Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops

2022-01-24 Thread Jean-Philippe Brucker
On Mon, Jan 24, 2022 at 09:58:18AM +, Tian, Kevin wrote: > > From: Lu Baolu > > Sent: Monday, January 24, 2022 3:11 PM > > +/** > > + * struct domain_ops - per-domain ops > > + * @attach_dev: attach an iommu domain to a device > > + * @detach_dev: detach an iommu domain from a device > >

Re: [PATCH 1/2] dt-bindings: Add Arm SMMUv3 PMCG binding

2021-12-10 Thread Jean-Philippe Brucker
On Thu, Nov 18, 2021 at 03:50:54PM +, Robin Murphy wrote: > > > + An SMMUv3 may have several Performance Monitor Counter Group (PMCG). > > > + They are standalone performance monitoring units that support both > > > + architected and IMPLEMENTATION DEFINED event counters. > > > > Humm, I

Re: [PATCH] iommu/arm-smmu-v3: Constify arm_smmu_mmu_notifier_ops

2021-12-10 Thread Jean-Philippe Brucker
> in read-only memory. > > Signed-off-by: Rikard Falkeborn Reviewed-by: Jean-Philippe Brucker > --- > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c

Re: [PATCH 1/4] ioasid: Reserve a global PASID for in-kernel DMA

2021-12-10 Thread Jean-Philippe Brucker
On Thu, Dec 09, 2021 at 10:14:04AM -0800, Jacob Pan wrote: > > This looks like we're just one step away from device drivers needing > > multiple PASIDs for kernel DMA so I'm trying to figure out how to evolve > > the API towards that. It's probably as simple as keeping a kernel IOASID > > set at

Re: [PATCH 1/4] ioasid: Reserve a global PASID for in-kernel DMA

2021-12-09 Thread Jean-Philippe Brucker
Hi Jacob, On Tue, Dec 07, 2021 at 05:47:11AM -0800, Jacob Pan wrote: > In-kernel DMA is managed by DMA mapping APIs, which supports per device > addressing mode for legacy DMA requests. With the introduction of > Process Address Space ID (PASID), device DMA can now target at a finer > granularity

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

2021-12-08 Thread Jean-Philippe Brucker
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 PASID in this step. > > 'page tables in userspace' means an iommufd ioctl to create an > iommu_domain where the IOMMU HW is directly

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

2021-12-01 Thread Jean-Philippe Brucker
identity mappings in this case. Reviewed-by: Kevin Tian Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/virtio-iommu.c | 20 +++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c index 80930ce04a16

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

2021-12-01 Thread Jean-Philippe Brucker
To ease identity mapping support, keep the list of reserved regions sorted. Reviewed-by: Eric Auger Reviewed-by: Kevin Tian Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/virtio-iommu.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/virtio

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

2021-12-01 Thread Jean-Philippe Brucker
size will most certainly be smaller than 2^64. Reviewed-by: Eric Auger Reviewed-by: Kevin Tian Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/virtio-iommu.c | 31 +++ 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/drivers/iommu/virtio

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

2021-12-01 Thread Jean-Philippe Brucker
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 changed, 7 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux

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

2021-12-01 Thread Jean-Philippe Brucker
itself to only perform DMA to suitable locations. In some cases it may even be desirable to perform DMA to MMIO regions. Reviewed-by: Eric Auger Reviewed-by: Kevin Tian Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/virtio-iommu.c | 61 +--- 1 file

[PATCH v3 0/5] iommu/virtio: Add identity domains

2021-12-01 Thread Jean-Philippe Brucker
/?h=virtio-iommu/bypass Jean-Philippe Brucker (5): iommu/virtio: Add definitions for VIRTIO_IOMMU_F_BYPASS_CONFIG iommu/virtio: Support bypass domains iommu/virtio: Sort reserved regions iommu/virtio: Pass end address to viommu_add_mapping() iommu/virtio: Support identity-mapped domains

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

2021-11-29 Thread Jean-Philippe Brucker
On Sat, Nov 27, 2021 at 06:09:56PM +0100, Eric Auger wrote: > > - vdomain->viommu = 0; > > + vdomain->viommu = NULL; > nit: that change could have been done in patch 2 Ah yes, I changed that in v2 but fixed up the wrong patch > > return

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

2021-11-29 Thread Jean-Philippe Brucker
On Sat, Nov 27, 2021 at 06:09:56PM -0500, Michael S. Tsirkin wrote: > > > -static int viommu_add_mapping(struct viommu_domain *vdomain, unsigned > > > long iova, > > > - phys_addr_t paddr, size_t size, u32 flags) > > > +static int viommu_add_mapping(struct viommu_domain

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

2021-11-29 Thread Jean-Philippe Brucker
On Sat, Nov 27, 2021 at 05:18:28PM +0100, Eric Auger wrote: > 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 >

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

2021-11-29 Thread Jean-Philippe Brucker
Hi Eric, On Sat, Nov 27, 2021 at 08:59:25AM +0100, Eric Auger wrote: > > @@ -36,6 +37,8 @@ struct virtio_iommu_config { > > struct virtio_iommu_range_32domain_range; > > /* Probe buffer size */ > > __le32 probe_size; > > + __u8

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

