From: Ricardo Koller <ricarkol@google.com>
To: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu
Cc: Paolo Bonzini <pbonzini@redhat.com>
Subject: [kvm-unit-tests PATCH] arm64: Add mmio_addr arg to arm/micro-bench
Date: Thu, 7 Oct 2021 11:32:30 -0700 [thread overview]
Message-ID: <20211007183230.2637929-1-ricarkol@google.com> (raw)
Add a command line arg to arm/micro-bench to set the mmio_addr to other
values besides the default QEMU one. Default to the QEMU value if no arg
is passed. Also, the <NUM> in mmio_addr=<NUM> can't be a hex.
Signed-off-by: Ricardo Koller <ricarkol@google.com>
---
arm/micro-bench.c | 33 +++++++++++++++++++++++++++------
1 file changed, 27 insertions(+), 6 deletions(-)
diff --git a/arm/micro-bench.c b/arm/micro-bench.c
index 8e1d4ab..2c08813 100644
--- a/arm/micro-bench.c
+++ b/arm/micro-bench.c
@@ -19,16 +19,19 @@
* This work is licensed under the terms of the GNU LGPL, version 2.
*/
#include <libcflat.h>
+#include <util.h>
#include <asm/gic.h>
#include <asm/gic-v3-its.h>
#include <asm/timer.h>
-#define NS_5_SECONDS (5 * 1000 * 1000 * 1000UL)
+#define NS_5_SECONDS (5 * 1000 * 1000 * 1000UL)
+#define QEMU_MMIO_ADDR 0x0a000008
static u32 cntfrq;
static volatile bool irq_ready, irq_received;
static int nr_ipi_received;
+static unsigned long mmio_addr = QEMU_MMIO_ADDR;
static void *vgic_dist_base;
static void (*write_eoir)(u32 irqstat);
@@ -278,12 +281,10 @@ static void *userspace_emulated_addr;
static bool mmio_read_user_prep(void)
{
/*
- * FIXME: Read device-id in virtio mmio here in order to
- * force an exit to userspace. This address needs to be
- * updated in the future if any relevant changes in QEMU
- * test-dev are made.
+ * Read device-id in virtio mmio here in order to
+ * force an exit to userspace.
*/
- userspace_emulated_addr = (void*)ioremap(0x0a000008, sizeof(u32));
+ userspace_emulated_addr = (void *)ioremap(mmio_addr, sizeof(u32));
return true;
}
@@ -378,10 +379,30 @@ static void loop_test(struct exit_test *test)
test->name, total_ns.ns, total_ns.ns_frac, avg_ns.ns, avg_ns.ns_frac);
}
+static void parse_args(int argc, char **argv)
+{
+ int i, len;
+ long val;
+
+ for (i = 0; i < argc; ++i) {
+ len = parse_keyval(argv[i], &val);
+ if (len == -1)
+ continue;
+
+ argv[i][len] = '\0';
+ if (strcmp(argv[i], "mmio-addr") == 0) {
+ mmio_addr = val;
+ report_info("found mmio_addr=0x%lx", mmio_addr);
+ }
+ }
+}
+
int main(int argc, char **argv)
{
int i;
+ parse_args(argc, argv);
+
if (!test_init())
return 1;
--
2.33.0.882.g93a45727a2-goog
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
next reply other threads:[~2021-10-07 18:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-07 18:32 Ricardo Koller [this message]
2021-10-08 6:28 ` [kvm-unit-tests PATCH] arm64: Add mmio_addr arg to arm/micro-bench Andrew Jones
2021-10-08 18:50 ` Ricardo Koller
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=20211007183230.2637929-1-ricarkol@google.com \
--to=ricarkol@google.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=pbonzini@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