linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] xen/arm: allow console=hvc0 to be omitted for guests
@ 2015-02-12 11:29 Ard Biesheuvel
  2015-02-13  7:03 ` Julien Grall
  0 siblings, 1 reply; 6+ messages in thread
From: Ard Biesheuvel @ 2015-02-12 11:29 UTC (permalink / raw)
  To: linux-arm-kernel

This patch registers hvc0 as the preferred console if no console
has been specified explicitly on the kernel command line.

The purpose is to allow platform agnostic kernels and boot images
(such as distro installers) to boot in a Xen/ARM domU without the
need to modify the command line by hand.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 arch/arm/xen/enlighten.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index 0abeefa7dbf8..927be1d1bad7 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -24,6 +24,7 @@
 #include <linux/cpuidle.h>
 #include <linux/cpufreq.h>
 #include <linux/cpu.h>
+#include <linux/console.h>
 
 #include <linux/mm.h>
 
@@ -255,6 +256,9 @@ void __init xen_early_init(void)
 		xen_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED;
 	else
 		xen_start_info->flags &= ~(SIF_INITDOMAIN|SIF_PRIVILEGED);
+
+	if (!console_set_on_cmdline && !xen_initial_domain())
+		add_preferred_console("hvc", 0, NULL);
 }
 
 static int __init xen_guest_init(void)
-- 
1.8.3.2

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

* [PATCH v2] xen/arm: allow console=hvc0 to be omitted for guests
  2015-02-12 11:29 [PATCH v2] xen/arm: allow console=hvc0 to be omitted for guests Ard Biesheuvel
@ 2015-02-13  7:03 ` Julien Grall
  2015-02-13  7:12   ` Ard Biesheuvel
  0 siblings, 1 reply; 6+ messages in thread
From: Julien Grall @ 2015-02-13  7:03 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Ard,

On 12/02/2015 19:29, Ard Biesheuvel wrote:
> This patch registers hvc0 as the preferred console if no console
> has been specified explicitly on the kernel command line.
>
> The purpose is to allow platform agnostic kernels and boot images
> (such as distro installers) to boot in a Xen/ARM domU without the
> need to modify the command line by hand.
>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>   arch/arm/xen/enlighten.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
> index 0abeefa7dbf8..927be1d1bad7 100644
> --- a/arch/arm/xen/enlighten.c
> +++ b/arch/arm/xen/enlighten.c
> @@ -24,6 +24,7 @@
>   #include <linux/cpuidle.h>
>   #include <linux/cpufreq.h>
>   #include <linux/cpu.h>
> +#include <linux/console.h>
>
>   #include <linux/mm.h>
>
> @@ -255,6 +256,9 @@ void __init xen_early_init(void)
>   		xen_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED;
>   	else
>   		xen_start_info->flags &= ~(SIF_INITDOMAIN|SIF_PRIVILEGED);
> +
> +	if (!console_set_on_cmdline && !xen_initial_domain())
> +		add_preferred_console("hvc", 0, NULL);

Unfortunately, this won't work as expected.

console_set_on_cmdline is set when Linux parses the early params. The 
parsing is done after setup_arch (the function which call xen_early_init).

So we will end up to add the HVC console even if a console has been 
passed on the command line.

>   }
>
>   static int __init xen_guest_init(void)
>

Regards,

-- 
Julien Grall

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

* [PATCH v2] xen/arm: allow console=hvc0 to be omitted for guests
  2015-02-13  7:03 ` Julien Grall
@ 2015-02-13  7:12   ` Ard Biesheuvel
  2015-02-13  7:17     ` Julien Grall
  0 siblings, 1 reply; 6+ messages in thread
From: Ard Biesheuvel @ 2015-02-13  7:12 UTC (permalink / raw)
  To: linux-arm-kernel

