From patchwork Sat Apr 10 07:18:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1464588 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:1:d65d:64ff:fe57:4e05; helo=desiato.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=desiato.20200630 header.b=XsWtPXQ4; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=0cKhlDi5; 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=Fbl8+VLs; dkim=neutral header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-sharedspace-onmicrosoft-com header.b=tzEvXma6; dkim-atps=neutral Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) (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 4FHRFS6bXTz9sWc for ; Sat, 10 Apr 2021 17:19:08 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=+Jl3o+aWk8Q/B9tPnkIwTCHBNv7VEvoffj3gLp92pmY=; b=XsWtPXQ42jkGszWh3ylkxEV/S QTNWCjqsbA4woCoe1e39fDcDwLvXDYHPYTbqTgY5e4p2w72TH4mz1w+JLtscyKKkmbEa1hHuBATyr e+PAy3t520RAeYzQnshxlDIkYMHQudRERblp3NP0cOFosUXoTi8cYfSEnjVTfalBsT753ihm3fhDo nydO5xi3yoAegQLWJJ7kv5jbt/m6eb7WjH1Pw8oA5/BlUXi4gIHxRaJuOrYNkZMoF3iCLPbVGRVG+ +iydLJjqnNcYksuAZD5+5BXOu5Epq/wtQRqeB7wXF45NdXYx37W/oSWrcFJg5ztQvUnEKtTUz2O6b YcRIrfv7g==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lV7tS-002M1d-EL; Sat, 10 Apr 2021 07:18:59 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lV7tG-002Lzo-H3 for opensbi@desiato.infradead.org; Sat, 10 Apr 2021 07:18:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=wTQEu54J+il2jfv04UdvwPV4eaVv9k/hS9SFuu/R+5o=; b=0cKhlDi5zh9LYeWL54hoLSpJ9v DpmdJLRAeMuaAcvl9IYB2oXLzX6dEePcSHaeU3MOX8fWSXugGOWBaQXGcp12Q7BYyoBH0r/STuF1O /10oFmCNLJe+lp6T4Vcdcm7dk0JYhTDnQddhFLZyAqsfLYJYNw46dmQ2Ra5VNs1yff5JMKXewvsZK UFcV0LWvPQkEHJqJ9b/6jXbHDoCuFfnLaqfCE4PWfNDAW1qBgVcA3dVZEb+NNrKTdiwxjfrrHC6gE u+Hly3SBqcoA3giTfT9vG3IqfOLA8xax5djbEtbjlankx9ceGWKyGyCLlH3Oz5XOuqc3goLAWBGrQ 9BXygOjQ==; Received: from esa5.hgst.iphmx.com ([216.71.153.144]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lV7tD-004yCJ-R5 for opensbi@lists.infradead.org; Sat, 10 Apr 2021 07:18: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=1618039123; x=1649575123; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=3csEfDpOOl2nKgsuCyBpUKsDSuHdYZ1dyHX7EeK1Ag4=; b=Fbl8+VLslBJIZ2nHndbxmvLvDOFHjHYhrhBDrVhs47KA24wh/K8yC7Rl Rj5jikylgFqn/XLkdRS2/7u9yujPzvKEZxrzPeT6NNFWx2qQRMwTWba16 42UPiZe8WnSb9FpO++Ktkejq5LodjMwfLJYEvl/2LUT0wu8nvi9m700Pr 11xT0P5mEAeK/EkPILMmdeGmf9b+sBpmu1zz8TsQuVSzWYm+8kIctwC+f /0TaXkfYfJ9S+Nl75oGbPrIRdFispjQOXLfZvAl/kiPRGo5NZ5jGtB78t bG+Oe00nwozoB9dlins49YJ3lUrgJBxEO2Eix6ww+adPCNeQnVDTkhKxP w==; IronPort-SDR: rV+P5/Q88ZeHkZzj2F2sbmCpqSWOUIr5edilt8+zFnSMmiUTwkA0y5/Tjt72MhPjEdWqFV2C21 ERlfEpuRpcE0buGBiMsy8FJJVUVeQfC7yHGVtGI5vdTB5n2LX8laaPPAwxon0yyD/dU6rqwTVA D9kQBK497TMNtb2UyCpJbOUBt48jyTNQH/x5230L1x5ioFOeVp96JQc8c2YqrM94S/Hvwqp4wz EnO6XLLRP0aywq3qVNfHFt97acSTTZL2MxTQZUQ44TgOOXUUbv8Eiknl9o4ZiNmE6PQOE7r57H fsM= X-IronPort-AV: E=Sophos;i="5.82,210,1613404800"; d="scan'208";a="164366703" Received: from mail-mw2nam12lp2046.outbound.protection.outlook.com (HELO NAM12-MW2-obe.outbound.protection.outlook.com) ([104.47.66.46]) by ob1.hgst.iphmx.com with ESMTP; 10 Apr 2021 15:18:42 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nJhZT+j1phKTUQ65uXBiRhZGsPTPOTna8DErkrxq/KZHZo5BuFZ41xEh1iYA5CRQxC4FmSx3f2K/RryS0YCvVWF2AUeiValPr+zikMsz67zqRzgCI1YgXNSoBk9azRzA1JkJ4T4yFTsMoyIFBvx7f54Z9qJW+qXWgDliTaMLKPFqtRUGOudTyHOXpvsT6sksBkgs9yIF9AKiy6XKTyawxyRvRKU4jfYmk008I0omMQzrO96vWR2Prsr+etij+p+A34ErFfoTRiuhU9q04qMAGgIY4fQZYPfk1SCqo6jFepsnceRRsBKuJZZNBos5U8jJHjp//QeIHYOGzqc79sxv7Q== 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=wTQEu54J+il2jfv04UdvwPV4eaVv9k/hS9SFuu/R+5o=; b=Akd5iEdzLue74qseZLsZlKz7+NDYgjxB1499AxNo+UndN+Y2uAxM1afAfEgzmNFQzd08Mm8TLAmQ86vj2ZMm8vTP4HazWf1WhlOr+wBqFXnh+3OGBfjBevkG07SZpllYOM2umXdA8/7651jbT+rDCKYhQThc8BfP3hJoWpdYlbXyO7ngTJuEDZIr/dKqCki4CjF7AHzNaU7n0WbCfJrqScwHzw+5Ihsqs3WgB7zqh/jLZ3Mhml2WyTe+ckGI6SVa+u4GGXlAWsEx+KszDc0cS/61TFbMbIAfsHDUDLaZ2A85je6DiJ9n8EhWfBzhsaKQJ+we8UnGfX1BIEBK2fmowQ== 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=wTQEu54J+il2jfv04UdvwPV4eaVv9k/hS9SFuu/R+5o=; b=tzEvXma6ZGw0xm2bG1U/ytxVA6M+JIxZRDtlhwvBWqq7Bt+RPnd4zR4t6WrLEdyTavpMSidng7pNvFrGzy1dMM0esSDa1i8/bpTiAY3NPBtZksH3rNDGCdJjm3RzBiWVZUAVDn1w6TJnbIcF6ntyWas8eyaCcegamjFnwzl0E/w= 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 DM6PR04MB6362.namprd04.prod.outlook.com (2603:10b6:5:1e7::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.29; Sat, 10 Apr 2021 07:18:41 +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.4020.018; Sat, 10 Apr 2021 07:18:41 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Cc: Anup Patel , opensbi@lists.infradead.org, Anup Patel Subject: [PATCH 1/7] lib: sbi: Domains can be registered only before finalizing domains Date: Sat, 10 Apr 2021 12:48:02 +0530 Message-Id: <20210410071808.759856-2-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210410071808.759856-1-anup.patel@wdc.com> References: <20210410071808.759856-1-anup.patel@wdc.com> X-Originating-IP: [122.179.48.237] X-ClientProxiedBy: MAXPR01CA0106.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:5d::24) 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.179.48.237) by MAXPR01CA0106.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:5d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.16 via Frontend Transport; Sat, 10 Apr 2021 07:18:39 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 985edef0-2680-42bc-cfc3-08d8fbf0de54 X-MS-TrafficTypeDiagnostic: DM6PR04MB6362: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:3044; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZxjllVTwnvuN9rKS0vyU+p882WvG6EMxbdzFsCPVbYHy9tIirpXoeXdyQypruEb+Kjlb9KSK8t43a5Ddp7K6EIpASRbpouAQvvFgpPn7/IN5z/Oous8jDC/e1xjqwnG80HY3cii8OSTSGbdZ/Jxxh4vtDCpzkPxVVkqIkk2yA+aWmZ7SFV/69HFPvF3wb1wxejZjmKnBazcEoY2xDVFWq7lHzGDmaPfLSV/1fLgfdOnvvXEGxpuf71lJild+wmf40/lTaqEEHraQ6UhKOgmLahg+gWlZjtzBvEAILzSu5Phj++uVDdVdw2xIfb/uHT1hwAZCGEJFnerCcfd8yS5XosXRHexHumI46KpaIxF9npkc9UQc22Ek70D/ahGJ4d28F2F/VFkThieZN1TWoi5BpVgyL27NzZehqJwlaceNrNA9OLCQ/dXwl9M4mlPefKe/2fkirEs7siAnjgbOwVqM93rUYb8MTjVPIQqxUx7nDylj//m+EKib9cizms1TlskbXrkOTxyfph+tV1sTPicmvMz1hben17Uc1xIl5VIC8v2u+/r40zEjZFO08K0g4l4bXYeYN0/w+/tOtuIgR6JQTM7eKgV7OdnaRqHK2MFsDGjnBBUAeTld+MKIDFEOaN58DYbxu/KQ6D27DEvQq1GBoPaXMYF2w1NL/DLXP5Ou9fA= 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)(366004)(346002)(136003)(39860400002)(110136005)(8936002)(83380400001)(8676002)(38100700002)(8886007)(54906003)(4326008)(316002)(38350700002)(52116002)(2906002)(186003)(16526019)(1076003)(55016002)(6636002)(26005)(66556008)(86362001)(66476007)(6666004)(44832011)(5660300002)(66946007)(36756003)(2616005)(7696005)(956004)(478600001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: ndfs3WqAIQoPpQBYTptZTEqSMqZRvwDRv+0+R0wRJ4nXXqBHAGEVVd7pZV5M7kC17KmD7WXppz9HjA6MT8oN7q7TBslXRUHaEjKQA8FVoJFmKcQs+9HPADrjuY9eCC62OQXlYyQUoKuEps1gGnGHswB1huZWou/0punbEACjNxg8MQbDBtr9YaEeLGdBctuMUeHQccirCaVNPJtBEBQSkOs/gmGdta6CDLqAKQqB1B9Sg/ohwa+bBOlXTeb7Vjber6ry/92Y3B0Vy8KZfbHqdUj861Fq/vJFiBhDqog/vDoyKDEuWZQAPYcGx6iZW1aLQXLAXAvPJfJcVHt46E1J5k1wbPyTV7F2Bh2cuXSRFCFak8Zn1W27hjMwDydIOCNOSk+GlhDXLqBwn6JWuayuEUOBN7ZPWws7SE20sz7uPtB2YTOq6Q8vRGKcAfSrLC8MfOBMIvXszuPsGBSTq98buJ4IN+3vFq9ssm2eqpQTU3yLz+iK+8qKpFBaCp11wAP7/7HXDWrp3I1+HaVTGftIZd4SjWaoIJ2Lkj1aTA8NQqP/wdwbFULJ3I37vT4VcHZu0yETbgYWEPeXI83YeWFGK8RX7KkApGWb1JOnEOJfqg1nt40bkSNsBvkIKrsHVhliS9qfEwy9NWfKE8rv0k/R0owibDeVkI3L6AeRxAQuhZtU6o30XOotISXb/X0mB1XEwrBIuTVCwb9pC1kjJfdE6+EHwg8XK1NPbPJKhpvK+/zh39WriIx2RVvTWQLnV80PuvZK3Z1M5HTGt1cAxlwMJoySGcQaUbo3sEwjQL3sIX6+IYCp0BK46+78OzQjCJADshjQg3gqnLjktidoEE4aUVagD1gwNHet6sPXSkDj39Qhd1APQzgVTUGflAyNoRak2o7TJ1VhkGcgV9fl1w/Lja733VJQtmLji9/9bbF3dUF54uH2BsAqEvAxbcE8dGgYOccwSznKrS3p3daxJCjjU5SElw1lVl9lzLC9XDY3dq9ZHd5UnDeGbFBAuY2I/pVAq+JqFJmUPeIDQyCB4MuNqAFnYfaCG3kVLgfe60fQ14pzqGclfMxTsojJRaupxD1+3DeQUBmdxxV17a9Bngg+jeeNfMEAguWSpL64Qr+V39GHb1b8fRQ2kJv97dY3lgpSEjTokzMdzvHnJbp2ckdTCateQNhSmaF9TY2+22o66Oq887o41+ACz4LWRfzM+7eQAxbshOdsI+5IpZCkmoL0GrIGt54Se+vgePk8vFF14PC0TPte9ihzWywZHjGUy/bU0bTEdJKpQr89XQTsLxZfzcaJga8NVlDV2m5eLO75R22D6buTdmceN2DJ2KPqE2rJ X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 985edef0-2680-42bc-cfc3-08d8fbf0de54 X-MS-Exchange-CrossTenant-AuthSource: DM6PR04MB6201.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2021 07:18:41.8065 (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: SZweY0fnfu56TCim5ij/mGhHiqXDH7qbED1o4RjUcoPmezIuhPWZ6cPWZphrmQnDWq0dc40PEJu2K1rW9Fwc0Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB6362 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210410_001843_909273_9415BA05 X-CRM114-Status: GOOD ( 13.03 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: The domains are boot-time system-level partitions so we should allow platform support to register domains only before hart domain assignments are finalized. Signed-off-by: Anup Patel --- lib/sbi/sbi_domain.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [216.71.153.144 listed in list.dnswl.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -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.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.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The domains are boot-time system-level partitions so we should allow platform support to register domains only before hart domain assignments are finalized. Signed-off-by: Anup Patel Reviewed-by: Xiang W Reviewed-by: Alistair Francis --- lib/sbi/sbi_domain.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/sbi/sbi_domain.c b/lib/sbi/sbi_domain.c index 195c941..2849241 100644 --- a/lib/sbi/sbi_domain.c +++ b/lib/sbi/sbi_domain.c @@ -19,8 +19,8 @@ struct sbi_domain *hartid_to_domain_table[SBI_HARTMASK_MAX_BITS] = { 0 }; struct sbi_domain *domidx_to_domain_table[SBI_DOMAIN_MAX_INDEX] = { 0 }; - static u32 domain_count = 0; +static bool domain_finalized = false; static struct sbi_hartmask root_hmask = { 0 }; @@ -376,7 +376,8 @@ int sbi_domain_register(struct sbi_domain *dom, u32 cold_hartid = current_hartid(); const struct sbi_platform *plat = sbi_platform_thishart_ptr(); - if (!dom || !assign_mask) + /* Sanity checks */ + if (!dom || !assign_mask || domain_finalized) return SBI_EINVAL; /* Check if domain already discovered */ @@ -490,6 +491,12 @@ int sbi_domain_finalize(struct sbi_scratch *scratch, u32 cold_hartid) } } + /* + * Set the finalized flag so that the root domain + * regions can't be changed. + */ + domain_finalized = true; + return 0; } From patchwork Sat Apr 10 07:18:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1464591 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:1:d65d:64ff:fe57:4e05; helo=desiato.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=desiato.20200630 header.b=eVaBA0Te; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=yD5HzMW9; 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=XPTMW6yK; dkim=neutral header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-sharedspace-onmicrosoft-com header.b=WVxZLh1y; dkim-atps=neutral Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) (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 4FHRFd4txmz9sWT for ; Sat, 10 Apr 2021 17:19:17 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cPue8eMfBlJPWG5DRr5fVo7QvlNZYNmtawo/XeO60BM=; b=eVaBA0TeMmxnZ4nnLBaJcb0j8 J/KXB7wfbbbvxHbd3nNwyLDKSmul8xkIpG+LnCBi62/Qy09Q1TwN1DBZRLWN3Ob2Ln4gi7yw+tk6S djU5EhfbvNQIRRECzIMBL4b69F3AP+UpvUA0xh75N1+MF3Igi1dgxrAhsZq/0vmcvjMx+qtbKFPeH Ui/BAFrLZD8Je3Z1rbWPpoBEc7O8YQsDESd7ROxv/czXfDBPf7Es6bgTiq7hnxtAcj6JHOCGLoFql 9PRlUo2AYX6zn6aoe4u74HHydjGKFIwh48f6v9ozIDJEq3rydY7Wr/nHgDvqpG5sngC/f4MpT1bB6 A3WuwKJrw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lV7tg-002M4P-5z; Sat, 10 Apr 2021 07:19:12 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lV7tH-002Lzu-R9 for opensbi@desiato.infradead.org; Sat, 10 Apr 2021 07:18:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=v1g3Jo0aXtmZEPoW5lGT8wMW/Oq60TpGaeBJJZQTyrc=; b=yD5HzMW9Q1JG6LL/HtApKH8qzx WVwvAs+i19WJpxh1OAQo4aWncZ5OxTyuF1Z4d5d3sRA2TmanCLc169XOpxpebxVPIJYCMK7WWyaDI 8yN1jboF6wwgKAzzOZken1Hwp6omnivwLeEdabR7ktyPHQRfWN7qFcAefGG8/YRXIyVNEufWqAG+g nXV2NJyWeZ60EdSFmYJskVBJ3IS7jtHdepho8QfG4yq0cEx023kS4fAdhWRog/uOj49W9wT5Ce3FF SEXYvjJKRBl36tti+jLNsEEDFYkc0p57nmRLY/6qBmFuG6wa0D6gj/r4p0cMvP33y+hgykElfbfid 0Fdv0WUQ==; Received: from esa5.hgst.iphmx.com ([216.71.153.144]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lV7tF-004yCo-5n for opensbi@lists.infradead.org; Sat, 10 Apr 2021 07:18:46 +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=1618039125; x=1649575125; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=vc5Yqlbj4QGQUYW9cYvnMOh/H3MMz2ED4lZKNIpwX0g=; b=XPTMW6yK4+C4CaKINIfhN/0amwPZ/7XeX6sFwUyBMGTApjYtmtIX1eh4 P+/+RJEIQXN9RZmvi1I9s95zuVOr7Am43rlOpPVk7ZdvJZTLt6qr0tTum 6YjnF19ngmVdChJ+ruCOZKjta496okgY3/mYebIWdq5eCXsqXTzvQVgdr CsDVN8prRQTJq7MaldvFN9cAXaoQ5Utyek7wl6qvo+nyAlw8tQGBzpiEs hVqeHW0+fY3AkFOQfq0wm2Lh+M+BW2oQTmVtzcYcs+Ul5aH3lP2lsTqzY w+KBDfHfePXe8MXWEuMAYyCvikEaxjxTGLBzNvnTB0UOr7hB88vgka71n Q==; IronPort-SDR: CCr2wp277cvyyOQqsvqc3ipAmlShw71Qi+w+61sZ7DL2r58Lp9jzKOciAbx869Z1inhzITDt8f nsrzKRtA7Kj239HknheTc4ykZbzlXSJeTGrO4y66Cp/egQwtVgnSwYRlVWQReBvwnRTXQzvrQh 5t2X/6FGLaDVA34I+Nk1HmJ2wFYijM4NXs9/x5zJx6eMgw6W1WvCr/602WJL9s1FlUwwKotdgc EBlX96JDyWvGLgDROw1t3DAecgCNM1Oj2aaljIqu4WQ/uxcL769t3BYpkNW6Wnf0I3UrqgNz2W Y3k= X-IronPort-AV: E=Sophos;i="5.82,210,1613404800"; d="scan'208";a="164366710" Received: from mail-mw2nam12lp2044.outbound.protection.outlook.com (HELO NAM12-MW2-obe.outbound.protection.outlook.com) ([104.47.66.44]) by ob1.hgst.iphmx.com with ESMTP; 10 Apr 2021 15:18:44 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PxlHS2bcZOOzSGaBrKS6QkzmcFr02luKcMJ5VjonFXqnzXqWpdnla0WK04MXLnX0OPGkQuAg1eNNDCqSDF2snFbKpPSLI1LjdMxx7SiSg/2YjmLctJLBlftLOEBss99pZMrmvnroFXpWr0EcuHamdK6ubgia8B+6GsdbCANBah3BQp6BJMuTttera3RSEMs54oMSKageSjPRcA2qq30lCtyoZF70QWLHJFJFXvdryAIf4ut7rMTd0TJyJnH9qYDIHdpIK+W8yW0JzANnvVfnXEuRxNlpJcSB/Ui1VGp+weCpP+q2vYh52mZ/qsTWA9HiUAOZXH0GtWay03Mv3VYoHQ== 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=v1g3Jo0aXtmZEPoW5lGT8wMW/Oq60TpGaeBJJZQTyrc=; b=d5yQUAuU2nCxLVoIU0ESWN4eYyLlW4A7/9kkd8Txqh5fSm9AvEfymq8Ik78Avl67HH1KrFkT/MpKcQkexrI5hJ+V2NE+IwXula6h/HnnzNcahfZBLGFY+qccvaxCPKS6ymu4Ss0K3NDjeYJSeNAi/WSrUq6xMNx5RLe4k/iATP6RO1nmV74un7glh41qMk8amVR0x4+7DkugFxOill1jC2YtfRMAJM5LKjAIWW+AhiocS4HAg30AAzm7Uo19FxBDd/HXNbG42b6U47S0MG0t/KBD3VQY6cyX1TGCv6SYbmwuLGcoGuNQedgZfS2ky0Aij4HKcBB5MxcuVczJdkoAVA== 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=v1g3Jo0aXtmZEPoW5lGT8wMW/Oq60TpGaeBJJZQTyrc=; b=WVxZLh1yi7A3NgzlMpXVKiDhRJqdya259IIyHK8J/Sx8uMRxYY3Ay672iti8nEDHjAfDxbPgnWdqKKpw8gWHSPC/99OnKwJYu2M8bXlBAiaVWzzFFITolQhThomRl6d1tWGbxK2Ih3kzTTVCWFa95/Z3KOf8j5NHiRtlSplrEN4= 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 DM6PR04MB6362.namprd04.prod.outlook.com (2603:10b6:5:1e7::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.29; Sat, 10 Apr 2021 07:18:44 +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.4020.018; Sat, 10 Apr 2021 07:18:44 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Cc: Anup Patel , opensbi@lists.infradead.org, Anup Patel Subject: [PATCH 2/7] lib: sbi: Add sbi_domain_memregion_init() API Date: Sat, 10 Apr 2021 12:48:03 +0530 Message-Id: <20210410071808.759856-3-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210410071808.759856-1-anup.patel@wdc.com> References: <20210410071808.759856-1-anup.patel@wdc.com> X-Originating-IP: [122.179.48.237] X-ClientProxiedBy: MAXPR01CA0106.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:5d::24) 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.179.48.237) by MAXPR01CA0106.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:5d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.16 via Frontend Transport; Sat, 10 Apr 2021 07:18:42 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7ac3087e-1d25-4eaa-977b-08d8fbf0dfe1 X-MS-TrafficTypeDiagnostic: DM6PR04MB6362: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: R8ojWht1oYiPETOxht0OSPgGfI90Ja4l+IleyazxaPF7WI/GOPxts2EtGAjLzJpoyeptObz8DtPhVMMxVlYXXY5mTNmjMjdD5zAOUkYWu7C3foVOfrdiQQAiI/EnSSul5qxJcXkmF94fnhDmMeixTkszHLbUgD206Tb8a3MWDqVx0xAtWqQHrjIPFTvpZH6b18t/Xv23strH5exSu8NFWiWcj+C/cdDdgyX+0KxVt7EdMj7lQTFqoVzzyktM0yVVZFcQVPLP+iib+2l39A6uK6sl6htbl9lTXN2P6Z9Enz2m5JDtVZQVTsNzKnsxVhFSuzyUHY9Vp1dSgsKb7pZrUzE+AyauGISrnYruCHjpzZZ5LlXfmSFFQrARE/InUJTxkIoCaX/HrL6ipCmb+4TblQ07aqFJA+8zKFSt7pd/c1Qcv1OmsCanMDhnSFQQNyXfQ1wCNJ0rDQSG71R9y/nZsozW88Tef9objEP6If7N+zjptCde/A+2unYnNfwY45+ftivEccsa1Wwv2n31flHj9gXWLc3QoZ6u1Bf5/YLBF0GIaw2EacOepvby85D3drnOD1e7WGD3E3oGwpwU9xunYyOyCJNGIx+M+quE1dSzCvupgKY1gbbt0R6c/O2uvWbgX/S3F6MpNthz+FFo1f1YZsad+mn8H8ESIsmy/+6yozQ= 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)(366004)(346002)(136003)(39860400002)(110136005)(8936002)(83380400001)(8676002)(38100700002)(8886007)(54906003)(4326008)(316002)(38350700002)(52116002)(2906002)(186003)(16526019)(1076003)(55016002)(6636002)(26005)(66556008)(86362001)(66476007)(6666004)(44832011)(5660300002)(66946007)(36756003)(2616005)(7696005)(956004)(478600001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: Lx6CoaWxcDzmAfULDF5tyCRVVRGBJ98cILApvVKBqjtdFRPyKvfhI6Y6Hd0oV+hHB7DrIV6Ub8vifyteinQCvV6O0kdKbHukMfDZPlID/FHAfiWSck7r11JtOj8d2pQW88a8g8vDqwx/k4PrwyJacZSzrmR4g5g08ZgvLBKe2I5kDrJd/cGklHyZhRwTz9K6SHgqa4M/TY/YR6jz5QxHGehG1VB77HyKTsYFW21QvAvxU0W5YMi3tG4ZzpAaccna1iqq8fcANXBfvgXqDamuGo1/AY9QUburoDXC/ymMaL2RUspq+sJ4NRpfm7bXOu+TwGSt3QkQCXVjeHZIFF5KStqbS2kLaq0FxI7NefoztsG+69CH+v6/c+68cwGPskv7XwbeXI9XQSVvt1G6bJtTJoQjoDpFq94KWWR4a3/MvYkcufDK7zsD5H/2ojMVRMS0Yfv8w8Y7UwnBtFX/8bIikhwlIZN1VH2R5NxeKuzV00qZNulr8O5Va1cpqyx//JsfaInjzuX+t49nrgvwYvAC87mew9ChKt48eBT9d5DQ4BejMmIpuSDDL9CDs37qX8n5Vp/GgQI7hd7C/NttM5pWqiWGHLPzaKnXJEP9s093lUA2KLrZo8SCo913DdNyw78d0aaNColnb7nIWT5v+nO8bF/f6CcD7tDwYndSo55TybipmFob014EgHx0qt180rpvIOtByZEPRLyJZhTjcEt2HgcdQnrMxSWM5C6MlmuXTjpGsGKegLnLACz2dhhadZyxRyuA9k5RbD/WsKnq9wYxxUkmZZYzeavaGNfw9ULf0GnXF40hQRjeMdnULoiCkUONfRrQsvvxz/4iLzJO3z5F+sSaY0qhOJ4bkA7TJO0I8yqbSxq8ABqHDiuXwOcDxPGmtiBHweu48qxXzlqk0iloq/zLjM9vWxQBcEh6ExM9PYcQrllD5Li+8enxH6mpmpEGhtOuobGkyvpN8nwKPfuqUD3JvHHclbO0u6eWeGfJzyA5fj2EXLTGngsNUeQgSwOO8/fXCudQZN3taM3cg35RlgYIaOm2CYMdcNStfprFwVbvMdmOMaGpp1G/FNT1Xk4vDjln9z3B6Wk1SWaH1Z2WatE0gUk9CeuT6qB4crQ+PG6Sj6j8IA/eNup8erzzyuB1oR5Cqn5v88ZKYRvCCbGqPoVNcGpmgeuSy3T4QWwI5tR70YXjdkR4xd96uh+f4OLKs2taQqw2Dl8814MCo/FqO+MkOSN6c9jzb0lTPm50BIULdOOXjK2kNAdDTGg0FrYILopBT/YF0RppGtflEC9Ujg98fRiGsCzSGe2gjzAAhqt9DdNEZvPFrxPXBaSiOBRA X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7ac3087e-1d25-4eaa-977b-08d8fbf0dfe1 X-MS-Exchange-CrossTenant-AuthSource: DM6PR04MB6201.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2021 07:18:44.1490 (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: q53CUFIji7n1/pvqY8O2YZMef7k1COa1zS1WT55MICZwI763DjXFmv06oPSGdBBIZscC7op6ltmjP+B0p5kRVw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB6362 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210410_001845_291103_4C614B01 X-CRM114-Status: GOOD ( 16.14 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: This patch adds sbi_domain_memregion_init() helper API which can be used by platform support to initialize a domain memory region before adding it to the root domain. Signed-off-by: Anup Patel --- include/sbi/sbi_domain.h | 14 +++++++++++++ lib/sbi/sbi_domain.c | 45 ++++++++++++++++++++++++++++++++-------- 2 files changed, 50 insertions(+), 9 d [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [216.71.153.144 listed in list.dnswl.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -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.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.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This patch adds sbi_domain_memregion_init() helper API which can be used by platform support to initialize a domain memory region before adding it to the root domain. Signed-off-by: Anup Patel Reviewed-by: Xiang W Reviewed-by: Alistair Francis --- include/sbi/sbi_domain.h | 14 +++++++++++++ lib/sbi/sbi_domain.c | 45 ++++++++++++++++++++++++++++++++-------- 2 files changed, 50 insertions(+), 9 deletions(-) diff --git a/include/sbi/sbi_domain.h b/include/sbi/sbi_domain.h index 1f8b942..f9f4f7d 100644 --- a/include/sbi/sbi_domain.h +++ b/include/sbi/sbi_domain.h @@ -127,6 +127,20 @@ ulong sbi_domain_get_assigned_hartmask(const struct sbi_domain *dom, /** Initialize a domain memory region as firmware region */ void sbi_domain_memregion_initfw(struct sbi_domain_memregion *reg); +/** + * Initialize a domain memory region based on it's physical + * address and size. + * + * @param addr start physical address of memory region + * @param size physical size of memory region + * @param flags memory region flags + * @param reg pointer to memory region being initialized + */ +void sbi_domain_memregion_init(unsigned long addr, + unsigned long size, + unsigned long flags, + struct sbi_domain_memregion *reg); + /** * Check whether we can access specified address for given mode and * memory region flags under a domain diff --git a/lib/sbi/sbi_domain.c b/lib/sbi/sbi_domain.c index 2849241..164f35c 100644 --- a/lib/sbi/sbi_domain.c +++ b/lib/sbi/sbi_domain.c @@ -72,6 +72,35 @@ void sbi_domain_memregion_initfw(struct sbi_domain_memregion *reg) sbi_memcpy(reg, &root_memregs[ROOT_FW_REGION], sizeof(*reg)); } +void sbi_domain_memregion_init(unsigned long addr, + unsigned long size, + unsigned long flags, + struct sbi_domain_memregion *reg) +{ + unsigned long base = 0, order; + + for (order = log2roundup(size) ; order <= __riscv_xlen; order++) { + if (order < __riscv_xlen) { + base = addr & ~((1UL << order) - 1UL); + if ((base <= addr) && + (addr < (base + (1UL << order))) && + (base <= (addr + size - 1UL)) && + ((addr + size - 1UL) < (base + (1UL << order)))) + break; + } else { + base = 0; + break; + } + + } + + if (reg) { + reg->base = base; + reg->order = order; + reg->flags = flags; + } +} + bool sbi_domain_check_addr(const struct sbi_domain *dom, unsigned long addr, unsigned long mode, unsigned long access_flags) @@ -507,17 +536,15 @@ int sbi_domain_init(struct sbi_scratch *scratch, u32 cold_hartid) const struct sbi_platform *plat = sbi_platform_ptr(scratch); /* Root domain firmware memory region */ - root_memregs[ROOT_FW_REGION].order = log2roundup(scratch->fw_size); - root_memregs[ROOT_FW_REGION].base = scratch->fw_start & - ~((1UL << root_memregs[0].order) - 1UL); - root_memregs[ROOT_FW_REGION].flags = 0; + sbi_domain_memregion_init(scratch->fw_start, scratch->fw_size, 0, + &root_memregs[ROOT_FW_REGION]); /* Root domain allow everything memory region */ - root_memregs[ROOT_ALL_REGION].order = __riscv_xlen; - root_memregs[ROOT_ALL_REGION].base = 0; - root_memregs[ROOT_ALL_REGION].flags = (SBI_DOMAIN_MEMREGION_READABLE | - SBI_DOMAIN_MEMREGION_WRITEABLE | - SBI_DOMAIN_MEMREGION_EXECUTABLE); + sbi_domain_memregion_init(0, ~0UL, + (SBI_DOMAIN_MEMREGION_READABLE | + SBI_DOMAIN_MEMREGION_WRITEABLE | + SBI_DOMAIN_MEMREGION_EXECUTABLE), + &root_memregs[ROOT_ALL_REGION]); /* Root domain memory region end */ root_memregs[ROOT_END_REGION].order = 0; From patchwork Sat Apr 10 07:18:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1464590 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:1:d65d:64ff:fe57:4e05; helo=desiato.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=desiato.20200630 header.b=gBi1rIXk; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=J1LujKmT; 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=IC1z9cvX; dkim=neutral header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-sharedspace-onmicrosoft-com header.b=LXkG+uw5; dkim-atps=neutral Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) (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 4FHRFZ58Q7z9sWT for ; Sat, 10 Apr 2021 17:19:14 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=naa7g+zO5OGiEtIs303TBNzEm/kwDMlpcB7p1ItoEw4=; b=gBi1rIXkPmioneB+sg0OV3eHY chfe/ZWxoOCbRZ1IQZ2dcJ/tQVUuVhOvYk7I2JZ6Vg+6Lk0aeNSL6p/3FxrM6gcMqjbSs6gHHd31W 46VzqU0e6eYXEt91SPwgv9sSgiSphxXYiavxDZPCB6rSgj/03B7kxj5ngh4b3GTHjxP2Wc+CZti4P Ulz+iGoZvueGGYXkjEBlCkSqVuJKPqp0GY/DzhqpOvA76AFklTf+rjAL2hBs1x4utmeAZeKiEAJcR wu52pA3T/V6PrHuZw+cOHB+9jCRC0p74Dz+mJUEeDkvOdyZx4paeDhPvTvoVZT2kafzKrTeVqiC4j etvwgxAoA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lV7td-002M3u-7p; Sat, 10 Apr 2021 07:19:09 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lV7tK-002Lzw-9e for opensbi@desiato.infradead.org; Sat, 10 Apr 2021 07:18:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=QEhUTNBQBVBc0gnU2MprDKRyJ4JUFnOqejD8M4XNuvw=; b=J1LujKmTk4EJlYpo31VLRCZQ5d 0hsqyYzOfO0HvmWpYkqDUf8mHyYAFjVH6jXieCYJ8vIjeQBReNFWV7iwUYUBjswygoIvhKtLgupdd uAV/IEa5St8WIRFZAh0ozaIRzgLJSE+dO9TdmL7X0XprUdMC3edDiMQcCstty72Zt92gVAz2NLGtf JMRSM6WJSYdknrKmJtdQ7mlUDADFjT33VlJTgaOR5nsZh3d71RinTOwOPMslJIHvcDy0GXJSj2fmK O771/ksB6id2jTbpWOJUSYmzfkrt2E+bZqWf3bZ9zouXMbo3NqVvweyr/E+rQ1OZfBQAqwHYe1IjL y2EbcriA==; Received: from esa5.hgst.iphmx.com ([216.71.153.144]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lV7tH-004yD8-Jl for opensbi@lists.infradead.org; Sat, 10 Apr 2021 07:18: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=1618039127; x=1649575127; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=UV4urBkJ4XABczrO4eVk1O9dxaE0dXxVrhKR89msrQQ=; b=IC1z9cvXB4UEWCvoSZqqTYk/CLrFU8YMcvpn0vl6hsqwn4+nmEk5rnQS sXGeuSqS0IKsPmib1reVykL/QNs2pViDWlv95kHisinOjW9yXf7lIKPoW wFLETgIN91V1F6AwpMMLrjX3cAqSilfENTZxoV8KM84FNlP6nVne1E+mJ FveIdnRsB46hJolcZI82c4/xDtIO0GiQlL3Bo7hD7w3d2CKnydNnFzX/M C/dwg50i/yOA1SXpV5dwmBmC8LQ8wNE9bWYYgSdWYJh9c4MuH2FGx8y/P emsrG2o3FIx6/u7qCTlNHStmyEUWSp7SBZkrPX8xruk9n8KtxWUnhJwd4 w==; IronPort-SDR: vlMl/AQSZrFE+llxlVI7xtTnBURRSmoEc2vryzDLoivH8EP4RHLgchrxkXm39Eve/l0kidfkuU Rzc2/7dz00MJpZ7Yiij0GG4vQ4Vvw96snxye4sFqlSsgiOFv/sGlhC56owSBYn6V5qhZy6YsEv vnC4IroRXPNMfG6JcRoqM6ruPF1nFiGMoOklgrRGad+hFOHrmCIK3IM9i94YVuYVQMds+yo2nw trx/tJQnbwXYiWX7zEQ6SE8oWmjl56qlW235ycKLWtQZxkqQVQFl3bewY8pmOQnGh2MSXFgA93 Kos= X-IronPort-AV: E=Sophos;i="5.82,210,1613404800"; d="scan'208";a="164366714" Received: from mail-mw2nam12lp2040.outbound.protection.outlook.com (HELO NAM12-MW2-obe.outbound.protection.outlook.com) ([104.47.66.40]) by ob1.hgst.iphmx.com with ESMTP; 10 Apr 2021 15:18:47 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F6uazhRsaNBlVQ0ig5aEa60WyY4ts3twADSajeWp1DzneTpwFPyT/kg79UwrSgt78MtVpIy/vOWqHLi1ZB4X4rf9ilKHtocJlNXer4ft9uAY2Oiyw6/A523gQh2K6Fgnsr3FO+DqxBHiK9AA51W4vc12P43TEawFsAmjH0KjqSKZPWK8bqDsifiZKv/gqSLJpVngPdWIzXmfCbmeRZ2hAGEHyu4NQF7SclIb3jD/D/nPM0Wwq4b1X+6s0/lkkTbr+0oOHbHTBRqE0lQ+TlD2WDYPurBXruH3ftRPPbDeCil/5W//0JUV1mrEvhJkaHr6MGVFVkjEmDBfGhSBk2UYng== 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=QEhUTNBQBVBc0gnU2MprDKRyJ4JUFnOqejD8M4XNuvw=; b=F6nmd46R/318/RmMd3g4+SslgSdnuVop+vOIklfr07B98MSipZEygFnTGRKpKpLytj8PiZIht0tZldklkzSBJ05fnxexiL1WsBt0AnncgslhJal/PTXgCDciDdra5Xmz5eLZoJD7X4O6WkEqEYTGI0E+yvl1DMoIBHBN7aLa+T6EmIvYATpXGrDrBFuFPDEQjWQVEU6cz82v+Eg0U02oFrtPEdkkmi1c7QPV5ji0nuIAB4qNHRRztNmE77BqMeJcIhJMpUXHJN+gcZlnnrKmJTdFUhX7BeftNoZiovUQfU+9p/jhsSpX+dleX11JGrAYIQ6M2Jj+WGgi/jHhYSs/qg== 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=QEhUTNBQBVBc0gnU2MprDKRyJ4JUFnOqejD8M4XNuvw=; b=LXkG+uw5qGeo9GNXIjnrYHyWbPvohcftCwmMHta0FA/ztatiMFHWGsM540Ny6UQi1pUbwg2VQ+q51wnZhMdHnHOG9Hg6g1ciFBAK2tk2nb2OXtsbp6F00+OmBmavNqmTNtHIRPu2FicBzL8dLFJjP2NA+y2feU7AYRsUrZeRRC8= 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 DM6PR04MB6362.namprd04.prod.outlook.com (2603:10b6:5:1e7::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.29; Sat, 10 Apr 2021 07:18:46 +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.4020.018; Sat, 10 Apr 2021 07:18:46 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Cc: Anup Patel , opensbi@lists.infradead.org, Anup Patel Subject: [PATCH 3/7] lib: sbi: Add sbi_domain_root_add_memregion() API Date: Sat, 10 Apr 2021 12:48:04 +0530 Message-Id: <20210410071808.759856-4-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210410071808.759856-1-anup.patel@wdc.com> References: <20210410071808.759856-1-anup.patel@wdc.com> X-Originating-IP: [122.179.48.237] X-ClientProxiedBy: MAXPR01CA0106.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:5d::24) 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.179.48.237) by MAXPR01CA0106.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:5d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.16 via Frontend Transport; Sat, 10 Apr 2021 07:18:44 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: da2b47f3-158a-48ec-c271-08d8fbf0e142 X-MS-TrafficTypeDiagnostic: DM6PR04MB6362: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:849; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UoZ18HoE0dHAuqVe6xqDn+1wB24ywU/ktkpv2pkOYaIlWgfRa7gZlkLKjWa3Ao/jyl90mwnJsqGmqzRGH4mATEZ99bJw0YOR10fXpY7XcBbZPjmeE+GWPsJ35vo6B4jTgIZyhrd/MEHERvvYdqtvwiuCj4vKtYRBqRKvXRjhAGmrmM6MfZvpy0Ryr+NIMv6R1Deytw/yrBdju2Q2r3SA1xHujxi+Zfn7nVtmFhhcswpNbx9JyMSNKh51HXF8GovnVvMmWNMb7irI9Ky5I3jBcNdHFDVDtaUhOeT8GLudw7YjXmy61lWxOSutp+iHWpH784OinCWp8eDuVbkWuEQSmoQ2dImZF3rQW9WUEAZ9EkJIA2tKaOFKmalIRTTaN80A2ZpzAZ+ELeXimQfZYXJXaUtit7j/9gSSC/pldMnGllMcPg6IIa+ubuQneTrVvFfUVKnJ9L/7ELNLEMzLFmEyTBDyUznoKRCG+ycpmlQfAJZv8X5jKPRYOpMGlorn/5uZ3KmfiQg2IX4MWK2+TYumPPBCL4RW8WBQr5XavkwJfaVzzPkPKdf0ecv8XirftYP5MRfUEtRqc0bPqYoZnweZomE0c6jRlhpMY9Q/7Xs7pjWCIf6m0fOaBWKm22zLU8uJ6WdgNjYflqCvqL8xinclyKzUCxXYk4BibOlif4ve9vE= 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)(366004)(346002)(136003)(39860400002)(110136005)(8936002)(83380400001)(8676002)(38100700002)(8886007)(54906003)(4326008)(316002)(38350700002)(52116002)(2906002)(186003)(16526019)(1076003)(55016002)(6636002)(26005)(66556008)(86362001)(66476007)(6666004)(44832011)(5660300002)(66946007)(36756003)(2616005)(7696005)(956004)(478600001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: sjQISB+nhrgk3uaFf1ccU7rXAFSURDD1zJpzc2KUVdmZzD2zQXFQgKfEvCzz8frKaYaFEXQsYIc3IKZVo7vLlAY+HtNlUFQ/OSy1k+0A0MhIvCoV2mOAloYUEayN52Fn4b6eYdgt+Vzpacqq87fCXCsv/3/1e6xCCuD2F2GcIp03H31bw4LNsDE2MsICC+CbSGWYXMEfWAi6cLr5SuO3ptPcw6UpsHcA3aHxfS8xmror4cXF/8abIWcbYWb5R3zo/9qZtw9a3hqhODUXorRqjaptJOfKnFF4qTtR/ygkY7Rl+DiY11Qxe6HQK4jazd2psxwBr5aw6ys5tm28eLcEopYjrmkFPAy927hbOxCN3bVTYYEl6TiOQlPmlpUPetkyywWWwRE8IqcAywMUWSPchir0bYaq6vMpSrX3avMjwbBMl4Q5JtT3WLCZDcT/oAcYub9gGX0EtNAGYak89sTYBlNSEIpliZWHznsCsxRXXdydDEMB0GB0AH5YF1VPJ7zVlbngzChe7nLv65lzXzd9rJhr+NzZQAVCLV2C9d3Z47itjLUrjDuTTB6AHI1NFuGxMvy0nTu0GvggaW0C0xNSzLvTeq47VZ9y7sfa5/HZVsTUzmc0UNkMqBme2l8+BeD/nddFnQoNPBFiffzk+4DKxeWf6LX7j1ZseVsteuTV1anDm+SLnJn8glE6I6P3rkJzPl/GSFGQFN62iT2++80HBOvg0HaJFZ9WiIZu40p+5wt9bwMqavTLnh8ARbhY8A3rUNh9s3vCyLtTVS4KgQqQ8QUbdLc477TS+CF2lDSv7BUsIfRRabkJ2gvfbor/MlqSIHnYSqSB9CrBE3OvR4V74bj8bFd3MW2d7ltlz8ltO5cVxSekPN9JSvvlumuWljvx7n9/V4+KNXzBeU4VrP2hEZsodog34ZmjM+VPqmy1XbieX4eM0Cb9i/ghLs4geM4y7F6FpLK9aYBa4v5BNHXisivIMqm/ZxzUDw+TsAfpmrFkBXXGY+//xUBEmUER8YCq/WMxMxUQtRSByZaMosuVm5t9JQhnozr9Ar+UkCQnj74PJ411DR2vFX0FZOCT7Z2czNwZzcefKRQsG76bs0VchhlqF2IOXv9iImuW/CUmhQD449+xLQInILvuwPzgasHHs51UFuQoWD94xXHZ5X/2q9TqiJkTB4H+9SBWdd47PjLhECOtPDuTcVLFaRt9kYTjKYEkHX+eXAlyOWnG3136IHdWIezOwK2fw5qmIhCv3GMGpsC/ORAXv9ubOg0Dv7mPi0vIA+iMu0EDZySMV/3wi3c9MqdgARWJH+7WFwHz/iptjEbQPfk1YNydnkOczBNZ X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: da2b47f3-158a-48ec-c271-08d8fbf0e142 X-MS-Exchange-CrossTenant-AuthSource: DM6PR04MB6201.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2021 07:18:46.4765 (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: TGA0UDry73+bSreHpJ19Aa5/S76fVjftmj1OWRqjg4sPonqUsMiYd5wTA6s1ZCth99mKP9TgYK1fuhRWrDD55w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB6362 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210410_001847_685561_716B0135 X-CRM114-Status: GOOD ( 21.43 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: We should allow platform support to add more root memory regions before domains are finalized. This will help platform support to protect critical M-mode only resources. This patch adds sbi_domain_root_add_memregion() API for above described purpose. Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [216.71.153.144 listed in list.dnswl.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -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.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.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org We should allow platform support to add more root memory regions before domains are finalized. This will help platform support to protect critical M-mode only resources. This patch adds sbi_domain_root_add_memregion() API for above described purpose. Signed-off-by: Anup Patel Reviewed-by: Xiang W Reviewed-by: Alistair Francis --- include/sbi/sbi_domain.h | 11 +++++++ lib/sbi/sbi_domain.c | 62 +++++++++++++++++++++++++++++++++------- 2 files changed, 62 insertions(+), 11 deletions(-) diff --git a/include/sbi/sbi_domain.h b/include/sbi/sbi_domain.h index f9f4f7d..b5f2f38 100644 --- a/include/sbi/sbi_domain.h +++ b/include/sbi/sbi_domain.h @@ -170,6 +170,17 @@ void sbi_domain_dump_all(const char *suffix); int sbi_domain_register(struct sbi_domain *dom, const struct sbi_hartmask *assign_mask); +/** + * Add a memory region to the root domain + * @param reg pointer to the memory region to be added + * @param skip_conflict do nothing if a conflicting region is already + * present in the root domain + * + * @return 0 on success and negative error code on failure + */ +int sbi_domain_root_add_memregion(const struct sbi_domain_memregion *reg, + bool skip_conflict); + /** Finalize domain tables and startup non-root domains */ int sbi_domain_finalize(struct sbi_scratch *scratch, u32 cold_hartid); diff --git a/lib/sbi/sbi_domain.c b/lib/sbi/sbi_domain.c index 164f35c..8afdb5d 100644 --- a/lib/sbi/sbi_domain.c +++ b/lib/sbi/sbi_domain.c @@ -24,10 +24,10 @@ static bool domain_finalized = false; static struct sbi_hartmask root_hmask = { 0 }; -#define ROOT_FW_REGION 0 -#define ROOT_ALL_REGION 1 -#define ROOT_END_REGION 2 -static struct sbi_domain_memregion root_memregs[ROOT_END_REGION + 1] = { 0 }; +#define ROOT_REGION_MAX 16 +static u32 root_memregs_count = 0; +static struct sbi_domain_memregion root_fw_region; +static struct sbi_domain_memregion root_memregs[ROOT_REGION_MAX + 1] = { 0 }; static struct sbi_domain root = { .name = "root", @@ -69,7 +69,7 @@ void sbi_domain_memregion_initfw(struct sbi_domain_memregion *reg) if (!reg) return; - sbi_memcpy(reg, &root_memregs[ROOT_FW_REGION], sizeof(*reg)); + sbi_memcpy(reg, &root_fw_region, sizeof(*reg)); } void sbi_domain_memregion_init(unsigned long addr, @@ -236,9 +236,9 @@ static int sanitize_domain(const struct sbi_platform *plat, count = 0; have_fw_reg = FALSE; sbi_domain_for_each_memregion(dom, reg) { - if (reg->order == root_memregs[ROOT_FW_REGION].order && - reg->base == root_memregs[ROOT_FW_REGION].base && - reg->flags == root_memregs[ROOT_FW_REGION].flags) + if (reg->order == root_fw_region.order && + reg->base == root_fw_region.base && + reg->flags == root_fw_region.flags) have_fw_reg = TRUE; count++; } @@ -468,6 +468,45 @@ int sbi_domain_register(struct sbi_domain *dom, return 0; } +int sbi_domain_root_add_memregion(const struct sbi_domain_memregion *reg, + bool skip_conflict) +{ + int rc; + struct sbi_domain_memregion *nreg; + const struct sbi_platform *plat = sbi_platform_thishart_ptr(); + + /* Sanity checks */ + if (!reg || domain_finalized || + (root.regions != root_memregs) || + (ROOT_REGION_MAX <= root_memregs_count)) + return SBI_EINVAL; + + /* Check for conflicts */ + sbi_domain_for_each_memregion(&root, nreg) { + if (is_region_conflict(reg, nreg)) + return (skip_conflict) ? 0 : SBI_EINVAL; + } + + /* Append the region to root regions */ + nreg = &root_memregs[root_memregs_count]; + sbi_memcpy(nreg, reg, sizeof(*reg)); + root_memregs_count++; + root_memregs[root_memregs_count].order = 0; + + /* Sanitize the root domain so that root regions are sorted */ + rc = sanitize_domain(plat, &root); + if (rc) { + sbi_printf("%s: sanity checks failed for" + " %s (error %d)\n", __func__, + root.name, rc); + nreg->order = 0; + root_memregs_count--; + return rc; + } + + return 0; +} + int sbi_domain_finalize(struct sbi_scratch *scratch, u32 cold_hartid) { int rc; @@ -537,17 +576,18 @@ int sbi_domain_init(struct sbi_scratch *scratch, u32 cold_hartid) /* Root domain firmware memory region */ sbi_domain_memregion_init(scratch->fw_start, scratch->fw_size, 0, - &root_memregs[ROOT_FW_REGION]); + &root_fw_region); + sbi_domain_memregion_initfw(&root_memregs[root_memregs_count++]); /* Root domain allow everything memory region */ sbi_domain_memregion_init(0, ~0UL, (SBI_DOMAIN_MEMREGION_READABLE | SBI_DOMAIN_MEMREGION_WRITEABLE | SBI_DOMAIN_MEMREGION_EXECUTABLE), - &root_memregs[ROOT_ALL_REGION]); + &root_memregs[root_memregs_count++]); /* Root domain memory region end */ - root_memregs[ROOT_END_REGION].order = 0; + root_memregs[root_memregs_count].order = 0; /* Use platform specific root memory regions when available */ memregs = sbi_platform_domains_root_regions(plat); From patchwork Sat Apr 10 07:18:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1464592 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:1:d65d:64ff:fe57:4e05; helo=desiato.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=desiato.20200630 header.b=Atrjo7Dv; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=1QXs9+Zn; 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=EOoyW6eg; dkim=neutral header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-sharedspace-onmicrosoft-com header.b=nJWB8jLP; dkim-atps=neutral Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) (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 4FHRFm5Qq3z9sWT for ; Sat, 10 Apr 2021 17:19:24 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=nzD19+CFdEiWKFb0BM35iwhhuJc1zqDCFL2Wda8eh/g=; b=Atrjo7DvguYEbdsY/daczchj3 cxCLGEHz9br3xal+ejKmlLoGAbSxkAes3hj7QmrpibpF1yf8jpP7MrhMqy1Emu3mJfnEs+1oEHy9R Urh13UxCr8VM1owKFUJJNsABQzX5Npdv71NQsJufzfcTthek3igWxqCs+wh1H6IbNvHhULzGxAWu2 oMyNvX4IwhBJWWuvJOE+ajnpwDrgqu4H23LYg/h0ldxfAqUMZNfM47Nls2+ccmlLnoBhNqhXk8oL/ OPcewAXHWb/4m+BBP/OvMmnd1h+TMMiK5JwpCWXt5U5+SSVEsuQNvKKT4p4u6Xl/WT3SkhAnAvj/j IMenMHnhw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lV7tj-002M5Z-2V; Sat, 10 Apr 2021 07:19:15 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lV7tM-002M10-92 for opensbi@desiato.infradead.org; Sat, 10 Apr 2021 07:18:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=+KNxp4SRuVX199lrq7Augfad4BJ3X3WFnOmFj++Ye3w=; b=1QXs9+ZndZ2c/DfiFV3oR9650A jp9Yh16ikPnVyf6TpfzdjSMrVaEG6Yk4zNDjAJQ+D+4elJbX7c0QRgmC7K/8Nfwen9WGmGzdMYWDd aiT/3X5KQZoRBAJo4Z8fGihu6mFYq6/3jyxORa0305NVu+cf9aBfWW6q6c1g/4SWVCH7+8/Id845D yOsJiXoYtamze4eLRgSSm7EabtwQBAFQlYnujBaQm5NiMTSw+NU+Q55aArg6Z/wsRRwgEvreKkfgE pzPf+kf3Q6vyI2KTFPpUninHXaGJP5o5k+h5ElxCbbXGUUe4uj6iN9ZTWCNYPaleR4IMB419vJ6Ad FE5rcX3A==; Received: from esa5.hgst.iphmx.com ([216.71.153.144]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lV7tJ-004yD8-Qn for opensbi@lists.infradead.org; Sat, 10 Apr 2021 07:18: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=1618039129; x=1649575129; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=GZBUrbq3cHtXMUCFYp9hGtDoBnYJXLT6/J85A/6AjSU=; b=EOoyW6eg2EQtNVbK4fb/l57ie+zBTTDn2VJ77OBZSGJ6YkZQIbNpzuN8 4ZtBUZ6gwGAfoBpZIz5eiyGnNE6WCD2/SkoTlOS7W0boh0ekkbINKZhUB inIlxsfCwo6gCJXN+4B/zsmMEeGXIK8PUU4IDKOXOd/p2WEoxDJ3NE7Q7 xPcJSYwJuuJXrjZ8gkTa7x+vtNWukxNKPMrcHpGCmnonfA4qmcNhaVXI9 PX12d56GepHGuxosHkXRdeKd7wXaQeon/QpjCUZLXkd6lH+dpWeePUdPa Hs5zSQpx169sBaeiOMADGdi31rRQD2ONfYYaRuLrVdqbjrt7+MPmRAeVu A==; IronPort-SDR: 5/2w2OljazU0a9a/sLXVfdOc9UBzm3iVW2FDje/iNA//HCmoGPW93Mg3Aq3k/G7wScghVtKXYa qEB0ti1w2lGAtQoIvjAyo0JAkJnDEd7tgTB0bsIupGILkgXKKektvmFOHP6RGs9u63QLae6HfB 3DgycRypgzdwxhhu07X1JOOJ+JPB8IOVSPIkU5jn/jozBb5VqtqxmoDF9Z1ASR26IRQVrTdeSf 0HQG/E2I2wXNV0INmdEI1acDaANHCY5yWMJIlfWGdl0sDVGmFKUjTcOpzgU2q/rgBPGv1CGnDt pFs= X-IronPort-AV: E=Sophos;i="5.82,210,1613404800"; d="scan'208";a="164366717" Received: from mail-mw2nam12lp2046.outbound.protection.outlook.com (HELO NAM12-MW2-obe.outbound.protection.outlook.com) ([104.47.66.46]) by ob1.hgst.iphmx.com with ESMTP; 10 Apr 2021 15:18:49 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cczhOjGQYDHBL2BxzmyQSijtj5G/dlCZt0VMyefnXF5l9UDzTUmoIKdUvABlO+TVnomZ862krTmaVMBbZUEuvgc0P0hZhzXdLDtyYMxc2vr5MZdS9GcZ/oCiH4f55T3Z249lHFb/HyOpv9EnmEMqbo/Vi1IHk85WeoKmQI649UXxfV48dvYv4BhEJWjbSbgj+FTTLrgv4jlYIW6CRzWDWfGJX0FQvvW4SiUJ5zArfjb8v57pwa9oVIUclV2FwaaYozv62opsaCY72w15ylj0DilZKA4LIiPritdRTl74aQaLsgBO+DdtUe01bS3Lh1dVQ6Z/EqS+5wiN348yA0nhrg== 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=+KNxp4SRuVX199lrq7Augfad4BJ3X3WFnOmFj++Ye3w=; b=G4uwM6i7GyS5UZRQyFdcok8Smr3KeOz+2bp18dB5htp82XBV48yD8nMsYnO2+dVHoGxxigWr9Z1OtoUHpqm+zKYRskvptp62n1sxinG64dLSrrxszrdTnFmUZZ5Kn0GuO/YMo7+VJt9mOa1cgtR9IwqK6p86L3CHnBUqnJD5D0vg0VQBaJo6wjMLLge64MSLJl/daA2NrmmnRiESXTv3qvLpEwuKVQbsdHJR1W02Exhc88MP04gwvlLBPaPHO4eZjMHORHfpcGsxcJPUs7+nNyWGVEbqnhUXcVD59WfBhy7pmnOBXt8uKfaJVYl1z6H4Z2XnrXmZOD/vAitSge9OGg== 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=+KNxp4SRuVX199lrq7Augfad4BJ3X3WFnOmFj++Ye3w=; b=nJWB8jLPZK4vLrszLj8ItjlEH3GEGOxwAQ81e7kh9yq4rNMsC3y8Ex7zFaTUY2K2Jq55DknXTVwyu1qAFUqwk6FsnmShWY6+fcf+Rtb8m8kxuUEOv1J11gA2XFQfhxI36BNyhbarDV53aWYS1oqu8lwVTD+M7BGOIjSSAfQFoeI= 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 DM6PR04MB6362.namprd04.prod.outlook.com (2603:10b6:5:1e7::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.29; Sat, 10 Apr 2021 07:18:48 +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.4020.018; Sat, 10 Apr 2021 07:18:48 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Cc: Anup Patel , opensbi@lists.infradead.org, Anup Patel Subject: [PATCH 4/7] lib: utils/sys: Add CLINT memregion in the root domain Date: Sat, 10 Apr 2021 12:48:05 +0530 Message-Id: <20210410071808.759856-5-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210410071808.759856-1-anup.patel@wdc.com> References: <20210410071808.759856-1-anup.patel@wdc.com> X-Originating-IP: [122.179.48.237] X-ClientProxiedBy: MAXPR01CA0106.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:5d::24) 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.179.48.237) by MAXPR01CA0106.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:5d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.16 via Frontend Transport; Sat, 10 Apr 2021 07:18:46 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e97b7fb3-217d-4e40-808e-08d8fbf0e2a8 X-MS-TrafficTypeDiagnostic: DM6PR04MB6362: 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: 71131dn+GB3xxxblVw284d/tUqB7k4f70jQyB/8D0zVVWJmCQM/D/RpACClFgekk/M16Z0soKqOVL3v5onlJojziNxQQ7Xp0pdgX7Jp1yq8fsfglc85KU12lxr31Ry9UxfKTl/888LAbEbpU5axc3XxxAJ50Ef1Ep37UQytx385GYSpQIrza2fYjH++Xy7y1m0CAqgKVnoC3dFImP7lKQBS4+mZp3PycgNKIhdLNGJuhE1CrAPSsCCjgPP9bdBjeFB/4OJuMEbZA3FDRZHcS2X5iI+UgtxgO5GHIBKyEAIQVwUxH8EBq9UX6HC2jTXNvp+DXVFBvTdl4rtOQ3QYiqVxXzzrev5mZiKeRHYqoc7+4cdfhWSxR2ybThwNKWFMgwGJPcvlJ4HGilE7mf8LJiFy1Gly5TD8JcdPUOPfDQoZfALt3fEEMxSmc74heY7ayDcqFi2ie24vGXh60BziUZiUp1aVDidZdirWmRmd+tF0OQ1Cwf/Ikv6GiNtiZN/ZhOSJf5af/y9w75E0NdO7Ets4NpG3eWz7lkm8iJty6149nINjMe0FMyW6zbZ62cUTtMIcb2QqW8SpKH3Oq6l605fhBqASE8sgEYfYqi/kWmW/69dRVTKQIEE1h1dOfq8bDR3THSKUBrJ6jwno/bFdsEA== 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)(366004)(346002)(136003)(39860400002)(110136005)(8936002)(83380400001)(8676002)(38100700002)(8886007)(54906003)(4326008)(316002)(38350700002)(52116002)(2906002)(186003)(16526019)(1076003)(55016002)(6636002)(26005)(66556008)(86362001)(66476007)(6666004)(44832011)(5660300002)(66946007)(36756003)(2616005)(7696005)(956004)(478600001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: f7159lrw8ksSKtCug45gLn38brUSf6B28qYMstyRJB4AwyDBKmGc8dHE9THszwR4Bwqbi8fzLGwIOrsh9TCuRVMVegfTmbu/UYwwkrdKk+XDT9tQY/H8NmbQmlvLDbkcjTf4xxoS2a5jB8NYywd0FxxH7wsxydGyPWVSg/nYmj+i3iH88OS1QhhP9vKk++A1BcwR/OSL+yXDUD8tXHngii/BQnWhShMTICjcUn+w1vZT/cEzkz3kKKFp1Vzg+y6W2n64MWu2ZhP4dYa7EyvsQqBPfMdBgCRDPYoiLmTSFeuEe4VhPyMSYgLYES6mN3Jwf7KSgwtZQKfqrS5JNDe2fkJG2m8DglvVQP7cjSkHJ+WFDrmN+HHWIHNF5yk2HCHzfG/WYPnCFrAtuSe7OLaukQj9KOIIJHSTJsC4txtTRhBN1dXjk9zvoRui5KBG9wcaycnFvXXIlLYXeegJNAzjnocHLL1+4adLfs1jNYovEahW4MNuxPVOVkbaJJBHwGDR29HDbLuw0V5GFERyHrZw4Z8M0K4R4FDVV+yE/XJYLtsNdhDjYGXqt1G9kva/ScMR5PW084oS7F+BY2JLarBlE/6z4oqGnZG1bvVISv1+Ef+TyzKPwzEpEdpI/SjDM6ikaYngMBKaYpkIwS6fabnO45PaLuBTZSCoCRF6sMr1XkCk7VtXm4Vm3j6Va4ULMT0liORiwXGYq63W7yCR0UDq6YSfdMohEL5NrgRFaKJ56PM6bUSusb5er+L4EyxSNSLM8H8i8mwJOqBz7mzCcCFHCqco7+xr0to7GqQneYLiHsJ+jvn7Mk8BNa4QABCQR7zUI0C7cV52VBHWwnQC2Fda9Q2TYHB8nWJOGQlGmhHQian5/fEVgPyz37h2F+RjSVBa78mr3szYspLJwGGnOfm0b6Z/osiX9hlRlagbOhlv3aWGb8adA5sgu4A33HN++5KzFRGU6AzVTSVrT7EARMJ0gDLAosJuyGBKUfL1z3vNsHU4dCi1fIYysp1yu73qU/Mu0spSOrwu2DV43i3e/BJqS6TY/CrcFSvgGwPsgArJ1zJZ7JAamCC+6sgtsMY2j6esQVqDCS4qTW7kOi8izn5RLbdXK7a8r1UR0CqLXPgilYgWhcIPcHZ54UhFbdhS4Ln+z2kJ8f+4b3zkzhN730Yr9fVg2DUIiBOZXI19C9HN3VusAFXgOZQZltZgwOoSagoS7k8Nqk+JIZWVF4IZKlVXpBhytsFqsH2S8VBkJqwq9SPGjY5fU/fuWQVKT57f9vIcM1WGtW4UasUvbNukpnAVVBZDe7xPe74IlsOHixPv4mLIvWA/n40V4FPmRH3j7QV2 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: e97b7fb3-217d-4e40-808e-08d8fbf0e2a8 X-MS-Exchange-CrossTenant-AuthSource: DM6PR04MB6201.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2021 07:18:48.8050 (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: iole5Ewx6ML+Qjxpq80tl2k/9lOIz6aNiCC8pGBLZbzhuH+fJiYOtTHYQveXmrKbW97MoQ0UZng1yJtfYUkhaA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB6362 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210410_001849_903206_AF627551 X-CRM114-Status: GOOD ( 15.27 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: The CLINT memory should not be accessed by the supervisor-mode software so let's protect it by adding CLINT memregion to the root domain. Signed-off-by: Anup Patel --- lib/utils/sys/clint.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [216.71.153.144 listed in list.dnswl.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -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.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.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The CLINT memory should not be accessed by the supervisor-mode software so let's protect it by adding CLINT memregion to the root domain. Signed-off-by: Anup Patel --- lib/utils/sys/clint.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/utils/sys/clint.c b/lib/utils/sys/clint.c index 7a392aa..fe98cc4 100644 --- a/lib/utils/sys/clint.c +++ b/lib/utils/sys/clint.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -17,9 +18,19 @@ #define CLINT_IPI_OFF 0 #define CLINT_TIME_CMP_OFF 0x4000 #define CLINT_TIME_VAL_OFF 0xbff8 +#define CLINT_SIZE 0xc000 static struct clint_data *clint_ipi_hartid2data[SBI_HARTMASK_MAX_BITS]; +static int clint_add_root_memregion(struct clint_data *clint) +{ + struct sbi_domain_memregion reg; + + sbi_domain_memregion_init(clint->addr, CLINT_SIZE, + SBI_DOMAIN_MEMREGION_MMIO, ®); + return sbi_domain_root_add_memregion(®, true); +} + void clint_ipi_send(u32 target_hart) { struct clint_data *clint; @@ -70,7 +81,8 @@ int clint_cold_ipi_init(struct clint_data *clint) for (i = 0; i < clint->hart_count; i++) clint_ipi_hartid2data[clint->first_hartid + i] = clint; - return 0; + /* Add CLINT region to the root domain */ + return clint_add_root_memregion(clint); } static struct clint_data *clint_timer_hartid2data[SBI_HARTMASK_MAX_BITS]; @@ -199,5 +211,6 @@ int clint_cold_timer_init(struct clint_data *clint, for (i = 0; i < clint->hart_count; i++) clint_timer_hartid2data[clint->first_hartid + i] = clint; - return 0; + /* Add CLINT region to the root domain */ + return clint_add_root_memregion(clint); } From patchwork Sat Apr 10 07:18:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1464593 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:1:d65d:64ff:fe57:4e05; helo=desiato.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=desiato.20200630 header.b=a7nGskZi; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=DIaflL9v; 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=fMxV46e5; dkim=neutral header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-sharedspace-onmicrosoft-com header.b=AOEYTgzd; dkim-atps=neutral Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) (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 4FHRFw5HB2z9sWT for ; Sat, 10 Apr 2021 17:19:32 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=we+JQw7eXEn7LCgS3RSBSNE1TidDNF3K+AAwUzt+53o=; b=a7nGskZimv2n+DVT0+7335AEx yTBKc/Jp36d3lNXpkMemUn1O8jwdCi3HRFhrs1xrDUwZqBlXWXyLP6EjotYD0sXb4Yj4N+QV6sqJc TsIKzxeQulsYMlBIj4fRPZRnJBh2cFSMlfI4bBWyCUDkjyfJmNL0C3llzxgRfT3Xvvbj6NL9J9h1/ cyoEeEF25XY+omcdqcZzkRFti6q/Tg6+CxXQ+gRSVgkzEy0d17T76wZBtUqHOIyeeil3ZqCvnLbMe HmjO01sj9hR4U1QUE5imsVVfaDn+Z4Poe7j5WK1HdTRY7sMufQTR9yNCSQc8aPx3posATGp62DdT1 A+WO1OeSw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lV7tu-002M7I-MH; Sat, 10 Apr 2021 07:19:26 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lV7tO-002M1K-OF for opensbi@desiato.infradead.org; Sat, 10 Apr 2021 07:18:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=MQZvbrxUhZO5zerUnViGJFCZBXzsBKQ0Sq/J+xD0sX8=; b=DIaflL9vLYO6LgljMM4oeyXabE x+qxXc/jVg+uq+Sx0JtTBOtoZi3GiEjKWRZ/3jpk4kQy0yCy0AeBjiLVZ/If7BMg6ukcp2Op18UaJ yCphiigI74vj/V/Dt+sApElFnJ7Z2z/WsVxlkQEhSJseRgrwHBBQyyFB4rz1Y27ZLgrbSG2t6Inp6 Yd0rU4s7KEPJKbw2en8+YIMhdjgOnjblRJpjkex2mLONRwBdqLKeCiVqerXXPmoJjEmfdUrGACUhf mZP3nY0u649Yr5+yOt4avkZHPAatfD1TUr7uQsfK2nIv0c79U3auqD/KY/aULwnZFziZQqWsXkYE+ wYOudSug==; Received: from esa5.hgst.iphmx.com ([216.71.153.144]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lV7tM-004yD8-C4 for opensbi@lists.infradead.org; Sat, 10 Apr 2021 07:18:53 +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=1618039132; x=1649575132; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=NF+G83ypOd8Rbb/nA5tHSgvkzCQBRu8voAi6tQug1BE=; b=fMxV46e5vKA1/5UA4V2hV+4u9uTuAb1mcvZRvATyttF1lxYbCGvDQKf+ chQi/2Bh7wcKpZkIzP4Ey6obnjv+/5dr6Ek5LqalECXio+a9PzhstFjN5 F5JTYnSHaMPntMJfe9B2SwxtsV8f92Ck1dz6kqgu05Sp8YulSLJjhLRfw +AjMuHHAup/WL9Cpl5Golkm2l1lw912sX8kl/1AJUi9p6BA4RbHL/WzG3 9RjqMWa9hiRon1CU8WRF4tV090yGcrunKS4AYhm4RfJhCEa6TYUQ/Ag5i 5CaWltPJRJrltxjmiV/GRxgdptYVrjf2ufREIHoakhRsjxOC4ipE0yBtW Q==; IronPort-SDR: kluxya3qu+xebUNUtoaXjoxqbYRCmNP9ZEMISsNpZfafX3KRTbzkwe6Upd4qp33K8VBUYq9cfL Iy5TWJMXfNefUhVETwTr57X8+0nbNCijLn7t90af9gLFww4284POVGn0ySrYnZ251fpYaz0Bc1 TxtDc3p7bwG5JdfxY4qoZhNGmrtZFhYm4x1hBxmKIage/lNNANlb5DEFOzWOq6HrMbYVFvb8u5 jmOcEDeyuUS9BHRt5DV0Qin4grYLMNAd/5jiRllU/ez28u2faqeP82jdpUI1rltItbzTQbfqgI 0nI= X-IronPort-AV: E=Sophos;i="5.82,210,1613404800"; d="scan'208";a="164366721" Received: from mail-mw2nam12lp2047.outbound.protection.outlook.com (HELO NAM12-MW2-obe.outbound.protection.outlook.com) ([104.47.66.47]) by ob1.hgst.iphmx.com with ESMTP; 10 Apr 2021 15:18:51 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jau62/+5PeHKyhk/mfd/H3KXk9iBfhL9d82JcbUXwTeq/cjTK6GS/r2js/BS3CwxNIVeZsaNy28yr+VthnGm6X/lLOcbnwAdl1Y5ODpYvsHvNwKpAcepJd/D2Fq0cDFGR6G7sKcjQhVzB8rfe8SpggZawMK1rlXncPhXZgLNtAbMOTJtBr8KJ2Po2ad+8LNpTW9zrx6e/xonioy2QZhezLh5AtVyUxfbRjm3TuJ/Z5tSQK+ENfAdKuF9lnomiRZAeJEcZj612BI/L1fCQUiZ2MKOQrVt3hsqqCfEAx7Rfoy/2UhK6FaV6MbIP48bUnGS8gIpGsG+XKaBoMu9QdL1Ng== 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=MQZvbrxUhZO5zerUnViGJFCZBXzsBKQ0Sq/J+xD0sX8=; b=BLdbRKcMfSEu+Bd4Cd/hLChpEZiLZVqPgRu3Ry2KT10tyJTgkX1soYdxtr9ddOgiViljxvmoGsUOSgovZ9zOl1r+PfJqclHu9MVtJJUeeufbJdgMnt1YPsC8j4XTo/Bs2ScqyRgj2VON+6uv59S1/RQ+k1xcJmsYZXicjLg6Ni97qWrYGgTkZZ2v2OjoUvvq8hIqrlgLgFscdtSvtWjZaG6Suw9D0cwXH7jiUM5XmFlxi7xaKVgqYPywGjqySv9p0+zvhiKi+YlohP8ClhZvn0Vi1r25S1UhnAVKY7dRRXpqPGCleR3JSHucUgIezgGR6AxwW9tIX91d3h6Z8CPSlg== 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=MQZvbrxUhZO5zerUnViGJFCZBXzsBKQ0Sq/J+xD0sX8=; b=AOEYTgzdhgEaRwyEFGt5GYe0jKuArpDoxg3UbejJMEICyBMwt9crGlOXsGtq/hJcWMrqmbdnoT5Jp3pP1KVezvzdkTk2NLlefuSCXebqnleiSANN9suE4SmrmkRmRTTm8Yo4yombyM8IQP6melIbVOHhwGHgKqE2pWJ9A4owlIQ= 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 DM6PR04MB6362.namprd04.prod.outlook.com (2603:10b6:5:1e7::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.29; Sat, 10 Apr 2021 07:18:51 +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.4020.018; Sat, 10 Apr 2021 07:18:51 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Cc: Anup Patel , opensbi@lists.infradead.org, Anup Patel Subject: [PATCH 5/7] lib: sbi: Make the root domain instance global variable Date: Sat, 10 Apr 2021 12:48:06 +0530 Message-Id: <20210410071808.759856-6-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210410071808.759856-1-anup.patel@wdc.com> References: <20210410071808.759856-1-anup.patel@wdc.com> X-Originating-IP: [122.179.48.237] X-ClientProxiedBy: MAXPR01CA0106.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:5d::24) 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.179.48.237) by MAXPR01CA0106.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:5d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.16 via Frontend Transport; Sat, 10 Apr 2021 07:18:49 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 257023db-5b9e-4a3b-f51b-08d8fbf0e40b X-MS-TrafficTypeDiagnostic: DM6PR04MB6362: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:1923; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hNB84JV2n3P9g0c/g07eLd9k+QzAEhdWt/7WKqMeARhZivE6kqfTIg55PZUU1ZXoK2M0uA9ZiZsYzORNPBuWz3crCwHWhyckebU/s/ll/ydZR2wFbjvGLlEhnZkqKhBadJM4YAAMrb2KMUyFI1ghdDdVU+W7ZBpoDfmRNckQLsq+BElcEQ3ugS6uWj9/+ljkzeFMDkegDc7JcHLkGY+7Big6hRj+A2FvQgXcdTNF8SxKXuuDsmWFer22HuOTGB8gDC2iEtFUPCB97fNAFSrtZTT4AJGYYgtvuyJyJroWe9BLLOQmFA4plDMNcvl9E1bXGf26jcYP2kcjX9taSQVj9xhZAjbnId54nwPPs8DAVGciBILztb6HmS8y5eMRYsQbscGM3uKNxxB5WAWXQSGoLjNTlaL5v+QXbh1kCh98IpmF71piVPYf2wvka1plYwJXtDmdlzyvaZgVoYDGnLiPmkP1P14J5TNDlLUNSBfRxFtxAjy+p21c3d3mPzvnScOxTsvGeGBtrlb//JWBqz40JwVDyUldjqkCyOkMT92E0UtpiHpybY2j8a51Kkg5TjNY57VsRETO7b5tTifDTh/0xHJURb5drCA+rOV6p0IA/nAgF+D3fMx99mrbDtgottTEuiZVrLsd2vOAf/FzjUGzrdaqOihNYXXMURqgrTTo1as= 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)(366004)(346002)(136003)(39860400002)(110136005)(8936002)(83380400001)(8676002)(38100700002)(8886007)(54906003)(4326008)(316002)(38350700002)(52116002)(2906002)(186003)(16526019)(1076003)(55016002)(6636002)(26005)(66556008)(86362001)(66476007)(6666004)(44832011)(5660300002)(66946007)(36756003)(2616005)(7696005)(956004)(478600001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: PgTqY3r24xxmYD/828FzC5QCgHYMGWHlsiV6cDlMU7ORfz52n/Tf5I9Z+/CblEubWTjcJ+DnTqfCC/y6JgkAGcoBbowF2ZJuvHo6OimdzR2RdqjgvfmqVWbeM+yP5tl1R/RQHNC49ehUX6B3YvtPCknz7cK8iPeH+iR3lgML+UjdlLAs5r/i88hUZzlTJ5Avg2nO/t1gJu2z5muViuk+ggRQWClsBE+/o5ApryoPGlAPw6x02e+/lEIqHQCthHlW8ZXzV/tqVgmcTXzsdPKtUnl26Fnu4BARlvuJBgSZPaVOoLRcCOj1QiscxfZ3KZacedWXXicge/Yo2h0m+tPHfiF/1XHWZBjHgx4hkRL6m/nJjG4+pxmjYB07vMQ9UE0uw9HGq+IAPodH8BKPtHsAcRNXun7kf64GIRU9lpsuUe8RQT3iHHKGDAKuqFkc4w1gnwHCqDU+dCSXDycLy7jTYJOov8m1NIbwbum1ycgDEV85HVHLzNqZkDsYEUT9JHFrK+oUPNd2R/iwf2/RWuZJdXiT/sJGquWwaFoQHy1QkE67+JUP7I9yyJ8kPTcDE8ZuOD+LLy7iqNKq6SWkq5a6UF0iET2wvaVKK9snT1KhCcx1CkLq/rXdoa4Z4d4scx8qaxrYwOk1B5S7YGuoo3lUm6WTCCzenF1QzDkszS/8KzOAHn7sp6Rvr9Wh5BlRDfrRmNLyXFF8RbHqNgoLwgkTw30B/Rcnk2+T8+JPMs/uWHgSr4uI/+mQeWGf6f9Ui6wNG2kwToKLSWOFHnce79xOxzWK5dV1zVj2UvnhKv3qE76RZ+25TJA9g5Zv8BPg6p3BASx19LcGsGyOT/A20CBLiayXwSsdedBmF+kxWXhU2pDrD52OkaisfnkzZTefEB4qicl64i85Scle+Fe8JijNjxL6dFD3V0Uo4qv2sJUTrpCgkSnwAzrsrZhwXar4zStrcT4z7klw9KqiOZf5acvhX4yQWaJq4vq7Bm4l+1IbfzmYxTa8F+jt6FYm6iEBSaebYHB1wXLoc6r/rnAWvU0MHy1L8FKRHVADOdJrV1s9NJZ8S/N+5YyviAiB43oD+GSqX1AXejYWsnYjmm9BwS+WMJ+R/VTQnkfF93dDu19V0qm5qe4MjRN+KMF1rTrFK3Nu21S4tf9c6Bo2oKIpLDrSOmfNw8TS1bjSlK8ZvLVvzuTkAcBuGLv8SSaWGTbdU87WGK2BwphkIvvshmR0aiqWvIZ7/iMem3h/wtN5v/4yV+oHtKQAXsRxpBnBWBmX+RaCC7hcLFWhJ/XIolvPHJzuvLC9LaenNbt1Xx6eltHO/NJPc952PqfoRawXNphawxTb X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 257023db-5b9e-4a3b-f51b-08d8fbf0e40b X-MS-Exchange-CrossTenant-AuthSource: DM6PR04MB6201.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2021 07:18:51.3824 (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: U66TwByiXLxYd7op7mb5cH4Okh2RV6yT2gNp4kFscZnMTPFkOLEzZjCd4wp9hdbZZPNXZhWD796/ecuTx6KhNA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB6362 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210410_001852_443399_C5ED609A X-CRM114-Status: GOOD ( 13.85 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: We make the the root domain instance global variable so that platform support and drivers can iterate over the root domain regions. Signed-off-by: Anup Patel --- include/sbi/sbi_domain.h | 3 +++ lib/sbi/sbi_domain.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [216.71.153.144 listed in list.dnswl.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -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.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.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org We make the the root domain instance global variable so that platform support and drivers can iterate over the root domain regions. Signed-off-by: Anup Patel Reviewed-by: Xiang W Reviewed-by: Alistair Francis --- include/sbi/sbi_domain.h | 3 +++ lib/sbi/sbi_domain.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/sbi/sbi_domain.h b/include/sbi/sbi_domain.h index b5f2f38..ef53ca5 100644 --- a/include/sbi/sbi_domain.h +++ b/include/sbi/sbi_domain.h @@ -80,6 +80,9 @@ struct sbi_domain { bool system_reset_allowed; }; +/** The root domain instance */ +extern struct sbi_domain root; + /** HART id to domain table */ extern struct sbi_domain *hartid_to_domain_table[]; diff --git a/lib/sbi/sbi_domain.c b/lib/sbi/sbi_domain.c index 8afdb5d..5e3a30d 100644 --- a/lib/sbi/sbi_domain.c +++ b/lib/sbi/sbi_domain.c @@ -29,7 +29,7 @@ static u32 root_memregs_count = 0; static struct sbi_domain_memregion root_fw_region; static struct sbi_domain_memregion root_memregs[ROOT_REGION_MAX + 1] = { 0 }; -static struct sbi_domain root = { +struct sbi_domain root = { .name = "root", .possible_harts = &root_hmask, .regions = root_memregs, From patchwork Sat Apr 10 07:18:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1464594 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:1:d65d:64ff:fe57:4e05; helo=desiato.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=desiato.20200630 header.b=f/y/xAaU; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=qi5aXv+6; 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=ZINTM+y6; dkim=neutral header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-sharedspace-onmicrosoft-com header.b=LvFWJHss; dkim-atps=neutral Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) (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 4FHRG06bxQz9sWT for ; Sat, 10 Apr 2021 17:19:36 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=e7K0QIfxCICMHnYcAsyYcfWbACsGFyF4+Yf8Fnitv9g=; b=f/y/xAaUu5NU697blgd9PhP+R 2XMZWaO3haA6BLZxk/u/HWbLBlCmjEMLJ3AkaOP+Gz+lDnyaH808Iiqg5g5ytpjeBy49MrOIk9cqn Ty4dNSFBIsYvqHUh+EK9I1UETXdAzMyw5IgF9XWGXys0pSMC8q/USlDweNjuBF7/6iUb99zViayMl K/6B+2idqmtR+0TTSkKDPBwSik2SpwFQo3cuObFuRhmRTexMaiZAJCHkiyN5lb+c7WCdWjRaRm8uT OvQ2fsDQvYU09f7xFKJp56EM6Zkj65Ly3nDiQgd2Qb/dEBpTzVnDPZicq8ljBVPcsi29REvGO6pfX TspCphz4Q==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lV7u0-002M7l-0p; Sat, 10 Apr 2021 07:19:32 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lV7tR-002M1b-G9 for opensbi@desiato.infradead.org; Sat, 10 Apr 2021 07:18:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=IgVrpJ8lnQgRataqquuhCi0dzjJujhBntPBvReELpFM=; b=qi5aXv+60boBjxcyaOuOrx5YUY PH6t0gQTLkZMp4QTVuNn9/Q4u8fEYUBX/s43xjbH9y5jPPy+B6UW8L7FHqZUIHTzXFpNWr1bpnH5d b+ax2f27YUVs5AU8761TmUAC8WrxPdCDW4mCAmuEVx751WIJ7ijaqzFdHlvqhmQZs3ivdUX55gD8L 8xT6mn9CNWNnxEtt0McdWrwaQIMOGwNBgi5XmlS+X9LJBdpFk555Wl+qC9G0RHAtlxE2V97wXyJis R0nGRMJHrqUeVtdUEFuB5tjvP/z1HOcw1EZXuIN0BsvjEb03XRWMP6M1V4lp1XcimTfHElOPwocNA dD9euhjQ==; Received: from esa5.hgst.iphmx.com ([216.71.153.144]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lV7tO-004yD8-VP for opensbi@lists.infradead.org; Sat, 10 Apr 2021 07:18:56 +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=1618039134; x=1649575134; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=9YOkjyucbo32S0uyQ9/tO9UjpgBFwJj4A0jydNGyGZI=; b=ZINTM+y6C1uBLKqr3aay8iG3l5wxOCWEc5htmBjRAoEHSFZXfdXMsBCg uFXUEZJRbCC7W2xqK5v8Dtu+GdcwyiYi4FeDEBNYFEXFzQ7h8AlQWODh6 KtmQH/OIsgd3sBMb8Ffn/lGExMWGM3+r/CTf9zKAVBmXwtusAMJ16vwsO siHJZJrhulgfkF5gnVl/dNUj0MCZvE8XslnZUMozT7j1jSWs6XsmnTBZM 8vvh861Me4fsGKX2xwC73E1rgLzEAqG48B7EmVC+Ar50Mrlv+gYoixZbH Tt2fqVSCkUlZFO4kzAvBCtULiPwpr8caFdELRQ2ug/Yuf6SQNiYi7alxg g==; IronPort-SDR: ayolaL6qMjYtUtW8k759xB/2t1jDCYXyWrEXSDRpTAlM/uMmb9w1ZIfpQwa0G/aUe6rlkcGrzl w43qzHDscE4HqLGWmJ6CilQru7/6krL+OGrkLveGItKQZI68G0cOv/zsZKwC/ERPNkLdv6GVQK L6bJ4JievGPCcHH2p0Lf63t+1lpViTfND0RxDOoDtpcoaw2xfHCX4rBwuELsUATRghwcTVMTd7 nyF6tV7GdWS2WK/rJV7tlv3r0iM0gI2AdeDhJV4ryblCY48qs5lCICGj8w54QjcgJvU7xrGc5P b+E= X-IronPort-AV: E=Sophos;i="5.82,210,1613404800"; d="scan'208";a="164366725" Received: from mail-mw2nam12lp2042.outbound.protection.outlook.com (HELO NAM12-MW2-obe.outbound.protection.outlook.com) ([104.47.66.42]) by ob1.hgst.iphmx.com with ESMTP; 10 Apr 2021 15:18:54 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M1J5MJajq2dAq6bdtCpkxE1w+X73Z0neWZ7bulbq58Y5M2lvlt4U67wJFa8l8P817rJBeZLJmdO4bYhLw0cKQzOtiFu4F2OzOLNn74y+LfQmSgWlLrMaBsrYjjvnxgwnivRK8DvhvbeZkFolPL3O2cs8maFzj5zeZYoQ372vOFfQ+xrXj+pkmZbRVlQy1ZmCBMmuJr0cnAtpCq34ntYlgtsEVqgkAlvfdEAGZGlqezejIiloh6HudK/JIXBFMx0BHQNgETuayj8eafcQl19mQGNg8Pe0SajFTD+SNRSVhKbeVgWPY+FhfbgKE61EO5bINIX4zc86PGbE0Azn4JH/Vw== 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=IgVrpJ8lnQgRataqquuhCi0dzjJujhBntPBvReELpFM=; b=HPgdH3Umd422ozQoTJcKKb9jAq4mNl4CO7/xxVAlBG5jMGbTEAkKYUY83l84Mu/NsAJN20qhwTFi8fxIF3xaxO14IpGS819TcEKttjlestruck0kPF1kkozaKwThtK0GVNfyYi39K6+gLyeR0zT+JTTcNawW75ozjrKklF/6xBAj8zPDAPhK3cLFEDYhWbYZ95aLDLdfYN1eahdWki2cNgjNtCWtAndws3E0A5WjQNDbepudDS/HlNtf5lSxh5uaWoMvqBFdaf8D3bMiSA81oHVrjFG1cKt6x4g9DTSWRR6P0gRzcstGLDWZENBAtaMNkrms25A0rF8d6L1yNY1BJg== 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=IgVrpJ8lnQgRataqquuhCi0dzjJujhBntPBvReELpFM=; b=LvFWJHssEonm6yVHhGFJu/Dof020jJz6VwJfuEeaPzR6iuK9Dgf4AknLh8AhZI2BVVRdu0tblADkqBGWOEYCHOMfJxQAoH8qifdOghjTRSX7XS/+T6zZSOYoeklB96+2evHV4xVmMDVgXEl9+bTDEEgm7aFVDs+rx79qdPajEDQ= 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 DM6PR04MB6362.namprd04.prod.outlook.com (2603:10b6:5:1e7::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.29; Sat, 10 Apr 2021 07:18: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.4020.018; Sat, 10 Apr 2021 07:18:54 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Cc: Anup Patel , opensbi@lists.infradead.org, Anup Patel Subject: [PATCH 6/7] lib: utils: Copy over restricted root domain memregions to FDT domains Date: Sat, 10 Apr 2021 12:48:07 +0530 Message-Id: <20210410071808.759856-7-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210410071808.759856-1-anup.patel@wdc.com> References: <20210410071808.759856-1-anup.patel@wdc.com> X-Originating-IP: [122.179.48.237] X-ClientProxiedBy: MAXPR01CA0106.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:5d::24) 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.179.48.237) by MAXPR01CA0106.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:5d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.16 via Frontend Transport; Sat, 10 Apr 2021 07:18:51 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7fb086ff-e639-4298-47c0-08d8fbf0e598 X-MS-TrafficTypeDiagnostic: DM6PR04MB6362: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qYovjXRNVLJ91/CjBfFDXn+iHXGyWsw+1psI2IOcPjLOgKi8VowcyJB1SMHVxXp52fqje+Ye8Tstp9oc3XsXg1v68Vvj573/8mhBB8qsV9OxXinXxSgtuuetcU2dznYCbSnYKOvuWoizSYQBFuHC0lsNvbbPl27S7Vr5ByrPf+HAzQGoVz/4iPaEZifOeYgiEMfWKHZZZaBb1gPxFhYW3ZMOQFEKqVGRpIS59H+RMQf/EsFP4xzqJlUVwTavaxuUdNGhRU0M8XLQ8kz3wldkAAbNNHvYTT5xnXTV5RJh/UIfwu+A+ey4HjxPN51b9r3UyYSEULrM4WZG40U/TkaasArRYTo8I8F2kE/fFcrlJkg2l9BDb+TCjbsvdej86b1F8CuEesNfLR4kOsxYW9G8Un3SePRFJYyGc+lr07keRxQRMBVCCq8Cppc2UQTSePJ8kLm6AkzEK0xVdz1teUvsg/6yzZ1LCzBusQvdUDnOpkJv54eqzrszszYwJ8g+wBXdLEH/v8eYfAvsZUs5OS3L/9teBQF7gC5e/0QjhSXUi8PJiLq+FWrEygyN76tiIvUPzLl6d78RmU3WG7K9meBWclMVUvi1MNzXcos71I5eZx8ulIBG0R9aeaqno6AO9ytNQ1JvjobzNr/Np5nKQSttMm4ETBRyPpSsc2Jk9Fbjatk= 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)(366004)(346002)(136003)(39860400002)(110136005)(8936002)(83380400001)(8676002)(38100700002)(8886007)(54906003)(4326008)(316002)(38350700002)(52116002)(2906002)(186003)(16526019)(1076003)(55016002)(6636002)(26005)(66556008)(86362001)(66476007)(6666004)(44832011)(5660300002)(66946007)(36756003)(2616005)(7696005)(956004)(478600001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: QKhq5n5seNIFWaEyBS/YDJEQv/71QViz6KG3GLZa2+XDCZIqFK/n79hAjmvnbbbg2oL4QXqVDnmfd0iTkScInTExN2hWAgvEGBn79C9nihGBvfEXRrGIyRRDx2cismNdTg0+pAp/4zHEg2iGdJBDLi1L0dUTWgX7GKt0zxWIdI+hEYy909qLkFU747WIfDm+hwVxtTEO8q/PckWJ4UTd0Xgom7bKIgKxeIXxXcCjoD0YaBE4Wxwt++ECAr8riDl+dpYTMqxLyRf5foiXM2AB0dPn8flNrJLuRxshhexfIhhfYdZFwfaOLNSTWUcaqtsWv3l6N0pspL0w31pVhJJq3MuzdMG4Nf9LNezbF7eTqihU+TUfzVH7RkKDRrb6gifMybd/8B7LKtrB4xLRc2fepMufo+z7bDmH/sVMMGzcsnJdc+02c3GLdQ5MXt8KleWUotZz8i+rxFReqpXkLAAUaMrNkNteEa6BYQDAa4DL+JuyGBdiUceX8IEc5+NcKeUEwAmusg84qLTCS0dZHzkL7EFa8mJ23UtMnKdaAzF10U3JgGTPltsn4gDZhn1gxY3hLln/T+XUBmIHgaQvAJsT26l+NukhjT+nf5yrNVuLe+5WD5YFy6ZO4Mrl11Oeg0HXYI60ckeB6RLY+0ieNcn+iUU2K5StJYRcrVGkyX7h4nTVSXrNiCbkEN/id+aehvuqranGwU7/5QKYXwxbe6jXHvDGkN3fpAmX5TgAzC8c+xZVmhaS9LeGY2z8P1tMxk4m1WwJWEyJ1qcXQMVUajeF2xrfYY/iHUCVYPpjMbEJl2JILLhEzrn5dlcOXB8QrSCuRs7Knh2DzrG+YgmK3jvpotv+2Zfb+wfT1cqZ4wiAwYsJO0Tq5KPnY3kPaMcJ3Ym57/+kdmZA+A4BhszCiD/0AIq4qYmvhXwfjJO7fRBMWbJb/i2yfKIigLXAKKulADOxz17GHjdyOLv3JvjkOlwa6/DNr63dgkMFhlmkTcToxcmefZUh41BOZJwWVY9YWDX/K1zycGE5oU6ZO4DYK1NMmAUub+tHmizqrR3Ran0o/68of9OUESgmWKSRDrz110sstWqGJ9fdh+OzQ6Nsn1pLa8MseXw+WOwUBcSsOO+8lR9l0vGn6p+RJQi/CadA2+iglm4Yec4VW2JeGEhCe95IxvsPlNkhvH9ZjyufCNE0Mj39dVMV0p7vvmQ3vaxNUoBisz/xkkzC7TRW3O4atim5lOql0iKQ0U+lRW+D89lRXgJ2v3lpG2TgSlcOZn464SgqvpFxLaS6KUXIYH+qK8voMt1b3n8KYIE33K7geZyfkSdYiUVEPG0InVfnqKlb2aCr X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7fb086ff-e639-4298-47c0-08d8fbf0e598 X-MS-Exchange-CrossTenant-AuthSource: DM6PR04MB6201.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2021 07:18:53.9487 (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: cNpOdEU3/651MRtOhg2l60JcAZi/v4eObe/2tgtkh3SmLGsBIC8HKA0I1dhhxsQmg6UDmCnIIVto64pMxU33bg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB6362 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210410_001855_047650_7FE09CDA X-CRM114-Status: GOOD ( 13.45 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: We should copy over all restricted memregions from the root domain to the domains populated from FDT. These restricted root memregions are typically firmware memregion and M-mode only mmio memregions. Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [216.71.153.144 listed in list.dnswl.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -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.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.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org We should copy over all restricted memregions from the root domain to the domains populated from FDT. These restricted root memregions are typically firmware memregion and M-mode only mmio memregions. Signed-off-by: Anup Patel Reviewed-by: Xiang W Reviewed-by: Alistair Francis --- lib/utils/fdt/fdt_domain.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/lib/utils/fdt/fdt_domain.c b/lib/utils/fdt/fdt_domain.c index 09615e5..95c195d 100644 --- a/lib/utils/fdt/fdt_domain.c +++ b/lib/utils/fdt/fdt_domain.c @@ -222,7 +222,7 @@ static u32 fdt_domains_count; static struct sbi_domain fdt_domains[FDT_DOMAIN_MAX_COUNT]; static struct sbi_hartmask fdt_masks[FDT_DOMAIN_MAX_COUNT]; static struct sbi_domain_memregion - fdt_regions[FDT_DOMAIN_MAX_COUNT][FDT_DOMAIN_REGION_MAX_COUNT + 2]; + fdt_regions[FDT_DOMAIN_MAX_COUNT][FDT_DOMAIN_REGION_MAX_COUNT + 1]; static int __fdt_parse_region(void *fdt, int domain_offset, int region_offset, u32 region_access, @@ -276,7 +276,7 @@ static int __fdt_parse_domain(void *fdt, int domain_offset, void *opaque) struct sbi_hartmask *mask; struct sbi_hartmask assign_mask; int *cold_domain_offset = opaque; - struct sbi_domain_memregion *regions; + struct sbi_domain_memregion *reg, *regions; int i, err, len, cpus_offset, cpu_offset, doffset; /* Sanity check on maximum domains we can handle */ @@ -314,13 +314,31 @@ static int __fdt_parse_domain(void *fdt, int domain_offset, void *opaque) /* Setup memregions from DT */ val32 = 0; sbi_memset(regions, 0, - sizeof(*regions) * (FDT_DOMAIN_REGION_MAX_COUNT + 2)); + sizeof(*regions) * (FDT_DOMAIN_REGION_MAX_COUNT + 1)); dom->regions = regions; err = fdt_iterate_each_memregion(fdt, domain_offset, &val32, __fdt_parse_region); if (err) return err; - sbi_domain_memregion_initfw(®ions[val32]); + + /* + * Copy over root domain memregions which don't allow + * read, write and execute from lower privilege modes. + * + * These root domain memregions without read, write, + * and execute permissions include: + * 1) firmware region protecting the firmware memory + * 2) mmio regions protecting M-mode only mmio devices + */ + sbi_domain_for_each_memregion(&root, reg) { + if ((reg->flags & SBI_DOMAIN_MEMREGION_READABLE) || + (reg->flags & SBI_DOMAIN_MEMREGION_WRITEABLE) || + (reg->flags & SBI_DOMAIN_MEMREGION_EXECUTABLE)) + continue; + if (FDT_DOMAIN_REGION_MAX_COUNT <= val32) + return SBI_EINVAL; + sbi_memcpy(®ions[val32++], reg, sizeof(*reg)); + } /* Read "boot-hart" DT property */ val32 = -1U; From patchwork Sat Apr 10 07:18:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1464595 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:1:d65d:64ff:fe57:4e05; helo=desiato.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=desiato.20200630 header.b=AtakivTC; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=DG919+Av; 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=E/Qoeibg; dkim=neutral header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-sharedspace-onmicrosoft-com header.b=WSH1Xvrc; dkim-atps=neutral Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) (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 4FHRG40Gktz9sWT for ; Sat, 10 Apr 2021 17:19:40 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=2rykZzsQsm2HpHkkHQ0rT+ZKuOcGboeqSNbS+z0YjQw=; b=AtakivTCSS4O+6mHTEQxzpB/H F+toNuDUt9fJtA3dOK/B1C+JpmgkfZFWCEao/ijKCSJGpbScTFJZGUDcqL58wik9r/9XS7ENhoI/i J6mMt4TFM9ARHwZV+wlSbof/0tKTedPZbncLnCTsnBts286UCkNfTsSeIDsXp9eT+mtdzF+VTbxFU yIxAJOJEUed19UDKVxd0Hy7MwGIfuAa1X7bnNzEXrbyaQ25AV1HUQsR6zMSpZ3aCM+m8Ct9DF2czF LJdsXSD28mctknV5WrC9GgFnInuclDaviewFNfzC6nNQpHACPHGe8CKOTShmVDixe5XumMqFcObOB 0kR/ZK43Q==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lV7u2-002M8L-41; Sat, 10 Apr 2021 07:19:34 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lV7tT-002M1l-OW for opensbi@desiato.infradead.org; Sat, 10 Apr 2021 07:19:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=Gj3w32cz/Hk9+lMmgf/ZYTMAWjVZXeKkcjKnOFhnQ7s=; b=DG919+AvsRBQeRp0+rXIyBgaK2 t9M31Fb/iiKVJp2sz3OeawjguORznhXZNaCg0dUERKcXZa0hbKCAxgihPIaB3ZSe43aP3Uptggcpk RQnV4pYzeM/AipjEu4fFSrWyPEgmnU2b2syFnXKCv2I4/tGHwSUzIMX2Mrt3WuKy1OtUfStnCM5xO OhWSY9dgacdCjy4+afLSzf2C5RHZRLIewfrcQJqTeZ37+TMLODNpKcq1B8rArZZz0+JS3X67bwXVO v4TRag7oslbx8KHJ3ucaSCaZqk0Gf3O3qk89SqXYwINJ6/rJ4p4h4lBssNFy5/8nXWhaeS7rTkZKl S1r0BeDQ==; Received: from esa3.hgst.iphmx.com ([216.71.153.141]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lV7tR-004yE9-9f for opensbi@lists.infradead.org; Sat, 10 Apr 2021 07:18:58 +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=1618039137; x=1649575137; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=xpoGp2Pqf3GCtw/s+j1hLXfRWmf96uHUwcnC9rKctdw=; b=E/QoeibgcJJE2vxtKVw9UV/mtdTgHhZ0W7kq6dL5J5ikH5Wj5rexZzDW 2fe8rdhxOWQkBf/BY82RihUpvJ1W9EdNesuNKlTqqL34DP/9CXmPHaH2V Xi3IH3Yz7Qeqm8nlh8XyzEcQkkP9Zy2ewR33SFT3/YOx9ZkbPBtlEOMB6 BeJCekac9qLp6Wq7iGAwSJP5p92jevuzy2wxCVaUtB6ueZ/EfexLy6ram qOJzsbYBqIJJKk+rQszk+keL1gzp+xgrjlWOmoAhe41+C7bIDLHa0vt4B REplkSbuHjnNvtsLJAEk+8dBfgnU+5ROJ27qqiCwwlCsfsLtTMTVCkPys Q==; IronPort-SDR: efasaEdjH5KXeaDgZHX+eF1LfYuI3WPmvPfmu/csgQXmOfM0ZJ37cW0pyem0QvWLSy46+QX+Ta tqyWvlN1UAYqT33H/+AmRleLfGIt+zFAHwydtsA2fgaktzaU3pccI6b0HfhKg+dhZr3R6RTMHB eR4KbBnAtd5SV8EzmGel/9Af04VdqMJU3fHWlR8qDyHbPNqp5iWwI1X3BYZOaWVUUzzN/0QlyB kpO63bw+LCQjeemJ7Wo6mW48j8kztIKFkBikI5xw2c/qv5u8VrYaz2RlnklSNMJUnr94BJBfo2 bJA= X-IronPort-AV: E=Sophos;i="5.82,210,1613404800"; d="scan'208";a="168866186" Received: from mail-mw2nam12lp2044.outbound.protection.outlook.com (HELO NAM12-MW2-obe.outbound.protection.outlook.com) ([104.47.66.44]) by ob1.hgst.iphmx.com with ESMTP; 10 Apr 2021 15:18:56 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PJWcGeL5vITWzc4v4CEbOAUPVnZLpITPfhIOt3bPhHZSGOB3JrtsmKmdUd5Y5fP+MQggxC6tpVG8ka6MH00XGrjDcfTLV30Togz5ZuhHhAkDXkFfNPnT7r7Bi2pWMsj5AmOKL9PuKNrNUb6iTaQV467HBLtPN3hzah26Sieu76ZEiL1ae1RYk7h8HnXqONWUbGqd/54iAITaRj5Q52FDN2zxVqZWad938EQh5QgDXURI/uGIvJ77ldCgQosujGWZYL+9S0TVptqTeM2Fi6ViYTQkSS2XBa5kKblVQVhNsybUwXvKIvzrgBVh1wsbV0q0KuxCayh9xxtbVZGpuHcyWw== 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=Gj3w32cz/Hk9+lMmgf/ZYTMAWjVZXeKkcjKnOFhnQ7s=; b=M83O9Tmxi8vPlu0zPwIepLvLiBvaq4JjzRnwM2TDVo0Wds/bXXwgP4WsPU047W30/vRepkYA5LQCCQYvimDhREzYP9e50x9NLID6+1l7l4UC91fUNx6atb0IUszIQrsKkTaDF+peXVpiqFSPGNSMnnTaIwtcZ5N4ypqebets+GN5f3p+IC0CFwfJ1Ti2sigtpSDVuONdvw6QxIeyesNC5YpZSCOYzoaH/ujwDhBYG2ARihjyyMuKLIh42Ax+kGEZijcEimOiRecuN3qcDK12DKvf5YjJfat0MSX0DKLsPQLzJeFSLMQ6ym2eLtnM9zdtfTI3HGUqNUCoIPB/LFeaeA== 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=Gj3w32cz/Hk9+lMmgf/ZYTMAWjVZXeKkcjKnOFhnQ7s=; b=WSH1XvrcMAxdAXVWGroi3FYOWvn/guDDxSY7rw/Fo7em9D3wG6L5QTckAF6+jwK2QMENYf8gKWfrQTRhspDH87CFFYW4isijB2YarsPipXb3s+t0gcnRzSdpKIcx0SNJJt0ay836cKJDWYJF4vQDMWp0RIY6GDI8U0KM37bGwhE= 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 DM6PR04MB6362.namprd04.prod.outlook.com (2603:10b6:5:1e7::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.29; Sat, 10 Apr 2021 07:18:56 +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.4020.018; Sat, 10 Apr 2021 07:18:56 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Cc: Anup Patel , opensbi@lists.infradead.org, Anup Patel Subject: [PATCH 7/7] lib: sbi: Make sbi_domain_memregion_initfw() a local function Date: Sat, 10 Apr 2021 12:48:08 +0530 Message-Id: <20210410071808.759856-8-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210410071808.759856-1-anup.patel@wdc.com> References: <20210410071808.759856-1-anup.patel@wdc.com> X-Originating-IP: [122.179.48.237] X-ClientProxiedBy: MAXPR01CA0106.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:5d::24) 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.179.48.237) by MAXPR01CA0106.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:5d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.16 via Frontend Transport; Sat, 10 Apr 2021 07:18:54 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 66a06ce2-b359-47ed-fefb-08d8fbf0e71a X-MS-TrafficTypeDiagnostic: DM6PR04MB6362: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:972; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xOgm+4TQIvtAelEmSnzoirfkp6zGpYybLv870rlXk6u5Hj4qK7nLSMwPc/MinCQiQfT/5sEK0lCvhroKQRPJHhsLk9hxmv4ZSv4sJQKWH00sLIFJKWgrg0TH6sD8W78eLBlnnvnX/JxWhYGLjaVy7MCRWvb+5H7iErfzrrpmLz6X0BxdfOSna+6Z/5bU46K+I/1JQBK4u9OUCsT1oyT0LDHuC6xnzlnsb8km2pRzi0R8c+QdKPuVwWX5ZTKMAP5Vit/UHvM//UI4Lzrlz9fp1H+mS0LtMPLnEzrztLlcCZDIPLLw0dcHcs9ReKsylhmoR0thFQ1zyf8Jv6ShrUe46xmW/djFVf2REvZtcrT75t1NN3K7sFa8wY+giVxq4UMKgtK6LHxKF2mnTVj6pkhZMCA2wNVoUWmbJPxu1RQVFl2jVKeFLKAhsjVcsKlhDsn0WUdJw59w1fx03q8hHmV+gH5glsQtFRX+DXC5B73ha+jgHf5f7WcMfkAU4owE/hV65H3RC8JIad8PgtLpIW9ysu5pLm6q1nm/4IiJ1feCFf/Wilde+EeymwF/0G99w9Y0vygAlwPMEeYQd/aocv4ivO4hupJlrw1sNOEguWHjBvK5wZ/d9xKES23cgMHJ96DIbMXBaTEBrBoJgEpjkXedw+B5vxCS21d7/N2qrT5q9M0= 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)(366004)(346002)(136003)(39860400002)(110136005)(8936002)(83380400001)(8676002)(38100700002)(8886007)(54906003)(4326008)(316002)(38350700002)(52116002)(2906002)(186003)(16526019)(1076003)(55016002)(6636002)(26005)(66556008)(86362001)(66476007)(6666004)(44832011)(5660300002)(66946007)(36756003)(2616005)(7696005)(956004)(478600001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: Es5W/va+9QrApuyMgJOfnD9yUpQwtsZhZpzNbusc1rJtOITJvs085mHAHkx882kJGTGUR3de4pI/JM0fX2jwjXttPPuARuVUJ7FaH6+oDbVpbDkyxNbv+VqpUsex8dpQUaCgxAf+OVzhRDQ4lZlup3H8lyvr0cOeYJAGKsXpvWqepfhBGZ77ART41okr8HcvrGqVk/veYJmeV4UR3vB3n+kseAtV4yqM1uDdNfr83paWR69aQx0lXKRcNrhkqYkSNHQWNESYchHBCvzbFIZhy04MLDfVFiEfWjjHxRrHciHajumspHx2Q8ZsjYF1Lkeywxki+OGg86I/0yDtYQhEUQLrOMtoF+U5v7Rx7A9R0Xcxp/J0B5fO8dLh7JJMELsOMQv81gZUZyPbMPBiYieupSZt8Q4hlxGAhYmkKJRVQ9a9XPtioGiBhB28vUkuTgKxSejnPO8R7lIa7fF4WHFRkbicgx2gDKLX5AJGnN13aMwTM4bxyMkrQmSAjZtyV2tyBYgbAgvbh27MBjq4e9uaK31h519KxH0+WZfYMi3q3/YDAJGtloaXvEnNJMrIQmjTp5+39V7itlQOrPwaCbEgUt4wxu2Nf1qhZw0Qk96t2bVZXDQHoO7y5uidf3lL62NybHLIDbrZPfe5VW2m/GIZxHGUBGY6mO34IM8/NRkFS5/B1YyIsFe7UkEKvAIHP7UAI3Jj4wZGeSVjcfqIuXKQp7Hmb3HReuK1WJtc/k+ynS11km4/OTRXyQxFcIzCSN8ga0AKy/4b6ZudLEr2ty8FNLXQmIbhhTFtLP41sbDVgJo4azZc/TbAQVm8Ui8X4Xp8vSjqFJl9GjzmXI5CppSSaHi298mL2So9hV0pUOadOVM7HWWeAvF2isY5zQR7bKxIq311xOaLA/eYC491J7gLVseMAa4wzMNDcwg7BZGPaU2Wtri+4PqCTgpbrPdu3OKlgaMvXlFTkpg6LbSSPekZbfRjV24If+fzU5xBS4fl6NGW5twBVZAir+dBGheRnEbIfQ7y0ktwlxlGRZ9wo+rVa7KBglWhb7BPZqSgOzUXvtVGZVrnFDrFBJ86pe3ZE8C6zifZkhzp9G1MyBMEuLb7N27Bs70VFdpLkQQ2ydFV1H+hipVmUs4g3CWub8Gso7XTUreBFjR5AbgOXMIYS31Z1+/D5cSmM8VMNTaIlgQ+igeTB6/NY3HH73SJ+M/ghViLiWo4anhdBb9oUZCNtBCF8ubEA7rSqz201PENJTapOJnFkEZewC8BjcQfWffsKEUCOfjjadHXU1HyNvBXzY+/5j4s3bqtVa2f1cuoQrufmPgDN7+jluSjUZvCSHmM4dvq X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 66a06ce2-b359-47ed-fefb-08d8fbf0e71a X-MS-Exchange-CrossTenant-AuthSource: DM6PR04MB6201.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2021 07:18:56.2413 (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: Siq0+4VQyUyLJdGP6VFI9b+jlDX0Al4cnweSSBtC4gM975BpCskMCrAUdPSrl/CTffJBAf5KGyv/gwOxIIhuAQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB6362 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210410_001857_371883_82E5A1CF X-CRM114-Status: GOOD ( 11.00 ) X-Spam-Score: -2.5 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: The sbi_domain_memregion_initfw() is no longer used outside sbi_domain.c so let's make it a local function. Signed-off-by: Anup Patel --- include/sbi/sbi_domain.h | 3 --- lib/sbi/sbi_domain.c | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) Content analysis details: (-2.5 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -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.0 SPF_NONE SPF: sender does not publish an SPF Record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -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.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.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The sbi_domain_memregion_initfw() is no longer used outside sbi_domain.c so let's make it a local function. Signed-off-by: Anup Patel Reviewed-by: Xiang W Reviewed-by: Alistair Francis --- include/sbi/sbi_domain.h | 3 --- lib/sbi/sbi_domain.c | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/include/sbi/sbi_domain.h b/include/sbi/sbi_domain.h index ef53ca5..3de5e46 100644 --- a/include/sbi/sbi_domain.h +++ b/include/sbi/sbi_domain.h @@ -127,9 +127,6 @@ bool sbi_domain_is_assigned_hart(const struct sbi_domain *dom, u32 hartid); ulong sbi_domain_get_assigned_hartmask(const struct sbi_domain *dom, ulong hbase); -/** Initialize a domain memory region as firmware region */ -void sbi_domain_memregion_initfw(struct sbi_domain_memregion *reg); - /** * Initialize a domain memory region based on it's physical * address and size. diff --git a/lib/sbi/sbi_domain.c b/lib/sbi/sbi_domain.c index 5e3a30d..069e2a7 100644 --- a/lib/sbi/sbi_domain.c +++ b/lib/sbi/sbi_domain.c @@ -64,7 +64,7 @@ ulong sbi_domain_get_assigned_hartmask(const struct sbi_domain *dom, return ret; } -void sbi_domain_memregion_initfw(struct sbi_domain_memregion *reg) +static void domain_memregion_initfw(struct sbi_domain_memregion *reg) { if (!reg) return; @@ -577,7 +577,7 @@ int sbi_domain_init(struct sbi_scratch *scratch, u32 cold_hartid) /* Root domain firmware memory region */ sbi_domain_memregion_init(scratch->fw_start, scratch->fw_size, 0, &root_fw_region); - sbi_domain_memregion_initfw(&root_memregs[root_memregs_count++]); + domain_memregion_initfw(&root_memregs[root_memregs_count++]); /* Root domain allow everything memory region */ sbi_domain_memregion_init(0, ~0UL,