qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] pci: Return PCI_INTX_DISABLED when no bus INTx routing support
@ 2012-10-17 18:25 Alex Williamson
  2012-10-17 18:40 ` Jan Kiszka
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Williamson @ 2012-10-17 18:25 UTC (permalink / raw)
  To: mst; +Cc: jan.kiszka, alex.williamson, qemu-devel

Rather than assert, simply return PCI_INTX_DISABLED when we don't
have a pci_route_irq_fn.  PIIX already returns DISABLED for an
invalid pin, so users already deal with this state.  Users of this
interface should only be acting on an ENABLED or INVERTED return
value (though we really have no support for INVERTED).

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---

A compromise to the gridlock; defuse the assert, but don't add
a new state to the API.  Thanks,

Alex

 hw/pci.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/hw/pci.c b/hw/pci.c
index 83d262a..9525220 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -1094,7 +1094,11 @@ PCIINTxRoute pci_device_route_intx_to_irq(PCIDevice *dev, int pin)
          pin = bus->map_irq(dev, pin);
          dev = bus->parent_dev;
     } while (dev);
-    assert(bus->route_intx_to_irq);
+
+    if (!bus->route_intx_to_irq) {
+        return (PCIINTxRoute) { PCI_INTX_DISABLED, -1 };
+    }
+
     return bus->route_intx_to_irq(bus->irq_opaque, pin);
 }
 

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

* Re: [Qemu-devel] [PATCH] pci: Return PCI_INTX_DISABLED when no bus INTx routing support
  2012-10-17 18:25 [Qemu-devel] [PATCH] pci: Return PCI_INTX_DISABLED when no bus INTx routing support Alex Williamson
@ 2012-10-17 18:40 ` Jan Kiszka
  2012-10-17 18:54   ` Alex Williamson
  2012-10-17 19:48   ` Michael S. Tsirkin
  0 siblings, 2 replies; 5+ messages in thread
From: Jan Kiszka @ 2012-10-17 18:40 UTC (permalink / raw)
  To: Alex Williamson; +Cc: qemu-devel@nongnu.org, mst@redhat.com

On 2012-10-17 20:25, Alex Williamson wrote:
> Rather than assert, simply return PCI_INTX_DISABLED when we don't
> have a pci_route_irq_fn.  PIIX already returns DISABLED for an
> invalid pin, so users already deal with this state.  Users of this
> interface should only be acting on an ENABLED or INVERTED return
> value (though we really have no support for INVERTED).
> 
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> ---
> 
> A compromise to the gridlock; defuse the assert, but don't add
> a new state to the API.  Thanks,

But how do you tell "unsupported" apart from "disabled" in VFIO? If the
chipset truly disabled the line, you must not provide it to the guest in
some other way.

Jan

> 
> Alex
> 
>  hw/pci.c |    6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/pci.c b/hw/pci.c
> index 83d262a..9525220 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -1094,7 +1094,11 @@ PCIINTxRoute pci_device_route_intx_to_irq(PCIDevice *dev, int pin)
>           pin = bus->map_irq(dev, pin);
>           dev = bus->parent_dev;
>      } while (dev);
> -    assert(bus->route_intx_to_irq);
> +
> +    if (!bus->route_intx_to_irq) {
> +        return (PCIINTxRoute) { PCI_INTX_DISABLED, -1 };
> +    }
> +
>      return bus->route_intx_to_irq(bus->irq_opaque, pin);
>  }
>  
> 

-- 
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux

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

* Re: [Qemu-devel] [PATCH] pci: Return PCI_INTX_DISABLED when no bus INTx routing support
  2012-10-17 18:40 ` Jan Kiszka
@ 2012-10-17 18:54   ` Alex Williamson
  2012-10-17 19:08     ` Michael S. Tsirkin
  2012-10-17 19:48   ` Michael S. Tsirkin
  1 sibling, 1 reply; 5+ messages in thread
From: Alex Williamson @ 2012-10-17 18:54 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: qemu-devel@nongnu.org, mst@redhat.com

