[PATCH 6/5] arm/arm64: selftest.vectors-user: clean up PSCI exit

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

 



Reviewed-by: Alexandru Elisei <alexandru.elisei at arm.com>
Tested-by: Alexandru Elisei <alexandru.elisei at arm.com>
Signed-off-by: Andrew Jones <drjones at 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



[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux