All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: kvm@vger.kernel.org
Cc: andre.przywara@arm.com, kvmarm@lists.cs.columbia.edu
Subject: [PATCH 6/5] arm/arm64: selftest.vectors-user: clean up PSCI exit
Date: Tue,  5 Feb 2019 15:29:01 +0100	[thread overview]
Message-ID: <20190205142901.13019-1-drjones@redhat.com> (raw)
In-Reply-To: <20190204134412.47877-1-alexandru.elisei@arm.com>

Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com>
Tested-by: Alexandru Elisei <alexandru.elisei@arm.com>
Signed-off-by: Andrew Jones <drjones@redhat.com>
---

The original posting didn't consider arm32. I kept Alexandru's tags
for this new version though, as the tweaks should be safe. Also
added __builtin_unreachable as suggested by Alexandru.

 arm/selftest.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/arm/selftest.c b/arm/selftest.c
index ea5101ef7217..28a17f7a7531 100644
--- a/arm/selftest.c
+++ b/arm/selftest.c
@@ -17,6 +17,13 @@
 #include <asm/smp.h>
 #include <asm/barrier.h>
 
+static void __user_psci_system_off(void)
+{
+	psci_system_off();
+	halt();
+	__builtin_unreachable();
+}
+
 static void check_setup(int argc, char **argv)
 {
 	int nr_tests = 0, len, i;
@@ -154,6 +161,11 @@ static bool check_svc(void)
 
 	return svc_works;
 }
+
+static void user_psci_system_off(struct pt_regs *regs)
+{
+	__user_psci_system_off();
+}
 #elif defined(__aarch64__)
 
 /*
@@ -270,12 +282,25 @@ static bool check_svc(void)
 
 	return svc_works;
 }
+
+static void user_psci_system_off(struct pt_regs *regs, unsigned int esr)
+{
+	__user_psci_system_off();
+}
 #endif
 
 static void check_vectors(void *arg __unused)
 {
 	report("und", check_und());
 	report("svc", check_svc());
+	if (is_user()) {
+#ifdef __arm__
+		install_exception_handler(EXCPTN_UND, user_psci_system_off);
+#else
+		install_exception_handler(EL0_SYNC_64, ESR_EL1_EC_UNKNOWN,
+					  user_psci_system_off);
+#endif
+	}
 	exit(report_summary());
 }
 
-- 
2.18.1

      parent reply	other threads:[~2019-02-05 14:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-04 13:44 [kvm-unit-tests PATCH v3 0/5] arm/arm64: Add support for running under kvmtool Alexandru Elisei
2019-02-04 13:44 ` [kvm-unit-tests PATCH v3 1/5] lib: arm: Use UART address from generated config.h Alexandru Elisei
2019-02-04 14:00   ` Andrew Jones
2019-02-04 14:17     ` Alexandru Elisei
2019-02-04 14:40       ` Andrew Jones
2019-02-20 13:14         ` Alexandru Elisei
2019-02-26  9:29           ` Vladimir Murzin
2019-02-04 13:44 ` [kvm-unit-tests PATCH v3 2/5] configure: arm/arm64: Add --vmm option with no effect Alexandru Elisei
2019-02-04 13:44 ` [kvm-unit-tests PATCH v3 3/5] lib: arm: Use ns16550a UART when --vmm=kvmtool Alexandru Elisei
2019-02-04 13:44 ` [kvm-unit-tests PATCH v3 4/5] lib: arm: Implement PSCI SYSTEM_OFF in psci_system_off() Alexandru Elisei
2019-02-04 13:44 ` [kvm-unit-tests PATCH v3 5/5] lib: arm: Fallback to psci_system_off() in exit() Alexandru Elisei
2019-02-04 14:39 ` [kvm-unit-tests PATCH v3 0/5] arm/arm64: Add support for running under kvmtool Andrew Jones
2019-02-05 12:05   ` Alexandru Elisei
2019-02-05 12:38     ` Andrew Jones
2019-02-05 13:26       ` Alexandru Elisei
2019-02-05 14:29 ` Andrew Jones [this message]

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=20190205142901.13019-1-drjones@redhat.com \
    --to=drjones@redhat.com \
    --cc=andre.przywara@arm.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    /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.