xen: do not use __-named variables in mapcache
Keep the namespace clean. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
This commit is contained in:
parent
3996e85c18
commit
9b6d7b365d
@ -199,8 +199,8 @@ uint8_t *xen_map_cache(hwaddr phys_addr, hwaddr size,
|
|||||||
MapCacheEntry *entry, *pentry = NULL;
|
MapCacheEntry *entry, *pentry = NULL;
|
||||||
hwaddr address_index;
|
hwaddr address_index;
|
||||||
hwaddr address_offset;
|
hwaddr address_offset;
|
||||||
hwaddr __size = size;
|
hwaddr cache_size = size;
|
||||||
hwaddr __test_bit_size = size;
|
hwaddr test_bit_size;
|
||||||
bool translated = false;
|
bool translated = false;
|
||||||
|
|
||||||
tryagain:
|
tryagain:
|
||||||
@ -209,22 +209,22 @@ tryagain:
|
|||||||
|
|
||||||
trace_xen_map_cache(phys_addr);
|
trace_xen_map_cache(phys_addr);
|
||||||
|
|
||||||
/* __test_bit_size is always a multiple of XC_PAGE_SIZE */
|
/* test_bit_size is always a multiple of XC_PAGE_SIZE */
|
||||||
if (size) {
|
if (size) {
|
||||||
__test_bit_size = size + (phys_addr & (XC_PAGE_SIZE - 1));
|
test_bit_size = size + (phys_addr & (XC_PAGE_SIZE - 1));
|
||||||
|
|
||||||
if (__test_bit_size % XC_PAGE_SIZE) {
|
if (test_bit_size % XC_PAGE_SIZE) {
|
||||||
__test_bit_size += XC_PAGE_SIZE - (__test_bit_size % XC_PAGE_SIZE);
|
test_bit_size += XC_PAGE_SIZE - (test_bit_size % XC_PAGE_SIZE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
__test_bit_size = XC_PAGE_SIZE;
|
test_bit_size = XC_PAGE_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapcache->last_entry != NULL &&
|
if (mapcache->last_entry != NULL &&
|
||||||
mapcache->last_entry->paddr_index == address_index &&
|
mapcache->last_entry->paddr_index == address_index &&
|
||||||
!lock && !__size &&
|
!lock && !size &&
|
||||||
test_bits(address_offset >> XC_PAGE_SHIFT,
|
test_bits(address_offset >> XC_PAGE_SHIFT,
|
||||||
__test_bit_size >> XC_PAGE_SHIFT,
|
test_bit_size >> XC_PAGE_SHIFT,
|
||||||
mapcache->last_entry->valid_mapping)) {
|
mapcache->last_entry->valid_mapping)) {
|
||||||
trace_xen_map_cache_return(mapcache->last_entry->vaddr_base + address_offset);
|
trace_xen_map_cache_return(mapcache->last_entry->vaddr_base + address_offset);
|
||||||
return mapcache->last_entry->vaddr_base + address_offset;
|
return mapcache->last_entry->vaddr_base + address_offset;
|
||||||
@ -232,20 +232,20 @@ tryagain:
|
|||||||
|
|
||||||
/* size is always a multiple of MCACHE_BUCKET_SIZE */
|
/* size is always a multiple of MCACHE_BUCKET_SIZE */
|
||||||
if (size) {
|
if (size) {
|
||||||
__size = size + address_offset;
|
cache_size = size + address_offset;
|
||||||
if (__size % MCACHE_BUCKET_SIZE) {
|
if (cache_size % MCACHE_BUCKET_SIZE) {
|
||||||
__size += MCACHE_BUCKET_SIZE - (__size % MCACHE_BUCKET_SIZE);
|
cache_size += MCACHE_BUCKET_SIZE - (cache_size % MCACHE_BUCKET_SIZE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
__size = MCACHE_BUCKET_SIZE;
|
cache_size = MCACHE_BUCKET_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
entry = &mapcache->entry[address_index % mapcache->nr_buckets];
|
entry = &mapcache->entry[address_index % mapcache->nr_buckets];
|
||||||
|
|
||||||
while (entry && entry->lock && entry->vaddr_base &&
|
while (entry && entry->lock && entry->vaddr_base &&
|
||||||
(entry->paddr_index != address_index || entry->size != __size ||
|
(entry->paddr_index != address_index || entry->size != cache_size ||
|
||||||
!test_bits(address_offset >> XC_PAGE_SHIFT,
|
!test_bits(address_offset >> XC_PAGE_SHIFT,
|
||||||
__test_bit_size >> XC_PAGE_SHIFT,
|
test_bit_size >> XC_PAGE_SHIFT,
|
||||||
entry->valid_mapping))) {
|
entry->valid_mapping))) {
|
||||||
pentry = entry;
|
pentry = entry;
|
||||||
entry = entry->next;
|
entry = entry->next;
|
||||||
@ -253,19 +253,19 @@ tryagain:
|
|||||||
if (!entry) {
|
if (!entry) {
|
||||||
entry = g_malloc0(sizeof (MapCacheEntry));
|
entry = g_malloc0(sizeof (MapCacheEntry));
|
||||||
pentry->next = entry;
|
pentry->next = entry;
|
||||||
xen_remap_bucket(entry, __size, address_index);
|
xen_remap_bucket(entry, cache_size, address_index);
|
||||||
} else if (!entry->lock) {
|
} else if (!entry->lock) {
|
||||||
if (!entry->vaddr_base || entry->paddr_index != address_index ||
|
if (!entry->vaddr_base || entry->paddr_index != address_index ||
|
||||||
entry->size != __size ||
|
entry->size != cache_size ||
|
||||||
!test_bits(address_offset >> XC_PAGE_SHIFT,
|
!test_bits(address_offset >> XC_PAGE_SHIFT,
|
||||||
__test_bit_size >> XC_PAGE_SHIFT,
|
test_bit_size >> XC_PAGE_SHIFT,
|
||||||
entry->valid_mapping)) {
|
entry->valid_mapping)) {
|
||||||
xen_remap_bucket(entry, __size, address_index);
|
xen_remap_bucket(entry, cache_size, address_index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!test_bits(address_offset >> XC_PAGE_SHIFT,
|
if(!test_bits(address_offset >> XC_PAGE_SHIFT,
|
||||||
__test_bit_size >> XC_PAGE_SHIFT,
|
test_bit_size >> XC_PAGE_SHIFT,
|
||||||
entry->valid_mapping)) {
|
entry->valid_mapping)) {
|
||||||
mapcache->last_entry = NULL;
|
mapcache->last_entry = NULL;
|
||||||
if (!translated && mapcache->phys_offset_to_gaddr) {
|
if (!translated && mapcache->phys_offset_to_gaddr) {
|
||||||
|
Loading…
Reference in New Issue
Block a user