From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36944) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBg9U-0002VO-O0 for qemu-devel@nongnu.org; Thu, 15 Jan 2015 03:51:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YBg9P-0006aF-Mz for qemu-devel@nongnu.org; Thu, 15 Jan 2015 03:51:40 -0500 Received: from [59.151.112.132] (port=44232 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBg9P-0006a6-BJ for qemu-devel@nongnu.org; Thu, 15 Jan 2015 03:51:35 -0500 Message-ID: <54B77E14.7060104@cn.fujitsu.com> Date: Thu, 15 Jan 2015 16:45:08 +0800 From: Chen Fan MIME-Version: 1.0 References: <1e75bc42628775555cabe140c8438af0093d4ead.1421028274.git.chen.fan.fnst@cn.fujitsu.com> <54B3C8C8.20502@redhat.com> In-Reply-To: <54B3C8C8.20502@redhat.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH 3/4] vfio-pci: add aer capability support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org Cc: Alex Williamson On 01/12/2015 09:14 PM, Paolo Bonzini wrote: > > On 12/01/2015 04:04, Chen Fan wrote: >> +static int vfio_add_ext_capabilities(VFIOPCIDevice *vdev) >> +{ >> + PCIDevice *pdev = &vdev->pdev; >> + PCIExpressDevice *exp; >> + uint32_t header; >> + uint16_t next = PCI_CONFIG_SPACE_SIZE; >> + >> + if (pci_config_size(pdev) <= PCI_CONFIG_SPACE_SIZE) { >> + return 0; >> + } >> + >> + header = pci_get_long(pdev->config + next); >> + while (header) { >> + switch (PCI_EXT_CAP_ID(header)) { >> + case PCI_EXT_CAP_ID_ERR: >> + exp = &pdev->exp; >> + exp->aer_cap = next; >> + >> + /* enable the error report */ >> + vfio_add_emulated_long(vdev, exp->exp_cap + PCI_EXP_DEVCTL, >> + PCI_EXP_DEVCTL_CERE | PCI_EXP_DEVCTL_NFERE | >> + PCI_EXP_DEVCTL_FERE | PCI_EXP_DEVCTL_URRE, ~0); >> + break; >> + }; >> + >> + next = PCI_EXT_CAP_NEXT(header); >> + if (!next) { >> + return 0; >> + } >> + header = pci_get_long(pdev->config + next); >> + } >> + >> + return 0; >> +} >> + > Please add a property to the VFIO device, defaulting to true, and > disable it for older machine types. Thanks for your suggestion. Chen > > Paolo >