Re: [PATCH V2 1/4] drivers/fpga/amd: Add new driver amd versal-pci

From: Xu Yilun
Date: Sun Jan 26 2025 - 04:24:49 EST


> +static int versal_pci_program_axlf(struct versal_pci_device *vdev, char *data, size_t size)
> +{
> + const struct axlf *axlf = (struct axlf *)data;
> + struct fpga_image_info *image_info;
> + int ret;
> +
> + image_info = fpga_image_info_alloc(&vdev->pdev->dev);
> + if (!image_info)
> + return -ENOMEM;
> +
> + image_info->count = axlf->header.length;
> + image_info->buf = (char *)axlf;
> +
> + ret = fpga_mgr_load(vdev->fdev->mgr, image_info);

I see, but this is not working like this. fpga_mgr_load() is intended to be
called by fpga_region, any reprogramming API should come from fpga_region,
and fpga_region could provide uAPI for userspace reprogramming.

If your driver act both as a fpga_mgr backend and a fpga_mgr kAPI user,
then you don't have to bother using fpga framework at all.

Thanks,
Yilun

> + if (ret) {
> + vdev_err(vdev, "failed to load xclbin: %d", ret);
> + goto exit;
> + }
> +
> + vdev_info(vdev, "Downloaded axlf %pUb of size %zu Bytes", &axlf->header.uuid, size);
> + uuid_copy(&vdev->xclbin_uuid, &axlf->header.uuid);
> +
> +exit:
> + fpga_image_info_free(image_info);
> +
> + return ret;
> +}