[PATCH v2] ACPI: VIOT: Fix ACS setup

2022-06-30 Thread Eric Auger
at it, guard the call to pci_request_acs() with #ifdef CONFIG_PCI. Fixes: 3cf485540e7b ("ACPI: Add driver for the VIOT table") Signed-off-by: Eric Auger Reported-by: Jin Liu --- v1 -> v2: - guard acpi_viot_early_init() content with #ifdef CONFIG_PCI - do not call acpi_put_table() if a

Re: [PATCH] ACPI: VIOT: Fix ACS setup

2022-06-29 Thread Eric Auger
Hi Jean On 6/29/22 11:14, Jean-Philippe Brucker wrote: > Hi Eric, > > On Mon, Jun 27, 2022 at 02:55:34PM +0200, Eric Auger wrote: >> Currently acpi_viot_init() gets called after the pci >> device has been scanned and pci_enable_acs() has been called. >> So pci_requ

[PATCH] ACPI: VIOT: Fix ACS setup

2022-06-27 Thread Eric Auger
: 3cf485540e7b ("ACPI: Add driver for the VIOT table") Signed-off-by: Eric Auger Reported-by: Jin Liu --- drivers/acpi/bus.c| 1 + drivers/acpi/viot.c | 23 +-- include/linux/acpi_viot.h | 2 ++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/dr

Re: [PATCH] vfio: Remove VFIO_TYPE1_NESTING_IOMMU

2022-05-12 Thread Eric Auger
Hi, On 5/10/22 20:13, Jason Gunthorpe wrote: > On Tue, May 10, 2022 at 06:52:06PM +0100, Robin Murphy wrote: >> On 2022-05-10 17:55, Jason Gunthorpe via iommu wrote: >>> This control causes the ARM SMMU drivers to choose a stage 2 >>> implementation for the IO pagetable (vs the stage 1 usual

Re: [PATCH RFC 00/12] IOMMUFD Generic interface

2022-04-12 Thread Eric Auger
Hi Jason, On 4/12/22 10:22 PM, Jason Gunthorpe wrote: > On Tue, Apr 12, 2022 at 10:13:32PM +0200, Eric Auger wrote: >> Hi, >> >> On 3/18/22 6:27 PM, Jason Gunthorpe wrote: >>> iommufd is the user API to control the IOMMU subsystem as it relates to >>> man

Re: [PATCH RFC 00/12] IOMMUFD Generic interface

2022-04-12 Thread Eric Auger
able here: > https://github.com/luxis1999/iommufd/commits/iommufd-v5.17-rc6 > > Various parts of the above extended features are in WIP stages currently > to define how their IOCTL interface should work. > > At this point, using the draft VFIO series, unmodified qemu has been > tested

Re: [PATCH RFC 11/12] iommufd: vfio container FD ioctl compatibility

2022-03-24 Thread Eric Auger
Hi, On 3/24/22 1:33 AM, Jason Gunthorpe wrote: > On Wed, Mar 23, 2022 at 04:51:25PM -0600, Alex Williamson wrote: > >> My overall question here would be whether we can actually achieve a >> compatibility interface that has sufficient feature transparency that we >> can dump vfio code in favor of

Re: [PATCH v8 00/11] ACPI/IORT: Support for IORT RMR node

2022-03-15 Thread Eric Auger
Hi Shameer, On 2/21/22 4:43 PM, Shameer Kolothum wrote: > Hi, > > Since we now have an updated verion[0] of IORT spec(E.d) which > addresses the memory attributes issues discussed here [1], > this series now make use of it. > > The pull request for ACPICA E.d related changes are already > raised

Re: [PATCH v8 00/11] ACPI/IORT: Support for IORT RMR node

2022-03-14 Thread Eric Auger
Hi Robin On 3/11/22 11:34 AM, Robin Murphy wrote: > On 2022-03-11 08:19, Eric Auger wrote: >> Hi guys, >> >> On 2/21/22 4:43 PM, Shameer Kolothum wrote: >>> Hi, >>> >>> Since we now have an updated verion[0] of IORT spec(E.d) which >>>

Re: [PATCH v8 00/11] ACPI/IORT: Support for IORT RMR node

2022-03-11 Thread Eric Auger
Hi guys, On 2/21/22 4:43 PM, Shameer Kolothum wrote: > Hi, > > Since we now have an updated verion[0] of IORT spec(E.d) which > addresses the memory attributes issues discussed here [1], > this series now make use of it. > > The pull request for ACPICA E.d related changes are already > raised and

Re: [PATCH v8 00/11] ACPI/IORT: Support for IORT RMR node

2022-03-11 Thread Eric Auger
layout and the now allowed multiple RID ID mapping format) and this worked for me. Feel free to add my Tested-by: Eric Auger Thanks Eric > > Please take a look and let me know your thoughts. > > Thanks, > Shameer > [0] https://developer.arm.com/documentation/den0049/ed/ > [1] http

Re: [PATCH v8 03/11] ACPI/IORT: Add helper functions to parse RMR nodes

2022-03-10 Thread Eric Auger
Hi Shameer, On 2/21/22 4:43 PM, Shameer Kolothum wrote: > The helper functions here parse through the IORT RMR nodes and > populate a reserved region list corresponding to a given iommu > and device(optional). These also go through the ID mappings of > the RMR node and retrieves all the SIDs

Re: [PATCH v8 00/11] Fix BUG_ON in vfio_iommu_group_notifier()

2022-03-10 Thread Eric Auger
gt; intercepting it in the bus notifier for driver unbinding. We agreed > that the driver structure should not be used out of the driver core. > - As iommu_group_claim/release_dma_owner() are only used by the VFIO, > there're no use cases for multiple calls for a single group.

