Commit 399ead3a authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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

Pull UML updates from Johannes Berg:
 "Apart from the usual small churn, we have

   - initial SMP support (only kernel)

   - major vDSO cleanups (and fixes for 32-bit)"

* tag 'uml-for-linux-6.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux: (33 commits)
  um: Disable KASAN_INLINE when STATIC_LINK is selected
  um: Don't rename vmap to kernel_vmap
  um: drivers: virtio: use string choices helper
  um: Always set up AT_HWCAP and AT_PLATFORM
  x86/um: Remove FIXADDR_USER_START and FIXADDR_USE_END
  um: Remove __access_ok_vsyscall()
  um: Remove redundant range check from __access_ok_vsyscall()
  um: Remove fixaddr_user_init()
  x86/um: Drop gate area handling
  x86/um: Do not inherit vDSO from host
  um: Split out default elf_aux_hwcap
  x86/um: Move ELF_PLATFORM fallback to x86-specific code
  um: Split out default elf_aux_platform
  um: Avoid circular dependency on asm-offsets in pgtable.h
  um: Enable SMP support on x86
  asm-generic: percpu: Add assembly guard
  um: vdso: Remove getcpu support on x86
  um: Add initial SMP support
  um: Define timers on a per-CPU basis
  um: Determine sleep based on need_resched()
  ...
parents 07025b51 a3209bb9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@
    |        s390: |  ok  |
    |          sh: |  ok  |
    |       sparc: |  ok  |
    |          um: | TODO |
    |          um: |  ok  |
    |         x86: |  ok  |
    |      xtensa: |  ok  |
    -----------------------
+44 −9
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ menu "UML-specific options"
config UML
	bool
	default y
	select ARCH_DISABLE_KASAN_INLINE if STATIC_LINK
	select ARCH_NEEDS_DEFER_KASAN if STATIC_LINK
	select ARCH_WANTS_DYNAMIC_TASK_STRUCT
	select ARCH_HAS_CACHE_LINE_SIZE
@@ -28,6 +29,7 @@ config UML
	select OF_EARLY_FLATTREE if OF
	select GENERIC_IRQ_SHOW
	select GENERIC_CPU_DEVICES
	select GENERIC_SMP_IDLE_THREAD
	select HAVE_GCC_PLUGINS
	select ARCH_SUPPORTS_LTO_CLANG
	select ARCH_SUPPORTS_LTO_CLANG_THIN
@@ -81,10 +83,48 @@ config HZ
	int
	default 100

config NR_CPUS
config UML_SUBARCH_SUPPORTS_SMP
	bool

config SMP
	bool "Symmetric multi-processing support"
	default n
	depends on UML_SUBARCH_SUPPORTS_SMP
	help
	  This option enables UML SMP support.

	  With this enabled, users can tell UML to start multiple virtual
	  processors. Each virtual processor is represented as a separate
	  host thread.

	  In UML, kthreads and normal threads (when running in kernel mode)
	  can be scheduled and executed simultaneously on different virtual
	  processors. However, the userspace code of normal threads still
	  runs within their respective single-threaded stubs.

	  That is, SMP support is available both within the kernel and
	  across different processes, but remains limited within threads
	  of the same process in userspace.

config NR_CPUS_RANGE_BEGIN
	int
	range 1 1
	default 1
	default 1 if !SMP
	default 2

config NR_CPUS_RANGE_END
	int
	default 1 if !SMP
	default 64

config NR_CPUS_DEFAULT
	int
	default 1 if !SMP
	default 2

config NR_CPUS
	int "Maximum number of CPUs" if SMP
	range NR_CPUS_RANGE_BEGIN NR_CPUS_RANGE_END
	default NR_CPUS_DEFAULT

source "arch/$(HEADER_ARCH)/um/Kconfig"

@@ -200,12 +240,6 @@ config KERNEL_STACK_ORDER
	  increase in the size of the state which needs to be saved when handling
	  signals.

config MMAPPER
	tristate "iomem emulation driver"
	help
	  This driver allows a host file to be used as emulated IO memory inside
	  UML.

config PGTABLE_LEVELS
	int
	default 4 if 64BIT
@@ -260,6 +294,7 @@ source "arch/um/drivers/Kconfig"

config ARCH_SUSPEND_POSSIBLE
	def_bool y
	depends on !SMP

menu "Power management options"

+5 −7
Original line number Diff line number Diff line
@@ -46,19 +46,17 @@ ARCH_INCLUDE := -I$(srctree)/$(SHARED_HEADERS)
ARCH_INCLUDE	+= -I$(srctree)/$(HOST_DIR)/um/shared
KBUILD_CPPFLAGS += -I$(srctree)/$(HOST_DIR)/um

# -Dvmap=kernel_vmap prevents anything from referencing the libpcap.o symbol so
# named - it's a common symbol in libpcap, so we get a binary which crashes.
#
# Same things for in6addr_loopback and mktime - found in libc. For these two we
# only get link-time error, luckily.
# -Dstrrchr=kernel_strrchr (as well as the various in6addr symbols) prevents
#  anything from referencing
# libc symbols with the same name, which can cause a linker error.
#
# -Dlongjmp=kernel_longjmp prevents anything from referencing the libpthread.a
# embedded copy of longjmp, same thing for setjmp.
#
# These apply to USER_CFLAGS to.
# These apply to USER_CFLAGS too.

