Patchwork target-xtensa: make 'sim' to be the default machine

login
register
mail settings
Submitter Max Filippov
Date Aug. 8, 2012, 11:31 p.m.
Message ID <1344468698-9768-1-git-send-email-jcmvbkbc@gmail.com>
Download mbox | patch
Permalink /patch/175972/
State New
Headers show

Comments

Max Filippov - Aug. 8, 2012, 11:31 p.m.
This fixes the following error:

    $ qemu-system-xtensa -cpu help
    Segmentation fault

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
 hw/xtensa_sim.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Markus Armbruster - Aug. 9, 2012, 7:43 a.m.
Max Filippov <jcmvbkbc@gmail.com> writes:

> This fixes the following error:
>
>     $ qemu-system-xtensa -cpu help
>     Segmentation fault

main() attempts to cope with "no machine found", it just screws it up:

    if (machine->hw_version) {
        qemu_set_version(machine->hw_version);
    }
[...]
    if (machine == NULL) {
        fprintf(stderr, "No machine found.\n");
        exit(1);
    }

Probably broken in commit 93bfef4c, cc'ing its author.

Of course, I don't mind you picking a default machine for xtensa, if
that's what you want.
dunrong huang - Aug. 9, 2012, 7:52 a.m.
2012/8/9 Markus Armbruster <armbru@redhat.com>:
> Max Filippov <jcmvbkbc@gmail.com> writes:
>
>> This fixes the following error:
>>
>>     $ qemu-system-xtensa -cpu help
>>     Segmentation fault
>
> main() attempts to cope with "no machine found", it just screws it up:
>
>     if (machine->hw_version) {
>         qemu_set_version(machine->hw_version);
>     }
> [...]
>     if (machine == NULL) {
>         fprintf(stderr, "No machine found.\n");
>         exit(1);
>     }
>
I have sent
 a trivial patch to fix this bug, but no one replied it.

I resend it just now.
http://lists.nongnu.org/archive/html/qemu-devel/2012-08/msg01437.html
> Probably broken in commit 93bfef4c, cc'ing its author.
>
> Of course, I don't mind you picking a default machine for xtensa, if
> that's what you want.
>
Markus Armbruster - Aug. 9, 2012, 8:01 a.m.
Dunrong Huang <riegamaths@gmail.com> writes:

> 2012/8/9 Markus Armbruster <armbru@redhat.com>:
>> Max Filippov <jcmvbkbc@gmail.com> writes:
>>
>>> This fixes the following error:
>>>
>>>     $ qemu-system-xtensa -cpu help
>>>     Segmentation fault
>>
>> main() attempts to cope with "no machine found", it just screws it up:
>>
>>     if (machine->hw_version) {
>>         qemu_set_version(machine->hw_version);
>>     }
>> [...]
>>     if (machine == NULL) {
>>         fprintf(stderr, "No machine found.\n");
>>         exit(1);
>>     }
>>
> I have sent
>  a trivial patch to fix this bug, but no one replied it.
>
> I resend it just now.
> http://lists.nongnu.org/archive/html/qemu-devel/2012-08/msg01437.html

Thanks!
Max Filippov - Aug. 9, 2012, 10:36 a.m.
On Thu, Aug 9, 2012 at 11:43 AM, Markus Armbruster <armbru@redhat.com> wrote:
> Max Filippov <jcmvbkbc@gmail.com> writes:
>
>> This fixes the following error:
>>
>>     $ qemu-system-xtensa -cpu help
>>     Segmentation fault
>
> main() attempts to cope with "no machine found", it just screws it up:
>
>     if (machine->hw_version) {
>         qemu_set_version(machine->hw_version);
>     }
> [...]
>     if (machine == NULL) {
>         fprintf(stderr, "No machine found.\n");
>         exit(1);
>     }
>
> Probably broken in commit 93bfef4c, cc'ing its author.
>
> Of course, I don't mind you picking a default machine for xtensa, if
> that's what you want.

I guess it would make no harm. Also this way it will less likely break
next time,
and I remember Blue once wondered why xtensa doesn't have the default
machine.
Blue Swirl - Aug. 9, 2012, 7:58 p.m.
Thanks, applied.


On Wed, Aug 8, 2012 at 11:31 PM, Max Filippov <jcmvbkbc@gmail.com> wrote:
> This fixes the following error:
>
>     $ qemu-system-xtensa -cpu help
>     Segmentation fault
>
> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
> ---
>  hw/xtensa_sim.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/hw/xtensa_sim.c b/hw/xtensa_sim.c
> index ed38bd4..831460b 100644
> --- a/hw/xtensa_sim.c
> +++ b/hw/xtensa_sim.c
> @@ -111,6 +111,7 @@ static void xtensa_sim_init(ram_addr_t ram_size,
>  static QEMUMachine xtensa_sim_machine = {
>      .name = "sim",
>      .desc = "sim machine (" XTENSA_DEFAULT_CPU_MODEL ")",
> +    .is_default = true,
>      .init = xtensa_sim_init,
>      .max_cpus = 4,
>  };
> --
> 1.7.7.6
>
>

Patch

diff --git a/hw/xtensa_sim.c b/hw/xtensa_sim.c
index ed38bd4..831460b 100644
--- a/hw/xtensa_sim.c
+++ b/hw/xtensa_sim.c
@@ -111,6 +111,7 @@  static void xtensa_sim_init(ram_addr_t ram_size,
 static QEMUMachine xtensa_sim_machine = {
     .name = "sim",
     .desc = "sim machine (" XTENSA_DEFAULT_CPU_MODEL ")",
+    .is_default = true,
     .init = xtensa_sim_init,
     .max_cpus = 4,
 };