diff mbox

[v10,27/26] intel_iommu: disallow kernel-irqchip=on with IR

Message ID 1466752221-22588-1-git-send-email-peterx@redhat.com
State New
Headers show

Commit Message

Peter Xu June 24, 2016, 7:10 a.m. UTC
When user specify "kernel-irqchip=on", throw error and then quit.

Signed-off-by: Peter Xu <peterx@redhat.com>
---

One more patch for this series. Without this one, guest kernel will
possibly hang. This is not user friendly.

 hw/i386/intel_iommu.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Peter Xu June 24, 2016, 9:20 a.m. UTC | #1
On Fri, Jun 24, 2016 at 03:10:21PM +0800, Peter Xu wrote:
> When user specify "kernel-irqchip=on", throw error and then quit.
> 
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
> 
> One more patch for this series. Without this one, guest kernel will
> possibly hang. This is not user friendly.

This patch should not be here. It should in-reply-to the cover letter.
My fault to erroneously pasted a wrong message ID. :(((((

-- peterx
Michael S. Tsirkin July 4, 2016, 3:39 p.m. UTC | #2
On Fri, Jun 24, 2016 at 05:20:22PM +0800, Peter Xu wrote:
> On Fri, Jun 24, 2016 at 03:10:21PM +0800, Peter Xu wrote:
> > When user specify "kernel-irqchip=on", throw error and then quit.
> > 
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> > ---
> > 
> > One more patch for this series. Without this one, guest kernel will
> > possibly hang. This is not user friendly.
> 
> This patch should not be here. It should in-reply-to the cover letter.
> My fault to erroneously pasted a wrong message ID. :(((((
> 
> -- peterx


It doesn't apply either.  Please repost it properly, including
Paolo's ack.
Peter Xu July 5, 2016, 3:51 a.m. UTC | #3
On Mon, Jul 04, 2016 at 06:39:00PM +0300, Michael S. Tsirkin wrote:
> On Fri, Jun 24, 2016 at 05:20:22PM +0800, Peter Xu wrote:
> > On Fri, Jun 24, 2016 at 03:10:21PM +0800, Peter Xu wrote:
> > > When user specify "kernel-irqchip=on", throw error and then quit.
> > > 
> > > Signed-off-by: Peter Xu <peterx@redhat.com>
> > > ---
> > > 
> > > One more patch for this series. Without this one, guest kernel will
> > > possibly hang. This is not user friendly.
> > 
> > This patch should not be here. It should in-reply-to the cover letter.
> > My fault to erroneously pasted a wrong message ID. :(((((
> > 
> > -- peterx
> 
> 
> It doesn't apply either.  Please repost it properly, including
> Paolo's ack.

Sure. Will be included in v11. Thanks,

-- peterx
David Kiarie July 11, 2016, 10:17 a.m. UTC | #4
On Fri, Jun 24, 2016 at 10:10 AM, Peter Xu <peterx@redhat.com> wrote:
> When user specify "kernel-irqchip=on", throw error and then quit.
>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>
> One more patch for this series. Without this one, guest kernel will
> possibly hang. This is not user friendly.
>
>  hw/i386/intel_iommu.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
> index 4ff9a24..618b0f9 100644
> --- a/hw/i386/intel_iommu.c
> +++ b/hw/i386/intel_iommu.c
> @@ -20,6 +20,7 @@
>   */
>
>  #include "qemu/osdep.h"
> +#include "qemu/error-report.h"
>  #include "hw/sysbus.h"
>  #include "exec/address-spaces.h"
>  #include "intel_iommu_internal.h"
> @@ -29,6 +30,7 @@
>  #include "hw/boards.h"
>  #include "hw/i386/x86-iommu.h"
>  #include "hw/pci-host/q35.h"
> +#include "sysemu/kvm.h"
>
>  /*#define DEBUG_INTEL_IOMMU*/
>  #ifdef DEBUG_INTEL_IOMMU
> @@ -2458,6 +2460,13 @@ static void vtd_realize(DeviceState *dev, Error **errp)
>      bus->iommu_opaque = dev;
>      /* Pseudo address space under root PCI bus. */
>      pcms->ioapic_as = vtd_host_dma_iommu(bus, s, Q35_PSEUDO_DEVFN_IOAPIC);
> +
> +    /* Currently Intel IOMMU IR only support "kernel-irqchip={off|split}" */
> +    if (kvm_irqchip_in_kernel() && !kvm_irqchip_is_split()) {
> +        error_report("Intel Interrupt Remapping cannot work with "
> +                     "kernel-irqchip=on, please use 'split|off'.");
> +        exit(1);
> +    }
>  }

Shouldn't you be checking whether VT-d interrupt remapping is
enabled(I'm assuming it's off by default) before you ensure
kernel-irqchip=off|split ? Doesn't the above imply that one can't use
VT-d with kernel_irqchip=on (regardless of whether IR is enabled) ?

>
>  static void vtd_class_init(ObjectClass *klass, void *data)
> --
> 2.4.11
>
Peter Xu July 11, 2016, 12:08 p.m. UTC | #5
On Mon, Jul 11, 2016 at 01:17:40PM +0300, David Kiarie wrote:
> On Fri, Jun 24, 2016 at 10:10 AM, Peter Xu <peterx@redhat.com> wrote:
> > When user specify "kernel-irqchip=on", throw error and then quit.
> >
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> > ---
> >
> > One more patch for this series. Without this one, guest kernel will
> > possibly hang. This is not user friendly.
> >
> >  hw/i386/intel_iommu.c | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> >
> > diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
> > index 4ff9a24..618b0f9 100644
> > --- a/hw/i386/intel_iommu.c
> > +++ b/hw/i386/intel_iommu.c
> > @@ -20,6 +20,7 @@
> >   */
> >
> >  #include "qemu/osdep.h"
> > +#include "qemu/error-report.h"
> >  #include "hw/sysbus.h"
> >  #include "exec/address-spaces.h"
> >  #include "intel_iommu_internal.h"
> > @@ -29,6 +30,7 @@
> >  #include "hw/boards.h"
> >  #include "hw/i386/x86-iommu.h"
> >  #include "hw/pci-host/q35.h"
> > +#include "sysemu/kvm.h"
> >
> >  /*#define DEBUG_INTEL_IOMMU*/
> >  #ifdef DEBUG_INTEL_IOMMU
> > @@ -2458,6 +2460,13 @@ static void vtd_realize(DeviceState *dev, Error **errp)
> >      bus->iommu_opaque = dev;
> >      /* Pseudo address space under root PCI bus. */
> >      pcms->ioapic_as = vtd_host_dma_iommu(bus, s, Q35_PSEUDO_DEVFN_IOAPIC);
> > +
> > +    /* Currently Intel IOMMU IR only support "kernel-irqchip={off|split}" */
> > +    if (kvm_irqchip_in_kernel() && !kvm_irqchip_is_split()) {
> > +        error_report("Intel Interrupt Remapping cannot work with "
> > +                     "kernel-irqchip=on, please use 'split|off'.");
> > +        exit(1);
> > +    }
> >  }
> 
> Shouldn't you be checking whether VT-d interrupt remapping is
> enabled(I'm assuming it's off by default) before you ensure
> kernel-irqchip=off|split ? Doesn't the above imply that one can't use
> VT-d with kernel_irqchip=on (regardless of whether IR is enabled) ?

Yes we should allow ir=off and kernel-irqchip=on. Will fix in v12,
thanks!

-- peterx
diff mbox

Patch

diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index 4ff9a24..618b0f9 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -20,6 +20,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu/error-report.h"
 #include "hw/sysbus.h"
 #include "exec/address-spaces.h"
 #include "intel_iommu_internal.h"
@@ -29,6 +30,7 @@ 
 #include "hw/boards.h"
 #include "hw/i386/x86-iommu.h"
 #include "hw/pci-host/q35.h"
+#include "sysemu/kvm.h"
 
 /*#define DEBUG_INTEL_IOMMU*/
 #ifdef DEBUG_INTEL_IOMMU
@@ -2458,6 +2460,13 @@  static void vtd_realize(DeviceState *dev, Error **errp)
     bus->iommu_opaque = dev;
     /* Pseudo address space under root PCI bus. */
     pcms->ioapic_as = vtd_host_dma_iommu(bus, s, Q35_PSEUDO_DEVFN_IOAPIC);
+
+    /* Currently Intel IOMMU IR only support "kernel-irqchip={off|split}" */
+    if (kvm_irqchip_in_kernel() && !kvm_irqchip_is_split()) {
+        error_report("Intel Interrupt Remapping cannot work with "
+                     "kernel-irqchip=on, please use 'split|off'.");
+        exit(1);
+    }
 }
 
 static void vtd_class_init(ObjectClass *klass, void *data)