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 X-Spam-Level: X-Spam-Status: No, score=-5.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13333C0650F for ; Tue, 30 Jul 2019 06:33:02 +0000 (UTC) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DA0ED2054F for ; Tue, 30 Jul 2019 06:33:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="d6nmUpah" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DA0ED2054F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 9CC3B246E; Tue, 30 Jul 2019 06:33:01 +0000 (UTC) Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 15E392434 for ; Tue, 30 Jul 2019 06:28:48 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 71D0CA8 for ; Tue, 30 Jul 2019 06:28:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=kdf9VzAcKlRao+cQi/gI52MGpBhS1qPDKJ44BshrQsQ=; b=d6nmUpaheyhCkGmbrEDaP1DXk ybqawQrZn8362H11uU4Y5WdRMlwoq5qg3O3becjLLIJ0Cf8Elp4wGoayiNXW9Jf/O8QD8NxhNRUcf oQu3gh2KsUWtgGTexCr6A5I5Iq7qTwOF2VyckQmJVydEMdUa1hwWeb0rAf7eWDEMf7pS9d8VZWIoq uXf3ncvi22lht1vcBctFk9AJMJu8G99R2msuf4uDH0eGFZRQlk2sWZR7yzN+sSttEYGyv6bZTS99Q bAEflp+QX2NxpZN3ECsWTk6334ANe28vDiRl2GL1ex/ycdP5YAvFtjvYzxZYSGO/4v/XZ0NCaxUZI t2clGakFg==; Received: from hch by bombadil.infradead.org with local (Exim 4.92 #3 (Red Hat Linux)) id 1hsLcp-0002L2-Fk; Tue, 30 Jul 2019 06:28:43 +0000 Date: Mon, 29 Jul 2019 23:28:43 -0700 From: Christoph Hellwig To: Robin Murphy Subject: Re: [PATCH] iommu/dma: Handle MSI mappings separately Message-ID: <20190730062843.GA1400@infradead.org> References: <2b2595de703c60a772ebcffe248d0cf036143e6a.1564414114.git.robin.murphy@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2b2595de703c60a772ebcffe248d0cf036143e6a.1564414114.git.robin.murphy@arm.com> User-Agent: Mutt/1.11.4 (2019-03-13) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Cc: maz@kernel.org, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, Andre Przywara X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: iommu-bounces@lists.linux-foundation.org Errors-To: iommu-bounces@lists.linux-foundation.org On Mon, Jul 29, 2019 at 04:32:38PM +0100, Robin Murphy wrote: > MSI pages must always be mapped into a device's *current* domain, which > *might* be the default DMA domain, but might instead be a VFIO domain > with its own MSI cookie. This subtlety got accidentally lost in the > streamlining of __iommu_dma_map(), but rather than reintroduce more > complexity and/or special-casing, it turns out neater to just split this > path out entirely. > > Since iommu_dma_get_msi_page() already duplicates much of what > __iommu_dma_map() does, it can easily just make the allocation and > mapping calls directly as well. That way we can further streamline the > helper back to exclusively operating on DMA domains. > > Fixes: b61d271e59d7 ("iommu/dma: Move domain lookup into __iommu_dma_{map,unmap}") > Reported-by: Shameer Kolothum > Reported-by: Andre Przywara > Signed-off-by: Robin Murphy Hmm. I remember proposing this patch and you didn't like it because we could also have msis for a !IOMMU_DMA_IOVA_COOKIE cookie type. Or did we talk past each other? Note that if this change turns out to be valid we should also clean up the iommu_dma_free_iova() side. _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu 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 X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27009C0650F for ; Tue, 30 Jul 2019 06:28:46 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id DDE432064A for ; Tue, 30 Jul 2019 06:28:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="GyeTtNo6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DDE432064A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vGguBBEiXjeZ8CBZ2E6FU6qDd5Va34pFOwGkoJxR8MY=; b=GyeTtNo6ROtpYv cN2ITt6d572aFeyYbDoT+lZMdV8al2CZ1/B1hXfnHfau69nhDGE7MX/0g2L5BmgdeE4jFiGY7QN4s T2h6gO826eaQtIp9Ow2NnUjhqoOVakmFaXb5WcksoABZLZpl+XBPU0CvkXjg6FaODPXvcXUyd3+FB LThoUsc6BhW9ib3xtHhkqknLNNYnLm9dfylyPA7PwIuZ5p9qUtl8pJd+F2j7DiJhkvIZKsaGbZR0p UMD0qZGGaPjgl8lrxV6FUTcSr0zTagwecTJgHPl3KSau9ROUdfH/h1PRJkyekEAyG5/Rr9wYmrwaT 1aomqgk3OO0x+nQ/cT5w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hsLcr-0002LG-Et; Tue, 30 Jul 2019 06:28:45 +0000 Received: from hch by bombadil.infradead.org with local (Exim 4.92 #3 (Red Hat Linux)) id 1hsLcp-0002L2-Fk; Tue, 30 Jul 2019 06:28:43 +0000 Date: Mon, 29 Jul 2019 23:28:43 -0700 From: Christoph Hellwig To: Robin Murphy Subject: Re: [PATCH] iommu/dma: Handle MSI mappings separately Message-ID: <20190730062843.GA1400@infradead.org> References: <2b2595de703c60a772ebcffe248d0cf036143e6a.1564414114.git.robin.murphy@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2b2595de703c60a772ebcffe248d0cf036143e6a.1564414114.git.robin.murphy@arm.com> User-Agent: Mutt/1.11.4 (2019-03-13) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: maz@kernel.org, joro@8bytes.org, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, Andre Przywara Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jul 29, 2019 at 04:32:38PM +0100, Robin Murphy wrote: > MSI pages must always be mapped into a device's *current* domain, which > *might* be the default DMA domain, but might instead be a VFIO domain > with its own MSI cookie. This subtlety got accidentally lost in the > streamlining of __iommu_dma_map(), but rather than reintroduce more > complexity and/or special-casing, it turns out neater to just split this > path out entirely. > > Since iommu_dma_get_msi_page() already duplicates much of what > __iommu_dma_map() does, it can easily just make the allocation and > mapping calls directly as well. That way we can further streamline the > helper back to exclusively operating on DMA domains. > > Fixes: b61d271e59d7 ("iommu/dma: Move domain lookup into __iommu_dma_{map,unmap}") > Reported-by: Shameer Kolothum > Reported-by: Andre Przywara > Signed-off-by: Robin Murphy Hmm. I remember proposing this patch and you didn't like it because we could also have msis for a !IOMMU_DMA_IOVA_COOKIE cookie type. Or did we talk past each other? Note that if this change turns out to be valid we should also clean up the iommu_dma_free_iova() side. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel