qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

tests/cpu-plug-test: Test CPU hot-plugging on s390x

CPU hot-plugging on s390x is possible with both, "cpu-add"
and "device_add", so test both.

Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>

+40
+1
tests/Makefile.include
··· 380 380 check-qtest-s390x-y += tests/virtio-balloon-test$(EXESUF) 381 381 check-qtest-s390x-y += tests/virtio-console-test$(EXESUF) 382 382 check-qtest-s390x-y += tests/virtio-serial-test$(EXESUF) 383 + check-qtest-s390x-y += tests/cpu-plug-test$(EXESUF) 383 384 384 385 check-qtest-generic-y += tests/qom-test$(EXESUF) 385 386 check-qtest-generic-y += tests/test-hmp$(EXESUF)
+39
tests/cpu-plug-test.c
··· 212 212 g_free(path); 213 213 } 214 214 215 + static void add_s390x_test_case(const char *mname) 216 + { 217 + char *path; 218 + PlugTestData *data, *data2; 219 + 220 + if (!g_str_has_prefix(mname, "s390-ccw-virtio-")) { 221 + return; 222 + } 223 + 224 + data = g_new(PlugTestData, 1); 225 + data->machine = g_strdup(mname); 226 + data->cpu_model = "qemu"; 227 + data->device_model = g_strdup("qemu-s390x-cpu"); 228 + data->sockets = 1; 229 + data->cores = 3; 230 + data->threads = 1; 231 + data->maxcpus = data->sockets * data->cores * data->threads * 2; 232 + 233 + data2 = g_memdup(data, sizeof(PlugTestData)); 234 + data2->machine = g_strdup(data->machine); 235 + data2->device_model = g_strdup(data->device_model); 236 + 237 + path = g_strdup_printf("cpu-plug/%s/cpu-add/%ux%ux%u&maxcpus=%u", 238 + mname, data->sockets, data->cores, 239 + data->threads, data->maxcpus); 240 + qtest_add_data_func_full(path, data, test_plug_with_cpu_add, 241 + test_data_free); 242 + g_free(path); 243 + 244 + path = g_strdup_printf("cpu-plug/%s/device-add/%ux%ux%u&maxcpus=%u", 245 + mname, data2->sockets, data2->cores, 246 + data2->threads, data2->maxcpus); 247 + qtest_add_data_func_full(path, data2, test_plug_with_device_add_coreid, 248 + test_data_free); 249 + g_free(path); 250 + } 251 + 215 252 int main(int argc, char **argv) 216 253 { 217 254 const char *arch = qtest_get_arch(); ··· 222 259 qtest_cb_for_every_machine(add_pc_test_case); 223 260 } else if (g_str_equal(arch, "ppc64")) { 224 261 qtest_cb_for_every_machine(add_pseries_test_case); 262 + } else if (g_str_equal(arch, "s390x")) { 263 + qtest_cb_for_every_machine(add_s390x_test_case); 225 264 } 226 265 227 266 return g_test_run();