From patchwork Thu Jan 10 07:28:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 10755343 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 5A8D013B5 for ; Thu, 10 Jan 2019 08:34:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4DFE32873A for ; Thu, 10 Jan 2019 08:34:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C15628FBB; Thu, 10 Jan 2019 08:34:23 +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,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 E43D82873A for ; Thu, 10 Jan 2019 08:34:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9F22F6ED70; Thu, 10 Jan 2019 08:34:14 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id 13B116ED45 for ; Thu, 10 Jan 2019 07:29:03 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id u4so10147915wrp.3 for ; Wed, 09 Jan 2019 23:29:02 -0800 (PST) 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; bh=ZtXwwgJ9jns1Sfy4Tyle1yTwi4X+cfbXqDXoJIa31BU=; b=c2j1st0eKbt1BKnav7JFl+lED95X+d40DFl+tfU0y6n+IYUoG73SZbkRrpFRpmyXPx CaAG9JtblpZljxpww4f99bZbD0K9vWR80t/yh43AI5KOq9wCpKSU8ubvWNcA0yOBAxSh XkrREezCSg8zwg0FGfkdp2PMSLFHSqguk8JsnlNqY05WkGuuM15CKlzyO4s1+u6YarQz UikydZJa3j62iMiPfmH9ifUniA3uh0CLPD6hMwR/xf0IjWbscK+8WyywmIQqK2ujmuh4 8/XlWlUvYWiEaGLrZIeP+Fm126hoBBw08AlA1SKICMAtkSWWa/mt1uU/SCzRkm85ziEc /AyQ== X-Gm-Message-State: AJcUukca0ZLt/zpyvkuh40Ie6tLXVSfaHup3KwxM8BhffKyHyMphqTvX mxTBeyxADMWqk5ynJWU5ouytROxifOL4UA== X-Google-Smtp-Source: ALg8bN6JYAJnNmdLeU8FdAN1JA2feccocZGuVk0j2D+N2pAyBiausHSwhmeg0uynECoW3jINQHu/Cg== X-Received: by 2002:adf:ae41:: with SMTP id u1mr7485670wrd.20.1547105341517; Wed, 09 Jan 2019 23:29:01 -0800 (PST) Received: from dogfood.home ([2a01:cb1d:112:6f00:311a:55a6:a895:3ae2]) by smtp.gmail.com with ESMTPSA id w12sm53846614wrr.23.2019.01.09.23.28.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Jan 2019 23:29:00 -0800 (PST) From: Ard Biesheuvel To: linux-kernel@vger.kernel.org Subject: [RFC PATCH] drm/ttm: force cached mappings for system RAM on ARM Date: Thu, 10 Jan 2019 08:28:41 +0100 Message-Id: <20190110072841.3283-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 X-Mailman-Approved-At: Thu, 10 Jan 2019 08:34:06 +0000 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: Carsten.Haitzler@arm.com, Ard Biesheuvel , David Airlie , will.deacon@arm.com, dri-devel@lists.freedesktop.org, Huang Rui , Junwei Zhang , Christian Koenig , linux-arm-kernel@lists.infradead.org, Bernhard.Rosenkranzer@linaro.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP ARM systems do not permit the use of anything other than cached mappings for system memory, since that memory may be mapped in the linear region as well, and the architecture does not permit aliases with mismatched attributes. So short-circuit the evaluation in ttm_io_prot() if the flags include TTM_PL_SYSTEM when running on ARM or arm64, and just return cached attributes immediately. This fixes the radeon and amdgpu [TBC] drivers when running on arm64. Without this change, amdgpu does not start at all, and radeon only produces corrupt display output. Cc: Christian Koenig Cc: Huang Rui Cc: Junwei Zhang Cc: David Airlie Reported-by: Carsten Haitzler Signed-off-by: Ard Biesheuvel --- drivers/gpu/drm/ttm/ttm_bo_util.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index 046a6dda690a..0c1eef5f7ae3 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c @@ -530,6 +530,11 @@ pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp) if (caching_flags & TTM_PL_FLAG_CACHED) return tmp; +#if defined(__arm__) || defined(__aarch64__) + /* ARM only permits cached mappings of system memory */ + if (caching_flags & TTM_PL_SYSTEM) + return tmp; +#endif #if defined(__i386__) || defined(__x86_64__) if (caching_flags & TTM_PL_FLAG_WC) tmp = pgprot_writecombine(tmp);