diff mbox series

[v2,11/12] target/arm/kvm: spe: Enable userspace irqchip support.

Message ID 6aaa406b824d0c427acbc3f3abfbbe841f3bb93c.1599549462.git.haibo.xu@linaro.org
State New
Headers show
Series target/arm: Add vSPE support to KVM guest | expand

Commit Message

Haibo Xu Sept. 8, 2020, 8:13 a.m. UTC
Since the current kernel patches haven't enabled the
userspace irqchip support, this patch is not verified yet!

Signed-off-by: Haibo Xu <haibo.xu@linaro.org>

---
 linux-headers/linux/kvm.h | 1 +
 target/arm/kvm.c          | 5 +++++
 2 files changed, 6 insertions(+)

-- 
2.17.1

Comments

Andrew Jones Sept. 8, 2020, 11:34 a.m. UTC | #1
On Tue, Sep 08, 2020 at 08:13:29AM +0000, Haibo Xu wrote:
> Since the current kernel patches haven't enabled the

> userspace irqchip support, this patch is not verified yet!

> 

> Signed-off-by: Haibo Xu <haibo.xu@linaro.org>

> ---

>  linux-headers/linux/kvm.h | 1 +

>  target/arm/kvm.c          | 5 +++++

>  2 files changed, 6 insertions(+)

> 

> diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h

> index 8840cbb01c..35ef0ae842 100644

> --- a/linux-headers/linux/kvm.h

> +++ b/linux-headers/linux/kvm.h

> @@ -1672,6 +1672,7 @@ struct kvm_assigned_msix_entry {

>  #define KVM_ARM_DEV_EL1_VTIMER		(1 << 0)

>  #define KVM_ARM_DEV_EL1_PTIMER		(1 << 1)

>  #define KVM_ARM_DEV_PMU			(1 << 2)

> +#define KVM_ARM_DEV_SPE			(1 << 3)


kernel header changes should be separate patches

>  

>  struct kvm_hyperv_eventfd {

>  	__u32 conn_id;

> diff --git a/target/arm/kvm.c b/target/arm/kvm.c

> index 58f991e890..7950ff1d83 100644

> --- a/target/arm/kvm.c

> +++ b/target/arm/kvm.c

> @@ -820,6 +820,11 @@ MemTxAttrs kvm_arch_post_run(CPUState *cs, struct kvm_run *run)

>              switched_level &= ~KVM_ARM_DEV_PMU;

>          }

>  

> +        if (switched_level & KVM_ARM_DEV_SPE) {

> +            qemu_set_irq(cpu->spe_interrupt,

> +                         !!(run->s.regs.device_irq_level & KVM_ARM_DEV_SPE));

> +            switched_level &= ~KVM_ARM_DEV_SPE;

> +        }

>          if (switched_level) {

>              qemu_log_mask(LOG_UNIMP, "%s: unhandled in-kernel device IRQ %x\n",

>                            __func__, switched_level);

> -- 

> 2.17.1

> 


Otherwise 

Reviewed-by: Andrew Jones <drjones@redhat.com>
Haibo Xu Sept. 9, 2020, 3:12 a.m. UTC | #2
On Tue, 8 Sep 2020 at 19:35, Andrew Jones <drjones@redhat.com> wrote:
>

> On Tue, Sep 08, 2020 at 08:13:29AM +0000, Haibo Xu wrote:

> > Since the current kernel patches haven't enabled the

> > userspace irqchip support, this patch is not verified yet!

> >

> > Signed-off-by: Haibo Xu <haibo.xu@linaro.org>

> > ---

> >  linux-headers/linux/kvm.h | 1 +

> >  target/arm/kvm.c          | 5 +++++

> >  2 files changed, 6 insertions(+)

> >

> > diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h

> > index 8840cbb01c..35ef0ae842 100644

> > --- a/linux-headers/linux/kvm.h

> > +++ b/linux-headers/linux/kvm.h

> > @@ -1672,6 +1672,7 @@ struct kvm_assigned_msix_entry {

> >  #define KVM_ARM_DEV_EL1_VTIMER               (1 << 0)

> >  #define KVM_ARM_DEV_EL1_PTIMER               (1 << 1)

> >  #define KVM_ARM_DEV_PMU                      (1 << 2)

> > +#define KVM_ARM_DEV_SPE                      (1 << 3)

>

> kernel header changes should be separate patches

>


Will move this line to patch 01 in v3.

Thanks,
Haibo

> >

> >  struct kvm_hyperv_eventfd {

> >       __u32 conn_id;

> > diff --git a/target/arm/kvm.c b/target/arm/kvm.c

> > index 58f991e890..7950ff1d83 100644

> > --- a/target/arm/kvm.c

> > +++ b/target/arm/kvm.c

> > @@ -820,6 +820,11 @@ MemTxAttrs kvm_arch_post_run(CPUState *cs, struct kvm_run *run)

> >              switched_level &= ~KVM_ARM_DEV_PMU;

> >          }

> >

> > +        if (switched_level & KVM_ARM_DEV_SPE) {

> > +            qemu_set_irq(cpu->spe_interrupt,

> > +                         !!(run->s.regs.device_irq_level & KVM_ARM_DEV_SPE));

> > +            switched_level &= ~KVM_ARM_DEV_SPE;

> > +        }

> >          if (switched_level) {

> >              qemu_log_mask(LOG_UNIMP, "%s: unhandled in-kernel device IRQ %x\n",

> >                            __func__, switched_level);

> > --

> > 2.17.1

> >

>

> Otherwise

>

> Reviewed-by: Andrew Jones <drjones@redhat.com>

>
diff mbox series

Patch

diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
index 8840cbb01c..35ef0ae842 100644
--- a/linux-headers/linux/kvm.h
+++ b/linux-headers/linux/kvm.h
@@ -1672,6 +1672,7 @@  struct kvm_assigned_msix_entry {
 #define KVM_ARM_DEV_EL1_VTIMER		(1 << 0)
 #define KVM_ARM_DEV_EL1_PTIMER		(1 << 1)
 #define KVM_ARM_DEV_PMU			(1 << 2)
+#define KVM_ARM_DEV_SPE			(1 << 3)
 
 struct kvm_hyperv_eventfd {
 	__u32 conn_id;
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index 58f991e890..7950ff1d83 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -820,6 +820,11 @@  MemTxAttrs kvm_arch_post_run(CPUState *cs, struct kvm_run *run)
             switched_level &= ~KVM_ARM_DEV_PMU;
         }
 
+        if (switched_level & KVM_ARM_DEV_SPE) {
+            qemu_set_irq(cpu->spe_interrupt,
+                         !!(run->s.regs.device_irq_level & KVM_ARM_DEV_SPE));
+            switched_level &= ~KVM_ARM_DEV_SPE;
+        }
         if (switched_level) {
             qemu_log_mask(LOG_UNIMP, "%s: unhandled in-kernel device IRQ %x\n",
                           __func__, switched_level);