Re: [PATCH v3 0/2] iommu/virtio: Enable IOMMU_CAP_DERRED_FLUSH

2023-11-20 Thread Jean-Philippe Brucker
of the patches. Thank you for the patches. For the series: Reviewed-by: Jean-Philippe Brucker

Re: [PATCH][next] iommu/virtio: Add __counted_by for struct viommu_request and use struct_size()

2023-10-10 Thread Jean-Philippe Brucker
rray member. > > This code was found with the help of Coccinelle, and audited and > fixed manually. > > Signed-off-by: Gustavo A. R. Silva Reviewed-by: Jean-Philippe Brucker > --- > drivers/iommu/virtio-iommu.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(

Re: [PATCH v2 1/2] iommu/virtio: Make use of ops->iotlb_sync_map

2023-09-22 Thread Jean-Philippe Brucker
On Tue, Sep 19, 2023 at 11:46:49AM -0300, Jason Gunthorpe wrote: > On Tue, Sep 19, 2023 at 09:15:19AM +0100, Jean-Philippe Brucker wrote: > > On Mon, Sep 18, 2023 at 05:37:47PM +0100, Robin Murphy wrote: > > > > diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-

Re: [PATCH v2 1/2] iommu/virtio: Make use of ops->iotlb_sync_map

2023-09-22 Thread Jean-Philippe Brucker
On Tue, Sep 19, 2023 at 09:28:08AM +0100, Robin Murphy wrote: > On 2023-09-19 09:15, Jean-Philippe Brucker wrote: > > On Mon, Sep 18, 2023 at 05:37:47PM +0100, Robin Murphy wrote: > > > > diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c >

Re: [PATCH v2 1/2] iommu/virtio: Make use of ops->iotlb_sync_map

2023-09-19 Thread Jean-Philippe Brucker
On Mon, Sep 18, 2023 at 05:37:47PM +0100, Robin Murphy wrote: > > diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c > > index 17dcd826f5c2..3649586f0e5c 100644 > > --- a/drivers/iommu/virtio-iommu.c > > +++ b/drivers/iommu/virtio-iommu.c > > @@ -189,6 +189,12 @@ static int

Re: [PATCH v2 2/2] iommu/virtio: Add ops->flush_iotlb_all and enable deferred flush

2023-09-18 Thread Jean-Philippe Brucker
yrica/ > Signed-off-by: Niklas Schnelle Reviewed-by: Jean-Philippe Brucker > --- > drivers/iommu/virtio-iommu.c | 10 ++ > 1 file changed, 10 insertions(+) > > diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c > index 3649586f0e5c..4dd330fbcbdd

Re: [PATCH v2 1/2] iommu/virtio: Make use of ops->iotlb_sync_map

2023-09-18 Thread Jean-Philippe Brucker
> it is also a requirement for IOMMU_CAP_DEFERRED_FLUSH. > > Link: > https://lore.kernel.org/lkml/20230726111433.1105665-1-schne...@linux.ibm.com/ > Signed-off-by: Niklas Schnelle Reviewed-by: Jean-Philippe Brucker This must be merged after "iommu/dma: s390 DMA API convers

Re: [PATCH 2/2] iommu/virtio: Add ops->flush_iotlb_all and enable deferred flush

2023-09-06 Thread Jean-Philippe Brucker
On Wed, Sep 06, 2023 at 09:55:49AM +0200, Niklas Schnelle wrote: > On Mon, 2023-09-04 at 17:33 +0100, Robin Murphy wrote: > > On 2023-09-04 16:34, Jean-Philippe Brucker wrote: > > > On Fri, Aug 25, 2023 at 05:21:26PM +0200, Niklas Schnelle wrote: > > > > Add

Re: [PATCH 2/2] iommu/virtio: Add ops->flush_iotlb_all and enable deferred flush

2023-09-04 Thread Jean-Philippe Brucker
On Fri, Aug 25, 2023 at 05:21:26PM +0200, Niklas Schnelle wrote: > Add ops->flush_iotlb_all operation to enable virtio-iommu for the > dma-iommu deferred flush scheme. This results inn a significant increase in > in performance in exchange for a window in which devices can still > access

Re: [PATCH 1/2] iommu/virtio: Make use of ops->iotlb_sync_map

2023-09-04 Thread Jean-Philippe Brucker
Hi Niklas, Thanks for following up with these patches On Fri, Aug 25, 2023 at 05:21:25PM +0200, Niklas Schnelle wrote: > Pull out the sync operation from viommu_map_pages() by implementing > ops->iotlb_sync_map. This allows the common IOMMU code to map multiple > elements of an sg with a single

Re: [RFC] iommu/virtio: Use single flush queue (EXPERIMENTAL)

2023-08-02 Thread Jean-Philippe Brucker
Hi Niklas, On Wed, Jul 26, 2023 at 01:14:33PM +0200, Niklas Schnelle wrote: > Just like on paged s390 guests with their virtual IOMMU, syncing > mappings via virtio-iommu is quite expensive. It can thus benefit from > queueing unmapped IOVAs and flushing them in batches but less so from >

Re: [RFC PATCHES 00/17] IOMMUFD: Deliver IO page faults to user space

2023-06-26 Thread Jean-Philippe Brucker
On Mon, Jun 19, 2023 at 11:35:50AM +0800, Baolu Lu wrote: > > Another outstanding issue was what to do for PASID stop. When the guest > > device driver stops using a PASID it issues a PASID stop request to the > > device (a device-specific mechanism). If the device is not using PRI stop > >

Re: [RFC PATCHES 00/17] IOMMUFD: Deliver IO page faults to user space

2023-06-16 Thread Jean-Philippe Brucker
Hi Baolu, On Tue, May 30, 2023 at 01:37:07PM +0800, Lu Baolu wrote: > - The timeout value for the pending page fault messages. Ideally we > should determine the timeout value from the device configuration, but > I failed to find any statement in the PCI specification (version 6.x). > A

Re: [PATCH] iommu/virtio: Detach domain on endpoint release

2023-05-18 Thread Jean-Philippe Brucker
On Thu, May 18, 2023 at 10:59:12AM -0300, Jason Gunthorpe wrote: > On Thu, May 18, 2023 at 02:56:38PM +0100, Jean-Philippe Brucker wrote: > > > Can you wrapper this into a BLOCKED domain like we are moving drivers > > > toward, and then attach the blocked domain i

Re: [PATCH] iommu/virtio: Detach domain on endpoint release

2023-05-18 Thread Jean-Philippe Brucker
On Wed, May 17, 2023 at 01:20:51PM -0300, Jason Gunthorpe wrote: > On Wed, May 10, 2023 at 09:11:57AM +0100, Jean-Philippe Brucker wrote: > > > > diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c > > > index 5b8fe9bfa9a5..3d3d4462359e 100644 > >

[PATCH v2 2/2] iommu/virtio: Return size mapped for a detached domain

2023-05-15 Thread Jean-Philippe Brucker
: 7e62edd7a33a ("iommu/virtio: Add map/unmap_pages() callbacks implementation") Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/virtio-iommu.c | 33 + 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/drivers/iommu/virtio-iommu.c b/drivers/io

[PATCH v2 1/2] iommu/virtio: Detach domain on endpoint release

2023-05-15 Thread Jean-Philippe Brucker
-3aa0-973a-3a86-3fa5c4d41...@daynix.com/ Signed-off-by: Jean-Philippe Brucker Tested-by: Akihiko Odaki --- v1: https://lore.kernel.org/linux-iommu/20230414150744.562456-1-jean-phili...@linaro.org/ v2: fixed nr_endpoints count reported by Eric --- drivers/iommu/virtio-iommu.c | 24 +

[PATCH v2 0/2] iommu/virtio: Fixes

2023-05-15 Thread Jean-Philippe Brucker
One fix reported by Akihiko, and another found while going over the driver. Jean-Philippe Brucker (2): iommu/virtio: Detach domain on endpoint release iommu/virtio: Return size mapped for a detached domain drivers/iommu/virtio-iommu.c | 57 ++-- 1 file

Re: [PATCH] iommu/virtio: Detach domain on endpoint release

2023-05-10 Thread Jean-Philippe Brucker
On Wed, May 10, 2023 at 05:37:22PM +0200, Eric Auger wrote: > Hi Jean, > > On 4/14/23 17:07, Jean-Philippe Brucker wrote: > > When an endpoint is released, for example a PCIe VF is disabled or a > > function hot-unplugged, it should be detached from its domain. Send

Re: [PATCH] iommu/virtio: Detach domain on endpoint release

2023-05-10 Thread Jean-Philippe Brucker
Hi Joerg, On Fri, Apr 14, 2023 at 04:07:45PM +0100, Jean-Philippe Brucker wrote: > When an endpoint is released, for example a PCIe VF is disabled or a > function hot-unplugged, it should be detached from its domain. Send a > DETACH request. > > Fixes: edcd69ab9a32 ("iom

Re: virtio-iommu hotplug issue

2023-04-14 Thread Jean-Philippe Brucker
On Thu, Apr 13, 2023 at 08:01:54PM +0900, Akihiko Odaki wrote: > Yes, that's right. The guest can dynamically create and delete VFs. The > device is emulated by QEMU: igb, an Intel NIC recently added to QEMU and > projected to be released as part of QEMU 8.0. Ah great, that's really useful, I'll

[PATCH] iommu/virtio: Detach domain on endpoint release

2023-04-14 Thread Jean-Philippe Brucker
-973a-3a86-3fa5c4d41...@daynix.com/ Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/virtio-iommu.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c index 5b8fe9bfa9a5..3d3d4462359e 100644 --- a/drivers/io

Re: virtio-iommu hotplug issue

2023-04-13 Thread Jean-Philippe Brucker
Hello, On Thu, Apr 13, 2023 at 01:49:43PM +0900, Akihiko Odaki wrote: > Hi, > > Recently I encountered a problem with the combination of Linux's > virtio-iommu driver and QEMU when a SR-IOV virtual function gets disabled. > I'd like to ask you what kind of solution is appropriate here and

[PATCH v3] dt-bindings: virtio: Convert virtio, pci-iommu to DT schema

2022-09-23 Thread Jean-Philippe Brucker
Convert the binding that describes the virtio-pci based IOMMU to DT schema. Change the compatible string to "pci,", which is defined by the PCI Bus Binding, but keep "virtio,pci-iommu" as an option for backward compatibility. Signed-off-by: Jean-Philippe Brucker --- v3: R

[PATCH v2] dt-bindings: virtio: Convert virtio, pci-iommu to DT schema

2022-09-22 Thread Jean-Philippe Brucker
Convert the binding that describes virtio-pci base IOMMU to DT schema. Change the compatible string to "pci," which is defined by the PCI Bus Binding Signed-off-by: Jean-Philippe Brucker --- v2: Fix example, make compatible a required property v1: https://lore.kern

Re: [PATCH] dt-bindings: virtio: Convert virtio,pci-iommu to DT schema

2022-09-22 Thread Jean-Philippe Brucker
On Sun, Sep 18, 2022 at 10:23:06AM +0100, Krzysztof Kozlowski wrote: > > +required: > > Also: compatible > > > + - reg > > + - '#iommu-cells' > > + > > +additionalProperties: false > > + > > +examples: > > + - | > > +pcie0 { > > Node name: pcie > > > +#address-cells = <3>; > > +

Re: [RFC PATCH] iommu/virtio: __viommu_sync_req is no need to return a value

2022-09-22 Thread Jean-Philippe Brucker
Hi Liu, On Thu, Sep 22, 2022 at 07:24:46PM +0800, Liu Song wrote: > From: Liu Song > > In "__viommu_sync_req", 0 is always returned as the only return value, no > return value is needed for this case, and the processes and functions > involved are adjusted accordingly. > > Signed-off-by: Liu

Re: [PATCH v4 0/6] Define EINVAL as device/domain incompatibility

2022-09-21 Thread Jean-Philippe Brucker
iommu/mtk_iommu.c | 4 +- > drivers/iommu/omap-iommu.c | 6 +-- > drivers/iommu/sprd-iommu.c | 4 +- > drivers/iommu/tegra-gart.c | 2 +- > drivers/iommu/virtio-iommu.c | 7 ++- For virt

[PATCH] dt-bindings: virtio: Convert virtio,pci-iommu to DT schema

2022-09-16 Thread Jean-Philippe Brucker
Convert the binding that describes the virtio-pci based IOMMU to DT schema. Change the compatible string to "pci,", which is defined by the PCI Bus Binding, but keep "virtio,pci-iommu" as an option for backward compatibility. Signed-off-by: Jean-Philippe Brucker --- ...

Re: [PATCH 4/5] iommu: Regulate errno in ->attach_dev callback functions

2022-09-14 Thread Jean-Philippe Brucker
On Wed, Sep 14, 2022 at 06:11:06AM -0300, Jason Gunthorpe wrote: > On Tue, Sep 13, 2022 at 01:27:03PM +0100, Jean-Philippe Brucker wrote: > > I think in the future it will be too easy to forget about the constrained > > return value of attach() while modifying some other par

Re: [PATCH 4/5] iommu: Regulate errno in ->attach_dev callback functions

2022-09-13 Thread Jean-Philippe Brucker
APIs like virtio or ida won't ever return EINVAL, we should set all return values: --- 8< --- >From 7b16796cb78d11971236f98fd2d3cd73ca769827 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Brucker Date: Tue, 13 Sep 2022 12:53:02 +0100 Subject: [PATCH] iommu/virtio: Constrain return value o

Re: [PATCH] iommu/virtio: Fix compile error with viommu_capable()

2022-09-07 Thread Jean-Philippe Brucker
will happen > because the function pointer types mismatch. Fix that by > updating the viommu_capable() signature after the merge. > > Cc: Jean-Philippe Brucker > Cc: Robin Murphy > Signed-off-by: Joerg Roedel Reviewed-by: Jean-Philippe Brucker > --- > drivers/iom

[PATCH v3] iommu/virtio: Fix interaction with VFIO

2022-08-25 Thread Jean-Philippe Brucker
E property and ATTACH/MAP flags. Cc: sta...@vger.kernel.org Fixes: e8ae0e140c05 ("vfio: Require that devices support DMA cache coherence") Signed-off-by: Jean-Philippe Brucker --- Since v2 [1], I tried to refine the commit message. This fix is needed for v5.19 and v6.0. I can i

Re: [PATCH v2] iommu/virtio: Fix interaction with VFIO

2022-08-19 Thread Jean-Philippe Brucker
On Thu, Aug 18, 2022 at 09:10:25PM +0100, Robin Murphy wrote: > On 2022-08-18 17:38, Jean-Philippe Brucker wrote: > > Commit e8ae0e140c05 ("vfio: Require that devices support DMA cache > > coherence") requires IOMMU drivers to advertise > > IOMMU_CAP_CACHE_COHEREN

[PATCH v2] iommu/virtio: Fix interaction with VFIO

2022-08-18 Thread Jean-Philippe Brucker
ints on x86, then virtio-iommu would need additional feature, PROBE property, ATTACH and/or MAP flags to support enforcing snoop. Fixes: e8ae0e140c05 ("vfio: Require that devices support DMA cache coherence") Signed-off-by: Jean-Philippe Brucker --- Since v1 [1], I added some

Re: [PATCH v1 1/1] iommu/virtio: Do not dereference fwnode in struct device

2022-08-09 Thread Jean-Philippe Brucker
Andy Shevchenko Reviewed-by: Jean-Philippe Brucker > --- > drivers/iommu/virtio-iommu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c > index 08eeafc9529f..9fe723f55213 100644 > --- a/

Re: [PATCH] iommu/virtio: Advertise IOMMU_CAP_CACHE_COHERENCY

2022-07-22 Thread Jean-Philippe Brucker
On Thu, Jul 14, 2022 at 02:39:32PM +0100, Robin Murphy wrote: > > In the meantime we do need to restore VFIO support under virtio-iommu, > > since userspace still expects that to work, and the existing use-cases are > > coherent devices. > > Yeah, I'm not necessarily against adding this as a

Re: [PATCH] iommu/virtio: Advertise IOMMU_CAP_CACHE_COHERENCY

2022-07-14 Thread Jean-Philippe Brucker
On Thu, Jul 14, 2022 at 01:01:37PM +0100, Robin Murphy wrote: > On 2022-07-14 12:11, Jean-Philippe Brucker wrote: > > Fix virtio-iommu interaction with VFIO, as VFIO now requires > > IOMMU_CAP_CACHE_COHERENCY. virtio-iommu does not support non-cacheable > > mapping

[PATCH] iommu/virtio: Advertise IOMMU_CAP_CACHE_COHERENCY

2022-07-14 Thread Jean-Philippe Brucker
f-by: Jean-Philippe Brucker --- drivers/iommu/virtio-iommu.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c index 25be4b822aa0..bf340d779c10 100644 --- a/drivers/iommu/virtio-iommu.c +++ b/drivers/iommu/virtio-iommu.c @@ -1006,

Re: [GIT PULL] virtio,vdpa,qemu_fw_cfg: features, cleanups, fixes

2022-01-14 Thread Jean-Philippe Brucker
Hi, On Fri, Jan 14, 2022 at 03:35:15PM -0500, Michael S. Tsirkin wrote: > 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/v

[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 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 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 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 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 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 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 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 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

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: [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 ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization

[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 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

[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 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 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

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: [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: [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 1/5] dt-bindings: virtio: mmio: Add support for device subnode

2021-07-14 Thread Jean-Philippe Brucker
On Tue, Jul 13, 2021 at 10:34:03PM +0200, Arnd Bergmann wrote: > > > Is it going to be a problem if two devices in kernel use the same > > > of_node ? > > > > There shouldn't be. We have nodes be multiple providers (e.g clocks > > and resets) already. > > I think this would be a little different,

[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 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 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 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: [PATCH V3 1/3] gpio: Add virtio-gpio driver

2021-06-10 Thread Jean-Philippe Brucker
Hi, Not being very familiar with GPIO, I just have a few general comments and one on the config space layout On Thu, Jun 10, 2021 at 12:16:46PM +, Viresh Kumar via Stratos-dev wrote: > +static int virtio_gpio_req(struct virtio_gpio *vgpio, u16 type, u16 gpio, > +u8

Re: [Stratos-dev] [PATCH V3 1/3] gpio: Add virtio-gpio driver

2021-06-10 Thread Jean-Philippe Brucker
On Thu, Jun 10, 2021 at 04:00:39PM +, Enrico Weigelt, metux IT consult via Stratos-dev wrote: > On 10.06.21 15:22, Arnd Bergmann wrote: > > > Can you give an example of how this would be hooked up to other drivers > > using those gpios. Can you give an example of how using the "gpio-keys" or

[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 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 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 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 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

[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

Re: [PATCH] dt-bindings: virtio: Convert virtio-mmio to DT schema

2021-06-08 Thread Jean-Philippe Brucker
On Mon, Jun 07, 2021 at 02:39:28PM -0500, Rob Herring wrote: > Convert the virtio-mmio binding to DT schema format. > > Cc: "Michael S. Tsirkin" > Cc: Jason Wang > Cc: Jean-Philippe Brucker > Cc: virtualization@lists.linux-foundation.org > Signed-off-by: Rob

[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

  1   2   3   4   >