From patchwork Fri Sep 24 12:53:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuad Tabba X-Patchwork-Id: 12515343 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B713C433F5 for ; Fri, 24 Sep 2021 13:09:13 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 1D0E760EE7 for ; Fri, 24 Sep 2021 13:09:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1D0E760EE7 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc: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=q18r/+mdm4fGQUK84JDODzxTOzV0vHF5SGMlhlqU51s=; b=RTL3c1VY5d6790PsnOKF0j3QnY 8PEfWfdndpNCd9PRR3G2AwtS7oYIwxfeEDwp2FxTipQWq/KbJJJUOh6JnHLgtUBfY0ya0+o+UC/Or NpiEl4rG+3hDTXhhwP2GZugj/Wvg3hmfn4ZRuRdXP+whr4SLiLE8z/nQPmHR6A7p1fAMIlq3jTwTZ K8f5n52VgOxUy0YD6nAqIYaG/wBxE61G2IIaAPohoTaOFa3jTh0Ll+JO+3ltzUCZ2vUaAngUQbatI 5XZLSo9Yl7hX5mMzSskZGv2HYUcit3+4nB4YxW5lEVVx1YFclWGAqEnv5nBpf3hikt3zf7958lHuN /nqOwMAg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mTktl-00ERLw-Ta; Fri, 24 Sep 2021 13:05:56 +0000 Received: from mail-qv1-xf49.google.com ([2607:f8b0:4864:20::f49]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mTkiv-00EMCp-Am for linux-arm-kernel@lists.infradead.org; Fri, 24 Sep 2021 12:54:43 +0000 Received: by mail-qv1-xf49.google.com with SMTP id h16-20020a05621402f000b0037cc26a5659so31505452qvu.1 for ; Fri, 24 Sep 2021 05:54:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=i7uodwfDnDtJuiTS9rXdXYViFWYsjMsbxF8IoeW8/W4=; b=qF3Vw4AceYdu1L0PZ66LcU5WQ4Q0vt8paDyr76neaIiU7PKYTbrZLZonVtIrIyRczb DU5SbrytlGhkBB1E+t5EqBtBbVrDhV4CyzU/EB8ANPxuMebR0qF/QjT8hLecRLcdlZgw A3lfSu8T99yQYr4bozntQ9WdVOsOPmEACfCRd0tfsFq6yXyqa5QjOxnbUZyAZx0Kx8ue PsVAFTS6kdE4EA4R/FbZWcnFQc+koZXhZ9EpQ3BLPMpc8IFYdDeyrGBI8gHWC3W4GLB6 P23Dlf8ES+p3OPOy3TiDL1x4KbFHLYAOvn+XGfAEiu3h6LwChGcFLWCRFl12kwRSLS+3 ctBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=i7uodwfDnDtJuiTS9rXdXYViFWYsjMsbxF8IoeW8/W4=; b=3z9YUqnrQ0ZuKHSe5S3y360wQrR1xtymYj8c0A9l4va8SlcU78HCPBNOIPCLIE6Qsz y1e2Hou6i0yz/ous24SmSUjKjbK9puyUldeIo+axWz9CKC3lUCpnVNYUF8KInmj6ek0h C7ildHHDP+oSOcUKJApCWwhmv0BzbJSM5EiWDpWtjg/nvTvFnucaglWN+QBVzjbGeZKV l7jnBfNPHVhy1QrXjmTw6RT0nKVnmNzkjp6pDQXfb4imXJWoOFUvdJWO8Av1xylWJBGr +002v9be49EySPyy2Xa6hzEEeAEdHS+Z6FCT4edvNr8fGG3EZR0rU5s/7hQL0sNQYKgb Q9hw== X-Gm-Message-State: AOAM5307zTsqQQB2by0MdU/ouXzoLyKoCYp4d3k9KJg9rv6ScNVQvhBW sLprty0+zL51duzXzQGcljVwNC4Nlw== X-Google-Smtp-Source: ABdhPJyK06uYrGrDSvLnw7I0yxv76y3TWXx+xyK98z+cTJ0e/eyHwuj1vePAtlEsCveTt5zBbE9Rk8ddCA== X-Received: from tabba.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:482]) (user=tabba job=sendgmr) by 2002:ad4:47a3:: with SMTP id a3mr9927375qvz.31.1632488079831; Fri, 24 Sep 2021 05:54:39 -0700 (PDT) Date: Fri, 24 Sep 2021 13:53:47 +0100 In-Reply-To: <20210924125359.2587041-1-tabba@google.com> Message-Id: <20210924125359.2587041-19-tabba@google.com> Mime-Version: 1.0 References: <20210924125359.2587041-1-tabba@google.com> X-Mailer: git-send-email 2.33.0.685.g46640cef36-goog Subject: [RFC PATCH v1 18/30] KVM: arm64: reduce scope of __guest_exit to only depend on kvm_cpu_context From: Fuad Tabba To: kvmarm@lists.cs.columbia.edu Cc: maz@kernel.org, will@kernel.org, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, mark.rutland@arm.com, christoffer.dall@arm.com, drjones@redhat.com, qperret@google.com, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel-team@android.com, tabba@google.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210924_055441_441077_4DF111A2 X-CRM114-Status: GOOD ( 11.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org __guest_exit only needs kvm_cpu_context (via the offset VCPU_CONTEXT). Only pass that to it, and fix it to ensure that it only refers to kvm_cpu_context rather than vcpu. Signed-off-by: Fuad Tabba --- arch/arm64/kvm/hyp/entry.S | 7 ++----- arch/arm64/kvm/hyp/hyp-entry.S | 8 ++++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/arch/arm64/kvm/hyp/entry.S b/arch/arm64/kvm/hyp/entry.S index e831d3dfd50d..996bdc9555da 100644 --- a/arch/arm64/kvm/hyp/entry.S +++ b/arch/arm64/kvm/hyp/entry.S @@ -99,15 +99,12 @@ SYM_INNER_LABEL(__guest_exit_panic, SYM_L_GLOBAL) adr_l x1, hyp_panic str x1, [x0, #CPU_XREG_OFFSET(30)] - get_vcpu_ptr x1, x0 + get_vcpu_ctxt_ptr x1, x0 SYM_INNER_LABEL(__guest_exit, SYM_L_GLOBAL) // x0: return code - // x1: vcpu + // x1: ctxt // x2-x29,lr: vcpu regs - // vcpu x0-x1 on the stack - - add x1, x1, #VCPU_CONTEXT ALTERNATIVE(nop, SET_PSTATE_PAN(1), ARM64_HAS_PAN, CONFIG_ARM64_PAN) diff --git a/arch/arm64/kvm/hyp/hyp-entry.S b/arch/arm64/kvm/hyp/hyp-entry.S index 5f49df4ffdd8..704b3388c86a 100644 --- a/arch/arm64/kvm/hyp/hyp-entry.S +++ b/arch/arm64/kvm/hyp/hyp-entry.S @@ -71,17 +71,17 @@ wa_epilogue: sb el1_trap: - get_vcpu_ptr x1, x0 + get_vcpu_ctxt_ptr x1, x0 mov x0, #ARM_EXCEPTION_TRAP b __guest_exit el1_irq: - get_vcpu_ptr x1, x0 + get_vcpu_ctxt_ptr x1, x0 mov x0, #ARM_EXCEPTION_IRQ b __guest_exit el1_error: - get_vcpu_ptr x1, x0 + get_vcpu_ctxt_ptr x1, x0 mov x0, #ARM_EXCEPTION_EL1_SERROR b __guest_exit @@ -100,7 +100,7 @@ el2_sync: 1: /* Let's attempt a recovery from the illegal exception return */ - get_vcpu_ptr x1, x0 + get_vcpu_ctxt_ptr x1, x0 mov x0, #ARM_EXCEPTION_IL b __guest_exit