Skip to contentSkip to conversation

psci: put psci_method in .data section if EFI_LOADER is not enabled

PATCH New Patrick Delaunay 2 participants 2 messages Jul 17, 2020 – Aug 5, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 psci: put psci_method in .data section if EFI_LOADER is not enabled

From: Yann Gautier <[email protected]>

Move the variable psci_method in .data section when EFI is not activated and the psci driver safely access it before relocation.

Without this patch the variable is located in .bss section and the psci probe requested before relocation corrupts the device tree (probe is requested by board_f.c::print_resetinfo()).

When EFI_LOADER is activated, this variable in already located in the .data.efi_runtime section by __efi_runtime_data.

---

 drivers/firmware/psci.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/firmware/psci.c +4 -0
index 23cf807591..7d2e49fd3e 100644
@@ -25,7 +25,11 @@
 #define PSCI_METHOD_HVC 1
 #define PSCI_METHOD_SMC 2
 
+#if CONFIG_IS_ENABLED(EFI_LOADER)
 int __efi_runtime_data psci_method;
+#else
+int psci_method __attribute__ ((section(".data")));
+#endif
 
 unsigned long __efi_runtime invoke_psci_fn
 		(unsigned long function_id, unsigned long arg0,
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 psci: put psci_method in .data section if EFI_LOADER is not enabled

Quoted 9 lines · Patrick Delaunay

From: Yann Gautier <[email protected]>

Move the variable psci_method in .data section when EFI is not activated and the psci driver safely access it before relocation.

Without this patch the variable is located in .bss section and the psci probe requested before relocation corrupts the device tree (probe is requested by board_f.c::print_resetinfo()).

Quoted 5 lines

When EFI_LOADER is activated, this variable in already located in the .data.efi_runtime section by __efi_runtime_data.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200805/49d7339d/attachment.sig>