On 13 February 2015 at 15:03, Julien Grall <julien.grall@linaro.org> wrote:
> Hi Ard,
>
>
> On 12/02/2015 19:29, Ard Biesheuvel wrote:
>>
>> This patch registers hvc0 as the preferred console if no console
>> has been specified explicitly on the kernel command line.
>>
>> The purpose is to allow platform agnostic kernels and boot images
>> (such as distro installers) to boot in a Xen/ARM domU without the
>> need to modify the command line by hand.
>>
>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> ---
>>   arch/arm/xen/enlighten.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
>> index 0abeefa7dbf8..927be1d1bad7 100644
>> --- a/arch/arm/xen/enlighten.c
>> +++ b/arch/arm/xen/enlighten.c
>> @@ -24,6 +24,7 @@
>>   #include <linux/cpuidle.h>
>>   #include <linux/cpufreq.h>
>>   #include <linux/cpu.h>
>> +#include <linux/console.h>
>>
>>   #include <linux/mm.h>
>>
>> @@ -255,6 +256,9 @@ void __init xen_early_init(void)
>>                 xen_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED;
>>         else
>>                 xen_start_info->flags &= ~(SIF_INITDOMAIN|SIF_PRIVILEGED);
>> +
>> +       if (!console_set_on_cmdline && !xen_initial_domain())
>> +               add_preferred_console("hvc", 0, NULL);
>
>
> Unfortunately, this won't work as expected.
>

Did you try it?

> console_set_on_cmdline is set when Linux parses the early params. The
> parsing is done after setup_arch (the function which call xen_early_init).
>
> So we will end up to add the HVC console even if a console has been passed
> on the command line.
>

parse_early_param() is also called by setup_arch(), before xen_early_init()

The call to parse_early_param() in generic code is only there for
architectures that don't call it in their setup_arch()

-- 
Ard.

>>   }
>>
>>   static int __init xen_guest_init(void)
>>
>
> Regards,
>
> --
> Julien Grall

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

* [PATCH v2] xen/arm: allow console=hvc0 to be omitted for guests
  2015-02-13  7:12   ` Ard Biesheuvel
@ 2015-02-13  7:17     ` Julien Grall
  2015-02-16  9:37       ` Ard Biesheuvel
  0 siblings, 1 reply; 6+ messages in thread
From: Julien Grall @ 2015-02-13  7:17 UTC (permalink / raw)
  To: linux-arm-kernel



On 13/02/2015 15:12, Ard Biesheuvel wrote:
> On 13 February 2015 at 15:03, Julien Grall <julien.grall@linaro.org> wrote:
>> Hi Ard,
>>
>>
>> On 12/02/2015 19:29, Ard Biesheuvel wrote:
>>>
>>> This patch registers hvc0 as the preferred console if no console
>>> has been specified explicitly on the kernel command line.
>>>
>>> The purpose is to allow platform agnostic kernels and boot images
>>> (such as distro installers) to boot in a Xen/ARM domU without the
>>> need to modify the command line by hand.
>>>
>>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>>> ---
>>>    arch/arm/xen/enlighten.c | 4 ++++
>>>    1 file changed, 4 insertions(+)
>>>
>>> diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
>>> index 0abeefa7dbf8..927be1d1bad7 100644
>>> --- a/arch/arm/xen/enlighten.c
>>> +++ b/arch/arm/xen/enlighten.c
>>> @@ -24,6 +24,7 @@
>>>    #include <linux/cpuidle.h>
>>>    #include <linux/cpufreq.h>
>>>    #include <linux/cpu.h>
>>> +#include <linux/console.h>
>>>
>>>    #include <linux/mm.h>
>>>
>>> @@ -255,6 +256,9 @@ void __init xen_early_init(void)
>>>                  xen_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED;
>>>          else
>>>                  xen_start_info->flags &= ~(SIF_INITDOMAIN|SIF_PRIVILEGED);
>>> +
>>> +       if (!console_set_on_cmdline && !xen_initial_domain())
>>> +               add_preferred_console("hvc", 0, NULL);
>>
>>
>> Unfortunately, this won't work as expected.
>>
>
> Did you try it?

No just looked at the code.

>> console_set_on_cmdline is set when Linux parses the early params. The
>> parsing is done after setup_arch (the function which call xen_early_init).
>>
>> So we will end up to add the HVC console even if a console has been passed
>> on the command line.
>>
>
> parse_early_param() is also called by setup_arch(), before xen_early_init()
>
> The call to parse_early_param() in generic code is only there for
> architectures that don't call it in their setup_arch()

Oh, right. Sorry for the noise.

So:

Reviewed-by: Julien Grall <julien.grall@linaro.org>

Regards,

-- 
Julien Grall

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

* [PATCH v2] xen/arm: allow console=hvc0 to be omitted for guests
  2015-02-13  7:17     ` Julien Grall
