KVM Archive on lore.kernel.org
 help / color / Atom feed
* [kvm-unit-tests PATCH] x86: Attempt to parse ACPI tables only when needed
@ 2019-08-22 23:48 Sean Christopherson
  0 siblings, 0 replies; only message in thread
From: Sean Christopherson @ 2019-08-22 23:48 UTC (permalink / raw)
  To: Paolo Bonzini, Radim Krčmář; +Cc: kvm

Parsing the ACPI tables to find the PM timer port hits a #PF on 32-bit
unit tests.  Regardless of what is causing the #PF, move the parsing to
the pmtimer test to unblock the other VM-Exit tests.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
 x86/vmexit.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/x86/vmexit.c b/x86/vmexit.c
index fa72be7..66d3458 100644
--- a/x86/vmexit.c
+++ b/x86/vmexit.c
@@ -196,6 +196,13 @@ static void ipi_halt(void)
 int pm_tmr_blk;
 static void inl_pmtimer(void)
 {
+    if (!pm_tmr_blk) {
+	struct fadt_descriptor_rev1 *fadt;
+
+	fadt = find_acpi_table_addr(FACP_SIGNATURE);
+	pm_tmr_blk = fadt->pm_tmr_blk;
+	printf("PM timer port is %x\n", pm_tmr_blk);
+    }
     inl(pm_tmr_blk);
 }
 
@@ -541,7 +548,6 @@ static bool test_wanted(struct test *test, char *wanted[], int nwanted)
 
 int main(int ac, char **av)
 {
-	struct fadt_descriptor_rev1 *fadt;
 	int i;
 	unsigned long membar = 0;
 	struct pci_dev pcidev;
@@ -555,10 +561,6 @@ int main(int ac, char **av)
 	irq_enable();
 	on_cpus(enable_nx, NULL);
 
-	fadt = find_acpi_table_addr(FACP_SIGNATURE);
-	pm_tmr_blk = fadt->pm_tmr_blk;
-	printf("PM timer port is %x\n", pm_tmr_blk);
-
 	ret = pci_find_dev(PCI_VENDOR_ID_REDHAT, PCI_DEVICE_ID_REDHAT_TEST);
 	if (ret != PCIDEVADDR_INVALID) {
 		pci_dev_init(&pcidev, ret);
-- 
2.22.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-22 23:48 [kvm-unit-tests PATCH] x86: Attempt to parse ACPI tables only when needed Sean Christopherson

KVM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/kvm/0 kvm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 kvm kvm/ https://lore.kernel.org/kvm \
		kvm@vger.kernel.org kvm@archiver.kernel.org
	public-inbox-index kvm


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.kvm


AGPL code for this site: git clone https://public-inbox.org/ public-inbox