From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40907) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YAepe-0005L9-8d for qemu-devel@nongnu.org; Mon, 12 Jan 2015 08:14:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YAepZ-0000NR-95 for qemu-devel@nongnu.org; Mon, 12 Jan 2015 08:14:58 -0500 Received: from mail-we0-x232.google.com ([2a00:1450:400c:c03::232]:61410) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YAepZ-0000NK-1j for qemu-devel@nongnu.org; Mon, 12 Jan 2015 08:14:53 -0500 Received: by mail-we0-f178.google.com with SMTP id p10so18946908wes.9 for ; Mon, 12 Jan 2015 05:14:52 -0800 (PST) Sender: Paolo Bonzini Message-ID: <54B3C8C8.20502@redhat.com> Date: Mon, 12 Jan 2015 14:14:48 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1e75bc42628775555cabe140c8438af0093d4ead.1421028274.git.chen.fan.fnst@cn.fujitsu.com> In-Reply-To: <1e75bc42628775555cabe140c8438af0093d4ead.1421028274.git.chen.fan.fnst@cn.fujitsu.com> Content-Type: text/plain; charset=windows-1252 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: Chen Fan , qemu-devel@nongnu.org Cc: Alex Williamson 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. Paolo