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 9644E37C90B 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-2ae4a6bb316so29197155ad.1 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=s2p0apwM0ksdIE58zS3++TaxofUuylU1KMSMgm8k9xsuZGUV07qy4VuqhRTKSSEbWb 7OENt2wI+9UONDFJhm5yoLmLSfoNHLpKPxiXJ6uwQzr9061AHSg92JyNRR1H44rTlwHB 1Zue/ZZylXzzQKHRNovaSGq/4EsG9Dcx5CgGfQotbln6L7jJ1+Qe0HeuEi0G5bma2ZSM zhiG7FR+07HKPXXNCWHaP+KFzRQmxwunbvSqii7UYGilsEPeHG3RAi5SgvtmdDm7b84s dDSwg/z+2O7zuLqw2/rT7OcoSr09jJxq/CrwWVYqX/kpqJgpqIBfFhW94GnJKp6E2t3S svwQ== X-Forwarded-Encrypted: i=1; AJvYcCW4ola2YfgSTPHVIS2QmjZO+sjohgtCpcnryqcVeRblT33ky65b017N9KTsQh3DSyMrrd8=@vger.kernel.org X-Gm-Message-State: AOJu0Yy4D+3FgT38HHNZzfGIQH3Y6vmYAnjlagQH7NYUl/TTpaFSCgRt S9ZigLTTErc3R6mTOFwfadyhn+ckILz/LKW/n40diABi8y2mVii4BbQNaBdj77+7XseqzoeMD06 uzCUIAg== 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: kvm@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.