public inbox for linux-cxl@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: linux-cxl@vger.kernel.org, dan.j.williams@intel.com,
	ira.weiny@intel.com, vishal.l.verma@intel.com,
	alison.schofield@intel.com, Jonathan.Cameron@huawei.com,
	dave@stgolabs.net, shiju.jose@huawei.com
Subject: Re: [RFC PATCH 10/13] fwctl/cxl: Add support for fwctl RPC command to enable CXL feature commands
Date: Mon, 22 Jul 2024 15:52:45 -0700	[thread overview]
Message-ID: <c4c158ce-f3a7-411e-8e9c-c6cd92462c19@intel.com> (raw)
In-Reply-To: <20240722152932.GD3371438@nvidia.com>



On 7/22/24 8:29 AM, Jason Gunthorpe wrote:
> On Thu, Jul 18, 2024 at 02:32:28PM -0700, Dave Jiang wrote:
>> diff --git a/include/uapi/fwctl/cxl.h b/include/uapi/fwctl/cxl.h
>> index d3a735f1fe4e..de8949a28473 100644
>> --- a/include/uapi/fwctl/cxl.h
>> +++ b/include/uapi/fwctl/cxl.h
>> @@ -22,4 +22,68 @@ struct fwctl_info_cxl {
>>  	__u32 uctx_caps;
>>  };
>>  
>> +/*
>> + * CXL spec r3.1 Table 8-101 Set Feature Input Payload
>> + */
>> +struct set_feature_input {
>> +	uuid_t uuid;
>> +	__u32 flags;
>> +	__u16 offset;
>> +	__u8 version;
>> +	__u8 reserved[9];
>> +	__u8 data[];
>> +} __packed;
> 
> This struct probably needs to be prefixed with fwcl_, but should it be
> here I wonder or should the CXL defined structs be someplace else?
>

It's the "set feature" mailbox input for user to fill out. So probably should be in uapi. 

 
>> +/**
>> + * struct cxl_send_command - Send a command to a memory device.
>> + * @id: The command to send to the memory device. This must be one of the
>> + *	commands returned by the query command.
>> + * @flags: Flags for the command (input).
>> + * @raw: Special fields for raw commands
>> + * @raw.opcode: Opcode passed to hardware when using the RAW command.
>> + * @raw.rsvd: Must be zero.
>> + * @rsvd: Must be zero.
>> + * @retval: Return value from the memory device (output).
>> + * @in: Parameters associated with input payload.
>> + * @in.size: Size of the payload to provide to the device (input).
>> + * @in.rsvd: Must be zero.
>> + * @in.payload: Pointer to memory for payload input, payload is little endian.
>> + *
>> + * Output payload is defined with 'struct fwctl_rpc' and is the hardware output
>> + */
>> +struct fwctl_cxl_command {
>> +	__u32 id;
>> +	__u32 flags;
>> +	union {
>> +		struct {
>> +			__u16 opcode;
>> +			__u16 rsvd;
>> +		} raw;
>> +		__u32 rsvd;
>> +	};
>> +
>> +	struct {
>> +		__u32 size;
>> +		__u32 rsvd;
>> +		__u64 payload;
>> +	} in;
>> +};
> 
> Why all the structs and unions?

It was copied from 'struct cxl_send_command' for the current ioctl command. Will rework that.

