Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp5308967imm; Tue, 26 Jun 2018 09:06:24 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeuTFgUYzHNTQm295RLRXXmDhkPu3A9hXoOVAZJPOtx+QE5HOp1+MDUNjPuygiHsZNrY/fC X-Received: by 2002:a63:2581:: with SMTP id l123-v6mr1938918pgl.226.1530029184026; Tue, 26 Jun 2018 09:06:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530029183; cv=none; d=google.com; s=arc-20160816; b=aWLoUh+zQIqY5jkb6BgxhTpmaHvxzePqYl+HIdz+TAaYxgFfyJ4cY11SAPmi7ACz7U Bs7fdEZRiDND30I7gGwMC6ugXIyxR4nHvH1drjaAn6/u6gdqOm1MbAEJwzm/EuzvLf1P ovx6pciMkZUXJYJXUMzTy4fn7XsSfKuV9JyXeDNODgdrzot0MCguZ9rBBHmJT9egK8QL q4XvdpbFCXUK/T/BJn1RGo8NkEfR42IcdL+maU4+QI/E+aUk5GMbVkAxG80ImCLRrBDh j66z6sf4m2OxS1npS7DIa3V1ssMEknRB3Vjj6XfYNcBmYqTElaQH0MSrwOy2+N1dFF39 lUVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=olO8NJVbUE6+ocyrzqnTCLj2kpWEoN8vj3cQi8+2iLE=; b=xk9jRtVaXsirNxJ5a96Jn+pGV1iqd2EE3SsoBR+BzWyf1CWb552EgmCA2UAxxVE472 0mEErEuYdiuzp32OtFde9MR0Ecu9LLcIqi+6/bdA1gA7xDfRS18j1D+HaE3ss4jP8gTt GRZTQwvASmtcD2pDSnICsQhUVz4atFdVKlWCLQt0Zt4YWufoq+jPbyvBefzGsuXWr3lG WjuXItRWnRWIHjLE/bS1UPEmNCi/CISbIXAAs6Tic5gEn60fT1fVPi8hvcF9KdObW7yL Zqql5lEc1DIl56Lk+nLqWdpj3lps6iQLp9/TN5vxBMtQpOpZmK7XJI9kcVG6QJoih1+H Jqkg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e1-v6si1710315pld.80.2018.06.26.09.06.09; Tue, 26 Jun 2018 09:06:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965251AbeFZOrO (ORCPT + 99 others); Tue, 26 Jun 2018 10:47:14 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:39859 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965103AbeFZOrL (ORCPT ); Tue, 26 Jun 2018 10:47:11 -0400 Received: by mail-wm0-f65.google.com with SMTP id p11-v6so2136940wmc.4 for ; Tue, 26 Jun 2018 07:47:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=olO8NJVbUE6+ocyrzqnTCLj2kpWEoN8vj3cQi8+2iLE=; b=hOzOaXxTUNR57Rvz/myUMQgymoLR+lYMA9N6Dl+1KxmphZXlAbH/9zqyB1ukcsZBt0 YGR7pQCmTjnqpvJg1uSbwJEbsjuVpWCbBueoN2yLrLJEu/kLw49/f4mEhnL89idWsysY +wRLP3S5WgkmnZT5Ho70qv5cLgcXNwsI3+nouRzkLfLxnt78lI4/Z1rkrGn6CJuhY3fo 0OUpepjoHaxUARbIY5PWQvFaHZaW2s8gNKzg2aLDsgMAV1WWkTfDTeujlrd2jDpLeUNO 4SjUUGdLA7YscIBk0FD4Kij9oAhD5k+RHBQ3TcjUP6pzOf1HqxOeIoz/kjV4lKoRBNJN XUtQ== X-Gm-Message-State: APt69E1tqKS5E6DeogZuHWHrXWoWuAj+Afe/mUvlUqurEfuRIw32AWJQ Biwc8FbWnUFY6eQfTANsuk/CsEx5qcY= X-Received: by 2002:a1c:bf0c:: with SMTP id p12-v6mr1801849wmf.120.1530024429552; Tue, 26 Jun 2018 07:47:09 -0700 (PDT) Received: from shalem.localdomain (546A5441.cm-12-3b.dynamic.ziggo.nl. [84.106.84.65]) by smtp.gmail.com with ESMTPSA id c18-v6sm3100835wrq.17.2018.06.26.07.47.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Jun 2018 07:47:08 -0700 (PDT) Subject: Re: simple-framebuffer enquire To: Michael Nazzareno Trimarchi Cc: artlomiej Zolnierkiewicz , linux-fbdev@vger.kernel.org, LKML References: <9fb661e6-482b-76e0-2af0-a62a70e5606d@redhat.com> <233d6808-4d44-9e47-7e3f-4f35cf731706@redhat.com> From: Hans de Goede Message-ID: <7b996681-3a94-1f93-10c0-5369fe843cbc@redhat.com> Date: Tue, 26 Jun 2018 16:47:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 26-06-18 16:42, Michael Nazzareno Trimarchi wrote: > Hi Hans > > On Tue, Jun 26, 2018 at 3:38 PM, Michael Nazzareno Trimarchi > wrote: >> Hi >> >> On Tue, Jun 26, 2018 at 3:36 PM, Hans de Goede wrote: >>> Hi, >>> >>> >>> On 26-06-18 15:29, Michael Nazzareno Trimarchi wrote: >>>> >>>> Hi >>>> >>>> to be more specific >>>> >>>> On Tue, Jun 26, 2018 at 3:06 PM, Michael Nazzareno Trimarchi >>>> wrote: >>>>> >>>>> Hi >>>>> >>>>> On Tue., 26 Jun. 2018, 12:01 pm Hans de Goede, >>>>> wrote: >>>>>> >>>>>> >>>>>> Hi, >>>>>> >>>>>> On 25-06-18 15:29, Michael Nazzareno Trimarchi wrote: >>>>>>> >>>>>>> Hi Hans >>>>>>> >>>>>>> In order to let it even registered the simplefb I have added this >>>>>>> change. According on what I understand >>>>>>> from the code seems that this is the way to acquire memory with the >>>>>>> correct attribute >>>>>>> >>>>>>> diff --git a/drivers/video/fbdev/simplefb.c >>>>>>> b/drivers/video/fbdev/simplefb.c >>>>>>> index a3c44ec..7e61ce3 100644 >>>>>>> --- a/drivers/video/fbdev/simplefb.c >>>>>>> +++ b/drivers/video/fbdev/simplefb.c >>>>>>> @@ -466,8 +466,8 @@ static int simplefb_probe(struct platform_device >>>>>>> *pdev) >>>>>>> >>>>>>> info->fbops = &simplefb_ops; >>>>>>> info->flags = FBINFO_DEFAULT | FBINFO_MISC_FIRMWARE; >>>>>>> - info->screen_base = ioremap_wc(info->fix.smem_start, >>>>>>> - info->fix.smem_len); >>>>>>> + info->screen_base = arch_memremap_wb(info->fix.smem_start, >>>>>>> + info->fix.smem_len); >>>>>> >>>>>> >>>>>> I'm not sure why you need this? wb certainly is not optimal >>>>>> for a framebuffer, the existing wc mapping is really what you >>>>>> want. >>>>>> >>>>> >>>>> Well in this way raise a WARN and get a nice NULL on memory remap on >>>>> imx6ull >>>>> SoC >>>>> >>>> >>>> [ 0.397484] WARNING: CPU: 0 PID: 1 at arch/arm/mm/ioremap.c:303 >>>> __arm_ioremap_pfn_caller+0x80/0x1cc >>> >>> >>> >>> This is causes by a mismatch in memory attributes, which means the >>> memory is already mapped by the kernel as regular RAM and may >>> already be used for other purposes by the kernel! >>> >>> Memory used by a simplefb framebuffer must be reserved by the >>> bootloader, so that it does not get used by the kernel as regular >>> RAM. See e.g.: >>> >>> http://git.denx.de/?p=u-boot.git;a=blob;f=drivers/video/sunxi/sunxi_display.c >>> >>> Near the end of the file where the framebuffer RAM gets excluded from >>> the memory-range reported to the kernel as usable RAM. Note this relies >>> on the u-boot sunxi video code putting the framebuffer at the end of the >>> RAM. > > + aliases { > + display0 = &lcdif; > + }; > + > + reserved-memory { > + #address-cells = <1>; > + #size-cells = <1>; > + ranges; > + > + display_reserved: framebuffer@86fd6080 { > + reg = <0x86fd6080 (480 * 272 *4)>; > + }; > + > > This should do the trick but I have still the same problem on memory > type. Any idea? For starters your start address and size are not page-size (multiple of 4k aligned), you need to fix that. After that double check in the memory map reported by the kernel during boot that your reservation actually works. Regards, Hans > > > + linux,cma { > + compatible = "shared-dma-pool"; > + reusable; > + size = <0x1000000>; > + linux,cma-default; > + }; > + }; > + > + chosen { > + #address-cells = <1>; > + #size-cells = <1>; > + ranges; > + > + stdout-path = &uart1; > + framebuffer0: framebuffer@86fd6080 { > + compatible = "simple-framebuffer"; > + reg = <0x86fd6080 (480 * 272 * 4)>; > > Here I try to use the same. I will create in uboot a dynamic way to > track down. I think that > we can even add to the simple buffer a way to get hand of reserved > region automatically > > Michael > > + width = <480>; > + height = <272>; > + stride = <(480 * 4)>; > + format = "a8r8g8b8"; > + clocks = <&clks IMX6UL_CLK_LCDIF_PIX>, > + <&clks IMX6UL_CLK_LCDIF_APB>, > + <&clks IMX6UL_CLK_DUMMY>, > + <&clks IMX6UL_CLK_GPIO3>, > + <&clks IMX6UL_CLK_GPIO4>; > + nshut-supply = <®_lcd_nshut>; > + nreset-supply = <®_lcd_nreset>; > + display = <&lcdif>; > + status = "okay"; > + }; > > > >>> >> >> Thank you very much for this lesson ;). I will try to document better >> after my tour ;) >> >> Michael >> >>> Regards, >>> >>> Hans >> >> >> >> -- >> | Michael Nazzareno Trimarchi Amarula Solutions BV | >> | COO - Founder Cruquiuskade 47 | >> | +31(0)851119172 Amsterdam 1018 AM NL | >> | [`as] http://www.amarulasolutions.com | > > >