* new QMP command qom-list-properties (Alexey)

* TCG cleanups (David)
 * use g_path_get_basename/g_path_get_dirname when useful (Julia)
 * WHPX fixes (Justin)
 * ASAN fixes (Marc-André)
 * g364fb memory leak fix, address_space_to_flatview RCU fixes (me)
 * chardev memory leak fix (Peter)
 * checkpatch improvements (Julia, Su Hang)
 * next round of deprecation patches (Thomas)
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQEcBAABAgAGBQJanpOeAAoJEL/70l94x66DNjcIAJ1AjvxdHQagMRZ7zLWe9XlR
 euJJIUU1guAYnOwvjQIKuAzr/wLOCJ9AsNl2Aj29xwQ/naCe6aYci3eRUccN/j9p
 iF4OjsMeYEIJvrzeYbH5dP5JvmmhGo+fdXWlEPc0VgyfXZKx34PpET+tG57plbCU
 uIGFgq2WnbjKURNqnlu+v+y+xDx9StBxw6g6fDcLe0DA6pFOdiVpqSSvMJg7Fsrw
 DTydZ2vb+fljXFgoPZVZsn+kaffCbXt+NtMcrbzX9aR0gbD6Q/mduKgJqyu3r2eu
 GUBeSM4RsvG4MPmRXQ6AYJFpAsl0zG9PTEnt0yGSzgy+bcTrmlKCwOWDfXMgB3g=
 =oMrE
 -----END PGP SIGNATURE-----

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

* new QMP command qom-list-properties (Alexey)
* TCG cleanups (David)
* use g_path_get_basename/g_path_get_dirname when useful (Julia)
* WHPX fixes (Justin)
* ASAN fixes (Marc-André)
* g364fb memory leak fix, address_space_to_flatview RCU fixes (me)
* chardev memory leak fix (Peter)
* checkpatch improvements (Julia, Su Hang)
* next round of deprecation patches (Thomas)

# gpg: Signature made Tue 06 Mar 2018 13:11:58 GMT
# gpg:                using RSA key BFFBD25F78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>"
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* remotes/bonzini/tags/for-upstream: (34 commits)
  use g_path_get_basename instead of basename
  balloon: Fix documentation of the --balloon parameter and deprecate it
  WHPX improve interrupt notification registration
  WHXP Removes the use of WHvGetExitContextSize
  Fix WHPX issue leaking tpr values
  Fix WHPX typo in 'mmio'
  Fix WHPX additional lock acquisition
  Remove unnecessary WHPX __debugbreak();
  Resolves WHPX breaking changes in SDK 17095
  Fixing WHPX casing to match SDK
  Revert "build-sys: compile with -Og or -O1 when --enable-debug"
  checkpatch: add check for `while` and `for`
  checkpatch: add a warning for basename/dirname
  address_space_rw: address_space_to_flatview needs RCU lock
  address_space_map: address_space_to_flatview needs RCU lock
  address_space_access_valid: address_space_to_flatview needs RCU lock
  address_space_read: address_space_to_flatview needs RCU lock
  address_space_write: address_space_to_flatview needs RCU lock
  memory: inline some performance-sensitive accessors
  openpic_kvm: drop address_space_to_flatview call
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2018-03-06 13:24:35 +00:00
commit b5fe11a49a
36 changed files with 317 additions and 354 deletions

View File

@ -592,19 +592,23 @@ static gboolean tcp_chr_telnet_init_io(QIOChannel *ioc,
ret = 0;
} else {
tcp_chr_disconnect(init->chr);
return FALSE;
goto end;
}
}
init->buflen -= ret;
if (init->buflen == 0) {
tcp_chr_connect(init->chr);
return FALSE;
goto end;
}
memmove(init->buf, init->buf + ret, init->buflen);
return TRUE;
return G_SOURCE_CONTINUE;
end:
g_free(init);
return G_SOURCE_REMOVE;
}
static void tcp_chr_telnet_init(Chardev *chr)

47
configure vendored
View File

@ -2486,20 +2486,20 @@ fi
if test "$whpx" != "no" ; then
cat > $TMPC << EOF
#include <windows.h>
#include <winhvplatform.h>
#include <winhvemulation.h>
#include <WinHvPlatform.h>
#include <WinHvEmulation.h>
int main(void) {
WHV_CAPABILITY whpx_cap;
WHvGetCapability(WHvCapabilityCodeFeatures, &whpx_cap, sizeof(whpx_cap));
return 0;
}
EOF
if compile_prog "" "-lwinhvplatform -lwinhvemulation" ; then
libs_softmmu="$libs_softmmu -lwinhvplatform -lwinhvemulation"
if compile_prog "" "-lWinHvPlatform -lWinHvEmulation" ; then
libs_softmmu="$libs_softmmu -lWinHvPlatform -lWinHvEmulation"
whpx="yes"
else
if test "$whpx" = "yes"; then
feature_not_found "winhvplatform" "winhvemulation is not installed"
feature_not_found "WinHvPlatform" "WinHvEmulation is not installed"
fi
whpx="no"
fi
@ -5316,25 +5316,27 @@ fi
##########################################
# checks for sanitizers
# we could use a simple skeleton for flags checks, but this also
# detect the static linking issue of ubsan, see also:
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285
cat > $TMPC << EOF
#include <stdint.h>
int main(void) {
return INT32_MIN / -1;
}
EOF
have_asan=no
have_ubsan=no
have_asan_iface_h=no
have_asan_iface_fiber=no
if test "$sanitizers" = "yes" ; then
write_c_skeleton
if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" ""; then
have_asan=yes
fi
# we could use a simple skeleton for flags checks, but this also
# detect the static linking issue of ubsan, see also:
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285
cat > $TMPC << EOF
#include <stdlib.h>
int main(void) {
void *tmp = malloc(10);
return *(int *)(tmp + 2);
}
EOF
if compile_prog "$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then
have_ubsan=yes
fi
@ -5366,19 +5368,8 @@ if test "$gcov" = "yes" ; then
LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
elif test "$fortify_source" = "yes" ; then
CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
elif test "$debug" = "yes"; then
if compile_prog "-Og" ""; then
CFLAGS="-Og $CFLAGS"
elif compile_prog "-O1" ""; then
CFLAGS="-O1 $CFLAGS"
fi
# Workaround GCC false-positive Wuninitialized bugs with Og or O1:
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24639
if cc_has_warning_flag "-Wno-maybe-uninitialized"; then
CFLAGS="-Wno-maybe-uninitialized $CFLAGS"
fi
else
CFLAGS="-O2 $CFLAGS"
elif test "$debug" = "no"; then
CFLAGS="-O2 $CFLAGS"
fi
if test "$have_asan" = "yes"; then

33
cpus.c
View File

@ -1383,11 +1383,9 @@ static void *qemu_tcg_rr_cpu_thread_fn(void *arg)
qemu_mutex_lock_iothread();
qemu_thread_get_self(cpu->thread);
CPU_FOREACH(cpu) {
cpu->thread_id = qemu_get_thread_id();
cpu->created = true;
cpu->can_do_io = 1;
}
cpu->thread_id = qemu_get_thread_id();
cpu->created = true;
cpu->can_do_io = 1;
qemu_cond_signal(&qemu_cpu_cond);
/* wait for initial kick-off after machine start */
@ -1856,13 +1854,13 @@ static void qemu_tcg_init_vcpu(CPUState *cpu)
#ifdef _WIN32
cpu->hThread = qemu_thread_get_handle(cpu->thread);
#endif
while (!cpu->created) {
qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex);
}
} else {
/* For non-MTTCG cases we share the thread */
cpu->thread = single_tcg_cpu_thread;
cpu->halt_cond = single_tcg_halt_cond;
cpu->thread_id = first_cpu->thread_id;
cpu->can_do_io = 1;
cpu->created = true;
}
}
@ -1881,9 +1879,6 @@ static void qemu_hax_start_vcpu(CPUState *cpu)
#ifdef _WIN32
cpu->hThread = qemu_thread_get_handle(cpu->thread);
#endif
while (!cpu->created) {
qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex);
}
}
static void qemu_kvm_start_vcpu(CPUState *cpu)
@ -1897,9 +1892,6 @@ static void qemu_kvm_start_vcpu(CPUState *cpu)
cpu->cpu_index);
qemu_thread_create(cpu->thread, thread_name, qemu_kvm_cpu_thread_fn,
cpu, QEMU_THREAD_JOINABLE);
while (!cpu->created) {
qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex);
}
}
static void qemu_hvf_start_vcpu(CPUState *cpu)
@ -1918,9 +1910,6 @@ static void qemu_hvf_start_vcpu(CPUState *cpu)
cpu->cpu_index);
qemu_thread_create(cpu->thread, thread_name, qemu_hvf_cpu_thread_fn,
cpu, QEMU_THREAD_JOINABLE);
while (!cpu->created) {
qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex);
}
}
static void qemu_whpx_start_vcpu(CPUState *cpu)
@ -1937,9 +1926,6 @@ static void qemu_whpx_start_vcpu(CPUState *cpu)
#ifdef _WIN32
cpu->hThread = qemu_thread_get_handle(cpu->thread);
#endif
while (!cpu->created) {
qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex);
}
}
static void qemu_dummy_start_vcpu(CPUState *cpu)
@ -1953,9 +1939,6 @@ static void qemu_dummy_start_vcpu(CPUState *cpu)
cpu->cpu_index);
qemu_thread_create(cpu->thread, thread_name, qemu_dummy_cpu_thread_fn, cpu,
QEMU_THREAD_JOINABLE);
while (!cpu->created) {
qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex);
}
}
void qemu_init_vcpu(CPUState *cpu)
@ -1985,6 +1968,10 @@ void qemu_init_vcpu(CPUState *cpu)
} else {
qemu_dummy_start_vcpu(cpu);
}
while (!cpu->created) {
qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex);
}
}
void cpu_stop_current(void)

90
exec.c
View File

@ -2616,6 +2616,8 @@ static const MemoryRegionOps watch_mem_ops = {
},
};
static MemTxResult flatview_read(FlatView *fv, hwaddr addr,
MemTxAttrs attrs, uint8_t *buf, int len);
static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
const uint8_t *buf, int len);
static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len,
@ -3078,6 +3080,7 @@ static MemTxResult flatview_write_continue(FlatView *fv, hwaddr addr,
return result;
}
/* Called from RCU critical section. */
static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
const uint8_t *buf, int len)
{
@ -3086,25 +3089,14 @@ static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
MemoryRegion *mr;
MemTxResult result = MEMTX_OK;
if (len > 0) {
rcu_read_lock();
l = len;
mr = flatview_translate(fv, addr, &addr1, &l, true);
result = flatview_write_continue(fv, addr, attrs, buf, len,
addr1, l, mr);
rcu_read_unlock();
}
l = len;
mr = flatview_translate(fv, addr, &addr1, &l, true);
result = flatview_write_continue(fv, addr, attrs, buf, len,
addr1, l, mr);
return result;
}
MemTxResult address_space_write(AddressSpace *as, hwaddr addr,
MemTxAttrs attrs,
const uint8_t *buf, int len)
{
return flatview_write(address_space_to_flatview(as), addr, attrs, buf, len);
}
/* Called within RCU critical section. */
MemTxResult flatview_read_continue(FlatView *fv, hwaddr addr,
MemTxAttrs attrs, uint8_t *buf,
@ -3175,42 +3167,61 @@ MemTxResult flatview_read_continue(FlatView *fv, hwaddr addr,
return result;
}
MemTxResult flatview_read_full(FlatView *fv, hwaddr addr,
MemTxAttrs attrs, uint8_t *buf, int len)
/* Called from RCU critical section. */
static MemTxResult flatview_read(FlatView *fv, hwaddr addr,
MemTxAttrs attrs, uint8_t *buf, int len)
{
hwaddr l;
hwaddr addr1;
MemoryRegion *mr;
l = len;
mr = flatview_translate(fv, addr, &addr1, &l, false);
return flatview_read_continue(fv, addr, attrs, buf, len,
addr1, l, mr);
}
MemTxResult address_space_read_full(AddressSpace *as, hwaddr addr,
MemTxAttrs attrs, uint8_t *buf, int len)
{
MemTxResult result = MEMTX_OK;
FlatView *fv;
if (len > 0) {
rcu_read_lock();
l = len;
mr = flatview_translate(fv, addr, &addr1, &l, false);
result = flatview_read_continue(fv, addr, attrs, buf, len,
addr1, l, mr);
fv = address_space_to_flatview(as);
result = flatview_read(fv, addr, attrs, buf, len);
rcu_read_unlock();
}
return result;
}
static MemTxResult flatview_rw(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
uint8_t *buf, int len, bool is_write)
MemTxResult address_space_write(AddressSpace *as, hwaddr addr,
MemTxAttrs attrs,
const uint8_t *buf, int len)
{
if (is_write) {
return flatview_write(fv, addr, attrs, (uint8_t *)buf, len);
} else {
return flatview_read(fv, addr, attrs, (uint8_t *)buf, len);
MemTxResult result = MEMTX_OK;
FlatView *fv;
if (len > 0) {
rcu_read_lock();
fv = address_space_to_flatview(as);
result = flatview_write(fv, addr, attrs, buf, len);
rcu_read_unlock();
}
return result;
}
MemTxResult address_space_rw(AddressSpace *as, hwaddr addr,
MemTxAttrs attrs, uint8_t *buf,
int len, bool is_write)
MemTxResult address_space_rw(AddressSpace *as, hwaddr addr, MemTxAttrs attrs,
uint8_t *buf, int len, bool is_write)
{
return flatview_rw(address_space_to_flatview(as),
addr, attrs, buf, len, is_write);
if (is_write) {
return address_space_write(as, addr, attrs, buf, len);
} else {
return address_space_read_full(as, addr, attrs, buf, len);
}
}
void cpu_physical_memory_rw(hwaddr addr, uint8_t *buf,
@ -3376,7 +3387,6 @@ static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len,
MemoryRegion *mr;
hwaddr l, xlat;
rcu_read_lock();
while (len > 0) {
l = len;
mr = flatview_translate(fv, addr, &xlat, &l, is_write);
@ -3391,15 +3401,20 @@ static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len,
len -= l;
addr += l;
}
rcu_read_unlock();
return true;
}
bool address_space_access_valid(AddressSpace *as, hwaddr addr,
int len, bool is_write)
{
return flatview_access_valid(address_space_to_flatview(as),
addr, len, is_write);
FlatView *fv;
bool result;
rcu_read_lock();
fv = address_space_to_flatview(as);
result = flatview_access_valid(fv, addr, len, is_write);
rcu_read_unlock();
return result;
}
static hwaddr
@ -3445,7 +3460,7 @@ void *address_space_map(AddressSpace *as,
hwaddr l, xlat;
MemoryRegion *mr;
void *ptr;
FlatView *fv = address_space_to_flatview(as);
FlatView *fv;
if (len == 0) {
return NULL;
@ -3453,6 +3468,7 @@ void *address_space_map(AddressSpace *as,
l = len;
rcu_read_lock();
fv = address_space_to_flatview(as);
mr = flatview_translate(fv, addr, &xlat, &l, is_write);
if (!memory_access_is_direct(mr, is_write)) {

View File

@ -55,6 +55,7 @@ static struct option helper_opts[] = {
static bool is_daemon;
static bool get_version; /* IOC getversion IOCTL supported */
static char *prog_name;
static void GCC_FMT_ATTR(2, 3) do_log(int loglevel, const char *format, ...)
{
@ -785,7 +786,7 @@ error:
return -1;
}
static void usage(char *prog)
static void usage(void)
{
fprintf(stderr, "usage: %s\n"
" -p|--path <path> 9p path to export\n"
@ -795,7 +796,7 @@ static void usage(char *prog)
" access to this socket\n"
" \tNote: -s & -f can not be used together\n"
" [-n|--nodaemon] Run as a normal program\n",
basename(prog));
prog_name);
}
static int process_reply(int sock, int type,
@ -1045,6 +1046,8 @@ int main(int argc, char **argv)
struct statfs st_fs;
#endif
prog_name = g_path_get_basename(argv[0]);
is_daemon = true;
sock = -1;
own_u = own_g = -1;
@ -1077,7 +1080,7 @@ int main(int argc, char **argv)
case '?':
case 'h':
default:
usage(argv[0]);
usage();
exit(EXIT_FAILURE);
}
}
@ -1085,13 +1088,13 @@ int main(int argc, char **argv)
/* Parameter validation */
if ((sock_name == NULL && sock == -1) || rpath == NULL) {
fprintf(stderr, "socket, socket descriptor or path not specified\n");
usage(argv[0]);
usage();
return -1;
}
if (sock_name && sock != -1) {
fprintf(stderr, "both named socket and socket descriptor specified\n");
usage(argv[0]);
usage();
exit(EXIT_FAILURE);
}
@ -1099,7 +1102,7 @@ int main(int argc, char **argv)
fprintf(stderr, "owner uid:gid not specified, ");
fprintf(stderr,
"owner uid:gid specifies who can access the socket file\n");
usage(argv[0]);
usage();
exit(EXIT_FAILURE);
}

View File

@ -207,6 +207,7 @@ done:
if (xmax || ymax) {
dpy_gfx_update(s->con, xmin, ymin, xmax - xmin + 1, ymax - ymin + 1);
}
g_free(snap);
}
static void g364fb_draw_blank(G364State *s)

View File

@ -1636,23 +1636,6 @@ void pc_nic_init(ISABus *isa_bus, PCIBus *pci_bus)
rom_reset_order_override();
}
void pc_pci_device_init(PCIBus *pci_bus)
{
int max_bus;
int bus;
/* Note: if=scsi is deprecated with PC machine types */
max_bus = drive_get_max_bus(IF_SCSI);
for (bus = 0; bus <= max_bus; bus++) {
pci_create_simple(pci_bus, -1, "lsi53c895a");
/*
* By not creating frontends here, we make
* scsi_legacy_handle_cmdline() create them, and warn that
* this usage is deprecated.
*/
}
}
void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name)
{
DeviceState *dev;

View File

@ -295,10 +295,6 @@ static void pc_init1(MachineState *machine,
PC_MACHINE_ACPI_DEVICE_PROP, &error_abort);
}
if (pcmc->pci_enabled) {
pc_pci_device_init(pci_bus);
}
if (pcms->acpi_nvdimm_state.is_enabled) {
nvdimm_init_acpi_state(&pcms->acpi_nvdimm_state, system_io,
pcms->fw_cfg, OBJECT(pcms));

View File

@ -273,9 +273,6 @@ static void pc_q35_init(MachineState *machine)
/* the rest devices to which pci devfn is automatically assigned */
pc_vga_init(isa_bus, host_bus);
pc_nic_init(isa_bus, host_bus);
if (pcmc->pci_enabled) {
pc_pci_device_init(host_bus);
}
if (pcms->acpi_nvdimm_state.is_enabled) {
nvdimm_init_acpi_state(&pcms->acpi_nvdimm_state, system_io,

View File

@ -125,10 +125,6 @@ static void kvm_openpic_region_add(MemoryListener *listener,
uint64_t reg_base;
int ret;
if (section->fv != address_space_to_flatview(&address_space_memory)) {
abort();
}
/* Ignore events on regions that are not us */
if (section->mr != &opp->mem) {
return;

View File

@ -48,7 +48,7 @@ static void s390_ccw_get_dev_info(S390CCWDevice *cdev,
return;
}
cdev->mdevid = g_strdup(basename(dev_path));
cdev->mdevid = g_path_get_basename(dev_path);
tmp = basename(dirname(dev_path));
if (sscanf(tmp, "%2x.%1x.%4x", &cssid, &ssid, &devid) != 3) {

View File

@ -2277,5 +2277,5 @@ void lsi53c895a_create(PCIBus *bus)
{
LSIState *s = LSI53C895A(pci_create_simple(bus, -1, "lsi53c895a"));
scsi_bus_legacy_handle_cmdline(&s->bus, false);
scsi_bus_legacy_handle_cmdline(&s->bus);
}

View File

@ -271,7 +271,7 @@ SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockBackend *blk,
return SCSI_DEVICE(dev);
}
void scsi_bus_legacy_handle_cmdline(SCSIBus *bus, bool deprecated)
void scsi_bus_legacy_handle_cmdline(SCSIBus *bus)
{
Location loc;
DriveInfo *dinfo;
@ -284,59 +284,12 @@ void scsi_bus_legacy_handle_cmdline(SCSIBus *bus, bool deprecated)
continue;
}
qemu_opts_loc_restore(dinfo->opts);
if (deprecated) {
/* Handling -drive not claimed by machine initialization */
if (blk_get_attached_dev(blk_by_legacy_dinfo(dinfo))) {
continue; /* claimed */
}
if (!dinfo->is_default) {
warn_report("bus=%d,unit=%d is deprecated with this"
" machine type",
bus->busnr, unit);
}
}
scsi_bus_legacy_add_drive(bus, blk_by_legacy_dinfo(dinfo),
unit, false, -1, false, NULL, &error_fatal);
}
loc_pop(&loc);
}
static bool is_scsi_hba_with_legacy_magic(Object *obj)
{
static const char *magic[] = {
"am53c974", "dc390", "esp", "lsi53c810", "lsi53c895a",
"megasas", "megasas-gen2", "mptsas1068", "spapr-vscsi",
"virtio-scsi-device",
NULL
};
const char *typename = object_get_typename(obj);
int i;
for (i = 0; magic[i]; i++)
if (!strcmp(typename, magic[i])) {
return true;
}
return false;
}
static int scsi_legacy_handle_cmdline_cb(Object *obj, void *opaque)
{
SCSIBus *bus = (SCSIBus *)object_dynamic_cast(obj, TYPE_SCSI_BUS);
if (bus && is_scsi_hba_with_legacy_magic(OBJECT(bus->qbus.parent))) {
scsi_bus_legacy_handle_cmdline(bus, true);
}
return 0;
}
void scsi_legacy_handle_cmdline(void)
{
object_child_foreach_recursive(object_get_root(),
scsi_legacy_handle_cmdline_cb, NULL);
}
static int32_t scsi_invalid_field(SCSIRequest *req, uint8_t *buf)
{
scsi_req_build_sense(req, SENSE_CODE(INVALID_FIELD));

View File

@ -1215,8 +1215,7 @@ void spapr_vscsi_create(VIOsPAPRBus *bus)
dev = qdev_create(&bus->bus, "spapr-vscsi");
qdev_init_nofail(dev);
scsi_bus_legacy_handle_cmdline(&VIO_SPAPR_VSCSI_DEVICE(dev)->bus,
false);
scsi_bus_legacy_handle_cmdline(&VIO_SPAPR_VSCSI_DEVICE(dev)->bus);
}
static int spapr_vscsi_devnode(VIOsPAPRDevice *dev, void *fdt, int node_off)

View File

@ -2807,7 +2807,7 @@ static void vfio_realize(PCIDevice *pdev, Error **errp)
return;
}
vdev->vbasedev.name = g_strdup(basename(vdev->vbasedev.sysfsdev));
vdev->vbasedev.name = g_path_get_basename(vdev->vbasedev.sysfsdev);
vdev->vbasedev.ops = &vfio_pci_ops;
vdev->vbasedev.type = VFIO_DEVICE_TYPE_PCI;
vdev->vbasedev.dev = &vdev->pdev.qdev;

View File

@ -561,7 +561,7 @@ static int vfio_base_device_init(VFIODevice *vbasedev, Error **errp)
/* @sysfsdev takes precedence over @host */
if (vbasedev->sysfsdev) {
g_free(vbasedev->name);
vbasedev->name = g_strdup(basename(vbasedev->sysfsdev));
vbasedev->name = g_path_get_basename(vbasedev->sysfsdev);
} else {
if (!vbasedev->name || strchr(vbasedev->name, '/')) {
error_setg(errp, "wrong host device name");

View File

@ -21,7 +21,15 @@
#define MEMORY_INTERNAL_H
#ifndef CONFIG_USER_ONLY
typedef struct AddressSpaceDispatch AddressSpaceDispatch;
static inline AddressSpaceDispatch *flatview_to_dispatch(FlatView *fv)
{
return fv->dispatch;
}
static inline AddressSpaceDispatch *address_space_to_dispatch(AddressSpace *as)
{
return flatview_to_dispatch(address_space_to_flatview(as));
}
extern const MemoryRegionOps unassigned_mem_ops;
@ -31,9 +39,6 @@ bool memory_region_access_valid(MemoryRegion *mr, hwaddr addr,
void flatview_add_to_dispatch(FlatView *fv, MemoryRegionSection *section);
AddressSpaceDispatch *address_space_dispatch_new(FlatView *fv);
void address_space_dispatch_compact(AddressSpaceDispatch *d);
AddressSpaceDispatch *address_space_to_dispatch(AddressSpace *as);
AddressSpaceDispatch *flatview_to_dispatch(FlatView *fv);
void address_space_dispatch_free(AddressSpaceDispatch *d);
void mtree_print_dispatch(fprintf_function mon, void *f,

View File

@ -326,7 +326,27 @@ struct AddressSpace {
QTAILQ_ENTRY(AddressSpace) address_spaces_link;
};
FlatView *address_space_to_flatview(AddressSpace *as);
typedef struct AddressSpaceDispatch AddressSpaceDispatch;
typedef struct FlatRange FlatRange;
/* Flattened global view of current active memory hierarchy. Kept in sorted
* order.
*/
struct FlatView {
struct rcu_head rcu;
unsigned ref;
FlatRange *ranges;
unsigned nr;
unsigned nr_allocated;
struct AddressSpaceDispatch *dispatch;
MemoryRegion *root;
};
static inline FlatView *address_space_to_flatview(AddressSpace *as)
{
return atomic_rcu_read(&as->current_map);
}
/**
* MemoryRegionSection: describes a fragment of a #MemoryRegion
@ -1897,13 +1917,12 @@ void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len,
/* Internal functions, part of the implementation of address_space_read. */
MemTxResult address_space_read_full(AddressSpace *as, hwaddr addr,
MemTxAttrs attrs, uint8_t *buf, int len);
MemTxResult flatview_read_continue(FlatView *fv, hwaddr addr,
MemTxAttrs attrs, uint8_t *buf,
int len, hwaddr addr1, hwaddr l,
MemoryRegion *mr);
MemTxResult flatview_read_full(FlatView *fv, hwaddr addr,
MemTxAttrs attrs, uint8_t *buf, int len);
void *qemu_map_ram_ptr(RAMBlock *ram_block, ram_addr_t addr);
static inline bool memory_access_is_direct(MemoryRegion *mr, bool is_write)
@ -1922,25 +1941,28 @@ static inline bool memory_access_is_direct(MemoryRegion *mr, bool is_write)
*
* Return a MemTxResult indicating whether the operation succeeded
* or failed (eg unassigned memory, device rejected the transaction,
* IOMMU fault).
* IOMMU fault). Called within RCU critical section.
*
* @fv: #FlatView to be accessed
* @as: #AddressSpace to be accessed
* @addr: address within that address space
* @attrs: memory transaction attributes
* @buf: buffer with the data transferred
*/
static inline __attribute__((__always_inline__))
MemTxResult flatview_read(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
uint8_t *buf, int len)
MemTxResult address_space_read(AddressSpace *as, hwaddr addr,
MemTxAttrs attrs, uint8_t *buf,
int len)
{
MemTxResult result = MEMTX_OK;
hwaddr l, addr1;
void *ptr;
MemoryRegion *mr;
FlatView *fv;
if (__builtin_constant_p(len)) {
if (len) {
rcu_read_lock();
fv = address_space_to_flatview(as);
l = len;
mr = flatview_translate(fv, addr, &addr1, &l, false);
if (len == l && memory_access_is_direct(mr, false)) {
@ -1953,18 +1975,11 @@ MemTxResult flatview_read(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
rcu_read_unlock();
}
} else {
result = flatview_read_full(fv, addr, attrs, buf, len);
result = address_space_read_full(as, addr, attrs, buf, len);
}
return result;
}
static inline MemTxResult address_space_read(AddressSpace *as, hwaddr addr,
MemTxAttrs attrs, uint8_t *buf,
int len)
{
return flatview_read(address_space_to_flatview(as), addr, attrs, buf, len);
}
/**
* address_space_read_cached: read from a cached RAM region
*

View File

@ -153,7 +153,7 @@ SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockBackend *blk,
int unit, bool removable, int bootindex,
bool share_rw,
const char *serial, Error **errp);
void scsi_bus_legacy_handle_cmdline(SCSIBus *bus, bool deprecated);
void scsi_bus_legacy_handle_cmdline(SCSIBus *bus);
void scsi_legacy_handle_cmdline(void);
SCSIRequest *scsi_req_alloc(const SCSIReqOps *reqops, SCSIDevice *d,

View File

@ -28,7 +28,7 @@ struct QemuLockable {
* to QEMU_MAKE_LOCKABLE. For optimized builds, we can rely on dead-code elimination
* from the compiler, and give the errors already at link time.
*/
#ifdef __OPTIMIZE__
#if defined(__OPTIMIZE__) && !defined(__SANITIZE_ADDRESS__)
void unknown_lock_type(void *);
#else
static inline void unknown_lock_type(void *unused)

View File

@ -1016,6 +1016,22 @@ typedef struct ObjectPropertyIterator {
void object_property_iter_init(ObjectPropertyIterator *iter,
Object *obj);
/**
* object_class_property_iter_init:
* @klass: the class
*
* Initializes an iterator for traversing all properties
* registered against an object class and all parent classes.
*
* It is forbidden to modify the property list while iterating,
* whether removing or adding properties.
*
* This can be used on abstract classes as it does not create a temporary
* instance.
*/
void object_class_property_iter_init(ObjectPropertyIterator *iter,
ObjectClass *klass);
/**
* object_property_iter_next:
* @iter: the iterator instance

View File

@ -210,8 +210,6 @@ static bool memory_region_ioeventfd_equal(MemoryRegionIoeventfd a,
&& !memory_region_ioeventfd_before(b, a);
}
typedef struct FlatRange FlatRange;
/* Range of memory in the global map. Addresses are absolute. */
struct FlatRange {
MemoryRegion *mr;
@ -222,19 +220,6 @@ struct FlatRange {
bool readonly;
};
/* Flattened global view of current active memory hierarchy. Kept in sorted
* order.
*/
struct FlatView {
struct rcu_head rcu;
unsigned ref;
FlatRange *ranges;
unsigned nr;
unsigned nr_allocated;
struct AddressSpaceDispatch *dispatch;
MemoryRegion *root;
};
typedef struct AddressSpaceOps AddressSpaceOps;
#define FOR_EACH_FLAT_RANGE(var, view) \
@ -322,21 +307,6 @@ static void flatview_unref(FlatView *view)
}
}
FlatView *address_space_to_flatview(AddressSpace *as)
{
return atomic_rcu_read(&as->current_map);
}
AddressSpaceDispatch *flatview_to_dispatch(FlatView *fv)
{
return fv->dispatch;
}
AddressSpaceDispatch *address_space_to_dispatch(AddressSpace *as)
{
return flatview_to_dispatch(address_space_to_flatview(as));
}
static bool can_merge(FlatRange *r1, FlatRange *r2)
{
return int128_eq(addrrange_end(r1->addr), r2->addr.start)

View File

@ -1285,10 +1285,12 @@
# 3) A link type in the form 'link<subtype>' where subtype is a qdev
# device type name. Link properties form the device model graph.
#
# @description: if specified, the description of the property.
#
# Since: 1.2
##
{ 'struct': 'ObjectPropertyInfo',
'data': { 'name': 'str', 'type': 'str' } }
'data': { 'name': 'str', 'type': 'str', '*description': 'str' } }
##
# @qom-list:
@ -1443,21 +1445,6 @@
'data': { '*implements': 'str', '*abstract': 'bool' },
'returns': [ 'ObjectTypeInfo' ] }
##
# @DevicePropertyInfo:
#
# Information about device properties.
#
# @name: the name of the property
# @type: the typename of the property
# @description: if specified, the description of the property.
# (since 2.2)
#
# Since: 1.2
##
{ 'struct': 'DevicePropertyInfo',
'data': { 'name': 'str', 'type': 'str', '*description': 'str' } }
##
# @device-list-properties:
#
@ -1465,13 +1452,28 @@
#
# @typename: the type name of a device
#
# Returns: a list of DevicePropertyInfo describing a devices properties
# Returns: a list of ObjectPropertyInfo describing a devices properties
#
# Since: 1.2
##
{ 'command': 'device-list-properties',
'data': { 'typename': 'str'},
'returns': [ 'DevicePropertyInfo' ] }
'returns': [ 'ObjectPropertyInfo' ] }
##
# @qom-list-properties:
#
# List properties associated with a QOM object.
#
# @typename: the type name of an object
#
# Returns: a list of ObjectPropertyInfo describing object properties
#
# Since: 2.12
##
{ 'command': 'qom-list-properties',
'data': { 'typename': 'str'},
'returns': [ 'ObjectPropertyInfo' ] }
##
# @xen-set-global-dirty-log:

View File

@ -258,8 +258,8 @@ int qdev_device_help(QemuOpts *opts)
{
Error *local_err = NULL;
const char *driver;
DevicePropertyInfoList *prop_list;
DevicePropertyInfoList *prop;
ObjectPropertyInfoList *prop_list;
ObjectPropertyInfoList *prop;
driver = qemu_opt_get(opts, "driver");
if (driver && is_help_option(driver)) {
@ -295,7 +295,7 @@ int qdev_device_help(QemuOpts *opts)
}
}
qapi_free_DevicePropertyInfoList(prop_list);
qapi_free_ObjectPropertyInfoList(prop_list);
return 1;
error:

View File

@ -2606,13 +2606,6 @@ which is the default.
@section System emulator command line arguments
@subsection -tdf (since 1.3.0)
The ``-tdf'' argument is ignored. The behaviour implemented
by this argument is now the default when using the KVM PIT,
but can be requested explicitly using
``-global kvm-pit.lost_tick_policy=slew''.
@subsection -no-kvm-pit-reinjection (since 1.3.0)
The ``-no-kvm-pit-reinjection'' argument is now a
@ -2687,11 +2680,6 @@ The ``-net vlan=NN'' argument is partially replaced with the
new ``-netdev'' argument. The remaining use cases will no
longer be directly supported in QEMU.
@subsection -drive if=scsi (since 2.9.0)
The ``-drive if=scsi'' argument is replaced by the the
``-device BUS-TYPE'' argument combined with ``-drive if=none''.
@subsection -drive cyls=...,heads=...,secs=...,trans=... (since 2.10.0)
The drive geometry arguments are replaced by the the geometry arguments
@ -2719,6 +2707,11 @@ enabled via the ``-machine usb=on'' argument.
The ``-nodefconfig`` argument is a synonym for ``-no-user-config``.
@subsection -balloon (since 2.12.0)
The @option{--balloon virtio} argument has been superseded by
@option{--device virtio-balloon}.
@subsection -machine s390-squash-mcss=on|off (since 2.12.0)
The ``s390-squash-mcss=on`` property has been obsoleted by allowing the
@ -2735,12 +2728,18 @@ filesystem test suite. Also it requires the CAP_DAC_READ_SEARCH capability,
which is not the recommended way to run QEMU. This backend should not be
used and it will be removed with no replacement.
@subsection -no-frame (since 2.12.0)
@subsection -rtc-td-hack (since 2.12.0)
The ``-no-frame'' argument works with SDL 1.2 only. SDL 2.0 lacks
support for frameless windows, and the other user interfaces never
implemented this in the first place. So this will be removed together
with SDL 1.2 support.
The @code{-rtc-td-hack} option has been replaced by
@code{-rtc driftfix=slew}.
@subsection -localtime (since 2.12.0)
The @code{-localtime} option has been replaced by @code{-rtc base=localtime}.
@subsection -startdate (since 2.12.0)
The @code{-startdate} option has been replaced by @code{-rtc base=@var{date}}.
@section qemu-img command line arguments

View File

@ -504,7 +504,7 @@ int main(int argc, char **argv)
#endif
module_call_init(MODULE_INIT_TRACE);
progname = basename(argv[0]);
progname = g_path_get_basename(argv[0]);
qemu_init_exec_dir(argv[0]);
qcrypto_init(&error_fatal);

View File

@ -462,16 +462,13 @@ modprobe i810_audio clocking=48000
ETEXI
DEF("balloon", HAS_ARG, QEMU_OPTION_balloon,
"-balloon none disable balloon device\n"
"-balloon virtio[,addr=str]\n"
" enable virtio balloon device (default)\n", QEMU_ARCH_ALL)
" enable virtio balloon device (deprecated)\n", QEMU_ARCH_ALL)
STEXI
@item -balloon none
@findex -balloon
Disable balloon device.
@item -balloon virtio[,addr=@var{addr}]
Enable virtio balloon device (default), optionally with PCI address
@var{addr}.
@findex -balloon
Enable virtio balloon device, optionally with PCI address @var{addr}. This
option is deprecated, use @option{--device virtio-balloon} instead.
ETEXI
DEF("device", HAS_ARG, QEMU_OPTION_device,

View File

@ -808,7 +808,7 @@ static char *get_pci_driver(char const *syspath, int pathlen, Error **errp)
len = readlink(dpath, buf, sizeof(buf) - 1);
if (len != -1) {
buf[len] = 0;
driver = g_strdup(basename(buf));
driver = g_path_get_basename(buf);
}
g_free(dpath);
g_free(path);
@ -1053,7 +1053,7 @@ static void build_guest_fsinfo_for_device(char const *devpath,
}
if (!fs->name) {
fs->name = g_strdup(basename(syspath));
fs->name = g_path_get_basename(syspath);
}
g_debug(" parse sysfs path '%s'", syspath);

69
qmp.c
View File

@ -465,12 +465,12 @@ ObjectTypeInfoList *qmp_qom_list_types(bool has_implements,
*
* The caller must free the return value.
*/
static DevicePropertyInfo *make_device_property_info(ObjectClass *klass,
const char *name,
const char *default_type,
const char *description)
static ObjectPropertyInfo *make_device_property_info(ObjectClass *klass,
const char *name,
const char *default_type,
const char *description)
{
DevicePropertyInfo *info;
ObjectPropertyInfo *info;
Property *prop;
do {
@ -510,14 +510,14 @@ static DevicePropertyInfo *make_device_property_info(ObjectClass *klass,
return info;
}
DevicePropertyInfoList *qmp_device_list_properties(const char *typename,
Error **errp)
ObjectPropertyInfoList *qmp_device_list_properties(const char *typename,
Error **errp)
{
ObjectClass *klass;
Object *obj;
ObjectProperty *prop;
ObjectPropertyIterator iter;
DevicePropertyInfoList *prop_list = NULL;
ObjectPropertyInfoList *prop_list = NULL;
klass = object_class_by_name(typename);
if (klass == NULL) {
@ -542,8 +542,8 @@ DevicePropertyInfoList *qmp_device_list_properties(const char *typename,
object_property_iter_init(&iter, obj);
while ((prop = object_property_iter_next(&iter))) {
DevicePropertyInfo *info;
DevicePropertyInfoList *entry;
ObjectPropertyInfo *info;
ObjectPropertyInfoList *entry;
/* Skip Object and DeviceState properties */
if (strcmp(prop->name, "type") == 0 ||
@ -578,6 +578,55 @@ DevicePropertyInfoList *qmp_device_list_properties(const char *typename,
return prop_list;
}
ObjectPropertyInfoList *qmp_qom_list_properties(const char *typename,
Error **errp)
{
ObjectClass *klass;
Object *obj = NULL;
ObjectProperty *prop;
ObjectPropertyIterator iter;
ObjectPropertyInfoList *prop_list = NULL;
klass = object_class_by_name(typename);
if (klass == NULL) {
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
"Class '%s' not found", typename);
return NULL;
}
klass = object_class_dynamic_cast(klass, TYPE_OBJECT);
if (klass == NULL) {
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "typename", TYPE_OBJECT);
return NULL;
}
if (object_class_is_abstract(klass)) {
object_class_property_iter_init(&iter, klass);
} else {
obj = object_new(typename);
object_property_iter_init(&iter, obj);
}
while ((prop = object_property_iter_next(&iter))) {
ObjectPropertyInfo *info;
ObjectPropertyInfoList *entry;
info = g_malloc0(sizeof(*info));
info->name = g_strdup(prop->name);
info->type = g_strdup(prop->type);
info->has_description = !!prop->description;
info->description = g_strdup(prop->description);
entry = g_malloc0(sizeof(*entry));
entry->value = info;
entry->next = prop_list;
prop_list = entry;
}
object_unref(obj);
return prop_list;
}
CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
{
return arch_query_cpu_definitions(errp);

View File

@ -1037,6 +1037,13 @@ ObjectProperty *object_property_iter_next(ObjectPropertyIterator *iter)
return val;
}
void object_class_property_iter_init(ObjectPropertyIterator *iter,
ObjectClass *klass)
{
g_hash_table_iter_init(&iter->iter, klass->properties);
iter->nextclass = klass;
}
ObjectProperty *object_class_property_find(ObjectClass *klass, const char *name,
Error **errp)
{

View File

@ -2352,8 +2352,9 @@ sub process {
}
}
# check for missing bracing round if etc
if ($line =~ /(^.*)\bif\b/ && $line !~ /\#\s*if/) {
# check for missing bracing around if etc
if ($line =~ /(^.*)\b(?:if|while|for)\b/ &&
$line !~ /\#\s*if/) {
my ($level, $endln, @chunks) =
ctx_statement_full($linenr, $realcnt, 1);
if ($dbg_adv_apw) {
@ -2584,6 +2585,11 @@ sub process {
ERROR("__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr);
}
# recommend g_path_get_* over g_strdup(basename/dirname(...))
if ($line =~ /\bg_strdup\s*\(\s*(basename|dirname)\s*\(/) {
WARN("consider using g_path_get_$1() in preference to g_strdup($1())\n" . $herecurr);
}
# recommend qemu_strto* over strto* for numeric conversions
if ($line =~ /\b(strto[^kd].*?)\s*\(/) {
ERROR("consider using qemu_$1 in preference to $1\n" . $herecurr);

View File

@ -26,13 +26,12 @@
#include "qapi/error.h"
#include "migration/blocker.h"
#include <winhvplatform.h>
#include <winhvemulation.h>
#include <WinHvPlatform.h>
#include <WinHvEmulation.h>
struct whpx_state {
uint64_t mem_quota;
WHV_PARTITION_HANDLE partition;
uint32_t exit_ctx_size;
};
static const WHV_REGISTER_NAME whpx_register_names[] = {
@ -364,7 +363,6 @@ static void whpx_set_registers(CPUState *cpu)
if (FAILED(hr)) {
error_report("WHPX: Failed to set virtual processor context, hr=%08lx",
hr);
__debugbreak();
}
return;
@ -391,7 +389,6 @@ static void whpx_get_registers(CPUState *cpu)
if (FAILED(hr)) {
error_report("WHPX: Failed to get virtual processor context, hr=%08lx",
hr);
__debugbreak();
}
/* Indexes for first 16 registers match between HV and QEMU definitions */
@ -529,7 +526,7 @@ static HRESULT CALLBACK whpx_emu_ioport_callback(
return S_OK;
}
static HRESULT CALLBACK whpx_emu_memio_callback(
static HRESULT CALLBACK whpx_emu_mmio_callback(
void *ctx,
WHV_EMULATOR_MEMORY_ACCESS_INFO *ma)
{
@ -554,7 +551,6 @@ static HRESULT CALLBACK whpx_emu_getreg_callback(
if (FAILED(hr)) {
error_report("WHPX: Failed to get virtual processor registers,"
" hr=%08lx", hr);
__debugbreak();
}
return hr;
@ -576,7 +572,6 @@ static HRESULT CALLBACK whpx_emu_setreg_callback(
if (FAILED(hr)) {
error_report("WHPX: Failed to set virtual processor registers,"
" hr=%08lx", hr);
__debugbreak();
}
/*
@ -604,7 +599,6 @@ static HRESULT CALLBACK whpx_emu_translate_callback(
Gva, TranslateFlags, &res, Gpa);
if (FAILED(hr)) {
error_report("WHPX: Failed to translate GVA, hr=%08lx", hr);
__debugbreak();
} else {
*TranslationResult = res.ResultCode;
}
@ -613,8 +607,9 @@ static HRESULT CALLBACK whpx_emu_translate_callback(
}
static const WHV_EMULATOR_CALLBACKS whpx_emu_callbacks = {
.Size = sizeof(WHV_EMULATOR_CALLBACKS),
.WHvEmulatorIoPortCallback = whpx_emu_ioport_callback,
.WHvEmulatorMemoryCallback = whpx_emu_memio_callback,
.WHvEmulatorMemoryCallback = whpx_emu_mmio_callback,
.WHvEmulatorGetVirtualProcessorRegisters = whpx_emu_getreg_callback,
.WHvEmulatorSetVirtualProcessorRegisters = whpx_emu_setreg_callback,
.WHvEmulatorTranslateGvaPage = whpx_emu_translate_callback,
@ -626,15 +621,15 @@ static int whpx_handle_mmio(CPUState *cpu, WHV_MEMORY_ACCESS_CONTEXT *ctx)
struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu);
WHV_EMULATOR_STATUS emu_status;
hr = WHvEmulatorTryMmioEmulation(vcpu->emulator, cpu, ctx, &emu_status);
hr = WHvEmulatorTryMmioEmulation(vcpu->emulator, cpu,
&vcpu->exit_ctx.VpContext, ctx,
&emu_status);
if (FAILED(hr)) {
__debugbreak();
error_report("WHPX: Failed to parse MMIO access, hr=%08lx", hr);
return -1;
}
if (!emu_status.EmulationSuccessful) {
__debugbreak();
error_report("WHPX: Failed to emulate MMIO access");
return -1;
}
@ -649,15 +644,15 @@ static int whpx_handle_portio(CPUState *cpu,
struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu);
WHV_EMULATOR_STATUS emu_status;
hr = WHvEmulatorTryIoEmulation(vcpu->emulator, cpu, ctx, &emu_status);
hr = WHvEmulatorTryIoEmulation(vcpu->emulator, cpu,
&vcpu->exit_ctx.VpContext, ctx,
&emu_status);
if (FAILED(hr)) {
__debugbreak();
error_report("WHPX: Failed to parse PortIO access, hr=%08lx", hr);
return -1;
}
if (!emu_status.EmulationSuccessful) {
__debugbreak();
error_report("WHPX: Failed to emulate PortMMIO access");
return -1;
}
@ -691,6 +686,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu)
struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr);
X86CPU *x86_cpu = X86_CPU(cpu);
int irq;
uint8_t tpr;
WHV_X64_PENDING_INTERRUPTION_REGISTER new_int = {0};
UINT32 reg_count = 0;
WHV_REGISTER_VALUE reg_values[3] = {0};
@ -709,10 +705,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu)
new_int.InterruptionVector = 2;
}
if (cpu->interrupt_request & CPU_INTERRUPT_SMI) {
qemu_mutex_lock_iothread();
cpu->interrupt_request &= ~CPU_INTERRUPT_SMI;
__debugbreak();
qemu_mutex_unlock_iothread();
}
}
@ -753,21 +746,21 @@ static void whpx_vcpu_pre_run(CPUState *cpu)
}
/* Sync the TPR to the CR8 if was modified during the intercept */
reg_values[reg_count].Reg64 = cpu_get_apic_tpr(x86_cpu->apic_state);
if (reg_values[reg_count].Reg64 != vcpu->tpr) {
vcpu->tpr = reg_values[reg_count].Reg64;
tpr = cpu_get_apic_tpr(x86_cpu->apic_state);
if (tpr != vcpu->tpr) {
vcpu->tpr = tpr;
reg_values[reg_count].Reg64 = tpr;
cpu->exit_request = 1;
reg_names[reg_count] = WHvX64RegisterCr8;
reg_count += 1;
}
/* Update the state of the interrupt delivery notification */
if (cpu->interrupt_request & CPU_INTERRUPT_HARD) {
if (!vcpu->window_registered &&
cpu->interrupt_request & CPU_INTERRUPT_HARD) {
reg_values[reg_count].DeliverabilityNotifications.InterruptNotification
= 1;
if (vcpu->window_registered != 1) {
vcpu->window_registered = 1;
}
vcpu->window_registered = 1;
reg_names[reg_count] = WHvX64RegisterDeliverabilityNotifications;
reg_count += 1;
}
@ -780,7 +773,6 @@ static void whpx_vcpu_pre_run(CPUState *cpu)
if (FAILED(hr)) {
error_report("WHPX: Failed to set interrupt state registers,"
" hr=%08lx", hr);
__debugbreak();
}
}
@ -807,7 +799,6 @@ static void whpx_vcpu_post_run(CPUState *cpu)
if (FAILED(hr)) {
error_report("WHPX: Failed to get interrupt state regusters,"
" hr=%08lx", hr);
__debugbreak();
vcpu->interruptable = false;
return;
}
@ -905,18 +896,8 @@ static int whpx_vcpu_run(CPUState *cpu)
whpx_vcpu_kick(cpu);
}
for (;;) {
hr = WHvRunVirtualProcessor(whpx->partition, cpu->cpu_index,
&vcpu->exit_ctx, whpx->exit_ctx_size);
if (SUCCEEDED(hr) && (vcpu->exit_ctx.ExitReason ==
WHvRunVpExitReasonAlerted)) {
WHvCancelRunVirtualProcessor(whpx->partition, cpu->cpu_index,
0);
} else {
break;
}
}
hr = WHvRunVirtualProcessor(whpx->partition, cpu->cpu_index,
&vcpu->exit_ctx, sizeof(vcpu->exit_ctx));
if (FAILED(hr)) {
error_report("WHPX: Failed to exec a virtual processor,"
@ -956,7 +937,6 @@ static int whpx_vcpu_run(CPUState *cpu)
case WHvRunVpExitReasonX64MsrAccess:
case WHvRunVpExitReasonX64Cpuid:
case WHvRunVpExitReasonException:
case WHvRunVpExitReasonAlerted:
default:
error_report("WHPX: Unexpected VP exit code %d",
vcpu->exit_ctx.ExitReason);
@ -1060,15 +1040,14 @@ int whpx_init_vcpu(CPUState *cpu)
}
}
vcpu = g_malloc0(FIELD_OFFSET(struct whpx_vcpu, exit_ctx) +
whpx->exit_ctx_size);
vcpu = g_malloc0(sizeof(struct whpx_vcpu));
if (!vcpu) {
error_report("WHPX: Failed to allocte VCPU context.");
return -ENOMEM;
}
hr = WHvEmulatorCreateEmulator(whpx_emu_callbacks, &vcpu->emulator);
hr = WHvEmulatorCreateEmulator(&whpx_emu_callbacks, &vcpu->emulator);
if (FAILED(hr)) {
error_report("WHPX: Failed to setup instruction completion support,"
" hr=%08lx", hr);
@ -1318,9 +1297,6 @@ static int whpx_accel_init(MachineState *ms)
goto error;
}
whpx->exit_ctx_size = WHvGetRunExitContextSize();
assert(whpx->exit_ctx_size);
whpx_memory_init();
cpu_interrupt_handler = whpx_handle_interrupt;

View File

@ -1823,6 +1823,7 @@ static void create_ahci_io_test(enum IOMode type, enum AddrMode addr,
if ((addr == ADDR_MODE_LBA48) && (offset == OFFSET_HIGH) &&
(mb_to_sectors(test_image_size_mb) <= 0xFFFFFFF)) {
g_test_message("%s: skipped; test image too small", name);
g_free(opts);
g_free(name);
return;
}

View File

@ -157,9 +157,7 @@ case "$QEMU_DEFAULT_MACHINE" in
pc)
run_qemu -drive if=floppy
run_qemu -drive if=ide,media=cdrom
run_qemu -drive if=scsi,media=cdrom
run_qemu -drive if=ide
run_qemu -drive if=scsi
;;
*)
;;
@ -188,9 +186,7 @@ case "$QEMU_DEFAULT_MACHINE" in
pc)
run_qemu -drive file="$TEST_IMG",if=floppy,readonly=on
run_qemu -drive file="$TEST_IMG",if=ide,media=cdrom,readonly=on
run_qemu -drive file="$TEST_IMG",if=scsi,media=cdrom,readonly=on
run_qemu -drive file="$TEST_IMG",if=ide,readonly=on
run_qemu -drive file="$TEST_IMG",if=scsi,readonly=on
;;
*)
;;

View File

@ -209,8 +209,10 @@ static QSDHCI *machine_start(const struct sdhci_t *test)
static void machine_stop(QSDHCI *s)
{
qpci_free_pc(s->pci.bus);
g_free(s->pci.dev);
qtest_quit(global_qtest);
g_free(s);
}
static void test_machine(const void *data)

20
vl.c
View File

@ -2209,6 +2209,9 @@ static int balloon_parse(const char *arg)
{
QemuOpts *opts;
warn_report("This option is deprecated. "
"Use '--device virtio-balloon' to enable the balloon device.");
if (strcmp(arg, "none") == 0) {
return 0;
}
@ -3406,6 +3409,8 @@ int main(int argc, char **argv, char **envp)
break;
case QEMU_OPTION_localtime:
rtc_utc = 0;
warn_report("This option is deprecated, "
"use '-rtc base=localtime' instead.");
break;
case QEMU_OPTION_vga:
vga_model = optarg;
@ -3665,6 +3670,8 @@ int main(int argc, char **argv, char **envp)
};
qdev_prop_register_global(&slew_lost_ticks);
warn_report("This option is deprecated, "
"use '-rtc driftfix=slew' instead.");
break;
}
case QEMU_OPTION_acpitable:
@ -3842,9 +3849,6 @@ int main(int argc, char **argv, char **envp)
exit(1);
}
break;
case QEMU_OPTION_tdf:
warn_report("ignoring deprecated option");
break;
case QEMU_OPTION_name:
opts = qemu_opts_parse_noisily(qemu_find_opts("name"),
optarg, true);
@ -3869,6 +3873,7 @@ int main(int argc, char **argv, char **envp)
*/
break;
case QEMU_OPTION_startdate:
warn_report("This option is deprecated, use '-rtc base=' instead.");
configure_rtc_date_offset(optarg, 1);
break;
case QEMU_OPTION_rtc:
@ -4624,15 +4629,6 @@ int main(int argc, char **argv, char **envp)
rom_reset_order_override();
/*
* Create frontends for -drive if=scsi leftovers.
* Normally, frontends for -drive get created by machine
* initialization for onboard SCSI HBAs. However, we create a few
* more ever since SCSI qdevification, but this is pretty much an
* implementation accident, and deprecated.
*/
scsi_legacy_handle_cmdline();
/* Did we create any drives that we failed to create a device for? */
drive_check_orphaned();