Re: [PATCH v7 01/11] iommu: Add DMA ownership management interfaces

2022-03-07 Thread Eric Auger
Hi Lu, On 3/7/22 4:27 AM, Lu Baolu wrote: > Hi Robin, > > On 3/4/22 10:10 PM, Robin Murphy wrote: >> On 2022-03-04 13:55, Eric Auger wrote: >>> Hi Robin, >>> >>> On 3/4/22 1:22 PM, Robin Murphy wrote: >>>> On 2022-03-04 10:43, Lu Baolu wro

Re: [PATCH v7 01/11] iommu: Add DMA ownership management interfaces

2022-03-04 Thread Eric Auger
Hi Robin, On 3/4/22 1:22 PM, Robin Murphy wrote: > On 2022-03-04 10:43, Lu Baolu wrote: >> Hi Eric, >> >> On 2022/3/4 18:34, Eric Auger wrote: >>> I hit a WARN_ON() when unbinding an e1000e driver just after boot: >>> >>> sudo modprobe -v vfio-pci

Re: [PATCH v7 01/11] iommu: Add DMA ownership management interfaces

2022-03-04 Thread Eric Auger
Hi Lu, On 2/28/22 1:50 AM, Lu Baolu wrote: > Multiple devices may be placed in the same IOMMU group because they > cannot be isolated from each other. These devices must either be > entirely under kernel control or userspace control, never a mixture. > > This adds dma ownership management in

Re: [RFC v16 1/9] iommu: Introduce attach/detach_pasid_table API

2021-12-09 Thread Eric Auger
Hi Jason, On 12/9/21 4:40 PM, Jason Gunthorpe wrote: > On Thu, Dec 09, 2021 at 08:50:04AM +0100, Eric Auger wrote: > >>> The kernel API should accept the S1ContextPtr IPA and all the parts of >>> the STE that relate to the defining the layout of what the S1Contex

Re: [RFC v16 1/9] iommu: Introduce attach/detach_pasid_table API

2021-12-09 Thread Eric Auger
Hi Kevin, On 12/9/21 4:21 AM, Tian, Kevin wrote: >> From: Jason Gunthorpe >> Sent: Wednesday, December 8, 2021 8:56 PM >> >> On Wed, Dec 08, 2021 at 08:33:33AM +0100, Eric Auger wrote: >>> Hi Baolu, >>> >>> On 12/8/21 3:44 AM, Lu Baolu wrot

Re: [RFC v16 1/9] iommu: Introduce attach/detach_pasid_table API

2021-12-09 Thread Eric Auger
Hi Jason, On 12/8/21 1:56 PM, Jason Gunthorpe wrote: > On Wed, Dec 08, 2021 at 08:33:33AM +0100, Eric Auger wrote: >> Hi Baolu, >> >> On 12/8/21 3:44 AM, Lu Baolu wrote: >>> Hi Eric, >>> >>> On 12/7/21 6:22 PM, Eric Auger wrote: >>>> O

Re: [RFC v16 1/9] iommu: Introduce attach/detach_pasid_table API

2021-12-08 Thread Eric Auger
Hi Jason, On 12/8/21 7:31 PM, Jason Gunthorpe wrote: > On Wed, Dec 08, 2021 at 05:20:39PM +, Jean-Philippe Brucker wrote: >> On Wed, Dec 08, 2021 at 08:56:16AM -0400, Jason Gunthorpe wrote: >>> From a progress perspective I would like to start with simple 'page >>> tables in userspace', ie no

Re: [RFC v16 1/9] iommu: Introduce attach/detach_pasid_table API

2021-12-07 Thread Eric Auger
Hi Baolu, On 12/8/21 3:44 AM, Lu Baolu wrote: > Hi Eric, > > On 12/7/21 6:22 PM, Eric Auger wrote: >> On 12/6/21 11:48 AM, Joerg Roedel wrote: >>> On Wed, Oct 27, 2021 at 12:44:20PM +0200, Eric Auger wrote: >>>> Signed-off-by: Jean-Philippe Brucker >>&

Re: [RFC v16 0/9] SMMUv3 Nested Stage Setup (IOMMU part)

2021-12-07 Thread Eric Auger
Hi Zhangfei, On 12/7/21 11:35 AM, Zhangfei Gao wrote: > > > On 2021/12/7 下午6:27, Eric Auger wrote: >> Hi Zhangfei, >> >> On 12/3/21 1:27 PM, Zhangfei Gao wrote: >>> Hi, Eric >>> >>> On 2021/10/27 下午6:44, Eric Auger wrote: >>>

Re: [RFC v16 0/9] SMMUv3 Nested Stage Setup (IOMMU part)

2021-12-07 Thread Eric Auger
3_v10 >> (use iommu=nested-smmuv3 ARM virt option) >> >> Guest dependency: >> [1] [PATCH v7 0/9] ACPI/IORT: Support for IORT RMR node >> >> History: >> >> v15 -> v16: >> - guest RIL must support RIL >> - additional checks in the cache inv

Re: [RFC v16 0/9] SMMUv3 Nested Stage Setup (IOMMU part)

2021-12-07 Thread Eric Auger
Hi Zhangfei, On 12/3/21 1:27 PM, Zhangfei Gao wrote: > > Hi, Eric > > On 2021/10/27 下午6:44, Eric Auger wrote: >> This series brings the IOMMU part of HW nested paging support >> in the SMMUv3. >> >> The SMMUv3 driver is adapted to support 2 nested stages. >&

Re: [RFC v16 1/9] iommu: Introduce attach/detach_pasid_table API

