From patchwork Tue Feb 5 14:29:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 10797491 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0149B13BF for ; Tue, 5 Feb 2019 14:29:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA33B2ACF5 for ; Tue, 5 Feb 2019 14:29:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CDF252BA54; Tue, 5 Feb 2019 14:29:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 750772BA86 for ; Tue, 5 Feb 2019 14:29:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727859AbfBEO3G (ORCPT ); Tue, 5 Feb 2019 09:29:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34652 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726558AbfBEO3G (ORCPT ); Tue, 5 Feb 2019 09:29:06 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 79835C05090A; Tue, 5 Feb 2019 14:29:06 +0000 (UTC) Received: from kamzik.brq.redhat.com (unknown [10.43.2.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id D592D17ADC; Tue, 5 Feb 2019 14:29:02 +0000 (UTC) From: Andrew Jones To: kvm@vger.kernel.org Cc: alexandru.elisei@arm.com, kvmarm@lists.cs.columbia.edu, andre.przywara@arm.com, vladimir.murzin@arm.com Subject: [PATCH 6/5] arm/arm64: selftest.vectors-user: clean up PSCI exit Date: Tue, 5 Feb 2019 15:29:01 +0100 Message-Id: <20190205142901.13019-1-drjones@redhat.com> In-Reply-To: <20190204134412.47877-1-alexandru.elisei@arm.com> References: <20190204134412.47877-1-alexandru.elisei@arm.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 05 Feb 2019 14:29:06 +0000 (UTC) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Reviewed-by: Alexandru Elisei Tested-by: Alexandru Elisei Signed-off-by: Andrew Jones --- 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 #include +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()); }