From: Jan Beulich Date: Tue, 29 Sep 2015 11:54:55 +0000 (+0200) Subject: x86/EPT: adjust types in ept_split_super_page() X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~2477 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=53e3f77bfa108aa83396f84027df0abc852e121c;p=xen.git x86/EPT: adjust types in ept_split_super_page() The function returns a boolean and its current and target level inputs are unsigned (which in turn allows simplifying the early-out check). Also convert a non-standard loop variable to an ordinary function scope one, at once making it unsigned too. Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper Acked-by: George Dunlap --- diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c index ed4c4930bb..0d87ebcf9b 100644 --- a/xen/arch/x86/mm/p2m-ept.c +++ b/xen/arch/x86/mm/p2m-ept.c @@ -266,16 +266,18 @@ static void ept_free_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry, int l p2m_free_ptp(p2m, mfn_to_page(ept_entry->mfn)); } -static int ept_split_super_page(struct p2m_domain *p2m, ept_entry_t *ept_entry, - int level, int target) +static bool_t ept_split_super_page(struct p2m_domain *p2m, + ept_entry_t *ept_entry, + unsigned int level, unsigned int target) { ept_entry_t new_ept, *table; uint64_t trunk; - int rv = 1; + unsigned int i; + bool_t rv = 1; /* End if the entry is a leaf entry or reaches the target level. */ - if ( level == 0 || level == target ) - return rv; + if ( level <= target ) + return 1; ASSERT(is_epte_superpage(ept_entry)); @@ -285,7 +287,7 @@ static int ept_split_super_page(struct p2m_domain *p2m, ept_entry_t *ept_entry, table = map_domain_page(_mfn(new_ept.mfn)); trunk = 1UL << ((level - 1) * EPT_TABLE_ORDER); - for ( int i = 0; i < EPT_PAGETABLE_ENTRIES; i++ ) + for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ ) { ept_entry_t *epte = table + i;