From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Jones Subject: [kvm-unit-tests PATCH v2 07/10] lib/pci: make PCIDEVADDR_INVALID truly invalid Date: Fri, 15 Jan 2016 17:51:32 +0100 Message-ID: <1452876695-9240-8-git-send-email-drjones@redhat.com> References: <1452876695-9240-1-git-send-email-drjones@redhat.com> Cc: pbonzini@redhat.com, mst@redhat.com, agordeev@redhat.com, rkrcmar@redhat.com To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:39026 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754813AbcAOQvy (ORCPT ); Fri, 15 Jan 2016 11:51:54 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 8E6E88E221 for ; Fri, 15 Jan 2016 16:51:54 +0000 (UTC) In-Reply-To: <1452876695-9240-1-git-send-email-drjones@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: 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 Signed-off-by: Andrew Jones --- 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