Skip to contentSkip to conversation

acpi: tpm: Fix TPM ACPI description

PATCH In review Stefan Berger 4 participants 17 messages Apr 4, 2016 – Apr 8, 2016

lore
Share & tools
lore
#0 lore raw

cover acpi: tpm: Fix TPM ACPI description

This series of patches fixes some problems with the TPM's ACPI description.

Stefan Berger (2):
acpi: tpm: Fix TPM ACPI description (BZ 1281413)
acpi: tpm: Get the interrupt the device model is using

 hw/i386/acpi-build.c | 29 ++++++++++++++---------------
 hw/tpm/tpm_tis.c     |  5 ++++-
 include/sysemu/tpm.h |  6 +++---
 3 files changed, 21 insertions(+), 19 deletions(-)
Signature · 1 line
2.5.5
#1 lore raw

PATCH 1/2 acpi: tpm: Fix TPM ACPI description (BZ 1281413)

This patch addresses BZ 1281413.

https://bugzilla.redhat.com/show_bug.cgi?id=1281413

Fix the APCI description to make it work on operating systems that are more strict about the contents of the TPM's ACPI description than Linux is. The ACPI description was broken in commit 9e472263.

We roll back the ACPI description to where it was in QEMU 2.3.1 and deactivate the interrupt, modify the scope to \_SB, and change the name of the device back to 'TPM' from 'ISA.TPM'. Here's the ACPI description from QEMU 2.3.1:

    Scope(\_SB) {
        /* TPM with emulated TPM TIS interface */
        Device (TPM) {
            Name (_HID, EisaID ("PNP0C31"))
            Name (_CRS, ResourceTemplate ()
            {
                Memory32Fixed (ReadWrite, TPM_TIS_ADDR_BASE, TPM_TIS_ADDR_SIZE)
                // older Linux tpm_tis drivers do not work with IRQ
                //IRQNoFlags () {TPM_TIS_IRQ}
            })
            Method (_STA, 0, NotSerialized) {
                Return (0x0F)
            }
        }
    }
---
 hw/i386/acpi-build.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)
hw/i386/acpi-build.c +12 -14
index 35180ef..e11c721 100644
@@ -2335,22 +2335,20 @@ build_dsdt(GArray *table_data, GArray *linker,
                 Aml *scope = aml_scope("PCI0");
                 /* Scan all PCI buses. Generate tables to support hotplug. */
                 build_append_pci_bus_devices(scope, bus, pm->pcihp_bridge_en);
-
-                if (misc->tpm_version != TPM_VERSION_UNSPEC) {
-                    dev = aml_device("ISA.TPM");
-                    aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C31")));
-                    aml_append(dev, aml_name_decl("_STA", aml_int(0xF)));
-                    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));
-                    aml_append(dev, aml_name_decl("_CRS", crs));
-                    aml_append(scope, dev);
-                }
-
-                aml_append(sb_scope, scope);
             }
         }
+
+        if (misc->tpm_version != TPM_VERSION_UNSPEC) {
+            dev = aml_device("TPM");
+            aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C31")));
+            aml_append(dev, aml_name_decl("_STA", aml_int(0xF)));
+            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));
+            aml_append(dev, aml_name_decl("_CRS", crs));
+            aml_append(sb_scope, dev);
+        }
         aml_append(dsdt, sb_scope);
     }
 
Signature · 1 line
2.5.5
#2 lore raw

Re: [Qemu-devel] [PATCH 1/2] acpi: tpm: Fix TPM ACPI description (BZ 1281413)

Quoted 29 lines · Stefan Berger

This patch addresses BZ 1281413.

https://bugzilla.redhat.com/show_bug.cgi?id=1281413

Fix the APCI description to make it work on operating systems that are more strict about the contents of the TPM's ACPI description than Linux is. The ACPI description was broken in commit 9e472263.

We roll back the ACPI description to where it was in QEMU 2.3.1 and deactivate the interrupt, modify the scope to \_SB, and change the name of the device back to 'TPM' from 'ISA.TPM'. Here's the ACPI description from QEMU 2.3.1:

    Scope(\_SB) {
        /* TPM with emulated TPM TIS interface */
        Device (TPM) {
            Name (_HID, EisaID ("PNP0C31"))
            Name (_CRS, ResourceTemplate ()
            {
                Memory32Fixed (ReadWrite, TPM_TIS_ADDR_BASE, TPM_TIS_ADDR_SIZE)
                // older Linux tpm_tis drivers do not work with IRQ
                //IRQNoFlags () {TPM_TIS_IRQ}
            })
            Method (_STA, 0, NotSerialized) {
                Return (0x0F)
            }
        }
    }
Quoted 1 line

Can we instead use Igor's patch
pc: acpi: tpm: add missing MMIO resource to PCI0._CRS
and only drop the irq_no_flags value?

Quoted 45 lines
---
 hw/i386/acpi-build.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)
