Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp619449imn; Thu, 28 Jul 2022 10:36:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uIsGsnqK5OhwTyaO+RjlUKyOkIvDmFbfXcn0iNFegWNebE2uE2wGSycvomGxMfmKufQojX X-Received: by 2002:a17:902:aa89:b0:16b:e514:54d2 with SMTP id d9-20020a170902aa8900b0016be51454d2mr27621568plr.127.1659029766874; Thu, 28 Jul 2022 10:36:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1659029766; cv=pass; d=google.com; s=arc-20160816; b=k228M9+lxC8AIT2DR9avokcXoOc1L/8sNdg/l+CQaWAfo/RcDpMVWLcFSx2T3HuHtf uZUXmwX5V4Kg+OzcwcePL0bVy/QpPWwSz3wX4NmBGD6HXHoqQIjlxlgXmxsud5cLh+s3 mEgV0QMks9hfIeriXY+xfuKcaCWKqEZwQ+1u/m7Fdp5XGP9DvSUTyAlggsB4jjLriyz+ DIKAuQpCrvnpAD7VrHxOo8wB4GqeEdCPQYvk8jmmo5QbmxbM54CpWy9JdKx0DiLfhiYS Idd3Su4esqHxWCVeS8+rLimj5t5XKl/tA1fsN6AzMZZxM8h9TRO8JfH/HgS8LKne3Auh 9gjw== 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=sbwfqx7c8hn2p8x1zazq73bZbbCOyYIOP2KNYo4hnkk=; b=JRcaU/EY+Awqbb7sA89Y0J9ZSBhV8+4wbjxteLZg1RCMO60OefwQlLL1+KNTb7K118 z+2ovevdVxyn7Z5nwfQBiomtqmCX7hsvz/4WN22k3aJ8T+UBRHI1kkwZqsatvpUT1NHG bRqAWlf+musHd5gUKtzeu6SfBHUXlkWuioVd5DYBNG6qrD4AA211TYXnmrcbSm5nRIKj LACz4olyuu5wpXBvU8Sv7JmBEuRvxbmdvNNwoUz3+hEoxGdbvIZKl/DI3IafMBau1ua4 mkISnovm2T6f4k/u+DoLz6YJc+yH1QaHXAzPswMHZqUBVmWZOB53tx/7SoFwkTZBxtcW 4D/g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=YrPgNzXV; 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 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p10-20020a634f4a000000b00415e11c6293si870670pgl.432.2022.07.28.10.35.49; Thu, 28 Jul 2022 10:36:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=YrPgNzXV; 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 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231150AbiG1Q7c (ORCPT + 99 others); Thu, 28 Jul 2022 12:59:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232344AbiG1Q70 (ORCPT ); Thu, 28 Jul 2022 12:59:26 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2046.outbound.protection.outlook.com [40.107.93.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4E20743D2 for ; Thu, 28 Jul 2022 09:59:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WrcgS/jbUikNcoKcc75GVK8qvsvXkF/ckgC7Z4TrCPVPPpc4/AaJyzcv/5l83gKJho4i5JqWE2h+LBYEpwP0mNmd0QVByFeU6JPBB5TjeQCl1heLxyzRE9O3IT4hjdK3ioLuetcX+XlKJnDBrLsHVr+i47N4owmwQQfBm/PPGSqCgxUz536H+VfCrLZBRIrFE9xOM5Pzdj2KOOjyK2wA6WpojIyo1QtOUQZip+Hgp0bkD37WA/P4nwteqGIe1OvnCcwvyrlwdnx8fpBe0qXuEaW8LwP/RS9BS5kSGp19GrJDv8IiV1tdCqvTfW403vTLBxjUKGXXmXsBWovIFFsVeQ== 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=sbwfqx7c8hn2p8x1zazq73bZbbCOyYIOP2KNYo4hnkk=; b=fZQT90jHvrALGtWaxGJzNPa8dnmUpKKqDmYDLP7iM5y4InGccomCt0Hgq8MS8fjy6cgoxCN09W0IBPbw7UOiMMwHbI58TlmTgRzZEQMbAEGazv5lReJdTEdAo5rdvvBrCukJ/OdGDFTrNpIjxnISO1IDJ1kiocSvjvA+x8Whe9VZnt3+bnQDuujf9XjNyBRQ1Fd67opFTlf8K01Ebw4jtIdL2e/WTxeh0pCaEDPAicgu5FZrq5O2BlmiTnbBdkS8vWBEX0GhwffcSjSAjVb0hIijmjUjCCfNe0B4APxIhNqut9JNKu7iY4LWekOCJtyQa9fBuSMirXGiwezECh/58A== 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=sbwfqx7c8hn2p8x1zazq73bZbbCOyYIOP2KNYo4hnkk=; b=YrPgNzXV8qw068Qu7ia/GIxSOgjrIa/XOlnZ57pQwMWdu5MnbRut/F+qNaqczmdIRi+l/TBmcM2wSeTiqdX57ZilHa7w67WzJjhiQcyBtXZeLizezdMW3SCqfFev2zVdRkO7oDyvPJ0orWIi2yR2NH0JdtBf0Oj1eb5OEvjNfLh9rQ9aCrJmvRbfmFL+8/88AljpZSDTgzw3y58K0c21rTacaGtbS0mqHgyGnhVqPM/CYP4H+E4wMlJmXhIehkknIN8C7uLQUq78mLcybXHhyUOdUf0jPnxddVTJq6VkJP+xOy6aC3mO7xdtg7sl26Zvb56GU02FmF5dGYfKWHbdaQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB4192.namprd12.prod.outlook.com (2603:10b6:208:1d5::15) by MN0PR12MB6271.namprd12.prod.outlook.com (2603:10b6:208:3c1::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.6; Thu, 28 Jul 2022 16:59:21 +0000 Received: from MN2PR12MB4192.namprd12.prod.outlook.com ([fe80::4cce:310f:93:5d58]) by MN2PR12MB4192.namprd12.prod.outlook.com ([fe80::4cce:310f:93:5d58%8]) with mapi id 15.20.5482.006; Thu, 28 Jul 2022 16:59:21 +0000 Date: Thu, 28 Jul 2022 08:59:45 -0300 From: Jason Gunthorpe To: "Tian, Kevin" Cc: Baolu Lu , Joerg Roedel , Christoph Hellwig , "Raj, Ashok" , Will Deacon , Robin Murphy , Jean-Philippe Brucker , "Jiang, Dave" , Vinod Koul , Eric Auger , "Liu, Yi L" , "Pan, Jacob jun" , Zhangfei Gao , "Zhu, Tony" , "iommu@lists.linux.dev" , "linux-kernel@vger.kernel.org" , Jean-Philippe Brucker Subject: Re: [PATCH v10 04/12] iommu: Add attach/detach_dev_pasid iommu interface Message-ID: References: <20220705050710.2887204-1-baolu.lu@linux.intel.com> <20220705050710.2887204-5-baolu.lu@linux.intel.com> <20220723141118.GD79279@nvidia.com> <686b137f-232a-2a78-beb0-e4373bd20959@linux.intel.com> <20220725144005.GE3747@nvidia.com> <6da27a6b-b580-4ba4-24c8-ebdfb2d9345d@linux.intel.com> <20220726135722.GC4438@nvidia.com> <20220727115339.GM4438@nvidia.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: BL0PR03CA0033.namprd03.prod.outlook.com (2603:10b6:208:2d::46) To MN2PR12MB4192.namprd12.prod.outlook.com (2603:10b6:208:1d5::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d8867778-66d9-4093-db60-08da70ba8422 X-MS-TrafficTypeDiagnostic: MN0PR12MB6271:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3McMyEIgsVeudFC3yLD0kSKCLMvbR1zKLgL8SeeKje800Ffy49F6MO/uIXQr6GYAEglWkm5jijx+oWWCiCJzAu0UexcNFAHibEGV5xvZWlVpNKqlUk11LyhWqh5bOhCBQ+2nIeGVGVnzI5lYaC+y6w4k3A//oIcfDtA7QynNfFtnatlm1ZIzBI7xQZca55KETKCTQjX+K0PTnImAe8t6OtobGSF14eeNhBHe5WlWgZissrfoDbeEoy1QwgRv5BafjdVCp+VeUdqY4DuwB1NZHsqMS65xiG+QQCf9GHPs1v46opp+/7ySOptsUs3mzzpJflZ5cPcdp758h+IOhn/+6a/23gAMpGRFQtOKJnF/+7tW9JHNeKITPd+I0YmiKac9Td7nJCgZ55sxphaEcfKDQnnlVq+E39sb8tUAsNb02VSqBUk7WRsJHWj8ZoWzlppe216EM9VlucJY2OMvrQ+/73yNN38gZQ0UEp462hImmN7vYnXQY6PKPQpfRLxa199ROJ2HB3KfuTPQAkOHHIcN5IlzH6RK1ynH17Kpe94D1ri1mqFvpSy1WfpYVfJAbRdK7iMrQnzdjnWNVl3i2hrddAEhzqsWwElvn18FsYM8FnoP//5393XV99GrI4/WSEVWVUgfqzT+frBJwsnkZ0Mib5Z563CnOhkFWiSnyWx0mDaKwCXLKjiy5+FO3UfSRLMzG5w5/UGzomZo4wClCDJAAEOTcmvXzv5VftG6pJSf2qTfpZeVbRhBfO0OCeFefJd+ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4192.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(396003)(346002)(366004)(39860400002)(136003)(376002)(36756003)(7416002)(5660300002)(2906002)(8676002)(6862004)(8936002)(4326008)(66556008)(4744005)(86362001)(66946007)(54906003)(316002)(66476007)(6666004)(41300700001)(6506007)(26005)(2616005)(38100700002)(6512007)(186003)(6486002)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ew27bYPqxqRkosDyX4G4BcykDHnlchghGStmpDjxmjIRk+ln3WO0o6MkiY+h?= =?us-ascii?Q?8D/FlyWoHUOiXtRr4oy+xOaVevK8LGj6RZjl0eY1NGtqhUW/W74cbnjCKrls?= =?us-ascii?Q?qNEqVZG+fPLhxfuT0UG/Zgk45ydKDZwpsZ2MjwK9lFSK0bgrq2c0hD3twlq4?= =?us-ascii?Q?K1/Vb3Vbl3MLoz2jw6Kh+b4wUM52fQB4/DGK0Askd1zRQ4SWkimuMrQMDEP1?= =?us-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ZUdif4Lv?= =?us-ascii?Q?lwas1iatyCYFr/Ao7+bqx+HqLMpCoOKeEpa2tmVRXCkH1pthAETy2gbCTAt+?= =?us-ascii?Q?+xFWHNVdVSV0SZT22q0su/z9J4kDv2YorK0AxAp6+LLIVD/+ZiApaYSuYGtv?= =?us-ascii?Q?ECm3HRwL77erPSOgTETRSacEqAd3LvJY2CSNxUX0Hglm84DfW9Z9agaaAXDb?= =?us-ascii?Q?8CwWP8GtZKt4ke32heBG9+qgoTrYCUfPzP6Ai/yYWVMW/ZaMKYOEUlOvz5nu?= =?us-ascii?Q?z726LOqO5DrDjW36RjH6tLoJVnTLlhLxzyKElbP+/HYM0DxaARJLE5RiBcFi?= =?us-ascii?Q?eBnz3u6xxRWOQXlXzA88XwEfIGavYlKzszS97D6cNt42IrXeJI90JyI/bv3d?= =?us-ascii?Q?N7uPb0eULKSqIEOO+xK9Od/sQUqTNWkbpZ3IHSz5Qv3uhk4rN1o2z1/rmicz?= =?us-ascii?Q?0nT37+SaVTChDdsYDetdu/uaSsckeG6G0x02QvSj?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: d8867778-66d9-4093-db60-08da70ba8422 X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4192.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2022 16:59:21.1169 (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: FnjxKrT2Vkd1bO+we5qHdQuLtGL5RqVZOo8Y/FFaaMAWVVsfvQ6UFgBL5EDZE2Js X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6271 X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_00,DATE_IN_PAST_03_06, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, FORGED_SPF_HELO,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 28, 2022 at 03:06:47AM +0000, Tian, Kevin wrote: > > Then we don't need this weirdo check in the core iommu code at all. > > and then we could also move group->pasid_array to device->pasid_array > with this approach. Though the end result doesn't change i.e. still only > the singleton group can enable pasid the iommu core can just stick to > the device manner now. I don't see why, the group is still logically the unit of attachment in the iommu area, and if we have a multi-device group it just means we iterate over all the devices in the group when doing pasid set, no different than a RID. Jason