From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.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 953A63976BE for ; Tue, 3 Mar 2026 19:44:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772567057; cv=none; b=DzPjfFFrygzWdhBdQaL/FHnOTY9zLloW/r+bmIHRp3N/UALNzlg0ocEiksJp/RRscMD6W/8b2EKOgEVNcbyC1ypLqch5lo0OI76B1J2IASmN/I7W4J23hdpn7NW/PTBL/05G5EzD0RjGLN1nax5jjyfHmsmeg9xLfAdadDxsNuc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772567057; c=relaxed/simple; bh=4pso3iO729dZpcd/ENmTltLyuClEQkS5sXGDOONqMh4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=BpkGJuOI3ldtvVIbhk7yIZMAcsxZmISj7KjZbQCxiq2MLc+FUXWOzNtAab2nfWCebKS09qdGn55QTjQHQOtu+HmzQb0bN63IauTg6XFYji8fzZkBBmaOlUTegwwNH4swB9OfSXnLASnskKBpA5xqn8P0tCP1Zwpw0rHWIqT0FDs= 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=Rrf3kS9R; arc=none smtp.client-ip=209.85.214.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Rrf3kS9R" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-2adef9d486bso54166915ad.2 for ; Tue, 03 Mar 2026 11:44:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772567055; x=1773171855; 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=7H8zcNkOosHL5Qyyqu/2sQSqxUPrIKJPaqmDB4tPT+k=; b=Rrf3kS9RC0h+6Zwd6eUNe0f7J6eEG1Fdf1FjqIhBc1h+HYbvJbVkzm+YUpvCHCpr+w DqDvWVJ0Lss/uW3WEmxB2J+9FCl3yy0p/7f5+A/ivFgzHDt+WAoznbunLW9ShmP9uLMs 3ruO4mMvtZWihXCZys3A/z9wqpNcJVBHUvrO+voIR8o4LGsMG7y2O2b4cIK+2Uyalu8e FTycUq2+ufG3S3JxAbyKdkvwx9dYX8+2BhabUGD0Dt/VwyFY1eQQ07KnhIgWBf/qSXpz c8FFe/oqOq+jLB6gm8JqUdGHz40TwkRsQYEv1A5R77dGPJv0tZVA1G6+W+2GF+4BN1mL HFQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772567055; x=1773171855; 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=7H8zcNkOosHL5Qyyqu/2sQSqxUPrIKJPaqmDB4tPT+k=; b=Ex8lnnU5sd7DY4xCc38laORKL+uqWPToqDhQRHyTYxQmjrROUDbWrMfTDf/gDpniUR fUVTFmiclaEK+ZNlhrOxn7p6WmjKfcuvKP8mphAQeSLeBEqXH31Y34Qbrf1MxYBUwZJw UYxB9jjQ9Ustekb0pvKFDBXL22Yk43wPezP5WKnkRsVN63LPi87bGkyvyJ98qy4BHsA4 cB+CyCCPAsIfwAmDInx2V4H+yqIVwGd713kshDUe+WGtUFsW/2JslS8lVIiDGL10GGx7 n31vZxDWlx2Goo6qKgZ/cOhUmJt3BGbrQiK7GnSxESdyGXa4WuvsCg42kkGMftOa39MR B6Zw== X-Forwarded-Encrypted: i=1; AJvYcCWZEuGW7+muJxTB+SR7RMK7vqTSJdU65rI56x7kC7zNrsbrOo9fqdFe+sCmFzTopsAw/4LB7ChYuQqtAug=@vger.kernel.org X-Gm-Message-State: AOJu0YxaZGZ2Yd7N+oZEoyttftNpnSyTY1U4t3ziDz4cKI4ZABJ/0Fqq tj5mN7R8HPSpVpZOMs997y3tNFYMRG5NadOEmgUs/mPGhTXbD4qd0BDQ0oDODNWQaf+fb5yNCs0 FENtcCg== X-Received: from pjbrs8.prod.google.com ([2002:a17:90b:2b88:b0:34a:c430:bd91]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:2b06:b0:2ae:4996:430b with SMTP id d9443c01a7336-2ae499644cfmr108344665ad.26.1772567054562; Tue, 03 Mar 2026 11:44:14 -0800 (PST) Date: Tue, 3 Mar 2026 11:44:12 -0800 In-Reply-To: <4574be9a29d75d565e553579ef6ce915ef33b19b.camel@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260225012049.920665-1-seanjc@google.com> <20260225012049.920665-15-seanjc@google.com> <8bed2406e9f5f30f8f01c1da731fae6e040da827.camel@intel.com> <4574be9a29d75d565e553579ef6ce915ef33b19b.camel@intel.com> Message-ID: Subject: Re: [PATCH 14/14] KVM: x86: Add helpers to prepare kvm_run for userspace MMIO exit From: Sean Christopherson To: Rick P Edgecombe Cc: "x86@kernel.org" , "zhangjiaji1@huawei.com" , "kas@kernel.org" , Xiaoyao Li , "linux-kernel@vger.kernel.org" , "thomas.lendacky@amd.com" , "binbin.wu@linux.intel.com" , "pbonzini@redhat.com" , "linux-coco@lists.linux.dev" , "kvm@vger.kernel.org" , "michael.roth@amd.com" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Tue, Mar 03, 2026, Rick P Edgecombe wrote: > On Mon, 2026-03-02 at 18:24 -0800, Sean Christopherson wrote: > > Ooh, better idea.=C2=A0 Since TDX is the only direct user of > > __kvm_prepare_emulated_mmio_exit() and it only supports lenths of 1, 2,= 4, and 8, > > kvm_prepare_emulated_mmio_exit() is the only path that actually needs t= o cap the > > length.=C2=A0 Then the inner helper can assert a valid length.=C2=A0 Do= esn't change anything > > in practice, but I like the idea of making the caller be aware of the l= imitation > > (even if that caller is itself a helper). >=20 > Seems ok and an improvement over the patch. But looking at the other call= ers, > there is quite a bit of min(8u, len) logic spread around. Might be worth = a wider > cleanup someday. LOL, "might". :-) Definitely a project for the future though, especially given how subtle and= brittle this all is.