From nobody Sun Jul 26 12:29:12 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1781847413; cv=none; d=zohomail.com; s=zohoarc; b=LF40KwgUz9dWHy4wZLBM//SnY0Uk/w1AJI2Et3H34kC93CsLYTX2RiddznHgXUhazwEd2R2YXgsJXl9wnKqzNsuM8EXyWpc73GkKVM5njP7LY26Hwo20rByBk6bM/eULF2c7LmeZLYYI4Modx+cc3X4rCSzBOq64yW2H+OBNLDg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781847413; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=rzpoEAPFv5OA3Buau/xvvnFoyBxxiJ4N44RYgjM+t/o=; b=JJmthTrYDHEWmikGuLCtUWgGhRYVDTy8Jz8O5scLluKuIBPUkbMirNCjYYPx1F/RWEz9ZhyWGsaEDjsrmvKE8TpeSUjgsvBI4fCM3UVfhAkyZIPg8Ye3wh6ULu9ngpqJhLUACQ+eoCp6EX1IgoiDZTFh+bGDgEwViy+REmc1joY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1781847413452710.7139895082264; Thu, 18 Jun 2026 22:36:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1waRuD-0005Vi-1h; Fri, 19 Jun 2026 01:36:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1waRuB-0005VY-G4 for qemu-devel@nongnu.org; Fri, 19 Jun 2026 01:36:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1waRu9-0003Fg-UY for qemu-devel@nongnu.org; Fri, 19 Jun 2026 01:36:39 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-244-TDncEMFOOKKjXB-Cl6Yl1Q-1; Fri, 19 Jun 2026 01:36:33 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C449C1955DAE; Fri, 19 Jun 2026 05:36:31 +0000 (UTC) Received: from mbawa-thinkpadt14gen5.redhat.corp (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E3159180058F; Fri, 19 Jun 2026 05:36:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1781847397; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rzpoEAPFv5OA3Buau/xvvnFoyBxxiJ4N44RYgjM+t/o=; b=aASLlcPrgjGPX9okdivxc1af0bFDqjpX0dHrHul6gQ0S1dS6wHQkDm8wok4jnXdU5WIZs+ PVVHzi33J9Me2OnOlGEa11RIsmZshBmDPaQwu8PdwbFiTD/E2VXq+CBaUuh+p8bLsCHvOY v7fhb+SIu4pkkO57kJDIfEYqpeheiMM= X-MC-Unique: TDncEMFOOKKjXB-Cl6Yl1Q-1 X-Mimecast-MFC-AGG-ID: TDncEMFOOKKjXB-Cl6Yl1Q_1781847392 From: Mohammadfaiz Bawa To: Stefan Berger , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org Cc: Zhao Liu , Peter Maydell Subject: [PATCH v2 1/3] hw/tpm: gate PPI support on tpm-tis-device behind a device property Date: Fri, 19 Jun 2026 11:06:21 +0530 Message-ID: <20260619053623.756021-2-mbawa@redhat.com> In-Reply-To: <20260619053623.756021-1-mbawa@redhat.com> References: <20260619053623.756021-1-mbawa@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mbawa@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1781847415970158500 Content-Type: text/plain; charset="utf-8" Add a "ppi" boolean property (default: true) to tpm-tis-device. When ppi=3Doff the RAMBlock is never registered and the migration stream omits "tpm-ppi", restoring backward compatibility. Move sysbus_init_mmio() calls from instance_init to realizefn so the memory regions are initialized before being registered. When ppi=3Doff, the PPI MMIO region is simply not exposed. Fixes: 46cd2c1050f0 ("hw/tpm: add PPI support to tpm-tis-device for ARM64 v= irt") Signed-off-by: Mohammadfaiz Bawa --- hw/tpm/tpm_tis.h | 1 + hw/tpm/tpm_tis_sysbus.c | 18 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/hw/tpm/tpm_tis.h b/hw/tpm/tpm_tis.h index 1531620bf9..6ac9804050 100644 --- a/hw/tpm/tpm_tis.h +++ b/hw/tpm/tpm_tis.h @@ -76,6 +76,7 @@ typedef struct TPMState { size_t be_buffer_size; =20 TPMPPI ppi; + bool ppi_enabled; } TPMState; =20 extern const VMStateDescription vmstate_locty; diff --git a/hw/tpm/tpm_tis_sysbus.c b/hw/tpm/tpm_tis_sysbus.c index 16bb17874b..a7b0002d82 100644 --- a/hw/tpm/tpm_tis_sysbus.c +++ b/hw/tpm/tpm_tis_sysbus.c @@ -94,6 +94,7 @@ static void tpm_tis_sysbus_reset(DeviceState *dev) static const Property tpm_tis_sysbus_properties[] =3D { DEFINE_PROP_UINT32("irq", TPMStateSysBus, state.irq_num, TPM_TIS_IRQ), DEFINE_PROP_TPMBE("tpmdev", TPMStateSysBus, state.be_driver), + DEFINE_PROP_BOOL("ppi", TPMStateSysBus, state.ppi_enabled, true), }; =20 static void tpm_tis_sysbus_initfn(Object *obj) @@ -101,9 +102,7 @@ static void tpm_tis_sysbus_initfn(Object *obj) TPMStateSysBus *sbdev =3D TPM_TIS_SYSBUS(obj); TPMState *s =3D &sbdev->state; =20 - sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio); sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq); - sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->ppi.ram); } =20 static void tpm_tis_sysbus_realizefn(DeviceState *dev, Error **errp) @@ -122,14 +121,19 @@ static void tpm_tis_sysbus_realizefn(DeviceState *dev= , Error **errp) return; } =20 - s->ppi.buf =3D qemu_memalign(host_page_size, - ROUND_UP(TPM_PPI_ADDR_SIZE, host_page_size)= ); memory_region_init_io(&s->mmio, OBJECT(dev), &tpm_tis_memory_ops, s, "tpm-tis-mmio", TPM_TIS_NUM_LOCALITIES << TPM_TIS_LOCALITY_SHIFT= ); - memory_region_init_ram_device_ptr(&s->ppi.ram, OBJECT(dev), "tpm-ppi", - TPM_PPI_ADDR_SIZE, s->ppi.buf); - vmstate_register_ram(&s->ppi.ram, dev); + sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->mmio); + + if (s->ppi_enabled) { + s->ppi.buf =3D qemu_memalign(host_page_size, + ROUND_UP(TPM_PPI_ADDR_SIZE, host_page_s= ize)); + memory_region_init_ram_device_ptr(&s->ppi.ram, OBJECT(dev), "tpm-p= pi", + TPM_PPI_ADDR_SIZE, s->ppi.buf); + sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->ppi.ram); + vmstate_register_ram(&s->ppi.ram, dev); + } } =20 static void tpm_tis_sysbus_class_init(ObjectClass *klass, const void *data) --=20 2.54.0 From nobody Sun Jul 26 12:29:12 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1781847434; cv=none; d=zohomail.com; s=zohoarc; b=KJfDDvjKL+No0Ii+Pic2cGJtV6tGx5NQG1Lkat3iyvbRBTRbizOayf9DUKsNTwZSroLATZN0NsbQZFN+O2jxKlfzMYNIG032AMQumW0dQNj+FPy62I+5UATyL/oJivYBwel5KimC9YJXt25nAOEKvwOJIH3b44pA0fggm8YPgic= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781847434; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=gQ2HpR0WFgqm8qJgydfubSQlOn0F80nDU3NQ+9sYN1k=; b=GjVOZBxXC/bRjRuZTNvsgO8FzF71omCDmVPPSG0aEks7GApoyPj4+XkWfNY42TXb4PZmxVyNvN8Zmv3+XOxYMCur6uCqBWWm9Lc8xnXNW7DGwoDwzm+CIGgMSml+/3lthQyED+ENHRLuoAHQhdPmVF74Xu442Hnlr+W2vm3x48w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1781847434869383.6266801620458; Thu, 18 Jun 2026 22:37:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1waRuI-0005XA-AK; Fri, 19 Jun 2026 01:36:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1waRuF-0005WR-QZ for qemu-devel@nongnu.org; Fri, 19 Jun 2026 01:36:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1waRuE-0003Gb-Dt for qemu-devel@nongnu.org; Fri, 19 Jun 2026 01:36:43 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-591-N2dcKPVUMs2Wzwem1DfEIw-1; Fri, 19 Jun 2026 01:36:36 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E707D180266B; Fri, 19 Jun 2026 05:36:34 +0000 (UTC) Received: from mbawa-thinkpadt14gen5.redhat.corp (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6129F180058F; Fri, 19 Jun 2026 05:36:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1781847401; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gQ2HpR0WFgqm8qJgydfubSQlOn0F80nDU3NQ+9sYN1k=; b=YlKMBrv7lcSY0ph1wUyCP2nI0kAhwpVTaQskT1ZMeBhc6N3beLz/dLxrisfc439nch9cFo KDjv7XHMZtXgutD2p8oMxkMPxt+E8OPHg/j9CJxWYN/5gK1xlHCrgqAQvfU8aLAVWJAD0A y7dm9CpWok2Tz0N/Y08PWsITchCp/74= X-MC-Unique: N2dcKPVUMs2Wzwem1DfEIw-1 X-Mimecast-MFC-AGG-ID: N2dcKPVUMs2Wzwem1DfEIw_1781847395 From: Mohammadfaiz Bawa To: Stefan Berger , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org Cc: Zhao Liu , Peter Maydell Subject: [PATCH v2 2/3] hw/core/machine: disable tpm-tis-device PPI for machine type <= 11.0 Date: Fri, 19 Jun 2026 11:06:22 +0530 Message-ID: <20260619053623.756021-3-mbawa@redhat.com> In-Reply-To: <20260619053623.756021-1-mbawa@redhat.com> References: <20260619053623.756021-1-mbawa@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=mbawa@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1781847435967158500 Content-Type: text/plain; charset="utf-8" Set ppi=3Doff in hw_compat_11_0[] so that older machine types do not register the "tpm-ppi" RAMBlock, restoring backward migration. Signed-off-by: Mohammadfaiz Bawa --- hw/core/machine.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/core/machine.c b/hw/core/machine.c index 9a10e45aab..92cf5e1ca1 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -44,6 +44,7 @@ GlobalProperty hw_compat_11_0[] =3D { { "chardev-vc", "encoding", "cp437" }, { "tpm-crb", "cap-chunk", "off" }, { "tpm-crb", "x-allow-chunk-migration", "off" }, + { "tpm-tis-device", "ppi", "off" }, { TYPE_ARM_SMMUV3, "ats", "off" }, { TYPE_ARM_SMMUV3, "ril", "on" }, { TYPE_ARM_SMMUV3, "ssidsize", "0" }, --=20 2.54.0 From nobody Sun Jul 26 12:29:12 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1781847419; cv=none; d=zohomail.com; s=zohoarc; b=A5EX0VXV8R8WavewsjLtl5KyZfJr/0zMvYjRyxuN3hHQScgYxDVYww6rFKpCdb/2Y0GYAnUDA67Gk0UBxyG/qf426wFLhXLoFFe1bIF0OkYqjAUmDOa2NupcuUrR8KZzN3CPa7a83aiU2kp/hoUW1mcmb/yVMoYeH+bJ9XJZTVs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781847419; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=WTFD6r5+wM+NXRvQowKZ30Avvw7E0gKC4ERV2hOG6HA=; b=VwdzvDCCyENNndN0T98l2UMekjAHaERckw5xn43A7SIDSc0cfVaixXI3aZRN+iG44pfCofOCS8q8WkaCHR8RdAr7yv45sroDA8jPVAqqTvbw0nHGDK2is3e+wGMogdSjcFXwUX5n5ezS3Zo4y9zGNgaDGwyOC3/XCbLTIV0hMiU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1781847419875681.0260881121329; Thu, 18 Jun 2026 22:36:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1waRuM-0005Xc-6R; Fri, 19 Jun 2026 01:36:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1waRuH-0005Wt-O4 for qemu-devel@nongnu.org; Fri, 19 Jun 2026 01:36:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1waRuF-0003Gu-UM for qemu-devel@nongnu.org; Fri, 19 Jun 2026 01:36:45 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-94-apprc6jNNmO9Nx4lDBu9Tw-1; Fri, 19 Jun 2026 01:36:39 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D76751805A1E; Fri, 19 Jun 2026 05:36:37 +0000 (UTC) Received: from mbawa-thinkpadt14gen5.redhat.corp (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 84C8C180058F; Fri, 19 Jun 2026 05:36:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1781847403; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WTFD6r5+wM+NXRvQowKZ30Avvw7E0gKC4ERV2hOG6HA=; b=JOz8aF/SvmbTdqHyamxegnrVvsL6jHoVuEH1s5FjMGlDim9/gHfOF74BjNjiU0s0x3GT8L MUH7Zreui+G62xBel8iI7xgyvLe9Z1Cf0+kv/Wg6rqU9wLL4ZGkRvVHNQ9b2lT+IEHxcTy BIAzYaM1iCXVS37CUgIem6bD2SUj0Jw= X-MC-Unique: apprc6jNNmO9Nx4lDBu9Tw-1 X-Mimecast-MFC-AGG-ID: apprc6jNNmO9Nx4lDBu9Tw_1781847398 From: Mohammadfaiz Bawa To: Stefan Berger , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org Cc: Zhao Liu , Peter Maydell Subject: [PATCH v2 3/3] hw/core/platform-bus: guard platform_bus_get_mmio_addr() against NULL Date: Fri, 19 Jun 2026 11:06:23 +0530 Message-ID: <20260619053623.756021-4-mbawa@redhat.com> In-Reply-To: <20260619053623.756021-1-mbawa@redhat.com> References: <20260619053623.756021-1-mbawa@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mbawa@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1781847422501158500 Content-Type: text/plain; charset="utf-8" sysbus_mmio_get_region() returns NULL when a device has fewer MMIO regions than the requested slot index. platform_bus_get_mmio_addr() passes the result directly to memory_region_is_mapped() without a NULL check, causing a SIGSEGV. Return -1 early when the region pointer is NULL, consistent with the existing "not mapped" path. Signed-off-by: Mohammadfaiz Bawa Reviewed-by: Peter Maydell --- hw/core/platform-bus.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/core/platform-bus.c b/hw/core/platform-bus.c index a2217a2dee..16d0ecc0f3 100644 --- a/hw/core/platform-bus.c +++ b/hw/core/platform-bus.c @@ -59,8 +59,7 @@ hwaddr platform_bus_get_mmio_addr(PlatformBusDevice *pbus= , SysBusDevice *sbdev, Object *pbus_mr_obj =3D OBJECT(pbus_mr); Object *parent_mr; =20 - if (!memory_region_is_mapped(sbdev_mr)) { - /* Region is not mapped? */ + if (!sbdev_mr || !memory_region_is_mapped(sbdev_mr)) { return -1; } =20 --=20 2.54.0