Re: [PATCH 03/11] cxl/mem: Implement Clear Event Records command

From: Ira Weiny
Date: Wed Nov 16 2022 - 20:12:49 EST


On Wed, Nov 16, 2022 at 03:45:43PM +0000, Jonathan Cameron wrote:
> On Wed, 16 Nov 2022 15:24:26 +0000
> Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> wrote:
>

[snip]

> >
> >
> > > + */
> > > +struct cxl_mbox_clear_event_payload {
> > > + u8 event_log; /* enum cxl_event_log_type */
> > > + u8 clear_flags;
> > > + u8 nr_recs; /* 1 for this struct */
> > Nope :) Delete the comments so they can't be wrong if this changes in future!
> Ah. You only use one. So should hard code that in the array size below.

No it can can send up to CXL_GET_EVENT_NR_RECORDS at a time : 'nr_rec'.


rc = cxl_clear_event_record(cxlds, type, &payload, nr_rec);


static int cxl_clear_event_record(struct cxl_dev_state *cxlds,
enum cxl_event_log_type log,
struct cxl_get_event_payload *get_pl, u16 nr)
{
struct cxl_mbox_clear_event_payload payload = {
.event_log = log,
.nr_recs = nr,
^^^^^^^^^^^^^^
Here...

};
int i;

for (i = 0; i < nr; i++) {
payload.handle[i] = get_pl->record[i].hdr.handle;
dev_dbg(cxlds->dev, "Event log '%s': Clearning %u\n",
cxl_event_log_type_str(log),
le16_to_cpu(payload.handle[i]));
}
...

Ira