accel/tcg: Add tlb_fill_flags to CPUTLBEntryFull
authorRichard Henderson <richard.henderson@linaro.org>
Fri, 1 Mar 2024 20:41:07 +0000 (10:41 -1000)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 5 Mar 2024 13:22:56 +0000 (13:22 +0000)
Allow the target to set tlb flags to apply to all of the
comparators.  Remove MemTxAttrs.byte_swap, as the bit is
not relevant to memory transactions, only the page mapping.
Adjust target/sparc to set TLB_BSWAP directly.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20240301204110.656742-4-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
accel/tcg/cputlb.c
include/exec/memattrs.h
include/hw/core/cpu.h
target/sparc/mmu_helper.c

index 6243bcb17913a3c208058b9afe00d10111595bad..ac986cb8ea51bf7d4ce4736654782d2a95aa550d 100644 (file)
@@ -1145,14 +1145,11 @@ void tlb_set_page_full(CPUState *cpu, int mmu_idx,
               " prot=%x idx=%d\n",
               addr, full->phys_addr, prot, mmu_idx);
 
-    read_flags = 0;
+    read_flags = full->tlb_fill_flags;
     if (full->lg_page_size < TARGET_PAGE_BITS) {
         /* Repeat the MMU check and TLB fill on every access.  */
         read_flags |= TLB_INVALID_MASK;
     }
-    if (full->attrs.byte_swap) {
-        read_flags |= TLB_BSWAP;
-    }
 
     is_ram = memory_region_is_ram(section->mr);
     is_romd = memory_region_is_romd(section->mr);
index afa885f983085060110dfa2a55fd84af1689e54c..14cdd8d5824f919b3d5bced299b88d32fd4440ae 100644 (file)
@@ -52,8 +52,6 @@ typedef struct MemTxAttrs {
     unsigned int memory:1;
     /* Requester ID (for MSI for example) */
     unsigned int requester_id:16;
-    /* Invert endianness for this page */
-    unsigned int byte_swap:1;
 } MemTxAttrs;
 
 /* Bus masters which don't specify any attributes will get this,
index d0e345419fcf3caf9992107fb6c665abe5b05ea9..ec14f74ce5dd16277cb91ba72eddc0ef3e59ec9f 100644 (file)
@@ -230,6 +230,9 @@ typedef struct CPUTLBEntryFull {
     /* @lg_page_size contains the log2 of the page size. */
     uint8_t lg_page_size;
 
+    /* Additional tlb flags requested by tlb_fill. */
+    uint8_t tlb_fill_flags;
+
     /*
      * Additional tlb flags for use by the slow path. If non-zero,
      * the corresponding CPUTLBEntry comparator must have TLB_FORCE_SLOW.
index 5170a668bb4971b28b28df2ae7fd5588c6de77fb..e7b1997d54ee0422aa8628f28181521963caf493 100644 (file)
@@ -580,7 +580,7 @@ static int get_physical_address_data(CPUSPARCState *env, CPUTLBEntryFull *full,
             int do_fault = 0;
 
             if (TTE_IS_IE(env->dtlb[i].tte)) {
-                full->attrs.byte_swap = true;
+                full->tlb_fill_flags |= TLB_BSWAP;
             }
 
             /* access ok? */