diff mbox series

[RFC,v2,1/6] tpm: rename TPM_TIS into TPM_TIS_ISA

Message ID 20200214183704.14389-2-eric.auger@redhat.com
State New
Headers show
Series vTPM for aarch64 | expand

Commit Message

Eric Auger Feb. 14, 2020, 6:36 p.m. UTC
As we plan to introduce a sysbus TPM_TIS, let's rename
TPM_TIS into TPM_TIS_ISA.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
---
 hw/i386/acpi-build.c | 6 +++---
 hw/tpm/tpm_tis.c     | 4 ++--
 include/sysemu/tpm.h | 6 +++---
 3 files changed, 8 insertions(+), 8 deletions(-)

Comments

Philippe Mathieu-Daudé Feb. 14, 2020, 6:55 p.m. UTC | #1
On 2/14/20 7:36 PM, Eric Auger wrote:
> As we plan to introduce a sysbus TPM_TIS, let's rename
> TPM_TIS into TPM_TIS_ISA.
> 
> Signed-off-by: Eric Auger <eric.auger@redhat.com>
> ---
>   hw/i386/acpi-build.c | 6 +++---
>   hw/tpm/tpm_tis.c     | 4 ++--
>   include/sysemu/tpm.h | 6 +++---
>   3 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 9c4e46fa74..26777f8828 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -2026,7 +2026,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
>           }
>       }
>   
> -    if (TPM_IS_TIS(tpm_find())) {
> +    if (TPM_IS_TIS_ISA(tpm_find())) {
>           aml_append(crs, aml_memory32_fixed(TPM_TIS_ADDR_BASE,
>                      TPM_TIS_ADDR_SIZE, AML_READ_WRITE));
>       }
> @@ -2197,7 +2197,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
>               /* Scan all PCI buses. Generate tables to support hotplug. */
>               build_append_pci_bus_devices(scope, bus, pm->pcihp_bridge_en);
>   
> -            if (TPM_IS_TIS(tpm)) {
> +            if (TPM_IS_TIS_ISA(tpm)) {
>                   if (misc->tpm_version == TPM_VERSION_2_0) {
>                       dev = aml_device("TPM");
>                       aml_append(dev, aml_name_decl("_HID",
> @@ -2304,7 +2304,7 @@ build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog)
>           (char *)&tpm2_ptr->log_area_start_address - table_data->data;
>   
>       tpm2_ptr->platform_class = cpu_to_le16(TPM2_ACPI_CLASS_CLIENT);
> -    if (TPM_IS_TIS(tpm_find())) {
> +    if (TPM_IS_TIS_ISA(tpm_find())) {
>           tpm2_ptr->control_area_address = cpu_to_le64(0);
>           tpm2_ptr->start_method = cpu_to_le32(TPM2_START_METHOD_MMIO);
>       } else if (TPM_IS_CRB(tpm_find())) {
> diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
> index 31facb896d..c609737272 100644
> --- a/hw/tpm/tpm_tis.c
> +++ b/hw/tpm/tpm_tis.c
> @@ -91,7 +91,7 @@ typedef struct TPMState {
>       TPMPPI ppi;
>   } TPMState;
>   
> -#define TPM(obj) OBJECT_CHECK(TPMState, (obj), TYPE_TPM_TIS)
> +#define TPM(obj) OBJECT_CHECK(TPMState, (obj), TYPE_TPM_TIS_ISA)
>   
>   #define DEBUG_TIS 0
>   
> @@ -1008,7 +1008,7 @@ static void tpm_tis_class_init(ObjectClass *klass, void *data)
>   }
>   
>   static const TypeInfo tpm_tis_info = {
> -    .name = TYPE_TPM_TIS,
> +    .name = TYPE_TPM_TIS_ISA,
>       .parent = TYPE_ISA_DEVICE,
>       .instance_size = sizeof(TPMState),
>       .instance_init = tpm_tis_initfn,
> diff --git a/include/sysemu/tpm.h b/include/sysemu/tpm.h
> index 15979a3647..1691b92c28 100644
> --- a/include/sysemu/tpm.h
> +++ b/include/sysemu/tpm.h
> @@ -43,12 +43,12 @@ typedef struct TPMIfClass {
>       enum TPMVersion (*get_version)(TPMIf *obj);
>   } TPMIfClass;
>   
> -#define TYPE_TPM_TIS                "tpm-tis"
> +#define TYPE_TPM_TIS_ISA            "tpm-tis"

It should be safe to rename this "tpm-tis-isa" in this patch.

Regardless:
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

>   #define TYPE_TPM_CRB                "tpm-crb"
>   #define TYPE_TPM_SPAPR              "tpm-spapr"
>   
> -#define TPM_IS_TIS(chr)                             \
> -    object_dynamic_cast(OBJECT(chr), TYPE_TPM_TIS)
> +#define TPM_IS_TIS_ISA(chr)                         \
> +    object_dynamic_cast(OBJECT(chr), TYPE_TPM_TIS_ISA)
>   #define TPM_IS_CRB(chr)                             \
>       object_dynamic_cast(OBJECT(chr), TYPE_TPM_CRB)
>   #define TPM_IS_SPAPR(chr)                           \
>
Stefan Berger Feb. 16, 2020, 6:14 p.m. UTC | #2
On 2/14/20 1:36 PM, Eric Auger wrote:
> As we plan to introduce a sysbus TPM_TIS, let's rename
> TPM_TIS into TPM_TIS_ISA.
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
>
> Signed-off-by: Eric Auger <eric.auger@redhat.com>
> ---
>   hw/i386/acpi-build.c | 6 +++---
>   hw/tpm/tpm_tis.c     | 4 ++--
>   include/sysemu/tpm.h | 6 +++---
>   3 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 9c4e46fa74..26777f8828 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -2026,7 +2026,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
>           }
>       }
>   
> -    if (TPM_IS_TIS(tpm_find())) {
> +    if (TPM_IS_TIS_ISA(tpm_find())) {
>           aml_append(crs, aml_memory32_fixed(TPM_TIS_ADDR_BASE,
>                      TPM_TIS_ADDR_SIZE, AML_READ_WRITE));
>       }
> @@ -2197,7 +2197,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
>               /* Scan all PCI buses. Generate tables to support hotplug. */
>               build_append_pci_bus_devices(scope, bus, pm->pcihp_bridge_en);
>   
> -            if (TPM_IS_TIS(tpm)) {
> +            if (TPM_IS_TIS_ISA(tpm)) {
>                   if (misc->tpm_version == TPM_VERSION_2_0) {
>                       dev = aml_device("TPM");
>                       aml_append(dev, aml_name_decl("_HID",
> @@ -2304,7 +2304,7 @@ build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog)
>           (char *)&tpm2_ptr->log_area_start_address - table_data->data;
>   
>       tpm2_ptr->platform_class = cpu_to_le16(TPM2_ACPI_CLASS_CLIENT);
> -    if (TPM_IS_TIS(tpm_find())) {
> +    if (TPM_IS_TIS_ISA(tpm_find())) {
>           tpm2_ptr->control_area_address = cpu_to_le64(0);
>           tpm2_ptr->start_method = cpu_to_le32(TPM2_START_METHOD_MMIO);
>       } else if (TPM_IS_CRB(tpm_find())) {
> diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
> index 31facb896d..c609737272 100644
> --- a/hw/tpm/tpm_tis.c
> +++ b/hw/tpm/tpm_tis.c
> @@ -91,7 +91,7 @@ typedef struct TPMState {
>       TPMPPI ppi;
>   } TPMState;
>   
> -#define TPM(obj) OBJECT_CHECK(TPMState, (obj), TYPE_TPM_TIS)
> +#define TPM(obj) OBJECT_CHECK(TPMState, (obj), TYPE_TPM_TIS_ISA)
>   
>   #define DEBUG_TIS 0
>   
> @@ -1008,7 +1008,7 @@ static void tpm_tis_class_init(ObjectClass *klass, void *data)
>   }
>   
>   static const TypeInfo tpm_tis_info = {
> -    .name = TYPE_TPM_TIS,
> +    .name = TYPE_TPM_TIS_ISA,
>       .parent = TYPE_ISA_DEVICE,
>       .instance_size = sizeof(TPMState),
>       .instance_init = tpm_tis_initfn,
> diff --git a/include/sysemu/tpm.h b/include/sysemu/tpm.h
> index 15979a3647..1691b92c28 100644
> --- a/include/sysemu/tpm.h
> +++ b/include/sysemu/tpm.h
> @@ -43,12 +43,12 @@ typedef struct TPMIfClass {
>       enum TPMVersion (*get_version)(TPMIf *obj);
>   } TPMIfClass;
>   
> -#define TYPE_TPM_TIS                "tpm-tis"
> +#define TYPE_TPM_TIS_ISA            "tpm-tis"
>   #define TYPE_TPM_CRB                "tpm-crb"
>   #define TYPE_TPM_SPAPR              "tpm-spapr"
>   
> -#define TPM_IS_TIS(chr)                             \
> -    object_dynamic_cast(OBJECT(chr), TYPE_TPM_TIS)
> +#define TPM_IS_TIS_ISA(chr)                         \
> +    object_dynamic_cast(OBJECT(chr), TYPE_TPM_TIS_ISA)
>   #define TPM_IS_CRB(chr)                             \
>       object_dynamic_cast(OBJECT(chr), TYPE_TPM_CRB)
>   #define TPM_IS_SPAPR(chr)                           \
Eric Auger Feb. 25, 2020, 10:16 a.m. UTC | #3
Hi Phil,

On 2/14/20 7:55 PM, Philippe Mathieu-Daudé wrote:
> On 2/14/20 7:36 PM, Eric Auger wrote:
>> As we plan to introduce a sysbus TPM_TIS, let's rename
>> TPM_TIS into TPM_TIS_ISA.
>>
>> Signed-off-by: Eric Auger <eric.auger@redhat.com>
>> ---
>>   hw/i386/acpi-build.c | 6 +++---
>>   hw/tpm/tpm_tis.c     | 4 ++--
>>   include/sysemu/tpm.h | 6 +++---
>>   3 files changed, 8 insertions(+), 8 deletions(-)
>>
>> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
>> index 9c4e46fa74..26777f8828 100644
>> --- a/hw/i386/acpi-build.c
>> +++ b/hw/i386/acpi-build.c
>> @@ -2026,7 +2026,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
>>           }
>>       }
>>   -    if (TPM_IS_TIS(tpm_find())) {
>> +    if (TPM_IS_TIS_ISA(tpm_find())) {
>>           aml_append(crs, aml_memory32_fixed(TPM_TIS_ADDR_BASE,
>>                      TPM_TIS_ADDR_SIZE, AML_READ_WRITE));
>>       }
>> @@ -2197,7 +2197,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
>>               /* Scan all PCI buses. Generate tables to support
>> hotplug. */
>>               build_append_pci_bus_devices(scope, bus,
>> pm->pcihp_bridge_en);
>>   -            if (TPM_IS_TIS(tpm)) {
>> +            if (TPM_IS_TIS_ISA(tpm)) {
>>                   if (misc->tpm_version == TPM_VERSION_2_0) {
>>                       dev = aml_device("TPM");
>>                       aml_append(dev, aml_name_decl("_HID",
>> @@ -2304,7 +2304,7 @@ build_tpm2(GArray *table_data, BIOSLinker
>> *linker, GArray *tcpalog)
>>           (char *)&tpm2_ptr->log_area_start_address - table_data->data;
>>         tpm2_ptr->platform_class = cpu_to_le16(TPM2_ACPI_CLASS_CLIENT);
>> -    if (TPM_IS_TIS(tpm_find())) {
>> +    if (TPM_IS_TIS_ISA(tpm_find())) {
>>           tpm2_ptr->control_area_address = cpu_to_le64(0);
>>           tpm2_ptr->start_method = cpu_to_le32(TPM2_START_METHOD_MMIO);
>>       } else if (TPM_IS_CRB(tpm_find())) {
>> diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
>> index 31facb896d..c609737272 100644
>> --- a/hw/tpm/tpm_tis.c
>> +++ b/hw/tpm/tpm_tis.c
>> @@ -91,7 +91,7 @@ typedef struct TPMState {
>>       TPMPPI ppi;
>>   } TPMState;
>>   -#define TPM(obj) OBJECT_CHECK(TPMState, (obj), TYPE_TPM_TIS)
>> +#define TPM(obj) OBJECT_CHECK(TPMState, (obj), TYPE_TPM_TIS_ISA)
>>     #define DEBUG_TIS 0
>>   @@ -1008,7 +1008,7 @@ static void tpm_tis_class_init(ObjectClass
>> *klass, void *data)
>>   }
>>     static const TypeInfo tpm_tis_info = {
>> -    .name = TYPE_TPM_TIS,
>> +    .name = TYPE_TPM_TIS_ISA,
>>       .parent = TYPE_ISA_DEVICE,
>>       .instance_size = sizeof(TPMState),
>>       .instance_init = tpm_tis_initfn,
>> diff --git a/include/sysemu/tpm.h b/include/sysemu/tpm.h
>> index 15979a3647..1691b92c28 100644
>> --- a/include/sysemu/tpm.h
>> +++ b/include/sysemu/tpm.h
>> @@ -43,12 +43,12 @@ typedef struct TPMIfClass {
>>       enum TPMVersion (*get_version)(TPMIf *obj);
>>   } TPMIfClass;
>>   -#define TYPE_TPM_TIS                "tpm-tis"
>> +#define TYPE_TPM_TIS_ISA            "tpm-tis"
> 
> It should be safe to rename this "tpm-tis-isa" in this patch.
This would change the name of the legacy ISA device and also the way we
instantiate it through the cmd line. To avoid breaking the compatibility
I kept the same name and used tpm-tis-device (?) for the new sysbus one.

Thanks

Eric
> 
> Regardless:
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> 
>>   #define TYPE_TPM_CRB                "tpm-crb"
>>   #define TYPE_TPM_SPAPR              "tpm-spapr"
>>   -#define TPM_IS_TIS(chr)                             \
>> -    object_dynamic_cast(OBJECT(chr), TYPE_TPM_TIS)
>> +#define TPM_IS_TIS_ISA(chr)                         \
>> +    object_dynamic_cast(OBJECT(chr), TYPE_TPM_TIS_ISA)
>>   #define TPM_IS_CRB(chr)                             \
>>       object_dynamic_cast(OBJECT(chr), TYPE_TPM_CRB)
>>   #define TPM_IS_SPAPR(chr)                           \
>>
>
Philippe Mathieu-Daudé Feb. 25, 2020, 10:22 a.m. UTC | #4
On 2/25/20 11:16 AM, Auger Eric wrote:
> Hi Phil,
> 
> On 2/14/20 7:55 PM, Philippe Mathieu-Daudé wrote:
>> On 2/14/20 7:36 PM, Eric Auger wrote:
>>> As we plan to introduce a sysbus TPM_TIS, let's rename
>>> TPM_TIS into TPM_TIS_ISA.
>>>
>>> Signed-off-by: Eric Auger <eric.auger@redhat.com>
>>> ---
>>>    hw/i386/acpi-build.c | 6 +++---
>>>    hw/tpm/tpm_tis.c     | 4 ++--
>>>    include/sysemu/tpm.h | 6 +++---
>>>    3 files changed, 8 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
>>> index 9c4e46fa74..26777f8828 100644
>>> --- a/hw/i386/acpi-build.c
>>> +++ b/hw/i386/acpi-build.c
>>> @@ -2026,7 +2026,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
>>>            }
>>>        }
>>>    -    if (TPM_IS_TIS(tpm_find())) {
>>> +    if (TPM_IS_TIS_ISA(tpm_find())) {
>>>            aml_append(crs, aml_memory32_fixed(TPM_TIS_ADDR_BASE,
>>>                       TPM_TIS_ADDR_SIZE, AML_READ_WRITE));
>>>        }
>>> @@ -2197,7 +2197,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
>>>                /* Scan all PCI buses. Generate tables to support
>>> hotplug. */
>>>                build_append_pci_bus_devices(scope, bus,
>>> pm->pcihp_bridge_en);
>>>    -            if (TPM_IS_TIS(tpm)) {
>>> +            if (TPM_IS_TIS_ISA(tpm)) {
>>>                    if (misc->tpm_version == TPM_VERSION_2_0) {
>>>                        dev = aml_device("TPM");
>>>                        aml_append(dev, aml_name_decl("_HID",
>>> @@ -2304,7 +2304,7 @@ build_tpm2(GArray *table_data, BIOSLinker
>>> *linker, GArray *tcpalog)
>>>            (char *)&tpm2_ptr->log_area_start_address - table_data->data;
>>>          tpm2_ptr->platform_class = cpu_to_le16(TPM2_ACPI_CLASS_CLIENT);
>>> -    if (TPM_IS_TIS(tpm_find())) {
>>> +    if (TPM_IS_TIS_ISA(tpm_find())) {
>>>            tpm2_ptr->control_area_address = cpu_to_le64(0);
>>>            tpm2_ptr->start_method = cpu_to_le32(TPM2_START_METHOD_MMIO);
>>>        } else if (TPM_IS_CRB(tpm_find())) {
>>> diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
>>> index 31facb896d..c609737272 100644
>>> --- a/hw/tpm/tpm_tis.c
>>> +++ b/hw/tpm/tpm_tis.c
>>> @@ -91,7 +91,7 @@ typedef struct TPMState {
>>>        TPMPPI ppi;
>>>    } TPMState;
>>>    -#define TPM(obj) OBJECT_CHECK(TPMState, (obj), TYPE_TPM_TIS)
>>> +#define TPM(obj) OBJECT_CHECK(TPMState, (obj), TYPE_TPM_TIS_ISA)
>>>      #define DEBUG_TIS 0
>>>    @@ -1008,7 +1008,7 @@ static void tpm_tis_class_init(ObjectClass
>>> *klass, void *data)
>>>    }
>>>      static const TypeInfo tpm_tis_info = {
>>> -    .name = TYPE_TPM_TIS,
>>> +    .name = TYPE_TPM_TIS_ISA,
>>>        .parent = TYPE_ISA_DEVICE,
>>>        .instance_size = sizeof(TPMState),
>>>        .instance_init = tpm_tis_initfn,
>>> diff --git a/include/sysemu/tpm.h b/include/sysemu/tpm.h
>>> index 15979a3647..1691b92c28 100644
>>> --- a/include/sysemu/tpm.h
>>> +++ b/include/sysemu/tpm.h
>>> @@ -43,12 +43,12 @@ typedef struct TPMIfClass {
>>>        enum TPMVersion (*get_version)(TPMIf *obj);
>>>    } TPMIfClass;
>>>    -#define TYPE_TPM_TIS                "tpm-tis"
>>> +#define TYPE_TPM_TIS_ISA            "tpm-tis"
>>
>> It should be safe to rename this "tpm-tis-isa" in this patch.
> This would change the name of the legacy ISA device and also the way we
> instantiate it through the cmd line. To avoid breaking the compatibility
> I kept the same name and used tpm-tis-device (?) for the new sysbus one.

I thought ISA devices were not user-creatable...

> 
> Thanks
> 
> Eric
>>
>> Regardless:
>> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>>
>>>    #define TYPE_TPM_CRB                "tpm-crb"
>>>    #define TYPE_TPM_SPAPR              "tpm-spapr"
>>>    -#define TPM_IS_TIS(chr)                             \
>>> -    object_dynamic_cast(OBJECT(chr), TYPE_TPM_TIS)
>>> +#define TPM_IS_TIS_ISA(chr)                         \
>>> +    object_dynamic_cast(OBJECT(chr), TYPE_TPM_TIS_ISA)
>>>    #define TPM_IS_CRB(chr)                             \
>>>        object_dynamic_cast(OBJECT(chr), TYPE_TPM_CRB)
>>>    #define TPM_IS_SPAPR(chr)                           \
>>>
>>
>
Eric Auger Feb. 25, 2020, 10:28 a.m. UTC | #5
Hi Phil,

On 2/25/20 11:22 AM, Philippe Mathieu-Daudé wrote:
> On 2/25/20 11:16 AM, Auger Eric wrote:
>> Hi Phil,
>>
>> On 2/14/20 7:55 PM, Philippe Mathieu-Daudé wrote:
>>> On 2/14/20 7:36 PM, Eric Auger wrote:
>>>> As we plan to introduce a sysbus TPM_TIS, let's rename
>>>> TPM_TIS into TPM_TIS_ISA.
>>>>
>>>> Signed-off-by: Eric Auger <eric.auger@redhat.com>
>>>> ---
>>>>    hw/i386/acpi-build.c | 6 +++---
>>>>    hw/tpm/tpm_tis.c     | 4 ++--
>>>>    include/sysemu/tpm.h | 6 +++---
>>>>    3 files changed, 8 insertions(+), 8 deletions(-)
>>>>
>>>> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
>>>> index 9c4e46fa74..26777f8828 100644
>>>> --- a/hw/i386/acpi-build.c
>>>> +++ b/hw/i386/acpi-build.c
>>>> @@ -2026,7 +2026,7 @@ build_dsdt(GArray *table_data, BIOSLinker
>>>> *linker,
>>>>            }
>>>>        }
>>>>    -    if (TPM_IS_TIS(tpm_find())) {
>>>> +    if (TPM_IS_TIS_ISA(tpm_find())) {
>>>>            aml_append(crs, aml_memory32_fixed(TPM_TIS_ADDR_BASE,
>>>>                       TPM_TIS_ADDR_SIZE, AML_READ_WRITE));
>>>>        }
>>>> @@ -2197,7 +2197,7 @@ build_dsdt(GArray *table_data, BIOSLinker
>>>> *linker,
>>>>                /* Scan all PCI buses. Generate tables to support
>>>> hotplug. */
>>>>                build_append_pci_bus_devices(scope, bus,
>>>> pm->pcihp_bridge_en);
>>>>    -            if (TPM_IS_TIS(tpm)) {
>>>> +            if (TPM_IS_TIS_ISA(tpm)) {
>>>>                    if (misc->tpm_version == TPM_VERSION_2_0) {
>>>>                        dev = aml_device("TPM");
>>>>                        aml_append(dev, aml_name_decl("_HID",
>>>> @@ -2304,7 +2304,7 @@ build_tpm2(GArray *table_data, BIOSLinker
>>>> *linker, GArray *tcpalog)
>>>>            (char *)&tpm2_ptr->log_area_start_address -
>>>> table_data->data;
>>>>          tpm2_ptr->platform_class =
>>>> cpu_to_le16(TPM2_ACPI_CLASS_CLIENT);
>>>> -    if (TPM_IS_TIS(tpm_find())) {
>>>> +    if (TPM_IS_TIS_ISA(tpm_find())) {
>>>>            tpm2_ptr->control_area_address = cpu_to_le64(0);
>>>>            tpm2_ptr->start_method =
>>>> cpu_to_le32(TPM2_START_METHOD_MMIO);
>>>>        } else if (TPM_IS_CRB(tpm_find())) {
>>>> diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
>>>> index 31facb896d..c609737272 100644
>>>> --- a/hw/tpm/tpm_tis.c
>>>> +++ b/hw/tpm/tpm_tis.c
>>>> @@ -91,7 +91,7 @@ typedef struct TPMState {
>>>>        TPMPPI ppi;
>>>>    } TPMState;
>>>>    -#define TPM(obj) OBJECT_CHECK(TPMState, (obj), TYPE_TPM_TIS)
>>>> +#define TPM(obj) OBJECT_CHECK(TPMState, (obj), TYPE_TPM_TIS_ISA)
>>>>      #define DEBUG_TIS 0
>>>>    @@ -1008,7 +1008,7 @@ static void tpm_tis_class_init(ObjectClass
>>>> *klass, void *data)
>>>>    }
>>>>      static const TypeInfo tpm_tis_info = {
>>>> -    .name = TYPE_TPM_TIS,
>>>> +    .name = TYPE_TPM_TIS_ISA,
>>>>        .parent = TYPE_ISA_DEVICE,
>>>>        .instance_size = sizeof(TPMState),
>>>>        .instance_init = tpm_tis_initfn,
>>>> diff --git a/include/sysemu/tpm.h b/include/sysemu/tpm.h
>>>> index 15979a3647..1691b92c28 100644
>>>> --- a/include/sysemu/tpm.h
>>>> +++ b/include/sysemu/tpm.h
>>>> @@ -43,12 +43,12 @@ typedef struct TPMIfClass {
>>>>        enum TPMVersion (*get_version)(TPMIf *obj);
>>>>    } TPMIfClass;
>>>>    -#define TYPE_TPM_TIS                "tpm-tis"
>>>> +#define TYPE_TPM_TIS_ISA            "tpm-tis"
>>>
>>> It should be safe to rename this "tpm-tis-isa" in this patch.
>> This would change the name of the legacy ISA device and also the way we
>> instantiate it through the cmd line. To avoid breaking the compatibility
>> I kept the same name and used tpm-tis-device (?) for the new sysbus one.
> 
> I thought ISA devices were not user-creatable...

See docs/specs/tpm.rst and the cmd line used for x86:

    ../..
    -chardev socket,id=chrtpm,path=/tmp/mytpm1/swtpm-sock \
    -tpmdev emulator,id=tpm0,chardev=chrtpm \
    -device tpm-tis,tpmdev=tpm0 test.img

Thanks

Eric
> 
>>
>> Thanks
>>
>> Eric
>>>
>>> Regardless:
>>> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>>>
>>>>    #define TYPE_TPM_CRB                "tpm-crb"
>>>>    #define TYPE_TPM_SPAPR              "tpm-spapr"
>>>>    -#define TPM_IS_TIS(chr)                             \
>>>> -    object_dynamic_cast(OBJECT(chr), TYPE_TPM_TIS)
>>>> +#define TPM_IS_TIS_ISA(chr)                         \
>>>> +    object_dynamic_cast(OBJECT(chr), TYPE_TPM_TIS_ISA)
>>>>    #define TPM_IS_CRB(chr)                             \
>>>>        object_dynamic_cast(OBJECT(chr), TYPE_TPM_CRB)
>>>>    #define TPM_IS_SPAPR(chr)                           \
>>>>
>>>
>>
> 
>
diff mbox series

Patch

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 9c4e46fa74..26777f8828 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -2026,7 +2026,7 @@  build_dsdt(GArray *table_data, BIOSLinker *linker,
         }
     }
 
-    if (TPM_IS_TIS(tpm_find())) {
+    if (TPM_IS_TIS_ISA(tpm_find())) {
         aml_append(crs, aml_memory32_fixed(TPM_TIS_ADDR_BASE,
                    TPM_TIS_ADDR_SIZE, AML_READ_WRITE));
     }
@@ -2197,7 +2197,7 @@  build_dsdt(GArray *table_data, BIOSLinker *linker,
             /* Scan all PCI buses. Generate tables to support hotplug. */
             build_append_pci_bus_devices(scope, bus, pm->pcihp_bridge_en);
 
-            if (TPM_IS_TIS(tpm)) {
+            if (TPM_IS_TIS_ISA(tpm)) {
                 if (misc->tpm_version == TPM_VERSION_2_0) {
                     dev = aml_device("TPM");
                     aml_append(dev, aml_name_decl("_HID",
@@ -2304,7 +2304,7 @@  build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog)
         (char *)&tpm2_ptr->log_area_start_address - table_data->data;
 
     tpm2_ptr->platform_class = cpu_to_le16(TPM2_ACPI_CLASS_CLIENT);
-    if (TPM_IS_TIS(tpm_find())) {
+    if (TPM_IS_TIS_ISA(tpm_find())) {
         tpm2_ptr->control_area_address = cpu_to_le64(0);
         tpm2_ptr->start_method = cpu_to_le32(TPM2_START_METHOD_MMIO);
     } else if (TPM_IS_CRB(tpm_find())) {
diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
index 31facb896d..c609737272 100644
--- a/hw/tpm/tpm_tis.c
+++ b/hw/tpm/tpm_tis.c
@@ -91,7 +91,7 @@  typedef struct TPMState {
     TPMPPI ppi;
 } TPMState;
 
-#define TPM(obj) OBJECT_CHECK(TPMState, (obj), TYPE_TPM_TIS)
+#define TPM(obj) OBJECT_CHECK(TPMState, (obj), TYPE_TPM_TIS_ISA)
 
 #define DEBUG_TIS 0
 
@@ -1008,7 +1008,7 @@  static void tpm_tis_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo tpm_tis_info = {
-    .name = TYPE_TPM_TIS,
+    .name = TYPE_TPM_TIS_ISA,
     .parent = TYPE_ISA_DEVICE,
     .instance_size = sizeof(TPMState),
     .instance_init = tpm_tis_initfn,
diff --git a/include/sysemu/tpm.h b/include/sysemu/tpm.h
index 15979a3647..1691b92c28 100644
--- a/include/sysemu/tpm.h
+++ b/include/sysemu/tpm.h
@@ -43,12 +43,12 @@  typedef struct TPMIfClass {
     enum TPMVersion (*get_version)(TPMIf *obj);
 } TPMIfClass;
 
-#define TYPE_TPM_TIS                "tpm-tis"
+#define TYPE_TPM_TIS_ISA            "tpm-tis"
 #define TYPE_TPM_CRB                "tpm-crb"
 #define TYPE_TPM_SPAPR              "tpm-spapr"
 
-#define TPM_IS_TIS(chr)                             \
-    object_dynamic_cast(OBJECT(chr), TYPE_TPM_TIS)
+#define TPM_IS_TIS_ISA(chr)                         \
+    object_dynamic_cast(OBJECT(chr), TYPE_TPM_TIS_ISA)
 #define TPM_IS_CRB(chr)                             \
     object_dynamic_cast(OBJECT(chr), TYPE_TPM_CRB)
 #define TPM_IS_SPAPR(chr)                           \