hw/i386/acpi-build.c +12 -14
index 35180ef..e11c721 100644
@@ -2335,22 +2335,20 @@ build_dsdt(GArray *table_data, GArray *linker,
                 Aml *scope = aml_scope("PCI0");
                 /* Scan all PCI buses. Generate tables to support hotplug. */
                 build_append_pci_bus_devices(scope, bus, pm->pcihp_bridge_en);
-
-                if (misc->tpm_version != TPM_VERSION_UNSPEC) {
-                    dev = aml_device("ISA.TPM");
-                    aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C31")));
-                    aml_append(dev, aml_name_decl("_STA", aml_int(0xF)));
-                    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));
-                    aml_append(dev, aml_name_decl("_CRS", crs));
-                    aml_append(scope, dev);
-                }
-
-                aml_append(sb_scope, scope);
             }
         }
+
+        if (misc->tpm_version != TPM_VERSION_UNSPEC) {
+            dev = aml_device("TPM");
+            aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C31")));
+            aml_append(dev, aml_name_decl("_STA", aml_int(0xF)));
+            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));
+            aml_append(dev, aml_name_decl("_CRS", crs));
+            aml_append(sb_scope, dev);
+        }
         aml_append(dsdt, sb_scope);
     }
 
Signature · 1 line
2.5.5
#3 lore raw

Re: [Qemu-devel] [PATCH 1/2] acpi: tpm: Fix TPM ACPI description (BZ 1281413)

Quoted 30 lines · Michael S. Tsirkin
Quoted 29 lines · Stefan Berger

This patch addresses BZ 1281413.

https://bugzilla.redhat.com/show_bug.cgi?id=1281413

Fix the APCI description to make it work on operating systems that are more strict about the contents of the TPM's ACPI description than Linux is. The ACPI description was broken in commit 9e472263.

We roll back the ACPI description to where it was in QEMU 2.3.1 and deactivate the interrupt, modify the scope to \_SB, and change the name of the device back to 'TPM' from 'ISA.TPM'. Here's the ACPI description from QEMU 2.3.1:

     Scope(\_SB) {
         /* TPM with emulated TPM TIS interface */
         Device (TPM) {
             Name (_HID, EisaID ("PNP0C31"))
             Name (_CRS, ResourceTemplate ()
             {
                 Memory32Fixed (ReadWrite, TPM_TIS_ADDR_BASE, TPM_TIS_ADDR_SIZE)
                 // older Linux tpm_tis drivers do not work with IRQ
                 //IRQNoFlags () {TPM_TIS_IRQ}
             })
             Method (_STA, 0, NotSerialized) {
                 Return (0x0F)
             }
         }
     }
Quoted 4 lines
Quoted 1 line

Can we instead use Igor's patch
pc: acpi: tpm: add missing MMIO resource to PCI0._CRS
and only drop the irq_no_flags value?

Igor's patch adds this here:

+
+ if (misc->tpm_version != TPM_VERSION_UNSPEC) {
+ aml_append(crs, aml_memory32_fixed(TPM_TIS_ADDR_BASE,
+ TPM_TIS_ADDR_SIZE, AML_READ_WRITE));
+ }

Now we that memory description there twice? I am not sure whether this is necessary, but you are the APCI experts.

Quoted 47 lines
Quoted 47 lines

---
  hw/i386/acpi-build.c | 26 ++++++++++++--------------
  1 file changed, 12 insertions(+), 14 deletions(-)
hw/i386/acpi-build.c +12 -14
index 35180ef..e11c721 100644
@@ -2335,22 +2335,20 @@ build_dsdt(GArray *table_data, GArray *linker,
                  Aml *scope = aml_scope("PCI0");
                  /* Scan all PCI buses. Generate tables to support hotplug. */
                  build_append_pci_bus_devices(scope, bus, pm->pcihp_bridge_en);
-
-                if (misc->tpm_version != TPM_VERSION_UNSPEC) {
-                    dev = aml_device("ISA.TPM");
-                    aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C31")));
-                    aml_append(dev, aml_name_decl("_STA", aml_int(0xF)));
-                    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));
-                    aml_append(dev, aml_name_decl("_CRS", crs));
-                    aml_append(scope, dev);
-                }
-
-                aml_append(sb_scope, scope);
              }
          }
+
+        if (misc->tpm_version != TPM_VERSION_UNSPEC) {
+            dev = aml_device("TPM");
+            aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C31")));
+            aml_append(dev, aml_name_decl("_STA", aml_int(0xF)));
+            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));
+            aml_append(dev, aml_name_decl("_CRS", crs));
+            aml_append(sb_scope, dev);
+        }
          aml_append(dsdt, sb_scope);
      }
 
Signature · 1 line
2.5.5
#4 lore raw

Re: [Qemu-devel] [PATCH 1/2] acpi: tpm: Fix TPM ACPI description (BZ 1281413)

Quoted 45 lines · On Mon, 4 Apr 2016 06:17:38 -0400 Stefan Berger <[email protected]>…
Quoted 30 lines · Michael S. Tsirkin
Quoted 29 lines · Stefan Berger

