Message ID | 20240301101410.356007-3-kraxel@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-88244-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp978601dyb; Fri, 1 Mar 2024 02:15:10 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXp070a+2Ravxx8aeATtM+JE/dT8kwbYaCpsG9rnEO9zBgPQptAVK5Ap1pKvsbJjjfxvXuyibqEnbf6TaNfz+pFE7pgkA== X-Google-Smtp-Source: AGHT+IE0ehjBq2P5KIPHaY8MCzH4exV3/1ksMdwa0xnhUfGbPfvwRz6SZGO3xFi0SXJJvFf8n+V9 X-Received: by 2002:a05:6a00:21d6:b0:6e4:3e76:4af5 with SMTP id t22-20020a056a0021d600b006e43e764af5mr1497571pfj.14.1709288110376; Fri, 01 Mar 2024 02:15:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709288110; cv=pass; d=google.com; s=arc-20160816; b=y86kUHKb0NiNxT/vyZNc1aD+wUPNvnEc46bajRDYq98Ww0bgA0BbwbGC4ROd9JValO mE8PJ1uO5dUZ1IunRrZkGxZMRd9vutqveReELsN3+TjfzXcvnsTHxk1DW+vaQ2ZmRJAq M2uwSU0BLi8Ev7sAhcZ5TlwF3/KtbR7/gVczljs6kKTqa+y8tsQXY2u/TlGBXgBTF9sP ZUyso5GuKBq9CafXSp39Lq/a+n+jlaU3TLxu9O2K4jNb8aADqKqBnayKzoAH1Kd8kJmz hj8/Hz/rQoxYXQrobZb2nmAi5al8sNpZq1n+hNu1erxJtZuFwuoX0vAE3fWP0bEb6XAr ut/w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=R+QSb4VJ1jHAbQmwW/SLNpPZK+rj9N/eRYzdT8VP+cg=; fh=8dvwZjTintHRZSEO4im4OT7nSZJf1h7yo1mdwcT0Sxs=; b=JTPlfrpHV4beUM5rz0HI70kV6PGCEKwr0yZIg0N/K/Pe4Gokyg7MMRFkk9Mw21aXH7 wBt8H265xdaYQp8te7ePVhmD3d2XYBh8R+0Ke2R+J/lg0RkNCjOewxTE/c39ZWg8kzPh /EdF7QRf546mofwuyCHiZZyweQzwqfvsOk5W5NmyKm7TNMbYwjO/Eniuk3ck9tA1v/Wv lmQbTuJjY3uPsl4LddOiqywrHOXzeRmmtgDzYdX2gGw4C16XQeMKczV4lN/eLzQ8diuB ZeE1CN3yZCAeKdfKo3Qrk1hrAjKGLb0+ZrL9CI5HL9Q5+K8gJERL9sMPrrAFCOGIHJ47 TBhg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BGH8YR2e; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-88244-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88244-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id bx12-20020a056a00428c00b006e0901330e8si3354096pfb.368.2024.03.01.02.15.10 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 02:15:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88244-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BGH8YR2e; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-88244-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88244-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 2F752288D45 for <ouuuleilei@gmail.com>; Fri, 1 Mar 2024 10:15:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 78B2A6CDA1; Fri, 1 Mar 2024 10:14:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="BGH8YR2e" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2838C6BB4E for <linux-kernel@vger.kernel.org>; Fri, 1 Mar 2024 10:14:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709288062; cv=none; b=EKWPudeZxMm7IqNp2WJecMzChoYH71ml5GDltGPdpsFgbQZicR7dGoQJPfch3sXJVjhW6Y381igN9b7mPcOONpxFBJoAlJd7oCAwXLbmUUf0L9868O2kMGhnIB4QZcYu2YhBrsoKA5YvOBZFOAoqWwCybChC7JIW7yoihFm6v3c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709288062; c=relaxed/simple; bh=x+nTTwmEfaKEpgrbbMiWdsUHJXOKVRsj2CPeKkTwj3I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cU7IIld8ELkkeuJexAMq/IrOZJDl/pjh7rfLJl/pzVx3LoNjjrk6S7oQ1bESfbZRIGn/XQmDFdBxbBXB+/cXjdl0DDx4hTyBSMPLJf8CWbG/i/1qyrk+JMT/QZF2L2VazxKG0FMP1KiEwp/GuiYWDoTaYFv5mR3k7cdHtKHoZLI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=BGH8YR2e; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709288060; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R+QSb4VJ1jHAbQmwW/SLNpPZK+rj9N/eRYzdT8VP+cg=; b=BGH8YR2eViefAlFVHWhVEuaPmGuqAi2oc5uPcCNvW/XdiiqfH27jHrbkpmyU1PuBaL1tyn jrpAaTzyS72X6V2c+det44shHYXWxBHabbIhgY1RJ5SO8FWIwNcJOZC6gKsMNbQIJGBMBN st4Xf7YD57zMbKtMlFmC9u4fLxNLBDU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-662-QWOY9T-_N0yzeq7pYgncJQ-1; Fri, 01 Mar 2024 05:14:16 -0500 X-MC-Unique: QWOY9T-_N0yzeq7pYgncJQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 58473108BD87; Fri, 1 Mar 2024 10:14:15 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.121]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5C1F02166B33; Fri, 1 Mar 2024 10:14:14 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id DAB481801491; Fri, 1 Mar 2024 11:14:10 +0100 (CET) From: Gerd Hoffmann <kraxel@redhat.com> To: kvm@vger.kernel.org Cc: Gerd Hoffmann <kraxel@redhat.com>, Sean Christopherson <seanjc@google.com>, Paolo Bonzini <pbonzini@redhat.com>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>, Dave Hansen <dave.hansen@linux.intel.com>, x86@kernel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)), "H. Peter Anvin" <hpa@zytor.com>, linux-kernel@vger.kernel.org (open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)) Subject: [PATCH 2/3] kvm/vmx: limit guest_phys_bits to 48 without 5-level ept Date: Fri, 1 Mar 2024 11:14:08 +0100 Message-ID: <20240301101410.356007-3-kraxel@redhat.com> In-Reply-To: <20240301101410.356007-1-kraxel@redhat.com> References: <20240301101410.356007-1-kraxel@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792318489598600819 X-GMAIL-MSGID: 1792318489598600819 |
Series |
[1/3] kvm: wire up KVM_CAP_VM_GPA_BITS for x86
|
|
Commit Message
Gerd Hoffmann
March 1, 2024, 10:14 a.m. UTC
If EPT has no support for 5-level paging the guest physical address
space is limited to 48 bits. Adjust kvm_caps.guest_phys_bits
accordingly.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
arch/x86/kvm/vmx/vmx.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index 1111d9d08903..8bd644a5022d 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -7899,6 +7899,11 @@ static __init void vmx_set_cpu_caps(void) if (cpu_has_vmx_waitpkg()) kvm_cpu_cap_check_and_set(X86_FEATURE_WAITPKG); + + if (enable_ept && + !cpu_has_vmx_ept_5levels() && + kvm_caps.guest_phys_bits > 48) + kvm_caps.guest_phys_bits = 48; } static void vmx_request_immediate_exit(struct kvm_vcpu *vcpu)