qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for-next] spapr: Avoid "HOST@0" CPU node name in SLOF device tree for -cpu host
@ 2013-08-01  1:02 Andreas Färber
  2013-08-08  5:15 ` Prerna Saxena
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Färber @ 2013-08-01  1:02 UTC (permalink / raw)
  To: qemu-devel
  Cc: Alexey Kardashevskiy, Alexander Graf, open list:sPAPR,
	Anthony Liguori, Prerna Saxena, Andreas Färber

By default on KVM or when user asks for it via -cpu host, cpu_model will
be "host" and sPAPR merely upper-cases it for the SLOF device tree.

Change it so that we get the underlying CPU type, e.g., "POWER7_V2.3@0".

Reported-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 This avoids a PVR based lookup in common code.
 Tested with local patches for POWER5+_v2.1 support and modified SLOF.

 hw/ppc/spapr.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 16bfab9..95579b9 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1072,7 +1072,7 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)
     const char *kernel_cmdline = args->kernel_cmdline;
     const char *initrd_filename = args->initrd_filename;
     const char *boot_device = args->boot_device;
-    PowerPCCPU *cpu;
+    PowerPCCPU *cpu = NULL;
     CPUPPCState *env;
     PCIHostState *phb;
     int i;
@@ -1307,6 +1307,15 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)
     register_savevm_live(NULL, "spapr/htab", -1, 1,
                          &savevm_htab_handlers, spapr);
 
+    if (kvm_enabled() && strcmp(cpu_model, "host") == 0) {
+        ObjectClass *cpu_class = object_get_class(OBJECT(cpu));
+        ObjectClass *parent_cpu_class = object_class_get_parent(cpu_class);
+        const char *parent_name = object_class_get_name(parent_cpu_class);
+
+        cpu_model = g_strndup(parent_name,
+            strlen(parent_name) - strlen("-" TYPE_POWERPC_CPU));
+    }
+
     /* Prepare the device tree */
     spapr->fdt_skel = spapr_create_fdt_skel(cpu_model,
                                             initrd_base, initrd_size,
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH for-next] spapr: Avoid "HOST@0" CPU node name in SLOF device tree for -cpu host
  2013-08-01  1:02 [Qemu-devel] [PATCH for-next] spapr: Avoid "HOST@0" CPU node name in SLOF device tree for -cpu host Andreas Färber
@ 2013-08-08  5:15 ` Prerna Saxena
  2013-08-09 11:34   ` Andreas Färber
  0 siblings, 1 reply; 3+ messages in thread
From: Prerna Saxena @ 2013-08-08  5:15 UTC (permalink / raw)
  To: Andreas Färber
  Cc: Alexey Kardashevskiy, sPAPR, qemu-devel, Anthony Liguori,
	Alexander Graf

On 08/01/2013 06:32 AM, Andreas Färber wrote:
> By default on KVM or when user asks for it via -cpu host, cpu_model will
> be "host" and sPAPR merely upper-cases it for the SLOF device tree.
> 
> Change it so that we get the underlying CPU type, e.g., "POWER7_V2.3@0".
> 
> Reported-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> ---

ACK.
Reviewed and tested --Works as expected.

I'll send out an updated follow-up patch later in the day which ensures
PAPR compliance for nomenclature.

Regards,
-- 
Prerna Saxena

Linux Technology Centre,
IBM Systems and Technology Lab,
Bangalore, India

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH for-next] spapr: Avoid "HOST@0" CPU node name in SLOF device tree for -cpu host
  2013-08-08  5:15 ` Prerna Saxena
@ 2013-08-09 11:34   ` Andreas Färber
  0 siblings, 0 replies; 3+ messages in thread
From: Andreas Färber @ 2013-08-09 11:34 UTC (permalink / raw)
  To: Prerna Saxena
  Cc: Alexey Kardashevskiy, sPAPR, qemu-devel, Anthony Liguori,
	Alexander Graf

Am 08.08.2013 07:15, schrieb Prerna Saxena:
> On 08/01/2013 06:32 AM, Andreas Färber wrote:
>> By default on KVM or when user asks for it via -cpu host, cpu_model will
>> be "host" and sPAPR merely upper-cases it for the SLOF device tree.
>>
>> Change it so that we get the underlying CPU type, e.g., "POWER7_V2.3@0".
>>
>> Reported-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
>> Signed-off-by: Andreas Färber <afaerber@suse.de>
>> ---
> 
> ACK.
> Reviewed and tested --Works as expected.

Thanks. Looking deeper into the issue I have come up with a simpler
solution that will obsolete this patch.

Andreas

> 
> I'll send out an updated follow-up patch later in the day which ensures
> PAPR compliance for nomenclature.
> 
> Regards,
> 


-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-08-09 11:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-01  1:02 [Qemu-devel] [PATCH for-next] spapr: Avoid "HOST@0" CPU node name in SLOF device tree for -cpu host Andreas Färber
2013-08-08  5:15 ` Prerna Saxena
2013-08-09 11:34   ` Andreas Färber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).