On 6/15/20 8:37 AM, Stefan Berger wrote:
> From: Stefan Berger <stefanb@linux.ibm.com>
>
> Move the TPM TIS IRQ to unused IRQ 13, which is also accepted by Windows.
> Query for the TPM's irq number and enable the TPM IRQ if not zero.
>
> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
> CC: Michael S. Tsirkin <mst@redhat.com>
This patch is missing the reference ACPI tables for the tests. Will add
in v2.
> ---
> hw/i386/acpi-build.c | 11 +++++------
> include/hw/acpi/tpm.h | 2 +-
> 2 files changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 23c77eeb95..919cab1702 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -2199,6 +2199,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
> build_append_pci_bus_devices(scope, bus, pm->pcihp_bridge_en);
>
> if (TPM_IS_TIS_ISA(tpm)) {
> + uint8_t irq = tpm_get_irqnum(tpm);
> if (misc->tpm_version == TPM_VERSION_2_0) {
> dev = aml_device("TPM");
> aml_append(dev, aml_name_decl("_HID",
> @@ -2213,12 +2214,10 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
> crs = aml_resource_template();
> aml_append(crs, aml_memory32_fixed(TPM_TIS_ADDR_BASE,
> TPM_TIS_ADDR_SIZE, AML_READ_WRITE));
> - /*
> - FIXME: TPM_TIS_IRQ=5 conflicts with PNP0C0F irqs,
> - Rewrite to take IRQ from TPM device model and
> - fix default IRQ value there to use some unused IRQ
> - */
> - /* aml_append(crs, aml_irq_no_flags(TPM_TIS_IRQ)); */
> +
> + if (irq) {
> + aml_append(crs, aml_irq_no_flags(irq));
> + }
> aml_append(dev, aml_name_decl("_CRS", crs));
>
> tpm_build_ppi_acpi(tpm, dev);
> diff --git a/include/hw/acpi/tpm.h b/include/hw/acpi/tpm.h
> index 1a2a57a21f..063a9eb42a 100644
> --- a/include/hw/acpi/tpm.h
> +++ b/include/hw/acpi/tpm.h
> @@ -24,7 +24,7 @@
> #define TPM_TIS_ADDR_BASE 0xFED40000
> #define TPM_TIS_ADDR_SIZE 0x5000
>
> -#define TPM_TIS_IRQ 5
> +#define TPM_TIS_IRQ 13
>
> #define TPM_TIS_NUM_LOCALITIES 5 /* per spec */
> #define TPM_TIS_LOCALITY_SHIFT 12