From patchwork Sun Feb 21 08:53:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1442757 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=Hb0fpqB2; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=QzNE8MdV; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-sharedspace-onmicrosoft-com header.b=Ifd8mG7b; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DjzdD5X79z9sVr for ; Sun, 21 Feb 2021 19:54:04 +1100 (AEDT) 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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=EYfYrjm7TYrvkypXRUGTjaRTb/DjMBGSScfOn0goR2c=; b=Hb0fpqB2jNDP6/Gux7LA/9AmZ 9rjRSG5ykOcoclGVOUI2U7G/pdjtWH/seYKBauR1b1XvaM4wtrGEimmtYmH0F91fHaiD+YkTgNpXB euX8BxKOwRyB1QkvFaa3ymD3g/Gp7R7SNjCuEaNZqAFbPsYgxZr7QePJ6PEsUHhtbRtbqdkql0Rqm PHBs7032lW1+VC+dJXf2Sh+LmBPFmYKgd1x47P25khnUHfHns+NEtjvXYPO4U0TRcgNQFDTKyg9Zx jwlroXjcYAVjwGd0pKDL+Da9azqb3HjtsIX8Wna0xRPgiJHcEkk2rXjhIFphirqsZINqitBJumToU SAVu92GoQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lDkUy-0003VB-Im; Sun, 21 Feb 2021 08:53:52 +0000 Received: from esa5.hgst.iphmx.com ([216.71.153.144]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lDkUu-0003TX-DE for opensbi@lists.infradead.org; Sun, 21 Feb 2021 08:53:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1613897628; x=1645433628; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=k0L+hlVvC+aqRBCWvLwCf3sPSg5PgyqsLSJx8FKXtwg=; b=QzNE8MdVoKiLNx9F4mDXQw8nQYVIwzneKAu9IOaT5HytwzIFXCxwmNL1 M2q/0hKqYGPIChPzdOylG8U2UgLxpgmkKxP9R5/ksZwFz2eBqH4KifhuH nsq+H/gUlrTW7F5w9ixE1XMCtKfgtlRIVzFqo7bq/5mSkVB46gRJjT4tA UUWP92ml9Lfqiuf8LudT04m050MZFf9l7nrYVHgL4+Tb1t9rBgcDffXuB y8Cz1ouJ8PR0Yjf8dtJFKiJGAJpEjFTajM2EECJudDTTs9jQ8G1BBHhf0 vVJXRAl71LBTHk3CoOnBmG0TuIez2CYR5iBDgAktcPskCrK7oEOjfacH1 w==; IronPort-SDR: 36TnDl+wFbjZB0fogvM29jIKOjC6twT6wE6HcpECQVFLCaEvneJ6qNNQXfdDm/0WDrMuHHHZM2 foWOGrYYBvw5Oc4l0tzvVOzK7uur228dhV2K8YtOmuFAgAhp+3wT1avDzorO01KBK/wiUce1NS EHtaBrXPNhwPtSvRgWrRILJNgdvv/RPzBnono+dGliP0BIhmclnAlBh6JVoBOZqFWFRNljaryZ 8gS3BJEQ2o8W5xWsjlUmVzUJ95Fxmlzzfplm99JHt9YSuDKzmngVB7uMyNWGnCeAFWztxE+WUU FqU= X-IronPort-AV: E=Sophos;i="5.81,194,1610380800"; d="scan'208";a="160446546" Received: from mail-bn7nam10lp2100.outbound.protection.outlook.com (HELO NAM10-BN7-obe.outbound.protection.outlook.com) ([104.47.70.100]) by ob1.hgst.iphmx.com with ESMTP; 21 Feb 2021 16:53:45 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j9FYA7a7eVp9il08RxDxztM/+bJ5D5LbGmy23xQok4IqfHkms9HWEiSMiz7Qv/2mR2NpvCbzTUhpmh6C3KX0ncZxQOC9ZBfStpxqdGkJvH5pqCmNfeKLAi/oyPfAn4ECoDqWwhK0Lf16fGqN67m8SOKLnolxwPaC/aQ2L/ZQEAOzvziMsLv+EqWaTo8qS1uYHefzWH1BBw6t1bK9ObLRovmG1F1QFrLi8SjhWF2MzIGYITi4NIjroBFyvPd+urjwTYYhfUfgHDXeXCT5Kbf1IP1H7LFDxb/9jQYFuP0BUmt3dkOfq47z2kOxekswxzIiUomqlqhYfiKIaHzbE/4CtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PyEnYAwt8l7VJ9eU624stoh5UvstZdZ5C/imosWW19Y=; b=nAIimle8QQ91AR76OAmrLd+7ZYuvk5pCIy+n6kC44bJ/fm+c4gsWz4nPrustOrcJzkwBPlxIBEy0SJsCyOe2wyEs5VwUAjxfRASM5zESGSJTuU3MrDraGlAnWnKJOPIwNAC/cFMG9Kqo1uPQGYnc8D+A8iWtdsRja1dKrUbRtuEcsb+xUuicjSuJOHk3tCw77Y73fyFR/Eqbs587RLBifbydP/8Z+qcRN+gm4Lrlq6ah2KtFH1DuU93ifBr2Gw3dtf3WscZNPQ7/p2uT+Gp+MAQH/TAV6xoHHn6L1gal/UGaOSflBhfRUKI7DGJGHu8W77IURnksxCARtks8mjS0Hg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wdc.com; dmarc=pass action=none header.from=wdc.com; dkim=pass header.d=wdc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector2-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PyEnYAwt8l7VJ9eU624stoh5UvstZdZ5C/imosWW19Y=; b=Ifd8mG7bD+lAIJhtexkMC7H8UKf6bt2cueKiHuBjdBKEkV4qgmt2tmd+tO63c/FN6TXAbbbCMNNpcOrnCuMHdgny3h0LdLruhEACXdJUkZ+FElXJmHvIPrvFTiq7M797AGr/YF3Bj5E6jCqq0b933scFz12rT70J86iHFIGFUiw= Authentication-Results: wdc.com; dkim=none (message not signed) header.d=none;wdc.com; dmarc=none action=none header.from=wdc.com; Received: from DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) by DM6PR04MB4123.namprd04.prod.outlook.com (2603:10b6:5:98::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.30; Sun, 21 Feb 2021 08:53:45 +0000 Received: from DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::38c0:cc46:192b:1868]) by DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::38c0:cc46:192b:1868%7]) with mapi id 15.20.3868.029; Sun, 21 Feb 2021 08:53:45 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Subject: [RFC PATCH 01/10] include: sbi: Simplify HSM state define names Date: Sun, 21 Feb 2021 14:23:12 +0530 Message-Id: <20210221085321.180602-2-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210221085321.180602-1-anup.patel@wdc.com> References: <20210221085321.180602-1-anup.patel@wdc.com> X-Originating-IP: [122.171.171.12] X-ClientProxiedBy: MA1PR01CA0104.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::20) To DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from wdc.com (122.171.171.12) by MA1PR01CA0104.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Sun, 21 Feb 2021 08:53:43 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 4ae8ee37-b4fe-4981-5f1b-08d8d646320d X-MS-TrafficTypeDiagnostic: DM6PR04MB4123: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:466; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qtGAN4ENX9kGDbo1gHsK6VyU65sL2lMB/uT97cvtWGymk1Ih4aHqz3MpC3dCy98gvxPPj5YFYjLhYO0brMzM7N1mwg+qkmyazvnQgC8ZM013VqeBNybie2yTVnbznq2wNcKhaajLZ1LfJeraiSOGSJ4kWRCMep/Bs+hKhS4ipKwszID/0+TUGCO+sNcjVcSdZCBEgJDKtGqijXV79lmPBq1NQoHqkj7olZYnxtDPPZuMEiLFAxtqRy0tWXQerexCaVlUzidSSbVzU/3Wm9QxLFZhOl65nHrGIBd30loMU+QvP1IRR29b4tkNV6gpWFma8GYO7r6jJdOrKa/sILwU0frJ5ijqJ0Rm9sMn0VU40VosMYEWlPB5Vwj3MHd36T/N0hZtxmUHq26D1MP8XEYurZatVB/egs4vM6vvuZXSu4tq2u0P5nnk3yWHyPH/QPUmTGyCd1ZOI29+GDKH9BQa3vVR0yqomujhE1rSFtHzvOXnk66cOEnAau9otNR+BsMIswqpWsbCwUuLaajLktAUdQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR04MB6201.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(376002)(366004)(396003)(136003)(346002)(7696005)(2616005)(5660300002)(4326008)(16526019)(186003)(478600001)(36756003)(8936002)(52116002)(2906002)(26005)(54906003)(110136005)(86362001)(55016002)(66556008)(8886007)(44832011)(66946007)(6666004)(6636002)(956004)(1076003)(66476007)(8676002)(83380400001)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: 6fMGcePGvsFkLkUGhSuTW0ZWhfBwQ37q5vItnQIR2Mr1hmJK1ufGLysGrjBmbgIjtnEsuOq4prVJXZVpqKKdXGVmqx9gxExH+CA4DfMANkO0gYVLqGzLmWayChZp5Hx8ZeAfagxiJC5SWS6SKfrv4yUvDZ2VJbFXG8ceQzPssl2FfmxMLuTg2Z2/1L86EW4hB947MNZUoTjvVgQikCUscn4AnzNJmyTOcEsPTCaFM/6nLth1RsayAM8Rpbw7oHAP1xdMlQq0CcrkHXw6Fa0PExlPdxnbAu4DIAuzhd5dRWIRsrVzEsxo68HEd/P67R+fTn7LmXFTru/SlsGFeGczTdZAFmzEH/xnk2iJwCx+3aMzhN903AeO4zETTkQtvPZ8YtQFUHKxKbmg53otOR5Eh8vZ68kM07ywi/ZiSyX/LEOmZwacazBmoc0/HVNlOz7ucxr7RhDO0HcjPU1ad9XKYatWcsCAvKmA8wE82YbFOW6hXHtPi1TO0AZ1KjuWQc0AYc/rObKlb80DWtwQfZhZJIHdPd+WsO/Px5D/AQJYeyBtJle2hjWdB7VV8F8DiSeAho4/bdAMulxe2G8TdKSOfBSIRx4aWUOxIK+GDCCtnykXpXMOWjrp3pkN4+u1veH2ncRZ2GWbUoRxtvfNpOPR27QcyynZr3y6o3PjvjB1GtP9o0HZR4zfDaZX1lnAPK+gOkuzfwsz3BgkQcZYPpEdedKPkQmE68VlTVCWkKHeb1VMXHsfnKRqQdFKvn2QQsH7Q7Ct0hYCAEDrehKWDvZFcTX+dUzkPW+6egXqE3htm4ymyxgu/xLcT9oZ++KXtystNrBbKaZBf8Tpw8ruMjtu56c1tQeLI46mg4J+UBqLV8LtWjr+CbALgMv+MEwpBxcIVLxVSApbH8NHsTOYcEymLh0KxPAwffvw6zosvwhoCsupka1LUZxhTpZeT8LBVtG04zur1g0a7Ts5A5TS9s8T10c5u6jcGyH7nrto9EehPw35NfX23JSEwUF5ih9KvqiR8lylb1xcfFnbKBRIOC7W3IrsEFyZScnMNTzsqSeXWNtaUhtHgnNctC/+wCdgN0L5qZ9AYkgbO1dxelHGU5FWMH5erJEyTs/ux8e2+nUgiyZE3s7FsP9Rukelo+zUzm1J9TJUT0VNqw/zEvdplTtgCK6H65nY0GqegeoF/tG4+Yef5hsLTBSQ/DmJ7s/UoDb9gFeA26A7ZpJbZtKMPXZNbtBU6MJBjDAZwzX2LBf3gmRKPrgAEuabbcVLOfhOlO5mEOk9MUyYxMR+RuoihWyLNP6P63Xtv0WVJYU22D7AZQmfwOM0/bxawmrB5vDpSYj3 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4ae8ee37-b4fe-4981-5f1b-08d8d646320d X-MS-Exchange-CrossTenant-AuthSource: DM6PR04MB6201.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2021 08:53:45.1525 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: aTgL9ouigkEplOChGVFdteZSPMVRuxgltXEJA8dISJtmahN/zLfbwoi9ReOsqDQSn8xok82c5rZFK4yezSEbfw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB4123 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210221_035348_690208_614E9CC8 X-CRM114-Status: GOOD ( 12.88 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [216.71.153.144 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 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 -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.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , Anup Patel , opensbi@lists.infradead.org Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org We simplify HSM state define names so that these defines can directly replace SBI_HART_xyz defines used by SBI HSM implementation. Signed-off-by: Anup Patel Reviewed-by: Atish Patra --- include/sbi/sbi_ecall_interface.h | 8 ++++---- lib/sbi/sbi_hsm.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/sbi/sbi_ecall_interface.h b/include/sbi/sbi_ecall_interface.h index 002c6f9..b272213 100644 --- a/include/sbi/sbi_ecall_interface.h +++ b/include/sbi/sbi_ecall_interface.h @@ -58,10 +58,10 @@ #define SBI_EXT_HSM_HART_STOP 0x1 #define SBI_EXT_HSM_HART_GET_STATUS 0x2 -#define SBI_HSM_HART_STATUS_STARTED 0x0 -#define SBI_HSM_HART_STATUS_STOPPED 0x1 -#define SBI_HSM_HART_STATUS_START_PENDING 0x2 -#define SBI_HSM_HART_STATUS_STOP_PENDING 0x3 +#define SBI_HSM_STATE_STARTED 0x0 +#define SBI_HSM_STATE_STOPPED 0x1 +#define SBI_HSM_STATE_START_PENDING 0x2 +#define SBI_HSM_STATE_STOP_PENDING 0x3 /* SBI function IDs for SRST extension */ #define SBI_EXT_SRST_RESET 0x0 diff --git a/lib/sbi/sbi_hsm.c b/lib/sbi/sbi_hsm.c index e1b2b2c..1722280 100644 --- a/lib/sbi/sbi_hsm.c +++ b/lib/sbi/sbi_hsm.c @@ -39,16 +39,16 @@ int sbi_hsm_hart_state_to_status(int state) switch (state) { case SBI_HART_STOPPED: - ret = SBI_HSM_HART_STATUS_STOPPED; + ret = SBI_HSM_STATE_STOPPED; break; case SBI_HART_STOPPING: - ret = SBI_HSM_HART_STATUS_STOP_PENDING; + ret = SBI_HSM_STATE_STOP_PENDING; break; case SBI_HART_STARTING: - ret = SBI_HSM_HART_STATUS_START_PENDING; + ret = SBI_HSM_STATE_START_PENDING; break; case SBI_HART_STARTED: - ret = SBI_HSM_HART_STATUS_STARTED; + ret = SBI_HSM_STATE_STARTED; break; default: ret = SBI_EINVAL; From patchwork Sun Feb 21 08:53:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1442753 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=F1XjDYu6; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=Zl54nqzc; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-sharedspace-onmicrosoft-com header.b=oAG9zVhk; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DjzdC1T38z9sVJ for ; Sun, 21 Feb 2021 19:54:04 +1100 (AEDT) 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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=RLJNvKCaoJ7ZHjGJnhnZw7x7OXmZAP4sjMFSIX6Euwc=; b=F1XjDYu68vQxDymau2DbBJzvB Kb0fkkGc6q4ROZNOXeQttf3QgwBoWxR63OH8cKY7G2RTtWqLnaT143rOPzlx4DagWRcafhwtld8Hp I4w3V5Iz8ngtH3/c9p/v1kTURpFCdiiR4VcrsqIa00qKTlrJ56Moa/U5yey9MqtVQ9YdvPXxFF7DI C5dkAGzh6Y6mUTrakEmzzCIEr3Gt4c9pgAwJ5GDomErxnZuMiLR0HQLGPsGVycb+PpMXqbBgjOtwM j6RiOGc/6at+dex5TKrKev9+C847hPh46UA7mzrej0rmPQgqGlUX6fT2RUn37STJXPR9ldaMCQlFD MGN8tDHqA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lDkUz-0003VR-1F; Sun, 21 Feb 2021 08:53:53 +0000 Received: from esa5.hgst.iphmx.com ([216.71.153.144]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lDkUv-0003UH-NV for opensbi@lists.infradead.org; Sun, 21 Feb 2021 08:53:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1613897629; x=1645433629; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=rBpsXxNcM7lj6x8XUoCaYEvTyaVP5iZAgI81yR0AJQU=; b=Zl54nqzc7luCd5PnHkOuGOe9w92gE86RNGtquJ+kqzFbFPJRef24jaML Qooee2iW/AnGtObkTC0rY8ni2vAUAHvILBo4vz23Z3JzS3MAHMAWIRYFW uwATLeFw/yLumdsbQpuWSfiC+cdRUdMTZljMOk4XVnCKY16qfWMoVT/d9 LZEgg55fpylzev5E3dBb2fzrI2dBALzWuPT1u09qzo6CZ6VEApvsl0KF6 gRdLlCHMb4LBAauDqtRbmpjvOtObgJcKMECpfd+ldco5mUYzxVFxuR5fE M2yhBfmC01QQIfUU28nhYWw7g1mx2ZYEjo37/PEVOGbdfTj658BWiUWak A==; IronPort-SDR: oIaTQMj2dLGHUnRKRujkjVhOM7DU2CPGl+mqtUBzTE9b5jRqjN7FzLyCKtNAqWmBCeOcY3eJKV TsbQ3Hkcgo/U/leqNEUig84MTsGx0U3/iNH9nrvLaGuaz1vuesX/tqmDd8eo81ZiIhxwKzR4QN Xd7Palv5ShyXdxX63abR354BtsiTEL1wfopZIr3+Jv0M9BNhKp2c4HIwE6KHlCLM0sLcfLGPRK B/YnaCDQX/bglwH3xWk6bTIDhi6xIu7QVam0iDtM1aCbH/PWwyXW8GC7iXqi8Ic7aMQpCULa6h c3U= X-IronPort-AV: E=Sophos;i="5.81,194,1610380800"; d="scan'208";a="160446549" Received: from mail-bn7nam10lp2101.outbound.protection.outlook.com (HELO NAM10-BN7-obe.outbound.protection.outlook.com) ([104.47.70.101]) by ob1.hgst.iphmx.com with ESMTP; 21 Feb 2021 16:53:48 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nPPISpKk32KatNh7bux7kX19AelLOFPpthtJp8a/fNRDIwJLdXW3y//vEAAe0c4vhXQ/bkBM8UixSMnCXb805mKjZ9nKbCWFjBreac+e1LRkInl6oxQ8GfO3JGxkm0KZOdHU1mALoOraLyjLGUWc6KrCh2B54huDSf9y/ruqHW65yT731wH6wHYfFHBu5YmWGmehWFzbm4xmHDApM+tyEeZ24a1gUygjmf12wxTFWWrk1jSnnpHcHFd1UmLPs1xOfJdZL8ozkl5LKFmpsxm6IYF5i7XAWFEwfbc9hdIBW8JfW3Sb7nLoTbWajHPZcxhrj6oXQdAjdmaTwOwoF2kuxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cp/bxGXQ9Hv1WCWy8mbX8vDEoUYfvqPhFLJEoCFziBc=; b=DU/M64Yz4zvTNjtSC9Dc2500OTMopi0qWD2Hey4kEDiTwhT6fGOEXN2bfDIVwOdhiu0RL6b7eELH924fVilxO0G6w+sXekncUFHtS3TZrIXE5ahN7Z/jbFLly9e0q/LPSHs6kGlG/b/8dzsOxdiA9q6Y9SkKS2JCpnhdTRZkb4QIUYZFtY+gZDCPnD+0sULs67XtIkc69nKhtvM2FD3BFx4gH0+UY1XFaHM+8H+SEcEoKJM8oYiHq4DvAX6hjjcxXxWNMX2lUbwFxEsB9lwovquZ3NwjCFKKAPNBm9Aw+EykWCiog8fqx/tt8RpHpLnHHsJ3/8a9rNPs4s4UF3eHMQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wdc.com; dmarc=pass action=none header.from=wdc.com; dkim=pass header.d=wdc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector2-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cp/bxGXQ9Hv1WCWy8mbX8vDEoUYfvqPhFLJEoCFziBc=; b=oAG9zVhkzHtJHiA0teqlax12n3cxAExxyj0rKrHi+hPM1GjjfM93l97O0tx4NpmyZc22oQ4T6OTjtUQBtGJnTvnEzhIymm9zQ6HmHmmzW2Ap4qdV6OgyQ3ZSVZbwFoAVTU6PAmPIepCzOjgc/hdO7j5osk09uT5aT6Cwms0LFnA= Authentication-Results: wdc.com; dkim=none (message not signed) header.d=none;wdc.com; dmarc=none action=none header.from=wdc.com; Received: from DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) by DM6PR04MB4123.namprd04.prod.outlook.com (2603:10b6:5:98::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.30; Sun, 21 Feb 2021 08:53:47 +0000 Received: from DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::38c0:cc46:192b:1868]) by DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::38c0:cc46:192b:1868%7]) with mapi id 15.20.3868.029; Sun, 21 Feb 2021 08:53:47 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Subject: [RFC PATCH 02/10] lib: sbi: Use SBI_HSM_STATE_xyz defines instead of SBI_STATE_xyz defines Date: Sun, 21 Feb 2021 14:23:13 +0530 Message-Id: <20210221085321.180602-3-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210221085321.180602-1-anup.patel@wdc.com> References: <20210221085321.180602-1-anup.patel@wdc.com> X-Originating-IP: [122.171.171.12] X-ClientProxiedBy: MA1PR01CA0104.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::20) To DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from wdc.com (122.171.171.12) by MA1PR01CA0104.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Sun, 21 Feb 2021 08:53:45 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c73b4f7e-5ed0-47ef-961e-08d8d646337a X-MS-TrafficTypeDiagnostic: DM6PR04MB4123: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:2512; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gTQA12mRt7O08Yf7eDuexdLzimyCl5/7nl1v+ERxyL7Daa2qjSz8d/NshKC69vj3Ra5k/My2Mu4APGJygu/PyDLAgM+B0ogG02DZnYQBRObsRVJyozXlIAcePdURXF1mijDtXsBH7G/WrJzfBbNUSz+AIavyvPTi7O55zhcNIP9OdKQj9os2C0JhaaiybfMb6JP0P6zo4c9IxhKpvS0xErmobs+15iilzFSDg/OjINdlqDFpOTlKpFNyHAzY8jppTXfNhO3fPZaTOepCgs7b+kSTyghSqzCMkerB+77FFzK3vcVHKS1W234diioK97+RiqHwF2wO8Ble6owpdLXzOG0B9dZa9XJ8Fxrel0PbNPRq4EHQXx2BuKikpWkGAO7VFFEKt55oCfCVSvgW6xtYsAi1WUSYSl4FioD5m0n9efqelJqx1dS04REPDRplqqKxjwBTi+Ceplf9m67se2Kl0ktRLYcgPtuyIksZ8Snw6K+tauMSnPqv9RZyx/YSfrOzRVEtWGTXJw/CY+fECan7lg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR04MB6201.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(376002)(366004)(396003)(136003)(346002)(7696005)(2616005)(5660300002)(4326008)(16526019)(186003)(478600001)(36756003)(8936002)(52116002)(2906002)(26005)(54906003)(110136005)(86362001)(55016002)(66556008)(8886007)(44832011)(66946007)(6666004)(6636002)(956004)(1076003)(66476007)(8676002)(83380400001)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: CYQ4TUwbWH5rHyFGaRa7In8xgEeJOx7UltQ1fvLKlizWEy50SfNKnKWMIa5fD0W1Rb/LywdBU4xRFuZEGastu4n8IuqN5e5qVlfoml/89tFm31y543hXDkb7UxAMywOS0fIlJVAsDKBhaedmNR/k1kZhA/GK2MDS22WJK4uXBl4yay2LmTRBouwLyRYjBzSYoRVOXWAN3+e7h421YH2TGWH6ZKSFpiJLbp0PtXX6wAccredh24BscntcEMQeJMRaMwnlMhjFI7gL7fgEUZHsR5iY5S0cqEkEQh69fka+UFSls6Q8junU45CL/ewmO1OodbKIvnSvb9zX97JTDWn1P2DR8TAOhKNq8SvG9MHf1yiaMEAtuhLX0ZRuQ1SxWoDCIs7pD7monLk4awHRLAaJgjn4zW49E6RiI5F+E35omehK6qrV/5cykdzEId4M4M6r+y4oAFdk4e+RDORw384R4U12MhTD5hcoPKkHkN4pFzym1Xlf6ccaaFudvQzzBfdccOxilr0aA3t+rPeaI2NnuLGm/PwH5YdX2vE9wqfG1PDccRzdlLMGZf9g6w4HUqZibzx1ilamuDcTMrrhqajgs71R+XbPk8I7aQBbN3g6HjmEPv8iuoCn4rux/1dhBjF2zw/SImqnUA4O1PxtGDPfcVh05/vftPQITxDq+h9Svm7fUaOLkQL6ObqacxZM9v/QKjGaLPhZw3HVCTscJytwl4HtSVlzyreFta920gmG+Pmdl9NVZIBCQoGJ/fh6mJGqWKTVkwFG2+3VFd+OzNZELBmAvES5L5euyBGy2FtZCC6ryxRsz4B7JKmN8rofUdJ35O7zAvkvtTqamPDZNYhqSClxf7nKpEecCJ6kRkXhA9Sr9ucbJ8yUFMl5ahsk9ZZl6TCF6yd9oAkb0AmYqb2/LtoV2bUg49IpjxlkJWy0WA0aq76H+kalfMa1w+LW77N5c6Z4wuU1OBYeYW35p3ZBAkR967b4RgKnKfYbAJLlLtXLtl3xWvQCPulTBBmvzkXx90l6whDLMPyy9Lfl5NZ6qBk5R1FFboPtWZvaHrUKkAmDZvv7E5hitJpt0Re6D7OA2AwcYuc9ojvcbb6Q+QecEhENXWnNo16Yph80l/i5bL2KUTofm/aAVBtyeSnSmVaQfzwdZRHGEiAPRs97N1IGGYpVU8CnP61wwwLd77A1iphsd06+7kcGtGac7isfNaapYTRVQsEGkPko6hoYYepi9YdILF74pusLJopvUfOXJBDHxINltDCoVAZDIOwHcMIKQfikagxzbnEeHakYItIiF9Ol6vRahp86s/kPnNdh01pf6OyUajpjBIeYBnn7xzvF X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: c73b4f7e-5ed0-47ef-961e-08d8d646337a X-MS-Exchange-CrossTenant-AuthSource: DM6PR04MB6201.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2021 08:53:47.4570 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xCwSZgVX5k+eVfn6ZhOnDQ1pOv4DYQQWRHhqDdz9IbZlo+WOrxpMMD66oBIdKQEt3F/NLtcqhyBE6D5gKUVoFw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB4123 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210221_035350_055912_690FACD4 X-CRM114-Status: GOOD ( 19.90 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [216.71.153.144 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 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 -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.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , Anup Patel , opensbi@lists.infradead.org Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org We replace the use of SBI_STATE_xyz defines with SBI_HSM_STATE_xyz defines because the HSM state defines are complete enough to implement HSM state machine in OpenSBI. As a result of this, we can now remove sbi_hsm_hart_state_to_status() function because it is now redundant and sbi_hsm_hart_get_state() can directly return HSM state or error. Signed-off-by: Anup Patel Reviewed-by: Atish Patra --- include/sbi/sbi_hsm.h | 8 ------ lib/sbi/sbi_ecall_hsm.c | 7 ++--- lib/sbi/sbi_hsm.c | 64 ++++++++++++++--------------------------- 3 files changed, 24 insertions(+), 55 deletions(-) diff --git a/include/sbi/sbi_hsm.h b/include/sbi/sbi_hsm.h index 4823383..69ddee7 100644 --- a/include/sbi/sbi_hsm.h +++ b/include/sbi/sbi_hsm.h @@ -12,13 +12,6 @@ #include -/** Hart state values **/ -#define SBI_HART_STOPPED 0 -#define SBI_HART_STOPPING 1 -#define SBI_HART_STARTING 2 -#define SBI_HART_STARTED 3 -#define SBI_HART_UNKNOWN 4 - struct sbi_domain; struct sbi_scratch; @@ -30,7 +23,6 @@ int sbi_hsm_hart_start(struct sbi_scratch *scratch, u32 hartid, ulong saddr, ulong smode, ulong priv); int sbi_hsm_hart_stop(struct sbi_scratch *scratch, bool exitnow); int sbi_hsm_hart_get_state(const struct sbi_domain *dom, u32 hartid); -int sbi_hsm_hart_state_to_status(int state); int sbi_hsm_hart_started_mask(const struct sbi_domain *dom, ulong hbase, ulong *out_hmask); void sbi_hsm_prepare_next_jump(struct sbi_scratch *scratch, u32 hartid); diff --git a/lib/sbi/sbi_ecall_hsm.c b/lib/sbi/sbi_ecall_hsm.c index df29d51..79a9f21 100644 --- a/lib/sbi/sbi_ecall_hsm.c +++ b/lib/sbi/sbi_ecall_hsm.c @@ -23,7 +23,7 @@ static int sbi_ecall_hsm_handler(unsigned long extid, unsigned long funcid, struct sbi_trap_info *out_trap) { ulong smode; - int ret = 0, hstate; + int ret = 0; struct sbi_scratch *scratch = sbi_scratch_thishart_ptr(); switch (funcid) { @@ -37,9 +37,8 @@ static int sbi_ecall_hsm_handler(unsigned long extid, unsigned long funcid, ret = sbi_hsm_hart_stop(scratch, TRUE); break; case SBI_EXT_HSM_HART_GET_STATUS: - hstate = sbi_hsm_hart_get_state(sbi_domain_thishart_ptr(), - regs->a0); - ret = sbi_hsm_hart_state_to_status(hstate); + ret = sbi_hsm_hart_get_state(sbi_domain_thishart_ptr(), + regs->a0); break; default: ret = SBI_ENOTSUPP; diff --git a/lib/sbi/sbi_hsm.c b/lib/sbi/sbi_hsm.c index 1722280..1f54c9d 100644 --- a/lib/sbi/sbi_hsm.c +++ b/lib/sbi/sbi_hsm.c @@ -33,30 +33,6 @@ struct sbi_hsm_data { atomic_t state; }; -int sbi_hsm_hart_state_to_status(int state) -{ - int ret; - - switch (state) { - case SBI_HART_STOPPED: - ret = SBI_HSM_STATE_STOPPED; - break; - case SBI_HART_STOPPING: - ret = SBI_HSM_STATE_STOP_PENDING; - break; - case SBI_HART_STARTING: - ret = SBI_HSM_STATE_START_PENDING; - break; - case SBI_HART_STARTED: - ret = SBI_HSM_STATE_STARTED; - break; - default: - ret = SBI_EINVAL; - } - - return ret; -} - static inline int __sbi_hsm_hart_get_state(u32 hartid) { struct sbi_hsm_data *hdata; @@ -64,7 +40,7 @@ static inline int __sbi_hsm_hart_get_state(u32 hartid) scratch = sbi_hartid_to_scratch(hartid); if (!scratch) - return SBI_HART_UNKNOWN; + return SBI_EINVAL; hdata = sbi_scratch_offset_ptr(scratch, hart_data_offset); return atomic_read(&hdata->state); @@ -73,14 +49,14 @@ static inline int __sbi_hsm_hart_get_state(u32 hartid) int sbi_hsm_hart_get_state(const struct sbi_domain *dom, u32 hartid) { if (!sbi_domain_is_assigned_hart(dom, hartid)) - return SBI_HART_UNKNOWN; + return SBI_EINVAL; return __sbi_hsm_hart_get_state(hartid); } static bool sbi_hsm_hart_started(const struct sbi_domain *dom, u32 hartid) { - if (sbi_hsm_hart_get_state(dom, hartid) == SBI_HART_STARTED) + if (sbi_hsm_hart_get_state(dom, hartid) == SBI_HSM_STATE_STARTED) return TRUE; else return FALSE; @@ -110,7 +86,7 @@ int sbi_hsm_hart_started_mask(const struct sbi_domain *dom, for (i = hbase; i < hend; i++) { hmask = 1UL << (i - hbase); if ((dmask & hmask) && - (__sbi_hsm_hart_get_state(i) == SBI_HART_STARTED)) + (__sbi_hsm_hart_get_state(i) == SBI_HSM_STATE_STARTED)) *out_hmask |= hmask; } @@ -123,9 +99,9 @@ void sbi_hsm_prepare_next_jump(struct sbi_scratch *scratch, u32 hartid) struct sbi_hsm_data *hdata = sbi_scratch_offset_ptr(scratch, hart_data_offset); - oldstate = atomic_cmpxchg(&hdata->state, SBI_HART_STARTING, - SBI_HART_STARTED); - if (oldstate != SBI_HART_STARTING) + oldstate = atomic_cmpxchg(&hdata->state, SBI_HSM_STATE_START_PENDING, + SBI_HSM_STATE_STARTED); + if (oldstate != SBI_HSM_STATE_START_PENDING) sbi_hart_hang(); } @@ -142,7 +118,7 @@ static void sbi_hsm_hart_wait(struct sbi_scratch *scratch, u32 hartid) csr_set(CSR_MIE, MIP_MSIP); /* Wait for hart_add call*/ - while (atomic_read(&hdata->state) != SBI_HART_STARTING) { + while (atomic_read(&hdata->state) != SBI_HSM_STATE_START_PENDING) { wfi(); }; @@ -174,7 +150,9 @@ int sbi_hsm_init(struct sbi_scratch *scratch, u32 hartid, bool cold_boot) hdata = sbi_scratch_offset_ptr(rscratch, hart_data_offset); ATOMIC_INIT(&hdata->state, - (i == hartid) ? SBI_HART_STARTING : SBI_HART_STOPPED); + (i == hartid) ? + SBI_HSM_STATE_START_PENDING : + SBI_HSM_STATE_STOPPED); } } else { sbi_hsm_hart_wait(scratch, hartid); @@ -191,9 +169,9 @@ void __noreturn sbi_hsm_exit(struct sbi_scratch *scratch) hart_data_offset); void (*jump_warmboot)(void) = (void (*)(void))scratch->warmboot_addr; - hstate = atomic_cmpxchg(&hdata->state, SBI_HART_STOPPING, - SBI_HART_STOPPED); - if (hstate != SBI_HART_STOPPING) + hstate = atomic_cmpxchg(&hdata->state, SBI_HSM_STATE_STOP_PENDING, + SBI_HSM_STATE_STOPPED); + if (hstate != SBI_HSM_STATE_STOP_PENDING) goto fail_exit; if (sbi_platform_has_hart_hotplug(plat)) { @@ -238,16 +216,16 @@ int sbi_hsm_hart_start(struct sbi_scratch *scratch, if (!rscratch) return SBI_EINVAL; hdata = sbi_scratch_offset_ptr(rscratch, hart_data_offset); - hstate = atomic_cmpxchg(&hdata->state, SBI_HART_STOPPED, - SBI_HART_STARTING); - if (hstate == SBI_HART_STARTED) + hstate = atomic_cmpxchg(&hdata->state, SBI_HSM_STATE_STOPPED, + SBI_HSM_STATE_START_PENDING); + if (hstate == SBI_HSM_STATE_STARTED) return SBI_EALREADY; /** * if a hart is already transition to start or stop, another start call * is considered as invalid request. */ - if (hstate != SBI_HART_STOPPED) + if (hstate != SBI_HSM_STATE_STOPPED) return SBI_EINVAL; init_count = sbi_init_count(hartid); @@ -276,9 +254,9 @@ int sbi_hsm_hart_stop(struct sbi_scratch *scratch, bool exitnow) if (!sbi_hsm_hart_started(sbi_domain_thishart_ptr(), hartid)) return SBI_EINVAL; - oldstate = atomic_cmpxchg(&hdata->state, SBI_HART_STARTED, - SBI_HART_STOPPING); - if (oldstate != SBI_HART_STARTED) { + oldstate = atomic_cmpxchg(&hdata->state, SBI_HSM_STATE_STARTED, + SBI_HSM_STATE_STOP_PENDING); + if (oldstate != SBI_HSM_STATE_STARTED) { sbi_printf("%s: ERR: The hart is in invalid state [%u]\n", __func__, oldstate); return SBI_EDENIED; From patchwork Sun Feb 21 08:53:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1442760 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=LwbqA5Ng; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=NOfw3him; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-sharedspace-onmicrosoft-com header.b=mifxDg3N; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DjzdC4tsGz9sVR for ; Sun, 21 Feb 2021 19:54:04 +1100 (AEDT) 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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ZL+ma//regT72HYXVxThIM44JMhNTZvxFO3wgMWYkaE=; b=LwbqA5Ng7U1Ft8XYBNPoHvnRS d7p/mEhr51kYeRj8sghGSq25HEvbwX52yByABVKYqJtx/W3heiZEY5I2ViUgDXvHSk6m09xAVo3ZE mNlwzDB6iRpIyUpdBR0jj+Eb7//NTIi2D96ioQg/D+MjtPJTMpnYyf86At016E6/6JJO5LYcbxTAg DVGAoi2BbdBdjKzk8Wcx5OrCsbpuwvZy0eSdg/ijjcpFSBJ2MWIxV5J+c7CMMJo08THmQDbqDww1+ dtO80SrdNsgfYzf7uKaNJolyZg8UxahOg5QJcfZi3BUNtkO5i3vIxgFv1J9JHrpZ+19aLe9YwKLt1 +NCdcAuSg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lDkV0-0003W0-KX; Sun, 21 Feb 2021 08:53:54 +0000 Received: from esa5.hgst.iphmx.com ([216.71.153.144]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lDkUx-0003UH-9t for opensbi@lists.infradead.org; Sun, 21 Feb 2021 08:53:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1613897631; x=1645433631; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=Keraw41uxEi59K1et17/wi0RwVxWkEjdYqpGqWcDJ/A=; b=NOfw3him9pMs4PV2Jrk/gltm6ihI4AzQlf4pzzXlRNUxwVZaJKVy6oRu GgrEvj6y6PjcXQx+D2wbeOLZOFVkOnEv9icGgawVArhtt4h7buOAnxpgz U4ZQcx0XmKIds7+JyKxXm5GGRq1eoMoEDtVtj71rBm70d4VTrgw1nwH7L CU6RqtUKvRrYXHmeeBVQWF6qdkEmgXhNle/VCvZSZ0qzIkwecml73v/Ia EXhctpjd16DKLG1cGnBcQvbXm6ub/GX9Irs0nJjQjZbfYVgHjyfqG12Sj zxP0XB62Mj595GzwJyzsBOM+InhM/1pim4kSRiMy2zbd0RtuCi73pVZhT w==; IronPort-SDR: aGDQnZa5RTsEerKQmmAcA7JNsSOoDGPK9cOWL0kphxb2f4Oh/KKQWLc6my04nuhG4KIvn91Liu I56kch7QylsD1cRY4Gb9OJjATIlm5ysb8dpOMys40gOLi2qv0g/2adZmKIF8qT8YC3oM0Qi+pP hkaY4xUXHd25vRyDqmwE7eSu/xQwuYb4wtGcsGaA2HCp1K2cL3OfeMXFQQt2+SNi4YIodqnrcj s8TEu9shJkDeeepNwMHJuSDAkUFjqO1i5znFiqtoAYudjMxGdulgsycfRhQ5SyacCyN4Fy+Wmy /KI= X-IronPort-AV: E=Sophos;i="5.81,194,1610380800"; d="scan'208";a="160446553" Received: from mail-bn7nam10lp2104.outbound.protection.outlook.com (HELO NAM10-BN7-obe.outbound.protection.outlook.com) ([104.47.70.104]) by ob1.hgst.iphmx.com with ESMTP; 21 Feb 2021 16:53:50 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KtbwdVMGPcvyS0G3BBM7DcQTX1RJxrVmaArd3PKw5hZZyX5exyMwWCMJBI5siBw38LCExhthZJXsyW3eo9jT2ugqraDyDsx6yuaddXkse6DdWrmElY/Jyj/Dclz5rcNdrBnZY6pImTCuLCmK5b7iIi6szUn5rNWFDv4AzcCJejzk+9JTvTIKKSv+gNBwqwW+OgeslnG6ZO+elEhmkroNUMrLsSAd/3D/G1uWoubFXBBcDWV5feB11AxG/RhmJtYthie0WEpcdQSg0YypkEaO7PhJk/ai6lp0a09A+EuAgLDJthYlIXbdJVITNNgz4FJ8xD51pnNI+NNvbosm+BbwGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2d2PSsruY+1msGxgb8YnUd8yyG0paxjJ8qQ9hBl2s1I=; b=ZnVMh93++o+7TNkjUcsDK3FsqznSw61WlrJal50e+6IiX4fCEJjTbiYPaTcDfWxmmCF9c7k4RdAxhKBhszPse3SyjWyTl5mwN3e0lGsJcfPREfKzmo2BidGGXetnClleOmXPIelrzNdLizmAmOWaFoLJn4EIhk939q7f57Mc8yPBxF6EplJoKVbLL41ZPVXukfbtCyCon6j9Er50K/X1PD6D4V1VZ8RWJvOP1J2IZwsrFX2cUUA9HE/zT7mLPifvoSnlIFPk/+z/n96NewsJ3kZ6Rnp7AAdu+BemCki9QZ6YHY4gvQeXhw4w6df4S0SoaPeAg3lMoU/Bwr/iSbbT/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wdc.com; dmarc=pass action=none header.from=wdc.com; dkim=pass header.d=wdc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector2-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2d2PSsruY+1msGxgb8YnUd8yyG0paxjJ8qQ9hBl2s1I=; b=mifxDg3N6AtwHji7P2a+DTtRrMkdGMXCE+NxvSv4bXlV+V6YamQ56OmKSbavbmLis9nOZBKiEe8NEm+nvhLYPhQzY9Sv/v2mftJoizCk7XFxWZLTksEuzvAPIQxFqHuMtX9QDMTxzQjaERLBePuPZWx4tzaHw1ed05IdbXQSoHI= Authentication-Results: wdc.com; dkim=none (message not signed) header.d=none;wdc.com; dmarc=none action=none header.from=wdc.com; Received: from DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) by DM6PR04MB4123.namprd04.prod.outlook.com (2603:10b6:5:98::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.30; Sun, 21 Feb 2021 08:53:49 +0000 Received: from DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::38c0:cc46:192b:1868]) by DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::38c0:cc46:192b:1868%7]) with mapi id 15.20.3868.029; Sun, 21 Feb 2021 08:53:49 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Subject: [RFC PATCH 03/10] lib: sbi: Rename sbi_hsm_hart_started_mask() function Date: Sun, 21 Feb 2021 14:23:14 +0530 Message-Id: <20210221085321.180602-4-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210221085321.180602-1-anup.patel@wdc.com> References: <20210221085321.180602-1-anup.patel@wdc.com> X-Originating-IP: [122.171.171.12] X-ClientProxiedBy: MA1PR01CA0104.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::20) To DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from wdc.com (122.171.171.12) by MA1PR01CA0104.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Sun, 21 Feb 2021 08:53:47 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: dc15e976-2239-4b45-afea-08d8d64634da X-MS-TrafficTypeDiagnostic: DM6PR04MB4123: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GfJtE7DZN2PMBV5aDej6vQhNCK7lwhN+NfufgSkuxES8T9zrOchCiRYbqnGqxGl2nH8SAqNOt6cK9siGSJGPGBFTdfdJ8u9a0+KImq5sE7GHvQSc26judphhG06rDGLIhsGPnviruD4kEYHNpk9WERBzqh4Xq0Y1Pbea5praBFWAAGENh3Nmw/j0xdEgX9iHf09ZDPn1C1C7SR/eGbGnnlbcFeOq/3dVngbzObijRZ2Pq4lfw8Fo8Aiwgssye+9TPpot/wXKL4xg9gCr5hQoUYFMBQP/A3GTP4i5vdhsjl4M1hbYs2Nq06joZ88pYfLtAvC/uDhWQ/11+TprHdGS8B6b1JZxbFqK0gnbkKaoVPvyCQ10bjKVDVsOfoLzOEORCB4YjY3b+e0/MqPm0OM4Vr8OwtqRSkL7QfFa+Qh+neSJ+8/9mxV7efCDqkVzJmFoCEIIUwodSxkhVduHO+LTOwmcNh6MAYUO0wIM1jW29VanWFJ4ph+vc3dLvz7KDacKn5rhjvZ3AUtWzDc50SscMA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR04MB6201.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(376002)(366004)(396003)(136003)(346002)(7696005)(2616005)(5660300002)(4326008)(16526019)(186003)(478600001)(36756003)(8936002)(52116002)(2906002)(26005)(54906003)(110136005)(86362001)(55016002)(66556008)(8886007)(44832011)(66946007)(6666004)(6636002)(956004)(1076003)(66476007)(8676002)(83380400001)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: +iYDSN5vmA6sJvySN+6xo47tUKkTYH+C/GlvvuvXca7qkooG1i1zUKH5mttsyU0qdMNP4oNjLoEvmG0XeYGi9lM/NaViVgH0QAxoJ9khCJVUHn+8F3Nhkr4PkxNYMhAD0moqEl5EUakDew8kecGqsNl8yavNqedO82lC1heS0wQ8h3HJdn0oLvlKZuqPHmWX/zO4jYiIBoTxpzcv3D5NrhVFGkYrx+7fVeJXvQPlVkybcuQFGdEA9vWg4uYv3BEJd4AsxK95lWplDDxVttrgjiLrVCS96/o2uaMk4CdCYsX6Pl/foNpFDDvFnIL9uGXTf3JXVTefu1cg7ACAOAH6HcqS1HDsSKr8SmT9OMdDn89ZXWMe7E+9fkPtYytzkKNnVbZk0dGHfMPnyk6u8tgvnL9TA3cY7F2f4su2P8X+Ch2Ie26wUudJBjRZmmmAms8e8lQe+iRUVBEGPGuv2HP9tRH5KA8SXJr2MYb8KbUWPOLQdAXIZCM3gzZRLtb7k9vP3DEh7rxFbORsDTHZDGau8WJ5EmzXaqrWrBLblG7uy6Ydkrq3ccG/kcyjoVw4ixBzQJzzROiwvAOu7DI0tT806AqHeEdAfKoN0sYdpgvFDY8/+RIv7xds5XPalJA2ERFEYV5NyEIDsyAoeXAu/zCEpXlwO8QK5FVRSpozp+eZ9ZzjwpvM4mJTCei4HHaNpd4fawPzsB4u+5MDdfaMM0TqMCvogeXNHg1xQpNUN95M2fqpnZtuemLN8MY8XCpLOMG8F04ZQCBX5c4KWuwZyRiLr5t6mu0HQdt0TJ6Dt9o3NHwc8rOv2H8djIzQ0x+lZNIF2Vrq5VC/3HVZ3QSxFEC3XfEG/aztq9hXqgZKkYz5VMh5G7uCLpzE/O3/39NrMdBrkb/yS5RKfwa5Pn7fEJBtXa9U5lr5k6vCoBe9NCL3vaKLQ/Ap27Wkf5nc432u6OsWHNgNy0K7LbkpsorhKFDk6oS6AR0MpMHGHOHl6xtOwCd5jkJwR8KjaLSEYzwxcslnZHaQiKPBfYdzwUEqNhs2xs2tWmwEDHWs0H97hPjlyICHTrHdYhSMeO6IyP2lFV3ryjMenB8qA/9c0HvGCu4AgNfEXL9fc7DWC+9WpobEagdR51TnXFImV7WIOidA4jO2sC/I+XnWJQSd5aNK3pj55wZUs34j/5TFHCS1hk3ThodkH2t6A3Puwhudey1S9DPpSw35JJn8wWV3i6lsPnGog+Dn9cXk+3Xot0xA2km3DqX0lvXkxvHI4Ddm3SH0957h6nZo+Xrz2Icd0N85fPCgzxakhQFENnKvbC/mTd05RDevK1hT2oPvACzREzQOdo+m X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: dc15e976-2239-4b45-afea-08d8d64634da X-MS-Exchange-CrossTenant-AuthSource: DM6PR04MB6201.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2021 08:53:49.7485 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rhIjyqZzKU6kM68UN5atMKZPndDj7x8WJxDyVsTDT80YvwCLLAkNlaPLJPnthh+NhOhCj/6Yf7t8m3oGJHnpKg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB4123 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210221_035351_555964_F86B1926 X-CRM114-Status: GOOD ( 15.30 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [216.71.153.144 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 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 -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.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , Anup Patel , opensbi@lists.infradead.org Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org A hart can take interrupt in the new HSM states introduced by the SBI HSM suspend function (such as SUSPENDED state) so we rename sbi_hsm_hart_started_mask() to something more generic such as sbi_hsm_hart_interruptible_mask(). Signed-off-by: Anup Patel Reviewed-by: Atish Patra --- include/sbi/sbi_hsm.h | 4 ++-- lib/sbi/sbi_ecall_legacy.c | 4 ++-- lib/sbi/sbi_hsm.c | 4 ++-- lib/sbi/sbi_ipi.c | 4 ++-- lib/sbi/sbi_system.c | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/sbi/sbi_hsm.h b/include/sbi/sbi_hsm.h index 69ddee7..4250515 100644 --- a/include/sbi/sbi_hsm.h +++ b/include/sbi/sbi_hsm.h @@ -23,8 +23,8 @@ int sbi_hsm_hart_start(struct sbi_scratch *scratch, u32 hartid, ulong saddr, ulong smode, ulong priv); int sbi_hsm_hart_stop(struct sbi_scratch *scratch, bool exitnow); int sbi_hsm_hart_get_state(const struct sbi_domain *dom, u32 hartid); -int sbi_hsm_hart_started_mask(const struct sbi_domain *dom, - ulong hbase, ulong *out_hmask); +int sbi_hsm_hart_interruptible_mask(const struct sbi_domain *dom, + ulong hbase, ulong *out_hmask); void sbi_hsm_prepare_next_jump(struct sbi_scratch *scratch, u32 hartid); #endif diff --git a/lib/sbi/sbi_ecall_legacy.c b/lib/sbi/sbi_ecall_legacy.c index 1a7fe26..e20de76 100644 --- a/lib/sbi/sbi_ecall_legacy.c +++ b/lib/sbi/sbi_ecall_legacy.c @@ -34,8 +34,8 @@ static int sbi_load_hart_mask_unpriv(ulong *pmask, ulong *hmask, if (uptrap->cause) return SBI_ETRAP; } else { - sbi_hsm_hart_started_mask(sbi_domain_thishart_ptr(), - 0, &mask); + sbi_hsm_hart_interruptible_mask(sbi_domain_thishart_ptr(), + 0, &mask); } *hmask = mask; diff --git a/lib/sbi/sbi_hsm.c b/lib/sbi/sbi_hsm.c index 1f54c9d..a81b821 100644 --- a/lib/sbi/sbi_hsm.c +++ b/lib/sbi/sbi_hsm.c @@ -70,8 +70,8 @@ static bool sbi_hsm_hart_started(const struct sbi_domain *dom, u32 hartid) * @return 0 on success and SBI_Exxx (< 0) on failure * Note: the output HART mask will be set to zero on failure as well. */ -int sbi_hsm_hart_started_mask(const struct sbi_domain *dom, - ulong hbase, ulong *out_hmask) +int sbi_hsm_hart_interruptible_mask(const struct sbi_domain *dom, + ulong hbase, ulong *out_hmask) { ulong i, hmask, dmask; ulong hend = sbi_scratch_last_hartid() + 1; diff --git a/lib/sbi/sbi_ipi.c b/lib/sbi/sbi_ipi.c index 4347832..a3a6ce6 100644 --- a/lib/sbi/sbi_ipi.c +++ b/lib/sbi/sbi_ipi.c @@ -82,7 +82,7 @@ int sbi_ipi_send_many(ulong hmask, ulong hbase, u32 event, void *data) struct sbi_scratch *scratch = sbi_scratch_thishart_ptr(); if (hbase != -1UL) { - rc = sbi_hsm_hart_started_mask(dom, hbase, &m); + rc = sbi_hsm_hart_interruptible_mask(dom, hbase, &m); if (rc) return rc; m &= hmask; @@ -94,7 +94,7 @@ int sbi_ipi_send_many(ulong hmask, ulong hbase, u32 event, void *data) } } else { hbase = 0; - while (!sbi_hsm_hart_started_mask(dom, hbase, &m)) { + while (!sbi_hsm_hart_interruptible_mask(dom, hbase, &m)) { /* Send IPIs */ for (i = hbase; m; i++, m >>= 1) { if (m & 1UL) diff --git a/lib/sbi/sbi_system.c b/lib/sbi/sbi_system.c index 08a8b47..10915b4 100644 --- a/lib/sbi/sbi_system.c +++ b/lib/sbi/sbi_system.c @@ -35,7 +35,7 @@ void __noreturn sbi_system_reset(u32 reset_type, u32 reset_reason) struct sbi_scratch *scratch = sbi_scratch_thishart_ptr(); /* Send HALT IPI to every hart other than the current hart */ - while (!sbi_hsm_hart_started_mask(dom, hbase, &hmask)) { + while (!sbi_hsm_hart_interruptible_mask(dom, hbase, &hmask)) { if (hbase <= cur_hartid) hmask &= ~(1UL << (cur_hartid - hbase)); if (hmask) From patchwork Sun Feb 21 08:53:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1442756 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=Fvc4GLX+; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=CLeiXOiB; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-sharedspace-onmicrosoft-com header.b=H2KlXnMr; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DjzdC5dXVz9sVS for ; Sun, 21 Feb 2021 19:54:05 +1100 (AEDT) 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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=GhP8qoEHHEcOFSTCtzB0HCoj0iPhlMIBvDwTYtEMVR4=; b=Fvc4GLX+fwk4jbUI/dyXep0KM Mq32tjZJwfErL37V4ttiqAXmYsFf9JR2Cqi1iKkey3Szl8HnaUTP4a46Ti9u5alYJ3KK6dXCtE8Jb 2U+/If1h84GBXnaHDI3RB8tHLkTMRYogj+Xts2n2PuPYHbvRV2wB+kBrxyG6qFqjJ4A4Dylko3ac5 5EeYxn/WYzJzdB+TBuaq8gE9Oj3ZUbaxzdDUSGw5/IubsPlJFnJvqLB2gRV/m5gRSpbntvvZKRc07 dVdFvFCtmghUn5crEr+lC7fq25yBuMc6Z/69vr071xVAzGNl6HpII5uojC3vnqWnA3vDLDTstAW9j 4tZ+q0x2w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lDkV3-0003Wy-5L; Sun, 21 Feb 2021 08:53:57 +0000 Received: from esa5.hgst.iphmx.com ([216.71.153.144]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lDkV0-0003Vk-3F for opensbi@lists.infradead.org; Sun, 21 Feb 2021 08:53:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1613897634; x=1645433634; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=cKNlf2G+Jm8Y5IaeCSvCUZQGMD6HoVh22e2WsVInO+0=; b=CLeiXOiB0b8glTQSWneRwnTg6WXuqawGRytJ/Wc1N2BvRd4/T86iuLNN kJ7V2wNj5YA2x/5ho8J3dZphqgAT3f6LO0F8c3UfiUs+HJGIzY7JoOltZ tOUwNVGKUGtRky4hCg5o6qknQOY1KfUqCbr5O20AC5BIMso+RnYxAkEO3 anjsak1qbisk2MXZ1OsgFCmUIQr1962oyLIg4NS+2Ns0zkLsrGCpeOvd9 DhZB0WEbZQUCVcKhMjARQas+5ZNhR6C4NYH92x+zHTCqAqN7m946nK5b3 z6uIfOfqY/hEV/3SX8Hsja1GfLSZmW4avAuTvD/OGqkpiTwwQ2mRccut3 A==; IronPort-SDR: HguIlEwFz4wayIpoeGCIXgj0fCPHMUZXb/ZeUrHZT3YgztdotTB8iXqLWnHxO7nUxPuTkn9yOp Y2HUc2UY+U3Q8ewdMtCnBMt6HrKjlVOZWcfeW4qDM+1ChkXEdUrfXPcV2QVpUKUIpRx6ulX9G9 NgRp0Li7a0MaJZcDru4YHY+WyfSOCfzZw1a/uzt46WDhKFuwfa6bWtXPKD/dEboA06G4MX6H+X PqzscUtgekCMdsMSEIf+BKpI/BhEvoGqPloMGorRDBd74u5psDCkNEvQ29KPZR/PZ1KxCuiuDx 0Ho= X-IronPort-AV: E=Sophos;i="5.81,194,1610380800"; d="scan'208";a="160446557" Received: from mail-bn7nam10lp2100.outbound.protection.outlook.com (HELO NAM10-BN7-obe.outbound.protection.outlook.com) ([104.47.70.100]) by ob1.hgst.iphmx.com with ESMTP; 21 Feb 2021 16:53:53 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h4pidNIDcghNTBNGl9qHq5f0yUP22SkLL54scznX+rUgFb+zEnVFv1VvQre2TEtJhSAOWZATvu1iokF36BO1PeMnueJQjHptXRoZfb5il8JDaeMJSKXjS6aKQORFnv+MsRyyvE6q5kTOAJGxYf9q4TKyj1GpqVakcqF82CtBke9vuZPNPhIgvYlFuAhriF6iTpiNGactxUx0bK2VXP7+Ry3NrEWEnA/vq4/uPocgJLNaI1FaaMw+kfHpuD4at6PSLVN3HIZqH1Qw36M9jUndUpqb6KL4jkfcQbem+G0Lln2UgTGUU2p4muB6qnfQuEO6vjtG9ld5RlK8JzTrxclRtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=J3aW4hAGBmmvbAn94WEZXEvZ6zAiqNSAXaUq88RaEiM=; b=f5svQoAyDNco2c8GUlqtrDLyOGuIP8f9SOEdZpflSiQ12ZeuSNWntW8f7LDeyt8x1uvgErfgU+zdlUu5v1qe72AaVH2OzUKuC0UCntEuYahoNy04srLY9GxkBsovHIdyyry64qrzZ9lJNm+wQnRk25ekJ/AsPahpTv1RzF24bpYGvKcfHwPiojpm0kvWhjp+KN/yjKkE1MfD6yFTNkKLUzdzO5Xj+v8uVAVpesxZhLC+dMwqKWU/KRwnkL9pFu/WienoXq6kaC/JfnyMkydHuyH8Fu1HVdM8pZr9yf1gZTqXc+MWJSP9DdxGttUgNKRhxI/O3OX83/qBKRPG/g0LEQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wdc.com; dmarc=pass action=none header.from=wdc.com; dkim=pass header.d=wdc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector2-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=J3aW4hAGBmmvbAn94WEZXEvZ6zAiqNSAXaUq88RaEiM=; b=H2KlXnMrJ+s+D+ypg85/tPaFV/Hg6Ru7vlNkvZmcCI1ja0LuNLDp6Vcy83HA0rlV1C3KVzXXJojC5gUn2H6Ft5w5TRmRmUB+W9gycTSFj2gezzNLjWbTN2Yny20o+IE9IBIkCzqr1igcShQlSbNG159peRqZslrpPltW25+7Hzw= Authentication-Results: wdc.com; dkim=none (message not signed) header.d=none;wdc.com; dmarc=none action=none header.from=wdc.com; Received: from DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) by DM6PR04MB4123.namprd04.prod.outlook.com (2603:10b6:5:98::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.30; Sun, 21 Feb 2021 08:53:52 +0000 Received: from DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::38c0:cc46:192b:1868]) by DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::38c0:cc46:192b:1868%7]) with mapi id 15.20.3868.029; Sun, 21 Feb 2021 08:53:52 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Subject: [RFC PATCH 04/10] lib: sbi: Remove redundant sbi_hsm_hart_started() function Date: Sun, 21 Feb 2021 14:23:15 +0530 Message-Id: <20210221085321.180602-5-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210221085321.180602-1-anup.patel@wdc.com> References: <20210221085321.180602-1-anup.patel@wdc.com> X-Originating-IP: [122.171.171.12] X-ClientProxiedBy: MA1PR01CA0104.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::20) To DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from wdc.com (122.171.171.12) by MA1PR01CA0104.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Sun, 21 Feb 2021 08:53:50 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 49956108-ed74-47c4-067e-08d8d646363a X-MS-TrafficTypeDiagnostic: DM6PR04MB4123: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:1388; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: b/1smkWR4sYlOIT3fwP32Vmf2eMB43Z+FBUaemweW447IYwrYsNUiCWONTaqX7/m9xnsVze9kaKRa+ZKYfd7QA2/oM/WOxP4yTSEqfhC5caX5AK+YS93+ccjBVGKjMutkPs9i0HqVef94tC9XeiRKKAx+CLSpWGAN29KvewzMS/o38FPFGmXtYPUf/O/RxNY9pvc4zEhs1bpMkifRMgC5fPtpwVGNLqeC8Gi+Jk6BlqHPgPRLHJpk9q7Lr7u8DL0Ozos0tqSf8itbx/Ch3P0yvZhMtuWiKtwJm7nIJZpFGEGWs/1ALDCYW9Y2c5GltCX6lgWCJmE0ttPC+MIzZpHOkgymqjESCef9egchi6y7bvmm1DmNnVNHLS2AcUxPZGpR6XcTZqxi/6OuBVQmVypRfxFAFI7QH7T1WUfZQ671hp0+mpjRDbQqs0lj8I5gvhiZvFtHWv64PuL2OiGm/SA4AqChS04xjLufPkgVvG4O0a5TMffKLox3ExB4bE6Usk3HdjnpeG9sz7wcU01V5krzA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR04MB6201.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(376002)(366004)(396003)(136003)(346002)(7696005)(2616005)(5660300002)(4326008)(16526019)(186003)(478600001)(36756003)(8936002)(52116002)(2906002)(26005)(54906003)(110136005)(86362001)(55016002)(66556008)(8886007)(44832011)(66946007)(6666004)(6636002)(956004)(1076003)(66476007)(8676002)(83380400001)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: upSJzUXsVWrrqsbavV7LbOBDcv2ScrtkcNxIciBqBmmR+RQj6C686iOgzINMUpMWkhfhrmZJcN6iF6y+VrWW/3CbrSOh0DK71RM/QZhyj0TYcNb1zrIV35AJ7b5JSOKwKIx5KZfIeVOUSMZUkUHIZNgGvBwL5b9wygyBWGc0RbMA6AnQG8OQH4fegQIFgGajVB9dV/wVxdHUDAQWLgZ7ZTKHa+/jrOTrafQ4puLGUzx7YNt2rMXMJ3aAydaJCWY9aSc0A4e50ho/C5eGkLB4fEdZo5Qhe4H0QCPJR9k630v5Q+9s831DxjIz9fTrC3J57wdxhwByQMkYV/be3gUNU4q7RZB4YHI0B8pflfdYc4AK5tTIcVYMX68GCEG6PVPsaqmjO2T+l3l3yQ3THofRpW0IDxrjDXvT1FmxrFAVc7iYIkdJoWFqg27DB1sgE4WXJDSJfVvQGcDz/qoWdJhMHGzsAQvjaLG+8oFWTqWsURoXsgDra2QUBU5pyqCCx4icbyt+5WEj6hVJmnGJ3hdpkXPWrplKIZBYRiWwutDfejjHPAyxqDyg6U7dipvEQJnAJlgQgmsSotZfm3RQ/SB3ssjgLHgyBV1HTtrAbBN3zNO7+7bl/3ou/2pScdoyBvHy/ySGU/8YNVDtHfQVWNd0uimQQjGroa1kqMPdIBa+wb5kBIF7QIKESJtu6bOcRqEBdfRdepdtgKcM24j8uGwEUz0EtvboERR2eUzm2xhb8+Ek9Bff7Mhb2DlRNx6w3shbDHJqMTSmWMDxSGiwOhLrST1GO/Zqq5kOtkEPNcdgTE+cL5jEpr/K9ITGHeFbg/uZxMi94XsW1OsZhLKG5OTXmnV2GIxcB/79mt0i2RSA/B4F63365ocI2FVGtaE8KrDPLqrdX5D99M/WOFpvvRw/ooPzf0y2DQ/w4Txbc7i5tC20rJR968mQI7YiHJLYIu3Jw9Bu8anur/uiQDJyLJjNftTya4H0V4o4+VgWyRPwfIRtu8Gzr1BV5r2vBulDy8F/evat9LNvCYqJNd/zsYem4pTUo0vlT4ijsGX5+uru0QnPS5oBEFJrdSm2svZvO0MMvDosKFAOhYY/x30T2uF7BoQYhfOrPGE/yhLpphg8IiTCddQw+wC3wnRZlsmtOlxfuCA39oM5VDPT0eS7dVTtBrC9/kzuP4If1NxBsSEZpwmDEO/5LW7jQroYBPr4DYM08BJZkkLgV9CwE6maa55oxIOTdD0OQIH4qfbjkLRdFtmJ+xo2ogOd+ykNCVXa2pMvDQK2Qidf4/AykPlYxxyGkcQho0MI+z1IRNXkCtnh2s/KbQYuRg8Scz5K+C2bJ70w X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 49956108-ed74-47c4-067e-08d8d646363a X-MS-Exchange-CrossTenant-AuthSource: DM6PR04MB6201.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2021 08:53:52.1390 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: IUef3qX7qL962lYunsBMLjvSz9IIbGiQiTbXGVZTMD18vGkyeIT6rujsbAvrLRkdR/SF/lDyQiV8rvf2MIrqXQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB4123 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210221_035354_370942_F5BDBB5E X-CRM114-Status: GOOD ( 14.40 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [216.71.153.144 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 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 -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.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , Anup Patel , opensbi@lists.infradead.org Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The sbi_hsm_hart_started() function is only used by sbi_hsm_hart_stop() for checking state of calling HART and current domain assignment. The atomic_cmpxchg() called by sbi_hsm_hart_stop() will check state of calling hart anyway and domain assignment can be checked by other domain function such as sbi_domain_is_assigned_hart(). This means sbi_hsm_hart_started() is redundant and can be removed. Signed-off-by: Anup Patel --- lib/sbi/sbi_hsm.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/sbi/sbi_hsm.c b/lib/sbi/sbi_hsm.c index a81b821..732c400 100644 --- a/lib/sbi/sbi_hsm.c +++ b/lib/sbi/sbi_hsm.c @@ -54,14 +54,6 @@ int sbi_hsm_hart_get_state(const struct sbi_domain *dom, u32 hartid) return __sbi_hsm_hart_get_state(hartid); } -static bool sbi_hsm_hart_started(const struct sbi_domain *dom, u32 hartid) -{ - if (sbi_hsm_hart_get_state(dom, hartid) == SBI_HSM_STATE_STARTED) - return TRUE; - else - return FALSE; -} - /** * Get ulong HART mask for given HART base ID * @param dom the domain to be used for output HART mask @@ -248,10 +240,11 @@ int sbi_hsm_hart_stop(struct sbi_scratch *scratch, bool exitnow) { int oldstate; u32 hartid = current_hartid(); + const struct sbi_domain *dom = sbi_domain_thishart_ptr(); struct sbi_hsm_data *hdata = sbi_scratch_offset_ptr(scratch, hart_data_offset); - if (!sbi_hsm_hart_started(sbi_domain_thishart_ptr(), hartid)) + if (dom && !sbi_domain_is_assigned_hart(dom, hartid)) return SBI_EINVAL; oldstate = atomic_cmpxchg(&hdata->state, SBI_HSM_STATE_STARTED, From patchwork Sun Feb 21 08:53:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1442759 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=Qsp+7Csc; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=ersUcUX5; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-sharedspace-onmicrosoft-com header.b=gcV62rFv; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DjzdB3Ytxz9sS8 for ; Sun, 21 Feb 2021 19:54:04 +1100 (AEDT) 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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=hShwxL5mEREnMvUdw6Zlzx9BF6dpF0SHyqxuFQ2FGcY=; b=Qsp+7CscXzP3CFqZ05Bb+hk/O gKOCUVK/zwl0R/aSMyzPqeb01GVgIcHH63w9rbAAStlh7wtqaTYcenPI8XqYBhVlo3rXUkcJHzsW6 hIyAb5hSTbyEBuIMKcZu8DgcqSFakol3Wznd1cIo5lTWAko8RjO7heYybrmAF3lXP5hvJCpdHSOiT ATGjm2Cj8k43tqHp03sgsngmbwXxoJc+3FTUH/iOV8Yv7M1rfkqotFjkFmWbIhQ44e+J6Gk58PAIG Jicu9BXCbPh9rgEfBO5Sh8RgRi2DW9Y9RX+bIE86p64mOj/vtYHMbGtwmfW4ldXwpZx82kOImM4U2 +b4vncHJA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lDkV5-0003Y3-TO; Sun, 21 Feb 2021 08:53:59 +0000 Received: from esa5.hgst.iphmx.com ([216.71.153.144]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lDkV2-0003Vk-JY for opensbi@lists.infradead.org; Sun, 21 Feb 2021 08:53:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1613897636; x=1645433636; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=kDIJyH4cXAIVtuYMux+AGj47CY1iSsWYpibPj3+GMoc=; b=ersUcUX51AfNV7YsHU0QBF0Y1POPed/ez9/Am6JDslJ1X/COs/WWP4CK qfYlKumvfLzBlJFKlqAjQMIVSaKmrkOSmMkdkYSJb1aF73/69YcOxo9Z7 sorRjbO0UeTeJKh1qJ2ZbXwO6nY2fD3nMh/HLu7MLlCObuRQuuxrIs8Jq zjaWc+C6EtYAXWa4JuxzPkpAkJjmfX1PaIcRMGW9+FvlKhA27meaAqEd1 G3kf268Sqz+cMXI67TB4TxP69pJSI1ndc/YMKL8BbYLpipeT/wW+R/p7t 03d2u3abqtLm+qqnQRh2b8Tw12yx/bL8/4EsibGZ/N2WAHsifFOWmLrqo g==; IronPort-SDR: elCyWWSF2FIjeNuc7MxfXr2CI/JQU51KXYM6QvxChrylRYsSI37eHdVqAkwYYKip9NTqz+vAm/ kGwlOKLzExSvGN9p/ykSyRsY8AyH6t6jsP9sx83efholD1rlyx7nyt3RSBsCyltOqtYSFOTztc eO27ox7SLQFLT1X7VWMpyYi1irr7GJoQWdi5KG0KfTSNNhTIGSUKAm/x2lN3OB4J4/28sZanc6 Y4PxIaDGDUrx4iM5L7yK+hLSh2mFppZl8NWUN/zT7cdjruqrm0wHBfGzeudBiVOJzbdD6Yu88U fSg= X-IronPort-AV: E=Sophos;i="5.81,194,1610380800"; d="scan'208";a="160446562" Received: from mail-bn7nam10lp2109.outbound.protection.outlook.com (HELO NAM10-BN7-obe.outbound.protection.outlook.com) ([104.47.70.109]) by ob1.hgst.iphmx.com with ESMTP; 21 Feb 2021 16:53:55 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JP9XmjF1ivfFwuNCrA+MEdpFNrSeL0qcpO7rG4bVWzhdRdFVZSNQ3MMqJPKRzaUp/X0s6or2Xm51pT9rD4Z3D6hta3k4sgK1n7tCA9YkM0+na3mcnTX+RUtfIg6K6/m6JDTyMqYT2Tc0Mdm/IT+Rq2eZvcUqbynGhbz5uuMh24tzYFnToNBSDV6ZeXzRpu9chqyUTWSgdZoidNUktUT8X7R84G2RiZbZ7HHi4pcN2N/hFIY8IXnTJXMf0KUtu5PW+Fts8l0GplyCkjxuYLo6aVGDLgWgPFloo7uIB4HAHC1I2Wo0oKvqW6ZbcDtJg/atBNpMxAkZ17MQq0WcdUVxcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Wyna8UMS6gOYxOExKKCsPAKsX9mklNojJYtLKmXMD/k=; b=bI4VXM/63WLatdSjvuMHPyHsZOJwN6lgjgwNaKTKKrIJxnFj7m8G3bTTzmWOso6ytZBZxvrnoR1zmLUmnKXfapJLTMn2Dbwwfkjxh/yTX37fyJ1nCdPuzNjjvzTAOe03Df8Hb/T7nlV1gPGtVA3N9I6PVDwt5kc9Kh3ocMF3ePjYAgUGyyxR4UI6Rfy39Upp0y6eW5MZrHAIHADPzOYFBT+hFDqAmZfcvo7yJqKo73VytbLApkqWqFp/xKrSvm+FagzXIeK8BVALohYimufULTC/4eWQ8ILhhvz7wmpTnuOgkQu18knrsEs0xHRorH08BaTUhScwKFG1d1eHd0Y0Wg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wdc.com; dmarc=pass action=none header.from=wdc.com; dkim=pass header.d=wdc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector2-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Wyna8UMS6gOYxOExKKCsPAKsX9mklNojJYtLKmXMD/k=; b=gcV62rFv3UxXEm+rCQ2G1DkoE1b3aEfhhB84sG9r7daRIcrdapRpby2PucuCwVIb/6N7hlz6dLc5A/In0RWyzran9a7u0+kiZc9auo4Kyqm3Anlj8V+mC1O1+pYg22EbL0FkZF5ppUllPRQXhpBmR/d+1ptBGuf1ly/NlVFasx4= Authentication-Results: wdc.com; dkim=none (message not signed) header.d=none;wdc.com; dmarc=none action=none header.from=wdc.com; Received: from DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) by DM6PR04MB4123.namprd04.prod.outlook.com (2603:10b6:5:98::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.30; Sun, 21 Feb 2021 08:53:54 +0000 Received: from DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::38c0:cc46:192b:1868]) by DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::38c0:cc46:192b:1868%7]) with mapi id 15.20.3868.029; Sun, 21 Feb 2021 08:53:54 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Subject: [RFC PATCH 05/10] include: sbi: Add HSM suspend related defines Date: Sun, 21 Feb 2021 14:23:16 +0530 Message-Id: <20210221085321.180602-6-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210221085321.180602-1-anup.patel@wdc.com> References: <20210221085321.180602-1-anup.patel@wdc.com> X-Originating-IP: [122.171.171.12] X-ClientProxiedBy: MA1PR01CA0104.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::20) To DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from wdc.com (122.171.171.12) by MA1PR01CA0104.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Sun, 21 Feb 2021 08:53:52 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c213317b-1baa-45f1-4ed1-08d8d64637a8 X-MS-TrafficTypeDiagnostic: DM6PR04MB4123: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:372; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n+6QSErIq4hq4Y+Cip2ICnBDBzwl01HAngm1X4ZWRj/TJ73H7jEP/++SUh3OKFR+ciEkVWDAUd/zIfvEusTv0nivtBSTjBaWmM1dexSNC9xVlEnkX/X/9K1RK69ha3u5gWrhntR1mRckTjTtHYFLk6FYxtoy8vL61dvv7PJ77gKRvE2JszuWNxjD1vRVnX/Vma7rcdDIXnWBLlX2QjjQRCIKyTqHEg8PlDuX9mOdPlzc9j/21r41xGaLXXcCSEVd7KQJH64gdHfXLFmaFWvV5OFiMd66/LPVneh6pYKLO/OgiW5kuiqeTmVcGlArdTZSbsiJQdyphGXw2ByvKqyrhSfDyO2ucxOcrybdDpSPJrXv5JcZcHJ3n8A8ufd3yAHGl/9F90poNLNNoYFHjC8kNgzJdBs92by/YNGjHHY9ib6zCFbeyoM2e6RIanMgIYq2wM46Qc4eHFgkLQONFJt2y0TFBzQUZ6VGcUumVTaB3FLRqKswcibTkf2aqA1rfNVFddoLkMWh983gJjAdNQ6gIA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR04MB6201.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(376002)(366004)(396003)(136003)(346002)(7696005)(2616005)(5660300002)(4326008)(16526019)(186003)(478600001)(36756003)(8936002)(52116002)(2906002)(26005)(15650500001)(54906003)(110136005)(86362001)(55016002)(66556008)(8886007)(44832011)(66946007)(6666004)(6636002)(956004)(1076003)(66476007)(8676002)(83380400001)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: +zsslTGROYpvCYrE6U2myVSawSrcImize/TpKDgjTA0Jp/Bo6KzGOX4swqPZq2+xS9bUb0JCJ43xu5/z2U54mivR2owAiuxOLOWKhTSTkqLs06Z83+FZTyaY/xK1/XjvFFKsjbW0sDb5ljQxfDt9lBaqQL0gxfm7YKxtisIl1aMWlcdb+FUIW/CQUTLuKU3oWpFrHXDUOgB0uvthRZEaWFg7f2LFOE4Dtu8BqORh8ygCec8VazJS1jM6CxOrANDHiC3CYn9MJ1Ijv4gl4ajD2EJXIj/yw/uBh+/imh2AHlpjxCq1bB736RlSXt+MfBwHQaktcaVniVdOVF9VNGH7sGv+wP4fWWlEJn+h071MnhpYow5pDJGqaQ7/KFhyvtrRv1BMgeTV+4UJPtcRMe/6ttXXAfyaDHjOzYkVpPZ/aRi62lOl2FDwCVw+pcLjgaM3raneGeVx4HDOUUptTd6sTAWQMJGfmuE1ahW+zIOqRrIwAj5mV2aIkhfhvw/MFTjBJZjzUvaVpCyJCDTF0FSQ/+n7Bhd8PCtbLPoNeoYC41dmpCRIkHe2U1KCwvDmCLERxid93oojirzhL/IK2vafc3yySHwGVfz3y+zwuTZOWZIAP67FOg0gcaJtZ3U9GOxZTrmhDOkpTFqMOR1dvBcTRI1UADWW2oqWI+xJhY6IEwwvngrC/spZ5v0/2R9YxrOuAaLoClYeqTCQkRO0+B6Oko6VRdMe5+vnFzzhF/UONJzF3/dXCTBPPU8vDJjjGCXh4A0+DIPS+i16CRUGXfUZM2rwWRXgyVAr92XczxyvPBxGgirXDeAIH0R4lGM7c4k7ygRL9058/8zixm1eTWVFCDI24dexEtUlZ/5wJrwg1IMzdSyHn1UpzNIR7OAN6Nswf7fVJVs8wjiru1CANiVL9rk8JI+OR1mrEysNhCNE2Jkpe50WB28SDLA+iyJw1pfQjMPKzGw2dOybN/2RK4+EmWPaPlaHFkU6FbkOpe0sQshbhelEA6UOY9kDYjajxs17ngz9kg3uLoPfo3EBrRE1OUxMdz7DycMHVJ++86b8SH8gmEPW8FxJpX+XxTqwt4YQrWSIsIFQbQqEfMapSPOo0pNaJp3azE45LhPmPumVZyvjCZfIjTXplCEpz6dsPkY9MBu249wsNWruLYRAHwkAThUzHjC1x1JgOE251KrFpdgCe+JkJiXyzHtaTpidfl3pjH/U2hm69C/2xWCtxwgRxQtDe1rrrfvaE4+8CeG0L9RHhq3lu9oEurkG6Nv971IIKH6EE4lS7JuvCd0CB9Sak9aeHit4LsoO0Lwlujgy5wyMFAXw2E0YMfBpIhqh7Uy7 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: c213317b-1baa-45f1-4ed1-08d8d64637a8 X-MS-Exchange-CrossTenant-AuthSource: DM6PR04MB6201.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2021 08:53:54.6544 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: nkqE9hqbx3DcBG1wtUqLZLfNjkbr4vmIo3y7B9t/lCIN4REZVTwmUUntegq1/gc/zaXQldeoO1rJUd00dueF4Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB4123 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210221_035356_905064_09E1F344 X-CRM114-Status: GOOD ( 11.87 ) X-Spam-Score: 0.6 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [216.71.153.144 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 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 -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.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay 0.8 UPPERCASE_50_75 message body is 50-75% uppercase X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , Anup Patel , opensbi@lists.infradead.org Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This patch adds SBI HSM suspend related defines to ecall interface header. Signed-off-by: Anup Patel --- include/sbi/sbi_ecall_interface.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/sbi/sbi_ecall_interface.h b/include/sbi/sbi_ecall_interface.h index b272213..7fcb373 100644 --- a/include/sbi/sbi_ecall_interface.h +++ b/include/sbi/sbi_ecall_interface.h @@ -57,11 +57,28 @@ #define SBI_EXT_HSM_HART_START 0x0 #define SBI_EXT_HSM_HART_STOP 0x1 #define SBI_EXT_HSM_HART_GET_STATUS 0x2 +#define SBI_EXT_HSM_HART_SUSPEND 0x3 #define SBI_HSM_STATE_STARTED 0x0 #define SBI_HSM_STATE_STOPPED 0x1 #define SBI_HSM_STATE_START_PENDING 0x2 #define SBI_HSM_STATE_STOP_PENDING 0x3 +#define SBI_HSM_STATE_SUSPENDED 0x4 +#define SBI_HSM_STATE_SUSPEND_PENDING 0x5 +#define SBI_HSM_STATE_RESUME_PENDING 0x6 + +#define SBI_HSM_SUSP_BASE_MASK 0x7fffffff +#define SBI_HSM_SUSP_NON_RET_BIT 0x80000000 +#define SBI_HSM_SUSP_PLAT_BASE 0x10000000 + +#define SBI_HSM_SUSPEND_RET_DEFAULT 0x00000000 +#define SBI_HSM_SUSPEND_RET_PLATFORM SBI_HSM_SUSP_PLAT_BASE +#define SBI_HSM_SUSPEND_RET_LAST SBI_HSM_SUSP_BASE_MASK +#define SBI_HSM_SUSPEND_NON_RET_DEFAULT SBI_HSM_SUSP_NON_RET_BIT +#define SBI_HSM_SUSPEND_NON_RET_PLATFORM (SBI_HSM_SUSP_NON_RET_BIT | \ + SBI_HSM_SUSP_PLAT_BASE) +#define SBI_HSM_SUSPEND_NON_RET_LAST (SBI_HSM_SUSP_NON_RET_BIT | \ + SBI_HSM_SUSP_BASE_MASK) /* SBI function IDs for SRST extension */ #define SBI_EXT_SRST_RESET 0x0 From patchwork Sun Feb 21 08:53:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1442755 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=1LEFQdj7; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=cf9aonDg; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-sharedspace-onmicrosoft-com header.b=AnD+p/BC; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DjzdB5ykmz9sSC for ; Sun, 21 Feb 2021 19:54:06 +1100 (AEDT) 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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=WZwVORVqIVfT2VVUXm5G3eNkhLtGX7XHhXyLrUBLs1E=; b=1LEFQdj7v9ll/HzgaDfl0AADi UfqExom2a1eZh/Hno6fWmo4qKy+qBFFVmSfDG0mXmyQK1ZOk8yb3guCqYtvdUffF5zjz8ZAdQL9Dk Llq3C/dAUpoT6MgoNS7Rm+NGI8jIIsL9WO8in4BPzt1DskcYOnV0bD76QAU52ZbnTKSTjY/ZSsmeE LtLWbAJVLvE0s8eRWiAPKTIWlVi+/D/6y7FG3mvT8JnAQjtuR2pLTWFmzo8oOuNxv+ODISBP5fJRb ydCdxJBbxH05NnBPemIrEi9pnAhXrBEjHBcIusecjY+J++rKCLKYweSC3naelFWP2ppxUzlAKMATQ UaVESsIOw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lDkV7-0003Ys-EV; Sun, 21 Feb 2021 08:54:01 +0000 Received: from esa5.hgst.iphmx.com ([216.71.153.144]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lDkV4-0003Vk-Ik for opensbi@lists.infradead.org; Sun, 21 Feb 2021 08:53:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1613897638; x=1645433638; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=MmZPiowsVdwgDU1+Zr+no9wbDm/JyB9yNx5OqMaTOwk=; b=cf9aonDgsLNU8IuD7KtxeFhISm9hEnSyp01Fp5KgFb8JeMxMaxU4HvC3 Q91jo6rC2kSFe7WFiP4DieHFNXpH7Qgpf1wZXJ2YoLs0rRLjJWOk//0c3 DcdOxx1iyojK4y/KKi8t16A9iXqETSmwAy+pCEpLtO0q2/Ed3QQj8RwRQ O7Ye6J21ArNXMI8IdLeS2H5ubOgHd87dxx15jcvtm4ZGjOK2ebXi08rAS Eo3WuDahj/JJSZr3SzTzuHxCwE1C43mqitSbmPIJjZFYSBxTlJMONIR1/ /oY2oIUojHQ4ZN73CNOe6+AEGMGfSboyEQOUW1yslIerUjfomTsDp+1ue w==; IronPort-SDR: My3KkfS3c8OgF054bboAJGEA3M1q172esVrsiOP/sJdsVk9fJwshaCmZ5qrnOhujr4DartdRPU srh1wj12JkMpif84Uw9o0yHb1uTeJTSmE8zRMCmJg+BXe5YZn/+bIXXznBRoV3+2Nb754MNPhk LI7EK2UjzBkLk7cxFU1r0lYBp7FTtskRKrKCBDOIJ5as0xTdBfXJMnHVvAu2p/r5bnSBlWLld1 bLjxS4lWON8uH+p89NxpLR1/3z6J1hcx585ACHtVPFNad4PoJCQHxf+mDkZGpxj6mbbw2QHLkn l5w= X-IronPort-AV: E=Sophos;i="5.81,194,1610380800"; d="scan'208";a="160446565" Received: from mail-bn7nam10lp2107.outbound.protection.outlook.com (HELO NAM10-BN7-obe.outbound.protection.outlook.com) ([104.47.70.107]) by ob1.hgst.iphmx.com with ESMTP; 21 Feb 2021 16:53:57 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lZjtz/9nzRZSUA29RybEXzgPKiFQ2iXHsnIkrqIE4mvvTZGKQ2HeRjwcH40qYIi3axRVf8Q68DDVz/6zwkmGAu+2MIPT+j3r9XYijXG7dYJJcisQbCLJE9Gx7kMBGliYDladnys+MmfRe3/WLTCzde158blGj/xcC+JxhCz9fZ1udjtB3ZjZh+ds50z3vXS/7J9rVTeGem66RiHHLMNlZEmRBvPTVB7jWKMEK73gmwfnjm2LY3PTjBkutINuA0CEcwqMHLC9QCn+/mSXDvauu5cw8VAQG2zqi0S4ROaL2RMwxI1T5WTmU6x6yrQsdq2w0T9y3Lo/sVNT6ukDcLanTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fM6xCuaOgD/qqrhtOP9V4V/BRQ7dOaz0eUI/RdETZFw=; b=oF1zgPWGWMCmKLmFoIrZ3R+cgZ4LgzENNuT6kmEcKMOdljNoGzo2ZrC0hJ0SoUyS7BPei7LBXubHh7EgI/+S+MwK7azx4N9ERYVpmOJthQJiZ2ncHazVaA9tM3JtSSnmBMcHMl8S+KpT+THEKS983O9narI+gC8vfD/WwckWhx1na9lgEnrzu9Jd0DTyNmaeEH2ObqoAq/uRv8mYwPxRFnXmwWbyIVSxgNrHqwGeDEJzkeM3GlhfY4du4Dh2Tf0gK2RgBJ77ufJTJwUdjPw56zm80Tov6Z/HkITTGDxiRFvJZgHOBlaxzwtgp1q5reNCF7duBiJDFq4qS3CfP2a49w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wdc.com; dmarc=pass action=none header.from=wdc.com; dkim=pass header.d=wdc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector2-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fM6xCuaOgD/qqrhtOP9V4V/BRQ7dOaz0eUI/RdETZFw=; b=AnD+p/BCJwE/mEBOM1u9xNoyPoq4pdIbDDXhyzCEA7C+h/vLThAlsFhX7U/hFOcreu2mZJphIESXT55bKwNt9euHFbGLKVsb/BPaMtepa9V6LGPhQnnpYBMxrfIrh7+1RHmjIV8qVFpMLZ4CHRsNShGWebDWALFtjyIQw8//meg= Authentication-Results: wdc.com; dkim=none (message not signed) header.d=none;wdc.com; dmarc=none action=none header.from=wdc.com; Received: from DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) by DM6PR04MB4123.namprd04.prod.outlook.com (2603:10b6:5:98::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.30; Sun, 21 Feb 2021 08:53:57 +0000 Received: from DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::38c0:cc46:192b:1868]) by DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::38c0:cc46:192b:1868%7]) with mapi id 15.20.3868.029; Sun, 21 Feb 2021 08:53:57 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Subject: [RFC PATCH 06/10] lib: sbi: Add sbi_hart_reinit() function Date: Sun, 21 Feb 2021 14:23:17 +0530 Message-Id: <20210221085321.180602-7-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210221085321.180602-1-anup.patel@wdc.com> References: <20210221085321.180602-1-anup.patel@wdc.com> X-Originating-IP: [122.171.171.12] X-ClientProxiedBy: MA1PR01CA0104.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::20) To DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from wdc.com (122.171.171.12) by MA1PR01CA0104.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Sun, 21 Feb 2021 08:53:55 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 3383df4a-a39b-4c17-d6d8-08d8d6463925 X-MS-TrafficTypeDiagnostic: DM6PR04MB4123: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:1728; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: K+n5Lql7VgIHh8tLrYG4QKKPspPFcD1kJ91Wm0ItGBuezakLGJsbPtkTZAR1yerGC9Wsg9J9S7k0HyBir/RKP2mwPuN7VK9Q47u4sP5bId8Hk2/8JtdyMVkrF4e8RBpPLxwl1b+ApDg1Z5NBjr1jTDolmm1NomsNTzoWgo0xMMPPEeQlJM7sfWozv8fzzJDbcTqVlhIZGD3tuDnzlmX2hMV0azwqr2R5H33nX1+0l4nAqkskzc4jvrvBDQgvkBnJqCH0gVqyvrBUFyJGW6EEkzoq6zErUVKfChXpdET+Fnu4FNCo1ZV3CDyiC2bYf2QZgH819E1s0bznIGL8nNEeVb+2Vjtp6MSz5y93YLGDbFw31XK46/vLdUTzkyypSpCeI0SbdzlqWcsbNqrQZn/9lVDqMRfSNyn3Sh4N6YenR2oJxMyognl2L7JKjyg+l3zjL6CQHUkBwa7wLuj9VKjq8ZVh/nGSWzGZ+yq1Pdygr7opEoiicy54siB+cZZP8lhqn7hsYQoP+gM4sgvUu/j3cA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR04MB6201.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(376002)(366004)(396003)(136003)(346002)(7696005)(2616005)(5660300002)(4326008)(16526019)(186003)(478600001)(36756003)(8936002)(52116002)(2906002)(26005)(54906003)(110136005)(86362001)(55016002)(66556008)(8886007)(44832011)(66946007)(6666004)(6636002)(956004)(1076003)(66476007)(8676002)(83380400001)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: IQSK4wGdiCagwGyv/UFIXMRpFUuc3/8PeRjoBaEXs5XDb+N3vRQNrDKC1YeJCwX0PkR7iscw4BcROz8XUv3/Hx6YhbIrwo7e1VZxpOUEaWMW3vOaDprDDXceaThoWs+Nzcl7VM6rXLyzHfiLnQQhppWaWXDK0ZIiosgmHI/CjmOxsQOML23KvxjE4DHDKRWCRzcXvGKvFmEoVE3nCGYpZCmzihuwtX0aKB7Ay6An9jZPqcwUiVEpVxZINEfpCEvUPBAViiUiHz35EYlGb8aMQdIXp767GQH5gCEE+SEjII3jKjv8Zwg5v9i/Iy1JLLjJIcz7vk4qUoKqGQ20s6AHR5juxVbz9SBrryiOa1HG1bRx+Io9DKMoOgfUhimvFLiuAhascJAzNz0KVPuO1YA9iTG3HqP9G7Ks9Qn6PE58iQVV0BP0BzA9ARt/XvGPUmH4+/YzQrIH3brGhVXFM+VSd273yFNmV3Rhmj864SzdmNsHfOu6JJsabLEDW8bkYc11q3JgYqW9ozpx7AhlQ1scJC91RISkfK8BZ3SAlki+7ut6933iMaMFEabT4pJ8f2PuM3b5u/wan+DRp/qIXhJ+LC2gipS/K5IwGd+4pcYXpuud7To9TDNZ2O6n4bXM7XVOO8a8w9LLV+tKIrCRkxkfYaFuEQr4p9q5g5Lxyp/9kw4IpMzuPr5iK83MfJ8vkhlPrS0P9ufmYlFBGZEZwZ5F2/Ry+OLHFBmiGsCl66wVps50QID2vVxGqN9rEV7uFoYVl9RN4jIcMsOjNWrlxaYAL0hpzHLiDC4Bm7Rtna918U5gUq7jBEbEwLJZoxBR7VftUQ62VVRjcZvUh05lHn5oVnYdh+8THBcwYLKDSML99JGX5vhCyeI9Yq3Ja1h7QAzQmb6G4n9/x93ErkLgfyZ9d92fDtpnGEvWeoNnbWSQHBKr1e3gHalCyOtc8obCR4mJulwAxI7CUYauWO8doMl5XwdovO5Fi8nvOi0QB/+ckAPpyHBPMOW6p0dSYJQj7CaZLkQaQyxPpFSOQ7YOUG47rss3BBnVepXlozE19D4fxkq/0woFBlT6LTIgUovCcLCLGlO3deWcwPcbg4nYSeGnk65QeACQwQ9Kk525WOecTxTASFnNrm+cNvGtnlmoK8NKgivoLkuCx+NPYMr9PDHJ0MdfBUZf/+uZeNppgf/1pDw8aFfNo72PdqM2CX0nvZW0Yz30JoGfRLUOUYaUwsyLm4UYIOBrE1RXPUAYi2HAx8Q0RhRo0iekfGzdPcced9/AjpbzWL+qP8gz9Tc51YAyow7keFklJUNpoSdKRsvenfuaWhQMZEGu6suL2RlPap2f X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3383df4a-a39b-4c17-d6d8-08d8d6463925 X-MS-Exchange-CrossTenant-AuthSource: DM6PR04MB6201.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2021 08:53:57.0129 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Wbo/ypFth+feRUtKBuUTs6m74x3tMMSrMM5zA30YSznfJSHlsSBlOMD4mM/kBgEnz+ishT3AYb5vDqODmbUvdw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB4123 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210221_035358_920843_1A90608A X-CRM114-Status: GOOD ( 15.48 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [216.71.153.144 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 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 -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.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , Anup Patel , opensbi@lists.infradead.org Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org We add sbi_hart_reinit() function which will re-initialize HART CSRs assuming HART features are already detected. This new function will be useful in re-initializing HART after it resumes from HSM SUSPENDED state. Signed-off-by: Anup Patel Reviewed-by: Atish Patra --- include/sbi/sbi_hart.h | 1 + lib/sbi/sbi_hart.c | 29 +++++++++++++++++------------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/include/sbi/sbi_hart.h b/include/sbi/sbi_hart.h index ec9e30f..031c7b0 100644 --- a/include/sbi/sbi_hart.h +++ b/include/sbi/sbi_hart.h @@ -27,6 +27,7 @@ enum sbi_hart_features { struct sbi_scratch; +int sbi_hart_reinit(struct sbi_scratch *scratch); int sbi_hart_init(struct sbi_scratch *scratch, bool cold_boot); extern void (*sbi_hart_expected_trap)(void); diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c index fc86e9f..d91b08c 100644 --- a/lib/sbi/sbi_hart.c +++ b/lib/sbi/sbi_hart.c @@ -430,10 +430,25 @@ __mhpm_skip: hfeatures->features |= SBI_HART_HAS_TIME; } -int sbi_hart_init(struct sbi_scratch *scratch, bool cold_boot) +int sbi_hart_reinit(struct sbi_scratch *scratch) { int rc; + mstatus_init(scratch); + + rc = fp_init(scratch); + if (rc) + return rc; + + rc = delegate_traps(scratch); + if (rc) + return rc; + + return 0; +} + +int sbi_hart_init(struct sbi_scratch *scratch, bool cold_boot) +{ if (cold_boot) { if (misa_extension('H')) sbi_hart_expected_trap = &__sbi_expected_trap_hext; @@ -447,17 +462,7 @@ int sbi_hart_init(struct sbi_scratch *scratch, bool cold_boot) hart_detect_features(scratch); - mstatus_init(scratch); - - rc = fp_init(scratch); - if (rc) - return rc; - - rc = delegate_traps(scratch); - if (rc) - return rc; - - return 0; + return sbi_hart_reinit(scratch); } void __attribute__((noreturn)) sbi_hart_hang(void) From patchwork Sun Feb 21 08:53:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1442758 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=km4egOZy; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=ibfMFq1L; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-sharedspace-onmicrosoft-com header.b=GDIpAsX4; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DjzdG02lZz9sVs for ; Sun, 21 Feb 2021 19:54:09 +1100 (AEDT) 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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=23ezebr6aaovQROCoFPGv1GZSlkk8YZV/+dyF3HHk/o=; b=km4egOZyqVIoTmmcwxql1OXQP mBE8v7JOAa2UTZloEpkB3lWAY3i5j7XDzUb+wEsTUILdjuldF9hDVFDgcRv/fy1qyKlGjsvge/6c6 0v/OyQ5FzKpCHo8s0z76u7jxSwhY4g3KjfKT9SMewkPVnlO6IuYCFiq5xLcKgNAfuM++yvHLJRoLV 5R6oNJXhzqiYv9uuI+ycwN1Xag2842dGoiopd32F5dW/SjlR3dvNi5bnu1KLtfVo26Dt/J5K5pZa4 z3I4qqihA8hZukULoq/iMACCdL0RcF0KnmUppbbEp4xq84SrRkB39QGFuWl4srplh9VOIIdvCwq/k lj0HQWReg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lDkVA-0003b5-9i; Sun, 21 Feb 2021 08:54:04 +0000 Received: from esa5.hgst.iphmx.com ([216.71.153.144]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lDkV7-0003Vk-14 for opensbi@lists.infradead.org; Sun, 21 Feb 2021 08:54:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1613897641; x=1645433641; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=vhUV944ARpecL5ppblMT1Ianz/XQoTCg4d/hF9LnnpY=; b=ibfMFq1LXW5zgSavKpXv69LS/fc/58VC4OlH2Ju8K/n/EyzoUgq88cPX erWyF9OVlf3GF2UoYE7queKV8NMhZOGmYhNMTWOTACf0AsTiv5H5BzTbx 86fth4RxxDly4hpJNv8DWxMWtcd9uGXEocdnm5YDZiuBBRWaOzmSy2rYB v3vHwmlGMjv3zIwVl8JOCy+2zPmxdAAZTwA6ktTB2IC0/LawG5bNDJ49r PYvsDFXSZzWxImd53PX3I/wkm+ka+LOMOuzUbumzdy08VJYk/TmVXgPJP jg2rZ75d5QE0oCyWTqw6/fX13+6D+1m9J0ed0dHumf/Y3CmMojyxrRsn6 g==; IronPort-SDR: y8SvYoSXs78xLQWh5qDogHIrAGoV/paTLSp7Ifw+2hAUR0H5GHehz6KMmcXIxtgB+w0y+aN6// uFdutEZSoCplHXWUM+ipW6KMLrkrdH3npzQtwLl2H6GBYoEPz7EBJ1jzfxsygl5FMXD1XMFawR 1uTSBTdL1FtV1rA9867YXECPfbk6nxWNXa4lSsftlhfUAdk6KmkMEcEuskHSt+sBQxcLzvjdY8 a3TB0ndR2V9nfURnXBcu57fL2VVQn4ENHn7kUUF9pYUe9QPpYpA7pPs3ZJpJpb+oRNpw8b/zlW 3dE= X-IronPort-AV: E=Sophos;i="5.81,194,1610380800"; d="scan'208";a="160446568" Received: from mail-bn7nam10lp2107.outbound.protection.outlook.com (HELO NAM10-BN7-obe.outbound.protection.outlook.com) ([104.47.70.107]) by ob1.hgst.iphmx.com with ESMTP; 21 Feb 2021 16:54:00 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CyXDjq8ePqVIZl7YusXbJ53owk7BNvsGE2EvRXBUHyfIQryxAMe0dw2np1wLEn3rDY6VCP2vZoBfN5GXX5f/sX+t6XdW0r3PDBnr2Ca1hfutRlk4LYD3mjRbP4X4lhFgkgYWQ2fHC8HeWhOU4SlTfxW7n9NkFTp5e2ZpjuyjrtbtKXPGi5yDNKHNnsivJL80jqp+lK/9989oQlocNoIa64zgyin2wpncfW7JYdhWb/orYBTRSgCyKP3ERlDYqQ0n7OKRZZh2+eZEWKtgo8TfFR2sVIIjizjM8zigyXfR+QkEjUsWq0260UPLDHRYK6LPB6ShVZGlLM7rWE5JnrjKUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8FopMlIndJneFssx4SnTaNiUFW/xXc7dg01x0NrU+cs=; b=C2GBK5jynnwZFZ9AYpeHHY4LmWtrUCa9L+syzhrB94Uyv6/s/YsPtKYFyzWlvKnhldjoJvNJh1lx8oMbb0c11CXBRx6p6AmuoE7nZY4tlC0qQDuz/OYa28i+GqVtjaO1aBNz/XJy4OWsEqh5Ppo7bjHgTRBjtmzqhr4aHYeOf0Bx574oUegeFnFhYog/VCtMDi6cyHD2UE5zUJE5vn/MVW//BwBw4wgBXXgK42NHwnNJVgCb+xXkPKo+BwS5YVDAIEePzTRSGSAyPzR8K3ZfKG1Y1qF50sO39PyBxrMpJXZv9wh8azejiuqMs4ZDfYgAawfrMLXKFEM/cKU2lEFrDw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wdc.com; dmarc=pass action=none header.from=wdc.com; dkim=pass header.d=wdc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector2-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8FopMlIndJneFssx4SnTaNiUFW/xXc7dg01x0NrU+cs=; b=GDIpAsX4KwG+HfwHCsEP3vr2rw0maFvcaFssWLBCcV3Hxxdxd649tjG6bQiOAtsFZYVhEWBtg/dkvQ0b0PaKSpUdyfWnNhvZSNXcJxs4+1gSkDvKiEWmM8d4HrCQqRlnqsYV77txvWFCHAzBW4kEbb6QyadXNK3sUUZQxpARl7E= Authentication-Results: wdc.com; dkim=none (message not signed) header.d=none;wdc.com; dmarc=none action=none header.from=wdc.com; Received: from DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) by DM6PR04MB4123.namprd04.prod.outlook.com (2603:10b6:5:98::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.30; Sun, 21 Feb 2021 08:53:59 +0000 Received: from DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::38c0:cc46:192b:1868]) by DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::38c0:cc46:192b:1868%7]) with mapi id 15.20.3868.029; Sun, 21 Feb 2021 08:53:59 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Subject: [RFC PATCH 07/10] include: sbi: Add hart_suspend() platform callback Date: Sun, 21 Feb 2021 14:23:18 +0530 Message-Id: <20210221085321.180602-8-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210221085321.180602-1-anup.patel@wdc.com> References: <20210221085321.180602-1-anup.patel@wdc.com> X-Originating-IP: [122.171.171.12] X-ClientProxiedBy: MA1PR01CA0104.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::20) To DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from wdc.com (122.171.171.12) by MA1PR01CA0104.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Sun, 21 Feb 2021 08:53:57 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d03a1dcc-1787-4f8b-d04a-08d8d6463a9c X-MS-TrafficTypeDiagnostic: DM6PR04MB4123: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YIYCZjI2ix66R7FISXqJo6vj1vQmNvLhduKdMDF3pfNChG1M37NPAb+wAm/Pk7OZ5Ope7VmvmhOHoQCxaCtIq4u8hHuj6LKXGC96k48kYGoHh03C+U0+6LqRXzZFfzZObDaTx5OfrhloZfxo6T4+wXySvdqCSHdMrLOafTTCvSW0TF6BP5TCLtKQ9qemWDoXBQ6arRq63PpwK6NMB2UtgOsGscAG4JLMJpUoxndv6dnqx0t9qCYjC+7tVOw3ZjkTjlT1NPMlnbTgbqk2uuSt7xOW0jcAWmQ1//GoTMSy+anqquox4WsFMv3KgJlxStXHyVCjdZfU61woCUDGvizk60Lyf9Ub+uDZphhhvkz6Q+q8kqLp+u/jaupfszjsjG0JZvNDzuD3omlPKb4lbczBAuXvaI9SIPwl07VjsyVJIHAKurcHiQahNJGjAoRpqqnDAPMzw1JIeM2uuK74W5RRbvJsD2rUewxGG2GP8V03oISrtqW/pkz/N3frtLxvUtsb5IWP9uU+Pt/Vrxb8Qin+IQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR04MB6201.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(376002)(366004)(396003)(136003)(346002)(7696005)(2616005)(5660300002)(4326008)(16526019)(186003)(478600001)(36756003)(8936002)(52116002)(2906002)(26005)(54906003)(110136005)(86362001)(55016002)(66556008)(8886007)(44832011)(66946007)(6666004)(6636002)(956004)(1076003)(66476007)(8676002)(83380400001)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: gcpJP/yj4SmAWJeRHrLnXjpxUtSWzOad2HJbosn2ZO8TAiZ9R6XH+DcA+PRMPiujdjwSolYepIVnShMkRRea0SgjCptJ99RUE9YxGBQRiEVzbEKZcXr9dtLj4ndbmG0lChs48oBwE+S0zqZ0sJDDiJfFeT30gG9SWH07VvoUaHeNfMGu291laLLV6YYO31lf82vyS6RJUT5iGXujlfoN2Pu6nlMvFxKIBtwbW1jwDJFpVP0s7uEdCNlFN9zMRHM2jtowV+3UFaHT2btGsAuZ1wh1127OjVfdFefiEOpzrMqweYCtglEtfSwIKC4hdt13X8CIuADU27LR70ounsybbLsBVEPd11agKhkZC7ndZkV8V9aktX2/2KujsWb91yqwQvtgYPJosXuecEjTdyULhmmz9r8TovDxt8stX6Em8Qey/k+JLDrsC4fyK1GTHi6iG9juwahGx9huibhsrypzRWb1Qyl0I+OAjpPu46dAKp/ULvgsabb9tSErkWFdETLVv4bZV3NixzRCJud4HEJ9rvVhaUm/w+UrygUuBy+R4JeNcOgEdbaim8/sLuHHjsq7rbsWUlUFv2+RTc4xnkAbd3inEMfMZTNQOmQ17YKDp33zN9rYXowM4OJo/ranKRjD1rTMc59227TT/rbKC+w4gmoWK+PK2lzO7AOJHop4z5ryc60qFQEVUPAB7YhS9/flRwQ1NxXh3QdO3fQrTGcGvT/3c32AdVcKgYPny04ylHJfDyZIkOycEmkZr1mSjcFIFLC5CIEtbpUycYGCxfPBRzxwqcQau0Kg8Ely6Fr/1RjvOA5B5pXGaxcm6iqUqLESj15BqtvjW/DMDi1oMx07QLtbtG6gwyl7HqeZkGEF+eyWGDM3IuIYSMw0RHaDMb9+v79s6a1bJYN33G1p+GdaadfNfu/KygpzylAHnxGzXzl2KNbcCQAFmmgcDZiZsZX3+J5PI4CWrwEDB1ylnPWFShhFxHuOWWpfOmvfmBzEXt0UGnyDJCpaqarG7S2jGGEEwW0wx+xhSdMAG/6h14CYSfX9EQ3i2iKH3h8awLowZQ2g8c0J0qH/kjfgn5X9l0SFe6Xto5X3thCWg/vw1RQjiThThKHLe7PpK8WWQGdkXkDCiV1fRED8MWbzIJAlq4dZt0nzmGN7gi5Oa0MziODCwsIJ+uOi67T0cb15C2ejVtHGpBAyWoLYcbJC0Or0rBQuByPUuZGvptG1WarhihIJiMxRb0BNT1Gw3q13AL3WFt6H520KDDt4KsQcNoZHCWiXPBtgYn1jB8BlATL0foW/5OOnAZxnloD81aa6CNCBn2iMxd8wMcpUYwWIwguBCFpR X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: d03a1dcc-1787-4f8b-d04a-08d8d6463a9c X-MS-Exchange-CrossTenant-AuthSource: DM6PR04MB6201.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2021 08:53:59.5243 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ffblNbjLhlmSfD5gwM7YmJLeBPy79mYQF4fHm6v8qiBCWDfZHhIgsZx8sVyknvl8NCDOHCbrLT2QJcAh9Sn8fA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB4123 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210221_035401_311290_2A323468 X-CRM114-Status: GOOD ( 15.14 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [216.71.153.144 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 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 -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.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , Anup Patel , opensbi@lists.infradead.org Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org We add hart_suspend() callback in platform operations which will be used by HSM implementation to enter retentive or non-retentive suspend state. Signed-off-by: Anup Patel Reviewed-by: Atish Patra --- include/sbi/sbi_platform.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/include/sbi/sbi_platform.h b/include/sbi/sbi_platform.h index cc7e3ff..ede3fb3 100644 --- a/include/sbi/sbi_platform.h +++ b/include/sbi/sbi_platform.h @@ -139,6 +139,11 @@ struct sbi_platform_operations { * return if success. */ int (*hart_stop)(void); + /** + * Put the current hart in platform specific suspend (or low-power) + * state. + */ + int (*hart_suspend)(u32 suspend_type, ulong raddr); /* Check whether reset type and reason supported by the platform */ int (*system_reset_check)(u32 reset_type, u32 reset_reason); @@ -370,6 +375,31 @@ static inline int sbi_platform_hart_stop(const struct sbi_platform *plat) return SBI_ENOTSUPP; } +/** + * Put the current hart in platform specific suspend (or low-power) state. + * + * For successful retentive suspend, the call will return 0 when the hart + * resumes normal execution. + * + * For successful non-retentive suspend, the hart will resume from specified + * resume address + * + * @param plat pointer to struct sbi_platform + * @param suspend_type the type of suspend + * @param raddr physical address where the hart can resume in M-mode after + * non-retantive suspend + * + * @return 0 if sucessful and negative error code on failure + */ +static inline int sbi_platform_hart_suspend(const struct sbi_platform *plat, + u32 suspend_type, ulong raddr) +{ + if (plat && sbi_platform_ops(plat)->hart_suspend) + return sbi_platform_ops(plat)->hart_suspend(suspend_type, + raddr); + return SBI_ENOTSUPP; +} + /** * Early initialization for current HART * From patchwork Sun Feb 21 08:53:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1442761 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=EUH8HKlh; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=RJ5sEJRd; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-sharedspace-onmicrosoft-com header.b=FGcBEHyV; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DjzdL0VYLz9sSC for ; Sun, 21 Feb 2021 19:54:13 +1100 (AEDT) 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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=WJCQS+CcUBjpY55JYgqq2vhssu0oO34PH1FEsidAdZI=; b=EUH8HKlhsZbuUlUakI6v+vpsv zmr67JGzCfyzSF/w2f1F127TLSp3Y7D/FlrTtZsKcPWq9222HAqTjfRa83vnvffPPTfBxfAyGwW1q WtfUJ29W+yi4lfjCIZ6YSQ1qP7nxk2e/s+yQsBI2/L5Lr9gey01jrOiXa3bkKPuJDNpld/9nij2oK JV+jJlefCxVt2+fLeYBfXiaGtTAUD3F6D9Eb65k6M2PN3UShcifDVb+8TzV3Sr/un2dCn/V4k0xY0 dqwtlQEcQLlYAP/1vo/Q8B7quZFflffmAie1eaAh68hcRJGX1AUDc+hdUXUGSAHnbr5d7gy1bgUhQ qwljUgbzg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lDkVE-0003dB-MV; Sun, 21 Feb 2021 08:54:08 +0000 Received: from esa5.hgst.iphmx.com ([216.71.153.144]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lDkV9-0003Vk-Md for opensbi@lists.infradead.org; Sun, 21 Feb 2021 08:54:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1613897643; x=1645433643; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=cD2Zj+BhVFfXjZKx7S6cEFyQZg6F1zRmM5vIEItdiEA=; b=RJ5sEJRdfoFjTonOmW1cC5zZLZXaAcv73xOQjaIsk5GBvKFOXbFwVjus lYSs/saKkUGBFPVmqwTYC7stYQJ18dQM0HImtjt3tB0bU0+69yc6W3X2P PSfX9tDKx4JpORjBdmLCtiOYfN83sTDaWdQabYxeTsW3nYHxlt6wZop26 KBWl89ksQBVBxztxhLT166AqDiXE7YHyhR/USTIKf3VkPMeNSWcg2EiUU Xq/FjJKQnus4kZ89o9uJ6TXVj6GEvzPijFudA1R8E+bVOlMew5PUwx/L1 chtzreNjsQd+GobBNP7M2fIQLYeaGKdinFf+yg0tYrzK5ATR7K7q5ekS1 w==; IronPort-SDR: 6iWC6op9q9uAfbRmYUm9XInVkQAlWDUKCL0vIPUEHE8R2WVmaQ0e6K4X0RI/lc5k7WiCzCRSgj /OOP6ctSpJXCHkENrRRbey5XVRcdTHVomDupgUC09VJkOsXYzWwYRJIaI3n6/Lqsb39i3sQL4U mHB8aARZaOkItjPHI78gyfFG0Ba2vezPEd/ZwU0nUm7kYACo1SGSJ2gVj1vLXxZsuewIhe/3En ScTe2pu9lxm5ur13vvu+VtchmV8325cZ3i8rymyW7cOR39RNNGOyx4tY3TnkkBHbR6MTs0hL+4 9vc= X-IronPort-AV: E=Sophos;i="5.81,194,1610380800"; d="scan'208";a="160446571" Received: from mail-bn7nam10lp2105.outbound.protection.outlook.com (HELO NAM10-BN7-obe.outbound.protection.outlook.com) ([104.47.70.105]) by ob1.hgst.iphmx.com with ESMTP; 21 Feb 2021 16:54:03 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nCg95SjGHn0hgv5pwrrt1RLPBSaC/634eWlNFyaZ4hY20f3nqtMBQFH2CnEHEzO2TSgdb83kIcmh4xrlYStoBpGCwLVFLofXqx43ieITLcc8I3vFzt2T8TgM17Dv3FouYR9LIsUPk1yqBPlHKyAcP+DD4XPeVKQS7z8gKq6eZP6ba2DpnAKI7Lnil33Pemf0AJNhnc9O8m5YoREgDHDtpzKNkE2YgJxYEePxMVLn1vQ7JUjMVjdPhkpiFyz2vF58irV9AzJTshF7zkoZshZ1MSzb5WRSTYL/rLpWi8uevWvR/pHVyIksu2kNJ9drdh0h3oLh63M2ZdyyRJgRvZt5HA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qDWOawMdi/qPbb7f4V6iwv03ApcC5l71oX3B3JM7Hp8=; b=IDxd5cUZ08BGz1fEcXKx/TEWftEnRuWw8gNwKgDs7AkgyhVoimbkcXKpzMBYRqvAewEwsTzqFj/JKiTkxzxzZ3h/81aK1kJ7T5LXau1pUuTrzvZjzwIGppUZdYhPM24Pv9K4LgW+PCj18jfSU6rapxP/SzXroQpXkH7bxo6AQcx1RDLyPbhGOlOB6NHnr4jeH8n3hDPUaJz9z+qibyFWRw2eTOLXZg3VGSS+98cQTDaADG6Q3iFu8LMY0bd3fzhhuCIaUbWjZT5wMBz027zZHr8agATRvcECWxfJ8lbV7jO1HEpdVs5QkVZjNfT27VRK6mp4nE0Ut/YxU4YaL0Vokg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wdc.com; dmarc=pass action=none header.from=wdc.com; dkim=pass header.d=wdc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector2-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qDWOawMdi/qPbb7f4V6iwv03ApcC5l71oX3B3JM7Hp8=; b=FGcBEHyVTHZGGg6I4RzAlwpWgCmol6j4kV+Q4/zhFcq3CaRe81zh1/gCf0cg2HdfXvhq5dmB9aaDxYYN9c/bcXVQdAgbPcWz7qAp+w2DI1EBORRF1iW7wF28E8tcU+tgHDE7JyrThIL4WVcUa5H8/Hc53o1R1SveQ1H2kV6DEzQ= Authentication-Results: wdc.com; dkim=none (message not signed) header.d=none;wdc.com; dmarc=none action=none header.from=wdc.com; Received: from DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) by DM6PR04MB4123.namprd04.prod.outlook.com (2603:10b6:5:98::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.30; Sun, 21 Feb 2021 08:54:02 +0000 Received: from DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::38c0:cc46:192b:1868]) by DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::38c0:cc46:192b:1868%7]) with mapi id 15.20.3868.029; Sun, 21 Feb 2021 08:54:02 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Subject: [RFC PATCH 08/10] lib: sbi: Implement SBI HSM suspend function Date: Sun, 21 Feb 2021 14:23:19 +0530 Message-Id: <20210221085321.180602-9-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210221085321.180602-1-anup.patel@wdc.com> References: <20210221085321.180602-1-anup.patel@wdc.com> X-Originating-IP: [122.171.171.12] X-ClientProxiedBy: MA1PR01CA0104.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::20) To DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from wdc.com (122.171.171.12) by MA1PR01CA0104.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Sun, 21 Feb 2021 08:53:59 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 0afa7475-0bbf-4889-7371-08d8d6463c0e X-MS-TrafficTypeDiagnostic: DM6PR04MB4123: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:669; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7Stnd83YV2l23idCuDvOYhFeffQl1hpLdObGEyp3O7C/YGpZUTg0/L1hyfV9OKKb72UOXwQujf6M6SBRChHT5tfgcF+p+xJUIOEWEx0HAqDFgCT8qmSCLFoNotLjFCv7yo6YNEqorTzFI7E3VxPrA/+huxNji80C5YI2rX4xOnc/cmdmkRZXVQAA+OV4v8Yf+env0p0BPhHgi5QwD/Cz0kZXbnBOxFgSFzZG6EyMzzg6nt0AiMyG0wAReLmiTZPUs9NSS7z9sfPk+HBUbfjUAM4CnrqaeHG9liHZiLH87qlS2SRNthMfAd6r0a/JmjO2o4a0nw9sNpBdVCzGKWlxSM9rdvCXZBQPjKeamYs52D5hY4UqrGh2l1SQTFpC8Dp+J7Fqwhf/zV4x+/Qre1YJ8hbrfXdTEVkDfDvZvtbVwkEZPRbg7pD8Sl+jC5I80OEFZ5GGP1EnvF9rtteg6/U9yDa3zHG1ZybBdc+wMsfEYDzb6QPeRtL6wpalcq4Gzc9bRf/Kzr/ENe97Vyw1VI19dA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR04MB6201.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(376002)(366004)(396003)(136003)(346002)(7696005)(2616005)(5660300002)(4326008)(16526019)(186003)(478600001)(36756003)(8936002)(52116002)(2906002)(26005)(15650500001)(54906003)(110136005)(86362001)(55016002)(66556008)(8886007)(44832011)(66946007)(6666004)(6636002)(956004)(1076003)(66476007)(8676002)(83380400001)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: +5mBaNo+gZyT0GGsAa+2kV+7nUF5GCHNcZQHWiEJAnsIc6T07+dHYNRMXGnaJFVAQZixKmf06DCbqXASGsjQ3drhyDctLtXX/ZWPjOGv+SeDHCp9zH8KktDS+QQub5hFvMGs+SgS8WLMXD0w5rasI8mK+zor2GQZ5Hgx/28U+dmEnEV4K3QOgEn2P7C9S0DMQ929GHa1MGrDcvqJ3+BR29LaB7BCAT+tOjxcjOI4cfDUp9NlJ0b0g6iAsSEtkVJ1o7IHAE18V2vJcQKsw7iWLiryRkc7m5c7s1GCH0ZC0uNEiZCzYz3lReI/68K2GSfa4SsATkCWCjkh5bKEYZtSr7L4F7EcSQr8qA880g4AG0p6iCt/C0A8pY0lMz/zUqCn/UWB5h4+pqYV/dKrbJIlJ7bwx5aIbf90PUSekbJmO9Q04vGm9CbWRcEl3bh8awtmYhDFYP1gveZJM/q39Pt5wSA8Zg5mYThrwSr5hOaNZUtBZT34Vx5fy4wYr9Dm3201hBARZepSB6LlRsm5SRLfR4GyF6aMOTq8pGGqfVB0w4MG6TnJpI3zwNxG599Fhq1oaMLToTj/16ZbSdjw8yjGVkeAyKb2yBaNd+iAOsE3saGNf9jMnKlsaA/Tazurk9H2xvpi1/5he1y9YPPFbZc8JCKiWs9KUSl0osBYR1xpecektdWORG4zhRPJ8VZp4jg5IOJcVTXzqG+u2hbEk2Gs9zclBPhg6WMHdGYR4cUrSBWvjAr6VUIWYrng/V280taUx81HgM8qVD5MWQ+uvzir6+NxOWOdvbloRVkmLnwnw4sJIZJ24G4auTSJT0mUN+1Zg6B3KnkBW/eOimO0pPIMOd5Beh5K91tIc0dwP+VuFZiV5lv5nhI3N+NvKaWlTut4DfYS8zElrSLiCstb9XYpeEln60ynoEHAJAQ9Qh6KS7DO/+X14ptUTAlJroOmW6+26/RxgIvOw/PZUKezpcz9lBnd/N+/DHFs+wFhk0obM9wntYDdKNdLJuAvR0Jest9iS9wziJVMJBIylAgiwCoKmjGZsui3USzkNoBZGRlQk6eWTH0N+ETQfkbBu9KmihBGLBrudHAslFOW3NNIqkrE8j2WxKX+vEaedqbFeOV3yhi4Dw1LPlI1pX2UdXqMVT+6LY5f71t5EuBQmy/WFPVUKj4u4LERlkqzpmJSQFSrI2CxI3pU2yvlvIMT9bEcKPk7FtvIznw3u7om1ByLJoMwoygATvlexJNl2JjRAtbth4nCip/AHegD7ZK9u5i3q7pyz5W6JMNYuQiS5+PDk+F7HuwwS3AKoDQiJRJ/PZOx22JYy5gqD3Zvbo9SoT6OVcCc X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0afa7475-0bbf-4889-7371-08d8d6463c0e X-MS-Exchange-CrossTenant-AuthSource: DM6PR04MB6201.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2021 08:54:02.0667 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 1UxExRb7/h87S4zyCJpyiI6lMJzwZCeepYF+7UJxkp0UG4s7h1kyWWCt/AQGdLV6turgSd1/n1OC1aPIsmuMeQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB4123 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210221_035404_189618_96AF96E8 X-CRM114-Status: GOOD ( 23.20 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [216.71.153.144 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 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 -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.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , Anup Patel , opensbi@lists.infradead.org Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This patch implements the SBI HSM suspend function. Using this new SBI call, the S-mode software can put calling HART in platform specific suspend (i.e. low-power) state. For a successful retentive suspend, the SBI call will return without errors upon resuming whereas for a successful non-retentive suspend, the SBI call will resume from a user provided resume address. Signed-off-by: Anup Patel --- include/sbi/sbi_hsm.h | 4 + lib/sbi/sbi_ecall_hsm.c | 6 ++ lib/sbi/sbi_hsm.c | 186 +++++++++++++++++++++++++++++++++++++++- lib/sbi/sbi_init.c | 38 +++++++- 4 files changed, 228 insertions(+), 6 deletions(-) diff --git a/include/sbi/sbi_hsm.h b/include/sbi/sbi_hsm.h index 4250515..bf0c1a5 100644 --- a/include/sbi/sbi_hsm.h +++ b/include/sbi/sbi_hsm.h @@ -22,6 +22,10 @@ int sbi_hsm_hart_start(struct sbi_scratch *scratch, const struct sbi_domain *dom, u32 hartid, ulong saddr, ulong smode, ulong priv); int sbi_hsm_hart_stop(struct sbi_scratch *scratch, bool exitnow); +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); 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); diff --git a/lib/sbi/sbi_ecall_hsm.c b/lib/sbi/sbi_ecall_hsm.c index 79a9f21..a4a0e58 100644 --- a/lib/sbi/sbi_ecall_hsm.c +++ b/lib/sbi/sbi_ecall_hsm.c @@ -40,6 +40,12 @@ static int sbi_ecall_hsm_handler(unsigned long extid, unsigned long funcid, ret = sbi_hsm_hart_get_state(sbi_domain_thishart_ptr(), regs->a0); break; + case SBI_EXT_HSM_HART_SUSPEND: + smode = csr_read(CSR_MSTATUS); + smode = (smode & MSTATUS_MPP) >> MSTATUS_MPP_SHIFT; + ret = sbi_hsm_hart_suspend(scratch, regs->a0, regs->a1, + smode, regs->a2); + break; default: ret = SBI_ENOTSUPP; }; diff --git a/lib/sbi/sbi_hsm.c b/lib/sbi/sbi_hsm.c index 732c400..b597265 100644 --- a/lib/sbi/sbi_hsm.c +++ b/lib/sbi/sbi_hsm.c @@ -31,6 +31,9 @@ static unsigned long hart_data_offset; /** Per hart specific data to manage state transition **/ struct sbi_hsm_data { atomic_t state; + unsigned long suspend_type; + unsigned long saved_mie; + unsigned long saved_mip; }; static inline int __sbi_hsm_hart_get_state(u32 hartid) @@ -65,6 +68,7 @@ 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) { + int hstate; ulong i, hmask, dmask; ulong hend = sbi_scratch_last_hartid() + 1; @@ -77,9 +81,12 @@ int sbi_hsm_hart_interruptible_mask(const struct sbi_domain *dom, dmask = sbi_domain_get_assigned_hartmask(dom, hbase); for (i = hbase; i < hend; i++) { hmask = 1UL << (i - hbase); - if ((dmask & hmask) && - (__sbi_hsm_hart_get_state(i) == SBI_HSM_STATE_STARTED)) - *out_hmask |= hmask; + if (dmask & hmask) { + hstate = __sbi_hsm_hart_get_state(i); + if (hstate == SBI_HSM_STATE_STARTED || + hstate == SBI_HSM_STATE_SUSPENDED) + *out_hmask |= hmask; + } } return 0; @@ -260,3 +267,176 @@ int sbi_hsm_hart_stop(struct sbi_scratch *scratch, bool exitnow) return 0; } + +static int __sbi_hsm_suspend_ret_default(struct sbi_scratch *scratch) +{ + /* Wait for interrupt */ + wfi(); + + return 0; +} + +static void __sbi_hsm_suspend_non_ret_save(struct sbi_scratch *scratch) +{ + struct sbi_hsm_data *hdata = sbi_scratch_offset_ptr(scratch, + hart_data_offset); + + /* + * We will be resuming in warm-boot path so the MIE and MIP CSRs + * will be back to initial state. It is possible that HART has + * configured timer event before going to suspend state so we + * should save MIE and MIP CSRs and restore it after resuming. + * + * Further, the M-mode bits in MIP CSR are read-only and set by + * external devices (such as interrupt controller) wherease all + * VS-mode bits in MIP are read-only alias of bits in HVIP CSR. + * + * This means we should only save/restore S-mode bits of MIP CSR + * such as MIP.SSIP and MIP.STIP. + */ + + hdata->saved_mie = csr_read(CSR_MIE); + hdata->saved_mip = csr_read(CSR_MIP) & (MIP_SSIP | MIP_STIP); +} + +static void __sbi_hsm_suspend_non_ret_restore(struct sbi_scratch *scratch) +{ + struct sbi_hsm_data *hdata = sbi_scratch_offset_ptr(scratch, + hart_data_offset); + + csr_write(CSR_MIE, hdata->saved_mie); + csr_write(CSR_MIP, (hdata->saved_mip & (MIP_SSIP | MIP_STIP))); +} + +static int __sbi_hsm_suspend_non_ret_default(struct sbi_scratch *scratch, + ulong raddr) +{ + void (*jump_warmboot)(void) = (void (*)(void))scratch->warmboot_addr; + + /* + * Save some of the M-mode CSRs which should be restored after + * resuming from suspend state + */ + __sbi_hsm_suspend_non_ret_save(scratch); + + /* Wait for interrupt */ + wfi(); + + /* + * Directly jump to warm reboot to simulate resume from a + * non-retentive suspend. + */ + jump_warmboot(); + + return 0; +} + +void sbi_hsm_hart_resume_start(struct sbi_scratch *scratch) +{ + int oldstate; + struct sbi_hsm_data *hdata = sbi_scratch_offset_ptr(scratch, + hart_data_offset); + + /* If current HART was SUSPENDED then set RESUME_PENDING state */ + oldstate = atomic_cmpxchg(&hdata->state, SBI_HSM_STATE_SUSPENDED, + SBI_HSM_STATE_RESUME_PENDING); + if (oldstate != SBI_HSM_STATE_SUSPENDED) + sbi_hart_hang(); +} + +void sbi_hsm_hart_resume_finish(struct sbi_scratch *scratch) +{ + u32 oldstate; + struct sbi_hsm_data *hdata = sbi_scratch_offset_ptr(scratch, + hart_data_offset); + + /* If current HART was RESUME_PENDING then set STARTED state */ + oldstate = atomic_cmpxchg(&hdata->state, SBI_HSM_STATE_RESUME_PENDING, + SBI_HSM_STATE_STARTED); + if (oldstate != SBI_HSM_STATE_RESUME_PENDING) + sbi_hart_hang(); + + /* + * Restore some of the M-mode CSRs which we are re-configured by + * the warm-boot sequence. + */ + __sbi_hsm_suspend_non_ret_restore(scratch); +} + +int sbi_hsm_hart_suspend(struct sbi_scratch *scratch, u32 suspend_type, + ulong raddr, ulong rmode, ulong priv) +{ + int oldstate, ret; + u32 hartid = current_hartid(); + const struct sbi_domain *dom = sbi_domain_thishart_ptr(); + const struct sbi_platform *plat = sbi_platform_ptr(scratch); + struct sbi_hsm_data *hdata = sbi_scratch_offset_ptr(scratch, + hart_data_offset); + + /* For now, we only allow suspend from S-mode or U-mode. */ + if (dom && !sbi_domain_is_assigned_hart(dom, hartid)) + return SBI_EINVAL; + + /* Sanity check on suspend type */ + if (SBI_HSM_SUSPEND_RET_DEFAULT < suspend_type && + suspend_type < SBI_HSM_SUSPEND_RET_PLATFORM) + return SBI_EINVAL; + if (SBI_HSM_SUSPEND_NON_RET_DEFAULT < suspend_type && + suspend_type < SBI_HSM_SUSPEND_NON_RET_PLATFORM) + return SBI_EINVAL; + + /* Additional sanity check for non-retentive suspend */ + if (suspend_type & SBI_HSM_SUSP_NON_RET_BIT) { + if (rmode != PRV_S && rmode != PRV_U) + return SBI_EINVAL; + if (dom && !sbi_domain_check_addr(dom, raddr, rmode, + SBI_DOMAIN_EXECUTE)) + return SBI_EINVALID_ADDR; + } + + /* Save the resume address and resume mode */ + scratch->next_arg1 = priv; + scratch->next_addr = raddr; + scratch->next_mode = rmode; + + /* Directly move from STARTED to SUSPENDED state */ + oldstate = atomic_cmpxchg(&hdata->state, SBI_HSM_STATE_STARTED, + SBI_HSM_STATE_SUSPENDED); + if (oldstate != SBI_HSM_STATE_STARTED) { + sbi_printf("%s: ERR: The hart is in invalid state [%u]\n", + __func__, oldstate); + ret = SBI_EDENIED; + goto fail_restore_state; + } + + /* Save the suspend type */ + hdata->suspend_type = suspend_type; + + /* Try platform specific suspend */ + ret = sbi_platform_hart_suspend(plat, suspend_type, + scratch->warmboot_addr); + if (ret == SBI_ENOTSUPP) { + /* Try generic implementation of default suspend types */ + if (suspend_type == SBI_HSM_SUSPEND_RET_DEFAULT) { + ret = __sbi_hsm_suspend_ret_default(scratch); + } else if (suspend_type == SBI_HSM_SUSPEND_NON_RET_DEFAULT) { + ret = __sbi_hsm_suspend_non_ret_default(scratch, + scratch->warmboot_addr); + } + } + +fail_restore_state: + /* + * We might have successfully resumed from retentive suspend + * or suspend failed. In both cases, we retore state of hart. + */ + oldstate = atomic_cmpxchg(&hdata->state, SBI_HSM_STATE_SUSPENDED, + SBI_HSM_STATE_STARTED); + if (oldstate != SBI_HSM_STATE_SUSPENDED) { + sbi_printf("%s: ERR: The hart is in invalid state [%u]\n", + __func__, oldstate); + sbi_hart_hang(); + } + + return ret; +} diff --git a/lib/sbi/sbi_init.c b/lib/sbi/sbi_init.c index 0e82458..1d4a838 100644 --- a/lib/sbi/sbi_init.c +++ b/lib/sbi/sbi_init.c @@ -311,14 +311,12 @@ static void __noreturn init_coldboot(struct sbi_scratch *scratch, u32 hartid) scratch->next_mode, FALSE); } -static void __noreturn init_warmboot(struct sbi_scratch *scratch, u32 hartid) +static void init_warm_startup(struct sbi_scratch *scratch, u32 hartid) { int rc; unsigned long *init_count; const struct sbi_platform *plat = sbi_platform_ptr(scratch); - wait_for_coldboot(scratch, hartid); - if (!init_count_offset) sbi_hart_hang(); @@ -362,6 +360,40 @@ static void __noreturn init_warmboot(struct sbi_scratch *scratch, u32 hartid) (*init_count)++; sbi_hsm_prepare_next_jump(scratch, hartid); +} + +static void init_warm_resume(struct sbi_scratch *scratch) +{ + int rc; + + sbi_hsm_hart_resume_start(scratch); + + rc = sbi_hart_reinit(scratch); + if (rc) + sbi_hart_hang(); + + rc = sbi_hart_pmp_configure(scratch); + if (rc) + sbi_hart_hang(); + + sbi_hsm_hart_resume_finish(scratch); +} + +static void __noreturn init_warmboot(struct sbi_scratch *scratch, u32 hartid) +{ + int hstate; + + wait_for_coldboot(scratch, hartid); + + hstate = sbi_hsm_hart_get_state(sbi_domain_thishart_ptr(), hartid); + if (hstate < 0) + sbi_hart_hang(); + + if (hstate == SBI_HSM_STATE_SUSPENDED) + init_warm_resume(scratch); + else + init_warm_startup(scratch, hartid); + sbi_hart_switch_mode(hartid, scratch->next_arg1, scratch->next_addr, scratch->next_mode, FALSE); From patchwork Sun Feb 21 08:53:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1442762 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=qUvlKt3y; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=EjFLZ8PW; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-sharedspace-onmicrosoft-com header.b=zj5aPtV0; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DjzdM59GXz9sS8 for ; Sun, 21 Feb 2021 19:54:15 +1100 (AEDT) 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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1mZCsJUluDy14VRzDn9Q6G9QNDMhXn8bRzhV5HSvxz0=; b=qUvlKt3yMxh4VLlT3O4pfMYly rz4lel98LO2qAaowlQMxWj/GbU31Wr4jbKNbJ6mhtnHRkexDaBe516ZqycqRStmHeSTCeUmfBO4zz /EkcpTtqhC2AUBLZvmwRkONu+VPwxEtZEYs5skNa208cCg9sjdq+Qje9a3/K+3zD5q+3vtd54hwLK RxQKSx3CHiBT7Mfyk1SdGwEKOD0oU8KZfb1seBy44XHl2Bi6b03hVk08cioWkhjk/bs5xTJAiI/qF pJATXueNxpBQAuTylS3Ktc+5L3gm/Mqma0QbQ5NgftkkLePrx1C02YgAgf9hgGU/OPABfXCMh4u03 X9xDVVXiQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lDkVG-0003eW-Hg; Sun, 21 Feb 2021 08:54:10 +0000 Received: from esa5.hgst.iphmx.com ([216.71.153.144]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lDkVD-0003c5-3B for opensbi@lists.infradead.org; Sun, 21 Feb 2021 08:54:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1613897647; x=1645433647; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=ilgT9/E2rEvMoOaiN2r8UZPKs3G0ZV9d77Wz5dBoKiw=; b=EjFLZ8PWjAOb6/yRDiobm7lTUGRUxu/kxcOtBYBvCqZFPV0vj700dbd3 CNL5AO7f284LVWSOBIF6CYzverqt6/3LZjaEgDLz5XzeZkmPw+azJmqi9 SlNCHwHfT7CEJBb9M8W2YCs0V/ZNhGj9nEoQ+eutwRZUXHTXyf6n2zgDL l7wSBYhAinpyKgLNI7oATTa7ruVTLzsX0kYlAwNXkSAA3/EP2UScj/Uzs Auj+W6wxmzvbve/wiSSRxGmoAplash9Vw4DPD3GoBRdLBEzJFLHKIRDwV y37Lej0kLcOt4cJzuJ9J2RXWNjlYb1Zfva1E+e07QDuxgw3yca0M+EWnm g==; IronPort-SDR: lLrKYqHlL39s7y4M13Ugz3fs8BTSV5ecOAAfq68JpxgWB4NFf8oloY4ZxKfKfUGpJQiE0KEYZu svkL/p9QrvidYwS+DZaX58hszAXIA+s523m6CfOcO6n8YnK179cdWvPesTDu8FnR0ynPekkn34 4ENrAKyDJfKtYxEVq731TpvK22XhJiuQ2cJ3LewCNnppbJkfG2ZqKxZHL9UWOM7HfTsqhPkg/2 3Z2GqD7OouTsUHRGvkO/sOtdsIXDm87PqcQfZm7vnHlLVAIGBDKD2ThN334RqVxWkYsmWcW65T 7Wk= X-IronPort-AV: E=Sophos;i="5.81,194,1610380800"; d="scan'208";a="160446579" Received: from mail-bn7nam10lp2104.outbound.protection.outlook.com (HELO NAM10-BN7-obe.outbound.protection.outlook.com) ([104.47.70.104]) by ob1.hgst.iphmx.com with ESMTP; 21 Feb 2021 16:54:05 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gIjgOYYYX9cp/8oXYyxq8eYPoDh31jyVXBo1aRRlKtVVmFe5HxiwyMxGpySC3Cz/Nivce4FXaHDUfKw7ZES3qcX+VmS9NEnM4xLVqH2s6d4wP92D+cRuZR85QkRi7DGEYkAV9zr0+V117moaR3h1nMQ63VRPyBjhj0mYxvjM8D2K+0OKoLlPwYbf0HKprA1Rs43hTDj8b/PFU1KJrseNQ4QaeL4gGK5SRDz8afGmPJEIExenrhY+/ODCwUiKkBdgnLmbYB8ca3YNYQrZVukx4zaKfaL4xFlvhLXOxJIzSlMh3lqT7vDPixqLFAjIoqQrl16JnRtWtg8tQ33E4HttOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CRV7SE/WCcpYJEM9gitlQRUdVqcm4ozDRjMqwy7Z7RQ=; b=k5FlxE2LfhdMVB1DrSP3E5X4sq2LNwzQJfL5ZZbIpyvCLl0hHFSXCnEl4wDsF2pxujlc2xSdXchDi5DCb79HHLWIrU0vnGE2JnXnzc6oTot8fkVhmscuhadZtTechA7vQoCgtU25iBmWLacxpaMA0fMBxfmBa8t+UidQUxxxEGHagJCQ13U+J/Ewo2jnPGs/umS3uQFdc9yZdoTvTx4ul105fAQgJiYZaoggMjD4xfbVQEL8t4JHJFEajDrP5lE5pb4pod435/xzFSWY6d38FI/4dSZK74/ZysBCMNCSa8gIDqhbDxqCzjBmdIkX2IdHRWcvDaAE05qvTovMWklGRA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wdc.com; dmarc=pass action=none header.from=wdc.com; dkim=pass header.d=wdc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector2-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CRV7SE/WCcpYJEM9gitlQRUdVqcm4ozDRjMqwy7Z7RQ=; b=zj5aPtV0ezHYknsG8YR4z6CzQCANfFp+nO3s+acpXbFVww1UQ0lTBex5LyfoH6vs4F/hSjVw/2wLGJb1Yiaz7oH3+ZVSm1HrXLEWF99SVpwVxXlfKptkX+4GLrnpoNDD0TNDIoBLIWls72/cArqI9yfcznPkDNWHNzxJrXiVVYY= Authentication-Results: wdc.com; dkim=none (message not signed) header.d=none;wdc.com; dmarc=none action=none header.from=wdc.com; Received: from DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) by DM6PR04MB4123.namprd04.prod.outlook.com (2603:10b6:5:98::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.30; Sun, 21 Feb 2021 08:54:04 +0000 Received: from DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::38c0:cc46:192b:1868]) by DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::38c0:cc46:192b:1868%7]) with mapi id 15.20.3868.029; Sun, 21 Feb 2021 08:54:04 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Subject: [RFC PATCH 09/10] include: sbi: Upgrade SBI implementation version to v0.3 Date: Sun, 21 Feb 2021 14:23:20 +0530 Message-Id: <20210221085321.180602-10-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210221085321.180602-1-anup.patel@wdc.com> References: <20210221085321.180602-1-anup.patel@wdc.com> X-Originating-IP: [122.171.171.12] X-ClientProxiedBy: MA1PR01CA0104.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::20) To DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from wdc.com (122.171.171.12) by MA1PR01CA0104.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Sun, 21 Feb 2021 08:54:02 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 3d9cd1e8-3ba0-4ac5-a45f-08d8d6463d8f X-MS-TrafficTypeDiagnostic: DM6PR04MB4123: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:1107; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XEsqbEToY96fYJJuAqwQwSQf7vdaqa3G4ltg2Pjh/2JzCHAPs0/6yrMXs+7AbTaZiQY2bR/RRk3ADwdRG2aSgu8GPGPgScqrrt2TRZHcsf4bPlmZkmgPfcjrPaqpxXvU11ddJEDm3kny0T+fJCqBfJJUbWiVoxLIpahSkxrXg1hQdb4NNOxPrBoXpEk+PFmaQXBanmAcAfFq8E5Ga2Vq6DQRBSQWoHZE+i8Fu+zEYmZOXEpeVIiY4a3k5vERm+zPFMGdT3B5ZY7tcCxTuPtP9hl1Hth4kFCTJYTY3sOPoXnZ+wxsy0rbrBSSWYMgyt2otXkdCx/KK2oq/oN7abVn4xajlUGKUEx0zYFnFuMVx1AC+Uv0pRPmPqaFcOOkYFuL0rAYb2CMtkzFlwraDyY0LfxcAmYf9B2r0GQunfJl2KArkt9jqIY8e3HMB/zW6QeFjdYuQbut++FicMO5V9HiP8paesFhgCNaSgZzPQYQiaVzKdsSE+0ELFDSZVMBNlWrZ5DUksxUeLDfDXF8BmPRhQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR04MB6201.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(376002)(366004)(396003)(136003)(346002)(7696005)(2616005)(5660300002)(4326008)(16526019)(186003)(478600001)(36756003)(8936002)(52116002)(2906002)(26005)(54906003)(110136005)(4744005)(86362001)(55016002)(66556008)(8886007)(44832011)(66946007)(6666004)(6636002)(956004)(1076003)(66476007)(8676002)(83380400001)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: UqUyh3fbRg2aa1fa10aATD432Zu046PSbNMtx/i4hCoiFh2y8XuBxeBQqT6O8KEk6tSRoA0mA/kOO40HvsVq67kSQRuS5de21gzOLxt5QrDohCYP+eSHZ6NqTvjyXj4E/SkdQh5YIx1vr9/iccUTixS6H3H7ExSDua5/gBURwsoR5j6HmxpdpVKZDzM3NQh4XpcjEYLPD19f6INHBsObEZ4M30M9iE/MQA7eok4U8imKW9NFOduH6DRapijINOJ5/778UzzAJh8SUdyXBkBqzWB4dvq3QdRkkfP57FQynIE7rMalhZQANvZkjOhudPVcOaDVcZUxM+Cpj6T8fj/Ys0RhWYvSk1nwrwITwP+TOS5iWNzHSAE0/sOiilsbJZTaddtuGfjKLU3WetMriz0ol/9OsrTxx7syJLyyYxwDUk3F4Ks9aCt12sjAaIrzTzDbigctn6JuQgOI0OXPqh/HHv5Cjh8VIcsOB6fjdaxhe01Bv05YF2sI5cGZ9BcsBAJz8HpfIf8rVZ0M7VkyrFGdAAeYIUrcbE/CHNPX2feRiz9AKdJ1Xo8trAHsmKyxPtFhsmdx0ZtfiQPt9TBsEHVookI5wKM92NgVGTFjNSfejNhbJHcJcvWWY1gXEVSwzQpNPvfF/d1QN3GOQcdkUzU42d+529Fs64aXq1j+zoaZfJHRgdt6Aik27mKYi3gCYKvK4kllZ0U4A+n80snFGwdYWUfRElXC2FxYxguZZSsrJFKkw3PnvLaDnJRDIfRLCkpDpZkKjNhXwQe4z1LSmIrjKdf9dPYCoMYQ1L4N3a2pdbuZQ5LoFlQi4mcbZQSyquW+zEtS9dxu8GAxQ2bCBx76DS9BMp4BeFKWwAVU/y6PgVhL4zgnEk0EnJZL/EmLxyTeys+RdAVlxfbnXs1jiHP9va5wWZd/jZrMZVTrjwz+3shORd/+HnK8Rq7Og45VEDH7pzevFKwnf7EgnpKaVb+xjP0NDPiKMdo64U4l6niDj53XETaCofYWIf9O5XGP6nGCMnW7cXAqE+b1f+s40CdjkCa7Ggymmo46dmD4tgUBHfaPomKZtr92kn+dM3TPnRZ20dYKhI+QAThPo7jIn0LnLJJVPT7WbxndQv/Xmcs/0hP+Q3WWLu+knDAGOvAG7wwGHm3TW1PdBHY3IhLXq3j3GNdhSxOF848MMrO9vLLNwkoLyGKRneB6M/PLHH/prqo/QKYPDhYb/qWrVZuYf5HHbfaySvr101IGRrKFSqglJjgZhvvOuOJp5YCkLallRSHWn3Vva6w/Oht207+/xcGhy1vJtrsbyGCZnWqUDRBg3YSXpWwCn18S9kn1ST7S5n+J X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3d9cd1e8-3ba0-4ac5-a45f-08d8d6463d8f X-MS-Exchange-CrossTenant-AuthSource: DM6PR04MB6201.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2021 08:54:04.6181 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: hO60ya/EFtvUruhm6yQF9G5H+W6cf+p+1t88Reb61v/MCD7ZvYH54J9qiijhfsNwSdOrbtB1VD9xA/En1e4Rvw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB4123 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210221_035407_396922_97A26884 X-CRM114-Status: GOOD ( 14.47 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [216.71.153.144 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 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 -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.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , Anup Patel , opensbi@lists.infradead.org Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The OpenSBI SBI implementation is now compliant with latest draft SBI v0.3 specification so let's upgrade SBI implementation version. This will also help HSM suspend function detection in S-mode because HSM suspend function is only present when HSM extension is present and SBI implementation version is 0.3 (or higher). Signed-off-by: Anup Patel --- include/sbi/sbi_ecall.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/sbi/sbi_ecall.h b/include/sbi/sbi_ecall.h index d357085..63ef866 100644 --- a/include/sbi/sbi_ecall.h +++ b/include/sbi/sbi_ecall.h @@ -14,7 +14,7 @@ #include #define SBI_ECALL_VERSION_MAJOR 0 -#define SBI_ECALL_VERSION_MINOR 2 +#define SBI_ECALL_VERSION_MINOR 3 #define SBI_OPENSBI_IMPID 1 struct sbi_trap_regs; From patchwork Sun Feb 21 08:53:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1442763 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=JnzTXubW; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=oi4T0j1d; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-sharedspace-onmicrosoft-com header.b=MynZUtQI; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DjzdN6stZz9sSC for ; Sun, 21 Feb 2021 19:54:16 +1100 (AEDT) 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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=esf0ZiNWLuOA8s0t9bgSx+wswkJenbNNalO4zK6c0a8=; b=JnzTXubWHaghPfnKFkxHA4Mjr 1P8ioqVj8w3XGroWEFY1XG+Ko8eDvGQqtPcD+ST8HmOK75KgMena6/5e14T4HXWm4FIzVN3yuG9hd nlZwafdZaBBWZz3vL3lPiaa5sLe9EmlfRONuxrRjhqDaQcLLv6uFMMrvVFJi+l0jJaEAWl389CnPQ bhvPoOKFTh39zJXoQ94oQofnkMwcb4GRXPahlc+nsyEr2fLdv11bpaZoYc7Von5TYcOxKalVf/KDk PORRiR74rcyH4135dXriptE7gdi3BjiWq9sfoMjoVDWd5TPorEm5CedDoFARnLEBWg0ts7jLM+gGG ZI+wmeaKA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lDkVI-0003fo-5Q; Sun, 21 Feb 2021 08:54:12 +0000 Received: from esa5.hgst.iphmx.com ([216.71.153.144]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lDkVF-0003dc-7H for opensbi@lists.infradead.org; Sun, 21 Feb 2021 08:54:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1613897649; x=1645433649; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=tO7P4SfMh5l5IScAoPVkqkrJhYmMRJMRY0immHi6U0Y=; b=oi4T0j1dxSjBoRCAy8lb3HbVCwZPDfA+LXoJSaL1eAIlcc+kHbej9AlI VCtx6xGUbbNnYXCA3r2LzjUG8QKpzcEAcQrNNq6+ea/ZuwGMDXzSbBrjm eCjDqee/1YRVDncIegJOurrfOk+nlO0Yyc4Zi3rNZGrIO4v3KRRGYFBe5 +e7oPn1DOLiZGhWu6p04TXNOzGKJFOhyqpmA1Fky6d8h214bK/CWNAY+S 7Hi1Jjmw5tOthYke+eo4u1uZQ+ald0Rpj357Iu3eEormDaKx7a4JJmCpo gquoPaWFj5R19oZwAdxscdlJOoRAVomDrL2anjBxMHbOPm9Nr3otqdvvV w==; IronPort-SDR: VxphSgC3fFRsQ1UcEReXexSTfhGuSMvq0IqtRaKstCl2IIC01qNTr+2dJlKhB4h/Mx10Azs01U KsZHBZMvgy2H6cxnc6/C9FqRAjuSNfUXZY1qF83owmTy6k4A6+8mznu1I4GCu/mD0G0cPK0kFt NC3sW8WdsK9rWiTl56dhI0H+cQ8g3QGeVxIVXbjlo4z/2tybkc6hYA5s5GXHptu2qtCs8wutiQ zUY3aC5bKhvMSGo4HhCSoR8+OJWtAb/+qA/7TCMuvRszLecOLq3Yr+ddxjY0uIAKfg6EmFGdjv Vis= X-IronPort-AV: E=Sophos;i="5.81,194,1610380800"; d="scan'208";a="160446583" Received: from mail-bn7nam10lp2109.outbound.protection.outlook.com (HELO NAM10-BN7-obe.outbound.protection.outlook.com) ([104.47.70.109]) by ob1.hgst.iphmx.com with ESMTP; 21 Feb 2021 16:54:08 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FzxBd6X2xjZsnwV0H6ftYq9w1kViad/UGgE7sxqq2WzrZKiZi87gb9ZO4JS/fqrA3K0U64B0X9FdwRcvuUdFr55fbwolUf3ErmNB6tihPpWv2iJE6I3qJlunUlAJpqYpnyLEM1LxwmQnxdmnjUN58OY9CWSE4XXO3a1rE0m8Bekg0lDyPcYZWboXf7878yAMOI9P8ALO7mtUYAq/ge9StMx2qq2B2yariPoYlCOirF64UwG3DAjsu0qIrD3D09iOUfDBWaURAlisnBiPng5rhiFp9bI30GPmuaQhoW23bWE/6rNeFV4E16VX9BIbyIdccE4EzQ2EuecS3f8da9NphQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fkbuYsCyxlwN/VWf7hfXeyhmRMS1da267y/Eeowbx+c=; b=BEyaNMDORyX/QIQuI4fV2ixtTXVol2Rn8s3KB2CIBCP6bPxoNhACIBD76JDQSQwZfGSaLjgC2UeciNM3JH5xUgHrpEaNoXMxdOKkNkObGYZoU7B1AD86Ho+5xdbQJAh8YQVHzubV0mjnAERc4KWWmPjNPAdnNbepTxTltdxiswlEgTZgZvlHINLeMXO8/zf8tdR4vwEpCjbBPDiKqWZx6bb6qyScDu12uUi89fKu17tFPSBAj9QO59ej5QCHJPr8x48JOaK/CljlXGdo7OJRAtbATfT4tDq0ktc7TUavYhKWNEThYaH17hn1JnAosfHAj0Nzsu507ieLkhrTWaUTgQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wdc.com; dmarc=pass action=none header.from=wdc.com; dkim=pass header.d=wdc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector2-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fkbuYsCyxlwN/VWf7hfXeyhmRMS1da267y/Eeowbx+c=; b=MynZUtQIIkZqXkB/cE5LpZt2Vi/mlLqwnVOj+l6KaafKB91yu5XKjJiUrSQeKSjaIIHbNnZuvTp4j94JleFCVxrOg+6N/C6f3nRT9GhLUWC8JsmJnyJ3OpFLJsCxq8HHXEQR4+kpb3lGR+DcKhFI8avh5qwlFjZTHU+ztK7qanE= Authentication-Results: wdc.com; dkim=none (message not signed) header.d=none;wdc.com; dmarc=none action=none header.from=wdc.com; Received: from DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) by DM6PR04MB4123.namprd04.prod.outlook.com (2603:10b6:5:98::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.30; Sun, 21 Feb 2021 08:54:07 +0000 Received: from DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::38c0:cc46:192b:1868]) by DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::38c0:cc46:192b:1868%7]) with mapi id 15.20.3868.029; Sun, 21 Feb 2021 08:54:07 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Subject: [RFC PATCH 10/10] lib: Remove redundant sbi_platform_ipi_clear() calls Date: Sun, 21 Feb 2021 14:23:21 +0530 Message-Id: <20210221085321.180602-11-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210221085321.180602-1-anup.patel@wdc.com> References: <20210221085321.180602-1-anup.patel@wdc.com> X-Originating-IP: [122.171.171.12] X-ClientProxiedBy: MA1PR01CA0104.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::20) To DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from wdc.com (122.171.171.12) by MA1PR01CA0104.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Sun, 21 Feb 2021 08:54:05 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 5dacb292-20b7-4ee0-2ba0-08d8d6463f16 X-MS-TrafficTypeDiagnostic: DM6PR04MB4123: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: b/xlV8YU13QxSZ5IQogiLNaKFB3XsgZJf18/ZqbfVHEr43Xsvtycou0KrIZICb6iRC9t82FHLSDolFnkgY7+DZP4toazF1Iu3m3yAuTkGgRIjqpogll1BmLeDjbRnytb/4ryDDVrLdRiq5XbKRdo3SXuz46QUwvqqaDPvebtRwhNYbcY00uX3e/HEfTJG+cD/BIqqAwPZFD9yYfe1W6L5YY5lVJnFekajLRfwM7LTUywwFLYUWOcDDrn/awDnvTJabqreLzKHwwsZXFze2CC98Ml5EcRr4K3q0PJ4b3aumZPetPovdj9LhADEfB21Jy76vmSUn3u8EFcPfWQG9tPum0CVdUkIkgGKKD2xDxR5HhTdYu2SrvKkBlT4AElidjJuhm24stL+S3UVdzbQNCTpF0ma8iByKUV6lPgeqw4AueYOCKCLTPCK7H26gH/U/N8z2uUY63fqlYhDOXMHMJKH/ILqsbuC718oORF7sI5NMXxdPryxv1Rt/Y2t9L/M5tM/sNRON3mL99B3JLGHMo75w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR04MB6201.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(376002)(366004)(396003)(136003)(346002)(7696005)(2616005)(5660300002)(4326008)(16526019)(186003)(478600001)(36756003)(8936002)(52116002)(2906002)(26005)(54906003)(110136005)(86362001)(55016002)(66556008)(8886007)(44832011)(66946007)(6666004)(6636002)(956004)(1076003)(66476007)(8676002)(83380400001)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: OoW9Sy4l5LI+uc/XbucITdXOtkdSAffY9kqcEYqPIhK7RoGpD7h/MZiuWQVo+6/s4Z13d7yXnPgmDRMM/ARY/UTxQywgqBTQ7ChNFS6E7oKpYXMCeANWBfq8CmeHM/J/Ejaut2tgT/qzpe7S9mrcJJoxjdtA85SNYsMxlnlJSUHKSbaX34ifcJeko0XNwi3sPOAq+NciyxOJ1uj1jiK59FVxz/IOQ8h0fTCT0MQAdeBslTD/2Q9lB+IICXEkCN/TLrsBBJHlaSX6+QXcLkDJ/Oolv1v1UeIFM2cxbGQ/9Q9cg6J4DWt7OMpxkVkRJBQsGopfCJ0aETYK7Q81ySQRVxxUvw+2SjiOsqHDO6MUlhFWwgbHAMNH72ciy9HmRWypa+Q6Z3y3IhNQQUBKNN2B21uJvK6f5l+KizXUSzs5ZXzPns+tdEojdYI4kxqqJ5a/l+wWk4RQJ8O/XZKlb5pWl6gmqdT42mi0LQcqb2qs2z9y+AXZExGQJkn6iLTpU7eTlirwgckQJZ0JI8m1d4IaQ8rbLr5ryPop7Wfbe0SCrrPekXIZIbCh9QRkZkwgQWwUUfP1wKGoE/78qONwRKhWej+L+7ig7Wl3bqKqq9zAb3P8PUiYXh4b4livNDBo9RePkha33pxB/Wlj9TYoyUzSCtSa0WOpm4DyZ9POiign04ZQegi7056bFSbZoih9Z39MzA3F8WRygxcXRBS2Y603Yclw7iUgY1KcjvncyxjL/57wPgBUiI+lrGYXWrtg0VOrQSGYR5L5sTQrJiEInBcPzb5Q9Hfw6EHk56mxcMve4Wn9KEtYyAzWCVv+pwsCpHwKOK2xDD7WK2F8Z0OSQR0OVj4jfDJIX3H24GyEKtnKnPt8+HTrAnIHbSKgMmwz5JyFjM/Y+B6mznr7JQyeNnh217sSi2MjjrSzhrntkH1eWz6/KJGh/RO12F/vw0jP1adA3HMjyEcMIHibs0r2r8mSslfRO3vqepMYvHjxo/BoSg/KZYQ1T8w6DjRaYqs7V8/m6jxeLH/z6k86HdMf4ojINbEyX6yWIhJLpXt5hbTw7sUS6TDyGqz3S2ophD9DJc/69KJIS0YVI8YkBKnfQQFfr1BWY1mx1lnkJ3X8l7Ru3aMh2fIJjLGfy4ziOvEpKkkkZHr+FrPtUxLObrylifpEKEBeAwvAvUGoQk8swinaWC28pkdTQ/lRiVGAl0XEaUhEXWXgvgIwinKOuHaYGblui7XIGXY44YmQJ+JL7Uy3VitnoyD6kcHRFhT/SW34rl1twF8CfKT9FTa9eCm5+45rx2qNUJNokFZc9yDeOjsFDNXQbSY8pbl0eRGzOxAF3hcs X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5dacb292-20b7-4ee0-2ba0-08d8d6463f16 X-MS-Exchange-CrossTenant-AuthSource: DM6PR04MB6201.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2021 08:54:07.1454 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: AOqJyuhu1wWVuPIfaq0Digt6QL09kx/gfCioMRAHj2ZP4M8EbKuWVDNd8fCG8Kd9i0YLbIfRWPeVkr8V4ZKD/Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB4123 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210221_035409_505555_400577F6 X-CRM114-Status: GOOD ( 14.69 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [216.71.153.144 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 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 -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.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , Anup Patel , opensbi@lists.infradead.org Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The sbi_platform_ipi_clear() called from wait_for_coldboot() and sbi_hsm_hart_wait() is redundant because IPI will be automatically cleared by sbi_platform_ipi_init() called from sbi_ipi_init(). Further, wait_for_coldboot() is common for warm startup and warm resume path so the sbi_platform_ipi_clear() called in warm resume path cause resuming HART to miss an IPI injected other HART to wakeup the HART. Signed-off-by: Anup Patel Reviewed-by: Atish Patra --- lib/sbi/sbi_hsm.c | 7 ++++--- lib/sbi/sbi_init.c | 11 ++++++++--- lib/sbi/sbi_ipi.c | 5 ++++- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/lib/sbi/sbi_hsm.c b/lib/sbi/sbi_hsm.c index b597265..643eba0 100644 --- a/lib/sbi/sbi_hsm.c +++ b/lib/sbi/sbi_hsm.c @@ -107,7 +107,6 @@ void sbi_hsm_prepare_next_jump(struct sbi_scratch *scratch, u32 hartid) static void sbi_hsm_hart_wait(struct sbi_scratch *scratch, u32 hartid) { unsigned long saved_mie; - const struct sbi_platform *plat = sbi_platform_ptr(scratch); struct sbi_hsm_data *hdata = sbi_scratch_offset_ptr(scratch, hart_data_offset); /* Save MIE CSR */ @@ -124,8 +123,10 @@ static void sbi_hsm_hart_wait(struct sbi_scratch *scratch, u32 hartid) /* Restore MIE CSR */ csr_write(CSR_MIE, saved_mie); - /* Clear current HART IPI */ - sbi_platform_ipi_clear(plat, hartid); + /* + * No need to clear IPI here because the sbi_ipi_init() will + * clear it for current HART via sbi_platform_ipi_init(). + */ } int sbi_hsm_init(struct sbi_scratch *scratch, u32 hartid, bool cold_boot) diff --git a/lib/sbi/sbi_init.c b/lib/sbi/sbi_init.c index 1d4a838..4de2dfa 100644 --- a/lib/sbi/sbi_init.c +++ b/lib/sbi/sbi_init.c @@ -130,7 +130,6 @@ static unsigned long coldboot_done; static void wait_for_coldboot(struct sbi_scratch *scratch, u32 hartid) { unsigned long saved_mie, cmip; - const struct sbi_platform *plat = sbi_platform_ptr(scratch); /* Save MIE CSR */ saved_mie = csr_read(CSR_MIE); @@ -167,8 +166,14 @@ static void wait_for_coldboot(struct sbi_scratch *scratch, u32 hartid) /* Restore MIE CSR */ csr_write(CSR_MIE, saved_mie); - /* Clear current HART IPI */ - sbi_platform_ipi_clear(plat, hartid); + /* + * The wait for coldboot is common for both warm startup and + * warm resume path so clearing IPI here would result in losing + * an IPI in warm resume path. + * + * Also, the sbi_platform_ipi_init() called from sbi_ipi_init() + * will automatically clear IPI for current HART. + */ } static void wake_coldboot_harts(struct sbi_scratch *scratch, u32 hartid) diff --git a/lib/sbi/sbi_ipi.c b/lib/sbi/sbi_ipi.c index a3a6ce6..b50735e 100644 --- a/lib/sbi/sbi_ipi.c +++ b/lib/sbi/sbi_ipi.c @@ -230,7 +230,10 @@ int sbi_ipi_init(struct sbi_scratch *scratch, bool cold_boot) ipi_data = sbi_scratch_offset_ptr(scratch, ipi_data_off); ipi_data->ipi_type = 0x00; - /* Platform init */ + /* + * Initialize platform IPI support. This will also clear any + * pending IPIs for current/calling HART. + */ ret = sbi_platform_ipi_init(sbi_platform_ptr(scratch), cold_boot); if (ret) return ret;