Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4738180pxj; Tue, 25 May 2021 15:24:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhDAKRbBjWyts/U+LAzvmqAv2PNcsJf+1qqrOfi9vmnkwiSByUnibiAc26hAkfhN1orMCR X-Received: by 2002:a50:ed13:: with SMTP id j19mr34180666eds.190.1621981460266; Tue, 25 May 2021 15:24:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1621981460; cv=pass; d=google.com; s=arc-20160816; b=FulrN7CWian1xK2VYuRg0J0m6c/GwWdlhIVrwwA9qngKrGw+1hY9R5Yo5DZyOcdv8M NkmyNHDI3wdhG/K4aCj+7zFlCwTI+yty1MFrLY2addugVjF4ek92+8dDFoHeq917/3uN NWj5f1kOvXtxWCCnNb9NqQr9CY8VbnmIOBsfmKsBnTHp9fkqyni/7TOplgJ1YMFTyH16 MQs/qlzUxK4FTvm+4IaGp1pXn/ZuF2qlaTebGGiaO4zSxPYu63ow7VZE62snUpAqeH93 0EuY5fwGEOpmX1uM6PGs1Ylt/bsiu5Go6palvruTdH6O3UHvdevuo/sJ/uHvq9g9T0HJ pQ4A== 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=+ez518mnFOeVKnb237EN1Z0Us45eGb+SvnOrdSmi2FQ=; b=KgzrPXR5bLNGF/BprcgbeTYk3fv7/NIBiGmkQz+rpXQ7QyoPp4NBxJ35+QKJCDgULu xuZf3G+GFEn4IIfR6a0RP1q3QA2rgsk9QpOsgp0hokEMzWPVHBu7vWriMefvFqSKucOB UaOq14PDZwjfELzfatJS8a6NmgZUYoXECrBzeM1BVZUNr6Uw8en6u6iTghXCfTp7OzGw 3CHcHaMcFuQl9MUhM7Vd9hxM7YMqWFy8OXVZgQ+8+7Y8k+mJIZz2DRCeKNwpGUnyAX+t ZhD0ekKl6opY8jDuxTeUZZ3GCbpfm898Q27di+TNsdAcwn22KOdkOf8mMzEH3znKZSP8 g6sw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=AXt88h7y; 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 qt20si10887970ejb.559.2021.05.25.15.23.57; Tue, 25 May 2021 15:24:20 -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=AXt88h7y; 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 S232911AbhEYTye (ORCPT + 99 others); Tue, 25 May 2021 15:54:34 -0400 Received: from mail-mw2nam12on2064.outbound.protection.outlook.com ([40.107.244.64]:9952 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232849AbhEYTyb (ORCPT ); Tue, 25 May 2021 15:54:31 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AfZjo6lD8cvWwxfP2chaopOw41rQUFF2Sha01+QlAaZQzCBUGrNMaVXt5Nd7ML5uAA0GWvuNynnpljYzBlxri62JcEePOg4jBdXx65CuLHi6BbMZb6z8Ees3qoV4ezSRuFt+Oit1LR0J1uJT/Z3dqs9HZaPjvo6S8u3AflR9i8LQgU/XNGXtumqkGL7s7/e9my3sDcgDFZqAgW7VLe23IqiCZlBXiZS8yPR1iO1qMhC3HhTNggCMZuKHIhKnbR4u5EElJBHYt10rNx5PfpbsCEuGGpjrcPA1e3TSn6hV9jMk+HmFHyJgMIAXadRRqN4F5NkiwFSKekFAUgInW9Ku4A== 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=+ez518mnFOeVKnb237EN1Z0Us45eGb+SvnOrdSmi2FQ=; b=jUM8bxFbwaZ1ZaQvPFp7HYKkHhdHruvqaGusjYaiZ6qLhGC4Z1mNCMAEkN1uI5xpmgusI15pbe7pImLKzuxBiwUkQuA0K1fEVgQHalKb8E+MhCLjMHVJlkIVD3qGKhUAWdQX111aUbDfb8gkU8ezscLD/vpR+r9SJ3UWLHTsMrXVdDaAK9wQWLWa/5T75U7E+5O2z/TfDIAL6ITGYc+UGUnkkWsBOn+xgQzmybyVDykJlZFYqnslJTaJOwzG/hSeJ07C1T1+Lv8o/GPkQ5tU4DKHY/0yDvCOaUOawIx6e3ssl7FlnDIxelJ+Wu8X8tzPzR0qlztjmocn4srPNbiDRA== 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=+ez518mnFOeVKnb237EN1Z0Us45eGb+SvnOrdSmi2FQ=; b=AXt88h7yrqnTV6zQ6EzJrOpllPEsiyz/yMhcG0r/BS+BuZq3zmUMROTPI7bVZXPOv7LpYZ/UE7hgfDqQsEmZofIMOr2avqStIlgc+lFM8nk/y3FUE9a0mMS/pWrfSrDgdSmhVhvBNikp3n0nZHAOMKyy06wxrS7OOIRLIzJJ7HJ6mAcG0b8+ABSSIHkIMd+bdkzTG1gns7vFJhRz9um0FV8xcMSxy/fv2LaF+6F68N8VMwAu1P9mlpl2xFq21CmXP/+BHpOOqhxH2zruZ4XX/JN0gY/ArcPfc032eBlTAjm3mhSZa9THx61MxKdwR83DeTT3yMhgT+y10qQe7oELvw== Authentication-Results: nvidia.com; dkim=none (message not signed) header.d=none;nvidia.com; dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB5506.namprd12.prod.outlook.com (2603:10b6:208:1cb::22) by BL0PR12MB5521.namprd12.prod.outlook.com (2603:10b6:208:1c7::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4173.20; Tue, 25 May 2021 19:52:59 +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.4173.020; Tue, 25 May 2021 19:52:59 +0000 Date: Tue, 25 May 2021 16:52:57 -0300 From: Jason Gunthorpe To: Kirti Wankhede Cc: David Gibson , Alex Williamson , "Liu, Yi L" , Jacob Pan , Auger Eric , Jean-Philippe Brucker , "Tian, Kevin" , LKML , Joerg Roedel , Lu Baolu , David Woodhouse , "iommu@lists.linux-foundation.org" , "cgroups@vger.kernel.org" , Tejun Heo , Li Zefan , Johannes Weiner , Jean-Philippe Brucker , Jonathan Corbet , "Raj, Ashok" , "Wu, Hao" , "Jiang, Dave" , Alexey Kardashevskiy Subject: Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs Message-ID: <20210525195257.GG1002214@nvidia.com> References: <20210427171212.GD1370958@nvidia.com> <20210428145622.GU1370958@nvidia.com> <20210503161518.GM1370958@nvidia.com> <20210513135938.GG1002214@nvidia.com> <20210524233744.GT1002214@nvidia.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Originating-IP: [206.223.160.26] X-ClientProxiedBy: CH2PR18CA0054.namprd18.prod.outlook.com (2603:10b6:610:55::34) 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 (206.223.160.26) by CH2PR18CA0054.namprd18.prod.outlook.com (2603:10b6:610:55::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4173.20 via Frontend Transport; Tue, 25 May 2021 19:52:58 +0000 Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1lld6n-00EZJr-Le; Tue, 25 May 2021 16:52:57 -0300 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9be89c40-09f1-47ae-0493-08d91fb6b288 X-MS-TrafficTypeDiagnostic: BL0PR12MB5521: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2089; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gcYzBgMBwmCyA9GAJfKAP6vgvuhyI0224iru0w8FGsS8OI/Z7nyLGsBBOc0Nx+T0SIAJMeIl6BYZ+RiynL0kI8aEkXdnlDx5gPJw359b0z5Mo5VA0V7+/LbX1j+vVwYJKAWvuL3FkGESRNHQFu1DmOtgJJh2gOLit3QSGlFsN0LKvsHKSmeCF+xKwb5nn6Y38ehz47bMGDlD2Ijop3kJT1vkHnRJDF5IkMGUB1fq9njhq1LFDR5WC2QtWXmTYujBvOHv7G9VHBzseDBENiheqMRWlEaZDj+DA/e9E7qQIDTM0aLY7VFp/EpslX28TZLQdGaHDdcJ50Yl9mr/X8EgpiacXBOMnMPgaSMSdlovEe9OldNLScoFJ34yYecIj5nvr8R8xuaS+/da1CmgtAJxbw1G8DasvUUNw5KccGitCnOFl1K5nhEGcq5Om/p4uDG5MvwE3N0z8hcHTtrjrabWqRHbKTTJ0kZWIQeys7m1uzmZfpmUVzJdKUK+x6cdGJqN85TAmvTix+JnlJc0CnLn1wZPygxqzlM5egLSDMP9b6mFqs3qhNU6DDVm9HIZnMKX4Wd5wNGoHNQvHYD/Zw8Lk3wmhI530mmmaKOECH8e8Oo= 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)(136003)(346002)(366004)(376002)(39860400002)(66476007)(4744005)(66556008)(6636002)(9786002)(9746002)(1076003)(478600001)(66946007)(186003)(7416002)(5660300002)(38100700002)(33656002)(8936002)(426003)(316002)(2616005)(54906003)(37006003)(26005)(8676002)(4326008)(83380400001)(36756003)(2906002)(86362001)(6862004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?PqpTzPeLrGqySkDwibZPooui5XgVefXqhYxRW/8nRuJlQ3Upzq2Jsriqnkqw?= =?us-ascii?Q?WN0b3SdvH5+nuHEvgY+rxMGmJqbPwoF14r0uIqT9dX3ptBIr30r0C2AVl94+?= =?us-ascii?Q?iC3yBxCb0CK+NLnCK7jd25IKqGCLnZlJa0W3vJiGJqEJiebK9RUoDwxZJWny?= =?us-ascii?Q?zXlsdFni86/fXu3vxVhFwfBYoOB5obpNfqYO9LMtJpx6CEo8j8pR6Tbgw+r2?= =?us-ascii?Q?UPH4iZScA6atRadR/wOA+YKnHu++5IZM+138X51c5kHilzIZVqVGPEb4qNjK?= =?us-ascii?Q?V1PQCc9pHBpVRCxz0uGQSfcwQjceJGe20oqMnThjRq0bcq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jLmhHgjzALVeby/QzQBifprHMBaH0dqcMrH5pI2xaJ9VglS4?= =?us-ascii?Q?YBhe+W/+biDCfZmirppGeJgWk0ohqZyCYOswmyeSX4Kf/PbEMv+s3z5AHoCm?= =?us-ascii?Q?KfVBYqaQDL3M7RjvO5kJKWii?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9be89c40-09f1-47ae-0493-08d91fb6b288 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB5506.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 19:52:59.2191 (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: EAhbALj8xkmFekZCDd7M6Onp9mi8lu5Oq2VumOFiEeu7Z7vRtCkL27KqWCJd4gPU X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB5521 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 26, 2021 at 12:56:30AM +0530, Kirti Wankhede wrote: > 2. iommu backed mdev devices for SRIOV where mdev device is created per > VF (mdev device == VF device) then that mdev device has same iommu > protection scope as VF associated to it. This doesn't require, and certainly shouldn't create, a fake group. Only the VF's real IOMMU group should be used to model an iommu domain linked to a VF. Injecting fake groups that are proxies for real groups only opens the possibility of security problems like David is concerned with. Max's series approaches this properly by fully linking the struct pci_device of the VF throughout the entire VFIO scheme, including the group and container, while still allowing override of various VFIO operations. Jason