[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 12/16] cpu: Move CPUClass::asidx_from_attrs to CPUSystemOperation
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 12/16] cpu: Move CPUClass::asidx_from_attrs to CPUSystemOperations |
Date: |
Fri, 26 Feb 2021 17:32:23 +0100 |
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
include/hw/core/cpu.h | 8 +++++---
hw/core/cpu.c | 4 ++--
target/arm/cpu.c | 2 +-
target/i386/cpu.c | 2 +-
4 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index e8c2e9af3bb..fc3c4c217b1 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -84,6 +84,11 @@ struct AccelCPUClass;
* struct CPUSystemOperations: System operations specific to a CPU class
*/
typedef struct CPUSystemOperations {
+ /**
+ * @asidx_from_attrs: Callback to return the CPU AddressSpace to use for
+ * a memory access with the specified memory transaction attributes.
+ */
+ int (*asidx_from_attrs)(CPUState *cpu, MemTxAttrs attrs);
/**
* @get_crash_info: Callback for reporting guest crash information in
* GUEST_PANICKED events.
@@ -153,8 +158,6 @@ typedef struct CPUSystemOperations {
* associated memory transaction attributes to use for the access.
* CPUs which use memory transaction attributes should implement this
* instead of get_phys_page_debug.
- * @asidx_from_attrs: Callback to return the CPU AddressSpace to use for
- * a memory access with the specified memory transaction attributes.
* @gdb_read_register: Callback for letting GDB read a register.
* @gdb_write_register: Callback for letting GDB write a register.
* @gdb_num_core_regs: Number of core registers accessible to GDB.
@@ -196,7 +199,6 @@ struct CPUClass {
hwaddr (*get_phys_page_debug)(CPUState *cpu, vaddr addr);
hwaddr (*get_phys_page_attrs_debug)(CPUState *cpu, vaddr addr,
MemTxAttrs *attrs);
- int (*asidx_from_attrs)(CPUState *cpu, MemTxAttrs attrs);
int (*gdb_read_register)(CPUState *cpu, GByteArray *buf, int reg);
int (*gdb_write_register)(CPUState *cpu, uint8_t *buf, int reg);
diff --git a/hw/core/cpu.c b/hw/core/cpu.c
index 3dc8faf6086..d38eda36bc3 100644
--- a/hw/core/cpu.c
+++ b/hw/core/cpu.c
@@ -116,8 +116,8 @@ int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs)
CPUClass *cc = CPU_GET_CLASS(cpu);
int ret = 0;
- if (cc->asidx_from_attrs) {
- ret = cc->asidx_from_attrs(cpu, attrs);
+ if (cc->system_ops.asidx_from_attrs) {
+ ret = cc->system_ops.asidx_from_attrs(cpu, attrs);
assert(ret < cpu->num_ases && ret >= 0);
}
return ret;
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 4941a651e64..86af15b0625 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -2298,7 +2298,7 @@ static void arm_cpu_class_init(ObjectClass *oc, void
*data)
cc->gdb_write_register = arm_cpu_gdb_write_register;
#ifndef CONFIG_USER_ONLY
cc->get_phys_page_attrs_debug = arm_cpu_get_phys_page_attrs_debug;
- cc->asidx_from_attrs = arm_asidx_from_attrs;
+ cc->system_ops.asidx_from_attrs = arm_asidx_from_attrs;
cc->system_ops.vmsd = &vmstate_arm_cpu;
cc->system_ops.virtio_is_big_endian = arm_cpu_virtio_is_big_endian;
cc->system_ops.write_elf64_note = arm_cpu_write_elf64_note;
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index c34d41d4c79..36b34eee62f 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -7418,7 +7418,7 @@ static void x86_cpu_common_class_init(ObjectClass *oc,
void *data)
cc->get_paging_enabled = x86_cpu_get_paging_enabled;
#ifndef CONFIG_USER_ONLY
- cc->asidx_from_attrs = x86_asidx_from_attrs;
+ cc->system_ops.asidx_from_attrs = x86_asidx_from_attrs;
cc->get_memory_mapping = x86_cpu_get_memory_mapping;
cc->get_phys_page_attrs_debug = x86_cpu_get_phys_page_attrs_debug;
cc->system_ops.get_crash_info = x86_cpu_get_crash_info;
--
2.26.2
- [PATCH 01/16] target: Set CPUClass::vmsd instead of DeviceClass::vmsd, (continued)
- [PATCH 01/16] target: Set CPUClass::vmsd instead of DeviceClass::vmsd, Philippe Mathieu-Daudé, 2021/02/26
- [PATCH 02/16] cpu: Un-inline cpu_get_phys_page_debug and cpu_asidx_from_attrs, Philippe Mathieu-Daudé, 2021/02/26
- [PATCH 03/16] cpu: Introduce cpu_virtio_is_big_endian(), Philippe Mathieu-Daudé, 2021/02/26
- [PATCH 04/16] cpu: Directly use cpu_write_elf*() fallback handlers in place, Philippe Mathieu-Daudé, 2021/02/26
- [PATCH 05/16] cpu: Directly use get_paging_enabled() fallback handlers in place, Philippe Mathieu-Daudé, 2021/02/26
- [PATCH 06/16] cpu: Directly use get_memory_mapping() fallback handlers in place, Philippe Mathieu-Daudé, 2021/02/26
- [PATCH 07/16] cpu: Introduce CPUSystemOperations structure, Philippe Mathieu-Daudé, 2021/02/26
- [PATCH 08/16] cpu: Move CPUClass::vmsd to CPUSystemOperations, Philippe Mathieu-Daudé, 2021/02/26
- [PATCH 09/16] cpu: Move CPUClass::virtio_is_big_endian to CPUSystemOperations, Philippe Mathieu-Daudé, 2021/02/26
- [PATCH 11/16] cpu: Move CPUClass::write_elf* to CPUSystemOperations, Philippe Mathieu-Daudé, 2021/02/26
- [PATCH 12/16] cpu: Move CPUClass::asidx_from_attrs to CPUSystemOperations,
Philippe Mathieu-Daudé <=
- [PATCH 10/16] cpu: Move CPUClass::get_crash_info to CPUSystemOperations, Philippe Mathieu-Daudé, 2021/02/26
- [PATCH 13/16] cpu: Move CPUClass::get_phys_page_debug to CPUSystemOperations, Philippe Mathieu-Daudé, 2021/02/26
- [PATCH 14/16] cpu: Move CPUClass::get_memory_mapping to CPUSystemOperations, Philippe Mathieu-Daudé, 2021/02/26
- [PATCH 15/16] cpu: Move CPUClass::get_paging_enabled to CPUSystemOperations, Philippe Mathieu-Daudé, 2021/02/26
- [PATCH 16/16] cpu: Restrict cpu_paging_enabled / cpu_get_memory_mapping to sysemu, Philippe Mathieu-Daudé, 2021/02/26