diff mbox series

xen/arm: Fix compilation error when early printk is enabled

Message ID 20210121093041.21537-1-michal.orzel@arm.com (mailing list archive)
State New, archived
Headers show
Series xen/arm: Fix compilation error when early printk is enabled | expand

Commit Message

Michal Orzel Jan. 21, 2021, 9:30 a.m. UTC
Fix compilation error when enabling early printk, introduced
by commit aa4b9d1ee6538b5cbe218d4d3fcdf9548130a063:
```
debug.S: Assembler messages:
debug.S:31: Error: constant expression expected at operand 2 -- `ldr x15,=((0x00400000+(0)*PAGE_SIZE)+(0x1c090000&~PAGE_MASK))`
debug.S:38: Error: constant expression expected at operand 2 -- `ldr x15,=((0x00400000+(0)*PAGE_SIZE)+(0x1c090000&~PAGE_MASK))`
```

The fix is to include header <xen/page-size.h> which now contains
definitions for page/size/mask etc.

Signed-off-by: Michal Orzel <michal.orzel@arm.com>
---
 xen/include/asm-arm/early_printk.h | 1 +
 1 file changed, 1 insertion(+)

Comments

Julien Grall Jan. 21, 2021, 9:35 a.m. UTC | #1
Hi Michal,

On 21/01/2021 09:30, Michal Orzel wrote:
> Fix compilation error when enabling early printk, introduced
> by commit aa4b9d1ee6538b5cbe218d4d3fcdf9548130a063:
> ```
> debug.S: Assembler messages:
> debug.S:31: Error: constant expression expected at operand 2 -- `ldr x15,=((0x00400000+(0)*PAGE_SIZE)+(0x1c090000&~PAGE_MASK))`
> debug.S:38: Error: constant expression expected at operand 2 -- `ldr x15,=((0x00400000+(0)*PAGE_SIZE)+(0x1c090000&~PAGE_MASK))`
> ```
> 
> The fix is to include header <xen/page-size.h> which now contains
> definitions for page/size/mask etc.
> 

Fixes: aa4b9d1ee653 ("include: don't use asm/page.h from common headers")

> Signed-off-by: Michal Orzel <michal.orzel@arm.com>

Reviewed-by: Julien Grall <jgrall@amazon.com>

> ---
>   xen/include/asm-arm/early_printk.h | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/xen/include/asm-arm/early_printk.h b/xen/include/asm-arm/early_printk.h
> index d5485decfa..8dc911cf48 100644
> --- a/xen/include/asm-arm/early_printk.h
> +++ b/xen/include/asm-arm/early_printk.h
> @@ -10,6 +10,7 @@
>   #ifndef __ARM_EARLY_PRINTK_H__
>   #define __ARM_EARLY_PRINTK_H__
>   
> +#include <xen/page-size.h>
>   
>   #ifdef CONFIG_EARLY_PRINTK
>   
> 

Cheers,
Jan Beulich Jan. 21, 2021, 9:43 a.m. UTC | #2
On 21.01.2021 10:30, Michal Orzel wrote:
> Fix compilation error when enabling early printk, introduced
> by commit aa4b9d1ee6538b5cbe218d4d3fcdf9548130a063:
> ```
> debug.S: Assembler messages:
> debug.S:31: Error: constant expression expected at operand 2 -- `ldr x15,=((0x00400000+(0)*PAGE_SIZE)+(0x1c090000&~PAGE_MASK))`
> debug.S:38: Error: constant expression expected at operand 2 -- `ldr x15,=((0x00400000+(0)*PAGE_SIZE)+(0x1c090000&~PAGE_MASK))`
> ```
> 
> The fix is to include header <xen/page-size.h> which now contains
> definitions for page/size/mask etc.
> 
> Signed-off-by: Michal Orzel <michal.orzel@arm.com>

I'm sorry for the breakage, but I wonder how I should have noticed
the issue. In all the Arm .config-s I'm routinely building I can't
even see ...

> --- a/xen/include/asm-arm/early_printk.h
> +++ b/xen/include/asm-arm/early_printk.h
> @@ -10,6 +10,7 @@
>  #ifndef __ARM_EARLY_PRINTK_H__
>  #define __ARM_EARLY_PRINTK_H__
>  
> +#include <xen/page-size.h>
>  
>  #ifdef CONFIG_EARLY_PRINTK

... a respective Kconfig setting, i.e. it's not like I simply
failed to enable it.

Jan
Bertrand Marquis Jan. 21, 2021, 9:47 a.m. UTC | #3
Hi Michal,

> On 21 Jan 2021, at 09:30, Michal Orzel <Michal.Orzel@arm.com> wrote:
> 
> Fix compilation error when enabling early printk, introduced
> by commit aa4b9d1ee6538b5cbe218d4d3fcdf9548130a063:
> ```
> debug.S: Assembler messages:
> debug.S:31: Error: constant expression expected at operand 2 -- `ldr x15,=((0x00400000+(0)*PAGE_SIZE)+(0x1c090000&~PAGE_MASK))`
> debug.S:38: Error: constant expression expected at operand 2 -- `ldr x15,=((0x00400000+(0)*PAGE_SIZE)+(0x1c090000&~PAGE_MASK))`
> ```
> 
> The fix is to include header <xen/page-size.h> which now contains
> definitions for page/size/mask etc.
> 
> Signed-off-by: Michal Orzel <michal.orzel@arm.com>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>

Thanks a lot, this is fixing the compilation issues.

Cheers
Bertrand

> ---
> xen/include/asm-arm/early_printk.h | 1 +
> 1 file changed, 1 insertion(+)
> 
> diff --git a/xen/include/asm-arm/early_printk.h b/xen/include/asm-arm/early_printk.h
> index d5485decfa..8dc911cf48 100644
> --- a/xen/include/asm-arm/early_printk.h
> +++ b/xen/include/asm-arm/early_printk.h
> @@ -10,6 +10,7 @@
> #ifndef __ARM_EARLY_PRINTK_H__
> #define __ARM_EARLY_PRINTK_H__
> 
> +#include <xen/page-size.h>
> 
> #ifdef CONFIG_EARLY_PRINTK
> 
> -- 
> 2.29.0
>
Michal Orzel Jan. 21, 2021, 9:52 a.m. UTC | #4
Hi Jan,

On 21.01.2021 10:43, Jan Beulich wrote:
> On 21.01.2021 10:30, Michal Orzel wrote:
>> Fix compilation error when enabling early printk, introduced
>> by commit aa4b9d1ee6538b5cbe218d4d3fcdf9548130a063:
>> ```
>> debug.S: Assembler messages:
>> debug.S:31: Error: constant expression expected at operand 2 -- `ldr x15,=((0x00400000+(0)*PAGE_SIZE)+(0x1c090000&~PAGE_MASK))`
>> debug.S:38: Error: constant expression expected at operand 2 -- `ldr x15,=((0x00400000+(0)*PAGE_SIZE)+(0x1c090000&~PAGE_MASK))`
>> ```
>>
>> The fix is to include header <xen/page-size.h> which now contains
>> definitions for page/size/mask etc.
>>
>> Signed-off-by: Michal Orzel <michal.orzel@arm.com>
> 
> I'm sorry for the breakage, but I wonder how I should have noticed
> the issue. In all the Arm .config-s I'm routinely building I can't
> even see ...
> 
This is not your fault. Nowadays it is becoming harder and harder to try all the possible combinations.
>> --- a/xen/include/asm-arm/early_printk.h
>> +++ b/xen/include/asm-arm/early_printk.h
>> @@ -10,6 +10,7 @@
>>  #ifndef __ARM_EARLY_PRINTK_H__
>>  #define __ARM_EARLY_PRINTK_H__
>>  
>> +#include <xen/page-size.h>
>>  
>>  #ifdef CONFIG_EARLY_PRINTK
> 
> ... a respective Kconfig setting, i.e. it's not like I simply
> failed to enable it.
> 
> Jan
> 

Cheers,
Michal
Julien Grall Jan. 21, 2021, 9:56 a.m. UTC | #5
Hi Jan,

On 21/01/2021 09:43, Jan Beulich wrote:
> On 21.01.2021 10:30, Michal Orzel wrote:
>> Fix compilation error when enabling early printk, introduced
>> by commit aa4b9d1ee6538b5cbe218d4d3fcdf9548130a063:
>> ```
>> debug.S: Assembler messages:
>> debug.S:31: Error: constant expression expected at operand 2 -- `ldr x15,=((0x00400000+(0)*PAGE_SIZE)+(0x1c090000&~PAGE_MASK))`
>> debug.S:38: Error: constant expression expected at operand 2 -- `ldr x15,=((0x00400000+(0)*PAGE_SIZE)+(0x1c090000&~PAGE_MASK))`
>> ```
>>
>> The fix is to include header <xen/page-size.h> which now contains
>> definitions for page/size/mask etc.
>>
>> Signed-off-by: Michal Orzel <michal.orzel@arm.com>
> 
> I'm sorry for the breakage, but I wonder how I should have noticed
> the issue. In all the Arm .config-s I'm routinely building I can't
> even see ...
> 
>> --- a/xen/include/asm-arm/early_printk.h
>> +++ b/xen/include/asm-arm/early_printk.h
>> @@ -10,6 +10,7 @@
>>   #ifndef __ARM_EARLY_PRINTK_H__
>>   #define __ARM_EARLY_PRINTK_H__
>>   
>> +#include <xen/page-size.h>
>>   
>>   #ifdef CONFIG_EARLY_PRINTK
> 
> ... a respective Kconfig setting, i.e. it's not like I simply
> failed to enable it.

EARLY_PRINTK is defined in arch/arm/Kconfig.debug and is selected when 
you specify the UART to use.

Assuming you are only build testing, you could add the following for 
testing EARLY_PRINTK:

CONFIG_DEBUG=y
CONFIG_EARLY_UART_CHOICE_8250=y
CONFIG_EARLY_UART_8250=y
CONFIG_EARLY_PRINTK=y
CONFIG_EARLY_UART_BASE_ADDRESS=
CONFIG_EARLY_UART_8250_REG_SHIFT=0
CONFIG_EARLY_PRINTK_INC="debug-8250.inc"

Cheers,
Jan Beulich Jan. 21, 2021, 10:24 a.m. UTC | #6
On 21.01.2021 10:56, Julien Grall wrote:
> Hi Jan,
> 
> On 21/01/2021 09:43, Jan Beulich wrote:
>> On 21.01.2021 10:30, Michal Orzel wrote:
>>> Fix compilation error when enabling early printk, introduced
>>> by commit aa4b9d1ee6538b5cbe218d4d3fcdf9548130a063:
>>> ```
>>> debug.S: Assembler messages:
>>> debug.S:31: Error: constant expression expected at operand 2 -- `ldr x15,=((0x00400000+(0)*PAGE_SIZE)+(0x1c090000&~PAGE_MASK))`
>>> debug.S:38: Error: constant expression expected at operand 2 -- `ldr x15,=((0x00400000+(0)*PAGE_SIZE)+(0x1c090000&~PAGE_MASK))`
>>> ```
>>>
>>> The fix is to include header <xen/page-size.h> which now contains
>>> definitions for page/size/mask etc.
>>>
>>> Signed-off-by: Michal Orzel <michal.orzel@arm.com>
>>
>> I'm sorry for the breakage, but I wonder how I should have noticed
>> the issue. In all the Arm .config-s I'm routinely building I can't
>> even see ...
>>
>>> --- a/xen/include/asm-arm/early_printk.h
>>> +++ b/xen/include/asm-arm/early_printk.h
>>> @@ -10,6 +10,7 @@
>>>   #ifndef __ARM_EARLY_PRINTK_H__
>>>   #define __ARM_EARLY_PRINTK_H__
>>>   
>>> +#include <xen/page-size.h>
>>>   
>>>   #ifdef CONFIG_EARLY_PRINTK
>>
>> ... a respective Kconfig setting, i.e. it's not like I simply
>> failed to enable it.
> 
> EARLY_PRINTK is defined in arch/arm/Kconfig.debug and is selected when 
> you specify the UART to use.
> 
> Assuming you are only build testing, you could add the following for 
> testing EARLY_PRINTK:
> 
> CONFIG_DEBUG=y
> CONFIG_EARLY_UART_CHOICE_8250=y
> CONFIG_EARLY_UART_8250=y
> CONFIG_EARLY_PRINTK=y
> CONFIG_EARLY_UART_BASE_ADDRESS=
> CONFIG_EARLY_UART_8250_REG_SHIFT=0
> CONFIG_EARLY_PRINTK_INC="debug-8250.inc"

Ah yes, this works, thanks. The "optional" on the choice isn't
very helpful I suppose, because when going from an existing
.config one would neither find a setting presently turned off
in that .config, nor will there be a prompt.

I suppose any page-aligned base address is fine to use for my
build-testing-only purposes?

Jan
Julien Grall Jan. 21, 2021, 6:47 p.m. UTC | #7
Hi Jan,

