From patchwork Fri Feb 24 07:01:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Xin3" X-Patchwork-Id: 61163 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp756656wrd; Thu, 23 Feb 2023 23:30:28 -0800 (PST) X-Google-Smtp-Source: AK7set9cbtsNN5qe3f0jFYBNO2hvTvNLTCVa4q4vFN//GQBfHKx+0AuYvgN25+9voG5jPARPWKUi X-Received: by 2002:a17:907:2d0f:b0:871:178d:fc1e with SMTP id gs15-20020a1709072d0f00b00871178dfc1emr28917079ejc.77.1677223827901; Thu, 23 Feb 2023 23:30:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677223827; cv=none; d=google.com; s=arc-20160816; b=sk31qvedLSWudoH8xuAyF9+lGIgyQlt4RH+FX+ZLFQDuUQoPwBWjr24aNn/kfmFwN/ hJTI/KfNNhAxlAiSoEdB3Xe8CjnIdbTZNY+ptfZKgT/M6SyHLUER4EJH/lLhL86vkKGs W1ddKHkgOhZl/XiZL8UpVfv+jW21wwMBQmKhxbDvTDShidF3NrZQNxh2LuDQ0A6+P+YQ 7Zm86UHs7pWftRIB9ct4K6P74UZOo6ApE4kL36ooMKROYx/Jts99qTa0TtL6LeMBp8zQ uqDIsDOvbiYcAuHPALTC6Qqowtezg0frMaTxbSwlyTVZGoA5d8YCFSCm4ly/9GxW7RRI 6zaQ== 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=4Gz5hp28ZFLmy8uIsUC+UiSXArc3GGVZRDW7I2CndzQ=; b=pzYOVZHyVDrdbAHMCVT64p7pMPkO5tss/rKpKtl+b5ptohs7rhlw9suetkW/VfWcrO VJ1v1JCdhKrCdET5TppJVHSWhvLKPBFsznyMXzX5TYLcwsvnafP9t3Np9b0I0xxjyE8X N6Insm+ZYqmnqfDmAeLkWuzo8oJvFVJANtYrpJUTXd0Ra7ItqsQ3Sl7V3Tk3pB/n1JBp GXDdCrPWYBDBlgI53abO0mJrQZC+iJSDTRzUkMUvVzwYwwo8dG3Y39sPfaQTGPS0xCoy UruIyr2qa17M3WpO3N57qly5J8GRtt5wrPdxKZTXOgQeaKzUpsK1cvBr3IZfycffQ6dV +lkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZscckcB8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v9-20020a17090610c900b008c03e7b183dsi24316581ejv.264.2023.02.23.23.30.05; Thu, 23 Feb 2023 23:30:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZscckcB8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229852AbjBXH2f (ORCPT + 99 others); Fri, 24 Feb 2023 02:28:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229778AbjBXH2M (ORCPT ); Fri, 24 Feb 2023 02:28:12 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0550F16ADA; Thu, 23 Feb 2023 23:28:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677223681; x=1708759681; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UOsdS7+owJQ73WNU9ofGpL7BxDN6CoX4IXCHRYhbv+k=; b=ZscckcB8j2PIEaJNbM/mcGDM19ZsA5TiJglT7i0/OXPGx/krEz8XArZ/ xbRCUmi9yg5INoFaey7BtKPgMm7b9pYVp3vF+yxJ1eAWkjoewdoMBtmPb xXRa7lqXA7VtHcdUK5Io9pjim3xiJxz/MqJFbJXoOk4UTZVl6JiUchAUV WOLRHWVwscxIeW5GQxv3BV4/MbnUn/K/DMThnxYi2RNkzfvAG5Yk7DBS4 C2feV79OVNw2DVm1RZtlVJct5kvRAt7tA5L1NC7rCbjkaMWZkwo7gFzoC J9ouVlabage/DLXKbuDlMgjs6+szWlbcYoG0NNoBk/oZMruFgY+DC9jff g==; X-IronPort-AV: E=McAfee;i="6500,9779,10630"; a="334836024" X-IronPort-AV: E=Sophos;i="5.97,324,1669104000"; d="scan'208";a="334836024" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2023 23:27:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10630"; a="815639225" X-IronPort-AV: E=Sophos;i="5.97,324,1669104000"; d="scan'208";a="815639225" Received: from unknown (HELO fred..) ([172.25.112.68]) by fmsmga001.fm.intel.com with ESMTP; 23 Feb 2023 23:27:22 -0800 From: Xin Li To: linux-kernel@vger.kernel.org, x86@kernel.org, kvm@vger.kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, peterz@infradead.org, andrew.cooper3@citrix.com, seanjc@google.com, pbonzini@redhat.com, ravi.v.shankar@intel.com Subject: [RFC PATCH v3 13/32] x86/fred: header file for event types Date: Thu, 23 Feb 2023 23:01:26 -0800 Message-Id: <20230224070145.3572-14-xin3.li@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230224070145.3572-1-xin3.li@intel.com> References: <20230224070145.3572-1-xin3.li@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758696652558161314?= X-GMAIL-MSGID: =?utf-8?q?1758696652558161314?= FRED inherits the Intel VT-x enhancement of classified events with a two-level event dispatch logic. The first-level dispatch is on the event type, not the event vector as used in the IDT architecture. This also means that vectors in different event types are orthogonal, e.g., vectors 0x10-0x1f become available as hardware interrupts. Add a header file for event types, and also use it in . Suggested-by: H. Peter Anvin (Intel) Signed-off-by: Xin Li --- arch/x86/include/asm/event-type.h | 17 +++++++++++++++++ arch/x86/include/asm/vmx.h | 17 +++++++++-------- 2 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 arch/x86/include/asm/event-type.h diff --git a/arch/x86/include/asm/event-type.h b/arch/x86/include/asm/event-type.h new file mode 100644 index 000000000000..fedaa0e492c5 --- /dev/null +++ b/arch/x86/include/asm/event-type.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_X86_EVENT_TYPE_H +#define _ASM_X86_EVENT_TYPE_H + +/* + * Event type codes: these are the same that are used by VTx. + */ +#define EVENT_TYPE_HWINT 0 /* Maskable external interrupt */ +#define EVENT_TYPE_RESERVED 1 +#define EVENT_TYPE_NMI 2 /* Non-maskable interrupt */ +#define EVENT_TYPE_HWFAULT 3 /* Hardware exceptions (e.g., page fault) */ +#define EVENT_TYPE_SWINT 4 /* Software interrupt (INT n) */ +#define EVENT_TYPE_PRIVSW 5 /* INT1 (ICEBP) */ +#define EVENT_TYPE_SWFAULT 6 /* Software exception (INT3 or INTO) */ +#define EVENT_TYPE_OTHER 7 /* FRED: SYSCALL/SYSENTER */ + +#endif diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h index 498dc600bd5c..8d9b8b0d8e56 100644 --- a/arch/x86/include/asm/vmx.h +++ b/arch/x86/include/asm/vmx.h @@ -15,6 +15,7 @@ #include #include #include +#include #include #define VMCS_CONTROL_BIT(x) BIT(VMX_FEATURE_##x & 0x1f) @@ -372,14 +373,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_HWINT << 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_HWFAULT << 8) /* processor exception */ +#define INTR_TYPE_SOFT_INTR (EVENT_TYPE_SWINT << 8) /* software interrupt */ +#define INTR_TYPE_PRIV_SW_EXCEPTION (EVENT_TYPE_PRIVSW << 8) /* ICE breakpoint - undocumented */ +#define INTR_TYPE_SOFT_EXCEPTION (EVENT_TYPE_SWFAULT << 8) /* software exception */ +#define INTR_TYPE_OTHER_EVENT (EVENT_TYPE_OTHER << 8) /* other event */ /* GUEST_INTERRUPTIBILITY_INFO flags. */ #define GUEST_INTR_STATE_STI 0x00000001