This patch addresses BZ 1281413.

https://bugzilla.redhat.com/show_bug.cgi?id=1281413

Fix the APCI description to make it work on operating systems that are more strict about the contents of the TPM's ACPI description than Linux is. The ACPI description was broken in commit 9e472263.

We roll back the ACPI description to where it was in QEMU 2.3.1 and deactivate the interrupt, modify the scope to \_SB, and change the name of the device back to 'TPM' from 'ISA.TPM'. Here's the ACPI description from QEMU 2.3.1:

     Scope(\_SB) {
         /* TPM with emulated TPM TIS interface */
         Device (TPM) {
             Name (_HID, EisaID ("PNP0C31"))
             Name (_CRS, ResourceTemplate ()
             {
                 Memory32Fixed (ReadWrite, TPM_TIS_ADDR_BASE,
TPM_TIS_ADDR_SIZE) // older Linux tpm_tis drivers do not work with
IRQ //IRQNoFlags () {TPM_TIS_IRQ}
             })
             Method (_STA, 0, NotSerialized) {
                 Return (0x0F)
             }
         }
     }
Quoted 4 lines
Quoted 1 line

Can we instead use Igor's patch
pc: acpi: tpm: add missing MMIO resource to PCI0._CRS
and only drop the irq_no_flags value?

Igor's patch adds this here:

hw/i386/acpi-build.c +5 -0
+
+    if (misc->tpm_version != TPM_VERSION_UNSPEC) {
+        aml_append(crs, aml_memory32_fixed(TPM_TIS_ADDR_BASE,
+                   TPM_TIS_ADDR_SIZE, AML_READ_WRITE));
+    }
Quoted 2 lines

Now we that memory description there twice? I am not sure whether this is necessary, but you are the APCI experts.

Since TPM_TIS_ADDR_BASE is outside of PCI window of PCI0, we need to add it explicitly to PCI0._CRS.
Moving out of scope is plainly wrong and works just by accident.

Granted that Michael is fine with hiding IRQ and provided that you'll fix IRQ handling later, I won't object commenting IRQ entry for 2.6.

Quoted 57 lines
Quoted 56 lines
Quoted 56 lines




---
  hw/i386/acpi-build.c | 26 ++++++++++++--------------
  1 file changed, 12 insertions(+), 14 deletions(-)
hw/i386/acpi-build.c +0 -0
index 35180ef..e11c721 100644
@@ -2335,22 +2335,20 @@ build_dsdt(GArray *table_data, GArray
 *linker, Aml *scope = aml_scope("PCI0");
                  /* Scan all PCI buses. Generate tables to
 support hotplug. */ build_append_pci_bus_devices(scope, bus,

pm->pcihp_bridge_en); -

hw/i386/acpi-build.c +0 -3
-                if (misc->tpm_version != TPM_VERSION_UNSPEC) {
-                    dev = aml_device("ISA.TPM");
-                    aml_append(dev, aml_name_decl("_HID",

aml_eisaid("PNP0C31")));
- aml_append(dev, aml_name_decl("_STA",
aml_int(0xF)));

hw/i386/acpi-build.c +0 -2
-                    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));

hw/i386/acpi-build.c +4 -5
-                    aml_append(dev, aml_name_decl("_CRS", crs));
-                    aml_append(scope, dev);
-                }
-
-                aml_append(sb_scope, scope);
              }
          }
+
+        if (misc->tpm_version != TPM_VERSION_UNSPEC) {
+            dev = aml_device("TPM");
+            aml_append(dev, aml_name_decl("_HID",

aml_eisaid("PNP0C31")));

hw/i386/acpi-build.c +8 -0
+            aml_append(dev, aml_name_decl("_STA", aml_int(0xF)));
+            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));
+            aml_append(dev, aml_name_decl("_CRS", crs));
+            aml_append(sb_scope, dev);
+        }
          aml_append(dsdt, sb_scope);
      }
Signature · 2 lines
-- 
2.5.5
#5 lore raw

PATCH 2/2 acpi: tpm: Get the interrupt the device model is using

In reply to Stefan Berger

Get the interrupt the TPM device model is using. Do not activate the interrupt in the ACPI description yet since the current default value clashes with other devices.

---
 hw/i386/acpi-build.c | 5 +++--
 hw/tpm/tpm_tis.c     | 5 ++++-
 include/sysemu/tpm.h | 6 +++---
 3 files changed, 10 insertions(+), 6 deletions(-)
hw/i386/acpi-build.c +3 -2
index e11c721..ae872a1 100644
@@ -105,6 +105,7 @@ typedef struct AcpiMiscInfo {
     bool is_piix4;
     bool has_hpet;
     TPMVersion tpm_version;
+    uint32_t tpm_irq_num;
     const unsigned char *dsdt_code;
     unsigned dsdt_size;
     uint16_t pvpanic_port;
@@ -203,7 +204,7 @@ static void acpi_get_misc_info(AcpiMiscInfo *info)
     }
 
     info->has_hpet = hpet_find();
