rpms/kernel/devel linux-2.6-iwlwifi-use-dma_alloc_coherent.patch, NONE, 1.1 drm-nouveau.patch, 1.2, 1.3 kernel.spec, 1.919, 1.920

Kyle McMartin kyle at fedoraproject.org
Tue Sep 2 14:56:53 UTC 2008


Author: kyle

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv11214

Modified Files:
	drm-nouveau.patch kernel.spec 
Added Files:
	linux-2.6-iwlwifi-use-dma_alloc_coherent.patch 
Log Message:
* Tue Sep 02 2008 Kyle McMartin <kyle at redhat.com>
- hopefully fix the iwlwifi issues.
- add an include <linux/pagemap.h> to drm-nouveau to hopefully fix
  the build on powerpc64.


linux-2.6-iwlwifi-use-dma_alloc_coherent.patch:

--- NEW FILE linux-2.6-iwlwifi-use-dma_alloc_coherent.patch ---
Index: linux-2.6.26.noarch/drivers/net/wireless/iwlwifi/iwl-dev.h
===================================================================
--- linux-2.6.26.noarch.orig/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ linux-2.6.26.noarch/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -135,6 +135,7 @@ struct iwl_tx_info {
 struct iwl_tx_queue {
 	struct iwl_queue q;
 	struct iwl_tfd_frame *bd;
+	dma_addr_t dma_addr_cmd[TFD_TX_CMD_SLOTS];
 	struct iwl_cmd *cmd[TFD_TX_CMD_SLOTS];
 	struct iwl_tx_info *txb;
 	int need_update;
Index: linux-2.6.26.noarch/drivers/net/wireless/iwlwifi/iwl-tx.c
===================================================================
--- linux-2.6.26.noarch.orig/drivers/net/wireless/iwlwifi/iwl-tx.c
+++ linux-2.6.26.noarch/drivers/net/wireless/iwlwifi/iwl-tx.c
@@ -212,7 +212,7 @@ static void iwl_tx_queue_free(struct iwl
 {
 	struct iwl_tx_queue *txq = &priv->txq[txq_id];
 	struct iwl_queue *q = &txq->q;
-	struct pci_dev *dev = priv->pci_dev;
+	struct device *dev = &priv->pci_dev->dev;
 	int i, slots_num, len;
 
 	if (q->n_bd == 0)
@@ -223,22 +223,22 @@ static void iwl_tx_queue_free(struct iwl
 	     q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd))
 		iwl_hw_txq_free_tfd(priv, txq);
 
-	len = sizeof(struct iwl_cmd) * q->n_window;
-	if (q->id == IWL_CMD_QUEUE_NUM)
-		len += IWL_MAX_SCAN_SIZE;
-
 	/* De-alloc array of command/tx buffers */
+	len = sizeof(struct iwl_cmd);
 	slots_num = (txq_id == IWL_CMD_QUEUE_NUM) ?
 			TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
 	for (i = 0; i < slots_num; i++)
-		kfree(txq->cmd[i]);
+		dma_free_coherent(dev, len, txq->cmd[i],
+				txq->dma_addr_cmd[i]);
 	if (txq_id == IWL_CMD_QUEUE_NUM)
-		kfree(txq->cmd[slots_num]);
+		dma_free_coherent(dev, len + IWL_MAX_SCAN_SIZE, txq->cmd[i],
+				txq->dma_addr_cmd[i]);
 
 	/* De-alloc circular buffer of TFDs */
 	if (txq->q.n_bd)
-		pci_free_consistent(dev, sizeof(struct iwl_tfd_frame) *
-				    txq->q.n_bd, txq->bd, txq->q.dma_addr);
+		pci_free_consistent(priv->pci_dev,
+			sizeof(struct iwl_tfd_frame) * txq->q.n_bd,
+			txq->bd, txq->q.dma_addr);
 
 	/* De-alloc array of per-TFD driver data */
 	kfree(txq->txb);
@@ -406,6 +406,7 @@ static int iwl_tx_queue_init(struct iwl_
 			     struct iwl_tx_queue *txq,
 			     int slots_num, u32 txq_id)
 {
+	struct device *dev = &priv->pci_dev->dev;
 	int i, len;
 	int rc = 0;
 
@@ -426,16 +427,27 @@ static int iwl_tx_queue_init(struct iwl_
 				continue;
 		}
 
-		txq->cmd[i] = kmalloc(len, GFP_KERNEL | GFP_DMA);
-		if (!txq->cmd[i])
+		txq->cmd[i] = dma_alloc_coherent(dev, len,
+				&txq->dma_addr_cmd[i], GFP_KERNEL);
+		if (!txq->cmd[i]) {
+			len = sizeof(struct iwl_cmd);
+			for (--i; i >= 0; --i)
+				dma_free_coherent(dev, len, txq->cmd[i],
+					txq->dma_addr_cmd[i]);
 			return -ENOMEM;
+		}
 	}
 
 	/* Alloc driver data array and TFD circular buffer */
 	rc = iwl_tx_queue_alloc(priv, txq, txq_id);
 	if (rc) {
+		len = sizeof(struct iwl_cmd);
 		for (i = 0; i < slots_num; i++)
-			kfree(txq->cmd[i]);
+			dma_free_coherent(dev, len, txq->cmd[i],
+				txq->dma_addr_cmd[i]);
+		if (txq_id == IWL_CMD_QUEUE_NUM)
+			dma_free_coherent(dev, len + IWL_MAX_SCAN_SIZE,
+				txq->cmd[i], txq->dma_addr_cmd[i]);
 
 		return -ENOMEM;
 	}
@@ -911,9 +923,7 @@ int iwl_tx_skb(struct iwl_priv *priv, st
 
 	/* Physical address of this Tx command's header (not MAC header!),
 	 * within command buffer array. */
-	txcmd_phys = pci_map_single(priv->pci_dev, out_cmd,
-				sizeof(struct iwl_cmd), PCI_DMA_TODEVICE);
-	txcmd_phys += offsetof(struct iwl_cmd, hdr);
+	txcmd_phys = txq->dma_addr_cmd[idx] + offsetof(struct iwl_cmd, hdr);
 
 	/* Add buffer containing Tx command and MAC(!) header to TFD's
 	 * first entry */
@@ -1060,9 +1070,7 @@ int iwl_enqueue_hcmd(struct iwl_priv *pr
 		out_cmd->hdr.sequence |= cpu_to_le16(SEQ_HUGE_FRAME);
 	len = (idx == TFD_CMD_SLOTS) ?
 			IWL_MAX_SCAN_SIZE : sizeof(struct iwl_cmd);
-	phys_addr = pci_map_single(priv->pci_dev, out_cmd, len,
-						PCI_DMA_TODEVICE);
-	phys_addr += offsetof(struct iwl_cmd, hdr);
+	phys_addr = txq->dma_addr_cmd[idx] + offsetof(struct iwl_cmd, hdr);
 	iwl_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size);
 
 	IWL_DEBUG_HC("Sending command %s (#%x), seq: 0x%04X, "
@@ -1127,9 +1135,6 @@ static void iwl_hcmd_queue_reclaim(struc
 {
 	struct iwl_tx_queue *txq = &priv->txq[txq_id];
 	struct iwl_queue *q = &txq->q;
-	struct iwl_tfd_frame *bd = &txq->bd[index];
-	dma_addr_t dma_addr;
-	int is_odd, buf_len;
 	int nfreed = 0;
 
 	if ((index >= q->n_bd) || (iwl_queue_used(q, index) == 0)) {
@@ -1147,19 +1152,7 @@ static void iwl_hcmd_queue_reclaim(struc
 					q->write_ptr, q->read_ptr);
 			queue_work(priv->workqueue, &priv->restart);
 		}
-		is_odd = (index/2) & 0x1;
-		if (is_odd) {
-			dma_addr = IWL_GET_BITS(bd->pa[index], tb2_addr_lo16) |
-					(IWL_GET_BITS(bd->pa[index],
-							tb2_addr_hi20) << 16);
-			buf_len = IWL_GET_BITS(bd->pa[index], tb2_len);
-		} else {
-			dma_addr = le32_to_cpu(bd->pa[index].tb1_addr);
-			buf_len = IWL_GET_BITS(bd->pa[index], tb1_len);
-		}
 
-		pci_unmap_single(priv->pci_dev, dma_addr, buf_len,
-				 PCI_DMA_TODEVICE);
 		nfreed++;
 	}
 }

drm-nouveau.patch:

Index: drm-nouveau.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/drm-nouveau.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- drm-nouveau.patch	2 Sep 2008 11:13:39 -0000	1.2
+++ drm-nouveau.patch	2 Sep 2008 14:56:52 -0000	1.3
@@ -5605,9 +5605,10 @@
 index 0000000..b35bfb7
 --- /dev/null
 +++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c
-@@ -0,0 +1,341 @@
+@@ -0,0 +1,342 @@
 +#include "drmP.h"
 +#include "nouveau_drv.h"
++#include <linux/pagemap.h>
 +
 +#define NV_CTXDMA_PAGE_SHIFT 12
 +#define NV_CTXDMA_PAGE_SIZE  (1 << NV_CTXDMA_PAGE_SHIFT)


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.919
retrieving revision 1.920
diff -u -r1.919 -r1.920
--- kernel.spec	2 Sep 2008 11:10:16 -0000	1.919
+++ kernel.spec	2 Sep 2008 14:56:52 -0000	1.920
@@ -597,6 +597,7 @@
 
 Patch680: linux-2.6-wireless.patch
 Patch681: linux-2.6-wireless-pending.patch
+Patch682: linux-2.6-iwlwifi-use-dma_alloc_coherent.patch
 Patch690: linux-2.6-at76.patch
 
 Patch700: linux-2.6-nfs-client-mounts-hang.patch
@@ -1127,6 +1128,9 @@
 # wireless patches headed for 2.6.28
 #ApplyPatch linux-2.6-wireless-pending.patch
 
+# fix spot's iwlwifi, hopefully...
+ApplyPatch linux-2.6-iwlwifi-use-dma_alloc_coherent.patch
+
 # Add misc wireless bits from upstream wireless tree
 ApplyPatch linux-2.6-at76.patch
 
@@ -1746,6 +1750,11 @@
 %kernel_variant_files -k vmlinux %{with_kdump} kdump
 
 %changelog
+* Tue Sep 02 2008 Kyle McMartin <kyle at redhat.com>
+- hopefully fix the iwlwifi issues.
+- add an include <linux/pagemap.h> to drm-nouveau to hopefully fix
+  the build on powerpc64.
+
 * Tue Sep 02 2008 Dave Airlie <airlied at redhat.com>
 - bring back nouveau yet again
 




More information about the fedora-extras-commits mailing list