Commit 64e85168 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull UML updates from Richard Weinberger:

 - Add support for rust (yay!)

 - Add support for LTO

 - Add platform bus support to virtio-pci

 - Various virtio fixes

 - Coding style, spelling cleanups

* tag 'uml-for-linus-6.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux: (27 commits)
  Documentation: rust: Fix arch support table
  uml: vector: Remove unused definitions VECTOR_{WRITE,HEADERS}
  um: virt-pci: properly remove PCI device from bus
  um: virtio_uml: move device breaking into workqueue
  um: virtio_uml: mark device as unregistered when breaking it
  um: virtio_uml: free command if adding to virtqueue failed
  UML: define RUNTIME_DISCARD_EXIT
  virt-pci: add platform bus support
  um-virt-pci: Make max delay configurable
  um: virt-pci: implement pcibios_get_phb_of_node()
  um: Support LTO
  um: put power options in a menu
  um: Use CFLAGS_vmlinux
  um: Prevent building modules incompatible with MODVERSIONS
  um: Avoid pcap multiple definition errors
  um: Make the definition of cpu_data more compatible
  x86: um: vdso: Add '%rcx' and '%r11' to the syscall clobber list
  rust: arch/um: Add support for CONFIG_RUST under x86_64 UML
  rust: arch/um: Disable FP/SIMD instruction to match x86
  rust: arch/um: Use 'pie' relocation mode under UML
  ...
parents e31b283a 04df97e1
...@@ -16,4 +16,6 @@ support corresponds to ``S`` values in the ``MAINTAINERS`` file. ...@@ -16,4 +16,6 @@ support corresponds to ``S`` values in the ``MAINTAINERS`` file.
Architecture Level of support Constraints Architecture Level of support Constraints
============ ================ ============================================== ============ ================ ==============================================
``x86`` Maintained ``x86_64`` only. ``x86`` Maintained ``x86_64`` only.
``um`` Maintained ``x86_64`` only.
============ ================ ============================================== ============ ================ ==============================================
...@@ -25,9 +25,12 @@ config UML ...@@ -25,9 +25,12 @@ config UML
select GENERIC_IRQ_SHOW select GENERIC_IRQ_SHOW
select GENERIC_CPU_DEVICES select GENERIC_CPU_DEVICES
select HAVE_GCC_PLUGINS select HAVE_GCC_PLUGINS
select ARCH_SUPPORTS_LTO_CLANG
select ARCH_SUPPORTS_LTO_CLANG_THIN
select TRACE_IRQFLAGS_SUPPORT select TRACE_IRQFLAGS_SUPPORT
select TTY # Needed for line.c select TTY # Needed for line.c
select HAVE_ARCH_VMAP_STACK select HAVE_ARCH_VMAP_STACK
select HAVE_RUST if X86_64
config MMU config MMU
bool bool
...@@ -242,4 +245,8 @@ source "arch/um/drivers/Kconfig" ...@@ -242,4 +245,8 @@ source "arch/um/drivers/Kconfig"
config ARCH_SUSPEND_POSSIBLE config ARCH_SUSPEND_POSSIBLE
def_bool y def_bool y
menu "Power management options"
source "kernel/power/Kconfig" source "kernel/power/Kconfig"
endmenu
...@@ -68,6 +68,8 @@ KBUILD_CFLAGS += $(CFLAGS) $(CFLAGS-y) -D__arch_um__ \ ...@@ -68,6 +68,8 @@ KBUILD_CFLAGS += $(CFLAGS) $(CFLAGS-y) -D__arch_um__ \
-Din6addr_loopback=kernel_in6addr_loopback \ -Din6addr_loopback=kernel_in6addr_loopback \
-Din6addr_any=kernel_in6addr_any -Dstrrchr=kernel_strrchr -Din6addr_any=kernel_in6addr_any -Dstrrchr=kernel_strrchr
KBUILD_RUSTFLAGS += -Crelocation-model=pie
KBUILD_AFLAGS += $(ARCH_INCLUDE) KBUILD_AFLAGS += $(ARCH_INCLUDE)
USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -I%,,$(KBUILD_CFLAGS))) \ USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -I%,,$(KBUILD_CFLAGS))) \
...@@ -139,11 +141,10 @@ ifeq ($(CONFIG_LD_IS_BFD),y) ...@@ -139,11 +141,10 @@ ifeq ($(CONFIG_LD_IS_BFD),y)
LDFLAGS_EXECSTACK += $(call ld-option,--no-warn-rwx-segments) LDFLAGS_EXECSTACK += $(call ld-option,--no-warn-rwx-segments)
endif endif
LD_FLAGS_CMDLINE = $(foreach opt,$(KBUILD_LDFLAGS),-Wl,$(opt)) LD_FLAGS_CMDLINE = $(foreach opt,$(KBUILD_LDFLAGS) $(LDFLAGS_EXECSTACK),-Wl,$(opt))
# Used by link-vmlinux.sh which has special support for um link # Used by link-vmlinux.sh which has special support for um link
export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE) export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE) $(CC_FLAGS_LTO)
export LDFLAGS_vmlinux := $(LDFLAGS_EXECSTACK)
# When cleaning we don't include .config, so we don't include # When cleaning we don't include .config, so we don't include
# TT or skas makefiles and don't clean skas_ptregs.h. # TT or skas makefiles and don't clean skas_ptregs.h.
......
...@@ -261,6 +261,7 @@ config UML_NET_VECTOR ...@@ -261,6 +261,7 @@ config UML_NET_VECTOR
config UML_NET_VDE config UML_NET_VDE
bool "VDE transport (obsolete)" bool "VDE transport (obsolete)"
depends on UML_NET depends on UML_NET
depends on !MODVERSIONS
select MAY_HAVE_RUNTIME_DEPS select MAY_HAVE_RUNTIME_DEPS
help help
This User-Mode Linux network transport allows one or more running This User-Mode Linux network transport allows one or more running
...@@ -309,6 +310,7 @@ config UML_NET_MCAST ...@@ -309,6 +310,7 @@ config UML_NET_MCAST
config UML_NET_PCAP config UML_NET_PCAP
bool "pcap transport (obsolete)" bool "pcap transport (obsolete)"
depends on UML_NET depends on UML_NET
depends on !MODVERSIONS
select MAY_HAVE_RUNTIME_DEPS select MAY_HAVE_RUNTIME_DEPS
help help
The pcap transport makes a pcap packet stream on the host look The pcap transport makes a pcap packet stream on the host look
......
...@@ -15,7 +15,7 @@ struct pcap_init { ...@@ -15,7 +15,7 @@ struct pcap_init {
char *filter; char *filter;
}; };
void pcap_init(struct net_device *dev, void *data) void pcap_init_kern(struct net_device *dev, void *data)
{ {
struct uml_net_private *pri; struct uml_net_private *pri;
struct pcap_data *ppri; struct pcap_data *ppri;
...@@ -44,7 +44,7 @@ static int pcap_write(int fd, struct sk_buff *skb, struct uml_net_private *lp) ...@@ -44,7 +44,7 @@ static int pcap_write(int fd, struct sk_buff *skb, struct uml_net_private *lp)
} }
static const struct net_kern_info pcap_kern_info = { static const struct net_kern_info pcap_kern_info = {
.init = pcap_init, .init = pcap_init_kern,
.protocol = eth_protocol, .protocol = eth_protocol,
.read = pcap_read, .read = pcap_read,
.write = pcap_write, .write = pcap_write,
......
...@@ -767,6 +767,7 @@ static int vector_config(char *str, char **error_out) ...@@ -767,6 +767,7 @@ static int vector_config(char *str, char **error_out)
if (parsed == NULL) { if (parsed == NULL) {
*error_out = "vector_config failed to parse parameters"; *error_out = "vector_config failed to parse parameters";
kfree(params);
return -EINVAL; return -EINVAL;
} }
......
...@@ -68,8 +68,6 @@ struct vector_fds { ...@@ -68,8 +68,6 @@ struct vector_fds {
}; };
#define VECTOR_READ 1 #define VECTOR_READ 1
#define VECTOR_WRITE (1 < 1)
#define VECTOR_HEADERS (1 < 2)
extern struct arglist *uml_parse_vector_ifspec(char *arg); extern struct arglist *uml_parse_vector_ifspec(char *arg);
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <linux/virtio.h> #include <linux/virtio.h>
#include <linux/virtio_config.h> #include <linux/virtio_config.h>
#include <linux/logic_iomem.h> #include <linux/logic_iomem.h>
#include <linux/of_platform.h>
#include <linux/irqdomain.h> #include <linux/irqdomain.h>
#include <linux/virtio_pcidev.h> #include <linux/virtio_pcidev.h>
#include <linux/virtio-uml.h> #include <linux/virtio-uml.h>
...@@ -39,6 +40,8 @@ struct um_pci_device { ...@@ -39,6 +40,8 @@ struct um_pci_device {
unsigned long status; unsigned long status;
int irq; int irq;
bool platform;
}; };
struct um_pci_device_reg { struct um_pci_device_reg {
...@@ -48,13 +51,15 @@ struct um_pci_device_reg { ...@@ -48,13 +51,15 @@ struct um_pci_device_reg {
static struct pci_host_bridge *bridge; static struct pci_host_bridge *bridge;
static DEFINE_MUTEX(um_pci_mtx); static DEFINE_MUTEX(um_pci_mtx);
static struct um_pci_device *um_pci_platform_device;
static struct um_pci_device_reg um_pci_devices[MAX_DEVICES]; static struct um_pci_device_reg um_pci_devices[MAX_DEVICES];
static struct fwnode_handle *um_pci_fwnode; static struct fwnode_handle *um_pci_fwnode;
static struct irq_domain *um_pci_inner_domain; static struct irq_domain *um_pci_inner_domain;
static struct irq_domain *um_pci_msi_domain; static struct irq_domain *um_pci_msi_domain;
static unsigned long um_pci_msi_used[BITS_TO_LONGS(MAX_MSI_VECTORS)]; static unsigned long um_pci_msi_used[BITS_TO_LONGS(MAX_MSI_VECTORS)];
#define UM_VIRT_PCI_MAXDELAY 40000 static unsigned int um_pci_max_delay_us = 40000;
module_param_named(max_delay_us, um_pci_max_delay_us, uint, 0644);
struct um_pci_message_buffer { struct um_pci_message_buffer {
struct virtio_pcidev_msg hdr; struct virtio_pcidev_msg hdr;
...@@ -132,8 +137,11 @@ static int um_pci_send_cmd(struct um_pci_device *dev, ...@@ -132,8 +137,11 @@ static int um_pci_send_cmd(struct um_pci_device *dev,
out ? 1 : 0, out ? 1 : 0,
posted ? cmd : HANDLE_NO_FREE(cmd), posted ? cmd : HANDLE_NO_FREE(cmd),
GFP_ATOMIC); GFP_ATOMIC);
if (ret) if (ret) {
if (posted)
kfree(cmd);
goto out; goto out;
}
if (posted) { if (posted) {
virtqueue_kick(dev->cmd_vq); virtqueue_kick(dev->cmd_vq);
...@@ -155,7 +163,7 @@ static int um_pci_send_cmd(struct um_pci_device *dev, ...@@ -155,7 +163,7 @@ static int um_pci_send_cmd(struct um_pci_device *dev,
kfree(completed); kfree(completed);
if (WARN_ONCE(virtqueue_is_broken(dev->cmd_vq) || if (WARN_ONCE(virtqueue_is_broken(dev->cmd_vq) ||
++delay_count > UM_VIRT_PCI_MAXDELAY, ++delay_count > um_pci_max_delay_us,
"um virt-pci delay: %d", delay_count)) { "um virt-pci delay: %d", delay_count)) {
ret = -EIO; ret = -EIO;
break; break;
...@@ -480,6 +488,9 @@ static void um_pci_handle_irq_message(struct virtqueue *vq, ...@@ -480,6 +488,9 @@ static void um_pci_handle_irq_message(struct virtqueue *vq,
struct virtio_device *vdev = vq->vdev; struct virtio_device *vdev = vq->vdev;
struct um_pci_device *dev = vdev->priv; struct um_pci_device *dev = vdev->priv;
if (!dev->irq)
return;
/* we should properly chain interrupts, but on ARCH=um we don't care */ /* we should properly chain interrupts, but on ARCH=um we don't care */
switch (msg->op) { switch (msg->op) {
...@@ -533,6 +544,25 @@ static void um_pci_irq_vq_cb(struct virtqueue *vq) ...@@ -533,6 +544,25 @@ static void um_pci_irq_vq_cb(struct virtqueue *vq)
} }
} }
/* Copied from arch/x86/kernel/devicetree.c */
struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
{
struct device_node *np;
for_each_node_by_type(np, "pci") {
const void *prop;
unsigned int bus_min;
prop = of_get_property(np, "bus-range", NULL);
if (!prop)
continue;
bus_min = be32_to_cpup(prop);
if (bus->number == bus_min)
return np;
}
return NULL;
}
static int um_pci_init_vqs(struct um_pci_device *dev) static int um_pci_init_vqs(struct um_pci_device *dev)
{ {
struct virtqueue *vqs[2]; struct virtqueue *vqs[2];
...@@ -561,6 +591,55 @@ static int um_pci_init_vqs(struct um_pci_device *dev) ...@@ -561,6 +591,55 @@ static int um_pci_init_vqs(struct um_pci_device *dev)
return 0; return 0;
} }
static void __um_pci_virtio_platform_remove(struct virtio_device *vdev,
struct um_pci_device *dev)
{
virtio_reset_device(vdev);
vdev->config->del_vqs(vdev);
mutex_lock(&um_pci_mtx);
um_pci_platform_device = NULL;
mutex_unlock(&um_pci_mtx);
kfree(dev);
}
static int um_pci_virtio_platform_probe(struct virtio_device *vdev,
struct um_pci_device *dev)
{
int ret;
dev->platform = true;
mutex_lock(&um_pci_mtx);
if (um_pci_platform_device) {
mutex_unlock(&um_pci_mtx);
ret = -EBUSY;
goto out_free;
}
ret = um_pci_init_vqs(dev);
if (ret) {
mutex_unlock(&um_pci_mtx);
goto out_free;
}
um_pci_platform_device = dev;
mutex_unlock(&um_pci_mtx);
ret = of_platform_default_populate(vdev->dev.of_node, NULL, &vdev->dev);
if (ret)
__um_pci_virtio_platform_remove(vdev, dev);
return ret;
out_free:
kfree(dev);
return ret;
}
static int um_pci_virtio_probe(struct virtio_device *vdev) static int um_pci_virtio_probe(struct virtio_device *vdev)
{ {
struct um_pci_device *dev; struct um_pci_device *dev;
...@@ -574,6 +653,9 @@ static int um_pci_virtio_probe(struct virtio_device *vdev) ...@@ -574,6 +653,9 @@ static int um_pci_virtio_probe(struct virtio_device *vdev)
dev->vdev = vdev; dev->vdev = vdev;
vdev->priv = dev; vdev->priv = dev;
if (of_device_is_compatible(vdev->dev.of_node, "simple-bus"))
return um_pci_virtio_platform_probe(vdev, dev);
mutex_lock(&um_pci_mtx); mutex_lock(&um_pci_mtx);
for (i = 0; i < MAX_DEVICES; i++) { for (i = 0; i < MAX_DEVICES; i++) {
if (um_pci_devices[i].dev) if (um_pci_devices[i].dev)
...@@ -623,9 +705,11 @@ static void um_pci_virtio_remove(struct virtio_device *vdev) ...@@ -623,9 +705,11 @@ static void um_pci_virtio_remove(struct virtio_device *vdev)
struct um_pci_device *dev = vdev->priv; struct um_pci_device *dev = vdev->priv;
int i; int i;
/* Stop all virtqueues */ if (dev->platform) {
virtio_reset_device(vdev); of_platform_depopulate(&vdev->dev);
vdev->config->del_vqs(vdev); __um_pci_virtio_platform_remove(vdev, dev);
return;
}
device_set_wakeup_enable(&vdev->dev, false); device_set_wakeup_enable(&vdev->dev, false);
...@@ -633,12 +717,27 @@ static void um_pci_virtio_remove(struct virtio_device *vdev) ...@@ -633,12 +717,27 @@ static void um_pci_virtio_remove(struct virtio_device *vdev)
for (i = 0; i < MAX_DEVICES; i++) { for (i = 0; i < MAX_DEVICES; i++) {
if (um_pci_devices[i].dev != dev) if (um_pci_devices[i].dev != dev)
continue; continue;
um_pci_devices[i].dev = NULL; um_pci_devices[i].dev = NULL;
irq_free_desc(dev->irq); irq_free_desc(dev->irq);
break;
} }
mutex_unlock(&um_pci_mtx); mutex_unlock(&um_pci_mtx);
um_pci_rescan(); if (i < MAX_DEVICES) {
struct pci_dev *pci_dev;
pci_dev = pci_get_slot(bridge->bus, i);
if (pci_dev)
pci_stop_and_remove_bus_device_locked(pci_dev);
}
/* Stop all virtqueues */
virtio_reset_device(vdev);
dev->cmd_vq = NULL;
dev->irq_vq = NULL;
vdev->config->del_vqs(vdev);
kfree(dev); kfree(dev);
} }
...@@ -860,6 +959,30 @@ void *pci_root_bus_fwnode(struct pci_bus *bus) ...@@ -860,6 +959,30 @@ void *pci_root_bus_fwnode(struct pci_bus *bus)
return um_pci_fwnode; return um_pci_fwnode;
} }
static long um_pci_map_platform(unsigned long offset, size_t size,
const struct logic_iomem_ops **ops,
void **priv)
{
if (!um_pci_platform_device)
return -ENOENT;
*ops = &um_pci_device_bar_ops;
*priv = &um_pci_platform_device->resptr[0];
return 0;
}
static const struct logic_iomem_region_ops um_pci_platform_ops = {
.map = um_pci_map_platform,
};
static struct resource virt_platform_resource = {
.name = "platform",
.start = 0x10000000,
.end = 0x1fffffff,
.flags = IORESOURCE_MEM,
};
static int __init um_pci_init(void) static int __init um_pci_init(void)
{ {
int err, i; int err, i;
...@@ -868,6 +991,8 @@ static int __init um_pci_init(void) ...@@ -868,6 +991,8 @@ static int __init um_pci_init(void)
&um_pci_cfgspace_ops)); &um_pci_cfgspace_ops));
WARN_ON(logic_iomem_add_region(&virt_iomem_resource, WARN_ON(logic_iomem_add_region(&virt_iomem_resource,
&um_pci_iomem_ops)); &um_pci_iomem_ops));
WARN_ON(logic_iomem_add_region(&virt_platform_resource,
&um_pci_platform_ops));
if (WARN(CONFIG_UML_PCI_OVER_VIRTIO_DEVICE_ID < 0, if (WARN(CONFIG_UML_PCI_OVER_VIRTIO_DEVICE_ID < 0,
"No virtio device ID configured for PCI - no PCI support\n")) "No virtio device ID configured for PCI - no PCI support\n"))
......
...@@ -168,7 +168,8 @@ static void vhost_user_check_reset(struct virtio_uml_device *vu_dev, ...@@ -168,7 +168,8 @@ static void vhost_user_check_reset(struct virtio_uml_device *vu_dev,
if (!vu_dev->registered) if (!vu_dev->registered)
return; return;
virtio_break_device(&vu_dev->vdev); vu_dev->registered = 0;
schedule_work(&pdata->conn_broken_wk); schedule_work(&pdata->conn_broken_wk);
} }
...@@ -412,7 +413,7 @@ static irqreturn_t vu_req_read_message(struct virtio_uml_device *vu_dev, ...@@ -412,7 +413,7 @@ static irqreturn_t vu_req_read_message(struct virtio_uml_device *vu_dev,
if (msg.msg.header.flags & VHOST_USER_FLAG_NEED_REPLY) if (msg.msg.header.flags & VHOST_USER_FLAG_NEED_REPLY)
vhost_user_reply(vu_dev, &msg.msg, response); vhost_user_reply(vu_dev, &msg.msg, response);
irq_rc = IRQ_HANDLED; irq_rc = IRQ_HANDLED;
}; }
/* mask EAGAIN as we try non-blocking read until socket is empty */ /* mask EAGAIN as we try non-blocking read until socket is empty */
vu_dev->recv_rc = (rc == -EAGAIN) ? 0 : rc; vu_dev->recv_rc = (rc == -EAGAIN) ? 0 : rc;
return irq_rc; return irq_rc;
...@@ -1136,6 +1137,15 @@ void virtio_uml_set_no_vq_suspend(struct virtio_device *vdev, ...@@ -1136,6 +1137,15 @@ void virtio_uml_set_no_vq_suspend(struct virtio_device *vdev,
static void vu_of_conn_broken(struct work_struct *wk) static void vu_of_conn_broken(struct work_struct *wk)
{ {
struct virtio_uml_platform_data *pdata;
struct virtio_uml_device *vu_dev;
pdata = container_of(wk, struct virtio_uml_platform_data, conn_broken_wk);
vu_dev = platform_get_drvdata(pdata->pdev);
virtio_break_device(&vu_dev->vdev);
/* /*
* We can't remove the device from the devicetree so the only thing we * We can't remove the device from the devicetree so the only thing we
* can do is warn. * can do is warn.
...@@ -1266,8 +1276,14 @@ static int vu_unregister_cmdline_device(struct device *dev, void *data) ...@@ -1266,8 +1276,14 @@ static int vu_unregister_cmdline_device(struct device *dev, void *data)
static void vu_conn_broken(struct work_struct *wk) static void vu_conn_broken(struct work_struct *wk)
{ {
struct virtio_uml_platform_data *pdata; struct virtio_uml_platform_data *pdata;
struct virtio_uml_device *vu_dev;
pdata = container_of(wk, struct virtio_uml_platform_data, conn_broken_wk); pdata = container_of(wk, struct virtio_uml_platform_data, conn_broken_wk);
vu_dev = platform_get_drvdata(pdata->pdev);
virtio_break_device(&vu_dev->vdev);
vu_unregister_cmdline_device(&pdata->pdev->dev, NULL); vu_unregister_cmdline_device(&pdata->pdev->dev, NULL);
} }
......
...@@ -91,7 +91,7 @@ struct cpuinfo_um { ...@@ -91,7 +91,7 @@ struct cpuinfo_um {
extern struct cpuinfo_um boot_cpu_data; extern struct cpuinfo_um boot_cpu_data;
#define cpu_data (&boot_cpu_data) #define cpu_data(cpu) boot_cpu_data
#define current_cpu_data 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)
......
...@@ -29,8 +29,8 @@ void flush_thread(void) ...@@ -29,8 +29,8 @@ void flush_thread(void)
ret = unmap(&current->mm->context.id, 0, TASK_SIZE, 1, &data); ret = unmap(&current->mm->context.id, 0, TASK_SIZE, 1, &data);
if (ret) { if (ret) {
printk(KERN_ERR "flush_thread - clearing address space failed, " printk(KERN_ERR "%s - clearing address space failed, err = %d\n",
"err = %d\n", ret); __func__, ret);
force_sig(SIGKILL); force_sig(SIGKILL);
} }
get_safe_registers(current_pt_regs()->regs.gp, get_safe_registers(current_pt_regs()->regs.gp,
......
...@@ -314,8 +314,8 @@ static inline int update_p4d_range(pgd_t *pgd, unsigned long addr, ...@@ -314,8 +314,8 @@ static inline int update_p4d_range(pgd_t *pgd, unsigned long addr,
return ret; return ret;
} }
void fix_range_common(struct mm_struct *mm, unsigned long start_addr, static void fix_range_common(struct mm_struct *mm, unsigned long start_addr,
unsigned long end_addr, int force) unsigned long end_addr, int force)
{ {
pgd_t *pgd; pgd_t *pgd;
struct host_vm_change hvc; struct host_vm_change hvc;
...@@ -597,6 +597,8 @@ void force_flush_all(void) ...@@ -597,6 +597,8 @@ void force_flush_all(void)
struct vm_area_struct *vma; struct vm_area_struct *vma;
VMA_ITERATOR(vmi, mm, 0); VMA_ITERATOR(vmi, mm, 0);
mmap_read_lock(mm);
for_each_vma(vmi, vma) for_each_vma(vmi, vma)
fix_range(mm, vma->vm_start, vma->vm_end, 1); fix_range(mm, vma->vm_start, vma->vm_end, 1);
mmap_read_unlock(mm);
} }
...@@ -96,7 +96,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) ...@@ -96,7 +96,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
static void *c_start(struct seq_file *m, loff_t *pos) static void *c_start(struct seq_file *m, loff_t *pos)
{ {
return *pos < nr_cpu_ids ? cpu_data + *pos : NULL; return *pos < nr_cpu_ids ? &boot_cpu_data + *pos : NULL;
} }
static void *c_next(struct seq_file *m, void *v, loff_t *pos) static void *c_next(struct seq_file *m, void *v, loff_t *pos)
......
#define RUNTIME_DISCARD_EXIT
KERNEL_STACK_SIZE = 4096 * (1 << CONFIG_KERNEL_STACK_ORDER); KERNEL_STACK_SIZE = 4096 * (1 << CONFIG_KERNEL_STACK_ORDER);
#ifdef CONFIG_LD_SCRIPT_STATIC #ifdef CONFIG_LD_SCRIPT_STATIC
......
...@@ -127,12 +127,10 @@ int os_mod_epoll_fd(int events, int fd, void *data) ...@@ -127,12 +127,10 @@ int os_mod_epoll_fd(int events, int fd, void *data)
int os_del_epoll_fd(int fd) int os_del_epoll_fd(int fd)
{ {
struct epoll_event event; struct epoll_event event;
int result;
/* This is quiet as we use this as IO ON/OFF - so it is often /* This is quiet as we use this as IO ON/OFF - so it is often
* invoked on a non-existent fd * invoked on a non-existent fd
*/ */
result = epoll_ctl(epollfd, EPOLL_CTL_DEL, fd, &event); return epoll_ctl(epollfd, EPOLL_CTL_DEL, fd, &event);
return result;
} }
void os_set_ioignore(void) void os_set_ioignore(void)
......
...@@ -60,8 +60,8 @@ static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr) ...@@ -60,8 +60,8 @@ static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr)
printk(UM_KERN_ERR "Registers - \n"); printk(UM_KERN_ERR "Registers - \n");
for (i = 0; i < MAX_REG_NR; i++) for (i = 0; i < MAX_REG_NR; i++)
printk(UM_KERN_ERR "\t%d\t0x%lx\n", i, syscall_regs[i]); printk(UM_KERN_ERR "\t%d\t0x%lx\n", i, syscall_regs[i]);
panic("do_syscall_stub : PTRACE_SETREGS failed, errno = %d\n", panic("%s : PTRACE_SETREGS failed, errno = %d\n",
-n); __func__, -n);
} }
err = ptrace(PTRACE_CONT, pid, 0, 0); err = ptrace(PTRACE_CONT, pid, 0, 0);
...@@ -81,20 +81,17 @@ static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr) ...@@ -81,20 +81,17 @@ static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr)
offset = *((unsigned long *) mm_idp->stack + 1); offset = *((unsigned long *) mm_idp->stack + 1);
if (offset) { if (offset) {
data = (unsigned long *)(mm_idp->stack + offset - STUB_DATA); data = (unsigned long *)(mm_idp->stack + offset - STUB_DATA);
printk(UM_KERN_ERR "do_syscall_stub : ret = %ld, offset = %ld, " printk(UM_KERN_ERR "%s : ret = %ld, offset = %ld, data = %p\n",
"data = %p\n", ret, offset, data); __func__, ret, offset, data);
syscall = (unsigned long *)((unsigned long)data + data[0]); syscall = (unsigned long *)((unsigned long)data + data[0]);
printk(UM_KERN_ERR "do_syscall_stub: syscall %ld failed, " printk(UM_KERN_ERR "%s: syscall %ld failed, return value = 0x%lx, expected return value = 0x%lx\n",
"return value = 0x%lx, expected return value = 0x%lx\n", __func__, syscall[0], ret, syscall[7]);
syscall[0], ret, syscall[7]); printk(UM_KERN_ERR " syscall parameters: 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n",
printk(UM_KERN_ERR " syscall parameters: "
"0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n",
syscall[1], syscall[2], syscall[3], syscall[1], syscall[2], syscall[3],
syscall[4], syscall[5], syscall[6]); syscall[4], syscall[5], syscall[6]);
for (n = 1; n < data[0]/sizeof(long); n++) { for (n = 1; n < data[0]/sizeof(long); n++) {
if (n == 1) if (n == 1)
printk(UM_KERN_ERR " additional syscall " printk(UM_KERN_ERR " additional syscall data:");
"data:");
if (n % 4 == 1) if (n % 4 == 1)
printk("\n" UM_KERN_ERR " "); printk("\n" UM_KERN_ERR " ");
printk(" 0x%lx", data[n]); printk(" 0x%lx", data[n]);
......
This diff is collapsed.
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
core-y += arch/x86/crypto/ core-y += arch/x86/crypto/
#
# Disable SSE and other FP/SIMD instructions to match normal x86
#
KBUILD_CFLAGS += -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx
KBUILD_RUSTFLAGS += -Ctarget-feature=-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-avx,-avx2
ifeq ($(CONFIG_X86_32),y) ifeq ($(CONFIG_X86_32),y)
START := 0x8048000 START := 0x8048000
......
...@@ -61,7 +61,7 @@ CFLAGS_REMOVE_um_vdso.o = -pg -fprofile-arcs -ftest-coverage ...@@ -61,7 +61,7 @@ CFLAGS_REMOVE_um_vdso.o = -pg -fprofile-arcs -ftest-coverage
# #
quiet_cmd_vdso = VDSO $@ quiet_cmd_vdso = VDSO $@
cmd_vdso = $(CC) -nostdlib -o $@ \ cmd_vdso = $(CC) -nostdlib -o $@ \
$(VDSO_LDFLAGS) $(VDSO_LDFLAGS_$(filter %.lds,$(^F))) \ $(CC_FLAGS_LTO) $(VDSO_LDFLAGS) $(VDSO_LDFLAGS_$(filter %.lds,$(^F))) \
-Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) && \ -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) && \
sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@' sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@'
......
...@@ -17,8 +17,10 @@ int __vdso_clock_gettime(clockid_t clock, struct __kernel_old_timespec *ts) ...@@ -17,8 +17,10 @@ int __vdso_clock_gettime(clockid_t clock, struct __kernel_old_timespec *ts)
{ {
long ret; long ret;
asm("syscall" : "=a" (ret) : asm("syscall"
"0" (__NR_clock_gettime), "D" (clock), "S" (ts) : "memory"); : "=a" (ret)
: "0" (__NR_clock_gettime), "D" (clock), "S" (ts)
: "rcx", "r11", "memory");
return ret; return ret;
} }
...@@ -29,8 +31,10 @@ int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz) ...@@ -29,8 +31,10 @@ int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz)
{ {
long ret; long ret;
asm("syscall" : "=a" (ret) : asm("syscall"
"0" (__NR_gettimeofday), "D" (tv), "S" (tz) : "memory"); : "=a" (ret)
: "0" (__NR_gettimeofday), "D" (tv), "S" (tz)
: "rcx", "r11", "memory");
return ret; return ret;
} }
......
...@@ -412,7 +412,7 @@ static int hostfs_writepage(struct page *page, struct writeback_control *wbc) ...@@ -412,7 +412,7 @@ static int hostfs_writepage(struct page *page, struct writeback_control *wbc)
if (page->index >= end_index) if (page->index >= end_index)
count = inode->i_size & (PAGE_SIZE-1); count = inode->i_size & (PAGE_SIZE-1);
buffer = kmap(page); buffer = kmap_local_page(page);
err = write_file(HOSTFS_I(inode)->fd, &base, buffer, count); err = write_file(HOSTFS_I(inode)->fd, &base, buffer, count);
if (err != count) { if (err != count) {
...@@ -428,9 +428,9 @@ static int hostfs_writepage(struct page *page, struct writeback_control *wbc) ...@@ -428,9 +428,9 @@ static int hostfs_writepage(struct page *page, struct writeback_control *wbc)
err = 0; err = 0;
out: out:
kunmap(page); kunmap_local(buffer);
unlock_page(page); unlock_page(page);
return err; return err;
} }
...@@ -441,7 +441,7 @@ static int hostfs_read_folio(struct file *file, struct folio *folio) ...@@ -441,7 +441,7 @@ static int hostfs_read_folio(struct file *file, struct folio *folio)
loff_t start = page_offset(page); loff_t start = page_offset(page);
int bytes_read, ret = 0; int bytes_read, ret = 0;
buffer = kmap(page); buffer = kmap_local_page(page);
bytes_read = read_file(FILE_HOSTFS_I(file)->fd, &start, buffer, bytes_read = read_file(FILE_HOSTFS_I(file)->fd, &start, buffer,
PAGE_SIZE); PAGE_SIZE);
if (bytes_read < 0) { if (bytes_read < 0) {
...@@ -458,8 +458,9 @@ static int hostfs_read_folio(struct file *file, struct folio *folio) ...@@ -458,8 +458,9 @@ static int hostfs_read_folio(struct file *file, struct folio *folio)
out: out:
flush_dcache_page(page); flush_dcache_page(page);
kunmap(page); kunmap_local(buffer);
unlock_page(page); unlock_page(page);
return ret; return ret;
} }
...@@ -484,9 +485,9 @@ static int hostfs_write_end(struct file *file, struct address_space *mapping, ...@@ -484,9 +485,9 @@ static int hostfs_write_end(struct file *file, struct address_space *mapping,
unsigned from = pos & (PAGE_SIZE - 1); unsigned from = pos & (PAGE_SIZE - 1);
int err; int err;
buffer = kmap(page); buffer = kmap_local_page(page);
err = write_file(FILE_HOSTFS_I(file)->fd, &pos, buffer + from, copied); err = write_file(FILE_HOSTFS_I(file)->fd, &pos, buffer + from, copied);
kunmap(page); kunmap_local(buffer);
if (!PageUptodate(page) && err == PAGE_SIZE) if (!PageUptodate(page) && err == PAGE_SIZE)
SetPageUptodate(page); SetPageUptodate(page);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment