Misc patches for 2019-05-15
The following changes since commit e329ad2ab72c43b56df88b34954c2c7d839bb373:
Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20190513' into staging (2019-05-14 10:08:47 +0100)
are available in the git repository at:
git://github.com/bonzini/qemu.git tags/for-upstream
for you to fetch changes up to 88f1090e9020057022ac04531ca87d25f67f57ca:
hw/net/ne2000: Extract the PCI device from the chipset common code (2019-05-15 11:56:54 +0200)
----------------------------------------------------------------
Mostly bugfixes and cleanups, the most important being "megasas: fix mapped frame size" from Peter Lieven. In addition, -realtime is marked as deprecated.
----------------------------------------------------------------
Chen Zhang via Qemu-devel (1):
hvf: Add missing break statement
Igor Mammedov (1):
roms: assert if max rom size is less than the used size
Laurent Vivier (5):
trace: only include trace-event-subdirs when they are needed
build: replace GENERATED_FILES by generated-files-y
configure: qemu-ga is only needed with softmmu targets
build: chardev is only needed for softmmu targets
build: don't build hardware objects with linux-user
Marc-André Lureau (1):
vl: fix -sandbox parsing crash when seccomp support is disabled
Paolo Bonzini (2):
mips-fulong2e: obey -vga none
sun4m: obey -vga none
Peter Lieven (1):
megasas: fix mapped frame size
Philippe Mathieu-Daudé (5):
vl: Add missing descriptions to the VGA adapters list hw/acpi/piix4: Move TYPE_PIIX4_PM to a public header hw/i386/acpi: Add object_resolve_type_unambiguous to improve modularity hw/i386/acpi: Assert a pointer is not null BEFORE using it hw/net/ne2000: Extract the PCI device from the chipset common code
Thomas Huth (3):
hw/input: Add a CONFIG_PS2 switch for the ps2.c file Declare -realtime as deprecated
hw/char: Move multi-serial devices into separate file
Vitaly Kuznetsov (1):
ioapic: allow buggy guests mishandling level-triggered interrupts to make progress
Wei Yang (1):
memory: correct the comment to DIRTY_MEMORY_MIGRATION
Makefile | 43 ++++---- Makefile.objs | 22 ++-- Makefile.target | 6 +- configure | 4 +- hw/acpi/piix4.c | 13 --- hw/char/Kconfig | 6 ++ hw/char/Makefile.objs | 1 + hw/char/serial-pci-multi.c | 208 ++++++++++++++++++++++++++++++++++++++ hw/char/serial-pci.c | 170 ------------------------------- hw/core/loader.c | 1 + hw/i386/acpi-build.c | 22 +++- hw/input/Kconfig | 5 + hw/input/Makefile.objs | 2 +- hw/intc/ioapic.c | 57 ++++++++++- hw/intc/trace-events | 1 + hw/isa/lpc_ich9.c | 11 -- hw/mips/mips_fulong2e.c | 10 +- hw/net/Kconfig | 7 +- hw/net/Makefile.objs | 3 +- hw/net/ne2000-pci.c | 132 ++++++++++++++++++++++++ hw/net/ne2000.c | 105 ------------------- hw/scsi/megasas.c | 2 +- hw/sparc/sun4m.c | 6 +- include/hw/acpi/piix4.h | 2 +- include/hw/i386/ich9.h | 2 - include/hw/i386/ioapic_internal.h | 3 + memory.c | 4 +- qemu-deprecated.texi | 5 + target/i386/hvf/hvf.c | 1 + target/s390x/Makefile.objs | 2 +- tests/Makefile.include | 116 ++++++++++----------- vl.c | 22 ++-- 32 files changed, 568 insertions(+), 426 deletions(-) create mode 100644 hw/char/serial-pci-multi.c create mode 100644 hw/net/ne2000-pci.c
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 02/21] roms: assert if max rom size is less than the used size
From: Igor Mammedov <[email protected]>
It would ensure that we would notice attempt to write beyond the allocated buffer. In case of MemoryRegion backed ROM it's the host buffer and the guest RAM otherwise.
assert can be triggered with:
dd if=/dev/zero of=/tmp/blob bs=63k count=1
qemu-system-x86_64 for i in {1..33}; do echo -n " -acpitable /tmp/blob"; done
Message-Id: <[email protected]>
--- hw/core/loader.c | 1 + 1 file changed, 1 insertion(+)
hw/core/loader.c +1 -0
@@ -1025,6 +1025,7 @@ MemoryRegion *rom_add_blob(const char *name, const void *blob, size_t len, rom->addr = addr; rom->romsize = max_len ? max_len : len; rom->datasize = len; +g_assert (rom->romsize >= rom->datasize); rom->data =g_malloc0 (rom->datasize);memcpy (rom->data, blob, len);rom_insert (rom);
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PULL 02/21] roms: assert if max rom size is less than the used size
Quoted 9 lines · Paolo Bonzini
From: Igor Mammedov <[email protected]>
It would ensure that we would notice attempt to write beyond the allocated buffer. In case of MemoryRegion backed ROM it's the host buffer and the guest RAM otherwise.
assert can be triggered with:
dd if=/dev/zero of=/tmp/blob bs=63k count=1
qemu-system-x86_64for i in {1..33}; do echo -n " -acpitable /tmp/blob"; done
Sorry, but a user should normally never be able to trigger an assert, even if passing lots of garbage to qemu via the command line. asserts are for guarding against programming errors.
Could you please change this into a proper error message instead?
Thanks,
Thomas
[Qemu-devel] [PULL 03/21] Declare -realtime as deprecated
In reply to Paolo BonziniFrom: Thomas Huth <[email protected]>
The old -realtime mlock=on|off parameter does exactly the same as the new -overcommit mem-lock=on|off parameter. Additionally, "-realtime" does not activate any additional "realtime" capabilities as the name might indicate. We should avoid to confuse the users this way, so let's deprecate the old -realtime option.
Message-Id: <[email protected]>
--- qemu-deprecated.texi | 5 +++++ vl.c | 2 ++ 2 files changed, 7 insertions(+)
qemu-deprecated.texi +5 -0
@@ -72,6 +72,11 @@ backend settings instead of environment variables. To ease migration to the new format, the ``-audiodev-help'' option can be used to convert the current values of the environment variables to ``-audiodev'' options. +@subsection -realtime (since 4.1) + +The @code{-realtime mlock=on|off} argument has been replaced by the +@code{-overcommit mem-lock=on|off} argument. + @section QEMU Machine Protocol (QMP) commands @subsection block-dirty-bitmap-add "autoload" parameter (since 2.12.0)
vl.c +2 -0
@@ -3927,6 +3927,8 @@ int main(int argc, char **argv, char **envp) }break ;case QEMU_OPTION_realtime: +warn_report ("'-realtime mlock=...' is deprecated, please use " +"'-overcommit mem-lock=...' instead" ); opts =qemu_opts_parse_noisily (qemu_find_opts ("realtime" ), optarg, false);if (!opts) {
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 05/21] megasas: fix mapped frame size
In reply to Paolo BonziniFrom: Peter Lieven <[email protected]>
the current value of 1024 bytes (16 * MFI_FRAME_SIZE) we map is not enough to hold the maximum number of scatter gather elements we advertise. We actually need a maximum of 2048 bytes. This is 128 max sg elements * 16 bytes (sizeof (union mfi_sgl)).
Message-Id: <[email protected]>
--- hw/scsi/megasas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/scsi/megasas.c +1 -1
@@ -477,7 +477,7 @@ static MegasasCmd *megasas_enqueue_frame(MegasasState *s, {PCIDevice *pcid =PCI_DEVICE (s);MegasasCmd *cmd =NULL ; -int frame_size =MFI_FRAME_SIZE *16 ; +int frame_size =MEGASAS_MAX_SGE *sizeof (union mfi_sgl );hwaddr frame_size_p = frame_size;unsigned long index;
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 01/21] hw/input: Add a CONFIG_PS2 switch for the ps2.c file
In reply to Paolo BonziniFrom: Thomas Huth <[email protected]>
ps2.c only needs to be compiled if we are building pckbd.c or pl050.c.
Message-Id: <[email protected]>
--- hw/input/Kconfig | 5 +++++ hw/input/Makefile.objs | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-)
hw/input/Kconfig +5 -0
@@ -8,10 +8,15 @@ config LM832X config PCKBD bool default y + select PS2 depends on ISA_BUS config PL050 bool + select PS2 + +config PS2 + bool config STELLARIS_INPUT bool
hw/input/Makefile.objs +1 -1
@@ -3,7 +3,7 @@ common-obj-y += hid.o common-obj-$(CONFIG_LM832X) += lm832x.o common-obj-$(CONFIG_PCKBD) += pckbd.o common-obj-$(CONFIG_PL050) += pl050.o -common-obj-y += ps2.o +common-obj-$(CONFIG_PS2) += ps2.o common-obj-$(CONFIG_STELLARIS_INPUT) += stellaris_input.o common-obj-$(CONFIG_TSC2005) += tsc2005.o
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 06/21] hvf: Add missing break statement
In reply to Paolo BonziniFrom: Chen Zhang via Qemu-devel <[email protected]>
In target/i386/hvf/hvf.c, a break statement was probably missing in hvf_vcpu_exec(), in handling EXIT_REASON_HLT.
These lines seemed to be equivalent to kvm_handle_halt().
Message-Id: <[email protected]>
--- target/i386/hvf/hvf.c | 1 + 1 file changed, 1 insertion(+)
target/i386/hvf/hvf.c +1 -0
@@ -708,6 +708,7 @@ int hvf_vcpu_exec(CPUState *cpu) !(idtvec_info & VMCS_IDT_VEC_VALID)) { cpu->halted =1 ; ret =EXCP_HLT ; +break ; } ret =EXCP_INTERRUPT ;break ;
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 07/21] vl: fix -sandbox parsing crash when seccomp support is disabled
In reply to Paolo BonziniFrom: Marc-André Lureau <[email protected]>
$ ./x86_64-softmmu/qemu-system-x86_64 -sandbox off qemu-system-x86_64: -sandbox off: There is no option group 'sandbox' Segmentation fault
Commit 5780760f5e ("seccomp: check TSYNC host capability") wrapped one use of the sandbox option group to produce a sensible error, it didn't do the same for another call to qemu_opts_parse_noisily():
(gdb) bt
at util/qemu-option.c:829
#0 0x00000000105b36d8 in opts_parse (list=0x0, params=0x3ffffffffab5 "off", permit_abbrev=true, defaults=false, errp=0x3ffffffff080)
at util/qemu-option.c:829
#1 0x00000000105b3b74 in qemu_opts_parse_noisily (list=<optimized out>, params=<optimized out>, permit_abbrev=<optimized out>) at util/qemu-option.c:890
#2 0x0000000010024964 in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at vl.c:3589Message-Id: <[email protected]>
--- vl.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
vl.c +10 -8
@@ -3896,17 +3896,19 @@ int main(int argc, char **argv, char **envp) qtest_log = optarg;break ;case QEMU_OPTION_sandbox: -#ifdef CONFIG_SECCOMP - opts =qemu_opts_parse_noisily (qemu_find_opts ("sandbox" ), - optarg, true); + olist =qemu_find_opts ("sandbox" ); +if (!olist) { +#ifndef CONFIG_SECCOMP +error_report ("-sandbox support is not enabled " +"in this QEMU binary" ); +#endif +exit (1 ); + } + + opts =qemu_opts_parse_noisily (olist, optarg, true);if (!opts) {exit (1 ); } -#else -error_report ("-sandbox support is not enabled " -"in this QEMU binary" ); -exit (1 ); -#endif break ;case QEMU_OPTION_add_fd:#ifndef _WIN32
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 09/21] hw/acpi/piix4: Move TYPE_PIIX4_PM to a public header
In reply to Paolo BonziniFrom: Philippe Mathieu-Daudé <[email protected]>
Move the TYPE_PIIX4_PM definition to the corresponding header, so other files can use it.
Message-Id: <[email protected]>
--- hw/acpi/piix4.c | 2 -- include/hw/acpi/piix4.h | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-)
hw/acpi/piix4.c +0 -2
@@ -92,8 +92,6 @@ typedef struct PIIX4PMState {MemHotplugState acpi_memory_hotplug; } PIIX4PMState; -#define TYPE_PIIX4_PM "PIIX4_PM" -#define PIIX4_PM (obj) \ OBJECT_CHECK(PIIX4PMState, (obj), TYPE_PIIX4_PM)
include/hw/acpi/piix4.h +2 -0
@@ -1,6 +1,8 @@#ifndef HW_ACPI_PIIX4_H #define HW_ACPI_PIIX4_H +#define TYPE_PIIX4_PM "PIIX4_PM" +Object *piix4_pm_find (void );#endif
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 04/21] vl: Add missing descriptions to the VGA adapters list
In reply to Paolo BonziniFrom: Philippe Mathieu-Daudé <[email protected]>
Some VGA adapters do not contain an helpful description, this can be confusing:
$ qemu-system-arm -M virt -vga help none std standard VGA cirrus Cirrus VGA (default) vmware VMWare SVGA xenfb
Add a description to the missing adapters:
$ qemu-system-arm -M virt -vga help none no graphic card std standard VGA cirrus Cirrus VGA (default) vmware VMWare SVGA xenfb Xen paravirtualized framebuffer
Based-on: <[email protected]>
Message-Id: <[email protected]>
--- vl.c | 2 ++ 1 file changed, 2 insertions(+)
vl.c +2 -0
@@ -2018,6 +2018,7 @@ typedef struct VGAInterfaceInfo {static const VGAInterfaceInfo vga_interfaces[VGA_TYPE_MAX ] = { [VGA_NONE ] = { .opt_name ="none" , + .name ="no graphic card" , }, [VGA_STD ] = { .opt_name ="std" ,
@@ -2056,6 +2057,7 @@ static const VGAInterfaceInfo vga_interfaces[VGA_TYPE_MAX] = { }, [VGA_XENFB ] = { .opt_name ="xenfb" , + .name ="Xen paravirtualized framebuffer" , }, };
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 10/21] hw/i386/acpi: Add object_resolve_type_unambiguous to improve modularity
In reply to Paolo BonziniFrom: Philippe Mathieu-Daudé <[email protected]>
When building with CONFIG_Q35=n, we get:
LINK x86_64-softmmu/qemu-system-x86_64
/usr/bin/ld: hw/i386/acpi-build.o: in function `acpi_get_misc_info':
/source/qemu/hw/i386/acpi-build.c:243: undefined reference to `ich9_lpc_find'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:204: qemu-system-x86_64] Error 1
This is due to a dependency in acpi-build.c on the ICH9_LPC (via ich9_lpc_find) and PIIX4_PM (via piix4_pm_find) devices.
To allow better modularity (compile acpi-build.c with only Q35/ICH9 or ISAPC/PIIX4), refactor the similar helper as object_resolve_type_unambiguous(). This way we relax the linker dependencies and can build the x86 targets with a selection of machines (instead of all of them).
Message-Id: <[email protected]>
--- hw/acpi/piix4.c | 11 ----------- hw/i386/acpi-build.c | 20 ++++++++++++++++---- hw/isa/lpc_ich9.c | 11 ----------- include/hw/acpi/piix4.h | 2 -- include/hw/i386/ich9.h | 2 -- 5 files changed, 16 insertions(+), 30 deletions(-)
hw/acpi/piix4.c +0 -11
@@ -552,17 +552,6 @@ static void piix4_pm_realize(PCIDevice *dev, Error **errp)piix4_pm_add_propeties (s); } -Object *piix4_pm_find (void ) -{ -bool ambig; -Object *o =object_resolve_path_type ("" ,TYPE_PIIX4_PM , &ambig); - -if (ambig || !o) { -return NULL ; - } -return o; -} -I2CBus *piix4_pm_init (PCIBus *bus,int devfn,uint32_t smb_io_base,qemu_irq sci_irq,qemu_irq smi_irq,int smm_enabled,DeviceState **piix4_pm)
hw/i386/acpi-build.c +16 -4
@@ -35,6 +35,7 @@#include "hw/acpi/acpi-defs.h" #include "hw/acpi/acpi.h" #include "hw/acpi/cpu.h" +#include "hw/acpi/piix4.h" #include "hw/nvram/fw_cfg.h" #include "hw/acpi/bios-linker-loader.h" #include "hw/loader.h"
@@ -164,10 +165,21 @@ static void init_common_fadt_data(Object *o, AcpiFadtData *data) *data = fadt; } +static Object *object_resolve_type_unambiguous (const char *typename) +{ +bool ambig; +Object *o =object_resolve_path_type ("" , typename, &ambig); + +if (ambig || !o) { +return NULL ; + } +return o; +} +static void acpi_get_pm_info (AcpiPmInfo *pm) { -Object *piix =piix4_pm_find (); -Object *lpc =ich9_lpc_find (); +Object *piix =object_resolve_type_unambiguous (TYPE_PIIX4_PM ); +Object *lpc =object_resolve_type_unambiguous (TYPE_ICH9_LPC_DEVICE );Object *obj = piix ? piix : lpc;QObject *o; pm->cpu_hp_io_base =0 ;
@@ -228,8 +240,8 @@ static void acpi_get_pm_info(AcpiPmInfo *pm)static void acpi_get_misc_info (AcpiMiscInfo *info) { -Object *piix =piix4_pm_find (); -Object *lpc =ich9_lpc_find (); +Object *piix =object_resolve_type_unambiguous (TYPE_PIIX4_PM ); +Object *lpc =object_resolve_type_unambiguous (TYPE_ICH9_LPC_DEVICE );assert (!!piix != !!lpc);if (piix) {
hw/isa/lpc_ich9.c +0 -11
@@ -624,17 +624,6 @@ static const MemoryRegionOps ich9_rst_cnt_ops = { .endianness = DEVICE_LITTLE_ENDIAN }; -Object *ich9_lpc_find (void ) -{ -bool ambig; -Object *o =object_resolve_path_type ("" ,TYPE_ICH9_LPC_DEVICE , &ambig); - -if (ambig) { -return NULL ; - } -return o; -} -static void ich9_lpc_get_sci_int (Object *obj,Visitor *v,const char *name,void *opaque,Error **errp) {
include/hw/acpi/piix4.h +0 -2
@@ -3,6 +3,4 @@#define TYPE_PIIX4_PM "PIIX4_PM" -Object *piix4_pm_find (void ); -#endif
include/hw/i386/ich9.h +0 -2
@@ -81,8 +81,6 @@ typedef struct ICH9LPCState {qemu_irq gsi[GSI_NUM_PINS ]; } ICH9LPCState; -Object *ich9_lpc_find (void ); -#define Q35_MASK (bit, ms_bit, ls_bit) \ ((uint##bit##_t)(((1ULL << ((ms_bit) + 1)) - 1) & ~((1ULL << ls_bit) - 1)))
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 11/21] hw/i386/acpi: Assert a pointer is not null BEFORE using it
In reply to Paolo BonziniFrom: Philippe Mathieu-Daudé <[email protected]>
Commit 72c194f7e75c added a non-null check on the 'obj' pointer. Later, commit 500b11ea5095 added code which uses the 'obj' pointer _before_ the assertion check. Move the assertion _before_ the pointer use.
Message-Id: <[email protected]>
--- hw/i386/acpi-build.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/acpi-build.c +1 -1
@@ -186,6 +186,7 @@ static void acpi_get_pm_info(AcpiPmInfo *pm) pm->pcihp_io_base =0 ; pm->pcihp_io_len =0 ; +assert (obj);init_common_fadt_data (obj, &pm->fadt);if (piix) {/* w2k requires FADT(rev1) or it won't boot, keep PC compatible */
@@ -204,7 +205,6 @@ static void acpi_get_pm_info(AcpiPmInfo *pm) pm->fadt.flags |=1 <<ACPI_FADT_F_RESET_REG_SUP ; pm->cpu_hp_io_base =ICH9_CPU_HOTPLUG_IO_BASE ; } -assert (obj);/* The above need not be conditional on machine type because the reset port * happens to be the same on PIIX (pc) and ICH9 (q35). */
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 13/21] sun4m: obey -vga none
In reply to Paolo BonziniDo not create a TCX if "-vga none" was passed on the command line. Remove some dead code along the way to avoid big reindentation.
--- hw/sparc/sun4m.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
hw/sparc/sun4m.c +2 -4
@@ -850,7 +850,6 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,uint32_t initrd_size;DriveInfo *fd[MAX_FD ];FWCfgState *fw_cfg; -unsigned int num_vsimms;DeviceState *dev;SysBusDevice *s;
@@ -909,8 +908,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,error_report ("Unsupported depth: %d" , graphic_depth);exit (1 ); } - num_vsimms =0 ; -if (num_vsimms ==0 ) { +if (vga_interface_type !=VGA_NONE ) {if (vga_interface_type ==VGA_CG3 ) {if (graphic_depth !=8 ) {error_report ("Unsupported depth: %d" , graphic_depth);
@@ -945,7 +943,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, } } -for (i = num_vsimms; i <MAX_VSIMMS ; i++) { +for (i =0 ; i <MAX_VSIMMS ; i++) {/* vsimm registers probed by OBP */ if (hwdef->vsimm[i].reg_base) {empty_slot_init (hwdef->vsimm[i].reg_base,0x2000 );
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 08/21] memory: correct the comment to DIRTY_MEMORY_MIGRATION
In reply to Paolo BonziniFrom: Wei Yang <[email protected]>
The dirty bit is DIRTY_MEMORY_MIGRATION. Correct the comment.
Message-Id: <[email protected]>
--- memory.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
memory.c +2 -2
@@ -2584,7 +2584,7 @@ void memory_global_dirty_log_start(void)MEMORY_LISTENER_CALL_GLOBAL (log_global_start, Forward); -/* Refresh DIRTY_LOG_MIGRATION bit. */ +/* Refresh DIRTY_MEMORY_MIGRATION bit. */ memory_region_transaction_begin (); memory_region_update_pending = true;memory_region_transaction_commit ();
@@ -2594,7 +2594,7 @@ static void memory_global_dirty_log_do_stop(void) { global_dirty_log = false; -/* Refresh DIRTY_LOG_MIGRATION bit. */ +/* Refresh DIRTY_MEMORY_MIGRATION bit. */ memory_region_transaction_begin (); memory_region_update_pending = true;memory_region_transaction_commit ();
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 12/21] mips-fulong2e: obey -vga none
In reply to Paolo BonziniDo not create an ATI VGA if "-vga none" was passed on the command line.
--- hw/mips/mips_fulong2e.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
hw/mips/mips_fulong2e.c +6 -4
@@ -349,10 +349,12 @@ static void mips_fulong2e_init(MachineState *machine) &smbus, &isa_bus);/* GPU */ - dev =DEVICE (pci_create (pci_bus,-1 ,"ati-vga" )); -qdev_prop_set_uint32 (dev,"vgamem_mb" ,16 ); -qdev_prop_set_uint16 (dev,"x-device-id" ,0x5159 ); -qdev_init_nofail (dev); +if (vga_interface_type !=VGA_NONE ) { + dev =DEVICE (pci_create (pci_bus,-1 ,"ati-vga" )); +qdev_prop_set_uint32 (dev,"vgamem_mb" ,16 ); +qdev_prop_set_uint16 (dev,"x-device-id" ,0x5159 ); +qdev_init_nofail (dev); + }/* Populate SPD eeprom data */ spd_data =spd_data_generate (DDR , ram_size, &err);
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 14/21] trace: only include trace-event-subdirs when they are needed
In reply to Paolo BonziniFrom: Laurent Vivier <[email protected]>
Some directories are built only for softmmu targets, and the related trace-event-subdirs must do the same
Message-Id: <[email protected]>
--- Makefile.objs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
Makefile.objs +7 -5
@@ -127,11 +127,12 @@ rdmacm-mux-obj-y = contrib/rdmacm-mux/ trace-events-subdirs = trace-events-subdirs += accel/kvm trace-events-subdirs += accel/tcg -trace-events-subdirs += audio trace-events-subdirs += authz trace-events-subdirs += block trace-events-subdirs += chardev trace-events-subdirs += crypto +ifeq ($(CONFIG_SOFTMMU),y) +trace-events-subdirs += audio trace-events-subdirs += hw/9pfs trace-events-subdirs += hw/acpi trace-events-subdirs += hw/alpha
@@ -140,7 +141,6 @@ trace-events-subdirs += hw/audio trace-events-subdirs += hw/block trace-events-subdirs += hw/block/dataplane trace-events-subdirs += hw/char -trace-events-subdirs += hw/display trace-events-subdirs += hw/dma trace-events-subdirs += hw/hppa trace-events-subdirs += hw/i2c
@@ -173,11 +173,14 @@ trace-events-subdirs += hw/virtio trace-events-subdirs += hw/watchdog trace-events-subdirs += hw/xen trace-events-subdirs += hw/gpio +trace-events-subdirs += migration +trace-events-subdirs += net +trace-events-subdirs += ui +endif +trace-events-subdirs += hw/display trace-events-subdirs += io trace-events-subdirs += linux-user -trace-events-subdirs += migration trace-events-subdirs += nbd -trace-events-subdirs += net trace-events-subdirs += qapi trace-events-subdirs += qom trace-events-subdirs += scsi
@@ -189,7 +192,6 @@ trace-events-subdirs += target/ppc trace-events-subdirs += target/riscv trace-events-subdirs += target/s390x trace-events-subdirs += target/sparc -trace-events-subdirs += ui trace-events-subdirs += util trace-events-files = $(SRC_PATH)/trace-events $(trace-events-subdirs:%=$(SRC_PATH)/%/trace-events)
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 18/21] build: don't build hardware objects with linux-user
In reply to Paolo BonziniFrom: Laurent Vivier <[email protected]>
Some objects are only needed for system emulation and tools. We can ignore them for the user mode case
Update tests to run accordingly: conditionally build some tests on CONFIG_BLOCK.
Some tests use components that are only built when softmmu or block tools are enabled, not for linux-user. So, if these components are not available, disable the tests.
Message-Id: <[email protected]>
--- Makefile | 4 +++ Makefile.objs | 14 +++++--- tests/Makefile.include | 90 +++++++++++++++++++++++++------------------------- 3 files changed, 58 insertions(+), 50 deletions(-)
Makefile +4 -0
@@ -87,6 +87,10 @@ endif include $(SRC_PATH)/rules.mak +# notempy and lor are defined in rules.mak +CONFIG_TOOLS := $(call notempty,$(TOOLS)) +CONFIG_BLOCK := $(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS)) + # Create QEMU_PKGVERSION and FULL_VERSION strings # If PKGVERSION is set, use that; otherwise get version and -dirty status from git QEMU_PKGVERSION := $(if $(PKGVERSION),$(PKGVERSION),$(shell \
Makefile.objs +9 -5
@@ -127,9 +127,17 @@ rdmacm-mux-obj-y = contrib/rdmacm-mux/ trace-events-subdirs = trace-events-subdirs += accel/kvm trace-events-subdirs += accel/tcg +trace-events-subdirs += crypto +ifeq ($(CONFIG_USER_ONLY),y) +trace-events-subdirs += linux-user +endif +ifeq ($(CONFIG_BLOCK),y) trace-events-subdirs += authz trace-events-subdirs += block -trace-events-subdirs += crypto +trace-events-subdirs += io +trace-events-subdirs += nbd +trace-events-subdirs += scsi +endif ifeq ($(CONFIG_SOFTMMU),y) trace-events-subdirs += chardev trace-events-subdirs += audio
@@ -178,12 +186,8 @@ trace-events-subdirs += net trace-events-subdirs += ui endif trace-events-subdirs += hw/display -trace-events-subdirs += io -trace-events-subdirs += linux-user -trace-events-subdirs += nbd trace-events-subdirs += qapi trace-events-subdirs += qom -trace-events-subdirs += scsi trace-events-subdirs += target/arm trace-events-subdirs += target/hppa trace-events-subdirs += target/i386
tests/Makefile.include +45 -45
124 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PULL 18/21] build: don't build hardware objects with linux-user
Quoted 25 lines · Paolo Bonzini
From: Laurent Vivier <[email protected]>
Some objects are only needed for system emulation and tools. We can ignore them for the user mode case
Update tests to run accordingly: conditionally build some tests on
CONFIG_BLOCK.Some tests use components that are only built when softmmu or block tools are enabled, not for linux-user. So, if these components are not available, disable the tests.
Signed-off-by Laurent Vivier <[email protected]>Message-Id: <[email protected]>
--- Makefile | 4 +++ Makefile.objs | 14 +++++--- tests/Makefile.include | 90 +++++++++++++++++++++++++------------------------- 3 files changed, 58 insertions(+), 50 deletions(-)Makefile +0
-0
Makefile endif · line 92
Quoted 6 lines
Makefile +3
-0@@ -87,6 +87,10 @@ endif include $(SRC_PATH)/rules.mak +# notempy and lor are defined in rules.mak +CONFIG_TOOLS := $(call notempty,$(TOOLS)) +CONFIG_BLOCK := $(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS))
IMHO calling this CONFIG_BLOCK is a really poor choice, as the decision is completely unrelated to block modules. It made really confused when trying to understand why all the crypto or auth code had been made conditional on the block drivers. The block code is just one part of QEMU that is used in tools & softmmu.
It would be better as CONFIG_SOFTMMU_TOOLS, or CONFIG_NOT_USER, or something else.
Quoted 165 lines
Makefile +9
-5+trace-events-subdirs += crypto +ifeq ($(CONFIG_USER_ONLY),y) +trace-events-subdirs += linux-user +endif +ifeq ($(CONFIG_BLOCK),y) trace-events-subdirs += authz trace-events-subdirs += block -trace-events-subdirs += crypto +trace-events-subdirs += io +trace-events-subdirs += nbd +trace-events-subdirs += scsi +endif ifeq ($(CONFIG_SOFTMMU),y) trace-events-subdirs += chardev trace-events-subdirs += audio@@ -178,12 +186,8 @@ trace-events-subdirs += net trace-events-subdirs += ui endif trace-events-subdirs += hw/display -trace-events-subdirs += io -trace-events-subdirs += linux-user -trace-events-subdirs += nbd trace-events-subdirs += qapi trace-events-subdirs += qom -trace-events-subdirs += scsi trace-events-subdirs += target/arm trace-events-subdirs += target/hppa trace-events-subdirs += target/i386tests/Makefile.include +45
-45@@ -45,7 +45,7 @@ SYSEMU_TARGET_LIST := $(subst -softmmu.mak,,$(notdir \ check-unit-y += tests/check-qdict$(EXESUF) check-unit-y += tests/check-block-qdict$(EXESUF) -check-unit-y += tests/test-char$(EXESUF) +check-unit-$(CONFIG_SOFTMMU) += tests/test-char$(EXESUF) check-unit-y += tests/check-qnum$(EXESUF) check-unit-y += tests/check-qstring$(EXESUF) check-unit-y += tests/check-qlist$(EXESUF)@@ -61,21 +61,21 @@ check-unit-y += tests/test-string-input-visitor$(EXESUF) check-unit-y += tests/test-string-output-visitor$(EXESUF) check-unit-y += tests/test-qmp-event$(EXESUF) check-unit-y += tests/test-opts-visitor$(EXESUF) -check-unit-y += tests/test-coroutine$(EXESUF) +check-unit-$(CONFIG_BLOCK) += tests/test-coroutine$(EXESUF) check-unit-y += tests/test-visitor-serialization$(EXESUF) check-unit-y += tests/test-iov$(EXESUF) -check-unit-y += tests/test-aio$(EXESUF) -check-unit-y += tests/test-aio-multithread$(EXESUF) -check-unit-y += tests/test-throttle$(EXESUF) -check-unit-y += tests/test-thread-pool$(EXESUF) -check-unit-y += tests/test-hbitmap$(EXESUF) -check-unit-y += tests/test-bdrv-drain$(EXESUF) -check-unit-y += tests/test-bdrv-graph-mod$(EXESUF) -check-unit-y += tests/test-blockjob$(EXESUF) -check-unit-y += tests/test-blockjob-txn$(EXESUF) -check-unit-y += tests/test-block-backend$(EXESUF) -check-unit-y += tests/test-block-iothread$(EXESUF) -check-unit-y += tests/test-image-locking$(EXESUF) +check-unit-$(CONFIG_BLOCK) += tests/test-aio$(EXESUF) +check-unit-$(CONFIG_BLOCK) += tests/test-aio-multithread$(EXESUF) +check-unit-$(CONFIG_BLOCK) += tests/test-throttle$(EXESUF) +check-unit-$(CONFIG_BLOCK) += tests/test-thread-pool$(EXESUF) +check-unit-$(CONFIG_BLOCK) += tests/test-hbitmap$(EXESUF) +check-unit-$(CONFIG_BLOCK) += tests/test-bdrv-drain$(EXESUF) +check-unit-$(CONFIG_BLOCK) += tests/test-bdrv-graph-mod$(EXESUF) +check-unit-$(CONFIG_BLOCK) += tests/test-blockjob$(EXESUF) +check-unit-$(CONFIG_BLOCK) += tests/test-blockjob-txn$(EXESUF) +check-unit-$(CONFIG_BLOCK) += tests/test-block-backend$(EXESUF) +check-unit-$(CONFIG_BLOCK) += tests/test-block-iothread$(EXESUF) +check-unit-$(CONFIG_BLOCK) += tests/test-image-locking$(EXESUF) check-unit-y += tests/test-x86-cpuid$(EXESUF) # all code tested by test-x86-cpuid is inside topology.h ifeq ($(CONFIG_SOFTMMU),y)@@ -101,40 +101,40 @@ check-unit-y += tests/check-qom-interface$(EXESUF) check-unit-y += tests/check-qom-proplist$(EXESUF) check-unit-y += tests/test-qemu-opts$(EXESUF) check-unit-y += tests/test-keyval$(EXESUF) -check-unit-y += tests/test-write-threshold$(EXESUF) -check-unit-y += tests/test-crypto-hash$(EXESUF) -check-speed-y += tests/benchmark-crypto-hash$(EXESUF) -check-unit-y += tests/test-crypto-hmac$(EXESUF) -check-speed-y += tests/benchmark-crypto-hmac$(EXESUF) -check-unit-y += tests/test-crypto-cipher$(EXESUF) -check-speed-y += tests/benchmark-crypto-cipher$(EXESUF) -check-unit-y += tests/test-crypto-secret$(EXESUF) -check-unit-$(CONFIG_GNUTLS) += tests/test-crypto-tlscredsx509$(EXESUF) -check-unit-$(CONFIG_GNUTLS) += tests/test-crypto-tlssession$(EXESUF) +check-unit-$(CONFIG_BLOCK) += tests/test-write-threshold$(EXESUF) +check-unit-$(CONFIG_BLOCK) += tests/test-crypto-hash$(EXESUF) +check-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-hash$(EXESUF) +check-unit-$(CONFIG_BLOCK) += tests/test-crypto-hmac$(EXESUF) +check-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-hmac$(EXESUF) +check-unit-$(CONFIG_BLOCK) += tests/test-crypto-cipher$(EXESUF) +check-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-cipher$(EXESUF) +check-unit-$(CONFIG_BLOCK) += tests/test-crypto-secret$(EXESUF) +check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_GNUTLS)) += tests/test-crypto-tlscredsx509$(EXESUF) +check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_GNUTLS)) += tests/test-crypto-tlssession$(EXESUF) ifneq (,$(findstring qemu-ga,$(TOOLS))) check-unit-$(call land,$(CONFIG_LINUX),$(CONFIG_VIRTIO_SERIAL)) += tests/test-qga$(EXESUF) endif check-unit-y += tests/test-timed-average$(EXESUF) check-unit-$(CONFIG_INOTIFY1) += tests/test-util-filemonitor$(EXESUF) check-unit-y += tests/test-util-sockets$(EXESUF) -check-unit-y += tests/test-authz-simple$(EXESUF) -check-unit-y += tests/test-authz-list$(EXESUF) -check-unit-y += tests/test-authz-listfile$(EXESUF) -check-unit-$(CONFIG_AUTH_PAM) += tests/test-authz-pam$(EXESUF) -check-unit-y += tests/test-io-task$(EXESUF) -check-unit-y += tests/test-io-channel-socket$(EXESUF) -check-unit-y += tests/test-io-channel-file$(EXESUF) -check-unit-$(CONFIG_GNUTLS) += tests/test-io-channel-tls$(EXESUF) -check-unit-y += tests/test-io-channel-command$(EXESUF) -check-unit-y += tests/test-io-channel-buffer$(EXESUF) +check-unit-$(CONFIG_BLOCK) += tests/test-authz-simple$(EXESUF) +check-unit-$(CONFIG_BLOCK) += tests/test-authz-list$(EXESUF) +check-unit-$(CONFIG_BLOCK) += tests/test-authz-listfile$(EXESUF) +check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_AUTH_PAM)) += tests/test-authz-pam$(EXESUF) +check-unit-$(CONFIG_BLOCK) += tests/test-io-task$(EXESUF) +check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-socket$(EXESUF) +check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-file$(EXESUF) +check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_GNUTLS)) += tests/test-io-channel-tls$(EXESUF) +check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-command$(EXESUF) +check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-buffer$(EXESUF) check-unit-y += tests/test-base64$(EXESUF) -check-unit-$(if $(CONFIG_NETTLE),y,$(CONFIG_GCRYPT)) += tests/test-crypto-pbkdf$(EXESUF) -check-unit-y += tests/test-crypto-ivgen$(EXESUF) -check-unit-y += tests/test-crypto-afsplit$(EXESUF) -check-unit-y += tests/test-crypto-xts$(EXESUF) -check-unit-y += tests/test-crypto-block$(EXESUF) +check-unit-$(call land,$(CONFIG_BLOCK),$(if $(CONFIG_NETTLE),y,$(CONFIG_GCRYPT))) += tests/test-crypto-pbkdf$(EXESUF) +check-unit-$(CONFIG_BLOCK) += tests/test-crypto-ivgen$(EXESUF) +check-unit-$(CONFIG_BLOCK) += tests/test-crypto-afsplit$(EXESUF) +check-unit-$(CONFIG_BLOCK) += tests/test-crypto-xts$(EXESUF) +check-unit-$(CONFIG_BLOCK) += tests/test-crypto-block$(EXESUF) check-unit-y += tests/test-logging$(EXESUF) -check-unit-$(CONFIG_REPLICATION) += tests/test-replication$(EXESUF) +check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_REPLICATION)) += tests/test-replication$(EXESUF) check-unit-y += tests/test-bufferiszero$(EXESUF) check-unit-y += tests/test-uuid$(EXESUF) check-unit-y += tests/ptimer-test$(EXESUF)@@ -496,11 +496,11 @@ test-qapi-obj-y = tests/test-qapi-types.o \ tests/test-qapi-visit-sub-sub-module.o \ tests/test-qapi-introspect.o \ $(test-qom-obj-y) -benchmark-crypto-obj-y = $(authz-obj-y) $(crypto-obj-y) $(test-qom-obj-y) -test-crypto-obj-y = $(authz-obj-y) $(crypto-obj-y) $(test-qom-obj-y) -test-io-obj-y = $(io-obj-y) $(test-crypto-obj-y) -test-authz-obj-y = $(test-qom-obj-y) $(authz-obj-y) -test-block-obj-y = $(block-obj-y) $(test-io-obj-y) tests/iothread.o +benchmark-crypto-obj-$(CONFIG_BLOCK) = $(authz-obj-y) $(crypto-obj-y) $(test-qom-obj-y) +test-crypto-obj-$(CONFIG_BLOCK) = $(authz-obj-y) $(crypto-obj-y) $(test-qom-obj-y) +test-io-obj-$(CONFIG_BLOCK) = $(io-obj-y) $(test-crypto-obj-y) +test-authz-obj-$(CONFIG_BLOCK) = $(test-qom-obj-y) $(authz-obj-y) +test-block-obj-$(CONFIG_BLOCK) = $(block-obj-y) $(test-io-obj-y) tests/iothread.o tests/check-qnum$(EXESUF): tests/check-qnum.o $(test-util-obj-y) tests/check-qstring$(EXESUF): tests/check-qstring.o $(test-util-obj-y)Signature · 1 line
1.8.3.1
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [Qemu-devel] [PULL 18/21] build: don't build hardware objects with linux-user
Quoted 40 lines · Daniel P. Berrangé
Quoted 25 lines · Paolo Bonzini
From: Laurent Vivier <[email protected]>
Some objects are only needed for system emulation and tools. We can ignore them for the user mode case
Update tests to run accordingly: conditionally build some tests on
CONFIG_BLOCK.Some tests use components that are only built when softmmu or block tools are enabled, not for linux-user. So, if these components are not available, disable the tests.
Signed-off-by Laurent Vivier <[email protected]>Message-Id: <[email protected]>
--- Makefile | 4 +++ Makefile.objs | 14 +++++--- tests/Makefile.include | 90 +++++++++++++++++++++++++------------------------- 3 files changed, 58 insertions(+), 50 deletions(-)Makefile +0
-0Makefile endif · line 92
Quoted 6 lines
Makefile +3
-0@@ -87,6 +87,10 @@ endif include $(SRC_PATH)/rules.mak +# notempy and lor are defined in rules.mak +CONFIG_TOOLS := $(call notempty,$(TOOLS)) +CONFIG_BLOCK := $(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS))IMHO calling this
CONFIG_BLOCKis a really poor choice, as the decision is completely unrelated to block modules. It made really confused when trying to understand why all the crypto or auth code had been made conditional on the block drivers. The block code is just one part of QEMU that is used in tools & softmmu.
Quoted 2 lines
It would be better as
CONFIG_SOFTMMU_TOOLS, orCONFIG_NOT_USER, or something else.
Do you think it's worth a patch to change the name?
Thanks,
Laurent
Re: [Qemu-devel] [PULL 18/21] build: don't build hardware objects with linux-user
Quoted 39 lines · Laurent Vivier
Quoted 38 lines · Daniel P. Berrangé
Quoted 25 lines · Paolo Bonzini
From: Laurent Vivier <[email protected]>
Some objects are only needed for system emulation and tools. We can ignore them for the user mode case
Update tests to run accordingly: conditionally build some tests on
CONFIG_BLOCK.Some tests use components that are only built when softmmu or block tools are enabled, not for linux-user. So, if these components are not available, disable the tests.
Signed-off-by Laurent Vivier <[email protected]>Message-Id: <[email protected]>
--- Makefile | 4 +++ Makefile.objs | 14 +++++--- tests/Makefile.include | 90 +++++++++++++++++++++++++------------------------- 3 files changed, 58 insertions(+), 50 deletions(-)Makefile +0
-0Makefile endif · line 90
Quoted 4 lines
Makefile +3
-0@@ -87,6 +87,10 @@ endif include $(SRC_PATH)/rules.mak +# notempy and lor are defined in rules.mak +CONFIG_TOOLS := $(call notempty,$(TOOLS)) +CONFIG_BLOCK := $(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS))IMHO calling this
CONFIG_BLOCKis a really poor choice, as the decision is completely unrelated to block modules. It made really confused when trying to understand why all the crypto or auth code had been made conditional on the block drivers. The block code is just one part of QEMU that is used in tools & softmmu.
Quoted 4 lines
Quoted 2 lines
It would be better as
CONFIG_SOFTMMU_TOOLS, orCONFIG_NOT_USER, or something else.Do you think it's worth a patch to change the name?
Personally I'd like to see a patch to give it a better name.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [Qemu-devel] [PULL 18/21] build: don't build hardware objects with linux-user
Quoted 40 lines · Daniel P. Berrangé
Quoted 39 lines · Laurent Vivier
Quoted 38 lines · Daniel P. Berrangé
Quoted 25 lines · Paolo Bonzini
From: Laurent Vivier <[email protected]>
Some objects are only needed for system emulation and tools. We can ignore them for the user mode case
Update tests to run accordingly: conditionally build some tests on
CONFIG_BLOCK.Some tests use components that are only built when softmmu or block tools are enabled, not for linux-user. So, if these components are not available, disable the tests.
Signed-off-by Laurent Vivier <[email protected]>Message-Id: <[email protected]>
--- Makefile | 4 +++ Makefile.objs | 14 +++++--- tests/Makefile.include | 90 +++++++++++++++++++++++++------------------------- 3 files changed, 58 insertions(+), 50 deletions(-)Makefile +0
-0Makefile endif · line 90
Quoted 4 lines
Makefile +3
-0@@ -87,6 +87,10 @@ endif include $(SRC_PATH)/rules.mak +# notempy and lor are defined in rules.mak +CONFIG_TOOLS := $(call notempty,$(TOOLS)) +CONFIG_BLOCK := $(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS))IMHO calling this
CONFIG_BLOCKis a really poor choice, as the decision is completely unrelated to block modules. It made really confused when trying to understand why all the crypto or auth code had been made conditional on the block drivers. The block code is just one part of QEMU that is used in tools & softmmu.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
It would be better as
CONFIG_SOFTMMU_TOOLS, orCONFIG_NOT_USER, or something else.Do you think it's worth a patch to change the name?
Personally I'd like to see a patch to give it a better name.
I'm wondering which name to use.
CONFIG_NOT_USER is not correct because the flag can be 'y' with CONFIG_USER_ONLY set. CONFIG_SOFTMMU_TOOLS is too fuzzy.
CONFIG_HW ?CONFIG_IO ?CONFIG_DEVICE ?
Thanks,
Laurent
Re: [Qemu-devel] [PULL 18/21] build: don't build hardware objects with linux-user
Quoted 51 lines · Laurent Vivier
Quoted 41 lines · Daniel P. Berrangé
Quoted 40 lines · Laurent Vivier
Quoted 39 lines · Daniel P. Berrangé
Quoted 27 lines · Paolo Bonzini
From: Laurent Vivier <[email protected]>
Some objects are only needed for system emulation and tools. We can ignore them for the user mode case
Update tests to run accordingly: conditionally build some tests on
CONFIG_BLOCK.Some tests use components that are only built when softmmu or block tools are enabled, not for linux-user. So, if these components are not available, disable the tests.
Signed-off-by Laurent Vivier <[email protected]>Message-Id: <[email protected]>
---
Makefile | 4 +++ Makefile.objs | 14 +++++--- tests/Makefile.include | 90
+++++++++++++++++++++++++-------------------------3 files changed, 58 insertions(+), 50 deletions(-)Makefile +0
-0@@ -87,6 +87,10 @@ endifinclude $(SRC_PATH)/rules.mak
Makefile endif · line 92
Quoted 3 lines
Makefile +3
-0+# notempy and lor are defined in rules.mak +CONFIG_TOOLS := $(call notempty,$(TOOLS)) +CONFIG_BLOCK := $(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS))IMHO calling this
CONFIG_BLOCKis a really poor choice, as the decision is completely unrelated to block modules. It made really confused when trying to understand why all the crypto or auth code had been made conditional on the block drivers. The block code is just one part of QEMU that is used in tools & softmmu.Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
It would be better as
CONFIG_SOFTMMU_TOOLS, orCONFIG_NOT_USER, or something else.Do you think it's worth a patch to change the name?
Personally I'd like to see a patch to give it a better name.
I'm wondering which name to use.
Quoted 7 lines
CONFIG_NOT_USERis not correct because the flag can be 'y' withCONFIG_USER_ONLYset.CONFIG_SOFTMMU_TOOLSis too fuzzy.
CONFIG_HW?CONFIG_IO?CONFIG_DEVICE?
CONFIG_MACHINE_HW?CONFIG_MACHINE_IO_HELPERS?CONFIG_AIO?
BTW looking at util/Makefile.objs there is various think you can skip for linux-user IMO.
Regards,
Phil.
[Qemu-devel] [PULL 19/21] ioapic: allow buggy guests mishandling level-triggered interrupts to make progress
In reply to Paolo BonziniFrom: Vitaly Kuznetsov <[email protected]>
It was found that Hyper-V 2016 on KVM in some configurations (q35 machine + piix4-usb-uhci) hangs on boot. Root-cause was that one of Hyper-V level-triggered interrupt handler performs EOI before fixing the cause of the interrupt. This results in IOAPIC keep re-raising the level-triggered interrupt after EOI because irq-line remains asserted.
Gory details: https://www.spinics.net/lists/kvm/msg184484.html
(the whole thread).
Turns out we were dealing with similar issues before; in-kernel IOAPIC implementation has commit 184564efae4d ("kvm: ioapic: conditionally delay irq delivery duringeoi broadcast") which describes a very similar issue.
Steal the idea from the above mentioned commit for IOAPIC implementation in QEMU. SUCCESSIVE_IRQ_MAX_COUNT, delay and the comment are borrowed as well.
Message-Id: <[email protected]>
--- hw/intc/ioapic.c | 57 +++++++++++++++++++++++++++++++++++---- hw/intc/trace-events | 1 + include/hw/i386/ioapic_internal.h | 3 +++ 3 files changed, 56 insertions(+), 5 deletions(-)
hw/intc/ioapic.c +52 -5
@@ -139,6 +139,15 @@ static void ioapic_service(IOAPICCommonState *s) } } +#define SUCCESSIVE_IRQ_MAX_COUNT 10000 + +static void delayed_ioapic_service_cb (void *opaque) +{ +IOAPICCommonState *s = opaque; + +ioapic_service (s); +} +static void ioapic_set_irq (void *opaque,int vector,int level) {IOAPICCommonState *s = opaque;
@@ -222,13 +231,39 @@ void ioapic_eoi_broadcast(int vector) }for (n =0 ; n <IOAPIC_NUM_PINS ; n++) { entry = s->ioredtbl[n]; -if ((entry &IOAPIC_LVT_REMOTE_IRR ) - && (entry &IOAPIC_VECTOR_MASK ) == vector) { -trace_ioapic_clear_remote_irr (n, vector); - s->ioredtbl[n] = entry & ~IOAPIC_LVT_REMOTE_IRR ; -if (!(entry &IOAPIC_LVT_MASKED ) && (s->irr & (1 << n))) { + +if ((entry &IOAPIC_VECTOR_MASK ) != vector || + ((entry >>IOAPIC_LVT_TRIGGER_MODE_SHIFT ) &1 ) !=IOAPIC_TRIGGER_LEVEL ) { +continue ; + } + +if (!(entry &IOAPIC_LVT_REMOTE_IRR )) { +continue ; + } + +trace_ioapic_clear_remote_irr (n, vector); + s->ioredtbl[n] = entry & ~IOAPIC_LVT_REMOTE_IRR ; + +if (!(entry &IOAPIC_LVT_MASKED ) && (s->irr & (1 << n))) { + ++s->irq_eoi[vector]; +if (s->irq_eoi[vector] >=SUCCESSIVE_IRQ_MAX_COUNT ) { +/* +* Real hardware does not deliver the interrupt immediately +* during eoi broadcast, and this lets a buggy guest make +* slow progress even if it does not correctly handle a +* level-triggered interrupt. Emulate this behavior if we +* detect an interrupt storm. +*/ + s->irq_eoi[vector] =0 ; +timer_mod_anticipate (s->delayed_ioapic_service_timer, +qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) + +NANOSECONDS_PER_SECOND /100 ); +trace_ioapic_eoi_delayed_reassert (vector); + }else {ioapic_service (s); } + }else { + s->irq_eoi[vector] =0 ; } } }
@@ -401,6 +436,9 @@ static void ioapic_realize(DeviceState *dev, Error **errp)memory_region_init_io (&s->io_memory,OBJECT (s), &ioapic_io_ops, s,"ioapic" ,0x1000 ); + s->delayed_ioapic_service_timer = +timer_new_ns (QEMU_CLOCK_VIRTUAL , delayed_ioapic_service_cb, s); +qdev_init_gpio_in (dev, ioapic_set_irq,IOAPIC_NUM_PINS ); ioapics[ioapic_no] = s;
@@ -408,6 +446,14 @@ static void ioapic_realize(DeviceState *dev, Error **errp)qemu_add_machine_init_done_notifier (&s->machine_done); } +static void ioapic_unrealize (DeviceState *dev,Error **errp) +{ +IOAPICCommonState *s =IOAPIC_COMMON (dev); + +timer_del (s->delayed_ioapic_service_timer); +timer_free (s->delayed_ioapic_service_timer); +} +static Property ioapic_properties[] = {DEFINE_PROP_UINT8 ("version" , IOAPICCommonState, version,IOAPIC_VER_DEF ),DEFINE_PROP_END_OF_LIST (),
@@ -419,6 +465,7 @@ static void ioapic_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass); k->realize = ioapic_realize; + k->unrealize = ioapic_unrealize;/* * If APIC is in kernel, we need to update the kernel cache after * migration, otherwise first 24 gsi routes will be invalid.
hw/intc/trace-events +1 -0
@@ -25,6 +25,7 @@ apic_mem_writel(uint64_t addr, uint32_t val) "0x%"PRIx64" = 0x%08x" ioapic_set_remote_irr(int n) "set remote irr for pin %d" ioapic_clear_remote_irr(int n, int vector) "clear remote irr for pin %d vector %d" ioapic_eoi_broadcast(int vector) "EOI broadcast for vector %d" +ioapic_eoi_delayed_reassert(int vector) "delayed reassert on EOI broadcast for vector %d" ioapic_mem_read(uint8_t addr, uint8_t regsel, uint8_t size, uint32_t val) "ioapic mem read addr 0x%"PRIx8" regsel: 0x%"PRIx8" size 0x%"PRIx8" retval 0x%"PRIx32 ioapic_mem_write(uint8_t addr, uint8_t regsel, uint8_t size, uint32_t val) "ioapic mem write addr 0x%"PRIx8" regsel: 0x%"PRIx8" size 0x%"PRIx8" val 0x%"PRIx32 ioapic_set_irq(int vector, int level) "vector: %d level: %d"
include/hw/i386/ioapic_internal.h +3 -0
@@ -96,6 +96,7 @@ typedef struct IOAPICCommonClass {SysBusDeviceClass parent_class;DeviceRealize realize; +DeviceUnrealize unrealize;void (*pre_save)(IOAPICCommonState *s);void (*post_load)(IOAPICCommonState *s); } IOAPICCommonClass;
@@ -111,6 +112,8 @@ struct IOAPICCommonState {uint8_t version;uint64_t irq_count[IOAPIC_NUM_PINS ];int irq_level[IOAPIC_NUM_PINS ]; +int irq_eoi[IOAPIC_NUM_PINS ]; +QEMUTimer *delayed_ioapic_service_timer; };void ioapic_reset_common (DeviceState *dev);
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PULL 19/21] ioapic: allow buggy guests mishandling level-triggered interrupts to make progress
Hi
Quoted 16 lines · Paolo Bonzini
From: Vitaly Kuznetsov <[email protected]>
It was found that Hyper-V 2016 on KVM in some configurations (q35 machine + piix4-usb-uhci) hangs on boot. Root-cause was that one of Hyper-V level-triggered interrupt handler performs EOI before fixing the cause of the interrupt. This results in IOAPIC keep re-raising the level-triggered interrupt after EOI because irq-line remains asserted.
Gory details: https://www.spinics.net/lists/kvm/msg184484.html
(the whole thread).Turns out we were dealing with similar issues before; in-kernel IOAPIC implementation has commit
184564efae4d("kvm: ioapic: conditionally delay irq delivery duringeoi broadcast") which describes a very similar issue.
Quoted 6 lines
Steal the idea from the above mentioned commit for IOAPIC implementation in QEMU.
SUCCESSIVE_IRQ_MAX_COUNT, delay and the comment are borrowed as well.Signed-off-by Vitaly Kuznetsov <[email protected]>Message-Id: <[email protected]>
Signed-off-by Paolo Bonzini <[email protected]>
After this commit, I get the following ASAN error when booting a VM:
/home/elmarco/src/qq/hw/intc/ioapic.c:266:27: runtime error: index 41 out of bounds for type 'int [24]'
=================================================================
==9761==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61b00000312c at pc 0x55e40b8f9e74 bp 0x7f269c1d32a0 sp 0x7f269c1d3290
WRITE of size 4 at 0x61b00000312c thread T4 (CPU 0/KVM)
#0 0x55e40b8f9e73 in ioapic_eoi_broadcast
/home/elmarco/src/qq/hw/intc/ioapic.c:266
#1 0x55e40bd3fa4e in kvm_arch_handle_exit
/home/elmarco/src/qq/target/i386/kvm.c:3644
#2 0x55e40b7d1fd7 in kvm_cpu_exec
/home/elmarco/src/qq/accel/kvm/kvm-all.c:2083
#3 0x55e40b6e435f in qemu_kvm_cpu_thread_fn /home/elmarco/src/qq/cpus.c:1282
#4 0x55e40ce9ba42 in qemu_thread_start
/home/elmarco/src/qq/util/qemu-thread-posix.c:502
#5 0x7f26ac3435a1 in start_thread (/lib64/libpthread.so.0+0x85a1)
#6 0x7f26ac270302 in __clone (/lib64/libc.so.6+0xfb302)Address 0x61b00000312c is a wild pointer.
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/elmarco/src/qq/hw/intc/ioapic.c:266 in ioapic_eoi_broadcast Shadow bytes around the buggy address:
0x0c367fff85d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c367fff85e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c367fff85f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c367fff8600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c367fff8610: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fa fa
=>0x0c367fff8620: fa fa fa fa fa[fa]fa fa fa fa fa fa fa fa fa fa
0x0c367fff8630: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c367fff8640: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c367fff8650: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c367fff8660: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c367fff8670: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
Shadow gap: cc
Thread T4 (CPU 0/KVM) created by T0 here:
#0 0x7f26af884965 in pthread_create (/lib64/libasan.so.5+0x3a965)
#1 0x55e40ce9be8b in qemu_thread_create
/home/elmarco/src/qq/util/qemu-thread-posix.c:539
#2 0x55e40b6ea347 in qemu_kvm_start_vcpu /home/elmarco/src/qq/cpus.c:2018
#3 0x55e40b6eb03b in qemu_init_vcpu /home/elmarco/src/qq/cpus.c:2084
#4 0x55e40bb52352 in x86_cpu_realizefn
/home/elmarco/src/qq/target/i386/cpu.c:5382
#5 0x55e40c017aed in device_set_realized
/home/elmarco/src/qq/hw/core/qdev.c:834
#6 0x55e40c95e703 in property_set_bool
/home/elmarco/src/qq/qom/object.c:2074
#7 0x55e40c959332 in object_property_set
/home/elmarco/src/qq/qom/object.c:1266
#8 0x55e40c961edb in object_property_set_qobject
/home/elmarco/src/qq/qom/qom-qobject.c:27
#9 0x55e40c959700 in object_property_set_bool
/home/elmarco/src/qq/qom/object.c:1332
#10 0x55e40ba831a3 in pc_new_cpu /home/elmarco/src/qq/hw/i386/pc.c:1531
#11 0x55e40ba838a0 in pc_cpus_init /home/elmarco/src/qq/hw/i386/pc.c:1579
#12 0x55e40ba9f394 in pc_q35_init /home/elmarco/src/qq/hw/i386/pc_q35.c:183
#13 0x55e40baa19ab in pc_init_v4_0 /home/elmarco/src/qq/hw/i386/pc_q35.c:385
#14 0x55e40c035aa7 in machine_run_board_init
/home/elmarco/src/qq/hw/core/machine.c:1033
#15 0x55e40bda59d8 in main /home/elmarco/src/qq/vl.c:4494
#16 0x7f26ac198f32 in __libc_start_main (/lib64/libc.so.6+0x23f32)I start investigating.
Quoted 142 lines
--- hw/intc/ioapic.c | 57 +++++++++++++++++++++++++++++++++++---- hw/intc/trace-events | 1 + include/hw/i386/ioapic_internal.h | 3 +++ 3 files changed, 56 insertions(+), 5 deletions(-)hw/intc/ioapic.c +52
-5@@ -139,6 +139,15 @@ static void ioapic_service(IOAPICCommonState *s) } } +#define SUCCESSIVE_IRQ_MAX_COUNT 10000 + +static void delayed_ioapic_service_cb (void *opaque) +{ +IOAPICCommonState *s = opaque; + +ioapic_service (s); +} +static void ioapic_set_irq (void *opaque,int vector,int level) {IOAPICCommonState *s = opaque;@@ -222,13 +231,39 @@ void ioapic_eoi_broadcast(int vector) }for (n =0 ; n <IOAPIC_NUM_PINS ; n++) { entry = s->ioredtbl[n]; -if ((entry &IOAPIC_LVT_REMOTE_IRR ) - && (entry &IOAPIC_VECTOR_MASK ) == vector) { -trace_ioapic_clear_remote_irr (n, vector); - s->ioredtbl[n] = entry & ~IOAPIC_LVT_REMOTE_IRR ; -if (!(entry &IOAPIC_LVT_MASKED ) && (s->irr & (1 << n))) { + +if ((entry &IOAPIC_VECTOR_MASK ) != vector || + ((entry >>IOAPIC_LVT_TRIGGER_MODE_SHIFT ) &1 ) !=IOAPIC_TRIGGER_LEVEL ) { +continue ; + } + +if (!(entry &IOAPIC_LVT_REMOTE_IRR )) { +continue ; + } + +trace_ioapic_clear_remote_irr (n, vector); + s->ioredtbl[n] = entry & ~IOAPIC_LVT_REMOTE_IRR ; + +if (!(entry &IOAPIC_LVT_MASKED ) && (s->irr & (1 << n))) { + ++s->irq_eoi[vector]; +if (s->irq_eoi[vector] >=SUCCESSIVE_IRQ_MAX_COUNT ) { +/* +* Real hardware does not deliver the interrupt immediately +* during eoi broadcast, and this lets a buggy guest make +* slow progress even if it does not correctly handle a +* level-triggered interrupt. Emulate this behavior if we +* detect an interrupt storm. +*/ + s->irq_eoi[vector] =0 ; +timer_mod_anticipate (s->delayed_ioapic_service_timer, +qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) + +NANOSECONDS_PER_SECOND /100 ); +trace_ioapic_eoi_delayed_reassert (vector); + }else {ioapic_service (s); } + }else { + s->irq_eoi[vector] =0 ; } } }@@ -401,6 +436,9 @@ static void ioapic_realize(DeviceState *dev, Error **errp)memory_region_init_io (&s->io_memory,OBJECT (s), &ioapic_io_ops, s,"ioapic" ,0x1000 ); + s->delayed_ioapic_service_timer = +timer_new_ns (QEMU_CLOCK_VIRTUAL , delayed_ioapic_service_cb, s); +qdev_init_gpio_in (dev, ioapic_set_irq,IOAPIC_NUM_PINS ); ioapics[ioapic_no] = s;@@ -408,6 +446,14 @@ static void ioapic_realize(DeviceState *dev, Error **errp)qemu_add_machine_init_done_notifier (&s->machine_done); } +static void ioapic_unrealize (DeviceState *dev,Error **errp) +{ +IOAPICCommonState *s =IOAPIC_COMMON (dev); + +timer_del (s->delayed_ioapic_service_timer); +timer_free (s->delayed_ioapic_service_timer); +} +static Property ioapic_properties[] = {DEFINE_PROP_UINT8 ("version" , IOAPICCommonState, version,IOAPIC_VER_DEF ),DEFINE_PROP_END_OF_LIST (),@@ -419,6 +465,7 @@ static void ioapic_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass); k->realize = ioapic_realize; + k->unrealize = ioapic_unrealize;/* * If APIC is in kernel, we need to update the kernel cache after * migration, otherwise first 24 gsi routes will be invalid. hw/intc/trace-events +1
-0@@ -25,6 +25,7 @@ apic_mem_writel(uint64_t addr, uint32_t val) "0x%"PRIx64" = 0x%08x" ioapic_set_remote_irr(int n) "set remote irr for pin %d" ioapic_clear_remote_irr(int n, int vector) "clear remote irr for pin %d vector %d" ioapic_eoi_broadcast(int vector) "EOI broadcast for vector %d" +ioapic_eoi_delayed_reassert(int vector) "delayed reassert on EOI broadcast for vector %d" ioapic_mem_read(uint8_t addr, uint8_t regsel, uint8_t size, uint32_t val) "ioapic mem read addr 0x%"PRIx8" regsel: 0x%"PRIx8" size 0x%"PRIx8" retval 0x%"PRIx32 ioapic_mem_write(uint8_t addr, uint8_t regsel, uint8_t size, uint32_t val) "ioapic mem write addr 0x%"PRIx8" regsel: 0x%"PRIx8" size 0x%"PRIx8" val 0x%"PRIx32 ioapic_set_irq(int vector, int level) "vector: %d level: %d"include/hw/i386/ioapic_internal.h +3
-1@@ -96,6 +96,7 @@ typedef struct IOAPICCommonClass {SysBusDeviceClass parent_class;DeviceRealize realize; +DeviceUnrealize unrealize;void (*pre_save)(IOAPICCommonState *s);void (*post_load)(IOAPICCommonState *s); } IOAPICCommonClass;@@ -111,6 +112,8 @@ struct IOAPICCommonState {uint8_t version;uint64_t irq_count[IOAPIC_NUM_PINS ];int irq_level[IOAPIC_NUM_PINS ]; +int irq_eoi[IOAPIC_NUM_PINS ]; +QEMUTimer *delayed_ioapic_service_timer; };void ioapic_reset_common (DeviceState *dev); --1.8.3.1
Signature · 1 line
Marc-André Lureau
Re: [Qemu-devel] [PULL 19/21] ioapic: allow buggy guests mishandling level-triggered interrupts to make progress
I have posted a fix for this several weeks ago:
-->https://www.mail-archive.com/[email protected]/msg626186.html
Thanks,
Li Qiang
Quoted 288 lines · Marc-André Lureau <[email protected]> 于2019年7月4日周四 下午8:57写道:
Hi
Quoted 4 lines · Paolo Bonzini
From: Vitaly Kuznetsov <[email protected]>
It was found that Hyper-V 2016 on KVM in some configurations (q35
machine +
Quoted 5 lines
piix4-usb-uhci) hangs on boot. Root-cause was that one of Hyper-V level-triggered interrupt handler performs EOI before fixing the cause of the interrupt. This results in IOAPIC keep re-raising the level-triggered interrupt after EOI because irq-line remains asserted.
Quoted 8 lines
Gory details: https://www.spinics.net/lists/kvm/msg184484.html
(the whole thread).Turns out we were dealing with similar issues before; in-kernel IOAPIC implementation has commit
184564efae4d("kvm: ioapic: conditionally delay irq delivery duringeoi broadcast") which describes a very similar issue.Steal the idea from the above mentioned commit for IOAPIC implementation
in
Quoted 1 line
QEMU.
SUCCESSIVE_IRQ_MAX_COUNT, delay and the comment are borrowed aswell.
Quoted 4 lines
Signed-off-by Vitaly Kuznetsov <[email protected]>Message-Id: <[email protected]>
Signed-off-by Paolo Bonzini <[email protected]>After this commit, I get the following ASAN error when booting a VM:
/home/elmarco/src/qq/hw/intc/ioapic.c:266:27: runtime error: index 41 out of bounds for type 'int [24]'
=================================================================
==9761==ERROR: AddressSanitizer: heap-buffer-overflow on address0x61b00000312cat pc0x55e40b8f9e74bp0x7f269c1d32a0sp0x7f269c1d3290
WRITE of size 4 at0x61b00000312cthread T4 (CPU 0/KVM)#0 0x55e40b8f9e73 in ioapic_eoi_broadcast /home/elmarco/src/qq/hw/intc/ioapic.c:266 #1 0x55e40bd3fa4e in kvm_arch_handle_exit /home/elmarco/src/qq/target/i386/kvm.c:3644 #2 0x55e40b7d1fd7 in kvm_cpu_exec /home/elmarco/src/qq/accel/kvm/kvm-all.c:2083 #3 0x55e40b6e435f in qemu_kvm_cpu_thread_fn /home/elmarco/src/qq/cpus.c:1282 #4 0x55e40ce9ba42 in qemu_thread_start /home/elmarco/src/qq/util/qemu-thread-posix.c:502 #5 0x7f26ac3435a1 in start_thread (/lib64/libpthread.so.0+0x85a1) #6 0x7f26ac270302 in __clone (/lib64/libc.so.6+0xfb302)Address
0x61b00000312cis a wild pointer.
SUMMARY: AddressSanitizer: heap-buffer-overflow/home/elmarco/src/qq/hw/intc/ioapic.c:266inioapic_eoi_broadcastShadow bytes around the buggy address:
0x0c367fff85d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000x0c367fff85e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000x0c367fff85f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000x0c367fff8600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000x0c367fff8610: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fa fa
=>0x0c367fff8620: fa fa fa fa fa[fa]fa fa fa fa fa fa fa fa fa fa
0x0c367fff8630: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa0x0c367fff8640: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa0x0c367fff8650: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa0x0c367fff8660: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa0x0c367fff8670: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb Shadow gap: cc Thread T4 (CPU 0/KVM) created by T0 here: #0 0x7f26af884965 in pthread_create (/lib64/libasan.so.5+0x3a965) #1 0x55e40ce9be8b in qemu_thread_create /home/elmarco/src/qq/util/qemu-thread-posix.c:539 #2 0x55e40b6ea347 in qemu_kvm_start_vcpu /home/elmarco/src/qq/cpus.c:2018 #3 0x55e40b6eb03b in qemu_init_vcpu /home/elmarco/src/qq/cpus.c:2084 #4 0x55e40bb52352 in x86_cpu_realizefn /home/elmarco/src/qq/target/i386/cpu.c:5382 #5 0x55e40c017aed in device_set_realized /home/elmarco/src/qq/hw/core/qdev.c:834 #6 0x55e40c95e703 in property_set_bool /home/elmarco/src/qq/qom/object.c:2074 #7 0x55e40c959332 in object_property_set /home/elmarco/src/qq/qom/object.c:1266 #8 0x55e40c961edb in object_property_set_qobject /home/elmarco/src/qq/qom/qom-qobject.c:27 #9 0x55e40c959700 in object_property_set_bool /home/elmarco/src/qq/qom/object.c:1332 #10 0x55e40ba831a3 in pc_new_cpu /home/elmarco/src/qq/hw/i386/pc.c:1531 #11 0x55e40ba838a0 in pc_cpus_init /home/elmarco/src/qq/hw/i386/pc.c:1579 #12 0x55e40ba9f394 in pc_q35_init /home/elmarco/src/qq/hw/i386/pc_q35.c:183 #13 0x55e40baa19ab in pc_init_v4_0 /home/elmarco/src/qq/hw/i386/pc_q35.c:385 #14 0x55e40c035aa7 in machine_run_board_init /home/elmarco/src/qq/hw/core/machine.c:1033 #15 0x55e40bda59d8 in main /home/elmarco/src/qq/vl.c:4494 #16 0x7f26ac198f32 in __libc_start_main (/lib64/libc.so.6+0x23f32)I start investigating.
Quoted 2 lines
--- hw/intc/ioapic.c | 57+++++++++++++++++++++++++++++++++++----
Quoted 25 lines
hw/intc/trace-events | 1 + include/hw/i386/ioapic_internal.h | 3 +++ 3 files changed, 56 insertions(+), 5 deletions(-)hw/intc/ioapic.c +9
-0@@ -139,6 +139,15 @@ static void ioapic_service(IOAPICCommonState *s) } } +#define SUCCESSIVE_IRQ_MAX_COUNT 10000 + +static void delayed_ioapic_service_cb (void *opaque) +{ +IOAPICCommonState *s = opaque; + +ioapic_service (s); +} +static void ioapic_set_irq (void *opaque,int vector,int level) {IOAPICCommonState *s = opaque;hw/intc/ioapic.c void ioapic_eoi_broadcast(int vector) · line 229
Quoted 8 lines
hw/intc/ioapic.c +0
-5@@ -222,13 +231,39 @@ void ioapic_eoi_broadcast(int vector) }for (n =0 ; n <IOAPIC_NUM_PINS ; n++) { entry = s->ioredtbl[n]; -if ((entry &IOAPIC_LVT_REMOTE_IRR ) - && (entry &IOAPIC_VECTOR_MASK ) == vector) { -trace_ioapic_clear_remote_irr (n, vector); - s->ioredtbl[n] = entry & ~IOAPIC_LVT_REMOTE_IRR ; - if (!(entry & IOAPIC_LVT_MASKED) && (s->irr & (1 <<n))) {
hw/intc/ioapic.c void ioapic_eoi_broadcast(int vector)
Quoted 3 lines
hw/intc/ioapic.c +3
-0+ +if ((entry &IOAPIC_VECTOR_MASK ) != vector || + ((entry >> IOAPIC_LVT_TRIGGER_MODE_SHIFT) & 1) !=
IOAPIC_TRIGGER_LEVEL) {Quoted 5 lines
hw/intc/ioapic.c +5
-0+continue ; + } + +if (!(entry &IOAPIC_LVT_REMOTE_IRR )) { +continue ;hw/intc/ioapic.c void ioapic_eoi_broadcast(int vector)
Quoted 10 lines
hw/intc/ioapic.c +10
-0+ } + +trace_ioapic_clear_remote_irr (n, vector); + s->ioredtbl[n] = entry & ~IOAPIC_LVT_REMOTE_IRR ; + +if (!(entry &IOAPIC_LVT_MASKED ) && (s->irr & (1 << n))) { + ++s->irq_eoi[vector]; +if (s->irq_eoi[vector] >=SUCCESSIVE_IRQ_MAX_COUNT ) { +/* +* Real hardware does not deliver the interrupt immediately
hw/intc/ioapic.c void ioapic_eoi_broadcast(int vector) · line 252
Quoted 1 line
hw/intc/ioapic.c +1
-0+* during eoi broadcast, and this lets a buggy guest make
hw/intc/ioapic.c void ioapic_eoi_broadcast(int vector) · line 253
Quoted 1 line
hw/intc/ioapic.c +1
-0+* slow progress even if it does not correctly handle a
hw/intc/ioapic.c void ioapic_eoi_broadcast(int vector) · line 254
Quoted 1 line
hw/intc/ioapic.c +1
-0+* level-triggered interrupt. Emulate this behavior if we
hw/intc/ioapic.c void ioapic_eoi_broadcast(int vector)
Quoted 4 lines
hw/intc/ioapic.c +4
-0+* detect an interrupt storm. +*/ + s->irq_eoi[vector] =0 ; +timer_mod_anticipate(s->delayed_ioapic_service_timer,
hw/intc/ioapic.c void ioapic_eoi_broadcast(int vector) · line 259
Quoted 1 line
hw/intc/ioapic.c +1
-0+
qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL)+hw/intc/ioapic.c static void ioapic_realize(DeviceState *dev, Error
Quoted 11 lines
hw/intc/ioapic.c +5
-0+ NANOSECONDS_PER_SECOND / 100); +trace_ioapic_eoi_delayed_reassert (vector); + }else {ioapic_service (s); } + }else { + s->irq_eoi[vector] =0 ; } } }@@ -401,6 +436,9 @@ static void ioapic_realize(DeviceState *dev, Error**errp)
hw/intc/ioapic.c static void ioapic_realize(DeviceState *dev, Error
Quoted 10 lines
hw/intc/ioapic.c +3
-0memory_region_init_io (&s->io_memory,OBJECT (s), &ioapic_io_ops, s,"ioapic" ,0x1000 ); + s->delayed_ioapic_service_timer = +timer_new_ns (QEMU_CLOCK_VIRTUAL , delayed_ioapic_service_cb, s); +qdev_init_gpio_in (dev, ioapic_set_irq,IOAPIC_NUM_PINS ); ioapics[ioapic_no] = s;@@ -408,6 +446,14 @@ static void ioapic_realize(DeviceState *dev, Error**errp)
hw/intc/ioapic.c static void ioapic_realize(DeviceState *dev, Error **errp)
Quoted 13 lines
hw/intc/ioapic.c +8
-0qemu_add_machine_init_done_notifier (&s->machine_done); } +static void ioapic_unrealize (DeviceState *dev,Error **errp) +{ +IOAPICCommonState *s =IOAPIC_COMMON (dev); + +timer_del (s->delayed_ioapic_service_timer); +timer_free (s->delayed_ioapic_service_timer); +} +static Property ioapic_properties[] = { DEFINE_PROP_UINT8("version", IOAPICCommonState, version,
IOAPIC_VER_DEF),hw/intc/ioapic.c static void ioapic_class_init(ObjectClass *klass,
Quoted 2 lines
hw/intc/ioapic.c +0
-0DEFINE_PROP_END_OF_LIST(),@@ -419,6 +465,7 @@ static void ioapic_class_init(ObjectClass *klass,void *data)
hw/intc/trace-events apic_mem_writel(uint64_t addr, uint32_t val)
Quoted 12 lines
hw/intc/ioapic.c +1
-0DeviceClass *dc =DEVICE_CLASS (klass); k->realize = ioapic_realize; + k->unrealize = ioapic_unrealize;/* * If APIC is in kernel, we need to update the kernel cache after * migration, otherwise first 24 gsi routes will be invalid. hw/intc/trace-events +0
-0@@ -25,6 +25,7 @@ apic_mem_writel(uint64_t addr, uint32_t val)"0x%"PRIx64" = 0x%08x"
hw/intc/trace-events apic_mem_writel(uint64_t addr, uint32_t val) · line 26
Quoted 2 lines
hw/intc/trace-events +0
-0ioapic_set_remote_irr(int n) "set remote irr for pin %d" ioapic_clear_remote_irr(int n, int vector) "clear remote irr for pin %dvector %d"
hw/intc/trace-events apic_mem_writel(uint64_t addr, uint32_t val) · line 28
Quoted 2 lines
hw/intc/trace-events +1
-0ioapic_eoi_broadcast(int vector) "EOI broadcast for vector %d" +ioapic_eoi_delayed_reassert(int vector) "delayed reassert on EOIbroadcast for vector %d"
hw/intc/trace-events apic_mem_writel(uint64_t addr, uint32_t val) · line 29
Quoted 1 line
hw/intc/trace-events +0
-0ioapic_mem_read(uint8_t addr, uint8_t regsel, uint8_t size, uint32_tval) "ioapic mem read addr 0x%"PRIx8" regsel: 0x%"PRIx8" size 0x%"PRIx8" retval 0x%"PRIx32
hw/intc/trace-events apic_mem_writel(uint64_t addr, uint32_t val) · line 30
Quoted 1 line
hw/intc/trace-events +0
-0ioapic_mem_write(uint8_t addr, uint8_t regsel, uint8_t size, uint32_tval) "ioapic mem write addr 0x%"PRIx8" regsel: 0x%"PRIx8" size 0x%"PRIx8" val 0x%"PRIx32
Review
Quoted 2 lines
hw/intc/trace-events +0
-0ioapic_set_irq(int vector, int level) "vector: %d level: %d"(quoted diff) +0
-0
b/include/hw/i386/ioapic_internal.hQuoted 21 lines
index 9848f39..07002f9 100644
include/hw/i386/ioapic_internal.h +3
-1@@ -96,6 +96,7 @@ typedef struct IOAPICCommonClass {SysBusDeviceClass parent_class;DeviceRealize realize; +DeviceUnrealize unrealize;void (*pre_save)(IOAPICCommonState *s);void (*post_load)(IOAPICCommonState *s); } IOAPICCommonClass;@@ -111,6 +112,8 @@ struct IOAPICCommonState {uint8_t version;uint64_t irq_count[IOAPIC_NUM_PINS ];int irq_level[IOAPIC_NUM_PINS ]; +int irq_eoi[IOAPIC_NUM_PINS ]; +QEMUTimer *delayed_ioapic_service_timer; };void ioapic_reset_common (DeviceState *dev); --Quoted 4 lines
1.8.3.1
--
Marc-André Lureau
Re: [Qemu-devel] [PULL 19/21] ioapic: allow buggy guests mishandling level-triggered interrupts to make progress
Hi
Quoted 4 lines · Li Qiang
I have posted a fix for this several weeks ago:
-->https://www.mail-archive.com/[email protected]/msg626186.html
Your patch looks reasonable, but I am not really able to review it.
I hope Paolo and Vitaly will take care of it.
Thanks
Quoted 265 lines
Thanks,
Li QiangQuoted 259 lines · Marc-André Lureau <[email protected]> 于2019年7月4日周四 下午8:57写道:
Hi
Quoted 16 lines · Paolo Bonzini
From: Vitaly Kuznetsov <[email protected]>
It was found that Hyper-V 2016 on KVM in some configurations (q35 machine + piix4-usb-uhci) hangs on boot. Root-cause was that one of Hyper-V level-triggered interrupt handler performs EOI before fixing the cause of the interrupt. This results in IOAPIC keep re-raising the level-triggered interrupt after EOI because irq-line remains asserted.
Gory details: https://www.spinics.net/lists/kvm/msg184484.html
(the whole thread).Turns out we were dealing with similar issues before; in-kernel IOAPIC implementation has commit
184564efae4d("kvm: ioapic: conditionally delay irq delivery duringeoi broadcast") which describes a very similar issue.Quoted 6 lines
Steal the idea from the above mentioned commit for IOAPIC implementation in QEMU.
SUCCESSIVE_IRQ_MAX_COUNT, delay and the comment are borrowed as well.Signed-off-by Vitaly Kuznetsov <[email protected]>Message-Id: <[email protected]>
Signed-off-by Paolo Bonzini <[email protected]>After this commit, I get the following ASAN error when booting a VM:
/home/elmarco/src/qq/hw/intc/ioapic.c:266:27: runtime error: index 41 out of bounds for type 'int [24]'
=================================================================
==9761==ERROR: AddressSanitizer: heap-buffer-overflow on address0x61b00000312cat pc0x55e40b8f9e74bp0x7f269c1d32a0sp0x7f269c1d3290
WRITE of size 4 at0x61b00000312cthread T4 (CPU 0/KVM)#0 0x55e40b8f9e73 in ioapic_eoi_broadcast /home/elmarco/src/qq/hw/intc/ioapic.c:266 #1 0x55e40bd3fa4e in kvm_arch_handle_exit /home/elmarco/src/qq/target/i386/kvm.c:3644 #2 0x55e40b7d1fd7 in kvm_cpu_exec /home/elmarco/src/qq/accel/kvm/kvm-all.c:2083 #3 0x55e40b6e435f in qemu_kvm_cpu_thread_fn /home/elmarco/src/qq/cpus.c:1282 #4 0x55e40ce9ba42 in qemu_thread_start /home/elmarco/src/qq/util/qemu-thread-posix.c:502 #5 0x7f26ac3435a1 in start_thread (/lib64/libpthread.so.0+0x85a1) #6 0x7f26ac270302 in __clone (/lib64/libc.so.6+0xfb302)Address
0x61b00000312cis a wild pointer.
SUMMARY: AddressSanitizer: heap-buffer-overflow/home/elmarco/src/qq/hw/intc/ioapic.c:266inioapic_eoi_broadcastShadow bytes around the buggy address:
0x0c367fff85d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000x0c367fff85e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000x0c367fff85f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000x0c367fff8600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000x0c367fff8610: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fa fa
=>0x0c367fff8620: fa fa fa fa fa[fa]fa fa fa fa fa fa fa fa fa fa
0x0c367fff8630: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa0x0c367fff8640: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa0x0c367fff8650: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa0x0c367fff8660: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa0x0c367fff8670: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb Shadow gap: cc Thread T4 (CPU 0/KVM) created by T0 here: #0 0x7f26af884965 in pthread_create (/lib64/libasan.so.5+0x3a965) #1 0x55e40ce9be8b in qemu_thread_create /home/elmarco/src/qq/util/qemu-thread-posix.c:539 #2 0x55e40b6ea347 in qemu_kvm_start_vcpu /home/elmarco/src/qq/cpus.c:2018 #3 0x55e40b6eb03b in qemu_init_vcpu /home/elmarco/src/qq/cpus.c:2084 #4 0x55e40bb52352 in x86_cpu_realizefn /home/elmarco/src/qq/target/i386/cpu.c:5382 #5 0x55e40c017aed in device_set_realized /home/elmarco/src/qq/hw/core/qdev.c:834 #6 0x55e40c95e703 in property_set_bool /home/elmarco/src/qq/qom/object.c:2074 #7 0x55e40c959332 in object_property_set /home/elmarco/src/qq/qom/object.c:1266 #8 0x55e40c961edb in object_property_set_qobject /home/elmarco/src/qq/qom/qom-qobject.c:27 #9 0x55e40c959700 in object_property_set_bool /home/elmarco/src/qq/qom/object.c:1332 #10 0x55e40ba831a3 in pc_new_cpu /home/elmarco/src/qq/hw/i386/pc.c:1531 #11 0x55e40ba838a0 in pc_cpus_init /home/elmarco/src/qq/hw/i386/pc.c:1579 #12 0x55e40ba9f394 in pc_q35_init /home/elmarco/src/qq/hw/i386/pc_q35.c:183 #13 0x55e40baa19ab in pc_init_v4_0 /home/elmarco/src/qq/hw/i386/pc_q35.c:385 #14 0x55e40c035aa7 in machine_run_board_init /home/elmarco/src/qq/hw/core/machine.c:1033 #15 0x55e40bda59d8 in main /home/elmarco/src/qq/vl.c:4494 #16 0x7f26ac198f32 in __libc_start_main (/lib64/libc.so.6+0x23f32)I start investigating.
Quoted 138 lines
--- hw/intc/ioapic.c | 57 +++++++++++++++++++++++++++++++++++---- hw/intc/trace-events | 1 + include/hw/i386/ioapic_internal.h | 3 +++ 3 files changed, 56 insertions(+), 5 deletions(-)hw/intc/ioapic.c +52
-5@@ -139,6 +139,15 @@ static void ioapic_service(IOAPICCommonState *s) } } +#define SUCCESSIVE_IRQ_MAX_COUNT 10000 + +static void delayed_ioapic_service_cb (void *opaque) +{ +IOAPICCommonState *s = opaque; + +ioapic_service (s); +} +static void ioapic_set_irq (void *opaque,int vector,int level) {IOAPICCommonState *s = opaque;@@ -222,13 +231,39 @@ void ioapic_eoi_broadcast(int vector) }for (n =0 ; n <IOAPIC_NUM_PINS ; n++) { entry = s->ioredtbl[n]; -if ((entry &IOAPIC_LVT_REMOTE_IRR ) - && (entry &IOAPIC_VECTOR_MASK ) == vector) { -trace_ioapic_clear_remote_irr (n, vector); - s->ioredtbl[n] = entry & ~IOAPIC_LVT_REMOTE_IRR ; -if (!(entry &IOAPIC_LVT_MASKED ) && (s->irr & (1 << n))) { + +if ((entry &IOAPIC_VECTOR_MASK ) != vector || + ((entry >>IOAPIC_LVT_TRIGGER_MODE_SHIFT ) &1 ) !=IOAPIC_TRIGGER_LEVEL ) { +continue ; + } + +if (!(entry &IOAPIC_LVT_REMOTE_IRR )) { +continue ; + } + +trace_ioapic_clear_remote_irr (n, vector); + s->ioredtbl[n] = entry & ~IOAPIC_LVT_REMOTE_IRR ; + +if (!(entry &IOAPIC_LVT_MASKED ) && (s->irr & (1 << n))) { + ++s->irq_eoi[vector]; +if (s->irq_eoi[vector] >=SUCCESSIVE_IRQ_MAX_COUNT ) { +/* +* Real hardware does not deliver the interrupt immediately +* during eoi broadcast, and this lets a buggy guest make +* slow progress even if it does not correctly handle a +* level-triggered interrupt. Emulate this behavior if we +* detect an interrupt storm. +*/ + s->irq_eoi[vector] =0 ; +timer_mod_anticipate (s->delayed_ioapic_service_timer, +qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) + +NANOSECONDS_PER_SECOND /100 ); +trace_ioapic_eoi_delayed_reassert (vector); + }else {ioapic_service (s); } + }else { + s->irq_eoi[vector] =0 ; } } }@@ -401,6 +436,9 @@ static void ioapic_realize(DeviceState *dev, Error **errp)memory_region_init_io (&s->io_memory,OBJECT (s), &ioapic_io_ops, s,"ioapic" ,0x1000 ); + s->delayed_ioapic_service_timer = +timer_new_ns (QEMU_CLOCK_VIRTUAL , delayed_ioapic_service_cb, s); +qdev_init_gpio_in (dev, ioapic_set_irq,IOAPIC_NUM_PINS ); ioapics[ioapic_no] = s;@@ -408,6 +446,14 @@ static void ioapic_realize(DeviceState *dev, Error **errp)qemu_add_machine_init_done_notifier (&s->machine_done); } +static void ioapic_unrealize (DeviceState *dev,Error **errp) +{ +IOAPICCommonState *s =IOAPIC_COMMON (dev); + +timer_del (s->delayed_ioapic_service_timer); +timer_free (s->delayed_ioapic_service_timer); +} +static Property ioapic_properties[] = {DEFINE_PROP_UINT8 ("version" , IOAPICCommonState, version,IOAPIC_VER_DEF ),DEFINE_PROP_END_OF_LIST (),@@ -419,6 +465,7 @@ static void ioapic_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass); k->realize = ioapic_realize; + k->unrealize = ioapic_unrealize;/* * If APIC is in kernel, we need to update the kernel cache after * migration, otherwise first 24 gsi routes will be invalid. hw/intc/trace-events +1
-0@@ -25,6 +25,7 @@ apic_mem_writel(uint64_t addr, uint32_t val) "0x%"PRIx64" = 0x%08x" ioapic_set_remote_irr(int n) "set remote irr for pin %d" ioapic_clear_remote_irr(int n, int vector) "clear remote irr for pin %d vector %d" ioapic_eoi_broadcast(int vector) "EOI broadcast for vector %d" +ioapic_eoi_delayed_reassert(int vector) "delayed reassert on EOI broadcast for vector %d" ioapic_mem_read(uint8_t addr, uint8_t regsel, uint8_t size, uint32_t val) "ioapic mem read addr 0x%"PRIx8" regsel: 0x%"PRIx8" size 0x%"PRIx8" retval 0x%"PRIx32 ioapic_mem_write(uint8_t addr, uint8_t regsel, uint8_t size, uint32_t val) "ioapic mem write addr 0x%"PRIx8" regsel: 0x%"PRIx8" size 0x%"PRIx8" val 0x%"PRIx32 ioapic_set_irq(int vector, int level) "vector: %d level: %d"include/hw/i386/ioapic_internal.h +3
-1@@ -96,6 +96,7 @@ typedef struct IOAPICCommonClass {SysBusDeviceClass parent_class;DeviceRealize realize; +DeviceUnrealize unrealize;void (*pre_save)(IOAPICCommonState *s);void (*post_load)(IOAPICCommonState *s); } IOAPICCommonClass;@@ -111,6 +112,8 @@ struct IOAPICCommonState {uint8_t version;uint64_t irq_count[IOAPIC_NUM_PINS ];int irq_level[IOAPIC_NUM_PINS ]; +int irq_eoi[IOAPIC_NUM_PINS ]; +QEMUTimer *delayed_ioapic_service_timer; };void ioapic_reset_common (DeviceState *dev); --Quoted 4 lines
1.8.3.1
--
Marc-André Lureau
Signature · 1 line
Marc-André Lureau
Paolo Bonzini
AppliedRe: [Qemu-devel] [PULL 19/21] ioapic: allow buggy guests mishandling level-triggered interrupts to make progress
Quoted 11 lines · Marc-André Lureau
Hi
Quoted 4 lines · Li Qiang
I have posted a fix for this several weeks ago:
-->https://www.mail-archive.com/[email protected]/msg626186.html
Your patch looks reasonable, but I am not really able to review it.
I hope Paolo and Vitaly will take care of it.
I have queued the patch, thanks Marc-André and Li Qiang.
Paolo
[Qemu-devel] [PULL 20/21] hw/char: Move multi-serial devices into separate file
In reply to Paolo BonziniFrom: Thomas Huth <[email protected]>
In our downstream distribution of QEMU, we'd like to ship the binary without the multi-serial PCI devices. To make this disablement easier, let's move the devices into a separate file and add a proper Kconfig- switch for these devices.
Message-Id: <[email protected]>
--- hw/char/Kconfig | 6 ++ hw/char/Makefile.objs | 1 + hw/char/serial-pci-multi.c | 208 +++++++++++++++++++++++++++++++++++++++++++++ hw/char/serial-pci.c | 170 ------------------------------------ 4 files changed, 215 insertions(+), 170 deletions(-) create mode 100644 hw/char/serial-pci-multi.c
hw/char/Kconfig +6 -0
@@ -24,6 +24,12 @@ config SERIAL_PCI depends on PCI select SERIAL +config SERIAL_PCI_MULTI + bool + default y if PCI_DEVICES + depends on PCI + select SERIAL + config VIRTIO_SERIAL bool default y
hw/char/Makefile.objs +1 -0
@@ -7,6 +7,7 @@ common-obj-$(CONFIG_PL011) += pl011.o common-obj-$(CONFIG_SERIAL) += serial.o common-obj-$(CONFIG_SERIAL_ISA) += serial-isa.o common-obj-$(CONFIG_SERIAL_PCI) += serial-pci.o +common-obj-$(CONFIG_SERIAL_PCI_MULTI) += serial-pci-multi.o common-obj-$(CONFIG_VIRTIO_SERIAL) += virtio-console.o common-obj-$(CONFIG_XILINX) += xilinx_uartlite.o common-obj-$(CONFIG_XEN) += xen_console.o
hw/char/serial-pci-multi.c new file +208 -0
208 lines not on this page · raw message
hw/char/serial-pci.c +0 -170
221 lines not on this page · raw message
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 16/21] configure: qemu-ga is only needed with softmmu targets
In reply to Paolo BonziniFrom: Laurent Vivier <[email protected]>
Remove it from the list of tools if --disable-system and --disable-tools are used as we don't need it for linux-user targets.
Message-Id: <[email protected]>
--- configure | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
configure +3 -1
@@ -6079,7 +6079,9 @@ fi # Probe for guest agent support/options if [ "$guest_agent" != "no" ]; then - if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then + if [ "$softmmu" = no -a "$want_tools" = no ] ; then + guest_agent=no + elif [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then tools="qemu-ga $tools" guest_agent=yes elif [ "$guest_agent" != yes ]; then
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 17/21] build: chardev is only needed for softmmu targets
In reply to Paolo BonziniFrom: Laurent Vivier <[email protected]>
Move the dependency from SUBDIR_RULES to SOFTMMU_SUBDIR_RULES
Message-Id: <[email protected]>
--- Makefile | 3 ++- Makefile.objs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
Makefile +2 -1
@@ -444,6 +444,7 @@ SOFTMMU_SUBDIR_RULES=$(filter %-softmmu,$(SUBDIR_RULES)) $(SOFTMMU_SUBDIR_RULES): $(authz-obj-y) $(SOFTMMU_SUBDIR_RULES): $(block-obj-y) +$(SOFTMMU_SUBDIR_RULES): $(chardev-obj-y) $(SOFTMMU_SUBDIR_RULES): $(crypto-obj-y) $(SOFTMMU_SUBDIR_RULES): $(io-obj-y) $(SOFTMMU_SUBDIR_RULES): config-all-devices.mak
@@ -480,7 +481,7 @@ subdir-capstone: .git-submodule-status subdir-slirp: .git-submodule-status $(call quiet-command,$(MAKE) -C $(SRC_PATH)/slirp BUILD_DIR="$(BUILD_DIR)/slirp" CC="$(CC)" AR="$(AR)" LD="$(LD)" RANLIB="$(RANLIB)" CFLAGS="$(QEMU_CFLAGS) $(CFLAGS)" LDFLAGS="$(LDFLAGS)") -$(SUBDIR_RULES): libqemuutil.a $(common-obj-y) $(chardev-obj-y) \ +$(SUBDIR_RULES): libqemuutil.a $(common-obj-y) \ $(qom-obj-y) $(crypto-aes-obj-$(CONFIG_USER_ONLY)) ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
Makefile.objs +1 -1
@@ -129,9 +129,9 @@ trace-events-subdirs += accel/kvm trace-events-subdirs += accel/tcg trace-events-subdirs += authz trace-events-subdirs += block -trace-events-subdirs += chardev trace-events-subdirs += crypto ifeq ($(CONFIG_SOFTMMU),y) +trace-events-subdirs += chardev trace-events-subdirs += audio trace-events-subdirs += hw/9pfs trace-events-subdirs += hw/acpi
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 15/21] build: replace GENERATED_FILES by generated-files-y
In reply to Paolo BonziniFrom: Laurent Vivier <[email protected]>
When possible use generated-files-$(FLAG) to disable some targets (like KEYCODEMAP_FILES).
Message-Id: <[email protected]>
--- Makefile | 36 +++++++++++++++++------------------- Makefile.target | 6 +++--- target/s390x/Makefile.objs | 2 +- tests/Makefile.include | 26 +++++++++++++------------- 4 files changed, 34 insertions(+), 36 deletions(-)
Makefile +17 -19
@@ -101,7 +101,7 @@ QEMU_PKGVERSION := $(if $(PKGVERSION),$(PKGVERSION),$(shell \ # Either "version (pkgversion)", or just "version" if pkgversion not set FULL_VERSION := $(if $(QEMU_PKGVERSION),$(VERSION) ($(QEMU_PKGVERSION)),$(VERSION)) -GENERATED_FILES = qemu-version.h config-host.h qemu-options.def +generated-files-y = qemu-version.h config-host.h qemu-options.def GENERATED_QAPI_FILES = qapi/qapi-builtin-types.h qapi/qapi-builtin-types.c GENERATED_QAPI_FILES += qapi/qapi-types.h qapi/qapi-types.c
@@ -121,20 +121,18 @@ GENERATED_QAPI_FILES += $(QAPI_MODULES:%=qapi/qapi-events-%.c) GENERATED_QAPI_FILES += qapi/qapi-introspect.c qapi/qapi-introspect.h GENERATED_QAPI_FILES += qapi/qapi-doc.texi -GENERATED_FILES += $(GENERATED_QAPI_FILES) +generated-files-y += $(GENERATED_QAPI_FILES) -GENERATED_FILES += trace/generated-tcg-tracers.h +generated-files-y += trace/generated-tcg-tracers.h -GENERATED_FILES += trace/generated-helpers-wrappers.h -GENERATED_FILES += trace/generated-helpers.h -GENERATED_FILES += trace/generated-helpers.c +generated-files-y += trace/generated-helpers-wrappers.h +generated-files-y += trace/generated-helpers.h +generated-files-y += trace/generated-helpers.c -ifdef CONFIG_TRACE_UST -GENERATED_FILES += trace-ust-all.h -GENERATED_FILES += trace-ust-all.c -endif +generated-files-$(CONFIG_TRACE_UST) += trace-ust-all.h +generated-files-$(CONFIG_TRACE_UST) += trace-ust-all.c -GENERATED_FILES += module_block.h +generated-files-y += module_block.h TRACE_HEADERS = trace-root.h $(trace-events-subdirs:%=%/trace.h) TRACE_SOURCES = trace-root.c $(trace-events-subdirs:%=%/trace.c)
@@ -147,10 +145,10 @@ ifdef CONFIG_TRACE_UST TRACE_HEADERS += trace-ust-root.h $(trace-events-subdirs:%=%/trace-ust.h) endif -GENERATED_FILES += $(TRACE_HEADERS) -GENERATED_FILES += $(TRACE_SOURCES) -GENERATED_FILES += $(BUILD_DIR)/trace-events-all -GENERATED_FILES += .git-submodule-status +generated-files-y += $(TRACE_HEADERS) +generated-files-y += $(TRACE_SOURCES) +generated-files-y += $(BUILD_DIR)/trace-events-all +generated-files-y += .git-submodule-status trace-group-name = $(shell dirname $1 | sed -e 's/[^a-zA-Z0-9]/_/g')
@@ -281,7 +279,7 @@ KEYCODEMAP_FILES = \ ui/input-keymap-osx-to-qcode.c \ $(NULL) -GENERATED_FILES += $(KEYCODEMAP_FILES) +generated-files-$(CONFIG_SOFTMMU) += $(KEYCODEMAP_FILES) ui/input-keymap-%.c: $(KEYCODEMAP_GEN) $(KEYCODEMAP_CSV) $(SRC_PATH)/ui/Makefile.objs $(call quiet-command,\
@@ -643,10 +641,10 @@ clean: rm -f fsdev/*.pod scsi/*.pod rm -f qemu-img-cmds.h rm -f ui/shader/*-vert.h ui/shader/*-frag.h - @# May not be present in GENERATED_FILES + @# May not be present in generated-files-y rm -f trace/generated-tracers-dtrace.dtrace* rm -f trace/generated-tracers-dtrace.h* - rm -f $(foreach f,$(GENERATED_FILES),$(f) $(f)-timestamp) + rm -f $(foreach f,$(generated-files-y),$(f) $(f)-timestamp) rm -f qapi-gen-timestamp rm -rf qga/qapi-generated for d in $(ALL_SUBDIRS); do \
@@ -1062,7 +1060,7 @@ endif # CONFIG_WIN # rebuilt before other object files ifneq ($(wildcard config-host.mak),) ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail)) -Makefile: $(GENERATED_FILES) +Makefile: $(generated-files-y) endif endif
Makefile.target +3 -3
@@ -166,7 +166,7 @@ else obj-y += hw/$(TARGET_BASE_ARCH)/ endif -GENERATED_FILES += hmp-commands.h hmp-commands-info.h +generated-files-y += hmp-commands.h hmp-commands-info.h endif # CONFIG_SOFTMMU
@@ -236,5 +236,5 @@ ifdef CONFIG_TRACE_SYSTEMTAP $(INSTALL_DATA) $(QEMU_PROG)-log.stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG)-log.stp" endif -GENERATED_FILES += config-target.h -Makefile: $(GENERATED_FILES) +generated-files-y += config-target.h +Makefile: $(generated-files-y)
target/s390x/Makefile.objs +1 -1
@@ -12,7 +12,7 @@ obj-$(call lnot,$(CONFIG_TCG)) += tcg-stub.o feat-src = $(SRC_PATH)/target/$(TARGET_BASE_ARCH)/ feat-dst = $(BUILD_DIR)/$(TARGET_DIR) ifneq ($(MAKECMDGOALS),clean) -GENERATED_FILES += $(feat-dst)gen-features.h +generated-files-y += $(feat-dst)gen-features.h endif $(feat-dst)gen-features.h: $(feat-dst)gen-features.h-timestamp
tests/Makefile.include +13 -13
@@ -468,19 +468,19 @@ qapi-schema += unknown-expr-key.json check-qapi-schema-y := $(addprefix tests/qapi-schema/, $(qapi-schema)) -GENERATED_FILES += tests/test-qapi-types.h \ - tests/include/test-qapi-types-sub-module.h \ - tests/test-qapi-types-sub-sub-module.h \ - tests/test-qapi-visit.h \ - tests/include/test-qapi-visit-sub-module.h \ - tests/test-qapi-visit-sub-sub-module.h \ - tests/test-qapi-commands.h \ - tests/include/test-qapi-commands-sub-module.h \ - tests/test-qapi-commands-sub-sub-module.h \ - tests/test-qapi-events.h \ - tests/include/test-qapi-events-sub-module.h \ - tests/test-qapi-events-sub-sub-module.h \ - tests/test-qapi-introspect.h +generated-files-y += tests/test-qapi-types.h +generated-files-y += tests/include/test-qapi-types-sub-module.h +generated-files-y += tests/test-qapi-types-sub-sub-module.h +generated-files-y += tests/test-qapi-visit.h +generated-files-y += tests/include/test-qapi-visit-sub-module.h +generated-files-y += tests/test-qapi-visit-sub-sub-module.h +generated-files-y += tests/test-qapi-commands.h +generated-files-y += tests/include/test-qapi-commands-sub-module.h +generated-files-y += tests/test-qapi-commands-sub-sub-module.h +generated-files-y += tests/test-qapi-events.h +generated-files-y += tests/include/test-qapi-events-sub-module.h +generated-files-y += tests/test-qapi-events-sub-sub-module.h +generated-files-y += tests/test-qapi-introspect.h QEMU_CFLAGS += -I$(SRC_PATH)/tests
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 21/21] hw/net/ne2000: Extract the PCI device from the chipset common code
In reply to Paolo BonziniFrom: Philippe Mathieu-Daudé <[email protected]>
The ne2000.c file contains functions common the the ISA and PCI devices. To allow to build with one or another, extract the PCI specific part into a new file.
This fix an issue where the NE2000_ISA Kconfig had to pull the full PCI core objects.
Message-Id: <[email protected]>
--- hw/net/Kconfig | 7 ++- hw/net/Makefile.objs | 3 +- hw/net/ne2000-pci.c | 132 +++++++++++++++++++++++++++++++++++++++++++++++++++ hw/net/ne2000.c | 105 ---------------------------------------- 4 files changed, 139 insertions(+), 108 deletions(-) create mode 100644 hw/net/ne2000-pci.c
hw/net/Kconfig +5 -2
@@ -1,10 +1,14 @@ config DP8393X bool +config NE2000_COMMON + bool + config NE2000_PCI bool default y if PCI_DEVICES depends on PCI + select NE2000_COMMON config EEPRO100_PCI bool
@@ -51,8 +55,7 @@ config NE2000_ISA bool default y depends on ISA_BUS - depends on PCI # for NE2000State - select NE2000_PCI + select NE2000_COMMON config OPENCORES_ETH bool
hw/net/Makefile.objs +2 -1
@@ -1,8 +1,9 @@ common-obj-$(CONFIG_DP8393X) += dp8393x.o common-obj-$(CONFIG_XEN) += xen_nic.o +common-obj-$(CONFIG_NE2000_COMMON) += ne2000.o # PCI network cards -common-obj-$(CONFIG_NE2000_PCI) += ne2000.o +common-obj-$(CONFIG_NE2000_PCI) += ne2000-pci.o common-obj-$(CONFIG_EEPRO100_PCI) += eepro100.o common-obj-$(CONFIG_PCNET_PCI) += pcnet-pci.o common-obj-$(CONFIG_PCNET_COMMON) += pcnet.o
hw/net/ne2000-pci.c new file +132 -0
132 lines not on this page · raw message
hw/net/ne2000.c +0 -105
126 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Quoted 14 lines · Paolo Bonzini
The following changes since commit
e329ad2ab72c43b56df88b34954c2c7d839bb373:Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20190513' into staging (2019-05-14 10:08:47 +0100)
are available in the git repository at:
git://github.com/bonzini/qemu.gittags/for-upstreamfor you to fetch changes up to
88f1090e9020057022ac04531ca87d25f67f57ca:hw/net/ne2000: Extract the PCI device from the chipset common code (2019-05-15 11:56:54 +0200)
Quoted 8 lines
----------------------------------------------------------------
Mostly bugfixes and cleanups, the most important being "megasas: fix mapped frame size" from Peter Lieven. In addition, -realtime is marked as deprecated.----------------------------------------------------------------
Chen Zhang via Qemu-devel (1):
hvf: Add missing break statement
Hi -- looks like this commit needs its author email tidying up so it isn't attributed to the mailing list.
thanks
-- PMM
Quoted 4 lines · Peter Maydell
Quoted 2 lines
Chen Zhang via Qemu-devel (1):
hvf: Add missing break statementHi -- looks like this commit needs its author email tidying up so it isn't attributed to the mailing list.
Oops, it's the first time I see this. I'll fix and resend.
Paolo