2021-11-23 Thread Jean-Philippe Brucker
size will most certainly be smaller than 2^64. Reviewed-by: Kevin Tian Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/virtio-iommu.c | 31 +++ 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio

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

2021-11-23 Thread Jean-Philippe Brucker
itself to only perform DMA to suitable locations. In some cases it may even be desirable to perform DMA to MMIO regions. Reviewed-by: Kevin Tian Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/virtio-iommu.c | 63 +--- 1 file changed, 58 insertions(+), 5

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

2021-11-23 Thread Jean-Philippe Brucker
To ease identity mapping support, keep the list of reserved regions sorted. Reviewed-by: Kevin Tian Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/virtio-iommu.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu

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

2021-11-23 Thread Jean-Philippe Brucker
identity mappings in this case. Reviewed-by: Kevin Tian Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/virtio-iommu.c | 20 +++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c index 80930ce04a16

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

2021-11-23 Thread Jean-Philippe Brucker
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 changed, 7 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux

[PATCH v2 0/5] iommu/virtio: Add identity domains

2021-11-23 Thread Jean-Philippe Brucker
/git/qemu/log/?h=virtio-iommu/bypass Jean-Philippe Brucker (5): iommu/virtio: Add definitions for VIRTIO_IOMMU_F_BYPASS_CONFIG iommu/virtio: Support bypass domains iommu/virtio: Sort reserved regions iommu/virtio: Pass end address to viommu_add_mapping() iommu/virtio: Support identity-mapped

[PATCH v2 3/3] perf/smmuv3: Synthesize IIDR from CoreSight ID registers

2021-11-17 Thread Jean-Philippe Brucker
Signed-off-by: Jean-Philippe Brucker --- drivers/perf/arm_smmuv3_pmu.c | 55 ++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c index 19697617153a..598d6978280d 100644 --- a/drivers/perf

[PATCH v2 2/3] perf/smmuv3: Add devicetree support

2021-11-17 Thread Jean-Philippe Brucker
Add device-tree support to the SMMUv3 PMCG driver. Signed-off-by: Jay Chen Signed-off-by: Jean-Philippe Brucker Signed-off-by: Robin Murphy --- drivers/perf/arm_smmuv3_pmu.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers

[PATCH v2 1/3] dt-bindings: Add Arm SMMUv3 PMCG binding

2021-11-17 Thread Jean-Philippe Brucker
for each TBU). Signed-off-by: Jean-Philippe Brucker Signed-off-by: Robin Murphy --- .../bindings/perf/arm,smmu-v3-pmcg.yaml | 70 +++ 1 file changed, 70 insertions(+) create mode 100644 Documentation/devicetree/bindings/perf/arm,smmu-v3-pmcg.yaml diff --git a/Documentation

[PATCH v2 0/3] perf/smmuv3: Support devicetree

2021-11-17 Thread Jean-Philippe Brucker
common across the tree.) [1] https://lore.kernel.org/linux-iommu/2026113536.69758-1-jean-phili...@linaro.org/ Jean-Philippe Brucker (2): dt-bindings: Add Arm SMMUv3 PMCG binding perf/smmuv3: Add devicetree support Robin Murphy (1): perf/smmuv3: Synthesize IIDR from CoreSight ID registers

Re: [PATCH 0/2] perf/smmuv3: Support devicetree

2021-11-16 Thread Jean-Philippe Brucker
On Tue, Nov 16, 2021 at 05:00:14PM +, Robin Murphy wrote: > On 2021-11-16 15:42, Jean-Philippe Brucker wrote: > > On Tue, Nov 16, 2021 at 12:02:47PM +, Robin Murphy wrote: > > > On 2021-11-16 11:35, Jean-Philippe Brucker wrote: > > > > Add devicetree bind

Re: [PATCH 1/2] dt-bindings: Add Arm SMMUv3 PMCG binding

2021-11-16 Thread Jean-Philippe Brucker
On Tue, Nov 16, 2021 at 08:02:53AM -0600, Rob Herring wrote: > My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' > on your patch (DT_CHECKER_FLAGS is new in v5.13): > > yamllint warnings/errors: > ./Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml:24:9: >

Re: [PATCH 2/2] perf/smmuv3: Add devicetree support

2021-11-16 Thread Jean-Philippe Brucker
On Tue, Nov 16, 2021 at 12:06:36PM +, John Garry wrote: > On 16/11/2021 11:35, Jean-Philippe Brucker wrote: > > Add device-tree support to the SMMUv3 PMCG. One small cosmetic change > > while factoring the option mask printout: don't display it when zero, it > > only

