From nobody Sat May 30 19:22:59 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1777542261; cv=none; d=zohomail.com; s=zohoarc; b=nPvtXjG+Vp8qxuo63Iqs0xQHIWb1dlEfm8NOzdsM6BlhAu3kAqZB3GOiL7/9UI89np8kurRD/nNpbKc29es1b69jAq9LubGgovHHHsMvUtKaOiDm6wVC7rL/XVLhKAFfqtyDIxVb9r8tmGo7HWnDkyuA2fHPUuiwwkza1Gv15pU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777542261; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=1Axtq64X+5rSvIEqryvcspUpFF2IjRCQsS7/Lsf4JrE=; b=iLCUIvxpT9BGPphE3EtiBEUcbyriaLfMOa760R2W/aYpDHvNobnEEPp/ufBb8+WyzQoDJhgg2Sl0+AvGF/Hd9LhfyMLZXOO7383rZVSO1lBspYrV2fIStwTpenSj02+aCO4pX82YSM1qhPs8pC8tWvhI4Yzx+20crQS0m9b62yY= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777542261704736.8384518372854; Thu, 30 Apr 2026 02:44:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wINr3-0004vU-3m; Thu, 30 Apr 2026 05:38:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wINqr-0004gY-Hx for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:33 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wINqi-0002Ry-TX for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:33 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-43cf8d550bdso633762f8f.0 for ; Thu, 30 Apr 2026 02:38:14 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-447b421721fsm10816795f8f.15.2026.04.30.02.38.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 02:38:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1777541893; x=1778146693; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1Axtq64X+5rSvIEqryvcspUpFF2IjRCQsS7/Lsf4JrE=; b=MPkuY9akhcw6HuHD7r3F2Oc8P/xcwX5Ognkvun23QXB+owtMpSQbDFkTE66EUd/Rpq rweqAnCbXKNwwJUzHdM6yF1M2caN3jeSE7EOoE/LEcyukyEIsB/X/Kl52olrgCyCyHDu eReW4EsGqi356/4/Jxw161ElNGZn54Z3YYn0hxg+6HtakTPYohBO9L/xZfLBxoxdRPtb SHADi/rI8I+Nt89O7bmYCPTmVSskD5iPIVyvulN1474Y7a+iFPsGiEv32+2liW5jmyCr b2zIvjE6SsJR3uIeACsdFGJHod76K7yZdBP+J2pxH5j251hVYnfpxzzX28X3aHAUCHo9 zmtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777541893; x=1778146693; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=1Axtq64X+5rSvIEqryvcspUpFF2IjRCQsS7/Lsf4JrE=; b=m/JCDPnDVmfcy54RgV9CJ4OTPip1Tx+88cIhWR7yBVpntz4hqLSQafsAJAcpinVIJE rrrV9Mf0nFPCfWbRD4qRnKth/+kZWrUqOQGNYSn6JnubL0SRBRfuw8VbHIeq9HebfxBV mHOncyCIvRXwE4mj9cnmrXdhIFkuHkig1d2oE3VLkOXzwLrwGQa3iG2HcsmDoKU57EJT hHQtpWAjgGg9wrLCWJ0RAa0vw/IwxskAXiQCvcP9OIuvXgVwfJ8iLpe9W8lYGXZfBPFo b86BeoYTXNcM6FwfAH0r9CcJzM/GXFoygFXzsj+/+lNCDkGaepUp6l1L5GFeGUd4GkfO M/8Q== X-Gm-Message-State: AOJu0Yx6UVhcnZ137y5wMXMJ3pdyEvoBTLkzQFSlmKIgyugX4f3CFV95 HPi1Ts2jgCG6MVf1+j63UmS00KCVh8bvxqjmYs5kJtTkOlY5iWxQ4zhCj4rp/7TpQFaXk0/wyJF rrSGm X-Gm-Gg: AeBDiesoAvmICofKt+skP5LA1bhikQ+pFC5xlP5JgZjDxINFRzD5P3wBH1zm5f4zCgr +PKgIWjtwrHFLzixzRNbdrYEHZ69YlhHQC6Lf7dw4SFHbEgE/5Vamzr7cXTg/SInRJlFUtrm+Q0 VOFLAgTcUw9tW/4x1koljfSrlgppLo0mctol7fLaTnKmcs7MTuOxhTBxJSj0PvvA0wDJLi2sPqo aq0PPRSSUnDXXqvi8/1baOpmIHi8qCXXsfgwGjwQVlndoqA8eNh2vBtsA8c9w5XuvFiF5KqS0ta Zvdwh7T+GHHdcE8flVUkkHufSPVKWHwwDbdR8gRqYdJb18XGSzViELghtxqbIgcl4AS+BMpW/HK MTRUwdjDkFkC+CpJnhe5ZI4exmIDOYwN7e0dH8lYkiyYI7+WQ1r8tB3AAvNNLvLvk6I7oY4Rsy4 /83exM4ba6jJhiA3a5RegHxMHXVyF3vKBghbrn7gfPYKXiMjf6jXZO7emJgWkLCn3ux7nZkdz5Z oBRwpdIUBYGjC6ZVkOZgGikSwMOPvIEtLK7LgeZLA== X-Received: by 2002:a05:6000:40cc:b0:441:1df5:480c with SMTP id ffacd0b85a97d-4493ffcdca0mr3451189f8f.42.1777541893235; Thu, 30 Apr 2026 02:38:13 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Yanan Wang , Zhao Liu , Paolo Bonzini , Richard Henderson , "Dr. David Alan Gilbert" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour , Peter Xu , "Edgar E. Iglesias" , Jiaxun Yang , Nicholas Piggin , Chinmay Rath , Glenn Miles , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Ilya Leoshkevich , David Hildenbrand , Mark Cave-Ayland , Artyom Tarasenko , Max Filippov Subject: [PATCH v2 01/25] hw/i386/vapic: Cope with non-page-aligned return from cpu_get_phys_page_debug() Date: Thu, 30 Apr 2026 10:37:46 +0100 Message-ID: <20260430093810.2762539-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260430093810.2762539-1-peter.maydell@linaro.org> References: <20260430093810.2762539-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, 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 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 @linaro.org) X-ZM-MESSAGEID: 1777542262692158500 Content-Type: text/plain; charset="utf-8" Currently the i386 implementation of get_phys_page_debug() always returns an address aligned to a page boundary, and the vapic.c code assumes this: it adds back in the page offset after the call. Change this to OR in the page offset, so that it works whether cpu_get_phys_page_debug() returns the page address or the exact physical address. This will mean the code continues to work when we change the semantics to standardize on "return exact physical address". Signed-off-by: Peter Maydell Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- hw/i386/vapic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/i386/vapic.c b/hw/i386/vapic.c index 1acb9f91b2..3738031a05 100644 --- a/hw/i386/vapic.c +++ b/hw/i386/vapic.c @@ -309,7 +309,7 @@ static int update_rom_mapping(VAPICROMState *s, CPUX86S= tate *env, target_ulong i if (paddr =3D=3D -1) { return -1; } - paddr +=3D rom_state_vaddr & ~TARGET_PAGE_MASK; + paddr |=3D rom_state_vaddr & ~TARGET_PAGE_MASK; if (paddr !=3D s->rom_state_paddr) { return -1; } --=20 2.43.0 From nobody Sat May 30 19:22:59 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1777541943; cv=none; d=zohomail.com; s=zohoarc; b=ZiB26weHXaxq0XMW0mfLsy13NP2V+RChGbwdOsEGoH1kXkF7xc7KcLixDVjhI5QdWZUp3L0AsXoix1P+7eVTDgssc7LWncrpRNskHH1HwmcKJIk44RYZbjLAPSqfgYUCgU/PxW3egC2Ou+1v18D1fisUL/nRT6yKCfoUoWiT3BQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777541943; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=WbM3cM2bDzJO93KlH0zKhh0sYblzAm78jBIigZVtZpY=; b=L4AvRJwX+NJGOB9dkJcligifg5SnJZaRlMHmECfWYZ23GBV4UenyBdL9P3jdGuTlXJXj0DSRED44cg1Tu9r12LW6VbFOPC7N0uJxxb+p93qoetOWJSPzk9il7VtHUXjvJiyDe2uQrpl5v2i49Gc9vSS7PEavkukwIwZpzSfJa7E= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177754194305732.96032225576187; Thu, 30 Apr 2026 02:39:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wINqn-0004da-Ka; Thu, 30 Apr 2026 05:38:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wINqj-0004a1-JD for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:25 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wINqg-0002Sp-Bp for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:25 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-43d43e09de5so350323f8f.1 for ; Thu, 30 Apr 2026 02:38:15 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-447b421721fsm10816795f8f.15.2026.04.30.02.38.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 02:38:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1777541895; x=1778146695; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WbM3cM2bDzJO93KlH0zKhh0sYblzAm78jBIigZVtZpY=; b=cnpgdseOmEmem2a4jVGY6WNxdMGRES52bT2c4AKy582VMgCcSYclXF7cBgKqzJNfj8 Onbu0CqFZvD/bJNC0Er+v5PQ8AfvlqYXwFjaZcwL7NG64qlSkCbpowHD39XY+HX60r6w anVJdeAaMukWKXwajyprueMEFyvpvztrHjI2HTZgRRdOS5bBVcV7PmJOOd21XrnK7GcP ke5N7gSOd0cHz5LlDL0wsDmGVxYmxDxpm9wUEgX9exxkNgxRb0WDTAs1NvyRN+cwgsbm 6b05pS0AdkI1IH+zfVlXjI3sI9vxvLZHCztfOZtDSgPmCuQABS2b5ZW76h+FUbUL37D1 Drsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777541895; x=1778146695; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=WbM3cM2bDzJO93KlH0zKhh0sYblzAm78jBIigZVtZpY=; b=OMtx1LhivL4BTFBsK3LuFueRWiS78FK3YqiVjbNP090fqCi+mPI0fZBX171azlwBMH 67OKG0PFzFbryBj5Dh6ibL/aph8eKasgUqsAu6DBgVTepyfBFcLuS+ewyo0r/QfnsyFg IdJ+AaZtOSOCLqBUJMGoWml/HY+JsR7bXR6j2zvpdap91J5xd3TRkxcxThLELtMXvZG2 HRa2n6IrFltBttOE56LhZzj1SURJ36FBLTPdWvE/nJSVW+bdYF39zzmN3OiwqoFN0TMU o9sFFA3ualUoOoXDd9Et3qm6GtmMXzW4ka76U/zkAcGJBFth6cQn9sqhqweB2HDP5h0M /ZwA== X-Gm-Message-State: AOJu0YxoNqFDmG14HfBPwUrL6ie/PDjX17upnKY1sU67WxIPeyJy40rl vwEwJVxfjrfgkATM/B2wAvcFnCWIQHi4aMgKn8PWJlSsz9761eZ/on5s13tym8ets2Lp5yMWrl+ uoJVG X-Gm-Gg: AeBDiesqmZlfjmjkJizZaFYWztNdPKRPdIlX5DXeGrrLyaF6eCqacl6GFXC8p4NT+rn QfqlOjlnWRGS8pp3hui5lXkRoj3bhAZz2idZFrXh2coFjrTnSNBfZ1NgqZ2qSwGPbxL93G86JUB FxEz17V0tBhtvRchjmxFwBnWaBzF5OAcI8vElbCpa4lyGivniK023ftZLtno4m+PsbwDeb427HS Rp6le/3ATA+vTy761k+Vu1mjGxgLilm9hm9R8RvpTg3zQF7CYY0UgIycS9lRrCkPJuh5z5lqB5t 2+0rMFqgEhrT11SEXal35mHCsZZUmMRg5EwoTUPAd+LfqAbg3T4Ok//LuHm5r2I4RAwW3a6qygP 66GmmPyJ2TPBQMC1cQe/h0ocFfgzZsUZ/Mn6+LjFG09P2Ho0JaSA84CrkoMDvcQ+0tcxxkRjiQX +2qskg4O3i/A9w3YhxdlbkoXqifee13AE60wLHW/pTIBEbi77Lq3ZrU8JyeFFbFMnsC3dwqS6/9 m5NpzImC7BGBPPDTs0d3sl99A0nxJeUtxYG6hIjZw== X-Received: by 2002:a5d:5f47:0:b0:43e:a70d:763c with SMTP id ffacd0b85a97d-4493f71a4f1mr3482410f8f.42.1777541894561; Thu, 30 Apr 2026 02:38:14 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Yanan Wang , Zhao Liu , Paolo Bonzini , Richard Henderson , "Dr. David Alan Gilbert" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour , Peter Xu , "Edgar E. Iglesias" , Jiaxun Yang , Nicholas Piggin , Chinmay Rath , Glenn Miles , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Ilya Leoshkevich , David Hildenbrand , Mark Cave-Ayland , Artyom Tarasenko , Max Filippov Subject: [PATCH v2 02/25] target/riscv: Make get_phys_page_debug handle non-page-aligned addrs Date: Thu, 30 Apr 2026 10:37:47 +0100 Message-ID: <20260430093810.2762539-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260430093810.2762539-1-peter.maydell@linaro.org> References: <20260430093810.2762539-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, 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 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 @linaro.org) X-ZM-MESSAGEID: 1777541945992154100 Currently our implementations of SysemuCPUOps::get_phys_page_debug and SysemuCPUOps::get_phys_page_attrs_debug are a mix of "accepts a non-page-aligned virtual address and returns the corresponding non-page-aligned physical address" and "only returns a page-aligned physical address". This is awkward for callsites, which in practice all want the physical address for an arbitrary virtual address and have to work around the possibility of getting a page-aligned address, and it doesn't account for protection being possibly on a sub-page-sized granularity. We want to standardize on the implementation having to handle non-page-aligned addresses. The only thing in the riscv implementation that we need to fix is the place where we explicitly round the return value down to a page boundary before returning it. Drop that. Signed-off-by: Peter Maydell Reviewed-by: Chao Liu Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-id: 20260417173105.1648172-2-peter.maydell@linaro.org --- target/riscv/cpu_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c index dd6c861a90..475e9cfd57 100644 --- a/target/riscv/cpu_helper.c +++ b/target/riscv/cpu_helper.c @@ -1677,7 +1677,7 @@ hwaddr riscv_cpu_get_phys_page_debug(CPUState *cs, va= ddr addr) } } =20 - return phys_addr & TARGET_PAGE_MASK; + return phys_addr; } =20 void riscv_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, --=20 2.43.0 From nobody Sat May 30 19:22:59 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1777541994; cv=none; d=zohomail.com; s=zohoarc; b=Ke3UrCHzJXPjv5np04rZdtQDMgMYB9s/QgP0Tr9HCKtqiNv8dXxUxco3/KGJYOc4cbwbOcpTWDiQl4hgYytHFZ8QxX6CNGQKs0Pa3d20uV/A0yqHSrFrn+/+Gkg3Xld9DFK/a/R/E82cz+DcwApdZATbSKBU9bbYJuN/6Gze0Yk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777541994; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=MdlueKTPTxRLKeni3j1LW0jwcf31UmunOv+FakAqBh4=; b=kpyBXW9xRHmrWrMfYLhTaZSbBNUS3OOWwJ7idJ5VCEwMCZIdPKVJuuQ/vFH6wEuPLi/pWGN3Kw19QfJCJXm5numwvU++LqM+6yTmwMtKb2+UdVongsiG2dV6tE23L2AqwTvjV0f35e94IdNEjN5wEEv3zXXs1duGTlMaCHYqZXk= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777541994575989.3708693274639; Thu, 30 Apr 2026 02:39:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wINr9-00052V-1y; Thu, 30 Apr 2026 05:38:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wINqs-0004in-LU for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:34 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wINqi-0002TA-VA for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:33 -0400 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-43cf7683a28so464007f8f.2 for ; Thu, 30 Apr 2026 02:38:16 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-447b421721fsm10816795f8f.15.2026.04.30.02.38.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 02:38:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1777541896; x=1778146696; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MdlueKTPTxRLKeni3j1LW0jwcf31UmunOv+FakAqBh4=; b=MAlDIKzm+UGnD+6jtuc1qHMUJ+GaTEdXsHxI1vhizN0GLMS+nTW7q2VNrUHR10/gTS cGFpfeT60pg27qWaiIYHqu/KZxnrCG2SJqv0bqLy2SldAigoRuT4USTjr7SD4Xf3n7e6 3K1BJMxwTkr0fPojslmoP7Qf2R1LSqcVzOBlehlMzmLEg6CbW/jY0GbGHF6ryMhlEtjV sCkQkBNx79emD261DXiT4Izu6DFnEOSWVkg6dweGRyGXAvXhJGLEkQjP+CLVyYslmXJV jc0ggq6DeNgRmcQIC478kID6tenRa+IfyC/0P+d4Rz+uVHLd5+eeUp+5MM4eWvGoHFew AyaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777541896; x=1778146696; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=MdlueKTPTxRLKeni3j1LW0jwcf31UmunOv+FakAqBh4=; b=KTC2hdXK0UtP6ILCCNn8GxHR2jDFfKIoIvypAzdDTTbxO/Ll9nlYPy3zwO34nOkC7f 5M5jPFFGeSw5L72g0FGzHMbtyEVulUIjm2kpYnLXUpHjcioVagpvIK0zhcWZA2Wc1NdO hJfnMECCFFRYSLwufQhFxmx+Czu5ApVN5K8uJ4HpN1JgvwOvTFHkSEt/YEuO1axXjz+s VCtwUxVN7yZH5eouwMcyZTVT+b53LlKxWtv4LNDlcALz9tcMCtsWVVCyb795IK3tsRdO LPzasqOjrGo9Rlz2WxVkFWwDCvY6ucaRcD9RVZ1/+w6a9Ou5A69lqJcp5JTKI51odsUX I7Fw== X-Gm-Message-State: AOJu0Yx/XiHcVamfZPPqUR1RdpfJPrSzZHq0HoiLLQQDwp9XwTpFDRMb snwpKkJMivJ1dYpSrgpscqlUiRDZ92r4/GPJWm9M6YkmpF2bGCS61IIjN3Kttzf9Np8YBWExjDg QRdQ3 X-Gm-Gg: AeBDieuUqHZcMEaaWguBhV1ELlxPoF2HBAh1inweaMuI5nb9zpQnHko0EA/l/wMlB6v 63caRB865pBu4paQPRGcZ5csPrTlHseRULlAe1iLfncAT+E0/m///5g3DpqC882an7J2TR7PTV9 ek+/OIXJsT94bOuFxp7RKR6uD6hWI+vQaJPZcUDhj0Yl66Q6+wy/DH747YxIJX99f9fxzyz7+nX 9/m2sUj2vNiPFqGwwmPgx8iXBjDy6Y06th0xZFz53fzRLKqg0EWXt7PviSy8DEORfXXqcAwdYqj ka6mtwvXlmAhMAAjsRh8p8H6H088pYQZg4Hlwlu3Vp+f8U94HhrybghEv/U8OBMHK1l0yJ/fgVG VASdzBaO7jBdpdnjCXSr9rgw0EHKqniKtdBknA/cAhMNbytedFldmxLojUaSoPjuPePhAHWfbus vxN0uiwD+CHmvFM4JKVqa4L5vZlxPusn/oZTTwSTG/9FE7fs0Sw/JevrtxgowZ0XrySBzO1g2+Q wTpNl65AqAOFRUjopT1Aj5Y4nC9uaB9KmhmInJp/w== X-Received: by 2002:a05:6000:184d:b0:43d:7946:badc with SMTP id ffacd0b85a97d-4493ec61dfemr3691019f8f.26.1777541895825; Thu, 30 Apr 2026 02:38:15 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Yanan Wang , Zhao Liu , Paolo Bonzini , Richard Henderson , "Dr. David Alan Gilbert" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour , Peter Xu , "Edgar E. Iglesias" , Jiaxun Yang , Nicholas Piggin , Chinmay Rath , Glenn Miles , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Ilya Leoshkevich , David Hildenbrand , Mark Cave-Ayland , Artyom Tarasenko , Max Filippov Subject: [PATCH v2 03/25] target/alpha: Make get_phys_page_debug handle non-page-aligned addrs Date: Thu, 30 Apr 2026 10:37:48 +0100 Message-ID: <20260430093810.2762539-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260430093810.2762539-1-peter.maydell@linaro.org> References: <20260430093810.2762539-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42d.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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, 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 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 @linaro.org) X-ZM-MESSAGEID: 1777541995651158500 Content-Type: text/plain; charset="utf-8" Currently our implementations of SysemuCPUOps::get_phys_page_debug and SysemuCPUOps::get_phys_page_attrs_debug are a mix of "accepts a non-page-aligned virtual address and returns the corresponding non-page-aligned physical address" and "only returns a page-aligned physical address". This is awkward for callsites, which in practice all want the physical address for an arbitrary virtual address and have to work around the possibility of getting a page-aligned address, and it doesn't account for protection being possibly on a sub-page-sized granularity. We want to standardize on the implementation having to handle non-page-aligned addresses. For alpha, the get_physical_address() function accepts arbitrary input addresses but may return an output rounded down to a page boundary, so in alpha_cpu_get_phys_page_debug() we OR the within-page offset into it before returning it. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20260417173105.1648172-3-peter.maydell@linaro.org --- target/alpha/helper.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/alpha/helper.c b/target/alpha/helper.c index 179dc2dc7a..af6d7847d5 100644 --- a/target/alpha/helper.c +++ b/target/alpha/helper.c @@ -301,6 +301,7 @@ hwaddr alpha_cpu_get_phys_page_debug(CPUState *cs, vadd= r addr) int prot, fail; =20 fail =3D get_physical_address(cpu_env(cs), addr, 0, 0, &phys, &prot); + phys |=3D addr & ~TARGET_PAGE_MASK; return (fail >=3D 0 ? -1 : phys); } =20 --=20 2.43.0 From nobody Sat May 30 19:22:59 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1777542246; cv=none; d=zohomail.com; s=zohoarc; b=QkhTKJcHAhL2It0WZzUJ+S2wDqhcUdjeeuAdlrsTaVNx9lQCFg3vwVEgZHqEzzKnQgtvT0iam9BrxdOSWJGgYESaL10Viy8X5OFTdd/p/xj2AorozF+5z/7SmetU2ZqXWwZvVTseXEcy62hwYDYswwf4xgjCRhnQOgJlBbPzM9M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777542246; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=KFFUBwd5+aMPX9c8MeW3RKBPUCvj4D64vvXRmnvq3Ag=; b=f+v9qlkiEPLj5k1RgYZpL9T0EdMTeKDjhgs/3aVQwIE32/yvQZrNCCQsxVB1JOolhFck6v1tjKEurYon498QHf1Mt/lLH9OWmMZ9fKlLVQrNm5qhlXQhAv7eXzi0zuWkqu/iiK++idKo7iac9EaubHwoY8NbUZmBSUKKTgukOzU= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777542246961271.7560077229109; Thu, 30 Apr 2026 02:44:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wINr2-0004uI-Jd; Thu, 30 Apr 2026 05:38:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wINqn-0004dw-K3 for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:29 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wINqi-0002Tc-7H for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:29 -0400 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-43d73352cf2so612042f8f.1 for ; Thu, 30 Apr 2026 02:38:18 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-447b421721fsm10816795f8f.15.2026.04.30.02.38.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 02:38:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1777541897; x=1778146697; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KFFUBwd5+aMPX9c8MeW3RKBPUCvj4D64vvXRmnvq3Ag=; b=wYzPFoAUVZgvi4uNGx7brV4+KhEelIRb5GY/M9EDbdZotK73VFGZQyeAhsNUMhj0bH CkB7t2+4QMUgaEGbYuGu3eR3R+Q+AmiNgPtJcoP4P62B+iBqy9VDPWERholB1SVtLi6G h1dlnjTVJsL7kY5J5+fby4Ha7zJy0sS7oPTjcIijShZ/j/cwNcX7gkLdBhMO510HxBS3 I5oAJBvNHkIkpHRpGn9iN4tuoqIgaVMvt+sUeQr8rTtm6dMz+oFajiF0nNJqky6Lbg0v efJ9IgPUFbq4dtmrAZ5DRZ0kP2GLtty7TZUM4YSXqlwmkasYvh0f05M7XDjhAy6NLyJL iK7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777541897; x=1778146697; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=KFFUBwd5+aMPX9c8MeW3RKBPUCvj4D64vvXRmnvq3Ag=; b=AVu+uPyZDvlEnJaaAN11v4xm0scDDmdASjmWJjPVvJW/0YkHCt2898OUzNqf8xJEpN g+QghO6O7s1lOUgd+2S7hWvX5MVdqyuVnVIo0l7TV2CtSkEtvRJyj3AU5nusDcfhf/Fp +dF9GNSFBIHzd0DH8fEXdyWstVe/2ONzM0t+CHaAWZLBnuVjEpS86w3tiJXTUTa2WmBJ WfxKavVi4kmHZm5kDnwT12nzmBwcLfBZHtAijV5QQ/uUzcSrG56KMRpH5eKg8AC9URX7 lvxZPz8VIzMjztHl86vbSpaDlfL/8HyKBlsHX3Bp/6AjBPxybDxizk3w7DTOYkG9bsdo llAg== X-Gm-Message-State: AOJu0Yx4bgduG2O7QBGxg50I3wtb59B+YKCtZh2rU35slYJztN0E3WNa 11p4ru0DJY9ajaE29fbZNvqT/z9BE2L7ZVP/8V1E4Qru8ubiMqoP+nl0uD/tRJJA8XQV05XJ+qv K/vhi X-Gm-Gg: AeBDiesq3Kody4fI5WK/3wvZUPrMO9/gNhuVEg5DlHGVGzx5FkoQYjWXYfitSXLZdE0 aGy17mmGsn7yhFp97dzinjirCnwD1ULnCbT7SBIwOs1BjJ6BlB+rqK7RQyj8tRD0c+Con6QDNvQ RohHtczXoIkpkk5iv255EsQsKxqZySkBG+ztKfcYFZpvsm6VWTOm86yF+DG9t9T+XmzqlWbBemN GCr+Mr9sAtsK5OFDFcMTUxhiaT7XTDx5L3Vxx+RBd21KSJ+fLb6fzYlEtYkhifOtIWIShNjOnWW wFS4XZk5VbJgOHIUUtal3KGW9/p3xYWmdko+5SGM3pG/aDnqL8II5xrpxMPT5nUjnG+bas5Tu2s qVNRfNxvJzWTelSyBahL4n8SUR9e8cKVOvNq+ktc/todqEs1dOetjSh4/PQHmK9LZl3NnPzIrV9 op+rmglc/fy1tFRAOeKra4lkXp/6FNIZAY0VSfIrP5jRdDurSgOtxAhyLk4XAIhE2O7ixJdLpDM 8lj/FC23w2qgaB2tAxKfeOaJ0lQYEGaQw0tm1i52Q== X-Received: by 2002:a05:6000:2681:b0:448:69c0:8da0 with SMTP id ffacd0b85a97d-4493c28a81amr3534235f8f.7.1777541897052; Thu, 30 Apr 2026 02:38:17 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Yanan Wang , Zhao Liu , Paolo Bonzini , Richard Henderson , "Dr. David Alan Gilbert" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour , Peter Xu , "Edgar E. Iglesias" , Jiaxun Yang , Nicholas Piggin , Chinmay Rath , Glenn Miles , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Ilya Leoshkevich , David Hildenbrand , Mark Cave-Ayland , Artyom Tarasenko , Max Filippov Subject: [PATCH v2 04/25] target/microblaze: Make get_phys_page_attrs_debug handle non-page-aligned addrs Date: Thu, 30 Apr 2026 10:37:49 +0100 Message-ID: <20260430093810.2762539-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260430093810.2762539-1-peter.maydell@linaro.org> References: <20260430093810.2762539-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42c.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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, 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 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 @linaro.org) X-ZM-MESSAGEID: 1777542248908158500 Currently our implementations of SysemuCPUOps::get_phys_page_debug and SysemuCPUOps::get_phys_page_attrs_debug are a mix of "accepts a non-page-aligned virtual address and returns the corresponding non-page-aligned physical address" and "only returns a page-aligned physical address". This is awkward for callsites, which in practice all want the physical address for an arbitrary virtual address and have to work around the possibility of getting a page-aligned address, and it doesn't account for protection being possibly on a sub-page-sized granularity. We want to standardize on the implementation having to handle non-page-aligned addresses. For microblaze, we just need to remove the explicit rounding down to the page boundary that we were doing in mb_cpu_get_phys_page_attrs_debug() when calculating the output physaddr from the results of the MMU lookup. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-id: 20260417173105.1648172-4-peter.maydell@linaro.org Reviewed-by: Alex Benn=C3=A9e --- target/microblaze/helper.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/target/microblaze/helper.c b/target/microblaze/helper.c index a1857b7217..da8abe063e 100644 --- a/target/microblaze/helper.c +++ b/target/microblaze/helper.c @@ -284,7 +284,6 @@ hwaddr mb_cpu_get_phys_page_attrs_debug(CPUState *cs, v= addr addr, MemTxAttrs *attrs) { MicroBlazeCPU *cpu =3D MICROBLAZE_CPU(cs); - vaddr vaddr; hwaddr paddr =3D 0; MicroBlazeMMULookup lu; int mmu_idx =3D cpu_mmu_index(cs, false); @@ -297,12 +296,12 @@ hwaddr mb_cpu_get_phys_page_attrs_debug(CPUState *cs,= vaddr addr, if (mmu_idx !=3D MMU_NOMMU_IDX) { hit =3D mmu_translate(cpu, &lu, addr, 0, 0); if (hit) { - vaddr =3D addr & TARGET_PAGE_MASK; - paddr =3D lu.paddr + vaddr - lu.vaddr; + paddr =3D lu.paddr + addr - lu.vaddr; } else paddr =3D 0; /* ???. */ - } else - paddr =3D addr & TARGET_PAGE_MASK; + } else { + paddr =3D addr; + } =20 return paddr; } --=20 2.43.0 From nobody Sat May 30 19:22:59 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1777542177; cv=none; d=zohomail.com; s=zohoarc; b=Ks+YqG9odAaMlawR1mXT6PWyKWwaKWViiDi/hwkTu5fQmTUBOzdB+LTi5y0wQN8KIjvdmQemAzQ04vh3szVpQCpgtGv4HLDDEbsuCGWasInPcEAHP0J24WRwdMH1DkTMKE65FmtKmWlCkAV0UE1pRad25lJbB5Yd+QBrWno+HGY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777542177; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=HT5u+p0qjQEaNXx84eQO2RGfa34EknNr47WRL7RZ/Fs=; b=R1Fqk1tsM50KGJDexCnLxskeFns3rHPjUpd0o4UuNG+RuYnPWFIeGVSuV/L8C3BLldsqy+gTeRZwTYitkZrRJfyY22cQ0BlURMV2F7Doy9ASMoioan+B7b3fv7kSO9Cw2uLPvgTr5WmHgJwsYJeg2dtOvv0YlCGbCHSYChrMyJ0= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777542177228699.1702064102321; Thu, 30 Apr 2026 02:42:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wINr0-0004p5-TJ; Thu, 30 Apr 2026 05:38:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wINqk-0004b9-Qz for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:26 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wINqg-0002U9-Ea for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:26 -0400 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-445795cf6f1so437948f8f.1 for ; Thu, 30 Apr 2026 02:38:19 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-447b421721fsm10816795f8f.15.2026.04.30.02.38.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 02:38:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1777541898; x=1778146698; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HT5u+p0qjQEaNXx84eQO2RGfa34EknNr47WRL7RZ/Fs=; b=VATf0LZ5eLgfWlcYXeqrM5rN2BCKp/NTuu6HkWzrsGJTiDpvZpNLRyaLNko1L1emr0 I688w3Kv5YFnaPg+WL+U6SA6+nvUriZEYkb/k/PSrvrmhGcf8Wqa53Rk9HFz/z7uoeTV xmp/vNy9yPj6jGW7xCqZzJFv1yY3k+Mipt4O8uummAzAkNEQDE37Iovb9wwRIW2LibX8 SbCK2Z0SO8FRcfnWh3cr8ArECYlswaWlquM6AIzicX1kjcqd6oLkN5xiSrsLFRV0BlB1 37f+itSSwbWKFhuFO86ZPSOLI1XOYhNwun9Masaq30Uq36gn8mq/L27MXvEl9wTRkgLt 1a3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777541898; x=1778146698; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=HT5u+p0qjQEaNXx84eQO2RGfa34EknNr47WRL7RZ/Fs=; b=JrJpL+ZKAZori5brSet6k5/oGyLEmMXvSFFwy87wb5MZOXP/UJiGKwlkJEIFuPYVng 1HU4bx6TqI2rhveP7xiCPgoeQuH11mFhQEYItpuLwp9KO3VIC2Lx6JIoMzCv8UvmFyIY qeAdTqkVGI+2kiti5gI1Us4RFGuVv/1yvCb4WIgpLUzCuxTwE4KxcAijCJuzdqI7Z2Up 5VgOohgpBvqZbVq47qga8EFoYioKxygCVu4yjfOyl8bpqW2Jsitivsvx9ScZu2P2pB22 NQQOsGzdmGy7zpTWzybp8VWYlRrBBlgd4kvtVlaXYkFo6RSF42UDdxfesXEtw4f+OhWr sUNA== X-Gm-Message-State: AOJu0Yz2ejDxDt8YDnFROdPE8R/IxeM0brQYFaDsJkfziCB9tfIWNcY4 ibuf6O97f8PDvAJORT7mi75FO3XcJg2i5aDkG6zAWgCWQi95I/P7nJb7bbhimXbDnIkhiNnzTcw ks7IH X-Gm-Gg: AeBDieur9meUu/IUXwx9pGPJEPkYO1DBkBtitIw398TBJS0un4//6lgnzyoa3kKI8Lq AeDEG493XWbfTDbAIZUMhpkMRy5QBuqYdhOQEgp3e1TjQXa5BLxXdRiicDXFV9cFX52w7X6Yc7W F9H7GHBN0/c2gCar5Ddasb1ipUJImBcZ4IcFFHg6qp+P6MtFB9lw/UnFGFgfR9mheneLQaRNeV9 oZqqlE+0tgYyuXKVDB122yzNQBf6Z0Q4MOfGUd/Z2y0ofHBJRS5Ijy16ZEjNQN65fNxmAf1cmKD YE8vXMvhMmt+1xF5tX5Agc6WCCLTRySNBHLcQv592eGim/CgTR1NwPSsIEWa0Wm75oZsHNDzsZh OIJlZzI9mAwx1JUwIutYmyy5gyM3mFUvne0GlRjmhe665pNvHLN6waNw/ub42HNhSE4nfyrYXmC kmOhpZDkbU+iERxfGtZ2ykRFEeBh5TVK8/EyxImtF4x1KPb54dupppXVX7gnaWHx6+7aZK+UwUL lA7Q3IIC9NGBSjDta7uu2sBu9/WJ2iaKBmOqLWtN++6hO3oLJH4 X-Received: by 2002:a05:6000:2f85:b0:441:1d53:cd9e with SMTP id ffacd0b85a97d-4493faf7702mr3049961f8f.37.1777541898314; Thu, 30 Apr 2026 02:38:18 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Yanan Wang , Zhao Liu , Paolo Bonzini , Richard Henderson , "Dr. David Alan Gilbert" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour , Peter Xu , "Edgar E. Iglesias" , Jiaxun Yang , Nicholas Piggin , Chinmay Rath , Glenn Miles , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Ilya Leoshkevich , David Hildenbrand , Mark Cave-Ayland , Artyom Tarasenko , Max Filippov Subject: [PATCH v2 05/25] target/sparc: Make get_phys_page_debug handle non-page-aligned addrs Date: Thu, 30 Apr 2026 10:37:50 +0100 Message-ID: <20260430093810.2762539-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260430093810.2762539-1-peter.maydell@linaro.org> References: <20260430093810.2762539-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x429.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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, 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 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 @linaro.org) X-ZM-MESSAGEID: 1777542178467154100 Content-Type: text/plain; charset="utf-8" Currently our implementations of SysemuCPUOps::get_phys_page_debug and SysemuCPUOps::get_phys_page_attrs_debug are a mix of "accepts a non-page-aligned virtual address and returns the corresponding non-page-aligned physical address" and "only returns a page-aligned physical address". This is awkward for callsites, which in practice all want the physical address for an arbitrary virtual address and have to work around the possibility of getting a page-aligned address, and it doesn't account for protection being possibly on a sub-page-sized granularity. We want to standardize on the implementation having to handle non-page-aligned addresses. The sparc TLB lookup code can handle non-aligned input addresses but will return page-aligned results. Rather than attempting to change the internals of the lookup code, we take the simple approach of ORing the page offset back into the phys_addr result. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20260417173105.1648172-5-peter.maydell@linaro.org --- target/sparc/mmu_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/sparc/mmu_helper.c b/target/sparc/mmu_helper.c index a6f76a1ab7..25f8a85fae 100644 --- a/target/sparc/mmu_helper.c +++ b/target/sparc/mmu_helper.c @@ -913,7 +913,7 @@ hwaddr sparc_cpu_get_phys_page_debug(CPUState *cs, vadd= r addr) return -1; } } - return phys_addr; + return phys_addr | (addr & ~TARGET_PAGE_MASK); } =20 G_NORETURN void sparc_cpu_do_unaligned_access(CPUState *cs, vaddr addr, --=20 2.43.0 From nobody Sat May 30 19:22:59 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1777542153; cv=none; d=zohomail.com; s=zohoarc; b=AbUpDuzpNUIN6JJACTepHl2KjbaL4Qz7JzPIPe8XRAhjwdrKLR8Y5UYhAui5AxYQAxwepldl8xZi1mnx2V9Ydh15WXLw/7BoYJTMPV9nk0V6hxNasOWGy8Nkyn8BjBl5foLvprb1OGkEn5wBckQ6Frbv1e23SRz5F1/ypZkXYuI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777542153; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=PKFk4CN3FBO853sFmh35BMyRf7rQp8uz5AZqJXrG9f0=; b=TS4EkFAomV5cPRu4ibzEIqI+DfRUs3TFvch99n5wDChEs5hPfi/Vvn7mlZ1/j2wPli3lwQgiGegRYcDiCNzx6SUjrLPkuThId5em5hKjRQzIEufn1MBoJepCHhQdImAPuiU4VD150QFbockAm0wHK8ddPfemybkipyMiyRNNc6o= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177754215306115.876864668155463; Thu, 30 Apr 2026 02:42:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wINr3-0004vg-7t; Thu, 30 Apr 2026 05:38:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wINqr-0004h7-Us for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:34 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wINqi-0002Ul-UX for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:33 -0400 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-4480f9b5efbso626260f8f.0 for ; Thu, 30 Apr 2026 02:38:20 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-447b421721fsm10816795f8f.15.2026.04.30.02.38.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 02:38:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1777541900; x=1778146700; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PKFk4CN3FBO853sFmh35BMyRf7rQp8uz5AZqJXrG9f0=; b=NlYoKLXOLrcQGAOlWDO5P6fan8m93Sk+39VuTYaxNIQhzI38rQ2LODJLfGp80ETUj3 y5AjMOHcTymEY8aIMfRTsvacEP8w/8HvvJPZ9AB98l3ZlWnHsdWOAy7ODzexN1vgvU03 YqdozUWiBeBVX6qvWdkJ++WqbQpVhXlnDiEtyeDIbDg5vruKFcXMVb2od+r30LQi2Pdf Lu36cqV99LOjLGLQHvsxo/Ulr3Ebf6m4eS+CBaHmZ5CIAXdyP1pFygH7LMM5Grn76xI/ EEIM3AMgECgHyMcHIx5tcDCgy1IvrQSOgs2uCCr0nPJpJ0N8z1ofSxUA+aSc0ki7rodS W7ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777541900; x=1778146700; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=PKFk4CN3FBO853sFmh35BMyRf7rQp8uz5AZqJXrG9f0=; b=JC2vsllnhifGyYB00AhOEpvAo68rySZRWwZ1YN4ubwkWzz5JuNV0OpApMVUtdoD8xe S4NL7oknF9DIghNtSaauCXNL0H3PDJqtq8C/bhRArJyB9ILIRidtrzmbfgIKTvzoXPMD LK9Dv6cfZc1u+sHken+RVqu4kljDcppj3niX0robgfy4OhlcCJ51L6uXPiLIkhjc2GER yVw8+n+skJ4FT6m6Wxc6qPg9ZyWZv1k8mI9DATYsE7lKMpF2VhDjjsbd0T1KnvS96R4S fk4BwkE/VY85NYt/Zi8vWeBwL83zIGfRj8Hs2G1b9U/xoefE3l4VEwi9vF8a26xaegca AUqg== X-Gm-Message-State: AOJu0YwqagTtndU2Wqho3laBn0nmUk1eB0eOUF+nKJvul5v/e4wgGr0F uQPaD0hma/ck1WURv7l+pvfAXv7fCSE7DN39f3bK3gQcMirhLxFyZz3E8jLDS7ENEfcBuEfSkE4 /pYqX X-Gm-Gg: AeBDieunzx1WyMRdbwQD2pCAMrfjBQPl1j4w4Nhkte09qocZtjW8xrFkAUQ5AzXinUo mXw02a7KUbv1yTt1Yugn7KFeEoUL/MBgdvZzF6uxerl6ZtCWvvIElrOIY8ZmMhKdO+arsS87/FQ NIPB8UNDAk23nwT5TnUnwpBAVjYElRLFIwLdo7XvIbi81nL/M6v1jk44jRCKJc/y2MoroycJ22H Zpc99R+JWOgyNKaOoaUNUHR87SiJr1JRP/38WCYPs/muJRh/Ila3du3qHWmdoVgv+J0gqpG0hqV k6skkXiWQ+8TJbG3KjMLCErhG+1+/6Vw23OWzVvywNe1oYVhaBiq+1ysb51YNyb2XQn2VVwSYV6 C642VAusjCkHmzyZVINfXBsoePmlPk29J3uYmVud8TGyTaM8ytdIUZQkyrZ6vMUuBjhjRIM/i0j fKcRZxeB6xrvZoR1zdUFjhpXSC/Yiolx6493s3yg7/kDJniz6l6BVXCMzsqEnE6Q8oaTXcFWukh +CknYuommotGpECI6kE0UlReQneZ2IgfXhtd9jIRg== X-Received: by 2002:a05:6000:144a:b0:437:711c:8754 with SMTP id ffacd0b85a97d-4493cb432dcmr3271035f8f.7.1777541899477; Thu, 30 Apr 2026 02:38:19 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Yanan Wang , Zhao Liu , Paolo Bonzini , Richard Henderson , "Dr. David Alan Gilbert" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour , Peter Xu , "Edgar E. Iglesias" , Jiaxun Yang , Nicholas Piggin , Chinmay Rath , Glenn Miles , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Ilya Leoshkevich , David Hildenbrand , Mark Cave-Ayland , Artyom Tarasenko , Max Filippov Subject: [PATCH v2 06/25] target/x86: Make get_phys_page_attrs_debug handle non-page-aligned addrs Date: Thu, 30 Apr 2026 10:37:51 +0100 Message-ID: <20260430093810.2762539-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260430093810.2762539-1-peter.maydell@linaro.org> References: <20260430093810.2762539-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x435.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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, 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 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 @linaro.org) X-ZM-MESSAGEID: 1777542154338158500 Content-Type: text/plain; charset="utf-8" Currently our implementations of SysemuCPUOps::get_phys_page_debug and SysemuCPUOps::get_phys_page_attrs_debug are a mix of "accepts a non-page-aligned virtual address and returns the corresponding non-page-aligned physical address" and "only returns a page-aligned physical address". This is awkward for callsites, which in practice all want the physical address for an arbitrary virtual address and have to work around the possibility of getting a page-aligned address, and it doesn't account for protection being possibly on a sub-page-sized granularity. We want to standardize on the implementation having to handle non-page-aligned addresses. For x86 this is simple: we just need to stop rounding down the input address to a TARGET_PAGE boundary when calculating the result to return. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20260417173105.1648172-6-peter.maydell@linaro.org --- target/i386/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/helper.c b/target/i386/helper.c index c397a6fde5..108b02396d 100644 --- a/target/i386/helper.c +++ b/target/i386/helper.c @@ -372,7 +372,7 @@ hwaddr x86_cpu_get_phys_page_attrs_debug(CPUState *cs, = vaddr addr, out: #endif pte &=3D PG_ADDRESS_MASK & ~(page_size - 1); - page_offset =3D (addr & TARGET_PAGE_MASK) & (page_size - 1); + page_offset =3D addr & (page_size - 1); return pte | page_offset; } =20 --=20 2.43.0 From nobody Sat May 30 19:22:59 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1777542277; cv=none; d=zohomail.com; s=zohoarc; b=I9fTg5yyEK75A9FQjjuGH1LgEFzE8i1+CxJLPEwvmp3K+w3TYlrRKrTMOlX26jDIIHpidF8+YNlDWVNww2YBVjeIrp1eleNRjDw7tElZclbdHpRwhCmAcpaEkVPC2421fvF08LsoTQMa6Oc8DcwVNisTx3+c0RqSErsgDoZ3gTc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777542277; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=DOKX0DPjwYUZpph6iph7SwRnGuSF5f4WQz6+Qq/UgBQ=; b=MU++wGQ0DLIbzyItDn55ctZrekybcdiww2Glt05beL8mQjiRWk0p+eVrx7YSmX9nntgZK3zATnedAijdAfhcE163bGEP8GIC9NOuXQXvXgHguycUoMkCkDlwT6eR3DG5I9Fs3844741c69TltNDmlgPnfb4iPlCL7MiQ+/Bit2I= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777542277985536.9954096859831; Thu, 30 Apr 2026 02:44:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wINrA-00054k-4p; Thu, 30 Apr 2026 05:38:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wINqs-0004jF-VK for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:35 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wINqi-0002VI-Vi for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:34 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-441209fb77eso415862f8f.1 for ; Thu, 30 Apr 2026 02:38:22 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-447b421721fsm10816795f8f.15.2026.04.30.02.38.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 02:38:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1777541901; x=1778146701; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DOKX0DPjwYUZpph6iph7SwRnGuSF5f4WQz6+Qq/UgBQ=; b=A+lK18QNA6IxuMjUR/9/ESTG7vCZs5U5PQi2j76GI0FUWCjBTIbGyGHh3l0jp4pUdN 0lBURg0e0tPdcANAiGnRNE7GkhD0EAhLRyisiYi2gIYRleJUBNmLhKfTJP4aPYFnj6VQ cm1q3afaW2lopDPmePZnhYJ2EkzRgouuCqt8su4Yy/8+zLoFfU53fgBhzaHmEQhPHS9B c8Dgoc8N/+1+EbxbhbwztZxTHoJEvzFu+yCIXCqiWkqqo0V0VAtoJ+XLxjICSu6M3x3g 68ehSFXk/kqQKRO7RWEeJKczrgQ1nW8VrRYOabaidbbI5cu6ZPCQNHag7Mzc65Sj2wRa uB0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777541901; x=1778146701; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=DOKX0DPjwYUZpph6iph7SwRnGuSF5f4WQz6+Qq/UgBQ=; b=jRpp+cSEXw4ljU/ldByKaqmaVEx+JxPCrA7fNUuNrdBGIoA951t60Qn95K5E+gCy/9 uldPXadW9wUWwF+itEKVdhUxwcnuxNCxiI5vOC4YJQapYkPnVySPOsIM1gdzXiGgOcEO lSmFsBz1dA47pq+MNd6DMKzM7Nsifs5vzneCWTJu2u1T4+Sil4SVjYSp29tE5ZNd/rsk VWBMaUqHZgn3Qf85FeKSEkxlyauZV+5pH6aVvB/h+2+0NLBp9bGO4EuXoYIp8zuvLPUI 1ylyTYioSszMgc0ntcw9I0u33/TBxXLqynECUo3Rqcvzdyg7bbcxz3/IMvqSO6WrphBm 7jqg== X-Gm-Message-State: AOJu0YykP7rGrOFieFGISSCfMfiZ/KRsas6sZ0jsF+EDBh3LL8VV5Uei kVxVuPaiRLLEZPEZjZT1jVbquJjZWFVMExyGJn3TEg+mlWEd6Jydx77MBmLaVvNwMlKKZn1chMr RK0pJ X-Gm-Gg: AeBDiev+7MtBONI4Q8VeEln/0PxWVGZb6jk3L57TUv4IZGPPdljPmn95Ng09l3JjKRx vZdBtgwTIMnmmNmNHZvicoDCfK5hImGxg+d+6tvynd0imQ2+AMjrc5v3KcmTv9dfni5uAoYQ1a/ vLweLhw2Q6/BRsi/tFlQHS9HHs+lxZL1TPJS+0enMR5Xw2LOuVCEOT2l8dL5MTAOQk69pP6OxAB Kb0yEo2smYVRVAkyapaVyCL1HFCUDXdG3+2AlT2kfDAxcXxuONpdJljwzPtbQUnbm74SUhw5U2W u47hMX7/ApsTr2Eznpgro5s/+zLEPpF/D+RtPhYYJ4FuUbUAg+hdc/J1yNcPvIrPfKojg94VZn6 m6RthySOjrCMRYxtnxhrcVQxslljE57GU62X26OBVXC1NCrO6nsqs/qWbOdxueWh0jfQ3+uck2j xzBeXPEU+A0/Jv7z1kdSHypdvuQxcf8cEp5QnYKd+ISWmvBiURh3GFJOgZOI0K85UUy+NUmW1RE jd3ma3I4nMKJHmX3KxS2MPJg6joRobffRgtDrqbXA== X-Received: by 2002:a05:6000:2381:b0:43f:e9f0:87bd with SMTP id ffacd0b85a97d-4494e8d7bc5mr3084907f8f.10.1777541900731; Thu, 30 Apr 2026 02:38:20 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Yanan Wang , Zhao Liu , Paolo Bonzini , Richard Henderson , "Dr. David Alan Gilbert" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour , Peter Xu , "Edgar E. Iglesias" , Jiaxun Yang , Nicholas Piggin , Chinmay Rath , Glenn Miles , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Ilya Leoshkevich , David Hildenbrand , Mark Cave-Ayland , Artyom Tarasenko , Max Filippov Subject: [PATCH v2 07/25] target/s390x: Make get_phys_page_debug handle non-page-aligned addrs Date: Thu, 30 Apr 2026 10:37:52 +0100 Message-ID: <20260430093810.2762539-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260430093810.2762539-1-peter.maydell@linaro.org> References: <20260430093810.2762539-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, 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 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 @linaro.org) X-ZM-MESSAGEID: 1777542280757158500 Content-Type: text/plain; charset="utf-8" Currently our implementations of SysemuCPUOps::get_phys_page_debug and SysemuCPUOps::get_phys_page_attrs_debug are a mix of "accepts a non-page-aligned virtual address and returns the corresponding non-page-aligned physical address" and "only returns a page-aligned physical address". This is awkward for callsites, which in practice all want the physical address for an arbitrary virtual address and have to work around the possibility of getting a page-aligned address, and it doesn't account for protection being possibly on a sub-page-sized granularity. We want to standardize on the implementation having to handle non-page-aligned addresses. s390x already has an implementation of "give me the actual physical address, not rounded down", in s390_get_phys_addr_debug(), so we can use this for the SysemuCPUOps::get_phys_page_debug method, and merge the s390_cpu_get_phys_page_debug() function into s390_get_phys_addr_debug() which is now its only caller. This leaves the function implementing the method with a name that doesn't match the method name, but we will fix that shortly by renaming the method to *_addr_* for all targets. Signed-off-by: Peter Maydell Reviewed-by: Ilya Leoshkevich Reviewed-by: Richard Henderson Message-id: 20260417173105.1648172-7-peter.maydell@linaro.org Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/s390x/cpu-system.c | 2 +- target/s390x/helper.c | 20 +++++--------------- target/s390x/s390x-internal.h | 1 - 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/target/s390x/cpu-system.c b/target/s390x/cpu-system.c index 881171d71a..c133b0c262 100644 --- a/target/s390x/cpu-system.c +++ b/target/s390x/cpu-system.c @@ -176,7 +176,7 @@ void s390_cpu_finalize(Object *obj) =20 static const struct SysemuCPUOps s390_sysemu_ops =3D { .has_work =3D s390_cpu_has_work, - .get_phys_page_debug =3D s390_cpu_get_phys_page_debug, + .get_phys_page_debug =3D s390_cpu_get_phys_addr_debug, .get_crash_info =3D s390_cpu_get_crash_info, .write_elf64_note =3D s390_cpu_write_elf64_note, .legacy_vmsd =3D &vmstate_s390_cpu, diff --git a/target/s390x/helper.c b/target/s390x/helper.c index 667d4a0da7..1a2658eaf9 100644 --- a/target/s390x/helper.c +++ b/target/s390x/helper.c @@ -39,7 +39,7 @@ void s390x_cpu_timer(void *opaque) cpu_inject_cpu_timer((S390CPU *) opaque); } =20 -hwaddr s390_cpu_get_phys_page_debug(CPUState *cs, vaddr vaddr) +hwaddr s390_cpu_get_phys_addr_debug(CPUState *cs, vaddr addr) { S390CPU *cpu =3D S390_CPU(cs); CPUS390XState *env =3D &cpu->env; @@ -47,10 +47,11 @@ hwaddr s390_cpu_get_phys_page_debug(CPUState *cs, vaddr= vaddr) int prot; uint64_t asc =3D env->psw.mask & PSW_MASK_ASC; uint64_t tec; + vaddr page =3D addr & TARGET_PAGE_MASK; =20 /* 31-Bit mode */ if (!(env->psw.mask & PSW_MASK_64)) { - vaddr &=3D 0x7fffffff; + page &=3D 0x7fffffff; } =20 /* We want to read the code (e.g., see what we are single-stepping).*/ @@ -62,24 +63,13 @@ hwaddr s390_cpu_get_phys_page_debug(CPUState *cs, vaddr= vaddr) * We want to read code even if IEP is active. Use MMU_DATA_LOAD inste= ad * of MMU_INST_FETCH. */ - if (mmu_translate(env, vaddr, MMU_DATA_LOAD, asc, &raddr, &prot, &tec)= ) { + if (mmu_translate(env, page, MMU_DATA_LOAD, asc, &raddr, &prot, &tec))= { return -1; } + raddr +=3D (addr & ~TARGET_PAGE_MASK); return raddr; } =20 -hwaddr s390_cpu_get_phys_addr_debug(CPUState *cs, vaddr v_addr) -{ - hwaddr phys_addr; - vaddr page; - - page =3D v_addr & TARGET_PAGE_MASK; - phys_addr =3D cpu_get_phys_page_debug(cs, page); - phys_addr +=3D (v_addr & ~TARGET_PAGE_MASK); - - return phys_addr; -} - static inline bool is_special_wait_psw(uint64_t psw_addr) { /* signal quiesce */ diff --git a/target/s390x/s390x-internal.h b/target/s390x/s390x-internal.h index 40850bcdc4..e7e4f2b45d 100644 --- a/target/s390x/s390x-internal.h +++ b/target/s390x/s390x-internal.h @@ -321,7 +321,6 @@ void do_restart_interrupt(CPUS390XState *env); void s390x_tod_timer(void *opaque); void s390x_cpu_timer(void *opaque); void s390_handle_wait(S390CPU *cpu); -hwaddr s390_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); hwaddr s390_cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr); LowCore *cpu_map_lowcore(CPUS390XState *env); void cpu_unmap_lowcore(CPUS390XState *env, LowCore *lowcore); --=20 2.43.0 From nobody Sat May 30 19:22:59 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1777541948; cv=none; d=zohomail.com; s=zohoarc; b=jTulkhQRZgYfWiM7mZ7TmE7EBLtrLKwlYlGSvImkYsz25fVHfD1Pm6Or+KqvD04q8GUyBa/KYbZOY35x9WiM9suxFjmJp9VXzTToYUDz7mMXHhonHP6ssehm4r6QTjPBqwvelJBfcHGfUzDZVk/gnA0Eb/K71sWmuXrE6GdWh4k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777541948; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=MY7hfUPLGJ8oz6CMVQMMmJ8m7WR8XRXo8hMX7o/HlFQ=; b=jey62S3gdbEyMBwKtKdFvrR1kg0mwEDxqj5yNZT4KDzF1jpbFkTlRR8rJBAp6hHbQH+SCITkq4k5RPH7PsnFpqkmwHf8pQ1NY8bwWWEiK1LnREuFlfs/xroVy+2urHVRCUzo5+T8po6FQqUiQiEV7a+jbTuFPgQPui+23MUs2VE= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777541948963727.8538385358931; Thu, 30 Apr 2026 02:39:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wINqu-0004kb-KL; Thu, 30 Apr 2026 05:38:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wINqm-0004d5-CA for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:28 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wINqi-0002WC-9c for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:28 -0400 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-445795cf6f1so438010f8f.1 for ; Thu, 30 Apr 2026 02:38:23 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-447b421721fsm10816795f8f.15.2026.04.30.02.38.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 02:38:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1777541902; x=1778146702; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MY7hfUPLGJ8oz6CMVQMMmJ8m7WR8XRXo8hMX7o/HlFQ=; b=tKEkum9QimQVYzY1ThGrCRNAIavfKnifNx/EqcA4I4522+3XVmkDhCPE9aH9wxHIrb 8afbHTm0lddR/xRpJQnGhthgrqIyIGZkCXG/vyXNU0FpiWDo6I8YmwJ7XlBGKLpr3JQC wlzDdxGYDBpXykjHByTmNu+924PRIyKCbxnauGAj6iKMWGJrM7zmHs7C7E0hA7/ucKBu D0aRFIlXGmNgxGSO/1K4CBXgX2AmFlv1cbvfzAap9619Fyxam6/KmNKqTJsscs3o4sgJ m9fCBwojC3zKEePscOVckKSBpn6sa4cMpnqXtBht6xWfgewj5kTFyptvenKU89gAZgsm Kojg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777541902; x=1778146702; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=MY7hfUPLGJ8oz6CMVQMMmJ8m7WR8XRXo8hMX7o/HlFQ=; b=sQgBo4jc9EarR0JMxOqQuLF7hKIPgiLydGTjgNJpLN9o3o0d+8o5u6NHEz8kcG21rx RBYTFCTwKxFAYFbm3r2amipVBDX4yeAId9Q6VqqY2XYBsIwqfp/1Gco57XOGYSHgKimc WKgjpWBoPRPL42F5WkgKpT05sh8/FqhpXHeHA1FPPep1U1WI5OHIzIVKGXL7od8cFZBz JScY7zepWgJOIXhPHFl+zWurQsRx7TI3/waiEYwGCUQIunJrupRTFy3DXCcObAwpbuvn w/PXr0VcmeutWsD06Cg34PcIrarqbk3wwlhxki1Cl+cebhe8aDhgZHvXb0oeD9rgsfAH Vxwg== X-Gm-Message-State: AOJu0Yy8CCDOWbDmsX80UDnfDE0J87VbuW6Halh4wp4Ka9IHfGJe/iFm iT4SB4lW2raWcGgugApHBDhvc6Nk6RKtkioUJHE13hh9rr+ir51GfGiTC7f4Tb2vxNsPIPh6qmn XpF1o X-Gm-Gg: AeBDievmFgK65NM4Nmx8bBZOtlPfCvQFU74+JQX+laQeZI/uTFc0DWjmHkGO3TeDmjh 4D2361BK+EAWGG/TONJ3h1fBVCKyoNA3VlKqPe7X0SM6jKESwv11O9ePrbb3X/lE8ImV2v90OJQ dU9qxKVNuSlAW8LPwqKG7WKjv/Sti/C69WDmeoA1RdwcV1MEl/npBn3QpOv7gpXCGXF4oIqvUR2 bfjKxdpRUNV6OCXO8bO2pfaivM+PxhXItHYddJ20B5lPdxBGWQAeQuiJjaZqshDjo0gs2S4KbF2 pEjzHokcs+LLjsj0Ux3c8sbS5tAzt/deFLGOzXtGEKLLVY2P3ygIfU/0AJOewDCZCRCA9pCER4V ABiePqpznxipKZ3MFe9qHgp5u+XdSEtKYnsAqHhEpimwQ8aURPzQCtbqHlkOlye8riRWnD0UBpf ms+SGus90NZwtoCO7QqN1Y+eifZ8H3soSAuDs2XLBc2FMVqmpEdEXOnTh6s7i/di/XxDXJxmhv2 AkkUxIhE0l5DncMSIZ9Qk+hS0efNc1laRl5pFxU1Q== X-Received: by 2002:a05:6000:25c1:b0:43d:7e11:1b72 with SMTP id ffacd0b85a97d-4493d7f9ea1mr3315847f8f.9.1777541902024; Thu, 30 Apr 2026 02:38:22 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Yanan Wang , Zhao Liu , Paolo Bonzini , Richard Henderson , "Dr. David Alan Gilbert" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour , Peter Xu , "Edgar E. Iglesias" , Jiaxun Yang , Nicholas Piggin , Chinmay Rath , Glenn Miles , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Ilya Leoshkevich , David Hildenbrand , Mark Cave-Ayland , Artyom Tarasenko , Max Filippov Subject: [PATCH v2 08/25] target/ppc: Make get_phys_page_debug handle non-page-aligned addrs Date: Thu, 30 Apr 2026 10:37:53 +0100 Message-ID: <20260430093810.2762539-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260430093810.2762539-1-peter.maydell@linaro.org> References: <20260430093810.2762539-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x434.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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, 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 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 @linaro.org) X-ZM-MESSAGEID: 1777541951620154100 Content-Type: text/plain; charset="utf-8" Currently our implementations of SysemuCPUOps::get_phys_page_debug and SysemuCPUOps::get_phys_page_attrs_debug are a mix of "accepts a non-page-aligned virtual address and returns the corresponding non-page-aligned physical address" and "only returns a page-aligned physical address". This is awkward for callsites, which in practice all want the physical address for an arbitrary virtual address and have to work around the possibility of getting a page-aligned address, and it doesn't account for protection being possibly on a sub-page-sized granularity. We want to standardize on the implementation having to handle non-page-aligned addresses. The ppc_xlate() function can accept a non-page-aligned input but may return a page-aligned output; we take the simple approach of ORing the page offset back into the result address after calling it. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20260417173105.1648172-8-peter.maydell@linaro.org Reviewed-by: Glenn Miles --- target/ppc/mmu_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index 52d48615ac..a1345df716 100644 --- a/target/ppc/mmu_common.c +++ b/target/ppc/mmu_common.c @@ -863,7 +863,7 @@ hwaddr ppc_cpu_get_phys_page_debug(CPUState *cs, vaddr = addr) ppc_env_mmu_index(&cpu->env, false), false) || ppc_xlate(cpu, addr, MMU_INST_FETCH, &raddr, &s, &p, ppc_env_mmu_index(&cpu->env, true), false)) { - return raddr & TARGET_PAGE_MASK; + return raddr | (addr & ~TARGET_PAGE_MASK); } return -1; } --=20 2.43.0 From nobody Sat May 30 19:22:59 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1777542058; cv=none; d=zohomail.com; s=zohoarc; b=XOPD49xzm65LnwcC5nlXvMNTXuk6yjwAyfq5ius0I5D8VBIPOUfLlfQnGmMx4h+EUDv3zkwQEai41qV32IKRxfsCzibdFFNsPNtE6fsS/CjhalgurzMPt8G6eIXPf5rMBI6aJJ4PiV7XkM0EOzc+ybBril1XvZeugbbIbuqrx/M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777542058; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ds0o8rL5bie8S049mYZ4UPlqu2fJMRXXMXyB9gO7cas=; b=XnLs2HYhtJ8x6ZdJzRNmP69f5IB10+4p+aGtbIIvms5BIkXS/xwrm4NRn2fOB1PRlm8v/y7IgTHOKY0bVB3yRR7eXk6Or1d6uRTENiaFy63Gxofcm1C8zyKyNH+1bpgNPXRIrXgXvowdCmqurn6KjSqOgcWoxxpXuCTHmRIQKHg= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777542058509778.2233090696622; Thu, 30 Apr 2026 02:40:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wINrA-00058D-UI; Thu, 30 Apr 2026 05:38:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wINqy-0004nC-OR for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:42 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wINqk-0002Wr-0Z for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:38 -0400 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-449de065cb3so83343f8f.2 for ; Thu, 30 Apr 2026 02:38:25 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-447b421721fsm10816795f8f.15.2026.04.30.02.38.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 02:38:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1777541904; x=1778146704; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ds0o8rL5bie8S049mYZ4UPlqu2fJMRXXMXyB9gO7cas=; b=N36Nnu5fRETEAFGMy+i7tFEPdPKP1DlFkNqdjSbh6gHGmF9/Nz1cjVhThc0Mj85CoR 4rOrwe+nmA3pcbS/HKZotoetnzA9WIxM+DKP8cqPip/bFF+4eYKnGwmgcDdG0GrvIeIE 3uR6o+R+MmlY7nKH8rcjUaBQt0awzYaOHx9mR8M6dWhNM8E4AE3hMC5MHazr1fPkX3Pj amthh3xSFHagK3AvOdMr+hk+mpK0xy3CijFWWxZkk/caqzlDhbVmZokuj17rBRwP0njw QZ+PBD2W8kjtbJXdbESqu70Ll/+kfnvAX/an3wHAi/rpZYCTKew6GVvC85qZeA1i8wdR uRgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777541904; x=1778146704; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ds0o8rL5bie8S049mYZ4UPlqu2fJMRXXMXyB9gO7cas=; b=JCH/fv1BpB34RE0mC0Vvb7bxbQqLtmNbAVeLznZNMaPS7QQ2O1BY6a6hU3UaDf5KJW XtuLVqab/enbC3tFrEPZJ2Kybk5japRpeViRmRIyFCGkOSbfLpUd9puBkS742f41uakM jqJ9vyUURekLu9Wsjio42dE9kpBGdvLb8Yu1zC1fR2wDlFUV/LlpV4QpnKPcQAoG8Y0C WLz3lfcXiuyCswyNtqRi8N7M+flm8AtpUgiseeMyQF7pczkkBFu2bH3NRLyffTkY7iUF O0YswI5LIqCpXlJUSm4KhZiPRa8H9/KW1FVbWP+awpNqZ5w1wJ+xUNFm21N0YJFmThcJ IuTg== X-Gm-Message-State: AOJu0YwzsQ5UfWlHmNbzrqC/LoxFtUnbX/M3NOwsWEImdhdwlX1XXNkL A5ZEpuobyLE9eJDyvepojUfejLZ000yGw/Q1kFY2UGGSfwrl6bUtZyjCo6oL01EBymdB5ZX+VWv 8s1W0 X-Gm-Gg: AeBDiesHuq3f/Cd4qvsoQcXiJMnYKDITeCQ9FGjLRz6qqsSRecLgwu7puVr3Tb7rKC3 +yOQKIkoehCEwj/dK9Ih1tIjizx5u9dd1/iBBuZQA2Xt87l8gRR3n7fMRZ6SshLlslqMRm+rrko w/EH/ug47qX39TimL/1TnnUjwXBxvRdNJh3k6ZvaEhlWKEaNggG22YifqaTEP6eM8gDFUfrSfhX wIBdGMfEXBlkufbaI6hCM/RaAD2grpR2owu9a27twyD3l9VKslC/q8ZE4sMZVxB/V4c6Q50N5YK iA/rS0+JlaoTMztoQIr0xYqlxKmgN2WPHbeG4COFTn/8kjJesOC8mBRNk1Tm9pzdQ1QiNlhw7ML KpTaHMh/Vt8xN9CTdKxNhsPASXxdbrkla9Q4vZrQTM6bJCgK0vsWA6ALRDewtZjmtL3iykBKM7a NlPVaBI3Q1zLgPAM+0msAdm0/QrhyJJe8NSc94A3YhV8bGFvP49gkSkWxboxwe5BeHV6q3iAv5i oNi/6zCnLmPiUOLtUvW03umiyojT8zQ4WXH62Vdsw== X-Received: by 2002:a5d:64c9:0:b0:441:377f:82a7 with SMTP id ffacd0b85a97d-4493ef4447bmr3466123f8f.32.1777541903657; Thu, 30 Apr 2026 02:38:23 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Yanan Wang , Zhao Liu , Paolo Bonzini , Richard Henderson , "Dr. David Alan Gilbert" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour , Peter Xu , "Edgar E. Iglesias" , Jiaxun Yang , Nicholas Piggin , Chinmay Rath , Glenn Miles , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Ilya Leoshkevich , David Hildenbrand , Mark Cave-Ayland , Artyom Tarasenko , Max Filippov Subject: [PATCH v2 09/25] target: Rename get_phys_page_debug to get_phys_addr_debug Date: Thu, 30 Apr 2026 10:37:54 +0100 Message-ID: <20260430093810.2762539-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260430093810.2762539-1-peter.maydell@linaro.org> References: <20260430093810.2762539-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x429.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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, 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 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 @linaro.org) X-ZM-MESSAGEID: 1777542060082158500 Now that we have ensured that all implementations of the get_phys_page_debug method handle a non-page-aligned input and return the corresponding non-page-aligned output, the name of the method is somewhat misleading. Rename it to get_phys_addr_debug. This commit was produced with the commands sed -i -e 's/_cpu_get_phys_page_debug/_cpu_get_phys_addr_debug/g;s/\/get_phys_addr_debug/g' $(git grep -l get_phys_page_debug) sed -i -e 's/_cpu_get_phys_page_attrs_debug/_cpu_get_phys_addr_attrs_debug= /g;s/\/get_phys_addr_attrs_debug/g' $(git grep = -l get_phys_page_attrs_debug) which catches all references to the method name itself plus the functions which each target uses as the method implementation, but (deliberately) not the cpu_phys_get_page_debug() and cpu_phys_get_page_attrs_debug() wrapper functions or their callers. (We'll deal with those in the next commit.) Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-id: 20260417173105.1648172-9-peter.maydell@linaro.org --- hw/core/cpu-system.c | 6 +++--- include/hw/core/sysemu-cpu-ops.h | 10 +++++----- target/alpha/cpu.c | 2 +- target/alpha/cpu.h | 2 +- target/alpha/helper.c | 2 +- target/arm/cpu.c | 2 +- target/arm/cpu.h | 2 +- target/arm/ptw.c | 2 +- target/avr/cpu.c | 2 +- target/avr/cpu.h | 2 +- target/avr/helper.c | 2 +- target/hppa/cpu.c | 2 +- target/hppa/cpu.h | 2 +- target/hppa/mem_helper.c | 2 +- target/i386/cpu.c | 2 +- target/i386/cpu.h | 2 +- target/i386/helper.c | 2 +- target/i386/whpx/whpx-all.c | 2 +- target/loongarch/cpu-mmu.h | 2 +- target/loongarch/cpu.c | 2 +- target/loongarch/cpu_helper.c | 2 +- target/m68k/cpu.c | 2 +- target/m68k/cpu.h | 2 +- target/m68k/helper.c | 2 +- target/microblaze/cpu.c | 2 +- target/microblaze/cpu.h | 2 +- target/microblaze/helper.c | 2 +- target/mips/cpu.c | 2 +- target/mips/internal.h | 2 +- target/mips/system/physaddr.c | 2 +- target/or1k/cpu.c | 2 +- target/or1k/cpu.h | 2 +- target/or1k/mmu.c | 2 +- target/ppc/cpu.h | 2 +- target/ppc/cpu_init.c | 2 +- target/ppc/mmu-hash32.c | 2 +- target/ppc/mmu_common.c | 2 +- target/riscv/cpu.c | 2 +- target/riscv/cpu.h | 2 +- target/riscv/cpu_helper.c | 2 +- target/rx/cpu.c | 2 +- target/rx/cpu.h | 2 +- target/rx/helper.c | 2 +- target/s390x/cpu-system.c | 2 +- target/sh4/cpu.c | 2 +- target/sh4/cpu.h | 2 +- target/sh4/helper.c | 2 +- target/sparc/cpu.c | 2 +- target/sparc/cpu.h | 2 +- target/sparc/mmu_helper.c | 2 +- target/tricore/cpu.c | 2 +- target/tricore/cpu.h | 2 +- target/tricore/helper.c | 2 +- target/xtensa/cpu.c | 2 +- target/xtensa/cpu.h | 2 +- target/xtensa/mmu_helper.c | 2 +- 56 files changed, 62 insertions(+), 62 deletions(-) diff --git a/hw/core/cpu-system.c b/hw/core/cpu-system.c index 273b9b7c22..93dc861083 100644 --- a/hw/core/cpu-system.c +++ b/hw/core/cpu-system.c @@ -60,13 +60,13 @@ hwaddr cpu_get_phys_page_attrs_debug(CPUState *cpu, vad= dr addr, { hwaddr paddr; =20 - if (cpu->cc->sysemu_ops->get_phys_page_attrs_debug) { - paddr =3D cpu->cc->sysemu_ops->get_phys_page_attrs_debug(cpu, addr, + if (cpu->cc->sysemu_ops->get_phys_addr_attrs_debug) { + paddr =3D cpu->cc->sysemu_ops->get_phys_addr_attrs_debug(cpu, addr, attrs); } else { /* Fallback for CPUs which don't implement the _attrs_ hook */ *attrs =3D MEMTXATTRS_UNSPECIFIED; - paddr =3D cpu->cc->sysemu_ops->get_phys_page_debug(cpu, addr); + paddr =3D cpu->cc->sysemu_ops->get_phys_addr_debug(cpu, addr); } /* Indicate that this is a debug access. */ attrs->debug =3D 1; diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-= ops.h index 7b2d2d2610..a4fc330bea 100644 --- a/include/hw/core/sysemu-cpu-ops.h +++ b/include/hw/core/sysemu-cpu-ops.h @@ -30,17 +30,17 @@ typedef struct SysemuCPUOps { */ bool (*get_paging_enabled)(const CPUState *cpu); /** - * @get_phys_page_debug: Callback for obtaining a physical address. + * @get_phys_addr_debug: Callback for obtaining a physical address. */ - hwaddr (*get_phys_page_debug)(CPUState *cpu, vaddr addr); + hwaddr (*get_phys_addr_debug)(CPUState *cpu, vaddr addr); /** - * @get_phys_page_attrs_debug: Callback for obtaining a physical addre= ss + * @get_phys_addr_attrs_debug: Callback for obtaining a physical addre= ss * and the associated memory transaction attributes to use for t= he * access. * CPUs which use memory transaction attributes should implement this - * instead of get_phys_page_debug. + * instead of get_phys_addr_debug. */ - hwaddr (*get_phys_page_attrs_debug)(CPUState *cpu, vaddr addr, + hwaddr (*get_phys_addr_attrs_debug)(CPUState *cpu, vaddr addr, MemTxAttrs *attrs); /** * @asidx_from_attrs: Callback to return the CPU AddressSpace to use f= or diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c index ff053043a3..0c35067b20 100644 --- a/target/alpha/cpu.c +++ b/target/alpha/cpu.c @@ -242,7 +242,7 @@ static void alpha_cpu_initfn(Object *obj) =20 static const struct SysemuCPUOps alpha_sysemu_ops =3D { .has_work =3D alpha_cpu_has_work, - .get_phys_page_debug =3D alpha_cpu_get_phys_page_debug, + .get_phys_addr_debug =3D alpha_cpu_get_phys_addr_debug, }; #endif =20 diff --git a/target/alpha/cpu.h b/target/alpha/cpu.h index b530cd0088..d6981a6419 100644 --- a/target/alpha/cpu.h +++ b/target/alpha/cpu.h @@ -283,7 +283,7 @@ extern const VMStateDescription vmstate_alpha_cpu; =20 void alpha_cpu_do_interrupt(CPUState *cpu); bool alpha_cpu_exec_interrupt(CPUState *cpu, int int_req); -hwaddr alpha_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); +hwaddr alpha_cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr); #endif /* !CONFIG_USER_ONLY */ void alpha_cpu_dump_state(CPUState *cs, FILE *f, int flags); int alpha_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg); diff --git a/target/alpha/helper.c b/target/alpha/helper.c index af6d7847d5..33fed0c746 100644 --- a/target/alpha/helper.c +++ b/target/alpha/helper.c @@ -295,7 +295,7 @@ static int get_physical_address(CPUAlphaState *env, vad= dr addr, return ret; } =20 -hwaddr alpha_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) +hwaddr alpha_cpu_get_phys_addr_debug(CPUState *cs, vaddr addr) { hwaddr phys; int prot, fail; diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 10feb639c4..9e6b4b1559 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -2436,7 +2436,7 @@ static vaddr aarch64_untagged_addr(CPUState *cs, vadd= r x) =20 static const struct SysemuCPUOps arm_sysemu_ops =3D { .has_work =3D arm_cpu_has_work, - .get_phys_page_attrs_debug =3D arm_cpu_get_phys_page_attrs_debug, + .get_phys_addr_attrs_debug =3D arm_cpu_get_phys_addr_attrs_debug, .asidx_from_attrs =3D arm_asidx_from_attrs, .write_elf32_note =3D arm_cpu_write_elf32_note, .write_elf64_note =3D arm_cpu_write_elf64_note, diff --git a/target/arm/cpu.h b/target/arm/cpu.h index be14a47c35..b1563a4d43 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1233,7 +1233,7 @@ extern const VMStateDescription vmstate_arm_cpu; void arm_cpu_do_interrupt(CPUState *cpu); void arm_v7m_cpu_do_interrupt(CPUState *cpu); =20 -hwaddr arm_cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr, +hwaddr arm_cpu_get_phys_addr_attrs_debug(CPUState *cpu, vaddr addr, MemTxAttrs *attrs); =20 typedef struct ARMGranuleProtectionConfig { diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 7b993bb5b3..f5f624c7c3 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -3943,7 +3943,7 @@ static hwaddr arm_cpu_get_phys_page(CPUARMState *env,= vaddr addr, return res.f.phys_addr; } =20 -hwaddr arm_cpu_get_phys_page_attrs_debug(CPUState *cs, vaddr addr, +hwaddr arm_cpu_get_phys_addr_attrs_debug(CPUState *cs, vaddr addr, MemTxAttrs *attrs) { ARMCPU *cpu =3D ARM_CPU(cs); diff --git a/target/avr/cpu.c b/target/avr/cpu.c index 8579a7283b..3591219212 100644 --- a/target/avr/cpu.c +++ b/target/avr/cpu.c @@ -233,7 +233,7 @@ static void avr_cpu_dump_state(CPUState *cs, FILE *f, i= nt flags) =20 static const struct SysemuCPUOps avr_sysemu_ops =3D { .has_work =3D avr_cpu_has_work, - .get_phys_page_debug =3D avr_cpu_get_phys_page_debug, + .get_phys_addr_debug =3D avr_cpu_get_phys_addr_debug, }; =20 static const TCGCPUOps avr_tcg_ops =3D { diff --git a/target/avr/cpu.h b/target/avr/cpu.h index 518e243d81..7ebdc7b953 100644 --- a/target/avr/cpu.h +++ b/target/avr/cpu.h @@ -178,7 +178,7 @@ extern const struct VMStateDescription vms_avr_cpu; =20 void avr_cpu_do_interrupt(CPUState *cpu); bool avr_cpu_exec_interrupt(CPUState *cpu, int int_req); -hwaddr avr_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); +hwaddr avr_cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr); int avr_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg); int avr_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); int avr_print_insn(bfd_vma addr, disassemble_info *info); diff --git a/target/avr/helper.c b/target/avr/helper.c index 365c8c60e1..f3be8483b2 100644 --- a/target/avr/helper.c +++ b/target/avr/helper.c @@ -107,7 +107,7 @@ void avr_cpu_do_interrupt(CPUState *cs) qemu_plugin_vcpu_interrupt_cb(cs, ret); } =20 -hwaddr avr_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) +hwaddr avr_cpu_get_phys_addr_debug(CPUState *cs, vaddr addr) { return addr; /* I assume 1:1 address correspondence */ } diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index 92027d129a..6443122cf1 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -244,7 +244,7 @@ static ObjectClass *hppa_cpu_class_by_name(const char *= cpu_model) =20 static const struct SysemuCPUOps hppa_sysemu_ops =3D { .has_work =3D hppa_cpu_has_work, - .get_phys_page_debug =3D hppa_cpu_get_phys_page_debug, + .get_phys_addr_debug =3D hppa_cpu_get_phys_addr_debug, }; #endif =20 diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index 7d47afe8ef..8a859d27b0 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -389,7 +389,7 @@ int hppa_cpu_gdb_write_register(CPUState *cpu, uint8_t = *buf, int reg); void hppa_cpu_dump_state(CPUState *cs, FILE *f, int); #ifndef CONFIG_USER_ONLY void hppa_ptlbe(CPUHPPAState *env); -hwaddr hppa_cpu_get_phys_page_debug(CPUState *cs, vaddr addr); +hwaddr hppa_cpu_get_phys_addr_debug(CPUState *cs, vaddr addr); void hppa_set_ior_and_isr(CPUHPPAState *env, vaddr addr, bool mmu_disabled= ); bool hppa_cpu_tlb_fill_align(CPUState *cs, CPUTLBEntryFull *out, vaddr add= r, MMUAccessType access_type, int mmu_idx, diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index ffbad8acfd..f507649226 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -345,7 +345,7 @@ int hppa_get_physical_address(CPUHPPAState *env, vaddr = addr, int mmu_idx, return ret; } =20 -hwaddr hppa_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) +hwaddr hppa_cpu_get_phys_addr_debug(CPUState *cs, vaddr addr) { HPPACPU *cpu =3D HPPA_CPU(cs); hwaddr phys; diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 9d126600c0..cbd064ebb8 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -10692,7 +10692,7 @@ static const struct SysemuCPUOps i386_sysemu_ops = =3D { .has_work =3D x86_cpu_has_work, .get_memory_mapping =3D x86_cpu_get_memory_mapping, .get_paging_enabled =3D x86_cpu_get_paging_enabled, - .get_phys_page_attrs_debug =3D x86_cpu_get_phys_page_attrs_debug, + .get_phys_addr_attrs_debug =3D x86_cpu_get_phys_addr_attrs_debug, .asidx_from_attrs =3D x86_asidx_from_attrs, .get_crash_info =3D x86_cpu_get_crash_info, .write_elf32_note =3D x86_cpu_write_elf32_note, diff --git a/target/i386/cpu.h b/target/i386/cpu.h index a09d5de121..66bbb37cfc 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -2580,7 +2580,7 @@ int cpu_x86_support_mca_broadcast(CPUX86State *env); #ifndef CONFIG_USER_ONLY int x86_cpu_pending_interrupt(CPUState *cs, int interrupt_request); =20 -hwaddr x86_cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr, +hwaddr x86_cpu_get_phys_addr_attrs_debug(CPUState *cpu, vaddr addr, MemTxAttrs *attrs); int cpu_get_pic_interrupt(CPUX86State *s); =20 diff --git a/target/i386/helper.c b/target/i386/helper.c index 108b02396d..8cc73f619a 100644 --- a/target/i386/helper.c +++ b/target/i386/helper.c @@ -252,7 +252,7 @@ void cpu_x86_update_cr4(CPUX86State *env, uint32_t new_= cr4) } =20 #if !defined(CONFIG_USER_ONLY) -hwaddr x86_cpu_get_phys_page_attrs_debug(CPUState *cs, vaddr addr, +hwaddr x86_cpu_get_phys_addr_attrs_debug(CPUState *cs, vaddr addr, MemTxAttrs *attrs) { X86CPU *cpu =3D X86_CPU(cs); diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index e56ae2b343..406ca0355c 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -238,7 +238,7 @@ struct whpx_register_set { * e. Let the affected CPU run in the exclusive mode. * f. Restore the original handler and the exception exit bitmap. * Note that handling all corner cases related to IDT/GDT is harder - * than it may seem. See x86_cpu_get_phys_page_attrs_debug() for a + * than it may seem. See x86_cpu_get_phys_addr_attrs_debug() for a * rough idea. * * 3. In order to properly support guest-level debugging in parallel w= ith diff --git a/target/loongarch/cpu-mmu.h b/target/loongarch/cpu-mmu.h index 3286accc14..2d7ebb2d72 100644 --- a/target/loongarch/cpu-mmu.h +++ b/target/loongarch/cpu-mmu.h @@ -97,7 +97,7 @@ TLBRet loongarch_ptw(CPULoongArchState *env, MMUContext *= context, int access_type, int mmu_idx, int debug); void get_dir_base_width(CPULoongArchState *env, uint64_t *dir_base, uint64_t *dir_width, unsigned int level); -hwaddr loongarch_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); +hwaddr loongarch_cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr); uint64_t loongarch_palen_mask(CPULoongArchState *env); =20 #endif /* LOONGARCH_CPU_MMU_H */ diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index e22568c84a..43ba414ac5 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -832,7 +832,7 @@ static void loongarch_cpu_dump_state(CPUState *cs, FILE= *f, int flags) static const struct SysemuCPUOps loongarch_sysemu_ops =3D { .has_work =3D loongarch_cpu_has_work, .write_elf64_note =3D loongarch_cpu_write_elf64_note, - .get_phys_page_debug =3D loongarch_cpu_get_phys_page_debug, + .get_phys_addr_debug =3D loongarch_cpu_get_phys_addr_debug, }; =20 static int64_t loongarch_cpu_get_arch_id(CPUState *cs) diff --git a/target/loongarch/cpu_helper.c b/target/loongarch/cpu_helper.c index 6044168766..181b931130 100644 --- a/target/loongarch/cpu_helper.c +++ b/target/loongarch/cpu_helper.c @@ -354,7 +354,7 @@ TLBRet get_physical_address(CPULoongArchState *env, MMU= Context *context, return loongarch_map_address(env, context, access_type, mmu_idx, is_de= bug); } =20 -hwaddr loongarch_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) +hwaddr loongarch_cpu_get_phys_addr_debug(CPUState *cs, vaddr addr) { CPULoongArchState *env =3D cpu_env(cs); MMUContext context; diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index d849a4a90f..425efdf7cc 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -606,7 +606,7 @@ static const VMStateDescription vmstate_m68k_cpu =3D { =20 static const struct SysemuCPUOps m68k_sysemu_ops =3D { .has_work =3D m68k_cpu_has_work, - .get_phys_page_debug =3D m68k_cpu_get_phys_page_debug, + .get_phys_addr_debug =3D m68k_cpu_get_phys_addr_debug, }; #endif /* !CONFIG_USER_ONLY */ =20 diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h index 7911ab9de3..b181d5f981 100644 --- a/target/m68k/cpu.h +++ b/target/m68k/cpu.h @@ -186,7 +186,7 @@ struct M68kCPUClass { #ifndef CONFIG_USER_ONLY void m68k_cpu_do_interrupt(CPUState *cpu); bool m68k_cpu_exec_interrupt(CPUState *cpu, int int_req); -hwaddr m68k_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); +hwaddr m68k_cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr); #endif /* !CONFIG_USER_ONLY */ void m68k_cpu_dump_state(CPUState *cpu, FILE *f, int flags); int m68k_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg); diff --git a/target/m68k/helper.c b/target/m68k/helper.c index 9bab184389..2dd9ec1bdc 100644 --- a/target/m68k/helper.c +++ b/target/m68k/helper.c @@ -907,7 +907,7 @@ txfail: return -1; } =20 -hwaddr m68k_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) +hwaddr m68k_cpu_get_phys_addr_debug(CPUState *cs, vaddr addr) { CPUM68KState *env =3D cpu_env(cs); hwaddr phys_addr; diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index ec513ae82d..20fffccb60 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -428,7 +428,7 @@ static ObjectClass *mb_cpu_class_by_name(const char *cp= u_model) =20 static const struct SysemuCPUOps mb_sysemu_ops =3D { .has_work =3D mb_cpu_has_work, - .get_phys_page_attrs_debug =3D mb_cpu_get_phys_page_attrs_debug, + .get_phys_addr_attrs_debug =3D mb_cpu_get_phys_addr_attrs_debug, }; #endif =20 diff --git a/target/microblaze/cpu.h b/target/microblaze/cpu.h index 5a856edaaa..9f342ef618 100644 --- a/target/microblaze/cpu.h +++ b/target/microblaze/cpu.h @@ -370,7 +370,7 @@ struct MicroBlazeCPUClass { #ifndef CONFIG_USER_ONLY void mb_cpu_do_interrupt(CPUState *cs); bool mb_cpu_exec_interrupt(CPUState *cs, int int_req); -hwaddr mb_cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr, +hwaddr mb_cpu_get_phys_addr_attrs_debug(CPUState *cpu, vaddr addr, MemTxAttrs *attrs); #endif /* !CONFIG_USER_ONLY */ G_NORETURN void mb_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr, diff --git a/target/microblaze/helper.c b/target/microblaze/helper.c index da8abe063e..f81c4f625b 100644 --- a/target/microblaze/helper.c +++ b/target/microblaze/helper.c @@ -280,7 +280,7 @@ void mb_cpu_do_interrupt(CPUState *cs) } } =20 -hwaddr mb_cpu_get_phys_page_attrs_debug(CPUState *cs, vaddr addr, +hwaddr mb_cpu_get_phys_addr_attrs_debug(CPUState *cs, vaddr addr, MemTxAttrs *attrs) { MicroBlazeCPU *cpu =3D MICROBLAZE_CPU(cs); diff --git a/target/mips/cpu.c b/target/mips/cpu.c index 5f88c077db..6ef18105b9 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -535,7 +535,7 @@ static ObjectClass *mips_cpu_class_by_name(const char *= cpu_model) =20 static const struct SysemuCPUOps mips_sysemu_ops =3D { .has_work =3D mips_cpu_has_work, - .get_phys_page_debug =3D mips_cpu_get_phys_page_debug, + .get_phys_addr_debug =3D mips_cpu_get_phys_addr_debug, .legacy_vmsd =3D &vmstate_mips_cpu, }; #endif diff --git a/target/mips/internal.h b/target/mips/internal.h index 28eb28936b..24bfa1903c 100644 --- a/target/mips/internal.h +++ b/target/mips/internal.h @@ -115,7 +115,7 @@ enum { int get_physical_address(CPUMIPSState *env, hwaddr *physical, int *prot, target_ulong real_address, MMUAccessType access_type, int mmu_idx); -hwaddr mips_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); +hwaddr mips_cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr); =20 typedef struct r4k_tlb_t r4k_tlb_t; struct r4k_tlb_t { diff --git a/target/mips/system/physaddr.c b/target/mips/system/physaddr.c index b8e1a5ac98..fbbbcf6e00 100644 --- a/target/mips/system/physaddr.c +++ b/target/mips/system/physaddr.c @@ -228,7 +228,7 @@ int get_physical_address(CPUMIPSState *env, hwaddr *phy= sical, return ret; } =20 -hwaddr mips_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) +hwaddr mips_cpu_get_phys_addr_debug(CPUState *cs, vaddr addr) { CPUMIPSState *env =3D cpu_env(cs); hwaddr phys_addr; diff --git a/target/or1k/cpu.c b/target/or1k/cpu.c index 3d1c22bf75..ea29b2e01f 100644 --- a/target/or1k/cpu.c +++ b/target/or1k/cpu.c @@ -247,7 +247,7 @@ static void openrisc_any_initfn(Object *obj) =20 static const struct SysemuCPUOps openrisc_sysemu_ops =3D { .has_work =3D openrisc_cpu_has_work, - .get_phys_page_debug =3D openrisc_cpu_get_phys_page_debug, + .get_phys_addr_debug =3D openrisc_cpu_get_phys_addr_debug, }; #endif =20 diff --git a/target/or1k/cpu.h b/target/or1k/cpu.h index c8e2827930..8f20b9a122 100644 --- a/target/or1k/cpu.h +++ b/target/or1k/cpu.h @@ -297,7 +297,7 @@ void openrisc_translate_code(CPUState *cs, TranslationB= lock *tb, int print_insn_or1k(bfd_vma addr, disassemble_info *info); =20 #ifndef CONFIG_USER_ONLY -hwaddr openrisc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); +hwaddr openrisc_cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr); =20 bool openrisc_cpu_tlb_fill(CPUState *cs, vaddr address, int size, MMUAccessType access_type, int mmu_idx, diff --git a/target/or1k/mmu.c b/target/or1k/mmu.c index 315debaf3e..3ff288a1f9 100644 --- a/target/or1k/mmu.c +++ b/target/or1k/mmu.c @@ -138,7 +138,7 @@ bool openrisc_cpu_tlb_fill(CPUState *cs, vaddr addr, in= t size, cpu_loop_exit_restore(cs, retaddr); } =20 -hwaddr openrisc_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) +hwaddr openrisc_cpu_get_phys_addr_debug(CPUState *cs, vaddr addr) { OpenRISCCPU *cpu =3D OPENRISC_CPU(cs); int prot, excp, sr =3D cpu->env.sr; diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index d637a50798..24a53ee2e1 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1639,7 +1639,7 @@ void ppc_cpu_dump_state(CPUState *cpu, FILE *f, int f= lags); int ppc_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg); int ppc_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); #ifndef CONFIG_USER_ONLY -hwaddr ppc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); +hwaddr ppc_cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr); #endif int ppc64_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cs, int cpuid, DumpState *s); diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 191f5726f6..d25f69f13b 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -7477,7 +7477,7 @@ static void ppc_disas_set_info(const CPUState *cs, di= sassemble_info *info) =20 static const struct SysemuCPUOps ppc_sysemu_ops =3D { .has_work =3D ppc_cpu_has_work, - .get_phys_page_debug =3D ppc_cpu_get_phys_page_debug, + .get_phys_addr_debug =3D ppc_cpu_get_phys_addr_debug, .write_elf32_note =3D ppc32_cpu_write_elf32_note, .write_elf64_note =3D ppc64_cpu_write_elf64_note, .internal_is_big_endian =3D ppc_cpu_is_big_endian, diff --git a/target/ppc/mmu-hash32.c b/target/ppc/mmu-hash32.c index 8b980a5aa9..43d581cadf 100644 --- a/target/ppc/mmu-hash32.c +++ b/target/ppc/mmu-hash32.c @@ -131,7 +131,7 @@ static bool ppc_hash32_direct_store(PowerPCCPU *cpu, ta= rget_ulong sr, } =20 /* - * From ppc_cpu_get_phys_page_debug, env->access_type is not set. + * From ppc_cpu_get_phys_addr_debug, env->access_type is not set. * Assume ACCESS_INT for that case. */ switch (guest_visible ? env->access_type : ACCESS_INT) { diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index a1345df716..2499e619f8 100644 --- a/target/ppc/mmu_common.c +++ b/target/ppc/mmu_common.c @@ -848,7 +848,7 @@ bool ppc_xlate(PowerPCCPU *cpu, vaddr eaddr, MMUAccessT= ype access_type, } } =20 -hwaddr ppc_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) +hwaddr ppc_cpu_get_phys_addr_debug(CPUState *cs, vaddr addr) { PowerPCCPU *cpu =3D POWERPC_CPU(cs); hwaddr raddr; diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 8ac935ac06..e5d8592ef2 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -2717,7 +2717,7 @@ static int64_t riscv_get_arch_id(CPUState *cs) =20 static const struct SysemuCPUOps riscv_sysemu_ops =3D { .has_work =3D riscv_cpu_has_work, - .get_phys_page_debug =3D riscv_cpu_get_phys_page_debug, + .get_phys_addr_debug =3D riscv_cpu_get_phys_addr_debug, .write_elf64_note =3D riscv_cpu_write_elf64_note, .write_elf32_note =3D riscv_cpu_write_elf32_note, .legacy_vmsd =3D &vmstate_riscv_cpu, diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 35d1f6362c..111afe19d1 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -629,7 +629,7 @@ void riscv_cpu_do_transaction_failed(CPUState *cs, hwad= dr physaddr, MMUAccessType access_type, int mmu_idx, MemTxAttrs attrs, MemTxResult response, uintptr_t retad= dr); -hwaddr riscv_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); +hwaddr riscv_cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr); bool riscv_cpu_exec_interrupt(CPUState *cs, int interrupt_request); void riscv_cpu_swap_hypervisor_regs(CPURISCVState *env); int riscv_cpu_claim_interrupts(RISCVCPU *cpu, uint64_t interrupts); diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c index 475e9cfd57..584a3928a4 100644 --- a/target/riscv/cpu_helper.c +++ b/target/riscv/cpu_helper.c @@ -1657,7 +1657,7 @@ static void raise_mmu_exception(CPURISCVState *env, t= arget_ulong address, env->two_stage_indirect_lookup =3D two_stage_indirect; } =20 -hwaddr riscv_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) +hwaddr riscv_cpu_get_phys_addr_debug(CPUState *cs, vaddr addr) { RISCVCPU *cpu =3D RISCV_CPU(cs); CPURISCVState *env =3D &cpu->env; diff --git a/target/rx/cpu.c b/target/rx/cpu.c index b5284199e6..20b188c24c 100644 --- a/target/rx/cpu.c +++ b/target/rx/cpu.c @@ -209,7 +209,7 @@ static void rx_cpu_init(Object *obj) =20 static const struct SysemuCPUOps rx_sysemu_ops =3D { .has_work =3D rx_cpu_has_work, - .get_phys_page_debug =3D rx_cpu_get_phys_page_debug, + .get_phys_addr_debug =3D rx_cpu_get_phys_addr_debug, }; =20 static const TCGCPUOps rx_tcg_ops =3D { diff --git a/target/rx/cpu.h b/target/rx/cpu.h index b3b1ecff5a..328521791b 100644 --- a/target/rx/cpu.h +++ b/target/rx/cpu.h @@ -137,7 +137,7 @@ struct RXCPUClass { const char *rx_crname(uint8_t cr); void rx_cpu_do_interrupt(CPUState *cpu); bool rx_cpu_exec_interrupt(CPUState *cpu, int int_req); -hwaddr rx_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); +hwaddr rx_cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr); void rx_cpu_dump_state(CPUState *cpu, FILE *f, int flags); int rx_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg); int rx_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); diff --git a/target/rx/helper.c b/target/rx/helper.c index daaeeec1b5..0f99279bba 100644 --- a/target/rx/helper.c +++ b/target/rx/helper.c @@ -147,7 +147,7 @@ bool rx_cpu_exec_interrupt(CPUState *cs, int interrupt_= request) return false; } =20 -hwaddr rx_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) +hwaddr rx_cpu_get_phys_addr_debug(CPUState *cs, vaddr addr) { return addr; } diff --git a/target/s390x/cpu-system.c b/target/s390x/cpu-system.c index c133b0c262..1bd3721d10 100644 --- a/target/s390x/cpu-system.c +++ b/target/s390x/cpu-system.c @@ -176,7 +176,7 @@ void s390_cpu_finalize(Object *obj) =20 static const struct SysemuCPUOps s390_sysemu_ops =3D { .has_work =3D s390_cpu_has_work, - .get_phys_page_debug =3D s390_cpu_get_phys_addr_debug, + .get_phys_addr_debug =3D s390_cpu_get_phys_addr_debug, .get_crash_info =3D s390_cpu_get_crash_info, .write_elf64_note =3D s390_cpu_write_elf64_note, .legacy_vmsd =3D &vmstate_s390_cpu, diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c index e2bde45761..40d5fde76d 100644 --- a/target/sh4/cpu.c +++ b/target/sh4/cpu.c @@ -278,7 +278,7 @@ static const VMStateDescription vmstate_sh_cpu =3D { =20 static const struct SysemuCPUOps sh4_sysemu_ops =3D { .has_work =3D superh_cpu_has_work, - .get_phys_page_debug =3D superh_cpu_get_phys_page_debug, + .get_phys_addr_debug =3D superh_cpu_get_phys_addr_debug, }; #endif =20 diff --git a/target/sh4/cpu.h b/target/sh4/cpu.h index b0759010c4..3743452190 100644 --- a/target/sh4/cpu.h +++ b/target/sh4/cpu.h @@ -252,7 +252,7 @@ void sh4_translate_code(CPUState *cs, TranslationBlock = *tb, int *max_insns, vaddr pc, void *host_pc); =20 #if !defined(CONFIG_USER_ONLY) -hwaddr superh_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); +hwaddr superh_cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr); bool superh_cpu_tlb_fill(CPUState *cs, vaddr address, int size, MMUAccessType access_type, int mmu_idx, bool probe, uintptr_t retaddr); diff --git a/target/sh4/helper.c b/target/sh4/helper.c index 5d6295618f..b3ec7ce64d 100644 --- a/target/sh4/helper.c +++ b/target/sh4/helper.c @@ -435,7 +435,7 @@ static int get_physical_address(CPUSH4State *env, hwadd= r* physical, return get_mmu_address(env, physical, prot, address, access_type); } =20 -hwaddr superh_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) +hwaddr superh_cpu_get_phys_addr_debug(CPUState *cs, vaddr addr) { hwaddr physical; int prot; diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 7704610428..d198f6ba19 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -997,7 +997,7 @@ static const Property sparc_cpu_properties[] =3D { =20 static const struct SysemuCPUOps sparc_sysemu_ops =3D { .has_work =3D sparc_cpu_has_work, - .get_phys_page_debug =3D sparc_cpu_get_phys_page_debug, + .get_phys_addr_debug =3D sparc_cpu_get_phys_addr_debug, .legacy_vmsd =3D &vmstate_sparc_cpu, }; #endif diff --git a/target/sparc/cpu.h b/target/sparc/cpu.h index 0139732e4c..307b98b76c 100644 --- a/target/sparc/cpu.h +++ b/target/sparc/cpu.h @@ -580,7 +580,7 @@ struct SPARCCPUClass { #ifndef CONFIG_USER_ONLY extern const VMStateDescription vmstate_sparc_cpu; =20 -hwaddr sparc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); +hwaddr sparc_cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr); #endif =20 void sparc_cpu_do_interrupt(CPUState *cpu); diff --git a/target/sparc/mmu_helper.c b/target/sparc/mmu_helper.c index 25f8a85fae..34b212a7aa 100644 --- a/target/sparc/mmu_helper.c +++ b/target/sparc/mmu_helper.c @@ -902,7 +902,7 @@ hwaddr cpu_get_phys_page_nofault(CPUSPARCState *env, ta= rget_ulong addr, } #endif =20 -hwaddr sparc_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) +hwaddr sparc_cpu_get_phys_addr_debug(CPUState *cs, vaddr addr) { CPUSPARCState *env =3D cpu_env(cs); hwaddr phys_addr; diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c index 04319e107b..472c24ae32 100644 --- a/target/tricore/cpu.c +++ b/target/tricore/cpu.c @@ -176,7 +176,7 @@ static bool tricore_cpu_exec_interrupt(CPUState *cs, in= t interrupt_request) =20 static const struct SysemuCPUOps tricore_sysemu_ops =3D { .has_work =3D tricore_cpu_has_work, - .get_phys_page_debug =3D tricore_cpu_get_phys_page_debug, + .get_phys_addr_debug =3D tricore_cpu_get_phys_addr_debug, }; =20 static const TCGCPUOps tricore_tcg_ops =3D { diff --git a/target/tricore/cpu.h b/target/tricore/cpu.h index ab46192e26..56241b491f 100644 --- a/target/tricore/cpu.h +++ b/target/tricore/cpu.h @@ -80,7 +80,7 @@ struct TriCoreCPUClass { ResettablePhases parent_phases; }; =20 -hwaddr tricore_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); +hwaddr tricore_cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr); void tricore_cpu_dump_state(CPUState *cpu, FILE *f, int flags); =20 FIELD(PCXI, PCPN_13, 24, 8) diff --git a/target/tricore/helper.c b/target/tricore/helper.c index 7ee8c7fd69..ce1693622b 100644 --- a/target/tricore/helper.c +++ b/target/tricore/helper.c @@ -46,7 +46,7 @@ static int get_physical_address(CPUTriCoreState *env, hwa= ddr *physical, return ret; } =20 -hwaddr tricore_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) +hwaddr tricore_cpu_get_phys_addr_debug(CPUState *cs, vaddr addr) { TriCoreCPU *cpu =3D TRICORE_CPU(cs); hwaddr phys_addr; diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index eebf40559b..8a22f1a08e 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -303,7 +303,7 @@ static const VMStateDescription vmstate_xtensa_cpu =3D { =20 static const struct SysemuCPUOps xtensa_sysemu_ops =3D { .has_work =3D xtensa_cpu_has_work, - .get_phys_page_debug =3D xtensa_cpu_get_phys_page_debug, + .get_phys_addr_debug =3D xtensa_cpu_get_phys_addr_debug, }; #endif =20 diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h index 2219292484..546a5e76a6 100644 --- a/target/xtensa/cpu.h +++ b/target/xtensa/cpu.h @@ -591,7 +591,7 @@ void xtensa_cpu_do_transaction_failed(CPUState *cs, hwa= ddr physaddr, vaddr addr, unsigned size, MMUAccessType access_= type, int mmu_idx, MemTxAttrs attrs, MemTxResult response, uintptr_t reta= ddr); -hwaddr xtensa_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); +hwaddr xtensa_cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr); bool xtensa_debug_check_breakpoint(CPUState *cs); #endif void xtensa_cpu_dump_state(CPUState *cpu, FILE *f, int flags); diff --git a/target/xtensa/mmu_helper.c b/target/xtensa/mmu_helper.c index 71330fc84b..a126f6b671 100644 --- a/target/xtensa/mmu_helper.c +++ b/target/xtensa/mmu_helper.c @@ -316,7 +316,7 @@ static void xtensa_tlb_set_entry(CPUXtensaState *env, b= ool dtlb, } } =20 -hwaddr xtensa_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) +hwaddr xtensa_cpu_get_phys_addr_debug(CPUState *cs, vaddr addr) { XtensaCPU *cpu =3D XTENSA_CPU(cs); uint32_t paddr; --=20 2.43.0 From nobody Sat May 30 19:22:59 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1777541949; cv=none; d=zohomail.com; s=zohoarc; b=I9djOEmRM+KDBZFdGQD+POrNUyS6S954jo8Z9iTb2UkB+SnaMCCXZYP4BHaAFVu9voEUwOlHnzxM8owDHMLTHmHxz02Z+gjmzkeYyKBQ38QwK/wJ7eoisuQ2izOYKDSRbcPfbJdg/4bzqXW+sKX0G0cfct5iZGZPDjDva6yr4MA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777541949; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=a3VHUpeET5mE4ABlG1aCJty2zCZSCJVxDWKrB9qKNsA=; b=Yq8AKtAen4AttxqHT8j3qPvhduJ9eozNnfBJGWyuV1FJWbNv27ACBCidPbDgUsQrAPoBYhHmMGOqV4eNZ44JwCQoqj15k8GwUwfM2C/wooQKaGOMhT2IBwnAiwl5OlNzfzPPdM5SAxGxeDUOAFrGQ3bxFJt1m51FfKk4UIPQurY= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777541949464984.2968322736277; Thu, 30 Apr 2026 02:39:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wINrB-0005Al-Of; Thu, 30 Apr 2026 05:38:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wINqy-0004nI-Ri for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:42 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wINqk-0002Xp-SV for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:39 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-449e96a8a80so37064f8f.3 for ; Thu, 30 Apr 2026 02:38:26 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-447b421721fsm10816795f8f.15.2026.04.30.02.38.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 02:38:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1777541905; x=1778146705; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=a3VHUpeET5mE4ABlG1aCJty2zCZSCJVxDWKrB9qKNsA=; b=wRiPBilhEdV2bqIYOVxmKDq4TYM0/WdHxxzwXLo7JYziuDC6ACzGd2Dy+qoslx22vs FSUrFe1HhZdp/6+D0KBzWBaFD5HWNpmsRMO5kqhKUyeKzRMLiI9wHWU+/X16f7y6KWaU BWJFlrJfsOTmZOTI57MPbuuFDk1hdYhpNDuVYQd+gn6bGMJhDQdblJmObDP5vLVozzdg vur9ZqvXqgByWtOj06QHH3sN7USILjQcxgn/uqlx+GAYT+1FImEDs5zs1grHD5JeTqH7 dKyn4Gka64gMwSVh1+/qw2W+MlZ1BL/EAnE6IbxaqRc0EVpg3OsBzPTjRfdm4jyMIEC7 3e0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777541905; x=1778146705; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=a3VHUpeET5mE4ABlG1aCJty2zCZSCJVxDWKrB9qKNsA=; b=jELFOTGPn9iu3SYy5+7PJ4CwKa3iJHsK9AupgIONeeT6NnLnW06yPK84e9kJG1GLvz OY5jSra1WxsZjNRQB1eMYuV2u8D0hpvOqPFcJQUQ5yzuEEWMqGXwZowlAXrCGMIpBgQ7 Qr+BqSRfjcH+Eq8HpLaBPb0Zv1e4fPuaGmQN/Xl70pQfvE74EL1fPbqv+Goe+76dLWi1 mlYwWLAHqHC7zsbUClYh97ZoDtCMVqYzE2t7xdrNxRJ+TKmqQRlZPYgtwlkrhcTTVceG BI//4t0Pi2sklgWGiN7RW7wwRlrHlflM6TQYD6W5nxj/ivH4vS8WbRXKJRBZNh0/gYPG 4CnA== X-Gm-Message-State: AOJu0YxPxWmcRtDOecbe+PNt+9eOxHkSNzA1RF9K1QIZ1/jJJP71ozzs xA0Q/vJFRm+hY8/tadAwbwNAlj3ipvjvHTLmu7Zdail2Ym2Fnk5dsFw/PgpJ95QfC4EBhoG9zaG tywT/ X-Gm-Gg: AeBDietb0aHrdtezMXOPR3YXj1icmfesY+X7nFpi9T+eAS5bVm2tnMZxMNR/+7z6tU+ BRC4X6TqjBXNI5V0sbkr1inbkidxvsJ1tOwTTuuYq7aqgwGWjMP1M1dFjp0uUHwzSso+KVgmj0c JxYy16RLKf7vAqlygqpIyglOKWbcawOTiFLBJkLBBS6PWRwNvQg9XaWfzYO7h3yic+FiDZAtK4G wV0ZzFRXxPewpAB0DPGR0CZfnHdQ4/gY3j11eHlYPK1x4KjlFZ37MgZt5ghRfZp0eWH4YMwzauT EcTq719iipReCt9JuhvWyMoKxWJPiEaCc7EHIIbx7o7qIbXwWBmQvgSAqNNoeVtepuNAVfvi/w5 MI5N3/crdnBGj4E1yU7jRccgS62xVVT1FcmvSL54sjqFeusviAaInAqIRclVc/A4zv2a2QWr2qK TX7db61j+2u/vOrazyflbHGvShXGtpA/u6fUecTDg0KhDkrMUmJPKo1Qo4T14OWW/TbGGmDeGwz 7aVXz5AkNJPCfKBizl6TR2F2ysdneK4o6CZqvXdmA== X-Received: by 2002:a05:6000:1789:b0:43d:1df7:ed24 with SMTP id ffacd0b85a97d-4493f42ce1amr3240933f8f.21.1777541905086; Thu, 30 Apr 2026 02:38:25 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Yanan Wang , Zhao Liu , Paolo Bonzini , Richard Henderson , "Dr. David Alan Gilbert" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour , Peter Xu , "Edgar E. Iglesias" , Jiaxun Yang , Nicholas Piggin , Chinmay Rath , Glenn Miles , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Ilya Leoshkevich , David Hildenbrand , Mark Cave-Ayland , Artyom Tarasenko , Max Filippov Subject: [PATCH v2 10/25] target: Rename cpu_get_phys_page_{,attrs_}debug Date: Thu, 30 Apr 2026 10:37:55 +0100 Message-ID: <20260430093810.2762539-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260430093810.2762539-1-peter.maydell@linaro.org> References: <20260430093810.2762539-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, 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 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 @linaro.org) X-ZM-MESSAGEID: 1777541951912158500 Rename cpu_phys_page_debug() and cpu_phys_page_attrs_debug() to cpu_phys_addr_debug() and cpu_phys_addr_attrs_debug(). Commit created with: sed -i -e 's/cpu_get_phys_page_debug/cpu_get_phys_addr_debug/g;s/cpu_get_p= hys_page_attrs_debug/cpu_get_phys_addr_attrs_debug/g' $(git grep -l cpu_get= _phys_page) Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-id: 20260417173105.1648172-10-peter.maydell@linaro.org --- hw/core/cpu-system.c | 6 +++--- hw/i386/vapic.c | 4 ++-- hw/xtensa/sim.c | 2 +- hw/xtensa/xtfpga.c | 2 +- include/hw/core/cpu.h | 8 ++++---- monitor/hmp-cmds.c | 2 +- plugins/api.c | 2 +- system/physmem.c | 2 +- target/sparc/mmu_helper.c | 6 +++--- target/xtensa/xtensa-semi.c | 2 +- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/hw/core/cpu-system.c b/hw/core/cpu-system.c index 93dc861083..05c126ecb6 100644 --- a/hw/core/cpu-system.c +++ b/hw/core/cpu-system.c @@ -55,7 +55,7 @@ bool cpu_get_memory_mapping(CPUState *cpu, MemoryMappingL= ist *list, return false; } =20 -hwaddr cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr, +hwaddr cpu_get_phys_addr_attrs_debug(CPUState *cpu, vaddr addr, MemTxAttrs *attrs) { hwaddr paddr; @@ -73,11 +73,11 @@ hwaddr cpu_get_phys_page_attrs_debug(CPUState *cpu, vad= dr addr, return paddr; } =20 -hwaddr cpu_get_phys_page_debug(CPUState *cpu, vaddr addr) +hwaddr cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr) { MemTxAttrs attrs =3D {}; =20 - return cpu_get_phys_page_attrs_debug(cpu, addr, &attrs); + return cpu_get_phys_addr_attrs_debug(cpu, addr, &attrs); } =20 int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs) diff --git a/hw/i386/vapic.c b/hw/i386/vapic.c index 3738031a05..225f19a75c 100644 --- a/hw/i386/vapic.c +++ b/hw/i386/vapic.c @@ -173,7 +173,7 @@ static int find_real_tpr_addr(VAPICROMState *s, CPUX86S= tate *env) * virtual address space for the APIC mapping. */ for (addr =3D 0xfffff000; addr >=3D 0x80000000; addr -=3D TARGET_PAGE_= SIZE) { - paddr =3D cpu_get_phys_page_debug(cs, addr); + paddr =3D cpu_get_phys_addr_debug(cs, addr); if (paddr !=3D APIC_DEFAULT_ADDRESS) { continue; } @@ -305,7 +305,7 @@ static int update_rom_mapping(VAPICROMState *s, CPUX86S= tate *env, target_ulong i =20 /* find out virtual address of the ROM */ rom_state_vaddr =3D s->rom_state_paddr + (ip & 0xf0000000); - paddr =3D cpu_get_phys_page_debug(cs, rom_state_vaddr); + paddr =3D cpu_get_phys_addr_debug(cs, rom_state_vaddr); if (paddr =3D=3D -1) { return -1; } diff --git a/hw/xtensa/sim.c b/hw/xtensa/sim.c index 994460d041..32eb16442f 100644 --- a/hw/xtensa/sim.c +++ b/hw/xtensa/sim.c @@ -41,7 +41,7 @@ static uint64_t translate_phys_addr(void *opaque, uint64_= t addr) { XtensaCPU *cpu =3D opaque; =20 - return cpu_get_phys_page_debug(CPU(cpu), addr); + return cpu_get_phys_addr_debug(CPU(cpu), addr); } =20 static void sim_reset(void *opaque) diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c index 5e509216df..256497e162 100644 --- a/hw/xtensa/xtfpga.c +++ b/hw/xtensa/xtfpga.c @@ -192,7 +192,7 @@ static uint64_t translate_phys_addr(void *opaque, uint6= 4_t addr) { XtensaCPU *cpu =3D opaque; =20 - return cpu_get_phys_page_debug(CPU(cpu), addr); + return cpu_get_phys_addr_debug(CPU(cpu), addr); } =20 static void xtfpga_reset(void *opaque) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 207a7a1bec..9d6b4fd697 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -745,7 +745,7 @@ enum CPUDumpFlags { void cpu_dump_state(CPUState *cpu, FILE *f, int flags); =20 /** - * cpu_get_phys_page_attrs_debug: + * cpu_get_phys_addr_attrs_debug: * @cpu: The CPU to obtain the physical page address for. * @addr: The virtual address. * @attrs: Updated on return with the memory transaction attributes to use @@ -757,11 +757,11 @@ void cpu_dump_state(CPUState *cpu, FILE *f, int flags= ); * * Returns: Corresponding physical page address or -1 if no page found. */ -hwaddr cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr, +hwaddr cpu_get_phys_addr_attrs_debug(CPUState *cpu, vaddr addr, MemTxAttrs *attrs); =20 /** - * cpu_get_phys_page_debug: + * cpu_get_phys_addr_debug: * @cpu: The CPU to obtain the physical page address for. * @addr: The virtual address. * @@ -770,7 +770,7 @@ hwaddr cpu_get_phys_page_attrs_debug(CPUState *cpu, vad= dr addr, * * Returns: Corresponding physical page address or -1 if no page found. */ -hwaddr cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); +hwaddr cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr); =20 /** cpu_asidx_from_attrs: * @cpu: CPU diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index bc26b39d70..e6d8322bcc 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -720,7 +720,7 @@ void hmp_gva2gpa(Monitor *mon, const QDict *qdict) return; } =20 - gpa =3D cpu_get_phys_page_debug(cs, addr & TARGET_PAGE_MASK); + gpa =3D cpu_get_phys_addr_debug(cs, addr & TARGET_PAGE_MASK); if (gpa =3D=3D -1) { monitor_printf(mon, "Unmapped\n"); } else { diff --git a/plugins/api.c b/plugins/api.c index 0c348a789b..4b6fad4999 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -619,7 +619,7 @@ bool qemu_plugin_translate_vaddr(uint64_t vaddr, uint64= _t *hwaddr) #ifdef CONFIG_SOFTMMU g_assert(current_cpu); =20 - uint64_t res =3D cpu_get_phys_page_debug(current_cpu, vaddr); + uint64_t res =3D cpu_get_phys_addr_debug(current_cpu, vaddr); =20 if (res =3D=3D (uint64_t)-1) { return false; diff --git a/system/physmem.c b/system/physmem.c index c58d940e80..652b03ad5f 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -4041,7 +4041,7 @@ int cpu_memory_rw_debug(CPUState *cpu, vaddr addr, MemTxResult res; =20 page =3D addr & TARGET_PAGE_MASK; - phys_addr =3D cpu_get_phys_page_attrs_debug(cpu, page, &attrs); + phys_addr =3D cpu_get_phys_addr_attrs_debug(cpu, page, &attrs); asidx =3D cpu_asidx_from_attrs(cpu, attrs); /* if no physical page mapped, return an error */ if (phys_addr =3D=3D -1) diff --git a/target/sparc/mmu_helper.c b/target/sparc/mmu_helper.c index 34b212a7aa..e1abd520c4 100644 --- a/target/sparc/mmu_helper.c +++ b/target/sparc/mmu_helper.c @@ -366,20 +366,20 @@ void dump_mmu(CPUSPARCState *env) for (n =3D 0, va =3D 0; n < 256; n++, va +=3D 16 * 1024 * 1024) { pde =3D mmu_probe(env, va, 2); if (pde) { - pa =3D cpu_get_phys_page_debug(cs, va); + pa =3D cpu_get_phys_addr_debug(cs, va); qemu_printf("VA: " TARGET_FMT_lx ", PA: " HWADDR_FMT_plx " PDE: " TARGET_FMT_lx "\n", va, pa, pde); for (m =3D 0, va1 =3D va; m < 64; m++, va1 +=3D 256 * 1024) { pde =3D mmu_probe(env, va1, 1); if (pde) { - pa =3D cpu_get_phys_page_debug(cs, va1); + pa =3D cpu_get_phys_addr_debug(cs, va1); qemu_printf(" VA: " TARGET_FMT_lx ", PA: " HWADDR_FMT_plx " PDE: " TARGET_FMT_lx "\n", va1, pa, pde); for (o =3D 0, va2 =3D va1; o < 64; o++, va2 +=3D 4 * 1= 024) { pde =3D mmu_probe(env, va2, 0); if (pde) { - pa =3D cpu_get_phys_page_debug(cs, va2); + pa =3D cpu_get_phys_addr_debug(cs, va2); qemu_printf(" VA: " TARGET_FMT_lx ", PA: " HWADDR_FMT_plx " PTE: " TARGET_FMT_lx "\n", diff --git a/target/xtensa/xtensa-semi.c b/target/xtensa/xtensa-semi.c index 28dfb29cbd..9a6a9c8b4e 100644 --- a/target/xtensa/xtensa-semi.c +++ b/target/xtensa/xtensa-semi.c @@ -215,7 +215,7 @@ void HELPER(simcall)(CPUXtensaState *env) uint32_t len_done =3D 0; =20 while (len > 0) { - hwaddr paddr =3D cpu_get_phys_page_debug(cs, vaddr); + hwaddr paddr =3D cpu_get_phys_addr_debug(cs, vaddr); uint32_t page_left =3D TARGET_PAGE_SIZE - (vaddr & (TARGET_PAGE_SIZE - 1)); uint32_t io_sz =3D page_left < len ? page_left : len; --=20 2.43.0 From nobody Sat May 30 19:22:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777542362051446.5637628319246; Thu, 30 Apr 2026 02:46:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wINrE-0005Hc-3n; Thu, 30 Apr 2026 05:38:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wINr0-0004nT-4R for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:42 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wINqm-0002YX-4f for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:40 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-44261378651so1184183f8f.0 for ; Thu, 30 Apr 2026 02:38:27 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-447b421721fsm10816795f8f.15.2026.04.30.02.38.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 02:38:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1777541907; x=1778146707; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hDGJjejJYZxkfE0DV0hYtPp8LwTrheCF0WqZXFUQHA4=; b=TxeOGuD3E5KgcgP+BnJ63T7UE/NZsucjmCCp7TXOFsHkZiMgAIupRadKNV6BekFvZL d9J2CCfYPHtECqpc0DIOJefGltlG+d7luLihLV7eJj3jv9oQ0c4SRbl6i/2IEjGraGRk Nwjnn2SxJxCUPNWMV5avPKKg5UZTZqkDIKOvaY6JSyd/60+8dlSPO/ZfkD6BWyTbotVs HimEMISjLU8z5N0Vs3SwlD67i+UgB/lNIz+3nFb3w3EDkWh8IlsT84877hObveZnUPFy 4Ty9kvS6leD5m8usVpmsAV5MwOey5ZP619pOlauLa0qQ3maW4CuVKupjfhf3ZWD7+PZ0 qWiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777541907; x=1778146707; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=hDGJjejJYZxkfE0DV0hYtPp8LwTrheCF0WqZXFUQHA4=; b=eROw1mggUQy9uVLHXFWYdZ8nae7kd1TAJyUCwb8IXP5wM2Y0IzVkDsRRWfAHSAtuwn cXcpNrCKq4ay5QbzAkdZnIkNdZ6+ISm0UYPFTLTlVdzGtYeGS6U8NukjKs3J4PGTZxgS ufYQi1b030OY3Og0X90zG/csJfslP6n5wAFXrhyXExSqi1nUUmaQ1wEZMWPso5vAzqzF FMYnbcTY3f6I1Wokzj8GSobkfG/XGW8iKL8EDqyDH45Nc6DbTfxfFhizRaNP0ZHp2Vb/ aGT8y/WVy1gHAXfD8ossx9x05Ris2PsZ9kbZyeQ82pG3Cx6ZP20llmna2NZwEnUtzvi4 d1FQ== X-Gm-Message-State: AOJu0YwpUem+u7wZ61+yXanm3+Gt9yzJfWg7pMNGPtLY3JPtoNW1Pzqd soRJTpZ/ijKKmyIs9Y8Y1pvc/04dGUlFozz3dPIAvvg8ThNb7RXAvDiLuTSKD9u3YHTFpqCZcQn GRvGG X-Gm-Gg: AeBDietljqVYHEaYOttV5NhfN6iqw1oa6L0MtefsJvZ+g81GEPf7SZc3lCpOfOoapOM d4jDaOBfyinbebkzoQzfh1vNBNwzzB0iIH8eIAZ7sxlcPp7Ir2Glj96AtDY/CbN1QcCFjSsZpXf bx0ztui54pcBZQ1Bm7JM4OzPp7wcR63hLgwy7Cr2JMvX7UJ3JUXL9vKB6T/Ermvq6iWqQBGzkN2 VBx5849hsTJQKEZQPw+49qO+MDJxKrcKcMklx7/XVnfrvTnw1cr0OkhqNs1FU0OYtqZ2OrO44jX bNoXIJbx/pc6nTAv07qiqzhM9HNUUs2kcwfuoTQsmls+zYWeXcFGl191VcNJe+65VW4CfHozAQd oxrijHA0e2FrOP50DBNxAmVunI86JNzOggTWa0PIto/BM/WYkfrFPLJAXV7WpQj4pp+jzSjKzKa WbubjAK2AnvfaSed1/O2AoGl/fQU1NUeAlqdEyQzQsTsBGllCZi0+QhjmDWG+DBFvLSp+Zx6C1o rHCq1iRlnfF4vHtpQsQAZAJ000miL6olx0Qlmuwaw== X-Received: by 2002:a05:6000:18e:b0:449:8650:954d with SMTP id ffacd0b85a97d-44986509648mr1390332f8f.12.1777541906355; Thu, 30 Apr 2026 02:38:26 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Yanan Wang , Zhao Liu , Paolo Bonzini , Richard Henderson , "Dr. David Alan Gilbert" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour , Peter Xu , "Edgar E. Iglesias" , Jiaxun Yang , Nicholas Piggin , Chinmay Rath , Glenn Miles , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Ilya Leoshkevich , David Hildenbrand , Mark Cave-Ayland , Artyom Tarasenko , Max Filippov Subject: [PATCH v2 11/25] hw/core: Update docs for get_phys_addr_{attrs_, }debug Date: Thu, 30 Apr 2026 10:37:56 +0100 Message-ID: <20260430093810.2762539-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260430093810.2762539-1-peter.maydell@linaro.org> References: <20260430093810.2762539-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42a.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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1777542363107154101 Update the documentation for the get_phys_addr_{attrs_,}debug methods and wrapper functions to state that they can handle non-page aligned addresses and will return the corresponding exact physaddr for them. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20260417173105.1648172-11-peter.maydell@linaro.org --- include/hw/core/cpu.h | 16 +++++++++++----- include/hw/core/sysemu-cpu-ops.h | 4 ++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 9d6b4fd697..730876b7b8 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -746,15 +746,18 @@ void cpu_dump_state(CPUState *cpu, FILE *f, int flags= ); =20 /** * cpu_get_phys_addr_attrs_debug: - * @cpu: The CPU to obtain the physical page address for. + * @cpu: The CPU to use for the virtual-to-physical translation * @addr: The virtual address. * @attrs: Updated on return with the memory transaction attributes to use * for this access. * - * Obtains the physical page corresponding to a virtual one, together + * Obtains the physical address corresponding to a virtual one, together * with the corresponding memory transaction attributes to use for the acc= ess. * Use it only for debugging because no protection checks are done. * + * The address need not be page-aligned; the returned address will + * be the physical address corresponding to that virtual address. + * * Returns: Corresponding physical page address or -1 if no page found. */ hwaddr cpu_get_phys_addr_attrs_debug(CPUState *cpu, vaddr addr, @@ -762,13 +765,16 @@ hwaddr cpu_get_phys_addr_attrs_debug(CPUState *cpu, v= addr addr, =20 /** * cpu_get_phys_addr_debug: - * @cpu: The CPU to obtain the physical page address for. + * @cpu: The CPU to use for the virtual-to-physical translation * @addr: The virtual address. * - * Obtains the physical page corresponding to a virtual one. + * Obtains the physical address corresponding to a virtual one. * Use it only for debugging because no protection checks are done. * - * Returns: Corresponding physical page address or -1 if no page found. + * The address need not be page-aligned; the returned address will + * be the physical address corresponding to that virtual address. + * + * Returns: Corresponding physical address, or -1 if no page found. */ hwaddr cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr); =20 diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-= ops.h index a4fc330bea..a87c55d922 100644 --- a/include/hw/core/sysemu-cpu-ops.h +++ b/include/hw/core/sysemu-cpu-ops.h @@ -31,6 +31,8 @@ typedef struct SysemuCPUOps { bool (*get_paging_enabled)(const CPUState *cpu); /** * @get_phys_addr_debug: Callback for obtaining a physical address. + * This must be able to handle a non-page-aligned address, and will + * return the physical address corresponding to that address. */ hwaddr (*get_phys_addr_debug)(CPUState *cpu, vaddr addr); /** @@ -39,6 +41,8 @@ typedef struct SysemuCPUOps { * access. * CPUs which use memory transaction attributes should implement this * instead of get_phys_addr_debug. + * This must be able to handle a non-page-aligned address, and will + * return the physical address corresponding to that address. */ hwaddr (*get_phys_addr_attrs_debug)(CPUState *cpu, vaddr addr, MemTxAttrs *attrs); --=20 2.43.0 From nobody Sat May 30 19:22:59 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1777542084; cv=none; d=zohomail.com; s=zohoarc; b=W0TknTmnykM5f+1aLMrO1Pk70+hVEvuknsKzTZBbnkYgVIuRC+FNqEYQCKbDuZRXYL7gifD8gBcHVVUq6NvgCktwVBU0j/J2HX+R0jcEiQi4POvb2BTblYFzLZ1hPuaTxR0L34QosmJCvQbJr5uDE5u/WgzSu+BlFqRAu7ZxNK4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777542084; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=AI7nq+06MysQl4C2bToWwnO/0PNTAhpGl0/yIqXSqvo=; b=OKlOfn5YnHqm6FZPiPbdFPYP3ggDYRPLFvWkjlQmY4hY153PpMNqPgqulsRDbpA47YUfKF3aE+8cU3xhPaI11g0L65BDY4KDPDHusc3bdPb5qPM45XJ7Ym1DAQSim8985eY7piVtEX3VN47m6++wPy5qLhKCilDZdkaiCtUzJFU= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777542084651238.62674747798064; Thu, 30 Apr 2026 02:41:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wINrB-00059z-EG; Thu, 30 Apr 2026 05:38:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wINr0-0004qP-Mk for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:42 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wINqn-0002ZW-G2 for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:42 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-43fe608cb92so425170f8f.2 for ; Thu, 30 Apr 2026 02:38:29 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-447b421721fsm10816795f8f.15.2026.04.30.02.38.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 02:38:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1777541908; x=1778146708; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AI7nq+06MysQl4C2bToWwnO/0PNTAhpGl0/yIqXSqvo=; b=Bs3QqhPaCD7mR7Xqjf/p6sZumpLIX+6gBAyoBrqx9LXyJJR9ghlZwdyp5pcsEzYQTK TQA3KUi1YVo9oYd+f2m7yLV2nE+9ORGafHP1odyp7y9Td+guN0ZG6wzsvyQwLRlReozo kYBP1aIwLr5vstbuh4wpjYQmrWbdOYtm030CM0a2bkGgue7Yy1o6wyXjWV1uUNp77IuW 1NTi2m/VM4mIPLLfRLdbzQw9sKWHhlrhjeAb4K9pfvRWvXG0rHs3jImP94czV0duvl1z qX10EDuGLPvGRP9Ql7NtkWRysfrvFuyiLlKBVYKZFo/gH8VqLNKQnrKoQ2sokZ2hhjh3 p2hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777541908; x=1778146708; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=AI7nq+06MysQl4C2bToWwnO/0PNTAhpGl0/yIqXSqvo=; b=WhhN8b2qlhIoRjULZY6u6nH6ECIcm6st+Ikitywi4APxFWoBRXB9a4J53dmj5XKWxg Mt8SP81D98rSVc0BT9A8Yah4GWUnLQfX1koT3N4FGdQgtYsN/Aszb+xu7HUNiPWcoKdi AvTKEptbIVl9tOdB5ciizdwmWeENwYj2O3Rzr/rnn1OBn2b0fvFldIiYRLsXxS2qj39T Glh+t6dN0/ypIzNBuGKxqtDzMZHg99d7HnHLYsOnCtoUMBCGwuuM2Zr5A/5mjm65/rAr +zFPZXOODxTVkJ2nfaA+uvdykv//livU8Sme+had/cDoH3DwjhKcgtkvJBh8h9RQmQS5 uW4g== X-Gm-Message-State: AOJu0YwQXRJddRtCQETMM7BAUKJmkegkk0dJ/mReI3NMokAN/1NpmAtc 9wYeYG6kEmyCBdSARHRw+4rdQH54RzNxwt70LcsOmUxMgn7N2CW/elRxdoOy6MFB6Ljrbiedj/P Sykaf X-Gm-Gg: AeBDies6iCZ4McVV15u38ge04jDvRSl47P0CX9VNEj1eSUf74tWjiLvtbbaahXzEIHk FhLpvKRzpzmBUukq/48IA8hbDoXSwskd7d7q5gl0dYpTE2KZh8ibZq5WhMQ7BDFhTlU+MTWAYKi VT2yJOdV81+szkVa9C19n/QS+oCkxwv/1tEmcSWUv4si4GA72drV69S0RQL0Lzx25FmdaoM7b1u +uVXX9gQOwwlpJ5HNhE4q6yuSlwdGemo/lUkOCzDqoN+0OZbntcAkZRFS4lLRTowi90qm6AuOif gKv8b8SPnun9rwtrHYYCFnoEH42RNaZ2jvPNJuHibZYy/slFUTf7qwc5bbu0el6sFqtxkSoasZo LUObfyV6sE9aAjwBHQ+4R3mZBUM6ZFDsxm4OTMj5vJ2/ATqblmbty0QGh0aHTH9/98+7FZ9szzi yhcU6Jq57JiMEJI905Vcs0ekDeSbWrQhIerAh80dKvUctclN7t7/HuWX/EX+PpQAtjcOWeBu3eU 2EqDlHMI9QJCuScVLxKkmw2i36UHMcWSPjWUq1vpQ== X-Received: by 2002:adf:e690:0:b0:449:6a23:dd1f with SMTP id ffacd0b85a97d-4496a23dd94mr1720147f8f.15.1777541907803; Thu, 30 Apr 2026 02:38:27 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Yanan Wang , Zhao Liu , Paolo Bonzini , Richard Henderson , "Dr. David Alan Gilbert" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour , Peter Xu , "Edgar E. Iglesias" , Jiaxun Yang , Nicholas Piggin , Chinmay Rath , Glenn Miles , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Ilya Leoshkevich , David Hildenbrand , Mark Cave-Ayland , Artyom Tarasenko , Max Filippov Subject: [PATCH v2 12/25] target/arm: Rename arm_cpu_get_phys_page() Date: Thu, 30 Apr 2026 10:37:57 +0100 Message-ID: <20260430093810.2762539-13-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260430093810.2762539-1-peter.maydell@linaro.org> References: <20260430093810.2762539-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, 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 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 @linaro.org) X-ZM-MESSAGEID: 1777542086091158500 The internal helper function arm_cpu_get_phys_page() is named that way because of its use in the get_phys_page_attrs_debug method. Now we've renamed the method, rename the helper to match, since it can handle non-page-aligned addresses. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20260417173105.1648172-12-peter.maydell@linaro.org --- target/arm/ptw.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index f5f624c7c3..8be6f243e6 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -3922,7 +3922,7 @@ bool get_phys_addr(CPUARMState *env, vaddr address, memop, result, fi); } =20 -static hwaddr arm_cpu_get_phys_page(CPUARMState *env, vaddr addr, +static hwaddr arm_cpu_get_phys_addr(CPUARMState *env, vaddr addr, MemTxAttrs *attrs, ARMMMUIdx mmu_idx) { S1Translate ptw =3D { @@ -3950,7 +3950,7 @@ hwaddr arm_cpu_get_phys_addr_attrs_debug(CPUState *cs= , vaddr addr, CPUARMState *env =3D &cpu->env; ARMMMUIdx mmu_idx =3D arm_mmu_idx(env); =20 - hwaddr res =3D arm_cpu_get_phys_page(env, addr, attrs, mmu_idx); + hwaddr res =3D arm_cpu_get_phys_addr(env, addr, attrs, mmu_idx); =20 if (res !=3D -1) { return res; @@ -3964,10 +3964,10 @@ hwaddr arm_cpu_get_phys_addr_attrs_debug(CPUState *= cs, vaddr addr, switch (mmu_idx) { case ARMMMUIdx_E10_1: case ARMMMUIdx_E10_1_PAN: - return arm_cpu_get_phys_page(env, addr, attrs, ARMMMUIdx_E10_0); + return arm_cpu_get_phys_addr(env, addr, attrs, ARMMMUIdx_E10_0); case ARMMMUIdx_E20_2: case ARMMMUIdx_E20_2_PAN: - return arm_cpu_get_phys_page(env, addr, attrs, ARMMMUIdx_E20_0); + return arm_cpu_get_phys_addr(env, addr, attrs, ARMMMUIdx_E20_0); default: return -1; } --=20 2.43.0 From nobody Sat May 30 19:22:59 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1777541962; cv=none; d=zohomail.com; s=zohoarc; b=lm16qxLJJ71ZpRdAdEOMFVvpfLHBC14DeKpvFcifHHT6ATM2TYwzHZ4lAAaXl6tL95uyMqk7b0M/iYKK8EhLkFmgXhB4VzZlFE9iwAuWTwy3933cAY2pSYXINS7zMrLJnTrzhjchg9SGVGdncHnr4T4iAd7mHZKeyLchjH3BGbQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777541962; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=jeiJLcMiad4H/zhSQfsPf5Zc6NaSRLrWE13Uwy30mq4=; b=gc/2Pgzqt/jNzEe9CI6G8qNPD6KVS9Eeu4dvU3HwgeZBsKt6c7IbeyRB0jSeBNjVFYd3K6/J6/vYxn+gO5OSXlNhQQAs0Xbr+NEJ+Bpjr5n+rj1KS6fPGJIYr/1JVM+V1JLfk6xs7lQAtPreIJDuogekiQWeruUP2zZLHjCzwSw= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777541962048295.37589695918314; Thu, 30 Apr 2026 02:39:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wINrE-0005JJ-Ll; Thu, 30 Apr 2026 05:38:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wINr2-0004uj-LL for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:44 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wINqp-0002aU-3A for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:44 -0400 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-43fe3e22e33so399778f8f.0 for ; Thu, 30 Apr 2026 02:38:30 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-447b421721fsm10816795f8f.15.2026.04.30.02.38.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 02:38:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1777541909; x=1778146709; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jeiJLcMiad4H/zhSQfsPf5Zc6NaSRLrWE13Uwy30mq4=; b=QYzET7K/BBExjVUvTgwvJEpwEtDC0IFg8J0Q3EJho2IlgA6zOvCKKEYlHQrcV+5bwA XgcvpzwVCZYedSSZbaYsO9SzOCpWU+/7x1QSDsSv5HON7T9uhWX3WheCv/abUe36vZMN Y3B+rlyyH8hpaT4o31kwzo0ukY3uJiw+6A0Hg+AKYuKMbB1Sp1fu8OqxF2VE4gbnvY18 Cc+VUxqSqY9etv5a4lBwcqkqs/bzL396vOFjl2VRlwjgItZkXmzWMKRdvB+h8Aax3NZJ RPa4w72p37XYVmxlCDtwS7PlqHSGvEWhab8RIuIP03TfyCuEQwXYjJZb6SqRq9S8dpyP oKww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777541909; x=1778146709; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=jeiJLcMiad4H/zhSQfsPf5Zc6NaSRLrWE13Uwy30mq4=; b=V355W07vbJE/Qz6HBo3grz0kIsK0ZWVIF+KWJc4jsfPk1jZNWz3oDX5AFtd5O9j3ik 3qCoqg5aKgvJEzA6NfY3AWjRoazSKMqwOUP0omxc50+r+SOqLGzv6ABqzMI+VDNBgcDD YI1fRQaTjGgCN70MlGdZYDdSFP0ZVMgvK4BlKaCt52ev3bXKGKcYS7Y4YnQ+Frdt2Wfx G2NBPwlJzUrcN+pi7JiwmHD0631lrBgaWeOQHufauy7I9Dhj0cj8OmY9sbUBcXSKT4G7 a3ZMKsxVB+DCe2T42pTgGhw0mb+Wff7SdW2v9x2XU47pSuBv1TMr9zqnpRoUkiZGSQw5 QZWQ== X-Gm-Message-State: AOJu0YxqDRVJMxz13gMAeWOq8vBwtYL+r3ywYpjerpAnmmtL3NwUehwK FZZuJxF+e6H1hRN46w+wiYQgEv5VGWBjONn/rGaxMzhxRYIS1UWXGZiBxnWyINYV4SBXjd5O4mp FGrh4 X-Gm-Gg: AeBDietY0XMqbFiHM0vPtFRmaFkUOeFWgUeVAj5u8z6yseOMDED5Q560eC7EGu+Vwt2 S28nC5iMTrQ2Wbm0IVCdIG5b/JEJSFEW6Q1IFxXvsqVRYUXmybjXkDbwE7OWrfMSDz5hS5lJXUf /8Ddvtl2UTisw4i7Fauap2LH+lM1b3akHTyiKqO8yICzBjewQzk7IkuN5GWUP5leFsj3+pSqtPP ohJFFbmAvtXoUT6kV/6QCIwCSSQRpl5mfxRQZJZHLreay9arrb0JrotUJI1P7qbgdlwIVRhB+pW MP+dNaIWCnus0lMNwbogkHklW/NZKupc6ie8pJ9BUTVkBXacUzH99v4zy3IrwhrHKR1+HFD++sk KsVGCJUmPwxjUGoyFJeO50ALimpbetEAzpkj4MPVhjkMf3tO8DivH7js1E+i4z81gJlQP5CNeT0 sTq5gEzQs0mBSoUy7P6OXXem6Ji6WSszzizz8svX9kYQyIlBxQ6R8FQV8LioGF7TVILe0DiPxuI Mr3A3v6ZA0plky3nWxysCkoWJjMOCFlea8GHJkcSA== X-Received: by 2002:a05:6000:4310:b0:43d:733f:aee6 with SMTP id ffacd0b85a97d-4493dcd3444mr3263214f8f.10.1777541909076; Thu, 30 Apr 2026 02:38:29 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Yanan Wang , Zhao Liu , Paolo Bonzini , Richard Henderson , "Dr. David Alan Gilbert" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour , Peter Xu , "Edgar E. Iglesias" , Jiaxun Yang , Nicholas Piggin , Chinmay Rath , Glenn Miles , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Ilya Leoshkevich , David Hildenbrand , Mark Cave-Ayland , Artyom Tarasenko , Max Filippov Subject: [PATCH v2 13/25] monitor: hmp_gva2gpa: Don't page-align cpu_get_phys_addr_debug() arg and return Date: Thu, 30 Apr 2026 10:37:58 +0100 Message-ID: <20260430093810.2762539-14-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260430093810.2762539-1-peter.maydell@linaro.org> References: <20260430093810.2762539-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42c.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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, 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 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 @linaro.org) X-ZM-MESSAGEID: 1777541963995154100 In hmp_gva2gpa() we currently have a workaround for not all implementations of get_phys_addr_debug handling non-page-aligned addresses: we round the input address from the user down to the target page boundary before the call and then add the page offset back to the returned value. Now that we guarantee that all implementations will return the correct exact physaddr for a virtual address, we can drop this handling. Signed-off-by: Peter Maydell Acked-by: Dr. David Alan Gilbert Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20260417173105.1648172-13-peter.maydell@linaro.org --- monitor/hmp-cmds.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index e6d8322bcc..f8380bda58 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -720,12 +720,11 @@ void hmp_gva2gpa(Monitor *mon, const QDict *qdict) return; } =20 - gpa =3D cpu_get_phys_addr_debug(cs, addr & TARGET_PAGE_MASK); + gpa =3D cpu_get_phys_addr_debug(cs, addr); if (gpa =3D=3D -1) { monitor_printf(mon, "Unmapped\n"); } else { - monitor_printf(mon, "gpa: 0x%" HWADDR_PRIx "\n", - gpa + (addr & ~TARGET_PAGE_MASK)); + monitor_printf(mon, "gpa: 0x%" HWADDR_PRIx "\n", gpa); } } =20 --=20 2.43.0 From nobody Sat May 30 19:22:59 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1777542099; cv=none; d=zohomail.com; s=zohoarc; b=L0HojIiuLBHf9secbV/dllc3bL63ByPCawRRaKAgvo8lvxHAZXHLKt4tabzfUCfeNFFPq994aFEH9gefogW68bxwEG9N6IIyzS24A8wTL85caRrrafm7CJzztjxbPCad+VNhFdmgQI7ZuxwElgdcKykTJ/Cio+N009cVXKeOohI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777542099; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=f0EYnWZKYPS/YsHeLRPLDp7EfXxXLD9+8hyam2As9ks=; b=YG6VBMmxdSeVguimbPC2BUuzu946FtdQUVMHcQYm7tiMzhNf9tq+lyQflqFg9Utb1uZbpK77DBZKQ6pGJrYc1bCauhKnh2rte7cgBvuffvaY5jVxCEHlFdrQEFQE7OsYXK6o78L8NPfp7jJdyBnKcs5RlApsQ+XYzRV1bchfawk= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777542099683347.60757606444827; Thu, 30 Apr 2026 02:41:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wINrB-00059m-AU; Thu, 30 Apr 2026 05:38:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wINr3-0004wB-BY for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:45 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wINqq-0002bM-1E for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:45 -0400 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-43d77f60944so501299f8f.3 for ; Thu, 30 Apr 2026 02:38:31 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-447b421721fsm10816795f8f.15.2026.04.30.02.38.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 02:38:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1777541910; x=1778146710; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=f0EYnWZKYPS/YsHeLRPLDp7EfXxXLD9+8hyam2As9ks=; b=JwG2lVF2tTRyRaCsoXst8LZPO90SmPevlgNqWD32+ouHOJ0SOKqDI3FW1KLKqLmle9 VIG3nv1NzoW5Y2Ct7P0uKJl2Bt7UxeSuxewZrOWAZJKMWE4jZB+Bpu7shLioDiqmQvkD kXYACaj6/4dsqFGl501ZjleHNdIL7H4Ru97o6IcwjS4/n+mW7LVfFAWIglGsFRI98gU7 FqXGD0J+dZP+WRTlUjsEahOddn1qd4aEhYT1BkQ27yCxWIVODovvYe5HjFtQvxLKXKzq N9OaypyEDyl4BDOR4HiFhKSkBfdcPH9ygfxERNwNlia+wMflwp2RMZ/7i6EWlt8EF0eB 46Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777541910; x=1778146710; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=f0EYnWZKYPS/YsHeLRPLDp7EfXxXLD9+8hyam2As9ks=; b=FWxc1XK/hTLZpr1LGIg3kOfCZPhgIFmguJhafpwgGpoY1mGn7sFN1mck/VbLBfogpl 1enQwE2k2OlD7a+nuUANEefDUzb66g7mBYBsyqlWSGe6IuXTPhIRqU42RockPgicx562 KmTmDHlb7UPSoZdI9R+xEvpL+tCPyHSw0YFjCITxT2Lzjqb4VLpEFHg1dPrbDcJgQFR0 UcpZHb7tglaIoDZatAS8ZQ4i0LZUCQZ5DALJa/dA11VNBW3jD8m0kKFIfEuWtT9xCLJf Htw6hUSBjblp+ZRxgczRBuFrOyyIVk2S9LjesgYFfCWTU3bq6uMIsPL97/zTrFv7H7Ud ifhA== X-Gm-Message-State: AOJu0YzFXLawW/1pwZIVa+jgpGB77Tj3jupMivqqnA6BJD2IxlGw8mg/ 20qpca19lSqhIkELUbnNBgWJ97DakbgM78/CWbLQh+Xo/OsurqOs5xlohk8E7fBmRMZ6uhPSkNt 8NWXa X-Gm-Gg: AeBDieu5M63r5Q/0Pj8HBT+gTbs++2Sl791ZitKd9uJDhOuqzJRYwBs4UhRLAFhj/q9 xaNoLdqQxjjdrY1+jRV1tAtv6bc1LBaM4FmRg5v5lfKrUzY5KsBDwY/qpKSuWO22TxPsu/rpDYx lJCfCS3yUahy5ug1lYo10RSvqxWekr+3Co+iw3HqIQbMj6EsxqhKnWGX3+Lo9hoDnYxPz0r0VXD MLQpXBJtZppK8FrxcGnA9MTj1utlKVAsPslzNB2xRXfj9Y/nBhrSDbz95nHZQa43pTMsS7/ikL6 gnL9MwvNRinzDLbRJWo5FRIYYm47X7SaptZuyBNFZs8zcJzR4YlIynmuvrgIixQLyI1fpmorHjC d05e5kPvWJ8qQbX+P9Qbpfj0eSrSWwMBZAwiuksuqD4xoeEmd84hhD04gU9O0M4SANZvTvV5stV 3wtuhnY0pWJGKOnsudXu6jQvWJFJh2ZeQ0hk2KCn3kU1GuHMFiNZ3NmHKp1CBsOsc862DDU4SvV h08jABEz3drmxozyde+ddjKerIKcS6COdQ1GT9c6w== X-Received: by 2002:a5d:5f91:0:b0:43b:5672:efe with SMTP id ffacd0b85a97d-4493cb42f75mr3233148f8f.9.1777541910362; Thu, 30 Apr 2026 02:38:30 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Yanan Wang , Zhao Liu , Paolo Bonzini , Richard Henderson , "Dr. David Alan Gilbert" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour , Peter Xu , "Edgar E. Iglesias" , Jiaxun Yang , Nicholas Piggin , Chinmay Rath , Glenn Miles , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Ilya Leoshkevich , David Hildenbrand , Mark Cave-Ayland , Artyom Tarasenko , Max Filippov Subject: [PATCH v2 14/25] plugins/api.c: Trust cpu_get_phys_addr_debug() return address Date: Thu, 30 Apr 2026 10:37:59 +0100 Message-ID: <20260430093810.2762539-15-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260430093810.2762539-1-peter.maydell@linaro.org> References: <20260430093810.2762539-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x433.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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, 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 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 @linaro.org) X-ZM-MESSAGEID: 1777542100081158500 Content-Type: text/plain; charset="utf-8" In qemu_plugin_translate_vaddr() we have a workaround for not all implementations of get_phys_addr_debug returning an exact physaddr for the input virtual address: we OR back in the page offset to the return value. Now that we guarantee that get_phys_addr_debug returns the exact physaddr for the input virtual address, we can drop this workaround. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20260417173105.1648172-14-peter.maydell@linaro.org --- plugins/api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/api.c b/plugins/api.c index 4b6fad4999..c97cc68882 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -625,7 +625,7 @@ bool qemu_plugin_translate_vaddr(uint64_t vaddr, uint64= _t *hwaddr) return false; } =20 - *hwaddr =3D res | (vaddr & ~TARGET_PAGE_MASK); + *hwaddr =3D res; =20 return true; #else --=20 2.43.0 From nobody Sat May 30 19:22:59 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1777542064; cv=none; d=zohomail.com; s=zohoarc; b=Cgd3/XR5vpnMuNkhYqo7ZvKWMqQSdTm2TVqmT1fPE8RQ5MjMF2g5sYO7LDoKu6X8ISYtO4iNYZ0+/Gk67sTBw/5YOdIeMsxgojK7CySXAfU6efQ0hn+ibOGvsPUHHII4U7nL+X7WuScIjtnlrqbj7wM8wW4ck4WXRxKFAvyjUsw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777542064; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=PrG0vJAnVOwocUICQiyboyR/fgJITJNbTgSVXZ5AWGw=; b=HY9C8b4x8zFGrHWITCY1P+Ta8SWr2ccvsgTFI2586QJ0FlFLkkIpsx0qGG94Raq/Z9JvpHMgvDuVhvGiW5S+f4vQuHV76G/8TqVObZzi6db9nWXFg/fPa3RJPfyCfJXQXSsP0UW65oGRvuHP2nTqrAFEkxz1rXnjyJbkevYdQGI= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777542064602875.6578420970919; Thu, 30 Apr 2026 02:41:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wINrB-0005BE-U2; Thu, 30 Apr 2026 05:38:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wINr5-0004yM-OR for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:47 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wINqr-0002cI-Nu for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:47 -0400 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-4486b5fcf3cso639847f8f.2 for ; Thu, 30 Apr 2026 02:38:33 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-447b421721fsm10816795f8f.15.2026.04.30.02.38.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 02:38:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1777541912; x=1778146712; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PrG0vJAnVOwocUICQiyboyR/fgJITJNbTgSVXZ5AWGw=; b=qrwM2wYn8II5fGYGPiiMvobF2IJo4Jrf1X2auRs8ErOo6uRu/UxllrHGOTMBIyND68 dkHa6PgB+DFqt2HvLcHs1DnwA4xlubHyooBp61nMHdLokPqqEqsEsZaE/vwkteTO8MLE q6R/L/D+/yjgD/dFqXY3Hyd7uKuFO5VPnFEZaLLuOw5/XzMWL43c209z+GIeawCgfNOa tKgeB2SRYiUpLwYeIqltjvIy7JV9PC3L09IqPVZ/c8KziZh79BMVG9QVrhcODQFxXCwN hOiObn3TjSCjFT6ncj3n8zBg0+m94bE6h0WRS+G34tJlR1gmPEVX94utN1R7jvE5loVF Kk7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777541912; x=1778146712; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=PrG0vJAnVOwocUICQiyboyR/fgJITJNbTgSVXZ5AWGw=; b=Z2t/E5J33vt7ZxhdNSfOF3/cXRN2WZ9nwLmFJxKHGhtliBreqABEt4G1LIkWWtl+PM Y9p7TYNiG5rhXWd+2ty7kKJ41ifo5OHN9etDGUJ+1XoqJhhzivWAoXOn0EmoHPxMpre8 VSbjoO7ynLI4q3N7Xc/28kQBTzMSDgYzWGpX0OHs3D0e2vMS0aWwrr1RsXWu1WY6DEGn 88wuJb3tTg2hzt+28L0Irqjsrt8lNcF5Jik6eCTs02SUmaMUjU2jSlsoCk+SNhBxCXgN oixsoHMXB6LFrEkzSSd29I9ykN6vu6aTp9KX9GoYxzeD4/dpQ6xkhvim2Rhf+O1wHV0z MKqw== X-Gm-Message-State: AOJu0Yzjs2Nf4xJrk9YS9Hg4sMzkfVbKiUEmPfqOXreiabk+98S74dhu 82xyFvWtyP6bj1lau97KFnnhw8gJu50H9qVTZVtpnCL/Pr/V8QYDiWzz0ndWPxYN3uv1lFGV+o0 N4dpv X-Gm-Gg: AeBDies99RYSrcepLbKP8Y10KHJmqUJATAyib0G2vkZdxIQ0Vf26cB19AYdmM1oZ49D 4RDT6uG3xGSHIMkl7etBMvXH5YWMtu/EXsHx3IoDYIqVPJexGU2IgX9a934bCpjUQSeAz465VXs z38hWYsrXNR6MzQnQuZ1ErhpeQ/qtF8ZqtkGFHhrGLukrtO6OMUr97cdNZ3YozwPiTQuGzal6ky KKz8xav79J7zEChePVZmwKK0yOMMByNEltz0vW+4BxK0lhai5Bk++MnM/LUjqa+mSr4KyQx2ot5 okxrSDmOJ86WUv/I+2CXQF8NpTgJrUEG0PBGPvEo+HC8a2hxxnLc+9Pr4MVCrm2PZ2M+QF15Pb8 tzX5sSfH9iNaGFz0XMO4WPTfTWpkXqlNvEjw0ROvn6vKHyQnDcHzPtiZxd273K/BZgOYWgWVVJc jZBRaH2QpMkFgiKGUIqffYfbzV+Q13xD1Ny6cyZO2af9qomJe5I1p9C90SXel/xEkTrVIZIDD7O JlBqB+HrD81oIcB5KqvgKOOOBtb4gnN4hYqRIgolw== X-Received: by 2002:a05:6000:4284:b0:43d:50c:6f33 with SMTP id ffacd0b85a97d-4493f426190mr3469419f8f.26.1777541911650; Thu, 30 Apr 2026 02:38:31 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Yanan Wang , Zhao Liu , Paolo Bonzini , Richard Henderson , "Dr. David Alan Gilbert" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour , Peter Xu , "Edgar E. Iglesias" , Jiaxun Yang , Nicholas Piggin , Chinmay Rath , Glenn Miles , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Ilya Leoshkevich , David Hildenbrand , Mark Cave-Ayland , Artyom Tarasenko , Max Filippov Subject: [PATCH v2 15/25] hw/core: Implement new cpu_translate_for_debug() Date: Thu, 30 Apr 2026 10:38:00 +0100 Message-ID: <20260430093810.2762539-16-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260430093810.2762539-1-peter.maydell@linaro.org> References: <20260430093810.2762539-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42e.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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, 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 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 @linaro.org) X-ZM-MESSAGEID: 1777542065428154100 In cpu_memory_rw_debug() we need to do a virtual-to-physical address translation for debug access. Currently we assume that the translation is valid for an entire guest page, but this may not be true if the target implements some protection regions that have sub-page granularity. (Currently the only such target is the Arm CPUs when using an MPU, as in R-profile and M-profile.) For TCG's emulated accesses, we handle sub-page granularity by the CPU filling in the lg_page_size field of the CPUTLBEntryFull struct to tell us how large the region covered by the result is. But we didn't extend this to the debug-access code path, with the result that debug accesses might incorrectly fail because they are looking at the mapping for the address rounded down to a page boundary. Provide a cpu_translate_for_debug() function which reports to the caller not just the physical address and attributes of the translation but also the lg_page_size for which it is valid. The fallback implementation calls cpu_get_phys_addr_attrs_debug() and assumes target-page-sized validity. NB: the "return true on valid access, false on failure" follows the same convention as TCGCPUOps::tlb_fill_align() (though it is the opposite of what we use in some other places, e.g. in target/arm's get_phys_addr_* functions). Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20260417173105.1648172-15-peter.maydell@linaro.org Reviewed-by: Richard Henderson --- changes in v2: lg_page_size wants TARGET_PAGE_BITS, not TARGET_PAGE_SIZE --- hw/core/cpu-system.c | 32 ++++++++++++++++++++++++++++++++ include/hw/core/cpu.h | 32 ++++++++++++++++++++++++++++++++ include/hw/core/sysemu-cpu-ops.h | 27 +++++++++++++++++++++++++-- 3 files changed, 89 insertions(+), 2 deletions(-) diff --git a/hw/core/cpu-system.c b/hw/core/cpu-system.c index 05c126ecb6..252e90c8fd 100644 --- a/hw/core/cpu-system.c +++ b/hw/core/cpu-system.c @@ -22,6 +22,7 @@ #include "qapi/error.h" #include "system/address-spaces.h" #include "exec/cputlb.h" +#include "exec/target_page.h" #include "system/memory.h" #include "qemu/target-info.h" #include "hw/core/qdev.h" @@ -55,6 +56,37 @@ bool cpu_get_memory_mapping(CPUState *cpu, MemoryMapping= List *list, return false; } =20 +bool cpu_translate_for_debug(CPUState *cpu, vaddr addr, + TranslateForDebugResult *result) +{ + if (cpu->cc->sysemu_ops->translate_for_debug) { + return cpu->cc->sysemu_ops->translate_for_debug(cpu, addr, result); + } else { + /* Fallbacks for CPUs which don't implement translate_for_debug */ + if (cpu->cc->sysemu_ops->get_phys_addr_attrs_debug) { + result->physaddr =3D + cpu->cc->sysemu_ops->get_phys_addr_attrs_debug(cpu, addr, + &result->at= trs); + } else { + result->physaddr + =3D cpu->cc->sysemu_ops->get_phys_addr_debug(cpu, addr); + result->attrs =3D MEMTXATTRS_UNSPECIFIED; + } + if (result->physaddr =3D=3D -1) { + return false; + } + /* Indicate that this is a debug access. */ + result->attrs.debug =3D 1; + /* + * Assume memory access permissions are valid for the whole page. + * Targets where this isn't true should implement the + * translate_for_debug method. + */ + result->lg_page_size =3D TARGET_PAGE_BITS; + return true; + } +} + hwaddr cpu_get_phys_addr_attrs_debug(CPUState *cpu, vaddr addr, MemTxAttrs *attrs) { diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 730876b7b8..6a6b78af31 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -778,6 +778,38 @@ hwaddr cpu_get_phys_addr_attrs_debug(CPUState *cpu, va= ddr addr, */ hwaddr cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr); =20 +/** + * TranslateForDebugResult: gives result of cpu_translate_for_debug() + * + * @physaddr: the physical address corresponding to the virtual address + * @attrs: the transaction attributes for this access + * @lg_page_size: log2 of the size of the aligned block of memory + * that this physaddr and attrs are valid for. + */ +typedef struct TranslateForDebugResult { + hwaddr physaddr; + MemTxAttrs attrs; + uint8_t lg_page_size; +} TranslateForDebugResult; + +/** + * cpu_translate_for_debug: + * @cpu: The CPU use for the virtual-to-physical translation + * @addr: The virtual address + * @result: Struct filled in with results of translation + * + * Perform a virtual-to-physical address translation for debug accesses. + * Use it only for debugging because no protection checks are done. + * + * The address need not be page-aligned; the returned address in @result + * will be the physical address corresponding to that virtual address. + * + * Returns: false on translation failure; true on successful translation + * and fills in the fields of @result. + */ +bool cpu_translate_for_debug(CPUState *cpu, vaddr addr, + TranslateForDebugResult *result); + /** cpu_asidx_from_attrs: * @cpu: CPU * @attrs: memory transaction attributes diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-= ops.h index a87c55d922..8625ebb564 100644 --- a/include/hw/core/sysemu-cpu-ops.h +++ b/include/hw/core/sysemu-cpu-ops.h @@ -33,19 +33,42 @@ typedef struct SysemuCPUOps { * @get_phys_addr_debug: Callback for obtaining a physical address. * This must be able to handle a non-page-aligned address, and will * return the physical address corresponding to that address. + * + * CPUs should prefer to implement translate_for_debug instead of + * this (and must do so if their translations are not always valid + * for a complete target page or they use memory attributes). */ hwaddr (*get_phys_addr_debug)(CPUState *cpu, vaddr addr); /** * @get_phys_addr_attrs_debug: Callback for obtaining a physical addre= ss * and the associated memory transaction attributes to use for t= he * access. - * CPUs which use memory transaction attributes should implement this - * instead of get_phys_addr_debug. + * * This must be able to handle a non-page-aligned address, and will * return the physical address corresponding to that address. + * + * CPUs should prefer to implement translate_for_debug instead of + * this (and must do so if their translations are not always valid + * for a complete target page). */ hwaddr (*get_phys_addr_attrs_debug)(CPUState *cpu, vaddr addr, MemTxAttrs *attrs); + /** + * @translate_for_debug: Callback for translating a virtual address in= to + * a physical address for debug purposes. + * The implementation should fill in @result with the physical address, + * transaction attributes, and log2 of the size of the aligned block of + * memory that the translation is valid for. + * This must be able to handle a non-page-aligned address, and will + * return the physical address corresponding to that address. + * The attributes must include the debug flag being set. + * Returns false on translation failure; on success returns true and + * fills in @result. + * + * This is the preferred method to implement for new CPUs. + */ + bool (*translate_for_debug)(CPUState *cpu, vaddr addr, + TranslateForDebugResult *result); /** * @asidx_from_attrs: Callback to return the CPU AddressSpace to use f= or * a memory access with the specified memory transaction attribu= tes. --=20 2.43.0 From nobody Sat May 30 19:22:59 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1777542037; cv=none; d=zohomail.com; s=zohoarc; b=Lb9FCg46zm+cYZIQ1x5sYdpn3Y2M1IaI0hSWMiuSujP2bClPNZG9yP/UX0uB0hPfC/Pc4rAvFFf9ZnNRcYtEzDSmu4sIVbxQjleKFl4U5w0Lojax1HYG/slHcvcbPGXRTbjzxfKeYNCsKU36Q6Lk13HTT+OyVL/lGewIFmgH698= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777542037; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=4/gv/HytlUcW5dY9i00lhaI+5RvkDtcY5NICndqocfw=; b=WBuBd8XZrCgl6QX0rUiV3vk9l2VR5zyNn4+uOKDhFgPMeY4tyqxS1Yyik/3kp+jjF5X3u+ROMEw/Ow3WSfIJ+xdCax3NLUq3cJhJMHeMP8umqamzP9EqP85l6Is47/lRyipapJE/loGLE7lSW8Upb1e5/b9rsGhYnJnRut6Zi5M= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177754203747238.8296408159797; Thu, 30 Apr 2026 02:40:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wINrG-0005MH-1T; Thu, 30 Apr 2026 05:38:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wINr6-0004zg-9n for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:49 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wINqs-0002eE-Li for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:47 -0400 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-43d70b3e159so374490f8f.0 for ; Thu, 30 Apr 2026 02:38:34 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-447b421721fsm10816795f8f.15.2026.04.30.02.38.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 02:38:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1777541913; x=1778146713; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4/gv/HytlUcW5dY9i00lhaI+5RvkDtcY5NICndqocfw=; b=uQMQ5wVPJRWQsq2VijeMwbzuDJU6BlvL3ypHngn+llroqhJJnX0l9J1Ehv/OS1FzKp cvkGDX6foL3TG3mM/Fh1L6jxrS2N+UFdM1P+tu7Rz+UqlHy6jzENZKFcrFA6qsXlQlKp 2ReA6vN7tsnFN5nt9KL2Ux82HoOI1UdaydN3r4dsV01bijoo/rlvaEKZURPhoxAMbAHb HiBxZwP42REzXrHfRC2qBQDisGU/6rl5VLh31yp9rSjFO5DS85UxK5Ht80zK9NIeCKt4 KK5KPBMK8v0/q47PEkULPOZlP1ROEeIDHIip1vBE5Xz3/cfbn1qpqrcLJ7weQa8D1jnz X3VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777541913; x=1778146713; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=4/gv/HytlUcW5dY9i00lhaI+5RvkDtcY5NICndqocfw=; b=Vvwc4cswLCw0Vy7OJzh3YyF4qrlziqbUeBJbr78DicEyUefKijCr4bSwHMfj7UtjFz sYU1SYIJYuVv/I0QPGOJyBYCErBSUL/YIuuF6skbMoTTkJN7ulMLCyi2UujSEmCnUxSJ lEBBKaCqI/68W9y0AA1x5nWIi3rS+wYgLxBTGOCCUC2jPKIbvP0KiAMyAIYIgOrbmG8q ZGm3noLvsHZcCjDiGngV7vmO++f6QcuL8/SQGS1SqTX3xLIWQSCu5er19H0Igd8z7A5d QHj7Dgk0tggeLaF4cSGS7QlSK17L0t76XnQd51lT4fbaWZVPJK/KM/zZfS+2tsTN7PJJ 53JA== X-Gm-Message-State: AOJu0Yy8jqm67JPwG7gBQDpLfeKmSfzzW7xzVhKb47FXtGCOExVw2tL7 ZT091QPgiapTiLEroCwuUrV8eeZp+5DMznd6DkN5nQxvTgqmVyhshW30G8muNIAOk8HTsU2Q79S Y8fV/ X-Gm-Gg: AeBDieteywDDAi2zGTjGeFKAX8/YBG4ZlxbJ+WSFquRrcdPLTAQZurV/uGkwepPYHhN lnfW0O/CIKKwR9GgE0tOsRcYoVYVFN66xqiBD96O5VWNm5mOFkzm0YJePX//LUtIxlmsV6C+pgB pzGzmzQH9hh+eHdORgtt0bu7NFSximxJ1G0lgkhk7VCfE9q0y1Gg+qY8u5rMNMV3lsGTS6nCrSt tSToi2dWiB7fL6tcj3WP6VkVb4bC6MzjytptA5LmgShjIQpGliK4Gcdgd8AOmOPeM6zOVm1QR3/ 5Y0Jvu0MrgRwQHVdnACtKBAhTKwXXLy601c8WKykYo0VJleD9Ru2OB6ACW1opguUZPBibVhzrGk GeuUAXCmLrpB4z3KuQMqQxlJbjyEjirQcI9FwHm0fVwRdZvtYc51R0nwNTpvCh6FNBwAhx/30h/ Bn3WzF004fLD8RGylalY52IpD4rB9a6bieiEH5MCLVat4YTvxdXRYuj8RloDWkhI5HwoPcdt37g hcH0D0op7FIIqZywXR66ERGJVS4NsFCavpy4XPXEQ== X-Received: by 2002:a05:6000:40c9:b0:43d:9bb5:bda5 with SMTP id ffacd0b85a97d-4493ee4d4c5mr3069153f8f.40.1777541912845; Thu, 30 Apr 2026 02:38:32 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Yanan Wang , Zhao Liu , Paolo Bonzini , Richard Henderson , "Dr. David Alan Gilbert" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour , Peter Xu , "Edgar E. Iglesias" , Jiaxun Yang , Nicholas Piggin , Chinmay Rath , Glenn Miles , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Ilya Leoshkevich , David Hildenbrand , Mark Cave-Ayland , Artyom Tarasenko , Max Filippov Subject: [PATCH v2 16/25] hw/core: Implement cpu_get_phys_addr_attrs_debug() with cpu_translate_for_debug() Date: Thu, 30 Apr 2026 10:38:01 +0100 Message-ID: <20260430093810.2762539-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260430093810.2762539-1-peter.maydell@linaro.org> References: <20260430093810.2762539-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42f.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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, 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 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 @linaro.org) X-ZM-MESSAGEID: 1777542037819158500 Content-Type: text/plain; charset="utf-8" Implement cpu_get_phys_addr_attrs_debug() with cpu_translate_for_debug(), so that CPUs can implement only the translate_for_debug method and have all of the wrapper functions cpu_translate_for_debug(), cpu_get_phys_addr_attrs_debug() and cpu_get_phys_addr_debug() work. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20260417173105.1648172-16-peter.maydell@linaro.org Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/core/cpu-system.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/hw/core/cpu-system.c b/hw/core/cpu-system.c index 252e90c8fd..954b81931d 100644 --- a/hw/core/cpu-system.c +++ b/hw/core/cpu-system.c @@ -90,19 +90,14 @@ bool cpu_translate_for_debug(CPUState *cpu, vaddr addr, hwaddr cpu_get_phys_addr_attrs_debug(CPUState *cpu, vaddr addr, MemTxAttrs *attrs) { - hwaddr paddr; + TranslateForDebugResult result; =20 - if (cpu->cc->sysemu_ops->get_phys_addr_attrs_debug) { - paddr =3D cpu->cc->sysemu_ops->get_phys_addr_attrs_debug(cpu, addr, - attrs); - } else { - /* Fallback for CPUs which don't implement the _attrs_ hook */ - *attrs =3D MEMTXATTRS_UNSPECIFIED; - paddr =3D cpu->cc->sysemu_ops->get_phys_addr_debug(cpu, addr); + if (!cpu_translate_for_debug(cpu, addr, &result)) { + return -1; } - /* Indicate that this is a debug access. */ - attrs->debug =3D 1; - return paddr; + + *attrs =3D result.attrs; + return result.physaddr; } =20 hwaddr cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr) --=20 2.43.0 From nobody Sat May 30 19:22:59 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1777541971; cv=none; d=zohomail.com; s=zohoarc; b=OuAn0S1pA1ZXRKfhAnG3/anecMnDWSXcF44ZRwf+SF5d17yL0+/cTT7X4/HgGnSxhrqgQk53wAM1ykHjfo1s4X2BHlXB/BDue6Elnq2mZqtY0WJ0DwWihqvLFfP0Lk6galVElAbfPTYJsSc06TJfG7XjqqVlXsDvA1lodGDxtc0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777541971; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=c9snYL6N/5LnNtzLZ3Lr1l12O+pLGtTzbqLqghTUwtI=; b=ID3FFevpgnPM8f69/yGwUh/6JEMwEThEsUvUo0D3U+wO5UofBdW7LVpuJYFQxGfpeySuQBzP4M0Miy1TpqD351I9VGDuB0Lh8ngsTvczfPWGcsJT0iNPURr5GoWck5LSYpXl6LoLUOzHPy+pyKRp7mbU7zUFUMW7flRAeu6TtZI= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777541971166573.8489302288752; Thu, 30 Apr 2026 02:39:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wINrF-0005Lo-V9; Thu, 30 Apr 2026 05:38:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wINr7-0004zy-Pc for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:49 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wINqt-0002gs-R6 for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:49 -0400 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-43fde5b81a1so578191f8f.0 for ; Thu, 30 Apr 2026 02:38:35 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-447b421721fsm10816795f8f.15.2026.04.30.02.38.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 02:38:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1777541914; x=1778146714; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=c9snYL6N/5LnNtzLZ3Lr1l12O+pLGtTzbqLqghTUwtI=; b=WYywqCBbQzH1VQkJNb/NHvj6KDKtDM6jVMT11PWLdrXfC1aICvpaU/RC0SnzRU5qE7 T/3ug6f6fCDN6lqoOTOrJDW6l9FbKUntWwvexYgoWl/VlUgpA6XmMTa1UZuktqNXJJEY aG/K4rUHoIv+Q5MbJ5M6ZglCqh1cG7U9ujbgR915g43Df7BYu/KbxIfaAhkamPdFBZYa ep6fDa1FRXhsvBM6vUBcKVzX2w5Wf/crA+HM9t1JiRB30I2wtdUEOnx0inhO/4wFcgyr NDUA/NIEiUH4QCKsNcqDcpJUcHTFOtbOcO64jfk4bPg51nT3BWK9ti2eacPVJAmzpR1s QxEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777541914; x=1778146714; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=c9snYL6N/5LnNtzLZ3Lr1l12O+pLGtTzbqLqghTUwtI=; b=qcjFFMDA6bWue5GlALVcqKukRWsW+doO+W1hmKbi4DNxRy4p0DUEcyoIbrRUewHbVZ QAeIfBLyF43PAMU302EgUVWEVA27sdVYxDSVWMz+pTL6FbIFAFfSqTQB4iNUFQYIDdZ6 Memmcto/v1ZmhJRY5djdeaxjpf2IiD4V0WtcOy7nzN+HHxm9lv6MhTaaHgiqJIngWIMm T11B1LCldJJmczMfCogv7KGtw/OqgxaY8Jz2be56fxW9q/QK0sDkVhGK4ktysiiDqnuj YR2vM7xTTW2udDUWL78nU39ieNBtfeYgIkg1MCfigk4Ybrt198XHIf6y1VL48yILobdS 0TGQ== X-Gm-Message-State: AOJu0YyKgQlFwOZz6m7MZ4Aq/Ob5LKQ6xcBcp9+66xZXUnyvEKp6e+Ox 2+4dobZMG6W40VSiN80LOTp3XO9sVOyBHWAsvIx9YMgJVMfL6iJufOEk/9XbgofajAc5Z3n2xop +3xcS X-Gm-Gg: AeBDiev+lrM7kC3zCNFjzh3HqF0y7g0jz+bLt5lWiQayARPQ0DypriCLG2CGT8pdbmP wmgthrtE4bCC2SHxLJO+Uzjvh0P7RP0e5fCSozXTRdIF1fyA2Xkx2AuE9g5k1PwCw5SeMjlEorT TOo4Cp+hUTw6B7R0a9zzRFVD2rYy8vi0rjfvf5BMPliifYZFJIP4p11HN2uSPkwTYSMQ0cDc6VL c/SclVR/aFJTL0H3hqfGgStkynKjGNOPDDhZ8q8gCRCM9ZEEljqmmalS/zikR6vNZV/W/myDQO+ kWwSBy2unJhE57ssJsbjJibZW3JMWN0tRKZVVXM8Asdal4D5uPzl1tI9xdbgtjdC7Yie0SzDqUu hBXe7cwrk8QUOrb3uoIM1cQwFSW/dcs585a36fSQAQ1UidxaqlEFgQIf55CNek9TDRsdbTcd3Xd cPhNtx4wiB0DqAnqTRKoYN9dCFoF8iMhrwwKte9nn96i92ITxGHPX/M2EklgP3WLWyAH1e+Bo/b tBjH2OO4FpWHcbh1BnXFm8DjxJiOV8qiRFeyU+2Pw== X-Received: by 2002:a05:6000:2486:b0:43d:7d24:b4ff with SMTP id ffacd0b85a97d-4493f42e211mr3104854f8f.40.1777541914093; Thu, 30 Apr 2026 02:38:34 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Yanan Wang , Zhao Liu , Paolo Bonzini , Richard Henderson , "Dr. David Alan Gilbert" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour , Peter Xu , "Edgar E. Iglesias" , Jiaxun Yang , Nicholas Piggin , Chinmay Rath , Glenn Miles , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Ilya Leoshkevich , David Hildenbrand , Mark Cave-Ayland , Artyom Tarasenko , Max Filippov Subject: [PATCH v2 17/25] target/arm: Implement translate_for_debug Date: Thu, 30 Apr 2026 10:38:02 +0100 Message-ID: <20260430093810.2762539-18-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260430093810.2762539-1-peter.maydell@linaro.org> References: <20260430093810.2762539-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x429.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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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 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 @linaro.org) X-ZM-MESSAGEID: 1777541971783158500 Implement the translate_for_debug method instead of the get_phys_addr_attrs_debug one. This allows us to pass the caller the lg_page_size from our internal GetPhysAddrResult struct. Awkwardly, translate_for_debug's "true on success" convention is the opposite of the one we use internally in ptw.c, so we have to be careful about the sense of the return values. This corresponds to the way that arm_cpu_tlb_fill_align() also has to return true when get_phys_addr() returns false. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20260417173105.1648172-17-peter.maydell@linaro.org Reviewed-by: Richard Henderson --- v1->v2: use 'fault' for the bool variable, not 'ret' --- target/arm/cpu.c | 2 +- target/arm/cpu.h | 3 --- target/arm/internals.h | 4 ++++ target/arm/ptw.c | 39 +++++++++++++++++++++++---------------- 4 files changed, 28 insertions(+), 20 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 9e6b4b1559..eaa1805160 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -2436,7 +2436,7 @@ static vaddr aarch64_untagged_addr(CPUState *cs, vadd= r x) =20 static const struct SysemuCPUOps arm_sysemu_ops =3D { .has_work =3D arm_cpu_has_work, - .get_phys_addr_attrs_debug =3D arm_cpu_get_phys_addr_attrs_debug, + .translate_for_debug =3D arm_cpu_translate_for_debug, .asidx_from_attrs =3D arm_asidx_from_attrs, .write_elf32_note =3D arm_cpu_write_elf32_note, .write_elf64_note =3D arm_cpu_write_elf64_note, diff --git a/target/arm/cpu.h b/target/arm/cpu.h index b1563a4d43..6fd7c4bd30 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1233,9 +1233,6 @@ extern const VMStateDescription vmstate_arm_cpu; void arm_cpu_do_interrupt(CPUState *cpu); void arm_v7m_cpu_do_interrupt(CPUState *cpu); =20 -hwaddr arm_cpu_get_phys_addr_attrs_debug(CPUState *cpu, vaddr addr, - MemTxAttrs *attrs); - typedef struct ARMGranuleProtectionConfig { /* GPCCR_EL3 */ uint64_t gpccr; diff --git a/target/arm/internals.h b/target/arm/internals.h index a632584a4e..81b2973b20 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1540,6 +1540,10 @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t ad= dress, =20 void arm_log_exception(CPUState *cs); =20 +/* Implementation of SysemuCPUOps::translate_for_debug */ +bool arm_cpu_translate_for_debug(CPUState *cs, vaddr addr, + TranslateForDebugResult *result); + #endif /* !CONFIG_USER_ONLY */ =20 /* diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 8be6f243e6..cc7f78c329 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -3922,8 +3922,9 @@ bool get_phys_addr(CPUARMState *env, vaddr address, memop, result, fi); } =20 -static hwaddr arm_cpu_get_phys_addr(CPUARMState *env, vaddr addr, - MemTxAttrs *attrs, ARMMMUIdx mmu_idx) +static bool arm_cpu_get_phys_addr(CPUARMState *env, vaddr addr, + TranslateForDebugResult *result, + ARMMMUIdx mmu_idx) { S1Translate ptw =3D { .in_mmu_idx =3D mmu_idx, @@ -3934,26 +3935,31 @@ static hwaddr arm_cpu_get_phys_addr(CPUARMState *en= v, vaddr addr, }; GetPhysAddrResult res =3D {}; ARMMMUFaultInfo fi =3D {}; - bool ret =3D get_phys_addr_gpc(env, &ptw, addr, MMU_DATA_LOAD, 0, &res= , &fi); - *attrs =3D res.f.attrs; + bool fault =3D get_phys_addr_gpc(env, &ptw, addr, MMU_DATA_LOAD, 0, &r= es, &fi); =20 - if (ret) { - return -1; + if (!fault) { + /* translation succeeded */ + result->physaddr =3D res.f.phys_addr; + result->attrs =3D res.f.attrs; + result->lg_page_size =3D res.f.lg_page_size; } - return res.f.phys_addr; + return fault; } =20 -hwaddr arm_cpu_get_phys_addr_attrs_debug(CPUState *cs, vaddr addr, - MemTxAttrs *attrs) +bool arm_cpu_translate_for_debug(CPUState *cs, vaddr addr, + TranslateForDebugResult *result) { ARMCPU *cpu =3D ARM_CPU(cs); CPUARMState *env =3D &cpu->env; ARMMMUIdx mmu_idx =3D arm_mmu_idx(env); =20 - hwaddr res =3D arm_cpu_get_phys_addr(env, addr, attrs, mmu_idx); - - if (res !=3D -1) { - return res; + /* + * Note that this function returns true on translation success, + * but arm_cpu_get_phys_addr() and all the other get_phys_addr + * style functions in this file return true on failure. + */ + if (!arm_cpu_get_phys_addr(env, addr, result, mmu_idx)) { + return true; } =20 /* @@ -3964,11 +3970,12 @@ hwaddr arm_cpu_get_phys_addr_attrs_debug(CPUState *= cs, vaddr addr, switch (mmu_idx) { case ARMMMUIdx_E10_1: case ARMMMUIdx_E10_1_PAN: - return arm_cpu_get_phys_addr(env, addr, attrs, ARMMMUIdx_E10_0); + return !arm_cpu_get_phys_addr(env, addr, result, ARMMMUIdx_E10_0); case ARMMMUIdx_E20_2: case ARMMMUIdx_E20_2_PAN: - return arm_cpu_get_phys_addr(env, addr, attrs, ARMMMUIdx_E20_0); + return !arm_cpu_get_phys_addr(env, addr, result, ARMMMUIdx_E20_0); default: - return -1; + /* translation failed */ + return false; } } --=20 2.43.0 From nobody Sat May 30 19:22:59 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1777542247; cv=none; d=zohomail.com; s=zohoarc; b=mT/+8dTp7TpPWbxLlnnm7txTnJkge5XH6srMV72+q8JMX5G8Dthky/4qM5wsEr77ZU3H1Ar2J7/dtrtY5gvdR2YHfnEvvbxSXsOfsVaRihukRORSnnkhDIMpmK7SycK7rtms/PKxI2DUkDpw4XimKOF1HCrkPSSvYI3WgAHbuac= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777542247; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ZNtoNR8zwSaxp92UruVR20bb34aPvKjX5U1Njv0t9eU=; b=dXnAUpiu1k62ZjtrhprBVzISGiubAwEgH2YHWaojE+15oP+hjExTDSBKTETtTn7Dta1PCUYKe8TM2ee0ci4gTtS1R7HsNrCh4bbXIsX+yDliCknj70gnFUujk0fej5bfyyniYv9E4gVOzwEHkSOkk9zIV368LH3WlcTsgiopvao= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777542247556934.9818161099791; Thu, 30 Apr 2026 02:44:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wINrH-0005Pr-Vx; Thu, 30 Apr 2026 05:39:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wINrB-0005Ac-KW for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:53 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wINqy-0002kL-7m for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:53 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-488e1a8ac40so6808405e9.2 for ; Thu, 30 Apr 2026 02:38:36 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-447b421721fsm10816795f8f.15.2026.04.30.02.38.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 02:38:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1777541916; x=1778146716; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZNtoNR8zwSaxp92UruVR20bb34aPvKjX5U1Njv0t9eU=; b=dwHdPbSmuiYdOi55FdKawJhr7wyiK4UdY2WY2ukR6+CYKlEHqzbx3oxi6lqwuDU6bB t7f7Ho0zNHAHBH5u2JP5p11EZMlg+L28lW1ZyYDPYEogmiXuGs9bc+XOMryBYsgNiv0T 1CTErAMovwkLuySD1B7vgf8MCKtkrBERt2F82xOX1UGWNp+FWs+5CwUHgTf5rIiujp41 vY1a0AKs7YJwk6Wbz1wQxV7i4znDUCuWtSZFyvTCmGEDxQDEM3A6Lr41SdXQqiLw98tD dYsVGMQYabqRPEAtGn0XDRXaHQGswmXOOrH2i4xAQR6HDt0R2ZKLF9E/QVEBZ0Y/cHy/ 6dmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777541916; x=1778146716; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ZNtoNR8zwSaxp92UruVR20bb34aPvKjX5U1Njv0t9eU=; b=p6S/vNgsz5F3gIHBPj6TDmvwzOlQUooKKYEKg/PHpuO+4Dw/IjSj578p96lQDVvOh8 PDvC3qwdB75VppWqnNjYWY4ZogAA/EN0cP60Rw1huPLaXT6Lz6/g6HeZpS2edH4cNyM4 e6ETIp1vBFRw0rmD5H6owlhsQgilAZiTby1HSwPHK2TF+2nF4uxqsD2ggs7G0q1ek98L hRikmE7ZkF+waQHewiwJNsLsJhITWckNTTBL7qw846TEFEDpYUyl1OEU49Abnq4/cEkr oQ2P0RyfYwmLZzkWGMN2A3ioAXB/wPSSO0eGCZj0lPi/T4aPf9m6e3yO4QOC5+1fr+R1 T76A== X-Gm-Message-State: AOJu0Yzh5QI3ErSQclq4oKISgLbP0gAuvQ0omQB87C+0Bg+0Xmg/anxi LnLC7X5WiUwovjrDcBEaNjJ8wnuCuk+56lFXid7pI5LtrAgjqi9TVjIfCYsCYygZ9iXR3Pkpbbi 2H/QK X-Gm-Gg: AeBDieuajgj3QwvECA72OZWZBPgMqknQqa5NrAB7DgcU241zGDmIbT+dh8SioiiwqpT hI2U3zYxiZd9lHRgzyV8p/S0aKWuJ8B/waJLMlEvbuxTfjI5By0BCnrfRkytIdmT801PjLjkCbK k59JdStqX0vm5U2sVTpRY/8miH0UYrEyPZDSMmy9FpVbm21hCu2g/32Oi5mWqQjb+zU2vXBZrqw vUS9N4HLozlZAtkrOowS2BfnNKjE67sP3yMUZ86+dmL0cxisn60tlyQWirDHQ3UWnydgbJDAKUP Bws9G825j72wTtzhfOQSpVK4sorca4V/Q2ceEOlwHbMdyouaj8DyCRQbpQmG0gx+LUSyZ9CSVun xymJnO/UhbdAMWoPp3Pcb6LuQc2HvMmWp12zdrX0potJBcM8mAwQKhLRQT4GR80cldRCJTBmybg ddcr5nN8TiJ0ZizZXM5fteopo5HF/VrlBdpIM2EnaOna8ME37m/LSHWfdKiPba35ll7InVUg6S2 0BcCGhVX/FLPWyK+NqBK80N2PQOpBm883w1BnkJEQ== X-Received: by 2002:a05:600c:4fc8:b0:488:ffad:6728 with SMTP id 5b1f17b1804b1-48a84451ac5mr37835485e9.19.1777541915355; Thu, 30 Apr 2026 02:38:35 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Yanan Wang , Zhao Liu , Paolo Bonzini , Richard Henderson , "Dr. David Alan Gilbert" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour , Peter Xu , "Edgar E. Iglesias" , Jiaxun Yang , Nicholas Piggin , Chinmay Rath , Glenn Miles , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Ilya Leoshkevich , David Hildenbrand , Mark Cave-Ayland , Artyom Tarasenko , Max Filippov Subject: [PATCH v2 18/25] system/physmem: Use translate_for_debug() in cpu_memory_rw_debug() Date: Thu, 30 Apr 2026 10:38:03 +0100 Message-ID: <20260430093810.2762539-19-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260430093810.2762539-1-peter.maydell@linaro.org> References: <20260430093810.2762539-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, 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 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 @linaro.org) X-ZM-MESSAGEID: 1777542248853158500 Content-Type: text/plain; charset="utf-8" Currently cpu_memory_rw_debug() assumes page-granularity for translations, and it works in a loop where each iteration translates for the vaddr rounded down to a page boundary and then copies up to the end of the page boundary. Rewrite it to use the new cpu_translate_for_debug(): we no longer want to round down the input address, and the boundary we copy up to is now determined by the lg_page_size it returns rather than being assumed to be page-sized. This, together with the implementation of translate_for_debug for Arm targets, fixes the bug where semihosting would incorrectly fail to access parameter blocks that were in memory where the start of the 4K region they were in was inaccessible due to MPU region settings, even if the parameter block itself was readable. Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3292 Signed-off-by: Peter Maydell Message-id: 20260417173105.1648172-18-peter.maydell@linaro.org Acked-by: Peter Xu Reviewed-by: Richard Henderson --- system/physmem.c | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/system/physmem.c b/system/physmem.c index 652b03ad5f..7bcbf87573 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -4030,28 +4030,38 @@ address_space_write_cached_slow(MemoryRegionCache *= cache, hwaddr addr, int cpu_memory_rw_debug(CPUState *cpu, vaddr addr, void *ptr, size_t len, bool is_write) { - hwaddr phys_addr; - vaddr l, page; uint8_t *buf =3D ptr; =20 cpu_synchronize_state(cpu); while (len > 0) { int asidx; - MemTxAttrs attrs; + TranslateForDebugResult tres; MemTxResult res; + hwaddr blk_base, blk_size, l; =20 - page =3D addr & TARGET_PAGE_MASK; - phys_addr =3D cpu_get_phys_addr_attrs_debug(cpu, page, &attrs); - asidx =3D cpu_asidx_from_attrs(cpu, attrs); - /* if no physical page mapped, return an error */ - if (phys_addr =3D=3D -1) + if (!cpu_translate_for_debug(cpu, addr, &tres)) { + /* Return error if no physical page mapped */ return -1; - l =3D (page + TARGET_PAGE_SIZE) - addr; - if (l > len) - l =3D len; - phys_addr +=3D (addr & ~TARGET_PAGE_MASK); - res =3D address_space_rw(cpu->cpu_ases[asidx].as, phys_addr, attrs= , buf, - l, is_write); + } + asidx =3D cpu_asidx_from_attrs(cpu, tres.attrs); + /* + * Clamp the amount we read to not go beyond a page even if + * the CPU returned a larger lg_page_size, in case this access + * is to a memory-mapped IO region. + */ + tres.lg_page_size =3D MIN(tres.lg_page_size, TARGET_PAGE_BITS); + /* + * Find the length in bytes from tres.physaddr to the end of the + * block whose size is 1 << tres.lg_page_size; we will access + * that much in one go. + */ + blk_size =3D 1ULL << tres.lg_page_size; + blk_base =3D ROUND_DOWN(tres.physaddr, blk_size); + l =3D blk_base + blk_size - tres.physaddr; + l =3D MIN(l, len); + + res =3D address_space_rw(cpu->cpu_ases[asidx].as, tres.physaddr, + tres.attrs, buf, l, is_write); if (res !=3D MEMTX_OK) { return -1; } --=20 2.43.0 From nobody Sat May 30 19:22:59 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1777542153; cv=none; d=zohomail.com; s=zohoarc; b=gP3ZJB0m1awvSiM8zJc+qXD/dMBXGDDYD3mBMJtKJ/nsyEOIDl43sO55Cyy3s2LYFa9w+BAs7WJ620EN12t46YFCh+dnWC9lQSs+YW+vl1l+rNevQgjAqZiYNpTmicv8scByBrHOzg7JpXA8/olNQ6Ka1CWO1FLhIWh2TabCivI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777542153; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=R4M1+8MaNJJPZqDo1tunWUHC1iAqc51w+I18EtZXKXs=; b=jzYo34rkuJpdmMy1TgqBH8Vo/hAGvgAVOo1WmsFlsv8+Kzdc6RS1Ekh0iMh8SXUhWez1iCzE3X7oMqjwupAzkEH06z4aQWVS9epcE98o06f+qNSyy12EwhVYV7/Gp+UIivzLpTnVKr3tdlYMgksrTI9+XDBsu3N+8sP7mWB6QMA= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777542153240345.92578192897054; Thu, 30 Apr 2026 02:42:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wINrG-0005OJ-W1; Thu, 30 Apr 2026 05:38:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wINrA-000587-Qc for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:52 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wINqy-0002lx-7w for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:52 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-43d73422431so625125f8f.2 for ; Thu, 30 Apr 2026 02:38:37 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-447b421721fsm10816795f8f.15.2026.04.30.02.38.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 02:38:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1777541917; x=1778146717; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=R4M1+8MaNJJPZqDo1tunWUHC1iAqc51w+I18EtZXKXs=; b=kLCoc72uPLbYaNNZNYJN/9cIVYu0BYkw4FcdmysF1s6fTH4ufhczaAzLP8BJLvae5b GBUYpXA3ODqy353LtujKBjOXIZT1Pxcb0O8QcDxcpsE64pN2Iwuigr5Mv5cFFWglTk3S dR3W2e/rb1mUUzVAgKfooNX9/43pC0rrwLDd5F5qjgDY0FFhlW7Qm6IkPHtu3HZLkM4T 4+gnY8yCdl1am7oYBvjTkROhJ40qh4m77FCqCFqaC6wN49Q7p0v73DEip2OxpW0b4uBO ah/uqTYTKqwbMfXXkXkPBMoBEvuB0GeOwibYw4Sb4js0ofukj0PX68HLQWnqUMg6Ajgx XkiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777541917; x=1778146717; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=R4M1+8MaNJJPZqDo1tunWUHC1iAqc51w+I18EtZXKXs=; b=tDKBdjskbEQtPMEDR5U1icQv4xMRxF8+d2DeyoN7CtKYIiBpoLyi5AQxCDTfGzf8Cr 0o8jt/OwHOLHN6D33o8KLrqzrvQx3J5vh2KZoEMS/lBKNKQDMC4nA3cSZySW0YkKYI/e IllazV3d8KPjca6v4sNrQ0SiP/HOdiyXE+jqBHEcRQ0QnSxGmx9DF6VcVf+iTD2ks4sN oG0qzlA2cFz3ocHnx/7jzxzQTGTr+z/VsdIwdPar7R/4M0AWoZxty04HY6KMtcrjZLwd itulzeHJXOCAOLdqhj/AGHabWPfBFUucOmrMYcDicAPQufmbMqLo1+OmzUAPxi3wrbtR 7YEA== X-Gm-Message-State: AOJu0YxXGm7ZMzmd7PeBX609QS9Pr5Zdy1h4lcqiUzEBb/xXaQxDguUz 7yoWVY6z+D0FMA22ZJ2RCxSGKOaC4iTpjlR9Ogum58c1Q6mxZqjyD5bxE61Oj0gpX4qeFhuXckU U5Fmo X-Gm-Gg: AeBDieso/heGWuRPzbpumoEGm1FDjeqn4f+e760UWMDbmgKT0GnMfQFU4nIKSNS4ZG4 flHul5sewzVgEiBKYacNJhKotLgnrr5IZYQElr70AzHqH9i320XJI2v6SY89a/5HpB+t+lwszqP iTEczDCSHzEDIdm4t9dJk+gMVVrFd0cVLJZSNgxWWeKcga6po1GxNIuWRUiT7EbwPz1i8c7kSlZ 3hQRv4lEJ1IQq+0kvKfJHOyU61hD6dBf2g+uwD/J7lvJkRPZLXEqUb3YnTr/aGjAvfg4LdpLtvW 374e8Ua+kQNc3FbmzzX0GMqCAfJyxHNEqAI4vNDg3DJoHxt1xKAaQ4CCOJx6apK9sMuG+C7Yqo4 SuINZUu8xfXZTEtuBdDqnKpoYu/jBd2xtCaqHYMz0PuIPssh0/SLJYOkQLrk8Kz/4iENoFEJuWm fAqjBvMUnhmmJPAq6GdXBDkFmW+qQKO+NTwnh9jOw4M9F/VMtNj6meXJksKF4zr+XGgz8kHS3sw sLXVgVEmTUUgSXy94GbXe1fOttFLdSJddWLf6zb9g== X-Received: by 2002:a5d:5f44:0:b0:43c:ff58:35c3 with SMTP id ffacd0b85a97d-4493d02aaa6mr3458793f8f.10.1777541916662; Thu, 30 Apr 2026 02:38:36 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Yanan Wang , Zhao Liu , Paolo Bonzini , Richard Henderson , "Dr. David Alan Gilbert" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour , Peter Xu , "Edgar E. Iglesias" , Jiaxun Yang , Nicholas Piggin , Chinmay Rath , Glenn Miles , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Ilya Leoshkevich , David Hildenbrand , Mark Cave-Ayland , Artyom Tarasenko , Max Filippov Subject: [PATCH v2 19/25] hw/i386/vapic.c: Use cpu_translate_for_debug() Date: Thu, 30 Apr 2026 10:38:04 +0100 Message-ID: <20260430093810.2762539-20-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260430093810.2762539-1-peter.maydell@linaro.org> References: <20260430093810.2762539-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42a.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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, 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 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 @linaro.org) X-ZM-MESSAGEID: 1777542154248154100 Content-Type: text/plain; charset="utf-8" We would like to remove the cpu_get_phys_addr_debug() function, by moving all callers to cpu_translate_for_debug(). Update the callsites in vapic.c. In the process we can drop the old "OR the page offset back in" workaround that we had for when cpu_get_phys_page_addr() returned the physaddr of the page base rather than the exact physaddr of the input virtual address. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/vapic.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/hw/i386/vapic.c b/hw/i386/vapic.c index 225f19a75c..781bf2a7fa 100644 --- a/hw/i386/vapic.c +++ b/hw/i386/vapic.c @@ -161,7 +161,6 @@ static void update_guest_rom_state(VAPICROMState *s) static int find_real_tpr_addr(VAPICROMState *s, CPUX86State *env) { CPUState *cs =3D env_cpu(env); - hwaddr paddr; target_ulong addr; =20 if (s->state =3D=3D VAPIC_ACTIVE) { @@ -173,8 +172,10 @@ static int find_real_tpr_addr(VAPICROMState *s, CPUX86= State *env) * virtual address space for the APIC mapping. */ for (addr =3D 0xfffff000; addr >=3D 0x80000000; addr -=3D TARGET_PAGE_= SIZE) { - paddr =3D cpu_get_phys_addr_debug(cs, addr); - if (paddr !=3D APIC_DEFAULT_ADDRESS) { + TranslateForDebugResult tres; + + if (!cpu_translate_for_debug(cs, addr, &tres) || + tres.physaddr !=3D APIC_DEFAULT_ADDRESS) { continue; } s->real_tpr_addr =3D addr + 0x80; @@ -292,6 +293,7 @@ static int update_rom_mapping(VAPICROMState *s, CPUX86S= tate *env, target_ulong i hwaddr paddr; uint32_t rom_state_vaddr; uint32_t pos, patch, offset; + TranslateForDebugResult tres; =20 /* nothing to do if already activated */ if (s->state =3D=3D VAPIC_ACTIVE) { @@ -305,11 +307,10 @@ static int update_rom_mapping(VAPICROMState *s, CPUX8= 6State *env, target_ulong i =20 /* find out virtual address of the ROM */ rom_state_vaddr =3D s->rom_state_paddr + (ip & 0xf0000000); - paddr =3D cpu_get_phys_addr_debug(cs, rom_state_vaddr); - if (paddr =3D=3D -1) { + if (!cpu_translate_for_debug(cs, rom_state_vaddr, &tres)) { return -1; } - paddr |=3D rom_state_vaddr & ~TARGET_PAGE_MASK; + paddr =3D tres.physaddr; if (paddr !=3D s->rom_state_paddr) { return -1; } --=20 2.43.0 From nobody Sat May 30 19:22:59 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1777542115; cv=none; d=zohomail.com; s=zohoarc; b=ILCBjK/8Cgnm1uigggzLqSC86waU2SmaNtaCbq3DVjsTePg5cXIkprZbk7DbooiRkcAeyCDbDXiQSWzoiADpvpbkikx1dHkSQTYSjJjjp/r9jUqaYTouuf3jt5oDjBnywSRM2TehLSjbUk0lbkBnXkkmrIgb56qPGFEm5MmUbXc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777542115; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=WDQ7la2K8WbK8u2/23ch5pBkMkaDcwKmzot+lA8IzKQ=; b=mpafcn0pDyCkWzbmV9Vb+H8Yt/MespAlWKf6uFWyvchb14b41V++lSAFLw7O4rRDCjwpTcXc2XPQx3cSWnwRZE1XF0AUtp77jGDMUdaJXCIpe8GV23HU1+9Dp7HMIif4E0aZwBb2XE/AXOBsTCHAKPcXLPV4nupS8D5LE8BJKqk= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777542115670404.0195473302954; Thu, 30 Apr 2026 02:41:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wINrF-0005LC-IW; Thu, 30 Apr 2026 05:38:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wINrA-00055N-7a for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:52 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wINqy-0002mP-72 for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:51 -0400 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-43d73352cf2so612491f8f.1 for ; Thu, 30 Apr 2026 02:38:39 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-447b421721fsm10816795f8f.15.2026.04.30.02.38.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 02:38:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1777541918; x=1778146718; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WDQ7la2K8WbK8u2/23ch5pBkMkaDcwKmzot+lA8IzKQ=; b=pdNILHMJZ7QVh0cmQ6Y6dadwjvmv63QU75CS7bYaPTq8IkSxG9BxEg93lhFBL7+0mh zGa8XhGMK+TbUcPplaSDcxOjQ3qt4ENXLid7WNgb8FeHulS9+1jj8jBo+owRLU8xHLtV GKDVN8pF847wC5Y1nE9vNuDR8tqgNgAfmgKqpuOcJhlsEiGDozPwlQvTo/+jY0hOOWgd r66FXpy5Aw3y3E4+M2dSNCO+03hLUdljAHNYrvD7CsOJrD3ndhnK8289YdWyhBgtXI5u CYX4YPkLLzIEcKz5PoEOUqgW6nU/Mx5OYEgzVXBxxcL5qZC17y4g0dEtSprjY2vZKogo GEFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777541918; x=1778146718; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=WDQ7la2K8WbK8u2/23ch5pBkMkaDcwKmzot+lA8IzKQ=; b=FrsOqQW4rlxZlYLxi3G2YGDkzuMOlr7pEpN7jXMqfX6d11tRsmM7qAj5y85PmoAIXH ktto5/7ggY2285Q9Oo2lqUWHnHpEse4/LqPsaMUWkBwlIQcQSpmUjqkYbiuPR0KnEaiX joE3FOk+cAeFPtEGz1tf3CtxaFzZI8huVhtNS/gW5JkVzQn490ERO4+JSQ16nn51YXvN eL3N8qvdspWwqXkPgs6mZEneRHe3s4kYVtMDjmD4ipK+GQMLM7dG4jTrMaQLe3ifrLnw qE5tLq1AQXTVJOjmeavnk9LNeIk3jAhIvvo2Jmcw95OahwogzAJxrDnqog721vIV9FiJ 3Ufg== X-Gm-Message-State: AOJu0Yxfh9TvEgqWOOPzRig07jlFbw4Kp0Uc23VwEuqTVab8l289Rn7P SAEq7WOrpEFYpaOY26iPx8uEYc+1X5A5+wUJGHvy9RrVzPyHGg1kF+YUoWhvYt1Xdp2DSiES18N VF8xP X-Gm-Gg: AeBDiesj3x/9Z9Sqid//XlXi7OOyomYinYciv2D66YrXR3sEperPFNPhtG1zorSunEQ YBFR6I3zGgHpppTF8ppGvfpv8v3Bhi1/Xuv+F6bVIgcFPQp52JXrjhzmQE9Zl2kCPEXxcKsQySU v2XkDuE12GH4vbuUlHyFWvsRZ+m6cm2UXnBnA4faVkNN3rDC4NrIMiYuPvHQNvgNiDxW/tGjEFs WzIb5fh5ru71HtzVtsfgx3jKOystLEBhWrqLv0QSXxvE0IUpvmYKp5i6pFbMwpSQ5q64AVau62W mbqjqFkh+9BZDJhRd80fvwC+xPY4130G4/jCRPTO6M/genWjnDTBEN1pabUIlz2F/l140JvpoKX ULiwE0QNVg03XLrbFURwax02I+63izNnhVA0kEm2rTgqOTChl8M0B01Q0bROCFwxM6EDGXVLvc8 fEQC9Nta1s09kdLvY70zOnggfKKDycpsWU+6ZFknTTBlvbIW6t9vD0rk2PR0xl1v6tuHw02KxX+ 8iYDmx+00oB5QN4Yi47cdTXNLn1kgHNhVsU15fwAQ== X-Received: by 2002:a05:6000:2585:b0:43b:498f:dceb with SMTP id ffacd0b85a97d-4493c37ef0cmr3506822f8f.9.1777541917911; Thu, 30 Apr 2026 02:38:37 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Yanan Wang , Zhao Liu , Paolo Bonzini , Richard Henderson , "Dr. David Alan Gilbert" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour , Peter Xu , "Edgar E. Iglesias" , Jiaxun Yang , Nicholas Piggin , Chinmay Rath , Glenn Miles , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Ilya Leoshkevich , David Hildenbrand , Mark Cave-Ayland , Artyom Tarasenko , Max Filippov Subject: [PATCH v2 20/25] target/sparc: Use cpu_translate_for_debug() Date: Thu, 30 Apr 2026 10:38:05 +0100 Message-ID: <20260430093810.2762539-21-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260430093810.2762539-1-peter.maydell@linaro.org> References: <20260430093810.2762539-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42c.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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, 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 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 @linaro.org) X-ZM-MESSAGEID: 1777542119467154100 Content-Type: text/plain; charset="utf-8" We want to remove the cpu_get_phys_addr_debug() function; update the sparc dump_mmu() function to use cpu_translate_for_debug() instead. The "mmu_probe succeeds but debug translate fails" cases are probably not possible in practice; since cpu_get_phys_addr_debug() would return -1 in that situation we make this conversion retain that behaviour. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/sparc/mmu_helper.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/target/sparc/mmu_helper.c b/target/sparc/mmu_helper.c index e1abd520c4..e441ffb8f7 100644 --- a/target/sparc/mmu_helper.c +++ b/target/sparc/mmu_helper.c @@ -360,26 +360,39 @@ void dump_mmu(CPUSPARCState *env) unsigned int n, m, o; hwaddr pa; uint32_t pde; + TranslateForDebugResult tres; =20 qemu_printf("Root ptr: " HWADDR_FMT_plx ", ctx: %d\n", (hwaddr)env->mmuregs[1] << 4, env->mmuregs[2]); for (n =3D 0, va =3D 0; n < 256; n++, va +=3D 16 * 1024 * 1024) { pde =3D mmu_probe(env, va, 2); if (pde) { - pa =3D cpu_get_phys_addr_debug(cs, va); + if (!cpu_translate_for_debug(cs, va, &tres)) { + pa =3D -1; + } else { + pa =3D tres.physaddr; + } qemu_printf("VA: " TARGET_FMT_lx ", PA: " HWADDR_FMT_plx " PDE: " TARGET_FMT_lx "\n", va, pa, pde); for (m =3D 0, va1 =3D va; m < 64; m++, va1 +=3D 256 * 1024) { pde =3D mmu_probe(env, va1, 1); if (pde) { - pa =3D cpu_get_phys_addr_debug(cs, va1); + if (!cpu_translate_for_debug(cs, va1, &tres)) { + pa =3D -1; + } else { + pa =3D tres.physaddr; + } qemu_printf(" VA: " TARGET_FMT_lx ", PA: " HWADDR_FMT_plx " PDE: " TARGET_FMT_lx "\n", va1, pa, pde); for (o =3D 0, va2 =3D va1; o < 64; o++, va2 +=3D 4 * 1= 024) { pde =3D mmu_probe(env, va2, 0); if (pde) { - pa =3D cpu_get_phys_addr_debug(cs, va2); + if (!cpu_translate_for_debug(cs, va2, &tres)) { + pa =3D -1; + } else { + pa =3D tres.physaddr; + } qemu_printf(" VA: " TARGET_FMT_lx ", PA: " HWADDR_FMT_plx " PTE: " TARGET_FMT_lx "\n", --=20 2.43.0 From nobody Sat May 30 19:22:59 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1777542218; cv=none; d=zohomail.com; s=zohoarc; b=lxiH1SZ4fcMdOtlIuADXfLl43z15o7d4LYgG+FfRl0/kmKihzzb8bkVn62GdBjcA84KY7krsFQgFb3MtA1eH16p/MZee2uB4TT9F+07B46dQ5OKZlFwPRRJnTisHlDQ3v9PU4AU5jq2G2+i1ISlcRCmXizkewIWJMTQxXbUBZ5c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777542218; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=xL8OwV5x8S3IokvAE6V255e7vRqVHIthpETVqBABDt4=; b=WCSjynIKg2zksUXIVFZIMmP2GKd6NmBV5oWU/l8VKGQ3DJW6J6lQw4R3XlneILOxGjq0233OmxB9tO5Pbf6dQPYI3CovJuwyD2sELWVi7o6fAFDebFz3dI3MovgaECisLmHlPUrHw1u/hef817E5G8/ujNK5B7QNmmrp4AOW8uA= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777542218832667.735525549449; Thu, 30 Apr 2026 02:43:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wINrJ-0005Tn-9I; Thu, 30 Apr 2026 05:39:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wINrD-0005DC-1R for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:55 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wINqz-0002nC-Nk for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:54 -0400 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-43d76dd4ee8so575099f8f.2 for ; Thu, 30 Apr 2026 02:38:40 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-447b421721fsm10816795f8f.15.2026.04.30.02.38.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 02:38:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1777541919; x=1778146719; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xL8OwV5x8S3IokvAE6V255e7vRqVHIthpETVqBABDt4=; b=ozdklPecS9+5OuP1UBCB1EPBCjkDYOAsGNGfHVCE9WVnJVJSKIeW+fMHh86oxHFJdB nvkVLUwVztXS5ABkLitxyRNGn5mPCkkkAymX+x1q7JcGYEKTRqIveE297sbFbIfU6jVD 8aEOXxIlDLI8zOvrFstuRexAgpztTCqyoHUn+I3cyOkfolimWR9b6dcEY0OS/+h1oyjB tjlZehJhvKxZbIBGhMeLybZe/BzqKgfZCr+fRmkUwffoOvTYcnLNRzn9sqEkl8boUysT QoW9esrz5IwoftVQoW56x4u9n8pGGnlzyodjbh49LxuD5R/C7OcLK3zlV9MbgcnunbYH imNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777541919; x=1778146719; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=xL8OwV5x8S3IokvAE6V255e7vRqVHIthpETVqBABDt4=; b=JtS1PH/zw4Bz7b8F7mx+dAKVdAzmdSypYHL+HUxNriYDynxtIE2GBKjI6rUNHviv3O etvIhC0nKJyK+Q+IUP/k53kCmGRM4Pwh4xlZfp+awkhJsH6xRB4xYU0Ud/dBIKxbpRVo l1fAG/KWRxjhS1UyUkxuj4DAXXCMgP6/dCExFP0BDbpnmb9mqSII0jwdkZedcYRlEdnJ MTPke3NWl6/kd78EDacAXU5OQiDHHUQycBHIA1pv2A3rFsAjm7f9HapOuu4Ugm0wVVFH A7hBp28mV1B8yOEjtI12gvEajYfm9a3x7GW7FXpuiWkjyvfIEKTiKwFkUsUyc9yc2O79 bFXQ== X-Gm-Message-State: AOJu0YzGmWfQVOdEX1N798EDCZA41nsGE6m48KOeIQZb0mSkUBJzsD0Q EptlgcftCJLDqquXV9npXhvbvuBho/Tbp90FrXx71u0TNKQM4x/cBWyFBNGOkP+KKYGQ9YmpMYs wLCZw X-Gm-Gg: AeBDiev5oP88qeqy3BgYOs6DfhX/iu+4Z6QoEdH9GxC9GjSAkA3g0nSHXmlCHTb6w5W ZcKaoknlT4bTWHxvl/JNQCa12fC6z7eJhrwZHer03m2n1SnDYUGt4Ag7GgaFj57sUQm89XNuNkW WQi+ZDR0yJd3heJwvomMVFpq11YOK4hGfgDgUXVO+GNcvX+7n2JSAQDyEYyVUGMaXQAUI8aIUmZ hgr4Qd99shSw0CUamMRn0rixI7GxVzGV7KUX4vC1VJp/npYjq2L7f96Zs0xb/Ya92a6jRC3A2RC snwG4KwMDMQGBv8jcSKk6Apxy96zviWMDNmh6KKaz2wFxg6uBMSB2zfJb5ScBj92DU1HtGJuiU8 MxxFeDzXFZH2XKPI18vp5wR9I5MgZtOfRsgbQzua2u8ILBrihUNIIvoLmkNiO+UPgtdmptAnpX5 WQLiaCt9P9upJXETNQIIVxLcZkxW14KzKViTAmJlOLystJ/iZvB/+UyFSg+d1jbIKd/j8h6rf5t GxMd/ECZZshwaP+Lhnq5GjrmsVZOJck36CCNO0CBA== X-Received: by 2002:a05:6000:144b:b0:43d:7e6f:3816 with SMTP id ffacd0b85a97d-4493f42c2c2mr3374636f8f.40.1777541919166; Thu, 30 Apr 2026 02:38:39 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Yanan Wang , Zhao Liu , Paolo Bonzini , Richard Henderson , "Dr. David Alan Gilbert" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour , Peter Xu , "Edgar E. Iglesias" , Jiaxun Yang , Nicholas Piggin , Chinmay Rath , Glenn Miles , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Ilya Leoshkevich , David Hildenbrand , Mark Cave-Ayland , Artyom Tarasenko , Max Filippov Subject: [PATCH v2 21/25] hw/xtensa: Use cpu_translate_for_debug() Date: Thu, 30 Apr 2026 10:38:06 +0100 Message-ID: <20260430093810.2762539-22-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260430093810.2762539-1-peter.maydell@linaro.org> References: <20260430093810.2762539-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42d.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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, 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 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 @linaro.org) X-ZM-MESSAGEID: 1777542220492158500 Content-Type: text/plain; charset="utf-8" We want to remove the cpu_get_phys_addr_debug() function; update the xtensa boards to use cpu_translate_for_debug() instead. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- hw/xtensa/sim.c | 6 +++++- hw/xtensa/xtfpga.c | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/hw/xtensa/sim.c b/hw/xtensa/sim.c index 32eb16442f..835cd04fe0 100644 --- a/hw/xtensa/sim.c +++ b/hw/xtensa/sim.c @@ -40,8 +40,12 @@ static uint64_t translate_phys_addr(void *opaque, uint64_t addr) { XtensaCPU *cpu =3D opaque; + TranslateForDebugResult tres; =20 - return cpu_get_phys_addr_debug(CPU(cpu), addr); + if (!cpu_translate_for_debug(CPU(cpu), addr, &tres)) { + return -1; + } + return tres.physaddr; } =20 static void sim_reset(void *opaque) diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c index 256497e162..33a2d9485c 100644 --- a/hw/xtensa/xtfpga.c +++ b/hw/xtensa/xtfpga.c @@ -191,8 +191,12 @@ static PFlashCFI01 *xtfpga_flash_init(MemoryRegion *ad= dress_space, static uint64_t translate_phys_addr(void *opaque, uint64_t addr) { XtensaCPU *cpu =3D opaque; + TranslateForDebugResult tres; =20 - return cpu_get_phys_addr_debug(CPU(cpu), addr); + if (!cpu_translate_for_debug(CPU(cpu), addr, &tres)) { + return -1; + } + return tres.physaddr; } =20 static void xtfpga_reset(void *opaque) --=20 2.43.0 From nobody Sat May 30 19:22:59 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1777542304; cv=none; d=zohomail.com; s=zohoarc; b=JlBDsaGR+UWSi+5Lt1nIq4WrF6PP9MqFDzgko6wvWketIG8Wws/Cw5zYqHwasUulbFGMkv9sqZKKqfHfMJOUa6mrt07Q/KJN91valnuuR6O7tvMgawXgbJv7Lj7vBUMPQmMpXr4FUpEFunXxQ6peBYYlQtdcOWOUlLgGFxbIXqo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777542304; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=vtdY7obMueMpd5fltY9RwFbeo9ZZ7O0JQvizv+LAkKE=; b=k+iVzyMhXSmdCXh8Dk1ZC8BZ0gzoR6bYFPwJrxvhhRFLuwEzyE/6oYNhm02Y0HAXSWwv0bOX0cJApBRGiLOJmSeefi8gvFbSPSK9qpWmppbVM/6eKX3SXqLKEPSsPmcfpHxqZ//icBYM1cGlXK5VbySIGpPytqlQxBR0IEU5IUk= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777542304965499.7637520267799; Thu, 30 Apr 2026 02:45:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wINrK-0005Wi-Ef; Thu, 30 Apr 2026 05:39:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wINrF-0005Ki-7D for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:57 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wINr0-0002oU-5x for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:56 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-445795cf6f1so438263f8f.1 for ; Thu, 30 Apr 2026 02:38:41 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-447b421721fsm10816795f8f.15.2026.04.30.02.38.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 02:38:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1777541920; x=1778146720; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vtdY7obMueMpd5fltY9RwFbeo9ZZ7O0JQvizv+LAkKE=; b=fLe45RvtvmVkEnlIjl7r+jNg8ytO+U08qtOi+TJgGs6zpKonyCIMZTR5FfHmEEdn9z O7BHJCiW7QJqB8otZDcDj/0LyNwd2DnhMwtGSxbHs2L0xTc+dEj2MEGh8khJinRi9+c6 QK+lZPnxgpkHsFkTD64av5J/gwTFgm7JRldhD3Ks1zz2a2hRELuCZ0feCLB/UFwskPlD rsnuIsoAZRdoWx61z58flUJSp72HGjlTiI4BZmMwN/PtnB1i6jn4ILkh8xdBfvt7/ujs zFLmEvtD5so8K9IW2ZgdmYXGqu3kSQb4UcFsQzAWYzjMckrH16zflNx9WMFXcPh3HdSD RO/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777541920; x=1778146720; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=vtdY7obMueMpd5fltY9RwFbeo9ZZ7O0JQvizv+LAkKE=; b=IPcfI0CqEgRPhcx/GrUrlDU8mI3nUmMu235PvVu4eBaq6Z/a/bw5it0tt83wwhYNO7 Fe1b5ee0yzvN8PfChClBH8tTOMTi2zNJwQm9Jns59fWKg0TrCKGwxXQbwQssJ3se9kkW Rwm6dqsqqEYkH6XNWM7Mvb/JHN0GZAgLxCd6qPpsTrb9LStgQ5uEfmxtGG4ZJBeADKU0 cuuUGm/jbvNGcusLvPMIfarrhBqMNbJg9kvvzeXQDWx31ZfJ4TtIfWvOczvNTSQbLQfa MjhOMdXrz+6QKqy3wMOsXV9xEeTxMetTvUtPvekyrzPgNTwrjdr1rRAKG1rWKyykrJ89 nESw== X-Gm-Message-State: AOJu0YxFU8aVCFyrGci+pgN8CAyBjIVyeCIQ0DIGlbdA0xYsDTm9W3ek vosZdBxm5VvVNq5Tybl8ZAI9YZXBMOOYV/miRZYZePC7jCIidiXCpm5JEKGul43tR6KDG4tpw3V zY7r9 X-Gm-Gg: AeBDietLu7gqyTuhk+Du47jJh22LJUK3Ai6cSKJtaTkbtIh6aEhdOvvKhq59pcOuMv9 qgddoDpr9IipaHTRSqT4dmKuGEQgNRHXEsPDH8Z1Sfj5luJ3faE0L7cfVRiQvgikvFwZzSNYpZN whxzhOaKsvA1N9sg6C5vCkAe/cTR3Eqdl44TQrmSkT3YOB1kmCldKkSY2YiR3fFXxE9BvxWauY7 OVZtJRS/Tp4GdHB/4X7Ku1Z7DBveVQeJVOGIuCL6W73HeUtyrMrNnVB+7ERUMx0uz3O29E4ZVTE vOjkfh++/dA4lVgmBRQuHEsxVT41jPJMjOKUcR5SRJFF9U1BuCwQP2YxO2SSXDWtlvInKE2KHVb JpAX37QNROAEfnhCbG4BNVVQ4AyeENcctALFAp8OHJbUm4hNVL1yMCltY2z9YyXTE6TwHgy3jvY HwVUH6qqmuI9jCsOYJcrl6XJo3RwmaH7ate/mEjZV7SJK0yk2bfEAp4TdjLc1ifv3h3CBb+WVEw yqZNEk8Aqvi0bQfYEPax3vSlTDiO+6vbQYw4a/S6PlW0mI/esNM X-Received: by 2002:a05:6000:2f8a:b0:43d:7828:1f81 with SMTP id ffacd0b85a97d-449400c5308mr3332206f8f.41.1777541920392; Thu, 30 Apr 2026 02:38:40 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Yanan Wang , Zhao Liu , Paolo Bonzini , Richard Henderson , "Dr. David Alan Gilbert" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour , Peter Xu , "Edgar E. Iglesias" , Jiaxun Yang , Nicholas Piggin , Chinmay Rath , Glenn Miles , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Ilya Leoshkevich , David Hildenbrand , Mark Cave-Ayland , Artyom Tarasenko , Max Filippov Subject: [PATCH v2 22/25] target/xtensa/xtensa-semi: Use cpu_translate_for_debug() Date: Thu, 30 Apr 2026 10:38:07 +0100 Message-ID: <20260430093810.2762539-23-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260430093810.2762539-1-peter.maydell@linaro.org> References: <20260430093810.2762539-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42a.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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, 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 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 @linaro.org) X-ZM-MESSAGEID: 1777542308628154100 Content-Type: text/plain; charset="utf-8" We want to remove the cpu_get_phys_addr_debug() function; update the xtensa semihosting code to use cpu_translate_for_debug() instead. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- target/xtensa/xtensa-semi.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/target/xtensa/xtensa-semi.c b/target/xtensa/xtensa-semi.c index 9a6a9c8b4e..3340bd1d41 100644 --- a/target/xtensa/xtensa-semi.c +++ b/target/xtensa/xtensa-semi.c @@ -215,15 +215,20 @@ void HELPER(simcall)(CPUXtensaState *env) uint32_t len_done =3D 0; =20 while (len > 0) { - hwaddr paddr =3D cpu_get_phys_addr_debug(cs, vaddr); + TranslateForDebugResult tres; uint32_t page_left =3D TARGET_PAGE_SIZE - (vaddr & (TARGET_PAGE_SIZE - 1)); uint32_t io_sz =3D page_left < len ? page_left : len; hwaddr sz =3D io_sz; - void *buf =3D address_space_map(as, paddr, &sz, !is_write,= attrs); + void *buf =3D NULL; uint32_t io_done; bool error =3D false; =20 + if (cpu_translate_for_debug(cs, vaddr, &tres)) { + buf =3D address_space_map(as, tres.physaddr, &sz, + !is_write, attrs); + } + if (buf) { vaddr +=3D io_sz; len -=3D io_sz; --=20 2.43.0 From nobody Sat May 30 19:22:59 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1777542107; cv=none; d=zohomail.com; s=zohoarc; b=NPWPkKhqjvV2cP8JpZsGA/jEsGHwr7lNCf+NBySksksYMMHgnWHPuOP8yTmZX3lJ9HxYhuIJXDUA4qGsLORqQtgdSnflrXMcN6BYWE4CmAIw5JOWu07Lz/M29mvHXidDbB3vd+31a6grPkKFGdobAWp1VFcJbJ9B42MpS8ZQ+KQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777542107; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=WCh2RmxvYZV/ZNYedrXNpgq7MB2RbmztWhGGLEAmQKE=; b=UZUoYq7hWXFW2hQ+7e5GtfzqGGLkPPcLGlIHYe+P6SIEjiPdukGDLDMhvjza65ibINIm4GYgY+cX/0imW/SR/90/ZunB13o1KQsXVZvIHSdyNnFCIBIuSA33nAZdbxT8zawXZojHY5O29D16PN0fGFe0e8EcNxZ1jMkKh0LarFc= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17775421070627.13061294257534; Thu, 30 Apr 2026 02:41:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wINrN-0005cT-7K; Thu, 30 Apr 2026 05:39:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wINrG-0005OS-Ts for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:58 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wINr1-0002q3-Gb for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:38:58 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-48896199cbaso5864465e9.1 for ; Thu, 30 Apr 2026 02:38:43 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-447b421721fsm10816795f8f.15.2026.04.30.02.38.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 02:38:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1777541922; x=1778146722; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WCh2RmxvYZV/ZNYedrXNpgq7MB2RbmztWhGGLEAmQKE=; b=NHMMIryZJ3T0hN38xfIijGnCf6Gw8wVkfFH1I+E29DBm1sJpIJZ0vsF9Dh8o/iKtiC Bd93aGXbK/Js1KG9eRYV61nCmNTDrOWdVB2LNtpBNX+PGIXIJ8olM/IMDOcoP0E2KW7J o7fGSV3UfSEzq/jl+U5whM0poja+AmzweendhOcIcxtiFTq6CEOLAeCf/fSvKwu4+1KZ AwHBRFfb9IyCROYjEf23KbOtv4yvNcdRSOyINrsNNvWyJH8dFldZ1KGQx/4eQ7RviPwt XhafervI6ScriK1YxUG3GuFGgEgc0MgdxnNi9nx2hl1JlBYSsHDi63sdFIqLieuHcJr8 YXPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777541922; x=1778146722; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=WCh2RmxvYZV/ZNYedrXNpgq7MB2RbmztWhGGLEAmQKE=; b=PichawBunTc7aLZokeJBKENYnWMEVqbhcqAa4HezE+NS7AcEXyBC02yysZRrn65ZBz 8LPMsBLo622DG8PpvizFef72hsh1NeeZ73Xd6FLJkaW90wT4Mmew7DgiofNiTF4x/ugn UBhJyYflDWWH//GnMPdzgWI5JfPHNOrwVg82ldUTXtfTRM9atHKwOwfATGl+qBy89lAo KrcGMUuHQvsHD7L6kbYMNjVL6KQ6B/Wsx6tRmXqpPBMjY+mbuEgUMB7Ph+0WP6TBWu3I lgNc5s2T6bjUPtjkOKhDIVGu87T3Xa7q7suVp2cEvC0a3g+W1shxZ7SL6G847qFP5UT+ OSpA== X-Gm-Message-State: AOJu0YxJ7ctCk6CalSHTUIVgFTHyH1PlREycRkpQIu7t2SjodH/eoaFD OhDPZgW9rh+tXI8PplzlGaBYX+Yx3Qs2nkpLcyt4Ue90zfC057Si13Tw/RdNQKmimuOvrnnW1vp fYMLg X-Gm-Gg: AeBDietlUwwMqjoiKHEn8Zkwko+EAbo1FfWYyELOpEvkz7ItSLMOsURnslKOO+5lS75 2yvmwjZkOMNvOhdHcIhu0KBD0gC88GIeeM/2I2681YlRwjlIDEIEIjHU4QHs4MiEo+GqJlACoPI ZJMafMVhg2xtuOQexHqwHTGpyxijxBY7mXB3Wvc917UT3H2f7ufuaosj9J+kORFhCkSXOcASeMm rqyfkx/50OTHdTJ5imZ6IF37JE8kcRhIvE+Mhn0o13p4JPJImgKBt2NkN9GiCS+6+0len01tDDb 8BLACIWBrrkbZFqxmFVNfpKrgSFT706YFo/ioBmlOF7CjQTkEDxpZxoihQv29Sky+BRoO6yyUM3 Jdi4pnmCd2ocL1t3xKC8vYT3CwON113ZyjvvT00F0VXDvTxXP+a4WmEWCqilDEcVe7A+6ZuI5o2 urbdOZ9Qmobmkq12yRHwqoAw4aPhlIehwSsXsLeMbO8NQU8B3Ukq3Fm+tC15G39/BItQOVJamNZ /JCjZXCFnFtgwtGHv1SoCHwby//+KqwJr5D3PjAdg== X-Received: by 2002:a05:600c:4594:b0:488:e7e4:8425 with SMTP id 5b1f17b1804b1-48a8445d10cmr36275865e9.23.1777541921847; Thu, 30 Apr 2026 02:38:41 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Yanan Wang , Zhao Liu , Paolo Bonzini , Richard Henderson , "Dr. David Alan Gilbert" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour , Peter Xu , "Edgar E. Iglesias" , Jiaxun Yang , Nicholas Piggin , Chinmay Rath , Glenn Miles , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Ilya Leoshkevich , David Hildenbrand , Mark Cave-Ayland , Artyom Tarasenko , Max Filippov Subject: [PATCH v2 23/25] monitor/hmp-cmds: Use cpu_translate_for_debug() Date: Thu, 30 Apr 2026 10:38:08 +0100 Message-ID: <20260430093810.2762539-24-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260430093810.2762539-1-peter.maydell@linaro.org> References: <20260430093810.2762539-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, 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 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 @linaro.org) X-ZM-MESSAGEID: 1777542108113158500 Content-Type: text/plain; charset="utf-8" We want to remove the cpu_get_phys_addr_debug() function; update the HMP gva2gpa command implementation to use cpu_translate_for_debug() instead. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- monitor/hmp-cmds.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index f8380bda58..2acdcf7d78 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -713,18 +713,17 @@ void hmp_gva2gpa(Monitor *mon, const QDict *qdict) { vaddr addr =3D qdict_get_int(qdict, "addr"); CPUState *cs =3D mon_get_cpu(mon); - hwaddr gpa; + TranslateForDebugResult tres; =20 if (!cs) { monitor_printf(mon, "No cpu\n"); return; } =20 - gpa =3D cpu_get_phys_addr_debug(cs, addr); - if (gpa =3D=3D -1) { + if (!cpu_translate_for_debug(cs, addr, &tres)) { monitor_printf(mon, "Unmapped\n"); } else { - monitor_printf(mon, "gpa: 0x%" HWADDR_PRIx "\n", gpa); + monitor_printf(mon, "gpa: 0x%" HWADDR_PRIx "\n", tres.physaddr); } } =20 --=20 2.43.0 From nobody Sat May 30 19:22:59 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1777542371; cv=none; d=zohomail.com; s=zohoarc; b=l/XVYjUM1DXAoo1AsmTrT2f3Q3IWuD605fqryEBUMtpEA2N5NGCGCvtcGgPy+58JHBY0Jnafzbe5VIWr6lWXzJfwEdKgM26R7/uk3cp9VQnuK+sCQrqROb1g/sJFGnb1pwrNQPw6LS41yRUStXsxlzmlq4/+DMEEh7pWmJQOUek= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777542371; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=W5r6sY4D7K54zH8grS/of9kRgg+UMxxamJYZ/28n8x8=; b=jsoe+ZieLVNpodvSBTjIUeoXwnmmpukxvNfFH2av/DaIFap6kqV1qawZPNg5rcv28Cj6v8IbzLoW2IxmfBgm8wpjrfmAFE7UjIX4+rUb7xxUV/8ezQP/EZtp1g4C1xvAMTBDf2AsPycpJxYL9AMgjH94RhYDPThco4+u3JkhtEM= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177754237111258.358586218178516; Thu, 30 Apr 2026 02:46:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wINrM-0005c6-MG; Thu, 30 Apr 2026 05:39:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wINrI-0005RM-Gv for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:39:00 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wINr4-0002rA-0V for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:39:00 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-48909558b3aso7829535e9.0 for ; Thu, 30 Apr 2026 02:38:44 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-447b421721fsm10816795f8f.15.2026.04.30.02.38.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 02:38:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1777541923; x=1778146723; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=W5r6sY4D7K54zH8grS/of9kRgg+UMxxamJYZ/28n8x8=; b=TsVL3RTWcEeeUZpcs82Ih0fsXtmNBmMMROZvE4P94Fm532pjX7EiTWHxOZCcD/Qe72 qxHptBcxBHWssPJhNdxmCBD5ya3N0RsHZE1e/oXsyUFFmdpX+MNC/TA1Cs8wJEyqVNZu 8sFaY0quLM6N98jZm5AsuJYX2+3U/CRURN9ZilP7c0yBbqE9WtJteAF61A0ifhSJyvl+ PRuAXFfetpV11UR7elXhJ7km5Xc8/wdcKrCN7EesapcLP+iWmvVnnYDyXy0o4LbnJjTy W2Cr7s8KzpRg5QZxU5XvdnepgksGXG7iKXqimQ6ziz1tXOBsOVC8k55zohVGovgqvgXt x8kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777541923; x=1778146723; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=W5r6sY4D7K54zH8grS/of9kRgg+UMxxamJYZ/28n8x8=; b=pNoXsa3d6IjNw4AqMmA2p7glcpv5dY4iTYByTB+j9oNWrUx19AUfSSiky1GsC2FueR csh/V/HYbzUvo1TwMjybecumEjMSaGmb/c90EDlKUP/AKq4r7J2CBTpfU6KEejMoqtJx SOwvjNlgKHi2u418X4rb17SmQ3HKb45b0+LLkrQSRSH1HeXG8wVTDZcFG7c15H1Q/HtV QZaqDs9zKeVg6pETzOO6n+zoekiLffaNtQgl7f57s2tW9rUuUxHmv1IguvXdNeH8DDSs XtW589Fyze8C8SuleENbIZMiHBOkuUzJEiBb4LwRU4WMiFAJOa/K2VX0Ld8FIUEhy+1q VbQQ== X-Gm-Message-State: AOJu0YzOFRXdyATHqmVIcZ6HUAZ/WXlH60z8X1UWC70z1xM0T7lok74d VewtxGCwjFzrLnpXPCszRH779kiyBog2DoqxReouAebdbne+/IyO8s5P/P5JolEHEv53wPtXzhM 7O5ZO X-Gm-Gg: AeBDiespyZMmnpJWbgnY/qmA/wOp9aw+AGq55LxhOsu9MDDZNsPgAfznFDuUFuh1fwo qEnt2TEY4vnMhe6Ap8GsoGAfqSpHGKlZzqbRo0TbuMaGcmmw0us8wEOUaiK//6ztLdBq95zeLpi LQPp+HtKdd6641Raq1JlLVvQ6bbVXxAnHYxVrzj0VcUFRtsTGczIBV19NMOnIS3gxQ0PRyy0/OK +t4xOamMS27HvIP8j5MPGwv2Wtx/1UL6pZATTvEHaJiHIc70jgPVxbUhHLCoSp6tJiOjz8FSCPu zpZD251tiDqy/k5p3sPd1UWpVdaGJ+xtAMFZEH23oTVElvk7L/Ij/qkN5OLqB+iJ+zMqxvzQ7oE Zd+CK04FQQg3y+yLF9TJaeI04zIPn8lo6SQADbUKDxn7RGhuM6KzBZo+b8AA+xGr7rNg7QLtF6F NG4qwx+XFUQYylmL4QpCLONV6bHIux2GsoTuZSrGFfLOyhVR9EnKf4iHlmVKMT784/HBpj+3791 Vr03YoEftUqVlFHiOxiZsWPap1fnhUo3VicwY+Sp/LA3cqNIYek X-Received: by 2002:a5d:438e:0:b0:449:9aee:4575 with SMTP id ffacd0b85a97d-4499aee464emr1142625f8f.30.1777541923127; Thu, 30 Apr 2026 02:38:43 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Yanan Wang , Zhao Liu , Paolo Bonzini , Richard Henderson , "Dr. David Alan Gilbert" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour , Peter Xu , "Edgar E. Iglesias" , Jiaxun Yang , Nicholas Piggin , Chinmay Rath , Glenn Miles , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Ilya Leoshkevich , David Hildenbrand , Mark Cave-Ayland , Artyom Tarasenko , Max Filippov Subject: [PATCH v2 24/25] plugins/api.c: Use cpu_translate_for_debug() Date: Thu, 30 Apr 2026 10:38:09 +0100 Message-ID: <20260430093810.2762539-25-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260430093810.2762539-1-peter.maydell@linaro.org> References: <20260430093810.2762539-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x336.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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, 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 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 @linaro.org) X-ZM-MESSAGEID: 1777542373104154100 Content-Type: text/plain; charset="utf-8" We want to remove the cpu_get_phys_addr_debug() function; update the plugin code to use cpu_translate_for_debug() instead. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- plugins/api.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/api.c b/plugins/api.c index c97cc68882..2d5fe9327f 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -617,15 +617,15 @@ qemu_plugin_write_memory_hwaddr(hwaddr addr, GByteArr= ay *data) bool qemu_plugin_translate_vaddr(uint64_t vaddr, uint64_t *hwaddr) { #ifdef CONFIG_SOFTMMU + TranslateForDebugResult tres; + g_assert(current_cpu); =20 - uint64_t res =3D cpu_get_phys_addr_debug(current_cpu, vaddr); - - if (res =3D=3D (uint64_t)-1) { + if (!cpu_translate_for_debug(current_cpu, vaddr, &tres)) { return false; } =20 - *hwaddr =3D res; + *hwaddr =3D tres.physaddr; =20 return true; #else --=20 2.43.0 From nobody Sat May 30 19:22:59 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1777542373; cv=none; d=zohomail.com; s=zohoarc; b=bPlt2AapwhpFxmcEyDSj5s0Y//EVODyfxOWzP/543pV4d1bie4NcaiFSFQgaUMzybOIXacQ18T6nvKnsAlr6f3gdBK3vB/AUZdoD0o3aTTOGxXCLxnbFJiYFHKN+m5BUDN8D673aMLiRnqq4QaC9DHNPQQFTy0yR2dzF+OUM7JY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777542373; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=5ouV2EmJ5IxGHRV6V1ycMGgG0OzUDMtn6AyWeuat9gA=; b=bC9G8BkIukKUvXBG5MUWDiNPMLtwUp47TGEJOPlRqw0joX3WyfopXFqz6LQK6Pflxo823fQ0HuH6TG17V8JQVIES/uKjcb0Wp+aE/u32GYh0z1jhR+GT98zpKPhpOBkxe3GXtuW3FGBbgZbAopSJvLuutXtTa+aBrB4X1koTtGc= ARC-Authentication-Results: i=1; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777542373595145.0570456623135; Thu, 30 Apr 2026 02:46:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wINrM-0005cB-Pt; Thu, 30 Apr 2026 05:39:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wINrJ-0005U4-EY for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:39:01 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wINr5-0002sd-GK for qemu-devel@nongnu.org; Thu, 30 Apr 2026 05:39:01 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-43d77f6092eso438889f8f.2 for ; Thu, 30 Apr 2026 02:38:45 -0700 (PDT) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-447b421721fsm10816795f8f.15.2026.04.30.02.38.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 02:38:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1777541925; x=1778146725; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5ouV2EmJ5IxGHRV6V1ycMGgG0OzUDMtn6AyWeuat9gA=; b=ynWAfKQA9ENj59O+pKwIQu24O87PKMtKH2XQhV3SWtVYxrg3Crnmsu0ubkdCNqD5HL Jl0+dN7Ll/3PuCUYICwqLtRUH7urrvNhKNcn4Sgm/6fUyrp9xRzGrHZNXF1Jh1DZDnHB 7zV2HM/sGLK8UiRPEvtNuvz72Ll98YDVgrvOSR4vB/+VeYI9sWqZLGukZwNEofqxVjSG tJhUy+7Tga40FDPdQ8RKJ9YYb1W0bk8JfEe5QW8BJR91pbK1gWxDIx3jpItPBNChktmy TPsoN6poUCPEGa0Djxxc4ZUXjDVgblLYVEOTl2oqu13ExuL1eHD0B7ga5CSvrQiPqvga HjyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777541925; x=1778146725; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=5ouV2EmJ5IxGHRV6V1ycMGgG0OzUDMtn6AyWeuat9gA=; b=Sl/Od8Wu+dGLoPkX6f1NLsHQ2nBustyiAdc3FUEhJBWbcwvL/q22D2Wt1rjIsDzxxK jJMlnkJhL28fb0DUyao7X+88b6KSYkYXUQF5HprXzA7Lb2Uqii6SsjYD52u+vAdDaXwC 59fEAT2B+852lBFzUVvxO+oCE3sWTuAXazT4P2zGv8O0/WGx0YzcF+ihHzwWkWDBotTo qxXilYnEx/vnABTU9/BKfUFuGVYRkuP5LSLSb1zLKJj6fh1y319PC5ggsfWz21P2sAQo tavxXTdX4OhRqO5ewGU6jy/8H6cbcIfDdAGqHlXS0MMpZn5wj0lP7pcjNuH7Fk8Zcvv6 Cwtg== X-Gm-Message-State: AOJu0YxEzpOWTWtykKHyph4BWZR56TD7YPoD3ZsEj9m6hoRe63fal9Hk WJ6g4JVATg0N8XUeFQgcsnDsCXLw6p4dERFncWmYRkKp0u3gXwwHaqaGWEiwaohqDeM1wcZ2oAc Wh1iH X-Gm-Gg: AeBDiesLt+qwnwiorYyldsZVz6rvTXd+TsM7GBbf8A6yU63gglXQ7A3j+uA2lFdDeue Tv1g6VCAqyeO1L642CN6Ez6ylOzs2McrhN5hFFn9Wve6GOL3n6ehTwMqBRPFu725p+bFwI/j0TS j0TdzpmFfWspnAwRksx6qM9PWWDAmoEb2u1diPWn1PIsuEH5oDHvN85jazyu5R2SRwxZMC86jEQ ixV7tkfKUbqRhUWXwdKpMOdB4nb8ae4Et7RFnqpdmiFLNP3fXmoWFCj/V21/F/DiZoffDuQZ0Ta EaJbMi03M17OHleuhjcwDkTWwGdKpZVnVJKDpeoafsYjg6VcOeypII7AP/4keoQ+CPsIzemfOYR ZYDcE9Tr3UUB+AV8IZB3zKgPvngmMT5dR/u58hbRle+DI1XFDmEypKIP9Xvvel/RhX8v4FQ4axB Yd5pOcvERQ5uRLCrMuVG3K5atlrrXR0Ex1CBvCc2E2roPFVikF1mt4ZPQg97tbBLp28+wNRiqlg e53Jthh/i2F2PwrxcCPdD7/CX4XgfuP0sKnmBk9+A== X-Received: by 2002:a5d:64e9:0:b0:43f:dc54:9493 with SMTP id ffacd0b85a97d-4493f42dacamr3521529f8f.21.1777541924665; Thu, 30 Apr 2026 02:38:44 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Yanan Wang , Zhao Liu , Paolo Bonzini , Richard Henderson , "Dr. David Alan Gilbert" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour , Peter Xu , "Edgar E. Iglesias" , Jiaxun Yang , Nicholas Piggin , Chinmay Rath , Glenn Miles , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Ilya Leoshkevich , David Hildenbrand , Mark Cave-Ayland , Artyom Tarasenko , Max Filippov Subject: [PATCH v2 25/25] Remove cpu_get_phys_addr_debug() and cpu_get_phys_addr_attrs_debug() Date: Thu, 30 Apr 2026 10:38:10 +0100 Message-ID: <20260430093810.2762539-26-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260430093810.2762539-1-peter.maydell@linaro.org> References: <20260430093810.2762539-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42a.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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, 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 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 @linaro.org) X-ZM-MESSAGEID: 1777542375164154100 Content-Type: text/plain; charset="utf-8" All the callers of cpu_get_phys_addr_debug() and cpu_get_phys_addr_attrs_debug() have now been updated to use cpu_translate_for_debug(), so we can remove them. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- hw/core/cpu-system.c | 20 -------------------- include/hw/core/cpu.h | 34 ---------------------------------- 2 files changed, 54 deletions(-) diff --git a/hw/core/cpu-system.c b/hw/core/cpu-system.c index 954b81931d..16f048c956 100644 --- a/hw/core/cpu-system.c +++ b/hw/core/cpu-system.c @@ -87,26 +87,6 @@ bool cpu_translate_for_debug(CPUState *cpu, vaddr addr, } } =20 -hwaddr cpu_get_phys_addr_attrs_debug(CPUState *cpu, vaddr addr, - MemTxAttrs *attrs) -{ - TranslateForDebugResult result; - - if (!cpu_translate_for_debug(cpu, addr, &result)) { - return -1; - } - - *attrs =3D result.attrs; - return result.physaddr; -} - -hwaddr cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr) -{ - MemTxAttrs attrs =3D {}; - - return cpu_get_phys_addr_attrs_debug(cpu, addr, &attrs); -} - int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs) { int ret =3D 0; diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 6a6b78af31..eac5329889 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -744,40 +744,6 @@ enum CPUDumpFlags { */ void cpu_dump_state(CPUState *cpu, FILE *f, int flags); =20 -/** - * cpu_get_phys_addr_attrs_debug: - * @cpu: The CPU to use for the virtual-to-physical translation - * @addr: The virtual address. - * @attrs: Updated on return with the memory transaction attributes to use - * for this access. - * - * Obtains the physical address corresponding to a virtual one, together - * with the corresponding memory transaction attributes to use for the acc= ess. - * Use it only for debugging because no protection checks are done. - * - * The address need not be page-aligned; the returned address will - * be the physical address corresponding to that virtual address. - * - * Returns: Corresponding physical page address or -1 if no page found. - */ -hwaddr cpu_get_phys_addr_attrs_debug(CPUState *cpu, vaddr addr, - MemTxAttrs *attrs); - -/** - * cpu_get_phys_addr_debug: - * @cpu: The CPU to use for the virtual-to-physical translation - * @addr: The virtual address. - * - * Obtains the physical address corresponding to a virtual one. - * Use it only for debugging because no protection checks are done. - * - * The address need not be page-aligned; the returned address will - * be the physical address corresponding to that virtual address. - * - * Returns: Corresponding physical address, or -1 if no page found. - */ -hwaddr cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr); - /** * TranslateForDebugResult: gives result of cpu_translate_for_debug() * --=20 2.43.0