-    info->tpm_version = tpm_get_version();
+    info->tpm_version = tpm_get_parameters(&info->tpm_irq_num);
     info->pvpanic_port = pvpanic_port();
     info->applesmc_io_base = applesmc_port();
 }
@@ -2345,7 +2346,7 @@ 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));
+            //aml_append(crs, aml_irq_no_flags(misc->tpm_irq_num));
             aml_append(dev, aml_name_decl("_CRS", crs));
             aml_append(sb_scope, dev);
         }
hw/tpm/tpm_tis.c +4 -1
index 381e726..9f5b2f7 100644
@@ -967,9 +967,12 @@ static int tpm_tis_do_startup_tpm(TPMState *s)
 /*
  * Get the TPMVersion of the backend device being used
  */
-TPMVersion tpm_tis_get_tpm_version(Object *obj)
+TPMVersion tpm_tis_get_tpm_parameters(Object *obj, uint32_t *irq_num)
 {
     TPMState *s = TPM(obj);
+    TPMTISEmuState *tis = &s->s.tis;
+
+    *irq_num = tis->irq_num;
 
     return tpm_backend_get_tpm_version(s->be_driver);
 }
include/sysemu/tpm.h +3 -3
index c8afa17..5be45d9 100644
@@ -26,17 +26,17 @@ typedef enum  TPMVersion {
     TPM_VERSION_2_0 = 2,
 } TPMVersion;
 
-TPMVersion tpm_tis_get_tpm_version(Object *obj);
+TPMVersion tpm_tis_get_tpm_parameters(Object *obj, uint32_t *irq_num);
 
 #define TYPE_TPM_TIS                "tpm-tis"
 
-static inline TPMVersion tpm_get_version(void)
+static inline TPMVersion tpm_get_parameters(uint32_t *irq_num)
 {
 #ifdef CONFIG_TPM
     Object *obj = object_resolve_path_type("", TYPE_TPM_TIS, NULL);
 
     if (obj) {
-        return tpm_tis_get_tpm_version(obj);
+        return tpm_tis_get_tpm_parameters(obj, irq_num);
     }
 #endif
     return TPM_VERSION_UNSPEC;
Signature · 1 line
2.5.5
#6 lore raw

Re: [Qemu-devel] [PATCH 2/2] acpi: tpm: Get the interrupt the device model is using

Quoted 5 lines · Stefan Berger

Get the interrupt the TPM device model is using. Do not activate the interrupt in the ACPI description yet since the current default value clashes with other devices.

Is this doing anything at all then?
I'd rather keep cleanups until post-2.6.

Quoted 81 lines
---
 hw/i386/acpi-build.c | 5 +++--
 hw/tpm/tpm_tis.c     | 5 ++++-
 include/sysemu/tpm.h | 6 +++---
 3 files changed, 10 insertions(+), 6 deletions(-)
hw/i386/acpi-build.c +3 -2
index e11c721..ae872a1 100644
@@ -105,6 +105,7 @@ typedef struct AcpiMiscInfo {
     bool is_piix4;
     bool has_hpet;
     TPMVersion tpm_version;
+    uint32_t tpm_irq_num;
     const unsigned char *dsdt_code;
     unsigned dsdt_size;
     uint16_t pvpanic_port;
@@ -203,7 +204,7 @@ static void acpi_get_misc_info(AcpiMiscInfo *info)
     }
 
     info->has_hpet = hpet_find();
-    info->tpm_version = tpm_get_version();
+    info->tpm_version = tpm_get_parameters(&info->tpm_irq_num);
     info->pvpanic_port = pvpanic_port();
     info->applesmc_io_base = applesmc_port();
 }
@@ -2345,7 +2346,7 @@ 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));
+            //aml_append(crs, aml_irq_no_flags(misc->tpm_irq_num));
             aml_append(dev, aml_name_decl("_CRS", crs));
             aml_append(sb_scope, dev);
         }
hw/tpm/tpm_tis.c +4 -1
index 381e726..9f5b2f7 100644
@@ -967,9 +967,12 @@ static int tpm_tis_do_startup_tpm(TPMState *s)
 /*
  * Get the TPMVersion of the backend device being used
  */
-TPMVersion tpm_tis_get_tpm_version(Object *obj)
+TPMVersion tpm_tis_get_tpm_parameters(Object *obj, uint32_t *irq_num)
 {
     TPMState *s = TPM(obj);
+    TPMTISEmuState *tis = &s->s.tis;
+
+    *irq_num = tis->irq_num;
 
     return tpm_backend_get_tpm_version(s->be_driver);
 }
include/sysemu/tpm.h +3 -3
index c8afa17..5be45d9 100644
@@ -26,17 +26,17 @@ typedef enum  TPMVersion {
     TPM_VERSION_2_0 = 2,
 } TPMVersion;
 
