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

arm/acpi: TPM2 ACPI table support

Add a TPM2 ACPI table if a TPM2.0 sysbus device has been
dynamically instantiated.

Signed-off-by: Eric Auger <eric.auger@redhat.com>

Message-Id: <20200601095737.32671-4-eric.auger@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

authored by

Eric Auger and committed by
Michael S. Tsirkin
80bde693 43384160

+12 -2
+3 -2
hw/acpi/aml-build.c
··· 1885 1885 unsigned log_addr_offset = 1886 1886 (char *)&tpm2_ptr->log_area_start_address - table_data->data; 1887 1887 uint8_t start_method_params[12] = {}; 1888 + TPMIf *tpmif = tpm_find(); 1888 1889 1889 1890 /* platform class */ 1890 1891 build_append_int_noprefix(table_data, TPM2_ACPI_CLASS_CLIENT, 2); 1891 1892 /* reserved */ 1892 1893 build_append_int_noprefix(table_data, 0, 2); 1893 - if (TPM_IS_TIS_ISA(tpm_find())) { 1894 + if (TPM_IS_TIS_ISA(tpmif) || TPM_IS_TIS_SYSBUS(tpmif)) { 1894 1895 /* address of control area */ 1895 1896 build_append_int_noprefix(table_data, 0, 8); 1896 1897 /* start method */ 1897 1898 build_append_int_noprefix(table_data, TPM2_START_METHOD_MMIO, 4); 1898 - } else if (TPM_IS_CRB(tpm_find())) { 1899 + } else if (TPM_IS_CRB(tpmif)) { 1899 1900 build_append_int_noprefix(table_data, TPM_CRB_ADDR_CTRL, 8); 1900 1901 build_append_int_noprefix(table_data, TPM2_START_METHOD_CRB, 4); 1901 1902 } else {
+7
hw/arm/virt-acpi-build.c
··· 41 41 #include "hw/acpi/pci.h" 42 42 #include "hw/acpi/memory_hotplug.h" 43 43 #include "hw/acpi/generic_event_device.h" 44 + #include "hw/acpi/tpm.h" 44 45 #include "hw/pci/pcie_host.h" 45 46 #include "hw/pci/pci.h" 46 47 #include "hw/arm/virt.h" 47 48 #include "hw/mem/nvdimm.h" 48 49 #include "sysemu/numa.h" 49 50 #include "sysemu/reset.h" 51 + #include "sysemu/tpm.h" 50 52 #include "kvm_arm.h" 51 53 #include "migration/vmstate.h" 52 54 #include "hw/acpi/ghes.h" ··· 846 848 if (its_class_name() && !vmc->no_its) { 847 849 acpi_add_table(table_offsets, tables_blob); 848 850 build_iort(tables_blob, tables->linker, vms); 851 + } 852 + 853 + if (tpm_get_version(tpm_find()) == TPM_VERSION_2_0) { 854 + acpi_add_table(table_offsets, tables_blob); 855 + build_tpm2(tables_blob, tables->linker, tables->tcpalog); 849 856 } 850 857 851 858 /* XSDT is pointed to by RSDP */
+2
include/sysemu/tpm.h
··· 50 50 51 51 #define TPM_IS_TIS_ISA(chr) \ 52 52 object_dynamic_cast(OBJECT(chr), TYPE_TPM_TIS_ISA) 53 + #define TPM_IS_TIS_SYSBUS(chr) \ 54 + object_dynamic_cast(OBJECT(chr), TYPE_TPM_TIS_SYSBUS) 53 55 #define TPM_IS_CRB(chr) \ 54 56 object_dynamic_cast(OBJECT(chr), TYPE_TPM_CRB) 55 57 #define TPM_IS_SPAPR(chr) \