Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp7310824rwl; Thu, 23 Mar 2023 02:27:35 -0700 (PDT) X-Google-Smtp-Source: AK7set/tIXj+iHjmKW74MKoNCKwWBs6hpgGjEmST+2HF67QoO0fVb6F1BNGg/82eLUSXNiv9H7p3 X-Received: by 2002:a05:6a20:63a3:b0:db:3293:278f with SMTP id m35-20020a056a2063a300b000db3293278fmr2209425pzg.44.1679563654900; Thu, 23 Mar 2023 02:27:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679563654; cv=none; d=google.com; s=arc-20160816; b=ASr5bNlZw+boc4vo41QTlCDbFF4bYT5xUbwzYKg+3YyD1nV67B9RQM3cAX29A+Fa+t cpDPRNT4jPifZmoN8QtBqd/atK+Trd+ucfqyYGKZO0hAx23GgXPqc66z/aX6LkYIal64 RXZPLPVmZRBV2Ywa7ucl+/uqLVxsiseiWWKIMVtFdav5aFOgALHcnbacZbA/A9QppYMP EdP+j8g+8PKm5+Dv68ciOI7+n1k8xrqrE55n2oEilhNtKM7OiGGdGWs8b/xg9kmeFkXj HnAhDVvYrwfRipJsDNeFkT4P7Hwfv7fOdMprDuzOJVZmWBhfHK3rbsoNWtiNsDrsMca0 KS/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=Ljj+BqQDncmWj58QrboBIaH/gThmvQ6lFtW/US5ZNCE=; b=aq8N/n+z0sqH003XwDiVnMJkruoyWl82r1UBH4B/GlPGVWt1v+EF5hGYXNfpswlzdb dEJuQY0CRCFxckdzclIYckK+rxyhFvxP/Khoz/jszAhsxlbnziSAyUSevyqxPW0r0SaI zCNpuYzUAx9ZtnUALbWZNeS60+5WnGNekZspOvrlPmYUx7GpAaRJTOVqouxckXl1X13h QM/Oh0Rkl7EeOXn0Wootzzydac8bEqjGxATn24wH8l/mArneyVfhDe2gB3cqAUoJijbl KBllgQUZigq5E9vwPV/rw4XM4vHAIpruUUpHSCDawtv3aScQXEyLllMITBM//NNjnBRz bOTA== ARC-Authentication-Results: i=1; mx.google.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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bm18-20020a656e92000000b00503011e4f27si17910755pgb.869.2023.03.23.02.27.23; Thu, 23 Mar 2023 02:27:34 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231623AbjCWJXc (ORCPT + 99 others); Thu, 23 Mar 2023 05:23:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231628AbjCWJWq (ORCPT ); Thu, 23 Mar 2023 05:22:46 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0040A1A95B; Thu, 23 Mar 2023 02:22:40 -0700 (PDT) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Pj0CM5ChTzSm34; Thu, 23 Mar 2023 17:19:11 +0800 (CST) Received: from [10.174.179.79] (10.174.179.79) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Thu, 23 Mar 2023 17:22:37 +0800 Subject: Re: [PATCH v2] vhost/vdpa: Add MSI translation tables to iommu for software-managed MSI To: Jason Gunthorpe , "Michael S. Tsirkin" CC: Jason Wang , , , , , , , , , , Cindy Lu 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> From: Nanyong Sun Message-ID: Date: Thu, 23 Mar 2023 17:22:36 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.179.79] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-2.3 required=5.0 tests=NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS 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 2023/3/10 20:36, Jason Gunthorpe wrote: > On Fri, Mar 10, 2023 at 04:53:42AM -0500, Michael S. Tsirkin wrote: >> On Fri, Mar 10, 2023 at 05:45:46PM +0800, Jason Wang wrote: >>> On Fri, Mar 10, 2023 at 4:41 PM Michael S. Tsirkin wrote: >>>> On Mon, Feb 20, 2023 at 10:37:18AM +0800, Jason Wang wrote: >>>>> On Fri, Feb 17, 2023 at 8:43 PM Jason Gunthorpe wrote: >>>>>> On Fri, Feb 17, 2023 at 05:12:29AM -0500, Michael S. Tsirkin wrote: >>>>>>> On Thu, Feb 16, 2023 at 08:14:50PM -0400, Jason Gunthorpe wrote: >>>>>>>> On Tue, Feb 07, 2023 at 08:08:43PM +0800, Nanyong Sun wrote: >>>>>>>>> From: Rong Wang >>>>>>>>> >>>>>>>>> Once enable iommu domain for one device, the MSI >>>>>>>>> translation tables have to be there for software-managed MSI. >>>>>>>>> Otherwise, platform with software-managed MSI without an >>>>>>>>> irq bypass function, can not get a correct memory write event >>>>>>>>> from pcie, will not get irqs. >>>>>>>>> The solution is to obtain the MSI phy base address from >>>>>>>>> iommu reserved region, and set it to iommu MSI cookie, >>>>>>>>> then translation tables will be created while request irq. >>>>>>>> Probably not what anyone wants to hear, but I would prefer we not add >>>>>>>> more uses of this stuff. It looks like we have to get rid of >>>>>>>> iommu_get_msi_cookie() :\ >>>>>>>> >>>>>>>> I'd like it if vdpa could move to iommufd not keep copying stuff from >>>>>>>> it.. >>>>>>> Absolutely but when is that happening? >>>>>> Don't know, I think it has to come from the VDPA maintainers, Nicolin >>>>>> made some drafts but wasn't able to get it beyond that. >>>>> Cindy (cced) will carry on the work. >>>>> >>>>> Thanks >>>> Hmm didn't see anything yet. Nanyong Sun maybe you can take a look? >>> Just to clarify, Cindy will work on the iommufd conversion for >>> vhost-vDPA, the changes are non-trivial and may take time. Before we >>> are able to achieve that, I think we still need something like this >>> patch to make vDPA work on software managed MSI platforms. >>> >>> Maybe Nanyong can post a new version that addresses the comment so far? >>> >>> Thanks >> Maybe but an ack from iommu maintainers will be needed anyway. Let's see >> that version, maybe split the export to a patch by itself to make the >> need for that ack clear. > 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. > > Jason > . I want to confirm if we need to introduce iommu group logic to vdpa, as "all the ownership stuff" ?