From nobody Fri Dec 19 04:15:52 2025 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=1750067978; cv=none; d=zohomail.com; s=zohoarc; b=iE3NHELznBmvFjZFXus9S9TGt7dZonZquPDorp3ip0GlyPDwFG+OGPBO3LaBXPcoGlOZSHgW3tjiZrUvVrNcoSJWKTGfjCADZOTR9POcouLwwlbVw9VPfpW4Y4pxhzBnxO0eySqNKUD+/tTYolBlT2BNIviByyNBGRdDU1vhCA0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750067978; 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=oVHzuIYRidgYIUD9KZN7nNTxYJvNEw6p07iuCBsNpMs=; b=jnIA8EbhJ5xWb/BKekrAZ8sv2mUEDIClOIVj4lZ4WnscFXGFyc4ixo2i2o0l6Xi/aZM7e6RcbX34GVq0Wq0MPP1JV+YT0kLJ2QpZJyaj5hKnsy/kFB3mnvrOvFNZcwy4ZbCgBYFuNRIG3n6dGng036eW2Dyu+PfWx63yA0RN2Go= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1750067978562591.1156251466513; Mon, 16 Jun 2025 02:59:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uR6V7-00044o-3O; Mon, 16 Jun 2025 05:51:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uR6V4-0003uA-Mr for qemu-devel@nongnu.org; Mon, 16 Jun 2025 05:51:34 -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 1uR6V2-0002ND-NJ for qemu-devel@nongnu.org; Mon, 16 Jun 2025 05:51:34 -0400 Received: from mx-prod-mc-06.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-552-yLhohCDsOHi-_2ztyxENuw-1; Mon, 16 Jun 2025 05:51:26 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 32E571800281; Mon, 16 Jun 2025 09:51:25 +0000 (UTC) Received: from laptop.redhat.com (unknown [10.45.224.77]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 418C419560AB; Mon, 16 Jun 2025 09:51:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1750067491; 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=oVHzuIYRidgYIUD9KZN7nNTxYJvNEw6p07iuCBsNpMs=; b=DmLvY7Kppak1dm3DIkmxiK6Q/lT1Q2AeFkWeUcZF2Xyqb/azsiYOezf6H3Yn7hXzv1i/BO r31ehpy+H2bbTa1TWnYpt5Rv1v2H6sw7pn5ug4iVv+Xjg2kyMR1hZUTOsjBwn3aSCugo+x ib5fiHx68bnfuBQ4EgOgedSgc4NMMGw= X-MC-Unique: yLhohCDsOHi-_2ztyxENuw-1 X-Mimecast-MFC-AGG-ID: yLhohCDsOHi-_2ztyxENuw_1750067485 From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, qemu-devel@nongnu.org, qemu-arm@nongnu.org, peter.maydell@linaro.org, imammedo@redhat.com, gustavo.romero@linaro.org, anisinha@redhat.com, mst@redhat.com, shannon.zhaosl@gmail.com Cc: pbonzini@redhat.com, Jonathan.Cameron@huawei.com, philmd@linaro.org, alex.bennee@linaro.org Subject: [PATCH v3 25/29] hw/arm/virt: Let virt support pci hotplug/unplug GED event Date: Mon, 16 Jun 2025 11:46:54 +0200 Message-ID: <20250616094903.885753-26-eric.auger@redhat.com> In-Reply-To: <20250616094903.885753-1-eric.auger@redhat.com> References: <20250616094903.885753-1-eric.auger@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=eric.auger@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=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: 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: 1750067980677116600 Content-Type: text/plain; charset="utf-8" Set up the IO registers used to communicate between QEMU and ACPI. Signed-off-by: Eric Auger Reviewed-by: Jonathan Cameron --- v2 -> v3: - remove acpi_ged_state->pcihp_state.use_acpi_hotplug_bridge =3D true; - use sysbus_mmio_map_name for all regs (Igor) - create_pcie left at its original place v1 -> v2: - use ACPI_PCIHP_REGION_NAME --- include/hw/acpi/generic_event_device.h | 1 + hw/arm/virt.c | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/include/hw/acpi/generic_event_device.h b/include/hw/acpi/gener= ic_event_device.h index ec8e1abe0a..8f5d903146 100644 --- a/include/hw/acpi/generic_event_device.h +++ b/include/hw/acpi/generic_event_device.h @@ -111,6 +111,7 @@ typedef struct GEDState { } GEDState; =20 #define ACPI_PCIHP_REGION_NAME "pcihp container" +#define ACPI_MEMHP_REGION_NAME "memhp container" =20 struct AcpiGedState { SysBusDevice parent_obj; diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 41be8f6dbb..8c882e0794 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -684,6 +684,8 @@ static inline DeviceState *create_acpi_ged(VirtMachineS= tate *vms) DeviceState *dev; MachineState *ms =3D MACHINE(vms); SysBusDevice *sbdev; + AcpiGedState *acpi_ged_state; + AcpiPciHpState *pcihp_state; int irq =3D vms->irqmap[VIRT_ACPI_GED]; uint32_t event =3D ACPI_GED_PWR_DOWN_EVT; =20 @@ -696,13 +698,26 @@ static inline DeviceState *create_acpi_ged(VirtMachin= eState *vms) } =20 dev =3D qdev_new(TYPE_ACPI_GED); + acpi_ged_state =3D ACPI_GED(dev); + pcihp_state =3D &acpi_ged_state->pcihp_state; + if (pcihp_state->use_acpi_hotplug_bridge) { + event |=3D ACPI_GED_PCI_HOTPLUG_EVT; + } qdev_prop_set_uint32(dev, "ged-event", event); object_property_set_link(OBJECT(dev), "bus", OBJECT(vms->bus), &error_= abort); sbdev =3D SYS_BUS_DEVICE(dev); sysbus_realize_and_unref(sbdev, &error_fatal); =20 - sysbus_mmio_map(sbdev, 0, vms->memmap[VIRT_ACPI_GED].base); - sysbus_mmio_map(sbdev, 1, vms->memmap[VIRT_PCDIMM_ACPI].base); + sysbus_mmio_map_name(sbdev, TYPE_ACPI_GED, vms->memmap[VIRT_ACPI_GED].= base); + sysbus_mmio_map_name(sbdev, ACPI_MEMHP_REGION_NAME, + vms->memmap[VIRT_PCDIMM_ACPI].base); + if (pcihp_state->use_acpi_hotplug_bridge) { + int pcihp_region_index; + + pcihp_region_index =3D sysbus_mmio_map_name(sbdev, ACPI_PCIHP_REGI= ON_NAME, + vms->memmap[VIRT_ACPI_PC= IHP].base); + assert(pcihp_region_index >=3D 0); + } sysbus_connect_irq(sbdev, 0, qdev_get_gpio_in(vms->gic, irq)); =20 return dev; --=20 2.49.0