Re: [PATCH v3 06/27] ocxl: Tally up the LPC memory on a link & allow it to be mapped

From: Andrew Donnellan
Date: Mon Feb 24 2020 - 00:25:36 EST


On 21/2/20 2:26 pm, Alastair D'Silva wrote:
From: Alastair D'Silva <alastair@xxxxxxxxxxx>

Tally up the LPC memory on an OpenCAPI link & allow it to be mapped

Signed-off-by: Alastair D'Silva <alastair@xxxxxxxxxxx>

This commit message is a bit short and could do with some further explanation.

In particular - it's worth explaining why the tracking of available LPC memory needs to be done at a link level, because a single OpenCAPI card can have multiple PCI functions, each with multiple AFUs which define an amount of LPC memory they have, even if the common case is expected to be a single function with a single AFU and thus one LPC area per link.

Snowpatch has a few checkpatch issues to report:

https://openpower.xyz/job/snowpatch/job/snowpatch-linux-checkpatch/11800//artifact/linux/checkpatch.log

The code generally looks okay to me.

diff --git a/drivers/misc/ocxl/ocxl_internal.h b/drivers/misc/ocxl/ocxl_internal.h
index 198e4e4bc51d..d0c8c4838f42 100644
--- a/drivers/misc/ocxl/ocxl_internal.h
+++ b/drivers/misc/ocxl/ocxl_internal.h
@@ -142,4 +142,37 @@ int ocxl_irq_offset_to_id(struct ocxl_context *ctx, u64 offset);
u64 ocxl_irq_id_to_offset(struct ocxl_context *ctx, int irq_id);
void ocxl_afu_irq_free_all(struct ocxl_context *ctx);
+/**
+ * ocxl_link_add_lpc_mem() - Increment the amount of memory required by an OpenCAPI link
+ *
+ * @link_handle: The OpenCAPI link handle
+ * @offset: The offset of the memory to add
+ * @size: The amount of memory to increment by
+ *
+ * Returns 0 on success, negative on overflow
+ */

I think "amount of memory required" isn't the best way to express this.

Might as well explicitly say -EINVAL on overflow.

--
Andrew Donnellan OzLabs, ADL Canberra
ajd@xxxxxxxxxxxxx IBM Australia Limited