2021-12-07 Thread Eric Auger
Hi Joerg, On 12/6/21 11:48 AM, Joerg Roedel wrote: > On Wed, Oct 27, 2021 at 12:44:20PM +0200, Eric Auger wrote: >> Signed-off-by: Jean-Philippe Brucker >> Signed-off-by: Liu, Yi L >> Signed-off-by: Ashok Raj >> Signed-off-by: Jacob Pan >> Signed-off-by: Eric

Re: [PATCH v3 2/5] iommu/virtio: Support bypass domains

2021-12-02 Thread Eric Auger
gt; currently fail attaching to an identity domain. Future patches will > instead create identity mappings in this case. > > Reviewed-by: Kevin Tian > Signed-off-by: Jean-Philippe Brucker Reviewed-by: Eric Auger Eric > --- > drivers/iommu/virtio-iommu.c | 20 +++- &g

Re: [PATCH v3 1/5] iommu/virtio: Add definitions for VIRTIO_IOMMU_F_BYPASS_CONFIG

2021-12-02 Thread Eric Auger
Hi Jean, On 12/1/21 6:33 PM, Jean-Philippe Brucker wrote: > Add definitions for the VIRTIO_IOMMU_F_BYPASS_CONFIG, which supersedes > VIRTIO_IOMMU_F_BYPASS. > > Reviewed-by: Kevin Tian > Signed-off-by: Jean-Philippe Brucker Reviewed-by: Eric Auger Eric > --- >

Re: [PATCH v2 5/5] iommu/virtio: Support identity-mapped domains

