summaryrefslogtreecommitdiff
path: root/include/linux/pds
diff options
context:
space:
mode:
authorNikhil P. Rao <nikhil.rao@amd.com>2026-07-30 04:25:22 +0000
committerJakub Kicinski <kuba@kernel.org>2026-08-05 17:59:29 -0700
commitb311af86b58f56ce81b85bd789c98e474851de90 (patch)
treeb42b87a0226098dcfe862019995f149c69004ba9 /include/linux/pds
parent5df545b3a5ee485fb366bba544063996d45d64af (diff)
pds_core: add host backed memory support for firmware
Some newer AMD/Pensando cards have minimal memory and there are cases where components, specifically in the control plane, need more memory. This series adds support for host backed DMA memory that can be used by the firmware for the previously mentioned cases. Host memory allocation is best-effort: if some allocations fail, the driver continues with whatever succeeded. Firmware gracefully degrades when less memory is available than requested. Signed-off-by: Vamsi Atluri <Vamsi.Atluri@amd.com> Signed-off-by: Nikhil P. Rao <nikhil.rao@amd.com> Link: https://patch.msgid.link/20260730-upstream_v8-v12-5-136cd174ee85@amd.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/linux/pds')
-rw-r--r--include/linux/pds/pds_core_if.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/include/linux/pds/pds_core_if.h b/include/linux/pds/pds_core_if.h
index 5a1fafaccf20..901e1e628f89 100644
--- a/include/linux/pds/pds_core_if.h
+++ b/include/linux/pds/pds_core_if.h
@@ -46,6 +46,7 @@ enum pds_core_cmd_opcode {
PDS_CORE_CMD_SEND_COMPONENT = 9,
PDS_CORE_CMD_FINALIZE_UPDATE = 10,
PDS_CORE_CMD_MATCH_RECORD_DESC = 11,
+ PDS_CORE_CMD_HOST_MEM = 12,
/* SR/IOV commands */
PDS_CORE_CMD_VF_GETATTR = 60,
@@ -110,9 +111,11 @@ struct pds_core_drv_identity {
/**
* enum pds_core_dev_capability - Device capabilities
* @PDS_CORE_DEV_CAP_PLDM_FW_UPDATE: Device only supports FW update via PLDM
+ * @PDS_CORE_DEV_CAP_HOST_MEM: Device supports host memory for fw use
*/
enum pds_core_dev_capability {
PDS_CORE_DEV_CAP_PLDM_FW_UPDATE = BIT(0),
+ PDS_CORE_DEV_CAP_HOST_MEM = BIT(1),
};
#define PDS_DEV_TYPE_MAX 16
@@ -837,6 +840,65 @@ struct pds_core_match_record_desc_comp {
u8 rsvd;
};
+/**
+ * enum pds_core_host_mem_oper - HOST_MEM sub-operations
+ * @PDS_CORE_HOST_MEM_GET_COUNT: Query number of memory requests
+ * @PDS_CORE_HOST_MEM_QUERY: Query details of a memory request
+ * @PDS_CORE_HOST_MEM_ADD: Provide allocated memory to firmware
+ * @PDS_CORE_HOST_MEM_DEL: Notify firmware of memory deallocation
+ */
+enum pds_core_host_mem_oper {
+ PDS_CORE_HOST_MEM_GET_COUNT = 0,
+ PDS_CORE_HOST_MEM_QUERY = 1,
+ PDS_CORE_HOST_MEM_ADD = 2,
+ PDS_CORE_HOST_MEM_DEL = 3,
+};
+
+/**
+ * struct pds_core_host_mem_cmd - HOST_MEM command
+ * @opcode: Opcode PDS_CORE_CMD_HOST_MEM
+ * @oper: Operation (enum pds_core_host_mem_oper)
+ * @index: Memory request index (GET_COUNT: max_count, QUERY: index)
+ * @tag: Tag for this memory request (ADD/DEL)
+ * @reason: Reason for deletion (DEL only)
+ * @rsvd: Reserved
+ * @max_contig: Maximum contiguous memory size (GET_COUNT only)
+ * @size: Size of memory in bytes (ADD only)
+ * @buf_pa: DMA address of memory (ADD only)
+ *
+ * Unified command for all host memory operations. Fields are reused
+ * across operations to minimize opcode space usage.
+ */
+struct pds_core_host_mem_cmd {
+ u8 opcode;
+ u8 oper;
+ __le16 index;
+ __le16 tag;
+ u8 reason;
+ u8 rsvd;
+ __le32 max_contig;
+ __le32 size;
+ __le64 buf_pa;
+};
+
+/**
+ * struct pds_core_host_mem_comp - HOST_MEM completion
+ * @status: Status of the command (enum pds_core_status_code)
+ * @oper: Operation that was performed
+ * @count: Number of memory requests (GET_COUNT)
+ * @size: Size of memory request in bytes (QUERY)
+ * @tag: Tag for this memory request (QUERY/DEL)
+ * @rsvd: Reserved
+ */
+struct pds_core_host_mem_comp {
+ u8 status;
+ u8 oper;
+ __le16 count;
+ __le32 size;
+ __le16 tag;
+ u8 rsvd[6];
+};
+
/*
* union pds_core_dev_cmd - Overlay of core device command structures
*/
@@ -860,6 +922,7 @@ union pds_core_dev_cmd {
struct pds_core_send_component_cmd send_component;
struct pds_core_finalize_update_cmd finalize_update;
struct pds_core_match_record_desc_cmd match_record_desc;
+ struct pds_core_host_mem_cmd host_mem;
};
/*
@@ -885,6 +948,7 @@ union pds_core_dev_comp {
struct pds_core_send_component_comp send_component;
struct pds_core_finalize_update_comp finalize_update;
struct pds_core_match_record_desc_comp match_record_desc;
+ struct pds_core_host_mem_comp host_mem;
};
/**