Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp36177lqt; Wed, 5 Jun 2024 16:20:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWvUEGgRp+pto6sQUJVbNf3kwtO7Wr9xxy7krvNBWuj5iyJf/dzwO8jzxoVljFU17hRlsG0sWoz/PFyyHVEbMWMT3ggNq1sBsXl8JVPcA== X-Google-Smtp-Source: AGHT+IGPnuXbQ9IxyFzPjku1uC6TUffXbU4PcN+AJxGuumWwadXtyc7ur16V326GhuWN2ra05Vam X-Received: by 2002:a05:620a:2953:b0:790:ed57:1354 with SMTP id af79cd13be357-79523d26448mr477744785a.6.1717629650728; Wed, 05 Jun 2024 16:20:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717629650; cv=pass; d=google.com; s=arc-20160816; b=IwBW9ZTR/4N5HsziquuU2JCnQxAXwDn50NFelHJO42EJkKgVSasf6URbQcopeZunQP slwWaL+uDYoG1/UnxsG49gmSuRQvH7W/JyFMkX/FOntlYNXAGY7ZBaI2I10C8jUfY5K3 J9CxuIJJlxHTrF4Qr37AM2uKwlFLB9QeaSKKEWH1joNu0H9qOZHjdiG99b1KquJjANZG R6QkL6L6u5/wEHbeMZJJWpE67Ql6O4PlxelXI7ZPYBmBjaQmGmwIFFKpMmqq6V7XkAoH 8/XeyYDpl5aajhRNR+VeXvUXCLyG2dj3cOvpHVhB98w58wPyA9CI1eUCypuNHL/mQNsQ mbnA== 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=EXdA077yWpI6eczOdgTucO+pfSrwF4gU1Jrgqc+2K/k=; fh=d96ppYB8SsPLuH840kRFC0enwv1ssUoG6fdO1ztsAHE=; b=DU4nFCVuj9oZPbEGmPodfmftCFVCcEgdjcQSjiMCJ6v6GG18iP6u8gEz3QL1XHcDD8 QebGu2WjzZG1zUxXBAofkVqxcjyXpX9ucuynWDOzny+2wckiCatwb2T0WV6wACmTqE2V kUOi7KsciexCRAHJm7GERCkWMyYvAvw0tulF9mmA206l5DRo3qjLeJlB3ytI0ioZNDi1 9Zb+8QqUJRCs3uKux6b43qJkq6LLBu89SN116zUakUn03P0Kr+/Uf9JLRATc3B7dfMn7 5U/Hx0YTWj+nWDzKiZTn6IRVl4LWHzqz9KL39tsNo9xwjvyLPVS4cFf94S0i2uY4VOP3 YXeg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=EGlIrM7a; 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-203396-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203396-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-795333910easi7232785a.715.2024.06.05.16.20.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 16:20:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-203396-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=EGlIrM7a; 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-203396-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203396-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 69FBA1C22729 for ; Wed, 5 Jun 2024 23:20:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E425F167265; Wed, 5 Jun 2024 23:19:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="EGlIrM7a" 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 9A0BD16D4C6 for ; Wed, 5 Jun 2024 23:19:30 +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=1717629573; cv=none; b=HiQB1qZFYaRcJL2EbbWmqmBj5dSSaGP6eYc6J5ZvGP3vqEwM1ndpGVkWnLadNzU4mT3v6mlfNOLde4MDuQydPf1wzajzPWqLNGlCi4C2mOVMeEsD4FTYZUS2Z1AkuXesywxKtHsnRCPiWYv+P3YHkXzR5WzBt8q09G4f0viyocg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717629573; c=relaxed/simple; bh=dO25VgHPABsHY2fEB1vc850vQbsSZc7TVlAn3AUTs0s=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=QZO10ThlyBR1U9QiKYfnRWS+VJuUpK1EDlf/Uvgpdj/iGQQJ5v523cZEWtae8Wntsjg9OmwQM0i+9L0SzQi5fF1j/kWAcNOiU3IvuIaCLIAfukUpqN+dAfrNyMtDfUPqVZlvo49zBOrxZuFOFt+5XP3HOBHDCY83N3pJJ8QHJTo= 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=EGlIrM7a; 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-627eb3fb46cso4805297b3.2 for ; Wed, 05 Jun 2024 16:19:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717629570; x=1718234370; 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=EXdA077yWpI6eczOdgTucO+pfSrwF4gU1Jrgqc+2K/k=; b=EGlIrM7apFsKkOtraFd9l3xurhcgrWIqRYqyAJNVqDJBLSNJXuz0R4lDJNUMBKHLLj POG2mxNeFowfCw4sGG1wU/RrutdtmU+Vsc2JLCbad5kT84ZJG1vZVTRcCirKnvQVXXBm L04XY8F2Zdt3pIxlBHCfyjKk4C5zjdC1euKqkIF+j588O7uZ0KGQbYVMRc8dc6pCDu1M cPW56OrUE7NaECbRMohaN3T+nfjP4mLZViak1A3FJdNpX7lEeAmyitkfjrax1uT7lzVP 5iX1xU5K11vbWI/h9LMO+7lBlMI4rFqESVHu/oxSzFQ+nFC2MzKTO+ZNnBU0zEHjjwAM fZFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717629570; x=1718234370; 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=EXdA077yWpI6eczOdgTucO+pfSrwF4gU1Jrgqc+2K/k=; b=n3IfYFBCNVA7p0AoT+LcWl759Ym3im/9P5MFxfkTX3aLneF3P7uBfOh9K5CZkugmnq PTyeXf/DXY7aW7AYLBZ4AjHP9beovmNCtvOBHE5sVxMeMolPuZgmkmX6RkU5jXk9UDFh PmhEy3F+P30lYMfEqHowYDsKV1BBh2iGjwfkOFe5f4UdwQdqQNMPlJcPH9pUKPb8oXK0 txAaB4/yts463GEAfM6NqNtZGPv2pV6L4t47deo5hHhOG2RZu/OcMng4XvBzqoDdstFq lQ9vmP/f1axV4FiCRWHtwNwfJfAKkZ5z+ZhksMQL7/kUH/XSpZb46X+5/u+S3BTLqlO1 NEKA== X-Gm-Message-State: AOJu0YwIB+9UBjpB33D+TVZhdU7UYnPJ/C+dljLW4jvug4Y7gkayCMwl NONxYpZUMeTw1UHn1HT4FdOLnmsHEZrVkvR44KdeEs4zZ6OYxiUpXcHZR7wykEfO8dwJSPyIkY3 U8w== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6902:c09:b0:dfa:59a1:e8f4 with SMTP id 3f1490d57ef6-dfacace3345mr463340276.10.1717629569624; Wed, 05 Jun 2024 16:19:29 -0700 (PDT) Reply-To: Sean Christopherson Date: Wed, 5 Jun 2024 16:19:12 -0700 In-Reply-To: <20240605231918.2915961-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: <20240605231918.2915961-1-seanjc@google.com> X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240605231918.2915961-5-seanjc@google.com> Subject: [PATCH v8 04/10] KVM: VMX: Move MSR_IA32_VMX_BASIC bit defines to asm/vmx.h From: Sean Christopherson To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Sean Christopherson , Paolo Bonzini , Andy Lutomirski , Peter Zijlstra Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Xiaoyao Li , Kai Huang , Jim Mattson , Shan Kang , Xin Li , Zhao Liu Content-Type: text/plain; charset="UTF-8" From: Xin Li Move the bit defines for MSR_IA32_VMX_BASIC from msr-index.h to vmx.h so that they are colocated with other VMX MSR bit defines, and with the helpers that extract specific information from an MSR_IA32_VMX_BASIC value. Opportunistically use BIT_ULL() instead of open coding hex values. Opportunistically rename VMX_BASIC_64 to VMX_BASIC_32BIT_PHYS_ADDR_ONLY, as "VMX_BASIC_64" is widly misleading. The flag enumerates that addresses are limited to 32 bits, not that 64-bit addresses are allowed. Last but not least, opportunistically #define DUAL_MONITOR_TREATMENT so that all known single-bit feature flags are defined (this will allow replacing open-coded literals in the future). Cc: Shan Kang Cc: Kai Huang Signed-off-by: Xin Li [sean: split to separate patch, write changelog] Reviewed-by: Zhao Liu Reviewed-by: Kai Huang Signed-off-by: Sean Christopherson --- arch/x86/include/asm/msr-index.h | 8 -------- arch/x86/include/asm/vmx.h | 7 +++++++ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index d93b73476583..b25c1c62b77c 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h @@ -1167,14 +1167,6 @@ #define MSR_IA32_VMX_VMFUNC 0x00000491 #define MSR_IA32_VMX_PROCBASED_CTLS3 0x00000492 -/* VMX_BASIC bits and bitmasks */ -#define VMX_BASIC_VMCS_SIZE_SHIFT 32 -#define VMX_BASIC_TRUE_CTLS (1ULL << 55) -#define VMX_BASIC_64 0x0001000000000000LLU -#define VMX_BASIC_MEM_TYPE_SHIFT 50 -#define VMX_BASIC_MEM_TYPE_MASK 0x003c000000000000LLU -#define VMX_BASIC_INOUT 0x0040000000000000LLU - /* Resctrl MSRs: */ /* - Intel: */ #define MSR_IA32_L3_QOS_CFG 0xc81 diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h index e531d8d80a11..81b986e501a9 100644 --- a/arch/x86/include/asm/vmx.h +++ b/arch/x86/include/asm/vmx.h @@ -135,6 +135,13 @@ #define VMX_VMFUNC_EPTP_SWITCHING VMFUNC_CONTROL_BIT(EPTP_SWITCHING) #define VMFUNC_EPTP_ENTRIES 512 +#define VMX_BASIC_VMCS_SIZE_SHIFT 32 +#define VMX_BASIC_32BIT_PHYS_ADDR_ONLY BIT_ULL(48) +#define VMX_BASIC_DUAL_MONITOR_TREATMENT BIT_ULL(49) +#define VMX_BASIC_MEM_TYPE_SHIFT 50 +#define VMX_BASIC_INOUT BIT_ULL(54) +#define VMX_BASIC_TRUE_CTLS BIT_ULL(55) + static inline u32 vmx_basic_vmcs_revision_id(u64 vmx_basic) { return vmx_basic & GENMASK_ULL(30, 0); -- 2.45.1.467.gbab1589fc0-goog