From: Eric Auger <eric.auger@redhat.com>
To: Shameer Kolothum <skolothumtho@nvidia.com>,
"qemu-arm@nongnu.org" <qemu-arm@nongnu.org>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: "peter.maydell@linaro.org" <peter.maydell@linaro.org>,
Jason Gunthorpe <jgg@nvidia.com>,
Nicolin Chen <nicolinc@nvidia.com>,
"ddutile@redhat.com" <ddutile@redhat.com>,
"berrange@redhat.com" <berrange@redhat.com>,
Nathan Chen <nathanc@nvidia.com>, Matt Ochs <mochs@nvidia.com>,
"smostafa@google.com" <smostafa@google.com>,
"wangzhou1@hisilicon.com" <wangzhou1@hisilicon.com>,
"jiangkunkun@huawei.com" <jiangkunkun@huawei.com>,
"jonathan.cameron@huawei.com" <jonathan.cameron@huawei.com>,
"zhangfei.gao@linaro.org" <zhangfei.gao@linaro.org>,
"zhenzhong.duan@intel.com" <zhenzhong.duan@intel.com>,
"yi.l.liu@intel.com" <yi.l.liu@intel.com>,
"shameerkolothum@gmail.com" <shameerkolothum@gmail.com>
Subject: Re: [PATCH v4 06/27] hw/arm/smmuv3-accel: Restrict accelerated SMMUv3 to vfio-pci endpoints with iommufd
Date: Fri, 17 Oct 2025 14:47:21 +0200 [thread overview]
Message-ID: <646bbedb-cfa4-418c-80b2-f143f6f97544@redhat.com> (raw)
In-Reply-To: <CH3PR12MB754822A08B7D9D7317DBECD8ABE7A@CH3PR12MB7548.namprd12.prod.outlook.com>
Hi Shameer,
On 10/2/25 11:30 AM, Shameer Kolothum wrote:
> Hi Eric,
>
>> -----Original Message-----
>> From: Eric Auger <eric.auger@redhat.com>
>> Sent: 01 October 2025 18:32
>> To: Shameer Kolothum <skolothumtho@nvidia.com>; qemu-
>> arm@nongnu.org; qemu-devel@nongnu.org
>> Cc: peter.maydell@linaro.org; Jason Gunthorpe <jgg@nvidia.com>; Nicolin
>> Chen <nicolinc@nvidia.com>; ddutile@redhat.com; berrange@redhat.com;
>> Nathan Chen <nathanc@nvidia.com>; Matt Ochs <mochs@nvidia.com>;
>> smostafa@google.com; wangzhou1@hisilicon.com;
>> jiangkunkun@huawei.com; jonathan.cameron@huawei.com;
>> zhangfei.gao@linaro.org; zhenzhong.duan@intel.com; yi.l.liu@intel.com;
>> shameerkolothum@gmail.com
>> Subject: Re: [PATCH v4 06/27] hw/arm/smmuv3-accel: Restrict accelerated
>> SMMUv3 to vfio-pci endpoints with iommufd
>>
>> External email: Use caution opening links or attachments
>>
>> Hi Shameer,
>>
>> On 9/29/25 3:36 PM, Shameer Kolothum wrote:
>>> Accelerated SMMUv3 is only useful when the device can take advantage
>>> of the host's SMMUv3 in nested mode. To keep things simple and
>>> correct, we only allow this feature for vfio-pci endpoint devices that
>>> use the iommufd backend. We also allow non-endpoint emulated devices
>>> like PCI bridges and root ports, so that users can plug in these
>>> vfio-pci devices. We can only enforce this if devices are cold
>>> plugged. For hotplug cases, give appropriate
>> "We can only enforce this if devices are cold plugged": I don't really
>> understand that statement.
> By "enforce" here I meant, we can prevent user from starting a Guest
> with a non "vfio-pci/iommufd dev" with accel=one case.
Ah OK I misread the code. I thought you were also exiting in case of
hotplug but you only issue a warn_report.
From a user point of view, the assigned device will succeed attachment
but won't work. Will we get subsequent messages? I understand the pain
of propagating the error but if the user experience is bad I think it
should weight over ?
>
> you do checks when the device is hotplugged too.
>> For emulated device you eventually allow them but you could decide to reject
>> them?
> Currently get_address_space() is a " Mandatory callback which returns a pointer
> to an #AddressSpace". Changing that and propagating an error all the way, as
> you said below, is not that straightforward. At present we warn the user
> appropriately for both vfio-pci without iommufd and emulated device hot plug
> cases. Perhaps, if required, the error handling can be taken up as a clean-up series
> later?
>
> Also, I think I need to explain the emulated device hotplug case a bit more. This
> is something I realised later during the tests.
>
> Unfortunately, the hotplug scenario for emulated devices behaves differently.
> What I’ve noticed is that the hotplug handler’s call path to get_address_space()
> differs from cold-plug cases.
>
> In the emulated device hotplug case, the pdev is NULL for below:
> PCIDevice *pdev = pci_find_device(bus, pci_bus_num(bus), devfn);
>
> Here’s what seems to be happening:
>
> do_pci_register_device() {
> ....
> if (phase_check(PHASE_MACHINE_READY)) {
> pci_init_bus_master(pci_dev);
> pci_device_iommu_address_space() --> get_address_space()
> }
> ....
> bus->devices[devfn] = pci_dev; //happens only after the above call.
> }
>
> For vfio-pci hotplug, we’re fine, since the vfio layer calls get_address_space()
> again, with a valid pdev.
>
> For cold-plug cases, the if (phase_check(PHASE_MACHINE_READY)) check is
> false, and the call path looks like this:
>
> pcibus_machine_done()
> pci_init_bus_master(pci_dev);
> pci_device_iommu_address_space() --> get_address_space()
>
> By then we have a valid pdev.
>
> I’m not sure there’s an easy fix here. One option could be to modify
> get_address_space() to take pci_dev as input. Or we could change the
> call path order above.
>
> (See my below reply to emulated dev warn_report() case as well)
>
> Please let me know your thoughts.
Can't you move the assignment of bus->devices[devfn] before the call and
unset it in case of failure?
Or if you propagate errors from
get_address_space() you could retry the call later?
Eric
>
>>> warnings.
>>>
> [...]
>
>>> +
>>> + if (pdev && !smmuv3_accel_pdev_allowed(pdev, &vfio_pci)) {
>>> + if (DEVICE(pdev)->hotplugged) {
>>> + if (vfio_pci) {
>>> + warn_report("Hot plugging a vfio-pci device (%s) without "
>>> + "iommufd as backend is not supported",
>>> + pdev->name);
>> with accelerated SMMUv3.
>>
>> why don't we return NULL and properly handle this in the caller. May be worth
>> adding an errp to get_address_space(). I know this is cumbersome though.
> See above reply on propagating err from this callback.
>
>>> + } else {
>>> + warn_report("Hot plugging an emulated device %s with "
>>> + "accelerated SMMUv3. This will bring down "
>>> + "performace", pdev->name);
>> performance
>>> + }
> As I mentioned above, since the pdev for emulated dev hotplug case is NULL,
> we will not hit the above warning.
>
>>> + /*
>>> + * Both cases, we will return IOMMU address space. For
>>> + hotplugged
>> In both cases?
> Yes, since we can't return NULL here. However, as done here, we will inform
> the user appropriately.
>
>>> + * vfio-pci dev without iommufd as backend, it will fail later in
>>> + * smmuv3_notify_flag_changed() with "requires iommu MAP
>> notifier"
> [...]
>
>>> +#define TYPE_PXB_PCIE_DEV "pxb-pcie"
>> I agree with Nicolin, you shall rather move that change in a seperate patch.
> I thought of mentioning this change in the commit log(which I missed) and
> avoiding a separate patch just for this. But if you guys feel strongly, I will
> have a separate one.
>
> Thanks,
> Shameer
next prev parent reply other threads:[~2025-10-17 12:48 UTC|newest]
Thread overview: 118+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-29 13:36 [PATCH v4 00/27] hw/arm/virt: Add support for user-creatable accelerated SMMUv3 Shameer Kolothum
2025-09-29 13:36 ` [PATCH v4 01/27] backends/iommufd: Introduce iommufd_backend_alloc_viommu Shameer Kolothum
2025-09-29 15:35 ` Jonathan Cameron via
2025-10-17 12:21 ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 02/27] backends/iommufd: Introduce iommufd_vdev_alloc Shameer Kolothum
2025-09-29 15:40 ` Jonathan Cameron via
2025-09-29 17:52 ` Nicolin Chen
2025-09-30 8:14 ` Shameer Kolothum
2025-09-29 13:36 ` [PATCH v4 03/27] hw/arm/smmu-common: Factor out common helper functions and export Shameer Kolothum
2025-09-29 15:43 ` Jonathan Cameron via
2025-09-29 13:36 ` [PATCH v4 04/27] hw/arm/smmu-common:Make iommu ops part of SMMUState Shameer Kolothum
2025-09-29 15:45 ` Jonathan Cameron via
2025-09-29 21:53 ` Nicolin Chen via
2025-10-01 16:11 ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 05/27] hw/arm/smmuv3-accel: Introduce smmuv3 accel device Shameer Kolothum
2025-09-29 15:53 ` Jonathan Cameron via
2025-09-29 22:24 ` Nicolin Chen
2025-10-01 16:25 ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 06/27] hw/arm/smmuv3-accel: Restrict accelerated SMMUv3 to vfio-pci endpoints with iommufd Shameer Kolothum
2025-09-29 16:08 ` Jonathan Cameron via
2025-09-30 8:03 ` Shameer Kolothum
2025-10-01 16:38 ` Eric Auger
2025-10-02 8:16 ` Shameer Kolothum
2025-09-30 0:11 ` Nicolin Chen
2025-10-02 7:29 ` Shameer Kolothum
2025-10-01 17:32 ` Eric Auger
2025-10-02 9:30 ` Shameer Kolothum
2025-10-17 12:47 ` Eric Auger [this message]
2025-10-17 13:15 ` Shameer Kolothum
2025-10-17 17:19 ` Eric Auger
2025-10-20 16:31 ` Eric Auger
2025-10-20 18:25 ` Nicolin Chen
2025-10-20 18:59 ` Shameer Kolothum
2025-10-21 15:28 ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 07/27] hw/arm/smmuv3: Implement get_viommu_cap() callback Shameer Kolothum
2025-09-29 16:13 ` Jonathan Cameron via
2025-10-01 17:36 ` Eric Auger
2025-10-02 9:38 ` Shameer Kolothum
2025-10-02 12:31 ` Eric Auger
2025-10-02 9:39 ` Jonathan Cameron via
2025-09-29 13:36 ` [PATCH v4 08/27] hw/arm/smmuv3-accel: Add set/unset_iommu_device callback Shameer Kolothum
2025-09-29 16:25 ` Jonathan Cameron via
2025-09-30 8:13 ` Shameer Kolothum
2025-10-02 6:52 ` Eric Auger
2025-10-02 11:34 ` Shameer Kolothum
2025-10-02 16:44 ` Nicolin Chen
2025-10-02 18:35 ` Jason Gunthorpe
2025-10-17 12:06 ` Eric Auger
2025-10-17 12:23 ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 09/27] hw/arm/smmuv3-accel: Support nested STE install/uninstall support Shameer Kolothum
2025-09-29 16:41 ` Jonathan Cameron via
2025-10-02 10:04 ` Eric Auger
2025-10-02 12:08 ` Shameer Kolothum
2025-10-02 12:27 ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 10/27] hw/arm/smmuv3-accel: Allocate a vDEVICE object for device Shameer Kolothum
2025-09-29 16:42 ` Jonathan Cameron via
2025-10-17 13:08 ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 11/27] hw/pci/pci: Introduce optional get_msi_address_space() callback Shameer Kolothum
2025-09-29 16:48 ` Jonathan Cameron via
2025-10-16 22:30 ` Nicolin Chen
2025-10-20 16:14 ` Eric Auger
2025-10-20 18:00 ` Nicolin Chen
2025-10-21 16:26 ` Eric Auger
2025-10-21 18:56 ` Nicolin Chen
2025-10-22 16:25 ` Eric Auger
2025-10-22 16:56 ` Shameer Kolothum
2025-10-20 16:21 ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 12/27] hw/arm/smmuv3-accel: Make use of " Shameer Kolothum
2025-09-29 16:51 ` Jonathan Cameron via
2025-10-02 7:33 ` Shameer Kolothum
2025-10-16 23:28 ` Nicolin Chen
2025-10-20 16:43 ` Eric Auger
2025-10-21 8:15 ` Shameer Kolothum
2025-10-21 16:16 ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 13/27] hw/arm/smmuv3-accel: Add support to issue invalidation cmd to host Shameer Kolothum
2025-09-29 16:53 ` Jonathan Cameron via
2025-10-16 22:59 ` Nicolin Chen via
2025-09-29 13:36 ` [PATCH v4 14/27] hw/arm/smmuv3-accel: Get host SMMUv3 hw info and validate Shameer Kolothum
2025-10-01 12:56 ` Jonathan Cameron via
2025-10-02 7:37 ` Shameer Kolothum
2025-10-02 9:54 ` Jonathan Cameron via
2025-09-29 13:36 ` [PATCH v4 15/27] acpi/gpex: Fix PCI Express Slot Information function 0 returned value Shameer Kolothum
2025-10-01 12:59 ` Jonathan Cameron via
2025-10-02 7:39 ` Shameer Kolothum
2025-10-21 15:32 ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 16/27] hw/pci-host/gpex: Allow to generate preserve boot config DSM #5 Shameer Kolothum
2025-10-01 13:05 ` Jonathan Cameron via
2025-09-29 13:36 ` [PATCH v4 17/27] hw/arm/virt: Set PCI preserve_config for accel SMMUv3 Shameer Kolothum
2025-10-01 13:06 ` Jonathan Cameron via
2025-09-29 13:36 ` [PATCH v4 18/27] hw/arm/virt-acpi-build: Add IORT RMR regions to handle MSI nested binding Shameer Kolothum
2025-10-01 13:30 ` Jonathan Cameron via
2025-09-29 13:36 ` [PATCH v4 19/27] hw/arm/smmuv3-accel: Install S1 bypass hwpt on reset Shameer Kolothum
2025-10-01 13:32 ` Jonathan Cameron via
2025-10-16 23:19 ` Nicolin Chen
2025-10-20 14:22 ` Shameer Kolothum
2025-09-29 13:36 ` [PATCH v4 20/27] hw/arm/smmuv3: Add accel property for SMMUv3 device Shameer Kolothum
2025-10-16 21:48 ` Nicolin Chen
2025-09-29 13:36 ` [PATCH v4 21/27] hw/arm/smmuv3-accel: Add a property to specify RIL support Shameer Kolothum
2025-10-01 13:39 ` Jonathan Cameron via
2025-10-17 8:48 ` Zhangfei Gao
2025-10-17 9:40 ` Shameer Kolothum
2025-10-17 14:05 ` Zhangfei Gao
2025-09-29 13:36 ` [PATCH v4 22/27] hw/arm/smmuv3-accel: Add support for ATS Shameer Kolothum
2025-10-01 13:43 ` Jonathan Cameron via
2025-09-29 13:36 ` [PATCH v4 23/27] hw/arm/smmuv3-accel: Add property to specify OAS bits Shameer Kolothum
2025-10-01 13:46 ` Jonathan Cameron via
2025-09-29 13:36 ` [PATCH v4 24/27] backends/iommufd: Retrieve PASID width from iommufd_backend_get_device_info() Shameer Kolothum
2025-10-01 13:50 ` Jonathan Cameron via
2025-09-29 13:36 ` [PATCH v4 25/27] backends/iommufd: Add a callback helper to retrieve PASID support Shameer Kolothum
2025-10-01 13:52 ` Jonathan Cameron via
2025-09-29 13:36 ` [PATCH v4 26/27] vfio: Synthesize vPASID capability to VM Shameer Kolothum
2025-10-01 13:58 ` Jonathan Cameron via
2025-10-02 8:03 ` Shameer Kolothum
2025-10-02 9:58 ` Jonathan Cameron via
2025-09-29 13:36 ` [PATCH v4 27/27] hw.arm/smmuv3: Add support for PASID enable Shameer Kolothum
2025-10-01 14:01 ` Jonathan Cameron via
2025-10-17 6:25 ` [PATCH v4 00/27] hw/arm/virt: Add support for user-creatable accelerated SMMUv3 Zhangfei Gao
2025-10-17 9:43 ` Shameer Kolothum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=646bbedb-cfa4-418c-80b2-f143f6f97544@redhat.com \
--to=eric.auger@redhat.com \
--cc=berrange@redhat.com \
--cc=ddutile@redhat.com \
--cc=jgg@nvidia.com \
--cc=jiangkunkun@huawei.com \
--cc=jonathan.cameron@huawei.com \
--cc=mochs@nvidia.com \
--cc=nathanc@nvidia.com \
--cc=nicolinc@nvidia.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=shameerkolothum@gmail.com \
--cc=skolothumtho@nvidia.com \
--cc=smostafa@google.com \
--cc=wangzhou1@hisilicon.com \
--cc=yi.l.liu@intel.com \
--cc=zhangfei.gao@linaro.org \
--cc=zhenzhong.duan@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).