Skip to contentSkip to conversation

acpi: tpm: "Fix" TPM ACPI description

PATCH New Igor Mammedov 1 participant 3 messages Apr 8, 2016

lore
Share & tools
lore
#0 lore raw

v2 cover acpi: tpm: "Fix" TPM ACPI description

TPM used to 'work', since in commit:
711b20b4 Add ACPI tables for TPM
as TPM device has been placed outside of PCI0 bus scope with IRQ commented out, but since commit
5cb18b3d TPM2 ACPI table support
with following fixup
9e472263 acpi: add missing ssdt
it has been moved to correct ISA bus scope, however no one added MMIO resource to parent bus and IRQ(5) became uncommented which regressed TPM as Windows fails to init it due to lack of resources
'device cannot find enough free resources'

Series is a partialy fix and a partially hack to temporary make TPM work on Windows.
1/2 - fixes IO resource lack on parent bus 2/2 - temporary comment out IRQ description
to make Windows beleve that there isn't any possible conflict to force successful driver initialization

Tested with Windows 8.1x64

Igor Mammedov (2):
pc: acpi: tpm: add missing MMIO resource to PCI0._CRS
tpm: acpi: remove IRQ from TPM's CRS to make Windows not see conflict

 hw/i386/acpi-build.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH v2 1/2 pc: acpi: tpm: add missing MMIO resource to PCI0._CRS

Windows will fail initialize TMP driver with the reason:
'device cannot find enough free resources'
That happens because parent BUS doesn't describe MMIO resources used by TPM child device.
Fix it by describing it in top-most parent bus scope PCI0.

It was 'regressed' by commit
5cb18b3d TPM2 ACPI table support
with following fixup
9e472263 acpi: add missing ssdt
which did the right thing by moving TPM to BUS it belongs to but lacked a proper resource declaration.

---
 hw/i386/acpi-build.c | 5 +++++
 1 file changed, 5 insertions(+)
hw/i386/acpi-build.c +5 -0
index 35180ef..784870e 100644
@@ -2167,6 +2167,11 @@ build_dsdt(GArray *table_data, GArray *linker,
                              0, pci->w64.begin, pci->w64.end - 1, 0,
                              pci->w64.end - pci->w64.begin));
     }
+
+    if (misc->tpm_version != TPM_VERSION_UNSPEC) {
+        aml_append(crs, aml_memory32_fixed(TPM_TIS_ADDR_BASE,
+                   TPM_TIS_ADDR_SIZE, AML_READ_WRITE));
+    }
     aml_append(scope, aml_name_decl("_CRS", crs));
 
     /* reserve GPE0 block resources */
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH v2 2/2 tpm: acpi: remove IRQ from TPM's CRS to make Windows not see conflict

In reply to Igor Mammedov

IRQ 5 used by TPM conflicts with PNP0C0F IRQs, as result Windows fails driver initialization with reason
'device cannot find enough free resources'
But if TPM._CRS.IRQ entry is commented out, Windows seems to initialize driver without errors as it doesn't notice possible conflict and it seems to work probably due to a link with IRQ 5 being unused/disabled.

So temporary comment out TPM._CRS.IRQ to 'fix' regression in TPM, with intent to fix it correctly later i.e.:
1. pick unused IRQ as default one for TPM
2. fetch IRQ value from device model so that user could override default one if it conflicts with some other device.

---
 hw/i386/acpi-build.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
hw/i386/acpi-build.c +6 -1
index 784870e..6477003 100644
@@ -2348,7 +2348,12 @@ build_dsdt(GArray *table_data, GArray *linker,
                     crs = aml_resource_template();
                     aml_append(crs, aml_memory32_fixed(TPM_TIS_ADDR_BASE,
                                TPM_TIS_ADDR_SIZE, AML_READ_WRITE));
-                    aml_append(crs, aml_irq_no_flags(TPM_TIS_IRQ));
+                    /*
+                        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)); */
                     aml_append(dev, aml_name_decl("_CRS", crs));
                     aml_append(scope, dev);
                 }
Signature · 1 line
1.8.3.1