On Wed, 2012-10-17 at 20:40 +0200, Jan Kiszka wrote:
> On 2012-10-17 20:25, Alex Williamson wrote:
> > Rather than assert, simply return PCI_INTX_DISABLED when we don't
> > have a pci_route_irq_fn.  PIIX already returns DISABLED for an
> > invalid pin, so users already deal with this state.  Users of this
> > interface should only be acting on an ENABLED or INVERTED return
> > value (though we really have no support for INVERTED).
> > 
> > Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> > ---
> > 
> > A compromise to the gridlock; defuse the assert, but don't add
> > a new state to the API.  Thanks,
> 
> But how do you tell "unsupported" apart from "disabled" in VFIO? If the
> chipset truly disabled the line, you must not provide it to the guest in

The downside to not being able to distinguish is that vfio can't tell
the user anything useful about whether it should work, but needs to be
implemented in the chipset or if it's just currently disabled.  Maybe an
error_report below would fix that, but yes, we do lose granularity we
had with NOROUTE.

Functionally, there's no direct kvm interrupt injection when this
returns DISABLED, so vfio routes the interrupt to qemu where we do
qemu_set_irq, and it can get dropped if it's really disabled.
pci-assign will just not program the interrupt to kvm and intx won't
work :-\  Thanks,

Alex


> >  hw/pci.c |    6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/hw/pci.c b/hw/pci.c
> > index 83d262a..9525220 100644
> > --- a/hw/pci.c
> > +++ b/hw/pci.c
> > @@ -1094,7 +1094,11 @@ PCIINTxRoute pci_device_route_intx_to_irq(PCIDevice *dev, int pin)
> >           pin = bus->map_irq(dev, pin);
> >           dev = bus->parent_dev;
> >      } while (dev);
> > -    assert(bus->route_intx_to_irq);
> > +
> > +    if (!bus->route_intx_to_irq) {
> > +        return (PCIINTxRoute) { PCI_INTX_DISABLED, -1 };
> > +    }
> > +
> >      return bus->route_intx_to_irq(bus->irq_opaque, pin);
> >  }
> >  
> > 
> 

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

* Re: [Qemu-devel] [PATCH] pci: Return PCI_INTX_DISABLED when no bus INTx routing support
  2012-10-17 18:54   ` Alex Williamson
@ 2012-10-17 19:08     ` Michael S. Tsirkin
  0 siblings, 0 replies; 5+ messages in thread
From: Michael S. Tsirkin @ 2012-10-17 19:08 UTC (permalink / raw)
  To: Alex Williamson; +Cc: Jan Kiszka, qemu-devel@nongnu.org

On Wed, Oct 17, 2012 at 12:54:36PM -0600, Alex Williamson wrote:
> On Wed, 2012-10-17 at 20:40 +0200, Jan Kiszka wrote:
> > On 2012-10-17 20:25, Alex Williamson wrote:
> > > Rather than assert, simply return PCI_INTX_DISABLED when we don't
> > > have a pci_route_irq_fn.  PIIX already returns DISABLED for an
> > > invalid pin, so users already deal with this state.  Users of this
> > > interface should only be acting on an ENABLED or INVERTED return
> > > value (though we really have no support for INVERTED).
> > > 
> > > Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> > > ---
> > > 
> > > A compromise to the gridlock; defuse the assert, but don't add
> > > a new state to the API.  Thanks,
> > 
> > But how do you tell "unsupported" apart from "disabled" in VFIO? If the
> > chipset truly disabled the line, you must not provide it to the guest in
> 
> The downside to not being able to distinguish is that vfio can't tell
> the user anything useful about whether it should work, but needs to be
> implemented in the chipset or if it's just currently disabled.  Maybe an
> error_report below would fix that, but yes, we do lose granularity we
> had with NOROUTE.

Stick error_report in pci_device_route_intx_to_irq you mean? OK why not.

