From patchwork Fri Jan 13 11:56:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haozhong Zhang X-Patchwork-Id: 9515355 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 1F01D6077E for ; Fri, 13 Jan 2017 11:57:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 129C6285CB for ; Fri, 13 Jan 2017 11:57:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 059E9285DA; Fri, 13 Jan 2017 11:57:31 +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 A2DA3285CB for ; Fri, 13 Jan 2017 11:57:30 +0000 (UTC) Received: from localhost ([::1]:40519 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cS0U5-0005H6-B7 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 13 Jan 2017 06:57:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53379) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cS0Tg-0005EK-4K for qemu-devel@nongnu.org; Fri, 13 Jan 2017 06:57:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cS0Td-000752-26 for qemu-devel@nongnu.org; Fri, 13 Jan 2017 06:57:04 -0500 Received: from mga14.intel.com ([192.55.52.115]:20839) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cS0Tc-00073h-PX for qemu-devel@nongnu.org; Fri, 13 Jan 2017 06:57:01 -0500 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP; 13 Jan 2017 03:56:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.33,221,1477983600"; d="scan'208"; a="1082543978" Received: from hz-desktop.sh.intel.com (HELO localhost) ([10.239.159.151]) by orsmga001.jf.intel.com with ESMTP; 13 Jan 2017 03:56:54 -0800 From: Haozhong Zhang To: qemu-devel@nongnu.org Date: Fri, 13 Jan 2017 19:56:51 +0800 Message-Id: <20170113115651.17607-1-haozhong.zhang@intel.com> X-Mailer: git-send-email 2.10.1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 192.55.52.115 Subject: [Qemu-devel] [PATCH] hw/i386: check if nvdimm is enabled before plugging 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 , Xiao Guangrong , Eduardo Habkost , "Michael S . Tsirkin" , Stefan Hajnoczi , imammedo@redhat.com, Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The missing of 'nvdimm' in the machine type option '-M' means NVDIMM is disabled. QEMU should refuse to plug any NVDIMM device in this case and report the misconfiguration. Reported-by: Stefan Hajnoczi Signed-off-by: Haozhong Zhang Message-Id: 20170112110928.GF4621@stefanha-x1.localdomain Message-Id: 20170111093630.2088-1-stefanha@redhat.com Reviewed-by: Xiao Guangrong Reviewed-by: Eduardo Habkost Reviewed-by: Stefan Hajnoczi --- hw/i386/pc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 25e8586..3907609 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1715,6 +1715,11 @@ static void pc_dimm_plug(HotplugHandler *hotplug_dev, } if (object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM)) { + if (!pcms->acpi_nvdimm_state.is_enabled) { + error_setg(&local_err, + "nvdimm is not enabled: missing 'nvdimm' in '-M'"); + goto out; + } nvdimm_plug(&pcms->acpi_nvdimm_state); }