18977bd11SGerd Hoffmann 28977bd11SGerd Hoffmannmultiseat howto (with some multihead coverage) 38977bd11SGerd Hoffmann============================================== 48977bd11SGerd Hoffmann 55cce1733SGerd Hoffmannhost devices 65cce1733SGerd Hoffmann------------ 78977bd11SGerd Hoffmann 88977bd11SGerd HoffmannFirst you must compile qemu with a user interface supporting 990525fe2SGerd Hoffmannmultihead/multiseat and input event routing. Right now this 1086fdcf23SGerd Hoffmannlist includes sdl2, gtk (both 2+3) and vnc: 118977bd11SGerd Hoffmann 12335dbb5dSThomas Huth ./configure --enable-sdl 138977bd11SGerd Hoffmann 1490525fe2SGerd Hoffmannor 1590525fe2SGerd Hoffmann 1690525fe2SGerd Hoffmann ./configure --enable-gtk 1790525fe2SGerd Hoffmann 188977bd11SGerd Hoffmann 1986fdcf23SGerd HoffmannNext put together the qemu command line (sdk/gtk): 208977bd11SGerd Hoffmann 21a1d30f28SThomas Huthqemu -accel kvm -usb $memory $disk $whatever \ 2290525fe2SGerd Hoffmann -display [ sdl | gtk ] \ 238977bd11SGerd Hoffmann -vga std \ 248977bd11SGerd Hoffmann -device usb-tablet 258977bd11SGerd Hoffmann 2686fdcf23SGerd HoffmannThat is it for the first seat, which will use the standard vga, the 278977bd11SGerd Hoffmannstandard ps/2 keyboard (implicitly there) and the usb-tablet. Now the 2886fdcf23SGerd Hoffmannadditional switches for the second seat: 298977bd11SGerd Hoffmann 308977bd11SGerd Hoffmann -device pci-bridge,addr=12.0,chassis_nr=2,id=head.2 \ 318977bd11SGerd Hoffmann -device secondary-vga,bus=head.2,addr=02.0,id=video.2 \ 328977bd11SGerd Hoffmann -device nec-usb-xhci,bus=head.2,addr=0f.0,id=usb.2 \ 338977bd11SGerd Hoffmann -device usb-kbd,bus=usb.2.0,port=1,display=video.2 \ 348977bd11SGerd Hoffmann -device usb-tablet,bus=usb.2.0,port=2,display=video.2 358977bd11SGerd Hoffmann 368977bd11SGerd HoffmannThis places a pci bridge in slot 12, connects a display adapter and 378977bd11SGerd Hoffmannxhci (usb) controller to the bridge. Then it adds a usb keyboard and 388977bd11SGerd Hoffmannusb mouse, both connected to the xhci and linked to the display. 398977bd11SGerd Hoffmann 408977bd11SGerd HoffmannThe "display=video2" sets up the input routing. Any input coming from 418977bd11SGerd Hoffmannthe window which belongs to the video.2 display adapter will be routed 428977bd11SGerd Hoffmannto these input devices. 438977bd11SGerd Hoffmann 445cce1733SGerd HoffmannStarting with qemu 2.4 and linux kernel 4.1 you can also use virtio 455cce1733SGerd Hoffmannfor the input devices, using this ... 465cce1733SGerd Hoffmann 475cce1733SGerd Hoffmann -device pci-bridge,addr=12.0,chassis_nr=2,id=head.2 \ 485cce1733SGerd Hoffmann -device secondary-vga,bus=head.2,addr=02.0,id=video.2 \ 495cce1733SGerd Hoffmann -device virtio-keyboard-pci,bus=head.2,addr=03.0,display=video.2 \ 505cce1733SGerd Hoffmann -device virtio-tablet-pci,bus=head.2,addr=03.0,display=video.2 515cce1733SGerd Hoffmann 525cce1733SGerd Hoffmann... instead of xhci and usb hid devices. 535cce1733SGerd Hoffmann 545cce1733SGerd Hoffmannhost ui 555cce1733SGerd Hoffmann------- 565cce1733SGerd Hoffmann 5790525fe2SGerd HoffmannThe sdl2 ui will start up with two windows, one for each display 5890525fe2SGerd Hoffmanndevice. The gtk ui will start with a single window and each display 5990525fe2SGerd Hoffmannin a separate tab. You can either simply switch tabs to switch heads, 6090525fe2SGerd Hoffmannor use the "View / Detach tab" menu item to move one of the displays 6190525fe2SGerd Hoffmannto its own window so you can see both display devices side-by-side. 6290525fe2SGerd Hoffmann 6386fdcf23SGerd HoffmannFor vnc some additional configuration on the command line is needed. 6486fdcf23SGerd HoffmannWe'll create two vnc server instances, and bind the second one to the 659277d81fSVille Skyttäsecond seat, similar to input devices: 6686fdcf23SGerd Hoffmann 6786fdcf23SGerd Hoffmann -display vnc=:1,id=primary \ 6886fdcf23SGerd Hoffmann -display vnc=:2,id=secondary,display=video.2 6986fdcf23SGerd Hoffmann 7086fdcf23SGerd HoffmannConnecting to vnc display :1 gives you access to the first seat, and 7186fdcf23SGerd Hoffmannlikewise connecting to vnc display :2 shows the second seat. 7286fdcf23SGerd Hoffmann 732082bac1SGerd HoffmannNote on spice: Spice handles multihead just fine. But it can't do 742082bac1SGerd Hoffmannmultiseat. For tablet events the event source is sent to the spice 752082bac1SGerd Hoffmannagent. But qemu can't figure it, so it can't do input routing. 762082bac1SGerd HoffmannFixing this needs a new or extended input interface between 772082bac1SGerd Hoffmannlibspice-server and qemu. For keyboard events it is even worse: The 782082bac1SGerd Hoffmannevent source isn't included in the spice protocol, so the wire 792082bac1SGerd Hoffmannprotocol must be extended to support this. 802082bac1SGerd Hoffmann 818977bd11SGerd Hoffmann 828977bd11SGerd Hoffmannguest side 838977bd11SGerd Hoffmann---------- 848977bd11SGerd Hoffmann 858977bd11SGerd HoffmannYou need a pretty recent linux guest. systemd with loginctl. kernel 868977bd11SGerd Hoffmann3.14+ with CONFIG_DRM_BOCHS enabled. Fedora 20 will do. Must be 878977bd11SGerd Hoffmannfully updated for the new kernel though, i.e. the live iso doesn't cut 888977bd11SGerd Hoffmannit. 898977bd11SGerd Hoffmann 903503206aSGerd HoffmannNow we'll have to configure the guest. Boot and login. "lspci -vt" 913503206aSGerd Hoffmannshould list the pci bridge with the display adapter and usb controller: 928977bd11SGerd Hoffmann 933503206aSGerd Hoffmann [root@fedora ~]# lspci -vt 943503206aSGerd Hoffmann -[0000:00]-+-00.0 Intel Corporation 440FX - 82441FX PMC [Natoma] 953503206aSGerd Hoffmann [ ... ] 963503206aSGerd Hoffmann \-12.0-[01]--+-02.0 Device 1234:1111 973503206aSGerd Hoffmann \-0f.0 NEC Corporation USB 3.0 Host Controller 988977bd11SGerd Hoffmann 993503206aSGerd HoffmannGood. Now lets tell the system that the pci bridge and all devices 1003503206aSGerd Hoffmannbelow it belong to a separate seat by dropping a file into 1013503206aSGerd Hoffmann/etc/udev/rules.d: 1028977bd11SGerd Hoffmann 1033503206aSGerd Hoffmann [root@fedora ~]# cat /etc/udev/rules.d/70-qemu-autoseat.rules 1043503206aSGerd Hoffmann SUBSYSTEMS=="pci", DEVPATH=="*/0000:00:12.0", TAG+="seat", ENV{ID_AUTOSEAT}="1" 1058977bd11SGerd Hoffmann 1063503206aSGerd HoffmannReboot. System should come up with two seats. With loginctl you can 1073503206aSGerd Hoffmanncheck the configuration: 1083503206aSGerd Hoffmann 1093503206aSGerd Hoffmann [root@fedora ~]# loginctl list-seats 1103503206aSGerd Hoffmann SEAT 1113503206aSGerd Hoffmann seat0 1123503206aSGerd Hoffmann seat-pci-pci-0000_00_12_0 1133503206aSGerd Hoffmann 1143503206aSGerd Hoffmann 2 seats listed. 1153503206aSGerd Hoffmann 1163503206aSGerd HoffmannYou can use "loginctl seat-status seat-pci-pci-0000_00_12_0" to list 1173503206aSGerd Hoffmannthe devices attached to the seat. 1183503206aSGerd Hoffmann 1193503206aSGerd HoffmannBackground info is here: 1203503206aSGerd Hoffmann http://www.freedesktop.org/wiki/Software/systemd/multiseat/ 1218977bd11SGerd Hoffmann 122eb6c6a60SGerd Hoffmann 123eb6c6a60SGerd Hoffmannguest side with pci-bridge-seat 124eb6c6a60SGerd Hoffmann------------------------------- 125eb6c6a60SGerd Hoffmann 126*5135fe71SPhilippe Mathieu-DaudéQEMU version 2.4 and newer has a new pci-bridge-seat device which 127eb6c6a60SGerd Hoffmanncan be used instead of pci-bridge. Just swap the device name in the 128eb6c6a60SGerd Hoffmannqemu command line above. The only difference between the two devices 129eb6c6a60SGerd Hoffmannis the pci id. We can match the pci id instead of the device path 130eb6c6a60SGerd Hoffmannwith a nice generic rule now, which simplifies the guest 131eb6c6a60SGerd Hoffmannconfiguration: 132eb6c6a60SGerd Hoffmann 133eb6c6a60SGerd Hoffmann [root@fedora ~]# cat /etc/udev/rules.d/70-qemu-pci-bridge-seat.rules 134eb6c6a60SGerd Hoffmann SUBSYSTEM=="pci", ATTR{vendor}=="0x1b36", ATTR{device}=="0x000a", \ 135eb6c6a60SGerd Hoffmann TAG+="seat", ENV{ID_AUTOSEAT}="1" 136eb6c6a60SGerd Hoffmann 137496eacaaSGerd HoffmannPatch with this rule has been submitted to upstream udev/systemd, was 138b6af0975SDaniel P. Berrangeaccepted and should be included in the next systemd release (222). 139496eacaaSGerd HoffmannSo, if your guest has this or a newer version, multiseat will work just 140496eacaaSGerd Hoffmannfine without any manual guest configuration. 141eb6c6a60SGerd Hoffmann 1428977bd11SGerd HoffmannEnjoy! 1438977bd11SGerd Hoffmann 1448977bd11SGerd Hoffmann-- 1458977bd11SGerd HoffmannGerd Hoffmann <kraxel@redhat.com> 146