From patchwork Mon Oct 22 18:36:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Ortiz X-Patchwork-Id: 987865 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.intel.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42f5Gq6JsQz9sCs for ; Tue, 23 Oct 2018 05:52:03 +1100 (AEDT) Received: from localhost ([::1]:36673 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gEfJ3-0004Cd-CK for incoming@patchwork.ozlabs.org; Mon, 22 Oct 2018 14:52:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39637) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gEf6p-0001Js-2a for qemu-devel@nongnu.org; Mon, 22 Oct 2018 14:39:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gEf6f-0005JI-DC for qemu-devel@nongnu.org; Mon, 22 Oct 2018 14:39:18 -0400 Received: from mga01.intel.com ([192.55.52.88]:7889) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gEf6e-0004iw-WB for qemu-devel@nongnu.org; Mon, 22 Oct 2018 14:39:13 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Oct 2018 11:38:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,413,1534834800"; d="scan'208";a="90378073" Received: from omccarth-mobl.ger.corp.intel.com (HELO localhost.localdomain) ([10.252.18.99]) by FMSMGA003.fm.intel.com with ESMTP; 22 Oct 2018 11:38:50 -0700 From: Samuel Ortiz To: qemu-devel@nongnu.org Date: Mon, 22 Oct 2018 20:36:51 +0200 Message-Id: <20181022183656.4902-22-sameo@linux.intel.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181022183656.4902-1-sameo@linux.intel.com> References: <20181022183656.4902-1-sameo@linux.intel.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 192.55.52.88 Subject: [Qemu-devel] [PATCH 21/26] hw: acpi: reduced: Add memory hotplug support 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: Yang Zhong , Igor Mammedov , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Yang Zhong We add the memory hotplug AML code to the hardware-reduced DSDT. The memory hotplug event is handled through the GED device. Cc: "Michael S. Tsirkin" Cc: Igor Mammedov Signed-off-by: Yang Zhong --- hw/acpi/reduced.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/hw/acpi/reduced.c b/hw/acpi/reduced.c index 53b57760eb..33d413a255 100644 --- a/hw/acpi/reduced.c +++ b/hw/acpi/reduced.c @@ -33,6 +33,7 @@ #include "hw/acpi/cpu.h" #include "hw/acpi/pc-hotplug.h" #include "hw/acpi/reduced.h" +#include "hw/acpi/memory_hotplug.h" #include "hw/nvram/fw_cfg.h" @@ -46,7 +47,16 @@ #include "migration/vmstate.h" -#define GED_DEVICE "GED" +#define GED_DEVICE "GED" +#define CPU_SCAN_METHOD "CSCN" +#define MEMORY_SLOT_SCAN_METHOD "MSCN" + +static void acpi_dsdt_add_memory_hotplug(MachineState *ms, Aml *dsdt) +{ + uint32_t nr_mem = ms->ram_slots; + + build_memory_hotplug_aml(dsdt, nr_mem, "\\_SB", NULL); +} static void acpi_dsdt_add_cpus(MachineState *ms, Aml *dsdt, Aml *scope, int smp_cpus, AcpiConfiguration *conf) @@ -85,6 +95,7 @@ static void build_dsdt(MachineState *ms, if (pci_host->pci_bus) { acpi_dsdt_add_pci_bus(dsdt, pci_host); } + acpi_dsdt_add_memory_hotplug(ms, dsdt); acpi_dsdt_add_cpus(ms, dsdt, scope, smp_cpus, conf); acpi_dsdt_add_ged(dsdt, conf); aml_append(dsdt, scope); @@ -283,8 +294,6 @@ void acpi_reduced_setup(MachineState *machine, AcpiConfiguration *conf) acpi_build_tables_cleanup(&tables, false); } -#define CPU_SCAN_METHOD "CSCN" - static Aml *ged_event_aml(GedEvent *event) { if (!event) { @@ -296,6 +305,8 @@ static Aml *ged_event_aml(GedEvent *event) /* We run a complete CPU SCAN when getting a CPU hotplug event */ return aml_call0("\\_SB.CPUS." CPU_SCAN_METHOD); case GED_MEMORY_HOTPLUG: + /* We run a complete memory SCAN when getting a memory hotplug event */ + return aml_call0("\\_SB.MHPC." MEMORY_SLOT_SCAN_METHOD); case GED_PCI_HOTPLUG: case GED_NVDIMM_HOTPLUG: /* Not supported for now */