From nobody Tue Feb 10 19:53:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=yandex-team.ru Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547122127902708.5478739244862; Thu, 10 Jan 2019 04:08:47 -0800 (PST) Received: from localhost ([127.0.0.1]:53606 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghZ8g-0006XA-Sj for importer@patchew.org; Thu, 10 Jan 2019 07:08:46 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49400) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghZ1m-0001CP-38 for qemu-devel@nongnu.org; Thu, 10 Jan 2019 07:01:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghZ1l-00005l-23 for qemu-devel@nongnu.org; Thu, 10 Jan 2019 07:01:38 -0500 Received: from forwardcorp1j.cmail.yandex.net ([2a02:6b8:0:1630::190]:46728) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ghZ1k-0008SW-AC for qemu-devel@nongnu.org; Thu, 10 Jan 2019 07:01:36 -0500 Received: from mxbackcorp1o.mail.yandex.net (mxbackcorp1o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::301]) by forwardcorp1j.cmail.yandex.net (Yandex) with ESMTP id DD704214C0; Thu, 10 Jan 2019 15:01:28 +0300 (MSK) Received: from smtpcorp1j.mail.yandex.net (smtpcorp1j.mail.yandex.net [2a02:6b8:0:1619::137]) by mxbackcorp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id d2V7HgmQQs-1ShCtckd; Thu, 10 Jan 2019 15:01:28 +0300 Received: from dynamic-red.dhcp.yndx.net (dynamic-red.dhcp.yndx.net [2a02:6b8:0:40c:e1bb:a1a7:a235:d6b4]) by smtpcorp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id v4PGSBu40N-1ShWTwNP; Thu, 10 Jan 2019 15:01:28 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1547121688; bh=yvT5e3Voe+f4VgnYTnsxIaLwwaR8Q/7pKbPJONY6WzM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=nuQh95ymu6QPoIGvJeRL7xf11k5GvYZ1RSNlJ9wuxCf+j6SWJ5/wpocIz3bDmSvMw yqzLVk2q7GcTTwkH62bLpspD4nlXYcvhV7Q2g5HvniQcgQS+r2UvKj3VZm0EASIikV DDbNOYoSfa+h9HAOpupp55O+3OKlLfrA3nfJ7/ks= Authentication-Results: mxbackcorp1o.mail.yandex.net; dkim=pass header.i=@yandex-team.ru From: Yury Kotov To: qemu-devel@nongnu.org, Eduardo Habkost , Igor Mammedov , Paolo Bonzini , Peter Crosthwaite , Richard Henderson , Juan Quintela , "Dr. David Alan Gilbert" , Eric Blake , Markus Armbruster , Thomas Huth , Laurent Vivier Date: Thu, 10 Jan 2019 15:01:18 +0300 Message-Id: <20190110120120.9943-3-yury-kotov@yandex-team.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190110120120.9943-1-yury-kotov@yandex-team.ru> References: <20190110120120.9943-1-yury-kotov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a02:6b8:0:1630::190 Subject: [Qemu-devel] [PATCH 2/4] exec: add RAM_EXTERNAL flag to mark non-QEMU allocated blocks X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: wrfsh@yandex-team.ru Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" This flag allows to determine whether RAM block is available from the outsi= de. E.g. when we use -object memory-backend-file or -mem-path options we have a RAM block which is mapped to shared file. We need this flag in the following commits. Signed-off-by: Yury Kotov --- backends/hostmem-file.c | 3 ++- exec.c | 2 +- include/exec/memory.h | 3 +++ numa.c | 4 ++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c index 7a34e25c43..37fe28f2ac 100644 --- a/backends/hostmem-file.c +++ b/backends/hostmem-file.c @@ -63,7 +63,8 @@ file_backend_memory_alloc(HostMemoryBackend *backend, Err= or **errp) name, backend->size, fb->align, (backend->share ? RAM_SHARED : 0) | - (fb->is_pmem ? RAM_PMEM : 0), + (fb->is_pmem ? RAM_PMEM : 0) | + RAM_EXTERNAL, fb->mem_path, errp); g_free(name); #endif diff --git a/exec.c b/exec.c index 6e875f0640..ef2f29d7cb 100644 --- a/exec.c +++ b/exec.c @@ -2241,7 +2241,7 @@ RAMBlock *qemu_ram_alloc_from_fd(ram_addr_t size, Mem= oryRegion *mr, int64_t file_size; =20 /* Just support these ram flags by now. */ - assert((ram_flags & ~(RAM_SHARED | RAM_PMEM)) =3D=3D 0); + assert((ram_flags & ~(RAM_SHARED | RAM_PMEM | RAM_EXTERNAL)) =3D=3D 0); =20 if (xen_enabled()) { error_setg(errp, "-mem-path not supported with Xen"); diff --git a/include/exec/memory.h b/include/exec/memory.h index ffd23ed8d8..3a9cb34f1e 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -126,6 +126,9 @@ typedef struct IOMMUNotifier IOMMUNotifier; /* RAM is a persistent kind memory */ #define RAM_PMEM (1 << 5) =20 +/* RAM is from external source (e.g. from file) */ +#define RAM_EXTERNAL (1 << 6) + static inline void iommu_notifier_init(IOMMUNotifier *n, IOMMUNotify fn, IOMMUNotifierFlag flags, hwaddr start, hwaddr end, diff --git a/numa.c b/numa.c index 50ec016013..653c5a08de 100644 --- a/numa.c +++ b/numa.c @@ -482,8 +482,8 @@ static void allocate_system_memory_nonnuma(MemoryRegion= *mr, Object *owner, if (mem_path) { #ifdef __linux__ Error *err =3D NULL; - memory_region_init_ram_from_file(mr, owner, name, ram_size, 0, 0, - mem_path, &err); + memory_region_init_ram_from_file(mr, owner, name, ram_size, 0, + RAM_EXTERNAL, mem_path, &err); if (err) { error_report_err(err); if (mem_prealloc) { --=20 2.20.1