KBUILD_CFLAGS += $(CFLAGS) $(CFLAGS-y) -D__arch_um__ \
	$(ARCH_INCLUDE) $(MODE_INCLUDE) -Dvmap=kernel_vmap	\
	$(ARCH_INCLUDE) $(MODE_INCLUDE)	\
	-Dlongjmp=kernel_longjmp -Dsetjmp=kernel_setjmp \
	-Din6addr_loopback=kernel_in6addr_loopback \
	-Din6addr_any=kernel_in6addr_any -Dstrrchr=kernel_strrchr \
+0 −1
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ obj-$(CONFIG_STDERR_CONSOLE) += stderr_console.o

obj-$(CONFIG_UML_NET_VECTOR) += vector.o
obj-$(CONFIG_MCONSOLE) += mconsole.o
obj-$(CONFIG_MMAPPER) += mmapper_kern.o 
obj-$(CONFIG_BLK_DEV_UBD) += ubd.o 
obj-$(CONFIG_UML_SOUND) += hostaudio.o
obj-$(CONFIG_NULL_CHAN) += null.o 

arch/um/drivers/mmapper_kern.c

deleted100644 → 0
+0 −135
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * arch/um/drivers/mmapper_kern.c
 *
 * BRIEF MODULE DESCRIPTION
 *
 * Copyright (C) 2000 RidgeRun, Inc.
 * Author: RidgeRun, Inc.
 *         Greg Lonnon glonnon@ridgerun.com or info@ridgerun.com
 *
 */

#include <linux/stddef.h>
#include <linux/types.h>
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/miscdevice.h>
#include <linux/module.h>
#include <linux/mm.h>

#include <linux/uaccess.h>
#include <mem_user.h>

/* These are set in mmapper_init, which is called at boot time */
static unsigned long mmapper_size;
static unsigned long p_buf;
static char *v_buf;

static ssize_t mmapper_read(struct file *file, char __user *buf, size_t count,
			    loff_t *ppos)
{
	return simple_read_from_buffer(buf, count, ppos, v_buf, mmapper_size);
}

static ssize_t mmapper_write(struct file *file, const char __user *buf,
			     size_t count, loff_t *ppos)
{
	if (*ppos > mmapper_size)
		return -EINVAL;

	return simple_write_to_buffer(v_buf, mmapper_size, ppos, buf, count);
}

static long mmapper_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
	return -ENOIOCTLCMD;
}

static int mmapper_mmap(struct file *file, struct vm_area_struct *vma)
{
	int ret = -EINVAL;
	int size;

	if (vma->vm_pgoff != 0)
		goto out;

	size = vma->vm_end - vma->vm_start;
	if (size > mmapper_size)
		return -EFAULT;

	/*
	 * XXX A comment above remap_pfn_range says it should only be
	 * called when the mm semaphore is held
	 */
	if (remap_pfn_range(vma, vma->vm_start, p_buf >> PAGE_SHIFT, size,
			    vma->vm_page_prot))
		goto out;
	ret = 0;
out:
	return ret;
}

static int mmapper_open(struct inode *inode, struct file *file)
{
	return 0;
}

static int mmapper_release(struct inode *inode, struct file *file)
{
	return 0;
}

static const struct file_operations mmapper_fops = {
	.owner		= THIS_MODULE,
	.read		= mmapper_read,
	.write		= mmapper_write,
	.unlocked_ioctl	= mmapper_ioctl,
	.mmap		= mmapper_mmap,
	.open		= mmapper_open,
	.release	= mmapper_release,
	.llseek		= default_llseek,
};

/*
 * No locking needed - only used (and modified) by below initcall and exitcall.
 */
static struct miscdevice mmapper_dev = {
	.minor		= MISC_DYNAMIC_MINOR,
	.name		= "mmapper",
	.fops		= &mmapper_fops
};

static int __init mmapper_init(void)
{
	int err;

	printk(KERN_INFO "Mapper v0.1\n");

	v_buf = (char *) find_iomem("mmapper", &mmapper_size);
	if (mmapper_size == 0) {
		printk(KERN_ERR "mmapper_init - find_iomem failed\n");
		return -ENODEV;
	}
	p_buf = __pa(v_buf);

	err = misc_register(&mmapper_dev);
	if (err) {
		printk(KERN_ERR "mmapper - misc_register failed, err = %d\n",
		       err);
		return err;
	}
	return 0;
}

static void __exit mmapper_exit(void)
{
	misc_deregister(&mmapper_dev);
}

module_init(mmapper_init);
module_exit(mmapper_exit);

MODULE_AUTHOR("Greg Lonnon <glonnon@ridgerun.com>");
MODULE_DESCRIPTION("DSPLinux simulator mmapper driver");
MODULE_LICENSE("GPL");
Loading