Skip to contentSkip to conversation

global_data: Move x86 specific GD flags into common flags

PATCH New Stefan Roese 3 participants 5 messages Aug 15, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 global_data: Move x86 specific GD flags into common flags

Currently the upper 16 bits of the GD flags are reserved for architecture specific flags. But only x86 uses 2 bits of these 16 bits and sprinkling those flags in multiple headers is confusing and does not scale.

This patch now moves the x86 flags into the common header and removes the comment about the reservation of the upper 16 bits.

Cc Bin Meng <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>
Cc Simon Goldschmidt <[email protected]>
---
 arch/x86/include/asm/global_data.h | 6 ------
 include/asm-generic/global_data.h  | 6 +++++-
 2 files changed, 5 insertions(+), 7 deletions(-)
arch/x86/include/asm/global_data.h +0 -6
index 797397e697..17a4d34491 100644
@@ -137,10 +137,4 @@ static inline __attribute__((no_instrument_function)) gd_t *get_fs_gd_ptr(void)
 
 #endif
 
-/*
- * Our private Global Data Flags
- */
-#define GD_FLG_COLD_BOOT	0x10000	/* Cold Boot */
-#define GD_FLG_WARM_BOOT	0x20000	/* Warm Boot */
-
 #endif /* __ASM_GBL_DATA_H */
include/asm-generic/global_data.h +5 -1
index 5372d5d8cd..42ae61c781 100644
@@ -150,7 +150,7 @@ typedef struct global_data {
 #endif
 
 /*
- * Global Data Flags - the top 16 bits are reserved for arch-specific flags
+ * Common Global Data Flags
  */
 #define GD_FLG_RELOC		0x00001	/* Code was relocated to RAM	   */
 #define GD_FLG_DEVINIT		0x00002	/* Devices have been initialized   */
@@ -170,4 +170,8 @@ typedef struct global_data {
 #define GD_FLG_LOG_READY	0x08000 /* Log system is ready for use	   */
 #define GD_FLG_WDT_READY	0x10000 /* Watchdog is ready for use	   */
 
+/* x86 specific GD flags */
+#define GD_FLG_COLD_BOOT	0x20000	/* Cold Boot */
+#define GD_FLG_WARM_BOOT	0x40000	/* Warm Boot */
+
 #endif /* __ASM_GENERIC_GBL_DATA_H */
Signature · 1 line
2.22.1
#1 lore raw

PATCH 1/1 global_data: Move x86 specific GD flags into common flags

Quoted 14 lines · Stefan Roese

Currently the upper 16 bits of the GD flags are reserved for architecture specific flags. But only x86 uses 2 bits of these 16 bits and sprinkling those flags in multiple headers is confusing and does not scale.

This patch now moves the x86 flags into the common header and removes the comment about the reservation of the upper 16 bits.

Cc Bin Meng <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>
Cc Simon Goldschmidt <[email protected]>
Quoted 5 lines
---
 arch/x86/include/asm/global_data.h | 6 ------
 include/asm-generic/global_data.h  | 6 +++++-
 2 files changed, 5 insertions(+), 7 deletions(-)
#2 lore raw

PATCH 1/1 global_data: Move x86 specific GD flags into common flags

In reply to Stefan Roese

Hi Stefan,

Quoted 48 lines · Stefan Roese

Currently the upper 16 bits of the GD flags are reserved for architecture specific flags. But only x86 uses 2 bits of these 16 bits and sprinkling those flags in multiple headers is confusing and does not scale.

This patch now moves the x86 flags into the common header and removes the comment about the reservation of the upper 16 bits.

Cc Bin Meng <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>
Cc Simon Goldschmidt <[email protected]>
---
 arch/x86/include/asm/global_data.h | 6 ------
 include/asm-generic/global_data.h  | 6 +++++-
 2 files changed, 5 insertions(+), 7 deletions(-)
arch/x86/include/asm/global_data.h +0 -6
index 797397e697..17a4d34491 100644
@@ -137,10 +137,4 @@ static inline __attribute__((no_instrument_function)) gd_t *get_fs_gd_ptr(void)
 
 #endif
 
-/*
- * Our private Global Data Flags
- */
-#define GD_FLG_COLD_BOOT       0x10000 /* Cold Boot */
-#define GD_FLG_WARM_BOOT       0x20000 /* Warm Boot */
-
 #endif /* __ASM_GBL_DATA_H */
include/asm-generic/global_data.h +1 -1
index 5372d5d8cd..42ae61c781 100644
@@ -150,7 +150,7 @@ typedef struct global_data {
 #endif
 
 /*
- * Global Data Flags - the top 16 bits are reserved for arch-specific flags
+ * Common Global Data Flags
  */
 #define GD_FLG_RELOC           0x00001 /* Code was relocated to RAM       */
 #define GD_FLG_DEVINIT         0x00002 /* Devices have been initialized   */

include/asm-generic/global_data.h typedef struct global_data { · line 175

Quoted 6 lines
include/asm-generic/global_data.h +3 -0
@@ -170,4 +170,8 @@ typedef struct global_data {
 #define GD_FLG_LOG_READY       0x08000 /* Log system is ready for use     */
 #define GD_FLG_WDT_READY       0x10000 /* Watchdog is ready for use       */
 
+/* x86 specific GD flags */
+#define GD_FLG_COLD_BOOT       0x20000 /* Cold Boot */
+#define GD_FLG_WARM_BOOT       0x40000 /* Warm Boot */

I think this change is generally good, but I failed to find code using the flag GD_FLG_WARM_BOOT (it's only set, not checked). Only the cold-boot flag is used (in coreboot's last_stage_init).

So, since we don't have too many bits free here, instead of wasting 2 for x86, could we probably remove one of these. Especially since you can either have warm OR cold, but not both (so the absence of 'WARM' could mean 'COLD')?

Regards,
Simon

Quoted 5 lines
include/asm-generic/global_data.h +1 -1
+
 #endif /* __ASM_GENERIC_GBL_DATA_H */
--

2.22.1

#3 lore raw

PATCH 1/1 global_data: Move x86 specific GD flags into common flags

Hi Simon,

Quoted 62 lines · Simon Goldschmidt

Hi Stefan,

Quoted 48 lines · Stefan Roese

Currently the upper 16 bits of the GD flags are reserved for architecture specific flags. But only x86 uses 2 bits of these 16 bits and sprinkling those flags in multiple headers is confusing and does not scale.

This patch now moves the x86 flags into the common header and removes the comment about the reservation of the upper 16 bits.

Cc Bin Meng <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>
Cc Simon Goldschmidt <[email protected]>
---
  arch/x86/include/asm/global_data.h | 6 ------
  include/asm-generic/global_data.h  | 6 +++++-
  2 files changed, 5 insertions(+), 7 deletions(-)
arch/x86/include/asm/global_data.h +0 -6
index 797397e697..17a4d34491 100644
@@ -137,10 +137,4 @@ static inline __attribute__((no_instrument_function)) gd_t *get_fs_gd_ptr(void)
 
  #endif
 
-/*
- * Our private Global Data Flags
- */
-#define GD_FLG_COLD_BOOT       0x10000 /* Cold Boot */
-#define GD_FLG_WARM_BOOT       0x20000 /* Warm Boot */
-
  #endif /* __ASM_GBL_DATA_H */
include/asm-generic/global_data.h +1 -1
index 5372d5d8cd..42ae61c781 100644
@@ -150,7 +150,7 @@ typedef struct global_data {
  #endif
 
  /*
- * Global Data Flags - the top 16 bits are reserved for arch-specific flags
+ * Common Global Data Flags
   */
  #define GD_FLG_RELOC           0x00001 /* Code was relocated to RAM       */
  #define GD_FLG_DEVINIT         0x00002 /* Devices have been initialized   */

include/asm-generic/global_data.h typedef struct global_data { · line 175

Quoted 6 lines
include/asm-generic/global_data.h +3 -0
@@ -170,4 +170,8 @@ typedef struct global_data {
  #define GD_FLG_LOG_READY       0x08000 /* Log system is ready for use     */
  #define GD_FLG_WDT_READY       0x10000 /* Watchdog is ready for use       */
 
+/* x86 specific GD flags */
+#define GD_FLG_COLD_BOOT       0x20000 /* Cold Boot */
+#define GD_FLG_WARM_BOOT       0x40000 /* Warm Boot */

I think this change is generally good, but I failed to find code using the flag GD_FLG_WARM_BOOT (it's only set, not checked). Only the cold-boot flag is used (in coreboot's last_stage_init).

Quoted 3 lines

So, since we don't have too many bits free here, instead of wasting 2 for x86, could we probably remove one of these. Especially since you can either have warm OR cold, but not both (so the absence of 'WARM' could mean 'COLD')?

Yes. I already commented on those 2 x86 bits and their (non-)usage:

https://lists.denx.de/pipermail/u-boot/2019-August/380634.html
&
https://lists.denx.de/pipermail/u-boot/2019-August/380800.html

My suggestion is to apply this patch now and re-work the x86 flags usage in a later patch (most likely remove one of those bits). The main reason being that this double usage of 0x10000 needs to get fixed quickly.

Thanks,
Stefan

#4 lore raw

PATCH 1/1 global_data: Move x86 specific GD flags into common flags

Hi Stefan,

Quoted 72 lines · Stefan Roese

Hi Simon,

Quoted 62 lines · Simon Goldschmidt

Hi Stefan,

Quoted 48 lines · Stefan Roese

Currently the upper 16 bits of the GD flags are reserved for architecture specific flags. But only x86 uses 2 bits of these 16 bits and sprinkling those flags in multiple headers is confusing and does not scale.

This patch now moves the x86 flags into the common header and removes the comment about the reservation of the upper 16 bits.

Cc Bin Meng <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tom Rini <[email protected]>
Cc Simon Goldschmidt <[email protected]>
---
  arch/x86/include/asm/global_data.h | 6 ------
  include/asm-generic/global_data.h  | 6 +++++-
  2 files changed, 5 insertions(+), 7 deletions(-)
arch/x86/include/asm/global_data.h +0 -6
index 797397e697..17a4d34491 100644
@@ -137,10 +137,4 @@ static inline __attribute__((no_instrument_function)) gd_t *get_fs_gd_ptr(void)
 
  #endif
 
-/*
- * Our private Global Data Flags
- */
-#define GD_FLG_COLD_BOOT       0x10000 /* Cold Boot */
-#define GD_FLG_WARM_BOOT       0x20000 /* Warm Boot */
-
  #endif /* __ASM_GBL_DATA_H */
include/asm-generic/global_data.h +1 -1
index 5372d5d8cd..42ae61c781 100644
@@ -150,7 +150,7 @@ typedef struct global_data {
  #endif
 
  /*
- * Global Data Flags - the top 16 bits are reserved for arch-specific flags
+ * Common Global Data Flags
   */
  #define GD_FLG_RELOC           0x00001 /* Code was relocated to RAM       */
  #define GD_FLG_DEVINIT         0x00002 /* Devices have been initialized   */

include/asm-generic/global_data.h typedef struct global_data { · line 175

Quoted 6 lines
include/asm-generic/global_data.h +3 -0
@@ -170,4 +170,8 @@ typedef struct global_data {
  #define GD_FLG_LOG_READY       0x08000 /* Log system is ready for use     */
  #define GD_FLG_WDT_READY       0x10000 /* Watchdog is ready for use       */
 
+/* x86 specific GD flags */
+#define GD_FLG_COLD_BOOT       0x20000 /* Cold Boot */
+#define GD_FLG_WARM_BOOT       0x40000 /* Warm Boot */

I think this change is generally good, but I failed to find code using the flag GD_FLG_WARM_BOOT (it's only set, not checked). Only the cold-boot flag is used (in coreboot's last_stage_init).

Quoted 3 lines

So, since we don't have too many bits free here, instead of wasting 2 for x86, could we probably remove one of these. Especially since you can either have warm OR cold, but not both (so the absence of 'WARM' could mean 'COLD')?

Yes. I already commented on those 2 x86 bits and their (non-)usage:

Quoted 7 lines

https://lists.denx.de/pipermail/u-boot/2019-August/380634.html
&
https://lists.denx.de/pipermail/u-boot/2019-August/380800.html

My suggestion is to apply this patch now and re-work the x86 flags usage in a later patch (most likely remove one of those bits). The main reason being that this double usage of 0x10000 needs to get fixed quickly.

You're right. In that case:

Regards,
Simon