mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-05-05 04:36:13 +02:00
Merge patch series "drop volatile from global data"
Rasmus Villemoes <ravi@prevas.dk> says: There's really no reason for the gd pointer to have the volatile qualifier. In fact, I claim that it's completely unnecessary and just pessimizes code generation and forces ugly casts in lots of places. For example, see the casts in drivers/core/tag.c where elements are added to gd->dm_taglist, or a helper such as cyclic_get_list() that should not be needed. Also, it is what ends up standing in the way of an otherwise innocent code cleanup of list.h: https://lore.kernel.org/u-boot/20250522165656.GB2179216@bill-the-cat/ Note that riscv, x86 as well as arm64 with LTO enabled has not had this volatile qualifier, so it's unlikely there's any generic code that depends on it. Link: https://lore.kernel.org/r/20250604195612.2312979-1-ravi@prevas.dk
This commit is contained in:
commit
2556caa89c
@ -20,6 +20,6 @@ struct arch_global_data {
|
||||
|
||||
#include <asm-generic/global_data.h>
|
||||
|
||||
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r25")
|
||||
#define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("r25")
|
||||
|
||||
#endif /* __ASM_ARC_GLOBAL_DATA_H */
|
||||
|
||||
@ -133,13 +133,13 @@ static inline gd_t *get_gd(void)
|
||||
#else
|
||||
|
||||
#ifdef CONFIG_ARM64
|
||||
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("x18")
|
||||
#define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("x18")
|
||||
#else
|
||||
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r9")
|
||||
#define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("r9")
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static inline void set_gd(volatile gd_t *gd_ptr)
|
||||
static inline void set_gd(gd_t *gd_ptr)
|
||||
{
|
||||
#ifdef CONFIG_ARM64
|
||||
__asm__ volatile("ldr x18, %0\n" : : "m"(gd_ptr));
|
||||
|
||||
@ -74,7 +74,7 @@ static int verify_ivt_header(struct ivt_header *ivt_hdr)
|
||||
#define FSL_SIP_HAB_REPORT_STATUS 0x04
|
||||
#define FSL_SIP_HAB_FAILSAFE 0x05
|
||||
#define FSL_SIP_HAB_CHECK_TARGET 0x06
|
||||
static volatile gd_t *gd_save;
|
||||
static gd_t *gd_save;
|
||||
#endif
|
||||
|
||||
static inline void save_gd(void)
|
||||
|
||||
@ -67,7 +67,7 @@ int mmc_get_env_dev(void)
|
||||
u16 boot_type;
|
||||
u8 boot_instance;
|
||||
|
||||
volatile gd_t *pgd = gd;
|
||||
gd_t *pgd = gd;
|
||||
rom_passover_t *rdata;
|
||||
|
||||
#if IS_ENABLED(CONFIG_XPL_BUILD)
|
||||
@ -675,7 +675,7 @@ enum imx9_soc_voltage_mode soc_target_voltage_mode(void)
|
||||
#if IS_ENABLED(CONFIG_SCMI_FIRMWARE)
|
||||
enum boot_device get_boot_device(void)
|
||||
{
|
||||
volatile gd_t *pgd = gd;
|
||||
gd_t *pgd = gd;
|
||||
int ret;
|
||||
u16 boot_type;
|
||||
u8 boot_instance;
|
||||
|
||||
@ -9,7 +9,7 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||
u32 rom_api_download_image(u8 *dest, u32 offset, u32 size)
|
||||
{
|
||||
u32 xor = (uintptr_t)dest ^ offset ^ size;
|
||||
volatile gd_t *sgd = gd;
|
||||
gd_t *sgd = gd;
|
||||
u32 ret;
|
||||
|
||||
ret = g_rom_api->download_image(dest, offset, size, xor);
|
||||
@ -21,7 +21,7 @@ u32 rom_api_download_image(u8 *dest, u32 offset, u32 size)
|
||||
u32 rom_api_query_boot_infor(u32 info_type, u32 *info)
|
||||
{
|
||||
u32 xor = info_type ^ (uintptr_t)info;
|
||||
volatile gd_t *sgd = gd;
|
||||
gd_t *sgd = gd;
|
||||
u32 ret;
|
||||
|
||||
ret = g_rom_api->query_boot_infor(info_type, info, xor);
|
||||
@ -34,7 +34,7 @@ extern struct rom_api *g_rom_api;
|
||||
|
||||
enum boot_device get_boot_device(void)
|
||||
{
|
||||
volatile gd_t *pgd = gd;
|
||||
gd_t *pgd = gd;
|
||||
int ret;
|
||||
u32 boot;
|
||||
u16 boot_type;
|
||||
|
||||
@ -32,11 +32,6 @@ struct arch_global_data {
|
||||
|
||||
#include <asm-generic/global_data.h>
|
||||
|
||||
#if 0
|
||||
extern gd_t *global_data;
|
||||
#define DECLARE_GLOBAL_DATA_PTR gd_t *gd = global_data
|
||||
#else
|
||||
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("d7")
|
||||
#endif
|
||||
#define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("d7")
|
||||
|
||||
#endif /* __ASM_GBL_DATA_H */
|
||||
|
||||
@ -18,7 +18,7 @@ struct arch_global_data {
|
||||
|
||||
#include <asm-generic/global_data.h>
|
||||
|
||||
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r31")
|
||||
#define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("r31")
|
||||
|
||||
#define gd_cpuinfo() ((struct microblaze_cpuinfo *)&gd->arch.cpuinfo)
|
||||
|
||||
|
||||
@ -44,6 +44,6 @@ struct arch_global_data {
|
||||
|
||||
#include <asm-generic/global_data.h>
|
||||
|
||||
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("k0")
|
||||
#define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("k0")
|
||||
|
||||
#endif /* __ASM_GBL_DATA_H */
|
||||
|
||||
@ -93,7 +93,7 @@ struct arch_global_data {
|
||||
|
||||
#include <asm-generic/global_data.h>
|
||||
|
||||
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r2")
|
||||
#define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("r2")
|
||||
|
||||
#include <asm/u-boot.h>
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ static inline gd_t *get_gd(void)
|
||||
|
||||
#endif
|
||||
|
||||
static inline void set_gd(volatile gd_t *gd_ptr)
|
||||
static inline void set_gd(gd_t *gd_ptr)
|
||||
{
|
||||
#ifdef CONFIG_64BIT
|
||||
asm volatile("ld gp, %0\n" : : "m"(gd_ptr));
|
||||
|
||||
@ -58,7 +58,7 @@ static efi_handle_t current_image;
|
||||
* restriction so we need to manually swap its and our view of that register on
|
||||
* EFI callback entry/exit.
|
||||
*/
|
||||
static volatile gd_t *efi_gd, *app_gd;
|
||||
static gd_t *efi_gd, *app_gd;
|
||||
#endif
|
||||
|
||||
efi_status_t efi_uninstall_protocol
|
||||
|
||||
@ -66,7 +66,7 @@ static inline uintptr_t __attribute__((no_instrument_function))
|
||||
/**
|
||||
* trace_gd - the value of the gd register
|
||||
*/
|
||||
static volatile gd_t *trace_gd;
|
||||
static gd_t *trace_gd;
|
||||
|
||||
/**
|
||||
* trace_save_gd() - save the value of the gd register
|
||||
@ -86,7 +86,7 @@ static void notrace trace_save_gd(void)
|
||||
*/
|
||||
static void notrace trace_swap_gd(void)
|
||||
{
|
||||
volatile gd_t *temp_gd = trace_gd;
|
||||
gd_t *temp_gd = trace_gd;
|
||||
|
||||
trace_gd = gd;
|
||||
set_gd(temp_gd);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user