From patchwork Thu Oct 15 13:26:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1382672 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; dmarc=fail (p=none dis=none) header.from=wdc.com 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=2CBYIZ1p; dkim=permerror header.d=wdc.com header.i=@wdc.com header.a=rsa-sha1 header.s=dkim.wdc.com header.b=rwk1Mw+J; 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=k4EjTALj; 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 4CBqpk1P9bz9sRk for ; Fri, 16 Oct 2020 00:27:58 +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=OVnghqCT3e/8ysa1vTLJ39pdsqs5FQW6v8nOX2bYb0k=; b=2CBYIZ1pxarAS6YePNh4voYzO xahXUqM7I+2ILUBtkEYJjbw5nGrNSEboxnzFcyfu+A46hLtdzlaSg2C4vjx4bloJW+kI84z2MDXor PfUcT9aKISFAeI/trDNM5orau6sWROamPb2F4e+UlWaUJ9CdM1+CKjAsn49Du5iSJa4ebdcj23FPI CNbGP/+FY+S6Z4tyNHMboAeZlNgX9Av5HvSaVBJ+GipQP0C1ES3J6uWkg8twLPcujaHwHPBkP7F05 fy8DZqwdglZCORhlv7q7WEGJxylT6BG084Y5MGD9XEvCpJvFo/t8GlY+vIgmlv11USkWiQhYWJUIp vsZv8KHTw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kT3IN-0004N0-GM; Thu, 15 Oct 2020 13:27:51 +0000 Received: from esa2.hgst.iphmx.com ([68.232.143.124]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kT3II-0004Fc-RB for opensbi@lists.infradead.org; Thu, 15 Oct 2020 13:27:48 +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=1602768817; x=1634304817; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=TE+AVyZLoI6MFYIghjV3m6Eo3B7XDD+AooUXWGAynpA=; b=rwk1Mw+JA5DdTwhxdHSyS/Gjm+rri3KYr424d+00BrzLZGsSgZAOHLI6 vG9gya012xpeP0ioHzn3DHWBCoqHbxOW1u3eaYMum6Mnuv5KZtS9NrIeu XtjEe/iBste7RQj/m5YeJ/ThejauNm+DPj/3DaISlkr0pxUlLmyEWEE3O bKwScl3qp2uxlLH683jrisn3k6o/VOyPwXpnD2WBNiKc/MZNcOXGJ92Rb WQjUvUhTsuDBBeRPk9R4KK7fzQhDSFafbD/1OKIYPY7LaxBclSpSQpWKb YOKCXv/RczoRPpdxtsuqJ/agfMja1HCZIuTMovzcGM+h7IIitvdd7IQzy w==; IronPort-SDR: q3v2f8ZP09moR+G1pZpwJQ3uqasYl1AcUgEi6yFSjUXdeut5XyBC6cxMPIckN9w1fN9rFbo261 IdiJ8rUSEOv7NAg9q7C+UUZpWpjAIhdYIS6A6ICJe9SBiDAOkOIyrloVEDq7gBCWE9w1R0qZB7 6m08cxLKItigDazixZp4DYnuxRoQx1GiGb+Y5LNHEABBQtB1h57r21Bm0YQC1LgPF8wuNCCQZG LSo9kLWFbsMUZIyRUw4d+960Ae4FEHX1xxSVjFfSPcyvFjV7Oy4KrbvCcmGjutLi3ttwgJ4Pnj P5Q= X-IronPort-AV: E=Sophos;i="5.77,379,1596470400"; d="scan'208";a="253498985" Received: from mail-bn8nam08lp2048.outbound.protection.outlook.com (HELO NAM04-BN8-obe.outbound.protection.outlook.com) ([104.47.74.48]) by ob1.hgst.iphmx.com with ESMTP; 15 Oct 2020 21:33:36 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jYTZJYwgbKGgTpN5nqqMechz/2ltuNTKI9oK9nlX5Sx5ZHoFMbLbmwO8Kch4Y7YEVdG+/Shwgr6bdtmPmmt2yZ9A2Ry0M/cVlNqvo8kuEPXlhk3X2dETxqwNi1IeB0i1I/RHo15ke0gLno0mw1vFzi1asviBtbf6cAax/FcLT81W1CepCSZ1VCBRLUHHlpUBrtHFa/gzxtsBLi3pF20sT0v3b5egGftUyMdelvIguGd7FmCIPj6raOEWRpRo/vUbKntk522NGDL219nn4K/IkxrPvjTEJuXNTmt8qwQIzucIPG7wdCHonicOE/hnOHwq8nS9CKGko/aQTsEZ/b2ZdA== 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=6AN6syAa6SwDXOMkUpKwDmnMHK/W6ammeJ4hO6U42sI=; b=JwRXg+8gq1Ntq8wNPypR0S6HoXJocdHxtQVlCbEpI+NGUo01h54oamkFKXkmntaL2FldagfhB1+VIDk9NEzUjNCx8zkt8tYmfocbTgv8Q7d91bMrbCIOvGwdttsrHlSmC4PEwByQrdQw6utgyrE6PJq1yNI6Alg2brioWChZfU/VArFXxJyiNRQwRnd7PmM0EufmN32LkpjN/CHhGQWqJf9Z5/+UeVMmj0+79vikNQVkmBnqJCHIJEDDBrEwmebtgYxF3kknIcKfFcg1TksZ5Mqc+LxRIFlZGvuuE4cgIzfLKlPKB14b7duFFvMD5FR/xgYEd7T2/8H2RCqKTTg6/w== 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=6AN6syAa6SwDXOMkUpKwDmnMHK/W6ammeJ4hO6U42sI=; b=k4EjTALjGWqGCIkQ7q8JK8Y4qsFahcQPYuutrlTdyhRku9Z9+E5DZnJ7iqij2d21ZVlNtMPkfag0EYVFXyOiXuVifX9jIooDP6Sj4IkOusOe8C05oF/0eNAaW/570/Rikwd1ncQk2eUgFXG1c5CisETVs70m2lcJaniRosMP0Kw= 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 DM6PR04MB6624.namprd04.prod.outlook.com (2603:10b6:5:1b6::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.21; Thu, 15 Oct 2020 13:27:45 +0000 Received: from DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::d035:e2c6:c11:51dd]) by DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::d035:e2c6:c11:51dd%6]) with mapi id 15.20.3477.021; Thu, 15 Oct 2020 13:27:45 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Subject: [PATCH v2 07/16] lib: sbi: Extend sbi_hsm_hart_started_mask() for domains Date: Thu, 15 Oct 2020 18:56:51 +0530 Message-Id: <20201015132700.2232820-8-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201015132700.2232820-1-anup.patel@wdc.com> References: <20201015132700.2232820-1-anup.patel@wdc.com> X-Originating-IP: [122.167.44.151] X-ClientProxiedBy: MAXPR0101CA0065.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::27) 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.167.44.151) by MAXPR0101CA0065.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.22 via Frontend Transport; Thu, 15 Oct 2020 13:27:42 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 10d5bb9f-e49a-4a3e-805e-08d8710e19af X-MS-TrafficTypeDiagnostic: DM6PR04MB6624: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:1284; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eJ3gRUspB+zxJKfhWyEKM0LWXan+h8aRI1XaV4gqj1jYCJm/bffgion1msVQfrQ1jSyuh8giywufFDePB8bnWFYtmrE1UZTRVGepnBo+BhfRRIZimKOqBLuRFbV5WkliqkxFU14sEc4Or5kP+cmQT2dkwEGSh40TqAnlVV9Ys2blwC0MOpm/tBD8UlaIerGeE2/k3OE1gXNwo6NOtSpIbmUI5oilotZzNUABZvd5t2raqZbT2TDBQjJgyrym009Fsyv3LPiCfmvuHOMc+jM2L3+HCkQT9qSaQ9EWX1gxuZKtQ34ImBHBg0XmxlqtE3435tBU2+2RZaveiwMBSB4mvuIL3xJUPVx+GsdsuR0YJ57m68wcsJtR8DqJ8CDbaYnM 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)(396003)(376002)(39860400002)(136003)(366004)(346002)(2906002)(66946007)(110136005)(66556008)(5660300002)(44832011)(66476007)(36756003)(6666004)(316002)(54906003)(8886007)(8676002)(8936002)(86362001)(34490700002)(1076003)(52116002)(26005)(16526019)(186003)(55016002)(83380400001)(478600001)(956004)(2616005)(6636002)(4326008)(7696005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: jgaqKhDLuBhFSyT6WwlzzpXwCu+d4ujxuSOoWQag1F7U2uFciV7/K9yvCt7Ih0ixtwvzKomgNGxNXs+9vmqSyHohsdapArI1tJKshGqXcagpJkj1ObYumj+QEVu/N60/Sukbvc3biNDim0FySNjzEPFwnxPXiHytmhwp5OWlsoYynPFwtXpX3h9OUCvJgZeic+CeyNSwaDh1DzQAWtGAKdpjmbgRK6IEB5iA02DL/WZNM+zNW+2diT+acu46YoMKLoclT1eZdnNcog4/XTYcQC0vtLlaaYeA7+WHNJbIjBEShLtK0jLKg1C+2zbc7y4a1F+1+fFi2lIj/VZvFdXiPbBM3QgfyJmOH44xsf0ayfT+yLIZBUn87yLGWjaZYazodR6Fw/7A0MFrU5pymVCLzPRJsKe16N1r85TN2JPYERn5z/r5yGNbkdEfSVNCgxYYEkVzALJXsgVcqTZhor6HHQ7tcZT9xnFGDfsnPn3oVOxVC9aSE4awPOmeU15TuhIKv180eyqvnauRbaPDnrnofEVkLn3QnmWwF4hOi76TscgGtDP45N4/GxFYMe9cyH4x0lXYzEsta14qbaIuDM/bXfpC98l3iDEsNZby4X6915Mgb2F3iHcQNdCsI5vrRd5bXIMw5DXKJziVYAJ9hwXo3Q== X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 10d5bb9f-e49a-4a3e-805e-08d8710e19af X-MS-Exchange-CrossTenant-AuthSource: DM6PR04MB6201.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2020 13:27:45.3354 (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: Yt5IsjiLzVBVCdyHj07bMplyItIzUDWsi6l+ThUqE66vh4cK749BrD5zj3kJjhX21h6r8A3r+Irvam5n8+tuAQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB6624 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201015_092747_178792_69B7E388 X-CRM114-Status: GOOD ( 21.22 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.143.124 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.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_mask() API should take one more parameter to allow caller specify domain under which started_mask is being generated. Further, the sbi_hsm_hart_started_mask() depends on sbi_hsm_hart_get_state() which also should return HART state under specified domain. This patch updates both sbi_hsm_hart_started_mask() and sbi_hsm_hart_get_state() as-per above. Signed-off-by: Anup Patel --- include/sbi/sbi_hsm.h | 7 ++++--- lib/sbi/sbi_ecall_hsm.c | 4 +++- lib/sbi/sbi_ecall_legacy.c | 4 +++- lib/sbi/sbi_hsm.c | 17 ++++++++++------- lib/sbi/sbi_ipi.c | 6 ++++-- lib/sbi/sbi_system.c | 4 +++- 6 files changed, 27 insertions(+), 15 deletions(-) diff --git a/include/sbi/sbi_hsm.h b/include/sbi/sbi_hsm.h index 18d129b..296b267 100644 --- a/include/sbi/sbi_hsm.h +++ b/include/sbi/sbi_hsm.h @@ -19,6 +19,7 @@ #define SBI_HART_STARTED 3 #define SBI_HART_UNKNOWN 4 +struct sbi_domain; struct sbi_scratch; int sbi_hsm_init(struct sbi_scratch *scratch, u32 hartid, bool cold_boot); @@ -27,10 +28,10 @@ void __noreturn sbi_hsm_exit(struct sbi_scratch *scratch); 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(u32 hartid); +int sbi_hsm_hart_get_state(const struct sbi_domain *dom, u32 hartid); int sbi_hsm_hart_state_to_status(int state); -bool sbi_hsm_hart_started(u32 hartid); -int sbi_hsm_hart_started_mask(ulong hbase, ulong *out_hmask); +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); #endif diff --git a/lib/sbi/sbi_ecall_hsm.c b/lib/sbi/sbi_ecall_hsm.c index 992c93a..3698a41 100644 --- a/lib/sbi/sbi_ecall_hsm.c +++ b/lib/sbi/sbi_ecall_hsm.c @@ -7,6 +7,7 @@ * Atish Patra */ +#include #include #include #include @@ -34,7 +35,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(args[0]); + hstate = sbi_hsm_hart_get_state(sbi_domain_thishart_ptr(), + args[0]); ret = sbi_hsm_hart_state_to_status(hstate); break; default: diff --git a/lib/sbi/sbi_ecall_legacy.c b/lib/sbi/sbi_ecall_legacy.c index 3bfe749..909cbe3 100644 --- a/lib/sbi/sbi_ecall_legacy.c +++ b/lib/sbi/sbi_ecall_legacy.c @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -33,7 +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(0, &mask); + sbi_hsm_hart_started_mask(sbi_domain_thishart_ptr(), + 0, &mask); } *hmask = mask; diff --git a/lib/sbi/sbi_hsm.c b/lib/sbi/sbi_hsm.c index 8c1b7b0..65e7f3d 100644 --- a/lib/sbi/sbi_hsm.c +++ b/lib/sbi/sbi_hsm.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -56,13 +57,13 @@ int sbi_hsm_hart_state_to_status(int state) return ret; } -int sbi_hsm_hart_get_state(u32 hartid) +int sbi_hsm_hart_get_state(const struct sbi_domain *dom, u32 hartid) { struct sbi_hsm_data *hdata; struct sbi_scratch *scratch; scratch = sbi_hartid_to_scratch(hartid); - if (!scratch) + if (!scratch || !sbi_domain_is_assigned_hart(dom, hartid)) return SBI_HART_UNKNOWN; hdata = sbi_scratch_offset_ptr(scratch, hart_data_offset); @@ -70,9 +71,9 @@ int sbi_hsm_hart_get_state(u32 hartid) return atomic_read(&hdata->state); } -bool sbi_hsm_hart_started(u32 hartid) +static bool sbi_hsm_hart_started(const struct sbi_domain *dom, u32 hartid) { - if (sbi_hsm_hart_get_state(hartid) == SBI_HART_STARTED) + if (sbi_hsm_hart_get_state(dom, hartid) == SBI_HART_STARTED) return TRUE; else return FALSE; @@ -80,12 +81,14 @@ bool sbi_hsm_hart_started(u32 hartid) /** * Get ulong HART mask for given HART base ID + * @param dom the domain to be used for output HART mask * @param hbase the HART base ID * @param out_hmask the output ulong HART mask * @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(ulong hbase, ulong *out_hmask) +int sbi_hsm_hart_started_mask(const struct sbi_domain *dom, + ulong hbase, ulong *out_hmask) { ulong i; ulong hcount = sbi_scratch_last_hartid() + 1; @@ -97,7 +100,7 @@ int sbi_hsm_hart_started_mask(ulong hbase, ulong *out_hmask) hcount = BITS_PER_LONG; for (i = hbase; i < hcount; i++) { - if (sbi_hsm_hart_get_state(i) == SBI_HART_STARTED) + if (sbi_hsm_hart_get_state(dom, i) == SBI_HART_STARTED) *out_hmask |= 1UL << (i - hbase); } @@ -259,7 +262,7 @@ int sbi_hsm_hart_stop(struct sbi_scratch *scratch, bool exitnow) struct sbi_hsm_data *hdata = sbi_scratch_offset_ptr(scratch, hart_data_offset); - if (!sbi_hsm_hart_started(hartid)) + if (!sbi_hsm_hart_started(sbi_domain_thishart_ptr(), hartid)) return SBI_EINVAL; oldstate = atomic_cmpxchg(&hdata->state, SBI_HART_STARTED, diff --git a/lib/sbi/sbi_ipi.c b/lib/sbi/sbi_ipi.c index a27dea0..4347832 100644 --- a/lib/sbi/sbi_ipi.c +++ b/lib/sbi/sbi_ipi.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -77,10 +78,11 @@ int sbi_ipi_send_many(ulong hmask, ulong hbase, u32 event, void *data) { int rc; ulong i, m; + struct sbi_domain *dom = sbi_domain_thishart_ptr(); struct sbi_scratch *scratch = sbi_scratch_thishart_ptr(); if (hbase != -1UL) { - rc = sbi_hsm_hart_started_mask(hbase, &m); + rc = sbi_hsm_hart_started_mask(dom, hbase, &m); if (rc) return rc; m &= hmask; @@ -92,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(hbase, &m)) { + while (!sbi_hsm_hart_started_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 6f7be14..a938003 100644 --- a/lib/sbi/sbi_system.c +++ b/lib/sbi/sbi_system.c @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -21,10 +22,11 @@ void __noreturn sbi_system_reset(u32 platform_reset_type) { ulong hbase = 0, hmask; u32 cur_hartid = current_hartid(); + struct sbi_domain *dom = sbi_domain_thishart_ptr(); 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(hbase, &hmask)) { + while (!sbi_hsm_hart_started_mask(dom, hbase, &hmask)) { if (hbase <= cur_hartid) hmask &= ~(1UL << (cur_hartid - hbase)); if (hmask)