qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] target/arm/kvm: gic: Prevent creating userspace GICv3 with KVM
@ 2018-02-01 20:53 Christoffer Dall
  2018-02-06  0:10 ` Philippe Mathieu-Daudé
  2018-02-08 15:23 ` Peter Maydell
  0 siblings, 2 replies; 5+ messages in thread
From: Christoffer Dall @ 2018-02-01 20:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Alex Bennee, Christoffer Dall

KVM doesn't support emulating a GICv3 in userspace, only GICv2.  We
currently attempt this anyway, and as a result a KVM guest doesn't
receive interrupts and the user is left wondering why.  Report an error
to the user if this particular combination is requested.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
---
 target/arm/kvm_arm.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
index ff53e9fafb..cfb7e5af72 100644
--- a/target/arm/kvm_arm.h
+++ b/target/arm/kvm_arm.h
@@ -234,6 +234,10 @@ static inline const char *gicv3_class_name(void)
         exit(1);
 #endif
     } else {
+        if (kvm_enabled()) {
+            error_report("Userspace GICv3 is not supported with KVM");
+            exit(1);
+        }
         return "arm-gicv3";
     }
 }
-- 
2.14.2

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

* Re: [Qemu-devel] [PATCH] target/arm/kvm: gic: Prevent creating userspace GICv3 with KVM
  2018-02-01 20:53 [Qemu-devel] [PATCH] target/arm/kvm: gic: Prevent creating userspace GICv3 with KVM Christoffer Dall
@ 2018-02-06  0:10 ` Philippe Mathieu-Daudé
  2018-02-06  0:19   ` Alistair Francis
  2018-02-06  9:06   ` Christoffer Dall
  2018-02-08 15:23 ` Peter Maydell
  1 sibling, 2 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-02-06  0:10 UTC (permalink / raw)
  To: Christoffer Dall, Alistair Francis, Edgar E. Iglesias
  Cc: qemu-devel, Peter Maydell, Alex Bennee

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

Hi Christoffer,

On 02/01/2018 05:53 PM, Christoffer Dall wrote:
> KVM doesn't support emulating a GICv3 in userspace, only GICv2.  We
> currently attempt this anyway, and as a result a KVM guest doesn't
> receive interrupts and the user is left wondering why.  Report an error
> to the user if this particular combination is requested.
> 
> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
> ---
>  target/arm/kvm_arm.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
> index ff53e9fafb..cfb7e5af72 100644
> --- a/target/arm/kvm_arm.h
> +++ b/target/arm/kvm_arm.h
> @@ -234,6 +234,10 @@ static inline const char *gicv3_class_name(void)

Any reason why these functions are inlined in this include?

Also - not related to your patch - while gicv3_class_name() is
self-explicit, gic_class_name() isn't (to me at least).

There are many check for gic_version 1/2/3 in virt.c, which we could
clean using more generic functions such gic_class_name(int gic_version)
and Co.

Alistair/Edgar:
Why the ZynqMP is not using the GICv3 for the APU? I remember hearing
something about not fully implemented so not working correctly.

>          exit(1);
>  #endif
>      } else {
> +        if (kvm_enabled()) {
> +            error_report("Userspace GICv3 is not supported with KVM");
> +            exit(1);

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> +        }
>          return "arm-gicv3";
>      }
>  }
> 

Regards,

Phil.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [Qemu-devel] [PATCH] target/arm/kvm: gic: Prevent creating userspace GICv3 with KVM
  2018-02-06  0:10 ` Philippe Mathieu-Daudé
@ 2018-02-06  0:19   ` Alistair Francis
  2018-02-06  9:06   ` Christoffer Dall
  1 sibling, 0 replies; 5+ messages in thread
From: Alistair Francis @ 2018-02-06  0:19 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Christoffer Dall, Alistair Francis, Edgar E. Iglesias,
	Peter Maydell, Alex Bennee, qemu-devel@nongnu.org Developers

On Mon, Feb 5, 2018 at 4:10 PM, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> Hi Christoffer,
>
> On 02/01/2018 05:53 PM, Christoffer Dall wrote:
>> KVM doesn't support emulating a GICv3 in userspace, only GICv2.  We
>> currently attempt this anyway, and as a result a KVM guest doesn't
>> receive interrupts and the user is left wondering why.  Report an error
>> to the user if this particular combination is requested.
>>
>> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
>> ---
>>  target/arm/kvm_arm.h | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
>> index ff53e9fafb..cfb7e5af72 100644
>> --- a/target/arm/kvm_arm.h
>> +++ b/target/arm/kvm_arm.h
>> @@ -234,6 +234,10 @@ static inline const char *gicv3_class_name(void)
>
> Any reason why these functions are inlined in this include?
>
> Also - not related to your patch - while gicv3_class_name() is
> self-explicit, gic_class_name() isn't (to me at least).
>
> There are many check for gic_version 1/2/3 in virt.c, which we could
> clean using more generic functions such gic_class_name(int gic_version)
> and Co.
>
> Alistair/Edgar:
> Why the ZynqMP is not using the GICv3 for the APU? I remember hearing
> something about not fully implemented so not working correctly.

The ZynqMP only has a GICv2.

Maybe you are thinking of the virtualisation features? Mainline
doesn't have those fully implemented so they don't work correctly.

Alistair

>
>>          exit(1);
>>  #endif
>>      } else {
>> +        if (kvm_enabled()) {
>> +            error_report("Userspace GICv3 is not supported with KVM");
>> +            exit(1);
>
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>
>> +        }
>>          return "arm-gicv3";
>>      }
>>  }
>>
>
> Regards,
>
> Phil.
>

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

* Re: [Qemu-devel] [PATCH] target/arm/kvm: gic: Prevent creating userspace GICv3 with KVM
  2018-02-06  0:10 ` Philippe Mathieu-Daudé
  2018-02-06  0:19   ` Alistair Francis
@ 2018-02-06  9:06   ` Christoffer Dall
  1 sibling, 0 replies; 5+ messages in thread
From: Christoffer Dall @ 2018-02-06  9:06 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Alistair Francis, Edgar E. Iglesias, qemu-devel, Peter Maydell,
	Alex Bennee

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

Hi Philippe,

On Mon, Feb 05, 2018 at 09:10:48PM -0300, Philippe Mathieu-Daudé wrote:
> 
> On 02/01/2018 05:53 PM, Christoffer Dall wrote:
> > KVM doesn't support emulating a GICv3 in userspace, only GICv2.  We
> > currently attempt this anyway, and as a result a KVM guest doesn't
> > receive interrupts and the user is left wondering why.  Report an error
> > to the user if this particular combination is requested.
> > 
> > Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
> > ---
> >  target/arm/kvm_arm.h | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
> > index ff53e9fafb..cfb7e5af72 100644
> > --- a/target/arm/kvm_arm.h
> > +++ b/target/arm/kvm_arm.h
> > @@ -234,6 +234,10 @@ static inline const char *gicv3_class_name(void)
> 
> Any reason why these functions are inlined in this include?

Not really sure what you mean?  What do you think would be a better
approach?

> 
> Also - not related to your patch - while gicv3_class_name() is
> self-explicit, gic_class_name() isn't (to me at least).

I think I tend to see 'gic' as GICv2 and 'gicv3' as GICv3 in QEMU, but I
don't remember the details of how you make the GIC be a proper GICv2 vs.
the 11mpcore version thingy.

> 
> There are many check for gic_version 1/2/3 in virt.c, which we could
> clean using more generic functions such gic_class_name(int gic_version)
> and Co.

Possibly.  Do note, that checking "which version of the GIC does this
board contain" is a separate thing from "which particular mechanism do I
use to emulate the GIC".

> 
> >          exit(1);
> >  #endif
> >      } else {
> > +        if (kvm_enabled()) {
> > +            error_report("Userspace GICv3 is not supported with KVM");
> > +            exit(1);
> 
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> 
> > +        }
> >          return "arm-gicv3";
> >      }
> >  }
> > 
> 
Thanks!
-Christoffer

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [Qemu-devel] [PATCH] target/arm/kvm: gic: Prevent creating userspace GICv3 with KVM
  2018-02-01 20:53 [Qemu-devel] [PATCH] target/arm/kvm: gic: Prevent creating userspace GICv3 with KVM Christoffer Dall
  2018-02-06  0:10 ` Philippe Mathieu-Daudé
@ 2018-02-08 15:23 ` Peter Maydell
  1 sibling, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2018-02-08 15:23 UTC (permalink / raw)
  To: Christoffer Dall; +Cc: QEMU Developers, Alex Bennee

On 1 February 2018 at 20:53, Christoffer Dall
<christoffer.dall@linaro.org> wrote:
> KVM doesn't support emulating a GICv3 in userspace, only GICv2.  We
> currently attempt this anyway, and as a result a KVM guest doesn't
> receive interrupts and the user is left wondering why.  Report an error
> to the user if this particular combination is requested.
>
> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
> ---
>  target/arm/kvm_arm.h | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
> index ff53e9fafb..cfb7e5af72 100644
> --- a/target/arm/kvm_arm.h
> +++ b/target/arm/kvm_arm.h
> @@ -234,6 +234,10 @@ static inline const char *gicv3_class_name(void)
>          exit(1);
>  #endif
>      } else {
> +        if (kvm_enabled()) {
> +            error_report("Userspace GICv3 is not supported with KVM");
> +            exit(1);
> +        }
>          return "arm-gicv3";
>      }



Applied to target-arm.next, thanks.

-- PMM

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

end of thread, other threads:[~2018-02-08 15:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-01 20:53 [Qemu-devel] [PATCH] target/arm/kvm: gic: Prevent creating userspace GICv3 with KVM Christoffer Dall
2018-02-06  0:10 ` Philippe Mathieu-Daudé
2018-02-06  0:19   ` Alistair Francis
2018-02-06  9:06   ` Christoffer Dall
2018-02-08 15:23 ` Peter Maydell

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