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

* Build system fixes and cleanups
* DMA support in the multiboot option ROM
* Rename default-bus-bypass-iommu
* Deprecate -watchdog and cleanup -watchdog-action
* HVF fix for <PAGE_SIZE regions
* Support TSC scaling for AMD nested virtualization
* Fix for ESP fuzzing bug

# gpg: Signature made Tue 02 Nov 2021 10:57:37 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: (27 commits)
  configure: fix --audio-drv-list help message
  configure: Remove the check for the __thread keyword
  Move the l2tpv3 test from configure to meson.build
  meson: remove unnecessary coreaudio test program
  meson: remove pointless warnings
  meson.build: Allow to disable OSS again
  meson: bump submodule to 0.59.3
  qtest/am53c974-test: add test for cancelling in-flight requests
  esp: ensure in-flight SCSI requests are always cancelled
  KVM: SVM: add migration support for nested TSC scaling
  hw/i386: fix vmmouse registration
  watchdog: remove select_watchdog_action
  vl: deprecate -watchdog
  watchdog: add information from -watchdog help to -device help
  hw/i386: Rename default_bus_bypass_iommu
  hvf: Avoid mapping regions < PAGE_SIZE as ram
  configure: do not duplicate CPU_CFLAGS into QEMU_LDFLAGS
  configure: remove useless NPTL probe
  target/i386: use DMA-enabled multiboot ROM for new-enough QEMU machine types
  optionrom: add a DMA-enabled multiboot ROM
  ...

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson
2021-11-03 13:07:30 -04:00
47 changed files with 293 additions and 204 deletions
+1 -1
View File
@@ -1611,7 +1611,7 @@ microvm
M: Sergio Lopez <slp@redhat.com>
M: Paolo Bonzini <pbonzini@redhat.com>
S: Maintained
F: docs/microvm.rst
F: docs/system/i386/microvm.rst
F: hw/i386/microvm.c
F: include/hw/i386/microvm.h
F: pc-bios/bios-microvm.bin
+3 -2
View File
@@ -235,7 +235,8 @@ distclean: clean
rm -f linux-headers/asm
rm -Rf .sdk
find-src-path = find "$(SRC_PATH)/" -path "$(SRC_PATH)/meson" -prune -o \( -name "*.[chsS]" -o -name "*.[ch].inc" \)
find-src-path = find "$(SRC_PATH)" -path "$(SRC_PATH)/meson" -prune -o \
-type l -prune -o \( -name "*.[chsS]" -o -name "*.[ch].inc" \)
.PHONY: ctags
ctags:
@@ -256,7 +257,7 @@ gtags:
"GTAGS", "Remove old $@ files")
$(call quiet-command, \
(cd $(SRC_PATH) && \
$(find-src-path) | gtags -f -), \
$(find-src-path) -print | gtags -f -), \
"GTAGS", "Re-index $(SRC_PATH)")
.PHONY: TAGS
+7
View File
@@ -122,6 +122,7 @@ static void hvf_set_phys_mem(MemoryRegionSection *section, bool add)
MemoryRegion *area = section->mr;
bool writeable = !area->readonly && !area->rom_device;
hv_memory_flags_t flags;
uint64_t page_size = qemu_real_host_page_size;
if (!memory_region_is_ram(area)) {
if (writeable) {
@@ -135,6 +136,12 @@ static void hvf_set_phys_mem(MemoryRegionSection *section, bool add)
}
}
if (!QEMU_IS_ALIGNED(int128_get64(section->size), page_size) ||
!QEMU_IS_ALIGNED(section->offset_within_address_space, page_size)) {
/* Not page aligned, so we can not map as RAM */
add = false;
}
mem = hvf_find_overlap_slot(
section->offset_within_address_space,
int128_get64(section->size));
Vendored
+24 -89
View File
@@ -1259,45 +1259,20 @@ firmwarepath="${firmwarepath:-$datadir/qemu-firmware}"
localedir="${localedir:-$datadir/locale}"
case "$cpu" in
ppc)
CPU_CFLAGS="-m32"
QEMU_LDFLAGS="-m32 $QEMU_LDFLAGS"
;;
ppc64)
CPU_CFLAGS="-m64"
QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS"
;;
sparc)
CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc"
QEMU_LDFLAGS="-m32 -mv8plus $QEMU_LDFLAGS"
;;
sparc64)
CPU_CFLAGS="-m64 -mcpu=ultrasparc"
QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS"
;;
s390)
CPU_CFLAGS="-m31"
QEMU_LDFLAGS="-m31 $QEMU_LDFLAGS"
;;
s390x)
CPU_CFLAGS="-m64"
QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS"
;;
i386)
CPU_CFLAGS="-m32"
QEMU_LDFLAGS="-m32 $QEMU_LDFLAGS"
;;
x86_64)
# ??? Only extremely old AMD cpus do not have cmpxchg16b.
# If we truly care, we should simply detect this case at
# runtime and generate the fallback to serial emulation.
CPU_CFLAGS="-m64 -mcx16"
QEMU_LDFLAGS="-m64 $QEMU_LDFLAGS"
;;
x32)
CPU_CFLAGS="-mx32"
QEMU_LDFLAGS="-mx32 $QEMU_LDFLAGS"
;;
ppc) CPU_CFLAGS="-m32" ;;
ppc64) CPU_CFLAGS="-m64" ;;
sparc) CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc" ;;
sparc64) CPU_CFLAGS="-m64 -mcpu=ultrasparc" ;;
s390) CPU_CFLAGS="-m31" ;;
s390x) CPU_CFLAGS="-m64" ;;
i386) CPU_CFLAGS="-m32" ;;
x32) CPU_CFLAGS="-mx32" ;;
# ??? Only extremely old AMD cpus do not have cmpxchg16b.
# If we truly care, we should simply detect this case at
# runtime and generate the fallback to serial emulation.
x86_64) CPU_CFLAGS="-m64 -mcx16" ;;
# No special flags required for other host CPUs
esac
@@ -1411,7 +1386,7 @@ Advanced options (experts only):
--disable-strip disable stripping binaries
--disable-werror disable compilation abort on warning
--disable-stack-protector disable compiler-provided stack protection
--audio-drv-list=LIST set audio drivers list
--audio-drv-list=LIST set audio drivers to try if -audiodev is not used
--block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
--block-drv-rw-whitelist=L
set block driver read-write whitelist
@@ -1521,7 +1496,7 @@ python_version=$($python -c 'import sys; print("%d.%d.%d" % (sys.version_info[0]
python="$python -B"
if test -z "$meson"; then
if test "$explicit_python" = no && has meson && version_ge "$(meson --version)" 0.59.2; then
if test "$explicit_python" = no && has meson && version_ge "$(meson --version)" 0.59.3; then
meson=meson
elif test $git_submodules_action != 'ignore' ; then
meson=git
@@ -1745,17 +1720,6 @@ if test "$static" = "yes" ; then
fi
fi
# Unconditional check for compiler __thread support
cat > $TMPC << EOF
static __thread int tls_var;
int main(void) { return tls_var; }
EOF
if ! compile_prog "-Werror" "" ; then
error_exit "Your compiler does not support the __thread specifier for " \
"Thread-Local Storage (TLS). Please upgrade to a version that does."
fi
cat > $TMPC << EOF
#ifdef __linux__
@@ -1767,9 +1731,11 @@ static THREAD int tls_var;
int main(void) { return tls_var; }
EOF
# Check we support --no-pie first; we will need this for building ROMs.
# Check we support -fno-pie and -no-pie first; we will need the former for
# building ROMs, and both for everything if --disable-pie is passed.
if compile_prog "-Werror -fno-pie" "-no-pie"; then
CFLAGS_NOPIE="-fno-pie"
LDFLAGS_NOPIE="-no-pie"
fi
if test "$static" = "yes"; then
@@ -1785,6 +1751,7 @@ if test "$static" = "yes"; then
fi
elif test "$pie" = "no"; then
CONFIGURE_CFLAGS="$CFLAGS_NOPIE $CONFIGURE_CFLAGS"
CONFIGURE_LDFLAGS="$LDFLAGS_NOPIE $CONFIGURE_LDFLAGS"
elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then
CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS"
CONFIGURE_LDFLAGS="-pie $CONFIGURE_LDFLAGS"
@@ -1914,20 +1881,6 @@ if test -z "$want_tools"; then
fi
fi
##########################################
# L2TPV3 probe
cat > $TMPC <<EOF
#include <sys/socket.h>
#include <linux/ip.h>
int main(void) { return sizeof(struct mmsghdr); }
EOF
if compile_prog "" "" ; then
l2tpv3=yes
else
l2tpv3=no
fi
#########################################
# vhost interdependencies and host support
@@ -1987,25 +1940,6 @@ if ! has "$pkg_config_exe"; then
error_exit "pkg-config binary '$pkg_config_exe' not found"
fi
##########################################
# NPTL probe
if test "$linux_user" = "yes"; then
cat > $TMPC <<EOF
#include <sched.h>
#include <linux/futex.h>
int main(void) {
#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
#error bork
#endif
return 0;
}
EOF
if ! compile_object ; then
feature_not_found "nptl" "Install glibc and linux kernel headers."
fi
fi
##########################################
# xen probe
@@ -3551,9 +3485,6 @@ if test "$slirp_smbd" = "yes" ; then
echo "CONFIG_SLIRP_SMBD=y" >> $config_host_mak
echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
fi
if test "$l2tpv3" = "yes" ; then
echo "CONFIG_L2TPV3=y" >> $config_host_mak
fi
if test "$gprof" = "yes" ; then
echo "CONFIG_GPROF=y" >> $config_host_mak
fi
@@ -3956,6 +3887,10 @@ for rom in seabios; do
echo "RANLIB=$ranlib" >> $config_mak
done
config_mak=pc-bios/optionrom/config.mak
echo "# Automatically generated by configure - do not modify" > $config_mak
echo "TOPSRC_DIR=$source_path" >> $config_mak
if test "$skip_meson" = no; then
cross="config-meson.cross.new"
meson_quote() {
+5
View File
@@ -160,6 +160,11 @@ Use ``-display sdl`` instead.
Use ``-display curses`` instead.
``-watchdog`` (since 6.2)
'''''''''''''''''''''''''
Use ``-device`` instead.
``-smp`` ("parameter=0" SMP configurations) (since 6.2)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
+1 -1
View File
@@ -1105,7 +1105,7 @@ static int vtd_page_walk_one(IOMMUTLBEvent *event, vtd_page_walk_info *info)
.translated_addr = entry->translated_addr,
.perm = entry->perm,
};
DMAMap *mapped = iova_tree_find(as->iova_tree, &target);
const DMAMap *mapped = iova_tree_find(as->iova_tree, &target);
if (event->type == IOMMU_NOTIFIER_UNMAP && !info->notify_unmap) {
trace_vtd_page_walk_one_skip_unmap(entry->iova, entry->addr_mask);
+4 -1
View File
@@ -332,7 +332,7 @@ static void microvm_memory_init(MicrovmMachineState *mms)
rom_set_fw(fw_cfg);
if (machine->kernel_filename != NULL) {
x86_load_linux(x86ms, fw_cfg, 0, true, true);
x86_load_linux(x86ms, fw_cfg, 0, true);
}
if (mms->option_roms) {
@@ -669,6 +669,7 @@ static void microvm_machine_initfn(Object *obj)
static void microvm_class_init(ObjectClass *oc, void *data)
{
X86MachineClass *x86mc = X86_MACHINE_CLASS(oc);
MachineClass *mc = MACHINE_CLASS(oc);
HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc);
@@ -699,6 +700,8 @@ static void microvm_class_init(ObjectClass *oc, void *data)
hc->unplug_request = microvm_device_unplug_request_cb;
hc->unplug = microvm_device_unplug_cb;
x86mc->fwcfg_dma_enabled = true;
object_class_property_add(oc, MICROVM_MACHINE_PIC, "OnOffAuto",
microvm_machine_get_pic,
microvm_machine_set_pic,
+8 -2
View File
@@ -143,7 +143,8 @@ static void mb_add_mod(MultibootState *s,
s->mb_mods_count++;
}
int load_multiboot(FWCfgState *fw_cfg,
int load_multiboot(X86MachineState *x86ms,
FWCfgState *fw_cfg,
FILE *f,
const char *kernel_filename,
const char *initrd_filename,
@@ -151,6 +152,7 @@ int load_multiboot(FWCfgState *fw_cfg,
int kernel_file_size,
uint8_t *header)
{
bool multiboot_dma_enabled = X86_MACHINE_GET_CLASS(x86ms)->fwcfg_dma_enabled;
int i, is_multiboot = 0;
uint32_t flags = 0;
uint32_t mh_entry_addr;
@@ -401,7 +403,11 @@ int load_multiboot(FWCfgState *fw_cfg,
fw_cfg_add_bytes(fw_cfg, FW_CFG_INITRD_DATA, mb_bootinfo_data,
sizeof(bootinfo));
option_rom[nb_option_roms].name = "multiboot.bin";
if (multiboot_dma_enabled) {
option_rom[nb_option_roms].name = "multiboot_dma.bin";
} else {
option_rom[nb_option_roms].name = "multiboot.bin";
}
option_rom[nb_option_roms].bootindex = 0;
nb_option_roms++;
+3 -1
View File
@@ -2,8 +2,10 @@
#define QEMU_MULTIBOOT_H
#include "hw/nvram/fw_cfg.h"
#include "hw/i386/x86.h"
int load_multiboot(FWCfgState *fw_cfg,
int load_multiboot(X86MachineState *x86ms,
FWCfgState *fw_cfg,
FILE *f,
const char *kernel_filename,
const char *initrd_filename,
+5 -5
View File
@@ -776,12 +776,13 @@ void xen_load_linux(PCMachineState *pcms)
rom_set_fw(fw_cfg);
x86_load_linux(x86ms, fw_cfg, pcmc->acpi_data_size,
pcmc->pvh_enabled, pcmc->linuxboot_dma_enabled);
pcmc->pvh_enabled);
for (i = 0; i < nb_option_roms; i++) {
assert(!strcmp(option_rom[i].name, "linuxboot.bin") ||
!strcmp(option_rom[i].name, "linuxboot_dma.bin") ||
!strcmp(option_rom[i].name, "pvh.bin") ||
!strcmp(option_rom[i].name, "multiboot.bin"));
!strcmp(option_rom[i].name, "multiboot.bin") ||
!strcmp(option_rom[i].name, "multiboot_dma.bin"));
rom_add_option(option_rom[i].name, option_rom[i].bootindex);
}
x86ms->fw_cfg = fw_cfg;
@@ -928,7 +929,7 @@ void pc_memory_init(PCMachineState *pcms,
if (linux_boot) {
x86_load_linux(x86ms, fw_cfg, pcmc->acpi_data_size,
pcmc->pvh_enabled, pcmc->linuxboot_dma_enabled);
pcmc->pvh_enabled);
}
for (i = 0; i < nb_option_roms; i++) {
@@ -1688,7 +1689,6 @@ static void pc_machine_class_init(ObjectClass *oc, void *data)
/* BIOS ACPI tables: 128K. Other BIOS datastructures: less than 4K reported
* to be used at the moment, 32K should be enough for a while. */
pcmc->acpi_data_size = 0x20000 + 0x8000;
pcmc->linuxboot_dma_enabled = true;
pcmc->pvh_enabled = true;
pcmc->kvmclock_create_always = true;
assert(!mc->get_hotplug_handler);
@@ -1742,7 +1742,7 @@ static void pc_machine_class_init(ObjectClass *oc, void *data)
object_class_property_add_bool(oc, "hpet",
pc_machine_get_hpet, pc_machine_set_hpet);
object_class_property_add_bool(oc, "default_bus_bypass_iommu",
object_class_property_add_bool(oc, "default-bus-bypass-iommu",
pc_machine_get_default_bus_bypass_iommu,
pc_machine_set_default_bus_bypass_iommu);
+2 -1
View File
@@ -620,11 +620,12 @@ DEFINE_I440FX_MACHINE(v2_7, "pc-i440fx-2.7", NULL,
static void pc_i440fx_2_6_machine_options(MachineClass *m)
{
X86MachineClass *x86mc = X86_MACHINE_CLASS(m);
PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
pc_i440fx_2_7_machine_options(m);
pcmc->legacy_cpu_hotplug = true;
pcmc->linuxboot_dma_enabled = false;
x86mc->fwcfg_dma_enabled = false;
compat_props_add(m->compat_props, hw_compat_2_6, hw_compat_2_6_len);
compat_props_add(m->compat_props, pc_compat_2_6, pc_compat_2_6_len);
}
+2 -1
View File
@@ -573,11 +573,12 @@ DEFINE_Q35_MACHINE(v2_7, "pc-q35-2.7", NULL,
static void pc_q35_2_6_machine_options(MachineClass *m)
{
X86MachineClass *x86mc = X86_MACHINE_CLASS(m);
PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
pc_q35_2_7_machine_options(m);
pcmc->legacy_cpu_hotplug = true;
pcmc->linuxboot_dma_enabled = false;
x86mc->fwcfg_dma_enabled = false;
compat_props_add(m->compat_props, hw_compat_2_6, hw_compat_2_6_len);
compat_props_add(m->compat_props, pc_compat_2_6, pc_compat_2_6_len);
}
+4 -3
View File
@@ -764,9 +764,9 @@ static bool load_elfboot(const char *kernel_filename,
void x86_load_linux(X86MachineState *x86ms,
FWCfgState *fw_cfg,
int acpi_data_size,
bool pvh_enabled,
bool linuxboot_dma_enabled)
bool pvh_enabled)
{
bool linuxboot_dma_enabled = X86_MACHINE_GET_CLASS(x86ms)->fwcfg_dma_enabled;
uint16_t protocol;
int setup_size, kernel_size, cmdline_size;
int dtb_size, setup_data_offset;
@@ -814,7 +814,7 @@ void x86_load_linux(X86MachineState *x86ms,
* PVH), so we try multiboot first since we check the multiboot magic
* header before to load it.
*/
if (load_multiboot(fw_cfg, f, kernel_filename, initrd_filename,
if (load_multiboot(x86ms, fw_cfg, f, kernel_filename, initrd_filename,
kernel_cmdline, kernel_size, header)) {
return;
}
@@ -1332,6 +1332,7 @@ static void x86_machine_class_init(ObjectClass *oc, void *data)
mc->possible_cpu_arch_ids = x86_possible_cpu_arch_ids;
x86mc->compat_apic_id_mode = false;
x86mc->save_tsc_khz = true;
x86mc->fwcfg_dma_enabled = true;
nc->nmi_monitor_handler = x86_nmi;
object_class_property_add(oc, X86_MACHINE_SMM, "OnOffAuto",
+5 -5
View File
@@ -204,11 +204,6 @@ static int esp_select(ESPState *s)
s->ti_size = 0;
fifo8_reset(&s->fifo);
if (s->current_req) {
/* Started a new command before the old one finished. Cancel it. */
scsi_req_cancel(s->current_req);
}
s->current_dev = scsi_device_find(&s->bus, 0, target, 0);
if (!s->current_dev) {
/* No such drive */
@@ -235,6 +230,11 @@ static uint32_t get_cmd(ESPState *s, uint32_t maxlen)
uint32_t dmalen, n;
int target;
if (s->current_req) {
/* Started a new command before the old one finished. Cancel it. */
scsi_req_cancel(s->current_req);
}
target = s->wregs[ESP_WBUSID] & BUSID_DID;
if (s->dma) {
dmalen = MIN(esp_get_tc(s), maxlen);
+2 -1
View File
@@ -273,8 +273,9 @@ static void wdt_sbsa_gwdt_class_init(ObjectClass *klass, void *data)
dc->realize = wdt_sbsa_gwdt_realize;
dc->reset = wdt_sbsa_gwdt_reset;
dc->hotpluggable = false;
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
set_bit(DEVICE_CATEGORY_WATCHDOG, dc->categories);
dc->vmsd = &vmstate_sbsa_gwdt;
dc->desc = "SBSA-compliant generic watchdog device";
}
static const TypeInfo wdt_sbsa_gwdt_info = {
-14
View File
@@ -76,20 +76,6 @@ int select_watchdog(const char *p)
return 1;
}
int select_watchdog_action(const char *p)
{
int action;
char *qapi_value;
qapi_value = g_ascii_strdown(p, -1);
action = qapi_enum_parse(&WatchdogAction_lookup, qapi_value, -1, NULL);
g_free(qapi_value);
if (action < 0)
return -1;
qmp_watchdog_set_action(action, &error_abort);
return 0;
}
WatchdogAction get_watchdog_action(void)
{
return watchdog_action;
+2 -1
View File
@@ -293,9 +293,10 @@ static void aspeed_wdt_class_init(ObjectClass *klass, void *data)
dc->desc = "ASPEED Watchdog Controller";
dc->realize = aspeed_wdt_realize;
dc->reset = aspeed_wdt_reset;
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
set_bit(DEVICE_CATEGORY_WATCHDOG, dc->categories);
dc->vmsd = &vmstate_aspeed_wdt;
device_class_set_props(dc, aspeed_wdt_properties);
dc->desc = "Aspeed watchdog device";
}
static const TypeInfo aspeed_wdt_info = {
+2 -1
View File
@@ -122,9 +122,10 @@ static void wdt_diag288_class_init(ObjectClass *klass, void *data)
dc->unrealize = wdt_diag288_unrealize;
dc->reset = wdt_diag288_reset;
dc->hotpluggable = false;
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
set_bit(DEVICE_CATEGORY_WATCHDOG, dc->categories);
dc->vmsd = &vmstate_diag288;
diag288->handle_timer = wdt_diag288_handle_timer;
dc->desc = "diag288 device for s390x platform";
}
static const TypeInfo wdt_diag288_info = {
+2 -1
View File
@@ -476,7 +476,8 @@ static void i6300esb_class_init(ObjectClass *klass, void *data)
k->class_id = PCI_CLASS_SYSTEM_OTHER;
dc->reset = i6300esb_reset;
dc->vmsd = &vmstate_i6300esb;
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
set_bit(DEVICE_CATEGORY_WATCHDOG, dc->categories);
dc->desc = "Intel 6300ESB";
}
static const TypeInfo i6300esb_info = {
+2 -1
View File
@@ -140,7 +140,8 @@ static void wdt_ib700_class_init(ObjectClass *klass, void *data)
dc->realize = wdt_ib700_realize;
dc->reset = wdt_ib700_reset;
dc->vmsd = &vmstate_ib700;
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
set_bit(DEVICE_CATEGORY_WATCHDOG, dc->categories);
dc->desc = "iBASE 700";
}
static const TypeInfo wdt_ib700_info = {

Some files were not shown because too many files have changed in this diff Show More