diff mbox series

[v3,1/2] sysctl: report existing physcaps on ARM

Message ID 20190906143021.28261-2-roger.pau@citrix.com (mailing list archive)
State New, archived
Headers show
Series libxl: choose a sane default for HAP | expand

Commit Message

Roger Pau Monné Sept. 6, 2019, 2:30 p.m. UTC
Current physcaps in XEN_SYSCTL_physinfo are only used by x86, albeit
the capabilities themselves are not x86 specific.

This patch adds support for also reporting the current capabilities on
ARM hardware. Note that on ARM PHYSCAP_hvm is always reported, and
setting PHYSCAP_directio has been moved to common code since the same
logic to set it is used by x86 and ARM.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
---
Changes since v1:
 - New in this version.
---
 xen/arch/arm/sysctl.c       | 5 ++++-
 xen/arch/x86/sysctl.c       | 2 --
 xen/common/sysctl.c         | 2 ++
 xen/include/public/sysctl.h | 6 +++---
 4 files changed, 9 insertions(+), 6 deletions(-)

Comments

Julien Grall Sept. 9, 2019, 10:07 a.m. UTC | #1
Hi,

Title NIT: s/ARM/Arm/

On 9/6/19 3:30 PM, Roger Pau Monne wrote:
> Current physcaps in XEN_SYSCTL_physinfo are only used by x86, albeit
> the capabilities themselves are not x86 specific.
> 
> This patch adds support for also reporting the current capabilities on
> ARM hardware. Note that on ARM PHYSCAP_hvm is always reported, and

Ditto.

> setting PHYSCAP_directio has been moved to common code since the same
> logic to set it is used by x86 and ARM.

Ditto.

> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
> Acked-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Julien Grall <julien.grall@arm.com>

Cheers,
diff mbox series

Patch

diff --git a/xen/arch/arm/sysctl.c b/xen/arch/arm/sysctl.c
index fbfdb44eff..92ac99c928 100644
--- a/xen/arch/arm/sysctl.c
+++ b/xen/arch/arm/sysctl.c
@@ -12,7 +12,10 @@ 
 #include <xen/hypercall.h>
 #include <public/sysctl.h>
 
-void arch_do_physinfo(struct xen_sysctl_physinfo *pi) { }
+void arch_do_physinfo(struct xen_sysctl_physinfo *pi)
+{
+    pi->capabilities |= XEN_SYSCTL_PHYSCAP_hvm;
+}
 
 long arch_do_sysctl(struct xen_sysctl *sysctl,
                     XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c
index c50d910a1c..7ec6174e6b 100644
--- a/xen/arch/x86/sysctl.c
+++ b/xen/arch/x86/sysctl.c
@@ -163,8 +163,6 @@  void arch_do_physinfo(struct xen_sysctl_physinfo *pi)
         pi->capabilities |= XEN_SYSCTL_PHYSCAP_hvm;
     if ( IS_ENABLED(CONFIG_PV) )
         pi->capabilities |= XEN_SYSCTL_PHYSCAP_pv;
-    if ( iommu_enabled )
-        pi->capabilities |= XEN_SYSCTL_PHYSCAP_directio;
 }
 
 long arch_do_sysctl(
diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c
index fcf2d2fd7c..92b4ea0d21 100644
--- a/xen/common/sysctl.c
+++ b/xen/common/sysctl.c
@@ -267,6 +267,8 @@  long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
         pi->cpu_khz = cpu_khz;
         pi->max_mfn = get_upper_mfn_bound();
         arch_do_physinfo(pi);
+        if ( iommu_enabled )
+            pi->capabilities |= XEN_SYSCTL_PHYSCAP_directio;
 
         if ( copy_to_guest(u_sysctl, op, 1) )
             ret = -EFAULT;
diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h
index 91c48dcae0..36b3f8c429 100644
--- a/xen/include/public/sysctl.h
+++ b/xen/include/public/sysctl.h
@@ -81,13 +81,13 @@  struct xen_sysctl_tbuf_op {
  * Get physical information about the host machine
  */
 /* XEN_SYSCTL_physinfo */
- /* (x86) The platform supports HVM guests. */
+ /* The platform supports HVM guests. */
 #define _XEN_SYSCTL_PHYSCAP_hvm          0
 #define XEN_SYSCTL_PHYSCAP_hvm           (1u<<_XEN_SYSCTL_PHYSCAP_hvm)
- /* (x86) The platform supports PV guests. */
+ /* The platform supports PV guests. */
 #define _XEN_SYSCTL_PHYSCAP_pv           1
 #define XEN_SYSCTL_PHYSCAP_pv            (1u<<_XEN_SYSCTL_PHYSCAP_pv)
- /* (x86) The platform supports direct access to I/O devices with IOMMU. */
+ /* The platform supports direct access to I/O devices with IOMMU. */
 #define _XEN_SYSCTL_PHYSCAP_directio     2
 #define XEN_SYSCTL_PHYSCAP_directio  (1u<<_XEN_SYSCTL_PHYSCAP_directio)
 struct xen_sysctl_physinfo {