All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH V2 0/4] target-openrisc hw/openrisc: Some OpenRISC fix.
@ 2013-07-16  2:00 Jia Liu
  2013-07-16  2:00 ` [Qemu-devel] [PATCH V2 1/4] hw/openrisc: Indent typo Jia Liu
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Jia Liu @ 2013-07-16  2:00 UTC (permalink / raw)
  To: qemu-devel

Fix OpenRISC CPU and sim broad, we should free typename and check cpu models
by name in cpu.c, and we should use stderr output in openrisc_sim.c.

Jia Liu (4):
  hw/openrisc: Indent typo
  hw/openrisc: Use stderr output instead of qemu_log
  target-openrisc: Free typename
  target-openrisc: Fix cpu_model by name

 hw/openrisc/openrisc_sim.c |  8 ++++----
 target-openrisc/cpu.c      | 17 +++++++++++++----
 2 files changed, 17 insertions(+), 8 deletions(-)

-- 
1.7.12.4 (Apple Git-37)

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

* [Qemu-devel] [PATCH V2 1/4] hw/openrisc: Indent typo
  2013-07-16  2:00 [Qemu-devel] [PATCH V2 0/4] target-openrisc hw/openrisc: Some OpenRISC fix Jia Liu
@ 2013-07-16  2:00 ` Jia Liu
  2013-07-16  2:00 ` [Qemu-devel] [PATCH V2 2/4] hw/openrisc: Use stderr output instead of qemu_log Jia Liu
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Jia Liu @ 2013-07-16  2:00 UTC (permalink / raw)
  To: qemu-devel

Indent typo.

Signed-off-by: Jia Liu <proljc@gmail.com>
---
 hw/openrisc/openrisc_sim.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c
index 924438b..f0dabb9 100644
--- a/hw/openrisc/openrisc_sim.c
+++ b/hw/openrisc/openrisc_sim.c
@@ -83,7 +83,7 @@ static void cpu_openrisc_load_kernel(ram_addr_t ram_size,
 
         if (kernel_size < 0) {
             qemu_log("QEMU: couldn't load the kernel '%s'\n",
-                    kernel_filename);
+                     kernel_filename);
             exit(1);
         }
     }
@@ -96,7 +96,7 @@ static void openrisc_sim_init(QEMUMachineInitArgs *args)
     ram_addr_t ram_size = args->ram_size;
     const char *cpu_model = args->cpu_model;
     const char *kernel_filename = args->kernel_filename;
-   OpenRISCCPU *cpu = NULL;
+    OpenRISCCPU *cpu = NULL;
     MemoryRegion *ram;
     int n;
 
-- 
1.7.12.4 (Apple Git-37)

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

* [Qemu-devel] [PATCH V2 2/4] hw/openrisc: Use stderr output instead of qemu_log
  2013-07-16  2:00 [Qemu-devel] [PATCH V2 0/4] target-openrisc hw/openrisc: Some OpenRISC fix Jia Liu
  2013-07-16  2:00 ` [Qemu-devel] [PATCH V2 1/4] hw/openrisc: Indent typo Jia Liu
@ 2013-07-16  2:00 ` Jia Liu
  2013-07-16  2:00 ` [Qemu-devel] [PATCH 3/4] target-openrisc: Free typename Jia Liu
  2013-07-16  2:00 ` [Qemu-devel] [PATCH 4/4] target-openrisc: Fix cpu_model by name Jia Liu
  3 siblings, 0 replies; 9+ messages in thread
From: Jia Liu @ 2013-07-16  2:00 UTC (permalink / raw)
  To: qemu-devel

We should use stderr output instead of qemu_log in order to output ErrMsg
onto the screen.

Signed-off-by: Jia Liu <proljc@gmail.com>
---
 hw/openrisc/openrisc_sim.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c
index f0dabb9..9f0d9be 100644
--- a/hw/openrisc/openrisc_sim.c
+++ b/hw/openrisc/openrisc_sim.c
@@ -82,8 +82,8 @@ static void cpu_openrisc_load_kernel(ram_addr_t ram_size,
         }
 
         if (kernel_size < 0) {
-            qemu_log("QEMU: couldn't load the kernel '%s'\n",
-                     kernel_filename);
+            printf(stderr, "QEMU: couldn't load the kernel '%s'\n",
+                   kernel_filename);
             exit(1);
         }
     }
@@ -107,7 +107,7 @@ static void openrisc_sim_init(QEMUMachineInitArgs *args)
     for (n = 0; n < smp_cpus; n++) {
         cpu = cpu_openrisc_init(cpu_model);
         if (cpu == NULL) {
-            qemu_log("Unable to find CPU definition!\n");
+            fprintf(stderr, "Unable to find CPU definition!\n");
             exit(1);
         }
         qemu_register_reset(main_cpu_reset, cpu);
-- 
1.7.12.4 (Apple Git-37)

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

* [Qemu-devel] [PATCH 3/4] target-openrisc: Free typename
  2013-07-16  2:00 [Qemu-devel] [PATCH V2 0/4] target-openrisc hw/openrisc: Some OpenRISC fix Jia Liu
  2013-07-16  2:00 ` [Qemu-devel] [PATCH V2 1/4] hw/openrisc: Indent typo Jia Liu
  2013-07-16  2:00 ` [Qemu-devel] [PATCH V2 2/4] hw/openrisc: Use stderr output instead of qemu_log Jia Liu
@ 2013-07-16  2:00 ` Jia Liu
  2013-07-16  2:05   ` Jia Liu
  2013-07-16 14:19   ` Andreas Färber
  2013-07-16  2:00 ` [Qemu-devel] [PATCH 4/4] target-openrisc: Fix cpu_model by name Jia Liu
  3 siblings, 2 replies; 9+ messages in thread
From: Jia Liu @ 2013-07-16  2:00 UTC (permalink / raw)
  To: qemu-devel

We should free typename here.

Signed-off-by: Jia Liu <proljc@gmail.com>
---
 target-openrisc/cpu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target-openrisc/cpu.c b/target-openrisc/cpu.c
index 6d40f1b..e348df0 100644
--- a/target-openrisc/cpu.c
+++ b/target-openrisc/cpu.c
@@ -99,6 +99,7 @@ static ObjectClass *openrisc_cpu_class_by_name(const char *cpu_model)
 
     typename = g_strdup_printf("%s-" TYPE_OPENRISC_CPU, cpu_model);
     oc = object_class_by_name(typename);
+    g_free(typename);
     if (oc != NULL && (!object_class_dynamic_cast(oc, TYPE_OPENRISC_CPU) ||
                        object_class_is_abstract(oc))) {
         return NULL;
-- 
1.7.12.4 (Apple Git-37)

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

* [Qemu-devel] [PATCH 4/4] target-openrisc: Fix cpu_model by name
  2013-07-16  2:00 [Qemu-devel] [PATCH V2 0/4] target-openrisc hw/openrisc: Some OpenRISC fix Jia Liu
                   ` (2 preceding siblings ...)
  2013-07-16  2:00 ` [Qemu-devel] [PATCH 3/4] target-openrisc: Free typename Jia Liu
@ 2013-07-16  2:00 ` Jia Liu
  2013-07-16  2:06   ` Jia Liu
  3 siblings, 1 reply; 9+ messages in thread
From: Jia Liu @ 2013-07-16  2:00 UTC (permalink / raw)
  To: qemu-devel

Fix cpu_model by name, make any and or1200 works both OK.

Signed-off-by: Jia Liu <proljc@gmail.com>
---
 target-openrisc/cpu.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/target-openrisc/cpu.c b/target-openrisc/cpu.c
index e348df0..6637166 100644
--- a/target-openrisc/cpu.c
+++ b/target-openrisc/cpu.c
@@ -100,11 +100,19 @@ static ObjectClass *openrisc_cpu_class_by_name(const char *cpu_model)
     typename = g_strdup_printf("%s-" TYPE_OPENRISC_CPU, cpu_model);
     oc = object_class_by_name(typename);
     g_free(typename);
-    if (oc != NULL && (!object_class_dynamic_cast(oc, TYPE_OPENRISC_CPU) ||
-                       object_class_is_abstract(oc))) {
-        return NULL;
+
+    if (oc != NULL && object_class_dynamic_cast(oc, TYPE_OPENRISC_CPU) != NULL
+        && !object_class_is_abstract(oc)) {
+        return oc;
     }
-    return oc;
+
+    oc = object_class_by_name(cpu_model);
+    if (oc != NULL && object_class_dynamic_cast(oc, TYPE_OPENRISC_CPU) != NULL
+        && !object_class_is_abstract(oc)) {
+        return oc;
+    }
+
+    return NULL;
 }
 
 static void or1200_initfn(Object *obj)
-- 
1.7.12.4 (Apple Git-37)

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

* Re: [Qemu-devel] [PATCH 3/4] target-openrisc: Free typename
  2013-07-16  2:00 ` [Qemu-devel] [PATCH 3/4] target-openrisc: Free typename Jia Liu
@ 2013-07-16  2:05   ` Jia Liu
  2013-07-16 14:19   ` Andreas Färber
  1 sibling, 0 replies; 9+ messages in thread
From: Jia Liu @ 2013-07-16  2:05 UTC (permalink / raw)
  To: qemu-devel

On Tue, Jul 16, 2013 at 10:00 AM, Jia Liu <proljc@gmail.com> wrote:
> We should free typename here.
>

Sorry, I forgot add V2 in title.

> Signed-off-by: Jia Liu <proljc@gmail.com>
> ---
>  target-openrisc/cpu.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/target-openrisc/cpu.c b/target-openrisc/cpu.c
> index 6d40f1b..e348df0 100644
> --- a/target-openrisc/cpu.c
> +++ b/target-openrisc/cpu.c
> @@ -99,6 +99,7 @@ static ObjectClass *openrisc_cpu_class_by_name(const char *cpu_model)
>
>      typename = g_strdup_printf("%s-" TYPE_OPENRISC_CPU, cpu_model);
>      oc = object_class_by_name(typename);
> +    g_free(typename);
>      if (oc != NULL && (!object_class_dynamic_cast(oc, TYPE_OPENRISC_CPU) ||
>                         object_class_is_abstract(oc))) {
>          return NULL;
> --
> 1.7.12.4 (Apple Git-37)
>

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

* Re: [Qemu-devel] [PATCH 4/4] target-openrisc: Fix cpu_model by name
  2013-07-16  2:00 ` [Qemu-devel] [PATCH 4/4] target-openrisc: Fix cpu_model by name Jia Liu
@ 2013-07-16  2:06   ` Jia Liu
  0 siblings, 0 replies; 9+ messages in thread
From: Jia Liu @ 2013-07-16  2:06 UTC (permalink / raw)
  To: qemu-devel

On Tue, Jul 16, 2013 at 10:00 AM, Jia Liu <proljc@gmail.com> wrote:
> Fix cpu_model by name, make any and or1200 works both OK.
>

Sorry, I forgot add V2 in title.

> Signed-off-by: Jia Liu <proljc@gmail.com>
> ---
>  target-openrisc/cpu.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/target-openrisc/cpu.c b/target-openrisc/cpu.c
> index e348df0..6637166 100644
> --- a/target-openrisc/cpu.c
> +++ b/target-openrisc/cpu.c
> @@ -100,11 +100,19 @@ static ObjectClass *openrisc_cpu_class_by_name(const char *cpu_model)
>      typename = g_strdup_printf("%s-" TYPE_OPENRISC_CPU, cpu_model);
>      oc = object_class_by_name(typename);
>      g_free(typename);
> -    if (oc != NULL && (!object_class_dynamic_cast(oc, TYPE_OPENRISC_CPU) ||
> -                       object_class_is_abstract(oc))) {
> -        return NULL;
> +
> +    if (oc != NULL && object_class_dynamic_cast(oc, TYPE_OPENRISC_CPU) != NULL
> +        && !object_class_is_abstract(oc)) {
> +        return oc;
>      }
> -    return oc;
> +
> +    oc = object_class_by_name(cpu_model);
> +    if (oc != NULL && object_class_dynamic_cast(oc, TYPE_OPENRISC_CPU) != NULL
> +        && !object_class_is_abstract(oc)) {
> +        return oc;
> +    }
> +
> +    return NULL;
>  }
>
>  static void or1200_initfn(Object *obj)
> --
> 1.7.12.4 (Apple Git-37)
>

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

* Re: [Qemu-devel] [PATCH 3/4] target-openrisc: Free typename
  2013-07-16  2:00 ` [Qemu-devel] [PATCH 3/4] target-openrisc: Free typename Jia Liu
  2013-07-16  2:05   ` Jia Liu
@ 2013-07-16 14:19   ` Andreas Färber
  2013-07-17  1:34     ` Jia Liu
  1 sibling, 1 reply; 9+ messages in thread
From: Andreas Färber @ 2013-07-16 14:19 UTC (permalink / raw)
  To: Jia Liu; +Cc: qemu-devel

Am 16.07.2013 04:00, schrieb Jia Liu:
> We should free typename here.
> 
> Signed-off-by: Jia Liu <proljc@gmail.com>
> ---
>  target-openrisc/cpu.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/target-openrisc/cpu.c b/target-openrisc/cpu.c
> index 6d40f1b..e348df0 100644
> --- a/target-openrisc/cpu.c
> +++ b/target-openrisc/cpu.c
> @@ -99,6 +99,7 @@ static ObjectClass *openrisc_cpu_class_by_name(const char *cpu_model)
>  
>      typename = g_strdup_printf("%s-" TYPE_OPENRISC_CPU, cpu_model);
>      oc = object_class_by_name(typename);
> +    g_free(typename);
>      if (oc != NULL && (!object_class_dynamic_cast(oc, TYPE_OPENRISC_CPU) ||
>                         object_class_is_abstract(oc))) {
>          return NULL;

Reviewed-by: Andreas Färber <afaerber@suse.de>

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

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

* Re: [Qemu-devel] [PATCH 3/4] target-openrisc: Free typename
  2013-07-16 14:19   ` Andreas Färber
@ 2013-07-17  1:34     ` Jia Liu
  0 siblings, 0 replies; 9+ messages in thread
From: Jia Liu @ 2013-07-17  1:34 UTC (permalink / raw)
  To: Andreas Färber; +Cc: qemu-devel

Hi Andreas,

On Tue, Jul 16, 2013 at 10:19 PM, Andreas Färber <afaerber@suse.de> wrote:
> Am 16.07.2013 04:00, schrieb Jia Liu:
>> We should free typename here.
>>
>> Signed-off-by: Jia Liu <proljc@gmail.com>
>> ---
>>  target-openrisc/cpu.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/target-openrisc/cpu.c b/target-openrisc/cpu.c
>> index 6d40f1b..e348df0 100644
>> --- a/target-openrisc/cpu.c
>> +++ b/target-openrisc/cpu.c
>> @@ -99,6 +99,7 @@ static ObjectClass *openrisc_cpu_class_by_name(const char *cpu_model)
>>
>>      typename = g_strdup_printf("%s-" TYPE_OPENRISC_CPU, cpu_model);
>>      oc = object_class_by_name(typename);
>> +    g_free(typename);
>>      if (oc != NULL && (!object_class_dynamic_cast(oc, TYPE_OPENRISC_CPU) ||
>>                         object_class_is_abstract(oc))) {
>>          return NULL;
>
> Reviewed-by: Andreas Färber <afaerber@suse.de>

Thank you, Andreas.
May you want to review the other three? :) I've tested them all.

>
> Andreas
>
> --
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

Regards,
Jia.

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

end of thread, other threads:[~2013-07-17  1:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-16  2:00 [Qemu-devel] [PATCH V2 0/4] target-openrisc hw/openrisc: Some OpenRISC fix Jia Liu
2013-07-16  2:00 ` [Qemu-devel] [PATCH V2 1/4] hw/openrisc: Indent typo Jia Liu
2013-07-16  2:00 ` [Qemu-devel] [PATCH V2 2/4] hw/openrisc: Use stderr output instead of qemu_log Jia Liu
2013-07-16  2:00 ` [Qemu-devel] [PATCH 3/4] target-openrisc: Free typename Jia Liu
2013-07-16  2:05   ` Jia Liu
2013-07-16 14:19   ` Andreas Färber
2013-07-17  1:34     ` Jia Liu
2013-07-16  2:00 ` [Qemu-devel] [PATCH 4/4] target-openrisc: Fix cpu_model by name Jia Liu
2013-07-16  2:06   ` Jia Liu

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.