From nobody Sat Nov 15 14:09:09 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1595254656; cv=none; d=zohomail.com; s=zohoarc; b=HBK1c5d887uL+rL6fvfCIXw0/u7M274QQ1M5B5k58xOBrW/FSwuhpcPEHkwu4DUGPliEUA1T/dUYp4QCvAxMw+t7V7FVDhqIeoF2NppFhv0yFdFf94CGGkLtTqoWMk87L65jI67T2VhMpzcGjLevmeBaKmQOUk6ydUhv8kQIpxw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595254656; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Z8ZPg0nYO+Sj177xvfTvuz/fKvcIMrndnYLifbp4Xqk=; b=Pg8W0NJgTddrhKAcdHcptP5qU+I4IBsp3DUpj63ZCmIxD+MBhZCkiHHBSwuKmQfdQ7BlSurSUYDMsc7krDsK7zLUY4Cdx0enNkkeBWD6Aqv/lzgNCCQjGFanPTf2DtpvnqXJJwyQBwdb88zs+/b8bRCR/wgWFUoO2CT+JO+l+t0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1595254656327407.1532365151211; Mon, 20 Jul 2020 07:17:36 -0700 (PDT) Received: from localhost ([::1]:43198 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jxWbn-0002ig-01 for importer@patchew.org; Mon, 20 Jul 2020 10:17:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57122) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jxWah-00015G-Uy for qemu-devel@nongnu.org; Mon, 20 Jul 2020 10:16:28 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:59991 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jxWaf-0002lx-Fl for qemu-devel@nongnu.org; Mon, 20 Jul 2020 10:16:27 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-154-JzTrSkiLOKq8JBVURoN6qw-1; Mon, 20 Jul 2020 10:16:20 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3E4D3107BF1A; Mon, 20 Jul 2020 14:16:14 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5D13C19C71; Mon, 20 Jul 2020 14:16:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595254584; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z8ZPg0nYO+Sj177xvfTvuz/fKvcIMrndnYLifbp4Xqk=; b=Auw/Lhj1m/niALYNpFqlQtfTwu+LjdjUM1nhObCrNZi8qpy7WR06E6T2a9OunOTE/PcG2m rx4jQ737YIiHNIFzIq0MlMFBpvQrrWo8IT9+ZHLiMf1U3B5cRqGT1C/l//JYYWc7SyeZKR 0AiK60cuzLg3mhyBbahQQdePJ5MLeVI= X-MC-Unique: JzTrSkiLOKq8JBVURoN6qw-1 From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH 1/6] x86: lpc9: let firmware negotiate 'CPU hotplug with SMI' features Date: Mon, 20 Jul 2020 10:16:05 -0400 Message-Id: <20200720141610.574308-2-imammedo@redhat.com> In-Reply-To: <20200720141610.574308-1-imammedo@redhat.com> References: <20200720141610.574308-1-imammedo@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=imammedo@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/20 02:16:39 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: boris.ostrovsky@oracle.com, lersek@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" It will allow firmware to notify QEMU that firmware requires SMI being triggered on CPU hot[un]plug, so that it would be able to account for hotplugged CPU and relocate it to new SMM base and/or safely remove CPU on unplug. Using negotiated features, follow up patches will insert SMI upcall into AML code, to make sure that firmware processes hotplug before guest OS would attempt to use new CPU. Signed-off-by: Igor Mammedov Reviewed-by: Laszlo Ersek --- include/hw/i386/ich9.h | 2 ++ hw/i386/pc.c | 5 ++++- hw/isa/lpc_ich9.c | 12 ++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/include/hw/i386/ich9.h b/include/hw/i386/ich9.h index a98d10b252..d1bb3f7bf0 100644 --- a/include/hw/i386/ich9.h +++ b/include/hw/i386/ich9.h @@ -247,5 +247,7 @@ typedef struct ICH9LPCState { =20 /* bit positions used in fw_cfg SMI feature negotiation */ #define ICH9_LPC_SMI_F_BROADCAST_BIT 0 +#define ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT 1 +#define ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT 2 =20 #endif /* HW_ICH9_H */ diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 3d419d5991..57d50fad6b 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -97,7 +97,10 @@ #include "fw_cfg.h" #include "trace.h" =20 -GlobalProperty pc_compat_5_0[] =3D {}; +GlobalProperty pc_compat_5_0[] =3D { + { "ICH9-LPC", "x-smi-cpu-hotplug", "off" }, + { "ICH9-LPC", "x-smi-cpu-hotunplug", "off" }, +}; const size_t pc_compat_5_0_len =3D G_N_ELEMENTS(pc_compat_5_0); =20 GlobalProperty pc_compat_4_2[] =3D { diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c index cd6e169d47..c9305080b5 100644 --- a/hw/isa/lpc_ich9.c +++ b/hw/isa/lpc_ich9.c @@ -373,6 +373,14 @@ static void smi_features_ok_callback(void *opaque) /* guest requests invalid features, leave @features_ok at zero */ return; } + if (!(guest_features & BIT_ULL(ICH9_LPC_SMI_F_BROADCAST_BIT)) && + guest_features & (BIT_ULL(ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT) | + BIT_ULL(ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT))) { + /* cpu hot-[un]plug with SMI requires SMI broadcast, + * leave @features_ok at zero + */ + return; + } =20 /* valid feature subset requested, lock it down, report success */ lpc->smi_negotiated_features =3D guest_features; @@ -747,6 +755,10 @@ static Property ich9_lpc_properties[] =3D { DEFINE_PROP_BOOL("noreboot", ICH9LPCState, pin_strap.spkr_hi, true), DEFINE_PROP_BIT64("x-smi-broadcast", ICH9LPCState, smi_host_features, ICH9_LPC_SMI_F_BROADCAST_BIT, true), + DEFINE_PROP_BIT64("x-smi-cpu-hotplug", ICH9LPCState, smi_host_features, + ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT, true), + DEFINE_PROP_BIT64("x-smi-cpu-hotunplug", ICH9LPCState, smi_host_featur= es, + ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT, true), DEFINE_PROP_END_OF_LIST(), }; =20 --=20 2.26.2