From nobody Mon Feb 9 02:28:22 2026 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=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1769642320; cv=none; d=zohomail.com; s=zohoarc; b=hsAdRaP5WTJkTlBy2y9sjA2shNRVNGXtyyVpml1vL6uH36/orkHJ397aHOHezh/FBtaf2MeNn53tN6EHwq9Pd/0zKQQkOxsMZIjZGSdSW487yJJUEuBpLptKRJS6fXijoLgfLS/j4TesJgbfEuXAOtndC9neIhGLimWYWyPp/l0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769642320; 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=avyJprNhXQnLQptD9Ig29wh5jYySTbjYbobNMiJa6bQ=; b=gPFtUdkMX/FZYk4kizxcwzgGnX3IO4CA3NUlC4VxvP6K1391wu+l8BoEB3dJs61O8xMdTtQOWN9AS1Aj9wBcz4OJ5vzxdaGSoQJbJfviSND4wIBhWqWyEN8wV9OIej6juyWvfmCB8kz8I7UCJyOi2CranLQoJbzx4kw1Q4vHrhY= 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 176964232042994.14441193708512; Wed, 28 Jan 2026 15:18:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vlEnB-0008Ke-QV; Wed, 28 Jan 2026 18:17:45 -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 1vlEnA-0008J8-VL for qemu-devel@nongnu.org; Wed, 28 Jan 2026 18:17:44 -0500 Received: from mgamail.intel.com ([192.198.163.13]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vlEn8-0001ir-6H for qemu-devel@nongnu.org; Wed, 28 Jan 2026 18:17:44 -0500 Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jan 2026 15:17:37 -0800 Received: from 9cc2c43eec6b.jf.intel.com ([10.54.77.43]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jan 2026 15:17:36 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1769642262; x=1801178262; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cDOJd1yKGHPrdejhdewjiE4LxByY8+m66Yja9TVYMFo=; b=CFDKwq0mB75hASA+uPM/o15X6VsjRMsLIhXtpApoQ6BRYEMBpYhANBFf JuQTEKQu4fuB/wM90B4tEUihCuxveKmI8kbrKt6HoJ4Qj/p+V5pOBpOmX ZB2lcIbLxIofm4mGmtMoNY+uxnD4jMUvSqdiZ946PXxPoHHyGUCy0kJgR GVwCbecSaWntVZ/O9D2AQa1V//LEW8YUi/RzdypOxvOKITD17QgM2qfDx ZdZeuIpT466xeQxg+4ddqWJYTt2cJQdzl2c4FbkM5Kw/mginGGtByiJUW PeAGUCwq7PogYPmGRJ91HBPJjvRju4mEGGgrTM8B97/bVBRPgYmW0/eve Q==; X-CSE-ConnectionGUID: clOX/zQGSw+wNNT6AaZFzQ== X-CSE-MsgGUID: Qpm0qEpNRoSb8RZyvT/wGA== X-IronPort-AV: E=McAfee;i="6800,10657,11685"; a="73462310" X-IronPort-AV: E=Sophos;i="6.21,258,1763452800"; d="scan'208";a="73462310" X-CSE-ConnectionGUID: thiR9T5xQ02UQxzDyTEXYA== X-CSE-MsgGUID: BuWH7TluS5mABVm+PPRu5A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,258,1763452800"; d="scan'208";a="208001760" From: Zide Chen To: qemu-devel@nongnu.org, kvm@vger.kernel.org, Paolo Bonzini , Zhao Liu , Peter Xu , Fabiano Rosas Cc: Xiaoyao Li , Dongli Zhang , Dapeng Mi , Zide Chen Subject: [PATCH V2 01/11] target/i386: Disable unsupported BTS for guest Date: Wed, 28 Jan 2026 15:09:38 -0800 Message-ID: <20260128231003.268981-2-zide.chen@intel.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260128231003.268981-1-zide.chen@intel.com> References: <20260128231003.268981-1-zide.chen@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: pass client-ip=192.198.163.13; envelope-from=zide.chen@intel.com; helo=mgamail.intel.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, 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.29 Precedence: list List-Id: qemu development 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: 1769642322609154100 Content-Type: text/plain; charset="utf-8" BTS (Branch Trace Store), enumerated by IA32_MISC_ENABLE.BTS_UNAVAILABLE (bit 11), is deprecated and has been superseded by LBR and Intel PT. KVM yields control of the above mentioned bit to userspace since KVM commit 9fc222967a39 ("KVM: x86: Give host userspace full control of MSR_IA32_MISC_ENABLES"). However, QEMU does not set this bit, which allows guests to write the BTS and BTINT bits in IA32_DEBUGCTL. Since KVM doesn't support BTS, this may lead to unexpected MSR access errors. Signed-off-by: Zide Chen --- V2: - Address Dapeng's comments. - Remove mention of VMState version_id from the commit message. target/i386/cpu.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 2bbc977d9088..f02812bfd19f 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -474,8 +474,11 @@ typedef enum X86Seg { =20 #define MSR_IA32_MISC_ENABLE 0x1a0 /* Indicates good rep/movs microcode on some processors: */ -#define MSR_IA32_MISC_ENABLE_DEFAULT 1 +#define MSR_IA32_MISC_ENABLE_FASTSTRING (1ULL << 0) +#define MSR_IA32_MISC_ENABLE_BTS_UNAVAIL (1ULL << 11) #define MSR_IA32_MISC_ENABLE_MWAIT (1ULL << 18) +#define MSR_IA32_MISC_ENABLE_DEFAULT (MSR_IA32_MISC_ENABLE_FASTSTRING = |\ + MSR_IA32_MISC_ENABLE_BTS_UNAVAIL) =20 #define MSR_MTRRphysBase(reg) (0x200 + 2 * (reg)) #define MSR_MTRRphysMask(reg) (0x200 + 2 * (reg) + 1) --=20 2.52.0