> -----Original Message----- > From: Cédric Le Goater <[email protected]> > Sent: 16 June 2026 13:48 > To: Nathan Chen <[email protected]>; [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]>; Matt Ochs <[email protected]>; Nicolin Chen > <[email protected]>; Shameer Kolothum Thodi > <[email protected]> > Subject: Re: [PATCH v2 2/3] vfio/pci: Add ats property > > External email: Use caution opening links or attachments > > > On 6/15/26 22:48, Nathan Chen wrote: > > From: Nathan Chen <[email protected]> > > > > Add an "ats" OnOffAuto property to vfio-pci. When the device has an ATS > > extended capability in config space but we should not expose it (ats=off, > > or ats=auto and kernel reports > IOMMU_HW_CAP_PCI_ATS_NOT_SUPPORTED), mask > > the capability so the guest does not see it. > > > > If ATS is explicitly requested but not supported by the kernel, fail > > device realize. > > > > This aligns with the kernel's per-device effective ATS reporting and allows > > vfio-pci to mask ATS when the host kernel reports ATS as unsupported. > > > > Introduce a new compat for the changed default for vfio-pci device ATS > > property, from "on" to "auto". > > > > Suggested-by: Shameer Kolothum <[email protected]> > > Signed-off-by: Nathan Chen <[email protected]> > > --- > > hw/vfio/pci.h | 1 + > > hw/core/machine.c | 1 + > > hw/vfio/pci.c | 74 > +++++++++++++++++++++++++++++++++++++++++++++-- > > 3 files changed, 73 insertions(+), 3 deletions(-) > > > > diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h > > index c3a1f53d35..f2934f2d84 100644 > > --- a/hw/vfio/pci.h > > +++ b/hw/vfio/pci.h > > @@ -188,6 +188,7 @@ struct VFIOPCIDevice { > > bool clear_parent_atomics_on_exit; > > bool skip_vsc_check; > > uint16_t vpasid_cap_offset; > > + OnOffAuto ats; > > VFIODisplay *dpy; > > Notifier irqchip_change_notifier; > > VFIOPCICPR cpr; > > diff --git a/hw/core/machine.c b/hw/core/machine.c > > index 4d8b15d99e..c0cdf7c9da 100644 > > --- a/hw/core/machine.c > > +++ b/hw/core/machine.c > > @@ -43,6 +43,7 @@ GlobalProperty hw_compat_11_0[] = { > > { "chardev-vc", "encoding", "cp437" }, > > { "tpm-crb", "cap-chunk", "off" }, > > { "tpm-crb", "x-allow-chunk-migration", "off" }, > > + { "vfio-pci", "ats", "on" }, > > > This compat "ats=on" for old machine types (11.0 and below) should > preserve > the old guest-visible behavior : ATS is always advertised regardless of > kernel capability. > > Now, if the kernel is upgraded and reports > IOMMU_HW_CAP_PCI_ATS_NOT_SUPPORTED, > the VM will now fail to realize the vfio-pci device, fail to boot and the > backward compatibility across machine types is broken ... Tough. > > We could argue that the previous behavior was wrong but should be "bug" > compatible too. > > > So, we could : > > 1. ignore, > 2. use a compat "ats=auto", which would hide ATS reported unsupported > in new kernels, > 3. add a legacy compat "x-ats-strict=off" property to warn but not fail > realize, and keep ATS enabled.
I would go with option 2 as failing to boot is too harsh. If host kernel already reports ATS NOT_SUPPORTED, guest use of ATS is already broken(so it doesn't matter even if we hide it after upgrade ). Thanks, Shameer
