diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-09-21 14:07:02 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-09-21 14:07:02 -0400 |
commit | 9dca3432ee063b70a4cfb3f0857d0aeef7b84fa8 (patch) | |
tree | 44a4b95e489cfbe91ccc7673d993dd0983ed681c | |
parent | 4553d469d6f88028f185de57e771dd29aba10d90 (diff) | |
parent | 73625ed66389d4c620520058d828f43a93ab4d0c (diff) |
Merge tag 'for-linus-5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml
Pull UML updates from Richard Weinberger:
- virtio support
- fixes for our new time travel mode
- various improvements to make lockdep and kasan work better
- SPDX header updates
* tag 'for-linus-5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml: (25 commits)
um: irq: Fix LAST_IRQ usage in init_IRQ()
um: Add SPDX headers for files in arch/um/include
um: Add SPDX headers for files in arch/um/os-Linux
um: Add SPDX headers to files in arch/um/kernel/
um: Add SPDX headers for files in arch/um/drivers
um: virtio: Implement VHOST_USER_PROTOCOL_F_REPLY_ACK
um: virtio: Implement VHOST_USER_PROTOCOL_F_SLAVE_REQ
um: drivers: Add virtio vhost-user driver
um: Use real DMA barriers
um: Don't use generic barrier.h
um: time-travel: Restrict time update in IRQ handler
um: time-travel: Fix periodic timers
um: Enable CONFIG_CONSTRUCTORS
um: Place (soft)irq text with macros
um: Fix VDSO compiler warning
um: Implement TRACE_IRQFLAGS_SUPPORT
um: Remove misleading #define ARCh_IRQ_ENABLED
um: Avoid using uninitialized regs
um: Remove sig_info[SIGALRM]
um: Error handling fixes in vector drivers
...
154 files changed, 1913 insertions, 291 deletions
diff --git a/arch/um/drivers/Kconfig b/arch/um/drivers/Kconfig index 2638e46f50cc..fea5a0d522dc 100644 --- a/arch/um/drivers/Kconfig +++ b/arch/um/drivers/Kconfig | |||
@@ -335,3 +335,10 @@ config UML_NET_SLIRP | |||
335 | Startup example: "eth0=slirp,FE:FD:01:02:03:04,/usr/local/bin/slirp" | 335 | Startup example: "eth0=slirp,FE:FD:01:02:03:04,/usr/local/bin/slirp" |
336 | 336 | ||
337 | endmenu | 337 | endmenu |
338 | |||
339 | config VIRTIO_UML | ||
340 | tristate "UML driver for virtio devices" | ||
341 | select VIRTIO | ||
342 | help | ||
343 | This driver provides support for virtio based paravirtual device | ||
344 | drivers over vhost-user sockets. | ||
diff --git a/arch/um/drivers/Makefile b/arch/um/drivers/Makefile index 693319839f69..a290821e355c 100644 --- a/arch/um/drivers/Makefile +++ b/arch/um/drivers/Makefile | |||
@@ -1,6 +1,6 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Copyright (C) 2000, 2002, 2003 Jeff Dike (jdike@karaya.com) | 3 | # Copyright (C) 2000, 2002, 2003 Jeff Dike (jdike@karaya.com) |
3 | # Licensed under the GPL | ||
4 | # | 4 | # |
5 | 5 | ||
6 | # pcap is broken in 2.5 because kbuild doesn't allow pcap.a to be linked | 6 | # pcap is broken in 2.5 because kbuild doesn't allow pcap.a to be linked |
@@ -61,6 +61,7 @@ obj-$(CONFIG_XTERM_CHAN) += xterm.o xterm_kern.o | |||
61 | obj-$(CONFIG_UML_WATCHDOG) += harddog.o | 61 | obj-$(CONFIG_UML_WATCHDOG) += harddog.o |
62 | obj-$(CONFIG_BLK_DEV_COW_COMMON) += cow_user.o | 62 | obj-$(CONFIG_BLK_DEV_COW_COMMON) += cow_user.o |
63 | obj-$(CONFIG_UML_RANDOM) += random.o | 63 | obj-$(CONFIG_UML_RANDOM) += random.o |
64 | obj-$(CONFIG_VIRTIO_UML) += virtio_uml.o | ||
64 | 65 | ||
65 | # pcap_user.o must be added explicitly. | 66 | # pcap_user.o must be added explicitly. |
66 | USER_OBJS := fd.o null.o pty.o tty.o xterm.o slip_common.o pcap_user.o vde_user.o vector_user.o | 67 | USER_OBJS := fd.o null.o pty.o tty.o xterm.o slip_common.o pcap_user.o vde_user.o vector_user.o |
diff --git a/arch/um/drivers/chan.h b/arch/um/drivers/chan.h index c512b0306dd4..c37cc4f26f91 100644 --- a/arch/um/drivers/chan.h +++ b/arch/um/drivers/chan.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com) | 3 | * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __CHAN_KERN_H__ | 6 | #ifndef __CHAN_KERN_H__ |
diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c index 749d2bf59599..62997055c454 100644 --- a/arch/um/drivers/chan_kern.c +++ b/arch/um/drivers/chan_kern.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com) | 3 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/slab.h> | 6 | #include <linux/slab.h> |
diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c index 3fd7c3efdb18..4d80526a4236 100644 --- a/arch/um/drivers/chan_user.c +++ b/arch/um/drivers/chan_user.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com) | 3 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <stdlib.h> | 6 | #include <stdlib.h> |
diff --git a/arch/um/drivers/chan_user.h b/arch/um/drivers/chan_user.h index 03f1b565c5f9..72222bb036f5 100644 --- a/arch/um/drivers/chan_user.h +++ b/arch/um/drivers/chan_user.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com) | 3 | * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __CHAN_USER_H__ | 6 | #ifndef __CHAN_USER_H__ |
diff --git a/arch/um/drivers/cow_user.c b/arch/um/drivers/cow_user.c index 0ee9cc6cc4c7..74b0c2686c95 100644 --- a/arch/um/drivers/cow_user.c +++ b/arch/um/drivers/cow_user.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com) | 3 | * Copyright (C) 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | /* | 6 | /* |
diff --git a/arch/um/drivers/daemon.h b/arch/um/drivers/daemon.h index c2dd1951559f..1509cc7eb907 100644 --- a/arch/um/drivers/daemon.h +++ b/arch/um/drivers/daemon.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __DAEMON_H__ | 6 | #ifndef __DAEMON_H__ |
diff --git a/arch/um/drivers/daemon_kern.c b/arch/um/drivers/daemon_kern.c index 7568cc2f3cd6..fd2402669c49 100644 --- a/arch/um/drivers/daemon_kern.c +++ b/arch/um/drivers/daemon_kern.c | |||
@@ -1,9 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and | 3 | * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and |
3 | * James Leu (jleu@mindspring.net). | 4 | * James Leu (jleu@mindspring.net). |
4 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 5 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
5 | * Copyright (C) 2001 by various other people who didn't put their name here. | 6 | * Copyright (C) 2001 by various other people who didn't put their name here. |
6 | * Licensed under the GPL. | ||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/init.h> | 9 | #include <linux/init.h> |
diff --git a/arch/um/drivers/daemon_user.c b/arch/um/drivers/daemon_user.c index 8813c10d0177..3695821d06a2 100644 --- a/arch/um/drivers/daemon_user.c +++ b/arch/um/drivers/daemon_user.c | |||
@@ -1,9 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and | 4 | * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and |
4 | * James Leu (jleu@mindspring.net). | 5 | * James Leu (jleu@mindspring.net). |
5 | * Copyright (C) 2001 by various other people who didn't put their name here. | 6 | * Copyright (C) 2001 by various other people who didn't put their name here. |
6 | * Licensed under the GPL. | ||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <stdint.h> | 9 | #include <stdint.h> |
diff --git a/arch/um/drivers/fd.c b/arch/um/drivers/fd.c index a13a427b996b..082d739dc052 100644 --- a/arch/um/drivers/fd.c +++ b/arch/um/drivers/fd.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com) | 3 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <stdio.h> | 6 | #include <stdio.h> |
diff --git a/arch/um/drivers/harddog_user.c b/arch/um/drivers/harddog_user.c index 3aa8b0d52a48..070468d22e39 100644 --- a/arch/um/drivers/harddog_user.c +++ b/arch/um/drivers/harddog_user.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <stdio.h> | 6 | #include <stdio.h> |
diff --git a/arch/um/drivers/hostaudio_kern.c b/arch/um/drivers/hostaudio_kern.c index 7f9dbdbc4eb7..bf75b1ceac47 100644 --- a/arch/um/drivers/hostaudio_kern.c +++ b/arch/um/drivers/hostaudio_kern.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 Steve Schmidtke | 3 | * Copyright (C) 2002 Steve Schmidtke |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/fs.h> | 6 | #include <linux/fs.h> |
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c index e0e63931fb2b..4f2a4ac8a82b 100644 --- a/arch/um/drivers/line.c +++ b/arch/um/drivers/line.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/irqreturn.h> | 6 | #include <linux/irqreturn.h> |
diff --git a/arch/um/drivers/line.h b/arch/um/drivers/line.h index 138a14526d9c..a151ff5155ef 100644 --- a/arch/um/drivers/line.h +++ b/arch/um/drivers/line.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com) | 3 | * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __LINE_H__ | 6 | #ifndef __LINE_H__ |
diff --git a/arch/um/drivers/mconsole.h b/arch/um/drivers/mconsole.h index 44af7379ea19..6356378304fd 100644 --- a/arch/um/drivers/mconsole.h +++ b/arch/um/drivers/mconsole.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) | 3 | * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) |
3 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 4 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
4 | * Licensed under the GPL | ||
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef __MCONSOLE_H__ | 7 | #ifndef __MCONSOLE_H__ |
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c index ff3ab72fd90f..0117489e9b30 100644 --- a/arch/um/drivers/mconsole_kern.c +++ b/arch/um/drivers/mconsole_kern.c | |||
@@ -1,7 +1,7 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) | 3 | * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) |
3 | * Copyright (C) 2001 - 2008 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 4 | * Copyright (C) 2001 - 2008 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
4 | * Licensed under the GPL | ||
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/console.h> | 7 | #include <linux/console.h> |
diff --git a/arch/um/drivers/mconsole_kern.h b/arch/um/drivers/mconsole_kern.h index 7a0c6a1ad1d4..56d8d6a3ff76 100644 --- a/arch/um/drivers/mconsole_kern.h +++ b/arch/um/drivers/mconsole_kern.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com) | 3 | * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __MCONSOLE_KERN_H__ | 6 | #ifndef __MCONSOLE_KERN_H__ |
diff --git a/arch/um/drivers/mconsole_user.c b/arch/um/drivers/mconsole_user.c index 99209826adb1..e24298a734be 100644 --- a/arch/um/drivers/mconsole_user.c +++ b/arch/um/drivers/mconsole_user.c | |||
@@ -1,7 +1,7 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) | 3 | * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) |
3 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 4 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
4 | * Licensed under the GPL | ||
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <errno.h> | 7 | #include <errno.h> |
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c index 6e5be5fb4143..327b728f7244 100644 --- a/arch/um/drivers/net_kern.c +++ b/arch/um/drivers/net_kern.c | |||
@@ -1,9 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and | 4 | * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and |
4 | * James Leu (jleu@mindspring.net). | 5 | * James Leu (jleu@mindspring.net). |
5 | * Copyright (C) 2001 by various other people who didn't put their name here. | 6 | * Copyright (C) 2001 by various other people who didn't put their name here. |
6 | * Licensed under the GPL. | ||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/memblock.h> | 9 | #include <linux/memblock.h> |
diff --git a/arch/um/drivers/net_user.c b/arch/um/drivers/net_user.c index e9f8445861dc..4c9576452ab0 100644 --- a/arch/um/drivers/net_user.c +++ b/arch/um/drivers/net_user.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <stdio.h> | 6 | #include <stdio.h> |
diff --git a/arch/um/drivers/null.c b/arch/um/drivers/null.c index 10495747ce8e..87087763a417 100644 --- a/arch/um/drivers/null.c +++ b/arch/um/drivers/null.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com) | 3 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <stddef.h> | 6 | #include <stddef.h> |
diff --git a/arch/um/drivers/pcap_kern.c b/arch/um/drivers/pcap_kern.c index be0fb57bd1d7..cfe4cb17694c 100644 --- a/arch/um/drivers/pcap_kern.c +++ b/arch/um/drivers/pcap_kern.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL. | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/init.h> | 6 | #include <linux/init.h> |
diff --git a/arch/um/drivers/pcap_user.c b/arch/um/drivers/pcap_user.c index c07b9c752c86..bbd20638788a 100644 --- a/arch/um/drivers/pcap_user.c +++ b/arch/um/drivers/pcap_user.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL. | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <errno.h> | 6 | #include <errno.h> |
diff --git a/arch/um/drivers/pcap_user.h b/arch/um/drivers/pcap_user.h index 1ca7c764cc63..216246f5f09b 100644 --- a/arch/um/drivers/pcap_user.h +++ b/arch/um/drivers/pcap_user.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | 3 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <net_user.h> | 6 | #include <net_user.h> |
diff --git a/arch/um/drivers/port.h b/arch/um/drivers/port.h index 372a80c0556a..9085b336e683 100644 --- a/arch/um/drivers/port.h +++ b/arch/um/drivers/port.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001 Jeff Dike (jdike@karaya.com) | 3 | * Copyright (C) 2001 Jeff Dike (jdike@karaya.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __PORT_H__ | 6 | #ifndef __PORT_H__ |
diff --git a/arch/um/drivers/port_kern.c b/arch/um/drivers/port_kern.c index b0e9ff35daee..a47ca5376d9d 100644 --- a/arch/um/drivers/port_kern.c +++ b/arch/um/drivers/port_kern.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com) | 3 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/completion.h> | 6 | #include <linux/completion.h> |
diff --git a/arch/um/drivers/port_user.c b/arch/um/drivers/port_user.c index 5f56d11b886f..5b5b64cb1071 100644 --- a/arch/um/drivers/port_user.c +++ b/arch/um/drivers/port_user.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com) | 3 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <stdio.h> | 6 | #include <stdio.h> |
diff --git a/arch/um/drivers/pty.c b/arch/um/drivers/pty.c index f1fcc2cedb5e..39c60068cfdf 100644 --- a/arch/um/drivers/pty.c +++ b/arch/um/drivers/pty.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <stdio.h> | 6 | #include <stdio.h> |
diff --git a/arch/um/drivers/slip_kern.c b/arch/um/drivers/slip_kern.c index ed5249fc0574..c58ccdcc16d6 100644 --- a/arch/um/drivers/slip_kern.c +++ b/arch/um/drivers/slip_kern.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL. | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/if_arp.h> | 6 | #include <linux/if_arp.h> |
diff --git a/arch/um/drivers/slip_user.c b/arch/um/drivers/slip_user.c index 0d6b66c64a81..8016d32b6809 100644 --- a/arch/um/drivers/slip_user.c +++ b/arch/um/drivers/slip_user.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL. | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <stdio.h> | 6 | #include <stdio.h> |
diff --git a/arch/um/drivers/slirp_kern.c b/arch/um/drivers/slirp_kern.c index 4ef11ca7cacf..2d9769237f08 100644 --- a/arch/um/drivers/slirp_kern.c +++ b/arch/um/drivers/slirp_kern.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL. | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/if_arp.h> | 6 | #include <linux/if_arp.h> |
diff --git a/arch/um/drivers/slirp_user.c b/arch/um/drivers/slirp_user.c index 98b6a41a254e..8f633e2e5f3d 100644 --- a/arch/um/drivers/slirp_user.c +++ b/arch/um/drivers/slirp_user.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL. | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <unistd.h> | 6 | #include <unistd.h> |
diff --git a/arch/um/drivers/ssl.c b/arch/um/drivers/ssl.c index 7ae407d5337e..b213201b8a3b 100644 --- a/arch/um/drivers/ssl.c +++ b/arch/um/drivers/ssl.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000, 2002 Jeff Dike (jdike@karaya.com) | 3 | * Copyright (C) 2000, 2002 Jeff Dike (jdike@karaya.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/fs.h> | 6 | #include <linux/fs.h> |
diff --git a/arch/um/drivers/stdio_console.c b/arch/um/drivers/stdio_console.c index c90817b04da9..0021d7ffb528 100644 --- a/arch/um/drivers/stdio_console.c +++ b/arch/um/drivers/stdio_console.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com) | 3 | * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/posix_types.h> | 6 | #include <linux/posix_types.h> |
diff --git a/arch/um/drivers/stdio_console.h b/arch/um/drivers/stdio_console.h index 6d8275f71fd4..3a409ec23d63 100644 --- a/arch/um/drivers/stdio_console.h +++ b/arch/um/drivers/stdio_console.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) | 3 | * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __STDIO_CONSOLE_H | 6 | #ifndef __STDIO_CONSOLE_H |
diff --git a/arch/um/drivers/tty.c b/arch/um/drivers/tty.c index eaa201bca5ed..884a762d21c7 100644 --- a/arch/um/drivers/tty.c +++ b/arch/um/drivers/tty.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com) | 3 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <errno.h> | 6 | #include <errno.h> |
diff --git a/arch/um/drivers/ubd.h b/arch/um/drivers/ubd.h index cc1cc85f5afc..f016fe15499f 100644 --- a/arch/um/drivers/ubd.h +++ b/arch/um/drivers/ubd.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) | 3 | * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) |
3 | * Copyright (C) 2001 RidgeRun, Inc (glonnon@ridgerun.com) | 4 | * Copyright (C) 2001 RidgeRun, Inc (glonnon@ridgerun.com) |
4 | * Licensed under the GPL | ||
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef __UM_UBD_USER_H | 7 | #ifndef __UM_UBD_USER_H |
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index 33c1cd6a12ac..612535cd9706 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c | |||
@@ -1,8 +1,8 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2018 Cambridge Greys Ltd | 3 | * Copyright (C) 2018 Cambridge Greys Ltd |
3 | * Copyright (C) 2015-2016 Anton Ivanov (aivanov@brocade.com) | 4 | * Copyright (C) 2015-2016 Anton Ivanov (aivanov@brocade.com) |
4 | * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) | 5 | * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) |
5 | * Licensed under the GPL | ||
6 | */ | 6 | */ |
7 | 7 | ||
8 | /* 2001-09-28...2002-04-17 | 8 | /* 2001-09-28...2002-04-17 |
diff --git a/arch/um/drivers/ubd_user.c b/arch/um/drivers/ubd_user.c index 6f744794d141..a1afe414ce48 100644 --- a/arch/um/drivers/ubd_user.c +++ b/arch/um/drivers/ubd_user.c | |||
@@ -1,8 +1,8 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2016 Anton Ivanov (aivanov@brocade.com) | 3 | * Copyright (C) 2016 Anton Ivanov (aivanov@brocade.com) |
3 | * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) | 4 | * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) |
4 | * Copyright (C) 2001 Ridgerun,Inc (glonnon@ridgerun.com) | 5 | * Copyright (C) 2001 Ridgerun,Inc (glonnon@ridgerun.com) |
5 | * Licensed under the GPL | ||
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <stddef.h> | 8 | #include <stddef.h> |
diff --git a/arch/um/drivers/umcast.h b/arch/um/drivers/umcast.h index c190c6440911..fe39bee1e3bd 100644 --- a/arch/um/drivers/umcast.h +++ b/arch/um/drivers/umcast.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __DRIVERS_UMCAST_H | 6 | #ifndef __DRIVERS_UMCAST_H |
diff --git a/arch/um/drivers/umcast_kern.c b/arch/um/drivers/umcast_kern.c index f5ba6e377913..595a54f2b9c6 100644 --- a/arch/um/drivers/umcast_kern.c +++ b/arch/um/drivers/umcast_kern.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * user-mode-linux networking multicast transport | 3 | * user-mode-linux networking multicast transport |
3 | * Copyright (C) 2001 by Harald Welte <laforge@gnumonks.org> | 4 | * Copyright (C) 2001 by Harald Welte <laforge@gnumonks.org> |
@@ -8,7 +9,6 @@ | |||
8 | * James Leu (jleu@mindspring.net). | 9 | * James Leu (jleu@mindspring.net). |
9 | * Copyright (C) 2001 by various other people who didn't put their name here. | 10 | * Copyright (C) 2001 by various other people who didn't put their name here. |
10 | * | 11 | * |
11 | * Licensed under the GPL. | ||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
diff --git a/arch/um/drivers/umcast_user.c b/arch/um/drivers/umcast_user.c index 6074184bb51b..b50b13cff04e 100644 --- a/arch/um/drivers/umcast_user.c +++ b/arch/um/drivers/umcast_user.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * user-mode-linux networking multicast transport | 3 | * user-mode-linux networking multicast transport |
3 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 4 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
@@ -8,7 +9,6 @@ | |||
8 | * James Leu (jleu@mindspring.net). | 9 | * James Leu (jleu@mindspring.net). |
9 | * Copyright (C) 2001 by various other people who didn't put their name here. | 10 | * Copyright (C) 2001 by various other people who didn't put their name here. |
10 | * | 11 | * |
11 | * Licensed under the GPL. | ||
12 | * | 12 | * |
13 | */ | 13 | */ |
14 | 14 | ||
diff --git a/arch/um/drivers/vde.h b/arch/um/drivers/vde.h index fc3a05902ba1..cab0379e6142 100644 --- a/arch/um/drivers/vde.h +++ b/arch/um/drivers/vde.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2007 Luca Bigliardi (shammash@artha.org). | 3 | * Copyright (C) 2007 Luca Bigliardi (shammash@artha.org). |
3 | * Licensed under the GPL. | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __UM_VDE_H__ | 6 | #ifndef __UM_VDE_H__ |
diff --git a/arch/um/drivers/vde_kern.c b/arch/um/drivers/vde_kern.c index 6a365fadc7c4..bc6f22cbfb35 100644 --- a/arch/um/drivers/vde_kern.c +++ b/arch/um/drivers/vde_kern.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2007 Luca Bigliardi (shammash@artha.org). | 3 | * Copyright (C) 2007 Luca Bigliardi (shammash@artha.org). |
3 | * Licensed under the GPL. | ||
4 | * | 4 | * |
5 | * Transport usage: | 5 | * Transport usage: |
6 | * ethN=vde,<vde_switch>,<mac addr>,<port>,<group>,<mode>,<description> | 6 | * ethN=vde,<vde_switch>,<mac addr>,<port>,<group>,<mode>,<description> |
diff --git a/arch/um/drivers/vde_user.c b/arch/um/drivers/vde_user.c index 64cb630d1157..bc7dc4e1e486 100644 --- a/arch/um/drivers/vde_user.c +++ b/arch/um/drivers/vde_user.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2007 Luca Bigliardi (shammash@artha.org). | 3 | * Copyright (C) 2007 Luca Bigliardi (shammash@artha.org). |
3 | * Licensed under the GPL. | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <stddef.h> | 6 | #include <stddef.h> |
diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c index e190e4ca52e1..769ffbd9e9a6 100644 --- a/arch/um/drivers/vector_kern.c +++ b/arch/um/drivers/vector_kern.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2017 - Cambridge Greys Limited | 3 | * Copyright (C) 2017 - Cambridge Greys Limited |
3 | * Copyright (C) 2011 - 2014 Cisco Systems Inc | 4 | * Copyright (C) 2011 - 2014 Cisco Systems Inc |
@@ -5,7 +6,6 @@ | |||
5 | * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and | 6 | * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and |
6 | * James Leu (jleu@mindspring.net). | 7 | * James Leu (jleu@mindspring.net). |
7 | * Copyright (C) 2001 by various other people who didn't put their name here. | 8 | * Copyright (C) 2001 by various other people who didn't put their name here. |
8 | * Licensed under the GPL. | ||
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/version.h> | 11 | #include <linux/version.h> |
@@ -76,6 +76,7 @@ static void vector_eth_configure(int n, struct arglist *def); | |||
76 | #define DEFAULT_VECTOR_SIZE 64 | 76 | #define DEFAULT_VECTOR_SIZE 64 |
77 | #define TX_SMALL_PACKET 128 | 77 | #define TX_SMALL_PACKET 128 |
78 | #define MAX_IOV_SIZE (MAX_SKB_FRAGS + 1) | 78 | #define MAX_IOV_SIZE (MAX_SKB_FRAGS + 1) |
79 | #define MAX_ITERATIONS 64 | ||
79 | 80 | ||
80 | static const struct { | 81 | static const struct { |
81 | const char string[ETH_GSTRING_LEN]; | 82 | const char string[ETH_GSTRING_LEN]; |
@@ -121,7 +122,8 @@ static int get_mtu(struct arglist *def) | |||
121 | 122 | ||
122 | if (mtu != NULL) { | 123 | if (mtu != NULL) { |
123 | if (kstrtoul(mtu, 10, &result) == 0) | 124 | if (kstrtoul(mtu, 10, &result) == 0) |
124 | return result; | 125 | if ((result < (1 << 16) - 1) && (result >= 576)) |
126 | return result; | ||
125 | } | 127 | } |
126 | return ETH_MAX_PACKET; | 128 | return ETH_MAX_PACKET; |
127 | } | 129 | } |
@@ -186,6 +188,8 @@ static int get_transport_options(struct arglist *def) | |||
186 | 188 | ||
187 | 189 | ||
188 | if (strncmp(transport, TRANS_TAP, TRANS_TAP_LEN) == 0) | 190 | if (strncmp(transport, TRANS_TAP, TRANS_TAP_LEN) == 0) |
191 | return 0; | ||
192 | if (strncmp(transport, TRANS_HYBRID, TRANS_HYBRID_LEN) == 0) | ||
189 | return (vec_rx | VECTOR_BPF); | 193 | return (vec_rx | VECTOR_BPF); |
190 | if (strncmp(transport, TRANS_RAW, TRANS_RAW_LEN) == 0) | 194 | if (strncmp(transport, TRANS_RAW, TRANS_RAW_LEN) == 0) |
191 | return (vec_rx | vec_tx | VECTOR_QDISC_BYPASS); | 195 | return (vec_rx | vec_tx | VECTOR_QDISC_BYPASS); |
@@ -415,6 +419,7 @@ static int vector_send(struct vector_queue *qi) | |||
415 | if (net_ratelimit()) | 419 | if (net_ratelimit()) |
416 | netdev_err(vp->dev, "sendmmsg err=%i\n", | 420 | netdev_err(vp->dev, "sendmmsg err=%i\n", |
417 | result); | 421 | result); |
422 | vp->in_error = true; | ||
418 | result = send_len; | 423 | result = send_len; |
419 | } | 424 | } |
420 | if (result > 0) { | 425 | if (result > 0) { |
@@ -842,6 +847,10 @@ static int vector_legacy_rx(struct vector_private *vp) | |||
842 | } | 847 | } |
843 | 848 | ||
844 | pkt_len = uml_vector_recvmsg(vp->fds->rx_fd, &hdr, 0); | 849 | pkt_len = uml_vector_recvmsg(vp->fds->rx_fd, &hdr, 0); |
850 | if (pkt_len < 0) { | ||
851 | vp->in_error = true; | ||
852 | return pkt_len; | ||
853 | } | ||
845 | 854 | ||
846 | if (skb != NULL) { | 855 | if (skb != NULL) { |
847 | if (pkt_len > vp->header_size) { | 856 | if (pkt_len > vp->header_size) { |
@@ -888,12 +897,16 @@ static int writev_tx(struct vector_private *vp, struct sk_buff *skb) | |||
888 | 897 | ||
889 | if (iov_count < 1) | 898 | if (iov_count < 1) |
890 | goto drop; | 899 | goto drop; |
900 | |||
891 | pkt_len = uml_vector_writev( | 901 | pkt_len = uml_vector_writev( |
892 | vp->fds->tx_fd, | 902 | vp->fds->tx_fd, |
893 | (struct iovec *) &iov, | 903 | (struct iovec *) &iov, |
894 | iov_count | 904 | iov_count |
895 | ); | 905 | ); |
896 | 906 | ||
907 | if (pkt_len < 0) | ||
908 | goto drop; | ||
909 | |||
897 | netif_trans_update(vp->dev); | 910 | netif_trans_update(vp->dev); |
898 | netif_wake_queue(vp->dev); | 911 | netif_wake_queue(vp->dev); |
899 | 912 | ||
@@ -908,6 +921,8 @@ static int writev_tx(struct vector_private *vp, struct sk_buff *skb) | |||
908 | drop: | 921 | drop: |
909 | vp->dev->stats.tx_dropped++; | 922 | vp->dev->stats.tx_dropped++; |
910 | consume_skb(skb); | 923 | consume_skb(skb); |
924 | if (pkt_len < 0) | ||
925 | vp->in_error = true; | ||
911 | return pkt_len; | 926 | return pkt_len; |
912 | } | 927 | } |
913 | 928 | ||
@@ -936,6 +951,9 @@ static int vector_mmsg_rx(struct vector_private *vp) | |||
936 | packet_count = uml_vector_recvmmsg( | 951 | packet_count = uml_vector_recvmmsg( |
937 | vp->fds->rx_fd, qi->mmsg_vector, qi->max_depth, 0); | 952 | vp->fds->rx_fd, qi->mmsg_vector, qi->max_depth, 0); |
938 | 953 | ||
954 | if (packet_count < 0) | ||
955 | vp->in_error = true; | ||
956 | |||
939 | if (packet_count <= 0) | 957 | if (packet_count <= 0) |
940 | return packet_count; | 958 | return packet_count; |
941 | 959 | ||
@@ -1005,15 +1023,18 @@ static int vector_mmsg_rx(struct vector_private *vp) | |||
1005 | static void vector_rx(struct vector_private *vp) | 1023 | static void vector_rx(struct vector_private *vp) |
1006 | { | 1024 | { |
1007 | int err; | 1025 | int err; |
1026 | int iter = 0; | ||
1008 | 1027 | ||
1009 | if ((vp->options & VECTOR_RX) > 0) | 1028 | if ((vp->options & VECTOR_RX) > 0) |
1010 | while ((err = vector_mmsg_rx(vp)) > 0) | 1029 | while (((err = vector_mmsg_rx(vp)) > 0) && (iter < MAX_ITERATIONS)) |
1011 | ; | 1030 | iter++; |
1012 | else | 1031 | else |
1013 | while ((err = vector_legacy_rx(vp)) > 0) | 1032 | while (((err = vector_legacy_rx(vp)) > 0) && (iter < MAX_ITERATIONS)) |
1014 | ; | 1033 | iter++; |
1015 | if ((err != 0) && net_ratelimit()) | 1034 | if ((err != 0) && net_ratelimit()) |
1016 | netdev_err(vp->dev, "vector_rx: error(%d)\n", err); | 1035 | netdev_err(vp->dev, "vector_rx: error(%d)\n", err); |
1036 | if (iter == MAX_ITERATIONS) | ||
1037 | netdev_err(vp->dev, "vector_rx: device stuck, remote end may have closed the connection\n"); | ||
1017 | } | 1038 | } |
1018 | 1039 | ||
1019 | static int vector_net_start_xmit(struct sk_buff *skb, struct net_device *dev) | 1040 | static int vector_net_start_xmit(struct sk_buff *skb, struct net_device *dev) |
@@ -1021,6 +1042,13 @@ static int vector_net_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1021 | struct vector_private *vp = netdev_priv(dev); | 1042 | struct vector_private *vp = netdev_priv(dev); |
1022 | int queue_depth = 0; | 1043 | int queue_depth = 0; |
1023 | 1044 | ||
1045 | if (vp->in_error) { | ||
1046 | deactivate_fd(vp->fds->rx_fd, vp->rx_irq); | ||
1047 | if ((vp->fds->rx_fd != vp->fds->tx_fd) && (vp->tx_irq != 0)) | ||
1048 | deactivate_fd(vp->fds->tx_fd, vp->tx_irq); | ||
1049 | return NETDEV_TX_BUSY; | ||
1050 | } | ||
1051 | |||
1024 | if ((vp->options & VECTOR_TX) == 0) { | 1052 | if ((vp->options & VECTOR_TX) == 0) { |
1025 | writev_tx(vp, skb); | 1053 | writev_tx(vp, skb); |
1026 | return NETDEV_TX_OK; | 1054 | return NETDEV_TX_OK; |
@@ -1131,6 +1159,7 @@ static int vector_net_close(struct net_device *dev) | |||
1131 | vp->fds = NULL; | 1159 | vp->fds = NULL; |
1132 | spin_lock_irqsave(&vp->lock, flags); | 1160 | spin_lock_irqsave(&vp->lock, flags); |
1133 | vp->opened = false; | 1161 | vp->opened = false; |
1162 | vp->in_error = false; | ||
1134 | spin_unlock_irqrestore(&vp->lock, flags); | 1163 | spin_unlock_irqrestore(&vp->lock, flags); |
1135 | return 0; | 1164 | return 0; |
1136 | } | 1165 | } |
@@ -1498,7 +1527,8 @@ static void vector_eth_configure( | |||
1498 | .transport_data = NULL, | 1527 | .transport_data = NULL, |
1499 | .in_write_poll = false, | 1528 | .in_write_poll = false, |
1500 | .coalesce = 2, | 1529 | .coalesce = 2, |
1501 | .req_size = get_req_size(def) | 1530 | .req_size = get_req_size(def), |
1531 | .in_error = false | ||
1502 | }); | 1532 | }); |
1503 | 1533 | ||
1504 | dev->features = dev->hw_features = (NETIF_F_SG | NETIF_F_FRAGLIST); | 1534 | dev->features = dev->hw_features = (NETIF_F_SG | NETIF_F_FRAGLIST); |
diff --git a/arch/um/drivers/vector_kern.h b/arch/um/drivers/vector_kern.h index 0b0a767b9076..4d292e6c07af 100644 --- a/arch/um/drivers/vector_kern.h +++ b/arch/um/drivers/vector_kern.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2002 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __UM_VECTOR_KERN_H | 6 | #ifndef __UM_VECTOR_KERN_H |
@@ -116,6 +116,7 @@ struct vector_private { | |||
116 | bool rexmit_scheduled; | 116 | bool rexmit_scheduled; |
117 | bool opened; | 117 | bool opened; |
118 | bool in_write_poll; | 118 | bool in_write_poll; |
119 | bool in_error; | ||
119 | 120 | ||
120 | /* ethtool stats */ | 121 | /* ethtool stats */ |
121 | 122 | ||
diff --git a/arch/um/drivers/vector_transports.c b/arch/um/drivers/vector_transports.c index 77e4ebc206ae..0794d23f07cb 100644 --- a/arch/um/drivers/vector_transports.c +++ b/arch/um/drivers/vector_transports.c | |||
@@ -1,7 +1,7 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2017 - Cambridge Greys Limited | 3 | * Copyright (C) 2017 - Cambridge Greys Limited |
3 | * Copyright (C) 2011 - 2014 Cisco Systems Inc | 4 | * Copyright (C) 2011 - 2014 Cisco Systems Inc |
4 | * Licensed under the GPL. | ||
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/etherdevice.h> | 7 | #include <linux/etherdevice.h> |
@@ -418,7 +418,7 @@ static int build_raw_transport_data(struct vector_private *vp) | |||
418 | return 0; | 418 | return 0; |
419 | } | 419 | } |
420 | 420 | ||
421 | static int build_tap_transport_data(struct vector_private *vp) | 421 | static int build_hybrid_transport_data(struct vector_private *vp) |
422 | { | 422 | { |
423 | if (uml_raw_enable_vnet_headers(vp->fds->rx_fd)) { | 423 | if (uml_raw_enable_vnet_headers(vp->fds->rx_fd)) { |
424 | vp->form_header = &raw_form_header; | 424 | vp->form_header = &raw_form_header; |
@@ -432,7 +432,7 @@ static int build_tap_transport_data(struct vector_private *vp) | |||
432 | NETIF_F_TSO | NETIF_F_GSO | NETIF_F_GRO); | 432 | NETIF_F_TSO | NETIF_F_GSO | NETIF_F_GRO); |
433 | netdev_info( | 433 | netdev_info( |
434 | vp->dev, | 434 | vp->dev, |
435 | "tap/raw: using vnet headers for tso and tx/rx checksum" | 435 | "tap/raw hybrid: using vnet headers for tso and tx/rx checksum" |
436 | ); | 436 | ); |
437 | } else { | 437 | } else { |
438 | return 0; /* do not try to enable tap too if raw failed */ | 438 | return 0; /* do not try to enable tap too if raw failed */ |
@@ -442,6 +442,38 @@ static int build_tap_transport_data(struct vector_private *vp) | |||
442 | return -1; | 442 | return -1; |
443 | } | 443 | } |
444 | 444 | ||
445 | static int build_tap_transport_data(struct vector_private *vp) | ||
446 | { | ||
447 | /* "Pure" tap uses the same fd for rx and tx */ | ||
448 | if (uml_tap_enable_vnet_headers(vp->fds->tx_fd)) { | ||
449 | vp->form_header = &raw_form_header; | ||
450 | vp->verify_header = &raw_verify_header; | ||
451 | vp->header_size = sizeof(struct virtio_net_hdr); | ||
452 | vp->rx_header_size = sizeof(struct virtio_net_hdr); | ||
453 | vp->dev->hw_features |= | ||
454 | (NETIF_F_TSO | NETIF_F_GSO | NETIF_F_GRO); | ||
455 | vp->dev->features |= | ||
456 | (NETIF_F_RXCSUM | NETIF_F_HW_CSUM | | ||
457 | NETIF_F_TSO | NETIF_F_GSO | NETIF_F_GRO); | ||
458 | netdev_info( | ||
459 | vp->dev, | ||
460 | "tap: using vnet headers for tso and tx/rx checksum" | ||
461 | ); | ||
462 | return 0; | ||
463 | } | ||
464 | return -1; | ||
465 | } | ||
466 | |||
467 | |||
468 | static int build_bess_transport_data(struct vector_private *vp) | ||
469 | { | ||
470 | vp->form_header = NULL; | ||
471 | vp->verify_header = NULL; | ||
472 | vp->header_size = 0; | ||
473 | vp->rx_header_size = 0; | ||
474 | return 0; | ||
475 | } | ||
476 | |||
445 | int build_transport_data(struct vector_private *vp) | 477 | int build_transport_data(struct vector_private *vp) |
446 | { | 478 | { |
447 | char *transport = uml_vector_fetch_arg(vp->parsed, "transport"); | 479 | char *transport = uml_vector_fetch_arg(vp->parsed, "transport"); |
@@ -454,6 +486,10 @@ int build_transport_data(struct vector_private *vp) | |||
454 | return build_raw_transport_data(vp); | 486 | return build_raw_transport_data(vp); |
455 | if (strncmp(transport, TRANS_TAP, TRANS_TAP_LEN) == 0) | 487 | if (strncmp(transport, TRANS_TAP, TRANS_TAP_LEN) == 0) |
456 | return build_tap_transport_data(vp); | 488 | return build_tap_transport_data(vp); |
489 | if (strncmp(transport, TRANS_HYBRID, TRANS_HYBRID_LEN) == 0) | ||
490 | return build_hybrid_transport_data(vp); | ||
491 | if (strncmp(transport, TRANS_BESS, TRANS_BESS_LEN) == 0) | ||
492 | return build_bess_transport_data(vp); | ||
457 | return 0; | 493 | return 0; |
458 | } | 494 | } |
459 | 495 | ||
diff --git a/arch/um/drivers/vector_user.c b/arch/um/drivers/vector_user.c index b3f7b3ca896d..e2c969b9f7ee 100644 --- a/arch/um/drivers/vector_user.c +++ b/arch/um/drivers/vector_user.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <stdio.h> | 6 | #include <stdio.h> |
@@ -17,6 +17,7 @@ | |||
17 | #include <sys/stat.h> | 17 | #include <sys/stat.h> |
18 | #include <fcntl.h> | 18 | #include <fcntl.h> |
19 | #include <sys/socket.h> | 19 | #include <sys/socket.h> |
20 | #include <sys/un.h> | ||
20 | #include <net/ethernet.h> | 21 | #include <net/ethernet.h> |
21 | #include <netinet/ip.h> | 22 | #include <netinet/ip.h> |
22 | #include <netinet/ether.h> | 23 | #include <netinet/ether.h> |
@@ -33,7 +34,8 @@ | |||
33 | 34 | ||
34 | #define ID_GRE 0 | 35 | #define ID_GRE 0 |
35 | #define ID_L2TPV3 1 | 36 | #define ID_L2TPV3 1 |
36 | #define ID_MAX 1 | 37 | #define ID_BESS 2 |
38 | #define ID_MAX 2 | ||
37 | 39 | ||
38 | #define TOKEN_IFNAME "ifname" | 40 | #define TOKEN_IFNAME "ifname" |
39 | 41 | ||
@@ -43,8 +45,11 @@ | |||
43 | #define VNET_HDR_FAIL "could not enable vnet headers on fd %d" | 45 | #define VNET_HDR_FAIL "could not enable vnet headers on fd %d" |
44 | #define TUN_GET_F_FAIL "tapraw: TUNGETFEATURES failed: %s" | 46 | #define TUN_GET_F_FAIL "tapraw: TUNGETFEATURES failed: %s" |
45 | #define L2TPV3_BIND_FAIL "l2tpv3_open : could not bind socket err=%i" | 47 | #define L2TPV3_BIND_FAIL "l2tpv3_open : could not bind socket err=%i" |
48 | #define UNIX_BIND_FAIL "unix_open : could not bind socket err=%i" | ||
46 | #define BPF_ATTACH_FAIL "Failed to attach filter size %d to %d, err %d\n" | 49 | #define BPF_ATTACH_FAIL "Failed to attach filter size %d to %d, err %d\n" |
47 | 50 | ||
51 | #define MAX_UN_LEN 107 | ||
52 | |||
48 | /* This is very ugly and brute force lookup, but it is done | 53 | /* This is very ugly and brute force lookup, but it is done |
49 | * only once at initialization so not worth doing hashes or | 54 | * only once at initialization so not worth doing hashes or |
50 | * anything more intelligent | 55 | * anything more intelligent |
@@ -114,12 +119,76 @@ cleanup: | |||
114 | 119 | ||
115 | #define PATH_NET_TUN "/dev/net/tun" | 120 | #define PATH_NET_TUN "/dev/net/tun" |
116 | 121 | ||
117 | static struct vector_fds *user_init_tap_fds(struct arglist *ifspec) | 122 | |
123 | static int create_tap_fd(char *iface) | ||
118 | { | 124 | { |
119 | struct ifreq ifr; | 125 | struct ifreq ifr; |
120 | int fd = -1; | 126 | int fd = -1; |
121 | struct sockaddr_ll sock; | ||
122 | int err = -ENOMEM, offload; | 127 | int err = -ENOMEM, offload; |
128 | |||
129 | fd = open(PATH_NET_TUN, O_RDWR); | ||
130 | if (fd < 0) { | ||
131 | printk(UM_KERN_ERR "uml_tap: failed to open tun device\n"); | ||
132 | goto tap_fd_cleanup; | ||
133 | } | ||
134 | memset(&ifr, 0, sizeof(ifr)); | ||
135 | ifr.ifr_flags = IFF_TAP | IFF_NO_PI | IFF_VNET_HDR; | ||
136 | strncpy((char *)&ifr.ifr_name, iface, sizeof(ifr.ifr_name) - 1); | ||
137 | |||
138 | err = ioctl(fd, TUNSETIFF, (void *) &ifr); | ||
139 | if (err != 0) { | ||
140 | printk(UM_KERN_ERR "uml_tap: failed to select tap interface\n"); | ||
141 | goto tap_fd_cleanup; | ||
142 | } | ||
143 | |||
144 | offload = TUN_F_CSUM | TUN_F_TSO4 | TUN_F_TSO6; | ||
145 | ioctl(fd, TUNSETOFFLOAD, offload); | ||
146 | return fd; | ||
147 | tap_fd_cleanup: | ||
148 | if (fd >= 0) | ||
149 | os_close_file(fd); | ||
150 | return err; | ||
151 | } | ||
152 | |||
153 | static int create_raw_fd(char *iface, int flags, int proto) | ||
154 | { | ||
155 | struct ifreq ifr; | ||
156 | int fd = -1; | ||
157 | struct sockaddr_ll sock; | ||
158 | int err = -ENOMEM; | ||
159 | |||
160 | fd = socket(AF_PACKET, SOCK_RAW, flags); | ||
161 | if (fd == -1) { | ||
162 | err = -errno; | ||
163 | goto raw_fd_cleanup; | ||
164 | } | ||
165 | memset(&ifr, 0, sizeof(ifr)); | ||
166 | strncpy((char *)&ifr.ifr_name, iface, sizeof(ifr.ifr_name) - 1); | ||
167 | if (ioctl(fd, SIOCGIFINDEX, (void *) &ifr) < 0) { | ||
168 | err = -errno; | ||
169 | goto raw_fd_cleanup; | ||
170 | } | ||
171 | |||
172 | sock.sll_family = AF_PACKET; | ||
173 | sock.sll_protocol = htons(proto); | ||
174 | sock.sll_ifindex = ifr.ifr_ifindex; | ||
175 | |||
176 | if (bind(fd, | ||
177 | (struct sockaddr *) &sock, sizeof(struct sockaddr_ll)) < 0) { | ||
178 | err = -errno; | ||
179 | goto raw_fd_cleanup; | ||
180 | } | ||
181 | return fd; | ||
182 | raw_fd_cleanup: | ||
183 | printk(UM_KERN_ERR "user_init_raw: init failed, error %d", err); | ||
184 | if (fd >= 0) | ||
185 | os_close_file(fd); | ||
186 | return err; | ||
187 | } | ||
188 | |||
189 | static struct vector_fds *user_init_tap_fds(struct arglist *ifspec) | ||
190 | { | ||
191 | int fd = -1; | ||
123 | char *iface; | 192 | char *iface; |
124 | struct vector_fds *result = NULL; | 193 | struct vector_fds *result = NULL; |
125 | 194 | ||
@@ -141,117 +210,167 @@ static struct vector_fds *user_init_tap_fds(struct arglist *ifspec) | |||
141 | 210 | ||
142 | /* TAP */ | 211 | /* TAP */ |
143 | 212 | ||
144 | fd = open(PATH_NET_TUN, O_RDWR); | 213 | fd = create_tap_fd(iface); |
145 | if (fd < 0) { | 214 | if (fd < 0) { |
146 | printk(UM_KERN_ERR "uml_tap: failed to open tun device\n"); | 215 | printk(UM_KERN_ERR "uml_tap: failed to create tun interface\n"); |
147 | goto tap_cleanup; | 216 | goto tap_cleanup; |
148 | } | 217 | } |
149 | result->tx_fd = fd; | 218 | result->tx_fd = fd; |
150 | memset(&ifr, 0, sizeof(ifr)); | 219 | result->rx_fd = fd; |
151 | ifr.ifr_flags = IFF_TAP | IFF_NO_PI | IFF_VNET_HDR; | 220 | return result; |
152 | strncpy((char *)&ifr.ifr_name, iface, sizeof(ifr.ifr_name) - 1); | 221 | tap_cleanup: |
222 | printk(UM_KERN_ERR "user_init_tap: init failed, error %d", fd); | ||
223 | if (result != NULL) | ||
224 | kfree(result); | ||
225 | return NULL; | ||
226 | } | ||
153 | 227 | ||
154 | err = ioctl(fd, TUNSETIFF, (void *) &ifr); | 228 | static struct vector_fds *user_init_hybrid_fds(struct arglist *ifspec) |
155 | if (err != 0) { | 229 | { |
156 | printk(UM_KERN_ERR "uml_tap: failed to select tap interface\n"); | 230 | char *iface; |
157 | goto tap_cleanup; | 231 | struct vector_fds *result = NULL; |
232 | |||
233 | iface = uml_vector_fetch_arg(ifspec, TOKEN_IFNAME); | ||
234 | if (iface == NULL) { | ||
235 | printk(UM_KERN_ERR "uml_tap: failed to parse interface spec\n"); | ||
236 | goto hybrid_cleanup; | ||
158 | } | 237 | } |
159 | 238 | ||
160 | offload = TUN_F_CSUM | TUN_F_TSO4 | TUN_F_TSO6; | 239 | result = uml_kmalloc(sizeof(struct vector_fds), UM_GFP_KERNEL); |
161 | ioctl(fd, TUNSETOFFLOAD, offload); | 240 | if (result == NULL) { |
241 | printk(UM_KERN_ERR "uml_tap: failed to allocate file descriptors\n"); | ||
242 | goto hybrid_cleanup; | ||
243 | } | ||
244 | result->rx_fd = -1; | ||
245 | result->tx_fd = -1; | ||
246 | result->remote_addr = NULL; | ||
247 | result->remote_addr_size = 0; | ||
248 | |||
249 | /* TAP */ | ||
250 | |||
251 | result->tx_fd = create_tap_fd(iface); | ||
252 | if (result->tx_fd < 0) { | ||
253 | printk(UM_KERN_ERR "uml_tap: failed to create tun interface: %i\n", result->tx_fd); | ||
254 | goto hybrid_cleanup; | ||
255 | } | ||
162 | 256 | ||
163 | /* RAW */ | 257 | /* RAW */ |
164 | 258 | ||
165 | fd = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL)); | 259 | result->rx_fd = create_raw_fd(iface, ETH_P_ALL, ETH_P_ALL); |
166 | if (fd == -1) { | 260 | if (result->rx_fd == -1) { |
167 | printk(UM_KERN_ERR | 261 | printk(UM_KERN_ERR |
168 | "uml_tap: failed to create socket: %i\n", -errno); | 262 | "uml_tap: failed to create paired raw socket: %i\n", result->rx_fd); |
169 | goto tap_cleanup; | 263 | goto hybrid_cleanup; |
170 | } | 264 | } |
171 | result->rx_fd = fd; | 265 | return result; |
172 | memset(&ifr, 0, sizeof(ifr)); | 266 | hybrid_cleanup: |
173 | strncpy((char *)&ifr.ifr_name, iface, sizeof(ifr.ifr_name) - 1); | 267 | printk(UM_KERN_ERR "user_init_hybrid: init failed"); |
174 | if (ioctl(fd, SIOCGIFINDEX, (void *) &ifr) < 0) { | 268 | if (result != NULL) |
175 | printk(UM_KERN_ERR | 269 | kfree(result); |
176 | "uml_tap: failed to set interface: %i\n", -errno); | 270 | return NULL; |
177 | goto tap_cleanup; | 271 | } |
272 | |||
273 | static struct vector_fds *user_init_unix_fds(struct arglist *ifspec, int id) | ||
274 | { | ||
275 | int fd = -1; | ||
276 | int socktype; | ||
277 | char *src, *dst; | ||
278 | struct vector_fds *result = NULL; | ||
279 | struct sockaddr_un *local_addr = NULL, *remote_addr = NULL; | ||
280 | |||
281 | src = uml_vector_fetch_arg(ifspec, "src"); | ||
282 | dst = uml_vector_fetch_arg(ifspec, "dst"); | ||
283 | result = uml_kmalloc(sizeof(struct vector_fds), UM_GFP_KERNEL); | ||
284 | if (result == NULL) { | ||
285 | printk(UM_KERN_ERR "unix open:cannot allocate remote addr"); | ||
286 | goto unix_cleanup; | ||
287 | } | ||
288 | remote_addr = uml_kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL); | ||
289 | if (remote_addr == NULL) { | ||
290 | printk(UM_KERN_ERR "unix open:cannot allocate remote addr"); | ||
291 | goto unix_cleanup; | ||
178 | } | 292 | } |
179 | 293 | ||
180 | sock.sll_family = AF_PACKET; | 294 | switch (id) { |
181 | sock.sll_protocol = htons(ETH_P_ALL); | 295 | case ID_BESS: |
182 | sock.sll_ifindex = ifr.ifr_ifindex; | 296 | socktype = SOCK_SEQPACKET; |
297 | if ((src != NULL) && (strlen(src) <= MAX_UN_LEN)) { | ||
298 | local_addr = uml_kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL); | ||
299 | if (local_addr == NULL) { | ||
300 | printk(UM_KERN_ERR "bess open:cannot allocate local addr"); | ||
301 | goto unix_cleanup; | ||
302 | } | ||
303 | local_addr->sun_family = AF_UNIX; | ||
304 | memcpy(local_addr->sun_path, src, strlen(src) + 1); | ||
305 | } | ||
306 | if ((dst == NULL) || (strlen(dst) > MAX_UN_LEN)) | ||
307 | goto unix_cleanup; | ||
308 | remote_addr->sun_family = AF_UNIX; | ||
309 | memcpy(remote_addr->sun_path, dst, strlen(dst) + 1); | ||
310 | break; | ||
311 | default: | ||
312 | printk(KERN_ERR "Unsupported unix socket type\n"); | ||
313 | return NULL; | ||
314 | } | ||
183 | 315 | ||
184 | if (bind(fd, | 316 | fd = socket(AF_UNIX, socktype, 0); |
185 | (struct sockaddr *) &sock, sizeof(struct sockaddr_ll)) < 0) { | 317 | if (fd == -1) { |
186 | printk(UM_KERN_ERR | 318 | printk(UM_KERN_ERR |
187 | "user_init_tap: failed to bind raw pair, err %d\n", | 319 | "unix open: could not open socket, error = %d", |
188 | -errno); | 320 | -errno |
189 | goto tap_cleanup; | 321 | ); |
322 | goto unix_cleanup; | ||
190 | } | 323 | } |
324 | if (local_addr != NULL) { | ||
325 | if (bind(fd, (struct sockaddr *) local_addr, sizeof(struct sockaddr_un))) { | ||
326 | printk(UM_KERN_ERR UNIX_BIND_FAIL, errno); | ||
327 | goto unix_cleanup; | ||
328 | } | ||
329 | } | ||
330 | switch (id) { | ||
331 | case ID_BESS: | ||
332 | if (connect(fd, remote_addr, sizeof(struct sockaddr_un)) < 0) { | ||
333 | printk(UM_KERN_ERR "bess open:cannot connect to %s %i", remote_addr->sun_path, -errno); | ||
334 | goto unix_cleanup; | ||
335 | } | ||
336 | break; | ||
337 | } | ||
338 | result->rx_fd = fd; | ||
339 | result->tx_fd = fd; | ||
340 | result->remote_addr_size = sizeof(struct sockaddr_un); | ||
341 | result->remote_addr = remote_addr; | ||
191 | return result; | 342 | return result; |
192 | tap_cleanup: | 343 | unix_cleanup: |
193 | printk(UM_KERN_ERR "user_init_tap: init failed, error %d", err); | 344 | if (fd >= 0) |
194 | if (result != NULL) { | 345 | os_close_file(fd); |
195 | if (result->rx_fd >= 0) | 346 | if (remote_addr != NULL) |
196 | os_close_file(result->rx_fd); | 347 | kfree(remote_addr); |
197 | if (result->tx_fd >= 0) | 348 | if (result != NULL) |
198 | os_close_file(result->tx_fd); | ||
199 | kfree(result); | 349 | kfree(result); |
200 | } | ||
201 | return NULL; | 350 | return NULL; |
202 | } | 351 | } |
203 | 352 | ||
204 | |||
205 | static struct vector_fds *user_init_raw_fds(struct arglist *ifspec) | 353 | static struct vector_fds *user_init_raw_fds(struct arglist *ifspec) |
206 | { | 354 | { |
207 | struct ifreq ifr; | ||
208 | int rxfd = -1, txfd = -1; | 355 | int rxfd = -1, txfd = -1; |
209 | struct sockaddr_ll sock; | ||
210 | int err = -ENOMEM; | 356 | int err = -ENOMEM; |
211 | char *iface; | 357 | char *iface; |
212 | struct vector_fds *result = NULL; | 358 | struct vector_fds *result = NULL; |
213 | 359 | ||
214 | iface = uml_vector_fetch_arg(ifspec, TOKEN_IFNAME); | 360 | iface = uml_vector_fetch_arg(ifspec, TOKEN_IFNAME); |
215 | if (iface == NULL) | 361 | if (iface == NULL) |
216 | goto cleanup; | 362 | goto raw_cleanup; |
217 | 363 | ||
218 | rxfd = socket(AF_PACKET, SOCK_RAW, ETH_P_ALL); | 364 | rxfd = create_raw_fd(iface, ETH_P_ALL, ETH_P_ALL); |
219 | if (rxfd == -1) { | 365 | if (rxfd == -1) { |
220 | err = -errno; | 366 | err = -errno; |
221 | goto cleanup; | 367 | goto raw_cleanup; |
222 | } | 368 | } |
223 | txfd = socket(AF_PACKET, SOCK_RAW, 0); /* Turn off RX on this fd */ | 369 | txfd = create_raw_fd(iface, 0, ETH_P_IP); /* Turn off RX on this fd */ |
224 | if (txfd == -1) { | 370 | if (txfd == -1) { |
225 | err = -errno; | 371 | err = -errno; |
226 | goto cleanup; | 372 | goto raw_cleanup; |
227 | } | 373 | } |
228 | memset(&ifr, 0, sizeof(ifr)); | ||
229 | strncpy((char *)&ifr.ifr_name, iface, sizeof(ifr.ifr_name) - 1); | ||
230 | if (ioctl(rxfd, SIOCGIFINDEX, (void *) &ifr) < 0) { | ||
231 | err = -errno; | ||
232 | goto cleanup; | ||
233 | } | ||
234 | |||
235 | sock.sll_family = AF_PACKET; | ||
236 | sock.sll_protocol = htons(ETH_P_ALL); | ||
237 | sock.sll_ifindex = ifr.ifr_ifindex; | ||
238 | |||
239 | if (bind(rxfd, | ||
240 | (struct sockaddr *) &sock, sizeof(struct sockaddr_ll)) < 0) { | ||
241 | err = -errno; | ||
242 | goto cleanup; | ||
243 | } | ||
244 | |||
245 | sock.sll_family = AF_PACKET; | ||
246 | sock.sll_protocol = htons(ETH_P_IP); | ||
247 | sock.sll_ifindex = ifr.ifr_ifindex; | ||
248 | |||
249 | if (bind(txfd, | ||
250 | (struct sockaddr *) &sock, sizeof(struct sockaddr_ll)) < 0) { | ||
251 | err = -errno; | ||
252 | goto cleanup; | ||
253 | } | ||
254 | |||
255 | result = uml_kmalloc(sizeof(struct vector_fds), UM_GFP_KERNEL); | 374 | result = uml_kmalloc(sizeof(struct vector_fds), UM_GFP_KERNEL); |
256 | if (result != NULL) { | 375 | if (result != NULL) { |
257 | result->rx_fd = rxfd; | 376 | result->rx_fd = rxfd; |
@@ -260,13 +379,10 @@ static struct vector_fds *user_init_raw_fds(struct arglist *ifspec) | |||
260 | result->remote_addr_size = 0; | 379 | result->remote_addr_size = 0; |
261 | } | 380 | } |
262 | return result; | 381 | return result; |
263 | cleanup: | 382 | raw_cleanup: |
264 | printk(UM_KERN_ERR "user_init_raw: init failed, error %d", err); | 383 | printk(UM_KERN_ERR "user_init_raw: init failed, error %d", err); |
265 | if (rxfd >= 0) | 384 | if (result != NULL) |
266 | os_close_file(rxfd); | 385 | kfree(result); |
267 | if (txfd >= 0) | ||
268 | os_close_file(txfd); | ||
269 | kfree(result); | ||
270 | return NULL; | 386 | return NULL; |
271 | } | 387 | } |
272 | 388 | ||
@@ -456,12 +572,16 @@ struct vector_fds *uml_vector_user_open( | |||
456 | } | 572 | } |
457 | if (strncmp(transport, TRANS_RAW, TRANS_RAW_LEN) == 0) | 573 | if (strncmp(transport, TRANS_RAW, TRANS_RAW_LEN) == 0) |
458 | return user_init_raw_fds(parsed); | 574 | return user_init_raw_fds(parsed); |
575 | if (strncmp(transport, TRANS_HYBRID, TRANS_HYBRID_LEN) == 0) | ||
576 | return user_init_hybrid_fds(parsed); | ||
459 | if (strncmp(transport, TRANS_TAP, TRANS_TAP_LEN) == 0) | 577 | if (strncmp(transport, TRANS_TAP, TRANS_TAP_LEN) == 0) |
460 | return user_init_tap_fds(parsed); | 578 | return user_init_tap_fds(parsed); |
461 | if (strncmp(transport, TRANS_GRE, TRANS_GRE_LEN) == 0) | 579 | if (strncmp(transport, TRANS_GRE, TRANS_GRE_LEN) == 0) |
462 | return user_init_socket_fds(parsed, ID_GRE); | 580 | return user_init_socket_fds(parsed, ID_GRE); |
463 | if (strncmp(transport, TRANS_L2TPV3, TRANS_L2TPV3_LEN) == 0) | 581 | if (strncmp(transport, TRANS_L2TPV3, TRANS_L2TPV3_LEN) == 0) |
464 | return user_init_socket_fds(parsed, ID_L2TPV3); | 582 | return user_init_socket_fds(parsed, ID_L2TPV3); |
583 | if (strncmp(transport, TRANS_BESS, TRANS_BESS_LEN) == 0) | ||
584 | return user_init_unix_fds(parsed, ID_BESS); | ||
465 | return NULL; | 585 | return NULL; |
466 | } | 586 | } |
467 | 587 | ||
@@ -482,8 +602,9 @@ int uml_vector_sendmsg(int fd, void *hdr, int flags) | |||
482 | int uml_vector_recvmsg(int fd, void *hdr, int flags) | 602 | int uml_vector_recvmsg(int fd, void *hdr, int flags) |
483 | { | 603 | { |
484 | int n; | 604 | int n; |
605 | struct msghdr *msg = (struct msghdr *) hdr; | ||
485 | 606 | ||
486 | CATCH_EINTR(n = recvmsg(fd, (struct msghdr *) hdr, flags)); | 607 | CATCH_EINTR(n = readv(fd, msg->msg_iov, msg->msg_iovlen)); |
487 | if ((n < 0) && (errno == EAGAIN)) | 608 | if ((n < 0) && (errno == EAGAIN)) |
488 | return 0; | 609 | return 0; |
489 | if (n >= 0) | 610 | if (n >= 0) |
@@ -497,7 +618,7 @@ int uml_vector_writev(int fd, void *hdr, int iovcount) | |||
497 | int n; | 618 | int n; |
498 | 619 | ||
499 | CATCH_EINTR(n = writev(fd, (struct iovec *) hdr, iovcount)); | 620 | CATCH_EINTR(n = writev(fd, (struct iovec *) hdr, iovcount)); |
500 | if ((n < 0) && (errno == EAGAIN)) | 621 | if ((n < 0) && ((errno == EAGAIN) || (errno == ENOBUFS))) |
501 | return 0; | 622 | return 0; |
502 | if (n >= 0) | 623 | if (n >= 0) |
503 | return n; | 624 | return n; |
@@ -514,7 +635,7 @@ int uml_vector_sendmmsg( | |||
514 | int n; | 635 | int n; |
515 | 636 | ||
516 | CATCH_EINTR(n = sendmmsg(fd, (struct mmsghdr *) msgvec, vlen, flags)); | 637 | CATCH_EINTR(n = sendmmsg(fd, (struct mmsghdr *) msgvec, vlen, flags)); |
517 | if ((n < 0) && (errno == EAGAIN)) | 638 | if ((n < 0) && ((errno == EAGAIN) || (errno == ENOBUFS))) |
518 | return 0; | 639 | return 0; |
519 | if (n >= 0) | 640 | if (n >= 0) |
520 | return n; | 641 | return n; |
diff --git a/arch/um/drivers/vector_user.h b/arch/um/drivers/vector_user.h index d7cbff73b7ff..649ec250268b 100644 --- a/arch/um/drivers/vector_user.h +++ b/arch/um/drivers/vector_user.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2002 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __UM_VECTOR_USER_H | 6 | #ifndef __UM_VECTOR_USER_H |
@@ -16,13 +16,18 @@ | |||
16 | #define TRANS_TAP "tap" | 16 | #define TRANS_TAP "tap" |
17 | #define TRANS_TAP_LEN strlen(TRANS_TAP) | 17 | #define TRANS_TAP_LEN strlen(TRANS_TAP) |
18 | 18 | ||
19 | |||
20 | #define TRANS_GRE "gre" | 19 | #define TRANS_GRE "gre" |
21 | #define TRANS_GRE_LEN strlen(TRANS_RAW) | 20 | #define TRANS_GRE_LEN strlen(TRANS_RAW) |
22 | 21 | ||
23 | #define TRANS_L2TPV3 "l2tpv3" | 22 | #define TRANS_L2TPV3 "l2tpv3" |
24 | #define TRANS_L2TPV3_LEN strlen(TRANS_L2TPV3) | 23 | #define TRANS_L2TPV3_LEN strlen(TRANS_L2TPV3) |
25 | 24 | ||
25 | #define TRANS_HYBRID "hybrid" | ||
26 | #define TRANS_HYBRID_LEN strlen(TRANS_HYBRID) | ||
27 | |||
28 | #define TRANS_BESS "bess" | ||
29 | #define TRANS_BESS_LEN strlen(TRANS_BESS) | ||
30 | |||
26 | #ifndef IPPROTO_GRE | 31 | #ifndef IPPROTO_GRE |
27 | #define IPPROTO_GRE 0x2F | 32 | #define IPPROTO_GRE 0x2F |
28 | #endif | 33 | #endif |
diff --git a/arch/um/drivers/vhost_user.h b/arch/um/drivers/vhost_user.h new file mode 100644 index 000000000000..45ff5ea22fea --- /dev/null +++ b/arch/um/drivers/vhost_user.h | |||
@@ -0,0 +1,117 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
2 | /* Vhost-user protocol */ | ||
3 | |||
4 | #ifndef __VHOST_USER_H__ | ||
5 | #define __VHOST_USER_H__ | ||
6 | |||
7 | /* Message flags */ | ||
8 | #define VHOST_USER_FLAG_REPLY BIT(2) | ||
9 | #define VHOST_USER_FLAG_NEED_REPLY BIT(3) | ||
10 | /* Feature bits */ | ||
11 | #define VHOST_USER_F_PROTOCOL_FEATURES 30 | ||
12 | /* Protocol feature bits */ | ||
13 | #define VHOST_USER_PROTOCOL_F_REPLY_ACK 3 | ||
14 | #define VHOST_USER_PROTOCOL_F_SLAVE_REQ 5 | ||
15 | #define VHOST_USER_PROTOCOL_F_CONFIG 9 | ||
16 | /* Vring state index masks */ | ||
17 | #define VHOST_USER_VRING_INDEX_MASK 0xff | ||
18 | #define VHOST_USER_VRING_POLL_MASK BIT(8) | ||
19 | |||
20 | /* Supported version */ | ||
21 | #define VHOST_USER_VERSION 1 | ||
22 | /* Supported transport features */ | ||
23 | #define VHOST_USER_SUPPORTED_F BIT_ULL(VHOST_USER_F_PROTOCOL_FEATURES) | ||
24 | /* Supported protocol features */ | ||
25 | #define VHOST_USER_SUPPORTED_PROTOCOL_F (BIT_ULL(VHOST_USER_PROTOCOL_F_REPLY_ACK) | \ | ||
26 | BIT_ULL(VHOST_USER_PROTOCOL_F_SLAVE_REQ) | \ | ||
27 | BIT_ULL(VHOST_USER_PROTOCOL_F_CONFIG)) | ||
28 | |||
29 | enum vhost_user_request { | ||
30 | VHOST_USER_GET_FEATURES = 1, | ||
31 | VHOST_USER_SET_FEATURES = 2, | ||
32 | VHOST_USER_SET_OWNER = 3, | ||
33 | VHOST_USER_RESET_OWNER = 4, | ||
34 | VHOST_USER_SET_MEM_TABLE = 5, | ||
35 | VHOST_USER_SET_LOG_BASE = 6, | ||
36 | VHOST_USER_SET_LOG_FD = 7, | ||
37 | VHOST_USER_SET_VRING_NUM = 8, | ||
38 | VHOST_USER_SET_VRING_ADDR = 9, | ||
39 | VHOST_USER_SET_VRING_BASE = 10, | ||
40 | VHOST_USER_GET_VRING_BASE = 11, | ||
41 | VHOST_USER_SET_VRING_KICK = 12, | ||
42 | VHOST_USER_SET_VRING_CALL = 13, | ||
43 | VHOST_USER_SET_VRING_ERR = 14, | ||
44 | VHOST_USER_GET_PROTOCOL_FEATURES = 15, | ||
45 | VHOST_USER_SET_PROTOCOL_FEATURES = 16, | ||
46 | VHOST_USER_GET_QUEUE_NUM = 17, | ||
47 | VHOST_USER_SET_VRING_ENABLE = 18, | ||
48 | VHOST_USER_SEND_RARP = 19, | ||
49 | VHOST_USER_NET_SEND_MTU = 20, | ||
50 | VHOST_USER_SET_SLAVE_REQ_FD = 21, | ||
51 | VHOST_USER_IOTLB_MSG = 22, | ||
52 | VHOST_USER_SET_VRING_ENDIAN = 23, | ||
53 | VHOST_USER_GET_CONFIG = 24, | ||
54 | VHOST_USER_SET_CONFIG = 25, | ||
55 | }; | ||
56 | |||
57 | enum vhost_user_slave_request { | ||
58 | VHOST_USER_SLAVE_IOTLB_MSG = 1, | ||
59 | VHOST_USER_SLAVE_CONFIG_CHANGE_MSG = 2, | ||
60 | VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG = 3, | ||
61 | }; | ||
62 | |||
63 | struct vhost_user_header { | ||
64 | /* | ||
65 | * Use enum vhost_user_request for outgoing messages, | ||
66 | * uses enum vhost_user_slave_request for incoming ones. | ||
67 | */ | ||
68 | u32 request; | ||
69 | u32 flags; | ||
70 | u32 size; | ||
71 | } __packed; | ||
72 | |||
73 | struct vhost_user_config { | ||
74 | u32 offset; | ||
75 | u32 size; | ||
76 | u32 flags; | ||
77 | u8 payload[0]; /* Variable length */ | ||
78 | } __packed; | ||
79 | |||
80 | struct vhost_user_vring_state { | ||
81 | u32 index; | ||
82 | u32 num; | ||
83 | } __packed; | ||
84 | |||
85 | struct vhost_user_vring_addr { | ||
86 | u32 index; | ||
87 | u32 flags; | ||
88 | u64 desc, used, avail, log; | ||
89 | } __packed; | ||
90 | |||
91 | struct vhost_user_mem_region { | ||
92 | u64 guest_addr; | ||
93 | u64 size; | ||
94 | u64 user_addr; | ||
95 | u64 mmap_offset; | ||
96 | } __packed; | ||
97 | |||
98 | struct vhost_user_mem_regions { | ||
99 | u32 num; | ||
100 | u32 padding; | ||
101 | struct vhost_user_mem_region regions[2]; /* Currently supporting 2 */ | ||
102 | } __packed; | ||
103 | |||
104 | union vhost_user_payload { | ||
105 | u64 integer; | ||
106 | struct vhost_user_config config; | ||
107 | struct vhost_user_vring_state vring_state; | ||
108 | struct vhost_user_vring_addr vring_addr; | ||
109 | struct vhost_user_mem_regions mem_regions; | ||
110 | }; | ||
111 | |||
112 | struct vhost_user_msg { | ||
113 | struct vhost_user_header header; | ||
114 | union vhost_user_payload payload; | ||
115 | } __packed; | ||
116 | |||
117 | #endif | ||
diff --git a/arch/um/drivers/virtio_uml.c b/arch/um/drivers/virtio_uml.c new file mode 100644 index 000000000000..fc8c52cff5aa --- /dev/null +++ b/arch/um/drivers/virtio_uml.c | |||
@@ -0,0 +1,1177 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
2 | /* | ||
3 | * Virtio vhost-user driver | ||
4 | * | ||
5 | * Copyright(c) 2019 Intel Corporation | ||
6 | * | ||
7 | * This module allows virtio devices to be used over a vhost-user socket. | ||
8 | * | ||
9 | * Guest devices can be instantiated by kernel module or command line | ||
10 | * parameters. One device will be created for each parameter. Syntax: | ||
11 | * | ||
12 | * [virtio_uml.]device=<socket>:<virtio_id>[:<platform_id>] | ||
13 | * where: | ||
14 | * <socket> := vhost-user socket path to connect | ||
15 | * <virtio_id> := virtio device id (as in virtio_ids.h) | ||
16 | * <platform_id> := (optional) platform device id | ||
17 | * | ||
18 | * example: | ||
19 | * virtio_uml.device=/var/uml.socket:1 | ||
20 | * | ||
21 | * Based on Virtio MMIO driver by Pawel Moll, copyright 2011-2014, ARM Ltd. | ||
22 | */ | ||
23 | #include <linux/module.h> | ||
24 | #include <linux/platform_device.h> | ||
25 | #include <linux/slab.h> | ||
26 | #include <linux/virtio.h> | ||
27 | #include <linux/virtio_config.h> | ||
28 | #include <linux/virtio_ring.h> | ||
29 | #include <shared/as-layout.h> | ||
30 | #include <irq_kern.h> | ||
31 | #include <init.h> | ||
32 | #include <os.h> | ||
33 | #include "vhost_user.h" | ||
34 | |||
35 | /* Workaround due to a conflict between irq_user.h and irqreturn.h */ | ||
36 | #ifdef IRQ_NONE | ||
37 | #undef IRQ_NONE | ||
38 | #endif | ||
39 | |||
40 | #define MAX_SUPPORTED_QUEUE_SIZE 256 | ||
41 | |||
42 | #define to_virtio_uml_device(_vdev) \ | ||
43 | container_of(_vdev, struct virtio_uml_device, vdev) | ||
44 | |||
45 | struct virtio_uml_device { | ||
46 | struct virtio_device vdev; | ||
47 | struct platform_device *pdev; | ||
48 | |||
49 | int sock, req_fd; | ||
50 | u64 features; | ||
51 | u64 protocol_features; | ||
52 | u8 status; | ||
53 | }; | ||
54 | |||
55 | struct virtio_uml_vq_info { | ||
56 | int kick_fd, call_fd; | ||
57 | char name[32]; | ||
58 | }; | ||
59 | |||
60 | extern unsigned long long physmem_size, highmem; | ||
61 | |||
62 | #define vu_err(vu_dev, ...) dev_err(&(vu_dev)->pdev->dev, __VA_ARGS__) | ||
63 | |||
64 | /* Vhost-user protocol */ | ||
65 | |||
66 | static int full_sendmsg_fds(int fd, const void *buf, unsigned int len, | ||
67 | const int *fds, unsigned int fds_num) | ||
68 | { | ||
69 | int rc; | ||
70 | |||
71 | do { | ||
72 | rc = os_sendmsg_fds(fd, buf, len, fds, fds_num); | ||
73 | if (rc > 0) { | ||
74 | buf += rc; | ||
75 | len -= rc; | ||
76 | fds = NULL; | ||
77 | fds_num = 0; | ||
78 | } | ||
79 | } while (len && (rc >= 0 || rc == -EINTR)); | ||
80 | |||
81 | if (rc < 0) | ||
82 | return rc; | ||
83 | return 0; | ||
84 | } | ||
85 | |||
86 | static int full_read(int fd, void *buf, int len) | ||
87 | { | ||
88 | int rc; | ||
89 | |||
90 | do { | ||
91 | rc = os_read_file(fd, buf, len); | ||
92 | if (rc > 0) { | ||
93 | buf += rc; | ||
94 | len -= rc; | ||
95 | } | ||
96 | } while (len && (rc > 0 || rc == -EINTR)); | ||
97 | |||
98 | if (rc < 0) | ||
99 | return rc; | ||
100 | if (rc == 0) | ||
101 | return -ECONNRESET; | ||
102 | return 0; | ||
103 | } | ||
104 | |||
105 | static int vhost_user_recv_header(int fd, struct vhost_user_msg *msg) | ||
106 | { | ||
107 | return full_read(fd, msg, sizeof(msg->header)); | ||
108 | } | ||
109 | |||
110 | static int vhost_user_recv(int fd, struct vhost_user_msg *msg, | ||
111 | size_t max_payload_size) | ||
112 | { | ||
113 | size_t size; | ||
114 | int rc = vhost_user_recv_header(fd, msg); | ||
115 | |||
116 | if (rc) | ||
117 | return rc; | ||
118 | size = msg->header.size; | ||
119 | if (size > max_payload_size) | ||
120 | return -EPROTO; | ||
121 | return full_read(fd, &msg->payload, size); | ||
122 | } | ||
123 | |||
124 | static int vhost_user_recv_resp(struct virtio_uml_device *vu_dev, | ||
125 | struct vhost_user_msg *msg, | ||
126 | size_t max_payload_size) | ||
127 | { | ||
128 | int rc = vhost_user_recv(vu_dev->sock, msg, max_payload_size); | ||
129 | |||
130 | if (rc) | ||
131 | return rc; | ||
132 | |||
133 | if (msg->header.flags != (VHOST_USER_FLAG_REPLY | VHOST_USER_VERSION)) | ||
134 | return -EPROTO; | ||
135 | |||
136 | return 0; | ||
137 | } | ||
138 | |||
139 | static int vhost_user_recv_u64(struct virtio_uml_device *vu_dev, | ||
140 | u64 *value) | ||
141 | { | ||
142 | struct vhost_user_msg msg; | ||
143 | int rc = vhost_user_recv_resp(vu_dev, &msg, | ||
144 | sizeof(msg.payload.integer)); | ||
145 | |||
146 | if (rc) | ||
147 | return rc; | ||
148 | if (msg.header.size != sizeof(msg.payload.integer)) | ||
149 | return -EPROTO; | ||
150 | *value = msg.payload.integer; | ||
151 | return 0; | ||
152 | } | ||
153 | |||
154 | static int vhost_user_recv_req(struct virtio_uml_device *vu_dev, | ||
155 | struct vhost_user_msg *msg, | ||
156 | size_t max_payload_size) | ||
157 | { | ||
158 | int rc = vhost_user_recv(vu_dev->req_fd, msg, max_payload_size); | ||
159 | |||
160 | if (rc) | ||
161 | return rc; | ||
162 | |||
163 | if ((msg->header.flags & ~VHOST_USER_FLAG_NEED_REPLY) != | ||
164 | VHOST_USER_VERSION) | ||
165 | return -EPROTO; | ||
166 | |||
167 | return 0; | ||
168 | } | ||
169 | |||
170 | static int vhost_user_send(struct virtio_uml_device *vu_dev, | ||
171 | bool need_response, struct vhost_user_msg *msg, | ||
172 | int *fds, size_t num_fds) | ||
173 | { | ||
174 | size_t size = sizeof(msg->header) + msg->header.size; | ||
175 | bool request_ack; | ||
176 | int rc; | ||
177 | |||
178 | msg->header.flags |= VHOST_USER_VERSION; | ||
179 | |||
180 | /* | ||
181 | * The need_response flag indicates that we already need a response, | ||
182 | * e.g. to read the features. In these cases, don't request an ACK as | ||
183 | * it is meaningless. Also request an ACK only if supported. | ||
184 | */ | ||
185 | request_ack = !need_response; | ||
186 | if (!(vu_dev->protocol_features & | ||
187 | BIT_ULL(VHOST_USER_PROTOCOL_F_REPLY_ACK))) | ||
188 | request_ack = false; | ||
189 | |||
190 | if (request_ack) | ||
191 | msg->header.flags |= VHOST_USER_FLAG_NEED_REPLY; | ||
192 | |||
193 | rc = full_sendmsg_fds(vu_dev->sock, msg, size, fds, num_fds); | ||
194 | if (rc < 0) | ||
195 | return rc; | ||
196 | |||
197 | if (request_ack) { | ||
198 | uint64_t status; | ||
199 | |||
200 | rc = vhost_user_recv_u64(vu_dev, &status); | ||
201 | if (rc) | ||
202 | return rc; | ||
203 | |||
204 | if (status) { | ||
205 | vu_err(vu_dev, "slave reports error: %llu\n", status); | ||
206 | return -EIO; | ||
207 | } | ||
208 | } | ||
209 | |||
210 | return 0; | ||
211 | } | ||
212 | |||
213 | static int vhost_user_send_no_payload(struct virtio_uml_device *vu_dev, | ||
214 | bool need_response, u32 request) | ||
215 | { | ||
216 | struct vhost_user_msg msg = { | ||
217 | .header.request = request, | ||
218 | }; | ||
219 | |||
220 | return vhost_user_send(vu_dev, need_response, &msg, NULL, 0); | ||
221 | } | ||
222 | |||
223 | static int vhost_user_send_no_payload_fd(struct virtio_uml_device *vu_dev, | ||
224 | u32 request, int fd) | ||
225 | { | ||
226 | struct vhost_user_msg msg = { | ||
227 | .header.request = request, | ||
228 | }; | ||
229 | |||
230 | return vhost_user_send(vu_dev, false, &msg, &fd, 1); | ||
231 | } | ||
232 | |||
233 | static int vhost_user_send_u64(struct virtio_uml_device *vu_dev, | ||
234 | u32 request, u64 value) | ||
235 | { | ||
236 | struct vhost_user_msg msg = { | ||
237 | .header.request = request, | ||
238 | .header.size = sizeof(msg.payload.integer), | ||
239 | .payload.integer = value, | ||
240 | }; | ||
241 | |||
242 | return vhost_user_send(vu_dev, false, &msg, NULL, 0); | ||
243 | } | ||
244 | |||
245 | static int vhost_user_set_owner(struct virtio_uml_device *vu_dev) | ||
246 | { | ||
247 | return vhost_user_send_no_payload(vu_dev, false, VHOST_USER_SET_OWNER); | ||
248 | } | ||
249 | |||
250 | static int vhost_user_get_features(struct virtio_uml_device *vu_dev, | ||
251 | u64 *features) | ||
252 | { | ||
253 | int rc = vhost_user_send_no_payload(vu_dev, true, | ||
254 | VHOST_USER_GET_FEATURES); | ||
255 | |||
256 | if (rc) | ||
257 | return rc; | ||
258 | return vhost_user_recv_u64(vu_dev, features); | ||
259 | } | ||
260 | |||
261 | static int vhost_user_set_features(struct virtio_uml_device *vu_dev, | ||
262 | u64 features) | ||
263 | { | ||
264 | return vhost_user_send_u64(vu_dev, VHOST_USER_SET_FEATURES, features); | ||
265 | } | ||
266 | |||
267 | static int vhost_user_get_protocol_features(struct virtio_uml_device *vu_dev, | ||
268 | u64 *protocol_features) | ||
269 | { | ||
270 | int rc = vhost_user_send_no_payload(vu_dev, true, | ||
271 | VHOST_USER_GET_PROTOCOL_FEATURES); | ||
272 | |||
273 | if (rc) | ||
274 | return rc; | ||
275 | return vhost_user_recv_u64(vu_dev, protocol_features); | ||
276 | } | ||
277 | |||
278 | static int vhost_user_set_protocol_features(struct virtio_uml_device *vu_dev, | ||
279 | u64 protocol_features) | ||
280 | { | ||
281 | return vhost_user_send_u64(vu_dev, VHOST_USER_SET_PROTOCOL_FEATURES, | ||
282 | protocol_features); | ||
283 | } | ||
284 | |||
285 | static void vhost_user_reply(struct virtio_uml_device *vu_dev, | ||
286 | struct vhost_user_msg *msg, int response) | ||
287 | { | ||
288 | struct vhost_user_msg reply = { | ||
289 | .payload.integer = response, | ||
290 | }; | ||
291 | size_t size = sizeof(reply.header) + sizeof(reply.payload.integer); | ||
292 | int rc; | ||
293 | |||
294 | reply.header = msg->header; | ||
295 | reply.header.flags &= ~VHOST_USER_FLAG_NEED_REPLY; | ||
296 | reply.header.flags |= VHOST_USER_FLAG_REPLY; | ||
297 | reply.header.size = sizeof(reply.payload.integer); | ||
298 | |||
299 | rc = full_sendmsg_fds(vu_dev->req_fd, &reply, size, NULL, 0); | ||
300 | |||
301 | if (rc) | ||
302 | vu_err(vu_dev, | ||
303 | "sending reply to slave request failed: %d (size %zu)\n", | ||
304 | rc, size); | ||
305 | } | ||
306 | |||
307 | static irqreturn_t vu_req_interrupt(int irq, void *data) | ||
308 | { | ||
309 | struct virtio_uml_device *vu_dev = data; | ||
310 | int response = 1; | ||
311 | struct { | ||
312 | struct vhost_user_msg msg; | ||
313 | u8 extra_payload[512]; | ||
314 | } msg; | ||
315 | int rc; | ||
316 | |||
317 | rc = vhost_user_recv_req(vu_dev, &msg.msg, | ||
318 | sizeof(msg.msg.payload) + | ||
319 | sizeof(msg.extra_payload)); | ||
320 | |||
321 | if (rc) | ||
322 | return IRQ_NONE; | ||
323 | |||
324 | switch (msg.msg.header.request) { | ||
325 | case VHOST_USER_SLAVE_CONFIG_CHANGE_MSG: | ||
326 | virtio_config_changed(&vu_dev->vdev); | ||
327 | response = 0; | ||
328 | break; | ||
329 | case VHOST_USER_SLAVE_IOTLB_MSG: | ||
330 | /* not supported - VIRTIO_F_IOMMU_PLATFORM */ | ||
331 | case VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG: | ||
332 | /* not supported - VHOST_USER_PROTOCOL_F_HOST_NOTIFIER */ | ||
333 | default: | ||
334 | vu_err(vu_dev, "unexpected slave request %d\n", | ||
335 | msg.msg.header.request); | ||
336 | } | ||
337 | |||
338 | if (msg.msg.header.flags & VHOST_USER_FLAG_NEED_REPLY) | ||
339 | vhost_user_reply(vu_dev, &msg.msg, response); | ||
340 | |||
341 | return IRQ_HANDLED; | ||
342 | } | ||
343 | |||
344 | static int vhost_user_init_slave_req(struct virtio_uml_device *vu_dev) | ||
345 | { | ||
346 | int rc, req_fds[2]; | ||
347 | |||
348 | /* Use a pipe for slave req fd, SIGIO is not supported for eventfd */ | ||
349 | rc = os_pipe(req_fds, true, true); | ||
350 | if (rc < 0) | ||
351 | return rc; | ||
352 | vu_dev->req_fd = req_fds[0]; | ||
353 | |||
354 | rc = um_request_irq(VIRTIO_IRQ, vu_dev->req_fd, IRQ_READ, | ||
355 | vu_req_interrupt, IRQF_SHARED, | ||
356 | vu_dev->pdev->name, vu_dev); | ||
357 | if (rc) | ||
358 | goto err_close; | ||
359 | |||
360 | rc = vhost_user_send_no_payload_fd(vu_dev, VHOST_USER_SET_SLAVE_REQ_FD, | ||
361 | req_fds[1]); | ||
362 | if (rc) | ||
363 | goto err_free_irq; | ||
364 | |||
365 | goto out; | ||
366 | |||
367 | err_free_irq: | ||
368 | um_free_irq(VIRTIO_IRQ, vu_dev); | ||
369 | err_close: | ||
370 | os_close_file(req_fds[0]); | ||
371 | out: | ||
372 | /* Close unused write end of request fds */ | ||
373 | os_close_file(req_fds[1]); | ||
374 | return rc; | ||
375 | } | ||
376 | |||
377 | static int vhost_user_init(struct virtio_uml_device *vu_dev) | ||
378 | { | ||
379 | int rc = vhost_user_set_owner(vu_dev); | ||
380 | |||
381 | if (rc) | ||
382 | return rc; | ||
383 | rc = vhost_user_get_features(vu_dev, &vu_dev->features); | ||
384 | if (rc) | ||
385 | return rc; | ||
386 | |||
387 | if (vu_dev->features & BIT_ULL(VHOST_USER_F_PROTOCOL_FEATURES)) { | ||
388 | rc = vhost_user_get_protocol_features(vu_dev, | ||
389 | &vu_dev->protocol_features); | ||
390 | if (rc) | ||
391 | return rc; | ||
392 | vu_dev->protocol_features &= VHOST_USER_SUPPORTED_PROTOCOL_F; | ||
393 | rc = vhost_user_set_protocol_features(vu_dev, | ||
394 | vu_dev->protocol_features); | ||
395 | if (rc) | ||
396 | return rc; | ||
397 | } | ||
398 | |||
399 | if (vu_dev->protocol_features & | ||
400 | BIT_ULL(VHOST_USER_PROTOCOL_F_SLAVE_REQ)) { | ||
401 | rc = vhost_user_init_slave_req(vu_dev); | ||
402 | if (rc) | ||
403 | return rc; | ||
404 | } | ||
405 | |||
406 | return 0; | ||
407 | } | ||
408 | |||
409 | static void vhost_user_get_config(struct virtio_uml_device *vu_dev, | ||
410 | u32 offset, void *buf, u32 len) | ||
411 | { | ||
412 | u32 cfg_size = offset + len; | ||
413 | struct vhost_user_msg *msg; | ||
414 | size_t payload_size = sizeof(msg->payload.config) + cfg_size; | ||
415 | size_t msg_size = sizeof(msg->header) + payload_size; | ||
416 | int rc; | ||
417 | |||
418 | if (!(vu_dev->protocol_features & | ||
419 | BIT_ULL(VHOST_USER_PROTOCOL_F_CONFIG))) | ||
420 | return; | ||
421 | |||
422 | msg = kzalloc(msg_size, GFP_KERNEL); | ||
423 | if (!msg) | ||
424 | return; | ||
425 | msg->header.request = VHOST_USER_GET_CONFIG; | ||
426 | msg->header.size = payload_size; | ||
427 | msg->payload.config.offset = 0; | ||
428 | msg->payload.config.size = cfg_size; | ||
429 | |||
430 | rc = vhost_user_send(vu_dev, true, msg, NULL, 0); | ||
431 | if (rc) { | ||
432 | vu_err(vu_dev, "sending VHOST_USER_GET_CONFIG failed: %d\n", | ||
433 | rc); | ||
434 | goto free; | ||
435 | } | ||
436 | |||
437 | rc = vhost_user_recv_resp(vu_dev, msg, msg_size); | ||
438 | if (rc) { | ||
439 | vu_err(vu_dev, | ||
440 | "receiving VHOST_USER_GET_CONFIG response failed: %d\n", | ||
441 | rc); | ||
442 | goto free; | ||
443 | } | ||
444 | |||
445 | if (msg->header.size != payload_size || | ||
446 | msg->payload.config.size != cfg_size) { | ||
447 | rc = -EPROTO; | ||
448 | vu_err(vu_dev, | ||
449 | "Invalid VHOST_USER_GET_CONFIG sizes (payload %d expected %zu, config %u expected %u)\n", | ||
450 | msg->header.size, payload_size, | ||
451 | msg->payload.config.size, cfg_size); | ||
452 | goto free; | ||
453 | } | ||
454 | memcpy(buf, msg->payload.config.payload + offset, len); | ||
455 | |||
456 | free: | ||
457 | kfree(msg); | ||
458 | } | ||
459 | |||
460 | static void vhost_user_set_config(struct virtio_uml_device *vu_dev, | ||
461 | u32 offset, const void *buf, u32 len) | ||
462 | { | ||
463 | struct vhost_user_msg *msg; | ||
464 | size_t payload_size = sizeof(msg->payload.config) + len; | ||
465 | size_t msg_size = sizeof(msg->header) + payload_size; | ||
466 | int rc; | ||
467 | |||
468 | if (!(vu_dev->protocol_features & | ||
469 | BIT_ULL(VHOST_USER_PROTOCOL_F_CONFIG))) | ||
470 | return; | ||
471 | |||
472 | msg = kzalloc(msg_size, GFP_KERNEL); | ||
473 | if (!msg) | ||
474 | return; | ||
475 | msg->header.request = VHOST_USER_SET_CONFIG; | ||
476 | msg->header.size = payload_size; | ||
477 | msg->payload.config.offset = offset; | ||
478 | msg->payload.config.size = len; | ||
479 | memcpy(msg->payload.config.payload, buf, len); | ||
480 | |||
481 | rc = vhost_user_send(vu_dev, false, msg, NULL, 0); | ||
482 | if (rc) | ||
483 | vu_err(vu_dev, "sending VHOST_USER_SET_CONFIG failed: %d\n", | ||
484 | rc); | ||
485 | |||
486 | kfree(msg); | ||
487 | } | ||
488 | |||
489 | static int vhost_user_init_mem_region(u64 addr, u64 size, int *fd_out, | ||
490 | struct vhost_user_mem_region *region_out) | ||
491 | { | ||
492 | unsigned long long mem_offset; | ||
493 | int rc = phys_mapping(addr, &mem_offset); | ||
494 | |||
495 | if (WARN(rc < 0, "phys_mapping of 0x%llx returned %d\n", addr, rc)) | ||
496 | return -EFAULT; | ||
497 | *fd_out = rc; | ||
498 | region_out->guest_addr = addr; | ||
499 | region_out->user_addr = addr; | ||
500 | region_out->size = size; | ||
501 | region_out->mmap_offset = mem_offset; | ||
502 | |||
503 | /* Ensure mapping is valid for the entire region */ | ||
504 | rc = phys_mapping(addr + size - 1, &mem_offset); | ||
505 | if (WARN(rc != *fd_out, "phys_mapping of 0x%llx failed: %d != %d\n", | ||
506 | addr + size - 1, rc, *fd_out)) | ||
507 | return -EFAULT; | ||
508 | return 0; | ||
509 | } | ||
510 | |||
511 | static int vhost_user_set_mem_table(struct virtio_uml_device *vu_dev) | ||
512 | { | ||
513 | struct vhost_user_msg msg = { | ||
514 | .header.request = VHOST_USER_SET_MEM_TABLE, | ||
515 | .header.size = sizeof(msg.payload.mem_regions), | ||
516 | .payload.mem_regions.num = 1, | ||
517 | }; | ||
518 | unsigned long reserved = uml_reserved - uml_physmem; | ||
519 | int fds[2]; | ||
520 | int rc; | ||
521 | |||
522 | /* | ||
523 | * This is a bit tricky, see also the comment with setup_physmem(). | ||
524 | * | ||
525 | * Essentially, setup_physmem() uses a file to mmap() our physmem, | ||
526 | * but the code and data we *already* have is omitted. To us, this | ||
527 | * is no difference, since they both become part of our address | ||
528 | * space and memory consumption. To somebody looking in from the | ||
529 | * outside, however, it is different because the part of our memory | ||
530 | * consumption that's already part of the binary (code/data) is not | ||
531 | * mapped from the file, so it's not visible to another mmap from | ||
532 | * the file descriptor. | ||
533 | * | ||
534 | * Thus, don't advertise this space to the vhost-user slave. This | ||
535 | * means that the slave will likely abort or similar when we give | ||
536 | * it an address from the hidden range, since it's not marked as | ||
537 | * a valid address, but at least that way we detect the issue and | ||
538 | * don't just have the slave read an all-zeroes buffer from the | ||
539 | * shared memory file, or write something there that we can never | ||
540 | * see (depending on the direction of the virtqueue traffic.) | ||
541 | * | ||
542 | * Since we usually don't want to use .text for virtio buffers, | ||
543 | * this effectively means that you cannot use | ||
544 | * 1) global variables, which are in the .bss and not in the shm | ||
545 | * file-backed memory | ||
546 | * 2) the stack in some processes, depending on where they have | ||
547 | * their stack (or maybe only no interrupt stack?) | ||
548 | * | ||
549 | * The stack is already not typically valid for DMA, so this isn't | ||
550 | * much of a restriction, but global variables might be encountered. | ||
551 | * | ||
552 | * It might be possible to fix it by copying around the data that's | ||
553 | * between bss_start and where we map the file now, but it's not | ||
554 | * something that you typically encounter with virtio drivers, so | ||
555 | * it didn't seem worthwhile. | ||
556 | */ | ||
557 | rc = vhost_user_init_mem_region(reserved, physmem_size - reserved, | ||
558 | &fds[0], | ||
559 | &msg.payload.mem_regions.regions[0]); | ||
560 | |||
561 | if (rc < 0) | ||
562 | return rc; | ||
563 | if (highmem) { | ||
564 | msg.payload.mem_regions.num++; | ||
565 | rc = vhost_user_init_mem_region(__pa(end_iomem), highmem, | ||
566 | &fds[1], &msg.payload.mem_regions.regions[1]); | ||
567 | if (rc < 0) | ||
568 | return rc; | ||
569 | } | ||
570 | |||
571 | return vhost_user_send(vu_dev, false, &msg, fds, | ||
572 | msg.payload.mem_regions.num); | ||
573 | } | ||
574 | |||
575 | static int vhost_user_set_vring_state(struct virtio_uml_device *vu_dev, | ||
576 | u32 request, u32 index, u32 num) | ||
577 | { | ||
578 | struct vhost_user_msg msg = { | ||
579 | .header.request = request, | ||
580 | .header.size = sizeof(msg.payload.vring_state), | ||
581 | .payload.vring_state.index = index, | ||
582 | .payload.vring_state.num = num, | ||
583 | }; | ||
584 | |||
585 | return vhost_user_send(vu_dev, false, &msg, NULL, 0); | ||
586 | } | ||
587 | |||
588 | static int vhost_user_set_vring_num(struct virtio_uml_device *vu_dev, | ||
589 | u32 index, u32 num) | ||
590 | { | ||
591 | return vhost_user_set_vring_state(vu_dev, VHOST_USER_SET_VRING_NUM, | ||
592 | index, num); | ||
593 | } | ||
594 | |||
595 | static int vhost_user_set_vring_base(struct virtio_uml_device *vu_dev, | ||
596 | u32 index, u32 offset) | ||
597 | { | ||
598 | return vhost_user_set_vring_state(vu_dev, VHOST_USER_SET_VRING_BASE, | ||
599 | index, offset); | ||
600 | } | ||
601 | |||
602 | static int vhost_user_set_vring_addr(struct virtio_uml_device *vu_dev, | ||
603 | u32 index, u64 desc, u64 used, u64 avail, | ||
604 | u64 log) | ||
605 | { | ||
606 | struct vhost_user_msg msg = { | ||
607 | .header.request = VHOST_USER_SET_VRING_ADDR, | ||
608 | .header.size = sizeof(msg.payload.vring_addr), | ||
609 | .payload.vring_addr.index = index, | ||
610 | .payload.vring_addr.desc = desc, | ||
611 | .payload.vring_addr.used = used, | ||
612 | .payload.vring_addr.avail = avail, | ||
613 | .payload.vring_addr.log = log, | ||
614 | }; | ||
615 | |||
616 | return vhost_user_send(vu_dev, false, &msg, NULL, 0); | ||
617 | } | ||
618 | |||
619 | static int vhost_user_set_vring_fd(struct virtio_uml_device *vu_dev, | ||
620 | u32 request, int index, int fd) | ||
621 | { | ||
622 | struct vhost_user_msg msg = { | ||
623 | .header.request = request, | ||
624 | .header.size = sizeof(msg.payload.integer), | ||
625 | .payload.integer = index, | ||
626 | }; | ||
627 | |||
628 | if (index & ~VHOST_USER_VRING_INDEX_MASK) | ||
629 | return -EINVAL; | ||
630 | if (fd < 0) { | ||
631 | msg.payload.integer |= VHOST_USER_VRING_POLL_MASK; | ||
632 | return vhost_user_send(vu_dev, false, &msg, NULL, 0); | ||
633 | } | ||
634 | return vhost_user_send(vu_dev, false, &msg, &fd, 1); | ||
635 | } | ||
636 | |||
637 | static int vhost_user_set_vring_call(struct virtio_uml_device *vu_dev, | ||
638 | int index, int fd) | ||
639 | { | ||
640 | return vhost_user_set_vring_fd(vu_dev, VHOST_USER_SET_VRING_CALL, | ||
641 | index, fd); | ||
642 | } | ||
643 | |||
644 | static int vhost_user_set_vring_kick(struct virtio_uml_device *vu_dev, | ||
645 | int index, int fd) | ||
646 | { | ||
647 | return vhost_user_set_vring_fd(vu_dev, VHOST_USER_SET_VRING_KICK, | ||
648 | index, fd); | ||
649 | } | ||
650 | |||
651 | static int vhost_user_set_vring_enable(struct virtio_uml_device *vu_dev, | ||
652 | u32 index, bool enable) | ||
653 | { | ||
654 | if (!(vu_dev->features & BIT_ULL(VHOST_USER_F_PROTOCOL_FEATURES))) | ||
655 | return 0; | ||
656 | |||
657 | return vhost_user_set_vring_state(vu_dev, VHOST_USER_SET_VRING_ENABLE, | ||
658 | index, enable); | ||
659 | } | ||
660 | |||
661 | |||
662 | /* Virtio interface */ | ||
663 | |||
664 | static bool vu_notify(struct virtqueue *vq) | ||
665 | { | ||
666 | struct virtio_uml_vq_info *info = vq->priv; | ||
667 | const uint64_t n = 1; | ||
668 | int rc; | ||
669 | |||
670 | do { | ||
671 | rc = os_write_file(info->kick_fd, &n, sizeof(n)); | ||
672 | } while (rc == -EINTR); | ||
673 | return !WARN(rc != sizeof(n), "write returned %d\n", rc); | ||
674 | } | ||
675 | |||
676 | static irqreturn_t vu_interrupt(int irq, void *opaque) | ||
677 | { | ||
678 | struct virtqueue *vq = opaque; | ||
679 | struct virtio_uml_vq_info *info = vq->priv; | ||
680 | uint64_t n; | ||
681 | int rc; | ||
682 | irqreturn_t ret = IRQ_NONE; | ||
683 | |||
684 | do { | ||
685 | rc = os_read_file(info->call_fd, &n, sizeof(n)); | ||
686 | if (rc == sizeof(n)) | ||
687 | ret |= vring_interrupt(irq, vq); | ||
688 | } while (rc == sizeof(n) || rc == -EINTR); | ||
689 | WARN(rc != -EAGAIN, "read returned %d\n", rc); | ||
690 | return ret; | ||
691 | } | ||
692 | |||
693 | |||
694 | static void vu_get(struct virtio_device *vdev, unsigned offset, | ||
695 | void *buf, unsigned len) | ||
696 | { | ||
697 | struct virtio_uml_device *vu_dev = to_virtio_uml_device(vdev); | ||
698 | |||
699 | vhost_user_get_config(vu_dev, offset, buf, len); | ||
700 | } | ||
701 | |||
702 | static void vu_set(struct virtio_device *vdev, unsigned offset, | ||
703 | const void *buf, unsigned len) | ||
704 | { | ||
705 | struct virtio_uml_device *vu_dev = to_virtio_uml_device(vdev); | ||
706 | |||
707 | vhost_user_set_config(vu_dev, offset, buf, len); | ||
708 | } | ||
709 | |||
710 | static u8 vu_get_status(struct virtio_device *vdev) | ||
711 | { | ||
712 | struct virtio_uml_device *vu_dev = to_virtio_uml_device(vdev); | ||
713 | |||
714 | return vu_dev->status; | ||
715 | } | ||
716 | |||
717 | static void vu_set_status(struct virtio_device *vdev, u8 status) | ||
718 | { | ||
719 | struct virtio_uml_device *vu_dev = to_virtio_uml_device(vdev); | ||
720 | |||
721 | vu_dev->status = status; | ||
722 | } | ||
723 | |||
724 | static void vu_reset(struct virtio_device *vdev) | ||
725 | { | ||
726 | struct virtio_uml_device *vu_dev = to_virtio_uml_device(vdev); | ||
727 | |||
728 | vu_dev->status = 0; | ||
729 | } | ||
730 | |||
731 | static void vu_del_vq(struct virtqueue *vq) | ||
732 | { | ||
733 | struct virtio_uml_vq_info *info = vq->priv; | ||
734 | |||
735 | um_free_irq(VIRTIO_IRQ, vq); | ||
736 | |||
737 | os_close_file(info->call_fd); | ||
738 | os_close_file(info->kick_fd); | ||
739 | |||
740 | vring_del_virtqueue(vq); | ||
741 | kfree(info); | ||
742 | } | ||
743 | |||
744 | static void vu_del_vqs(struct virtio_device *vdev) | ||
745 | { | ||
746 | struct virtio_uml_device *vu_dev = to_virtio_uml_device(vdev); | ||
747 | struct virtqueue *vq, *n; | ||
748 | u64 features; | ||
749 | |||
750 | /* Note: reverse order as a workaround to a decoding bug in snabb */ | ||
751 | list_for_each_entry_reverse(vq, &vdev->vqs, list) | ||
752 | WARN_ON(vhost_user_set_vring_enable(vu_dev, vq->index, false)); | ||
753 | |||
754 | /* Ensure previous messages have been processed */ | ||
755 | WARN_ON(vhost_user_get_features(vu_dev, &features)); | ||
756 | |||
757 | list_for_each_entry_safe(vq, n, &vdev->vqs, list) | ||
758 | vu_del_vq(vq); | ||
759 | } | ||
760 | |||
761 | static int vu_setup_vq_call_fd(struct virtio_uml_device *vu_dev, | ||
762 | struct virtqueue *vq) | ||
763 | { | ||
764 | struct virtio_uml_vq_info *info = vq->priv; | ||
765 | int call_fds[2]; | ||
766 | int rc; | ||
767 | |||
768 | /* Use a pipe for call fd, since SIGIO is not supported for eventfd */ | ||
769 | rc = os_pipe(call_fds, true, true); | ||
770 | if (rc < 0) | ||
771 | return rc; | ||
772 | |||
773 | info->call_fd = call_fds[0]; | ||
774 | rc = um_request_irq(VIRTIO_IRQ, info->call_fd, IRQ_READ, | ||
775 | vu_interrupt, IRQF_SHARED, info->name, vq); | ||
776 | if (rc) | ||
777 | goto close_both; | ||
778 | |||
779 | rc = vhost_user_set_vring_call(vu_dev, vq->index, call_fds[1]); | ||
780 | if (rc) | ||
781 | goto release_irq; | ||
782 | |||
783 | goto out; | ||
784 | |||
785 | release_irq: | ||
786 | um_free_irq(VIRTIO_IRQ, vq); | ||
787 | close_both: | ||
788 | os_close_file(call_fds[0]); | ||
789 | out: | ||
790 | /* Close (unused) write end of call fds */ | ||
791 | os_close_file(call_fds[1]); | ||
792 | |||
793 | return rc; | ||
794 | } | ||
795 | |||
796 | static struct virtqueue *vu_setup_vq(struct virtio_device *vdev, | ||
797 | unsigned index, vq_callback_t *callback, | ||
798 | const char *name, bool ctx) | ||
799 | { | ||
800 | struct virtio_uml_device *vu_dev = to_virtio_uml_device(vdev); | ||
801 | struct platform_device *pdev = vu_dev->pdev; | ||
802 | struct virtio_uml_vq_info *info; | ||
803 | struct virtqueue *vq; | ||
804 | int num = MAX_SUPPORTED_QUEUE_SIZE; | ||
805 | int rc; | ||
806 | |||
807 | info = kzalloc(sizeof(*info), GFP_KERNEL); | ||
808 | if (!info) { | ||
809 | rc = -ENOMEM; | ||
810 | goto error_kzalloc; | ||
811 | } | ||
812 | snprintf(info->name, sizeof(info->name), "%s.%d-%s", pdev->name, | ||
813 | pdev->id, name); | ||
814 | |||
815 | vq = vring_create_virtqueue(index, num, PAGE_SIZE, vdev, true, true, | ||
816 | ctx, vu_notify, callback, info->name); | ||
817 | if (!vq) { | ||
818 | rc = -ENOMEM; | ||
819 | goto error_create; | ||
820 | } | ||
821 | vq->priv = info; | ||
822 | num = virtqueue_get_vring_size(vq); | ||
823 | |||
824 | rc = os_eventfd(0, 0); | ||
825 | if (rc < 0) | ||
826 | goto error_kick; | ||
827 | info->kick_fd = rc; | ||
828 | |||
829 | rc = vu_setup_vq_call_fd(vu_dev, vq); | ||
830 | if (rc) | ||
831 | goto error_call; | ||
832 | |||
833 | rc = vhost_user_set_vring_num(vu_dev, index, num); | ||
834 | if (rc) | ||
835 | goto error_setup; | ||
836 | |||
837 | rc = vhost_user_set_vring_base(vu_dev, index, 0); | ||
838 | if (rc) | ||
839 | goto error_setup; | ||
840 | |||
841 | rc = vhost_user_set_vring_addr(vu_dev, index, | ||
842 | virtqueue_get_desc_addr(vq), | ||
843 | virtqueue_get_used_addr(vq), | ||
844 | virtqueue_get_avail_addr(vq), | ||
845 | (u64) -1); | ||
846 | if (rc) | ||
847 | goto error_setup; | ||
848 | |||
849 | return vq; | ||
850 | |||
851 | error_setup: | ||
852 | um_free_irq(VIRTIO_IRQ, vq); | ||
853 | os_close_file(info->call_fd); | ||
854 | error_call: | ||
855 | os_close_file(info->kick_fd); | ||
856 | error_kick: | ||
857 | vring_del_virtqueue(vq); | ||
858 | error_create: | ||
859 | kfree(info); | ||
860 | error_kzalloc: | ||
861 | return ERR_PTR(rc); | ||
862 | } | ||
863 | |||
864 | static int vu_find_vqs(struct virtio_device *vdev, unsigned nvqs, | ||
865 | struct virtqueue *vqs[], vq_callback_t *callbacks[], | ||
866 | const char * const names[], const bool *ctx, | ||
867 | struct irq_affinity *desc) | ||
868 | { | ||
869 | struct virtio_uml_device *vu_dev = to_virtio_uml_device(vdev); | ||
870 | int i, queue_idx = 0, rc; | ||
871 | struct virtqueue *vq; | ||
872 | |||
873 | rc = vhost_user_set_mem_table(vu_dev); | ||
874 | if (rc) | ||
875 | return rc; | ||
876 | |||
877 | for (i = 0; i < nvqs; ++i) { | ||
878 | if (!names[i]) { | ||
879 | vqs[i] = NULL; | ||
880 | continue; | ||
881 | } | ||
882 | |||
883 | vqs[i] = vu_setup_vq(vdev, queue_idx++, callbacks[i], names[i], | ||
884 | ctx ? ctx[i] : false); | ||
885 | if (IS_ERR(vqs[i])) { | ||
886 | rc = PTR_ERR(vqs[i]); | ||
887 | goto error_setup; | ||
888 | } | ||
889 | } | ||
890 | |||
891 | list_for_each_entry(vq, &vdev->vqs, list) { | ||
892 | struct virtio_uml_vq_info *info = vq->priv; | ||
893 | |||
894 | rc = vhost_user_set_vring_kick(vu_dev, vq->index, | ||
895 | info->kick_fd); | ||
896 | if (rc) | ||
897 | goto error_setup; | ||
898 | |||
899 | rc = vhost_user_set_vring_enable(vu_dev, vq->index, true); | ||
900 | if (rc) | ||
901 | goto error_setup; | ||
902 | } | ||
903 | |||
904 | return 0; | ||
905 | |||
906 | error_setup: | ||
907 | vu_del_vqs(vdev); | ||
908 | return rc; | ||
909 | } | ||
910 | |||
911 | static u64 vu_get_features(struct virtio_device *vdev) | ||
912 | { | ||
913 | struct virtio_uml_device *vu_dev = to_virtio_uml_device(vdev); | ||
914 | |||
915 | return vu_dev->features; | ||
916 | } | ||
917 | |||
918 | static int vu_finalize_features(struct virtio_device *vdev) | ||
919 | { | ||
920 | struct virtio_uml_device *vu_dev = to_virtio_uml_device(vdev); | ||
921 | u64 supported = vdev->features & VHOST_USER_SUPPORTED_F; | ||
922 | |||
923 | vring_transport_features(vdev); | ||
924 | vu_dev->features = vdev->features | supported; | ||
925 | |||
926 | return vhost_user_set_features(vu_dev, vu_dev->features); | ||
927 | } | ||
928 | |||
929 | static const char *vu_bus_name(struct virtio_device *vdev) | ||
930 | { | ||
931 | struct virtio_uml_device *vu_dev = to_virtio_uml_device(vdev); | ||
932 | |||
933 | return vu_dev->pdev->name; | ||
934 | } | ||
935 | |||
936 | static const struct virtio_config_ops virtio_uml_config_ops = { | ||
937 | .get = vu_get, | ||
938 | .set = vu_set, | ||
939 | .get_status = vu_get_status, | ||
940 | .set_status = vu_set_status, | ||
941 | .reset = vu_reset, | ||
942 | .find_vqs = vu_find_vqs, | ||
943 | .del_vqs = vu_del_vqs, | ||
944 | .get_features = vu_get_features, | ||
945 | .finalize_features = vu_finalize_features, | ||
946 | .bus_name = vu_bus_name, | ||
947 | }; | ||
948 | |||
949 | static void virtio_uml_release_dev(struct device *d) | ||
950 | { | ||
951 | struct virtio_device *vdev = | ||
952 | container_of(d, struct virtio_device, dev); | ||
953 | struct virtio_uml_device *vu_dev = to_virtio_uml_device(vdev); | ||
954 | |||
955 | /* might not have been opened due to not negotiating the feature */ | ||
956 | if (vu_dev->req_fd >= 0) { | ||
957 | um_free_irq(VIRTIO_IRQ, vu_dev); | ||
958 | os_close_file(vu_dev->req_fd); | ||
959 | } | ||
960 | |||
961 | os_close_file(vu_dev->sock); | ||
962 | } | ||
963 | |||
964 | /* Platform device */ | ||
965 | |||
966 | struct virtio_uml_platform_data { | ||
967 | u32 virtio_device_id; | ||
968 | const char *socket_path; | ||
969 | }; | ||
970 | |||
971 | static int virtio_uml_probe(struct platform_device *pdev) | ||
972 | { | ||
973 | struct virtio_uml_platform_data *pdata = pdev->dev.platform_data; | ||
974 | struct virtio_uml_device *vu_dev; | ||
975 | int rc; | ||
976 | |||
977 | if (!pdata) | ||
978 | return -EINVAL; | ||
979 | |||
980 | vu_dev = devm_kzalloc(&pdev->dev, sizeof(*vu_dev), GFP_KERNEL); | ||
981 | if (!vu_dev) | ||
982 | return -ENOMEM; | ||
983 | |||
984 | vu_dev->vdev.dev.parent = &pdev->dev; | ||
985 | vu_dev->vdev.dev.release = virtio_uml_release_dev; | ||
986 | vu_dev->vdev.config = &virtio_uml_config_ops; | ||
987 | vu_dev->vdev.id.device = pdata->virtio_device_id; | ||
988 | vu_dev->vdev.id.vendor = VIRTIO_DEV_ANY_ID; | ||
989 | vu_dev->pdev = pdev; | ||
990 | vu_dev->req_fd = -1; | ||
991 | |||
992 | do { | ||
993 | rc = os_connect_socket(pdata->socket_path); | ||
994 | } while (rc == -EINTR); | ||
995 | if (rc < 0) | ||
996 | return rc; | ||
997 | vu_dev->sock = rc; | ||
998 | |||
999 | rc = vhost_user_init(vu_dev); | ||
1000 | if (rc) | ||
1001 | goto error_init; | ||
1002 | |||
1003 | platform_set_drvdata(pdev, vu_dev); | ||
1004 | |||
1005 | rc = register_virtio_device(&vu_dev->vdev); | ||
1006 | if (rc) | ||
1007 | put_device(&vu_dev->vdev.dev); | ||
1008 | return rc; | ||
1009 | |||
1010 | error_init: | ||
1011 | os_close_file(vu_dev->sock); | ||
1012 | return rc; | ||
1013 | } | ||
1014 | |||
1015 | static int virtio_uml_remove(struct platform_device *pdev) | ||
1016 | { | ||
1017 | struct virtio_uml_device *vu_dev = platform_get_drvdata(pdev); | ||
1018 | |||
1019 | unregister_virtio_device(&vu_dev->vdev); | ||
1020 | return 0; | ||
1021 | } | ||
1022 | |||
1023 | /* Command line device list */ | ||
1024 | |||
1025 | static void vu_cmdline_release_dev(struct device *d) | ||
1026 | { | ||
1027 | } | ||
1028 | |||
1029 | static struct device vu_cmdline_parent = { | ||
1030 | .init_name = "virtio-uml-cmdline", | ||
1031 | .release = vu_cmdline_release_dev, | ||
1032 | }; | ||
1033 | |||
1034 | static bool vu_cmdline_parent_registered; | ||
1035 | static int vu_cmdline_id; | ||
1036 | |||
1037 | static int vu_cmdline_set(const char *device, const struct kernel_param *kp) | ||
1038 | { | ||
1039 | const char *ids = strchr(device, ':'); | ||
1040 | unsigned int virtio_device_id; | ||
1041 | int processed, consumed, err; | ||
1042 | char *socket_path; | ||
1043 | struct virtio_uml_platform_data pdata; | ||
1044 | struct platform_device *pdev; | ||
1045 | |||
1046 | if (!ids || ids == device) | ||
1047 | return -EINVAL; | ||
1048 | |||
1049 | processed = sscanf(ids, ":%u%n:%d%n", | ||
1050 | &virtio_device_id, &consumed, | ||
1051 | &vu_cmdline_id, &consumed); | ||
1052 | |||
1053 | if (processed < 1 || ids[consumed]) | ||
1054 | return -EINVAL; | ||
1055 | |||
1056 | if (!vu_cmdline_parent_registered) { | ||
1057 | err = device_register(&vu_cmdline_parent); | ||
1058 | if (err) { | ||
1059 | pr_err("Failed to register parent device!\n"); | ||
1060 | put_device(&vu_cmdline_parent); | ||
1061 | return err; | ||
1062 | } | ||
1063 | vu_cmdline_parent_registered = true; | ||
1064 | } | ||
1065 | |||
1066 | socket_path = kmemdup_nul(device, ids - device, GFP_KERNEL); | ||
1067 | if (!socket_path) | ||
1068 | return -ENOMEM; | ||
1069 | |||
1070 | pdata.virtio_device_id = (u32) virtio_device_id; | ||
1071 | pdata.socket_path = socket_path; | ||
1072 | |||
1073 | pr_info("Registering device virtio-uml.%d id=%d at %s\n", | ||
1074 | vu_cmdline_id, virtio_device_id, socket_path); | ||
1075 | |||
1076 | pdev = platform_device_register_data(&vu_cmdline_parent, "virtio-uml", | ||
1077 | vu_cmdline_id++, &pdata, | ||
1078 | sizeof(pdata)); | ||
1079 | err = PTR_ERR_OR_ZERO(pdev); | ||
1080 | if (err) | ||
1081 | goto free; | ||
1082 | return 0; | ||
1083 | |||
1084 | free: | ||
1085 | kfree(socket_path); | ||
1086 | return err; | ||
1087 | } | ||
1088 | |||
1089 | static int vu_cmdline_get_device(struct device *dev, void *data) | ||
1090 | { | ||
1091 | struct platform_device *pdev = to_platform_device(dev); | ||
1092 | struct virtio_uml_platform_data *pdata = pdev->dev.platform_data; | ||
1093 | char *buffer = data; | ||
1094 | unsigned int len = strlen(buffer); | ||
1095 | |||
1096 | snprintf(buffer + len, PAGE_SIZE - len, "%s:%d:%d\n", | ||
1097 | pdata->socket_path, pdata->virtio_device_id, pdev->id); | ||
1098 | return 0; | ||
1099 | } | ||
1100 | |||
1101 | static int vu_cmdline_get(char *buffer, const struct kernel_param *kp) | ||
1102 | { | ||
1103 | buffer[0] = '\0'; | ||
1104 | if (vu_cmdline_parent_registered) | ||
1105 | device_for_each_child(&vu_cmdline_parent, buffer, | ||
1106 | vu_cmdline_get_device); | ||
1107 | return strlen(buffer) + 1; | ||
1108 | } | ||
1109 | |||
1110 | static const struct kernel_param_ops vu_cmdline_param_ops = { | ||
1111 | .set = vu_cmdline_set, | ||
1112 | .get = vu_cmdline_get, | ||
1113 | }; | ||
1114 | |||
1115 | device_param_cb(device, &vu_cmdline_param_ops, NULL, S_IRUSR); | ||
1116 | __uml_help(vu_cmdline_param_ops, | ||
1117 | "virtio_uml.device=<socket>:<virtio_id>[:<platform_id>]\n" | ||
1118 | " Configure a virtio device over a vhost-user socket.\n" | ||
1119 | " See virtio_ids.h for a list of possible virtio device id values.\n" | ||
1120 | " Optionally use a specific platform_device id.\n\n" | ||
1121 | ); | ||
1122 | |||
1123 | |||
1124 | static int vu_unregister_cmdline_device(struct device *dev, void *data) | ||
1125 | { | ||
1126 | struct platform_device *pdev = to_platform_device(dev); | ||
1127 | struct virtio_uml_platform_data *pdata = pdev->dev.platform_data; | ||
1128 | |||
1129 | kfree(pdata->socket_path); | ||
1130 | platform_device_unregister(pdev); | ||
1131 | return 0; | ||
1132 | } | ||
1133 | |||
1134 | static void vu_unregister_cmdline_devices(void) | ||
1135 | { | ||
1136 | if (vu_cmdline_parent_registered) { | ||
1137 | device_for_each_child(&vu_cmdline_parent, NULL, | ||
1138 | vu_unregister_cmdline_device); | ||
1139 | device_unregister(&vu_cmdline_parent); | ||
1140 | vu_cmdline_parent_registered = false; | ||
1141 | } | ||
1142 | } | ||
1143 | |||
1144 | /* Platform driver */ | ||
1145 | |||
1146 | static const struct of_device_id virtio_uml_match[] = { | ||
1147 | { .compatible = "virtio,uml", }, | ||
1148 | { } | ||
1149 | }; | ||
1150 | MODULE_DEVICE_TABLE(of, virtio_uml_match); | ||
1151 | |||
1152 | static struct platform_driver virtio_uml_driver = { | ||
1153 | .probe = virtio_uml_probe, | ||
1154 | .remove = virtio_uml_remove, | ||
1155 | .driver = { | ||
1156 | .name = "virtio-uml", | ||
1157 | .of_match_table = virtio_uml_match, | ||
1158 | }, | ||
1159 | }; | ||
1160 | |||
1161 | static int __init virtio_uml_init(void) | ||
1162 | { | ||
1163 | return platform_driver_register(&virtio_uml_driver); | ||
1164 | } | ||
1165 | |||
1166 | static void __exit virtio_uml_exit(void) | ||
1167 | { | ||
1168 | platform_driver_unregister(&virtio_uml_driver); | ||
1169 | vu_unregister_cmdline_devices(); | ||
1170 | } | ||
1171 | |||
1172 | module_init(virtio_uml_init); | ||
1173 | module_exit(virtio_uml_exit); | ||
1174 | __uml_exitcall(virtio_uml_exit); | ||
1175 | |||
1176 | MODULE_DESCRIPTION("UML driver for vhost-user virtio devices"); | ||
1177 | MODULE_LICENSE("GPL"); | ||
diff --git a/arch/um/drivers/xterm.c b/arch/um/drivers/xterm.c index 20e30be44795..fc7f1e746703 100644 --- a/arch/um/drivers/xterm.c +++ b/arch/um/drivers/xterm.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <stddef.h> | 6 | #include <stddef.h> |
diff --git a/arch/um/drivers/xterm.h b/arch/um/drivers/xterm.h index 56b9c4aba423..5968da3a6aba 100644 --- a/arch/um/drivers/xterm.h +++ b/arch/um/drivers/xterm.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | 3 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __XTERM_H__ | 6 | #ifndef __XTERM_H__ |
diff --git a/arch/um/drivers/xterm_kern.c b/arch/um/drivers/xterm_kern.c index e8f9957bfbf6..d64ef6d0d463 100644 --- a/arch/um/drivers/xterm_kern.c +++ b/arch/um/drivers/xterm_kern.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/slab.h> | 6 | #include <linux/slab.h> |
diff --git a/arch/um/include/asm/Kbuild b/arch/um/include/asm/Kbuild index b352ed09260e..398006d27e40 100644 --- a/arch/um/include/asm/Kbuild +++ b/arch/um/include/asm/Kbuild | |||
@@ -1,5 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | 1 | # SPDX-License-Identifier: GPL-2.0 |
2 | generic-y += barrier.h | ||
3 | generic-y += bpf_perf_event.h | 2 | generic-y += bpf_perf_event.h |
4 | generic-y += bug.h | 3 | generic-y += bug.h |
5 | generic-y += compat.h | 4 | generic-y += compat.h |
diff --git a/arch/um/include/asm/common.lds.S b/arch/um/include/asm/common.lds.S index 4049f2c46387..d7086b985f27 100644 --- a/arch/um/include/asm/common.lds.S +++ b/arch/um/include/asm/common.lds.S | |||
@@ -83,8 +83,8 @@ | |||
83 | __preinit_array_end = .; | 83 | __preinit_array_end = .; |
84 | } | 84 | } |
85 | .init_array : { | 85 | .init_array : { |
86 | /* dummy - we call this ourselves */ | ||
86 | __init_array_start = .; | 87 | __init_array_start = .; |
87 | *(.init_array) | ||
88 | __init_array_end = .; | 88 | __init_array_end = .; |
89 | } | 89 | } |
90 | .fini_array : { | 90 | .fini_array : { |
diff --git a/arch/um/include/asm/irq.h b/arch/um/include/asm/irq.h index 49ed3e35b35a..42c6205e2dc4 100644 --- a/arch/um/include/asm/irq.h +++ b/arch/um/include/asm/irq.h | |||
@@ -17,17 +17,18 @@ | |||
17 | #define TELNETD_IRQ 12 | 17 | #define TELNETD_IRQ 12 |
18 | #define XTERM_IRQ 13 | 18 | #define XTERM_IRQ 13 |
19 | #define RANDOM_IRQ 14 | 19 | #define RANDOM_IRQ 14 |
20 | #define VIRTIO_IRQ 15 | ||
20 | 21 | ||
21 | #ifdef CONFIG_UML_NET_VECTOR | 22 | #ifdef CONFIG_UML_NET_VECTOR |
22 | 23 | ||
23 | #define VECTOR_BASE_IRQ 15 | 24 | #define VECTOR_BASE_IRQ (VIRTIO_IRQ + 1) |
24 | #define VECTOR_IRQ_SPACE 8 | 25 | #define VECTOR_IRQ_SPACE 8 |
25 | 26 | ||
26 | #define LAST_IRQ (VECTOR_IRQ_SPACE + VECTOR_BASE_IRQ) | 27 | #define LAST_IRQ (VECTOR_IRQ_SPACE + VECTOR_BASE_IRQ - 1) |
27 | 28 | ||
28 | #else | 29 | #else |
29 | 30 | ||
30 | #define LAST_IRQ RANDOM_IRQ | 31 | #define LAST_IRQ VIRTIO_IRQ |
31 | 32 | ||
32 | #endif | 33 | #endif |
33 | 34 | ||
diff --git a/arch/um/include/asm/irqflags.h b/arch/um/include/asm/irqflags.h index cbc6c0013a64..0642ad9035d1 100644 --- a/arch/um/include/asm/irqflags.h +++ b/arch/um/include/asm/irqflags.h | |||
@@ -32,7 +32,6 @@ static inline void arch_local_irq_disable(void) | |||
32 | } | 32 | } |
33 | 33 | ||
34 | #define ARCH_IRQ_DISABLED 0 | 34 | #define ARCH_IRQ_DISABLED 0 |
35 | #define ARCh_IRQ_ENABLED (SIGIO|SIGVTALRM) | ||
36 | 35 | ||
37 | #include <asm-generic/irqflags.h> | 36 | #include <asm-generic/irqflags.h> |
38 | 37 | ||
diff --git a/arch/um/include/asm/kmap_types.h b/arch/um/include/asm/kmap_types.h index 2e0a6b1d8300..b0bd12de1d23 100644 --- a/arch/um/include/asm/kmap_types.h +++ b/arch/um/include/asm/kmap_types.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | 3 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __UM_KMAP_TYPES_H | 6 | #ifndef __UM_KMAP_TYPES_H |
diff --git a/arch/um/include/asm/mmu.h b/arch/um/include/asm/mmu.h index da705448590f..5b072aba5b65 100644 --- a/arch/um/include/asm/mmu.h +++ b/arch/um/include/asm/mmu.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __ARCH_UM_MMU_H | 6 | #ifndef __ARCH_UM_MMU_H |
diff --git a/arch/um/include/asm/mmu_context.h b/arch/um/include/asm/mmu_context.h index 00cefd33afdd..5aee0626e390 100644 --- a/arch/um/include/asm/mmu_context.h +++ b/arch/um/include/asm/mmu_context.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __UM_MMU_CONTEXT_H | 6 | #ifndef __UM_MMU_CONTEXT_H |
diff --git a/arch/um/include/asm/page.h b/arch/um/include/asm/page.h index f878bec23576..95af12e82a32 100644 --- a/arch/um/include/asm/page.h +++ b/arch/um/include/asm/page.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com) | 3 | * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com) |
3 | * Copyright 2003 PathScale, Inc. | 4 | * Copyright 2003 PathScale, Inc. |
4 | * Licensed under the GPL | ||
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef __UM_PAGE_H | 7 | #ifndef __UM_PAGE_H |
diff --git a/arch/um/include/asm/pgalloc.h b/arch/um/include/asm/pgalloc.h index d7b282e9c4d5..023599c3fa51 100644 --- a/arch/um/include/asm/pgalloc.h +++ b/arch/um/include/asm/pgalloc.h | |||
@@ -1,8 +1,8 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) | 3 | * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) |
3 | * Copyright 2003 PathScale, Inc. | 4 | * Copyright 2003 PathScale, Inc. |
4 | * Derived from include/asm-i386/pgalloc.h and include/asm-i386/pgtable.h | 5 | * Derived from include/asm-i386/pgalloc.h and include/asm-i386/pgtable.h |
5 | * Licensed under the GPL | ||
6 | */ | 6 | */ |
7 | 7 | ||
8 | #ifndef __UM_PGALLOC_H | 8 | #ifndef __UM_PGALLOC_H |
diff --git a/arch/um/include/asm/pgtable-2level.h b/arch/um/include/asm/pgtable-2level.h index 179c0ea87a0c..32b3d26a7109 100644 --- a/arch/um/include/asm/pgtable-2level.h +++ b/arch/um/include/asm/pgtable-2level.h | |||
@@ -1,8 +1,8 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) | 3 | * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) |
3 | * Copyright 2003 PathScale, Inc. | 4 | * Copyright 2003 PathScale, Inc. |
4 | * Derived from include/asm-i386/pgtable.h | 5 | * Derived from include/asm-i386/pgtable.h |
5 | * Licensed under the GPL | ||
6 | */ | 6 | */ |
7 | 7 | ||
8 | #ifndef __UM_PGTABLE_2LEVEL_H | 8 | #ifndef __UM_PGTABLE_2LEVEL_H |
diff --git a/arch/um/include/asm/pgtable-3level.h b/arch/um/include/asm/pgtable-3level.h index c4d876dfb9ac..9812269fefc9 100644 --- a/arch/um/include/asm/pgtable-3level.h +++ b/arch/um/include/asm/pgtable-3level.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright 2003 PathScale Inc | 3 | * Copyright 2003 PathScale Inc |
3 | * Derived from include/asm-i386/pgtable.h | 4 | * Derived from include/asm-i386/pgtable.h |
4 | * Licensed under the GPL | ||
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef __UM_PGTABLE_3LEVEL_H | 7 | #ifndef __UM_PGTABLE_3LEVEL_H |
diff --git a/arch/um/include/asm/pgtable.h b/arch/um/include/asm/pgtable.h index b377df76cc28..e4d3ed980d82 100644 --- a/arch/um/include/asm/pgtable.h +++ b/arch/um/include/asm/pgtable.h | |||
@@ -1,8 +1,8 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Copyright 2003 PathScale, Inc. | 4 | * Copyright 2003 PathScale, Inc. |
4 | * Derived from include/asm-i386/pgtable.h | 5 | * Derived from include/asm-i386/pgtable.h |
5 | * Licensed under the GPL | ||
6 | */ | 6 | */ |
7 | 7 | ||
8 | #ifndef __UM_PGTABLE_H | 8 | #ifndef __UM_PGTABLE_H |
diff --git a/arch/um/include/asm/processor-generic.h b/arch/um/include/asm/processor-generic.h index b58b746d3f2c..afd9b267cf81 100644 --- a/arch/um/include/asm/processor-generic.h +++ b/arch/um/include/asm/processor-generic.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __UM_PROCESSOR_GENERIC_H | 6 | #ifndef __UM_PROCESSOR_GENERIC_H |
diff --git a/arch/um/include/asm/ptrace-generic.h b/arch/um/include/asm/ptrace-generic.h index 5ab20620fc97..81c647ef9c6c 100644 --- a/arch/um/include/asm/ptrace-generic.h +++ b/arch/um/include/asm/ptrace-generic.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __UM_PTRACE_GENERIC_H | 6 | #ifndef __UM_PTRACE_GENERIC_H |
diff --git a/arch/um/include/asm/thread_info.h b/arch/um/include/asm/thread_info.h index 4eecd960ee8c..4c19ce4c49f1 100644 --- a/arch/um/include/asm/thread_info.h +++ b/arch/um/include/asm/thread_info.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __UM_THREAD_INFO_H | 6 | #ifndef __UM_THREAD_INFO_H |
diff --git a/arch/um/include/asm/tlbflush.h b/arch/um/include/asm/tlbflush.h index 614f2c091178..a5bda890390d 100644 --- a/arch/um/include/asm/tlbflush.h +++ b/arch/um/include/asm/tlbflush.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __UM_TLBFLUSH_H | 6 | #ifndef __UM_TLBFLUSH_H |
diff --git a/arch/um/include/asm/uaccess.h b/arch/um/include/asm/uaccess.h index cc00fc50768f..fe66d659acad 100644 --- a/arch/um/include/asm/uaccess.h +++ b/arch/um/include/asm/uaccess.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | 3 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) |
3 | * Copyright (C) 2015 Richard Weinberger (richard@nod.at) | 4 | * Copyright (C) 2015 Richard Weinberger (richard@nod.at) |
4 | * Licensed under the GPL | ||
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef __UM_UACCESS_H | 7 | #ifndef __UM_UACCESS_H |
diff --git a/arch/um/include/shared/arch.h b/arch/um/include/shared/arch.h index 4f46abda060d..880ee42a3329 100644 --- a/arch/um/include/shared/arch.h +++ b/arch/um/include/shared/arch.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __ARCH_H__ | 6 | #ifndef __ARCH_H__ |
diff --git a/arch/um/include/shared/as-layout.h b/arch/um/include/shared/as-layout.h index ca1843e1df15..5f286ef2721b 100644 --- a/arch/um/include/shared/as-layout.h +++ b/arch/um/include/shared/as-layout.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __START_H__ | 6 | #ifndef __START_H__ |
diff --git a/arch/um/include/shared/elf_user.h b/arch/um/include/shared/elf_user.h index 53516b637272..fd461ee40c05 100644 --- a/arch/um/include/shared/elf_user.h +++ b/arch/um/include/shared/elf_user.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2004 Fujitsu Siemens Computers GmbH | 3 | * Copyright (C) 2004 Fujitsu Siemens Computers GmbH |
3 | * Author: Bodo Stroesser <bstroesser@fujitsu-siemens.com> | 4 | * Author: Bodo Stroesser <bstroesser@fujitsu-siemens.com> |
4 | * Licensed under the GPL | ||
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef __ELF_USER_H__ | 7 | #ifndef __ELF_USER_H__ |
diff --git a/arch/um/include/shared/frame_kern.h b/arch/um/include/shared/frame_kern.h index a5cde5c433b4..ed952ac661ca 100644 --- a/arch/um/include/shared/frame_kern.h +++ b/arch/um/include/shared/frame_kern.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | 3 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __FRAME_KERN_H_ | 6 | #ifndef __FRAME_KERN_H_ |
diff --git a/arch/um/include/shared/irq_kern.h b/arch/um/include/shared/irq_kern.h index e05bd667de15..7cd1a10c6244 100644 --- a/arch/um/include/shared/irq_kern.h +++ b/arch/um/include/shared/irq_kern.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com) | 3 | * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __IRQ_KERN_H__ | 6 | #ifndef __IRQ_KERN_H__ |
diff --git a/arch/um/include/shared/irq_user.h b/arch/um/include/shared/irq_user.h index e7242a0ae489..107751dce153 100644 --- a/arch/um/include/shared/irq_user.h +++ b/arch/um/include/shared/irq_user.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __IRQ_USER_H__ | 6 | #ifndef __IRQ_USER_H__ |
diff --git a/arch/um/include/shared/kern.h b/arch/um/include/shared/kern.h index 6cd01240bbf0..3a9c75a8413c 100644 --- a/arch/um/include/shared/kern.h +++ b/arch/um/include/shared/kern.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) | 3 | * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __KERN_H__ | 6 | #ifndef __KERN_H__ |
diff --git a/arch/um/include/shared/kern_util.h b/arch/um/include/shared/kern_util.h index 35ab97e4bb9b..ccafb62e8cce 100644 --- a/arch/um/include/shared/kern_util.h +++ b/arch/um/include/shared/kern_util.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __KERN_UTIL_H__ | 6 | #ifndef __KERN_UTIL_H__ |
diff --git a/arch/um/include/shared/longjmp.h b/arch/um/include/shared/longjmp.h index b3315c1f198b..85a1cc290ecb 100644 --- a/arch/um/include/shared/longjmp.h +++ b/arch/um/include/shared/longjmp.h | |||
@@ -18,7 +18,7 @@ extern void longjmp(jmp_buf, int); | |||
18 | enable = get_signals(); \ | 18 | enable = get_signals(); \ |
19 | n = setjmp(*buf); \ | 19 | n = setjmp(*buf); \ |
20 | if(n != 0) \ | 20 | if(n != 0) \ |
21 | set_signals(enable); \ | 21 | set_signals_trace(enable); \ |
22 | n; }) | 22 | n; }) |
23 | 23 | ||
24 | #endif | 24 | #endif |
diff --git a/arch/um/include/shared/mem.h b/arch/um/include/shared/mem.h index 5cd40e99e8d5..4862c91d4213 100644 --- a/arch/um/include/shared/mem.h +++ b/arch/um/include/shared/mem.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __MEM_H__ | 6 | #ifndef __MEM_H__ |
diff --git a/arch/um/include/shared/net_kern.h b/arch/um/include/shared/net_kern.h index 40442b98b173..a87be13c5b87 100644 --- a/arch/um/include/shared/net_kern.h +++ b/arch/um/include/shared/net_kern.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2002 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __UM_NET_KERN_H | 6 | #ifndef __UM_NET_KERN_H |
diff --git a/arch/um/include/shared/net_user.h b/arch/um/include/shared/net_user.h index 3dabbe128e40..1b0531769a5e 100644 --- a/arch/um/include/shared/net_user.h +++ b/arch/um/include/shared/net_user.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __UM_NET_USER_H__ | 6 | #ifndef __UM_NET_USER_H__ |
diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h index 4a62ac4251a5..506bcd1bca68 100644 --- a/arch/um/include/shared/os.h +++ b/arch/um/include/shared/os.h | |||
@@ -1,8 +1,8 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2015 Anton Ivanov (aivanov@{brocade.com,kot-begemot.co.uk}) | 3 | * Copyright (C) 2015 Anton Ivanov (aivanov@{brocade.com,kot-begemot.co.uk}) |
3 | * Copyright (C) 2015 Thomas Meyer (thomas@m3y3r.de) | 4 | * Copyright (C) 2015 Thomas Meyer (thomas@m3y3r.de) |
4 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 5 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
5 | * Licensed under the GPL | ||
6 | */ | 6 | */ |
7 | 7 | ||
8 | #ifndef __OS_H__ | 8 | #ifndef __OS_H__ |
@@ -36,6 +36,8 @@ | |||
36 | #define OS_LIB_PATH "/usr/lib/" | 36 | #define OS_LIB_PATH "/usr/lib/" |
37 | #endif | 37 | #endif |
38 | 38 | ||
39 | #define OS_SENDMSG_MAX_FDS 8 | ||
40 | |||
39 | /* | 41 | /* |
40 | * types taken from stat_file() in hostfs_user.c | 42 | * types taken from stat_file() in hostfs_user.c |
41 | * (if they are wrong here, they are wrong there...). | 43 | * (if they are wrong here, they are wrong there...). |
@@ -176,6 +178,9 @@ extern unsigned os_major(unsigned long long dev); | |||
176 | extern unsigned os_minor(unsigned long long dev); | 178 | extern unsigned os_minor(unsigned long long dev); |
177 | extern unsigned long long os_makedev(unsigned major, unsigned minor); | 179 | extern unsigned long long os_makedev(unsigned major, unsigned minor); |
178 | extern int os_falloc_punch(int fd, unsigned long long offset, int count); | 180 | extern int os_falloc_punch(int fd, unsigned long long offset, int count); |
181 | extern int os_eventfd(unsigned int initval, int flags); | ||
182 | extern int os_sendmsg_fds(int fd, const void *buf, unsigned int len, | ||
183 | const int *fds, unsigned int fds_num); | ||
179 | 184 | ||
180 | /* start_up.c */ | 185 | /* start_up.c */ |
181 | extern void os_early_checks(void); | 186 | extern void os_early_checks(void); |
@@ -232,6 +237,7 @@ extern void block_signals(void); | |||
232 | extern void unblock_signals(void); | 237 | extern void unblock_signals(void); |
233 | extern int get_signals(void); | 238 | extern int get_signals(void); |
234 | extern int set_signals(int enable); | 239 | extern int set_signals(int enable); |
240 | extern int set_signals_trace(int enable); | ||
235 | extern int os_is_signal_stack(void); | 241 | extern int os_is_signal_stack(void); |
236 | extern void deliver_alarm(void); | 242 | extern void deliver_alarm(void); |
237 | 243 | ||
@@ -317,4 +323,10 @@ extern unsigned long os_get_top_address(void); | |||
317 | 323 | ||
318 | long syscall(long number, ...); | 324 | long syscall(long number, ...); |
319 | 325 | ||
326 | /* irqflags tracing */ | ||
327 | extern void block_signals_trace(void); | ||
328 | extern void unblock_signals_trace(void); | ||
329 | extern void um_trace_signals_on(void); | ||
330 | extern void um_trace_signals_off(void); | ||
331 | |||
320 | #endif | 332 | #endif |
diff --git a/arch/um/include/shared/ptrace_user.h b/arch/um/include/shared/ptrace_user.h index 56b2f284b108..95455e8996e7 100644 --- a/arch/um/include/shared/ptrace_user.h +++ b/arch/um/include/shared/ptrace_user.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __PTRACE_USER_H__ | 6 | #ifndef __PTRACE_USER_H__ |
diff --git a/arch/um/include/shared/registers.h b/arch/um/include/shared/registers.h index a74449b5b0e3..0c50fa6e8a55 100644 --- a/arch/um/include/shared/registers.h +++ b/arch/um/include/shared/registers.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2004 PathScale, Inc | 3 | * Copyright (C) 2004 PathScale, Inc |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __REGISTERS_H | 6 | #ifndef __REGISTERS_H |
diff --git a/arch/um/include/shared/sigio.h b/arch/um/include/shared/sigio.h index 434f1a9ae4b3..8fe8f57c05de 100644 --- a/arch/um/include/shared/sigio.h +++ b/arch/um/include/shared/sigio.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | 3 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __SIGIO_H__ | 6 | #ifndef __SIGIO_H__ |
diff --git a/arch/um/include/shared/skas/mm_id.h b/arch/um/include/shared/skas/mm_id.h index 48dd0989ddaa..4337b4ced095 100644 --- a/arch/um/include/shared/skas/mm_id.h +++ b/arch/um/include/shared/skas/mm_id.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2005 Jeff Dike (jdike@karaya.com) | 3 | * Copyright (C) 2005 Jeff Dike (jdike@karaya.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __MM_ID_H | 6 | #ifndef __MM_ID_H |
diff --git a/arch/um/include/shared/skas/skas.h b/arch/um/include/shared/skas/skas.h index 911f3c45ad1f..c93d2cbc8f32 100644 --- a/arch/um/include/shared/skas/skas.h +++ b/arch/um/include/shared/skas/skas.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __SKAS_H | 6 | #ifndef __SKAS_H |
diff --git a/arch/um/include/shared/skas/stub-data.h b/arch/um/include/shared/skas/stub-data.h index 13f404e1262b..6b01d97a9386 100644 --- a/arch/um/include/shared/skas/stub-data.h +++ b/arch/um/include/shared/skas/stub-data.h | |||
@@ -1,8 +1,8 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | 3 | ||
3 | * Copyright (C) 2015 Thomas Meyer (thomas@m3y3r.de) | 4 | * Copyright (C) 2015 Thomas Meyer (thomas@m3y3r.de) |
4 | * Copyright (C) 2005 Jeff Dike (jdike@karaya.com) | 5 | * Copyright (C) 2005 Jeff Dike (jdike@karaya.com) |
5 | * Licensed under the GPL | ||
6 | */ | 6 | */ |
7 | 7 | ||
8 | #ifndef __STUB_DATA_H | 8 | #ifndef __STUB_DATA_H |
diff --git a/arch/um/include/shared/timer-internal.h b/arch/um/include/shared/timer-internal.h index 9991ec2371e4..2d2d13c9b46f 100644 --- a/arch/um/include/shared/timer-internal.h +++ b/arch/um/include/shared/timer-internal.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2012 - 2014 Cisco Systems | 3 | * Copyright (C) 2012 - 2014 Cisco Systems |
3 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 4 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
4 | * Licensed under the GPL | ||
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef __TIMER_INTERNAL_H__ | 7 | #ifndef __TIMER_INTERNAL_H__ |
@@ -43,6 +43,11 @@ static inline void time_travel_set_timer_expiry(unsigned long long expiry) | |||
43 | { | 43 | { |
44 | time_travel_timer_expiry = expiry; | 44 | time_travel_timer_expiry = expiry; |
45 | } | 45 | } |
46 | |||
47 | static inline void time_travel_set_timer_interval(unsigned long long interval) | ||
48 | { | ||
49 | time_travel_timer_interval = interval; | ||
50 | } | ||
46 | #else | 51 | #else |
47 | #define time_travel_mode TT_MODE_OFF | 52 | #define time_travel_mode TT_MODE_OFF |
48 | #define time_travel_time 0 | 53 | #define time_travel_time 0 |
@@ -61,6 +66,10 @@ static inline void time_travel_set_timer_expiry(unsigned long long expiry) | |||
61 | { | 66 | { |
62 | } | 67 | } |
63 | 68 | ||
69 | static inline void time_travel_set_timer_interval(unsigned long long interval) | ||
70 | { | ||
71 | } | ||
72 | |||
64 | #define time_travel_timer_mode TT_TMR_DISABLED | 73 | #define time_travel_timer_mode TT_TMR_DISABLED |
65 | #endif | 74 | #endif |
66 | 75 | ||
diff --git a/arch/um/include/shared/um_malloc.h b/arch/um/include/shared/um_malloc.h index 6395fef6b69b..13da93284c2c 100644 --- a/arch/um/include/shared/um_malloc.h +++ b/arch/um/include/shared/um_malloc.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2005 Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> | 3 | * Copyright (C) 2005 Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __UM_MALLOC_H__ | 6 | #ifndef __UM_MALLOC_H__ |
diff --git a/arch/um/include/shared/user.h b/arch/um/include/shared/user.h index 4cff19f6207a..e793e4212f0a 100644 --- a/arch/um/include/shared/user.h +++ b/arch/um/include/shared/user.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __USER_H__ | 6 | #ifndef __USER_H__ |
diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile index 2f36d515762e..5aa882011e04 100644 --- a/arch/um/kernel/Makefile +++ b/arch/um/kernel/Makefile | |||
@@ -1,6 +1,6 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux,intel}.com) | 3 | # Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux,intel}.com) |
3 | # Licensed under the GPL | ||
4 | # | 4 | # |
5 | 5 | ||
6 | # Don't instrument UML-specific code; without this, we may crash when | 6 | # Don't instrument UML-specific code; without this, we may crash when |
@@ -13,7 +13,6 @@ CPPFLAGS_vmlinux.lds := -DSTART=$(LDS_START) \ | |||
13 | -DELF_FORMAT=$(LDS_ELF_FORMAT) \ | 13 | -DELF_FORMAT=$(LDS_ELF_FORMAT) \ |
14 | $(LDS_EXTRA) | 14 | $(LDS_EXTRA) |
15 | extra-y := vmlinux.lds | 15 | extra-y := vmlinux.lds |
16 | clean-files := | ||
17 | 16 | ||
18 | obj-y = config.o exec.o exitcode.o irq.o ksyms.o mem.o \ | 17 | obj-y = config.o exec.o exitcode.o irq.o ksyms.o mem.o \ |
19 | physmem.o process.o ptrace.o reboot.o sigio.o \ | 18 | physmem.o process.o ptrace.o reboot.o sigio.o \ |
diff --git a/arch/um/kernel/config.c.in b/arch/um/kernel/config.c.in index 972bf1659564..3ece3c3b31cc 100644 --- a/arch/um/kernel/config.c.in +++ b/arch/um/kernel/config.c.in | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | // SPDX-License-Identifier: GPL-2.0 |
2 | /* | ||
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | 3 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <stdio.h> | 6 | #include <stdio.h> |
diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S index 5568cf882371..c69d69ee96be 100644 --- a/arch/um/kernel/dyn.lds.S +++ b/arch/um/kernel/dyn.lds.S | |||
@@ -70,6 +70,8 @@ SECTIONS | |||
70 | SCHED_TEXT | 70 | SCHED_TEXT |
71 | CPUIDLE_TEXT | 71 | CPUIDLE_TEXT |
72 | LOCK_TEXT | 72 | LOCK_TEXT |
73 | IRQENTRY_TEXT | ||
74 | SOFTIRQENTRY_TEXT | ||
73 | *(.fixup) | 75 | *(.fixup) |
74 | *(.stub .text.* .gnu.linkonce.t.*) | 76 | *(.stub .text.* .gnu.linkonce.t.*) |
75 | /* .gnu.warning sections are handled specially by elf32.em. */ | 77 | /* .gnu.warning sections are handled specially by elf32.em. */ |
@@ -101,7 +103,6 @@ SECTIONS | |||
101 | be empty, which isn't pretty. */ | 103 | be empty, which isn't pretty. */ |
102 | . = ALIGN(32 / 8); | 104 | . = ALIGN(32 / 8); |
103 | .preinit_array : { *(.preinit_array) } | 105 | .preinit_array : { *(.preinit_array) } |
104 | .init_array : { *(.init_array) } | ||
105 | .fini_array : { *(.fini_array) } | 106 | .fini_array : { *(.fini_array) } |
106 | .data : { | 107 | .data : { |
107 | INIT_TASK_DATA(KERNEL_STACK_SIZE) | 108 | INIT_TASK_DATA(KERNEL_STACK_SIZE) |
diff --git a/arch/um/kernel/exec.c b/arch/um/kernel/exec.c index 783b9247161f..e8fd5d540b05 100644 --- a/arch/um/kernel/exec.c +++ b/arch/um/kernel/exec.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/stddef.h> | 6 | #include <linux/stddef.h> |
diff --git a/arch/um/kernel/exitcode.c b/arch/um/kernel/exitcode.c index 546302e3b7fb..369fd844e195 100644 --- a/arch/um/kernel/exitcode.c +++ b/arch/um/kernel/exitcode.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/ctype.h> | 6 | #include <linux/ctype.h> |
diff --git a/arch/um/kernel/gmon_syms.c b/arch/um/kernel/gmon_syms.c index f138a4a0db99..9361a8eb9bf1 100644 --- a/arch/um/kernel/gmon_syms.c +++ b/arch/um/kernel/gmon_syms.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/module.h> | 6 | #include <linux/module.h> |
diff --git a/arch/um/kernel/gprof_syms.c b/arch/um/kernel/gprof_syms.c index 74ddb44288a3..84d536908775 100644 --- a/arch/um/kernel/gprof_syms.c +++ b/arch/um/kernel/gprof_syms.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/module.h> | 6 | #include <linux/module.h> |
diff --git a/arch/um/kernel/initrd.c b/arch/um/kernel/initrd.c index 1dcd310cb34d..c1981ffb7179 100644 --- a/arch/um/kernel/initrd.c +++ b/arch/um/kernel/initrd.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/init.h> | 6 | #include <linux/init.h> |
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c index efde1f16c603..3577118bb4a5 100644 --- a/arch/um/kernel/irq.c +++ b/arch/um/kernel/irq.c | |||
@@ -1,8 +1,8 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2017 - Cambridge Greys Ltd | 3 | * Copyright (C) 2017 - Cambridge Greys Ltd |
3 | * Copyright (C) 2011 - 2014 Cisco Systems Inc | 4 | * Copyright (C) 2011 - 2014 Cisco Systems Inc |
4 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 5 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
5 | * Licensed under the GPL | ||
6 | * Derived (i.e. mostly copied) from arch/i386/kernel/irq.c: | 6 | * Derived (i.e. mostly copied) from arch/i386/kernel/irq.c: |
7 | * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar | 7 | * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar |
8 | */ | 8 | */ |
@@ -480,7 +480,7 @@ void __init init_IRQ(void) | |||
480 | irq_set_chip_and_handler(TIMER_IRQ, &SIGVTALRM_irq_type, handle_edge_irq); | 480 | irq_set_chip_and_handler(TIMER_IRQ, &SIGVTALRM_irq_type, handle_edge_irq); |
481 | 481 | ||
482 | 482 | ||
483 | for (i = 1; i < LAST_IRQ; i++) | 483 | for (i = 1; i <= LAST_IRQ; i++) |
484 | irq_set_chip_and_handler(i, &normal_irq_type, handle_edge_irq); | 484 | irq_set_chip_and_handler(i, &normal_irq_type, handle_edge_irq); |
485 | /* Initialize EPOLL Loop */ | 485 | /* Initialize EPOLL Loop */ |
486 | os_setup_epoll(); | 486 | os_setup_epoll(); |
diff --git a/arch/um/kernel/ksyms.c b/arch/um/kernel/ksyms.c index 232b22307fdd..8ade54a86a7e 100644 --- a/arch/um/kernel/ksyms.c +++ b/arch/um/kernel/ksyms.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/module.h> | 6 | #include <linux/module.h> |
@@ -38,6 +38,8 @@ EXPORT_SYMBOL(run_helper); | |||
38 | EXPORT_SYMBOL(os_major); | 38 | EXPORT_SYMBOL(os_major); |
39 | EXPORT_SYMBOL(os_minor); | 39 | EXPORT_SYMBOL(os_minor); |
40 | EXPORT_SYMBOL(os_makedev); | 40 | EXPORT_SYMBOL(os_makedev); |
41 | EXPORT_SYMBOL(os_eventfd); | ||
42 | EXPORT_SYMBOL(os_sendmsg_fds); | ||
41 | 43 | ||
42 | EXPORT_SYMBOL(add_sigio_fd); | 44 | EXPORT_SYMBOL(add_sigio_fd); |
43 | EXPORT_SYMBOL(ignore_sigio_fd); | 45 | EXPORT_SYMBOL(ignore_sigio_fd); |
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c index de58e976b9bc..417ff647fb37 100644 --- a/arch/um/kernel/mem.c +++ b/arch/um/kernel/mem.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/stddef.h> | 6 | #include <linux/stddef.h> |
@@ -31,6 +31,7 @@ pgd_t swapper_pg_dir[PTRS_PER_PGD]; | |||
31 | 31 | ||
32 | /* Initialized at boot time, and readonly after that */ | 32 | /* Initialized at boot time, and readonly after that */ |
33 | unsigned long long highmem; | 33 | unsigned long long highmem; |
34 | EXPORT_SYMBOL(highmem); | ||
34 | int kmalloc_ok = 0; | 35 | int kmalloc_ok = 0; |
35 | 36 | ||
36 | /* Used during early boot */ | 37 | /* Used during early boot */ |
diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c index 5bf56af4d5b9..e7c7b53a1435 100644 --- a/arch/um/kernel/physmem.c +++ b/arch/um/kernel/physmem.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/module.h> | 6 | #include <linux/module.h> |
@@ -143,6 +143,7 @@ int phys_mapping(unsigned long phys, unsigned long long *offset_out) | |||
143 | 143 | ||
144 | return fd; | 144 | return fd; |
145 | } | 145 | } |
146 | EXPORT_SYMBOL(phys_mapping); | ||
146 | 147 | ||
147 | static int __init uml_mem_setup(char *line, int *add) | 148 | static int __init uml_mem_setup(char *line, int *add) |
148 | { | 149 | { |
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c index 6bede7888fc2..263a8f069133 100644 --- a/arch/um/kernel/process.c +++ b/arch/um/kernel/process.c | |||
@@ -1,9 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2015 Anton Ivanov (aivanov@{brocade.com,kot-begemot.co.uk}) | 3 | * Copyright (C) 2015 Anton Ivanov (aivanov@{brocade.com,kot-begemot.co.uk}) |
3 | * Copyright (C) 2015 Thomas Meyer (thomas@m3y3r.de) | 4 | * Copyright (C) 2015 Thomas Meyer (thomas@m3y3r.de) |
4 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 5 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
5 | * Copyright 2003 PathScale, Inc. | 6 | * Copyright 2003 PathScale, Inc. |
6 | * Licensed under the GPL | ||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/stddef.h> | 9 | #include <linux/stddef.h> |
@@ -210,15 +210,23 @@ static void time_travel_sleep(unsigned long long duration) | |||
210 | if (time_travel_mode != TT_MODE_INFCPU) | 210 | if (time_travel_mode != TT_MODE_INFCPU) |
211 | os_timer_disable(); | 211 | os_timer_disable(); |
212 | 212 | ||
213 | if (time_travel_timer_mode != TT_TMR_DISABLED || | 213 | while (time_travel_timer_mode == TT_TMR_PERIODIC && |
214 | time_travel_timer_expiry < time_travel_time) | ||
215 | time_travel_set_timer_expiry(time_travel_timer_expiry + | ||
216 | time_travel_timer_interval); | ||
217 | |||
218 | if (time_travel_timer_mode != TT_TMR_DISABLED && | ||
214 | time_travel_timer_expiry < next) { | 219 | time_travel_timer_expiry < next) { |
215 | if (time_travel_timer_mode == TT_TMR_ONESHOT) | 220 | if (time_travel_timer_mode == TT_TMR_ONESHOT) |
216 | time_travel_set_timer_mode(TT_TMR_DISABLED); | 221 | time_travel_set_timer_mode(TT_TMR_DISABLED); |
217 | /* | 222 | /* |
218 | * time_travel_time will be adjusted in the timer | 223 | * In basic mode, time_travel_time will be adjusted in |
219 | * IRQ handler so it works even when the signal | 224 | * the timer IRQ handler so it works even when the signal |
220 | * comes from the OS timer | 225 | * comes from the OS timer, see there. |
221 | */ | 226 | */ |
227 | if (time_travel_mode != TT_MODE_BASIC) | ||
228 | time_travel_set_time(time_travel_timer_expiry); | ||
229 | |||
222 | deliver_alarm(); | 230 | deliver_alarm(); |
223 | } else { | 231 | } else { |
224 | time_travel_set_time(next); | 232 | time_travel_set_time(next); |
diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c index da1e96b1ec3e..b425f47bddbb 100644 --- a/arch/um/kernel/ptrace.c +++ b/arch/um/kernel/ptrace.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/audit.h> | 6 | #include <linux/audit.h> |
diff --git a/arch/um/kernel/reboot.c b/arch/um/kernel/reboot.c index 71f3e9217cf2..48c0610d506e 100644 --- a/arch/um/kernel/reboot.c +++ b/arch/um/kernel/reboot.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/sched/signal.h> | 6 | #include <linux/sched/signal.h> |
diff --git a/arch/um/kernel/sigio.c b/arch/um/kernel/sigio.c index 3fb6a4041ed6..10c99e058fca 100644 --- a/arch/um/kernel/sigio.c +++ b/arch/um/kernel/sigio.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com) | 3 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/interrupt.h> | 6 | #include <linux/interrupt.h> |
diff --git a/arch/um/kernel/signal.c b/arch/um/kernel/signal.c index 57acbd67d85d..3d57c71c532e 100644 --- a/arch/um/kernel/signal.c +++ b/arch/um/kernel/signal.c | |||
@@ -1,20 +1,48 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/module.h> | 6 | #include <linux/module.h> |
7 | #include <linux/ptrace.h> | 7 | #include <linux/ptrace.h> |
8 | #include <linux/sched.h> | 8 | #include <linux/sched.h> |
9 | #include <linux/ftrace.h> | ||
9 | #include <asm/siginfo.h> | 10 | #include <asm/siginfo.h> |
10 | #include <asm/signal.h> | 11 | #include <asm/signal.h> |
11 | #include <asm/unistd.h> | 12 | #include <asm/unistd.h> |
12 | #include <frame_kern.h> | 13 | #include <frame_kern.h> |
13 | #include <kern_util.h> | 14 | #include <kern_util.h> |
15 | #include <os.h> | ||
14 | 16 | ||
15 | EXPORT_SYMBOL(block_signals); | 17 | EXPORT_SYMBOL(block_signals); |
16 | EXPORT_SYMBOL(unblock_signals); | 18 | EXPORT_SYMBOL(unblock_signals); |
17 | 19 | ||
20 | void block_signals_trace(void) | ||
21 | { | ||
22 | block_signals(); | ||
23 | if (current_thread_info()) | ||
24 | trace_hardirqs_off(); | ||
25 | } | ||
26 | |||
27 | void unblock_signals_trace(void) | ||
28 | { | ||
29 | if (current_thread_info()) | ||
30 | trace_hardirqs_on(); | ||
31 | unblock_signals(); | ||
32 | } | ||
33 | |||
34 | void um_trace_signals_on(void) | ||
35 | { | ||
36 | if (current_thread_info()) | ||
37 | trace_hardirqs_on(); | ||
38 | } | ||
39 | |||
40 | void um_trace_signals_off(void) | ||
41 | { | ||
42 | if (current_thread_info()) | ||
43 | trace_hardirqs_off(); | ||
44 | } | ||
45 | |||
18 | /* | 46 | /* |
19 | * OK, we're invoking a handler | 47 | * OK, we're invoking a handler |
20 | */ | 48 | */ |
diff --git a/arch/um/kernel/skas/Makefile b/arch/um/kernel/skas/Makefile index 5bd3edfcfedf..f3d494a4fd9b 100644 --- a/arch/um/kernel/skas/Makefile +++ b/arch/um/kernel/skas/Makefile | |||
@@ -1,6 +1,6 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | # Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | # Licensed under the GPL | ||
4 | # | 4 | # |
5 | 5 | ||
6 | obj-y := clone.o mmu.o process.o syscall.o uaccess.o | 6 | obj-y := clone.o mmu.o process.o syscall.o uaccess.o |
diff --git a/arch/um/kernel/skas/clone.c b/arch/um/kernel/skas/clone.c index 0f25d41b1031..bfb70c456b30 100644 --- a/arch/um/kernel/skas/clone.c +++ b/arch/um/kernel/skas/clone.c | |||
@@ -1,7 +1,7 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2015 Thomas Meyer (thomas@m3y3r.de) | 3 | * Copyright (C) 2015 Thomas Meyer (thomas@m3y3r.de) |
3 | * Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 4 | * Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
4 | * Licensed under the GPL | ||
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <signal.h> | 7 | #include <signal.h> |
diff --git a/arch/um/kernel/skas/mmu.c b/arch/um/kernel/skas/mmu.c index 29e7f5f9f188..b5e3d91fc9c2 100644 --- a/arch/um/kernel/skas/mmu.c +++ b/arch/um/kernel/skas/mmu.c | |||
@@ -1,7 +1,7 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2015 Thomas Meyer (thomas@m3y3r.de) | 3 | * Copyright (C) 2015 Thomas Meyer (thomas@m3y3r.de) |
3 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 4 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
4 | * Licensed under the GPL | ||
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/mm.h> | 7 | #include <linux/mm.h> |
@@ -63,12 +63,12 @@ int init_new_context(struct task_struct *task, struct mm_struct *mm) | |||
63 | if (current->mm != NULL && current->mm != &init_mm) | 63 | if (current->mm != NULL && current->mm != &init_mm) |
64 | from_mm = ¤t->mm->context; | 64 | from_mm = ¤t->mm->context; |
65 | 65 | ||
66 | block_signals(); | 66 | block_signals_trace(); |
67 | if (from_mm) | 67 | if (from_mm) |
68 | to_mm->id.u.pid = copy_context_skas0(stack, | 68 | to_mm->id.u.pid = copy_context_skas0(stack, |
69 | from_mm->id.u.pid); | 69 | from_mm->id.u.pid); |
70 | else to_mm->id.u.pid = start_userspace(stack); | 70 | else to_mm->id.u.pid = start_userspace(stack); |
71 | unblock_signals(); | 71 | unblock_signals_trace(); |
72 | 72 | ||
73 | if (to_mm->id.u.pid < 0) { | 73 | if (to_mm->id.u.pid < 0) { |
74 | ret = to_mm->id.u.pid; | 74 | ret = to_mm->id.u.pid; |
diff --git a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c index d4dbf08722d6..f2ac134c9752 100644 --- a/arch/um/kernel/skas/process.c +++ b/arch/um/kernel/skas/process.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/init.h> | 6 | #include <linux/init.h> |
@@ -19,7 +19,7 @@ static int __init start_kernel_proc(void *unused) | |||
19 | { | 19 | { |
20 | int pid; | 20 | int pid; |
21 | 21 | ||
22 | block_signals(); | 22 | block_signals_trace(); |
23 | pid = os_getpid(); | 23 | pid = os_getpid(); |
24 | 24 | ||
25 | cpu_tasks[0].pid = pid; | 25 | cpu_tasks[0].pid = pid; |
diff --git a/arch/um/kernel/skas/syscall.c b/arch/um/kernel/skas/syscall.c index 44bb10785075..f574b1856bc6 100644 --- a/arch/um/kernel/skas/syscall.c +++ b/arch/um/kernel/skas/syscall.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/kernel.h> | 6 | #include <linux/kernel.h> |
diff --git a/arch/um/kernel/skas/uaccess.c b/arch/um/kernel/skas/uaccess.c index bd3cb694322c..3236052f20e6 100644 --- a/arch/um/kernel/skas/uaccess.c +++ b/arch/um/kernel/skas/uaccess.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/err.h> | 6 | #include <linux/err.h> |
diff --git a/arch/um/kernel/syscall.c b/arch/um/kernel/syscall.c index 35f7047bdebc..eed54c53fbbb 100644 --- a/arch/um/kernel/syscall.c +++ b/arch/um/kernel/syscall.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/file.h> | 6 | #include <linux/file.h> |
diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c index 234757233355..94ea87bd231c 100644 --- a/arch/um/kernel/time.c +++ b/arch/um/kernel/time.c | |||
@@ -1,9 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2015 Anton Ivanov (aivanov@{brocade.com,kot-begemot.co.uk}) | 3 | * Copyright (C) 2015 Anton Ivanov (aivanov@{brocade.com,kot-begemot.co.uk}) |
3 | * Copyright (C) 2015 Thomas Meyer (thomas@m3y3r.de) | 4 | * Copyright (C) 2015 Thomas Meyer (thomas@m3y3r.de) |
4 | * Copyright (C) 2012-2014 Cisco Systems | 5 | * Copyright (C) 2012-2014 Cisco Systems |
5 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 6 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
6 | * Licensed under the GPL | ||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/clockchips.h> | 9 | #include <linux/clockchips.h> |
@@ -39,7 +39,15 @@ void timer_handler(int sig, struct siginfo *unused_si, struct uml_pt_regs *regs) | |||
39 | { | 39 | { |
40 | unsigned long flags; | 40 | unsigned long flags; |
41 | 41 | ||
42 | if (time_travel_mode != TT_MODE_OFF) | 42 | /* |
43 | * In basic time-travel mode we still get real interrupts | ||
44 | * (signals) but since we don't read time from the OS, we | ||
45 | * must update the simulated time here to the expiry when | ||
46 | * we get a signal. | ||
47 | * This is not the case in inf-cpu mode, since there we | ||
48 | * never get any real signals from the OS. | ||
49 | */ | ||
50 | if (time_travel_mode == TT_MODE_BASIC) | ||
43 | time_travel_set_time(time_travel_timer_expiry); | 51 | time_travel_set_time(time_travel_timer_expiry); |
44 | 52 | ||
45 | local_irq_save(flags); | 53 | local_irq_save(flags); |
@@ -65,6 +73,7 @@ static int itimer_set_periodic(struct clock_event_device *evt) | |||
65 | if (time_travel_mode != TT_MODE_OFF) { | 73 | if (time_travel_mode != TT_MODE_OFF) { |
66 | time_travel_set_timer_mode(TT_TMR_PERIODIC); | 74 | time_travel_set_timer_mode(TT_TMR_PERIODIC); |
67 | time_travel_set_timer_expiry(time_travel_time + interval); | 75 | time_travel_set_timer_expiry(time_travel_time + interval); |
76 | time_travel_set_timer_interval(interval); | ||
68 | } | 77 | } |
69 | 78 | ||
70 | if (time_travel_mode != TT_MODE_INFCPU) | 79 | if (time_travel_mode != TT_MODE_INFCPU) |
diff --git a/arch/um/kernel/tlb.c b/arch/um/kernel/tlb.c index 45f739bf302f..b7eaf655635c 100644 --- a/arch/um/kernel/tlb.c +++ b/arch/um/kernel/tlb.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/mm.h> | 6 | #include <linux/mm.h> |
diff --git a/arch/um/kernel/trap.c b/arch/um/kernel/trap.c index 58fe36856182..e62296c66c95 100644 --- a/arch/um/kernel/trap.c +++ b/arch/um/kernel/trap.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/mm.h> | 6 | #include <linux/mm.h> |
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index a818ccef30ca..0f40eccbd759 100644 --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/delay.h> | 6 | #include <linux/delay.h> |
@@ -113,6 +113,7 @@ static int have_root __initdata = 0; | |||
113 | 113 | ||
114 | /* Set in uml_mem_setup and modified in linux_main */ | 114 | /* Set in uml_mem_setup and modified in linux_main */ |
115 | long long physmem_size = 32 * 1024 * 1024; | 115 | long long physmem_size = 32 * 1024 * 1024; |
116 | EXPORT_SYMBOL(physmem_size); | ||
116 | 117 | ||
117 | static const char *usage_string = | 118 | static const char *usage_string = |
118 | "User Mode Linux v%s\n" | 119 | "User Mode Linux v%s\n" |
diff --git a/arch/um/kernel/umid.c b/arch/um/kernel/umid.c index 10bf4aca529f..8031a038eb58 100644 --- a/arch/um/kernel/umid.c +++ b/arch/um/kernel/umid.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <asm/errno.h> | 6 | #include <asm/errno.h> |
diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S index 36b07ec09742..9f21443be2c9 100644 --- a/arch/um/kernel/uml.lds.S +++ b/arch/um/kernel/uml.lds.S | |||
@@ -31,6 +31,8 @@ SECTIONS | |||
31 | SCHED_TEXT | 31 | SCHED_TEXT |
32 | CPUIDLE_TEXT | 32 | CPUIDLE_TEXT |
33 | LOCK_TEXT | 33 | LOCK_TEXT |
34 | IRQENTRY_TEXT | ||
35 | SOFTIRQENTRY_TEXT | ||
34 | *(.fixup) | 36 | *(.fixup) |
35 | /* .gnu.warning sections are handled specially by elf32.em. */ | 37 | /* .gnu.warning sections are handled specially by elf32.em. */ |
36 | *(.gnu.warning) | 38 | *(.gnu.warning) |
diff --git a/arch/um/os-Linux/Makefile b/arch/um/os-Linux/Makefile index 455b500afe97..839915b8c31c 100644 --- a/arch/um/os-Linux/Makefile +++ b/arch/um/os-Linux/Makefile | |||
@@ -1,6 +1,6 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | # Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | # Licensed under the GPL | ||
4 | # | 4 | # |
5 | 5 | ||
6 | # Don't instrument UML-specific code | 6 | # Don't instrument UML-specific code |
diff --git a/arch/um/os-Linux/drivers/Makefile b/arch/um/os-Linux/drivers/Makefile index 6c546dc9222b..d79e75f1b69a 100644 --- a/arch/um/os-Linux/drivers/Makefile +++ b/arch/um/os-Linux/drivers/Makefile | |||
@@ -1,6 +1,6 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Copyright (C) 2000, 2002 Jeff Dike (jdike@karaya.com) | 3 | # Copyright (C) 2000, 2002 Jeff Dike (jdike@karaya.com) |
3 | # Licensed under the GPL | ||
4 | # | 4 | # |
5 | 5 | ||
6 | ethertap-objs := ethertap_kern.o ethertap_user.o | 6 | ethertap-objs := ethertap_kern.o ethertap_user.o |
diff --git a/arch/um/os-Linux/drivers/etap.h b/arch/um/os-Linux/drivers/etap.h index 54183a679fdd..a475259f90e1 100644 --- a/arch/um/os-Linux/drivers/etap.h +++ b/arch/um/os-Linux/drivers/etap.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __DRIVERS_ETAP_H | 6 | #ifndef __DRIVERS_ETAP_H |
diff --git a/arch/um/os-Linux/drivers/ethertap_kern.c b/arch/um/os-Linux/drivers/ethertap_kern.c index f424600a583f..3182e759d8de 100644 --- a/arch/um/os-Linux/drivers/ethertap_kern.c +++ b/arch/um/os-Linux/drivers/ethertap_kern.c | |||
@@ -1,9 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and | 3 | * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and |
3 | * James Leu (jleu@mindspring.net). | 4 | * James Leu (jleu@mindspring.net). |
4 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 5 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
5 | * Copyright (C) 2001 by various other people who didn't put their name here. | 6 | * Copyright (C) 2001 by various other people who didn't put their name here. |
6 | * Licensed under the GPL. | ||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/init.h> | 9 | #include <linux/init.h> |
diff --git a/arch/um/os-Linux/drivers/ethertap_user.c b/arch/um/os-Linux/drivers/ethertap_user.c index 6d4918246ffe..9483021d86dd 100644 --- a/arch/um/os-Linux/drivers/ethertap_user.c +++ b/arch/um/os-Linux/drivers/ethertap_user.c | |||
@@ -1,9 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and | 4 | * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and |
4 | * James Leu (jleu@mindspring.net). | 5 | * James Leu (jleu@mindspring.net). |
5 | * Copyright (C) 2001 by various other people who didn't put their name here. | 6 | * Copyright (C) 2001 by various other people who didn't put their name here. |
6 | * Licensed under the GPL. | ||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <stdio.h> | 9 | #include <stdio.h> |
diff --git a/arch/um/os-Linux/drivers/tuntap.h b/arch/um/os-Linux/drivers/tuntap.h index 7367354ac8df..e364e42abfc5 100644 --- a/arch/um/os-Linux/drivers/tuntap.h +++ b/arch/um/os-Linux/drivers/tuntap.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef __UM_TUNTAP_H | 6 | #ifndef __UM_TUNTAP_H |
diff --git a/arch/um/os-Linux/drivers/tuntap_kern.c b/arch/um/os-Linux/drivers/tuntap_kern.c index d9d56e5810fe..adcb6717be6f 100644 --- a/arch/um/os-Linux/drivers/tuntap_kern.c +++ b/arch/um/os-Linux/drivers/tuntap_kern.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/netdevice.h> | 6 | #include <linux/netdevice.h> |
diff --git a/arch/um/os-Linux/drivers/tuntap_user.c b/arch/um/os-Linux/drivers/tuntap_user.c index db24ce0d09a6..53eb3d508645 100644 --- a/arch/um/os-Linux/drivers/tuntap_user.c +++ b/arch/um/os-Linux/drivers/tuntap_user.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <stdio.h> | 6 | #include <stdio.h> |
diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c index f25b110d4e70..5133e3afb96f 100644 --- a/arch/um/os-Linux/file.c +++ b/arch/um/os-Linux/file.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <stdio.h> | 6 | #include <stdio.h> |
@@ -15,6 +15,7 @@ | |||
15 | #include <sys/sysmacros.h> | 15 | #include <sys/sysmacros.h> |
16 | #include <sys/un.h> | 16 | #include <sys/un.h> |
17 | #include <sys/types.h> | 17 | #include <sys/types.h> |
18 | #include <sys/eventfd.h> | ||
18 | #include <os.h> | 19 | #include <os.h> |
19 | 20 | ||
20 | static void copy_stat(struct uml_stat *dst, const struct stat64 *src) | 21 | static void copy_stat(struct uml_stat *dst, const struct stat64 *src) |
@@ -620,3 +621,46 @@ int os_falloc_punch(int fd, unsigned long long offset, int len) | |||
620 | return n; | 621 | return n; |
621 | } | 622 | } |
622 | 623 | ||
624 | int os_eventfd(unsigned int initval, int flags) | ||
625 | { | ||
626 | int fd = eventfd(initval, flags); | ||
627 | |||
628 | if (fd < 0) | ||
629 | return -errno; | ||
630 | return fd; | ||
631 | } | ||
632 | |||
633 | int os_sendmsg_fds(int fd, const void *buf, unsigned int len, const int *fds, | ||
634 | unsigned int fds_num) | ||
635 | { | ||
636 | struct iovec iov = { | ||
637 | .iov_base = (void *) buf, | ||
638 | .iov_len = len, | ||
639 | }; | ||
640 | union { | ||
641 | char control[CMSG_SPACE(sizeof(*fds) * OS_SENDMSG_MAX_FDS)]; | ||
642 | struct cmsghdr align; | ||
643 | } u; | ||
644 | unsigned int fds_size = sizeof(*fds) * fds_num; | ||
645 | struct msghdr msg = { | ||
646 | .msg_iov = &iov, | ||
647 | .msg_iovlen = 1, | ||
648 | .msg_control = u.control, | ||
649 | .msg_controllen = CMSG_SPACE(fds_size), | ||
650 | }; | ||
651 | struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg); | ||
652 | int err; | ||
653 | |||
654 | if (fds_num > OS_SENDMSG_MAX_FDS) | ||
655 | return -EINVAL; | ||
656 | memset(u.control, 0, sizeof(u.control)); | ||
657 | cmsg->cmsg_level = SOL_SOCKET; | ||
658 | cmsg->cmsg_type = SCM_RIGHTS; | ||
659 | cmsg->cmsg_len = CMSG_LEN(fds_size); | ||
660 | memcpy(CMSG_DATA(cmsg), fds, fds_size); | ||
661 | err = sendmsg(fd, &msg, 0); | ||
662 | |||
663 | if (err < 0) | ||
664 | return -errno; | ||
665 | return err; | ||
666 | } | ||
diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c index 3f02d4232812..9fa6e4187d4f 100644 --- a/arch/um/os-Linux/helper.c +++ b/arch/um/os-Linux/helper.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <stdlib.h> | 6 | #include <stdlib.h> |
diff --git a/arch/um/os-Linux/irq.c b/arch/um/os-Linux/irq.c index 365823010346..d508310ee5e1 100644 --- a/arch/um/os-Linux/irq.c +++ b/arch/um/os-Linux/irq.c | |||
@@ -1,8 +1,8 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2017 - Cambridge Greys Ltd | 3 | * Copyright (C) 2017 - Cambridge Greys Ltd |
3 | * Copyright (C) 2011 - 2014 Cisco Systems Inc | 4 | * Copyright (C) 2011 - 2014 Cisco Systems Inc |
4 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 5 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
5 | * Licensed under the GPL | ||
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <stdlib.h> | 8 | #include <stdlib.h> |
diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c index f1fee2b91239..8014dfac644d 100644 --- a/arch/um/os-Linux/main.c +++ b/arch/um/os-Linux/main.c | |||
@@ -1,7 +1,7 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2015 Thomas Meyer (thomas@m3y3r.de) | 3 | * Copyright (C) 2015 Thomas Meyer (thomas@m3y3r.de) |
3 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 4 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
4 | * Licensed under the GPL | ||
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <stdio.h> | 7 | #include <stdio.h> |
@@ -170,7 +170,7 @@ int __init main(int argc, char **argv, char **envp) | |||
170 | * that they won't be delivered after the exec, when | 170 | * that they won't be delivered after the exec, when |
171 | * they are definitely not expected. | 171 | * they are definitely not expected. |
172 | */ | 172 | */ |
173 | unblock_signals(); | 173 | unblock_signals_trace(); |
174 | 174 | ||
175 | os_info("\n"); | 175 | os_info("\n"); |
176 | /* Reboot */ | 176 | /* Reboot */ |
diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c index e162a95ad7dd..3c1b77474d2d 100644 --- a/arch/um/os-Linux/mem.c +++ b/arch/um/os-Linux/mem.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <stdio.h> | 6 | #include <stdio.h> |
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c index b3e0d40932e1..e52dd37ddadc 100644 --- a/arch/um/os-Linux/process.c +++ b/arch/um/os-Linux/process.c | |||
@@ -1,7 +1,7 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2015 Thomas Meyer (thomas@m3y3r.de) | 3 | * Copyright (C) 2015 Thomas Meyer (thomas@m3y3r.de) |
3 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 4 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
4 | * Licensed under the GPL | ||
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <stdio.h> | 7 | #include <stdio.h> |
diff --git a/arch/um/os-Linux/registers.c b/arch/um/os-Linux/registers.c index 2ff8d4fe83c4..2d9270508e15 100644 --- a/arch/um/os-Linux/registers.c +++ b/arch/um/os-Linux/registers.c | |||
@@ -1,7 +1,7 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2004 PathScale, Inc | 3 | * Copyright (C) 2004 PathScale, Inc |
3 | * Copyright (C) 2004 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 4 | * Copyright (C) 2004 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
4 | * Licensed under the GPL | ||
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <errno.h> | 7 | #include <errno.h> |
diff --git a/arch/um/os-Linux/sigio.c b/arch/um/os-Linux/sigio.c index 46e762f926eb..75558080d0bf 100644 --- a/arch/um/os-Linux/sigio.c +++ b/arch/um/os-Linux/sigio.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 - 2008 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2002 - 2008 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <unistd.h> | 6 | #include <unistd.h> |
@@ -132,7 +132,7 @@ static void update_thread(void) | |||
132 | int n; | 132 | int n; |
133 | char c; | 133 | char c; |
134 | 134 | ||
135 | flags = set_signals(0); | 135 | flags = set_signals_trace(0); |
136 | CATCH_EINTR(n = write(sigio_private[0], &c, sizeof(c))); | 136 | CATCH_EINTR(n = write(sigio_private[0], &c, sizeof(c))); |
137 | if (n != sizeof(c)) { | 137 | if (n != sizeof(c)) { |
138 | printk(UM_KERN_ERR "update_thread : write failed, err = %d\n", | 138 | printk(UM_KERN_ERR "update_thread : write failed, err = %d\n", |
@@ -147,7 +147,7 @@ static void update_thread(void) | |||
147 | goto fail; | 147 | goto fail; |
148 | } | 148 | } |
149 | 149 | ||
150 | set_signals(flags); | 150 | set_signals_trace(flags); |
151 | return; | 151 | return; |
152 | fail: | 152 | fail: |
153 | /* Critical section start */ | 153 | /* Critical section start */ |
@@ -161,7 +161,7 @@ static void update_thread(void) | |||
161 | close(write_sigio_fds[0]); | 161 | close(write_sigio_fds[0]); |
162 | close(write_sigio_fds[1]); | 162 | close(write_sigio_fds[1]); |
163 | /* Critical section end */ | 163 | /* Critical section end */ |
164 | set_signals(flags); | 164 | set_signals_trace(flags); |
165 | } | 165 | } |
166 | 166 | ||
167 | int add_sigio_fd(int fd) | 167 | int add_sigio_fd(int fd) |
diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c index 75b10235d369..b58bc68cbe64 100644 --- a/arch/um/os-Linux/signal.c +++ b/arch/um/os-Linux/signal.c | |||
@@ -1,15 +1,16 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2015 Anton Ivanov (aivanov@{brocade.com,kot-begemot.co.uk}) | 3 | * Copyright (C) 2015 Anton Ivanov (aivanov@{brocade.com,kot-begemot.co.uk}) |
3 | * Copyright (C) 2015 Thomas Meyer (thomas@m3y3r.de) | 4 | * Copyright (C) 2015 Thomas Meyer (thomas@m3y3r.de) |
4 | * Copyright (C) 2004 PathScale, Inc | 5 | * Copyright (C) 2004 PathScale, Inc |
5 | * Copyright (C) 2004 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 6 | * Copyright (C) 2004 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
6 | * Licensed under the GPL | ||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <stdlib.h> | 9 | #include <stdlib.h> |
10 | #include <stdarg.h> | 10 | #include <stdarg.h> |
11 | #include <errno.h> | 11 | #include <errno.h> |
12 | #include <signal.h> | 12 | #include <signal.h> |
13 | #include <string.h> | ||
13 | #include <strings.h> | 14 | #include <strings.h> |
14 | #include <as-layout.h> | 15 | #include <as-layout.h> |
15 | #include <kern_util.h> | 16 | #include <kern_util.h> |
@@ -26,7 +27,6 @@ void (*sig_info[NSIG])(int, struct siginfo *, struct uml_pt_regs *) = { | |||
26 | [SIGBUS] = bus_handler, | 27 | [SIGBUS] = bus_handler, |
27 | [SIGSEGV] = segv_handler, | 28 | [SIGSEGV] = segv_handler, |
28 | [SIGIO] = sigio_handler, | 29 | [SIGIO] = sigio_handler, |
29 | [SIGALRM] = timer_handler | ||
30 | }; | 30 | }; |
31 | 31 | ||
32 | static void sig_handler_common(int sig, struct siginfo *si, mcontext_t *mc) | 32 | static void sig_handler_common(int sig, struct siginfo *si, mcontext_t *mc) |
@@ -42,8 +42,8 @@ static void sig_handler_common(int sig, struct siginfo *si, mcontext_t *mc) | |||
42 | } | 42 | } |
43 | 43 | ||
44 | /* enable signals if sig isn't IRQ signal */ | 44 | /* enable signals if sig isn't IRQ signal */ |
45 | if ((sig != SIGIO) && (sig != SIGWINCH) && (sig != SIGALRM)) | 45 | if ((sig != SIGIO) && (sig != SIGWINCH)) |
46 | unblock_signals(); | 46 | unblock_signals_trace(); |
47 | 47 | ||
48 | (*sig_info[sig])(sig, si, &r); | 48 | (*sig_info[sig])(sig, si, &r); |
49 | 49 | ||
@@ -76,11 +76,11 @@ void sig_handler(int sig, struct siginfo *si, mcontext_t *mc) | |||
76 | return; | 76 | return; |
77 | } | 77 | } |
78 | 78 | ||
79 | block_signals(); | 79 | block_signals_trace(); |
80 | 80 | ||
81 | sig_handler_common(sig, si, mc); | 81 | sig_handler_common(sig, si, mc); |
82 | 82 | ||
83 | set_signals(enabled); | 83 | set_signals_trace(enabled); |
84 | } | 84 | } |
85 | 85 | ||
86 | static void timer_real_alarm_handler(mcontext_t *mc) | 86 | static void timer_real_alarm_handler(mcontext_t *mc) |
@@ -89,6 +89,8 @@ static void timer_real_alarm_handler(mcontext_t *mc) | |||
89 | 89 | ||
90 | if (mc != NULL) | 90 | if (mc != NULL) |
91 | get_regs_from_mc(®s, mc); | 91 | get_regs_from_mc(®s, mc); |
92 | else | ||
93 | memset(®s, 0, sizeof(regs)); | ||
92 | timer_handler(SIGALRM, NULL, ®s); | 94 | timer_handler(SIGALRM, NULL, ®s); |
93 | } | 95 | } |
94 | 96 | ||
@@ -102,7 +104,7 @@ void timer_alarm_handler(int sig, struct siginfo *unused_si, mcontext_t *mc) | |||
102 | return; | 104 | return; |
103 | } | 105 | } |
104 | 106 | ||
105 | block_signals(); | 107 | block_signals_trace(); |
106 | 108 | ||
107 | signals_active |= SIGALRM_MASK; | 109 | signals_active |= SIGALRM_MASK; |
108 | 110 | ||
@@ -110,7 +112,7 @@ void timer_alarm_handler(int sig, struct siginfo *unused_si, mcontext_t *mc) | |||
110 | 112 | ||
111 | signals_active &= ~SIGALRM_MASK; | 113 | signals_active &= ~SIGALRM_MASK; |
112 | 114 | ||
113 | set_signals(enabled); | 115 | set_signals_trace(enabled); |
114 | } | 116 | } |
115 | 117 | ||
116 | void deliver_alarm(void) { | 118 | void deliver_alarm(void) { |
@@ -251,6 +253,8 @@ void unblock_signals(void) | |||
251 | if (signals_enabled == 1) | 253 | if (signals_enabled == 1) |
252 | return; | 254 | return; |
253 | 255 | ||
256 | signals_enabled = 1; | ||
257 | |||
254 | /* | 258 | /* |
255 | * We loop because the IRQ handler returns with interrupts off. So, | 259 | * We loop because the IRQ handler returns with interrupts off. So, |
256 | * interrupts may have arrived and we need to re-enable them and | 260 | * interrupts may have arrived and we need to re-enable them and |
@@ -260,12 +264,9 @@ void unblock_signals(void) | |||
260 | /* | 264 | /* |
261 | * Save and reset save_pending after enabling signals. This | 265 | * Save and reset save_pending after enabling signals. This |
262 | * way, signals_pending won't be changed while we're reading it. | 266 | * way, signals_pending won't be changed while we're reading it. |
263 | */ | 267 | * |
264 | signals_enabled = 1; | ||
265 | |||
266 | /* | ||
267 | * Setting signals_enabled and reading signals_pending must | 268 | * Setting signals_enabled and reading signals_pending must |
268 | * happen in this order. | 269 | * happen in this order, so have the barrier here. |
269 | */ | 270 | */ |
270 | barrier(); | 271 | barrier(); |
271 | 272 | ||
@@ -278,10 +279,13 @@ void unblock_signals(void) | |||
278 | /* | 279 | /* |
279 | * We have pending interrupts, so disable signals, as the | 280 | * We have pending interrupts, so disable signals, as the |
280 | * handlers expect them off when they are called. They will | 281 | * handlers expect them off when they are called. They will |
281 | * be enabled again above. | 282 | * be enabled again above. We need to trace this, as we're |
283 | * expected to be enabling interrupts already, but any more | ||
284 | * tracing that happens inside the handlers we call for the | ||
285 | * pending signals will mess up the tracing state. | ||
282 | */ | 286 | */ |
283 | |||
284 | signals_enabled = 0; | 287 | signals_enabled = 0; |
288 | um_trace_signals_off(); | ||
285 | 289 | ||
286 | /* | 290 | /* |
287 | * Deal with SIGIO first because the alarm handler might | 291 | * Deal with SIGIO first because the alarm handler might |
@@ -304,6 +308,9 @@ void unblock_signals(void) | |||
304 | if (!(signals_pending & SIGIO_MASK) && (signals_active & SIGALRM_MASK)) | 308 | if (!(signals_pending & SIGIO_MASK) && (signals_active & SIGALRM_MASK)) |
305 | return; | 309 | return; |
306 | 310 | ||
311 | /* Re-enable signals and trace that we're doing so. */ | ||
312 | um_trace_signals_on(); | ||
313 | signals_enabled = 1; | ||
307 | } | 314 | } |
308 | } | 315 | } |
309 | 316 | ||
@@ -326,6 +333,21 @@ int set_signals(int enable) | |||
326 | return ret; | 333 | return ret; |
327 | } | 334 | } |
328 | 335 | ||
336 | int set_signals_trace(int enable) | ||
337 | { | ||
338 | int ret; | ||
339 | if (signals_enabled == enable) | ||
340 | return enable; | ||
341 | |||
342 | ret = signals_enabled; | ||
343 | if (enable) | ||
344 | unblock_signals_trace(); | ||
345 | else | ||
346 | block_signals_trace(); | ||
347 | |||
348 | return ret; | ||
349 | } | ||
350 | |||
329 | int os_is_signal_stack(void) | 351 | int os_is_signal_stack(void) |
330 | { | 352 | { |
331 | stack_t ss; | 353 | stack_t ss; |
diff --git a/arch/um/os-Linux/skas/Makefile b/arch/um/os-Linux/skas/Makefile index d2ea3409e072..c4566e788815 100644 --- a/arch/um/os-Linux/skas/Makefile +++ b/arch/um/os-Linux/skas/Makefile | |||
@@ -1,6 +1,6 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Copyright (C) 2002 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com) | 3 | # Copyright (C) 2002 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com) |
3 | # Licensed under the GPL | ||
4 | # | 4 | # |
5 | 5 | ||
6 | obj-y := mem.o process.o | 6 | obj-y := mem.o process.o |
diff --git a/arch/um/os-Linux/skas/mem.c b/arch/um/os-Linux/skas/mem.c index 35015e3e1e87..c546d16f8dfe 100644 --- a/arch/um/os-Linux/skas/mem.c +++ b/arch/um/os-Linux/skas/mem.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <stddef.h> | 6 | #include <stddef.h> |
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c index df4a985716eb..4fb877b99dde 100644 --- a/arch/um/os-Linux/skas/process.c +++ b/arch/um/os-Linux/skas/process.c | |||
@@ -1,7 +1,7 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2015 Thomas Meyer (thomas@m3y3r.de) | 3 | * Copyright (C) 2015 Thomas Meyer (thomas@m3y3r.de) |
3 | * Copyright (C) 2002- 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 4 | * Copyright (C) 2002- 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
4 | * Licensed under the GPL | ||
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <stdlib.h> | 7 | #include <stdlib.h> |
@@ -425,9 +425,9 @@ void userspace(struct uml_pt_regs *regs, unsigned long *aux_fp_regs) | |||
425 | case SIGBUS: | 425 | case SIGBUS: |
426 | case SIGFPE: | 426 | case SIGFPE: |
427 | case SIGWINCH: | 427 | case SIGWINCH: |
428 | block_signals(); | 428 | block_signals_trace(); |
429 | (*sig_info[sig])(sig, (struct siginfo *)&si, regs); | 429 | (*sig_info[sig])(sig, (struct siginfo *)&si, regs); |
430 | unblock_signals(); | 430 | unblock_signals_trace(); |
431 | break; | 431 | break; |
432 | default: | 432 | default: |
433 | printk(UM_KERN_ERR "userspace - child stopped " | 433 | printk(UM_KERN_ERR "userspace - child stopped " |
@@ -625,10 +625,10 @@ void initial_thread_cb_skas(void (*proc)(void *), void *arg) | |||
625 | cb_arg = arg; | 625 | cb_arg = arg; |
626 | cb_back = &here; | 626 | cb_back = &here; |
627 | 627 | ||
628 | block_signals(); | 628 | block_signals_trace(); |
629 | if (UML_SETJMP(&here) == 0) | 629 | if (UML_SETJMP(&here) == 0) |
630 | UML_LONGJMP(&initial_jmpbuf, INIT_JMP_CALLBACK); | 630 | UML_LONGJMP(&initial_jmpbuf, INIT_JMP_CALLBACK); |
631 | unblock_signals(); | 631 | unblock_signals_trace(); |
632 | 632 | ||
633 | cb_proc = NULL; | 633 | cb_proc = NULL; |
634 | cb_arg = NULL; | 634 | cb_arg = NULL; |
@@ -637,13 +637,13 @@ void initial_thread_cb_skas(void (*proc)(void *), void *arg) | |||
637 | 637 | ||
638 | void halt_skas(void) | 638 | void halt_skas(void) |
639 | { | 639 | { |
640 | block_signals(); | 640 | block_signals_trace(); |
641 | UML_LONGJMP(&initial_jmpbuf, INIT_JMP_HALT); | 641 | UML_LONGJMP(&initial_jmpbuf, INIT_JMP_HALT); |
642 | } | 642 | } |
643 | 643 | ||
644 | void reboot_skas(void) | 644 | void reboot_skas(void) |
645 | { | 645 | { |
646 | block_signals(); | 646 | block_signals_trace(); |
647 | UML_LONGJMP(&initial_jmpbuf, INIT_JMP_REBOOT); | 647 | UML_LONGJMP(&initial_jmpbuf, INIT_JMP_REBOOT); |
648 | } | 648 | } |
649 | 649 | ||
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c index 82bf5f8442ba..f79dc338279e 100644 --- a/arch/um/os-Linux/start_up.c +++ b/arch/um/os-Linux/start_up.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <stdio.h> | 6 | #include <stdio.h> |
diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c index 6d94ff52362c..432f8e1f55c2 100644 --- a/arch/um/os-Linux/time.c +++ b/arch/um/os-Linux/time.c | |||
@@ -1,9 +1,9 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2015 Anton Ivanov (aivanov@{brocade.com,kot-begemot.co.uk}) | 3 | * Copyright (C) 2015 Anton Ivanov (aivanov@{brocade.com,kot-begemot.co.uk}) |
3 | * Copyright (C) 2015 Thomas Meyer (thomas@m3y3r.de) | 4 | * Copyright (C) 2015 Thomas Meyer (thomas@m3y3r.de) |
4 | * Copyright (C) 2012-2014 Cisco Systems | 5 | * Copyright (C) 2012-2014 Cisco Systems |
5 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike{addtoit,linux.intel}.com) | 6 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike{addtoit,linux.intel}.com) |
6 | * Licensed under the GPL | ||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <stddef.h> | 9 | #include <stddef.h> |
diff --git a/arch/um/os-Linux/tty.c b/arch/um/os-Linux/tty.c index 721d8afa329b..f784db83e026 100644 --- a/arch/um/os-Linux/tty.c +++ b/arch/um/os-Linux/tty.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <stdlib.h> | 6 | #include <stdlib.h> |
diff --git a/arch/um/os-Linux/umid.c b/arch/um/os-Linux/umid.c index e261656fe9d7..44def53a11cd 100644 --- a/arch/um/os-Linux/umid.c +++ b/arch/um/os-Linux/umid.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <stdio.h> | 6 | #include <stdio.h> |
diff --git a/arch/um/os-Linux/util.c b/arch/um/os-Linux/util.c index 8cc8b2617a67..ecf2f390fad2 100644 --- a/arch/um/os-Linux/util.c +++ b/arch/um/os-Linux/util.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 3 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <stdio.h> | 6 | #include <stdio.h> |
diff --git a/arch/x86/um/asm/barrier.h b/arch/x86/um/asm/barrier.h index f31e5d903161..165be7f9a964 100644 --- a/arch/x86/um/asm/barrier.h +++ b/arch/x86/um/asm/barrier.h | |||
@@ -2,14 +2,7 @@ | |||
2 | #ifndef _ASM_UM_BARRIER_H_ | 2 | #ifndef _ASM_UM_BARRIER_H_ |
3 | #define _ASM_UM_BARRIER_H_ | 3 | #define _ASM_UM_BARRIER_H_ |
4 | 4 | ||
5 | #include <asm/asm.h> | 5 | #include <asm/alternative.h> |
6 | #include <asm/segment.h> | ||
7 | #include <asm/cpufeatures.h> | ||
8 | #include <asm/cmpxchg.h> | ||
9 | #include <asm/nops.h> | ||
10 | |||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/irqflags.h> | ||
13 | 6 | ||
14 | /* | 7 | /* |
15 | * Force strict CPU ordering. | 8 | * Force strict CPU ordering. |
@@ -30,9 +23,6 @@ | |||
30 | 23 | ||
31 | #endif /* CONFIG_X86_32 */ | 24 | #endif /* CONFIG_X86_32 */ |
32 | 25 | ||
33 | #define dma_rmb() barrier() | ||
34 | #define dma_wmb() barrier() | ||
35 | |||
36 | #include <asm-generic/barrier.h> | 26 | #include <asm-generic/barrier.h> |
37 | 27 | ||
38 | #endif | 28 | #endif |
diff --git a/arch/x86/um/vdso/um_vdso.c b/arch/x86/um/vdso/um_vdso.c index ac9c02b9d92c..891868756a51 100644 --- a/arch/x86/um/vdso/um_vdso.c +++ b/arch/x86/um/vdso/um_vdso.c | |||
@@ -47,7 +47,7 @@ time_t __vdso_time(time_t *t) | |||
47 | 47 | ||
48 | return secs; | 48 | return secs; |
49 | } | 49 | } |
50 | int time(time_t *t) __attribute__((weak, alias("__vdso_time"))); | 50 | time_t time(time_t *t) __attribute__((weak, alias("__vdso_time"))); |
51 | 51 | ||
52 | long | 52 | long |
53 | __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused) | 53 | __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused) |
diff --git a/init/Kconfig b/init/Kconfig index 7020238fd263..058ba4e74250 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -54,7 +54,6 @@ config CC_DISABLE_WARN_MAYBE_UNINITIALIZED | |||
54 | 54 | ||
55 | config CONSTRUCTORS | 55 | config CONSTRUCTORS |
56 | bool | 56 | bool |
57 | depends on !UML | ||
58 | 57 | ||
59 | config IRQ_WORK | 58 | config IRQ_WORK |
60 | bool | 59 | bool |
diff --git a/kernel/gcov/Kconfig b/kernel/gcov/Kconfig index 3941a9c48f83..060e8e726755 100644 --- a/kernel/gcov/Kconfig +++ b/kernel/gcov/Kconfig | |||
@@ -4,7 +4,7 @@ menu "GCOV-based kernel profiling" | |||
4 | config GCOV_KERNEL | 4 | config GCOV_KERNEL |
5 | bool "Enable gcov-based kernel profiling" | 5 | bool "Enable gcov-based kernel profiling" |
6 | depends on DEBUG_FS | 6 | depends on DEBUG_FS |
7 | select CONSTRUCTORS if !UML | 7 | select CONSTRUCTORS |
8 | default n | 8 | default n |
9 | ---help--- | 9 | ---help--- |
10 | This option enables gcov-based code profiling (e.g. for code coverage | 10 | This option enables gcov-based code profiling (e.g. for code coverage |