From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Jones Subject: [kvm-unit-tests PATCH 08/11] lib/pci: make PCIDEVADDR_INVALID truly invalid Date: Fri, 15 Jan 2016 17:10:13 +0100 Message-ID: <1452874216-3087-9-git-send-email-drjones@redhat.com> References: <1452874216-3087-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]:41058 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752775AbcAOQKi (ORCPT ); Fri, 15 Jan 2016 11:10:38 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id C9E0CA8D for ; Fri, 15 Jan 2016 16:10:38 +0000 (UTC) In-Reply-To: <1452874216-3087-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