Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.0/patches/2175387/?format=api
{ "id": 2175387, "url": "http://patchwork.ozlabs.org/api/1.0/patches/2175387/?format=api", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/1.0/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": "" }, "msgid": "<20251217212018.93320-6-gustavo.romero@linaro.org>", "date": "2025-12-17T21:20:17", "name": "[v2,5/6] system/physmem: Add cpu_address_space_init", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "f226cb26a4a45ed4b8b5b91111c5ac7365136325", "submitter": { "id": 82513, "url": "http://patchwork.ozlabs.org/api/1.0/people/82513/?format=api", "name": "Gustavo Romero", "email": "gustavo.romero@linaro.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20251217212018.93320-6-gustavo.romero@linaro.org/mbox/", "series": [ { "id": 485770, "url": "http://patchwork.ozlabs.org/api/1.0/series/485770/?format=api", "date": "2025-12-17T21:20:12", "name": "system/physmem: Enhance the Address Space API", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/485770/mbox/" } ], "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2175387/checks/", "tags": {}, "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\tdkim=pass (2048-bit key;\n unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=ArkIQO8B;\n\tdkim-atps=neutral", "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 4dWmx32yFmz1xpw\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 18 Dec 2025 08:23:03 +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 1vVyxO-00009l-4C; Wed, 17 Dec 2025 16:21:14 -0500", "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 <gustavo.romero@linaro.org>)\n id 1vVyxL-0008Ut-5j\n for qemu-devel@nongnu.org; Wed, 17 Dec 2025 16:21:11 -0500", "from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <gustavo.romero@linaro.org>)\n id 1vVyxJ-0004dO-J3\n for qemu-devel@nongnu.org; Wed, 17 Dec 2025 16:21:10 -0500", "by mail-pj1-x1029.google.com with SMTP id\n 98e67ed59e1d1-34c84dc332cso4267185a91.0\n for <qemu-devel@nongnu.org>; Wed, 17 Dec 2025 13:21:08 -0800 (PST)", "from gromero0.. ([191.8.216.160]) by smtp.gmail.com with ESMTPSA id\n a92af1059eb24-12061ef3383sm1852476c88.0.2025.12.17.13.21.05\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 17 Dec 2025 13:21:06 -0800 (PST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1766006467; x=1766611267; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=4ANPNEdMCjohC/SqbWuEPORpYMejuUnEzpSC6wthoj4=;\n b=ArkIQO8BcitG1puK5VNVftNQz8GV1GTT4zXgyavZK+RycCCDj1A5GIUfxtYaenX4ja\n EdnE7TVQbGcfmWOdsvYOJ5nYPehBh4Vw/pcJoEkAOAHvLqkV5jyD2pkuAiGBsdp5hZLp\n jEcaO0KkyG86SlufJaU/gd7I7fGOqywzqmGxc7omDjifX1XwGRlLIvf3poS5+3a1LL7g\n W2CvOmzY0a0vRYqlMlawfty0dt8GZIDCFYPSNH8o9h6eGlRzjWOsyp6vKJ9pSCh87ulA\n NaqdXHXJBI/ZytjWCT8kuyHstKnnhwWP5gmurnd4IyU39y6oJk/xEyI8yzMpV9T7GW+i\n o3Xw==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1766006467; x=1766611267;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=4ANPNEdMCjohC/SqbWuEPORpYMejuUnEzpSC6wthoj4=;\n b=I9yoT8xgIGKH8tiKvQldrpFoBYMoHjiT5BqfOFiO0qhGolejd3eZ0WbVDs1G2ZOiBo\n 9qlsEFdwZd/NSl1gnzqfGhvtXHR+L4ZfJwic957DD5mKKfgTyQdbG/NOtT36RdHFdAIj\n ZjDn8Q4H8hdI0AQyKUupNXfpLmgq/VdOLxbrq9ET9F1fYTuZlQrtWcukMPXaoj5LD4OC\n HExbkUgf0j20atp/xkoGbK0YiQb2emv7gHqVlMxk9usr1snTuRBbNYzG41Cn0MXWS1qC\n E8/XYAeELN6pMAZAkFmMJCeeEOLUvn2UkEQJa2RMfsEQHoIYn/5pKncPYDBb11uUNcid\n btXw==", "X-Gm-Message-State": "AOJu0Yw82WzQ+eCwxqGDH4BZrxnUHEwF1BgPPglKFxqWHqjTYPjfvN+Z\n i2fzfIow5fXvKPRn8gk/yOkdpLtvsWuqXc9gZazlEj90Kc4MOOyg5I7NUFFd5dpoJ58vQq8Rl9z\n UjeCL", "X-Gm-Gg": "AY/fxX7kPyBrb0bk6/Bd7MvUrwNKR12rHe0hQwrscfJAc+AtROuQ22NKNZSkzPQTynV\n pw3tC698Coaht4++v46Q0fKIuaNQi3dt4cdrgAwjnjUw47Qnb/ITgYp2QcOZcRyj4/Un6zHF+wO\n fX2qjFS1p2RMTR6+ONtk+2x23f0izsEbjFJvh5deIX6hIaD5PTzOS4smHLnux59ev18I9Dcc88t\n t7Rthlplq8hKtamSQOP5szZLs9uodhekwtSAfjYFyB9lGm+esZDfr86w+70tl9nPv1zNksMcGPy\n Iyg96wr3BWgh+XnCUHvjcnC1/cgQSPNqILIqqvDlhEvsbGv6SoBij9r9q7n8IMIgUCRHLkNVfvS\n EG+dXZ8iQS64BQK7c3/TL2d7JD022OyjfWDA8lcvgCO+90O7vq0Tll82hOFy5U9LyAaN20hdQ66\n QnPfVe+bmPI9wWENU=", "X-Google-Smtp-Source": "\n AGHT+IEIbgn0/kfIHH+oQnIQi9s/ItN1W3x5eycWesXz/1IC06oQt9pAOmIHYjpqnYNqn3lw4MtG3g==", "X-Received": "by 2002:a05:7022:7e84:b0:11f:2c69:32 with SMTP id\n a92af1059eb24-11f34bd9069mr13503187c88.7.1766006467089;\n Wed, 17 Dec 2025 13:21:07 -0800 (PST)", "From": "Gustavo Romero <gustavo.romero@linaro.org>", "To": "qemu-devel@nongnu.org, qemu-arm@nongnu.org, richard.henderson@linaro.org,\n alex.bennee@linaro.org, philmd@linaro.org, peter.maydell@linaro.org", "Cc": "gustavo.romero@linaro.org", "Subject": "[PATCH v2 5/6] system/physmem: Add cpu_address_space_init", "Date": "Wed, 17 Dec 2025 18:20:17 -0300", "Message-Id": "<20251217212018.93320-6-gustavo.romero@linaro.org>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20251217212018.93320-1-gustavo.romero@linaro.org>", "References": "<20251217212018.93320-1-gustavo.romero@linaro.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Received-SPF": "pass client-ip=2607:f8b0:4864:20::1029;\n envelope-from=gustavo.romero@linaro.org; helo=mail-pj1-x1029.google.com", "X-Spam_score_int": "-20", "X-Spam_score": "-2.1", "X-Spam_bar": "--", "X-Spam_report": "(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n 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-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>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "Add cpu_address_space_init to enforce the invariant that cpu->num_ases\nis set exactly once, preventing bypass of the Address Space API.\n\nSigned-off-by: Gustavo Romero <gustavo.romero@linaro.org>\n---\n include/exec/cpu-common.h | 19 ++++++++++++++++---\n system/physmem.c | 8 ++++++++\n 2 files changed, 24 insertions(+), 3 deletions(-)", "diff": "diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h\nindex 126f645354..1ab63eac9f 100644\n--- a/include/exec/cpu-common.h\n+++ b/include/exec/cpu-common.h\n@@ -101,6 +101,19 @@ int qemu_ram_get_fd(RAMBlock *rb);\n size_t qemu_ram_pagesize(RAMBlock *block);\n size_t qemu_ram_pagesize_largest(void);\n \n+\n+/**\n+ * cpu_address_space_init:\n+ * @cpu: CPU to init the number of address space(s)\n+ * @num_ases: number of address space(s) in @cpu\n+ *\n+ * This function must be called before calling cpu_address_space_add and\n+ * it sets the total number of address spaces that can be added to @cpu\n+ * using cpu_address_space_add.\n+ *\n+ */\n+void cpu_address_space_init(CPUState *cpu, int num_ases);\n+\n /**\n * cpu_address_space_add:\n * @cpu: CPU to add this address space to\n@@ -114,9 +127,9 @@ size_t qemu_ram_pagesize_largest(void);\n * The target-specific code which registers ASes is responsible\n * for defining what semantics address space 0, 1, 2, etc have.\n *\n- * Before the first call to this function, the caller must set\n- * cpu->num_ases to the total number of address spaces it needs\n- * to support.\n+ * Before the first call to this function, the caller must call\n+ * cpu_address_space_init to set the total number of address\n+ * spaces @cpu can support.\n *\n * Note that with KVM only one address space is supported.\n */\ndiff --git a/system/physmem.c b/system/physmem.c\nindex 4a0c1b74f1..2666dbc272 100644\n--- a/system/physmem.c\n+++ b/system/physmem.c\n@@ -775,6 +775,14 @@ hwaddr memory_region_section_get_iotlb(CPUState *cpu,\n \n #endif /* CONFIG_TCG */\n \n+void cpu_address_space_init(CPUState *cpu, int num_ases)\n+{\n+ assert(num_ases > 0);\n+ assert(cpu->num_ases == 0);\n+\n+ cpu->num_ases = num_ases;\n+}\n+\n void cpu_address_space_add(CPUState *cpu, int asidx,\n const char *prefix, MemoryRegion *mr)\n {\n", "prefixes": [ "v2", "5/6" ] }