diff mbox

[Xen-devel,RFC,06/14] xen/xsm: xsm_do_mca is x86 specific

Message ID 1394640969-25583-7-git-send-email-julien.grall@linaro.org
State Accepted, archived
Commit f30dc3719d203560b385414c0064dbe5ba0a9147
Headers show

Commit Message

Julien Grall March 12, 2014, 4:16 p.m. UTC
xsm_do_mca is only used by x86. Only define the function for x86 to
avoid usage on ARM.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Cc: Daniel De Graaf <dgdegra@tycho.nsa.gov>
---
 xen/include/xsm/dummy.h |   12 ++++++------
 xen/include/xsm/xsm.h   |   12 ++++++------
 xen/xsm/dummy.c         |    2 +-
 xen/xsm/flask/hooks.c   |   12 ++++++------
 4 files changed, 19 insertions(+), 19 deletions(-)

Comments

Daniel De Graaf March 13, 2014, 2:26 p.m. UTC | #1
On 03/12/2014 12:16 PM, Julien Grall wrote:
> xsm_do_mca is only used by x86. Only define the function for x86 to
> avoid usage on ARM.
>
> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> Cc: Daniel De Graaf <dgdegra@tycho.nsa.gov>

Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>

> ---
>   xen/include/xsm/dummy.h |   12 ++++++------
>   xen/include/xsm/xsm.h   |   12 ++++++------
>   xen/xsm/dummy.c         |    2 +-
>   xen/xsm/flask/hooks.c   |   12 ++++++------
>   4 files changed, 19 insertions(+), 19 deletions(-)
>
> diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
> index 76f9280..e722155 100644
> --- a/xen/include/xsm/dummy.h
> +++ b/xen/include/xsm/dummy.h
> @@ -140,12 +140,6 @@ static XSM_INLINE int xsm_readconsole(XSM_DEFAULT_ARG uint32_t clear)
>       return xsm_default_action(action, current->domain, NULL);
>   }
>
> -static XSM_INLINE int xsm_do_mca(XSM_DEFAULT_VOID)
> -{
> -    XSM_ASSERT_ACTION(XSM_PRIV);
> -    return xsm_default_action(action, current->domain, NULL);
> -}
> -
>   static XSM_INLINE int xsm_alloc_security_domain(struct domain *d)
>   {
>       return 0;
> @@ -496,6 +490,12 @@ static XSM_INLINE int xsm_hvm_param_nested(XSM_DEFAULT_ARG struct domain *d)
>   }
>
>   #ifdef CONFIG_X86
> +static XSM_INLINE int xsm_do_mca(XSM_DEFAULT_VOID)
> +{
> +    XSM_ASSERT_ACTION(XSM_PRIV);
> +    return xsm_default_action(action, current->domain, NULL);
> +}
> +
>   static XSM_INLINE int xsm_shadow_control(XSM_DEFAULT_ARG struct domain *d, uint32_t op)
>   {
>       XSM_ASSERT_ACTION(XSM_HOOK);
> diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
> index 11218b6..15acb3b 100644
> --- a/xen/include/xsm/xsm.h
> +++ b/xen/include/xsm/xsm.h
> @@ -61,7 +61,6 @@ struct xsm_operations {
>       int (*domctl) (struct domain *d, int cmd);
>       int (*sysctl) (int cmd);
>       int (*readconsole) (uint32_t clear);
> -    int (*do_mca) (void);
>
>       int (*evtchn_unbound) (struct domain *d, struct evtchn *chn, domid_t id2);
>       int (*evtchn_interdomain) (struct domain *d1, struct evtchn *chn1,
> @@ -139,6 +138,7 @@ struct xsm_operations {
>       int (*hvm_param_nested) (struct domain *d);
>
>   #ifdef CONFIG_X86
> +    int (*do_mca) (void);
>       int (*shadow_control) (struct domain *d, uint32_t op);
>       int (*hvm_set_pci_intx_level) (struct domain *d);
>       int (*hvm_set_isa_irq_level) (struct domain *d);
> @@ -223,11 +223,6 @@ static inline int xsm_readconsole (xsm_default_t def, uint32_t clear)
>       return xsm_ops->readconsole(clear);
>   }
>
> -static inline int xsm_do_mca(xsm_default_t def)
> -{
> -    return xsm_ops->do_mca();
> -}
> -
>   static inline int xsm_evtchn_unbound (xsm_default_t def, struct domain *d1, struct evtchn *chn,
>                                                                       domid_t id2)
>   {
> @@ -524,6 +519,11 @@ static inline int xsm_hvm_param_nested (xsm_default_t def, struct domain *d)
>   }
>
>   #ifdef CONFIG_X86
> +static inline int xsm_do_mca(xsm_default_t def)
> +{
> +    return xsm_ops->do_mca();
> +}
> +
>   static inline int xsm_shadow_control (xsm_default_t def, struct domain *d, uint32_t op)
>   {
>       return xsm_ops->shadow_control(d, op);
> diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c
> index 627edcc..b79e10f 100644
> --- a/xen/xsm/dummy.c
> +++ b/xen/xsm/dummy.c
> @@ -38,7 +38,6 @@ void xsm_fixup_ops (struct xsm_operations *ops)
>       set_to_dummy_if_null(ops, domctl);
>       set_to_dummy_if_null(ops, sysctl);
>       set_to_dummy_if_null(ops, readconsole);
> -    set_to_dummy_if_null(ops, do_mca);
>
>       set_to_dummy_if_null(ops, evtchn_unbound);
>       set_to_dummy_if_null(ops, evtchn_interdomain);
> @@ -115,6 +114,7 @@ void xsm_fixup_ops (struct xsm_operations *ops)
>       set_to_dummy_if_null(ops, remove_from_physmap);
>
>   #ifdef CONFIG_X86
> +    set_to_dummy_if_null(ops, do_mca);
>       set_to_dummy_if_null(ops, shadow_control);
>       set_to_dummy_if_null(ops, hvm_set_pci_intx_level);
>       set_to_dummy_if_null(ops, hvm_set_isa_irq_level);
> diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
> index 7329f31..65343f3 100644
> --- a/xen/xsm/flask/hooks.c
> +++ b/xen/xsm/flask/hooks.c
> @@ -798,11 +798,6 @@ static int flask_readconsole(uint32_t clear)
>       return domain_has_xen(current->domain, perms);
>   }
>
> -static int flask_do_mca(void)
> -{
> -    return domain_has_xen(current->domain, XEN__MCA_OP);
> -}
> -
>   static inline u32 resource_to_perm(uint8_t access)
>   {
>       if ( access )
> @@ -1169,6 +1164,11 @@ static int flask_deassign_device(struct domain *d, uint32_t machine_bdf)
>   #endif /* HAS_PASSTHROUGH && HAS_PCI */
>
>   #ifdef CONFIG_X86
> +static int flask_do_mca(void)
> +{
> +    return domain_has_xen(current->domain, XEN__MCA_OP);
> +}
> +
>   static int flask_shadow_control(struct domain *d, uint32_t op)
>   {
>       u32 perm;
> @@ -1472,7 +1472,6 @@ static struct xsm_operations flask_ops = {
>       .domctl = flask_domctl,
>       .sysctl = flask_sysctl,
>       .readconsole = flask_readconsole,
> -    .do_mca = flask_do_mca,
>
>       .evtchn_unbound = flask_evtchn_unbound,
>       .evtchn_interdomain = flask_evtchn_interdomain,
> @@ -1551,6 +1550,7 @@ static struct xsm_operations flask_ops = {
>   #endif
>
>   #ifdef CONFIG_X86
> +    .do_mca = flask_do_mca,
>       .shadow_control = flask_shadow_control,
>       .hvm_set_pci_intx_level = flask_hvm_set_pci_intx_level,
>       .hvm_set_isa_irq_level = flask_hvm_set_isa_irq_level,
>
Ian Campbell March 14, 2014, 5:21 p.m. UTC | #2
On Thu, 2014-03-13 at 10:26 -0400, Daniel De Graaf wrote:
> On 03/12/2014 12:16 PM, Julien Grall wrote:
> > xsm_do_mca is only used by x86. Only define the function for x86 to
> > avoid usage on ARM.
> >
> > Signed-off-by: Julien Grall <julien.grall@linaro.org>
> > Cc: Daniel De Graaf <dgdegra@tycho.nsa.gov>
> 
> Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>

Acked-by: Ian Campbell <ian.campbell@citrix.com>
diff mbox

Patch

diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index 76f9280..e722155 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -140,12 +140,6 @@  static XSM_INLINE int xsm_readconsole(XSM_DEFAULT_ARG uint32_t clear)
     return xsm_default_action(action, current->domain, NULL);
 }
 
-static XSM_INLINE int xsm_do_mca(XSM_DEFAULT_VOID)
-{
-    XSM_ASSERT_ACTION(XSM_PRIV);
-    return xsm_default_action(action, current->domain, NULL);
-}
-
 static XSM_INLINE int xsm_alloc_security_domain(struct domain *d)
 {
     return 0;
@@ -496,6 +490,12 @@  static XSM_INLINE int xsm_hvm_param_nested(XSM_DEFAULT_ARG struct domain *d)
 }
 
 #ifdef CONFIG_X86
+static XSM_INLINE int xsm_do_mca(XSM_DEFAULT_VOID)
+{
+    XSM_ASSERT_ACTION(XSM_PRIV);
+    return xsm_default_action(action, current->domain, NULL);
+}
+
 static XSM_INLINE int xsm_shadow_control(XSM_DEFAULT_ARG struct domain *d, uint32_t op)
 {
     XSM_ASSERT_ACTION(XSM_HOOK);
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 11218b6..15acb3b 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -61,7 +61,6 @@  struct xsm_operations {
     int (*domctl) (struct domain *d, int cmd);
     int (*sysctl) (int cmd);
     int (*readconsole) (uint32_t clear);
-    int (*do_mca) (void);
 
     int (*evtchn_unbound) (struct domain *d, struct evtchn *chn, domid_t id2);
     int (*evtchn_interdomain) (struct domain *d1, struct evtchn *chn1,
@@ -139,6 +138,7 @@  struct xsm_operations {
     int (*hvm_param_nested) (struct domain *d);
 
 #ifdef CONFIG_X86
+    int (*do_mca) (void);
     int (*shadow_control) (struct domain *d, uint32_t op);
     int (*hvm_set_pci_intx_level) (struct domain *d);
     int (*hvm_set_isa_irq_level) (struct domain *d);
@@ -223,11 +223,6 @@  static inline int xsm_readconsole (xsm_default_t def, uint32_t clear)
     return xsm_ops->readconsole(clear);
 }
 
-static inline int xsm_do_mca(xsm_default_t def)
-{
-    return xsm_ops->do_mca();
-}
-
 static inline int xsm_evtchn_unbound (xsm_default_t def, struct domain *d1, struct evtchn *chn,
                                                                     domid_t id2)
 {
@@ -524,6 +519,11 @@  static inline int xsm_hvm_param_nested (xsm_default_t def, struct domain *d)
 }
 
 #ifdef CONFIG_X86
+static inline int xsm_do_mca(xsm_default_t def)
+{
+    return xsm_ops->do_mca();
+}
+
 static inline int xsm_shadow_control (xsm_default_t def, struct domain *d, uint32_t op)
 {
     return xsm_ops->shadow_control(d, op);
diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c
index 627edcc..b79e10f 100644
--- a/xen/xsm/dummy.c
+++ b/xen/xsm/dummy.c
@@ -38,7 +38,6 @@  void xsm_fixup_ops (struct xsm_operations *ops)
     set_to_dummy_if_null(ops, domctl);
     set_to_dummy_if_null(ops, sysctl);
     set_to_dummy_if_null(ops, readconsole);
-    set_to_dummy_if_null(ops, do_mca);
 
     set_to_dummy_if_null(ops, evtchn_unbound);
     set_to_dummy_if_null(ops, evtchn_interdomain);
@@ -115,6 +114,7 @@  void xsm_fixup_ops (struct xsm_operations *ops)
     set_to_dummy_if_null(ops, remove_from_physmap);
 
 #ifdef CONFIG_X86
+    set_to_dummy_if_null(ops, do_mca);
     set_to_dummy_if_null(ops, shadow_control);
     set_to_dummy_if_null(ops, hvm_set_pci_intx_level);
     set_to_dummy_if_null(ops, hvm_set_isa_irq_level);
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 7329f31..65343f3 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -798,11 +798,6 @@  static int flask_readconsole(uint32_t clear)
     return domain_has_xen(current->domain, perms);
 }
 
-static int flask_do_mca(void)
-{
-    return domain_has_xen(current->domain, XEN__MCA_OP);
-}
-
 static inline u32 resource_to_perm(uint8_t access)
 {
     if ( access )
@@ -1169,6 +1164,11 @@  static int flask_deassign_device(struct domain *d, uint32_t machine_bdf)
 #endif /* HAS_PASSTHROUGH && HAS_PCI */
 
 #ifdef CONFIG_X86
+static int flask_do_mca(void)
+{
+    return domain_has_xen(current->domain, XEN__MCA_OP);
+}
+
 static int flask_shadow_control(struct domain *d, uint32_t op)
 {
     u32 perm;
@@ -1472,7 +1472,6 @@  static struct xsm_operations flask_ops = {
     .domctl = flask_domctl,
     .sysctl = flask_sysctl,
     .readconsole = flask_readconsole,
-    .do_mca = flask_do_mca,
 
     .evtchn_unbound = flask_evtchn_unbound,
     .evtchn_interdomain = flask_evtchn_interdomain,
@@ -1551,6 +1550,7 @@  static struct xsm_operations flask_ops = {
 #endif
 
 #ifdef CONFIG_X86
+    .do_mca = flask_do_mca,
     .shadow_control = flask_shadow_control,
     .hvm_set_pci_intx_level = flask_hvm_set_pci_intx_level,
     .hvm_set_isa_irq_level = flask_hvm_set_isa_irq_level,