From patchwork Mon Oct 19 12:54:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1384286 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=hesmStmQ; 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=G8Skw+EB; 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=yICk9hi2; 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 4CFGvv2FKKz9sVH for ; Mon, 19 Oct 2020 23:55:55 +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=hesmStmQMvq3HNNmk9cdqo8DY 9jHdpmYGPRENdORQKG8aVWv6d+ihmSm2oPd2kzOADUmJnPrUS3bgS4Dz2flsdudP5G5+pq0KeGuXR 2u8G4AQ6B/q7KYIi0ZXZCa7LaeHoiKaMhiQcSy44xLtboPt9Id1l2j+O8eG1zztT4ioPhzHJWJvRz HgajyO5Cu+hdrTMAZs3dY4TYzg7Wwfq27UI3zOjJP1fZhbrguENnf38MmdXoAbnY+EyaOzx+qp5HO kIew7zT32kl/EDjXvSoMs6Zco68F5O8AOaKwfNMY55jMIwFvF/2MxPohgQDLDpwDXTvHtzE3sXav3 tDPdBkIJg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUUhY-0004yW-0F; Mon, 19 Oct 2020 12:55:48 +0000 Received: from esa3.hgst.iphmx.com ([216.71.153.141]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUUhU-0004wU-EP for opensbi@lists.infradead.org; Mon, 19 Oct 2020 12:55:45 +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=1603112145; x=1634648145; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=TE+AVyZLoI6MFYIghjV3m6Eo3B7XDD+AooUXWGAynpA=; b=G8Skw+EBAyh+zOjgLl2NLTrTv0iYbcSc1AlWy5SFDfa9FdWRqT8M+FQ9 lxTuSXWjsvVGKMOfUeV9w6CeLHUndouCkotH20Gm4swMMD/Ok7RB41C0D tFQB4KrUxWxSa/SrP9TSmaLnOsPy5sVSZPR//gX4wXGxgBx5/ZPM7xxfA l6JkM/8NLrqX5ppDF91KlBypAJK8HkiNrQo8StGM0/S+4yrqYl2MnVpjI DsjdpUy2h/iluPFubP81Mjzf4kN29/OjTBFglAoPSwW/1Sn6rGbbHw0R5 BIjO/IfYD4KMr3PlWBRBDyyF+eG/ls8+J5Ef3t+K+jvxwiE0osjw1Nms3 Q==; IronPort-SDR: +NhQIIWTL03JSxqlUZ0Ii6CRb7A7G6llVHyvKGQWBRXgFmoq3wdYnQmU6BgkRAwGovsn96Js1b pV2AdYBMKuzdpQbYZiGHl9qldCh4Jw5uWFGjG6OSLiFuDFGTkk0pkV62JhU5loEHh654LCjXo4 OZQas4okpcB0r8IzSloOuQ0/eY+iAc1NxIqdZcdLeIzJP/y/l/J0IgFvwXVYBakOOEVx1lmggF khCo8YDFxRmIL20JiYs6a6xStEokv6O0h5KHYfeEC4mtONXZb9SRHQ5kCH0++DgJIvlPMJIqq/ 3/U= X-IronPort-AV: E=Sophos;i="5.77,394,1596470400"; d="scan'208";a="154752544" Received: from mail-cys01nam02lp2053.outbound.protection.outlook.com (HELO NAM02-CY1-obe.outbound.protection.outlook.com) ([104.47.37.53]) by ob1.hgst.iphmx.com with ESMTP; 19 Oct 2020 20:55:42 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eYa6Xuj8FI7SAto7Fgu4tCx34oj3OIlHQPERC5Hzn2zOXnmlctG0sKezUdLOWdpliup16KeWayYWE8po06BS1YvOlITyQkFHONZilMQ7DNupIlMBKbl9qI9Q7zqeaDktkryJRvg3aueiW+eIgUdRvo5vWWbbfYuHRKMOtnlXmyD4/X4aukq3cJIJ03egtrUXJXLCkdl1m20DKVS+F7gmj8WSxqfkfR2xYXElKbc2gHNZOlkvYWERws58/BRtUSPGmaFd0YAJASUh9MA/k3znrY5dBkUBtGjbayGbw4Et8BhKEB7WuNi1LXBWP1G2yphh5a96gfsuROc554lJ0MJC2g== 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=ADE2xBnDxQ2uq24wS4MBvMc3cbQCooloGcv6X9olVRjOkNQNa9JfjLiuOzhm8PMQrcc36msgqmqHLQrvCoAkryY6tuwFfTwxTaCfVX+KRQJ8P9wntWgc6EcJ3BLmAeTRsqq5n9VY1GUK73XD4ltLixAJES41hhoi/tPiwqyDwp85YTYIy57++ZYlYc2JBiePlQEpnJA2IxMUyaO7EifQANg20qMY30KFbuiH0AZmww92996dgDAjZ+5KHxuTMORbzQhFfoFFjyOPPqJcx3znV+ZJECC408ZFleuipsxFuuCdoU/lgs8Dw0NGkeFtRzmJ3e1CWKK+8j9yeWPTSTXTPg== 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=yICk9hi2K2YdZ8sTOjwlAta6BsO7kBvouphIKmD7c2+th6n4iZokFDWLYEzRGFf+dQ5dxiy6DdF/ZpSt4jxHQ9cUUCiQtd2CNxrnJJC33rwJ3fAfmCDIchlyWfj5VfCyKRtkJa0QSEOFKNl+HKATtUVIED4s9ApP/Nyqd2uTlTM= 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 DM6PR04MB5548.namprd04.prod.outlook.com (2603:10b6:5:12a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.27; Mon, 19 Oct 2020 12:55:41 +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.028; Mon, 19 Oct 2020 12:55:41 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Subject: [PATCH v3 07/16] lib: sbi: Extend sbi_hsm_hart_started_mask() for domains Date: Mon, 19 Oct 2020 18:24:44 +0530 Message-Id: <20201019125453.2460105-8-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201019125453.2460105-1-anup.patel@wdc.com> References: <20201019125453.2460105-1-anup.patel@wdc.com> X-Originating-IP: [122.172.253.92] X-ClientProxiedBy: MAXPR0101CA0060.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::22) 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.172.253.92) by MAXPR0101CA0060.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21 via Frontend Transport; Mon, 19 Oct 2020 12:55:38 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 05edada9-c8d3-4e42-81d3-08d8742e4862 X-MS-TrafficTypeDiagnostic: DM6PR04MB5548: 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: TQ+DqHCIrPA7+stjO4V4qvp2DdIno2qf4058brYfthqgbGN0WTfX6nXugHxZeK09WC+nSjWuxF4jMUDPoXkl9tPTD+nxpdbbuR+/7AKZly2z9FuP4SCAV9J87tVHIH4JapuTlO3OJfHM7r+otShMsM1iMWhvh12Jnvyc2yaXWi45ag4KW62ogdYS6vMNBJfZpuBRM2GnCiSGPkWUsoIZ2EaM7cna5uMW5NqH4bf6f2z2pw/oUZQVasLLytI8u3UFuMaila7zQr6JQpr1OpnyiNHPs8CfDRbTeJ4HtYuHwudqLxoB1YKzt6MF/e3Mvmw2h15z3+T+CTS83SyVEnbvXA== 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)(366004)(136003)(396003)(376002)(346002)(39860400002)(6636002)(55016002)(6666004)(8886007)(66946007)(66476007)(8936002)(8676002)(66556008)(2906002)(86362001)(44832011)(83380400001)(2616005)(956004)(16526019)(5660300002)(186003)(54906003)(110136005)(52116002)(7696005)(55236004)(1076003)(4326008)(478600001)(316002)(36756003)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: dbBd39aefssdn0Mcl1j2rhnV56nO5UQ/3YQsP5Xr4rye/EK6KWeTh3MfiVc8wh1kzqKrfpo9Rmwq5zRG1PbaIfNRghy8vcXpUgFH7VffCt1NDaZttcDBK+VYXgs22PxGd5eFoVo2JY1+2E+qQxmlKy1jVFY9duxESAmJ+Quzco50hBh1g4U+cK0s6sZ65OlkK5NU08H+CYhKqZ2gPD7NbW+Hcx2Waw047ezcKPBvTglTq5MSjfPIsj1Y9c/RoxB5xHiMggwQMqqJPT0Dx09jQZ+aJKx3+cXs5VaMV3IXAX26ZSOctv01KwJ1zdm2ItURJlvEPAWsLLwepUQxnbB+Vyb+VW2fk6dYYfpMB+3HnVDIPm8xw66mi78pkXyUwpcI4QVj2mwE7Fmr+EVGV4/rmRXam31DI1FJw9E8HjtBkKTUQLOlYDSPeRb6wHob7byJnWpvsIt8xF7GGtRewYnXXV4gt2rXcsjKhncLEYeU7yYpo8PgSjcoR5/m6xfIPl/LMxsVdAY5ibNIkq78AVJBBYPXUV3WLQt9OhstnspmEYkM9o0OpSKz/Ud1RWEpa/cGEBOK8hCwVyoL6jMm3ntJalwsBfZYAUgkT++x5veK0cz5JKIfaLJb48FAZ2NhajqDiEMXJXIdNnG99nXliEU8JA== X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 05edada9-c8d3-4e42-81d3-08d8742e4862 X-MS-Exchange-CrossTenant-AuthSource: DM6PR04MB6201.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2020 12:55:40.9275 (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: bQgULOw5xQ8s6bci86VO+ozufrSgd2O7XisZgz3RnyN9edn264BLTCWjxB73GrCGQ67YFaDLsVgtFQz2xqtAIQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB5548 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201019_085544_702450_7C887495 X-CRM114-Status: GOOD ( 21.24 ) 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 ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [216.71.153.141 listed in list.dnswl.org] -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_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.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 Reviewed-by: Alistair Francis --- 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)