|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] xen/arch/arm: add XSM hook to HVMOP_{get, set}_param
# HG changeset patch
# User Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
# Date 1359542200 28800
# Node ID 12859b96ac9bb0ce009e12faaf9c3ac7e6ca3795
# Parent 11ba88a82256a5ac5bcdffeac59acecc4448ab8d
xen/arch/arm: add XSM hook to HVMOP_{get,set}_param
This hook is not x86-specific; move it out of CONFIG_X86.
Signed-off-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Committed-by: Keir Fraser <keir@xxxxxxx>
---
diff -r 11ba88a82256 -r 12859b96ac9b xen/arch/arm/hvm.c
--- a/xen/arch/arm/hvm.c Mon Jan 28 16:48:20 2013 +0000
+++ b/xen/arch/arm/hvm.c Wed Jan 30 02:36:40 2013 -0800
@@ -30,9 +30,13 @@ long do_hvm_op(unsigned long op, XEN_GUE
if ( a.index >= HVM_NR_PARAMS )
return -EINVAL;
- rc = rcu_lock_target_domain_by_id(a.domid, &d);
- if ( rc != 0 )
- return rc;
+ d = rcu_lock_domain_by_any_id(a.domid);
+ if ( d == NULL )
+ return -ESRCH;
+
+ rc = xsm_hvm_param(XSM_TARGET, d, op);
+ if ( rc )
+ goto param_fail;
if ( op == HVMOP_set_param )
{
@@ -44,6 +48,7 @@ long do_hvm_op(unsigned long op, XEN_GUE
rc = copy_to_guest(arg, &a, 1) ? -EFAULT : 0;
}
+ param_fail:
rcu_unlock_domain(d);
break;
}
diff -r 11ba88a82256 -r 12859b96ac9b xen/include/xsm/dummy.h
--- a/xen/include/xsm/dummy.h Mon Jan 28 16:48:20 2013 +0000
+++ b/xen/include/xsm/dummy.h Wed Jan 30 02:36:40 2013 -0800
@@ -467,6 +467,12 @@ static XSM_INLINE int xsm_remove_from_ph
return xsm_default_action(action, d1, d2);
}
+static XSM_INLINE int xsm_hvm_param(XSM_DEFAULT_ARG struct domain *d, unsigned
long op)
+{
+ XSM_ASSERT_ACTION(XSM_TARGET);
+ return xsm_default_action(action, current->domain, d);
+}
+
#ifdef CONFIG_X86
static XSM_INLINE int xsm_shadow_control(XSM_DEFAULT_ARG struct domain *d,
uint32_t op)
{
@@ -474,12 +480,6 @@ static XSM_INLINE int xsm_shadow_control
return xsm_default_action(action, current->domain, d);
}
-static XSM_INLINE int xsm_hvm_param(XSM_DEFAULT_ARG struct domain *d, unsigned
long op)
-{
- XSM_ASSERT_ACTION(XSM_TARGET);
- return xsm_default_action(action, current->domain, d);
-}
-
static XSM_INLINE int xsm_hvm_set_pci_intx_level(XSM_DEFAULT_ARG struct domain
*d)
{
XSM_ASSERT_ACTION(XSM_DM_PRIV);
diff -r 11ba88a82256 -r 12859b96ac9b xen/include/xsm/xsm.h
--- a/xen/include/xsm/xsm.h Mon Jan 28 16:48:20 2013 +0000
+++ b/xen/include/xsm/xsm.h Wed Jan 30 02:36:40 2013 -0800
@@ -129,9 +129,10 @@ struct xsm_operations {
long (*do_xsm_op) (XEN_GUEST_HANDLE_PARAM(xsm_op_t) op);
+ int (*hvm_param) (struct domain *d, unsigned long op);
+
#ifdef CONFIG_X86
int (*shadow_control) (struct domain *d, uint32_t op);
- int (*hvm_param) (struct domain *d, unsigned long op);
int (*hvm_set_pci_intx_level) (struct domain *d);
int (*hvm_set_isa_irq_level) (struct domain *d);
int (*hvm_set_pci_link_route) (struct domain *d);
@@ -487,17 +488,17 @@ static inline long xsm_do_xsm_op (XEN_GU
return xsm_ops->do_xsm_op(op);
}
+static inline int xsm_hvm_param (xsm_default_t def, struct domain *d, unsigned
long op)
+{
+ return xsm_ops->hvm_param(d, op);
+}
+
#ifdef CONFIG_X86
static inline int xsm_shadow_control (xsm_default_t def, struct domain *d,
uint32_t op)
{
return xsm_ops->shadow_control(d, op);
}
-static inline int xsm_hvm_param (xsm_default_t def, struct domain *d, unsigned
long op)
-{
- return xsm_ops->hvm_param(d, op);
-}
-
static inline int xsm_hvm_set_pci_intx_level (xsm_default_t def, struct domain
*d)
{
return xsm_ops->hvm_set_pci_intx_level(d);
diff -r 11ba88a82256 -r 12859b96ac9b xen/xsm/dummy.c
--- a/xen/xsm/dummy.c Mon Jan 28 16:48:20 2013 +0000
+++ b/xen/xsm/dummy.c Wed Jan 30 02:36:40 2013 -0800
@@ -100,6 +100,7 @@ void xsm_fixup_ops (struct xsm_operation
set_to_dummy_if_null(ops, page_offline);
set_to_dummy_if_null(ops, tmem_op);
set_to_dummy_if_null(ops, tmem_control);
+ set_to_dummy_if_null(ops, hvm_param);
set_to_dummy_if_null(ops, do_xsm_op);
@@ -108,7 +109,6 @@ void xsm_fixup_ops (struct xsm_operation
#ifdef CONFIG_X86
set_to_dummy_if_null(ops, shadow_control);
- set_to_dummy_if_null(ops, hvm_param);
set_to_dummy_if_null(ops, hvm_set_pci_intx_level);
set_to_dummy_if_null(ops, hvm_set_isa_irq_level);
set_to_dummy_if_null(ops, hvm_set_pci_link_route);
diff -r 11ba88a82256 -r 12859b96ac9b xen/xsm/flask/hooks.c
--- a/xen/xsm/flask/hooks.c Mon Jan 28 16:48:20 2013 +0000
+++ b/xen/xsm/flask/hooks.c Wed Jan 30 02:36:40 2013 -0800
@@ -1068,6 +1068,28 @@ static int flask_remove_from_physmap(str
return domain_has_perm(d1, d2, SECCLASS_MMU, MMU__PHYSMAP);
}
+static int flask_hvm_param(struct domain *d, unsigned long op)
+{
+ u32 perm;
+
+ switch ( op )
+ {
+ case HVMOP_set_param:
+ perm = HVM__SETPARAM;
+ break;
+ case HVMOP_get_param:
+ perm = HVM__GETPARAM;
+ break;
+ case HVMOP_track_dirty_vram:
+ perm = HVM__TRACKDIRTYVRAM;
+ break;
+ default:
+ perm = HVM__HVMCTL;
+ }
+
+ return current_has_perm(d, SECCLASS_HVM, perm);
+}
+
#ifdef CONFIG_X86
static int flask_shadow_control(struct domain *d, uint32_t op)
{
@@ -1148,28 +1170,6 @@ static int flask_ioport_mapping(struct d
return flask_ioport_permission(d, start, end, access);
}
-static int flask_hvm_param(struct domain *d, unsigned long op)
-{
- u32 perm;
-
- switch ( op )
- {
- case HVMOP_set_param:
- perm = HVM__SETPARAM;
- break;
- case HVMOP_get_param:
- perm = HVM__GETPARAM;
- break;
- case HVMOP_track_dirty_vram:
- perm = HVM__TRACKDIRTYVRAM;
- break;
- default:
- perm = HVM__HVMCTL;
- }
-
- return current_has_perm(d, SECCLASS_HVM, perm);
-}
-
static int flask_hvm_set_pci_intx_level(struct domain *d)
{
return current_has_perm(d, SECCLASS_HVM, HVM__PCILEVEL);
@@ -1503,6 +1503,7 @@ static struct xsm_operations flask_ops =
.page_offline = flask_page_offline,
.tmem_op = flask_tmem_op,
.tmem_control = flask_tmem_control,
+ .hvm_param = flask_hvm_param,
.do_xsm_op = do_flask_op,
@@ -1511,7 +1512,6 @@ static struct xsm_operations flask_ops =
#ifdef CONFIG_X86
.shadow_control = flask_shadow_control,
- .hvm_param = flask_hvm_param,
.hvm_set_pci_intx_level = flask_hvm_set_pci_intx_level,
.hvm_set_isa_irq_level = flask_hvm_set_isa_irq_level,
.hvm_set_pci_link_route = flask_hvm_set_pci_link_route,
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |