@samitouri / QOSamiQemu / commits / 46427d53eb

hw/tpm: Remove CRBState::ppi_enabled field

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. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> Message-Id: <20260317120241.16320-4-philmd@linaro.org>

Philippe Mathieu-Daudé committed Mar 17, 2026 at 12:32 UTC 46427d53eb9551e947242fd10451acc4000c5cac
1 file changed +4 -9
hw/tpm/tpm_crb.c
+4 -9
@@ -43,7 +43,6 @@ struct CRBState {
43
44 size_t be_buffer_size;
45
46 - bool ppi_enabled;
46 TPMPPI ppi;
47 };
48 typedef struct CRBState CRBState;
@@ -228,16 +227,13 @@ static const VMStateDescription vmstate_tpm_crb = {
227
228 static const Property tpm_crb_properties[] = {
229 DEFINE_PROP_TPMBE("tpmdev", CRBState, tpmbe),
231 - DEFINE_PROP_BOOL("ppi", CRBState, ppi_enabled, true),
230 };
231
232 static void tpm_crb_reset(void *dev)
233 {
234 CRBState *s = CRB(dev);
235
238 - if (s->ppi_enabled) {
239 - tpm_ppi_reset(&s->ppi);
240 - }
236 + tpm_ppi_reset(&s->ppi);
237 tpm_backend_reset(s->tpmbe);
238
239 memset(s->regs, 0, sizeof(s->regs));
@@ -303,10 +299,8 @@ static void tpm_crb_realize(DeviceState *dev, Error **errp)
299 memory_region_add_subregion(get_system_memory(),
300 TPM_CRB_ADDR_BASE + sizeof(s->regs), &s->cmdmem);
301
306 - if (s->ppi_enabled) {
307 - tpm_ppi_init(&s->ppi, get_system_memory(),
308 - TPM_PPI_ADDR_BASE, OBJECT(s));
309 - }
302 + tpm_ppi_init(&s->ppi, get_system_memory(),
303 + TPM_PPI_ADDR_BASE, OBJECT(s));
304
305 if (xen_enabled()) {
306 tpm_crb_reset(dev);
@@ -325,6 +319,7 @@ static void tpm_crb_class_init(ObjectClass *klass, const void *data)
319 dc->vmsd = &vmstate_tpm_crb;
320 dc->user_creatable = true;
321 tc->model = TPM_MODEL_TPM_CRB;
322 + tc->ppi_enabled = true;
323 tc->get_version = tpm_crb_get_version;
324 tc->request_completed = tpm_crb_request_completed;
325