Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp705524pxj; Wed, 2 Jun 2021 09:21:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQQhFmCXTPfTmwwRmD/xKHCYG/vcmYkhoErLKhbYOPnNYgsiShRaxD4MqBqPAF+2qIO/Lq X-Received: by 2002:a17:906:7052:: with SMTP id r18mr34710427ejj.449.1622650859060; Wed, 02 Jun 2021 09:20:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1622650858; cv=pass; d=google.com; s=arc-20160816; b=PbK42laREW4OYCC2trOZKr9Ih8FcI1Dcc61/mVViRmby7AOB986Rt8WaBUy8YKCaBd cMPt9UBNNQTw3S+x+m7BxRooeSA74yqpCfcDXJlAqrIub2+qYq7H/+MfvyDnm50d8moX lW4KJ7IrvRl0215oEyoigY1oTH6v1In0nQtumIyWapX7D08TVrA6vPT3n9xNApEf/v+3 Db6nX4ORwmtj6n0y2ICwk/fD5LaGrIP0pHfC4aQaYADWVqcXmLTtrdeHHqlkKuydufwY YQWxummDk2V/f9qr7b9Wj6QUwenuSzi+WhvAfcV3yDFNOpxSGA9T916KjgZvPZfeyATA aacg== 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=WqT2czsM8n9i2Pj7oiq/ZqZM1NTEmmwCCkTPDn6BcrY=; b=Ugi8rYQ6RebYwOW7ZCXagEmWtR79p41j2hDUvdqKODgAfUh7NCfxYLyeA/PGQ4n380 hbDFyuQ5ZyTnkD5Tra8FiruC/QmUEAsUEBzGXx8egqEKSTY/saJgIdeGJUyq5DDPfMsi QPDTTNVbgPmTaMyo5BRL44Ppa3WqFQa6YrWORSRBSs1ATeokgW0TjX4mP1H1mZQ2eTZr zy6G/+8vjdpLpFyDE85zyVVb/IR2AB1Um80YWp4PVh3yTh31YIcz6ifQag3UXW3id6Bh nqb4wa8jqptGhzLdh5wqIo9X56ZkUJ7KgZrSMTW2NDKEREH3dPgeDtN2QB9kpqtAIuCn Kppw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b="nIrxxk/M"; 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 dk3si261957edb.476.2021.06.02.09.20.36; Wed, 02 Jun 2021 09:20:58 -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="nIrxxk/M"; 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 S229654AbhFBQSf (ORCPT + 99 others); Wed, 2 Jun 2021 12:18:35 -0400 Received: from mail-co1nam11on2055.outbound.protection.outlook.com ([40.107.220.55]:44385 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229541AbhFBQSe (ORCPT ); Wed, 2 Jun 2021 12:18:34 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fcT8iGuDM8vLQp6Ibu8u9OKVZBUI9Hw/ruyo2zPFmx2Zj2LACluXoJgXoaFUbb6dS96ZZ70ivi9kyoqfUoV3Xz2sFoOZ9UhZPUzXXcCcRx1xxUIlRZUbfffMO+/mhkRToC2SKKgiNbMfp+vMX4ndKPKjPWDAUMd0fauKbP5pIsOP4Oo+hzAy5ScBNLgLbCWMADuhysR/YmqsUts2sCR82Z9W9NDidXVYI0T0QcmDIPhPheHQ420RLN7x37RTxtLcWZ0F0HLKRh6/wySZcF2tSXyiC1rnlujjk/PUB8VUhJAn7M5ICbmuPIiKBCrNhwrzVgIxFWdkPG/uRKrppT2BXg== 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=WqT2czsM8n9i2Pj7oiq/ZqZM1NTEmmwCCkTPDn6BcrY=; b=TmjH5j7oYG9WRuB2OABxVVMr/ZAXjdWPcQZf2d03bYGvnBvokevMOIjFIi+acO3dwSEXhsjaK9vZOIlhC/wymvoFowGOrVJV1BOaUZw+P9muAnye+wLNMtWNDkknejpno9TMfPzshYMn9SWDXRl6PBw9drvckj7aSqzkRRy1i6//mQwrHGSMTFaYZK18k34F0971SRzW4r5P9nHb02KMXXPJneWCDTHNhlwYI5NP25MEzaxCB2iI7eoK7Eo63CAxx9jaBG1r4sSHALCxlku2bIh3xE6S4edBjKCGXCBO680s2v3N0v4yYaFnxFsOi1f/JtxdCjOBqto2N/IFwHD6Uw== 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=WqT2czsM8n9i2Pj7oiq/ZqZM1NTEmmwCCkTPDn6BcrY=; b=nIrxxk/Mo8HDPMtumig4CiN0peQ8k8I9B+jxd3VzX1LDQM5U1m+JujoJtLokQhsgWSpfN+O4smmhGVt5olruQ2Y8pfGPaGXJVL1QTOJky70MeS7bzDjTaNK9Y2O8jtfGxPpjTlFZ74Brl6E/rhAcPqlPKtO+UKpBRu/QbIArusWO+YZeUpsWGkZNrG+Gz0LBiy4tBicbq4trqv1GQMwKavj8fPJq3Ak0jzmjjhLvMuKVe+rK4zVqw8f4RSvjmIX5lmhRkUIhAEfYapH+jMsYoB3S+X7f8PARWSRrKEZeitveQchTUdNcVFqla7OjvUR70+qmqNYBf583PBgU/qh3UQ== 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 BL1PR12MB5318.namprd12.prod.outlook.com (2603:10b6:208:31d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.21; Wed, 2 Jun 2021 16:16:50 +0000 Received: from BL0PR12MB5506.namprd12.prod.outlook.com ([fe80::3d51:a3b9:8611:684e]) by BL0PR12MB5506.namprd12.prod.outlook.com ([fe80::3d51:a3b9:8611:684e%6]) with mapi id 15.20.4195.020; Wed, 2 Jun 2021 16:16:49 +0000 Date: Wed, 2 Jun 2021 13:16:48 -0300 From: Jason Gunthorpe To: David Gibson Cc: "Tian, Kevin" , LKML , Joerg Roedel , Lu Baolu , David Woodhouse , "iommu@lists.linux-foundation.org" , "kvm@vger.kernel.org" , "Alex Williamson (alex.williamson@redhat.com)" , Jason Wang , Eric Auger , Jonathan Corbet , "Raj, Ashok" , "Liu, Yi L" , "Wu, Hao" , "Jiang, Dave" , Jacob Pan , Jean-Philippe Brucker , Kirti Wankhede , Robin Murphy Subject: Re: [RFC] /dev/ioasid uAPI proposal Message-ID: <20210602161648.GY1002214@nvidia.com> References: <20210528173538.GA3816344@nvidia.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Originating-IP: [47.55.113.94] X-ClientProxiedBy: BL1PR13CA0158.namprd13.prod.outlook.com (2603:10b6:208:2bd::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 BL1PR13CA0158.namprd13.prod.outlook.com (2603:10b6:208:2bd::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.9 via Frontend Transport; Wed, 2 Jun 2021 16:16:49 +0000 Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1loTY0-000HUl-Bi; Wed, 02 Jun 2021 13:16:48 -0300 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 41b3ae50-9342-4252-3b19-08d925e1d392 X-MS-TrafficTypeDiagnostic: BL1PR12MB5318: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 98c48qY31G4ammsUConkIY1BtxKMtgxCA876O5VmyCqU2xpkwiUsYtlbBJAWzPNfBhbyq7XhG/qm4Zo8O4W3hWRF2DMmM8xW1f1TmEsRdBl2wqKPKhhlq2N7inYRyXUaxmqwyMvXym573oQgjaJEnkq96VgRWN2PekJ4ppPJU2/kLIWpBVNJ3NJyUXudUibV0OMsSdL9KkfKMZhu/9SrsygbesUfwMT/GMsbRzPhSy8Y9F2Ar87cWnSNcXR3+ZjQN7KDBuCqbX18rxoJlcSE7eLQw8ZXtX4WBbj9FW0Ayv/uvsKUSm/iSkR1Z+SVBnhcBbUutX094BX4w3nVv0aj58go2FXtlQwSjLkcyX2OTj/OAe4IZmmqDY524Uj0CPc9ZoiIlt/nP5md0nh/1o2xNTxDohW4PfO1xjcK6ZG6GmefgPCbU24jGDzsTJ1+qTdMKP4Yccj5Ssn79uOhwZsJ0fAn5Zw1wkAwmsZ8Ryd86bvdjkfDb6088HgxVHhFlzurc+Rc0Ykh6j0yHs2hw4rn6Pl+i0+RPGzRjnRH9rGFChNChc3GMVDyJq7dIm7kb7FVAiKoQBuVtahrEwFRMxlr2zdghFHBfyemh8O1CMs1mQ4= 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)(396003)(346002)(39860400002)(136003)(366004)(376002)(9746002)(38100700002)(6916009)(66556008)(2906002)(66476007)(186003)(9786002)(86362001)(7416002)(36756003)(54906003)(4326008)(8676002)(5660300002)(8936002)(33656002)(426003)(2616005)(66946007)(26005)(83380400001)(478600001)(316002)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?+ZZNffdHbMiA9g3lSfKzdY2U/LaUsOTyiLPna79t2JeiKBAr7gp9Zf9xVSmr?= =?us-ascii?Q?/WY1MLRNrh40GVtqrMKxq/aXd3V6zJ2w7C796QdepC1fHTsmCH6czy8a2mUH?= =?us-ascii?Q?Gkrkr6+fCqvftzA0aVgJufKkvrpbCKTOd66H1oLCRpv75gg6SLji9U4Jb62Q?= =?us-ascii?Q?IdaPmpa6xL1Nsl4rnLiBIkCYtdnqRdaKm0MQTSnnIiWiiPY9FceIww59FTMh?= =?us-ascii?Q?d4eoFVMfvXq5yeILTo6gyglAUoxIh9toVJ0fKR6vv28E5FqkkE46mYpqMv2I?= =?us-ascii?Q?iYNJ0+zRqgQZa7viUP7t7udj/WFkmvXYUmzeRLtQoUaGW6i9GetvrVETO7nk?= =?us-ascii?Q?hE9NOsJlZVhQEM+2L6n+XH/Rh8+HHEp0KwQurHlNqVQbFR2Xz9RZx/ghZyEd?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axeHm2x6YV4l32LVEmFe9AD4qQn6KlZn?= =?us-ascii?Q?VknCL+lI9jexbavEH6Os4K5X?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 41b3ae50-9342-4252-3b19-08d925e1d392 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB5506.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2021 16:16:49.8614 (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: uthiETI3cHEhbUtJ9j5rHpHQNw7OX/sbqLKktAvPANmlT8WxD74xTY7qja7pA0Qi X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5318 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 02, 2021 at 04:32:27PM +1000, David Gibson wrote: > > I agree with Jean-Philippe - at the very least erasing this > > information needs a major rational - but I don't really see why it > > must be erased? The HW reports the originating device, is it just a > > matter of labeling the devices attached to the /dev/ioasid FD so it > > can be reported to userspace? > > HW reports the originating device as far as it knows. In many cases > where you have multiple devices in an IOMMU group, it's because > although they're treated as separate devices at the kernel level, they > have the same RID at the HW level. Which means a RID for something in > the right group is the closest you can count on supplying. Granted there may be cases where exact fidelity is not possible, but that doesn't excuse eliminating fedelity where it does exist.. > > If there are no hypervisor traps (does this exist?) then there is no > > way to involve the hypervisor here and the child IOASID should simply > > be a pointer to the guest's data structure that describes binding. In > > this case that IOASID should claim all PASIDs when bound to a > > RID. > > And in that case I think we should call that object something other > than an IOASID, since it represents multiple address spaces. Maybe.. It is certainly a special case. We can still consider it a single "address space" from the IOMMU perspective. What has happened is that the address table is not just a 64 bit IOVA, but an extended ~80 bit IOVA formed by "PASID, IOVA". If we are already going in the direction of having the IOASID specify the page table format and other details, specifying that the page tabnle format is the 80 bit "PASID, IOVA" format is a fairly small step. I wouldn't twist things into knots to create a difference, but if it is easy to do it wouldn't hurt either. Jason