From nobody Tue Oct 28 02:08:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1516112972454972.5581027132574; Tue, 16 Jan 2018 06:29:32 -0800 (PST) Received: from localhost ([::1]:39132 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebSEy-000440-4c for importer@patchew.org; Tue, 16 Jan 2018 09:29:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50033) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebS3d-0002XX-8V for qemu-devel@nongnu.org; Tue, 16 Jan 2018 09:17:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ebS3c-0004QZ-2o for qemu-devel@nongnu.org; Tue, 16 Jan 2018 09:17:45 -0500 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:41869) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ebS3b-0004QL-Sd for qemu-devel@nongnu.org; Tue, 16 Jan 2018 09:17:44 -0500 Received: by mail-wm0-x243.google.com with SMTP id f71so8699289wmf.0 for ; Tue, 16 Jan 2018 06:17:43 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-229-84.clienti.tiscali.it. [78.12.229.84]) by smtp.gmail.com with ESMTPSA id u10sm1537758wrg.6.2018.01.16.06.17.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jan 2018 06:17:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=WuIGzw7hBamMo8s4pHysTbueWGCHrcegxv2oW6BJiuA=; b=sxbzEn+TtoGnZ+ecM+CGlfMBS4ZRWK7FZ7sLfrUk61czGmgMKUr5i27xMUwt31AlZJ /CXJEZbbuw2q38ZjlN/2ckidV7p9nLPaRPCPOkq5D02rUpe1nvLO6BAxwX76X+RIdSqm zuN0nMbPTSulnA8OVwtn1ySk0EsAfSKFbPWDZQVrLLqAc19rRZQb3m6teN634L3P4Md3 hs/QDhUJ+1Gp3IoNSrTrki7dIrD9zzvuUYrMddb6WaYi62HJbUw1x4olIr8/t75H8upi ihPgOio5VKumgBFrSIvVP75we/xu7m3S+a+WZavnem1ruKBA1KlGadg+EaW1/3y/D3ln fkLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=WuIGzw7hBamMo8s4pHysTbueWGCHrcegxv2oW6BJiuA=; b=DLginTaHWlFyQBOPq3XS1yx1BtzARyWfxMBhyXFXfLP9oJRDK9Ibgz0Hs8dJXX1nbw DsPL0yQz9bbq0fjmuB45ID9P0uSnIiidl/Htv7DiYhNWkG9ogEvrKxwqOs9zXwCPv/IX rqQYyXbbZP4aDtjC3rxSzCgzsJ93tkHAs990l59m4nTgIWqmEP62Nlq+Vrw0gJWTh3n+ 3sHDqrF7RYId2mJ6aQoQs+5iVob10etzBorAZeQWZSt60PHo3nYVbeInf2JBLpC0V3PE rSvSNXoprrF682+1loUOdJAsu47LPlGBpxvkwz1hPppn5CVMA0/r7sY4/q/24yRd+Aa1 mIlg== X-Gm-Message-State: AKwxytczhZv89fDzGaKqDmV+ScPyEqQ/eft+xoFqeqrTal7/LhlCu9eI SVgwSyL0EE8ZRPgnKdaad/ii1Cxu X-Google-Smtp-Source: ACJfBouA+e6xd494nTKo/XwjpmQa1hs+WFIc1WNlL0rG9WjSZHyWFqnMbbPE7beKiujGCvE1Wy4pmw== X-Received: by 10.28.191.135 with SMTP id o7mr13097386wmi.143.1516112262546; Tue, 16 Jan 2018 06:17:42 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 16 Jan 2018 15:16:45 +0100 Message-Id: <1516112253-14480-4-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516112253-14480-1-git-send-email-pbonzini@redhat.com> References: <1516112253-14480-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PULL 03/51] pc: fail memory hot-plug/unplug with -no-acpi and Q35 machine type 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 Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Haozhong Zhang When -no-acpi option is used with Q35 machine type, no guest ACPI is built, but the ACPI device is still created, so only checking the presence of ACPI device before memory plug/unplug is not enough in such cases. Check whether ACPI is disabled globally in addition and fail memory plug/unplug if it's disabled. Signed-off-by: Haozhong Zhang Message-Id: <20171222015120.31730-1-haozhong.zhang@intel.com> Reviewed-by: Igor Mammedov Signed-off-by: Paolo Bonzini --- hw/i386/pc.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 3fcf318..55686bf 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1695,9 +1695,14 @@ static void pc_dimm_plug(HotplugHandler *hotplug_dev, align =3D memory_region_get_alignment(mr); } =20 - if (!pcms->acpi_dev) { + /* + * When -no-acpi is used with Q35 machine type, no ACPI is built, + * but pcms->acpi_dev is still created. Check !acpi_enabled in + * addition to cover this case. + */ + if (!pcms->acpi_dev || !acpi_enabled) { error_setg(&local_err, - "memory hotplug is not enabled: missing acpi device"); + "memory hotplug is not enabled: missing acpi device or = acpi disabled"); goto out; } =20 @@ -1729,9 +1734,14 @@ static void pc_dimm_unplug_request(HotplugHandler *h= otplug_dev, Error *local_err =3D NULL; PCMachineState *pcms =3D PC_MACHINE(hotplug_dev); =20 - if (!pcms->acpi_dev) { + /* + * When -no-acpi is used with Q35 machine type, no ACPI is built, + * but pcms->acpi_dev is still created. Check !acpi_enabled in + * addition to cover this case. + */ + if (!pcms->acpi_dev || !acpi_enabled) { error_setg(&local_err, - "memory hotplug is not enabled: missing acpi device"); + "memory hotplug is not enabled: missing acpi device or = acpi disabled"); goto out; } =20 --=20 1.8.3.1