From patchwork Sat Jan 9 21:40:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 565252 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 C09AA1401DE for ; Sun, 10 Jan 2016 08:52:27 +1100 (AEDT) Received: from localhost ([::1]:43338 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aI1Qv-00073M-Qh for incoming@patchwork.ozlabs.org; Sat, 09 Jan 2016 16:52:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35251) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aI1FG-00087J-49 for qemu-devel@nongnu.org; Sat, 09 Jan 2016 16:40:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aI1FE-00071L-Py for qemu-devel@nongnu.org; Sat, 09 Jan 2016 16:40:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57706) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aI1FE-00071F-J1 for qemu-devel@nongnu.org; Sat, 09 Jan 2016 16:40:20 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 369B0372505; Sat, 9 Jan 2016 21:40:20 +0000 (UTC) Received: from redhat.com (vpn1-5-155.ams2.redhat.com [10.36.5.155]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id u09LeHsw025706; Sat, 9 Jan 2016 16:40:18 -0500 Date: Sat, 9 Jan 2016 23:40:17 +0200 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <1452375528-16627-21-git-send-email-mst@redhat.com> References: <1452375528-16627-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1452375528-16627-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Peter Maydell , Richard Henderson , Paolo Bonzini , Eduardo Habkost , Igor Mammedov Subject: [Qemu-devel] [PULL v2 20/59] pc: acpi: cpuhp: move CPMA() 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 From: Igor Mammedov Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/acpi/cpu_hotplug.h | 2 ++ hw/acpi/cpu_hotplug_acpi_table.c | 23 +++++++++++++++++++++++ hw/i386/acpi-build.c | 5 +++-- hw/i386/acpi-dsdt-cpu-hotplug.dsl | 13 ------------- 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/include/hw/acpi/cpu_hotplug.h b/include/hw/acpi/cpu_hotplug.h index 87504be..40b9316 100644 --- a/include/hw/acpi/cpu_hotplug.h +++ b/include/hw/acpi/cpu_hotplug.h @@ -28,6 +28,8 @@ void acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner, AcpiCpuHotplug *gpe_cpu, uint16_t base); #define CPU_EJECT_METHOD "CPEJ" +#define CPU_MAT_METHOD "CPMA" +#define CPU_ON_BITMAP "CPON" void build_cpu_hotplug_aml(Aml *ctx); #endif diff --git a/hw/acpi/cpu_hotplug_acpi_table.c b/hw/acpi/cpu_hotplug_acpi_table.c index 422e57b..69c37fa 100644 --- a/hw/acpi/cpu_hotplug_acpi_table.c +++ b/hw/acpi/cpu_hotplug_acpi_table.c @@ -19,6 +19,29 @@ void build_cpu_hotplug_aml(Aml *ctx) { Aml *method; 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); + Aml *cpu_on = aml_local(0); + Aml *madt = aml_local(1); + Aml *cpus_map = aml_name(CPU_ON_BITMAP); + + /* + * _MAT method - creates an madt apic buffer + * cpu_id = Arg0 = Processor ID = Local APIC ID + * cpu_on = Local0 = CPON flag for this cpu + * madt = Local1 = Buffer (in madt apic form) to return + */ + method = aml_method(CPU_MAT_METHOD, 1, AML_NOTSERIALIZED); + aml_append(method, + aml_store(aml_derefof(aml_index(cpus_map, cpu_id)), cpu_on)); + aml_append(method, + aml_store(aml_buffer(sizeof(madt_tmpl), madt_tmpl), madt)); + /* Update the processor id, lapic id, and enable/disable status */ + aml_append(method, aml_store(cpu_id, aml_index(madt, aml_int(2)))); + aml_append(method, aml_store(cpu_id, aml_index(madt, aml_int(3)))); + aml_append(method, aml_store(cpu_on, aml_index(madt, aml_int(4)))); + aml_append(method, aml_return(madt)); + aml_append(sb_scope, method); method = aml_method(CPU_EJECT_METHOD, 2, AML_NOTSERIALIZED); aml_append(method, aml_sleep(200)); diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 53b2916..88299fa 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1318,7 +1318,8 @@ build_ssdt(GArray *table_data, GArray *linker, dev = aml_processor(i, 0, 0, "CP%.02X", i); method = aml_method("_MAT", 0, AML_NOTSERIALIZED); - aml_append(method, aml_return(aml_call1("CPMA", aml_int(i)))); + aml_append(method, + aml_return(aml_call1(CPU_MAT_METHOD, aml_int(i)))); aml_append(dev, method); method = aml_method("_STA", 0, AML_NOTSERIALIZED); @@ -1362,7 +1363,7 @@ build_ssdt(GArray *table_data, GArray *linker, uint8_t b = test_bit(i, cpu->found_cpus) ? 0x01 : 0x00; aml_append(pkg, aml_int(b)); } - aml_append(sb_scope, aml_name_decl("CPON", pkg)); + aml_append(sb_scope, aml_name_decl(CPU_ON_BITMAP, pkg)); build_memory_devices(sb_scope, nr_mem, pm->mem_hp_io_base, pm->mem_hp_io_len); diff --git a/hw/i386/acpi-dsdt-cpu-hotplug.dsl b/hw/i386/acpi-dsdt-cpu-hotplug.dsl index 18331be..9739191 100644 --- a/hw/i386/acpi-dsdt-cpu-hotplug.dsl +++ b/hw/i386/acpi-dsdt-cpu-hotplug.dsl @@ -24,19 +24,6 @@ Scope(\_SB) { External(PRS, FieldUnitObj) /* Methods called by run-time generated SSDT Processor objects */ - Method(CPMA, 1, NotSerialized) { - // _MAT method - create an madt apic buffer - // Arg0 = Processor ID = Local APIC ID - // Local0 = CPON flag for this cpu - Store(DerefOf(Index(CPON, Arg0)), Local0) - // Local1 = Buffer (in madt apic form) to return - Store(Buffer(8) {0x00, 0x08, 0x00, 0x00, 0x00, 0, 0, 0}, Local1) - // Update the processor id, lapic id, and enable/disable status - Store(Arg0, Index(Local1, 2)) - Store(Arg0, Index(Local1, 3)) - Store(Local0, Index(Local1, 4)) - Return (Local1) - } Method(CPST, 1, NotSerialized) { // _STA method - return ON status of cpu // Arg0 = Processor ID = Local APIC ID