Received: by 2002:ac8:156:0:b0:3e0:cd10:60c8 with SMTP id f22csp2490859qtg; Thu, 23 Mar 2023 04:39:26 -0700 (PDT) X-Google-Smtp-Source: AK7set8U2CXJU4/SzJhd3poYJbHfJnq4XFIHHmcGFPDlQeOmCV6smiQA6f81Wg5jhssWwTLlyHtz X-Received: by 2002:a17:906:90cc:b0:930:18f5:d016 with SMTP id v12-20020a17090690cc00b0093018f5d016mr10693880ejw.15.1679571566662; Thu, 23 Mar 2023 04:39:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1679571566; cv=pass; d=google.com; s=arc-20160816; b=RQlS0errYrDaAQqDGmRsVgfrfY1RItV6rD+YA2L6odpQaIN2VkSkerbk4JYYsWtQCh dqGMqFfxCkjOjaX2NbYHxmn8N47Xgarr69Wb+5iAI53spqM1r7kPOC1zPZ+eKA8rKsJY 6VJ3oD7pZ5ijXr6K8MAkQGO0X4BH/SV7yKv1wRHdRINE4Rth33v2LrpwH/fmc8vq229y E3qzrHI85subw47YNoC0V8sgjYnIXUP8JWxz9GgCh82Q5JhYfW5QALiPWX5Njtga31F1 t4k8LSWEbjh1XcB8153N5GEiNy7+7yZu6c4hugGeB3B5v3JxJwcSUNNXGL0gwk1SWFqb PRjw== 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=kgwGkRvQGhnQvvV2Qnfi3jU5my70jRonwiuIg94yKUQ=; b=jrURxBn3E3YD4WpbGoJ4UgIa1Gn0RR1NGGhnr0z/IGpO1g63zA25Svp6Ct4H+5jrB9 t5KRiHCWktIbDuubqgPXwqWPGpAN2GvCrOCoOwGeO4ErCSOijbANAuS3xr8GfgrkmxtW Jm1UwCInJcSzNWoKeD8dwnk2nepEK/mNESg7FnPm6Kcons038f3SgyJvwQMcDtvELuIW aO/8m7+hEXQA0IkynkD7HvHm6pLmdm2+/L158ZCUNAA7d2R9WcBWmDoS4xRhOMLOvZcw AsOPpuvqTyaN7DfqVIkxXuQIemGgp2Np57SVbaAPNi3w8HiA2BA9dwfLmNrhC0V9DjIR P+KQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=GTe3YcDQ; 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 bi26-20020a170906a25a00b0092fa6d3ab9asi17920972ejb.443.2023.03.23.04.39.02; Thu, 23 Mar 2023 04:39:26 -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=GTe3YcDQ; 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 S230409AbjCWLbX (ORCPT + 99 others); Thu, 23 Mar 2023 07:31:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbjCWLbW (ORCPT ); Thu, 23 Mar 2023 07:31:22 -0400 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2089.outbound.protection.outlook.com [40.107.102.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A083412BC4; Thu, 23 Mar 2023 04:31:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AEr06WBTVJdBCKY5lTT+AoG5vd98BsglzIcusohVJWmqStFW5GGv8VOlM4m/WzzWAPFGWTJpT0zBvMppLOu07m3bdqUOVivQjRfMOahCHHYQ2BId3qF9XhJ4D9t+qT5tlpyqvFhiw5QSOWLpmQqQSJ90sfJkorztCLXWJd8QOa/cGesr7RBLQ9lkH0QsHd/ZO+7Qr6zT4MrpXgYh0pHeJQ/tGIpfwzGTuYMNS4/GUL43MQplGfddoT6J4KOoAcIFK0kl4Oll/bLJeyG/d/XLNDKp0+2o+8aD5D2773k4r+2/lMoKLx6apriK1ogP8SrVsAzBnqZjHWtSzvQQtwd3Ug== 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=kgwGkRvQGhnQvvV2Qnfi3jU5my70jRonwiuIg94yKUQ=; b=SIMZtA6UEbZZUGPd3waL5u5/LvmWLcyQb/s6+PJw83Q5dwdkEVaOZOP85zIahPqSa/CDb552qHaen++fX7u/clV3BDnp6LwlVaQU4oh4AH8ahaxai+/Zc5q5ZAr5EFV6QS5STXRgpvH2V1l931/NNCp0+CPruqzup0hGVRweeTguAZYAyNcE1/2wZ31FYyfuoQJqwSICW59+Xqv90TG+t7jeBpIYDC2DjXfRhoAY0eYiAV8O3Pa31UFBg+uEzHG2CbmGhhj82hAdS3utZpFCySEVC5CyXoci3aUv8t4EKJIRYq6YXmV53BzU2rSzksb9TBJnYQK96lY/RoQROXVsrg== 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=kgwGkRvQGhnQvvV2Qnfi3jU5my70jRonwiuIg94yKUQ=; b=GTe3YcDQxj8+zrU4E2Pmco3EFxvLATiT5p3CceLGTBGnb6yhIocmlCQQZNzIz9XuYj+Bjno5cDB9MKAQq2V0ZNblD3cDtXsnkJ+5HBcPhmcz7dneS4K0H8dOVH9YeaTswV4J0I+6T4/A8nMfQWBtyokRiy0Dn46Ds7WyWPZFI1Inns7Pzv/4h8XJgohZl433yyZS9UN7cfHQ+8PFa7B/XEvULns9O9s0hVvjoY5jI5bS9X3OBQJoR0WtISp3z/TDzKUP9FTxMv/YJbjeRTizmZZt8A92orA/xoB/IvLk2xDdbYLWi8U7L1r9eiUFH2ctYvNuQ4/awjkWGPie4VKerg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) by DM4PR12MB5245.namprd12.prod.outlook.com (2603:10b6:5:398::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.38; Thu, 23 Mar 2023 11:31:18 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::ef6d:fdf6:352f:efd1]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::ef6d:fdf6:352f:efd1%3]) with mapi id 15.20.6178.037; Thu, 23 Mar 2023 11:31:18 +0000 Date: Thu, 23 Mar 2023 08:31:16 -0300 From: Jason Gunthorpe To: Nanyong Sun Cc: "Michael S. Tsirkin" , Jason Wang , joro@8bytes.org, will@kernel.org, robin.murphy@arm.com, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, wangrong68@huawei.com, Cindy Lu Subject: Re: [PATCH v2] vhost/vdpa: Add MSI translation tables to iommu for software-managed MSI Message-ID: References: <20230207120843.1580403-1-sunnanyong@huawei.com> <20230217051158-mutt-send-email-mst@kernel.org> <20230310034101-mutt-send-email-mst@kernel.org> <20230310045100-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: YT4PR01CA0094.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:ff::8) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|DM4PR12MB5245:EE_ X-MS-Office365-Filtering-Correlation-Id: 5c73ff28-ac10-4beb-2765-08db2b921e96 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +FL3JPEFTilyC3ko+dvlZPOcztc4fUQYrvdIizeWuXUmwuyb/euJ057D6XzssgGmZ0HDM+jAyHAKvhxrqDKNugqhftVgspLGWXtrhNY3SGh0LyzKikng3OfzzfDjN5+iUZP4SJ07tx3mJyqw+nIxwuChK+QEnVBxQ3raxrjnLfPFH/hnERoEFTA5Y9ANLWxncgTHhYSLrcq197KkLui8rODWJbA4uB6oLwED09ifq/03H1Ah0Edn6htHkdnl+ANmHv7Nqk22gYghHZbVGFGd30uRxSsna7RYGBE3QE/y6CLbJO2WfdnPoR7nIismFtEKX1qmUyHcV7+D0hRWbUlgzPQZC9LPsU6hg44PQCfy7Z6cI2FDeYM1T0U91SIL5EkWKu1Vj0bPkDUH3miVzs/shJRLrg9cnafA/zVPNjIbAuD2+18zWHuxeQf9XHrvOAb4hne5TphFvHFOhNS6bIRF4+xhU0AD8Nrusz1twZ/ykpd5tXlFWdFajeF432zl9dN61kna5pzxGIh++eb3i0XP0ojXYx6d0RmaT7rYY9zWDXJKKXGzuM/duzaYzRVm4GM6GrBVsov0jwpqTgIA11NcVN8oj3Jaal3CjIqpNRo4vTaFn5HHqk7fsxqUouVt+BUh9PrcVKpNv8yfZmPYpETm5BOq4iU7LVmMoZ4Q2T9fMhzmKOMdFTxc/S2bagHP8TrZ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5869.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(39860400002)(366004)(396003)(376002)(136003)(346002)(451199018)(66946007)(66556008)(66476007)(8936002)(45080400002)(41300700001)(6916009)(4326008)(86362001)(8676002)(36756003)(38100700002)(26005)(6512007)(6506007)(2616005)(83380400001)(186003)(316002)(478600001)(6486002)(966005)(54906003)(2906002)(5660300002)(7416002)(4744005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?0/Ete/LvgouHTQENTKhUE4z01IwTMicwsXVhLB4iLSKxDP6iekN92gicsmt/?= =?us-ascii?Q?FSK00hszWRZ1jXE4d3RqWQNftIN+FRM0DpKAL9qvgJHfGWFAn3RP6SG2FY4n?= =?us-ascii?Q?pqUiJHfDERXqMvd670+IJzGHj4oCUrm+uQQ/HvBHIXNDSZYLlKfW6nCFKLyq?= =?us-ascii?Q?pGRiNzA/WVfyXxRoEJk2x2weR+SUci7Ujn7Jfrw1hJlH9lVA/FArwGl4q1EA?= =?us-ascii?Q?s3R+YNLj0Tw8l4XLv+6yWPz92VhWznF+vgV7Iu5EZ3+MmFH81q0hfKo3bM5z?= =?us-ascii?Q?fepbxPL1nF22VbOSgwr84oe7qaUEbNJOO0ZOKjmcO2VQwo1zx++3ONo/gE6h?= =?us-ascii?Q?aSQ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TKy9mjr+Ddx2k4HHy?= =?us-ascii?Q?AP220ySSg1p9cNwfEl3LjQk5czdZbEGeo8Wgbec1R47EQ/5R3OEjTJdQXPqJ?= =?us-ascii?Q?SQ5T8V6bv3Wv76IRi0jvdIyIxgRVp9eYPwWJ0OCV529MrbcZCwaXtthpEilX?= =?us-ascii?Q?zDhSKzBpikikZqxP4ZMBiKd9jre+LcxfTOmGmPUDAidK5N37lg1IROY7SLL9?= =?us-ascii?Q?DePIfW/LDj9qItvRUKnJ6KyEVQHaVeclep+BFB8eyBj4PTpCgxw5oJlvZZqA?= =?us-ascii?Q?J0d7c3Rx2cy2hiOoMT/+iGRD1hbLG1IP39OUZkZ8JJA/+0nXMKI+aFgtbYff?= =?us-ascii?Q?Tg2xy5dhaa1I/bmNMzqvhQsOUJqqRoz58oehPNrN?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5c73ff28-ac10-4beb-2765-08db2b921e96 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Mar 2023 11:31:18.3152 (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: Kmturz/UnKjDR12kvvLJmogcA0DjRJxHmFARnm0aW8+PQVpQXNBcsb9WujrkpLWG X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5245 X-Spam-Status: No, score=-0.2 required=5.0 tests=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=unavailable 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 23, 2023 at 05:22:36PM +0800, Nanyong Sun wrote: > > A patch to export that function is alread posted: > > > > https://lore.kernel.org/linux-iommu/BN9PR11MB52760E9705F2985EACCD5C4A8CBA9@BN9PR11MB5276.namprd11.prod.outlook.com/T/#u > > > > But I do not want VDPA to mis-use it unless it also implements all the > > ownership stuff properly. > > > I want to confirm if we need to introduce iommu group logic to vdpa, as "all > the ownership stuff" ? You have to call iommu_device_claim_dma_owner() But again, this is all pointless, iommufd takes are of all of this and VDPA should switch to it instead of more hacking. Jason