From: Jason Gunthorpe <jgg@nvidia.com>
To: Shannon Nelson <shannon.nelson@amd.com>
Cc: andrew.gospodarek@broadcom.com, aron.silverton@oracle.com,
dan.j.williams@intel.com, daniel.vetter@ffwll.ch,
dave.jiang@intel.com, dsahern@kernel.org,
gregkh@linuxfoundation.org, hch@infradead.org,
itayavr@nvidia.com, jiri@nvidia.com, Jonathan.Cameron@huawei.com,
kuba@kernel.org, lbloch@nvidia.com, leonro@nvidia.com,
linux-cxl@vger.kernel.org, linux-rdma@vger.kernel.org,
netdev@vger.kernel.org, saeedm@nvidia.com, brett.creeley@amd.com
Subject: Re: [PATCH v2 5/6] pds_fwctl: add rpc and query support
Date: Tue, 4 Mar 2025 15:52:33 -0400 [thread overview]
Message-ID: <20250304195233.GU133783@nvidia.com> (raw)
In-Reply-To: <20250301013554.49511-6-shannon.nelson@amd.com>
On Fri, Feb 28, 2025 at 05:35:53PM -0800, Shannon Nelson wrote:
> + /* reject unsupported and/or out of scope commands */
> + op_entry = (struct pds_fwctl_query_data_operation *)ep_info->operations->entries;
> + for (i = 0; i < ep_info->operations->num_entries; i++) {
> + if (PDS_FWCTL_RPC_OPCODE_CMP(rpc->in.op, op_entry[i].id)) {
> + if (scope < op_entry[i].scope)
> + return -EPERM;
> + return 0;
Oh I see, you are doing the scope like CXL with a "command intent's
report". That is a good idea.
> + if (rpc->in.len > 0) {
> + in_payload = kzalloc(rpc->in.len, GFP_KERNEL);
> + if (!in_payload) {
> + dev_err(dev, "Failed to allocate in_payload\n");
> + out = ERR_PTR(-ENOMEM);
> + goto done;
> + }
> +
> + if (copy_from_user(in_payload, u64_to_user_ptr(rpc->in.payload),
> + rpc->in.len)) {
> + dev_err(dev, "Failed to copy in_payload from user\n");
> + out = ERR_PTR(-EFAULT);
> + goto done;
> + }
This wasn't really the intention to have a payload pointer inside the
existing payload pointer, is it the same issue as CXL where you wanted
a header?
I see your FW API also can't take a scatterlist, so it makes sense it
needs to be linearized like this.
I don't think it makes a difference to have the indirection or not, it
would be a bunch of stuff to keep the header seperate from the payload
and then still also end up with memcpy in the driver, so leave it.
> +#define PDS_FWCTL_RPC_OPCODE_CMD_SHIFT 0
> +#define PDS_FWCTL_RPC_OPCODE_CMD_MASK GENMASK(15, PDS_FWCTL_RPC_OPCODE_CMD_SHIFT)
> +#define PDS_FWCTL_RPC_OPCODE_VER_SHIFT 16
> +#define PDS_FWCTL_RPC_OPCODE_VER_MASK GENMASK(23, PDS_FWCTL_RPC_OPCODE_VER_SHIFT)
> +
> +#define PDS_FWCTL_RPC_OPCODE_GET_CMD(op) \
> + (((op) & PDS_FWCTL_RPC_OPCODE_CMD_MASK) >> PDS_FWCTL_RPC_OPCODE_CMD_SHIFT)
Isn't that FIELD_GET?
> +struct fwctl_rpc_pds {
> + struct {
> + __u32 op;
> + __u32 ep;
> + __u32 rsvd;
> + __u32 len;
> + __u64 payload;
> + } in;
> + struct {
> + __u32 retval;
> + __u32 rsvd[2];
> + __u32 len;
> + __u64 payload;
> + } out;
> +};
Use __aligned_u64 in the uapi headers
Jason
next prev parent reply other threads:[~2025-03-04 19:52 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-01 1:35 [PATCH v2 0/6] pds_fwctl: fwctl for AMD/Pensando core devices Shannon Nelson
2025-03-01 1:35 ` [PATCH v2 1/6] pds_core: make pdsc_auxbus_dev_del() void Shannon Nelson
2025-03-04 1:57 ` Jonathan Cameron
2025-03-04 4:09 ` Kalesh Anakkur Purayil
2025-03-01 1:35 ` [PATCH v2 2/6] pds_core: specify auxiliary_device to be created Shannon Nelson
2025-03-04 7:44 ` Jonathan Cameron
2025-03-01 1:35 ` [PATCH v2 3/6] pds_core: add new fwctl auxiliary_device Shannon Nelson
2025-03-04 8:03 ` Jonathan Cameron
2025-03-06 1:48 ` Nelson, Shannon
2025-03-01 1:35 ` [PATCH v2 4/6] pds_fwctl: initial driver framework Shannon Nelson
2025-03-03 16:45 ` Dave Jiang
2025-03-03 17:29 ` Jason Gunthorpe
2025-03-03 17:35 ` Nelson, Shannon
2025-03-04 1:50 ` Jonathan Cameron
2025-03-03 17:31 ` Nelson, Shannon
2025-03-03 17:46 ` Dave Jiang
2025-03-04 8:30 ` Jonathan Cameron
2025-03-06 1:52 ` Nelson, Shannon
2025-03-04 19:39 ` Jason Gunthorpe
2025-03-06 2:05 ` Nelson, Shannon
2025-03-01 1:35 ` [PATCH v2 5/6] pds_fwctl: add rpc and query support Shannon Nelson
2025-03-04 9:08 ` Jonathan Cameron
2025-03-04 17:24 ` Jason Gunthorpe
2025-03-06 2:02 ` Nelson, Shannon
2025-03-06 1:55 ` Nelson, Shannon
2025-03-04 19:52 ` Jason Gunthorpe [this message]
2025-03-06 2:07 ` Nelson, Shannon
2025-03-01 1:35 ` [PATCH v2 6/6] pds_fwctl: add Documentation entries Shannon Nelson
2025-03-04 9:12 ` Jonathan Cameron
2025-03-06 1:56 ` Nelson, Shannon
2025-03-02 12:34 ` [PATCH v2 0/6] pds_fwctl: fwctl for AMD/Pensando core devices Leon Romanovsky
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=20250304195233.GU133783@nvidia.com \
--to=jgg@nvidia.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=andrew.gospodarek@broadcom.com \
--cc=aron.silverton@oracle.com \
--cc=brett.creeley@amd.com \
--cc=dan.j.williams@intel.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dave.jiang@intel.com \
--cc=dsahern@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=hch@infradead.org \
--cc=itayavr@nvidia.com \
--cc=jiri@nvidia.com \
--cc=kuba@kernel.org \
--cc=lbloch@nvidia.com \
--cc=leonro@nvidia.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=saeedm@nvidia.com \
--cc=shannon.nelson@amd.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.