[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [XEN][PATCH] xen/domctl: add XEN_DOMCTL_CDF_ALL mask
- To: Teddy Astie <teddy.astie@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- From: Grygorii Strashko <grygorii_strashko@xxxxxxxx>
- Date: Sun, 21 Dec 2025 23:19:37 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=K7tf16p5uVfKOGdFPvoAM40ttXm4vOTqWqvXPCz1Gi4=; b=ReL0J9GjytSN1gzzf10ppZabFMQyX5KwbTpo1Z7UB2PQMfvivascUmy6ND/5J1KytVQXU1YcYy06ZOLR3ubEzGeFvF0W/oQP4xAsFgAI38jqFIVMashHQAMP4awlkFbjCmnuW4926rQ1QoLFugTPplk5WCJMZqkHAa++zSf/xXpShD+78i8KzfFf5WfJP5AtNMQlAOh8+Yhv16YCGGR0NAxaM76aFsQzSkBJGO5gCxtxUfJTjj3xI5p7+QPxU0EcuXTrl+BR7lrdFZnQ+C1GUGuutIEXWa61OCyLpr/sgFnGFOj0msp+PSBMaVrZ7n8FtVXamuNtNjgwDWwCEG7wEA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FA3bDbe0P6LBLHZ1QbS5tfPhf0TuSA+5mZPKyzxeE5LRtspNWNUwYtItgeU+4ekEiBa6OETgRaDcXI9IFH/NXkztQmNf8FKCwAFruU/VZGpqGmepTYCOo6IGzaJxcCPpXaXGFIUJ6LG5E4ASS3D1VsxOJseqfluKMZLXloM3SmdqjKQZJhVZPWqIi4AK3CcTrthgxakv97CDJKkrR+WmSAPCWWYEJ9QPtEaa1WHGI49E8BhgKryIEC+KcQysu1EdbXvrEMlzmU4FthPGGMAi8xWUG5VUqcnhTkNO2QbAvaWs3iwk9r6oK5VmnqGNwrzkfgO0tTOJe8fDmIWQ/7sk/A==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
- Delivery-date: Sun, 21 Dec 2025 21:23:10 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 19.12.25 18:10, Teddy Astie wrote:
Le 18/12/2025 à 16:21, Grygorii Strashko a écrit :
On 11.11.25 22:16, Grygorii Strashko wrote:
From: Grygorii Strashko <grygorii_strashko@xxxxxxxx>
Every XEN_DOMCTL_CDF_x flag:
- is defined in public/domctl.h
- explicitly listed in sanitise_domain_config() (common/domain.c) to form
mask containing all supported DOMCTL_CDF flags for "Unknown CDF flags"
check.
So, it is required to modify two files every time XEN_DOMCTL_CDF_x flags
set is modified.
Simplify the things by introducing XEN_DOMCTL_CDF_ALL mask, so
sanitise_domain_config() no need to be modified any more.
Signed-off-by: Grygorii Strashko <grygorii_strashko@xxxxxxxx>
---
Seems nobody interested, sad, dropping from backlog.
Sorry, I missed this one (I guess others have too).
xen/common/domain.c | 7 +------
xen/include/public/domctl.h | 7 +++++++
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 775c33928585..4f91316ad93e 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -730,12 +730,7 @@ static int sanitise_domain_config(struct
xen_domctl_createdomain *config)
bool iommu = config->flags & XEN_DOMCTL_CDF_iommu;
bool vpmu = config->flags & XEN_DOMCTL_CDF_vpmu;
- if ( config->flags &
- ~(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_vpmu |
- XEN_DOMCTL_CDF_trap_unmapped_accesses) )
+ if ( config->flags & ~XEN_DOMCTL_CDF_ALL )
{
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 8f6708c0a7cd..94a8e3042cbf 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -72,6 +72,13 @@ struct xen_domctl_createdomain {
/* Max XEN_DOMCTL_CDF_* constant. Used for ABI checking. */
#define XEN_DOMCTL_CDF_MAX XEN_DOMCTL_CDF_trap_unmapped_accesses
+#define
XEN_DOMCTL_CDF_ALL \
+ (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_vpmu |
\
+ XEN_DOMCTL_CDF_trap_unmapped_accesses)
+
uint32_t flags;
#define _XEN_DOMCTL_IOMMU_no_sharept 0
Given that we already have XEN_DOMCTL_CDF_MAX, we could base the check
using it instead.
Something like checking fls(config->flags) > fls(XEN_DOMCTL_CDF_MAX) ?
That's what I've tried first.
The problem is that there is possibility of CDF_X to be removed/deprecated,
small, but still it is.
In such case fls() can't be used.
So using define which list allowed flags is safer from long term point of view.
--
Best regards,
-grygorii
|