Received: by 10.192.165.148 with SMTP id m20csp516192imm; Fri, 4 May 2018 01:41:26 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq8Ex5tGWtpfOD71VHrIsy0XawHfljKgU3lAYCA33pCcSDW5ktVXSPaxPSlVbUBi2shAWrt X-Received: by 2002:a17:902:7c18:: with SMTP id x24-v6mr11977557pll.173.1525423285995; Fri, 04 May 2018 01:41:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525423285; cv=none; d=google.com; s=arc-20160816; b=fI6JVnI6oISfAM28/hPWz6Ylw5QxeybvrUW80t/bhfyup5Z4JZv8OMyeA8Hs21hP0a J6GnYl79mh+BASUpwAxDIRqIShgRxhOYMN13+PpHaSbb5fo62ua/cxDihSpoju0vInfD ijwkfBEmY/rEFxaLZ8lJFD3sbkwyfuWtbn3murOfD5VLsj4DPLVS9pNlv50n9BhMekfJ 6wBojnvBhm4wJ1+adds/MZKpAaIZ6JJ2n7DpCNhNv6niubQS29d8XWhZAy9FzHeetq8u L5awCuP2YFzeRhsFKlDPONUfOCDR7YzRotOtSXtLAj79DmjfjNh57XYq59Y70l+atvuk 3tOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=YKfoDMsIfpzpbNwJHAmDlEjYDQXlsbWvu/uu8DW3eSk=; b=Ga46kGDCa85lywuZqQhkJL1jdgZOP85iqdw1NCDa7mpPqOY3QVAtPYqXilqFhqsRFb UsY/a2OHMWtbK9zvPJ8fPJnjfqHN3cMRZLzrgBAK01pNcc636GPXjwBsmDoHc12IocgL pts+xSjsM/wvREAIr9kVsU3NBftQZqT8tEloQF+BR+Dr0Sfp6M+FE9VcuLN/o8Ifnxfh B0HgbUSsd3ZFJ9xVny/ckSZYMSYgZVsAoxoOo0o8sHYU5D6dFpy5I7EfNjLcbJDDuFAM M/07/6XTprhvoqne/dAD+tXFyENIbDjfYD8eyM3GYhpuG9z5BStny27OcqJ0ASzceSoN c/zw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v29-v6si13525536pgo.483.2018.05.04.01.41.11; Fri, 04 May 2018 01:41:25 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751943AbeEDIk3 (ORCPT + 99 others); Fri, 4 May 2018 04:40:29 -0400 Received: from mail.bootlin.com ([62.4.15.54]:52620 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751551AbeEDIk1 (ORCPT ); Fri, 4 May 2018 04:40:27 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 299DB20A0D; Fri, 4 May 2018 10:40:25 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.bootlin.com (Postfix) with ESMTPSA id 58FB2207DA; Fri, 4 May 2018 10:40:08 +0200 (CEST) Date: Fri, 4 May 2018 10:40:08 +0200 From: Maxime Ripard To: Paul Kocialkowski Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, Mauro Carvalho Chehab , Rob Herring , Mark Rutland , Chen-Yu Tsai , Pawel Osciak , Marek Szyprowski , Kyungmin Park , Hans Verkuil , Sakari Ailus , Philipp Zabel , Arnd Bergmann , Alexandre Courbot , Tomasz Figa Subject: Re: [PATCH v2 09/10] ARM: dts: sun7i-a20: Add Video Engine and reserved memory nodes Message-ID: <20180504084008.h6p4brari3xrbv6l@flea> References: <20180419154124.17512-1-paul.kocialkowski@bootlin.com> <20180419154536.17846-5-paul.kocialkowski@bootlin.com> <20180420073908.nkcbsdxibnzkqski@flea> <82057e2f734137a3902d9313c228b01ceb345ee7.camel@bootlin.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="54sv25q3qjyzu2lb" Content-Disposition: inline In-Reply-To: <82057e2f734137a3902d9313c228b01ceb345ee7.camel@bootlin.com> User-Agent: NeoMutt/20180323 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --54sv25q3qjyzu2lb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, May 04, 2018 at 09:49:16AM +0200, Paul Kocialkowski wrote: > > > + reserved-memory { > > > + #address-cells =3D <1>; > > > + #size-cells =3D <1>; > > > + ranges; > > > + > > > + /* Address must be kept in the lower 256 MiBs of > > > DRAM for VE. */ > > > + ve_memory: cma@4a000000 { > > > + compatible =3D "shared-dma-pool"; > > > + reg =3D <0x4a000000 0x6000000>; > > > + no-map; > >=20 > > I'm not sure why no-map is needed. >=20 > In fact, having no-map here would lead to reserving the area as cache- > coherent instead of contiguous and thus prevented dmabuf support. > Replacing it by "resuable" allows proper CMA reservation. >=20 > > And I guess we could use alloc-ranges to make sure the region is in > > the proper memory range, instead of hardcoding it. >=20 > As far as I could understand from the documentation, "alloc-ranges" is > used for dynamic allocation while only "reg" is used for static > allocation. We are currently going with static allocation and thus > reserve the whole 96 MiB. Is using dynamic allocation instead desirable > here? I guess we could turn the question backward. Why do we need a static allocation? This isn't a buffer that is always allocated on the same area, but rather that we have a range available. So our constraint is on the range, nothing else. > > > + reg =3D <0x01c0e000 0x1000>; > > > + memory-region =3D <&ve_memory>; > >=20 > > Since you made the CMA region the default one, you don't need to tie > > it to that device in particular (and you can drop it being mandatory > > from your binding as well). >=20 > What if another driver (or the system) claims memory from that zone and > that the reserved memory ends up not being available for the VPU > anymore? >=20 > Acccording to the reserved-memory documentation, the reusable property > (that we need for dmabuf) puts a limitation that the device driver > owning the region must be able to reclaim it back. >=20 > How does that work out if the CMA region is not tied to a driver in > particular? I'm not sure to get what you're saying. You have the property linux,cma-default in your reserved region, so the behaviour you described is what you explicitly asked for. >=20 > > > + > > > + clocks =3D <&ccu CLK_AHB_VE>, <&ccu CLK_VE>, > > > + <&ccu CLK_DRAM_VE>; > > > + clock-names =3D "ahb", "mod", "ram"; > > > + > > > + assigned-clocks =3D <&ccu CLK_VE>; > > > + assigned-clock-rates =3D <320000000>; > >=20 > > This should be set from within the driver. If it's something that you > > absolutely needed for the device to operate, you have no guarantee > > that the clock rate won't change at any point in time after the device > > probe, so that's not a proper solution. > >=20 > > And if it's not needed and can be adjusted depending on the > > framerate/codec/resolution, then it shouldn't be in the DT either. >=20 > Yes, that makes sense. >=20 > > Don't you also need to map the SRAM on the A20? >=20 > That's a good point, there is currently no syscon handle for A20 (and > also A13). Maybe SRAM is muxed to the VE by default so it "just works"?= =20 >=20 > I'll investigate on this side, also keeping in mind that the actual > solution is to use the SRAM controller driver (but that won't make it to > v3). The SRAM driver is available on the A20, so you should really use that instead of a syscon. Maxime --=20 Maxime Ripard, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com --54sv25q3qjyzu2lb Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE0VqZU19dR2zEVaqr0rTAlCFNr3QFAlrsHGgACgkQ0rTAlCFN r3SWDg/+Im6ItEaIACJLbnNoFjw+1xFOaFJk+2PrTIHXnFJl6zxS1kIlUjDt7vt+ gQucM8JCg5gB4baUxuAmTVHOHH0htJiqnFjChqD691hqeChbW/qMZvSBwvdNgQNL /mtSGR1Ozzq6yYyk0T7Qqfzpjce4HdDc1/u/QY0vPwYRqMAKPGL1QJZ68A2wGRG7 LhJSFiR6A2Mw6FlnCrG0bDQ2oJBGl2hDeTrBUG9k8Qn9uqewk5NrNJHjEUtYDi06 8XZ1JZ6tn2urM53v51dfKZ93lMDbv0+jKn6p7UjrqMTP8uQNgf7vD6Wjw2Cqs1is YUTLrrOpFfJ8txMbpwHgbBTVMmzT1MyUy32mmJ4Feng9HClpkVhSTqjGp41urThk cmC1f6Kk3JQVOdN6j8WWQ4JA1Hqyq3uAJao7ak7Th94USG/cTIGsLnoXHyOxVI+k Pa9lETQdU8N88vo6gJrDXiOECz87yhZu4bREgeRDuQ9OjhEPnCGAJEgtXY36i83+ MErVMvetAytzx0tnQggn6NFb0EniAnM6+LD1JqjQZ7waqF8aBbkXNB+kHccyzywC h/9X3+srJz7tx5wTfGfOX2tURRpVHqB4hxjIIlqyodLGuasxmSj5l9SgzunXFcl6 t44s64B6AEo0gJtJ6YtuRDx3v/c6GvkGToZjJMGdCXLlYzsibXs= =XMKw -----END PGP SIGNATURE----- --54sv25q3qjyzu2lb--