From patchwork Fri Jan 26 04:11:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 13532022 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06AD5C47DDB for ; Fri, 26 Jan 2024 04:40:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 89EB86B0082; Thu, 25 Jan 2024 23:40:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 84E4F6B0087; Thu, 25 Jan 2024 23:40:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6EE556B0088; Thu, 25 Jan 2024 23:40:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 604456B0082 for ; Thu, 25 Jan 2024 23:40:52 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id DCC13C047A for ; Fri, 26 Jan 2024 04:40:51 +0000 (UTC) X-FDA: 81720211902.02.DDEE54B Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2062.outbound.protection.outlook.com [40.107.237.62]) by imf03.hostedemail.com (Postfix) with ESMTP id E3A302000C for ; Fri, 26 Jan 2024 04:40:47 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=moVU9MZI; dmarc=pass (policy=quarantine) header.from=amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf03.hostedemail.com: domain of Michael.Roth@amd.com designates 40.107.237.62 as permitted sender) smtp.mailfrom=Michael.Roth@amd.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706244048; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=5kiZwN/er7VREe8gy2nnlht7qc4XPTgKknA5h/Y9v8k=; b=LEprw9pBJiwhu58V502OW/OR+D/CaRnOrLY4l9jYyQhdiTqvrllq/k0MWgvtNMdcilopga qFvSx78odyJQewArIL4VGDhwyoZqDmzss/tNXFD8pYQCuThHIRIKeOqz514tXgWoAn1oq0 XXsYkDxepKbgKn0qhyz1U6zuxYjjYJc= ARC-Authentication-Results: i=2; imf03.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=moVU9MZI; dmarc=pass (policy=quarantine) header.from=amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf03.hostedemail.com: domain of Michael.Roth@amd.com designates 40.107.237.62 as permitted sender) smtp.mailfrom=Michael.Roth@amd.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1706244048; a=rsa-sha256; cv=pass; b=f+mZ6qisfOv9Hz/UHis+tkdLH6Y68wl1lPPn57m5PMnALa+JnWE1LDBM2b6Sjb7Ik0J1qD UlyzVtZKwa8TA0089HjG8tbjVJmaIwUMap6w7ERk1uFlLak7/WZBDlwJki459c4FKrSuZS nHFHFCiFIG76aIKaYDjvPsip65cjpDA= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VeZrnm2e1PW48zb3oGKYqTbeBzD2zCTHbKb8kXo/mxBgEFow+yQP2g47MZ/oIEyooLTIKtITkjLsBVc2TCfpa4nSOZK1VoIH4Ayc/GUksMD0IINfR1GQnnPHcghUrWBSK46cGABSAzZwixYy4ShKWbcPqpYiH6TdcWdDGpmqehs0cg/Eowe/zSJaExRbipgQTi8QJjx+5Wd82USyTnEquxhh6qP/LP/3i8Wkgged0mO+btFOvJSfSgS19ZlfTo2ykvdVnWJYQ9rv1VwmSc0hCsHmhf48fGxaPGKRVsVusFe0l9T300Xq7Hw6pwZsvYUqqClnsq1DHkZUytCqYS6J/g== 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=5kiZwN/er7VREe8gy2nnlht7qc4XPTgKknA5h/Y9v8k=; b=ZpHer7G8Ruaqy39EaHpBXUeXNcW3FDIdM3Dk3A2I9gyoL8n2KpOHdQ+Hcw5zN5qfV+AmJm9z5vqdNpZzKMFHcLnpW5WV8qE3Nd7o7Rs0artCeRBVIUEw6GR5LPnG8z+SkytTQW5opnggBOGBl3l8fFJ6lhEyzJAEJIiHSLbvVnnYPqMxYT8eMpnV01CKEBA4KNUTzZ2spASBhfpJkHETolci40Adk3cMUO/Zaq2p/ubyezgmsMf5DdUGrieiH5+3EPyk+oo29jRpzAWOuPv6FXeR83MILhgLFaT2bZLpsnG3axmryE0hyw3o2nKlwE4A/MzrKPs+S/x8VT5oEtM+lg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5kiZwN/er7VREe8gy2nnlht7qc4XPTgKknA5h/Y9v8k=; b=moVU9MZIEPloTUJXqQONJrCUv+0Cw36CAG6mHvA8kOjihXtLloY+2jKWiNQfskwrcPbk70qMG0lfM5rCCJLmgPWHDeBqM0NTlOeJKBxFpHcp+2o9CBVCiu/9CVDiblkeXaYYjCooYxaqUequUqg0WgutiAOJQdwL6MBeqnG7tGU= Received: from BYAPR07CA0032.namprd07.prod.outlook.com (2603:10b6:a02:bc::45) by DM4PR12MB5344.namprd12.prod.outlook.com (2603:10b6:5:39a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.26; Fri, 26 Jan 2024 04:40:45 +0000 Received: from MWH0EPF000971E6.namprd02.prod.outlook.com (2603:10b6:a02:bc:cafe::46) by BYAPR07CA0032.outlook.office365.com (2603:10b6:a02:bc::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.37 via Frontend Transport; Fri, 26 Jan 2024 04:40:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by MWH0EPF000971E6.mail.protection.outlook.com (10.167.243.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7228.16 via Frontend Transport; Fri, 26 Jan 2024 04:40:44 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 25 Jan 2024 22:40:43 -0600 From: Michael Roth To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Brijesh Singh Subject: [PATCH v2 10/25] x86/sev: Add helper functions for RMPUPDATE and PSMASH instruction Date: Thu, 25 Jan 2024 22:11:10 -0600 Message-ID: <20240126041126.1927228-11-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240126041126.1927228-1-michael.roth@amd.com> References: <20240126041126.1927228-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000971E6:EE_|DM4PR12MB5344:EE_ X-MS-Office365-Filtering-Correlation-Id: fa54b2f0-6fe3-4570-8bbf-08dc1e28f5ab X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WfJ1hAzRyglTd9I7ruhZxVOS5k4L25u9zbwuRLnd6NkdjdukB5XeeCayEROD8I3+6wLXMHRtP5MnM3lAZZoM58zVrVtg635HeR2k9flfOP005GgxjksLL3ObpbhJFYiPfMgmcpl3f93ooJ+F6B+tbtd70VjVvTW692/zaZdlAkmnqiVg5xl5KtUmZHpDmELpqeuHLsEUovauqfFakQsylFfmg9YLud8YV0XtwfW2l/sIsfTdDziQa1QbE7H7v40+398BOVAMTezVsVMJHDw4lEjcu4AF0wo9+/DvN38NEplgN9CDb/qyaPuVTx/E5Pifn5s+tESmKKyBMaAV0iT//WGvHALm0QVeuPwv9KWYubBmc2fM9nmdywMR4vUv+JrXl3vych13xqFBqi96rGZ0T9XRtf2CzcjPnzeLHYD1mB1NmX8rtc54m6rcsnYtrzMFOcCcZbNVTK8vyjF1KUYZKbgnXE2XCS/MgkbPPlo9rs+/iUe+h/w9zqVzmVGIOYREYziiKZ3fHxzYlpOZihVrRZaUsq5u6LOBCJix7NkRGr8fiflfsAbr5PbHsaA57AZI7yOUQN5+fqu9/DKBmdkwA0WUWBcztqpiTbVesQn526Dj+PnGYCkH8g0GQRBevDmkkmIBp6stCKSciDMco2al1f6GAYvtLtnjzTDQwiyZxPVTEGhnGHc9/jZXcBGEqCRhb6Nil0i+1ucQNtoP5fxp79Y9opwWiv4Gh7Yu2YjKT92FtUWhemGbGt8EAAJOdZPmVmVQneLWcpZGpDbGFJuxeQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(396003)(376002)(136003)(346002)(230922051799003)(64100799003)(186009)(451199024)(82310400011)(1800799012)(40470700004)(36840700001)(46966006)(47076005)(36860700001)(16526019)(8936002)(336012)(426003)(41300700001)(5660300002)(36756003)(83380400001)(478600001)(8676002)(4326008)(26005)(86362001)(70586007)(70206006)(44832011)(6916009)(54906003)(316002)(1076003)(2616005)(7406005)(2906002)(7416002)(6666004)(40460700003)(40480700001)(356005)(81166007)(82740400003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2024 04:40:44.7547 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fa54b2f0-6fe3-4570-8bbf-08dc1e28f5ab X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000971E6.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5344 X-Rspamd-Queue-Id: E3A302000C X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 8c493dgf64nq9nqb74xdhou3a3wy4mhi X-HE-Tag: 1706244047-143862 X-HE-Meta: U2FsdGVkX1/bEdUYT4hpT8XDhoQNpUmpPaVgEHoBZpQTiJQnZjU/kq0pHbPokrmFtceAadxuHz+VSiKtQ0n5Xvwm5ObeDI2n/kjO8IzVOIZ36/bVJFoIsERL5nRX2Oz/H0eO0yNkakIxxWwmyexjbMauelBgb5Fr7mONlsaa0VY/4LcZDmnxX4ULVVaTeJYf624BGi487j16WJVGnrf8wSgy5xbmSn3VaHoHPX+5DAFlICYuxQbJ4SAnnRMpnGjk/vD5++5MeDqruzdVy59X6VeYyWJbVGqs/vHf66j0cixRSNBJFUpQl8a31LgVJQ3NM+PUvwF5Om/mYBSiAHsHPrqBlPmi5cePDnQlnBqnfrInsv/p54Qsxcbv9j7aNs/0C1G0WrRdzfi4FGvZ1BAUGHRA7/uyzk+AnV1bspDqODuc9FpXchyNZRDLlq0Sy3RDmnOVVpQPiqPER2CAW8iEDXL5+vjODnlrdGAAP+guSXRCNZ5QXCpToUGWp2rce/mSJIAO/nvz1Y2cSIl/vVxTXQn0LPS32KcPF/FE+EX1Xi/0vFKfQpC+6M1C9RxhePvJAGoucZkxJFpgoHLpgM2T263Fs9vLzqRB22bjOZhUlrFTKQe1ciz+k3dJPdAkFeUEQTeEcL/17eNVlA6fEw2rRbdDfvBSFZUx0wD/HdmnssgFFSMA8UX18OGaAJzRIIsPdXydMYm7RzCjJ73FW8MQUOVnOFCA3hHmF7Oym8v5U26+BhweKwp9v/cpXIs2C5H9vTWwjbuL6OVcbZdC+LNiPOGJH724OT41coNH+cIASbQEV2W0tWbUszp+DXCFb6KMfdYvx79HhIGh+1gCfGt19zm958o34h5dJm4whwVvcA8ywgu5iUKyDiTdE7j7sX/tISan1XkgtB5L8cFO2qYCZ+OL2ayAFJlT4GkE5JZ1YHv1XpWcGPMKAborAXShj0Y+ceHb8tKJY6hKwuCg1+l Us2HYqUe bIBEFjQizwpyytFwxgRcj+TVrvvUZMQYaXPPyqr0ULOIY19+vCc/Aafsz/YxYRUO6fIjTeTGw56a86t3TOhC5HWlB/lDMLFHFkJCxR5LJK49JW6YIFSgVN+sFhcPtBQZ/gWeXFx+xsnf0CKqh246mSXej4zwZr7j8nh7HzljW2Ik/qs/VAVBWCQMt+gBTMQ1gyXE0E9xyYlVl6Cau7AgrB4WoSbbJbIjDQjyqgNHjaAz4+FgYJ3+lczhfobM03o5sObD8zkeLCBPgHkNnSXoQHW58ptdBfiCsrH5fTzHnUALvYxlPvNfHQDU6vmoWw/1rsk3c5/GgKBmC5MY= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Brijesh Singh The RMPUPDATE instruction updates the access restrictions for a page via its corresponding entry in the RMP Table. The hypervisor will use the instruction to enforce various access restrictions on pages used for confidential guests and other specialized functionality. See APM3 for details on the instruction operations. The PSMASH instruction expands a 2MB RMP entry in the RMP table into a corresponding set of contiguous 4KB RMP entries while retaining the state of the validated bit from the original 2MB RMP entry. The hypervisor will use this instruction in cases where it needs to re-map a page as 4K rather than 2MB in a guest's nested page table. Add helpers to make use of these instructions. Signed-off-by: Brijesh Singh Signed-off-by: Ashish Kalra [mdr: add RMPUPDATE retry logic for transient FAIL_OVERLAP errors] Signed-off-by: Michael Roth Reviewed-by: Liam Merwick --- arch/x86/include/asm/sev.h | 23 ++++++++++ arch/x86/virt/svm/sev.c | 92 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+) diff --git a/arch/x86/include/asm/sev.h b/arch/x86/include/asm/sev.h index 2c53e3de0b71..d3ccb7a0c7e9 100644 --- a/arch/x86/include/asm/sev.h +++ b/arch/x86/include/asm/sev.h @@ -87,10 +87,23 @@ extern bool handle_vc_boot_ghcb(struct pt_regs *regs); /* Software defined (when rFlags.CF = 1) */ #define PVALIDATE_FAIL_NOUPDATE 255 +/* RMUPDATE detected 4K page and 2MB page overlap. */ +#define RMPUPDATE_FAIL_OVERLAP 4 + /* RMP page size */ #define RMP_PG_SIZE_4K 0 #define RMP_PG_SIZE_2M 1 #define RMP_TO_PG_LEVEL(level) (((level) == RMP_PG_SIZE_4K) ? PG_LEVEL_4K : PG_LEVEL_2M) +#define PG_LEVEL_TO_RMP(level) (((level) == PG_LEVEL_4K) ? RMP_PG_SIZE_4K : RMP_PG_SIZE_2M) + +struct rmp_state { + u64 gpa; + u8 assigned; + u8 pagesize; + u8 immutable; + u8 rsvd; + u32 asid; +} __packed; #define RMPADJUST_VMSA_PAGE_BIT BIT(16) @@ -248,10 +261,20 @@ static inline u64 sev_get_status(void) { return 0; } bool snp_probe_rmptable_info(void); int snp_lookup_rmpentry(u64 pfn, bool *assigned, int *level); void snp_dump_hva_rmpentry(unsigned long address); +int psmash(u64 pfn); +int rmp_make_private(u64 pfn, u64 gpa, enum pg_level level, int asid, bool immutable); +int rmp_make_shared(u64 pfn, enum pg_level level); #else static inline bool snp_probe_rmptable_info(void) { return false; } static inline int snp_lookup_rmpentry(u64 pfn, bool *assigned, int *level) { return -ENODEV; } static inline void snp_dump_hva_rmpentry(unsigned long address) {} +static inline int psmash(u64 pfn) { return -ENODEV; } +static inline int rmp_make_private(u64 pfn, u64 gpa, enum pg_level level, int asid, + bool immutable) +{ + return -ENODEV; +} +static inline int rmp_make_shared(u64 pfn, enum pg_level level) { return -ENODEV; } #endif #endif diff --git a/arch/x86/virt/svm/sev.c b/arch/x86/virt/svm/sev.c index c74266e039b2..16b3d8139649 100644 --- a/arch/x86/virt/svm/sev.c +++ b/arch/x86/virt/svm/sev.c @@ -342,3 +342,95 @@ void snp_dump_hva_rmpentry(unsigned long hva) paddr = PFN_PHYS(pte_pfn(*pte)) | (hva & ~page_level_mask(level)); dump_rmpentry(PHYS_PFN(paddr)); } + +/* + * PSMASH a 2MB aligned page into 4K pages in the RMP table while preserving the + * Validated bit. + */ +int psmash(u64 pfn) +{ + unsigned long paddr = pfn << PAGE_SHIFT; + int ret; + + if (!cpu_feature_enabled(X86_FEATURE_SEV_SNP)) + return -ENODEV; + + if (!pfn_valid(pfn)) + return -EINVAL; + + /* Binutils version 2.36 supports the PSMASH mnemonic. */ + asm volatile(".byte 0xF3, 0x0F, 0x01, 0xFF" + : "=a" (ret) + : "a" (paddr) + : "memory", "cc"); + + return ret; +} +EXPORT_SYMBOL_GPL(psmash); + +/* + * It is expected that those operations are seldom enough so that no mutual + * exclusion of updaters is needed and thus the overlap error condition below + * should happen very seldomly and would get resolved relatively quickly by + * the firmware. + * + * If not, one could consider introducing a mutex or so here to sync concurrent + * RMP updates and thus diminish the amount of cases where firmware needs to + * lock 2M ranges to protect against concurrent updates. + * + * The optimal solution would be range locking to avoid locking disjoint + * regions unnecessarily but there's no support for that yet. + */ +static int rmpupdate(u64 pfn, struct rmp_state *state) +{ + unsigned long paddr = pfn << PAGE_SHIFT; + int ret; + + if (!cpu_feature_enabled(X86_FEATURE_SEV_SNP)) + return -ENODEV; + + do { + /* Binutils version 2.36 supports the RMPUPDATE mnemonic. */ + asm volatile(".byte 0xF2, 0x0F, 0x01, 0xFE" + : "=a" (ret) + : "a" (paddr), "c" ((unsigned long)state) + : "memory", "cc"); + } while (ret == RMPUPDATE_FAIL_OVERLAP); + + if (ret) { + pr_err("RMPUPDATE failed for PFN %llx, ret: %d\n", pfn, ret); + dump_rmpentry(pfn); + dump_stack(); + return -EFAULT; + } + + return 0; +} + +/* Transition a page to guest-owned/private state in the RMP table. */ +int rmp_make_private(u64 pfn, u64 gpa, enum pg_level level, int asid, bool immutable) +{ + struct rmp_state state; + + memset(&state, 0, sizeof(state)); + state.assigned = 1; + state.asid = asid; + state.immutable = immutable; + state.gpa = gpa; + state.pagesize = PG_LEVEL_TO_RMP(level); + + return rmpupdate(pfn, &state); +} +EXPORT_SYMBOL_GPL(rmp_make_private); + +/* Transition a page to hypervisor-owned/shared state in the RMP table. */ +int rmp_make_shared(u64 pfn, enum pg_level level) +{ + struct rmp_state state; + + memset(&state, 0, sizeof(state)); + state.pagesize = PG_LEVEL_TO_RMP(level); + + return rmpupdate(pfn, &state); +} +EXPORT_SYMBOL_GPL(rmp_make_shared);