Skip to content

Commit 2f278b5

Browse files
benzeajmberg-intel
authored andcommitted
um: always include kconfig.h and compiler-version.h
Since commit a95b37e ("kbuild: get <linux/compiler_types.h> out of <linux/kconfig.h>") we can safely include these files in userspace code. Doing so simplifies matters as options do not need to be exported via asm-offsets.h anymore. Signed-off-by: Benjamin Berg <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Johannes Berg <[email protected]>
1 parent fce0128 commit 2f278b5

File tree

7 files changed

+16
-31
lines changed

7 files changed

+16
-31
lines changed

arch/um/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ KBUILD_AFLAGS += $(ARCH_INCLUDE)
7171
USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -I%,,$(KBUILD_CFLAGS))) \
7272
$(ARCH_INCLUDE) $(MODE_INCLUDE) $(filter -I%,$(CFLAGS)) \
7373
-D_FILE_OFFSET_BITS=64 -idirafter $(srctree)/include \
74-
-idirafter $(objtree)/include -D__KERNEL__ -D__UM_HOST__
74+
-idirafter $(objtree)/include -D__KERNEL__ -D__UM_HOST__ \
75+
-include $(srctree)/include/linux/compiler-version.h \
76+
-include $(srctree)/include/linux/kconfig.h
7577

7678
#This will adjust *FLAGS accordingly to the platform.
7779
include $(srctree)/$(ARCH_DIR)/Makefile-os-Linux

arch/um/include/shared/common-offsets.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,3 @@ DEFINE(UM_THREAD_SIZE, THREAD_SIZE);
1515

1616
DEFINE(UM_NSEC_PER_SEC, NSEC_PER_SEC);
1717
DEFINE(UM_NSEC_PER_USEC, NSEC_PER_USEC);
18-
19-
#ifdef CONFIG_PRINTK
20-
DEFINE(UML_CONFIG_PRINTK, CONFIG_PRINTK);
21-
#endif
22-
#ifdef CONFIG_UML_X86
23-
DEFINE(UML_CONFIG_UML_X86, CONFIG_UML_X86);
24-
#endif
25-
#ifdef CONFIG_64BIT
26-
DEFINE(UML_CONFIG_64BIT, CONFIG_64BIT);
27-
#endif
28-
#ifdef CONFIG_UML_TIME_TRAVEL_SUPPORT
29-
DEFINE(UML_CONFIG_UML_TIME_TRAVEL_SUPPORT, CONFIG_UML_TIME_TRAVEL_SUPPORT);
30-
#endif
31-
#ifdef CONFIG_UML_MAX_USERSPACE_ITERATIONS
32-
DEFINE(UML_CONFIG_UML_MAX_USERSPACE_ITERATIONS, CONFIG_UML_MAX_USERSPACE_ITERATIONS);
33-
#else
34-
DEFINE(UML_CONFIG_UML_MAX_USERSPACE_ITERATIONS, 0);
35-
#endif

arch/um/include/shared/timetravel.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@ enum time_travel_mode {
1212
TT_MODE_EXTERNAL,
1313
};
1414

15-
#if defined(UML_CONFIG_UML_TIME_TRAVEL_SUPPORT) || \
16-
defined(CONFIG_UML_TIME_TRAVEL_SUPPORT)
15+
#if IS_ENABLED(CONFIG_UML_TIME_TRAVEL_SUPPORT)
1716
extern enum time_travel_mode time_travel_mode;
1817
extern int time_travel_should_print_bc_msg;
1918
#else
2019
#define time_travel_mode TT_MODE_OFF
2120
#define time_travel_should_print_bc_msg 0
22-
#endif /* (UML_)CONFIG_UML_TIME_TRAVEL_SUPPORT */
21+
#endif /* CONFIG_UML_TIME_TRAVEL_SUPPORT */
2322

2423
void _time_travel_print_bc_msg(void);
2524
static inline void time_travel_print_bc_msg(void)

arch/um/include/shared/user.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ extern void panic(const char *fmt, ...)
3838
#define UM_KERN_DEBUG KERN_DEBUG
3939
#define UM_KERN_CONT KERN_CONT
4040

41-
#ifdef UML_CONFIG_PRINTK
41+
#if IS_ENABLED(CONFIG_PRINTK)
4242
#define printk(...) _printk(__VA_ARGS__)
4343
extern int _printk(const char *fmt, ...)
4444
__attribute__ ((format (printf, 1, 2)));

arch/um/os-Linux/signal.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static void sig_handler_common(int sig, struct siginfo *si, mcontext_t *mc)
6565
#define SIGALRM_MASK (1 << SIGALRM_BIT)
6666

6767
int signals_enabled;
68-
#ifdef UML_CONFIG_UML_TIME_TRAVEL_SUPPORT
68+
#if IS_ENABLED(CONFIG_UML_TIME_TRAVEL_SUPPORT)
6969
static int signals_blocked, signals_blocked_pending;
7070
#endif
7171
static unsigned int signals_pending;
@@ -75,7 +75,7 @@ static void sig_handler(int sig, struct siginfo *si, mcontext_t *mc)
7575
{
7676
int enabled = signals_enabled;
7777

78-
#ifdef UML_CONFIG_UML_TIME_TRAVEL_SUPPORT
78+
#if IS_ENABLED(CONFIG_UML_TIME_TRAVEL_SUPPORT)
7979
if ((signals_blocked ||
8080
__atomic_load_n(&signals_blocked_pending, __ATOMIC_SEQ_CST)) &&
8181
(sig == SIGIO)) {
@@ -297,7 +297,7 @@ void unblock_signals(void)
297297
return;
298298

299299
signals_enabled = 1;
300-
#ifdef UML_CONFIG_UML_TIME_TRAVEL_SUPPORT
300+
#if IS_ENABLED(CONFIG_UML_TIME_TRAVEL_SUPPORT)
301301
deliver_time_travel_irqs();
302302
#endif
303303

@@ -389,7 +389,7 @@ int um_set_signals_trace(int enable)
389389
return ret;
390390
}
391391

392-
#ifdef UML_CONFIG_UML_TIME_TRAVEL_SUPPORT
392+
#if IS_ENABLED(CONFIG_UML_TIME_TRAVEL_SUPPORT)
393393
void mark_sigio_pending(void)
394394
{
395395
/*

arch/um/os-Linux/skas/process.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,12 +413,14 @@ void userspace(struct uml_pt_regs *regs)
413413
*/
414414
if (time_travel_mode == TT_MODE_INFCPU ||
415415
time_travel_mode == TT_MODE_EXTERNAL) {
416-
if (UML_CONFIG_UML_MAX_USERSPACE_ITERATIONS &&
416+
#ifdef CONFIG_UML_MAX_USERSPACE_ITERATIONS
417+
if (CONFIG_UML_MAX_USERSPACE_ITERATIONS &&
417418
unscheduled_userspace_iterations++ >
418-
UML_CONFIG_UML_MAX_USERSPACE_ITERATIONS) {
419+
CONFIG_UML_MAX_USERSPACE_ITERATIONS) {
419420
tt_extra_sched_jiffies += 1;
420421
unscheduled_userspace_iterations = 0;
421422
}
423+
#endif
422424
}
423425

424426
time_travel_print_bc_msg();

arch/um/os-Linux/util.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ void setup_machinename(char *machine_out)
5252
struct utsname host;
5353

5454
uname(&host);
55-
#ifdef UML_CONFIG_UML_X86
56-
# ifndef UML_CONFIG_64BIT
55+
#if IS_ENABLED(CONFIG_UML_X86)
56+
# if !IS_ENABLED(CONFIG_64BIT)
5757
if (!strcmp(host.machine, "x86_64")) {
5858
strcpy(machine_out, "i686");
5959
return;

0 commit comments

Comments
 (0)