From patchwork Mon Feb 27 10:31:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 1748597 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=SneLxfrA; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ventanamicro.com header.i=@ventanamicro.com header.a=rsa-sha256 header.s=google header.b=Ay8WylRm; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PQGyG4xZkz1yWw for ; Mon, 27 Feb 2023 21:31:50 +1100 (AEDT) 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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=TRAF5E5h9g2kdqijoJr4J30LXuXxddLK3BR5LjCjbnE=; b=SneLxfrAj91Lav wSI/nMCIGij1WNDLHVSiDZ16PoYG3UjoFSMn7+rc6tLWQZwnYijSlM1Lh4WrWcZnO8mmEtLJitaEB PjtCp/OmO9OpCVyHv3gpts1BJaZmkn3NwHpG6efoWX2sKwdzbb0tn8OLljLvzkC+Ejztu9AbcXqyx dw4cEd/cRF9OixpI4PcmTGCne0aOrPwL2HRVm6n5ikPJP4BSuXFrmZlv72NKHJIGoTEc3OPdaNLzs 2roWALgBUnfJPAXh3yiDLxi0laB81xDTWUZKw6neQGBSqrv1SNNuYArx7VNk6nPmuQOtn5xbWawTy UVRar3WjQn+NmHiRdx4Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pWan9-009Ec8-5g; Mon, 27 Feb 2023 10:31:35 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pWan2-009EVI-ED for opensbi@lists.infradead.org; Mon, 27 Feb 2023 10:31:31 +0000 Received: by mail-wr1-x435.google.com with SMTP id bt28so5638393wrb.8 for ; Mon, 27 Feb 2023 02:31:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nlMS+i6dlWZNklC8Ztba3ByzNdnkQang/Dkeotu66UA=; b=Ay8WylRmQn/1JEH8ozsioTc4H5sS1+pzBeCAUpwAg/Gjzr8/8xb25JvhqwBjZ4BWrb +6o9GS9F1X4IZNWuzyPBaJrg76GTBS+GxLoD9pOdqAbyZRR7H1STKWv+Q+2qfZeAqL6z 0y7w9Tb2IwuVazl5g/pOlbeNML7LTdMyY48XH9sW3KPXoXa5IhwEIgT25sCqkazGtVBG LT+sHQi8A+0TuAI+p8f7Kd9w/pf6V5tkE6ohVGgKbpSqH9vduBCrkGyRPAwr3mRmSFeA 85pUUVtdMCnCp/O9ixkxJ10YckFMi0o1RpMsoo4MoLkvUAo5Upk9+8mvxCh7vGzye7bN e+NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nlMS+i6dlWZNklC8Ztba3ByzNdnkQang/Dkeotu66UA=; b=spvR6tIeEdmd7nvGNQha54U4ofXsTyewTnHfhRRN6NMlHw5nx57Tj8r3RoaqcJlMrb e+oQO7v0bR/rD6xKNEhPygmuubufPfJJ6fjX3U1MTpeMPB+534NTgHeqwgBLhwMZ+LPv q+O6XhF1Uvgdzpf7rb9p93Qkux6Gvps6siXuPAZGNsGUKtFHBXE59tOg9vl0AwKJsthK R30A0iQgMkxXlrnGTAKdNIzgNvHip0b1fWSyr2H9Pk3sHzDRE/aptDrtIt1w7CsDIaYC 97yrABsmH9s9GOEIx2+GzO7cAbcaYYHWNqYL931iOD7t7V3aXcEZHwzQ1KEZCdnvVSXv tcAg== X-Gm-Message-State: AO0yUKUWdtxxe4w5LVgpBk50gnCEo7iHAfvIYVHlsvvcy/7/IIo/koNx N59wUXJlWrMn7StLsdlnLaDDSFGeYRxWFD/M X-Google-Smtp-Source: AK7set/WvUHnEr31gCTczinQeEr6Xj3cNUmB+Irff3IXfApB0mJBjx1EPLOF48YfkKSAjLVA98puow== X-Received: by 2002:adf:cd82:0:b0:2c7:cc8:84a6 with SMTP id q2-20020adfcd82000000b002c70cc884a6mr14469748wrj.31.1677493884257; Mon, 27 Feb 2023 02:31:24 -0800 (PST) Received: from localhost (cst2-173-16.cust.vodafone.cz. [31.30.173.16]) by smtp.gmail.com with ESMTPSA id l3-20020a05600012c300b002c5694aef92sm6667451wrx.21.2023.02.27.02.31.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Feb 2023 02:31:23 -0800 (PST) From: Andrew Jones To: opensbi@lists.infradead.org Cc: 'Ley Foon Tan ' , 'Atish Patra ' , 'Anup Patel ' , 'Sia Jee Heng ' , Anup Patel Subject: [PATCH v2 06/11] lib: sbi_hsm: Export some functions Date: Mon, 27 Feb 2023 11:31:01 +0100 Message-Id: <20230227103106.137995-7-ajones@ventanamicro.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230227103106.137995-1-ajones@ventanamicro.com> References: <20230227103106.137995-1-ajones@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230227_023128_521478_6BEDD318 X-CRM114-Status: GOOD ( 10.32 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: A coming patch can make use of a few internal hsm functions if we export them. Signed-off-by: Andrew Jones Reviewed-by: Anup Patel --- include/sbi/sbi_hsm.h | 4 ++++ lib/sbi/sbi_hsm.c | 12 ++++++++++-- 2 files changed, 14 insertion [...] Content analysis details: (-0.2 points, 5.0 required) 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:435 listed in] [list.dnswl.org] -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_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org A coming patch can make use of a few internal hsm functions if we export them. Signed-off-by: Andrew Jones Reviewed-by: Anup Patel --- include/sbi/sbi_hsm.h | 4 ++++ lib/sbi/sbi_hsm.c | 12 ++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/include/sbi/sbi_hsm.h b/include/sbi/sbi_hsm.h index 1170127baa87..c0b483030de8 100644 --- a/include/sbi/sbi_hsm.h +++ b/include/sbi/sbi_hsm.h @@ -69,9 +69,13 @@ void sbi_hsm_hart_resume_start(struct sbi_scratch *scratch); void sbi_hsm_hart_resume_finish(struct sbi_scratch *scratch); int sbi_hsm_hart_suspend(struct sbi_scratch *scratch, u32 suspend_type, ulong raddr, ulong rmode, ulong arg1); +bool sbi_hsm_hart_change_state(struct sbi_scratch *scratch, long oldstate, + long newstate); +int __sbi_hsm_hart_get_state(u32 hartid); int sbi_hsm_hart_get_state(const struct sbi_domain *dom, u32 hartid); int sbi_hsm_hart_interruptible_mask(const struct sbi_domain *dom, ulong hbase, ulong *out_hmask); +void __sbi_hsm_suspend_non_ret_save(struct sbi_scratch *scratch); void sbi_hsm_prepare_next_jump(struct sbi_scratch *scratch, u32 hartid); #endif diff --git a/lib/sbi/sbi_hsm.c b/lib/sbi/sbi_hsm.c index 294156a9a7bd..3eeeb586cbb8 100644 --- a/lib/sbi/sbi_hsm.c +++ b/lib/sbi/sbi_hsm.c @@ -46,7 +46,15 @@ struct sbi_hsm_data { unsigned long saved_mip; }; -static inline int __sbi_hsm_hart_get_state(u32 hartid) +bool sbi_hsm_hart_change_state(struct sbi_scratch *scratch, long oldstate, + long newstate) +{ + struct sbi_hsm_data *hdata = sbi_scratch_offset_ptr(scratch, + hart_data_offset); + return __sbi_hsm_hart_change_state(hdata, oldstate, newstate); +} + +int __sbi_hsm_hart_get_state(u32 hartid) { struct sbi_hsm_data *hdata; struct sbi_scratch *scratch; @@ -328,7 +336,7 @@ static int __sbi_hsm_suspend_default(struct sbi_scratch *scratch) return 0; } -static void __sbi_hsm_suspend_non_ret_save(struct sbi_scratch *scratch) +void __sbi_hsm_suspend_non_ret_save(struct sbi_scratch *scratch) { struct sbi_hsm_data *hdata = sbi_scratch_offset_ptr(scratch, hart_data_offset);