Re: [RESEND PATCH v2] vhost: Allow null msg.size on VHOST_IOTLB_INVALIDATE

2023-10-16 Thread Eric Auger
Hi, On 9/27/23 16:05, Eric Auger wrote: > Commit e2ae38cf3d91 ("vhost: fix hung thread due to erroneous iotlb > entries") Forbade vhost iotlb msg with null size to prevent entries > with size = start = 0 and last = ULONG_MAX to end up in the iotlb. > > Then commit 95

[RESEND PATCH v2] vhost: Allow null msg.size on VHOST_IOTLB_INVALIDATE

2023-09-27 Thread Eric Auger
ase with qemu/smmuv3/vhost integration which does not work anymore. It Looks safe to partially revert the original commit and allow VHOST_IOTLB_INVALIDATE messages with null size. vhost_iotlb_del_range() will compute a correct end iova. Same for vhost_vdpa_iotlb_unmap(). Signed-off-by: Eric Auger

Re: [PATCH v2] vhost: Allow null msg.size on VHOST_IOTLB_INVALIDATE

2023-09-13 Thread Eric Auger
Hi, On 8/24/23 11:37, Eric Auger wrote: > Commit e2ae38cf3d91 ("vhost: fix hung thread due to erroneous iotlb > entries") Forbade vhost iotlb msg with null size to prevent entries > with size = start = 0 and last = ULONG_MAX to end up in the iotlb. > > Then commit 95

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

2023-09-07 Thread Eric Auger
Hi, On 9/6/23 15:20, Jean-Philippe Brucker wrote: > 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

[PATCH v2] vhost: Allow null msg.size on VHOST_IOTLB_INVALIDATE

2023-08-24 Thread Eric Auger
ase with qemu/smmuv3/vhost integration which does not work anymore. It Looks safe to partially revert the original commit and allow VHOST_IOTLB_INVALIDATE messages with null size. vhost_iotlb_del_range() will compute a correct end iova. Same for vhost_vdpa_iotlb_unmap(). Signed-off-by: Eric Auger

[PATCH] vhost: Allow null msg.size on VHOST_IOTLB_INVALIDATE

2023-08-23 Thread Eric Auger
ase with qemu/smmuv3/vhost integration which does not work anymore. It Looks safe to partially revert the original commit and allow VHOST_IOTLB_INVALIDATE messages with null size. vhost_iotlb_del_range() will compute a correct end iova. Same for vhost_vdpa_iotlb_unmap(). Signed-off-by: Eric Auger

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

2023-05-10 Thread Eric Auger
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 a > DETACH request. > > Fixes: edcd69ab9a32 ("iommu: Add virtio-iommu driver") > Reported-by:

Re: virtio-iommu hotplug issue

2023-04-13 Thread Eric Auger
Hi, On 4/13/23 13:01, Akihiko Odaki wrote: > On 2023/04/13 19:40, Jean-Philippe Brucker wrote: >> 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

Re: [PATCH 0/2] vhost/net: Clear the pending messages when the backend is removed

2023-01-29 Thread Eric Auger
Hi, On 1/17/23 16:15, Eric Auger wrote: > When the vhost iotlb is used along with a guest virtual iommu > and the guest gets rebooted, some MISS messages may have been > recorded just before the reboot and spuriously executed by > the virtual iommu after the reboot. This is due

[PATCH 0/2] vhost/net: Clear the pending messages when the backend is removed

2023-01-17 Thread Eric Auger
in vhost_init_device_iotlb(). Best Regards Eric History: [1] RFC: [RFC] vhost: Clear the pending messages on vhost_init_device_iotlb() https://lore.kernel.org/all/20221107203431.368306-1-eric.au...@redhat.com/ Eric Auger (2): vhost: Remove the enabled parameter from vhost_init_device_iotlb vhost/net: Clear

[PATCH 1/2] vhost: Remove the enabled parameter from vhost_init_device_iotlb

2023-01-17 Thread Eric Auger
The 'enabled' parameter is not used by the function. Remove it. Signed-off-by: Eric Auger Reported-by: Michael S. Tsirkin --- drivers/vhost/net.c | 2 +- drivers/vhost/vhost.c | 2 +- drivers/vhost/vhost.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/vhost

[PATCH 2/2] vhost/net: Clear the pending messages when the backend is removed

2023-01-17 Thread Eric Auger
looks a reasonable point where to clear the pending messages, in case the backend is removed. Export vhost_clear_msg() and call it in vhost_net_set_backend() when fd == -1. Signed-off-by: Eric Auger Suggested-by: Jason Wang Fixes: 6b1e6cc7855b0 ("vhost: new device IOTLB API") --

Re: [RFC] vhost: Clear the pending messages on vhost_init_device_iotlb()

