[Qemu-devel] [PATCH] hw/core/null-machine: Print error message when using the -kernel parameter

Thomas Huth posted 1 patch 7 years, 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/1488271971-12624-1-git-send-email-thuth@redhat.com
Test checkpatch passed
Test docker passed
Test s390x passed
hw/core/null-machine.c | 6 ++++++
1 file changed, 6 insertions(+)
[Qemu-devel] [PATCH] hw/core/null-machine: Print error message when using the -kernel parameter
Posted by Thomas Huth 7 years, 1 month ago
If the user currently tries to use the -kernel parameter, simply nothing
happens, and the user might get confused that there is nothing loaded
to memory, but also no error message has been issued. Since there is no
real generic way to load a kernel on all CPU types (but on some targets,
the generic loader can be used instead), issue an appropriate error
message here now to avoid the possible confusion.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/core/null-machine.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/core/null-machine.c b/hw/core/null-machine.c
index 27c8369..864832d 100644
--- a/hw/core/null-machine.c
+++ b/hw/core/null-machine.c
@@ -40,6 +40,12 @@ static void machine_none_init(MachineState *mch)
         memory_region_allocate_system_memory(ram, NULL, "ram", mch->ram_size);
         memory_region_add_subregion(get_system_memory(), 0, ram);
     }
+
+    if (mch->kernel_filename) {
+        error_report("The -kernel parameter is not supported "
+                     "(use the generic 'loader' device instead).");
+        exit(1);
+    }
 }
 
 static void machine_none_machine_init(MachineClass *mc)
-- 
1.8.3.1


Re: [Qemu-devel] [PATCH] hw/core/null-machine: Print error message when using the -kernel parameter
Posted by Marcel Apfelbaum 7 years, 1 month ago
On 02/28/2017 10:52 AM, Thomas Huth wrote:
> If the user currently tries to use the -kernel parameter, simply nothing
> happens, and the user might get confused that there is nothing loaded
> to memory, but also no error message has been issued. Since there is no
> real generic way to load a kernel on all CPU types (but on some targets,
> the generic loader can be used instead), issue an appropriate error
> message here now to avoid the possible confusion.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  hw/core/null-machine.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/hw/core/null-machine.c b/hw/core/null-machine.c
> index 27c8369..864832d 100644
> --- a/hw/core/null-machine.c
> +++ b/hw/core/null-machine.c
> @@ -40,6 +40,12 @@ static void machine_none_init(MachineState *mch)
>          memory_region_allocate_system_memory(ram, NULL, "ram", mch->ram_size);
>          memory_region_add_subregion(get_system_memory(), 0, ram);
>      }
> +
> +    if (mch->kernel_filename) {
> +        error_report("The -kernel parameter is not supported "
> +                     "(use the generic 'loader' device instead).");
> +        exit(1);
> +    }
>  }
>
>  static void machine_none_machine_init(MachineClass *mc)
>


Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>

Thanks,
Marcel

Re: [Qemu-devel] [PATCH] hw/core/null-machine: Print error message when using the -kernel parameter
Posted by Philippe Mathieu-Daudé 7 years, 1 month ago
On 02/28/2017 10:17 AM, Marcel Apfelbaum wrote:
> On 02/28/2017 10:52 AM, Thomas Huth wrote:
>> If the user currently tries to use the -kernel parameter, simply nothing
>> happens, and the user might get confused that there is nothing loaded
>> to memory, but also no error message has been issued. Since there is no
>> real generic way to load a kernel on all CPU types (but on some targets,
>> the generic loader can be used instead), issue an appropriate error
>> message here now to avoid the possible confusion.
>>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
>>  hw/core/null-machine.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/hw/core/null-machine.c b/hw/core/null-machine.c
>> index 27c8369..864832d 100644
>> --- a/hw/core/null-machine.c
>> +++ b/hw/core/null-machine.c
>> @@ -40,6 +40,12 @@ static void machine_none_init(MachineState *mch)
>>          memory_region_allocate_system_memory(ram, NULL, "ram",
>> mch->ram_size);
>>          memory_region_add_subregion(get_system_memory(), 0, ram);
>>      }
>> +
>> +    if (mch->kernel_filename) {
>> +        error_report("The -kernel parameter is not supported "
>> +                     "(use the generic 'loader' device instead).");
>> +        exit(1);
>> +    }
>>  }
>>
>>  static void machine_none_machine_init(MachineClass *mc)
>>
>
>
> Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

>
> Thanks,
> Marcel
>

Re: [Qemu-devel] [PATCH] hw/core/null-machine: Print error message when using the -kernel parameter
Posted by Eduardo Habkost 7 years, 1 month ago
On Tue, Feb 28, 2017 at 09:52:51AM +0100, Thomas Huth wrote:
> If the user currently tries to use the -kernel parameter, simply nothing
> happens, and the user might get confused that there is nothing loaded
> to memory, but also no error message has been issued. Since there is no
> real generic way to load a kernel on all CPU types (but on some targets,
> the generic loader can be used instead), issue an appropriate error
> message here now to avoid the possible confusion.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>

Applied to my machine-next branch, but I'm unsure if we should
break soft freeze and include this on 2.9. I will probably hold
it for 2.10.

> ---
>  hw/core/null-machine.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/hw/core/null-machine.c b/hw/core/null-machine.c
> index 27c8369..864832d 100644
> --- a/hw/core/null-machine.c
> +++ b/hw/core/null-machine.c
> @@ -40,6 +40,12 @@ static void machine_none_init(MachineState *mch)
>          memory_region_allocate_system_memory(ram, NULL, "ram", mch->ram_size);
>          memory_region_add_subregion(get_system_memory(), 0, ram);
>      }
> +
> +    if (mch->kernel_filename) {
> +        error_report("The -kernel parameter is not supported "
> +                     "(use the generic 'loader' device instead).");
> +        exit(1);
> +    }
>  }
>  
>  static void machine_none_machine_init(MachineClass *mc)
> -- 
> 1.8.3.1
> 

-- 
Eduardo