Re: [PATCH 0/2] perf/smmuv3: Support devicetree

2021-11-16 Thread Jean-Philippe Brucker
On Tue, Nov 16, 2021 at 12:02:47PM +, Robin Murphy wrote: > On 2021-11-16 11:35, Jean-Philippe Brucker wrote: > > Add devicetree binding for the SMMUv3 PMU, called Performance Monitoring > > Counter Group (PMCG) in the spec. Each SMMUv3 implementation can have > > multi

[PATCH 1/2] dt-bindings: Add Arm SMMUv3 PMCG binding

2021-11-16 Thread Jean-Philippe Brucker
for each TBU). Signed-off-by: Jean-Philippe Brucker --- .../bindings/iommu/arm,smmu-v3-pmcg.yaml | 67 +++ 1 file changed, 67 insertions(+) create mode 100644 Documentation/devicetree/bindings/iommu/arm,smmu-v3-pmcg.yaml diff --git a/Documentation/devicetree/bindings/iommu/arm

[PATCH 0/2] perf/smmuv3: Support devicetree

2021-11-16 Thread Jean-Philippe Brucker
] https://jpbrucker.net/git/linux/log/?h=smmu/pmu-dt Jean-Philippe Brucker (2): dt-bindings: Add Arm SMMUv3 PMCG binding perf/smmuv3: Add devicetree support .../bindings/iommu/arm,smmu-v3-pmcg.yaml | 67 +++ drivers/perf/arm_smmuv3_pmu.c | 25 +

[PATCH 2/2] perf/smmuv3: Add devicetree support

2021-11-16 Thread Jean-Philippe Brucker
Add device-tree support to the SMMUv3 PMCG. One small cosmetic change while factoring the option mask printout: don't display it when zero, it only contains one erratum at the moment. Signed-off-by: Jay Chen Signed-off-by: Jean-Philippe Brucker --- drivers/perf/arm_smmuv3_pmu.c | 25

Re: [PATCH 0/5] iommu/virtio: Add identity domains

