qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC PATCH 3/4] vfio-pci: add aer capability support


From: Chen Fan
Subject: Re: [Qemu-devel] [RFC PATCH 3/4] vfio-pci: add aer capability support
Date: Thu, 15 Jan 2015 16:45:08 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0


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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]