From: Julien Grall Date: Thu, 15 Sep 2016 11:28:20 +0000 (+0100) Subject: xen/arm: p2m: Use typesafe gfn in p2m_mem_access_radix_set X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~338 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=e22ac0e000a8366b771e524c1f22fe1924348fe9;p=xen.git xen/arm: p2m: Use typesafe gfn in p2m_mem_access_radix_set p2m_mem_access_radix_set is expecting a gfn in a parameter. Rename the parameter 'pfn' to 'gfn' to match its content and use the typesafe gfn to avoid possible misusage. Also rename the parameter to gfn to match its content. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini Tested-by: Tamas K Lengyel --- diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 929a96bb74..fe0ed9fd3e 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -550,7 +550,7 @@ static int __p2m_get_mem_access(struct domain *d, gfn_t gfn, return 0; } -static int p2m_mem_access_radix_set(struct p2m_domain *p2m, unsigned long pfn, +static int p2m_mem_access_radix_set(struct p2m_domain *p2m, gfn_t gfn, p2m_access_t a) { int rc; @@ -560,18 +560,18 @@ static int p2m_mem_access_radix_set(struct p2m_domain *p2m, unsigned long pfn, if ( p2m_access_rwx == a ) { - radix_tree_delete(&p2m->mem_access_settings, pfn); + radix_tree_delete(&p2m->mem_access_settings, gfn_x(gfn)); return 0; } - rc = radix_tree_insert(&p2m->mem_access_settings, pfn, + rc = radix_tree_insert(&p2m->mem_access_settings, gfn_x(gfn), radix_tree_int_to_ptr(a)); if ( rc == -EEXIST ) { /* If a setting already exists, change it to the new one */ radix_tree_replace_slot( radix_tree_lookup_slot( - &p2m->mem_access_settings, pfn), + &p2m->mem_access_settings, gfn_x(gfn)), radix_tree_int_to_ptr(a)); rc = 0; } @@ -715,7 +715,7 @@ static int apply_one_level(struct domain *d, */ (level == 3 || (!p2m_table(orig_pte) && !p2m->mem_access_enabled)) ) { - rc = p2m_mem_access_radix_set(p2m, paddr_to_pfn(*addr), a); + rc = p2m_mem_access_radix_set(p2m, _gfn(paddr_to_pfn(*addr)), a); if ( rc < 0 ) return rc; @@ -833,7 +833,8 @@ static int apply_one_level(struct domain *d, *flush = true; p2m_remove_pte(entry, p2m->clean_pte); - p2m_mem_access_radix_set(p2m, paddr_to_pfn(*addr), p2m_access_rwx); + p2m_mem_access_radix_set(p2m, _gfn(paddr_to_pfn(*addr)), + p2m_access_rwx); *addr += level_size; *maddr += level_size; @@ -904,7 +905,8 @@ static int apply_one_level(struct domain *d, if ( p2m_valid(pte) ) { - rc = p2m_mem_access_radix_set(p2m, paddr_to_pfn(*addr), a); + rc = p2m_mem_access_radix_set(p2m, _gfn(paddr_to_pfn(*addr)), + a); if ( rc < 0 ) return rc;