Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1359452rwi; Thu, 20 Oct 2022 11:27:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5iEEI8XP7WEkS+qcyr0uHj5+oLFFqDLJXQB9xqFYS9bcT2cuu5cyTRARc22mKQ7wctMzYg X-Received: by 2002:a17:90b:3c88:b0:20d:9724:95dc with SMTP id pv8-20020a17090b3c8800b0020d972495dcmr17385078pjb.56.1666290427460; Thu, 20 Oct 2022 11:27:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666290427; cv=none; d=google.com; s=arc-20160816; b=RATvyw8NDq+mBz3/yDM1v8GEEj36E0BnJtQXkWGv1717lbWbwo4I7gJk3sPWqquJrq 8uD8+2rF569NCtyDi0G01dQsLrob4GMkoGr0zvzzuDddXYvZgjvV+3iKM8ExiblI5nGW BZ61GnoTGFwRyE2GEDsi3KGnYetgoG7/Qmd6/w8SK5nPrcO6vZiLB5/pcZ546sdvKvbq IQa6paR9UwmS+1t7RotQt4Ow+VWFD8OAf89PpZK/17GKpjLX7KuZ9m1PDfD4gTR8Ny65 1syQgy9cKs0X/M4pOurnGnJuWjKPcXM7H4Aw5SJZc9fRyPK9GdUaqvzgBZ6haG3+EQ25 vIUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=KdHqm/l66j6BWqUls9UaxFTsEolEqNPGfBkODMbr/GA=; b=uBPNSyKydwlZnDBImtRta5Eqw/xM4j4FAMc1b+mgU0Mnzd2g/4O+N22Lq5RRL9PeA5 sHPo2XOKYpvZB5cTjGTDTDK+6LEiu501aqJrVexE5SK+C4c6GVFXAyfP4H1fE3RIYSjK ihxJP+JqSuyhI8dnlRZaw7PQL5AfvAZ+r53lr92FgtXSN3iByJ0roLvdW/GEifGy0pY4 TepK9Gjw9sOuxWayn+wbBegzrlqhRcaUuwpZQqd/K8rzI33SzKrcb4LTAcClsYrUvfAS jQzglBkToXQ0lOLmij1pMw4oa7/AcQt2CW1sWFjsH590XpL71p/Ut5B4e7t1U4LofqnP P/Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@metanate.com header.s=stronger header.b="SvnNrY/A"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=metanate.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g7-20020a056a000b8700b00563ad44ddf9si22641482pfj.380.2022.10.20.11.26.54; Thu, 20 Oct 2022 11:27:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@metanate.com header.s=stronger header.b="SvnNrY/A"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=metanate.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230216AbiJTSNI (ORCPT + 99 others); Thu, 20 Oct 2022 14:13:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229933AbiJTSNG (ORCPT ); Thu, 20 Oct 2022 14:13:06 -0400 Received: from metanate.com (unknown [IPv6:2001:8b0:1628:5005::111]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACD4C16D578 for ; Thu, 20 Oct 2022 11:13:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metanate.com; s=stronger; h=Content-Transfer-Encoding:Message-Id:Date: Subject:Cc:To:From:Content-Type:Reply-To:Content-ID:Content-Description: In-Reply-To:References; bh=KdHqm/l66j6BWqUls9UaxFTsEolEqNPGfBkODMbr/GA=; b=Sv nNrY/A/9z+07NdZbX/h5lHzCRWSVw2LllsAYQ7NTYjUEyc6dQokA+2UwXMOf84QjssYBe+LdN5WrA 1E+Qmxio2VQqwJbL6k3j0z5pAGMF8+oor9uvvWUOtvTugP5eIw3rnfbF3q7bWi9mZi2GZYiq4vYi7 pB9wCXsQUK6EmSNKSoQ45FzhFrJ48fiDlduzZrWGZEuD9j0vleJfN/QQKTzZYMrFoeVxUD10V2eT/ l9y3MuLU6ywQ9oLAEhSzPI7F9LIa/lP6xzDGDjlI7xVer+E4jPwkB/R6ImWStlIbwYEwdKwdLqukk wovhcKowstPQZZxPyNveoPXXvjH+JfRA==; Received: from [81.174.171.191] (helo=donbot.metanate.com) by email.metanate.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1ola2F-0002sk-Tt; Thu, 20 Oct 2022 19:12:53 +0100 From: John Keeping To: dri-devel@lists.freedesktop.org Cc: Johan Jonker , John Keeping , Thomas Zimmermann , Sandy Huang , =?UTF-8?q?Heiko=20St=C3=BCbner?= , David Airlie , Daniel Vetter , linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/rockchip: fix fbdev on non-IOMMU devices Date: Thu, 20 Oct 2022 19:12:47 +0100 Message-Id: <20221020181248.2497065-1-john@metanate.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Authenticated: YES X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RDNS_NONE,SPF_HELO_PASS, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When switching to the generic fbdev infrastructure, it was missed that framebuffers were created with the alloc_kmap parameter to rockchip_gem_create_object() set to true. The generic infrastructure calls this via the .dumb_create() driver operation and thus creates a buffer without an associated kmap. alloc_kmap only makes a difference on devices without an IOMMU, but when it is missing rockchip_gem_prime_vmap() fails and the framebuffer cannot be used. Detect the case where a buffer is being allocated for the framebuffer and ensure a kernel mapping is created in this case. Fixes: 24af7c34b290 ("drm/rockchip: use generic fbdev setup") Reported-by: Johan Jonker Cc: Thomas Zimmermann Signed-off-by: John Keeping --- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c index 614e97aaac80..da8a69953706 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c @@ -364,9 +364,12 @@ rockchip_gem_create_with_handle(struct drm_file *file_priv, { struct rockchip_gem_object *rk_obj; struct drm_gem_object *obj; + bool is_framebuffer; int ret; - rk_obj = rockchip_gem_create_object(drm, size, false); + is_framebuffer = drm->fb_helper && file_priv == drm->fb_helper->client.file; + + rk_obj = rockchip_gem_create_object(drm, size, is_framebuffer); if (IS_ERR(rk_obj)) return ERR_CAST(rk_obj); -- 2.38.1