From patchwork Thu Mar 3 10:44:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liang Li X-Patchwork-Id: 8491161 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7A025C0553 for ; Thu, 3 Mar 2016 10:52:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A6F64201BB for ; Thu, 3 Mar 2016 10:52:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C0194201CE for ; Thu, 3 Mar 2016 10:52:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757389AbcCCKum (ORCPT ); Thu, 3 Mar 2016 05:50:42 -0500 Received: from mga09.intel.com ([134.134.136.24]:46996 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757365AbcCCKuk (ORCPT ); Thu, 3 Mar 2016 05:50:40 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 03 Mar 2016 02:50:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,532,1449561600"; d="scan'208";a="915990352" Received: from ll.sh.intel.com (HELO localhost) ([10.239.13.27]) by fmsmga001.fm.intel.com with ESMTP; 03 Mar 2016 02:50:38 -0800 From: Liang Li To: quintela@redhat.com, amit.shah@redhat.com, qemu-devel@nongnu.org, linux-kernel@vger.kernel.org Cc: mst@redhat.com, akpm@linux-foundation.org, pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com, linux-mm@kvack.org, virtualization@lists.linux-foundation.org, kvm@vger.kernel.org, dgilbert@redhat.com, Liang Li Subject: [RFC qemu 1/4] pc: Add code to get the lowmem form PCMachineState Date: Thu, 3 Mar 2016 18:44:25 +0800 Message-Id: <1457001868-15949-2-git-send-email-liang.z.li@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1457001868-15949-1-git-send-email-liang.z.li@intel.com> References: <1457001868-15949-1-git-send-email-liang.z.li@intel.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The lowmem will be used by the following patch to get a correct free pages bitmap. Signed-off-by: Liang Li --- hw/i386/pc.c | 5 +++++ hw/i386/pc_piix.c | 1 + hw/i386/pc_q35.c | 1 + include/hw/i386/pc.h | 3 ++- 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 0aeefd2..f794a84 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1115,6 +1115,11 @@ void pc_hot_add_cpu(const int64_t id, Error **errp) object_unref(OBJECT(cpu)); } +ram_addr_t pc_get_lowmem(PCMachineState *pcms) +{ + return pcms->lowmem; +} + void pc_cpus_init(PCMachineState *pcms) { int i; diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 6f8c2cd..268a08c 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -113,6 +113,7 @@ static void pc_init1(MachineState *machine, } } + pcms->lowmem = lowmem; if (machine->ram_size >= lowmem) { pcms->above_4g_mem_size = machine->ram_size - lowmem; pcms->below_4g_mem_size = lowmem; diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 46522c9..8d9bd39 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -101,6 +101,7 @@ static void pc_q35_init(MachineState *machine) } } + pcms->lowmem = lowmem; if (machine->ram_size >= lowmem) { pcms->above_4g_mem_size = machine->ram_size - lowmem; pcms->below_4g_mem_size = lowmem; diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 8b3546e..3694c91 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -60,7 +60,7 @@ struct PCMachineState { bool nvdimm; /* RAM information (sizes, addresses, configuration): */ - ram_addr_t below_4g_mem_size, above_4g_mem_size; + ram_addr_t below_4g_mem_size, above_4g_mem_size, lowmem; /* CPU and apic information: */ bool apic_xrupt_override; @@ -229,6 +229,7 @@ void pc_hot_add_cpu(const int64_t id, Error **errp); void pc_acpi_init(const char *default_dsdt); void pc_guest_info_init(PCMachineState *pcms); +ram_addr_t pc_get_lowmem(PCMachineState *pcms); #define PCI_HOST_PROP_PCI_HOLE_START "pci-hole-start" #define PCI_HOST_PROP_PCI_HOLE_END "pci-hole-end"