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 6330C3D7D71 for ; Wed, 15 Apr 2026 16:05:48 +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=1776269150; cv=none; b=JZIkiuZqBiJ6knfXUJ8+cyCr6IKHiDaTa9j1j25oEpnndEX6VMdtIgIG0jjJMHZr/ALU+tV9sf8ftBrnz7SBiWsjAAMAjmk09yRDjXhzJtodhguSNHk7S/bmivoTQ94VYmAbsH3xsP+Kr/7lT8r4hp/CxUtnNN/ckLK1hU5p72M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776269150; c=relaxed/simple; bh=qwrVZaJ8w0DVBNh7+BKEJThCgGURc6TMBDXjogqsrfE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=NlyAb6nWyT7+PLXlveQAmhaJVPiTjjSvH1DOQgbb8f6NufOT+vVx2nQDP59xCq5CuU60TFxyivd0hr3lYTb+C1t8c2ob8VZe72AH1wp3fTcG3WDjDLs2wsFVCXNZ6W3VKBYi0Q1Oww/cKrIt41eFjV10K0V0pboFqNywb6L+230= 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=m2PBR1Dz; 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="m2PBR1Dz" Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-82f74f0e3c6so118097b3a.0 for ; Wed, 15 Apr 2026 09:05:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1776269148; x=1776873948; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=5QuFTNdG7aougrYuvI/HIgSB8ZVaWwT1LWPyv1PRH9w=; b=m2PBR1DzeSOlBoeV9ZhPjjWn8ly8ILgL2dvMjMRq5oO7zU6/RdSyInb7u4UnaADp13 aGHVyIx+URT6fFvy25FDqAbRYkuMMcfjwZPIKmPz8MhYzciGUD1/IClzv8PsyNJEy8XE fPzpNaUP032QohYvdS+bPI6bDbc6c8cwYNggvK3kIGTfLLpSqDwTxXr8pPoGcMW4C80D CXbsq/G3Z5LKIo46KyxpvWf79ox4ZpbPOpo1l6JvZG6zINXY790jfrvUbtl/LKDDmyyr sqD3mhQbM34GbhJsf7AErkfks46JdSqSYEfbTzDThkEPIBV+KOnC3nt3ypV7AOlPAUMc UlCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776269148; x=1776873948; h=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=5QuFTNdG7aougrYuvI/HIgSB8ZVaWwT1LWPyv1PRH9w=; b=sRVL3FbNXg7tRh+0ju8i7hdPp6d49MWd7Yk7B9+i8I+ofDGJJqZMolwvx+7jPmX7ky HvXL9DbIYW1uXrs4zsxzxETAcj7RDCKisTpryPhx8Lsbc/E2RjRyn2wHqbPnx9AxbK9F n5hd1DZQAPBihTXNXEs1O5Zw8Fxb04C7W2OB5OfemxqfxzXQ5NAN7e+DWKnXT6rOa2Fs RkNI/kNElstFNcxb1LPDZ3qenZKpcN3gbPRaPDD7+BUpigBuQTynV0Qxn+OSX1dbSUp4 0MaSqViJ1MaHo883w4sDAisR3gMMEfrLoPxw+cfNJ/VOwJ40slRE9CAScRq8fVdZgtGH nvaQ== X-Forwarded-Encrypted: i=1; AFNElJ+EmZLDdgJKTg7RxaNolK0Q3NxE0jUmaWv/Hcw44nsH4Wk/lwtW7PoVxYG5CVAwRQVVpuiX/EG+r45cl/4=@vger.kernel.org X-Gm-Message-State: AOJu0YystDJTgTG6EA5I7AQY3hor4HugcBm6TPbr4NMU76UCL26A6jhl w6ieA/JiH8oI+U1PHv64e25BZkhIfgSETAg4Oye93c2tY2sYV7XFh4IBDwb/95c+VBGhw5bLbtv umUflIg== X-Received: from pfbdi7.prod.google.com ([2002:a05:6a00:4807:b0:82c:9c4b:469f]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:1bcd:b0:82c:24d5:63e6 with SMTP id d2e1a72fcca58-82f0c169049mr21219442b3a.15.1776269147434; Wed, 15 Apr 2026 09:05:47 -0700 (PDT) Date: Wed, 15 Apr 2026 09:05:45 -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: <20260409224236.2021562-1-seanjc@google.com> <20260409224236.2021562-6-seanjc@google.com> <95a931f8-42cc-4834-953c-30c9167bfdc1@intel.com> Message-ID: Subject: Re: [PATCH v2 5/6] KVM: x86: Track available/dirty register masks as "unsigned long" values From: Sean Christopherson To: Xiaoyao Li Cc: Kai Huang , Chang Seok Bae , "kvm@vger.kernel.org" , "pbonzini@redhat.com" , "kas@kernel.org" , "linux-kernel@vger.kernel.org" , "linux-coco@lists.linux.dev" , "x86@kernel.org" Content-Type: text/plain; charset="us-ascii" On Wed, Apr 15, 2026, Xiaoyao Li wrote: > On 4/15/2026 7:29 PM, Xiaoyao Li wrote: > > > Note that updating only the "available" masks is wrong, as TDX needs > > > to marshall written registers back to their correct location. > > > > In what case it needs to marshall written registers back? Can you > > elaborate? > > Sorry that I asked a silly question. I mistakenly thought TDVMCALL for > instructions (like, CPUID, RDMSR, WRMSR) use the same output register as the > x86 instructions. After checking the TDX GHCI, obviously I'm wrong. > > But I don't understand what's is wrong regarding "updating only the > "available" masks". Or what is missing for "marshall written registers back > to their correct location"? KVM would need to also update the "dirty" mask, so that TDX knows it (a) needs to propagate state back to the GHCI, and (b) that all registers it expects to be dirty are indeed marked dirty.