2021-11-27 Thread Eric Auger
vdomain->bypass = true; > + return 0; > + } > + > + ret = viommu_domain_map_identity(vdev, vdomain); > + if (ret) { > ida_free(>domain_ids, vdomain->id); > - vdomain-

Re: [PATCH v2 3/5] iommu/virtio: Sort reserved regions

2021-11-27 Thread Eric Auger
Hi Jean, On 11/23/21 4:53 PM, Jean-Philippe Brucker wrote: > To ease identity mapping support, keep the list of reserved regions > sorted. > > Reviewed-by: Kevin Tian > Signed-off-by: Jean-Philippe Brucker Reviewed-by: Eric Auger Eric > --- > drivers/iommu/virtio-iommu

Re: [PATCH v2 4/5] iommu/virtio: Pass end address to viommu_add_mapping()

2021-11-27 Thread Eric Auger
e returned size was never true: when > sweeping the whole address space the returned size will most certainly > be smaller than 2^64. > > Reviewed-by: Kevin Tian > Signed-off-by: Jean-Philippe Brucker Reviewed-by: Eric Auger Eric > --- > drivers/iommu/virtio-iommu.c | 31 +

Re: [PATCH v2 2/5] iommu/virtio: Support bypass domains

2021-11-27 Thread Eric Auger
Hi Jean, On 11/23/21 4:52 PM, Jean-Philippe Brucker wrote: > The VIRTIO_IOMMU_F_BYPASS_CONFIG feature adds a new flag to the ATTACH > request, that creates a bypass domain. Use it to enable identity > domains. > > When VIRTIO_IOMMU_F_BYPASS_CONFIG is not supported by the device, we > currently

Re: [PATCH v2 1/5] iommu/virtio: Add definitions for VIRTIO_IOMMU_F_BYPASS_CONFIG

2021-11-26 Thread Eric Auger
Hi Jean, On 11/23/21 4:52 PM, Jean-Philippe Brucker wrote: > Add definitions for the VIRTIO_IOMMU_F_BYPASS_CONFIG, which supersedes > VIRTIO_IOMMU_F_BYPASS. > > Reviewed-by: Kevin Tian > Signed-off-by: Jean-Philippe Brucker > --- > include/uapi/linux/virtio_iommu.h | 8 +++- > 1 file

[RFC v16 9/9] iommu/smmuv3: Disallow nested mode in presence of HW MSI regions

2021-10-27 Thread Eric Auger
in such configuration. Signed-off-by: Eric Auger --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 23 + 1 file changed, 23 insertions(+) diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c index ddfc069c10ae..12e7d7920f27 100644

[RFC v16 8/9] iommu/smmuv3: report additional recoverable faults

2021-10-27 Thread Eric Auger
Up to now we have only reported translation faults. Now that the guest can induce some configuration faults, let's report them too. Add propagation for BAD_SUBSTREAMID, CD_FETCH, BAD_CD, WALK_EABT. We also fix the transcoding for some existing translation faults. Signed-off-by: Eric Auger

[RFC v16 7/9] iommu/smmuv3: Implement cache_invalidate

2021-10-27 Thread Eric Auger
Implement domain-selective, pasid selective and page-selective IOTLB invalidations. Signed-off-by: Eric Auger --- v15 -> v16: - make sure the range is set (RIL guest) and check the granule size is supported by the physical IOMMU - use cmd_with_sync v14 -> v15: - remove the red

[RFC v16 6/9] iommu/smmuv3: Allow stage 1 invalidation with unmanaged ASIDs

2021-10-27 Thread Eric Auger
With nested stage support, soon we will need to invalidate S1 contexts and ranges tagged with an unmanaged asid, this latter being managed by the guest. So let's introduce 2 helpers that allow to invalidate with externally managed ASIDs Signed-off-by: Eric Auger --- v15 -> v16: -

[RFC v16 5/9] iommu/smmuv3: Implement attach/detach_pasid_table

2021-10-27 Thread Eric Auger
. Signed-off-by: Eric Auger --- v14 -> v15: - add a comment before arm_smmu_get_cd_ptr to warn the developper this function must not be used in case of nested (Keqian) v13 -> v14: - on PASID table detach, reset the abort flag (Keqian) v7 -> v8: - remove smmu->features check, now do

[RFC v16 4/9] iommu/smmuv3: Get prepared for nested stage support

2021-10-27 Thread Eric Auger
to write both stage fields in the STE and deal with the abort field. In nested mode, only stage 2 is "finalized" as the host does not own/configure the stage 1 context descriptor; guest does. Signed-off-by: Eric Auger --- v13 -> v14: - removed BUG_ON(ste_live && !nested)

[RFC v16 3/9] iommu/smmuv3: Allow s1 and s2 configs to coexist

2021-10-27 Thread Eric Auger
oth stages are used and the S1 config is "set" when the guest passes its pasid table. No functional change intended. Signed-off-by: Eric Auger --- v13 -> v14: - slight reword of the commit message v12 -> v13: - does not dynamically allocate s1-cfg and s2_cfg anymore. Add the se

[RFC v16 2/9] iommu: Introduce iommu_get_nesting

2021-10-27 Thread Eric Auger
Add iommu_get_nesting() which allow to retrieve whether a domain uses nested stages. Signed-off-by: Eric Auger --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 8 drivers/iommu/arm/arm-smmu/arm-smmu.c | 8 drivers/iommu/intel/iommu.c | 13

[RFC v16 1/9] iommu: Introduce attach/detach_pasid_table API

2021-10-27 Thread Eric Auger
. A generic iommu_pasid_table_config struct is introduced in a new iommu.h uapi header. This is going to be used by the VFIO user API. Signed-off-by: Jean-Philippe Brucker Signed-off-by: Liu, Yi L Signed-off-by: Ashok Raj Signed-off-by: Jacob Pan Signed-off-by: Eric Auger --- v13 ->

[RFC v16 0/9] SMMUv3 Nested Stage Setup (IOMMU part)

2021-10-27 Thread Eric Auger
RMR node History: v15 -> v16: - guest RIL must support RIL - additional checks in the cache invalidation hook - removal of the MSI BINDING ioctl (tentative replacement by RMRs) Eric Auger (9): iommu: Introduce attach/detach_pasid_table API iommu: Introduce iommu_get_nesting iommu/smm

Re: [PATCH v7 0/9] ACPI/IORT: Support for IORT RMR node

2021-09-30 Thread Eric Auger
Hi Shameer, On 8/5/21 10:07 AM, Shameer Kolothum wrote: > Hi, > > The series adds support to IORT RMR nodes specified in IORT > Revision E.b -ARM DEN 0049E[0]. RMR nodes are used to describe > memory ranges that are used by endpoints and require a unity > mapping in SMMU. I used your series and

Re: [PATCH v15 00/12] SMMUv3 Nested Stage Setup (IOMMU part)

2021-09-28 Thread Eric Auger
Hi Krishna, On 9/27/21 11:17 PM, Krishna Reddy wrote: > Hi Eric, >> This is based on Jean-Philippe's >> [PATCH v14 00/10] iommu: I/O page faults for SMMUv3 >> https://www.spinics.net/lists/arm-kernel/msg886518.html >> (including the patches that were not pulled for 5.13) >> > Jean's patches have

Re: [RFC 03/20] vfio: Add vfio_[un]register_device()

2021-09-23 Thread Eric Auger
Hi, On 9/22/21 3:00 AM, Jason Gunthorpe wrote: > On Wed, Sep 22, 2021 at 12:54:02AM +, Tian, Kevin wrote: >>> From: Jason Gunthorpe >>> Sent: Wednesday, September 22, 2021 12:01 AM >>> One open about how to organize the device nodes under >>> /dev/vfio/devices/. This RFC adopts a

Re: [RFC 09/20] iommu: Add page size and address width attributes

2021-09-22 Thread Eric Auger
Hi, On 9/19/21 8:38 AM, Liu Yi L wrote: > From: Lu Baolu > > This exposes PAGE_SIZE and ADDR_WIDTH attributes. The iommufd could use > them to define the IOAS. > > Signed-off-by: Lu Baolu > --- > include/linux/iommu.h | 4 > 1 file changed, 4 insertions(+) > > diff --git

Re: [RFC v2] /dev/iommu uAPI proposal

2021-08-10 Thread Eric Auger
Hi Kevin, On 8/5/21 2:36 AM, Tian, Kevin wrote: >> From: Eric Auger >> Sent: Wednesday, August 4, 2021 11:59 PM >> > [...] >>> 1.2. Attach Device to I/O address space >>> +++ >>> >>> Device at

Re: [RFC v2] /dev/iommu uAPI proposal

2021-08-04 Thread Eric Auger
Hi Kevin, Few comments/questions below. On 7/9/21 9:48 AM, Tian, Kevin wrote: > /dev/iommu provides an unified interface for managing I/O page tables for > devices assigned to userspace. Device passthrough frameworks (VFIO, vDPA, > etc.) are expected to use this interface instead of creating

Re: [PATCH v5 2/5] ACPI: Move IOMMU setup code out of IORT

2021-06-22 Thread Eric Auger
n turn calls the acpi_iommu_fwspec_init() helper. > > Signed-off-by: Jean-Philippe Brucker Reviewed-by: Eric Auger Thanks Eric > --- > include/acpi/acpi_bus.h | 3 ++ > include/linux/acpi_iort.h | 8 ++--- > drivers/acpi/arm64/iort.c | 74 +---

Re: [PATCH v5 4/5] iommu/dma: Pass address limit rather than size to iommu_setup_dma_ops()

2021-06-22 Thread Eric Auger
>geometry. > * they can now be obtained from dev->dma_range_map on Arm. > But removing them on Arm isn't completely straightforward so is left for > future work. As an intermediate step, simplify the x86 callers by > passing dummy limits. > > Signed-off-by: Je

Re: [PATCH v4 6/6] iommu/virtio: Enable x86 support

2021-06-16 Thread Eric Auger
at the > moment. Similarly to Vt-d and AMD IOMMU, call iommu_setup_dma_ops() from > probe_finalize(). > > Acked-by: Joerg Roedel > Acked-by: Michael S. Tsirkin > Signed-off-by: Jean-Philippe Brucker Reviewed-by: Eric Auger Eric > --- > drivers/iommu/Kconfig| 3

Re: [PATCH v4 5/6] iommu/dma: Simplify calls to iommu_setup_dma_ops()

2021-06-16 Thread Eric Auger
setup_dma_ops(). > > Signed-off-by: Jean-Philippe Brucker Reviewed-by: Eric Auger Eric > --- > drivers/iommu/amd/iommu.c | 9 + > drivers/iommu/dma-iommu.c | 4 +++- > drivers/iommu/intel/iommu.c | 10 +- > 3 files changed, 5 insertions(+), 18 deletions

Re: [PATCH v4 4/6] iommu/dma: Pass address limit rather than size to iommu_setup_dma_ops()

2021-06-16 Thread Eric Auger
Hi Jean, On 6/10/21 9:51 AM, Jean-Philippe Brucker wrote: > Passing a 64-bit address width to iommu_setup_dma_ops() is valid on > virtual platforms, but isn't currently possible. The overflow check in > iommu_dma_init_domain() prevents this even when @dma_base isn't 0. Pass > a limit address

Re: [PATCH v4 3/6] ACPI: Add driver for the VIOT table

2021-06-16 Thread Eric Auger
(); > + > + return viot_dev_iommu_init(>dev, ep->viommu, > +epid); > + } > + } > + return -ENODEV; > +} > + > +static int viot_mmio_dev_iommu_init(struct platform_device *pdev) > +{ > + struct resource *mem; > + struct viot_endpoint *ep; > + > + mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); > + if (!mem) > + return -ENODEV; > + > + list_for_each_entry(ep, _mmio_endpoints, list) { > + if (ep->address == mem->start) > + return viot_dev_iommu_init(>dev, ep->viommu, > +ep->endpoint_id); > + } > + return -ENODEV; > +} > + > +/** > + * viot_iommu_configure - Setup IOMMU ops for an endpoint described by VIOT > + * @dev: the endpoint > + * > + * Return: 0 on success, <0 on failure > + */ > +int viot_iommu_configure(struct device *dev) > +{ > + if (dev_is_pci(dev)) > + return pci_for_each_dma_alias(to_pci_dev(dev), > + viot_pci_dev_iommu_init, NULL); > + else if (dev_is_platform(dev)) > + return viot_mmio_dev_iommu_init(to_platform_device(dev)); > + return -ENODEV; > +} > diff --git a/MAINTAINERS b/MAINTAINERS > index b706dd20ff2b..8d71591f979a 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -431,6 +431,14 @@ W: https://01.org/linux-acpi > B: https://bugzilla.kernel.org > F: drivers/acpi/acpi_video.c > > +ACPI VIOT DRIVER > +M: Jean-Philippe Brucker > +L: linux-a...@vger.kernel.org > +L: iommu@lists.linux-foundation.org > +S: Maintained > +F: drivers/acpi/viot.c > +F: include/linux/acpi_viot.h > + > ACPI WMI DRIVER > L: platform-driver-...@vger.kernel.org > S: Orphan Besides Reviewed-by: Eric Auger Thanks Eric ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH v4 0/6] Add support for ACPI VIOT

