[PULL kvm-unit-tests 05/10] arm64: micro-bench: ioremap userspace_emulated_addr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We should explicitly ioremap the userspace emulated address used
in the benchmark.

Reported-by: Alexandru Elisei <alexandru.elisei@xxxxxxx>
Reviewed-by: Alexandru Elisei <alexandru.elisei@xxxxxxx>
Tested-by: Alexandru Elisei <alexandru.elisei@xxxxxxx>
Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx>
---
 arm/micro-bench.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/arm/micro-bench.c b/arm/micro-bench.c
index 95c418c10eb4..8e1d4abdf8a8 100644
--- a/arm/micro-bench.c
+++ b/arm/micro-bench.c
@@ -273,7 +273,9 @@ static void hvc_exec(void)
 	asm volatile("mov w0, #0x4b000000; hvc #0" ::: "w0");
 }
 
-static void mmio_read_user_exec(void)
+static void *userspace_emulated_addr;
+
+static bool mmio_read_user_prep(void)
 {
 	/*
 	 * FIXME: Read device-id in virtio mmio here in order to
@@ -281,8 +283,12 @@ static void mmio_read_user_exec(void)
 	 * updated in the future if any relevant changes in QEMU
 	 * test-dev are made.
 	 */
-	void *userspace_emulated_addr = (void*)0x0a000008;
+	userspace_emulated_addr = (void*)ioremap(0x0a000008, sizeof(u32));
+	return true;
+}
 
+static void mmio_read_user_exec(void)
+{
 	readl(userspace_emulated_addr);
 }
 
@@ -309,14 +315,14 @@ struct exit_test {
 };
 
 static struct exit_test tests[] = {
-	{"hvc",			NULL,		hvc_exec,		NULL,		65536,		true},
-	{"mmio_read_user",	NULL,		mmio_read_user_exec,	NULL,		65536,		true},
-	{"mmio_read_vgic",	NULL,		mmio_read_vgic_exec,	NULL,		65536,		true},
-	{"eoi",			NULL,		eoi_exec,		NULL,		65536,		true},
-	{"ipi",			ipi_prep,	ipi_exec,		NULL,		65536,		true},
-	{"ipi_hw",		ipi_hw_prep,	ipi_exec,		NULL,		65536,		true},
-	{"lpi",			lpi_prep,	lpi_exec,		NULL,		65536,		true},
-	{"timer_10ms",		timer_prep,	timer_exec,		timer_post,	256,		true},
+	{"hvc",			NULL,			hvc_exec,		NULL,		65536,		true},
+	{"mmio_read_user",	mmio_read_user_prep,	mmio_read_user_exec,	NULL,		65536,		true},
+	{"mmio_read_vgic",	NULL,			mmio_read_vgic_exec,	NULL,		65536,		true},
+	{"eoi",			NULL,			eoi_exec,		NULL,		65536,		true},
+	{"ipi",			ipi_prep,		ipi_exec,		NULL,		65536,		true},
+	{"ipi_hw",		ipi_hw_prep,		ipi_exec,		NULL,		65536,		true},
+	{"lpi",			lpi_prep,		lpi_exec,		NULL,		65536,		true},
+	{"timer_10ms",		timer_prep,		timer_exec,		timer_post,	256,		true},
 };
 
 struct ns_time {
-- 
2.30.2




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux