Sfoglia il codice sorgente

qcacmn: Add paddr in CE descriptor history

Add IOMMU IOVA to PA and MMU virtual to phys address
in CE Desc History, hif_ce_desc_history.

Change-Id: I877a2275e7ea99748087ea6f2ad5f26aa3b2476e
CRs-Fixed: 2524381
Alok Kumar 5 anni fa
parent
commit
1c42376e40
2 ha cambiato i file con 59 aggiunte e 1 eliminazioni
  1. 28 1
      hif/src/ce/ce_internal.h
  2. 31 0
      hif/src/ce/ce_service.c

+ 28 - 1
hif/src/ce/ce_internal.h

@@ -540,7 +540,7 @@ int hif_get_wake_ce_id(struct hif_softc *scn, uint8_t *ce_id);
 #if defined(HIF_CONFIG_SLUB_DEBUG_ON) || defined(HIF_CE_DEBUG_DATA_BUF)
 
 #ifndef HIF_CE_HISTORY_MAX
-#define HIF_CE_HISTORY_MAX 512
+#define HIF_CE_HISTORY_MAX 1024
 #endif
 
 #define CE_DEBUG_MAX_DATA_BUF_SIZE 64
@@ -573,6 +573,11 @@ struct hif_ce_desc_event {
 	uint8_t *data;
 	size_t actual_data_len;
 #endif /* HIF_CE_DEBUG_DATA_BUF */
+
+#ifdef HIF_CONFIG_SLUB_DEBUG_ON
+	qdf_dma_addr_t dma_to_phy;
+	qdf_dma_addr_t virt_to_phy;
+#endif
 };
 #else
 struct hif_ce_desc_event;
@@ -669,4 +674,26 @@ static inline void ce_validate_nbytes(uint32_t nbytes,
 {
 }
 #endif
+
+#if defined(HIF_CONFIG_SLUB_DEBUG_ON) && defined(HIF_RECORD_RX_PADDR)
+/**
+ * hif_ce_desc_record_rx_paddr() - record physical address for IOMMU
+ * IOVA addr and MMU virtual addr for Rx
+ * @scn: hif_softc
+ * @event: structure detailing a ce event
+ *
+ * record physical address for ce_event_type HIF_RX_DESC_POST and
+ * HIF_RX_DESC_COMPLETION
+ *
+ * Return: none
+ */
+void hif_ce_desc_record_rx_paddr(struct hif_softc *scn,
+				 struct hif_ce_desc_event *event);
+#else
+static inline
+void hif_ce_desc_record_rx_paddr(struct hif_softc *scn,
+				 struct hif_ce_desc_event *event)
+{
+}
+#endif
 #endif /* __COPY_ENGINE_INTERNAL_H__ */

+ 31 - 0
hif/src/ce/ce_service.c

@@ -130,6 +130,35 @@ void hif_ce_desc_data_record(struct hif_ce_desc_event *event, int len)
 }
 #endif
 
+#if defined(HIF_CONFIG_SLUB_DEBUG_ON) && defined(HIF_RECORD_RX_PADDR)
+/**
+ * hif_ce_desc_record_rx_paddr() - record physical address for IOMMU
+ * IOVA addr and MMU virtual addr for Rx
+ * @scn: hif_softc
+ * @event: structure detailing a ce event
+ *
+ * Record physical address for ce event type HIF_RX_DESC_POST and
+ * HIF_RX_DESC_COMPLETION
+ *
+ * Return: none
+ */
+void hif_ce_desc_record_rx_paddr(struct hif_softc *scn,
+				 struct hif_ce_desc_event *event)
+{
+	if (event->type != HIF_RX_DESC_POST &&
+	    event->type != HIF_RX_DESC_COMPLETION)
+		return;
+
+	if (event->descriptor.dest_desc.buffer_addr)
+		event->dma_to_phy = qdf_mem_paddr_from_dmaaddr(
+				scn->qdf_dev,
+				event->descriptor.dest_desc.buffer_addr);
+
+	if (event->memory)
+		event->virt_to_phy = virt_to_phys(qdf_nbuf_data(event->memory));
+}
+#endif
+
 /**
  * hif_record_ce_desc_event() - record ce descriptor events
  * @scn: hif_softc
@@ -182,6 +211,8 @@ void hif_record_ce_desc_event(struct hif_softc *scn, int ce_id,
 	event->memory = memory;
 	event->index = index;
 
+	hif_ce_desc_record_rx_paddr(scn, event);
+
 	if (ce_hist->data_enable[ce_id])
 		hif_ce_desc_data_record(event, len);
 }