Skip to contentSkip to conversation

x86/hvm: Fix the use of "hap=0" following c/s c0902a9a143a

PATCH In review Andrew Cooper 5 participants 5 messages Oct 9, 2019 – Oct 10, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/hvm: Fix the use of "hap=0" following c/s c0902a9a143a

c/s c0902a9a143a refactored hvm_enable() a little, but dropped the logic which cleared hap_supported in the case that the user had asked for it off.

This results in Xen booting up, claiming:

(XEN) HVM: Hardware Assisted Paging (HAP) detected but disabled

but with HAP advertised via sysctl, and XEN_DOMCTL_CDF_hap being accepted in domain_create().

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Paul Durrant <[email protected]>
CC: Juergen Gross <[email protected]>

This is a regression from 4.12, so should be fixed before 4.13 ships.

---
 xen/arch/x86/hvm/hvm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
xen/arch/x86/hvm/hvm.c +3 -2
index c22cb39cf3..9acd359c99 100644
@@ -142,7 +142,7 @@ static struct notifier_block cpu_nfb = {
     .notifier_call = cpu_callback
 };
 
-static bool __init hap_supported(const struct hvm_function_table *fns)
+static bool __init hap_supported(struct hvm_function_table *fns)
 {
     if ( !fns->hap_supported )
     {
@@ -152,6 +152,7 @@ static bool __init hap_supported(const struct hvm_function_table *fns)
 
     if ( !opt_hap_enabled )
     {
+        fns->hap_supported = 0;
         printk("HVM: Hardware Assisted Paging (HAP) detected but disabled\n");
         return false;
     }
@@ -175,7 +176,7 @@ static int __init hvm_enable(void)
     hvm_enabled = 1;
 
     printk("HVM: %s enabled\n", fns->name);
-    if ( !hap_supported(fns) )
+    if ( !hap_supported(&hvm_funcs) )
         clear_iommu_hap_pt_share();
     else
     {
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Andrew Cooper

c/s c0902a9a143a refactored hvm_enable() a little, but dropped the logic which cleared hap_supported in the case that the user had asked for it off.

Quoted 8 lines

This results in Xen booting up, claiming:

(XEN) HVM: Hardware Assisted Paging (HAP) detected but disabled

but with HAP advertised via sysctl, and XEN_DOMCTL_CDF_hap being accepted in domain_create().

That should have been largely code movement, so I don't know how I managed to drop that.

Quoted 43 lines

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Paul Durrant <[email protected]>
CC: Juergen Gross <[email protected]>

This is a regression from 4.12, so should be fixed before 4.13 ships.

---
 xen/arch/x86/hvm/hvm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
xen/arch/x86/hvm/hvm.c +3 -3
index c22cb39cf3..9acd359c99 100644
@@ -142,7 +142,7 @@ static struct notifier_block cpu_nfb = {
     .notifier_call = cpu_callback
 };
 
-static bool __init hap_supported(const struct hvm_function_table *fns)
+static bool __init hap_supported(struct hvm_function_table *fns)
 {
     if ( !fns->hap_supported )
     {
@@ -152,6 +152,7 @@ static bool __init hap_supported(const struct hvm_function_table *fns)
 
     if ( !opt_hap_enabled )
     {
+        fns->hap_supported = 0;
         printk("HVM: Hardware Assisted Paging (HAP) detected but disabled\n");
         return false;
     }
@@ -175,7 +176,7 @@ static int __init hvm_enable(void)
     hvm_enabled = 1;
 
     printk("HVM: %s enabled\n", fns->name);
-    if ( !hap_supported(fns) )
+    if ( !hap_supported(&hvm_funcs) )
         clear_iommu_hap_pt_share();
     else
     {
--
Quoted 2 lines

2.11.0

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Acked-by
#2 lore raw
Quoted 12 lines · Paul Durrant
Quoted 11 lines · Andrew Cooper

c/s c0902a9a143a refactored hvm_enable() a little, but dropped the logic which cleared hap_supported in the case that the user had asked for it off.

This results in Xen booting up, claiming:

(XEN) HVM: Hardware Assisted Paging (HAP) detected but disabled

but with HAP advertised via sysctl, and XEN_DOMCTL_CDF_hap being accepted in domain_create().

Quoted 6 lines
Quoted 1 line

That should have been largely code movement, so I don't know how I managed to drop that.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by on v1 1/1
#3 lore raw
In reply to Andrew Cooper
Quoted 4 lines · Andrew Cooper

c/s c0902a9a143a refactored hvm_enable() a little, but dropped the logic which cleared hap_supported in the case that the user had asked for it off.

Quoted 8 lines

This results in Xen booting up, claiming:

(XEN) HVM: Hardware Assisted Paging (HAP) detected but disabled

but with HAP advertised via sysctl, and XEN_DOMCTL_CDF_hap being accepted in domain_create().

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw
In reply to Andrew Cooper
Quoted 11 lines · Andrew Cooper

c/s c0902a9a143a refactored hvm_enable() a little, but dropped the logic which cleared hap_supported in the case that the user had asked for it off.

This results in Xen booting up, claiming:

(XEN) HVM: Hardware Assisted Paging (HAP) detected but disabled

but with HAP advertised via sysctl, and XEN_DOMCTL_CDF_hap being accepted in domain_create().

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel