From patchwork Mon Dec 28 17:02:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Mammedov X-Patchwork-Id: 561335 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id CF0E2140C60 for ; Tue, 29 Dec 2015 04:08:50 +1100 (AEDT) Received: from localhost ([::1]:45335 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDbHs-0003IN-Jf for incoming@patchwork.ozlabs.org; Mon, 28 Dec 2015 12:08:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34134) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDbCV-00007A-Py for qemu-devel@nongnu.org; Mon, 28 Dec 2015 12:03:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aDbCU-00083b-Qx for qemu-devel@nongnu.org; Mon, 28 Dec 2015 12:03:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43622) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDbCU-00083Q-K2 for qemu-devel@nongnu.org; Mon, 28 Dec 2015 12:03:14 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 415D28E24E for ; Mon, 28 Dec 2015 17:03:14 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tBSH2wJ8021909 for ; Mon, 28 Dec 2015 12:03:13 -0500 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 28 Dec 2015 18:02:25 +0100 Message-Id: <1451322178-261185-18-git-send-email-imammedo@redhat.com> In-Reply-To: <1451321851-260744-1-git-send-email-imammedo@redhat.com> References: <1451321851-260744-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 18/51] pc: acpi: cpuhp: move CPST() method into SSDT X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Igor Mammedov --- hw/acpi/cpu_hotplug_acpi_table.c | 22 ++++++++++++++++++++++ hw/i386/acpi-build.c | 3 ++- hw/i386/acpi-dsdt-cpu-hotplug.dsl | 12 ------------ include/hw/acpi/cpu_hotplug.h | 1 + 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/hw/acpi/cpu_hotplug_acpi_table.c b/hw/acpi/cpu_hotplug_acpi_table.c index 69c37fa..90c4043 100644 --- a/hw/acpi/cpu_hotplug_acpi_table.c +++ b/hw/acpi/cpu_hotplug_acpi_table.c @@ -18,6 +18,8 @@ void build_cpu_hotplug_aml(Aml *ctx) { Aml *method; + Aml *if_ctx; + Aml *else_ctx; Aml *sb_scope = aml_scope("_SB"); uint8_t madt_tmpl[8] = {0x00, 0x08, 0x00, 0x00, 0x00, 0, 0, 0}; Aml *cpu_id = aml_arg(0); @@ -43,6 +45,26 @@ void build_cpu_hotplug_aml(Aml *ctx) aml_append(method, aml_return(madt)); aml_append(sb_scope, method); + /* + * _STA method - return ON status of cpu + * cpu_id = Arg0 = Processor ID = Local APIC ID + * cpu_on = Local0 = CPON flag for this cpu + */ + method = aml_method(CPU_STATUS_METHOD, 1, AML_NOTSERIALIZED); + aml_append(method, + aml_store(aml_derefof(aml_index(cpus_map, cpu_id)), cpu_on)); + if_ctx = aml_if(cpu_on); + { + aml_append(if_ctx, aml_return(aml_int(0xF))); + } + aml_append(method, if_ctx); + else_ctx = aml_else(); + { + aml_append(else_ctx, aml_return(aml_int(0x0))); + } + aml_append(method, else_ctx); + aml_append(sb_scope, method); + method = aml_method(CPU_EJECT_METHOD, 2, AML_NOTSERIALIZED); aml_append(method, aml_sleep(200)); aml_append(sb_scope, method); diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 683687a..a1b4e98 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1321,7 +1321,8 @@ build_ssdt(GArray *table_data, GArray *linker, aml_append(dev, method); method = aml_method("_STA", 0, AML_NOTSERIALIZED); - aml_append(method, aml_return(aml_call1("CPST", aml_int(i)))); + aml_append(method, + aml_return(aml_call1(CPU_STATUS_METHOD, aml_int(i)))); aml_append(dev, method); method = aml_method("_EJ0", 1, AML_NOTSERIALIZED); diff --git a/hw/i386/acpi-dsdt-cpu-hotplug.dsl b/hw/i386/acpi-dsdt-cpu-hotplug.dsl index 9739191..fb75eda 100644 --- a/hw/i386/acpi-dsdt-cpu-hotplug.dsl +++ b/hw/i386/acpi-dsdt-cpu-hotplug.dsl @@ -24,18 +24,6 @@ Scope(\_SB) { External(PRS, FieldUnitObj) /* Methods called by run-time generated SSDT Processor objects */ - Method(CPST, 1, NotSerialized) { - // _STA method - return ON status of cpu - // Arg0 = Processor ID = Local APIC ID - // Local0 = CPON flag for this cpu - Store(DerefOf(Index(CPON, Arg0)), Local0) - If (Local0) { - Return (0xF) - } Else { - Return (0x0) - } - } - Method(PRSC, 0) { // Local5 = active cpu bitmap Store(PRS, Local5) diff --git a/include/hw/acpi/cpu_hotplug.h b/include/hw/acpi/cpu_hotplug.h index 40b9316..0755dd3 100644 --- a/include/hw/acpi/cpu_hotplug.h +++ b/include/hw/acpi/cpu_hotplug.h @@ -30,6 +30,7 @@ void acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner, #define CPU_EJECT_METHOD "CPEJ" #define CPU_MAT_METHOD "CPMA" #define CPU_ON_BITMAP "CPON" +#define CPU_STATUS_METHOD "CPST" void build_cpu_hotplug_aml(Aml *ctx); #endif