From patchwork Sun Apr 24 18:10:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 8920451 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1715ABF29F for ; Sun, 24 Apr 2016 18:10:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3086520259 for ; Sun, 24 Apr 2016 18:10:41 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 476B820222 for ; Sun, 24 Apr 2016 18:10:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 97AB76E20F; Sun, 24 Apr 2016 18:10:35 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0417D6E215; Sun, 24 Apr 2016 18:10:33 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id w143so15849623wmw.3; Sun, 24 Apr 2016 11:10:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=jgLz6XGz0YM6SEzAiraYSC3V3U9bVANSSJuMawpoRBw=; b=fftTcr2fW82xYD8VAuGKVJq9WoZdob5fctUdD3ayjfp5EvIianjqHbsV8k2fAlPC9h 5LyMV2pGOoR6ZZUxpGjVTJ4OuM4K3/f8Van3ZN+8pKgcQZNk9MxU8QB1EhhpJPdbgp8O nVk1vCLKc5eeMZmquFOeYQP8oRxnNCApu+y06V7EF98df0k5WFp5w/yAJGS393wHtT+a owDUj8OP7BY8WyGXYP2yqQ64go8CkpSV9gVU2ftd0OpQV10x9Jc7Bl+AskU9PIG4XsjJ n4P3sxBntRg5ZjDIer1vsbVp9VLayd472EUA6UScCqJUHHdW9m5Ke2TFJJoEwTm4oaR1 1N0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=jgLz6XGz0YM6SEzAiraYSC3V3U9bVANSSJuMawpoRBw=; b=SYHwuK7gJ+7V7OhvBOj+sO/vNATHbAmfh2dMwReU2NMJQSP17SOEgF2mCsX1Iq1z81 P323/c0Sh/l9Ge10o7FtDh/SMy8JTqxkmEI3XWTccgyz+MvjoSPwMts1da7uYYKx8Vzp +RwLTm3zQiAZv16AeOHFv/nbA0MNxAa8qj8rp2HL/YgK9zS+QvtSXpT2TtpvNBYDvCj1 eiRjRpsqIGskfmXfnG7u1eKah6L+1wWMTBWBoRmv/HQIztBdvrlnd298ZHnp/QeIsvVp gbFjrRmFFQSeKJbPbKOuwZUl8JGgGnFyFBBVrjvW8qkwhsFu8PFruuoNnTsUqcW1BKlG R6fw== X-Gm-Message-State: AOPr4FWv9DAmrRNLOPIR6Z4luoqzo4slfrAk5rv5Nk1v0gVsxIzA5ncjqvHirdqYgaFdow== X-Received: by 10.194.2.225 with SMTP id 1mr34794450wjx.29.1461521430701; Sun, 24 Apr 2016 11:10:30 -0700 (PDT) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id lh1sm19590888wjb.20.2016.04.24.11.10.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 Apr 2016 11:10:29 -0700 (PDT) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Subject: [PATCH v3 03/21] io-mapping: Specify mapping size for io_mapping_map_wc() Date: Sun, 24 Apr 2016 19:10:01 +0100 Message-Id: <1461521419-18086-3-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1461521419-18086-1-git-send-email-chris@chris-wilson.co.uk> References: <1461521419-18086-1-git-send-email-chris@chris-wilson.co.uk> Cc: Tvrtko Ursulin , netdev@vger.kernel.org, Yishai Hadas , linux-kernel@vger.kernel.org, "Peter Zijlstra \(Intel\)" , "Luis R . Rodriguez" , dri-devel@lists.freedesktop.org, linux-rdma@vger.kernel.org, Daniel Vetter , Dan Williams , Ingo Molnar , David Hildenbrand X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The ioremap() hidden behind the io_mapping_map_wc() convenience helper can be used for remapping multiple pages. Extend the helper so that future callers can use it for larger ranges. Signed-off-by: Chris Wilson Cc: Tvrtko Ursulin Cc: Daniel Vetter Cc: Jani Nikula Cc: David Airlie Cc: Yishai Hadas Cc: Dan Williams Cc: Ingo Molnar Cc: "Peter Zijlstra (Intel)" Cc: David Hildenbrand Cc: Luis R. Rodriguez Cc: intel-gfx@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org Cc: netdev@vger.kernel.org Cc: linux-rdma@vger.kernel.org Cc: linux-kernel@vger.kernel.org Reviewed-by: Luis R. Rodriguez --- drivers/gpu/drm/i915/intel_overlay.c | 3 ++- drivers/net/ethernet/mellanox/mlx4/pd.c | 4 +++- include/linux/io-mapping.h | 10 +++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c index 9746b9841c13..0d5a376878d3 100644 --- a/drivers/gpu/drm/i915/intel_overlay.c +++ b/drivers/gpu/drm/i915/intel_overlay.c @@ -198,7 +198,8 @@ intel_overlay_map_regs(struct intel_overlay *overlay) regs = (struct overlay_registers __iomem *)overlay->reg_bo->phys_handle->vaddr; else regs = io_mapping_map_wc(ggtt->mappable, - overlay->flip_addr); + overlay->flip_addr, + PAGE_SIZE); return regs; } diff --git a/drivers/net/ethernet/mellanox/mlx4/pd.c b/drivers/net/ethernet/mellanox/mlx4/pd.c index b3cc3ab63799..6fc156a3918d 100644 --- a/drivers/net/ethernet/mellanox/mlx4/pd.c +++ b/drivers/net/ethernet/mellanox/mlx4/pd.c @@ -205,7 +205,9 @@ int mlx4_bf_alloc(struct mlx4_dev *dev, struct mlx4_bf *bf, int node) goto free_uar; } - uar->bf_map = io_mapping_map_wc(priv->bf_mapping, uar->index << PAGE_SHIFT); + uar->bf_map = io_mapping_map_wc(priv->bf_mapping, + uar->index << PAGE_SHIFT, + PAGE_SIZE); if (!uar->bf_map) { err = -ENOMEM; goto unamp_uar; diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h index e399029b68c5..645ad06b5d52 100644 --- a/include/linux/io-mapping.h +++ b/include/linux/io-mapping.h @@ -100,14 +100,16 @@ io_mapping_unmap_atomic(void __iomem *vaddr) } static inline void __iomem * -io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset) +io_mapping_map_wc(struct io_mapping *mapping, + unsigned long offset, + unsigned long size) { resource_size_t phys_addr; BUG_ON(offset >= mapping->size); phys_addr = mapping->base + offset; - return ioremap_wc(phys_addr, PAGE_SIZE); + return ioremap_wc(phys_addr, size); } static inline void @@ -155,7 +157,9 @@ io_mapping_unmap_atomic(void __iomem *vaddr) /* Non-atomic map/unmap */ static inline void __iomem * -io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset) +io_mapping_map_wc(struct io_mapping *mapping, + unsigned long offset, + unsigned long size) { return ((char __force __iomem *) mapping) + offset; }