Skip to contentSkip to conversation

cxgb4: Add HMA support

PATCH Applied Arjun Vynipadath 2 participants 2 messages Mar 13, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cxgb4: Add HMA support

HMA(Host Memory Access) maps a part of host memory for T6-SO memfree cards.

This commit does the following:
- Query FW to check if we have HMA support. If yes, the params will return HMA size configured in FW. We will dma map memory based on this size.
- Also contains changes to get HMA memory information via debugfs.

---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4.h         |  13 ++
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c |  10 +-
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c    | 228 ++++++++++++++++++++-
 drivers/net/ethernet/chelsio/cxgb4/t4_hw.c         |   2 +-
 drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h      |  56 +++++
 5 files changed, 303 insertions(+), 6 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +13 -0
index d3fa53d..b2df0ff 100644
@@ -831,6 +831,16 @@ struct vf_info {
 	u16 vlan;
 };
 
+enum {
+	HMA_DMA_MAPPED_FLAG = 1
+};
+
+struct hma_data {
+	unsigned char flags;
+	struct sg_table *sgt;
+	dma_addr_t *phy_addr;	/* physical address of the page */
+};
+
 struct mbox_list {
 	struct list_head list;
 };
@@ -946,6 +956,9 @@ struct adapter {
 
 	/* Ethtool Dump */
 	struct ethtool_dump eth_dump;
+
+	/* HMA */
+	struct hma_data hma;
 };
 
 /* Support for "sched-class" command to allow a TX Scheduling Class to be
drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c +8 -2
index 2822bbf..de2ba86 100644
@@ -2617,7 +2617,7 @@ int mem_open(struct inode *inode, struct file *file)
 
 	file->private_data = inode->i_private;
 
-	mem = (uintptr_t)file->private_data & 0x3;
+	mem = (uintptr_t)file->private_data & 0x7;
 	adap = file->private_data - mem;
 
 	(void)t4_fwcache(adap, FW_PARAM_DEV_FWCACHE_FLUSH);
@@ -2630,7 +2630,7 @@ static ssize_t mem_read(struct file *file, char __user *buf, size_t count,
 {
 	loff_t pos = *ppos;
 	loff_t avail = file_inode(file)->i_size;
-	unsigned int mem = (uintptr_t)file->private_data & 3;
+	unsigned int mem = (uintptr_t)file->private_data & 0x7;
 	struct adapter *adap = file->private_data - mem;
 	__be32 *data;
 	int ret;
@@ -3042,6 +3042,12 @@ int t4_setup_debugfs(struct adapter *adap)
 			add_debugfs_mem(adap, "mc", MEM_MC,
 					EXT_MEM_SIZE_G(size));
 		}
+
+		if (i & HMA_MUX_F) {
+			size = t4_read_reg(adap, MA_EXT_MEMORY1_BAR_A);
+			add_debugfs_mem(adap, "hma", MEM_HMA,
+					EXT_MEM1_SIZE_G(size));
+		}
 	}
 
 	de = debugfs_create_file_size("flash", S_IRUSR, adap->debugfs_root, adap,
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +225 -3

278 lines not on this page · raw message

drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +1 -1
index 2c889ef..38e38dc 100644
@@ -487,7 +487,7 @@ static int t4_edc_err_read(struct adapter *adap, int idx)
  * t4_memory_rw_init - Get memory window relative offset, base, and size.
  * @adap: the adapter
  * @win: PCI-E Memory Window to use
- * @mtype: memory type: MEM_EDC0, MEM_EDC1 or MEM_MC
+ * @mtype: memory type: MEM_EDC0, MEM_EDC1, MEM_HMA or MEM_MC
  * @mem_off: memory relative offset with respect to @mtype.
  * @mem_base: configured memory base address.
  * @mem_aperture: configured memory window aperture.
drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h +56 -0

80 lines not on this page · raw message

Signature · 1 line
2.3.5
maintainer Applied
#1 lore raw

From: Arjun Vynipadath <[email protected]>
Date: Tue, 13 Mar 2018 16:24:45 +0530

Quoted 8 lines

HMA(Host Memory Access) maps a part of host memory for T6-SO memfree cards.

This commit does the following:
- Query FW to check if we have HMA support. If yes, the params will return HMA size configured in FW. We will dma map memory based on this size.
- Also contains changes to get HMA memory information via debugfs.

Quoted 4 lines

Applied, thank you.