From patchwork Thu Aug 20 10:34:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Scull X-Patchwork-Id: 11726033 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C9A241575 for ; Thu, 20 Aug 2020 10:37:31 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A02FA20639 for ; Thu, 20 Aug 2020 10:37:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="HqCwN2Oz"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="ttsVAj7n" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A02FA20639 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version:Message-Id: In-Reply-To:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cR6Uc+pAT9SwPSACKnURP46hTgs2+8SM+GSfVZdbjqI=; b=HqCwN2Ozs6qjOcEeZGrhn5Dlr CmsnHfYV04PqUjqv2jKPMYsNXmqFAakPdfDpd9G8aMFhPQT3dGQugWK/kV3t1mOykz7nSfGAixQAf VHOzaf0B9WvT3kiC0qbbmVII2ugPs5h/liaD3Q87rca0+ZBigP4MM+4qtmOLh0t9bWjdRIo9IE49y PdpgL234yyJzWJKy6Meo4shexaTKL+JZ1rjcEYoToek+zR+AjN1B4776gOcNStRJNyHOV8RXfljs3 cc6rL8j5m9zSyQibUNcn2s3/MPjJjxpPemM4/7obKvqudNLPHNsqF5xQrnlQpvzbLRY4K0bsqb8Oj q2L1NRpvg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8huu-0001zO-A3; Thu, 20 Aug 2020 10:35:32 +0000 Received: from mail-wr1-x44a.google.com ([2a00:1450:4864:20::44a]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8hup-0001xs-Uc for linux-arm-kernel@lists.infradead.org; Thu, 20 Aug 2020 10:35:28 +0000 Received: by mail-wr1-x44a.google.com with SMTP id z12so506639wrl.16 for ; Thu, 20 Aug 2020 03:35:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=FpXGW2sGNgfy+CtJ7CXoWW+rn8TCwxkGXj7yU9QSp6Y=; b=ttsVAj7nmCb3QMAaIIDzT7OmMhd6HcWp0XMv8mtRiDFmTkfFNVsqg2wriz3PPmK3A9 30CU3WzvRy1kqa1skZ3VzgODbEEMYFD0VHflfyQXd6lH1ciejSmnsbBDWaUr8jO/MPTa hpsr4ty3rugoOv8bPC0J3Vcup0+dpi77exLll9lSeuSMqJujONetR+bPvSNTZCxftOmB /kKRe9gunwz6n44vTPC9a1C3c+EMRgMvGt6B4BFFf9ZOcXywUvJce6QTZZbwTIO0JJlG l9QieQ70/jtxMBx/kTYYeONHTZFA02DEu37Cj8oKMpqdwfkP+9Zyfqz0JZn54c8g5Yk4 AJeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=FpXGW2sGNgfy+CtJ7CXoWW+rn8TCwxkGXj7yU9QSp6Y=; b=eWNeVuSJOmGizkJbJP65La5385pMb54mpaWZTmPMTlBpbg+XLKMhDoIxD2gO3DK6qq OvRCVyWPiikLYTSBjNtByoIOAQGdUE2vKyI6r2Ett3clQxDzcd3iOvObvK2n4qDp170S +iiM7WLVS3sA7w8VuKWLHfvJ0MmCvM4keaVpRuULv974zMF5mRKgqYowxdXre6GL0V1A 4sD2qquawEZe2Sk5dgVI/XVk/2e+I/qXN3naW/WiwNHKM2u8UyNWdz99ES+9JYcUIctB iO4VA0XZw66KbEW+YWPNzQmwDNyOG5i/XcavpgLA900zPhWplfYMUWGK5EgQ4T0T1wY1 79tQ== X-Gm-Message-State: AOAM530extyOuEIp6GWJ+giLRgAwgYJOTdQX3Tigoj+Rlg/iY56C/j/t h/H09QcZ7SakqmLkYEuasY+/FKVAv+U= X-Google-Smtp-Source: ABdhPJzUJO0vAS12FqRwiVrrpYI/5KMeVxMpn8uu2ncYyxlpc3uZjKgzLGSHeTcMw6oIQgCymDQCbAN9kC8= X-Received: from ascull.lon.corp.google.com ([2a00:79e0:d:109:4a0f:cfff:fe4a:6363]) (user=ascull job=sendgmr) by 2002:a1c:96d7:: with SMTP id y206mr2834837wmd.9.1597919724606; Thu, 20 Aug 2020 03:35:24 -0700 (PDT) Date: Thu, 20 Aug 2020 11:34:28 +0100 In-Reply-To: <20200820103446.959000-1-ascull@google.com> Message-Id: <20200820103446.959000-3-ascull@google.com> Mime-Version: 1.0 References: <20200820103446.959000-1-ascull@google.com> X-Mailer: git-send-email 2.28.0.220.ged08abb693-goog Subject: [PATCH v2 02/20] KVM: arm64: Remove hyp_panic arguments From: Andrew Scull To: kvmarm@lists.cs.columbia.edu X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200820_063528_046955_E902A83C X-CRM114-Status: GOOD ( 12.19 ) X-Spam-Score: -7.7 (-------) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-7.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:44a listed in] [list.dnswl.org] -7.5 USER_IN_DEF_DKIM_WL From: address is in the default DKIM white-list -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.0 DKIMWL_WL_MED DKIMwl.org - Medium sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, kernel-team@android.com, suzuki.poulose@arm.com, maz@kernel.org, Sudeep Holla , james.morse@arm.com, Andrew Scull , catalin.marinas@arm.com, will@kernel.org, julien.thierry.kdev@gmail.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org hyp_panic is able to find all the context it needs from within itself so remove the argument. The __hyp_panic wrapper becomes redundant so is also removed. Signed-off-by: Andrew Scull --- arch/arm64/include/asm/kvm_hyp.h | 2 +- arch/arm64/kvm/hyp/hyp-entry.S | 11 +++-------- arch/arm64/kvm/hyp/nvhe/switch.c | 4 +++- arch/arm64/kvm/hyp/vhe/switch.c | 4 +++- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/arch/arm64/include/asm/kvm_hyp.h b/arch/arm64/include/asm/kvm_hyp.h index 46689e7db46c..3de99b323061 100644 --- a/arch/arm64/include/asm/kvm_hyp.h +++ b/arch/arm64/include/asm/kvm_hyp.h @@ -89,7 +89,7 @@ void deactivate_traps_vhe_put(void); u64 __guest_enter(struct kvm_vcpu *vcpu, struct kvm_cpu_context *host_ctxt); -void __noreturn hyp_panic(struct kvm_cpu_context *host_ctxt); +void __noreturn hyp_panic(void); #ifdef __KVM_NVHE_HYPERVISOR__ void __noreturn __hyp_do_panic(unsigned long, ...); #endif diff --git a/arch/arm64/kvm/hyp/hyp-entry.S b/arch/arm64/kvm/hyp/hyp-entry.S index 689fccbc9de7..b0923e9f9291 100644 --- a/arch/arm64/kvm/hyp/hyp-entry.S +++ b/arch/arm64/kvm/hyp/hyp-entry.S @@ -148,7 +148,7 @@ el2_sync: /* if this was something else, then panic! */ tst x0, #PSR_IL_BIT - b.eq __hyp_panic + b.eq hyp_panic /* Let's attempt a recovery from the illegal exception return */ get_vcpu_ptr x1, x0 @@ -176,7 +176,7 @@ el2_error: cmp x0, x1 adr x1, abort_guest_exit_end ccmp x0, x1, #4, ne - b.ne __hyp_panic + b.ne hyp_panic mov x0, #(1 << ARM_EXIT_WITH_SERROR_BIT) eret sb @@ -193,12 +193,7 @@ SYM_FUNC_START(__hyp_do_panic) SYM_FUNC_END(__hyp_do_panic) #endif -SYM_CODE_START(__hyp_panic) - get_host_ctxt x0, x1 - b hyp_panic -SYM_CODE_END(__hyp_panic) - -.macro invalid_vector label, target = __hyp_panic +.macro invalid_vector label, target = hyp_panic .align 2 SYM_CODE_START(\label) b \target diff --git a/arch/arm64/kvm/hyp/nvhe/switch.c b/arch/arm64/kvm/hyp/nvhe/switch.c index 2940d220096d..f969a6dc4741 100644 --- a/arch/arm64/kvm/hyp/nvhe/switch.c +++ b/arch/arm64/kvm/hyp/nvhe/switch.c @@ -242,11 +242,13 @@ int __kvm_vcpu_run(struct kvm_vcpu *vcpu) return exit_code; } -void __noreturn hyp_panic(struct kvm_cpu_context *host_ctxt) +void __noreturn hyp_panic(void) { u64 spsr = read_sysreg_el2(SYS_SPSR); u64 elr = read_sysreg_el2(SYS_ELR); u64 par = read_sysreg(par_el1); + struct kvm_cpu_context *host_ctxt = + &__hyp_this_cpu_ptr(kvm_host_data)->host_ctxt; struct kvm_vcpu *vcpu = host_ctxt->__hyp_running_vcpu; unsigned long str_va; diff --git a/arch/arm64/kvm/hyp/vhe/switch.c b/arch/arm64/kvm/hyp/vhe/switch.c index 30bb76066cc0..099bfa78011c 100644 --- a/arch/arm64/kvm/hyp/vhe/switch.c +++ b/arch/arm64/kvm/hyp/vhe/switch.c @@ -208,8 +208,10 @@ static void __hyp_call_panic(u64 spsr, u64 elr, u64 par, } NOKPROBE_SYMBOL(__hyp_call_panic); -void __noreturn hyp_panic(struct kvm_cpu_context *host_ctxt) +void __noreturn hyp_panic(void) { + struct kvm_cpu_context *host_ctxt = + &__hyp_this_cpu_ptr(kvm_host_data)->host_ctxt; u64 spsr = read_sysreg_el2(SYS_SPSR); u64 elr = read_sysreg_el2(SYS_ELR); u64 par = read_sysreg(par_el1);