All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] msf2: drop cpu_model to directly use cpu type
@ 2017-09-18 22:11 Philippe Mathieu-Daudé
  2017-09-19  2:08 ` Fam Zheng
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-09-18 22:11 UTC (permalink / raw)
  To: Igor Mammedov, Eduardo Habkost, Subbaraya Sundeep,
	Alistair Francis, Peter Maydell
  Cc: Philippe Mathieu-Daudé, qemu-devel, qemu-arm, Fam Zheng

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
after Igor comment:
http://lists.nongnu.org/archive/html/qemu-devel/2017-09/msg04709.html

Fam: I'm trying your patchew "apply over series" feature on these 2 series,
     hoping they get both applied before my patch:

Based-on: 1505318697-77161-6-git-send-email-imammedo@redhat.com
Based-on: 1505762601-27143-6-git-send-email-sundeep.lkml@gmail.com

 include/hw/arm/msf2-soc.h |  1 +
 hw/arm/msf2-soc.c         |  3 ++-
 hw/arm/msf2-som.c         | 11 +++++++++++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/include/hw/arm/msf2-soc.h b/include/hw/arm/msf2-soc.h
index afea23db38..3cfe5c76ee 100644
--- a/include/hw/arm/msf2-soc.h
+++ b/include/hw/arm/msf2-soc.h
@@ -50,6 +50,7 @@ typedef struct MSF2State {
 
     ARMv7MState armv7m;
 
+    char *cpu_type;
     char *part_name;
     uint64_t envm_size;
     uint64_t esram_size;
diff --git a/hw/arm/msf2-soc.c b/hw/arm/msf2-soc.c
index abba3d888b..6f97fa9fe3 100644
--- a/hw/arm/msf2-soc.c
+++ b/hw/arm/msf2-soc.c
@@ -111,7 +111,7 @@ static void m2sxxx_soc_realize(DeviceState *dev_soc, Error **errp)
 
     armv7m = DEVICE(&s->armv7m);
     qdev_prop_set_uint32(armv7m, "num-irq", 81);
-    qdev_prop_set_string(armv7m, "cpu-model", "cortex-m3");
+    qdev_prop_set_string(armv7m, "cpu-type", s->cpu_type);
     object_property_set_link(OBJECT(&s->armv7m), OBJECT(get_system_memory()),
                                      "memory", &error_abort);
     object_property_set_bool(OBJECT(&s->armv7m), true, "realized", &err);
@@ -201,6 +201,7 @@ static Property m2sxxx_soc_properties[] = {
      * part name specifies the type of SmartFusion2 device variant(this
      * property is for information purpose only.
      */
+    DEFINE_PROP_STRING("cpu-type", MSF2State, cpu_type),
     DEFINE_PROP_STRING("part-name", MSF2State, part_name),
     DEFINE_PROP_UINT64("eNVM-size", MSF2State, envm_size, MSF2_ENVM_MAX_SIZE),
     DEFINE_PROP_UINT64("eSRAM-size", MSF2State, esram_size,
diff --git a/hw/arm/msf2-som.c b/hw/arm/msf2-som.c
index d3956965ab..0795a3a3a1 100644
--- a/hw/arm/msf2-som.c
+++ b/hw/arm/msf2-som.c
@@ -24,11 +24,13 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "qemu/error-report.h"
 #include "hw/boards.h"
 #include "hw/arm/arm.h"
 #include "exec/address-spaces.h"
 #include "qemu/cutils.h"
 #include "hw/arm/msf2-soc.h"
+#include "cpu.h"
 
 #define DDR_BASE_ADDRESS      0xA0000000
 #define DDR_SIZE              (64 * M_BYTE)
@@ -41,18 +43,26 @@ static void emcraft_sf2_s2s010_init(MachineState *machine)
     DeviceState *dev;
     DeviceState *spi_flash;
     MSF2State *soc;
+    MachineClass *mc = MACHINE_GET_CLASS(machine);
     DriveInfo *dinfo = drive_get_next(IF_MTD);
     qemu_irq cs_line;
     SSIBus *spi_bus;
     MemoryRegion *sysmem = get_system_memory();
     MemoryRegion *ddr = g_new(MemoryRegion, 1);
 
+    if (strcmp(machine->cpu_type, mc->default_cpu_type) != 0) {
+        error_report("This board can only be used with CPU %s",
+                     mc->default_cpu_type);
+    }
+
     memory_region_init_ram(ddr, NULL, "ddr-ram", DDR_SIZE,
                            &error_fatal);
     memory_region_add_subregion(sysmem, DDR_BASE_ADDRESS, ddr);
 
     dev = qdev_create(NULL, TYPE_MSF2_SOC);
     qdev_prop_set_string(dev, "part-name", "M2S010");
+    qdev_prop_set_string(dev, "cpu-type", mc->default_cpu_type);
+
     qdev_prop_set_uint64(dev, "eNVM-size", M2S010_ENVM_SIZE);
     qdev_prop_set_uint64(dev, "eSRAM-size", M2S010_ESRAM_SIZE);
 
@@ -89,6 +99,7 @@ static void emcraft_sf2_machine_init(MachineClass *mc)
 {
     mc->desc = "SmartFusion2 SOM kit from Emcraft (M2S010)";
     mc->init = emcraft_sf2_s2s010_init;
+    mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-m3");
 }
 
 DEFINE_MACHINE("emcraft-sf2", emcraft_sf2_machine_init)
-- 
2.14.1

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

* Re: [Qemu-devel] [PATCH] msf2: drop cpu_model to directly use cpu type
  2017-09-18 22:11 [Qemu-devel] [PATCH] msf2: drop cpu_model to directly use cpu type Philippe Mathieu-Daudé
@ 2017-09-19  2:08 ` Fam Zheng
  2017-09-19  9:48   ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 3+ messages in thread