> Functionally, there's no direct kvm interrupt injection when this
> returns DISABLED, so vfio routes the interrupt to qemu where we do
> qemu_set_irq, and it can get dropped if it's really disabled.
> pci-assign will just not program the interrupt to kvm and intx won't
> work :-\  Thanks,
> 
> Alex
> 

All this handling is just dead code anyway, it's there just in case anyway.


> > >  hw/pci.c |    6 +++++-
> > >  1 file changed, 5 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/hw/pci.c b/hw/pci.c
> > > index 83d262a..9525220 100644
> > > --- a/hw/pci.c
> > > +++ b/hw/pci.c
> > > @@ -1094,7 +1094,11 @@ PCIINTxRoute pci_device_route_intx_to_irq(PCIDevice *dev, int pin)
> > >           pin = bus->map_irq(dev, pin);
> > >           dev = bus->parent_dev;
> > >      } while (dev);
> > > -    assert(bus->route_intx_to_irq);
> > > +
> > > +    if (!bus->route_intx_to_irq) {
> > > +        return (PCIINTxRoute) { PCI_INTX_DISABLED, -1 };
> > > +    }
> > > +
> > >      return bus->route_intx_to_irq(bus->irq_opaque, pin);
> > >  }
> > >  
> > > 
> > 
> 
> 

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

* Re: [Qemu-devel] [PATCH] pci: Return PCI_INTX_DISABLED when no bus INTx routing support
  2012-10-17 18:40 ` Jan Kiszka
  2012-10-17 18:54   ` Alex Williamson
@ 2012-10-17 19:48   ` Michael S. Tsirkin
  1 sibling, 0 replies; 5+ messages in thread
From: Michael S. Tsirkin @ 2012-10-17 19:48 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Alex Williamson, qemu-devel@nongnu.org

On Wed, Oct 17, 2012 at 08:40:05PM +0200, Jan Kiszka wrote:
> On 2012-10-17 20:25, Alex Williamson wrote:
> > Rather than assert, simply return PCI_INTX_DISABLED when we don't
> > have a pci_route_irq_fn.  PIIX already returns DISABLED for an
> > invalid pin, so users already deal with this state.  Users of this
> > interface should only be acting on an ENABLED or INVERTED return
> > value (though we really have no support for INVERTED).
> > 
> > Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> > ---
> > 
> > A compromise to the gridlock; defuse the assert, but don't add
> > a new state to the API.  Thanks,
> 
> But how do you tell "unsupported" apart from "disabled" in VFIO? If the
> chipset truly disabled the line, you must not provide it to the guest in
> some other way.
> 
> Jan

vfio does not care. It merely disables irqfd and delivers irqs to qemu.

> > 
> > Alex
> > 
> >  hw/pci.c |    6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/hw/pci.c b/hw/pci.c
> > index 83d262a..9525220 100644
> > --- a/hw/pci.c
> > +++ b/hw/pci.c
> > @@ -1094,7 +1094,11 @@ PCIINTxRoute pci_device_route_intx_to_irq(PCIDevice *dev, int pin)
> >           pin = bus->map_irq(dev, pin);
> >           dev = bus->parent_dev;
> >      } while (dev);
> > -    assert(bus->route_intx_to_irq);
> > +
> > +    if (!bus->route_intx_to_irq) {
> > +        return (PCIINTxRoute) { PCI_INTX_DISABLED, -1 };
> > +    }
> > +
> >      return bus->route_intx_to_irq(bus->irq_opaque, pin);
> >  }
> >  
> > 
> 
> -- 
> Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
> Corporate Competence Center Embedded Linux

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

end of thread, other threads:[~2012-10-17 19:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-17 18:25 [Qemu-devel] [PATCH] pci: Return PCI_INTX_DISABLED when no bus INTx routing support Alex Williamson
2012-10-17 18:40 ` Jan Kiszka
2012-10-17 18:54   ` Alex Williamson
2012-10-17 19:08     ` Michael S. Tsirkin
2012-10-17 19:48   ` Michael S. Tsirkin

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).