On 21/01/2021 10:24, Jan Beulich wrote:
> On 21.01.2021 10:56, Julien Grall wrote:
>> Hi Jan,
>>
>> On 21/01/2021 09:43, Jan Beulich wrote:
>>> On 21.01.2021 10:30, Michal Orzel wrote:
>>>> Fix compilation error when enabling early printk, introduced
>>>> by commit aa4b9d1ee6538b5cbe218d4d3fcdf9548130a063:
>>>> ```
>>>> debug.S: Assembler messages:
>>>> debug.S:31: Error: constant expression expected at operand 2 -- `ldr x15,=((0x00400000+(0)*PAGE_SIZE)+(0x1c090000&~PAGE_MASK))`
>>>> debug.S:38: Error: constant expression expected at operand 2 -- `ldr x15,=((0x00400000+(0)*PAGE_SIZE)+(0x1c090000&~PAGE_MASK))`
>>>> ```
>>>>
>>>> The fix is to include header <xen/page-size.h> which now contains
>>>> definitions for page/size/mask etc.
>>>>
>>>> Signed-off-by: Michal Orzel <michal.orzel@arm.com>
>>>
>>> I'm sorry for the breakage, but I wonder how I should have noticed
>>> the issue. In all the Arm .config-s I'm routinely building I can't
>>> even see ...
>>>
>>>> --- a/xen/include/asm-arm/early_printk.h
>>>> +++ b/xen/include/asm-arm/early_printk.h
>>>> @@ -10,6 +10,7 @@
>>>>    #ifndef __ARM_EARLY_PRINTK_H__
>>>>    #define __ARM_EARLY_PRINTK_H__
>>>>    
>>>> +#include <xen/page-size.h>
>>>>    
>>>>    #ifdef CONFIG_EARLY_PRINTK
>>>
>>> ... a respective Kconfig setting, i.e. it's not like I simply
>>> failed to enable it.
>>
>> EARLY_PRINTK is defined in arch/arm/Kconfig.debug and is selected when
>> you specify the UART to use.
>>
>> Assuming you are only build testing, you could add the following for
>> testing EARLY_PRINTK:
>>
>> CONFIG_DEBUG=y
>> CONFIG_EARLY_UART_CHOICE_8250=y
>> CONFIG_EARLY_UART_8250=y
>> CONFIG_EARLY_PRINTK=y
>> CONFIG_EARLY_UART_BASE_ADDRESS=
>> CONFIG_EARLY_UART_8250_REG_SHIFT=0
>> CONFIG_EARLY_PRINTK_INC="debug-8250.inc"
> 
> Ah yes, this works, thanks. The "optional" on the choice isn't
> very helpful I suppose, because when going from an existing
> .config one would neither find a setting presently turned off
> in that .config, nor will there be a prompt.

Do you have a suggestion how the "choice" can appear in the .config?

> I suppose any page-aligned base address is fine to use for my
> build-testing-only purposes?

The base address doesn't need to be page-aligned (some HW have multiple 
UARTs in the same 4K region).

Cheers,
Jan Beulich Jan. 22, 2021, 9:07 a.m. UTC | #8
On 21.01.2021 19:47, Julien Grall wrote:
> On 21/01/2021 10:24, Jan Beulich wrote:
>> On 21.01.2021 10:56, Julien Grall wrote:
>>> On 21/01/2021 09:43, Jan Beulich wrote:
>>>> On 21.01.2021 10:30, Michal Orzel wrote:
>>>>> --- a/xen/include/asm-arm/early_printk.h
>>>>> +++ b/xen/include/asm-arm/early_printk.h
>>>>> @@ -10,6 +10,7 @@
>>>>>    #ifndef __ARM_EARLY_PRINTK_H__
>>>>>    #define __ARM_EARLY_PRINTK_H__
>>>>>    
>>>>> +#include <xen/page-size.h>
>>>>>    
>>>>>    #ifdef CONFIG_EARLY_PRINTK
>>>>
>>>> ... a respective Kconfig setting, i.e. it's not like I simply
>>>> failed to enable it.
>>>
>>> EARLY_PRINTK is defined in arch/arm/Kconfig.debug and is selected when
>>> you specify the UART to use.
>>>
>>> Assuming you are only build testing, you could add the following for
>>> testing EARLY_PRINTK:
>>>
>>> CONFIG_DEBUG=y
>>> CONFIG_EARLY_UART_CHOICE_8250=y
>>> CONFIG_EARLY_UART_8250=y
>>> CONFIG_EARLY_PRINTK=y
>>> CONFIG_EARLY_UART_BASE_ADDRESS=
>>> CONFIG_EARLY_UART_8250_REG_SHIFT=0
>>> CONFIG_EARLY_PRINTK_INC="debug-8250.inc"
>>
>> Ah yes, this works, thanks. The "optional" on the choice isn't
>> very helpful I suppose, because when going from an existing
>> .config one would neither find a setting presently turned off
>> in that .config, nor will there be a prompt.
> 
> Do you have a suggestion how the "choice" can appear in the .config?

Drop the "optional" attribute from it? Of course I ask without any
knowledge on why it may have been put there in the first place.

Jan
diff mbox series

Patch

diff --git a/xen/include/asm-arm/early_printk.h b/xen/include/asm-arm/early_printk.h
index d5485decfa..8dc911cf48 100644
--- a/xen/include/asm-arm/early_printk.h
+++ b/xen/include/asm-arm/early_printk.h
@@ -10,6 +10,7 @@ 
 #ifndef __ARM_EARLY_PRINTK_H__
 #define __ARM_EARLY_PRINTK_H__
 
+#include <xen/page-size.h>
 
 #ifdef CONFIG_EARLY_PRINTK