From: Fam Zheng @ 2017-09-19  2:08 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Igor Mammedov, Eduardo Habkost, Subbaraya Sundeep,
	Alistair Francis, Peter Maydell, qemu-devel, qemu-arm

On Mon, 09/18 19:11, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> after Igor comment:
> http://lists.nongnu.org/archive/html/qemu-devel/2017-09/msg04709.html
> 
> Fam: I'm trying your patchew "apply over series" feature on these 2 series,
>      hoping they get both applied before my patch:
> 
> Based-on: 1505318697-77161-6-git-send-email-imammedo@redhat.com
> Based-on: 1505762601-27143-6-git-send-email-sundeep.lkml@gmail.com

Only one based-on will be picked up, so this doesn't work. Patchew basically
applies the series on top of something, where something is the result of a
previous applying. So it can be thought of a chain.

To support multiple patches, a different approach needs to be implemented.

Fam

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

* Re: [Qemu-devel] [PATCH] msf2: drop cpu_model to directly use cpu type
  2017-09-19  2:08 ` Fam Zheng
@ 2017-09-19  9:48   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-09-19  9:48 UTC (permalink / raw)
  To: Fam Zheng
  Cc: Peter Maydell, Eduardo Habkost, qemu-devel, Alistair Francis,
	qemu-arm, Igor Mammedov, Subbaraya Sundeep

On 09/18/2017 11:08 PM, Fam Zheng wrote:
> On Mon, 09/18 19:11, Philippe Mathieu-Daudé wrote:
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>> after Igor comment:
>> http://lists.nongnu.org/archive/html/qemu-devel/2017-09/msg04709.html
>>
>> Fam: I'm trying your patchew "apply over series" feature on these 2 series,
>>       hoping they get both applied before my patch:
>>
>> Based-on: 1505318697-77161-6-git-send-email-imammedo@redhat.com
>> Based-on: 1505762601-27143-6-git-send-email-sundeep.lkml@gmail.com
> 
> Only one based-on will be picked up, so this doesn't work. Patchew basically
> applies the series on top of something, where something is the result of a
> previous applying. So it can be thought of a chain.

OK, here I used each series trail, luckily they apply independently.
It seems your script only kept/used then last Based-on.

> 
> To support multiple patches, a different approach needs to be implemented.
> 
> Fam
> 

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

end of thread, other threads:[~2017-09-19  9:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-18 22:11 [Qemu-devel] [PATCH] msf2: drop cpu_model to directly use cpu type Philippe Mathieu-Daudé
2017-09-19  2:08 ` Fam Zheng
2017-09-19  9:48   ` Philippe Mathieu-Daudé

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.