From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 86F89C43334 for ; Mon, 20 Jun 2022 10:12:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1PGsRamuiZGH+AkxlWBU7LAK3BU3MxbzIeyouP2Q5ME=; b=lU5wyTmxzNqAOs lJxfI1XKfiD7BOJv5gnhxFSOhvuwVhFLRX8OzFJAW0pQxy2O9QrOiIK57Sg0QdizuRZEo5eALEdir 75GQPEHJ+MWR66Vb01rq7T+LW4dRBGNFoI2JlHhD3slXzI3g+Twt7QIPMs2BvG5VcIh/uOh4iPrAZ 2fHad6J5bbRPdDjy9q+5eTVpsS2wyaEQSbvuUaHUlSH72imgrBRQkW9Wg05PXDwKFHkhf8gZ6oXoe c/lIyHTIRS/AEmrXaQpLePbDI57KH2X5QHPSJ6HBfIcyWdmEyjan2vLuFH1BGUqE5LC6I7nuok0o8 P5UqXbiZwBcRXWo76Vxg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o3ENQ-00HPNs-A4; Mon, 20 Jun 2022 10:11:24 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o3ENK-00HPLG-S7; Mon, 20 Jun 2022 10:11:22 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C40DE113E; Mon, 20 Jun 2022 03:11:10 -0700 (PDT) Received: from [10.57.84.159] (unknown [10.57.84.159]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 162D83F7D7; Mon, 20 Jun 2022 03:11:05 -0700 (PDT) Message-ID: <55e352d5-3fea-7e46-0530-b41d323b6fcf@arm.com> Date: Mon, 20 Jun 2022 11:11:01 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH v2 5/5] vfio/iommu_type1: Simplify group attachment Content-Language: en-GB To: "Tian, Kevin" , Nicolin Chen Cc: "cohuck@redhat.com" , "kvm@vger.kernel.org" , "jordan@cosmicpenguin.net" , "linux-tegra@vger.kernel.org" , "thierry.reding@gmail.com" , "will@kernel.org" , "alyssa@rosenzweig.io" , "jean-philippe@linaro.org" , "saiprakash.ranjan@codeaurora.org" , "zhang.lyra@gmail.com" , "iommu@lists.linux-foundation.org" , "jonathanh@nvidia.com" , "jgg@nvidia.com" , "yangyingliang@huawei.com" , "orsonzhai@gmail.com" , "gerald.schaefer@linux.ibm.com" , "linux-s390@vger.kernel.org" , "linux-arm-msm@vger.kernel.org" , "alex.williamson@redhat.com" , "christophe.jaillet@wanadoo.fr" , "matthias.bgg@gmail.com" , "tglx@linutronix.de" , "virtualization@lists.linux-foundation.org" , "linux-arm-kernel@lists.infradead.org" , "isaacm@codeaurora.org" , "dwmw2@infradead.org" , "marcan@marcan.st" , "linux-kernel@vger.kernel.org" , "baolin.wang7@gmail.com" , "linux-mediatek@lists.infradead.org" References: <20220616000304.23890-1-nicolinc@nvidia.com> <20220616000304.23890-6-nicolinc@nvidia.com> From: Robin Murphy In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220620_031119_050284_E04E0647 X-CRM114-Status: UNSURE ( 9.25 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2022-06-17 03:53, Tian, Kevin wrote: >> From: Nicolin Chen >> Sent: Friday, June 17, 2022 6:41 AM >> >>> ... >>>> - if (resv_msi) { >>>> + if (resv_msi && !domain->msi_cookie) { >>>> ret = iommu_get_msi_cookie(domain->domain, >>>> resv_msi_base); >>>> if (ret && ret != -ENODEV) >>>> goto out_detach; >>>> + domain->msi_cookie = true; >>>> } >>> >>> why not moving to alloc_attach_domain() then no need for the new >>> domain field? It's required only when a new domain is allocated. >> >> When reusing an existing domain that doesn't have an msi_cookie, >> we can do iommu_get_msi_cookie() if resv_msi is found. So it is >> not limited to a new domain. > > Looks msi_cookie requirement is per platform (currently only > for smmu. see arm_smmu_get_resv_regions()). If there is > no mixed case then above check is not required. > > But let's hear whether Robin has a different thought here. Yes, the cookie should logically be tied to the lifetime of the domain itself. In the relevant context, "an existing domain that doesn't have an msi_cookie" should never exist. Thanks, Robin. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel