128 changes: 128 additions & 0 deletions qapi/cxl.json
@@ -0,0 +1,128 @@
# -*- Mode: Python -*-
# vim: filetype=python

##
# = CXL devices
##

##
# @CxlUncorErrorType:
#
# Type of uncorrectable CXL error to inject. These errors are reported via
# an AER uncorrectable internal error with additional information logged at
# the CXL device.
#
# @cache-data-parity: Data error such as data parity or data ECC error CXL.cache
# @cache-address-parity: Address parity or other errors associated with the
# address field on CXL.cache
# @cache-be-parity: Byte enable parity or other byte enable errors on CXL.cache
# @cache-data-ecc: ECC error on CXL.cache
# @mem-data-parity: Data error such as data parity or data ECC error on CXL.mem
# @mem-address-parity: Address parity or other errors associated with the
# address field on CXL.mem
# @mem-be-parity: Byte enable parity or other byte enable errors on CXL.mem.
# @mem-data-ecc: Data ECC error on CXL.mem.
# @reinit-threshold: REINIT threshold hit.
# @rsvd-encoding: Received unrecognized encoding.
# @poison-received: Received poison from the peer.
# @receiver-overflow: Buffer overflows (first 3 bits of header log indicate which)
# @internal: Component specific error
# @cxl-ide-tx: Integrity and data encryption tx error.
# @cxl-ide-rx: Integrity and data encryption rx error.
#
# Since: 8.0
##

{ 'enum': 'CxlUncorErrorType',
'data': ['cache-data-parity',
'cache-address-parity',
'cache-be-parity',
'cache-data-ecc',
'mem-data-parity',
'mem-address-parity',
'mem-be-parity',
'mem-data-ecc',
'reinit-threshold',
'rsvd-encoding',
'poison-received',
'receiver-overflow',
'internal',
'cxl-ide-tx',
'cxl-ide-rx'
]
}

##
# @CXLUncorErrorRecord:
#
# Record of a single error including header log.
#
# @type: Type of error
# @header: 16 DWORD of header.
#
# Since: 8.0
##
{ 'struct': 'CXLUncorErrorRecord',
'data': {
'type': 'CxlUncorErrorType',
'header': [ 'uint32' ]
}
}

##
# @cxl-inject-uncorrectable-errors:
#
# Command to allow injection of multiple errors in one go. This allows testing
# of multiple header log handling in the OS.
#
# @path: CXL Type 3 device canonical QOM path
# @errors: Errors to inject
#
# Since: 8.0
##
{ 'command': 'cxl-inject-uncorrectable-errors',
'data': { 'path': 'str',
'errors': [ 'CXLUncorErrorRecord' ] }}

##
# @CxlCorErrorType:
#
# Type of CXL correctable error to inject
#
# @cache-data-ecc: Data ECC error on CXL.cache
# @mem-data-ecc: Data ECC error on CXL.mem
# @crc-threshold: Component specific and applicable to 68 byte Flit mode only.
# @cache-poison-received: Received poison from a peer on CXL.cache.
# @mem-poison-received: Received poison from a peer on CXL.mem
# @physical: Received error indication from the physical layer.
#
# Since: 8.0
##
{ 'enum': 'CxlCorErrorType',
'data': ['cache-data-ecc',
'mem-data-ecc',
'crc-threshold',
'retry-threshold',
'cache-poison-received',
'mem-poison-received',
'physical']
}

##
# @cxl-inject-correctable-error:
#
# Command to inject a single correctable error. Multiple error injection
# of this error type is not interesting as there is no associated header log.
# These errors are reported via AER as a correctable internal error, with
# additional detail available from the CXL device.
#
# @path: CXL Type 3 device canonical QOM path
# @type: Type of error.
#
# Since: 8.0
##
{ 'command': 'cxl-inject-correctable-error',
'data': { 'path': 'str',
'type': 'CxlCorErrorType'
}
}
2 changes: 2 additions & 0 deletions qapi/meson.build
Expand Up @@ -31,6 +31,7 @@ qapi_all_modules = [
'compat',
'control',
'crypto',
'cxl',
'dump',
'error',
'introspect',
Expand All @@ -56,6 +57,7 @@ if have_system
qapi_all_modules += [
'acpi',
'audio',
'cryptodev',
'qdev',
'pci',
'rdma',
Expand Down
2 changes: 2 additions & 0 deletions qapi/qapi-schema.json
Expand Up @@ -95,3 +95,5 @@
{ 'include': 'pci.json' }
{ 'include': 'stats.json' }
{ 'include': 'virtio.json' }
{ 'include': 'cryptodev.json' }
{ 'include': 'cxl.json' }
8 changes: 7 additions & 1 deletion qapi/qom.json
Expand Up @@ -278,10 +278,16 @@
# cryptodev-backend and must be 1 for cryptodev-backend-builtin.
# (default: 1)
#
# @throttle-bps: limit total bytes per second (Since 8.0)
#
# @throttle-ops: limit total operations per second (Since 8.0)
#
# Since: 2.8
##
{ 'struct': 'CryptodevBackendProperties',
'data': { '*queues': 'uint32' } }
'data': { '*queues': 'uint32',
'*throttle-bps': 'uint64',
'*throttle-ops': 'uint64' } }

##
# @CryptodevVhostUserProperties:
Expand Down
10 changes: 8 additions & 2 deletions qapi/stats.json
Expand Up @@ -50,10 +50,14 @@
#
# Enumeration of statistics providers.
#
# @kvm: since 7.1
#
# @cryptodev: since 8.0
#
# Since: 7.1
##
{ 'enum': 'StatsProvider',
'data': [ 'kvm' ] }
'data': [ 'kvm', 'cryptodev' ] }

##
# @StatsTarget:
Expand All @@ -65,10 +69,12 @@
#
# @vcpu: statistics that apply to a single virtual CPU.
#
# @cryptodev: statistics that apply to a crypto device. since 8.0
#
# Since: 7.1
##
{ 'enum': 'StatsTarget',
'data': [ 'vm', 'vcpu' ] }
'data': [ 'vm', 'vcpu', 'cryptodev' ] }

##
# @StatsRequest:
Expand Down
5 changes: 5 additions & 0 deletions stats/stats-hmp-cmds.c
Expand Up @@ -155,6 +155,8 @@ static StatsFilter *stats_filter(StatsTarget target, const char *names,
filter->u.vcpu.vcpus = vcpu_list;
break;
}
case STATS_TARGET_CRYPTODEV:
break;
default:
break;
}
Expand Down Expand Up @@ -226,6 +228,9 @@ void hmp_info_stats(Monitor *mon, const QDict *qdict)
int cpu_index = monitor_get_cpu_index(mon);
filter = stats_filter(target, names, cpu_index, provider);
break;
case STATS_TARGET_CRYPTODEV:
filter = stats_filter(target, names, -1, provider);
break;
default:
abort();
}
Expand Down
2 changes: 2 additions & 0 deletions stats/stats-qmp-cmds.c
Expand Up @@ -64,6 +64,8 @@ static bool invoke_stats_cb(StatsCallbacks *entry,
targets = filter->u.vcpu.vcpus;
}
break;
case STATS_TARGET_CRYPTODEV:
break;
default:
abort();
}
Expand Down
Binary file modified tests/data/acpi/pc/DSDT
Binary file not shown.
Binary file modified tests/data/acpi/pc/DSDT.acpierst
Binary file not shown.
Binary file modified tests/data/acpi/pc/DSDT.acpihmat
Binary file not shown.
Binary file modified tests/data/acpi/pc/DSDT.bridge
Binary file not shown.
Binary file modified tests/data/acpi/pc/DSDT.cphp
Binary file not shown.
Binary file modified tests/data/acpi/pc/DSDT.dimmpxm
Binary file not shown.
Binary file modified tests/data/acpi/pc/DSDT.hpbridge
Binary file not shown.
Binary file modified tests/data/acpi/pc/DSDT.hpbrroot
Binary file not shown.
Binary file modified tests/data/acpi/pc/DSDT.ipmikcs
Binary file not shown.
Binary file modified tests/data/acpi/pc/DSDT.memhp
Binary file not shown.
Binary file modified tests/data/acpi/pc/DSDT.nohpet
Binary file not shown.
Binary file modified tests/data/acpi/pc/DSDT.numamem
Binary file not shown.
Binary file modified tests/data/acpi/pc/DSDT.roothp
Binary file not shown.
Binary file modified tests/data/acpi/q35/DSDT
Binary file not shown.
Binary file modified tests/data/acpi/q35/DSDT.acpierst
Binary file not shown.
Binary file modified tests/data/acpi/q35/DSDT.acpihmat
Binary file not shown.
Binary file modified tests/data/acpi/q35/DSDT.acpihmat-noinitiator
Binary file not shown.
Binary file modified tests/data/acpi/q35/DSDT.applesmc
Binary file not shown.
Binary file modified tests/data/acpi/q35/DSDT.bridge
Binary file not shown.
Binary file modified tests/data/acpi/q35/DSDT.core-count2
Binary file not shown.
Binary file modified tests/data/acpi/q35/DSDT.cphp
Binary file not shown.
Binary file modified tests/data/acpi/q35/DSDT.cxl
Binary file not shown.
Binary file modified tests/data/acpi/q35/DSDT.dimmpxm
Binary file not shown.
Binary file modified tests/data/acpi/q35/DSDT.ipmibt
Binary file not shown.
Binary file modified tests/data/acpi/q35/DSDT.ipmismbus
Binary file not shown.
Binary file modified tests/data/acpi/q35/DSDT.ivrs
Binary file not shown.
Binary file modified tests/data/acpi/q35/DSDT.memhp
Binary file not shown.
Binary file modified tests/data/acpi/q35/DSDT.mmio64
Binary file not shown.
Binary file modified tests/data/acpi/q35/DSDT.multi-bridge
Binary file not shown.
Binary file added tests/data/acpi/q35/DSDT.noacpihp
Binary file not shown.
Binary file modified tests/data/acpi/q35/DSDT.nohpet
Binary file not shown.
Binary file modified tests/data/acpi/q35/DSDT.numamem
Binary file not shown.
Binary file modified tests/data/acpi/q35/DSDT.pvpanic-isa
Binary file not shown.
Binary file modified tests/data/acpi/q35/DSDT.tis.tpm12
Binary file not shown.
Binary file modified tests/data/acpi/q35/DSDT.tis.tpm2
Binary file not shown.
Binary file modified tests/data/acpi/q35/DSDT.viot
Binary file not shown.
Binary file modified tests/data/acpi/q35/DSDT.xapic
Binary file not shown.
125 changes: 50 additions & 75 deletions tests/qtest/bios-tables-test.c
Expand Up @@ -949,9 +949,14 @@ static void test_acpi_piix4_no_acpi_pci_hotplug(void)
data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
test_acpi_one("-global PIIX4_PM.acpi-root-pci-hotplug=off "
"-global PIIX4_PM.acpi-pci-hotplug-with-bridge-support=off "
"-device pci-bridge,chassis_nr=1 "
"-device pci-testdev,bus=pci.0 "
"-device pci-testdev,bus=pci.1", &data);
"-device pci-bridge,chassis_nr=1,addr=4.0 "
"-device pci-testdev,bus=pci.0,addr=5.0 "
"-device pci-testdev,bus=pci.0,addr=6.0,acpi-index=101 "
"-device pci-testdev,bus=pci.1,addr=1.0 "
"-device pci-testdev,bus=pci.1,addr=2.0,acpi-index=201 "
"-device pci-bridge,id=nhpbr,chassis_nr=2,shpc=off,addr=7.0 "
"-device pci-testdev,bus=nhpbr,addr=1.0,acpi-index=301 "
, &data);
free_test_data(&data);
}

Expand Down Expand Up @@ -1002,18 +1007,42 @@ static void test_acpi_q35_tcg_bridge(void)
free_test_data(&data);
}

static void test_acpi_q35_tcg_no_acpi_hotplug(void)
{
test_data data;

memset(&data, 0, sizeof(data));
data.machine = MACHINE_Q35;
data.variant = ".noacpihp";
data.required_struct_types = base_required_struct_types;
data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
test_acpi_one("-global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off"
" -device pci-testdev,bus=pcie.0,acpi-index=101,addr=3.0"
" -device pci-bridge,chassis_nr=1,id=shpcbr,addr=4.0"
" -device pci-testdev,bus=shpcbr,addr=1.0,acpi-index=201"
" -device pci-bridge,chassis_nr=2,shpc=off,id=noshpcbr,addr=5.0"
" -device pci-testdev,bus=noshpcbr,addr=1.0,acpi-index=301"
" -device pcie-root-port,id=hprp,port=0x0,chassis=1,addr=6.0"
" -device pci-testdev,bus=hprp,acpi-index=401"
" -device pcie-root-port,id=nohprp,port=0x0,chassis=2,hotplug=off,"
"addr=7.0"
" -device pci-testdev,bus=nohprp,acpi-index=501"
" -device pcie-root-port,id=nohprpint,port=0x0,chassis=3,hotplug=off,"
"multifunction=on,addr=8.0"
" -device pci-testdev,bus=nohprpint,acpi-index=601,addr=8.1"
" -device pcie-root-port,id=hprp2,port=0x0,chassis=4,bus=nohprpint,"
"addr=9.0"
" -device pci-testdev,bus=hprp2,acpi-index=602"
, &data);
free_test_data(&data);
}

static void test_acpi_q35_multif_bridge(void)
{
test_data data = {
.machine = MACHINE_Q35,
.variant = ".multi-bridge",
};

if (!qtest_has_device("pcie-root-port")) {
g_test_skip("Device pcie-root-port is not available");
goto out;
}

test_vm_prepare("-S"
" -device virtio-balloon,id=balloon0,addr=0x4.0x2"
" -device pcie-root-port,id=rp0,multifunction=on,"
Expand All @@ -1025,9 +1054,14 @@ static void test_acpi_q35_multif_bridge(void)
" -device pcie-root-port,id=rphptgt2,port=0x0,chassis=6,addr=2.2"
" -device pcie-root-port,id=rphptgt3,port=0x0,chassis=7,addr=2.3"
" -device pci-testdev,bus=pcie.0,addr=2.4"
" -device pci-testdev,bus=pcie.0,addr=2.5,acpi-index=102"
" -device pci-testdev,bus=pcie.0,addr=5.0"
" -device pci-testdev,bus=pcie.0,addr=0xf.0,acpi-index=101"
" -device pci-testdev,bus=rp0,addr=0.0"
" -device pci-testdev,bus=br1", &data);
" -device pci-testdev,bus=br1"
" -device pcie-root-port,id=rpnohp,chassis=8,addr=0xA.0,hotplug=off"
" -device pcie-root-port,id=rp3,chassis=9,bus=rpnohp"
, &data);

/* hotplugged bridges section */
qtest_qmp_device_add(data.qts, "pci-bridge", "hpbr1",
Expand All @@ -1049,7 +1083,6 @@ static void test_acpi_q35_multif_bridge(void)
/* check that reboot/reset doesn't change any ACPI tables */
qtest_qmp_send(data.qts, "{'execute':'system_reset' }");
process_acpi_tables(&data);
out:
free_test_data(&data);
}

Expand Down Expand Up @@ -1403,11 +1436,6 @@ static void test_acpi_tcg_dimm_pxm(const char *machine)
{
test_data data;

if (!qtest_has_device("nvdimm")) {
g_test_skip("Device nvdimm is not available");
return;
}

memset(&data, 0, sizeof(data));
data.machine = machine;
data.variant = ".dimmpxm";
Expand Down Expand Up @@ -1456,11 +1484,6 @@ static void test_acpi_virt_tcg_memhp(void)
.scan_len = 256ULL * 1024 * 1024,
};

if (!qtest_has_device("nvdimm")) {
g_test_skip("Device nvdimm is not available");
goto out;
}

data.variant = ".memhp";
test_acpi_one(" -machine nvdimm=on"
" -cpu cortex-a57"
Expand All @@ -1474,7 +1497,7 @@ static void test_acpi_virt_tcg_memhp(void)
" -device pc-dimm,id=dimm0,memdev=ram2,node=0"
" -device nvdimm,id=dimm1,memdev=nvm0,node=1",
&data);
out:

free_test_data(&data);

}
Expand All @@ -1492,11 +1515,6 @@ static void test_acpi_microvm_tcg(void)
{
test_data data;

if (!qtest_has_device("virtio-blk-device")) {
g_test_skip("Device virtio-blk-device is not available");
return;
}

test_acpi_microvm_prepare(&data);
test_acpi_one(" -machine microvm,acpi=on,ioapic2=off,rtc=off",
&data);
Expand All @@ -1507,11 +1525,6 @@ static void test_acpi_microvm_usb_tcg(void)
{
test_data data;

if (!qtest_has_device("virtio-blk-device")) {
g_test_skip("Device virtio-blk-device is not available");
return;
}

test_acpi_microvm_prepare(&data);
data.variant = ".usb";
test_acpi_one(" -machine microvm,acpi=on,ioapic2=off,usb=on,rtc=off",
Expand All @@ -1523,11 +1536,6 @@ static void test_acpi_microvm_rtc_tcg(void)
{
test_data data;

if (!qtest_has_device("virtio-blk-device")) {
g_test_skip("Device virtio-blk-device is not available");
return;
}

test_acpi_microvm_prepare(&data);
data.variant = ".rtc";
test_acpi_one(" -machine microvm,acpi=on,ioapic2=off,rtc=on",
Expand All @@ -1539,11 +1547,6 @@ static void test_acpi_microvm_pcie_tcg(void)
{
test_data data;

if (!qtest_has_device("virtio-blk-device")) {
g_test_skip("Device virtio-blk-device is not available");
return;
}

test_acpi_microvm_prepare(&data);
data.variant = ".pcie";
data.tcg_only = true; /* need constant host-phys-bits */
Expand All @@ -1556,11 +1559,6 @@ static void test_acpi_microvm_ioapic2_tcg(void)
{
test_data data;

if (!qtest_has_device("virtio-blk-device")) {
g_test_skip("Device virtio-blk-device is not available");
return;
}

test_acpi_microvm_prepare(&data);
data.variant = ".ioapic2";
test_acpi_one(" -machine microvm,acpi=on,ioapic2=on,rtc=off",
Expand Down Expand Up @@ -1600,12 +1598,6 @@ static void test_acpi_virt_tcg_pxb(void)
.ram_start = 0x40000000ULL,
.scan_len = 128ULL * 1024 * 1024,
};

if (!qtest_has_device("pcie-root-port")) {
g_test_skip("Device pcie-root-port is not available");
goto out;
}

/*
* While using -cdrom, the cdrom would auto plugged into pxb-pcie,
* the reason is the bus of pxb-pcie is also root bus, it would lead
Expand All @@ -1624,7 +1616,7 @@ static void test_acpi_virt_tcg_pxb(void)
" -cpu cortex-a57"
" -device pxb-pcie,bus_nr=128",
&data);
out:

free_test_data(&data);
}

Expand Down Expand Up @@ -1812,12 +1804,6 @@ static void test_acpi_microvm_acpi_erst(void)
gchar *params;
test_data data;

if (!qtest_has_device("virtio-blk-device")) {
g_test_skip("Device virtio-blk-device is not available");
g_free(tmp_path);
return;
}

test_acpi_microvm_prepare(&data);
data.variant = ".pcie";
data.tcg_only = true; /* need constant host-phys-bits */
Expand Down Expand Up @@ -1878,11 +1864,6 @@ static void test_acpi_q35_viot(void)
.variant = ".viot",
};

if (!qtest_has_device("virtio-iommu")) {
g_test_skip("Device virtio-iommu is not available");
goto out;
}

/*
* To keep things interesting, two buses bypass the IOMMU.
* VIOT should only describes the other two buses.
Expand All @@ -1893,7 +1874,6 @@ static void test_acpi_q35_viot(void)
"-device pxb-pcie,bus_nr=0x20,id=pcie.200,bus=pcie.0,bypass_iommu=on "
"-device pxb-pcie,bus_nr=0x30,id=pcie.300,bus=pcie.0",
&data);
out:
free_test_data(&data);
}

Expand Down Expand Up @@ -1954,10 +1934,8 @@ static void test_acpi_virt_viot(void)
.scan_len = 128ULL * 1024 * 1024,
};

if (qtest_has_device("virtio-iommu")) {
test_acpi_one("-cpu cortex-a57 "
"-device virtio-iommu-pci", &data);
}
test_acpi_one("-cpu cortex-a57 "
"-device virtio-iommu-pci", &data);
free_test_data(&data);
}

Expand Down Expand Up @@ -2066,11 +2044,6 @@ static void test_acpi_microvm_oem_fields(void)
test_data data;
char *args;

if (!qtest_has_device("virtio-blk-device")) {
g_test_skip("Device virtio-blk-device is not available");
return;
}

test_acpi_microvm_prepare(&data);

args = test_acpi_create_args(&data,
Expand Down Expand Up @@ -2161,6 +2134,8 @@ int main(int argc, char *argv[])
test_acpi_q35_tcg_tpm12_tis);
}
qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge);
qtest_add_func("acpi/q35/no-acpi-hotplug",
test_acpi_q35_tcg_no_acpi_hotplug);
qtest_add_func("acpi/q35/multif-bridge",
test_acpi_q35_multif_bridge);
qtest_add_func("acpi/q35/mmio64", test_acpi_q35_tcg_mmio64);
Expand Down