2021-10-22 Thread Jean-Philippe Brucker
On Fri, Oct 22, 2021 at 06:16:27AM -0400, Michael S. Tsirkin wrote: > On Wed, Oct 13, 2021 at 01:10:48PM +0100, Jean-Philippe Brucker wrote: > > Support identity domains, allowing to only enable IOMMU protection for a > > subset of endpoints (those assigned to userspace, for

Re: [RFC 10/20] iommu/iommufd: Add IOMMU_DEVICE_GET_INFO

2021-10-22 Thread Jean-Philippe Brucker
On Thu, Oct 21, 2021 at 08:22:23PM -0300, Jason Gunthorpe wrote: > On Thu, Oct 21, 2021 at 03:58:02PM +0100, Jean-Philippe Brucker wrote: > > On Thu, Oct 21, 2021 at 02:26:00AM +, Tian, Kevin wrote: > > > > I'll leave it to Jean to confirm. If only coherent DMA can be used

Re: [RFC 10/20] iommu/iommufd: Add IOMMU_DEVICE_GET_INFO

2021-10-21 Thread Jean-Philippe Brucker
On Thu, Oct 21, 2021 at 02:26:00AM +, Tian, Kevin wrote: > > I'll leave it to Jean to confirm. If only coherent DMA can be used in > > the guest on other platforms, suppose VFIO should not blindly set > > IOMMU_CACHE and in concept it should deny assigning a non-coherent > > device since no

Re: [PATCH 0/5] iommu/virtio: Add identity domains

2021-10-19 Thread Jean-Philippe Brucker
On Tue, Oct 19, 2021 at 09:22:13AM +0800, Jason Wang wrote: > > > So I think clarifying system reset should address your questions. > > > I believe we should leave bypass sticky across device reset, so a FW->OS > > > transition, where the OS resets the device, does not open a vulnerability > > >

Re: [PATCH 0/5] iommu/virtio: Add identity domains

2021-10-18 Thread Jean-Philippe Brucker
On Thu, Oct 14, 2021 at 03:00:38AM +, Tian, Kevin wrote: > > From: Jean-Philippe Brucker > > Sent: Wednesday, October 13, 2021 8:11 PM > > > > Support identity domains, allowing to only enable IOMMU protection for a > > subset of endpoints (those assigned to

Re: [PATCH RFC] virtio: wrap config->reset calls

2021-10-14 Thread Jean-Philippe Brucker
abled. > > Signed-off-by: Michael S. Tsirkin > --- > drivers/iommu/virtio-iommu.c | 2 +- Reviewed-by: Jean-Philippe Brucker ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

2021-10-13 Thread Jean-Philippe Brucker
itself to only perform DMA to suitable locations. In some cases it may even be desirable to perform DMA to MMIO regions. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/virtio-iommu.c | 61 +--- 1 file changed, 57 insertions(+), 4 deletions(-) diff --git

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

2021-10-13 Thread Jean-Philippe Brucker
size will most certainly be smaller than 2^64. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/virtio-iommu.c | 31 +++ 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c index

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

2021-10-13 Thread Jean-Philippe Brucker
identity mappings in this case. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/virtio-iommu.c | 20 +++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c index 80930ce04a16..ee8a7afd667b 100644

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

2021-10-13 Thread Jean-Philippe Brucker
Add definitions for the VIRTIO_IOMMU_F_BYPASS_CONFIG, which supersedes VIRTIO_IOMMU_F_BYPASS. Signed-off-by: Jean-Philippe Brucker --- include/uapi/linux/virtio_iommu.h | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/virtio_iommu.h b/include/uapi

[PATCH 0/5] iommu/virtio: Add identity domains

2021-10-13 Thread Jean-Philippe Brucker
/linux/log/?h=virtio-iommu/bypass [3] https://jpbrucker.net/git/qemu/log/?h=virtio-iommu/bypass Jean-Philippe Brucker (5): iommu/virtio: Add definitions for VIRTIO_IOMMU_F_BYPASS_CONFIG iommu/virtio: Support bypass domains iommu/virtio: Sort reserved regions iommu/virtio: Pass end address

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

2021-10-13 Thread Jean-Philippe Brucker
To ease identity mapping support, keep the list of reserved regions sorted. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/virtio-iommu.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c index

Re: [RFC 11/20] iommu/iommufd: Add IOMMU_IOASID_ALLOC/FREE

2021-10-12 Thread Jean-Philippe Brucker
On Mon, Oct 11, 2021 at 08:38:17PM -0300, Jason Gunthorpe wrote: > On Mon, Oct 11, 2021 at 09:49:57AM +0100, Jean-Philippe Brucker wrote: > > > Seems like we don't need the negotiation part? The host kernel > > communicates available IOVA ranges to userspace including h

Re: [PATCH RFC v1 03/11] iommu/virtio: Handle incoming page faults

2021-10-11 Thread Jean-Philippe Brucker
Hi Vivek, On Mon, Oct 11, 2021 at 01:41:15PM +0530, Vivek Gautam wrote: > > > + list_for_each_entry(ep, >endpoints, list) { > > > + if (ep->eid == endpoint) { > > > + vdev = ep->vdev; > > I have a question here though - > Is endpoint-ID unique across all the

Re: [RFC 11/20] iommu/iommufd: Add IOMMU_IOASID_ALLOC/FREE

2021-10-11 Thread Jean-Philippe Brucker
On Mon, Oct 11, 2021 at 05:02:01PM +1100, David Gibson wrote: > qemu wants to emulate a PAPR vIOMMU, so it says (via interfaces yet to > be determined) that it needs an IOAS where things can be mapped in the > range 0..2GiB (for the 32-bit window) and 2^59..2^59+1TiB (for the > 64-bit window). >

Re: [PATCH RFC v1 10/11] uapi/virtio-iommu: Add a new request type to send page response

2021-10-06 Thread Jean-Philippe Brucker
On Thu, Sep 30, 2021 at 02:54:05PM +0530, Vivek Kumar Gautam wrote: > > > +struct virtio_iommu_req_page_resp { > > > + struct virtio_iommu_req_headhead; > > > + __le32 domain; > > > > I don't think we need this field, since the fault report doesn't

Re: [PATCH RFC v1 01/11] uapi/virtio-iommu: Add page request grp-id and flags information

2021-09-30 Thread Jean-Philippe Brucker
On Thu, Sep 30, 2021 at 10:26:35AM +0530, Vivek Kumar Gautam wrote: > > I'm not sure why we made it 32-bit in Linux UAPI, it's a little wasteful. > > PCIe PRGI is 9-bits and SMMU STAG is 16-bits. Since the scope of the grpid > > is the endpoint, 16-bit means 64k in-flight faults per endpoint,

Re: [RFC 17/20] iommu/iommufd: Report iova range to userspace

2021-09-29 Thread Jean-Philippe Brucker
On Wed, Sep 29, 2021 at 10:44:01AM +, Liu, Yi L wrote: > > From: Jean-Philippe Brucker > > Sent: Wednesday, September 22, 2021 10:49 PM > > > > On Sun, Sep 19, 2021 at 02:38:45PM +0800, Liu Yi L wrote: > > > [HACK. will fix in v2] > > > >

Re: [RFC 10/20] iommu/iommufd: Add IOMMU_DEVICE_GET_INFO

2021-09-23 Thread Jean-Philippe Brucker
On Thu, Sep 23, 2021 at 03:10:47AM +, Tian, Kevin wrote: > > From: Jason Gunthorpe > > Sent: Thursday, September 23, 2021 7:50 AM > > > > On Wed, Sep 22, 2021 at 03:24:07PM -0600, Alex Williamson wrote: > > > On Sun, 19 Sep 2021 14:38:38 +0800 > > > Liu Yi L wrote: > > > > > > > +struct

Re: [RFC 17/20] iommu/iommufd: Report iova range to userspace

2021-09-22 Thread Jean-Philippe Brucker
On Sun, Sep 19, 2021 at 02:38:45PM +0800, Liu Yi L wrote: > [HACK. will fix in v2] > > IOVA range is critical info for userspace to manage DMA for an I/O address > space. This patch reports the valid iova range info of a given device. > > Due to aforementioned hack, this info comes from the

Re: [RFC 11/20] iommu/iommufd: Add IOMMU_IOASID_ALLOC/FREE

2021-09-22 Thread Jean-Philippe Brucker
On Sun, Sep 19, 2021 at 02:38:39PM +0800, Liu Yi L wrote: > This patch adds IOASID allocation/free interface per iommufd. When > allocating an IOASID, userspace is expected to specify the type and > format information for the target I/O page table. > > This RFC supports only one type

Re: [PATCH RFC v1 10/11] uapi/virtio-iommu: Add a new request type to send page response

2021-09-21 Thread Jean-Philippe Brucker
On Fri, Apr 23, 2021 at 03:21:46PM +0530, Vivek Gautam wrote: > Once the page faults are handled, the response has to be sent to > virtio-iommu backend, from where it can be sent to the host to > prepare the response to a generated io page fault by the device. > Add a new virt-queue request type

Re: [PATCH RFC v1 09/11] iommu/virtio: Implement sva bind/unbind calls

2021-09-21 Thread Jean-Philippe Brucker
On Fri, Apr 23, 2021 at 03:21:45PM +0530, Vivek Gautam wrote: > SVA bind and unbind implementations will allow to prepare translation > context with CPU page tables that can be programmed into host iommu > hardware to realize shared address space utilization between the CPU > and virtualized

Re: [PATCH RFC v1 08/11] iommu/arm-smmu-v3: Implement shared context alloc and free ops

2021-09-21 Thread Jean-Philippe Brucker
On Fri, Apr 23, 2021 at 03:21:44PM +0530, Vivek Gautam wrote: > Implementing the alloc_shared_cd and free_shared_cd in cd-lib, and > start using them for arm-smmu-v3-sva implementation. > > Signed-off-by: Vivek Gautam > --- > .../arm/arm-smmu-v3/arm-smmu-v3-cd-lib.c | 71 >

Re: [PATCH RFC v1 05/11] iommu/virtio: Add SVA feature and related enable/disable callbacks

2021-09-21 Thread Jean-Philippe Brucker
On Fri, Apr 23, 2021 at 03:21:41PM +0530, Vivek Gautam wrote: > Add a feature flag to virtio iommu for Shared virtual addressing > (SVA). This feature would indicate the availablily path for handling > device page faults, and the provision for sending page response. In this case the feature

Re: [PATCH RFC v1 03/11] iommu/virtio: Handle incoming page faults

2021-09-21 Thread Jean-Philippe Brucker
On Fri, Apr 23, 2021 at 03:21:39PM +0530, Vivek Gautam wrote: > Redirect the incoming page faults to the registered fault handler > that can take the fault information such as, pasid, page request > group-id, address and pasid flags. > > Signed-off-by: Vivek Gautam > --- >

Re: [PATCH RFC v1 02/11] iommu/virtio: Maintain a list of endpoints served by viommu_dev

2021-09-21 Thread Jean-Philippe Brucker
On Fri, Apr 23, 2021 at 03:21:38PM +0530, Vivek Gautam wrote: > Keeping a record of list of endpoints that are served by the virtio-iommu > device would help in redirecting the requests of page faults to the > correct endpoint device to handle such requests. > > Signed-off-by: Vivek Gautam > ---

Re: [PATCH RFC v1 01/11] uapi/virtio-iommu: Add page request grp-id and flags information

2021-09-21 Thread Jean-Philippe Brucker
ek Gautam > Cc: Joerg Roedel > Cc: Will Deacon > Cc: Robin Murphy > Cc: Jean-Philippe Brucker > Cc: Eric Auger > Cc: Alex Williamson > Cc: Kevin Tian > Cc: Jacob Pan > Cc: Liu Yi L > Cc: Lorenzo Pieralisi > Cc: Shameerali Kolothum Thodi > --- > inc

Re: [PATCH v2 01/24] iommu: Pull IOVA cookie management into the core

2021-07-30 Thread Jean-Philippe Brucker
> CC: Marek Szyprowski > CC: Yoshihiro Shimoda > CC: Geert Uytterhoeven > CC: Yong Wu > CC: Heiko Stuebner > CC: Chunyan Zhang > CC: Chunyan Zhang > CC: Maxime Ripard > CC: Jean-Philippe Brucker > Signed-off-by: Robin Murphy Reviewed-by: Jean-Philippe Br

Re: [PATCH v2 20/24] iommu: Merge strictness and domain type configs

2021-07-30 Thread Jean-Philippe Brucker
xt still refers to the old config options Otherwise Reviewed-by: Jean-Philippe Brucker > --- > drivers/iommu/Kconfig | 80 +-- > drivers/iommu/iommu.c | 2 +- > 2 files changed, 41 insertions(+), 41 deletions(-) > > diff --git a/drivers/iomm

Re: [PATCH v2 19/24] iommu: Expose DMA domain strictness via sysfs

2021-07-30 Thread Jean-Philippe Brucker
On Wed, Jul 28, 2021 at 04:58:40PM +0100, Robin Murphy wrote: > The sysfs interface for default domain types exists primarily so users > can choose the performance/security tradeoff relevant to their own > workload. As such, the choice between the policies for DMA domains fits > perfectly as an

Re: [PATCH v2 14/24] iommu: Introduce explicit type for non-strict DMA domains

2021-07-30 Thread Jean-Philippe Brucker
d-off-by: Robin Murphy Reviewed-by: Jean-Philippe Brucker > --- > drivers/iommu/dma-iommu.c | 2 +- > drivers/iommu/iommu.c | 8 ++-- > include/linux/iommu.h | 11 +++ > 3 files changed, 18 insertions(+), 3 deletions(-) > > diff --git a/drivers/i

Re: [PATCH v2 12/24] iommu/dma: Unexport IOVA cookie management

2021-07-30 Thread Jean-Philippe Brucker
someone else putting them, so that aspect is unaffected. > > Signed-off-by: Robin Murphy Reviewed-by: Jean-Philippe Brucker ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH v2 11/24] iommu/virtio: Drop IOVA cookie management

2021-07-30 Thread Jean-Philippe Brucker
On Wed, Jul 28, 2021 at 04:58:32PM +0100, Robin Murphy wrote: > The core code bakes its own cookies now. > > CC: Jean-Philippe Brucker > Signed-off-by: Robin Murphy Reviewed-by: Jean-Philippe Brucker Also tested on the Seattle (vsmmuv3/viommu with lazy/strict, still need to test

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

2021-07-26 Thread Jean-Philippe Brucker
Hi Kevin, On Fri, Jul 09, 2021 at 07:48:44AM +, 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 their own

Re: [RFC PATCH 4/5] iommu/arm-smmu-v3: Use pinned VMID for NESTED stage with BTM

2021-07-22 Thread Jean-Philippe Brucker
Hi Shameer, On Wed, Jul 21, 2021 at 08:54:00AM +, Shameerali Kolothum Thodi wrote: > > More generally I think this pinned VMID set conflicts with that of > > stage-2-only domains (which is the default state until a guest attaches a > > PASID table). Say you have one guest using DOMAIN_NESTED

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-18 Thread Jean-Philippe Brucker
On Thu, Jun 17, 2021 at 01:00:14PM +1000, David Gibson wrote: > On Thu, Jun 10, 2021 at 06:37:31PM +0200, Jean-Philippe Brucker wrote: > > On Tue, Jun 08, 2021 at 04:31:50PM +1000, David Gibson wrote: > > > For the qemu case, I would imagine a two stage fallback: >

[PATCH v5 5/5] iommu/virtio: Enable x86 support

2021-06-18 Thread Jean-Philippe Brucker
iommu_setup_dma_ops() from probe_finalize(). Acked-by: Joerg Roedel Acked-by: Michael S. Tsirkin Tested-by: Eric Auger Reviewed-by: Eric Auger Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/Kconfig| 3 ++- drivers/iommu/dma-iommu.c| 1 + drivers/iommu/virtio-iommu.c | 11 +++ 3

[PATCH v5 3/5] ACPI: Add driver for the VIOT table

2021-06-18 Thread Jean-Philippe Brucker
(2), it is deferred until the IOMMU is initialized, then retried. Tested-by: Eric Auger Reviewed-by: Eric Auger Signed-off-by: Jean-Philippe Brucker --- drivers/acpi/Kconfig | 3 + drivers/iommu/Kconfig | 1 + drivers/acpi/Makefile | 2 + include/linux/acpi_viot.h | 19

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

2021-06-18 Thread Jean-Philippe Brucker
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: Jean-Philippe Brucker --- include/linux/dma-iommu.h | 4 ++-- arch/arm64/mm/dma-mapping.c | 2 +- drivers/iommu/amd/iommu.c | 2 +- drivers

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

2021-06-18 Thread Jean-Philippe Brucker
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 acpi_iommu_fwspec_init() helper. Signed-off-by: Jean-Philippe Brucker

[PATCH v5 1/5] ACPI: arm64: Move DMA setup operations out of IORT

2021-06-18 Thread Jean-Philippe Brucker
Extract generic DMA setup code out of IORT, so it can be reused by VIOT. Keep it in drivers/acpi/arm64 for now, since it could break x86 platforms that haven't run this code so far, if they have invalid tables. Reviewed-by: Eric Auger Signed-off-by: Jean-Philippe Brucker --- drivers/acpi/arm64

[PATCH v5 0/5] Add support for ACPI VIOT

2021-06-18 Thread Jean-Philippe Brucker
and IOMMU. This series is at [3]. [1] https://lore.kernel.org/linux-iommu/20210610075130.67517-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 Jean-Philippe Brucker (5): ACPI: arm64: Move DMA

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

2021-06-18 Thread Jean-Philippe Brucker
On Wed, Jun 16, 2021 at 06:02:39PM +0100, Robin Murphy wrote: > > diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c > > index c62e19bed302..175f8eaeb5b3 100644 > > --- a/drivers/iommu/dma-iommu.c > > +++ b/drivers/iommu/dma-iommu.c > > @@ -1322,7 +1322,9 @@ void

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

2021-06-18 Thread Jean-Philippe Brucker
On Wed, Jun 16, 2021 at 05:28:59PM +0200, Eric Auger wrote: > Hi Jean, > > On 6/10/21 9:51 AM, Jean-Philippe Brucker wrote: > > diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c > > index 4bf1dd3eb041..7bd1d2199141 100644 > > --- a/arch/arm64/mm/d

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

2021-06-18 Thread Jean-Philippe Brucker
On Thu, Jun 17, 2021 at 01:50:59PM +0200, Rafael J. Wysocki wrote: > > diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c > > index be7da23fad76..b835ca702ff0 100644 > > --- a/drivers/acpi/bus.c > > +++ b/drivers/acpi/bus.c > > @@ -27,6 +27,7 @@ > > #include > > #endif > > #include > >

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

2021-06-18 Thread Jean-Philippe Brucker
On Wed, Jun 16, 2021 at 03:26:08PM +0200, Eric Auger wrote: > > + default: > > + pr_warn("Unsupported node %x\n", hdr->type); > > + ret = 0; > > + goto err_free; > > + } > > + > > + /* > > +* To be compatible with future versions of the table which may

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

2021-06-18 Thread Jean-Philippe Brucker
Hi Eric, On Wed, Jun 16, 2021 at 11:35:13AM +0200, Eric Auger wrote: > > -const struct iommu_ops *iort_iommu_configure_id(struct device *dev, > > - const u32 *id_in) > > +int iort_iommu_configure_id(struct device *dev, const u32 *id_in) > > { > >

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

2021-06-16 Thread Jean-Philippe Brucker
Hi Rafael, On Thu, Jun 10, 2021 at 09:51:27AM +0200, Jean-Philippe Brucker wrote: > Add a driver for the ACPI VIOT table, which provides topology > information for para-virtual IOMMUs. Enable virtio-iommu on > non-devicetree platforms, including x86. > > Since v3 [1] I fi

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-10 Thread Jean-Philippe Brucker
On Tue, Jun 08, 2021 at 04:31:50PM +1000, David Gibson wrote: > For the qemu case, I would imagine a two stage fallback: > > 1) Ask for the exact IOMMU capabilities (including pagetable >format) that the vIOMMU has. If the host can supply, you're >good > > 2) If not, ask

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

2021-06-10 Thread Jean-Philippe Brucker
ize(). The base parameter can be zero because dma-iommu already removes the first IOVA page, and the limit parameter can be U64_MAX because it's only checked against the domain geometry. Simplify calls to iommu_setup_dma_ops(). Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/amd/iommu.c |

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

2021-06-10 Thread Jean-Philippe Brucker
the check. Signed-off-by: Jean-Philippe Brucker --- include/linux/dma-iommu.h | 4 ++-- arch/arm64/mm/dma-mapping.c | 2 +- drivers/iommu/amd/iommu.c | 2 +- drivers/iommu/dma-iommu.c | 12 ++-- drivers/iommu/intel/iommu.c | 2 +- 5 files changed, 11 insertions(+), 11 deletions

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

2021-06-10 Thread Jean-Philippe Brucker
the endpoint to a driver, find the associated IOMMU ops. Register them, along with the endpoint ID, into the device's iommu_fwspec. If step (3) happens before step (2), it is deferred until the IOMMU is initialized, then retried. Signed-off-by: Jean-Philippe Brucker --- drivers/acpi

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

2021-06-10 Thread Jean-Philippe Brucker
probe_finalize(). Acked-by: Joerg Roedel Acked-by: Michael S. Tsirkin Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/Kconfig| 3 ++- drivers/iommu/dma-iommu.c| 1 + drivers/iommu/virtio-iommu.c | 8 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/iommu

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

2021-06-10 Thread Jean-Philippe Brucker
/log/?h=virtio-iommu/acpi [3] https://jpbrucker.net/git/linux/log/?h=virtio-iommu/acpi Jean-Philippe Brucker (6): ACPI: arm64: Move DMA setup operations out of IORT ACPI: Move IOMMU setup code out of IORT ACPI: Add driver for the VIOT table iommu/dma: Pass address limit rather than size

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

2021-06-10 Thread Jean-Philippe Brucker
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 acpi_iommu_fwspec_init() helper. Signed-off-by: Jean-Philippe Brucker

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

2021-06-10 Thread Jean-Philippe Brucker
Extract generic DMA setup code out of IORT, so it can be reused by VIOT. Keep it in drivers/acpi/arm64 for now, since it could break x86 platforms that haven't run this code so far, if they have invalid tables. Signed-off-by: Jean-Philippe Brucker --- drivers/acpi/arm64/Makefile | 1 + include

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

2021-06-10 Thread Jean-Philippe Brucker
On Fri, Jun 04, 2021 at 05:22:07PM +0200, Joerg Roedel wrote: > On Thu, Jun 03, 2021 at 09:26:39AM +0200, Jean-Philippe Brucker wrote: > > These are only defined when CONFIG_IOMMU_API is set. IORT uses them inside > > an #ifdef, I can do the same. Maybe moving these two fun

Re: [PATCH v15 0/3] iommu/arm-smmu-v3: Add stall support

2021-06-09 Thread Jean-Philippe Brucker
On Tue, Jun 08, 2021 at 12:42:34PM +0100, Will Deacon wrote: > On Wed, 26 May 2021 18:19:25 +0200, Jean-Philippe Brucker wrote: > > Add stall support for SMMUv3, enabling I/O page faults and SVA for > > compatible devices. No change since last version [1], but

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-04 Thread Jean-Philippe Brucker
On Thu, Jun 03, 2021 at 03:45:09PM +1000, David Gibson wrote: > > > But it would certainly be possible for a system to have two > > > different host bridges with two different IOMMUs with different > > > pagetable formats. Until you know which devices (and therefore > > > which host bridge)

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-04 Thread Jean-Philippe Brucker
On Wed, Jun 02, 2021 at 01:25:00AM +, Tian, Kevin wrote: > > > This implies that VFIO_BOUND_IOASID will be extended to allow user > > > specify a device label. This label will be recorded in /dev/iommu to > > > serve per-device invalidation request from and report per-device > > > fault data

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

2021-06-03 Thread Jean-Philippe Brucker
On Thu, Jun 03, 2021 at 04:06:18AM +0800, kernel test robot wrote: > >> drivers/acpi/scan.c:1540:26: error: no member named 'ops' in 'struct > >> iommu_fwspec' >return fwspec ? fwspec->ops : NULL; >~~ ^ > >> drivers/acpi/scan.c:1564:9: error: implicit

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

2021-06-02 Thread Jean-Philippe Brucker
the endpoint to a driver, find the associated IOMMU ops. Register them, along with the endpoint ID, into the device's iommu_fwspec. If step (3) happens before step (2), it is deferred until the IOMMU is initialized, then retried. Signed-off-by: Jean-Philippe Brucker --- drivers/acpi

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

2021-06-02 Thread Jean-Philippe Brucker
the check. Signed-off-by: Jean-Philippe Brucker --- include/linux/dma-iommu.h | 4 ++-- arch/arm64/mm/dma-mapping.c | 2 +- drivers/iommu/amd/iommu.c | 2 +- drivers/iommu/dma-iommu.c | 12 ++-- drivers/iommu/intel/iommu.c | 2 +- 5 files changed, 11 insertions(+), 11 deletions

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

2021-06-02 Thread Jean-Philippe Brucker
ize(). The base parameter can be zero because dma-iommu already removes the first IOVA page, and the limit parameter can be U64_MAX because it's only checked against the domain geometry. Simplify calls to iommu_setup_dma_ops(). Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/amd/iommu.c |

[PATCH v3 6/6] iommu/virtio: Enable x86 support

2021-06-02 Thread Jean-Philippe Brucker
probe_finalize(). Acked-by: Joerg Roedel Acked-by: Michael S. Tsirkin Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/Kconfig| 3 ++- drivers/iommu/dma-iommu.c| 1 + drivers/iommu/virtio-iommu.c | 8 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/iommu

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

2021-06-02 Thread Jean-Philippe Brucker
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 acpi_iommu_fwspec_init() helper. Signed-off-by: Jean-Philippe Brucker

  1   2   3   4   5   6   7   8   9   10   >