All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/1] ppc-for-2.7 queue 20160815
@ 2016-08-15  6:47 David Gibson
  2016-08-15  6:47 ` [Qemu-devel] [PULL 1/1] ppc: parse cpu features once David Gibson
  2016-08-16  8:32 ` [Qemu-devel] [PULL 0/1] ppc-for-2.7 queue 20160815 Peter Maydell
  0 siblings, 2 replies; 3+ messages in thread
From: David Gibson @ 2016-08-15  6:47 UTC (permalink / raw)
  To: peter.maydell; +Cc: qemu-devel, agraf, David Gibson

The following changes since commit 6bbbb0ac136102098a70b97ab0c07bc7bf53131c:

  target-arm: Fix warn about implicit conversion (2016-08-12 11:12:24 +0100)

are available in the git repository at:

  git://github.com/dgibson/qemu.git tags/ppc-for-2.7-20160815

for you to fetch changes up to e703d2f71c0f3f721b66bd2955135524538d2c58:

  ppc: parse cpu features once (2016-08-13 17:32:58 +1000)

----------------------------------------------------------------
ppc patch queue for 2016-08-15

Just a single patch here, I hope this is the last ppc / spapr fix to
squeeze into qemu-2.7.

----------------------------------------------------------------
Greg Kurz (1):
      ppc: parse cpu features once

 hw/ppc/ppc.c         | 26 ++++++++++++++++++++++++++
 hw/ppc/spapr.c       |  2 ++
 include/hw/ppc/ppc.h |  1 +
 3 files changed, 29 insertions(+)

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

* [Qemu-devel] [PULL 1/1] ppc: parse cpu features once
  2016-08-15  6:47 [Qemu-devel] [PULL 0/1] ppc-for-2.7 queue 20160815 David Gibson
@ 2016-08-15  6:47 ` David Gibson
  2016-08-16  8:32 ` [Qemu-devel] [PULL 0/1] ppc-for-2.7 queue 20160815 Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: David Gibson @ 2016-08-15  6:47 UTC (permalink / raw)
  To: peter.maydell
  Cc: qemu-devel, agraf, Greg Kurz, Cédric Le Goater, David Gibson

From: Greg Kurz <groug@kaod.org>

Considering that features are converted to global properties and
global properties are automatically applied to every new instance
of created CPU (at object_new() time), there is no point in
parsing cpu_model string every time a CPU created. So move
parsing outside CPU creation loop and do it only once.

Parsing also should be done before any CPU is created so that
features would affect the first CPU a well.

This patch does that for all PowerPC machine types.

It is based on previous work from Bharata:

https://lists.nongnu.org/archive/html/qemu-devel/2016-06/msg07564.html

Signed-off-by: Greg Kurz <groug@kaod.org>
[clg: only kept the fix for the spapr platform. support for other
      platform will be added in 2.8 ]
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Tested-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 hw/ppc/ppc.c         | 26 ++++++++++++++++++++++++++
 hw/ppc/spapr.c       |  2 ++
 include/hw/ppc/ppc.h |  1 +
 3 files changed, 29 insertions(+)

diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
index e425252..8945869 100644
--- a/hw/ppc/ppc.c
+++ b/hw/ppc/ppc.c
@@ -33,6 +33,7 @@
 #include "hw/timer/m48t59.h"
 #include "qemu/log.h"
 #include "qemu/error-report.h"
+#include "qapi/error.h"
 #include "hw/loader.h"
 #include "sysemu/kvm.h"
 #include "kvm_ppc.h"
@@ -1350,3 +1351,28 @@ PowerPCCPU *ppc_get_vcpu_by_dt_id(int cpu_dt_id)
 
     return NULL;
 }
+
+void ppc_cpu_parse_features(const char *cpu_model)
+{
+    CPUClass *cc;
+    ObjectClass *oc;
+    const char *typename;
+    gchar **model_pieces;
+
+    model_pieces = g_strsplit(cpu_model, ",", 2);
+    if (!model_pieces[0]) {
+        error_report("Invalid/empty CPU model name");
+        exit(1);
+    }
+
+    oc = cpu_class_by_name(TYPE_POWERPC_CPU, model_pieces[0]);
+    if (oc == NULL) {
+        error_report("Unable to find CPU definition: %s", model_pieces[0]);
+        exit(1);
+    }
+
+    typename = object_class_get_name(oc);
+    cc = CPU_CLASS(oc);
+    cc->parse_features(typename, model_pieces[1], &error_fatal);
+    g_strfreev(model_pieces);
+}
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 0787c66..30d6800 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1812,6 +1812,8 @@ static void ppc_spapr_init(MachineState *machine)
         machine->cpu_model = kvm_enabled() ? "host" : "POWER7";
     }
 
+    ppc_cpu_parse_features(machine->cpu_model);
+
     if (mc->query_hotpluggable_cpus) {
         char *type = spapr_get_cpu_core_type(machine->cpu_model);
 
diff --git a/include/hw/ppc/ppc.h b/include/hw/ppc/ppc.h
index 520c72a..00c1fb1 100644
--- a/include/hw/ppc/ppc.h
+++ b/include/hw/ppc/ppc.h
@@ -106,4 +106,5 @@ enum {
 /* ppc_booke.c */
 void ppc_booke_timers_init(PowerPCCPU *cpu, uint32_t freq, uint32_t flags);
 
+void ppc_cpu_parse_features(const char *cpu_model);
 #endif
-- 
2.7.4

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

* Re: [Qemu-devel] [PULL 0/1] ppc-for-2.7 queue 20160815
  2016-08-15  6:47 [Qemu-devel] [PULL 0/1] ppc-for-2.7 queue 20160815 David Gibson
  2016-08-15  6:47 ` [Qemu-devel] [PULL 1/1] ppc: parse cpu features once David Gibson
@ 2016-08-16  8:32 ` Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2016-08-16  8:32 UTC (permalink / raw)
  To: David Gibson; +Cc: QEMU Developers, Alexander Graf

On 15 August 2016 at 07:47, David Gibson <david@gibson.dropbear.id.au> wrote:
> The following changes since commit 6bbbb0ac136102098a70b97ab0c07bc7bf53131c:
>
>   target-arm: Fix warn about implicit conversion (2016-08-12 11:12:24 +0100)
>
> are available in the git repository at:
>
>   git://github.com/dgibson/qemu.git tags/ppc-for-2.7-20160815
>
> for you to fetch changes up to e703d2f71c0f3f721b66bd2955135524538d2c58:
>
>   ppc: parse cpu features once (2016-08-13 17:32:58 +1000)
>
> ----------------------------------------------------------------
> ppc patch queue for 2016-08-15
>
> Just a single patch here, I hope this is the last ppc / spapr fix to
> squeeze into qemu-2.7.
>
> ----------------------------------------------------------------
> Greg Kurz (1):
>       ppc: parse cpu features once

Applied, thanks.

-- PMM

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

end of thread, other threads:[~2016-08-16  8:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-15  6:47 [Qemu-devel] [PULL 0/1] ppc-for-2.7 queue 20160815 David Gibson
2016-08-15  6:47 ` [Qemu-devel] [PULL 1/1] ppc: parse cpu features once David Gibson
2016-08-16  8:32 ` [Qemu-devel] [PULL 0/1] ppc-for-2.7 queue 20160815 Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.