From 8e26317a3d619a2cc00d1270a00886c7a1241a97 Mon Sep 17 00:00:00 2001 From: Ivan Kardykov Date: Wed, 7 Jul 2021 15:24:02 +0300 Subject: [PATCH] Add Intel GVT-g support (xengt device) --- qemu/patches/qemu-stub-xengt-support.patch | 91 ++++++++++++++++++++++ qemu/patches/series | 1 + rpm_spec/xen-hvm-stubdom-linux.spec.in | 2 + 3 files changed, 94 insertions(+) create mode 100644 qemu/patches/qemu-stub-xengt-support.patch diff --git a/qemu/patches/qemu-stub-xengt-support.patch b/qemu/patches/qemu-stub-xengt-support.patch new file mode 100644 index 0000000..6b3c5dd --- /dev/null +++ b/qemu/patches/qemu-stub-xengt-support.patch @@ -0,0 +1,91 @@ +From 01818d9d2af100d56e2701690bbac4a87576f0e9 Mon Sep 17 00:00:00 2001 +From: Ivan Kardykov +Date: Sun, 2 Jan 2022 23:36:21 +0300 +Subject: [PATCH] Add stubdom xengt support + +--- + hw/pci/pci.c | 4 ++++ + include/sysemu/sysemu.h | 2 +- + qemu-options.hx | 7 ++++++- + softmmu/vl.c | 5 +++++ + 4 files changed, 16 insertions(+), 2 deletions(-) + +diff --git a/hw/pci/pci.c b/hw/pci/pci.c +index 23d2ae2ab..40838559a 100644 +--- a/hw/pci/pci.c ++++ b/hw/pci/pci.c +@@ -1062,6 +1062,10 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, + if (devfn < 0) { + for(devfn = bus->devfn_min ; devfn < ARRAY_SIZE(bus->devices); + devfn += PCI_FUNC_MAX) { ++ /* If vGT/XenGT is in use, reserve 00:02.* for the IGD */ ++ if (vga_interface_type == VGA_VGT && devfn == 0x10) ++ continue; ++ + if (pci_bus_devfn_available(bus, devfn) && + !pci_bus_devfn_reserved(bus, devfn)) { + goto found; +diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h +index 8fae66717..a6d228927 100644 +--- a/include/sysemu/sysemu.h ++++ b/include/sysemu/sysemu.h +@@ -28,7 +28,7 @@ extern int autostart; + + typedef enum { + VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB, VGA_QXL, +- VGA_TCX, VGA_CG3, VGA_DEVICE, VGA_VIRTIO, ++ VGA_TCX, VGA_CG3, VGA_DEVICE, VGA_VIRTIO, VGA_VGT, + VGA_TYPE_MAX, + } VGAInterfaceType; + +diff --git a/qemu-options.hx b/qemu-options.hx +index 83aa59a92..07d2696e4 100644 +--- a/qemu-options.hx ++++ b/qemu-options.hx +@@ -2131,7 +2131,7 @@ SRST + ERST + + DEF("vga", HAS_ARG, QEMU_OPTION_vga, +- "-vga [std|cirrus|vmware|qxl|xenfb|tcx|cg3|virtio|none]\n" ++ "-vga [std|cirrus|vmware|qxl|xenfb|tcx|cg3|virtio|xengt|none]\n" + " select video card type\n", QEMU_ARCH_ALL) + SRST + ``-vga type`` +@@ -2175,6 +2175,11 @@ SRST + ``virtio`` + Virtio VGA card. + ++ ``xengt`` ++ Intel IGD card based on mediated pass-through technique. A single ++ IGD card can be used to accelerate multiple VMs, which each run ++ native graphics driver inside. ++ + ``none`` + Disable VGA card. + ERST +diff --git a/softmmu/vl.c b/softmmu/vl.c +index 5ca11e746..116095d5d 100644 +--- a/softmmu/vl.c ++++ b/softmmu/vl.c +@@ -906,6 +906,10 @@ static const VGAInterfaceInfo vga_interfaces[VGA_TYPE_MAX] = { + .opt_name = "xenfb", + .name = "Xen paravirtualized framebuffer", + }, ++ [VGA_VGT] = { ++ .opt_name = "xengt", ++ .name = "Intel GVT-g", ++ }, + }; + + static bool vga_interface_available(VGAInterfaceType t) +@@ -960,6 +964,7 @@ static void select_vgahw(const MachineClass *machine_class, const char *p) + exit(1); + } + vga_interface_type = t; ++ printf("%s vga is %s\n", __func__, ti->opt_name); + break; + } + } +-- +2.31.1 + diff --git a/qemu/patches/series b/qemu/patches/series index c4a67c5..e383f41 100644 --- a/qemu/patches/series +++ b/qemu/patches/series @@ -18,3 +18,4 @@ 0018-pc-bios-ignore-prebuilt-binaries.patch seabios-python3.patch vgasrc-ignore-.node.gnu.property-binutils-2.36-suppo.patch +qemu-stub-xengt-support.patch diff --git a/rpm_spec/xen-hvm-stubdom-linux.spec.in b/rpm_spec/xen-hvm-stubdom-linux.spec.in index 3d8dfb8..2035914 100644 --- a/rpm_spec/xen-hvm-stubdom-linux.spec.in +++ b/rpm_spec/xen-hvm-stubdom-linux.spec.in @@ -15,6 +15,8 @@ URL: https://www.qubes-os.org/ Requires: xen-libs >= 2001:4.14.3-5 +Provides: xen-hvm-stubdom-gvt + BuildRequires: quilt # QEMU