summary refs log tree commit diff stats
path: root/hw/core/cpu-sysemu.c
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2021-05-17 12:51:27 +0200
committerRichard Henderson <richard.henderson@linaro.org>2021-05-26 15:33:59 -0700
commit65c57115dfeef8d344052a0e2b9d156b652be478 (patch)
tree39cfe1a543cb5af20434004f930c7680b9e7debd /hw/core/cpu-sysemu.c
parent77ba5d50bad66d56dde93e6f1c0b7a76b58ca290 (diff)
downloadfocaccia-qemu-65c57115dfeef8d344052a0e2b9d156b652be478.tar.gz
focaccia-qemu-65c57115dfeef8d344052a0e2b9d156b652be478.zip
cpu: Directly use get_memory_mapping() fallback handlers in place
No code uses CPUClass::get_memory_mapping() outside of hw/core/cpu.c:

  $ git grep -F -- '->get_memory_mapping'
  hw/core/cpu.c:87:    cc->get_memory_mapping(cpu, list, errp);
  hw/core/cpu.c:439:    k->get_memory_mapping = cpu_common_get_memory_mapping;
  target/i386/cpu.c:7422:    cc->get_memory_mapping = x86_cpu_get_memory_mapping;

Check the handler presence in place and remove the common fallback code.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210517105140.1062037-11-f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'hw/core/cpu-sysemu.c')
-rw-r--r--hw/core/cpu-sysemu.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c
index 931ba46354..aa68ca281e 100644
--- a/hw/core/cpu-sysemu.c
+++ b/hw/core/cpu-sysemu.c
@@ -33,6 +33,19 @@ bool cpu_paging_enabled(const CPUState *cpu)
     return false;
 }
 
+void cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list,
+                            Error **errp)
+{
+    CPUClass *cc = CPU_GET_CLASS(cpu);
+
+    if (cc->get_memory_mapping) {
+        cc->get_memory_mapping(cpu, list, errp);
+        return;
+    }
+
+    error_setg(errp, "Obtaining memory mappings is unsupported on this CPU.");
+}
+
 hwaddr cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr,
                                      MemTxAttrs *attrs)
 {