> -----Original Message-----
> From: Nathan Chen <[email protected]>
> Sent: 15 June 2026 21:49
> To: [email protected]
> Cc: Yi Liu <[email protected]>; Eric Auger <[email protected]>;
> Zhenzhong Duan <[email protected]>; Philippe Mathieu-Daudé
> <[email protected]>; Zhao Liu <[email protected]>; Alex Williamson
> <[email protected]>; Cédric Le Goater <[email protected]>; Matt Ochs
> <[email protected]>; Nicolin Chen <[email protected]>; Shameer
> Kolothum Thodi <[email protected]>; Nathan Chen
> <[email protected]>
> Subject: [PATCH v2 3/3] vfio/pci: Warn when ats=on but host device lacks ATS
> cap
>
> From: Nathan Chen <[email protected]>
>
> Emit a warning when ats=on is requested but the physical device does not
> advertise ATS, since ATS cannot be exposed to the guest in this case.
>
> Signed-off-by: Nathan Chen <[email protected]>
> ---
> hw/vfio/pci.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 0f592ada89..49ba6813ee
> 100644
> --- a/hw/vfio/pci.c
> +++ b/hw/vfio/pci.c
> @@ -2592,6 +2592,7 @@ static void vfio_add_ext_cap(VFIOPCIDevice
> *vdev, bool ats_needed) {
> PCIDevice *pdev = PCI_DEVICE(vdev);
> bool pasid_cap_added = false;
> + bool ats_cap_present = false;
> Error *err = NULL;
> uint32_t header;
> uint16_t cap_id, next, size;
> @@ -2680,6 +2681,7 @@ static void vfio_add_ext_cap(VFIOPCIDevice
> *vdev, bool ats_needed)
> pcie_add_capability(pdev, cap_id, cap_ver, next, size);
> break;
> case PCI_EXT_CAP_ID_ATS:
> + ats_cap_present = true;
> /*
> * If ATS is requested and supported according to the kernel, add
> * the ATS capability. If not supported according to the kernel
> or @@ -
> 2699,6 +2701,11 @@ static void vfio_add_ext_cap(VFIOPCIDevice *vdev,
> bool ats_needed)
> error_report_err(err);
> }
>
> + if (vdev->ats == ON_OFF_AUTO_ON && !ats_cap_present) {
Nit: Can we do:
If (ats_needed && !ats_cap_present) here?
> + warn_report("vfio-pci: ats=on requested, but host device has no "
> + "ATS extended capability");
> + }
> +
Also, why this has to be a separate patch? Can't we fold into patch #2?
Besides(if you plan to keep this as separate one):
Reviewed-by: Shameer Kolothum <[email protected]>
Thanks,
Shameer