Skip to contentSkip to conversation

include: sbi: Don't unconditionally define '__always_inline'

PATCH New Anup Patel 3 participants 3 messages Sep 15, 2024 – Sep 27, 2024

lore
Share & tools
lore

Anup Patel

author
#0 lore raw

PATCH 1/1 include: sbi: Don't unconditionally define '__always_inline'

From: Elyes Haouas <[email protected]>

Update __always_inline macro define to fix opensbi upstream
build for coreboot.
Refer, https://qa.coreboot.org/job/coreboot-gerrit/257449/testReport/junit/(root)/clang/EMULATION_QEMU_RISCV_RV64_/

---
 include/sbi/sbi_types.h | 3 +++
 1 file changed, 3 insertions(+)
include/sbi/sbi_types.h +3 -0
index def88bba..a9943d29 100644
@@ -69,7 +69,10 @@ typedef uint64_t		be64_t;
 #define __packed		__attribute__((packed))
 #define __noreturn		__attribute__((noreturn))
 #define __aligned(x)		__attribute__((aligned(x)))
+
+#ifndef __always_inline
 #define __always_inline	inline __attribute__((always_inline))
+#endif
 
 #define likely(x) __builtin_expect((x), 1)
 #define unlikely(x) __builtin_expect((x), 0)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/1 include: sbi: Don't unconditionally define '__always_inline'

Quoted 18 lines · Anup Patel

From: Elyes Haouas <[email protected]>

Update __always_inline macro define to fix opensbi upstream
build for coreboot.
Refer, https://qa.coreboot.org/job/coreboot-gerrit/257449/testReport/junit/(root)/clang/EMULATION_QEMU_RISCV_RV64_/

---
 include/sbi/sbi_types.h | 3 +++
 1 file changed, 3 insertions(+)
include/sbi/sbi_types.h +0 -0
index def88bba..a9943d29 100644

include/sbi/sbi_types.h typedef uint64_t be64_t; · line 75

Quoted 7 lines
include/sbi/sbi_types.h +3 -0
@@ -69,7 +69,10 @@ typedef uint64_t		be64_t;
 #define __packed		__attribute__((packed))
 #define __noreturn		__attribute__((noreturn))
 #define __aligned(x)		__attribute__((aligned(x)))
+
+#ifndef __always_inline
 #define __always_inline	inline __attribute__((always_inline))
+#endif

If we're concerned about an existing definition behaving differently, we could unconditionally #undef __always_inline instead. But I expect any existing definition to be equivalent, so:

Quoted 3 lines
include/sbi/sbi_types.h +0 -0
 #define likely(x) __builtin_expect((x), 1)
 #define unlikely(x) __builtin_expect((x), 0)
Applied
#2 lore raw

PATCH 1/1 include: sbi: Don't unconditionally define '__always_inline'

In reply to Anup Patel
Quoted 10 lines · On Sun, Sep 15, 2024 at 9:34?PM Anup Patel <[email protected]> wrote:

From: Elyes Haouas <[email protected]>

Update __always_inline macro define to fix opensbi upstream
build for coreboot.
Refer, https://qa.coreboot.org/job/coreboot-gerrit/257449/testReport/junit/(root)/clang/EMULATION_QEMU_RISCV_RV64_/

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

Quoted 22 lines
---
 include/sbi/sbi_types.h | 3 +++
 1 file changed, 3 insertions(+)
include/sbi/sbi_types.h +3 -1
index def88bba..a9943d29 100644
@@ -69,7 +69,10 @@ typedef uint64_t             be64_t;
 #define __packed               __attribute__((packed))
 #define __noreturn             __attribute__((noreturn))
 #define __aligned(x)           __attribute__((aligned(x)))
+
+#ifndef __always_inline
 #define __always_inline        inline __attribute__((always_inline))
+#endif
 
 #define likely(x) __builtin_expect((x), 1)
 #define unlikely(x) __builtin_expect((x), 0)
--

2.43.0