Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2216048/?format=api
{ "id": 2216048, "url": "http://patchwork.ozlabs.org/api/patches/2216048/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260325184259.366-2-alireza.sanaee@huawei.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260325184259.366-2-alireza.sanaee@huawei.com>", "list_archive_url": null, "date": "2026-03-25T18:42:49", "name": "[1/9] hw/mem: Add tag support to generic host memory backends", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "87d2741c18aee42478eabe99ac40095e47830698", "submitter": { "id": 90159, "url": "http://patchwork.ozlabs.org/api/people/90159/?format=api", "name": "Alireza Sanaee", "email": "alireza.sanaee@huawei.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260325184259.366-2-alireza.sanaee@huawei.com/mbox/", "series": [ { "id": 497484, "url": "http://patchwork.ozlabs.org/api/series/497484/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=497484", "date": "2026-03-25T18:42:48", "name": "Application Specific Tagged Memory Support in CXL Type 3 Devices", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/497484/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2216048/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2216048/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)", "Received": [ "from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fgwmm2ZDrz1y1K\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 26 Mar 2026 05:44:24 +1100 (AEDT)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1w5TCi-00026k-Kq; Wed, 25 Mar 2026 14:43:44 -0400", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <alireza.sanaee@huawei.com>)\n id 1w5TCg-00026X-CZ\n for qemu-devel@nongnu.org; Wed, 25 Mar 2026 14:43:42 -0400", "from frasgout.his.huawei.com ([185.176.79.56])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <alireza.sanaee@huawei.com>)\n id 1w5TCe-0005u5-E6\n for qemu-devel@nongnu.org; Wed, 25 Mar 2026 14:43:42 -0400", "from mail.maildlp.com (unknown [172.18.224.83])\n by frasgout.his.huawei.com (SkyGuard) with ESMTPS id 4fgwlB5KS0zHnGhl;\n Thu, 26 Mar 2026 02:43:02 +0800 (CST)", "from dubpeml500005.china.huawei.com (unknown [7.214.145.207])\n by mail.maildlp.com (Postfix) with ESMTPS id 8F53240086;\n Thu, 26 Mar 2026 02:43:38 +0800 (CST)", "from a2303103017.china.huawei.com (10.47.66.203) by\n dubpeml500005.china.huawei.com (7.214.145.207) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n 15.2.1544.11; Wed, 25 Mar 2026 18:43:37 +0000" ], "To": "<qemu-devel@nongnu.org>", "CC": "<anisa.su@samsung.com>, <armbru@redhat.com>, <berrange@redhat.com>,\n <eblake@redhat.com>, <jonathan.cameron@huawei.com>,\n <linux-cxl@vger.kernel.org>, <linuxarm@huawei.com>, <lizhijian@fujitsu.com>,\n <mst@redhat.com>, <pbonzini@redhat.com>, <gourry@gourry.net>,\n <nifan.cxl@gmail.com>, <me@linux.beauty>", "Subject": "[PATCH 1/9] hw/mem: Add tag support to generic host memory backends", "Date": "Wed, 25 Mar 2026 18:42:49 +0000", "Message-ID": "<20260325184259.366-2-alireza.sanaee@huawei.com>", "X-Mailer": "git-send-email 2.51.0.windows.2", "In-Reply-To": "<20260325184259.366-1-alireza.sanaee@huawei.com>", "References": "<20260325184259.366-1-alireza.sanaee@huawei.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Content-Type": "text/plain", "X-Originating-IP": "[10.47.66.203]", "X-ClientProxiedBy": "lhrpeml500011.china.huawei.com (7.191.174.215) To\n dubpeml500005.china.huawei.com (7.214.145.207)", "Received-SPF": "pass client-ip=185.176.79.56;\n envelope-from=alireza.sanaee@huawei.com; helo=frasgout.his.huawei.com", "X-Spam_score_int": "-41", "X-Spam_score": "-4.2", "X-Spam_bar": "----", "X-Spam_report": "(-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3,\n RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,\n SPF_HELO_NONE=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": "qemu development <qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Reply-to": "Alireza Sanaee <alireza.sanaee@huawei.com>", "From": "Alireza Sanaee via qemu development <qemu-devel@nongnu.org>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "Add a string tag property to HostMemoryBackend so that backends can be\nidentified by a user-assigned name at runtime. Expose the property through\nQOM and add a host_memory_backend_find_by_tag() helper that walks the\nobject tree to locate a backend by its tag.\n\nThis is used by the following CXL patches to resolve a named backend for a\npending DC extent and attach it to the accepted extent when the host\nacknowledges the add request.\n\nSigned-off-by: Alireza Sanaee <alireza.sanaee@huawei.com>\n---\n backends/hostmem.c | 72 ++++++++++++++++++++++++++++++++++++++++\n include/system/hostmem.h | 2 ++\n qapi/qom.json | 3 ++\n tests/qtest/qom-test.c | 8 +++--\n 4 files changed, 83 insertions(+), 2 deletions(-)", "diff": "diff --git a/backends/hostmem.c b/backends/hostmem.c\nindex 15d4365b69..270cae9569 100644\n--- a/backends/hostmem.c\n+++ b/backends/hostmem.c\n@@ -47,6 +47,50 @@ host_memory_backend_get_name(HostMemoryBackend *backend)\n return object_get_canonical_path(OBJECT(backend));\n }\n \n+typedef struct HostMemoryBackendTagSearch {\n+ const char *tag;\n+ HostMemoryBackend *backend;\n+} HostMemoryBackendTagSearch;\n+\n+static int host_memory_backend_find_by_tag_cb(Object *obj, void *opaque)\n+{\n+ HostMemoryBackendTagSearch *ctx = opaque;\n+ HostMemoryBackend *backend;\n+\n+ if (!object_dynamic_cast(obj, TYPE_MEMORY_BACKEND)) {\n+ return 0;\n+ }\n+\n+ backend = MEMORY_BACKEND(obj);\n+ if (!backend->tag) {\n+ return 0;\n+ }\n+\n+ if (strcmp(backend->tag, ctx->tag) == 0) {\n+ ctx->backend = backend;\n+ return 1;\n+ }\n+\n+ return 0;\n+}\n+\n+HostMemoryBackend *host_memory_backend_find_by_tag(const char *tag)\n+{\n+ HostMemoryBackendTagSearch ctx = {\n+ .tag = tag,\n+ .backend = NULL,\n+ };\n+\n+ if (!tag) {\n+ return NULL;\n+ }\n+\n+ object_child_foreach_recursive(object_get_objects_root(),\n+ host_memory_backend_find_by_tag_cb, &ctx);\n+\n+ return ctx.backend;\n+}\n+\n static void\n host_memory_backend_get_size(Object *obj, Visitor *v, const char *name,\n void *opaque, Error **errp)\n@@ -460,6 +504,22 @@ static void host_memory_backend_set_share(Object *o, bool value, Error **errp)\n backend->share = value;\n }\n \n+static void\n+host_memory_backend_set_tag(Object *obj, const char *value, Error **errp)\n+{\n+ HostMemoryBackend *backend = MEMORY_BACKEND(obj);\n+\n+ g_free(backend->tag);\n+ backend->tag = g_strdup(value);\n+}\n+\n+static char *host_memory_backend_get_tag(Object *obj, Error **errp)\n+{\n+ HostMemoryBackend *backend = MEMORY_BACKEND(obj);\n+\n+ return g_strdup(backend->tag);\n+}\n+\n #ifdef CONFIG_LINUX\n static bool host_memory_backend_get_reserve(Object *o, Error **errp)\n {\n@@ -501,6 +561,13 @@ host_memory_backend_set_use_canonical_path(Object *obj, bool value,\n backend->use_canonical_path = value;\n }\n \n+static void host_memory_backend_finalize(Object *obj)\n+{\n+ HostMemoryBackend *backend = MEMORY_BACKEND(obj);\n+\n+ g_free(backend->tag);\n+}\n+\n static void\n host_memory_backend_class_init(ObjectClass *oc, const void *data)\n {\n@@ -557,6 +624,10 @@ host_memory_backend_class_init(ObjectClass *oc, const void *data)\n host_memory_backend_get_share, host_memory_backend_set_share);\n object_class_property_set_description(oc, \"share\",\n \"Mark the memory as private to QEMU or shared\");\n+ object_class_property_add_str(oc, \"tag\",\n+ host_memory_backend_get_tag, host_memory_backend_set_tag);\n+ object_class_property_set_description(oc, \"tag\",\n+ \"A user-defined tag to identify this memory backend\");\n #ifdef CONFIG_LINUX\n object_class_property_add_bool(oc, \"reserve\",\n host_memory_backend_get_reserve, host_memory_backend_set_reserve);\n@@ -586,6 +657,7 @@ static const TypeInfo host_memory_backend_info = {\n .class_init = host_memory_backend_class_init,\n .instance_size = sizeof(HostMemoryBackend),\n .instance_init = host_memory_backend_init,\n+ .instance_finalize = host_memory_backend_finalize,\n .instance_post_init = host_memory_backend_post_init,\n .interfaces = (const InterfaceInfo[]) {\n { TYPE_USER_CREATABLE },\ndiff --git a/include/system/hostmem.h b/include/system/hostmem.h\nindex 88fa791ac7..a02e173d48 100644\n--- a/include/system/hostmem.h\n+++ b/include/system/hostmem.h\n@@ -81,12 +81,14 @@ struct HostMemoryBackend {\n ThreadContext *prealloc_context;\n DECLARE_BITMAP(host_nodes, MAX_NODES + 1);\n HostMemPolicy policy;\n+ char *tag;\n \n MemoryRegion mr;\n };\n \n bool host_memory_backend_mr_inited(HostMemoryBackend *backend);\n MemoryRegion *host_memory_backend_get_memory(HostMemoryBackend *backend);\n+HostMemoryBackend *host_memory_backend_find_by_tag(const char *tag);\n \n void host_memory_backend_set_mapped(HostMemoryBackend *backend, bool mapped);\n bool host_memory_backend_is_mapped(HostMemoryBackend *backend);\ndiff --git a/qapi/qom.json b/qapi/qom.json\nindex c653248f85..e6feeb324a 100644\n--- a/qapi/qom.json\n+++ b/qapi/qom.json\n@@ -658,6 +658,8 @@\n # @reserve: if true, reserve swap space (or huge pages) if applicable\n # (default: true) (since 6.1)\n #\n+# @tag: user-defined memory backend tag (since 11.1)\n+#\n # @size: size of the memory region in bytes\n #\n # @x-use-canonical-path-for-ramblock-id: if true, the canonical path\n@@ -683,6 +685,7 @@\n '*prealloc-context': 'str',\n '*share': 'bool',\n '*reserve': 'bool',\n+ '*tag': 'str',\n 'size': 'size',\n '*x-use-canonical-path-for-ramblock-id': 'bool' } }\n \ndiff --git a/tests/qtest/qom-test.c b/tests/qtest/qom-test.c\nindex 6421f2d9d9..3109b47cca 100644\n--- a/tests/qtest/qom-test.c\n+++ b/tests/qtest/qom-test.c\n@@ -17,6 +17,7 @@\n \n #define RAM_NAME \"node0\"\n #define RAM_SIZE 65536\n+#define RAM_TAG \"ramtag0\"\n \n static int verbosity_level;\n \n@@ -59,6 +60,8 @@ static void test_list_get_value(QTestState *qts)\n \n } else if (!strcmp(prop_name, \"size\")) {\n g_assert_cmpint(qdict_get_int(prop, \"value\"), ==, RAM_SIZE);\n+ } else if (!strcmp(prop_name, \"tag\")) {\n+ g_assert_cmpstr(qdict_get_str(prop, \"value\"), ==, RAM_TAG);\n }\n }\n }\n@@ -195,8 +198,9 @@ static void test_machine(gconstpointer data)\n QTestState *qts;\n g_autoptr(QList) paths = qlist_new();\n \n- qts = qtest_initf(\"-machine %s -object memory-backend-ram,id=%s,size=%d\",\n- machine, RAM_NAME, RAM_SIZE);\n+ qts = qtest_initf(\"-machine %s -object memory-backend-ram,id=%s,size=%d\"\n+ \",tag=%s\",\n+ machine, RAM_NAME, RAM_SIZE, RAM_TAG);\n \n if (g_test_slow()) {\n /* Make sure we can get the machine class properties: */\n", "prefixes": [ "1/9" ] }