From: Prerna Saxena <prerna@linux.vnet.ibm.com>
To: QEMU <qemu-devel@nongnu.org>
Cc: sPAPR <qemu-ppc@nongnu.org>,
"Alexey Kardashevisky" <aik@au1.ibm.com>,
"Andreas Färber" <afaerber@suse.de>,
"Anthony Liguori" <anthony@codemonkey.ws>,
"Alexander Graf" <agraf@suse.de>
Subject: [Qemu-devel] [PATCH 2/2] [v3] target-ppc: Enhance CPU nodes of device tree to be PAPR compliant.
Date: Thu, 8 Aug 2013 12:56:29 +0530 [thread overview]
Message-ID: <20130808125629.4e5f435d@zephyr> (raw)
In-Reply-To: <20130808125106.6b29a78c@zephyr>
From: Prerna Saxena <prerna@linux.vnet.ibm.com>
Date: Thu, 8 Aug 2013 06:38:03 +0530
Subject: [PATCH 2/2] Enhance CPU nodes of device tree to be PAPR compliant.
This is based on patch from Andreas which enables the default CPU with KVM
to show up as "-cpu <type>", such as "POWER7_V2.3@0"
While this is definitely, more descriptive, PAPR mandates the device tree CPU
node names to be of the form : "PowerPC,<name>" where <name> should not have
underscores.
Hence replacing the CPU model (which has underscores) with CPU alias.
With this patch, the CPU nodes of device tree show up as :
/proc/device-tree/cpus/PowerPC,POWER7@0/...
/proc/device-tree/cpus/PowerPC,POWER7@4/...
Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
---
hw/ppc/spapr.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 59e2fea..8efd84e 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -43,6 +43,7 @@
#include "hw/pci-host/spapr.h"
#include "hw/ppc/xics.h"
#include "hw/pci/msi.h"
+#include "cpu-models.h"
#include "hw/pci/pci.h"
@@ -80,6 +81,8 @@
#define HTAB_SIZE(spapr) (1ULL << ((spapr)->htab_shift))
+#define PPC_DEVTREE_STR "PowerPC,"
+
sPAPREnvironment *spapr;
int spapr_allocate_irq(int hint, bool lsi)
@@ -322,9 +325,16 @@ 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);
+ /*
+ * PAPR convention mandates that
+ * Device tree nodes must be named as:
+ * PowerPC,CPU-NAME@...
+ * Also, CPU-NAME must not have underscores.(hence use of CPU-ALIAS)
+ */
+
+ modelname = g_strdup_printf(PPC_DEVTREE_STR "%s", cpu_model);
- for (i = 0; i < strlen(modelname); i++) {
+ for (i = strlen(PPC_DEVTREE_STR); i < strlen(modelname); i++) {
modelname[i] = toupper(modelname[i]);
}
@@ -1315,6 +1325,14 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)
cpu_model = g_strndup(parent_name,
strlen(parent_name) - strlen("-" TYPE_POWERPC_CPU));
+
+ for (i = 0; ppc_cpu_aliases[i].model != NULL; i++) {
+ if (strcmp(ppc_cpu_aliases[i].model, cpu_model) == 0) {
+ g_free(cpu_model);
+ cpu_model = g_strndup(ppc_cpu_aliases[i].alias,
+ strlen(ppc_cpu_aliases[i].alias));
+ }
+ }
}
/* Prepare the device tree */
--
1.7.11.4
--
Prerna Saxena
Linux Technology Centre,
IBM Systems and Technology Lab,
Bangalore, India
next prev parent reply other threads:[~2013-08-08 7:32 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 ` [Qemu-devel] [PATCH 1/2] [v3] target-ppc: Get CPU name to correct reflect its model in the SLOF " Prerna Saxena
2013-08-08 7:26 ` Prerna Saxena [this message]
2013-08-08 10:34 ` [Qemu-devel] [PATCH 2/2] [v3] target-ppc: Enhance CPU nodes of device tree to be PAPR compliant 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=20130808125629.4e5f435d@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).