From nobody Fri Nov 22 14:13:11 2024 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=1716589032; cv=pass; d=zohomail.com; s=zohoarc; b=MsS57FUpEZ2e3vOtQ2uW6QHGbg2HuKBNVcpZTSCL75uDiipOwrqqfwE7JmMUDxyqs1tW2J9rpoSJN/TgyU6kELYGbesOTpRlMTPHy2ESjA5GebLGA/LOwF/fSGCqiO4bfN6dll1HUNWew0nsQLX/HViRmFUiMfXX5tyLlV8ykJc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716589032; 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=DJzU+Lo23+pblv8U5ELG1eHDNPAMdYWdjjMuN9k4W2I=; b=mFdzN8ylHqPYpC0sDxXjqS/VLykiWojgX3/lyrVObXEKbHs5onOXKkYW8+2LkSvqS+vWc5ic1vRbPVCmtrT/9KSY+uyNf8PmZYJFpOwtrnL5mSJtg/IOsIHsz6f0AfonnO1jEOIr/aDPgVxI0KKjWMv5TN+pQ7EtFRPs/Tva2TE= 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 1716589032302481.67000737992373; Fri, 24 May 2024 15:17:12 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.729887.1135196 (Exim 4.92) (envelope-from ) id 1sAdDe-0007X1-L6; Fri, 24 May 2024 22:16:58 +0000 Received: by outflank-mailman (output) from mailman id 729887.1135196; Fri, 24 May 2024 22:16:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sAdDe-0007Vi-Bg; Fri, 24 May 2024 22:16:58 +0000 Received: by outflank-mailman (input) for mailman id 729887; Fri, 24 May 2024 22:16:56 +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 1sAdDc-0006xe-Gp for xen-devel@lists.xenproject.org; Fri, 24 May 2024 22:16:56 +0000 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on20600.outbound.protection.outlook.com [2a01:111:f403:2417::600]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 534f98c6-1a1b-11ef-b4bb-af5377834399; Sat, 25 May 2024 00:16:54 +0200 (CEST) Received: from DM5PR08CA0041.namprd08.prod.outlook.com (2603:10b6:4:60::30) by SN7PR12MB7811.namprd12.prod.outlook.com (2603:10b6:806:34f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.22; Fri, 24 May 2024 22:16:50 +0000 Received: from CY4PEPF0000FCC4.namprd03.prod.outlook.com (2603:10b6:4:60:cafe::a9) by DM5PR08CA0041.outlook.office365.com (2603:10b6:4:60::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.22 via Frontend Transport; Fri, 24 May 2024 22:16:49 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000FCC4.mail.protection.outlook.com (10.167.242.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7611.14 via Frontend Transport; Fri, 24 May 2024 22:16:48 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 24 May 2024 17:16:48 -0500 Received: from smtp.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Fri, 24 May 2024 17:16:47 -0500 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: 534f98c6-1a1b-11ef-b4bb-af5377834399 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ns9JCnCAXGoAjQfpP9wTbqYGU7n90JKF+cuIZPfDk/R14fZpmhkxc7Lfyc1c+Zj0gU4kMbg3DVQ5uNluhrqy0QC1uIfO7sukvVSTgSWaHizcFf7YfcE+CYWevdrPUscDIeVLCSc2GR2ZlmMUnZesH1aZPi1jx59TDIn7r2saF2jpC2bU1OCJROwplSWO+nx/WLm/Cf84NWGd7LcfmYZ5OdoK8Af2w23DDIuygvc+flp+aDvQWa1/plWMuvY6kG3bIfx2KiGeHg96iedhe1gl//+3Cliw8cNuod7jGDkQ8LOqyvUo1judm1qLbl9/6wLyM3jSpbGaRJ5dYc5kNByhOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=DJzU+Lo23+pblv8U5ELG1eHDNPAMdYWdjjMuN9k4W2I=; b=bp5c6uxrCNfQZZipQ4TC9ZG/hqYGc0hO4mq7bqpZqgrL5JcW8seJhm2L2aaHGPkGeVwlsGUQfKz04vTgF9xuQ3C2h+gEkw2AArIELGI6kwrSB/vKevmRYIDM107anhmob+PWDx/ocBBcs90GxXkAGzwM11qgdKmiuv03jF+S60APTK+uOQVSp7723ytAif/rTlqdUTfkw4wEbrvQ2/pYvGnUseGpIaWYrpoviKuST1h7j0qZCEF3vbwu9GY8OCWiQM3Q+AN9bIiYUexKF+FLUn95HcoWX0qm2gtbpcalv7xkS23h7+Nwm8DcgV/3FSQsF7WD/c5WbsVcE61lTHer5w== 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=DJzU+Lo23+pblv8U5ELG1eHDNPAMdYWdjjMuN9k4W2I=; b=GiNFzdCzMXUm73p1jFdMZbwrVPzY6M1lm2agrxUnPzjtm3vbUi6PwInsDTbhyk1SCsoGEIUfoqMS4J/xL9LV5yHhchshune1moFCe6xaWW/fn+jFhdbKyO+Fl9d4bz13cVLOkOqkinNBSB0KlduiVl3BeABiKhhmcY2GnKzxrDk= 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=SATLEXMB04.amd.com; pr=C From: Stefano Stabellini To: CC: , , , , , , Henry Wang , Jason Andryuk Subject: [PATCH v6 1/7] tools/xl: Correct the help information and exit code of the dt-overlay command Date: Fri, 24 May 2024 15:16:41 -0700 Message-ID: <20240524221647.2860711-1-stefano.stabellini@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: None (SATLEXMB04.amd.com: stefano.stabellini@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCC4:EE_|SN7PR12MB7811:EE_ X-MS-Office365-Filtering-Correlation-Id: 3b1469f8-0f67-42e1-a46d-08dc7c3f34b9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|82310400017|376005|36860700004; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?We6+HSNrH5PCtFIOkHpGgt47i80SS+XBiQvm/anNS7mrXE0NZIsDs+wIJdcw?= =?us-ascii?Q?5+ZLaSs55myOP+JkzbHmu4KL7rCMkWewFqo2Fyk6rAX12ecPnGpHjZ/26Yfg?= =?us-ascii?Q?C8Ote7p//1M8iWpYtW4jYlety5h20Ru+oP0S1MsKOMHH4dfI1XM0EStbdbfF?= =?us-ascii?Q?Tlv4/Kmfs1jr9eW53iOVjW8MJAVifHma0rVtl4FI9RHlavMaiDhXTL8nCd8e?= =?us-ascii?Q?mYOqnQxRKPTTitxMvSU8yTUfgdAR5Z6zFr2ZfZg94CEnZxkaHR79Vq+1UmS3?= =?us-ascii?Q?E5BCXVuri1RnWJT5hyRCI/2SsZY1GWQy3DJgAbUrx0suLVNnFCC4HhEV+jUi?= =?us-ascii?Q?zHNsC/pVU+5DYGMA6FV8UVzpBIOF1Vsfu5ul1YX8lz55ZbjHhoWJra+5ybG0?= =?us-ascii?Q?mEwtGdZgdLGPkjvO6U9KQEUEEkrIW4KPqqqEVepjpfDobc6nVAtH3+bxw5T5?= =?us-ascii?Q?Evx/1K3WZ1cb44GBS1ZDJcq5KZ9DsgvCEscSbzoAkuhlEIhjjIO2Ufvj1mJe?= =?us-ascii?Q?gnqKwBunPzRMYJ9mr0Qx2ZYOLOcYEDau061FdvbJWEG41Bggq/bCmqQtl2It?= =?us-ascii?Q?BWiD2K5a2SarXocGPtG8wUx/eiTL1vEwBRts84MPG1kKyhJR6KibCLVaSHpU?= =?us-ascii?Q?u/nO1dZu8LDwNDM00k/RGTve8SKJF/CcvRaYF1Nt+FwfFT23jx6h6vpQtNRn?= =?us-ascii?Q?ZRkQD4/VTalHvLRBpOmiKYW9uKEiP9qea4KdR4ylkBFa2MVbPzuf0Yt9oQSN?= =?us-ascii?Q?GNSecdAAEXFM7bljdq5IxyP6piPIvKnUkA7UZWfA/x9qym+lD0f0DuZA+oxn?= =?us-ascii?Q?twDW7w6KNka/W3X3Ig7z4A3hdYvOkwDTHR+G6pLLXc1H/44okZl2sE07jJ7k?= =?us-ascii?Q?6ObFOYJ+Ytdy5JDnEkLeG8gmS59h+bTE6wcMcyV2DTLc+Fl1jRZfe4gLoa3o?= =?us-ascii?Q?1PzAdTuyq89J/fjWWPwvJ+8swkunyrp/Q5SwGcXK+uHg+g65uybFXdMlc0xy?= =?us-ascii?Q?mj60imeCLGUAefkehRGk9M/njRhBmu/sDZDsKbFI6sSK4k9W7iDI/lVoz65h?= =?us-ascii?Q?0x0B1PDRhyBr3+q/VcHMomXjoMDFKUtY4UFAsv7VPuOKzgrnlTjDkY7KUtGQ?= =?us-ascii?Q?5l2J+vKSDZ6QbK/gqiwwtcj00sTSaMdCRantg1xOaI5ZGDgvP1h6jbOXk4i5?= =?us-ascii?Q?+/WjC/opFE1G6nVyzcMrziUIpXFUfRp+wfU1dgK8KchFQFVzchwIwVPAkf45?= =?us-ascii?Q?2zdyH9tBOoeMqxz5TZJEyVczFvIZvFNuVG+/Mw2IljLEdEKxbxbzQAIA310X?= =?us-ascii?Q?VZH3bu3AJUbYs59v3Qugofqlo5nmq20g3nofn0XUIL3pBZifQsZ7hosrb1Wy?= =?us-ascii?Q?Z7rcljk=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(1800799015)(82310400017)(376005)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2024 22:16:48.8195 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3b1469f8-0f67-42e1-a46d-08dc7c3f34b9 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000FCC4.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7811 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1716589033047100001 Content-Type: text/plain; charset="utf-8" From: Henry Wang Fix the name mismatch in the xl dt-overlay command, the command name should be "dt-overlay" instead of "dt_overlay". Add the missing "," in the cmdtable. Fix the exit code of the dt-overlay command, use EXIT_FAILURE instead of ERROR_FAIL. Fixes: 61765a07e3d8 ("tools/xl: Add new xl command overlay for device tree = overlay support") Suggested-by: Anthony PERARD Signed-off-by: Henry Wang Reviewed-by: Jason Andryuk Reviewed-by: Stefano Stabellini --- tools/xl/xl_cmdtable.c | 2 +- tools/xl/xl_vmcontrol.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c index 62bdb2aeaa..1f3c6b5897 100644 --- a/tools/xl/xl_cmdtable.c +++ b/tools/xl/xl_cmdtable.c @@ -635,7 +635,7 @@ const struct cmd_spec cmd_table[] =3D { { "dt-overlay", &main_dt_overlay, 0, 1, "Add/Remove a device tree overlay", - "add/remove <.dtbo>" + "add/remove <.dtbo>", "-h print this help\n" }, #endif diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c index 98f6bd2e76..02575d5d36 100644 --- a/tools/xl/xl_vmcontrol.c +++ b/tools/xl/xl_vmcontrol.c @@ -1278,7 +1278,7 @@ int main_dt_overlay(int argc, char **argv) const int overlay_remove_op =3D 2; =20 if (argc < 2) { - help("dt_overlay"); + help("dt-overlay"); return EXIT_FAILURE; } =20 @@ -1302,11 +1302,11 @@ int main_dt_overlay(int argc, char **argv) fprintf(stderr, "failed to read the overlay device tree file %= s\n", overlay_config_file); free(overlay_dtb); - return ERROR_FAIL; + return EXIT_FAILURE; } } else { fprintf(stderr, "overlay dtbo file not provided\n"); - return ERROR_FAIL; + return EXIT_FAILURE; } =20 rc =3D libxl_dt_overlay(ctx, overlay_dtb, overlay_dtb_size, op); --=20 2.25.1 From nobody Fri Nov 22 14:13:11 2024 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=1716589043; cv=pass; d=zohomail.com; s=zohoarc; b=i4NnOgGH/yrZrxsX7UOAFZNejDSskdzNBoj+eyVEsebadOW95QsxlO8t79GqenqMjXRlWw01b0YKuLvVQvD0IEhJ6ng2Sm4hq2zA3gKjwee/5KlvPkD79E1lxtVU9emheSG+TUlt2E7LPptowpqX0oe9d/WOIDJ2j7XAizaL3lQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716589043; 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=xRJXSt/i9q6c1C8Y7abmDgKw7TBf2B9wiQ/rWE+b2Go=; b=MYYG/1RpC3A/MS6YlOZG3mWNejPVbF8CEz74Yeqv1Wjyi7ITeeYS7VaHqAIcqvDCcTGVEFmS9KpHuEfrG+fq3T6llpxbYkvY5IEgjaA+tKLmR9R3M/3idBn5XH9i2WDt31NVgzlhFrUUBq2jAvE6wiRbTKgMKn/5MblmYyplbYw= 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 1716589043651149.40320747837563; Fri, 24 May 2024 15:17:23 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.729890.1135230 (Exim 4.92) (envelope-from ) id 1sAdDj-00006b-JR; Fri, 24 May 2024 22:17:03 +0000 Received: by outflank-mailman (output) from mailman id 729890.1135230; Fri, 24 May 2024 22:17:03 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sAdDj-00006Q-Bq; Fri, 24 May 2024 22:17:03 +0000 Received: by outflank-mailman (input) for mailman id 729890; Fri, 24 May 2024 22:17:01 +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 1sAdDh-0007Iy-SJ for xen-devel@lists.xenproject.org; Fri, 24 May 2024 22:17:01 +0000 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2060c.outbound.protection.outlook.com [2a01:111:f400:7ea9::60c]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 5761ee32-1a1b-11ef-90a1-e314d9c70b13; Sat, 25 May 2024 00:17:00 +0200 (CEST) Received: from DM5PR08CA0042.namprd08.prod.outlook.com (2603:10b6:4:60::31) by PH0PR12MB7888.namprd12.prod.outlook.com (2603:10b6:510:28b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.22; Fri, 24 May 2024 22:16:51 +0000 Received: from CY4PEPF0000FCC4.namprd03.prod.outlook.com (2603:10b6:4:60:cafe::a8) by DM5PR08CA0042.outlook.office365.com (2603:10b6:4:60::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.22 via Frontend Transport; Fri, 24 May 2024 22:16:50 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000FCC4.mail.protection.outlook.com (10.167.242.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7611.14 via Frontend Transport; Fri, 24 May 2024 22:16:50 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 24 May 2024 17:16:49 -0500 Received: from smtp.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Fri, 24 May 2024 17:16:48 -0500 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: 5761ee32-1a1b-11ef-90a1-e314d9c70b13 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HglzBUSu0Q3uLWrJxDq4dyGWmR3pEAjys9pbN6rERGCSdO8hH/HEyQ1/N0Ni3LIeYLlkglg981luM1UuEDf+b6fIlgkRvFNTcD9MA47iYzppFucr2Qlx5kC/e819XcBXvW9rPmFkxwjKHAsurg21PEGevJfH+dGhFa0wfBL/Ew8A944cI5DRopBnbc13FIh4Na3Qsnhv2jXynWcKDezjNDR6U34EWAvfAf4Mvx9lbouLHuhxuOtY7M3XLi9EDjZsPE5rVLv1DV2Wf/7EQOnuuUGOsI4WqYoqvKb6sYjlu0bCCzUOYUferjo/z2KujU2Y5tS0bYaOFR83xoOs9uXktg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=xRJXSt/i9q6c1C8Y7abmDgKw7TBf2B9wiQ/rWE+b2Go=; b=D/JdGi+CtOOBbF8Anrxl7pSdmvnLsoE+IhUc9SJ9OXzBF+hO3lw6Haf6oVnzRzLCa4nfnNngS7Hu43T0lxLQqHfSL0URPwLQ1OybuI+KVYc/ZPGEMHbuWMVUv46M4uaYMiULFyoNk3wctF9yv3bl8+rAorB1wlBzF0T0wUs3nJ2jx7dT+hD45+5Tm/3OZDPU/cNHOMHrBpgk6/dpj/KYR9YZ6DOqCSbuASM0uPDIy5Fm0BU7i6YrAjLfDG7hGqG+6k5YzbR/TeKkb1oi3nEIR4se4/Ua63Hb4OTQV++50eS/ExcjjBb3dBLe/bBf0z/86Gol1+8Ujfl1uyOsYEg2aw== 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=xRJXSt/i9q6c1C8Y7abmDgKw7TBf2B9wiQ/rWE+b2Go=; b=kyEbJu5MxFV3zc8+DDSkzY2Gt4n/wMqXF4TCPw+k6xPNtV9FdJAKdUFOjmNdC191AgLFovxVICh/8BWZtLVLXSkYy/F4qu2IjMBIwZhnED4PFn3C3QZmlrd+rrqRbjY5/yqErTrY0VMJKJAEsq5j4rgombQNFg6+rQ46Y6TG9nA= 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=SATLEXMB04.amd.com; pr=C From: Stefano Stabellini To: CC: , , , , , , Henry Wang , Julien Grall Subject: [PATCH v6 2/7] xen/arm, doc: Add a DT property to specify IOMMU for Dom0less domUs Date: Fri, 24 May 2024 15:16:42 -0700 Message-ID: <20240524221647.2860711-2-stefano.stabellini@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: None (SATLEXMB04.amd.com: stefano.stabellini@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCC4:EE_|PH0PR12MB7888:EE_ X-MS-Office365-Filtering-Correlation-Id: c2982c3e-5f43-45cf-85fd-08dc7c3f359e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|36860700004|376005|1800799015|82310400017; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?VnEuSgH1Nm9hpjmMVJ2Ssfx+PXLQKIGbFygjMcZWfXmTX6CZwojlSidlxN8e?= =?us-ascii?Q?EKmu7MIaZFZd1EgPWGpaJItUmEz/oTpI+vCib6LJLfpVkhucRFFLdRM22cT2?= =?us-ascii?Q?lvFhaNWgMvKr/d0LinGaY2RmTOJB+XzlJDdBe1FJ99mo3/xbAbjLq6tFKJNh?= =?us-ascii?Q?54AkGtA0c1AgDZoToClT9VtYrl949DVZxt8YfZjKio8QDHtcPXGiKs2kXBDi?= =?us-ascii?Q?qbsM83ju+J522cZpG8kmJuz18/4XmSKeRulnlY4XIto4lsfTeKNuDF1NWU74?= =?us-ascii?Q?LgDq2FXA+j88/uXig5QGpZRuVRBM6q6KXoFf/BfXxj4KxdfAS6QwYF0mW1XX?= =?us-ascii?Q?fAi9vyf2pPs03ZyjMearB/kuRZeh1qo64Bc8qWyg6d/Wen7ohzO8AyAA1egE?= =?us-ascii?Q?EBoukhdxuvPztyLuVpb4urhPSTmkTmiSpzPd8JOVKXinojs3Bo8dwicFs61b?= =?us-ascii?Q?sWFpzsFmtPp6GjXrkBHiDiRDrrfTxBP3/MqVGa0i5CkIyN+vT9A3usprz96z?= =?us-ascii?Q?xKrPpS921mOyeWomn8VuegPyipqvGUZPp8VvyF+XDjhCd4cG1vPqUOfWU7Bz?= =?us-ascii?Q?2tUL97e8ubOSS/yss7syRmtrf5utsVO51Vp63RzZdS7taEcqg61QmH0G7/4c?= =?us-ascii?Q?ZR5u0dlZZmm6IkyeLsi/OayOY0kgxHbKPCgBL2dcAIinJlk56zctwgPcD6YT?= =?us-ascii?Q?T27bS82XfdiHk1AZ5+Po+f00bfpEfNbroqxjgKfdzJpNeZd4CT4E59KPHwzN?= =?us-ascii?Q?TialEmqMXu+ZUpP3pX1yaKtoGftqY8LP0rfZDWv5V/Nx6kwbMR3C/laqFaSc?= =?us-ascii?Q?ll0162PheXCZjSjOKkTXoWvlHnjD97HTcORnQZ0LtDPyk66g1J+UXC8/dE7b?= =?us-ascii?Q?Zj2U4xu+KdsaGViGw3pA7PuXW3V2M9hpOHP+0wORWfmvQ290oXJFkf/MvIrW?= =?us-ascii?Q?3dGQfbxlcAtD4iwgswkLMdsv04ZAHaArU1d6a7zCG7aO2gIX7oEiJIMmnsyj?= =?us-ascii?Q?hAJYdvjPyVEviZmVqxkolrKo4U8jkXar/oXXMq/DY4/GyE/U3LtaOLn8QQ+J?= =?us-ascii?Q?dq/OfG4Zx+5KoUBEC+/Ik/YKe11c8pwi2vgpmtwukpVTPw9Rbftu63Zxz0zq?= =?us-ascii?Q?DwTKIsmyIlpqvdOJ8np03B2bv+SzNPyCBU0q9mxkq/GbgDYhhrBXV+PEEmqy?= =?us-ascii?Q?UwS1pXk+FppK9hLLu+1MbMOP1QBaa6Eh/nbcforwtQbGwsEQxiLAEJ4xHDHy?= =?us-ascii?Q?wGsyKWSbTZf+gmN9WDMqavy7dcK3CEfqcvGHw0dwZ2UxlUrhloj+Yld9h2xh?= =?us-ascii?Q?wXhSOUjdMEH0hslYOF7fu3aJnM/49ZcCOhKf3TVtjvFeJVEHam5dzp0K62Dc?= =?us-ascii?Q?fE/pDOwDhJiFBIt08duxCU2T2NTZ?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(36860700004)(376005)(1800799015)(82310400017);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2024 22:16:50.3039 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c2982c3e-5f43-45cf-85fd-08dc7c3f359e 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000FCC4.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7888 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1716589045092100005 Content-Type: text/plain; charset="utf-8" From: Henry Wang There are some use cases in which the dom0less domUs need to have the XEN_DOMCTL_CDF_iommu set at the domain construction time. For example, the dynamic dtbo feature allows the domain to be assigned a device that is behind the IOMMU at runtime. For these use cases, we need to have a way to specify the domain will need the IOMMU mapping at domain construction time. Introduce a "passthrough" DT property for Dom0less DomUs following the same entry as the xl.cfg. Currently only provide two options, i.e. "enable" and "disable". Set the XEN_DOMCTL_CDF_iommu at domain construction time based on the property. Signed-off-by: Henry Wang Reviewed-by: Julien Grall --- docs/misc/arm/device-tree/booting.txt | 16 ++++++++++++++++ xen/arch/arm/dom0less-build.c | 11 +++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/docs/misc/arm/device-tree/booting.txt b/docs/misc/arm/device-t= ree/booting.txt index bbd955e9c2..f1fd069c87 100644 --- a/docs/misc/arm/device-tree/booting.txt +++ b/docs/misc/arm/device-tree/booting.txt @@ -260,6 +260,22 @@ with the following properties: value specified by Xen command line parameter gnttab_max_maptrack_fram= es (or its default value if unspecified, i.e. 1024) is used. =20 +- passthrough + + A string property specifying whether IOMMU mappings are enabled for the + domain and hence whether it will be enabled for passthrough hardware. + Possible property values are: + + - "enabled" + IOMMU mappings are enabled for the domain. Note that this option is the + default if the user provides the device partial passthrough device tree + for the domain. + + - "disabled" + IOMMU mappings are disabled for the domain and so hardware may not be + passed through. This option is the default if this property is missing + and the user does not provide the device partial device tree for the d= omain. + Under the "xen,domain" compatible node, one or more sub-nodes are present for the DomU kernel and ramdisk. =20 diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c index 74f053c242..5830a7051d 100644 --- a/xen/arch/arm/dom0less-build.c +++ b/xen/arch/arm/dom0less-build.c @@ -848,6 +848,8 @@ static int __init construct_domU(struct domain *d, void __init create_domUs(void) { struct dt_device_node *node; + const char *dom0less_iommu; + bool iommu =3D false; const struct dt_device_node *cpupool_node, *chosen =3D dt_find_node_by_path("/chosen"= ); =20 @@ -895,8 +897,13 @@ void __init create_domUs(void) panic("Missing property 'cpus' for domain %s\n", dt_node_name(node)); =20 - if ( dt_find_compatible_node(node, NULL, "multiboot,device-tree") = && - iommu_enabled ) + if ( !dt_property_read_string(node, "passthrough", &dom0less_iommu= ) && + !strcmp(dom0less_iommu, "enabled") ) + iommu =3D true; + + if ( iommu_enabled && + (iommu || dt_find_compatible_node(node, NULL, + "multiboot,device-tree")) ) d_cfg.flags |=3D XEN_DOMCTL_CDF_iommu; =20 if ( !dt_property_read_u32(node, "nr_spis", &d_cfg.arch.nr_spis) ) --=20 2.25.1 From nobody Fri Nov 22 14:13:11 2024 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=1716589033; cv=pass; d=zohomail.com; s=zohoarc; b=Y9KfC0W29GLvRaLUUBHi0PchGH1EPsXpH0w2sEcJpXe11HbNo0jyGRyBOzwuFe0rcCqkswlV1Qg9CBzPCIkatJrm3D4t6oDgVrVmbTl40h4gf3RRlVq/a5MKoEcUVRGXVLYcWtKwAxa6XQTEftb5NDItyAzM6iSlrqFYWIRBpB0= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716589033; 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=NlizJg2iClGMdik+Fxv6BQH90USOSUhLLxid+7iVuz0=; b=XgvTvfw34h2hXREidnypcj1ax8HuU4DRzwjIQyCVGKvxbo6m37NqnTT3krqVesjTEcIRj5yOI8fYQ72WxNqqTfnfXf1LlMNBRzRGBGNsQ2NdwQoPr8yJtt8I+aZuFVLANeo32w0WJRwQlPdfhdmiaMbZCUPE/9jofIshjDkLtmI= 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 1716589033198384.55212294282444; Fri, 24 May 2024 15:17:13 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.729886.1135190 (Exim 4.92) (envelope-from ) id 1sAdDe-0007U9-8f; Fri, 24 May 2024 22:16:58 +0000 Received: by outflank-mailman (output) from mailman id 729886.1135190; Fri, 24 May 2024 22:16:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sAdDe-0007TX-4w; Fri, 24 May 2024 22:16:58 +0000 Received: by outflank-mailman (input) for mailman id 729886; Fri, 24 May 2024 22:16:56 +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 1sAdDc-0007Iy-Fr for xen-devel@lists.xenproject.org; Fri, 24 May 2024 22:16:56 +0000 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on20600.outbound.protection.outlook.com [2a01:111:f403:2417::600]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 53c72a6f-1a1b-11ef-90a1-e314d9c70b13; Sat, 25 May 2024 00:16:55 +0200 (CEST) Received: from DM5PR08CA0054.namprd08.prod.outlook.com (2603:10b6:4:60::43) by PH8PR12MB7205.namprd12.prod.outlook.com (2603:10b6:510:227::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.26; Fri, 24 May 2024 22:16:52 +0000 Received: from CY4PEPF0000FCC4.namprd03.prod.outlook.com (2603:10b6:4:60:cafe::19) by DM5PR08CA0054.outlook.office365.com (2603:10b6:4:60::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.26 via Frontend Transport; Fri, 24 May 2024 22:16:51 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000FCC4.mail.protection.outlook.com (10.167.242.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7611.14 via Frontend Transport; Fri, 24 May 2024 22:16:51 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 24 May 2024 17:16:50 -0500 Received: from smtp.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Fri, 24 May 2024 17:16:49 -0500 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: 53c72a6f-1a1b-11ef-90a1-e314d9c70b13 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CTzZuTGnG5+05W5Uf1a//3vm5/5e2izw06KDCV27HWIBe8C0mueHPbJEf61VdJYE2h/EQDbk5cHJmxBuWViFhsbLc1TRVxjqlhVQ3O+JscEXBzvsjcMHxBe8zUteq/eVg3zEVfn7yO8+h25hUX6mX9+Fl5aLT0yusC88UQbnbEvhDdWTtjwLB1O8Eepmr1btqpKQsv4N8Gtx2zMJpuwaoSUWdzDUd+ywW87OXCarIwUghPUBynQukRbNrRaNnyOorhxwyOAnJsy2ByQrBA08uIlWUAE/JOqwp7GALbmOcuBYrWEDPMyHEyI08WJInsb55N2qeN8AJpEYXawVaD2PLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=NlizJg2iClGMdik+Fxv6BQH90USOSUhLLxid+7iVuz0=; b=Ej/sc3hrLkuTD/ZOdBItZcOTZgCvZkgb14atfgI2HWOGx2Hlr9dTAJBAQoHiimYxLdpzkKy7cHEMpFf6EkT7slTVllV/crg4av+54S19jgWryPTrzhb0rj4fo8i3C3mRIbTDPnHjIuim6NDdjhpg0wGTe+slmOLob0t920A5JL8eAT1JGzx36RcY2JbD2P7OUft3I6SrrtGN3UtAa7nhqg+XKIbNEGokDox64xcT7Z83lu55pMPnoW21yHPOHIN02vCdEkrIHVXRr66QbrQ7kMfJOWWtEllMMrozwjh1WTYC44C1QgbyN7Wjbd0EKhosghoQIbQe0NoYtpnzWpBtPw== 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=NlizJg2iClGMdik+Fxv6BQH90USOSUhLLxid+7iVuz0=; b=2dQAv7rvWO8m5WNGBKOKSy9yTmkfMUtvBuJYnKqkD8u4hGBbRVxAkt9Ww7puLpDeAHHdXohRQfLe541nZPmSGoQqjkCk++kuG5b2ratM2PZY8VdygRyOqI6DOBq2MRCfHR7IP+hgcfyx4tiUVjpkFCo9/AHXbnK7RcF+XxX85UA= 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=SATLEXMB04.amd.com; pr=C From: Stefano Stabellini To: CC: , , , , , , Henry Wang , "Stefano Stabellini" , Jason Andryuk Subject: [PATCH v6 3/7] tools/arm: Introduce the "nr_spis" xl config entry Date: Fri, 24 May 2024 15:16:43 -0700 Message-ID: <20240524221647.2860711-3-stefano.stabellini@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: None (SATLEXMB04.amd.com: stefano.stabellini@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCC4:EE_|PH8PR12MB7205:EE_ X-MS-Office365-Filtering-Correlation-Id: e9ca015d-c878-4a30-07cd-08dc7c3f3643 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|36860700004|376005|1800799015|82310400017; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?OMGWerVL3CvW7SrQ9+jFQR7rc6NW++MjeBSJIczUJ3cIrT1WuiLL/mLyUJj/?= =?us-ascii?Q?Wpu1awTo/LxQNe41fHOQxNhj8fbJmAhLTWtqv8CacRwVFJhFUM1cdlkLEhgI?= =?us-ascii?Q?B1hYz5Gl8/sfKAyv6/rcdSM01BhHLhklG6uh/1k7Aq+AVO8KQ9Ewkv4eLsel?= =?us-ascii?Q?M9Fu8df3AxaOlkFutEz5n7tGWgVv5uzZM+xWJ+yXSf3enZX/FwCZi7hztWge?= =?us-ascii?Q?+HibR6azoD0BviPVMw8j5/WZZPaBrMm8SeeF33AFsj5RrGWIadiGlt3HBAER?= =?us-ascii?Q?FYjbCoNZLdE8hz/JL77erBLq012qpjY3wNlgpGgoMo0s0y/FyAqF5igvUSan?= =?us-ascii?Q?1Y3JknGpqBUhxtAyQ8cLSj2W1qXVDIoHSHXAWYa7pjF7ADBuLfZ3HNgCu/xp?= =?us-ascii?Q?aevzch5SB+nuBaQh222JSdzARflDwd+QEfdq49wZhxV8TrJStP1WZ7NbMG+S?= =?us-ascii?Q?o/wVnjibjfSL9m7HEc82zo/bvxOX8v3WIaOhHpif6eidgJeDTHRhP00Akku8?= =?us-ascii?Q?dTZrqBMH1D3Sn86qmiQxKMFXExSAoSaoKOgsSExsRQ0Ih+CNNr35JzskaCNu?= =?us-ascii?Q?xG1GOLudtHQAgAKjE5NC9TmnNwjiPNos+xUbAMCR4kjvlo0oDgQjmi0G8wo/?= =?us-ascii?Q?evWBeSMbgj7tcZj0h/+av2cAWxtA3Gvf4XCEwi8VC72o7l2Zf/7obynimB+G?= =?us-ascii?Q?Rl4YDu1Khg7BVpHWFd5rfX6jSfM/niN6KCf0i79Ms5rqVBRk5YTSiPf8JS8K?= =?us-ascii?Q?9+Ub0pTympVGJ/qmB64UM91Knb/wMESmDpAf3MfORrGm+D0GRq1xwC7X8nvA?= =?us-ascii?Q?Kmqff43AfePIptfJe6IDawd0BdrKqPneZPaa5JIboHRDqda1C3bl0xIJHvCU?= =?us-ascii?Q?+yeX+MTd/0T+CMzXURCmmunvRQjsK1p5N65cOJ/G3FvIwG1AE5ai+8HP+SOm?= =?us-ascii?Q?SPwuCnf0SKcCmScrUefZrAlYesZZ4jAKbk6hMeikPlYf51OPD3ZG3W2bGIiS?= =?us-ascii?Q?B2cTd4F97ScwGiREx+inlG+zG2Ze0SfEcTt+JSTvMzOvCsa1EzZbVtNtx29L?= =?us-ascii?Q?4As2Itcs75kcrmf5gN1OApJNbrfCUWlK/BEZzwEffrtraJUNyWFpDLI6OLdO?= =?us-ascii?Q?NYY/NUTAiQ/PJhymBRyLTFmx83oA2gw1AMwTBJgU1eXB613qFTzjIg+FklPm?= =?us-ascii?Q?D/n2064WZZEdmKhq6Ax4AK3rh8C+YqlhwhLNiGUkb9PJEKgoI1CeIx4W1qdG?= =?us-ascii?Q?wRGLGLFHivsM1bAEz82uUTaGVZVhWeuUuo1fOzifnjqMggU9bwdOOAWTnpsW?= =?us-ascii?Q?jREUPY54aHGRnKxEQQTXKXYyqAfBv7voQxpGDACVD43w/t/EbSsmcl/aSgLF?= =?us-ascii?Q?6eXMS5A+wKukOrM0l8ltG2APEy1+?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(36860700004)(376005)(1800799015)(82310400017);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2024 22:16:51.3820 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e9ca015d-c878-4a30-07cd-08dc7c3f3643 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000FCC4.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7205 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1716589035066100003 Content-Type: text/plain; charset="utf-8" From: Henry Wang Currently, the number of SPIs allocated to the domain is only configurable for Dom0less DomUs. Xen domains are supposed to be platform agnostics and therefore the numbers of SPIs for libxl guests should not be based on the hardware. Introduce a new xl config entry for Arm to provide a method for user to decide the number of SPIs. This would help to avoid bumping the `config->arch.nr_spis` in libxl everytime there is a new platform with increased SPI numbers. Update the doc and the golang bindings accordingly. Signed-off-by: Henry Wang Signed-off-by: Stefano Stabellini Reviewed-by: Jason Andryuk --- docs/man/xl.cfg.5.pod.in | 16 ++++++++++++++++ tools/golang/xenlight/helpers.gen.go | 2 ++ tools/golang/xenlight/types.gen.go | 1 + tools/include/libxl.h | 5 +++++ tools/libs/light/libxl_arm.c | 4 ++-- tools/libs/light/libxl_types.idl | 1 + tools/xl/xl_parse.c | 3 +++ 7 files changed, 30 insertions(+), 2 deletions(-) diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in index 8f2b375ce9..ac3f88fd57 100644 --- a/docs/man/xl.cfg.5.pod.in +++ b/docs/man/xl.cfg.5.pod.in @@ -3072,6 +3072,22 @@ raised. =20 =3Dback =20 +=3Dover 4 + +=3Ditem B + +An optional integer parameter specifying the number of SPIs (Shared +Peripheral Interrupts) to allocate for the domain. Max is 991 SPIs. If +the value specified by the `nr_spis` parameter is smaller than the +number of SPIs calculated by the toolstack based on the devices +allocated for the domain, or the `nr_spis` parameter is not specified, +the value calculated by the toolstack will be used for the domain. +Otherwise, the value specified by the `nr_spis` parameter will be used. +The number of SPIs should match the highest interrupt ID that will be +assigned to the domain. + +=3Dback + =3Dhead3 x86 =20 =3Dover 4 diff --git a/tools/golang/xenlight/helpers.gen.go b/tools/golang/xenlight/h= elpers.gen.go index b9cb5b33c7..fe5110474d 100644 --- a/tools/golang/xenlight/helpers.gen.go +++ b/tools/golang/xenlight/helpers.gen.go @@ -1154,6 +1154,7 @@ return fmt.Errorf("invalid union key '%v'", x.Type)} x.ArchArm.GicVersion =3D GicVersion(xc.arch_arm.gic_version) x.ArchArm.Vuart =3D VuartType(xc.arch_arm.vuart) x.ArchArm.SveVl =3D SveType(xc.arch_arm.sve_vl) +x.ArchArm.NrSpis =3D uint32(xc.arch_arm.nr_spis) if err :=3D x.ArchX86.MsrRelaxed.fromC(&xc.arch_x86.msr_relaxed);err !=3D = nil { return fmt.Errorf("converting field ArchX86.MsrRelaxed: %v", err) } @@ -1670,6 +1671,7 @@ return fmt.Errorf("invalid union key '%v'", x.Type)} xc.arch_arm.gic_version =3D C.libxl_gic_version(x.ArchArm.GicVersion) xc.arch_arm.vuart =3D C.libxl_vuart_type(x.ArchArm.Vuart) xc.arch_arm.sve_vl =3D C.libxl_sve_type(x.ArchArm.SveVl) +xc.arch_arm.nr_spis =3D C.uint32_t(x.ArchArm.NrSpis) if err :=3D x.ArchX86.MsrRelaxed.toC(&xc.arch_x86.msr_relaxed); err !=3D n= il { return fmt.Errorf("converting field ArchX86.MsrRelaxed: %v", err) } diff --git a/tools/golang/xenlight/types.gen.go b/tools/golang/xenlight/typ= es.gen.go index 5b293755d7..c9e45b306f 100644 --- a/tools/golang/xenlight/types.gen.go +++ b/tools/golang/xenlight/types.gen.go @@ -597,6 +597,7 @@ ArchArm struct { GicVersion GicVersion Vuart VuartType SveVl SveType +NrSpis uint32 } ArchX86 struct { MsrRelaxed Defbool diff --git a/tools/include/libxl.h b/tools/include/libxl.h index 62cb07dea6..a3d05c840b 100644 --- a/tools/include/libxl.h +++ b/tools/include/libxl.h @@ -308,6 +308,11 @@ */ #define LIBXL_HAVE_BUILDINFO_ARCH_ARM_SVE_VL 1 =20 +/* + * libxl_domain_build_info has the arch_arm.nr_spis field + */ +#define LIBXL_HAVE_BUILDINFO_ARCH_NR_SPIS 1 + /* * LIBXL_HAVE_SOFT_RESET indicates that libxl supports performing * 'soft reset' for domains and there is 'soft_reset' shutdown reason diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c index 1cb89fa584..a4029e3ac8 100644 --- a/tools/libs/light/libxl_arm.c +++ b/tools/libs/light/libxl_arm.c @@ -181,8 +181,8 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc, =20 LOG(DEBUG, "Configure the domain"); =20 - config->arch.nr_spis =3D nr_spis; - LOG(DEBUG, " - Allocate %u SPIs", nr_spis); + config->arch.nr_spis =3D max(nr_spis, d_config->b_info.arch_arm.nr_spi= s); + LOG(DEBUG, " - Allocate %u SPIs", config->arch.nr_spis); =20 switch (d_config->b_info.arch_arm.gic_version) { case LIBXL_GIC_VERSION_DEFAULT: diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_type= s.idl index 79e9c656cc..4e65e6fda5 100644 --- a/tools/libs/light/libxl_types.idl +++ b/tools/libs/light/libxl_types.idl @@ -722,6 +722,7 @@ libxl_domain_build_info =3D Struct("domain_build_info",[ ("arch_arm", Struct(None, [("gic_version", libxl_gic_version), ("vuart", libxl_vuart_type), ("sve_vl", libxl_sve_type), + ("nr_spis", uint32), ])), ("arch_x86", Struct(None, [("msr_relaxed", libxl_defbool), ])), diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c index c504ab3711..e3a4800f6e 100644 --- a/tools/xl/xl_parse.c +++ b/tools/xl/xl_parse.c @@ -2935,6 +2935,9 @@ skip_usbdev: } } =20 + if (!xlu_cfg_get_long (config, "nr_spis", &l, 0)) + b_info->arch_arm.nr_spis =3D l; + parse_vkb_list(config, d_config); =20 d_config->virtios =3D NULL; --=20 2.25.1 From nobody Fri Nov 22 14:13:11 2024 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=1716589036; cv=pass; d=zohomail.com; s=zohoarc; b=ncV73vf7UdjM9P8MbzVRqSv0lzwIKUbgCOxVqKwqRjKU4qQNYXmyq7bKlL44t9Oj8ltVBPKgGBv4xRJ3ovMa5LwkqWdGPSxOJKhn+b7+6DFeXZiwP/s8a/JFEGg62yWijkjRDsZTWjRTgPVv5DsAkIQB59kxay7ORztyYtBfE3s= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716589036; 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=dUxLvykGPrn0TdFclj7NWwLQlt3XRena1NmCNYfl8WY=; b=FDmnt2mNaIEjl4381agmysQdxDGslFep5SfsJ/ZXhl+Wkqa7wNqwZfgXDrrw3VT06idkoPlpUCwZ70GN+7vtXnzkBfA03VCtb5pJJpu1v6BtAhiNIDvoxT6smaaD2TS3gqRwatunQFFvTgPvmuGCVJjCMlpU2t7jKi5zJMerLHA= 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 171658903625068.94606044853504; Fri, 24 May 2024 15:17:16 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.729888.1135209 (Exim 4.92) (envelope-from ) id 1sAdDf-0007z0-Oq; Fri, 24 May 2024 22:16:59 +0000 Received: by outflank-mailman (output) from mailman id 729888.1135209; Fri, 24 May 2024 22:16: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 1sAdDf-0007yQ-LT; Fri, 24 May 2024 22:16:59 +0000 Received: by outflank-mailman (input) for mailman id 729888; Fri, 24 May 2024 22:16:58 +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 1sAdDe-0007Iy-Ni for xen-devel@lists.xenproject.org; Fri, 24 May 2024 22:16:58 +0000 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on20601.outbound.protection.outlook.com [2a01:111:f403:2418::601]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 5588d913-1a1b-11ef-90a1-e314d9c70b13; Sat, 25 May 2024 00:16:58 +0200 (CEST) Received: from DM5PR08CA0025.namprd08.prod.outlook.com (2603:10b6:4:60::14) by IA1PR12MB6329.namprd12.prod.outlook.com (2603:10b6:208:3e5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.19; Fri, 24 May 2024 22:16:52 +0000 Received: from CY4PEPF0000FCC4.namprd03.prod.outlook.com (2603:10b6:4:60:cafe::fb) by DM5PR08CA0025.outlook.office365.com (2603:10b6:4:60::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.26 via Frontend Transport; Fri, 24 May 2024 22:16:52 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000FCC4.mail.protection.outlook.com (10.167.242.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7611.14 via Frontend Transport; Fri, 24 May 2024 22:16:52 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 24 May 2024 17:16:50 -0500 Received: from smtp.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Fri, 24 May 2024 17:16:50 -0500 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: 5588d913-1a1b-11ef-90a1-e314d9c70b13 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HzIcS/jnelNSjX5wmxlhAnjjAVdohjceaUs9ETjTs5Y+YhOn5igMhInyZZ/EJ1Z5OoyDnhq2SMISzSjRBTq/+cUPxEH3lZbK5XEjt/JwccDSRf9rmelHCz4ggiuWYMtc2nVFk1njrZXcsdZI5MSihSFhnP14iqlYo9BJRlaGYluzA9VivtjA+/3Asn+yb9ZT8nu0N3ZZGo5Hov8q+TD581ijD8qVrZfMXPKZvn3Tp2Lw0pWzgBtNvQJFyOnSddHp6X/XfQJLKRFgdSAGpHzgeCb0UBuIhYUz5ESy+YIXxPAkfx50U7P/thQgPDB1uGfdGIzBODRKXUEoZUkS7V633g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=dUxLvykGPrn0TdFclj7NWwLQlt3XRena1NmCNYfl8WY=; b=kaBZAr3pU4zrWLveeJm1a1tA0bhHgywJpIeS2nRlAMsHHPnTJeKbx+u3YG2Pqyzn+HE5DXvXqltQn5BiYZSWcspoUKcW/eoS1Rz9lruKIWqN6pqS19KZPQOOfHaYjyE/3LH4lVsTubjnrv1dQXT7y+EraAfPBMhJhPGeSM4Btp1YjMZU4q80fv4SSJC8GoWBHHv7IUhUTFabCTVk/06YJO0+CPf92nxT9/m/gse05/uOd9X0S1Vez58Ejez0OYdCuO91mmCaHo3AakoNWO+IvjGJS5D/dNfQClZnNP1/f2LR1fJSJBMNnts345dJBeNcf8Xnmz0vJcFh9/d/K0QhMg== 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=dUxLvykGPrn0TdFclj7NWwLQlt3XRena1NmCNYfl8WY=; b=44iYRey/bQX/UqeeEG1oty/E0pXIS2Fa5yCEm5zFSJpI1TQ3ebtVDkmsiqfC6Lc7UokVtlM7RN6rsBvknALGs40MWSpr3MX7bbXf5Vk59Cxdt3q2PYsyZeym4Zg3vJUjxwIqkVhi5uz+oM3P2rWH9t94E3sxwFly/JsKwx3a/sw= 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=SATLEXMB04.amd.com; pr=C From: Stefano Stabellini To: CC: , , , , , , Henry Wang , "Stefano Stabellini" , Julien Grall Subject: [PATCH v6 4/7] xen/arm/gic: Allow adding interrupt to running VMs Date: Fri, 24 May 2024 15:16:44 -0700 Message-ID: <20240524221647.2860711-4-stefano.stabellini@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: None (SATLEXMB04.amd.com: stefano.stabellini@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCC4:EE_|IA1PR12MB6329:EE_ X-MS-Office365-Filtering-Correlation-Id: e3ffe385-56df-4e60-27c3-08dc7c3f36e5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|82310400017|376005|36860700004; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?x7bV7ZqjgUF7VWv5tEb0t7r9/1QAF3128hqXshja0lxs7s/Tn52FXT3oFHsS?= =?us-ascii?Q?ZT2zhsIwWX9WmVCIbeyGtfYr8jPZjh1JEYvQdtmOoATSEVTGHSBJMLJ2UoVG?= =?us-ascii?Q?j6dUkA4J0WItM5O/5BecsfapkAmTqG9XKMGWl/VOXpSRhSUTcP3FOtyHlxKF?= =?us-ascii?Q?dpJBx2XkgtsfaDeptG0jvlTVzj7kfIPkaFQJKX/TUy27EvTt0143HRTQExXm?= =?us-ascii?Q?BhRH/YDC4bD1Cw/Zs0MRzkxOwVPOzQUmprIMGNWY8+O/76vMs6x03QS/X5if?= =?us-ascii?Q?tlL27RkOWIALa9YBK3rFGVxyXZsgLEbndrDAntOMgxAWxfpiGtXHygvUybX6?= =?us-ascii?Q?EjchwqpbJVmQ+t62P5McG3mK+lFyL6awNcJJSTaYfewSJSFd3Z1jQwOSyRdc?= =?us-ascii?Q?cQvnaOuXa3snhaMz2R7c0K2OsU/loLa2i3BkiYYa00oTrrA/AamDNVtvk4xV?= =?us-ascii?Q?tA7x1TC+kuBQVRboW/EdhySZxNBZCeZ/d/QmGSpbKfuKtzY/SetOSN0fOWLU?= =?us-ascii?Q?qRLe9jvHdH02rYu17zOatsvltddMKd7TpUX7vwp1H+fzWF29NRtylfYKI2P5?= =?us-ascii?Q?A8z5zNFVnE1KC1YPtVCDuYAV0IpxPeeJmUlCQJGpUtL6JoVwVSqul8DnBo9w?= =?us-ascii?Q?XXoDUeCq2KHVGDGfajg59FAGsK2PPUB+yoUVbnUu8jzx6YbICMJJrOl+flCM?= =?us-ascii?Q?nUwXkUeRQLgiS+9aubFdVsFAJZcSVsA/EaZLt2TPQdxEPG3JI6Lu55MG8+AS?= =?us-ascii?Q?y/I3ST/A9pbVxZem8uNBcgNRJQcYCgz+qP4UcqAsExXn5rw/Dvdy2XlD3B93?= =?us-ascii?Q?+fJ2yu7bOaT8JHNpNGbYseCEAigDJekk9IDr3d+UT1AZnSSUjy5FMTuy2jMF?= =?us-ascii?Q?8HZbr71te46vq01pgwrvo/6WrYLkQOjaNbuEqSniqbYdbqdF45cxq1JRqNG+?= =?us-ascii?Q?r5jbCzBWQo6lmNogYCUk4LIQFJkazvrl5T/Qzc1GOsCz3wpj4rxN5ZDWzMsI?= =?us-ascii?Q?5aPUQlrM5ZvqkBsvoDNQRR791iDpT7C/T5+Lq0t12xZx+wPgFjQegNFI5wlk?= =?us-ascii?Q?3a7laNehWr2PjvNShs/LIG8VQNzFlRrB/jZ1CB2vCZxZy1rWHtsvwqTMGa5u?= =?us-ascii?Q?eK+POV4b4FBwTdtAiZQQm6jnuEDu+BrK4ipwsZYFpyQAn1TsWTAJWB+1y7GK?= =?us-ascii?Q?fZwqxTtc+MqneLz/2aNx4tdUuHp9MtexrJV/Ocrv0V4YbwPD5vans9K4JpQw?= =?us-ascii?Q?wjvMBa3vq3gaEESRQDESTPL/eGk4hpcZ6F7qXcXGwg11p3aP/E04qgUNGb6J?= =?us-ascii?Q?zrRnnZk9EEW/qVxAOdiMjmIbeMzAEO1oWAnL4u1hUkjYlo+DRZlhuSt336uG?= =?us-ascii?Q?QBeB9YOLN2h+QucIJMfIDN+Yl49R?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(1800799015)(82310400017)(376005)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2024 22:16:52.4601 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e3ffe385-56df-4e60-27c3-08dc7c3f36e5 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000FCC4.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6329 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1716589037076100005 Content-Type: text/plain; charset="utf-8" From: Henry Wang Currently, adding physical interrupts are only allowed at the domain creation time. For use cases such as dynamic device tree overlay addition, the adding of physical IRQ to running domains should be allowed. Drop the above-mentioned domain creation check. Since this will introduce interrupt state unsync issues for cases when the interrupt is active or pending in the guest, therefore for these cases we simply reject the operation. Do it for both new and old vGIC implementations. Signed-off-by: Henry Wang Signed-off-by: Stefano Stabellini Reviewed-by: Julien Grall --- xen/arch/arm/gic-vgic.c | 9 +++++++-- xen/arch/arm/gic.c | 8 -------- xen/arch/arm/vgic/vgic.c | 7 +++++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/xen/arch/arm/gic-vgic.c b/xen/arch/arm/gic-vgic.c index 56490dbc43..b99e287224 100644 --- a/xen/arch/arm/gic-vgic.c +++ b/xen/arch/arm/gic-vgic.c @@ -442,9 +442,14 @@ int vgic_connect_hw_irq(struct domain *d, struct vcpu = *v, unsigned int virq, =20 if ( connect ) { - /* The VIRQ should not be already enabled by the guest */ + /* + * The VIRQ should not be already enabled by the guest nor + * active/pending in the guest. + */ if ( !p->desc && - !test_bit(GIC_IRQ_GUEST_ENABLED, &p->status) ) + !test_bit(GIC_IRQ_GUEST_ENABLED, &p->status) && + !test_bit(GIC_IRQ_GUEST_VISIBLE, &p->status) && + !test_bit(GIC_IRQ_GUEST_ACTIVE, &p->status) ) p->desc =3D desc; else ret =3D -EBUSY; diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index 44c40e86de..b3467a76ae 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -135,14 +135,6 @@ int gic_route_irq_to_guest(struct domain *d, unsigned = int virq, ASSERT(virq < vgic_num_irqs(d)); ASSERT(!is_lpi(virq)); =20 - /* - * When routing an IRQ to guest, the virtual state is not synced - * back to the physical IRQ. To prevent get unsync, restrict the - * routing to when the Domain is been created. - */ - if ( d->creation_finished ) - return -EBUSY; - ret =3D vgic_connect_hw_irq(d, NULL, virq, desc, true); if ( ret ) return ret; diff --git a/xen/arch/arm/vgic/vgic.c b/xen/arch/arm/vgic/vgic.c index b9463a5f27..6cabd0496d 100644 --- a/xen/arch/arm/vgic/vgic.c +++ b/xen/arch/arm/vgic/vgic.c @@ -876,8 +876,11 @@ int vgic_connect_hw_irq(struct domain *d, struct vcpu = *vcpu, =20 if ( connect ) /* assign a mapped IRQ */ { - /* The VIRQ should not be already enabled by the guest */ - if ( !irq->hw && !irq->enabled ) + /* + * The VIRQ should not be already enabled by the guest nor + * active/pending in the guest. + */ + if ( !irq->hw && !irq->enabled && !irq->active && !irq->pending_la= tch ) { irq->hw =3D true; irq->hwintid =3D desc->irq; --=20 2.25.1 From nobody Fri Nov 22 14:13:11 2024 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=1716589041; cv=pass; d=zohomail.com; s=zohoarc; b=EZ8ruy+uJZKTJpeyFgDLOmNPRGzAN1gSnOqqvbZbtSWrJYxttFzeni7o5pX9L+vhxjS6RMGsXzhdZN3wFynazQ9N8xQ4gt/Ay1Kvy9oVNKlA7IUfnYBUSwbfsWvnHpSusJRLQy7PNP+rkMEf6H+HGJF1Tpz9yTWj3KzAlWa9QLI= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716589041; 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=iRI1HqDlL5ZdxdN/WlhV5sNzuCLmoN3HyEJY9Ux8c04=; b=Mxaj7dZxL4j8Qm5Xs/OwI38+adBRfK+Y9JPoWlwpVg/OOqkdpIJXsbIv7fJyolbC4qd5ez43j/qZbUh7eUcLKzGC7iCG46d+CH48OQadzuQ8IkyoTCtow2Z9R62nZmbVPQ82OwwYAEz2El820TUKSbLeTkKysxuRE6QjL+QxyH8= 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 1716589041267637.969099742205; Fri, 24 May 2024 15:17:21 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.729889.1135220 (Exim 4.92) (envelope-from ) id 1sAdDi-0008Gq-5g; Fri, 24 May 2024 22:17:02 +0000 Received: by outflank-mailman (output) from mailman id 729889.1135220; Fri, 24 May 2024 22:17:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sAdDi-0008Gh-2D; Fri, 24 May 2024 22:17:02 +0000 Received: by outflank-mailman (input) for mailman id 729889; Fri, 24 May 2024 22:17:01 +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 1sAdDg-0007Iy-S2 for xen-devel@lists.xenproject.org; Fri, 24 May 2024 22:17:00 +0000 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2060d.outbound.protection.outlook.com [2a01:111:f400:7ea9::60d]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 55fd81fe-1a1b-11ef-90a1-e314d9c70b13; Sat, 25 May 2024 00:16:59 +0200 (CEST) Received: from DM5PR08CA0054.namprd08.prod.outlook.com (2603:10b6:4:60::43) by DM4PR12MB8497.namprd12.prod.outlook.com (2603:10b6:8:180::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.22; Fri, 24 May 2024 22:16:53 +0000 Received: from CY4PEPF0000FCC4.namprd03.prod.outlook.com (2603:10b6:4:60:cafe::38) by DM5PR08CA0054.outlook.office365.com (2603:10b6:4:60::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.26 via Frontend Transport; Fri, 24 May 2024 22:16:53 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000FCC4.mail.protection.outlook.com (10.167.242.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7611.14 via Frontend Transport; Fri, 24 May 2024 22:16:53 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 24 May 2024 17:16:51 -0500 Received: from smtp.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Fri, 24 May 2024 17:16:51 -0500 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: 55fd81fe-1a1b-11ef-90a1-e314d9c70b13 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QeXeaYcAhNT879ugktFaQEjg1g4Ny4UwtfkPJYFyGHHUPBiIoVj/1eGGjO4K9msD5Ugabtoku1MuSVCWyuAJnpP4BdUgZ3KkcN7opchHjnxMfDpEYEXga7XaZqckEDOvLSyWunA3+bWtSouL0psh5VXLX477W+Rfku61Ik7T7ip3SwcOv+8i70QXAV9C1YmKWqRmuiBVDABmSDy0BmgN5U4koNOfibBJ4FDMOvY5qWd5hC7Y2rBQIHONOLJaQvlPF7+qwsp+/+Bbl830bzFNfu2cQpeCEHXhklQzlnlkCxaM3nVGHZrJP06G8zfY26c760ry+mT/p6N+hjFXi8RyDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=iRI1HqDlL5ZdxdN/WlhV5sNzuCLmoN3HyEJY9Ux8c04=; b=lDe0INtBJnnPmVzEUEdO//GSBkgnnZlKn/fMvZzbAqqQ/jA77GeWGMf310HhcgB02GpF+1oK/VtiaFNqQjMEccYPa2/b9ljEa8hcaBKh1A8N/4qy5Kw3IE82P4GEkcRplOha8SlgWwuqSaT185IUYLOXTIVTPT4LjgsspWfxtiVgNpNVbQXBqNtXmYtPbBsGkCjJo/BCN1I/1LUN8cCgx+AgV0OPSWPkhBaPe3h4ahQT0zidzlLy2MueiXfupGhfKGJpRBalM5eTWDn2dsTynVBkCLS8VptHBwg8PXmrdTQrLEgL2UJgNVF3fe74QYLQCVEu/13apVunV7yUNWDQGg== 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=iRI1HqDlL5ZdxdN/WlhV5sNzuCLmoN3HyEJY9Ux8c04=; b=Yio6nUeEFewAbh3RSiJLaD1gd/5ZV3efbRgmIDUtM1NtzbpzwIW6BVtx6EDlKmWa644AG9G+E3iGJe1qD+9+ENtnMhYG3mse316E6QvSlqDrM3BbnYFcsynxyS9TGUswiQdKM486EkZemrWjDezDCl0p15D4sTF4zO5XYzsQvKY= 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=SATLEXMB04.amd.com; pr=C From: Stefano Stabellini To: CC: , , , , , , Henry Wang , Vikram Garhwal , Stefano Stabellini Subject: [PATCH v6 5/7] xen/arm: Add XEN_DOMCTL_dt_overlay and device attachment to domains Date: Fri, 24 May 2024 15:16:45 -0700 Message-ID: <20240524221647.2860711-5-stefano.stabellini@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: None (SATLEXMB04.amd.com: stefano.stabellini@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCC4:EE_|DM4PR12MB8497:EE_ X-MS-Office365-Filtering-Correlation-Id: 1afe2021-d29c-4367-48ca-08dc7c3f3768 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|376005|36860700004|82310400017; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?0zS8WKN9gYe0mffDjmraAbod5ztY2uhf1w7dACwXABVzCSN+hAdwAfH0lO49?= =?us-ascii?Q?oafYStPymArANWC76Ti9PkC+xxSWfzLBi+2PnLzU7KPXgv0v5vTYo4pUL6RO?= =?us-ascii?Q?/r2QttNSQa4wWd2uTc9rs5ufEEsEx5Ttut/ZKs1w707tUtlj4A9LrKO65xqZ?= =?us-ascii?Q?pZYGuMwAL+EQ4fMGdb2xBBaKKeuwpYvYLengJd175roUoJevBykCbfI6TX1s?= =?us-ascii?Q?Ig2MPrk7lfRguGfLHEf/ijU/4MdPl4jHcAPG5gcf9HTnImdAyrHQbiHyLgsE?= =?us-ascii?Q?rgbkJ4xNgTN8EhYLhVqHGSn/RUGYfxR9BoZFfdwrl9pGtcKesAjpIHvEiN9B?= =?us-ascii?Q?8DHzsNEi+dll2UDJ7TOOZUvP0+sGtdC9bKDripMYSMag7OIjm3DSc1Ap7KUA?= =?us-ascii?Q?r6KuMgqcOS1RklRsbZxG9HtehIPhZDQUdpVrvJatvF1eCOTpdfysu1d4MP4T?= =?us-ascii?Q?b1lnk392S9GIVqIoLnmW31kqlNwIP8bK4XM3jRH31wLdwYwCgwHRZpWFpn/G?= =?us-ascii?Q?AkF4aBdMXs/QU7RUUEHnnCCNwA/ebl1EB2u4X0jI7PfYuTbWSki0/+kXv/l5?= =?us-ascii?Q?Ka1+PKazuapvLg8dMjDA+PtA/IgTpmzggro3KDHbjsJixbENgqzAzFXtn7fe?= =?us-ascii?Q?RSHfSLN39W62GgKONDDPApFKFPpGIb3BtzPkeIBHSHBgyj3g6ouYEK2S5Qja?= =?us-ascii?Q?9iD+ueIeR8hr/fZRwhG8EIZKJ6tcNDU5i49/KhV+CKPFhOp51DZHJ7PArzW3?= =?us-ascii?Q?B9lcner3rE9fuu4h7HDXFsfmPVgYhdTdwP4IGfMj6+F7mPzz0C7R6EdwYvcV?= =?us-ascii?Q?Xn7Fj0hEXFQoIYRpo0xUPLixH8Iiajgi5KxAtwzJldjZM9r6UFuCml5Mopgi?= =?us-ascii?Q?JiVlG0Yog0LBHnco5MqNhrUZ59iqKZ/j60gkRR8Rrf7O5S8OYSF2V36t3X3i?= =?us-ascii?Q?O76+ykXJQbXJKZaZHi1kAUut91rzv5xiEjoLh8NQeCA3r03RaNjO8AMzC1hD?= =?us-ascii?Q?lUNTZJ/WT+I2vE3w6Wf0gBrDqnc3JLGGWW5gsIal1T+D6dGS1H6XR8Fjsan4?= =?us-ascii?Q?HmMY00zRNjNMvcFw8w7P4CKAf3m9nw1VowL47YxCbEbxL7oq/U4rVeO1yQlf?= =?us-ascii?Q?tnsZYL6HxrKUe3c2TicAKNC8EqZXy8AtuhtjARxsyxI2++fP2YnJLee45bdi?= =?us-ascii?Q?vp20hcCZ7BUib4D1d+ZkWNMFm6IgV4N/i83ytL+ItaV+QHarLGwe4mn/rP/b?= =?us-ascii?Q?8wvlvfN5jIfukUJuhFGdVD6e7bBqFo5Cxn8q042xzEZXi68gIvEhyycUe6U+?= =?us-ascii?Q?ciBP/RamkTKvj7S8CCSo9r8z3W84fNsfkUMmXIhWMi79OjPXtwkicdZCyLYd?= =?us-ascii?Q?+Gg2xf4=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(1800799015)(376005)(36860700004)(82310400017);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2024 22:16:53.3039 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1afe2021-d29c-4367-48ca-08dc7c3f3768 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000FCC4.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB8497 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1716589043130100002 Content-Type: text/plain; charset="utf-8" From: Henry Wang In order to support the dynamic dtbo device assignment to a running VM, the add/remove of the DT overlay and the attach/detach of the device from the DT overlay should happen separately. Therefore, repurpose the existing XEN_SYSCTL_dt_overlay to only add the DT overlay to Xen device tree, instead of assigning the device to the hardware domain at the same time. It is OK to change the sysctl behavior as this feature is experimental so changing sysctl behavior and breaking compatibility is OK. Add the XEN_DOMCTL_dt_overlay with operations XEN_DOMCTL_DT_OVERLAY_ATTACH to do the device assignment to the domain. The hypervisor firstly checks the DT overlay passed from the toolstack is valid. Then the device nodes are retrieved from the overlay tracker based on the DT overlay. The attach of the device is implemented by mapping the IRQ and IOMMU resources. All devices in the overlay are assigned to a single domain. Also take the opportunity to make one coding style fix in sysctl.h. Introduce DT_OVERLAY_MAX_SIZE and use it to avoid repetitions of KB(500). xen,reg is to be used to handle non-1:1 mappings but it is currently unsupported. For now return errors for not-1:1 mapped domains. Signed-off-by: Henry Wang Signed-off-by: Vikram Garhwal Signed-off-by: Stefano Stabellini Acked-by: Julien Grall --- xen/arch/arm/domctl.c | 3 + xen/common/dt-overlay.c | 211 ++++++++++++++++++++++++++--------- xen/include/public/domctl.h | 16 ++- xen/include/public/sysctl.h | 11 +- xen/include/xen/dt-overlay.h | 8 ++ 5 files changed, 189 insertions(+), 60 deletions(-) diff --git a/xen/arch/arm/domctl.c b/xen/arch/arm/domctl.c index ad56efb0f5..12a12ee781 100644 --- a/xen/arch/arm/domctl.c +++ b/xen/arch/arm/domctl.c @@ -5,6 +5,7 @@ * Copyright (c) 2012, Citrix Systems */ =20 +#include #include #include #include @@ -176,6 +177,8 @@ long arch_do_domctl(struct xen_domctl *domctl, struct d= omain *d, =20 return rc; } + case XEN_DOMCTL_dt_overlay: + return dt_overlay_domctl(d, &domctl->u.dt_overlay); default: return subarch_do_domctl(domctl, d, u_domctl); } diff --git a/xen/common/dt-overlay.c b/xen/common/dt-overlay.c index 9cece79067..d53b4706cd 100644 --- a/xen/common/dt-overlay.c +++ b/xen/common/dt-overlay.c @@ -15,6 +15,8 @@ #include #include =20 +#define DT_OVERLAY_MAX_SIZE KB(500) + static LIST_HEAD(overlay_tracker); static DEFINE_SPINLOCK(overlay_lock); =20 @@ -356,6 +358,42 @@ static int overlay_get_nodes_info(const void *fdto, ch= ar **nodes_full_path) return 0; } =20 +/* This function should be called with the overlay_lock taken */ +static struct overlay_track * +find_track_entry_from_tracker(const void *overlay_fdt, + uint32_t overlay_fdt_size) +{ + struct overlay_track *entry, *temp; + bool found_entry =3D false; + + ASSERT(spin_is_locked(&overlay_lock)); + + /* + * First check if dtbo is correct i.e. it should one of the dtbo which= was + * used when dynamically adding the node. + * Limitation: Cases with same node names but different property are n= ot + * supported currently. We are relying on user to provide the same dtbo + * as it was used when adding the nodes. + */ + list_for_each_entry_safe( entry, temp, &overlay_tracker, entry ) + { + if ( memcmp(entry->overlay_fdt, overlay_fdt, overlay_fdt_size) =3D= =3D 0 ) + { + found_entry =3D true; + break; + } + } + + if ( !found_entry ) + { + printk(XENLOG_ERR "Cannot find any matching tracker with input dtb= o." + " Operation is supported only for prior added dtbo.\n"); + return NULL; + } + + return entry; +} + /* Check if node itself can be removed and remove node from IOMMU. */ static int remove_node_resources(struct dt_device_node *device_node) { @@ -485,8 +523,7 @@ static long handle_remove_overlay_nodes(const void *ove= rlay_fdt, uint32_t overlay_fdt_size) { int rc; - struct overlay_track *entry, *temp, *track; - bool found_entry =3D false; + struct overlay_track *entry; =20 rc =3D check_overlay_fdt(overlay_fdt, overlay_fdt_size); if ( rc ) @@ -494,29 +531,10 @@ static long handle_remove_overlay_nodes(const void *o= verlay_fdt, =20 spin_lock(&overlay_lock); =20 - /* - * First check if dtbo is correct i.e. it should one of the dtbo which= was - * used when dynamically adding the node. - * Limitation: Cases with same node names but different property are n= ot - * supported currently. We are relying on user to provide the same dtbo - * as it was used when adding the nodes. - */ - list_for_each_entry_safe( entry, temp, &overlay_tracker, entry ) - { - if ( memcmp(entry->overlay_fdt, overlay_fdt, overlay_fdt_size) =3D= =3D 0 ) - { - track =3D entry; - found_entry =3D true; - break; - } - } - - if ( !found_entry ) + entry =3D find_track_entry_from_tracker(overlay_fdt, overlay_fdt_size); + if ( entry =3D=3D NULL ) { rc =3D -EINVAL; - - printk(XENLOG_ERR "Cannot find any matching tracker with input dtb= o." - " Removing nodes is supported only for prior added dtbo.\n"= ); goto out; =20 } @@ -620,15 +638,7 @@ static long add_nodes(struct overlay_track *tr, char *= *nodes_full_path) return -EFAULT; } =20 - rc =3D handle_device(hardware_domain, overlay_node, p2m_mmio_direc= t_c, - tr->iomem_ranges, - tr->irq_ranges); write_unlock(&dt_host_lock); - if ( rc ) - { - printk(XENLOG_ERR "Adding IRQ and IOMMU failed\n"); - return rc; - } =20 /* Keep overlay_node address in tracker. */ tr->nodes_address[j] =3D (unsigned long)overlay_node; @@ -638,9 +648,7 @@ static long add_nodes(struct overlay_track *tr, char **= nodes_full_path) } /* * Adds device tree nodes under target node. - * We use tr->dt_host_new to unflatten the updated device_tree_flattened. = This - * is done to avoid the removal of device_tree generation, iomem regions m= apping - * to hardware domain done by handle_node(). + * We use tr->dt_host_new to unflatten the updated device_tree_flattened. */ static long handle_add_overlay_nodes(void *overlay_fdt, uint32_t overlay_fdt_size) @@ -774,20 +782,6 @@ static long handle_add_overlay_nodes(void *overlay_fdt, goto err; } =20 - tr->irq_ranges =3D rangeset_new(hardware_domain, "Overlays: Interrupts= ", 0); - if (tr->irq_ranges =3D=3D NULL) - { - printk(XENLOG_ERR "Creating IRQ rangeset failed"); - goto err; - } - - tr->iomem_ranges =3D rangeset_new(hardware_domain, "Overlay: I/O Memor= y", 0); - if (tr->iomem_ranges =3D=3D NULL) - { - printk(XENLOG_ERR "Creating IOMMU rangeset failed"); - goto err; - } - rc =3D add_nodes(tr, nodes_full_path); if ( rc ) { @@ -843,14 +837,83 @@ static long handle_add_overlay_nodes(void *overlay_fd= t, xfree(tr->nodes_address); xfree(tr->fdt); =20 - rangeset_destroy(tr->irq_ranges); - rangeset_destroy(tr->iomem_ranges); - xfree(tr); =20 return rc; } =20 +static long handle_attach_overlay_nodes(struct domain *d, + const void *overlay_fdt, + uint32_t overlay_fdt_size) +{ + int rc; + unsigned int j; + struct overlay_track *entry; + + rc =3D check_overlay_fdt(overlay_fdt, overlay_fdt_size); + if ( rc ) + return rc; + + spin_lock(&overlay_lock); + + entry =3D find_track_entry_from_tracker(overlay_fdt, overlay_fdt_size); + if ( entry =3D=3D NULL ) + { + rc =3D -EINVAL; + goto out; + } + + entry->irq_ranges =3D rangeset_new(d, "Overlays: Interrupts", 0); + if (entry->irq_ranges =3D=3D NULL) + { + rc =3D -ENOMEM; + printk(XENLOG_ERR "Creating IRQ rangeset failed"); + goto out; + } + + entry->iomem_ranges =3D rangeset_new(d, "Overlay: I/O Memory", 0); + if (entry->iomem_ranges =3D=3D NULL) + { + rc =3D -ENOMEM; + printk(XENLOG_ERR "Creating IOMMU rangeset failed"); + goto out; + } + + for ( j =3D 0; j < entry->num_nodes; j++ ) + { + struct dt_device_node *overlay_node; + + overlay_node =3D (struct dt_device_node *)entry->nodes_address[j]; + if ( overlay_node =3D=3D NULL ) + { + rc =3D -EINVAL; + goto out; + } + + write_lock(&dt_host_lock); + rc =3D handle_device(d, overlay_node, p2m_mmio_direct_c, + entry->iomem_ranges, entry->irq_ranges); + write_unlock(&dt_host_lock); + if ( rc ) + { + printk(XENLOG_ERR "Adding IRQ and IOMMU failed\n"); + goto out; + } + } + + spin_unlock(&overlay_lock); + + return 0; + + out: + spin_unlock(&overlay_lock); + + rangeset_destroy(entry->irq_ranges); + rangeset_destroy(entry->iomem_ranges); + + return rc; +} + long dt_overlay_sysctl(struct xen_sysctl_dt_overlay *op) { long ret; @@ -860,7 +923,8 @@ long dt_overlay_sysctl(struct xen_sysctl_dt_overlay *op) op->overlay_op !=3D XEN_SYSCTL_DT_OVERLAY_REMOVE ) return -EOPNOTSUPP; =20 - if ( op->overlay_fdt_size =3D=3D 0 || op->overlay_fdt_size > KB(500) ) + if ( op->overlay_fdt_size =3D=3D 0 || + op->overlay_fdt_size > DT_OVERLAY_MAX_SIZE ) return -EINVAL; =20 if ( op->pad[0] || op->pad[1] || op->pad[2] ) @@ -890,6 +954,49 @@ long dt_overlay_sysctl(struct xen_sysctl_dt_overlay *o= p) return ret; } =20 +long dt_overlay_domctl(struct domain *d, struct xen_domctl_dt_overlay *op) +{ + long ret; + void *overlay_fdt; + + if ( op->overlay_op !=3D XEN_DOMCTL_DT_OVERLAY_ATTACH ) + return -EOPNOTSUPP; + + if ( op->overlay_fdt_size =3D=3D 0 || + op->overlay_fdt_size > DT_OVERLAY_MAX_SIZE ) + return -EINVAL; + + if ( op->pad[0] || op->pad[1] || op->pad[2] ) + return -EINVAL; + + /* TODO: add support for non-1:1 domains using xen,reg */ + if ( !is_domain_direct_mapped(d) ) + return -EOPNOTSUPP; + + overlay_fdt =3D xmalloc_bytes(op->overlay_fdt_size); + + if ( overlay_fdt =3D=3D NULL ) + return -ENOMEM; + + ret =3D copy_from_guest(overlay_fdt, op->overlay_fdt, op->overlay_fdt_= size); + if ( ret ) + { + gprintk(XENLOG_ERR, "copy from guest failed\n"); + xfree(overlay_fdt); + + return -EFAULT; + } + + if ( op->overlay_op =3D=3D XEN_DOMCTL_DT_OVERLAY_ATTACH ) + ret =3D handle_attach_overlay_nodes(d, overlay_fdt, op->overlay_fd= t_size); + else + ret =3D -EOPNOTSUPP; + + xfree(overlay_fdt); + + return ret; +} + /* * Local variables: * mode: C diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h index a33f9ec32b..6cd39ea46d 100644 --- a/xen/include/public/domctl.h +++ b/xen/include/public/domctl.h @@ -21,7 +21,7 @@ #include "hvm/save.h" #include "memory.h" =20 -#define XEN_DOMCTL_INTERFACE_VERSION 0x00000016 +#define XEN_DOMCTL_INTERFACE_VERSION 0x00000017 =20 /* * NB. xen_domctl.domain is an IN/OUT parameter for this operation. @@ -1190,6 +1190,16 @@ struct xen_domctl_vmtrace_op { typedef struct xen_domctl_vmtrace_op xen_domctl_vmtrace_op_t; DEFINE_XEN_GUEST_HANDLE(xen_domctl_vmtrace_op_t); =20 +#if defined(__arm__) || defined(__aarch64__) +struct xen_domctl_dt_overlay { + XEN_GUEST_HANDLE_64(const_void) overlay_fdt; /* IN: overlay fdt. */ + uint32_t overlay_fdt_size; /* IN: Overlay dtb size. */ +#define XEN_DOMCTL_DT_OVERLAY_ATTACH 1 + uint8_t overlay_op; /* IN: Attach. */ + uint8_t pad[3]; /* IN: Must be zero. */ +}; +#endif + struct xen_domctl { uint32_t cmd; #define XEN_DOMCTL_createdomain 1 @@ -1277,6 +1287,7 @@ struct xen_domctl { #define XEN_DOMCTL_vmtrace_op 84 #define XEN_DOMCTL_get_paging_mempool_size 85 #define XEN_DOMCTL_set_paging_mempool_size 86 +#define XEN_DOMCTL_dt_overlay 87 #define XEN_DOMCTL_gdbsx_guestmemio 1000 #define XEN_DOMCTL_gdbsx_pausevcpu 1001 #define XEN_DOMCTL_gdbsx_unpausevcpu 1002 @@ -1339,6 +1350,9 @@ struct xen_domctl { struct xen_domctl_vuart_op vuart_op; struct xen_domctl_vmtrace_op vmtrace_op; struct xen_domctl_paging_mempool paging_mempool; +#if defined(__arm__) || defined(__aarch64__) + struct xen_domctl_dt_overlay dt_overlay; +#endif uint8_t pad[128]; } u; }; diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h index febaa4b16a..3a6e7d48f0 100644 --- a/xen/include/public/sysctl.h +++ b/xen/include/public/sysctl.h @@ -1184,14 +1184,11 @@ typedef struct xen_sysctl_cpu_policy xen_sysctl_cpu= _policy_t; DEFINE_XEN_GUEST_HANDLE(xen_sysctl_cpu_policy_t); #endif =20 -#if defined(__arm__) || defined (__aarch64__) +#if defined(__arm__) || defined(__aarch64__) /* * XEN_SYSCTL_dt_overlay - * Performs addition/removal of device tree nodes under parent node using = dtbo. - * This does in three steps: - * - Adds/Removes the nodes from dt_host. - * - Adds/Removes IRQ permission for the nodes. - * - Adds/Removes MMIO accesses. + * Performs addition/removal of device tree nodes under parent node using = dtbo + * from dt_host. */ struct xen_sysctl_dt_overlay { XEN_GUEST_HANDLE_64(const_void) overlay_fdt; /* IN: overlay fdt. */ @@ -1265,7 +1262,7 @@ struct xen_sysctl { struct xen_sysctl_cpu_policy cpu_policy; #endif =20 -#if defined(__arm__) || defined (__aarch64__) +#if defined(__arm__) || defined(__aarch64__) struct xen_sysctl_dt_overlay dt_overlay; #endif uint8_t pad[128]; diff --git a/xen/include/xen/dt-overlay.h b/xen/include/xen/dt-overlay.h index c0567741ee..b2cedf3f2a 100644 --- a/xen/include/xen/dt-overlay.h +++ b/xen/include/xen/dt-overlay.h @@ -39,15 +39,23 @@ struct overlay_track { }; =20 struct xen_sysctl_dt_overlay; +struct xen_domctl_dt_overlay; =20 #ifdef CONFIG_OVERLAY_DTB long dt_overlay_sysctl(struct xen_sysctl_dt_overlay *op); +long dt_overlay_domctl(struct domain *d, struct xen_domctl_dt_overlay *op); #else #include static inline long dt_overlay_sysctl(struct xen_sysctl_dt_overlay *op) { return -EOPNOTSUPP; } + +static inline long dt_overlay_domctl(struct domain *d, + struct xen_domctl_dt_overlay *op) +{ + return -EOPNOTSUPP; +} #endif =20 #endif /* __XEN_DT_OVERLAY_H__ */ --=20 2.25.1 From nobody Fri Nov 22 14:13:11 2024 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=1716589049; cv=pass; d=zohomail.com; s=zohoarc; b=JC8s7zmMa71G+IKs3KzOUMvIsopE0pvWbCEVEaI0it5h8z8L6HcNGxq4in3MFtjBAtT+ByZTY61wjMsLi5jdnZLKs2UK3qpJNiG80qh36O302WfFKvHEnWv7yaMT1BgZnhgGKIVBQ+dm/PrEjmvTKka19cbWbpx6UsZlvuDV8yE= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716589049; 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=8840+SwwfsZRigVHTRSue5zpJzKftzBoXAWMQbq7J+M=; b=mJs7joMcXs05Yn9eIx/P6Ei0uLFxKETj/vMRCXOjmGedYo4XI54YG1hqqJS6GfM0D6YiR5yQMx0s1xktCfhmcAkARXFPdecd8mguTC7C9ZLnI7e31LdXVQA1/vlg/lVzZrQT4ewXY/DasUwJj2y3uEQj1quKbGwafeKduJVQqQc= 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 1716589049445807.8587670789636; Fri, 24 May 2024 15:17:29 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.729892.1135246 (Exim 4.92) (envelope-from ) id 1sAdDl-0000Z3-Bo; Fri, 24 May 2024 22:17:05 +0000 Received: by outflank-mailman (output) from mailman id 729892.1135246; Fri, 24 May 2024 22:17:05 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sAdDl-0000Y2-7c; Fri, 24 May 2024 22:17:05 +0000 Received: by outflank-mailman (input) for mailman id 729892; Fri, 24 May 2024 22:17:04 +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 1sAdDj-0007Iy-SR for xen-devel@lists.xenproject.org; Fri, 24 May 2024 22:17:03 +0000 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on20601.outbound.protection.outlook.com [2a01:111:f403:2416::601]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 56bec488-1a1b-11ef-90a1-e314d9c70b13; Sat, 25 May 2024 00:17:00 +0200 (CEST) Received: from DM5PR08CA0053.namprd08.prod.outlook.com (2603:10b6:4:60::42) by PH7PR12MB7186.namprd12.prod.outlook.com (2603:10b6:510:202::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.36; Fri, 24 May 2024 22:16:54 +0000 Received: from CY4PEPF0000FCC4.namprd03.prod.outlook.com (2603:10b6:4:60:cafe::eb) by DM5PR08CA0053.outlook.office365.com (2603:10b6:4:60::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.22 via Frontend Transport; Fri, 24 May 2024 22:16:53 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000FCC4.mail.protection.outlook.com (10.167.242.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7611.14 via Frontend Transport; Fri, 24 May 2024 22:16:53 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 24 May 2024 17:16:52 -0500 Received: from smtp.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Fri, 24 May 2024 17:16:52 -0500 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: 56bec488-1a1b-11ef-90a1-e314d9c70b13 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n1WIa5hyBbCCmlFsWsiq13AwcNfDf/prH6dSxgm6oIo3UjuP/GqZTPKrsRepQOPZlyuzfn5lhTrHU2E/kYnz12viCULvm1LYNwq4P5tSZriOz47NU6p0EgNlGTEqIOtfyo08zWXQ8yg0NtIESkV65YY7K4unrZiAzaqrZUBj2w/MCZqha3W5MoQ5QnpEJjcDYJ8YwdtoWahmNunPJqXAe5Wg2N7KXY+61l64dYoDTWwLwduInYTCbFw/h9GlvuiKBJIMCUH02mRLY+ImMMolcrFsImwG15zbIFWWT97Xd8P0aRf69Quepyeq5l4Qa+zCzc2sFzAX6gUwyhhHfb2ArQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=8840+SwwfsZRigVHTRSue5zpJzKftzBoXAWMQbq7J+M=; b=Qrk8E90Rgt6OOmUIFY0qT0O8Z83C04195iMCs2ce652csFpzX5gnnbQc1gQQ5GABIEC3LM9Tt59zURQ7XNUCbv9UFML6sC0ZzcOBuMag/TwfTXb0sYsxny66B5ER5+bqjoOD1nETJ11vqrUOS+MiwiAV/6pbADZAYQwh+UBqDu9bSQ6sYdR/FL1MVYCHUgyQY6IaGiscYziPOMGxiZtYLTVUPwsbbu+kgjguffDNj0qTp4KHYQJqZDy4b6UKjAFm0EaQdb+T/qTdwUE4dy+OtEtUHdH84ciaOtcpSJk1awiuoWreYWqNj6V2ZtGSIUxlf09MV/29PZpMLkOlSxSMUw== 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=8840+SwwfsZRigVHTRSue5zpJzKftzBoXAWMQbq7J+M=; b=Fq9Fg5caWy1L9wZTOdDnjbfjD7lAO/71QqmWN29AMXvkT6W2gt2puCYt+6zEkevBLQezaHP3geXk9Ep94o4lztrZ+lyZFXq88zUkREbCTZ5A9o/e5E0uBpZ+5K+fHXKWWLb1GUaL5Pm4g/mUxJAxiljI4qAGi1vXXuv3vFj6iEo= 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=SATLEXMB04.amd.com; pr=C From: Stefano Stabellini To: CC: , , , , , , Henry Wang , "Stefano Stabellini" , Jason Andryuk Subject: [PATCH v6 6/7] tools: Introduce the "xl dt-overlay attach" command Date: Fri, 24 May 2024 15:16:46 -0700 Message-ID: <20240524221647.2860711-6-stefano.stabellini@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: None (SATLEXMB04.amd.com: stefano.stabellini@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCC4:EE_|PH7PR12MB7186:EE_ X-MS-Office365-Filtering-Correlation-Id: 31ee4b0c-592c-4e4e-93e8-08dc7c3f37b4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|82310400017|1800799015|36860700004; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?U4fvEoe62dzmheReT3IX5YSBS6THqI7f9eCy8/PXK3G2ySg6+fuUd3nDyGK8?= =?us-ascii?Q?tG91lPI7TuDG4N3+enj7jOGF/PS8vKIk/NUhumPlOkCfNmA9xGttOoWv+8go?= =?us-ascii?Q?iSO4Pgn6ZE8pCskl1obbxJHSgHK8TUejGKJfyk2UUZb7GBMhUYjNnnso1ngs?= =?us-ascii?Q?i6rNYkCs67hMA2ZJOsktatvcMO195MonofhLr3vngg32r8HhlolMVXULhwUz?= =?us-ascii?Q?SS7bnr4/VL4LDnbFV0E56OsaMFMFyKzk+APf/s5Pe85yty4SgcTYe5KcPiBr?= =?us-ascii?Q?HBS3FGNVAKhuh4Q3sN87MaPQtqyKnb3ouvRwoTxozA/ddP+R+1NTEw9Yewt1?= =?us-ascii?Q?woYmszs0kDIYaHc8c21RC8nisZEFBbHFfUxrlItAiqCtVT9T6J109+WVAiWF?= =?us-ascii?Q?r9k6GVRqdSDayzPcdV1eAAJuISNDHVK3XBqCB3VoCY6nzG7FgRdyV4Yk2aZK?= =?us-ascii?Q?u7vX6nYUAhxmtBEoYBhZknadZ26P5lWyaLPXfG3JQGkwp3IUzSbykpXjEbSJ?= =?us-ascii?Q?3x/wPyy/7aIOmBGbpAFpoIG9NasLMp8rXUd+teYwZKFrgbeglyyajaSOyvQS?= =?us-ascii?Q?OEk0dgF9pwT9Ye6sVI0nd6WVAZxH20aqSoSME5zXQfmrB1sDf1FoOsawCaG5?= =?us-ascii?Q?bczEW55Z9mV9fcZAQAVL8FS74EFaeR/22UFNcFIrWvSoHiDLhjcK+7WEB+EC?= =?us-ascii?Q?PgGN7AVw/diyymphRb/DsVyvyrZrm/nh80RfzZI1wVB0tRnwUFVyll72LsHg?= =?us-ascii?Q?wVLcWcDLZ7FbMUVjfJxYC0XmtyGcVF214Mu2abQXWYOl8u4aWRrcjbEbzobf?= =?us-ascii?Q?OD1xH8gQFgLBaZ4e+IpoOeqW9hNeLCqp2Pt59kiLVRrQv2g61n024xxwqDV7?= =?us-ascii?Q?Dg4j50cp3TKDqe1klIkKn+Q67JKRrGDOEcZ3ly78yFsYmsyHFbZJt5x2zcBP?= =?us-ascii?Q?WKcP/vVLZHG+f/UFQiWkJ9Eu/KzBPaKCBlKZOJX2n1fNjXExzlBdiCJtMw/n?= =?us-ascii?Q?PruPBfolRqYCAu686/c5qYthZTGD3t/XrZVVemULFPRzdDowogcz62GPi7ne?= =?us-ascii?Q?s5TKw4tgqBeenvioCzTgvyySJQozI6OSp4HTjxBIjS/kf4PeoLruOB9CiTBl?= =?us-ascii?Q?eUwvwmmBShi0vdBhbWjfq4iRzqL49qxVc50u0PUp91loQ2NSJUiUrQFIC6og?= =?us-ascii?Q?oAojShaBmycYaPTa2u4abnd98Dti94R09cb7ehUG1NStysdnZRmUJycW/xG/?= =?us-ascii?Q?F+ydTDXqnak4eGY0h7svTjZKF/S8HW2obWdgv+VjVQb90hnvhD6kQYqDL9kh?= =?us-ascii?Q?jEa6wmKNjI6IY3rgrKBrYicxpxK73OoErtb6O7x/h0O6q+fBawH7SeQduZJ0?= =?us-ascii?Q?LTd9aTLasnDpEi80051JEwHcKWjx?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(376005)(82310400017)(1800799015)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2024 22:16:53.8195 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 31ee4b0c-592c-4e4e-93e8-08dc7c3f37b4 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000FCC4.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7186 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1716589051135100001 Content-Type: text/plain; charset="utf-8" From: Henry Wang With the XEN_DOMCTL_dt_overlay DOMCTL added, users should be able to attach (in the future also detach) devices from the provided DT overlay to domains. Support this by introducing a new "xl dt-overlay" command and related documentation, i.e. "xl dt-overlay attach. Slightly rework the command option parsing logic. Signed-off-by: Henry Wang Signed-off-by: Stefano Stabellini Reviewed-by: Jason Andryuk Reviewed-by: Stefano Stabellini --- tools/include/libxl.h | 15 +++++++++++ tools/include/xenctrl.h | 3 +++ tools/libs/ctrl/xc_dt_overlay.c | 31 +++++++++++++++++++++++ tools/libs/light/libxl_dt_overlay.c | 28 +++++++++++++++++++++ tools/xl/xl_cmdtable.c | 4 +-- tools/xl/xl_vmcontrol.c | 39 ++++++++++++++++++++--------- 6 files changed, 106 insertions(+), 14 deletions(-) diff --git a/tools/include/libxl.h b/tools/include/libxl.h index a3d05c840b..f5c7167742 100644 --- a/tools/include/libxl.h +++ b/tools/include/libxl.h @@ -641,6 +641,12 @@ */ #define LIBXL_HAVE_XEN_9PFS 1 =20 +/* + * LIBXL_HAVE_DT_OVERLAY_DOMAIN indicates the presence of + * libxl_dt_overlay_domain. + */ +#define LIBXL_HAVE_DT_OVERLAY_DOMAIN 1 + /* * libxl memory management * @@ -2554,8 +2560,17 @@ libxl_device_pci *libxl_device_pci_list(libxl_ctx *c= tx, uint32_t domid, void libxl_device_pci_list_free(libxl_device_pci* list, int num); =20 #if defined(__arm__) || defined(__aarch64__) +/* Values should keep consistent with the op from XEN_SYSCTL_dt_overlay */ +#define LIBXL_DT_OVERLAY_ADD 1 +#define LIBXL_DT_OVERLAY_REMOVE 2 int libxl_dt_overlay(libxl_ctx *ctx, void *overlay, uint32_t overlay_size, uint8_t overlay_op); + +/* Values should keep consistent with the op from XEN_DOMCTL_dt_overlay */ +#define LIBXL_DT_OVERLAY_DOMAIN_ATTACH 1 +int libxl_dt_overlay_domain(libxl_ctx *ctx, uint32_t domain_id, + void *overlay_dt, uint32_t overlay_dt_size, + uint8_t overlay_op); #endif =20 /* diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h index 4996855944..9ceca0cffc 100644 --- a/tools/include/xenctrl.h +++ b/tools/include/xenctrl.h @@ -2657,6 +2657,9 @@ int xc_domain_cacheflush(xc_interface *xch, uint32_t = domid, #if defined(__arm__) || defined(__aarch64__) int xc_dt_overlay(xc_interface *xch, void *overlay_fdt, uint32_t overlay_fdt_size, uint8_t overlay_op); +int xc_dt_overlay_domain(xc_interface *xch, void *overlay_fdt, + uint32_t overlay_fdt_size, uint8_t overlay_op, + uint32_t domain_id); #endif =20 /* Compat shims */ diff --git a/tools/libs/ctrl/xc_dt_overlay.c b/tools/libs/ctrl/xc_dt_overla= y.c index c2224c4d15..ea1da522d1 100644 --- a/tools/libs/ctrl/xc_dt_overlay.c +++ b/tools/libs/ctrl/xc_dt_overlay.c @@ -48,3 +48,34 @@ err: =20 return err; } + +int xc_dt_overlay_domain(xc_interface *xch, void *overlay_fdt, + uint32_t overlay_fdt_size, uint8_t overlay_op, + uint32_t domain_id) +{ + int err; + struct xen_domctl domctl =3D { + .cmd =3D XEN_DOMCTL_dt_overlay, + .domain =3D domain_id, + .u.dt_overlay =3D { + .overlay_op =3D overlay_op, + .overlay_fdt_size =3D overlay_fdt_size, + } + }; + + DECLARE_HYPERCALL_BOUNCE(overlay_fdt, overlay_fdt_size, + XC_HYPERCALL_BUFFER_BOUNCE_IN); + + if ( (err =3D xc_hypercall_bounce_pre(xch, overlay_fdt)) ) + goto err; + + set_xen_guest_handle(domctl.u.dt_overlay.overlay_fdt, overlay_fdt); + + if ( (err =3D do_domctl(xch, &domctl)) !=3D 0 ) + PERROR("%s failed", __func__); + +err: + xc_hypercall_bounce_post(xch, overlay_fdt); + + return err; +} diff --git a/tools/libs/light/libxl_dt_overlay.c b/tools/libs/light/libxl_d= t_overlay.c index a6c709a6dc..00503b76bd 100644 --- a/tools/libs/light/libxl_dt_overlay.c +++ b/tools/libs/light/libxl_dt_overlay.c @@ -69,3 +69,31 @@ out: return rc; } =20 +int libxl_dt_overlay_domain(libxl_ctx *ctx, uint32_t domain_id, + void *overlay_dt, uint32_t overlay_dt_size, + uint8_t overlay_op) +{ + int rc; + int r; + GC_INIT(ctx); + + if (check_overlay_fdt(gc, overlay_dt, overlay_dt_size)) { + LOG(ERROR, "Overlay DTB check failed"); + rc =3D ERROR_FAIL; + goto out; + } else { + LOG(DEBUG, "Overlay DTB check passed"); + rc =3D 0; + } + + r =3D xc_dt_overlay_domain(ctx->xch, overlay_dt, overlay_dt_size, over= lay_op, + domain_id); + if (r) { + LOG(ERROR, "%s: Attaching/Detaching overlay dtb failed.", __func__= ); + rc =3D ERROR_FAIL; + } + +out: + GC_FREE; + return rc; +} diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c index 1f3c6b5897..42751228c1 100644 --- a/tools/xl/xl_cmdtable.c +++ b/tools/xl/xl_cmdtable.c @@ -634,8 +634,8 @@ const struct cmd_spec cmd_table[] =3D { #ifdef LIBXL_HAVE_DT_OVERLAY { "dt-overlay", &main_dt_overlay, 0, 1, - "Add/Remove a device tree overlay", - "add/remove <.dtbo>", + "Add/Remove a device tree overlay to Xen device tree, attach/detach = the device to a domain", + " <.dtbo> OR <.dtbo> ", "-h print this help\n" }, #endif diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c index 02575d5d36..fa1a4420e3 100644 --- a/tools/xl/xl_vmcontrol.c +++ b/tools/xl/xl_vmcontrol.c @@ -1268,32 +1268,43 @@ int main_create(int argc, char **argv) #ifdef LIBXL_HAVE_DT_OVERLAY int main_dt_overlay(int argc, char **argv) { - const char *overlay_ops =3D NULL; const char *overlay_config_file =3D NULL; void *overlay_dtb =3D NULL; int rc; uint8_t op; int overlay_dtb_size =3D 0; - const int overlay_add_op =3D 1; - const int overlay_remove_op =3D 2; + uint32_t domain_id =3D 0; + bool domain_op =3D false; =20 if (argc < 2) { help("dt-overlay"); return EXIT_FAILURE; } =20 - overlay_ops =3D argv[1]; - overlay_config_file =3D argv[2]; - - if (strcmp(overlay_ops, "add") =3D=3D 0) - op =3D overlay_add_op; - else if (strcmp(overlay_ops, "remove") =3D=3D 0) - op =3D overlay_remove_op; - else { + if (strcmp(argv[optind], "add") =3D=3D 0) + op =3D LIBXL_DT_OVERLAY_ADD; + else if (strcmp(argv[optind], "remove") =3D=3D 0) + op =3D LIBXL_DT_OVERLAY_REMOVE; + else if (strcmp(argv[optind], "attach") =3D=3D 0) { + op =3D LIBXL_DT_OVERLAY_DOMAIN_ATTACH; + domain_op =3D true; + } else { fprintf(stderr, "Invalid dt overlay operation\n"); return EXIT_FAILURE; } =20 + overlay_config_file =3D argv[optind+1]; + + if (domain_op) { + if (argc <=3D optind + 2) { + fprintf(stderr, "Missing domain ID\n"); + help("dt-overlay"); + return EXIT_FAILURE; + } else { + domain_id =3D find_domain(argv[optind+2]); + } + } + if (overlay_config_file) { rc =3D libxl_read_file_contents(ctx, overlay_config_file, &overlay_dtb, &overlay_dtb_size); @@ -1309,7 +1320,11 @@ int main_dt_overlay(int argc, char **argv) return EXIT_FAILURE; } =20 - rc =3D libxl_dt_overlay(ctx, overlay_dtb, overlay_dtb_size, op); + if (!domain_op) + rc =3D libxl_dt_overlay(ctx, overlay_dtb, overlay_dtb_size, op); + else + rc =3D libxl_dt_overlay_domain(ctx, domain_id, overlay_dtb, + overlay_dtb_size, op); =20 free(overlay_dtb); =20 --=20 2.25.1 From nobody Fri Nov 22 14:13:11 2024 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=1716589042; cv=pass; d=zohomail.com; s=zohoarc; b=PXYi9ihWxUCm+OzoEG3KJhpZnkQswBFwox339vvD0qtxlJxjOHVGBnauxjXOeKqLf1s0+LyoJsl7yOwFL5RaWY5LxbciQ3uihAESjyn2LPPxUxcfux6i7fOsX8DOtrpgHfc8xehKUAmnzzZkpB52228oim/0W5BqYGbzhi0nRl4= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716589042; 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=B3jJMlOrEINeOqECOvhj7YrjOfi6yjCyyFlom/2lhcc=; b=UIA/fcjP23TQa3SXixhWmXeX4JKq7aXI8/0+8zk02ch2/RJxKjofOy7CGq+eZkgK1RxU+60FYdUx7JcayzV6EPls7wIvJhM++KAegJMRTX3fIK2tNVuhFJva4860+I6wbEUA2l0KsthW3j6AATTkD9xSqjlmuLujhvhsCzKAGUE= 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 1716589042576402.5626349277462; Fri, 24 May 2024 15:17:22 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.729891.1135235 (Exim 4.92) (envelope-from ) id 1sAdDk-0000Br-2q; Fri, 24 May 2024 22:17:04 +0000 Received: by outflank-mailman (output) from mailman id 729891.1135235; Fri, 24 May 2024 22:17: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 1sAdDj-0000AD-RT; Fri, 24 May 2024 22:17:03 +0000 Received: by outflank-mailman (input) for mailman id 729891; Fri, 24 May 2024 22:17:02 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sAdDi-0007Iy-SM for xen-devel@lists.xenproject.org; Fri, 24 May 2024 22:17:02 +0000 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on20601.outbound.protection.outlook.com [2a01:111:f403:2412::601]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 56dc309d-1a1b-11ef-90a1-e314d9c70b13; Sat, 25 May 2024 00:17:00 +0200 (CEST) Received: from DM5PR08CA0034.namprd08.prod.outlook.com (2603:10b6:4:60::23) by CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.26; Fri, 24 May 2024 22:16:55 +0000 Received: from CY4PEPF0000FCC4.namprd03.prod.outlook.com (2603:10b6:4:60:cafe::75) by DM5PR08CA0034.outlook.office365.com (2603:10b6:4:60::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.25 via Frontend Transport; Fri, 24 May 2024 22:16:54 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000FCC4.mail.protection.outlook.com (10.167.242.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7611.14 via Frontend Transport; Fri, 24 May 2024 22:16:54 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 24 May 2024 17:16:53 -0500 Received: from smtp.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Fri, 24 May 2024 17:16:53 -0500 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: 56dc309d-1a1b-11ef-90a1-e314d9c70b13 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g1WOooZrS4FH+fyJ4SSehSaqtVvNVnbUijGatl/DGrn68l53YfnP8aBy6pCVotcgP0MzVC5O5aCfGywTSoEGYgvSGDDyM2WFbIpsj9s4+ib1Rd1agRBHvfvoWzcu6tOAgYH58Dp8Z+KTDoKA4cYZ8xXOTP4v2gRhiKuCeYoDQCf9RCDf8OC6xzuJHRoTMLwbeFL9JuL2DWXoFrWccFuCAaJKrU+obhl88HaGrK7oXDqarXx5ysV4SIq3wUgJ2bsDh935baZGdhgDYnZZy7xEtAYhAQZlJz6PgckpIb7lwwXaBtiiBYnslEfv04elBYo9rhM+H794tfh+DVAP53PbOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=B3jJMlOrEINeOqECOvhj7YrjOfi6yjCyyFlom/2lhcc=; b=AHLzFVxfdmPKSLY1YtAaJiQufbIrNc+5WpangG7AxgdIT1xQptvcjPMsifLBQzvZk46sJHhsUZltDuNJ3g/PxePAd+KfbP3H7tBlO91bOLIAtdXjIksoxZ0jX8kEU9jP5fH9Y8KqgTjodQ27a2/sFcojoYtoJXq1Vr/cFfj2UmNwsTe9ggceC3CvDmm+1ShCmqW4LKoByT4CHhntNcFFqr85367OSRg/FGObT3zsBq1NmjQ+urdPL/5hS6AGd9kmeohveRRwhW/DiwTa28szsngWFZ46MMHwT0ssiIMNiCs2ue/AyMQT0zjcXIG4yNgb9tqzjBJK2Nvd2cRo5Jm+/A== 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=B3jJMlOrEINeOqECOvhj7YrjOfi6yjCyyFlom/2lhcc=; b=FDgOXMKihEKrR3R36cgnYUEr4THgczch2FnwFnc1Zi3ZExA01ySutsrcWZB01iybLOrd2MkfqlYi6cdxRj6ivpmRJPEVz/XoVCvS1sYyMlFPa8eyhX06LlOXGcNzfnMKDOQ+EVnYr5pVw1oF71zLAHZ/IhB2k8GdCnLIT8yghNs= 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=SATLEXMB04.amd.com; pr=C From: Stefano Stabellini To: CC: , , , , , , Vikram Garhwal , "Stefano Stabellini" , Henry Wang Subject: [PATCH v6 7/7] docs: Add device tree overlay documentation Date: Fri, 24 May 2024 15:16:47 -0700 Message-ID: <20240524221647.2860711-7-stefano.stabellini@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: None (SATLEXMB04.amd.com: stefano.stabellini@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCC4:EE_|CY5PR12MB6179:EE_ X-MS-Office365-Filtering-Correlation-Id: cc71ca9e-005e-4f8d-eef1-08dc7c3f3851 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|376005|36860700004|82310400017; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?deCGLzX/V1y8E1Tqx8Fh3fF2X4SFWVIXBAZZTwvkHrIvwzSx9AcJYK+dzWOX?= =?us-ascii?Q?+QriQOY6UE4ri6HE0WpZWblf64Skvx23+4xd0KlJHy63+jfTGXoRBz0L94CM?= =?us-ascii?Q?vU/pXAX5kHCjV0QEl8+b5BKr8iJLY1+Wk924OcjWwo6Q4OnCyf6e8eeljC7A?= =?us-ascii?Q?43WlawRJQwIzzEBQxSFU0/WohKSfq1dk5og8URauTXAeiCkGBsqDAXavhWcs?= =?us-ascii?Q?iB5lRm62iQ7CB7ZEMwS3x4PIrVGsL0EcaE0ts4vwZENa7BYIA2D7zQpQwEaL?= =?us-ascii?Q?mQ3DjfrujikEg/ajUmzBNbdAoi+kWc2ndWKFl0EQAiB8DVo6RIhYC8GH7qXt?= =?us-ascii?Q?Fw4n/iuyAX+3TacF1tiA0s9Ro6xqns3PmDqWBXZXz0wyb8gn1oWmwIjnD/CI?= =?us-ascii?Q?bnOgzZ/p3M/eNgm5hvWvn/0CI198tBUMAmwMrA/qYTGtFWWLebWagMq+jreL?= =?us-ascii?Q?m+6xIQKdgwDePDicDePYGXm+L4Aio8qagKHInO9S8IpQ1P/grvLT5BtaOgo4?= =?us-ascii?Q?07H9nKOPiqC3PhLFG/OvxT9ggf2hUT5fbIg7QdYnU4hnkf1Tig0Hi1gI6D1Z?= =?us-ascii?Q?f1WzSfpsS1qGXreJvhXQjbwKPKd1nFCxJCugqozB9fiGtFlaxtluS+VxQCDa?= =?us-ascii?Q?f6zKFyygE1Ajtt5nhhX0WYAFBTyj1XSONKqstknPmpIMHAeBimJH+FY9ZPQ9?= =?us-ascii?Q?7MELPM9j9EPB391ByY91WelFad13kl9UopNCfLqxxLnjGHy+W02gaaUyKVAf?= =?us-ascii?Q?OhVcfYjlLaIgEhoQtPPZs3coeW8vOsaSrdeoVOm7nVrd49afc/9z86h6BJ4E?= =?us-ascii?Q?tCjYTNp2N6i45czoGbFc7CudCpNhyb9TZbgKKuFuH1t1mAWh0UV/6Oa9I0Z0?= =?us-ascii?Q?4PgqgplJmOHYOBQDQrNMHKVaNoH1XVqd8wDXo6QUbjohM8d5KnWEEvMRaDNC?= =?us-ascii?Q?UhT4FvuesX5j44SFxHIk3I6diVlpOFkbY4C3UYlkMyf5MACHphLtd6/ZhodE?= =?us-ascii?Q?6d9t1F8n2eRZbFcPhgecu6qZ5VPeNnVuhxCEfNNgkhtgYmT1adIYYaOmGmKr?= =?us-ascii?Q?HvFuheVTbHYFwuP1htWGVS4IasF2F6XChpS5rhIfRVi4mXpD9tHAiCp2i8Ny?= =?us-ascii?Q?41ynCKbmhCxv1WuVMtgcN6WWRZB81PmlVkA3pILVy/no/QjAQMZokTAvpuxv?= =?us-ascii?Q?FG0qCsVbPb1sjj14KYFtG0BIWzbUz9hPn2BsePcm7ieitz81SpoWXcjiX0ns?= =?us-ascii?Q?+/yw7UaWyZn6eiAd9HufssvZURQ8vG51dNVWfYivAxq/juPb8noNfTfC76NV?= =?us-ascii?Q?PCbcHvffcem74FQ/46HeJidN?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(1800799015)(376005)(36860700004)(82310400017);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2024 22:16:54.8195 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cc71ca9e-005e-4f8d-eef1-08dc7c3f3851 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000FCC4.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6179 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1716589043096100001 Content-Type: text/plain; charset="utf-8" From: Vikram Garhwal Signed-off-by: Vikram Garhwal Signed-off-by: Stefano Stabellini Signed-off-by: Henry Wang Reviewed-by: Julien Grall --- docs/misc/arm/overlay.txt | 82 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 docs/misc/arm/overlay.txt diff --git a/docs/misc/arm/overlay.txt b/docs/misc/arm/overlay.txt new file mode 100644 index 0000000000..ef3ef792f7 --- /dev/null +++ b/docs/misc/arm/overlay.txt @@ -0,0 +1,82 @@ +# Device Tree Overlays support in Xen + +Xen experimentally supports dynamic device assignment to running +domains, i.e. adding/removing nodes (using .dtbo) to/from Xen device +tree, and attaching them to a running domain with given $domid. + +Dynamic node assignment works in two steps: + +## Add/Remove device tree overlay to/from Xen device tree + +1. Xen tools check the dtbo given and parse all other user provided argume= nts +2. Xen tools pass the dtbo to Xen hypervisor via hypercall. +3. Xen hypervisor applies/removes the dtbo to/from Xen device tree. + +## Attach device from the DT overlay to domain + +1. Xen tools check the dtbo given and parse all other user provided argume= nts +2. Xen tools pass the dtbo to Xen hypervisor via hypercall. +3. Xen hypervisor attach the device to the user-provided $domid by + mapping node resources in the DT overlay. + +# Examples + +Here are a few examples on how to use it. + +## Dom0 device add + +For assigning a device tree overlay to Dom0, user should firstly properly +prepare the DT overlay. More information about device tree overlays can be +found in [1]. Then, in Dom0, enter the following: + + (dom0) xl dt-overlay add overlay.dtbo + +This will allocate the devices mentioned in overlay.dtbo to Xen device tre= e. + +To assign the newly added device from the dtbo to Dom0: + + (dom0) xl dt-overlay attach overlay.dtbo 0 + +Next, if the user wants to add the same device tree overlay to dom0 +Linux, execute the following: + + (dom0) mkdir -p /sys/kernel/config/device-tree/overlays/new_overlay + (dom0) cat overlay.dtbo > /sys/kernel/config/device-tree/overlays/new_= overlay/dtbo + +Finally if needed, the relevant Linux kernel drive can be loaded using: + + (dom0) modprobe module_name.ko + +## DomU device add/remove + +All the nodes in dtbo will be assigned to one domain. The user will need +to prepare a different dtbo for the domU. For example, the +`interrupt-parent` property of the DomU overlay should be changed to the +Xen hardcoded value `0xfde8` and the xen,reg property should be added to +specify the address mappings. If the domain is not 1:1 mapped, xen,reg +must be present. See the xen,reg format description in +docs/misc/arm/passthrough.txt. Below assumes the properly written DomU +dtbo is `overlay_domu.dtbo`. + +You need to set the `passthrough` property in the xl config file if you +plan to use DT overlay and devices requiring an IOMMU. + +User will also need to modprobe the relevant drivers. For already +running domains, the user can use the xl dt-overlay attach command, +example: + + (dom0) xl dt-overlay add overlay.dtbo # If not executed bef= ore + (dom0) xl dt-overlay attach overlay_domu.dtbo $domid + (dom0) xl console $domid # To access $domid co= nsole + +Next, if the user needs to modify/prepare the overlay.dtbo suitable for +the domU: + + (domU) mkdir -p /sys/kernel/config/device-tree/overlays/new_overlay + (domU) cat overlay_domu.dtbo > /sys/kernel/config/device-tree/overlays= /new_overlay/dtbo + +Finally, if needed, the relevant Linux kernel drive can be probed: + + (domU) modprobe module_name.ko + +[1] https://www.kernel.org/doc/Documentation/devicetree/overlay-notes.txt --=20 2.25.1