|
|
9ae3a8 |
From 348710ce46ee2ddf02396aad4bd3978c6dfc2a07 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Marcel Apfelbaum <marcel.a@redhat.com>
|
|
|
9ae3a8 |
Date: Sun, 19 Jan 2014 13:07:35 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 10/11] exec: change well-known physical sections to macros
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Marcel Apfelbaum <marcel.a@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1390136856-7024-2-git-send-email-marcel.a@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 56810
|
|
|
9ae3a8 |
O-Subject: [RHEL-7 qemu-kvm PATCH v2 1/2] exec: change well-known physical sections to macros
|
|
|
9ae3a8 |
Bugzilla: 1003535
|
|
|
9ae3a8 |
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: Liu Ping Fan <qemulist@gmail.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Sections like phys_section_unassigned always have fixed address
|
|
|
9ae3a8 |
in phys_sections. Declared as macro, so we can use them
|
|
|
9ae3a8 |
when having more than one phys_sections array.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
|
|
|
9ae3a8 |
Signed-off-by: Liu Ping Fan <qemulist@gmail.com>
|
|
|
9ae3a8 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit b41aac4f0d17000babd815e088699d58e59917b8)
|
|
|
9ae3a8 |
Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Conflicts:
|
|
|
9ae3a8 |
exec.c
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
exec.c | 42 ++++++++++++++++++++++++------------------
|
|
|
9ae3a8 |
1 file changed, 24 insertions(+), 18 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
exec.c | 42 ++++++++++++++++++++++++------------------
|
|
|
9ae3a8 |
1 files changed, 24 insertions(+), 18 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/exec.c b/exec.c
|
|
|
9ae3a8 |
index b16ef4a..01c74cd 100644
|
|
|
9ae3a8 |
--- a/exec.c
|
|
|
9ae3a8 |
+++ b/exec.c
|
|
|
9ae3a8 |
@@ -101,10 +101,10 @@ struct AddressSpaceDispatch {
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static MemoryRegionSection *phys_sections;
|
|
|
9ae3a8 |
static unsigned phys_sections_nb, phys_sections_nb_alloc;
|
|
|
9ae3a8 |
-static uint16_t phys_section_unassigned;
|
|
|
9ae3a8 |
-static uint16_t phys_section_notdirty;
|
|
|
9ae3a8 |
-static uint16_t phys_section_rom;
|
|
|
9ae3a8 |
-static uint16_t phys_section_watch;
|
|
|
9ae3a8 |
+#define PHYS_SECTION_UNASSIGNED 0
|
|
|
9ae3a8 |
+#define PHYS_SECTION_NOTDIRTY 1
|
|
|
9ae3a8 |
+#define PHYS_SECTION_ROM 2
|
|
|
9ae3a8 |
+#define PHYS_SECTION_WATCH 3
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
/* Simple allocator for PhysPageEntry nodes */
|
|
|
9ae3a8 |
static PhysPageEntry (*phys_map_nodes)[L2_SIZE];
|
|
|
9ae3a8 |
@@ -168,7 +168,7 @@ static void phys_page_set_level(PhysPageEntry *lp, hwaddr *index,
|
|
|
9ae3a8 |
if (level == 0) {
|
|
|
9ae3a8 |
for (i = 0; i < L2_SIZE; i++) {
|
|
|
9ae3a8 |
p[i].is_leaf = 1;
|
|
|
9ae3a8 |
- p[i].ptr = phys_section_unassigned;
|
|
|
9ae3a8 |
+ p[i].ptr = PHYS_SECTION_UNASSIGNED;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
} else {
|
|
|
9ae3a8 |
@@ -204,7 +204,7 @@ MemoryRegionSection *phys_page_find(AddressSpaceDispatch *d, hwaddr index)
|
|
|
9ae3a8 |
PhysPageEntry lp = d->phys_map;
|
|
|
9ae3a8 |
PhysPageEntry *p;
|
|
|
9ae3a8 |
int i;
|
|
|
9ae3a8 |
- uint16_t s_index = phys_section_unassigned;
|
|
|
9ae3a8 |
+ uint16_t s_index = PHYS_SECTION_UNASSIGNED;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
for (i = P_L2_LEVELS - 1; i >= 0 && !lp.is_leaf; i--) {
|
|
|
9ae3a8 |
if (lp.ptr == PHYS_MAP_NODE_NIL) {
|
|
|
9ae3a8 |
@@ -646,9 +646,9 @@ hwaddr memory_region_section_get_iotlb(CPUArchState *env,
|
|
|
9ae3a8 |
iotlb = (memory_region_get_ram_addr(section->mr) & TARGET_PAGE_MASK)
|
|
|
9ae3a8 |
+ memory_region_section_addr(section, paddr);
|
|
|
9ae3a8 |
if (!section->readonly) {
|
|
|
9ae3a8 |
- iotlb |= phys_section_notdirty;
|
|
|
9ae3a8 |
+ iotlb |= PHYS_SECTION_NOTDIRTY;
|
|
|
9ae3a8 |
} else {
|
|
|
9ae3a8 |
- iotlb |= phys_section_rom;
|
|
|
9ae3a8 |
+ iotlb |= PHYS_SECTION_ROM;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
} else {
|
|
|
9ae3a8 |
/* IO handlers are currently passed a physical address.
|
|
|
9ae3a8 |
@@ -667,7 +667,7 @@ hwaddr memory_region_section_get_iotlb(CPUArchState *env,
|
|
|
9ae3a8 |
if (vaddr == (wp->vaddr & TARGET_PAGE_MASK)) {
|
|
|
9ae3a8 |
/* Avoid trapping reads of pages with a write breakpoint. */
|
|
|
9ae3a8 |
if ((prot & PAGE_WRITE) || (wp->flags & BP_MEM_READ)) {
|
|
|
9ae3a8 |
- iotlb = phys_section_watch + paddr;
|
|
|
9ae3a8 |
+ iotlb = PHYS_SECTION_WATCH + paddr;
|
|
|
9ae3a8 |
*address |= TLB_MMIO;
|
|
|
9ae3a8 |
break;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
@@ -1722,7 +1722,7 @@ static subpage_t *subpage_init(hwaddr base)
|
|
|
9ae3a8 |
printf("%s: %p base " TARGET_FMT_plx " len %08x %d\n", __func__,
|
|
|
9ae3a8 |
mmio, base, TARGET_PAGE_SIZE, subpage_memory);
|
|
|
9ae3a8 |
#endif
|
|
|
9ae3a8 |
- subpage_register(mmio, 0, TARGET_PAGE_SIZE-1, phys_section_unassigned);
|
|
|
9ae3a8 |
+ subpage_register(mmio, 0, TARGET_PAGE_SIZE-1, PHYS_SECTION_UNASSIGNED);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
return mmio;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
@@ -1768,11 +1768,17 @@ static void mem_begin(MemoryListener *listener)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static void core_begin(MemoryListener *listener)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
+ uint16_t n;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
phys_sections_clear();
|
|
|
9ae3a8 |
- phys_section_unassigned = dummy_section(&io_mem_unassigned);
|
|
|
9ae3a8 |
- phys_section_notdirty = dummy_section(&io_mem_notdirty);
|
|
|
9ae3a8 |
- phys_section_rom = dummy_section(&io_mem_rom);
|
|
|
9ae3a8 |
- phys_section_watch = dummy_section(&io_mem_watch);
|
|
|
9ae3a8 |
+ n = dummy_section(&io_mem_unassigned);
|
|
|
9ae3a8 |
+ assert(n == PHYS_SECTION_UNASSIGNED);
|
|
|
9ae3a8 |
+ n = dummy_section(&io_mem_notdirty);
|
|
|
9ae3a8 |
+ assert(n == PHYS_SECTION_NOTDIRTY);
|
|
|
9ae3a8 |
+ n = dummy_section(&io_mem_rom);
|
|
|
9ae3a8 |
+ assert(n == PHYS_SECTION_ROM);
|
|
|
9ae3a8 |
+ n = dummy_section(&io_mem_watch);
|
|
|
9ae3a8 |
+ assert(n == PHYS_SECTION_WATCH);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static void tcg_commit(MemoryListener *listener)
|
|
|
9ae3a8 |
@@ -2440,7 +2446,7 @@ void stl_phys_notdirty(hwaddr addr, uint32_t val)
|
|
|
9ae3a8 |
if (!memory_region_is_ram(section->mr) || section->readonly) {
|
|
|
9ae3a8 |
addr = memory_region_section_addr(section, addr);
|
|
|
9ae3a8 |
if (memory_region_is_ram(section->mr)) {
|
|
|
9ae3a8 |
- section = &phys_sections[phys_section_rom];
|
|
|
9ae3a8 |
+ section = &phys_sections[PHYS_SECTION_ROM];
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
io_mem_write(section->mr, addr, val, 4);
|
|
|
9ae3a8 |
} else {
|
|
|
9ae3a8 |
@@ -2473,7 +2479,7 @@ void stq_phys_notdirty(hwaddr addr, uint64_t val)
|
|
|
9ae3a8 |
if (!memory_region_is_ram(section->mr) || section->readonly) {
|
|
|
9ae3a8 |
addr = memory_region_section_addr(section, addr);
|
|
|
9ae3a8 |
if (memory_region_is_ram(section->mr)) {
|
|
|
9ae3a8 |
- section = &phys_sections[phys_section_rom];
|
|
|
9ae3a8 |
+ section = &phys_sections[PHYS_SECTION_ROM];
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
#ifdef TARGET_WORDS_BIGENDIAN
|
|
|
9ae3a8 |
io_mem_write(section->mr, addr, val >> 32, 4);
|
|
|
9ae3a8 |
@@ -2502,7 +2508,7 @@ static inline void stl_phys_internal(hwaddr addr, uint32_t val,
|
|
|
9ae3a8 |
if (!memory_region_is_ram(section->mr) || section->readonly) {
|
|
|
9ae3a8 |
addr = memory_region_section_addr(section, addr);
|
|
|
9ae3a8 |
if (memory_region_is_ram(section->mr)) {
|
|
|
9ae3a8 |
- section = &phys_sections[phys_section_rom];
|
|
|
9ae3a8 |
+ section = &phys_sections[PHYS_SECTION_ROM];
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
#if defined(TARGET_WORDS_BIGENDIAN)
|
|
|
9ae3a8 |
if (endian == DEVICE_LITTLE_ENDIAN) {
|
|
|
9ae3a8 |
@@ -2569,7 +2575,7 @@ static inline void stw_phys_internal(hwaddr addr, uint32_t val,
|
|
|
9ae3a8 |
if (!memory_region_is_ram(section->mr) || section->readonly) {
|
|
|
9ae3a8 |
addr = memory_region_section_addr(section, addr);
|
|
|
9ae3a8 |
if (memory_region_is_ram(section->mr)) {
|
|
|
9ae3a8 |
- section = &phys_sections[phys_section_rom];
|
|
|
9ae3a8 |
+ section = &phys_sections[PHYS_SECTION_ROM];
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
#if defined(TARGET_WORDS_BIGENDIAN)
|
|
|
9ae3a8 |
if (endian == DEVICE_LITTLE_ENDIAN) {
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|