Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp160398lqe; Fri, 5 Apr 2024 16:57:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWo4nF1QyfE/ih8Jsi963P9HK8OT3k+BiVgv44oldiOYoy4NSpDOqDa0OlRO7etuP3gBunfpSkIawnY5EWDr9RFclTu70Z0Y3oCfxDfuQ== X-Google-Smtp-Source: AGHT+IF3g7x0np3XrVB985TjuZHpYi83H1Mj8tfW84Q3YNRMWjX0USozutq8OPlLz3RGbHCGQBqq X-Received: by 2002:a05:6871:520c:b0:22e:c19f:b616 with SMTP id ht12-20020a056871520c00b0022ec19fb616mr3340679oac.54.1712361445860; Fri, 05 Apr 2024 16:57:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712361445; cv=pass; d=google.com; s=arc-20160816; b=trijj5qEbjn1g/CjUpI3fdr9jeGqTEyp+2vzHqkG0HwTBIf7WgfoHpXsYccsjuGmbC dm3dQZ1zyQ042fPTVjwddcJnDD8pVlfHTOo3g0h7bQYMGYtJlxkuo1AM+abR4TNZY06u c/73j/vvHWS+ZVYUFStvDJeqmo2oPLgqgzEHgb+yE5B3QtJxs9CwIw8Q8P8nY0ErBqHK bjmG+ClbtHlPwYpV1cg9hyHSXmMJeF1iKpCSLxqtDvSycBZmRTqlUooecotozx38yjLd Q6Qf8I5dTuACywf3KzSHNnsjVg33zv9I3ztnjNt7TgcN5l4ecInoDNKDEebpEv4P6YQ6 ODAw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :reply-to:dkim-signature; bh=33EqBa4idiXBlKLk1bB/GrgkrHxm1+OWlCnF+mCuARU=; fh=j9+R2WN6ryuJ43orhFYAtTZtcmmoON5C/+0d3nF89VQ=; b=m0DgHqg9m+zNuyt5mVruFRPPN6BxS/YQDsw74CCazVtjKtQkJpyA3CydCxxoGgG1qq ZP/Zf9Hxn2qGDWQeFRxUhHOUo0CddR7WaDzZc5CeMv2aFup/YRSbzauH4P43zV9jlRxr X542wWqHmaNy8t4HTfR9UAkKXUj10zfaHWPP2XoBz8MrTuEnozT2B0OHuDBiIVzcDk86 5sSW5ZHVnt+T0oxL9bup7eX0XKW86aFUI84VyifMwnCW68fRyKkVYsAZlzwAspxJjTLB l7KXQYVwMcGKj7OIZApxicdOi12YyXe3TNJWECauvRt6dkIOMd5x1QF0Gk2+QWWTL0a3 tY+A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=YjM4qu6B; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-133713-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-133713-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id b189-20020a62cfc6000000b006e6a5a72271si2116072pfg.403.2024.04.05.16.57.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 16:57:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-133713-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=YjM4qu6B; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-133713-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-133713-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7D298283C26 for ; Fri, 5 Apr 2024 23:57:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 65AB350269; Fri, 5 Apr 2024 23:56:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="YjM4qu6B" Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1D1264AEF7 for ; Fri, 5 Apr 2024 23:56:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712361377; cv=none; b=oIsAsX3/3g0kLemJ4biaZInOLnhyVXSXApMW+fAFyHrTG1KWwWt1LQew1jvAKZzfUr3t/n5Fl/lFUMPJpP5aSjRCXecFXgJelkhc4WwfOva1n6qZF6TbwEFQsZMTlLW/DOSJjt/XUYHtmaQazdbnDZGAsyDxvgDwGDfH+Chk9+I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712361377; c=relaxed/simple; bh=torl8B7uqungrFtG8/K2MGtZpZ3nwc8GBWa8Ngm8w58=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=ESvN+zYtKER276kVYph6vxOkW39M9uKfXqZ+XP+M+xk9bC071TQEtgkW778PQnD7C6I+4oYSi3xr6WTrkn3cBVi9RQXTLbCLZJLefzf1qIZSEx3cTxziVVwdtt1jeOXobouJFx3fm/KzeCw2nFnd7KY8hrQxSB/hf7u+HpA7ESQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=YjM4qu6B; arc=none smtp.client-ip=209.85.215.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-5e4df21f22dso1864240a12.0 for ; Fri, 05 Apr 2024 16:56:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712361375; x=1712966175; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=33EqBa4idiXBlKLk1bB/GrgkrHxm1+OWlCnF+mCuARU=; b=YjM4qu6B/aBJINhFpoKfYsuPWqCMVqcrTH5fx8t4TMv9AdtFh+/Ypx0qNqXS+M5PtQ 5UGZxAmDheyelzx0x77277dHpSgHxQEIeVAkmuvRv2XRsSovDySxorN1UYqbcGhjruXx SNsyPz5GES0JqsBq7dThm+1PO+OS8Ud5Bw5Hjr8dEAtv1t5BdMO2Z4Anu4vymuwbMO3J GVZC2RqEdOuBbcH6yf0scaajChowARibphLngvTRO3es93MtS4KkL6Nm63hHoX7P94KC QwyHr3rY9hRrR+naFKU6FKaEtZ1uJEW2BaBsFnAdxFd9Z/2P0JvpVJN+4BGrUwH6H8rY FiTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712361375; x=1712966175; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=33EqBa4idiXBlKLk1bB/GrgkrHxm1+OWlCnF+mCuARU=; b=jvjRBRymKJ4WANVVilEXnQ/FfO/JHKxCgFd47qlMh+kBaFDKVqaMcFBv8pAPVLHP0I gzBWAijWKSyb5uIgwoQuSSRLc1D1Jimyej10nHYUyznP8Ld0WLd6TNs8uL9M8dMIdQ8Z tAd1+iuWe704ruiCvHPXZ9xrk2peB2FHOZOW4osfftUQHbNIzOGkb+fN74ec424BVOAM pwFhYfOIcTnePlnmhb98G9FwqA+UHrbjJKVDmYvJEqVxX5+256Ga5sMB79OrFe9aBBi5 HJkBp2l8UKLrFDYjseXXmSx7omurCb1GTQm63NFerTOn2METCRK0mrVyypEEKvDcX54M PHsg== X-Forwarded-Encrypted: i=1; AJvYcCWJ/Yrj7lc3xMGDx8fB3FdbcGwmiiwHqZT0Y4+ErLbaJJsB5n5gGOMN6P6FBTQKYPEzoHBMw+r5iPmZ4foyHeKcDvucMETuviWYxNf9 X-Gm-Message-State: AOJu0Yy3CmB59Yh7mpdkEVnaXEeO+/pUswGW7A50kGCSTqlNauBk4kEc Jio7GviXNsBd0QPgDJywww0KYt4XW+/zLLZZ5fB9hCSuZLWElNpP1JoZ9VX6/4iXhUbfUViHmv8 9Vw== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a65:6a50:0:b0:5e4:2b26:960a with SMTP id o16-20020a656a50000000b005e42b26960amr12959pgu.4.1712361375228; Fri, 05 Apr 2024 16:56:15 -0700 (PDT) Reply-To: Sean Christopherson Date: Fri, 5 Apr 2024 16:55:57 -0700 In-Reply-To: <20240405235603.1173076-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240405235603.1173076-1-seanjc@google.com> X-Mailer: git-send-email 2.44.0.478.gd926399ef9-goog Message-ID: <20240405235603.1173076-5-seanjc@google.com> Subject: [PATCH 04/10] KVM: x86: Apply Intel's TSC_AUX reserved-bit behavior to Intel compat vCPUs From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Sandipan Das , Jim Mattson , Like Xu Content-Type: text/plain; charset="UTF-8" Extend Intel's check on MSR_TSC_AUX[63:32] to all vCPU models that are Intel compatible, i.e. aren't AMD or Hygon in KVM's world, as the behavior is architectural, i.e. applies to any CPU that is compatible with Intel's architecture. Applying the behavior strictly to Intel wasn't intentional, KVM simply didn't have a concept of "Intel compatible" as of commit 61a05d444d2c ("KVM: x86: Tie Intel and AMD behavior for MSR_TSC_AUX to guest CPU model"). Signed-off-by: Sean Christopherson --- arch/x86/kvm/x86.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index ebcc12d1e1de..d9719141502a 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1883,11 +1883,11 @@ static int __kvm_set_msr(struct kvm_vcpu *vcpu, u32 index, u64 data, * incomplete and conflicting architectural behavior. Current * AMD CPUs completely ignore bits 63:32, i.e. they aren't * reserved and always read as zeros. Enforce Intel's reserved - * bits check if and only if the guest CPU is Intel, and clear - * the bits in all other cases. This ensures cross-vendor - * migration will provide consistent behavior for the guest. + * bits check if the guest CPU is Intel compatible, otherwise + * clear the bits. This ensures cross-vendor migration will + * provide consistent behavior for the guest. */ - if (guest_cpuid_is_intel(vcpu) && (data >> 32) != 0) + if (guest_cpuid_is_intel_compatible(vcpu) && (data >> 32) != 0) return 1; data = (u32)data; -- 2.44.0.478.gd926399ef9-goog