From patchwork Thu Sep 14 04:47:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Xin3" X-Patchwork-Id: 139630 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp406215vqi; Thu, 14 Sep 2023 07:56:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF1mtqJAPTevAKHeugpV3DmGAu/ubt2YBu0xoHfkWItGyLKq3lWivVIAXaA1BQNYfSBqAMo X-Received: by 2002:a05:6a20:394c:b0:123:149b:a34f with SMTP id r12-20020a056a20394c00b00123149ba34fmr4903348pzg.1.1694703390764; Thu, 14 Sep 2023 07:56:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694703390; cv=none; d=google.com; s=arc-20160816; b=JC1ZpMujy9C9ob2mKEPffvE91LXaVdPoX6VflxL/JqVINsSdyFAwURx+9vPSeffPWP ej2FmLhRM+oeNOsSSnGicorvmx6xxtdX9dPFjHZRTY9+I0C4A9hzFwsZaFSFeneMf991 SQM+eNh/LgppW9BXmZCHCy3/l5R2kmjGLxZU/t28F0LHSqd1x6cYQGCXYdvQjBIg0d51 s9SU2ATsP34Tm+acYJaar4kkk1bl6Mpd79J6A4hx6pTWVbiWi88QLvmeSSSudlCfnw4C mzhu58TmBS9EW4rLdCfusVnlaZikzW+DB8wMRaw9sU8s7T7XJHs6o7liMsHIPBI4ZnGE QO0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3cyS8FchZ3LDc9KTW9sGmbtr7Xt/VOHEFQpJJHWI1LA=; fh=jqCbnajAXgJ+s7A1aA7DOHJD13/+EpD442pw8d+Ofss=; b=R4rs76qnFoQmVJDyIMSiCNAUReERgpLeB9YFXmMJTfgTzkiVaYVc5Jfy1VeEt7dxix +3NudjFM22t1aoCcttuG3DPWDaw4N5T4uZ5/aE2S3HWi75ONONU5fWXoVNLGlSoYNJI2 lzkj+61zklYiLKetsjpgw3s4LyBj2Qx0JEG30jqqHOx3KXqOPf+7Yi0UoR5YqlytphjW 9YdrqPcF8lQyBy9WdofuQl7K6TcmOdkFajjENozoOYibG06gi36al5mwmvjDw+jAgBHZ TPF8frNmDSztmX90aB423RrZlEW3M5dZYli1N76JUAQmsBjFSC6nlQDV7KkWdw3ZUkIj 2huA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ERYQa4vt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id z28-20020a056a001d9c00b00689f449fe24si1745195pfw.53.2023.09.14.07.56.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 07:56:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ERYQa4vt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 2AA5D81D4779; Wed, 13 Sep 2023 22:19:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235140AbjINFT3 (ORCPT + 35 others); Thu, 14 Sep 2023 01:19:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234805AbjINFTR (ORCPT ); Thu, 14 Sep 2023 01:19:17 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C225C1BCD; Wed, 13 Sep 2023 22:19:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694668753; x=1726204753; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=COrE9eAXE6OPNE8ZIH2tugeOeIPIGx3BreJKJ34Ny6U=; b=ERYQa4vttg4kDkfC8pj00neOW+h5fhFTjR0bo01HSK7jD38eO5zRvQ88 xUtKkCtE29OQB1LFNF4LGjYB7ER+l+2p6895bZEg4Uk9EwLG6T4Fp6wzA 9JPrmp+WYPPcJe4WFDnpjUv8pPFnx9bPwYzF4SnmAW0ed8mYm2cwrKIy7 Jl+ZlU9k60/tzzj6D/037rxQJHaDQyKY/eZ9AXho7ExjDvQQjyW9cs1I8 zmaxxsBazfy+C/BzVBH7h1UFD+McpKOH06YafBHtru9q+CUhCmaJm8J39 OrZm8K+gUzUhSxc3r4hIb+Z+DwWQxwrwd5yyw4ECcFKdhyYHyV3Dz1kN+ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10832"; a="382661129" X-IronPort-AV: E=Sophos;i="6.02,145,1688454000"; d="scan'208";a="382661129" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Sep 2023 22:17:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10832"; a="779488749" X-IronPort-AV: E=Sophos;i="6.02,145,1688454000"; d="scan'208";a="779488749" Received: from unknown (HELO fred..) ([172.25.112.68]) by orsmga001.jf.intel.com with ESMTP; 13 Sep 2023 22:17:31 -0700 From: Xin Li To: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-edac@vger.kernel.org, linux-hyperv@vger.kernel.org, kvm@vger.kernel.org, xen-devel@lists.xenproject.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, luto@kernel.org, pbonzini@redhat.com, seanjc@google.com, peterz@infradead.org, jgross@suse.com, ravi.v.shankar@intel.com, mhiramat@kernel.org, andrew.cooper3@citrix.com, jiangshanlai@gmail.com Subject: [PATCH v10 05/38] x86/trapnr: Add event type macros to Date: Wed, 13 Sep 2023 21:47:32 -0700 Message-Id: <20230914044805.301390-6-xin3.li@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230914044805.301390-1-xin3.li@intel.com> References: <20230914044805.301390-1-xin3.li@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 13 Sep 2023 22:19:35 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777025302969551822 X-GMAIL-MSGID: 1777025302969551822 Intel VT-x classifies events into eight different types, which is inherited by FRED for event identification. As such, event type becomes a common x86 concept, and should be defined in a common x86 header. Add event type macros to , and use it in . Suggested-by: H. Peter Anvin (Intel) Tested-by: Shan Kang Signed-off-by: Xin Li --- arch/x86/include/asm/trapnr.h | 12 ++++++++++++ arch/x86/include/asm/vmx.h | 17 +++++++++-------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/arch/x86/include/asm/trapnr.h b/arch/x86/include/asm/trapnr.h index f5d2325aa0b7..ab7e4c9d666f 100644 --- a/arch/x86/include/asm/trapnr.h +++ b/arch/x86/include/asm/trapnr.h @@ -2,6 +2,18 @@ #ifndef _ASM_X86_TRAPNR_H #define _ASM_X86_TRAPNR_H +/* + * Event type codes used by both FRED and Intel VT-x + */ +#define EVENT_TYPE_EXTINT 0 // External interrupt +#define EVENT_TYPE_RESERVED 1 +#define EVENT_TYPE_NMI 2 // NMI +#define EVENT_TYPE_HWEXC 3 // Hardware originated traps, exceptions +#define EVENT_TYPE_SWINT 4 // INT n +#define EVENT_TYPE_PRIV_SWEXC 5 // INT1 +#define EVENT_TYPE_SWEXC 6 // INT0, INT3 +#define EVENT_TYPE_OTHER 7 // FRED SYSCALL/SYSENTER, VT-x MTF + /* Interrupts/Exceptions */ #define X86_TRAP_DE 0 /* Divide-by-zero */ diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h index 0e73616b82f3..c84acfefcd31 100644 --- a/arch/x86/include/asm/vmx.h +++ b/arch/x86/include/asm/vmx.h @@ -17,6 +17,7 @@ #include #include +#include #include #define VMCS_CONTROL_BIT(x) BIT(VMX_FEATURE_##x & 0x1f) @@ -374,14 +375,14 @@ enum vmcs_field { #define VECTORING_INFO_DELIVER_CODE_MASK INTR_INFO_DELIVER_CODE_MASK #define VECTORING_INFO_VALID_MASK INTR_INFO_VALID_MASK -#define INTR_TYPE_EXT_INTR (0 << 8) /* external interrupt */ -#define INTR_TYPE_RESERVED (1 << 8) /* reserved */ -#define INTR_TYPE_NMI_INTR (2 << 8) /* NMI */ -#define INTR_TYPE_HARD_EXCEPTION (3 << 8) /* processor exception */ -#define INTR_TYPE_SOFT_INTR (4 << 8) /* software interrupt */ -#define INTR_TYPE_PRIV_SW_EXCEPTION (5 << 8) /* ICE breakpoint - undocumented */ -#define INTR_TYPE_SOFT_EXCEPTION (6 << 8) /* software exception */ -#define INTR_TYPE_OTHER_EVENT (7 << 8) /* other event */ +#define INTR_TYPE_EXT_INTR (EVENT_TYPE_EXTINT << 8) /* external interrupt */ +#define INTR_TYPE_RESERVED (EVENT_TYPE_RESERVED << 8) /* reserved */ +#define INTR_TYPE_NMI_INTR (EVENT_TYPE_NMI << 8) /* NMI */ +#define INTR_TYPE_HARD_EXCEPTION (EVENT_TYPE_HWEXC << 8) /* processor exception */ +#define INTR_TYPE_SOFT_INTR (EVENT_TYPE_SWINT << 8) /* software interrupt */ +#define INTR_TYPE_PRIV_SW_EXCEPTION (EVENT_TYPE_PRIV_SWEXC << 8) /* ICE breakpoint - undocumented */ +#define INTR_TYPE_SOFT_EXCEPTION (EVENT_TYPE_SWEXC << 8) /* software exception */ +#define INTR_TYPE_OTHER_EVENT (EVENT_TYPE_OTHER << 8) /* other event */ /* GUEST_INTERRUPTIBILITY_INFO flags. */ #define GUEST_INTR_STATE_STI 0x00000001