qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 11/13] exec/cpu_ldst: Restrict TCG-specific code


From: Richard Henderson
Subject: Re: [PATCH 11/13] exec/cpu_ldst: Restrict TCG-specific code
Date: Wed, 9 Feb 2022 09:43:34 +1100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0

On 2/9/22 02:22, Philippe Mathieu-Daudé wrote:
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
  include/exec/cpu_ldst.h | 53 ++++++++++++++++++++++-------------------
  1 file changed, 28 insertions(+), 25 deletions(-)

diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h
index 5c999966de..0932096d29 100644
--- a/include/exec/cpu_ldst.h
+++ b/include/exec/cpu_ldst.h
@@ -321,6 +321,8 @@ void cpu_atomic_sto_le_mmu(CPUArchState *env, target_ulong 
addr, Int128 val,
  void cpu_atomic_sto_be_mmu(CPUArchState *env, target_ulong addr, Int128 val,
                             MemOpIdx oi, uintptr_t retaddr);
+#ifdef CONFIG_TCG
+
  #if defined(CONFIG_USER_ONLY)
extern __thread uintptr_t helper_retaddr;
@@ -374,9 +376,34 @@ static inline CPUTLBEntry *tlb_entry(CPUArchState *env, 
uintptr_t mmu_idx,
  {
      return &env_tlb(env)->f[mmu_idx].table[tlb_index(env, mmu_idx, addr)];
  }
-
  #endif /* defined(CONFIG_USER_ONLY) */
+/**
+ * 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, abi_ptr addr,
+                        MMUAccessType access_type, int mmu_idx);
+#endif
+
+#endif /* CONFIG_TCG */

Why is it just these functions you think are tcg only?
I think the entire file is tcg only, if you are considering stuff that uses the 
softmmu tlb.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]