|
|
8be556 |
From eef48dbd8ff1db034868f2a43ddb580efb8885b7 Mon Sep 17 00:00:00 2001
|
|
|
8be556 |
From: Xiao Wang <jasowang@redhat.com>
|
|
|
8be556 |
Date: Tue, 7 Jul 2015 09:18:13 +0200
|
|
|
8be556 |
Subject: [PATCH 125/217] Add MemTxAttrs to the IOTLB
|
|
|
8be556 |
MIME-Version: 1.0
|
|
|
8be556 |
Content-Type: text/plain; charset=UTF-8
|
|
|
8be556 |
Content-Transfer-Encoding: 8bit
|
|
|
8be556 |
|
|
|
8be556 |
Message-id: <1436260751-25015-11-git-send-email-jasowang@redhat.com>
|
|
|
8be556 |
Patchwork-id: 66785
|
|
|
8be556 |
O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 10/68] Add MemTxAttrs to the IOTLB
|
|
|
8be556 |
Bugzilla: 1227343
|
|
|
8be556 |
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
8be556 |
RH-Acked-by: David Gibson <dgibson@redhat.com>
|
|
|
8be556 |
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
8be556 |
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
|
8be556 |
|
|
|
8be556 |
From: Peter Maydell <peter.maydell@linaro.org>
|
|
|
8be556 |
|
|
|
8be556 |
Add a MemTxAttrs field to the IOTLB, and allow target-specific
|
|
|
8be556 |
code to set it via a new tlb_set_page_with_attrs() function;
|
|
|
8be556 |
pass the attributes through to the device when making IO accesses.
|
|
|
8be556 |
|
|
|
8be556 |
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
|
8be556 |
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
8be556 |
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
|
|
|
8be556 |
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
|
|
|
8be556 |
(cherry picked from commit fadc1cbe85c6b032d5842ec0d19d209f50fcb375)
|
|
|
8be556 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
8be556 |
---
|
|
|
8be556 |
cputlb.c | 18 +++++++++++++++---
|
|
|
8be556 |
include/exec/cpu-defs.h | 2 ++
|
|
|
8be556 |
include/exec/exec-all.h | 3 +++
|
|
|
8be556 |
softmmu_template.h | 4 ++--
|
|
|
8be556 |
4 files changed, 22 insertions(+), 5 deletions(-)
|
|
|
8be556 |
|
|
|
8be556 |
diff --git a/cputlb.c b/cputlb.c
|
|
|
8be556 |
index 5e1cb8f..7606548 100644
|
|
|
8be556 |
--- a/cputlb.c
|
|
|
8be556 |
+++ b/cputlb.c
|
|
|
8be556 |
@@ -249,9 +249,9 @@ static void tlb_add_large_page(CPUArchState *env, target_ulong vaddr,
|
|
|
8be556 |
* Called from TCG-generated code, which is under an RCU read-side
|
|
|
8be556 |
* critical section.
|
|
|
8be556 |
*/
|
|
|
8be556 |
-void tlb_set_page(CPUState *cpu, target_ulong vaddr,
|
|
|
8be556 |
- hwaddr paddr, int prot,
|
|
|
8be556 |
- int mmu_idx, target_ulong size)
|
|
|
8be556 |
+void tlb_set_page_with_attrs(CPUState *cpu, target_ulong vaddr,
|
|
|
8be556 |
+ hwaddr paddr, MemTxAttrs attrs, int prot,
|
|
|
8be556 |
+ int mmu_idx, target_ulong size)
|
|
|
8be556 |
{
|
|
|
8be556 |
CPUArchState *env = cpu->env_ptr;
|
|
|
8be556 |
MemoryRegionSection *section;
|
|
|
8be556 |
@@ -302,6 +302,7 @@ void tlb_set_page(CPUState *cpu, target_ulong vaddr,
|
|
|
8be556 |
|
|
|
8be556 |
/* refill the tlb */
|
|
|
8be556 |
env->iotlb[mmu_idx][index].addr = iotlb - vaddr;
|
|
|
8be556 |
+ env->iotlb[mmu_idx][index].attrs = attrs;
|
|
|
8be556 |
te->addend = addend - vaddr;
|
|
|
8be556 |
if (prot & PAGE_READ) {
|
|
|
8be556 |
te->addr_read = address;
|
|
|
8be556 |
@@ -331,6 +332,17 @@ void tlb_set_page(CPUState *cpu, target_ulong vaddr,
|
|
|
8be556 |
}
|
|
|
8be556 |
}
|
|
|
8be556 |
|
|
|
8be556 |
+/* Add a new TLB entry, but without specifying the memory
|
|
|
8be556 |
+ * transaction attributes to be used.
|
|
|
8be556 |
+ */
|
|
|
8be556 |
+void tlb_set_page(CPUState *cpu, target_ulong vaddr,
|
|
|
8be556 |
+ hwaddr paddr, int prot,
|
|
|
8be556 |
+ int mmu_idx, target_ulong size)
|
|
|
8be556 |
+{
|
|
|
8be556 |
+ tlb_set_page_with_attrs(cpu, vaddr, paddr, MEMTXATTRS_UNSPECIFIED,
|
|
|
8be556 |
+ prot, mmu_idx, size);
|
|
|
8be556 |
+}
|
|
|
8be556 |
+
|
|
|
8be556 |
/* NOTE: this function can trigger an exception */
|
|
|
8be556 |
/* NOTE2: the returned address is not exactly the physical address: it
|
|
|
8be556 |
* is actually a ram_addr_t (in system mode; the user mode emulation
|
|
|
8be556 |
diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h
|
|
|
8be556 |
index 7f88185..3f56546 100644
|
|
|
8be556 |
--- a/include/exec/cpu-defs.h
|
|
|
8be556 |
+++ b/include/exec/cpu-defs.h
|
|
|
8be556 |
@@ -30,6 +30,7 @@
|
|
|
8be556 |
#ifndef CONFIG_USER_ONLY
|
|
|
8be556 |
#include "exec/hwaddr.h"
|
|
|
8be556 |
#endif
|
|
|
8be556 |
+#include "exec/memattrs.h"
|
|
|
8be556 |
|
|
|
8be556 |
#ifndef TARGET_LONG_BITS
|
|
|
8be556 |
#error TARGET_LONG_BITS must be defined before including this header
|
|
|
8be556 |
@@ -109,6 +110,7 @@ QEMU_BUILD_BUG_ON(sizeof(CPUTLBEntry) != (1 << CPU_TLB_ENTRY_BITS));
|
|
|
8be556 |
*/
|
|
|
8be556 |
typedef struct CPUIOTLBEntry {
|
|
|
8be556 |
hwaddr addr;
|
|
|
8be556 |
+ MemTxAttrs attrs;
|
|
|
8be556 |
} CPUIOTLBEntry;
|
|
|
8be556 |
|
|
|
8be556 |
#define CPU_COMMON_TLB \
|
|
|
8be556 |
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
|
|
|
8be556 |
index ff1bc3e..b58cd47 100644
|
|
|
8be556 |
--- a/include/exec/exec-all.h
|
|
|
8be556 |
+++ b/include/exec/exec-all.h
|
|
|
8be556 |
@@ -105,6 +105,9 @@ void tlb_flush(CPUState *cpu, int flush_global);
|
|
|
8be556 |
void tlb_set_page(CPUState *cpu, target_ulong vaddr,
|
|
|
8be556 |
hwaddr paddr, int prot,
|
|
|
8be556 |
int mmu_idx, target_ulong size);
|
|
|
8be556 |
+void tlb_set_page_with_attrs(CPUState *cpu, target_ulong vaddr,
|
|
|
8be556 |
+ hwaddr paddr, MemTxAttrs attrs,
|
|
|
8be556 |
+ int prot, int mmu_idx, target_ulong size);
|
|
|
8be556 |
void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr);
|
|
|
8be556 |
#else
|
|
|
8be556 |
static inline void tlb_flush_page(CPUState *cpu, target_ulong addr)
|
|
|
8be556 |
diff --git a/softmmu_template.h b/softmmu_template.h
|
|
|
8be556 |
index 0e30986..16b0852 100644
|
|
|
8be556 |
--- a/softmmu_template.h
|
|
|
8be556 |
+++ b/softmmu_template.h
|
|
|
8be556 |
@@ -160,7 +160,7 @@ static inline DATA_TYPE glue(io_read, SUFFIX)(CPUArchState *env,
|
|
|
8be556 |
|
|
|
8be556 |
cpu->mem_io_vaddr = addr;
|
|
|
8be556 |
memory_region_dispatch_read(mr, physaddr, &val, 1 << SHIFT,
|
|
|
8be556 |
- MEMTXATTRS_UNSPECIFIED);
|
|
|
8be556 |
+ iotlbentry->attrs);
|
|
|
8be556 |
return val;
|
|
|
8be556 |
}
|
|
|
8be556 |
#endif
|
|
|
8be556 |
@@ -382,7 +382,7 @@ static inline void glue(io_write, SUFFIX)(CPUArchState *env,
|
|
|
8be556 |
cpu->mem_io_vaddr = addr;
|
|
|
8be556 |
cpu->mem_io_pc = retaddr;
|
|
|
8be556 |
memory_region_dispatch_write(mr, physaddr, val, 1 << SHIFT,
|
|
|
8be556 |
- MEMTXATTRS_UNSPECIFIED);
|
|
|
8be556 |
+ iotlbentry->attrs);
|
|
|
8be556 |
}
|
|
|
8be556 |
|
|
|
8be556 |
void helper_le_st_name(CPUArchState *env, target_ulong addr, DATA_TYPE val,
|
|
|
8be556 |
--
|
|
|
8be556 |
1.8.3.1
|
|
|
8be556 |
|