[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231211203946.35552183.alex.williamson@redhat.com>
Date: Mon, 11 Dec 2023 20:39:46 -0700
From: Alex Williamson <alex.williamson@...hat.com>
To: "Duan, Zhenzhong" <zhenzhong.duan@...el.com>
Cc: "Liu, Yi L" <yi.l.liu@...el.com>,
"joro@...tes.org" <joro@...tes.org>,
"jgg@...dia.com" <jgg@...dia.com>,
"Tian, Kevin" <kevin.tian@...el.com>,
"robin.murphy@....com" <robin.murphy@....com>,
"baolu.lu@...ux.intel.com" <baolu.lu@...ux.intel.com>,
"cohuck@...hat.com" <cohuck@...hat.com>,
"eric.auger@...hat.com" <eric.auger@...hat.com>,
"nicolinc@...dia.com" <nicolinc@...dia.com>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"mjrosato@...ux.ibm.com" <mjrosato@...ux.ibm.com>,
"chao.p.peng@...ux.intel.com" <chao.p.peng@...ux.intel.com>,
"yi.y.sun@...ux.intel.com" <yi.y.sun@...ux.intel.com>,
"peterx@...hat.com" <peterx@...hat.com>,
"jasowang@...hat.com" <jasowang@...hat.com>,
"shameerali.kolothum.thodi@...wei.com"
<shameerali.kolothum.thodi@...wei.com>,
"lulu@...hat.com" <lulu@...hat.com>,
"suravee.suthikulpanit@....com" <suravee.suthikulpanit@....com>,
"iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-kselftest@...r.kernel.org" <linux-kselftest@...r.kernel.org>,
"joao.m.martins@...cle.com" <joao.m.martins@...cle.com>,
"Zeng, Xin" <xin.zeng@...el.com>,
"Zhao, Yan Y" <yan.y.zhao@...el.com>
Subject: Re: [PATCH 3/3] vfio: Report PASID capability via
VFIO_DEVICE_FEATURE ioctl
On Tue, 12 Dec 2023 02:43:20 +0000
"Duan, Zhenzhong" <zhenzhong.duan@...el.com> wrote:
> >-----Original Message-----
> >From: Alex Williamson <alex.williamson@...hat.com>
> >Sent: Tuesday, December 12, 2023 2:04 AM
> >Subject: Re: [PATCH 3/3] vfio: Report PASID capability via
> >VFIO_DEVICE_FEATURE ioctl
> >
> >On Sun, 26 Nov 2023 22:39:09 -0800
> >Yi Liu <yi.l.liu@...el.com> wrote:
> >
> >> This reports the PASID capability data to userspace via
> >VFIO_DEVICE_FEATURE,
> >> hence userspace could probe PASID capability by it. This is a bit different
> >> with other capabilities which are reported to userspace when the user
> >reads
> >> the device's PCI configuration space. There are two reasons for this.
> >>
> >> - First, Qemu by default exposes all available PCI capabilities in vfio-pci
> >> config space to the guest as read-only, so adding PASID capability in the
> >> vfio-pci config space will make it exposed to the guest automatically
> >while
> >> an old Qemu doesn't really support it.
> >
> >Shouldn't we also be working on hiding the PASID capability in QEMU
> >ASAP? This feature only allows QEMU to know PASID control is actually
> >available, not the guest. Maybe we're hoping this is really only used
> >by VFs where there's no capability currently exposed to the guest?
>
> PASID capability is not exposed to QEMU through config space,
> VFIO_DEVICE_FEATURE ioctl is the only interface to expose PASID
> cap to QEMU for both PF and VF.
>
> /*
> * Lengths of PCIe/PCI-X Extended Config Capabilities
> * 0: Removed or masked from the user visible capability list
> * FF: Variable length
> */
> static const u16 pci_ext_cap_length[PCI_EXT_CAP_ID_MAX + 1] = {
> ...
> [PCI_EXT_CAP_ID_PASID] = 0, /* not yet */
> }
Ah, thanks. The comment made me think is was already exposed and I
didn't double check. So we really just want to convey the information
of the PASID capability outside of config space because if we pass the
capability itself existing userspace will blindly expose a read-only
version to the guest. That could be better explained in the commit log
and comments.
So how do we keep up with PCIe spec updates relative to the PASID
capability with this proposal? Would it make more sense to report the
raw capability register and capability version rather that a translated
copy thereof? Perhaps just masking the fields we're currently prepared
to expose. Thanks,
Alex
Powered by blists - more mailing lists