> 
>> +/**
>> + * struct fwctl_rpc_cxl - ioctl(FWCTL_RPC) input
>> + */
>> +struct fwctl_rpc_cxl {
>> +	__u32 rpc_cmd;
>> +	__u32 payload_size;
>> +	__u32 version;
>> +	__u32 rsvd;
>> +	struct fwctl_cxl_command send_cmd;
>> +};
>> +
>> +struct fwctl_rpc_cxl_out {
>> +	__u32 retval;
>> +	__u32 rsvd;
> 
>> +	__u8 payload[];
> 
> This might be better as 
> 
>   __aligned_u64 payload[]
> 
> Which will force a 8 byte alignment of the struct which will allow the
> payload to be casted to aligned u64 reliably.

ok will change.

> 
> How do you know the length of payload?

Yes will change the rsvd field to size.

> 
> Jason

  reply	other threads:[~2024-07-22 22:52 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-18 21:32 [RFC PATCH 0/13] fwctl/cxl: Add CXL feature commands support via fwctl Dave Jiang
2024-07-18 21:32 ` [RFC PATCH 01/13] cxl: Move mailbox related bits to the same context Dave Jiang
2024-07-19  6:31   ` Alejandro Lucero Palau
2024-07-19 15:47     ` Dave Jiang
2024-07-19 16:07       ` Alejandro Lucero Palau
2024-07-26 17:28   ` Jonathan Cameron
2024-07-18 21:32 ` [RFC PATCH 02/13] cxl: Fix comment regarding cxl_query_cmd() return data Dave Jiang
2024-07-26 17:29   ` Jonathan Cameron
2024-09-24 23:41     ` Dave Jiang
2024-07-18 21:32 ` [RFC PATCH 03/13] cxl: Refactor user ioctl command path from mds to mailbox Dave Jiang
2024-07-18 21:32 ` [RFC PATCH 04/13] cxl: Add Get Supported Features command for kernel usage Dave Jiang
2024-07-26 17:50   ` Jonathan Cameron
2024-09-27 16:22     ` Dave Jiang
2024-08-21 16:05   ` Shiju Jose
2024-08-21 18:10     ` Dave Jiang
2024-07-18 21:32 ` [RFC PATCH 05/13] cxl/test: Add Get Supported Features mailbox command support Dave Jiang
2024-07-18 21:32 ` [RFC PATCH 06/13] cxl: Add Get Feature " Dave Jiang
2024-07-18 21:32 ` [RFC PATCH 07/13] cxl: Add Set " Dave Jiang
2024-07-18 21:32 ` [RFC PATCH 08/13] fwctl/cxl: Add driver for CXL mailbox for handling CXL features commands Dave Jiang
2024-07-22 15:31   ` Jason Gunthorpe
2024-07-22 21:42     ` Dave Jiang
2024-07-26 18:02   ` Jonathan Cameron
2024-09-24 23:44     ` Dave Jiang
2024-09-26 17:37       ` Jason Gunthorpe
2024-09-26 20:26         ` Dave Jiang
2024-07-18 21:32 ` [RFC PATCH 09/13] fwctl/cxl: Add support for get driver information Dave Jiang
2024-07-18 21:32 ` [RFC PATCH 10/13] fwctl/cxl: Add support for fwctl RPC command to enable CXL feature commands Dave Jiang
2024-07-22 15:29   ` Jason Gunthorpe
2024-07-22 22:52     ` Dave Jiang [this message]
2024-07-29 11:29   ` Jonathan Cameron
2024-11-13 15:41     ` Dave Jiang
2024-11-19 11:41       ` Jonathan Cameron
2024-07-18 21:32 ` [RFC PATCH 11/13] fwctl/cxl: Add query commands software command for ->fw_rpc() Dave Jiang
2024-07-22 15:24   ` Jason Gunthorpe
2024-07-22 23:23     ` Dave Jiang
2024-08-08 12:56       ` Jason Gunthorpe
2024-07-29 11:48   ` Jonathan Cameron
2024-07-18 21:32 ` [RFC PATCH 12/13] cxl/test: Add Get Feature support to cxl_test Dave Jiang
2024-07-18 21:32 ` [RFC PATCH 13/13] cxl/test: Add Set " Dave Jiang
2024-07-19  6:23 ` [RFC PATCH 0/13] fwctl/cxl: Add CXL feature commands support via fwctl Alejandro Lucero Palau
2024-07-19 15:48   ` Dave Jiang
2024-07-22 15:32 ` Jason Gunthorpe
2024-07-29 12:05 ` Jonathan Cameron
2024-08-06 16:44   ` Dave Jiang
2024-11-13  0:17   ` Dave Jiang
2024-11-19 11:43     ` Jonathan Cameron
2024-11-19 15:58       ` Dave Jiang

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=c4c158ce-f3a7-411e-8e9c-c6cd92462c19@intel.com \
    --to=dave.jiang@intel.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=alison.schofield@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave@stgolabs.net \
    --cc=ira.weiny@intel.com \
    --cc=jgg@nvidia.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=shiju.jose@huawei.com \
    --cc=vishal.l.verma@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