All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] qemu-ga-win: 'guest-get-fsinfo' command wont query storage devices of bus type USB
@ 2022-11-20 14:00 Kfir Manor
  2022-11-20 14:00 ` [PATCH 1/2] qga:/qga-win: adding a empty PCI address creation function Kfir Manor
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Kfir Manor @ 2022-11-20 14:00 UTC (permalink / raw)
  To: qemu-devel, Konstantin Kostiuk, Michael Roth; +Cc: Yan Vugenfirer

guest-get-fsinfo won't query storage devices of bus-type USB (https://bugzilla.redhat.com/show_bug.cgi?id=2090333).

Bug, get_pci_info function returns an error after not finding any storage port device info on the USB disk parent device (because of USB abstraction).

Fix, skip getting PCI info (get_pci_info function) for USB disks (as USB disk doesn't have PCI info), and return an empty PCI address instead to keep with schema.


Kfir Manor (2):
  adding a empty PCI address creation function
  skip getting pci info for USB disks

 qga/commands-win32.c | 32 +++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)

-- 
2.38.1



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] qga:/qga-win: adding a empty PCI address creation function
  2022-11-20 14:00 [PATCH 0/2] qemu-ga-win: 'guest-get-fsinfo' command wont query storage devices of bus type USB Kfir Manor
@ 2022-11-20 14:00 ` Kfir Manor
  2022-11-21  8:33   ` Konstantin Kostiuk
  2022-11-20 14:00 ` [PATCH 2/2] qga:/qga-win: skip getting pci info for USB disks Kfir Manor
  2022-11-21  6:38 ` [PATCH 0/2] qemu-ga-win: 'guest-get-fsinfo' command wont query storage devices of bus type USB Marc-André Lureau
  2 siblings, 1 reply; 7+ messages in thread
From: Kfir Manor @ 2022-11-20 14:00 UTC (permalink / raw)
  To: qemu-devel, Konstantin Kostiuk, Michael Roth; +Cc: Yan Vugenfirer

Refactoring code to avoid duplication of creating an empty PCI address code.

Signed-off-by: Kfir Manor <kfir@daynix.com>
---
 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



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] qga:/qga-win: skip getting pci info for USB disks
  2022-11-20 14:00 [PATCH 0/2] qemu-ga-win: 'guest-get-fsinfo' command wont query storage devices of bus type USB Kfir Manor
  2022-11-20 14:00 ` [PATCH 1/2] qga:/qga-win: adding a empty PCI address creation function Kfir Manor
@ 2022-11-20 14:00 ` Kfir Manor
  2022-11-21  8:33   ` Konstantin Kostiuk
  2022-11-21  6:38 ` [PATCH 0/2] qemu-ga-win: 'guest-get-fsinfo' command wont query storage devices of bus type USB Marc-André Lureau
  2 siblings, 1 reply; 7+ messages in thread
From: Kfir Manor @ 2022-11-20 14:00 UTC (permalink / raw)
  To: qemu-devel, Konstantin Kostiuk, Michael Roth; +Cc: Yan Vugenfirer

Skip getting PCI info from disks type USB and give them an empty PCI address instead.

Signed-off-by: Kfir Manor <kfir@daynix.com>
---
 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



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2] qemu-ga-win: 'guest-get-fsinfo' command wont query storage devices of bus type USB
  2022-11-20 14:00 [PATCH 0/2] qemu-ga-win: 'guest-get-fsinfo' command wont query storage devices of bus type USB Kfir Manor
  2022-11-20 14:00 ` [PATCH 1/2] qga:/qga-win: adding a empty PCI address creation function Kfir Manor
  2022-11-20 14:00 ` [PATCH 2/2] qga:/qga-win: skip getting pci info for USB disks Kfir Manor
@ 2022-11-21  6:38 ` Marc-André Lureau
  2022-12-26 14:02   ` Konstantin Kostiuk
  2 siblings, 1 reply; 7+ messages in thread
From: Marc-André Lureau @ 2022-11-21  6:38 UTC (permalink / raw)
  To: Kfir Manor; +Cc: qemu-devel, Konstantin Kostiuk, Michael Roth, Yan Vugenfirer

Hi

On Sun, Nov 20, 2022 at 6:09 PM Kfir Manor <kfir@daynix.com> wrote:
>
> guest-get-fsinfo won't query storage devices of bus-type USB (https://bugzilla.redhat.com/show_bug.cgi?id=2090333).
>
> Bug, get_pci_info function returns an error after not finding any storage port device info on the USB disk parent device (because of USB abstraction).
>
> Fix, skip getting PCI info (get_pci_info function) for USB disks (as USB disk doesn't have PCI info), and return an empty PCI address instead to keep with schema.
>
>
> Kfir Manor (2):
>   adding a empty PCI address creation function
>   skip getting pci info for USB disks
>
>  qga/commands-win32.c | 32 +++++++++++++++++++++-----------
>  1 file changed, 21 insertions(+), 11 deletions(-)
>
> --
> 2.38.1
>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>



-- 
Marc-André Lureau


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] qga:/qga-win: adding a empty PCI address creation function
  2022-11-20 14:00 ` [PATCH 1/2] qga:/qga-win: adding a empty PCI address creation function Kfir Manor
