From 18ae9a9ae240ef6868622510b76b856a62d36c71 Mon Sep 17 00:00:00 2001 From: Konstantin Kostiuk Date: Tue, 6 Dec 2022 12:19:40 +0200 Subject: [PATCH] Fix USB support for Windows resolves: rhbz#2090333 Signed-off-by: Konstantin Kostiuk --- 0001-Change-Version.patch | 2 +- 0002-qga-win-usb-support.patch | 117 +++++++++++++++++++++++++++++++++ mingw-qemu-ga-win.spec | 17 +++-- 3 files changed, 129 insertions(+), 7 deletions(-) create mode 100644 0002-qga-win-usb-support.patch diff --git a/0001-Change-Version.patch b/0001-Change-Version.patch index 7449f5f..55b5331 100644 --- a/0001-Change-Version.patch +++ b/0001-Change-Version.patch @@ -14,6 +14,6 @@ index 91ff57278e..586de296f5 100644 +++ b/VERSION @@ -1 +1 @@ -7.1.0 -+105.0.0 ++105.0.1 -- 2.17.2 diff --git a/0002-qga-win-usb-support.patch b/0002-qga-win-usb-support.patch new file mode 100644 index 0000000..184b9c8 --- /dev/null +++ b/0002-qga-win-usb-support.patch @@ -0,0 +1,117 @@ +From git@z Thu Jan 1 00:00:00 1970 +Subject: [PATCH 1/2] qga:/qga-win: adding a empty PCI address creation function +From: Kfir Manor +Date: Sun, 20 Nov 2022 16:00:43 +0200 +Message-Id: <20221120140044.752503-2-kfir@daynix.com> +To: qemu-devel@nongnu.org, Konstantin Kostiuk , Michael Roth +Cc: Yan Vugenfirer +In-Reply-To: <20221120140044.752503-1-kfir@daynix.com> +References: <20221120140044.752503-1-kfir@daynix.com> +List-Id: +MIME-Version: 1.0 +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 8bit + +Refactoring code to avoid duplication of creating an empty PCI address code. + +Signed-off-by: Kfir Manor +Reviewed-by: Konstantin Kostiuk +Reviewed-by: Marc-André Lureau +--- + qga/commands-win32.c | 20 +++++++++++++------- + 1 file changed, 13 insertions(+), 7 deletions(-) + +diff --git a/qga/commands-win32.c b/qga/commands-win32.c +index ec9f55b453..a645480496 100644 +--- a/qga/commands-win32.c ++++ b/qga/commands-win32.c +@@ -599,6 +599,18 @@ static void get_pci_address_for_device(GuestPCIAddress *pci, + } + } + ++static GuestPCIAddress *get_empty_pci_address(void) ++{ ++ GuestPCIAddress *pci = NULL; ++ ++ pci = g_malloc0(sizeof(*pci)); ++ pci->domain = -1; ++ pci->slot = -1; ++ pci->function = -1; ++ pci->bus = -1; ++ return pci; ++} ++ + static GuestPCIAddress *get_pci_info(int number, Error **errp) + { + HDEVINFO dev_info = INVALID_HANDLE_VALUE; +@@ -608,13 +620,7 @@ static GuestPCIAddress *get_pci_info(int number, Error **errp) + SP_DEVICE_INTERFACE_DATA dev_iface_data; + HANDLE dev_file; + int i; +- GuestPCIAddress *pci = NULL; +- +- pci = g_malloc0(sizeof(*pci)); +- pci->domain = -1; +- pci->slot = -1; +- pci->function = -1; +- pci->bus = -1; ++ GuestPCIAddress *pci = get_empty_pci_address(); + + dev_info = SetupDiGetClassDevs(&GUID_DEVINTERFACE_DISK, 0, 0, + DIGCF_PRESENT | DIGCF_DEVICEINTERFACE); + +-- +2.38.1 + + +From git@z Thu Jan 1 00:00:00 1970 +Subject: [PATCH 2/2] qga:/qga-win: skip getting pci info for USB disks +From: Kfir Manor +Date: Sun, 20 Nov 2022 16:00:44 +0200 +Message-Id: <20221120140044.752503-3-kfir@daynix.com> +To: qemu-devel@nongnu.org, Konstantin Kostiuk , Michael Roth +Cc: Yan Vugenfirer +In-Reply-To: <20221120140044.752503-1-kfir@daynix.com> +References: <20221120140044.752503-1-kfir@daynix.com> +List-Id: +MIME-Version: 1.0 +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 8bit + +Skip getting PCI info from disks type USB and give them an empty PCI address instead. + +Signed-off-by: Kfir Manor +Reviewed-by: Konstantin Kostiuk +Reviewed-by: Marc-André Lureau +--- + qga/commands-win32.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/qga/commands-win32.c b/qga/commands-win32.c +index a645480496..14c43b3de5 100644 +--- a/qga/commands-win32.c ++++ b/qga/commands-win32.c +@@ -878,10 +878,14 @@ static void get_single_disk_info(int disk_number, + * if that doesn't hold since that suggests some other unexpected + * breakage + */ +- disk->pci_controller = get_pci_info(disk_number, &local_err); +- if (local_err) { +- error_propagate(errp, local_err); +- goto err_close; ++ if (disk->bus_type == GUEST_DISK_BUS_TYPE_USB) { ++ disk->pci_controller = get_empty_pci_address(); ++ } else { ++ disk->pci_controller = get_pci_info(disk_number, &local_err); ++ if (local_err) { ++ error_propagate(errp, local_err); ++ goto err_close; ++ } + } + if (disk->bus_type == GUEST_DISK_BUS_TYPE_SCSI + || disk->bus_type == GUEST_DISK_BUS_TYPE_IDE + +-- +2.38.1 + + diff --git a/mingw-qemu-ga-win.spec b/mingw-qemu-ga-win.spec index dba32a0..5403aad 100644 --- a/mingw-qemu-ga-win.spec +++ b/mingw-qemu-ga-win.spec @@ -6,7 +6,7 @@ %define ga_distro "RHEL" Name: mingw-qemu-ga-win -Version: 105.0.0 +Version: 105.0.1 Release: 1%{?dist} Summary: Qemus Guest agent for Windows @@ -19,6 +19,7 @@ Requires(postun): systemd-units Source0: http://wiki.qemu.org/download/qemu-%{qemu_version}.tar.bz2 Patch0001: 0001-Change-Version.patch +Patch0002: 0002-qga-win-usb-support.patch BuildArch: noarch @@ -42,6 +43,8 @@ BuildRequires: meson BuildRequires: ninja-build %description +Qemu Guest Agent for Windows. + qemu-kvm is an open source virtualizer that provides hardware emulation for the KVM hypervisor. @@ -50,11 +53,8 @@ with the host over a virtio-serial channel named "org.qemu.guest_agent.0" This package does not need to be installed on the host OS. -%package -n qemu-ga-win Summary: %{summary} -%description -n qemu-ga-win -Qemu Guest Agent for Windows %prep %setup -q -n qemu-%{qemu_version} @@ -84,7 +84,7 @@ export QEMU_GA_VERSION="%{version}" make -j$(nproc) qemu-ga mkdir -p $RPM_BUILD_ROOT%{mingw32_bindir} -# cp build/qga/qemu-ga.exe $RPM_BUILD_ROOT%{mingw32_bindir} +#cp build/qga/qemu-ga.exe $RPM_BUILD_ROOT%{mingw32_bindir} cp build/qga/qemu-ga-i386.msi $RPM_BUILD_ROOT%{mingw32_bindir} #Build for Win64 @@ -107,12 +107,17 @@ mkdir -p $RPM_BUILD_ROOT%{mingw64_bindir} cp build/qga/qemu-ga-x86_64.msi $RPM_BUILD_ROOT%{mingw64_bindir} -%files -n qemu-ga-win +%files %defattr(-,root,root) %{mingw32_bindir}/qemu-ga* %{mingw64_bindir}/qemu-ga* %changelog +* Tue Dec 6 2022 Konstantin Kostiuk 105.0.1 +- Set version to 105.0.1 +- Remove redundant package +- BZ#2090333 - [mingw-qemu-ga-win] qga command 'guest-get-fsinfo' can't query bus-type of USB + * Mon Oct 24 2022 Konstantin Kostiuk 105.0.0 - Set version to 105.0.0 - BZ#2137262 - qemu-ga-win: Rebase qemu-ga to 7.1.0