From patchwork Thu Apr 11 07:17:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 10895167 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A52771669 for ; Thu, 11 Apr 2019 07:19:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 893DF28C0F for ; Thu, 11 Apr 2019 07:19:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7CECA28C2F; Thu, 11 Apr 2019 07:19:06 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 17ADB28C0F for ; Thu, 11 Apr 2019 07:19:05 +0000 (UTC) Received: from localhost ([127.0.0.1]:43029 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hETzE-0002Um-BR for patchwork-qemu-devel@patchwork.kernel.org; Thu, 11 Apr 2019 03:19:04 -0400 Received: from eggs.gnu.org ([209.51.188.92]:37710) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hETyG-0001oj-RP for qemu-devel@nongnu.org; Thu, 11 Apr 2019 03:18:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hETyF-0005U6-Ut for qemu-devel@nongnu.org; Thu, 11 Apr 2019 03:18:04 -0400 Received: from mga01.intel.com ([192.55.52.88]:47561) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hETyF-0005T4-Ki for qemu-devel@nongnu.org; Thu, 11 Apr 2019 03:18:03 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Apr 2019 00:18:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,336,1549958400"; d="scan'208";a="222497725" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by orsmga001.jf.intel.com with ESMTP; 11 Apr 2019 00:17:59 -0700 From: Wei Yang To: qemu-devel@nongnu.org Date: Thu, 11 Apr 2019 15:17:39 +0800 Message-Id: <20190411071739.22889-1-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 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] hw/i386/pc: check apci hotplug capability before nvdimm's 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: pbonzini@redhat.com, thuth@redhat.com, Wei Yang , ehabkost@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP pc_memory_pre_plug() is called during hotplug for both pc-dimm and nvdimm. This is more proper to check apci hotplug capability before check nvdimm specific capability. Signed-off-by: Wei Yang Tested-by: Thomas Huth --- hw/i386/pc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index f2c15bf1f2..d48b6f9582 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -2091,17 +2091,17 @@ static void pc_memory_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev, return; } - if (is_nvdimm && !ms->nvdimms_state->is_enabled) { - error_setg(errp, "nvdimm is not enabled: missing 'nvdimm' in '-M'"); - return; - } - hotplug_handler_pre_plug(pcms->acpi_dev, dev, &local_err); if (local_err) { error_propagate(errp, local_err); return; } + if (is_nvdimm && !ms->nvdimms_state->is_enabled) { + error_setg(errp, "nvdimm is not enabled: missing 'nvdimm' in '-M'"); + return; + } + pc_dimm_pre_plug(PC_DIMM(dev), MACHINE(hotplug_dev), pcmc->enforce_aligned_dimm ? NULL : &legacy_align, errp); }