From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) (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 52B78376475 for ; Fri, 29 May 2026 22:22:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780093377; cv=none; b=cf0j+YjUatxPNxeqmW/0JckkYwyQDeinbDEyQNEP4ITQZ5LtY8oTSIK9m03H6+c9VBlP225HAQ5wtj/ncEzIVVgHBFKY1/PldQT6A6oi9J0LxelOc8t0cQiyG6s7lCYoXG01+sCnUI80tQVJ0a3ni+w5Pli37ageFlII/rrDDf4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780093377; c=relaxed/simple; bh=7mIOAYDO5oSpz1HswBSG6LYqEatOLHW5qOqOaTlM01Q=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=MyAaaU3+InLlXVwVWLW5HAOBXdJXNsVsrdTemRECVOp5yodE3J3yH0fARu2kLN5HAticsPi5trSC5lfbjnAROv1il6+NuPrQFHZ09ezTug27Tj3j0FrNr08ETDVKFalsFQCT3xcZpS2TBX0sgdtLAAxuiszj1PvCqfGzVlR9C10= 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=KQE68mFt; arc=none smtp.client-ip=209.85.216.73 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="KQE68mFt" Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-36bc54005a7so1341293a91.0 for ; Fri, 29 May 2026 15:22:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780093373; x=1780698173; 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=jKofG2Hvtgv/l66zJ72qbyioy0cgxVopkyT0Bv1ocwE=; b=KQE68mFtJfvxiBmycb+hSiJsRsK8mD4hZH3AZZFQKxAerQrgXcSM946oMyN3HSCyYK byYvUxeVVmezKDecLfbhxe5RfYcoiVwbXmUYs73v8mD4ifKtuQaXQlqo0DKhJ7743P48 V7/3khwfJ6jlGj7GpKUngvpnYyrgi3Kz24x+I+j8Re7r54ztKM8jY0Kh1o4aiQlAn/xY u3FrLovgXSvKuxNqfbVPTmKW/VoTKsIJMBz+IgnWd5BH3w1N2tYxtYkaZMndWpBGahp4 d6FCT6qFJgwx1BuBIVh/HvAGy+f4NsE1BbeKCGLQju4j2peOV6f6VzWRoUVxQ2hE1cxd vLWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780093373; x=1780698173; 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=jKofG2Hvtgv/l66zJ72qbyioy0cgxVopkyT0Bv1ocwE=; b=B9a3/FX/YOU1JhCcxYMQ4ozcZmncy+0YLHAw+pRo8TyQi1K8Jr4lVpM6AQXogkezNc YMoq1+zPxgfqkYVRSYodWwN37j7xqoTQaW4bHoOYrdrZ3ZjS5qGzOlzlbRoz/m3UBUCq 2utglDA1OURP7oGO0VVWvyWTi4WRGzYi6lx5xpn1d8wxfoKfPRiQSnSOTZFDaVNv+oUj oT23qHALoFNSFezyTDwwMk7KND7KSfKEeiuBlhKJlp1bZTbwHTtdIZu7PXnI9/jMtm8o ZVKJrPAtMVkGSiPnZLrHFJc/KIs+IJlpt3WJc7zcAtLy9COaS6Inu0eGGdSG0GaldIO8 gIdQ== X-Forwarded-Encrypted: i=1; AFNElJ8CGUZd/0mnRzh4zRHAcCylkb43eRQyVsgFRWMzhDAB2hBk6efk19slA2xV1HHgsnKCeR1u3YMmjmtljEM=@vger.kernel.org X-Gm-Message-State: AOJu0YwbR0bUegr01wWGsJLgjdCF3qZFdmJ7nEF4aGOtFoX9Woxh83bW PtImQ0vovc89ju87kj7+j/mgV4Im6rr5icmb+0gY6IA0+QzyNnwjM8XC68kYr0w7PbKDVPAX9bx sV08OxA== X-Received: from pgig5.prod.google.com ([2002:a63:f405:0:b0:c80:2399:151]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a21:6017:b0:39f:a42:9251 with SMTP id adf61e73a8af0-3b427f2af2cmr1231557637.22.1780093373357; Fri, 29 May 2026 15:22:53 -0700 (PDT) Reply-To: Sean Christopherson Date: Fri, 29 May 2026 15:21:52 -0700 In-Reply-To: <20260529222223.870923-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: <20260529222223.870923-1-seanjc@google.com> X-Mailer: git-send-email 2.54.0.823.g6e5bcc1fc9-goog Message-ID: <20260529222223.870923-10-seanjc@google.com> Subject: [PATCH v3 09/40] KVM: x86: Drop non-raw kvm__write() helpers From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini , Vitaly Kuznetsov , David Woodhouse , Paul Durrant Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Yosry Ahmed , Binbin Wu , David Woodhouse , Kai Huang Content-Type: text/plain; charset="UTF-8" Drop the non-raw, mode-aware kvm__write() helpers as there is no usage in KVM, and in all likelihood there will never be usage in KVM as use of hardcoded registers in instructions is uncommon, and *modifying* hardcoded registers is practically unheard of. While there are a few instructions that modify registers in mode-aware ways, e.g. REP string and some ENCLS varieties, the odds of KVM needing to emulate such instructions (outside of the fully emulator) are vanishingly small. Drop kvm__write() to prevent incorrect usage; _if_ a new instruction comes along that needs to modify a hardcoded register, this can be reverted. No functional change intended. Reviewed-by: Binbin Wu Signed-off-by: Sean Christopherson --- arch/x86/kvm/regs.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/arch/x86/kvm/regs.h b/arch/x86/kvm/regs.h index 12db5039aace..f22b3a8cd483 100644 --- a/arch/x86/kvm/regs.h +++ b/arch/x86/kvm/regs.h @@ -61,11 +61,6 @@ static __always_inline unsigned long kvm_##lname##_read(struct kvm_vcpu *vcpu) { \ return vcpu->arch.regs[VCPU_REGS_##uname] & kvm_reg_mode_mask(vcpu); \ } \ -static __always_inline void kvm_##lname##_write(struct kvm_vcpu *vcpu, \ - unsigned long val) \ -{ \ - vcpu->arch.regs[VCPU_REGS_##uname] = val & kvm_reg_mode_mask(vcpu); \ -} \ static __always_inline unsigned long kvm_##lname##_read_raw(struct kvm_vcpu *vcpu) \ { \ return vcpu->arch.regs[VCPU_REGS_##uname]; \ -- 2.54.0.823.g6e5bcc1fc9-goog