diff mbox

[RFC,v0,3/5] spapr: Implement CPUClass.get_arch_id() for PowerPC CPUs

Message ID 1467693772-7391-4-git-send-email-bharata@linux.vnet.ibm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Bharata B Rao July 5, 2016, 4:42 a.m. UTC
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
---
 target-ppc/translate_init.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

David Gibson July 5, 2016, 4:58 a.m. UTC | #1
On Tue, Jul 05, 2016 at 10:12:50AM +0530, Bharata B Rao wrote:
> Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

Longer term we should probably change the field name to arch_id.  In
theory we could have something like this on a platform that didn't do
device trees.

> ---
>  target-ppc/translate_init.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
> index 8f257fb..b810624 100644
> --- a/target-ppc/translate_init.c
> +++ b/target-ppc/translate_init.c
> @@ -10357,6 +10357,13 @@ static gchar *ppc_gdb_arch_name(CPUState *cs)
>  #endif
>  }
>  
> +static int64_t ppc_cpu_get_arch_id(CPUState *cs)
> +{
> +    PowerPCCPU *cpu = POWERPC_CPU(cs);
> +
> +    return cpu->cpu_dt_id;
> +}
> +
>  static void ppc_cpu_class_init(ObjectClass *oc, void *data)
>  {
>      PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
> @@ -10409,6 +10416,7 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
>  #ifndef CONFIG_USER_ONLY
>      cc->virtio_is_big_endian = ppc_cpu_is_big_endian;
>  #endif
> +    cc->get_arch_id = ppc_cpu_get_arch_id;
>  
>      dc->fw_name = "PowerPC,UNKNOWN";
>  }
diff mbox

Patch

diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 8f257fb..b810624 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -10357,6 +10357,13 @@  static gchar *ppc_gdb_arch_name(CPUState *cs)
 #endif
 }
 
+static int64_t ppc_cpu_get_arch_id(CPUState *cs)
+{
+    PowerPCCPU *cpu = POWERPC_CPU(cs);
+
+    return cpu->cpu_dt_id;
+}
+
 static void ppc_cpu_class_init(ObjectClass *oc, void *data)
 {
     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
@@ -10409,6 +10416,7 @@  static void ppc_cpu_class_init(ObjectClass *oc, void *data)
 #ifndef CONFIG_USER_ONLY
     cc->virtio_is_big_endian = ppc_cpu_is_big_endian;
 #endif
+    cc->get_arch_id = ppc_cpu_get_arch_id;
 
     dc->fw_name = "PowerPC,UNKNOWN";
 }