Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge tag 'accel-20230628' of https://github.com/philmd/qemu into sta…
…ging

Accelerators patches

- MAINTAINERS: Update Roman Bolshakov email address
- HAX: Fix a memory leak
- HAX/NVMM/WHPX/HVF: Rename per-accel state as AccelCPUState
- KVM: Restrict specific fields from ArchCPU
- WHPX: Re-enable cross-build gitlab-ci job on case sensitive filesystems
- WHPX: Fix error message when setting ProcessorCount fails
- exec/memory: Add definitions for memory listener priorities

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmScVtkACgkQ4+MsLN6t
# wN7p8A//RXuX9gLFT35zx+5axocU3/XBbCsQWSvzzkYoXxmC/TLxvivO66NPGMc0
# C76b1FJUoLS/u9SyJUeIeYkL0rjkzARUKcRpiJXM21WM6ou8Nkz0kuI4ouowt+4K
# i/4chTjxlN5/4PKlHHcX9ZUJ9acVj01zO1BCuj/bVsxO6WMT1kjL+kplVxxFR3aW
# tlbYtUT3v4xmp94FfE2Q9lR25z4usrGnmz2rchaadlVc43kmsNcQRx+EoUdi148n
# lkViRR90sacYPX586s2yxhPpUdtrXjJmEdX0X00urdPqljkRxekHtyTqG4CRZi+K
# hG5NztK7p37GNNXZroL0gpHyr9IX6hZ3o8rmN3IiCOGU6BgQBRUhvvG2sblwcJ1A
# SSiBK4RWtgyIGWt4U6PgVj8IAu55JuqT5xR2r34fH/zccxXlp/B13vadGs7TUK15
# oHDUT4GnKL2R29lVFTl95BzsxwaMtbB9w01CLJk8va2T/97eqtFgvJyuVC9vZb0N
# 41u2RkinaQZ+hbq9TP1G21zpG0eyucEMIQ6loUd7+G3KJFjFfB4JzE2VDm0Y/OVy
# 77cEEQ67wts29fMNSqqPIQCMttDrNj7JqMMknGBQS2iHPgF+B3KjwIjnRaMBt73I
# CKPITOJPmb+kvIUsK3KlONdicEG57cBxFBTZW5+P9pJXF5izrAY=
# =b9hj
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 28 Jun 2023 05:50:49 PM CEST
# gpg:                using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE
# gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [full]

* tag 'accel-20230628' of https://github.com/philmd/qemu: (30 commits)
  exec/memory: Add symbol for the min value of memory listener priority
  exec/memory: Add symbol for memory listener priority for device backend
  exec/memory: Add symbolic value for memory listener priority for accel
  target/i386/WHPX: Fix error message when fail to set ProcessorCount
  target/riscv: Restrict KVM-specific fields from ArchCPU
  target/ppc: Restrict KVM-specific fields from ArchCPU
  target/arm: Restrict KVM-specific fields from ArchCPU
  hw/arm/sbsa-ref: Include missing 'sysemu/kvm.h' header
  hw/intc/arm_gic: Rename 'first_cpu' argument
  hw/intc/arm_gic: Un-inline GIC*/ITS class_name() helpers
  accel/kvm: Declare kvm_direct_msi_allowed in stubs
  accel/kvm: Re-include "exec/memattrs.h" header
  accel: Rename HVF 'struct hvf_vcpu_state' -> AccelCPUState
  accel: Rename 'cpu_state' -> 'cs'
  accel: Inline WHPX get_whpx_vcpu()
  accel: Rename WHPX 'struct whpx_vcpu' -> AccelCPUState
  accel: Remove WHPX unreachable error path
  accel: Inline NVMM get_qemu_vcpu()
  accel: Rename NVMM 'struct qemu_vcpu' -> AccelCPUState
  accel: Remove NVMM unreachable error path
  ...

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
  • Loading branch information
rth7680 committed Jun 29, 2023
2 parents 0eb8f90 + 14a868c commit 017b2e7
Show file tree
Hide file tree
Showing 64 changed files with 582 additions and 559 deletions.
3 changes: 2 additions & 1 deletion .mailmap
Expand Up @@ -76,9 +76,10 @@ Paul Burton <paulburton@kernel.org> <pburton@wavecomp.com>
Philippe Mathieu-Daudé <philmd@linaro.org> <f4bug@amsat.org>
Philippe Mathieu-Daudé <philmd@linaro.org> <philmd@redhat.com>
Philippe Mathieu-Daudé <philmd@linaro.org> <philmd@fungible.com>
Roman Bolshakov <rbolshakov@ddn.com> <r.bolshakov@yadro.com>
Stefan Brankovic <stefan.brankovic@syrmia.com> <stefan.brankovic@rt-rk.com.com>
Yongbok Kim <yongbok.kim@mips.com> <yongbok.kim@imgtec.com>
Taylor Simpson <ltaylorsimpson@gmail.com> <tsimpson@quicinc.com>
Yongbok Kim <yongbok.kim@mips.com> <yongbok.kim@imgtec.com>

# Also list preferred name forms where people have changed their
# git author config, or had utf8/latin1 encoding issues.
Expand Down
4 changes: 2 additions & 2 deletions MAINTAINERS
Expand Up @@ -498,14 +498,14 @@ F: target/arm/hvf/

X86 HVF CPUs
M: Cameron Esfahani <dirty@apple.com>
M: Roman Bolshakov <r.bolshakov@yadro.com>
M: Roman Bolshakov <rbolshakov@ddn.com>
W: https://wiki.qemu.org/Features/HVF
S: Maintained
F: target/i386/hvf/

HVF
M: Cameron Esfahani <dirty@apple.com>
M: Roman Bolshakov <r.bolshakov@yadro.com>
M: Roman Bolshakov <rbolshakov@ddn.com>
W: https://wiki.qemu.org/Features/HVF
S: Maintained
F: accel/hvf/
Expand Down
21 changes: 11 additions & 10 deletions accel/hvf/hvf-accel-ops.c
Expand Up @@ -304,7 +304,7 @@ static void hvf_region_del(MemoryListener *listener,

static MemoryListener hvf_memory_listener = {
.name = "hvf",
.priority = 10,
.priority = MEMORY_LISTENER_PRIORITY_ACCEL,
.region_add = hvf_region_add,
.region_del = hvf_region_del,
.log_start = hvf_log_start,
Expand Down Expand Up @@ -372,19 +372,19 @@ type_init(hvf_type_init);

static void hvf_vcpu_destroy(CPUState *cpu)
{
hv_return_t ret = hv_vcpu_destroy(cpu->hvf->fd);
hv_return_t ret = hv_vcpu_destroy(cpu->accel->fd);
assert_hvf_ok(ret);

hvf_arch_vcpu_destroy(cpu);
g_free(cpu->hvf);
cpu->hvf = NULL;
g_free(cpu->accel);
cpu->accel = NULL;
}

static int hvf_init_vcpu(CPUState *cpu)
{
int r;

cpu->hvf = g_malloc0(sizeof(*cpu->hvf));
cpu->accel = g_new0(AccelCPUState, 1);

/* init cpu signals */
struct sigaction sigact;
Expand All @@ -393,18 +393,19 @@ static int hvf_init_vcpu(CPUState *cpu)
sigact.sa_handler = dummy_signal;
sigaction(SIG_IPI, &sigact, NULL);

pthread_sigmask(SIG_BLOCK, NULL, &cpu->hvf->unblock_ipi_mask);
sigdelset(&cpu->hvf->unblock_ipi_mask, SIG_IPI);
pthread_sigmask(SIG_BLOCK, NULL, &cpu->accel->unblock_ipi_mask);
sigdelset(&cpu->accel->unblock_ipi_mask, SIG_IPI);

#ifdef __aarch64__
r = hv_vcpu_create(&cpu->hvf->fd, (hv_vcpu_exit_t **)&cpu->hvf->exit, NULL);
r = hv_vcpu_create(&cpu->accel->fd,
(hv_vcpu_exit_t **)&cpu->accel->exit, NULL);
#else
r = hv_vcpu_create((hv_vcpuid_t *)&cpu->hvf->fd, HV_VCPU_DEFAULT);
r = hv_vcpu_create((hv_vcpuid_t *)&cpu->accel->fd, HV_VCPU_DEFAULT);
#endif
cpu->vcpu_dirty = 1;
assert_hvf_ok(r);

cpu->hvf->guest_debug_enabled = false;
cpu->accel->guest_debug_enabled = false;

return hvf_arch_init_vcpu(cpu);
}
Expand Down
5 changes: 3 additions & 2 deletions accel/kvm/kvm-all.c
Expand Up @@ -1105,6 +1105,7 @@ static MemoryListener kvm_coalesced_pio_listener = {
.name = "kvm-coalesced-pio",
.coalesced_io_add = kvm_coalesce_pio_add,
.coalesced_io_del = kvm_coalesce_pio_del,
.priority = MEMORY_LISTENER_PRIORITY_MIN,
};

int kvm_check_extension(KVMState *s, unsigned int extension)
Expand Down Expand Up @@ -1777,7 +1778,7 @@ void kvm_memory_listener_register(KVMState *s, KVMMemoryListener *kml,
kml->listener.commit = kvm_region_commit;
kml->listener.log_start = kvm_log_start;
kml->listener.log_stop = kvm_log_stop;
kml->listener.priority = 10;
kml->listener.priority = MEMORY_LISTENER_PRIORITY_ACCEL;
kml->listener.name = name;

if (s->kvm_dirty_ring_size) {
Expand All @@ -1802,7 +1803,7 @@ static MemoryListener kvm_io_listener = {
.name = "kvm-io",
.eventfd_add = kvm_io_ioeventfd_add,
.eventfd_del = kvm_io_ioeventfd_del,
.priority = 10,
.priority = MEMORY_LISTENER_PRIORITY_DEV_BACKEND,
};

int kvm_set_irq(KVMState *s, int irq, int level)
Expand Down
1 change: 1 addition & 0 deletions accel/stubs/kvm-stub.c
Expand Up @@ -27,6 +27,7 @@ bool kvm_allowed;
bool kvm_readonly_mem_allowed;
bool kvm_ioeventfd_any_length_allowed;
bool kvm_msi_use_devid;
bool kvm_direct_msi_allowed;

void kvm_flush_coalesced_mmio_buffer(void)
{
Expand Down
4 changes: 0 additions & 4 deletions accel/tcg/tcg-accel-ops-mttcg.c
Expand Up @@ -152,8 +152,4 @@ void mttcg_start_vcpu_thread(CPUState *cpu)

qemu_thread_create(cpu->thread, thread_name, mttcg_cpu_thread_fn,
cpu, QEMU_THREAD_JOINABLE);

#ifdef _WIN32
cpu->hThread = qemu_thread_get_handle(cpu->thread);
#endif
}
3 changes: 0 additions & 3 deletions accel/tcg/tcg-accel-ops-rr.c
Expand Up @@ -329,9 +329,6 @@ void rr_start_vcpu_thread(CPUState *cpu)

single_tcg_halt_cond = cpu->halt_cond;
single_tcg_cpu_thread = cpu->thread;
#ifdef _WIN32
cpu->hThread = qemu_thread_get_handle(cpu->thread);
#endif
} else {
/* we share the thread */
cpu->thread = single_tcg_cpu_thread;
Expand Down
2 changes: 1 addition & 1 deletion docs/devel/testing.rst
Expand Up @@ -558,7 +558,7 @@ When CI tasks, maintainers or yourself report a Docker test failure, follow the
below steps to debug it:

1. Locally reproduce the failure with the reported command line. E.g. run
``make docker-test-mingw@fedora J=8``.
``make docker-test-mingw@fedora-win64-cross J=8``.
2. Add "V=1" to the command line, try again, to see the verbose output.
3. Further add "DEBUG=1" to the command line. This will pause in a shell prompt
in the container right before testing starts. You could either manually
Expand Down
2 changes: 2 additions & 0 deletions hw/arm/sbsa-ref.c
Expand Up @@ -23,6 +23,7 @@
#include "qemu/error-report.h"
#include "qemu/units.h"
#include "sysemu/device_tree.h"
#include "sysemu/kvm.h"
#include "sysemu/numa.h"
#include "sysemu/runstate.h"
#include "sysemu/sysemu.h"
Expand All @@ -36,6 +37,7 @@
#include "hw/ide/internal.h"
#include "hw/ide/ahci_internal.h"
#include "hw/intc/arm_gicv3_common.h"
#include "hw/intc/arm_gicv3_its_common.h"
#include "hw/loader.h"
#include "hw/pci-host/gpex.h"
#include "hw/qdev-properties.h"
Expand Down
2 changes: 1 addition & 1 deletion hw/arm/virt-acpi-build.c
Expand Up @@ -48,12 +48,12 @@
#include "hw/pci/pci_bus.h"
#include "hw/pci-host/gpex.h"
#include "hw/arm/virt.h"
#include "hw/intc/arm_gicv3_its_common.h"
#include "hw/mem/nvdimm.h"
#include "hw/platform-bus.h"
#include "sysemu/numa.h"
#include "sysemu/reset.h"
#include "sysemu/tpm.h"
#include "kvm_arm.h"
#include "migration/vmstate.h"
#include "hw/acpi/ghes.h"
#include "hw/acpi/viot.h"
Expand Down
1 change: 1 addition & 0 deletions hw/arm/virt.c
Expand Up @@ -63,6 +63,7 @@
#include "hw/arm/fdt.h"
#include "hw/intc/arm_gic.h"
#include "hw/intc/arm_gicv3_common.h"
#include "hw/intc/arm_gicv3_its_common.h"
#include "hw/irq.h"
#include "kvm_arm.h"
#include "hw/firmware/smbios.h"
Expand Down
2 changes: 1 addition & 1 deletion hw/arm/xen_arm.c
Expand Up @@ -45,7 +45,7 @@ static MemoryListener xen_memory_listener = {
.log_sync = NULL,
.log_global_start = NULL,
.log_global_stop = NULL,
.priority = 10,
.priority = MEMORY_LISTENER_PRIORITY_ACCEL,
};

struct XenArmState {
Expand Down
2 changes: 1 addition & 1 deletion hw/i386/xen/xen-hvm.c
Expand Up @@ -467,7 +467,7 @@ static MemoryListener xen_memory_listener = {
.log_sync = xen_log_sync,
.log_global_start = xen_log_global_start,
.log_global_stop = xen_log_global_stop,
.priority = 10,
.priority = MEMORY_LISTENER_PRIORITY_ACCEL,
};

static void regs_to_cpu(vmware_regs_t *vmport_regs, ioreq_t *req)
Expand Down
11 changes: 9 additions & 2 deletions hw/intc/arm_gic_common.c
Expand Up @@ -21,10 +21,12 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu/module.h"
#include "qemu/error-report.h"
#include "gic_internal.h"
#include "hw/arm/linux-boot-if.h"
#include "hw/qdev-properties.h"
#include "migration/vmstate.h"
#include "sysemu/kvm.h"

static int gic_pre_save(void *opaque)
{
Expand Down Expand Up @@ -233,12 +235,12 @@ static void arm_gic_common_realize(DeviceState *dev, Error **errp)
}
}

static inline void arm_gic_common_reset_irq_state(GICState *s, int first_cpu,
static inline void arm_gic_common_reset_irq_state(GICState *s, int cidx,
int resetprio)
{
int i, j;

for (i = first_cpu; i < first_cpu + s->num_cpu; i++) {
for (i = cidx; i < cidx + s->num_cpu; i++) {
if (s->revision == REV_11MPCORE) {
s->priority_mask[i] = 0xf0;
} else {
Expand Down Expand Up @@ -393,3 +395,8 @@ static void register_types(void)
}

type_init(register_types)

const char *gic_class_name(void)
{
return kvm_irqchip_in_kernel() ? "kvm-arm-gic" : "arm_gic";
}
14 changes: 14 additions & 0 deletions hw/intc/arm_gicv3_common.c
Expand Up @@ -24,6 +24,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu/module.h"
#include "qemu/error-report.h"
#include "hw/core/cpu.h"
#include "hw/intc/arm_gicv3_common.h"
#include "hw/qdev-properties.h"
Expand Down Expand Up @@ -608,3 +609,16 @@ static void register_types(void)
}

type_init(register_types)

const char *gicv3_class_name(void)
{
if (kvm_irqchip_in_kernel()) {
return "kvm-arm-gicv3";
} else {
if (kvm_enabled()) {
error_report("Userspace GICv3 is not supported with KVM");
exit(1);
}
return "arm-gicv3";
}
}
12 changes: 12 additions & 0 deletions hw/intc/arm_gicv3_its_common.c
Expand Up @@ -24,6 +24,7 @@
#include "hw/intc/arm_gicv3_its_common.h"
#include "qemu/log.h"
#include "qemu/module.h"
#include "sysemu/kvm.h"

static int gicv3_its_pre_save(void *opaque)
{
Expand Down Expand Up @@ -158,3 +159,14 @@ static void gicv3_its_common_register_types(void)
}

type_init(gicv3_its_common_register_types)

const char *its_class_name(void)
{
if (kvm_irqchip_in_kernel()) {
/* KVM implementation requires this capability */
return kvm_direct_msi_enabled() ? "arm-its-kvm" : NULL;
} else {
/* Software emulation based model */
return "arm-gicv3-its";
}
}
2 changes: 2 additions & 0 deletions hw/ppc/e500.c
Expand Up @@ -765,7 +765,9 @@ static void mmubooke_create_initial_mapping(CPUPPCState *env)
tlb->mas7_3 = 0;
tlb->mas7_3 |= MAS3_UR | MAS3_UW | MAS3_UX | MAS3_SR | MAS3_SW | MAS3_SX;

#ifdef CONFIG_KVM
env->tlb_dirty = true;
#endif
}

static void ppce500_cpu_reset_sec(void *opaque)
Expand Down
2 changes: 2 additions & 0 deletions hw/ppc/ppce500_spin.c
Expand Up @@ -83,7 +83,9 @@ static void mmubooke_create_initial_mapping(CPUPPCState *env,
tlb->mas2 = (va & TARGET_PAGE_MASK) | MAS2_M;
tlb->mas7_3 = pa & TARGET_PAGE_MASK;
tlb->mas7_3 |= MAS3_UR | MAS3_UW | MAS3_UX | MAS3_SR | MAS3_SW | MAS3_SX;
#ifdef CONFIG_KVM
env->tlb_dirty = true;
#endif
}

static void spin_kick(CPUState *cs, run_on_cpu_data data)
Expand Down
2 changes: 1 addition & 1 deletion hw/remote/proxy-memory-listener.c
Expand Up @@ -217,7 +217,7 @@ void proxy_memory_listener_configure(ProxyMemoryListener *proxy_listener,
proxy_listener->listener.commit = proxy_memory_listener_commit;
proxy_listener->listener.region_add = proxy_memory_listener_region_addnop;
proxy_listener->listener.region_nop = proxy_memory_listener_region_addnop;
proxy_listener->listener.priority = 10;
proxy_listener->listener.priority = MEMORY_LISTENER_PRIORITY_DEV_BACKEND;
proxy_listener->listener.name = "proxy";

memory_listener_register(&proxy_listener->listener,
Expand Down
2 changes: 1 addition & 1 deletion hw/virtio/vhost.c
Expand Up @@ -1444,7 +1444,7 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
.log_sync = vhost_log_sync,
.log_global_start = vhost_log_global_start,
.log_global_stop = vhost_log_global_stop,
.priority = 10
.priority = MEMORY_LISTENER_PRIORITY_DEV_BACKEND
};

hdev->iommu_listener = (MemoryListener) {
Expand Down
2 changes: 1 addition & 1 deletion hw/xen/xen-hvm-common.c
Expand Up @@ -155,7 +155,7 @@ MemoryListener xen_io_listener = {
.name = "xen-io",
.region_add = xen_io_add,
.region_del = xen_io_del,
.priority = 10,
.priority = MEMORY_LISTENER_PRIORITY_ACCEL,
};

DeviceListener xen_device_listener = {
Expand Down
4 changes: 2 additions & 2 deletions hw/xen/xen_pt.c
Expand Up @@ -691,14 +691,14 @@ static const MemoryListener xen_pt_memory_listener = {
.name = "xen-pt-mem",
.region_add = xen_pt_region_add,
.region_del = xen_pt_region_del,
.priority = 10,
.priority = MEMORY_LISTENER_PRIORITY_ACCEL,
};

static const MemoryListener xen_pt_io_listener = {
.name = "xen-pt-io",
.region_add = xen_pt_io_region_add,
.region_del = xen_pt_io_region_del,
.priority = 10,
.priority = MEMORY_LISTENER_PRIORITY_ACCEL,
};

/* destroy. */
Expand Down
4 changes: 4 additions & 0 deletions include/exec/memory.h
Expand Up @@ -811,6 +811,10 @@ struct IOMMUMemoryRegion {
#define IOMMU_NOTIFIER_FOREACH(n, mr) \
QLIST_FOREACH((n), &(mr)->iommu_notify, node)

#define MEMORY_LISTENER_PRIORITY_MIN 0
#define MEMORY_LISTENER_PRIORITY_ACCEL 10
#define MEMORY_LISTENER_PRIORITY_DEV_BACKEND 10

/**
* struct MemoryListener: callbacks structure for updates to the physical memory map
*
Expand Down

0 comments on commit 017b2e7

Please sign in to comment.