Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp500300imn; Tue, 26 Jul 2022 01:23:38 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t3+WIDgovdj07NTQrKjp68SvJYiVMYPoTO4M35eHX+EvNJmqrVO2njao5tZLalPnPnTcwW X-Received: by 2002:aa7:c948:0:b0:43c:78d2:8dd7 with SMTP id h8-20020aa7c948000000b0043c78d28dd7mr1126497edt.370.1658823817883; Tue, 26 Jul 2022 01:23:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658823817; cv=none; d=google.com; s=arc-20160816; b=FxdeVMHMlVM+XgsLxINoIW9zWq5lMq0FdGsZVVw3687ohN/JL8Ln2TBSN1/Bk4BYME w2Pf5EBty5KldlJQoGFnVnEYfGwdzdK0TvnzPmdqh/6G1LjYZyi57a6h5hnDGwJ7Xhks 1zN6WpBU6fm32rDt9044qfO3AKafTUOXHlKCfDiNPCGCHsAt81EGetAp3nNu3164MX8n q52gjP/tKGiC9tc/289bDuhaCVHDBro1UBTcNxYXzTVir9/3x+v9JKDRpJo5KUc63E1c XBYx736+MkgoLSyXHAhb/6z8rgfg7UEZag5bj9VRPg5mkb7t6TxCkKqf4KkIY4oaEVEv T7Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:from:subject :references:mime-version:message-id:in-reply-to:date:dkim-signature; bh=xrCZ3JDmoRPruDDfTE2MIoljy3aPp6Mt1Jsyf41HvKw=; b=zPEfwagb9Y1jpGxc+u6mB9ToqSFntUSH4As5bfKJGogHEjCPHE/++9175PQdAAq6OD 3G6W3fX6sMo5Hkv9Qevx8fKJSNBulBc8yz5RiHC8No7FObG98JBmkTJd6IcTWaQrP65S 6M69EFP96dTxkvCEyHuwxp4Q4hOGmDJi3lOwaKW4P6q6n3BnD6BvFv0SF2683po1duCm 8JnYPx4eRDsff0EJ96dRNEBjqVMX6eftPDYMsTr5aUMCjE0PXZEkaAjZeYBabqtgzoRd awhxxfCoHnGm2LNRV+iEwCS1JGve4dP5EU+bAf3Y8xAt0detDKQyRvj435cuOAdtHGTI EEew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=m6IsAPXe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l3-20020a1709061c4300b00726b4f91300si13204261ejg.269.2022.07.26.01.23.12; Tue, 26 Jul 2022 01:23:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=m6IsAPXe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238214AbiGZHkl (ORCPT + 99 others); Tue, 26 Jul 2022 03:40:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238519AbiGZHiq (ORCPT ); Tue, 26 Jul 2022 03:38:46 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55CAD2BFB for ; Tue, 26 Jul 2022 00:38:30 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-31edbd801b5so52732567b3.3 for ; Tue, 26 Jul 2022 00:38:30 -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:content-transfer-encoding; bh=xrCZ3JDmoRPruDDfTE2MIoljy3aPp6Mt1Jsyf41HvKw=; b=m6IsAPXeraH4sveiwup4g2zagtiCTkNBAzqv8fgM0IoJl7hrB2JzWnIspy1lIY7osA NzAq3F6sO2d8uqWMdVFrS63sBkmLaYviVNj7S5bFoNxZW4aM3kSxz16b2fsJs1wHVodj XYTsyXv2EdLxUTOBL2TRNlpw2hv5izPXRxd/Z8NCB05ZO1KoHvjIeAKzQ/wCMrPfIjkF CwDZjSNE4xTOp8O6+44f6VUzoPj0PPtSHzUMylIR6Z8gIUsJG12CccrP3jvNWY5L6ovS GpZRrij++WgXDPzUdF+AuJ2mJkEU3GESYnoDG1tN06qjgOizHU6Q+SpIz3jEcMDcit9j EyAQ== 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:content-transfer-encoding; bh=xrCZ3JDmoRPruDDfTE2MIoljy3aPp6Mt1Jsyf41HvKw=; b=aLNH8UUCOISk3FmHUe6k/rb17CJUL77cN87X6iVW+bwg2OmagS3va1V/KnDqyGcyVl JWePsdw7S6gjqm3ssfxQe5euB1Uhcy0o7tLL/ef96A64rrlscbXbbC9fgr94lxJ0M+Hg WF3AQLM3aCvaUr0FJj8unFxJmMUCbQ/iYbX0HkYKKA/LCAHCmIswk0kyvV5d7BbRG78/ 7hcNP8PxCx+jXkkHiSof7NAujAUdbfzrrSWYG1LLnGpfyjdR7IayOWf4kw3WdcIU0I4L R12Vke82NgTnp25qhe6Jsdo98I9RZHxnQQQfVQp/g6X2ycz3rD0EyOqtMAgAwN4ROJB/ shIg== X-Gm-Message-State: AJIora8zYGmeNzXHb4pVG/u7RdFDJI7Hc3pbZ8HS0ucdDegGBMP/Vz7p ZwCgkFecxqJnOHnGvCnXyRO6gTNUpATWpP/N0g== X-Received: from kaleshsingh.mtv.corp.google.com ([2620:15c:211:200:4f77:3b64:736a:394e]) (user=kaleshsingh job=sendgmr) by 2002:a05:6902:1542:b0:66e:e116:95b8 with SMTP id r2-20020a056902154200b0066ee11695b8mr12799119ybu.218.1658821109572; Tue, 26 Jul 2022 00:38:29 -0700 (PDT) Date: Tue, 26 Jul 2022 00:37:47 -0700 In-Reply-To: <20220726073750.3219117-1-kaleshsingh@google.com> Message-Id: <20220726073750.3219117-15-kaleshsingh@google.com> Mime-Version: 1.0 References: <20220726073750.3219117-1-kaleshsingh@google.com> X-Mailer: git-send-email 2.37.1.359.gd136c6c3e2-goog Subject: [PATCH v6 14/17] KVM: arm64: Stub implementation of pKVM HYP stack unwinder From: Kalesh Singh To: maz@kernel.org, mark.rutland@arm.com, broonie@kernel.org, madvenka@linux.microsoft.com, tabba@google.com, oliver.upton@linux.dev Cc: will@kernel.org, qperret@google.com, kaleshsingh@google.com, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, andreyknvl@gmail.com, vincenzo.frascino@arm.com, mhiramat@kernel.org, ast@kernel.org, wangkefeng.wang@huawei.com, elver@google.com, keirf@google.com, yuzenghui@huawei.com, ardb@kernel.org, oupton@google.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, android-mm@google.com, kernel-team@android.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add some stub implementations of protected nVHE stack unwinder, for building. These are implemented later in this series. Signed-off-by: Kalesh Singh Reviewed-by: Fuad Tabba Tested-by: Fuad Tabba --- Changes in v6: - Add Fuad=E2=80=99s Reviewed-by and Tested-by tags Changes in v5: - Mark unwind_next() as inline, per Marc arch/arm64/include/asm/stacktrace/nvhe.h | 35 ++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/stacktrace/nvhe.h b/arch/arm64/include/= asm/stacktrace/nvhe.h index 170fe7459f7c..2ce59c058806 100644 --- a/arch/arm64/include/asm/stacktrace/nvhe.h +++ b/arch/arm64/include/asm/stacktrace/nvhe.h @@ -9,6 +9,10 @@ * to allocate shared buffers for the host to read the unwinded * stacktrace. * + * 2) pKVM (protected nVHE) mode - the host cannot directly access + * the HYP memory. The stack is unwinded in EL2 and dumped to a share= d + * buffer where the host can read and print the stacktrace. + * * Copyright (C) 2022 Google LLC */ #ifndef __ASM_STACKTRACE_NVHE_H @@ -49,7 +53,34 @@ static inline bool on_accessible_stack(const struct task= _struct *tsk, return false; } =20 -#ifndef __KVM_NVHE_HYPERVISOR__ +#ifdef __KVM_NVHE_HYPERVISOR__ +/* + * Protected nVHE HYP stack unwinder + * + * In protected mode, the unwinding is done by the hypervisor in EL2. + */ + +#ifdef CONFIG_PROTECTED_NVHE_STACKTRACE +static inline bool on_overflow_stack(unsigned long sp, unsigned long size, + struct stack_info *info) +{ + return false; +} + +static inline bool on_hyp_stack(unsigned long sp, unsigned long size, + struct stack_info *info) +{ + return false; +} + +static inline int notrace unwind_next(struct unwind_state *state) +{ + return 0; +} +NOKPROBE_SYMBOL(unwind_next); +#endif /* CONFIG_PROTECTED_NVHE_STACKTRACE */ + +#else /* !__KVM_NVHE_HYPERVISOR__ */ /* * Conventional (non-protected) nVHE HYP stack unwinder * @@ -132,5 +163,5 @@ static inline int notrace unwind_next(struct unwind_sta= te *state) } NOKPROBE_SYMBOL(unwind_next); =20 -#endif /* !__KVM_NVHE_HYPERVISOR__ */ +#endif /* __KVM_NVHE_HYPERVISOR__ */ #endif /* __ASM_STACKTRACE_NVHE_H */ --=20 2.37.1.359.gd136c6c3e2-goog