Message ID | 20230127114108.10025-10-joey.gouly@arm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7F844C54EAA for <linux-arm-kernel@archiver.kernel.org>; Fri, 27 Jan 2023 12:25:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Bu6xaOdJoFzlKT6hIpFitxWOMoGossRXdwFv/6hL7E4=; b=UGm0YQ5IMd5Pir tsI2b6fFxIJWyaFw6MVdx5udG5aA+uf1QRAZHeYBeblkrwcFAXI5Mav7rkDA25m+QVAMtwDE9prM+ hm+VexmRhzC7zkBRJSWWFHeJsjJtKyFmnIN1E+KUJO72ZHYez7ptiApmw0XFQ4vra5Q6TOllEdZtl YdpddqKi9Hhvo+L71rY3v+9/0Ou17MAlrFQTjPoXBLLkDMSmu3jD6nLBg+LbQklnM+1Sn0Ny09R24 9fWi9kIw0qAH5axXBJI5jFECKFVp1RNE7CLHa6TzqeI9Ta2v2L8xtuiR9AxRU0HygCACsX/tqziBs t9huAaPBv/9TsXCj9msQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pLNm5-00EWxv-B5; Fri, 27 Jan 2023 12:24:10 +0000 Received: from mail-vi1eur05on2059.outbound.protection.outlook.com ([40.107.21.59] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pLN7j-00EDzg-UH for linux-arm-kernel@lists.infradead.org; Fri, 27 Jan 2023 11:42:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7LPirvCS090ii8x00q60vC8CmR1XvwhXOu0GKUUIIY0=; b=MNceCef5xhcEzMv0CP9yefRYmetyvnhJdaUwaBbgQ4DH/2wahnVWzrkyzpQDsCw1RXqYA9uMRSL6QqHX7wzl5GWE7cnfbrZiEmzpnVOUTv0mvBi9qO0IkZsMxmTy1LSexHAOf1Jh4JqhI3M7AKaa+YTsVp9V3KetY4YX5onLnGw= Received: from AS8P189CA0016.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:31f::7) by PAXPR08MB6608.eurprd08.prod.outlook.com (2603:10a6:102:150::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.23; Fri, 27 Jan 2023 11:42:20 +0000 Received: from AM7EUR03FT056.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:31f:cafe::12) by AS8P189CA0016.outlook.office365.com (2603:10a6:20b:31f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.23 via Frontend Transport; Fri, 27 Jan 2023 11:42:20 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM7EUR03FT056.mail.protection.outlook.com (100.127.140.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.22 via Frontend Transport; Fri, 27 Jan 2023 11:42:20 +0000 Received: ("Tessian outbound 43b0faad5a68:v132"); Fri, 27 Jan 2023 11:42:20 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 9bd9ecc9dc87ca10 X-CR-MTA-TID: 64aa7808 Received: from 3b00719e383c.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 3F85915E-32AB-4BCC-946B-18C3739F12DB.1; Fri, 27 Jan 2023 11:42:13 +0000 Received: from EUR03-AM7-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 3b00719e383c.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 27 Jan 2023 11:42:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HrAvJ0Bo6Nd6TvUrqElZBwAhjYSS09Ch+IatBKizTGWo3iMmLJche31ZuUg8LR3nTIIJJLj/igPVkU6NRI2alqITDgX6ECpcTM9GYfmxd5RQYOwDzTVQqWs7U8o0WRTrpz4jcYM55Bsf3mGei4fC1nWX2oHTQ/J8YLvnhy4gFviupnwU+uzQVeCuMqVG+zzx40Oj0QolGcOu6+BMAvOgNsmxYSzbsbdcNP1usWPbjb/K+g/heiLrznBggCCP43W2Cq0i2c37nFzQ/G0aiNOaHyZ3VWE6RI/nvgfVwPQM4TH5aOzZUCIf5qxaaisTm6yw7CzLEFXD2R7afsmfUM8+Mg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7LPirvCS090ii8x00q60vC8CmR1XvwhXOu0GKUUIIY0=; b=TCGoGqauAJNz1KM73ynZRh22GYMnAanTSEylvR4S6I9vMzaPMll8p1rTQGShmTByYIfpHXRmmZNeEcO7GyAYJU2a6wnMHSKrouzJ9x7Iliz+BRLH2DcITgHBqtjyDa9ImrhIZQODKfSWAKM1KlKPRvOVG5rKcVvSFv/+6r7pOQRwraPR1dkuVQFcm8+cOfOJnHuSvYqB86YbCBzIanYtToFRD1V99AtWL7+Al8UjZD2/wRezlWVFn9uTXvHUvSbjfMEl5xK2nRNXw6tc1eGDqJ9L4ooiA3tfVV3B/1Kx8Zxbv6XbGI5aiovTjXxR1+j1Iq4f8kB+5wsWPQ7wADgufw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=linux.dev smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7LPirvCS090ii8x00q60vC8CmR1XvwhXOu0GKUUIIY0=; b=MNceCef5xhcEzMv0CP9yefRYmetyvnhJdaUwaBbgQ4DH/2wahnVWzrkyzpQDsCw1RXqYA9uMRSL6QqHX7wzl5GWE7cnfbrZiEmzpnVOUTv0mvBi9qO0IkZsMxmTy1LSexHAOf1Jh4JqhI3M7AKaa+YTsVp9V3KetY4YX5onLnGw= Received: from AS9PR06CA0718.eurprd06.prod.outlook.com (2603:10a6:20b:49f::33) by DU0PR08MB9079.eurprd08.prod.outlook.com (2603:10a6:10:470::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.22; Fri, 27 Jan 2023 11:42:08 +0000 Received: from AM7EUR03FT048.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:49f:cafe::f8) by AS9PR06CA0718.outlook.office365.com (2603:10a6:20b:49f::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.23 via Frontend Transport; Fri, 27 Jan 2023 11:42:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by AM7EUR03FT048.mail.protection.outlook.com (100.127.140.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6043.23 via Frontend Transport; Fri, 27 Jan 2023 11:42:08 +0000 Received: from AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Fri, 27 Jan 2023 11:42:07 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Fri, 27 Jan 2023 11:42:06 +0000 Received: from e124191.cambridge.arm.com (10.1.197.45) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Fri, 27 Jan 2023 11:42:01 +0000 From: Joey Gouly <joey.gouly@arm.com> To: Andrew Jones <andrew.jones@linux.dev>, <kvmarm@lists.linux.dev>, <kvm@vger.kernel.org> CC: <joey.gouly@arm.com>, Alexandru Elisei <alexandru.elisei@arm.com>, Christoffer Dall <christoffer.dall@arm.com>, Fuad Tabba <tabba@google.com>, Jean-Philippe Brucker <jean-philippe@linaro.org>, Joey Gouly <Joey.Gouly@arm.com>, Marc Zyngier <maz@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Oliver Upton <oliver.upton@linux.dev>, Paolo Bonzini <pbonzini@redhat.com>, Quentin Perret <qperret@google.com>, Steven Price <steven.price@arm.com>, Suzuki K Poulose <suzuki.poulose@arm.com>, "Thomas Huth" <thuth@redhat.com>, Will Deacon <will@kernel.org>, Zenghui Yu <yuzenghui@huawei.com>, <linux-coco@lists.linux.dev>, <kvmarm@lists.cs.columbia.edu>, <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org> Subject: [RFC kvm-unit-tests 09/27] arm: realm: Add support for changing the state of memory Date: Fri, 27 Jan 2023 11:40:50 +0000 Message-ID: <20230127114108.10025-10-joey.gouly@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230127114108.10025-1-joey.gouly@arm.com> References: <20230127112248.136810-1-suzuki.poulose@arm.com> <20230127114108.10025-1-joey.gouly@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM7EUR03FT048:EE_|DU0PR08MB9079:EE_|AM7EUR03FT056:EE_|PAXPR08MB6608:EE_ X-MS-Office365-Filtering-Correlation-Id: dfda2e87-4170-408b-e57e-08db005b8cbe x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: rheXZgf8s9vM0JR+2yCi7Tl5zJkej8a2aTYURTHqrXgT5cudKFEHmXNQuv0Jyd5KyOP8qfcb45HSVfrDz0RZVytOq+XFlmAI+Ynipl1YS9UcvUvZ40bDBmDlEEEfuyYbcaNXmvlwDNkCqsZXifivrT+AMgvkVn031kRF8N5vcUXUVxTI4Ak1CwRvWp86vjRlQw51CCkGjsrZAir0c0EQrRa8xcA4toNqwbwxsnYUnhCOwsoUUog5ae/Yfud70Hx6eickmijPR9yB/FFIYi8zC8cASeQy5qIAVWJepNRvhtJRSb8EuFoWLrrqM8bHZF2Mhsyyo0fvDs4m7/XWv+ltQCuwBWsK8G5PI/qPj/Rk9KwSdacUdgix0nhjje61kwnOb0612iEUi2gbYCSGRfuQVHrMVTtZ2lWgZjyGVV1y8yrX1a7AUuripHEPJ5+SzY6ZNEPoactivURJd6Nrl9po4uZ/Zpy2fvzvMvWuKZ8rSUnTGCSKPgxr2Ra7UAy12VsnKLcCHXKATTJZ48nITcIEof5p1H0tWzgW7u0ai1GhdXw2leGB0XLWmxhW09Apiw43SpoBJCvBd0RAu/vEbmeteD4MaSrNiSxx7Zt0J9UwHwHiXMixoT0but71Kph2euez2Wa9dzIFfa7Yro6DMetmczZ9GwkYY0RMhH+x/HK5Z6eWSznaXJDCnch94tEFUHUg2EN1nCpGVg8gLhvWolfBwXcSefl7p5K78RoSNDaWipgAqaHVTa3hIwmrSEl1/IqT X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230025)(4636009)(346002)(39860400002)(376002)(396003)(136003)(451199018)(36840700001)(40470700004)(46966006)(2906002)(26005)(1076003)(41300700001)(186003)(110136005)(426003)(54906003)(47076005)(4326008)(83380400001)(70206006)(8676002)(70586007)(36860700001)(356005)(6666004)(316002)(86362001)(44832011)(82310400005)(40480700001)(40460700003)(82740400003)(81166007)(478600001)(7416002)(2616005)(336012)(8936002)(5660300002)(7696005)(36756003)(2101003)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB9079 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT056.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: db2a54ca-f8cc-4e96-1ae6-08db005b85a3 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M6nHsIpIvTkX0gQrTGrJYg2rRmdcp8higc9Ys6AKVROHrw/T9fyvw0hUG/SNiC9MSY64rIfp8nPBZmiSYxt03Rmr5AW90hkGJwgP38DbBj4iwCtdoOl88SZvcwFFOYMX4NNBoBMumH3k5Gi59cXUCouTgoSxzqf7j+7OxJeuvx+ByzIch/bRLmGXIfOCM8+kPd0TYCKTnZ3OJE2pYM5RcixES0Wxq3jNs2ZLNw5cM5odnWrI4dMhVZZ5QXuBH1yTNE23aw2W93dX2FBkCAasm3JjRTUAFFQ8L4zHh+kDHu+O/dXCQLTAl5XCmndY4OPKXKNoL0x/zbkW0C7AMksCXfHbfHKG1w5UcKlOxX4ZGbtKFzsQW6ZfMQA437ZQWIjol9MLbjnqQx3P0q6UUetNyF2pgmMgFjDWIUOpITYxQQeXtmeRlm5F+65PgUR0/XqyW1W563g9/sUYMfBNFmOgw32Ba2iBnbVrQbKxnUnO4hxXk1/pW2DsKvZRSHQFQG6gZmTuqIxEjfSPn0RfmC01Fc1b5eipYpvKuHzdzuCyZYoP4K/xksI2X7+PGopEz11JPDatU/Qn5odDYrjCQ6FwA59U+jFMo+sQEzaV2/j8bm50DSexFp2H6jDiHRbpE65CphMmUnAnQmpHqsdZAwUdEOlMDFw1pGVhZBnsMx2qPrtWv8xGRKZTNdVFprKKnFGxR9/7/uAirITd93Dg4ctkwGVQr1DaW6GrzQXPLumCmzs= X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230025)(4636009)(396003)(376002)(39860400002)(346002)(136003)(451199018)(46966006)(36840700001)(40470700004)(1076003)(478600001)(186003)(26005)(4326008)(8676002)(107886003)(6666004)(70586007)(70206006)(7696005)(336012)(82310400005)(41300700001)(2616005)(426003)(47076005)(83380400001)(2906002)(86362001)(54906003)(110136005)(8936002)(81166007)(40460700003)(36756003)(36860700001)(82740400003)(44832011)(40480700001)(5660300002)(316002)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 11:42:20.5933 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dfda2e87-4170-408b-e57e-08db005b8cbe X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM7EUR03FT056.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6608 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230127_034228_235844_64855858 X-CRM114-Status: GOOD ( 18.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
[RFC,kvm-unit-tests,01/27] lib/string: include stddef.h for size_t
|
expand
|
diff --git a/lib/arm/mmu.c b/lib/arm/mmu.c index 6f1f42f5..2b5a7141 100644 --- a/lib/arm/mmu.c +++ b/lib/arm/mmu.c @@ -12,6 +12,7 @@ #include <asm/setup.h> #include <asm/page.h> #include <asm/io.h> +#include <asm/rsi.h> #include "alloc_page.h" #include "vmalloc.h" diff --git a/lib/arm64/asm/rsi.h b/lib/arm64/asm/rsi.h index 8b9b91b2..c8179341 100644 --- a/lib/arm64/asm/rsi.h +++ b/lib/arm64/asm/rsi.h @@ -33,4 +33,12 @@ static inline bool is_realm(void) return rsi_present; } +enum ripas_t { + RIPAS_EMPTY, + RIPAS_RAM, +}; + +void arm_set_memory_protected(unsigned long va, size_t size); +void arm_set_memory_shared(unsigned long va, size_t size); + #endif /* __ASMARM64_RSI_H_ */ diff --git a/lib/arm64/rsi.c b/lib/arm64/rsi.c index 23a4e963..08c77889 100644 --- a/lib/arm64/rsi.c +++ b/lib/arm64/rsi.c @@ -65,3 +65,47 @@ void arm_rsi_init(void) /* Set the upper bit of the IPA as the NS_SHARED pte attribute */ prot_ns_shared = (1UL << phys_mask_shift); } + +static unsigned rsi_set_addr_range_state(unsigned long start, unsigned long size, + enum ripas_t state, unsigned long *top) +{ + struct smccc_result res; + + rsi_invoke(SMC_RSI_IPA_STATE_SET, start, size, state, 0, 0, 0, 0, 0, 0, 0, 0, &res); + *top = res.r1; + return res.r0; +} + +static void arm_set_memory_state(unsigned long start, + unsigned long size, + unsigned int ripas) +{ + int ret; + unsigned long end, top; + unsigned long old_start = start; + + if (!is_realm()) + return; + + start = ALIGN_DOWN(start, RSI_GRANULE_SIZE); + if (start != old_start) + size += old_start - start; + end = ALIGN(start + size, RSI_GRANULE_SIZE); + while (start != end) { + ret = rsi_set_addr_range_state(start, (end - start), + ripas, &top); + assert(!ret); + assert(top <= end); + start = top; + } +} + +void arm_set_memory_protected(unsigned long start, unsigned long size) +{ + arm_set_memory_state(start, size, RIPAS_RAM); +} + +void arm_set_memory_shared(unsigned long start, unsigned long size) +{ + arm_set_memory_state(start, size, RIPAS_EMPTY); +}