diff mbox series

acpi: Make TPM 2.0 with TIS available as MSFT0101

Message ID 20190125210058.1092551-1-stefanb@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series acpi: Make TPM 2.0 with TIS available as MSFT0101 | expand

Commit Message

Stefan Berger Jan. 25, 2019, 9 p.m. UTC
This patch makes the a TPM 2.0 with TIS interface available under the
HID 'MSF0101'. This is supported by Linux and also Windows now
recognizes the TPM 2.0 with TIS interface. Leave the TPM 1.2 as before.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
---
 hw/i386/acpi-build.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

Comments

Igor Mammedov Jan. 28, 2019, 2:45 p.m. UTC | #1
On Fri, 25 Jan 2019 16:00:58 -0500
Stefan Berger <stefanb@linux.ibm.com> wrote:

> This patch makes the a TPM 2.0 with TIS interface available under the
> HID 'MSF0101'. This is supported by Linux and also Windows now
MSF0101 is relatively recent addition to Linux,
are there in wild (old) kernels that worked with PNP0C31 but won't work
with MSF0101?

> recognizes the TPM 2.0 with TIS interface. Leave the TPM 1.2 as before.
> 
> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
> ---
>  hw/i386/acpi-build.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 2e21a31f82..f51225b4a7 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -2141,8 +2141,16 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
>              build_append_pci_bus_devices(scope, bus, pm->pcihp_bridge_en);
>  
>              if (TPM_IS_TIS(tpm)) {
> -                dev = aml_device("ISA.TPM");
> -                aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C31")));
> +                if (misc->tpm_version == TPM_VERSION_2_0) {
> +                    dev = aml_device("TPM");
> +                    aml_append(dev, aml_name_decl("_HID",
> +                                                  aml_string("MSFT0101")));
> +                } else {
> +                    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,
Michael S. Tsirkin Jan. 28, 2019, 3:15 p.m. UTC | #2
On Mon, Jan 28, 2019 at 03:45:53PM +0100, Igor Mammedov wrote:
> On Fri, 25 Jan 2019 16:00:58 -0500
> Stefan Berger <stefanb@linux.ibm.com> wrote:
> 
> > This patch makes the a TPM 2.0 with TIS interface available under the
> > HID 'MSF0101'. This is supported by Linux and also Windows now
> MSF0101 is relatively recent addition to Linux,
> are there in wild (old) kernels that worked with PNP0C31 but won't work
> with MSF0101?

Well what would you do? You either have TPM 2.0 or you don't.
If you have a 2.0 backend you need to expose it as 2.0
to the frontend right?

> > recognizes the TPM 2.0 with TIS interface. Leave the TPM 1.2 as before.
> > 
> > Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
> > ---
> >  hw/i386/acpi-build.c | 12 ++++++++++--
> >  1 file changed, 10 insertions(+), 2 deletions(-)
> > 
> > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> > index 2e21a31f82..f51225b4a7 100644
> > --- a/hw/i386/acpi-build.c
> > +++ b/hw/i386/acpi-build.c
> > @@ -2141,8 +2141,16 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
> >              build_append_pci_bus_devices(scope, bus, pm->pcihp_bridge_en);
> >  
> >              if (TPM_IS_TIS(tpm)) {
> > -                dev = aml_device("ISA.TPM");
> > -                aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C31")));
> > +                if (misc->tpm_version == TPM_VERSION_2_0) {
> > +                    dev = aml_device("TPM");
> > +                    aml_append(dev, aml_name_decl("_HID",
> > +                                                  aml_string("MSFT0101")));
> > +                } else {
> > +                    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,
Igor Mammedov Jan. 28, 2019, 3:40 p.m. UTC | #3
On Mon, 28 Jan 2019 10:15:55 -0500
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Mon, Jan 28, 2019 at 03:45:53PM +0100, Igor Mammedov wrote:
> > On Fri, 25 Jan 2019 16:00:58 -0500
> > Stefan Berger <stefanb@linux.ibm.com> wrote:
> >   
> > > This patch makes the a TPM 2.0 with TIS interface available under the
> > > HID 'MSF0101'. This is supported by Linux and also Windows now  
> > MSF0101 is relatively recent addition to Linux,
> > are there in wild (old) kernels that worked with PNP0C31 but won't work
> > with MSF0101?  
> 
> Well what would you do? You either have TPM 2.0 or you don't.
> If you have a 2.0 backend you need to expose it as 2.0
> to the frontend right?
I wasn't clear enough, question is:
If there are kernels where TPM2 worked with PNP0C31 and without MSF0101 support?

 
> > > recognizes the TPM 2.0 with TIS interface. Leave the TPM 1.2 as before.
> > > 
> > > Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
> > > ---
> > >  hw/i386/acpi-build.c | 12 ++++++++++--
> > >  1 file changed, 10 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> > > index 2e21a31f82..f51225b4a7 100644
> > > --- a/hw/i386/acpi-build.c
> > > +++ b/hw/i386/acpi-build.c
> > > @@ -2141,8 +2141,16 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
> > >              build_append_pci_bus_devices(scope, bus, pm->pcihp_bridge_en);
> > >  
> > >              if (TPM_IS_TIS(tpm)) {
> > > -                dev = aml_device("ISA.TPM");
> > > -                aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C31")));
> > > +                if (misc->tpm_version == TPM_VERSION_2_0) {
> > > +                    dev = aml_device("TPM");
> > > +                    aml_append(dev, aml_name_decl("_HID",
> > > +                                                  aml_string("MSFT0101")));
> > > +                } else {
> > > +                    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,
Michael S. Tsirkin Jan. 28, 2019, 3:56 p.m. UTC | #4
On Mon, Jan 28, 2019 at 04:40:46PM +0100, Igor Mammedov wrote:
> On Mon, 28 Jan 2019 10:15:55 -0500
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> 
> > On Mon, Jan 28, 2019 at 03:45:53PM +0100, Igor Mammedov wrote:
> > > On Fri, 25 Jan 2019 16:00:58 -0500
> > > Stefan Berger <stefanb@linux.ibm.com> wrote:
> > >   
> > > > This patch makes the a TPM 2.0 with TIS interface available under the
> > > > HID 'MSF0101'. This is supported by Linux and also Windows now  
> > > MSF0101 is relatively recent addition to Linux,
> > > are there in wild (old) kernels that worked with PNP0C31 but won't work
> > > with MSF0101?  
> > 
> > Well what would you do? You either have TPM 2.0 or you don't.
> > If you have a 2.0 backend you need to expose it as 2.0
> > to the frontend right?
> I wasn't clear enough, question is:
> If there are kernels where TPM2 worked with PNP0C31 and without MSF0101 support?

As far as I can see TPM 2.0 support was added by

commit 30fc8d138e9123f374a3c3867e7c7c5cd4004941
Author: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Date:   Fri Dec 12 11:46:39 2014 -0800

    tpm: TPM 2.0 CRB Interface

this seems to already use MSF0101.


I guess the answer is no.

>  
> > > > recognizes the TPM 2.0 with TIS interface. Leave the TPM 1.2 as before.
> > > > 
> > > > Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
> > > > ---
> > > >  hw/i386/acpi-build.c | 12 ++++++++++--
> > > >  1 file changed, 10 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> > > > index 2e21a31f82..f51225b4a7 100644
> > > > --- a/hw/i386/acpi-build.c
> > > > +++ b/hw/i386/acpi-build.c
> > > > @@ -2141,8 +2141,16 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
> > > >              build_append_pci_bus_devices(scope, bus, pm->pcihp_bridge_en);
> > > >  
> > > >              if (TPM_IS_TIS(tpm)) {
> > > > -                dev = aml_device("ISA.TPM");
> > > > -                aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C31")));
> > > > +                if (misc->tpm_version == TPM_VERSION_2_0) {
> > > > +                    dev = aml_device("TPM");
> > > > +                    aml_append(dev, aml_name_decl("_HID",
> > > > +                                                  aml_string("MSFT0101")));
> > > > +                } else {
> > > > +                    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,
Stefan Berger Jan. 28, 2019, 4:14 p.m. UTC | #5
On 1/28/19 9:45 AM, Igor Mammedov wrote:
> On Fri, 25 Jan 2019 16:00:58 -0500
> Stefan Berger <stefanb@linux.ibm.com> wrote:
>
>> This patch makes the a TPM 2.0 with TIS interface available under the
>> HID 'MSF0101'. This is supported by Linux and also Windows now
> MSF0101 is relatively recent addition to Linux,
> are there in wild (old) kernels that worked with PNP0C31 but won't work
> with MSF0101?


Linux 4.3.4 and later references this HID here: 
https://elixir.bootlin.com/linux/v4.3.4/source/drivers/char/tpm/tpm_tis.c 
. I don't see it before that. A 3.10 kernel works with this patch as well.


>
>> recognizes the TPM 2.0 with TIS interface. Leave the TPM 1.2 as before.
>>
>> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
>> ---
>>   hw/i386/acpi-build.c | 12 ++++++++++--
>>   1 file changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
>> index 2e21a31f82..f51225b4a7 100644
>> --- a/hw/i386/acpi-build.c
>> +++ b/hw/i386/acpi-build.c
>> @@ -2141,8 +2141,16 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
>>               build_append_pci_bus_devices(scope, bus, pm->pcihp_bridge_en);
>>   
>>               if (TPM_IS_TIS(tpm)) {
>> -                dev = aml_device("ISA.TPM");
>> -                aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C31")));
>> +                if (misc->tpm_version == TPM_VERSION_2_0) {
>> +                    dev = aml_device("TPM");
>> +                    aml_append(dev, aml_name_decl("_HID",
>> +                                                  aml_string("MSFT0101")));
>> +                } else {
>> +                    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,
Stefan Berger Jan. 28, 2019, 5:19 p.m. UTC | #6
On 1/28/19 11:14 AM, Stefan Berger wrote:
> On 1/28/19 9:45 AM, Igor Mammedov wrote:
>> On Fri, 25 Jan 2019 16:00:58 -0500
>> Stefan Berger <stefanb@linux.ibm.com> wrote:
>>
>>> This patch makes the a TPM 2.0 with TIS interface available under the
>>> HID 'MSF0101'. This is supported by Linux and also Windows now
>> MSF0101 is relatively recent addition to Linux,
>> are there in wild (old) kernels that worked with PNP0C31 but won't work
>> with MSF0101?
>
>
> Linux 4.3.4 and later references this HID here: 
> https://elixir.bootlin.com/linux/v4.3.4/source/drivers/char/tpm/tpm_tis.c 
> . I don't see it before that. A 3.10 kernel works with this patch as 
> well.


... that 3.10 kernel from el7 has been patched, though.

    Stefan
Michael S. Tsirkin Jan. 28, 2019, 5:49 p.m. UTC | #7
On Mon, Jan 28, 2019 at 12:19:37PM -0500, Stefan Berger wrote:
> On 1/28/19 11:14 AM, Stefan Berger wrote:
> > On 1/28/19 9:45 AM, Igor Mammedov wrote:
> > > On Fri, 25 Jan 2019 16:00:58 -0500
> > > Stefan Berger <stefanb@linux.ibm.com> wrote:
> > > 
> > > > This patch makes the a TPM 2.0 with TIS interface available under the
> > > > HID 'MSF0101'. This is supported by Linux and also Windows now
> > > MSF0101 is relatively recent addition to Linux,
> > > are there in wild (old) kernels that worked with PNP0C31 but won't work
> > > with MSF0101?
> > 
> > 
> > Linux 4.3.4 and later references this HID here:
> > https://elixir.bootlin.com/linux/v4.3.4/source/drivers/char/tpm/tpm_tis.c
> > . I don't see it before that. A 3.10 kernel works with this patch as
> > well.
> 
> 
> ... that 3.10 kernel from el7 has been patched, though.
> 
>    Stefan

.. and supports the new HID.
Stefan Berger Jan. 28, 2019, 9:53 p.m. UTC | #8
On 1/28/19 12:49 PM, Michael S. Tsirkin wrote:
> On Mon, Jan 28, 2019 at 12:19:37PM -0500, Stefan Berger wrote:
>> On 1/28/19 11:14 AM, Stefan Berger wrote:
>>> On 1/28/19 9:45 AM, Igor Mammedov wrote:
>>>> On Fri, 25 Jan 2019 16:00:58 -0500
>>>> Stefan Berger <stefanb@linux.ibm.com> wrote:
>>>>
>>>>> This patch makes the a TPM 2.0 with TIS interface available under the
>>>>> HID 'MSF0101'. This is supported by Linux and also Windows now
>>>> MSF0101 is relatively recent addition to Linux,
>>>> are there in wild (old) kernels that worked with PNP0C31 but won't work
>>>> with MSF0101?
>>>
>>> Linux 4.3.4 and later references this HID here:
>>> https://elixir.bootlin.com/linux/v4.3.4/source/drivers/char/tpm/tpm_tis.c
>>> . I don't see it before that. A 3.10 kernel works with this patch as
>>> well.
>>
>> ... that 3.10 kernel from el7 has been patched, though.
>>
>>     Stefan
> .. and supports the new HID.
>
And this spec here also speaks for it: 
https://trustedcomputinggroup.org/wp-content/uploads/PC-ClientSpecific_Platform_Profile_for_TPM_2p0_Systems_v51.pdf

See chapter 8.
Igor Mammedov Jan. 29, 2019, 8:05 a.m. UTC | #9
On Fri, 25 Jan 2019 16:00:58 -0500
Stefan Berger <stefanb@linux.ibm.com> wrote:

> This patch makes the a TPM 2.0 with TIS interface available under the
> HID 'MSF0101'. This is supported by Linux and also Windows now
> recognizes the TPM 2.0 with TIS interface. Leave the TPM 1.2 as before.
> 
> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
>  hw/i386/acpi-build.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 2e21a31f82..f51225b4a7 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -2141,8 +2141,16 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
>              build_append_pci_bus_devices(scope, bus, pm->pcihp_bridge_en);
>  
>              if (TPM_IS_TIS(tpm)) {
> -                dev = aml_device("ISA.TPM");
> -                aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C31")));
> +                if (misc->tpm_version == TPM_VERSION_2_0) {
> +                    dev = aml_device("TPM");
> +                    aml_append(dev, aml_name_decl("_HID",
> +                                                  aml_string("MSFT0101")));
> +                } else {
> +                    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,
diff mbox series

Patch

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 2e21a31f82..f51225b4a7 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -2141,8 +2141,16 @@  build_dsdt(GArray *table_data, BIOSLinker *linker,
             build_append_pci_bus_devices(scope, bus, pm->pcihp_bridge_en);
 
             if (TPM_IS_TIS(tpm)) {
-                dev = aml_device("ISA.TPM");
-                aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C31")));
+                if (misc->tpm_version == TPM_VERSION_2_0) {
+                    dev = aml_device("TPM");
+                    aml_append(dev, aml_name_decl("_HID",
+                                                  aml_string("MSFT0101")));
+                } else {
+                    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,