[PATCH] 2.4: Preemption fixes for Broadcom DMA Page operations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello !

The attached patch implements preempt_disable/preempt_enable around the SB1 DMA
page operations. Please review ...

Thanks
Manish Lachwani
--- arch/mips/mm/pg-sb1.c.orig	2004-12-01 10:59:53.000000000 -0800
+++ arch/mips/mm/pg-sb1.c	2004-12-01 11:08:59.000000000 -0800
@@ -157,7 +157,11 @@
 
 void sb1_dma_init(void)
 {
-	int cpu = smp_processor_id();
+	int cpu;
+
+	preempt_disable();
+
+	cpu = smp_processor_id();
 	uint64_t base_val = PHYSADDR(&page_descr[cpu]) | V_DM_DSCR_BASE_RINGSZ(1);
 
 	out64(base_val,
@@ -166,15 +170,23 @@
 	      IO_SPACE_BASE + A_DM_REGISTER(cpu, R_DM_DSCR_BASE));
 	out64(base_val | M_DM_DSCR_BASE_ENABL,
 	      IO_SPACE_BASE + A_DM_REGISTER(cpu, R_DM_DSCR_BASE));
+
+	preempt_enable();
 }
 
 void sb1_clear_page_dma(void *page)
 {
-	int cpu = smp_processor_id();
+	int cpu;
+
+	preempt_disable();
+
+	cpu = smp_processor_id();
 
 	/* if the page is above Kseg0, use old way */
-	if (KSEGX(page) != K0BASE)
+	if (KSEGX(page) != K0BASE) {
+		preempt_enable();
 		return sb1_clear_page(page);
+	}
 
 	page_descr[cpu].dscr_a = PHYSADDR(page) | M_DM_DSCRA_ZERO_MEM | M_DM_DSCRA_L2C_DEST | M_DM_DSCRA_INTERRUPT;
 	page_descr[cpu].dscr_b = V_DM_DSCRB_SRC_LENGTH(PAGE_SIZE);
@@ -187,17 +199,27 @@
 	while (!(in64(IO_SPACE_BASE + A_DM_REGISTER(cpu, R_DM_DSCR_BASE_DEBUG)) & M_DM_DSCR_BASE_INTERRUPT))
 		;
 	in64(IO_SPACE_BASE + A_DM_REGISTER(cpu, R_DM_DSCR_BASE));
+
+	preempt_enable();
 }
 
 void sb1_copy_page_dma(void *to, void *from)
 {
-	unsigned long from_phys = PHYSADDR(from);
-	unsigned long to_phys = PHYSADDR(to);
-	int cpu = smp_processor_id();
+	unsigned long from_phys;
+	unsigned long to_phys;
+	int cpu;
+
+	preempt_disable();
+
+	from_phys = PHYSADDR(from);
+	to_phys = PHYSADDR(to);
+	cpu = smp_processor_id();
 
 	/* if either page is above Kseg0, use old way */
-	if ((KSEGX(to) != K0BASE) || (KSEGX(from) != K0BASE))
+	if ((KSEGX(to) != K0BASE) || (KSEGX(from) != K0BASE)) {
+		preempt_enable();
 		return sb1_copy_page(to, from);
+	}
 
 	page_descr[cpu].dscr_a = PHYSADDR(to_phys) | M_DM_DSCRA_L2C_DEST | M_DM_DSCRA_INTERRUPT;
 	page_descr[cpu].dscr_b = PHYSADDR(from_phys) | V_DM_DSCRB_SRC_LENGTH(PAGE_SIZE);
@@ -210,6 +232,8 @@
 	while (!(in64(IO_SPACE_BASE + A_DM_REGISTER(cpu, R_DM_DSCR_BASE_DEBUG)) & M_DM_DSCR_BASE_INTERRUPT))
 		;
 	in64(IO_SPACE_BASE + A_DM_REGISTER(cpu, R_DM_DSCR_BASE));
+
+	preempt_enable();
 }
 
 #endif
--- drivers/char/Config.in.orig	2004-12-01 10:33:59.000000000 -0800
+++ drivers/char/Config.in	2004-12-01 10:34:22.000000000 -0800
@@ -178,7 +178,7 @@
          define_bool CONFIG_AU1X00_USB_DEVICE y
          fi
       fi
-      if [ "$CONFIG_SIBYTE_SB1250" = "y" ]; then
+      if [ "$CONFIG_SIBYTE_BOARD" = "y" ]; then
          bool '  Support for sb1250 onchip DUART' CONFIG_SIBYTE_SB1250_DUART
          if [ "$CONFIG_SIBYTE_SB1250_DUART" = "y" ]; then
             bool '  Console on SB1250 DUART' CONFIG_SIBYTE_SB1250_DUART_CONSOLE
--- drivers/net/Config.in.orig	2004-12-01 10:41:37.000000000 -0800
+++ drivers/net/Config.in	2004-12-01 10:41:46.000000000 -0800
@@ -104,7 +104,7 @@
    if [ "$CONFIG_IDT_79EB434" = "y" ]; then
       bool '  IDT RC32434 Ethernet support' CONFIG_IDT_RC32434_ETH
    fi
-   if [ "$CONFIG_SIBYTE_SB1250" = "y" ]; then
+   if [ "$CONFIG_SIBYTE_BOARD" = "y" ]; then
       tristate '  SB1250 Ethernet support' CONFIG_NET_SB1250_MAC
    fi
    if [ "$CONFIG_SGI_IP27" = "y" ]; then

[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux