From patchwork Tue Apr 23 12:31:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 10914231 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 62BC31575 for ; Wed, 24 Apr 2019 07:18:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C7422863C for ; Wed, 24 Apr 2019 07:18:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 404AC288B6; Wed, 24 Apr 2019 07:18:49 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 526572863C for ; Wed, 24 Apr 2019 07:18:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BAE9889760; Wed, 24 Apr 2019 07:18:25 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5EBB0892EF for ; Tue, 23 Apr 2019 12:32:18 +0000 (UTC) Received: by mail-lj1-x242.google.com with SMTP id t4so13333331ljc.2 for ; Tue, 23 Apr 2019 05:32:18 -0700 (PDT) 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=IeMFTwABt5DS5SIVpQpt9rzI7qethCObwwGInDxLi4mJTAxYUn5WnIXN4KIOYcLXIh BI7i46uvOC88FQw6OrHahAtAnt1WSq52zuNgOQ8gw8D+7jiyPXzMXJ3vNtDEWGiHCxGS oETda0VcJYPrUF3GiC3GRD806XTtteVls0L7+p+zl0eRWTxjK4gAoMxwrOxN7SSWi6ew hP+QS1DmhAhKxXO246iM8BkIdKu6UJ/VpKmE46Pk4Pp61DdeYWRtv3OliZ5ZdJgrT6A0 EvdBJILhghfPlgch7PyblC9C3glFAPgZEDxtHLPHYga4OxeJKABry2BvVvc4SkwqSmJu 2mYg== X-Gm-Message-State: APjAAAVouRGCi93YqDmd6MY9tuqJJOdBBM5kHSE9y3TWlRKLqx061C7d 07+1RTCPzZ+e/92+mlgHo7M= 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 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 X-Mailman-Approved-At: Wed, 24 Apr 2019 07:18:24 +0000 X-Mailman-Original-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-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Vadim V . Vlasov" , James Hogan , dri-devel@lists.freedesktop.org, linux-mips@vger.kernel.org, Serge Semin , linux-kernel@vger.kernel.org, Paul Burton , Ralf Baechle Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- 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;