From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38656) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a4Fpr-0000D5-HE for qemu-devel@nongnu.org; Wed, 02 Dec 2015 17:25:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a4Fpo-0001mc-85 for qemu-devel@nongnu.org; Wed, 02 Dec 2015 17:25:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43371) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a4Fpo-0001mV-2l for qemu-devel@nongnu.org; Wed, 02 Dec 2015 17:25:12 -0500 Message-ID: <1449095107.15753.144.camel@redhat.com> From: Alex Williamson Date: Wed, 02 Dec 2015 15:25:07 -0700 In-Reply-To: <1448372127-28115-3-git-send-email-tianyu.lan@intel.com> References: <1448372127-28115-1-git-send-email-tianyu.lan@intel.com> <1448372127-28115-3-git-send-email-tianyu.lan@intel.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH V2 02/10] Qemu/VFIO: Add new VFIO_GET_PCI_CAP_INFO ioctl cmd definition List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Lan Tianyu Cc: emil.s.tantilov@intel.com, kvm@vger.kernel.org, ard.biesheuvel@linaro.org, aik@ozlabs.ru, donald.c.skidmore@intel.com, mst@redhat.com, eddie.dong@intel.com, agraf@suse.de, quintela@redhat.com, qemu-devel@nongnu.org, blauwirbel@gmail.com, cornelia.huck@de.ibm.com, nrupal.jani@intel.com, kraxel@redhat.com, anthony@codemonkey.ws, amit.shah@redhat.com, pbonzini@redhat.com, mark.d.rustad@intel.com, lcapitulino@redhat.com, gerlitz.or@gmail.com On Tue, 2015-11-24 at 21:35 +0800, Lan Tianyu wrote: > Signed-off-by: Lan Tianyu > --- > linux-headers/linux/vfio.h | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/linux-headers/linux/vfio.h b/linux-headers/linux/vfio.h > index 0508d0b..732b0bd 100644 > --- a/linux-headers/linux/vfio.h > +++ b/linux-headers/linux/vfio.h > @@ -495,6 +495,22 @@ struct vfio_eeh_pe_op { > > #define VFIO_EEH_PE_OP _IO(VFIO_TYPE, VFIO_BASE + 21) > > + > +#define VFIO_FIND_FREE_PCI_CONFIG_REG _IO(VFIO_TYPE, VFIO_BASE + 22) > + > +#define VFIO_GET_PCI_CAP_INFO _IO(VFIO_TYPE, VFIO_BASE + 22) > + > +struct vfio_pci_cap_info { > + __u32 argsz; > + __u32 flags; > +#define VFIO_PCI_CAP_GET_SIZE (1 << 0) > +#define VFIO_PCI_CAP_GET_FREE_REGION (1 << 1) > + __u32 index; > + __u32 offset; > + __u32 size; > + __u8 cap; > +}; > + > /* ***************************************************************** */ > > #endif /* VFIO_H */ I didn't seen a matching kernel patch series for this, but why is the kernel more capable of doing this than userspace is already? These seem like pointless ioctls, we're creating a purely virtual PCI capability, the kernel doesn't really need to participate in that. Also, why are we restricting ourselves to standard capabilities? That's often a crowded space and we can't always know whether an area is free or not based only on it being covered by a capability. Some capabilities can also appear more than once, so there's context that isn't being passed to the kernel here. Thanks, Alex