From nobody Tue Nov 26 15:43:00 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; 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=pass(p=none dis=none) header.from=linux.intel.com ARC-Seal: i=1; a=rsa-sha256; t=1706951936; cv=none; d=zohomail.com; s=zohoarc; b=gjhSzebQn5oAJZHdmQbNbohfxT5XYCjiLq3zQYGyz+v1IGN9MpiuLZDhQ2rh+H90e6op35ZvoT8Bgj6DyV5BNcohDNFZrDFQa2va3YeBvni29qPFUtGeRuXPzTCvO5fN3SWDHRTH6RGePOp6TuhM/Kfz0h/qE8VYLCTQd0c+C3Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706951936; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=gfQ3iEhAWH+VFpAxvzhRJRAbSykIh1BswiSWQXT9SvA=; b=lO07z4omKM1m7kNhhHcAZZQxpDJfYPZXnidHbTo4qsnfXjfsEw2R99t3ZwkZc9t65NyeDw4733+yPxG2O82NrSmxm6QDIAgLwVDlK84ri5QWY0qikjTnxMBYSUWRAnmIszz5U4PapYE0THUxD2SWLkFV/O2jG4MdY8UyPu6DTdo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706951936634796.7208082330245; Sat, 3 Feb 2024 01:18:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rWC9c-0006FF-Qa; Sat, 03 Feb 2024 04:17:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rWC9a-0006Ea-Rw for qemu-devel@nongnu.org; Sat, 03 Feb 2024 04:17:38 -0500 Received: from mgamail.intel.com ([198.175.65.20]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rWC9Z-0001VV-2p for qemu-devel@nongnu.org; Sat, 03 Feb 2024 04:17:38 -0500 Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2024 01:17:36 -0800 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by fmviesa001.fm.intel.com with ESMTP; 03 Feb 2024 01:17:34 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706951857; x=1738487857; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Qw/YbJpx31Y4rkwPhKpfzP6ZtmWqCYJuII8bNQ2v5T0=; b=LWkqzO0xrA6ivYL/QuknokXIQo/NSwdVDKBdHlC+326QrvkI22MTx0rt wR/adBB9qsv45JpoaPn98nu0WD0zzsHclv4isSTj/KnQP80W/1Y5jyUng v+NRiRzKQ7Gqdzxrq/0M9tx7Ibz2zl6kIJyDFYZXo04frqDWq9XUwDIYU rE/180WzRCrlGSwdIr6wNES3gNN6XQmJPa9Mko3W9QEX/v22Hs8LsuPEc 9hPzIYIDadc4SDqRRaLKezOUZftpGZvXoGkBxldHOhnx4BhL+1hU0LmbV MU+p66Y3wGbzXb/l3Z7eUdimJWiHVgVZRCPzcICQuUkWBWt+HPM2kt7ev w==; X-IronPort-AV: E=McAfee;i="6600,9927,10971"; a="216371" X-IronPort-AV: E=Sophos;i="6.05,240,1701158400"; d="scan'208";a="216371" X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,240,1701158400"; d="scan'208";a="31379008" From: Zhao Liu To: Paolo Bonzini , Marcelo Tosatti , qemu-devel@nongnu.org, kvm@vger.kernel.org Cc: Zhenyu Wang , Zhuocheng Ding , Dapeng Mi , Yanting Jiang , Yongwei Ma , Zhao Liu Subject: [RFC 4/6] target/i386: Add support for Intel Thread Director feature Date: Sat, 3 Feb 2024 17:30:52 +0800 Message-Id: <20240203093054.412135-5-zhao1.liu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240203093054.412135-1-zhao1.liu@linux.intel.com> References: <20240203093054.412135-1-zhao1.liu@linux.intel.com> MIME-Version: 1.0 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: none client-ip=198.175.65.20; envelope-from=zhao1.liu@linux.intel.com; helo=mgamail.intel.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.276, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1706951938599100005 Content-Type: text/plain; charset="utf-8" From: Zhao Liu Intel Thread Director (ITD) is the extension of HFI, and it extends the HFI to provide performance and energy efficiency data for advanced classes of instructions [1]. From Alder Lake, Intel's client products support ITD, and this feature can be used in VM to optimize scheduling on hybrid architectures. Like HFI, ITD virtualization also has the same topology limitations (only 1 die and 1 socket) because ITD's virtualization support is based on HFI. In order to avoid potential contention problems caused by multiple virtual-packages/dies, add the following restrictions to the ITD feature bit: 1. Mark ITD as no_autoenable_flags and it won't be enabled by default. 2. ITD can't be enabled for the case with multiple packages/dies. ITD feature depends on HFI, so also add its dependency. [1]: SDM, vol. 3B, section 15.6 HARDWARE FEEDBACK INTERFACE AND INTEL THREAD DIRECTOR Tested-by: Yanting Jiang Co-developed-by: Zhuocheng Ding Signed-off-by: Zhuocheng Ding Signed-off-by: Zhao Liu --- target/i386/cpu.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index e3eb361436c9..55287d0a3e73 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1118,17 +1118,18 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = =3D { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "hfi", - NULL, NULL, NULL, NULL, + NULL, NULL, NULL, "itd", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, }, .cpuid =3D { .eax =3D 6, .reg =3D R_EAX, }, .tcg_features =3D TCG_6_EAX_FEATURES, /* - * PTS and HFI shouldn't be enabled by default since they have + * PTS, HFI and ITD shouldn't be enabled by default since they have * requirement for cpu topology. */ - .no_autoenable_flags =3D CPUID_6_EAX_PTS | CPUID_6_EAX_HFI, + .no_autoenable_flags =3D CPUID_6_EAX_PTS | CPUID_6_EAX_HFI | + CPUID_6_EAX_ITD, }, [FEAT_XSAVE_XCR0_LO] =3D { .type =3D CPUID_FEATURE_WORD, @@ -1569,6 +1570,10 @@ static FeatureDep feature_dependencies[] =3D { .from =3D { FEAT_6_EAX, CPUID_6_EAX_PTS }, .to =3D { FEAT_6_EAX, CPUID_6_EAX_HFI }, }, + { + .from =3D { FEAT_6_EAX, CPUID_6_EAX_HFI }, + .to =3D { FEAT_6_EAX, CPUID_6_EAX_ITD }, + }, }; =20 typedef struct X86RegisterInfo32 { @@ -7468,10 +7473,10 @@ static void x86_cpu_realizefn(DeviceState *dev, Err= or **errp) return; } =20 - if (env->features[FEAT_6_EAX] & CPUID_6_EAX_HFI && + if (env->features[FEAT_6_EAX] & (CPUID_6_EAX_HFI | CPUID_6_EAX_ITD) && (ms->smp.dies > 1 || ms->smp.sockets > 1)) { error_setg(errp, - "HFI currently only supports die/package, " + "HFI/ITD currently only supports die/package, " "please set by \"-smp ...,sockets=3D1,dies=3D1\""); return; } --=20 2.34.1