From patchwork Tue Apr 23 12:31:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 10912869 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B665B1708 for ; Tue, 23 Apr 2019 12:32:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A790828742 for ; Tue, 23 Apr 2019 12:32:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A5215287A2; Tue, 23 Apr 2019 12:32:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A09632888E for ; Tue, 23 Apr 2019 12:32:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726801AbfDWMcT (ORCPT ); Tue, 23 Apr 2019 08:32:19 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:39014 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726033AbfDWMcT (ORCPT ); Tue, 23 Apr 2019 08:32:19 -0400 Received: by mail-lj1-f195.google.com with SMTP id l7so13344080ljg.6; Tue, 23 Apr 2019 05:32:17 -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:mime-version :content-transfer-encoding; bh=Y21hx1+ZWcM1GMPqrCOpWwNweQmqFuIM89y/n/Gh9Ow=; b=S4u5ppLECCr0x9IXYQD11GdI8OH47geK+mtaxNFDeD3+TEJwR1O+2cwsustuadremf +bXUVdIvQbtS0wEj/s/xOyIMEhYABbtHZpa7OVBcH2a5r5sA4sjSo8UkYazSiXWr11yd twR/NxaPJE+8k1BPM85J3NrazyKgwzSd1rsc+h4TZswD45nA+GI6LGVL67JdnK+ijgW5 IusRrv6BCi0XarrxyfJQj+3HeRmnPoX5TtKj/11Lg4o8Dv3YhD+qD2x1d76xvBhPSJUF xmyQv8Dl8mmRS4lsdcXWHtuVFA0f3e5AaC5HL13DZUkmCTAHEn8A9rL9lm+0wjPoHuI0 hz5A== 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:mime-version :content-transfer-encoding; bh=Y21hx1+ZWcM1GMPqrCOpWwNweQmqFuIM89y/n/Gh9Ow=; b=aixC45ERMa+596iDFkhcNVsHv1Wim8+kQTihejDVJvUrzthUbMkkZrGarg7lOQkhnP XtDtOrADI1a9oPTek1dMLb5Gg5eZQJglhl1iVuh7F6F/bP1CbtHQL2Djs9JLHZXM5vDj 5W5NuK+UxihyxzZgIcD530K+b2Q0VW/tkqKPLbYuJcN1t5CaZsGFujZ2BE1P++PTdreD RTCUkrQDu5xhYsxrzaoioxCAzDeg1xlWqSj3dc3YOUg+pSYUISGHBE+26iiVQu6wN6Hj wUo4RMM33bQJ8LdqHPjSg3hJPFvvz41vF6aQCp3BB/xrArF7g7YFVXKES1VqE2+6BV9u sbqg== X-Gm-Message-State: APjAAAWRzKM3A0oL8P6weTB6k6J/CLkhux6FZzY59Tlv2fvHlCJlbk2z JRb0sB8/lJTzODDQSL7lSj8= X-Google-Smtp-Source: APXvYqwT7KYuVtbEI6VGDs8eFTLw6lPj/3oCH6V/sPC5Lzt06f80AVqoaTC2lcP3rnGYgU3y9gmNLw== X-Received: by 2002:a2e:9915:: with SMTP id v21mr13796464lji.154.1556022736711; Tue, 23 Apr 2019 05:32:16 -0700 (PDT) Received: from localhost.localdomain ([5.164.240.123]) by smtp.gmail.com with ESMTPSA id l15sm3344379ljh.62.2019.04.23.05.32.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Apr 2019 05:32:15 -0700 (PDT) From: Serge Semin To: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , Christian Koenig , Huang Rui , Junwei Zhang Cc: dri-devel@lists.freedesktop.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Serge Semin , Ralf Baechle , Paul Burton , James Hogan , "Vadim V . Vlasov" Subject: [PATCH] drm: Permit video-buffers writecombine mapping for MIPS Date: Tue, 23 Apr 2019 15:31:22 +0300 Message-Id: <20190423123122.32573-1-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since commit 4b050ba7a66c ("MIPS: pgtable.h: Implement the pgprot_writecombine function for MIPS") and commit c4687b15a848 ("MIPS: Fix definition of pgprot_writecombine()") write-combine vma mapping is available to be used by kernel subsystems for MIPS. In particular the uncached accelerated attribute is requested to be set by ioremap_wc() method and by generic PCI memory pages/ranges mapping methods. The same is done by the drm_io_prot()/ttm_io_prot() functions in case if write-combine flag is set for vma's passed for mapping. But for some reason the pgprot_writecombine() method calling is ifdefed to be a platform-specific with MIPS system being marked as lacking of one. At the very least it doesn't reflect the current MIPS platform implementation. So in order to improve the DRM subsystem performance on MIPS with UCA mapping enabled, we need to have pgprot_writecombine() called for buffers, which need store operations being combined. In case if particular MIPS chip doesn't support the UCA attribute, the mapping will fall back to noncached. Cc: Ralf Baechle Cc: Paul Burton Cc: James Hogan Signed-off-by: Vadim V. Vlasov Signed-off-by: Serge Semin Acked-by: Christian König --- drivers/gpu/drm/drm_vm.c | 5 +++-- drivers/gpu/drm/ttm/ttm_bo_util.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c index c3301046dfaa..50178dc64060 100644 --- a/drivers/gpu/drm/drm_vm.c +++ b/drivers/gpu/drm/drm_vm.c @@ -62,7 +62,8 @@ static pgprot_t drm_io_prot(struct drm_local_map *map, /* We don't want graphics memory to be mapped encrypted */ tmp = pgprot_decrypted(tmp); -#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) +#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || \ + defined(__mips__) if (map->type == _DRM_REGISTERS && !(map->flags & _DRM_WRITE_COMBINING)) tmp = pgprot_noncached(tmp); else @@ -73,7 +74,7 @@ static pgprot_t drm_io_prot(struct drm_local_map *map, tmp = pgprot_writecombine(tmp); else tmp = pgprot_noncached(tmp); -#elif defined(__sparc__) || defined(__arm__) || defined(__mips__) +#elif defined(__sparc__) || defined(__arm__) tmp = pgprot_noncached(tmp); #endif return tmp; diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index 895d77d799e4..9f918b992f7e 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c @@ -539,13 +539,13 @@ pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp) tmp = pgprot_noncached(tmp); #endif #if defined(__ia64__) || defined(__arm__) || defined(__aarch64__) || \ - defined(__powerpc__) + defined(__powerpc__) || defined(__mips__) if (caching_flags & TTM_PL_FLAG_WC) tmp = pgprot_writecombine(tmp); else tmp = pgprot_noncached(tmp); #endif -#if defined(__sparc__) || defined(__mips__) +#if defined(__sparc__) tmp = pgprot_noncached(tmp); #endif return tmp;