[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230830132037.00005348@Huawei.com>
Date: Wed, 30 Aug 2023 13:20:37 +0100
From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
To: Ira Weiny <ira.weiny@...el.com>
CC: Dan Williams <dan.j.williams@...el.com>,
Navneet Singh <navneet.singh@...el.com>,
Fan Ni <fan.ni@...sung.com>,
Davidlohr Bueso <dave@...olabs.net>,
Dave Jiang <dave.jiang@...el.com>,
Alison Schofield <alison.schofield@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>,
<linux-cxl@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH RFC v2 17/18] tools/testing/cxl: Add DC Regions to mock
mem data
On Mon, 28 Aug 2023 22:21:08 -0700
Ira Weiny <ira.weiny@...el.com> wrote:
> To test DC regions the mock memory devices will need to store
> information about the regions and manage fake extent data.
>
> Define mock_dc_region information within the mock memory data. Add
> sysfs entries on the mock device to inject and delete extents.
>
> The inject format is <start>:<length>:<tag>
> The delete format is <start>
>
> Add DC mailbox commands to the CEL and implement those commands.
>
> Signed-off-by: Ira Weiny <ira.weiny@...el.com>
Looks fine to me. Totally trivial comment inline.
FWIW
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
> +
> static int mock_gsl(struct cxl_mbox_cmd *cmd)
> {
> if (cmd->size_out < sizeof(mock_gsl_payload))
> @@ -1315,6 +1429,148 @@ static int mock_activate_fw(struct cxl_mockmem_data *mdata,
> return -EINVAL;
> }
>
Bit inconsistent on whether there are one or two blank lines between functions.
> +static int mock_get_dc_config(struct device *dev,
> + struct cxl_mbox_cmd *cmd)
> +{
> + struct cxl_mbox_get_dc_config *dc_config = cmd->payload_in;
> + struct cxl_mockmem_data *mdata = dev_get_drvdata(dev);
> + u8 region_requested, region_start_idx, region_ret_cnt;
> + struct cxl_mbox_dynamic_capacity *resp;
> +
> + region_requested = dc_config->region_count;
> + if (NUM_MOCK_DC_REGIONS < region_requested)
> + region_requested = NUM_MOCK_DC_REGIONS;
> +
> + if (cmd->size_out < struct_size(resp, region, region_requested))
> + return -EINVAL;
> +
> + memset(cmd->payload_out, 0, cmd->size_out);
> + resp = cmd->payload_out;
> +
> + region_start_idx = dc_config->start_region_index;
> + region_ret_cnt = 0;
> + for (int i = 0; i < NUM_MOCK_DC_REGIONS; i++) {
> + if (i >= region_start_idx) {
> + memcpy(&resp->region[region_ret_cnt],
> + &mdata->dc_regions[i],
> + sizeof(resp->region[region_ret_cnt]));
> + region_ret_cnt++;
> + }
> + }
> + resp->avail_region_count = region_ret_cnt;
> +
> + dev_dbg(dev, "Returning %d dc regions\n", region_ret_cnt);
> + return 0;
> +}
Powered by blists - more mailing lists