From patchwork Sun Apr 24 07:18:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 8919671 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 658D39F6FA for ; Sun, 24 Apr 2016 07:19:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7EB92201ED for ; Sun, 24 Apr 2016 07:19:28 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 38CCD201F2 for ; Sun, 24 Apr 2016 07:19:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E74326E0FF; Sun, 24 Apr 2016 07:19:22 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4A25A6E09F; Sun, 24 Apr 2016 07:19:12 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id e201so14147481wme.2; Sun, 24 Apr 2016 00:19:12 -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=gXFYirlgJvbaHlUzTtism6UMQF7f3z2newNGMUy7iCFkuT2DFkq7e+090IBFJg5XB/ 6kGB2zLT6GBofGzwRJcuc1byZ3aMkhYZfHGvQN651WPYNgSVleY9Y7HRmyZsL5OzwGRi 50tTTUZlpuQxgHtGUaoYzAAhQ3HdKVJDI5vd2XlkCRqefwf5hDMKazDfPNfBogTrZSeN SKV7vQNBJOJfPB4H8cfIAI8zfC5IYd9TtqTrii9S4VTZFgfUfymnO905PP/sYOO4jkAI A05m8CypESqqMz3x8+Vg5xSW+LXkCi9AsQSqfyJB3ZFqiZ0p9jYOAsBjnvYV1ShzOV8/ t2gw== 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=jcMn6hPBNETHx/BR+TrlVD0UzqxCaGltzJb5YMDPpwGxXQwxtVYM5BC7XBMc5BPCwM B1IogkGLxm193t/TaBQ2pw2ND3XzQD73zvR7oUBU0+XeA0QH7sLx2U1aXAmPGcyJqsd3 jxTnXSVqAjPI08TUV4L3RwpcHSvd8oWfudp2PAzdaxqY3T7fWG/oGh+OvZ8529IyIQFt wuuZ9fNO+Zpze+3o7aACHQs3tILjcSUuT8InjO/zyIa02YXzNcbtd7oUSs0XzWeiwGrm 971iMAT7Cj52h3ulvLJ4LnptSwBhkMIBlbp+CyFgSnFIjuehAW6N0pYy6uLpVrCNZ38g H54g== X-Gm-Message-State: AOPr4FVZRrLIf2xyicarvy447NPoZi1DwKqmJ02UkyDxE2AN8WuPV/oWV5xbuAVOXwjg0g== X-Received: by 10.28.48.203 with SMTP id w194mr1164529wmw.67.1461482350758; Sun, 24 Apr 2016 00:19:10 -0700 (PDT) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id i11sm16937119wjn.36.2016.04.24.00.19.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 24 Apr 2016 00:19:09 -0700 (PDT) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Sun, 24 Apr 2016 08:18:34 +0100 Message-Id: <1461482332-21975-3-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1461482332-21975-1-git-send-email-chris@chris-wilson.co.uk> References: <1461482332-21975-1-git-send-email-chris@chris-wilson.co.uk> Cc: David Airlie , 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 Subject: [Intel-gfx] [PATCH 03/21] io-mapping: Specify mapping size for io_mapping_map_wc() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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; }