From: Ian Jackson Date: Fri, 6 Feb 2009 16:16:06 +0000 (+0000) Subject: hw/pass-through.c: workaround for old libpci X-Git-Tag: xen-3.4.0-rc2~67^2~17 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=b80fc65b715099ee28465f6571eb5242588ef246;p=qemu-xen-4.1-testing.git hw/pass-through.c: workaround for old libpci Old versions of libpci (including the ones on the automatic tests which control Xen staging propagation) do not define PCI_LIB_VERSION or the PCI_ERR_{UNCOR_MASK,...} constants. This means that change 8c771eb6294afc5b3754a9e3de51568d4e5986c2 breaks the build. In this changeset I apply what is intended to be a workaround for this problem but it may not be completely correct; this is therefore perhaps an interim fix. The potential problem is that the save/restore of some PCI passthrough error handling registers (across suspend/resume) may not work properly with old versions of libpci. However non-passthrough and non-suspect use cases should now be fine. Signed-off-by: Ian Jackson --- diff --git a/hw/pass-through.c b/hw/pass-through.c index 8dfae3c1b..29714c7ee 100644 --- a/hw/pass-through.c +++ b/hw/pass-through.c @@ -1503,7 +1503,7 @@ exit: static void pt_libpci_fixup(struct pci_dev *dev) { -#if PCI_LIB_VERSION < 0x030100 +#if !defined(PCI_LIB_VERSION) || PCI_LIB_VERSION < 0x030100 int i; FILE *fp; char path[PATH_MAX], buf[256]; @@ -1850,6 +1850,7 @@ static void pt_aer_reg_save(struct pt_dev *ptdev) /* Root Port and Root Complex Event Collector need size expansion */ int aer_size = 0x2c; +#ifdef PCI_ERR_UNCOR_MASK for (i=0; i < aer_size; i+=4) { switch (i) { @@ -1867,6 +1868,7 @@ static void pt_aer_reg_save(struct pt_dev *ptdev) break; } } +#endif } /* restore AER register */ @@ -1879,6 +1881,7 @@ static void pt_aer_reg_restore(struct pt_dev *ptdev) /* Root Port and Root Complex Event Collector need size expansion */ int aer_size = 0x2c; +#ifdef PCI_ERR_UNCOR_MASK for (i=0; i < aer_size; i+=4) { switch (i) { @@ -1899,6 +1902,7 @@ static void pt_aer_reg_restore(struct pt_dev *ptdev) break; } } +#endif } /* reset Interrupt and I/O resource */