[RFC PATCH 5/5] arm/virt: provide virtualization extensions to the guest

Miguel Luis posted 5 patches 2 years, 11 months ago
[RFC PATCH 5/5] arm/virt: provide virtualization extensions to the guest
Posted by Miguel Luis 2 years, 11 months ago
From: Haibo Xu <haibo.xu@linaro.org>

VHE enablement if host supports EL2.

Ref: https://lore.kernel.org/qemu-devel/b7c2626e6c720ccc43e57197dff3dac72d613640.1616052890.git.haibo.xu@linaro.org/

Signed-off-by: Haibo Xu <haibo.xu@linaro.org>
Signed-off-by: Miguel Luis <miguel.luis@oracle.com>
---
 hw/arm/virt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 377181e009..7103aecf3f 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -2093,7 +2093,8 @@ static void machvirt_init(MachineState *machine)
         exit(1);
     }
 
-    if (vms->virt && (kvm_enabled() || hvf_enabled())) {
+    if (vms->virt && (kvm_enabled() || hvf_enabled())
+        && !kvm_arm_el2_supported()) {
         error_report("mach-virt: %s does not support providing "
                      "Virtualization extensions to the guest CPU",
                      kvm_enabled() ? "KVM" : "HVF");
-- 
2.39.2
Re: [RFC PATCH 5/5] arm/virt: provide virtualization extensions to the guest
Posted by Richard Henderson 2 years, 11 months ago
On 2/27/23 06:37, Miguel Luis wrote:
> -    if (vms->virt && (kvm_enabled() || hvf_enabled())) {
> +    if (vms->virt && (kvm_enabled() || hvf_enabled())
> +        && !kvm_arm_el2_supported()) {

The ordering of the tests isn't right -- shouldn't test kvm_arm_* for hvf.

     virt && ((kvm && !kvm_el2) || hvf)


r~
Re: [RFC PATCH 5/5] arm/virt: provide virtualization extensions to the guest
Posted by Miguel Luis 2 years, 11 months ago
Hi Richard,

> On 27 Feb 2023, at 18:26, Richard Henderson <richard.henderson@linaro.org> wrote:
> 
> On 2/27/23 06:37, Miguel Luis wrote:
>> -    if (vms->virt && (kvm_enabled() || hvf_enabled())) {
>> +    if (vms->virt && (kvm_enabled() || hvf_enabled())
>> +        && !kvm_arm_el2_supported()) {
> 
> The ordering of the tests isn't right -- shouldn't test kvm_arm_* for hvf.
> 
>    virt && ((kvm && !kvm_el2) || hvf)
> 

Agree. It will be fixed on the next version.

Thank you!
Miguel

> 
> r~