[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 29/29] spapr: Use DeviceClass::fw_name for device tree
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PULL 29/29] spapr: Use DeviceClass::fw_name for device tree CPU node |
Date: |
Fri, 25 Oct 2013 23:27:54 +0200 |
From: Andreas Färber <address@hidden>
Instead of relying on cpu_model, obtain the device tree node label
per CPU. Use DeviceClass::fw_name as source.
Whenever DeviceClass::fw_name is unknown, default to "PowerPC,UNKNOWN".
As a consequence, spapr_fixup_cpu_dt() can operate on each CPU's fw_name,
obsoleting sPAPREnvironment::cpu_model, and spapr_create_fdt_skel() can
drop its cpu_model argument.
Signed-off-by: Prerna Saxena <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>
Signed-off-by: Alexander Graf <address@hidden>
---
hw/ppc/spapr.c | 26 ++++++--------------------
include/hw/ppc/spapr.h | 1 -
target-ppc/translate_init.c | 2 ++
3 files changed, 8 insertions(+), 21 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index c0613e4..f76b355 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -204,9 +204,8 @@ static int spapr_fixup_cpu_dt(void *fdt, sPAPREnvironment
*spapr)
int smt = kvmppc_smt_threads();
uint32_t pft_size_prop[] = {0, cpu_to_be32(spapr->htab_shift)};
- assert(spapr->cpu_model);
-
CPU_FOREACH(cpu) {
+ DeviceClass *dc = DEVICE_GET_CLASS(cpu);
uint32_t associativity[] = {cpu_to_be32(0x5),
cpu_to_be32(0x0),
cpu_to_be32(0x0),
@@ -218,7 +217,7 @@ static int spapr_fixup_cpu_dt(void *fdt, sPAPREnvironment
*spapr)
continue;
}
- snprintf(cpu_model, 32, "/cpus/address@hidden", spapr->cpu_model,
+ snprintf(cpu_model, 32, "/cpus/address@hidden", dc->fw_name,
cpu->cpu_index);
offset = fdt_path_offset(fdt, cpu_model);
@@ -288,8 +287,7 @@ static size_t create_page_sizes_prop(CPUPPCState *env,
uint32_t *prop,
} while (0)
-static void *spapr_create_fdt_skel(const char *cpu_model,
- hwaddr initrd_base,
+static void *spapr_create_fdt_skel(hwaddr initrd_base,
hwaddr initrd_size,
hwaddr kernel_size,
bool little_endian,
@@ -306,7 +304,6 @@ static void *spapr_create_fdt_skel(const char *cpu_model,
char qemu_hypertas_prop[] = "hcall-memop1";
uint32_t refpoints[] = {cpu_to_be32(0x4), cpu_to_be32(0x4)};
uint32_t interrupt_server_ranges_prop[] = {0, cpu_to_be32(smp_cpus)};
- char *modelname;
int i, smt = kvmppc_smt_threads();
unsigned char vec5[] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x80};
@@ -365,18 +362,10 @@ static void *spapr_create_fdt_skel(const char *cpu_model,
_FDT((fdt_property_cell(fdt, "#address-cells", 0x1)));
_FDT((fdt_property_cell(fdt, "#size-cells", 0x0)));
- modelname = g_strdup(cpu_model);
-
- for (i = 0; i < strlen(modelname); i++) {
- modelname[i] = toupper(modelname[i]);
- }
-
- /* This is needed during FDT finalization */
- spapr->cpu_model = g_strdup(modelname);
-
CPU_FOREACH(cs) {
PowerPCCPU *cpu = POWERPC_CPU(cs);
CPUPPCState *env = &cpu->env;
+ DeviceClass *dc = DEVICE_GET_CLASS(cs);
PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cs);
int index = cs->cpu_index;
uint32_t servers_prop[smp_threads];
@@ -393,7 +382,7 @@ static void *spapr_create_fdt_skel(const char *cpu_model,
continue;
}
- nodename = g_strdup_printf("address@hidden", modelname, index);
+ nodename = g_strdup_printf("address@hidden", dc->fw_name, index);
_FDT((fdt_begin_node(fdt, nodename)));
@@ -477,8 +466,6 @@ static void *spapr_create_fdt_skel(const char *cpu_model,
_FDT((fdt_end_node(fdt)));
}
- g_free(modelname);
-
_FDT((fdt_end_node(fdt)));
/* RTAS */
@@ -1363,8 +1350,7 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)
&savevm_htab_handlers, spapr);
/* Prepare the device tree */
- spapr->fdt_skel = spapr_create_fdt_skel(cpu_model,
- initrd_base, initrd_size,
+ spapr->fdt_skel = spapr_create_fdt_skel(initrd_base, initrd_size,
kernel_size, kernel_le,
boot_device, kernel_cmdline,
spapr->epow_irq);
diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
index 5ae0b58..fdaab2d 100644
--- a/include/hw/ppc/spapr.h
+++ b/include/hw/ppc/spapr.h
@@ -29,7 +29,6 @@ typedef struct sPAPREnvironment {
target_ulong entry_point;
uint32_t next_irq;
uint64_t rtc_offset;
- char *cpu_model;
bool has_graphics;
uint32_t epow_irq;
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 9e29caa..47825ac 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -8587,6 +8587,8 @@ static void ppc_cpu_class_init(ObjectClass *oc, void
*data)
#else
cc->gdb_core_xml_file = "power-core.xml";
#endif
+
+ dc->fw_name = "PowerPC,UNKNOWN";
}
static const TypeInfo ppc_cpu_type_info = {
--
1.8.1.4
- [Qemu-ppc] [PULL 13/29] xics: add pre_save/post_load dispatchers, (continued)
- [Qemu-ppc] [PULL 13/29] xics: add pre_save/post_load dispatchers, Alexander Graf, 2013/10/25
- [Qemu-ppc] [PULL 14/29] xics: convert init() to realize(), Alexander Graf, 2013/10/25
- [Qemu-ppc] [PULL 18/29] xics-kvm: Support for in-kernel XICS interrupt controller, Alexander Graf, 2013/10/25
- [Qemu-ppc] [PULL 17/29] xics: add cpu_setup callback, Alexander Graf, 2013/10/25
- [Qemu-ppc] [PULL 16/29] xics: split to xics and xics-common, Alexander Graf, 2013/10/25
- [Qemu-ppc] [PULL 23/29] target-ppc: Update slb array with correct index values., Alexander Graf, 2013/10/25
- [Qemu-ppc] [PULL 06/29] spapr: increase temporary fdt buffer size, Alexander Graf, 2013/10/25
- [Qemu-ppc] [PULL 25/29] target-ppc: Use #define for max slb entries, Alexander Graf, 2013/10/25
- [Qemu-ppc] [PULL 26/29] dump-guest-memory: Check for the correct return value, Alexander Graf, 2013/10/25
- [Qemu-ppc] [PULL 24/29] target-ppc: Check for error on address translation in memsave command, Alexander Graf, 2013/10/25
- [Qemu-ppc] [PULL 29/29] spapr: Use DeviceClass::fw_name for device tree CPU node,
Alexander Graf <=
- [Qemu-ppc] [PULL 28/29] target-ppc: Fill in OpenFirmware names for some PowerPCCPU families, Alexander Graf, 2013/10/25
- [Qemu-ppc] [PULL 27/29] target-ppc: dump-guest-memory support, Alexander Graf, 2013/10/25
- Re: [Qemu-ppc] [PULL 00/29] ppc patch queue 2013-10-25, Mark Cave-Ayland, 2013/10/25
- [Qemu-ppc] [PULL 01/29] pseries: Update SLOF firmware image, Alexander Graf, 2013/10/25