From patchwork Thu Jun 23 11:32:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Murphy X-Patchwork-Id: 9194863 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 633886075C for ; Thu, 23 Jun 2016 11:32:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5397D2844C for ; Thu, 23 Jun 2016 11:32:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 481C32844E; Thu, 23 Jun 2016 11:32:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DDD7B2844C for ; Thu, 23 Jun 2016 11:32:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751719AbcFWLcT (ORCPT ); Thu, 23 Jun 2016 07:32:19 -0400 Received: from foss.arm.com ([217.140.101.70]:53011 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751445AbcFWLcS (ORCPT ); Thu, 23 Jun 2016 07:32:18 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E97A93B0; Thu, 23 Jun 2016 04:33:04 -0700 (PDT) Received: from [10.1.205.154] (e104324-lin.cambridge.arm.com [10.1.205.154]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 425143F213; Thu, 23 Jun 2016 04:32:14 -0700 (PDT) Subject: Re: [RFC PATCH v2 03/15] arm64: mm: change IOMMU notifier action to attach DMA ops To: Lorenzo Pieralisi References: <1465306270-27076-1-git-send-email-lorenzo.pieralisi@arm.com> <1465306270-27076-4-git-send-email-lorenzo.pieralisi@arm.com> <5763C27A.9030306@arm.com> <20160617141536.GA24840@red-moon> Cc: Jon Masters , Marc Zyngier , Catalin Marinas , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Will Deacon , Sinan Kaya , linux-acpi@vger.kernel.org, iommu@lists.linux-foundation.org, Hanjun Guo , linux-pci@vger.kernel.org, Tomasz Nowicki , linux-arm-kernel@lists.infradead.org From: Robin Murphy Message-ID: <576BC8BC.6090400@arm.com> Date: Thu, 23 Jun 2016 12:32:12 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <20160617141536.GA24840@red-moon> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Lorenzo, On 17/06/16 15:15, Lorenzo Pieralisi wrote: >> I think this patch makes sense even independent of the rest of the >> series, one nit inline notwithstanding. > > Thanks. Yes I added it to this series since it is not strictly > necessary (ie it does not fix anything) in the mainline, but > it *is* necessary for this whole series to function when we > boot through ACPI. > > I will send it out in a separate patch and fold changes you > request below, it would be good to have some coverage for > it before merging it. Having considered it a bit more, triggering on BIND_DRIVER also means the silly "process the whole list every time" behaviour should go away. There's little point in trying to configure a device's ops before we know they're actually needed, and once a driver has bound it's too late to change anything anyway. What do you think of squashing in something like the below? Robin. ----->8----- mutex_unlock(&iommu_dma_notifier_lock); --- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c index 7d3fa9ae8a11..02484dc3f369 100644 --- a/arch/arm64/mm/dma-mapping.c +++ b/arch/arm64/mm/dma-mapping.c @@ -854,10 +854,11 @@ static int __iommu_attach_notifier(struct notifier_block *nb, mutex_lock(&iommu_dma_notifier_lock); list_for_each_entry_safe(master, tmp, &iommu_dma_masters, list) { - if (do_iommu_attach(master->dev, master->ops, - master->dma_base, master->size)) { + if (data == master->dev && do_iommu_attach(master->dev, + master->ops, master->dma_base, master->size)) { list_del(&master->list); kfree(master); + break; } }