info->header_size always 0, breaks fpga-zynq.c driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Everyone,

Our Xilinx FPGA driver (zynq-fpga.c) is no longer compatible with
fpga-mgr.c and barfs with:

      "Invalid bitstream, could not find a sync word. Bitstream must
be a byte swapped .bin file"

It seems to come from here (inside fpga_mgr_write_init_buf()):
      size_t header_size = info->header_size;

It uses header_size to decide whether or not to call
fpga_mgr_write_init() with a NULL buffer and a 0 size, or use a real
buffer and real size, like this:

    if (header_size > count)
        ret = -EINVAL;
    else if (!header_size)
        ret = fpga_mgr_write_init(mgr, info, NULL, 0);
    else
        ret = fpga_mgr_write_init(mgr, info, buf, count);

The trouble is, that if I follow my code path, info->header_size isn't
set by anyone.  So it's **ALWAYS** zero.  But the value **should** be
128:

    static const struct fpga_manager_ops zynq_fpga_ops = {
         .initial_header_size = 128,
        ...
    };

The issue seems to have been introduced as part of commit 3cc624beba
which I have linked to here:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/fpga/fpga-mgr.c?id=3cc624beba6310a8a534fb00841f22445a200d54


What I find really interesting is that the original mailing list patch
submission didn't have this bug, and would have worked for us:

    + if (info->header_size)
        + header_size = info->header_size;
    + else
        + header_size = mgr->mops->initial_header_size;

Could this be a viable way to ensure that the FPGA manager driver is
compatible with the zynq-fpga.c driver again?


- DG




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux