From: Ivan Bornyakov <i.bornyakov@metrotek.ru>
To: Xu Yilun <yilun.xu@intel.com>
Cc: mdf@kernel.org, hao.wu@intel.com, trix@redhat.com,
conor.dooley@microchip.com, robh+dt@kernel.org,
krzysztof.kozlowski+dt@linaro.org, system@metrotek.ru,
linux-kernel@vger.kernel.org, linux-fpga@vger.kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH v9 1/3] fpga: fpga-mgr: support bitstream offset in image buffer
Date: Sat, 9 Apr 2022 15:38:51 +0300 [thread overview]
Message-ID: <20220409123851.tcjflctnuurag2yb@x260> (raw)
In-Reply-To: <20220409050423.GA265355@yilunxu-OptiPlex-7050>
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
would be to make initial_header_size to be mandatory for usage of
parse_header().
> >
> > ... 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.
next prev parent reply other threads:[~2022-04-09 13:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-07 13:36 [PATCH v9 0/3] Microchip Polarfire FPGA manager Ivan Bornyakov
2022-04-07 13:36 ` [PATCH v9 1/3] fpga: fpga-mgr: support bitstream offset in image buffer Ivan Bornyakov
2022-04-09 5:04 ` Xu Yilun
2022-04-09 12:38 ` Ivan Bornyakov [this message]
2022-04-11 1:36 ` Xu Yilun
2022-04-07 13:36 ` [PATCH v9 2/3] fpga: microchip-spi: add Microchip MPF FPGA manager Ivan Bornyakov
2022-04-07 13:36 ` [PATCH v9 3/3] dt-bindings: fpga: add binding doc for microchip-spi fpga mgr Ivan Bornyakov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220409123851.tcjflctnuurag2yb@x260 \
--to=i.bornyakov@metrotek.ru \
--cc=conor.dooley@microchip.com \
--cc=devicetree@vger.kernel.org \
--cc=hao.wu@intel.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-fpga@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mdf@kernel.org \
--cc=robh+dt@kernel.org \
--cc=system@metrotek.ru \
--cc=trix@redhat.com \
--cc=yilun.xu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).