All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chao Liu <chao.liu.zevorn@gmail.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org, qemu-ppc@nongnu.org,
	qemu-riscv@nongnu.org, qemu-s390x@nongnu.org,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Yanan Wang" <wangyanan55@huawei.com>,
	"Zhao Liu" <zhao1.liu@intel.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Dr. David Alan Gilbert" <dave@treblig.org>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Alexandre Iooss" <erdnaxe@crans.org>,
	"Mahmoud Mandour" <ma.mandourr@gmail.com>,
	"Peter Xu" <peterx@redhat.com>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Chinmay Rath" <rathc@linux.ibm.com>,
	"Glenn Miles" <milesg@linux.ibm.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Alistair Francis" <alistair.francis@wdc.com>,
	"Weiwei Li" <liwei1518@gmail.com>,
	"Daniel Henrique Barboza" <daniel.barboza@oss.qualcomm.com>,
	"Liu Zhiwei" <zhiwei_liu@linux.alibaba.com>,
	"Ilya Leoshkevich" <iii@linux.ibm.com>,
	"David Hildenbrand" <david@kernel.org>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"Artyom Tarasenko" <atar4qemu@gmail.com>
Subject: Re: [PATCH 01/17] target/riscv: Make get_phys_page_debug handle non-page-aligned addrs
Date: Sat, 18 Apr 2026 11:43:00 +0800	[thread overview]
Message-ID: <aeL9to3kuG2L2dKC@ZEVORN-PC.localdomain> (raw)
In-Reply-To: <20260417173105.1648172-2-peter.maydell@linaro.org>

On Fri, Apr 17, 2026 at 06:30:49PM +0100, Peter Maydell wrote:
> 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 <peter.maydell@linaro.org>
Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com>

Thanks,
Chao
> ---
>  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, vaddr addr)
>          }
>      }
>  
> -    return phys_addr & TARGET_PAGE_MASK;
> +    return phys_addr;
>  }
>  
>  void riscv_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,
> -- 
> 2.43.0
> 


  reply	other threads:[~2026-04-18  3:44 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-17 17:30 [PATCH 00/17] Handle sub-page granularity in cpu_memory_rw_debug() Peter Maydell
2026-04-17 17:30 ` [PATCH 01/17] target/riscv: Make get_phys_page_debug handle non-page-aligned addrs Peter Maydell
2026-04-18  3:43   ` Chao Liu [this message]
2026-04-18 22:18   ` Philippe Mathieu-Daudé
2026-04-23  2:13   ` Richard Henderson
2026-04-17 17:30 ` [PATCH 02/17] target/alpha: " Peter Maydell
2026-04-23  2:14   ` Richard Henderson
2026-04-17 17:30 ` [PATCH 03/17] target/microblaze: Make get_phys_page_attrs_debug " Peter Maydell
2026-04-18 22:18   ` Philippe Mathieu-Daudé
2026-04-23  2:24   ` Richard Henderson
2026-04-17 17:30 ` [PATCH 04/17] target/sparc: Make get_phys_page_debug " Peter Maydell
2026-04-23  2:26   ` Richard Henderson
2026-04-17 17:30 ` [PATCH 05/17] target/x86: Make get_phys_page_attrs_debug " Peter Maydell
2026-04-23  2:27   ` Richard Henderson
2026-04-17 17:30 ` [PATCH 06/17] target/s390x: Make get_phys_page_debug " Peter Maydell
2026-04-21 11:04   ` Ilya Leoshkevich
2026-04-23  2:29   ` Richard Henderson
2026-04-17 17:30 ` [PATCH 07/17] target/ppc: " Peter Maydell
2026-04-23  2:30   ` Richard Henderson
2026-04-17 17:30 ` [PATCH 08/17] target: Rename get_phys_page_debug to get_phys_addr_debug Peter Maydell
2026-04-18 22:14   ` Philippe Mathieu-Daudé
2026-04-23  2:32   ` Richard Henderson
2026-04-17 17:30 ` [PATCH 09/17] target: Rename cpu_get_phys_page_{,attrs_}debug Peter Maydell
2026-04-18 22:15   ` Philippe Mathieu-Daudé
2026-04-23  2:34   ` Richard Henderson
2026-04-17 17:30 ` [PATCH 10/17] hw/core: Update docs for get_phys_addr_{attrs_,}debug Peter Maydell
2026-04-18 22:16   ` Philippe Mathieu-Daudé
2026-04-23  2:42   ` Richard Henderson
2026-04-17 17:30 ` [PATCH 11/17] target/arm: Rename arm_cpu_get_phys_page() Peter Maydell
2026-04-18 22:16   ` Philippe Mathieu-Daudé
2026-04-17 17:31 ` [PATCH 12/17] monitor: hmp_gva2gpa: Don't page-align cpu_get_phys_addr_debug() arg and return Peter Maydell
2026-04-17 17:46   ` Dr. David Alan Gilbert
2026-04-18 22:16   ` Philippe Mathieu-Daudé
2026-04-17 17:31 ` [PATCH 13/17] plugins/api.c: Trust cpu_get_phys_addr_debug() return address Peter Maydell
2026-04-23  2:44   ` Richard Henderson
2026-04-17 17:31 ` [PATCH 14/17] hw/core: Implement new cpu_translate_for_debug() Peter Maydell
2026-04-18 22:25   ` Philippe Mathieu-Daudé
2026-04-23  3:05   ` Richard Henderson
2026-04-28 10:42     ` Peter Maydell
2026-04-17 17:31 ` [PATCH 15/17] hw/core: Implement cpu_get_phys_addr_attrs_debug() with cpu_translate_for_debug() Peter Maydell
2026-04-23  3:08   ` Richard Henderson
2026-04-28 10:43     ` Peter Maydell
2026-04-17 17:31 ` [PATCH 16/17] target/arm: Implement translate_for_debug Peter Maydell
2026-04-18 22:29   ` Philippe Mathieu-Daudé
2026-04-23  3:12   ` Richard Henderson
2026-04-28 10:26     ` Peter Maydell
2026-04-17 17:31 ` [PATCH 17/17] system/physmem: Use translate_for_debug() in cpu_memory_rw_debug() Peter Maydell
2026-04-18 22:33   ` Philippe Mathieu-Daudé
2026-04-23  3:17   ` Richard Henderson
2026-04-28 10:32     ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aeL9to3kuG2L2dKC@ZEVORN-PC.localdomain \
    --to=chao.liu.zevorn@gmail.com \
    --cc=alex.bennee@linaro.org \
    --cc=alistair.francis@wdc.com \
    --cc=atar4qemu@gmail.com \
    --cc=daniel.barboza@oss.qualcomm.com \
    --cc=dave@treblig.org \
    --cc=david@kernel.org \
    --cc=edgar.iglesias@gmail.com \
    --cc=erdnaxe@crans.org \
    --cc=iii@linux.ibm.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=liwei1518@gmail.com \
    --cc=ma.mandourr@gmail.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=milesg@linux.ibm.com \
    --cc=npiggin@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=peterx@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=rathc@linux.ibm.com \
    --cc=richard.henderson@linaro.org \
    --cc=wangyanan55@huawei.com \
    --cc=zhao1.liu@intel.com \
    --cc=zhiwei_liu@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.