From nobody Mon Apr 29 03:17:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 14987736147831006.1512885838197; Thu, 29 Jun 2017 15:00:14 -0700 (PDT) Received: from localhost ([::1]:41420 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQhTx-0000UY-IV for importer@patchew.org; Thu, 29 Jun 2017 18:00:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34387) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQhQJ-0005kY-JD for qemu-devel@nongnu.org; Thu, 29 Jun 2017 17:56:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dQhQF-0000QR-S1 for qemu-devel@nongnu.org; Thu, 29 Jun 2017 17:56:27 -0400 Received: from mail-lf0-x241.google.com ([2a00:1450:4010:c07::241]:36214) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dQhQF-0000P2-L4 for qemu-devel@nongnu.org; Thu, 29 Jun 2017 17:56:23 -0400 Received: by mail-lf0-x241.google.com with SMTP id f28so8682508lfi.3 for ; Thu, 29 Jun 2017 14:56:21 -0700 (PDT) Received: from localhost.localdomain (broadband-5-228-183-39.moscow.rt.ru. [5.228.183.39]) by smtp.gmail.com with ESMTPSA id l69sm1532906lfl.10.2017.06.29.14.56.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Jun 2017 14:56:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Os8Yx29jrfdEf28drvke/gH9UXPEENIqrfyGq8HaWtw=; b=deL0i0FjVPlc9RqIoEABAUoGqo2Hjxa0zBpkyWuHu7ZVZ2Yj1kD+dCV3VVBp2ApH/0 NaOW3RInJU52pPaaG7OCyJQ/0QFwCRobxw+FUsJkLXlPknFKx22+2qbyCtQ6FOdIbS+Z kAAyAtNFvKyPFm4Yy1vr31Tk3E6pnGebgWdPWdJkuUDcPmrWAEoJCJ2HpwwZw7tqSOPW zFkglgl2l66PO387R1Od9TBZ1PAGLOwuHoRiwx8VD39nIOD4DTYMOEgKTIuf0dhookel F+q0rREX+L7ZutCZX+IwZjJCAm3DiU2XMjNn/y080aE4CZK2M+ZjnXEuWlE0rbDMSlRJ rtZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Os8Yx29jrfdEf28drvke/gH9UXPEENIqrfyGq8HaWtw=; b=sxMuvKTvME32sj4JbQH0qAgfgDwb3G/bvg5rO1c/NrmJI+E2kZka4nzIaKDtUBu/6Q qpYipu2Z0N3cjolBUCO9923gJDIiPvBg9VCjqZvKofL0AXUZoPkQg0YYuMZot9NlejRm TADknI+RxhQuEs3QqyeVkIGsCf71zzpWGMY42M2WvqF/b3IZHtD+EiAMQ/RiEhug6I3E fDYMxlMrOILY9J0WMXOoLF4MpuehgPldg2qTfl3mXJopMKmX79Z/MOvy+9KuwNnccoVf dLy/jHpt8MdEbxl9IUHZRpQC70sybGtEdYn0TpfwAwUG9hgmEHlNgPLS0YGg2wHyZ1Jn lJVA== X-Gm-Message-State: AKS2vOwM1rqqRen/hxSw6GXkyYHvDqffpCiYlC9T3LXdTHYQfUEs49pw fMfzU4JFUovc9cd6VsM= X-Received: by 10.46.88.92 with SMTP id x28mr3199051ljd.106.1498773380402; Thu, 29 Jun 2017 14:56:20 -0700 (PDT) From: Aleksandr Bezzubikov To: qemu-devel@nongnu.org Date: Fri, 30 Jun 2017 00:55:57 +0300 Message-Id: <1498773362-18675-2-git-send-email-zuban32s@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1498773362-18675-1-git-send-email-zuban32s@gmail.com> References: <1498773362-18675-1-git-send-email-zuban32s@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::241 Subject: [Qemu-devel] [PATCH RFC 1/6] hw/acpi: remove dead acpi code X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ehabkost@redhat.com, mst@redhat.com, Aleksandr Bezzubikov , pbonzini@redhat.com, marcel@redhat.com, imammedo@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Aleksandr Bezzubikov Reviewed-by: Igor Mammedov --- hw/i386/acpi-build.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index afcadac..6fce967 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1912,16 +1912,6 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, build_piix4_pci0_int(dsdt); } else { sb_scope =3D aml_scope("_SB"); - aml_append(sb_scope, - aml_operation_region("PCST", AML_SYSTEM_IO, aml_int(0xae00), 0= x0c)); - aml_append(sb_scope, - aml_operation_region("PCSB", AML_SYSTEM_IO, aml_int(0xae0c), 0= x01)); - field =3D aml_field("PCSB", AML_ANY_ACC, AML_NOLOCK, AML_WRITE_AS_= ZEROS); - aml_append(field, aml_named_field("PCIB", 8)); - aml_append(sb_scope, field); - aml_append(dsdt, sb_scope); - - sb_scope =3D aml_scope("_SB"); dev =3D aml_device("PCI0"); aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A08"))); aml_append(dev, aml_name_decl("_CID", aml_eisaid("PNP0A03"))); --=20 2.7.4 From nobody Mon Apr 29 03:17:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1498773485539726.86186686923; Thu, 29 Jun 2017 14:58:05 -0700 (PDT) Received: from localhost ([::1]:41413 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQhRr-0006dL-29 for importer@patchew.org; Thu, 29 Jun 2017 17:58:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34388) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQhQJ-0005kZ-JC for qemu-devel@nongnu.org; Thu, 29 Jun 2017 17:56:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dQhQF-0000QI-N6 for qemu-devel@nongnu.org; Thu, 29 Jun 2017 17:56:27 -0400 Received: from mail-lf0-x244.google.com ([2a00:1450:4010:c07::244]:34987) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dQhQF-0000Po-Fg for qemu-devel@nongnu.org; Thu, 29 Jun 2017 17:56:23 -0400 Received: by mail-lf0-x244.google.com with SMTP id n136so8680200lfn.2 for ; Thu, 29 Jun 2017 14:56:23 -0700 (PDT) Received: from localhost.localdomain (broadband-5-228-183-39.moscow.rt.ru. [5.228.183.39]) by smtp.gmail.com with ESMTPSA id l69sm1532906lfl.10.2017.06.29.14.56.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Jun 2017 14:56:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ifHzksHpcQAtKreJgCTR1IgYJlmkVrkHX9EUC1WvAJU=; b=SJG3zgad91uErbcqgTzoDOeK6GudojkqVNd0AVbxc5bqyXQtzw/2IBL1H7wiNz+g+M sgKOKfSsC/OrR/QLh0+Bg3cqW68i48bU6ox2ImRPHt9X7hrZjc8dTKcA+6KwI1NRtDaq iWrin6qpmnjHCtHdBSX2X7C894Pvo7h10EgNMO6GV0I79EDXFMfMm8jb0nN8ucmTwT9T lTozuajOcYJKVfFxyrQG4pd/eH6RC5ccwdzF6VHLFa+jug9kXfS1P4EpPOLLeL3uKdNI PIshFnXU0sl9AdVUcrRCW2fnDgHFAvtbZo4gJj9EFttLNqkBmL0ueRxQIE0ugQTeiQKt j3DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ifHzksHpcQAtKreJgCTR1IgYJlmkVrkHX9EUC1WvAJU=; b=JX3ec8PLgSezj8qFYAlJpcT9dX/QwluxBxZxRevvKyWc8SP5DHwJMwp3csPvlCi9yL sfgc+b6dVGNyw9eSwU6+ZkoAvLWDjw/MT/jBl2uqSeThaLLG+wyVtHdgkDhXR2egW3iL 8togfnMQqTSs6GaMVvF3B0yH5Eyqu/x5+m393ScXGVw72dRHPc1V2t1+MphaYnBewM4x +zRjBJDzPa0DGVPoUOW1xXNwe5sP919WArbZqlPc2IBn9HVEaYh2CqiJMlZdNWwfLlZd zYM7GFdRUjeYOLHnNmSaJ/xK/91njGRCuRGSK3AmBvXIgpdpkFGS0m3igWQ9RcFbsvK3 ILpQ== X-Gm-Message-State: AKS2vOyGphSYkPQiZQZ20YAAIy8agjjpyC90L0jqb2GXcExHGEyUx4a2 /YUjdBEW/MUVN+VPwd0= X-Received: by 10.46.82.208 with SMTP id n77mr5936464lje.93.1498773381816; Thu, 29 Jun 2017 14:56:21 -0700 (PDT) From: Aleksandr Bezzubikov To: qemu-devel@nongnu.org Date: Fri, 30 Jun 2017 00:55:58 +0300 Message-Id: <1498773362-18675-3-git-send-email-zuban32s@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1498773362-18675-1-git-send-email-zuban32s@gmail.com> References: <1498773362-18675-1-git-send-email-zuban32s@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::244 Subject: [Qemu-devel] [PATCH RFC 2/6] hw/acpi: simplify dsdt building code X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ehabkost@redhat.com, mst@redhat.com, Aleksandr Bezzubikov , pbonzini@redhat.com, marcel@redhat.com, imammedo@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Aleksandr Bezzubikov --- hw/i386/acpi-build.c | 59 +++++++++++++++++++++++-------------------------= ---- 1 file changed, 26 insertions(+), 33 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 6fce967..b0dcd34 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1886,7 +1886,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, PCMachineClass *pcmc =3D PC_MACHINE_GET_CLASS(machine); uint32_t nr_mem =3D machine->ram_slots; int root_bus_limit =3D 0xFF; - PCIBus *bus =3D NULL; + PCIBus *root_bus =3D NULL; int i; =20 dsdt =3D init_aml_allocator(); @@ -1927,6 +1927,9 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, build_q35_pci0_int(dsdt); } =20 + root_bus =3D PC_MACHINE(machine)->bus; + assert(root_bus); + if (pcmc->legacy_cpu_hotplug) { build_legacy_cpu_hotplug_aml(dsdt, machine, pm->cpu_hp_io_base); } else { @@ -1961,8 +1964,8 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, aml_append(dsdt, scope); =20 crs_range_set_init(&crs_range_set); - bus =3D PC_MACHINE(machine)->bus; - if (bus) { + { + PCIBus *bus =3D root_bus; QLIST_FOREACH(bus, &bus->child, sibling) { uint8_t bus_num =3D pci_bus_num(bus); uint8_t numa_node =3D pci_bus_numa_node(bus); @@ -2206,38 +2209,28 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, =20 sb_scope =3D aml_scope("\\_SB"); { - Object *pci_host; - PCIBus *bus =3D NULL; - - pci_host =3D acpi_get_i386_pci_host(); - if (pci_host) { - bus =3D PCI_HOST_BRIDGE(pci_host)->bus; + Aml *scope =3D aml_scope("PCI0"); + /* Scan all PCI buses. Generate tables to support hotplug. */ + build_append_pci_bus_devices(scope, root_bus, pm->pcihp_bridge_en); + + if (misc->tpm_version !=3D TPM_VERSION_UNSPEC) { + dev =3D aml_device("ISA.TPM"); + aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C31"))); + aml_append(dev, aml_name_decl("_STA", aml_int(0xF))); + crs =3D aml_resource_template(); + aml_append(crs, aml_memory32_fixed(TPM_TIS_ADDR_BASE, + TPM_TIS_ADDR_SIZE, AML_READ_WRITE)); + /* + FIXME: TPM_TIS_IRQ=3D5 conflicts with PNP0C0F irqs, + Rewrite to take IRQ from TPM device model and + fix default IRQ value there to use some unused IRQ + */ + /* aml_append(crs, aml_irq_no_flags(TPM_TIS_IRQ)); */ + aml_append(dev, aml_name_decl("_CRS", crs)); + aml_append(scope, dev); } =20 - if (bus) { - Aml *scope =3D aml_scope("PCI0"); - /* Scan all PCI buses. Generate tables to support hotplug. */ - build_append_pci_bus_devices(scope, bus, pm->pcihp_bridge_en); - - if (misc->tpm_version !=3D TPM_VERSION_UNSPEC) { - dev =3D aml_device("ISA.TPM"); - aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C31"= ))); - aml_append(dev, aml_name_decl("_STA", aml_int(0xF))); - crs =3D aml_resource_template(); - aml_append(crs, aml_memory32_fixed(TPM_TIS_ADDR_BASE, - TPM_TIS_ADDR_SIZE, AML_READ_WRITE)); - /* - FIXME: TPM_TIS_IRQ=3D5 conflicts with PNP0C0F irqs, - Rewrite to take IRQ from TPM device model and - fix default IRQ value there to use some unused IRQ - */ - /* aml_append(crs, aml_irq_no_flags(TPM_TIS_IRQ)); */ - aml_append(dev, aml_name_decl("_CRS", crs)); - aml_append(scope, dev); - } - - aml_append(sb_scope, scope); - } + aml_append(sb_scope, scope); } aml_append(dsdt, sb_scope); =20 --=20 2.7.4 From nobody Mon Apr 29 03:17:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1498773612039676.9906053544192; Thu, 29 Jun 2017 15:00:12 -0700 (PDT) Received: from localhost ([::1]:41419 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQhTu-0000UO-GR for importer@patchew.org; Thu, 29 Jun 2017 18:00:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34393) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQhQJ-0005kb-KQ for qemu-devel@nongnu.org; Thu, 29 Jun 2017 17:56:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dQhQH-0000Qt-IY for qemu-devel@nongnu.org; Thu, 29 Jun 2017 17:56:27 -0400 Received: from mail-lf0-x241.google.com ([2a00:1450:4010:c07::241]:36215) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dQhQH-0000Qe-B2 for qemu-devel@nongnu.org; Thu, 29 Jun 2017 17:56:25 -0400 Received: by mail-lf0-x241.google.com with SMTP id f28so8682553lfi.3 for ; Thu, 29 Jun 2017 14:56:25 -0700 (PDT) Received: from localhost.localdomain (broadband-5-228-183-39.moscow.rt.ru. [5.228.183.39]) by smtp.gmail.com with ESMTPSA id l69sm1532906lfl.10.2017.06.29.14.56.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Jun 2017 14:56:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9Rp4bOTIeFl+vlB5zjlUhqDhtQW9EJHN5fJD2Hz9D9w=; b=B9KvdFTUayLtOY1oV1O8KcAkHrMLp+W0e3H3pVC6sEsS/MeZ1L7DxXeoTW91qW+WuJ hp/jZrWrnOxlZBNP+uSa9NAqz6DEeDIFUqNmoS43rxc5dyu0xIWpKlNegE7JNJuGB6Qg QSxrEDHfVQv2MqCymuUlE/1l0/jv8EI1/U6ndtbsx/P/kwTn2KgGqQ0bStOWJGlFrTy5 Qj8AGdM4UPdfXFOnfiFJJSLpIUSbT52/x4ELKZR9maDZHZC3d4Olgq24fzkGxSAsyWxE tkwKcVcahqQzRctNHW3wNvK480hOpiMJGTdK2W+KutM3udCVfTsZ41Am+AQ3kzTrOnbY 3Rog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9Rp4bOTIeFl+vlB5zjlUhqDhtQW9EJHN5fJD2Hz9D9w=; b=YiVM+mQNldna1W+K2ym98uwWP82E84xjMn4g+ZK44afvevpvykTAEhiDK1ekV3rOK/ RqjuPDycWL+nGl8R9v2d+R72qIbvJEWoJQGpCuYeTAUySc8gzN+StpHt9PjTR+kCJl3h rQmUdK9ljBSdwsyRnVChgSp/LLxReEABFO0t3fVhp17R7UX+vUHqTjx3YqQNQ9V5Gu/z nspto79v8QNQ6rkAPaTlpk3NIALfw8C9kyoHmNvRGXYVUjaHANvwxjBgKfFk5Zue0Hi3 RjLx3U5wVOBHcFfQB7Xp8nFOLCIWblfuR/s+/pem85eymMg8dGvoIwy4+UJLIUvu1dTp lQyQ== X-Gm-Message-State: AKS2vOzXx9iXswu95jrVFuccS93uKclNNqoXNZYgB+jpCMpOXX5sbb3o 7uHDFZMu0+Q5lU/pi4Y= X-Received: by 10.46.74.18 with SMTP id x18mr5832646lja.130.1498773383725; Thu, 29 Jun 2017 14:56:23 -0700 (PDT) From: Aleksandr Bezzubikov To: qemu-devel@nongnu.org Date: Fri, 30 Jun 2017 00:55:59 +0300 Message-Id: <1498773362-18675-4-git-send-email-zuban32s@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1498773362-18675-1-git-send-email-zuban32s@gmail.com> References: <1498773362-18675-1-git-send-email-zuban32s@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::241 Subject: [Qemu-devel] [PATCH RFC 3/6] hw/acpi: fix pcihp io initialization X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ehabkost@redhat.com, mst@redhat.com, Aleksandr Bezzubikov , pbonzini@redhat.com, marcel@redhat.com, imammedo@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Aleksandr Bezzubikov --- hw/i386/acpi-build.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index b0dcd34..c99dbcc 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -129,17 +129,18 @@ static void acpi_get_pm_info(AcpiPmInfo *pm) Object *lpc =3D ich9_lpc_find(); Object *obj =3D NULL; QObject *o; + int pcihp_io_len, pcihp_io_base; =20 pm->cpu_hp_io_base =3D 0; - pm->pcihp_io_base =3D 0; - pm->pcihp_io_len =3D 0; if (piix) { obj =3D piix; pm->cpu_hp_io_base =3D PIIX4_CPU_HOTPLUG_IO_BASE; - pm->pcihp_io_base =3D + pcihp_io_base =3D object_property_get_int(obj, ACPI_PCIHP_IO_BASE_PROP, NULL); - pm->pcihp_io_len =3D + pcihp_io_len =3D object_property_get_int(obj, ACPI_PCIHP_IO_LEN_PROP, NULL); + pm->pcihp_io_base =3D (pcihp_io_base =3D=3D -1) ? 0 : pcihp_io_bas= e; + pm->pcihp_io_len =3D (pcihp_io_len =3D=3D -1) ? 0 : pcihp_io_len; } if (lpc) { obj =3D lpc; --=20 2.7.4 From nobody Mon Apr 29 03:17:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1498773483908261.0839019293378; Thu, 29 Jun 2017 14:58:03 -0700 (PDT) Received: from localhost ([::1]:41411 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQhRq-0006cT-IK for importer@patchew.org; Thu, 29 Jun 2017 17:58:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34396) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQhQJ-0005kc-LB for qemu-devel@nongnu.org; Thu, 29 Jun 2017 17:56:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dQhQI-0000Rc-Un for qemu-devel@nongnu.org; Thu, 29 Jun 2017 17:56:27 -0400 Received: from mail-lf0-x241.google.com ([2a00:1450:4010:c07::241]:34990) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dQhQI-0000R7-NI for qemu-devel@nongnu.org; Thu, 29 Jun 2017 17:56:26 -0400 Received: by mail-lf0-x241.google.com with SMTP id n136so8680247lfn.2 for ; Thu, 29 Jun 2017 14:56:26 -0700 (PDT) Received: from localhost.localdomain (broadband-5-228-183-39.moscow.rt.ru. [5.228.183.39]) by smtp.gmail.com with ESMTPSA id l69sm1532906lfl.10.2017.06.29.14.56.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Jun 2017 14:56:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7Phr/bi4ohsr6siI/LjCseR/dSQN5xnjh+37HQ/DJD0=; b=MMc7Ee2oO6AJTGUaknMqVSF6XPRk3Tib2SWY1NdAeY9Q5fLaPZnEvmVGGRtZXWP5C+ SZdABrk00vni/1n1AOmRa0I7YaDSoVWi7sYiHXgYkP3rGXNso/nvsai9x65TxM5KmYi3 iAr5Rqy6J+fLbMcVJT/utAF71we1qq/31S0W4LFH+DX/mSo27r17xzLUofScULxR0GMp jshAyt+y+q20idwuNurIVH79uvVQcEiC3Y1iqJCCnancg9uZdDruoBihmiw90wwOo4YF t/0Jes5AhzM9wEuoFy7boeRfhw8Dvadcaw0y6IB6uAiMtdPEgPhB7IIvNYLb7mjWj/ft 8xPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7Phr/bi4ohsr6siI/LjCseR/dSQN5xnjh+37HQ/DJD0=; b=AE/uCw+vMz2o8UVmwalUZGGaNCjxgZpS7sG//ohc+2she15hfkCGJTw8MTUo0OjplK kWBcq7JRLr8vOwDCjFkJ4L0ccBSnYKnMgbUfgElljibBtGyeKMXUWAtwIa0Iud3fkChS wAMz2m6yS5TMDI8R1dkfKqfFJ30nxzcp3B07kfta40VSGbR3AAIQGQ7ZhxHfxnJRJ26B LCuHy3AMCDzawJOFqhil09kFF/XP4/GgDDxNaHUfjWwNsTApNcWj307+LiwM3rMJ2+58 M2TVb7gfKa1aWP5N+zItV51YP0VHg82dsxbktvqDufHgmtV9Rc6rUYn7YiR88MdX/ukW vG/g== X-Gm-Message-State: AKS2vOx1lvuFXjTA6o2RJTRLlI69CS//zPVQGMqb2pSEfvSfO7pxIUD3 5ivXMCUtMf0I8jh7Y1c= X-Received: by 10.46.76.10 with SMTP id z10mr5573276lja.41.1498773385101; Thu, 29 Jun 2017 14:56:25 -0700 (PDT) From: Aleksandr Bezzubikov To: qemu-devel@nongnu.org Date: Fri, 30 Jun 2017 00:56:00 +0300 Message-Id: <1498773362-18675-5-git-send-email-zuban32s@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1498773362-18675-1-git-send-email-zuban32s@gmail.com> References: <1498773362-18675-1-git-send-email-zuban32s@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::241 Subject: [Qemu-devel] [PATCH RFC 4/6] hw/acpi: prepare pci hotplug IO for ich9 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ehabkost@redhat.com, mst@redhat.com, Aleksandr Bezzubikov , pbonzini@redhat.com, marcel@redhat.com, imammedo@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Aleksandr Bezzubikov --- hw/i386/acpi-build.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index c99dbcc..e434efe 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -135,12 +135,6 @@ static void acpi_get_pm_info(AcpiPmInfo *pm) if (piix) { obj =3D piix; pm->cpu_hp_io_base =3D PIIX4_CPU_HOTPLUG_IO_BASE; - pcihp_io_base =3D - object_property_get_int(obj, ACPI_PCIHP_IO_BASE_PROP, NULL); - pcihp_io_len =3D - object_property_get_int(obj, ACPI_PCIHP_IO_LEN_PROP, NULL); - pm->pcihp_io_base =3D (pcihp_io_base =3D=3D -1) ? 0 : pcihp_io_bas= e; - pm->pcihp_io_len =3D (pcihp_io_len =3D=3D -1) ? 0 : pcihp_io_len; } if (lpc) { obj =3D lpc; @@ -148,6 +142,13 @@ static void acpi_get_pm_info(AcpiPmInfo *pm) } assert(obj); =20 + pcihp_io_base =3D + object_property_get_int(obj, ACPI_PCIHP_IO_BASE_PROP, NULL); + pcihp_io_len =3D + object_property_get_int(obj, ACPI_PCIHP_IO_LEN_PROP, NULL); + pm->pcihp_io_base =3D (pcihp_io_base =3D=3D -1) ? 0 : pcihp_io_base; + pm->pcihp_io_len =3D (pcihp_io_len =3D=3D -1) ? 0 : pcihp_io_len; + /* Fill in optional s3/s4 related properties */ o =3D object_property_get_qobject(obj, ACPI_PM_PROP_S3_DISABLED, NULL); if (o) { --=20 2.7.4 From nobody Mon Apr 29 03:17:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1498773731037882.9926029789584; Thu, 29 Jun 2017 15:02:11 -0700 (PDT) Received: from localhost ([::1]:41438 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQhVn-0001vE-Pi for importer@patchew.org; Thu, 29 Jun 2017 18:02:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34425) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQhQL-0005kz-JF for qemu-devel@nongnu.org; Thu, 29 Jun 2017 17:56:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dQhQK-0000Sg-Mr for qemu-devel@nongnu.org; Thu, 29 Jun 2017 17:56:29 -0400 Received: from mail-lf0-x242.google.com ([2a00:1450:4010:c07::242]:34991) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dQhQK-0000Rs-Bk for qemu-devel@nongnu.org; Thu, 29 Jun 2017 17:56:28 -0400 Received: by mail-lf0-x242.google.com with SMTP id n136so8680281lfn.2 for ; Thu, 29 Jun 2017 14:56:28 -0700 (PDT) Received: from localhost.localdomain (broadband-5-228-183-39.moscow.rt.ru. [5.228.183.39]) by smtp.gmail.com with ESMTPSA id l69sm1532906lfl.10.2017.06.29.14.56.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Jun 2017 14:56:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7/xbdj9px7S5ZrC6BIGh27tvV6k8zxRYC/cKPAElrF0=; b=daTni0zhmX8JB2GTTBYXlvBpOgUK/oNNOYOXLgb/bI255+nW43gp892I2rvyV2K3zB cQ4QHBa0RWuQo7pF7dpn0EACJ/cGTRiKcDSG8bzycnPCy3JgLoxEgld70PBUArCWFIrs KGFBF51VPoUJezuG8q2TiVwihmZb94M1vk7voIn7fMGhvTGyigphCPgsh5W9RmbZMJ0D 8G1nKXBVvTxm1bXcdWdLxmOy+bEPM5Y8ntoI2gP8vYM8lN4HmCz6gEQZXKHUUYzBaHDN bm4bL3SnDw9A2qNXNZ4ps2izmTV0mKLYvDLkyZPDEHoQdsQKoxfX6w/fqAKGHkNf5KiS I+IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7/xbdj9px7S5ZrC6BIGh27tvV6k8zxRYC/cKPAElrF0=; b=WGOrOec8h4b8nLlfFicIEL58Lyc+CWNz2x9HBtrzoM/eujoejsstFJva1T2Z0d3Jck +sq5hScqgpVE9l49XSpmtRcN0sKXVmR7K4wjvRjRqygPbJRfg+i2pRUnrA2lDVxWGIEN 6VScfJ7yLn1whyka8lFd7WUoXXQ0IfHMn8DIDZxp3GlaE68gfB9K4A8qKd2Y1UJPuN5D fyusadO6Mm92rDQRyLLIJJXQGFDtlHRscyreMiLs6WYaU5Z/ZPdP7ZEO2XZp3KWALDaF fyWqGONaY86RrgSiJd5GvJJ3pDJE9GLnflH6nDvbhqsI7cCdhD+UlRS3n2dYckidhkgV Qguw== X-Gm-Message-State: AKS2vOwpJZUYy85F3hsxwPinWrVwMcHwe/ifHG8nMbWPQO34hCw07hk6 ZrYzZOs+cmx2zA0zX60= X-Received: by 10.25.235.69 with SMTP id j66mr6195963lfh.141.1498773386690; Thu, 29 Jun 2017 14:56:26 -0700 (PDT) From: Aleksandr Bezzubikov To: qemu-devel@nongnu.org Date: Fri, 30 Jun 2017 00:56:01 +0300 Message-Id: <1498773362-18675-6-git-send-email-zuban32s@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1498773362-18675-1-git-send-email-zuban32s@gmail.com> References: <1498773362-18675-1-git-send-email-zuban32s@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::242 Subject: [Qemu-devel] [PATCH RFC 5/6] hw/acpi: extend acpi pci hotplug support for pci express X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ehabkost@redhat.com, mst@redhat.com, Aleksandr Bezzubikov , pbonzini@redhat.com, marcel@redhat.com, imammedo@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Aleksandr Bezzubikov --- hw/i386/acpi-build.c | 47 +++++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index e434efe..8bbece5 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -254,6 +254,11 @@ static void acpi_get_pci_holes(Range *hole, Range *hol= e64) NULL)); } =20 +static void acpi_test_pci_bus(PCIBus *bus, void *opaque) +{ + *(bool *)opaque |=3D !pci_bus_is_express(bus); +} + #define ACPI_PORT_SMI_CMD 0x00b2 /* TODO: this is APM_CNT_IOPORT= */ =20 static void acpi_align_size(GArray *blob, unsigned align) @@ -489,7 +494,7 @@ static void *acpi_set_bsel(PCIBus *bus, void *opaque) unsigned *bsel_alloc =3D opaque; unsigned *bus_bsel; =20 - if (qbus_is_hotpluggable(BUS(bus))) { + if (qbus_is_hotpluggable(BUS(bus)) && !pci_bus_is_express(bus)) { bus_bsel =3D g_malloc(sizeof *bus_bsel); =20 *bus_bsel =3D (*bsel_alloc)++; @@ -500,15 +505,12 @@ static void *acpi_set_bsel(PCIBus *bus, void *opaque) return bsel_alloc; } =20 -static void acpi_set_pci_info(void) +static void acpi_set_pci_info(PCIBus *bus) { - PCIBus *bus =3D find_i440fx(); /* TODO: Q35 support */ unsigned bsel_alloc =3D ACPI_PCIHP_BSEL_DEFAULT; =20 - if (bus) { - /* Scan all PCI buses. Set property to enable acpi based hotplug. = */ - pci_for_each_bus_depth_first(bus, acpi_set_bsel, NULL, &bsel_alloc= ); - } + /* Scan all PCI buses. Set property to enable acpi based hotplug. */ + pci_for_each_bus_depth_first(bus, acpi_set_bsel, NULL, &bsel_alloc); } =20 static void build_append_pcihp_notify_entry(Aml *method, int slot) @@ -570,7 +572,7 @@ static void build_append_pci_bus_devices(Aml *parent_sc= ope, PCIBus *bus, * In this case they aren't themselves hot-pluggable. * Hotplugged bridges *are* hot-pluggable. */ - bridge_in_acpi =3D pc->is_bridge && pcihp_bridge_en && + bridge_in_acpi =3D pc->is_bridge && !pc->is_express && pcihp_bridg= e_en && !DEVICE(pdev)->hotplugged; =20 hotplug_enabled_dev =3D bsel && dc->hotpluggable && !bridge_in_acp= i; @@ -1787,7 +1789,7 @@ static void build_piix4_isa_bridge(Aml *table) aml_append(table, scope); } =20 -static void build_piix4_pci_hotplug(Aml *table) +static void build_acpi_pci_hotplug(Aml *table) { Aml *scope; Aml *field; @@ -1889,6 +1891,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, uint32_t nr_mem =3D machine->ram_slots; int root_bus_limit =3D 0xFF; PCIBus *root_bus =3D NULL; + bool has_pci_bus =3D false; int i; =20 dsdt =3D init_aml_allocator(); @@ -1910,7 +1913,6 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, build_piix4_pm(dsdt); build_piix4_isa_bridge(dsdt); build_isa_devices_aml(dsdt); - build_piix4_pci_hotplug(dsdt); build_piix4_pci0_int(dsdt); } else { sb_scope =3D aml_scope("_SB"); @@ -1932,6 +1934,11 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, root_bus =3D PC_MACHINE(machine)->bus; assert(root_bus); =20 + pci_for_each_bus(root_bus, acpi_test_pci_bus, &has_pci_bus); + if (pm->pcihp_bridge_en && has_pci_bus) { + build_acpi_pci_hotplug(dsdt); + } + if (pcmc->legacy_cpu_hotplug) { build_legacy_cpu_hotplug_aml(dsdt, machine, pm->cpu_hp_io_base); } else { @@ -1947,7 +1954,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, { aml_append(scope, aml_name_decl("_HID", aml_string("ACPI0006"))); =20 - if (misc->is_piix4) { + if (pm->pcihp_bridge_en && has_pci_bus) { method =3D aml_method("_E01", 0, AML_NOTSERIALIZED); aml_append(method, aml_acquire(aml_name("\\_SB.PCI0.BLCK"), 0xFFFF)); @@ -2080,7 +2087,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, crs_range_set_free(&crs_range_set); =20 /* reserve PCIHP resources */ - if (pm->pcihp_io_len) { + if (pm->pcihp_bridge_en && has_pci_bus && pm->pcihp_io_len) { dev =3D aml_device("PHPR"); aml_append(dev, aml_name_decl("_HID", aml_string("PNP0A06"))); aml_append(dev, @@ -2212,8 +2219,13 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, sb_scope =3D aml_scope("\\_SB"); { Aml *scope =3D aml_scope("PCI0"); - /* Scan all PCI buses. Generate tables to support hotplug. */ - build_append_pci_bus_devices(scope, root_bus, pm->pcihp_bridge_en); + bool scope_used =3D false; + + if (pm->pcihp_bridge_en && has_pci_bus) { + /* Scan all PCI buses. Generate tables to support hotplug. */ + build_append_pci_bus_devices(scope, root_bus, pm->pcihp_bridge= _en); + scope_used =3D true; + } =20 if (misc->tpm_version !=3D TPM_VERSION_UNSPEC) { dev =3D aml_device("ISA.TPM"); @@ -2230,9 +2242,12 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, /* aml_append(crs, aml_irq_no_flags(TPM_TIS_IRQ)); */ aml_append(dev, aml_name_decl("_CRS", crs)); aml_append(scope, dev); + scope_used =3D true; } =20 - aml_append(sb_scope, scope); + if (scope_used) { + aml_append(sb_scope, scope); + } } aml_append(dsdt, sb_scope); =20 @@ -2866,7 +2881,7 @@ void acpi_setup(void) =20 build_state =3D g_malloc0(sizeof *build_state); =20 - acpi_set_pci_info(); + acpi_set_pci_info(pcms->bus); =20 acpi_build_tables_init(&tables); acpi_build(&tables, MACHINE(pcms)); --=20 2.7.4 From nobody Mon Apr 29 03:17:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1498773666445621.4455928722009; Thu, 29 Jun 2017 15:01:06 -0700 (PDT) Received: from localhost ([::1]:41427 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQhUn-0001CJ-59 for importer@patchew.org; Thu, 29 Jun 2017 18:01:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34446) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQhQN-0005mN-6X for qemu-devel@nongnu.org; Thu, 29 Jun 2017 17:56:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dQhQM-0000TT-5E for qemu-devel@nongnu.org; Thu, 29 Jun 2017 17:56:31 -0400 Received: from mail-lf0-x241.google.com ([2a00:1450:4010:c07::241]:34533) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dQhQL-0000Sq-R4 for qemu-devel@nongnu.org; Thu, 29 Jun 2017 17:56:30 -0400 Received: by mail-lf0-x241.google.com with SMTP id g21so8706656lfk.1 for ; Thu, 29 Jun 2017 14:56:29 -0700 (PDT) Received: from localhost.localdomain (broadband-5-228-183-39.moscow.rt.ru. [5.228.183.39]) by smtp.gmail.com with ESMTPSA id l69sm1532906lfl.10.2017.06.29.14.56.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Jun 2017 14:56:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=uFjJKpQNWCaWQ1CY4kult0NemvR5k8CQ0JRIcWV7F+g=; b=HW6tZRgpCejObgeDm3IIeFrm0n75QdHREzUImi53aZYTTH8WDl4E5kDj1oTiBMwAbN qklBBcSXtdBQfpbTCv0lDBLOeis/z/490z3FsLc8rXe79lE4NCLn+QoTe4LNuIf/zny/ fLcEiKCh8ie/qeraFLCYdsm7sIyNQpMf6wt7HkQhdIBDy+4vG+Wx2mHjWJ7My8V/Mx+d oxwr4U4/UXjpVeGZJvbLyQ2+tuUobaAVUw8EAMUDVcMpEjYVfl5Ll4Zj4Y+ZKLNUVQwK BT7hObBa0NNfRWAY4/IsDcidHlmVlL+I3ETqbVAmGKzSs37amID41onzE/wyGROFQMeI X8Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=uFjJKpQNWCaWQ1CY4kult0NemvR5k8CQ0JRIcWV7F+g=; b=jsErBCB61vGkn+DYxXYfujNoDcPy/2gIrhEgXy1uDOMpwacYfKgaI4vVKDUFFWLSyr lTAeryIM2O5tpAGmBClrOPCIqY9eTEnk+Iq9rPHsRmCmPH8F0vX6WlPdUDdEm+Fx8Mgr mgxyw9zwer5Xh2E/7S+lVveygW8f98Jck/w5LojtHgxn9crDMyUw3WCK/u+W32qMbFjx daLASxoy5Qepu9Dl1Xx54XUQfVPiD9mUulvBEp/txDEY1iEOZZ5AcKUE3J6GUPhUf6PB qOVMwS6FUMBzub9wsdv/BdSdmPKWYfm4Z2bbqHmCAQvo2yp+oCT6mFD09UZ1sjZqM0ZW X5JA== X-Gm-Message-State: AKS2vOxCIMLC9xB6uEtenaQJayp5F+yHv2FMs1tFfqlb5Fi1kc8LRuQI j77UwsqGl3AXGVGWE24= X-Received: by 10.25.211.16 with SMTP id k16mr5964472lfg.45.1498773388232; Thu, 29 Jun 2017 14:56:28 -0700 (PDT) From: Aleksandr Bezzubikov To: qemu-devel@nongnu.org Date: Fri, 30 Jun 2017 00:56:02 +0300 Message-Id: <1498773362-18675-7-git-send-email-zuban32s@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1498773362-18675-1-git-send-email-zuban32s@gmail.com> References: <1498773362-18675-1-git-send-email-zuban32s@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::241 Subject: [Qemu-devel] [PATCH RFC 6/6] hw/ich9: enable acpi pci hotplug X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ehabkost@redhat.com, mst@redhat.com, Aleksandr Bezzubikov , pbonzini@redhat.com, marcel@redhat.com, imammedo@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Aleksandr Bezzubikov --- hw/acpi/ich9.c | 31 +++++++++++++++++++++++++++++++ hw/isa/lpc_ich9.c | 12 ++++++++++++ include/hw/acpi/ich9.h | 4 ++++ include/hw/i386/pc.h | 7 ++++++- 4 files changed, 53 insertions(+), 1 deletion(-) diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c index 5c279bb..25339eb 100644 --- a/hw/acpi/ich9.c +++ b/hw/acpi/ich9.c @@ -258,6 +258,7 @@ static void pm_reset(void *opaque) } pm->smi_en_wmask =3D ~0; =20 + acpi_pcihp_reset(&pm->acpi_pci_hotplug); acpi_update_sci(&pm->acpi_regs, pm->irq); } =20 @@ -301,6 +302,10 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *p= m, pm->powerdown_notifier.notify =3D pm_powerdown_req; qemu_register_powerdown_notifier(&pm->powerdown_notifier); =20 + acpi_pcihp_init(OBJECT(lpc_pci), &pm->acpi_pci_hotplug, lpc_pci->bus, + pci_address_space_io(lpc_pci), + pm->use_acpi_pci_hotplug); + legacy_acpi_cpu_hotplug_init(pci_address_space_io(lpc_pci), OBJECT(lpc_pci), &pm->gpe_cpu, ICH9_CPU_HOTPLUG_IO_BASE); =20 @@ -335,6 +340,21 @@ static void ich9_pm_set_memory_hotplug_support(Object = *obj, bool value, s->pm.acpi_memory_hotplug.is_enabled =3D value; } =20 +static bool ich9_pm_get_acpi_pci_hotplug_support(Object *obj, Error **errp) +{ + ICH9LPCState *s =3D ICH9_LPC_DEVICE(obj); + + return s->pm.use_acpi_pci_hotplug; +} + +static void ich9_pm_set_acpi_pci_hotplug_support(Object *obj, bool value, + Error **errp) +{ + ICH9LPCState *s =3D ICH9_LPC_DEVICE(obj); + + s->pm.use_acpi_pci_hotplug =3D value; +} + static bool ich9_pm_get_cpu_hotplug_legacy(Object *obj, Error **errp) { ICH9LPCState *s =3D ICH9_LPC_DEVICE(obj); @@ -446,6 +466,7 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs = *pm, Error **errp) { static const uint32_t gpe0_len =3D ICH9_PMIO_GPE0_LEN; pm->acpi_memory_hotplug.is_enabled =3D true; + pm->use_acpi_pci_hotplug =3D true; pm->cpu_hotplug_legacy =3D true; pm->disable_s3 =3D 0; pm->disable_s4 =3D 0; @@ -462,6 +483,10 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs= *pm, Error **errp) ich9_pm_get_memory_hotplug_support, ich9_pm_set_memory_hotplug_support, NULL); + object_property_add_bool(obj, "acpi-pci-hotplug-with-bridge-support", + ich9_pm_get_acpi_pci_hotplug_support, + ich9_pm_set_acpi_pci_hotplug_support, + NULL); object_property_add_bool(obj, "cpu-hotplug-legacy", ich9_pm_get_cpu_hotplug_legacy, ich9_pm_set_cpu_hotplug_legacy, @@ -497,6 +522,9 @@ void ich9_pm_device_plug_cb(HotplugHandler *hotplug_dev= , DeviceState *dev, acpi_memory_plug_cb(hotplug_dev, &lpc->pm.acpi_memory_hotplug, dev, errp); } + } else if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) { + acpi_pcihp_device_plug_cb(hotplug_dev, &lpc->pm.acpi_pci_hotplug, + dev, errp); } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) { if (lpc->pm.cpu_hotplug_legacy) { legacy_acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.gpe_cpu, dev, er= rp); @@ -519,6 +547,9 @@ void ich9_pm_device_unplug_request_cb(HotplugHandler *h= otplug_dev, acpi_memory_unplug_request_cb(hotplug_dev, &lpc->pm.acpi_memory_hotplug, dev, errp); + } else if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) { + acpi_pcihp_device_unplug_cb(hotplug_dev, &lpc->pm.acpi_pci_hotplug, + dev, errp); } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU) && !lpc->pm.cpu_hotplug_legacy) { acpi_cpu_unplug_request_cb(hotplug_dev, &lpc->pm.cpuhp_state, diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c index e2215dc..13574d0 100644 --- a/hw/isa/lpc_ich9.c +++ b/hw/isa/lpc_ich9.c @@ -33,6 +33,7 @@ #include "hw/hw.h" #include "qapi/visitor.h" #include "qemu/range.h" +#include "qapi/error.h" #include "hw/isa/isa.h" #include "hw/sysbus.h" #include "hw/i386/pc.h" @@ -574,6 +575,15 @@ static const MemoryRegionOps rcrb_mmio_ops =3D { .endianness =3D DEVICE_LITTLE_ENDIAN, }; =20 +static void ich9_update_bus_hotplug(PCIBus *pci_bus, void *opaque) +{ + ICH9LPCState *s =3D opaque; + + if (!pci_bus_is_express(pci_bus)) { + qbus_set_hotplug_handler(BUS(pci_bus), DEVICE(s), &error_abort); + } +} + static void ich9_lpc_machine_ready(Notifier *n, void *opaque) { ICH9LPCState *s =3D container_of(n, ICH9LPCState, machine_ready); @@ -597,6 +607,8 @@ static void ich9_lpc_machine_ready(Notifier *n, void *o= paque) /* floppy */ pci_conf[0x82] |=3D 0x08; } + + pci_for_each_bus(s->d.bus, ich9_update_bus_hotplug, s); } =20 /* reset control */ diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h index a352c94..e1df363 100644 --- a/include/hw/acpi/ich9.h +++ b/include/hw/acpi/ich9.h @@ -22,6 +22,7 @@ #define HW_ACPI_ICH9_H =20 #include "hw/acpi/acpi.h" +#include "hw/acpi/pcihp.h" #include "hw/acpi/cpu_hotplug.h" #include "hw/acpi/cpu.h" #include "hw/acpi/memory_hotplug.h" @@ -55,6 +56,9 @@ typedef struct ICH9LPCPMRegs { =20 MemHotplugState acpi_memory_hotplug; =20 + AcpiPciHpState acpi_pci_hotplug; + bool use_acpi_pci_hotplug; + uint8_t disable_s3; uint8_t disable_s4; uint8_t s4_val; diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index e447f5d..0d4e8b2 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -464,7 +464,12 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_= t *); }, =20 #define PC_COMPAT_2_5 \ - HW_COMPAT_2_5 + HW_COMPAT_2_5 \ + {\ + .driver =3D "ICH9-LPC",\ + .property =3D "acpi-pci-hotplug-with-bridge-support",\ + .value =3D "off",\ + }, =20 /* Helper for setting model-id for CPU models that changed model-id * depending on QEMU versions up to QEMU 2.4. --=20 2.7.4