From: Andrew Jones Subject: [kvm-unit-tests PATCH v3 8/8] lib/pci: make PCIDEVADDR_INVALID truly invalid Date: Mon, 18 Jan 2016 19:01:04 +0100 Message-ID: <1453140064-9040-9-git-send-email-drjones@redhat.com> References: <1453140064-9040-1-git-send-email-drjones@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE 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]:33904 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756111AbcARSBZ (ORCPT ); Mon, 18 Jan 2016 13:01:25 -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 75809C077547 for ; Mon, 18 Jan 2016 18:01:25 +0000 (UTC) In-Reply-To: <1453140064-9040-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 Reviewed-by: Radim Kr=C4=8Dm=C3=A1=C5=99 --- 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 @@ =20 typedef uint16_t pcidevaddr_t; enum { - PCIDEVADDR_INVALID =3D 0x0 + PCIDEVADDR_INVALID =3D 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 375524f6f7d96..9e049752f6c63 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); =20 pcidev =3D pci_find_dev(PCI_VENDOR_ID_REDHAT, PCI_DEVICE_ID_REDHAT_TE= ST); - if (pcidev) { + if (pcidev !=3D PCIDEVADDR_INVALID) { for (i =3D 0; i < PCI_TESTDEV_NUM_BARS; i++) { if (!pci_bar_is_valid(pcidev, i)) { continue; --=20 2.4.3