Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3521189pxb; Mon, 4 Apr 2022 19:44:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwlUzcM7V2ov42c1zQbuSS/AxYx/AoV35dgprdgGiHPp+zmaTcuQpwTutg7eLk2sHDm++cy X-Received: by 2002:a17:902:e403:b0:156:ab93:2094 with SMTP id m3-20020a170902e40300b00156ab932094mr1199794ple.104.1649126689731; Mon, 04 Apr 2022 19:44:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1649126689; cv=pass; d=google.com; s=arc-20160816; b=UsELyYhySVUKD9ShdHt+pG8DKnGVbV5YLiFw8Dhpas4aOTL8tZ3SdeCd5FEAQigbWR Zh00yBmDf8eNrjDiOfUI4jekHQQXwKJ7c21Po5iU9Qa6DXEduV7cLH9PuasGrbQ2Z4X2 F4cQ0TlBxNULKh8QprSX2uYUGK9qOMgsPamKrr71U1SU4neT8XYDpH/lUou63QEDOQAV gj922oPXFnMh/RP5OTHe2zV3fjIShBIiZjkFOO/PE5jXb4+mrvRpKth1NJCMsrQDXrPj AMAcMSZOUasX7k2og51NnDS5x8jwaInJPPFxbDfoW/7w0IhFrnFrxot09dnB52sYdTmQ /M6g== 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=LtJt4U3XddyaAF6RxBoLcxcD+kNCWxOCVVX3rhUxAcI=; b=nEo2Cj7rQte9/fVFEbVF+O/h0o5FDIGis6WVAAUhWxIbfHZ5nykc4MGkNv+QyN8W7s eNaGuG6cZw6QibaQXcJ1MAbGFUQKYVKCDMX48FEHX3V6hH9seJJHkIyT3Li5sYBZCsml MlUjJbVjUzBN5MflxaQN3AhwEGN5VDblIGY55+lENHjyDxV/yPyMapUCBEm4axkz+Kh5 xS5y8phmiBqIuqLp3u0nxuQ/VZnKw8AjLq2eypv8Xc2+CIqlBF1xrXQj71uDmVbbSrYQ W31ZZmAdKFANYPi4cSnJK/tHrC/6ck2s33Uo/aQWx+m0btzG03sFQtM7luTeWVtpHbR2 tbWQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=cVL6iWd2; 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:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id e17-20020a631e11000000b00382044ef7afsi12368932pge.779.2022.04.04.19.44.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 19:44:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=cVL6iWd2; 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:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6EB1B386A98; Mon, 4 Apr 2022 18:08:09 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236663AbiCaW2X (ORCPT + 99 others); Thu, 31 Mar 2022 18:28:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233865AbiCaW2V (ORCPT ); Thu, 31 Mar 2022 18:28:21 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2055.outbound.protection.outlook.com [40.107.220.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E59619BFE7 for ; Thu, 31 Mar 2022 15:26:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ADUzU/6jtZTMprgxoX2eF2IAindoTFktmj1+0S08Lb5QHa1QK7eXloYJTUVOODxBANsPLx87Yqe+G9W1dR3B3LuQa7m1+yUj/3kWKHiPNO2jZKBQWwswz+YfrgJ7lp3Laej35GAl4pIXGMvq2qQBKTFhAvUHG9Z13r1G0GgRItOw8eKeRtktqHolmt2f9Cf3uNRUv1OW3p7C9FvH7Xqb1iCm7WqWRrswfbjegjmPNLlw4gzRcERjoP5MI7pMbgZPj9/1QU7fTv5coSPjuTmD8RqWpgUWh9AWFQLBaB7rzZ20aXB8/fGa54iYlNyBE0Dt0cVq3/df3f4q3RIKR+GZvw== 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=LtJt4U3XddyaAF6RxBoLcxcD+kNCWxOCVVX3rhUxAcI=; b=VgdfL77oq39pKnKOcz969wDPmy2GHokhFWjwM2rlyczI/7uBfx/+UjVGWJ7HPzyDfIepPzpJ+hm7rxWHORpwcQy210iySa0XF1yEuHJGwZLOn4Aea8c6A8fbBQyiqYS0EAM9SPP9v5LChOGWR+3K5KwzB2hfNdt4864QoerXFhHFlAka8fRVLNtMxFRaHj1on8+Fta5wJ6uwLYA2qsfu5rQX6rcyFHFeCZKxu44XYr0I+o9s+Mvkf3RLkeiTYhJ35CGh17CWe7XzhiGsMi9vcrkmfNQVZAYEEeJQZTvhBb5BOOJA3rHcQGouPH3+7x1ZsGJRbm7AFKTiowgf2gexCQ== 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=LtJt4U3XddyaAF6RxBoLcxcD+kNCWxOCVVX3rhUxAcI=; b=cVL6iWd2yJnbKDmWHg2YbxgS++wU9G4x6KPrOVpeZ22ZFSEcHGcqh1LJfinKdVuRea81l6+K+KSXO6tS8KAxkXuYpCLWulQwZfC5hgAX8AhSozgb5rTm7lDk6pGAcDq8TStKzsVKZnhiCTC5xK4AaQeYiPdHIc2KktO/8sBdwHTHryvWeEQb+ZAaG9R8jH7j8zSKpz00J0w4kiw2tWTqWEWdTHeJK2KuWvCZ2qgmZ7Ny1fTB8RgNgUUBp+chRGf0fJsqRG8pzut9bqxnkQnuNw1MlBOGmm7b6u0/91H90B3YPCBMqB1hEsH2cpXcAAWco9db4MXXeEk85SCkcVv/wQ== 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 BL0PR12MB2369.namprd12.prod.outlook.com (2603:10b6:207:40::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.21; Thu, 31 Mar 2022 22:26:31 +0000 Received: from MN2PR12MB4192.namprd12.prod.outlook.com ([fe80::cdfb:f88e:410b:9374]) by MN2PR12MB4192.namprd12.prod.outlook.com ([fe80::cdfb:f88e:410b:9374%5]) with mapi id 15.20.5123.021; Thu, 31 Mar 2022 22:26:31 +0000 Date: Thu, 31 Mar 2022 19:26:30 -0300 From: Jason Gunthorpe To: Jacob Pan Cc: Lu Baolu , Joerg Roedel , Christoph Hellwig , Kevin Tian , Ashok Raj , Will Deacon , Robin Murphy , Jean-Philippe Brucker , Eric Auger , Liu Yi L , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC v2 08/11] iommu/sva: Use attach/detach_pasid_dev in SVA interfaces Message-ID: <20220331222630.GI2120790@nvidia.com> References: <20220329053800.3049561-1-baolu.lu@linux.intel.com> <20220329053800.3049561-9-baolu.lu@linux.intel.com> <20220331135922.6c677117@jacob-builder> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220331135922.6c677117@jacob-builder> X-ClientProxiedBy: MN2PR18CA0019.namprd18.prod.outlook.com (2603:10b6:208:23c::24) 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: a95b7e32-7316-49b5-dd3c-08da13658183 X-MS-TrafficTypeDiagnostic: BL0PR12MB2369:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: i0CcMgBElbWDLK8duQm9OBHehd7CR7knDRGHU2kSxz9xLgr0c/yT2W6FExUa6wLm3nDGgVbRjudo9iGpff7h+OJAzZTlK+lvjbSBei7itl06DJlyM4oWp0Ve9g/LlL50V9UpEfLr3LAenUP7JuzhRX7FvU2/WtI8zKkTmOgS/v58iky69gwwtmedrVq75dVwKqHtqSbs92bFomgLKAz+wkVwwcN+iFYzrcZZrkM4uwfm9P66UDCBN0qkT0y5eNfUpPCVLyf1e9ej8DDJxdgikkN/oO9P0sbt1EIIqd7sKWQxHbTPi8GC6U3WnV64bm9+UWrNzab/GIw+T3amwq+yOrHpa38isC14jFqaziqBSYciNpw9yCGOXvF9zvushX50sfHdR++2NqgVxA6mHWjI+2B8+b35ROl4kr2Q2J+7nYcQSNzJwUdzb91JZm27rcNjrEyB9QlnpAaEhIZayYCUWvOsYuixTk1fVp4dFX8oBVmVS4tUwvJvBtkKsLwUBnSSGR5D581kF728qT8KbjphNo5WjEzQAQar45JqfLEaeDJpJGObYdi1zzIZfcR6vbJcQCxJIuYnhOP8FJ6hHrF6f02yWAzbSqr3MAdCfbTG8UVmosc/pCKhfV/TqGdSj6oANRLC6Pk+Yup24IPpWU5J8w== 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:(13230001)(4636009)(366004)(8936002)(54906003)(508600001)(6512007)(6506007)(7416002)(316002)(4744005)(6916009)(38100700002)(6486002)(36756003)(8676002)(186003)(33656002)(4326008)(86362001)(26005)(1076003)(5660300002)(2616005)(66556008)(66946007)(66476007)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?IYfMq3/am+gASB7bcl6U266yxBwUZu68qxkJWVFNeKRQ73iuvFaFpBlCg08c?= =?us-ascii?Q?9xRF35+Wd/VHjofreV0p8Ui9USAnG5DF++zx2VT1eilDU70Efq0pRKC28hVU?= =?us-ascii?Q?fzgzCLosCfBnVyRbiVcuyqOkQd9Pg12Bm4vDClEceMGtAaDqXxh63OSOGVec?= =?us-ascii?Q?0zyOjyw+powzwf9AJc/VbFjkaBeH6zD28o5NkQRmcWuEzpgsv+6bDhdKoFGM?= =?us-ascii?Q?Y8dZsAugA+MYQ2cYoeUYL7zS0/NVhX4CDVrBCsm1GYWpQRq9zX5XLrIXT7Dw?= =?us-ascii?Q?MvFdMmdU2peo6aTokWrGL40f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55L39glbWgnuFHJC8a6Ct/bNFuMPKYGfx3ONbKtUL4eQT/7W3Eth?= =?us-ascii?Q?OkRiVudlx+q3/80/FM419flw9P+V6ez7Do0cKwZ6W3oFseZwwcJHAEWmRbVC?= =?us-ascii?Q?LxlfsXx+DQi6mzP5qemJlbao5vYQFKlQdjDQ9tBzlqSvx5aBpyAEYtJheTev?= =?us-ascii?Q?EdRo4WnC2SjIyNjZDvtcTOZoSSu0IOmHft53+0xgnxFiqM1+baosveN9mGPh?= =?us-ascii?Q?0cLmwDBficDnMZw5Kl6qEJ6pH1xkNk1nnCmb9PtYJ7Q6H6VDnPCSYB8ZBOKH?= =?us-ascii?Q?G2Zzk/3oJPcgSGIgHdCTs7AQGyA4ppGJfH8n25lqVQ3AlerEC/yNeoZnVsC6?= =?us-ascii?Q?4S2dJ5vh95k0O3XQb6ktypmVpNm1ECy8AlsjD5VdKy0aCDEniU1zRfaalQIL?= =?us-ascii?Q?76lXqNDOQaHEQNGS3ki3k9iNEtHmT5KIjik+zh6eL1HwOoTdO8RWQjyHjL/d?= =?us-ascii?Q?7ubfoih2PWG+HBsHhGVgJFa5rDJmdX0QXL10ZbBy6qpjAUSEtOnjliXtfH57?= =?us-ascii?Q?6rtqEsaLRg=3D=3D?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: a95b7e32-7316-49b5-dd3c-08da13658183 X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4192.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Mar 2022 22:26:31.3748 (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: Znn0bg21OUDYdIlOcpP4amhEuUlKyzvLxp+NdoHzFTPWWJHob4NU121XsrbM1Ley X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB2369 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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, Mar 31, 2022 at 01:59:22PM -0700, Jacob Pan wrote: > > + handle->dev = dev; > > + handle->domain = domain; > > + handle->pasid = mm->pasid; > why do we need to store pasid here? Conceptually, pasid is per sva domain > not per bind. You can get it from handle->domain->sva_cookie. That is a mistake - SVA needs to follow the general PASID design - the domain does not encode the PASID, the PASID comes from the device attachment only. Jason