Skip to contentSkip to conversation

Keyboard/Mouse Console for vfio with active function x-vga ans -vga none

PATCH In review qemu Mailinglist 2 participants 3 messages Apr 10, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Keyboard/Mouse Console for vfio with active function x-vga ans -vga none

there are many discus about using keyboard and mouse with VGA passthru, so I add a graphic_console to vfio.c, like puv3.c.
I test it with SDL and VNC Access, the Keyboard works, the mouse work good without absolute version like "-usbdevice mouse". Default it boot with "QEMU PS/2 Mouse", but this is changing to "vmmouse (absolute)" at boot time of gast system.

I hope someone else can test.

---
 hw/misc/vfio.c | 5 +++++
 1 file changed, 5 insertions(+)
hw/misc/vfio.c +1 -0
index 9cf5b84..9294041 100644
@@ -39,6 +39,7 @@
 #include "qemu/range.h"
 #include "sysemu/kvm.h"
 #include "sysemu/sysemu.h"
+#include "ui/console.h"
 
 /* #define DEBUG_VFIO */
 #ifdef DEBUG_VFIO
@@ -3586,6 +3587,10 @@ static int vfio_get_device(VFIOGroup *group,

const char *name, VFIODevice *vdev)

         QLIST_INIT(&vdev->vga.region[QEMU_PCI_VGA_IO_HI].quirks);
 
         vdev->has_vga = true;

+ if (vga_interface_type == VGA_NONE) {
+ static const GraphicHwOps no_ops;
+ graphic_console_init(NULL, 0, &no_ops, NULL);
+ }

     }
     irq_info.index = VFIO_PCI_ERR_IRQ_INDEX;
Signature · 1 line
1.9.1
#1 lore raw
Quoted 28 lines · qemu Mailinglist

there are many discus about using keyboard and mouse with VGA passthru, so I add a graphic_console to vfio.c, like puv3.c.
I test it with SDL and VNC Access, the Keyboard works, the mouse work good without absolute version like "-usbdevice mouse". Default it boot with "QEMU PS/2 Mouse", but this is changing to "vmmouse (absolute)" at boot time of gast system.

I hope someone else can test.

---
 hw/misc/vfio.c | 5 +++++
 1 file changed, 5 insertions(+)
hw/misc/vfio.c +1 -0
index 9cf5b84..9294041 100644
@@ -39,6 +39,7 @@
 #include "qemu/range.h"
 #include "sysemu/kvm.h"
 #include "sysemu/sysemu.h"
+#include "ui/console.h"
 
 /* #define DEBUG_VFIO */
 #ifdef DEBUG_VFIO

hw/misc/vfio.c static int vfio_get_device(VFIOGroup *group, · line 3596

Quoted 10 lines
hw/misc/vfio.c +4 -0
@@ -3586,6 +3587,10 @@ static int vfio_get_device(VFIOGroup *group,
 const char *name, VFIODevice *vdev)
         QLIST_INIT(&vdev->vga.region[QEMU_PCI_VGA_IO_HI].quirks);
 
         vdev->has_vga = true;
+        if (vga_interface_type == VGA_NONE) {
+            static const GraphicHwOps no_ops;
+            graphic_console_init(NULL, 0, &no_ops, NULL);
+        }
     }
     irq_info.index = VFIO_PCI_ERR_IRQ_INDEX;

I don't think vfio is the one to be creating a dummy console, besides there's no reason you can't have multiple vfio devices with x-vga=on. There should probably be some dummy console driver so you can add -device dummy-console to the commandline if this is desired. Thanks,

Alex

#2 lore raw

Am 10.04.2014 22:29, schrieb Alex Williamson:

Quoted 6 lines

I don't think vfio is the one to be creating a dummy console, besides there's no reason you can't have multiple vfio devices with x-vga=on. There should probably be some dummy console driver so you can add -device dummy-console to the commandline if this is desired. Thanks,

Alex

Hi Alex,

thanks for the fast answer, I had no luck with the dummy devices, so I have to forward additional input devices via usbpassthru or pcipassthru of a USB Card.

The other console_inits are in the device files like: ( some from 30 files total)
./hw/unicore32/puv3.c:101: graphic_console_init(NULL, 0, &no_ops, NULL);
./hw/display/pl110.c:467: s->con = graphic_console_init(dev, 0,
&pl110_gfx_ops, s);
./hw/display/vga-isa-mm.c:138: s->vga.con =
graphic_console_init(NULL, 0, s->vga.hw_ops, s);
./hw/display/exynos4210_fimd.c:1920: s->console =
graphic_console_init(DEVICE(dev), 0, &exynos4210_fimd_ops, s);
./hw/display/vmware_vga.c:1203: s->vga.con =
graphic_console_init(dev, 0, &vmsvga_ops, s);
./hw/display/cirrus_vga.c:2920: s->con = graphic_console_init(dev, 0,
s->hw_ops, s);
./hw/display/cirrus_vga.c:2966: s->vga.con =
graphic_console_init(DEVICE(dev), 0, s->vga.hw_ops, &s->vga);
./hw/display/vga-pci.c:154: s->con =
graphic_console_init(DEVICE(dev), 0, s->hw_ops, s);

But you are right, its more a feature with a additional parameter for x-vga.

Thanks,
Tobias