From nobody Fri Nov 29 18:29:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=arm.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1633348617578586.4075602962108; Mon, 4 Oct 2021 04:56:57 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.201370.355847 (Exim 4.92) (envelope-from ) id 1mXMaK-0006KQ-RB; Mon, 04 Oct 2021 11:56:44 +0000 Received: by outflank-mailman (output) from mailman id 201370.355847; Mon, 04 Oct 2021 11:56:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mXMaK-0006KJ-N7; Mon, 04 Oct 2021 11:56:44 +0000 Received: by outflank-mailman (input) for mailman id 201370; Mon, 04 Oct 2021 11:56:43 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mXMaI-0006Jn-V8 for xen-devel@lists.xenproject.org; Mon, 04 Oct 2021 11:56:42 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id 1f972611-3141-4d9f-b216-6868f93f684d; Mon, 04 Oct 2021 11:56:40 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9E438D6E; Mon, 4 Oct 2021 04:56:40 -0700 (PDT) Received: from e109506.cambridge.arm.com (e109506.cambridge.arm.com [10.1.199.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BC3D93F70D; Mon, 4 Oct 2021 04:56:38 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 1f972611-3141-4d9f-b216-6868f93f684d From: Rahul Singh To: xen-devel@lists.xenproject.org Cc: bertrand.marquis@arm.com, rahul.singh@arm.com, Andre.Przywara@arm.com, Christian Lindig , David Scott , Ian Jackson , Wei Liu , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Volodymyr Babchuk , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 10/14] xen/domctl: Introduce XEN_DOMCTL_CDF_vpci flag Date: Mon, 4 Oct 2021 12:52:05 +0100 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1633348619596100001 Content-Type: text/plain; charset="utf-8" Introduce XEN_DOMCTL_CDF_vpci flag to enable VPCI support in XEN. Reject the use of this new flag for x86 as VPCI is not supported for DOMU guests for x86. Signed-off-by: Rahul Singh Acked-by: Christian Lindig > Reviewed-by: Stefano Stabellini --- Change in v4: Added in this version --- --- tools/ocaml/libs/xc/xenctrl.ml | 1 + tools/ocaml/libs/xc/xenctrl.mli | 1 + xen/arch/arm/domain.c | 4 ++-- xen/arch/x86/domain.c | 6 ++++++ xen/common/domain.c | 2 +- xen/include/public/domctl.h | 4 +++- 6 files changed, 14 insertions(+), 4 deletions(-) diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml index a5588c643f..7ed1c00e47 100644 --- a/tools/ocaml/libs/xc/xenctrl.ml +++ b/tools/ocaml/libs/xc/xenctrl.ml @@ -69,6 +69,7 @@ type domain_create_flag =3D | CDF_XS_DOMAIN | CDF_IOMMU | CDF_NESTED_VIRT + | CDF_VPCI =20 type domain_create_iommu_opts =3D | IOMMU_NO_SHAREPT diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.= mli index 6e94940a8a..391d4abdf8 100644 --- a/tools/ocaml/libs/xc/xenctrl.mli +++ b/tools/ocaml/libs/xc/xenctrl.mli @@ -62,6 +62,7 @@ type domain_create_flag =3D | CDF_XS_DOMAIN | CDF_IOMMU | CDF_NESTED_VIRT + | CDF_VPCI =20 type domain_create_iommu_opts =3D | IOMMU_NO_SHAREPT diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 19c756ac3d..36138c1b2e 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -622,8 +622,8 @@ int arch_sanitise_domain_config(struct xen_domctl_creat= edomain *config) { unsigned int max_vcpus; =20 - /* HVM and HAP must be set. IOMMU may or may not be */ - if ( (config->flags & ~XEN_DOMCTL_CDF_iommu) !=3D + /* HVM and HAP must be set. IOMMU and VPCI may or may not be */ + if ( (config->flags & ~XEN_DOMCTL_CDF_iommu & ~XEN_DOMCTL_CDF_vpci) != =3D (XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap) ) { dprintk(XENLOG_INFO, "Unsupported configuration %#x\n", diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index ef1812dc14..79c2aa4636 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -662,6 +662,12 @@ int arch_sanitise_domain_config(struct xen_domctl_crea= tedomain *config) return -EINVAL; } =20 + if ( config->flags & XEN_DOMCTL_CDF_vpci ) + { + dprintk(XENLOG_INFO, "vPCI cannot be enabled yet\n"); + return -EINVAL; + } + if ( config->vmtrace_size ) { unsigned int size =3D config->vmtrace_size; diff --git a/xen/common/domain.c b/xen/common/domain.c index 6ee5d033b0..40d67ec342 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -483,7 +483,7 @@ static int sanitise_domain_config(struct xen_domctl_cre= atedomain *config) ~(XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap | XEN_DOMCTL_CDF_s3_integrity | XEN_DOMCTL_CDF_oos_off | XEN_DOMCTL_CDF_xs_domain | XEN_DOMCTL_CDF_iommu | - XEN_DOMCTL_CDF_nested_virt) ) + XEN_DOMCTL_CDF_nested_virt | XEN_DOMCTL_CDF_vpci) ) { dprintk(XENLOG_INFO, "Unknown CDF flags %#x\n", config->flags); return -EINVAL; diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h index 96696e3842..4245da3f45 100644 --- a/xen/include/public/domctl.h +++ b/xen/include/public/domctl.h @@ -70,9 +70,11 @@ struct xen_domctl_createdomain { #define XEN_DOMCTL_CDF_iommu (1U<<_XEN_DOMCTL_CDF_iommu) #define _XEN_DOMCTL_CDF_nested_virt 6 #define XEN_DOMCTL_CDF_nested_virt (1U << _XEN_DOMCTL_CDF_nested_virt) +#define _XEN_DOMCTL_CDF_vpci 7 +#define XEN_DOMCTL_CDF_vpci (1U << _XEN_DOMCTL_CDF_vpci) =20 /* Max XEN_DOMCTL_CDF_* constant. Used for ABI checking. */ -#define XEN_DOMCTL_CDF_MAX XEN_DOMCTL_CDF_nested_virt +#define XEN_DOMCTL_CDF_MAX XEN_DOMCTL_CDF_vpci =20 uint32_t flags; =20 --=20 2.25.1