xen/arm64: correct comments
PATCH 1/2 xen/arm64: correct comments
The 'Base address for 4K mapping' is '(x19 >> THIRD_SHIFT) << THIRD_SHIFT'. Also we are building 4K page mapping, not section mapping.
--- xen/arch/arm/arm64/head.S | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
xen/arch/arm/arm64/head.S +4 -4
@@ -471,10 +471,10 @@ skip_bss: ldr x4, =boot_third add x4, x4, x20 /* x4 := paddr (boot_third) */ - lsr x2, x19, #THIRD_SHIFT /* Base address for 4K mapping */ - lsl x2, x2, #THIRD_SHIFT - mov x3, #PT_MEM_L3 /* x2 := Section map */ - orr x2, x2, x3 + lsr x2, x19, #THIRD_SHIFT + lsl x2, x2, #THIRD_SHIFT /* Base address for 4K mapping */ + mov x3, #PT_MEM_L3 + orr x2, x2, x3 /* x2 := Page map */ /* ... map of vaddr(start) in boot_third */ mov x1, xzr
Signature · 7 lines
2.6.2 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH 2/2 xen/arm64: use shift operator
Use shift operator, but not muliplication.
No function change.
--- xen/arch/arm/arm64/head.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/arm64/head.S +1 -1
@@ -524,7 +524,7 @@ paging: lsl x2, x2, #THIRD_SHIFT /* 4K aligned paddr of UART */ mov x3, #PT_DEV_L3 orr x2, x2, x3 /* x2 := 4K dev map including UART */ - str x2, [x1, #(FIXMAP_CONSOLE*8)] /* Map it in the first fixmap's slot */ + str x2, [x1, #(FIXMAP_CONSOLE << 3)] /* Map it in the first fixmap's slot */ 1: /* Map fixmap into boot_second */
Signature · 7 lines
2.6.2 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH 2/2] xen/arm64: use shift operator
Hello Peng,
Quoted 2 lines · Peng Fan
Use shift operator, but not muliplication.
No function change.
Why? The compiler will calculate the address at compilation time.
Regards,
Quoted 21 lines
Signed-off-by Peng Fan <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Julien Grall <[email protected]>--- xen/arch/arm/arm64/head.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)xen/arch/arm/arm64/head.S +1
-1@@ -524,7 +524,7 @@ paging: lsl x2, x2, #THIRD_SHIFT /* 4K aligned paddr of UART */ mov x3, #PT_DEV_L3 orr x2, x2, x3 /* x2 := 4K dev map including UART */ - str x2, [x1, #(FIXMAP_CONSOLE*8)] /* Map it in the first fixmap's slot */ + str x2, [x1, #(FIXMAP_CONSOLE << 3)] /* Map it in the first fixmap's slot */ 1: /* Map fixmap into boot_second */
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH 2/2] xen/arm64: use shift operator
Hi Julien,
Quoted 7 lines · Julien Grall
Hello Peng,
Quoted 2 lines · Peng Fan
Use shift operator, but not muliplication.
No function change.Why? The compiler will calculate the address at compilation time.
Yeah. The compiler will do this. I just think in asm, we rarely use
multiplication. In this file, there is "cmp x1, #(LPAE_ENTRIES<<3)",
here use shift operator but not multiplication.
Thanks,
Peng.
Quoted 22 lines
Regards,
Quoted 19 lines
Signed-off-by Peng Fan <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Julien Grall <[email protected]>--- xen/arch/arm/arm64/head.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)xen/arch/arm/arm64/head.S +1
-1@@ -524,7 +524,7 @@ paging: lsl x2, x2, #THIRD_SHIFT /* 4K aligned paddr of UART */ mov x3, #PT_DEV_L3 orr x2, x2, x3 /* x2 := 4K dev map including UART */ - str x2, [x1, #(FIXMAP_CONSOLE*8)] /* Map it in the first fixmap's slot */ + str x2, [x1, #(FIXMAP_CONSOLE << 3)] /* Map it in the first fixmap's slot */ 1:
Quoted 5 lines
Quoted 2 lines
xen/arch/arm/arm64/head.S +0
-0/* Map fixmap into boot_second */Signature · 1 line
Julien Grall
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH 2/2] xen/arm64: use shift operator
Quoted 1 line · Peng Fan
Hi Julien,
Hello Peng,
Quoted 12 lines · Julien Grall
Quoted 7 lines
Hello Peng,
Quoted 2 lines · Peng Fan
Use shift operator, but not muliplication.
No function change.Why? The compiler will calculate the address at compilation time.
Yeah. The compiler will do this. I just think in asm, we rarely use
multiplication. In this file, there is "cmp x1, #(LPAE_ENTRIES<<3)",
here use shift operator but not multiplication.
It took me a bit of time to understand that 8 is the number of byte of an LPAE entries. IMHO the "<< 3" would be more confusing.
So I would introduce a macro to get the slot based of an index. Something like:
LPAE_SLOT(slot) ((slot) * 8)
And add a comment to explain why 8. You could even introduce LPAE_ENTRY_SIZE.
Regards,
Quoted 31 lines
Thanks,
Peng.Quoted 27 lines
Regards,
Quoted 13 lines
Signed-off-by Peng Fan <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Julien Grall <[email protected]>--- xen/arch/arm/arm64/head.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)xen/arch/arm/arm64/head.S +0
-0xen/arch/arm/arm64/head.S paging: · line 530
Quoted 8 lines
xen/arch/arm/arm64/head.S +1
-1@@ -524,7 +524,7 @@ paging: lsl x2, x2, #THIRD_SHIFT /* 4K aligned paddr of UART */ mov x3, #PT_DEV_L3 orr x2, x2, x3 /* x2 := 4K dev map including UART */ - str x2, [x1, #(FIXMAP_CONSOLE*8)] /* Map it in the first fixmap's slot */ + str x2, [x1, #(FIXMAP_CONSOLE << 3)] /* Map it in the first fixmap's slot */ 1: /* Map fixmap into boot_second */--
Julien Grall
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Hello Peng,
I would specific the file modified in the title.
Quoted 1 line · Peng Fan
The 'Base address for 4K mapping' is '(x19 >>
THIRD_SHIFT) <<THIRD_SHIFT'.
The computation is a sequence of 2 instructions. I gave a look to the rest of the file and the comments are usually put on the first instruction.
So I would much prefer to stay consistent with the rest of the code.
Quoted 1 line
Also we are building 4K page mapping, not section mapping.
To be fair, a page is a specialized section.
Quoted 13 lines
Signed-off-by Peng Fan <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Julien Grall <[email protected]>--- xen/arch/arm/arm64/head.S | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)xen/arch/arm/arm64/head.S +0
-0@@ -471,10 +471,10 @@ skip_bss: ldr x4, =boot_third
xen/arch/arm/arm64/head.S skip_bss: · line 477
Quoted 10 lines
xen/arch/arm/arm64/head.S +4
-4add x4, x4, x20 /* x4 := paddr (boot_third) */ - lsr x2, x19, #THIRD_SHIFT /* Base address for 4K mapping */ - lsl x2, x2, #THIRD_SHIFT - mov x3, #PT_MEM_L3 /* x2 := Section map */ - orr x2, x2, x3 + lsr x2, x19, #THIRD_SHIFT + lsl x2, x2, #THIRD_SHIFT /* Base address for 4K mapping */ + mov x3, #PT_MEM_L3 + orr x2, x2, x3 /* x2 := Page map */
The section map is the combination of 2 instructions. With this change we don't know quickly what the purpose of "mov x3, #PT_MEM_L3".
xen/arch/arm/arm64/head.S skip_bss:
Quoted 4 lines
xen/arch/arm/arm64/head.S +0
-0/* ... map of vaddr(start) in boot_third */ mov x1, xzr
Regards,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH 2/2] xen/arm64: use shift operator
In reply to Julien GrallHi Julien,
Quoted 21 lines · Julien Grall
Quoted 1 line · Peng Fan
Hi Julien,
Hello Peng,
Quoted 12 lines · Julien Grall
Quoted 7 lines
Hello Peng,
Quoted 2 lines · Peng Fan
Use shift operator, but not muliplication.
No function change.Why? The compiler will calculate the address at compilation time.
Yeah. The compiler will do this. I just think in asm, we rarely use
multiplication. In this file, there is "cmp x1, #(LPAE_ENTRIES<<3)",
here use shift operator but not multiplication.It took me a bit of time to understand that 8 is the number of byte of an LPAE entries. IMHO the "<< 3" would be more confusing.
Quoted 6 lines
So I would introduce a macro to get the slot based of an index. Something like:
LPAE_SLOT(slot)((slot) * 8)And add a comment to explain why 8. You could even introduce
LPAE_ENTRY_SIZE.
Thanks for comments. I'll try to submit a new patch following your suggestion.
Thanks,
Peng.
Quoted 28 lines
Regards,
Quoted 25 lines
Thanks,
Peng.Quoted 22 lines
Regards,
Quoted 19 lines
Signed-off-by Peng Fan <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Julien Grall <[email protected]>--- xen/arch/arm/arm64/head.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)xen/arch/arm/arm64/head.S +1
-1@@ -524,7 +524,7 @@ paging: lsl x2, x2, #THIRD_SHIFT /* 4K aligned paddr of UART */ mov x3, #PT_DEV_L3 orr x2, x2, x3 /* x2 := 4K dev map including UART */ - str x2, [x1, #(FIXMAP_CONSOLE*8)] /* Map it in the first fixmap's slot */ + str x2, [x1, #(FIXMAP_CONSOLE << 3)] /* Map it in the first fixmap's slot */ 1:
Quoted 9 lines
Quoted 6 lines
Quoted 5 lines
xen/arch/arm/arm64/head.S paging: · line 530
Quoted 2 lines
xen/arch/arm/arm64/head.S +0
-0/* Map fixmap into boot_second */--
Julien GrallSignature · 1 line
Julien Grall
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel