Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753318AbbBUHF0 (ORCPT ); Sat, 21 Feb 2015 02:05:26 -0500 Received: from mail-bn1on0069.outbound.protection.outlook.com ([157.56.110.69]:37088 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751946AbbBUHFY (ORCPT ); Sat, 21 Feb 2015 02:05:24 -0500 Date: Sat, 21 Feb 2015 00:31:36 -0600 From: atull X-X-Sender: atull@shineypoop To: Jason Gunthorpe , Ming Lei , Michal Simek CC: Pavel Machek , Rob Landley , "Pantelis Antoniou" , One Thousand Gnomes , Greg Kroah-Hartman , , Michal Simek , Randy Dunlap , "Linux Kernel Mailing List" , , , Grant Likely , , , Mark Brown , , , "Steffen Trumtrar" , , , , Felipe Balbi , , , , , , Andrew Morton , Linus Walleij , , , , , , Alan Tull , , Subject: Re: [PATCH v8 2/4] fpga manager: add sysfs interface document In-Reply-To: <0440c296085f48918e07134b07690a08@BY2FFO11FD028.protection.gbl> Message-ID: References: <20150113222450.GA17475@obsidianresearch.com> <20150115184726.GA23247@obsidianresearch.com> <20150115204502.591bca1d@lxorguk.ukuu.org.uk> <20150121160151.453ba403@lxorguk.ukuu.org.uk> <20150121202700.GB4942@obsidianresearch.com> <20150215224006.GA5626@amd> <54E37569.80508@landley.net> <20150217191727.GA18429@amd> <0440c296085f48918e07134b07690a08@BY2FFO11FD028.protection.gbl> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Originating-IP: [24.206.110.125] X-ClientProxiedBy: CY1PR00CA0006.namprd00.prod.outlook.com (25.160.142.144) To BN3PR0301MB1236.namprd03.prod.outlook.com (25.161.207.24) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=atull@opensource.altera.com; X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:BN3PR0301MB1236; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005003);SRVR:BN3PR0301MB1236; X-Forefront-PRVS: 049486C505 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6009001)(479174004)(377454003)(51704005)(189002)(24454002)(377424004)(199003)(46102003)(93886004)(83506001)(86152002)(42186005)(66066001)(122386002)(68736005)(87976001)(40100003)(50466002)(54356999)(76176999)(106356001)(50986999)(105586002)(46406003)(64706001)(97736003)(33716001)(101416001)(92566002)(2950100001)(47776003)(86362001)(77156002)(62966003)(23726002)(7059030);DIR:OUT;SFP:1101;SCL:1;SRVR:BN3PR0301MB1236;H:shineypoop.local;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:0;LANG:en; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:;SRVR:BN3PR0301MB1236; X-OriginatorOrg: opensource.altera.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2015 06:31:57.5892 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0301MB1236 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2871 Lines: 70 On Thu, 19 Feb 2015, Michal Simek wrote: > On 02/17/2015 08:17 PM, Pavel Machek wrote: > > On Tue 2015-02-17 11:07:53, Rob Landley wrote: > >> > >> > >> On 02/15/2015 04:40 PM, Pavel Machek wrote: > >>> On Wed 2015-01-21 13:27:00, Jason Gunthorpe wrote: > >>>> On Wed, Jan 21, 2015 at 06:33:12PM +0200, Pantelis Antoniou wrote: > >>>> My point is that the current firmware layer is overly cautious and > >>>> FPGAs are very big. My current project on small Xilinx device has a > >>>> 10MB programming file. The biggest Xilinx device today has a max > >>>> bitfile size around 122MB. > >>>> > >>>> So keeping that much memory pinned in the kernel when I can prove it > >>>> is uncessary for my system (either because there is no suspend/resume > >>>> possibility, or because I know the CPU can always access the > >>>> filesytem) is very undesirable. > >>> > >>> Well, your current device aalso has 1GB RAM, no? > >> > >> Unnecessarily pinning 10% of your ram is a good solution? > > > > Never said that. But I'd rather have _some_ API proposed, then try to > > design in everthing including kitchen sink and do nothing. > I propose an extension to the firmware class: int request_firmware_streamed(const struct firmware **firmware_p, const char *name, struct device *device, int (*consumer)(char *buf, size_t size, void *priv)) This is a new function that streams the firmware file in 4k chunks to a callback function. So firmware is not limited to the allocation size of vmalloc. This new function would have the same parameters as request_firmware except adding a pointer to a consumer function. In the case of fpga's, the consumer function is writing the 4k chunks to the fpga. The new function will: * open the file * read 4k * hand that buffer to the consumer * sleep until the consumer returns * give up if consumer has a nonzero exit, continue reading otherwise Admittedly this is really different from the current firmeware class's structures. The real problem this is trying to solve is that bitstreams can be huge, especially as fpga's can be daisychained. And the CPU doing the loading could be embedded (limited resources). IFAIK fpga's don't need to have the whole image in a ram buffer. This gives us the convenience of request_firmware() and gives the kernel an extension of the firmware class that others might useful instead of solving this problem that we keep hovering around for fpga's only. Alan Tull -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/