qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Prerna Saxena <prerna@linux.vnet.ibm.com>
To: Prerna Saxena <prerna@linux.vnet.ibm.com>
Cc: "Alexey Kardashevisky" <aik@au1.ibm.com>,
	"Alexander Graf" <agraf@suse.de>, QEMU <qemu-devel@nongnu.org>,
	sPAPR <qemu-ppc@nongnu.org>,
	"Anthony Liguori" <anthony@codemonkey.ws>,
	"Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [PATCH 1/2] [v3] target-ppc: Get CPU name to correct reflect its model in the SLOF device tree.
Date: Thu, 8 Aug 2013 12:54:55 +0530	[thread overview]
Message-ID: <20130808125455.2ba5a8b4@zephyr> (raw)
In-Reply-To: <20130808125106.6b29a78c@zephyr>

From: Andreas Farber <afaerber@suse.de>
Date: Wed, 7 Aug 2013 14:50:41 +0530
Subject: [PATCH 1/2] 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".

Tested-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/ppc/spapr.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 16bfab9..59e2fea 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,16 @@ 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.7.11.4


-- 
Prerna Saxena

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

  reply	other threads:[~2013-08-08  7:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-08  7:21 [Qemu-devel] [PATCH 0/2] [v3] target-ppc: Enhance CPU nodes of SPAPR-generated device tree Prerna Saxena
2013-08-08  7:24 ` Prerna Saxena [this message]
2013-08-08  7:26 ` [Qemu-devel] [PATCH 2/2] [v3] target-ppc: Enhance CPU nodes of device tree to be PAPR compliant Prerna Saxena
2013-08-08 10:34   ` Andreas Färber
2013-08-12  4:37     ` Prerna Saxena
2013-08-12  6:03       ` [Qemu-devel] [Qemu-ppc] " Benjamin Herrenschmidt
2013-08-12 19:17         ` Thomas Huth
2013-08-12 21:22           ` Benjamin Herrenschmidt
2013-08-14 10:18             ` Alexander Graf
2013-08-14 10:31               ` Andreas Färber
2013-08-14 11:04               ` Andreas Färber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130808125455.2ba5a8b4@zephyr \
    --to=prerna@linux.vnet.ibm.com \
    --cc=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=aik@au1.ibm.com \
    --cc=anthony@codemonkey.ws \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).