2021-06-16 Thread Eric Auger
> https://lore.kernel.org/linux-iommu/2021060215.1077006-1-jean-phili...@linaro.org/ > [2] https://jpbrucker.net/git/qemu/log/?h=virtio-iommu/acpi > [3] https://jpbrucker.net/git/linux/log/?h=virtio-iommu/acpi I tested the series on both aarch64 and x86_64 with qemu. It works for me.

Re: [PATCH v4 1/6] ACPI: arm64: Move DMA setup operations out of IORT

2021-06-16 Thread Eric Auger
t; > Signed-off-by: Jean-Philippe Brucker Reviewed-by: Eric Auger Eric > --- > drivers/acpi/arm64/Makefile | 1 + > include/linux/acpi.h| 3 +++ > include/linux/acpi_iort.h | 6 ++--- > drivers/acpi/arm64/dma.c| 50 ++ &g

Re: [PATCH v4 2/6] ACPI: Move IOMMU setup code out of IORT

2021-06-16 Thread Eric Auger
Hi jean, On 6/10/21 9:51 AM, Jean-Philippe Brucker wrote: > Extract the code that sets up the IOMMU infrastructure from IORT, since > it can be reused by VIOT. Move it one level up into a new > acpi_iommu_configure_id() function, which calls the IORT parsing > function which in turn calls the

Re: Plan for /dev/ioasid RFC v2

2021-06-09 Thread Eric Auger
Hi Kevin, On 6/9/21 11:37 AM, Tian, Kevin wrote: >> From: Eric Auger >> Sent: Wednesday, June 9, 2021 4:15 PM >> >> Hi Kevin, >> >> On 6/7/21 4:58 AM, Tian, Kevin wrote: >>> Hi, all, >>> >>> We plan to work on v2 now, given

Re: Plan for /dev/ioasid RFC v2

2021-06-09 Thread Eric Auger
Hi Kevin, On 6/7/21 4:58 AM, Tian, Kevin wrote: > Hi, all, > > We plan to work on v2 now, given many good comments already received > and substantial changes envisioned. This is a very complex topic with > many sub-threads being discussed. To ensure that I didn't miss valuable > suggestions (and

[PATCH v13 13/13] vfio/pci: Inject page response upon response region fill

