Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp4889124rwi; Mon, 17 Oct 2022 12:10:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6qirX5f+vkCaRMAJeI3M6rVGUsHVnV8rYHAlLSJzgoC0avCWLjyUTc8RReTZnNbnwa/j1e X-Received: by 2002:a17:906:cc16:b0:78d:ce93:f5af with SMTP id ml22-20020a170906cc1600b0078dce93f5afmr9361760ejb.592.1666033842052; Mon, 17 Oct 2022 12:10:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666033842; cv=none; d=google.com; s=arc-20160816; b=wYxGjRkl7pxODl8Nqgh1DLLVnrsGendRnB9wggj7WqCwLWM4B5CG4PZmXYYR/0fCPg XZkqBHh+sYwhaOkeXAQhWNjtr/AuHpaxqiuarvcPN+92Xn6GomeFWoRPgJC1jWHKdFv6 hqk2cDzhcRD6G+cBB19UPqzAWHs//gY+eUMZGpMJscr96e2AXWFf1QyV0hkIAE17n2Eh xhMIFujqYS8X6TFU/hn5VhSH9I4bCliJK2Gs1L1bwURUaToim4N4qMCGglqKnAa0WsBi ot9wtegfz/p6+liqTnn33mn94Gd4dKZkyhrEFmcvlx14pMmchdCQbl4z0l37V6JVDYJO jJeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=KaiF/SCfWzsRvXRBubrvLDOWGhfVrO/hXf7iRdDzGmk=; b=ePPF0qbmFQjjrQtwrVCUami7DVBO/U6YpFby2hMazS6ISVtcNLrUz9xNH4oKDsMyk8 kILkipwdrWIYW0UV6TDu9Ph6zP7jSQj1EqDiQ7ARJpPY5j9bDc+4TlHzkvIrYxryOxf2 jHoFhsZXko77PeWXxhFId72VRoWL1WDqMHDAdQg3w1qqRPjhvoYrP0goHgB0sl4I50ka yiksBrQuQ7RhxFFQEFZN5F0xN1bgLKRxwbn0jsgXXxYzJ6Zf+qh6HjZouITI7m9t7sS5 CSKJk/3r+sFLvoMzfEEppfshUI3cmPUfHczXijTo3DCO6EnvW8vXtJn6Ebph97GDn5dC 5odA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@metanate.com header.s=stronger header.b=sHtaiyqA; 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 m22-20020aa7c2d6000000b0044e9fd71b82si8587373edp.280.2022.10.17.12.10.16; Mon, 17 Oct 2022 12:10:42 -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=sHtaiyqA; 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 S230033AbiJQTAi (ORCPT + 99 others); Mon, 17 Oct 2022 15:00:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230022AbiJQTAe (ORCPT ); Mon, 17 Oct 2022 15:00:34 -0400 Received: from metanate.com (unknown [IPv6:2001:8b0:1628:5005::111]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E893DEC6 for ; Mon, 17 Oct 2022 12:00:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metanate.com; s=stronger; h=In-Reply-To:Content-Type:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description; bh=KaiF/SCfWzsRvXRBubrvLDOWGhfVrO/hXf7iRdDzGmk=; b=sHtai yqAEg9DkUpwrXBnspJ5VZMuZQYaZ85XTaLkxgnHhfTQX2I30OjhPcYuA3AuXZDtMwnIFhYyQAXt2N 18wzcdV8ZRPLAxg+4proMrSifd0wnRENgY5rwQnZ1qTqv0RJxf6Br/K3HPIShZkClZU6+xHRtsTht bNCdWtd6sf2ipr6EFhyxr0e8wN4ruwhobn7jZPeUA/pNszAz1JqpGrGd6HQktfLpmFMLBq74H2+gu eOstzi+9GjOYkMAdpaNHU1XeExVa9bHTQQJa4zmcBnMPrc0KBqiQR1NYU+iIl+wqnl9dcB7fFzRC9 iaHWgHFF4q11A/ryHRFmhlWnHesrg==; Received: from [81.174.171.191] (helo=donbot) by email.metanate.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1okVLZ-0006Sk-25; Mon, 17 Oct 2022 20:00:22 +0100 Date: Mon, 17 Oct 2022 20:00:21 +0100 From: John Keeping To: Johan Jonker , Thomas Zimmermann Cc: Heiko Stuebner , dri-devel@lists.freedesktop.org, Sandy Huang , David Airlie , Daniel Vetter , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org Subject: Re: [BUG] [PATCH] drm/rockchip: use generic fbdev setup Message-ID: References: <20211029115014.264084-1-john@metanate.com> <2220890.jZfb76A358@phil> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 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 On Mon, Oct 17, 2022 at 08:30:23PM +0200, Johan Jonker wrote: > > > On 10/17/22 13:29, Heiko Stuebner wrote: > > Am Montag, 17. Oktober 2022, 12:05:16 CEST schrieb John Keeping: > >> Hi Johan, > >> > >> On Mon, Oct 17, 2022 at 10:11:32AM +0200, Johan Jonker wrote: > >>> Your patch contribution causes a kernel panic on MK808 with Rockchip rk3066a SoC. > >>> Would you like to contribute to fix this issue? > >>> The assumtion that drm_fbdev_generic_setup() does what rockchip_drm_fbdev_init did is not true! > >>> A revert makes it work again. > >> > > >> It looks like there are 3 different ways to end up with -ENOMEM here, > >> can you track down whether you're hitting one of the cases in > >> rockchip_gem_prime_vmap() or if it's the iosys_map_is_null case in > >> drm_gem_vmap()? > > It looks like it comes from rockchip_gem_prime_vmap() second return (2). > > > if (rk_obj->dma_attrs & DMA_ATTR_NO_KERNEL_MAPPING) { > > //////////////// > > printk("FBDEV rockchip_gem_prime_vmap 2"); > > //////////////// > return -ENOMEM; > } Ah-ha, Heiko was right that this is because the no-iommu path is broken as a result of switching to the generic fbdev code. This patch should fix it, but I wonder if Thomas has any ideas about a better way to handle this since it feels a bit hacky to special-case the fb_helper inside the GEM code: -- >8 -- 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); -- 8< --