From: Pierrick Bouvier <pierrick.bouvier@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Anton Johansson" <anjo@rev.ng>,
qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, "Thomas Huth" <thuth@redhat.com>,
qemu-arm@nongnu.org, "Peter Xu" <peterx@redhat.com>,
qemu-riscv@nongnu.org, "David Hildenbrand" <david@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Alex Bennée" <alex.bennee@linaro.org>,
qemu-s390x@nongnu.org
Subject: Re: [PATCH 20/24] exec: Declare tlb_vaddr_to_host() in 'exec/cputlb.h'
Date: Wed, 13 Nov 2024 20:14:58 -0800 [thread overview]
Message-ID: <fedd9248-5aef-43e7-8655-079033329d0e@linaro.org> (raw)
In-Reply-To: <20241114011310.3615-21-philmd@linaro.org>
On 11/13/24 17:13, Philippe Mathieu-Daudé wrote:
> Move CPU TLB related methods to "exec/cputlb.h".
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> include/exec/cpu_ldst.h | 25 -------------------------
> include/exec/cputlb.h | 26 ++++++++++++++++++++++++++
> target/arm/tcg/helper-a64.c | 1 +
> target/ppc/mem_helper.c | 1 +
> 4 files changed, 28 insertions(+), 25 deletions(-)
>
> diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h
> index 769e9fc440..eec47ca05e 100644
> --- a/include/exec/cpu_ldst.h
> +++ b/include/exec/cpu_ldst.h
> @@ -69,7 +69,6 @@
> #include "exec/memopidx.h"
> #include "exec/vaddr.h"
> #include "exec/abi_ptr.h"
> -#include "exec/mmu-access-type.h"
> #include "qemu/int128.h"
>
> #if defined(CONFIG_USER_ONLY)
> @@ -311,30 +310,6 @@ uint32_t cpu_lduw_code(CPUArchState *env, abi_ptr addr);
> uint32_t cpu_ldl_code(CPUArchState *env, abi_ptr addr);
> uint64_t cpu_ldq_code(CPUArchState *env, abi_ptr addr);
>
> -/**
> - * tlb_vaddr_to_host:
> - * @env: CPUArchState
> - * @addr: guest virtual address to look up
> - * @access_type: 0 for read, 1 for write, 2 for execute
> - * @mmu_idx: MMU index to use for lookup
> - *
> - * Look up the specified guest virtual index in the TCG softmmu TLB.
> - * If we can translate a host virtual address suitable for direct RAM
> - * access, without causing a guest exception, then return it.
> - * Otherwise (TLB entry is for an I/O access, guest software
> - * TLB fill required, etc) return NULL.
> - */
> -#ifdef CONFIG_USER_ONLY
> -static inline void *tlb_vaddr_to_host(CPUArchState *env, abi_ptr addr,
> - MMUAccessType access_type, int mmu_idx)
> -{
> - return g2h(env_cpu(env), addr);
> -}
> -#else
> -void *tlb_vaddr_to_host(CPUArchState *env, vaddr addr,
> - MMUAccessType access_type, int mmu_idx);
> -#endif
> -
> /*
> * For user-only, helpers that use guest to host address translation
> * must protect the actual host memory access by recording 'retaddr'
> diff --git a/include/exec/cputlb.h b/include/exec/cputlb.h
> index 07c4bc669e..4acc2c6235 100644
> --- a/include/exec/cputlb.h
> +++ b/include/exec/cputlb.h
> @@ -20,6 +20,7 @@
> #ifndef CPUTLB_H
> #define CPUTLB_H
>
> +#include "exec/abi_ptr.h"
> #include "exec/cpu-common.h"
> #include "exec/hwaddr.h"
> #include "exec/memattrs.h"
> @@ -306,4 +307,29 @@ void tlb_set_page(CPUState *cpu, vaddr addr,
> hwaddr paddr, int prot,
> int mmu_idx, vaddr size);
>
> +/**
> + * tlb_vaddr_to_host:
> + * @env: CPUArchState
> + * @addr: guest virtual address to look up
> + * @access_type: 0 for read, 1 for write, 2 for execute
> + * @mmu_idx: MMU index to use for lookup
> + *
> + * Look up the specified guest virtual index in the TCG softmmu TLB.
> + * If we can translate a host virtual address suitable for direct RAM
> + * access, without causing a guest exception, then return it.
> + * Otherwise (TLB entry is for an I/O access, guest software
> + * TLB fill required, etc) return NULL.
> + */
> +#ifdef CONFIG_USER_ONLY
> +#include "user/guest-host.h"
> +static inline void *tlb_vaddr_to_host(CPUArchState *env, abi_ptr addr,
> + MMUAccessType access_type, int mmu_idx)
> +{
> + return g2h(env_cpu(env), addr);
> +}
> +#else
> +void *tlb_vaddr_to_host(CPUArchState *env, vaddr addr,
> + MMUAccessType access_type, int mmu_idx);
> +#endif
> +
> #endif
> diff --git a/target/arm/tcg/helper-a64.c b/target/arm/tcg/helper-a64.c
> index 8f42a28d07..9cb5d8ee53 100644
> --- a/target/arm/tcg/helper-a64.c
> +++ b/target/arm/tcg/helper-a64.c
> @@ -30,6 +30,7 @@
> #include "qemu/crc32c.h"
> #include "exec/exec-all.h"
> #include "exec/cpu_ldst.h"
> +#include "exec/cputlb.h"
> #include "qemu/int128.h"
> #include "qemu/atomic128.h"
> #include "fpu/softfloat.h"
> diff --git a/target/ppc/mem_helper.c b/target/ppc/mem_helper.c
> index 51b137febd..44974b25f8 100644
> --- a/target/ppc/mem_helper.c
> +++ b/target/ppc/mem_helper.c
> @@ -24,6 +24,7 @@
> #include "exec/helper-proto.h"
> #include "helper_regs.h"
> #include "exec/cpu_ldst.h"
> +#include "exec/cputlb.h"
> #include "internal.h"
> #include "qemu/atomic128.h"
>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
next prev parent reply other threads:[~2024-11-14 4:15 UTC|newest]
Thread overview: 78+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-14 1:12 [PATCH 00/24] exec: Build up 'cputlb.h' and 'ram_addr.h' headers Philippe Mathieu-Daudé
2024-11-14 1:12 ` [PATCH 01/24] exec/cpu-all: Include missing 'exec/cpu-defs.h' header Philippe Mathieu-Daudé
2024-11-14 4:09 ` Pierrick Bouvier
2024-11-14 8:29 ` Thomas Huth
2024-11-14 18:11 ` Richard Henderson
2024-11-14 1:12 ` [PATCH 02/24] exec/cpu-defs: Remove unnecessary headers Philippe Mathieu-Daudé
2024-11-14 4:09 ` Pierrick Bouvier
2024-11-14 8:33 ` Thomas Huth
2024-11-14 18:15 ` Richard Henderson
2024-11-14 1:12 ` [PATCH 03/24] exec/translation-block: Include missing 'exec/vaddr.h' header Philippe Mathieu-Daudé
2024-11-14 4:10 ` Pierrick Bouvier
2024-11-14 15:23 ` Philippe Mathieu-Daudé
2024-11-14 17:13 ` Pierrick Bouvier
2024-11-14 18:15 ` Richard Henderson
2024-11-14 1:12 ` [PATCH 04/24] accel/tcg: Include missing 'exec/translation-block.h' header Philippe Mathieu-Daudé
2024-11-14 4:11 ` Pierrick Bouvier
2024-11-14 18:23 ` Richard Henderson
2024-11-14 1:12 ` [PATCH 05/24] target/i386/helper: " Philippe Mathieu-Daudé
2024-11-14 4:11 ` Pierrick Bouvier
2024-11-14 18:42 ` Richard Henderson
2024-11-14 1:12 ` [PATCH 06/24] target/rx/cpu: " Philippe Mathieu-Daudé
2024-11-14 4:11 ` Pierrick Bouvier
2024-11-14 18:43 ` Richard Henderson
2024-11-14 1:12 ` [PATCH 07/24] system/watchpoint: Include missing 'exec/cpu-all.h' header Philippe Mathieu-Daudé
2024-11-14 4:11 ` Pierrick Bouvier
2024-11-14 18:53 ` Richard Henderson
2024-11-14 1:12 ` [PATCH 08/24] linux-user/aarch64/mte: Include missing 'user/abitypes.h' header Philippe Mathieu-Daudé
2024-11-14 4:11 ` Pierrick Bouvier
2024-11-14 18:59 ` Richard Henderson
2024-11-14 1:12 ` [PATCH 09/24] target/arm/mte: Restrict 'exec/ram_addr.h' to system emulation Philippe Mathieu-Daudé
2024-11-14 4:11 ` Pierrick Bouvier
2024-11-14 19:00 ` Richard Henderson
2024-11-14 1:12 ` [PATCH 10/24] target/arm/cpu: Restrict cpu_untagged_addr() to user emulation Philippe Mathieu-Daudé
2024-11-14 4:12 ` Pierrick Bouvier
2024-11-14 19:03 ` Richard Henderson
2024-11-14 1:12 ` [PATCH 11/24] exec: Introduce 'user/guest-host.h' header Philippe Mathieu-Daudé
2024-11-14 4:12 ` Pierrick Bouvier
2024-11-14 19:14 ` Richard Henderson
2024-11-14 1:12 ` [PATCH 12/24] accel/tcg: Have tlb_vaddr_to_host() use vaddr type Philippe Mathieu-Daudé
2024-11-14 4:12 ` Pierrick Bouvier
2024-11-14 19:16 ` Richard Henderson
2024-11-14 1:12 ` [PATCH 13/24] exec: Declare tlb_reset_dirty*() in 'exec/cputlb.h' Philippe Mathieu-Daudé
2024-11-14 4:12 ` Pierrick Bouvier
2024-11-14 19:19 ` Richard Henderson
2024-11-14 21:05 ` Philippe Mathieu-Daudé
2024-11-14 1:12 ` [PATCH 14/24] exec: Declare tlb_init/destroy() " Philippe Mathieu-Daudé
2024-11-14 4:13 ` Pierrick Bouvier
2024-11-14 19:21 ` Richard Henderson
2024-11-14 21:13 ` Philippe Mathieu-Daudé
2024-11-14 1:13 ` [PATCH 15/24] exec: Declare tlb_set_page_full() " Philippe Mathieu-Daudé
2024-11-14 4:13 ` Pierrick Bouvier
2024-11-14 19:24 ` Richard Henderson
2024-11-14 1:13 ` [PATCH 16/24] exec: Declare tlb_set_page_with_attrs() " Philippe Mathieu-Daudé
2024-11-14 4:13 ` Pierrick Bouvier
2024-11-14 1:13 ` [PATCH 17/24] exec: Declare tlb_set_page() " Philippe Mathieu-Daudé
2024-11-14 4:13 ` Pierrick Bouvier
2024-11-14 1:13 ` [PATCH 18/24] exec: Declare tlb_flush*() " Philippe Mathieu-Daudé
2024-11-14 4:14 ` Pierrick Bouvier
2024-11-14 19:30 ` Richard Henderson
2024-11-14 1:13 ` [PATCH 19/24] exec: Declare tlb_hit*() " Philippe Mathieu-Daudé
2024-11-14 4:14 ` Pierrick Bouvier
2024-11-14 19:37 ` Richard Henderson
2024-11-14 1:13 ` [PATCH 20/24] exec: Declare tlb_vaddr_to_host() " Philippe Mathieu-Daudé
2024-11-14 4:14 ` Pierrick Bouvier [this message]
2024-11-14 19:59 ` Richard Henderson
2024-11-14 1:13 ` [PATCH 21/24] exec: Extract CPU physical memory API to 'sysemu/physmem-target.h' Philippe Mathieu-Daudé
2024-11-14 1:17 ` Philippe Mathieu-Daudé
2024-11-14 4:15 ` Pierrick Bouvier
2024-11-14 20:51 ` Richard Henderson
2024-11-14 1:13 ` [PATCH 22/24] exec/cpu-common: Move ram_addr_t related methods to 'exec/ram_addr.h' Philippe Mathieu-Daudé
2024-11-14 4:15 ` Pierrick Bouvier
2024-11-14 20:47 ` Richard Henderson
2024-11-14 1:13 ` [PATCH 23/24] exec/memory: Move qemu_map_ram_ptr() declaration " Philippe Mathieu-Daudé
2024-11-14 4:16 ` Pierrick Bouvier
2024-11-14 20:48 ` Richard Henderson
2024-11-14 1:13 ` [PATCH 24/24] exec: Move 'ram_addr.h' header under sysemu/ namespace Philippe Mathieu-Daudé
2024-11-14 4:16 ` Pierrick Bouvier
2024-11-14 20:49 ` Richard Henderson
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=fedd9248-5aef-43e7-8655-079033329d0e@linaro.org \
--to=pierrick.bouvier@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=anjo@rev.ng \
--cc=david@redhat.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=richard.henderson@linaro.org \
--cc=thuth@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).