From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 124D3CF8840 for ; Fri, 4 Oct 2024 18:15:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:CC:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=r4DdmH1/jiSVye/T3NS/6slWEYclgeldlupGZQOxP0w=; b=jjLrx9LY9q2DR9E/5G7T7vlAWh crNhM+t3CJQjiJHT0T3VK6q2JOnZqtniAZ5XWNHIlxcQLpIb8OX83sJF+07amnPfDz+8N+WAhwg8Y SO7k6dc0d18PRo1AJv1S0GSKTti6Cdqgl98BP2/z1Fi+XAbbDhW1cv6OMbQM5o955TDJTO4PGGWc/ cz/Fo/sJU9EPRyriA4k4vbwfBqPn89CZi8bQAXfqtgOvI1iBlrAQXkn+6Cm4ZvdAXoS5TyF8ux48/ jke0OWj917/U/1WBffNbVMpABZ9cCej6cR8uCDwy8yKFXlKh5cWdacSlsYOo3M9Kb6rPqSjwxVXqT 3m6Uez+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1swmpz-0000000DeRf-0zvO; Fri, 04 Oct 2024 18:15:35 +0000 Received: from mail-bn1nam02on20617.outbound.protection.outlook.com ([2a01:111:f403:2407::617] helo=NAM02-BN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1swmoh-0000000DeBc-3Sw4 for linux-arm-kernel@lists.infradead.org; Fri, 04 Oct 2024 18:14:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rf3Ou4FAaX9whGpHreWfDu9uF9gvmGnP3hPdheuD1GaNo/3HPGtmamYoVHNSxVmmAhdOLFrzowakekcmXzTapqjSpS0diz0WXoOCyME9Z8thbqt9p2xmDYocp2pxLqOjNBKyJrGFRh27pvVMxR1/G3uaW8jrkjvae3p9SrsDaTQln1b9zHfHlzXgQY1ESUwE/pT5NBc0kVp0ZJ4Y6cfC5NqS2ppzxB3FCcLbO+W+JQBtwMPsYV6X2eLeCPXGEJFxMAa96Fzn1klqH36abmAbOG6iadSMMQRNicAqFPMiIa3euN0EtHqtWKV1d7HQVRr6YYTs9z5aqhYXZDNn3KVcdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=r4DdmH1/jiSVye/T3NS/6slWEYclgeldlupGZQOxP0w=; b=TY1RSocK/HECBNVGxu5p9Xsp3P6RjSyG7YE2Qna+UaPPW95MKHsJ9dSQ6bETbHikPkT1tX8GE18xBi/G4QKAv59dM2G4A2ZArHGQGlDdozpRKArO94RPG32fDEn2Y6JREsNbMu1zMgWaO4hzlLVsKBVdlbeUU98mPc5yaPG7Ap0NU/EQ4i2t3pYKof32MFJCmYlDwRkhd26qjbKxs76OX5txhuteVtUmkFI9mvF3Mc5+mhURQD9yIhYCQ20FGGJTx33PwcLkZSIeREKXBUXuTeRgGL9Fd0HWfZGxJNybFT6r9EX1R2ipjHQxLH65T8J0JjvJ2YMsZkUtFTHB94A2Kg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=huawei.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=r4DdmH1/jiSVye/T3NS/6slWEYclgeldlupGZQOxP0w=; b=eQuJMzU7ITRfC72Q4UMTRIjnn1/nuen4wZDbtV7BfzOFsB7mehvz0psVMlrKv94Vk2PPJFlyqX8/U/1bnivntcLNE1wemfJ1wzIS8nSL7G232jNFJOEnhppyWkEC8jnQvE2shiRFfUiB8AFonNm3us2kzGVIVU8MrpwkBizNmBfqKGoUjMWCfCJqM/6+oGN7jpcAWEly/iQTeRmn3jGzmBJA5HFRte9D0a9UGk5Oaikz9kaN2mSEK2xG3QlDtJAr7GkD/v0BVP6xUJ+ep+7q56UmPVq8G2X9wtFJUwpBOEklQvYJCtme9Upm0YTZ2Jui7W/n9r7UluHnCX5PpyF5Ag== Received: from CH0PR03CA0090.namprd03.prod.outlook.com (2603:10b6:610:cc::35) by LV8PR12MB9232.namprd12.prod.outlook.com (2603:10b6:408:182::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18; Fri, 4 Oct 2024 18:14:03 +0000 Received: from CH1PEPF0000AD81.namprd04.prod.outlook.com (2603:10b6:610:cc:cafe::f8) by CH0PR03CA0090.outlook.office365.com (2603:10b6:610:cc::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.19 via Frontend Transport; Fri, 4 Oct 2024 18:14:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CH1PEPF0000AD81.mail.protection.outlook.com (10.167.244.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.11 via Frontend Transport; Fri, 4 Oct 2024 18:14:02 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Fri, 4 Oct 2024 11:13:50 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Fri, 4 Oct 2024 11:13:49 -0700 Received: from Asurada-Nvidia (10.127.8.13) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4 via Frontend Transport; Fri, 4 Oct 2024 11:13:48 -0700 Date: Fri, 4 Oct 2024 11:13:46 -0700 From: Nicolin Chen To: Jason Gunthorpe CC: Alexey Kardashevskiy , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH v2 06/19] iommufd/viommu: Add IOMMU_VIOMMU_SET/UNSET_VDEV_ID ioctl Message-ID: References: <6348cc7a72ce9f2ac0e9caf9737e70177a01eb74.1724776335.git.nicolinc@nvidia.com> <35701c5e-030a-4f52-b6f6-ed18368fb2cd@amd.com> <20241004114147.GF1365916@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20241004114147.GF1365916@nvidia.com> X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000AD81:EE_|LV8PR12MB9232:EE_ X-MS-Office365-Filtering-Correlation-Id: 8433cce7-a921-4f7c-ea84-08dce4a05343 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|7416014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?t/7on8X5shbGA/lRc/f4Zc3qGn5YNGoeE2k9bOlKCTXTPPxQyw5YAEcHyp4k?= =?us-ascii?Q?iAvXSqsTV1bTdpt3VBU7E6a/+n8iH8uK+A3sas6zN2InljROcV0zSEbUkR3G?= =?us-ascii?Q?pJ29ZvKE+HWj5Vt+y3RwNPzMFjwzB9K4lPQnkwqqGLc7BagocHlGunacdlfx?= =?us-ascii?Q?jn/ZJfWjIlkfEZuSneSFQnpw5RjfhUjQwgWbfRcLoUSTPCp9UWtc+craOj+D?= =?us-ascii?Q?TBDLEttar1dYptCa2/FcvsaCbK55LSXwfjC3BzdhHAa5DwQ0veKWdA0MWILD?= =?us-ascii?Q?hf3zQMOt9WWdzskN2mZzwSJwNwa8RoXigJ9b9aEgl71EsiFFgCbktxwa9jWZ?= =?us-ascii?Q?TfWg9ziXqVqz4Ai6/V4KY72J6hax2m2L1Wc9+AO2lLKtiV/4CYS53ka//sYA?= =?us-ascii?Q?XzqB/WYnfeZc430eh7LTEoCSu0pIKH1qTeh1V5BZ1SamXHhcWdZuOxbMV4Tf?= =?us-ascii?Q?UQFRpxcYTEimQg1opgVEs/+IuSZqa3Q71smHkUrC3o3DzlEtk6cBqwhhFxjT?= =?us-ascii?Q?CIwlcPkk+wcQgHM9Y8uq4N0uIS7LrdCaXTvtHA7dR5Hp+51kDB5ntKoziB7B?= =?us-ascii?Q?AZJSMhoeN5hwcBm3+fE+98aBMQbNpvlJbPD3Y9ahHKDUbs1Ty188HGaXCE80?= =?us-ascii?Q?168ln3mY1GydK7/pfxyrZnU7bR8ieihwCHGplrKelKZQ9C5UngOzaY/F+eiL?= =?us-ascii?Q?fWToKFTVy/1xUQ54ryGz3LTcdxyLzD/MlQhB8SOOaKTsIYz8HEx3j59nUr1D?= =?us-ascii?Q?H7qPpezsfvqNpPIczU8sqdPRx0NVA2tZEcxcYqTY1EiV5R4adHFp5WisFusE?= =?us-ascii?Q?Uo+RwWM4lD7T0ZnHRhP58RAWxm8/vg0Hq91TqcTZwE3ycOnxPz5+hOa97mkj?= =?us-ascii?Q?lOEbsTa2KGPOpWCPAYPoWnlkhtdd0f4skJTIpDP9otPsZpm7K2QChHRHwe2x?= =?us-ascii?Q?Z3AuMlG0a4MdX2xHk6P3tdxFk98gKy0FAt3QBbM90mwnzuwBuiW6oO77T4dI?= =?us-ascii?Q?/LY5l/KvMnUUOwTepFvildMNP0XtqA2xL5jiymPLu6SNRjorcDPV7qcwHkh3?= =?us-ascii?Q?baa3GXjbX8CU48I6+hZKyN/o5Gqri962YGHhDyDwo6wgGHNuZQNAkG4vBv9N?= =?us-ascii?Q?PIecdx2R8dd9zDRuXPiPyvzj5eIMQVOvz5wgV88TdZ61jzJGj5Jd1X7Amogv?= =?us-ascii?Q?dxtaRJhkbUePMyoNDYXw5JXGPF0jrGF5OC699JYAbY/govc6+YGWhEtgJ23V?= =?us-ascii?Q?eP9LNdesfJLczzJ2TgXrD/jv5QJThi5zpwRhKkHRue6Nfk2LN27vPbw+l+1y?= =?us-ascii?Q?3qrNxNUMfslCts47TNEQNTWqhJbE4+join4dXOAQSGinh9cOvXjMBK+0ATPV?= =?us-ascii?Q?qKsfRbw=3D?= X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(376014)(36860700013)(7416014)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 18:14:02.0909 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8433cce7-a921-4f7c-ea84-08dce4a05343 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CH1PEPF0000AD81.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9232 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241004_111415_880971_15DE3C32 X-CRM114-Status: GOOD ( 18.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Oct 04, 2024 at 08:41:47AM -0300, Jason Gunthorpe wrote: > On Fri, Oct 04, 2024 at 02:32:28PM +1000, Alexey Kardashevskiy wrote: > > For my SEV-TIO exercise ("trusted IO"), I am looking for a kernel interface > > to pass the guest's BDFs for a specific host device (which is passed > > through) and nothing in the kernel has any knowledge of it atm, is this the > > right place, or another ioctl() is needed here? > > We probably need to add the vRID as well to this struct for that > reason. "vRID"/"vBDF" doesn't sound very generic to me to put in this structure, though PCI devices are and very likely will be the only users of this Virtual Device for a while. Any good idea? Also, I am wondering if the uAPI structure of Virtual Device should have a driver-specific data structure. And the vdev_id should be in the driver-specific struct. So, it could stay in corresponding naming, "Stream ID", "Device ID" or "Context ID" v.s. a generic "Virtual ID" in the top-level structure? Then, other info like CCA can be put in the driver-level structure of SMMU's. > The vdev_id is the iommu handle, and there is a platform specific > transformation between Bus/Device/Function and the iommu handle. In > some cases this is math, in some cases it is ACPI/DT tables or > something. > So I think the kernel should not make an assumption about the > relationship. Agreed. That also implies that a vRID is quite independent to the IOMMU right? So, I think that the reason of adding a vRID to the virtual deivce uAPI/structure should be IOMMU requiring it? Thanks Nicolin