2021-04-11 Thread Eric Auger
When the userspace increments the head of the page response buffer ring, let's push the response into the iommu layer. This is done through a workqueue that pops the responses from the ring buffer and increment the tail. Signed-off-by: Eric Auger --- drivers/vfio/pci/vfio_pci.c | 40

[PATCH v13 12/13] vfio/pci: Register a DMA fault response region

2021-04-11 Thread Eric Auger
In preparation for vSVA, let's register a DMA fault response region, where the userspace will push the page responses and increment the head of the buffer. The kernel will pop those responses and inject them on iommu side. Signed-off-by: Eric Auger --- v11 -> v12: - use DMA_FAULT_RESPONSE

[PATCH v13 11/13] vfio: Document nested stage control

2021-04-11 Thread Eric Auger
The VFIO API was enhanced to support nested stage control: a bunch of new iotcls, one DMA FAULT region and an associated specific IRQ. Let's document the process to follow to set up nested mode. Signed-off-by: Eric Auger --- v11 -> v12: s/VFIO_REGION_INFO_CAP_PRODUCER_FA

[PATCH v13 10/13] vfio/pci: Register and allow DMA FAULT IRQ signaling

2021-04-11 Thread Eric Auger
Register the VFIO_IRQ_TYPE_NESTED/VFIO_IRQ_SUBTYPE_DMA_FAULT IRQ that allows to signal a nested mode DMA fault. Signed-off-by: Eric Auger --- v10 -> v11: - the irq now is registered in vfio_pci_dma_fault_init() in case the domain is nested --- drivers/vfio/pci/vfio_pci.c |

[PATCH v13 09/13] vfio: Add new IRQ for DMA fault reporting

2021-04-11 Thread Eric Auger
Add a new IRQ type/subtype to get notification on nested stage DMA faults. Signed-off-by: Eric Auger --- include/uapi/linux/vfio.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h index 0728b6f3f348..ad7c275b4074 100644 --- a/include

[PATCH v13 08/13] vfio/pci: Add framework for custom interrupt indices

2021-04-11 Thread Eric Auger
Implement IRQ capability chain infrastructure. All interrupt indexes beyond VFIO_PCI_NUM_IRQS are handled as extended interrupts. They are registered with a specific type/subtype and supported flags. Signed-off-by: Eric Auger --- v11 -> v12: - check !vdev->num_ex

[PATCH v13 07/13] vfio: Use capability chains to handle device specific irq

2021-04-11 Thread Eric Auger
From: Tina Zhang Caps the number of irqs with fixed indexes and uses capability chains to chain device specific irqs. Signed-off-by: Tina Zhang Signed-off-by: Eric Auger [Eric: Put cap_offset at the end of the vfio_irq_info struct, remove GFX IRQ at the moment and remove any reference

[PATCH v13 06/13] vfio/pci: Allow to mmap the fault queue

2021-04-11 Thread Eric Auger
The DMA FAULT region contains the fault ring buffer. There is benefit to let the userspace mmap this area. Expose this mmappable area through a sparse mmap entry and implement the mmap operation. Signed-off-by: Eric Auger --- v8 -> v9: - remove unused index local varia

[PATCH v13 05/13] vfio/pci: Register an iommu fault handler

2021-04-11 Thread Eric Auger
Register an IOMMU fault handler which records faults in the DMA FAULT region ring buffer. In a subsequent patch, we will add the signaling of a specific eventfd to allow the userspace to be notified whenever a new fault has shown up. Signed-off-by: Eric Auger --- v11 -> v12: - t

[PATCH v13 04/13] vfio/pci: Add VFIO_REGION_TYPE_NESTED region type

2021-04-11 Thread Eric Auger
, entry size). At the moment the region is dimensionned for 512 fault records. Signed-off-by: Eric Auger --- v11 -> v12: - set fault_pages to NULL after free - check new_tail >= header->nb_entries (Zenghui) - update value of VFIO_REGION_TYPE_NESTED - handle the case where the domain is NU

[PATCH v13 03/13] vfio: VFIO_IOMMU_SET_MSI_BINDING

2021-04-11 Thread Eric Auger
This patch adds the VFIO_IOMMU_SET_MSI_BINDING ioctl which aim to (un)register the guest MSI binding to the host. This latter then can use those stage 1 bindings to build a nested stage binding targeting the physical MSIs. Signed-off-by: Eric Auger --- v11 -> v12: - Share VFIO_BASE +

[PATCH v13 02/13] vfio: VFIO_IOMMU_CACHE_INVALIDATE

2021-04-11 Thread Eric Auger
DATE ioctl with aims at propagating guest stage1 IOMMU cache invalidations to the host. Signed-off-by: Liu, Yi L Signed-off-by: Eric Auger --- v12 -> v13: - resolve minor conflict due to 898b9eaeb3fe ("vfio/type1: block on invalid vaddr") v11 -> v12: - share VFIO_BASE + 19 with VFI

[PATCH v13 01/13] vfio: VFIO_IOMMU_SET_PASID_TABLE

2021-04-11 Thread Eric Auger
From: "Liu, Yi L" This patch adds an VFIO_IOMMU_SET_PASID_TABLE ioctl which aims to pass the virtual iommu guest configuration to the host. This latter takes the form of the so-called PASID table. Signed-off-by: Jacob Pan Signed-off-by: Liu, Yi L Signed-off-by: Eric Auger ---

[PATCH v13 00/13] SMMUv3 Nested Stage Setup (VFIO part)

2021-04-11 Thread Eric Auger
ponse region - Took into account Zenghui's comments - In this version I have kept the ioctl separate. Since Yi's series [2] is currently stalled, I've just rebased here. [2] [PATCH v7 00/16] vfio: expose virtual Shared Virtual Addressing to VMs v9 -> v10 - rebase on top of 5.6.0-rc3 (no change vers

