From patchwork Mon Feb 13 14:57:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xenia Ragiadakou X-Patchwork-Id: 13138537 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 349C0C636D4 for ; Mon, 13 Feb 2023 14:58:16 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.494607.764735 (Exim 4.92) (envelope-from ) id 1pRaHM-0001LF-An; Mon, 13 Feb 2023 14:58:04 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 494607.764735; Mon, 13 Feb 2023 14:58:04 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pRaHM-0001KR-4Z; Mon, 13 Feb 2023 14:58:04 +0000 Received: by outflank-mailman (input) for mailman id 494607; Mon, 13 Feb 2023 14:58:02 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pRaHK-0001Ha-Qm for xen-devel@lists.xenproject.org; Mon, 13 Feb 2023 14:58:02 +0000 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [2a00:1450:4864:20::52b]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id ceaf1c9c-abae-11ed-93b5-47a8fe42b414; Mon, 13 Feb 2023 15:58:00 +0100 (CET) Received: by mail-ed1-x52b.google.com with SMTP id eq11so13271083edb.6 for ; Mon, 13 Feb 2023 06:57:59 -0800 (PST) Received: from uni.router.wind (adsl-89.109.242.225.tellas.gr. [109.242.225.89]) by smtp.googlemail.com with ESMTPSA id v1-20020a50a441000000b004aab66d34c7sm6787617edb.7.2023.02.13.06.57.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Feb 2023 06:57:59 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ceaf1c9c-abae-11ed-93b5-47a8fe42b414 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ADMJRcoEAWm10JX/p9S3CdQyxMC2w4XTtFoR/0gxu3M=; b=X1lGJBJhbDa/titkYOtiVh/LdtY8RONmn7XhmMApll5t74Nm5DTuN5PfrNMKOS3IBD OX5GmHus4G6QcuxoL4EtKl+0OuKMx4x1KxOcYRQu9HSpOVE05YAMg5dd1w866lxLW/64 IivBSvMpb/HOJcc78xLpttA03H0nHBxF4MXqsLNzVW4Bd82JcPZ1R6AQD3VUnwiyAGYM kiu1vhwmBxDWsL4thVzG0f6uaDQW8xUEbII3NiST44OfyAoOl1ADGBpPVCWmBUC5h387 Tq1dqKaMwWxSP3AcCI5L+vu50NBx5PYDQQOBEnTtjzQIkHBBU5oV+2XZme+6lTDWoEgj GHvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ADMJRcoEAWm10JX/p9S3CdQyxMC2w4XTtFoR/0gxu3M=; b=oU09j0XWtg4z9U03w1X/WiAB2wr3uQ9SO2phmCmtN3lzLrr6WN3nSTPBtDKoM/GBAh zNwvNQz8u/9VXFeEClBBHVlwGwVB3KyKPqR3IOtJtzyw+DR0J0GnwPQNppMpLe/xy40h stxiYL8OnORJfzr+/nSpFvUHaVTiRNvTsi8/2hxmWDAACaGTnfLfjDIi3N1+QNr8hSxo e2sPmphWLB6DNkQ0dra7rLDs3gvxy8zvA0IGfuLPqacK7yEmwLxGzf2XBUf+BgYg3gyG Ox5C1NEmYsG99FMGssw8jI39NHrugQ+bLsUnp/2g7bk4A1R18Qoe/AhN7DjPkUIPtJKJ Mb8Q== X-Gm-Message-State: AO0yUKXi0depnXSR5dQ+kIeSvtwOljtPRT5x1PHQtSVou+MHEsLrZkpo 6cb+qyR8hoh90u24F7x96c2Jzq0V3g8= X-Google-Smtp-Source: AK7set9UsZcVfGy81UB7eVU5IdMA6J8v5r9Aj7wABPQloH0Ui0vkXBWyinmWtBM20hhv/+XKmmOtxA== X-Received: by 2002:a50:d70f:0:b0:4ac:b619:80d5 with SMTP id t15-20020a50d70f000000b004acb61980d5mr8494122edi.2.1676300279322; Mon, 13 Feb 2023 06:57:59 -0800 (PST) From: Xenia Ragiadakou To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu , George Dunlap , Paul Durrant Subject: [RFC 01/10] x86: introduce AMD-V and Intel VT-x Kconfig options Date: Mon, 13 Feb 2023 16:57:42 +0200 Message-Id: <20230213145751.1047236-2-burzalodowa@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230213145751.1047236-1-burzalodowa@gmail.com> References: <20230213145751.1047236-1-burzalodowa@gmail.com> MIME-Version: 1.0 Introduce two new Kconfig options, AMD_SVM and INTEL_VMX, to allow code specific to each virtualization technology to be separated and, when not required, stripped. AMD_SVM will be used to enable virtual machine extensions on platforms that implement the AMD Virtualization Technology (AMD-V). INTEL_VMX will be used to enable virtual machine extensions on platforms that implement the Intel Virtualization Technology (Intel VT-x). Both features depend on HVM support. Since, at this point, disabling any of them would cause Xen to not compile, the options are enabled by default if HVM and are not selectable by the user. No functional change intended. Signed-off-by: Xenia Ragiadakou --- xen/arch/x86/Kconfig | 6 ++++++ xen/arch/x86/cpu/Makefile | 4 +++- xen/arch/x86/hvm/Makefile | 4 ++-- xen/arch/x86/mm/Makefile | 3 ++- xen/arch/x86/mm/hap/Makefile | 2 +- xen/drivers/passthrough/Kconfig | 2 +- 6 files changed, 15 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig index 6a7825f4ba..2a72111c23 100644 --- a/xen/arch/x86/Kconfig +++ b/xen/arch/x86/Kconfig @@ -117,6 +117,12 @@ config HVM If unsure, say Y. +config AMD_SVM + def_bool y if HVM + +config INTEL_VMX + def_bool y if HVM + config XEN_SHSTK bool "Supervisor Shadow Stacks" depends on HAS_AS_CET_SS diff --git a/xen/arch/x86/cpu/Makefile b/xen/arch/x86/cpu/Makefile index 35561fe51d..08bdf4abb8 100644 --- a/xen/arch/x86/cpu/Makefile +++ b/xen/arch/x86/cpu/Makefile @@ -10,4 +10,6 @@ obj-y += intel.o obj-y += intel_cacheinfo.o obj-y += mwait-idle.o obj-y += shanghai.o -obj-y += vpmu.o vpmu_amd.o vpmu_intel.o +obj-y += vpmu.o +obj-$(CONFIG_AMD_SVM) += vpmu_amd.o +obj-$(CONFIG_INTEL_VMX) += vpmu_intel.o diff --git a/xen/arch/x86/hvm/Makefile b/xen/arch/x86/hvm/Makefile index 3464191544..4c1fa5c6c2 100644 --- a/xen/arch/x86/hvm/Makefile +++ b/xen/arch/x86/hvm/Makefile @@ -1,5 +1,5 @@ -obj-y += svm/ -obj-y += vmx/ +obj-$(CONFIG_AMD_SVM) += svm/ +obj-$(CONFIG_INTEL_VMX) += vmx/ obj-y += viridian/ obj-y += asid.o diff --git a/xen/arch/x86/mm/Makefile b/xen/arch/x86/mm/Makefile index 0803ac9297..c53c94308a 100644 --- a/xen/arch/x86/mm/Makefile +++ b/xen/arch/x86/mm/Makefile @@ -10,6 +10,7 @@ obj-$(CONFIG_MEM_SHARING) += mem_sharing.o obj-$(CONFIG_HVM) += nested.o obj-$(CONFIG_HVM) += p2m.o obj-y += p2m-basic.o -obj-$(CONFIG_HVM) += p2m-ept.o p2m-pod.o p2m-pt.o +obj-$(CONFIG_HVM) += p2m-pod.o p2m-pt.o +obj-$(CONFIG_INTEL_VMX) += p2m-ept.o obj-y += paging.o obj-y += physmap.o diff --git a/xen/arch/x86/mm/hap/Makefile b/xen/arch/x86/mm/hap/Makefile index 8ef54b1faa..67c29b2162 100644 --- a/xen/arch/x86/mm/hap/Makefile +++ b/xen/arch/x86/mm/hap/Makefile @@ -3,4 +3,4 @@ obj-y += guest_walk_2.o obj-y += guest_walk_3.o obj-y += guest_walk_4.o obj-y += nested_hap.o -obj-y += nested_ept.o +obj-$(CONFIG_INTEL_VMX) += nested_ept.o diff --git a/xen/drivers/passthrough/Kconfig b/xen/drivers/passthrough/Kconfig index 864fcf3b0c..f95e7e5902 100644 --- a/xen/drivers/passthrough/Kconfig +++ b/xen/drivers/passthrough/Kconfig @@ -51,7 +51,7 @@ config AMD_IOMMU config INTEL_IOMMU bool "Intel VT-d" if EXPERT - depends on X86 + depends on X86 && INTEL_VMX default y help Enables I/O virtualization on platforms that implement the From patchwork Mon Feb 13 14:57:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xenia Ragiadakou X-Patchwork-Id: 13138543 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2B736C678D4 for ; Mon, 13 Feb 2023 14:58:17 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.494606.764730 (Exim 4.92) (envelope-from ) id 1pRaHL-0001Ia-Vq; Mon, 13 Feb 2023 14:58:03 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 494606.764730; Mon, 13 Feb 2023 14:58:03 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pRaHL-0001IT-So; Mon, 13 Feb 2023 14:58:03 +0000 Received: by outflank-mailman (input) for mailman id 494606; Mon, 13 Feb 2023 14:58:02 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pRaHK-00012P-2K for xen-devel@lists.xenproject.org; Mon, 13 Feb 2023 14:58:02 +0000 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [2a00:1450:4864:20::530]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id cfae58e8-abae-11ed-933c-83870f6b2ba8; Mon, 13 Feb 2023 15:58:01 +0100 (CET) Received: by mail-ed1-x530.google.com with SMTP id bt8so7469884edb.12 for ; Mon, 13 Feb 2023 06:58:01 -0800 (PST) Received: from uni.router.wind (adsl-89.109.242.225.tellas.gr. [109.242.225.89]) by smtp.googlemail.com with ESMTPSA id v1-20020a50a441000000b004aab66d34c7sm6787617edb.7.2023.02.13.06.58.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Feb 2023 06:58:00 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: cfae58e8-abae-11ed-933c-83870f6b2ba8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HeAl2muVNr+xBWeBNqW6dkb9Qt1VF+mqagJ51IbAAUY=; b=glvTuglrnCswKeleHOErx9yowMgXTUBT9C0pWMfJ/xQX5AgnDJtZgE5M0GiQlOt1qL 7HrGCJUw2pmCiV1UpKPIFD4kW3mOpkCzXx/kmSy61ZtBvCLXO2Dj4xXWzzOb1x/I0bq4 qCX/6njhrE2hX23krceYh9+3FND6fh4co0mo2AfpEimXAayLXuK+wUtLl11yTgTcxoIS eRrEEOTBFQHHT4aLCATyl856hBfV5+8tqyzW5idxN2rLC6qoPLJvW305aodrUVr+AbSC UhgAqQRRKzC5s84GZXENX290OPo13cGrxnf95aPgUGZzRaax8fwTX1RCLpKceP2/g8FK aRqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HeAl2muVNr+xBWeBNqW6dkb9Qt1VF+mqagJ51IbAAUY=; b=V4DF7OKx+8wL8p1GrbTLeRRTeIvULoUQfgxb4GtHKbCmZzdMjuV8ZexS+NqdzlXODH qbYkgKT09XlCPUJ/avPnfhKMGkz4fZPqsKv4I34Y3bmKP6mWiqMLSJQMFW+gX/l0EcQG hjxhCzws3BaHdcLG6YNulRn4jO04lJrSbVXWkcI9Z9B4EEQJ7yeG/3gmBtM6fzLsoIHK YPHluiEPGrGCF4T+5zGsp0jEaK+3VZTV6q9oYCL2Fz/+mZ3QDJ82YsnkzSv8bctx1Sjq cAYrlGVPw3tGHK3gMJEAwc3TuqfUo0NF+tU4/HYgdELychHjPL2dHSQIMh5P55FFwyoM CFxA== X-Gm-Message-State: AO0yUKV1fKi2UPHz6Kc539VszsfqFnX60auqy5trzZRqCkXe+m3HFGvK wR404Sa+6kRu9TgiXXScDIsbZhHjviU= X-Google-Smtp-Source: AK7set9hI4WpTfinHmniGiBvx5mghdRr9a8iXiXXdwGMfGT7ZIOCMmJGN5cjSMJAOKkywpOEaF9zpw== X-Received: by 2002:a50:9ea2:0:b0:4ac:bbaa:867a with SMTP id a31-20020a509ea2000000b004acbbaa867amr7556802edf.24.1676300281111; Mon, 13 Feb 2023 06:58:01 -0800 (PST) From: Xenia Ragiadakou To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu Subject: [RFC 02/10] x86/hvm: separate AMD-V and Intel VT-x hvm_function_table initializers Date: Mon, 13 Feb 2023 16:57:43 +0200 Message-Id: <20230213145751.1047236-3-burzalodowa@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230213145751.1047236-1-burzalodowa@gmail.com> References: <20230213145751.1047236-1-burzalodowa@gmail.com> MIME-Version: 1.0 Since start_svm() is AMD-V specific while start_vmx() is Intel VT-x specific, need to be guarded with AMD_SVM and INTEL_VMX, respectively. Instead of adding #ifdef guards around the function calls, implement them as static inline null-returning functions when the respective technology is not enabled. No functional change intended. Signed-off-by: Xenia Ragiadakou --- xen/arch/x86/include/asm/hvm/hvm.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h index 43d3fc2498..353e48f4e3 100644 --- a/xen/arch/x86/include/asm/hvm/hvm.h +++ b/xen/arch/x86/include/asm/hvm/hvm.h @@ -261,8 +261,16 @@ extern struct hvm_function_table hvm_funcs; extern bool_t hvm_enabled; extern s8 hvm_port80_allowed; +#ifdef CONFIG_AMD_SVM extern const struct hvm_function_table *start_svm(void); +#else +static inline const struct hvm_function_table *start_svm(void) { return NULL; } +#endif +#ifdef CONFIG_INTEL_VMX extern const struct hvm_function_table *start_vmx(void); +#else +static inline const struct hvm_function_table *start_vmx(void) { return NULL; } +#endif int hvm_domain_initialise(struct domain *d, const struct xen_domctl_createdomain *config); From patchwork Mon Feb 13 14:57:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xenia Ragiadakou X-Patchwork-Id: 13138539 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 042B0C64ED9 for ; Mon, 13 Feb 2023 14:58:16 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.494608.764752 (Exim 4.92) (envelope-from ) id 1pRaHO-0001ps-OQ; Mon, 13 Feb 2023 14:58:06 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 494608.764752; Mon, 13 Feb 2023 14:58:06 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pRaHO-0001pd-L2; Mon, 13 Feb 2023 14:58:06 +0000 Received: by outflank-mailman (input) for mailman id 494608; Mon, 13 Feb 2023 14:58:05 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pRaHM-0001Ha-W7 for xen-devel@lists.xenproject.org; Mon, 13 Feb 2023 14:58:05 +0000 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [2a00:1450:4864:20::52b]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id d0d24940-abae-11ed-93b5-47a8fe42b414; Mon, 13 Feb 2023 15:58:03 +0100 (CET) Received: by mail-ed1-x52b.google.com with SMTP id eq11so13271373edb.6 for ; Mon, 13 Feb 2023 06:58:03 -0800 (PST) Received: from uni.router.wind (adsl-89.109.242.225.tellas.gr. [109.242.225.89]) by smtp.googlemail.com with ESMTPSA id v1-20020a50a441000000b004aab66d34c7sm6787617edb.7.2023.02.13.06.58.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Feb 2023 06:58:02 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d0d24940-abae-11ed-93b5-47a8fe42b414 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ehevLc9UhGQTTXawWIjo+7aNcyD01VoFpnNrDZ36mVw=; b=c9lUKLlsbtltLGWVZRSYyjKUzvZBFCrc2pKH061xmq457BT5H00nnOlPWHpQJvU7xH EbMm9buOdH5hGvx/huQcGmVyF8qDpVcVf1oENRftqo1HH0Hwscai5fHS/WTdlvkl8IaA SX0thonEGefecuqO0oyKbsgozeCWdXWW/KKMf1fdM9KOozrFpWOIyS4FPXoVZKp/Ha7T JYF4yavwnmcbSyeULGB73vAF7X/nLc8RF63k2G8ZpacZKvyN60p4IlQT+oYbbPkqy25G nnjy2X4tcJYJG4Q2aHGT+n8eE0kMXVVGrGvvQRLq6BDv3YfMc+sjM+OkENAWC/S/qmh6 PRzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ehevLc9UhGQTTXawWIjo+7aNcyD01VoFpnNrDZ36mVw=; b=qqOpeTFjtJrmOKgO0wZtQuWBEep6CmLP+g3MqBXes7mphlU79pq45boWkJSpC8GlRv XwLbe7obKUr4rYPlqHvEh0chCZPVPb49cqTByq7TyV8FfHVusLNzN6rcD63/E12Civqn rpJbazDeAhS469Y0c3BSvzxH0HB9xrF56ysOeC+rqTBLlnjNl9iKV/9xwxErzGQub3K/ NOrDK9+o/WZnhFq+sBU9VYdt+dCZsi8Nz/3Ms3kWOAZmkXY0gZL96ktUAw89c7aITeJg yiOffKpIht9QLu9ya97e7JC232ew1T65xnCG/1WhGkvu15TUZycighVMef1AImTrrqXH IZ1w== X-Gm-Message-State: AO0yUKW4SlBuJoJGdifF0FQBqO0O7tqA6uaPcvaN9manMphqI1lKXlIu mRFnH5pF4n8sadDPv+uBO+jAG8VvayM= X-Google-Smtp-Source: AK7set/RhU+VKXAMuoVSRcH0AkySbUzaBHdZAEoRN54+E6ZdszX6hHmjPmE+XYWHO9PeKbDe2npL9w== X-Received: by 2002:a50:bb4a:0:b0:4aa:f932:6f49 with SMTP id y68-20020a50bb4a000000b004aaf9326f49mr20931521ede.8.1676300282961; Mon, 13 Feb 2023 06:58:02 -0800 (PST) From: Xenia Ragiadakou To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Andrew Cooper , George Dunlap , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu Subject: [RFC 03/10] x86/p2m: guard vmx specific ept functions with INTEL_VMX Date: Mon, 13 Feb 2023 16:57:44 +0200 Message-Id: <20230213145751.1047236-4-burzalodowa@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230213145751.1047236-1-burzalodowa@gmail.com> References: <20230213145751.1047236-1-burzalodowa@gmail.com> MIME-Version: 1.0 The functions ept_p2m_init(), ept_p2m_uninit() and p2m_init_altp2m_ept() are VT-x specific. Implement them as unreachable static inline functions when !INTEL_VMX. No functional change intended. Signed-off-by: Xenia Ragiadakou --- xen/arch/x86/mm/p2m.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/xen/arch/x86/mm/p2m.h b/xen/arch/x86/mm/p2m.h index cc0f6766e4..ac80414688 100644 --- a/xen/arch/x86/mm/p2m.h +++ b/xen/arch/x86/mm/p2m.h @@ -35,9 +35,25 @@ void p2m_nestedp2m_init(struct p2m_domain *p2m); int p2m_init_nestedp2m(struct domain *d); void p2m_teardown_nestedp2m(struct domain *d); +#ifdef CONFIG_INTEL_VMX int ept_p2m_init(struct p2m_domain *p2m); void ept_p2m_uninit(struct p2m_domain *p2m); void p2m_init_altp2m_ept(struct domain *d, unsigned int i); +#else +static inline int ept_p2m_init(struct p2m_domain *p2m) +{ + ASSERT_UNREACHABLE(); + return -EINVAL; +} +static inline void ept_p2m_uninit(struct p2m_domain *p2m) +{ + ASSERT_UNREACHABLE(); +} +static inline void p2m_init_altp2m_ept(struct domain *d, unsigned int i) +{ + ASSERT_UNREACHABLE(); +} +#endif /* * Local variables: From patchwork Mon Feb 13 14:57:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xenia Ragiadakou X-Patchwork-Id: 13138541 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8EF24C64EC7 for ; Mon, 13 Feb 2023 14:58:16 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.494609.764757 (Exim 4.92) (envelope-from ) id 1pRaHP-0001tn-82; Mon, 13 Feb 2023 14:58:07 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 494609.764757; Mon, 13 Feb 2023 14:58:07 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pRaHP-0001tW-01; Mon, 13 Feb 2023 14:58:07 +0000 Received: by outflank-mailman (input) for mailman id 494609; Mon, 13 Feb 2023 14:58:05 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pRaHN-00012P-IR for xen-devel@lists.xenproject.org; Mon, 13 Feb 2023 14:58:05 +0000 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [2a00:1450:4864:20::52c]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id d1cb4403-abae-11ed-933c-83870f6b2ba8; Mon, 13 Feb 2023 15:58:05 +0100 (CET) Received: by mail-ed1-x52c.google.com with SMTP id w3so6279037edc.2 for ; Mon, 13 Feb 2023 06:58:05 -0800 (PST) Received: from uni.router.wind (adsl-89.109.242.225.tellas.gr. [109.242.225.89]) by smtp.googlemail.com with ESMTPSA id v1-20020a50a441000000b004aab66d34c7sm6787617edb.7.2023.02.13.06.58.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Feb 2023 06:58:04 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d1cb4403-abae-11ed-933c-83870f6b2ba8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ujMzxZfrYB5JFSrASU3fn2r5SzOae7nTM8nRB1r5wJY=; b=qQUzqofAB7XHVlMOJ9/FiXdsAacgiS1HSqi/8gBRNXvR56Oj4eO3O8SJgrLiL9tVEt rfBTy+Qs9j5FxHLjB1uR8NE7soc6tL4v/cm6P4jMtPXiknjOjvWhOrZOUh6zb0ijU4Ep cr0sJL06LieL2T8A2eJgMYsz/7AqDWm0Ld+lEgshwqK1DKHLXbtXO9NTqn5sUqjyQxxZ VInXFl0fSpMym4dxoxV7fcorKp0jetIjKw+QeKDPOiuktGtcGGSZevTby+s9p3xDwi5r JeimrvjdRoXR2C+eEggRYLl22PNakIG5w572SRtHitcKA6yytQRD4oIF4KprCY+6Dk4G H9pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ujMzxZfrYB5JFSrASU3fn2r5SzOae7nTM8nRB1r5wJY=; b=gSAoZc59SWV6eX6ercuQFVU5I+i81uIPNtgRzftWyVYdLXFMeAeT2MCudJyIoCXzR6 b6z3lAAjNNuPXau3tV91fGVfuU6kU0NP9kXa3Jph3PlHtEwV9F3YlBOzwVm/GhuidNsz l2DOs3EBZnu9sQl54jOXZ5FfLtHZstPliUz5uxkfEsV61ht97Sy8uDu9ziDBqfKPPbaI FsSESlidVUkoI7WB2c01uryJGxQT995uqhrB03TxWZnyUrC5s9Hlzs/mB5T7hbEurcgB JTZqU/G5RujoJrlrdPDeWMX55gAsc589/4Ag6p5MtURraVZUdenUKQiQsch2xBuYAELj +tlQ== X-Gm-Message-State: AO0yUKVdyxDasLRnSTP8XxoOvpQmFPxaI64pD94dlOubufBX7EAG3Oky DQI0YsoEJ18IWg51o46IlWfSx+t20E0= X-Google-Smtp-Source: AK7set/AgUit0BtL52XxsnBZB07JuKhunWPqAOd3skmpuIm61VEmLFWBGHZlfOt4Hgg3BEozgoJVnA== X-Received: by 2002:a50:d547:0:b0:4ab:15d9:2dae with SMTP id f7-20020a50d547000000b004ab15d92daemr19565683edj.14.1676300284612; Mon, 13 Feb 2023 06:58:04 -0800 (PST) From: Xenia Ragiadakou To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu Subject: [RFC 04/10] x86/vpmu: separate AMD-V and Intel VT-x init arch_vpmu_ops initializers Date: Mon, 13 Feb 2023 16:57:45 +0200 Message-Id: <20230213145751.1047236-5-burzalodowa@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230213145751.1047236-1-burzalodowa@gmail.com> References: <20230213145751.1047236-1-burzalodowa@gmail.com> MIME-Version: 1.0 The function core2_vpmu_init() is VT-x specific while the functions amd_vpmu_init() and hygon_vpmu_init() are AMD-V specific, thus need to be guarded with INTEL_VMX and AMD_SVM, respectively. Instead of adding #ifdef guards around the function calls in common vpu code, implement them as static inline null-returning functions when the respective technology is not enabled. No functional change intended. Signed-off-by: Xenia Ragiadakou --- xen/arch/x86/include/asm/vpmu.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/xen/arch/x86/include/asm/vpmu.h b/xen/arch/x86/include/asm/vpmu.h index 05e1fbfccf..1e08afb7af 100644 --- a/xen/arch/x86/include/asm/vpmu.h +++ b/xen/arch/x86/include/asm/vpmu.h @@ -53,9 +53,18 @@ struct arch_vpmu_ops { #endif }; +#ifdef CONFIG_INTEL_VMX const struct arch_vpmu_ops *core2_vpmu_init(void); +#else +static inline const struct arch_vpmu_ops *core2_vpmu_init(void) { return NULL; } +#endif /* CONFIG_INTEL_VMX */ +#ifdef CONFIG_AMD_SVM const struct arch_vpmu_ops *amd_vpmu_init(void); const struct arch_vpmu_ops *hygon_vpmu_init(void); +#else +static inline const struct arch_vpmu_ops *amd_vpmu_init(void) { return NULL; } +static inline const struct arch_vpmu_ops *hygon_vpmu_init(void) { return NULL; } +#endif /* CONFIG_AMD_SVM */ struct vpmu_struct { u32 flags; From patchwork Mon Feb 13 14:57:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xenia Ragiadakou X-Patchwork-Id: 13138540 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AF148C64ED6 for ; Mon, 13 Feb 2023 14:58:16 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.494610.764773 (Exim 4.92) (envelope-from ) id 1pRaHR-0002Om-Bq; Mon, 13 Feb 2023 14:58:09 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 494610.764773; Mon, 13 Feb 2023 14:58:09 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pRaHR-0002OT-8O; Mon, 13 Feb 2023 14:58:09 +0000 Received: by outflank-mailman (input) for mailman id 494610; Mon, 13 Feb 2023 14:58:07 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pRaHP-00012P-AL for xen-devel@lists.xenproject.org; Mon, 13 Feb 2023 14:58:07 +0000 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [2a00:1450:4864:20::532]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id d2d8dd28-abae-11ed-933c-83870f6b2ba8; Mon, 13 Feb 2023 15:58:07 +0100 (CET) Received: by mail-ed1-x532.google.com with SMTP id cq19so10543156edb.5 for ; Mon, 13 Feb 2023 06:58:06 -0800 (PST) Received: from uni.router.wind (adsl-89.109.242.225.tellas.gr. [109.242.225.89]) by smtp.googlemail.com with ESMTPSA id v1-20020a50a441000000b004aab66d34c7sm6787617edb.7.2023.02.13.06.58.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Feb 2023 06:58:06 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d2d8dd28-abae-11ed-933c-83870f6b2ba8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=U5v/N22n2LqrdW7DqMvxVswsNGoZiD6T9tF2GDu61pk=; b=idPIyCoiAFOpr5KMigzgO35lMseihPsh34sqaciuVp5Ygz9GLa7eWZonWDYfOCrxAB re2+zBMqX9MiMvnygNeaBpZEzON46mN3PH1gZ6OxBrf+QhyHdaS68SRvmlYgXx1j3P8x r49v//ABzPD4Pg/N50IMvXwTocp7/nlHqFR6KGf7ymZ4aANcKw6pSnzkLs4liqLTW97/ MEtHTz0R+nvbw5NeNPVAobkgLQbsLh0NOUR6g92dk56bJriOT4PUpzTtb8j8lMbAm62E kkaUxlxtd+/c287k5fzOj6VepT8YAlGGsUZBA1SD5Nu8gBrKV28rMcnUJdTTUTe3QI9O VPtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=U5v/N22n2LqrdW7DqMvxVswsNGoZiD6T9tF2GDu61pk=; b=sJM2SfcY7fj1CDlPTI2slfuoGfU9HBiBJzhtOQnTClF+8kpTuQ/DobKRHVF04JDjph yxooVRbk2fxq1f/LDzYOpNKvDBLpsQXAsrwaQCTb1o82FxwiqR8YaUGEEOeAsD6Qj5TI A1g0W5pIQi12dffY/gbxT2VUM6kLxlocvIRSJkJwAzXXBKdCgPIbbswrx393E3FVZ5QD 1v7NawJSmqQIcjfK7suHIW2JUi1M7gPOjAI1iyDuLfZmSFVMTqf/o1vGBYtgIz0DVIZ1 CQr+u4Jjih1K1zQ22rTzaUm2oZfxDuCsQNFd82urZqkZYgVqrdbMfgMZO6Tp9BTK2Ul8 o80g== X-Gm-Message-State: AO0yUKXeoBgOHRFrmSIEVfj7GIiTLWjp7sEFGTkFBanOV/xk73bFCLX+ I0cuGqulNUerPoTy6BbE1hbPvIHYkUQ= X-Google-Smtp-Source: AK7set+oN4N2dbUMeM0v4BVjErq8kcyFD7IfbCxSH+ypx9T+wfJHOSIhZukL+SrLDTQe0dn6y3ij+Q== X-Received: by 2002:a50:cd48:0:b0:47e:eaae:9a69 with SMTP id d8-20020a50cd48000000b0047eeaae9a69mr25788468edj.41.1676300286331; Mon, 13 Feb 2023 06:58:06 -0800 (PST) From: Xenia Ragiadakou To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu Subject: [RFC 05/10] x86/traps: guard vmx specific functions with INTEL_VMX Date: Mon, 13 Feb 2023 16:57:46 +0200 Message-Id: <20230213145751.1047236-6-burzalodowa@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230213145751.1047236-1-burzalodowa@gmail.com> References: <20230213145751.1047236-1-burzalodowa@gmail.com> MIME-Version: 1.0 The functions vmx_vmcs_enter() and vmx_vmcs_exit() are VT-x specific. Guard their calls with INTEL_VMX. No functional change intended. Signed-off-by: Xenia Ragiadakou Acked-by: Jan Beulich --- xen/arch/x86/traps.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index cade9e12f8..77b4f772f2 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -694,7 +694,7 @@ void vcpu_show_execution_state(struct vcpu *v) vcpu_pause(v); /* acceptably dangerous */ -#ifdef CONFIG_HVM +#ifdef CONFIG_INTEL_VMX /* * For VMX special care is needed: Reading some of the register state will * require VMCS accesses. Engaging foreign VMCSes involves acquiring of a @@ -732,7 +732,7 @@ void vcpu_show_execution_state(struct vcpu *v) console_unlock_recursive_irqrestore(flags); } -#ifdef CONFIG_HVM +#ifdef CONFIG_INTEL_VMX if ( cpu_has_vmx && is_hvm_vcpu(v) ) vmx_vmcs_exit(v); #endif From patchwork Mon Feb 13 14:57:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xenia Ragiadakou X-Patchwork-Id: 13138542 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 33D5DC677F1 for ; Mon, 13 Feb 2023 14:58:18 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.494611.764785 (Exim 4.92) (envelope-from ) id 1pRaHT-0002jf-Nd; Mon, 13 Feb 2023 14:58:11 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 494611.764785; Mon, 13 Feb 2023 14:58:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pRaHT-0002jX-Js; Mon, 13 Feb 2023 14:58:11 +0000 Received: by outflank-mailman (input) for mailman id 494611; Mon, 13 Feb 2023 14:58:10 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pRaHS-0001Ha-3d for xen-devel@lists.xenproject.org; Mon, 13 Feb 2023 14:58:10 +0000 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [2a00:1450:4864:20::534]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id d3c4ce85-abae-11ed-93b5-47a8fe42b414; Mon, 13 Feb 2023 15:58:08 +0100 (CET) Received: by mail-ed1-x534.google.com with SMTP id fj20so13307858edb.1 for ; Mon, 13 Feb 2023 06:58:08 -0800 (PST) Received: from uni.router.wind (adsl-89.109.242.225.tellas.gr. [109.242.225.89]) by smtp.googlemail.com with ESMTPSA id v1-20020a50a441000000b004aab66d34c7sm6787617edb.7.2023.02.13.06.58.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Feb 2023 06:58:07 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d3c4ce85-abae-11ed-93b5-47a8fe42b414 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3ysij/ro07c0+TJWrYCtfS1joxXIrIyAx6s1ZIXpyeE=; b=FTblwDg1zWMM5BWbt/RyBbkeX6ZNWCNhXCIr31OBqIsdO403hTub6k4ryOSHp4apJ9 1Q1n8OeNkZxFyfI+A16rDQROCTh673T/AnBLay8tifziYwmZwNaXghuxzzb7tkUpGw+L 2f09xIlOSdLF5jmY681wVvoFdPPJOERENu1jYpwWphmsv+RL77liwbRpiaHwMJsxYBzD t3HCxHiLCwm1sceFOFNgbxQfndZZLoLfGecFd15iGrG59zHot3MXi4mVUN3BGDKoCT8P plOkEACe8phLE3lyGbIM9nAEEhxWfL1SqmrHmKl3NjLVk4UcTi1P7QvJczp944GDoJO0 FSzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3ysij/ro07c0+TJWrYCtfS1joxXIrIyAx6s1ZIXpyeE=; b=hAfNhwTPcdv7J2i56jIEDQMzXX96vffVLw+aYLaVOIDVJRPrZ+VVeP2Oub0LDqFd1E 75YvzOw7SRMYjbdyfepwunQZMh/2+3RrujvkZe3f5Z2nV48VKqqQ0SqIeI5QERV6i/vo 69GIv6PGkaulF0CNfnJTPR8sn8rBzuRyr416x+ojY2mrmI1y1z0mE9EZ3yt+9UsUTSrL 27YoWvm1zqhzle8g0zwVsyrf9e+udQSkWWizIOBQ7z7RsZb/gyeqpzg0rh4paxC0B/8A RIFMK5k7zflLguW2QjyB87m+UYShG9JGh5WJkaiC6kr4qJv75w+gYdCBhB4LrJ0a8kBX LDmg== X-Gm-Message-State: AO0yUKWNQ10Mmt8eXTiTAjXw1OB0MgLzLsU6OTZcxv7M9jVN7oe8QveE SE5+RWmFfPdH2FyLt7RLUn3J+yKkJck= X-Google-Smtp-Source: AK7set+GkQzuNUROaeZkqPhJFMYN6bRqV/h4LSzc3WsL+gk+OfUAqC1YutzN7Qknx+IQLfp3UmAd+w== X-Received: by 2002:a50:a681:0:b0:4ac:c123:cd8f with SMTP id e1-20020a50a681000000b004acc123cd8fmr5228426edc.11.1676300287974; Mon, 13 Feb 2023 06:58:07 -0800 (PST) From: Xenia Ragiadakou To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu Subject: [RFC 06/10] x86/domain: guard svm specific functions with AMD_SVM Date: Mon, 13 Feb 2023 16:57:47 +0200 Message-Id: <20230213145751.1047236-7-burzalodowa@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230213145751.1047236-1-burzalodowa@gmail.com> References: <20230213145751.1047236-1-burzalodowa@gmail.com> MIME-Version: 1.0 The functions svm_load_segs() and svm_load_segs_prefetch() are AMD-V specific so guard their calls in common code with AMD_SVM. Since AMD_SVM depends on HVM, it can be used alone. No functional change intended. Signed-off-by: Xenia Ragiadakou Acked-by: Jan Beulich --- xen/arch/x86/domain.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index db3ebf062d..576a410f4f 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -1628,7 +1628,7 @@ static void load_segments(struct vcpu *n) if ( !(n->arch.flags & TF_kernel_mode) ) SWAP(gsb, gss); -#ifdef CONFIG_HVM +#ifdef CONFIG_AMD_SVM if ( cpu_has_svm && (uregs->fs | uregs->gs) <= 3 ) fs_gs_done = svm_load_segs(n->arch.pv.ldt_ents, LDT_VIRT_START(n), n->arch.pv.fs_base, gsb, gss); @@ -1951,7 +1951,7 @@ static void __context_switch(void) write_ptbase(n); -#if defined(CONFIG_PV) && defined(CONFIG_HVM) +#if defined(CONFIG_PV) && defined(CONFIG_AMD_SVM) /* Prefetch the VMCB if we expect to use it later in the context switch */ if ( cpu_has_svm && is_pv_64bit_domain(nd) && !is_idle_domain(nd) ) svm_load_segs_prefetch(); From patchwork Mon Feb 13 14:57:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xenia Ragiadakou X-Patchwork-Id: 13138544 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0085AC636CC for ; Mon, 13 Feb 2023 14:58:18 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.494612.764791 (Exim 4.92) (envelope-from ) id 1pRaHU-0002nj-9c; Mon, 13 Feb 2023 14:58:12 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 494612.764791; Mon, 13 Feb 2023 14:58:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pRaHT-0002mt-VU; Mon, 13 Feb 2023 14:58:11 +0000 Received: by outflank-mailman (input) for mailman id 494612; Mon, 13 Feb 2023 14:58:10 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pRaHS-00012P-K0 for xen-devel@lists.xenproject.org; Mon, 13 Feb 2023 14:58:10 +0000 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [2a00:1450:4864:20::536]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id d4d22d39-abae-11ed-933c-83870f6b2ba8; Mon, 13 Feb 2023 15:58:10 +0100 (CET) Received: by mail-ed1-x536.google.com with SMTP id dz21so1248919edb.13 for ; Mon, 13 Feb 2023 06:58:10 -0800 (PST) Received: from uni.router.wind (adsl-89.109.242.225.tellas.gr. [109.242.225.89]) by smtp.googlemail.com with ESMTPSA id v1-20020a50a441000000b004aab66d34c7sm6787617edb.7.2023.02.13.06.58.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Feb 2023 06:58:09 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d4d22d39-abae-11ed-933c-83870f6b2ba8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uTOuRMzovcu9U8yHdgtcg1aC/lNK90HeqMCP2DHSHtQ=; b=Uhk4AJdyUbsybuROvfNH7szECAyg6hEOSh/H07XBFIwbnYN6q6PxvBa6FQiCoot/MO VEM/q9LQtmW6uhQeHAALxuWc1w0fBsOCEWYU8iiZu1/gs4jaR5bVl7XfxnG1E2S1RM8/ Xg1BYvAS1CxV9tITTRaWtGZHy8C2GSRTu4ILaTWIPQmbbo5JTggo++dWJOemx72etxTK jRTKnaL5+1UOXBbTVD+fqN2tgUhz4VM8PT0HYp2pv9LBwq76+wYnSdUOLm/zgDVjyBEK Pm3DtKO6QhdHT8hRlNhYYfbGwgQDlMuDCwe/zZAM9SSs2f8GgpPQhi4lZssgPqJDI4LA fkLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uTOuRMzovcu9U8yHdgtcg1aC/lNK90HeqMCP2DHSHtQ=; b=hcYQiLXBz/aSBMpeFmWsXAuioN2ld5NvMiYM4pHnweI5ForoKDGyk0KoNijajFJ3UC bN3BzlBBxzjd9s56J/3msGGtrljiA2057Q8912Hs0/uPDNZxJdaEUSl7Ewp+X33MKEZo 4PC/mhTidy4M2H12hH0NYuCWbYMXYcWA+KhDpNoHAbIsuBq3NQEmiAlvZ9cnagvEFHLT XVUMGMh7yxrrB17gcG+d6fbBwPqk7+dB6SM342On3znb3yUoiThtgBnpliSU4FUlQG1w qOrvUxphyuCUrIPgOR2oZHn+Xny/tG7o5RG4K1yzC+SVyaMtZEovarJ/3fazbg36ojuR UTQg== X-Gm-Message-State: AO0yUKX934p0U1V73HdMvLHkEeIgplpwVi2pXzAjyPmTsDW9qtdQVZ0G 0UfnSvYNVYOvB0n3yNZDRuEGWY15hGA= X-Google-Smtp-Source: AK7set9hXBu2M70GkVjxBxm3e15BzI8avJlnuyZR2dQq6aszC7C4QNGHdcTvn/vrdCT7HnC9og3zOQ== X-Received: by 2002:a50:d69b:0:b0:4ac:b866:7ebb with SMTP id r27-20020a50d69b000000b004acb8667ebbmr7971508edi.9.1676300289730; Mon, 13 Feb 2023 06:58:09 -0800 (PST) From: Xenia Ragiadakou To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu Subject: [RFC 07/10] x86/oprofile: guard svm specific symbols with AMD_SVM Date: Mon, 13 Feb 2023 16:57:48 +0200 Message-Id: <20230213145751.1047236-8-burzalodowa@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230213145751.1047236-1-burzalodowa@gmail.com> References: <20230213145751.1047236-1-burzalodowa@gmail.com> MIME-Version: 1.0 The symbol svm_stgi_label is AMD-V specific so guard its usage in common code with AMD_SVM. Since AMD_SVM depends on HVM, it can be used alone. Also, use #ifdef instead of #if. No functional change intended. Signed-off-by: Xenia Ragiadakou Acked-by: Jan Beulich --- xen/arch/x86/oprofile/op_model_athlon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/oprofile/op_model_athlon.c b/xen/arch/x86/oprofile/op_model_athlon.c index 69fd3fcc86..782fa606ee 100644 --- a/xen/arch/x86/oprofile/op_model_athlon.c +++ b/xen/arch/x86/oprofile/op_model_athlon.c @@ -320,7 +320,7 @@ static int cf_check athlon_check_ctrs( struct vcpu *v = current; unsigned int const nr_ctrs = model->num_counters; -#if CONFIG_HVM +#ifdef CONFIG_AMD_SVM struct cpu_user_regs *guest_regs = guest_cpu_user_regs(); if (!guest_mode(regs) && From patchwork Mon Feb 13 14:57:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xenia Ragiadakou X-Patchwork-Id: 13138545 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A77B5C6379F for ; Mon, 13 Feb 2023 14:58:20 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.494615.764807 (Exim 4.92) (envelope-from ) id 1pRaHW-0003Qi-S6; Mon, 13 Feb 2023 14:58:14 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 494615.764807; Mon, 13 Feb 2023 14:58:14 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pRaHW-0003QU-KK; Mon, 13 Feb 2023 14:58:14 +0000 Received: by outflank-mailman (input) for mailman id 494615; Mon, 13 Feb 2023 14:58:13 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pRaHV-0001Ha-Mj for xen-devel@lists.xenproject.org; Mon, 13 Feb 2023 14:58:13 +0000 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [2a00:1450:4864:20::530]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id d5e0b7d7-abae-11ed-93b5-47a8fe42b414; Mon, 13 Feb 2023 15:58:12 +0100 (CET) Received: by mail-ed1-x530.google.com with SMTP id a10so13250838edu.9 for ; Mon, 13 Feb 2023 06:58:12 -0800 (PST) Received: from uni.router.wind (adsl-89.109.242.225.tellas.gr. [109.242.225.89]) by smtp.googlemail.com with ESMTPSA id v1-20020a50a441000000b004aab66d34c7sm6787617edb.7.2023.02.13.06.58.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Feb 2023 06:58:11 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d5e0b7d7-abae-11ed-93b5-47a8fe42b414 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MvIoc5bBDL+U3AaRn4Z94l9PVnkFFMdQ2k/Ww5bMv0w=; b=JdMx4mznZ0/8VCrN7/smpGbxw2TcphyETjng1zV9KYbGGVRaESxC+YVH+QLmKMcwkv 2x1zLE9zM4IT0SWlFQ6Lb9FxMlcrKtVKs3cSonckkza7fuawSuWmc6ffbFng1eYmgF/3 oecTjTmqv8krRF4saVRHxKikfhJE5fS4x5nBYGkp5CanYufUBDBOsYtivWp0Psx/uTgw q0qeAiRaFjv7P3vikuPmM06m0Rvk2Y2D3Zq+02s915L6Yw7ZMmS4A9/CkHK9GiC8leZU HQDLeeRMtPjgj9TE6wt1LQVRLTL0QLaiu/fFgob9fFsTXNhE7utpMuIhPyd3CJp5hp8W BP8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MvIoc5bBDL+U3AaRn4Z94l9PVnkFFMdQ2k/Ww5bMv0w=; b=54i7I8seBsriLBhwm0qAjM5T64YLYjFSmXoZRpK1g8wvZZwVxYirlJYw0MRL/8JHDE k/hR001axfNJqlTfrRK+KemXVu83aBstY/mQTqChMKXyalL4LxFkCEBg/dAEKHizxK/J DvoP4ufOAGrgMiUH0Z2DWtdDODEFjiNfYvMZkuK+M8IDjIycgZLwltpxxVAfS6YfDTCM fKiwQ40QVs1OyUbLo3J5EF8iXvYKy3UAox53gWRB5AcS3wbD6cmvBVxrSA6uoZKriD0R 80T4CC5b5szMNw+GIoOTSDcUgN9ftQTEEwKRS4oSDk1GJgBC3G2Pv5j0vLQ6Ck0gNsYA idag== X-Gm-Message-State: AO0yUKWQWc7zC37oOGRnRSpEbLjphbNTphEFdncl4whExHYnVwXSXh3Y BPTOvQVf5Y5SWw8LE2tna2H2IPhUWUg= X-Google-Smtp-Source: AK7set9ISVZ/9+WhCVxmbwk/PEEwSzL7YpdteuK90ToMhP7WfzgjriLjNFMIjhZGZ5oqPZO1Z0CoMQ== X-Received: by 2002:a50:8d1e:0:b0:4ac:c426:6b4a with SMTP id s30-20020a508d1e000000b004acc4266b4amr4832781eds.36.1676300291502; Mon, 13 Feb 2023 06:58:11 -0800 (PST) From: Xenia Ragiadakou To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu , Jun Nakajima , Kevin Tian Subject: [RFC 08/10] x86: wire cpu_has_svm/vmx_* to false when svm/vmx not enabled Date: Mon, 13 Feb 2023 16:57:49 +0200 Message-Id: <20230213145751.1047236-9-burzalodowa@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230213145751.1047236-1-burzalodowa@gmail.com> References: <20230213145751.1047236-1-burzalodowa@gmail.com> MIME-Version: 1.0 To be able to use cpu_has_svm/vmx_* macros in common code without enclosing them inside #ifdef guards when the respective virtualization technology is not enabled, define them as false when not applicable. No functional change intended. Signed-off-by: Xenia Ragiadakou --- xen/arch/x86/include/asm/hvm/svm/svm.h | 17 ++++++++++++ xen/arch/x86/include/asm/hvm/vmx/vmcs.h | 35 +++++++++++++++++++++++++ xen/arch/x86/include/asm/hvm/vmx/vmx.h | 18 +++++++++++++ 3 files changed, 70 insertions(+) diff --git a/xen/arch/x86/include/asm/hvm/svm/svm.h b/xen/arch/x86/include/asm/hvm/svm/svm.h index 65e35a4f59..556584851b 100644 --- a/xen/arch/x86/include/asm/hvm/svm/svm.h +++ b/xen/arch/x86/include/asm/hvm/svm/svm.h @@ -80,6 +80,7 @@ extern u32 svm_feature_flags; #define SVM_FEATURE_SSS 19 /* NPT Supervisor Shadow Stacks */ #define SVM_FEATURE_SPEC_CTRL 20 /* MSR_SPEC_CTRL virtualisation */ +#ifdef CONFIG_AMD_SVM #define cpu_has_svm_feature(f) (svm_feature_flags & (1u << (f))) #define cpu_has_svm_npt cpu_has_svm_feature(SVM_FEATURE_NPT) #define cpu_has_svm_lbrv cpu_has_svm_feature(SVM_FEATURE_LBRV) @@ -95,6 +96,22 @@ extern u32 svm_feature_flags; #define cpu_has_svm_vloadsave cpu_has_svm_feature(SVM_FEATURE_VLOADSAVE) #define cpu_has_svm_sss cpu_has_svm_feature(SVM_FEATURE_SSS) #define cpu_has_svm_spec_ctrl cpu_has_svm_feature(SVM_FEATURE_SPEC_CTRL) +#else +#define cpu_has_svm_npt false +#define cpu_has_svm_lbrv false +#define cpu_has_svm_svml false +#define cpu_has_svm_nrips false +#define cpu_has_svm_cleanbits false +#define cpu_has_svm_flushbyasid false +#define cpu_has_svm_decode false +#define cpu_has_svm_vgif false +#define cpu_has_pause_filter false +#define cpu_has_pause_thresh false +#define cpu_has_tsc_ratio false +#define cpu_has_svm_vloadsave false +#define cpu_has_svm_sss false +#define cpu_has_svm_spec_ctrl false +#endif /* CONFIG_AMD_SVM */ #define SVM_PAUSEFILTER_INIT 4000 #define SVM_PAUSETHRESH_INIT 1000 diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h index 0a84e74478..03d1f7480a 100644 --- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h +++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h @@ -294,6 +294,7 @@ extern u64 vmx_ept_vpid_cap; #define VMX_TSC_MULTIPLIER_MAX 0xffffffffffffffffULL +#ifdef CONFIG_INTEL_VMX #define cpu_has_wbinvd_exiting \ (vmx_secondary_exec_control & SECONDARY_EXEC_WBINVD_EXITING) #define cpu_has_vmx_virtualize_apic_accesses \ @@ -352,6 +353,36 @@ extern u64 vmx_ept_vpid_cap; (vmx_secondary_exec_control & SECONDARY_EXEC_BUS_LOCK_DETECTION) #define cpu_has_vmx_notify_vm_exiting \ (vmx_secondary_exec_control & SECONDARY_EXEC_NOTIFY_VM_EXITING) +#else +#define cpu_has_wbinvd_exiting false +#define cpu_has_vmx_virtualize_apic_accesses false +#define cpu_has_vmx_tpr_shadow false +#define cpu_has_vmx_vnmi false +#define cpu_has_vmx_msr_bitmap false +#define cpu_has_vmx_secondary_exec_control false +#define cpu_has_vmx_ept false +#define cpu_has_vmx_dt_exiting false +#define cpu_has_vmx_vpid false +#define cpu_has_monitor_trap_flag false +#define cpu_has_vmx_pat false +#define cpu_has_vmx_efer false +#define cpu_has_vmx_unrestricted_guest false +#define vmx_unrestricted_guest(v) false +#define cpu_has_vmx_ple false +#define cpu_has_vmx_apic_reg_virt false +#define cpu_has_vmx_virtual_intr_delivery false +#define cpu_has_vmx_virtualize_x2apic_mode false +#define cpu_has_vmx_posted_intr_processing false +#define cpu_has_vmx_vmcs_shadowing false +#define cpu_has_vmx_vmfunc false +#define cpu_has_vmx_virt_exceptions false +#define cpu_has_vmx_pml false +#define cpu_has_vmx_mpx false +#define cpu_has_vmx_xsaves false +#define cpu_has_vmx_tsc_scaling false +#define cpu_has_vmx_bus_lock_detection false +#define cpu_has_vmx_notify_vm_exiting false +#endif /* CONFIG_INTEL_VMX */ #define VMCS_RID_TYPE_MASK 0x80000000 @@ -374,8 +405,12 @@ extern u64 vmx_ept_vpid_cap; #define VMX_BASIC_DEFAULT1_ZERO (1ULL << 55) extern u64 vmx_basic_msr; +#ifdef CONFIG_INTEL_VMX #define cpu_has_vmx_ins_outs_instr_info \ (!!(vmx_basic_msr & VMX_BASIC_INS_OUT_INFO)) +#else +#define cpu_has_vmx_ins_outs_instr_info false +#endif /* CONFIG_INTEL_VMX */ /* Guest interrupt status */ #define VMX_GUEST_INTR_STATUS_SUBFIELD_BITMASK 0x0FF diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmx.h b/xen/arch/x86/include/asm/hvm/vmx/vmx.h index 97d6b810ec..fe9a5796f7 100644 --- a/xen/arch/x86/include/asm/hvm/vmx/vmx.h +++ b/xen/arch/x86/include/asm/hvm/vmx/vmx.h @@ -289,6 +289,7 @@ typedef union cr_access_qual { extern uint8_t posted_intr_vector; +#ifdef CONFIG_INTEL_VMX #define cpu_has_vmx_ept_exec_only_supported \ (vmx_ept_vpid_cap & VMX_EPT_EXEC_ONLY_SUPPORTED) @@ -301,6 +302,17 @@ extern uint8_t posted_intr_vector; #define cpu_has_vmx_ept_ad (vmx_ept_vpid_cap & VMX_EPT_AD_BIT) #define cpu_has_vmx_ept_invept_single_context \ (vmx_ept_vpid_cap & VMX_EPT_INVEPT_SINGLE_CONTEXT) +#else +#define cpu_has_vmx_ept_exec_only_supported false + +#define cpu_has_vmx_ept_wl4_supported false +#define cpu_has_vmx_ept_mt_uc false +#define cpu_has_vmx_ept_mt_wb false +#define cpu_has_vmx_ept_2mb false +#define cpu_has_vmx_ept_1gb false +#define cpu_has_vmx_ept_ad false +#define cpu_has_vmx_ept_invept_single_context false +#endif /* CONFIG_INTEL_VMX */ #define EPT_2MB_SHIFT 16 #define EPT_1GB_SHIFT 17 @@ -310,12 +322,18 @@ extern uint8_t posted_intr_vector; #define INVEPT_SINGLE_CONTEXT 1 #define INVEPT_ALL_CONTEXT 2 +#ifdef CONFIG_INTEL_VMX #define cpu_has_vmx_vpid_invvpid_individual_addr \ (vmx_ept_vpid_cap & VMX_VPID_INVVPID_INDIVIDUAL_ADDR) #define cpu_has_vmx_vpid_invvpid_single_context \ (vmx_ept_vpid_cap & VMX_VPID_INVVPID_SINGLE_CONTEXT) #define cpu_has_vmx_vpid_invvpid_single_context_retaining_global \ (vmx_ept_vpid_cap & VMX_VPID_INVVPID_SINGLE_CONTEXT_RETAINING_GLOBAL) +#else +#define cpu_has_vmx_vpid_invvpid_individual_addr false +#define cpu_has_vmx_vpid_invvpid_single_context false +#define cpu_has_vmx_vpid_invvpid_single_context_retaining_global false +#endif /* CONFIG_INTEL_VMX */ #define INVVPID_INDIVIDUAL_ADDR 0 #define INVVPID_SINGLE_CONTEXT 1 From patchwork Mon Feb 13 14:57:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xenia Ragiadakou X-Patchwork-Id: 13138546 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4C245C636D4 for ; Mon, 13 Feb 2023 14:58:23 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.494617.764818 (Exim 4.92) (envelope-from ) id 1pRaHY-0003jw-GL; Mon, 13 Feb 2023 14:58:16 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 494617.764818; Mon, 13 Feb 2023 14:58:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pRaHY-0003io-4d; Mon, 13 Feb 2023 14:58:16 +0000 Received: by outflank-mailman (input) for mailman id 494617; Mon, 13 Feb 2023 14:58:14 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pRaHW-00012P-Lk for xen-devel@lists.xenproject.org; Mon, 13 Feb 2023 14:58:14 +0000 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [2a00:1450:4864:20::52e]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id d6ef06c8-abae-11ed-933c-83870f6b2ba8; Mon, 13 Feb 2023 15:58:13 +0100 (CET) Received: by mail-ed1-x52e.google.com with SMTP id s11so5549253edd.10 for ; Mon, 13 Feb 2023 06:58:13 -0800 (PST) Received: from uni.router.wind (adsl-89.109.242.225.tellas.gr. [109.242.225.89]) by smtp.googlemail.com with ESMTPSA id v1-20020a50a441000000b004aab66d34c7sm6787617edb.7.2023.02.13.06.58.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Feb 2023 06:58:13 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d6ef06c8-abae-11ed-933c-83870f6b2ba8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jy9MxG42u4Nv2Kmf3LwoFoiWXt3O4JC+9pElyhn6lpo=; b=g1GhuG7H3AgAo9I6Y1zdnMtEETZeI+HeHhmx99n/fL0O5qNoMAKeKwh7SzcG5XeR80 ueYyHZx+ACWlx/FAa0jzJszlhNfrp61mgSapkQQgmQquZd8d33yBWw/twVDeBygdT4bf aS5MwAz1Y0l+gsOX5QzNWbtghjofy5Y549nK+mJHghFjnaUj4KMid5fjGgiHNBPMdfMa G4rk9LtJfht9pgMmF5KaMh+9c4kDqdn79hP/cYG691ES2z3XN4U7Fcc5fVUkAnfdmepL /2sPbV3otOOKGJWF2bFi8zP7sfXIzUhlm/fz6yrFyXyqHMFlAxyVtVOkJppDRkptfvyL 2XXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jy9MxG42u4Nv2Kmf3LwoFoiWXt3O4JC+9pElyhn6lpo=; b=6bBm3S6JgWzMgFtK6hj/ktk8+NsX+mxmz/SYuDjJ118NNQ5umFdvxLozS1Q8E+pmLD 4kgbIdMo8yUIQr225gVREQeJRNfKE6sDyrXdLD+IDR0wBGloOZz2kO9M434j4/rjiGTf S6bBmjwXOYafzo7h3F3zXsfN2gghFxC5xdpAakfEos97ScEiGCPpf+wfGp9kpMmNDqCP UrfcEcCVXWEm+0PBZi2sA1R8OYjpZJXaeVJI4u7CjkYYyuRzbRoIF5ZWKqMOOpJ9f4j9 uwOByv7yX2Lf6t9zI4TiFeMXi7FEboSW2ZsPJxrq5fmKQQ0PahytwZoRDWam4SwsonDu RNOg== X-Gm-Message-State: AO0yUKV4CabVj+Ab0hvys1tZyCkZVoVhGrRX8s/NXnxe7yJB72X4i/BZ DcdGtKVo1XhlG6z88qFCyXqUnHlb+HU= X-Google-Smtp-Source: AK7set/sApjHPPTP1O6/z1JAvOV1iMnOSIJgco5nBsKflB+rmX5HgDRq3yl+57+4mm7+OY4MuOWzww== X-Received: by 2002:a50:874a:0:b0:4ab:f6c:1a47 with SMTP id 10-20020a50874a000000b004ab0f6c1a47mr19075094edv.31.1676300293281; Mon, 13 Feb 2023 06:58:13 -0800 (PST) From: Xenia Ragiadakou To: xen-devel@lists.xenproject.org Cc: Paul Durrant , Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu Subject: [RFC 09/10] x86/ioreq: guard VIO_realmode_completion with INTEL_VMX Date: Mon, 13 Feb 2023 16:57:50 +0200 Message-Id: <20230213145751.1047236-10-burzalodowa@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230213145751.1047236-1-burzalodowa@gmail.com> References: <20230213145751.1047236-1-burzalodowa@gmail.com> MIME-Version: 1.0 VIO_realmode_completion is specific to vmx realmode, so guard the completion handling code with INTEL_VMX. No functional change intended. Signed-off-by: Xenia Ragiadakou --- xen/arch/x86/hvm/ioreq.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c index 0bdcca1e1a..1b0c0f1b12 100644 --- a/xen/arch/x86/hvm/ioreq.c +++ b/xen/arch/x86/hvm/ioreq.c @@ -44,6 +44,7 @@ bool arch_vcpu_ioreq_completion(enum vio_completion completion) { switch ( completion ) { +#ifdef CONFIG_INTEL_VMX case VIO_realmode_completion: { struct hvm_emulate_ctxt ctxt; @@ -54,6 +55,7 @@ bool arch_vcpu_ioreq_completion(enum vio_completion completion) break; } +#endif default: ASSERT_UNREACHABLE(); From patchwork Mon Feb 13 14:57:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xenia Ragiadakou X-Patchwork-Id: 13138547 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CA408C6379F for ; Mon, 13 Feb 2023 14:58:24 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.494621.764829 (Exim 4.92) (envelope-from ) id 1pRaHa-0004Mh-Qq; Mon, 13 Feb 2023 14:58:18 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 494621.764829; Mon, 13 Feb 2023 14:58:18 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pRaHa-0004MP-JG; Mon, 13 Feb 2023 14:58:18 +0000 Received: by outflank-mailman (input) for mailman id 494621; Mon, 13 Feb 2023 14:58:17 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pRaHY-0001Ha-Vn for xen-devel@lists.xenproject.org; Mon, 13 Feb 2023 14:58:17 +0000 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [2a00:1450:4864:20::52b]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id d7fe0c09-abae-11ed-93b5-47a8fe42b414; Mon, 13 Feb 2023 15:58:15 +0100 (CET) Received: by mail-ed1-x52b.google.com with SMTP id eq11so13272291edb.6 for ; Mon, 13 Feb 2023 06:58:15 -0800 (PST) Received: from uni.router.wind (adsl-89.109.242.225.tellas.gr. [109.242.225.89]) by smtp.googlemail.com with ESMTPSA id v1-20020a50a441000000b004aab66d34c7sm6787617edb.7.2023.02.13.06.58.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Feb 2023 06:58:14 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d7fe0c09-abae-11ed-93b5-47a8fe42b414 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=z4XxNzz7rqsriFu3pt/xtkLxxWkI8GAzMmbRJ9k+P3k=; b=LIVU7Nn9rKw1Sx2lMV6AQsc501lDTNYf4YUZT8T+RQe3HEnEcWlUAkLkCDBPHdyeSn XSYCHC2ioaJPSJBc9pmsL4o4K9FZBIOKyLkM+ScNiB2zZEifYfYubSp1CnZJGEdhwE6x PHhKCUpimVfjTaqgC101oXU7Im8XBkpB4N8GxkE9RsIvnkNhzgp+nD1yLT2wWwD7jvqj o6LRjEXXX8Qw1wVsBF/nMyLFE6X4ngRMNvQJ9U4AEaUZ3NA4QZjiCId7fNHfCavXhEWm aqdlxa7HOc8BCSlnKFYsicDqhdiUQAVxRU7nnmyfSja0TYVaUVx6q/crAORjbImsbOWF dYOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=z4XxNzz7rqsriFu3pt/xtkLxxWkI8GAzMmbRJ9k+P3k=; b=RTHCgql5+CuBdg8LBKmmeiPQeOiuEGakkJluYntETneh5YBkzxlPoWB97cBKrWizf6 PKqyA0oE/9coMAUCKcTWHvE/VYr2KXk4lOiUTriei+ltK8K67w2Bo/Jmp26FA3IRqcR2 o35djpte9YEY4jVmoDkhovnU2t+a4mH+BCMThysTP0TYfLQTFN5ZZNmPxuDqrRv+V6Ft YAaAGTDb/looVP3W5gXmtLP1BT+sXyG1tAg1DuC6mDSvkTsg2yUDWk6mcM9+YLHMdCaP dh91JrHB2YH6lFI8G5jk/hRSCPB7AfN5v27dz2eOVbgmw1Oh1J4DWWnqEPujdySmFq7z STqw== X-Gm-Message-State: AO0yUKX4PSsLK1nMcYDMEQvxOx1LYHiOSACou3GNhHFDMJQ9GugjRAtK GdWdiowsdimlqMmDUAgewqXdnM/xTIY= X-Google-Smtp-Source: AK7set+qOVFZEYPqf6090xY3A1jG/4TWdiNMUokFCls7wZJZ0YWyYbbwmfdRqnyNYh17MWf/omyhwg== X-Received: by 2002:a50:8705:0:b0:4ab:4569:4b9f with SMTP id i5-20020a508705000000b004ab45694b9fmr10836818edb.0.1676300294999; Mon, 13 Feb 2023 06:58:14 -0800 (PST) From: Xenia Ragiadakou To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu Subject: [RFC 10/10] x86/hvm: make AMD-V and Intel VT-x support configurable Date: Mon, 13 Feb 2023 16:57:51 +0200 Message-Id: <20230213145751.1047236-11-burzalodowa@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230213145751.1047236-1-burzalodowa@gmail.com> References: <20230213145751.1047236-1-burzalodowa@gmail.com> MIME-Version: 1.0 Provide the user with configuration control over the cpu virtualization support in Xen by making AMD_SVM and INTEL_VMX options user selectable. To preserve the current default behavior, both options depend on HVM and default to Y. To prevent users from unknowingly disabling virtualization support, make the controls user selectable only if EXPERT is enabled. No functional change intended. Signed-off-by: Xenia Ragiadakou --- xen/arch/x86/Kconfig | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig index 2a72111c23..fce40f08b1 100644 --- a/xen/arch/x86/Kconfig +++ b/xen/arch/x86/Kconfig @@ -118,10 +118,24 @@ config HVM If unsure, say Y. config AMD_SVM - def_bool y if HVM + bool "AMD-V" if EXPERT + depends on HVM + default y + help + Enables virtual machine extensions on platforms that implement the + AMD Virtualization Technology (AMD-V). + If your system includes a processor with AMD-V support, say Y. + If in doubt, say Y. config INTEL_VMX - def_bool y if HVM + bool "Intel VT-x" if EXPERT + depends on HVM + default y + help + Enables virtual machine extensions on platforms that implement the + Intel Virtualization Technology (Intel VT-x). + If your system includes a processor with Intel VT-x support, say Y. + If in doubt, say Y. config XEN_SHSTK bool "Supervisor Shadow Stacks"