From nobody Mon Feb 9 05:24:56 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1733332673; cv=pass; d=zohomail.com; s=zohoarc; b=XfT7cv7OeZqJUFn7W+k0WjHqkn4bJe/ParQ+9tnvrXZnSHzKzx/CSPCsedOiJw3WnmB/MIgRSpOJh5uB/hlfdRFlfAQm9HfeUgNDvKuW6pHc8YAf1Y2tv0bjmQ5jwbMQyZXJaxtc0wrrjf7930SdxoFCiCG1lTtsuUJnnOLwMqw= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1733332673; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BAY1xUG30EjiQIbycn3JIikJhjk0I+U9WDzHzIMNJR8=; b=MwQUzsWUcCIRUwG6DuXSnZ0uXLIlG685REj0fqLXvSpHM9VXwCv666qfgTlI7f8On6Ul/I8fZ/KgDsyLz74S0PnBDPvTwQ1J8Iq3oBfL46maucrNxYz0SY1GcTuc8RlpB68qS7q9CDzo3iF9b0qDL3UG+My4nl6KaOo+8QwsTTY= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1733332673331518.9978891004474; Wed, 4 Dec 2024 09:17:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tIszb-0004oD-GT; Wed, 04 Dec 2024 12:16:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tIszW-0004nZ-Sm for qemu-devel@nongnu.org; Wed, 04 Dec 2024 12:16:46 -0500 Received: from mail-dm6nam04on2077.outbound.protection.outlook.com ([40.107.102.77] helo=NAM04-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tIszT-0001Af-7a for qemu-devel@nongnu.org; Wed, 04 Dec 2024 12:16:45 -0500 Received: from PH7PR17CA0045.namprd17.prod.outlook.com (2603:10b6:510:323::10) by CH3PR12MB8994.namprd12.prod.outlook.com (2603:10b6:610:171::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.11; Wed, 4 Dec 2024 17:11:31 +0000 Received: from SN1PEPF000252A1.namprd05.prod.outlook.com (2603:10b6:510:323:cafe::a9) by PH7PR17CA0045.outlook.office365.com (2603:10b6:510:323::10) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.19 via Frontend Transport; Wed, 4 Dec 2024 17:11:31 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by SN1PEPF000252A1.mail.protection.outlook.com (10.167.242.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8230.7 via Frontend Transport; Wed, 4 Dec 2024 17:11:30 +0000 Received: from MKM-L1-ZHLUO987.amd.com (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.39; Wed, 4 Dec 2024 11:11:29 -0600 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SSSTI8pR3Z/HaHvmm7t0wqSBvElIhuIZEdbeDgenybAMci1ZtbonNaDZnHM1SkLT8GTiwudeHdCloeEzYRkFGwVjVYldhCEFw21HQZfxgLkHp9DRXxaAoXFA7L2eTPV68xGV7oYQuFTJK6bnUG6+S+RfG4P5/ZtCuf8LNBhRbkhu2cJ2BzV5/1p2EdwrOFYarfIPUDaRu7FtfTBCornLXkPd0T9C56oMpho92/6i9vTid6KZZGg9ZF+HW3FJZsgG/+adSlxwsRxpASu7bojgRK4E74hHs7fTPPWXgHpikaJCmtVe+l4c5gOtEkyiUr6zFpDFtA6cgXQj+gJRSUsS8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=BAY1xUG30EjiQIbycn3JIikJhjk0I+U9WDzHzIMNJR8=; b=Ct1DVM6yrgp9oUnpU4g29mo8eH8/+pGsTK7Da4rdR50x4AOQn2ZYQ8IzJtBrJCPvHt4h98VNvzswpLINNvFU1gTrrGfhRkmq1ORyc5Oh0mH58PyNYaZpwL0GoF6Lw3JGrGwVncw+2JwMDHsIqNfGUJnT5B4ALNjsgbMJVgOF96uMOw4E/1o9PKPes6bb76alFIOj4lY3gwyUaLr6GOWRfpfW9J824GMf6U55sUQkE1N4UfljmRTln6gNjA+G2ApLokN5qhhYzEb9Y0NVTldRn4RP6Z1SeoiG/bV7LJwq22ZlQpdzQvemn1boJEGHocMcTYt2A1Dy9XpQJ48WdNxvTA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.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=BAY1xUG30EjiQIbycn3JIikJhjk0I+U9WDzHzIMNJR8=; b=sF8qHGIeWOnMatsNGg1Z12yhMHAp221NnQqboVoojIVrSz0ZYN+4qlUWYBbOqYYRpfScLDzEQvOKiHbYcXJ6OIaT04Zpdt8YO758D7dSGnUwnS1hsKFngEkJMAya9S/21seOCW/mE14K4d7pGTGfchKjPFCchFyJh4jwyIeCHeA= 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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 From: Zhigang Luo To: CC: , , Zhigang Luo Subject: [PATCH] hostmem-file: add the 'hmem' option Date: Wed, 4 Dec 2024 12:11:14 -0500 Message-ID: <20241204171114.20033-1-Zhigang.Luo@amd.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000252A1:EE_|CH3PR12MB8994:EE_ X-MS-Office365-Filtering-Correlation-Id: 94666cc8-6ee1-47d6-14f7-08dd1486b274 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?FFxX719HJ0q+BvoCKicBA0BnRtd1bEbnJzJ+ZrcL7GInhruQtTE/7iSKnMBr?= =?us-ascii?Q?HoV5bMD3gPlx6EczmRTKnCAwZHWUP+MPZ1Eo3fY9xy9rE3S7juASu0kR5MDP?= =?us-ascii?Q?vF0bGCZCW77dE23v+tVmrkwFJvaqOVF+83kEyKC7AzfCvRrbJQLEWbwaDpJ6?= =?us-ascii?Q?aCyQuuxfe3H4cshN7cvY0nXprG0EG6oy5rj+iCTZQNbM1F+jGJ/4qwz6GecM?= =?us-ascii?Q?QQYcsKTbu0I28mIg9FgZgogYwOzJlkqATUhsdD/6VLazNIjOmSUf9Fz8yQLT?= =?us-ascii?Q?XzOgq99b5h1woFevxxz8JlhdbV5laPGXulAlFEIJOoDmRjZ+v8XbN2EWKROf?= =?us-ascii?Q?kpXLcHGLFDdg2G6SLvI3WaIeNuqsgKfm+uJK3pGoU12Ea292TG79E1UU8A0q?= =?us-ascii?Q?kIbP9mPU5WoRiYdMAlIjNh0HBJV8R2xnm3mAPx+9Ff0OFa8QBGRZjIZOPYrw?= =?us-ascii?Q?sXxi+OPJcpOiYCDb9eWtyN2H6bZgCW8yT1aru2mXw6w7h+xebI6HIqAUlKAl?= =?us-ascii?Q?yCBfBBxRtLDmdNjQVO4RdAUTdb/UtNFqH76o54R1OVIlhmQsw3pVXbq2X6Q7?= =?us-ascii?Q?7lyoZltV9hdxeuvj5ZtR+ywkWVanXWn+IC5xMDNuEit2uSiDbZpl3xctSqJa?= =?us-ascii?Q?+zcl7niIY6wlCoPOgU9TtRFyCpz8Pxr8Mmtt8gz2Y+6FNfz1gk8yXZB81HVT?= =?us-ascii?Q?ohrLVHbqNR4SIMUi/GACUbMwh9zzCgzKUyIslWKbfT0ddbmmhP69VWe8aLYg?= =?us-ascii?Q?K9kEFQ/zKUaLeeUpT5E+1YAqb7py1pgMPRJiucv5a9PkHN58SmgVos0p1PS4?= =?us-ascii?Q?MvQnNse4pRD9LAQ8drfqT3/x0vNO/Iso0eT9Whrsle4O3lXZMmXb8lGy4eNw?= =?us-ascii?Q?GARhSy+k3+9JyKmwSO/Z2KhD5VoXsS3rQutAJQ2Qw7O8BrTtMWhhE67k+ybE?= =?us-ascii?Q?vrpqQZpWEtsARu+dOfwwYc7kBik1zQaB/tGtIIJmnPygZD8DNoB8M+2Lt6qy?= =?us-ascii?Q?PWXuRjBGD1dgbErH5BUzlIRv38qFKHE29KKsUSqyzKokuTqkKAAw0kvwoizL?= =?us-ascii?Q?gRNw3MXbAc8bDX10a9+6XD8sTwSGmXxRRzjEbM3tv4bqTruXUEtV1k7ld87G?= =?us-ascii?Q?xqd0ouvV8Mi5OSB0uVRH8mIMs6BDPDjuznrLxDfaxurHLgIIHk+p2UBQfcJ6?= =?us-ascii?Q?ZJxmQvPHiT9aQMCtvVH1l/nAfc+TAPI5qlVPABZHkeyLq4tJ+a6eq/M6keVX?= =?us-ascii?Q?8a2BmTqyX08ZZ4oGYbPoi95IeXriUft2tbFFD5QN4ExtGZvJKu3iQN4KSsx0?= =?us-ascii?Q?G3cy9nZRts8Sqa0iyuFU8UfUBWfyRx1cNI4mebrneH0WcfcWu4hpuU8G1sMs?= =?us-ascii?Q?mBNbGgsk/o+IgrDqRDtMkWIQzeHQvkicl13Kg4P3zc+S7qH/AxZnifBiDwwn?= =?us-ascii?Q?BNp0mWVNkEx9/pRZaBuYyCUOtVosSLps?= 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:(13230040)(376014)(36860700013)(1800799024)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2024 17:11:30.7822 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 94666cc8-6ee1-47d6-14f7-08dd1486b274 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: SN1PEPF000252A1.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8994 Received-SPF: permerror client-ip=40.107.102.77; envelope-from=Zhigang.Luo@amd.com; helo=NAM04-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -50 X-Spam_score: -5.1 X-Spam_bar: ----- X-Spam_report: (-5.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.999, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1733332674820116600 Content-Type: text/plain; charset="utf-8" This boolean option 'hmem' allows users to set a memory region from memory-backend-file as heterogeneous memory. If 'hmem=3Don', QEMU will set the flag RAM_HMEM in the RAM block of the corresponding memory region and set the e820 type to E820_SOFT_RESERVED for this region. Signed-off-by: Zhigang Luo --- backends/hostmem-file.c | 23 +++++++++++++++++++++++ hw/i386/e820_memory_layout.h | 1 + hw/i386/pc.c | 16 ++++++++++++++++ include/exec/cpu-common.h | 1 + include/exec/memory.h | 3 +++ qapi/qom.json | 4 ++++ system/physmem.c | 7 ++++++- 7 files changed, 54 insertions(+), 1 deletion(-) diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c index 7e5072e33e..5ddfdbaf86 100644 --- a/backends/hostmem-file.c +++ b/backends/hostmem-file.c @@ -32,6 +32,7 @@ struct HostMemoryBackendFile { uint64_t offset; bool discard_data; bool is_pmem; + bool is_hmem; bool readonly; OnOffAuto rom; }; @@ -88,6 +89,7 @@ file_backend_memory_alloc(HostMemoryBackend *backend, Err= or **errp) ram_flags |=3D backend->reserve ? 0 : RAM_NORESERVE; ram_flags |=3D backend->guest_memfd ? RAM_GUEST_MEMFD : 0; ram_flags |=3D fb->is_pmem ? RAM_PMEM : 0; + ram_flags |=3D fb->is_hmem ? RAM_HMEM : 0; ram_flags |=3D RAM_NAMED_FILE; return memory_region_init_ram_from_file(&backend->mr, OBJECT(backend),= name, backend->size, fb->align, ram_= flags, @@ -256,6 +258,25 @@ static void file_memory_backend_set_rom(Object *obj, V= isitor *v, visit_type_OnOffAuto(v, name, &fb->rom, errp); } =20 +static bool file_memory_backend_get_hmem(Object *o, Error **errp) +{ + return MEMORY_BACKEND_FILE(o)->is_hmem; +} + +static void file_memory_backend_set_hmem(Object *o, bool value, Error **er= rp) +{ + HostMemoryBackend *backend =3D MEMORY_BACKEND(o); + HostMemoryBackendFile *fb =3D MEMORY_BACKEND_FILE(o); + + if (host_memory_backend_mr_inited(backend)) { + error_setg(errp, "cannot change property 'hmem' of %s.", + object_get_typename(o)); + return; + } + + fb->is_hmem =3D value; +} + static void file_backend_unparent(Object *obj) { HostMemoryBackend *backend =3D MEMORY_BACKEND(obj); @@ -295,6 +316,8 @@ file_backend_class_init(ObjectClass *oc, void *data) object_class_property_add_bool(oc, "pmem", file_memory_backend_get_pmem, file_memory_backend_set_pmem); #endif + object_class_property_add_bool(oc, "hmem", + file_memory_backend_get_hmem, file_memory_backend_set_hmem); object_class_property_add_bool(oc, "readonly", file_memory_backend_get_readonly, file_memory_backend_set_readonly); diff --git a/hw/i386/e820_memory_layout.h b/hw/i386/e820_memory_layout.h index b50acfa201..8af6a9cfac 100644 --- a/hw/i386/e820_memory_layout.h +++ b/hw/i386/e820_memory_layout.h @@ -15,6 +15,7 @@ #define E820_ACPI 3 #define E820_NVS 4 #define E820_UNUSABLE 5 +#define E820_SOFT_RESERVED 0xEFFFFFFF =20 struct e820_entry { uint64_t address; diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 317aaca25a..41e9cc276c 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -785,6 +785,21 @@ static hwaddr pc_max_used_gpa(PCMachineState *pcms, ui= nt64_t pci_hole64_size) return pc_above_4g_end(pcms) - 1; } =20 +static int pc_update_hmem_memory(RAMBlock *rb, void *opaque) +{ + X86MachineState *x86ms =3D opaque; + ram_addr_t offset; + ram_addr_t length; + + if (qemu_ram_is_hmem(rb)) { + offset =3D qemu_ram_get_offset(rb) + (0x100000000ULL - x86ms->belo= w_4g_mem_size); + length =3D qemu_ram_get_used_length(rb); + e820_add_entry(offset, length, E820_SOFT_RESERVED); + } + + return 0; +} + /* * AMD systems with an IOMMU have an additional hole close to the * 1Tb, which are special GPAs that cannot be DMA mapped. Depending @@ -895,6 +910,7 @@ void pc_memory_init(PCMachineState *pcms, e820_add_entry(x86ms->above_4g_mem_start, x86ms->above_4g_mem_size, E820_RAM); } + qemu_ram_foreach_block(pc_update_hmem_memory, x86ms); =20 if (pcms->sgx_epc.size !=3D 0) { e820_add_entry(pcms->sgx_epc.base, pcms->sgx_epc.size, E820_RESERV= ED); diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index 638dc806a5..1b2dfb31e8 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -98,6 +98,7 @@ ram_addr_t qemu_ram_get_offset(RAMBlock *rb); ram_addr_t qemu_ram_get_used_length(RAMBlock *rb); ram_addr_t qemu_ram_get_max_length(RAMBlock *rb); bool qemu_ram_is_shared(RAMBlock *rb); +bool qemu_ram_is_hmem(RAMBlock *rb); bool qemu_ram_is_noreserve(RAMBlock *rb); bool qemu_ram_is_uf_zeroable(RAMBlock *rb); void qemu_ram_set_uf_zeroable(RAMBlock *rb); diff --git a/include/exec/memory.h b/include/exec/memory.h index 9458e2801d..18c593a00b 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -246,6 +246,9 @@ typedef struct IOMMUTLBEvent { /* RAM can be private that has kvm guest memfd backend */ #define RAM_GUEST_MEMFD (1 << 12) =20 +/* RAM is a heterogeneous kind memory */ +#define RAM_HMEM (1 << 13) + static inline void iommu_notifier_init(IOMMUNotifier *n, IOMMUNotify fn, IOMMUNotifierFlag flags, hwaddr start, hwaddr end, diff --git a/qapi/qom.json b/qapi/qom.json index 28ce24cd8d..7b8632697f 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -669,6 +669,9 @@ # in host persistent memory that can be accessed using the SNIA # NVM programming model (e.g. Intel NVDIMM). # +# @hmem: specifies whether the backing file specified by @mem-path is +# in host heterogeneous memory. +# # @readonly: if true, the backing file is opened read-only; if false, # it is opened read-write. (default: false) # @@ -696,6 +699,7 @@ '*discard-data': 'bool', 'mem-path': 'str', '*pmem': { 'type': 'bool', 'if': 'CONFIG_LIBPMEM' }, + '*hmem': 'bool', '*readonly': 'bool', '*rom': 'OnOffAuto' } } =20 diff --git a/system/physmem.c b/system/physmem.c index dc1db3a384..f703398359 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -1584,6 +1584,11 @@ bool qemu_ram_is_noreserve(RAMBlock *rb) return rb->flags & RAM_NORESERVE; } =20 +bool qemu_ram_is_hmem(RAMBlock *rb) +{ + return rb->flags & RAM_HMEM; +} + /* Note: Only set at the start of postcopy */ bool qemu_ram_is_uf_zeroable(RAMBlock *rb) { @@ -1951,7 +1956,7 @@ RAMBlock *qemu_ram_alloc_from_fd(ram_addr_t size, Mem= oryRegion *mr, int64_t file_size, file_align; =20 /* Just support these ram flags by now. */ - assert((ram_flags & ~(RAM_SHARED | RAM_PMEM | RAM_NORESERVE | + assert((ram_flags & ~(RAM_SHARED | RAM_PMEM | RAM_HMEM | RAM_NORESERVE= | RAM_PROTECTED | RAM_NAMED_FILE | RAM_READONLY | RAM_READONLY_FD | RAM_GUEST_MEMFD)) =3D=3D 0); =20 --=20 2.25.1