From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Yidong Zhang <yidong.zhang@amd.com>,
linux-kernel@vger.kernel.org, linux-fpga@vger.kernel.org,
mdf@kernel.org, hao.wu@intel.com, yilun.xu@intel.com
Cc: lizhi.hou@amd.com, Nishad Saraf <nishads@amd.com>,
Prapul Krishnamurthy <prapulk@amd.com>
Subject: Re: [PATCH V2 3/4] drivers/fpga/amd: Add remote queue
Date: Sun, 26 Jan 2025 11:24:58 +0100 [thread overview]
Message-ID: <3d805a67-aae1-4342-90fd-c7d0dc100b3a@wanadoo.fr> (raw)
In-Reply-To: <20241210183734.30803-4-yidong.zhang@amd.com>
Le 10/12/2024 à 19:37, Yidong Zhang a écrit :
> The remote queue is a hardware queue based ring buffer service between mgmt
> PF and PCIe hardware firmware for programming FPGA Program Logic, loading
> versal firmware and checking card healthy status.
...
> +static int rm_queue_submit_cmd(struct rm_cmd *cmd)
> +{
> + struct versal_pci_device *vdev = cmd->rdev->vdev;
> + struct rm_device *rdev = cmd->rdev;
> + u32 offset;
> + int ret;
> +
> + mutex_lock(&rdev->queue);
Using guardmutex) would slightly simplify the code.
> +
> + offset = rm_queue_get_sq_slot_offset(rdev);
> + if (!offset) {
> + vdev_err(vdev, "No SQ slot available");
> + ret = -ENOSPC;
> + goto exit;
> + }
> +
> + rm_queue_bulk_write(rdev, offset, (u32 *)&cmd->sq_msg,
> + sizeof(cmd->sq_msg));
> +
> + ret = rm_queue_set_pidx(rdev, RM_QUEUE_SQ, ++rdev->sq.pidx);
> + if (ret) {
> + vdev_err(vdev, "Failed to update PIDX, ret %d", ret);
> + goto exit;
> + }
> +
> + list_add_tail(&cmd->list, &rdev->submitted_cmds);
> +exit:
> + mutex_unlock(&rdev->queue);
> + return ret;
> +}
> +
> +void rm_queue_withdraw_cmd(struct rm_cmd *cmd)
> +{
> + mutex_lock(&cmd->rdev->queue);
Using guardmutex) would slightly simplify the code.
> + list_del(&cmd->list);
> + mutex_unlock(&cmd->rdev->queue);
> +}
...
> +static void rm_check_msg(struct work_struct *w)
> +{
> + struct rm_device *rdev = to_rdev_msg_monitor(w);
> + int ret;
> +
> + mutex_lock(&rdev->queue);
Using guardmutex) would slightly simplify the code.
> +
> + rdev->sq.cidx = rm_queue_get_cidx(rdev, RM_QUEUE_SQ);
> + rdev->cq.pidx = rm_queue_get_pidx(rdev, RM_QUEUE_CQ);
> +
> + while (rdev->cq.cidx < rdev->cq.pidx) {
> + ret = rm_process_msg(rdev);
> + if (ret)
> + break;
> +
> + rdev->cq.cidx++;
> +
> + rm_queue_set_cidx(rdev, RM_QUEUE_CQ, rdev->cq.cidx);
> + }
> +
> + mutex_unlock(&rdev->queue);
> +}
...
> +int rm_queue_init(struct rm_device *rdev)
> +{
> + struct versal_pci_device *vdev = rdev->vdev;
> + struct rm_queue_header header = {0};
> + int ret;
> +
> + INIT_LIST_HEAD(&rdev->submitted_cmds);
> + mutex_init(&rdev->queue);
devm_mutex_init()?
In order to slightly simplify the code.
> +
> + rm_queue_bulk_read(rdev, RM_HDR_OFF, (u32 *)&header, sizeof(header));
> +
> + if (header.magic != RM_QUEUE_HDR_MAGIC_NUM) {
> + vdev_err(vdev, "Invalid RM queue header");
> + ret = -ENODEV;
> + goto error;
> + }
...
CJ
next prev parent reply other threads:[~2025-01-26 10:34 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-10 18:37 [PATCH V2 0/4] Add versal-pci driver Yidong Zhang
2024-12-10 18:37 ` [PATCH V2 1/4] drivers/fpga/amd: Add new driver amd versal-pci Yidong Zhang
2025-01-26 9:24 ` Xu Yilun
2025-01-26 19:50 ` Yidong Zhang
2025-01-26 10:12 ` Christophe JAILLET
2025-01-26 19:56 ` Yidong Zhang
2025-01-26 10:16 ` Christophe JAILLET
2025-01-26 10:32 ` Xu Yilun
2025-01-26 19:46 ` Yidong Zhang
2025-02-06 4:15 ` Xu Yilun
2025-02-06 4:31 ` Yidong Zhang
2025-02-07 2:19 ` Xu Yilun
2025-02-07 3:16 ` Yidong Zhang
2025-02-07 4:40 ` Xu Yilun
2025-02-10 11:33 ` Yidong Zhang
2025-02-11 9:09 ` Xu Yilun
2025-02-11 11:31 ` Yidong Zhang
2025-03-01 8:20 ` Xu Yilun
2025-03-01 19:03 ` Yidong Zhang
2025-03-03 7:57 ` Xu Yilun
2025-03-03 17:00 ` Yidong Zhang
2024-12-10 18:37 ` [PATCH V2 2/4] drivers/fpga/amd: Add communication channel Yidong Zhang
2025-01-26 10:19 ` Christophe JAILLET
2025-01-26 19:57 ` Yidong Zhang
2024-12-10 18:37 ` [PATCH V2 3/4] drivers/fpga/amd: Add remote queue Yidong Zhang
2025-01-26 10:24 ` Christophe JAILLET [this message]
2024-12-10 18:37 ` [PATCH V2 4/4] drivers/fpga/amd: Add load xclbin and load firmware Yidong Zhang
2025-01-26 9:27 ` [PATCH V2 0/4] Add versal-pci driver Xu Yilun
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=3d805a67-aae1-4342-90fd-c7d0dc100b3a@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=hao.wu@intel.com \
--cc=linux-fpga@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizhi.hou@amd.com \
--cc=mdf@kernel.org \
--cc=nishads@amd.com \
--cc=prapulk@amd.com \
--cc=yidong.zhang@amd.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.