xen/arm: Properly clean update to init_ttbr and smp_up_cpu
PATCH 1/1 xen/arm: Properly clean update to init_ttbr and smp_up_cpu
From: Julien Grall <[email protected]>
Recent rework to the secondary boot code modified how init_ttbr and smp_up_cpu are accessed. Rather than directly accessing them, we are using a pointer to them.
The helper clean_dcache() is expected to take the variable in parameter and then clean its content. As we now pass a pointer to the variable, we will clean the area storing the address rather than the content itself.
Switch to use clean_dcache_va_range() to avoid casting the pointer.
--- xen/arch/arm/mmu/smpboot.c | 2 +- xen/arch/arm/smpboot.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
xen/arch/arm/mmu/smpboot.c +1 -1
@@ -88,7 +88,7 @@ static void set_init_ttbr(lpae_t *root)* init_ttbr will be accessed with the MMU off, so ensure the update * is visible by cleaning the cache. */ -clean_dcache (ptr); +clean_dcache_va_range (ptr,sizeof (uint64_t ));unmap_domain_page (ptr); }
xen/arch/arm/smpboot.c +1 -1
@@ -449,7 +449,7 @@ static void set_smp_up_cpu(unsigned long mpidr)* smp_up_cpu will be accessed with the MMU off, so ensure the update * is visible by cleaning the cache. */ -clean_dcache (ptr); +clean_dcache_va_range (ptr,sizeof (unsigned long ));unmap_domain_page (ptr);
Signature · 1 line
2.40.1
On 30.01.24 19:29, Julien Grall wrote:
Hello Julien
Quoted 10 lines
From: Julien Grall <[email protected]>
Recent rework to the secondary boot code modified how
init_ttbrandsmp_up_cpuare accessed. Rather than directly accessing them, we are using a pointer to them.The helper
clean_dcache()is expected to take the variable in parameter and then clean its content. As we now pass a pointer to the variable, we will clean the area storing the address rather than the content itself.
Quoted 7 lines
Switch to use
clean_dcache_va_range()to avoid casting the pointer.Fixes a5ed59e62c6f ("arm/mmu: Move init_ttbr to a new section .data.idmap")Fixes 9a5114074b04 ("arm/smpboot: Move smp_up_cpu to a new section .data.idmap)Reported-by Oleksandr Tyshchenko <[email protected]>Signed-off-by Julien Grall <[email protected]>
Quoted 31 lines
--- xen/arch/arm/mmu/smpboot.c | 2 +- xen/arch/arm/smpboot.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)xen/arch/arm/mmu/smpboot.c +1
-1@@ -88,7 +88,7 @@ static void set_init_ttbr(lpae_t *root)* init_ttbr will be accessed with the MMU off, so ensure the update * is visible by cleaning the cache. */ -clean_dcache (ptr); +clean_dcache_va_range (ptr,sizeof (uint64_t ));unmap_domain_page (ptr); }xen/arch/arm/smpboot.c +1
-1@@ -449,7 +449,7 @@ static void set_smp_up_cpu(unsigned long mpidr)* smp_up_cpu will be accessed with the MMU off, so ensure the update * is visible by cleaning the cache. */ -clean_dcache (ptr); +clean_dcache_va_range (ptr,sizeof (unsigned long ));unmap_domain_page (ptr);
Hi Julien,
Nice finding :-)
Quoted 12 lines · Julien Grall
From: Julien Grall <[email protected]>
Recent rework to the secondary boot code modified how
init_ttbrandsmp_up_cpuare accessed. Rather than directly accessing them, we are using a pointer to them.The helper
clean_dcache()is expected to take the variable in parameter and then clean its content. As we now pass a pointer to the variable, we will clean the area storing the address rather than the content itself.
Quoted 7 lines
Switch to use
clean_dcache_va_range()to avoid casting the pointer.Fixes a5ed59e62c6f ("arm/mmu: Move init_ttbr to a new section .data.idmap")Fixes 9a5114074b04 ("arm/smpboot: Move smp_up_cpu to a new section .data.idmap)Reported-by Oleksandr Tyshchenko <[email protected]>Signed-off-by Julien Grall <[email protected]>
Cheers
Bertrand
Quoted 34 lines
---
xen/arch/arm/mmu/smpboot.c| 2 +-xen/arch/arm/smpboot.c| 2 +-2 files changed, 2 insertions(+), 2 deletions(-)xen/arch/arm/mmu/smpboot.c +1
-1@@ -88,7 +88,7 @@ static void set_init_ttbr(lpae_t *root)* init_ttbr will be accessed with the MMU off, so ensure the update * is visible by cleaning the cache. */ -clean_dcache (ptr); +clean_dcache_va_range (ptr,sizeof (uint64_t ));unmap_domain_page (ptr); }xen/arch/arm/smpboot.c +1
-1@@ -449,7 +449,7 @@ static void set_smp_up_cpu(unsigned long mpidr)* smp_up_cpu will be accessed with the MMU off, so ensure the update * is visible by cleaning the cache. */ -clean_dcache (ptr); +clean_dcache_va_range (ptr,sizeof (unsigned long ));unmap_domain_page (ptr);Signature · 1 line
2.40.1
Hi,
Quoted 14 lines · Bertrand Marquis
Quoted 14 lines · Julien Grall
From: Julien Grall <[email protected]>
Recent rework to the secondary boot code modified how
init_ttbrandsmp_up_cpuare accessed. Rather than directly accessing them, we are using a pointer to them.The helper
clean_dcache()is expected to take the variable in parameter and then clean its content. As we now pass a pointer to the variable, we will clean the area storing the address rather than the content itself.Switch to use
clean_dcache_va_range()to avoid casting the pointer.
Quoted 7 lines
Quoted 5 lines
Fixes a5ed59e62c6f ("arm/mmu: Move init_ttbr to a new section .data.idmap")Fixes 9a5114074b04 ("arm/smpboot: Move smp_up_cpu to a new section .data.idmap)Reported-by Oleksandr Tyshchenko <[email protected]>Signed-off-by Julien Grall <[email protected]>Reviewed-by Bertrand Marquis <[email protected]>
Committed. Thanks.
Cheers,
Signature · 1 line
Julien Grall