* Add compat machines for QEMU 9.0

* Some header clean-ups by Philippe
 * Restrict type names to alphanumerical range (and a few special characters)
 * Fix analyze-migration.py script on s390x
 * Clean up and improve some tests
 * Document handling of commas in CLI options parameters
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmWCtYsRHHRodXRoQHJl
 ZGhhdC5jb20ACgkQLtnXdP5wLbWLnw//cNJrxG0V+j0iakX+C7HRumVrLBDI4KYY
 Cp2Hx92SyeQ0Kk8DJS6JueTV0SLjMsV77APu2YPH7ELmPlk+CB9gqmV7xVoYNvsm
 QbRPlIjFw8MHLekadc2A+C+pn48tWACoOdBEDIfazKrxybnf0B57RC/fIfMKHjbs
 2ALCoFbbgphs7yWuzTHK8ayKaGMhUVkWfzHQwpnq899olHyZBhkl951uKJA6VmLx
 KvggePkpszLjmmXA8MH1hDCcizki31cB0ZKTbQFCyE42s2S3Hvg0GueU90O7Y1cj
 lS5tPVQxyEhUYMLL+/hudlf2OYqVn2BalB7ieUQIy6rG8yoc9zxfIKQi0ccl+2oA
 s8HRq5S0bSjtilQogU1LQL/Gk6W1/N9MmnhKvCGB+BTK5KX7s4EQk02y9gGZm/8s
 pMErMyaXTG4dLiTAK42VgMVDqCYvzBmE+Gj91OmoUR7fb+VMrsWxeBFxMPDn+VtL
 TMJegIFsjw2QCSitcU4v+nP0qtKgXGbuZtrGXKabrxH5PmeQFJDSM7TwpTK4qvjK
 QMIQKBbz8BfJnUzN8qAaaJEpp1T5tcMJClKtfcgxq/+VyaSaHLmD0cljqBC+g+y7
 FTo+fa7oYx44sAlqapdEXBSGn4T+J26iuCef13CCCiPfYBv/tk3b2E0AWHj4y58I
 +VpInjUaPBQ=
 =TA1/
 -----END PGP SIGNATURE-----

Merge tag 'pull-request-2023-12-20' of https://gitlab.com/thuth/qemu into staging

* Add compat machines for QEMU 9.0
* Some header clean-ups by Philippe
* Restrict type names to alphanumerical range (and a few special characters)
* Fix analyze-migration.py script on s390x
* Clean up and improve some tests
* Document handling of commas in CLI options parameters

# -----BEGIN PGP SIGNATURE-----
#
# iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmWCtYsRHHRodXRoQHJl
# ZGhhdC5jb20ACgkQLtnXdP5wLbWLnw//cNJrxG0V+j0iakX+C7HRumVrLBDI4KYY
# Cp2Hx92SyeQ0Kk8DJS6JueTV0SLjMsV77APu2YPH7ELmPlk+CB9gqmV7xVoYNvsm
# QbRPlIjFw8MHLekadc2A+C+pn48tWACoOdBEDIfazKrxybnf0B57RC/fIfMKHjbs
# 2ALCoFbbgphs7yWuzTHK8ayKaGMhUVkWfzHQwpnq899olHyZBhkl951uKJA6VmLx
# KvggePkpszLjmmXA8MH1hDCcizki31cB0ZKTbQFCyE42s2S3Hvg0GueU90O7Y1cj
# lS5tPVQxyEhUYMLL+/hudlf2OYqVn2BalB7ieUQIy6rG8yoc9zxfIKQi0ccl+2oA
# s8HRq5S0bSjtilQogU1LQL/Gk6W1/N9MmnhKvCGB+BTK5KX7s4EQk02y9gGZm/8s
# pMErMyaXTG4dLiTAK42VgMVDqCYvzBmE+Gj91OmoUR7fb+VMrsWxeBFxMPDn+VtL
# TMJegIFsjw2QCSitcU4v+nP0qtKgXGbuZtrGXKabrxH5PmeQFJDSM7TwpTK4qvjK
# QMIQKBbz8BfJnUzN8qAaaJEpp1T5tcMJClKtfcgxq/+VyaSaHLmD0cljqBC+g+y7
# FTo+fa7oYx44sAlqapdEXBSGn4T+J26iuCef13CCCiPfYBv/tk3b2E0AWHj4y58I
# +VpInjUaPBQ=
# =TA1/
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 20 Dec 2023 04:36:11 EST
# gpg:                using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5
# gpg:                issuer "thuth@redhat.com"
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full]
# gpg:                 aka "Thomas Huth <thuth@redhat.com>" [full]
# gpg:                 aka "Thomas Huth <huth@tuxfamily.org>" [full]
# gpg:                 aka "Thomas Huth <th.huth@posteo.de>" [unknown]
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5

* tag 'pull-request-2023-12-20' of https://gitlab.com/thuth/qemu:
  tests/unit/test-qmp-event: Replace fixture by global variables
  tests/unit/test-qmp-event: Simplify event emission check
  tests/unit/test-qmp-event: Drop superfluous mutex
  tests/qtest/npcm7xx_pwm-test: Only do full testing in slow mode
  qemu-options: Clarify handling of commas in options parameters
  tests/qtest/migration-test: Fix analyze-migration.py for s390x
  qom/object: Limit type names to alphanumerical and some few special characters
  tests/unit/test-io-task: Rename "qemu:dummy" to avoid colon in the name
  memory: Remove "qemu:" prefix from the "qemu:ram-discard-manager" type name
  hw: Replace anti-social QOM type names (again)
  docs/system/arm: Fix for rename of type "xlnx.bbram-ctrl"
  target: Restrict 'sysemu/reset.h' to system emulation
  hw/s390x/ipl: Remove unused 'exec/exec-all.h' included header
  hw/misc/mips_itu: Remove unnecessary 'exec/exec-all.h' header
  hw/ppc/spapr_hcall: Remove unused 'exec/exec-all.h' included header
  system/qtest: Restrict QTest API to system emulation
  system/qtest: Include missing 'hw/core/cpu.h' header
  MAINTAINERS: Add some more vmware-related files to the corresponding section
  hw: Add compat machines for 9.0

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Stefan Hajnoczi 2023-12-20 09:40:15 -05:00
commit 191710c221
35 changed files with 239 additions and 114 deletions

View File

@ -2399,8 +2399,13 @@ F: hw/net/net_tx_pkt*
Vmware
M: Dmitry Fleytman <dmitry.fleytman@gmail.com>
S: Maintained
F: docs/specs/vmw_pvscsi-spec.txt
F: hw/display/vmware_vga.c
F: hw/net/vmxnet*
F: hw/scsi/vmw_pvscsi*
F: pc-bios/efi-vmxnet3.rom
F: pc-bios/vgabios-vmware.bin
F: roms/config.vga-vmware
F: tests/qtest/vmxnet3-test.c
F: docs/specs/vwm_pvscsi-spec.rst

View File

@ -194,7 +194,7 @@ To use a different index value, N, from default of 0, add:
.. code-block:: bash
-global xlnx,bbram-ctrl.drive-index=N
-global driver=xlnx.bbram-ctrl,property=drive-index,value=N
eFUSE File Backend
""""""""""""""""""
@ -212,7 +212,7 @@ To use a different index value, N, from default of 1, add:
.. code-block:: bash
-global xlnx,efuse.drive-index=N
-global xlnx-efuse.drive-index=N
.. warning::
In actual physical Versal, BBRAM and eFUSE contain sensitive data.

View File

@ -10,6 +10,11 @@ Invocation
disk_image is a raw hard disk image for IDE hard disk 0. Some targets do
not need a disk image.
When dealing with options parameters as arbitrary strings containing
commas, such as in "file=my,file" and "string=a,b", it's necessary to
double the commas. For instance,"-fw_cfg name=z,string=a,,b" will be
parsed as "-fw_cfg name=z,string=a,b".
.. hxtool-doc:: qemu-options.hx
Device URL Syntax

View File

@ -31,6 +31,11 @@ Options
disk_image is a raw hard disk image for IDE hard disk 0. Some targets do
not need a disk image.
When dealing with options parameters as arbitrary strings containing
commas, such as in "file=my,file" and "string=a,b", it's necessary to
double the commas. For instance,"-fw_cfg name=z,string=a,,b" will be
parsed as "-fw_cfg name=z,string=a,b".
.. hxtool-doc:: qemu-options.hx
.. include:: keys.rst.inc

View File

@ -3181,10 +3181,17 @@ static void machvirt_machine_init(void)
}
type_init(machvirt_machine_init);
static void virt_machine_8_2_options(MachineClass *mc)
static void virt_machine_9_0_options(MachineClass *mc)
{
}
DEFINE_VIRT_MACHINE_AS_LATEST(8, 2)
DEFINE_VIRT_MACHINE_AS_LATEST(9, 0)
static void virt_machine_8_2_options(MachineClass *mc)
{
virt_machine_9_0_options(mc);
compat_props_add(mc->compat_props, hw_compat_8_2, hw_compat_8_2_len);
}
DEFINE_VIRT_MACHINE(8, 2)
static void virt_machine_8_1_options(MachineClass *mc)
{

View File

@ -32,6 +32,9 @@
#include "hw/virtio/virtio-net.h"
#include "audio/audio.h"
GlobalProperty hw_compat_8_2[] = {};
const size_t hw_compat_8_2_len = G_N_ELEMENTS(hw_compat_8_2);
GlobalProperty hw_compat_8_1[] = {
{ TYPE_PCI_BRIDGE, "x-pci-express-writeable-slt-bug", "true" },
{ "ramfb", "x-migrate", "off" },

View File

@ -78,6 +78,9 @@
{ "qemu64-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, },\
{ "athlon-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, },
GlobalProperty pc_compat_8_2[] = {};
const size_t pc_compat_8_2_len = G_N_ELEMENTS(pc_compat_8_2);
GlobalProperty pc_compat_8_1[] = {};
const size_t pc_compat_8_1_len = G_N_ELEMENTS(pc_compat_8_1);

View File

@ -545,13 +545,26 @@ static void pc_i440fx_machine_options(MachineClass *m)
"Use a different south bridge than PIIX3");
}
static void pc_i440fx_8_2_machine_options(MachineClass *m)
static void pc_i440fx_9_0_machine_options(MachineClass *m)
{
pc_i440fx_machine_options(m);
m->alias = "pc";
m->is_default = true;
}
DEFINE_I440FX_MACHINE(v9_0, "pc-i440fx-9.0", NULL,
pc_i440fx_9_0_machine_options);
static void pc_i440fx_8_2_machine_options(MachineClass *m)
{
pc_i440fx_9_0_machine_options(m);
m->alias = NULL;
m->is_default = false;
compat_props_add(m->compat_props, hw_compat_8_2, hw_compat_8_2_len);
compat_props_add(m->compat_props, pc_compat_8_2, pc_compat_8_2_len);
}
DEFINE_I440FX_MACHINE(v8_2, "pc-i440fx-8.2", NULL,
pc_i440fx_8_2_machine_options);
@ -560,8 +573,6 @@ static void pc_i440fx_8_1_machine_options(MachineClass *m)
PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
pc_i440fx_8_2_machine_options(m);
m->alias = NULL;
m->is_default = false;
pcmc->broken_32bit_mem_addr_check = true;
compat_props_add(m->compat_props, hw_compat_8_1, hw_compat_8_1_len);

View File

@ -383,12 +383,23 @@ static void pc_q35_machine_options(MachineClass *m)
machine_class_allow_dynamic_sysbus_dev(m, TYPE_VMBUS_BRIDGE);
}
static void pc_q35_8_2_machine_options(MachineClass *m)
static void pc_q35_9_0_machine_options(MachineClass *m)
{
pc_q35_machine_options(m);
m->alias = "q35";
}
DEFINE_Q35_MACHINE(v9_0, "pc-q35-9.0", NULL,
pc_q35_9_0_machine_options);
static void pc_q35_8_2_machine_options(MachineClass *m)
{
pc_q35_9_0_machine_options(m);
m->alias = NULL;
compat_props_add(m->compat_props, hw_compat_8_2, hw_compat_8_2_len);
compat_props_add(m->compat_props, pc_compat_8_2, pc_compat_8_2_len);
}
DEFINE_Q35_MACHINE(v8_2, "pc-q35-8.2", NULL,
pc_q35_8_2_machine_options);

View File

@ -346,10 +346,17 @@ type_init(virt_machine_register_types)
} \
type_init(machvirt_machine_##major##_##minor##_init);
static void virt_machine_8_2_options(MachineClass *mc)
static void virt_machine_9_0_options(MachineClass *mc)
{
}
DEFINE_VIRT_MACHINE(8, 2, true)
DEFINE_VIRT_MACHINE(9, 0, true)
static void virt_machine_8_2_options(MachineClass *mc)
{
virt_machine_9_0_options(mc);
compat_props_add(mc->compat_props, hw_compat_8_2, hw_compat_8_2_len);
}
DEFINE_VIRT_MACHINE(8, 2, false)
static void virt_machine_8_1_options(MachineClass *mc)
{

View File

@ -22,9 +22,10 @@
#include "qemu/log.h"
#include "qemu/module.h"
#include "qapi/error.h"
#include "exec/exec-all.h"
#include "hw/core/cpu.h"
#include "hw/misc/mips_itu.h"
#include "hw/qdev-properties.h"
#include "target/mips/cpu.h"
#define ITC_TAG_ADDRSPACE_SZ (ITC_ADDRESSMAP_NUM * 8)
/* Initialize as 4kB area to fit all 32 cells with default 128B grain.

View File

@ -4786,14 +4786,25 @@ static void spapr_machine_latest_class_options(MachineClass *mc)
type_init(spapr_machine_register_##suffix)
/*
* pseries-8.2
* pseries-9.0
*/
static void spapr_machine_8_2_class_options(MachineClass *mc)
static void spapr_machine_9_0_class_options(MachineClass *mc)
{
/* Defaults for the latest behaviour inherited from the base class */
}
DEFINE_SPAPR_MACHINE(8_2, "8.2", true);
DEFINE_SPAPR_MACHINE(9_0, "9.0", true);
/*
* pseries-8.2
*/
static void spapr_machine_8_2_class_options(MachineClass *mc)
{
spapr_machine_9_0_class_options(mc);
compat_props_add(mc->compat_props, hw_compat_8_2, hw_compat_8_2_len);
}
DEFINE_SPAPR_MACHINE(8_2, "8.2", false);
/*
* pseries-8.1

View File

@ -8,7 +8,6 @@
#include "qemu/main-loop.h"
#include "qemu/module.h"
#include "qemu/error-report.h"
#include "exec/exec-all.h"
#include "exec/tb-flush.h"
#include "helper_regs.h"
#include "hw/ppc/ppc.h"

View File

@ -35,7 +35,6 @@
#include "qemu/cutils.h"
#include "qemu/option.h"
#include "standard-headers/linux/virtio_ids.h"
#include "exec/exec-all.h"
#define KERN_IMAGE_START 0x010000UL
#define LINUX_MAGIC_ADDR 0x010008UL

View File

@ -855,14 +855,26 @@ bool css_migration_enabled(void)
} \
type_init(ccw_machine_register_##suffix)
static void ccw_machine_9_0_instance_options(MachineState *machine)
{
}
static void ccw_machine_9_0_class_options(MachineClass *mc)
{
}
DEFINE_CCW_MACHINE(9_0, "9.0", true);
static void ccw_machine_8_2_instance_options(MachineState *machine)
{
ccw_machine_9_0_instance_options(machine);
}
static void ccw_machine_8_2_class_options(MachineClass *mc)
{
ccw_machine_9_0_class_options(mc);
compat_props_add(mc->compat_props, hw_compat_8_2, hw_compat_8_2_len);
}
DEFINE_CCW_MACHINE(8_2, "8.2", true);
DEFINE_CCW_MACHINE(8_2, "8.2", false);
static void ccw_machine_8_1_instance_options(MachineState *machine)
{

View File

@ -43,7 +43,7 @@ typedef struct IOMMUMemoryRegionClass IOMMUMemoryRegionClass;
DECLARE_OBJ_CHECKERS(IOMMUMemoryRegion, IOMMUMemoryRegionClass,
IOMMU_MEMORY_REGION, TYPE_IOMMU_MEMORY_REGION)
#define TYPE_RAM_DISCARD_MANAGER "qemu:ram-discard-manager"
#define TYPE_RAM_DISCARD_MANAGER "ram-discard-manager"
typedef struct RamDiscardManagerClass RamDiscardManagerClass;
typedef struct RamDiscardManager RamDiscardManager;
DECLARE_OBJ_CHECKERS(RamDiscardManager, RamDiscardManagerClass,

View File

@ -419,6 +419,9 @@ struct MachineState {
} \
type_init(machine_initfn##_register_types)
extern GlobalProperty hw_compat_8_2[];
extern const size_t hw_compat_8_2_len;
extern GlobalProperty hw_compat_8_1[];
extern const size_t hw_compat_8_1_len;

View File

@ -210,6 +210,9 @@ void pc_madt_cpu_entry(int uid, const CPUArchIdList *apic_ids,
/* sgx.c */
void pc_machine_init_sgx_epc(PCMachineState *pcms);
extern GlobalProperty pc_compat_8_2[];
extern const size_t pc_compat_8_2_len;
extern GlobalProperty pc_compat_8_1[];
extern const size_t pc_compat_8_1_len;

View File

@ -23,7 +23,7 @@
#include "hw/misc/xlnx-versal-cfu.h"
#include "qemu/fifo32.h"
#define TYPE_XLNX_VERSAL_CFRAME_REG "xlnx,cframe-reg"
#define TYPE_XLNX_VERSAL_CFRAME_REG "xlnx-cframe-reg"
OBJECT_DECLARE_SIMPLE_TYPE(XlnxVersalCFrameReg, XLNX_VERSAL_CFRAME_REG)
#define TYPE_XLNX_VERSAL_CFRAME_BCAST_REG "xlnx.cframe-bcast-reg"

View File

@ -22,13 +22,13 @@
#include "hw/misc/xlnx-cfi-if.h"
#include "qemu/fifo32.h"
#define TYPE_XLNX_VERSAL_CFU_APB "xlnx,versal-cfu-apb"
#define TYPE_XLNX_VERSAL_CFU_APB "xlnx-versal-cfu-apb"
OBJECT_DECLARE_SIMPLE_TYPE(XlnxVersalCFUAPB, XLNX_VERSAL_CFU_APB)
#define TYPE_XLNX_VERSAL_CFU_FDRO "xlnx,versal-cfu-fdro"
#define TYPE_XLNX_VERSAL_CFU_FDRO "xlnx-versal-cfu-fdro"
OBJECT_DECLARE_SIMPLE_TYPE(XlnxVersalCFUFDRO, XLNX_VERSAL_CFU_FDRO)
#define TYPE_XLNX_VERSAL_CFU_SFR "xlnx,versal-cfu-sfr"
#define TYPE_XLNX_VERSAL_CFU_SFR "xlnx-versal-cfu-sfr"
OBJECT_DECLARE_SIMPLE_TYPE(XlnxVersalCFUSFR, XLNX_VERSAL_CFU_SFR)
REG32(CFU_ISR, 0x0)

View File

@ -13,7 +13,7 @@
#include "hw/register.h"
#include "target/arm/cpu.h"
#define TYPE_XLNX_VERSAL_CRL "xlnx,versal-crl"
#define TYPE_XLNX_VERSAL_CRL "xlnx-versal-crl"
OBJECT_DECLARE_SIMPLE_TYPE(XlnxVersalCRL, XLNX_VERSAL_CRL)
REG32(ERR_CTRL, 0x0)

View File

@ -30,7 +30,7 @@
#include "sysemu/block-backend.h"
#include "hw/qdev-core.h"
#define TYPE_XLNX_EFUSE "xlnx,efuse"
#define TYPE_XLNX_EFUSE "xlnx-efuse"
OBJECT_DECLARE_SIMPLE_TYPE(XlnxEFuse, XLNX_EFUSE);
struct XlnxEFuse {

View File

@ -29,8 +29,8 @@
#define XLNX_VERSAL_EFUSE_CTRL_R_MAX ((0x100 / 4) + 1)
#define TYPE_XLNX_VERSAL_EFUSE_CTRL "xlnx,versal-efuse"
#define TYPE_XLNX_VERSAL_EFUSE_CACHE "xlnx,pmc-efuse-cache"
#define TYPE_XLNX_VERSAL_EFUSE_CTRL "xlnx-versal-efuse"
#define TYPE_XLNX_VERSAL_EFUSE_CACHE "xlnx-pmc-efuse-cache"
OBJECT_DECLARE_SIMPLE_TYPE(XlnxVersalEFuseCtrl, XLNX_VERSAL_EFUSE_CTRL);
OBJECT_DECLARE_SIMPLE_TYPE(XlnxVersalEFuseCache, XLNX_VERSAL_EFUSE_CACHE);

View File

@ -29,7 +29,7 @@
#define XLNX_ZYNQMP_EFUSE_R_MAX ((0x10fc / 4) + 1)
#define TYPE_XLNX_ZYNQMP_EFUSE "xlnx,zynqmp-efuse"
#define TYPE_XLNX_ZYNQMP_EFUSE "xlnx-zynqmp-efuse"
OBJECT_DECLARE_SIMPLE_TYPE(XlnxZynqMPEFuse, XLNX_ZYNQMP_EFUSE);
struct XlnxZynqMPEFuse {

View File

@ -23,6 +23,7 @@ static inline bool qtest_enabled(void)
return qtest_allowed;
}
#ifndef CONFIG_USER_ONLY
void qtest_send_prefix(CharBackend *chr);
void G_GNUC_PRINTF(2, 3) qtest_sendf(CharBackend *chr, const char *fmt, ...);
void qtest_set_command_cb(bool (*pc_cb)(CharBackend *chr, gchar **words));
@ -35,5 +36,6 @@ void qtest_server_set_send_handler(void (*send)(void *, const char *),
void qtest_server_inproc_recv(void *opaque, const char *buf);
int64_t qtest_get_virtual_clock(void);
#endif
#endif

View File

@ -4086,9 +4086,13 @@ DEF("fw_cfg", HAS_ARG, QEMU_OPTION_fwcfg,
SRST
``-fw_cfg [name=]name,file=file``
Add named fw\_cfg entry with contents from file file.
If the filename contains comma, you must double it (for instance,
"file=my,,file" to use file "my,file").
``-fw_cfg [name=]name,string=str``
Add named fw\_cfg entry with contents from string str.
If the string contains comma, you must double it (for instance,
"string=my,,string" to use file "my,string").
The terminating NUL character of the contents of str will not be
included as part of the fw\_cfg item data. To insert contents with

View File

@ -138,9 +138,50 @@ static TypeImpl *type_new(const TypeInfo *info)
return ti;
}
static bool type_name_is_valid(const char *name)
{
const int slen = strlen(name);
int plen;
g_assert(slen > 1);
/*
* Ideally, the name should start with a letter - however, we've got
* too many names starting with a digit already, so allow digits here,
* too (except '0' which is not used yet)
*/
if (!g_ascii_isalnum(name[0]) || name[0] == '0') {
return false;
}
plen = strspn(name, "abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"0123456789-_.");
/* Allow some legacy names with '+' in it for compatibility reasons */
if (name[plen] == '+') {
if (plen == 6 && g_str_has_prefix(name, "power")) {
/* Allow "power5+" and "power7+" CPU names*/
return true;
}
if (plen >= 17 && g_str_has_prefix(name, "Sun-UltraSparc-I")) {
/* Allow "Sun-UltraSparc-IV+" and "Sun-UltraSparc-IIIi+" */
return true;
}
}
return plen == slen;
}
static TypeImpl *type_register_internal(const TypeInfo *info)
{
TypeImpl *ti;
if (!type_name_is_valid(info->name)) {
fprintf(stderr, "Registering '%s' with illegal type name\n", info->name);
abort();
}
ti = type_new(info);
type_table_add(ti);

View File

@ -263,6 +263,34 @@ class HTABSection(object):
return ""
class S390StorageAttributes(object):
STATTR_FLAG_EOS = 0x01
STATTR_FLAG_MORE = 0x02
STATTR_FLAG_ERROR = 0x04
STATTR_FLAG_DONE = 0x08
def __init__(self, file, version_id, device, section_key):
if version_id != 0:
raise Exception("Unknown storage_attributes version %d" % version_id)
self.file = file
self.section_key = section_key
def read(self):
while True:
addr_flags = self.file.read64()
flags = addr_flags & 0xfff
if (flags & (self.STATTR_FLAG_DONE | self.STATTR_FLAG_EOS)):
return
if (flags & self.STATTR_FLAG_ERROR):
raise Exception("Error in migration stream")
count = self.file.read64()
self.file.readvar(count)
def getDict(self):
return ""
class ConfigurationSection(object):
def __init__(self, file, desc):
self.file = file
@ -544,8 +572,11 @@ class MigrationDump(object):
QEMU_VM_SECTION_FOOTER= 0x7e
def __init__(self, filename):
self.section_classes = { ( 'ram', 0 ) : [ RamSection, None ],
( 'spapr/htab', 0) : ( HTABSection, None ) }
self.section_classes = {
( 'ram', 0 ) : [ RamSection, None ],
( 's390-storage_attributes', 0 ) : [ S390StorageAttributes, None],
( 'spapr/htab', 0) : ( HTABSection, None )
}
self.filename = filename
self.vmsd_desc = None

View File

@ -21,6 +21,7 @@
#include "exec/tswap.h"
#include "hw/qdev-core.h"
#include "hw/irq.h"
#include "hw/core/cpu.h"
#include "qemu/accel.h"
#include "sysemu/cpu-timers.h"
#include "qemu/config-file.h"

View File

@ -24,7 +24,6 @@
#include "qemu/hw-version.h"
#include "cpu.h"
#include "tcg/helper-tcg.h"
#include "sysemu/reset.h"
#include "sysemu/hvf.h"
#include "hvf/hvf-i386.h"
#include "kvm/kvm_i386.h"
@ -37,6 +36,7 @@
#include "hw/qdev-properties.h"
#include "hw/i386/topology.h"
#ifndef CONFIG_USER_ONLY
#include "sysemu/reset.h"
#include "qapi/qapi-commands-machine-target.h"
#include "exec/address-spaces.h"
#include "hw/boards.h"

View File

@ -17,7 +17,9 @@
#include "internals.h"
#include "fpu/softfloat-helpers.h"
#include "cpu-csr.h"
#ifndef CONFIG_USER_ONLY
#include "sysemu/reset.h"
#endif
#include "tcg/tcg.h"
#include "vec.h"

View File

@ -3360,9 +3360,7 @@ int main(int argc, char **argv)
qtest_add_func("/migration/bad_dest", test_baddest);
#ifndef _WIN32
if (!g_str_equal(arch, "s390x")) {
qtest_add_func("/migration/analyze-script", test_analyze_script);
}
qtest_add_func("/migration/analyze-script", test_analyze_script);
#endif
qtest_add_func("/migration/precopy/unix/plain", test_precopy_unix_plain);
qtest_add_func("/migration/precopy/unix/xbzrle", test_precopy_unix_xbzrle);

View File

@ -606,6 +606,7 @@ static void test_toggle(gconstpointer test_data)
uint32_t ppr, csr, pcr, cnr, cmr;
int i, j, k, l;
uint64_t expected_freq, expected_duty;
int cnr_step = g_test_quick() ? 2 : 1;
mft_init(qts, td);
@ -618,7 +619,7 @@ static void test_toggle(gconstpointer test_data)
csr = csr_list[j];
pwm_write_csr(qts, td, csr);
for (k = 0; k < ARRAY_SIZE(cnr_list); ++k) {
for (k = 0; k < ARRAY_SIZE(cnr_list); k += cnr_step) {
cnr = cnr_list[k];
pwm_write_cnr(qts, td, cnr);
@ -678,6 +679,7 @@ static void pwm_add_test(const char *name, const TestData* td,
int main(int argc, char **argv)
{
TestData test_data_list[ARRAY_SIZE(pwm_module_list) * ARRAY_SIZE(pwm_list)];
int pwm_module_list_cnt = 1, pwm_list_cnt = 1;
char *v_env = getenv("V");
@ -687,8 +689,13 @@ int main(int argc, char **argv)
g_test_init(&argc, &argv, NULL);
for (int i = 0; i < ARRAY_SIZE(pwm_module_list); ++i) {
for (int j = 0; j < ARRAY_SIZE(pwm_list); ++j) {
if (!g_test_quick()) {
pwm_module_list_cnt = ARRAY_SIZE(pwm_module_list);
pwm_list_cnt = ARRAY_SIZE(pwm_list);
}
for (int i = 0; i < pwm_module_list_cnt; ++i) {
for (int j = 0; j < pwm_list_cnt; ++j) {
TestData *td = &test_data_list[i * ARRAY_SIZE(pwm_list) + j];
td->module = &pwm_module_list[i];

View File

@ -25,7 +25,7 @@
#include "qapi/error.h"
#include "qemu/module.h"
#define TYPE_DUMMY "qemu:dummy"
#define TYPE_DUMMY "qemu-dummy"
typedef struct DummyObject DummyObject;
typedef struct DummyObjectClass DummyObjectClass;

View File

@ -24,19 +24,15 @@
#include "test-qapi-events.h"
#include "test-qapi-emit-events.h"
typedef struct TestEventData {
QDict *expect;
bool emitted;
} TestEventData;
TestEventData *test_event_data;
static GMutex test_event_lock;
static QDict *expected_event;
void test_qapi_event_emit(test_QAPIEvent event, QDict *d)
{
QDict *t;
int64_t s, ms;
g_assert(expected_event);
/* Verify that we have timestamp, then remove it to compare other fields */
t = qdict_get_qdict(d, "timestamp");
g_assert(t);
@ -52,71 +48,38 @@ void test_qapi_event_emit(test_QAPIEvent event, QDict *d)
qdict_del(d, "timestamp");
g_assert(qobject_is_equal(QOBJECT(d), QOBJECT(test_event_data->expect)));
test_event_data->emitted = true;
g_assert(qobject_is_equal(QOBJECT(d), QOBJECT(expected_event)));
qobject_unref(expected_event);
expected_event = NULL;
}
static void event_prepare(TestEventData *data,
const void *unused)
static void test_event_a(void)
{
/* Global variable test_event_data was used to pass the expectation, so
test cases can't be executed at same time. */
g_mutex_lock(&test_event_lock);
test_event_data = data;
}
static void event_teardown(TestEventData *data,
const void *unused)
{
test_event_data = NULL;
g_mutex_unlock(&test_event_lock);
}
static void event_test_add(const char *testpath,
void (*test_func)(TestEventData *data,
const void *user_data))
{
g_test_add(testpath, TestEventData, NULL, event_prepare, test_func,
event_teardown);
}
/* Test cases */
static void test_event_a(TestEventData *data,
const void *unused)
{
data->expect = qdict_from_jsonf_nofail("{ 'event': 'EVENT_A' }");
expected_event = qdict_from_jsonf_nofail("{ 'event': 'EVENT_A' }");
qapi_event_send_event_a();
g_assert(data->emitted);
qobject_unref(data->expect);
g_assert(!expected_event);
}
static void test_event_b(TestEventData *data,
const void *unused)
static void test_event_b(void)
{
data->expect = qdict_from_jsonf_nofail("{ 'event': 'EVENT_B' }");
expected_event = qdict_from_jsonf_nofail("{ 'event': 'EVENT_B' }");
qapi_event_send_event_b();
g_assert(data->emitted);
qobject_unref(data->expect);
g_assert(!expected_event);
}
static void test_event_c(TestEventData *data,
const void *unused)
static void test_event_c(void)
{
UserDefOne b = { .integer = 2, .string = (char *)"test1" };
data->expect = qdict_from_jsonf_nofail(
expected_event = qdict_from_jsonf_nofail(
"{ 'event': 'EVENT_C', 'data': {"
" 'a': 1, 'b': { 'integer': 2, 'string': 'test1' }, 'c': 'test2' } }");
qapi_event_send_event_c(true, 1, &b, "test2");
g_assert(data->emitted);
qobject_unref(data->expect);
g_assert(!expected_event);
}
/* Complex type */
static void test_event_d(TestEventData *data,
const void *unused)
static void test_event_d(void)
{
UserDefOne struct1 = {
.integer = 2, .string = (char *)"test1",
@ -129,65 +92,56 @@ static void test_event_d(TestEventData *data,
.enum2 = ENUM_ONE_VALUE2,
};
data->expect = qdict_from_jsonf_nofail(
expected_event = qdict_from_jsonf_nofail(
"{ 'event': 'EVENT_D', 'data': {"
" 'a': {"
" 'struct1': { 'integer': 2, 'string': 'test1', 'enum1': 'value1' },"
" 'string': 'test2', 'enum2': 'value2' },"
" 'b': 'test3', 'enum3': 'value3' } }");
qapi_event_send_event_d(&a, "test3", NULL, true, ENUM_ONE_VALUE3);
g_assert(data->emitted);
qobject_unref(data->expect);
g_assert(!expected_event);
}
static void test_event_deprecated(TestEventData *data, const void *unused)
static void test_event_deprecated(void)
{
data->expect = qdict_from_jsonf_nofail("{ 'event': 'TEST_EVENT_FEATURES1' }");
expected_event = qdict_from_jsonf_nofail("{ 'event': 'TEST_EVENT_FEATURES1' }");
memset(&compat_policy, 0, sizeof(compat_policy));
qapi_event_send_test_event_features1();
g_assert(data->emitted);
g_assert(!expected_event);
compat_policy.has_deprecated_output = true;
compat_policy.deprecated_output = COMPAT_POLICY_OUTPUT_HIDE;
data->emitted = false;
qapi_event_send_test_event_features1();
g_assert(!data->emitted);
qobject_unref(data->expect);
}
static void test_event_deprecated_data(TestEventData *data, const void *unused)
static void test_event_deprecated_data(void)
{
memset(&compat_policy, 0, sizeof(compat_policy));
data->expect = qdict_from_jsonf_nofail("{ 'event': 'TEST_EVENT_FEATURES0',"
expected_event = qdict_from_jsonf_nofail("{ 'event': 'TEST_EVENT_FEATURES0',"
" 'data': { 'foo': 42 } }");
qapi_event_send_test_event_features0(42);
g_assert(data->emitted);
g_assert(!expected_event);
qobject_unref(data->expect);
compat_policy.has_deprecated_output = true;
compat_policy.deprecated_output = COMPAT_POLICY_OUTPUT_HIDE;
data->expect = qdict_from_jsonf_nofail("{ 'event': 'TEST_EVENT_FEATURES0' }");
expected_event = qdict_from_jsonf_nofail("{ 'event': 'TEST_EVENT_FEATURES0' }");
qapi_event_send_test_event_features0(42);
g_assert(data->emitted);
qobject_unref(data->expect);
}
int main(int argc, char **argv)
{
g_test_init(&argc, &argv, NULL);
event_test_add("/event/event_a", test_event_a);
event_test_add("/event/event_b", test_event_b);
event_test_add("/event/event_c", test_event_c);
event_test_add("/event/event_d", test_event_d);
event_test_add("/event/deprecated", test_event_deprecated);
event_test_add("/event/deprecated_data", test_event_deprecated_data);
g_test_add_func("/event/event_a", test_event_a);
g_test_add_func("/event/event_b", test_event_b);
g_test_add_func("/event/event_c", test_event_c);
g_test_add_func("/event/event_d", test_event_d);
g_test_add_func("/event/deprecated", test_event_deprecated);
g_test_add_func("/event/deprecated_data", test_event_deprecated_data);
g_test_run();
return 0;