qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Clarify error message when a PCI slot is already in use
@ 2010-06-08 13:58 Daniel P. Berrange
  2010-06-08 14:16 ` Isaku Yamahata
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel P. Berrange @ 2010-06-08 13:58 UTC (permalink / raw)
  To: qemu-devel

When mistakenly configuring two devices in the same PCI slot,
QEMU gives a not entirely obvious message about a 'devfn' being
in use:

$ qemu -device rtl8139 -device virtio-balloon-pci,bus=pci.0,addr=0x3
qemu-kvm: -device virtio-balloon-pci,bus=pci.0,addr=0x3: PCI: devfn 24 not available for virtio-balloon-pci, in use by rtl8139

The user does not configure 'devfn' numbers, they use slot+function.
Thus the error messages should be reported back to the user with that
same terminology rather than the internal QEMU terminology. This
patch makes it report:

$ qemu -device rtl8139 -device virtio-balloon-pci,bus=pci.0,addr=0x3
qemu: -device virtio-balloon-pci,bus=pci.0,addr=0x3.7: PCI: slot 3 function 0 not available for virtio-balloon-pci, in use by rtl8139

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
 hw/pci.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/pci.c b/hw/pci.c
index cbbd1dd..2347708 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -609,12 +609,12 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
             if (!bus->devices[devfn])
                 goto found;
         }
-        error_report("PCI: no devfn available for %s, all in use", name);
+        error_report("PCI: no slot/function available for %s, all in use", name);
         return NULL;
     found: ;
     } else if (bus->devices[devfn]) {
-        error_report("PCI: devfn %d not available for %s, in use by %s",
-                     devfn, name, bus->devices[devfn]->name);
+        error_report("PCI: slot %d function %d not available for %s, in use by %s",
+                     (devfn >> 3), (devfn % 8), name, bus->devices[devfn]->name);
         return NULL;
     }
     pci_dev->bus = bus;
-- 
1.6.6.1

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

* Re: [Qemu-devel] [PATCH] Clarify error message when a PCI slot is already in use
  2010-06-08 13:58 [Qemu-devel] [PATCH] Clarify error message when a PCI slot is already in use Daniel P. Berrange
@ 2010-06-08 14:16 ` Isaku Yamahata
  2010-06-08 14:24   ` Daniel P. Berrange
  0 siblings, 1 reply; 3+ messages in thread
From: Isaku Yamahata @ 2010-06-08 14:16 UTC (permalink / raw)
  To: Daniel P. Berrange; +Cc: qemu-devel

On Tue, Jun 08, 2010 at 02:58:25PM +0100, Daniel P. Berrange wrote:
> When mistakenly configuring two devices in the same PCI slot,
> QEMU gives a not entirely obvious message about a 'devfn' being
> in use:
> 
> $ qemu -device rtl8139 -device virtio-balloon-pci,bus=pci.0,addr=0x3
> qemu-kvm: -device virtio-balloon-pci,bus=pci.0,addr=0x3: PCI: devfn 24 not available for virtio-balloon-pci, in use by rtl8139
> 
> The user does not configure 'devfn' numbers, they use slot+function.
> Thus the error messages should be reported back to the user with that
> same terminology rather than the internal QEMU terminology. This
> patch makes it report:
> 
> $ qemu -device rtl8139 -device virtio-balloon-pci,bus=pci.0,addr=0x3
> qemu: -device virtio-balloon-pci,bus=pci.0,addr=0x3.7: PCI: slot 3 function 0 not available for virtio-balloon-pci, in use by rtl8139
> 
> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> ---
>  hw/pci.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/pci.c b/hw/pci.c
> index cbbd1dd..2347708 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -609,12 +609,12 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
>              if (!bus->devices[devfn])
>                  goto found;
>          }
> -        error_report("PCI: no devfn available for %s, all in use", name);
> +        error_report("PCI: no slot/function available for %s, all in use", name);
>          return NULL;
>      found: ;
>      } else if (bus->devices[devfn]) {
> -        error_report("PCI: devfn %d not available for %s, in use by %s",
> -                     devfn, name, bus->devices[devfn]->name);
> +        error_report("PCI: slot %d function %d not available for %s, in use by %s",
> +                     (devfn >> 3), (devfn % 8), name, bus->devices[devfn]->name);

Please use PCI_SLOT() and PCI_FUNC().


>          return NULL;
>      }
>      pci_dev->bus = bus;
> -- 
> 1.6.6.1
> 
> 

-- 
yamahata

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

* Re: [Qemu-devel] [PATCH] Clarify error message when a PCI slot is already in use
  2010-06-08 14:16 ` Isaku Yamahata
@ 2010-06-08 14:24   ` Daniel P. Berrange
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel P. Berrange @ 2010-06-08 14:24 UTC (permalink / raw)
  To: Isaku Yamahata; +Cc: qemu-devel

On Tue, Jun 08, 2010 at 11:16:48PM +0900, Isaku Yamahata wrote:
> On Tue, Jun 08, 2010 at 02:58:25PM +0100, Daniel P. Berrange wrote:
> > When mistakenly configuring two devices in the same PCI slot,
> > QEMU gives a not entirely obvious message about a 'devfn' being
> > in use:
> > 
> > $ qemu -device rtl8139 -device virtio-balloon-pci,bus=pci.0,addr=0x3
> > qemu-kvm: -device virtio-balloon-pci,bus=pci.0,addr=0x3: PCI: devfn 24 not available for virtio-balloon-pci, in use by rtl8139
> > 
> > The user does not configure 'devfn' numbers, they use slot+function.
> > Thus the error messages should be reported back to the user with that
> > same terminology rather than the internal QEMU terminology. This
> > patch makes it report:
> > 
> > $ qemu -device rtl8139 -device virtio-balloon-pci,bus=pci.0,addr=0x3
> > qemu: -device virtio-balloon-pci,bus=pci.0,addr=0x3.7: PCI: slot 3 function 0 not available for virtio-balloon-pci, in use by rtl8139
> > 
> > Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> > ---
> >  hw/pci.c |    6 +++---
> >  1 files changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/hw/pci.c b/hw/pci.c
> > index cbbd1dd..2347708 100644
> > --- a/hw/pci.c
> > +++ b/hw/pci.c
> > @@ -609,12 +609,12 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
> >              if (!bus->devices[devfn])
> >                  goto found;
> >          }
> > -        error_report("PCI: no devfn available for %s, all in use", name);
> > +        error_report("PCI: no slot/function available for %s, all in use", name);
> >          return NULL;
> >      found: ;
> >      } else if (bus->devices[devfn]) {
> > -        error_report("PCI: devfn %d not available for %s, in use by %s",
> > -                     devfn, name, bus->devices[devfn]->name);
> > +        error_report("PCI: slot %d function %d not available for %s, in use by %s",
> > +                     (devfn >> 3), (devfn % 8), name, bus->devices[devfn]->name);
> 
> Please use PCI_SLOT() and PCI_FUNC().

Thanks for the pointer. I've resent the patch with that change

Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

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

end of thread, other threads:[~2010-06-08 14:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-08 13:58 [Qemu-devel] [PATCH] Clarify error message when a PCI slot is already in use Daniel P. Berrange
2010-06-08 14:16 ` Isaku Yamahata
2010-06-08 14:24   ` Daniel P. Berrange

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).