From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1034684AbcIZMcv (ORCPT ); Mon, 26 Sep 2016 08:32:51 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:35074 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934871AbcIZMcr (ORCPT ); Mon, 26 Sep 2016 08:32:47 -0400 From: Ard Biesheuvel To: linux-kernel@vger.kernel.org, bskeggs@redhat.com, airlied@linux.ie, dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org Cc: Ard Biesheuvel Subject: [PATCH v4 0/3] drm/nouveau: set DMA mask before mapping scratch page Date: Mon, 26 Sep 2016 05:32:37 -0700 Message-Id: <1474893160-12321-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This v4 is now a 3 piece series, after Alexandre pointed out that both GF 100 and NV50 are affected by the same issue, and that a related issue has been solved already for Tegra in commit 9d0394c6bed5 ("drm/nouveau/instmem/gk20a: set DMA mask early"). The issue that this series addresses is the fact that the Nouveau driver invokes the DMA API before setting the DMA mask. In both cases addressed here, these are simply static bidirectional mappings of scratch pages whose purpose is not well understood, and in most cases, it does not matter that these pages are always allocated below 4 GB even if the hardware can access memory much higher up. However, on platforms without any RAM below 4 GB, the preliminary DMA mask of 32 is preventing the nouveau driver from loading on GF100 and NV50 hardware with an error like the following one: nouveau 0000:02:00.0: enabling device (0000 -> 0003) nouveau 0000:02:00.0: NVIDIA GT218 (0a8280b1) nouveau 0000:02:00.0: bios: version 70.18.a6.00.00 nouveau 0000:02:00.0: fb ctor failed, -14 nouveau: probe of 0000:02:00.0 failed with error -14 So fix this by setting a preliminary DMA mask based on the MMU device 'dma_bits' property (patch #1), and postpone mapping the scratch pages to the respective FB .init() hooks. (#2 and #3) v4: split and move dma_set_mask to probe hook (Alexander) v3: rework code to get rid of DMA_ERROR_CODE references, which is not defined on all architectures v2: replace incorrect comparison of dma_addr_t type var against NULL Ard Biesheuvel (3): drm/nouveau: set streaming DMA mask early drm/nouveau/fb/gf100: defer DMA mapping of scratch page to init() hook drm/nouveau/fb/nv50: defer DMA mapping of scratch page to init() hook drivers/gpu/drm/nouveau/nouveau_drm.c | 11 +++++++ drivers/gpu/drm/nouveau/nvkm/subdev/fb/gf100.c | 26 +++++++++++------ drivers/gpu/drm/nouveau/nvkm/subdev/fb/nv50.c | 30 +++++++++++++------- 3 files changed, 48 insertions(+), 19 deletions(-) -- 2.7.4