-TPMVersion tpm_tis_get_tpm_version(Object *obj);
+TPMVersion tpm_tis_get_tpm_parameters(Object *obj, uint32_t *irq_num);
 
 #define TYPE_TPM_TIS                "tpm-tis"
 
-static inline TPMVersion tpm_get_version(void)
+static inline TPMVersion tpm_get_parameters(uint32_t *irq_num)
 {
 #ifdef CONFIG_TPM
     Object *obj = object_resolve_path_type("", TYPE_TPM_TIS, NULL);
 
     if (obj) {
-        return tpm_tis_get_tpm_version(obj);
+        return tpm_tis_get_tpm_parameters(obj, irq_num);
     }
 #endif
     return TPM_VERSION_UNSPEC;
Signature · 1 line
2.5.5
#7 lore raw

Re: [Qemu-devel] [PATCH 2/2] acpi: tpm: Get the interrupt the device model is using

Quoted 7 lines · Michael S. Tsirkin
Quoted 5 lines · Stefan Berger

Get the interrupt the TPM device model is using. Do not activate the interrupt in the ACPI description yet since the current default value clashes with other devices.

Is this doing anything at all then?

It's fixing the retrieval of data from the TPM model.

Quoted 83 lines

I'd rather keep cleanups until post-2.6.

Quoted 81 lines
---
  hw/i386/acpi-build.c | 5 +++--
  hw/tpm/tpm_tis.c     | 5 ++++-
  include/sysemu/tpm.h | 6 +++---
  3 files changed, 10 insertions(+), 6 deletions(-)
hw/i386/acpi-build.c +3 -2
index e11c721..ae872a1 100644
@@ -105,6 +105,7 @@ typedef struct AcpiMiscInfo {
      bool is_piix4;
      bool has_hpet;
      TPMVersion tpm_version;
+    uint32_t tpm_irq_num;
      const unsigned char *dsdt_code;
      unsigned dsdt_size;
      uint16_t pvpanic_port;
@@ -203,7 +204,7 @@ static void acpi_get_misc_info(AcpiMiscInfo *info)
      }
 
      info->has_hpet = hpet_find();
-    info->tpm_version = tpm_get_version();
+    info->tpm_version = tpm_get_parameters(&info->tpm_irq_num);
      info->pvpanic_port = pvpanic_port();
      info->applesmc_io_base = applesmc_port();
  }
@@ -2345,7 +2346,7 @@ 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));
+            //aml_append(crs, aml_irq_no_flags(misc->tpm_irq_num));
              aml_append(dev, aml_name_decl("_CRS", crs));
              aml_append(sb_scope, dev);
          }
hw/tpm/tpm_tis.c +4 -1
index 381e726..9f5b2f7 100644
@@ -967,9 +967,12 @@ static int tpm_tis_do_startup_tpm(TPMState *s)
  /*
   * Get the TPMVersion of the backend device being used
   */
-TPMVersion tpm_tis_get_tpm_version(Object *obj)
+TPMVersion tpm_tis_get_tpm_parameters(Object *obj, uint32_t *irq_num)
  {
      TPMState *s = TPM(obj);
+    TPMTISEmuState *tis = &s->s.tis;
+
+    *irq_num = tis->irq_num;
 
      return tpm_backend_get_tpm_version(s->be_driver);
  }
include/sysemu/tpm.h +3 -3
index c8afa17..5be45d9 100644
@@ -26,17 +26,17 @@ typedef enum  TPMVersion {
      TPM_VERSION_2_0 = 2,
  } TPMVersion;
 
-TPMVersion tpm_tis_get_tpm_version(Object *obj);
+TPMVersion tpm_tis_get_tpm_parameters(Object *obj, uint32_t *irq_num);
 
  #define TYPE_TPM_TIS                "tpm-tis"
 
