From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel De Graaf Subject: Re: [RFC 06/14] xen/xsm: xsm_do_mca is x86 specific Date: Thu, 13 Mar 2014 10:26:15 -0400 Message-ID: <5321C007.1000906@tycho.nsa.gov> References: <1394640969-25583-1-git-send-email-julien.grall@linaro.org> <1394640969-25583-7-git-send-email-julien.grall@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WO6b4-0004js-Ed for xen-devel@lists.xenproject.org; Thu, 13 Mar 2014 14:26:58 +0000 In-Reply-To: <1394640969-25583-7-git-send-email-julien.grall@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Julien Grall , xen-devel@lists.xenproject.org Cc: stefano.stabellini@citrix.com, tim@xen.org, ian.campbell@citrix.com List-Id: xen-devel@lists.xenproject.org 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 > Cc: Daniel De Graaf Acked-by: Daniel De Graaf > --- > 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, > -- Daniel De Graaf National Security Agency