Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp1104988lqo; Fri, 17 May 2024 10:45:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWDUuOlQXefxSD1M3frKGeXUSzdqgN/kdBeU9h9Ic6iCzkVBobCH9ryKM7MqZlLs3Jr0WYs4ScarB5mg1Kik7bxhBY4YJfz6q1EM5ymtw== X-Google-Smtp-Source: AGHT+IEes037UIuAC4gSuFGsqLqQJFnPupZWCFQA5gca3oeTdSuWNc6CUo8MlKKdJ1XTLaA2VjhP X-Received: by 2002:a17:90b:b09:b0:2ba:e4d:d2b0 with SMTP id 98e67ed59e1d1-2ba0e4dd68dmr6957909a91.3.1715967916979; Fri, 17 May 2024 10:45:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715967916; cv=pass; d=google.com; s=arc-20160816; b=aWzanPR/3zoGAjrUr3frcZjtsJhd0zuIyORmvH5s2KREEfJga17dfbtffF2qo9HskR WoLIN88kD9evsjYPxn43GB0tqBP7eTtY9gvRCgbApIMnRsBnUPq9VA4uAYzE4BXmvbBO FFB5tQULZLJnLwTtLgias5dQJV0VIDj2b4LpER9/iUX5adJvZwbdcRt6rexNHconQhvT GaMZRfHUKDd1M2KuxBNfu5MkHvXhw6rg2i/y4VAxaHAyaksV6AGTZ5vXmitBS+mUAsHL UXXvx4J2M4mqkrx39FHD1d/yzlRgEx4oaBPWr2wMpkTexk30ve/1aPOxnZ4MCROat0rs fI7g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :reply-to:dkim-signature; bh=cJS16Zy4jomaDCrDnpvskk8dKRRVP3ZQ5kOPgDcUpWE=; fh=484WSTQFOmfhIy17xpnayxMB5zbOVnIr2KvjikiBuJo=; b=vxlnzDFzTEVzYZsOHOPzpHT4ihL9hOetlbEn14UcuTrmFmFveSCKR6Ei2LW6OpyMK2 Vs8n9Qmdw99oOR/yUlMJUf+AgzV03nyBhAEhKbgoGWCoq15Lgu0AgLhrRXHOf6+4foW5 +KsS0oYl4g3+Q5WToEoN5OYsqeDTn2IEwJglOXzGp+jhJZJZcKNHBEPiZop9CcdSjy1i Ku4j/Nr+z3Cd7zFBTJA/g9PsfUsX40Fw8v38aQiJ/k6QhYbBJfSetRxWsXJpCqIJASAH x/WJ2vA7TRw9RNzVKnKbBxu22fjIOtGbkeiJJ7EbWiBJfiKe17otEQEB19I/t6s5mto6 oSyw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=BRxvpZO+; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-182441-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182441-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2b628a5c76esi20089155a91.46.2024.05.17.10.45.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 10:45:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-182441-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=BRxvpZO+; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-182441-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182441-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 40C11B23644 for ; Fri, 17 May 2024 17:42:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C4C731420B9; Fri, 17 May 2024 17:40:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="BRxvpZO+" Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.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 7B61E1419AD for ; Fri, 17 May 2024 17:40:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715967601; cv=none; b=jUsdXGwCiUzPUyFM7EC0+Qj0wu0Cjap+naFhJsEuSznp6IPo0DZdIqL9cSVPOBZ7kLnADtkcvr0kIw0R7fU79xEhaqkpLy0KJ/t7b3yERaohFUYLatEPXDBPmtdS2KdUWljr8EpDDmm28RFpQsQfo4J83EKWbHaIXiF6QKiSxZ4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715967601; c=relaxed/simple; bh=laZKFsXjLB6k3TKhu7t99v7hDnzkfbuO6HPnpt9yaCw=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=NfX3bCzn7Y8qzQWB2HhxwnDPNplnaMtAN+rB4YbcIS/sgojnHVBdkIKGPbEddfrdSiNQ4F6LQ4CqH1AdOg5fZ07hp9Is5S+RvppUg0IqDz08/BNGSKRq+91Fn2neX570E/yTn55H4G/VVWlcfVDo8fqpN4+g0GjtjEDqwmE8RAA= 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=BRxvpZO+; arc=none smtp.client-ip=209.85.128.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 Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-61be4b79115so182504137b3.1 for ; Fri, 17 May 2024 10:40:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1715967599; x=1716572399; 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=cJS16Zy4jomaDCrDnpvskk8dKRRVP3ZQ5kOPgDcUpWE=; b=BRxvpZO+KD33aBejaJAk+lBl1GF50WRlDAn8GoJnQqzQt24vQ+zaBl+X3diFvx0EIS fSFmauaRthR8vBYD4w8uJWCj3OHhz/DlTCmvPoo0zR6YZ6eHxxE8tz5EcslHXHQNRHJw 5Y30FAywWhJ4ZuEMvYnODfxWGgjPvH8XJIkyGmP4AqH0MlUztVGfapCySG5qRvxSKs05 K6o+Ikn4eaEmbfg0BGFN64NCjV5EJSnC1lAe9pCXaj2rs+HAh7NT/0YHAn2XgmRmhZqK Ym3jm+HfPny3E1ZlxLNHjt7d5+7VBLxR2t1vlM7SxxnDYfMl1kMeKDQUFBZuVHOOP5CV O9TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715967599; x=1716572399; 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=cJS16Zy4jomaDCrDnpvskk8dKRRVP3ZQ5kOPgDcUpWE=; b=FZqXjejogWCNUcQurgDgFjTWhzDH0NKQd8mu5L0QqLqVlDmutL4ox3fNKcNeEp/0wA BZ6mQJlptF2qmCvFFhZVfzsvkc0OHt+gdmosp80i9jfAAY7YJgfWkBBAxaRwflaq7/Dh kBGg2JzXFDFOQbLQHbJslH01fYofexPwZZMp+cqSIk/piwYmLpq7RkT8K9a2VrPCYTrG medKznsyNewRzXQ2GSiewaB9kvbbDC20aEyXOoqcxjp/vacfj9UwshXopkGRySG645TS 48adHKWOiOqtsaoh1Yx+zi7RuBd13dM3kBrc74GAfqYOerLMR29TzSuksdFvbxhks07j uIaA== X-Forwarded-Encrypted: i=1; AJvYcCX72lu1YnMf7dLuMiksjr08D+OcyMTynZ2wNFyfaeT8DVczNQ8xry2xg9HG6Yt2XY59ZOV/IxtLg+CTdD1qIRwi7YfekEJBeFNgue+Q X-Gm-Message-State: AOJu0YxE62IuhuPGMnTekqrduHmqvVdeF8UgsDsXA5rydg/JMMqI20jU opXSVvJtqo2CRzhOXgu1HoJnsh5rM8PFAKIDppYcBiKyhBMS7YTvpjxSqRXgdnjuQb3ZE+a5Jlf MqQ== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6902:102d:b0:dee:6802:dc49 with SMTP id 3f1490d57ef6-dee6802f337mr4772588276.1.1715967599568; Fri, 17 May 2024 10:39:59 -0700 (PDT) Reply-To: Sean Christopherson Date: Fri, 17 May 2024 10:38:45 -0700 In-Reply-To: <20240517173926.965351-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: <20240517173926.965351-1-seanjc@google.com> X-Mailer: git-send-email 2.45.0.215.g3402c0e53f-goog Message-ID: <20240517173926.965351-9-seanjc@google.com> Subject: [PATCH v2 08/49] KVM: x86: Move __kvm_is_valid_cr4() definition to x86.h From: Sean Christopherson To: Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Hou Wenlong , Kechen Lu , Oliver Upton , Maxim Levitsky , Binbin Wu , Yang Weijiang , Robert Hoo Content-Type: text/plain; charset="UTF-8" Let vendor code inline __kvm_is_valid_cr4() now x86.c's cr4_reserved_bits no longer exists, as keeping cr4_reserved_bits local to x86.c was the only reason for "hiding" the definition of __kvm_is_valid_cr4(). No functional change intended. Signed-off-by: Sean Christopherson --- arch/x86/kvm/x86.c | 9 --------- arch/x86/kvm/x86.h | 6 +++++- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 3f20de4368a6..2f6dda723005 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1130,15 +1130,6 @@ int kvm_emulate_xsetbv(struct kvm_vcpu *vcpu) } EXPORT_SYMBOL_GPL(kvm_emulate_xsetbv); -bool __kvm_is_valid_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) -{ - if (cr4 & vcpu->arch.cr4_guest_rsvd_bits) - return false; - - return true; -} -EXPORT_SYMBOL_GPL(__kvm_is_valid_cr4); - static bool kvm_is_valid_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) { return __kvm_is_valid_cr4(vcpu, cr4) && diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h index d80a4c6b5a38..4a723705a139 100644 --- a/arch/x86/kvm/x86.h +++ b/arch/x86/kvm/x86.h @@ -491,7 +491,6 @@ static inline void kvm_machine_check(void) void kvm_load_guest_xsave_state(struct kvm_vcpu *vcpu); void kvm_load_host_xsave_state(struct kvm_vcpu *vcpu); int kvm_spec_ctrl_test_value(u64 value); -bool __kvm_is_valid_cr4(struct kvm_vcpu *vcpu, unsigned long cr4); int kvm_handle_memory_failure(struct kvm_vcpu *vcpu, int r, struct x86_exception *e); int kvm_handle_invpcid(struct kvm_vcpu *vcpu, unsigned long type, gva_t gva); @@ -505,6 +504,11 @@ bool kvm_msr_allowed(struct kvm_vcpu *vcpu, u32 index, u32 type); #define KVM_MSR_RET_INVALID 2 /* in-kernel MSR emulation #GP condition */ #define KVM_MSR_RET_FILTERED 3 /* #GP due to userspace MSR filter */ +static inline bool __kvm_is_valid_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) +{ + return !(cr4 & vcpu->arch.cr4_guest_rsvd_bits); +} + #define __cr4_reserved_bits(__cpu_has, __c) \ ({ \ u64 __reserved_bits = CR4_RESERVED_BITS; \ -- 2.45.0.215.g3402c0e53f-goog