[PATCH v15 12/12] iommu/smmuv3: report additional recoverable faults

2021-04-11 Thread Eric Auger
Up to now we have only reported translation faults. Now that the guest can induce some configuration faults, let's report them too. Add propagation for BAD_SUBSTREAMID, CD_FETCH, BAD_CD, WALK_EABT. We also fix the transcoding for some existing translation faults. Signed-off-by: Eric Auger

[PATCH v15 11/12] iommu/smmuv3: Implement bind/unbind_guest_msi

2021-04-11 Thread Eric Auger
The bind/unbind_guest_msi() callbacks check the domain is NESTED and redirect to the dma-iommu implementation. Signed-off-by: Eric Auger --- v6 -> v7: - remove device handle argument --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 43 + 1 file changed, 43 inserti

[PATCH v15 10/12] iommu/smmuv3: Enforce incompatibility between nested mode and HW MSI regions

2021-04-11 Thread Eric Auger
Nested mode currently is not compatible with HW MSI reserved regions. Indeed MSI transactions targeting this MSI doorbells bypass the SMMU. Let's check nested mode is not attempted in such configuration. Signed-off-by: Eric Auger --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 23

[PATCH v15 09/12] iommu/smmuv3: Nested mode single MSI doorbell per domain enforcement

2021-04-11 Thread Eric Auger
into the correct physical doorbell. So let's forbid this situation. Signed-off-by: Eric Auger --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 41 + 1 file changed, 41 insertions(+) diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c

[PATCH v15 08/12] dma-iommu: Implement NESTED_MSI cookie

2021-04-11 Thread Eric Auger
ectly mapped through both stages. Nested mode is not compatible with HW MSI regions as in that case gDB and hDB should have a 1-1 mapping. This check will be done when attaching each device to the IOMMU domain. Signed-off-by: Eric Auger --- v14 -> v15: Took into account Zenghui's comments - re

[PATCH v15 07/12] iommu/smmuv3: Implement cache_invalidate

2021-04-11 Thread Eric Auger
Implement domain-selective, pasid selective and page-selective IOTLB invalidations. Signed-off-by: Eric Auger --- v4 -> v15: - remove the redundant arm_smmu_cmdq_issue_sync(smmu) in IOMMU_INV_GRANU_ADDR case (Zenghui) - if RIL is not supported by the host, make sure the granule_s

[PATCH v15 06/12] iommu/smmuv3: Allow stage 1 invalidation with unmanaged ASIDs

2021-04-11 Thread Eric Auger
With nested stage support, soon we will need to invalidate S1 contexts and ranges tagged with an unmanaged asid, this latter being managed by the guest. So let's introduce 2 helpers that allow to invalidate with externally managed ASIDs Signed-off-by: Eric Auger --- v14 -> v15: - Always s

[PATCH v15 05/12] iommu/smmuv3: Implement attach/detach_pasid_table

2021-04-11 Thread Eric Auger
. Signed-off-by: Eric Auger --- v14 -> v15: - add a comment before arm_smmu_get_cd_ptr to warn the developper this function must not be used in case of nested (Keqian) v13 -> v14: - on PASID table detach, reset the abort flag (Keqian) v7 -> v8: - remove smmu->features check, now do

[PATCH v15 03/12] iommu/smmuv3: Allow s1 and s2 configs to coexist

2021-04-11 Thread Eric Auger
oth stages are used and the S1 config is "set" when the guest passes its pasid table. No functional change intended. Signed-off-by: Eric Auger --- v13 -> v14: - slight reword of the commit message v12 -> v13: - does not dynamically allocate s1-cfg and s2_cfg anymore. Add the se

[PATCH v15 02/12] iommu: Introduce bind/unbind_guest_msi

2021-04-11 Thread Eric Auger
nd similarly a single virtual doorbell mapping gets registered (1 single virtual doorbell is used on guest as well). Signed-off-by: Eric Auger --- v13 -> v14: - s/iova/giova in iommu_unbind_guest_msi proto (Kequian) v7 -> v8: - dummy iommu_unbind_guest_msi turned into a void function

[PATCH v15 01/12] iommu: Introduce attach/detach_pasid_table API

2021-04-11 Thread Eric Auger
. A generic iommu_pasid_table_config struct is introduced in a new iommu.h uapi header. This is going to be used by the VFIO user API. Signed-off-by: Jean-Philippe Brucker Signed-off-by: Liu, Yi L Signed-off-by: Ashok Raj Signed-off-by: Jacob Pan Signed-off-by: Eric Auger --- v13 ->

[PATCH v15 00/12] SMMUv3 Nested Stage Setup (IOMMU part)

2021-04-11 Thread Eric Auger
;device structure" according to the last version v11 -> v12: - rebase on top of v5.10-rc4 Eric Auger (12): iommu: Introduce attach/detach_pasid_table API iommu: Introduce bind/unbind_guest_msi iommu/smmuv3: Allow s1 and s2 configs to coexist iommu/smmuv3: Get prepared for nes

[PATCH v12 10/13] vfio/pci: Register and allow DMA FAULT IRQ signaling

2021-02-23 Thread Eric Auger
Register the VFIO_IRQ_TYPE_NESTED/VFIO_IRQ_SUBTYPE_DMA_FAULT IRQ that allows to signal a nested mode DMA fault. Signed-off-by: Eric Auger --- v10 -> v11: - the irq now is registered in vfio_pci_dma_fault_init() in case the domain is nested --- drivers/vfio/pci/vfio_pci.c |

[PATCH v12 13/13] vfio/pci: Inject page response upon response region fill

