qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: mttcg@listserver.greensocs.com, mark.burton@greensocs.com,
	fred.konrad@greensocs.com, a.rigo@virtualopensystems.com
Cc: peter.maydell@linaro.org, drjones@redhat.com,
	a.spyridakis@virtualopensystems.com, claudio.fontana@huawei.com,
	qemu-devel@nongnu.org, will.deacon@arm.com,
	crosthwaitepeter@gmail.com, pbonzini@redhat.com,
	"Alex Bennée" <alex.bennee@linaro.org>,
	aurelien@aurel32.net, rth@twiddle.net
Subject: [Qemu-devel] [RFC 04/11] arm/arm64: Add IPI test
Date: Fri, 26 Feb 2016 13:15:26 +0000	[thread overview]
Message-ID: <1456492533-17171-5-git-send-email-alex.bennee@linaro.org> (raw)
In-Reply-To: <1456492533-17171-1-git-send-email-alex.bennee@linaro.org>

From: Andrew Jones <drjones@redhat.com>

Signed-off-by: Andrew Jones <drjones@redhat.com>
[ajb: slight tweak to .mak file]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 arm/ipi-test.c               | 58 ++++++++++++++++++++++++++++++++++++++++++++
 config/config-arm-common.mak |  2 ++
 2 files changed, 60 insertions(+)
 create mode 100644 arm/ipi-test.c

diff --git a/arm/ipi-test.c b/arm/ipi-test.c
new file mode 100644
index 0000000..705295f
--- /dev/null
+++ b/arm/ipi-test.c
@@ -0,0 +1,58 @@
+/*
+ * Test sending an IPI and handling IRQ exceptions.
+ *
+ * Copyright (C) 2015, Red Hat Inc, Andrew Jones <drjones@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.
+ */
+#include <libcflat.h>
+#include <asm/setup.h>
+#include <asm/processor.h>
+#include <asm/gic.h>
+#include <asm/smp.h>
+#include <asm/barrier.h>
+
+static volatile bool ready, acked, done;
+
+static void irq_handler(struct pt_regs *regs __unused)
+{
+	gic_irq_ack();
+	acked = true;
+}
+
+static void ipi_test(void)
+{
+	gic_enable();
+#ifdef __arm__
+	install_exception_handler(EXCPTN_IRQ, irq_handler);
+#else
+	install_irq_handler(EL1H_IRQ, irq_handler);
+#endif
+	local_irq_enable();
+	ready = true;
+	wfi();
+	report("IPI", acked);
+	done = true;
+	halt();
+}
+
+int main(void)
+{
+	if (nr_cpus < 2) {
+		printf("ipi-test requires '-smp 2'\n");
+		abort();
+	}
+
+	gic_enable();
+	smp_boot_secondary(1, ipi_test);
+
+	while (!ready)
+		cpu_relax();
+
+	gic_send_sgi(1, 1);
+
+	while (!done)
+		cpu_relax();
+
+	return report_summary();
+}
diff --git a/config/config-arm-common.mak b/config/config-arm-common.mak
index e037507..d90eccc 100644
--- a/config/config-arm-common.mak
+++ b/config/config-arm-common.mak
@@ -11,6 +11,7 @@ endif
 
 tests-common = $(TEST_DIR)/selftest.flat
 tests-common += $(TEST_DIR)/spinlock-test.flat
+tests-common += $(TEST_DIR)/ipi-test.flat
 
 all: test_cases
 
@@ -69,3 +70,4 @@ test_cases: $(generated_files) $(tests-common) $(tests)
 
 $(TEST_DIR)/selftest.elf: $(cstart.o) $(TEST_DIR)/selftest.o
 $(TEST_DIR)/spinlock-test.elf: $(cstart.o) $(TEST_DIR)/spinlock-test.o
+$(TEST_DIR)/ipi-test.elf: $(cstart.o) $(TEST_DIR)/ipi-test.o
-- 
2.7.1

  parent reply	other threads:[~2016-02-26 13:15 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-26 13:15 [Qemu-devel] [RFC 00/11] Current MTTCG kvm-unit-test patches Alex Bennée
2016-02-26 13:15 ` [Qemu-devel] [RFC 01/11] config/config-arm-common: build-up tests-common target Alex Bennée
2016-02-26 14:04   ` Andrew Jones
2016-02-26 14:16     ` Alex Bennée
2016-02-26 13:15 ` [Qemu-devel] [RFC 02/11] arm/arm64: irq enable/disable Alex Bennée
2016-02-26 13:15 ` [Qemu-devel] [RFC 03/11] arm/arm64: Add initial gic support Alex Bennée
2016-02-26 13:15 ` Alex Bennée [this message]
2016-02-26 13:15 ` [Qemu-devel] [RFC 05/11] lib: add isaac prng library from CCAN Alex Bennée
2016-02-26 13:15 ` [Qemu-devel] [RFC 06/11] arm/run: set indentation defaults for emacs Alex Bennée
2016-02-26 13:15 ` [Qemu-devel] [RFC 07/11] arm/run: allow aarch64 to start arm binaries Alex Bennée
2016-02-26 14:02   ` Andrew Jones
2016-02-26 14:19     ` Alex Bennée
2016-02-26 13:15 ` [Qemu-devel] [RFC 08/11] arm/tlbflush-test: Add TLB torture test Alex Bennée
2016-02-26 13:15 ` [Qemu-devel] [RFC 09/11] arm/locking-tests: add comprehensive locking test Alex Bennée
2016-02-26 13:15 ` [Qemu-devel] [RFC 10/11] arm/barrier-litmus-tests: add some litmus tests Alex Bennée
2016-02-26 13:15 ` [Qemu-devel] [RFC 11/11] arm/tcg-test: some basic TCG exercising tests Alex Bennée
2016-02-26 14:12 ` [Qemu-devel] [RFC 00/11] Current MTTCG kvm-unit-test patches Andrew Jones
2016-02-26 14:54   ` Alex Bennée
2016-02-26 15:22     ` Andrew Jones
2016-02-26 16:03       ` Alex Bennée
2016-04-27 15:09   ` Alex Bennée
2016-04-27 15:26     ` Andrew Jones
2016-04-28 18:44       ` 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=1456492533-17171-5-git-send-email-alex.bennee@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=a.rigo@virtualopensystems.com \
    --cc=a.spyridakis@virtualopensystems.com \
    --cc=aurelien@aurel32.net \
    --cc=claudio.fontana@huawei.com \
    --cc=crosthwaitepeter@gmail.com \
    --cc=drjones@redhat.com \
    --cc=fred.konrad@greensocs.com \
    --cc=mark.burton@greensocs.com \
    --cc=mttcg@listserver.greensocs.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=will.deacon@arm.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;
as well as URLs for NNTP newsgroup(s).