Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2230020/?format=api
{ "id": 2230020, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2230020/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260429044752.4176397-24-alistair.francis@wdc.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/1.1/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": "<20260429044752.4176397-24-alistair.francis@wdc.com>", "date": "2026-04-29T04:47:24", "name": "[PULL,23/51] target/riscv: fix stale ptshift and base on page walk restart", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "249aba0ddbe6a7bd977a4c1128fe5d61acef8331", "submitter": { "id": 64571, "url": "http://patchwork.ozlabs.org/api/1.1/people/64571/?format=api", "name": "Alistair Francis", "email": "alistair23@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260429044752.4176397-24-alistair.francis@wdc.com/mbox/", "series": [ { "id": 501983, "url": "http://patchwork.ozlabs.org/api/1.1/series/501983/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=501983", "date": "2026-04-29T04:47:05", "name": "[PULL,01/51] hw/riscv/riscv-iommu: Use standard EN_PRI bit for PRI", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/501983/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2230020/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2230020/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=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=fz4BG+bG;\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=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from lists1p.gnu.org (lists1p.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 4g54lX6Wrtz1yHv\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 14:56:40 +1000 (AEST)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wHwsE-0004vZ-0w; Wed, 29 Apr 2026 00:50:10 -0400", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <alistair23@gmail.com>)\n id 1wHwsC-0004rU-IC\n for qemu-devel@nongnu.org; Wed, 29 Apr 2026 00:50:08 -0400", "from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <alistair23@gmail.com>)\n id 1wHwsB-0000Mo-0k\n for qemu-devel@nongnu.org; Wed, 29 Apr 2026 00:50:08 -0400", "by mail-pl1-x62f.google.com with SMTP id\n d9443c01a7336-2ab077e3f32so53035935ad.3\n for <qemu-devel@nongnu.org>; Tue, 28 Apr 2026 21:50:06 -0700 (PDT)", "from toolbx.alistair23.me ([2403:581e:fdf9:0:6209:4521:6813:45b7])\n by smtp.gmail.com with ESMTPSA id\n d9443c01a7336-2b988772ae8sm7756145ad.7.2026.04.28.21.50.01\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 28 Apr 2026 21:50:05 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1777438205; x=1778043005; 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=6LT1/EJ4TmcNjWWSWxvrhRM1oUkyUaxsMz6fDhIwFOg=;\n b=fz4BG+bGwBVYlMHfjfbxzbaglFp3atiGW1sYJqELE8H1F3zLfqQVu7i9ILHQRqxIPb\n oNusGJx7TZChTvf2zCuIx35fLKQHSFtQo9W+ctTmUj9vX7k0AQAyP3NcnlJk7b23PvYH\n ErKHkKeNKUq3djenFDxNWZCA2p4BGWfZAhDaFymmneiaRjUCbeeWNgf1K958dQ0b7sdv\n 0yX/oBp0r4qltOAnI6Rzzk9e2Vnktkv5unoHHMnZDNIGT1EV9/YNSb/alUj1NscRliHV\n F0EanEBAOEvtTxRzxf0QjqrUTtr0S6i8o6IhcwprNNWlfsiPpPHC6NWs33Oi4DRkjbRn\n AyiA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777438205; x=1778043005;\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=6LT1/EJ4TmcNjWWSWxvrhRM1oUkyUaxsMz6fDhIwFOg=;\n b=gWSEB9BU4yCNXFVNJpxNYlYdfSalHj4Rz3pAB822f7+Lfcx4nUAyCdS64qg7Kwhv9t\n H1HKNExhcSOCK+EDGi9Dx56dhGIwJMmX+e5NuT3tCnmXh1U5h5OfvtKu9jUWYf6jrbcw\n dgjMgkoMVmhoorCxaW0TR7R6dcWatR+taxVcABoEj9MVVGT6ibY2ona1hgJUOodYizll\n fgFggLFBxCKOYzO/E0b2p3hlDwIjdLkqiDgIhPuKoa6AiU5hwptnMR5ihD8+9PsZohbn\n FAEhhQXO/EoLH9ge4eKOSEdQn9xoC5TFMZtYTtpo++++x7kVBCeZS1ecU8L8fK9L1hLp\n 5ZBQ==", "X-Forwarded-Encrypted": "i=1;\n AFNElJ/lV3okcGJa296ihZfvvpmHzi6GhvFsn3jvobSJZPU0+6ZI/caMQPr8OcW7PgW7N0RRc7E9iqZDU9tE@nongnu.org", "X-Gm-Message-State": "AOJu0Yw8cxqxSXZKqxY0U1vNlBjzO0TAz2YiSZBavsAxC/lN1+MWCYz3\n wQAcsOODZL9BxW3JRh40Vy/LPrHLWmgaLhpe+pv6L3eyWIzbOfOiJ8RJ", "X-Gm-Gg": "AeBDievjyOZZGR2QGSOwCZv5IFhFn70UImEXyv6h0zLG2d2LFmbEkSirDO4QQDmYdcN\n nEe1gPw5zXPfo6u3NAlLgKYkKB5yK6WYUUvG+7mKTzvuyhLkUk7NTUb7IzC1ZD6fUsSTXpRMcfw\n GpJ5OjfdlET1Sp+Tme3wS7A/HlrNIufbRwEDelHbBjNLCrpMgNsJL66B0p/x4pnBkqp3gfEhswJ\n Fzhy3VeTMj1qLwRR8LdEfc/AkFM4dkauNKw+Fqni0pgOk4pdzSkqAiP1WbPC9OtEBQUXGnj8/tF\n G62U8W936jL7wyOkkqSHTrn0Z5ARQxBQy6f58ZEU42f7c2sVmJADE3e12VAAOIlL2sx6QeSYyhy\n W1/VuUl5+7xnncNirANlSVQAP1jpw090MJQ9pA3ttfED+ZtNKFayJLlKTjEw2r48nl2FJs7k/Yy\n F7bXKDy60JFgP+nJNolEU0/CyVAKwQa/1FxmiHbaUFnqvrEhb2iJLXf8uXRq83USo=", "X-Received": "by 2002:a17:902:f212:b0:2b4:5743:2395 with SMTP id\n d9443c01a7336-2b97c4b2a2fmr41125825ad.19.1777438205527;\n Tue, 28 Apr 2026 21:50:05 -0700 (PDT)", "From": "alistair23@gmail.com", "X-Google-Original-From": "alistair.francis@wdc.com", "To": "palmer@dabbelt.com, liwei1518@gmail.com, daniel.barboza@oss.qualcomm.com,\n zhiwei_liu@linux.alibaba.com, chao.liu.zevorn@gmail.com,\n qemu-riscv@nongnu.org, qemu-devel@nongnu.org", "Cc": "alistair23@gmail.com,\n =?utf-8?q?Sebasti=C3=A1n_Alba_Vives?= <sebasjosue84@gmail.com>,\n Alistair Francis <alistair.francis@wdc.com>", "Subject": "[PULL 23/51] target/riscv: fix stale ptshift and base on page walk\n restart", "Date": "Wed, 29 Apr 2026 14:47:24 +1000", "Message-ID": "<20260429044752.4176397-24-alistair.francis@wdc.com>", "X-Mailer": "git-send-email 2.53.0", "In-Reply-To": "<20260429044752.4176397-1-alistair.francis@wdc.com>", "References": "<20260429044752.4176397-1-alistair.francis@wdc.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Received-SPF": "pass client-ip=2607:f8b0:4864:20::62f;\n envelope-from=alistair23@gmail.com; helo=mail-pl1-x62f.google.com", "X-Spam_score_int": "-17", "X-Spam_score": "-1.8", "X-Spam_bar": "-", "X-Spam_report": "(-1.8 / 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 FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=unavailable 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>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "From: Sebastián Alba Vives <sebasjosue84@gmail.com>\n\nWhen the atomic compare-and-swap for updating A/D bits in the page\ntable entry fails due to a concurrent PTE modification by another\nvCPU, get_physical_address() jumps to the 'restart' label to re-walk\nthe page table from the root.\n\nHowever, neither 'ptshift' nor 'base' are re-initialized before the\nrestart. After the walk completes, ptshift has been decremented to\nits final value and base has been overwritten with an inner PTE PPN.\nOn goto restart, the for loop resets i=0 but ptshift and base remain\nstale, causing the restarted walk to compute incorrect PTE addresses.\n\nIn an SMP guest with MTTCG and Svadu active, this can result in\nincorrect physical address mappings or guest crashes.\n\nFix by saving the root base address and re-initializing both ptshift\nand base on each restart.\n\nFixes: 0c3e702aca (\"RISC-V CPU Helpers\")\nSigned-off-by: Sebastián Alba Vives <sebasjosue84@gmail.com>\nReviewed-by: Alistair Francis <alistair.francis@wdc.com>\nMessage-ID: <20260401053853.10473-1-sebasjosue84@gmail.com>\nSigned-off-by: Alistair Francis <alistair.francis@wdc.com>\n---\n target/riscv/cpu_helper.c | 5 ++++-\n 1 file changed, 4 insertions(+), 1 deletion(-)", "diff": "diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c\nindex c28832e0e3..659150c646 100644\n--- a/target/riscv/cpu_helper.c\n+++ b/target/riscv/cpu_helper.c\n@@ -1316,12 +1316,15 @@ static int get_physical_address(CPURISCVState *env, hwaddr *physical,\n adue = adue && (env->henvcfg & HENVCFG_ADUE);\n }\n \n- int ptshift = (levels - 1) * ptidxbits;\n+ int ptshift;\n target_ulong pte;\n hwaddr pte_addr;\n+ const hwaddr base_root = base;\n int i;\n \n restart:\n+ ptshift = (levels - 1) * ptidxbits;\n+ base = base_root;\n for (i = 0; i < levels; i++, ptshift -= ptidxbits) {\n target_ulong idx;\n if (i == 0) {\n", "prefixes": [ "PULL", "23/51" ] }