diff options
author | Daniel De Graaf <dgdegra@tycho.nsa.gov> | 2013-05-07 16:51:19 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2013-05-07 16:51:19 +0200 |
commit | 3b77afc7f3bfce1fa09b4cf3d54b4463cf4c216f (patch) | |
tree | df6cd25cd9c00eac83c5d30cdf5e1187e3caebdf /xen/include | |
parent | f3d7d1b2c5124d88d27a70a5f02a3c14fd169d42 (diff) | |
download | xen-3b77afc7f3bfce1fa09b4cf3d54b4463cf4c216f.tar.gz xen-3b77afc7f3bfce1fa09b4cf3d54b4463cf4c216f.tar.bz2 xen-3b77afc7f3bfce1fa09b4cf3d54b4463cf4c216f.zip |
rename IS_PRIV to is_hardware_domain
Since the remaining uses of IS_PRIV are actually concerned with the
domain having control of the hardware (i.e. being the initial domain),
clarify this by renaming IS_PRIV to is_hardware_domain. This also
removes IS_PRIV_FOR since the only remaining user was xsm/dummy.h.
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com> (for 4.3 release)
Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/include')
-rw-r--r-- | xen/include/xen/sched.h | 12 | ||||
-rw-r--r-- | xen/include/xsm/dummy.h | 32 |
2 files changed, 30 insertions, 14 deletions
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index cb3baed344..5b55c09fb6 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -716,8 +716,16 @@ uint64_t get_cpu_idle_time(unsigned int cpu); void watchdog_domain_init(struct domain *d); void watchdog_domain_destroy(struct domain *d); -#define IS_PRIV(_d) ((_d)->is_privileged) -#define IS_PRIV_FOR(_d, _t) (IS_PRIV(_d) || ((_d)->target && (_d)->target == (_t))) +/* + * Use this check when the following are both true: + * - Using this feature or interface requires full access to the hardware + * (that is, this is would not be suitable for a driver domain) + * - There is never a reason to deny dom0 access to this + */ +#define is_hardware_domain(_d) ((_d)->is_privileged) + +/* This check is for functionality specific to a control domain */ +#define is_control_domain(_d) ((_d)->is_privileged) #define VM_ASSIST(_d,_t) (test_bit((_t), &(_d)->vm_assist)) diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h index 3912bd93b9..a87205661d 100644 --- a/xen/include/xsm/dummy.h +++ b/xen/include/xsm/dummy.h @@ -60,17 +60,23 @@ static always_inline int xsm_default_action( case XSM_HOOK: return 0; case XSM_DM_PRIV: - if ( !IS_PRIV_FOR(src, target) ) - return -EPERM; - return 0; + if ( src->is_privileged ) + return 0; + if ( target && src->target == target ) + return 0; + return -EPERM; case XSM_TARGET: - if ( src != target && !IS_PRIV_FOR(src, target) ) - return -EPERM; - return 0; + if ( src == target ) + return 0; + if ( src->is_privileged ) + return 0; + if ( target && src->target == target ) + return 0; + return -EPERM; case XSM_PRIV: - if ( !IS_PRIV(src) ) - return -EPERM; - return 0; + if ( src->is_privileged ) + return 0; + return -EPERM; default: LINKER_BUG_ON(1); return -EPERM; @@ -567,10 +573,12 @@ static XSM_INLINE int xsm_domain_memory_map(XSM_DEFAULT_ARG struct domain *d) static XSM_INLINE int xsm_mmu_update(XSM_DEFAULT_ARG struct domain *d, struct domain *t, struct domain *f, uint32_t flags) { + int rc; XSM_ASSERT_ACTION(XSM_TARGET); - if ( t && d != t && !IS_PRIV_FOR(d, t) ) - return -EPERM; - return xsm_default_action(action, d, f); + rc = xsm_default_action(action, d, f); + if ( t && !rc ) + rc = xsm_default_action(action, d, t); + return rc; } static XSM_INLINE int xsm_mmuext_op(XSM_DEFAULT_ARG struct domain *d, struct domain *f) |