Merge tag 'uml-for-linux-6.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux

Pull uml updates from Johannes Berg:

 - minor preparations for SMP support

 - SPARSE_IRQ support for kunit

 - help output cleanups

* tag 'uml-for-linux-6.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux:
  um: Remove unused ipi_pipe field from cpuinfo_um
  um: Remove unused cpu_data and current_cpu_data macros
  um: Stop tracking virtual CPUs via mm_cpumask()
  um: Centralize stub size calculations
  um: Remove outdated comment about STUB_DATA_PAGES
  um: Remove unused offset and child_err fields from stub_data
  um: Indent time-travel help messages
  um: Fix help message for ssl-non-raw
  um: vector: Fix indentation for help message
  um: Add missing trailing newline to help messages
  um: virtio-pci: implement .shutdown()
  um: Support SPARSE_IRQ
This commit is contained in:
Linus Torvalds
2025-10-06 12:10:55 -07:00
16 changed files with 46 additions and 49 deletions

View File

@@ -39,6 +39,7 @@ config UML
select HAVE_ARCH_TRACEHOOK select HAVE_ARCH_TRACEHOOK
select HAVE_SYSCALL_TRACEPOINTS select HAVE_SYSCALL_TRACEPOINTS
select THREAD_INFO_IN_TASK select THREAD_INFO_IN_TASK
select SPARSE_IRQ
config MMU config MMU
bool bool

View File

@@ -199,4 +199,7 @@ static int ssl_non_raw_setup(char *str)
return 1; return 1;
} }
__setup("ssl-non-raw", ssl_non_raw_setup); __setup("ssl-non-raw", ssl_non_raw_setup);
__channel_help(ssl_non_raw_setup, "set serial lines to non-raw mode"); __uml_help(ssl_non_raw_setup,
"ssl-non-raw\n"
" Set serial lines to non-raw mode.\n\n"
);

View File

@@ -370,7 +370,7 @@ __uml_help(ubd_setup,
" useful when a unique number should be given to the device. Note when\n" " useful when a unique number should be given to the device. Note when\n"
" specifying a label, the filename2 must be also presented. It can be\n" " specifying a label, the filename2 must be also presented. It can be\n"
" an empty string, in which case the backing file is not used:\n" " an empty string, in which case the backing file is not used:\n"
" ubd0=File,,Serial\n" " ubd0=File,,Serial\n\n"
); );
static int udb_setup(char *str) static int udb_setup(char *str)

View File

@@ -598,6 +598,11 @@ static void virtio_pcidev_virtio_remove(struct virtio_device *vdev)
kfree(dev); kfree(dev);
} }
static void virtio_pcidev_virtio_shutdown(struct virtio_device *vdev)
{
/* nothing to do, we just don't want queue shutdown */
}
static struct virtio_device_id id_table[] = { static struct virtio_device_id id_table[] = {
{ CONFIG_UML_PCI_OVER_VIRTIO_DEVICE_ID, VIRTIO_DEV_ANY_ID }, { CONFIG_UML_PCI_OVER_VIRTIO_DEVICE_ID, VIRTIO_DEV_ANY_ID },
{ 0 }, { 0 },
@@ -609,6 +614,7 @@ static struct virtio_driver virtio_pcidev_virtio_driver = {
.id_table = id_table, .id_table = id_table,
.probe = virtio_pcidev_virtio_probe, .probe = virtio_pcidev_virtio_probe,
.remove = virtio_pcidev_virtio_remove, .remove = virtio_pcidev_virtio_remove,
.shutdown = virtio_pcidev_virtio_shutdown,
}; };
static int __init virtio_pcidev_init(void) static int __init virtio_pcidev_init(void)

View File

@@ -13,20 +13,9 @@
#include <asm/mm_hooks.h> #include <asm/mm_hooks.h>
#include <asm/mmu.h> #include <asm/mmu.h>
#define activate_mm activate_mm
static inline void activate_mm(struct mm_struct *old, struct mm_struct *new)
{
}
static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
struct task_struct *tsk) struct task_struct *tsk)
{ {
unsigned cpu = smp_processor_id();
if (prev != next) {
cpumask_clear_cpu(cpu, mm_cpumask(prev));
cpumask_set_cpu(cpu, mm_cpumask(next));
}
} }
#define init_new_context init_new_context #define init_new_context init_new_context

View File

@@ -71,7 +71,6 @@ extern void start_thread(struct pt_regs *regs, unsigned long entry,
struct cpuinfo_um { struct cpuinfo_um {
unsigned long loops_per_jiffy; unsigned long loops_per_jiffy;
int ipi_pipe[2];
int cache_alignment; int cache_alignment;
union { union {
__u32 x86_capability[NCAPINTS + NBUGINTS]; __u32 x86_capability[NCAPINTS + NBUGINTS];
@@ -81,8 +80,6 @@ struct cpuinfo_um {
extern struct cpuinfo_um boot_cpu_data; extern struct cpuinfo_um boot_cpu_data;
#define cpu_data(cpu) boot_cpu_data
#define current_cpu_data boot_cpu_data
#define cache_line_size() (boot_cpu_data.cache_alignment) #define cache_line_size() (boot_cpu_data.cache_alignment)
#define KSTK_REG(tsk, reg) get_thread_reg(reg, &tsk->thread.switch_buf) #define KSTK_REG(tsk, reg) get_thread_reg(reg, &tsk->thread.switch_buf)

View File

@@ -23,8 +23,9 @@
#define STUB_START stub_start #define STUB_START stub_start
#define STUB_CODE STUB_START #define STUB_CODE STUB_START
#define STUB_DATA (STUB_CODE + UM_KERN_PAGE_SIZE) #define STUB_DATA (STUB_CODE + UM_KERN_PAGE_SIZE)
#define STUB_DATA_PAGES 2 /* must be a power of two */ #define STUB_DATA_PAGES 2
#define STUB_END (STUB_DATA + STUB_DATA_PAGES * UM_KERN_PAGE_SIZE) #define STUB_SIZE ((1 + STUB_DATA_PAGES) * UM_KERN_PAGE_SIZE)
#define STUB_END (STUB_START + STUB_SIZE)
#ifndef __ASSEMBLER__ #ifndef __ASSEMBLER__

View File

@@ -53,8 +53,7 @@ struct stub_syscall {
}; };
struct stub_data { struct stub_data {
unsigned long offset; long err;
long err, child_err;
int syscall_data_len; int syscall_data_len;
/* 128 leaves enough room for additional fields in the struct */ /* 128 leaves enough room for additional fields in the struct */

View File

@@ -38,5 +38,5 @@ static int __init uml_dtb_setup(char *line, int *add)
__uml_setup("dtb=", uml_dtb_setup, __uml_setup("dtb=", uml_dtb_setup,
"dtb=<file>\n" "dtb=<file>\n"
" Boot the kernel with the devicetree blob from the specified file.\n" " Boot the kernel with the devicetree blob from the specified file.\n\n"
); );

View File

@@ -691,6 +691,11 @@ void __init init_IRQ(void)
os_setup_epoll(); os_setup_epoll();
} }
int __init arch_probe_nr_irqs(void)
{
return NR_IRQS;
}
void sigchld_handler(int sig, struct siginfo *unused_si, void sigchld_handler(int sig, struct siginfo *unused_si,
struct uml_pt_regs *regs, void *mc) struct uml_pt_regs *regs, void *mc)
{ {

View File

@@ -986,26 +986,26 @@ static int setup_time_travel(char *str)
__setup("time-travel", setup_time_travel); __setup("time-travel", setup_time_travel);
__uml_help(setup_time_travel, __uml_help(setup_time_travel,
"time-travel\n" "time-travel\n"
"This option just enables basic time travel mode, in which the clock/timers\n" " This option just enables basic time travel mode, in which the clock/timers\n"
"inside the UML instance skip forward when there's nothing to do, rather than\n" " inside the UML instance skip forward when there's nothing to do, rather than\n"
"waiting for real time to elapse. However, instance CPU speed is limited by\n" " waiting for real time to elapse. However, instance CPU speed is limited by\n"
"the real CPU speed, so e.g. a 10ms timer will always fire after ~10ms wall\n" " the real CPU speed, so e.g. a 10ms timer will always fire after ~10ms wall\n"
"clock (but quicker when there's nothing to do).\n" " clock (but quicker when there's nothing to do).\n"
"\n" "\n"
"time-travel=inf-cpu\n" "time-travel=inf-cpu\n"
"This enables time travel mode with infinite processing power, in which there\n" " This enables time travel mode with infinite processing power, in which there\n"
"are no wall clock timers, and any CPU processing happens - as seen from the\n" " are no wall clock timers, and any CPU processing happens - as seen from the\n"
"guest - instantly. This can be useful for accurate simulation regardless of\n" " guest - instantly. This can be useful for accurate simulation regardless of\n"
"debug overhead, physical CPU speed, etc. but is somewhat dangerous as it can\n" " debug overhead, physical CPU speed, etc. but is somewhat dangerous as it can\n"
"easily lead to getting stuck (e.g. if anything in the system busy loops).\n" " easily lead to getting stuck (e.g. if anything in the system busy loops).\n"
"\n" "\n"
"time-travel=ext:[ID:]/path/to/socket\n" "time-travel=ext:[ID:]/path/to/socket\n"
"This enables time travel mode similar to =inf-cpu, except the system will\n" " This enables time travel mode similar to =inf-cpu, except the system will\n"
"use the given socket to coordinate with a central scheduler, in order to\n" " use the given socket to coordinate with a central scheduler, in order to\n"
"have more than one system simultaneously be on simulated time. The virtio\n" " have more than one system simultaneously be on simulated time. The virtio\n"
"driver code in UML knows about this so you can also simulate networks and\n" " driver code in UML knows about this so you can also simulate networks and\n"
"devices using it, assuming the device has the right capabilities.\n" " devices using it, assuming the device has the right capabilities.\n"
"The optional ID is a 64-bit integer that's sent to the central scheduler.\n"); " The optional ID is a 64-bit integer that's sent to the central scheduler.\n\n");
static int setup_time_travel_start(char *str) static int setup_time_travel_start(char *str)
{ {
@@ -1022,8 +1022,9 @@ static int setup_time_travel_start(char *str)
__setup("time-travel-start=", setup_time_travel_start); __setup("time-travel-start=", setup_time_travel_start);
__uml_help(setup_time_travel_start, __uml_help(setup_time_travel_start,
"time-travel-start=<nanoseconds>\n" "time-travel-start=<nanoseconds>\n"
"Configure the UML instance's wall clock to start at this value rather than\n" " Configure the UML instance's wall clock to start at this value rather than\n"
"the host's wall clock at the time of UML boot.\n"); " the host's wall clock at the time of UML boot.\n\n");
static struct kobject *bc_time_kobject; static struct kobject *bc_time_kobject;
static ssize_t bc_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) static ssize_t bc_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)

View File

@@ -54,12 +54,9 @@ static void __init add_arg(char *arg)
/* /*
* These fields are initialized at boot time and not changed. * These fields are initialized at boot time and not changed.
* XXX This structure is used only in the non-SMP case. Maybe this
* should be moved to smp.c.
*/ */
struct cpuinfo_um boot_cpu_data = { struct cpuinfo_um boot_cpu_data = {
.loops_per_jiffy = 0, .loops_per_jiffy = 0,
.ipi_pipe = { -1, -1 },
.cache_alignment = L1_CACHE_BYTES, .cache_alignment = L1_CACHE_BYTES,
.x86_capability = { 0 } .x86_capability = { 0 }
}; };
@@ -331,9 +328,7 @@ int __init linux_main(int argc, char **argv, char **envp)
host_task_size = get_top_address(envp); host_task_size = get_top_address(envp);
/* reserve a few pages for the stubs */ /* reserve a few pages for the stubs */
stub_start = host_task_size - STUB_DATA_PAGES * PAGE_SIZE; stub_start = host_task_size - STUB_SIZE;
/* another page for the code portion */
stub_start -= PAGE_SIZE;
host_task_size = stub_start; host_task_size = stub_start;
/* Limit TASK_SIZE to what is addressable by the page table */ /* Limit TASK_SIZE to what is addressable by the page table */

View File

@@ -895,7 +895,7 @@ __uml_setup("noreboot", noreboot_cmd_param,
"noreboot\n" "noreboot\n"
" Rather than rebooting, exit always, akin to QEMU's -no-reboot option.\n" " Rather than rebooting, exit always, akin to QEMU's -no-reboot option.\n"
" This is useful if you're using CONFIG_PANIC_TIMEOUT in order to catch\n" " This is useful if you're using CONFIG_PANIC_TIMEOUT in order to catch\n"
" crashes in CI\n"); " crashes in CI\n\n");
void reboot_skas(void) void reboot_skas(void)
{ {

View File

@@ -129,7 +129,7 @@ static __always_inline void *get_stub_data(void)
"subl %0,%%esp ;" \ "subl %0,%%esp ;" \
"movl %1, %%eax ; " \ "movl %1, %%eax ; " \
"call *%%eax ;" \ "call *%%eax ;" \
:: "i" ((1 + STUB_DATA_PAGES) * UM_KERN_PAGE_SIZE), \ :: "i" (STUB_SIZE), \
"i" (&fn)) "i" (&fn))
static __always_inline void static __always_inline void

View File

@@ -133,7 +133,7 @@ static __always_inline void *get_stub_data(void)
"subq %0,%%rsp ;" \ "subq %0,%%rsp ;" \
"movq %1,%%rax ;" \ "movq %1,%%rax ;" \
"call *%%rax ;" \ "call *%%rax ;" \
:: "i" ((1 + STUB_DATA_PAGES) * UM_KERN_PAGE_SIZE), \ :: "i" (STUB_SIZE), \
"i" (&fn)) "i" (&fn))
static __always_inline void static __always_inline void