mirror of
https://github.com/qemu/qemu.git
synced 2024-12-12 21:23:36 +08:00
vhost: fixes
Misc fixes related to memory region handling. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -----BEGIN PGP SIGNATURE----- iQEcBAABAgAGBQJdi3mHAAoJECgfDbjSjVRp41wH/3l7E5zcJPJfzr9OTe0UmmtO PKzQrvdrUdLPJfxEY2dtTmJ/u3LpBB9PpAjPfEWaxFsI43OCbs7rwrDvgZsnEixI Ib1mFk1o8LUH2Df9dvlGXogcX413i/H1UQF3kLte1JL8iyPmo6HUXO8n6GZ6fo6x w7sGvC/NO5sNLPVadw2EOVPNSonp58zQFJB7i056cZ81ooUh4Rm09nQzgC2NmIA4 dRs/HrxM6BUYDRwwUN3x8Z4KMj138PxZ8QvF5DB54a9rX9EpL/iRl14zlYsNwi8D V32+FnH5kOrPvA2D2az2e0q//J2DiQu87Rkcv5B2b8Sys1HVnPVF12KD+VHaUTk= =C3aK -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging vhost: fixes Misc fixes related to memory region handling. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Wed 25 Sep 2019 15:28:23 BST # gpg: using RSA key 281F0DB8D28D5469 # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" [full] # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" [full] # Primary key fingerprint: 0270 606B 6F3C DF3D 0B17 0970 C350 3912 AFBE 8E67 # Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA 8A0D 281F 0DB8 D28D 5469 * remotes/mst/tags/for_upstream: vhost: Fix memory region section comparison memory: Provide an equality function for MemoryRegionSections memory: Align MemoryRegionSections fields Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
1329132d28
@ -451,8 +451,13 @@ static void vhost_commit(MemoryListener *listener)
|
||||
changed = true;
|
||||
} else {
|
||||
/* Same size, lets check the contents */
|
||||
changed = n_old_sections && memcmp(dev->mem_sections, old_sections,
|
||||
n_old_sections * sizeof(old_sections[0])) != 0;
|
||||
for (int i = 0; i < n_old_sections; i++) {
|
||||
if (!MemoryRegionSection_eq(&old_sections[i],
|
||||
&dev->mem_sections[i])) {
|
||||
changed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
trace_vhost_commit(dev->started, changed);
|
||||
|
@ -495,15 +495,27 @@ static inline FlatView *address_space_to_flatview(AddressSpace *as)
|
||||
* @nonvolatile: this section is non-volatile
|
||||
*/
|
||||
struct MemoryRegionSection {
|
||||
Int128 size;
|
||||
MemoryRegion *mr;
|
||||
FlatView *fv;
|
||||
hwaddr offset_within_region;
|
||||
Int128 size;
|
||||
hwaddr offset_within_address_space;
|
||||
bool readonly;
|
||||
bool nonvolatile;
|
||||
};
|
||||
|
||||
static inline bool MemoryRegionSection_eq(MemoryRegionSection *a,
|
||||
MemoryRegionSection *b)
|
||||
{
|
||||
return a->mr == b->mr &&
|
||||
a->fv == b->fv &&
|
||||
a->offset_within_region == b->offset_within_region &&
|
||||
a->offset_within_address_space == b->offset_within_address_space &&
|
||||
int128_eq(a->size, b->size) &&
|
||||
a->readonly == b->readonly &&
|
||||
a->nonvolatile == b->nonvolatile;
|
||||
}
|
||||
|
||||
/**
|
||||
* memory_region_init: Initialize a memory region
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user