-static inline TPMVersion tpm_get_version(void)
+static inline TPMVersion tpm_get_parameters(uint32_t *irq_num)
  {
  #ifdef CONFIG_TPM
      Object *obj = object_resolve_path_type("", TYPE_TPM_TIS, NULL);
 
      if (obj) {
-        return tpm_tis_get_tpm_version(obj);
+        return tpm_tis_get_tpm_parameters(obj, irq_num);
      }
  #endif
      return TPM_VERSION_UNSPEC;
Signature · 1 line
2.5.5
#8 lore raw

Re: [Qemu-devel] [PATCH 2/2] acpi: tpm: Get the interrupt the device model is using

Quoted 10 lines · Stefan Berger
Quoted 7 lines · Michael S. Tsirkin
Quoted 5 lines · Stefan Berger

Get the interrupt the TPM device model is using. Do not activate the interrupt in the ACPI description yet since the current default value clashes with other devices.

Is this doing anything at all then?

It's fixing the retrieval of data from the TPM model.

Right but you never tell guest it can use interrupts, right? So why does it matter which interrupt we end up not using?

Quoted 77 lines
Quoted 77 lines

I'd rather keep cleanups until post-2.6.

Quoted 75 lines
---
 hw/i386/acpi-build.c | 5 +++--
 hw/tpm/tpm_tis.c     | 5 ++++-
 include/sysemu/tpm.h | 6 +++---
 3 files changed, 10 insertions(+), 6 deletions(-)
hw/i386/acpi-build.c +3 -2
index e11c721..ae872a1 100644
@@ -105,6 +105,7 @@ typedef struct AcpiMiscInfo {
     bool is_piix4;
     bool has_hpet;
     TPMVersion tpm_version;
+    uint32_t tpm_irq_num;
     const unsigned char *dsdt_code;
     unsigned dsdt_size;
     uint16_t pvpanic_port;
@@ -203,7 +204,7 @@ static void acpi_get_misc_info(AcpiMiscInfo *info)
     }
     info->has_hpet = hpet_find();
-    info->tpm_version = tpm_get_version();
+    info->tpm_version = tpm_get_parameters(&info->tpm_irq_num);
     info->pvpanic_port = pvpanic_port();
     info->applesmc_io_base = applesmc_port();
 }
@@ -2345,7 +2346,7 @@ 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));
+            //aml_append(crs, aml_irq_no_flags(misc->tpm_irq_num));
             aml_append(dev, aml_name_decl("_CRS", crs));
             aml_append(sb_scope, dev);
         }
hw/tpm/tpm_tis.c +4 -1
index 381e726..9f5b2f7 100644
@@ -967,9 +967,12 @@ static int tpm_tis_do_startup_tpm(TPMState *s)
 /*
  * Get the TPMVersion of the backend device being used
  */
-TPMVersion tpm_tis_get_tpm_version(Object *obj)
+TPMVersion tpm_tis_get_tpm_parameters(Object *obj, uint32_t *irq_num)
 {
     TPMState *s = TPM(obj);
+    TPMTISEmuState *tis = &s->s.tis;
+
+    *irq_num = tis->irq_num;
     return tpm_backend_get_tpm_version(s->be_driver);
 }
include/sysemu/tpm.h +3 -3
index c8afa17..5be45d9 100644
@@ -26,17 +26,17 @@ typedef enum  TPMVersion {
     TPM_VERSION_2_0 = 2,
 } TPMVersion;
-TPMVersion tpm_tis_get_tpm_version(Object *obj);
+TPMVersion tpm_tis_get_tpm_parameters(Object *obj, uint32_t *irq_num);
 #define TYPE_TPM_TIS                "tpm-tis"
-static inline TPMVersion tpm_get_version(void)
+static inline TPMVersion tpm_get_parameters(uint32_t *irq_num)
 {
 #ifdef CONFIG_TPM
     Object *obj = object_resolve_path_type("", TYPE_TPM_TIS, NULL);
     if (obj) {
-        return tpm_tis_get_tpm_version(obj);
+        return tpm_tis_get_tpm_parameters(obj, irq_num);
     }
 #endif
     return TPM_VERSION_UNSPEC;
Signature · 1 line
2.5.5
#9 lore raw

Re: [Qemu-devel] [PATCH 2/2] acpi: tpm: Get the interrupt the device model is using

In reply to Stefan Berger
Quoted 24 lines · On Sun, 3 Apr 2016 21:37:56 -0400 Stefan Berger <[email protected]> wrote:

Get the interrupt the TPM device model is using. Do not activate the interrupt in the ACPI description yet since the current default value clashes with other devices.

---
 hw/i386/acpi-build.c | 5 +++--
 hw/tpm/tpm_tis.c     | 5 ++++-
 include/sysemu/tpm.h | 6 +++---
 3 files changed, 10 insertions(+), 6 deletions(-)
hw/i386/acpi-build.c +1 -0
index e11c721..ae872a1 100644
@@ -105,6 +105,7 @@ typedef struct AcpiMiscInfo {
     bool is_piix4;
     bool has_hpet;
     TPMVersion tpm_version;
+    uint32_t tpm_irq_num;
     const unsigned char *dsdt_code;
     unsigned dsdt_size;
     uint16_t pvpanic_port;

hw/i386/acpi-build.c static void acpi_get_misc_info(AcpiMiscInfo *info) · line 207

Quoted 5 lines
hw/i386/acpi-build.c +1 -1
@@ -203,7 +204,7 @@ static void acpi_get_misc_info(AcpiMiscInfo *info)
     }
 
     info->has_hpet = hpet_find();
-    info->tpm_version = tpm_get_version();
+    info->tpm_version = tpm_get_parameters(&info->tpm_irq_num);

it's a bit confusing to read, provided that IRQ is an object property I would just do here:

  obj  = object_resolve_path_type("", TYPE_TPM_TIS, NULL);
  if (obj)
    info->tpm_irq_num = object_property_get_int(obj, "irq", NULL);

may be do the same for version too and do away with tpm_get_*() wrapper that pokes into object internals. (result is 1 less global symbol to link and no ifdef magic in tpm.h)

Quoted 55 lines
hw/i386/acpi-build.c +1 -1
     info->pvpanic_port = pvpanic_port();
     info->applesmc_io_base = applesmc_port();
 }
