From patchwork Fri Jan 6 11:22:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 1722377 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=2E3iP0xx; 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=F9k46fCJ; 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 4NpLXx41Rtz23fc for ; Fri, 6 Jan 2023 22:22:41 +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=BORDFMEOC9Zfu6DzgnlWt4ylBfm3jnzAFUtLuYFRaMQ=; b=2E3iP0xx8hLxL8 /bhjodkHROiH2OMeLRnMZH9DnT3pK+MzpsZ/J69gavGHb5qbFniPHFzvz8JbLdHt2Y/fdAjWwGPBs i4BFFBvrh6RMvB3tbJ7VypexskVQnQX7TYHPpWAYeN2vJ9/9PWKWxEeozAe9qK9fHyqfkyih10Gln l/co8MycD6ur1yUx8G2scABir5gzZyZEX/qE9a19nTPtBWvRDkz321KGZ7QkxxFbPTR1fTC7PbX1J GZ3WGvHICoRdGVUzpIgcmCi2m5Ix9JStSCc31IBFqE43z2zsrYr5omjiOUmLvG0IDw6Gj2a1TqWxJ cSbUetDAytlFu24Wjwww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDknp-007i9C-6M; Fri, 06 Jan 2023 11:22:25 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDknm-007i5c-9x for opensbi@lists.infradead.org; Fri, 06 Jan 2023 11:22:23 +0000 Received: by mail-wm1-x32f.google.com with SMTP id bi26-20020a05600c3d9a00b003d3404a89faso3545324wmb.1 for ; Fri, 06 Jan 2023 03:22:20 -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=J2rdJ7g+0nwnhWNenv4sr17y5+qkeWl6LQugu98/DfI=; b=F9k46fCJqX4nKRSggaj6LLnpwuqHXLk8rLzPZP5975tO2x7P7fykhBTyUwkEavcD9i Ucsc8yPwa3YGuRbAejSFT0DfgJHqNXXS1znGbVrPbPSavAlM+8kHgFomZXTqrbxmrmhh UuWi6eNotr+3oLxC6PeVmOt9JQHjgAG6PWTkP/7dvpw3FgwqbYrzCVhaF6NHhXZdHm6J zo+09f4YA66x7KbSLw/NlY4T3Ubsu3fFDTpN19pXD3WxztSz2tTQRsgVCEl+mQEQPsmN 0qfSulx0AukeUHWcjQn4Jg2KN1QEwKti20JlfGTF21ToQK3vEvogVpFZq7EH7gvva9xv qkbw== 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=J2rdJ7g+0nwnhWNenv4sr17y5+qkeWl6LQugu98/DfI=; b=dW5OWrYdjWvxEd+hGkkGCGbnF/L529gZv2XaahMqKkIzyOZF/aZiIt8xdE6x4IVc5X 4zUaAPqYXBL7xq4LN0arrdQZ0iusIW6+Lm7/RD5ZstTK7n6wzTROr0+trnrS3sKgR9XR Ggit69aKkLsY41egjzYyMCyp5ZeipenFAZNGlNej7loP4t+kXqNirPaywJ5U32CCKtDL xks8WNSNsMmz+3D8+lJLVOa6fSEGYf9/BhS3xN1MAhkyP0HE2uuHpFfnB5Ql36TwX1fF xC6NaGfwlg6yh6+JkCH3fjaoke/eytwu/tud1MukV4z2BsGNuMF2ZTpsla/CJjHetvIW 8Wcg== X-Gm-Message-State: AFqh2kpVfP/5N+geZBHlrALBqniwb19e4p23Pd6B+j0mU7p3/zEfT73H 7ODtb2ziNvWl64H+w6lThW+a2oJZceUj+Gal X-Google-Smtp-Source: AMrXdXvIM+/W5auSwoZh8f36Untgj5wIZVxNS43Ecpb/eFv1GiEph+rrUjRLqVJCO+X22tWA2L76nw== X-Received: by 2002:a7b:c7d6:0:b0:3d1:ee3a:62ae with SMTP id z22-20020a7bc7d6000000b003d1ee3a62aemr42077539wmk.8.1673004139412; Fri, 06 Jan 2023 03:22:19 -0800 (PST) Received: from localhost (cst2-173-16.cust.vodafone.cz. [31.30.173.16]) by smtp.gmail.com with ESMTPSA id n23-20020a05600c3b9700b003cf71b1f66csm1592155wms.0.2023.01.06.03.22.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Jan 2023 03:22:19 -0800 (PST) From: Andrew Jones To: opensbi@lists.infradead.org Cc: 'Sia Jee Heng ' , 'Anup Patel ' , 'Ley Foon Tan ' , 'Atish Patra ' Subject: [RFC PATCH 06/11] lib: sbi_hsm: Export some functions Date: Fri, 6 Jan 2023 12:22:04 +0100 Message-Id: <20230106112209.441825-7-ajones@ventanamicro.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230106112209.441825-1-ajones@ventanamicro.com> References: <20230106112209.441825-1-ajones@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230106_032222_363615_0CC7B30B X-CRM114-Status: GOOD ( 10.43 ) 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 --- include/sbi/sbi_hsm.h | 4 ++++ lib/sbi/sbi_hsm.c | 12 ++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) 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:32f 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 d6cc468d0528..00adfe1a4ef1 100644 --- a/include/sbi/sbi_hsm.h +++ b/include/sbi/sbi_hsm.h @@ -65,9 +65,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 priv); +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 cce4b07bbb36..8eb9643e6e72 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; @@ -329,7 +337,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);