2021-02-23 Thread Eric Auger
When the userspace increments the head of the page response buffer ring, let's push the response into the iommu layer. This is done through a workqueue that pops the responses from the ring buffer and increment the tail. Signed-off-by: Eric Auger --- drivers/vfio/pci/vfio_pci.c | 40

[PATCH v12 12/13] vfio/pci: Register a DMA fault response region

2021-02-23 Thread Eric Auger
In preparation for vSVA, let's register a DMA fault response region, where the userspace will push the page responses and increment the head of the buffer. The kernel will pop those responses and inject them on iommu side. Signed-off-by: Eric Auger --- v11 -> v12: - use DMA_FAULT_RESPONSE

[PATCH v12 08/13] vfio/pci: Add framework for custom interrupt indices

2021-02-23 Thread Eric Auger
Implement IRQ capability chain infrastructure. All interrupt indexes beyond VFIO_PCI_NUM_IRQS are handled as extended interrupts. They are registered with a specific type/subtype and supported flags. Signed-off-by: Eric Auger --- v11 -> v12: - check !vdev->num_ex

[PATCH v12 11/13] vfio: Document nested stage control

2021-02-23 Thread Eric Auger
The VFIO API was enhanced to support nested stage control: a bunch of new iotcls, one DMA FAULT region and an associated specific IRQ. Let's document the process to follow to set up nested mode. Signed-off-by: Eric Auger --- v11 -> v12: s/VFIO_REGION_INFO_CAP_PRODUCER_FA

[PATCH v12 06/13] vfio/pci: Allow to mmap the fault queue

2021-02-23 Thread Eric Auger
The DMA FAULT region contains the fault ring buffer. There is benefit to let the userspace mmap this area. Expose this mmappable area through a sparse mmap entry and implement the mmap operation. Signed-off-by: Eric Auger --- v8 -> v9: - remove unused index local varia

[PATCH v12 05/13] vfio/pci: Register an iommu fault handler

2021-02-23 Thread Eric Auger
Register an IOMMU fault handler which records faults in the DMA FAULT region ring buffer. In a subsequent patch, we will add the signaling of a specific eventfd to allow the userspace to be notified whenever a new fault has shown up. Signed-off-by: Eric Auger --- v11 -> v12: - t

[PATCH v12 09/13] vfio: Add new IRQ for DMA fault reporting

2021-02-23 Thread Eric Auger
Add a new IRQ type/subtype to get notification on nested stage DMA faults. Signed-off-by: Eric Auger --- include/uapi/linux/vfio.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h index 3688215843fe..f0eea0f9305a 100644 --- a/include

[PATCH v12 00/13] SMMUv3 Nested Stage Setup (VFIO part)

2021-02-23 Thread Eric Auger
ntfd and expose the faults through an mmappable fault region v1 -> v2: - Added the fault reporting capability - asid properly passed on invalidation (fix assignment of multiple devices) - see individual change logs for more info Eric Auger (10): vfio: VFIO_IOMMU_SET_MSI_BINDING vfio

[PATCH v12 01/13] vfio: VFIO_IOMMU_SET_PASID_TABLE

2021-02-23 Thread Eric Auger
From: "Liu, Yi L" This patch adds an VFIO_IOMMU_SET_PASID_TABLE ioctl which aims to pass the virtual iommu guest configuration to the host. This latter takes the form of the so-called PASID table. Signed-off-by: Jacob Pan Signed-off-by: Liu, Yi L Signed-off-by: Eric Auger ---

[PATCH v12 03/13] vfio: VFIO_IOMMU_SET_MSI_BINDING

2021-02-23 Thread Eric Auger
This patch adds the VFIO_IOMMU_SET_MSI_BINDING ioctl which aim to (un)register the guest MSI binding to the host. This latter then can use those stage 1 bindings to build a nested stage binding targeting the physical MSIs. Signed-off-by: Eric Auger --- v11 -> v12: - Share VFIO_BASE +

[PATCH v12 04/13] vfio/pci: Add VFIO_REGION_TYPE_NESTED region type

2021-02-23 Thread Eric Auger
, entry size). At the moment the region is dimensionned for 512 fault records. Signed-off-by: Eric Auger --- v11 -> v12: - set fault_pages to NULL after free - check new_tail >= header->nb_entries (Zenghui) - update value of VFIO_REGION_TYPE_NESTED - handle the case where the domain is NU

[PATCH v12 02/13] vfio: VFIO_IOMMU_CACHE_INVALIDATE

2021-02-23 Thread Eric Auger
DATE ioctl with aims at propagating guest stage1 IOMMU cache invalidations to the host. Signed-off-by: Liu, Yi L Signed-off-by: Eric Auger --- v11 -> v12: - share VFIO_BASE + 19 with VFIO_IOMMU_SPAPR_TCE_CREATE v10 -> v11: - renamed ustruct into cache_inv v8 -> v9: - change the ioctl ID

[PATCH v14 13/13] iommu/smmuv3: Accept configs with more than one context descriptor

2021-02-23 Thread Eric Auger
In preparation for vSVA, let's accept userspace provided configs with more than one CD. We check the max CD against the host iommu capability and also the format (linear versus 2 level). Signed-off-by: Eric Auger Signed-off-by: Shameer Kolothum --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c

[PATCH v14 08/13] dma-iommu: Implement NESTED_MSI cookie

2021-02-23 Thread Eric Auger
ectly mapped through both stages. Nested mode is not compatible with HW MSI regions as in that case gDB and hDB should have a 1-1 mapping. This check will be done when attaching each device to the IOMMU domain. Signed-off-by: Eric Auger --- v10 -> v11: - fix compilation if !CONFIG_IOMMU_DMA v7 -

  1   2   3   4   5   6   7   8   9   10   >