@@ -2345,7 +2346,7 @@ 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));
+            //aml_append(crs, aml_irq_no_flags(misc->tpm_irq_num));
             aml_append(dev, aml_name_decl("_CRS", crs));
             aml_append(sb_scope, dev);
         }
hw/tpm/tpm_tis.c +4 -1
index 381e726..9f5b2f7 100644
@@ -967,9 +967,12 @@ static int tpm_tis_do_startup_tpm(TPMState *s)
 /*
  * Get the TPMVersion of the backend device being used
  */
-TPMVersion tpm_tis_get_tpm_version(Object *obj)
+TPMVersion tpm_tis_get_tpm_parameters(Object *obj, uint32_t *irq_num)
 {
     TPMState *s = TPM(obj);
+    TPMTISEmuState *tis = &s->s.tis;
+
+    *irq_num = tis->irq_num;
 
     return tpm_backend_get_tpm_version(s->be_driver);
 }
include/sysemu/tpm.h +3 -3
index c8afa17..5be45d9 100644
@@ -26,17 +26,17 @@ typedef enum  TPMVersion {
     TPM_VERSION_2_0 = 2,
 } TPMVersion;
 
-TPMVersion tpm_tis_get_tpm_version(Object *obj);
+TPMVersion tpm_tis_get_tpm_parameters(Object *obj, uint32_t
 *irq_num); 
 #define TYPE_TPM_TIS                "tpm-tis"
 
