From patchwork Thu Dec 7 10:18:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haozhong Zhang X-Patchwork-Id: 10098299 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 74EE160329 for ; Thu, 7 Dec 2017 10:27:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 646D22A1F1 for ; Thu, 7 Dec 2017 10:27:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 573242A1F8; Thu, 7 Dec 2017 10:27:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C92C02A1F1 for ; Thu, 7 Dec 2017 10:27:39 +0000 (UTC) Received: from localhost ([::1]:59882 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eMtP1-0005ko-2u for patchwork-qemu-devel@patchwork.kernel.org; Thu, 07 Dec 2017 05:27:39 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52149) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eMtGY-0005VG-Nh for qemu-devel@nongnu.org; Thu, 07 Dec 2017 05:18:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eMtGX-0003ee-LU for qemu-devel@nongnu.org; Thu, 07 Dec 2017 05:18:54 -0500 Received: from mga06.intel.com ([134.134.136.31]:34562) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eMtGX-000355-Bh for qemu-devel@nongnu.org; Thu, 07 Dec 2017 05:18:53 -0500 Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Dec 2017 02:18:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,372,1508828400"; d="scan'208";a="795753" Received: from hz-desktop.sh.intel.com (HELO localhost) ([10.239.159.142]) by orsmga007.jf.intel.com with ESMTP; 07 Dec 2017 02:18:50 -0800 From: Haozhong Zhang To: qemu-devel@nongnu.org, xen-devel@lists.xenproject.org Date: Thu, 7 Dec 2017 18:18:12 +0800 Message-Id: <20171207101812.23602-11-haozhong.zhang@intel.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171207101812.23602-1-haozhong.zhang@intel.com> References: <20171207101812.23602-1-haozhong.zhang@intel.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 134.134.136.31 Subject: [Qemu-devel] [RFC QEMU PATCH v4 10/10] xen-hvm: enable building NFIT and SSDT of vNVDIMM for HVM domains 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: Haozhong Zhang , Stefano Stabellini , Eduardo Habkost , Konrad Rzeszutek Wilk , "Michael S. Tsirkin" , Paolo Bonzini , Anthony Perard , Chao Peng , Dan Williams , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP When QEMU is used the device model of Xen HVM domain and vNVDIMM devices are present, enable building ACPI tables related to vNVDIMM. Signed-off-by: Haozhong Zhang --- Cc: Stefano Stabellini Cc: Anthony Perard Cc: "Michael S. Tsirkin" Cc: Paolo Bonzini Cc: Richard Henderson Cc: Eduardo Habkost --- hw/i386/xen/xen-hvm.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c index a7e99bd438..33447fc482 100644 --- a/hw/i386/xen/xen-hvm.c +++ b/hw/i386/xen/xen-hvm.c @@ -1236,6 +1236,11 @@ static void xen_wakeup_notifier(Notifier *notifier, void *data) xc_set_hvm_param(xen_xc, xen_domid, HVM_PARAM_ACPI_S_STATE, 0); } +static bool xen_dm_acpi_build_enabled(PCMachineState *pcms) +{ + return pcms->acpi_nvdimm_state.is_enabled; +} + static void xen_fw_cfg_init(PCMachineState *pcms) { FWCfgState *fw_cfg = fw_cfg_init_io(FW_CFG_IO_BASE); @@ -1392,8 +1397,7 @@ void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory) xen_be_register_common(); xen_read_physmap(state); - /* Disable ACPI build because Xen handles it */ - pcms->acpi_build_enabled = false; + pcms->acpi_build_enabled = xen_dm_acpi_build_enabled(pcms);; if (pcms->acpi_build_enabled) { xen_fw_cfg_init(pcms); } @@ -1486,6 +1490,11 @@ void xen_acpi_build(AcpiBuildTables *tables, GArray *table_offsets, return; } + if (pcms->acpi_nvdimm_state.is_enabled) { + nvdimm_build_acpi(table_offsets, tables_blob, tables->linker, + &pcms->acpi_nvdimm_state, machine->ram_slots); + } + /* * QEMU RSDP and RSDT are only used by hvmloader to enumerate * QEMU-built tables. HVM domains still use Xen-built RSDP and RSDT.