aboutsummaryrefslogtreecommitdiff
path: root/tests/qtest
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2024-07-03 20:54:17 -0700
committerRichard Henderson <richard.henderson@linaro.org>2024-07-03 20:54:17 -0700
commit1406b7fc4bbaab42133b1ef03270179746e91723 (patch)
tree06417fdecf690ec74b83d1a30a3f7f87fabeaf10 /tests/qtest
parent7914bda497f07965f15a91905cd7ed9eaf1c1092 (diff)
parent6a67577d8003428bdbeba61d32a9f8158f12624b (diff)
downloadqemu-1406b7fc4bbaab42133b1ef03270179746e91723.zip
qemu-1406b7fc4bbaab42133b1ef03270179746e91723.tar.gz
qemu-1406b7fc4bbaab42133b1ef03270179746e91723.tar.bz2
Merge tag 'for_upstream' of https://git.kernel.org/pub/scm/virt/kvm/mst/qemu into staging
virtio: features,fixes A bunch of improvements: - vhost dirty log is now only scanned once, not once per device - virtio and vhost now support VIRTIO_F_NOTIFICATION_DATA - cxl gained DCD emulation support - pvpanic gained shutdown support - beginning of patchset for Generic Port Affinity Structure - s3 support - friendlier error messages when boot fails on some illegal configs - for vhost-user, VHOST_USER_SET_LOG_BASE is now only sent once - part of vhost-user support for any POSIX system - not yet enabled due to qtest failures - sr-iov VF setup code has been reworked significantly - new tests, particularly for risc-v ACPI - bugfixes Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # -----BEGIN PGP SIGNATURE----- # # iQFDBAABCAAtFiEEXQn9CHHI+FuUyooNKB8NuNKNVGkFAmaF068PHG1zdEByZWRo # YXQuY29tAAoJECgfDbjSjVRp+DMIAMC//mBXIZlPprfhb5cuZklxYi31Acgu5TUr # njqjCkN+mFhXXZuc3B67xmrQ066IEPtsbzCjSnzuU41YK4tjvO1g+LgYJBv41G16 # va2k8vFM5pdvRA+UC9li1CCIPxiEcszxOdzZemj3szWLVLLUmwsc5OZLWWeFA5m8 # vXrrT9miODUz3z8/Xn/TVpxnmD6glKYIRK/IJRzzC4Qqqwb5H3ji/BJV27cDUtdC # w6ns5RYIj5j4uAiG8wQNDggA1bMsTxFxThRDUwxlxaIwAcexrf1oRnxGRePA7PVG # BXrt5yodrZYR2sR6svmOOIF3wPMUDKdlAItTcEgYyxaVo5rAdpc= # =p9h4 # -----END PGP SIGNATURE----- # gpg: Signature made Wed 03 Jul 2024 03:41:51 PM PDT # gpg: using RSA key 5D09FD0871C8F85B94CA8A0D281F0DB8D28D5469 # gpg: issuer "mst@redhat.com" # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" [undefined] # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" [undefined] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 0270 606B 6F3C DF3D 0B17 0970 C350 3912 AFBE 8E67 # Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA 8A0D 281F 0DB8 D28D 5469 * tag 'for_upstream' of https://git.kernel.org/pub/scm/virt/kvm/mst/qemu: (85 commits) hw/pci: Replace -1 with UINT32_MAX for romsize pcie_sriov: Register VFs after migration pcie_sriov: Remove num_vfs from PCIESriovPF pcie_sriov: Release VFs failed to realize pcie_sriov: Reuse SR-IOV VF device instances pcie_sriov: Ensure VF function number does not overflow pcie_sriov: Do not manually unrealize hw/ppc/spapr_pci: Do not reject VFs created after a PF hw/ppc/spapr_pci: Do not create DT for disabled PCI device hw/pci: Rename has_power to enabled virtio-iommu: Clear IOMMUDevice when VFIO device is unplugged virtio: remove virtio_tswap16s() call in vring_packed_event_read() hw/cxl/events: Mark cxl-add-dynamic-capacity and cxl-release-dynamic-capcity unstable hw/cxl/events: Improve QMP interfaces and documentation for add/release dynamic capacity. tests/data/acpi/rebuild-expected-aml.sh: Add RISC-V pc-bios/meson.build: Add support for RISC-V in unpack_edk2_blobs meson.build: Add RISC-V to the edk2-target list tests/data/acpi/virt: Move ARM64 ACPI tables under aarch64/${machine} path tests/data/acpi: Move x86 ACPI tables under x86/${machine} path tests/qtest/bios-tables-test.c: Set "arch" for x86 tests ... Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tests/qtest')
-rw-r--r--tests/qtest/bios-tables-test.c143
-rw-r--r--tests/qtest/meson.build3
-rw-r--r--tests/qtest/pvpanic-pci-test.c44
-rw-r--r--tests/qtest/pvpanic-test.c34
-rw-r--r--tests/qtest/vhost-user-blk-test.c2
-rw-r--r--tests/qtest/vhost-user-test.c28
6 files changed, 216 insertions, 38 deletions
diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index d1ff4db..f4c4704 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -78,6 +78,7 @@
typedef struct {
bool tcg_only;
const char *machine;
+ const char *arch;
const char *machine_param;
const char *variant;
const char *uefi_fl1;
@@ -262,8 +263,19 @@ static void dump_aml_files(test_data *data, bool rebuild)
g_assert(exp_sdt->aml);
if (rebuild) {
- aml_file = g_strdup_printf("%s/%s/%.4s%s", data_dir, data->machine,
+ aml_file = g_strdup_printf("%s/%s/%s/%.4s%s", data_dir,
+ data->arch, data->machine,
sdt->aml, ext);
+
+ /*
+ * To keep test cases not failing before the DATA files are moved to
+ * ${arch}/${machine} folder, add this check as well.
+ */
+ if (!g_file_test(aml_file, G_FILE_TEST_EXISTS)) {
+ aml_file = g_strdup_printf("%s/%s/%.4s%s", data_dir,
+ data->machine, sdt->aml, ext);
+ }
+
if (!g_file_test(aml_file, G_FILE_TEST_EXISTS) &&
sdt->aml_len == exp_sdt->aml_len &&
!memcmp(sdt->aml, exp_sdt->aml, sdt->aml_len)) {
@@ -398,8 +410,13 @@ static GArray *load_expected_aml(test_data *data)
memset(&exp_sdt, 0, sizeof(exp_sdt));
try_again:
- aml_file = g_strdup_printf("%s/%s/%.4s%s", data_dir, data->machine,
- sdt->aml, ext);
+ aml_file = g_strdup_printf("%s/%s/%s/%.4s%s", data_dir, data->arch,
+ data->machine, sdt->aml, ext);
+ if (!g_file_test(aml_file, G_FILE_TEST_EXISTS)) {
+ aml_file = g_strdup_printf("%s/%s/%.4s%s", data_dir, data->machine,
+ sdt->aml, ext);
+ }
+
if (verbosity_level >= 2) {
fprintf(stderr, "Looking for expected file '%s'\n", aml_file);
}
@@ -916,6 +933,7 @@ static void test_acpi_piix4_tcg(void)
* This is to make guest actually run.
*/
data.machine = MACHINE_PC;
+ data.arch = "x86";
data.required_struct_types = base_required_struct_types;
data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
test_acpi_one(NULL, &data);
@@ -927,6 +945,7 @@ static void test_acpi_piix4_tcg_bridge(void)
test_data data = {};
data.machine = MACHINE_PC;
+ data.arch = "x86";
data.variant = ".bridge";
data.required_struct_types = base_required_struct_types;
data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
@@ -964,6 +983,7 @@ static void test_acpi_piix4_no_root_hotplug(void)
test_data data = {};
data.machine = MACHINE_PC;
+ data.arch = "x86";
data.variant = ".roothp";
data.required_struct_types = base_required_struct_types;
data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
@@ -980,6 +1000,7 @@ static void test_acpi_piix4_no_bridge_hotplug(void)
test_data data = {};
data.machine = MACHINE_PC;
+ data.arch = "x86";
data.variant = ".hpbridge";
data.required_struct_types = base_required_struct_types;
data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
@@ -996,6 +1017,7 @@ static void test_acpi_piix4_no_acpi_pci_hotplug(void)
test_data data = {};
data.machine = MACHINE_PC;
+ data.arch = "x86";
data.variant = ".hpbrroot";
data.required_struct_types = base_required_struct_types;
data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
@@ -1017,6 +1039,7 @@ static void test_acpi_q35_tcg(void)
test_data data = {};
data.machine = MACHINE_Q35;
+ data.arch = "x86";
data.required_struct_types = base_required_struct_types;
data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
test_acpi_one(NULL, &data);
@@ -1032,6 +1055,7 @@ static void test_acpi_q35_kvm_type4_count(void)
{
test_data data = {
.machine = MACHINE_Q35,
+ .arch = "x86",
.variant = ".type4-count",
.required_struct_types = base_required_struct_types,
.required_struct_types_len = ARRAY_SIZE(base_required_struct_types),
@@ -1048,6 +1072,7 @@ static void test_acpi_q35_kvm_core_count(void)
{
test_data data = {
.machine = MACHINE_Q35,
+ .arch = "x86",
.variant = ".core-count",
.required_struct_types = base_required_struct_types,
.required_struct_types_len = ARRAY_SIZE(base_required_struct_types),
@@ -1065,6 +1090,7 @@ static void test_acpi_q35_kvm_core_count2(void)
{
test_data data = {
.machine = MACHINE_Q35,
+ .arch = "x86",
.variant = ".core-count2",
.required_struct_types = base_required_struct_types,
.required_struct_types_len = ARRAY_SIZE(base_required_struct_types),
@@ -1082,6 +1108,7 @@ static void test_acpi_q35_kvm_thread_count(void)
{
test_data data = {
.machine = MACHINE_Q35,
+ .arch = "x86",
.variant = ".thread-count",
.required_struct_types = base_required_struct_types,
.required_struct_types_len = ARRAY_SIZE(base_required_struct_types),
@@ -1099,6 +1126,7 @@ static void test_acpi_q35_kvm_thread_count2(void)
{
test_data data = {
.machine = MACHINE_Q35,
+ .arch = "x86",
.variant = ".thread-count2",
.required_struct_types = base_required_struct_types,
.required_struct_types_len = ARRAY_SIZE(base_required_struct_types),
@@ -1117,6 +1145,7 @@ static void test_acpi_q35_tcg_bridge(void)
test_data data = {};
data.machine = MACHINE_Q35;
+ data.arch = "x86",
data.variant = ".bridge";
data.required_struct_types = base_required_struct_types;
data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
@@ -1131,6 +1160,7 @@ static void test_acpi_q35_tcg_no_acpi_hotplug(void)
test_data data = {};
data.machine = MACHINE_Q35;
+ data.arch = "x86",
data.variant = ".noacpihp";
data.required_struct_types = base_required_struct_types;
data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
@@ -1159,6 +1189,7 @@ static void test_acpi_q35_multif_bridge(void)
{
test_data data = {
.machine = MACHINE_Q35,
+ .arch = "x86",
.variant = ".multi-bridge",
};
test_vm_prepare("-S"
@@ -1208,6 +1239,7 @@ static void test_acpi_q35_tcg_mmio64(void)
{
test_data data = {
.machine = MACHINE_Q35,
+ .arch = "x86",
.variant = ".mmio64",
.tcg_only = true,
.required_struct_types = base_required_struct_types,
@@ -1228,6 +1260,7 @@ static void test_acpi_piix4_tcg_cphp(void)
test_data data = {};
data.machine = MACHINE_PC;
+ data.arch = "x86";
data.variant = ".cphp";
test_acpi_one("-smp 2,cores=3,sockets=2,maxcpus=6"
" -object memory-backend-ram,id=ram0,size=64M"
@@ -1243,6 +1276,7 @@ static void test_acpi_q35_tcg_cphp(void)
test_data data = {};
data.machine = MACHINE_Q35;
+ data.arch = "x86",
data.variant = ".cphp";
test_acpi_one(" -smp 2,cores=3,sockets=2,maxcpus=6"
" -object memory-backend-ram,id=ram0,size=64M"
@@ -1262,6 +1296,7 @@ static void test_acpi_q35_tcg_ipmi(void)
test_data data = {};
data.machine = MACHINE_Q35;
+ data.arch = "x86",
data.variant = ".ipmibt";
data.required_struct_types = ipmi_required_struct_types;
data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types);
@@ -1276,6 +1311,7 @@ static void test_acpi_q35_tcg_smbus_ipmi(void)
test_data data = {};
data.machine = MACHINE_Q35;
+ data.arch = "x86",
data.variant = ".ipmismbus";
data.required_struct_types = ipmi_required_struct_types;
data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types);
@@ -1293,6 +1329,7 @@ static void test_acpi_piix4_tcg_ipmi(void)
* This is to make guest actually run.
*/
data.machine = MACHINE_PC;
+ data.arch = "x86";
data.variant = ".ipmikcs";
data.required_struct_types = ipmi_required_struct_types;
data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types);
@@ -1307,6 +1344,7 @@ static void test_acpi_q35_tcg_memhp(void)
test_data data = {};
data.machine = MACHINE_Q35;
+ data.arch = "x86",
data.variant = ".memhp";
test_acpi_one(" -m 128,slots=3,maxmem=1G"
" -object memory-backend-ram,id=ram0,size=64M"
@@ -1322,6 +1360,7 @@ static void test_acpi_piix4_tcg_memhp(void)
test_data data = {};
data.machine = MACHINE_PC;
+ data.arch = "x86";
data.variant = ".memhp";
test_acpi_one(" -m 128,slots=3,maxmem=1G"
" -object memory-backend-ram,id=ram0,size=64M"
@@ -1337,6 +1376,7 @@ static void test_acpi_piix4_tcg_nosmm(void)
test_data data = {};
data.machine = MACHINE_PC;
+ data.arch = "x86";
data.variant = ".nosmm";
test_acpi_one("-machine smm=off", &data);
free_test_data(&data);
@@ -1347,6 +1387,7 @@ static void test_acpi_piix4_tcg_smm_compat(void)
test_data data = {};
data.machine = MACHINE_PC;
+ data.arch = "x86";
data.variant = ".smm-compat";
test_acpi_one("-global PIIX4_PM.smm-compat=on", &data);
free_test_data(&data);
@@ -1357,6 +1398,7 @@ static void test_acpi_piix4_tcg_smm_compat_nosmm(void)
test_data data = {};
data.machine = MACHINE_PC;
+ data.arch = "x86";
data.variant = ".smm-compat-nosmm";
test_acpi_one("-global PIIX4_PM.smm-compat=on -machine smm=off", &data);
free_test_data(&data);
@@ -1367,6 +1409,7 @@ static void test_acpi_piix4_tcg_nohpet(void)
test_data data = {};
data.machine = MACHINE_PC;
+ data.arch = "x86";
data.machine_param = ",hpet=off";
data.variant = ".nohpet";
test_acpi_one(NULL, &data);
@@ -1378,6 +1421,7 @@ static void test_acpi_q35_tcg_numamem(void)
test_data data = {};
data.machine = MACHINE_Q35;
+ data.arch = "x86",
data.variant = ".numamem";
test_acpi_one(" -object memory-backend-ram,id=ram0,size=128M"
" -numa node -numa node,memdev=ram0", &data);
@@ -1389,6 +1433,7 @@ static void test_acpi_q35_kvm_xapic(void)
test_data data = {};
data.machine = MACHINE_Q35;
+ data.arch = "x86",
data.variant = ".xapic";
test_acpi_one(" -object memory-backend-ram,id=ram0,size=128M"
" -numa node -numa node,memdev=ram0"
@@ -1401,6 +1446,7 @@ static void test_acpi_q35_tcg_nosmm(void)
test_data data = {};
data.machine = MACHINE_Q35;
+ data.arch = "x86",
data.variant = ".nosmm";
test_acpi_one("-machine smm=off", &data);
free_test_data(&data);
@@ -1411,6 +1457,7 @@ static void test_acpi_q35_tcg_smm_compat(void)
test_data data = {};
data.machine = MACHINE_Q35;
+ data.arch = "x86",
data.variant = ".smm-compat";
test_acpi_one("-global ICH9-LPC.smm-compat=on", &data);
free_test_data(&data);
@@ -1421,6 +1468,7 @@ static void test_acpi_q35_tcg_smm_compat_nosmm(void)
test_data data = {};
data.machine = MACHINE_Q35;
+ data.arch = "x86",
data.variant = ".smm-compat-nosmm";
test_acpi_one("-global ICH9-LPC.smm-compat=on -machine smm=off", &data);
free_test_data(&data);
@@ -1431,6 +1479,7 @@ static void test_acpi_q35_tcg_nohpet(void)
test_data data = {};
data.machine = MACHINE_Q35;
+ data.arch = "x86",
data.machine_param = ",hpet=off";
data.variant = ".nohpet";
test_acpi_one(NULL, &data);
@@ -1442,6 +1491,7 @@ static void test_acpi_q35_kvm_dmar(void)
test_data data = {};
data.machine = MACHINE_Q35;
+ data.arch = "x86",
data.variant = ".dmar";
test_acpi_one("-machine kernel-irqchip=split -accel kvm"
" -device intel-iommu,intremap=on,device-iotlb=on", &data);
@@ -1453,6 +1503,7 @@ static void test_acpi_q35_tcg_ivrs(void)
test_data data = {};
data.machine = MACHINE_Q35;
+ data.arch = "x86",
data.variant = ".ivrs";
data.tcg_only = true,
test_acpi_one(" -device amd-iommu", &data);
@@ -1464,6 +1515,7 @@ static void test_acpi_piix4_tcg_numamem(void)
test_data data = {};
data.machine = MACHINE_PC;
+ data.arch = "x86";
data.variant = ".numamem";
test_acpi_one(" -object memory-backend-ram,id=ram0,size=128M"
" -numa node -numa node,memdev=ram0", &data);
@@ -1472,8 +1524,9 @@ static void test_acpi_piix4_tcg_numamem(void)
uint64_t tpm_tis_base_addr;
-static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
- uint64_t base, enum TPMVersion tpm_version)
+static void test_acpi_tcg_tpm(const char *machine, const char *arch,
+ const char *tpm_if, uint64_t base,
+ enum TPMVersion tpm_version)
{
gchar *tmp_dir_name = g_strdup_printf("qemu-test_acpi_%s_tcg_%s.XXXXXX",
machine, tpm_if);
@@ -1500,6 +1553,7 @@ static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
tpm_emu_test_wait_cond(&test);
data.machine = machine;
+ data.arch = arch;
data.variant = variant;
args = g_strdup_printf(
@@ -1523,19 +1577,20 @@ static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
static void test_acpi_q35_tcg_tpm2_tis(void)
{
- test_acpi_tcg_tpm("q35", "tis", 0xFED40000, TPM_VERSION_2_0);
+ test_acpi_tcg_tpm("q35", "x86", "tis", 0xFED40000, TPM_VERSION_2_0);
}
static void test_acpi_q35_tcg_tpm12_tis(void)
{
- test_acpi_tcg_tpm("q35", "tis", 0xFED40000, TPM_VERSION_1_2);
+ test_acpi_tcg_tpm("q35", "x86", "tis", 0xFED40000, TPM_VERSION_1_2);
}
-static void test_acpi_tcg_dimm_pxm(const char *machine)
+static void test_acpi_tcg_dimm_pxm(const char *machine, const char *arch)
{
test_data data = {};
data.machine = machine;
+ data.arch = arch;
data.variant = ".dimmpxm";
test_acpi_one(" -machine nvdimm=on,nvdimm-persistence=cpu"
" -smp 4,sockets=4"
@@ -1562,18 +1617,19 @@ static void test_acpi_tcg_dimm_pxm(const char *machine)
static void test_acpi_q35_tcg_dimm_pxm(void)
{
- test_acpi_tcg_dimm_pxm(MACHINE_Q35);
+ test_acpi_tcg_dimm_pxm(MACHINE_Q35, "x86");
}
static void test_acpi_piix4_tcg_dimm_pxm(void)
{
- test_acpi_tcg_dimm_pxm(MACHINE_PC);
+ test_acpi_tcg_dimm_pxm(MACHINE_PC, "x86");
}
-static void test_acpi_virt_tcg_memhp(void)
+static void test_acpi_aarch64_virt_tcg_memhp(void)
{
test_data data = {
.machine = "virt",
+ .arch = "aarch64",
.tcg_only = true,
.uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
.uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
@@ -1603,6 +1659,7 @@ static void test_acpi_virt_tcg_memhp(void)
static void test_acpi_microvm_prepare(test_data *data)
{
data->machine = "microvm";
+ data->arch = "x86";
data->required_struct_types = NULL; /* no smbios */
data->required_struct_types_len = 0;
data->blkdev = "virtio-blk-device";
@@ -1663,10 +1720,11 @@ static void test_acpi_microvm_ioapic2_tcg(void)
free_test_data(&data);
}
-static void test_acpi_virt_tcg_numamem(void)
+static void test_acpi_aarch64_virt_tcg_numamem(void)
{
test_data data = {
.machine = "virt",
+ .arch = "aarch64",
.tcg_only = true,
.uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
.uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
@@ -1685,10 +1743,11 @@ static void test_acpi_virt_tcg_numamem(void)
}
-static void test_acpi_virt_tcg_pxb(void)
+static void test_acpi_aarch64_virt_tcg_pxb(void)
{
test_data data = {
.machine = "virt",
+ .arch = "aarch64",
.tcg_only = true,
.uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
.uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
@@ -1717,11 +1776,12 @@ static void test_acpi_virt_tcg_pxb(void)
free_test_data(&data);
}
-static void test_acpi_tcg_acpi_hmat(const char *machine)
+static void test_acpi_tcg_acpi_hmat(const char *machine, const char *arch)
{
test_data data = {};
data.machine = machine;
+ data.arch = arch;
data.variant = ".acpihmat";
test_acpi_one(" -machine hmat=on"
" -smp 2,sockets=2"
@@ -1750,18 +1810,19 @@ static void test_acpi_tcg_acpi_hmat(const char *machine)
static void test_acpi_q35_tcg_acpi_hmat(void)
{
- test_acpi_tcg_acpi_hmat(MACHINE_Q35);
+ test_acpi_tcg_acpi_hmat(MACHINE_Q35, "x86");
}
static void test_acpi_piix4_tcg_acpi_hmat(void)
{
- test_acpi_tcg_acpi_hmat(MACHINE_PC);
+ test_acpi_tcg_acpi_hmat(MACHINE_PC, "x86");
}
-static void test_acpi_virt_tcg_acpi_hmat(void)
+static void test_acpi_aarch64_virt_tcg_acpi_hmat(void)
{
test_data data = {
.machine = "virt",
+ .arch = "aarch64",
.tcg_only = true,
.uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
.uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
@@ -1820,6 +1881,7 @@ static void test_acpi_q35_tcg_acpi_hmat_noinitiator(void)
test_data data = {};
data.machine = MACHINE_Q35;
+ data.arch = "x86";
data.variant = ".acpihmat-noinitiator";
test_acpi_one(" -machine hmat=on"
" -smp 4,sockets=2"
@@ -1863,13 +1925,14 @@ static void test_acpi_q35_tcg_acpi_hmat_noinitiator(void)
}
#ifdef CONFIG_POSIX
-static void test_acpi_erst(const char *machine)
+static void test_acpi_erst(const char *machine, const char *arch)
{
gchar *tmp_path = g_dir_make_tmp("qemu-test-erst.XXXXXX", NULL);
gchar *params;
test_data data = {};
data.machine = machine;
+ data.arch = arch;
data.variant = ".acpierst";
params = g_strdup_printf(
" -object memory-backend-file,id=erstnvram,"
@@ -1884,12 +1947,12 @@ static void test_acpi_erst(const char *machine)
static void test_acpi_piix4_acpi_erst(void)
{
- test_acpi_erst(MACHINE_PC);
+ test_acpi_erst(MACHINE_PC, "x86");
}
static void test_acpi_q35_acpi_erst(void)
{
- test_acpi_erst(MACHINE_Q35);
+ test_acpi_erst(MACHINE_Q35, "x86");
}
static void test_acpi_microvm_acpi_erst(void)
@@ -1914,10 +1977,11 @@ static void test_acpi_microvm_acpi_erst(void)
}
#endif /* CONFIG_POSIX */
-static void test_acpi_virt_tcg(void)
+static void test_acpi_aarch64_virt_tcg(void)
{
test_data data = {
.machine = "virt",
+ .arch = "aarch64",
.tcg_only = true,
.uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
.uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
@@ -1933,10 +1997,11 @@ static void test_acpi_virt_tcg(void)
free_test_data(&data);
}
-static void test_acpi_virt_tcg_topology(void)
+static void test_acpi_aarch64_virt_tcg_topology(void)
{
test_data data = {
.machine = "virt",
+ .arch = "aarch64",
.variant = ".topology",
.tcg_only = true,
.uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
@@ -1955,6 +2020,7 @@ static void test_acpi_q35_viot(void)
{
test_data data = {
.machine = MACHINE_Q35,
+ .arch = "x86",
.variant = ".viot",
};
@@ -1979,6 +2045,7 @@ static void test_acpi_q35_cxl(void)
test_data data = {
.machine = MACHINE_Q35,
+ .arch = "x86",
.variant = ".cxl",
};
/*
@@ -2016,10 +2083,11 @@ static void test_acpi_q35_cxl(void)
}
#endif /* CONFIG_POSIX */
-static void test_acpi_virt_viot(void)
+static void test_acpi_aarch64_virt_viot(void)
{
test_data data = {
.machine = "virt",
+ .arch = "aarch64",
.tcg_only = true,
.uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
.uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
@@ -2043,6 +2111,7 @@ static void test_acpi_q35_slic(void)
{
test_data data = {
.machine = MACHINE_Q35,
+ .arch = "x86",
.variant = ".slic",
};
@@ -2057,6 +2126,7 @@ static void test_acpi_q35_applesmc(void)
{
test_data data = {
.machine = MACHINE_Q35,
+ .arch = "x86",
.variant = ".applesmc",
};
@@ -2070,6 +2140,7 @@ static void test_acpi_q35_pvpanic_isa(void)
{
test_data data = {
.machine = MACHINE_Q35,
+ .arch = "x86",
.variant = ".pvpanic-isa",
};
@@ -2082,6 +2153,7 @@ static void test_acpi_pc_smbios_options(void)
uint8_t req_type11[] = { 11 };
test_data data = {
.machine = MACHINE_PC,
+ .arch = "x86",
.variant = ".pc_smbios_options",
.required_struct_types = req_type11,
.required_struct_types_len = ARRAY_SIZE(req_type11),
@@ -2096,6 +2168,7 @@ static void test_acpi_pc_smbios_blob(void)
uint8_t req_type11[] = { 11 };
test_data data = {
.machine = MACHINE_PC,
+ .arch = "x86",
.variant = ".pc_smbios_blob",
.required_struct_types = req_type11,
.required_struct_types_len = ARRAY_SIZE(req_type11),
@@ -2145,6 +2218,7 @@ static void test_acpi_piix4_oem_fields(void)
test_data data = {};
data.machine = MACHINE_PC;
+ data.arch = "x86";
data.required_struct_types = base_required_struct_types;
data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
@@ -2163,6 +2237,7 @@ static void test_acpi_q35_oem_fields(void)
test_data data = {};
data.machine = MACHINE_Q35;
+ data.arch = "x86";
data.required_struct_types = base_required_struct_types;
data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
@@ -2192,10 +2267,11 @@ static void test_acpi_microvm_oem_fields(void)
g_free(args);
}
-static void test_acpi_virt_oem_fields(void)
+static void test_acpi_aarch64_virt_oem_fields(void)
{
test_data data = {
.machine = "virt",
+ .arch = "aarch64",
.tcg_only = true,
.uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
.uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
@@ -2364,16 +2440,19 @@ int main(int argc, char *argv[])
}
} else if (strcmp(arch, "aarch64") == 0) {
if (has_tcg && qtest_has_device("virtio-blk-pci")) {
- qtest_add_func("acpi/virt", test_acpi_virt_tcg);
+ qtest_add_func("acpi/virt", test_acpi_aarch64_virt_tcg);
qtest_add_func("acpi/virt/acpihmatvirt",
- test_acpi_virt_tcg_acpi_hmat);
- qtest_add_func("acpi/virt/topology", test_acpi_virt_tcg_topology);
- qtest_add_func("acpi/virt/numamem", test_acpi_virt_tcg_numamem);
- qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp);
- qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb);
- qtest_add_func("acpi/virt/oem-fields", test_acpi_virt_oem_fields);
+ test_acpi_aarch64_virt_tcg_acpi_hmat);
+ qtest_add_func("acpi/virt/topology",
+ test_acpi_aarch64_virt_tcg_topology);
+ qtest_add_func("acpi/virt/numamem",
+ test_acpi_aarch64_virt_tcg_numamem);
+ qtest_add_func("acpi/virt/memhp", test_acpi_aarch64_virt_tcg_memhp);
+ qtest_add_func("acpi/virt/pxb", test_acpi_aarch64_virt_tcg_pxb);
+ qtest_add_func("acpi/virt/oem-fields",
+ test_acpi_aarch64_virt_oem_fields);
if (qtest_has_device("virtio-iommu-pci")) {
- qtest_add_func("acpi/virt/viot", test_acpi_virt_viot);
+ qtest_add_func("acpi/virt/viot", test_acpi_aarch64_virt_viot);
}
}
}
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index 1279294..6508bfb 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -259,6 +259,9 @@ qtests_s390x = \
qtests_riscv32 = \
(config_all_devices.has_key('CONFIG_SIFIVE_E_AON') ? ['sifive-e-aon-watchdog-test'] : [])
+qtests_riscv64 = \
+ (unpack_edk2_blobs ? ['bios-tables-test'] : [])
+
qos_test_ss = ss.source_set()
qos_test_ss.add(
'ac97-test.c',
diff --git a/tests/qtest/pvpanic-pci-test.c b/tests/qtest/pvpanic-pci-test.c
index 2c05b37..dc021c2 100644
--- a/tests/qtest/pvpanic-pci-test.c
+++ b/tests/qtest/pvpanic-pci-test.c
@@ -16,6 +16,7 @@
#include "qapi/qmp/qdict.h"
#include "libqos/pci.h"
#include "libqos/pci-pc.h"
+#include "hw/misc/pvpanic.h"
#include "hw/pci/pci_regs.h"
static void test_panic_nopause(void)
@@ -34,7 +35,7 @@ static void test_panic_nopause(void)
bar = qpci_iomap(dev, 0, NULL);
qpci_memread(dev, bar, 0, &val, sizeof(val));
- g_assert_cmpuint(val, ==, 3);
+ g_assert_cmpuint(val, ==, PVPANIC_EVENTS);
val = 1;
qpci_memwrite(dev, bar, 0, &val, sizeof(val));
@@ -67,7 +68,7 @@ static void test_panic(void)
bar = qpci_iomap(dev, 0, NULL);
qpci_memread(dev, bar, 0, &val, sizeof(val));
- g_assert_cmpuint(val, ==, 3);
+ g_assert_cmpuint(val, ==, PVPANIC_EVENTS);
val = 1;
qpci_memwrite(dev, bar, 0, &val, sizeof(val));
@@ -84,11 +85,50 @@ static void test_panic(void)
qtest_quit(qts);
}
+static void test_pvshutdown(void)
+{
+ uint8_t val;
+ QDict *response, *data;
+ QTestState *qts;
+ QPCIBus *pcibus;
+ QPCIDevice *dev;
+ QPCIBar bar;
+
+ qts = qtest_init("-device pvpanic-pci,addr=04.0");
+ pcibus = qpci_new_pc(qts, NULL);
+ dev = qpci_device_find(pcibus, QPCI_DEVFN(0x4, 0x0));
+ qpci_device_enable(dev);
+ bar = qpci_iomap(dev, 0, NULL);
+
+ qpci_memread(dev, bar, 0, &val, sizeof(val));
+ g_assert_cmpuint(val, ==, PVPANIC_EVENTS);
+
+ val = PVPANIC_SHUTDOWN;
+ qpci_memwrite(dev, bar, 0, &val, sizeof(val));
+
+ response = qtest_qmp_eventwait_ref(qts, "GUEST_PVSHUTDOWN");
+ qobject_unref(response);
+
+ response = qtest_qmp_eventwait_ref(qts, "SHUTDOWN");
+ g_assert(qdict_haskey(response, "data"));
+ data = qdict_get_qdict(response, "data");
+ g_assert(qdict_haskey(data, "guest"));
+ g_assert(qdict_get_bool(data, "guest"));
+ g_assert(qdict_haskey(data, "reason"));
+ g_assert_cmpstr(qdict_get_str(data, "reason"), ==, "guest-shutdown");
+ qobject_unref(response);
+
+ g_free(dev);
+ qpci_free_pc(pcibus);
+ qtest_quit(qts);
+}
+
int main(int argc, char **argv)
{
g_test_init(&argc, &argv, NULL);
qtest_add_func("/pvpanic-pci/panic", test_panic);
qtest_add_func("/pvpanic-pci/panic-nopause", test_panic_nopause);
+ qtest_add_func("/pvpanic-pci/pvshutdown", test_pvshutdown);
return g_test_run();
}
diff --git a/tests/qtest/pvpanic-test.c b/tests/qtest/pvpanic-test.c
index 78f1cf8..d49d2ba 100644
--- a/tests/qtest/pvpanic-test.c
+++ b/tests/qtest/pvpanic-test.c
@@ -10,6 +10,7 @@
#include "qemu/osdep.h"
#include "libqtest.h"
#include "qapi/qmp/qdict.h"
+#include "hw/misc/pvpanic.h"
static void test_panic_nopause(void)
{
@@ -20,7 +21,7 @@ static void test_panic_nopause(void)
qts = qtest_init("-device pvpanic -action panic=none");
val = qtest_inb(qts, 0x505);
- g_assert_cmpuint(val, ==, 3);
+ g_assert_cmpuint(val, ==, PVPANIC_EVENTS);
qtest_outb(qts, 0x505, 0x1);
@@ -43,7 +44,7 @@ static void test_panic(void)
qts = qtest_init("-device pvpanic -action panic=pause");
val = qtest_inb(qts, 0x505);
- g_assert_cmpuint(val, ==, 3);
+ g_assert_cmpuint(val, ==, PVPANIC_EVENTS);
qtest_outb(qts, 0x505, 0x1);
@@ -57,11 +58,40 @@ static void test_panic(void)
qtest_quit(qts);
}
+static void test_pvshutdown(void)
+{
+ uint8_t val;
+ QDict *response, *data;
+ QTestState *qts;
+
+ qts = qtest_init("-device pvpanic");
+
+ val = qtest_inb(qts, 0x505);
+ g_assert_cmpuint(val, ==, PVPANIC_EVENTS);
+
+ qtest_outb(qts, 0x505, PVPANIC_SHUTDOWN);
+
+ response = qtest_qmp_eventwait_ref(qts, "GUEST_PVSHUTDOWN");
+ qobject_unref(response);
+
+ response = qtest_qmp_eventwait_ref(qts, "SHUTDOWN");
+ g_assert(qdict_haskey(response, "data"));
+ data = qdict_get_qdict(response, "data");
+ g_assert(qdict_haskey(data, "guest"));
+ g_assert(qdict_get_bool(data, "guest"));
+ g_assert(qdict_haskey(data, "reason"));
+ g_assert_cmpstr(qdict_get_str(data, "reason"), ==, "guest-shutdown");
+ qobject_unref(response);
+
+ qtest_quit(qts);
+}
+
int main(int argc, char **argv)
{
g_test_init(&argc, &argv, NULL);
qtest_add_func("/pvpanic/panic", test_panic);
qtest_add_func("/pvpanic/panic-nopause", test_panic_nopause);
+ qtest_add_func("/pvpanic/pvshutdown", test_pvshutdown);
return g_test_run();
}
diff --git a/tests/qtest/vhost-user-blk-test.c b/tests/qtest/vhost-user-blk-test.c
index 117b9ac..ea90d41 100644
--- a/tests/qtest/vhost-user-blk-test.c
+++ b/tests/qtest/vhost-user-blk-test.c
@@ -906,7 +906,7 @@ static void start_vhost_user_blk(GString *cmd_line, int vus_instances,
vhost_user_blk_bin);
g_string_append_printf(cmd_line,
- " -object memory-backend-memfd,id=mem,size=256M,share=on "
+ " -object memory-backend-shm,id=mem,size=256M "
" -M memory-backend=mem -m 256M ");
for (i = 0; i < vus_instances; i++) {
diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c
index 929af5c..d607500 100644
--- a/tests/qtest/vhost-user-test.c
+++ b/tests/qtest/vhost-user-test.c
@@ -44,6 +44,8 @@
"mem-path=%s,share=on -numa node,memdev=mem"
#define QEMU_CMD_MEMFD " -m %d -object memory-backend-memfd,id=mem,size=%dM," \
" -numa node,memdev=mem"
+#define QEMU_CMD_SHM " -m %d -object memory-backend-shm,id=mem,size=%dM," \
+ " -numa node,memdev=mem"
#define QEMU_CMD_CHR " -chardev socket,id=%s,path=%s%s"
#define QEMU_CMD_NETDEV " -netdev vhost-user,id=hs0,chardev=%s,vhostforce=on"
@@ -195,6 +197,7 @@ enum test_memfd {
TEST_MEMFD_AUTO,
TEST_MEMFD_YES,
TEST_MEMFD_NO,
+ TEST_MEMFD_SHM,
};
static void append_vhost_net_opts(TestServer *s, GString *cmd_line,
@@ -228,6 +231,8 @@ static void append_mem_opts(TestServer *server, GString *cmd_line,
if (memfd == TEST_MEMFD_YES) {
g_string_append_printf(cmd_line, QEMU_CMD_MEMFD, size, size);
+ } else if (memfd == TEST_MEMFD_SHM) {
+ g_string_append_printf(cmd_line, QEMU_CMD_SHM, size, size);
} else {
const char *root = init_hugepagefs() ? : server->tmpfs;
@@ -458,7 +463,10 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)
case VHOST_USER_SET_VRING_KICK:
case VHOST_USER_SET_VRING_CALL:
/* consume the fd */
- qemu_chr_fe_get_msgfds(chr, &fd, 1);
+ if (!qemu_chr_fe_get_msgfds(chr, &fd, 1) && fd < 0) {
+ qos_printf("call fd: %d, do not set non-blocking\n", fd);
+ break;
+ }
/*
* This is a non-blocking eventfd.
* The receive function forces it to be blocking,
@@ -788,6 +796,19 @@ static void *vhost_user_test_setup_memfd(GString *cmd_line, void *arg)
return server;
}
+static void *vhost_user_test_setup_shm(GString *cmd_line, void *arg)
+{
+ TestServer *server = test_server_new("vhost-user-test", arg);
+ test_server_listen(server);
+
+ append_mem_opts(server, cmd_line, 256, TEST_MEMFD_SHM);
+ server->vu_ops->append_opts(server, cmd_line, "");
+
+ g_test_queue_destroy(vhost_user_test_cleanup, server);
+
+ return server;
+}
+
static void test_read_guest_mem(void *obj, void *arg, QGuestAllocator *alloc)
{
TestServer *server = arg;
@@ -1081,6 +1102,11 @@ static void register_vhost_user_test(void)
"virtio-net",
test_read_guest_mem, &opts);
+ opts.before = vhost_user_test_setup_shm;
+ qos_add_test("vhost-user/read-guest-mem/shm",
+ "virtio-net",
+ test_read_guest_mem, &opts);
+
if (qemu_memfd_check(MFD_ALLOW_SEALING)) {
opts.before = vhost_user_test_setup_memfd;
qos_add_test("vhost-user/read-guest-mem/memfd",