Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6315248imu; Mon, 21 Jan 2019 06:53:46 -0800 (PST) X-Google-Smtp-Source: ALg8bN76AcJ3Yb1JjIAiapxsTy8j4xgfGeF+l7qdalbwcDg4+vdYIyxjzccMXzMmM6S/GkdzR5o2 X-Received: by 2002:a17:902:3f81:: with SMTP id a1mr30259884pld.258.1548082426143; Mon, 21 Jan 2019 06:53:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548082426; cv=none; d=google.com; s=arc-20160816; b=XoMp/AS3zj0EynthtBWv0mM6AtntCTCZZS2PbQxYSB/bp9Aw5bq30dLqwCpDSsaFmO TYRWLcfDJ6pSjaHxX47vz9Or4ymwY+CxmRgftXQegtLigLWtpJRu1wQVw5tO6/osVDmZ NFygtmt2XO4rod3JeVpWLt+2cgQIcA7eEmacvKM1sdtb6ASr5CKttanHyUALoy3+WD3f 3fz13x8kLeFP1fDpVps5mxLd35dcn7ABmIWyyR70SPsU088HmGx/yM2jWbBc1fSxHmiw pGe+bYhIczeMgxtUvUTFLyWMZmbt1xTOcvo/7DaJdM7ndUtxw/oyblvPOPiQF5iVtJxp 9RTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=C4nDdXAdvcU5/dL8T2QaPt9yLOU7KtWL4Oe/u5kP2Bo=; b=eJYJQN/Po0pOdsE6Ww6yvEZShSX3M3Ar/PtCtzkJY7DugI+PphFimE8ajfuqc7Ihg6 9KqrYTYUBFDlxYgo5ZLutjbn9ZnSTCw5GRRdTpqthcYafmtQA/ohgkOI5ycVvDBJXaeX nK8Thqg2Fp4315JsWDWfEMZdd81E5OucprClF1tNDMUk8iac4qAWLdjatX/udXc4Tp60 gRN56Ynxd2ODtw9Vi38xbAAa4TLHRHwhgNRuTBbKTRQzA2DVbnOTc5kksuU9JM0zckeU +nHvg8Dgtla9EkypqGTZN1wpvnK7Af0q/+aUmbWXHHonzFcoWxaNRhumpOSqdgOSt0hK 0DCw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n33si12547085pgl.336.2019.01.21.06.53.29; Mon, 21 Jan 2019 06:53:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729479AbfAUOwY (ORCPT + 99 others); Mon, 21 Jan 2019 09:52:24 -0500 Received: from foss.arm.com ([217.140.101.70]:35810 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729072AbfAUOwY (ORCPT ); Mon, 21 Jan 2019 09:52:24 -0500 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 E438DEBD; Mon, 21 Jan 2019 06:52:23 -0800 (PST) Received: from e110467-lin.cambridge.arm.com (e110467-lin.cambridge.arm.com [10.1.196.75]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 21C913F5C1; Mon, 21 Jan 2019 06:52:21 -0800 (PST) From: Robin Murphy To: iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: m.szyprowski@samsung.com, hch@lst.de, treding@nvidia.com, rmk+kernel@armlinux.org.uk, bskeggs@redhat.com, tjakobi@math.uni-bielefeld.de, b.zolnierkie@samsung.com Subject: [PATCH] ARM: dma-mapping: Clear DMA ops on teardown Date: Mon, 21 Jan 2019 14:52:16 +0000 Message-Id: <2f5833b7639543d614095cd3f5ab0dc0274e26d6.1548081277.git.robin.murphy@arm.com> X-Mailer: git-send-email 2.20.1.dirty MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Installing the appropriate non-IOMMU DMA ops in arm_iommu_detch_device() serves the case where IOMMU-aware drivers choose to control their own mapping but still make DMA API calls, however it also affects the case when the arch code itself tears down the mapping upon driver unbinding, where the ops now get left in place and can inhibit arch_setup_dma_ops() on subsequent re-probe attempts. Fix the latter case by making sure that arch_teardown_dma_ops() cleans up whenever the ops were automatically installed by its counterpart. Reported-by: Tobias Jakobi Reported-by: Marek Szyprowski Fixes: 1874619a7df4 "ARM: dma-mapping: Set proper DMA ops in arm_iommu_detach_device()" Tested-by: Tobias Jakobi Signed-off-by: Robin Murphy --- Sorry for the delay - there was a giant email infrastructure cock-up just at the point I wanted to go back through my archive and double-check the discussion around the original commit... Robin. arch/arm/mm/dma-mapping.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index f1e2922e447c..1e3e08a1c456 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -2390,4 +2390,6 @@ void arch_teardown_dma_ops(struct device *dev) return; arm_teardown_iommu_dma_ops(dev); + /* Let arch_setup_dma_ops() start again from scratch upon re-probe */ + set_dma_ops(dev, NULL); } -- 2.20.1.dirty