@ 2015-02-16  9:37       ` Ard Biesheuvel
  2015-02-16 10:09         ` Julien Grall
  0 siblings, 1 reply; 6+ messages in thread
From: Ard Biesheuvel @ 2015-02-16  9:37 UTC (permalink / raw)
  To: linux-arm-kernel

On 13 February 2015 at 15:17, Julien Grall <julien.grall@linaro.org> wrote:
>
>
> On 13/02/2015 15:12, Ard Biesheuvel wrote:
>>
>> On 13 February 2015 at 15:03, Julien Grall <julien.grall@linaro.org>
>> wrote:
>>>
>>> Hi Ard,
>>>
>>>
>>> On 12/02/2015 19:29, Ard Biesheuvel wrote:
>>>>
>>>>
>>>> This patch registers hvc0 as the preferred console if no console
>>>> has been specified explicitly on the kernel command line.
>>>>
>>>> The purpose is to allow platform agnostic kernels and boot images
>>>> (such as distro installers) to boot in a Xen/ARM domU without the
>>>> need to modify the command line by hand.
>>>>
>>>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>>>> ---
>>>>    arch/arm/xen/enlighten.c | 4 ++++
>>>>    1 file changed, 4 insertions(+)
>>>>
>>>> diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
>>>> index 0abeefa7dbf8..927be1d1bad7 100644
>>>> --- a/arch/arm/xen/enlighten.c
>>>> +++ b/arch/arm/xen/enlighten.c
>>>> @@ -24,6 +24,7 @@
>>>>    #include <linux/cpuidle.h>
>>>>    #include <linux/cpufreq.h>
>>>>    #include <linux/cpu.h>
>>>> +#include <linux/console.h>
>>>>
>>>>    #include <linux/mm.h>
>>>>
>>>> @@ -255,6 +256,9 @@ void __init xen_early_init(void)
>>>>                  xen_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED;
>>>>          else
>>>>                  xen_start_info->flags &=
>>>> ~(SIF_INITDOMAIN|SIF_PRIVILEGED);
>>>> +
>>>> +       if (!console_set_on_cmdline && !xen_initial_domain())
>>>> +               add_preferred_console("hvc", 0, NULL);
>>>
>>>
>>>
>>> Unfortunately, this won't work as expected.
>>>
>>
>> Did you try it?
>
>
> No just looked at the code.
>
>>> console_set_on_cmdline is set when Linux parses the early params. The
>>> parsing is done after setup_arch (the function which call
>>> xen_early_init).
>>>
>>> So we will end up to add the HVC console even if a console has been
>>> passed
>>> on the command line.
>>>
>>
>> parse_early_param() is also called by setup_arch(), before
>> xen_early_init()
>>
>> The call to parse_early_param() in generic code is only there for
>> architectures that don't call it in their setup_arch()
>
>
> Oh, right. Sorry for the noise.
>
> So:
>
> Reviewed-by: Julien Grall <julien.grall@linaro.org>
>

Would it make sense to roll this into your xen_early_init() series as #3?

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

* [PATCH v2] xen/arm: allow console=hvc0 to be omitted for guests
  2015-02-16  9:37       ` Ard Biesheuvel
@ 2015-02-16 10:09         ` Julien Grall
  0 siblings, 0 replies; 6+ messages in thread
From: Julien Grall @ 2015-02-16 10:09 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Ard,

On 16/02/15 09:37, Ard Biesheuvel wrote:
> On 13 February 2015 at 15:17, Julien Grall <julien.grall@linaro.org> wrote:
>>
>>
>> On 13/02/2015 15:12, Ard Biesheuvel wrote:
>>>
>>> On 13 February 2015 at 15:03, Julien Grall <julien.grall@linaro.org>
>>> wrote:
>>>>
>>>> Hi Ard,
>>>>
>>>>
>>>> On 12/02/2015 19:29, Ard Biesheuvel wrote:
>>>>>
>>>>>
>>>>> This patch registers hvc0 as the preferred console if no console
>>>>> has been specified explicitly on the kernel command line.
>>>>>
>>>>> The purpose is to allow platform agnostic kernels and boot images
>>>>> (such as distro installers) to boot in a Xen/ARM domU without the
>>>>> need to modify the command line by hand.
>>>>>
>>>>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>>>>> ---
>>>>>    arch/arm/xen/enlighten.c | 4 ++++
>>>>>    1 file changed, 4 insertions(+)
>>>>>
>>>>> diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
>>>>> index 0abeefa7dbf8..927be1d1bad7 100644
>>>>> --- a/arch/arm/xen/enlighten.c
>>>>> +++ b/arch/arm/xen/enlighten.c
>>>>> @@ -24,6 +24,7 @@
>>>>>    #include <linux/cpuidle.h>
>>>>>    #include <linux/cpufreq.h>
>>>>>    #include <linux/cpu.h>
>>>>> +#include <linux/console.h>
>>>>>
>>>>>    #include <linux/mm.h>
>>>>>
>>>>> @@ -255,6 +256,9 @@ void __init xen_early_init(void)
>>>>>                  xen_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED;
>>>>>          else
>>>>>                  xen_start_info->flags &=
>>>>> ~(SIF_INITDOMAIN|SIF_PRIVILEGED);
>>>>> +
>>>>> +       if (!console_set_on_cmdline && !xen_initial_domain())
>>>>> +               add_preferred_console("hvc", 0, NULL);
>>>>
>>>>
>>>>
>>>> Unfortunately, this won't work as expected.
>>>>
>>>
>>> Did you try it?
>>
>>
>> No just looked at the code.
>>
>>>> console_set_on_cmdline is set when Linux parses the early params. The
>>>> parsing is done after setup_arch (the function which call
>>>> xen_early_init).
>>>>
>>>> So we will end up to add the HVC console even if a console has been
>>>> passed
>>>> on the command line.
>>>>
>>>
>>> parse_early_param() is also called by setup_arch(), before
>>> xen_early_init()
>>>
>>> The call to parse_early_param() in generic code is only there for
>>> architectures that don't call it in their setup_arch()
>>
>>
>> Oh, right. Sorry for the noise.
>>
>> So:
>>
>> Reviewed-by: Julien Grall <julien.grall@linaro.org>
>>
> 
> Would it make sense to roll this into your xen_early_init() series as #3?

The xen_early_init has been created in order to support preferred
console. I don't mind to carry this patch in the next version.

Regards,

-- 
Julien Grall

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

end of thread, other threads:[~2015-02-16 10:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-12 11:29 [PATCH v2] xen/arm: allow console=hvc0 to be omitted for guests Ard Biesheuvel
2015-02-13  7:03 ` Julien Grall
2015-02-13  7:12   ` Ard Biesheuvel
2015-02-13  7:17     ` Julien Grall
2015-02-16  9:37       ` Ard Biesheuvel
2015-02-16 10:09         ` Julien Grall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).