Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755019AbbFESGR (ORCPT ); Fri, 5 Jun 2015 14:06:17 -0400 Received: from mail-vn0-f48.google.com ([209.85.216.48]:33955 "EHLO mail-vn0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932671AbbFESGQ (ORCPT ); Fri, 5 Jun 2015 14:06:16 -0400 MIME-Version: 1.0 In-Reply-To: <1433516792-16397-1-git-send-email-eric.auger@linaro.org> References: <1433516792-16397-1-git-send-email-eric.auger@linaro.org> From: Rob Herring Date: Fri, 5 Jun 2015 13:05:54 -0500 Message-ID: Subject: Re: [PATCH v2 0/4] VFIO platform reset To: Eric Auger Cc: eric.auger@st.com, "linux-arm-kernel@lists.infradead.org" , alex.williamson@redhat.com, b.reynal@virtualopensystems.com, Alexander Graf , "linux-kernel@vger.kernel.org" , Christoffer Dall , Linaro Patches Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3942 Lines: 88 On Fri, Jun 5, 2015 at 10:06 AM, Eric Auger wrote: > In situations where the userspace driver is stopped abnormally and the > VFIO platform device is released, the assigned HW device currently is > left running. As a consequence the HW device might continue issuing IRQs > and performing DMA accesses. > > On release, no physical IRQ handler is setup anymore. Also the DMA buffers > are unmapped leading to IOMMU aborts. So there is no serious consequence. > > However when assigning that HW device again to another userspace driver, > this latter might face some unexpected IRQs and DMA accesses, which are > the result of the previous assignment. In general, shouldn't it just be a requirement that the drivers handle this condition. You have the same problem with firmware/bootloaders leaving h/w not in reset state or kexec'ing to a new kernel. Rob > In virtualization use-case, a VM newly granted with that HW device may be > impacted by the assignment of that device to a previous VM: > - IRQs may be injected very early when booting the new guest, even before > the guest driver has initialized leading to possible driver state > inconsistency. > - DMA accesses may hit the newly mapped VM address space at addresses that > may jeopardize the integrity of the newly installed VM. > > Obviously the criticity depends on the assigned HW device. > > As opposed to PCI, there is no standard mechanism to reset the platform > device. > > This series proposes to implement device specific reset functions in > separate vfio reset modules (in-kernel or external). The vfio-platform > driver holds a whitelist of implemented triplets (compat string, module > name, function name). When the vfio-platform driver is probed it identifies > the fellow reset module/function matching the compat string of the > device, if any, and forces the load of this reset module. > > A first reset module is provided: the vfio-platform-calxedaxgmac > module which implements a basic reset for the Calxeda xgmac. > > The series can be found at > https://git.linaro.org/people/eric.auger/linux.git/shortlog/refs/heads/v4.1-rc6-reset-v2 > > History: > v1 -> v2: > - much simplified compared to v1 although principle of external modules is > kept: removed mechanism of dynamic registration of reset functions > - list is replaced by whitelist lookup table > - name of the reset function also stored in the lookup table > - autoload of reset modules > > RFC -> PATCH v1: > - solution now based on a lookup list instead of specialized driver > > > Eric Auger (4): > VFIO: platform: add reset struct and lookup table > VFIO: platform: add reset callback > VFIO: platform: populate the reset function on probe > VFIO: platform: Calxeda xgmac reset module > > drivers/vfio/platform/Kconfig | 2 + > drivers/vfio/platform/Makefile | 2 + > drivers/vfio/platform/reset/Kconfig | 7 ++ > drivers/vfio/platform/reset/Makefile | 5 ++ > .../platform/reset/vfio_platform_calxedaxgmac.c | 98 ++++++++++++++++++++++ > drivers/vfio/platform/vfio_platform_common.c | 75 ++++++++++++++++- > drivers/vfio/platform/vfio_platform_private.h | 14 ++++ > 7 files changed, 200 insertions(+), 3 deletions(-) > create mode 100644 drivers/vfio/platform/reset/Kconfig > create mode 100644 drivers/vfio/platform/reset/Makefile > create mode 100644 drivers/vfio/platform/reset/vfio_platform_calxedaxgmac.c > > -- > 1.9.1 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/