hw/tpm: Remove instance @ppi_enabled field
v3 cover hw/tpm: Remove instance @ppi_enabled field
The "ppi" property and @ppi_enabled field were only used for backward compatibility during the 3.1 release. We removed all these legacy machines: the property isn't required anymore. Still it was how the ACPI subsystem was checking PPI use by TPM devices. This series convert the per-instance field exposed as QOM property as a single class (actually QOM interface) one.
Philippe Mathieu-Daudé (5):
hw/tpm: Factor tpm_ppi_enabled() out
hw/tpm: Add TPMIfClass::ppi_enabled field
hw/tpm: Remove CRBState::ppi_enabled field
hw/tpm: Propagate @ppi_enabled to tpm_tis_reset() and remove in
TPMState
hw/tpm: Simplify tpm_ppi_enabled()
hw/tpm/tpm_tis.h | 3 +-- include/system/tpm.h | 9 +++++++++ hw/acpi/tpm.c | 2 +- hw/i386/acpi-build.c | 2 +- hw/tpm/tpm_crb.c | 13 ++++--------- hw/tpm/tpm_tis_common.c | 4 ++-- hw/tpm/tpm_tis_i2c.c | 2 +- hw/tpm/tpm_tis_isa.c | 10 ++++------ hw/tpm/tpm_tis_sysbus.c | 2 +- 9 files changed, 24 insertions(+), 23 deletions(-)
Signature · 1 line
2.53.0
PATCH v3 1/5 hw/tpm: Factor tpm_ppi_enabled() out
Factor tpm_ppi_enabled() out before modifying it in a unique place.
--- include/system/tpm.h | 9 +++++++++ hw/acpi/tpm.c | 2 +- hw/i386/acpi-build.c | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-)
include/system/tpm.h +9 -0
@@ -13,6 +13,7 @@#define QEMU_TPM_H #include "qapi/qapi-types-tpm.h" +#include "qapi/error.h" #include "qom/object.h" #ifdef CONFIG_TPM
@@ -78,6 +79,14 @@ static inline TPMVersion tpm_get_version(TPMIf *ti) return TPM_IF_GET_CLASS(ti)->get_version(ti); } +static inline bool tpm_ppi_enabled (TPMIf *ti) +{ +if (!ti) { +return false; + } +return object_property_get_bool (OBJECT (ti),"ppi" , &error_abort); +} +#else /* CONFIG_TPM */ #define tpm_init () (0)
hw/acpi/tpm.c +1 -1
@@ -25,7 +25,7 @@ void tpm_build_ppi_acpi(TPMIf *tpm, Aml *dev)Aml *method, *field, *ifctx, *ifctx2, *ifctx3, *func_mask, *not_implemented, *pak, *tpm2, *tpm3, *pprm, *pprq, *zero, *one; -if (!object_property_get_bool (OBJECT (tpm),"ppi" , &error_abort)) { +if (!tpm_ppi_enabled (tpm)) {return ; }
hw/i386/acpi-build.c +1 -1
@@ -2218,7 +2218,7 @@ void acpi_setup(void) tables.tcpalog->data, acpi_data_len(tables.tcpalog)); tpm =tpm_find (); -if (tpm &&object_property_get_bool (OBJECT (tpm),"ppi" , &error_abort)) { +if (tpm_ppi_enabled (tpm)) { tpm_config = (FwCfgTPMConfig ) { .tpmppi_address =cpu_to_le32 (TPM_PPI_ADDR_BASE ), .tpm_version =tpm_get_version (tpm),
Signature · 1 line
2.53.0
Re: [PATCH v3 1/5] hw/tpm: Factor tpm_ppi_enabled() out
Quoted 1 line · Philippe Mathieu-Daudé
Factor
tpm_ppi_enabled()out before modifying it in a unique place.
Factor-out ...
Quoted 53 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/system/tpm.h | 9 +++++++++ hw/acpi/tpm.c | 2 +- hw/i386/acpi-build.c | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-)include/system/tpm.h +9
-0@@ -13,6 +13,7 @@#define QEMU_TPM_H #include "qapi/qapi-types-tpm.h" +#include "qapi/error.h" #include "qom/object.h" #ifdef CONFIG_TPM @@ -78,6 +79,14 @@ static inline TPMVersion tpm_get_version(TPMIf *ti) return TPM_IF_GET_CLASS(ti)->get_version(ti); } +static inline bool tpm_ppi_enabled (TPMIf *ti) +{ +if (!ti) { +return false; + } +return object_property_get_bool (OBJECT (ti),"ppi" , &error_abort); +} +#else /* CONFIG_TPM */ #define tpm_init () (0)hw/acpi/tpm.c +1
-1@@ -25,7 +25,7 @@ void tpm_build_ppi_acpi(TPMIf *tpm, Aml *dev)Aml *method, *field, *ifctx, *ifctx2, *ifctx3, *func_mask, *not_implemented, *pak, *tpm2, *tpm3, *pprm, *pprq, *zero, *one; -if (!object_property_get_bool (OBJECT (tpm),"ppi" , &error_abort)) { +if (!tpm_ppi_enabled (tpm)) {return ; }hw/i386/acpi-build.c +0
-0
hw/i386/acpi-build.c void acpi_setup(void) · line 2224
Quoted 8 lines
hw/i386/acpi-build.c +1
-1@@ -2218,7 +2218,7 @@ void acpi_setup(void) tables.tcpalog->data, acpi_data_len(tables.tcpalog)); tpm =tpm_find (); -if (tpm &&object_property_get_bool (OBJECT (tpm),"ppi" , &error_abort)) { +if (tpm_ppi_enabled (tpm)) { tpm_config = (FwCfgTPMConfig ) { .tpmppi_address =cpu_to_le32 (TPM_PPI_ADDR_BASE ), .tpm_version =tpm_get_version (tpm),
PATCH v3 2/5 hw/tpm: Add TPMIfClass::ppi_enabled field
In reply to Philippe Mathieu-DaudéEach TMP derived device has a @ppi_enabled field, itself exposed as a QOM property. External layers (like the ACPI subsystem) wanting to know whether a device implements PPI has to check for the QOM property available. This can be simplified by declaring a single field in the TPM interface.
Here we add such field to TPMIfClass, before converting each TPM devices to use it in the following commits.
--- include/system/tpm.h | 4 ++++ 1 file changed, 4 insertions(+)
include/system/tpm.h +4 -0
@@ -43,6 +43,7 @@ struct TPMIfClass {enum TpmModel model;void (*request_completed)(TPMIf *obj,int ret);enum TPMVersion (*get_version)(TPMIf *obj); +bool ppi_enabled; };#define TYPE_TPM_TIS_ISA "tpm-tis"
@@ -84,6 +85,9 @@ static inline bool tpm_ppi_enabled(TPMIf *ti)if (!ti) {return false; } +if (TPM_IF_GET_CLASS (ti)->ppi_enabled) { +return true; + }return object_property_get_bool (OBJECT (ti),"ppi" , &error_abort); }
Signature · 1 line
2.53.0
Re: [PATCH v3 2/5] hw/tpm: Add TPMIfClass::ppi_enabled field
Quoted 1 line · Philippe Mathieu-Daudé
Each TMP derived device has a @ppi_enabled field, itself
TPM?
Quoted 26 lines
exposed as a QOM property. External layers (like the ACPI subsystem) wanting to know whether a device implements PPI has to check for the QOM property available. This can be simplified by declaring a single field in the TPM interface.
Here we add such field to TPMIfClass, before converting each TPM devices to use it in the following commits.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/system/tpm.h | 4 ++++ 1 file changed, 4 insertions(+)include/system/tpm.h +1
-0@@ -43,6 +43,7 @@ struct TPMIfClass {enum TpmModel model;void (*request_completed)(TPMIf *obj,int ret);enum TPMVersion (*get_version)(TPMIf *obj); +bool ppi_enabled; };#define TYPE_TPM_TIS_ISA "tpm-tis"
include/system/tpm.h static inline bool tpm_ppi_enabled(TPMIf *ti) · line 93
Quoted 9 lines
include/system/tpm.h +3
-0@@ -84,6 +85,9 @@ static inline bool tpm_ppi_enabled(TPMIf *ti)if (!ti) {return false; } +if (TPM_IF_GET_CLASS (ti)->ppi_enabled) { +return true; + }return object_property_get_bool (OBJECT (ti),"ppi" , &error_abort); }
Re: [PATCH v3 2/5] hw/tpm: Add TPMIfClass::ppi_enabled field
Quoted 6 lines · Stefan Berger
Quoted 1 line · Philippe Mathieu-Daudé
Each TMP derived device has a @ppi_enabled field, itself
TPM?
Finger crossed =)
Quoted 25 lines
Quoted 25 lines
exposed as a QOM property. External layers (like the ACPI subsystem) wanting to know whether a device implements PPI has to check for the QOM property available. This can be simplified by declaring a single field in the TPM interface.
Here we add such field to TPMIfClass, before converting each TPM devices to use it in the following commits.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
include/system/tpm.h| 4 ++++1 file changed, 4 insertions(+)include/system/tpm.h +1
-0@@ -43,6 +43,7 @@ struct TPMIfClass { enum TpmModel model; void (*request_completed)(TPMIf *obj, int ret); enum TPMVersion (*get_version)(TPMIf *obj); + bool ppi_enabled; };
Quoted 14 lines
include/system/tpm.h static inline bool tpm_ppi_enabled(TPMIf *ti) · line 93
Quoted 11 lines
include/system/tpm.h +3
-0#define TYPE_TPM_TIS_ISA "tpm-tis"@@ -84,6 +85,9 @@ static inline bool tpm_ppi_enabled(TPMIf *ti) if (!ti) { return false; } + if (TPM_IF_GET_CLASS(ti)->ppi_enabled) { + return true; + } return object_property_get_bool(OBJECT(ti), "ppi", &error_abort); }Reviewed-by Stefan Berger <[email protected]>
Thanks!
PATCH v3 3/5 hw/tpm: Remove CRBState::ppi_enabled field
In reply to Philippe Mathieu-DaudéThe CRBState::ppi_enabled boolean was only set in the hw_compat_3_1[] array, via the 'ppi=false' property. We removed all machines using that array, and the array itself in commit a861ffef237 ("hw/core/machine: Remove the hw_compat_3_1[] array"). We can safely remove the now unused property. Since CRB devices always use PPI, simplify removing the CRBState::ppi_enabled field. Set the generic TPMIfClass::ppi_enabled so ACPI subsystem can keep checking its availability.
--- hw/tpm/tpm_crb.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
hw/tpm/tpm_crb.c +4 -9
@@ -43,7 +43,6 @@ struct CRBState {size_t be_buffer_size; -bool ppi_enabled;TPMPPI ppi; };typedef struct CRBState CRBState ;
@@ -228,16 +227,13 @@ static const VMStateDescription vmstate_tpm_crb = {static const Property tpm_crb_properties[] = {DEFINE_PROP_TPMBE ("tpmdev" , CRBState, tpmbe), -DEFINE_PROP_BOOL ("ppi" , CRBState, ppi_enabled, true), };static void tpm_crb_reset (void *dev) {CRBState *s =CRB (dev); -if (s->ppi_enabled) { -tpm_ppi_reset (&s->ppi); - } +tpm_ppi_reset (&s->ppi);tpm_backend_reset (s->tpmbe);memset (s->regs,0 ,sizeof (s->regs));
@@ -303,10 +299,8 @@ static void tpm_crb_realize(DeviceState *dev, Error **errp)memory_region_add_subregion (get_system_memory (),TPM_CRB_ADDR_BASE +sizeof (s->regs), &s->cmdmem); -if (s->ppi_enabled) { -tpm_ppi_init (&s->ppi,get_system_memory (), -TPM_PPI_ADDR_BASE ,OBJECT (s)); - } +tpm_ppi_init (&s->ppi,get_system_memory (), +TPM_PPI_ADDR_BASE ,OBJECT (s));if (xen_enabled ()) {tpm_crb_reset (dev);
@@ -325,6 +319,7 @@ static void tpm_crb_class_init(ObjectClass *klass, const void *data) dc->vmsd = &vmstate_tpm_crb; dc->user_creatable = true; tc->model =TPM_MODEL_TPM_CRB ; + tc->ppi_enabled = true; tc->get_version = tpm_crb_get_version; tc->request_completed = tpm_crb_request_completed;
Signature · 1 line
2.53.0
Re: [PATCH v3 3/5] hw/tpm: Remove CRBState::ppi_enabled field
Quoted 6 lines · Philippe Mathieu-Daudé
The
CRBState::ppi_enabledboolean was only set in the hw_compat_3_1[] array, via the 'ppi=false' property. We removed all machines using that array, and the array itself in commita861ffef237("hw/core/machine: Remove the hw_compat_3_1[] array"). We can safely remove the now unused property. Since CRB devices always use PPI,
s/use/uses
Quoted 53 lines
simplify removing the
CRBState::ppi_enabledfield. Set the genericTPMIfClass::ppi_enabledso ACPI subsystem can keep checking its availability.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/tpm/tpm_crb.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)hw/tpm/tpm_crb.c +3
-9@@ -43,7 +43,6 @@ struct CRBState {size_t be_buffer_size; -bool ppi_enabled;TPMPPI ppi; };typedef struct CRBState CRBState ;@@ -228,16 +227,13 @@ static const VMStateDescription vmstate_tpm_crb = {static const Property tpm_crb_properties[] = {DEFINE_PROP_TPMBE ("tpmdev" , CRBState, tpmbe), -DEFINE_PROP_BOOL ("ppi" , CRBState, ppi_enabled, true), };static void tpm_crb_reset (void *dev) {CRBState *s =CRB (dev); -if (s->ppi_enabled) { -tpm_ppi_reset (&s->ppi); - } +tpm_ppi_reset (&s->ppi);tpm_backend_reset (s->tpmbe);memset (s->regs,0 ,sizeof (s->regs));@@ -303,10 +299,8 @@ static void tpm_crb_realize(DeviceState *dev, Error **errp)memory_region_add_subregion (get_system_memory (),TPM_CRB_ADDR_BASE +sizeof (s->regs), &s->cmdmem); -if (s->ppi_enabled) { -tpm_ppi_init (&s->ppi,get_system_memory (), -TPM_PPI_ADDR_BASE ,OBJECT (s)); - } +tpm_ppi_init (&s->ppi,get_system_memory (), +TPM_PPI_ADDR_BASE ,OBJECT (s));if (xen_enabled ()) {tpm_crb_reset (dev);
hw/tpm/tpm_crb.c static void tpm_crb_class_init(ObjectClass *klass, const void *data) · line 325
Quoted 7 lines
hw/tpm/tpm_crb.c +1
-0@@ -325,6 +319,7 @@ static void tpm_crb_class_init(ObjectClass *klass, const void *data) dc->vmsd = &vmstate_tpm_crb; dc->user_creatable = true; tc->model =TPM_MODEL_TPM_CRB ; + tc->ppi_enabled = true; tc->get_version = tpm_crb_get_version; tc->request_completed = tpm_crb_request_completed;
Re: [PATCH v3 3/5] hw/tpm: Remove CRBState::ppi_enabled field
Quoted 11 lines · Stefan Berger
Quoted 6 lines · Philippe Mathieu-Daudé
The
CRBState::ppi_enabledboolean was only set in the hw_compat_3_1[] array, via the 'ppi=false' property. We removed all machines using that array, and the array itself in commita861ffef237("hw/core/machine: Remove the hw_compat_3_1[] array"). We can safely remove the now unused property. Since CRB devices always use PPI,s/use/uses
I used plural form. To you rather singular?
"Since the CRB device always use PPI, ..."
Quoted 9 lines
Quoted 9 lines
simplify removing the
CRBState::ppi_enabledfield. Set the genericTPMIfClass::ppi_enabledso ACPI subsystem can keep checking its availability.Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
hw/tpm/tpm_crb.c| 13 ++++---------1 file changed, 4 insertions(+), 9 deletions(-)
Re: [PATCH v3 3/5] hw/tpm: Remove CRBState::ppi_enabled field
Quoted 11 lines · Philippe Mathieu-Daudé
Quoted 10 lines · Stefan Berger
Quoted 6 lines · Philippe Mathieu-Daudé
The
CRBState::ppi_enabledboolean was only set in the hw_compat_3_1[] array, via the 'ppi=false' property. We removed all machines using that array, and the array itself in commita861ffef237("hw/core/machine: Remove the hw_compat_3_1[] array"). We can safely remove the now unused property. Since CRB devices always use PPI,
Quoted 3 lines
Quoted 1 line
s/use/uses
I used plural form. To you rather singular?
my error
Quoted 12 lines
"Since the CRB device always use PPI, ..>
Quoted 9 lines
Quoted 9 lines
simplify removing the
CRBState::ppi_enabledfield. Set the genericTPMIfClass::ppi_enabledso ACPI subsystem can keep checking its availability.Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
hw/tpm/tpm_crb.c| 13 ++++---------1 file changed, 4 insertions(+), 9 deletions(-)
PATCH v3 4/5 hw/tpm: Propagate @ppi_enabled to tpm_tis_reset() and remove in TPMState
In reply to Philippe Mathieu-DaudéOf TMP devices using FIFO mode, only the ISA variant has PPI, and call tpm_ppi_init() to initialize the PPI state. Propagate @ppi_enabled to tpm_tis_reset() so it only resets the PPI part when requested (ISA case) otherwise the PPI is in uninitialized state. Remove the now unused TPMState::ppi_enabled field. Set the generic TPMIfClass::ppi_enabled so ACPI subsystem can keep checking its availability.
--- hw/tpm/tpm_tis.h | 3 +-- hw/tpm/tpm_tis_common.c | 4 ++-- hw/tpm/tpm_tis_i2c.c | 2 +- hw/tpm/tpm_tis_isa.c | 10 ++++------ hw/tpm/tpm_tis_sysbus.c | 2 +- 5 files changed, 9 insertions(+), 12 deletions(-)
hw/tpm/tpm_tis.h +1 -2
@@ -75,7 +75,6 @@ typedef struct TPMState {size_t be_buffer_size; -bool ppi_enabled;TPMPPI ppi; } TPMState;
@@ -83,7 +82,7 @@ extern const VMStateDescription vmstate_locty;extern const MemoryRegionOps tpm_tis_memory_ops;int tpm_tis_pre_save (TPMState *s); -void tpm_tis_reset (TPMState *s); +void tpm_tis_reset (TPMState *s,bool ppi_enabled);enum TPMVersion tpm_tis_get_tpm_version (TPMState *s);void tpm_tis_request_completed (TPMState *s,int ret);uint32_t tpm_tis_read_data (TPMState *s,hwaddr addr,unsigned size);
hw/tpm/tpm_tis_common.c +2 -2
@@ -813,7 +813,7 @@ enum TPMVersion tpm_tis_get_tpm_version(TPMState *s)* This function is called when the machine starts, resets or due to * S3 resume. */ -void tpm_tis_reset (TPMState *s) +void tpm_tis_reset (TPMState *s,bool ppi_enabled) {int c;
@@ -821,7 +821,7 @@ void tpm_tis_reset(TPMState *s) s->be_buffer_size =MIN (tpm_backend_get_buffer_size (s->be_driver),TPM_TIS_BUFFER_MAX ); -if (s->ppi_enabled) { +if (ppi_enabled) {tpm_ppi_reset (&s->ppi); }tpm_backend_reset (s->be_driver);
hw/tpm/tpm_tis_i2c.c +1 -1
@@ -523,7 +523,7 @@ static void tpm_tis_i2c_reset(DeviceState *dev) i2cst->csum_enable =0 ; i2cst->loc_sel =0x00 ; -return tpm_tis_reset (s); +return tpm_tis_reset (s, false); }static void tpm_tis_i2c_class_init (ObjectClass *klass,const void *data)
hw/tpm/tpm_tis_isa.c +4 -6
@@ -88,13 +88,12 @@ static void tpm_tis_isa_reset(DeviceState *dev)TPMStateISA *isadev =TPM_TIS_ISA (dev);TPMState *s = &isadev->state; -return tpm_tis_reset (s); +return tpm_tis_reset (s, true); }static const Property tpm_tis_isa_properties[] = {DEFINE_PROP_UINT32 ("irq" , TPMStateISA, state.irq_num,TPM_TIS_IRQ ),DEFINE_PROP_TPMBE ("tpmdev" , TPMStateISA, state.be_driver), -DEFINE_PROP_BOOL ("ppi" , TPMStateISA, state.ppi_enabled, true), };static void tpm_tis_isa_initfn (Object *obj)
@@ -132,10 +131,8 @@ static void tpm_tis_isa_realizefn(DeviceState *dev, Error **errp)memory_region_add_subregion (isa_address_space (ISA_DEVICE (dev)),TPM_TIS_ADDR_BASE , &s->mmio); -if (s->ppi_enabled) { -tpm_ppi_init (&s->ppi,isa_address_space (ISA_DEVICE (dev)), -TPM_PPI_ADDR_BASE ,OBJECT (dev)); - } +tpm_ppi_init (&s->ppi,isa_address_space (ISA_DEVICE (dev)), +TPM_PPI_ADDR_BASE ,OBJECT (dev)); }static void build_tpm_tis_isa_aml (AcpiDevAmlIf *adev,Aml *scope)
@@ -175,6 +172,7 @@ static void tpm_tis_isa_class_init(ObjectClass *klass, const void *data)device_class_set_props (dc, tpm_tis_isa_properties); dc->vmsd = &vmstate_tpm_tis_isa; tc->model =TPM_MODEL_TPM_TIS ; + tc->ppi_enabled = true; dc->realize = tpm_tis_isa_realizefn;device_class_set_legacy_reset (dc, tpm_tis_isa_reset); tc->request_completed = tpm_tis_isa_request_completed;
hw/tpm/tpm_tis_sysbus.c +1 -1
@@ -87,7 +87,7 @@ static void tpm_tis_sysbus_reset(DeviceState *dev)TPMStateSysBus *sbdev =TPM_TIS_SYSBUS (dev);TPMState *s = &sbdev->state; -return tpm_tis_reset (s); +return tpm_tis_reset (s, false); }static const Property tpm_tis_sysbus_properties[] = {
Signature · 1 line
2.53.0
Re: [PATCH v3 4/5] hw/tpm: Propagate @ppi_enabled to tpm_tis_reset() and remove in TPMState
Quoted 1 line · Philippe Mathieu-Daudé
Of TMP devices using FIFO mode, only the ISA variant has PPI,
Of the TPM devices ...
Quoted 1 line
and call
tpm_ppi_init()to initialize the PPI state. Propagate
s/call/calls
Quoted 116 lines
@ppi_enabled to
tpm_tis_reset()so it only resets the PPI part when requested (ISA case) otherwise the PPI is in uninitialized state. Remove the now unusedTPMState::ppi_enabledfield. Set the genericTPMIfClass::ppi_enabledso ACPI subsystem can keep checking its availability.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/tpm/tpm_tis.h | 3 +-- hw/tpm/tpm_tis_common.c | 4 ++-- hw/tpm/tpm_tis_i2c.c | 2 +- hw/tpm/tpm_tis_isa.c | 10 ++++------ hw/tpm/tpm_tis_sysbus.c | 2 +- 5 files changed, 9 insertions(+), 12 deletions(-)hw/tpm/tpm_tis.h +1
-2@@ -75,7 +75,6 @@ typedef struct TPMState {size_t be_buffer_size; -bool ppi_enabled;TPMPPI ppi; } TPMState;@@ -83,7 +82,7 @@ extern const VMStateDescription vmstate_locty;extern const MemoryRegionOps tpm_tis_memory_ops;int tpm_tis_pre_save (TPMState *s); -void tpm_tis_reset (TPMState *s); +void tpm_tis_reset (TPMState *s,bool ppi_enabled);enum TPMVersion tpm_tis_get_tpm_version (TPMState *s);void tpm_tis_request_completed (TPMState *s,int ret);uint32_t tpm_tis_read_data (TPMState *s,hwaddr addr,unsigned size);hw/tpm/tpm_tis_common.c +2
-2@@ -813,7 +813,7 @@ enum TPMVersion tpm_tis_get_tpm_version(TPMState *s)* This function is called when the machine starts, resets or due to * S3 resume. */ -void tpm_tis_reset (TPMState *s) +void tpm_tis_reset (TPMState *s,bool ppi_enabled) {int c;@@ -821,7 +821,7 @@ void tpm_tis_reset(TPMState *s) s->be_buffer_size =MIN (tpm_backend_get_buffer_size (s->be_driver),TPM_TIS_BUFFER_MAX ); -if (s->ppi_enabled) { +if (ppi_enabled) {tpm_ppi_reset (&s->ppi); }tpm_backend_reset (s->be_driver);hw/tpm/tpm_tis_i2c.c +1
-1@@ -523,7 +523,7 @@ static void tpm_tis_i2c_reset(DeviceState *dev) i2cst->csum_enable =0 ; i2cst->loc_sel =0x00 ; -return tpm_tis_reset (s); +return tpm_tis_reset (s, false); }static void tpm_tis_i2c_class_init (ObjectClass *klass,const void *data)hw/tpm/tpm_tis_isa.c +4
-6@@ -88,13 +88,12 @@ static void tpm_tis_isa_reset(DeviceState *dev)TPMStateISA *isadev =TPM_TIS_ISA (dev);TPMState *s = &isadev->state; -return tpm_tis_reset (s); +return tpm_tis_reset (s, true); }static const Property tpm_tis_isa_properties[] = {DEFINE_PROP_UINT32 ("irq" , TPMStateISA, state.irq_num,TPM_TIS_IRQ ),DEFINE_PROP_TPMBE ("tpmdev" , TPMStateISA, state.be_driver), -DEFINE_PROP_BOOL ("ppi" , TPMStateISA, state.ppi_enabled, true), };static void tpm_tis_isa_initfn (Object *obj)@@ -132,10 +131,8 @@ static void tpm_tis_isa_realizefn(DeviceState *dev, Error **errp)memory_region_add_subregion (isa_address_space (ISA_DEVICE (dev)),TPM_TIS_ADDR_BASE , &s->mmio); -if (s->ppi_enabled) { -tpm_ppi_init (&s->ppi,isa_address_space (ISA_DEVICE (dev)), -TPM_PPI_ADDR_BASE ,OBJECT (dev)); - } +tpm_ppi_init (&s->ppi,isa_address_space (ISA_DEVICE (dev)), +TPM_PPI_ADDR_BASE ,OBJECT (dev)); }static void build_tpm_tis_isa_aml (AcpiDevAmlIf *adev,Aml *scope)@@ -175,6 +172,7 @@ static void tpm_tis_isa_class_init(ObjectClass *klass, const void *data)device_class_set_props (dc, tpm_tis_isa_properties); dc->vmsd = &vmstate_tpm_tis_isa; tc->model =TPM_MODEL_TPM_TIS ; + tc->ppi_enabled = true; dc->realize = tpm_tis_isa_realizefn;device_class_set_legacy_reset (dc, tpm_tis_isa_reset); tc->request_completed = tpm_tis_isa_request_completed;hw/tpm/tpm_tis_sysbus.c +0
-0
hw/tpm/tpm_tis_sysbus.c static void tpm_tis_sysbus_reset(DeviceState *dev) · line 93
Quoted 8 lines
hw/tpm/tpm_tis_sysbus.c +1
-1@@ -87,7 +87,7 @@ static void tpm_tis_sysbus_reset(DeviceState *dev)TPMStateSysBus *sbdev =TPM_TIS_SYSBUS (dev);TPMState *s = &sbdev->state; -return tpm_tis_reset (s); +return tpm_tis_reset (s, false); }static const Property tpm_tis_sysbus_properties[] = {
PATCH v3 5/5 hw/tpm: Simplify tpm_ppi_enabled()
In reply to Philippe Mathieu-DaudéTPM instances don't expose any "ppi" property anymore, remove that dead code.
--- include/system/tpm.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
include/system/tpm.h +1 -5
@@ -13,7 +13,6 @@#define QEMU_TPM_H #include "qapi/qapi-types-tpm.h" -#include "qapi/error.h" #include "qom/object.h" #ifdef CONFIG_TPM
@@ -85,10 +84,7 @@ static inline bool tpm_ppi_enabled(TPMIf *ti)if (!ti) {return false; } -if (TPM_IF_GET_CLASS (ti)->ppi_enabled) { -return true; - } - return object_property_get_bool(OBJECT(ti), "ppi", &error_abort); + return TPM_IF_GET_CLASS(ti)->ppi_enabled; }#else /* CONFIG_TPM */
Signature · 1 line
2.53.0
Re: [PATCH v3 5/5] hw/tpm: Simplify tpm_ppi_enabled()
Quoted 22 lines · Philippe Mathieu-Daudé
TPM instances don't expose any "ppi" property anymore, remove that dead code.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/system/tpm.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)include/system/tpm.h +0
-1@@ -13,7 +13,6 @@#define QEMU_TPM_H #include "qapi/qapi-types-tpm.h" -#include "qapi/error.h" #include "qom/object.h" #ifdef CONFIG_TPM @@ -85,10 +84,7 @@ static inline bool tpm_ppi_enabled(TPMIf *ti)if (!ti) {
include/system/tpm.h static inline bool tpm_ppi_enabled(TPMIf *ti) · line 90
Quoted 10 lines
include/system/tpm.h +1
-4return false; } -if (TPM_IF_GET_CLASS (ti)->ppi_enabled) { -return true; - } -return object_property_get_bool (OBJECT (ti),"ppi" , &error_abort); +return TPM_IF_GET_CLASS (ti)->ppi_enabled; }#else /* CONFIG_TPM */
Quoted 7 lines · Philippe Mathieu-Daudé
Philippe Mathieu-Daudé (5):
hw/tpm: Factortpm_ppi_enabled()out
hw/tpm: AddTPMIfClass::ppi_enabledfield
hw/tpm: RemoveCRBState::ppi_enabledfield
hw/tpm: Propagate @ppi_enabled totpm_tis_reset()and remove in
TPMState
hw/tpm: Simplifytpm_ppi_enabled()
Series queued for 11.1 (typo fixed), thanks.
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Philippe Mathieu-Daudé
Philippe Mathieu-Daudé (5):
hw/tpm: Factortpm_ppi_enabled()out
hw/tpm: AddTPMIfClass::ppi_enabledfield
hw/tpm: RemoveCRBState::ppi_enabledfield
hw/tpm: Propagate @ppi_enabled totpm_tis_reset()and remove in TPMState
hw/tpm: Simplifytpm_ppi_enabled()
Quoted 2 lines
Series queued for 11.1 (typo fixed), thanks.
Here's another TPM PPI related series. It would make sense to upstream them together. Do you want to queue that one as well?
Quoted 13 lines · Stefan Berger
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Philippe Mathieu-Daudé
Philippe Mathieu-Daudé (5):
hw/tpm: Factortpm_ppi_enabled()out
hw/tpm: AddTPMIfClass::ppi_enabledfield
hw/tpm: RemoveCRBState::ppi_enabledfield
hw/tpm: Propagate @ppi_enabled totpm_tis_reset()and remove in TPMState
hw/tpm: Simplifytpm_ppi_enabled()
Quoted 7 lines
Quoted 2 lines
Series queued for 11.1 (typo fixed), thanks.
Here's another TPM PPI related series. It would make sense to upstream them together. Do you want to queue that one as well?
https://lore.kernel.org/qemu-devel/20260327-tpm-tis-sysbus-ppi-v2-0- [email protected]/T/#t
Actually, they will have to rebase on this series first...
Quoted 1 line
Quoted 19 lines · Stefan Berger
Quoted 16 lines · Stefan Berger
Quoted 12 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Philippe Mathieu-Daudé
Philippe Mathieu-Daudé (5):
hw/tpm: Factortpm_ppi_enabled()out
hw/tpm: AddTPMIfClass::ppi_enabledfield
hw/tpm: RemoveCRBState::ppi_enabledfield
hw/tpm: Propagate @ppi_enabled totpm_tis_reset()and remove in TPMState
hw/tpm: Simplifytpm_ppi_enabled()Series queued for 11.1 (typo fixed), thanks.
Quoted 8 lines
Quoted 4 lines
Here's another TPM PPI related series. It would make sense to upstream them together. Do you want to queue that one as well?
https://lore.kernel.org/qemu-devel/20260327-tpm-tis-sysbus-ppi-v2-0- [email protected]/T/#t
Actually, they will have to rebase on this series first...
Quoted 1 line
v3 is good now:
https://lore.kernel.org/qemu-devel/[email protected]/T/#t
If you want to take it let me know, otherwise I will have to wait for your series.
Quoted 31 lines · Stefan Berger
Quoted 19 lines · Stefan Berger
Quoted 16 lines · Stefan Berger
Quoted 12 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Philippe Mathieu-Daudé
Philippe Mathieu-Daudé (5):
hw/tpm: Factortpm_ppi_enabled()out
hw/tpm: AddTPMIfClass::ppi_enabledfield
hw/tpm: RemoveCRBState::ppi_enabledfield
hw/tpm: Propagate @ppi_enabled totpm_tis_reset()and remove in TPMState
hw/tpm: Simplifytpm_ppi_enabled()Series queued for 11.1 (typo fixed), thanks.
Quoted 8 lines
Quoted 4 lines
Here's another TPM PPI related series. It would make sense to upstream them together. Do you want to queue that one as well?
https://lore.kernel.org/qemu-devel/20260327-tpm-tis-sysbus-ppi-v2-0- [email protected]/T/#t
Actually, they will have to rebase on this series first...
Quoted 1 line
Quoted 5 lines
v3 is good now:
https://lore.kernel.org/qemu-devel/20260327173209.148180-1- [email protected]/T/#t
If you want to take it let me know, otherwise I will have to wait for your series.
Thanks for the head up, I'll queue it along and send the pull request after 11.0 is released.
Regards,
Phil.
Hi Stefan,
Quoted 32 lines · Philippe Mathieu-Daudé
Quoted 31 lines · Stefan Berger
Quoted 27 lines · Stefan Berger
Quoted 13 lines · Stefan Berger
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Philippe Mathieu-Daudé
Philippe Mathieu-Daudé (5):
hw/tpm: Factortpm_ppi_enabled()out
hw/tpm: AddTPMIfClass::ppi_enabledfield
hw/tpm: RemoveCRBState::ppi_enabledfield
hw/tpm: Propagate @ppi_enabled totpm_tis_reset()and remove in TPMState
hw/tpm: Simplifytpm_ppi_enabled()Quoted 7 lines
Quoted 2 lines
Series queued for 11.1 (typo fixed), thanks.
Here's another TPM PPI related series. It would make sense to upstream them together. Do you want to queue that one as well?
https://lore.kernel.org/qemu-devel/20260327-tpm-tis-sysbus-ppi-v2-0- [email protected]/T/#t
Actually, they will have to rebase on this series first...
Quoted 1 line
Quoted 5 lines
Quoted 5 lines
v3 is good now:
https://lore.kernel.org/qemu-devel/20260327173209.148180-1- [email protected]/T/#t
If you want to take it let me know, otherwise I will have to wait for your series.
I'm not seeing your R-b tag on v3 on the mailing list, did you sent it? (asking because the list had some issue the last weeks).
Quoted 7 lines
Thanks for the head up, I'll queue it along and send the pull request after 11.0 is released.
Regards,
Phil.
Quoted 35 lines · Philippe Mathieu-Daudé
Hi Stefan,
Quoted 32 lines · Philippe Mathieu-Daudé
Quoted 31 lines · Stefan Berger
Quoted 27 lines · Stefan Berger
Quoted 13 lines · Stefan Berger
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Philippe Mathieu-Daudé
Philippe Mathieu-Daudé (5):
hw/tpm: Factortpm_ppi_enabled()out
hw/tpm: AddTPMIfClass::ppi_enabledfield
hw/tpm: RemoveCRBState::ppi_enabledfield
hw/tpm: Propagate @ppi_enabled totpm_tis_reset()and remove in TPMState
hw/tpm: Simplifytpm_ppi_enabled()Quoted 7 lines
Quoted 2 lines
Series queued for 11.1 (typo fixed), thanks.
Here's another TPM PPI related series. It would make sense to upstream them together. Do you want to queue that one as well?
https://lore.kernel.org/qemu-devel/20260327-tpm-tis-sysbus-ppi- v2-0- [email protected]/T/#t
Actually, they will have to rebase on this series first...
Quoted 1 line
Quoted 12 lines
Quoted 5 lines
Quoted 5 lines
v3 is good now:
https://lore.kernel.org/qemu-devel/20260327173209.148180-1- [email protected]/T/#t
If you want to take it let me know, otherwise I will have to wait for your series.
I'm not seeing your R-b tag on v3 on the mailing list, did you sent it? (asking because the list had some issue the last weeks).
Quoted 3 lines
Thanks for the head up, I'll queue it along and send the pull request after 11.0 is released.
https://lore.kernel.org/qemu-devel/[email protected]/T/#m42a888b82b87432799e53c0426e65f95e9a27708
All 3 patches have my R-b as far as I can see...
Quoted 6 lines
Quoted 4 lines
Regards,
Phil.
Quoted 48 lines · Stefan Berger
Quoted 45 lines · Philippe Mathieu-Daudé
Hi Stefan,
Quoted 32 lines · Philippe Mathieu-Daudé
Quoted 31 lines · Stefan Berger
Quoted 27 lines · Stefan Berger
Quoted 13 lines · Stefan Berger
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Philippe Mathieu-Daudé
Philippe Mathieu-Daudé (5):
hw/tpm: Factortpm_ppi_enabled()out
hw/tpm: AddTPMIfClass::ppi_enabledfield
hw/tpm: RemoveCRBState::ppi_enabledfield
hw/tpm: Propagate @ppi_enabled totpm_tis_reset()and remove in TPMState
hw/tpm: Simplifytpm_ppi_enabled()Quoted 7 lines
Quoted 2 lines
Series queued for 11.1 (typo fixed), thanks.
Here's another TPM PPI related series. It would make sense to upstream them together. Do you want to queue that one as well?
https://lore.kernel.org/qemu-devel/20260327-tpm-tis-sysbus-ppi- v2-0- [email protected]/T/#t
Actually, they will have to rebase on this series first...
Quoted 1 line
Quoted 5 lines
Quoted 5 lines
v3 is good now:
https://lore.kernel.org/qemu-devel/20260327173209.148180-1- [email protected]/T/#t
If you want to take it let me know, otherwise I will have to wait for your series.
I'm not seeing your R-b tag on v3 on the mailing list, did you sent it? (asking because the list had some issue the last weeks).
Quoted 1 line
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Thanks for the head up, I'll queue it along and send the pull request after 11.0 is released.
https://lore.kernel.org/qemu-devel/20260327173209.148180-1- [email protected]/T/#m42a888b82b87432799e53c0426e65f95e9a27708
All 3 patches have my R-b as far as I can see...
Indeed, even in the pull request I prepared... I suppose I was looking at a previous version 🤷♂️ Sorry for the noise!
Waiting the git tree to open before posting that PR 🤞🏻