[kvm-unit-tests PATCH v2 07/10] lib/pci: make PCIDEVADDR_INVALID truly invalid

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

 



dev addr 0 is valid, just not for the pci-testdev (since the host
bridge is already there). So, while it's not a problem, let's
"fix" it anyway.

Suggested-by: Alexander Gordeev <agordeev@xxxxxxxxxx>
Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx>
---
 lib/pci.h    | 2 +-
 x86/vmexit.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/pci.h b/lib/pci.h
index 9e62d120a52d6..9160cfb5950d0 100644
--- a/lib/pci.h
+++ b/lib/pci.h
@@ -12,7 +12,7 @@
 
 typedef uint16_t pcidevaddr_t;
 enum {
-    PCIDEVADDR_INVALID = 0x0
+    PCIDEVADDR_INVALID = 0xffff,
 };
 pcidevaddr_t pci_find_dev(uint16_t vendor_id, uint16_t device_id);
 unsigned long pci_bar_addr(pcidevaddr_t dev, int bar_num);
diff --git a/x86/vmexit.c b/x86/vmexit.c
index 7b68896fe9494..321ebda35b449 100644
--- a/x86/vmexit.c
+++ b/x86/vmexit.c
@@ -388,7 +388,7 @@ int main(int ac, char **av)
 	printf("PM timer port is %x\n", pm_tmr_blk);
 
 	pcidev = pci_find_dev(PCI_VENDOR_ID_REDHAT, PCI_DEVICE_ID_REDHAT_TEST);
-	if (pcidev) {
+	if (pcidev != PCIDEVADDR_INVALID) {
 		for (i = 0; i < PCI_TESTDEV_NUM_BARS; i++) {
 			if (!pci_bar_is_valid(pcidev, i)) {
 				continue;
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux