From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60543) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYDwq-0007Vx-Bu for qemu-devel@nongnu.org; Wed, 18 Mar 2015 09:23:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YYDwn-0003vQ-2b for qemu-devel@nongnu.org; Wed, 18 Mar 2015 09:23:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59435) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYDwm-0003vM-Ub for qemu-devel@nongnu.org; Wed, 18 Mar 2015 09:23:45 -0400 Date: Wed, 18 Mar 2015 14:23:41 +0100 From: "Michael S. Tsirkin" Message-ID: <20150318142315-mutt-send-email-mst@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH v5 6/7] vfio: add 'x-aer' property to expose aercap List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Chen Fan Cc: izumi.taku@jp.fujitsu.com, alex.williamson@redhat.com, qemu-devel@nongnu.org On Thu, Mar 12, 2015 at 06:23:58PM +0800, Chen Fan wrote: > add 'x-aer' property to let user able to decide whether expose > the aer capability. > > Signed-off-by: Chen Fan If it's exposed to users, it should not have the x- prefix. That prefix means "internal only". > --- > hw/vfio/pci.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c > index 8966c49..0517091 100644 > --- a/hw/vfio/pci.c > +++ b/hw/vfio/pci.c > @@ -159,6 +159,8 @@ typedef struct VFIOPCIDevice { > #define VFIO_FEATURE_ENABLE_VGA (1 << VFIO_FEATURE_ENABLE_VGA_BIT) > #define VFIO_FEATURE_ENABLE_REQ_BIT 1 > #define VFIO_FEATURE_ENABLE_REQ (1 << VFIO_FEATURE_ENABLE_REQ_BIT) > +#define VFIO_FEATURE_ENABLE_AER_BIT 2 > +#define VFIO_FEATURE_ENABLE_AER (1 << VFIO_FEATURE_ENABLE_AER_BIT) > int32_t bootindex; > uint8_t pm_cap; > bool has_vga; > @@ -2731,6 +2733,10 @@ static int vfio_setup_aer(VFIOPCIDevice *vdev, int pos, uint16_t size) > uint32_t severity, errcap; > int ret; > > + if (!(vdev->features & VFIO_FEATURE_ENABLE_AER)) { > + return 0; > + } > + > errcap = vfio_pci_read_config(pdev, pdev->exp.aer_cap + PCI_ERR_CAP, 4); > /* The ability to record multiple headers is depending on > the state of the Multiple Header Recording Capable bit and > @@ -3691,6 +3697,8 @@ static Property vfio_pci_dev_properties[] = { > VFIO_FEATURE_ENABLE_VGA_BIT, false), > DEFINE_PROP_BIT("x-req", VFIOPCIDevice, features, > VFIO_FEATURE_ENABLE_REQ_BIT, true), > + DEFINE_PROP_BIT("x-aer", VFIOPCIDevice, features, > + VFIO_FEATURE_ENABLE_AER_BIT, true), > DEFINE_PROP_INT32("bootindex", VFIOPCIDevice, bootindex, -1), > DEFINE_PROP_BOOL("x-mmap", VFIOPCIDevice, vbasedev.allow_mmap, true), > /* > -- > 1.9.3 >