From patchwork Wed May 30 14:06:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 922826 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Iz/9Psaj"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40wspG41BBz9s0q for ; Thu, 31 May 2018 00:06:30 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752089AbeE3OG3 (ORCPT ); Wed, 30 May 2018 10:06:29 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:34194 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751844AbeE3OG2 (ORCPT ); Wed, 30 May 2018 10:06:28 -0400 Received: by mail-wr0-f193.google.com with SMTP id j1-v6so29683016wrm.1 for ; Wed, 30 May 2018 07:06:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=BBqBdMky8Ur5wDsGaFp5y5PoG4EwnlPOvxauzhFC//g=; b=Iz/9PsajRRZuoX6jGvn8I/jLdr8L6orW/acvQsXBUI7r+XrUcHuZ62zQFHkJbCzf9i dXJZSauhSps7mIiRL6GZJuasbcUaU29W9lpojYID6WaEZlry5tOwQm9VnoSlnrFkvSwa LEczaUlWBS0KBvO7mqDLfgPyoJGESvqqUY+WcyJmy+NTEDR78tIG/NMOaXfP1vlYfyfY xM8nVWBvlqTDXaTCxnFGO1w9d72DHl4VUWcb6xKyPCme0+dCVuhe2jFTrO20rUfPhFvk rVaOUm1Y0JVMtb5ehF/A3gUBO629jfllyqaue0KHmS+PX9FrJ3EnFrmaEqj0am0JmPWP 5vAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=BBqBdMky8Ur5wDsGaFp5y5PoG4EwnlPOvxauzhFC//g=; b=MJK0c4ogJCZ5Hh30DPadst4tXcTOp51TOef0nwwDWeKIOnoIhwZenY2PHaZZlrMEQ3 NCkaQOcXc95AuN1Xey2fzN2VPECrAq7A6ohoN6qVvgx4I7y2R9WSuVXRxCAeQfZv0jnb 7f3zv6hIGvTlm0q9dL3OcQvsTDDryDXjlf0+2mkDt554X21hp1KX9MBoyq5uxz3ZrIK7 YbvUhvd7Qi8I6WpcHi0udUsHscnFLxeWlRsdLvgrqN4q13r2Pbyj0vOSrIDYkPYvzWJv CHYEj1K8LRLB4Z7PGs+cRIt58LA9Ds1NtZiJv/4Zaaa2a9Snpl3pUkAj3hxnhB1v9g/u a07Q== X-Gm-Message-State: ALKqPwcEqGeG/q+Qwxzlz7JKFhdWwpDJftbiEcvXa6K6Pk4F07efPAAJ QhJ2eVWzt9Ab5nneX7Bjp8M= X-Google-Smtp-Source: ADUXVKKutaLBRClShdan0gwYPJPkG3t2mPhVawyEKBzdx2GmqoSt461rIg9o1Q2B1jCAnhwIbwImew== X-Received: by 2002:adf:988c:: with SMTP id w12-v6mr2177095wrb.215.1527689187804; Wed, 30 May 2018 07:06:27 -0700 (PDT) Received: from localhost (p2E5BEDA6.dip0.t-ipconnect.de. [46.91.237.166]) by smtp.gmail.com with ESMTPSA id 123-v6sm29016211wmt.19.2018.05.30.07.06.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 May 2018 07:06:26 -0700 (PDT) From: Thierry Reding To: Ben Skeggs , Christoph Hellwig , Russell King Cc: Robin Murphy , Joerg Roedel , Daniel Vetter , Jordan Crouse , nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, linux-tegra@vger.kernel.org Subject: [PATCH v4 0/2] drm/nouveau: tegra: Detach from ARM DMA/IOMMU mapping Date: Wed, 30 May 2018 16:06:23 +0200 Message-Id: <20180530140625.21247-1-thierry.reding@gmail.com> X-Mailer: git-send-email 2.17.0 Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org From: Thierry Reding An unfortunate interaction between the 32-bit ARM DMA/IOMMU mapping code and Tegra SMMU driver changes to support IOMMU groups introduced a boot- time regression on Tegra124. This was caught very late because none of the standard configurations that are tested on Tegra enable the ARM DMA/ IOMMU mapping code since it is not needed. The reason for the failure is that the GPU found on Tegra uses a special bit in physical addresses to determine whether or not a buffer is mapped through the SMMU. In order to achieve this, the Nouveau driver needs to explicitly understand which buffers are mapped through the SMMU and which aren't. Hiding usage of the SMMU behind the DMA API is bound to fail because the knowledge doesn't exist. Furthermore, the GPU has its own IOMMU and in most cases doesn't need buffers to be physically or virtually contiguous. One notable exception is for compressible buffers which need to be mapped with large pages, which in turn require all the small pages in a large page to be contiguous. This can be achieved with an SMMU mapping, though it isn't currently supported in Nouveau. Since Translating through the SMMU is unnecessary and can have a negative impact on performance for the common case, so we want to avoid it when possible. This series of patches adds a 32-bit ARM specific API that allows a driver to detach the device from the DMA/IOMMU mapping so that it can provide its own implementation for dealing with the SMMU. The second patch makes use of that new API in the Nouveau driver to fix the regression. Thierry Thierry Reding (2): ARM: dma-mapping: Set proper DMA ops in arm_iommu_detach_device() drm/nouveau: tegra: Detach from ARM DMA/IOMMU mapping arch/arm/mm/dma-mapping.c | 12 ++++++------ drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c | 13 +++++++++++++ 2 files changed, 19 insertions(+), 6 deletions(-)