Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4595331pxb; Thu, 14 Oct 2021 08:14:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/Rmvf4+rgaogeMrvRlBBoZ0dZCIUy6trmnIC1SgOmTKER0rBc5ohiWdhKVMtNzd6pTSlp X-Received: by 2002:a50:cf41:: with SMTP id d1mr9132063edk.219.1634224474438; Thu, 14 Oct 2021 08:14:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1634224474; cv=pass; d=google.com; s=arc-20160816; b=urj9VGe4L+1k9BZpu2K1ZjrAWxMru2YV6AGHdvVjvqeqGmXnHpPpPd3hFF3AKTq+C1 wKAOrxwCDSdm7AWDmDrYrv3NtqNuGmcRlyL8mXyocdCcp2W0AXRnkfgG/eUusvZlTfrS XxKNXHsGj2TMv2tzQ/gvX+6ZKsVN3lhEYpLPReI2tJK4AOKfoodcdjJLSu2VE2FwNL2v bLEMVvkMSeJEkUkXOoKJZFSxw5cibUWhL4gsXGwTAA98hREbbP+5BkQw5vj7BwlT+/zu dyhYkbSdb6SGuQnbBZwIDMttcXNrYXLT2peZB4MYl6VaplTdx50hpWtl7hm1aaKjsjBp qfeg== 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=uN/a7ZxDYZkFOG28knwcabOWpYq1E0/j850GpRkvnkg=; b=ZNLNFwFZoifwBDA1/6mjRrskRXkAPdacWZzZ5eb2x+/sTAPG1/R2un6cwTgzOUi23m rOG17DBI5h1RhY7DLPx48IQb5eGJhecbZzILJaWMlX8Nzzfrgn307rMOJOx58bRqPoDc Gan2IJwEWOk49ggH2va52s1jTbr6ykc56KwuFc1sbJHhn4MjSiP4fSuRzLapwsMzthY8 3P07t5ysKX6uyLmATr4MvUlAppLECPAfo6ZzP2p2KVQM1C2XfJnNyJhLjVEFrhX3MTJy x/2FZ6x6OkD6wp2lPEq/rhVN4hnXTXbdFtficB/9ZhSTMVOCs5riCQY5YW5Pd4cv3r/0 mp/Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=HP5oVp5F; 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=QUARANTINE sp=QUARANTINE 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 x12si3948787ejf.380.2021.10.14.08.14.09; Thu, 14 Oct 2021 08:14:34 -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=HP5oVp5F; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233194AbhJNPJP (ORCPT + 99 others); Thu, 14 Oct 2021 11:09:15 -0400 Received: from mail-dm6nam11on2089.outbound.protection.outlook.com ([40.107.223.89]:39168 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234095AbhJNPIS (ORCPT ); Thu, 14 Oct 2021 11:08:18 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qgkum8G1jVN/3nN9mhyw1AtKjUDGHz1YKoni2f8QRLZJkEJUFxGKvIu5T7JtNgruRo7dklQrqasKzeLC+DjkbevVeAEz4jhsUebeMgc20yzzYbho5kYyIfLV+Z6/7+JTouXaDCT85sv1G13JvEw4QoQxiy2E2+aMA8TEOnx+oHbDsjvmTqKEVJQWz1E2WjWBboIPr6EzkgRnf4fA8Z1IVFkan+Gz678yfL1oTHHEgU4tHYkfun0cCV1DTJMaJMnCCNK1PL499aUK7c4XMnufN7Sks/6WkfFR/6JGwMAfADc5Le3cXnH5L60sNzvHam63Q1rnotaCudHwPWrshYoUfg== 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=uN/a7ZxDYZkFOG28knwcabOWpYq1E0/j850GpRkvnkg=; b=MWaa8YFj0J8bHWnD7My6TvQznyBhGK/mJU4s3vKfTjtaOXTMw+7oj2JbfXCVYdfis7Hk4ceMx6vJiN1QKiz1xyo7fH5Zmmp3syikGbpa0gMLtvVzyz/5JCaSw0NTuaMPhsU9qxrN1x3Z7p8nq9DsCvVwjRz2CM3Uq2rtGbGcxaCUJlBbtNFeZP9mp2vaxRhovzqVFfSyTXNQRNqbPKtIUExqY979SJDt8e37EgEWChiOMuBAYavfxRg2S+kEP3MZSxcXaoOL+t+cBV834+cB6sT108XaflyfwfKunTY5aLniCXcQxFhPgtBXgQ/uKEf0i8bEoA6GBC7m3W1SjF06Zg== 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=uN/a7ZxDYZkFOG28knwcabOWpYq1E0/j850GpRkvnkg=; b=HP5oVp5FiMB6ycvJLb0f72bqiXJICCdMo5M2/5EHDNmSnziVYWe0WKuxItNQf0KEkZsqp4r4aArEoeqAWJCE1WPeAcuhVAC/lRTtSPkQ9LfR6Z7TJqgbxaG+dQT0seLHceJEsUcWR65bw2zSY0gzP4si9866i3QsN1W6aN6QABtIXOsRFWaxRrYkjLX1SNOEyEAzOId3ZFVcGjwm8vEe5ha4/ZsmuQ5v+bv2poxT4P0m6YQoEHtdENT7guKJt7mGTPpxl5Ymogpg/eZ3Z9H9so0/iIf4+A6jOpJmk2wBUe5/EKD8bcw1ODd6aUHnhVlJFL7CfRvgIVl/LZWi7mgkXA== Authentication-Results: gibson.dropbear.id.au; dkim=none (message not signed) header.d=none;gibson.dropbear.id.au; dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB5506.namprd12.prod.outlook.com (2603:10b6:208:1cb::22) by BL1PR12MB5286.namprd12.prod.outlook.com (2603:10b6:208:31d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Thu, 14 Oct 2021 15:06:11 +0000 Received: from BL0PR12MB5506.namprd12.prod.outlook.com ([fe80::e8af:232:915e:2f95]) by BL0PR12MB5506.namprd12.prod.outlook.com ([fe80::e8af:232:915e:2f95%6]) with mapi id 15.20.4608.017; Thu, 14 Oct 2021 15:06:11 +0000 Date: Thu, 14 Oct 2021 12:06:10 -0300 From: Jason Gunthorpe To: "david@gibson.dropbear.id.au" Cc: "Tian, Kevin" , "Liu, Yi L" , "alex.williamson@redhat.com" , "hch@lst.de" , "jasowang@redhat.com" , "joro@8bytes.org" , "jean-philippe@linaro.org" , "parav@mellanox.com" , "lkml@metux.net" , "pbonzini@redhat.com" , "lushenming@huawei.com" , "eric.auger@redhat.com" , "corbet@lwn.net" , "Raj, Ashok" , "yi.l.liu@linux.intel.com" , "Tian, Jun J" , "Wu, Hao" , "Jiang, Dave" , "jacob.jun.pan@linux.intel.com" , "kwankhede@nvidia.com" , "robin.murphy@arm.com" , "kvm@vger.kernel.org" , "iommu@lists.linux-foundation.org" , "dwmw2@infradead.org" , "linux-kernel@vger.kernel.org" , "baolu.lu@linux.intel.com" , "nicolinc@nvidia.com" Subject: Re: [RFC 11/20] iommu/iommufd: Add IOMMU_IOASID_ALLOC/FREE Message-ID: <20211014150610.GS2744544@nvidia.com> References: <20210921174438.GW327412@nvidia.com> <20210922140911.GT327412@nvidia.com> <20211001122505.GL964074@nvidia.com> <20211002122542.GW964074@nvidia.com> <20211011171748.GA92207@nvidia.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: BL1PR13CA0369.namprd13.prod.outlook.com (2603:10b6:208:2c0::14) To BL0PR12MB5506.namprd12.prod.outlook.com (2603:10b6:208:1cb::22) MIME-Version: 1.0 Received: from mlx.ziepe.ca (142.162.113.129) by BL1PR13CA0369.namprd13.prod.outlook.com (2603:10b6:208:2c0::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.7 via Frontend Transport; Thu, 14 Oct 2021 15:06:11 +0000 Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1mb2J8-00Ex4Q-1G; Thu, 14 Oct 2021 12:06:10 -0300 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3539ff5f-53bb-45a6-2ec0-08d98f2428a8 X-MS-TrafficTypeDiagnostic: BL1PR12MB5286: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: z+3XkRKKQUULRIVmH8pny5JyJ9CJEqxcq+sbKjIkQOeYE7x+f+Cu4wzmtpRBC489S/YA3UEE2nAFOVH9qj77cO1outBGNyThj0rRrgCxAxUZSnPnrmrrPzqUXqHkX+/RhgiImIfa4FzNF0YQAYgrBLgL3xafSAAYEbKStAlItoCwYOU3rIZENnkxfPJPP8xw2IiMGmmzaZz9Mv1nHYgO5k5eD0XS+GC8eBo8w07IVPVD8ZioAohDdUU5b2N/w3LpuCpSW7uK1jHzq3P1/r6m+/av733/CfpbJbI1+Ma7cI904be4RnECwk6BFk4VhjLPE90+Pge+cQY0YIIuTni9lnsN5QJelm6ddrGcGwqtsQJJI0ut7otBn0W5xNCJgDlQ80z6kf0OaU7d2hfcXX2YPI22ooFMOihbdNMtoGAVp4siqwcj69TS2CqYb7hPIL36IiOZEPwnkbFimyHDmDJzpoACggr6C+1O3EwJ1POl7CZ9nbxtzWEA1Ldptg+LJBZ/v5Og6+ZDPP0siJoc+c1OtS0Il5sj4JUVafDVspSEDNfsRZ8Y4m5WRY3ilwBHw9opiMfA9HVGYm8F5hAFh+uraZmFBWsAVjQjgG3aaooiEhRJr6WBCvYAmUFaVn6h7mOMSu1/icoV3UvQTRaZr5BqqAn3obRHm6RGFk+A9RgzSudZc7N7JoLopT84s8+0dVeWeDyASQ5JiH1kgEQg5oCN9A== 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)(366004)(426003)(316002)(2906002)(7416002)(5660300002)(38100700002)(8936002)(83380400001)(508600001)(2616005)(1076003)(66946007)(9786002)(6916009)(86362001)(66476007)(66556008)(186003)(36756003)(4326008)(107886003)(8676002)(33656002)(9746002)(54906003)(26005)(84603001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?uI5CnTu30fEyEe3vzb0hJJ9jNsRk3TEV2Ph/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aJ81TZS1bXiZlZZqVA+j4BdczX0X6aSF4qJV6+ButTZR?= =?us-ascii?Q?/CxOlx7APWj98GK9NUORVQj9yJZl26bj9p+ylDyWcetngZx+ejwlLiKW7dk3?= =?us-ascii?Q?AGth2b+j6J9T7LdB0bGDO2KexPDNoCxPCHsJ4mrNOtq5QhbzVyf5+zfboH0K?= =?us-ascii?Q?Vab7zY5BgvMa9N/hdomabOZ9VUcEi/mF2bsiCDnsLtvhR+TbRqNh6VBPbQx2?= =?us-ascii?Q?/Z50XSL/UAkAJbSZbRJWYE63hlbWjVRzi0+bsxMAeIYFvcyJfgDzA6Y5JAHp?= =?us-ascii?Q?DmU3c0DVM5T+yprujizivKAKIrBBOoR26V2MeyhxFfvf6b7clnlgPphX8l3e?= =?us-ascii?Q?Dj77+uhs+PNiJnI0lphIYPsbs8oJt/yZERhE7PLpcWhSY2K+/9HVn9DlD2yZ?= =?us-ascii?Q?erjp/9XkuR6i1sRugs6miC+co6SI/IoRJGUMAms0uSa9Og=3D=3D?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3539ff5f-53bb-45a6-2ec0-08d98f2428a8 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB5506.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2021 15:06:11.4924 (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: myak+zlqHBr6n9wGoRDwjTW/dvsAxDuJpIffRF+sVhBv1hzUWyIIID0G2rR2Dibh X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5286 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 14, 2021 at 03:33:21PM +1100, david@gibson.dropbear.id.au wrote: > > If the HW can attach multiple non-overlapping IOAS's to the same > > device then the HW is routing to the correct IOAS by using the address > > bits. This is not much different from the prior discussion we had > > where we were thinking of the PASID as an 80 bit address > > Ah... that might be a workable approach. And it even helps me get my > head around multiple attachment which I was struggling with before. > > So, the rule would be that you can attach multiple IOASes to a device, > as long as none of them overlap. The non-overlapping could be because > each IOAS covers a disjoint address range, or it could be because > there's some attached information - such as a PASID - to disambiguate. Right exactly - it is very parallel to PASID And obviously HW support is required to have multiple page table pointers per RID - which sounds like PPC does (high/low pointer?) > What remains a question is where the disambiguating information comes > from in each case: does it come from properties of the IOAS, > propertues of the device, or from extra parameters supplied at attach > time. IIUC, the current draft suggests it always comes at attach time > for the PASID information. Obviously the more consistency we can have > here the better. From a generic view point I'd say all are fair game. It is up to the IOMMU driver to take the requested set of IOAS's, the "at attachment" information (like PASID) and decide what to do, or fail. > I can also see an additional problem in implementation, once we start > looking at hot-adding devices to existing address spaces. I won't pretend to guess how to implement this :) Just from a modeling perspective is something that works logically. If the kernel implementation is too hard then PPC should do one of the other ideas. Personally I'd probably try for a nice multi-domain attachment model like PASID and not try to create/destroy domains. As I said in my last email I think it is up to each IOMMU HW driver to make these decisions, the iommufd framework just provides a standardized API toward the attaching driver that the IOMMU HW must fit into. Jason