2022-11-08 Thread Eric Auger
Hi Jason, On 11/9/22 04:44, Jason Wang wrote: > On Tue, Nov 8, 2022 at 6:17 PM Eric Auger wrote: >> Hi Michael, Jason, >> >> On 11/8/22 10:31, Michael S. Tsirkin wrote: >>> On Tue, Nov 08, 2022 at 05:13:50PM +0800, Jason Wang wrote: >>>> On Tue, Nov 8,

Re: [RFC] vhost: Clear the pending messages on vhost_init_device_iotlb()

2022-11-08 Thread Eric Auger
v 8, 2022 at 7:06 AM Michael S. Tsirkin wrote: >>>>> On Mon, Nov 07, 2022 at 10:10:06PM +0100, Eric Auger wrote: >>>>>> Hi Michael, >>>>>> On 11/7/22 21:42, Michael S. Tsirkin wrote: >>>>>>> On Mon, Nov 07, 2022 at 09:3

Re: [RFC] vhost: Clear the pending messages on vhost_init_device_iotlb()

2022-11-07 Thread Eric Auger
On 11/8/22 04:09, Jason Wang wrote: > On Tue, Nov 8, 2022 at 7:06 AM Michael S. Tsirkin wrote: >> On Mon, Nov 07, 2022 at 10:10:06PM +0100, Eric Auger wrote: >>> Hi Michael, >>> On 11/7/22 21:42, Michael S. Tsirkin wrote: >>>> On Mon, Nov 07, 202

Re: [RFC] vhost: Clear the pending messages on vhost_init_device_iotlb()

2022-11-07 Thread Eric Auger
Hi Michael, On 11/7/22 21:42, Michael S. Tsirkin wrote: > On Mon, Nov 07, 2022 at 09:34:31PM +0100, Eric Auger wrote: >> When the vhost iotlb is used along with a guest virtual iommu >> and the guest gets rebooted, some MISS messages may have been >> recorded just before the

[RFC] vhost: Clear the pending messages on vhost_init_device_iotlb()

2022-11-07 Thread Eric Auger
that by calling vhost_clear_msg() at the end of vhost_init_device_iotlb(). Signed-off-by: Eric Auger --- drivers/vhost/vhost.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 40097826cff0..422a1fdee0ca 100644 --- a/drivers/vhost/vhost.c

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

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

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

[PATCH v2] dma-mapping: Use dma_get_mask in dma_addressing_limited

2019-07-22 Thread Eric Auger
We currently have cases where the dma_addressing_limited() gets called with dma_mask unset. This causes a NULL pointer dereference. Use dma_get_mask() accessor to prevent the crash. Fixes: b866455423e0 ("dma-mapping: add a dma_addressing_limited helper") Signed-off-by: Eric Auger ---

[PATCH 2/2] virtio/virtio_ring: Fix the dma_max_mapping_size call

2019-07-22 Thread Eric Auger
Do not call dma_max_mapping_size for devices that have no DMA mask set, otherwise we can hit a NULL pointer dereference. This occurs when a virtio-blk-pci device is protected with a virtual IOMMU. Fixes: e6d6dd6c875e ("virtio: Introduce virtio_max_dma_size()") Signed-off-by:

[PATCH 1/2] dma-mapping: Protect dma_addressing_limited against NULL dma_mask

2019-07-22 Thread Eric Auger
dma_addressing_limited() should not be called on a device with a NULL dma_mask. If this occurs let's WARN_ON_ONCE and immediately return. Existing call sites are updated separately. Fixes: b866455423e0 ("dma-mapping: add a dma_addressing_limited helper") Signed-off-by: Eric Auger ---

[PATCH 0/2] Fix NULL pointer dereference with virtio-blk-pci and virtual IOMMU

2019-07-22 Thread Eric Auger
in dma_addressing_limited() if the dma_mask is NULL. Eric Auger (2): dma-mapping: Protect dma_addressing_limited against NULL dma_mask virtio/virtio_ring: Fix the dma_max_mapping_size call drivers/virtio/virtio_ring.c | 2 +- include/linux/dma-mapping.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions

[PATCH] vhost: Fix vhost_copy_to_user()

2018-04-11 Thread Eric Auger
vhost_copy_to_user is used to copy vring used elements to userspace. We should use VHOST_ADDR_USED instead of VHOST_ADDR_DESC. Fixes: f88949138058 ("vhost: introduce O(1) vq metadata cache") Signed-off-by: Eric Auger <eric.au...@redhat.com> --- This fixes a stall obser

Re: [Qemu-devel] [RFC PATCH 0/2] virtio-mmio: add irqfd support for vhost-net based on virtio-mmio

2014-11-10 Thread Eric Auger
On 10/27/2014 12:23 PM, Li Liu wrote: On 2014/10/27 17:37, Peter Maydell wrote: On 25 October 2014 09:24, john.liuli john.li...@huawei.com wrote: To get the interrupt reason to support such VIRTIO_NET_F_STATUS features I add a new register offset VIRTIO_MMIO_ISRMEM which will help to