Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5058342pxj; Wed, 9 Jun 2021 08:14:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXKdXURRuXDpYHqeeej8mdnWarzl4SOa8HZqCAwH752zTQMfQjnuJaUMJXMhxuWBF1Tji/ X-Received: by 2002:a17:906:e88:: with SMTP id p8mr364230ejf.105.1623251641851; Wed, 09 Jun 2021 08:14:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1623251641; cv=pass; d=google.com; s=arc-20160816; b=YLj+PgbzeXwRINs8385b3yr9m9Ge9kMt+Q8RAC0CAuH56l22vjrytXCZUrD/nhm8H8 pU5uJkmrSonmY6UB9/8AARN/FV6OHT8RQ3+taGC1NAtyf420LZwHgHMBE9G8wN3psmb4 XqntOQes9p/5Z1VjD1XYvhvEZ44LgltXPEXCpeBhwL8mH3GJYIf0gJiRW2BCH/XDeinM 99dujgvawnamWyEz3LaLT8EyA4FlqHHl878I+lRvGOIp+4MC7L/5baJsexkGvHN5I+Cy 7XwcRCNBNvpJO6NhFgtppo3pfrePhN6vupkVmNAyAZQKZQAogihpFYONNMBrQhHUzzZw vS7g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Zwj1Avnetk6RkYWNvFYOeup0374u0tgyFNkucQkz95U=; b=HMKW3kFWetitFGCFsfobVQe87oWGsr3fh56BJ0Bs4kq2I5g/jSLT81ZDH+PqI0eQRg /16J31kCugYvkEzKPfVgfR2c6gpGuKWhMqx6QDTF8MgIp1uvqqEfrj2lW6XHIJV6NLwt M93XJwgLAk6v/3am7Dv1/1nnXSU/O3AEk3VSF5io58iRs0xlAhpFly08Hl9UWjU/zRdS UqqLEZcrUFTUFUrUO+KiHPjF3f21lKLjCkDlh8D+p08FJ+rJchwgkzgdMc+KyVq0CLTm FJRUsjdfivACKF86c6Do5rTxXuvlOTar0C1iGb58SB2P3BUMal27+7ML/i5LefuY4IPF BB3g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=LgVQqCnG; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 2si869edw.66.2021.06.09.08.13.38; Wed, 09 Jun 2021 08:14:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=LgVQqCnG; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233783AbhFIMlR (ORCPT + 99 others); Wed, 9 Jun 2021 08:41:17 -0400 Received: from mail-mw2nam12on2054.outbound.protection.outlook.com ([40.107.244.54]:31107 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233488AbhFIMlR (ORCPT ); Wed, 9 Jun 2021 08:41:17 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nAT+8FBaqui5CjMdCMyBQhzM/eCe+5wD7CTQMYgftpwEZP/xznGD0xRqpiGOSZG4jKPDvkbdVFF/2Wk2a+hgxF6APSurUuHgb6/wgliLmmICiKrumpoeMt/xcOjOTTDiLJ0lqvuDk9xANZy/kXhXPEhLJKGAj67MA+/4TqWrCwkywYCAP7n42tHC/3XhpnPjc4kSONcaqtqFF6H9srs0fmHyfjRRtrIHcZe9et6OC9uQj0GlooDURnhR0OMdqPqv0l79ESbnOtOum2FBxVdSAe5R+ymrOGFeinhmxIWK++/vMxQHalVzTktPWvb1t8LYGn3S2O9o0uLP6gDhy46t8g== 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-SenderADCheck; bh=Zwj1Avnetk6RkYWNvFYOeup0374u0tgyFNkucQkz95U=; b=UIObTzQA8qKuDqYrZ6gfrg5HMDFU926OCFax+Dvn757xbrc97efgNg81Z+kbuxC3DLXO6tcekxQPVW6Sb+70DJy2F2nUppT4PrgqXrPsHOJxGna6Y72WRr5rpqkMZnjz8Kl5DTCfCGY64iCHNQhNcVL3DlKDQHEMKCehrUM5rwnkcgR4qIF0+4J48cftDV2TpO+DRQAOIc/JRrhcENIXEzuQJ3e8ZfBesa7R1nrdaQdTUCL2fwYI6GJi8GHqK0bOohtYuwUrXYRV/3PTBTSwFhMcx1Pq03Ro3Cc2qqLRIcUgGgY3beye4Bp3ocizHEZyOrXS92hj5740LS/8XqzcyQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none 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=Zwj1Avnetk6RkYWNvFYOeup0374u0tgyFNkucQkz95U=; b=LgVQqCnGunwnKXWhB5MOEfcTd/WotU3LHJUGhAmjrw9b5WhNjoFTn9tmg9INPy8rTRdq7v0SQplpiFMRqZArNxIVDuP3xxhzL5dXmAVYkGcWc5bIUHLYKWFME6ZEv+6TB0hSfPCP0vd1Bh6ohhT+W+Sv8KWHzlirDoZm1Be4VM2qXbBlYMoenJDDf6sUnBmJhJcZOgsJHogoDSTizg7cbQVLYmYxEsNSYPMI5d+Xq7QaYbFURjzn9S03MPAKP9SRUmMcH4knWLC69I/G85urQgO/Ppvien9KWfX07giAfJv2WXWMp44nHDfmOKk+V+amXR7jxRPn1AbEVbgc6dfRIw== Authentication-Results: 8bytes.org; dkim=none (message not signed) header.d=none;8bytes.org; dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB5506.namprd12.prod.outlook.com (2603:10b6:208:1cb::22) by BL1PR12MB5110.namprd12.prod.outlook.com (2603:10b6:208:312::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21; Wed, 9 Jun 2021 12:39:20 +0000 Received: from BL0PR12MB5506.namprd12.prod.outlook.com ([fe80::3d51:a3b9:8611:684e]) by BL0PR12MB5506.namprd12.prod.outlook.com ([fe80::3d51:a3b9:8611:684e%7]) with mapi id 15.20.4219.021; Wed, 9 Jun 2021 12:39:20 +0000 Date: Wed, 9 Jun 2021 09:39:19 -0300 From: Jason Gunthorpe To: Joerg Roedel Cc: "Tian, Kevin" , "Alex Williamson (alex.williamson@redhat.com)" , Jean-Philippe Brucker , David Gibson , Jason Wang , "parav@mellanox.com" , "Enrico Weigelt, metux IT consult" , Paolo Bonzini , Shenming Lu , Eric Auger , Jonathan Corbet , "Raj, Ashok" , "Liu, Yi L" , "Wu, Hao" , "Jiang, Dave" , Jacob Pan , Kirti Wankhede , Robin Murphy , "kvm@vger.kernel.org" , "iommu@lists.linux-foundation.org" , David Woodhouse , LKML , Lu Baolu Subject: Re: Plan for /dev/ioasid RFC v2 Message-ID: <20210609123919.GA1002214@nvidia.com> References: Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Originating-IP: [47.55.113.94] X-ClientProxiedBy: BL1PR13CA0368.namprd13.prod.outlook.com (2603:10b6:208:2c0::13) To BL0PR12MB5506.namprd12.prod.outlook.com (2603:10b6:208:1cb::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mlx.ziepe.ca (47.55.113.94) by BL1PR13CA0368.namprd13.prod.outlook.com (2603:10b6:208:2c0::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.12 via Frontend Transport; Wed, 9 Jun 2021 12:39:20 +0000 Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1lqxUN-004bv1-D4; Wed, 09 Jun 2021 09:39:19 -0300 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 42b3fe8c-48ad-4c84-0aa5-08d92b439a82 X-MS-TrafficTypeDiagnostic: BL1PR12MB5110: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eEWCZl/4HPvkf0L2gIVjMmr9wx3Lt5oOPRHsFCClBY0PjKndXsXGRhWAUAQO/YK+n9XaUhtrHZIHRdaUCMNDQOVxvtfSobKITaTg4LKA6QigjA1+v/v9rYpg3fbVz4BbWgEOoSqtqlq4i2BogOdGHmkY4v5h5wmqHxU43H4mYxn5+PW9kdzGlcGweJSDTPoJEqlO/Z4fEA//MSO9LzX/MdBkamFW3GzjRIyRFTFRQuYM1kNQO0XyjcLKIHFcg7JKOpAMwv3QRAWqnmMnIOjN4txAEY9Aq5fnUZVPsRDGahaPrAByDxviyWJulePw62DWIsK1o/MelvQqsINPAEe9eMeNJ9XuJluoKSqDwg42nvJx80PpmTRWvjKyrctlOhKSnwW1ztZhX9V0AY4Cf7hsQGs/inT/LNVW5Gw583M4h6yhkTtAW4PbG7U8in1kQZJhyGOeL39IwDrOhrP0JCxXZQYPM+5QSdom7/jJO9bhFfty3F8uYNJAw2XBcENQUCE45W7danyqer8D5mmWJcvukBo59ZHTG8ueOZP4//nKpTNZsjEDIIg86YdvSq81HmtAQRy18RTTbN8Soi8MfwBRwWQXTfnYD/Ac7Z4GWu57+9Y= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB5506.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(136003)(346002)(366004)(39860400002)(376002)(396003)(26005)(186003)(2906002)(2616005)(1076003)(66556008)(66476007)(66946007)(9746002)(4326008)(54906003)(86362001)(6916009)(478600001)(38100700002)(9786002)(8936002)(8676002)(316002)(36756003)(5660300002)(7416002)(33656002)(426003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?XoodICnufil7P34oPBAQzOv9QjagiTQOhRVvT1p5GIF48eYIq2ybdz6UFbod?= =?us-ascii?Q?oUQOkuc9AUYXwI16WAhZGZlewQz+sKqdsld3x/0YcQzi0wW4o4G+xYYkPvsJ?= =?us-ascii?Q?R8pwcV980CExlqV5S9JylXZhZRNRnM0rc/mrdY8Z509hZGU4SLBKqThJL+0O?= =?us-ascii?Q?/hg7kdYn/7VaYuglGI15ZEGgtSBl4iR1Mfg/WYxz5oMSNSDF6N7sgK7Wgmc5?= =?us-ascii?Q?TOGKfymaSUX1pH4Pv/SHrMayMXaZ0SwV7QxZpc2LtOEgOXRzyt1XnVu3px/l?= =?us-ascii?Q?e0YqQrIXIjhrjmY9L5mInqkASqz0XW2gNOW/cxYZuIFfgphEE/IMaT5ZfI+I?= =?us-ascii?Q?uPnn64tHNoN7HNn564zHkSuU12eh5tB8inhoCKSxCR8RbO7PEaVl7UrxuGC5?= =?us-asc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GAAIV/S8OPaPuV1mPeibZsfnk3?= =?us-ascii?Q?o0ScSLPf6UgtrgPNeZAZ96p7?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 42b3fe8c-48ad-4c84-0aa5-08d92b439a82 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB5506.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2021 12:39:20.7191 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7H29M5qMvliK+NMCagORSUp2UARKKkoNxTEab+fHKpAXEcu2EeudflIFSSu+MnaJ X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5110 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 09, 2021 at 02:24:03PM +0200, Joerg Roedel wrote: > On Mon, Jun 07, 2021 at 02:58:18AM +0000, Tian, Kevin wrote: > > - Device-centric (Jason) vs. group-centric (David) uAPI. David is not fully > > convinced yet. Based on discussion v2 will continue to have ioasid uAPI > > being device-centric (but it's fine for vfio to be group-centric). A new > > section will be added to elaborate this part; > > I would vote for group-centric here. Or do the reasons for which VFIO is > group-centric not apply to IOASID? If so, why? VFIO being group centric has made it very ugly/difficult to inject device driver specific knowledge into the scheme. The device driver is the only thing that knows to ask: - I need a SW table for this ioasid because I am like a mdev - I will issue TLPs with PASID - I need a IOASID linked to a PASID - I am a devices that uses ENQCMD and vPASID - etc in future The current approach has the group try to guess the device driver intention in the vfio type 1 code. I want to see this be clean and have the device driver directly tell the iommu layer what kind of DMA it plans to do, and thus how it needs the IOMMU and IOASID configured. This is the source of the ugly symbol_get and the very, very hacky 'if you are a mdev *and* a iommu then you must want a single PASID' stuff in type1. The group is causing all this mess because the group knows nothing about what the device drivers contained in the group actually want. Further being group centric eliminates the possibility of working in cases like !ACS. How do I use PASID functionality of a device behind a !ACS switch if the uAPI forces all IOASID's to be linked to a group, not a device? Device centric with an report that "all devices in the group must use the same IOASID" covers all the new functionality, keep the old, and has a better chance to keep going as a uAPI into the future. Jason