Received: by 10.223.164.202 with SMTP id h10csp327786wrb; Wed, 8 Nov 2017 17:32:57 -0800 (PST) X-Google-Smtp-Source: ABhQp+R5eztARwM41YPLVCx8Rf9JIChjh7OSL+jH21CKICm0PhO94AFmziY28O1uFec4kE2M6fxm X-Received: by 10.84.151.70 with SMTP id i64mr2160725pli.114.1510191177709; Wed, 08 Nov 2017 17:32:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510191177; cv=none; d=google.com; s=arc-20160816; b=0a82nMu4nLNep3/ViQy9Kr4rJRGN92Vku2aa4cI5pY/9ORg47Y/ea/nsGT8hvn8hLK FH6BooUQUvmvfYObg4yZ5xOT6n+kU5pMjRPo+DHRX8XDpiY2EfoVeEPtJPlUJsqT7IWD Hv5/NN3Pn0KQBeWTx+iMGP5uydPvFWXKlPu62yg6HzXDsQX2aF19QZ/mZ1mOikjbYYxq UYzN89ldsfWuG2BWKQl1U9fVDvUK1K9KRmZwBqT8mjKgB/onkLOFnaFWzzyirmDP2WLc iMKOkEs5UGdUCM4D7UPaSUPmGH8LKbmX76tpbEytydvSG/xn7qoFPAqB85RbyE92pjiK KSGA== 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:mime-version :references:in-reply-to:organization:message-id:date:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=ZfXkUca7PidMh3tooYa9zC06AGNJUgeJDUgesp1EQDY=; b=Uq5fEIin6ot6l+1DvUxKkg27+NJ4MDwKJ9csEcTXyZLqE4WSW41t+/xNGHaSUcQm5h SiqXAkvvrIu/Mbubf7xR2Id6PxT6jS16sMRLhgA0VKtoG3psuYrXDRaTTjfnLS2DKkNE S4AalnN2jaofx99tHkwbZczNPS1uFb1b7RoKREX/WIZejNL1Cm5KwI1OATeQvMCydFrj vegSGb7e82OVKVfu5yDKC+Zjt4s469DkNixe/Qw5Z5f3JbLGSJsF/uu9N7vm7bv/3aed RAehP8Z4p7i5V0dCNeoa+lNja9XwC/WyXrRDmSsK+whVrFpblXl738n2n87CQIq0Ga8x XbvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=jCTkhdhk; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si4940285plz.759.2017.11.08.17.32.45; Wed, 08 Nov 2017 17:32:57 -0800 (PST) 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; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=jCTkhdhk; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753013AbdKIBcE (ORCPT + 82 others); Wed, 8 Nov 2017 20:32:04 -0500 Received: from galahad.ideasonboard.com ([185.26.127.97]:49939 "EHLO galahad.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752555AbdKIBcC (ORCPT ); Wed, 8 Nov 2017 20:32:02 -0500 Received: from avalon.localnet (unknown [182.232.171.229]) by galahad.ideasonboard.com (Postfix) with ESMTPSA id 727AF20064; Thu, 9 Nov 2017 02:30:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1510191052; bh=lPoY7XehyWLJkSoHg1X4o5bStzEYInISVnqoHmY7KuE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jCTkhdhklFSP0FbOqUuVEntU4RuCQUfNLvvSVw9+iiGEB83j73vW+BAW4Es7UrEpM KX3wkmWjypJPIIpNVmGYx2j+n6ypbgNaSbhphgV8e2WzMSG/w/ApRREH1DvoC5FITc K99zxrv1HoKs93AeSKviTScbubVqPz4yN1j8EsW0= From: Laurent Pinchart To: Geert Uytterhoeven Cc: Jacopo Mondi , Yoshinori Sato , Rich Felker , Linux-sh list , Linux-Renesas , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] sh: migor: Reserve memory block for CEU Date: Thu, 09 Nov 2017 03:32:07 +0200 Message-ID: <1691054.qjv9XWrNm9@avalon> Organization: Ideas on Board Oy In-Reply-To: References: <1510164346-21134-1-git-send-email-jacopo+renesas@jmondi.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Geert, On Wednesday, 8 November 2017 20:31:22 EET Geert Uytterhoeven wrote: > On Wed, Nov 8, 2017 at 7:05 PM, Jacopo Mondi wrote: > > A memory region for CEU video buffer has to be reserved during machine > > initialization. > > > > Originally, it was allocated through DMA API helpers and stored in the > > second IORESOURCE_MEM entry, to be later remapped by the CEU driver with > > a call to 'dma_declare_coherent_memory()' > > > > As Linux does not allow anymore to remap system RAM regions with > > 'memremap' function, sh_mobile_ceu driver fails when trying to remap the > > memory area: > > > > WARN_ONCE(1, "memremap attempted on ram %pa size: %#lx\n", > > > > &offset, (unsigned long) size) > > > > from 'memremap()' function in kernel/memremap.c > > > > To avoid hitting that WARN_ONCE() and have memory successfully remapped, > > reserve a region using '.mv_mem_reserve' member of SH's 'struct > > sh_machine_vector' to make sure memory is reserved early enough, and > > removed from the available system RAM. > > > > This is similar to what happens on ARM architecture with > > 'arm_memblock_steal()' function. > > > > Suggested-by: Laurent Pinchart > > Signed-off-by: Jacopo Mondi > > I assume this failure isnot limited to CEU on Migo-R, but applies to > the other 24 callers of platform_resource_setup_memory(), too? > > Can platform_resource_setup_memory() be fixed instead, or is that difficult > due to the need to reserve the memory very early in the boot process? That's exactly the problem, memory needs to be reserved early at boot, earlier than the current call sites of platform_resource_setup_memory(). The real fix in my opinion would be to use CMA, but implementing CMA for SH is out of scope of Jacopo's work on the CEU driver. And that would still require patching all the 24 callers of platform_resource_setup_memory() anyway. -- Regards, Laurent Pinchart From 1583523829637559736@xxx Wed Nov 08 18:33:25 +0000 2017 X-GM-THRID: 1583522157640962016 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread