Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp3244788imc; Wed, 13 Mar 2019 12:34:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqyddhuHz4ZZp150eO9DICHZ+SzF0Ym+WliWtdPSAHpKzv2O7UjeAkjH1DLN+tSgfRHuYszJ X-Received: by 2002:a17:902:e50b:: with SMTP id ck11mr48166030plb.25.1552505697470; Wed, 13 Mar 2019 12:34:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552505697; cv=none; d=google.com; s=arc-20160816; b=gi27IJYNPI+IGrLh+OqLFHbxRHBjWGkjEieeROYbrswdNnh5Q6Ttjxq5+OzNVhdKU3 8T/pJn8Cy0/lHzvc9NYNf2bymeiv1wXSmeCWzwq7BjoBKFZt/SNg+od/11WGjX/pozhA wvdMXiiNQoKqO++nutWB9vnf64rkXcPlhmN8r2qgiiVsENUIEsvuIQ1ztObY2bvaz2tv X0/8BU7cGWqNMEcd2wG+WABTZVsNA4znWU+EHqMJwJhv86nCGdu7hmkeXRaAQfBRSNBv mn8SrNW6Pz85RaRi2ymDEvvc0keUOinVxa4geHKtROmfT5JK6KJM4zx3zBzzvKfuSpfD x+KA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/LNyzkPKuc1yGoPejxuEIXJSpFYYG8rTmb4j+BbZoi4=; b=zLIPExgPmJB6Mhr3kI4PiX6/LQ+h0tp89xaDHBuJt+McQSEzL7rhKqffWv/0kLZDiY 4ARQhGjcyH7zi/B7mSBFaooX/Dfg5U7yOVAAfiz8BZmvHDcfH7b3MsOXa2pBX7nBJKHP HDrLwRhxAwpO0yrdi5jrqkLOqmDqrQw85AYN0J4a99kDVken5Mh6gjcSIhUpTsam1hFD 6OJ8+WOxyRMu1BEJRoGVpGAfkRWCFtgMLWVkrnfiJDq7Wpq6uuIpjLjtP+holxwikEuX kLz28op8KoMoFaGekFI+rEtmG4ykOQ8kzIjl4W3nsLwAVYWqXURSG3SzG4lzWqtMXHWj s6qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tJKKyX72; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s14si10387443pgs.98.2019.03.13.12.34.41; Wed, 13 Mar 2019 12:34:57 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=tJKKyX72; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727141AbfCMTKp (ORCPT + 99 others); Wed, 13 Mar 2019 15:10:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:41298 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727112AbfCMTKm (ORCPT ); Wed, 13 Mar 2019 15:10:42 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DA0082183F; Wed, 13 Mar 2019 19:10:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552504241; bh=yN21YWSjkjnHUTbYYwLQjCrys8QazynvM+ofXuZlgJY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tJKKyX72haV2C9MNQ9+YQS5JixptkH83qwxTBXqhYVmhPgFRjIx19uxbPrfbcTeik 9fn9qbr1p+BjnNss1NdmU1Whb9pSwkpRaWfk9GFtfBPh9VCA//VBomZ7wgmqM8Ke7M +e8eOio7julifT0A1nBT3zvXvMkDjnJ+Zv4B44TY= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Robin Murphy , Russell King , Sasha Levin Subject: [PATCH AUTOSEL 4.20 10/60] ARM: 8835/1: dma-mapping: Clear DMA ops on teardown Date: Wed, 13 Mar 2019 15:09:31 -0400 Message-Id: <20190313191021.158171-10-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190313191021.158171-1-sashal@kernel.org> References: <20190313191021.158171-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Robin Murphy [ Upstream commit fc67e6f120a388b611d94cc40baf99a5cc56b283 ] 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 Tested-by: Thierry Reding Signed-off-by: Robin Murphy Signed-off-by: Russell King Signed-off-by: Sasha Levin --- 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 78de138aa66d..7f8afe3c9072 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -2399,4 +2399,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.19.1