@ 2022-11-21  8:33   ` Konstantin Kostiuk
  0 siblings, 0 replies; 7+ messages in thread
From: Konstantin Kostiuk @ 2022-11-21  8:33 UTC (permalink / raw)
  To: Kfir Manor; +Cc: qemu-devel, Michael Roth, Yan Vugenfirer

[-- Attachment #1: Type: text/plain, Size: 1574 bytes --]

Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>

On Sun, Nov 20, 2022 at 4:09 PM Kfir Manor <kfir@daynix.com> wrote:

> Refactoring code to avoid duplication of creating an empty PCI address
> code.
>
> Signed-off-by: Kfir Manor <kfir@daynix.com>
> ---
>  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
>
>

[-- Attachment #2: Type: text/html, Size: 2210 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] qga:/qga-win: skip getting pci info for USB disks
  2022-11-20 14:00 ` [PATCH 2/2] qga:/qga-win: skip getting pci info for USB disks Kfir Manor
@ 2022-11-21  8:33   ` Konstantin Kostiuk
  0 siblings, 0 replies; 7+ messages in thread
From: Konstantin Kostiuk @ 2022-11-21  8:33 UTC (permalink / raw)
  To: Kfir Manor; +Cc: qemu-devel, Michael Roth, Yan Vugenfirer

[-- Attachment #1: Type: text/plain, Size: 1326 bytes --]

Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>

On Sun, Nov 20, 2022 at 4:01 PM Kfir Manor <kfir@daynix.com> wrote:

> Skip getting PCI info from disks type USB and give them an empty PCI
> address instead.
>
> Signed-off-by: Kfir Manor <kfir@daynix.com>
> ---
>  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
>
>

[-- Attachment #2: Type: text/html, Size: 1920 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2] qemu-ga-win: 'guest-get-fsinfo' command wont query storage devices of bus type USB
  2022-11-21  6:38 ` [PATCH 0/2] qemu-ga-win: 'guest-get-fsinfo' command wont query storage devices of bus type USB Marc-André Lureau
@ 2022-12-26 14:02   ` Konstantin Kostiuk
  0 siblings, 0 replies; 7+ messages in thread
From: Konstantin Kostiuk @ 2022-12-26 14:02 UTC (permalink / raw)
  To: Kfir Manor; +Cc: qemu-devel, Marc-André Lureau, Yan Vugenfirer

[-- Attachment #1: Type: text/plain, Size: 1109 bytes --]

the series was merged

Best Regards,
Konstantin Kostiuk.

On Mon, Nov 21, 2022 at 8:38 AM Marc-André Lureau <
marcandre.lureau@gmail.com> wrote:

> Hi
>
> On Sun, Nov 20, 2022 at 6:09 PM Kfir Manor <kfir@daynix.com> wrote:
> >
> > guest-get-fsinfo won't query storage devices of bus-type USB (
> https://bugzilla.redhat.com/show_bug.cgi?id=2090333).
> >
> > Bug, get_pci_info function returns an error after not finding any
> storage port device info on the USB disk parent device (because of USB
> abstraction).
> >
> > Fix, skip getting PCI info (get_pci_info function) for USB disks (as USB
> disk doesn't have PCI info), and return an empty PCI address instead to
> keep with schema.
> >
> >
> > Kfir Manor (2):
> >   adding a empty PCI address creation function
> >   skip getting pci info for USB disks
> >
> >  qga/commands-win32.c | 32 +++++++++++++++++++++-----------
> >  1 file changed, 21 insertions(+), 11 deletions(-)
> >
> > --
> > 2.38.1
> >
> >
>
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>
>
>
> --
> Marc-André Lureau
>
>

[-- Attachment #2: Type: text/html, Size: 1867 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-12-26 14:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-20 14:00 [PATCH 0/2] qemu-ga-win: 'guest-get-fsinfo' command wont query storage devices of bus type USB Kfir Manor
2022-11-20 14:00 ` [PATCH 1/2] qga:/qga-win: adding a empty PCI address creation function Kfir Manor
2022-11-21  8:33   ` Konstantin Kostiuk
2022-11-20 14:00 ` [PATCH 2/2] qga:/qga-win: skip getting pci info for USB disks Kfir Manor
2022-11-21  8:33   ` Konstantin Kostiuk
2022-11-21  6:38 ` [PATCH 0/2] qemu-ga-win: 'guest-get-fsinfo' command wont query storage devices of bus type USB Marc-André Lureau
2022-12-26 14:02   ` Konstantin Kostiuk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.