-static inline TPMVersion tpm_get_version(void)
+static inline TPMVersion tpm_get_parameters(uint32_t *irq_num)
 {
 #ifdef CONFIG_TPM
     Object *obj = object_resolve_path_type("", TYPE_TPM_TIS, NULL);
 
     if (obj) {
-        return tpm_tis_get_tpm_version(obj);
+        return tpm_tis_get_tpm_parameters(obj, irq_num);
     }
 #endif
     return TPM_VERSION_UNSPEC;
#10 lore raw
In reply to Stefan Berger
Quoted 2 lines · Stefan Berger

This series of patches fixes some problems with the TPM's ACPI description.

Could you pls describe how does this interact with Igor's patch?

Quoted 11 lines

Stefan Berger (2):
acpi: tpm: Fix TPM ACPI description (BZ 1281413)
acpi: tpm: Get the interrupt the device model is using

 hw/i386/acpi-build.c | 29 ++++++++++++++---------------
 hw/tpm/tpm_tis.c     |  5 ++++-
 include/sysemu/tpm.h |  6 +++---
 3 files changed, 21 insertions(+), 19 deletions(-)
Signature · 1 line
2.5.5
#11 lore raw
Quoted 4 lines · Michael S. Tsirkin
Quoted 2 lines · Stefan Berger

This series of patches fixes some problems with the TPM's ACPI description.

Could you pls describe how does this interact with Igor's patch?

Follow https://bugzilla.redhat.com/attachment.cgi?id=1137429 and attachment https://bugzilla.redhat.com/attachment.cgi?id=1137429 I don't think we need Igor's patch. I am posting what has been tested.

Quoted 13 lines
Quoted 13 lines

Stefan Berger (2):
acpi: tpm: Fix TPM ACPI description (BZ 1281413)
acpi: tpm: Get the interrupt the device model is using

  hw/i386/acpi-build.c | 29 ++++++++++++++---------------
  hw/tpm/tpm_tis.c     |  5 ++++-
  include/sysemu/tpm.h |  6 +++---
  3 files changed, 21 insertions(+), 19 deletions(-)
Signature · 1 line
2.5.5
#12 lore raw
Quoted 9 lines · On Mon, 4 Apr 2016 06:31:43 -0400 Stefan Berger <[email protected]>…
Quoted 4 lines · Michael S. Tsirkin
Quoted 2 lines · Stefan Berger

This series of patches fixes some problems with the TPM's ACPI description.

Could you pls describe how does this interact with Igor's patch?

Follow https://bugzilla.redhat.com/attachment.cgi?id=1137429 and attachment https://bugzilla.redhat.com/attachment.cgi?id=1137429 I don't think we need Igor's patch. I am posting what has been tested.

I've also tested my patch + commented out irq, it also 'works'. i.e. Windows doesn't see irq conflict as well.

Quoted 15 lines
Quoted 14 lines
Quoted 14 lines

Stefan Berger (2):
acpi: tpm: Fix TPM ACPI description (BZ 1281413)
acpi: tpm: Get the interrupt the device model is using

  hw/i386/acpi-build.c | 29 ++++++++++++++---------------
  hw/tpm/tpm_tis.c     |  5 ++++-
  include/sysemu/tpm.h |  6 +++---
  3 files changed, 21 insertions(+), 19 deletions(-)
Signature · 1 line
2.5.5
#13 lore raw
Quoted 7 lines · Igor Mammedov
Quoted 4 lines · On Mon, 4 Apr 2016 06:31:43 -0400 Stefan Berger <[email protected]>…
Quoted 3 lines · Michael S. Tsirkin
Quoted 2 lines · Stefan Berger

This series of patches fixes some problems with the TPM's ACPI description.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Could you pls describe how does this interact with Igor's patch?

Follow https://bugzilla.redhat.com/attachment.cgi?id=1137429 and attachment https://bugzilla.redhat.com/attachment.cgi?id=1137429 I don't think we need Igor's patch. I am posting what has been tested.

I've also tested my patch + commented out irq, it also 'works'. i.e. Windows doesn't see irq conflict as well.

Igor, could you please post a complete patchset for testing? It seems preferable to me.

Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 14 lines

Stefan Berger (2):
acpi: tpm: Fix TPM ACPI description (BZ 1281413)
acpi: tpm: Get the interrupt the device model is using

  hw/i386/acpi-build.c | 29 ++++++++++++++---------------
  hw/tpm/tpm_tis.c     |  5 ++++-
  include/sysemu/tpm.h |  6 +++---
  3 files changed, 21 insertions(+), 19 deletions(-)
Signature · 1 line
2.5.5
#14 lore raw
Quoted 10 lines · On Fri, 8 Apr 2016 10:51:30 +0300 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 9 lines · Igor Mammedov
Quoted 6 lines · On Mon, 4 Apr 2016 06:31:43 -0400 Stefan Berger <[email protected]>…
Quoted 4 lines · Michael S. Tsirkin
Quoted 2 lines · Stefan Berger

This series of patches fixes some problems with the TPM's ACPI description.

Could you pls describe how does this interact with Igor's patch?

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Follow https://bugzilla.redhat.com/attachment.cgi?id=1137429 and attachment https://bugzilla.redhat.com/attachment.cgi?id=1137429 I don't think we need Igor's patch. I am posting what has been tested.

I've also tested my patch + commented out irq, it also 'works'. i.e. Windows doesn't see irq conflict as well.

Igor, could you please post a complete patchset for testing? It seems preferable to me.

Ok, I'll post a2 patches, 1st adding range to PCI0._CRS and 2nd commenting out IRQ entry with a hope that Stefan will fix IRQ handling in 2.7 dev cycle.

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
Quoted 15 lines

Stefan Berger (2):
acpi: tpm: Fix TPM ACPI description (BZ 1281413)
acpi: tpm: Get the interrupt the device model is using

  hw/i386/acpi-build.c | 29 ++++++++++++++---------------
  hw/tpm/tpm_tis.c     |  5 ++++-
  include/sysemu/tpm.h |  6 +++---
  3 files changed, 21 insertions(+), 19 deletions(-)
Signature · 1 line
2.5.5  
#15 lore raw
In reply to Stefan Berger
Quoted 9 lines · Stefan Berger
Quoted 4 lines · Michael S. Tsirkin
Quoted 2 lines · Stefan Berger

This series of patches fixes some problems with the TPM's ACPI description.

Could you pls describe how does this interact with Igor's patch?

Follow https://bugzilla.redhat.com/attachment.cgi?id=1137429 and attachment
https://bugzilla.redhat.com/attachment.cgi?id=1137429 I don't think we need Igor's patch. I am posting what has been tested.

I might just merge the change 1/2 under the justification "we don't know what's going on, let's revert to old behaviour for now even if it seems broken". But let's be clear this is what is going on here, the commit log at least does not explain what the issues
are and how they are fixed.

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines

Stefan Berger (2):
acpi: tpm: Fix TPM ACPI description (BZ 1281413)
acpi: tpm: Get the interrupt the device model is using

 hw/i386/acpi-build.c | 29 ++++++++++++++---------------
 hw/tpm/tpm_tis.c     |  5 ++++-
 include/sysemu/tpm.h |  6 +++---
 3 files changed, 21 insertions(+), 19 deletions(-)
Signature · 1 line
2.5.5
#16 lore raw
Quoted 6 lines · Michael S. Tsirkin
Quoted 5 lines · Stefan Berger
Quoted 4 lines · Michael S. Tsirkin
Quoted 2 lines · Stefan Berger

This series of patches fixes some problems with the TPM's ACPI description.

Could you pls describe how does this interact with Igor's patch?

Quoted 8 lines
Quoted 3 lines

Follow https://bugzilla.redhat.com/attachment.cgi?id=1137429 and attachment
https://bugzilla.redhat.com/attachment.cgi?id=1137429 I don't think we need Igor's patch. I am posting what has been tested.

I might just merge the change 1/2 under the justification "we don't know what's going on, let's revert to old behaviour for now even if it seems broken". But let's be clear this is what is going on here, the commit log at least does not explain what the issues
are and how they are fixed.

Thx