[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 02/16] x86/shadow: fold/rename sh_unhook_*_mappings()
The "32b" and "pae" functions are identical at the source level (they differ in what they get compiled to, due to differences in SHADOW_FOREACH_L2E()), leaving aside a comment the PAE variant has and the non-PAE one doesn't. Replace these infixes by the more usual l<N> ones (and then also for the "64b" one for consistency; that'll also allow for re-use once we support 5-level paging, if need be). The two different instances are still distinguishable by their "level" suffix. While fiddling with the names, convert the last parameter to boolean as well. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- As long as the backing functions don't need to invoke each other, the infixes could arguably also be dropped altogether. Every mode has exactly one such function. (Thinking of it, unhooking at L4 is kind of pointless for PV32, as the guest controlled root is L3. The only time where we might want to unhook from L4 is when we clean up after the guest. But even that's not strictly necessary as that would also be taken care of by sh_detach_old_tables().) --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -898,14 +898,14 @@ void shadow_unhook_mappings(struct domai { #ifdef CONFIG_HVM case SH_type_l2_32_shadow: - SHADOW_INTERNAL_NAME(sh_unhook_32b_mappings, 2)(d, smfn, user_only); + SHADOW_INTERNAL_NAME(sh_unhook_l2_mappings, 2)(d, smfn, user_only); break; case SH_type_l2_pae_shadow: - SHADOW_INTERNAL_NAME(sh_unhook_pae_mappings, 3)(d, smfn, user_only); + SHADOW_INTERNAL_NAME(sh_unhook_l2_mappings, 3)(d, smfn, user_only); break; #endif case SH_type_l4_64_shadow: - SHADOW_INTERNAL_NAME(sh_unhook_64b_mappings, 4)(d, smfn, user_only); + SHADOW_INTERNAL_NAME(sh_unhook_l4_mappings, 4)(d, smfn, user_only); break; default: printk(XENLOG_ERR "Bad top-level shadow type %08x\n", sp->u.sh.type); --- a/xen/arch/x86/mm/shadow/multi.c +++ b/xen/arch/x86/mm/shadow/multi.c @@ -1416,21 +1416,9 @@ void sh_destroy_l1_shadow(struct domain * This implementation is pretty crude and slow, but we hope that it won't * be called very often. */ -#if GUEST_PAGING_LEVELS == 2 +#if GUEST_PAGING_LEVELS < 4 -void sh_unhook_32b_mappings(struct domain *d, mfn_t sl2mfn, int user_only) -{ - shadow_l2e_t *sl2e; - SHADOW_FOREACH_L2E(sl2mfn, sl2e, 0, 0, d, { - if ( !user_only || (sl2e->l2 & _PAGE_USER) ) - shadow_set_l2e(d, sl2e, shadow_l2e_empty(), sl2mfn); - }); -} - -#elif GUEST_PAGING_LEVELS == 3 - -void sh_unhook_pae_mappings(struct domain *d, mfn_t sl2mfn, int user_only) -/* Walk a PAE l2 shadow, unhooking entries from all the subshadows */ +void sh_unhook_l2_mappings(struct domain *d, mfn_t sl2mfn, bool user_only) { shadow_l2e_t *sl2e; SHADOW_FOREACH_L2E(sl2mfn, sl2e, 0, 0, d, { @@ -1441,7 +1429,7 @@ void sh_unhook_pae_mappings(struct domai #elif GUEST_PAGING_LEVELS == 4 -void sh_unhook_64b_mappings(struct domain *d, mfn_t sl4mfn, int user_only) +void sh_unhook_l4_mappings(struct domain *d, mfn_t sl4mfn, bool user_only) { shadow_l4e_t *sl4e; SHADOW_FOREACH_L4E(sl4mfn, sl4e, 0, 0, d, { --- a/xen/arch/x86/mm/shadow/multi.h +++ b/xen/arch/x86/mm/shadow/multi.h @@ -50,14 +50,11 @@ SHADOW_INTERNAL_NAME(sh_destroy_l4_shado struct domain *d, mfn_t smfn); extern void -SHADOW_INTERNAL_NAME(sh_unhook_32b_mappings, GUEST_LEVELS) - (struct domain *d, mfn_t sl2mfn, int user_only); +SHADOW_INTERNAL_NAME(sh_unhook_l2_mappings, GUEST_LEVELS) + (struct domain *d, mfn_t sl2mfn, bool user_only); extern void -SHADOW_INTERNAL_NAME(sh_unhook_pae_mappings, GUEST_LEVELS) - (struct domain *d, mfn_t sl3mfn, int user_only); -extern void -SHADOW_INTERNAL_NAME(sh_unhook_64b_mappings, GUEST_LEVELS) - (struct domain *d, mfn_t sl4mfn, int user_only); +SHADOW_INTERNAL_NAME(sh_unhook_l4_mappings, GUEST_LEVELS) + (struct domain *d, mfn_t sl4mfn, bool user_only); int cf_check SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, GUEST_LEVELS) --- a/xen/arch/x86/mm/shadow/types.h +++ b/xen/arch/x86/mm/shadow/types.h @@ -232,9 +232,8 @@ static inline shadow_l4e_t shadow_l4e_fr #define sh_destroy_l3_shadow INTERNAL_NAME(sh_destroy_l3_shadow) #define sh_destroy_l2_shadow INTERNAL_NAME(sh_destroy_l2_shadow) #define sh_destroy_l1_shadow INTERNAL_NAME(sh_destroy_l1_shadow) -#define sh_unhook_32b_mappings INTERNAL_NAME(sh_unhook_32b_mappings) -#define sh_unhook_pae_mappings INTERNAL_NAME(sh_unhook_pae_mappings) -#define sh_unhook_64b_mappings INTERNAL_NAME(sh_unhook_64b_mappings) +#define sh_unhook_l2_mappings INTERNAL_NAME(sh_unhook_l2_mappings) +#define sh_unhook_l4_mappings INTERNAL_NAME(sh_unhook_l4_mappings) #define sh_paging_mode INTERNAL_NAME(sh_paging_mode) #define sh_audit_l1_table INTERNAL_NAME(sh_audit_l1_table) #define sh_audit_fl1_table INTERNAL_NAME(sh_audit_fl1_table)
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |