From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59151) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwcKs-0001IW-K8 for qemu-devel@nongnu.org; Wed, 11 Nov 2015 15:49:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZwcKp-0006Jl-CU for qemu-devel@nongnu.org; Wed, 11 Nov 2015 15:49:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40349) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwcKp-0006Jf-72 for qemu-devel@nongnu.org; Wed, 11 Nov 2015 15:49:39 -0500 Message-ID: <1447274976.3946.17.camel@redhat.com> From: Alex Williamson Date: Wed, 11 Nov 2015 13:49:36 -0700 In-Reply-To: <7d730be4f52fcd790b83a8329a17a099b2b6ceb9.1447231392.git.chen.fan.fnst@cn.fujitsu.com> References: <7d730be4f52fcd790b83a8329a17a099b2b6ceb9.1447231392.git.chen.fan.fnst@cn.fujitsu.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v13 07/13] vfio: add aer support for vfio device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cao jin Cc: Chen Fan , qemu-devel@nongnu.org, mst@redhat.com On Wed, 2015-11-11 at 18:34 +0800, Cao jin wrote: > From: Chen Fan > > Calling pcie_aer_init to initilize aer related registers for > vfio device, then reload physical related registers to expose > device capability. > > Signed-off-by: Chen Fan > --- What if VFIO_FEATURE_ENABLE_AER is enabled for a device that doesn't posses an AER capability or isn't attached to a PCIe bus? It appears that we silently ignore it, which would lead to unregistering a hotplug notifier that was never registered in 09/13 and needing to test both VFIO_FEATURE_ENABLE_AER and exp.aer_cap in 12/13 as well as the inconsistency that we often only test for VFIO_FEATURE_ENABLE_AER when really we expect that to imply that AER is setup and enabled for the device. It seems like we need to error either within vfio_add_capabilities() or after calling it if VFIO_FEATURE_ENABLE_AER is specified but not configured. If a user expects AER to be enabled for a device by specifying aer=on, we need to fail if that's not possible. > hw/vfio/pci.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- > hw/vfio/pci.h | 3 +++ > 2 files changed, 82 insertions(+), 3 deletions(-) > > diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c > index 4bc2b51..2d34edf 100644 > --- a/hw/vfio/pci.c > +++ b/hw/vfio/pci.c > @@ -1806,6 +1806,68 @@ static int vfio_add_std_cap(VFIOPCIDevice *vdev, uint8_t pos) ... > + > + pcie_cap_deverr_init(pdev); > + ret = pcie_aer_init(pdev, pos, size); > + if (ret) { > + return ret; > + } This branch is unnecessary, we can simply: return pcie_aer_init(pdev, pos, size); if we get this far. Thanks, Alex