diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2013-06-14 07:51:30 -0500 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2013-06-14 07:51:30 -0500 |
commit | 5f13731f8cb6aadecf214513ec810d61dc1f71dc (patch) | |
tree | befdd804224f893f36f8c8c839ddb96e8f06e4c5 /include | |
parent | 86a6a0774509c59f1570f763a0fad57e26762d9c (diff) | |
parent | c67e216bdf42abfb8505790b2da9562356103976 (diff) |
Merge remote-tracking branch 'afaerber/qom-cpu' into staging
# By Andreas Färber (12) and others
# Via Andreas Färber
* afaerber/qom-cpu:
spapr_rtas: Abstract rtas_start_cpu() with qemu_get_cpu()
spapr_rtas: Abstract rtas_query_cpu_stopped_state() with qemu_get_cpu()
memory_mapping: Improve qemu_get_guest_memory_mapping() error reporting
dump: Abstract dump_init() with cpu_synchronize_all_states()
cpu: Change default for CPUClass::get_paging_enabled()
dump: Drop qmp_dump_guest_memory() stub and build for all targets
memory_mapping: Drop qemu_get_memory_mapping() stub
cpu: Turn cpu_get_memory_mapping() into a CPUState hook
memory_mapping: Move MemoryMappingList typedef to qemu/typedefs.h
cpu: Turn cpu_paging_enabled() into a CPUState hook
monitor: Simplify do_inject_mce() with qemu_get_cpu()
target-i386: cpu: Fix potential buffer overrun in get_register_name_32()
target-i386: Set level=4 on Conroe/Penryn/Nehalem
target-i386: Update model values on Conroe/Penryn/Nehalem CPU models
pc: Create pc-*-1.6 machine-types
pc: Fix crash when attempting to hotplug CPU with negative ID
dump: Move stubs into libqemustub.a
Diffstat (limited to 'include')
-rw-r--r-- | include/hw/i386/pc.h | 28 | ||||
-rw-r--r-- | include/qemu/typedefs.h | 2 | ||||
-rw-r--r-- | include/qom/cpu.h | 23 | ||||
-rw-r--r-- | include/sysemu/memory_mapping.h | 16 |
4 files changed, 57 insertions, 12 deletions
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 61540587a4..fab9be51cc 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -185,7 +185,35 @@ int pvpanic_init(ISABus *bus); int e820_add_entry(uint64_t, uint64_t, uint32_t); +#define PC_COMPAT_1_5 \ + {\ + .driver = "Conroe-" TYPE_X86_CPU,\ + .property = "model",\ + .value = stringify(2),\ + },{\ + .driver = "Conroe-" TYPE_X86_CPU,\ + .property = "level",\ + .value = stringify(2),\ + },{\ + .driver = "Penryn-" TYPE_X86_CPU,\ + .property = "model",\ + .value = stringify(2),\ + },{\ + .driver = "Penryn-" TYPE_X86_CPU,\ + .property = "level",\ + .value = stringify(2),\ + },{\ + .driver = "Nehalem-" TYPE_X86_CPU,\ + .property = "model",\ + .value = stringify(2),\ + },{\ + .driver = "Nehalem-" TYPE_X86_CPU,\ + .property = "level",\ + .value = stringify(2),\ + } + #define PC_COMPAT_1_4 \ + PC_COMPAT_1_5, \ {\ .driver = "scsi-hd",\ .property = "discard_granularity",\ diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h index afe4ec76e1..698fc03d78 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -22,6 +22,8 @@ typedef struct AddressSpace AddressSpace; typedef struct MemoryRegion MemoryRegion; typedef struct MemoryRegionSection MemoryRegionSection; +typedef struct MemoryMappingList MemoryMappingList; + typedef struct NICInfo NICInfo; typedef struct HCIInfo HCIInfo; typedef struct AudioState AudioState; diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 7cd9442503..a5bb515978 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -23,6 +23,7 @@ #include <signal.h> #include "hw/qdev-core.h" #include "qemu/thread.h" +#include "qemu/typedefs.h" typedef int (*WriteCoreDumpFunction)(void *buf, size_t size, void *opaque); @@ -48,6 +49,8 @@ typedef struct CPUState CPUState; * @reset: Callback to reset the #CPUState to its initial state. * @do_interrupt: Callback for interrupt handling. * @get_arch_id: Callback for getting architecture-dependent CPU ID. + * @get_paging_enabled: Callback for inquiring whether paging is enabled. + * @get_memory_mapping: Callback for obtaining the memory mappings. * @vmsd: State description for migration. * * Represents a CPU family or model. @@ -62,6 +65,9 @@ typedef struct CPUClass { void (*reset)(CPUState *cpu); void (*do_interrupt)(CPUState *cpu); int64_t (*get_arch_id)(CPUState *cpu); + bool (*get_paging_enabled)(const CPUState *cpu); + void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list, + Error **errp); const struct VMStateDescription *vmsd; int (*write_elf64_note)(WriteCoreDumpFunction f, CPUState *cpu, @@ -138,6 +144,23 @@ struct CPUState { }; /** + * cpu_paging_enabled: + * @cpu: The CPU whose state is to be inspected. + * + * Returns: %true if paging is enabled, %false otherwise. + */ +bool cpu_paging_enabled(const CPUState *cpu); + +/** + * cpu_get_memory_mapping: + * @cpu: The CPU whose memory mappings are to be obtained. + * @list: Where to write the memory mappings to. + * @errp: Pointer for reporting an #Error. + */ +void cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list, + Error **errp); + +/** * cpu_write_elf64_note: * @f: pointer to a function that writes memory to a file * @cpu: The CPU whose memory is to be dumped diff --git a/include/sysemu/memory_mapping.h b/include/sysemu/memory_mapping.h index 1256125963..6dfb68ddcd 100644 --- a/include/sysemu/memory_mapping.h +++ b/include/sysemu/memory_mapping.h @@ -15,6 +15,7 @@ #define MEMORY_MAPPING_H #include "qemu/queue.h" +#include "qemu/typedefs.h" /* The physical and virtual address in the memory mapping are contiguous. */ typedef struct MemoryMapping { @@ -24,14 +25,11 @@ typedef struct MemoryMapping { QTAILQ_ENTRY(MemoryMapping) next; } MemoryMapping; -typedef struct MemoryMappingList { +struct MemoryMappingList { unsigned int num; MemoryMapping *last_mapping; QTAILQ_HEAD(, MemoryMapping) head; -} MemoryMappingList; - -int cpu_get_memory_mapping(MemoryMappingList *list, CPUArchState *env); -bool cpu_paging_enabled(CPUArchState *env); +}; /* * add or merge the memory region [phys_addr, phys_addr + length) into the @@ -47,13 +45,7 @@ void memory_mapping_list_free(MemoryMappingList *list); void memory_mapping_list_init(MemoryMappingList *list); -/* - * Return value: - * 0: success - * -1: failed - * -2: unsupported - */ -int qemu_get_guest_memory_mapping(MemoryMappingList *list); +void qemu_get_guest_memory_mapping(MemoryMappingList *list, Error **errp); /* get guest's memory mapping without do paging(virtual address is 0). */ void qemu_get_guest_simple_memory_mapping(MemoryMappingList *list); |