From nobody Mon Feb 9 10:58:13 2026 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.zohomail.com; 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531181226340681.4918669765126; Mon, 9 Jul 2018 17:07:06 -0700 (PDT) Received: from localhost ([::1]:44985 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcgBN-0005I9-8r for importer@patchew.org; Mon, 09 Jul 2018 20:07:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36079) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcg64-00018j-Ph for qemu-devel@nongnu.org; Mon, 09 Jul 2018 20:01:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcg63-0001pe-Hr for qemu-devel@nongnu.org; Mon, 09 Jul 2018 20:01:36 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:38466 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcg63-0001pM-By for qemu-devel@nongnu.org; Mon, 09 Jul 2018 20:01:35 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D12974023470; Tue, 10 Jul 2018 00:01:34 +0000 (UTC) Received: from redhat.com (ovpn-120-239.rdu2.redhat.com [10.10.120.239]) by smtp.corp.redhat.com (Postfix) with SMTP id 806CC16874; Tue, 10 Jul 2018 00:01:34 +0000 (UTC) Date: Tue, 10 Jul 2018 03:01:34 +0300 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <20180710000024.542612-8-mst@redhat.com> References: <20180710000024.542612-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20180710000024.542612-1-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Tue, 10 Jul 2018 00:01:34 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Tue, 10 Jul 2018 00:01:34 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mst@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH hack dontapply v2 7/7] pc: HACK: acpi: tie in _CST object to Processor 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: imammedo@redhat.com, Richard Henderson , ehabkost@redhat.com, pbonzini@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Based on patch by Igor Mammedov. This is a hack: we definitely shouldn't do it unconditionally, and initialization should be handled differently (through an isa device?). io port to use should depend on the PC type and should be documented. Notifications should be supported. Signed-off-by: Michael S. Tsirkin --- include/hw/i386/pc.h | 5 +++++ hw/acpi/cpu.c | 5 +++++ hw/i386/acpi-build.c | 10 +++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 316230e570..83b3a84322 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -20,6 +20,11 @@ =20 #define HPET_INTCAP "hpet-intcap" =20 +typedef struct PCCstate { + uint32_t latency; + uint32_t hint; +} PCCstate; + /** * PCMachineState: * @acpi_dev: link to ACPI PM device that performs ACPI hotplug handling diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c index 5ae595ecbe..e9e207b033 100644 --- a/hw/acpi/cpu.c +++ b/hw/acpi/cpu.c @@ -561,6 +561,11 @@ void build_cpus_aml(Aml *table, MachineState *machine,= CPUHotplugFeatures opts, aml_int(arch_ids->cpus[i].props.node_id))); } =20 + if (1) { + method =3D aml_method("_CST", 0, AML_NOTSERIALIZED); + aml_append(method, aml_return(aml_call0("CCST"))); + aml_append(dev, method); + } aml_append(cpus_dev, dev); } } diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index fff1059a31..da2c830db7 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -64,6 +64,7 @@ #include "hw/i386/intel_iommu.h" =20 #include "hw/acpi/ipmi.h" +#include "hw/acpi/cst.h" =20 /* These are used to size the ACPI tables for -M pc-i440fx-1.7 and * -M pc-i440fx-2.0. Even if the actual amount of AML generated grows @@ -1840,7 +1841,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, build_legacy_cpu_hotplug_aml(dsdt, machine, pm->cpu_hp_io_base); } else { CPUHotplugFeatures opts =3D { - .apci_1_compatible =3D true, .has_legacy_cphp =3D true + .apci_1_compatible =3D true, .has_legacy_cphp =3D true, }; build_cpus_aml(dsdt, machine, opts, pm->cpu_hp_io_base, "\\_SB.PCI0", "\\_GPE._E02"); @@ -2693,6 +2694,10 @@ void acpi_build(AcpiBuildTables *tables, MachineStat= e *machine) tables->vmgenid, tables->linker); } =20 + /* TODO: get a free ioport. This one is PIIX specific. */ + acpi_add_table(table_offsets, tables_blob); + cst_build_acpi(tables_blob, tables->linker, 0xaf20); + if (misc.has_hpet) { acpi_add_table(table_offsets, tables_blob); build_hpet(tables_blob, tables->linker); @@ -2891,6 +2896,9 @@ void acpi_setup(void) =20 build_state =3D g_malloc0(sizeof *build_state); =20 + /* TODO: this is not the best place to do it */ + cst_register(pcms->fw_cfg, 0xaf20); + acpi_build_tables_init(&tables); acpi_build(&tables, MACHINE(pcms)); =20 --=20 MST