mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
Xen 2017/07/21
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJZcp+2AAoJEIlPj0hw4a6QngIQAJQJb/dKrVSXA27v8oeEvPlF e1ZM+JuNiAQUPhLzuBhr0w2u+95/xarp911AeULY3X1eMww276VCO+xtz/XDJgy1 i+KNmveRfgr64iER3ytjLTWovtIwBWZZDDaPhQgefNVjgU/xPkmMEGz5VMyHuuoX bVKzGwaHED3Wb8XT4KQKxErg7HMZ7JfrFCVUvaNhJEWJr+DWC9SplcdR8ot0aT7Y 4jFIZTgJ9hgOgChGRajqWe2oQovlE26T6fBJwcgI/w/vZH6v+02T/5X6ESLQi8h1 Ur2pHtjsTSfFYwacL/D9T0kcUq6OwKEezzl3drvuT8TeTpc08l93ZJJnkiTJIoRT 2qr5YNUM9gndblK5lpVHQG9jLgsU4RMBSlu7HuXD5LnXa/SlLk93y7Wc3hgKxabj MeLR0WRrlvekVPmLvbFUk9xXw3KmP4NmeFMRS/pqF8fKwzOeI8nf+6q0kp+hXFIK d49CWbjuAKKEkSWv5DVU6KYq8Z+Po6ZnsJEPmvpaPKNNQMaYkDwOdjGmyhMpsWhn OwwZg86dcNS6E6l1UrAi7Grmyiu/ESC4NXUQVivX1GTI4sTjJZbM5an0PWPZH5Gi dxU/Ef0ZgH0/zEmKCIN/+N98UJb0nP4F1c1Cjs2xqf6yWniWfkl7PctEpzt9+Dlj uT/vTUfyyb0D/MEC+qUP =hsXv -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/sstabellini/tags/xen-20170721-tag' into staging Xen 2017/07/21 # gpg: Signature made Sat 22 Jul 2017 01:43:34 BST # gpg: using RSA key 0x894F8F4870E1AE90 # gpg: Good signature from "Stefano Stabellini <stefano.stabellini@eu.citrix.com>" # gpg: aka "Stefano Stabellini <sstabellini@kernel.org>" # Primary key fingerprint: D04E 33AB A51F 67BA 07D3 0AEA 894F 8F48 70E1 AE90 * remotes/sstabellini/tags/xen-20170721-tag: xen-mapcache: Fix the bug when overlapping emulated DMA operations may cause inconsistency in guest memory mappings xen: fix compilation on 32-bit hosts Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
df95f1a298
1 changed files with 16 additions and 6 deletions
|
@ -234,7 +234,8 @@ static void xen_remap_bucket(MapCacheEntry *entry,
|
||||||
static uint8_t *xen_map_cache_unlocked(hwaddr phys_addr, hwaddr size,
|
static uint8_t *xen_map_cache_unlocked(hwaddr phys_addr, hwaddr size,
|
||||||
uint8_t lock, bool dma)
|
uint8_t lock, bool dma)
|
||||||
{
|
{
|
||||||
MapCacheEntry *entry, *pentry = NULL;
|
MapCacheEntry *entry, *pentry = NULL,
|
||||||
|
*free_entry = NULL, *free_pentry = NULL;
|
||||||
hwaddr address_index;
|
hwaddr address_index;
|
||||||
hwaddr address_offset;
|
hwaddr address_offset;
|
||||||
hwaddr cache_size = size;
|
hwaddr cache_size = size;
|
||||||
|
@ -281,14 +282,22 @@ tryagain:
|
||||||
|
|
||||||
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 && (lock || entry->lock) && entry->vaddr_base &&
|
||||||
(entry->paddr_index != address_index || entry->size != cache_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))) {
|
||||||
|
if (!free_entry && !entry->lock) {
|
||||||
|
free_entry = entry;
|
||||||
|
free_pentry = pentry;
|
||||||
|
}
|
||||||
pentry = entry;
|
pentry = entry;
|
||||||
entry = entry->next;
|
entry = entry->next;
|
||||||
}
|
}
|
||||||
|
if (!entry && free_entry) {
|
||||||
|
entry = free_entry;
|
||||||
|
pentry = free_pentry;
|
||||||
|
}
|
||||||
if (!entry) {
|
if (!entry) {
|
||||||
entry = g_malloc0(sizeof (MapCacheEntry));
|
entry = g_malloc0(sizeof (MapCacheEntry));
|
||||||
pentry->next = entry;
|
pentry->next = entry;
|
||||||
|
@ -527,7 +536,7 @@ static uint8_t *xen_replace_cache_entry_unlocked(hwaddr old_phys_addr,
|
||||||
entry = entry->next;
|
entry = entry->next;
|
||||||
}
|
}
|
||||||
if (!entry) {
|
if (!entry) {
|
||||||
DPRINTF("Trying to update an entry for %lx " \
|
DPRINTF("Trying to update an entry for "TARGET_FMT_plx \
|
||||||
"that is not in the mapcache!\n", old_phys_addr);
|
"that is not in the mapcache!\n", old_phys_addr);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -535,15 +544,16 @@ static uint8_t *xen_replace_cache_entry_unlocked(hwaddr old_phys_addr,
|
||||||
address_index = new_phys_addr >> MCACHE_BUCKET_SHIFT;
|
address_index = new_phys_addr >> MCACHE_BUCKET_SHIFT;
|
||||||
address_offset = new_phys_addr & (MCACHE_BUCKET_SIZE - 1);
|
address_offset = new_phys_addr & (MCACHE_BUCKET_SIZE - 1);
|
||||||
|
|
||||||
fprintf(stderr, "Replacing a dummy mapcache entry for %lx with %lx\n",
|
fprintf(stderr, "Replacing a dummy mapcache entry for "TARGET_FMT_plx \
|
||||||
old_phys_addr, new_phys_addr);
|
" with "TARGET_FMT_plx"\n", old_phys_addr, new_phys_addr);
|
||||||
|
|
||||||
xen_remap_bucket(entry, entry->vaddr_base,
|
xen_remap_bucket(entry, entry->vaddr_base,
|
||||||
cache_size, address_index, false);
|
cache_size, address_index, false);
|
||||||
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)) {
|
||||||
DPRINTF("Unable to update a mapcache entry for %lx!\n", old_phys_addr);
|
DPRINTF("Unable to update a mapcache entry for "TARGET_FMT_plx"!\n",
|
||||||
|
old_phys_addr);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue