From nobody Sun Dec 14 05:55:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1765512423; cv=pass; d=zohomail.com; s=zohoarc; b=LUNoL6hfWDE2qIS6goFtvi9fKeDvklRCyuu17GKagCZMrQ51+fRakmXVGdV3x1IBI4crU4Jw/P/aZH+9XVQwevpdg4CXdLiugZOHnfmMi8JZswOc9GBKi6XnRl18qwbC9RiZTVdsvxcvp5VZjdQEcN47KGX91NQEjGL+NgTobTM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765512423; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=azldVw3LRxDX4G3fQuaEQzTV1XLt1yT4AZM75H1BB28=; b=eqO963AAJzjRYQKOyXHwEBjNaLNHdn8W7+IJa6baTbQMzOpSIoHZjZqQdeaOjPfayFaADxIOc/mYvfiO96uXfK6yZdnBaAJ4FnFhQgn1cY5MwLQVNd3BelM2ogh/I3nH7IOAG0H61G9BIGhgQYRnPNMiB+ep2NEw9CzCHJ4dKRQ= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1765512422993777.6677041219158; Thu, 11 Dec 2025 20:07:02 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1184893.1507182 (Exim 4.92) (envelope-from ) id 1vTuQO-0007Sl-Tm; Fri, 12 Dec 2025 04:06:36 +0000 Received: by outflank-mailman (output) from mailman id 1184893.1507182; Fri, 12 Dec 2025 04:06:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vTuQO-0007Se-R2; Fri, 12 Dec 2025 04:06:36 +0000 Received: by outflank-mailman (input) for mailman id 1184893; Fri, 12 Dec 2025 04:06:35 +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 1vTuQN-0007Dl-F2 for xen-devel@lists.xenproject.org; Fri, 12 Dec 2025 04:06:35 +0000 Received: from SA9PR02CU001.outbound.protection.outlook.com (mail-southcentralusazlp170130001.outbound.protection.outlook.com [2a01:111:f403:c10c::1]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ee7d1c40-d70f-11f0-b15b-2bf370ae4941; Fri, 12 Dec 2025 05:06:27 +0100 (CET) Received: from BL0PR02CA0036.namprd02.prod.outlook.com (2603:10b6:207:3c::49) by DM6PR12MB4369.namprd12.prod.outlook.com (2603:10b6:5:2a1::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.10; Fri, 12 Dec 2025 04:06:23 +0000 Received: from BL02EPF00029929.namprd02.prod.outlook.com (2603:10b6:207:3c:cafe::62) by BL0PR02CA0036.outlook.office365.com (2603:10b6:207:3c::49) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9412.8 via Frontend Transport; Fri, 12 Dec 2025 04:06:23 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by BL02EPF00029929.mail.protection.outlook.com (10.167.249.54) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.4 via Frontend Transport; Fri, 12 Dec 2025 04:06:23 +0000 Received: from penny-System-Product-Name.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Thu, 11 Dec 2025 22:06:21 -0600 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: ee7d1c40-d70f-11f0-b15b-2bf370ae4941 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=zEmg+qlR4vwHAlFTQZWsU29BYG8/cNr0ojahX31J3I3wVF+WlbPoWdn7TAkrnU1y5qEEXOyNMBD3wCO55G/KvfsJtxilFfkpJwZfZCFp8hNyCnj/8UAt99iROq7xNmi+p7cbZw43HlteW6OMHqxqeKM43+3uLeLethJ+rw8Zw6fmOz3cbsmT7v+q21Jn4ggvfcSWeqd+jfQ0arRdPsIgGsZ79M47hkjb0SjFFk6HMcGF3yOLoQPYhL7JFtyyfbRVoJN121eqGDqRjChV6Sqd7nE0eZzekdQqF1iQFTHKcgMq0onKYwO9a7EaonvBY6Xruf1kIMuSuRn/HrwZUc3D0A== 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=azldVw3LRxDX4G3fQuaEQzTV1XLt1yT4AZM75H1BB28=; b=ARNvnk9d4F9uds1dAreSI3YRxFT1IAiG8JU9eGOzazbF+zof3IAdstYFPZIVDdZH3wKA1aoTXG9DJTKnwxiZPEpiaocQKUZfuvs/wERYnLrkhAh9VFF81YPOEb4e2n5GXmXymYHcxEBtIE1AXytGGqz35mZllmKIhKuFT5wYPa1/ym+O5S4utNCCWJsOP/PbtSUSVG7bZMelm31T5csFhZEWPp9h5amPFyBB5JAqZoS/q2OZKdRrH3oQiIO8blsQpZgXtZi7u2PVBkbON1+pJ1qeqmQheMzybojI2PUt5nuwJewYXtDo5dEAFND9D2O+TT9Z2icgUtVChGSf5rWZDA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=azldVw3LRxDX4G3fQuaEQzTV1XLt1yT4AZM75H1BB28=; b=0lm3eOVd0OB0F9zGkoep50AKqNBHnnlBHX8lCWwbBvWEmoYLtmrI/1dT7UOEQvNMqeGkr5haDwcIeN5wOVtlOfh5RxyvAkrcnB0hBzhcimuQqUKB6EWJb1tqS1/DGXYC3WV4JmzxYZrhvhA0CdWGb3i3cw1Gw6x8LVJ1KhLCGxc= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; 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; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C From: Penny Zheng To: CC: , , Penny Zheng , "Daniel P. Smith" , "Jan Beulich" Subject: [PATCH v5 01/24] xen/xsm: remove redundant flask_iomem_mapping() Date: Fri, 12 Dec 2025 12:01:46 +0800 Message-ID: <20251212040209.1970553-2-Penny.Zheng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251212040209.1970553-1-Penny.Zheng@amd.com> References: <20251212040209.1970553-1-Penny.Zheng@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00029929:EE_|DM6PR12MB4369:EE_ X-MS-Office365-Filtering-Correlation-Id: 11989606-9acf-4352-c2f8-08de3933d03b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|376014|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?XyffYdFAjWaZeAtdmehN/8ApiLKC8aA1cYz22RAf+YW2QegRGtQHWy/xkvyJ?= =?us-ascii?Q?xiD8UvOFfe2yDBlD6RVX71vFaVJTHziF15Xie5xjW+3e5MfGwSLibi5HdaIN?= =?us-ascii?Q?ueO4kG4sENeBS86hjLExdNpF3hiKCpsuJIcDCfiBCHndiGqpyQF5NjwZrctW?= =?us-ascii?Q?qXBApIeEvRAfxODfLwFrPDZSfxz0Gfx8l2q/aBBKGeo9cOVji8r8U52qLbWb?= =?us-ascii?Q?iQEZ9JhExuHhWNCR1q+cunKYl15J6mBORukwajawRij3xg5D4p8XlaXXG0mM?= =?us-ascii?Q?8PAFOfBJbjFwkFl6nVerpAXmefU9fvduvVcaKCET6fQDOoPBvfOg1eFBU9kD?= =?us-ascii?Q?OAF/4u055LJiVorJgZZd0J26TxMO4/4mzep0qgCf72Pb7x/vRNKSD+tS6uCh?= =?us-ascii?Q?bi9M0+XVJ8Kib4xiJ8abQ0JMCs6dJnht7DoSRJH+h3VWDHbgVEE3b24+HUr+?= =?us-ascii?Q?A6yWZxVmd7BgAE6uKRzjTo+p6bnQje/OpBg8iI1HnnlJfA1oQA6UL5Kih9Po?= =?us-ascii?Q?4V+Xijmt9xTOLuYbkbHIaVqQvL/31LJDmLT1GJ5AXLSkULi9VNio9acoNOLr?= =?us-ascii?Q?K6CeBzwARkxSSc848+hBHLeEQxXpTST84zj+jbIAb2GI16PEwRGnZbXEqCIh?= =?us-ascii?Q?eh0PvWvLhNfIOwBPpj5Hk4DUT403YF14oA3iBqDtrn72FiSea8mmanDiCdlJ?= =?us-ascii?Q?p/TZHHRIk2RpOWtSTZvhNJ+wcQ1K7ZOXXdixfq1ZSQhaYl39tWzpi/TNiMAR?= =?us-ascii?Q?pVYaK7ydiU3Rxdf8ArIBMon//a5HeLili98Lnl9OFXvRF18XvrfLHK4om0Lf?= =?us-ascii?Q?jpYBAu7F0ocF9mLPLifV4W1udPOQBCW7A+/kJN6To/lh3V4uDI5D7fXO1RLv?= =?us-ascii?Q?kw8sIeXIaY+07LivDEFdzzgAeWerGzxPwXH4mitxl+B28LPWLEnwABp956z/?= =?us-ascii?Q?LSgz2a7ujqaMHQeZyUHd12xeuDJPYFoBIjLZFTT1N41PZoyXsZSNGaMe/L23?= =?us-ascii?Q?Ot871UgtDuOiwCTP1PK7xSNXelB4O/+eQe5/UNLxCrkCzk/6rcR+CnYruZX0?= =?us-ascii?Q?CCH+MMLeAPEBqH/2V/GsX+Iujv7N8K4h9BossNjF1UhfQg6cOXf3KMg3aCSD?= =?us-ascii?Q?Hp2v75LXulNdmz0rHDeD4Rop31yQZN8MLyJ+w4TAsQUSMs0quq1X2nCYu4JQ?= =?us-ascii?Q?Q7iB1CUEGQ8oKmsreySq2kYca6cJPJu34Vip7biIj22U2MHlsBzLhbGuhLuY?= =?us-ascii?Q?dWZHt0muXfo3yRvNtA5iSUAoEQeB94v92jG2CqM4ws1Ky3YY3xUPv68ANyx7?= =?us-ascii?Q?adiwe9q7/9W9btV6/u9xDyBAdEa00vgSHYpaTUdzGtY8RUmJBveZuC26lyfq?= =?us-ascii?Q?gC+v7myEmEpUwysSGvGxZu+zAs6LhkD3FlFgq6sy/IvkrruKHdzA27ubOqa9?= =?us-ascii?Q?Ad2rS3qLLYFDydbE/E+W2tGatu1BMlRgbmvPhmOuIGXeY2aC0IIsWh46TzlK?= =?us-ascii?Q?RZRf4J8XZRJwZrzqHoHSOmsrhJv+uFMtGaHy3VWP5NZERXvo70ARYDej0hwK?= =?us-ascii?Q?wcox8htgj8y6ZrT7fZ0=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(1800799024)(376014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2025 04:06:23.2523 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 11989606-9acf-4352-c2f8-08de3933d03b X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00029929.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4369 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1765512424046158500 Content-Type: text/plain; charset="utf-8" xsm_iomem_mapping() in flask policy seems redundant, as it only provides an extra call layer by calling flask_iomem_permission(). It also has benefit of making a cf_check disappearing too. Suggested-by: Jan Beulich Signed-off-by: Penny Zheng --- v2 -> v3: - new commit --- v4 -> v5: - only folding redundant xsm_iomem_mapping() implementation --- xen/xsm/flask/hooks.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c index 9f3915617c..a43cd361a2 100644 --- a/xen/xsm/flask/hooks.c +++ b/xen/xsm/flask/hooks.c @@ -1167,11 +1167,6 @@ static int cf_check flask_iomem_permission( return security_iterate_iomem_sids(start, end, _iomem_has_perm, &data); } =20 -static int cf_check flask_iomem_mapping(struct domain *d, uint64_t start, = uint64_t end, uint8_t access) -{ - return flask_iomem_permission(d, start, end, access); -} - static int cf_check flask_pci_config_permission( struct domain *d, uint32_t machine_bdf, uint16_t start, uint16_t end, uint8_t access) @@ -1945,7 +1940,7 @@ static const struct xsm_ops __initconst_cf_clobber fl= ask_ops =3D { .unbind_pt_irq =3D flask_unbind_pt_irq, .irq_permission =3D flask_irq_permission, .iomem_permission =3D flask_iomem_permission, - .iomem_mapping =3D flask_iomem_mapping, + .iomem_mapping =3D flask_iomem_permission, .pci_config_permission =3D flask_pci_config_permission, =20 .resource_plug_core =3D flask_resource_plug_core, --=20 2.34.1 From nobody Sun Dec 14 05:55:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1765512427; cv=pass; d=zohomail.com; s=zohoarc; b=BODby/wznjeQSmnYW2BV/2lDg8csHfgkyG9delM3U0POCKnXlM48r1M7EbvMrzK8KJmQsS27xrX7erLdBmlJKVpJn43prwx9q6hml8+m4ljZIs6GjGQzr1GRTLv2gyKQgbrmwcM4RX8d7Pazq07ug49KZj1NuEbOTkCt+NlJpb0= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765512427; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=H8kEpXRvqr8MrFDJ2wvTbPkfdGzZSeSHrE84ezAGE34=; b=dyzydoZalAd6pUG/EPoxlG5xpMrvcEHUYMkBOZ7ShZ2H0CTukMu7HaPshlAzGoNO/Q8jah5yGM7i8FBWcp8dsEwzznK7ArI4NvJ/lQOYzMEgY0vZ1gOFln5TY3Dy1RXUYJddnCYhnqDd417RctO5iHEAGkUDE3TSxes2z9ianA4= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1765512427556896.9528519854454; Thu, 11 Dec 2025 20:07:07 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1184895.1507194 (Exim 4.92) (envelope-from ) id 1vTuQQ-0007j1-CV; Fri, 12 Dec 2025 04:06:38 +0000 Received: by outflank-mailman (output) from mailman id 1184895.1507194; Fri, 12 Dec 2025 04:06:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vTuQQ-0007i3-8A; Fri, 12 Dec 2025 04:06:38 +0000 Received: by outflank-mailman (input) for mailman id 1184895; Fri, 12 Dec 2025 04:06:37 +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 1vTuQO-0007SS-Q2 for xen-devel@lists.xenproject.org; Fri, 12 Dec 2025 04:06:37 +0000 Received: from SN4PR2101CU001.outbound.protection.outlook.com (mail-southcentralusazlp170120001.outbound.protection.outlook.com [2a01:111:f403:c10d::1]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id f18e1697-d70f-11f0-9cce-f158ae23cfc8; Fri, 12 Dec 2025 05:06:33 +0100 (CET) Received: from MN2PR18CA0028.namprd18.prod.outlook.com (2603:10b6:208:23c::33) by LV2PR12MB5966.namprd12.prod.outlook.com (2603:10b6:408:171::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.10; Fri, 12 Dec 2025 04:06:27 +0000 Received: from BL02EPF0002992B.namprd02.prod.outlook.com (2603:10b6:208:23c:cafe::37) by MN2PR18CA0028.outlook.office365.com (2603:10b6:208:23c::33) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9388.16 via Frontend Transport; Fri, 12 Dec 2025 04:05:45 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by BL02EPF0002992B.mail.protection.outlook.com (10.167.249.56) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.4 via Frontend Transport; Fri, 12 Dec 2025 04:06:26 +0000 Received: from penny-System-Product-Name.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Thu, 11 Dec 2025 22:06:23 -0600 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: f18e1697-d70f-11f0-9cce-f158ae23cfc8 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Y57Zy71ynCrEmBsD9ITzj6hCSJKrx1SYavN8zsaVdOXzULjUSIm4E7kd0ykIUDmYvkyPTsawp+FjoAkpOtk6+nMP4GaybLJK2ajWfGz62k15/bqjuXZ8dgSDm9E0JOtAnzzQ4Jzrcz5mG8v/b0GGyr0ZUr9QJPJHyFO58cfkDezwJuosB6/pKPNW3iAI1GwPgXVnEugRS9QTE13RW5cOL+X58sNsrxtinjbZ9rPa711TAWgjmRh8B1WHFm2RK3/n+E6ensJZk71kVS58Iab3Vb0taM7dRvlGJp4aZ8DQ0EqXsz3S3YEuTCzFzThFufVdY3rRxRJsDjJNE4hZsK6Bkw== 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=H8kEpXRvqr8MrFDJ2wvTbPkfdGzZSeSHrE84ezAGE34=; b=cRlOV7T6deCVtD57oWgGiiohhmc2lPcevD91OUNcbi48zKLcIfORq1sZFwplJQkgiEqU44vQvjSbSGSzssoRqojtur8pVI9mt8OmmmM3wHD7zfdoHfZUr0ZqMzCQkpY3ES5jJ095Ixae7O1KOoEF5hzw4U5Gtsj9TFQYwolBxn3ZuyXC4dfHsasQqgEncLXx7V9PWlZEQ/y22TLZ+lCZ6sAdqNkZFoopfiR/94JeKIpXgyfLd55zYH0sYU/RDgG/gDVnm75hDTu17aSodblaZ99QH+cv8Oy70N2PULGYhe/60GbD6p+fzCDTAuzbn42nj9NvO13oZMWBZCFkGG1uPQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=H8kEpXRvqr8MrFDJ2wvTbPkfdGzZSeSHrE84ezAGE34=; b=BkHokY3UPicgMmUoTB9iuxIKuPEpfKSNrqhClRMmtrQEkNZZJ5veUl81ty+CEjr93/o+8IeTpSqFGUXmv7yNnSLYNbpcULN8W/x1kV1GLo5m+Cg/PaCK27wlX7LkV61ou04FqVu6iF7JWIkw+0JhbmFzSLHvjM3OW9B8UchsoKc= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; 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; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C From: Penny Zheng To: CC: , , Penny Zheng , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Anthony PERARD , "Michal Orzel" , Julien Grall , "Stefano Stabellini" , Juergen Gross Subject: [PATCH v5 02/24] xen/x86: library-fy cpuid-releated functions Date: Fri, 12 Dec 2025 12:01:47 +0800 Message-ID: <20251212040209.1970553-3-Penny.Zheng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251212040209.1970553-1-Penny.Zheng@amd.com> References: <20251212040209.1970553-1-Penny.Zheng@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0002992B:EE_|LV2PR12MB5966:EE_ X-MS-Office365-Filtering-Correlation-Id: 3e1c4b18-f28b-459c-f07d-08de3933d237 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?VsTmTsMT1UqhEAvbB7kuSqxziCTbEhzS2Ur8SWFRVUEgxNukNu34feWmq7I/?= =?us-ascii?Q?DHeftFavsH7bFDVsLsEva2keOzvUnMp9bM7tI5JJJG6iJZZECQgVBOqkbOyK?= =?us-ascii?Q?62TKzaw5Y3Y1gWe+KHzeYTqSfvSN9rUeUyDDLPbGtL6nnJgIRSTt5CMoNniK?= =?us-ascii?Q?FY6jzLuVjwljDwvhgq2k5GUViPfIeGAE79m77IIk/w1NXPf94Rs7C0p3Jb4h?= =?us-ascii?Q?L5WjPgh3tg3JNnv3Df2QPNkSLtdRtokIXj/mrf4YgT+sBnTWlDxJTNtw0sdG?= =?us-ascii?Q?hlT5wfNsuxSWB0lN7e4x5mpMacRdh9v9M1j9xd0fHuFzTWnRW6V0kJACKE51?= =?us-ascii?Q?G7Gv/c4OHPjQmxwab6mmFrTAL9LfadF8XAB3Y9Djd0zIj4CpCGP6/A8IJMs2?= =?us-ascii?Q?Qg2RLyqVDtCXGWXQjpJGTEgYGxGSuz8SisRzLD+e+8vpm2xSbttETieg1Ljd?= =?us-ascii?Q?+ve9I5SnzlG4eLWE2iuxYe8x5qCCtgbBu5tG/Ko9Wn8IRnzF1F2GJSi1GWVx?= =?us-ascii?Q?10jSimavxd7egCp99SVx7Qy5FvoerYL/0s9z1JAJnJv8ulPZvKmx1RHRexwn?= =?us-ascii?Q?Ixdnp0tpIDN7xkfUkb2+45+c7g5omBQ5eV25vARZAy6l/aiM61HghmF/LjTs?= =?us-ascii?Q?K8YBne55wtsWJkGZEbUBtgcKFqN6A60+DpO3//Od24ULCWHT3vysjukSNeYQ?= =?us-ascii?Q?rthnEKH1TblNypRSr6ma5cGmj7Rkf50kiTRLZjYo4ipf0/ReDV0jp6knFlql?= =?us-ascii?Q?0BeDUFyv0drdjrpSD6Lt1V9wZXVZpLtXHIkob3oB3hfPWEwP5pMKEX46d1y4?= =?us-ascii?Q?TzLyWRpAtemrZVf2Al9ZK4KcvWHe0tL3lknhb6noGpIrkm2pO2hIqD6hcvcj?= =?us-ascii?Q?8fd4Yj6qiMQRW23yFw9sMrILWZLjdwdGWQzwRQIwkRnksrVbfw2dVJ2j42zM?= =?us-ascii?Q?iMIlPUpBX61hgJrsqvoaqjEt7lmUMXa209lG2rLYBAK7sVgbm2Rg5YdmCG7u?= =?us-ascii?Q?b9A1PNhv2kH2/VA9GNgs3vlnuCvQAh91OASjBZqCiS/dutkruN55Xwer85NV?= =?us-ascii?Q?Q3pGIz/oEj5fS7RtzQjLES6383NszXZlu8frfhitCs+QEDvh8w3kQUEcHxSV?= =?us-ascii?Q?eaziYlaXRUGgZZzkboZlKXfd/aBmOz7fP5ZkrY1GtoWokRZ6ouydkI0FiTOB?= =?us-ascii?Q?zrojSoMa0meLSTTH/grcB0VxEn7Qm2T2Z+g8SlHMVXLaCqWc8eEadlS2Jau4?= =?us-ascii?Q?2U0NRY/scSL1JdAM2qFlQwC8+tBSHL14pLYd8U5lFGhPs5Fx+EIV27X1fpOz?= =?us-ascii?Q?p8r54riuPanPEDnQ9V8+ub/gYt68H6AvQa7/wNFCUXNNnkXtnIFVSPDDDpEl?= =?us-ascii?Q?7YMoqlJfA8ZOwRUTzO78cCpEkQjiA9mzWfIwoB8N/bgmYsCmV8NxePR5wbkq?= =?us-ascii?Q?DvtbynuTfZTJQXXJ53QlpCb46JKalr83AUcmiRknPABGDoA7PjCpj812KyXw?= =?us-ascii?Q?5saKsEWx7+9xFQ3Hq35wGR7EvJ+c0f5Cytk+j9ysJPj+rv0X5yFFVroG5R1i?= =?us-ascii?Q?NJm3GGO0CZnyJZJmrPE=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(36860700013)(1800799024)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2025 04:06:26.5742 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3e1c4b18-f28b-459c-f07d-08de3933d237 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0002992B.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR12MB5966 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1765512428317158500 Content-Type: text/plain; charset="utf-8" There are some cpuid library functions only referenced in XEN_DOMCTL-case, and shall be wrapped with CONFIG_MGMT_HYPERCALLS later, otherwise they will become unreachable when MGMT_HYPERCALLS=3Dn, and hence violate Misra 2.1 For file cpupolicy-clr.c to contain cpupolicy clearing library function: - x86_cpu_policy_clear_out_of_range_leaves - zero_leaves For file cpuid-cp2buf.c to contain cpuid copy-to-buffer library function: - x86_cpuid_copy_to_buffer - copy_leaf_to_buffer For file cpuid-cpfrbuf.c to contain cpuid copy-from-buffer library function: - x86_cpuid_copy_from_buffer Sunmmerize all needed cpuid-library object file under a new variable CPUID_OBJS in Makefile. Suggested-by: Jan Beulich Signed-off-by: Penny Zheng --- v4 -> v5: - library-fy cpuid-releated functions --- tools/fuzz/cpu-policy/Makefile | 4 +- tools/fuzz/x86_instruction_emulator/Makefile | 11 +- tools/libs/guest/Makefile.common | 4 +- tools/tests/cpu-policy/Makefile | 3 +- tools/tests/x86_emulator/Makefile | 3 +- xen/lib/Makefile | 5 + xen/lib/x86/cpuid-cp2buf.c | 123 ++++++++ xen/lib/x86/cpuid-cpfrbuf.c | 129 +++++++++ xen/lib/x86/cpuid.c | 286 ------------------- xen/lib/x86/cpupolicy-clr.c | 73 +++++ 10 files changed, 346 insertions(+), 295 deletions(-) create mode 100644 xen/lib/x86/cpuid-cp2buf.c create mode 100644 xen/lib/x86/cpuid-cpfrbuf.c create mode 100644 xen/lib/x86/cpupolicy-clr.c diff --git a/tools/fuzz/cpu-policy/Makefile b/tools/fuzz/cpu-policy/Makefile index 6e7743e0aa..543d265e62 100644 --- a/tools/fuzz/cpu-policy/Makefile +++ b/tools/fuzz/cpu-policy/Makefile @@ -22,7 +22,9 @@ CFLAGS +=3D $(APPEND_CFLAGS) -Og =20 vpath %.c ../../../xen/lib/x86 =20 -afl-policy-fuzzer: afl-policy-fuzzer.o msr.o cpuid.o +CPUID_OBJS :=3D cpuid.o cpuid-cp2buf.o cpuid-cpfrbuf.o cpupolicy-clr.o +afl-policy-fuzzer: afl-policy-fuzzer.o msr.o $(CPUID_OBJS) + $(CC) $(CFLAGS) $^ -o $@ =20 -include $(DEPS_INCLUDE) diff --git a/tools/fuzz/x86_instruction_emulator/Makefile b/tools/fuzz/x86_= instruction_emulator/Makefile index 459743f4d9..7a0ca79db8 100644 --- a/tools/fuzz/x86_instruction_emulator/Makefile +++ b/tools/fuzz/x86_instruction_emulator/Makefile @@ -25,7 +25,8 @@ x86_emulate/%.h: x86_emulate ; ln -nsf $< $@ =20 CFLAGS +=3D $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -iquote . -cpuid.o: CFLAGS +=3D -iquote $(XEN_ROOT)/xen/lib/x86 +CPUID_OBJS :=3D cpuid.o cpuid-cp2buf.o cpuid-cpfrbuf.o cpupolicy-clr.o +$(CPUID_OBJS): CFLAGS +=3D -iquote $(XEN_ROOT)/xen/lib/x86 =20 GCOV_FLAGS :=3D --coverage %-cov.o: %.c @@ -49,16 +50,16 @@ $(filter x86_emulate/%.o,$(OBJS)): x86_emulate/%.o: x86= _emulate/%.c $(private.h) $(patsubst %.o,%-cov.o,$(filter x86_emulate/%.o,$(OBJS))): x86_emulate/%-c= ov.o: x86_emulate/%.c $(private.h) $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$*.o) $(GCOV_FLAGS) -c -o $@ $< $(AP= PEND_CFLAGS) =20 -x86-insn-fuzzer.a: $(OBJS) cpuid.o +x86-insn-fuzzer.a: $(OBJS) $(CPUID_OBJS) $(AR) rc $@ $^ =20 -afl-harness: afl-harness.o $(OBJS) cpuid.o wrappers.o +afl-harness: afl-harness.o $(OBJS) $(CPUID_OBJS) wrappers.o $(CC) $(CFLAGS) $(addprefix -Wl$(comma)--wrap=3D,$(WRAPPED)) $^ -o $@ =20 -afl-harness-cov: afl-harness-cov.o $(patsubst %.o,%-cov.o,$(OBJS)) cpuid.o= wrappers.o +afl-harness-cov: afl-harness-cov.o $(patsubst %.o,%-cov.o,$(OBJS)) $(CPUID= _OBJS) wrappers.o $(CC) $(CFLAGS) $(GCOV_FLAGS) $(addprefix -Wl$(comma)--wrap=3D,$(WRAPPED)= ) $^ -o $@ =20 -libfuzzer-harness: $(OBJS) cpuid.o wrappers.o +libfuzzer-harness: $(OBJS) $(CPUID_OBJS) wrappers.o $(CC) $(CFLAGS) $(LIB_FUZZING_ENGINE) -fsanitize=3Dfuzzer $(addprefix -Wl= $(comma)--wrap=3D,$(WRAPPED)) $^ -o $@ =20 # Common targets diff --git a/tools/libs/guest/Makefile.common b/tools/libs/guest/Makefile.c= ommon index a026a2f662..7dee6c0e0b 100644 --- a/tools/libs/guest/Makefile.common +++ b/tools/libs/guest/Makefile.common @@ -35,7 +35,9 @@ OBJS-y +=3D $(LIBELF_OBJS) ifeq ($(CONFIG_X86),y) # Add libx86 to the build vpath %.c ../../../xen/lib/x86 =20 -OBJS-y +=3D cpuid.o msr.o policy.o +CPUID_OBJS :=3D cpuid.o cpuid-cp2buf.o cpuid-cpfrbuf.o cpupolicy-clr.o +OBJS-y +=3D $(CPUID_OBJS) +OBJS-y +=3D msr.o policy.o endif =20 # new domain builder diff --git a/tools/tests/cpu-policy/Makefile b/tools/tests/cpu-policy/Makef= ile index 24f87e2eca..f99a8b3ea2 100644 --- a/tools/tests/cpu-policy/Makefile +++ b/tools/tests/cpu-policy/Makefile @@ -46,7 +46,8 @@ vpath %.c ../../../xen/lib/x86 =20 %.o: Makefile =20 -test-cpu-policy: test-cpu-policy.o msr.o cpuid.o policy.o +CPUID_OBJS :=3D cpuid.o cpuid-cp2buf.o cpuid-cpfrbuf.o cpupolicy-clr.o +test-cpu-policy: test-cpu-policy.o msr.o $(CPUID_OBJS) policy.o $(CC) $^ -o $@ $(LDFLAGS) =20 -include $(DEPS_INCLUDE) diff --git a/tools/tests/x86_emulator/Makefile b/tools/tests/x86_emulator/M= akefile index 3e02580a35..2f2bf933d3 100644 --- a/tools/tests/x86_emulator/Makefile +++ b/tools/tests/x86_emulator/Makefile @@ -248,7 +248,8 @@ xop.h avx512f.h avx512fp16.h: simd-fma.c =20 endif # 32-bit override =20 -OBJS :=3D x86-emulate.o cpuid.o test_x86_emulator.o evex-disp8.o predicate= s.o wrappers.o +CPUID_OBJS :=3D cpuid.o cpuid-cp2buf.o cpuid-cpfrbuf.o cpupolicy-clr.o +OBJS :=3D x86-emulate.o $(CPUID_OBJS) test_x86_emulator.o evex-disp8.o pre= dicates.o wrappers.o OBJS +=3D x86_emulate/0f01.o x86_emulate/0fae.o x86_emulate/0fc7.o OBJS +=3D x86_emulate/blk.o x86_emulate/decode.o x86_emulate/fpu.o x86_emu= late/util.o =20 diff --git a/xen/lib/Makefile b/xen/lib/Makefile index efca830d92..9b3e03a511 100644 --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -45,3 +45,8 @@ lib-$(CONFIG_X86) +=3D xxhash64.o lib32-y :=3D divmod.o lib32-$(CONFIG_64BIT) :=3D lib-y +=3D $(lib32-y) + +libx86-y :=3D x86/cpuid-cp2buf.o +libx86-y +=3D x86/cpuid-cpfrbuf.o +libx86-y +=3D x86/cpupolicy-clr.o +lib-$(CONFIG_X86) +=3D $(libx86-y) diff --git a/xen/lib/x86/cpuid-cp2buf.c b/xen/lib/x86/cpuid-cp2buf.c new file mode 100644 index 0000000000..144d915ad9 --- /dev/null +++ b/xen/lib/x86/cpuid-cp2buf.c @@ -0,0 +1,123 @@ +#include "private.h" + +#include + +/* + * Copy a single cpuid_leaf into a provided xen_cpuid_leaf_t buffer, + * performing boundary checking against the buffer size. + */ +static int copy_leaf_to_buffer(uint32_t leaf, uint32_t subleaf, + const struct cpuid_leaf *data, + cpuid_leaf_buffer_t leaves, + uint32_t *curr_entry, const uint32_t nr_ent= ries) +{ + const xen_cpuid_leaf_t val =3D { + leaf, subleaf, data->a, data->b, data->c, data->d, + }; + + if ( *curr_entry =3D=3D nr_entries ) + return -ENOBUFS; + + if ( copy_to_buffer_offset(leaves, *curr_entry, &val, 1) ) + return -EFAULT; + + ++*curr_entry; + + return 0; +} + +int x86_cpuid_copy_to_buffer(const struct cpu_policy *p, + cpuid_leaf_buffer_t leaves, uint32_t *nr_entr= ies_p) +{ + const uint32_t nr_entries =3D *nr_entries_p; + uint32_t curr_entry =3D 0, leaf, subleaf; + +#define COPY_LEAF(l, s, data) \ + ({ \ + int ret; \ + \ + if ( (ret =3D copy_leaf_to_buffer( \ + l, s, data, leaves, &curr_entry, nr_entries)) ) \ + return ret; \ + }) + + /* Basic leaves. */ + for ( leaf =3D 0; leaf <=3D MIN(p->basic.max_leaf, + ARRAY_SIZE(p->basic.raw) - 1); ++leaf ) + { + switch ( leaf ) + { + case 0x4: + for ( subleaf =3D 0; subleaf < ARRAY_SIZE(p->cache.raw); ++sub= leaf ) + { + COPY_LEAF(leaf, subleaf, &p->cache.raw[subleaf]); + + if ( p->cache.subleaf[subleaf].type =3D=3D 0 ) + break; + } + break; + + case 0x7: + for ( subleaf =3D 0; + subleaf <=3D MIN(p->feat.max_subleaf, + ARRAY_SIZE(p->feat.raw) - 1); ++subleaf ) + COPY_LEAF(leaf, subleaf, &p->feat.raw[subleaf]); + break; + + case 0xb: + for ( subleaf =3D 0; subleaf < ARRAY_SIZE(p->topo.raw); ++subl= eaf ) + { + COPY_LEAF(leaf, subleaf, &p->topo.raw[subleaf]); + + if ( p->topo.subleaf[subleaf].type =3D=3D 0 ) + break; + } + break; + + case 0xd: + { + uint64_t xstates =3D cpu_policy_xstates(p); + + COPY_LEAF(leaf, 0, &p->xstate.raw[0]); + COPY_LEAF(leaf, 1, &p->xstate.raw[1]); + + for ( xstates >>=3D 2, subleaf =3D 2; + xstates && subleaf < ARRAY_SIZE(p->xstate.raw); + xstates >>=3D 1, ++subleaf ) + COPY_LEAF(leaf, subleaf, &p->xstate.raw[subleaf]); + break; + } + + default: + COPY_LEAF(leaf, XEN_CPUID_NO_SUBLEAF, &p->basic.raw[leaf]); + break; + } + } + + /* TODO: Port Xen and Viridian leaves to the new CPUID infrastructure.= */ + COPY_LEAF(0x40000000, XEN_CPUID_NO_SUBLEAF, + &(struct cpuid_leaf){ p->hv_limit }); + COPY_LEAF(0x40000100, XEN_CPUID_NO_SUBLEAF, + &(struct cpuid_leaf){ p->hv2_limit }); + + /* Extended leaves. */ + for ( leaf =3D 0; leaf <=3D MIN(p->extd.max_leaf & 0xffffUL, + ARRAY_SIZE(p->extd.raw) - 1); ++leaf ) + COPY_LEAF(0x80000000U | leaf, XEN_CPUID_NO_SUBLEAF, &p->extd.raw[l= eaf]); + +#undef COPY_LEAF + + *nr_entries_p =3D curr_entry; + + return 0; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/lib/x86/cpuid-cpfrbuf.c b/xen/lib/x86/cpuid-cpfrbuf.c new file mode 100644 index 0000000000..41eb7ee250 --- /dev/null +++ b/xen/lib/x86/cpuid-cpfrbuf.c @@ -0,0 +1,129 @@ +#include "private.h" + +#include + +int x86_cpuid_copy_from_buffer(struct cpu_policy *p, + const cpuid_leaf_buffer_t leaves, + uint32_t nr_entries, uint32_t *err_leaf, + uint32_t *err_subleaf) +{ + unsigned int i; + xen_cpuid_leaf_t data; + + if ( err_leaf ) + *err_leaf =3D -1; + if ( err_subleaf ) + *err_subleaf =3D -1; + + /* + * A well formed caller is expected to pass an array with leaves in or= der, + * and without any repetitions. However, due to per-vendor difference= s, + * and in the case of upgrade or levelled scenarios, we typically expe= ct + * fewer than MAX leaves to be passed. + * + * Detecting repeated entries is prohibitively complicated, so we don't + * bother. That said, one way or another if more than MAX leaves are + * passed, something is wrong. + */ + if ( nr_entries > CPUID_MAX_SERIALISED_LEAVES ) + return -E2BIG; + + for ( i =3D 0; i < nr_entries; ++i ) + { + struct cpuid_leaf l; + + if ( copy_from_buffer_offset(&data, leaves, i, 1) ) + return -EFAULT; + + l =3D (struct cpuid_leaf){ data.a, data.b, data.c, data.d }; + + switch ( data.leaf ) + { + case 0 ... ARRAY_SIZE(p->basic.raw) - 1: + switch ( data.leaf ) + { + case 0x4: + if ( data.subleaf >=3D ARRAY_SIZE(p->cache.raw) ) + goto out_of_range; + + array_access_nospec(p->cache.raw, data.subleaf) =3D l; + break; + + case 0x7: + if ( data.subleaf >=3D ARRAY_SIZE(p->feat.raw) ) + goto out_of_range; + + array_access_nospec(p->feat.raw, data.subleaf) =3D l; + break; + + case 0xb: + if ( data.subleaf >=3D ARRAY_SIZE(p->topo.raw) ) + goto out_of_range; + + array_access_nospec(p->topo.raw, data.subleaf) =3D l; + break; + + case 0xd: + if ( data.subleaf >=3D ARRAY_SIZE(p->xstate.raw) ) + goto out_of_range; + + array_access_nospec(p->xstate.raw, data.subleaf) =3D l; + break; + + default: + if ( data.subleaf !=3D XEN_CPUID_NO_SUBLEAF ) + goto out_of_range; + + array_access_nospec(p->basic.raw, data.leaf) =3D l; + break; + } + break; + + case 0x40000000: + if ( data.subleaf !=3D XEN_CPUID_NO_SUBLEAF ) + goto out_of_range; + + p->hv_limit =3D l.a; + break; + + case 0x40000100: + if ( data.subleaf !=3D XEN_CPUID_NO_SUBLEAF ) + goto out_of_range; + + p->hv2_limit =3D l.a; + break; + + case 0x80000000U ... 0x80000000U + ARRAY_SIZE(p->extd.raw) - 1: + if ( data.subleaf !=3D XEN_CPUID_NO_SUBLEAF ) + goto out_of_range; + + array_access_nospec(p->extd.raw, data.leaf & 0xffff) =3D l; + break; + + default: + goto out_of_range; + } + } + + x86_cpu_policy_recalc_synth(p); + + return 0; + + out_of_range: + if ( err_leaf ) + *err_leaf =3D data.leaf; + if ( err_subleaf ) + *err_subleaf =3D data.subleaf; + + return -ERANGE; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/lib/x86/cpuid.c b/xen/lib/x86/cpuid.c index 6298d051f2..465bdee35a 100644 --- a/xen/lib/x86/cpuid.c +++ b/xen/lib/x86/cpuid.c @@ -2,13 +2,6 @@ =20 #include =20 -static void zero_leaves(struct cpuid_leaf *l, - unsigned int first, unsigned int last) -{ - if ( first <=3D last ) - memset(&l[first], 0, sizeof(*l) * (last - first + 1)); -} - unsigned int x86_cpuid_lookup_vendor(uint32_t ebx, uint32_t ecx, uint32_t = edx) { switch ( ebx ) @@ -238,59 +231,6 @@ void x86_cpu_policy_fill_native(struct cpu_policy *p) x86_cpu_policy_recalc_synth(p); } =20 -void x86_cpu_policy_clear_out_of_range_leaves(struct cpu_policy *p) -{ - unsigned int i; - - zero_leaves(p->basic.raw, p->basic.max_leaf + 1, - ARRAY_SIZE(p->basic.raw) - 1); - - if ( p->basic.max_leaf < 4 ) - memset(p->cache.raw, 0, sizeof(p->cache.raw)); - else - { - for ( i =3D 0; (i < ARRAY_SIZE(p->cache.raw) && - p->cache.subleaf[i].type); ++i ) - ; - - zero_leaves(p->cache.raw, i, ARRAY_SIZE(p->cache.raw) - 1); - } - - if ( p->basic.max_leaf < 7 ) - memset(p->feat.raw, 0, sizeof(p->feat.raw)); - else - zero_leaves(p->feat.raw, p->feat.max_subleaf + 1, - ARRAY_SIZE(p->feat.raw) - 1); - - if ( p->basic.max_leaf < 0xb ) - memset(p->topo.raw, 0, sizeof(p->topo.raw)); - else - { - for ( i =3D 0; (i < ARRAY_SIZE(p->topo.raw) && - p->topo.subleaf[i].type); ++i ) - ; - - zero_leaves(p->topo.raw, i, ARRAY_SIZE(p->topo.raw) - 1); - } - - if ( p->basic.max_leaf < 0xd || !cpu_policy_xstates(p) ) - memset(p->xstate.raw, 0, sizeof(p->xstate.raw)); - else - { - /* This logic will probably need adjusting when XCR0[63] gets used= . */ - BUILD_BUG_ON(ARRAY_SIZE(p->xstate.raw) > 63); - - /* First two leaves always valid. Rest depend on xstates. */ - i =3D max(2, 64 - __builtin_clzll(cpu_policy_xstates(p))); - - zero_leaves(p->xstate.raw, i, - ARRAY_SIZE(p->xstate.raw) - 1); - } - - zero_leaves(p->extd.raw, (p->extd.max_leaf & 0xffff) + 1, - ARRAY_SIZE(p->extd.raw) - 1); -} - const uint32_t *x86_cpu_policy_lookup_deep_deps(uint32_t feature) { static const uint32_t deep_features[] =3D INIT_DEEP_FEATURES; @@ -322,232 +262,6 @@ const uint32_t *x86_cpu_policy_lookup_deep_deps(uint3= 2_t feature) return NULL; } =20 -/* - * Copy a single cpuid_leaf into a provided xen_cpuid_leaf_t buffer, - * performing boundary checking against the buffer size. - */ -static int copy_leaf_to_buffer(uint32_t leaf, uint32_t subleaf, - const struct cpuid_leaf *data, - cpuid_leaf_buffer_t leaves, - uint32_t *curr_entry, const uint32_t nr_ent= ries) -{ - const xen_cpuid_leaf_t val =3D { - leaf, subleaf, data->a, data->b, data->c, data->d, - }; - - if ( *curr_entry =3D=3D nr_entries ) - return -ENOBUFS; - - if ( copy_to_buffer_offset(leaves, *curr_entry, &val, 1) ) - return -EFAULT; - - ++*curr_entry; - - return 0; -} - -int x86_cpuid_copy_to_buffer(const struct cpu_policy *p, - cpuid_leaf_buffer_t leaves, uint32_t *nr_entr= ies_p) -{ - const uint32_t nr_entries =3D *nr_entries_p; - uint32_t curr_entry =3D 0, leaf, subleaf; - -#define COPY_LEAF(l, s, data) \ - ({ \ - int ret; \ - \ - if ( (ret =3D copy_leaf_to_buffer( \ - l, s, data, leaves, &curr_entry, nr_entries)) ) \ - return ret; \ - }) - - /* Basic leaves. */ - for ( leaf =3D 0; leaf <=3D MIN(p->basic.max_leaf, - ARRAY_SIZE(p->basic.raw) - 1); ++leaf ) - { - switch ( leaf ) - { - case 0x4: - for ( subleaf =3D 0; subleaf < ARRAY_SIZE(p->cache.raw); ++sub= leaf ) - { - COPY_LEAF(leaf, subleaf, &p->cache.raw[subleaf]); - - if ( p->cache.subleaf[subleaf].type =3D=3D 0 ) - break; - } - break; - - case 0x7: - for ( subleaf =3D 0; - subleaf <=3D MIN(p->feat.max_subleaf, - ARRAY_SIZE(p->feat.raw) - 1); ++subleaf ) - COPY_LEAF(leaf, subleaf, &p->feat.raw[subleaf]); - break; - - case 0xb: - for ( subleaf =3D 0; subleaf < ARRAY_SIZE(p->topo.raw); ++subl= eaf ) - { - COPY_LEAF(leaf, subleaf, &p->topo.raw[subleaf]); - - if ( p->topo.subleaf[subleaf].type =3D=3D 0 ) - break; - } - break; - - case 0xd: - { - uint64_t xstates =3D cpu_policy_xstates(p); - - COPY_LEAF(leaf, 0, &p->xstate.raw[0]); - COPY_LEAF(leaf, 1, &p->xstate.raw[1]); - - for ( xstates >>=3D 2, subleaf =3D 2; - xstates && subleaf < ARRAY_SIZE(p->xstate.raw); - xstates >>=3D 1, ++subleaf ) - COPY_LEAF(leaf, subleaf, &p->xstate.raw[subleaf]); - break; - } - - default: - COPY_LEAF(leaf, XEN_CPUID_NO_SUBLEAF, &p->basic.raw[leaf]); - break; - } - } - - /* TODO: Port Xen and Viridian leaves to the new CPUID infrastructure.= */ - COPY_LEAF(0x40000000, XEN_CPUID_NO_SUBLEAF, - &(struct cpuid_leaf){ p->hv_limit }); - COPY_LEAF(0x40000100, XEN_CPUID_NO_SUBLEAF, - &(struct cpuid_leaf){ p->hv2_limit }); - - /* Extended leaves. */ - for ( leaf =3D 0; leaf <=3D MIN(p->extd.max_leaf & 0xffffUL, - ARRAY_SIZE(p->extd.raw) - 1); ++leaf ) - COPY_LEAF(0x80000000U | leaf, XEN_CPUID_NO_SUBLEAF, &p->extd.raw[l= eaf]); - -#undef COPY_LEAF - - *nr_entries_p =3D curr_entry; - - return 0; -} - -int x86_cpuid_copy_from_buffer(struct cpu_policy *p, - const cpuid_leaf_buffer_t leaves, - uint32_t nr_entries, uint32_t *err_leaf, - uint32_t *err_subleaf) -{ - unsigned int i; - xen_cpuid_leaf_t data; - - if ( err_leaf ) - *err_leaf =3D -1; - if ( err_subleaf ) - *err_subleaf =3D -1; - - /* - * A well formed caller is expected to pass an array with leaves in or= der, - * and without any repetitions. However, due to per-vendor difference= s, - * and in the case of upgrade or levelled scenarios, we typically expe= ct - * fewer than MAX leaves to be passed. - * - * Detecting repeated entries is prohibitively complicated, so we don't - * bother. That said, one way or another if more than MAX leaves are - * passed, something is wrong. - */ - if ( nr_entries > CPUID_MAX_SERIALISED_LEAVES ) - return -E2BIG; - - for ( i =3D 0; i < nr_entries; ++i ) - { - struct cpuid_leaf l; - - if ( copy_from_buffer_offset(&data, leaves, i, 1) ) - return -EFAULT; - - l =3D (struct cpuid_leaf){ data.a, data.b, data.c, data.d }; - - switch ( data.leaf ) - { - case 0 ... ARRAY_SIZE(p->basic.raw) - 1: - switch ( data.leaf ) - { - case 0x4: - if ( data.subleaf >=3D ARRAY_SIZE(p->cache.raw) ) - goto out_of_range; - - array_access_nospec(p->cache.raw, data.subleaf) =3D l; - break; - - case 0x7: - if ( data.subleaf >=3D ARRAY_SIZE(p->feat.raw) ) - goto out_of_range; - - array_access_nospec(p->feat.raw, data.subleaf) =3D l; - break; - - case 0xb: - if ( data.subleaf >=3D ARRAY_SIZE(p->topo.raw) ) - goto out_of_range; - - array_access_nospec(p->topo.raw, data.subleaf) =3D l; - break; - - case 0xd: - if ( data.subleaf >=3D ARRAY_SIZE(p->xstate.raw) ) - goto out_of_range; - - array_access_nospec(p->xstate.raw, data.subleaf) =3D l; - break; - - default: - if ( data.subleaf !=3D XEN_CPUID_NO_SUBLEAF ) - goto out_of_range; - - array_access_nospec(p->basic.raw, data.leaf) =3D l; - break; - } - break; - - case 0x40000000: - if ( data.subleaf !=3D XEN_CPUID_NO_SUBLEAF ) - goto out_of_range; - - p->hv_limit =3D l.a; - break; - - case 0x40000100: - if ( data.subleaf !=3D XEN_CPUID_NO_SUBLEAF ) - goto out_of_range; - - p->hv2_limit =3D l.a; - break; - - case 0x80000000U ... 0x80000000U + ARRAY_SIZE(p->extd.raw) - 1: - if ( data.subleaf !=3D XEN_CPUID_NO_SUBLEAF ) - goto out_of_range; - - array_access_nospec(p->extd.raw, data.leaf & 0xffff) =3D l; - break; - - default: - goto out_of_range; - } - } - - x86_cpu_policy_recalc_synth(p); - - return 0; - - out_of_range: - if ( err_leaf ) - *err_leaf =3D data.leaf; - if ( err_subleaf ) - *err_subleaf =3D data.subleaf; - - return -ERANGE; -} - /* * Local variables: * mode: C diff --git a/xen/lib/x86/cpupolicy-clr.c b/xen/lib/x86/cpupolicy-clr.c new file mode 100644 index 0000000000..de090a7c95 --- /dev/null +++ b/xen/lib/x86/cpupolicy-clr.c @@ -0,0 +1,73 @@ +#include "private.h" + +#include + +static void zero_leaves(struct cpuid_leaf *l, + unsigned int first, unsigned int last) +{ + if ( first <=3D last ) + memset(&l[first], 0, sizeof(*l) * (last - first + 1)); +} + +void x86_cpu_policy_clear_out_of_range_leaves(struct cpu_policy *p) +{ + unsigned int i; + + zero_leaves(p->basic.raw, p->basic.max_leaf + 1, + ARRAY_SIZE(p->basic.raw) - 1); + + if ( p->basic.max_leaf < 4 ) + memset(p->cache.raw, 0, sizeof(p->cache.raw)); + else + { + for ( i =3D 0; (i < ARRAY_SIZE(p->cache.raw) && + p->cache.subleaf[i].type); ++i ) + ; + + zero_leaves(p->cache.raw, i, ARRAY_SIZE(p->cache.raw) - 1); + } + + if ( p->basic.max_leaf < 7 ) + memset(p->feat.raw, 0, sizeof(p->feat.raw)); + else + zero_leaves(p->feat.raw, p->feat.max_subleaf + 1, + ARRAY_SIZE(p->feat.raw) - 1); + + if ( p->basic.max_leaf < 0xb ) + memset(p->topo.raw, 0, sizeof(p->topo.raw)); + else + { + for ( i =3D 0; (i < ARRAY_SIZE(p->topo.raw) && + p->topo.subleaf[i].type); ++i ) + ; + + zero_leaves(p->topo.raw, i, ARRAY_SIZE(p->topo.raw) - 1); + } + + if ( p->basic.max_leaf < 0xd || !cpu_policy_xstates(p) ) + memset(p->xstate.raw, 0, sizeof(p->xstate.raw)); + else + { + /* This logic will probably need adjusting when XCR0[63] gets used= . */ + BUILD_BUG_ON(ARRAY_SIZE(p->xstate.raw) > 63); + + /* First two leaves always valid. Rest depend on xstates. */ + i =3D max(2, 64 - __builtin_clzll(cpu_policy_xstates(p))); + + zero_leaves(p->xstate.raw, i, + ARRAY_SIZE(p->xstate.raw) - 1); + } + + zero_leaves(p->extd.raw, (p->extd.max_leaf & 0xffff) + 1, + ARRAY_SIZE(p->extd.raw) - 1); +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ --=20 2.34.1 From nobody Sun Dec 14 05:55:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1765512417; cv=pass; d=zohomail.com; s=zohoarc; b=N+/p3DhRdXa0OmVA5f0dN4KhC6eZGZ5zk+tguuPIUDYzNWK4JBosYfXNR7iixJcrbNEtQMNNldpeCbpIhA7oD56OhHsu8y6JCY5if1zf47MnHoWPAw127D9yWTU8HN251Bh7ZCnkl3VZJbJnVpDfqrdoYiAgynPss7psgot6LqU= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765512417; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=YXAQFART80WLThJjcvr6ZzdrnhTVp/Mdx6r3fmkmkIU=; b=iTMmWF6IAUzqvQLgN+QW8lvGEvl2eBwKNozrwqJdFfT3NjZHS8cMHlWR//Hve94r3X785dgRrHoyPsE2UYtQ4++/hNz6MPRDJGHmQs4d5Lk9Cms8Yl3IC6wVJCY6xZkRlsHJc7XRa197b1bzjbrDHj8mckGzEMSXQIFu78i8y/E= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1765512417170431.4092593792284; Thu, 11 Dec 2025 20:06:57 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1184894.1507192 (Exim 4.92) (envelope-from ) id 1vTuQQ-0007gk-5x; Fri, 12 Dec 2025 04:06:38 +0000 Received: by outflank-mailman (output) from mailman id 1184894.1507192; Fri, 12 Dec 2025 04:06:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vTuQQ-0007gd-1t; Fri, 12 Dec 2025 04:06:38 +0000 Received: by outflank-mailman (input) for mailman id 1184894; Fri, 12 Dec 2025 04:06:36 +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 1vTuQO-0007Dl-FF for xen-devel@lists.xenproject.org; Fri, 12 Dec 2025 04:06:36 +0000 Received: from BL2PR02CU003.outbound.protection.outlook.com (mail-eastusazlp17011000f.outbound.protection.outlook.com [2a01:111:f403:c100::f]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id f228ef1f-d70f-11f0-b15b-2bf370ae4941; Fri, 12 Dec 2025 05:06:35 +0100 (CET) Received: from MN2PR03CA0010.namprd03.prod.outlook.com (2603:10b6:208:23a::15) by IA0PPF7646FEBB5.namprd12.prod.outlook.com (2603:10b6:20f:fc04::bd3) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.6; Fri, 12 Dec 2025 04:06:29 +0000 Received: from BL02EPF0002992C.namprd02.prod.outlook.com (2603:10b6:208:23a:cafe::c3) by MN2PR03CA0010.outlook.office365.com (2603:10b6:208:23a::15) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9388.16 via Frontend Transport; Fri, 12 Dec 2025 04:06:14 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by BL02EPF0002992C.mail.protection.outlook.com (10.167.249.57) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.4 via Frontend Transport; Fri, 12 Dec 2025 04:06:29 +0000 Received: from penny-System-Product-Name.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Thu, 11 Dec 2025 22:06:26 -0600 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: f228ef1f-d70f-11f0-b15b-2bf370ae4941 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZaKiUXk4MzO/A9ATcrJfmwQ3GEdtj1ywfMcL6LVVRhblUcO6620R0y9c9M9O+FVNXSjzlVy6NPtCbf/0DnLFX3CScMmwXtxSZdEKWYmXPh2UJ0jZ0WoU8iI6Uhv/1NqH7/hAiHhwTDkbmT/od3Ewj0WWX/sYHa8cJJW+WAB+OY2TecutTdr+Q6SUyTbERQJIqZI0sjvuDiFqrBMgnycKheEzE5Unk7uq4h/ycMdQPg4j3X66fVc4iusOLCXR9YXbj3tpnrVbX/LnDA9trC4RKSTUt4tvQ77d7IbTzSZc/r/pQgFfQhKobifJev8VMvSUs0Gsrv77o8GKQI0fYT4/OA== 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=YXAQFART80WLThJjcvr6ZzdrnhTVp/Mdx6r3fmkmkIU=; b=FlfiKf8JIV23MnTnQeJIPecEzltaOXlsBZsX4bpBSTI6ewPNDgii+SQ7/CxdHvDjtCWw6ID6b6VpGmCGl0GNxE3/bAjL1AlydDGgcrLzySdjl7NE2yS0Y9YcfVKAbN5CERpPJOuKvXhwCDfpSgttL4WfzQVmYQ1CsZIPQck1/ZmP/HVeHS7gAJHaJmKPFb6pouRxeruglqAgKNqwdcbuo/IysYZ88rsgIK/c5W19TEDBm0sk7wU2VCJAFGWGBaLUP2E8r6xFH1Q46clnu4Jl32RsPpkx1izbSWgEpsTne/v3AGUNqzmLXHoaAigvkCIDaHGmQjjshuAFxxwHVdd4/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YXAQFART80WLThJjcvr6ZzdrnhTVp/Mdx6r3fmkmkIU=; b=noXX+P9szPAnX6CGl130T2qdsUU3uY3gfPuYUzvWxcmLCjwAs3dVuDOsirCgCegTI3g9k02z7Buww7ycJFT7qr34LeL9Ksw9J30J/R9akKM1X63l/G6KNoLRnqmJUuBI5bjG4JMmUs8HStJ8MJwbCNYrzPMr/HQ/+PCbLX7z1tY= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; 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; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C From: Penny Zheng To: CC: , , Penny Zheng , Stefano Stabellini , "Julien Grall" , Bertrand Marquis , "Michal Orzel" , Penny Zheng Subject: [PATCH v5 03/24] xen/arm: move dt_find_node_by_gpath() to passthrough/device_tree.c Date: Fri, 12 Dec 2025 12:01:48 +0800 Message-ID: <20251212040209.1970553-4-Penny.Zheng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251212040209.1970553-1-Penny.Zheng@amd.com> References: <20251212040209.1970553-1-Penny.Zheng@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0002992C:EE_|IA0PPF7646FEBB5:EE_ X-MS-Office365-Filtering-Correlation-Id: 4d6f502c-7898-45e6-ee24-08de3933d3ba X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?blVOFwB7jBrp8/v5J/AqmksMjwNkWafWx1jsI2HJ+4ceHP1ARRRevL+WZQsM?= =?us-ascii?Q?v600MmS7WMMWq/lll01Nm20Eb3HPvmYZb+syyuZ1TGmxqAUe0Sa0ES3Y+CAL?= =?us-ascii?Q?sG4d6588KCuchCYxLvsybAJI5O9YpGgF2YvOEo20os7+T4ulIVO3vlnP9PaK?= =?us-ascii?Q?/fblsC5M69KWLKf5gRfw/0wMM3jWdL/DfFVWyJ1VbOwjz8RIi2+j5BdVbFZU?= =?us-ascii?Q?IDsxKEO/I+6neewRxtOrWYalJNSUlQ4qh6VXVgyKL4aBwYASSgN90gBr9rW8?= =?us-ascii?Q?0LyGOdXN4Mi95LEaQ3gSl3Ouj8hOXK7dP9T/GJBXAb2rgP+Kin+kRZzu2SiN?= =?us-ascii?Q?NVuof9FVrYGCD3DgmV6jqyjJw6sLIr6etk0wwkHVUqgjHcxIEFGaM1V7JsNq?= =?us-ascii?Q?5on6UFUhuY7T7VX8OqMRA4FRi1QeVEdf3a/ubX/Hu/AAqMaZgVQJTuufG/ka?= =?us-ascii?Q?OReB4tURVhdasRahxiYbGNFbXixt1jMdphGb0n1KBOkjrNA9riOco4MfT08h?= =?us-ascii?Q?1fo7IVkhE8bQ6P1+qQTPNsrJOfYv0EsYo+mfZlfzGdo2HrguRBx0SuEbp2YG?= =?us-ascii?Q?0jdNysZyKxYS26x8JF9IP+9FhMf1+8Xj4Tn5jRRt7byPUYfxqhuTKW+cqdWT?= =?us-ascii?Q?YXrRNPS3xVzyxr6phzli24rwgusI/AWKELuABsrFdAIL42kmYRoWyN00iwfx?= =?us-ascii?Q?EWq0uqkb1+7rMN9ETPvl5Dwxmq992sQBH7P1bq2aNNVuealh5rTNxhEqna0r?= =?us-ascii?Q?MtL+QEhrPA6hBqTjG7sviaeLLMWG7MXTo5q0AD7Xo67Z1cW4HPMATpi0kjvi?= =?us-ascii?Q?w+QI7bBhodkAFk3yRhnJePy9oJJFTgenb67O5ujq7Z+xSSIxRBloPGguXNLs?= =?us-ascii?Q?WW0i2N7RM3yIj643AOLj4k9/3c9UT+SDCKoJynlwAakJVew/tCsM2hhu+bpt?= =?us-ascii?Q?8/+4uvccOV1J9+Z0Efkmc6dPblg+e9eHfcqikuC++itN5myhA6Irhr+OyJuK?= =?us-ascii?Q?7/4I3Z0yD5YxJ6BROt16+BbV74SCchzOGAfeFG0Jizz2B2Dki+bq1u7/tljG?= =?us-ascii?Q?VHXhGTJXZI6wKgxUHlPr/QhNb/jUvuJqG5RGVv2Qur4D/4Bgwd9qDYRCCQ8l?= =?us-ascii?Q?CkEOZ42E/pQ1EgZyKh2r0rfXREPNmWvQbhSdP+bY/MWZjr1fHnNUcIZ6EZFU?= =?us-ascii?Q?sU67F13TQiN54mTj9acx7kKR0iXy+1rVQ4cJzgeoRcUOGdG4fyEW9qEw1BbD?= =?us-ascii?Q?74jnt2cufx1aiC5chycW3+MYgXCuHgI4/k2gZ6VzAVRB22r+SkH2LmIeoxC3?= =?us-ascii?Q?DpfNZ7S33PixN9xxQZK4/sB+jbWxZTml6+9vjtqO1vj2aIaYu/MoMN92vec8?= =?us-ascii?Q?GKdD3p0Prcd3Wy5fpnDBnyizaxjtIOc0ar0RczK6N0q6ELHMseQxbwSvg6Ux?= =?us-ascii?Q?hkU1X8X7wuNKt6hyDKQ5QGRVGDdXoKnHlEwPlrWdgFE3JXKUdt5gynkQGs8u?= =?us-ascii?Q?HfkUQgd97+z2gKh9uupua5HJ2eMKjk/f8128c/hMDJZai8pdVc3QAQ0wLyGf?= =?us-ascii?Q?KtfFgHD6UOKAuABNXs0=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(82310400026)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2025 04:06:29.1101 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4d6f502c-7898-45e6-ee24-08de3933d3ba X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0002992C.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PPF7646FEBB5 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1765512418392158500 Content-Type: text/plain; charset="utf-8" The common/device-tree/device-tree.c contains generic unflatten DT helpers = API, while dt_find_node_by_gpath() is specific for domctl (iommu) processing. We move this function into drivers\passthrough\device_tree.c and make it static, as it is used only there now. Suggested-by: Grygorii Strashko Signed-off-by: Penny Zheng --- v4 -> v5: - new commit --- xen/common/device-tree/device-tree.c | 16 --------------- xen/drivers/passthrough/device_tree.c | 28 +++++++++++++++++++++++++++ xen/include/xen/device_tree.h | 13 ------------- 3 files changed, 28 insertions(+), 29 deletions(-) diff --git a/xen/common/device-tree/device-tree.c b/xen/common/device-tree/= device-tree.c index 0b5375f151..d6cf417e94 100644 --- a/xen/common/device-tree/device-tree.c +++ b/xen/common/device-tree/device-tree.c @@ -371,22 +371,6 @@ struct dt_device_node *dt_find_node_by_path_from(struc= t dt_device_node *from, return np; } =20 -int dt_find_node_by_gpath(XEN_GUEST_HANDLE(char) u_path, uint32_t u_plen, - struct dt_device_node **node) -{ - char *path; - - path =3D safe_copy_string_from_guest(u_path, u_plen, PAGE_SIZE); - if ( IS_ERR(path) ) - return PTR_ERR(path); - - *node =3D dt_find_node_by_path(path); - - xfree(path); - - return (*node =3D=3D NULL) ? -ESRCH : 0; -} - struct dt_device_node *dt_find_node_by_alias(const char *alias) { const struct dt_alias_prop *app; diff --git a/xen/drivers/passthrough/device_tree.c b/xen/drivers/passthroug= h/device_tree.c index f5850a2607..eb0c233977 100644 --- a/xen/drivers/passthrough/device_tree.c +++ b/xen/drivers/passthrough/device_tree.c @@ -16,6 +16,7 @@ */ =20 #include +#include #include #include #include @@ -318,6 +319,33 @@ int iommu_add_dt_device(struct dt_device_node *np) return rc; } =20 +/* + * dt_find_node_by_gpath - Same as dt_find_node_by_path but retrieve the + * path from the guest + * + * @u_path: Xen Guest handle to the buffer containing the path + * @u_plen: Length of the buffer + * @node: TODO + * + * Return 0 if succeed otherwise -errno + */ +static int dt_find_node_by_gpath(XEN_GUEST_HANDLE(char) u_path, + uint32_t u_plen, + struct dt_device_node **node) +{ + char *path; + + path =3D safe_copy_string_from_guest(u_path, u_plen, PAGE_SIZE); + if ( IS_ERR(path) ) + return PTR_ERR(path); + + *node =3D dt_find_node_by_path(path); + + xfree(path); + + return (*node =3D=3D NULL) ? -ESRCH : 0; +} + int iommu_do_dt_domctl(struct xen_domctl *domctl, struct domain *d, XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) { diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h index 06d7643622..241f269b57 100644 --- a/xen/include/xen/device_tree.h +++ b/xen/include/xen/device_tree.h @@ -550,19 +550,6 @@ static inline struct dt_device_node *dt_find_node_by_p= ath(const char *path) return dt_find_node_by_path_from(dt_host, path); } =20 -/** - * dt_find_node_by_gpath - Same as dt_find_node_by_path but retrieve the - * path from the guest - * - * @u_path: Xen Guest handle to the buffer containing the path - * @u_plen: Length of the buffer - * @node: TODO - * - * Return 0 if succeed otherwise -errno - */ -int dt_find_node_by_gpath(XEN_GUEST_HANDLE(char) u_path, uint32_t u_plen, - struct dt_device_node **node); - /** * dt_get_parent - Get a node's parent if any * @node: Node to get parent --=20 2.34.1 From nobody Sun Dec 14 05:55:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1765512431; cv=pass; d=zohomail.com; s=zohoarc; b=L3jX6OWpSF+jjsIxJQ1HWCI9I3bF8BWhlPNODBgTgZQ4LLMTT2gYgniMV6FnTOq7Vt3//swXUKH3zfCOOLxgWOkM1wuf84SV8sgQnG33ypO5A9mngVCmqupp9wJ/Ei/Bk1aJ+jnG/1zaqTmsotJTgCfiWv+Cijw5RVzvE1ppGKs= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765512431; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8Z2BxFgH8/sr6mg9dw32KzPvjL6Qcc2zUqQTjqKG13o=; b=LfbNJWfH9Sl3eie3O3LvGJDv3RoEGWiAV0LfFFB9SZ0zHagEK699BD2WqIeAw+P1vLUEXZJmeZPvTSOY8CWZXm30F5jbnpev7VYh7WYFTTSu3tNLgaud9b8GyRgSaGI05ZQX1f0sTgGCGO5O5rTG+l4wLwMkp3909BudCNz3pXE= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1765512431945125.30705968261498; Thu, 11 Dec 2025 20:07:11 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1184900.1507222 (Exim 4.92) (envelope-from ) id 1vTuQa-0000AA-2s; Fri, 12 Dec 2025 04:06:48 +0000 Received: by outflank-mailman (output) from mailman id 1184900.1507222; Fri, 12 Dec 2025 04:06:48 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vTuQZ-00009r-Vf; Fri, 12 Dec 2025 04:06:47 +0000 Received: by outflank-mailman (input) for mailman id 1184900; Fri, 12 Dec 2025 04:06:46 +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 1vTuQY-0007Dl-92 for xen-devel@lists.xenproject.org; Fri, 12 Dec 2025 04:06:46 +0000 Received: from CY3PR05CU001.outbound.protection.outlook.com (mail-westcentralusazlp170130007.outbound.protection.outlook.com [2a01:111:f403:c112::7]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id f80a5b74-d70f-11f0-b15b-2bf370ae4941; Fri, 12 Dec 2025 05:06:44 +0100 (CET) Received: from MN2PR13CA0030.namprd13.prod.outlook.com (2603:10b6:208:160::43) by SJ2PR12MB9088.namprd12.prod.outlook.com (2603:10b6:a03:565::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.10; Fri, 12 Dec 2025 04:06:35 +0000 Received: from BL02EPF0002992E.namprd02.prod.outlook.com (2603:10b6:208:160:cafe::25) by MN2PR13CA0030.outlook.office365.com (2603:10b6:208:160::43) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9434.5 via Frontend Transport; Fri, 12 Dec 2025 04:06:35 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by BL02EPF0002992E.mail.protection.outlook.com (10.167.249.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.4 via Frontend Transport; Fri, 12 Dec 2025 04:06:34 +0000 Received: from penny-System-Product-Name.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Thu, 11 Dec 2025 22:06:29 -0600 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: f80a5b74-d70f-11f0-b15b-2bf370ae4941 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=j+Bk5g1smFpuH+rsKRCmiSYqFmsh+XtoGPX8fzgGiVGOd36/4nq+0TLoJZeIJvqziSVKSP4k405Sy2Mq96A313o0721jNbSDmYXPV1P6yt6h1YV7umE8O0VtiNibBi6P9Kv/FvlYRlEdEuQEFqOERLDdrbG9lhQTD9w+WI5y6jLVd2pifj+HTkHqkAhOSCCoUsxOb/GVHct+DEdNKkrd2vi5mXBZRjtaUmPKjbinfCAzD7ai9erb3g9UBneDgphAkkMRqg3+6jOJ0UEcHIO/Ly9FMQSLRqENTuBxeEmCOx2NhVX+w4iFg3tj+UJbsz0rJk/LHTgsYCbaXB7jGujUOA== 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=8Z2BxFgH8/sr6mg9dw32KzPvjL6Qcc2zUqQTjqKG13o=; b=sBO4suMoI49zisoHJMoykfUh7A8QVB5tOlk0PcCV7UmKfl5ASD2dSL5ud9n19727YoA6G7fqKEQtcXze4iER1LCQkhkOM6nydY7Rjle/QMpvbVLRA9jFhhBX/Z/poXm6Tk+YcrMGeNCdQsHE3ZflxSXj2ExtiHUTMhHiLDKYMFcDIaI2w5SrEusLx0/0DSjo5xSV23vhWtSBMPN25JS3HoMD0ANlsJImb+yrotir5pb5S0RWXRhv8L3mZyAvPLjBv5+sTXXzIb7acsolJ3fUrHiB0LYTJ0ggisz4lYMTBhnnkMisnpLmYOw9svkVFLp/R6kmEr/DgZIwUe9NRhsE5w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8Z2BxFgH8/sr6mg9dw32KzPvjL6Qcc2zUqQTjqKG13o=; b=fDE4OBLLG/bgCYVlxyh1q1QrCUq2eCJXdosZ6tfVUc2y0LCFpK/8lUTg+AnsLQRus9nXAruOF+PivV1YCymWoCfgQFyDDz6pm0GRwzO1l0i8NLVOkWz9Tr/MQGkG5kB3dtvOytkn94fcdCwtFo8zRb2cxnYOLuroAZze29sgCSQ= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; 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; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C From: Penny Zheng To: , CC: , , Penny Zheng , Andrew Cooper , "Anthony PERARD" , Michal Orzel , "Jan Beulich" , Julien Grall , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , "Stefano Stabellini" , Bertrand Marquis , Volodymyr Babchuk , Bob Eshleman , Connor Davis , Oleksii Kurochko , Nathan Studer , Stewart Hildebrand , "Dario Faggioli" , Juergen Gross , George Dunlap , "Daniel P. Smith" , Alistair Francis Subject: [PATCH v5 04/24] xen/sysctl: replace CONFIG_SYSCTL with CONFIG_MGMT_HYPERCALLS Date: Fri, 12 Dec 2025 12:01:49 +0800 Message-ID: <20251212040209.1970553-5-Penny.Zheng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251212040209.1970553-1-Penny.Zheng@amd.com> References: <20251212040209.1970553-1-Penny.Zheng@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0002992E:EE_|SJ2PR12MB9088:EE_ X-MS-Office365-Filtering-Correlation-Id: b63b8be6-5bda-4ec7-9a56-08de3933d702 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|376014|7416014|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?qKZIFlBeM21V+mfnklC5MKCQCBvgSOJL0cSg12P4SELXeOO19cPjT/tFQUxP?= =?us-ascii?Q?aUgzwolTup4aVKE/f/+mplSABerBsrqts1YlmwLkL9w8ZgQ46EZHJGel30YM?= =?us-ascii?Q?C/KCFjTOVmh/ycGqBchzR+RUd+d29CylYNSdo4GuszeNltk1Hy5sVlD0OxFP?= =?us-ascii?Q?b6FU0tCYRhAWiIiSNuGOEU8aGlts9BM8SBm2G3u5egvcGgUHfdXJ2csIYyfA?= =?us-ascii?Q?bBSQgjF2BKpUVNk0CcX6AJFn3rPozqZRXyeR9oJ6avMuwcXH+FZijU5TvYOj?= =?us-ascii?Q?urgOlMFs8RT+8yaXxbniMT0K791sJ5XOaQmFZ0NKj3gn2YGi2WPuBcI5Su+W?= =?us-ascii?Q?0rwjFCZy9W8ml6CWNT3crpg6UllhZ/WUGZ+u6Z4AvjKAk0QxhUeHXjEZiD7B?= =?us-ascii?Q?Qa3Ep8k6vW0o3xBXskkKOOkgotB1+2sERHqDRN38lzWDmcygbwuOleCAUmqy?= =?us-ascii?Q?3cUmHB2WpYVPG49T1+eRFNeYqqNP3Zh1zXlPP15lQq+erEHBe5Nuvd/L1tEJ?= =?us-ascii?Q?Skupv/3aSDBd4X1ScUyOXGshFg98/tNOWu377+CIDHxHia8h9lK1Vs5R/Q8y?= =?us-ascii?Q?erswauBbmJTXSGpZj9Fc5fFWU/8IVXWVsCEArs3cDrCHli0337JABXJF8i/t?= =?us-ascii?Q?IlVjLVPmE2j/BTqD+C0LswfaWLYJ9T6smVX64+gZaVQLq2wYNH9VOh3KYmhl?= =?us-ascii?Q?Pdlt+/hiM5bIDqclfldtV9TY5f2qm9+Y87Ihzc0sFkUvzNzrcB4UlaDZxEX9?= =?us-ascii?Q?vfwjIHx7vH8mYzfEQpT4ZiTN6ozDtyk/pLSjHitqfB77Lx4iJtj3NAVneynI?= =?us-ascii?Q?EcJXTZaMX5UKqryioo9oDvbllZQOVYzvZVpBOtdxv127iBo8INGFrmdrRqn8?= =?us-ascii?Q?7BPeKonqFtw1BI7ZSCgzP7VpftZ40NiYA+FTR/qseLQpObTrZcp5MsOmZt5q?= =?us-ascii?Q?yEfux3RfoTID+nmBVZVmFjSbP4mOY7XXpcKMNcc8KKI6Pq935mATXjkogRog?= =?us-ascii?Q?TH9zEERC+TI4HQ4HbMKwItoVsw7IOjSgxVCb1YtNBU88FAliTWWtUelpPJ4Q?= =?us-ascii?Q?Gaqe1ukw7qciqLou8bWjxKTBJMUZn1Y7oVy0WRSopVlfsUUojnpZLYAfGPpg?= =?us-ascii?Q?+J1oWMj2Ynv4z+m4rmUpPTu5zZBrUsgX0j0Qf/FkMtdvcFEP9f9BVWq0NYKX?= =?us-ascii?Q?7ynnA+GX6eWkG9sZ/UYa4K+guHdZVtf6tDI2w5e7QO5fyKg5NQKTVZoXCU5N?= =?us-ascii?Q?WritO1Wv1ckALMhSQtTopm8+b226EaQ4RY0TiWFAF7TE/J1txgVJDNjwPbIQ?= =?us-ascii?Q?DQhelY/sVsQlmbip3mu9XdJevUizBwIKhnIk7XE+xfPax3I5kEnlWvEmcnS8?= =?us-ascii?Q?kOF+252CGXuxT5GWQxdPC2j6Mgc3vGctdvoJLVPPGVJG6vSTdLZJXHw80EIq?= =?us-ascii?Q?3Nx/gcra5g4tH3OYZAKB7NVsBiREgIlIrsokWmHNV6nf+gq5UDO/bd4M6c9A?= =?us-ascii?Q?drVaHIum0DnCSorF3NezXDDCFLxad9fFESqv23hQBytp5hLn4M/mdAR1k5Hi?= =?us-ascii?Q?KN2+eKFuKCVeSS7SWnc=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(82310400026)(376014)(7416014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2025 04:06:34.6140 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b63b8be6-5bda-4ec7-9a56-08de3933d702 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0002992E.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB9088 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1765512432150158500 Content-Type: text/plain; charset="utf-8" Rename all the CONFIG_SYSCTL into CONFIG_MGMT_HYPERCALLS to help provide a single option to manage all unnecessary hypercalls, including sysctl, domctl, etc, in dom0less system and PV shim mode, which could also make it easier to support randconfigs. While doing the replacement, we fix some bugs on xsm system: - wrap the whole xsm function to avoid bringing unreachable codes when MGMT_DOMCTL=3Dn - add missing wrapping in include/xsm/dummy.h Suggested-by: Stefano Stabellini Signed-off-by: Penny Zheng Reviewed-by: Stefano Stabellini Reviewed-by: Juergen Gross Acked-by: Stewart Hildebrand #ARINC 653 Acked-by: Jan Beulich Cc: Alistair Francis --- xen/Kconfig.debug | 2 +- xen/arch/arm/Makefile | 2 +- xen/arch/riscv/stubs.c | 4 ++-- xen/arch/x86/Makefile | 2 +- xen/arch/x86/configs/pvshim_defconfig | 2 +- xen/arch/x86/psr.c | 26 +++++++++++++------------- xen/common/Kconfig | 15 ++++++++------- xen/common/Makefile | 2 +- xen/common/page_alloc.c | 8 ++++---- xen/common/perfc.c | 4 ++-- xen/common/sched/arinc653.c | 10 +++++----- xen/common/sched/core.c | 6 +++--- xen/common/sched/cpupool.c | 16 ++++++++-------- xen/common/sched/credit.c | 6 +++--- xen/common/sched/credit2.c | 6 +++--- xen/common/sched/private.h | 4 ++-- xen/common/spinlock.c | 4 ++-- xen/drivers/char/console.c | 4 ++-- xen/include/hypercall-defs.c | 4 ++-- xen/include/xsm/dummy.h | 6 ++++++ xen/include/xsm/xsm.h | 24 +++++++++--------------- xen/xsm/dummy.c | 6 +++--- xen/xsm/flask/hooks.c | 22 +++++++++++----------- 23 files changed, 93 insertions(+), 92 deletions(-) diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug index d900d926c5..a69615cd63 100644 --- a/xen/Kconfig.debug +++ b/xen/Kconfig.debug @@ -37,7 +37,7 @@ config SELF_TESTS =20 config COVERAGE bool "Code coverage support" - depends on SYSCTL && !LIVEPATCH + depends on MGMT_HYPERCALLS && !LIVEPATCH select SUPPRESS_DUPLICATE_SYMBOL_WARNINGS if !ENFORCE_UNIQUE_SYMBOLS help Enable code coverage support. diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index 7494a0f926..069e2c532e 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -51,7 +51,7 @@ obj-y +=3D setup.o obj-y +=3D shutdown.o obj-y +=3D smp.o obj-y +=3D smpboot.o -obj-$(CONFIG_SYSCTL) +=3D sysctl.o +obj-$(CONFIG_MGMT_HYPERCALLS) +=3D sysctl.o obj-y +=3D time.o obj-y +=3D traps.o obj-y +=3D vcpreg.o diff --git a/xen/arch/riscv/stubs.c b/xen/arch/riscv/stubs.c index fe7d85ee1d..cb19a83280 100644 --- a/xen/arch/riscv/stubs.c +++ b/xen/arch/riscv/stubs.c @@ -267,7 +267,7 @@ unsigned long raw_copy_from_guest(void *to, const void = __user *from, BUG_ON("unimplemented"); } =20 -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS /* sysctl.c */ =20 long arch_do_sysctl(struct xen_sysctl *sysctl, @@ -280,7 +280,7 @@ void arch_do_physinfo(struct xen_sysctl_physinfo *pi) { BUG_ON("unimplemented"); } -#endif /* CONFIG_SYSCTL */ +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 /* p2m.c */ =20 diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index 66ce5ad3d7..1e2ce8e72c 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -67,7 +67,7 @@ obj-y +=3D smpboot.o obj-y +=3D spec_ctrl.o obj-y +=3D srat.o obj-y +=3D string.o -obj-$(CONFIG_SYSCTL) +=3D sysctl.o +obj-$(CONFIG_MGMT_HYPERCALLS) +=3D sysctl.o obj-y +=3D time.o obj-y +=3D traps-setup.o obj-y +=3D traps.o diff --git a/xen/arch/x86/configs/pvshim_defconfig b/xen/arch/x86/configs/p= vshim_defconfig index 24f4e4857d..d1db94df78 100644 --- a/xen/arch/x86/configs/pvshim_defconfig +++ b/xen/arch/x86/configs/pvshim_defconfig @@ -25,4 +25,4 @@ CONFIG_PDX_NONE=3Dy # CONFIG_INTEL_IOMMU is not set # CONFIG_DEBUG is not set # CONFIG_GDBSX is not set -# CONFIG_SYSCTL is not set +# CONFIG_MGMT_HYPERCALLS is not set diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c index cce7020868..80ce5804b4 100644 --- a/xen/arch/x86/psr.c +++ b/xen/arch/x86/psr.c @@ -135,7 +135,7 @@ static const struct feat_props { */ enum psr_type alt_type; =20 -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS /* get_feat_info is used to return feature HW info through sysctl. */ bool (*get_feat_info)(const struct feat_node *feat, uint32_t data[], unsigned int array_len); @@ -422,7 +422,7 @@ static bool mba_init_feature(const struct cpuid_leaf *r= egs, return true; } =20 -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS static bool cf_check cat_get_feat_info( const struct feat_node *feat, uint32_t data[], unsigned int array_len) { @@ -435,7 +435,7 @@ static bool cf_check cat_get_feat_info( =20 return true; } -#endif /* CONFIG_SYSCTL */ +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 /* L3 CAT props */ static void cf_check l3_cat_write_msr( @@ -448,14 +448,14 @@ static const struct feat_props l3_cat_props =3D { .cos_num =3D 1, .type[0] =3D PSR_TYPE_L3_CBM, .alt_type =3D PSR_TYPE_UNKNOWN, -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS .get_feat_info =3D cat_get_feat_info, #endif .write_msr =3D l3_cat_write_msr, .sanitize =3D cat_check_cbm, }; =20 -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS /* L3 CDP props */ static bool cf_check l3_cdp_get_feat_info( const struct feat_node *feat, uint32_t data[], uint32_t array_len) @@ -467,7 +467,7 @@ static bool cf_check l3_cdp_get_feat_info( =20 return true; } -#endif /* CONFIG_SYSCTL */ +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static void cf_check l3_cdp_write_msr( unsigned int cos, uint32_t val, enum psr_type type) @@ -483,7 +483,7 @@ static const struct feat_props l3_cdp_props =3D { .type[0] =3D PSR_TYPE_L3_DATA, .type[1] =3D PSR_TYPE_L3_CODE, .alt_type =3D PSR_TYPE_L3_CBM, -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS .get_feat_info =3D l3_cdp_get_feat_info, #endif .write_msr =3D l3_cdp_write_msr, @@ -501,14 +501,14 @@ static const struct feat_props l2_cat_props =3D { .cos_num =3D 1, .type[0] =3D PSR_TYPE_L2_CBM, .alt_type =3D PSR_TYPE_UNKNOWN, -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS .get_feat_info =3D cat_get_feat_info, #endif .write_msr =3D l2_cat_write_msr, .sanitize =3D cat_check_cbm, }; =20 -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS /* MBA props */ static bool cf_check mba_get_feat_info( const struct feat_node *feat, uint32_t data[], unsigned int array_len) @@ -523,7 +523,7 @@ static bool cf_check mba_get_feat_info( =20 return true; } -#endif /* CONFIG_SYSCTL */ +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static void cf_check mba_write_msr( unsigned int cos, uint32_t val, enum psr_type type) @@ -561,7 +561,7 @@ static const struct feat_props mba_props =3D { .cos_num =3D 1, .type[0] =3D PSR_TYPE_MBA_THRTL, .alt_type =3D PSR_TYPE_UNKNOWN, -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS .get_feat_info =3D mba_get_feat_info, #endif .write_msr =3D mba_write_msr, @@ -826,7 +826,7 @@ static struct psr_socket_info *get_socket_info(unsigned= int socket) return socket_info + socket; } =20 -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS int psr_get_info(unsigned int socket, enum psr_type type, uint32_t data[], unsigned int array_len) { @@ -858,7 +858,7 @@ int psr_get_info(unsigned int socket, enum psr_type typ= e, =20 return -EINVAL; } -#endif /* CONFIG_SYSCTL */ +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 int psr_get_val(struct domain *d, unsigned int socket, uint32_t *val, enum psr_type type) diff --git a/xen/common/Kconfig b/xen/common/Kconfig index 218ac3d549..6709c3c95c 100644 --- a/xen/common/Kconfig +++ b/xen/common/Kconfig @@ -508,7 +508,7 @@ config CRYPTO config LIVEPATCH bool "Live patching support" default X86 - depends on "$(XEN_HAS_BUILD_ID)" =3D "y" && SYSCTL && HAS_VMAP + depends on "$(XEN_HAS_BUILD_ID)" =3D "y" && MGMT_HYPERCALLS && HAS_VMAP select CC_SPLIT_SECTIONS help Allows a running Xen hypervisor to be dynamically patched using @@ -600,7 +600,7 @@ config DTB_FILE config TRACEBUFFER bool "Enable tracing infrastructure" if EXPERT default y - depends on SYSCTL + depends on MGMT_HYPERCALLS help Enable tracing infrastructure and pre-defined tracepoints within Xen. This will allow live information about Xen's execution and performance @@ -651,19 +651,20 @@ config SYSTEM_SUSPEND menu "Supported hypercall interfaces" visible if EXPERT =20 -config SYSCTL - bool "Enable sysctl hypercall" +config MGMT_HYPERCALLS + bool "Enable privileged hypercalls for system management" depends on !PV_SHIM_EXCLUSIVE default y help This option shall only be disabled on some dom0less systems, or - PV shim on x86, to reduce Xen footprint. + PV shim on x86, to reduce Xen footprint via managing unnessary + hypercalls, like sysctl, etc. =20 endmenu =20 config PM_OP bool "Enable Performance Management Operation" - depends on ACPI && HAS_CPUFREQ && SYSCTL + depends on ACPI && HAS_CPUFREQ && MGMT_HYPERCALLS default y help This option shall enable userspace performance management control @@ -671,7 +672,7 @@ config PM_OP =20 config PM_STATS bool "Enable Performance Management Statistics" - depends on ACPI && HAS_CPUFREQ && SYSCTL + depends on ACPI && HAS_CPUFREQ && MGMT_HYPERCALLS default y help Enable collection of performance management statistics to aid in diff --git a/xen/common/Makefile b/xen/common/Makefile index 8486c0b510..4353ea59a4 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -51,7 +51,7 @@ obj-y +=3D spinlock.o obj-$(CONFIG_STACK_PROTECTOR) +=3D stack-protector.o obj-y +=3D stop_machine.o obj-y +=3D symbols.o -obj-$(CONFIG_SYSCTL) +=3D sysctl.o +obj-$(CONFIG_MGMT_HYPERCALLS) +=3D sysctl.o obj-y +=3D tasklet.o obj-y +=3D time.o obj-y +=3D timer.o diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index 1f67b88a89..26615d1e97 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -602,7 +602,7 @@ out: return ret; } =20 -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS void get_outstanding_claims(uint64_t *free_pages, uint64_t *outstanding_pa= ges) { spin_lock(&heap_lock); @@ -610,7 +610,7 @@ void get_outstanding_claims(uint64_t *free_pages, uint6= 4_t *outstanding_pages) *free_pages =3D avail_heap_pages(MEMZONE_XEN + 1, NR_ZONES - 1, -1); spin_unlock(&heap_lock); } -#endif /* CONFIG_SYSCTL */ +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static bool __read_mostly first_node_initialised; #ifndef CONFIG_SEPARATE_XENHEAP @@ -1788,7 +1788,7 @@ int offline_page(mfn_t mfn, int broken, uint32_t *sta= tus) return 0; } =20 -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS /* * Online the memory. * The caller should make sure end_pfn <=3D max_page, @@ -1873,7 +1873,7 @@ int query_page_offline(mfn_t mfn, uint32_t *status) =20 return 0; } -#endif /* CONFIG_SYSCTL */ +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 /* * This function should only be called with valid pages from the same NUMA diff --git a/xen/common/perfc.c b/xen/common/perfc.c index 0f3b89af2c..97a94ef1fc 100644 --- a/xen/common/perfc.c +++ b/xen/common/perfc.c @@ -149,7 +149,7 @@ void cf_check perfc_reset(unsigned char key) } } =20 -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS static struct xen_sysctl_perfc_desc perfc_d[NR_PERFCTRS]; static xen_sysctl_perfc_val_t *perfc_vals; static unsigned int perfc_nbr_vals; @@ -266,7 +266,7 @@ int perfc_control(struct xen_sysctl_perfc_op *pc) =20 return rc; } -#endif /* CONFIG_SYSCTL */ +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 /* * Local variables: diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c index 8a4f4259d8..7d6c40d800 100644 --- a/xen/common/sched/arinc653.c +++ b/xen/common/sched/arinc653.c @@ -220,7 +220,7 @@ static void update_schedule_units(const struct schedule= r *ops) SCHED_PRIV(ops)->schedule[i].unit_id); } =20 -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS /** * This function is called by the adjust_global scheduler hook to put * in place a new ARINC653 schedule. @@ -335,7 +335,7 @@ arinc653_sched_get( =20 return 0; } -#endif /* CONFIG_SYSCTL */ +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 /************************************************************************** * Scheduler callback functions * @@ -661,7 +661,7 @@ a653_switch_sched(struct scheduler *new_ops, unsigned i= nt cpu, return &sr->_lock; } =20 -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS /** * Xen scheduler callback function to perform a global (not domain-specifi= c) * adjustment. It is used by the ARINC 653 scheduler to put in place a new @@ -701,7 +701,7 @@ a653sched_adjust_global(const struct scheduler *ops, =20 return rc; } -#endif /* CONFIG_SYSCTL */ +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 /** * This structure defines our scheduler for Xen. @@ -736,7 +736,7 @@ static const struct scheduler sched_arinc653_def =3D { .switch_sched =3D a653_switch_sched, =20 .adjust =3D NULL, -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS .adjust_global =3D a653sched_adjust_global, #endif =20 diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c index ec2448cfa1..88150432c3 100644 --- a/xen/common/sched/core.c +++ b/xen/common/sched/core.c @@ -2064,7 +2064,7 @@ long do_set_timer_op(s_time_t timeout) return 0; } =20 -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS /* scheduler_id - fetch ID of current scheduler */ int scheduler_id(void) { @@ -2107,7 +2107,7 @@ long sched_adjust(struct domain *d, struct xen_domctl= _scheduler_op *op) return ret; } =20 -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS long sched_adjust_global(struct xen_sysctl_scheduler_op *op) { struct cpupool *pool; @@ -2136,7 +2136,7 @@ long sched_adjust_global(struct xen_sysctl_scheduler_= op *op) =20 return rc; } -#endif /* CONFIG_SYSCTL */ +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static void vcpu_periodic_timer_work_locked(struct vcpu *v) { diff --git a/xen/common/sched/cpupool.c b/xen/common/sched/cpupool.c index f5459c2779..51ba3cb43d 100644 --- a/xen/common/sched/cpupool.c +++ b/xen/common/sched/cpupool.c @@ -241,12 +241,12 @@ struct cpupool *cpupool_get_by_id(unsigned int poolid) return __cpupool_get_by_id(poolid, true); } =20 -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS static struct cpupool *cpupool_get_next_by_id(unsigned int poolid) { return __cpupool_get_by_id(poolid, false); } -#endif /* CONFIG_SYSCTL */ +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 void cpupool_put(struct cpupool *pool) { @@ -354,7 +354,7 @@ static struct cpupool *cpupool_create(unsigned int pool= id, =20 return ERR_PTR(ret); } -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS /* * destroys the given cpupool * returns 0 on success, 1 else @@ -382,7 +382,7 @@ static int cpupool_destroy(struct cpupool *c) debugtrace_printk("cpupool_destroy(pool=3D%u)\n", c->cpupool_id); return 0; } -#endif /* CONFIG_SYSCTL */ +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 /* * Move domain to another cpupool @@ -572,7 +572,7 @@ static int cpupool_unassign_cpu_start(struct cpupool *c= , unsigned int cpu) return ret; } =20 -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS static long cf_check cpupool_unassign_cpu_helper(void *info) { struct cpupool *c =3D info; @@ -638,7 +638,7 @@ static int cpupool_unassign_cpu(struct cpupool *c, unsi= gned int cpu) } return continue_hypercall_on_cpu(work_cpu, cpupool_unassign_cpu_helper= , c); } -#endif /* CONFIG_SYSCTL */ +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 /* * add a new domain to a cpupool @@ -816,7 +816,7 @@ static void cpupool_cpu_remove_forced(unsigned int cpu) rcu_read_unlock(&sched_res_rculock); } =20 -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS /* * do cpupool related sysctl operations */ @@ -982,7 +982,7 @@ int cpupool_do_sysctl(struct xen_sysctl_cpupool_op *op) =20 return ret; } -#endif /* CONFIG_SYSCTL */ +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 unsigned int cpupool_get_id(const struct domain *d) { diff --git a/xen/common/sched/credit.c b/xen/common/sched/credit.c index e9a91d11c3..e8fef6fb51 100644 --- a/xen/common/sched/credit.c +++ b/xen/common/sched/credit.c @@ -1256,7 +1256,7 @@ __csched_set_tslice(struct csched_private *prv, unsig= ned int timeslice_ms) prv->credit =3D prv->credits_per_tslice * prv->ncpus; } =20 -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS static int cf_check csched_sys_cntl(const struct scheduler *ops, struct xen_sysctl_scheduler_op *sc) @@ -1299,7 +1299,7 @@ csched_sys_cntl(const struct scheduler *ops, out: return rc; } -#endif /* CONFIG_SYSCTL */ +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static void *cf_check csched_alloc_domdata(const struct scheduler *ops, struct domain *dom) @@ -2290,7 +2290,7 @@ static const struct scheduler sched_credit_def =3D { =20 .adjust =3D csched_dom_cntl, .adjust_affinity=3D csched_aff_cntl, -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS .adjust_global =3D csched_sys_cntl, #endif =20 diff --git a/xen/common/sched/credit2.c b/xen/common/sched/credit2.c index 75316d42b7..307e63ebd8 100644 --- a/xen/common/sched/credit2.c +++ b/xen/common/sched/credit2.c @@ -3131,7 +3131,7 @@ csched2_aff_cntl(const struct scheduler *ops, struct = sched_unit *unit, __clear_bit(__CSFLAG_pinned, &svc->flags); } =20 -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS static int cf_check csched2_sys_cntl( const struct scheduler *ops, struct xen_sysctl_scheduler_op *sc) { @@ -3163,7 +3163,7 @@ static int cf_check csched2_sys_cntl( =20 return 0; } -#endif /* CONFIG_SYSCTL */ +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static void *cf_check csched2_alloc_domdata(const struct scheduler *ops, struct domain *dom) @@ -4248,7 +4248,7 @@ static const struct scheduler sched_credit2_def =3D { =20 .adjust =3D csched2_dom_cntl, .adjust_affinity=3D csched2_aff_cntl, -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS .adjust_global =3D csched2_sys_cntl, #endif =20 diff --git a/xen/common/sched/private.h b/xen/common/sched/private.h index d6884550cd..b7ff67200b 100644 --- a/xen/common/sched/private.h +++ b/xen/common/sched/private.h @@ -356,7 +356,7 @@ struct scheduler { struct sched_unit *unit, const struct cpumask *hard, const struct cpumask *soft); -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS int (*adjust_global) (const struct scheduler *ops, struct xen_sysctl_scheduler_op *sc); #endif @@ -512,7 +512,7 @@ static inline int sched_adjust_dom(const struct schedul= er *s, struct domain *d, return s->adjust ? s->adjust(s, d, op) : 0; } =20 -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS static inline int sched_adjust_cpupool(const struct scheduler *s, struct xen_sysctl_scheduler_op *op) { diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c index 0389293b09..9d08159615 100644 --- a/xen/common/spinlock.c +++ b/xen/common/spinlock.c @@ -690,7 +690,7 @@ void cf_check spinlock_profile_reset(unsigned char key) spinlock_profile_iterate(spinlock_profile_reset_elem, NULL); } =20 -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS typedef struct { struct xen_sysctl_lockprof_op *pc; int rc; @@ -750,7 +750,7 @@ int spinlock_profile_control(struct xen_sysctl_lockprof= _op *pc) =20 return rc; } -#endif /* CONFIG_SYSCTL */ +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 void _lock_profile_register_struct( int32_t type, struct lock_profile_qhead *qhead, int32_t idx) diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c index a996051035..baed7121c3 100644 --- a/xen/drivers/char/console.c +++ b/xen/drivers/char/console.c @@ -371,7 +371,7 @@ static void conring_puts(const char *str, size_t len) conringc =3D conringp - conring_size; } =20 -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS long read_console_ring(struct xen_sysctl_readconsole *op) { XEN_GUEST_HANDLE_PARAM(char) str; @@ -414,7 +414,7 @@ long read_console_ring(struct xen_sysctl_readconsole *o= p) =20 return 0; } -#endif /* CONFIG_SYSCTL */ +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 =20 /* diff --git a/xen/include/hypercall-defs.c b/xen/include/hypercall-defs.c index cef08eeec1..4840de805b 100644 --- a/xen/include/hypercall-defs.c +++ b/xen/include/hypercall-defs.c @@ -194,7 +194,7 @@ kexec_op(unsigned long op, void *uarg) #ifdef CONFIG_IOREQ_SERVER dm_op(domid_t domid, unsigned int nr_bufs, xen_dm_op_buf_t *bufs) #endif -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS sysctl(xen_sysctl_t *u_sysctl) #endif #if defined(CONFIG_X86) && defined(CONFIG_PAGING) && !defined(CONFIG_PV_SH= IM_EXCLUSIVE) @@ -277,7 +277,7 @@ physdev_op compat do hv= m hvm do_arm #ifdef CONFIG_HVM hvm_op do do do do do #endif -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS sysctl do do do do do #endif #ifndef CONFIG_PV_SHIM_EXCLUSIVE diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h index e801dbcdba..df8d737c18 100644 --- a/xen/include/xsm/dummy.h +++ b/xen/include/xsm/dummy.h @@ -148,11 +148,13 @@ static XSM_INLINE int cf_check xsm_domctl_scheduler_o= p( return xsm_default_action(action, current->domain, d); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS static XSM_INLINE int cf_check xsm_sysctl_scheduler_op(XSM_DEFAULT_ARG int= cmd) { XSM_ASSERT_ACTION(XSM_HOOK); return xsm_default_action(action, current->domain, NULL); } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static XSM_INLINE int cf_check xsm_set_target( XSM_DEFAULT_ARG struct domain *d, struct domain *e) @@ -180,6 +182,7 @@ static XSM_INLINE int cf_check xsm_domctl( } } =20 +#ifdef CONFIG_MGMT_HYPERCALLS static XSM_INLINE int cf_check xsm_sysctl(XSM_DEFAULT_ARG int cmd) { XSM_ASSERT_ACTION(XSM_PRIV); @@ -191,6 +194,7 @@ static XSM_INLINE int cf_check xsm_readconsole(XSM_DEFA= ULT_ARG uint32_t clear) XSM_ASSERT_ACTION(XSM_HOOK); return xsm_default_action(action, current->domain, NULL); } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static XSM_INLINE int cf_check xsm_alloc_security_domain(struct domain *d) { @@ -485,11 +489,13 @@ static XSM_INLINE int cf_check xsm_resource_setup_mis= c(XSM_DEFAULT_VOID) return xsm_default_action(action, current->domain, NULL); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS static XSM_INLINE int cf_check xsm_page_offline(XSM_DEFAULT_ARG uint32_t c= md) { XSM_ASSERT_ACTION(XSM_HOOK); return xsm_default_action(action, current->domain, NULL); } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static XSM_INLINE int cf_check xsm_hypfs_op(XSM_DEFAULT_VOID) { diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h index 2d831d7745..d20d4ae657 100644 --- a/xen/include/xsm/xsm.h +++ b/xen/include/xsm/xsm.h @@ -57,13 +57,15 @@ struct xsm_ops { int (*domain_create)(struct domain *d, uint32_t ssidref); int (*getdomaininfo)(struct domain *d); int (*domctl_scheduler_op)(struct domain *d, int op); -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS int (*sysctl_scheduler_op)(int op); #endif int (*set_target)(struct domain *d, struct domain *e); int (*domctl)(struct domain *d, unsigned int cmd, uint32_t ssidref); +#ifdef CONFIG_MGMT_HYPERCALLS int (*sysctl)(int cmd); int (*readconsole)(uint32_t clear); +#endif =20 int (*evtchn_unbound)(struct domain *d, struct evtchn *chn, domid_t id= 2); int (*evtchn_interdomain)(struct domain *d1, struct evtchn *chn1, @@ -140,7 +142,7 @@ struct xsm_ops { int (*resource_setup_gsi)(int gsi); int (*resource_setup_misc)(void); =20 -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS int (*page_offline)(uint32_t cmd); #endif int (*hypfs_op)(void); @@ -246,7 +248,7 @@ static inline int xsm_domctl_scheduler_op( return alternative_call(xsm_ops.domctl_scheduler_op, d, cmd); } =20 -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS static inline int xsm_sysctl_scheduler_op(xsm_default_t def, int cmd) { return alternative_call(xsm_ops.sysctl_scheduler_op, cmd); @@ -265,23 +267,17 @@ static inline int xsm_domctl(xsm_default_t def, struc= t domain *d, return alternative_call(xsm_ops.domctl, d, cmd, ssidref); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS static inline int xsm_sysctl(xsm_default_t def, int cmd) { -#ifdef CONFIG_SYSCTL return alternative_call(xsm_ops.sysctl, cmd); -#else - return -EOPNOTSUPP; -#endif } =20 static inline int xsm_readconsole(xsm_default_t def, uint32_t clear) { -#ifdef CONFIG_SYSCTL return alternative_call(xsm_ops.readconsole, clear); -#else - return -EOPNOTSUPP; -#endif } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static inline int xsm_evtchn_unbound( xsm_default_t def, struct domain *d1, struct evtchn *chn, domid_t id2) @@ -601,14 +597,12 @@ static inline int xsm_resource_setup_misc(xsm_default= _t def) return alternative_call(xsm_ops.resource_setup_misc); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS static inline int xsm_page_offline(xsm_default_t def, uint32_t cmd) { -#ifdef CONFIG_SYSCTL return alternative_call(xsm_ops.page_offline, cmd); -#else - return -EOPNOTSUPP; -#endif } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static inline int xsm_hypfs_op(xsm_default_t def) { diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c index 96dc82ac2e..2c70b979d6 100644 --- a/xen/xsm/dummy.c +++ b/xen/xsm/dummy.c @@ -19,12 +19,12 @@ static const struct xsm_ops __initconst_cf_clobber dumm= y_ops =3D { .domain_create =3D xsm_domain_create, .getdomaininfo =3D xsm_getdomaininfo, .domctl_scheduler_op =3D xsm_domctl_scheduler_op, -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS .sysctl_scheduler_op =3D xsm_sysctl_scheduler_op, #endif .set_target =3D xsm_set_target, .domctl =3D xsm_domctl, -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS .sysctl =3D xsm_sysctl, .readconsole =3D xsm_readconsole, #endif @@ -98,7 +98,7 @@ static const struct xsm_ops __initconst_cf_clobber dummy_= ops =3D { .resource_setup_gsi =3D xsm_resource_setup_gsi, .resource_setup_misc =3D xsm_resource_setup_misc, =20 -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS .page_offline =3D xsm_page_offline, #endif .hypfs_op =3D xsm_hypfs_op, diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c index a43cd361a2..490823913e 100644 --- a/xen/xsm/flask/hooks.c +++ b/xen/xsm/flask/hooks.c @@ -626,7 +626,7 @@ static int cf_check flask_domctl_scheduler_op(struct do= main *d, int op) } } =20 -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS static int cf_check flask_sysctl_scheduler_op(int op) { switch ( op ) @@ -641,7 +641,7 @@ static int cf_check flask_sysctl_scheduler_op(int op) return avc_unknown_permission("sysctl_scheduler_op", op); } } -#endif /* CONFIG_SYSCTL */ +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static int cf_check flask_set_target(struct domain *d, struct domain *t) { @@ -858,7 +858,7 @@ static int cf_check flask_domctl(struct domain *d, unsi= gned int cmd, } } =20 -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS static int cf_check flask_sysctl(int cmd) { switch ( cmd ) @@ -946,7 +946,7 @@ static int cf_check flask_readconsole(uint32_t clear) =20 return domain_has_xen(current->domain, perms); } -#endif /* CONFIG_SYSCTL */ +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static inline uint32_t resource_to_perm(uint8_t access) { @@ -1203,12 +1203,12 @@ static int cf_check flask_resource_unplug_core(void) return avc_current_has_perm(SECINITSID_DOMXEN, SECCLASS_RESOURCE, RESO= URCE__UNPLUG, NULL); } =20 -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS static int flask_resource_use_core(void) { return avc_current_has_perm(SECINITSID_DOMXEN, SECCLASS_RESOURCE, RESO= URCE__USE, NULL); } -#endif /* CONFIG_SYSCTL */ +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static int cf_check flask_resource_plug_pci(uint32_t machine_bdf) { @@ -1273,7 +1273,7 @@ static int cf_check flask_resource_setup_misc(void) return avc_current_has_perm(SECINITSID_XEN, SECCLASS_RESOURCE, RESOURC= E__SETUP, NULL); } =20 -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS static inline int cf_check flask_page_offline(uint32_t cmd) { switch ( cmd ) @@ -1288,7 +1288,7 @@ static inline int cf_check flask_page_offline(uint32_= t cmd) return avc_unknown_permission("page_offline", cmd); } } -#endif /* CONFIG_SYSCTL */ +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static inline int cf_check flask_hypfs_op(void) { @@ -1884,12 +1884,12 @@ static const struct xsm_ops __initconst_cf_clobber = flask_ops =3D { .domain_create =3D flask_domain_create, .getdomaininfo =3D flask_getdomaininfo, .domctl_scheduler_op =3D flask_domctl_scheduler_op, -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS .sysctl_scheduler_op =3D flask_sysctl_scheduler_op, #endif .set_target =3D flask_set_target, .domctl =3D flask_domctl, -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS .sysctl =3D flask_sysctl, .readconsole =3D flask_readconsole, #endif @@ -1951,7 +1951,7 @@ static const struct xsm_ops __initconst_cf_clobber fl= ask_ops =3D { .resource_setup_gsi =3D flask_resource_setup_gsi, .resource_setup_misc =3D flask_resource_setup_misc, =20 -#ifdef CONFIG_SYSCTL +#ifdef CONFIG_MGMT_HYPERCALLS .page_offline =3D flask_page_offline, #endif .hypfs_op =3D flask_hypfs_op, --=20 2.34.1 From nobody Sun Dec 14 05:55:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1765512425; cv=pass; d=zohomail.com; s=zohoarc; b=j77a3L3DuHM//FJBJl5gcRTZ0t8Gt2vmmcNUBD/iDxIFCqUcpjDu0Z2zOJ9U57tJR0zxJzy5h6qpG/JM0Gl9A6awUYb7vPrI7CdHLgQ315RcIPmJQio36bjoehyeKeyV5zBkJ3sywQUK+uOts6rS5/vP32+aCafRHj9mMJM/ORc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765512425; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=tU7WN++E8sGJQqM5bzkULDc4QRrCLty/nbwKRMgzHgo=; b=TFfx4qyzks3oFzCX6g8v9j+4vpwOnJmY2ficXD9cStdfWkvFRrVri/YaALU7/5hFmAnUjK3OA8thsWDHjlPlX/rg43dKPpxiTRN2ewGF55cWjiPBxImJtHhrxL/yi+Ryb/sm+RYF5hb5dozqoBk2JidPgiCFR1OrxtvOtejbLYg= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1765512425886356.87621192671327; Thu, 11 Dec 2025 20:07:05 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1184896.1507212 (Exim 4.92) (envelope-from ) id 1vTuQV-0008FX-Q4; Fri, 12 Dec 2025 04:06:43 +0000 Received: by outflank-mailman (output) from mailman id 1184896.1507212; Fri, 12 Dec 2025 04:06:43 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vTuQV-0008FQ-NK; Fri, 12 Dec 2025 04:06:43 +0000 Received: by outflank-mailman (input) for mailman id 1184896; Fri, 12 Dec 2025 04:06:42 +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 1vTuQU-0007Dl-NJ for xen-devel@lists.xenproject.org; Fri, 12 Dec 2025 04:06:42 +0000 Received: from DM1PR04CU001.outbound.protection.outlook.com (mail-centralusazlp170100005.outbound.protection.outlook.com [2a01:111:f403:c111::5]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id f6a96121-d70f-11f0-b15b-2bf370ae4941; Fri, 12 Dec 2025 05:06:42 +0100 (CET) Received: from BN9PR03CA0943.namprd03.prod.outlook.com (2603:10b6:408:108::18) by DM4PR12MB5866.namprd12.prod.outlook.com (2603:10b6:8:65::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.10; Fri, 12 Dec 2025 04:06:38 +0000 Received: from BL02EPF0002992D.namprd02.prod.outlook.com (2603:10b6:408:108:cafe::3a) by BN9PR03CA0943.outlook.office365.com (2603:10b6:408:108::18) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9388.14 via Frontend Transport; Fri, 12 Dec 2025 04:06:33 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by BL02EPF0002992D.mail.protection.outlook.com (10.167.249.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.4 via Frontend Transport; Fri, 12 Dec 2025 04:06:37 +0000 Received: from penny-System-Product-Name.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Thu, 11 Dec 2025 22:06:34 -0600 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: f6a96121-d70f-11f0-b15b-2bf370ae4941 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=neiIUiL8+UYO6+/iz5uvzP81WNLMOtxqUO1/FCIpzC8bbvx6Mosx2HPRdvw3G8kOiTgXFKDlOWZKva9mxRORADMA2+mXKxm/kTA40aPWHraljd6C/9ivsSnZCUMoNpyCzKW6D3BXx3ebIqUlWefEoGbvH2OCJZE8EJLfP0kRv6FLL50S61LrD6UWa9rSFGFA1FsrwYByzkY3nlD2zveYWgMfOivXdpssztMny+MUZgfLKfkqL9YT0Ow+1Ccx/aecoW29O1VYjgniUevKPHo5UxzfUSpejazWTOj9fjA05muw1bqCuumz49fO7xYaVZThS7oj0wmG65i+DJk9jWu4zQ== 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=tU7WN++E8sGJQqM5bzkULDc4QRrCLty/nbwKRMgzHgo=; b=JTGtbPxCrtSAv18NAbG+gObbQ5fZrlC7YnSTWBVWYLCaMOgMbdAvfPuyXDcU5xnavVOkYr5ikqK1okDLLVEZEqs9RWqt9ioXd9MeEfCodDqY7HsAdTzQffNCzXpL5jFJq1zTDCLNa5ombuxFOFaRTzwS7rTe5Llbz0Jt+EsKvs4xUNUER041ltGaBS53IxSGIgKMojVISREDxZi6U0hPIe73CgYQXh95OBMi2rkrkJM15P9U3WL57xd0n/zuPU6sMa2q2Sh7X1uaBQNIRJ41aJMIWLog7wu8MuubHsltDpKyNvsTAJibdYSVySawX1/rXXvvKaiHZr22KFmYCtntWw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tU7WN++E8sGJQqM5bzkULDc4QRrCLty/nbwKRMgzHgo=; b=xZwjR93WzkxPezJuHGwgNlyfg0T6srouPfiRbORvmb7zK3naUgyrVjrtHnUxmGfaEyY/VCU14H2wtcFCD1/20+4kbnW9f9nw0U0Ss7GggDTrhdOumqT3G+6wU5kBE7uq3Trg3lJk4zsep9Aoa9IqD8QC647GEnaAO1HgytS6DMk= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; 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; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C From: Penny Zheng To: CC: , , Penny Zheng , Andrew Cooper , "Anthony PERARD" , Michal Orzel , "Jan Beulich" , Julien Grall , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , "Stefano Stabellini" Subject: [PATCH v5 05/24] xen/domctl: make MGMT_HYPERCALLS transiently def_bool Date: Fri, 12 Dec 2025 12:01:50 +0800 Message-ID: <20251212040209.1970553-6-Penny.Zheng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251212040209.1970553-1-Penny.Zheng@amd.com> References: <20251212040209.1970553-1-Penny.Zheng@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0002992D:EE_|DM4PR12MB5866:EE_ X-MS-Office365-Filtering-Correlation-Id: bf747ca1-ffb7-4408-451d-08de3933d8bd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?fgQ+bFyE48U+ki6H4xhXvAV526BPcTEStVHotJakbpoBXhJCbD9QCaWXQvGD?= =?us-ascii?Q?yuRpCF4jzJnLANxTrqmcovkF/kjIeeiH2UYUfHRbOGWlJ8hqDQAxYPId70Wp?= =?us-ascii?Q?waQjXq03YgfgnZ37s1+4EgyPtAJ53Lofk+VEY0qc+EJ9i1Fo5Znb1kYICPdt?= =?us-ascii?Q?NfxXXxeIlTiIFQdlv149KCIhJ4YxcZpj3jSO1PbFdIMuXNua4Gg+TvHfhKDb?= =?us-ascii?Q?k+7td068mNfuR5I3ERmr4RenLfTVdBj8iPcRt19rj9Ne4DuKnt15KQDC8WXc?= =?us-ascii?Q?fEc+HF1ZBCjbl9juX2kErGhMUrDRaKwLLdq86txdMA5nmkqwa6kvLsT0Wfbi?= =?us-ascii?Q?1w/X1vkVcp7fvbhkKa6dvJgcpoEecyGk3x2jg8l1nNapXym+W4bZf1hQ1uWa?= =?us-ascii?Q?k1hc4l6472wYV217PBO+NaGgiZLclxfToe1HQisKh6h+r1HZJGSSf7POj+RY?= =?us-ascii?Q?MdqUKmSWESdONlePvpNjEfJne9Ri3oBOj1uwiXIl1vXI+MIwoqj2czv14Im9?= =?us-ascii?Q?nmBgeZ78/nYgl17+QQll6iVoBLJCBnDO2gZ5PtT1ijBTZeZJahfY8xRHvQtB?= =?us-ascii?Q?MQyiNdOxDVjqBAxj+17CwowQHR+ioo/6Jp+rfdk48UpE78bRHy9pptXQJ7kA?= =?us-ascii?Q?XCGnf4fIYJ2UIF+24djdIgDdn5j+ARpUXea79yfYRxzpOAKKLoFRqnOha5Sz?= =?us-ascii?Q?SalHQ6V+Ergcq+7FhP+Hvn2PjaukL4MLYfITC9RV+0Bi0aeNKGdaVo2CJ7wd?= =?us-ascii?Q?ts26gnuciX5sGuYSAM/5f12xpLOcdCiYKmszfF4timPECt48iipKLcOzESbl?= =?us-ascii?Q?nOLwcO/opQBXMl2Q3ELpRrgSxREKvyz8ZT3GQPteCNS/BWQyIjWpk5yu7mqp?= =?us-ascii?Q?WfUS9DSuA+S9l0TNCcJGZxOTJWvu585YaFFrzP1SDhbOIYcS+MV/5LeVvvNd?= =?us-ascii?Q?TUtqhCb4ebTTxPTkxBZu//E7SRU/3YP0O7ByCBNQ5zQhPtfvwrHqmVem2Wbp?= =?us-ascii?Q?Ib8yj5H4/bk9pAqXFpZcKvyThJ27U40m+TZWR2auW3oLnk4oP0wG0OOHY4D8?= =?us-ascii?Q?dIlBliOXhI/J9AJwk9WpzkLO5z9D4qqvV8Dp53ZYp8J30BPoHqdfz9c9xRnp?= =?us-ascii?Q?/Jmm1FTzyneIsNqKMs8leFafaGsMs5mbpykrdki6tD02O6vP4yEDnMtZqCVR?= =?us-ascii?Q?MgKjsROCO6x6mXdUrNKbcCkT/ARZ4ezyfPJblQIDyKqQUBoIokpgsTFyRB4a?= =?us-ascii?Q?OtX7HhaKLGtYRG4NT3j+bUpKe05dHwMAC/1VCGzz2+vVzSeMiLWgqHNFBqE+?= =?us-ascii?Q?bZ4Il7H3G/EL241jGdkyhXWT6a2bTgvZD45BbxF6Eh4BzKsf3ZrUNYeWb+Rs?= =?us-ascii?Q?E81t2hk7YHMIn7ujb7+KDYAUrrLwJw9MSbFhAybym956BP8rdUQQEGh2z1+L?= =?us-ascii?Q?2kRoQpNz8w8WfkbXPTWoRwh8udGVk4E/nS4qlDbYVaT4cCMn+fgIW7c7WWlr?= =?us-ascii?Q?FDKva19tZgAGR7uLCCnMAGg5y2Arb++GH0vcpb07KQ5qWtGYxdbXLXvj+cQV?= =?us-ascii?Q?5wlmtoe8eS+dlMNNLbE=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(1800799024)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2025 04:06:37.5148 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bf747ca1-ffb7-4408-451d-08de3933d8bd X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0002992D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5866 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1765512426054158500 Content-Type: text/plain; charset="utf-8" In order to asist in reviewing/developing disabling domctl-op patch serie, we will transiently make MGMT_HYPERCALLS def_bool. And it will become optional at the last of domctl-op patch serie, where common/domctl.o's building as a whole becomes dependent upon that setting. Signed-off-by: Penny Zheng --- v2 -> v3: - new commit --- v4 -> v5: - Remove "bool xxx" is to actually remove prompt --- xen/common/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xen/common/Kconfig b/xen/common/Kconfig index 6709c3c95c..7f7ed62f78 100644 --- a/xen/common/Kconfig +++ b/xen/common/Kconfig @@ -652,9 +652,8 @@ menu "Supported hypercall interfaces" visible if EXPERT =20 config MGMT_HYPERCALLS - bool "Enable privileged hypercalls for system management" + def_bool y depends on !PV_SHIM_EXCLUSIVE - default y help This option shall only be disabled on some dom0less systems, or PV shim on x86, to reduce Xen footprint via managing unnessary --=20 2.34.1 From nobody Sun Dec 14 05:55:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1765512429; cv=pass; d=zohomail.com; s=zohoarc; b=VbGH7c98lqqAcxn2djwN7WbXZY9gpsgEQOHHCd/Y8bNqt9i58zrRSAIcmbLYCgP4g9KLHAusta2hZ5JSxIaiEYhaegmnaNOXTbrNGVCKCCFMA3RJwyxhjkkKhZPQT6PMwVT3HPTDHSA4sId7eLZ+sfzNu93EAQYe1mz96X9gyJY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765512429; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=HP0m5fEJkd3B7Qh6DPpCoP4ZtIZdbWL+1PtIZr2jEUk=; b=ZkghlE0+Q/t6oCJyI2p1Sde/2ipnPBzaZ7lEsjFcIqKD9C108RDjEkpfvgCjYyv0LnKJkssznRg+SmliEvR14mYshzuxS3kVZp4Xi7bt277AQNPqZwmjk9mMc/RJX9BCEV8EljffDbuEdP1hi9vwLEYDTffKbXl68i4IFm352Go= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1765512429064276.5084843396145; Thu, 11 Dec 2025 20:07:09 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1184901.1507225 (Exim 4.92) (envelope-from ) id 1vTuQa-0000Du-BJ; Fri, 12 Dec 2025 04:06:48 +0000 Received: by outflank-mailman (output) from mailman id 1184901.1507225; Fri, 12 Dec 2025 04:06:48 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vTuQa-0000D3-7D; Fri, 12 Dec 2025 04:06:48 +0000 Received: by outflank-mailman (input) for mailman id 1184901; Fri, 12 Dec 2025 04:06:46 +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 1vTuQY-0007SS-SA for xen-devel@lists.xenproject.org; Fri, 12 Dec 2025 04:06:46 +0000 Received: from CH5PR02CU005.outbound.protection.outlook.com (mail-northcentralusazlp170120005.outbound.protection.outlook.com [2a01:111:f403:c105::5]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id f86857ee-d70f-11f0-9cce-f158ae23cfc8; Fri, 12 Dec 2025 05:06:45 +0100 (CET) Received: from MN2PR15CA0056.namprd15.prod.outlook.com (2603:10b6:208:237::25) by MN0PR12MB5905.namprd12.prod.outlook.com (2603:10b6:208:379::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.10; Fri, 12 Dec 2025 04:06:40 +0000 Received: from BL02EPF0002992A.namprd02.prod.outlook.com (2603:10b6:208:237:cafe::6a) by MN2PR15CA0056.outlook.office365.com (2603:10b6:208:237::25) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9412.9 via Frontend Transport; Fri, 12 Dec 2025 04:06:40 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by BL02EPF0002992A.mail.protection.outlook.com (10.167.249.55) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.4 via Frontend Transport; Fri, 12 Dec 2025 04:06:40 +0000 Received: from penny-System-Product-Name.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Thu, 11 Dec 2025 22:06:37 -0600 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: f86857ee-d70f-11f0-9cce-f158ae23cfc8 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LkBDPd0DrInEZIiMaTSfRuvDKpsOIKzMdm4NphF7pR3oMV17ml4lsXsiuvxNQXwqE8f/ziAfp/ZUYWqkEVUc69eiNHLNUzL6SPPFqCgxMpNoF8jMijv5Rmi+NWvwGCCgdcYp5RmcfiHn/83E8+x68KNoNBWbCZIvC3TpYrno4d7Ji/gSp2dtctLvhMZMzukPRW5iyKN3aNI8ODJD5TPPbXMN0B7XOZU9M4aiz3IpYdsiZwcHyblCq4WMk2K/h+s++p6lkXAF6KqmNKewXza1pJGfzmhbTrRYHLMUzUQeBhJTZBUFeXJT8WHdINoV70SykLZyU0eh2BzjPOW7fMM6Ng== 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=HP0m5fEJkd3B7Qh6DPpCoP4ZtIZdbWL+1PtIZr2jEUk=; b=OwsdefG2j7Km19KVSBORyTs6cZqwU+QZizhjiuXaPLj/34xI+WQpCFAFzz2/9c9mEcLQHpOASImbKWn1C1QcIkRRyJtuWLQjFoBz21sRWoAmFlS90C0nhreaC7BAC7QfRJHqOalwgJHmOqKZlLJYATpYPH7Etl3Fo6hH/cfDBQvGWyse6EALAgZkCGrPIhP5z/ZFnWgA3IOU4fgCtvwx5L7LmNu++ekUEhU0pS+NxCWgLQ7CUsf5Z+pmMH1VwRU8lV78yMEblqFF0y+2bFG+NBpEMiwDiZxtcCpyyAQCd/51OcKJHdH0QEfzgv/Tt6jvfJQE+urz/y0Pk0Vl4dz4mQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HP0m5fEJkd3B7Qh6DPpCoP4ZtIZdbWL+1PtIZr2jEUk=; b=kQlNjhkfEiL59HQQ7uX4P1UU6jBrdRVBI62UtC4VkVTnhElfOghbwZZmcBmTQNmujRKcWvyZHi5KAss0xBOGY7FUyMTTMPPYFFFp5if4klFG54v5XpWpkCKfPHNV+VfYd0X14EFd5xCqoicQ71K91xtf5KycQz/G3wIp3IC2Qtw= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; 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; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C From: Penny Zheng To: CC: , , Penny Zheng , Andrew Cooper , "Anthony PERARD" , Michal Orzel , "Jan Beulich" , Julien Grall , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , "Stefano Stabellini" Subject: [PATCH v5 06/24] xen/vm_event: make VM_EVENT depend on CONFIG_MGMT_HYPERCALLS Date: Fri, 12 Dec 2025 12:01:51 +0800 Message-ID: <20251212040209.1970553-7-Penny.Zheng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251212040209.1970553-1-Penny.Zheng@amd.com> References: <20251212040209.1970553-1-Penny.Zheng@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0002992A:EE_|MN0PR12MB5905:EE_ X-MS-Office365-Filtering-Correlation-Id: bae88c4b-a625-4fff-c781-08de3933da6b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|36860700013|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Hn4y3k0UCm1t6sEcbTQdXs//MY3R7Qtnfl5LpFFqxYXeG7PgnNNUU4wnxVaO?= =?us-ascii?Q?THzj7Bq0pX0aBrSBa0KJYTsaRONTF1jcFqn+Sbd0+lIwxG/PA2qhi9/z+PT/?= =?us-ascii?Q?kLAZRiY4SzytkF+hKZ0Yq/p4VN51q1uYaaXD/XofIqK2NpUVvF2zn+qVOLTw?= =?us-ascii?Q?T150pshWWiae+nZXGuIUN4UecrXezEpsoN+fnvXRowiVjd69h/q9eisY90E/?= =?us-ascii?Q?vl2ia0X5I9RRfrcIZTBPzfprQzid2hUKSHWu3VjSF2ckmwHfuI7t/EQCaYyL?= =?us-ascii?Q?qX9jOuXiiImSOE+RN8ogqq3fRCH13qozJYqHNHAl9aguw06GdbZ7C6q7Opt0?= =?us-ascii?Q?SKXn6MlqeZ804aoLQfoHJac2qWruUPE57h0typlMuxPTmPfRSvmU4++mw2yq?= =?us-ascii?Q?O0Zmsl0ycWjDx0oVSd+ZEy2CILNZLxEfcdDmQHb1zKsWKOOMIdHGRECwivCV?= =?us-ascii?Q?Saag2H5u8h6wZrPpRstiHrX0PRwjjOzfKmmC1ebFkBSq+sjMyMZUDdEpbfcD?= =?us-ascii?Q?nTmlaMzQoNwNktJ6Ulz65MFU0goJFPDMU8hn3MWSCV1OJnuqZOJ90Q/mUEL5?= =?us-ascii?Q?WjYrqy2dvIewjgcgtN5j2cQ3qm8zt9SweELn88xHipLc9LAqvXR1rcfRpmjp?= =?us-ascii?Q?szbWPXn9xp7Mif9TntwmaEnJrQscX2TMfnKhPnj23cbmR2ceBSRsnIczCqcn?= =?us-ascii?Q?UxMVEKC5/qMBoCHMsjVFQb/2SYbetagZ8735kHdi7U/svX+DsuzCuZS8CFXl?= =?us-ascii?Q?RUJ8tKOJWQtD6Yq7X5VlI3yIZhCQC57aMzBcMP45mQVO38KpYDo/LfOA1LEE?= =?us-ascii?Q?i/L/uGePIA/s5pGS3Eit1c4FetBciu+nNz1HKi4qz/PCRgYzys4BLkIC8i5j?= =?us-ascii?Q?JMZgDyN/PexEsezmhC+2dwEoM+QYK1mdVSiH13oic4gH1Cx8o0xrkS+wfDnJ?= =?us-ascii?Q?WxX6n+J5t1PisGJxWjFVlXiu/G64rUDs5MhTGbF4jtKSDL7A+zvL0n0IW4IC?= =?us-ascii?Q?24RH1lIRqyendUDCrl8R1XCBl+8gLkJfWDOxdopHkTp0nYgdlzbBgQOvMEW0?= =?us-ascii?Q?sfhCo+IKnmLLyXEt4Dgb5wuJne4T42kn5xZC9jyYVS7JIH2HhP4ntCU8V37z?= =?us-ascii?Q?X1cuJMqpW6unKmo5oTpHtcxS1+vSn/icoxiH6qQnkketDs5RnxsTYAxSYjYm?= =?us-ascii?Q?yI71R1sjSymCWE+2TwDIa5WHTQX77SzODPCD5NfWb3u9VJCKAkUbg/IgnIEk?= =?us-ascii?Q?V0PyAfL0ZB+h1yhTxHwO/8qYh9kOGflZASWPSmWlfi8Kophkr0f2N1Gcihvz?= =?us-ascii?Q?xuYYJIcl7xV/7nb5tXdKK0XKbol3neJ/aFyBzbcuzrPVYHetlgyCDJru78+Q?= =?us-ascii?Q?5DCdszniMCyPzigZ4Ba2i9PwVdn+Iu3HLwvs5S+PDBjeBjBPs/Do1K8JPu/3?= =?us-ascii?Q?MN/Jnhs8dGS7Y/LoNbxnVJmOLvAIzSkadH+k82Wn3EdII1LxK7Ttu8j25PGr?= =?us-ascii?Q?xGfdm2W7zETujWK0x1xgmjxx8tGGlwfSVgEz6NWNTKDwUbuKXIQLg8q4Iypv?= =?us-ascii?Q?FGBvixYYPmb/fP2c6KY=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(82310400026)(36860700013)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2025 04:06:40.3381 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bae88c4b-a625-4fff-c781-08de3933da6b X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0002992A.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5905 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1765512430051158500 Content-Type: text/plain; charset="utf-8" VM event could only be enabled/disabled via vm_event domctl-op, so CONFIG_VM_EVENT shall depend on CONFIG_MGMT_HYPERCALLS Signed-off-by: Penny Zheng Acked-by: Jan Beulich --- v1 -> v2: - adapt to changes of "unify DOMCTL to MGMT_HYPERCALLS" --- xen/common/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/common/Kconfig b/xen/common/Kconfig index 7f7ed62f78..2914508a8f 100644 --- a/xen/common/Kconfig +++ b/xen/common/Kconfig @@ -175,7 +175,7 @@ config LIBFDT =20 config VM_EVENT bool "Memory Access and VM events" - depends on HVM + depends on HVM && MGMT_HYPERCALLS default X86 help =20 --=20 2.34.1 From nobody Sun Dec 14 05:55:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1765512441; cv=pass; d=zohomail.com; s=zohoarc; b=ZK45sYewNMLjzqBIwY7a/81W/B0SmpwDYlF9mJVcdyEiuU+3iJsR9HZ29M0Uj7YxFOqcde+yVEJ+Gcq8a9U+L7uIwAkH/vbwhjHqU6R8DMGX/vJJJmaG7LwcHqC+Jui7PhaMKQCRnAg5UE3j9ea+fC4e33WET5W+BAxhoLT89lg= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765512441; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=zSnQFrn0+BNHOUVlVgs7xAwawlO9+RHttRTFHT2TiAk=; b=EWEpdEVOat2dDqCznRGHJwt0M+GJPXYwPxmJNW6zSiO92AhkWSSot8bboNLMQDXhQbv2CaltmpMlRzyg3tCeeAybm56VbgS3DUB7AL+IUAYrMJIZZk76DdTa8hUjPCtu6gnQgihi9P2lNMb1t7J1mF9ZnWZmejwRzxpYT2kY1FU= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1765512441838289.42917083745067; Thu, 11 Dec 2025 20:07:21 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1184902.1507242 (Exim 4.92) (envelope-from ) id 1vTuQc-0000gJ-2d; Fri, 12 Dec 2025 04:06:50 +0000 Received: by outflank-mailman (output) from mailman id 1184902.1507242; Fri, 12 Dec 2025 04:06:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vTuQb-0000g6-TP; Fri, 12 Dec 2025 04:06:49 +0000 Received: by outflank-mailman (input) for mailman id 1184902; Fri, 12 Dec 2025 04:06:49 +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 1vTuQa-0007Dl-Vv for xen-devel@lists.xenproject.org; Fri, 12 Dec 2025 04:06:48 +0000 Received: from MW6PR02CU001.outbound.protection.outlook.com (mail-westus2azlp170120002.outbound.protection.outlook.com [2a01:111:f403:c007::2]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id fa09c7b2-d70f-11f0-b15b-2bf370ae4941; Fri, 12 Dec 2025 05:06:48 +0100 (CET) Received: from BL0PR02CA0015.namprd02.prod.outlook.com (2603:10b6:207:3c::28) by LV3PR12MB9437.namprd12.prod.outlook.com (2603:10b6:408:21d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.9; Fri, 12 Dec 2025 04:06:43 +0000 Received: from BL02EPF00029929.namprd02.prod.outlook.com (2603:10b6:207:3c:cafe::9e) by BL0PR02CA0015.outlook.office365.com (2603:10b6:207:3c::28) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9412.8 via Frontend Transport; Fri, 12 Dec 2025 04:06:45 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by BL02EPF00029929.mail.protection.outlook.com (10.167.249.54) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.4 via Frontend Transport; Fri, 12 Dec 2025 04:06:43 +0000 Received: from penny-System-Product-Name.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Thu, 11 Dec 2025 22:06:40 -0600 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: fa09c7b2-d70f-11f0-b15b-2bf370ae4941 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QGgh36HewgveIhSJU++TcdjVKNraelM3k76wzNfO8TBp0Ze3IEi8gmsaHHnNRk2hIfryPzJEfx3VRGabfwMniRtibZigKM03XwzTDZ4CqZWubcSZy/U2y/+gXbsoH4rhixRW7yLshNGTaQ9GqY1X5Q78VYyuhmiz0FSjvhkl4lVBHRzIJ0sKJ4aoMEsLveropRuZW39cZhu1H7MInPBTOTs7yUylAkcdXmmz7nDeBnYTjicyUal5mly4UQYQzZIVq0ywcYOQ2Gydlyf+ph8mPsbIwmqjz4bUyK5pVW3Io3I4EDFRNM4VyNoKZavGBwvsszTTSKSi0XZ+bVHL4uizBg== 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=zSnQFrn0+BNHOUVlVgs7xAwawlO9+RHttRTFHT2TiAk=; b=FybDXFltopW2HQ0CAbfhsT/jfWTIipOmoNZEwiyhrXrM3FjCeK838nyPEE85yiyo6oszQjBw+yDWLg79G+RPV4oSgpijatynQk3ylMH+zbX3aIw5eP9UdAJ2BpWZCZIFxD0MK3ZNouFTYW4VjA2Kv8c4booXEcxZT3hIvkno6K3FXDjGJQYCvxpT28hL82tVwHWgqri3/FPX5A4UQMB5z6RI6Vgc8yCE4TWyaIw1FHKaUcEfpLrqfqKPlZJgl736f/AZUCFy8bz5IPYsDBtVsR2wIuP9A7JdJX1+kaPncLk2sUbPLY5QhL9o7jGizYOc+Bd84xDNMRbnr+5jIqcvOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zSnQFrn0+BNHOUVlVgs7xAwawlO9+RHttRTFHT2TiAk=; b=RaK6Kwizq+AaPl2RY3oggT0922Y0C/zu+BYVaekc1+X8rqtIbkEEG3/cnb0ofcSxnigrvgoaVCe6hnKSn0HTFB3/RoP4bPQJmUX53zh8lldGlCZ8j7CIhja3v8C6lDX6LQ2I7HXeWdh9ppKMmy/SZNF5zb0pmFX9mvsRjO/RbQ0= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; 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; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C From: Penny Zheng To: CC: , , Penny Zheng , Andrew Cooper , "Anthony PERARD" , Michal Orzel , "Jan Beulich" , Julien Grall , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , "Stefano Stabellini" Subject: [PATCH v5 07/24] xen/domctl: consolidate domain.c towards MGMT_HYPERCALLS Date: Fri, 12 Dec 2025 12:01:52 +0800 Message-ID: <20251212040209.1970553-8-Penny.Zheng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251212040209.1970553-1-Penny.Zheng@amd.com> References: <20251212040209.1970553-1-Penny.Zheng@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00029929:EE_|LV3PR12MB9437:EE_ X-MS-Office365-Filtering-Correlation-Id: 2feafb55-1327-4aaf-ff01-08de3933dc1c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|82310400026|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?wDv1/wjajMPCINF+B1yiOk8U9MdJyDoyBjz7dhHpUTeapHVhnhQcw1qfUqcT?= =?us-ascii?Q?xloY6kPS2VXeVOX4zl3U3dqc9w3wipcLuGElQHtsSBMF9URL2AdHAXlxBmt5?= =?us-ascii?Q?YZkVo989kCV50q+fPVDwf26jiw7DXQ36fWPOWZRKqukat5KL2EMBTB6NRM+v?= =?us-ascii?Q?P/Yehx03m0fFj9giA/fY/6dv/v/WJCYjK4LKeJlFqu38Hz0gB3+q2C2hYpIF?= =?us-ascii?Q?kj8nNri5GIkdCZqBqC/XPzxaht8XqW9dDyerYL6lddc7pMeWsVuX0ufV4Bn/?= =?us-ascii?Q?0AALrgu6056YjH0YhytDgTv5QRH1/Ok/AUAAv3FMXecOsNoiRD42S8orjmTK?= =?us-ascii?Q?D3eR664HF9fGWyuxDrTU1Ib3XpSFKuyFKPk4lnKL4hAX5X7Wu3YmzU6TMUvq?= =?us-ascii?Q?eZZfnGl1DpEe7EqbtLF8ywtFKawsrY55zNP6s72Hg5OKr2aMQr0/0y8h1kDx?= =?us-ascii?Q?a4L4B9FnZ38szhko7H6IvtPrKMOA/l9YUkHCCZOYfZUGM5eWViYL0qCl92Dq?= =?us-ascii?Q?vFOL9Wbv4D8Mgl1cYVAY4L3l+Rzcs5vDLAGHfs+AYoR5eM8sW+m7gyUamR2L?= =?us-ascii?Q?74lhK59dyT2EWCIBOXViySi7MqxVPIO3yuoeRDthJFEUsb1pe17EN7P0R4f0?= =?us-ascii?Q?Mu7xwHAeQ4cURgKo7iufstRPnWE0qTPbW21EALiAFW1gmlw23UYb3AcGDCc7?= =?us-ascii?Q?ePrFOUwSsXNn424KvvmYpcunlckpBW15UL2b1mJAZg9uLaUWugHXjXud29QJ?= =?us-ascii?Q?YY6/xTheGStPVbtM6LEga930goP3goCFpU4Qdv2bYiHl3RSQq/g9Lz6g28Q+?= =?us-ascii?Q?vGhg7ZM/pHFw5Xi16z6PgNwrZ5rOYfxt0e3BW2/yXTvvQQxBLtkimZYUUXaV?= =?us-ascii?Q?ArYFeJ6OrPOB0Y5jy1GEG2uiErBB2GsCUdkPJON0jNlNExjTeLGLg2+zM3NO?= =?us-ascii?Q?O+IpPGr9nRZyUFELOoAja0Y7PBASoDpkyhKxda6tgAdONS+7c/M1WEYW/ijZ?= =?us-ascii?Q?/YhXh9p5VyYiVUV5A+0v2yom7QeP3DffAn+7prUYxIeDPgz3VQlwVxMIkt3B?= =?us-ascii?Q?UurJSgwXfWLwAZkvl0HU9h/w9eOsp+m1PTvWh943tx5JRBV2Z9bxVz06K8UQ?= =?us-ascii?Q?TK8HMSgXupAVBjcoqaDbq5VF4QfvhIYN6oCO6FdDsr2IqrsDL2K2BTz0Rv9a?= =?us-ascii?Q?c1UqFxz9T/Tk+/27/r8nrFFZrKt61UOB5RVUlk34mst6a5jzr7rTnpuKNtsI?= =?us-ascii?Q?XPhsf6LqHj9KxyymhGHecloPlxmqR8jALM2zhMSDfiRQQ5EqRGoRkGMRufmu?= =?us-ascii?Q?VhJYGv7wNJZd7kD/Y+7CXB0FRwJRItFBdhp2qna9TH2uKPc/LYlvakr5y3FS?= =?us-ascii?Q?BwLDFCk9oee3Y+zbwg8fOgPTp0+bOBh3IJ3DuZKjcKAG7jDN8gD/dBXI6DTI?= =?us-ascii?Q?3Kw/MDuuTU4UmKpldMLVybMkWBKpCv7N/yvMfQa+070Qh/gJgF6+DRHihGfi?= =?us-ascii?Q?A6uD0yxvG8fpzLxVv1tjpEq7MSf1ClC/8QLHMU1aW0BVxRMhGaATha+J5Bku?= =?us-ascii?Q?a8jnG4g6MPFhILJsLbo=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(1800799024)(82310400026)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2025 04:06:43.1849 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2feafb55-1327-4aaf-ff01-08de3933dc1c X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00029929.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR12MB9437 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1765512442115158500 Content-Type: text/plain; charset="utf-8" The following functions, scattered in common/domain.c, and are only referen= ced and responsible for domctl-op: - domain_pause_by_systemcontroller - domain_resume - domain_set_node_affinity So they shall be wrapped with CONFIG_MGMT_HYPERCALLS. Otherwise it will become unreachable codes when MGMT_HYPERCALLS=3Dn, and hence violating Misra rule 2.1. Move them together to avoid scattering #ifdef. And add a leading blank befo= re label to conform to ./CODING_STYLE. Signed-off-by: Penny Zheng Acked-by: Jan Beulich --- v3 - v4: - combine commit "xen/domctl: wrap domain_pause_by_systemcontroller() with = MGMT_HYPERCALLS", "xen/domctl: wrap domain_resume() with CONFIG_MGMT_HYPERCALLS", and "xen/domctl: wrap domain_set_node_affinity() with CONFIG_MGMT_HYPERCALLS" --- v4 -> v5: - coding format correction and title refinement --- xen/common/domain.c | 114 ++++++++++++++++++++++---------------------- 1 file changed, 58 insertions(+), 56 deletions(-) diff --git a/xen/common/domain.c b/xen/common/domain.c index 93c71bc766..f24f3675aa 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -1125,35 +1125,6 @@ void __init setup_system_domains(void) #endif } =20 -int domain_set_node_affinity(struct domain *d, const nodemask_t *affinity) -{ - /* Being disjoint with the system is just wrong. */ - if ( !nodes_intersects(*affinity, node_online_map) ) - return -EINVAL; - - spin_lock(&d->node_affinity_lock); - - /* - * Being/becoming explicitly affine to all nodes is not particularly - * useful. Let's take it as the `reset node affinity` command. - */ - if ( nodes_full(*affinity) ) - { - d->auto_node_affinity =3D 1; - goto out; - } - - d->auto_node_affinity =3D 0; - d->node_affinity =3D *affinity; - -out: - spin_unlock(&d->node_affinity_lock); - - domain_update_node_affinity(d); - - return 0; -} - /* rcu_read_lock(&domlist_read_lock) must be held. */ static struct domain *domid_to_domain(domid_t dom) { @@ -1371,33 +1342,6 @@ int domain_shutdown(struct domain *d, u8 reason) return 0; } =20 -void domain_resume(struct domain *d) -{ - struct vcpu *v; - - /* - * Some code paths assume that shutdown status does not get reset under - * their feet (e.g., some assertions make this assumption). - */ - domain_pause(d); - - spin_lock(&d->shutdown_lock); - - d->is_shutting_down =3D d->is_shut_down =3D 0; - d->shutdown_code =3D SHUTDOWN_CODE_INVALID; - - for_each_vcpu ( d, v ) - { - if ( v->paused_for_shutdown ) - vcpu_unpause(v); - v->paused_for_shutdown =3D 0; - } - - spin_unlock(&d->shutdown_lock); - - domain_unpause(d); -} - int vcpu_start_shutdown_deferral(struct vcpu *v) { if ( v->defer_shutdown ) @@ -1626,10 +1570,68 @@ static int _domain_pause_by_systemcontroller(struct= domain *d, bool sync) return 0; } =20 +#ifdef CONFIG_MGMT_HYPERCALLS +int domain_set_node_affinity(struct domain *d, const nodemask_t *affinity) +{ + /* Being disjoint with the system is just wrong. */ + if ( !nodes_intersects(*affinity, node_online_map) ) + return -EINVAL; + + spin_lock(&d->node_affinity_lock); + + /* + * Being/becoming explicitly affine to all nodes is not particularly + * useful. Let's take it as the `reset node affinity` command. + */ + if ( nodes_full(*affinity) ) + { + d->auto_node_affinity =3D 1; + goto out; + } + + d->auto_node_affinity =3D 0; + d->node_affinity =3D *affinity; + + out: + spin_unlock(&d->node_affinity_lock); + + domain_update_node_affinity(d); + + return 0; +} + +void domain_resume(struct domain *d) +{ + struct vcpu *v; + + /* + * Some code paths assume that shutdown status does not get reset under + * their feet (e.g., some assertions make this assumption). + */ + domain_pause(d); + + spin_lock(&d->shutdown_lock); + + d->is_shutting_down =3D d->is_shut_down =3D 0; + d->shutdown_code =3D SHUTDOWN_CODE_INVALID; + + for_each_vcpu ( d, v ) + { + if ( v->paused_for_shutdown ) + vcpu_unpause(v); + v->paused_for_shutdown =3D 0; + } + + spin_unlock(&d->shutdown_lock); + + domain_unpause(d); +} + int domain_pause_by_systemcontroller(struct domain *d) { return _domain_pause_by_systemcontroller(d, true /* sync */); } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 int domain_pause_by_systemcontroller_nosync(struct domain *d) { --=20 2.34.1 From nobody Sun Dec 14 05:55:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1765512437; cv=pass; d=zohomail.com; s=zohoarc; b=UvT6SBr7zVzIT8+t4TZVUsYZeSGPR0Z5w6/R/RYQGaDhz04V/6Z3a8qwPtS6tR/5zbwzazzZAt+GDA/5k7GEGY0puoNSL7RHYpZ7X3WlB5Nt4ZSJpcvXvWYseQac/m2Akqi0JT8mVFtwoLEZKd5X5WQDSI4y3UDDd8q0K62kssw= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765512437; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ynBWoLzkFEqy7wvBamCk0uYlCKmGseA6I5oKFUpt5OQ=; b=Itv4DtsWiHqxi9LRQpeLXLidHLl2FSi30vnTy7tnXZzwlhMwhChFLGPRDs5v3amW5dycvNH+TeAH5MHIOxEC+0iaxQfT0z6OaElM6sNwSAclLn8D/lxSX65SiYE1pblWODc4s0ThOsfJVwO7+PcEYl016farnnSPsj5N78MLt/A= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1765512437383823.3085357924073; Thu, 11 Dec 2025 20:07:17 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1184908.1507251 (Exim 4.92) (envelope-from ) id 1vTuQi-0001KK-Aa; Fri, 12 Dec 2025 04:06:56 +0000 Received: by outflank-mailman (output) from mailman id 1184908.1507251; Fri, 12 Dec 2025 04:06:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vTuQi-0001K2-76; Fri, 12 Dec 2025 04:06:56 +0000 Received: by outflank-mailman (input) for mailman id 1184908; Fri, 12 Dec 2025 04:06:55 +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 1vTuQh-0007Dl-1C for xen-devel@lists.xenproject.org; Fri, 12 Dec 2025 04:06:55 +0000 Received: from PH8PR06CU001.outbound.protection.outlook.com (mail-westus3azlp170120001.outbound.protection.outlook.com [2a01:111:f403:c107::1]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id fd4c3b1a-d70f-11f0-b15b-2bf370ae4941; Fri, 12 Dec 2025 05:06:53 +0100 (CET) Received: from MN2PR15CA0061.namprd15.prod.outlook.com (2603:10b6:208:237::30) by DS7PR12MB6191.namprd12.prod.outlook.com (2603:10b6:8:98::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.11; Fri, 12 Dec 2025 04:06:45 +0000 Received: from BL02EPF0002992A.namprd02.prod.outlook.com (2603:10b6:208:237:cafe::e6) by MN2PR15CA0061.outlook.office365.com (2603:10b6:208:237::30) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9412.9 via Frontend Transport; Fri, 12 Dec 2025 04:06:43 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by BL02EPF0002992A.mail.protection.outlook.com (10.167.249.55) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.4 via Frontend Transport; Fri, 12 Dec 2025 04:06:45 +0000 Received: from penny-System-Product-Name.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Thu, 11 Dec 2025 22:06:43 -0600 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: fd4c3b1a-d70f-11f0-b15b-2bf370ae4941 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AhPEswa+DaHG6t5rhRU0PA3rjPDYep1s87M4wSZw5Q5WxKHC7BDs+cirkbolPU/yKMQYq7QmyPtw3TUkTksGwxXjIsC/iXvTM1p+eTFfYgItoZvcNR7ib/gAYLeY4NmybBXAYMdsvr6yxfqOFWQXknprMghtVMTj1SKa3zBRGWYg8nem5E5CQFxXGYyC+r49LUgXdl4VRtj02cIOQnuXuVbn6Kl6ofzKVk9kVa9uRw+7GBz7kScNIvHTR+qtjYDGYrYDkBZbp+y4NzlH05wd0LzCz9TAPW5GNmLBjn6Kv/9a2F9Q9V0IvKXSDULkEykWOaKTQ2D6QdQyhWMzZvxRjQ== 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=ynBWoLzkFEqy7wvBamCk0uYlCKmGseA6I5oKFUpt5OQ=; b=tbiaT06cLJg0wl3COzIrhXivF+IRHoLFdBPrfEs1QMAniunoQ5GuS1ndQBd3EPG91qwJ0aKi766pq/7XdXoy3VuJ50LwSRe3DU2uCCJcfOQEts0drf3Kp+Eah9WJHISzWg9JXG/nLdHH/2UUPW0rOKmRSnr/RptdnLdfdCuj9DhWkho2wKqyPpOiY80bYZMbt6CxTDuxJqcCFZOir9dBQ03NykB/J6on3f1qKNWfV9+Mu9kglzsGqHgeJ7XDyI1p5R63yAj477CTIMM6Bo3msX2LVIhzgLauvUncq++4YQ/4bgQWemEmjh0KJ0+Iz8Ubj8NVR14XaghyFetAfY1IXA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ynBWoLzkFEqy7wvBamCk0uYlCKmGseA6I5oKFUpt5OQ=; b=qoqBbbyuhqri/5tNAc0pGgFw0T9m+95RgcBQ4imXdbgfcRX9vaR2R0hrXALTCQ8xtbcNHyXfJ4zp1A7PCK0/v6+Lh5bN8dYRYfosO7F0MJ0W4Rt+n8wQkXQ2eqvBm0ALAYZ0gCfHoMJksMHIJVKQKW660FOm099D3kileQ9CaVU= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; 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; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C From: Penny Zheng To: CC: , , Penny Zheng , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v5 08/24] xen/mem_sharing: make memory sharing depend on MGMT_HYPERCALLS Date: Fri, 12 Dec 2025 12:01:53 +0800 Message-ID: <20251212040209.1970553-9-Penny.Zheng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251212040209.1970553-1-Penny.Zheng@amd.com> References: <20251212040209.1970553-1-Penny.Zheng@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0002992A:EE_|DS7PR12MB6191:EE_ X-MS-Office365-Filtering-Correlation-Id: b545f5a8-0cec-4de3-d4d6-08de3933dd69 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|376014|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?F+ruPS8dlHJTXFzBbKnOyVLsN8ZUci95mNNmMWSZP79sDELRB72xvuk0+UHr?= =?us-ascii?Q?q2e5u72lr+Ip6AsrE+YMDlJreYGVc6XpA2qDVUfdI6LTRB8fA2lfPh6XLt6Q?= =?us-ascii?Q?wf+tzAUK4n+vzDfT5WgQH2HIBDmO2brM36csA1zmyqVsK/eet9imL95it34K?= =?us-ascii?Q?5dlZcd92jjiCXEpwfVDA/tlC+4p3NUaZsRopMMKXNp46iWJal50drya8Su0t?= =?us-ascii?Q?w9y+mTXjSzUx5U4Ll6YD1S8ecvUikdGvKMTT6HKv+fHTIfNYmi1abcZbO0HO?= =?us-ascii?Q?+UyZJPSKmMkwNXLeiTi3Fm+PBncVctsBW7XPHJlaiP+9+MhoMThaA9rlWbDw?= =?us-ascii?Q?EaT3/3447BkovAyKULXG9EWy9sycEcw4RMv5e/krrxWbKmw1wWKpwg5UrYr7?= =?us-ascii?Q?9bPUnpVxoYN1YBPwBhBGm2/c8paY8rc6C9Q51DyoCe7afwSr7R5gAeyUvJ9d?= =?us-ascii?Q?DTRpT/sp6EomRp5JIYFj4aeAhCbhjs+YQiUBKrPJgCJ2sEY16adnMIC1ClTD?= =?us-ascii?Q?enXEsFCY/VVd1dGMU6cZLWMjFwH/CvWvOtvZGbb4yb9SN199AUVtMPG58Cp4?= =?us-ascii?Q?15QaeK2CUktUPSim+oPyKNXl5ozyE5ARWNvPK7W2qAX2l+op1kp+krN5jo5v?= =?us-ascii?Q?DA3IC3bNTP3RkdFEk/COvZGEi7NiVCFAKfHXsIEL5nBDKYQMtPhw6W2y9Pvw?= =?us-ascii?Q?Se9Fi01YQaQzqvakvzkVjSdxbQ0DZaX3nCVW/xc736aSy6CE7i/h2FAhNyPi?= =?us-ascii?Q?MAK9O9DOQ4/u3ZTZQvgHJ9lF2AqzcjyPyMwsbDHlU83L7yd/q3lhj/K53ySv?= =?us-ascii?Q?4gQcIEsuYNtzPLH8hJ4K15Uj5Ooy8vEVwzTK0byOZNNs+8TVLPG+Qgnymeh3?= =?us-ascii?Q?tRwqewRQEJ1naR9Ns0suMJwqj3nKGviU0pG9QYqy53Q6G1SE/NU/GDgSC+7P?= =?us-ascii?Q?MCO89xPwTTmCmwKINULf+VF31buPYl7h7WvzeG0boKPpFh+qM9SyA0GL8Shp?= =?us-ascii?Q?vblghyDyO4R/fzcXje54PtUY2RLKQVozGtO4XMA4r+mL0X6fHggs6JCL+ZG/?= =?us-ascii?Q?7RvqHkAN4f/csB4D7QLSff+f5KnLI1+ASK4ruyj6IQ4SPCiviRAt0hRX7+xQ?= =?us-ascii?Q?wYD57WffL4c8IEJrcPVi0zv3Ofi6fRk9dI7cIvl0GcTxwkh3RSSPK281hZHL?= =?us-ascii?Q?KKSOALj3w0iq0gz63RVI9ih1ERxlc6SZlAJjFiemQFrQG7024drB4s90qx1V?= =?us-ascii?Q?CuIKHvdByUCUvoWQc5ezacr8S3b9n15MZ1uC0qyivB4FnPo7g0FwVPA0FHBb?= =?us-ascii?Q?BiO62YnR69raRIqvfdB+FQldbaGz9HDEob290azRdpGJFajSou4W3VsHXJfH?= =?us-ascii?Q?vmWC2IGTfr6GqNt6yN4xPG1aBsr1tCcXUCofH6kLRsIogUxZXoXTu/zlINh7?= =?us-ascii?Q?akt5MPBPNop8dhn3Ss3zvUIuFjb7nTIq4evtaodjbNJGjCmIB6tV5WN7VrQK?= =?us-ascii?Q?fmXSJ5YtKPVXEcPWKR+OjUAp/xQaVgCt3NFKHaXNrRqXywgJVl1Ej31KyueQ?= =?us-ascii?Q?svNN309XjRKs92+IYMs=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(1800799024)(376014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2025 04:06:45.3581 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b545f5a8-0cec-4de3-d4d6-08de3933dd69 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0002992A.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6191 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1765512438318158500 Content-Type: text/plain; charset="utf-8" The enabling bit (d->arch.hvm.mem_sharing.enabled) for memory sharing could only be enabled via domctl-op, so we shall make memory sharing feature depend on MGMT_HYPERCALLS. Signed-off-by: Penny Zheng Acked-by: Tamas K Lengyel --- v3 -> v4: - new commit --- xen/arch/x86/hvm/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/xen/arch/x86/hvm/Kconfig b/xen/arch/x86/hvm/Kconfig index 25eb3e374f..df9bea65b0 100644 --- a/xen/arch/x86/hvm/Kconfig +++ b/xen/arch/x86/hvm/Kconfig @@ -79,5 +79,6 @@ config MEM_PAGING config MEM_SHARING bool "Xen memory sharing support (UNSUPPORTED)" if UNSUPPORTED depends on INTEL_VMX + depends on MGMT_HYPERCALLS =20 endif --=20 2.34.1 From nobody Sun Dec 14 05:55:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1765512477; cv=pass; d=zohomail.com; s=zohoarc; b=j6GU5/vykXBNWarbPu3aUaByphoYxglIjvJ7XH+7FacsspH2FkdnMFSRqdeMWh2k9Ez30SjuDm9/rn24uIAC1WXGf5t6wKt7LaT4y1pajSh0nIxHxak0lwfYF2kpI0DA9fQPz5Bt+hZnjJZrcLmJt036Oq+VHqzkj7YKX596xIg= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765512477; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=JzuQmmqlcML7KE9IskVKiovSk6+95AR+dO+1iepoyl0=; b=Qs0s3MTKjegxY+D0ufQ/MOLKLg7RbWRzfd+DxtDmi+ZcGE5fMvaMvM2MB2GhGkqz8FtY6nZVMYp6teRRjCpOo5dAV/L0mDz5yrXQZGvjxTAkRyC8d5n3+wcw/WDxKBZbNDmXQeV1xzX30kfw3Ma8xal7QI65kHSaIEBlFGzQ4bQ= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1765512477331961.7347726920997; Thu, 11 Dec 2025 20:07:57 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1184964.1507332 (Exim 4.92) (envelope-from ) id 1vTuRF-0005l8-RL; Fri, 12 Dec 2025 04:07:29 +0000 Received: by outflank-mailman (output) from mailman id 1184964.1507332; Fri, 12 Dec 2025 04:07:29 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vTuRF-0005km-MS; Fri, 12 Dec 2025 04:07:29 +0000 Received: by outflank-mailman (input) for mailman id 1184964; Fri, 12 Dec 2025 04:07:28 +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 1vTuQj-0007Dl-4x for xen-devel@lists.xenproject.org; Fri, 12 Dec 2025 04:06:57 +0000 Received: from BYAPR05CU005.outbound.protection.outlook.com (mail-westusazlp170100001.outbound.protection.outlook.com [2a01:111:f403:c000::1]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id fea1d79d-d70f-11f0-b15b-2bf370ae4941; Fri, 12 Dec 2025 05:06:55 +0100 (CET) Received: from MN2PR03CA0001.namprd03.prod.outlook.com (2603:10b6:208:23a::6) by BL3PR12MB9049.namprd12.prod.outlook.com (2603:10b6:208:3b8::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.11; Fri, 12 Dec 2025 04:06:49 +0000 Received: from BL02EPF0002992C.namprd02.prod.outlook.com (2603:10b6:208:23a:cafe::98) by MN2PR03CA0001.outlook.office365.com (2603:10b6:208:23a::6) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9388.16 via Frontend Transport; Fri, 12 Dec 2025 04:06:49 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by BL02EPF0002992C.mail.protection.outlook.com (10.167.249.57) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.4 via Frontend Transport; Fri, 12 Dec 2025 04:06:49 +0000 Received: from penny-System-Product-Name.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Thu, 11 Dec 2025 22:06:45 -0600 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: fea1d79d-d70f-11f0-b15b-2bf370ae4941 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sz8JwfxmHzsdSuAgQaHd56ckYEGXu9kU0BFgiJyz0PrX9Xcu21TE7B81XtIiHXutqZIWLyB+W1FzqkvUCBc1kBR9109P5v4G22z5BS5ciuVQVDwRzofOblFRI+U+s5V2FmjmMJ8aG14aA4JQGBZgUqEjirdUwB1qBBC/1IDvVvUsUaqQH+/jtUG46p7Kty3QUhRBc1EL7PdSj1srhWhOHxNRuL2cuZ2ZJttwkIq69Ou4PCmg8zrTOmCbwLfeRNLuiNGSoaBMCVJQTDNLvMItXDj2ijEvm2nBXmU3Y/GdWM5cJ9fIaoewoKVWUglPyYBxX/0zLDaUP4+hqC1/t2kCHA== 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=JzuQmmqlcML7KE9IskVKiovSk6+95AR+dO+1iepoyl0=; b=giH5Tn3F1XMSzSldZf93Mb6oXxg29RgczuH5F8J0Zmhd9ufse8rpeqAc+bB9XtrBauUws86dFtZbYXaeUIqjTp7jchM03scQFoo73xSr0x4rmOSILPTWHNkznMHK3E1KwqkJQPbKVlCOAK76HqDbQtYzoYYT6q0AYZnVmVlc0g5LEmGRF5Sm8lWSFQ+9ReXmdwPOFiASUDq9yL06HHpceB2t5ISTJNQtBsa5B0UGZQ9RgJCLSA+v3NRugqyhcNt18FCQNzFDnK99i2C74ZZxcIzOW138aim3qfxGNL5lRxuLeBKqBYUNMlqKLoqQ3YgJQ32mxUaT+Bsqmf3ZoRtwCw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JzuQmmqlcML7KE9IskVKiovSk6+95AR+dO+1iepoyl0=; b=48Z0FePR27lT0PdMyFRis0wDVpn6WP5iiEGP89SVz19u/NJN88Y+0xL1wBGfbs/GVFxil24DxWhEVbGw5L+v+R3AuFpSTuL/ffRjMCaKnb8+HFjX7z98qW0VvAXGZS2/+MUOiSjwaKvdYHz+3TH7fRjzHF1o4GrUOYNX8xRq3qI= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; 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; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C From: Penny Zheng To: CC: , , Penny Zheng , Stefano Stabellini , "Julien Grall" , Bertrand Marquis , "Michal Orzel" , Volodymyr Babchuk , Andrew Cooper , Anthony PERARD , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Timothy Pearson , Alistair Francis , Bob Eshleman , "Connor Davis" , Oleksii Kurochko Subject: [PATCH v5 09/24] xen/domctl: wrap domain_kill() with CONFIG_MGMT_HYPERCALLS Date: Fri, 12 Dec 2025 12:01:54 +0800 Message-ID: <20251212040209.1970553-10-Penny.Zheng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251212040209.1970553-1-Penny.Zheng@amd.com> References: <20251212040209.1970553-1-Penny.Zheng@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0002992C:EE_|BL3PR12MB9049:EE_ X-MS-Office365-Filtering-Correlation-Id: 40b072cd-f243-42e9-00d8-08de3933dfe2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|36860700013|7416014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?6D3R8FBVf97GIx5nNLvqOt56sTW5Q1K9hRfM8Iull8jf22GG2deaqPIgode2?= =?us-ascii?Q?KKR1RBK+RBZDvb5lYfwBCjlgWk11V4EtCbqb/SWzi2itMNPyBx/uLIAHGo0b?= =?us-ascii?Q?jwY6NZ2N5GKKpownrvCYbeajZxqh+iy/UeLINmzNPC5uIvQLIEzAwwdei8N4?= =?us-ascii?Q?so7wsJOLADJn5El6sPX2sJRjHjEHBt7iDqa6oKUjvxt29scZReI3vF2/5Q2D?= =?us-ascii?Q?dCYfkZYnICB3kGHCtVrH4pPkf6SqcxUvSkG8RcFdeoDfnW0+WGW2GlGHUQyn?= =?us-ascii?Q?PKYOMPnYlugKLkUapP9zeiztMKBn8YqXefZaobNaeMzoMcCaaSA6XEO0ZEnq?= =?us-ascii?Q?Im+5BuMcgspFHMJsgPT1YYH1hBo0CrGW125boR/LLmd1ke0cAofqYlYCOfjX?= =?us-ascii?Q?IZBKvmmzalSO4f4xWWC8TuqmDbehCvlHBbIMbPz127K41IiIE8wDdEc9Vb7i?= =?us-ascii?Q?P9tyI1gIK04aFRKQFJSCgoLDiY4P8Gv+sL3lt35v1YE/Zk3072FC22ODgXyi?= =?us-ascii?Q?P6YPKnZ62G/xZ1Hizb9poQ6MkFzfRokiBERKHzFqMxmE2UtPNjzMUOf/JIM+?= =?us-ascii?Q?0BRmSP2vn3ao1xkPVy0NT3lsdlKpIMICTRijJuLI4DLd3+Mh3YllIWBmbJsd?= =?us-ascii?Q?YkNXDUlezv4J3CjlDKyNDTtAehmCJ4Ttqt6Sk3yQi1Cp/kdbrNoYZCqGRp5g?= =?us-ascii?Q?s1fMZXY1Xyf4IA/QGdlbnyoThjTBWkpN/BaQUL7t6jnyRLQprcVIcw3BEGNs?= =?us-ascii?Q?rDqzPLB9EeHodDKbNvzHxjkwAX/244aWgLyXryapgGrBcWWdRHtjAY6SlH25?= =?us-ascii?Q?hPVmgVipMb3vEhDwROSMELDfydzB0MEtICa1o5mKbE533dCXkQdrvGTEKbwB?= =?us-ascii?Q?KfCWP6hP9Wgusr6bxX3BxP6ITY4+U4GUX8UCdRaRmKtBcg7oUDVH80uk1ctI?= =?us-ascii?Q?zXMkeiv3WkSeh7M61XRKgQAmFKcj5YMhVOiwlOrEJ+phtHCwEXchklrsAZ1N?= =?us-ascii?Q?pM1v5eVbOriPzWlpgJ/m96gWfGEUAUdlPKWUkyZC9ogAdpp0nd1phq1B5OcD?= =?us-ascii?Q?FOWpHmsD5MDRter2C9cSF/wtUERo47YeYK6I9CWyHqTd6HNGrigLmV869u47?= =?us-ascii?Q?iTAjevdZnltkL04ZLynP9EoHQwSnXhbuvLn9PbkjKsRJQapzACOBHMXYoPuG?= =?us-ascii?Q?6lFf9i/KWR7Uzt3+l4x5DhfMpQa7RQIXsXjd/TUHHkLULmBte9xfshM8sTEF?= =?us-ascii?Q?konOtjMaFcmjZ1TC3aXYdp4+XuolaOQcOOQLfwJ/6WZkomvaqAaWPNxZrj1d?= =?us-ascii?Q?u/WlYBoob7SVUZ4vHaLEFBlJYBogHDw+E8EIQ3TZAR9iHoICtg3Z0YYl9Fkv?= =?us-ascii?Q?5RDCHHAKo8Ub3u/9j+DfypmE3sWqGnnrBqW9dJOzhUAZzOr7sAJyRGHqKgxC?= =?us-ascii?Q?RARGMifHZWm/lZpGbYHqCnUfQUu0g+YkmmWajiyGcvNjaLv3rJ1dpba8VHZm?= =?us-ascii?Q?WF32oJZK9OZdvFDrAN2yBPQoo5V51ymu8/K2UbMJeOM2IX0Pkq7W0Ek4nUwx?= =?us-ascii?Q?k5lL9KYyFpJxj4jNMYA=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(376014)(36860700013)(7416014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2025 04:06:49.5061 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 40b072cd-f243-42e9-00d8-08de3933dfe2 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0002992C.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB9049 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1765512478325158500 Content-Type: text/plain; charset="utf-8" Function domain_kill() is responsible for killing domain and relinquish domain-held resources. and it is only invoked under XEN_DOMCTL_destroydomain-case. So it shall be wrapped with CONFIG_MGMT_HYPERCALLS. Tracking its calling chain, the following functions could also be wrapped w= ith CONFIG_MGMT_HYPERCALLS: - domain_relinquish_resource - pci_release_device - paging_teardown - p2m_pod_empty_cache - relinquish_memory - pit_deinit - iommu_release_dt_devices - tee_relinquish_resources - ffa_relinquish_resources/optee_relinquish_resources - relinquish_p2m_mapping - p2m_clear_root_pages Otherwise all these functions will become unreachable codes when MGMT_HYPERCALLS=3Dn, and hence violating Misra rule 2.1. The reason why {arch_}domain_teardown() is not wrapped is that it is also u= sed on the failure path of domain_create(). And the exclusion of paging_final_teardown() is blocked by domain_destroy(), which will be triggered when d->refcnt equals zero. Signed-off-by: Penny Zheng Reviewed-by: Stefano Stabellini Acked-by: Jan Beulich --- v1 -> v2: - adapt to changes of "unify DOMCTL to MGMT_HYPERCALLS" - wrap XEN_DOMCTL_destroydomain-case transiently --- v2 -> v3: - add back stub wrapping in ppc/riscv - address "violating Misra rule 2.1" in commit message - remove transient wrapping around XEN_DOMCTL_destroydomain-case --- v3 -> v4: - remove diff in mem_sharing.c - add description for some functions to aid review --- xen/arch/arm/domain.c | 3 +++ xen/arch/arm/include/asm/tee/tee.h | 2 ++ xen/arch/arm/mmu/p2m.c | 4 ++++ xen/arch/arm/mpu/p2m.c | 2 ++ xen/arch/arm/tee/ffa.c | 4 ++++ xen/arch/arm/tee/optee.c | 4 ++++ xen/arch/arm/tee/tee.c | 2 ++ xen/arch/ppc/stubs.c | 2 ++ xen/arch/riscv/stubs.c | 2 ++ xen/arch/x86/domain.c | 2 ++ xen/arch/x86/emul-i8254.c | 2 ++ xen/arch/x86/mm/p2m-pod.c | 2 ++ xen/arch/x86/mm/p2m.c | 2 ++ xen/arch/x86/mm/paging.c | 2 ++ xen/common/domain.c | 2 ++ xen/drivers/passthrough/device_tree.c | 2 ++ xen/drivers/passthrough/pci.c | 2 ++ 17 files changed, 41 insertions(+) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 47973f99d9..049cc8923b 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -959,6 +959,7 @@ int arch_vcpu_reset(struct vcpu *v) return 0; } =20 +#ifdef CONFIG_MGMT_HYPERCALLS static int relinquish_memory(struct domain *d, struct page_list_head *list) { struct page_info *page, *tmp; @@ -1110,6 +1111,8 @@ int domain_relinquish_resources(struct domain *d) =20 #undef PROGRESS =20 +#endif /* CONFIG_MGMT_HYPERCALLS */ + void arch_dump_domain_info(struct domain *d) { p2m_dump_info(d); diff --git a/xen/arch/arm/include/asm/tee/tee.h b/xen/arch/arm/include/asm/= tee/tee.h index 15d664e28d..f4187c5dc3 100644 --- a/xen/arch/arm/include/asm/tee/tee.h +++ b/xen/arch/arm/include/asm/tee/tee.h @@ -40,12 +40,14 @@ struct tee_mediator_ops { int (*domain_teardown)(struct domain *d); void (*free_domain_ctx)(struct domain *d); =20 +#ifdef CONFIG_MGMT_HYPERCALLS /* * Called during domain destruction to relinquish resources used * by mediator itself. This function can return -ERESTART to indicate * that it does not finished work and should be called again. */ int (*relinquish_resources)(struct domain *d); +#endif =20 /* Handle SMCCC call for current domain. */ bool (*handle_call)(struct cpu_user_regs *regs); diff --git a/xen/arch/arm/mmu/p2m.c b/xen/arch/arm/mmu/p2m.c index 51abf3504f..30d6071e91 100644 --- a/xen/arch/arm/mmu/p2m.c +++ b/xen/arch/arm/mmu/p2m.c @@ -1243,6 +1243,7 @@ static void p2m_invalidate_table(struct p2m_domain *p= 2m, mfn_t mfn) p2m->need_flush =3D true; } =20 +#ifdef CONFIG_MGMT_HYPERCALLS /* * The domain will not be scheduled anymore, so in theory we should * not need to flush the TLBs. Do it for safety purpose. @@ -1262,6 +1263,7 @@ void p2m_clear_root_pages(struct p2m_domain *p2m) =20 p2m_write_unlock(p2m); } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 /* * Invalidate all entries in the root page-tables. This is @@ -1556,6 +1558,7 @@ int p2m_init(struct domain *d) return 0; } =20 +#ifdef CONFIG_MGMT_HYPERCALLS /* * The function will go through the p2m and remove page reference when it * is required. The mapping will be removed from the p2m. @@ -1626,6 +1629,7 @@ int relinquish_p2m_mapping(struct domain *d) =20 return rc; } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 /* * Clean & invalidate RAM associated to the guest vCPU. diff --git a/xen/arch/arm/mpu/p2m.c b/xen/arch/arm/mpu/p2m.c index f7fb58ab6a..c44297a9e3 100644 --- a/xen/arch/arm/mpu/p2m.c +++ b/xen/arch/arm/mpu/p2m.c @@ -57,10 +57,12 @@ bool p2m_resolve_translation_fault(struct domain *d, gf= n_t gfn) =20 void p2m_flush_vm(struct vcpu *v) {} =20 +#ifdef CONFIG_MGMT_HYPERCALLS int relinquish_p2m_mapping(struct domain *d) { return 0; } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 void p2m_domain_creation_finished(struct domain *d) {} =20 diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c index 1d0239cf69..f9ba9b60bf 100644 --- a/xen/arch/arm/tee/ffa.c +++ b/xen/arch/arm/tee/ffa.c @@ -469,10 +469,12 @@ static void ffa_free_domain_ctx(struct domain *d) XFREE(d->arch.tee); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS static int ffa_relinquish_resources(struct domain *d) { return 0; } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static void ffa_init_secondary(void) { @@ -623,7 +625,9 @@ static const struct tee_mediator_ops ffa_ops =3D .domain_init =3D ffa_domain_init, .domain_teardown =3D ffa_domain_teardown, .free_domain_ctx =3D ffa_free_domain_ctx, +#ifdef CONFIG_MGMT_HYPERCALLS .relinquish_resources =3D ffa_relinquish_resources, +#endif .handle_call =3D ffa_handle_call, }; =20 diff --git a/xen/arch/arm/tee/optee.c b/xen/arch/arm/tee/optee.c index 5151bd90ed..1ed0fd231d 100644 --- a/xen/arch/arm/tee/optee.c +++ b/xen/arch/arm/tee/optee.c @@ -632,6 +632,7 @@ static void free_optee_shm_buf_pg_list(struct optee_dom= ain *ctx, cookie); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS static int optee_relinquish_resources(struct domain *d) { struct arm_smccc_res resp; @@ -693,6 +694,7 @@ static int optee_relinquish_resources(struct domain *d) =20 return 0; } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 #define PAGELIST_ENTRIES_PER_PAGE \ ((OPTEE_MSG_NONCONTIG_PAGE_SIZE / sizeof(u64)) - 1) @@ -1727,7 +1729,9 @@ static const struct tee_mediator_ops optee_ops =3D .probe =3D optee_probe, .domain_init =3D optee_domain_init, .domain_teardown =3D optee_domain_teardown, +#ifdef CONFIG_MGMT_HYPERCALLS .relinquish_resources =3D optee_relinquish_resources, +#endif .handle_call =3D optee_handle_call, }; =20 diff --git a/xen/arch/arm/tee/tee.c b/xen/arch/arm/tee/tee.c index 8501443c8e..a8e160700f 100644 --- a/xen/arch/arm/tee/tee.c +++ b/xen/arch/arm/tee/tee.c @@ -65,6 +65,7 @@ int tee_domain_teardown(struct domain *d) return cur_mediator->ops->domain_teardown(d); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS int tee_relinquish_resources(struct domain *d) { if ( !cur_mediator ) @@ -72,6 +73,7 @@ int tee_relinquish_resources(struct domain *d) =20 return cur_mediator->ops->relinquish_resources(d); } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 uint16_t tee_get_type(void) { diff --git a/xen/arch/ppc/stubs.c b/xen/arch/ppc/stubs.c index 9953ea1c6c..4d03a927ee 100644 --- a/xen/arch/ppc/stubs.c +++ b/xen/arch/ppc/stubs.c @@ -229,10 +229,12 @@ int arch_vcpu_reset(struct vcpu *v) BUG_ON("unimplemented"); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS int domain_relinquish_resources(struct domain *d) { BUG_ON("unimplemented"); } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 void arch_dump_domain_info(struct domain *d) { diff --git a/xen/arch/riscv/stubs.c b/xen/arch/riscv/stubs.c index cb19a83280..c2e6af2c43 100644 --- a/xen/arch/riscv/stubs.c +++ b/xen/arch/riscv/stubs.c @@ -203,10 +203,12 @@ int arch_vcpu_reset(struct vcpu *v) BUG_ON("unimplemented"); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS int domain_relinquish_resources(struct domain *d) { BUG_ON("unimplemented"); } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 void arch_dump_domain_info(struct domain *d) { diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 5e37bfbd17..b103301d7a 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -2289,6 +2289,7 @@ void sync_vcpu_execstate(struct vcpu *v) read_atomic(&v->dirty_cpu) !=3D dirty_cpu); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS static int relinquish_memory( struct domain *d, struct page_list_head *list, unsigned long type) { @@ -2613,6 +2614,7 @@ int domain_relinquish_resources(struct domain *d) =20 return 0; } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 void arch_dump_domain_info(struct domain *d) { diff --git a/xen/arch/x86/emul-i8254.c b/xen/arch/x86/emul-i8254.c index 144aa168a3..f106ab794c 100644 --- a/xen/arch/x86/emul-i8254.c +++ b/xen/arch/x86/emul-i8254.c @@ -651,6 +651,7 @@ void pit_init(struct domain *d) pit_reset(d); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS void pit_deinit(struct domain *d) { PITState *pit =3D domain_vpit(d); @@ -664,6 +665,7 @@ void pit_deinit(struct domain *d) destroy_periodic_time(&pit->pt0); } } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 /* * Local variables: diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c index 05633fe2ac..4e915808f4 100644 --- a/xen/arch/x86/mm/p2m-pod.c +++ b/xen/arch/x86/mm/p2m-pod.c @@ -366,6 +366,7 @@ void p2m_pod_get_mem_target(const struct domain *d, xen= _pod_target_t *target) pod_unlock(p2m); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS int p2m_pod_empty_cache(struct domain *d) { struct p2m_domain *p2m =3D p2m_get_hostp2m(d); @@ -409,6 +410,7 @@ int p2m_pod_empty_cache(struct domain *d) unlock_page_alloc(p2m); return p2m->pod.count ? -ERESTART : 0; } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 int p2m_pod_offline_or_broken_hit(struct page_info *p) diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index 2763f9a6be..a5db8e6d4a 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -2097,6 +2097,7 @@ int xenmem_add_to_physmap_one( return rc; } =20 +#ifdef CONFIG_MGMT_HYPERCALLS /* * Remove foreign mappings from the p2m, as that drops the page reference = taken * when mapped. @@ -2160,6 +2161,7 @@ int relinquish_p2m_mapping(struct domain *d) =20 return rc; } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 void p2m_log_dirty_range(struct domain *d, unsigned long begin_pfn, unsigned long nr, uint8_t *dirty_bitmap) diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c index 65455a6867..116389d4e9 100644 --- a/xen/arch/x86/mm/paging.c +++ b/xen/arch/x86/mm/paging.c @@ -768,6 +768,7 @@ void paging_vcpu_teardown(struct vcpu *v) shadow_vcpu_teardown(v); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS /* Call when destroying a domain */ int paging_teardown(struct domain *d) { @@ -794,6 +795,7 @@ int paging_teardown(struct domain *d) =20 return rc; } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 /* Call once all of the references to the domain have gone away */ void paging_final_teardown(struct domain *d) diff --git a/xen/common/domain.c b/xen/common/domain.c index f24f3675aa..6819494649 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -1221,6 +1221,7 @@ int rcu_lock_live_remote_domain_by_id(domid_t dom, st= ruct domain **d) return 0; } =20 +#ifdef CONFIG_MGMT_HYPERCALLS int domain_kill(struct domain *d) { int rc =3D 0; @@ -1271,6 +1272,7 @@ int domain_kill(struct domain *d) =20 return rc; } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 =20 void __domain_crash(struct domain *d) diff --git a/xen/drivers/passthrough/device_tree.c b/xen/drivers/passthroug= h/device_tree.c index eb0c233977..bdbae0f8bf 100644 --- a/xen/drivers/passthrough/device_tree.c +++ b/xen/drivers/passthrough/device_tree.c @@ -109,6 +109,7 @@ int iommu_dt_domain_init(struct domain *d) return 0; } =20 +#ifdef CONFIG_MGMT_HYPERCALLS int iommu_release_dt_devices(struct domain *d) { const struct domain_iommu *hd =3D dom_iommu(d); @@ -137,6 +138,7 @@ int iommu_release_dt_devices(struct domain *d) =20 return 0; } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static int iommu_dt_xlate(struct device *dev, const struct dt_phandle_args *iommu_spec, diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c index 52c22fa50c..422e45f5a6 100644 --- a/xen/drivers/passthrough/pci.c +++ b/xen/drivers/passthrough/pci.c @@ -946,6 +946,7 @@ static int deassign_device(struct domain *d, uint16_t s= eg, uint8_t bus, return ret; } =20 +#ifdef CONFIG_MGMT_HYPERCALLS int pci_release_devices(struct domain *d) { int combined_ret; @@ -1004,6 +1005,7 @@ int pci_release_devices(struct domain *d) =20 return combined_ret; } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 #define PCI_CLASS_BRIDGE_HOST 0x0600 #define PCI_CLASS_BRIDGE_PCI 0x0604 --=20 2.34.1 From nobody Sun Dec 14 05:55:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1765512439; cv=pass; d=zohomail.com; s=zohoarc; b=WZc/A44Q6nrF+SKVHiJuc7FlCYHWRMo0Y7hZLDB02muYRTzGFoF4SDngTwFkGFFcaI+vrl1KLKlMOIZvQ8tNBDw1+KqT12HCTy77uS2E4wULv8YNMs+y/P+n/8WA2c+wnzHGDQ2iVl8UaNqzW+M3muTOeXgtjV/YG5F1fHmevrg= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765512439; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ujDe1zt9QHrXlG7ZNmi2RWPU8HuKyDN6Q+EP1SD7HV8=; b=e0RdcYlVFLl/OXS5Xv7gk2EYF8IxPmlvPm/2GrUi0411faU2qIg8hAG+RhFYKrpPyXA8v3SozutbxWC/wiKt/y6ru9GDk/mtlChnwTahGw5b6qdeF9yoKjrWdT0Ttz2qKu6oK8xpj31NWzlCfHUAA1IGiKb47yx7T01HtCGvWbM= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1765512439868944.0095289852319; Thu, 11 Dec 2025 20:07:19 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1184914.1507262 (Exim 4.92) (envelope-from ) id 1vTuQl-0001p1-Qr; Fri, 12 Dec 2025 04:06:59 +0000 Received: by outflank-mailman (output) from mailman id 1184914.1507262; Fri, 12 Dec 2025 04:06:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vTuQl-0001om-Ma; Fri, 12 Dec 2025 04:06:59 +0000 Received: by outflank-mailman (input) for mailman id 1184914; Fri, 12 Dec 2025 04:06:58 +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 1vTuQk-0007SS-7t for xen-devel@lists.xenproject.org; Fri, 12 Dec 2025 04:06:58 +0000 Received: from DM1PR04CU001.outbound.protection.outlook.com (mail-centralusazlp170100005.outbound.protection.outlook.com [2a01:111:f403:c111::5]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id ffc3d82d-d70f-11f0-9cce-f158ae23cfc8; Fri, 12 Dec 2025 05:06:56 +0100 (CET) Received: from MN2PR03CA0019.namprd03.prod.outlook.com (2603:10b6:208:23a::24) by CYXPR12MB9320.namprd12.prod.outlook.com (2603:10b6:930:e6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.8; Fri, 12 Dec 2025 04:06:52 +0000 Received: from BL02EPF0002992C.namprd02.prod.outlook.com (2603:10b6:208:23a:cafe::6c) by MN2PR03CA0019.outlook.office365.com (2603:10b6:208:23a::24) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9388.16 via Frontend Transport; Fri, 12 Dec 2025 04:06:51 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by BL02EPF0002992C.mail.protection.outlook.com (10.167.249.57) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.4 via Frontend Transport; Fri, 12 Dec 2025 04:06:51 +0000 Received: from penny-System-Product-Name.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Thu, 11 Dec 2025 22:06:49 -0600 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: ffc3d82d-d70f-11f0-9cce-f158ae23cfc8 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PIeq9S8OHBwMPG4YYGbZplRdCWcpHxME9wXmHt2J2j8iI574QDOj2lLMt+XPSgaI2lAuIevYCQlC32s+gF2UJXW75MDDN31NnkolavnIvvhbPZu7c3dyS81+kJ16BwzBgBGfWKt347Sh2s/XTB1v7EraAKAjga64MLPgfHJL8laVDyXU8jkkNDpSBbyrR1xDedVstwTHV76tlDb61ysdG23tu4tGqno4hG9FdlcKhEPAXfA123tm5IGbuMUSwxIz8eEnEvAK3l2AHagdW+MVzso1hMBYMgbsy/oxyuiDX0jklL29GbewEd++1cIpY2ASgzH1pAgO9iS7ulO9n4C3QQ== 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=ujDe1zt9QHrXlG7ZNmi2RWPU8HuKyDN6Q+EP1SD7HV8=; b=KgxNpuyFTmyd6rWJNY2v4i8E2A1lUBNCP59bvRAnx1aH686HlfTaX15lwvkOjbfXubs9rvvcVPAOxSlBfbN6PTJytnnH4+ZbE7tKi1eY0GFNXc8zePSLoTmDYpbLV9DDSyd1U9TDVAhKNRJvXT5pQ6lxN5877STaGm4+BxJOCx4tcHWBEMNtpfHiE5dHJ2558N8+ogV9a9B86m3bk77hC6i4U++o+vR8kEEyuHLyqjb7FZisG8SWT5Eqk+SCr+ATUNREcIi8TAYWdGaHpB/ANZ+3ghz1/6inlyAyjulqTs7MHl+bZ1kdL/UkoUdW83kl96vnIqapl2wEoPPDKxoa7g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ujDe1zt9QHrXlG7ZNmi2RWPU8HuKyDN6Q+EP1SD7HV8=; b=1S0uPclOCCh4MrRqmYxA3CcUQLd9k8jytQ5kHGDcTfWgNXwwdkK/RHX8jhyvsbXu23gketArFG3MyJLhL+QbqhZV9v8CCYFIKJ067OdpqJbBepQ9RH24assbcPV2HzXF0O4CqGFvhQouhlEQv0B5PbWIoHugtM2pK7BVl1YeyzI= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; 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; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C From: Penny Zheng To: CC: , , Penny Zheng , Dario Faggioli , Juergen Gross , George Dunlap Subject: [PATCH v5 10/24] xen/domctl: wrap vcpu_affinity_domctl() with CONFIG_MGMT_HYPERCALLS Date: Fri, 12 Dec 2025 12:01:55 +0800 Message-ID: <20251212040209.1970553-11-Penny.Zheng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251212040209.1970553-1-Penny.Zheng@amd.com> References: <20251212040209.1970553-1-Penny.Zheng@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0002992C:EE_|CYXPR12MB9320:EE_ X-MS-Office365-Filtering-Correlation-Id: 5473bb78-81e1-4d8a-4371-08de3933e134 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?GdMJX9nOr9p/IVlXpJBxx4QGFkKdUpsrOzs7FiwNxbHyzitE3PB27ZnD84eA?= =?us-ascii?Q?J68wd6V+awla9zm8VBuj0ni50y3URty53b7W0kFuZDsK9uD0K90OoJjUAeTa?= =?us-ascii?Q?Zr30l60GN1gCS9npeg34lWsqPfcUjDNcPD7KwEHGy0oE4MzADTNlXI1dDY9I?= =?us-ascii?Q?SXAtbP9dgPBaIDnidbZdVQ5HUVoyPbHgteeZI5oy/oVujQDLhCGXDCNMNh/r?= =?us-ascii?Q?YQ9fkaAmV0Pn5RETxXOcycKMn58l4tvsu/zo7fC8AGKGytT5dZctuigv7xd9?= =?us-ascii?Q?RDsm8hl5DD1fdQuNLTJuKPVke4b2TOVyKKszoFXaEnC6yvnGMFJbEvJswsWi?= =?us-ascii?Q?zQLkL+xtgogAAnCEnC2Gjc0NZgBreL/pF7SMiWtdobnQ6PPDK358P0TKvOqb?= =?us-ascii?Q?njJbqFB+vqRRzZ1TNJb7SUzowsn2y7o+LUJD4eA99VSnARfGosGAIHC2h3L0?= =?us-ascii?Q?dUI31110FJp/SkRAmyFKxyXOFllwpcYFm5vtKfEOFmeMfijKkMAHvIMf/JFS?= =?us-ascii?Q?MLQ3AXCAO7FQMSwiRxkGKj4qK/IysBi20uG5O9hgvL/GUwepEX0sYstEXGgQ?= =?us-ascii?Q?qtDYB+Jw6a0uJ93Gxyhr6AMCuLYRB4/ZhixYUjvWMzbHUBU/N16neMnexM8x?= =?us-ascii?Q?MfDfE9+w6NdiAzrqkDD2ZT/7Fq9HAqPJnE+6NU8snZnIwmLRls6P0xRKJCuH?= =?us-ascii?Q?nLdG2X4+p4dkD07MeFU+Z5UeomQMQ3/jNmKRJJSedHQ7WelnSyNLK9lYufCX?= =?us-ascii?Q?ADG1wqfh3GVsYCnDMhnwuyfu5XG7VSFGDtxfMVgm0HVEhjxGymyzQ0siBpJf?= =?us-ascii?Q?4DSvnN0Y6o+xl7n/f6s6HrwweUi5PHUx/xCglGKdizvoqeou1R5QGN6tepZB?= =?us-ascii?Q?U5CrM5vd2Kh18gxqIEVjKIvMkQSA/TEiTjvzY920zWJJrkSSJ/ipp4vWUMId?= =?us-ascii?Q?Ow0wsFohKiC/Y0X8u+9+3WYSor3CC3yVFatvm2RuZkGkRSX+bkuy9e2DSLjS?= =?us-ascii?Q?0fLrB8b3ScW5fbtVYRIVCiKHevj8KSJB9+tz7V99mpL9RezAw7Mg/60Eu1TS?= =?us-ascii?Q?HZyKgqz5C9qRfVz/42byMl4i0IkUhdbt5VpoVymEmyEvRu2x/4rDMnZWqod1?= =?us-ascii?Q?zuGWR8RqWUeLVq7VFfOnQtkSF1STKl+2l16GES9gmehNeSf6wOkMJLLd/S11?= =?us-ascii?Q?ia07cGZxBCs1AtOBCnvjIIxqvHUPQ4NeDXaMS2lgFpoRRnyMQQ5eZsfHH/L2?= =?us-ascii?Q?Yjm2HkTZZXSHSglxZDASbHM7DuUibxNqWqUNE9yizENS9cFn+kQcdzf1xmlX?= =?us-ascii?Q?AKM2hnl9xlWM8C9bJ/88zlaeyjB3Di42NzXnHzG2uDrr1ZhWQ7ZtMCcal7Qh?= =?us-ascii?Q?3NnJ31lkPXFMR8/S879hKjSSNcGm19b+ejghJ1au2FedDbrO/O+pzn62ERrK?= =?us-ascii?Q?QQ5L/FBeUBBey1Uwti3Fh2u8H94qZRhsgNTCbHmA+n+Q/trURhQ/7Vl1j/dp?= =?us-ascii?Q?oUTQ5g1/LY+bnfBfmQVitVqLuDfsVSwIvHMIBo0LWhCeI8kdzgNxj+8hxW4I?= =?us-ascii?Q?vaikI92vicy9QvaJBVI=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(376014)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2025 04:06:51.7157 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5473bb78-81e1-4d8a-4371-08de3933e134 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0002992C.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYXPR12MB9320 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1765512440083158500 Content-Type: text/plain; charset="utf-8" Function vcpu_affinity_domctl() is responsible for XEN_DOMCTL_{getvcpuaffinity,setvcpuaffinity} domctl-op, and shall be wrapped with CONFIG_MGMT_HYPERCALLS. Otherwise it will become unreachable codes when MGMT_HYPERCALLS=3Dn, and hence violating Misra rule 2.1. Tracking its calling chain, vcpuaffinity_params_invalid() also needs wrapping too Signed-off-by: Penny Zheng --- v1 -> v2: - adapt to changes of "unify DOMCTL to MGMT_HYPERCALLS" - wrap XEN_DOMCTL_{getvcpuaffinity,setvcpuaffinity}-case transiently --- v2 -> v3: - adapt to changes of "remove vcpu_set_soft_affinity()" - address "violating Misra rule 2.1" in commit message - remove transient wrapping around XEN_DOMCTL_{getvcpuaffinity,setvcpuaffin= ity}-case --- v3 -> v4 - wrap vcpuaffinity_params_invalid() --- xen/common/sched/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c index 88150432c3..83e34e7c05 100644 --- a/xen/common/sched/core.c +++ b/xen/common/sched/core.c @@ -1678,6 +1678,7 @@ int vcpu_temporary_affinity(struct vcpu *v, unsigned = int cpu, uint8_t reason) return ret; } =20 +#ifdef CONFIG_MGMT_HYPERCALLS static inline int vcpuaffinity_params_invalid(const struct xen_domctl_vcpuaffinity *vcpu= aff) { @@ -1798,6 +1799,7 @@ int vcpu_affinity_domctl(struct domain *d, uint32_t c= md, =20 return ret; } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 bool alloc_affinity_masks(struct affinity_masks *affinity) { --=20 2.34.1 From nobody Sun Dec 14 05:55:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1765512455; cv=pass; d=zohomail.com; s=zohoarc; b=kmaSOCAsQlAD9LaI7VDPG3WcrcreAKCc8V76Cqh7q+3z8NwJzSicQIDczEhvGXNwopN9IbWJRPYAA+DOw6//uSG4D9aFkdQ8Na7gg1vB06Ct+JmWz/UwcbmCf56wqZEwv+6GJyNJgdQYZjEeoTV/djebsh4QnTXWn8BtvWhro1U= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765512455; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=fc4GOUXjj8Gz2F+R05siesUERkmjkVYJyAi/lfHSPH0=; b=DhomnXcUHxIc3MV8v4JW0vyvWfSj9dHc6V+okjzeZ236QliqMi9EqdDQl6kp4J4LqcuECz2PVw1O7xPc7kGnRBvmYdjqaF7aTNWF3fRjr76RhP+cXaOT4U+IYHB4/F9Rxf3piQYcIPNwopCSQnDnYjq143QiZFb6VHuJh0cO1wo= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1765512455777990.7108740718224; Thu, 11 Dec 2025 20:07:35 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1184932.1507276 (Exim 4.92) (envelope-from ) id 1vTuR5-0003Vd-Aq; Fri, 12 Dec 2025 04:07:19 +0000 Received: by outflank-mailman (output) from mailman id 1184932.1507276; Fri, 12 Dec 2025 04:07:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vTuR5-0003V2-5e; Fri, 12 Dec 2025 04:07:19 +0000 Received: by outflank-mailman (input) for mailman id 1184932; Fri, 12 Dec 2025 04:07:18 +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 1vTuQm-0007Dl-9E for xen-devel@lists.xenproject.org; Fri, 12 Dec 2025 04:07:00 +0000 Received: from BL0PR03CU003.outbound.protection.outlook.com (mail-eastusazlp170120007.outbound.protection.outlook.com [2a01:111:f403:c101::7]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 0103ecba-d710-11f0-b15b-2bf370ae4941; Fri, 12 Dec 2025 05:06:59 +0100 (CET) Received: from MN2PR18CA0004.namprd18.prod.outlook.com (2603:10b6:208:23c::9) by CH1PPFDA34A4201.namprd12.prod.outlook.com (2603:10b6:61f:fc00::625) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9388.11; Fri, 12 Dec 2025 04:06:55 +0000 Received: from BL02EPF0002992B.namprd02.prod.outlook.com (2603:10b6:208:23c:cafe::70) by MN2PR18CA0004.outlook.office365.com (2603:10b6:208:23c::9) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9412.11 via Frontend Transport; Fri, 12 Dec 2025 04:06:55 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by BL02EPF0002992B.mail.protection.outlook.com (10.167.249.56) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.4 via Frontend Transport; Fri, 12 Dec 2025 04:06:54 +0000 Received: from penny-System-Product-Name.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Thu, 11 Dec 2025 22:06:51 -0600 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: 0103ecba-d710-11f0-b15b-2bf370ae4941 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jYbrfidpstbGB/dQZ5QhMngzbvTifHfAIeqsJXA5zTzi03v/0aNMUXlaAM+A1usA4gaCDFs7oGcWwaYrAP7RImQF6QDzo0zaHYC9Z1lHgwnv0gbZIGRwV2A8G5CmUNlmI/cSWGx1ZLkjTRPtz8qixT+zOu3jLRkHG+mVa1F5/sM0tyQvuefu694j/BRqHKUkzYWgwqLLAvrJQGVqfXWj8lqZ8HD68NOgpUnNrTwnJ4oe4uMsC69K/qwOcCchqk87lnYkRnnD8rjqA1z4GSWeA+VxCwJRBigj0UeN5Zy9ZnbBh2psETK2E4tKZBO92X8qA/811wUviotFW/JWG9WHaQ== 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=fc4GOUXjj8Gz2F+R05siesUERkmjkVYJyAi/lfHSPH0=; b=ZrSWCzmsPRKbVX1Z3TthvNNRmUMsUrnbLE7Ujb2mHaQihQEGtgwCWNgkf7VgkBr9VCHHLGkTPNfeYeD91Z7CkJXDOqu3LQAu3zsAMzq1OxEA/GHeMc56b+EP9Sd0lLODz++10HpIyxTeXTvm1IWE+jVcjeK9m36yanvFXKnP/iLduly2Z8imtYi8xmwGaYZjPpYM/6XJ8Fn/KtRC6JR1e0UJXZXwoivW2uG5GwLaYbmfMIMcNQSdVfkCKXmdQHMU2OTaZ51ipQpcvegBUCN99A34oFpgFMXtvyp7QStoOleS9h4EjjXiKPK7fP9MNIjev4wQYL+6ExsVCoX6KC0MuQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fc4GOUXjj8Gz2F+R05siesUERkmjkVYJyAi/lfHSPH0=; b=21/Ci0CLAcN8zX0dmRBq0bhOSevsDRaK9kITT4HDT40WlhsOb0SgGVDixOBQpr+t54Mts2us9ZfD0wGEeDa4rs+AwhhofQ78ufDqjcOgysHBeGIvSf6Vzg75yOmJjSiSvrh7H1N4RrSZVTCg/yqnUUR1lpSo+29i3LD2n0lppWs= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; 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; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C From: Penny Zheng To: , CC: , , Penny Zheng , Nathan Studer , "Stewart Hildebrand" , Dario Faggioli , "Juergen Gross" , George Dunlap , Meng Xu , "Daniel P. Smith" , Stefano Stabellini Subject: [PATCH v5 11/24] xen/domctl: wrap sched_adjust() with CONFIG_MGMT_HYPERCALLS Date: Fri, 12 Dec 2025 12:01:56 +0800 Message-ID: <20251212040209.1970553-12-Penny.Zheng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251212040209.1970553-1-Penny.Zheng@amd.com> References: <20251212040209.1970553-1-Penny.Zheng@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0002992B:EE_|CH1PPFDA34A4201:EE_ X-MS-Office365-Filtering-Correlation-Id: 12511625-b345-4a06-0d10-08de3933e324 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|1800799024|36860700013|7416014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?b676qOjQKf2WL139nWI0Emx8+eUygDt5T7LEEL3S6w5nYRdzBNLHEDuA5EC3?= =?us-ascii?Q?3UIxHMDgT3EKPRVEK+0XrpDZotg7wtQ/esKj5AieoBCrhBuKsn5Pj0Gu8IDs?= =?us-ascii?Q?0QvnsER7G1JX+x/kF1fLTULezhbC6+R6rcGDsMFGAkL0me4rhWR0MlRd8kzk?= =?us-ascii?Q?IXOkf5Ll6oVnNeYSDBQnivWd95DjOs255Mel1STrTgF32DrIC1BebfnSa3CW?= =?us-ascii?Q?2j8AjEdXINB5ZvATEXrVewFn9IzPCLMMqX/ZXFtB3do8dGgNoNS1Dnbx6CSj?= =?us-ascii?Q?xZq44VgoOoOlTeGVRWlOGo33AkFafg52uW1Gan5EKQnTT1rAKFrbRtvy3t6s?= =?us-ascii?Q?jJVg7whRktNscbqqeyOx+Klut5aH0H8gOOfNBiTikR4w9i8proaXbLqmg+E8?= =?us-ascii?Q?7TtZMswI2jLMFMXI8BOKaeNhcla6G8TVoOVaiyCvtsxXL/QlvLFwaEYQyVTQ?= =?us-ascii?Q?Ww4Axz//hvhsbQ8x8Sq/MPa1KKSDpg9KaBbwJpkuk/jwCk+ufqkJeqh0WqJK?= =?us-ascii?Q?F6MW25ID4zHLbHmJiMAfKpUTlrGv29hzpv0L7eiMI//8M07H9mp66OS7aoN4?= =?us-ascii?Q?EbhXGHgMVOiD00y4ctrzVkR52SKZmur1xfKjvsUJfKRsn9pnFxpjmdXm6c2M?= =?us-ascii?Q?zaperFsfkOhRWvPEtdccdKCC2b6eR3RAz6ZXgl0yGZZW0jmARY7VUzCRtS8e?= =?us-ascii?Q?z3KWINXIiBUWjRaM5ZBkuJsNeyzmOJjv+xGDrxDhFnFk9GTOEO3xc+Qh6Wy1?= =?us-ascii?Q?KLsrWvVKkMO764AOiTeUIhYdssH0vCuSV3a4/fnhqtKfMliZgF15NwzStgLh?= =?us-ascii?Q?5/zOVEn0azUwldKF7q/DH1CLUwHudoCVmURR/jF/eSNht1nsvZvC6tByeo+H?= =?us-ascii?Q?+TjDC296OnDkOROo/b1JGUcNruZJ7CpCSTwbBnRiBGbvMnESfgQK/Ihb146F?= =?us-ascii?Q?ggxV8w2ZitnKKomTii7aoSxW667lgEtG/rkTSFOBcpZEbnwTmB4jR55qUBhh?= =?us-ascii?Q?0MOZyLnH5rySVcwahlY1wbiuMaVtZXPqr7fz6WSpwLtfYUSJZ3GIaItYV+ul?= =?us-ascii?Q?zrd7U9gCzLw8sdNNsPOuT2RwpTrGrMmhGy7nuNMC/qxzcob56r7MlSggCkql?= =?us-ascii?Q?LTSxM9qiZfFuEbdg524hNIGKF4dFerASfaTmSwJhogHEn0JggKVHBkBUvpAm?= =?us-ascii?Q?4RBgM7EJiGkIEj49sN3hiMTcvg15utgejCrCQXGRC4RT5eNSsHM4A6CF/y9p?= =?us-ascii?Q?RF7W+ez/5DEGr4NdG6NrCsKxERhe2u5ZwfYMe/PSbiGMexhTrykArSRQ6bvM?= =?us-ascii?Q?we4ZJv+Sp29weB594D1xwlE8mVC2tgKqFEANmTHU2sOII46gqGkA1y6WCJVt?= =?us-ascii?Q?iSOvtAWBeZo7TiRnijxuQ8Mn0cZHBHSklsoAO4DDqJYUnK19KDhTinkap8zV?= =?us-ascii?Q?cBVHLmFXBIvejacS5smejCmcGqr3GnFCGeQmlSCo0yNdRDMB6SVC+uOijDFG?= =?us-ascii?Q?3B0bAgXs35lTnAeBm02dItkANZOQtaz9o6R6r6Y85aTkUGTfX158ixLikvMq?= =?us-ascii?Q?6gZvrAqwtYaFrSO05A8=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(376014)(1800799024)(36860700013)(7416014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2025 04:06:54.9656 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 12511625-b345-4a06-0d10-08de3933e324 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0002992B.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH1PPFDA34A4201 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1765512456383158500 Content-Type: text/plain; charset="utf-8" Function sched_adjust() is responsible for XEN_DOMCTL_scheduler_op domctl-o= p, so it could be wrapped with CONFIG_MGMT_HYPERCALLS. Tracing its calling chain, the following functions shall be wrapped with CONFIG_MGMT_HYPERCALLS too: - sched_adjust_dom() - scheduler-specific .adjust() callback - xsm_sysctl_scheduler_op() Otherwise all these functions will become unreachable when MGMT_HYPERCALLS= =3Dn, and hence violating Misra rule 2.1. Signed-off-by: Penny Zheng Reviewed-by: Stefano Stabellini Reviewed-by: Juergen Gross --- v1 -> v2: - adapt to changes of "unify DOMCTL to MGMT_HYPERCALLS" - wrap XEN_DOMCTL_scheduler_op-case transiently --- v2 -> v3 - add missing wrapping in xsm/dummy.h - move and get away with just a single #ifdef - address "violating Misra rule 2.1" in commit message - remove transient wrapping around XEN_DOMCTL_scheduler_op-case --- xen/common/sched/arinc653.c | 1 - xen/common/sched/core.c | 2 -- xen/common/sched/credit.c | 4 +++- xen/common/sched/credit2.c | 4 +++- xen/common/sched/private.h | 8 ++++---- xen/common/sched/rt.c | 4 ++++ xen/include/xsm/dummy.h | 2 ++ xen/include/xsm/xsm.h | 4 ++-- xen/xsm/dummy.c | 2 +- xen/xsm/flask/hooks.c | 4 ++-- 10 files changed, 21 insertions(+), 14 deletions(-) diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c index 7d6c40d800..5a6f8c8642 100644 --- a/xen/common/sched/arinc653.c +++ b/xen/common/sched/arinc653.c @@ -735,7 +735,6 @@ static const struct scheduler sched_arinc653_def =3D { =20 .switch_sched =3D a653_switch_sched, =20 - .adjust =3D NULL, #ifdef CONFIG_MGMT_HYPERCALLS .adjust_global =3D a653sched_adjust_global, #endif diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c index 83e34e7c05..0943cb1e97 100644 --- a/xen/common/sched/core.c +++ b/xen/common/sched/core.c @@ -2072,7 +2072,6 @@ int scheduler_id(void) { return operations.sched_id; } -#endif =20 /* Adjust scheduling parameter for a given domain. */ long sched_adjust(struct domain *d, struct xen_domctl_scheduler_op *op) @@ -2109,7 +2108,6 @@ long sched_adjust(struct domain *d, struct xen_domctl= _scheduler_op *op) return ret; } =20 -#ifdef CONFIG_MGMT_HYPERCALLS long sched_adjust_global(struct xen_sysctl_scheduler_op *op) { struct cpupool *pool; diff --git a/xen/common/sched/credit.c b/xen/common/sched/credit.c index e8fef6fb51..54a4def362 100644 --- a/xen/common/sched/credit.c +++ b/xen/common/sched/credit.c @@ -1183,6 +1183,7 @@ csched_unit_yield(const struct scheduler *ops, struct= sched_unit *unit) set_bit(CSCHED_FLAG_UNIT_YIELD, &svc->flags); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS static int cf_check csched_dom_cntl( const struct scheduler *ops, @@ -1227,6 +1228,7 @@ csched_dom_cntl( =20 return rc; } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static void cf_check csched_aff_cntl(const struct scheduler *ops, struct sched_unit *unit, @@ -2288,9 +2290,9 @@ static const struct scheduler sched_credit_def =3D { .wake =3D csched_unit_wake, .yield =3D csched_unit_yield, =20 - .adjust =3D csched_dom_cntl, .adjust_affinity=3D csched_aff_cntl, #ifdef CONFIG_MGMT_HYPERCALLS + .adjust =3D csched_dom_cntl, .adjust_global =3D csched_sys_cntl, #endif =20 diff --git a/xen/common/sched/credit2.c b/xen/common/sched/credit2.c index 307e63ebd8..b73dd3c548 100644 --- a/xen/common/sched/credit2.c +++ b/xen/common/sched/credit2.c @@ -2909,6 +2909,7 @@ static void cf_check csched2_unit_migrate( sched_set_res(unit, get_sched_res(new_cpu)); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS static int cf_check csched2_dom_cntl( const struct scheduler *ops, @@ -3114,6 +3115,7 @@ csched2_dom_cntl( =20 return rc; } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static void cf_check csched2_aff_cntl(const struct scheduler *ops, struct sched_unit *unit, @@ -4246,9 +4248,9 @@ static const struct scheduler sched_credit2_def =3D { .wake =3D csched2_unit_wake, .yield =3D csched2_unit_yield, =20 - .adjust =3D csched2_dom_cntl, .adjust_affinity=3D csched2_aff_cntl, #ifdef CONFIG_MGMT_HYPERCALLS + .adjust =3D csched2_dom_cntl, .adjust_global =3D csched2_sys_cntl, #endif =20 diff --git a/xen/common/sched/private.h b/xen/common/sched/private.h index b7ff67200b..3b35002c5d 100644 --- a/xen/common/sched/private.h +++ b/xen/common/sched/private.h @@ -349,14 +349,14 @@ struct scheduler { void (*migrate) (const struct scheduler *ops, struct sched_unit *unit, unsigned int new_cpu); - int (*adjust) (const struct scheduler *ops, - struct domain *d, - struct xen_domctl_scheduler_op *op); void (*adjust_affinity)(const struct scheduler *ops, struct sched_unit *unit, const struct cpumask *hard, const struct cpumask *soft); #ifdef CONFIG_MGMT_HYPERCALLS + int (*adjust) (const struct scheduler *ops, + struct domain *d, + struct xen_domctl_scheduler_op *op); int (*adjust_global) (const struct scheduler *ops, struct xen_sysctl_scheduler_op *sc); #endif @@ -506,13 +506,13 @@ static inline void sched_adjust_affinity(const struct= scheduler *s, s->adjust_affinity(s, unit, hard, soft); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS static inline int sched_adjust_dom(const struct scheduler *s, struct domai= n *d, struct xen_domctl_scheduler_op *op) { return s->adjust ? s->adjust(s, d, op) : 0; } =20 -#ifdef CONFIG_MGMT_HYPERCALLS static inline int sched_adjust_cpupool(const struct scheduler *s, struct xen_sysctl_scheduler_op *op) { diff --git a/xen/common/sched/rt.c b/xen/common/sched/rt.c index 7b1f64a779..a42040b259 100644 --- a/xen/common/sched/rt.c +++ b/xen/common/sched/rt.c @@ -1362,6 +1362,7 @@ out: unit_schedule_unlock_irq(lock, unit); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS /* * set/get each unit info of each domain */ @@ -1471,6 +1472,7 @@ rt_dom_cntl( =20 return rc; } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 /* * The replenishment timer handler picks units @@ -1572,7 +1574,9 @@ static const struct scheduler sched_rtds_def =3D { .insert_unit =3D rt_unit_insert, .remove_unit =3D rt_unit_remove, =20 +#ifdef CONFIG_MGMT_HYPERCALLS .adjust =3D rt_dom_cntl, +#endif =20 .pick_resource =3D rt_res_pick, .do_schedule =3D rt_schedule, diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h index df8d737c18..6e8a6a2858 100644 --- a/xen/include/xsm/dummy.h +++ b/xen/include/xsm/dummy.h @@ -141,12 +141,14 @@ static XSM_INLINE int cf_check xsm_getdomaininfo( return xsm_default_action(action, current->domain, d); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS static XSM_INLINE int cf_check xsm_domctl_scheduler_op( XSM_DEFAULT_ARG struct domain *d, int cmd) { XSM_ASSERT_ACTION(XSM_HOOK); return xsm_default_action(action, current->domain, d); } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 #ifdef CONFIG_MGMT_HYPERCALLS static XSM_INLINE int cf_check xsm_sysctl_scheduler_op(XSM_DEFAULT_ARG int= cmd) diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h index d20d4ae657..b3bec66e7e 100644 --- a/xen/include/xsm/xsm.h +++ b/xen/include/xsm/xsm.h @@ -56,8 +56,8 @@ struct xsm_ops { struct xen_domctl_getdomaininfo *info); int (*domain_create)(struct domain *d, uint32_t ssidref); int (*getdomaininfo)(struct domain *d); - int (*domctl_scheduler_op)(struct domain *d, int op); #ifdef CONFIG_MGMT_HYPERCALLS + int (*domctl_scheduler_op)(struct domain *d, int op); int (*sysctl_scheduler_op)(int op); #endif int (*set_target)(struct domain *d, struct domain *e); @@ -242,13 +242,13 @@ static inline int xsm_get_domain_state(xsm_default_t = def, struct domain *d) return alternative_call(xsm_ops.get_domain_state, d); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS static inline int xsm_domctl_scheduler_op( xsm_default_t def, struct domain *d, int cmd) { return alternative_call(xsm_ops.domctl_scheduler_op, d, cmd); } =20 -#ifdef CONFIG_MGMT_HYPERCALLS static inline int xsm_sysctl_scheduler_op(xsm_default_t def, int cmd) { return alternative_call(xsm_ops.sysctl_scheduler_op, cmd); diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c index 2c70b979d6..2c878999a3 100644 --- a/xen/xsm/dummy.c +++ b/xen/xsm/dummy.c @@ -18,8 +18,8 @@ static const struct xsm_ops __initconst_cf_clobber dummy_= ops =3D { .security_domaininfo =3D xsm_security_domaininfo, .domain_create =3D xsm_domain_create, .getdomaininfo =3D xsm_getdomaininfo, - .domctl_scheduler_op =3D xsm_domctl_scheduler_op, #ifdef CONFIG_MGMT_HYPERCALLS + .domctl_scheduler_op =3D xsm_domctl_scheduler_op, .sysctl_scheduler_op =3D xsm_sysctl_scheduler_op, #endif .set_target =3D xsm_set_target, diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c index 490823913e..669b04f8ea 100644 --- a/xen/xsm/flask/hooks.c +++ b/xen/xsm/flask/hooks.c @@ -609,6 +609,7 @@ static int cf_check flask_getdomaininfo(struct domain *= d) return current_has_perm(d, SECCLASS_DOMAIN, DOMAIN__GETDOMAININFO); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS static int cf_check flask_domctl_scheduler_op(struct domain *d, int op) { switch ( op ) @@ -626,7 +627,6 @@ static int cf_check flask_domctl_scheduler_op(struct do= main *d, int op) } } =20 -#ifdef CONFIG_MGMT_HYPERCALLS static int cf_check flask_sysctl_scheduler_op(int op) { switch ( op ) @@ -1883,8 +1883,8 @@ static const struct xsm_ops __initconst_cf_clobber fl= ask_ops =3D { .security_domaininfo =3D flask_security_domaininfo, .domain_create =3D flask_domain_create, .getdomaininfo =3D flask_getdomaininfo, - .domctl_scheduler_op =3D flask_domctl_scheduler_op, #ifdef CONFIG_MGMT_HYPERCALLS + .domctl_scheduler_op =3D flask_domctl_scheduler_op, .sysctl_scheduler_op =3D flask_sysctl_scheduler_op, #endif .set_target =3D flask_set_target, --=20 2.34.1 From nobody Sun Dec 14 05:55:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1765512462; cv=pass; d=zohomail.com; s=zohoarc; b=N1sFMl6bY2widFxN+jvWv1IyvZs6KT6DmGnnynmvuYXKBRSe56E41eHeDANpo1ao3LlVKdSIWwJkqezLuE2gU6Di/bzN0bSvaxQfC0Lf9kiRKqkrAuPdzygdlo/TxjihmHb+qspFVDC378oTaQNrmoFJFpygrSAQD4aoVCby6Rs= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765512462; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=g0u0YW906Vw5GXiM5PY9h0Wf3UJFla0tEJDdVcSp3lE=; b=HAGCmMwxtoCdsWf1N71tbmuViWKEZr3R7ET+I36PkpV9si1Q7fOKTJo88SDhn7DqiFV0TQu6ale1pg1Eid9ftaB5mtheui+FW0sTlz2LlO5Kh8CVgDKipp3THE28yD/FPx4iLbKdt+HbN6LqjkpjqUgl7syoxyqt/38a4J2gtb0= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1765512462148895.4600149297673; Thu, 11 Dec 2025 20:07:42 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1184934.1507284 (Exim 4.92) (envelope-from ) id 1vTuR5-0003Zz-PI; Fri, 12 Dec 2025 04:07:19 +0000 Received: by outflank-mailman (output) from mailman id 1184934.1507284; Fri, 12 Dec 2025 04:07:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vTuR5-0003Xv-EM; Fri, 12 Dec 2025 04:07:19 +0000 Received: by outflank-mailman (input) for mailman id 1184934; Fri, 12 Dec 2025 04:07:18 +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 1vTuQt-0007SS-RG for xen-devel@lists.xenproject.org; Fri, 12 Dec 2025 04:07:07 +0000 Received: from PH7PR06CU001.outbound.protection.outlook.com (mail-westus3azlp170100009.outbound.protection.outlook.com [2a01:111:f403:c107::9]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 0453d223-d710-11f0-9cce-f158ae23cfc8; Fri, 12 Dec 2025 05:07:05 +0100 (CET) Received: from MN0PR04CA0023.namprd04.prod.outlook.com (2603:10b6:208:52d::28) by BL3PR12MB6548.namprd12.prod.outlook.com (2603:10b6:208:38f::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.9; Fri, 12 Dec 2025 04:06:56 +0000 Received: from BL02EPF00029927.namprd02.prod.outlook.com (2603:10b6:208:52d:cafe::92) by MN0PR04CA0023.outlook.office365.com (2603:10b6:208:52d::28) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9412.10 via Frontend Transport; Fri, 12 Dec 2025 04:06:52 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by BL02EPF00029927.mail.protection.outlook.com (10.167.249.52) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.4 via Frontend Transport; Fri, 12 Dec 2025 04:06:56 +0000 Received: from penny-System-Product-Name.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Thu, 11 Dec 2025 22:06:54 -0600 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: 0453d223-d710-11f0-9cce-f158ae23cfc8 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qJiM+dMh7WnjmBQhDbAkFciZGYsNZYcOCSKvbNBt1FO8eGD8ucFq6iQG6+PIw+4o2rQU6IgzOmpUBlTxvr/ZfqURCkvG0W6xFqf5WjOQQDGDsqBiuKjjapCn5KwAgWLIQ/P3sHY/HBAeA5h3uQUAQ/P12G2wbuk4ogsG/3lZEROVm8jY/ZxB3/cr/ZH4GlfmBXruMb31NvD62Kv4FiYOI1/QY9TRMlwQt3EZyFxFioJNI9Fo4nEzdQGmC2rN04LTh0sJm4MDhsxiB271MIRC5SBTzzZU+z22u0546yGho1pPxePuDFN/Jzq6qEVPSuKPT6gGHAr9XtV8Ok+Vup8mEQ== 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=g0u0YW906Vw5GXiM5PY9h0Wf3UJFla0tEJDdVcSp3lE=; b=Dw60RjpX5S9GwIUn8C5ZfhsmKrL6Blc3EwEGN79ItRu1xeSnmGqamBDzGd6ju8AysriYYYsX6pAv/7sc707s9ddAtgpcvrTHIN3aRggEZeXbL3tvJa+/0QgQBgBRVXbGjQHW5jQQEXsbNwePFoy37UXVQCL79+FIPR0ZlyC3IDlL+Lh02D3egHnxrf6Jvo7Zn3JvUnKY/xn5liz9jZsEhedZTjomlAL9GE8TxGy7drTzK4ZHd6ZOxMAR8dr/PFgzjW4USspaMpprLqd9hXf5AGNfwDlx0ot3wY7Kips97D8pmqiP63okzvRIltVUzWNV73xdVuQd+DrCzTHrX4bgjQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=g0u0YW906Vw5GXiM5PY9h0Wf3UJFla0tEJDdVcSp3lE=; b=helEOfrOaM1HjCeoHRliPxw8puJONZy6KxqNopC4v5p2QWenxUJh97s6wADlEfIlCWc0cHeGEIT8b4mfhjcZBZwXeFUqumt6+VLfwg13WYcGCdiFkNRKCQHrRxIjdIcU9RJ9jtQL+MWUxFP1U6Hlk4vVkUIcLM3iU04C60bGqz8= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; 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; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C From: Penny Zheng To: CC: , , Penny Zheng , "Daniel P. Smith" Subject: [PATCH v5 12/24] xen/xsm: wrap xsm_irq{,iomem}_permission with CONFIG_MGMT_HYPERCALLS Date: Fri, 12 Dec 2025 12:01:57 +0800 Message-ID: <20251212040209.1970553-13-Penny.Zheng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251212040209.1970553-1-Penny.Zheng@amd.com> References: <20251212040209.1970553-1-Penny.Zheng@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00029927:EE_|BL3PR12MB6548:EE_ X-MS-Office365-Filtering-Correlation-Id: 01171621-f024-448d-8d41-08de3933e41b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?fyenozwvsp+ObbL4ki3Q+89vSRgYXgcRquCi9tmOJm4Rp00eLJrN6pVM9r32?= =?us-ascii?Q?gzbMH0P361YfLWKAiUNDulwdmASEwW2YDtXFhWWfooCZLmNDdcWJ60kp1bVv?= =?us-ascii?Q?Kb1CREipdXXBfJHeRHZvTvNmUuFjFJ3fjS1L/YOvID64e+W2UXhtS5XGNYN+?= =?us-ascii?Q?t1IoHPRBhuk9X79skMvSUa5mX2ZXBQ60lrj3RQZiKJ6ifiCOe+i4J/Z1aFbt?= =?us-ascii?Q?lbvnAqwE2tXKjRpeoDNg3A32TqsQkQB/HglrLg+pV1aB3YF5nugbjzz842Vx?= =?us-ascii?Q?JzR+Ll3WHma5bWgq603L4uZ5o64c3IQ+L/S0rm+ql1TZ/4w5Xyme8+MlozPu?= =?us-ascii?Q?zwapI+CS0yL7epFebNVEz4mlVUMmfq2dNaFkk1vsJIDoZk+YYr98XqdN7Anh?= =?us-ascii?Q?eS0h1Lfxw0HXvSrQQhqjuYWcWYasFfXfczR6po6vyaHDtcxjE9ydg90k/ICu?= =?us-ascii?Q?UezU9Q8RLzUbfGjslnDrIG+PCk0PaKsbuVWyx7+RIg81k5+L5ycNGuMxSLuQ?= =?us-ascii?Q?7Yj2kCl57szU14c2db9m4Cj/DjC/FCQShJPEoY6Iwk/xon7Ye3g3ihv0+MCC?= =?us-ascii?Q?oAfh7k8v6qO/qZWuJsSWwAh1N+xLnSVCIH89veT4IqMCo7n/XwFyH0B5rSjn?= =?us-ascii?Q?V8ehT0o3GUlWM3MvDZazkJnb5W82DG/3Mv72zvdjNGFMyoCA59BuID6bvofE?= =?us-ascii?Q?Kbp3+dUCj0WQNSypH4VAfczika2QUlPXZfCguQE4gnnAozeGwSqo1IeEEEgk?= =?us-ascii?Q?/Pnc9Gxk7Qwui1MH6LHTBt14D5Ur1kmX33IhhbX5SziFlLBTU+nc7o8WIixh?= =?us-ascii?Q?q44mG7BN68nzbBLjz0Tjki//fXVftP4fBvD35hHgZlHg5P1bNBsmEu7j5BsY?= =?us-ascii?Q?QVN3v3XQOai0rDGn2aEN3zA3ZHNB+9J6JNFPWcu4nFeTjj0GpydLl0I0Sx+f?= =?us-ascii?Q?UVA66tF6Is4csnb9+0P1aPmQiSj10MLSHn/27OoLEmHJsrxf8ymdAWDfXkGr?= =?us-ascii?Q?jTm7rXHLnoPiq7JmvXWwbEI3rUpvYw0viQIA6pG8+DF6tqJnCYh8FCRKoT1B?= =?us-ascii?Q?kPVuquMAn5i/LiTlb7/tJ8X4rLs2Vb8dBfIfvJGKKdWNNCusaAZvjRSGUf5U?= =?us-ascii?Q?nts0w7Fwq8klKFu0Y5yraqMDkSuZ6hPfYsa6+CnzVIBQ3u5T07GU4rGLgt13?= =?us-ascii?Q?eEoO7+PtNa5E8Vk/s93V0QZmgGwNC5QMGQ1+j9I8rbkiuH2aPJKW2zsyUCeJ?= =?us-ascii?Q?cpoqtO8Lz7V4Hx8lZeGN+/STc+DQcJ5ho3B8bDIeZoPUhQLGWkl/EeRSKCMQ?= =?us-ascii?Q?2jpvWr+4Fzf/aNsX1FGac2FEsjRr3PnDWiAxLJEale7+iySPwWjs+anrbudO?= =?us-ascii?Q?oC7SsidXems15FeIwgIv0yWp2xYiZqDxlyXUPc1b9WUy551gd5JfbC/KDLMK?= =?us-ascii?Q?YVzBRW1BIBwiw/aMXT343xtSiEQXK9V+Q7Z0GEKwbzE5Tm8LJv+rvfl/cElI?= =?us-ascii?Q?i0CrXHoKb4wEE9E5KA6pbWyRMn8HoClqM/7CJZjT0KvXPP4PKR37rc5KzpS5?= =?us-ascii?Q?7IuTOhPuYc+A8GV3hGA=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(36860700013)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2025 04:06:56.5962 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 01171621-f024-448d-8d41-08de3933e41b X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00029927.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6548 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1765512464277158500 Content-Type: text/plain; charset="utf-8" Function xsm_irq{,iomem}_permission() is invoked only under XEN_DOMCTL_irq{,iomem}_permission domctl-op, and shall be wrapped with CONFIG_MGMT_HYPERCALLS. Otherwise it will become unreanchable when MGMT_HYPERCALLS=3Dn, and hence violating Misra rule 2.1. In flask policy, flask_iomem_permission() is also invoked for xsm_iomem_mapping(), which is needed in vpci support. So we shall exclude wrapping for flask_iomem_permission() Signed-off-by: Penny Zheng --- v1 -> v2: - adapt to changes of "unify DOMCTL to MGMT_HYPERCALLS" --- v2 -> v3 - add missing wrapping in xsm/dummy.h - adapt to the commit of "remove redundant xsm_iomem_mapping()" - address "violating Misra rule 2.1" in commit message --- v4 -> v5: - include changes for xsm_iomem_permission() --- xen/include/xsm/dummy.h | 2 ++ xen/include/xsm/xsm.h | 4 ++++ xen/xsm/dummy.c | 2 ++ xen/xsm/flask/hooks.c | 4 ++++ 4 files changed, 12 insertions(+) diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h index 6e8a6a2858..535de82f62 100644 --- a/xen/include/xsm/dummy.h +++ b/xen/include/xsm/dummy.h @@ -564,6 +564,7 @@ static XSM_INLINE int cf_check xsm_unmap_domain_irq( return xsm_default_action(action, current->domain, d); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS static XSM_INLINE int cf_check xsm_irq_permission( XSM_DEFAULT_ARG struct domain *d, int pirq, uint8_t allow) { @@ -577,6 +578,7 @@ static XSM_INLINE int cf_check xsm_iomem_permission( XSM_ASSERT_ACTION(XSM_HOOK); return xsm_default_action(action, current->domain, d); } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static XSM_INLINE int cf_check xsm_iomem_mapping( XSM_DEFAULT_ARG struct domain *d, uint64_t s, uint64_t e, uint8_t allo= w) diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h index b3bec66e7e..786cfd7ac4 100644 --- a/xen/include/xsm/xsm.h +++ b/xen/include/xsm/xsm.h @@ -115,9 +115,11 @@ struct xsm_ops { int (*unmap_domain_irq)(struct domain *d, int irq, const void *data); int (*bind_pt_irq)(struct domain *d, struct xen_domctl_bind_pt_irq *bi= nd); int (*unbind_pt_irq)(struct domain *d, struct xen_domctl_bind_pt_irq *= bind); +#ifdef CONFIG_MGMT_HYPERCALLS int (*irq_permission)(struct domain *d, int pirq, uint8_t allow); int (*iomem_permission)(struct domain *d, uint64_t s, uint64_t e, uint8_t allow); +#endif int (*iomem_mapping)(struct domain *d, uint64_t s, uint64_t e, uint8_t allow); int (*pci_config_permission)(struct domain *d, uint32_t machine_bdf, @@ -501,6 +503,7 @@ static inline int xsm_unbind_pt_irq( return alternative_call(xsm_ops.unbind_pt_irq, d, bind); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS static inline int xsm_irq_permission( xsm_default_t def, struct domain *d, int pirq, uint8_t allow) { @@ -512,6 +515,7 @@ static inline int xsm_iomem_permission( { return alternative_call(xsm_ops.iomem_permission, d, s, e, allow); } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static inline int xsm_iomem_mapping( xsm_default_t def, struct domain *d, uint64_t s, uint64_t e, uint8_t a= llow) diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c index 2c878999a3..b216894579 100644 --- a/xen/xsm/dummy.c +++ b/xen/xsm/dummy.c @@ -73,8 +73,10 @@ static const struct xsm_ops __initconst_cf_clobber dummy= _ops =3D { .unmap_domain_irq =3D xsm_unmap_domain_irq, .bind_pt_irq =3D xsm_bind_pt_irq, .unbind_pt_irq =3D xsm_unbind_pt_irq, +#ifdef CONFIG_MGMT_HYPERCALLS .irq_permission =3D xsm_irq_permission, .iomem_permission =3D xsm_iomem_permission, +#endif .iomem_mapping =3D xsm_iomem_mapping, .pci_config_permission =3D xsm_pci_config_permission, .get_vnumainfo =3D xsm_get_vnumainfo, diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c index 669b04f8ea..d480009142 100644 --- a/xen/xsm/flask/hooks.c +++ b/xen/xsm/flask/hooks.c @@ -1111,12 +1111,14 @@ static int cf_check flask_unbind_pt_irq( return current_has_perm(d, SECCLASS_RESOURCE, RESOURCE__REMOVE); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS static int cf_check flask_irq_permission( struct domain *d, int pirq, uint8_t access) { /* the PIRQ number is not useful; real IRQ is checked during mapping */ return current_has_perm(d, SECCLASS_RESOURCE, resource_to_perm(access)= ); } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 struct iomem_has_perm_data { uint32_t ssid; @@ -1938,8 +1940,10 @@ static const struct xsm_ops __initconst_cf_clobber f= lask_ops =3D { .unmap_domain_irq =3D flask_unmap_domain_irq, .bind_pt_irq =3D flask_bind_pt_irq, .unbind_pt_irq =3D flask_unbind_pt_irq, +#ifdef CONFIG_MGMT_HYPERCALLS .irq_permission =3D flask_irq_permission, .iomem_permission =3D flask_iomem_permission, +#endif .iomem_mapping =3D flask_iomem_permission, .pci_config_permission =3D flask_pci_config_permission, =20 --=20 2.34.1 From nobody Sun Dec 14 05:55:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1765512470; cv=pass; d=zohomail.com; s=zohoarc; b=aYcgLmFBuk21dU3eYLJEVMq6lqJ9u7MNFbRwuSR4vf8oFhYq7NILT5AiAs9SOKAxmgC9e0TaSR6ILAhcOl0TDjTBCxQQZdVNSFdU4Rjiy8mkv9rdha2jE8bD0UitSU6bOpKreI5R03pbF7FZ3ZJOVPzWW9r/cEUGADRJSFe4rQw= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765512470; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=4hSsMPp+Gwf1XzRD1dfz9efboZW2JkZdEhihPPv5904=; b=DUNHIdkYMjB2JFi8vxvh8XTzyee7eshhqM+jIMx6Ku4PCZ1AbQvlHJPRwac9+uEbvEtEdvev9BNLvlhrIsMAu26NHaCu4o/11+uRmVIBFaMvvJ4cQ08cFfe+Vo8Ot7nIh1qwQI4XNf04wzRj5y+uyTL5991hQdDhUGLoF0Kou4k= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1765512470032216.9787329297493; Thu, 11 Dec 2025 20:07:50 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1184952.1507312 (Exim 4.92) (envelope-from ) id 1vTuRA-0004nO-SM; Fri, 12 Dec 2025 04:07:24 +0000 Received: by outflank-mailman (output) from mailman id 1184952.1507312; Fri, 12 Dec 2025 04:07:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vTuRA-0004n7-M5; Fri, 12 Dec 2025 04:07:24 +0000 Received: by outflank-mailman (input) for mailman id 1184952; Fri, 12 Dec 2025 04:07:23 +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 1vTuQv-0007Dl-8y for xen-devel@lists.xenproject.org; Fri, 12 Dec 2025 04:07:09 +0000 Received: from SN4PR0501CU005.outbound.protection.outlook.com (mail-southcentralusazlp170110003.outbound.protection.outlook.com [2a01:111:f403:c10d::3]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 05557dea-d710-11f0-b15b-2bf370ae4941; Fri, 12 Dec 2025 05:07:06 +0100 (CET) Received: from BL6PEPF00013E03.NAMP222.PROD.OUTLOOK.COM (2603:10b6:22e:400:0:1001:0:1b) by DS0PR12MB7584.namprd12.prod.outlook.com (2603:10b6:8:13b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.9; Fri, 12 Dec 2025 04:07:02 +0000 Received: from BL02EPF0002992D.namprd02.prod.outlook.com (2a01:111:f403:f901::7) by BL6PEPF00013E03.outlook.office365.com (2603:1036:903:4::4) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9412.6 via Frontend Transport; Fri, 12 Dec 2025 04:07:02 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by BL02EPF0002992D.mail.protection.outlook.com (10.167.249.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.4 via Frontend Transport; Fri, 12 Dec 2025 04:07:02 +0000 Received: from penny-System-Product-Name.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Thu, 11 Dec 2025 22:06:56 -0600 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: 05557dea-d710-11f0-b15b-2bf370ae4941 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ULoZrgPWshFwCo6OOQyEa0aQRZE/nkE8TFL2gsqqBd/h/IqJLlKYtnQeOLnIldbEeoHt3nS65/bGIYM3qdtw6AUb7/moehVAsr2R82at+ditstBHPGhYtjZLpJBmHfXf/AL+nuIpxC5mYmTXV7JVpNH0kZW3cVdYlz6LySVPLQ47QXwlKjHcU/OuB9hKvJFZctMEg8uVCh0DFrJIUna2ur6qDNxdcsDhBlhYsXYflhmPzkLThg0lyukE8CjLYyx6or1OQhm37hWGqWmmx0i79o2MSR87BLmRwKz/ToVkVE7H1Virobj1zabkwIciCzECyk2ZJ9mmx0vZEN9tKm7tuQ== 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=4hSsMPp+Gwf1XzRD1dfz9efboZW2JkZdEhihPPv5904=; b=EXdvIzbXbPVbF8gjLe3Why7kHaO0q/Sv8khXRBsh1mDGe0zfmiwyaGk8jLhDB3kSNtb28MnuHyxOI5ZRhOPvln8iLUdiBJIEBz54j7WoWPYpbs8eDUk5Sz/mAP6Be0TgPF+P+fwSOOT2aCJ5ksTysCySU8rUzSwtl5N9WmYB0JqYAGO40cG5odlqc5BkeOJrFN05rQxoDaDZ1MRsE/VBKjiO0M0xD+F6LxKe3DZNn2DEZ7Ai6Ynj8uuhL3zut/tV4N3cExLk7XMrCO0phObY/xAL+aPYQ6vSbKVo3GhxLDXqD0zqm4t2RyAHivA1IHaplZPJF/uIilMWpzfksc+yPw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4hSsMPp+Gwf1XzRD1dfz9efboZW2JkZdEhihPPv5904=; b=PauBnWC7ULFfbbZDHXHlmt9iWR1LQDV2M0y9Vx7pmhXzl6xYrFOxuSxaioHykfrvREzkv5Ua1/u+00YvNNe80DB1d0m92w5qPh18zPxeTv3CEq2+owOblk1cuUXQuoJcAoXY59SGf1rUrLgu+wtIgeGt4WQyQNZTaNAU+C7VMUs= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; 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; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C From: Penny Zheng To: CC: , , Penny Zheng , Stefano Stabellini , "Julien Grall" , Bertrand Marquis , "Michal Orzel" , Volodymyr Babchuk , Alistair Francis , Bob Eshleman , Connor Davis , "Oleksii Kurochko" , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v5 13/24] xen/domctl: wrap arch-specific domain_set_time_offset() with CONFIG_MGMT_HYPERCALLS Date: Fri, 12 Dec 2025 12:01:58 +0800 Message-ID: <20251212040209.1970553-14-Penny.Zheng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251212040209.1970553-1-Penny.Zheng@amd.com> References: <20251212040209.1970553-1-Penny.Zheng@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0002992D:EE_|DS0PR12MB7584:EE_ X-MS-Office365-Filtering-Correlation-Id: 1039f12a-7642-4c66-3cff-08de3933e77a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|376014|82310400026|7416014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?3vP0vjNDnEG0Z5iKSakAYxSdaUel/3wafOwfiyLrcQBFOm3SbT1Aw0x3CyQJ?= =?us-ascii?Q?Ogh1JnPm3/Uv4nJOKyCSrW+UpRtqNZdA8lywBPAqzIMc6DYkWVXRYCNQC/kc?= =?us-ascii?Q?od5gMLM9WZMEjRkFYGKo266qRQVTRvn0JQzQ15r6RcNjStA3IRDGJuO/fRmv?= =?us-ascii?Q?2FeD4ncUqERq840Zi88ZbTRtJ+HQxuolG9gjENtOonqtCdXUWxwl3/vKxpQZ?= =?us-ascii?Q?yc2g/g5hw9H/NqJ/nUrQgqEClyfMopDzvCpI4PdIjL+tFNBFuTvUI/qXG0Bp?= =?us-ascii?Q?dR08PU/9PTi9J0v4pm6h3jtdhGHlpqbZPgS3nVzIOtOg0BwjqpyyW55P9ewD?= =?us-ascii?Q?h2F1EIXqSjmSc2YzXwgdzwtkn1Nxr1+s1TFCqvldrQFNytMPbk0qWhV6TfNH?= =?us-ascii?Q?6mtqG1wh1Ee91EyXmADRwGvEFLijgbgnj3oQh6+oNSZ5scPSEK/rB6es/F8j?= =?us-ascii?Q?5ZL2H7mV2pCReQC1jkk7ANnAf+xlsEN4uqrMj0H0YVKCht4nSJibepmF9YsB?= =?us-ascii?Q?TnrXt45aAVNDVPH0jjuxWYX+skyrNNvyyu07L9Q7MpytjUWoqrzHBBxOSEkl?= =?us-ascii?Q?n4Gfia93+okn+Q+JVpp3pzLzo77928KfYQLrorOrjl0VQp3JTehOnenLYFNl?= =?us-ascii?Q?5V6Kv88HtJcefwYXV92ALICnE604dEKuMtIcCz6R8VipF83qGtAwoYAcgNtg?= =?us-ascii?Q?Oib1SislO8jNjg3+V7P/hEDcMGAZXjsqU5dR1AayIEWDEyJhTLcmAaK7zZay?= =?us-ascii?Q?6gWtickPqOPjdrSkAqzd9K6IosMdtIE6bfVQ2iNNwXSncFRsoLznuvBpQfZZ?= =?us-ascii?Q?Exid2ONlWEZmJ1rD6GSmG7MMuAakNmfZnxS/6bHWsBfgi2eHeXdvhIg0klUa?= =?us-ascii?Q?2oAVUMMI3JL/frG8hhr+mzKhdS/FB3qiT8jAuzPtLLDMs8ZpWIlr+YBE9/yT?= =?us-ascii?Q?B4ZOE3bMhw1ZBrlOu8Mh55sJKJO6ZCbF5AVK/wgbudFwm9q1jDD+rMGUkZxn?= =?us-ascii?Q?wHeg58wxkQiDT6c+0VphnHGzG49mKvERTRrl6GHP3Dp4pRrv8aW64vrLjyXc?= =?us-ascii?Q?b6qU9U1p/Wb43Si7zOqMzsDSFQ7/Hf9rY2+iV9AureqVIV8YvYHtK2oGTbit?= =?us-ascii?Q?qi32InTggpVehnOU3eQFX9qq2Xdg+cPpYl41R/tqklDz9FrtHH2gcytYYHKa?= =?us-ascii?Q?hTQT8p7g/Uk5GVntgcaNb1eaajdogz9FIBH4sbd7vsYtYl3gnkHQ+AQhZJLO?= =?us-ascii?Q?RzXueJLQz3UqM+wDz/yV+uVARAoLtEBiHhJWbCFxWG4hnQBGA/5vNnhCmRW9?= =?us-ascii?Q?Ilvge8cpGUZIXl8DloJMhm5PCD0KQxxSexUjimGN5dJAF0V9oJN/1KoJbnqT?= =?us-ascii?Q?UjW2VcZVLhBCAVweHRAZsPL8qco0/cL+MxuTZ2RKnvcdQkt6NJoy77P1oP8i?= =?us-ascii?Q?tjmYBsTmKJF4p+9NlMc3Bpfghxd7wTocRG5i+nlfyNonDtCZk4S3qwEHP1rD?= =?us-ascii?Q?HUV7kNA+AANkAZdYOBFwTHA2bn3osX+o5ZYH+5QdnXkMtJ3NvB8l5wWYfHNu?= =?us-ascii?Q?K7BVc/F45JTEG3cmyAI=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(1800799024)(376014)(82310400026)(7416014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2025 04:07:02.2425 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1039f12a-7642-4c66-3cff-08de3933e77a X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0002992D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7584 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1765512472266158500 Content-Type: text/plain; charset="utf-8" Arch-specific domain_set_time_offset() is responisble for XEN_DOMCTL_settimeoffset domctl-op, and shall be wrapped with CONFIG_MGMT_HYPERCALLS. Otherwise it will become unreachable when MGMT_HYPERCALLS=3Dn, and hence violating Misra rule 2.1. Signed-off-by: Penny Zheng Reviewed-by: Stefano Stabellini Acked-by: Jan Beulich # x86 --- v1 -> v2: - adapt to changes of "unify DOMCTL to MGMT_HYPERCALLS" - wrap XEN_DOMCTL_settimeoffset-case transiently --- v2 -> v3: - add back stub wrapping for riscv - address "violating Misra rule 2.1" in commit message - remove transient wrapping around XEN_DOMCTL_settimeoffset-case --- xen/arch/arm/time.c | 2 ++ xen/arch/riscv/stubs.c | 2 ++ xen/arch/x86/time.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c index 3710eab109..a40b233f9d 100644 --- a/xen/arch/arm/time.c +++ b/xen/arch/arm/time.c @@ -378,12 +378,14 @@ void force_update_vcpu_system_time(struct vcpu *v) update_vcpu_system_time(v); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS void domain_set_time_offset(struct domain *d, int64_t time_offset_seconds) { d->time_offset.seconds =3D time_offset_seconds; d->time_offset.set =3D true; /* XXX update guest visible wallclock time */ } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static int cpu_time_callback(struct notifier_block *nfb, unsigned long action, diff --git a/xen/arch/riscv/stubs.c b/xen/arch/riscv/stubs.c index c2e6af2c43..a8a0b4156a 100644 --- a/xen/arch/riscv/stubs.c +++ b/xen/arch/riscv/stubs.c @@ -31,10 +31,12 @@ void send_timer_event(struct vcpu *v) BUG_ON("unimplemented"); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS void domain_set_time_offset(struct domain *d, int64_t time_offset_seconds) { BUG_ON("unimplemented"); } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 /* domctl.c */ =20 diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index ece9ae0b34..8ba2dd9395 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -1841,6 +1841,7 @@ static void update_domain_rtc(void) rcu_read_unlock(&domlist_read_lock); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS void domain_set_time_offset(struct domain *d, int64_t time_offset_seconds) { d->time_offset.seconds =3D time_offset_seconds; @@ -1849,6 +1850,7 @@ void domain_set_time_offset(struct domain *d, int64_t= time_offset_seconds) rtc_update_clock(d); update_domain_wallclock_time(d); } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 int cpu_frequency_change(u64 freq) { --=20 2.34.1 From nobody Sun Dec 14 05:55:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1765512465; cv=pass; d=zohomail.com; s=zohoarc; b=NUdZnv5N2LP1HNlQHuGaepZhpXFCWNCOnvX6XyMgMXFdSHCdD6pSj75IxKRnje0uVYJ24j7yPeVrhr92Il4p2u5wU2z71MRa4G/VV0e1aFw7VEdJaRl+4RtEuFz2NSGb4q80WjX269SG1XdxdVTJarrP+LjVbKc0lDofh3oVTxo= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765512465; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=AaFTmwwa+bCWw5fIRu939ZdZxVXEUY/bAtUkbevuahw=; b=KZIpzM93jDWTYiOfRYepNswRzGy+gewkIEO0rS7B00Rvn04Rr1yiYY84wreYjp/nt3o3b2u2v0lFJ8nVpGkZ+tgGWAXeiKENQmFqLS2shKMM8lO5UVMFu+tuabPJhU5lfEGrcs/N177KOBg1BPg7TG1i/fn6Hjoilp3ECXRSvCs= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1765512465591430.3667369351449; Thu, 11 Dec 2025 20:07:45 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1184930.1507272 (Exim 4.92) (envelope-from ) id 1vTuR5-0003TA-1Z; Fri, 12 Dec 2025 04:07:19 +0000 Received: by outflank-mailman (output) from mailman id 1184930.1507272; Fri, 12 Dec 2025 04:07:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vTuR4-0003Sn-Ub; Fri, 12 Dec 2025 04:07:18 +0000 Received: by outflank-mailman (input) for mailman id 1184930; Fri, 12 Dec 2025 04:07:18 +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 1vTuQv-0007Dl-HN for xen-devel@lists.xenproject.org; Fri, 12 Dec 2025 04:07:09 +0000 Received: from CH5PR02CU005.outbound.protection.outlook.com (mail-northcentralusazlp170120005.outbound.protection.outlook.com [2a01:111:f403:c105::5]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 0694f9dc-d710-11f0-b15b-2bf370ae4941; Fri, 12 Dec 2025 05:07:08 +0100 (CET) Received: from BL6PEPF00013E03.NAMP222.PROD.OUTLOOK.COM (2603:10b6:22e:400:0:1001:0:1b) by DS0PR12MB7581.namprd12.prod.outlook.com (2603:10b6:8:13d::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.9; Fri, 12 Dec 2025 04:07:05 +0000 Received: from BL02EPF0002992D.namprd02.prod.outlook.com (2a01:111:f403:f901::7) by BL6PEPF00013E03.outlook.office365.com (2603:1036:903:4::4) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9412.6 via Frontend Transport; Fri, 12 Dec 2025 04:07:04 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by BL02EPF0002992D.mail.protection.outlook.com (10.167.249.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.4 via Frontend Transport; Fri, 12 Dec 2025 04:07:04 +0000 Received: from penny-System-Product-Name.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Thu, 11 Dec 2025 22:07:00 -0600 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: 0694f9dc-d710-11f0-b15b-2bf370ae4941 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NZ+qB7M/0kWyDnqtMp+52AMOynrx+ou5I1Zrye/gf3TSsbMZxigs5fz9koZ0zHFZo3Bq7X03OjSOLAbF/9eVNtvyI3u3vwBbGyarFOZxZtR210i0HoLZWnDRnALl07qWI4c0RosbtVIFnbNrGQgC91zt1Sb2LR4w7aX4OQg86V+G+E5NImj9lrZPamNN0CnE9aEB/bH6rsZs45IPaZBthhMwxwQqxGPERfiO9Hh2T963+5ICZ8Lrv5BuAYGWfNja1A5B78HgDn0FWigwmGU1BnnjGcZ8fEUXhhWrH73TvRA+XV/NJH/xP1ftsKY1YttL+PT1RWHqCJdviXK3yWy0AA== 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=AaFTmwwa+bCWw5fIRu939ZdZxVXEUY/bAtUkbevuahw=; b=wtHiJYXoADm4R7IdCDEJYLlTmYiw2xUAMcRhVJ9DBLDwO2/AS+lXO2rzIpQmk4a/iITXzsJLuyHoMoF2WLikBzTSZhfdtjZJpyX9Wijw31baYwWis+FK4K4kx6HsRIWGfLKdnFUcIJvGvKH0Jb24MH4Tt/RiujWkXsu8hqn40Y5CgteBs4LTlvyr/OB/RqcZZKQdWUDWhMJD+eqRsrMUp43KYcJcGKD4GnEvH56PbgbHSjumuPMr7IXAZcPZzMnDV+gQPTFdjbyeaEEVSaPwUPMxZUwD31TeZR+vn9FTX90O2IMgzg0Rpw1y1C7UOPNbCKvjQIE6EoYL8uG/ihF0Hg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AaFTmwwa+bCWw5fIRu939ZdZxVXEUY/bAtUkbevuahw=; b=4jHXxCbanqOsIC7IqIEYm/3iayFMDKZDB0WfdhFF0RnQsg3RJoK1pUgkDqexMNlnRBqjMQVlncRPHdxbyXsXysjUHwtajzKpTTXCVf1N4zx3RaI08uLY2twz6B5tOwMVzyGLeUwCh8JbYxRrx911HxRBaOyA50BBO82lwbb90PE= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; 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; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C From: Penny Zheng To: CC: , , Penny Zheng , "Daniel P. Smith" Subject: [PATCH v5 14/24] xen/domctl: wrap xsm_set_target() with CONFIG_MGMT_HYPERCALLS Date: Fri, 12 Dec 2025 12:01:59 +0800 Message-ID: <20251212040209.1970553-15-Penny.Zheng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251212040209.1970553-1-Penny.Zheng@amd.com> References: <20251212040209.1970553-1-Penny.Zheng@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0002992D:EE_|DS0PR12MB7581:EE_ X-MS-Office365-Filtering-Correlation-Id: a7ab0564-45bc-4511-0d69-08de3933e90d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?iiNG/nOgPcMeRolsMbGR+XbiDHx/ywyWcVxO4YBwi+hHf/0AEXyiEvDxA/l8?= =?us-ascii?Q?g42hb0UPIkvcjFnprJetbFj5QJCl9nCK8x9k4Ygn0sUCIjCUn0whCZM4Jn0x?= =?us-ascii?Q?w8zoMfTNoMpRCZ2XJvvr+K52sZ4vkg9ebl0QJZAhyGpqLcJpn5XiqoUcPXss?= =?us-ascii?Q?j3OfN01Wc8xriCk6C+ja03UTCd8UNl4NZif+CfPvFkka0vSVK41T1aUum7Nv?= =?us-ascii?Q?3SHB4c107khKBukiewkG8ltWs5yt0irNGSSsixr7bSur+Ipl2/IIpPoAXUcv?= =?us-ascii?Q?tYwSY3EX9jAvV1AgPIp1UU8Z7KbAyTmtbrRzG/wO2Sk5UDStRCQAFF1Z88ia?= =?us-ascii?Q?a+ECMbLPrEiIG8t69d8Jbf4RdNFwBwsgz/g/b192zAedcFS78qpjFv2208+L?= =?us-ascii?Q?Pmn3y8FPdlmLoOt/PuMnBmzNu+1MAnAabKqZla3FD7pIzcusYM4FIt5aNLoj?= =?us-ascii?Q?OI+MolcZYB5FpKnP8ttRtLLTm7ZOOB55J8zg8dgYEY/s4fMLCc8VInBW3j4+?= =?us-ascii?Q?s2gdmE/gqYjb8FTMBFrUq5j7+k265czLo7te9S/n/3NRRzdDuXziCPxx+kj8?= =?us-ascii?Q?Byd7mCmPj6kCaBQvPyz/frESWohOasf3xS2/wpo8t3NxqKfzDBRKCaeHGmkg?= =?us-ascii?Q?1pUxyyYnvTI8DWZlE7zwjgpvj/eE18o+8AWqq3ZeKhlmdMmUXSH0AhhJoRc5?= =?us-ascii?Q?XbtJgsOT9kThPTU1miuoSdJxmgXs2SOCkqA7JdguSysa8PJyK4ZSwLVnLwjJ?= =?us-ascii?Q?D12kRFOiYT8w43pVovgOnpiphEnnSdA+GfN8AargJYVY4PONFH2lmhneqYhg?= =?us-ascii?Q?CnnlhyRmn5dEUWl60+zkyMkEybN0JmiZEDtxwGQSz9LyFndqGx4zfP3dTh/U?= =?us-ascii?Q?nNA2aRjaxj7I4NAJILEyz+e0CpD5R6muh3N8oe3Ma7l6nZeNHRVGfMgwljd9?= =?us-ascii?Q?90KvITKCs/pycLMg1xRXcmoiRGtC82Fsogsfi5J5JQFXO2aAO8TydvGJwayO?= =?us-ascii?Q?MoQslAxQ/Dl4iTyQcWP2B/1un6Dgv/Sv3AGQ9FKWsZDeAj3TrZFj6i0t8aTg?= =?us-ascii?Q?N3CLNz+iOUfrImFMMWFOsfyT4R8KauQc/9vIed7keATpPvniH3T5S4KgjIiv?= =?us-ascii?Q?bA3jQVjWii/9p0/ttql4VO8VSiVUrbY0k/ZBo79Oe9lqETkk69Cl0vZzP8TM?= =?us-ascii?Q?Sj1Dvx1goA7ljGwNEpfi7JeSleYi2CT/E+Z1GOdzCRmmoUvfn+fr3SIdas0H?= =?us-ascii?Q?rjxwnbthh/HGulEsPTNvTpP8C28RlLFU+SKAet3jSS2hnym5I0P7sl6HQVu/?= =?us-ascii?Q?neYcWZez6P+UOuIDC0PCKANvzvYcAEjzgD/1L+556smsjr+dP34nJCXU0++S?= =?us-ascii?Q?rT+TiOobtD6yz5ihBzBr3qtK+CFRVvGMfgliu9jJ9VPGmFSQPVuV34QsIYfz?= =?us-ascii?Q?UQz9Mte5T7MG3UPbdDm4+nTf3au4lgEiXzTbCg6CIpMuzIQLyDhwzUEArMq5?= =?us-ascii?Q?FGa5rMM4kh43Q0hWz1vzOdSlGsoPXIg+UpAMW+Lwx8TolncgWSJp31vVVDMz?= =?us-ascii?Q?0QtSayxMxkX91/fk3DQ=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(1800799024)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2025 04:07:04.8831 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a7ab0564-45bc-4511-0d69-08de3933e90d X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0002992D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7581 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1765512466224158500 Content-Type: text/plain; charset="utf-8" Function xsm_set_target() is only invoked under XEN_DOMCTL_set_target domctl-op, and shall be wrapped with CONFIG_MGMT_HYPERCALLS. Otherwise it will become unreachable codes when MGMT_HYPERCALLS=3Dn, and hence violat= ing Misra 2.1. Signed-off-by: Penny Zheng --- v1 -> v2: - adapt to changes of "unify DOMCTL to MGMT_HYPERCALLS" --- v2 -> v3 - wrap the whole inline function xsm_set_target() - add missing wrapping in xsm/dummy.h - address "violating Misra rule 2.1" in commit message --- xen/include/xsm/dummy.h | 2 ++ xen/include/xsm/xsm.h | 4 +++- xen/xsm/dummy.c | 2 +- xen/xsm/flask/hooks.c | 4 ++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h index 535de82f62..92291ac9e5 100644 --- a/xen/include/xsm/dummy.h +++ b/xen/include/xsm/dummy.h @@ -158,12 +158,14 @@ static XSM_INLINE int cf_check xsm_sysctl_scheduler_o= p(XSM_DEFAULT_ARG int cmd) } #endif /* CONFIG_MGMT_HYPERCALLS */ =20 +#ifdef CONFIG_MGMT_HYPERCALLS static XSM_INLINE int cf_check xsm_set_target( XSM_DEFAULT_ARG struct domain *d, struct domain *e) { XSM_ASSERT_ACTION(XSM_HOOK); return xsm_default_action(action, current->domain, NULL); } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static XSM_INLINE int cf_check xsm_domctl( XSM_DEFAULT_ARG struct domain *d, unsigned int cmd, uint32_t ssidref) diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h index 786cfd7ac4..b76eb22429 100644 --- a/xen/include/xsm/xsm.h +++ b/xen/include/xsm/xsm.h @@ -59,8 +59,8 @@ struct xsm_ops { #ifdef CONFIG_MGMT_HYPERCALLS int (*domctl_scheduler_op)(struct domain *d, int op); int (*sysctl_scheduler_op)(int op); -#endif int (*set_target)(struct domain *d, struct domain *e); +#endif int (*domctl)(struct domain *d, unsigned int cmd, uint32_t ssidref); #ifdef CONFIG_MGMT_HYPERCALLS int (*sysctl)(int cmd); @@ -257,11 +257,13 @@ static inline int xsm_sysctl_scheduler_op(xsm_default= _t def, int cmd) } #endif =20 +#ifdef CONFIG_MGMT_HYPERCALLS static inline int xsm_set_target( xsm_default_t def, struct domain *d, struct domain *e) { return alternative_call(xsm_ops.set_target, d, e); } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static inline int xsm_domctl(xsm_default_t def, struct domain *d, unsigned int cmd, uint32_t ssidref) diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c index b216894579..f6986dd2bb 100644 --- a/xen/xsm/dummy.c +++ b/xen/xsm/dummy.c @@ -21,8 +21,8 @@ static const struct xsm_ops __initconst_cf_clobber dummy_= ops =3D { #ifdef CONFIG_MGMT_HYPERCALLS .domctl_scheduler_op =3D xsm_domctl_scheduler_op, .sysctl_scheduler_op =3D xsm_sysctl_scheduler_op, -#endif .set_target =3D xsm_set_target, +#endif .domctl =3D xsm_domctl, #ifdef CONFIG_MGMT_HYPERCALLS .sysctl =3D xsm_sysctl, diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c index d480009142..9c1298697c 100644 --- a/xen/xsm/flask/hooks.c +++ b/xen/xsm/flask/hooks.c @@ -641,7 +641,6 @@ static int cf_check flask_sysctl_scheduler_op(int op) return avc_unknown_permission("sysctl_scheduler_op", op); } } -#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static int cf_check flask_set_target(struct domain *d, struct domain *t) { @@ -666,6 +665,7 @@ static int cf_check flask_set_target(struct domain *d, = struct domain *t) &dsec->target_sid); return rc; } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static int cf_check flask_domctl(struct domain *d, unsigned int cmd, uint32_t ssidref) @@ -1888,8 +1888,8 @@ static const struct xsm_ops __initconst_cf_clobber fl= ask_ops =3D { #ifdef CONFIG_MGMT_HYPERCALLS .domctl_scheduler_op =3D flask_domctl_scheduler_op, .sysctl_scheduler_op =3D flask_sysctl_scheduler_op, -#endif .set_target =3D flask_set_target, +#endif .domctl =3D flask_domctl, #ifdef CONFIG_MGMT_HYPERCALLS .sysctl =3D flask_sysctl, --=20 2.34.1 From nobody Sun Dec 14 05:55:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1765512467; cv=pass; d=zohomail.com; s=zohoarc; b=Q6GniFy41DM1AqK1kjRxvnGzJ4T9E8GpcLmCmd5VC9iGG0rIlnnHq+XSZ4u2lnziVxnlVmVU6gd91cGh8+qhRbJfO/zIIZVY+ckpNglVEWaV5BrKLka6/MGUkRSrB9uf2YLSx0ZaN2KsIlGt2PVCg6t8EaZk4QcRGZTF/kK52PQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765512467; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=xmIanaYhA7lDAz9D81o3iTrsQ8uyDXNxse6wMqaVzko=; b=RsowClr9QCmhC/JEWjsnSRJBkmwcQxWT0xDyteYkvNzT5zW02OzA4MFkaM/Ok6r/oEPEeXTvuQh+0MqYu6KPfChzb5CRjHfYfatnby0EzJll8soL5LxtEvUnR3EvzHqHUfQINgMii70RershLbgSB20WsVuMGjH8p7jiYonhLwI= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1765512467563607.1081661468921; Thu, 11 Dec 2025 20:07:47 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1184955.1507322 (Exim 4.92) (envelope-from ) id 1vTuRC-0005Ai-9i; Fri, 12 Dec 2025 04:07:26 +0000 Received: by outflank-mailman (output) from mailman id 1184955.1507322; Fri, 12 Dec 2025 04:07:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vTuRC-00059Q-36; Fri, 12 Dec 2025 04:07:26 +0000 Received: by outflank-mailman (input) for mailman id 1184955; Fri, 12 Dec 2025 04:07:24 +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 1vTuR1-0007SS-S2 for xen-devel@lists.xenproject.org; Fri, 12 Dec 2025 04:07:15 +0000 Received: from CH1PR05CU001.outbound.protection.outlook.com (mail-northcentralusazlp170100001.outbound.protection.outlook.com [2a01:111:f403:c105::1]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 09083059-d710-11f0-9cce-f158ae23cfc8; Fri, 12 Dec 2025 05:07:12 +0100 (CET) Received: from BL6PEPF00013DF6.NAMP222.PROD.OUTLOOK.COM (2603:10b6:22e:400:0:1001:0:a) by SN7PR12MB8817.namprd12.prod.outlook.com (2603:10b6:806:347::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.8; Fri, 12 Dec 2025 04:07:05 +0000 Received: from BL02EPF0002992D.namprd02.prod.outlook.com (2a01:111:f403:f901::7) by BL6PEPF00013DF6.outlook.office365.com (2603:1036:903:4::4) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9412.9 via Frontend Transport; Fri, 12 Dec 2025 04:07:05 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by BL02EPF0002992D.mail.protection.outlook.com (10.167.249.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.4 via Frontend Transport; Fri, 12 Dec 2025 04:07:05 +0000 Received: from penny-System-Product-Name.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Thu, 11 Dec 2025 22:07:02 -0600 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: 09083059-d710-11f0-9cce-f158ae23cfc8 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cSwyoK6vazECKfMyXZQGuDC8+bn0B4xzcPRjoXZfQw9L3nOZToKxM7KXmpuLC9bCHE6QqWDk1+NKScTXoAKPiWqgQdm8P1pnsaPoiFjcQIoK7c1f5do0AXKa3VQfqrPHGMeS2AxSOXTbEwKBFrHrzWI5Il4khX+VAXE5dGgfZJ8xyB3BgCmpoVOhzD98mmBTnE/DvzgDZKejs35i7hQHDFeKVzB/EnfU1vDg6iQBcbfpRBeClSjNWy1KIddBvx340ycqWnqGltj3Byuiql0DMgjIIjSE+yM4LxPINcHIk127wm2m5unOksbX2IfhSaomYEuGgvW+cSxfo0Bh7EsHSw== 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=xmIanaYhA7lDAz9D81o3iTrsQ8uyDXNxse6wMqaVzko=; b=o+bWDfhxjXEqIHWbMahNQ7M9b6CLibDZZ5zI0gO3k80JsKmHzQ+kVxyJM1Bua7VVjn74apTBzUUsC+KDC9G11FsGMqTAMWeDNrwvypd/PZyszJk56POBu4mW24D6SXhPZwDL4VRFUvk01VixBfndse6SsQl78Ijzh5MYWFXmXv78uFHTnMNCyb2/aVvwR6UIykg+fqSbPbrAkQZTooMOMuzpM9q/baym8pTpxDiA5Pza464RW6pl7GwxD9+TubuvlaXUhWQD9KP/WXk6Q9EJNB8hlmHn51xUWIK9kNi/C2AtAwpq8uoPzbBP+e5xo5UJqouUpIOCFd6RX9rErvOlrQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xmIanaYhA7lDAz9D81o3iTrsQ8uyDXNxse6wMqaVzko=; b=Dvv5OaP55+WM7ZMnpMz6QgFeXM5xnVnh9Vg6BgM5CUps8KNdj5NTwqUSC2cQgwbV6Pb8ZcmFvN+08B6iq3K400B5DnkHXBci6r+oJqqxmFSf9kdcb8133faWdiEDJqMvVysGRBdyyf7cmLryF3ykzxWXUwkghZbjB6KWqa4EIW0= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; 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; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C From: Penny Zheng To: CC: , , Penny Zheng , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Jason Andryuk , "Daniel P. Smith" Subject: [PATCH v5 15/24] xen/domctl: wrap pci-subset iommu-related domctl op with CONFIG_MGMT_HYPERCALLS Date: Fri, 12 Dec 2025 12:02:00 +0800 Message-ID: <20251212040209.1970553-16-Penny.Zheng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251212040209.1970553-1-Penny.Zheng@amd.com> References: <20251212040209.1970553-1-Penny.Zheng@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0002992D:EE_|SN7PR12MB8817:EE_ X-MS-Office365-Filtering-Correlation-Id: e734c53d-e29d-4e7a-cd37-08de3933e947 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?/uQVslx0txzvGNuWuq0JWftz3WmeCtox+1jBeK384hLA+smeI4SABYyAc9PE?= =?us-ascii?Q?YHLnv1MkDYfxGz+WF81ADQD1qTEO5Zmj4dhT9K04H91PalkM2KXX/u9DHCMC?= =?us-ascii?Q?LgIBZ8q9OWEIDjuGUqghoElbYJv20MmfBP+ZADaWCbd9zcdvkKfYnJgaZixM?= =?us-ascii?Q?J6N2QaY4KlO+xnorkRzQ4uutUIHPn0fA0pYTSrRR1ORjViqFqH/r7Uunv4H2?= =?us-ascii?Q?eY9nsywhmxFOa4aOcXKP/d1QlQNCzIAlN/h5yO8qMJm8iKo/ngTOeotfiZX0?= =?us-ascii?Q?TVnaKKwsQ5p8IHUGlPlVueL92iBgOE1oF3eu38METRuTKOZ/6AJAN5VbNBBf?= =?us-ascii?Q?TXWMzoCZBflcye0WWsKf+Gdkrp5iopCXyF4u5Bde79fkBQ92hJZHh0oSZVIe?= =?us-ascii?Q?3ogQbC5zxmqUWGQbvF5oGUTzQWUg5NAZXQ9xVW+OfCt38zRjBkBWwYNhEgU8?= =?us-ascii?Q?tLMbRWVW9ILHvk91UlhBR4JV+kgfF9SEaOciPMKe5zGV/ZQhKvykYXl6GPSh?= =?us-ascii?Q?6PxgG0FfXUGMOiL/Qfu0Jwh+vJpTKQ5NWLE01klO1kOmM6XQNrs7p1R+ZTqf?= =?us-ascii?Q?hU2Ja+BMcEgaYe3tALxXF/i9ze8+TnqmqOraMhR0vJKJToGNCzVIMIj4j1hf?= =?us-ascii?Q?AfmkDdI0eGzsYZIKkwdjzQnpliI7kom56qETgZP6D6ctdakWgiuarsHEy1wf?= =?us-ascii?Q?EcYz4ts2wu2t0tvcvCeTLIGKLvXEF/zrAEDfud5HzkOwoSlYJEn4xoHGgXjO?= =?us-ascii?Q?EGrmJ0XEAffAlGH2c18SWtHLkLsAJczUvj0bxwShV1udqpSBv3wL42loMau7?= =?us-ascii?Q?y9+W71o5Exa5yhY4AHGyhCeFB5+ahQVmbUcRUy71n3myte2VqR4eQ8KIlgnj?= =?us-ascii?Q?iztcbQAK1fMLwoZSx/q0PP1iPZyCkCwfqGLk0WW8BZO0wOo9hPpPkW/k0fE/?= =?us-ascii?Q?khh/NcJ7n0SiWZnsi5K/M5REVX9FmCCcNIbCkv51043PKfnpvVlg4WYgescY?= =?us-ascii?Q?P4pBj8m2P2shNxqANdZ4SbT0g4EGp/1OGVZsggf+/yQ5amX/FEkRI7TM7Vx0?= =?us-ascii?Q?953VWwwBvWsSXLORLL8CYXlUmErfO9TnS/gXqCPfS7WeJvKUXeCsNaIXTAwm?= =?us-ascii?Q?8BUpQWof0Y7h/na3sxzbeJxEaJIXtWW7WwRkJA0cKA1cgO/n4z6rDxaUFtir?= =?us-ascii?Q?lrF3Nkm3WW20gIWGTcxontNQxHw77IAHntTsKKj7HWRVMLXEPa+IaSNyHF6+?= =?us-ascii?Q?tCYRWtdtNliwdMOleNmz4qA74TAF8TfUgPkWf3wv4mHLxYl64z66wlMzamhp?= =?us-ascii?Q?oiOT0lB87WrwtRFd0AY0+UQc1wR7oRm93atAw7i4IIrCD0F71POt9IM+8LTu?= =?us-ascii?Q?zZWv9P5Qj8g/ygBXQASwkcHk4G8AvN7R/nmat/mIijRrw0hZB2E4Tvz/xudg?= =?us-ascii?Q?WM1DXKOQq/K4+v2V9N6qUvldf/SVmGeyuJpnfZbazmcLTn10cjBGB2B8S6TT?= =?us-ascii?Q?2Qn4/IvwuAWCi3bBn/bKt8iwquJfyh66xM4/LXBwYsBGEVwSfeyP5zfqrlit?= =?us-ascii?Q?yK2WpBaVvS5cEzrfVrM=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(82310400026)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2025 04:07:05.2674 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e734c53d-e29d-4e7a-cd37-08de3933e947 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0002992D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8817 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1765512468300158500 Content-Type: text/plain; charset="utf-8" Function iommu_do_pci_domctl() is the main entry for pci-subset iommu-related domctl-op, and shall be wrapped with CONFIG_MGMT_HYPERCALLS. Tracking its calling chain, the following functions shall all be wrapped with CONFIG_MGMT_HYPERCALLS: - iommu_do_pci_domctl - iommu_get_device_group - xsm_get_device_group - iommu_ops.get_device_group_id - amd_iommu_group_id/intel_iommu_group_id - device_assigned - xsm_assign_device - assign_device - iommu_ops.assign_device - intel_iommu_assign_device/amd_iommu_assign_device - xsm_deassign_device - deassign_device - iommu_ops.reassign_device - reassign_device_ownership/reassign_device Otherwise all the functions will become unreachable when MGMT_HYPERCALLS=3D= n, and hence violating Misra rule 2.1 The PCI-part in ARM, (regarding codes under HAS_PCI), will be taken care of later when guarding PCI_PASSTHROUGH with MGMT_HYPERCALLS, as the Kconfig select chain in ARM is as follows: HAS_VPCI_GUEST_SUPPORT if PCI_PASSTHROUGH -> HAS_VPCI -> HAS_PCI So making PCI_PASSTHROUGH depend on MGMT_HYPERCALLS will recursively leading HAS_PCI depend on MGMT_HYPERCALLS too in ARM. Signed-off-by: Penny Zheng --- v1 -> v2: - adapt to changes of "unify DOMCTL to MGMT_HYPERCALLS" - wrap XEN_DOMCTL_assign_device{test_assign_device,deassign_device, get_device_group}-case transiently --- v2 -> v3: - make PCI_PASSTHROUGH(, then HAS_VPCI_GUEST_SUPPORT) depend on MGMT_HYPERC= ALLS - add wrapping for iommu_remove_dt_device/iommu_dt_device_is_assigned_locke= d/ arm_smmu_detach_dev/arm_smmu_domain_remove_master - fold commit "xen/xsm: wrap xsm-iommu-related functions with CONFIG_MGMT_HYPERCALLS" in - fix overly long #ifdef - add missing wrapping in xsm/dummy.h - address "violating Misra rule 2.1" in commit message - remove transient wrapping of XEN_DOMCTL_assign_device{test_assign_device,deassign_device,get_device_grou= p}-case --- v3 -> v4: - move codes to wrap with a single #ifdef - split into PCI related subset and DT subset --- v4 -> v5: - Hook .get_device_group_id should be properly dealt with in xen/iommu.h right away - Add description for how PCI-part will be dealt in ARM --- xen/drivers/passthrough/amd/pci_amd_iommu.c | 20 ++++---- xen/drivers/passthrough/pci.c | 52 +++++++++++---------- xen/drivers/passthrough/vtd/iommu.c | 6 ++- xen/include/xen/iommu.h | 2 + xen/include/xsm/dummy.h | 6 ++- xen/include/xsm/xsm.h | 12 +++-- xen/xsm/dummy.c | 6 ++- xen/xsm/flask/hooks.c | 12 +++-- 8 files changed, 70 insertions(+), 46 deletions(-) diff --git a/xen/drivers/passthrough/amd/pci_amd_iommu.c b/xen/drivers/pass= through/amd/pci_amd_iommu.c index 3a14770855..576b36af92 100644 --- a/xen/drivers/passthrough/amd/pci_amd_iommu.c +++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c @@ -461,6 +461,7 @@ static void amd_iommu_disable_domain_device(const struc= t domain *domain, spin_unlock_irqrestore(&iommu->lock, flags); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS static int cf_check reassign_device( struct domain *source, struct domain *target, u8 devfn, struct pci_dev *pdev) @@ -551,6 +552,14 @@ static int cf_check amd_iommu_assign_device( return rc; } =20 +static int cf_check amd_iommu_group_id(u16 seg, u8 bus, u8 devfn) +{ + unsigned int bdf =3D PCI_BDF(bus, devfn); + + return (bdf < ivrs_bdf_entries) ? get_dma_requestor_id(seg, bdf) : bdf; +} +#endif /* CONFIG_MGMT_HYPERCALLS */ + static void cf_check amd_iommu_clear_root_pgtable(struct domain *d) { struct domain_iommu *hd =3D dom_iommu(d); @@ -698,13 +707,6 @@ static int cf_check amd_iommu_remove_device(u8 devfn, = struct pci_dev *pdev) return 0; } =20 -static int cf_check amd_iommu_group_id(u16 seg, u8 bus, u8 devfn) -{ - unsigned int bdf =3D PCI_BDF(bus, devfn); - - return (bdf < ivrs_bdf_entries) ? get_dma_requestor_id(seg, bdf) : bdf; -} - #include =20 static void amd_dump_page_table_level(struct page_info *pg, int level, @@ -772,14 +774,16 @@ static const struct iommu_ops __initconst_cf_clobber = _iommu_ops =3D { .quarantine_init =3D amd_iommu_quarantine_init, .add_device =3D amd_iommu_add_device, .remove_device =3D amd_iommu_remove_device, - .assign_device =3D amd_iommu_assign_device, .teardown =3D amd_iommu_domain_destroy, .clear_root_pgtable =3D amd_iommu_clear_root_pgtable, .map_page =3D amd_iommu_map_page, .unmap_page =3D amd_iommu_unmap_page, .iotlb_flush =3D amd_iommu_flush_iotlb_pages, +#ifdef CONFIG_MGMT_HYPERCALLS + .assign_device =3D amd_iommu_assign_device, .reassign_device =3D reassign_device, .get_device_group_id =3D amd_iommu_group_id, +#endif .enable_x2apic =3D iov_enable_xt, .update_ire_from_apic =3D amd_iommu_ioapic_update_ire, .update_ire_from_msi =3D amd_iommu_msi_msg_update_ire, diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c index 422e45f5a6..8ab229bfe7 100644 --- a/xen/drivers/passthrough/pci.c +++ b/xen/drivers/passthrough/pci.c @@ -878,6 +878,7 @@ int pci_remove_device(u16 seg, u8 bus, u8 devfn) return ret; } =20 +#ifdef CONFIG_MGMT_HYPERCALLS /* Caller should hold the pcidevs_lock */ static int deassign_device(struct domain *d, uint16_t seg, uint8_t bus, uint8_t devfn) @@ -946,7 +947,6 @@ static int deassign_device(struct domain *d, uint16_t s= eg, uint8_t bus, return ret; } =20 -#ifdef CONFIG_MGMT_HYPERCALLS int pci_release_devices(struct domain *d) { int combined_ret; @@ -1484,6 +1484,7 @@ static int iommu_remove_device(struct pci_dev *pdev) return iommu_call(hd->platform_ops, remove_device, devfn, pci_to_dev(p= dev)); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS static int device_assigned(u16 seg, u8 bus, u8 devfn) { struct pci_dev *pdev; @@ -1648,30 +1649,6 @@ static int iommu_get_device_group( return i; } =20 -void iommu_dev_iotlb_flush_timeout(struct domain *d, struct pci_dev *pdev) -{ - pcidevs_lock(); - - disable_ats_device(pdev); - - ASSERT(pdev->domain); - if ( d !=3D pdev->domain ) - { - pcidevs_unlock(); - return; - } - - pdev->broken =3D true; - - if ( !d->is_shutting_down && printk_ratelimit() ) - printk(XENLOG_ERR "dom%d: ATS device %pp flush failed\n", - d->domain_id, &pdev->sbdf); - if ( !is_hardware_domain(d) ) - domain_crash(d); - - pcidevs_unlock(); -} - int iommu_do_pci_domctl( struct xen_domctl *domctl, struct domain *d, XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) @@ -1805,6 +1782,31 @@ int iommu_do_pci_domctl( =20 return ret; } +#endif /* CONFIG_MGMT_HYPERCALLS */ + +void iommu_dev_iotlb_flush_timeout(struct domain *d, struct pci_dev *pdev) +{ + pcidevs_lock(); + + disable_ats_device(pdev); + + ASSERT(pdev->domain); + if ( d !=3D pdev->domain ) + { + pcidevs_unlock(); + return; + } + + pdev->broken =3D true; + + if ( !d->is_shutting_down && printk_ratelimit() ) + printk(XENLOG_ERR "dom%d: ATS device %pp flush failed\n", + d->domain_id, &pdev->sbdf); + if ( !is_hardware_domain(d) ) + domain_crash(d); + + pcidevs_unlock(); +} =20 struct segment_iter { int (*handler)(struct pci_dev *pdev, void *arg); diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/= vtd/iommu.c index 90f36ac22b..ad2e657bca 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -2742,6 +2742,7 @@ static int __init cf_check vtd_setup(void) return ret; } =20 +#ifdef CONFIG_MGMT_HYPERCALLS static int cf_check reassign_device_ownership( struct domain *source, struct domain *target, @@ -2937,6 +2938,7 @@ static int cf_check intel_iommu_group_id(u16 seg, u8 = bus, u8 devfn) =20 return PCI_BDF(bus, devfn); } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static int __must_check cf_check vtd_suspend(void) { @@ -3245,14 +3247,16 @@ static const struct iommu_ops __initconst_cf_clobbe= r vtd_ops =3D { .add_device =3D intel_iommu_add_device, .enable_device =3D intel_iommu_enable_device, .remove_device =3D intel_iommu_remove_device, - .assign_device =3D intel_iommu_assign_device, .teardown =3D iommu_domain_teardown, .clear_root_pgtable =3D iommu_clear_root_pgtable, .map_page =3D intel_iommu_map_page, .unmap_page =3D intel_iommu_unmap_page, .lookup_page =3D intel_iommu_lookup_page, +#ifdef CONFIG_MGMT_HYPERCALLS + .assign_device =3D intel_iommu_assign_device, .reassign_device =3D reassign_device_ownership, .get_device_group_id =3D intel_iommu_group_id, +#endif .enable_x2apic =3D intel_iommu_enable_eim, .disable_x2apic =3D intel_iommu_disable_eim, .update_ire_from_apic =3D io_apic_write_remap_rte, diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h index 37c4a1dc82..6ca4190eb9 100644 --- a/xen/include/xen/iommu.h +++ b/xen/include/xen/iommu.h @@ -333,9 +333,11 @@ struct iommu_ops { uint32_t flag); int (*reassign_device)(struct domain *s, struct domain *t, uint8_t devfn, device_t *dev); +#ifdef CONFIG_MGMT_HYPERCALLS #ifdef CONFIG_HAS_PCI int (*get_device_group_id)(uint16_t seg, uint8_t bus, uint8_t devfn); #endif /* HAS_PCI */ +#endif /* MGMT_HYPERCALLS */ =20 void (*teardown)(struct domain *d); =20 diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h index 92291ac9e5..07d69e3725 100644 --- a/xen/include/xsm/dummy.h +++ b/xen/include/xsm/dummy.h @@ -407,7 +407,8 @@ static XSM_INLINE int cf_check xsm_get_vnumainfo( return xsm_default_action(action, current->domain, d); } =20 -#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_PCI) +#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_MGMT_HYPERCALLS) +#ifdef CONFIG_HAS_PCI static XSM_INLINE int cf_check xsm_get_device_group( XSM_DEFAULT_ARG uint32_t machine_bdf) { @@ -429,7 +430,8 @@ static XSM_INLINE int cf_check xsm_deassign_device( return xsm_default_action(action, current->domain, d); } =20 -#endif /* HAS_PASSTHROUGH && HAS_PCI */ +#endif /* CONFIG_HAS_PCI */ +#endif /* HAS_PASSTHROUGH && MGMT_HYPERCALLS */ =20 #if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_DEVICE_TREE_DISC= OVERY) static XSM_INLINE int cf_check xsm_assign_dtdevice( diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h index b76eb22429..b331e81f9d 100644 --- a/xen/include/xsm/xsm.h +++ b/xen/include/xsm/xsm.h @@ -125,11 +125,13 @@ struct xsm_ops { int (*pci_config_permission)(struct domain *d, uint32_t machine_bdf, uint16_t start, uint16_t end, uint8_t acc= ess); =20 -#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_PCI) +#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_MGMT_HYPERCALLS) +#ifdef CONFIG_HAS_PCI int (*get_device_group)(uint32_t machine_bdf); int (*assign_device)(struct domain *d, uint32_t machine_bdf); int (*deassign_device)(struct domain *d, uint32_t machine_bdf); -#endif +#endif /* CONFIG_HAS_PCI */ +#endif /* HAS_PASSTHROUGH && MGMT_HYPERCALLS */ =20 #if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_DEVICE_TREE_DISC= OVERY) int (*assign_dtdevice)(struct domain *d, const char *dtpath); @@ -532,7 +534,8 @@ static inline int xsm_pci_config_permission( return alternative_call(xsm_ops.pci_config_permission, d, machine_bdf,= start, end, access); } =20 -#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_PCI) +#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_MGMT_HYPERCALLS) +#ifdef CONFIG_HAS_PCI static inline int xsm_get_device_group(xsm_default_t def, uint32_t machine= _bdf) { return alternative_call(xsm_ops.get_device_group, machine_bdf); @@ -549,7 +552,8 @@ static inline int xsm_deassign_device( { return alternative_call(xsm_ops.deassign_device, d, machine_bdf); } -#endif /* HAS_PASSTHROUGH && HAS_PCI) */ +#endif /* CONFIG_HAS_PCI */ +#endif /* HAS_PASSTHROUGH && MGMT_HYPERCALLS */ =20 #if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_DEVICE_TREE_DISC= OVERY) static inline int xsm_assign_dtdevice( diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c index f6986dd2bb..c693e77a7d 100644 --- a/xen/xsm/dummy.c +++ b/xen/xsm/dummy.c @@ -81,11 +81,13 @@ static const struct xsm_ops __initconst_cf_clobber dumm= y_ops =3D { .pci_config_permission =3D xsm_pci_config_permission, .get_vnumainfo =3D xsm_get_vnumainfo, =20 -#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_PCI) +#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_MGMT_HYPERCALLS) +#ifdef CONFIG_HAS_PCI .get_device_group =3D xsm_get_device_group, .assign_device =3D xsm_assign_device, .deassign_device =3D xsm_deassign_device, -#endif +#endif /* CONFIG_HAS_PCI */ +#endif /* HAS_PASSTHROUGH && MGMT_HYPERCALLS */ =20 #if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_DEVICE_TREE_DISC= OVERY) .assign_dtdevice =3D xsm_assign_dtdevice, diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c index 9c1298697c..c772f79e16 100644 --- a/xen/xsm/flask/hooks.c +++ b/xen/xsm/flask/hooks.c @@ -1388,7 +1388,8 @@ static int cf_check flask_mem_sharing(struct domain *= d) } #endif =20 -#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_PCI) +#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_MGMT_HYPERCALLS) +#ifdef CONFIG_HAS_PCI static int cf_check flask_get_device_group(uint32_t machine_bdf) { uint32_t rsid; @@ -1459,7 +1460,8 @@ static int cf_check flask_deassign_device( =20 return avc_current_has_perm(rsid, SECCLASS_RESOURCE, RESOURCE__REMOVE_= DEVICE, NULL); } -#endif /* HAS_PASSTHROUGH && HAS_PCI */ +#endif /* CONFIG_HAS_PCI */ +#endif /* HAS_PASSTHROUGH && MGMT_HYPERCALLS */ =20 #if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_DEVICE_TREE_DISC= OVERY) static int flask_test_assign_dtdevice(const char *dtpath) @@ -1988,11 +1990,13 @@ static const struct xsm_ops __initconst_cf_clobber = flask_ops =3D { .remove_from_physmap =3D flask_remove_from_physmap, .map_gmfn_foreign =3D flask_map_gmfn_foreign, =20 -#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_PCI) +#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_MGMT_HYPERCALLS) +#ifdef CONFIG_HAS_PCI .get_device_group =3D flask_get_device_group, .assign_device =3D flask_assign_device, .deassign_device =3D flask_deassign_device, -#endif +#endif /* CONFIG_HAS_PCI */ +#endif /* HAS_PASSTHROUGH && MGMT_HYPERCALLS */ =20 #if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_DEVICE_TREE_DISC= OVERY) .assign_dtdevice =3D flask_assign_dtdevice, --=20 2.34.1 From nobody Sun Dec 14 05:55:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1765512462; cv=pass; d=zohomail.com; s=zohoarc; b=JCFMeWK9o8dQpCXhy5tqriL5fCYa558FYNE4W3hyxcua/1l/1erKlr+9RxCsYIxcdxtDmsl/i01tez6jKCEyFl+wvjv5FvJxoOYXscVNajhWuIl+oKpxcHgbo2E5gTHZx0MwaFej5rs1z5xWW2M6RSx+ZAOWjBe2HcfIPKO4LEE= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765512462; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=cNBo7HSAOiqoWr9Mm1NZh1/tC7tfzjVGKDQZ3VmVKG8=; b=Wuvc7axqWQfgw6d60qcmL13O/L6bxWUDF5znQGj9wUYelN+aG1oVXXr6DBsbzShdhqvNUALBGjN7Jkq4xtFWFWXdOHal9QXNIMe72U3FHk8QkAKbwHCbI1Ue+kkqa32dDHHEU4tFQstMbMl+5/iC6oBYVfGUeItq3+vrj5WP+2M= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1765512462860626.232024248098; Thu, 11 Dec 2025 20:07:42 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1184936.1507296 (Exim 4.92) (envelope-from ) id 1vTuR7-00042R-23; Fri, 12 Dec 2025 04:07:21 +0000 Received: by outflank-mailman (output) from mailman id 1184936.1507296; Fri, 12 Dec 2025 04:07:21 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vTuR6-00040M-Tf; Fri, 12 Dec 2025 04:07:20 +0000 Received: by outflank-mailman (input) for mailman id 1184936; Fri, 12 Dec 2025 04:07:18 +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 1vTuR3-0007Dl-Hn for xen-devel@lists.xenproject.org; Fri, 12 Dec 2025 04:07:17 +0000 Received: from SN4PR0501CU005.outbound.protection.outlook.com (mail-southcentralusazlp170110003.outbound.protection.outlook.com [2a01:111:f403:c10d::3]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 0a16e5a8-d710-11f0-b15b-2bf370ae4941; Fri, 12 Dec 2025 05:07:15 +0100 (CET) Received: from MN2PR18CA0028.namprd18.prod.outlook.com (2603:10b6:208:23c::33) by LV2PR12MB5967.namprd12.prod.outlook.com (2603:10b6:408:170::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.10; Fri, 12 Dec 2025 04:07:08 +0000 Received: from BL02EPF0002992B.namprd02.prod.outlook.com (2603:10b6:208:23c:cafe::cd) by MN2PR18CA0028.outlook.office365.com (2603:10b6:208:23c::33) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9388.16 via Frontend Transport; Fri, 12 Dec 2025 04:06:26 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by BL02EPF0002992B.mail.protection.outlook.com (10.167.249.56) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.4 via Frontend Transport; Fri, 12 Dec 2025 04:07:08 +0000 Received: from penny-System-Product-Name.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Thu, 11 Dec 2025 22:07:04 -0600 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: 0a16e5a8-d710-11f0-b15b-2bf370ae4941 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gsNyCEzohz8CMJNuL4TOZkuIiofjscEIcwtI5iziUnUXi8D4x95qvGyd5M8J3VMoBiQXmia/cQ4S4MeRD7r8HluNQ5opTUgX1LK3jB9xvfIICBcHAljLefZp2j5gEKHxBhgkJ/u55Gs+fRM6YYh13LTsGE4XvuzL2UL183c8/ec4MMzafJcaZV0YgBqxrlGvg1pZkcbsBahlS5Xk1eir2LCNDrOeabkLjrE2uetiC1H35/qkX+j65kXn1TnFPDOoaU3e6P8M715+4w1TgFRS3dzELWSk+4q3XjByWNp0bfnytmqPVZ2cdT7SrK8Qri/HwpAFA4heqqaXLC8RztakYA== 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=cNBo7HSAOiqoWr9Mm1NZh1/tC7tfzjVGKDQZ3VmVKG8=; b=bMrTH1W+vNCL0oR3vOw7g0f80gqUhDIE0KS7oGzOOnbSrLDjrr6IV6jxro8GmepPID3+1ByHaWpLOT3FKQDV2sy08vRYe7VVQf0MBrxfrrhiqh3N0PS+hToa2pPhbMqhX4ASxDXvD1+o/ErgXyR0dhuGTdyyh0yP21Z3dGHtkTxnnkTQgUiwvMxIHy+tItLK59nhm2lnPdBJtHIYOJ/0MkesBfkq3O66/0JOPqrHfEeR2sJVafc7NeUXNj0c8MkNrQqHLFYRjODNJN22hGMPz5StKcoc8p+/s6/OPrPt9VYA32C/x7Z6AYqU/Y/6wbYU9Feu69gswe3L7SRj6VLrSw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cNBo7HSAOiqoWr9Mm1NZh1/tC7tfzjVGKDQZ3VmVKG8=; b=aARwx1DW+p38jQJvCTMnMb+TKB6+7okiUek6yMJFp1TqQs6GJ7rdCXl3sbObPS8Rsph/ufMQDf5l8L2JYZ4FKdoR3hixliBAVkDz5lqA4CHVMURhH0XS4wu+zyQZIfLJFviRM7EEDQ24VBW+1JGxxqnSnLpnF1uX5UyPP4nmFZQ= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; 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; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C From: Penny Zheng To: CC: , , Penny Zheng , Stefano Stabellini , "Julien Grall" , Bertrand Marquis , "Michal Orzel" , Volodymyr Babchuk , Rahul Singh , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , "Daniel P. Smith" Subject: [PATCH v5 16/24] xen/domctl: wrap device-tree-subset iommu-related domctl op with CONFIG_MGMT_HYPERCALLS Date: Fri, 12 Dec 2025 12:02:01 +0800 Message-ID: <20251212040209.1970553-17-Penny.Zheng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251212040209.1970553-1-Penny.Zheng@amd.com> References: <20251212040209.1970553-1-Penny.Zheng@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0002992B:EE_|LV2PR12MB5967:EE_ X-MS-Office365-Filtering-Correlation-Id: 4a1d4b4d-448c-459b-8195-08de3933eaf0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|82310400026|7416014|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?5lGE+8orBaQ8sgNMHsWNFAbX0o0vp8qN6cWsynigwHhj9v7oAvw90N4sC51C?= =?us-ascii?Q?f6Yh/MOHkZmCCuppwAyciunQa+AU2ui5BoU8zqYhLsbAhrRFjLdW7JWt04yA?= =?us-ascii?Q?YnDf6L+ULYde3kJR8aM5FXhGyei3xFr8fbqaC7zIRa3BAu0Ts3BvYCNg8XSy?= =?us-ascii?Q?XoqSKBnwZ9Y/rH9k+1yWpmo15+JFicxrOsa7ll0J5zVRxb/otNwV3WIgptQr?= =?us-ascii?Q?lgMWdc15APjre0KLmY7kJchLwwBkwln/UQ5Wn1Czk7PsHe6DHiWQP+oPDaYv?= =?us-ascii?Q?PC108mVHWSo6tJFjCnLkpxdOXmz64Wt04VKt3rBJQ+636nZYZKb4w+q9y6bH?= =?us-ascii?Q?h3lRwrMTQD3KSDiuGFGKhOJuUZHzxYo8S93nzsqc09W/wyi2Mz151AcR3zeK?= =?us-ascii?Q?mIy7Aar7cmkBbwvyQsPnvX/UNrvB08rrFdFGVdb5RTZWl4rKIo0z+CiLeG8E?= =?us-ascii?Q?gq2jEfdAXcqP4HO1/ajIH2T5tzDeaZpd5l0kPD+wdgl8ZKm8wY2PikY+czfT?= =?us-ascii?Q?7NLY/lh4sRFDUMIyE8+/H0axdEGBTh+4YE5aXtgxrspTd2pHhRjMqoKxPQuf?= =?us-ascii?Q?Y2O2XGkRqdvsXfEqoyMGkWgjSSkOaFNL8dQlVCKX+mlzU16h8GYl2V4GurEf?= =?us-ascii?Q?3CcXfKGIGbkcPzl46p5vyyDBKt1MGlcZ8hoHZyv/66JZtosYBcFyosjATRlm?= =?us-ascii?Q?dHbuqWJNZQHtqxAfPOcXN3c63XmU67erZtVf3PURn+DpyTLakiTn0V7uI92x?= =?us-ascii?Q?jbNpGs6Pa3Ath8Km7qDV9UWQ9DiPcp1U5VLFHiUk/Ms/YRXu5DEMBG0Vrs09?= =?us-ascii?Q?0pS8ueLY7P6AaWrAjIn2JjMvx76Lpcl4k3ZPdP3Q52wKVfclnsM9ZSMFjNJw?= =?us-ascii?Q?07z7FDJdW/0m+SrQMEklrciXyiujIPuBWMI3138Uf7cZ9yqb2uGe2keHo/JH?= =?us-ascii?Q?oj8J2CpvUMiT76DB65DU+thDqGefBHjGmioFBxMymnoeJbAZtVrkyVJmtoNb?= =?us-ascii?Q?G5y7wmOs3DvIvbOrNiLGFjBq7G13k0kl3G8TZ6FuXAsVbjtS3ZolKzMN6h39?= =?us-ascii?Q?MjF5jwG0QDbErKywc3WDx/f0nPPSXndWhRx5DJCOaVrph9hsM138YINjdzlL?= =?us-ascii?Q?pEd1m0hj1fvktZq4UwoMW0kUYC4RyYkEMcQSLkFkb9DLnXYRRCxWmiUrUNV5?= =?us-ascii?Q?n+ueCM8AbRklt0+0mWVxmutcM0LX/VWhEgjwE90NuqLbOTf03L5W5E6vxLo9?= =?us-ascii?Q?hTZqAjAfHFl7CrE+iQhg/0ZccDynduPsam1NsVyTHyVK16KdYhek0xUb/WwA?= =?us-ascii?Q?2o9PUxU7wDIm4Imjzwk9LJXU/UAAN3mmPE5ptsdc/Ox+YgJDnfmADGBJdUe+?= =?us-ascii?Q?RNn0X6KSqGRCd06OJoEPdYpAHsja2OiulBykR8sPRyL70RrsjOlDBGewQSvZ?= =?us-ascii?Q?nbMN3xMijA7tMLOxxEZxRIB7iyjMrYL5fiT39uTkRIKlnQYwa1rK590CuXaa?= =?us-ascii?Q?yOWCN0+S7MxYtqAAGIk+Awio79HhRjEQWGxuxOZjn0M0c+tbML86b9VWGG08?= =?us-ascii?Q?FR6fk6glZNC228aMzGs=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(376014)(82310400026)(7416014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2025 04:07:08.0565 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4a1d4b4d-448c-459b-8195-08de3933eaf0 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0002992B.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR12MB5967 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1765512464328158500 Content-Type: text/plain; charset="utf-8" Function iommu_do_dt_domctl() is the main entry for all device-tree-subset iommu-related domctl-op, and shall be wrapped with CONFIG_MGMT_HYPERCALLS. Tracking its calling chain, the following functions shall all be wrapped with CONFIG_MGMT_HYPERCALLS: - make PCI_PASSTHROUGH depend on MGMT_HYPERCALLS - iommu_do_dt_domctl - xsm_assign_dtdevice - xsm_deassign_dtdevice - iommu_deassign_dt_device - arm_smmu_reassign_dev - arm_smmu_deassign_dev - arm_smmu_detach_dev - arm_smmu_domain_remove_master - ipmmu_reassign_device - ipmmu_deassign_device - ipmmu_detach_device - iommu_remove_dt_device - iommu_dt_device_is_assigned_locked - dt_find_node_by_gpath Otherwise all the functions will become unreachable when MGMT_HYPERCALLS=3D= n, and hence violating Misra rule 2.1 Move codes closer to avoid scattering #ifdef Signed-off-by: Penny Zheng Acked-by: Jan Beulich --- v3 -> v4 - split into PCI related subset and DT subset - Move codes closer to avoid scattering #ifdef --- v4 -> v5: - wrap arm_smmu_deassign_dev() declaration with MGMT_HYPERCALLS - zap the hooks in xen/iommu.h right away --- xen/arch/arm/Kconfig | 2 +- xen/drivers/passthrough/arm/ipmmu-vmsa.c | 26 +++--- xen/drivers/passthrough/arm/smmu-v3.c | 6 ++ xen/drivers/passthrough/arm/smmu.c | 55 ++++++------ xen/drivers/passthrough/device_tree.c | 108 ++++++++++++----------- xen/include/xen/iommu.h | 2 +- xen/include/xsm/dummy.h | 6 +- xen/include/xsm/xsm.h | 12 +-- xen/xsm/dummy.c | 6 +- xen/xsm/flask/hooks.c | 12 +-- 10 files changed, 127 insertions(+), 108 deletions(-) diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index cf6af68299..5a5d7810c8 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -270,7 +270,7 @@ source "arch/arm/firmware/Kconfig" =20 config PCI_PASSTHROUGH bool "PCI passthrough" if EXPERT - depends on ARM_64 && HAS_PASSTHROUGH + depends on ARM_64 && HAS_PASSTHROUGH && MGMT_HYPERCALLS help This option enables PCI device passthrough =20 diff --git a/xen/drivers/passthrough/arm/ipmmu-vmsa.c b/xen/drivers/passthr= ough/arm/ipmmu-vmsa.c index ea9fa9ddf3..b1fc14bc32 100644 --- a/xen/drivers/passthrough/arm/ipmmu-vmsa.c +++ b/xen/drivers/passthrough/arm/ipmmu-vmsa.c @@ -739,16 +739,6 @@ static int ipmmu_attach_device(struct ipmmu_vmsa_domai= n *domain, return 0; } =20 -static void ipmmu_detach_device(struct ipmmu_vmsa_domain *domain, - struct device *dev) -{ - struct iommu_fwspec *fwspec =3D dev_iommu_fwspec_get(dev); - unsigned int i; - - for ( i =3D 0; i < fwspec->num_ids; ++i ) - ipmmu_utlb_disable(domain, fwspec->ids[i]); -} - static int ipmmu_init_platform_device(struct device *dev, const struct dt_phandle_args *args) { @@ -1138,7 +1128,9 @@ static void ipmmu_free_root_domain(struct ipmmu_vmsa_= domain *domain) xfree(domain); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS static int ipmmu_deassign_device(struct domain *d, struct device *dev); +#endif =20 static int ipmmu_assign_device(struct domain *d, u8 devfn, struct device *= dev, uint32_t flag) @@ -1254,6 +1246,17 @@ out: return ret; } =20 +#ifdef CONFIG_MGMT_HYPERCALLS +static void ipmmu_detach_device(struct ipmmu_vmsa_domain *domain, + struct device *dev) +{ + struct iommu_fwspec *fwspec =3D dev_iommu_fwspec_get(dev); + unsigned int i; + + for ( i =3D 0; i < fwspec->num_ids; ++i ) + ipmmu_utlb_disable(domain, fwspec->ids[i]); +} + static int ipmmu_deassign_device(struct domain *d, struct device *dev) { struct ipmmu_vmsa_xen_domain *xen_domain =3D dom_iommu(d)->arch.priv; @@ -1309,6 +1312,7 @@ static int ipmmu_reassign_device(struct domain *s, st= ruct domain *t, =20 return 0; } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static int ipmmu_dt_xlate(struct device *dev, const struct dt_phandle_args *spec) @@ -1487,7 +1491,9 @@ static const struct iommu_ops ipmmu_iommu_ops =3D .teardown =3D ipmmu_iommu_domain_teardown, .iotlb_flush =3D ipmmu_iotlb_flush, .assign_device =3D ipmmu_assign_device, +#ifdef CONFIG_MGMT_HYPERCALLS .reassign_device =3D ipmmu_reassign_device, +#endif .map_page =3D arm_iommu_map_page, .unmap_page =3D arm_iommu_unmap_page, .dt_xlate =3D ipmmu_dt_xlate, diff --git a/xen/drivers/passthrough/arm/smmu-v3.c b/xen/drivers/passthroug= h/arm/smmu-v3.c index bf153227db..1d85341e72 100644 --- a/xen/drivers/passthrough/arm/smmu-v3.c +++ b/xen/drivers/passthrough/arm/smmu-v3.c @@ -1490,8 +1490,10 @@ static bool arm_smmu_sid_in_range(struct arm_smmu_de= vice *smmu, u32 sid) static struct arm_smmu_device *arm_smmu_get_by_dev(const struct device *de= v); static int arm_smmu_assign_dev(struct domain *d, u8 devfn, struct device *= dev, u32 flag); +#ifdef CONFIG_MGMT_HYPERCALLS static int arm_smmu_deassign_dev(struct domain *d, uint8_t devfn, struct device *dev); +#endif =20 static int arm_smmu_add_device(u8 devfn, struct device *dev) { @@ -2759,6 +2761,7 @@ out: return ret; } =20 +#ifdef CONFIG_MGMT_HYPERCALLS static int arm_smmu_deassign_dev(struct domain *d, uint8_t devfn, struct d= evice *dev) { struct iommu_domain *io_domain =3D arm_smmu_get_domain(d, dev); @@ -2826,6 +2829,7 @@ static int arm_smmu_reassign_dev(struct domain *s, st= ruct domain *t, =20 return 0; } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static int arm_smmu_iommu_xen_domain_init(struct domain *d) { @@ -2862,7 +2866,9 @@ static const struct iommu_ops arm_smmu_iommu_ops =3D { .teardown =3D arm_smmu_iommu_xen_domain_teardown, .iotlb_flush =3D arm_smmu_iotlb_flush, .assign_device =3D arm_smmu_assign_dev, +#ifdef CONFIG_MGMT_HYPERCALLS .reassign_device =3D arm_smmu_reassign_dev, +#endif .map_page =3D arm_iommu_map_page, .unmap_page =3D arm_iommu_unmap_page, .dt_xlate =3D arm_smmu_dt_xlate, diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/a= rm/smmu.c index 22d306d0cb..a75ec08633 100644 --- a/xen/drivers/passthrough/arm/smmu.c +++ b/xen/drivers/passthrough/arm/smmu.c @@ -894,8 +894,10 @@ static int register_smmu_master(struct arm_smmu_device= *smmu, /* Forward declaration */ static int arm_smmu_assign_dev(struct domain *d, u8 devfn, struct device *dev, u32 flag); +#ifdef CONFIG_MGMT_HYPERCALLS static int arm_smmu_deassign_dev(struct domain *d, uint8_t devfn, struct device *dev); +#endif =20 /* * The driver which supports generic IOMMU DT bindings must have this @@ -1699,21 +1701,6 @@ static int arm_smmu_domain_add_master(struct arm_smm= u_domain *smmu_domain, return 0; } =20 -static void arm_smmu_domain_remove_master( - const struct arm_smmu_domain *smmu_domain, - struct arm_smmu_master_cfg *cfg) -{ - uint32_t i, idx; - struct arm_smmu_device *smmu =3D smmu_domain->smmu; - struct arm_smmu_s2cr *s2cr =3D smmu->s2crs; - const struct iommu_fwspec *fwspec =3D arm_smmu_get_fwspec(cfg); - - for_each_cfg_sme(cfg, i, idx, fwspec->num_ids) { - s2cr[idx] =3D s2cr_init_val; - arm_smmu_write_s2cr(smmu, idx); - } -} - static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device = *dev) { int ret; @@ -1761,16 +1748,6 @@ static int arm_smmu_attach_dev(struct iommu_domain *= domain, struct device *dev) return arm_smmu_domain_add_master(smmu_domain, cfg); } =20 -static void arm_smmu_detach_dev(struct iommu_domain *domain, struct device= *dev) -{ - struct arm_smmu_domain *smmu_domain =3D domain->priv; - struct arm_smmu_master_cfg *cfg =3D find_smmu_master_cfg(dev); - - if (cfg) - arm_smmu_domain_remove_master(smmu_domain, cfg); - -} - #if 0 /* * Xen: The page table is shared with the processor, therefore * helpers to implement separate is not necessary. @@ -2849,6 +2826,31 @@ out: return ret; } =20 +#ifdef CONFIG_MGMT_HYPERCALLS +static void arm_smmu_domain_remove_master( + const struct arm_smmu_domain *smmu_domain, + struct arm_smmu_master_cfg *cfg) +{ + uint32_t i, idx; + struct arm_smmu_device *smmu =3D smmu_domain->smmu; + struct arm_smmu_s2cr *s2cr =3D smmu->s2crs; + const struct iommu_fwspec *fwspec =3D arm_smmu_get_fwspec(cfg); + + for_each_cfg_sme(cfg, i, idx, fwspec->num_ids) { + s2cr[idx] =3D s2cr_init_val; + arm_smmu_write_s2cr(smmu, idx); + } +} + +static void arm_smmu_detach_dev(struct iommu_domain *domain, struct device= *dev) +{ + struct arm_smmu_domain *smmu_domain =3D domain->priv; + struct arm_smmu_master_cfg *cfg =3D find_smmu_master_cfg(dev); + + if (cfg) + arm_smmu_domain_remove_master(smmu_domain, cfg); + +} static int arm_smmu_deassign_dev(struct domain *d, uint8_t devfn, struct device *dev) { @@ -2918,6 +2920,7 @@ static int arm_smmu_reassign_dev(struct domain *s, st= ruct domain *t, =20 return 0; } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static int arm_smmu_iommu_domain_init(struct domain *d) { @@ -2956,7 +2959,9 @@ static const struct iommu_ops arm_smmu_iommu_ops =3D { .teardown =3D arm_smmu_iommu_domain_teardown, .iotlb_flush =3D arm_smmu_iotlb_flush, .assign_device =3D arm_smmu_assign_dev, +#ifdef CONFIG_MGMT_HYPERCALLS .reassign_device =3D arm_smmu_reassign_dev, +#endif .map_page =3D arm_iommu_map_page, .unmap_page =3D arm_iommu_unmap_page, .dt_xlate =3D arm_smmu_dt_xlate_generic, diff --git a/xen/drivers/passthrough/device_tree.c b/xen/drivers/passthroug= h/device_tree.c index bdbae0f8bf..bcc4f44a71 100644 --- a/xen/drivers/passthrough/device_tree.c +++ b/xen/drivers/passthrough/device_tree.c @@ -60,6 +60,14 @@ fail: return rc; } =20 +int iommu_dt_domain_init(struct domain *d) +{ + INIT_LIST_HEAD(&dom_iommu(d)->dt_devices); + + return 0; +} + +#ifdef CONFIG_MGMT_HYPERCALLS int iommu_deassign_dt_device(struct domain *d, struct dt_device_node *dev) { const struct domain_iommu *hd =3D dom_iommu(d); @@ -102,14 +110,6 @@ static bool iommu_dt_device_is_assigned_locked(const s= truct dt_device_node *dev) return assigned; } =20 -int iommu_dt_domain_init(struct domain *d) -{ - INIT_LIST_HEAD(&dom_iommu(d)->dt_devices); - - return 0; -} - -#ifdef CONFIG_MGMT_HYPERCALLS int iommu_release_dt_devices(struct domain *d) { const struct domain_iommu *hd =3D dom_iommu(d); @@ -213,51 +213,6 @@ int iommu_add_dt_pci_sideband_ids(struct pci_dev *pdev) } #endif /* CONFIG_HAS_PCI */ =20 -int iommu_remove_dt_device(struct dt_device_node *np) -{ - const struct iommu_ops *ops =3D iommu_get_ops(); - struct device *dev =3D dt_to_dev(np); - int rc; - - ASSERT(rw_is_locked(&dt_host_lock)); - - if ( !iommu_enabled ) - return 1; - - if ( !ops ) - return -EOPNOTSUPP; - - spin_lock(&dtdevs_lock); - - if ( iommu_dt_device_is_assigned_locked(np) ) - { - rc =3D -EBUSY; - goto fail; - } - - if ( !ops->remove_device ) - { - rc =3D -EOPNOTSUPP; - goto fail; - } - - /* - * De-register the device from the IOMMU driver. - * The driver is responsible for removing is_protected flag. - */ - rc =3D ops->remove_device(0, dev); - - if ( !rc ) - { - ASSERT(!dt_device_is_protected(np)); - iommu_fwspec_free(dev); - } - - fail: - spin_unlock(&dtdevs_lock); - return rc; -} - int iommu_add_dt_device(struct dt_device_node *np) { const struct iommu_ops *ops =3D iommu_get_ops(); @@ -321,6 +276,52 @@ int iommu_add_dt_device(struct dt_device_node *np) return rc; } =20 +#ifdef CONFIG_MGMT_HYPERCALLS +int iommu_remove_dt_device(struct dt_device_node *np) +{ + const struct iommu_ops *ops =3D iommu_get_ops(); + struct device *dev =3D dt_to_dev(np); + int rc; + + ASSERT(rw_is_locked(&dt_host_lock)); + + if ( !iommu_enabled ) + return 1; + + if ( !ops ) + return -EOPNOTSUPP; + + spin_lock(&dtdevs_lock); + + if ( iommu_dt_device_is_assigned_locked(np) ) + { + rc =3D -EBUSY; + goto fail; + } + + if ( !ops->remove_device ) + { + rc =3D -EOPNOTSUPP; + goto fail; + } + + /* + * De-register the device from the IOMMU driver. + * The driver is responsible for removing is_protected flag. + */ + rc =3D ops->remove_device(0, dev); + + if ( !rc ) + { + ASSERT(!dt_device_is_protected(np)); + iommu_fwspec_free(dev); + } + + fail: + spin_unlock(&dtdevs_lock); + return rc; +} + /* * dt_find_node_by_gpath - Same as dt_find_node_by_path but retrieve the * path from the guest @@ -459,3 +460,4 @@ int iommu_do_dt_domctl(struct xen_domctl *domctl, struc= t domain *d, =20 return ret; } +#endif /* CONFIG_MGMT_HYPERCALLS */ diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h index 6ca4190eb9..e5e9f98201 100644 --- a/xen/include/xen/iommu.h +++ b/xen/include/xen/iommu.h @@ -331,9 +331,9 @@ struct iommu_ops { int (*remove_device)(uint8_t devfn, device_t *dev); int (*assign_device)(struct domain *d, uint8_t devfn, device_t *dev, uint32_t flag); +#ifdef CONFIG_MGMT_HYPERCALLS int (*reassign_device)(struct domain *s, struct domain *t, uint8_t devfn, device_t *dev); -#ifdef CONFIG_MGMT_HYPERCALLS #ifdef CONFIG_HAS_PCI int (*get_device_group_id)(uint16_t seg, uint8_t bus, uint8_t devfn); #endif /* HAS_PCI */ diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h index 07d69e3725..90fe741fb4 100644 --- a/xen/include/xsm/dummy.h +++ b/xen/include/xsm/dummy.h @@ -431,9 +431,8 @@ static XSM_INLINE int cf_check xsm_deassign_device( } =20 #endif /* CONFIG_HAS_PCI */ -#endif /* HAS_PASSTHROUGH && MGMT_HYPERCALLS */ =20 -#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_DEVICE_TREE_DISC= OVERY) +#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY static XSM_INLINE int cf_check xsm_assign_dtdevice( XSM_DEFAULT_ARG struct domain *d, const char *dtpath) { @@ -448,7 +447,8 @@ static XSM_INLINE int cf_check xsm_deassign_dtdevice( return xsm_default_action(action, current->domain, d); } =20 -#endif /* HAS_PASSTHROUGH && HAS_DEVICE_TREE_DISCOVERY */ +#endif /* CONFIG_HAS_DEVICE_TREE_DISCOVERY */ +#endif /* HAS_PASSTHROUGH && MGMT_HYPERCALLS */ =20 static XSM_INLINE int cf_check xsm_resource_plug_core(XSM_DEFAULT_VOID) { diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h index b331e81f9d..90349d02c2 100644 --- a/xen/include/xsm/xsm.h +++ b/xen/include/xsm/xsm.h @@ -131,12 +131,12 @@ struct xsm_ops { int (*assign_device)(struct domain *d, uint32_t machine_bdf); int (*deassign_device)(struct domain *d, uint32_t machine_bdf); #endif /* CONFIG_HAS_PCI */ -#endif /* HAS_PASSTHROUGH && MGMT_HYPERCALLS */ =20 -#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_DEVICE_TREE_DISC= OVERY) +#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY int (*assign_dtdevice)(struct domain *d, const char *dtpath); int (*deassign_dtdevice)(struct domain *d, const char *dtpath); -#endif +#endif /* CONFIG_HAS_DEVICE_TREE_DISCOVERY */ +#endif /* HAS_PASSTHROUGH && MGMT_HYPERCALLS */ =20 int (*resource_plug_core)(void); int (*resource_unplug_core)(void); @@ -553,9 +553,8 @@ static inline int xsm_deassign_device( return alternative_call(xsm_ops.deassign_device, d, machine_bdf); } #endif /* CONFIG_HAS_PCI */ -#endif /* HAS_PASSTHROUGH && MGMT_HYPERCALLS */ =20 -#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_DEVICE_TREE_DISC= OVERY) +#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY static inline int xsm_assign_dtdevice( xsm_default_t def, struct domain *d, const char *dtpath) { @@ -568,7 +567,8 @@ static inline int xsm_deassign_dtdevice( return alternative_call(xsm_ops.deassign_dtdevice, d, dtpath); } =20 -#endif /* HAS_PASSTHROUGH && HAS_DEVICE_TREE_DISCOVERY */ +#endif /* CONFIG_HAS_DEVICE_TREE_DISCOVERY */ +#endif /* HAS_PASSTHROUGH && MGMT_HYPERCALLS */ =20 static inline int xsm_resource_plug_pci(xsm_default_t def, uint32_t machin= e_bdf) { diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c index c693e77a7d..1ac4f719ad 100644 --- a/xen/xsm/dummy.c +++ b/xen/xsm/dummy.c @@ -87,12 +87,12 @@ static const struct xsm_ops __initconst_cf_clobber dumm= y_ops =3D { .assign_device =3D xsm_assign_device, .deassign_device =3D xsm_deassign_device, #endif /* CONFIG_HAS_PCI */ -#endif /* HAS_PASSTHROUGH && MGMT_HYPERCALLS */ =20 -#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_DEVICE_TREE_DISC= OVERY) +#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY .assign_dtdevice =3D xsm_assign_dtdevice, .deassign_dtdevice =3D xsm_deassign_dtdevice, -#endif +#endif /* CONFIG_HAS_DEVICE_TREE_DISCOVERY */ +#endif /* HAS_PASSTHROUGH && MGMT_HYPERCALLS */ =20 .resource_plug_core =3D xsm_resource_plug_core, .resource_unplug_core =3D xsm_resource_unplug_core, diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c index c772f79e16..9c800b574e 100644 --- a/xen/xsm/flask/hooks.c +++ b/xen/xsm/flask/hooks.c @@ -1461,9 +1461,8 @@ static int cf_check flask_deassign_device( return avc_current_has_perm(rsid, SECCLASS_RESOURCE, RESOURCE__REMOVE_= DEVICE, NULL); } #endif /* CONFIG_HAS_PCI */ -#endif /* HAS_PASSTHROUGH && MGMT_HYPERCALLS */ =20 -#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_DEVICE_TREE_DISC= OVERY) +#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY static int flask_test_assign_dtdevice(const char *dtpath) { uint32_t rsid; @@ -1524,7 +1523,8 @@ static int cf_check flask_deassign_dtdevice( return avc_current_has_perm(rsid, SECCLASS_RESOURCE, RESOURCE__REMOVE_= DEVICE, NULL); } -#endif /* HAS_PASSTHROUGH && HAS_DEVICE_TREE_DISCOVERY */ +#endif /* CONFIG_HAS_DEVICE_TREE_DISCOVERY */ +#endif /* HAS_PASSTHROUGH && MGMT_HYPERCALLS */ =20 static int cf_check flask_platform_op(uint32_t op) { @@ -1996,12 +1996,12 @@ static const struct xsm_ops __initconst_cf_clobber = flask_ops =3D { .assign_device =3D flask_assign_device, .deassign_device =3D flask_deassign_device, #endif /* CONFIG_HAS_PCI */ -#endif /* HAS_PASSTHROUGH && MGMT_HYPERCALLS */ =20 -#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_DEVICE_TREE_DISC= OVERY) +#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY .assign_dtdevice =3D flask_assign_dtdevice, .deassign_dtdevice =3D flask_deassign_dtdevice, -#endif +#endif /* CONFIG_HAS_DEVICE_TREE_DISCOVERY */ +#endif /* HAS_PASSTHROUGH && MGMT_HYPERCALLS */ =20 .platform_op =3D flask_platform_op, #ifdef CONFIG_X86 --=20 2.34.1 From nobody Sun Dec 14 05:55:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1765513320; cv=pass; d=zohomail.com; s=zohoarc; b=FDc6YjtuPB09ey9Eh7VnN1d8uhJwAwqwgEv5TG2cNQ2jHmWJuSw+nQ/dBbIabspQZDdc1+wxQ4tKnTuofUPN90OvCeA3b5uc5ER3LvUtEcs4HKvqiiGG2oIXefSxpgTTOLizQZj1vxAcg8k+12BON40WZDe38vy5OSAoK7ZDIGY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765513320; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=WGbm9eEkFpZ2F/oXAGCX6J/TUQbFlJ+O3rJBuFWng2A=; b=l5JR63eNNY3DR5c4M5KlkLQK+x0w7t9O9o+czjLAZMxuMND7XbCyOa/ygCHrvVW8qNG8SXXMr9lsGTIz0ZmqRCLo8WhX2+N3GNSz71b9316vMuAXM6vXIum8UfFNw3X8vKs6gE47DMNLTUk6COHDVrmAaaEJmH20fhjscRVawuQ= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1765513320906733.3263428013217; Thu, 11 Dec 2025 20:22:00 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1185128.1507412 (Exim 4.92) (envelope-from ) id 1vTuf0-00060p-5s; Fri, 12 Dec 2025 04:21:42 +0000 Received: by outflank-mailman (output) from mailman id 1185128.1507412; Fri, 12 Dec 2025 04:21:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vTuf0-00060h-2R; Fri, 12 Dec 2025 04:21:42 +0000 Received: by outflank-mailman (input) for mailman id 1185128; Fri, 12 Dec 2025 04:21:40 +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 1vTuR4-0007Dl-Hl for xen-devel@lists.xenproject.org; Fri, 12 Dec 2025 04:07:18 +0000 Received: from CY3PR05CU001.outbound.protection.outlook.com (mail-westcentralusazlp170130007.outbound.protection.outlook.com [2a01:111:f403:c112::7]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 0b4ef203-d710-11f0-b15b-2bf370ae4941; Fri, 12 Dec 2025 05:07:16 +0100 (CET) Received: from MN2PR03CA0023.namprd03.prod.outlook.com (2603:10b6:208:23a::28) by SJ2PR12MB7961.namprd12.prod.outlook.com (2603:10b6:a03:4c0::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.10; Fri, 12 Dec 2025 04:07:10 +0000 Received: from BL02EPF0002992C.namprd02.prod.outlook.com (2603:10b6:208:23a:cafe::4b) by MN2PR03CA0023.outlook.office365.com (2603:10b6:208:23a::28) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9388.16 via Frontend Transport; Fri, 12 Dec 2025 04:07:10 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by BL02EPF0002992C.mail.protection.outlook.com (10.167.249.57) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.4 via Frontend Transport; Fri, 12 Dec 2025 04:07:10 +0000 Received: from penny-System-Product-Name.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Thu, 11 Dec 2025 22:07:08 -0600 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: 0b4ef203-d710-11f0-b15b-2bf370ae4941 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Y22ncfmGuzHS5u8OlZfjFOS6MDtHiCpYOJWA5h/xwYeF7WiNNOTcZksDZqhy65fpUSTBYynpauHJpGUVWnCbugZxyzIo8n8P6E/wTMDrN9ledKND7M2KRTwSNWDBaJ2W3WNB+KNfznK91ILsB8EjOpp+MMo+trqH0iFQsiCRE9jMf+o6Ux5luUJCl4wGhHS88E1UE1P4v28PuI8i+m3uG1sCVI/AZR9SMZbQB9XxKN+vuYJ+s7SGHYIZHiKdmzmr4+nCiodKDGzEyj/WG8u6losT/DJxy6Nz48A6wf6DzepQ1gS6NivxeJjBoBzxHwr6HiIERXVc56OI+jzdAp2b/g== 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=WGbm9eEkFpZ2F/oXAGCX6J/TUQbFlJ+O3rJBuFWng2A=; b=yxmA6svWd6gpND2dDB8PdEZtJLjk5tTOrXHme7u30jzfRp7BV11LzLdUGpqCp4iJ16ripO/0NJUfE3MMjt2JUpKeuAz6r5Az5haki0Ixmim0riPAVRUoyIoCncQ9rHdFm+YaN6t/5CF56Yr2ijYTXTryocWfLYBYllPbcViY2dJITidQtj/KyZ3sLErVUQ4aInhLPNLHdKvjQoXgN5t2c7lEpGl/WSzucF+gH1yrPOnWBlchCIIOJAUNCnD2LXx8oPEniifJ3P0U0Rol+2J5gXwTkF98ZJ//pFPAGkjR+tMJXKBLvj+0tKjfFBlrjeOpk7GOEQ/NG1F80qDa5YjvXA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WGbm9eEkFpZ2F/oXAGCX6J/TUQbFlJ+O3rJBuFWng2A=; b=TfDnfCqzL2tSC6LO+uExolq1IFKjKrZNpiZIYlW8qXOith/5J2SqEyx0LA1Iq5/yR2Dn2hi11CzzAllWu0PH8gMFQtbKSuFT2Wi1FdH5h/y3T/OyzxZRJIBG69GYjJTJnsFJ8YrcrfsauaOnWEMK+Jffybh4mid+x+VqIzgN+C8= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; 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; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C From: Penny Zheng To: CC: , , Penny Zheng , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v5 17/24] xen/domctl: wrap iommu-related domctl op with CONFIG_MGMT_HYPERCALLS Date: Fri, 12 Dec 2025 12:02:02 +0800 Message-ID: <20251212040209.1970553-18-Penny.Zheng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251212040209.1970553-1-Penny.Zheng@amd.com> References: <20251212040209.1970553-1-Penny.Zheng@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0002992C:EE_|SJ2PR12MB7961:EE_ X-MS-Office365-Filtering-Correlation-Id: 1fa4527f-c77d-42f8-ee1a-08de3933ec1d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|36860700013|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?oLX0rDCLn7HgUiE8PVrwL+tHuKGUtebiKCfYJZdxH6ilD4jnk73DcSwiPb0Y?= =?us-ascii?Q?1jaetEhji6NWGwuygttMHNF60aJZOm/aEHPX0ti5E5DxXCD5d+4e9kF0D5zQ?= =?us-ascii?Q?7jYKrMwnKYeLpKmRn1S+Sa+L9yaGXECf0wHxEXd35FLuBZKJhq2ewq2tIVn0?= =?us-ascii?Q?mes2EuHibC//5gRVchXyovyOUgwMhpzM/tDYy7Ia7ExnZqsco9UWHbwkxwXf?= =?us-ascii?Q?GVBaRRm2bYVCFsw76Wnqk17wb0IqWCrLT+BbfsoakjDCF9Sf8D/sJjenNmkI?= =?us-ascii?Q?lW3g0UO56aLWO9A8GYO3SUP9CYdRZ0En51zhbRXKP/QVAkdbxLIyySXdkmm7?= =?us-ascii?Q?SskaKwK8izoJImeXfPls/IyEvmpcDF9ud4nmPI6XWskf5Ckz6KHx40BQqDtY?= =?us-ascii?Q?jzNVpfIMR32Xvu3iSFQBZ/2ScMub+gbfz0fDtjyTBw+qBkHkrxB6J0hvx/lM?= =?us-ascii?Q?+nxSXapJJJaaf4u3RMiuJT3TKhIzKTwZYmiW91PM/IO+H3H8KuhDHHv/VylM?= =?us-ascii?Q?WHunNKyk/fHinwUm/9cQiFmSGJ07u7qg0WqVK43ZOsTZCBAAz/DwRQtXh4Gb?= =?us-ascii?Q?uLvHlnxqcv/xf6YDNdGg3CmEkYYimHxT57gN9D/3nACYbXvXqsXnEVGm10fM?= =?us-ascii?Q?G3TcNEZD7kIm2dfQWPDbTAXAbxoMBBaHZ69nX8c127lwSqHdf9sg2qIR1vSl?= =?us-ascii?Q?KS914j3H+dKdlchyO8Uu8SL/K8lFauFOuetZhwFpUE8y8uG86Pjz/Riw16be?= =?us-ascii?Q?yKxSpfCQzlSZomRNF45IpQZqu490RrXYP16ngSm9bp926df/TPLhbxhve3Zw?= =?us-ascii?Q?uAi/oGSBacoLVQuhMz5Z0DLP3MzQY65f/dvhiEFTUMUEFcR/8+z/6gvQFfC0?= =?us-ascii?Q?hz9aTVCH4HDKfvB8KzeY7T9VvRuk1Nddi/N9A4DcIaJQR2Q/xQjnOqT7NFEE?= =?us-ascii?Q?ARqhJ4/vnd/Fm+ulupbbxkpkOoiMDDuEucIWbpOB+msy05LGNYLjf3mUoXY0?= =?us-ascii?Q?Z+/+qdUTVsHgldBzIf0O5lN5UsIsR/lSdrcftwvpKq+XamimOY4Euj8NArAz?= =?us-ascii?Q?sNOI8r/4QiH+y5JnYDnhqlmQ8jKf7dH1I4ay3cwppp9xU/EeEcm6J9XP9Ep1?= =?us-ascii?Q?TrEdaxGefePRz2S/PrZqDVraZszyNZhhoUYuCFc4VueKfchAkMD+7VGBDdqc?= =?us-ascii?Q?7GQL/RW58mF2g7gRIVYC4h2AZ5diPvEAJqSYcJLHdSZ6fjahM7/VIjcM0tb2?= =?us-ascii?Q?e6xZN5SaWCso/+tP+DVAmL80r4b7AfD5N+8g6fUm7+dIVM19FfAQ5G/oYsbx?= =?us-ascii?Q?9W8W8YPkZGcZOFuvDKnJCru4/rpDt2iax5nhyyM1uM3pbyIYT+PcWePgwAb/?= =?us-ascii?Q?AiR+VLh36zygqwsyu3Mu1gjhzcPA0giaj+oboM5PLAdAwhrrVXTJOA7DSMDi?= =?us-ascii?Q?07m4CwWqfNLN5mKLlc5s1T0ER1SA31R0JRk+bMzQXyFYcmp2Hnfzlc+TcLQy?= =?us-ascii?Q?l6Q+RNjYAxNih081WpJeJPQnXNZ+e1q2ygqbxweyfaQph423b1w7jKoWQGlL?= =?us-ascii?Q?iuaNOwN1FdMkpYeOiJQ=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(82310400026)(36860700013)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2025 04:07:10.0262 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1fa4527f-c77d-42f8-ee1a-08de3933ec1d X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0002992C.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB7961 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1765513321353158500 Content-Type: text/plain; charset="utf-8" Function iommu_do_domctl() is the main entry for all iommu-related domctl-o= p, and shall be wrapped with CONFIG_MGMT_HYPERCALLS. Otherwise it will become unreachable when MGMT_HYPERCALLS=3Dn, and hence violating Misra rule 2.1 Signed-off-by: Penny Zheng --- v3 -> v4: - new commit --- v4 -> v5: - fix typo --- xen/drivers/passthrough/iommu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iomm= u.c index c9425d6971..8812e38174 100644 --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -625,6 +625,7 @@ void iommu_resume(void) iommu_vcall(iommu_get_ops(), resume); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS int iommu_do_domctl( struct xen_domctl *domctl, struct domain *d, XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) @@ -645,6 +646,7 @@ int iommu_do_domctl( =20 return ret; } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 void iommu_crash_shutdown(void) { --=20 2.34.1 From nobody Sun Dec 14 05:55:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1765513097; cv=pass; d=zohomail.com; s=zohoarc; b=FrEFVLW4qQ1SXpVzeIT1zv+a4F5i1PzfbQinWHNytZKiaYvyEF+91RpUwqE+IwAbsktJ6f03cJSD3tFnrkA6wRTgGeUkEfyVnqVTiylVZONv2ulOB0fjjF3xy1jOUES0PsTPBf3x+iXko8VvkKP2zm/muqGF54A/QJNDcpcH6As= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765513097; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=KWivIiaybYPw5jJB/DQbmVNl+SgpVQga3F7RYOvVWbg=; b=MTjdV5rFDJygoDHKD0WqkgqVCNAFJRkPhLw9Ge+LR+nTx59zfMwxi2hSLM1Kn8Z0Wo8IkledeqCPcMElvJyrK+C8ET4Xtb2n2bxsFi77ia8Yaaw8g4mkAGmD9QstAqQKFJjRLPB0NhABFIziTJL33Z8DSqkThANiJ5AzYcM6VhE= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1765513097798318.0827160393135; Thu, 11 Dec 2025 20:18:17 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1185030.1507362 (Exim 4.92) (envelope-from ) id 1vTubU-0001su-HY; Fri, 12 Dec 2025 04:18:04 +0000 Received: by outflank-mailman (output) from mailman id 1185030.1507362; Fri, 12 Dec 2025 04:18: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 1vTubU-0001sn-Dg; Fri, 12 Dec 2025 04:18:04 +0000 Received: by outflank-mailman (input) for mailman id 1185030; Fri, 12 Dec 2025 04:18:03 +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 1vTuR5-0007SS-2S for xen-devel@lists.xenproject.org; Fri, 12 Dec 2025 04:07:19 +0000 Received: from CH1PR05CU001.outbound.protection.outlook.com (mail-northcentralusazlp170100001.outbound.protection.outlook.com [2a01:111:f403:c105::1]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 0bc92d6a-d710-11f0-9cce-f158ae23cfc8; Fri, 12 Dec 2025 05:07:17 +0100 (CET) Received: from MN2PR13CA0019.namprd13.prod.outlook.com (2603:10b6:208:160::32) by IA1PR12MB6433.namprd12.prod.outlook.com (2603:10b6:208:3af::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.11; Fri, 12 Dec 2025 04:07:13 +0000 Received: from BL02EPF0002992E.namprd02.prod.outlook.com (2603:10b6:208:160:cafe::3d) by MN2PR13CA0019.outlook.office365.com (2603:10b6:208:160::32) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9434.5 via Frontend Transport; Fri, 12 Dec 2025 04:07:12 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by BL02EPF0002992E.mail.protection.outlook.com (10.167.249.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.4 via Frontend Transport; Fri, 12 Dec 2025 04:07:13 +0000 Received: from penny-System-Product-Name.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Thu, 11 Dec 2025 22:07:10 -0600 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: 0bc92d6a-d710-11f0-9cce-f158ae23cfc8 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=l7LOjONY4qCNiahorfmtjP0XCQF6vZrEmf+CX1qJjQ2vkUdbSJrFFnvemCYLXyKUKCAXXsgr3ew401BZesTL+bmQcTSoimFmfjtp+XfAQwbN2hENL6N9T+2Y5H4YwWBmEZrQKRLaPeJivIwbaZcGDubX6EG+kB0+WT2MbzTdO6/65Ct+r9QJUoSY+rwD8TcWlRExbPudThQx+rHTg2ivqePYOeAeMPTUbH8rrg+VQ9ODBp32oGxO9CKDsR2AKjj53KSqiJJ2ph6v2Gs9u+Wb0wZCXccZ2QR6UlPWMOnZu3nmXrYnjy+s30Wop29qYpMl/NPYaxUYSldYoLVBngwQRA== 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=KWivIiaybYPw5jJB/DQbmVNl+SgpVQga3F7RYOvVWbg=; b=wBbOaIVxSbPMJOkpVNWYqRTzlv1KNP4fyl33Te5mezJzJBgwdUQGOuz6ojSB61pMwKUTD3F5TKtpgim9MGcJLJUTpuORXW+Wf7xfrhQPt9E5ufL5PWGm7e5hlbAqmy9uoRh8VTCLKxdsEVD5cLm/duYI2ck2GsIluifJarE2/zLG9uA6QNN7PTSDV+Jr6xrzWKzquSa0wKdWn4JISuy9KMEqHKcOJ67RRysIHaFt3KHqlgypTYpMyOzKqpcKo32ASqLmX78/BsB14xo2W3btjprkXPZJMA9Xe/qOrbKlp8Zbp9c925KD3TJ4K/He+F8anG0koHkpVemRba/WxJMKlg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KWivIiaybYPw5jJB/DQbmVNl+SgpVQga3F7RYOvVWbg=; b=axOPZe+729JHE4Ru9hz5LCC49PSmleOo/4SNcGB2YWA18YsrVeYHUOob5LzVvUHUj3RV8rBZNFEzeOjVv7H/JPX/IxweT5+gZvNSHJrZvsQmxl+vnYD2dvsxBYR2TP8VVW6yBd11FvrqKA05DtT2RxOEQwYtAs6aFV2QMfiCaFg= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; 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; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C From: Penny Zheng To: CC: , , Penny Zheng , Stefano Stabellini , "Julien Grall" , Bertrand Marquis , "Michal Orzel" , Volodymyr Babchuk , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v5 18/24] xen/domctl: wrap arch_{get,set}_paging_mempool_size() with CONFIG_MGMT_HYPERCALLS Date: Fri, 12 Dec 2025 12:02:03 +0800 Message-ID: <20251212040209.1970553-19-Penny.Zheng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251212040209.1970553-1-Penny.Zheng@amd.com> References: <20251212040209.1970553-1-Penny.Zheng@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0002992E:EE_|IA1PR12MB6433:EE_ X-MS-Office365-Filtering-Correlation-Id: 4e96c102-530e-48e3-6435-08de3933edea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|376014|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?DcrRkvywtYBRp4zrTmFAaqy4gazQVJwM9qHe8YDM7bDHYqEJhAWlqZ5ZyYXl?= =?us-ascii?Q?cH/fCdc8r8Wq/dUyU8ykVNY+2zyRLjIGM4uTMHJFbgvGxKptTRn0kik/DK72?= =?us-ascii?Q?uzm0PKdhLWrz8GlNuBHK1z9lIRM5JkyV7Y7PLErc14g99O7O3G9K0yAapmKs?= =?us-ascii?Q?EXi/gwVTbhiEzutkk8u+7mCOWGZQ9RIsTU4MfubPReRa+Eu2eW+hXuwQ4eP2?= =?us-ascii?Q?Njx2P8IUkMVHXQ3tjFVruiZR/yHnipIPgiJyfJXUXkKCDgmcoPAR2tXYxcaB?= =?us-ascii?Q?YqptIRGOSMXTEF0A08uj4i7pKjsSPKtcwqqMxwva/Z6ZWg78kb9mm8J01uyr?= =?us-ascii?Q?ytfyNH89jCAVL2sbWQ01TPErW26l70XREk2weDcJo/QfYflnKTksb64bqQzQ?= =?us-ascii?Q?ZYHiBckcmRG4zCTXJXfYMQJWjdwcTKkQMENupfoW509uXBno5xTeNGpjDkG+?= =?us-ascii?Q?fc8Mo4LmcjZWgNPu7Lqv2ari+72kHOOJNlC6z6dkQkwN+a5RI6lKTUlcYJHO?= =?us-ascii?Q?0yDsbQSjj+t+X0p7IiEEnpq71kvN/aCHKiDeEac7w+51jy+Hx377nRSHKFMc?= =?us-ascii?Q?C2XFc6+3JZ0NPDiPN3DxPi4CJYv4G6w3he7vbidpSGMFWetpyoU58kljI0Jf?= =?us-ascii?Q?rgJ2aZzEGDCzMQdJYFW9/8GqDBtMJYh7ZiGcQtXCkVGB9g5KTMyxSONz+ACA?= =?us-ascii?Q?1wvA+ybFmI+EOjUOFr9n3n/uIkd5aTdkJjw1QSKWYTsZq31DPusuavg9HT6J?= =?us-ascii?Q?NaPZhquCEnncEkpalecmSZ8eYY4moR4AaOcPQ96e8qBq1AFiRc+gDJbISPXJ?= =?us-ascii?Q?oJGO21TlUam54F6btKGycd22Q254ZDYbH77h8sM4tOXoZIt1urNQQ5NKv9V9?= =?us-ascii?Q?UDHAUM8HjXd7pBBNU29bGw6QXQzgy8W9YcnDq6Ty7naw6OLgmKscaf/+73jM?= =?us-ascii?Q?kIOXk/qmG3/GdknJ+klorn6lMCTe6O3cKxxJiAUDe+lzVQZGzF6Xx7BL4l4p?= =?us-ascii?Q?oUovR30S9IgK242R+1fiwThG+ZvlYjXrWBfrJmz2zbs2dQl+0vcQRTyLBWir?= =?us-ascii?Q?9Fr4lJw69aXIgPoDWN0EVH8fheKqmLXC+87GPn25BNu2GJ85Q/goHwWlVgEV?= =?us-ascii?Q?lwF97DKEp4+WzOFM7IICtf45qFdDCTgAOVnCQ41nWFyz2XgNNBfnAUdTIdFG?= =?us-ascii?Q?4ElFnh6SFSR5T3DuAMn6zqPfDuXrLEOjv23jniAStqsjWCQrpGHwWVwrWgig?= =?us-ascii?Q?YBF7Ngphd9FfjWG2iH3Y7FjQjC7fEWrCwBNTT/77Gaa0iJ+OZtYfiTXzwwZ4?= =?us-ascii?Q?N5IiXfsdJp31I6u8jmSshk4tyglUJhCg18rzD1TIA7tvsr+eykIodaBlYSMz?= =?us-ascii?Q?j2ZaRxJam8G6vdMBGOoq5OFbs231SZVQ1EFN2xWyT/S3Nfekdm7uVz55D+q4?= =?us-ascii?Q?yWYTCBG8pv782UqZ2aV0Kmabt1FpFUV6i+iZXYeiEj+AS5c9VScw2f4L1wLc?= =?us-ascii?Q?H5g8Y78NoHRw3KinzwI9OxiQFWRkpTMegz8ePCHKeADzzquRF4iHZjB8jeks?= =?us-ascii?Q?FIrEz40B9vGsmWhsDTE=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(82310400026)(376014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2025 04:07:13.0491 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4e96c102-530e-48e3-6435-08de3933edea X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0002992E.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6433 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1765513098494158500 Content-Type: text/plain; charset="utf-8" Arch-specific arch_{get,set}_paging_mempool_size() is responsible for XEN_DOMCTL_{get,set}_paging_mempool_size domctl-op, and shall be wrapped with CONFIG_MGMT_HYPERCALLS. Otherwise it will become unreachable codes when MGMT_HYPERCALLS=3Dn, and hence violating Misra 2.1. Signed-off-by: Penny Zheng Acked-by: Jan Beulich # x86 Reviewed-by: Stefano Stabellini --- v1 -> v2: - adapt to changes of "unify DOMCTL to MGMT_HYPERCALLS" - wrap XEN_DOMCTL_{get,set}_paging_mempool_size-case transiently --- v2 -> v3 - address "violating Misra rule 2.1" in commit message - remove transient wrapping around XEN_DOMCTL_{get,set}_paging_mempool_size= -case --- xen/arch/arm/mmu/p2m.c | 4 ++++ xen/arch/x86/mm/paging.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/xen/arch/arm/mmu/p2m.c b/xen/arch/arm/mmu/p2m.c index 30d6071e91..4caa5844e4 100644 --- a/xen/arch/arm/mmu/p2m.c +++ b/xen/arch/arm/mmu/p2m.c @@ -58,12 +58,14 @@ static void p2m_free_page(struct domain *d, struct page= _info *pg) } } =20 +#ifdef CONFIG_MGMT_HYPERCALLS /* Return the size of the pool, in bytes. */ int arch_get_paging_mempool_size(struct domain *d, uint64_t *size) { *size =3D (uint64_t)ACCESS_ONCE(d->arch.paging.p2m_total_pages) << PAG= E_SHIFT; return 0; } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 /* * Set the pool of pages to the required number of pages. @@ -122,6 +124,7 @@ int p2m_set_allocation(struct domain *d, unsigned long = pages, bool *preempted) return 0; } =20 +#ifdef CONFIG_MGMT_HYPERCALLS int arch_set_paging_mempool_size(struct domain *d, uint64_t size) { unsigned long pages =3D size >> PAGE_SHIFT; @@ -140,6 +143,7 @@ int arch_set_paging_mempool_size(struct domain *d, uint= 64_t size) =20 return rc; } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 int p2m_teardown_allocation(struct domain *d) { diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c index 116389d4e9..c6e3996093 100644 --- a/xen/arch/x86/mm/paging.c +++ b/xen/arch/x86/mm/paging.c @@ -949,6 +949,7 @@ int __init paging_set_allocation(struct domain *d, unsi= gned int pages, } #endif =20 +#ifdef CONFIG_MGMT_HYPERCALLS int arch_get_paging_mempool_size(struct domain *d, uint64_t *size) { unsigned long pages; @@ -991,6 +992,7 @@ int arch_set_paging_mempool_size(struct domain *d, uint= 64_t size) =20 return preempted ? -ERESTART : rc; } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 /* * Local variables: --=20 2.34.1 From nobody Sun Dec 14 05:55:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1765513269; cv=pass; d=zohomail.com; s=zohoarc; b=nCn3FjSzaRrOk7RVL3BRdJ2mg1AyE0oEKxJVtZEh8tpngNoQ8WgwsVJKSZitpuyBJTC3afXN4rsSbVu7kxO1vvx15hEw1OGEVbhe2RW5VVSMTx8dmONpj7mTB7IT0B5/lPMr0cmpkvRYK5dGKBb1c0cAsNaVSUR5dTlLtL+nDio= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765513269; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=bok7u4Xk+jAmguRQIjJccc8H+q65eQAsNIZzfh2MqlE=; b=MxwgtQBifXTd7r4+O9lWAntELGgbripvGrI0bWw4nIORcTTBxT4+vgTuf0o295Ku26pefuVinFMKvvBNzEBW5NqpcFu7umxPH2k0XTESsZMAjEDAXJAqUcCCmhUVAqY1qwvEiUpGeq8uGuZI2O9oTfsme3dqwrCvV9fIXzZfp1M= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 176551326990278.78611253481415; Thu, 11 Dec 2025 20:21:09 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1185098.1507383 (Exim 4.92) (envelope-from ) id 1vTueE-0004sn-8t; Fri, 12 Dec 2025 04:20:54 +0000 Received: by outflank-mailman (output) from mailman id 1185098.1507383; Fri, 12 Dec 2025 04:20:54 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vTueE-0004sg-52; Fri, 12 Dec 2025 04:20:54 +0000 Received: by outflank-mailman (input) for mailman id 1185098; Fri, 12 Dec 2025 04:20:53 +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 1vTuR9-0007SS-W3 for xen-devel@lists.xenproject.org; Fri, 12 Dec 2025 04:07:23 +0000 Received: from SN4PR2101CU001.outbound.protection.outlook.com (mail-southcentralusazlp170120001.outbound.protection.outlook.com [2a01:111:f403:c10d::1]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 0dc838d4-d710-11f0-9cce-f158ae23cfc8; Fri, 12 Dec 2025 05:07:20 +0100 (CET) Received: from BL6PEPF00013DF6.NAMP222.PROD.OUTLOOK.COM (2603:10b6:22e:400:0:1001:0:a) by SN7PR12MB7024.namprd12.prod.outlook.com (2603:10b6:806:26e::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.10; Fri, 12 Dec 2025 04:07:15 +0000 Received: from BL02EPF0002992D.namprd02.prod.outlook.com (2a01:111:f403:f901::7) by BL6PEPF00013DF6.outlook.office365.com (2603:1036:903:4::4) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9412.9 via Frontend Transport; Fri, 12 Dec 2025 04:07:15 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by BL02EPF0002992D.mail.protection.outlook.com (10.167.249.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.4 via Frontend Transport; Fri, 12 Dec 2025 04:07:15 +0000 Received: from penny-System-Product-Name.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Thu, 11 Dec 2025 22:07:13 -0600 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: 0dc838d4-d710-11f0-9cce-f158ae23cfc8 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=V3ciX5dAa8hy/uKpXcvJ9R7gitR7SbT1ON+BeJlOBWYYeuLgurJqTE3JedvjNr3zabJNr9vggqLLysGqYBIWh8e/7yh5Huho69Zzhr61sp+NgHnZnAqCgD+8OCcLM+f5tenyFhHkmdPaRDU5oRS2nNKu0lwq+q5N5ufJ3OcGkoofS8zm4zypbZUDZScMWSHRf+vEdilzSfe+Aj0d7WXyBGyRN8sCdV7iODyuW+Ltr5ceVUTNFWc8ob6IhxTbC3lUKIK6l4MJ+F5x8+Q/CKJOkPduVaj5+QFCFV8+ezfOHFofxODkUHHLH7c1UofaERvo5fEF4C2TVk++D7bs4and/Q== 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=bok7u4Xk+jAmguRQIjJccc8H+q65eQAsNIZzfh2MqlE=; b=cCFp8sjOt1LCv7XzUtvVrpVfJN94VB/njYCzbUODW63OdI4myJSVFo5z9OQj2OWCNDRKQ+QiEWiep1i7sp7ZKwzQmSAGrdeMHFLcg5c+1cMuEP2giR8RkdXblMqzeE+hLTcwX6XgnX9oCoowel6cJjxY9aqQ/CBKDVcTLkrsujC2jeWW3iNA5x7ui9QVR9qVWMNxN78uLXYGJIc2/h6+F9EtVPW2YwJdy1zD9/woypQ4sTQOxbxjOStfSMy8QTHSLroOz97rV9qFLhEMZUJ2RSAxI8bAoBkh3bzG+MAMVQK9eoFz79UwmTLtVZwjeMoAq6A0Y8diMqOiNhaY5C3yzA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bok7u4Xk+jAmguRQIjJccc8H+q65eQAsNIZzfh2MqlE=; b=GLBqMJsqin5zj2KHy7h1FlcaXLqQE0DotDng18986AtjJpKeBJGQDvxVUp7bAjPoFTnhKoU9bsH+V/p0RMAaun/O8jWJ/EJ8WiwT2JJnOzdxg2tt8BgcPQDq2RE/O5/TccIh5bLiH9Dwtif13Ff/Krb2bzyz153p5F8vePPiF0c= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; 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; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C From: Penny Zheng To: CC: , , Penny Zheng , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Stefano Stabellini Subject: [PATCH v5 19/24] xen/domctl: make CONFIG_X86_PSR depend on CONFIG_MGMT_HYPERCALLS Date: Fri, 12 Dec 2025 12:02:04 +0800 Message-ID: <20251212040209.1970553-20-Penny.Zheng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251212040209.1970553-1-Penny.Zheng@amd.com> References: <20251212040209.1970553-1-Penny.Zheng@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0002992D:EE_|SN7PR12MB7024:EE_ X-MS-Office365-Filtering-Correlation-Id: 7476f342-3dce-4a7c-3216-08de3933ef4a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|376014|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Isybgq6zQ/gc6+xvCSAVR4BfFBhR+gMUr6fU3zXpogbveAe8Zl4/juwFpU/y?= =?us-ascii?Q?dIagsKBq/LDXKdIQdbnIOjScmMsIccQ+rhPsPhtQIsltNww9tj/aq9EN/dzI?= =?us-ascii?Q?8dFelrXLhcYT4xclmsH4jlTNVyfRnbsf08s+v1pvclZV6SNnuv9nMwazQDZj?= =?us-ascii?Q?phtngG9sCoSCu6wKFkR1utbPwXTm4dE7WRWIIyTHw4D00htKWzmGIHlvCASF?= =?us-ascii?Q?4dbUT37/IudSKQFawWZNYo4lxxuQYaI6SVu+e0Xdj3hYHLLx4TTiKd2mLh5W?= =?us-ascii?Q?pkvc0pKS+tJAE8jHxWyr6J1pHGXIKm9kDGvInqK0SeADwk6J670NS4CO2Uc/?= =?us-ascii?Q?P1mmrSaFgxT0+02yZaG5Tlj0XwcM17TJnqwHPELbrFU9anomG9n36O7ifRey?= =?us-ascii?Q?4UcaRI0o+3GBEpu/VDgVPt0mlJLkfLQDnnlTtrTZAQCdsNDsQzkQXwVGdYos?= =?us-ascii?Q?WRcw/Voaa4pzbVlYOph4MhEPzt8hKMriPRXQtgMKrRJwoJPh+GCo5lr8yTd/?= =?us-ascii?Q?JSHhsgYdAQud9dtgHkMy2LAo+GccY17Luk4dAer7MuKk6LfZaYEOAr8uvg6k?= =?us-ascii?Q?8ubvy3IQm/U8EueUXYDvjuvsbCuIDGQEBnSlSCc3gq4WWDRX+5w0yeUpEGxN?= =?us-ascii?Q?N2Dk1cFcKMkUZk4sCsH/Iqmkbikp/7W0V8li1DSJArHTMLYJ2wX7rZHf515d?= =?us-ascii?Q?BVSJprigu5wmfnXUr94l+W4OX80s9gMOpvAJpfYfczS1B7AxUZkvvF5HZ+s9?= =?us-ascii?Q?KIcRBKwtQJS6zIeKYSGdAWrGM/9fFo2uNuRLTWWYAqrWirjSHpVy7mI6e4eK?= =?us-ascii?Q?PuaVU2dXalXkGoBSkOmjy7H8B0sTP8WBK//8GLgSpVAGyKR7Hi9LeONzSFKk?= =?us-ascii?Q?FKUm/4F/x/+eSHcFgyGAkX14Edd3wfAqG5bXXKQnFg7r1ALy/C2vrNMOHYg1?= =?us-ascii?Q?QY4pHPEtYd2iKwxMRu7lFmn0M7IQTy01H3D79o3Km0lY7ihTOYwdQXY3xa2i?= =?us-ascii?Q?q58vmwE9D2EVxJWfetwMeQrKav2s7WHuNiG2r0si1Saypkjg491HFi0zY+BK?= =?us-ascii?Q?Qy0aOmppn9Z1j+Sjnm5pNcoqswyjptFp+a/QtwCisGTJHOBj8TWQOeP+lunK?= =?us-ascii?Q?bQWPBEsR0eJRpBIMLsZybOq1WLOr1nPMpFTRKN3tRQY/Y9C2tIKKnKVyuh7p?= =?us-ascii?Q?oILDwSMDtSZ60vBb2A2/HyWn1ehF2xEv7xQoyYmBz7hgr1/K/kri8tdPUSMI?= =?us-ascii?Q?K5G6s45GrKBMcEdrAXeyFIKTsGdpUFJdZpDT7qJDzQ1A0VvDWWVmZac/Mxm/?= =?us-ascii?Q?xmCDF+cRCiDKlZLhQNBZTotulJXjEOulBzVifl7BHbPjhdNbyNc9KNCYhW3Y?= =?us-ascii?Q?/B3mLG6e94oAgX+/KiimXksqVntp/gwqcuG/FkNhYRqzHodWxnYbLZL492e9?= =?us-ascii?Q?iSWWSRaeZAyiEdZfNJQva8OOZCezCGlkUKaQcmz/QWDwJIzz9MyF7oXOS+6e?= =?us-ascii?Q?Ek/R6wSA20jy2OUGpTreomS7UpAKBGKo/xutf/XbIKDiAQGh3f8LMuWPwGma?= =?us-ascii?Q?ozaKIG1Pzr2DGNhmZKo=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(82310400026)(376014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2025 04:07:15.3519 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7476f342-3dce-4a7c-3216-08de3933ef4a X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0002992D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7024 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1765513271138158500 Content-Type: text/plain; charset="utf-8" Users control/monitor Intel Platform Shared Resource (PSR) through related domctl-op or sysctl-op, so CONFIG_X86_PSR can be put under MGMT_HYPERCALLS. With this change, we could remove MGMT_HYPERCALLS-wrapping in psr.c. Signed-off-by: Penny Zheng Reviewed-by: Stefano Stabellini Acked-by: Jan Beulich --- v1 -> v2: - adapt to changes of "unify DOMCTL to MGMT_HYPERCALLS" --- xen/arch/x86/Kconfig | 1 + xen/arch/x86/psr.c | 18 ------------------ 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig index c808c989fc..8368c6ecf0 100644 --- a/xen/arch/x86/Kconfig +++ b/xen/arch/x86/Kconfig @@ -191,6 +191,7 @@ config TBOOT config X86_PSR bool "Platform Shared Resource support" if EXPERT default INTEL + depends on MGMT_HYPERCALLS help Support of Platform Shared Resource technology, which is basis for monitoring and control of resources like cache and memory bandwidth. diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c index 80ce5804b4..4f2c2d0042 100644 --- a/xen/arch/x86/psr.c +++ b/xen/arch/x86/psr.c @@ -135,11 +135,9 @@ static const struct feat_props { */ enum psr_type alt_type; =20 -#ifdef CONFIG_MGMT_HYPERCALLS /* get_feat_info is used to return feature HW info through sysctl. */ bool (*get_feat_info)(const struct feat_node *feat, uint32_t data[], unsigned int array_len); -#endif =20 /* write_msr is used to write out feature MSR register. */ void (*write_msr)(unsigned int cos, uint32_t val, enum psr_type type); @@ -422,7 +420,6 @@ static bool mba_init_feature(const struct cpuid_leaf *r= egs, return true; } =20 -#ifdef CONFIG_MGMT_HYPERCALLS static bool cf_check cat_get_feat_info( const struct feat_node *feat, uint32_t data[], unsigned int array_len) { @@ -435,7 +432,6 @@ static bool cf_check cat_get_feat_info( =20 return true; } -#endif /* CONFIG_MGMT_HYPERCALLS */ =20 /* L3 CAT props */ static void cf_check l3_cat_write_msr( @@ -448,14 +444,11 @@ static const struct feat_props l3_cat_props =3D { .cos_num =3D 1, .type[0] =3D PSR_TYPE_L3_CBM, .alt_type =3D PSR_TYPE_UNKNOWN, -#ifdef CONFIG_MGMT_HYPERCALLS .get_feat_info =3D cat_get_feat_info, -#endif .write_msr =3D l3_cat_write_msr, .sanitize =3D cat_check_cbm, }; =20 -#ifdef CONFIG_MGMT_HYPERCALLS /* L3 CDP props */ static bool cf_check l3_cdp_get_feat_info( const struct feat_node *feat, uint32_t data[], uint32_t array_len) @@ -467,7 +460,6 @@ static bool cf_check l3_cdp_get_feat_info( =20 return true; } -#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static void cf_check l3_cdp_write_msr( unsigned int cos, uint32_t val, enum psr_type type) @@ -483,9 +475,7 @@ static const struct feat_props l3_cdp_props =3D { .type[0] =3D PSR_TYPE_L3_DATA, .type[1] =3D PSR_TYPE_L3_CODE, .alt_type =3D PSR_TYPE_L3_CBM, -#ifdef CONFIG_MGMT_HYPERCALLS .get_feat_info =3D l3_cdp_get_feat_info, -#endif .write_msr =3D l3_cdp_write_msr, .sanitize =3D cat_check_cbm, }; @@ -501,14 +491,11 @@ static const struct feat_props l2_cat_props =3D { .cos_num =3D 1, .type[0] =3D PSR_TYPE_L2_CBM, .alt_type =3D PSR_TYPE_UNKNOWN, -#ifdef CONFIG_MGMT_HYPERCALLS .get_feat_info =3D cat_get_feat_info, -#endif .write_msr =3D l2_cat_write_msr, .sanitize =3D cat_check_cbm, }; =20 -#ifdef CONFIG_MGMT_HYPERCALLS /* MBA props */ static bool cf_check mba_get_feat_info( const struct feat_node *feat, uint32_t data[], unsigned int array_len) @@ -523,7 +510,6 @@ static bool cf_check mba_get_feat_info( =20 return true; } -#endif /* CONFIG_MGMT_HYPERCALLS */ =20 static void cf_check mba_write_msr( unsigned int cos, uint32_t val, enum psr_type type) @@ -561,9 +547,7 @@ static const struct feat_props mba_props =3D { .cos_num =3D 1, .type[0] =3D PSR_TYPE_MBA_THRTL, .alt_type =3D PSR_TYPE_UNKNOWN, -#ifdef CONFIG_MGMT_HYPERCALLS .get_feat_info =3D mba_get_feat_info, -#endif .write_msr =3D mba_write_msr, .sanitize =3D mba_sanitize_thrtl, }; @@ -826,7 +810,6 @@ static struct psr_socket_info *get_socket_info(unsigned= int socket) return socket_info + socket; } =20 -#ifdef CONFIG_MGMT_HYPERCALLS int psr_get_info(unsigned int socket, enum psr_type type, uint32_t data[], unsigned int array_len) { @@ -858,7 +841,6 @@ int psr_get_info(unsigned int socket, enum psr_type typ= e, =20 return -EINVAL; } -#endif /* CONFIG_MGMT_HYPERCALLS */ =20 int psr_get_val(struct domain *d, unsigned int socket, uint32_t *val, enum psr_type type) --=20 2.34.1 From nobody Sun Dec 14 05:55:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1765513087; cv=pass; d=zohomail.com; s=zohoarc; b=Gzs0pUT1zm4x2FWJbmd5ziRXiP+BTLvNfG5pp+eMJta9cVDQp0Mcdt+BbNAtf2wF0a5AywgDI7xQCoho1HX3StrxzGlp50qaqx5wjUUARqAbsDYxfR2epiK7vOPvfAuJVw+m75bA7wkitxkqqSQ+ZKpEA9V+LX8qgElZoXHpi5s= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765513087; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=hazNCar4WYebJf7A/BJnz7JkBCn0HLXqiGSPgIqEUcQ=; b=aJjNfT/SCX6HT8fF82hXJouiGI61Hw7BJ0Kvkj9BVBL0DTkc5CkBSmMXQEwysuAzo7JN1tiPGfHZI5fvAVH/79cJ4NWF2cgo7B5WL09EufwbXQ1koqtJmdTwhdqMT2kpKkW3w8wS3t+2cwJ30era6tozqrIaK9xCkuhpvYHRTGw= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1765513087723156.29839839992167; Thu, 11 Dec 2025 20:18:07 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1185026.1507352 (Exim 4.92) (envelope-from ) id 1vTubG-0001Q0-7V; Fri, 12 Dec 2025 04:17:50 +0000 Received: by outflank-mailman (output) from mailman id 1185026.1507352; Fri, 12 Dec 2025 04:17:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vTubG-0001Pt-4f; Fri, 12 Dec 2025 04:17:50 +0000 Received: by outflank-mailman (input) for mailman id 1185026; Fri, 12 Dec 2025 04:17:48 +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 1vTuRG-0007SS-0i for xen-devel@lists.xenproject.org; Fri, 12 Dec 2025 04:07:30 +0000 Received: from CH5PR02CU005.outbound.protection.outlook.com (mail-northcentralusazlp170120005.outbound.protection.outlook.com [2a01:111:f403:c105::5]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 11be36f9-d710-11f0-9cce-f158ae23cfc8; Fri, 12 Dec 2025 05:07:27 +0100 (CET) Received: from BL0PR02CA0013.namprd02.prod.outlook.com (2603:10b6:207:3c::26) by DS7PR12MB6285.namprd12.prod.outlook.com (2603:10b6:8:96::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.11; Fri, 12 Dec 2025 04:07:18 +0000 Received: from BL02EPF00029929.namprd02.prod.outlook.com (2603:10b6:207:3c:cafe::37) by BL0PR02CA0013.outlook.office365.com (2603:10b6:207:3c::26) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9412.8 via Frontend Transport; Fri, 12 Dec 2025 04:07:20 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by BL02EPF00029929.mail.protection.outlook.com (10.167.249.54) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.4 via Frontend Transport; Fri, 12 Dec 2025 04:07:18 +0000 Received: from penny-System-Product-Name.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Thu, 11 Dec 2025 22:07:15 -0600 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: 11be36f9-d710-11f0-9cce-f158ae23cfc8 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xtJBKnUIRPK6mTgGDpg11uAgkOTxIDKcTltV0NRSu6LOnebC6K+Jnn3pmA+JzFAz1fM9YHPGgeCUtMj2EKr4ocCAyPJW447VWU0svziDVlLz3DqrZOhaEb0R1V7AoRvzelOxV9uDmGme1kjJzJ2IBxxjJrYW3kX9mSlUJjws8hzsR2BiKnH149Cn/kZFLbtvIZHOJfnWpMVsVZWZWbctudmixUnxbIgoqKSF1tD5Z6wJdD0Fnq3GcwD3XGX90VOmthxCD4LNxhVUDmdSkzImSbJ2mY1CXNbqgRccmOAr2ylx+P0iSrJxsYIT4jEHkALUOzDRAc7ZITcd28/Jg/Bhdw== 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=hazNCar4WYebJf7A/BJnz7JkBCn0HLXqiGSPgIqEUcQ=; b=n9iLfnpBV0w7C2gdPIXoe6zCM439OMhchlhHmmQV2rbjHjsFiPJagRou5A+5YQMoFFbl/aLWYeg9iz0oDyUFHMWwh9J4vF1GaBthMjBnfkhV0Fjv6RZOePZK+Nwn6dgXL4EktskuXyR4nQPhMZPCEJXl+4+b53TRcmQ7/mpfyeV//CG5sAxsEIiOzwIMAVgpjPdeT/QUjUqMmAv7qTKa8T1skmQnqu5s/L1Y6nIcjK0ROZNlpG5V0XZCw5nCchVuAK/FEKpLhWn8aRE5drx5QTUoMBYPJVEfywWg9aTTE55w/lF7n+zxjcgIYauiR+3RkZEkqJ0NgHtw3T3D08ocUA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hazNCar4WYebJf7A/BJnz7JkBCn0HLXqiGSPgIqEUcQ=; b=CvrvAb/3XyOccrQKIhu/Z5sOQAKjUDCxqI8RGR5SamhlyEvSq4TKl4FfjalvfiZIazFPDWN33eR2vU6JqI5X+WaTxlWtNXtPyNOo+MRQ5q4tXodSzFrYb5Aw9wwKpNPN098olRIFB2LF2/9G6iHkAxvh+T/jhnoX1lx8PAi8v3M= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; 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; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C From: Penny Zheng To: CC: , , Penny Zheng , Andrew Cooper , "Anthony PERARD" , Michal Orzel , "Jan Beulich" , Julien Grall , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , "Stefano Stabellini" , "Daniel P. Smith" Subject: [PATCH v5 20/24] xen/x86: wrap x86-specific domctl-op with CONFIG_MGMT_HYPERCALLS Date: Fri, 12 Dec 2025 12:02:05 +0800 Message-ID: <20251212040209.1970553-21-Penny.Zheng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251212040209.1970553-1-Penny.Zheng@amd.com> References: <20251212040209.1970553-1-Penny.Zheng@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00029929:EE_|DS7PR12MB6285:EE_ X-MS-Office365-Filtering-Correlation-Id: 5ad07a58-0817-41de-3aca-08de3933f128 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|82310400026|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?19M4b/V/O+JwWRuGFBwJOYqBVNgGTQ6qqjVal6tOoexGgtw20Tbfapt5mj3/?= =?us-ascii?Q?aHGFgm98eIZ7pUhTovwopu53Ox2p9uuvIaKKo+rBHLv41+Nwh4Rz/DTTIY7u?= =?us-ascii?Q?uVUJcADa+67db6RFCfCzNTksn6lsmafm8A5p421zmHxpT755C4heIOpgW/yF?= =?us-ascii?Q?WNa6FhZkjcwESUeYGE+1lp1od3kAZEQFTU0NfUpgFCD5deB/RxTHz94nS8nZ?= =?us-ascii?Q?hKdXTyW6DtaK0xUtoBTqsjbht6hyMAiw+Fdz7wDzO+FGvF4Fc2HJU1o+gafU?= =?us-ascii?Q?MSNl6PDM4KTC6ie5Buyb/RzUGxdkV6amtXvedW1wpiGctwZg/yYSy7PTbh6X?= =?us-ascii?Q?2RefDan7aUXP8OtZ0JaPok+RUizFZDddZiBa7NH7QSQXXj9cuBPr/8vNJ5UF?= =?us-ascii?Q?wpgNtGbbJFsBhZEKqxBsbqavC2UfQuGN679BPcyT5xRgrfYjA5qfNEoTG+Dj?= =?us-ascii?Q?Yd+yZh/fEtsla7J6F+4d0xyZKxrBfBAP9Tht2LNHwIuBx3awCMdj0TxoDmQF?= =?us-ascii?Q?6VZ9CKT4VbUwOzlsX4fwm3HxfnMKhsLlqMr3N9uVUJveLZkHVj5UQRxsPi08?= =?us-ascii?Q?8JubafIZFEYv7dCGQ3LLLau5VwKb4kjyZ4LRoSLxIJupdO5fVDwNXxcYvB0h?= =?us-ascii?Q?Ue3qX21GokgXBBDcso63RcXVn5cfzgMoiXjuSo+abXfX+3Pr2bwwi8KbdD6W?= =?us-ascii?Q?mlScpPtJok6wXhV+klRYFvRiSflfIth5yXwOsot5ItPvUFHfLwfNGjeQbZ7F?= =?us-ascii?Q?xNDTN9SI2AjOc9TGcN7eKgriSizes641g3naNa+IiKCsio9S/hb9MqZrxzq0?= =?us-ascii?Q?c28THroTXl2H4ZLhPpjOtkKzKHbymPpaQ7Hh9J02HQu92Lc7jLIiogsd2fb2?= =?us-ascii?Q?fryYweELVXOGwH0bDtZD0rnC9soHWl75j2VAhuW2Ey24vKLxZRcDifnOIMzd?= =?us-ascii?Q?5stAWIh5NBf58l1LxPt5Ie1RajlpeG2DJnnZo9oT4U+4ogmrZ4dR4WVZjAGQ?= =?us-ascii?Q?75MIiGLB/k1+lHZ4bopTEdkGhQlAtd06mf8reqo+ZNQVnEFyu/n1NmnyzyJ3?= =?us-ascii?Q?TDNeScr/rlTp80BsGSNCdewpJ5TxbbhNbvrszOw+aHB8NRxDWMwWIIWqqdJg?= =?us-ascii?Q?aGFXEMkmJHdJymYPL8oSgC/5W22OC9tdRGiKtzvuEOos+TcRlFQbcp+Xlunb?= =?us-ascii?Q?sy+o38dqV5NqvYuIM+zL9ZoUmqjgBmgX7w0GAI0UEYKYM1Lk7zDloNMVIFyB?= =?us-ascii?Q?mCIsu0l9ay4iulbgRfQbqdbaOiNnKQAtij4cWiEiLormwBQR2u7dVkQ2PIKS?= =?us-ascii?Q?IBbj4FJqcQ05KDABAQv8+jUwyAG9eptCFtMUwxChyZDe73gWvVeONENS7jIx?= =?us-ascii?Q?QssfZ2iakd3LvX1Hz7W0vKz/OlbrThP5L1ER8yMw1TbtC5JdztVma13yI0L0?= =?us-ascii?Q?oAVW3BNjwOgKAj0XNaDQ+B7MorMIVglXb05+ptAYA/BQvCRt6T6F7FhEUv3V?= =?us-ascii?Q?QCHTAHpgpCplWakiYUp/9MtZyS8cZjGs9EOB1Ti4Y9VQ38DVOo3dqCTFOyBL?= =?us-ascii?Q?wEbyWP8PqvaATxnGGgk=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(82310400026)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2025 04:07:18.4887 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5ad07a58-0817-41de-3aca-08de3933f128 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00029929.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6285 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1765513088531158500 Content-Type: text/plain; charset="utf-8" Function arch_do_domctl() is responsible for arch-specific domctl-op, and shall be wrapped with CONFIG_MGMT_HYPERCALLS We focus on x86 implementation here only. Tracking its calling chain and the following functions shall be wrapped with CONFIG_MGMT_HYPERCALLS too. Otherwise they will all become unreachable when MGMT_HYPERCALLS=3Dn, and he= nce violating Misra Rule 2.1. - hvm_acpi_power_button - hvm_acpi_sleep_button - hvm_debug_op - make P2M_AUDIT depend on CONFIG_MGMT_HYPERCALLS - make PG_log_dirty depend on CONFIG_MGMT_HYPERCALLS - make policy.o/msr.o depend on CONFIG_MGMT_HYPERCALLS - make cpuid-cp2buf.o/cpuid-cpfrbuf.o/cpupolicy-clr.o depend on CONFIG_MGMT= _HYPERCALLS - make HAS_SOFT_RESET depend on CONFIG_MGMT_HYPERCALLS - make VMTRACE depend on CONFIG_MGMT_HYPERCALLS - paging_domctl_cont We put the guardian in Makefile for the arch-specific domctl.o compilation. Signed-off-by: Penny Zheng --- v1 -> v2: - split out xsm parts - adapt to changes of "unify DOMCTL to MGMT_HYPERCALLS" - wrap default-case and arch_get_domain_info() transiently --- v2 -> v3: - add missing guardian in arm/Makefile - cover RTIT_CTL{,STATUS}_MASK #define-s - add missing guardian for .vmtrace_output_position - guard the whole static inline function - address "violating Misra rule 2.1" in commit message - remove transient wrapping around default-case and arch_get_domain_info() --- v3 -> v4: - make HAS_SOFT_RESET depend on CONFIG_MGMT_HYPERCALLS - make VMTRACE depend on CONFIG_MGMT_HYPERCALLS - seperate depends on condition for future convenience - split arch-specific domctl-op into x86 and arm --- v4 -> v5: - do not undo imply and add "depends on MGMT_HYPERCALLS" in option - use IS_ENABLED(...) to avoid too long line - move paging_domctl_cont hypercall-def closer to avoid scattering #ifdef --- xen/Kconfig.debug | 1 + xen/arch/x86/Makefile | 2 +- xen/arch/x86/hvm/Kconfig | 1 + xen/arch/x86/hvm/hvm.c | 2 ++ xen/arch/x86/hvm/pmtimer.c | 2 ++ xen/arch/x86/include/asm/p2m.h | 2 +- xen/arch/x86/include/asm/paging.h | 3 ++- xen/common/Kconfig | 1 + xen/include/hypercall-defs.c | 8 ++++---- xen/lib/Makefile | 6 +++--- xen/lib/x86/Makefile | 4 ++-- 11 files changed, 20 insertions(+), 12 deletions(-) diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug index a69615cd63..c078c6bf2e 100644 --- a/xen/Kconfig.debug +++ b/xen/Kconfig.debug @@ -15,6 +15,7 @@ if DEBUG || EXPERT =20 config GDBSX bool "Guest debugging with gdbsx" + depends on MGMT_HYPERCALLS depends on X86 default y help diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index 1e2ce8e72c..d389787bb3 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -80,7 +80,7 @@ obj-$(CONFIG_VM_EVENT) +=3D vm_event.o obj-y +=3D xstate.o =20 ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y) -obj-y +=3D domctl.o +obj-$(CONFIG_MGMT_HYPERCALLS) +=3D domctl.o obj-y +=3D platform_hypercall.o obj-$(CONFIG_COMPAT) +=3D x86_64/platform_hypercall.o endif diff --git a/xen/arch/x86/hvm/Kconfig b/xen/arch/x86/hvm/Kconfig index df9bea65b0..1989808810 100644 --- a/xen/arch/x86/hvm/Kconfig +++ b/xen/arch/x86/hvm/Kconfig @@ -54,6 +54,7 @@ config HVM_FEP config ALTP2M bool "Alternate P2M support" if EXPERT depends on INTEL_VMX + depends on MGMT_HYPERCALLS default y help Alternate-p2m allows a guest to manage multiple p2m guest physical diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 5d297fb42a..ce75fb7839 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -5208,6 +5208,7 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PAR= AM(void) arg) return rc; } =20 +#ifdef CONFIG_MGMT_HYPERCALLS int hvm_debug_op(struct vcpu *v, int32_t op) { int rc =3D 0; @@ -5250,6 +5251,7 @@ int hvm_debug_op(struct vcpu *v, int32_t op) =20 return rc; } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 #ifdef CONFIG_VM_EVENT void hvm_toggle_singlestep(struct vcpu *v) diff --git a/xen/arch/x86/hvm/pmtimer.c b/xen/arch/x86/hvm/pmtimer.c index 87a7a01c9f..f080f7561d 100644 --- a/xen/arch/x86/hvm/pmtimer.c +++ b/xen/arch/x86/hvm/pmtimer.c @@ -56,6 +56,7 @@ static void pmt_update_sci(PMTState *s) hvm_isa_irq_deassert(s->vcpu->domain, SCI_IRQ); } =20 +#ifdef CONFIG_MGMT_HYPERCALLS void hvm_acpi_power_button(struct domain *d) { PMTState *s =3D &d->arch.hvm.pl_time->vpmt; @@ -81,6 +82,7 @@ void hvm_acpi_sleep_button(struct domain *d) pmt_update_sci(s); spin_unlock(&s->lock); } +#endif /* CONFIG_MGMT_HYPERCALLS */ =20 /* Set the correct value in the timer, accounting for time elapsed * since the last time we did that. */ diff --git a/xen/arch/x86/include/asm/p2m.h b/xen/arch/x86/include/asm/p2m.h index 9016e88411..3574e2eecd 100644 --- a/xen/arch/x86/include/asm/p2m.h +++ b/xen/arch/x86/include/asm/p2m.h @@ -20,7 +20,7 @@ #include /* for pagetable_t */ =20 /* Debugging and auditing of the P2M code? */ -#if !defined(NDEBUG) && defined(CONFIG_HVM) +#if !defined(NDEBUG) && defined(CONFIG_HVM) && defined(CONFIG_MGMT_HYPERCA= LLS) #define P2M_AUDIT 1 #else #define P2M_AUDIT 0 diff --git a/xen/arch/x86/include/asm/paging.h b/xen/arch/x86/include/asm/p= aging.h index 0c06b0a7a8..b95d80e75a 100644 --- a/xen/arch/x86/include/asm/paging.h +++ b/xen/arch/x86/include/asm/paging.h @@ -57,7 +57,8 @@ #endif #if defined(CONFIG_PAGING) && !defined(CONFIG_PV_SHIM_EXCLUSIVE) /* Enable log dirty mode */ -#define PG_log_dirty (XEN_DOMCTL_SHADOW_ENABLE_LOG_DIRTY << PG_mode_shif= t) +#define PG_log_dirty IS_ENABLED(CONFIG_MGMT_HYPERCALLS) && = \ + (XEN_DOMCTL_SHADOW_ENABLE_LOG_DIRTY << PG_mode_shi= ft) #else #define PG_log_dirty 0 #endif diff --git a/xen/common/Kconfig b/xen/common/Kconfig index 2914508a8f..64023703ae 100644 --- a/xen/common/Kconfig +++ b/xen/common/Kconfig @@ -157,6 +157,7 @@ config HAS_SCHED_GRANULARITY =20 config HAS_SOFT_RESET bool + depends on MGMT_HYPERCALLS =20 config HAS_STACK_PROTECTOR bool diff --git a/xen/include/hypercall-defs.c b/xen/include/hypercall-defs.c index 4840de805b..a08e80ed59 100644 --- a/xen/include/hypercall-defs.c +++ b/xen/include/hypercall-defs.c @@ -196,10 +196,10 @@ dm_op(domid_t domid, unsigned int nr_bufs, xen_dm_op_= buf_t *bufs) #endif #ifdef CONFIG_MGMT_HYPERCALLS sysctl(xen_sysctl_t *u_sysctl) -#endif #if defined(CONFIG_X86) && defined(CONFIG_PAGING) && !defined(CONFIG_PV_SH= IM_EXCLUSIVE) paging_domctl_cont(xen_domctl_t *u_domctl) #endif +#endif #ifndef CONFIG_PV_SHIM_EXCLUSIVE domctl(xen_domctl_t *u_domctl) platform_op(xen_platform_op_t *u_xenpf_op) @@ -279,6 +279,9 @@ hvm_op do do do= do do #endif #ifdef CONFIG_MGMT_HYPERCALLS sysctl do do do do do +#if defined(CONFIG_X86) && defined(CONFIG_PAGING) && !defined(CONFIG_PV_SH= IM_EXCLUSIVE) +paging_domctl_cont do do do do - +#endif #endif #ifndef CONFIG_PV_SHIM_EXCLUSIVE domctl do do do do do @@ -298,8 +301,5 @@ dm_op compat do co= mpat do do hypfs_op do do do do do #endif mca do do - - - -#if defined(CONFIG_X86) && defined(CONFIG_PAGING) && !defined(CONFIG_PV_SH= IM_EXCLUSIVE) -paging_domctl_cont do do do do - -#endif =20 #endif /* !CPPCHECK */ diff --git a/xen/lib/Makefile b/xen/lib/Makefile index 9b3e03a511..26c6a0de33 100644 --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -46,7 +46,7 @@ lib32-y :=3D divmod.o lib32-$(CONFIG_64BIT) :=3D lib-y +=3D $(lib32-y) =20 -libx86-y :=3D x86/cpuid-cp2buf.o -libx86-y +=3D x86/cpuid-cpfrbuf.o -libx86-y +=3D x86/cpupolicy-clr.o +libx86-$(CONFIG_MGMT_HYPERCALLS) :=3D x86/cpuid-cp2buf.o +libx86-$(CONFIG_MGMT_HYPERCALLS) +=3D x86/cpuid-cpfrbuf.o +libx86-$(CONFIG_MGMT_HYPERCALLS) +=3D x86/cpupolicy-clr.o lib-$(CONFIG_X86) +=3D $(libx86-y) diff --git a/xen/lib/x86/Makefile b/xen/lib/x86/Makefile index 780ea05db1..89fb4bba27 100644 --- a/xen/lib/x86/Makefile +++ b/xen/lib/x86/Makefile @@ -1,3 +1,3 @@ obj-y +=3D cpuid.o -obj-y +=3D msr.o -obj-y +=3D policy.o +obj-$(CONFIG_MGMT_HYPERCALLS) +=3D msr.o +obj-$(CONFIG_MGMT_HYPERCALLS) +=3D policy.o --=20 2.34.1 From nobody Sun Dec 14 05:55:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1765513176; cv=pass; d=zohomail.com; s=zohoarc; b=DpHLx1bni+UpKR8/fwP3c+GGidSdt1S2O7ms0G5oCH6H+G0xWVRy6uRp4n0VRKTaLl4ZTcLYBpHetTakO3GBCwRmh2nTPYLVV9GHlXXPB0Yqb/LrF+MtlslXObQlVuzFlWBIPEhfq8IU9wZ1r4wSKQ919IHNua/laOaaInXtSEc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765513176; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=csNyOjSkFIvdqjgNPlKK9D9XWEr0x478Jq7b5iigMd0=; b=c34ooBjBJGQQGncCf0npAtGo1ZPIzQbLrJtU6R2ifOmX63BgX1pivwtyxWoRipirxHzH4AtB3wHPS0UVT5m++MvYe9Ue6/oY4QQ9AaymcRE+xo+n3pjZHk69qTac94VcsXgFYaCp/0sO7pqwAV7qn21Ct5MTa2HE28wSiSGqht0= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1765513176248568.9528760014796; Thu, 11 Dec 2025 20:19:36 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1185062.1507372 (Exim 4.92) (envelope-from ) id 1vTuch-0002zW-QU; Fri, 12 Dec 2025 04:19:19 +0000 Received: by outflank-mailman (output) from mailman id 1185062.1507372; Fri, 12 Dec 2025 04:19:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vTuch-0002zP-NM; Fri, 12 Dec 2025 04:19:19 +0000 Received: by outflank-mailman (input) for mailman id 1185062; Fri, 12 Dec 2025 04:19:18 +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 1vTuRE-0007SS-0U for xen-devel@lists.xenproject.org; Fri, 12 Dec 2025 04:07:28 +0000 Received: from DM5PR21CU001.outbound.protection.outlook.com (mail-centralusazlp170110009.outbound.protection.outlook.com [2a01:111:f403:c111::9]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 1066ae0a-d710-11f0-9cce-f158ae23cfc8; Fri, 12 Dec 2025 05:07:25 +0100 (CET) Received: from MN0PR04CA0007.namprd04.prod.outlook.com (2603:10b6:208:52d::12) by MW4PR12MB7215.namprd12.prod.outlook.com (2603:10b6:303:228::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.7; Fri, 12 Dec 2025 04:07:21 +0000 Received: from BL02EPF00029927.namprd02.prod.outlook.com (2603:10b6:208:52d:cafe::39) by MN0PR04CA0007.outlook.office365.com (2603:10b6:208:52d::12) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9412.10 via Frontend Transport; Fri, 12 Dec 2025 04:07:16 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by BL02EPF00029927.mail.protection.outlook.com (10.167.249.52) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.4 via Frontend Transport; Fri, 12 Dec 2025 04:07:20 +0000 Received: from penny-System-Product-Name.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Thu, 11 Dec 2025 22:07:18 -0600 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: 1066ae0a-d710-11f0-9cce-f158ae23cfc8 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=F63U58GLzrSm2svauWHsgSCeWYaKea507E/O+sXglWb6LoH+6Pe8wOEuVOTTsP7pM9TQnVRU9yU128/KcNac0WIbX9W0lPJecD14lumlRkHTCG2A4SL6Co4grOl3z1cSI8mEOSQCNfs+wEoU6XrmwHUP4gRQtGB8Snyy4geaqDQOmKspVw0YnI+/mW8okyXWwqoQqYRfarkLCN9m7czPUGSK6mBjGPQPamw18oPtsxZLtxFd2gMnrY1VrVyUueGIu8DD6II29ArJ5CuP/Lr8ekbMqeCXArxaKwsXMEkF1pWmcS4mcUdtrUG3ugiQXxJViKkd7kOz8HbuqGxjD/JmqQ== 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=csNyOjSkFIvdqjgNPlKK9D9XWEr0x478Jq7b5iigMd0=; b=Dwsyj7xoy083IjYLAOKtf8GWarVQqFJoCRFlQ2U97pltRpVU242bvw4hFSUz+D5NsZ9NceazQd5y2zyDuSytKmc+yIc7jQOvu/ovVCsAHbybSrEnx2fI7Dga7JP0KolCb122v5tb/EW6NqNFdrUAGzr14mab3O87WtYdisb9akUwARuDNCL8SAcmpACFfT8z8JMzDq7gxjk8H9TgXgn70EgoT09QsNS++rX8y9sHW3p76lmWNvQbJldwJBEYOfbc+RCskWBaHG8Zh7Ok73II9Oz0uXTdkj07KQYHn9tdcXrH4ech113hUhPvq7+jiF3YJKT5dqj1cZgL2N/IioT/2A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=csNyOjSkFIvdqjgNPlKK9D9XWEr0x478Jq7b5iigMd0=; b=jB3hcoMn3ErSlfRVBJtgJabk0WKG/ALH86Sc2OWJXqUYRN/hs4wbCsH1zElFGU9/95M7RlkhfZqY2faZmP2Z8sYow1SBMc+g5jwUHvYiqihxxXxoYWEBgdI91XCwcQwp6zUmFXGjIoQtc/a38XktLwEevXtVdX8UsOwBibvSoI0= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; 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; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C From: Penny Zheng To: CC: , , Penny Zheng , Stefano Stabellini , "Julien Grall" , Bertrand Marquis , "Michal Orzel" , Volodymyr Babchuk Subject: [PATCH v5 21/24] xen/arm: wrap arm-specific domctl-op with CONFIG_MGMT_HYPERCALLS Date: Fri, 12 Dec 2025 12:02:06 +0800 Message-ID: <20251212040209.1970553-22-Penny.Zheng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251212040209.1970553-1-Penny.Zheng@amd.com> References: <20251212040209.1970553-1-Penny.Zheng@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00029927:EE_|MW4PR12MB7215:EE_ X-MS-Office365-Filtering-Correlation-Id: 281e453a-6b7b-4635-b539-08de3933f2a0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?r/qOcL7v8Hm9P3PdLZFYd+gNEfgS7g9XS5PEtgCXOgbLqdziGlshv+4IZQPP?= =?us-ascii?Q?IY3jSJbEDsmGzLHQvYNcTx0WrXqtcY1qp2h/nwU/Db3loARoLI0cDrG6kkcB?= =?us-ascii?Q?PdtSPjtFv0lzxmkkGm510vAGHF3oJMpx/0ZlTpKzdXe3QDs8UjTEgCYq16Ya?= =?us-ascii?Q?pUx3ufN5i3IRcfyyVZvfvPsnYUdbPScRiCAgDrHoY3AlxxodP7uQiiF8jLJD?= =?us-ascii?Q?5OKoPk6CXeYcOqvTXqxEvLaDOyVecg1jt27iu0Koiw7chCP9D39v2uyrib/k?= =?us-ascii?Q?mhpKvLzFb2Icw5QpP1iEAxcSPBsAzQjI/ugEkPSzTKywCOODIVbgH+6ZfBhG?= =?us-ascii?Q?sPNDjf4XGkola4+yn/bQvPe0l4FqDdS7JKfGINYSZMucK1OpYAFjGVEQ+Oy1?= =?us-ascii?Q?tRWvY0pTSTz/5luK0KnV24kIdT95kGa/tEqtEsw0Gv7JORjSz3OigIVedkyx?= =?us-ascii?Q?qc3/egDGw0aDB4YC+iXfIrJZ8ithL1bfUXdVxnOW8xCAzkPeqI8+B63rseYQ?= =?us-ascii?Q?8hPmya2cFx2D7nV1S7+OIEzFZ+gLEdpyiYlY0ux3qoNbZ3rLkzwPKZCwsBS2?= =?us-ascii?Q?9naNOF6Kz95W0OLcCe2pWnBKqNpgyF/4xLqsK9NXsl6aFNHmfd3biRSyuXbN?= =?us-ascii?Q?6Rl0xKXRPfNXErDGa5x3UKswn3QmTLzhXEVjWKHe9T7m2H5+iXf0aZmDaABu?= =?us-ascii?Q?uh3H6BAW1XtNmblV70rBXUxPnr52l/ritZ9fiAixvIqnGR+3RZR3ss4XhsKM?= =?us-ascii?Q?24C974xPSHcnav21ItmuRo1LHlBYiJolUkQdsoDvdHZ4988iCJNPJXyfiqEQ?= =?us-ascii?Q?RfVJLa6zPGdBaZohN4THrNhkbdB3joFtPsZRGA8QEOiOiQeichENQ8c3+QLh?= =?us-ascii?Q?0oh6oiMN1vZzTTz/zdvNI1sRfB4OsGscbTaqT6nU5snAeZ4qdN0uRncfoq79?= =?us-ascii?Q?pELXHqpRqqu7VXj0qM/8wMxzTThL8ySW3drz55qsBTCbPm7iC9x9dScyiNDr?= =?us-ascii?Q?MYQ75luJuCiyE2/BMI6MNMJG5luPKfmmYnjHOOZCBMAPaGVXDnJhZiW3shIr?= =?us-ascii?Q?/sB9uYSDrAUFc9yQzqohOC/6osaPrxFi+0G7IA/3EepaFJ0b8tvQYqKMDEoH?= =?us-ascii?Q?s1MvOf8xvwzt43KIolS0SnJOFOYdV6bI06wUvyXRvT9i++UirrBcRMfbuVOe?= =?us-ascii?Q?XMKXtRwpiesk612+gK4Uy0MVdzgdS0oq3IQzQ3WxEVNwfu4LiXfS/zjgdsZ2?= =?us-ascii?Q?jxE7Px7sIFhIqP0iJbAU0I2BSOyBEj9UtjEc0KPSFjP42YGMNxmZxWSfUsPl?= =?us-ascii?Q?bNGdXwUKFUPt1Ox8o88vjtsumEaZDAFLB+802o7cBT/p/79znttHNhQX5v9J?= =?us-ascii?Q?6dlq3ywq2NAYLU4/lykVZXtnZhAYcaD/jYosrtccnExpv2K7R/H/jxS2mooN?= =?us-ascii?Q?WbUkW3oCzWMHD5aA1MV1OKgwYbElIDa3NuNa741xGOV8IpLy3JSuhs2w2Va+?= =?us-ascii?Q?7b1yqN8WvDLF5LFF5RtiIvhRDWHeKsPceFXQHpQmAd1l3Dw29JlGRTQkp10H?= =?us-ascii?Q?Z6yqXyW2q5T6d1wWYIw=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(82310400026)(1800799024)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2025 04:07:20.9563 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 281e453a-6b7b-4635-b539-08de3933f2a0 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00029927.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7215 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1765513176897158500 Content-Type: text/plain; charset="utf-8" Function arch_do_domctl() is responsible for arch-specific domctl-op, and shall be wrapped with CONFIG_MGMT_HYPERCALLS Guard arm-specific domctl.o compilation with CONFIG_MGMT_HYPERCALLS. Otherw= ise the whole file will become unreachable when MGMT_HYPERCALLS=3Dn, and hence violating Misra Rule 2.1. Signed-off-by: Penny Zheng --- v3 -> v4: - split arch-specific domctl-op into x86 and arm --- xen/arch/arm/Makefile | 2 +- xen/arch/arm/arm32/Makefile | 2 +- xen/arch/arm/arm64/Makefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index 069e2c532e..91ac4d6e32 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -20,7 +20,7 @@ obj-$(CONFIG_IOREQ_SERVER) +=3D dm.o obj-$(CONFIG_DOM0LESS_BOOT) +=3D dom0less-build.init.o obj-y +=3D domain.o obj-y +=3D domain_build.init.o -obj-y +=3D domctl.o +obj-$(CONFIG_MGMT_HYPERCALLS) +=3D domctl.o obj-$(CONFIG_EARLY_PRINTK) +=3D early_printk.o obj-y +=3D efi/ obj-y +=3D gic.o diff --git a/xen/arch/arm/arm32/Makefile b/xen/arch/arm/arm32/Makefile index 531168f58a..f8cbf14211 100644 --- a/xen/arch/arm/arm32/Makefile +++ b/xen/arch/arm/arm32/Makefile @@ -4,7 +4,7 @@ obj-$(CONFIG_MPU) +=3D mpu/ =20 obj-y +=3D cache.o obj-$(CONFIG_EARLY_PRINTK) +=3D debug.o -obj-y +=3D domctl.o +obj-$(CONFIG_MGMT_HYPERCALLS) +=3D domctl.o obj-y +=3D domain.o obj-y +=3D entry.o obj-y +=3D head.o diff --git a/xen/arch/arm/arm64/Makefile b/xen/arch/arm/arm64/Makefile index 6491c5350b..6b77a15abe 100644 --- a/xen/arch/arm/arm64/Makefile +++ b/xen/arch/arm/arm64/Makefile @@ -6,7 +6,7 @@ obj-y +=3D cache.o obj-y +=3D cpufeature.o obj-$(CONFIG_HARDEN_BRANCH_PREDICTOR) +=3D bpi.o obj-$(CONFIG_EARLY_PRINTK) +=3D debug.o -obj-y +=3D domctl.o +obj-$(CONFIG_MGMT_HYPERCALLS) +=3D domctl.o obj-y +=3D domain.o obj-y +=3D entry.o obj-y +=3D head.o --=20 2.34.1 From nobody Sun Dec 14 05:55:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1765513081; cv=pass; d=zohomail.com; s=zohoarc; b=DeO9uf+68rPSqIPT40vGXlFZDiG0uNVKbpCp8/+jhFKv+rezJfVzxU+BEzDG4YIJViEv3IeWXzYnb3IBOxSPBq/rdtPs0GKh3+ILaQo3Eqp3c4D/u2kECLrj4MUbNejfCNPPde3HcCKNzaY3ikusES8NPvVEtZj5kwT2tI3fWZg= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765513081; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8CDjhjNeGSnpu7WULKozeSHXwJMukMwEQH7YbEo2lUA=; b=QhsdkrZLmh6GRCWhW2weJsoFC8SxhTqhKn1MCvlh516AyXbzWhdlElDvPoZRa7eTaOM5NFW+tryag//fMoDe+TTYU/6FUff8o04AIudtmtn/TO4Cfk52883bkXpZ4KVPHmgsAW4/huWgHTxYYoW1ysVKZDDqjoM8AQeTAZgXayc= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1765513081748529.6220497232562; Thu, 11 Dec 2025 20:18:01 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1185018.1507341 (Exim 4.92) (envelope-from ) id 1vTub4-00013l-Rh; Fri, 12 Dec 2025 04:17:38 +0000 Received: by outflank-mailman (output) from mailman id 1185018.1507341; Fri, 12 Dec 2025 04:17:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vTub4-00013e-OT; Fri, 12 Dec 2025 04:17:38 +0000 Received: by outflank-mailman (input) for mailman id 1185018; Fri, 12 Dec 2025 04:17:37 +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 1vTuRH-0007SS-0h for xen-devel@lists.xenproject.org; Fri, 12 Dec 2025 04:07:31 +0000 Received: from BN1PR04CU002.outbound.protection.outlook.com (mail-eastus2azlp170100001.outbound.protection.outlook.com [2a01:111:f403:c110::1]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 11f87d82-d710-11f0-9cce-f158ae23cfc8; Fri, 12 Dec 2025 05:07:27 +0100 (CET) Received: from BL0PR02CA0011.namprd02.prod.outlook.com (2603:10b6:207:3c::24) by LV8PR12MB9110.namprd12.prod.outlook.com (2603:10b6:408:18b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.7; Fri, 12 Dec 2025 04:07:22 +0000 Received: from BL02EPF00029929.namprd02.prod.outlook.com (2603:10b6:207:3c:cafe::38) by BL0PR02CA0011.outlook.office365.com (2603:10b6:207:3c::24) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9412.8 via Frontend Transport; Fri, 12 Dec 2025 04:07:25 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by BL02EPF00029929.mail.protection.outlook.com (10.167.249.54) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.4 via Frontend Transport; Fri, 12 Dec 2025 04:07:22 +0000 Received: from penny-System-Product-Name.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Thu, 11 Dec 2025 22:07:20 -0600 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: 11f87d82-d710-11f0-9cce-f158ae23cfc8 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WUFHwTMtB18A/9HHDSu44CHTGVdTGTHU52FAVUDuVaQAKWhdkXdGC2t//RIrxNjcrpiQDr9oVlaHzHKeALYQ+ufISxtut9Wn6v0mNnlRTERA7U9LAzG7ykWnVFXp+F67h2ANWWhFxc3e1d9v+qNyiyT9Xkh7Jq4XM6RR65V4gnXc+V2GxLT0dAPLEqQ8UW/QTtlTdZChpphzdQI0nSoObPoEfpeE0KjjbRxeNceFOw8f6gEnI5iYqPlgv6Iaa4/pDDMSao2+Hj7NqadEYJLPFG5Cdl6Dd81CnAKcP82fb2KNk1SmRbHrKhNF+blWJbu8jIKDO38a60+oyDmbDw7dPw== 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=8CDjhjNeGSnpu7WULKozeSHXwJMukMwEQH7YbEo2lUA=; b=aUerMAYA4jPiclG9rauJ8U7CyfHEElt3Qy9OoiyGiOX12Oj2gu5gk/SRxXYkacw2rM03Jm/6Ba7Pk3daL+zvLT6K1wQSPNJhCmmGS5/WXOQMRlh0l6g/PP7usv4F02bBvt0b/fn0rJQn9b9dHoc5Ub4TLmVx54/M+Y2Oy8e3gqWCw2vealf4FKjy5Ez8jTSqU1KhCsfb4edF2ll0566zEB0ODD95h/V6lCkzH5R0uBZyLVV6G1vHXPgLXgDj8n/KqB5vOeNhh2rheTTkM4GRCaU1jUHXvDh2EWBORtlf9VvtLME6tRxP0EbpRRCEFNpSBQcTfokeDIoloHKQ7J9xLA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8CDjhjNeGSnpu7WULKozeSHXwJMukMwEQH7YbEo2lUA=; b=UNcmC38UBQZaRFtC6ZU2lrVxsaokTG1Ry5tLKouM/GnlDfhY8Wxg8r/Eezu9x5lj52/g66U7Z1ClGFh28YS9mzOg2QiKIcbSPM+3si3MtK33iEGts7jTAzKMSzF2tehTZrHzP1LESwBIwSUFpXFK7cOimZqMdwDuj1kVHqOok8c= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; 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; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C From: Penny Zheng To: CC: , , Penny Zheng , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v5 22/24] x86/hvm: domctl_lock synchronization only when MGMT_HYPERCALLS=y Date: Fri, 12 Dec 2025 12:02:07 +0800 Message-ID: <20251212040209.1970553-23-Penny.Zheng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251212040209.1970553-1-Penny.Zheng@amd.com> References: <20251212040209.1970553-1-Penny.Zheng@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00029929:EE_|LV8PR12MB9110:EE_ X-MS-Office365-Filtering-Correlation-Id: 523a287a-b7b2-435c-2d9a-08de3933f3cc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|82310400026|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?1VoL6zvcy2WF1CMSaBoMno598uddqzaj7gPi/wDN6rLfFyIO17+1aNB7Vi01?= =?us-ascii?Q?UNYA9r7CTUVA7IHlXmNl/ayRMDBoYQdAqksqiEN1aKn7+1K3mgq6rEFP0svQ?= =?us-ascii?Q?XtJRJiF0xX2UpiZVMR0We6TmqhA/NHGgUo9SVG9yg/qWxBu/LSXD+JzgdodJ?= =?us-ascii?Q?MpzmJJ2gd37v+WjaK1s7n6m+53/0bSzLUi9DD6IWGqZ39XnnHvnECXUNjc2E?= =?us-ascii?Q?Sv3mctO49uFFDBl54KDVB4bCWCkfzIfHEeJAO8ji5vE0P66GoN0xK936PtKj?= =?us-ascii?Q?2aDNEU7MKW9AVAn6+Hv+7SUn7XtGKgVRK8byz4D+v6fub7Jyez69IB1ev6vG?= =?us-ascii?Q?YXtdCkDS7NIXlF6/YYgwqDvGcxFpjQFzHsJi3WPZlz3W0AIWdDV2FQYdE0Cw?= =?us-ascii?Q?Ch4uJazb4S3s7wyTmmIrKFvebjntYJBHFkIE1ADE4vYuuXIyX0ibj1j8b/FC?= =?us-ascii?Q?It+XDF9Iztk1ytqysiUH5p7JqIC3MkGC0OByfVoaYErhLzRXFic+uh7jlFt5?= =?us-ascii?Q?0aOT7OGhpLHu9hN4zH1xF9UNMWjl1GMv7IgfLvhkpa9677yb0VCp7xR8uznP?= =?us-ascii?Q?8ydBQj859vccqees4TTIgiWJVpheh9OzGME2JsCOpFZPxqq51vU77EFXihRH?= =?us-ascii?Q?x74mkLxoqWB7aDeH6IWcORo5CdamlsJZSoADVY+njHBNZd9B8HAiHdy7+2Pp?= =?us-ascii?Q?lojh1dyivOQ3xIi4qmUYy9tytL5HcJQ5z0IST48iYNrJM73B7yq3bVAar1ll?= =?us-ascii?Q?VT72zb2KzuMTC+iQqEunMYWSvVOlmkVKWK3g1xHtZskfsurw9mJgc9JsBaJF?= =?us-ascii?Q?UIjPWKXTC+493jpYfSTp0sI0DaASLMr6NMmU2x3uz8hW5UMQc4iY6QCmYpIa?= =?us-ascii?Q?dmmODf/OTNGxUkRbQmHR15t+9i8uQmTeixR0lZFNoIeaaVGXRDraZ1kKtrV8?= =?us-ascii?Q?TfI2IUQmCOj2IMCdmKuvZF8SXe76ERPjFvb1pwXGzsHOsajgFJlXbqmJcInv?= =?us-ascii?Q?hEPFkDV/5y9ZJvSP2hn2hsMrDx0u6DEgfR+Dd3P2bG9fngvujVA1P11gEUY3?= =?us-ascii?Q?jE2x4iq58wvD9hUAoBzJYl8LGTVEBstwcx2DNY73U/I9tNtLkkx5gbcqccCI?= =?us-ascii?Q?Xv6Kv8Vu6uZgC+nE8YVedPgKMkTyuid+yeLUDIoxk/p33AmYjRGGC1mT2vQn?= =?us-ascii?Q?OXi94iIld67ZL7d4X2FS7NcyGUpvM1cDYFQZkXrEik1vsBb5u94hB3k1d1EN?= =?us-ascii?Q?A3SKdCd8TNkdEi6WK0CzkdxNcVCgUT5oVUfYJ8qFxATG/pDXdMDFhelY1HYv?= =?us-ascii?Q?HqeoNzpc6Nr7hVC7LHjqrVolq3KRrH3HiuWV+Uyw4H5bX3s7EKPPwcEpOeA3?= =?us-ascii?Q?vPj3kCyURtfICH1zBP9VebWlJYfDeZFD/CVJePrLF1qFadp8PL8r6VYTSjH3?= =?us-ascii?Q?XUEQCOU83rv76I8+1ycAUt3e42A6m9ZC4U054iDILuVD1aP6eW64XlaA0NVE?= =?us-ascii?Q?haCiwYjU9yLrAmqKBXUYm+8QHV+3UG1B1pMOTwxEis7cvzDMpuR/VAYRpWAC?= =?us-ascii?Q?VyfT5BuiEywWm8pCCGo=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(82310400026)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2025 04:07:22.9192 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 523a287a-b7b2-435c-2d9a-08de3933f3cc X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00029929.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9110 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1765513082715158500 Content-Type: text/plain; charset="utf-8" Helper domctl_lock_{acquire,release}() is domctl_lock, which HVM_PARAM_IDEN= T_PT uses to ensure synchronization on potential domctl-op altering guest state. So it is only needed when MGMT_HYPERCALLS=3Dy. Suggested-by: Jan Beulich Signed-off-by: Penny Zheng Acked-by: Jan Beulich --- v3 -> v4: - new commit --- v4 -> v5: - refine title and commit message --- xen/arch/x86/hvm/hvm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index ce75fb7839..b52dd8f1c4 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -4272,7 +4272,7 @@ static int hvm_set_param(struct domain *d, uint32_t i= ndex, uint64_t value) * the domctl_lock. */ rc =3D -ERESTART; - if ( !domctl_lock_acquire() ) + if ( IS_ENABLED(CONFIG_MGMT_HYPERCALLS) && !domctl_lock_acquire() ) break; =20 rc =3D 0; @@ -4282,7 +4282,8 @@ static int hvm_set_param(struct domain *d, uint32_t i= ndex, uint64_t value) paging_update_cr3(v, false); domain_unpause(d); =20 - domctl_lock_release(); + if ( IS_ENABLED(CONFIG_MGMT_HYPERCALLS) ) + domctl_lock_release(); break; case HVM_PARAM_DM_DOMAIN: /* The only value this should ever be set to is DOMID_SELF */ --=20 2.34.1 From nobody Sun Dec 14 05:55:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1765513316; cv=pass; d=zohomail.com; s=zohoarc; b=YyU947FR8INEqlegeoMvPSjVqHVLuJdbceDCB1cAA3fzsmrYon/FVUt/d/2g94JbEVD/y4Y+4Ivr5+M59kEVHBpSC6pgcE/7JMt/jyEugh4zf28bP1xPXfb0gdrm9E0hcYSMScUJAuPB0UqwD9KIpn+dAFEmH8DQBDP2kSPFfws= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765513316; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=odExyTV3fsgU5LF6NYJiZ8Pw/V9R8W68o6yrCIsvmNc=; b=VBYu6XiO1PGmceI3j3iu/cy7ESweYCsCX3DiIxUvj1SsgB9HXRDzHjohJeVbtQYB1UWx3xKXkFaeSfu4tNxHKcsNclO+jYgOX+IoztOrZXfNX9JUpSyMVUJLSY61Eq6GtqoetHVTRR0oRseSwL34v5U6/6uVSLSCdsMuUVCYqEY= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1765513316852886.2691783588197; Thu, 11 Dec 2025 20:21:56 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1185120.1507391 (Exim 4.92) (envelope-from ) id 1vTuew-0005VU-GI; Fri, 12 Dec 2025 04:21:38 +0000 Received: by outflank-mailman (output) from mailman id 1185120.1507391; Fri, 12 Dec 2025 04:21:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vTuew-0005VN-DN; Fri, 12 Dec 2025 04:21:38 +0000 Received: by outflank-mailman (input) for mailman id 1185120; Fri, 12 Dec 2025 04:21:36 +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 1vTuRM-0007SS-1B for xen-devel@lists.xenproject.org; Fri, 12 Dec 2025 04:07:36 +0000 Received: from BL2PR02CU003.outbound.protection.outlook.com (mail-eastusazlp17011000f.outbound.protection.outlook.com [2a01:111:f403:c100::f]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 131bd19d-d710-11f0-9cce-f158ae23cfc8; Fri, 12 Dec 2025 05:07:29 +0100 (CET) Received: from MN2PR13CA0032.namprd13.prod.outlook.com (2603:10b6:208:160::45) by DS0PR12MB9273.namprd12.prod.outlook.com (2603:10b6:8:193::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.10; Fri, 12 Dec 2025 04:07:26 +0000 Received: from BL02EPF0002992E.namprd02.prod.outlook.com (2603:10b6:208:160:cafe::23) by MN2PR13CA0032.outlook.office365.com (2603:10b6:208:160::45) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9434.5 via Frontend Transport; Fri, 12 Dec 2025 04:07:25 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by BL02EPF0002992E.mail.protection.outlook.com (10.167.249.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.4 via Frontend Transport; Fri, 12 Dec 2025 04:07:25 +0000 Received: from penny-System-Product-Name.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Thu, 11 Dec 2025 22:07:23 -0600 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: 131bd19d-d710-11f0-9cce-f158ae23cfc8 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AcMTWT6ISmCZi5Ug52edbR8PVxaoQG+2zw9cYTzyHjR8veFPvJy5MpRRVM0iPhdwPfeECrvf0R6eKrYWsvZOEPMtfc7eryWH1gvcJvz5gQKX+KVEn+bsMBuopalbSsRG25QPB/a9WC3G5JD1v35n8n9Xucf/yH9tFTZJePXquHf12RGhCEGqTX6aY3RnjKMXEIO4HJnC801JismKvTwv/ardH1t14o2cZ7On/1AKBIOoEfNx9XQhdaU/cfYgYHM+IcOaW3BUBj8j7GcTcsVF1LFEsBo3TOKbPo26qg6sZAW0XsZ/ORmkzM5unUptJiogzHAsinqEDHncH95Fvz/GtQ== 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=odExyTV3fsgU5LF6NYJiZ8Pw/V9R8W68o6yrCIsvmNc=; b=waBsqy8Ct1czB8sbu2zV1pV/bxd3D7qYm0BRiVQFqmnbdJWDSMilQXUBdcplaSrhCdU3l9ts8JflBY3G0PeZ7g0cYM34DhctBXFaNG+wqV7/wmAzjFnoPqniodTJqQPtjDbIsoFJ68V2qcFrfe32zgDfwwxhr7/xBpEsCur1YEsPtB0aqunW6kgD2PWQFQr1GS1cvtDpWyrpsJPhZ9AaAh/1Uc5PlLB68tbcKW1xvzfG2+NbV8G4+4VkMezZ+uT53xalNQSqBBvbs6BWYCeNcR82lsNlx+xFNKDfo2EQyfavRNWGGbgZiPa8YWk0/lTOGavnt0WPdFf91rLzfPVN1Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=odExyTV3fsgU5LF6NYJiZ8Pw/V9R8W68o6yrCIsvmNc=; b=pNS9YKdLcdiKV8qJ1RCDB00lPol9sS04W6aJGYSyKBua/Q5MgziXsQiXAexcWSYfPyRPykB3sfPI5pW7gq4AmVwBq4kfa2wos6YFOxadDzjPOGg7y8a+TX0/zXYaseiVbkIqLlGPhChjcLXrc2ZyAKd2zZ3fhwP0HARL32Db3j8= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; 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; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C From: Penny Zheng To: CC: , , Penny Zheng , Andrew Cooper , "Anthony PERARD" , Michal Orzel , "Jan Beulich" , Julien Grall , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , "Stefano Stabellini" Subject: [PATCH v5 23/24] xen/domctl: wrap common/domctl.c with CONFIG_MGMT_HYPERCALLS Date: Fri, 12 Dec 2025 12:02:08 +0800 Message-ID: <20251212040209.1970553-24-Penny.Zheng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251212040209.1970553-1-Penny.Zheng@amd.com> References: <20251212040209.1970553-1-Penny.Zheng@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0002992E:EE_|DS0PR12MB9273:EE_ X-MS-Office365-Filtering-Correlation-Id: a286bc90-480c-411f-d09c-08de3933f599 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?P4Ttmj+kvtCIrhUAdK4KFavOuDhm5MTMUzmBFdhIr0/t8mSuENMtaVacmNMV?= =?us-ascii?Q?DWhLN3yrwzP03DmNwuoNDFckHA/qOO7BKXTLpBJ8ydVk3jysK6lD4namwDPt?= =?us-ascii?Q?u3vk8UwjcQTROGFitkawFPtZFSOyAxOn7Fe0MMLtJchNIAVhQ5aQkbFwOqaI?= =?us-ascii?Q?fuYijCbhzgIBO0Mi6wJqFahX+7j8cpgGPmxvso4YTBe+AA8glmMIkfA82rV4?= =?us-ascii?Q?ULs+yOBrgFcgDGZCJSMs/iSOEbmZ0Wej2NBx1djET0Z0Y1p4yTGQHXAv13MY?= =?us-ascii?Q?0DU5uScu4c0IAVjIy91rVBYXkp3cOggz0eKGL2DoVlYQIc/azIaJObLnAuuY?= =?us-ascii?Q?VZsAx3Tos01PSYQNqmgW9zz1xGu7tKf86aN9i14mrIW6Uv3AmB0s4CmsjtCH?= =?us-ascii?Q?vil5S90Q/hk2BQz4t8R3TtywVQSSjMBxH4Jn4+EH+hF9BEjHSbzWHWmQaYCG?= =?us-ascii?Q?dhaPE0fTgCM/ek6J+iokCE+B7X8CJBIc1EbFQRtidYJVBHxw/ZHkTg+cYaUv?= =?us-ascii?Q?t8Hfc4htJb1khJs4zvLPZQWobq15mLBZ24jleEpFkX/gGpzkOuUGrsgjStEL?= =?us-ascii?Q?5NDkuJvHJT9JFKVHB1uTbU7Zz+iG+HbYkrbb+4zKWkn2ZTG7QUpvpTZczPiW?= =?us-ascii?Q?NuhXl74dFc4uOsnvH06DEgwbRotKgAWOs9NMgYtLy45sulycbfZhQHXfGZhG?= =?us-ascii?Q?rQrxQI5S1pSNWtON64fd83dy/zqEFT/4/ePAbHBhjXxrfoQE5xMKoyyIQbdz?= =?us-ascii?Q?wljDAO3CRAqp79Y71halTQsRLLBbxa919wMSouuz0zo24GWDwyhGvm/zw4Ng?= =?us-ascii?Q?Naa03izfoVmk+xdoXUY6SxkY27iKxEeictdQ48VrwAl/T7Z+1oFOI+Wn4wTe?= =?us-ascii?Q?O7uwgiMPkUNM5FA6sc4nptijBXmoSNh8h4qohOSo1U0s216u9dr+fYLbaeRx?= =?us-ascii?Q?2Rw/SN2DDxBDg0lhqvRcHTKoCAII7yo+H9P6MPxnMicL/Zy+apIU8d5TSasf?= =?us-ascii?Q?ykrEEIU3lqJY4lPIasroZ/pYsp8fLjX/o1P5gBs9fkP7l7zh5B0zQJzMxtOB?= =?us-ascii?Q?zNZgTj1wl0pW7mgCTxSDBy8u0PKlYSXUHLYKL1bPjTf6Sa/CWLlqtMEDApP+?= =?us-ascii?Q?u+WUBP6MYtI+b0GowqqPqDD9TSTO8xTb+BY6j+A1roy9k1c6fyFuOp8YPZMP?= =?us-ascii?Q?tPgh/AbWNvJOb/QUP6EYjQMXaL3EoYl6GZqUkuXQ80iecaEWV2naLWFCPjV+?= =?us-ascii?Q?0Nroj2qPQfHx2tU25SWHtOqzGtSw+DtBCQKMIaHB0909ue9XSoeko7ucnCtd?= =?us-ascii?Q?qzEIbkB0VbQXQrhhUfYiurn3uJFQUDZTnmPQimT3B8blCJ9JcooHIu64c048?= =?us-ascii?Q?a1Gh4ynsz/Y0n73XbWur3iS6EjR5eT9jYbSnhQhxJbuUMtlHdTPg1qGQIIkI?= =?us-ascii?Q?TbJAH2ELrHq5bmUqF7DBq5Q65LZJqKjr/DDWLgXR5nrmodR3LM5Krp82maz1?= =?us-ascii?Q?Qi5f+USm+a3YCsDZCl6jzt2Ug5mVnGKcLdbAGrw97RkBQElerakpKolHWUYZ?= =?us-ascii?Q?pEVgh9ROzVWpzho2QGw=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(376014)(82310400026)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2025 04:07:25.9387 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a286bc90-480c-411f-d09c-08de3933f599 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0002992E.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB9273 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1765513317271158501 Content-Type: text/plain; charset="utf-8" Wrap domctl hypercall def and domctl.o with CONFIG_MGMT_HYPERCALLS. Make CONFIG_MGMT_HYPERCALLS optional and expand help message Signed-off-by: Penny Zheng --- v1 -> v2: - remove stub in common/domctl.c - combine the original commit of "xen/domctl: provide stub for domctl_lock_{acquire,release}" - adapt to changes of "unify DOMCTL to MGMT_HYPERCALLS" --- v2 -> v3: - add pitfall warnning in Kconfig help --- v3 -> v4: - refine help message --- - change to "say Y" to keep consistent - add back default y --- xen/common/Kconfig | 16 ++++++++++++---- xen/common/Makefile | 2 +- xen/include/hypercall-defs.c | 6 ++++-- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/xen/common/Kconfig b/xen/common/Kconfig index 64023703ae..d59e108652 100644 --- a/xen/common/Kconfig +++ b/xen/common/Kconfig @@ -653,12 +653,20 @@ menu "Supported hypercall interfaces" visible if EXPERT =20 config MGMT_HYPERCALLS - def_bool y + bool "Enable privileged hypercalls for system management" depends on !PV_SHIM_EXCLUSIVE + default y help - This option shall only be disabled on some dom0less systems, or - PV shim on x86, to reduce Xen footprint via managing unnessary - hypercalls, like sysctl, etc. + Management hypercalls provide the means for dom0 to manage the + overall Xen system and other domains, including sysctl, domctl, etc. + In a dom0less or pv-shim build, they can be omitted to cut down + on the Xen binary's size. However, this comes at the loss of + significant runtime functionality. + So be cautious to disable it, as admins will face missing a few basic + hypercalls like listdomains, getdomaininfo, etc, hence leading to + have an impact on device-passthrough and DM. + + Unless you know what you are doing, say Y. =20 endmenu =20 diff --git a/xen/common/Makefile b/xen/common/Makefile index 4353ea59a4..9f59f141a8 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -71,7 +71,7 @@ obj-bin-$(CONFIG_X86) +=3D $(foreach n,decompress bunzip2= unxz unlzma lzo unlzo un obj-$(CONFIG_COMPAT) +=3D $(addprefix compat/,domain.o memory.o multicall.= o xlat.o) =20 ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y) -obj-y +=3D domctl.o +obj-$(CONFIG_MGMT_HYPERCALLS) +=3D domctl.o endif =20 obj-$(CONFIG_COVERAGE) +=3D coverage/ diff --git a/xen/include/hypercall-defs.c b/xen/include/hypercall-defs.c index a08e80ed59..c9ee5de99e 100644 --- a/xen/include/hypercall-defs.c +++ b/xen/include/hypercall-defs.c @@ -199,9 +199,11 @@ sysctl(xen_sysctl_t *u_sysctl) #if defined(CONFIG_X86) && defined(CONFIG_PAGING) && !defined(CONFIG_PV_SH= IM_EXCLUSIVE) paging_domctl_cont(xen_domctl_t *u_domctl) #endif -#endif #ifndef CONFIG_PV_SHIM_EXCLUSIVE domctl(xen_domctl_t *u_domctl) +#endif +#endif +#ifndef CONFIG_PV_SHIM_EXCLUSIVE platform_op(xen_platform_op_t *u_xenpf_op) #endif #ifdef CONFIG_HVM @@ -282,10 +284,10 @@ sysctl do do = do do do #if defined(CONFIG_X86) && defined(CONFIG_PAGING) && !defined(CONFIG_PV_SH= IM_EXCLUSIVE) paging_domctl_cont do do do do - #endif -#endif #ifndef CONFIG_PV_SHIM_EXCLUSIVE domctl do do do do do #endif +#endif #ifdef CONFIG_KEXEC kexec_op compat do - - - #endif --=20 2.34.1 From nobody Sun Dec 14 05:55:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1765513312; cv=pass; d=zohomail.com; s=zohoarc; b=T37ED+1h5HjJ/D3OWHWOwFZ3Qu7xevKqfR8APiyxW+NOhLgDZH25y1iI0ftB3TczYmRVERlLVo7KAAqCbuSP+7J1KVoaUMGP3/O9DG3hFxOxspeROGfgicTGfYg9768vhqYEL7xMyGY5sRG7aVqB5xdmyg0pmwKMyW0cYUmyYmE= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765513312; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=VeiH6+Z+OiU86ZAPkaW9D/QiTAcCg9U2zSCm9FXdi9c=; b=WCCJm2vR/gTlB+Fk2X71jMwUBQpfLonoDS8XEW/kphhdEbJkByOH1epM9g4ptsBqVPPvo4H5RnzORzybCGHGUVVcw6MMA6DDBQW8nR9uVpoRM0TARCfTW0iih/bYY1v17drT9ZLJPU67187HnypPgc+Z3nG4NE28UUp9JZPoEOk= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1765513312441576.1368549093635; Thu, 11 Dec 2025 20:21:52 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1185123.1507397 (Exim 4.92) (envelope-from ) id 1vTuew-0005Yl-Pa; Fri, 12 Dec 2025 04:21:38 +0000 Received: by outflank-mailman (output) from mailman id 1185123.1507397; Fri, 12 Dec 2025 04:21:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vTuew-0005Yg-LZ; Fri, 12 Dec 2025 04:21:38 +0000 Received: by outflank-mailman (input) for mailman id 1185123; Fri, 12 Dec 2025 04:21:37 +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 1vTuS0-0007SS-UV for xen-devel@lists.xenproject.org; Fri, 12 Dec 2025 04:08:16 +0000 Received: from DM5PR21CU001.outbound.protection.outlook.com (mail-centralusazlp170110009.outbound.protection.outlook.com [2a01:111:f403:c111::9]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 2e1a4448-d710-11f0-9cce-f158ae23cfc8; Fri, 12 Dec 2025 05:08:15 +0100 (CET) Received: from MN2PR03CA0005.namprd03.prod.outlook.com (2603:10b6:208:23a::10) by IA1PR12MB8539.namprd12.prod.outlook.com (2603:10b6:208:446::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.10; Fri, 12 Dec 2025 04:08:10 +0000 Received: from BL02EPF0002992C.namprd02.prod.outlook.com (2603:10b6:208:23a:cafe::76) by MN2PR03CA0005.outlook.office365.com (2603:10b6:208:23a::10) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9388.16 via Frontend Transport; Fri, 12 Dec 2025 04:08:10 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by BL02EPF0002992C.mail.protection.outlook.com (10.167.249.57) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.4 via Frontend Transport; Fri, 12 Dec 2025 04:08:10 +0000 Received: from penny-System-Product-Name.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Thu, 11 Dec 2025 22:07:25 -0600 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: 2e1a4448-d710-11f0-9cce-f158ae23cfc8 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cVVKg9/Kw+eVhdLtv02KYsLTdREQg1Ub5VkLEvgEFLpzxTCwhh1a1Z8nZVBwMKEO89kM2WlEyC7+oMvMU0GzBtQnxuk0xpAo0yQ3M58YJ0G/zQEmJjLJQ/VvI+XEkp7WvNsRvZin+5U02boWFX4KMK9ZvUkiNYV5itTFjGo1+rY8LzVLzjsL7tkU8Z36kon8Km075JVafMWARgTMtVJJcP/+h66PRjfOh8YaQkGlDwWyIRWEY1CMsA3H8/UkjrNjoxZvVeMT+fzbLmABiLRywQrAlRxaYpE2K9h5BymEGLd5RA+Kw90jR46gBOFGSf471EHARmkUq/qsxSXMoGnvxA== 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=VeiH6+Z+OiU86ZAPkaW9D/QiTAcCg9U2zSCm9FXdi9c=; b=qjaA8sHQQEWvZyy86FUol40iRgxZem9iIWkDs+hByDnTGAHgkd6dv9Eqa4aeDoR7Z7UHgGHyNH9579zAtZqqnddiK2gsK0rhq/i6496wMLbhBKxxcEK1fbf4g5v7slKCyE1wRm2R+AY/4FwHsnftwZHKYh/nAOtf14SyfVDmSB3296QTCMHBmbV4qlrJS29Ktg2TGeGN0TjebDDY22QXOop2IRtL9eZC1ogFuAxYgxFGIXBkI3Rpd1prPJ7d/cPbUjj/rkwGmXMiEDUKXINioXRJJC8wlTTCbolqv4ZsSQiFQlWtdVfTpyvlpp43pSr9qFayVvNKg9lKMgQM9frd5w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VeiH6+Z+OiU86ZAPkaW9D/QiTAcCg9U2zSCm9FXdi9c=; b=QPZNRx1SRupFBknzoILKF7cKFZ4GSynxCUPNyjkZ7TjoqdAhNznvKTZmFmNdVYr0G2KpH6Xn4IjQi5SgdASR3eu5SH4l8RblxLvpYftIehWg86W0URjznYQjHAzrj93+B/xFiisVu6ALvsWuATmeRBQaPfVMXD8hskM+J3zG7KA= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; 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; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C From: Penny Zheng To: CC: , , Penny Zheng , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Anthony PERARD , "Michal Orzel" , Julien Grall , "Stefano Stabellini" Subject: [PATCH v5 24/24] xen: decouple PV_SHIM_EXCLUSIVE and MGMT_HYPERCALLS Date: Fri, 12 Dec 2025 12:02:09 +0800 Message-ID: <20251212040209.1970553-25-Penny.Zheng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251212040209.1970553-1-Penny.Zheng@amd.com> References: <20251212040209.1970553-1-Penny.Zheng@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0002992C:EE_|IA1PR12MB8539:EE_ X-MS-Office365-Filtering-Correlation-Id: 12e54e11-07f3-4ca9-8203-08de3934100b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?ecAJNwxNGcDDb9CMM7azRAkbgy+3eWiEClL37IOGhg+xlVo8XQI/By1gOnnQ?= =?us-ascii?Q?CErzSgrznXStZfBOl2Cx2W1/JXEM23o1Gvcec9VS5H5eGPnttMvgyOEAYgVb?= =?us-ascii?Q?190PK2DOxRTyiIJPmb19zY43Q1hxc5d6AW3mCCL0ke720XGb51rqdzvWVZb+?= =?us-ascii?Q?hN14ef57IKOyKRfPjTJ/paqa7ENWkfI07jh6uANd9+YV08ZICfcYSDbNRX1N?= =?us-ascii?Q?f8nywZChj5zCLneFJsVtv6LlpvmsWECtazcPQBaFKkJpfYoxVjlH4jtRpzO2?= =?us-ascii?Q?thLrJSTtmE5BkAcztjEfK7HYLs+fYdVrBD7QuqK56jGTn1++2hqmYW4pM/Fw?= =?us-ascii?Q?r4F72grAt7hNXghMhS25lPehO5f+aiIWrkJMw7XViu1P+CewzuS8dxlEGtZq?= =?us-ascii?Q?50qVrn6gqOv6glm6pHbAlbbbYZZT5SMkA+TM6mEkgJyWn2Xcj1/e6OG0uPeI?= =?us-ascii?Q?tAnqGDTUwRFMEMklMGc6dQKZYoji4tRbMRfSlDUUBuLZCSItwCalPJvoPFaw?= =?us-ascii?Q?MvSiRtXuzO+eGFYepQGHMBwBkR2PxsJP0/JKjn2udguuoDdyr74FzYHHSc26?= =?us-ascii?Q?D8j1EchzJBFWGOapV+qyCg8prAzO7gE81VvwJ+LlDkKQq0z2lCML4LxUtwn+?= =?us-ascii?Q?CPN9xupDWGfRDhpLHEA+/hKBZX2wCDnoGVy5DjMvB/gQh3OgvRigz35rZr6R?= =?us-ascii?Q?SfjbctRg3Wg4NS1+WfgewblaZ0fVqnuK4iuF0LRT8Q7qaq9q1tHKP5dn4xeB?= =?us-ascii?Q?y7PV0A1eQUniHGRlfhj3eJqAYmJImwomi7yTIWkPjIbMqxMUgb/xmT+NzTI7?= =?us-ascii?Q?6yyrMNEDjrKlG4rSwWoNSUPlcGw6W5k1Uireh4ePffC06H2AhzxgUF7odiSH?= =?us-ascii?Q?/NnxipMXUHdRzgIRV2UITgjU5gBinsz/624WffQvIkIdxfMpjR7XTf7GsJ+M?= =?us-ascii?Q?GTdAdrDsirEWl0KnDDqtSm9FqUM7x5xP1ddYOcmOtMce/0KoiP9bmi3Eq6Qj?= =?us-ascii?Q?RYVj8wOYlX3xp8AbpzdS7OQKTf29Mr31/H0hVV0TcnzB0+9lBwPNq7Ap8QWq?= =?us-ascii?Q?IT9JXhaK6WP7g2srCwetA6kQDq7UJAeTF1+KRLPxRzlICKvp41BMSMCAQ7FN?= =?us-ascii?Q?0u7Ub98/S50tyB9JEtgk+7KBXd0hfgbh++ECByHRIus8D8qBGmTm/tjlrJFC?= =?us-ascii?Q?5gPg1qZ3wA//iWbJxK0FBwI9/cG+CrAG3EkiPZ0HQXtCLuJk1pG5cBEor0YW?= =?us-ascii?Q?QoLUXS/U2twbuYDZ7b3vgRiD/IAQQLL+nBZyzKbwN9aetPbSlnpjfIXCwxgG?= =?us-ascii?Q?EE+8RKke0y7Daq9LAKkak6EjgNqvaVFAryHIjPSQ2TVOh83zuKjOrBLP9D9O?= =?us-ascii?Q?Awz3oTYtr4GD1pub0l0YqJgSzFxA1P79FI22biwvuqbnYIljeGmyMo+xn7po?= =?us-ascii?Q?IIEhTUniDzoJLQIIk/gFRjoxk31GxOD8ObjJBBm/GINARUu7n3hU24CAkJ74?= =?us-ascii?Q?IxGD/T7luILwINCGUOYcDcTT+UAOF6+TdaZIt8/g82btrvY2AN/fi2SmPGsR?= =?us-ascii?Q?LoQVc4asJRXQ5M0xOMQ=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(376014)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2025 04:08:10.3112 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 12e54e11-07f3-4ca9-8203-08de3934100b X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0002992C.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8539 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1765513313284158500 Content-Type: text/plain; charset="utf-8" We try to decouple PV_SHIM_EXCLUSIVE and MGMT_HYPERCALLS, including getting rid of "depends on !PV_SHIM_EXCLUSIVE" (and related Makefile constructs) regarding features guarded under MGMT_HYPERCALLS. There is little possibility that random config may pick MGMT_HYPERCALLS=3Dy and PV_SHIM_EXCLUSIVE=3Dy, so we need to add !defined(CONFIG_PV_SHIM_EXCLUS= IVE) constriction on paging_domctl() under XEN_DOMCTL_shadow_op-case to avoid undefined error. Signed-off-by: Penny Zheng --- v3 -> v4: - new commit --- v4 -> v5: - Remove unrelated changes on CONFIG_HVM - add !defined(CONFIG_PV_SHIM_EXCLUSIVE) constriction on paging_domctl() un= der XEN_DOMCTL_shadow_op-case - refine title and commit message --- xen/arch/x86/Makefile | 2 +- xen/arch/x86/domctl.c | 2 +- xen/common/Kconfig | 1 - xen/common/Makefile | 4 +--- xen/include/hypercall-defs.c | 4 ---- xen/include/xen/domain.h | 4 ---- 6 files changed, 3 insertions(+), 14 deletions(-) diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index d389787bb3..03650049ce 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -31,6 +31,7 @@ obj-bin-y +=3D dmi_scan.init.o obj-y +=3D domain.o obj-bin-y +=3D dom0_build.init.o obj-y +=3D domain_page.o +obj-$(CONFIG_MGMT_HYPERCALLS) +=3D domctl.o obj-y +=3D e820.o obj-y +=3D emul-i8254.o obj-y +=3D extable.o @@ -80,7 +81,6 @@ obj-$(CONFIG_VM_EVENT) +=3D vm_event.o obj-y +=3D xstate.o =20 ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y) -obj-$(CONFIG_MGMT_HYPERCALLS) +=3D domctl.o obj-y +=3D platform_hypercall.o obj-$(CONFIG_COMPAT) +=3D x86_64/platform_hypercall.o endif diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c index 6153e3c07e..235fd3b60f 100644 --- a/xen/arch/x86/domctl.c +++ b/xen/arch/x86/domctl.c @@ -216,7 +216,7 @@ long arch_do_domctl( { =20 case XEN_DOMCTL_shadow_op: -#ifdef CONFIG_PAGING +#if defined(CONFIG_PAGING) && !defined(CONFIG_PV_SHIM_EXCLUSIVE) ret =3D paging_domctl(d, &domctl->u.shadow_op, u_domctl, 0); if ( ret =3D=3D -ERESTART ) return hypercall_create_continuation( diff --git a/xen/common/Kconfig b/xen/common/Kconfig index d59e108652..f57a5f00a3 100644 --- a/xen/common/Kconfig +++ b/xen/common/Kconfig @@ -654,7 +654,6 @@ menu "Supported hypercall interfaces" =20 config MGMT_HYPERCALLS bool "Enable privileged hypercalls for system management" - depends on !PV_SHIM_EXCLUSIVE default y help Management hypercalls provide the means for dom0 to manage the diff --git a/xen/common/Makefile b/xen/common/Makefile index 9f59f141a8..a0b0705f72 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -11,6 +11,7 @@ obj-$(filter-out $(CONFIG_X86),$(CONFIG_ACPI)) +=3D devic= e.o obj-$(CONFIG_DEVICE_TREE_PARSE) +=3D device-tree/ obj-$(CONFIG_IOREQ_SERVER) +=3D dm.o obj-y +=3D domain.o +obj-$(CONFIG_MGMT_HYPERCALLS) +=3D domctl.o obj-y +=3D domid.o obj-y +=3D event_2l.o obj-y +=3D event_channel.o @@ -70,9 +71,6 @@ obj-bin-$(CONFIG_X86) +=3D $(foreach n,decompress bunzip2= unxz unlzma lzo unlzo un =20 obj-$(CONFIG_COMPAT) +=3D $(addprefix compat/,domain.o memory.o multicall.= o xlat.o) =20 -ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y) -obj-$(CONFIG_MGMT_HYPERCALLS) +=3D domctl.o -endif =20 obj-$(CONFIG_COVERAGE) +=3D coverage/ obj-y +=3D sched/ diff --git a/xen/include/hypercall-defs.c b/xen/include/hypercall-defs.c index c9ee5de99e..e7209f8b63 100644 --- a/xen/include/hypercall-defs.c +++ b/xen/include/hypercall-defs.c @@ -199,10 +199,8 @@ sysctl(xen_sysctl_t *u_sysctl) #if defined(CONFIG_X86) && defined(CONFIG_PAGING) && !defined(CONFIG_PV_SH= IM_EXCLUSIVE) paging_domctl_cont(xen_domctl_t *u_domctl) #endif -#ifndef CONFIG_PV_SHIM_EXCLUSIVE domctl(xen_domctl_t *u_domctl) #endif -#endif #ifndef CONFIG_PV_SHIM_EXCLUSIVE platform_op(xen_platform_op_t *u_xenpf_op) #endif @@ -284,10 +282,8 @@ sysctl do do d= o do do #if defined(CONFIG_X86) && defined(CONFIG_PAGING) && !defined(CONFIG_PV_SH= IM_EXCLUSIVE) paging_domctl_cont do do do do - #endif -#ifndef CONFIG_PV_SHIM_EXCLUSIVE domctl do do do do do #endif -#endif #ifdef CONFIG_KEXEC kexec_op compat do - - - #endif diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h index 8aab05ae93..11d2505420 100644 --- a/xen/include/xen/domain.h +++ b/xen/include/xen/domain.h @@ -185,11 +185,7 @@ struct vnuma_info { struct xen_vmemrange *vmemrange; }; =20 -#ifndef CONFIG_PV_SHIM_EXCLUSIVE void vnuma_destroy(struct vnuma_info *vnuma); -#else -static inline void vnuma_destroy(struct vnuma_info *vnuma) { ASSERT(!vnuma= ); } -#endif =20 extern bool vmtrace_available; =20 --=20 2.34.1