Received: by 2002:ab2:7104:0:b0:1f7:f6c3:9cb1 with SMTP id z4csp22498lql; Tue, 7 May 2024 08:47:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW21rhrQLj4fjakxV10qDCnxBKAMTrd47MLDWlKT8if5ZDz1wi06gHh1doa0W+JFn38Uw5KfNBaRcyyMr9+XWJZ0d6u06wy3ugvvt0nKg== X-Google-Smtp-Source: AGHT+IFovt8Beb5KgqJtbPbTeOeM5MOdF0mUjQ155lo/xjzdrq1z1o8rg3hGdYIgd0DmBnqhyM4E X-Received: by 2002:a05:6e02:2161:b0:36a:3b51:402d with SMTP id s1-20020a056e02216100b0036a3b51402dmr19947468ilv.19.1715096839321; Tue, 07 May 2024 08:47:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715096839; cv=pass; d=google.com; s=arc-20160816; b=JJhhyFg4vhnOHCe8YWQhAKvrTW1yXnWT1RFGYgHMj3wYfdDvxcMtSNh5jK/cXLonuP OdQx95EvlPsPuLHYpvld0wfSBHEM5b23igvq6yQ/Um/yuaWn/US9gLK7M2KWHvDTlR7D wNWPGSvYPHIerHzrtgzt9zW5tCY7PJ7qZBBgyKQs6IRbF6TXgdbN/LW8gnxNOKlT9IdU jN4F6TvzXbFJcFj/c6VAN+Yx8j0SRcnROah7n5kLtwGzRPEqMcCMWgzW881LNMJtZyYD Ga3kdhxv+loU4lKt7ka7VjzQR6rE5t9PM4ahsvfRoyC7AQjqGbQQ3W39q2lQ9jqH8dqp zQ8Q== 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=dzb4U8P2rFm7N43PBgXdaqlbDl/eTgHl8fkTAu8lzP0=; fh=4N0ilCeWNPUMy3p+fwQEcpDcSktLq8IMxbqwLAweA1k=; b=KYcx2ZG4eZsrKKq8PQWOW9s6N4N65pYnbzczMj3AjQuYB295IdUHUXt2JGM52qR8B4 4+yjFyM/4IZ+tmFrS43KQvb6Ey/B4AhEUazLJGsq80hNxF3ZaAp7hta6h5f1TTnqrRCu fi0M0oxEDD24B+Nr1SXhjeSNtxujyfAlPC8qim4X+29tul6u2Vrg6yh9Uaxp7Dt3SNOE /t2FFbr74Z2C+FvfNxltWR2V8KL5hVwmfqZvA8l/AfoQZL0lFbGEecTzkKRG8i8ZDdRg TwVFrt7CtoBppsyvPKz9oe+Gp/i8uZuvzALkEYu3IqjKPYu7dV8ycjoNA0Bl4j9H5zXC O7mw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CuldQFvF; 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-171715-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171715-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. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id m127-20020a633f85000000b0061cbad72a7fsi9127365pga.532.2024.05.07.08.47.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 08:47:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-171715-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CuldQFvF; 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-171715-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171715-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 535712865A0 for ; Tue, 7 May 2024 15:46:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 315AE16C87A; Tue, 7 May 2024 15:45:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CuldQFvF" 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 8108116ABFA for ; Tue, 7 May 2024 15:45:06 +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=1715096708; cv=none; b=mG1IiVikmE8XTejce8AeIXyglEUAIixiFDIZElPBmEdcctw+U0GpNkdt+8XcrpYpkNKZZBnarx2hiSDKT7EqL/IGVUoy8RkPgkGP+aiqV3CE90zpdYITLOlWbScDP2yIAojVsORrLtUw6fUJfRXipGdwwfVavPknZlZ7Lpr9ILU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715096708; c=relaxed/simple; bh=BON88ogC2wPRar6FuSAb/E+HDh538ph255feyBFYIT0=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Qpj8LrkK7N68AoN/HhIfiMilqJmwDO9kXmULuajkxEdx2UJHyCAyHu5unHl3d+PFltNh4D5hs/A/TEi/x32QCV+vAR/lRciSYmXnwPuDTl5DO6C93jDfCNFlmDr4/BfhS6ayNF/2KevYR4n2EUcFgoDAZPVZSGeREO9TvT052Q4= 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=CuldQFvF; 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=1715096705; 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=dzb4U8P2rFm7N43PBgXdaqlbDl/eTgHl8fkTAu8lzP0=; b=CuldQFvFsLq2DVYsYo+dOKtjGIEX1PwSXCoWglSFjy7ooarqjlaE0tq6Xih2P2poX1Gl7s Y+xAE55Mg+dkwSvdJxslph1AFVunM1PGRIMnPpzJSBhqPauE2BXWTgZ/g/zqbAbtlb3TLO hpJ81y2lTG5cPhQ4tCFrjDQ102v5suc= 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-147-8JF1wSBDO86XTzV4XGUlXQ-1; Tue, 07 May 2024 11:45:02 -0400 X-MC-Unique: 8JF1wSBDO86XTzV4XGUlXQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (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 BF8A129ABA10; Tue, 7 May 2024 15:45:01 +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 A89F3C154E5; Tue, 7 May 2024 15:45:01 +0000 (UTC) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: [PATCH 6/7] KVM, x86: add architectural support code for #VE Date: Tue, 7 May 2024 11:44:58 -0400 Message-ID: <20240507154459.3950778-7-pbonzini@redhat.com> In-Reply-To: <20240507154459.3950778-1-pbonzini@redhat.com> References: <20240507154459.3950778-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.8 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 | 4 ++++ 2 files changed, 16 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..d780eee9b697 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -6408,6 +6408,10 @@ 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) { + pr_err("VE info address = 0x%016llx\n", + vmcs_read64(VE_INFORMATION_ADDRESS)); + } } /* -- 2.43.0