All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <sean.j.christopherson@intel.com>
To: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>
Cc: kvm@vger.kernel.org
Subject: [kvm-unit-tests PATCH] x86: Attempt to parse ACPI tables only when needed
Date: Thu, 22 Aug 2019 16:48:37 -0700	[thread overview]
Message-ID: <20190822234837.3500-1-sean.j.christopherson@intel.com> (raw)

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


                 reply	other threads:[~2019-08-22 23:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20190822234837.3500-1-sean.j.christopherson@intel.com \
    --to=sean.j.christopherson@intel.com \
    --cc=kvm@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.