Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp67844lqp; Fri, 12 Apr 2024 10:36:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVrKGY3a4DzNDzxEi86kXS095DZmz45y1uYKmsiNSFXYTtHEPNocIpYacYhjMJ06UBoUf7XFYaPzZThFpYvc/gPPB27gnP/hgHENOgeGg== X-Google-Smtp-Source: AGHT+IFz4pWcJ6Tib79mGBjO7U2p9YtPtuJXSuK0YP15WwiiHyZiGEKTIcLCWDJQSmmyJziCNJwo X-Received: by 2002:a17:902:e543:b0:1e4:362b:17d5 with SMTP id n3-20020a170902e54300b001e4362b17d5mr3594496plf.4.1712943402520; Fri, 12 Apr 2024 10:36:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712943402; cv=pass; d=google.com; s=arc-20160816; b=YDUsmZAkQqX04YRZyuSzEx7Vk2qB+ZDXNUeO7cUA4zRhpAqHzaE86riqs2ZwuqcLR+ l0QxVk6B4M4OkUXx240vpgV11gY1qoHKBgm7uO94QgG3yl+jsC5hCEBoclsIiB/dz8vO YlLqct/x4ccWVPtXgtRQ7FVrkQ2ssvrELXR67ceKa6FmPVZAFcks7r5/5UMvg1Gntq/e ajlLj/zRj9saTH4KU9OZ42z5Ay/TpVRauuOP5SeSJAnDKDAPyqQxmZSvaAy+p6DsA8rv qm1dlmnGyCNCQyn0r2lNic+7IkywnOIg97Q9CNdKLIsHYL8S5TIPdWGh13n1Lo8UB6oX pRZg== 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:to:from:dkim-signature; bh=OiuOtF3km5mOrYS4QJpem+PodieKRqZDiEKM9mH6/7c=; fh=4N0ilCeWNPUMy3p+fwQEcpDcSktLq8IMxbqwLAweA1k=; b=nI+DdV0z+ibIu188hA++LuoAhiPFmWEXLnUpDCbc/X5axP1mC8ZmO6MvS8rp9XYgG+ rY0Q3wEy6OIjxmfP7vziVhAbxZ3dkR9TceDHGLv/6bWKBIXdfOxpwLkAqH9HwbDX10P9 LL0l+h3DsLe8fQ0cCPqXWq1NduW/UnqQmNZxPzYHLg19elsO3GB5jeeoXrWXNl5Upyk5 MbHUlTxM2wk5afYZ7g6Ve5P2T79cnH2SoYj8sj8TQQebm0PjHmKdU3ZKzd3eHcEOEOhV kud637mlj/b7KoF/wx+eq2eMKK3g3+IQOo6AW0SjPxycZPNXuHse0CX+a1BuEXqddZ6n pUlw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fIjnWguQ; 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-143136-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143136-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id l7-20020a170903120700b001e2b56c8cc5si3646559plh.509.2024.04.12.10.36.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 10:36:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143136-linux.lists.archive=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=fIjnWguQ; 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-143136-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143136-linux.lists.archive=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 C93DB2832CA for ; Fri, 12 Apr 2024 17:36:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 28B8514F9F7; Fri, 12 Apr 2024 17:35:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="fIjnWguQ" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 487B714E2EC for ; Fri, 12 Apr 2024 17:35:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712943340; cv=none; b=fCt1ivlOuaIrGRJZzIcdt5lD5Gkk4LxFC0ly/6LsNg3FWzng2A6/fiBhYyojVsI+BliH/sEHAT+R1hvDhTe0DgRFb4apP78fKtk4DssdJcSUYKErYMPG097iQvEBMdOdJM4YEQHBtguLBy5HPS9Kr8vXV4V/cnnMK1xa31EL4w8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712943340; c=relaxed/simple; bh=AYc/dQIgIGfPyd8Ji3WVCJ/kBmRWzsyv1BvZrf6DJiU=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PpMBUMoTpKeywpc2migo/h6c76b/L6Efdw7YXsthp6fYa1vqhuwcrDddxFK3t36GJ2eMqP98Q5a4slDV4t2pHC6OKPIE6Zl7otSpB6r++/3DsRwnJgHeI6CJQKhDtHAcnVEN3uuD/XGokAfOmeirBLDqZbo5IT/sGuZfACOEiZs= 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=fIjnWguQ; arc=none smtp.client-ip=170.10.129.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=1712943338; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OiuOtF3km5mOrYS4QJpem+PodieKRqZDiEKM9mH6/7c=; b=fIjnWguQq+xvcHemc6JvyPcfPYVZe33JF8Z75z8lL/O8STYywvs7ljfx38Iyytm7A8WM2B 9j07ZSqYgQj+B1qKZOGNyIA57nuODcjv/xM4KdKCo3zZy968X3nRQymHna2xR241CCdRls 2reEh0RxIRVoX9zGKIbSw5ZZNyp8BRw= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-483-BRP0A3PAOyWRxaH4tNJ55Q-1; Fri, 12 Apr 2024 13:35:34 -0400 X-MC-Unique: BRP0A3PAOyWRxaH4tNJ55Q-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (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 36C4738049F9; Fri, 12 Apr 2024 17:35:34 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1FA01492BC7; Fri, 12 Apr 2024 17:35:34 +0000 (UTC) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: [PATCH 06/10] KVM, x86: add architectural support code for #VE Date: Fri, 12 Apr 2024 13:35:28 -0400 Message-ID: <20240412173532.3481264-7-pbonzini@redhat.com> In-Reply-To: <20240412173532.3481264-1-pbonzini@redhat.com> References: <20240412173532.3481264-1-pbonzini@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 Dump the contents of the #VE info data structure and assert that #VE does not happen, but do not yet do anything with it. No functional change intended, separated for clarity only. Extracted from a patch by Isaku Yamahata . Signed-off-by: Paolo Bonzini --- arch/x86/include/asm/vmx.h | 12 ++++++++++++ arch/x86/kvm/vmx/vmx.c | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h index ac6da0a5f5e6..d77a31039f24 100644 --- a/arch/x86/include/asm/vmx.h +++ b/arch/x86/include/asm/vmx.h @@ -71,6 +71,7 @@ #define SECONDARY_EXEC_ENCLS_EXITING VMCS_CONTROL_BIT(ENCLS_EXITING) #define SECONDARY_EXEC_RDSEED_EXITING VMCS_CONTROL_BIT(RDSEED_EXITING) #define SECONDARY_EXEC_ENABLE_PML VMCS_CONTROL_BIT(PAGE_MOD_LOGGING) +#define SECONDARY_EXEC_EPT_VIOLATION_VE VMCS_CONTROL_BIT(EPT_VIOLATION_VE) #define SECONDARY_EXEC_PT_CONCEAL_VMX VMCS_CONTROL_BIT(PT_CONCEAL_VMX) #define SECONDARY_EXEC_ENABLE_XSAVES VMCS_CONTROL_BIT(XSAVES) #define SECONDARY_EXEC_MODE_BASED_EPT_EXEC VMCS_CONTROL_BIT(MODE_BASED_EPT_EXEC) @@ -226,6 +227,8 @@ enum vmcs_field { VMREAD_BITMAP_HIGH = 0x00002027, VMWRITE_BITMAP = 0x00002028, VMWRITE_BITMAP_HIGH = 0x00002029, + VE_INFORMATION_ADDRESS = 0x0000202A, + VE_INFORMATION_ADDRESS_HIGH = 0x0000202B, XSS_EXIT_BITMAP = 0x0000202C, XSS_EXIT_BITMAP_HIGH = 0x0000202D, ENCLS_EXITING_BITMAP = 0x0000202E, @@ -631,4 +634,13 @@ enum vmx_l1d_flush_state { extern enum vmx_l1d_flush_state l1tf_vmx_mitigation; +struct vmx_ve_information { + u32 exit_reason; + u32 delivery; + u64 exit_qualification; + u64 guest_linear_address; + u64 guest_physical_address; + u16 eptp_index; +}; + #endif diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index 6780313914f8..2c746318c6c3 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -6408,6 +6408,18 @@ void dump_vmcs(struct kvm_vcpu *vcpu) if (secondary_exec_control & SECONDARY_EXEC_ENABLE_VPID) pr_err("Virtual processor ID = 0x%04x\n", vmcs_read16(VIRTUAL_PROCESSOR_ID)); + if (secondary_exec_control & SECONDARY_EXEC_EPT_VIOLATION_VE) { + struct vmx_ve_information *ve_info; + + pr_err("VE info address = 0x%016llx\n", + vmcs_read64(VE_INFORMATION_ADDRESS)); + ve_info = __va(vmcs_read64(VE_INFORMATION_ADDRESS)); + pr_err("ve_info: 0x%08x 0x%08x 0x%016llx 0x%016llx 0x%016llx 0x%04x\n", + ve_info->exit_reason, ve_info->delivery, + ve_info->exit_qualification, + ve_info->guest_linear_address, + ve_info->guest_physical_address, ve_info->eptp_index); + } } /* -- 2.43.0