Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: kvm@vger.kernel.org
Cc: pbonzini@redhat.com, mst@redhat.com, agordeev@redhat.com,
	rkrcmar@redhat.com
Subject: [kvm-unit-tests PATCH 07/11] x86: share pci-testdev hdr in common lib
Date: Fri, 15 Jan 2016 17:10:12 +0100	[thread overview]
Message-ID: <1452874216-3087-8-git-send-email-drjones@redhat.com> (raw)
In-Reply-To: <1452874216-3087-1-git-send-email-drjones@redhat.com>

Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 lib/pci.h    | 22 +++++++++++++++++++++-
 x86/vmexit.c | 14 ++------------
 2 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/lib/pci.h b/lib/pci.h
index 65fcd9444461c..9e62d120a52d6 100644
--- a/lib/pci.h
+++ b/lib/pci.h
@@ -19,4 +19,24 @@ unsigned long pci_bar_addr(pcidevaddr_t dev, int bar_num);
 bool pci_bar_is_memory(pcidevaddr_t dev, int bar_num);
 bool pci_bar_is_valid(pcidevaddr_t dev, int bar_num);
 
-#endif
+/*
+ * pci-testdev is a driver for the pci-testdev qemu pci device. The
+ * device enables testing mmio and portio exits, and measuring their
+ * speed.
+ */
+#define PCI_VENDOR_ID_REDHAT		0x1b36
+#define PCI_DEVICE_ID_REDHAT_TEST	0x0005
+
+#define PCI_TESTDEV_NUM_BARS		2
+
+struct pci_test_dev_hdr {
+	uint8_t  test;
+	uint8_t  width;
+	uint8_t  pad0[2];
+	uint32_t offset;
+	uint32_t data;
+	uint32_t count;
+	uint8_t  name[];
+};
+
+#endif /* PCI_H */
diff --git a/x86/vmexit.c b/x86/vmexit.c
index 35c6fac747588..7b68896fe9494 100644
--- a/x86/vmexit.c
+++ b/x86/vmexit.c
@@ -134,16 +134,6 @@ static void wr_tsc_adjust_msr(void)
 	wrmsr(MSR_TSC_ADJUST, 0x0);
 }
 
-struct pci_test_dev_hdr {
-    uint8_t test;
-    uint8_t width;
-    uint8_t pad0[2];
-    uint32_t offset;
-    uint32_t data;
-    uint32_t count;
-    uint8_t name[];
-};
-
 static struct pci_test {
 	unsigned iobar;
 	unsigned ioport;
@@ -397,9 +387,9 @@ int main(int ac, char **av)
 	pm_tmr_blk = fadt->pm_tmr_blk;
 	printf("PM timer port is %x\n", pm_tmr_blk);
 
-	pcidev = pci_find_dev(0x1b36, 0x0005);
+	pcidev = pci_find_dev(PCI_VENDOR_ID_REDHAT, PCI_DEVICE_ID_REDHAT_TEST);
 	if (pcidev) {
-		for (i = 0; i < 2; i++) {
+		for (i = 0; i < PCI_TESTDEV_NUM_BARS; i++) {
 			if (!pci_bar_is_valid(pcidev, i)) {
 				continue;
 			}
-- 
2.4.3


  parent reply	other threads:[~2016-01-15 16:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-15 16:10 [kvm-unit-tests PATCH 00/11] share pci-testdev with the framework Andrew Jones
2016-01-15 16:10 ` [kvm-unit-tests PATCH 01/11] asm-generic: add portio accessors to io.h Andrew Jones
2016-01-15 16:10 ` [kvm-unit-tests PATCH 02/11] x86: move io.h to asm Andrew Jones
2016-01-15 16:10 ` [kvm-unit-tests PATCH 03/11] x86: use common portio accessors from io.h Andrew Jones
2016-01-15 16:10 ` [kvm-unit-tests PATCH 04/11] x86: pci.h: remove useless include Andrew Jones
2016-01-15 16:10 ` [kvm-unit-tests PATCH 05/11] x86: mov pci.h to asm Andrew Jones
2016-01-15 16:10 ` [kvm-unit-tests PATCH 06/11] x86: move x86/pci to the common lib Andrew Jones
2016-01-15 16:27   ` Andrew Jones
2016-01-15 16:10 ` Andrew Jones [this message]
2016-01-15 16:10 ` [kvm-unit-tests PATCH 08/11] lib/pci: make PCIDEVADDR_INVALID truly invalid Andrew Jones
2016-01-15 16:10 ` [kvm-unit-tests PATCH 09/11] lib: add linux dir for kernel uapi headers Andrew Jones
2016-01-15 16:10 ` [kvm-unit-tests PATCH 10/11] Revert "arm/arm64: import include/uapi/linux/psci.h" Andrew Jones
2016-01-15 16:10 ` [kvm-unit-tests PATCH 11/11] lib/linux: import pci_regs.h Andrew Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1452874216-3087-8-git-send-email-drjones@redhat.com \
    --to=drjones@redhat.com \
    --cc=agordeev@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox