* -smp cleanpus (Yanan)

* Hyper-V enlightenment functionality (Vitaly)
 * virtio-mem support in dump, tpm and QMP (David)
 * NetBSD GCC 7.4 compiler support (Nia)
 -----BEGIN PGP SIGNATURE-----
 
 iQFIBAABCAAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmFZXqoUHHBib256aW5p
 QHJlZGhhdC5jb20ACgkQv/vSX3jHroOD7wf+Nu+ussVGhCGM34Jp8HhpBvp97Xap
 CSz9udJc6uOK8qeZgOj9zqZ8kDKXv1hifuuOnyWnyi+Ojgyi5mKEhmnlZBt7WK8b
 gwqADAgNpBzM8OSK6kT6WjLKods9OkBnDqSKFOakddrLJ1lmfjox1BKfykqtsux3
 sc+eKVFYA9mu5AEiWOs9yDXUUPbdJfTjEI2dHcJco6K+/Ei5++z7hyMjcX/pDj/Q
 Bq9LtrKS6XZahpy6ywsBQVjq1NqN9PXtFJOkUGftEYj/BAyl69Z9nU0g+HUKJOMw
 40VsUpkL4su5rfID0gOGJhT09w5u/Hfyc/4VzCLAJ4NbP76uNcnMVXyiQA==
 =nrp5
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging

* -smp cleanpus (Yanan)
* Hyper-V enlightenment functionality (Vitaly)
* virtio-mem support in dump, tpm and QMP (David)
* NetBSD GCC 7.4 compiler support (Nia)

# gpg: Signature made Sun 03 Oct 2021 03:41:30 AM EDT
# gpg:                using RSA key F13338574B662389866C7682BFFBD25F78C7AE83
# gpg:                issuer "pbonzini@redhat.com"
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full]
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [full]

* remotes/bonzini/tags/for-upstream:
  softmmu/memory_mapping: optimize for RamDiscardManager sections
  softmmu/memory_mapping: factor out adding physical memory ranges
  softmmu/memory_mapping: never merge ranges accross memory regions
  tpm: mark correct memory region range dirty when clearing RAM
  monitor: Rate-limit MEMORY_DEVICE_SIZE_CHANGE qapi events per device
  qapi: Include qom-path in MEMORY_DEVICE_SIZE_CHANGE qapi events
  virtio-mem-pci: Fix memory leak when creating MEMORY_DEVICE_SIZE_CHANGE event
  configure: Loosen GCC requirement from 7.5.0 to 7.4.0

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2021-10-03 08:45:19 -04:00
commit 30bd1db58b
6 changed files with 66 additions and 33 deletions

6
configure vendored
View File

@ -2094,8 +2094,8 @@ cat > $TMPC << EOF
# endif
# endif
#elif defined(__GNUC__) && defined(__GNUC_MINOR__)
# if __GNUC__ < 7 || (__GNUC__ == 7 && __GNUC_MINOR__ < 5)
# error You need at least GCC v7.5.0 to compile QEMU
# if __GNUC__ < 7 || (__GNUC__ == 7 && __GNUC_MINOR__ < 4)
# error You need at least GCC v7.4.0 to compile QEMU
# endif
#else
# error You either need GCC or Clang to compiler QEMU
@ -2103,7 +2103,7 @@ cat > $TMPC << EOF
int main (void) { return 0; }
EOF
if ! compile_prog "" "" ; then
error_exit "You need at least GCC v7.5 or Clang v6.0 (or XCode Clang v10.0)"
error_exit "You need at least GCC v7.4 or Clang v6.0 (or XCode Clang v10.0)"
fi
# Accumulate -Wfoo and -Wno-bar separately.

View File

@ -30,11 +30,14 @@ void tpm_ppi_reset(TPMPPI *tpmppi)
guest_phys_blocks_init(&guest_phys_blocks);
guest_phys_blocks_append(&guest_phys_blocks);
QTAILQ_FOREACH(block, &guest_phys_blocks.head, next) {
hwaddr mr_offs = block->host_addr -
(uint8_t *)memory_region_get_ram_ptr(block->mr);
trace_tpm_ppi_memset(block->host_addr,
block->target_end - block->target_start);
memset(block->host_addr, 0,
block->target_end - block->target_start);
memory_region_set_dirty(block->mr, 0,
memory_region_set_dirty(block->mr, mr_offs,
block->target_end - block->target_start);
}
guest_phys_blocks_free(&guest_phys_blocks);

View File

@ -87,14 +87,12 @@ static void virtio_mem_pci_size_change_notify(Notifier *notifier, void *data)
VirtIOMEMPCI *pci_mem = container_of(notifier, VirtIOMEMPCI,
size_change_notifier);
DeviceState *dev = DEVICE(pci_mem);
char *qom_path = object_get_canonical_path(OBJECT(dev));
const uint64_t * const size_p = data;
const char *id = NULL;
if (dev->id) {
id = g_strdup(dev->id);
}
qapi_event_send_memory_device_size_change(!!id, id, *size_p);
qapi_event_send_memory_device_size_change(!!dev->id, dev->id, *size_p,
qom_path);
g_free(qom_path);
}
static void virtio_mem_pci_class_init(ObjectClass *klass, void *data)

View File

@ -474,6 +474,10 @@ static unsigned int qapi_event_throttle_hash(const void *key)
hash += g_str_hash(qdict_get_str(evstate->data, "node-name"));
}
if (evstate->event == QAPI_EVENT_MEMORY_DEVICE_SIZE_CHANGE) {
hash += g_str_hash(qdict_get_str(evstate->data, "qom-path"));
}
return hash;
}
@ -496,6 +500,11 @@ static gboolean qapi_event_throttle_equal(const void *a, const void *b)
qdict_get_str(evb->data, "node-name"));
}
if (eva->event == QAPI_EVENT_MEMORY_DEVICE_SIZE_CHANGE) {
return !strcmp(qdict_get_str(eva->data, "qom-path"),
qdict_get_str(evb->data, "qom-path"));
}
return TRUE;
}

View File

@ -1336,8 +1336,11 @@
# action).
#
# @id: device's ID
#
# @size: the new size of memory that the device provides
#
# @qom-path: path to the device object in the QOM tree (since 6.2)
#
# Note: this event is rate-limited.
#
# Since: 5.1
@ -1350,7 +1353,7 @@
#
##
{ 'event': 'MEMORY_DEVICE_SIZE_CHANGE',
'data': { '*id': 'str', 'size': 'size' } }
'data': { '*id': 'str', 'size': 'size', 'qom-path' : 'str'} }
##

View File

@ -193,29 +193,14 @@ typedef struct GuestPhysListener {
MemoryListener listener;
} GuestPhysListener;
static void guest_phys_blocks_region_add(MemoryListener *listener,
static void guest_phys_block_add_section(GuestPhysListener *g,
MemoryRegionSection *section)
{
GuestPhysListener *g;
uint64_t section_size;
hwaddr target_start, target_end;
uint8_t *host_addr;
GuestPhysBlock *predecessor;
/* we only care about RAM */
if (!memory_region_is_ram(section->mr) ||
memory_region_is_ram_device(section->mr) ||
memory_region_is_nonvolatile(section->mr)) {
return;
}
g = container_of(listener, GuestPhysListener, listener);
section_size = int128_get64(section->size);
target_start = section->offset_within_address_space;
target_end = target_start + section_size;
host_addr = memory_region_get_ram_ptr(section->mr) +
section->offset_within_region;
predecessor = NULL;
const hwaddr target_start = section->offset_within_address_space;
const hwaddr target_end = target_start + int128_get64(section->size);
uint8_t *host_addr = memory_region_get_ram_ptr(section->mr) +
section->offset_within_region;
GuestPhysBlock *predecessor = NULL;
/* find continuity in guest physical address space */
if (!QTAILQ_EMPTY(&g->list->head)) {
@ -229,7 +214,8 @@ static void guest_phys_blocks_region_add(MemoryListener *listener,
/* we want continuity in both guest-physical and host-virtual memory */
if (predecessor->target_end < target_start ||
predecessor->host_addr + predecessor_size != host_addr) {
predecessor->host_addr + predecessor_size != host_addr ||
predecessor->mr != section->mr) {
predecessor = NULL;
}
}
@ -260,6 +246,40 @@ static void guest_phys_blocks_region_add(MemoryListener *listener,
#endif
}
static int guest_phys_ram_populate_cb(MemoryRegionSection *section,
void *opaque)
{
GuestPhysListener *g = opaque;
guest_phys_block_add_section(g, section);
return 0;
}
static void guest_phys_blocks_region_add(MemoryListener *listener,
MemoryRegionSection *section)
{
GuestPhysListener *g = container_of(listener, GuestPhysListener, listener);
/* we only care about RAM */
if (!memory_region_is_ram(section->mr) ||
memory_region_is_ram_device(section->mr) ||
memory_region_is_nonvolatile(section->mr)) {
return;
}
/* for special sparse regions, only add populated parts */
if (memory_region_has_ram_discard_manager(section->mr)) {
RamDiscardManager *rdm;
rdm = memory_region_get_ram_discard_manager(section->mr);
ram_discard_manager_replay_populated(rdm, section,
guest_phys_ram_populate_cb, g);
return;
}
guest_phys_block_add_section(g, section);
}
void guest_phys_blocks_append(GuestPhysBlockList *list)
{
GuestPhysListener g = { 0 };