[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220411013650.GA271264@yilunxu-OptiPlex-7050>
Date: Mon, 11 Apr 2022 09:36:50 +0800
From: Xu Yilun <yilun.xu@...el.com>
To: Ivan Bornyakov <i.bornyakov@...rotek.ru>
Cc: mdf@...nel.org, hao.wu@...el.com, trix@...hat.com,
conor.dooley@...rochip.com, robh+dt@...nel.org,
krzysztof.kozlowski+dt@...aro.org, system@...rotek.ru,
linux-kernel@...r.kernel.org, linux-fpga@...r.kernel.org,
devicetree@...r.kernel.org
Subject: Re: [PATCH v9 1/3] fpga: fpga-mgr: support bitstream offset in image
buffer
On Sat, Apr 09, 2022 at 03:38:51PM +0300, Ivan Bornyakov wrote:
> On Sat, Apr 09, 2022 at 01:04:23PM +0800, Xu Yilun wrote:
> > On Thu, Apr 07, 2022 at 04:36:56PM +0300, Ivan Bornyakov wrote:
> > >
> > > ... snip ...
> > >
> > > @@ -148,12 +149,10 @@ static int fpga_mgr_write_init_buf(struct fpga_manager *mgr,
> > > int ret;
> > >
> > > mgr->state = FPGA_MGR_STATE_WRITE_INIT;
> > > - if (!mgr->mops->initial_header_size)
> > > - ret = fpga_mgr_write_init(mgr, info, NULL, 0);
> > > - else
> > > - ret = fpga_mgr_write_init(
> > > - mgr, info, buf, min(mgr->mops->initial_header_size, count));
> > > + if (mgr->mops->initial_header_size)
> > > + count = min(mgr->mops->initial_header_size, count);
> > >
> > > + ret = fpga_mgr_write_init(mgr, info, buf, count);
> >
> > Here we pass the whole buffer for write_init(). Maybe it works for mapped buf,
> > but still doesn't work for sg buf.
> >
> > It is also inefficient if we change to map and copy all sg buffers just for
> > write_init().
> >
> > We could discuss on the solution.
> >
> > My quick mind is we introduce an optional fpga_manager_ops.parse_header()
> > callback, and a header_size (dynamic header size) field in
> > fpga_image_info. FPGA core starts with mapping a buf of initial_header_size
> > for parse_header(), let the drivers decide the dynamic header_size.
> >
> > The parse_header() could be called several times with updated dynamic
> > header_size, if drivers doesn't get enough buffer for final decision and
> > return -EAGAIN.
> >
> > Then write_init() be called with the final dynamic header size.
> >
> > For mapped buffer, just passing the whole buffer for write_init() is
> > fine.
> >
>
> Ok, that's sounds reasonable. Should we pass PAGE_SIZE of a buffer to
> the parse_header() if initial_header_size is not set? The other option
I think it is not necessary, no initial_header_size means no need to
parse image header.
> would be to make initial_header_size to be mandatory for usage of
> parse_header().
That's a good idea. If parse_header() is provided, initial_header_size
is mandatory.
Thanks,
Yilun
>
> > >
> > > ... snip ...
> > >
> > > @@ -98,6 +101,8 @@ struct fpga_image_info {
> > > struct sg_table *sgt;
> > > const char *buf;
> > > size_t count;
> > > + size_t bitstream_start;
> >
> > How about we name it header_size?
> >
> > > + size_t bitstream_size;
> >
> > And how about data_size?
> >
>
> Sure, I don't mind.
Powered by blists - more mailing lists