From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) (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 709E5282F1D for ; Fri, 3 Apr 2026 23:07:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775257665; cv=none; b=REoQDlbsC4rvoWs9CKm4HasH7scuhsYwWzNFA+gGudULnhJwifAqkH2J16erEIgB72DaBaB7u61Wvf/JHaUuHJWHF76gesnmBKGdzhS59KLH+KDnhiyZs+PLoqAZevDZt72NQJ4/bFEFFd5RT1vDDn/xe++sr5TUCfXR2jh89jI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775257665; c=relaxed/simple; bh=QFw0rrC9aSRV2WEJT8WSxFXaANoNrpSU9ltrBzCF5KU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Cm6V90kHjqPVwuR8fHu75SyK0BZByOdpvsHX6uXmhjomXBqti0sf+FHekvHTnPjsUGBbrpkuoTANueWJLK3/x9S9gV57ZD1s6MSoxhScby6si4EqRHI1zCRYlvo/ll3v7Gz0wv/b5USrqPrxjqzSZKtjLe6T6Ugy7jUVg+NtyWk= 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=PCGinfKA; arc=none smtp.client-ip=209.85.210.202 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="PCGinfKA" Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-82c89d4ce16so1415713b3a.2 for ; Fri, 03 Apr 2026 16:07:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1775257664; x=1775862464; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=Hyvj5kBMSuNn+SZot72GWuwcDIHZb7QGlMIx1bfcdhA=; b=PCGinfKAygOkkUXf+DY3y087qTEWqrFKxAXmXE6FLgGHVE30kP6BYJ2yCWv4wwKRC1 Zwqq8fhu/MtrCSuZM8FZI4fW1Rklj9zbKCOtM1zXpYMcAKpIjl2Ura1+lw+LYzdClvBP Kuqj985YIhOxJ9DHA/peUFZE2F7aXQwo5mk7/0qOzen2Is6t8PY6OQj1DXPc80Rd+IBB 6VG1MdBC8/YCedky63Npj8Z9cAbhAuIQO+e/k0XhDd4d3xcFMDXmyuUlKJ02Y2xTF/Ft cu7uQ4UpPG05TXHKX7sS13MUd3XGX8EXSgurJK/DqAszzZzmQIpwkE2I/AE3ie+8ugBi lQ7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775257664; x=1775862464; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=Hyvj5kBMSuNn+SZot72GWuwcDIHZb7QGlMIx1bfcdhA=; b=LfvKZDOmO6KEj2lSzTXFKtGQIr+dT0/UD9woDgxapkQooBg+Tz55wAidi79IZDH5QC YjQAOOFBnVQKOYWnoMMxXUTpIhwuv9/eEBOcitwwntRQTpK1ZF/dvVUzfELdWK6esgtZ ly4hGOkjzUhgHsCQziRkahk5KBzqf+8Gnszj44p08dkxQOFuaJAVPyG7CzOpHmspJEf1 +O0OAteXXyoVqg7MXVrh6jgDz5z49p8JrMag3MHj+Jn59URzakNyBMtxQEcpXhMtoc9m 5KAvYcUmEfk7KJtIVfZW97Bkka8OjgC3PTmLxc0HxGufWehRkLr/x5osrV26BiG9Sk5u Wf0Q== X-Forwarded-Encrypted: i=1; AJvYcCUCMpaDz2nORADZ9QFXbqsY8io71ZTO3aPYLSQECkDqs+qWSJpcjOnQxU/524wh7rIlhyqWoKusDbKT4Pc=@vger.kernel.org X-Gm-Message-State: AOJu0Yzh0h16pXRFRQgghef9VpRKZEAvlIDJEeWFlbAQdw4kbouXnqsA hUB3EXeSKOqEgfWkUKi7NvRnKtucAQHUr0iv0uX58PqcD/8yuVfYkBlwJJXLh5yefQdrp0uu/Cd OCzBlFA== X-Received: from pfra8.prod.google.com ([2002:aa7:8e88:0:b0:824:ada9:ae89]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:1a89:b0:823:3079:7c7 with SMTP id d2e1a72fcca58-82d0db6bb43mr4629830b3a.29.1775257663390; Fri, 03 Apr 2026 16:07:43 -0700 (PDT) Date: Fri, 3 Apr 2026 16:07:41 -0700 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260318190111.1041924-1-dmaluka@chromium.org> <94b06319-2be8-4f01-87d1-8989ae1ca85d@intel.com> <93358559-5ed1-4574-8951-24d7ea9354e4@intel.com> <401db97a254b356ad8539a5d637d68ee826179a5.camel@intel.com> Message-ID: Subject: Re: [PATCH] KVM: TDX: Fix APIC MSR ranges in tdx_has_emulated_msr() From: Sean Christopherson To: Rick P Edgecombe Cc: "linux-coco@lists.linux.dev" , Dave Hansen , "dmaluka@chromium.org" , "bp@alien8.de" , "kas@kernel.org" , "x86@kernel.org" , "binbin.wu@linux.intel.com" , "linux-kernel@vger.kernel.org" , "dave.hansen@linux.intel.com" , "tglx@kernel.org" , "kvm@vger.kernel.org" , "hpa@zytor.com" , "pbonzini@redhat.com" , "mingo@redhat.com" , Isaku Yamahata Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Fri, Apr 03, 2026, Rick P Edgecombe wrote: > On Fri, 2026-04-03 at 12:07 -0700, Sean Christopherson wrote: > > > > No?=C2=A0 Don't we just want to allow access to MSRs that aren't ac= celerated?=C2=A0 > > > > What the TDX-Module supports is largely irrelevant, I think. > > >=20 > > > Not sure if I might be missing the point here. As above, we don't hav= e > > > enough info to=C2=A0know which MSRs are accelerated. If the guest ena= bled #VE > > > reduction, it changes which ones are accelerated and the VMM is not > > > notified. > >=20 > > What does the "accleration" in that case?=C2=A0 Or does it reduce which= ones are > > accelerated? >=20 > I mean ones where wrmsr is handled by the TDX module instead of generatin= g a #VE > that gets morphed into TDVMCALL by the guest. Actually usually called "na= tive", > but I just reused your "accelerated" term from the mail. It's neither. Precision matters here, otherwise I can't follow along. Acc= elerated means the CPU virtualizes it without software involvement. Native would me= an the guest has direct access to bare metal hardware. IIUC, what's happening her= e is that the TDX-Module is emulating x2APIC stuff. > So... "Reduced #VE" (also called "VE reduction") reduces which things cau= se a > #VE. The guest opts into it and the TDX module starts behaving differentl= y. It's > kind of grab bag of changes including changing CPUID behavior, which is a= nother > wrinkle. It was intended to fixup guest side TDX arch issues. And KVM has no visilibity into which mode the guest has selected? That's a= wful. If KVM has no visiblity, then I don't see an option other than for KVM to a= dvertise and emulate what it can at all times, and it becomes the guest's responsibi= lity to not screw up. I guess it's not really any different from not trying to = use MMIO accesses after switching to x2APIC mode.