RESEND [PATCH] - SN: Add support for CPU disable

2007-08-22 Thread John Keller
Add additional support for CPU disable on SN platforms.
Correctly setup the smp_affinity mask for I/O error IRQs.
Restrict the use of the feature to Altix 4000 and 450 systems
running with a CPU disable capable PROM, and do not allow disabling
of CPU 0.

Signed-off-by: John Keller <[EMAIL PROTECTED]>
---
Resend #2:
  Add severity levels to the new "printk" messages.

Resend #1:
  Code was incorrectly passing a logical, instead of physical,
  cpuid to set_irq_affinity_info(). Also, some cleanup per
  review comments.


 arch/ia64/kernel/smpboot.c  |6 +
 arch/ia64/sn/kernel/huberror.c  |   14 ---
 arch/ia64/sn/kernel/irq.c   |   15 
 arch/ia64/sn/kernel/sn2/sn2_smp.c   |   26 ++
 arch/ia64/sn/pci/pcibr/pcibr_provider.c |1 
 arch/ia64/sn/pci/tioca_provider.c   |2 +
 arch/ia64/sn/pci/tioce_provider.c   |1 
 include/asm-ia64/sn/arch.h  |1 
 include/asm-ia64/sn/intr.h  |1 
 include/asm-ia64/sn/sn_feature_sets.h   |1 
 10 files changed, 64 insertions(+), 4 deletions(-)


Index: release/arch/ia64/sn/kernel/huberror.c
===
--- release.orig/arch/ia64/sn/kernel/huberror.c 2007-08-22 16:51:28.667238863 
-0500
+++ release/arch/ia64/sn/kernel/huberror.c  2007-08-22 18:41:19.088053993 
-0500
@@ -185,11 +185,14 @@ void hubiio_crb_error_handler(struct hub
  */
 void hub_error_init(struct hubdev_info *hubdev_info)
 {
+
if (request_irq(SGI_II_ERROR, hub_eint_handler, IRQF_SHARED,
-   "SN_hub_error", (void *)hubdev_info))
+   "SN_hub_error", (void *)hubdev_info)) {
printk("hub_error_init: Failed to request_irq for 0x%p\n",
hubdev_info);
-   return;
+   return;
+   }
+   sn_set_err_irq_affinity(SGI_II_ERROR);
 }
 
 
@@ -202,11 +205,14 @@ void hub_error_init(struct hubdev_info *
  */
 void ice_error_init(struct hubdev_info *hubdev_info)
 {
+
 if (request_irq
 (SGI_TIO_ERROR, (void *)hub_eint_handler, IRQF_SHARED, 
"SN_TIO_error",
- (void *)hubdev_info))
+ (void *)hubdev_info)) {
 printk("ice_error_init: request_irq() error hubdev_info 
0x%p\n",
hubdev_info);
-return;
+   return;
+   }
+   sn_set_err_irq_affinity(SGI_TIO_ERROR);
 }
 
Index: release/arch/ia64/sn/pci/pcibr/pcibr_provider.c
===
--- release.orig/arch/ia64/sn/pci/pcibr/pcibr_provider.c2007-08-22 
16:51:28.679240340 -0500
+++ release/arch/ia64/sn/pci/pcibr/pcibr_provider.c 2007-08-22 
18:41:19.100055471 -0500
@@ -145,6 +145,7 @@ pcibr_bus_fixup(struct pcibus_bussoft *p
printk(KERN_WARNING
   "pcibr cannot allocate interrupt for error handler\n");
}
+   sn_set_err_irq_affinity(SGI_PCIASIC_ERROR);
 
/* 
 * Update the Bridge with the "kernel" pagesize 
Index: release/arch/ia64/sn/pci/tioca_provider.c
===
--- release.orig/arch/ia64/sn/pci/tioca_provider.c  2007-08-22 
16:51:28.679240340 -0500
+++ release/arch/ia64/sn/pci/tioca_provider.c   2007-08-22 18:41:19.112056948 
-0500
@@ -654,6 +654,8 @@ tioca_bus_fixup(struct pcibus_bussoft *p
   __FUNCTION__, SGI_TIOCA_ERROR,
   (int)tioca_common->ca_common.bs_persist_busnum);
 
+   sn_set_err_irq_affinity(SGI_TIOCA_ERROR);
+
/* Setup locality information */
controller->node = tioca_kern->ca_closest_node;
return tioca_common;
Index: release/arch/ia64/sn/pci/tioce_provider.c
===
--- release.orig/arch/ia64/sn/pci/tioce_provider.c  2007-08-22 
16:51:28.679240340 -0500
+++ release/arch/ia64/sn/pci/tioce_provider.c   2007-08-22 18:41:19.124058426 
-0500
@@ -1034,6 +1034,7 @@ tioce_bus_fixup(struct pcibus_bussoft *p
   tioce_common->ce_pcibus.bs_persist_segment,
   tioce_common->ce_pcibus.bs_persist_busnum);
 
+   sn_set_err_irq_affinity(SGI_PCIASIC_ERROR);
return tioce_common;
 }
 
Index: release/include/asm-ia64/sn/sn_feature_sets.h
===
--- release.orig/include/asm-ia64/sn/sn_feature_sets.h  2007-08-22 
16:51:32.887758491 -0500
+++ release/include/asm-ia64/sn/sn_feature_sets.h   2007-08-22 
18:41:19.140060396 -0500
@@ -31,6 +31,7 @@ extern int sn_prom_feature_available(int
 #define PRF_PAL_CACHE_FLUSH_SAFE   0
 #define PRF_DEVICE_FLUSH_LIST  1
 #define PRF_HOTPLUG_SUPPORT2
+#define PRF_CPU_DISABLE_SUPPORT3
 
 /* 

RESEND [PATCH] - SN: Add support for CPU disable

2007-08-22 Thread John Keller
Add additional support for CPU disable on SN platforms.
Correctly setup the smp_affinity mask for I/O error IRQs.
Restrict the use of the feature to Altix 4000 and 450 systems
running with a CPU disable capable PROM, and do not allow disabling
of CPU 0.

Signed-off-by: John Keller [EMAIL PROTECTED]
---
Resend #2:
  Add severity levels to the new printk messages.

Resend #1:
  Code was incorrectly passing a logical, instead of physical,
  cpuid to set_irq_affinity_info(). Also, some cleanup per
  review comments.


 arch/ia64/kernel/smpboot.c  |6 +
 arch/ia64/sn/kernel/huberror.c  |   14 ---
 arch/ia64/sn/kernel/irq.c   |   15 
 arch/ia64/sn/kernel/sn2/sn2_smp.c   |   26 ++
 arch/ia64/sn/pci/pcibr/pcibr_provider.c |1 
 arch/ia64/sn/pci/tioca_provider.c   |2 +
 arch/ia64/sn/pci/tioce_provider.c   |1 
 include/asm-ia64/sn/arch.h  |1 
 include/asm-ia64/sn/intr.h  |1 
 include/asm-ia64/sn/sn_feature_sets.h   |1 
 10 files changed, 64 insertions(+), 4 deletions(-)


Index: release/arch/ia64/sn/kernel/huberror.c
===
--- release.orig/arch/ia64/sn/kernel/huberror.c 2007-08-22 16:51:28.667238863 
-0500
+++ release/arch/ia64/sn/kernel/huberror.c  2007-08-22 18:41:19.088053993 
-0500
@@ -185,11 +185,14 @@ void hubiio_crb_error_handler(struct hub
  */
 void hub_error_init(struct hubdev_info *hubdev_info)
 {
+
if (request_irq(SGI_II_ERROR, hub_eint_handler, IRQF_SHARED,
-   SN_hub_error, (void *)hubdev_info))
+   SN_hub_error, (void *)hubdev_info)) {
printk(hub_error_init: Failed to request_irq for 0x%p\n,
hubdev_info);
-   return;
+   return;
+   }
+   sn_set_err_irq_affinity(SGI_II_ERROR);
 }
 
 
@@ -202,11 +205,14 @@ void hub_error_init(struct hubdev_info *
  */
 void ice_error_init(struct hubdev_info *hubdev_info)
 {
+
 if (request_irq
 (SGI_TIO_ERROR, (void *)hub_eint_handler, IRQF_SHARED, 
SN_TIO_error,
- (void *)hubdev_info))
+ (void *)hubdev_info)) {
 printk(ice_error_init: request_irq() error hubdev_info 
0x%p\n,
hubdev_info);
-return;
+   return;
+   }
+   sn_set_err_irq_affinity(SGI_TIO_ERROR);
 }
 
Index: release/arch/ia64/sn/pci/pcibr/pcibr_provider.c
===
--- release.orig/arch/ia64/sn/pci/pcibr/pcibr_provider.c2007-08-22 
16:51:28.679240340 -0500
+++ release/arch/ia64/sn/pci/pcibr/pcibr_provider.c 2007-08-22 
18:41:19.100055471 -0500
@@ -145,6 +145,7 @@ pcibr_bus_fixup(struct pcibus_bussoft *p
printk(KERN_WARNING
   pcibr cannot allocate interrupt for error handler\n);
}
+   sn_set_err_irq_affinity(SGI_PCIASIC_ERROR);
 
/* 
 * Update the Bridge with the kernel pagesize 
Index: release/arch/ia64/sn/pci/tioca_provider.c
===
--- release.orig/arch/ia64/sn/pci/tioca_provider.c  2007-08-22 
16:51:28.679240340 -0500
+++ release/arch/ia64/sn/pci/tioca_provider.c   2007-08-22 18:41:19.112056948 
-0500
@@ -654,6 +654,8 @@ tioca_bus_fixup(struct pcibus_bussoft *p
   __FUNCTION__, SGI_TIOCA_ERROR,
   (int)tioca_common-ca_common.bs_persist_busnum);
 
+   sn_set_err_irq_affinity(SGI_TIOCA_ERROR);
+
/* Setup locality information */
controller-node = tioca_kern-ca_closest_node;
return tioca_common;
Index: release/arch/ia64/sn/pci/tioce_provider.c
===
--- release.orig/arch/ia64/sn/pci/tioce_provider.c  2007-08-22 
16:51:28.679240340 -0500
+++ release/arch/ia64/sn/pci/tioce_provider.c   2007-08-22 18:41:19.124058426 
-0500
@@ -1034,6 +1034,7 @@ tioce_bus_fixup(struct pcibus_bussoft *p
   tioce_common-ce_pcibus.bs_persist_segment,
   tioce_common-ce_pcibus.bs_persist_busnum);
 
+   sn_set_err_irq_affinity(SGI_PCIASIC_ERROR);
return tioce_common;
 }
 
Index: release/include/asm-ia64/sn/sn_feature_sets.h
===
--- release.orig/include/asm-ia64/sn/sn_feature_sets.h  2007-08-22 
16:51:32.887758491 -0500
+++ release/include/asm-ia64/sn/sn_feature_sets.h   2007-08-22 
18:41:19.140060396 -0500
@@ -31,6 +31,7 @@ extern int sn_prom_feature_available(int
 #define PRF_PAL_CACHE_FLUSH_SAFE   0
 #define PRF_DEVICE_FLUSH_LIST  1
 #define PRF_HOTPLUG_SUPPORT2
+#define PRF_CPU_DISABLE_SUPPORT3
 
 /* - OS Features ---*/
 
Index: release/arch/ia64/kernel/smpboot.c

RESEND [PATCH] - SN: Add support for CPU disable

2007-08-01 Thread John Keller
Add additional support for CPU disable on SN platforms.
Correctly setup the smp_affinity mask for I/O error IRQs.
Restrict the use of the feature to Altix 4000 and 450 systems
running with a CPU disable capable PROM, and do not allow disabling
of CPU 0.

Signed-off-by: John Keller <[EMAIL PROTECTED]>
---

Resend #1:
  Code was incorrectly passing a logical, instead of physical,
  cpuid to set_irq_affinity_info(). Also, some cleanup per
  review comments.


 arch/ia64/kernel/smpboot.c  |6 +
 arch/ia64/sn/kernel/huberror.c  |   14 +---
 arch/ia64/sn/kernel/irq.c   |   15 +
 arch/ia64/sn/kernel/sn2/sn2_smp.c   |   24 ++
 arch/ia64/sn/pci/pcibr/pcibr_provider.c |1 
 arch/ia64/sn/pci/tioca_provider.c   |2 +
 arch/ia64/sn/pci/tioce_provider.c   |1 
 include/asm-ia64/sn/arch.h  |1 
 include/asm-ia64/sn/intr.h  |1 
 include/asm-ia64/sn/sn_feature_sets.h   |1 
 10 files changed, 62 insertions(+), 4 deletions(-)


Index: linux-2.6/arch/ia64/sn/kernel/huberror.c
===
--- linux-2.6.orig/arch/ia64/sn/kernel/huberror.c   2007-08-01 
14:28:07.683651839 -0500
+++ linux-2.6/arch/ia64/sn/kernel/huberror.c2007-08-01 14:29:20.400606100 
-0500
@@ -185,11 +185,14 @@ void hubiio_crb_error_handler(struct hub
  */
 void hub_error_init(struct hubdev_info *hubdev_info)
 {
+
if (request_irq(SGI_II_ERROR, hub_eint_handler, IRQF_SHARED,
-   "SN_hub_error", (void *)hubdev_info))
+   "SN_hub_error", (void *)hubdev_info)) {
printk("hub_error_init: Failed to request_irq for 0x%p\n",
hubdev_info);
-   return;
+   return;
+   }
+   sn_set_err_irq_affinity(SGI_II_ERROR);
 }
 
 
@@ -202,11 +205,14 @@ void hub_error_init(struct hubdev_info *
  */
 void ice_error_init(struct hubdev_info *hubdev_info)
 {
+
 if (request_irq
 (SGI_TIO_ERROR, (void *)hub_eint_handler, IRQF_SHARED, 
"SN_TIO_error",
- (void *)hubdev_info))
+ (void *)hubdev_info)) {
 printk("ice_error_init: request_irq() error hubdev_info 
0x%p\n",
hubdev_info);
-return;
+   return;
+   }
+   sn_set_err_irq_affinity(SGI_TIO_ERROR);
 }
 
Index: linux-2.6/arch/ia64/sn/pci/pcibr/pcibr_provider.c
===
--- linux-2.6.orig/arch/ia64/sn/pci/pcibr/pcibr_provider.c  2007-08-01 
14:28:07.683651839 -0500
+++ linux-2.6/arch/ia64/sn/pci/pcibr/pcibr_provider.c   2007-08-01 
14:29:20.420608563 -0500
@@ -145,6 +145,7 @@ pcibr_bus_fixup(struct pcibus_bussoft *p
printk(KERN_WARNING
   "pcibr cannot allocate interrupt for error handler\n");
}
+   sn_set_err_irq_affinity(SGI_PCIASIC_ERROR);
 
/* 
 * Update the Bridge with the "kernel" pagesize 
Index: linux-2.6/arch/ia64/sn/pci/tioca_provider.c
===
--- linux-2.6.orig/arch/ia64/sn/pci/tioca_provider.c2007-08-01 
14:28:07.695653317 -0500
+++ linux-2.6/arch/ia64/sn/pci/tioca_provider.c 2007-08-01 14:29:20.432610041 
-0500
@@ -654,6 +654,8 @@ tioca_bus_fixup(struct pcibus_bussoft *p
   __FUNCTION__, SGI_TIOCA_ERROR,
   (int)tioca_common->ca_common.bs_persist_busnum);
 
+   sn_set_err_irq_affinity(SGI_TIOCA_ERROR);
+
/* Setup locality information */
controller->node = tioca_kern->ca_closest_node;
return tioca_common;
Index: linux-2.6/arch/ia64/sn/pci/tioce_provider.c
===
--- linux-2.6.orig/arch/ia64/sn/pci/tioce_provider.c2007-08-01 
14:28:07.695653317 -0500
+++ linux-2.6/arch/ia64/sn/pci/tioce_provider.c 2007-08-01 14:29:20.444611519 
-0500
@@ -1034,6 +1034,7 @@ tioce_bus_fixup(struct pcibus_bussoft *p
   tioce_common->ce_pcibus.bs_persist_segment,
   tioce_common->ce_pcibus.bs_persist_busnum);
 
+   sn_set_err_irq_affinity(SGI_PCIASIC_ERROR);
return tioce_common;
 }
 
Index: linux-2.6/include/asm-ia64/sn/sn_feature_sets.h
===
--- linux-2.6.orig/include/asm-ia64/sn/sn_feature_sets.h2007-08-01 
14:28:07.695653317 -0500
+++ linux-2.6/include/asm-ia64/sn/sn_feature_sets.h 2007-08-01 
14:29:20.456612997 -0500
@@ -31,6 +31,7 @@ extern int sn_prom_feature_available(int
 #define PRF_PAL_CACHE_FLUSH_SAFE   0
 #define PRF_DEVICE_FLUSH_LIST  1
 #define PRF_HOTPLUG_SUPPORT2
+#define PRF_CPU_DISABLE_SUPPORT3
 
 /* - 

RESEND [PATCH] - SN: Add support for CPU disable

2007-08-01 Thread John Keller
Add additional support for CPU disable on SN platforms.
Correctly setup the smp_affinity mask for I/O error IRQs.
Restrict the use of the feature to Altix 4000 and 450 systems
running with a CPU disable capable PROM, and do not allow disabling
of CPU 0.

Signed-off-by: John Keller [EMAIL PROTECTED]
---

Resend #1:
  Code was incorrectly passing a logical, instead of physical,
  cpuid to set_irq_affinity_info(). Also, some cleanup per
  review comments.


 arch/ia64/kernel/smpboot.c  |6 +
 arch/ia64/sn/kernel/huberror.c  |   14 +---
 arch/ia64/sn/kernel/irq.c   |   15 +
 arch/ia64/sn/kernel/sn2/sn2_smp.c   |   24 ++
 arch/ia64/sn/pci/pcibr/pcibr_provider.c |1 
 arch/ia64/sn/pci/tioca_provider.c   |2 +
 arch/ia64/sn/pci/tioce_provider.c   |1 
 include/asm-ia64/sn/arch.h  |1 
 include/asm-ia64/sn/intr.h  |1 
 include/asm-ia64/sn/sn_feature_sets.h   |1 
 10 files changed, 62 insertions(+), 4 deletions(-)


Index: linux-2.6/arch/ia64/sn/kernel/huberror.c
===
--- linux-2.6.orig/arch/ia64/sn/kernel/huberror.c   2007-08-01 
14:28:07.683651839 -0500
+++ linux-2.6/arch/ia64/sn/kernel/huberror.c2007-08-01 14:29:20.400606100 
-0500
@@ -185,11 +185,14 @@ void hubiio_crb_error_handler(struct hub
  */
 void hub_error_init(struct hubdev_info *hubdev_info)
 {
+
if (request_irq(SGI_II_ERROR, hub_eint_handler, IRQF_SHARED,
-   SN_hub_error, (void *)hubdev_info))
+   SN_hub_error, (void *)hubdev_info)) {
printk(hub_error_init: Failed to request_irq for 0x%p\n,
hubdev_info);
-   return;
+   return;
+   }
+   sn_set_err_irq_affinity(SGI_II_ERROR);
 }
 
 
@@ -202,11 +205,14 @@ void hub_error_init(struct hubdev_info *
  */
 void ice_error_init(struct hubdev_info *hubdev_info)
 {
+
 if (request_irq
 (SGI_TIO_ERROR, (void *)hub_eint_handler, IRQF_SHARED, 
SN_TIO_error,
- (void *)hubdev_info))
+ (void *)hubdev_info)) {
 printk(ice_error_init: request_irq() error hubdev_info 
0x%p\n,
hubdev_info);
-return;
+   return;
+   }
+   sn_set_err_irq_affinity(SGI_TIO_ERROR);
 }
 
Index: linux-2.6/arch/ia64/sn/pci/pcibr/pcibr_provider.c
===
--- linux-2.6.orig/arch/ia64/sn/pci/pcibr/pcibr_provider.c  2007-08-01 
14:28:07.683651839 -0500
+++ linux-2.6/arch/ia64/sn/pci/pcibr/pcibr_provider.c   2007-08-01 
14:29:20.420608563 -0500
@@ -145,6 +145,7 @@ pcibr_bus_fixup(struct pcibus_bussoft *p
printk(KERN_WARNING
   pcibr cannot allocate interrupt for error handler\n);
}
+   sn_set_err_irq_affinity(SGI_PCIASIC_ERROR);
 
/* 
 * Update the Bridge with the kernel pagesize 
Index: linux-2.6/arch/ia64/sn/pci/tioca_provider.c
===
--- linux-2.6.orig/arch/ia64/sn/pci/tioca_provider.c2007-08-01 
14:28:07.695653317 -0500
+++ linux-2.6/arch/ia64/sn/pci/tioca_provider.c 2007-08-01 14:29:20.432610041 
-0500
@@ -654,6 +654,8 @@ tioca_bus_fixup(struct pcibus_bussoft *p
   __FUNCTION__, SGI_TIOCA_ERROR,
   (int)tioca_common-ca_common.bs_persist_busnum);
 
+   sn_set_err_irq_affinity(SGI_TIOCA_ERROR);
+
/* Setup locality information */
controller-node = tioca_kern-ca_closest_node;
return tioca_common;
Index: linux-2.6/arch/ia64/sn/pci/tioce_provider.c
===
--- linux-2.6.orig/arch/ia64/sn/pci/tioce_provider.c2007-08-01 
14:28:07.695653317 -0500
+++ linux-2.6/arch/ia64/sn/pci/tioce_provider.c 2007-08-01 14:29:20.444611519 
-0500
@@ -1034,6 +1034,7 @@ tioce_bus_fixup(struct pcibus_bussoft *p
   tioce_common-ce_pcibus.bs_persist_segment,
   tioce_common-ce_pcibus.bs_persist_busnum);
 
+   sn_set_err_irq_affinity(SGI_PCIASIC_ERROR);
return tioce_common;
 }
 
Index: linux-2.6/include/asm-ia64/sn/sn_feature_sets.h
===
--- linux-2.6.orig/include/asm-ia64/sn/sn_feature_sets.h2007-08-01 
14:28:07.695653317 -0500
+++ linux-2.6/include/asm-ia64/sn/sn_feature_sets.h 2007-08-01 
14:29:20.456612997 -0500
@@ -31,6 +31,7 @@ extern int sn_prom_feature_available(int
 #define PRF_PAL_CACHE_FLUSH_SAFE   0
 #define PRF_DEVICE_FLUSH_LIST  1
 #define PRF_HOTPLUG_SUPPORT2
+#define PRF_CPU_DISABLE_SUPPORT3
 
 /* - OS Features ---*/
 
Index: linux-2.6/arch/ia64/kernel/smpboot.c

[PATCH] - SN: Add support for CPU disable

2007-07-31 Thread John Keller
Add additional support for CPU disable on SN platforms.
Correctly setup the smp_affinity mask for I/O error IRQs.
Restrict the use of the feature to Altix 4000 and 450 systems
running with a CPU disable capable PROM, and do not allow disabling
of CPU 0.

Signed-off-by: John Keller <[EMAIL PROTECTED]>
---

 arch/ia64/kernel/smpboot.c  |6 
 arch/ia64/sn/kernel/huberror.c  |   31 +++---
 arch/ia64/sn/kernel/sn2/sn2_smp.c   |   24 +
 arch/ia64/sn/pci/pcibr/pcibr_provider.c |   10 +++
 arch/ia64/sn/pci/tioca_provider.c   |   10 +++
 arch/ia64/sn/pci/tioce_provider.c   |   11 +++
 include/asm-ia64/sn/arch.h  |1 
 include/asm-ia64/sn/sn_feature_sets.h   |1 
 8 files changed, 90 insertions(+), 4 deletions(-)



Index: linux-2.6/arch/ia64/sn/kernel/huberror.c
===
--- linux-2.6.orig/arch/ia64/sn/kernel/huberror.c   2007-07-31 
09:09:55.414522005 -0500
+++ linux-2.6/arch/ia64/sn/kernel/huberror.c2007-07-31 09:38:14.634045360 
-0500
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "xtalk/xwidgetdev.h"
 #include "xtalk/hubdev.h"
 #include 
@@ -185,11 +186,22 @@ void hubiio_crb_error_handler(struct hub
  */
 void hub_error_init(struct hubdev_info *hubdev_info)
 {
+
if (request_irq(SGI_II_ERROR, hub_eint_handler, IRQF_SHARED,
-   "SN_hub_error", (void *)hubdev_info))
+   "SN_hub_error", (void *)hubdev_info)) {
printk("hub_error_init: Failed to request_irq for 0x%p\n",
hubdev_info);
-   return;
+   return;
+   }
+
+#ifdef CONFIG_SMP
+   /*
+* On systems which support CPU disabling (SHub2), all error interrupts
+* are targetted at the boot CPU.
+*/
+   if (is_shub2() && sn_prom_feature_available(PRF_CPU_DISABLE_SUPPORT))
+   set_irq_affinity_info(SGI_II_ERROR, 0, 0);
+#endif
 }
 
 
@@ -202,11 +214,22 @@ void hub_error_init(struct hubdev_info *
  */
 void ice_error_init(struct hubdev_info *hubdev_info)
 {
+
 if (request_irq
 (SGI_TIO_ERROR, (void *)hub_eint_handler, IRQF_SHARED, 
"SN_TIO_error",
- (void *)hubdev_info))
+ (void *)hubdev_info)) {
 printk("ice_error_init: request_irq() error hubdev_info 
0x%p\n",
hubdev_info);
-return;
+   return;
+   }
+
+#ifdef CONFIG_SMP
+   /*
+* On systems which support CPU disabling (SHub2), all error interrupts
+* are targetted at the boot CPU.
+*/
+   if (is_shub2() && sn_prom_feature_available(PRF_CPU_DISABLE_SUPPORT))
+   set_irq_affinity_info(SGI_TIO_ERROR, 0, 0);
+#endif
 }
 
Index: linux-2.6/arch/ia64/sn/pci/pcibr/pcibr_provider.c
===
--- linux-2.6.orig/arch/ia64/sn/pci/pcibr/pcibr_provider.c  2007-07-31 
09:09:55.422522987 -0500
+++ linux-2.6/arch/ia64/sn/pci/pcibr/pcibr_provider.c   2007-07-31 
09:38:14.662048814 -0500
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "xtalk/xwidgetdev.h"
 #include "xtalk/hubdev.h"
 
@@ -146,6 +147,15 @@ pcibr_bus_fixup(struct pcibus_bussoft *p
   "pcibr cannot allocate interrupt for error handler\n");
}
 
+#ifdef CONFIG_SMP
+   /*
+* On systems which support CPU disabling (SHub2), all error interrupts
+* are targetted at the boot CPU.
+*/
+   if (is_shub2() && sn_prom_feature_available(PRF_CPU_DISABLE_SUPPORT))
+   set_irq_affinity_info(SGI_PCIASIC_ERROR, 0, 0);
+#endif
+
/* 
 * Update the Bridge with the "kernel" pagesize 
 */
Index: linux-2.6/arch/ia64/sn/pci/tioca_provider.c
===
--- linux-2.6.orig/arch/ia64/sn/pci/tioca_provider.c2007-07-31 
09:09:55.422522987 -0500
+++ linux-2.6/arch/ia64/sn/pci/tioca_provider.c 2007-07-31 09:38:14.686051774 
-0500
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 
 u32 tioca_gart_found;
 EXPORT_SYMBOL(tioca_gart_found);   /* used by agp-sgi */
@@ -653,6 +654,15 @@ tioca_bus_fixup(struct pcibus_bussoft *p
   "Error interrupts won't be routed for TIOCA bus %d\n",
   __FUNCTION__, SGI_TIOCA_ERROR,
   (int)tioca_common->ca_common.bs_persist_busnum);
+#ifdef CONFIG_SMP
+   /*
+* On systems which support CPU disabling (SHub2), all error interrupts
+* are targetted at the boot CPU.
+*/
+   if (is_shub2() && sn_prom_feature_available(PRF_CPU_DISABLE_SUPPORT))
+   set_irq_affinity_info(SGI_T

[PATCH] - SN: Add support for CPU disable

2007-07-31 Thread John Keller
Add additional support for CPU disable on SN platforms.
Correctly setup the smp_affinity mask for I/O error IRQs.
Restrict the use of the feature to Altix 4000 and 450 systems
running with a CPU disable capable PROM, and do not allow disabling
of CPU 0.

Signed-off-by: John Keller [EMAIL PROTECTED]
---

 arch/ia64/kernel/smpboot.c  |6 
 arch/ia64/sn/kernel/huberror.c  |   31 +++---
 arch/ia64/sn/kernel/sn2/sn2_smp.c   |   24 +
 arch/ia64/sn/pci/pcibr/pcibr_provider.c |   10 +++
 arch/ia64/sn/pci/tioca_provider.c   |   10 +++
 arch/ia64/sn/pci/tioce_provider.c   |   11 +++
 include/asm-ia64/sn/arch.h  |1 
 include/asm-ia64/sn/sn_feature_sets.h   |1 
 8 files changed, 90 insertions(+), 4 deletions(-)



Index: linux-2.6/arch/ia64/sn/kernel/huberror.c
===
--- linux-2.6.orig/arch/ia64/sn/kernel/huberror.c   2007-07-31 
09:09:55.414522005 -0500
+++ linux-2.6/arch/ia64/sn/kernel/huberror.c2007-07-31 09:38:14.634045360 
-0500
@@ -14,6 +14,7 @@
 #include asm/sn/addrs.h
 #include asm/sn/shubio.h
 #include asm/sn/geo.h
+#include asm/sn/sn_feature_sets.h
 #include xtalk/xwidgetdev.h
 #include xtalk/hubdev.h
 #include asm/sn/bte.h
@@ -185,11 +186,22 @@ void hubiio_crb_error_handler(struct hub
  */
 void hub_error_init(struct hubdev_info *hubdev_info)
 {
+
if (request_irq(SGI_II_ERROR, hub_eint_handler, IRQF_SHARED,
-   SN_hub_error, (void *)hubdev_info))
+   SN_hub_error, (void *)hubdev_info)) {
printk(hub_error_init: Failed to request_irq for 0x%p\n,
hubdev_info);
-   return;
+   return;
+   }
+
+#ifdef CONFIG_SMP
+   /*
+* On systems which support CPU disabling (SHub2), all error interrupts
+* are targetted at the boot CPU.
+*/
+   if (is_shub2()  sn_prom_feature_available(PRF_CPU_DISABLE_SUPPORT))
+   set_irq_affinity_info(SGI_II_ERROR, 0, 0);
+#endif
 }
 
 
@@ -202,11 +214,22 @@ void hub_error_init(struct hubdev_info *
  */
 void ice_error_init(struct hubdev_info *hubdev_info)
 {
+
 if (request_irq
 (SGI_TIO_ERROR, (void *)hub_eint_handler, IRQF_SHARED, 
SN_TIO_error,
- (void *)hubdev_info))
+ (void *)hubdev_info)) {
 printk(ice_error_init: request_irq() error hubdev_info 
0x%p\n,
hubdev_info);
-return;
+   return;
+   }
+
+#ifdef CONFIG_SMP
+   /*
+* On systems which support CPU disabling (SHub2), all error interrupts
+* are targetted at the boot CPU.
+*/
+   if (is_shub2()  sn_prom_feature_available(PRF_CPU_DISABLE_SUPPORT))
+   set_irq_affinity_info(SGI_TIO_ERROR, 0, 0);
+#endif
 }
 
Index: linux-2.6/arch/ia64/sn/pci/pcibr/pcibr_provider.c
===
--- linux-2.6.orig/arch/ia64/sn/pci/pcibr/pcibr_provider.c  2007-07-31 
09:09:55.422522987 -0500
+++ linux-2.6/arch/ia64/sn/pci/pcibr/pcibr_provider.c   2007-07-31 
09:38:14.662048814 -0500
@@ -17,6 +17,7 @@
 #include asm/sn/sn_sal.h
 #include asm/sn/pic.h
 #include asm/sn/sn2/sn_hwperf.h
+#include asm/sn/sn_feature_sets.h
 #include xtalk/xwidgetdev.h
 #include xtalk/hubdev.h
 
@@ -146,6 +147,15 @@ pcibr_bus_fixup(struct pcibus_bussoft *p
   pcibr cannot allocate interrupt for error handler\n);
}
 
+#ifdef CONFIG_SMP
+   /*
+* On systems which support CPU disabling (SHub2), all error interrupts
+* are targetted at the boot CPU.
+*/
+   if (is_shub2()  sn_prom_feature_available(PRF_CPU_DISABLE_SUPPORT))
+   set_irq_affinity_info(SGI_PCIASIC_ERROR, 0, 0);
+#endif
+
/* 
 * Update the Bridge with the kernel pagesize 
 */
Index: linux-2.6/arch/ia64/sn/pci/tioca_provider.c
===
--- linux-2.6.orig/arch/ia64/sn/pci/tioca_provider.c2007-07-31 
09:09:55.422522987 -0500
+++ linux-2.6/arch/ia64/sn/pci/tioca_provider.c 2007-07-31 09:38:14.686051774 
-0500
@@ -15,6 +15,7 @@
 #include asm/sn/pcidev.h
 #include asm/sn/pcibus_provider_defs.h
 #include asm/sn/tioca_provider.h
+#include asm/sn/sn_feature_sets.h
 
 u32 tioca_gart_found;
 EXPORT_SYMBOL(tioca_gart_found);   /* used by agp-sgi */
@@ -653,6 +654,15 @@ tioca_bus_fixup(struct pcibus_bussoft *p
   Error interrupts won't be routed for TIOCA bus %d\n,
   __FUNCTION__, SGI_TIOCA_ERROR,
   (int)tioca_common-ca_common.bs_persist_busnum);
+#ifdef CONFIG_SMP
+   /*
+* On systems which support CPU disabling (SHub2), all error interrupts
+* are targetted at the boot CPU.
+*/
+   if (is_shub2()  sn_prom_feature_available(PRF_CPU_DISABLE_SUPPORT

[PATCH] - x86_64-add-ioapic-nmi-support-fix-3

2007-06-30 Thread John Keller
> 
> [adding Andi Kleen]
> 
> John Keller wrote:
> > Place all the IOACPI NMI support code under CONFIG_ACPI
> > to clear up build errors with certain configs.
> > 
> > Signed-off-by: John Keller <[EMAIL PROTECTED]>
> > ---
> 
> Is there some architectural reason that IO APIC NMI support should
> require ACPI?

OK, I guess standing alone this description was a bit misleading.
The code referred to here is the new code supporting the ACPI NMI SRC
structure that can be specified in the MADT. Without ACPI support this
code is not relevant. All the code touched by this patch was introduced
by eariler versions of this patchset.

This patch makes no changes to the workings of nmi_watchdog.

John


> 
> Is this a new requirement?  It seems like a step backwards to me.
> 
> 
> Documentation/nmi_watchdog.txt doesn't say anything about ACPI being
> needed.  It does say:
> 
> "For x86-64, the needed APIC is always compiled in, and the NMI watchdog is
> always enabled with I/O-APIC mode (nmi_watchdog=1). Currently, local APIC
> mode (nmi_watchdog=2) does not work on x86-64.
> 
> Using local APIC (nmi_watchdog=2) needs the first performance register, so
> you can't use it for other purposes (such as high precision performance
> profiling.) However, at least oprofile and the perfctr driver disable the
> local APIC NMI watchdog automatically."
> 
> 
> 
> >  arch/x86_64/kernel/io_apic.c |   77 +
> >  1 file changed, 40 insertions(+), 37 deletions(-)
> > 
> > 
> > Index: linux-2.6.22-rc6/arch/x86_64/kernel/io_apic.c
> > ===
> > --- linux-2.6.22-rc6.orig/arch/x86_64/kernel/io_apic.c  2007-06-29 
> > 08:56:46.0 -0500
> > +++ linux-2.6.22-rc6/arch/x86_64/kernel/io_apic.c   2007-06-29 
> > 10:28:08.109040333 -0500
> > @@ -76,6 +76,10 @@ struct irq_cfg irq_cfg[NR_IRQS] __read_m
> > [15] = { .domain = CPU_MASK_ALL, .vector = IRQ15_VECTOR, },
> >  };
> >  
> > +#ifdef CONFIG_ACPI
> > +static void setup_ioapic_nmi_irq(int ioapic, int pin,
> > +struct IO_APIC_route_entry *entry);
> > +#endif
> >  static int assign_irq_vector(int irq, cpumask_t mask);
> >  
> >  #define __apicdebuginit  __init
> > @@ -1168,9 +1172,6 @@ void __apicdebuginit print_PIC(void)
> >  
> >  #endif  /*  0  */
> >  
> > -static void setup_ioapic_nmi_irq(int ioapic, int pin,
> > -struct IO_APIC_route_entry *entry);
> > -
> >  static void __init enable_IO_APIC(void)
> >  {
> > union IO_APIC_reg_01 reg_01;
> > @@ -1211,8 +1212,10 @@ static void __init enable_IO_APIC(void)
> > continue;
> > }
> >  
> > +#ifdef CONFIG_ACPI
> > if (entry.delivery_mode == dest_NMI)
> > setup_ioapic_nmi_irq(apic, pin, );
> > +#endif
> > }
> > }
> >  
> > @@ -1586,40 +1589,6 @@ static void setup_nmi (void)
> > printk(" done.\n");
> >  }
> >  
> > -#define disable_nmi_ioapic  mask_IO_APIC_irq
> > -#define enable_nmi_ioapic   unmask_IO_APIC_irq
> > -
> > -static struct irq_chip nmi_ioapic_chip __read_mostly = {
> > -   .name   = "IO-APIC NMI",
> > -   .enable = enable_nmi_ioapic,
> > -   .disable= disable_nmi_ioapic,
> > -   .mask   = mask_IO_APIC_irq,
> > -   .unmask = unmask_IO_APIC_irq,
> > -};
> > -
> > -void __init setup_ioapic_nmi_irq(int apic, int pin,
> > -struct IO_APIC_route_entry *entry)
> > -{
> > -   int irq;
> > -
> > -   entry->dest_mode = INT_DEST_MODE;
> > -   entry->dest = cpu_mask_to_apicid(TARGET_CPUS);
> > -   ioapic_write_entry(apic, pin, *entry);
> > -
> > -   irq = mp_apic_pin_to_gsi(apic, pin);
> > -
> > -   /* Setup pin_2_irq[irq] entry */
> > -   add_pin_to_irq(irq, apic, pin);
> > -
> > -   irq_desc[irq].status = IRQ_NOREQUEST | IRQ_NO_BALANCING;
> > -   if (!entry->mask) {
> > -   irq_desc[irq].status &= ~IRQ_DISABLED;
> > -   irq_desc[irq].depth = 0;
> > -   }
> > -
> > -   set_irq_chip(irq, _ioapic_chip);
> > -}
> > -
> >  /*
> >   * This looks a bit hackish but it's about the only one way of sending
> >   * a few INTA cycles to 8259As and any associated glue logic.  ICR does
> > @@ -2282,6 +2251,40 @@ void __init io_apic_set_nm

[PATCH] - x86_64-add-ioapic-nmi-support-fix-3

2007-06-30 Thread John Keller
 
 [adding Andi Kleen]
 
 John Keller wrote:
  Place all the IOACPI NMI support code under CONFIG_ACPI
  to clear up build errors with certain configs.
  
  Signed-off-by: John Keller [EMAIL PROTECTED]
  ---
 
 Is there some architectural reason that IO APIC NMI support should
 require ACPI?

OK, I guess standing alone this description was a bit misleading.
The code referred to here is the new code supporting the ACPI NMI SRC
structure that can be specified in the MADT. Without ACPI support this
code is not relevant. All the code touched by this patch was introduced
by eariler versions of this patchset.

This patch makes no changes to the workings of nmi_watchdog.

John


 
 Is this a new requirement?  It seems like a step backwards to me.
 
 
 Documentation/nmi_watchdog.txt doesn't say anything about ACPI being
 needed.  It does say:
 
 For x86-64, the needed APIC is always compiled in, and the NMI watchdog is
 always enabled with I/O-APIC mode (nmi_watchdog=1). Currently, local APIC
 mode (nmi_watchdog=2) does not work on x86-64.
 
 Using local APIC (nmi_watchdog=2) needs the first performance register, so
 you can't use it for other purposes (such as high precision performance
 profiling.) However, at least oprofile and the perfctr driver disable the
 local APIC NMI watchdog automatically.
 
 
 
   arch/x86_64/kernel/io_apic.c |   77 +
   1 file changed, 40 insertions(+), 37 deletions(-)
  
  
  Index: linux-2.6.22-rc6/arch/x86_64/kernel/io_apic.c
  ===
  --- linux-2.6.22-rc6.orig/arch/x86_64/kernel/io_apic.c  2007-06-29 
  08:56:46.0 -0500
  +++ linux-2.6.22-rc6/arch/x86_64/kernel/io_apic.c   2007-06-29 
  10:28:08.109040333 -0500
  @@ -76,6 +76,10 @@ struct irq_cfg irq_cfg[NR_IRQS] __read_m
  [15] = { .domain = CPU_MASK_ALL, .vector = IRQ15_VECTOR, },
   };
   
  +#ifdef CONFIG_ACPI
  +static void setup_ioapic_nmi_irq(int ioapic, int pin,
  +struct IO_APIC_route_entry *entry);
  +#endif
   static int assign_irq_vector(int irq, cpumask_t mask);
   
   #define __apicdebuginit  __init
  @@ -1168,9 +1172,6 @@ void __apicdebuginit print_PIC(void)
   
   #endif  /*  0  */
   
  -static void setup_ioapic_nmi_irq(int ioapic, int pin,
  -struct IO_APIC_route_entry *entry);
  -
   static void __init enable_IO_APIC(void)
   {
  union IO_APIC_reg_01 reg_01;
  @@ -1211,8 +1212,10 @@ static void __init enable_IO_APIC(void)
  continue;
  }
   
  +#ifdef CONFIG_ACPI
  if (entry.delivery_mode == dest_NMI)
  setup_ioapic_nmi_irq(apic, pin, entry);
  +#endif
  }
  }
   
  @@ -1586,40 +1589,6 @@ static void setup_nmi (void)
  printk( done.\n);
   }
   
  -#define disable_nmi_ioapic  mask_IO_APIC_irq
  -#define enable_nmi_ioapic   unmask_IO_APIC_irq
  -
  -static struct irq_chip nmi_ioapic_chip __read_mostly = {
  -   .name   = IO-APIC NMI,
  -   .enable = enable_nmi_ioapic,
  -   .disable= disable_nmi_ioapic,
  -   .mask   = mask_IO_APIC_irq,
  -   .unmask = unmask_IO_APIC_irq,
  -};
  -
  -void __init setup_ioapic_nmi_irq(int apic, int pin,
  -struct IO_APIC_route_entry *entry)
  -{
  -   int irq;
  -
  -   entry-dest_mode = INT_DEST_MODE;
  -   entry-dest = cpu_mask_to_apicid(TARGET_CPUS);
  -   ioapic_write_entry(apic, pin, *entry);
  -
  -   irq = mp_apic_pin_to_gsi(apic, pin);
  -
  -   /* Setup pin_2_irq[irq] entry */
  -   add_pin_to_irq(irq, apic, pin);
  -
  -   irq_desc[irq].status = IRQ_NOREQUEST | IRQ_NO_BALANCING;
  -   if (!entry-mask) {
  -   irq_desc[irq].status = ~IRQ_DISABLED;
  -   irq_desc[irq].depth = 0;
  -   }
  -
  -   set_irq_chip(irq, nmi_ioapic_chip);
  -}
  -
   /*
* This looks a bit hackish but it's about the only one way of sending
* a few INTA cycles to 8259As and any associated glue logic.  ICR does
  @@ -2282,6 +2251,40 @@ void __init io_apic_set_nmi_src_irq(int 
  ioapic_write_entry(ioapic, pin, entry);
   }
   
  +#define disable_nmi_ioapic  mask_IO_APIC_irq
  +#define enable_nmi_ioapic   unmask_IO_APIC_irq
  +
  +static struct irq_chip nmi_ioapic_chip __read_mostly = {
  +   .name   = IO-APIC NMI,
  +   .enable = enable_nmi_ioapic,
  +   .disable= disable_nmi_ioapic,
  +   .mask   = mask_IO_APIC_irq,
  +   .unmask = unmask_IO_APIC_irq,
  +};
  +
  +void __init setup_ioapic_nmi_irq(int apic, int pin,
  +struct IO_APIC_route_entry *entry)
  +{
  +   int irq;
  +
  +   entry-dest_mode = INT_DEST_MODE;
  +   entry-dest = cpu_mask_to_apicid(TARGET_CPUS);
  +   ioapic_write_entry(apic, pin, *entry);
  +
  +   irq = mp_apic_pin_to_gsi(apic, pin);
  +
  +   /* Setup pin_2_irq[irq] entry */
  +   add_pin_to_irq(irq, apic, pin

[PATCH] - x86_64-add-ioapic-nmi-support-fix-3

2007-06-29 Thread John Keller
Place all the IOACPI NMI support code under CONFIG_ACPI
to clear up build errors with certain configs.

Signed-off-by: John Keller <[EMAIL PROTECTED]>
---

 arch/x86_64/kernel/io_apic.c |   77 +
 1 file changed, 40 insertions(+), 37 deletions(-)


Index: linux-2.6.22-rc6/arch/x86_64/kernel/io_apic.c
===
--- linux-2.6.22-rc6.orig/arch/x86_64/kernel/io_apic.c  2007-06-29 
08:56:46.0 -0500
+++ linux-2.6.22-rc6/arch/x86_64/kernel/io_apic.c   2007-06-29 
10:28:08.109040333 -0500
@@ -76,6 +76,10 @@ struct irq_cfg irq_cfg[NR_IRQS] __read_m
[15] = { .domain = CPU_MASK_ALL, .vector = IRQ15_VECTOR, },
 };
 
+#ifdef CONFIG_ACPI
+static void setup_ioapic_nmi_irq(int ioapic, int pin,
+struct IO_APIC_route_entry *entry);
+#endif
 static int assign_irq_vector(int irq, cpumask_t mask);
 
 #define __apicdebuginit  __init
@@ -1168,9 +1172,6 @@ void __apicdebuginit print_PIC(void)
 
 #endif  /*  0  */
 
-static void setup_ioapic_nmi_irq(int ioapic, int pin,
-struct IO_APIC_route_entry *entry);
-
 static void __init enable_IO_APIC(void)
 {
union IO_APIC_reg_01 reg_01;
@@ -1211,8 +1212,10 @@ static void __init enable_IO_APIC(void)
continue;
}
 
+#ifdef CONFIG_ACPI
if (entry.delivery_mode == dest_NMI)
setup_ioapic_nmi_irq(apic, pin, );
+#endif
}
}
 
@@ -1586,40 +1589,6 @@ static void setup_nmi (void)
printk(" done.\n");
 }
 
-#define disable_nmi_ioapic  mask_IO_APIC_irq
-#define enable_nmi_ioapic   unmask_IO_APIC_irq
-
-static struct irq_chip nmi_ioapic_chip __read_mostly = {
-   .name   = "IO-APIC NMI",
-   .enable = enable_nmi_ioapic,
-   .disable= disable_nmi_ioapic,
-   .mask   = mask_IO_APIC_irq,
-   .unmask = unmask_IO_APIC_irq,
-};
-
-void __init setup_ioapic_nmi_irq(int apic, int pin,
-struct IO_APIC_route_entry *entry)
-{
-   int irq;
-
-   entry->dest_mode = INT_DEST_MODE;
-   entry->dest = cpu_mask_to_apicid(TARGET_CPUS);
-   ioapic_write_entry(apic, pin, *entry);
-
-   irq = mp_apic_pin_to_gsi(apic, pin);
-
-   /* Setup pin_2_irq[irq] entry */
-   add_pin_to_irq(irq, apic, pin);
-
-   irq_desc[irq].status = IRQ_NOREQUEST | IRQ_NO_BALANCING;
-   if (!entry->mask) {
-   irq_desc[irq].status &= ~IRQ_DISABLED;
-   irq_desc[irq].depth = 0;
-   }
-
-   set_irq_chip(irq, _ioapic_chip);
-}
-
 /*
  * This looks a bit hackish but it's about the only one way of sending
  * a few INTA cycles to 8259As and any associated glue logic.  ICR does
@@ -2282,6 +2251,40 @@ void __init io_apic_set_nmi_src_irq(int 
ioapic_write_entry(ioapic, pin, entry);
 }
 
+#define disable_nmi_ioapic  mask_IO_APIC_irq
+#define enable_nmi_ioapic   unmask_IO_APIC_irq
+
+static struct irq_chip nmi_ioapic_chip __read_mostly = {
+   .name   = "IO-APIC NMI",
+   .enable = enable_nmi_ioapic,
+   .disable= disable_nmi_ioapic,
+   .mask   = mask_IO_APIC_irq,
+   .unmask = unmask_IO_APIC_irq,
+};
+
+void __init setup_ioapic_nmi_irq(int apic, int pin,
+struct IO_APIC_route_entry *entry)
+{
+   int irq;
+
+   entry->dest_mode = INT_DEST_MODE;
+   entry->dest = cpu_mask_to_apicid(TARGET_CPUS);
+   ioapic_write_entry(apic, pin, *entry);
+
+   irq = mp_apic_pin_to_gsi(apic, pin);
+
+   /* Setup pin_2_irq[irq] entry */
+   add_pin_to_irq(irq, apic, pin);
+
+   irq_desc[irq].status = IRQ_NOREQUEST | IRQ_NO_BALANCING;
+   if (!entry->mask) {
+   irq_desc[irq].status &= ~IRQ_DISABLED;
+   irq_desc[irq].depth = 0;
+   }
+
+   set_irq_chip(irq, _ioapic_chip);
+}
+
 #endif /* CONFIG_ACPI */
 
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RESEND: [PATCH] - SN: Correct ROM resource length for BIOS copy

2007-06-29 Thread John Keller
On SN systems, when setting the IORESOURCE_ROM_BIOS_COPY resource flag,
the resource length should be set to the actual size of the ROM image
so that a call to pci_map_rom() returns the correct size.

Signed-off-by: John Keller <[EMAIL PROTECTED]>
---

Resend #1 - correct format of block comment for pci_get_rom_size()


To avoid duplicate code, the image size calculation loop in
pci_map_rom() has been put into a separate function that both
pci_map_rom() and the SN specific code now call.

 arch/ia64/sn/kernel/io_acpi_init.c |   17 ++
 arch/ia64/sn/kernel/io_init.c  |   20 ++-
 drivers/pci/rom.c  |   73 ---
 include/linux/pci.h|1 
 4 files changed, 70 insertions(+), 41 deletions(-)


Index: linux-2.6/arch/ia64/sn/kernel/io_acpi_init.c
===
--- linux-2.6.orig/arch/ia64/sn/kernel/io_acpi_init.c   2007-06-28 
10:35:59.144045279 -0500
+++ linux-2.6/arch/ia64/sn/kernel/io_acpi_init.c2007-06-28 
10:44:38.034721316 -0500
@@ -418,7 +418,7 @@ sn_acpi_slot_fixup(struct pci_dev *dev)
void __iomem *addr;
struct pcidev_info *pcidev_info = NULL;
struct sn_irq_info *sn_irq_info = NULL;
-   size_t size;
+   size_t image_size, size;
 
if (sn_acpi_get_pcidev_info(dev, _info, _irq_info)) {
panic("%s:  Failure obtaining pcidev_info for %s\n",
@@ -428,17 +428,16 @@ sn_acpi_slot_fixup(struct pci_dev *dev)
if (pcidev_info->pdi_pio_mapped_addr[PCI_ROM_RESOURCE]) {
/*
 * A valid ROM image exists and has been shadowed by the
-* PROM. Setup the pci_dev ROM resource to point to
-* the shadowed copy.
+* PROM. Setup the pci_dev ROM resource with the address
+* of the shadowed copy, and the actual length of the ROM image.
 */
-   size = dev->resource[PCI_ROM_RESOURCE].end -
-   dev->resource[PCI_ROM_RESOURCE].start;
-   addr =
-ioremap(pcidev_info->pdi_pio_mapped_addr[PCI_ROM_RESOURCE],
-size);
+   size = pci_resource_len(dev, PCI_ROM_RESOURCE);
+   addr = 
ioremap(pcidev_info->pdi_pio_mapped_addr[PCI_ROM_RESOURCE],
+  size);
+   image_size = pci_get_rom_size(addr, size);
dev->resource[PCI_ROM_RESOURCE].start = (unsigned long) addr;
dev->resource[PCI_ROM_RESOURCE].end =
-   (unsigned long) addr + size;
+   (unsigned long) addr + image_size - 1;
dev->resource[PCI_ROM_RESOURCE].flags |= 
IORESOURCE_ROM_BIOS_COPY;
}
sn_pci_fixup_slot(dev, pcidev_info, sn_irq_info);
Index: linux-2.6/arch/ia64/sn/kernel/io_init.c
===
--- linux-2.6.orig/arch/ia64/sn/kernel/io_init.c2007-06-28 
10:35:59.144045279 -0500
+++ linux-2.6/arch/ia64/sn/kernel/io_init.c 2007-06-28 10:44:51.712380223 
-0500
@@ -259,9 +259,23 @@ sn_io_slot_fixup(struct pci_dev *dev)
insert_resource(_resource, >resource[idx]);
else
insert_resource(_resource, >resource[idx]);
-   /* If ROM, mark as shadowed in PROM */
-   if (idx == PCI_ROM_RESOURCE)
-   dev->resource[idx].flags |= IORESOURCE_ROM_BIOS_COPY;
+   /*
+* If ROM, set the actual ROM image size, and mark as
+* shadowed in PROM.
+*/
+   if (idx == PCI_ROM_RESOURCE) {
+   size_t image_size;
+   void __iomem *rom;
+
+   rom = ioremap(pci_resource_start(dev, PCI_ROM_RESOURCE),
+ size + 1);
+   image_size = pci_get_rom_size(rom, size + 1);
+   dev->resource[PCI_ROM_RESOURCE].end =
+   dev->resource[PCI_ROM_RESOURCE].start +
+   image_size - 1;
+   dev->resource[PCI_ROM_RESOURCE].flags |=
+IORESOURCE_ROM_BIOS_COPY;
+   }
}
/* Create a pci_window in the pci_controller struct for
 * each device resource.
Index: linux-2.6/drivers/pci/rom.c
===
--- linux-2.6.orig/drivers/pci/rom.c2007-06-28 10:36:02.956505069 -0500
+++ linux-2.6/drivers/pci/rom.c 2007-06-28 10:45:18.475626403 -0500
@@ -54,6 +54,49 @@ static void pci_disable_rom(struct pci_d
 }
 
 /**
+ * pci_get_rom_size - obtain the actual size of the ROM image
+ * @rom: kernel virtual pointer to im

[PATCH] - SN: Correct ROM resource length for BIOS copy

2007-06-29 Thread John Keller
On SN systems, when setting the IORESOURCE_ROM_BIOS_COPY resource flag,
the resource length should be set to the actual size of the ROM image
so that a call to pci_map_rom() returns the correct size.

Signed-off-by: John Keller <[EMAIL PROTECTED]>
---

To avoid duplicate code, the image size calculation loop in
pci_map_rom() has been put into a separate function that both
pci_map_rom() and the SN specific code now call.

 arch/ia64/sn/kernel/io_acpi_init.c |   17 ++
 arch/ia64/sn/kernel/io_init.c  |   20 ++-
 drivers/pci/rom.c  |   73 ---
 include/linux/pci.h|1 
 4 files changed, 70 insertions(+), 41 deletions(-)


Index: linux-2.6/arch/ia64/sn/kernel/io_acpi_init.c
===
--- linux-2.6.orig/arch/ia64/sn/kernel/io_acpi_init.c   2007-06-28 
10:35:59.144045279 -0500
+++ linux-2.6/arch/ia64/sn/kernel/io_acpi_init.c2007-06-28 
10:44:38.034721316 -0500
@@ -418,7 +418,7 @@ sn_acpi_slot_fixup(struct pci_dev *dev)
void __iomem *addr;
struct pcidev_info *pcidev_info = NULL;
struct sn_irq_info *sn_irq_info = NULL;
-   size_t size;
+   size_t image_size, size;
 
if (sn_acpi_get_pcidev_info(dev, _info, _irq_info)) {
panic("%s:  Failure obtaining pcidev_info for %s\n",
@@ -428,17 +428,16 @@ sn_acpi_slot_fixup(struct pci_dev *dev)
if (pcidev_info->pdi_pio_mapped_addr[PCI_ROM_RESOURCE]) {
/*
 * A valid ROM image exists and has been shadowed by the
-* PROM. Setup the pci_dev ROM resource to point to
-* the shadowed copy.
+* PROM. Setup the pci_dev ROM resource with the address
+* of the shadowed copy, and the actual length of the ROM image.
 */
-   size = dev->resource[PCI_ROM_RESOURCE].end -
-   dev->resource[PCI_ROM_RESOURCE].start;
-   addr =
-ioremap(pcidev_info->pdi_pio_mapped_addr[PCI_ROM_RESOURCE],
-size);
+   size = pci_resource_len(dev, PCI_ROM_RESOURCE);
+   addr = 
ioremap(pcidev_info->pdi_pio_mapped_addr[PCI_ROM_RESOURCE],
+  size);
+   image_size = pci_get_rom_size(addr, size);
dev->resource[PCI_ROM_RESOURCE].start = (unsigned long) addr;
dev->resource[PCI_ROM_RESOURCE].end =
-   (unsigned long) addr + size;
+   (unsigned long) addr + image_size - 1;
dev->resource[PCI_ROM_RESOURCE].flags |= 
IORESOURCE_ROM_BIOS_COPY;
}
sn_pci_fixup_slot(dev, pcidev_info, sn_irq_info);
Index: linux-2.6/arch/ia64/sn/kernel/io_init.c
===
--- linux-2.6.orig/arch/ia64/sn/kernel/io_init.c2007-06-28 
10:35:59.144045279 -0500
+++ linux-2.6/arch/ia64/sn/kernel/io_init.c 2007-06-28 10:44:51.712380223 
-0500
@@ -259,9 +259,23 @@ sn_io_slot_fixup(struct pci_dev *dev)
insert_resource(_resource, >resource[idx]);
else
insert_resource(_resource, >resource[idx]);
-   /* If ROM, mark as shadowed in PROM */
-   if (idx == PCI_ROM_RESOURCE)
-   dev->resource[idx].flags |= IORESOURCE_ROM_BIOS_COPY;
+   /*
+* If ROM, set the actual ROM image size, and mark as
+* shadowed in PROM.
+*/
+   if (idx == PCI_ROM_RESOURCE) {
+   size_t image_size;
+   void __iomem *rom;
+
+   rom = ioremap(pci_resource_start(dev, PCI_ROM_RESOURCE),
+ size + 1);
+   image_size = pci_get_rom_size(rom, size + 1);
+   dev->resource[PCI_ROM_RESOURCE].end =
+   dev->resource[PCI_ROM_RESOURCE].start +
+   image_size - 1;
+   dev->resource[PCI_ROM_RESOURCE].flags |=
+IORESOURCE_ROM_BIOS_COPY;
+   }
}
/* Create a pci_window in the pci_controller struct for
 * each device resource.
Index: linux-2.6/drivers/pci/rom.c
===
--- linux-2.6.orig/drivers/pci/rom.c2007-06-28 10:36:02.956505069 -0500
+++ linux-2.6/drivers/pci/rom.c 2007-06-28 10:45:18.475626403 -0500
@@ -54,6 +54,49 @@ static void pci_disable_rom(struct pci_d
 }
 
 /**
+ * pci_get_rom_size - obtain the actual size of the ROM image
+ * @rom: kernel virtual pointer to image of ROM
+ *  size: size of PCI window
+ *  return: size of actual ROM 

[PATCH] - SN: Correct ROM resource length for BIOS copy

2007-06-29 Thread John Keller
On SN systems, when setting the IORESOURCE_ROM_BIOS_COPY resource flag,
the resource length should be set to the actual size of the ROM image
so that a call to pci_map_rom() returns the correct size.

Signed-off-by: John Keller [EMAIL PROTECTED]
---

To avoid duplicate code, the image size calculation loop in
pci_map_rom() has been put into a separate function that both
pci_map_rom() and the SN specific code now call.

 arch/ia64/sn/kernel/io_acpi_init.c |   17 ++
 arch/ia64/sn/kernel/io_init.c  |   20 ++-
 drivers/pci/rom.c  |   73 ---
 include/linux/pci.h|1 
 4 files changed, 70 insertions(+), 41 deletions(-)


Index: linux-2.6/arch/ia64/sn/kernel/io_acpi_init.c
===
--- linux-2.6.orig/arch/ia64/sn/kernel/io_acpi_init.c   2007-06-28 
10:35:59.144045279 -0500
+++ linux-2.6/arch/ia64/sn/kernel/io_acpi_init.c2007-06-28 
10:44:38.034721316 -0500
@@ -418,7 +418,7 @@ sn_acpi_slot_fixup(struct pci_dev *dev)
void __iomem *addr;
struct pcidev_info *pcidev_info = NULL;
struct sn_irq_info *sn_irq_info = NULL;
-   size_t size;
+   size_t image_size, size;
 
if (sn_acpi_get_pcidev_info(dev, pcidev_info, sn_irq_info)) {
panic(%s:  Failure obtaining pcidev_info for %s\n,
@@ -428,17 +428,16 @@ sn_acpi_slot_fixup(struct pci_dev *dev)
if (pcidev_info-pdi_pio_mapped_addr[PCI_ROM_RESOURCE]) {
/*
 * A valid ROM image exists and has been shadowed by the
-* PROM. Setup the pci_dev ROM resource to point to
-* the shadowed copy.
+* PROM. Setup the pci_dev ROM resource with the address
+* of the shadowed copy, and the actual length of the ROM image.
 */
-   size = dev-resource[PCI_ROM_RESOURCE].end -
-   dev-resource[PCI_ROM_RESOURCE].start;
-   addr =
-ioremap(pcidev_info-pdi_pio_mapped_addr[PCI_ROM_RESOURCE],
-size);
+   size = pci_resource_len(dev, PCI_ROM_RESOURCE);
+   addr = 
ioremap(pcidev_info-pdi_pio_mapped_addr[PCI_ROM_RESOURCE],
+  size);
+   image_size = pci_get_rom_size(addr, size);
dev-resource[PCI_ROM_RESOURCE].start = (unsigned long) addr;
dev-resource[PCI_ROM_RESOURCE].end =
-   (unsigned long) addr + size;
+   (unsigned long) addr + image_size - 1;
dev-resource[PCI_ROM_RESOURCE].flags |= 
IORESOURCE_ROM_BIOS_COPY;
}
sn_pci_fixup_slot(dev, pcidev_info, sn_irq_info);
Index: linux-2.6/arch/ia64/sn/kernel/io_init.c
===
--- linux-2.6.orig/arch/ia64/sn/kernel/io_init.c2007-06-28 
10:35:59.144045279 -0500
+++ linux-2.6/arch/ia64/sn/kernel/io_init.c 2007-06-28 10:44:51.712380223 
-0500
@@ -259,9 +259,23 @@ sn_io_slot_fixup(struct pci_dev *dev)
insert_resource(ioport_resource, dev-resource[idx]);
else
insert_resource(iomem_resource, dev-resource[idx]);
-   /* If ROM, mark as shadowed in PROM */
-   if (idx == PCI_ROM_RESOURCE)
-   dev-resource[idx].flags |= IORESOURCE_ROM_BIOS_COPY;
+   /*
+* If ROM, set the actual ROM image size, and mark as
+* shadowed in PROM.
+*/
+   if (idx == PCI_ROM_RESOURCE) {
+   size_t image_size;
+   void __iomem *rom;
+
+   rom = ioremap(pci_resource_start(dev, PCI_ROM_RESOURCE),
+ size + 1);
+   image_size = pci_get_rom_size(rom, size + 1);
+   dev-resource[PCI_ROM_RESOURCE].end =
+   dev-resource[PCI_ROM_RESOURCE].start +
+   image_size - 1;
+   dev-resource[PCI_ROM_RESOURCE].flags |=
+IORESOURCE_ROM_BIOS_COPY;
+   }
}
/* Create a pci_window in the pci_controller struct for
 * each device resource.
Index: linux-2.6/drivers/pci/rom.c
===
--- linux-2.6.orig/drivers/pci/rom.c2007-06-28 10:36:02.956505069 -0500
+++ linux-2.6/drivers/pci/rom.c 2007-06-28 10:45:18.475626403 -0500
@@ -54,6 +54,49 @@ static void pci_disable_rom(struct pci_d
 }
 
 /**
+ * pci_get_rom_size - obtain the actual size of the ROM image
+ * @rom: kernel virtual pointer to image of ROM
+ *  size: size of PCI window
+ *  return: size of actual ROM image
+ *
+ * Determine the actual length of the ROM

RESEND: [PATCH] - SN: Correct ROM resource length for BIOS copy

2007-06-29 Thread John Keller
On SN systems, when setting the IORESOURCE_ROM_BIOS_COPY resource flag,
the resource length should be set to the actual size of the ROM image
so that a call to pci_map_rom() returns the correct size.

Signed-off-by: John Keller [EMAIL PROTECTED]
---

Resend #1 - correct format of block comment for pci_get_rom_size()


To avoid duplicate code, the image size calculation loop in
pci_map_rom() has been put into a separate function that both
pci_map_rom() and the SN specific code now call.

 arch/ia64/sn/kernel/io_acpi_init.c |   17 ++
 arch/ia64/sn/kernel/io_init.c  |   20 ++-
 drivers/pci/rom.c  |   73 ---
 include/linux/pci.h|1 
 4 files changed, 70 insertions(+), 41 deletions(-)


Index: linux-2.6/arch/ia64/sn/kernel/io_acpi_init.c
===
--- linux-2.6.orig/arch/ia64/sn/kernel/io_acpi_init.c   2007-06-28 
10:35:59.144045279 -0500
+++ linux-2.6/arch/ia64/sn/kernel/io_acpi_init.c2007-06-28 
10:44:38.034721316 -0500
@@ -418,7 +418,7 @@ sn_acpi_slot_fixup(struct pci_dev *dev)
void __iomem *addr;
struct pcidev_info *pcidev_info = NULL;
struct sn_irq_info *sn_irq_info = NULL;
-   size_t size;
+   size_t image_size, size;
 
if (sn_acpi_get_pcidev_info(dev, pcidev_info, sn_irq_info)) {
panic(%s:  Failure obtaining pcidev_info for %s\n,
@@ -428,17 +428,16 @@ sn_acpi_slot_fixup(struct pci_dev *dev)
if (pcidev_info-pdi_pio_mapped_addr[PCI_ROM_RESOURCE]) {
/*
 * A valid ROM image exists and has been shadowed by the
-* PROM. Setup the pci_dev ROM resource to point to
-* the shadowed copy.
+* PROM. Setup the pci_dev ROM resource with the address
+* of the shadowed copy, and the actual length of the ROM image.
 */
-   size = dev-resource[PCI_ROM_RESOURCE].end -
-   dev-resource[PCI_ROM_RESOURCE].start;
-   addr =
-ioremap(pcidev_info-pdi_pio_mapped_addr[PCI_ROM_RESOURCE],
-size);
+   size = pci_resource_len(dev, PCI_ROM_RESOURCE);
+   addr = 
ioremap(pcidev_info-pdi_pio_mapped_addr[PCI_ROM_RESOURCE],
+  size);
+   image_size = pci_get_rom_size(addr, size);
dev-resource[PCI_ROM_RESOURCE].start = (unsigned long) addr;
dev-resource[PCI_ROM_RESOURCE].end =
-   (unsigned long) addr + size;
+   (unsigned long) addr + image_size - 1;
dev-resource[PCI_ROM_RESOURCE].flags |= 
IORESOURCE_ROM_BIOS_COPY;
}
sn_pci_fixup_slot(dev, pcidev_info, sn_irq_info);
Index: linux-2.6/arch/ia64/sn/kernel/io_init.c
===
--- linux-2.6.orig/arch/ia64/sn/kernel/io_init.c2007-06-28 
10:35:59.144045279 -0500
+++ linux-2.6/arch/ia64/sn/kernel/io_init.c 2007-06-28 10:44:51.712380223 
-0500
@@ -259,9 +259,23 @@ sn_io_slot_fixup(struct pci_dev *dev)
insert_resource(ioport_resource, dev-resource[idx]);
else
insert_resource(iomem_resource, dev-resource[idx]);
-   /* If ROM, mark as shadowed in PROM */
-   if (idx == PCI_ROM_RESOURCE)
-   dev-resource[idx].flags |= IORESOURCE_ROM_BIOS_COPY;
+   /*
+* If ROM, set the actual ROM image size, and mark as
+* shadowed in PROM.
+*/
+   if (idx == PCI_ROM_RESOURCE) {
+   size_t image_size;
+   void __iomem *rom;
+
+   rom = ioremap(pci_resource_start(dev, PCI_ROM_RESOURCE),
+ size + 1);
+   image_size = pci_get_rom_size(rom, size + 1);
+   dev-resource[PCI_ROM_RESOURCE].end =
+   dev-resource[PCI_ROM_RESOURCE].start +
+   image_size - 1;
+   dev-resource[PCI_ROM_RESOURCE].flags |=
+IORESOURCE_ROM_BIOS_COPY;
+   }
}
/* Create a pci_window in the pci_controller struct for
 * each device resource.
Index: linux-2.6/drivers/pci/rom.c
===
--- linux-2.6.orig/drivers/pci/rom.c2007-06-28 10:36:02.956505069 -0500
+++ linux-2.6/drivers/pci/rom.c 2007-06-28 10:45:18.475626403 -0500
@@ -54,6 +54,49 @@ static void pci_disable_rom(struct pci_d
 }
 
 /**
+ * pci_get_rom_size - obtain the actual size of the ROM image
+ * @rom: kernel virtual pointer to image of ROM
+ * @size: size of PCI window
+ *  return: size

[PATCH] - x86_64-add-ioapic-nmi-support-fix-3

2007-06-29 Thread John Keller
Place all the IOACPI NMI support code under CONFIG_ACPI
to clear up build errors with certain configs.

Signed-off-by: John Keller [EMAIL PROTECTED]
---

 arch/x86_64/kernel/io_apic.c |   77 +
 1 file changed, 40 insertions(+), 37 deletions(-)


Index: linux-2.6.22-rc6/arch/x86_64/kernel/io_apic.c
===
--- linux-2.6.22-rc6.orig/arch/x86_64/kernel/io_apic.c  2007-06-29 
08:56:46.0 -0500
+++ linux-2.6.22-rc6/arch/x86_64/kernel/io_apic.c   2007-06-29 
10:28:08.109040333 -0500
@@ -76,6 +76,10 @@ struct irq_cfg irq_cfg[NR_IRQS] __read_m
[15] = { .domain = CPU_MASK_ALL, .vector = IRQ15_VECTOR, },
 };
 
+#ifdef CONFIG_ACPI
+static void setup_ioapic_nmi_irq(int ioapic, int pin,
+struct IO_APIC_route_entry *entry);
+#endif
 static int assign_irq_vector(int irq, cpumask_t mask);
 
 #define __apicdebuginit  __init
@@ -1168,9 +1172,6 @@ void __apicdebuginit print_PIC(void)
 
 #endif  /*  0  */
 
-static void setup_ioapic_nmi_irq(int ioapic, int pin,
-struct IO_APIC_route_entry *entry);
-
 static void __init enable_IO_APIC(void)
 {
union IO_APIC_reg_01 reg_01;
@@ -1211,8 +1212,10 @@ static void __init enable_IO_APIC(void)
continue;
}
 
+#ifdef CONFIG_ACPI
if (entry.delivery_mode == dest_NMI)
setup_ioapic_nmi_irq(apic, pin, entry);
+#endif
}
}
 
@@ -1586,40 +1589,6 @@ static void setup_nmi (void)
printk( done.\n);
 }
 
-#define disable_nmi_ioapic  mask_IO_APIC_irq
-#define enable_nmi_ioapic   unmask_IO_APIC_irq
-
-static struct irq_chip nmi_ioapic_chip __read_mostly = {
-   .name   = IO-APIC NMI,
-   .enable = enable_nmi_ioapic,
-   .disable= disable_nmi_ioapic,
-   .mask   = mask_IO_APIC_irq,
-   .unmask = unmask_IO_APIC_irq,
-};
-
-void __init setup_ioapic_nmi_irq(int apic, int pin,
-struct IO_APIC_route_entry *entry)
-{
-   int irq;
-
-   entry-dest_mode = INT_DEST_MODE;
-   entry-dest = cpu_mask_to_apicid(TARGET_CPUS);
-   ioapic_write_entry(apic, pin, *entry);
-
-   irq = mp_apic_pin_to_gsi(apic, pin);
-
-   /* Setup pin_2_irq[irq] entry */
-   add_pin_to_irq(irq, apic, pin);
-
-   irq_desc[irq].status = IRQ_NOREQUEST | IRQ_NO_BALANCING;
-   if (!entry-mask) {
-   irq_desc[irq].status = ~IRQ_DISABLED;
-   irq_desc[irq].depth = 0;
-   }
-
-   set_irq_chip(irq, nmi_ioapic_chip);
-}
-
 /*
  * This looks a bit hackish but it's about the only one way of sending
  * a few INTA cycles to 8259As and any associated glue logic.  ICR does
@@ -2282,6 +2251,40 @@ void __init io_apic_set_nmi_src_irq(int 
ioapic_write_entry(ioapic, pin, entry);
 }
 
+#define disable_nmi_ioapic  mask_IO_APIC_irq
+#define enable_nmi_ioapic   unmask_IO_APIC_irq
+
+static struct irq_chip nmi_ioapic_chip __read_mostly = {
+   .name   = IO-APIC NMI,
+   .enable = enable_nmi_ioapic,
+   .disable= disable_nmi_ioapic,
+   .mask   = mask_IO_APIC_irq,
+   .unmask = unmask_IO_APIC_irq,
+};
+
+void __init setup_ioapic_nmi_irq(int apic, int pin,
+struct IO_APIC_route_entry *entry)
+{
+   int irq;
+
+   entry-dest_mode = INT_DEST_MODE;
+   entry-dest = cpu_mask_to_apicid(TARGET_CPUS);
+   ioapic_write_entry(apic, pin, *entry);
+
+   irq = mp_apic_pin_to_gsi(apic, pin);
+
+   /* Setup pin_2_irq[irq] entry */
+   add_pin_to_irq(irq, apic, pin);
+
+   irq_desc[irq].status = IRQ_NOREQUEST | IRQ_NO_BALANCING;
+   if (!entry-mask) {
+   irq_desc[irq].status = ~IRQ_DISABLED;
+   irq_desc[irq].depth = 0;
+   }
+
+   set_irq_chip(irq, nmi_ioapic_chip);
+}
+
 #endif /* CONFIG_ACPI */
 
 
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: 2.6.22-rc6-mm1: io_apic build error

2007-06-28 Thread John Keller
> 
> On Thu, 28 Jun 2007 13:09:21 -0700
> Randy Dunlap <[EMAIL PROTECTED]> wrote:
> 
> > On Thu, 28 Jun 2007 03:43:21 -0700 Andrew Morton wrote:
> > 
> > > 
> > > ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.22-rc6/2.6.22-rc6-mm1/
> > 
> > 
> > on x86_64, with CONFIG_PCI disabled, CONFIG_PM disabled,
> > hence CONFIG_ACPI disabled:
> > 
> > 
> > arch/x86_64/kernel/built-in.o: In function `setup_IO_APIC':
> > (.init.text+0x4ef7): undefined reference to `mp_apic_pin_to_gsi'
> > make: *** [.tmp_vmlinux1] Error 1
> > 
> 
> hm, it's not immediately obvious how to fix that so I'll ask John to do
> repairs, please. 
> 

OK, I'll take a look.

John
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: 2.6.22-rc6-mm1: io_apic build error

2007-06-28 Thread John Keller
 
 On Thu, 28 Jun 2007 13:09:21 -0700
 Randy Dunlap [EMAIL PROTECTED] wrote:
 
  On Thu, 28 Jun 2007 03:43:21 -0700 Andrew Morton wrote:
  
   
   ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.22-rc6/2.6.22-rc6-mm1/
  
  
  on x86_64, with CONFIG_PCI disabled, CONFIG_PM disabled,
  hence CONFIG_ACPI disabled:
  
  
  arch/x86_64/kernel/built-in.o: In function `setup_IO_APIC':
  (.init.text+0x4ef7): undefined reference to `mp_apic_pin_to_gsi'
  make: *** [.tmp_vmlinux1] Error 1
  
 
 hm, it's not immediately obvious how to fix that so I'll ask John to do
 repairs, please. 
 

OK, I'll take a look.

John
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] - Add IOAPIC NMI support on x86_64

2007-06-19 Thread John Keller
> 
> >  In our specific case, a loadable driver will register to process
> >  the NMI generated by a timer device on the IOAPIC pin. The driver
> >  will need to unmask/mask the NMI interrupt at init/exit time.
> > 
> >  The timer NMI interrupt will be used to synchronize cluster nodes.
> 
> We normally don't add hooks which are only useful for out of tree
> modules unless there is a very good justification for it.

Sorry, I should have been clearer on all this.
The syncsched driver referred to here, is not anything proprietary,
and will be added to the community tree later this year.

I'm just looking to get some of the completed support code (this patch)
submitted, any issues resolved, and accepted prior to that. 


John


> 
> -Andi
> 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] - Add IOAPIC NMI support on x86_64

2007-06-19 Thread John Keller
>
> John Keller <[EMAIL PROTECTED]> writes:
>
> > Add support for IOAPIC NMI interrupts on x86_64.
> >
> > Changes include the following:
> >
> >   - Obtain the NMI IOAPIC info via an ACPI NMI SRC structure that is
> > part of the MADT, and program the IOAPIC redirection register.
> > The NMI SRC struct will contain the GSI of the NMI interrupt.
> >
> >   - Setup irq_desc[] and irq_2_pin[] entries for the NMI interrupt irq,
> > which will be used by the generic mask/unmask routines. This will
> > allow a driver to enable/disable the NMI interrupt via
> > enable/disable_irq().
>
> What's the motivation for this patch?

 In our specific case, a loadable driver will register to process
 the NMI generated by a timer device on the IOAPIC pin. The driver
 will need to unmask/mask the NMI interrupt at init/exit time.

 The timer NMI interrupt will be used to synchronize cluster nodes.

John


>
> -Andi
>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] - Add IOAPIC NMI support on x86_64

2007-06-19 Thread John Keller

 John Keller [EMAIL PROTECTED] writes:

  Add support for IOAPIC NMI interrupts on x86_64.
 
  Changes include the following:
 
- Obtain the NMI IOAPIC info via an ACPI NMI SRC structure that is
  part of the MADT, and program the IOAPIC redirection register.
  The NMI SRC struct will contain the GSI of the NMI interrupt.
 
- Setup irq_desc[] and irq_2_pin[] entries for the NMI interrupt irq,
  which will be used by the generic mask/unmask routines. This will
  allow a driver to enable/disable the NMI interrupt via
  enable/disable_irq().

 What's the motivation for this patch?

 In our specific case, a loadable driver will register to process
 the NMI generated by a timer device on the IOAPIC pin. The driver
 will need to unmask/mask the NMI interrupt at init/exit time.

 The timer NMI interrupt will be used to synchronize cluster nodes.

John



 -Andi


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] - Add IOAPIC NMI support on x86_64

2007-06-19 Thread John Keller
 
   In our specific case, a loadable driver will register to process
   the NMI generated by a timer device on the IOAPIC pin. The driver
   will need to unmask/mask the NMI interrupt at init/exit time.
  
   The timer NMI interrupt will be used to synchronize cluster nodes.
 
 We normally don't add hooks which are only useful for out of tree
 modules unless there is a very good justification for it.

Sorry, I should have been clearer on all this.
The syncsched driver referred to here, is not anything proprietary,
and will be added to the community tree later this year.

I'm just looking to get some of the completed support code (this patch)
submitted, any issues resolved, and accepted prior to that. 


John


 
 -Andi
 

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] - Add IOAPIC NMI support on x86_64

2007-06-18 Thread John Keller
Add support for IOAPIC NMI interrupts on x86_64.

Changes include the following:

  - Obtain the NMI IOAPIC info via an ACPI NMI SRC structure that is
part of the MADT, and program the IOAPIC redirection register.
The NMI SRC struct will contain the GSI of the NMI interrupt.

  - Setup irq_desc[] and irq_2_pin[] entries for the NMI interrupt irq,
which will be used by the generic mask/unmask routines. This will
allow a driver to enable/disable the NMI interrupt via
enable/disable_irq().


Signed-off-by: John Keller <[EMAIL PROTECTED]>
---

 arch/i386/kernel/acpi/boot.c |3 -
 arch/i386/kernel/mpparse.c   |5 ++
 arch/x86_64/kernel/io_apic.c |   78 ++---
 arch/x86_64/kernel/mpparse.c |   44 ++
 include/asm-i386/mpspec.h|1
 include/asm-x86_64/io_apic.h |1
 include/asm-x86_64/mpspec.h  |2
 7 files changed, 127 insertions(+), 7 deletions(-)


Index: linux-2.6/arch/x86_64/kernel/io_apic.c
===
--- linux-2.6.orig/arch/x86_64/kernel/io_apic.c 2007-06-13 13:14:44.0 
-0500
+++ linux-2.6/arch/x86_64/kernel/io_apic.c  2007-06-13 13:15:21.0 
-0500
@@ -349,9 +349,12 @@ static void clear_IO_APIC_pin(unsigned i
 {
struct IO_APIC_route_entry entry;
 
-   /* Check delivery_mode to be sure we're not clearing an SMI pin */
+   /* Check delivery_mode to be sure we're not clearing an SMI
+* or NMI pin.
+*/
entry = ioapic_read_entry(apic, pin);
-   if (entry.delivery_mode == dest_SMI)
+   if ((entry.delivery_mode == dest_SMI) ||
+   (entry.delivery_mode == dest_NMI))
return;
/*
 * Disable it in the IO-APIC irq-routing table:
@@ -1139,10 +1142,14 @@ void __apicdebuginit print_PIC(void)
 
 #endif  /*  0  */
 
+static void setup_ioapic_nmi_irq(int ioapic, int pin,
+struct IO_APIC_route_entry *entry);
+
 static void __init enable_IO_APIC(void)
 {
union IO_APIC_reg_01 reg_01;
int i8259_apic, i8259_pin;
+   int found_i8259 = 0;
int i, apic;
unsigned long flags;
 
@@ -1162,7 +1169,7 @@ static void __init enable_IO_APIC(void)
}
for(apic = 0; apic < nr_ioapics; apic++) {
int pin;
-   /* See if any of the pins is in ExtINT mode */
+   /* See if any of the pins are in ExtINT  or NMI mode */
for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) {
struct IO_APIC_route_entry entry;
entry = ioapic_read_entry(apic, pin);
@@ -1170,14 +1177,20 @@ static void __init enable_IO_APIC(void)
/* If the interrupt line is enabled and in ExtInt mode
 * I have found the pin where the i8259 is connected.
 */
-   if ((entry.mask == 0) && (entry.delivery_mode == 
dest_ExtINT)) {
+   if (!found_i8259 && (entry.mask == 0) &&
+   (entry.delivery_mode == dest_ExtINT)) {
ioapic_i8259.apic = apic;
ioapic_i8259.pin  = pin;
-   goto found_i8259;
+   found_i8259 = 1;
+   continue;
+   }
+
+   if (entry.delivery_mode == dest_NMI) {
+   setup_ioapic_nmi_irq(apic, pin, );
}
}
}
- found_i8259:
+
/* Look to see what if the MP table has reported the ExtINT */
i8259_pin  = find_isa_irq_pin(0, mp_ExtINT);
i8259_apic = find_isa_irq_apic(0, mp_ExtINT);
@@ -1519,6 +1532,40 @@ static void setup_nmi (void)
printk(" done.\n");
 }
 
+#define disable_nmi_ioapic  mask_IO_APIC_irq
+#define enable_nmi_ioapic   unmask_IO_APIC_irq
+
+static struct irq_chip nmi_ioapic_chip __read_mostly = {
+   .name   = "IO-APIC NMI",
+   .enable = enable_nmi_ioapic,
+   .disable= disable_nmi_ioapic,
+   .mask   = mask_IO_APIC_irq,
+   .unmask = unmask_IO_APIC_irq,
+};
+
+void __init setup_ioapic_nmi_irq(int apic, int pin,
+struct IO_APIC_route_entry *entry)
+{
+   int irq;
+
+   entry->dest_mode = INT_DEST_MODE;
+   entry->dest = cpu_mask_to_apicid(TARGET_CPUS);
+   ioapic_write_entry(apic, pin, *entry);
+
+   irq = mp_apic_pin_to_gsi(apic, pin);
+
+   /* Setup pin_2_irq[irq] entry */
+   add_pin_to_irq(irq, apic, pin);
+
+   irq_desc[irq].status = IRQ_NOREQUEST | IRQ_NO_BALANCING;
+   if (!entry->mask) {
+   irq_desc[irq].status &= ~IRQ_DISABLED;
+   irq_desc[irq].depth = 0;
+   }
+
+   set_irq_chip(irq

[PATCH] - Add IOAPIC NMI support on x86_64

2007-06-18 Thread John Keller
Add support for IOAPIC NMI interrupts on x86_64.

Changes include the following:

  - Obtain the NMI IOAPIC info via an ACPI NMI SRC structure that is
part of the MADT, and program the IOAPIC redirection register.
The NMI SRC struct will contain the GSI of the NMI interrupt.

  - Setup irq_desc[] and irq_2_pin[] entries for the NMI interrupt irq,
which will be used by the generic mask/unmask routines. This will
allow a driver to enable/disable the NMI interrupt via
enable/disable_irq().


Signed-off-by: John Keller [EMAIL PROTECTED]
---

 arch/i386/kernel/acpi/boot.c |3 -
 arch/i386/kernel/mpparse.c   |5 ++
 arch/x86_64/kernel/io_apic.c |   78 ++---
 arch/x86_64/kernel/mpparse.c |   44 ++
 include/asm-i386/mpspec.h|1
 include/asm-x86_64/io_apic.h |1
 include/asm-x86_64/mpspec.h  |2
 7 files changed, 127 insertions(+), 7 deletions(-)


Index: linux-2.6/arch/x86_64/kernel/io_apic.c
===
--- linux-2.6.orig/arch/x86_64/kernel/io_apic.c 2007-06-13 13:14:44.0 
-0500
+++ linux-2.6/arch/x86_64/kernel/io_apic.c  2007-06-13 13:15:21.0 
-0500
@@ -349,9 +349,12 @@ static void clear_IO_APIC_pin(unsigned i
 {
struct IO_APIC_route_entry entry;
 
-   /* Check delivery_mode to be sure we're not clearing an SMI pin */
+   /* Check delivery_mode to be sure we're not clearing an SMI
+* or NMI pin.
+*/
entry = ioapic_read_entry(apic, pin);
-   if (entry.delivery_mode == dest_SMI)
+   if ((entry.delivery_mode == dest_SMI) ||
+   (entry.delivery_mode == dest_NMI))
return;
/*
 * Disable it in the IO-APIC irq-routing table:
@@ -1139,10 +1142,14 @@ void __apicdebuginit print_PIC(void)
 
 #endif  /*  0  */
 
+static void setup_ioapic_nmi_irq(int ioapic, int pin,
+struct IO_APIC_route_entry *entry);
+
 static void __init enable_IO_APIC(void)
 {
union IO_APIC_reg_01 reg_01;
int i8259_apic, i8259_pin;
+   int found_i8259 = 0;
int i, apic;
unsigned long flags;
 
@@ -1162,7 +1169,7 @@ static void __init enable_IO_APIC(void)
}
for(apic = 0; apic  nr_ioapics; apic++) {
int pin;
-   /* See if any of the pins is in ExtINT mode */
+   /* See if any of the pins are in ExtINT  or NMI mode */
for (pin = 0; pin  nr_ioapic_registers[apic]; pin++) {
struct IO_APIC_route_entry entry;
entry = ioapic_read_entry(apic, pin);
@@ -1170,14 +1177,20 @@ static void __init enable_IO_APIC(void)
/* If the interrupt line is enabled and in ExtInt mode
 * I have found the pin where the i8259 is connected.
 */
-   if ((entry.mask == 0)  (entry.delivery_mode == 
dest_ExtINT)) {
+   if (!found_i8259  (entry.mask == 0) 
+   (entry.delivery_mode == dest_ExtINT)) {
ioapic_i8259.apic = apic;
ioapic_i8259.pin  = pin;
-   goto found_i8259;
+   found_i8259 = 1;
+   continue;
+   }
+
+   if (entry.delivery_mode == dest_NMI) {
+   setup_ioapic_nmi_irq(apic, pin, entry);
}
}
}
- found_i8259:
+
/* Look to see what if the MP table has reported the ExtINT */
i8259_pin  = find_isa_irq_pin(0, mp_ExtINT);
i8259_apic = find_isa_irq_apic(0, mp_ExtINT);
@@ -1519,6 +1532,40 @@ static void setup_nmi (void)
printk( done.\n);
 }
 
+#define disable_nmi_ioapic  mask_IO_APIC_irq
+#define enable_nmi_ioapic   unmask_IO_APIC_irq
+
+static struct irq_chip nmi_ioapic_chip __read_mostly = {
+   .name   = IO-APIC NMI,
+   .enable = enable_nmi_ioapic,
+   .disable= disable_nmi_ioapic,
+   .mask   = mask_IO_APIC_irq,
+   .unmask = unmask_IO_APIC_irq,
+};
+
+void __init setup_ioapic_nmi_irq(int apic, int pin,
+struct IO_APIC_route_entry *entry)
+{
+   int irq;
+
+   entry-dest_mode = INT_DEST_MODE;
+   entry-dest = cpu_mask_to_apicid(TARGET_CPUS);
+   ioapic_write_entry(apic, pin, *entry);
+
+   irq = mp_apic_pin_to_gsi(apic, pin);
+
+   /* Setup pin_2_irq[irq] entry */
+   add_pin_to_irq(irq, apic, pin);
+
+   irq_desc[irq].status = IRQ_NOREQUEST | IRQ_NO_BALANCING;
+   if (!entry-mask) {
+   irq_desc[irq].status = ~IRQ_DISABLED;
+   irq_desc[irq].depth = 0;
+   }
+
+   set_irq_chip(irq, nmi_ioapic_chip);
+}
+
 /*
  * This looks a bit hackish but it's about the only one way

Re: [PATCH Resend] - SN: validate smp_affinity mask on intr

2007-05-08 Thread John Keller
> 
> On Tue, 8 May 2007 13:14:26 -0700
> "Luck, Tony" <[EMAIL PROTECTED]> wrote:
> 
> > > It had a dopey little bug:
> > >
> > > -#define is_affinity_mask_valid() 1
> > > +#define is_affinity_mask_valid(val) 1
> > 
> > That would fix warnings on non-ia64 systems (which is
> > a step in the right direction).  But on ia64 I have
> > the
> > 
> > #define is_affinity_mask_valid is_affinity_mask_valid
> > 
> > in play at that point, so I have a real function call
> > which doesn't have an in-scope declaration, so I get:
> > 
> > kernel/irq/proc.c:49: warning: implicit declaration of function 
> > `is_affinity_mask_valid'
> > 
> 
> hm, I wonder if John sent the right patch.


I sure thought I had sent the right patch, but obviously not.
Thanks for setting things straight.

John


> 
> The obvious fix fixes it up for me:
> 
> --- 
> a/include/asm-ia64/irq.h~sn-validate-smp_affinity-mask-on-intr-redirect-fix-2
> +++ a/include/asm-ia64/irq.h
> @@ -11,6 +11,9 @@
>   * 02/29/00 D.Mosberger  moved most things into hw_irq.h
>   */
>  
> +#include 
> +#include 
> +
>  #define NR_IRQS  256
>  #define NR_IRQ_VECTORS   NR_IRQS
>  
> @@ -29,6 +32,7 @@ extern void disable_irq (unsigned int);
>  extern void disable_irq_nosync (unsigned int);
>  extern void enable_irq (unsigned int);
>  extern void set_irq_affinity_info (unsigned int irq, int dest, int redir);
> +bool is_affinity_mask_valid(cpumask_t cpumask);
>  
>  #define is_affinity_mask_valid is_affinity_mask_valid
>  
> _
> 
> but the new includes are always a worry.
> 
> We need the cpumask.h include because we went and created a stupid typedef.
>  I think at the time we did this because cpumask_t could optionally be a
> plain old "long".  However I don't think we ended up doing that so we could
> now do:
> 
> -typedef struct { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t;
> +typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t;
> 
> and then we can forward-declare `struct cpumask' in include/asm-ia64/irq.h
> rather than adding the nested include.
> 
> 
> 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH Resend] - SN: validate smp_affinity mask on intr redirect

2007-05-08 Thread John Keller
On SN, only allow one bit to be set in the smp_affinty mask
when redirecting an interrupt. Currently setting multiple
bits is allowed, but only the first bit is used in
determining the CPU to redirect to. This has caused confusion
among some customers.

Signed-off-by: John Keller <[EMAIL PROTECTED]>
---

Patch reworked as per Andrew's option "b".


 arch/ia64/kernel/irq.c |   11 +++
 include/asm-ia64/irq.h |2 ++
 kernel/irq/proc.c  |7 +++
 3 files changed, 20 insertions(+)


Index: linux-2.6/kernel/irq/proc.c
===
--- linux-2.6.orig/kernel/irq/proc.c2007-05-02 09:03:14.440820500 -0500
+++ linux-2.6/kernel/irq/proc.c 2007-05-03 16:00:46.746068614 -0500
@@ -27,6 +27,10 @@ static int irq_affinity_read_proc(char *
return len;
 }
 
+#ifndef is_affinity_mask_valid
+#define is_affinity_mask_valid() 1
+#endif
+
 int no_irq_affinity;
 static int irq_affinity_write_proc(struct file *file, const char __user 
*buffer,
   unsigned long count, void *data)
@@ -42,6 +46,9 @@ static int irq_affinity_write_proc(struc
if (err)
return err;
 
+   if (!is_affinity_mask_valid(new_value))
+   return -EINVAL;
+
/*
 * Do not allow disabling IRQs completely - it's a too easy
 * way to make the system unusable accidentally :-) At least
Index: linux-2.6/arch/ia64/kernel/irq.c
===
--- linux-2.6.orig/arch/ia64/kernel/irq.c   2007-05-02 09:03:14.504828433 
-0500
+++ linux-2.6/arch/ia64/kernel/irq.c2007-05-03 16:15:47.604740039 -0500
@@ -104,6 +104,17 @@ void set_irq_affinity_info (unsigned int
irq_redir[irq] = (char) (redir & 0xff);
}
 }
+
+bool is_affinity_mask_valid(cpumask_t cpumask)
+{
+   if (ia64_platform_is("sn2")) {
+   /* Only allow one CPU to be specified in the smp_affinity mask 
*/
+   if (cpus_weight(cpumask) != 1)
+   return false;
+   }
+   return true;
+}
+
 #endif /* CONFIG_SMP */
 
 #ifdef CONFIG_HOTPLUG_CPU
Index: linux-2.6/include/asm-ia64/irq.h
===
--- linux-2.6.orig/include/asm-ia64/irq.h   2007-05-02 09:03:14.640845292 
-0500
+++ linux-2.6/include/asm-ia64/irq.h2007-05-03 16:02:31.934991908 -0500
@@ -30,4 +30,6 @@ extern void disable_irq_nosync (unsigned
 extern void enable_irq (unsigned int);
 extern void set_irq_affinity_info (unsigned int irq, int dest, int redir);
 
+#define is_affinity_mask_valid is_affinity_mask_valid
+
 #endif /* _ASM_IA64_IRQ_H */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH Resend] - SN: validate smp_affinity mask on intr redirect

2007-05-08 Thread John Keller
On SN, only allow one bit to be set in the smp_affinty mask
when redirecting an interrupt. Currently setting multiple
bits is allowed, but only the first bit is used in
determining the CPU to redirect to. This has caused confusion
among some customers.

Signed-off-by: John Keller [EMAIL PROTECTED]
---

Patch reworked as per Andrew's option b.


 arch/ia64/kernel/irq.c |   11 +++
 include/asm-ia64/irq.h |2 ++
 kernel/irq/proc.c  |7 +++
 3 files changed, 20 insertions(+)


Index: linux-2.6/kernel/irq/proc.c
===
--- linux-2.6.orig/kernel/irq/proc.c2007-05-02 09:03:14.440820500 -0500
+++ linux-2.6/kernel/irq/proc.c 2007-05-03 16:00:46.746068614 -0500
@@ -27,6 +27,10 @@ static int irq_affinity_read_proc(char *
return len;
 }
 
+#ifndef is_affinity_mask_valid
+#define is_affinity_mask_valid() 1
+#endif
+
 int no_irq_affinity;
 static int irq_affinity_write_proc(struct file *file, const char __user 
*buffer,
   unsigned long count, void *data)
@@ -42,6 +46,9 @@ static int irq_affinity_write_proc(struc
if (err)
return err;
 
+   if (!is_affinity_mask_valid(new_value))
+   return -EINVAL;
+
/*
 * Do not allow disabling IRQs completely - it's a too easy
 * way to make the system unusable accidentally :-) At least
Index: linux-2.6/arch/ia64/kernel/irq.c
===
--- linux-2.6.orig/arch/ia64/kernel/irq.c   2007-05-02 09:03:14.504828433 
-0500
+++ linux-2.6/arch/ia64/kernel/irq.c2007-05-03 16:15:47.604740039 -0500
@@ -104,6 +104,17 @@ void set_irq_affinity_info (unsigned int
irq_redir[irq] = (char) (redir  0xff);
}
 }
+
+bool is_affinity_mask_valid(cpumask_t cpumask)
+{
+   if (ia64_platform_is(sn2)) {
+   /* Only allow one CPU to be specified in the smp_affinity mask 
*/
+   if (cpus_weight(cpumask) != 1)
+   return false;
+   }
+   return true;
+}
+
 #endif /* CONFIG_SMP */
 
 #ifdef CONFIG_HOTPLUG_CPU
Index: linux-2.6/include/asm-ia64/irq.h
===
--- linux-2.6.orig/include/asm-ia64/irq.h   2007-05-02 09:03:14.640845292 
-0500
+++ linux-2.6/include/asm-ia64/irq.h2007-05-03 16:02:31.934991908 -0500
@@ -30,4 +30,6 @@ extern void disable_irq_nosync (unsigned
 extern void enable_irq (unsigned int);
 extern void set_irq_affinity_info (unsigned int irq, int dest, int redir);
 
+#define is_affinity_mask_valid is_affinity_mask_valid
+
 #endif /* _ASM_IA64_IRQ_H */
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH Resend] - SN: validate smp_affinity mask on intr

2007-05-08 Thread John Keller
 
 On Tue, 8 May 2007 13:14:26 -0700
 Luck, Tony [EMAIL PROTECTED] wrote:
 
   It had a dopey little bug:
  
   -#define is_affinity_mask_valid() 1
   +#define is_affinity_mask_valid(val) 1
  
  That would fix warnings on non-ia64 systems (which is
  a step in the right direction).  But on ia64 I have
  the
  
  #define is_affinity_mask_valid is_affinity_mask_valid
  
  in play at that point, so I have a real function call
  which doesn't have an in-scope declaration, so I get:
  
  kernel/irq/proc.c:49: warning: implicit declaration of function 
  `is_affinity_mask_valid'
  
 
 hm, I wonder if John sent the right patch.


I sure thought I had sent the right patch, but obviously not.
Thanks for setting things straight.

John


 
 The obvious fix fixes it up for me:
 
 --- 
 a/include/asm-ia64/irq.h~sn-validate-smp_affinity-mask-on-intr-redirect-fix-2
 +++ a/include/asm-ia64/irq.h
 @@ -11,6 +11,9 @@
   * 02/29/00 D.Mosberger  moved most things into hw_irq.h
   */
  
 +#include linux/types.h
 +#include linux/cpumask.h
 +
  #define NR_IRQS  256
  #define NR_IRQ_VECTORS   NR_IRQS
  
 @@ -29,6 +32,7 @@ extern void disable_irq (unsigned int);
  extern void disable_irq_nosync (unsigned int);
  extern void enable_irq (unsigned int);
  extern void set_irq_affinity_info (unsigned int irq, int dest, int redir);
 +bool is_affinity_mask_valid(cpumask_t cpumask);
  
  #define is_affinity_mask_valid is_affinity_mask_valid
  
 _
 
 but the new includes are always a worry.
 
 We need the cpumask.h include because we went and created a stupid typedef.
  I think at the time we did this because cpumask_t could optionally be a
 plain old long.  However I don't think we ended up doing that so we could
 now do:
 
 -typedef struct { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t;
 +typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t;
 
 and then we can forward-declare `struct cpumask' in include/asm-ia64/irq.h
 rather than adding the nested include.
 
 
 

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] - SN: validate smp_affinity mask on intr redirect

2007-05-03 Thread John Keller
I'll rework as per your suggestions.

Thanks,
John


> 
> On Thu, 03 May 2007 07:56:02 -0500
> John Keller <[EMAIL PROTECTED]> wrote:
> 
> > On SN, only allow one bit to be set in the smp_affinty mask
> > when redirecting an interrupt. Currently setting multiple
> > bits is allowed, but only the first bit is used in
> > determining the CPU to redirect to. This has caused confusion
> > among some customers.
> > 
> > ...
> >
> > +
> > +int is_affinity_mask_valid(cpumask_t cpumask)
> > +{
> > +   if (ia64_platform_is("sn2")) {
> > +   /* Only allow one CPU to be specified in the smp_affinity mask 
> > */
> > +   if (cpus_weight(cpumask) != 1)
> > +   return 0;
> > +   }
> > +   return 1;
> > +}
> 
> A bool returning true or false would be appropriate, given this function's
> clearly-boolean name.
> 
> > +#ifndef ARCH_HAS_IRQ_AFFINITY_VALIDATION
> > +#define is_irq_affinity_mask_valid(cpumask) 1
> > +#endif
> 
> The ARCH_HAS_FOO things have never been popular.  There are a couple of
> alternatives going around:
> 
> a) use __attribute__((weak)) and provide a one-line default
>implementation in kernel/irq/proc.c.  This has a small runtime cost.
> 
> b) In include/asm-ia64/irq.h, do
> 
>#define is_affinity_mask_valid is_affinity_mask_valid
> 
>and in kernel/irq/proc.c do
> 
>#ifndef is_affinity_mask_valid
>#define is_affinity_mask_valid() 1
>#endif
> 
>This has minimal runtime cost, but is a bit tricksy.
> 
>It has the advantage that it doesn't introduce some new identifier
>which needs to be maintained.
> 
> >  extern int irq_set_affinity(unsigned int irq, cpumask_t cpumask);
> >  extern int irq_can_set_affinity(unsigned int irq);
> >  
> > Index: linux-2.6/include/asm-ia64/irq.h
> > ===
> > --- linux-2.6.orig/include/asm-ia64/irq.h   2007-05-01 15:47:01.660643076 
> > -0500
> > +++ linux-2.6/include/asm-ia64/irq.h2007-05-01 15:48:42.729254805 
> > -0500
> > @@ -11,6 +11,8 @@
> >   * 02/29/00 D.Mosbergermoved most things into hw_irq.h
> >   */
> >  
> > +#include 
> > +
> 
> This is the sort of inclusion which tends to make things blow up.  I trust
> this was carefully compile-tested.
> 
> With a) above, the is_affinity_mask_valid() declaration would be in a
> different header.  With b), no additional include will be needed.
> 
> >  #define NR_IRQS256
> >  #define NR_IRQ_VECTORS NR_IRQS
> >  
> > @@ -30,4 +32,7 @@ extern void disable_irq_nosync (unsigned
> >  extern void enable_irq (unsigned int);
> >  extern void set_irq_affinity_info (unsigned int irq, int dest, int redir);
> >  
> > +#define ARCH_HAS_IRQ_AFFINITY_VALIDATION
> > +extern int is_affinity_mask_valid(cpumask_t cpumask);
> > +
> 
> 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] - SN: validate smp_affinity mask on intr redirect

2007-05-03 Thread John Keller
On SN, only allow one bit to be set in the smp_affinty mask
when redirecting an interrupt. Currently setting multiple
bits is allowed, but only the first bit is used in
determining the CPU to redirect to. This has caused confusion
among some customers.

Signed-off-by: John Keller <[EMAIL PROTECTED]>
---

 arch/ia64/kernel/irq.c |   11 +++
 include/asm-ia64/irq.h |5 +
 include/linux/irq.h|4 
 kernel/irq/proc.c  |3 +++
 4 files changed, 23 insertions(+)


Index: linux-2.6/kernel/irq/proc.c
===
--- linux-2.6.orig/kernel/irq/proc.c2007-05-01 15:47:01.656642577 -0500
+++ linux-2.6/kernel/irq/proc.c 2007-05-01 15:48:42.725254306 -0500
@@ -42,6 +42,9 @@ static int irq_affinity_write_proc(struc
if (err)
return err;
 
+   if (!is_affinity_mask_valid(new_value))
+   return -EINVAL;
+
/*
 * Do not allow disabling IRQs completely - it's a too easy
 * way to make the system unusable accidentally :-) At least
Index: linux-2.6/arch/ia64/kernel/irq.c
===
--- linux-2.6.orig/arch/ia64/kernel/irq.c   2007-05-01 15:47:01.660643076 
-0500
+++ linux-2.6/arch/ia64/kernel/irq.c2007-05-01 15:48:42.729254805 -0500
@@ -104,6 +104,17 @@ void set_irq_affinity_info (unsigned int
irq_redir[irq] = (char) (redir & 0xff);
}
 }
+
+int is_affinity_mask_valid(cpumask_t cpumask)
+{
+   if (ia64_platform_is("sn2")) {
+   /* Only allow one CPU to be specified in the smp_affinity mask 
*/
+   if (cpus_weight(cpumask) != 1)
+   return 0;
+   }
+   return 1;
+}
+
 #endif /* CONFIG_SMP */
 
 #ifdef CONFIG_HOTPLUG_CPU
Index: linux-2.6/include/linux/irq.h
===
--- linux-2.6.orig/include/linux/irq.h  2007-05-01 15:47:01.660643076 -0500
+++ linux-2.6/include/linux/irq.h   2007-05-01 15:48:42.729254805 -0500
@@ -228,6 +228,10 @@ static inline void set_pending_irq(unsig
 
 #endif /* CONFIG_GENERIC_PENDING_IRQ */
 
+#ifndef ARCH_HAS_IRQ_AFFINITY_VALIDATION
+#define is_irq_affinity_mask_valid(cpumask) 1
+#endif
+
 extern int irq_set_affinity(unsigned int irq, cpumask_t cpumask);
 extern int irq_can_set_affinity(unsigned int irq);
 
Index: linux-2.6/include/asm-ia64/irq.h
===
--- linux-2.6.orig/include/asm-ia64/irq.h   2007-05-01 15:47:01.660643076 
-0500
+++ linux-2.6/include/asm-ia64/irq.h2007-05-01 15:48:42.729254805 -0500
@@ -11,6 +11,8 @@
  * 02/29/00 D.Mosbergermoved most things into hw_irq.h
  */
 
+#include 
+
 #define NR_IRQS256
 #define NR_IRQ_VECTORS NR_IRQS
 
@@ -30,4 +32,7 @@ extern void disable_irq_nosync (unsigned
 extern void enable_irq (unsigned int);
 extern void set_irq_affinity_info (unsigned int irq, int dest, int redir);
 
+#define ARCH_HAS_IRQ_AFFINITY_VALIDATION
+extern int is_affinity_mask_valid(cpumask_t cpumask);
+
 #endif /* _ASM_IA64_IRQ_H */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] - SN: validate smp_affinity mask on intr redirect

2007-05-03 Thread John Keller
On SN, only allow one bit to be set in the smp_affinty mask
when redirecting an interrupt. Currently setting multiple
bits is allowed, but only the first bit is used in
determining the CPU to redirect to. This has caused confusion
among some customers.

Signed-off-by: John Keller [EMAIL PROTECTED]
---

 arch/ia64/kernel/irq.c |   11 +++
 include/asm-ia64/irq.h |5 +
 include/linux/irq.h|4 
 kernel/irq/proc.c  |3 +++
 4 files changed, 23 insertions(+)


Index: linux-2.6/kernel/irq/proc.c
===
--- linux-2.6.orig/kernel/irq/proc.c2007-05-01 15:47:01.656642577 -0500
+++ linux-2.6/kernel/irq/proc.c 2007-05-01 15:48:42.725254306 -0500
@@ -42,6 +42,9 @@ static int irq_affinity_write_proc(struc
if (err)
return err;
 
+   if (!is_affinity_mask_valid(new_value))
+   return -EINVAL;
+
/*
 * Do not allow disabling IRQs completely - it's a too easy
 * way to make the system unusable accidentally :-) At least
Index: linux-2.6/arch/ia64/kernel/irq.c
===
--- linux-2.6.orig/arch/ia64/kernel/irq.c   2007-05-01 15:47:01.660643076 
-0500
+++ linux-2.6/arch/ia64/kernel/irq.c2007-05-01 15:48:42.729254805 -0500
@@ -104,6 +104,17 @@ void set_irq_affinity_info (unsigned int
irq_redir[irq] = (char) (redir  0xff);
}
 }
+
+int is_affinity_mask_valid(cpumask_t cpumask)
+{
+   if (ia64_platform_is(sn2)) {
+   /* Only allow one CPU to be specified in the smp_affinity mask 
*/
+   if (cpus_weight(cpumask) != 1)
+   return 0;
+   }
+   return 1;
+}
+
 #endif /* CONFIG_SMP */
 
 #ifdef CONFIG_HOTPLUG_CPU
Index: linux-2.6/include/linux/irq.h
===
--- linux-2.6.orig/include/linux/irq.h  2007-05-01 15:47:01.660643076 -0500
+++ linux-2.6/include/linux/irq.h   2007-05-01 15:48:42.729254805 -0500
@@ -228,6 +228,10 @@ static inline void set_pending_irq(unsig
 
 #endif /* CONFIG_GENERIC_PENDING_IRQ */
 
+#ifndef ARCH_HAS_IRQ_AFFINITY_VALIDATION
+#define is_irq_affinity_mask_valid(cpumask) 1
+#endif
+
 extern int irq_set_affinity(unsigned int irq, cpumask_t cpumask);
 extern int irq_can_set_affinity(unsigned int irq);
 
Index: linux-2.6/include/asm-ia64/irq.h
===
--- linux-2.6.orig/include/asm-ia64/irq.h   2007-05-01 15:47:01.660643076 
-0500
+++ linux-2.6/include/asm-ia64/irq.h2007-05-01 15:48:42.729254805 -0500
@@ -11,6 +11,8 @@
  * 02/29/00 D.Mosbergermoved most things into hw_irq.h
  */
 
+#include linux/cpumask.h
+
 #define NR_IRQS256
 #define NR_IRQ_VECTORS NR_IRQS
 
@@ -30,4 +32,7 @@ extern void disable_irq_nosync (unsigned
 extern void enable_irq (unsigned int);
 extern void set_irq_affinity_info (unsigned int irq, int dest, int redir);
 
+#define ARCH_HAS_IRQ_AFFINITY_VALIDATION
+extern int is_affinity_mask_valid(cpumask_t cpumask);
+
 #endif /* _ASM_IA64_IRQ_H */
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] - SN: validate smp_affinity mask on intr redirect

2007-05-03 Thread John Keller
I'll rework as per your suggestions.

Thanks,
John


 
 On Thu, 03 May 2007 07:56:02 -0500
 John Keller [EMAIL PROTECTED] wrote:
 
  On SN, only allow one bit to be set in the smp_affinty mask
  when redirecting an interrupt. Currently setting multiple
  bits is allowed, but only the first bit is used in
  determining the CPU to redirect to. This has caused confusion
  among some customers.
  
  ...
 
  +
  +int is_affinity_mask_valid(cpumask_t cpumask)
  +{
  +   if (ia64_platform_is(sn2)) {
  +   /* Only allow one CPU to be specified in the smp_affinity mask 
  */
  +   if (cpus_weight(cpumask) != 1)
  +   return 0;
  +   }
  +   return 1;
  +}
 
 A bool returning true or false would be appropriate, given this function's
 clearly-boolean name.
 
  +#ifndef ARCH_HAS_IRQ_AFFINITY_VALIDATION
  +#define is_irq_affinity_mask_valid(cpumask) 1
  +#endif
 
 The ARCH_HAS_FOO things have never been popular.  There are a couple of
 alternatives going around:
 
 a) use __attribute__((weak)) and provide a one-line default
implementation in kernel/irq/proc.c.  This has a small runtime cost.
 
 b) In include/asm-ia64/irq.h, do
 
#define is_affinity_mask_valid is_affinity_mask_valid
 
and in kernel/irq/proc.c do
 
#ifndef is_affinity_mask_valid
#define is_affinity_mask_valid() 1
#endif
 
This has minimal runtime cost, but is a bit tricksy.
 
It has the advantage that it doesn't introduce some new identifier
which needs to be maintained.
 
   extern int irq_set_affinity(unsigned int irq, cpumask_t cpumask);
   extern int irq_can_set_affinity(unsigned int irq);
   
  Index: linux-2.6/include/asm-ia64/irq.h
  ===
  --- linux-2.6.orig/include/asm-ia64/irq.h   2007-05-01 15:47:01.660643076 
  -0500
  +++ linux-2.6/include/asm-ia64/irq.h2007-05-01 15:48:42.729254805 
  -0500
  @@ -11,6 +11,8 @@
* 02/29/00 D.Mosbergermoved most things into hw_irq.h
*/
   
  +#include linux/cpumask.h
  +
 
 This is the sort of inclusion which tends to make things blow up.  I trust
 this was carefully compile-tested.
 
 With a) above, the is_affinity_mask_valid() declaration would be in a
 different header.  With b), no additional include will be needed.
 
   #define NR_IRQS256
   #define NR_IRQ_VECTORS NR_IRQS
   
  @@ -30,4 +32,7 @@ extern void disable_irq_nosync (unsigned
   extern void enable_irq (unsigned int);
   extern void set_irq_affinity_info (unsigned int irq, int dest, int redir);
   
  +#define ARCH_HAS_IRQ_AFFINITY_VALIDATION
  +extern int is_affinity_mask_valid(cpumask_t cpumask);
  +
 
 

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] - Altix: ioremap vga_console_iobase

2007-03-20 Thread John Keller
When booting an SN system without specifing a console
(i.e., no "console=" on boot line), the system will hang during
boot at the point where /sbin/init is run.

The problem is that vga_console_iobase is not converted to a
virtual address before storing in io_space[0].mmio_base.
The conversion was happening in sn_scan_pcdp(), but not in
setup_vga_console().

Signed-off-by: John Keller <[EMAIL PROTECTED]>
---

 arch/ia64/sn/kernel/setup.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)


Index: linux-2.6/arch/ia64/sn/kernel/setup.c
===
--- linux-2.6.orig/arch/ia64/sn/kernel/setup.c  2007-03-16 15:23:54.743044272 
-0500
+++ linux-2.6/arch/ia64/sn/kernel/setup.c   2007-03-20 13:22:38.837859262 
-0500
@@ -348,8 +348,7 @@ sn_scan_pcdp(void)
continue;   /* not PCI interconnect */
 
if (if_pci.translation & PCDP_PCI_TRANS_IOPORT)
-   vga_console_iobase =
-   if_pci.ioport_tra | __IA64_UNCACHED_OFFSET;
+   vga_console_iobase = if_pci.ioport_tra;
 
if (if_pci.translation & PCDP_PCI_TRANS_MMIO)
vga_console_membase =
@@ -429,7 +428,8 @@ void __init sn_setup(char **cmdline_p)
 *  bus containing the VGA console.
 */
if (vga_console_iobase) {
-   io_space[0].mmio_base = vga_console_iobase;
+   io_space[0].mmio_base =
+   (unsigned long) ioremap(vga_console_iobase, 0);
io_space[0].sparse = 0;
}
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] - Altix: ioremap vga_console_iobase

2007-03-20 Thread John Keller
When booting an SN system without specifing a console
(i.e., no console= on boot line), the system will hang during
boot at the point where /sbin/init is run.

The problem is that vga_console_iobase is not converted to a
virtual address before storing in io_space[0].mmio_base.
The conversion was happening in sn_scan_pcdp(), but not in
setup_vga_console().

Signed-off-by: John Keller [EMAIL PROTECTED]
---

 arch/ia64/sn/kernel/setup.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)


Index: linux-2.6/arch/ia64/sn/kernel/setup.c
===
--- linux-2.6.orig/arch/ia64/sn/kernel/setup.c  2007-03-16 15:23:54.743044272 
-0500
+++ linux-2.6/arch/ia64/sn/kernel/setup.c   2007-03-20 13:22:38.837859262 
-0500
@@ -348,8 +348,7 @@ sn_scan_pcdp(void)
continue;   /* not PCI interconnect */
 
if (if_pci.translation  PCDP_PCI_TRANS_IOPORT)
-   vga_console_iobase =
-   if_pci.ioport_tra | __IA64_UNCACHED_OFFSET;
+   vga_console_iobase = if_pci.ioport_tra;
 
if (if_pci.translation  PCDP_PCI_TRANS_MMIO)
vga_console_membase =
@@ -429,7 +428,8 @@ void __init sn_setup(char **cmdline_p)
 *  bus containing the VGA console.
 */
if (vga_console_iobase) {
-   io_space[0].mmio_base = vga_console_iobase;
+   io_space[0].mmio_base =
+   (unsigned long) ioremap(vga_console_iobase, 0);
io_space[0].sparse = 0;
}
 
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Fix wrong /proc/iomem on SGI Altix

2007-03-15 Thread John Keller
Looks good.
Feel free to add.

Acked-by: John Keller <[EMAIL PROTECTED]>


> 
> In sn_io_slot_fixup(), the parent is re-set from the bus to
> io(port|mem)_resource because the address is changed in a way that it's not
> child of the bus any more.
> 
> However, only the root is set but not the parent/child/sibling relationship in
> the resource tree which causes 'cat /proc/iomem' to stop after this memory
> area. Depding on the poition in the tree the iomem may be nearly completely
> empty.
> 
> Signed-off-by: Bernhard Walle <[EMAIL PROTECTED]>
> 
> ---
>  arch/ia64/sn/kernel/io_init.c |   12 ++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> Index: b/arch/ia64/sn/kernel/io_init.c
> ===
> --- a/arch/ia64/sn/kernel/io_init.c
> +++ b/arch/ia64/sn/kernel/io_init.c
> @@ -247,10 +247,18 @@ sn_io_slot_fixup(struct pci_dev *dev)
>   addr = ((addr << 4) >> 4) | __IA64_UNCACHED_OFFSET;
>   dev->resource[idx].start = addr;
>   dev->resource[idx].end = addr + size;
> +
> + /*
> +  * if it's already in the device structure, remove it before
> +  * inserting
> +  */
> + if (dev->resource[idx].parent && 
> dev->resource[idx].parent->child)
> + release_resource(>resource[idx]);
> +
>   if (dev->resource[idx].flags & IORESOURCE_IO)
> - dev->resource[idx].parent = _resource;
> + insert_resource(_resource, >resource[idx]);
>   else
> - dev->resource[idx].parent = _resource;
> + insert_resource(_resource, >resource[idx]);
>   /* If ROM, mark as shadowed in PROM */
>   if (idx == PCI_ROM_RESOURCE)
>   dev->resource[idx].flags |= IORESOURCE_ROM_BIOS_COPY;
> -

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Fix wrong /proc/iomem on SGI Altix

2007-03-15 Thread John Keller
Looks good.
Feel free to add.

Acked-by: John Keller [EMAIL PROTECTED]


 
 In sn_io_slot_fixup(), the parent is re-set from the bus to
 io(port|mem)_resource because the address is changed in a way that it's not
 child of the bus any more.
 
 However, only the root is set but not the parent/child/sibling relationship in
 the resource tree which causes 'cat /proc/iomem' to stop after this memory
 area. Depding on the poition in the tree the iomem may be nearly completely
 empty.
 
 Signed-off-by: Bernhard Walle [EMAIL PROTECTED]
 
 ---
  arch/ia64/sn/kernel/io_init.c |   12 ++--
  1 file changed, 10 insertions(+), 2 deletions(-)
 
 Index: b/arch/ia64/sn/kernel/io_init.c
 ===
 --- a/arch/ia64/sn/kernel/io_init.c
 +++ b/arch/ia64/sn/kernel/io_init.c
 @@ -247,10 +247,18 @@ sn_io_slot_fixup(struct pci_dev *dev)
   addr = ((addr  4)  4) | __IA64_UNCACHED_OFFSET;
   dev-resource[idx].start = addr;
   dev-resource[idx].end = addr + size;
 +
 + /*
 +  * if it's already in the device structure, remove it before
 +  * inserting
 +  */
 + if (dev-resource[idx].parent  
 dev-resource[idx].parent-child)
 + release_resource(dev-resource[idx]);
 +
   if (dev-resource[idx].flags  IORESOURCE_IO)
 - dev-resource[idx].parent = ioport_resource;
 + insert_resource(ioport_resource, dev-resource[idx]);
   else
 - dev-resource[idx].parent = iomem_resource;
 + insert_resource(iomem_resource, dev-resource[idx]);
   /* If ROM, mark as shadowed in PROM */
   if (idx == PCI_ROM_RESOURCE)
   dev-resource[idx].flags |= IORESOURCE_ROM_BIOS_COPY;
 -

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/1] - Altix: reinitialize acpi tables

2007-03-01 Thread John Keller
Len,
 The call itself does not fail. acpi_table_init() has no problem
processing an empty DSDT. In fact, this is exactly what happens
today when booting our non-acpi capable kernel. The second call is
needed in the case of booting an acpi capable kernel. We need to
rebuild the DSDT and SSDT, and because the first acpi_table_init
call has saved away info from the first set of tables, we need to
call it again to process the rebuilt tables.

In the future, when we no longer need to support non-acpi capable
kernels, the second call would not be needed for a normal/production
boot. But, it would still be required for a kexec/kdump boot.

John


> 
> so will the 1st acpi_table_init() always fail -- even
> on future machines?
> 
> -Len
> 
> On Wednesday 28 February 2007 18:47, John Keller wrote:
> > To provide compatibilty with SN kernels that do and do not
> > have ACPI IO support, the SN PROM must build different
> > versions of some ACPI tables based on which kernel is booting.
> > As such, the tables may have to change at kernel boot time.
> > By default, prior to kernel boot, the PROM builds an empty
> > DSDT (header only) and no SSDTs. If an ACPI capable kernel
> > boots, the kernel will notify the PROM, at platform setup time,
> > and the PROM will build full DSDT and SSDT tables.
> > 
> > With the latest changes to acpi_table_init(), the table lengths
> > are saved, and when our PROM changes them, the changes are not seen,
> > and the kernel will crash on boot. Because of issues with kexec support,
> > we are not able to create the tables prior to acpi_table_init().
> > As a result, we are making a second call to acpi_table_init() to
> > process the rebuilt DSDT and SSDTs.
> > 
> > Signed-off-by: John Keller <[EMAIL PROTECTED]>
> > ---
> > 
> > 
> > Index: release/arch/ia64/sn/kernel/setup.c
> > ===
> > --- release.orig/arch/ia64/sn/kernel/setup.c2007-02-28 
> > 11:02:34.558139870 -0600
> > +++ release/arch/ia64/sn/kernel/setup.c 2007-02-28 11:02:39.362737953 
> > -0600
> > @@ -397,6 +397,8 @@ void __init sn_setup(char **cmdline_p)
> > ia64_sn_set_os_feature(OSF_PCISEGMENT_ENABLE);
> > ia64_sn_set_os_feature(OSF_ACPI_ENABLE);
> >  
> > +   /* Load the new DSDT and SSDT tables into the global table list. */
> > +   acpi_table_init();
> >  
> >  #if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE)
> > /*
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> > the body of a message to [EMAIL PROTECTED]
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > 
> 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/1] - Altix: reinitialize acpi tables

2007-03-01 Thread John Keller
Len,
 The call itself does not fail. acpi_table_init() has no problem
processing an empty DSDT. In fact, this is exactly what happens
today when booting our non-acpi capable kernel. The second call is
needed in the case of booting an acpi capable kernel. We need to
rebuild the DSDT and SSDT, and because the first acpi_table_init
call has saved away info from the first set of tables, we need to
call it again to process the rebuilt tables.

In the future, when we no longer need to support non-acpi capable
kernels, the second call would not be needed for a normal/production
boot. But, it would still be required for a kexec/kdump boot.

John


 
 so will the 1st acpi_table_init() always fail -- even
 on future machines?
 
 -Len
 
 On Wednesday 28 February 2007 18:47, John Keller wrote:
  To provide compatibilty with SN kernels that do and do not
  have ACPI IO support, the SN PROM must build different
  versions of some ACPI tables based on which kernel is booting.
  As such, the tables may have to change at kernel boot time.
  By default, prior to kernel boot, the PROM builds an empty
  DSDT (header only) and no SSDTs. If an ACPI capable kernel
  boots, the kernel will notify the PROM, at platform setup time,
  and the PROM will build full DSDT and SSDT tables.
  
  With the latest changes to acpi_table_init(), the table lengths
  are saved, and when our PROM changes them, the changes are not seen,
  and the kernel will crash on boot. Because of issues with kexec support,
  we are not able to create the tables prior to acpi_table_init().
  As a result, we are making a second call to acpi_table_init() to
  process the rebuilt DSDT and SSDTs.
  
  Signed-off-by: John Keller [EMAIL PROTECTED]
  ---
  
  
  Index: release/arch/ia64/sn/kernel/setup.c
  ===
  --- release.orig/arch/ia64/sn/kernel/setup.c2007-02-28 
  11:02:34.558139870 -0600
  +++ release/arch/ia64/sn/kernel/setup.c 2007-02-28 11:02:39.362737953 
  -0600
  @@ -397,6 +397,8 @@ void __init sn_setup(char **cmdline_p)
  ia64_sn_set_os_feature(OSF_PCISEGMENT_ENABLE);
  ia64_sn_set_os_feature(OSF_ACPI_ENABLE);
   
  +   /* Load the new DSDT and SSDT tables into the global table list. */
  +   acpi_table_init();
   
   #if defined(CONFIG_VT)  defined(CONFIG_VGA_CONSOLE)
  /*
  -
  To unsubscribe from this list: send the line unsubscribe linux-acpi in
  the body of a message to [EMAIL PROTECTED]
  More majordomo info at  http://vger.kernel.org/majordomo-info.html
  
 

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/1] - Altix: reinitialize acpi tables

2007-02-28 Thread John Keller
To provide compatibilty with SN kernels that do and do not
have ACPI IO support, the SN PROM must build different
versions of some ACPI tables based on which kernel is booting.
As such, the tables may have to change at kernel boot time.
By default, prior to kernel boot, the PROM builds an empty
DSDT (header only) and no SSDTs. If an ACPI capable kernel
boots, the kernel will notify the PROM, at platform setup time,
and the PROM will build full DSDT and SSDT tables.

With the latest changes to acpi_table_init(), the table lengths
are saved, and when our PROM changes them, the changes are not seen,
and the kernel will crash on boot. Because of issues with kexec support,
we are not able to create the tables prior to acpi_table_init().
As a result, we are making a second call to acpi_table_init() to
process the rebuilt DSDT and SSDTs.

Signed-off-by: John Keller <[EMAIL PROTECTED]>
---


Index: release/arch/ia64/sn/kernel/setup.c
===
--- release.orig/arch/ia64/sn/kernel/setup.c2007-02-28 11:02:34.558139870 
-0600
+++ release/arch/ia64/sn/kernel/setup.c 2007-02-28 11:02:39.362737953 -0600
@@ -397,6 +397,8 @@ void __init sn_setup(char **cmdline_p)
ia64_sn_set_os_feature(OSF_PCISEGMENT_ENABLE);
ia64_sn_set_os_feature(OSF_ACPI_ENABLE);
 
+   /* Load the new DSDT and SSDT tables into the global table list. */
+   acpi_table_init();
 
 #if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE)
/*
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/1] - platform_kernel_launch_event is noop on generic kernel

2007-02-28 Thread John Keller
Add a missing #define for the platform_kernel_launch_event.
Without this fix, a call to platform_kernel_launch_event()
becomes a noop on generic kernels. SN systems require this
fix to successfully kdump/kexec from certain hardware errors.

Signed-off-by: John Keller <[EMAIL PROTECTED]>
---

Index: linux-2.6/include/asm-ia64/machvec.h
===
--- linux-2.6.orig/include/asm-ia64/machvec.h   2007-02-28 08:39:45.764537727 
-0600
+++ linux-2.6/include/asm-ia64/machvec.h2007-02-28 08:40:01.254467899 
-0600
@@ -168,6 +168,7 @@ extern void machvec_tlb_migrate_finish (
 #  define platform_setup_msi_irq   ia64_mv.setup_msi_irq
 #  define platform_teardown_msi_irqia64_mv.teardown_msi_irq
 #  define platform_pci_fixup_bus   ia64_mv.pci_fixup_bus
+#  define platform_kernel_launch_event ia64_mv.kernel_launch_event
 # endif
 
 /* __attribute__((__aligned__(16))) is required to make size of the
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/1] - platform_kernel_launch_event is noop on generic kernel

2007-02-28 Thread John Keller
Add a missing #define for the platform_kernel_launch_event.
Without this fix, a call to platform_kernel_launch_event()
becomes a noop on generic kernels. SN systems require this
fix to successfully kdump/kexec from certain hardware errors.

Signed-off-by: John Keller [EMAIL PROTECTED]
---

Index: linux-2.6/include/asm-ia64/machvec.h
===
--- linux-2.6.orig/include/asm-ia64/machvec.h   2007-02-28 08:39:45.764537727 
-0600
+++ linux-2.6/include/asm-ia64/machvec.h2007-02-28 08:40:01.254467899 
-0600
@@ -168,6 +168,7 @@ extern void machvec_tlb_migrate_finish (
 #  define platform_setup_msi_irq   ia64_mv.setup_msi_irq
 #  define platform_teardown_msi_irqia64_mv.teardown_msi_irq
 #  define platform_pci_fixup_bus   ia64_mv.pci_fixup_bus
+#  define platform_kernel_launch_event ia64_mv.kernel_launch_event
 # endif
 
 /* __attribute__((__aligned__(16))) is required to make size of the
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/1] - Altix: reinitialize acpi tables

2007-02-28 Thread John Keller
To provide compatibilty with SN kernels that do and do not
have ACPI IO support, the SN PROM must build different
versions of some ACPI tables based on which kernel is booting.
As such, the tables may have to change at kernel boot time.
By default, prior to kernel boot, the PROM builds an empty
DSDT (header only) and no SSDTs. If an ACPI capable kernel
boots, the kernel will notify the PROM, at platform setup time,
and the PROM will build full DSDT and SSDT tables.

With the latest changes to acpi_table_init(), the table lengths
are saved, and when our PROM changes them, the changes are not seen,
and the kernel will crash on boot. Because of issues with kexec support,
we are not able to create the tables prior to acpi_table_init().
As a result, we are making a second call to acpi_table_init() to
process the rebuilt DSDT and SSDTs.

Signed-off-by: John Keller [EMAIL PROTECTED]
---


Index: release/arch/ia64/sn/kernel/setup.c
===
--- release.orig/arch/ia64/sn/kernel/setup.c2007-02-28 11:02:34.558139870 
-0600
+++ release/arch/ia64/sn/kernel/setup.c 2007-02-28 11:02:39.362737953 -0600
@@ -397,6 +397,8 @@ void __init sn_setup(char **cmdline_p)
ia64_sn_set_os_feature(OSF_PCISEGMENT_ENABLE);
ia64_sn_set_os_feature(OSF_ACPI_ENABLE);
 
+   /* Load the new DSDT and SSDT tables into the global table list. */
+   acpi_table_init();
 
 #if defined(CONFIG_VT)  defined(CONFIG_VGA_CONSOLE)
/*
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/1] - Altix: cannot register acpi bus driver before bus scan

2007-02-23 Thread John Keller
SN code to initialize the Hub/TIO infrastructure needs to
execute before bus scanning. This is currently done by an
early call to acpi_bus_register_driver(). With the latest
ACPI changes to the driver model, a driver cannot be registered
this early. Make changes to have the init routines invoked via
calls to acpi_get_devices().

Signed-off-by: John Keller <[EMAIL PROTECTED]>
---

 arch/ia64/sn/kernel/io_acpi_init.c |   44 +--
 1 file changed, 22 insertions(+), 22 deletions(-)


Index: release/arch/ia64/sn/kernel/io_acpi_init.c
===
--- release.orig/arch/ia64/sn/kernel/io_acpi_init.c 2007-02-23 
15:21:21.070216119 -0600
+++ release/arch/ia64/sn/kernel/io_acpi_init.c  2007-02-23 15:22:04.255545247 
-0600
@@ -53,12 +53,15 @@ sal_ioif_init(u64 *result)
 }
 
 /*
- * sn_hubdev_add - The 'add' function of the acpi_sn_hubdev_driver.
- *Called for every "SGIHUB" or "SGITIO" device defined
- *in the ACPI namespace.
+ * sn_acpi_hubdev_init() - This function is called by 
acpi_ns_get_device_callback()
+ *for all SGIHUB and SGITIO acpi devices defined in the
+ *DSDT. It obtains the hubdev_info pointer from the
+ *ACPI vendor resource, which the PROM setup, and sets 
up the
+ *hubdev_info in the pda.
  */
-static int __init
-sn_hubdev_add(struct acpi_device *device)
+
+static acpi_status __init
+sn_acpi_hubdev_init(acpi_handle handle, u32 depth, void *context, void **ret)
 {
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
u64 addr;
@@ -67,18 +70,19 @@ sn_hubdev_add(struct acpi_device *device
int i;
u64 nasid;
struct acpi_resource *resource;
-   int ret = 0;
acpi_status status;
struct acpi_resource_vendor_typed *vendor;
extern void sn_common_hubdev_init(struct hubdev_info *);
 
-   status = acpi_get_vendor_resource(device->handle, METHOD_NAME__CRS,
+   status = acpi_get_vendor_resource(handle, METHOD_NAME__CRS,
  _uuid, );
if (ACPI_FAILURE(status)) {
printk(KERN_ERR
-  "sn_hubdev_add: acpi_get_vendor_resource() failed: %d\n",
-   status);
-   return 1;
+  "sn_acpi_hubdev_init: acpi_get_vendor_resource() "
+  "(0x%x) failed for: ", status);
+   acpi_ns_print_node_pathname(handle, NULL);
+   printk("\n");
+   return AE_OK;   /* Continue walking namespace */
}
 
resource = buffer.pointer;
@@ -86,9 +90,10 @@ sn_hubdev_add(struct acpi_device *device
if ((vendor->byte_length - sizeof(struct acpi_vendor_uuid)) !=
sizeof(struct hubdev_info *)) {
printk(KERN_ERR
-  "sn_hubdev_add: Invalid vendor data length: %d\n",
+  "sn_acpi_hubdev_init: Invalid vendor data length: %d 
for: ",
vendor->byte_length);
-   ret = 1;
+   acpi_ns_print_node_pathname(handle, NULL);
+   printk("\n");
goto exit;
}
 
@@ -103,7 +108,7 @@ sn_hubdev_add(struct acpi_device *device
 
 exit:
kfree(buffer.pointer);
-   return ret;
+   return AE_OK;   /* Continue walking namespace */
 }
 
 /*
@@ -441,14 +446,6 @@ sn_acpi_slot_fixup(struct pci_dev *dev)
 
 EXPORT_SYMBOL(sn_acpi_slot_fixup);
 
-static struct acpi_driver acpi_sn_hubdev_driver = {
-   .name = "SGI HUBDEV Driver",
-   .ids = "SGIHUB,SGITIO",
-   .ops = {
-   .add = sn_hubdev_add,
-   },
-};
-
 
 /*
  * sn_acpi_bus_fixup -  Perform SN specific setup of software structs
@@ -492,7 +489,10 @@ sn_io_acpi_init(void)
/* SN Altix does not follow the IOSAPIC IRQ routing model */
acpi_irq_model = ACPI_IRQ_MODEL_PLATFORM;
 
-   acpi_bus_register_driver(_sn_hubdev_driver);
+   /* Setup hubdev_info for all SGIHUB/SGITIO devices */
+   acpi_get_devices("SGIHUB", sn_acpi_hubdev_init, NULL, NULL);
+   acpi_get_devices("SGITIO", sn_acpi_hubdev_init, NULL, NULL);
+
status = sal_ioif_init();
if (status || result)
panic("sal_ioif_init failed: [%lx] %s\n",
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/1] - Altix: cannot register acpi bus driver before bus scan

2007-02-23 Thread John Keller
SN code to initialize the Hub/TIO infrastructure needs to
execute before bus scanning. This is currently done by an
early call to acpi_bus_register_driver(). With the latest
ACPI changes to the driver model, a driver cannot be registered
this early. Make changes to have the init routines invoked via
calls to acpi_get_devices().

Signed-off-by: John Keller [EMAIL PROTECTED]
---

 arch/ia64/sn/kernel/io_acpi_init.c |   44 +--
 1 file changed, 22 insertions(+), 22 deletions(-)


Index: release/arch/ia64/sn/kernel/io_acpi_init.c
===
--- release.orig/arch/ia64/sn/kernel/io_acpi_init.c 2007-02-23 
15:21:21.070216119 -0600
+++ release/arch/ia64/sn/kernel/io_acpi_init.c  2007-02-23 15:22:04.255545247 
-0600
@@ -53,12 +53,15 @@ sal_ioif_init(u64 *result)
 }
 
 /*
- * sn_hubdev_add - The 'add' function of the acpi_sn_hubdev_driver.
- *Called for every SGIHUB or SGITIO device defined
- *in the ACPI namespace.
+ * sn_acpi_hubdev_init() - This function is called by 
acpi_ns_get_device_callback()
+ *for all SGIHUB and SGITIO acpi devices defined in the
+ *DSDT. It obtains the hubdev_info pointer from the
+ *ACPI vendor resource, which the PROM setup, and sets 
up the
+ *hubdev_info in the pda.
  */
-static int __init
-sn_hubdev_add(struct acpi_device *device)
+
+static acpi_status __init
+sn_acpi_hubdev_init(acpi_handle handle, u32 depth, void *context, void **ret)
 {
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
u64 addr;
@@ -67,18 +70,19 @@ sn_hubdev_add(struct acpi_device *device
int i;
u64 nasid;
struct acpi_resource *resource;
-   int ret = 0;
acpi_status status;
struct acpi_resource_vendor_typed *vendor;
extern void sn_common_hubdev_init(struct hubdev_info *);
 
-   status = acpi_get_vendor_resource(device-handle, METHOD_NAME__CRS,
+   status = acpi_get_vendor_resource(handle, METHOD_NAME__CRS,
  sn_uuid, buffer);
if (ACPI_FAILURE(status)) {
printk(KERN_ERR
-  sn_hubdev_add: acpi_get_vendor_resource() failed: %d\n,
-   status);
-   return 1;
+  sn_acpi_hubdev_init: acpi_get_vendor_resource() 
+  (0x%x) failed for: , status);
+   acpi_ns_print_node_pathname(handle, NULL);
+   printk(\n);
+   return AE_OK;   /* Continue walking namespace */
}
 
resource = buffer.pointer;
@@ -86,9 +90,10 @@ sn_hubdev_add(struct acpi_device *device
if ((vendor-byte_length - sizeof(struct acpi_vendor_uuid)) !=
sizeof(struct hubdev_info *)) {
printk(KERN_ERR
-  sn_hubdev_add: Invalid vendor data length: %d\n,
+  sn_acpi_hubdev_init: Invalid vendor data length: %d 
for: ,
vendor-byte_length);
-   ret = 1;
+   acpi_ns_print_node_pathname(handle, NULL);
+   printk(\n);
goto exit;
}
 
@@ -103,7 +108,7 @@ sn_hubdev_add(struct acpi_device *device
 
 exit:
kfree(buffer.pointer);
-   return ret;
+   return AE_OK;   /* Continue walking namespace */
 }
 
 /*
@@ -441,14 +446,6 @@ sn_acpi_slot_fixup(struct pci_dev *dev)
 
 EXPORT_SYMBOL(sn_acpi_slot_fixup);
 
-static struct acpi_driver acpi_sn_hubdev_driver = {
-   .name = SGI HUBDEV Driver,
-   .ids = SGIHUB,SGITIO,
-   .ops = {
-   .add = sn_hubdev_add,
-   },
-};
-
 
 /*
  * sn_acpi_bus_fixup -  Perform SN specific setup of software structs
@@ -492,7 +489,10 @@ sn_io_acpi_init(void)
/* SN Altix does not follow the IOSAPIC IRQ routing model */
acpi_irq_model = ACPI_IRQ_MODEL_PLATFORM;
 
-   acpi_bus_register_driver(acpi_sn_hubdev_driver);
+   /* Setup hubdev_info for all SGIHUB/SGITIO devices */
+   acpi_get_devices(SGIHUB, sn_acpi_hubdev_init, NULL, NULL);
+   acpi_get_devices(SGITIO, sn_acpi_hubdev_init, NULL, NULL);
+
status = sal_ioif_init(result);
if (status || result)
panic(sal_ioif_init failed: [%lx] %s\n,
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/1] - acpi_boot_init() making bad check on return code

2007-02-16 Thread John Keller
acpi_boot_init() is making a bad check on the return
status from acpi_table_parse(). acpi_table_parse() now
returns zero on success, one on failure.

Signed-off-by: Aaron Young <[EMAIL PROTECTED]>
---

Index: release/arch/ia64/kernel/acpi.c
===
--- release.orig/arch/ia64/kernel/acpi.c2007-02-16 08:58:10.0 
-0600
+++ release/arch/ia64/kernel/acpi.c 2007-02-16 09:03:16.893360100 -0600
@@ -651,7 +651,7 @@ int __init acpi_boot_init(void)
 * information -- the successor to MPS tables.
 */
 
-   if (acpi_table_parse(ACPI_SIG_MADT, acpi_parse_madt) < 1) {
+   if (acpi_table_parse(ACPI_SIG_MADT, acpi_parse_madt)) {
printk(KERN_ERR PREFIX "Can't find MADT\n");
goto skip_madt;
}
@@ -702,7 +702,7 @@ int __init acpi_boot_init(void)
 * gets interrupts such as power and sleep buttons.  If it's not
 * on a Legacy interrupt, it needs to be setup.
 */
-   if (acpi_table_parse(ACPI_SIG_FADT, acpi_parse_fadt) < 1)
+   if (acpi_table_parse(ACPI_SIG_FADT, acpi_parse_fadt))
printk(KERN_ERR PREFIX "Can't find FADT\n");
 
 #ifdef CONFIG_SMP
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/1] - acpi_unload_table_id() always returns error

2007-02-16 Thread John Keller
Yes.

  I understand and agree this project and the contribution
  are public and that a record of the contribution (including all
  personal information I submit with it, including my sign-off) is
  maintained indefinitely. I thereby license this patch to be
  redistributed under any license (GPL or non-GPL) consistent
  with the project.

John


> 
> Thanks for the fix, John.
> Do you grant Intel permission to apply it to the upstream ACPICA tree (with 
> its non-GPL license)?
> 
> -Len
> 
> On Thursday 15 February 2007 15:08, John Keller wrote:
> > acpi_unload_table_id() is always returning an error status.
> > Also, once the matching table is found, don't bother looking
> > for another match.
> > 
> > 
> > Signed-off-by: John Keller <[EMAIL PROTECTED]>
> > ---
> > 
> > 
> > Index: release/drivers/acpi/tables/tbxface.c
> > ===
> > --- release.orig/drivers/acpi/tables/tbxface.c  2007-02-13 
> > 08:20:42.0 -0600
> > +++ release/drivers/acpi/tables/tbxface.c   2007-02-15 14:04:07.855248010 
> > -0600
> > @@ -338,9 +338,9 @@ acpi_status acpi_unload_table_id(acpi_ow
> > int i;
> > acpi_status status = AE_NOT_EXIST;
> >  
> > -   ACPI_FUNCTION_TRACE(acpi_unload_table);
> > +   ACPI_FUNCTION_TRACE(acpi_unload_table_id);
> >  
> > -   /* Find table from the requested type list */
> > +   /* Find table in the global table list */
> > for (i = 0; i < acpi_gbl_root_table_list.count; ++i) {
> > if (id != acpi_gbl_root_table_list.tables[i].owner_id) {
> > continue;
> > @@ -352,8 +352,9 @@ acpi_status acpi_unload_table_id(acpi_ow
> > * simply a position within the hierarchy
> > */
> > acpi_tb_delete_namespace_by_owner(i);
> > -   acpi_tb_release_owner_id(i);
> > +   status = acpi_tb_release_owner_id(i);
> > acpi_tb_set_table_loaded_flag(i, FALSE);
> > +   break;
> > }
> > return_ACPI_STATUS(status);
> >  }
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> > the body of a message to [EMAIL PROTECTED]
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > 
> 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/1] - acpi_unload_table_id() always returns error

2007-02-16 Thread John Keller
Yes.

  I understand and agree this project and the contribution
  are public and that a record of the contribution (including all
  personal information I submit with it, including my sign-off) is
  maintained indefinitely. I thereby license this patch to be
  redistributed under any license (GPL or non-GPL) consistent
  with the project.

John


 
 Thanks for the fix, John.
 Do you grant Intel permission to apply it to the upstream ACPICA tree (with 
 its non-GPL license)?
 
 -Len
 
 On Thursday 15 February 2007 15:08, John Keller wrote:
  acpi_unload_table_id() is always returning an error status.
  Also, once the matching table is found, don't bother looking
  for another match.
  
  
  Signed-off-by: John Keller [EMAIL PROTECTED]
  ---
  
  
  Index: release/drivers/acpi/tables/tbxface.c
  ===
  --- release.orig/drivers/acpi/tables/tbxface.c  2007-02-13 
  08:20:42.0 -0600
  +++ release/drivers/acpi/tables/tbxface.c   2007-02-15 14:04:07.855248010 
  -0600
  @@ -338,9 +338,9 @@ acpi_status acpi_unload_table_id(acpi_ow
  int i;
  acpi_status status = AE_NOT_EXIST;
   
  -   ACPI_FUNCTION_TRACE(acpi_unload_table);
  +   ACPI_FUNCTION_TRACE(acpi_unload_table_id);
   
  -   /* Find table from the requested type list */
  +   /* Find table in the global table list */
  for (i = 0; i  acpi_gbl_root_table_list.count; ++i) {
  if (id != acpi_gbl_root_table_list.tables[i].owner_id) {
  continue;
  @@ -352,8 +352,9 @@ acpi_status acpi_unload_table_id(acpi_ow
  * simply a position within the hierarchy
  */
  acpi_tb_delete_namespace_by_owner(i);
  -   acpi_tb_release_owner_id(i);
  +   status = acpi_tb_release_owner_id(i);
  acpi_tb_set_table_loaded_flag(i, FALSE);
  +   break;
  }
  return_ACPI_STATUS(status);
   }
  -
  To unsubscribe from this list: send the line unsubscribe linux-acpi in
  the body of a message to [EMAIL PROTECTED]
  More majordomo info at  http://vger.kernel.org/majordomo-info.html
  
 

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/1] - acpi_boot_init() making bad check on return code

2007-02-16 Thread John Keller
acpi_boot_init() is making a bad check on the return
status from acpi_table_parse(). acpi_table_parse() now
returns zero on success, one on failure.

Signed-off-by: Aaron Young [EMAIL PROTECTED]
---

Index: release/arch/ia64/kernel/acpi.c
===
--- release.orig/arch/ia64/kernel/acpi.c2007-02-16 08:58:10.0 
-0600
+++ release/arch/ia64/kernel/acpi.c 2007-02-16 09:03:16.893360100 -0600
@@ -651,7 +651,7 @@ int __init acpi_boot_init(void)
 * information -- the successor to MPS tables.
 */
 
-   if (acpi_table_parse(ACPI_SIG_MADT, acpi_parse_madt)  1) {
+   if (acpi_table_parse(ACPI_SIG_MADT, acpi_parse_madt)) {
printk(KERN_ERR PREFIX Can't find MADT\n);
goto skip_madt;
}
@@ -702,7 +702,7 @@ int __init acpi_boot_init(void)
 * gets interrupts such as power and sleep buttons.  If it's not
 * on a Legacy interrupt, it needs to be setup.
 */
-   if (acpi_table_parse(ACPI_SIG_FADT, acpi_parse_fadt)  1)
+   if (acpi_table_parse(ACPI_SIG_FADT, acpi_parse_fadt))
printk(KERN_ERR PREFIX Can't find FADT\n);
 
 #ifdef CONFIG_SMP
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/1] - acpi_unload_table_id() always returns error

2007-02-15 Thread John Keller
acpi_unload_table_id() is always returning an error status.
Also, once the matching table is found, don't bother looking
for another match.


Signed-off-by: John Keller <[EMAIL PROTECTED]>
---


Index: release/drivers/acpi/tables/tbxface.c
===
--- release.orig/drivers/acpi/tables/tbxface.c  2007-02-13 08:20:42.0 
-0600
+++ release/drivers/acpi/tables/tbxface.c   2007-02-15 14:04:07.855248010 
-0600
@@ -338,9 +338,9 @@ acpi_status acpi_unload_table_id(acpi_ow
int i;
acpi_status status = AE_NOT_EXIST;
 
-   ACPI_FUNCTION_TRACE(acpi_unload_table);
+   ACPI_FUNCTION_TRACE(acpi_unload_table_id);
 
-   /* Find table from the requested type list */
+   /* Find table in the global table list */
for (i = 0; i < acpi_gbl_root_table_list.count; ++i) {
if (id != acpi_gbl_root_table_list.tables[i].owner_id) {
continue;
@@ -352,8 +352,9 @@ acpi_status acpi_unload_table_id(acpi_ow
* simply a position within the hierarchy
*/
acpi_tb_delete_namespace_by_owner(i);
-   acpi_tb_release_owner_id(i);
+   status = acpi_tb_release_owner_id(i);
acpi_tb_set_table_loaded_flag(i, FALSE);
+   break;
}
return_ACPI_STATUS(status);
 }
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/1] - acpi_unload_table_id() always returns error

2007-02-15 Thread John Keller
acpi_unload_table_id() is always returning an error status.
Also, once the matching table is found, don't bother looking
for another match.


Signed-off-by: John Keller [EMAIL PROTECTED]
---


Index: release/drivers/acpi/tables/tbxface.c
===
--- release.orig/drivers/acpi/tables/tbxface.c  2007-02-13 08:20:42.0 
-0600
+++ release/drivers/acpi/tables/tbxface.c   2007-02-15 14:04:07.855248010 
-0600
@@ -338,9 +338,9 @@ acpi_status acpi_unload_table_id(acpi_ow
int i;
acpi_status status = AE_NOT_EXIST;
 
-   ACPI_FUNCTION_TRACE(acpi_unload_table);
+   ACPI_FUNCTION_TRACE(acpi_unload_table_id);
 
-   /* Find table from the requested type list */
+   /* Find table in the global table list */
for (i = 0; i  acpi_gbl_root_table_list.count; ++i) {
if (id != acpi_gbl_root_table_list.tables[i].owner_id) {
continue;
@@ -352,8 +352,9 @@ acpi_status acpi_unload_table_id(acpi_ow
* simply a position within the hierarchy
*/
acpi_tb_delete_namespace_by_owner(i);
-   acpi_tb_release_owner_id(i);
+   status = acpi_tb_release_owner_id(i);
acpi_tb_set_table_loaded_flag(i, FALSE);
+   break;
}
return_ACPI_STATUS(status);
 }
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/1] - Altix: more ACPI PRT support

2007-02-02 Thread John Keller
The SN Altix platform does not conform to the 
IOSAPIC IRQ routing model. Add code in acpi_unregister_gsi()
to check if (acpi_irq_model == ACPI_IRQ_MODEL_PLATFORM) and
return.

Signed-off-by: John Keller <[EMAIL PROTECTED]>
---

Due to an oversight, this code was not added previously when
similar code was added to acpi_register_gsi().

http://marc.theaimsgroup.com/?l=linux-acpi=116680983430121=2

 arch/ia64/kernel/acpi.c |3 +++
 1 file changed, 3 insertions(+)


Index: linux-2.6/arch/ia64/kernel/acpi.c
===
--- linux-2.6.orig/arch/ia64/kernel/acpi.c  2007-02-02 14:44:31.0 
-0600
+++ linux-2.6/arch/ia64/kernel/acpi.c   2007-02-02 14:47:44.658143727 -0600
@@ -609,6 +609,9 @@ EXPORT_SYMBOL(acpi_register_gsi);
 
 void acpi_unregister_gsi(u32 gsi)
 {
+   if (acpi_irq_model == ACPI_IRQ_MODEL_PLATFORM)
+   return;
+
iosapic_unregister_intr(gsi);
 }
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/1] - Altix: more ACPI PRT support

2007-02-02 Thread John Keller
The SN Altix platform does not conform to the 
IOSAPIC IRQ routing model. Add code in acpi_unregister_gsi()
to check if (acpi_irq_model == ACPI_IRQ_MODEL_PLATFORM) and
return.

Signed-off-by: John Keller [EMAIL PROTECTED]
---

Due to an oversight, this code was not added previously when
similar code was added to acpi_register_gsi().

http://marc.theaimsgroup.com/?l=linux-acpim=116680983430121w=2

 arch/ia64/kernel/acpi.c |3 +++
 1 file changed, 3 insertions(+)


Index: linux-2.6/arch/ia64/kernel/acpi.c
===
--- linux-2.6.orig/arch/ia64/kernel/acpi.c  2007-02-02 14:44:31.0 
-0600
+++ linux-2.6/arch/ia64/kernel/acpi.c   2007-02-02 14:47:44.658143727 -0600
@@ -609,6 +609,9 @@ EXPORT_SYMBOL(acpi_register_gsi);
 
 void acpi_unregister_gsi(u32 gsi)
 {
+   if (acpi_irq_model == ACPI_IRQ_MODEL_PLATFORM)
+   return;
+
iosapic_unregister_intr(gsi);
 }
 
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/1] - increase acpi owner_id max

2007-01-26 Thread John Keller
To support systems with large IO configurations,
this patch increases the number of available ACPI
owner ids to 1023.

On SN platforms, we represent every populated root
bus slot with an ACPI SSDT table containing info
for every device and PPB attached to the slot.
Each SSDT requires a unique ACPI owner id.

Signed-off-by: John Keller <[EMAIL PROTECTED]>
---

 drivers/acpi/utilities/utmisc.c |6 +++---
 include/acpi/acconfig.h |4 ++--
 include/acpi/aclocal.h  |4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)


Index: linux/drivers/acpi/utilities/utmisc.c
===
--- linux.orig/drivers/acpi/utilities/utmisc.c  2007-01-25 11:27:25.509259412 
-0600
+++ linux/drivers/acpi/utilities/utmisc.c   2007-01-26 13:16:09.551081284 
-0600
@@ -147,7 +147,7 @@ acpi_status acpi_ut_allocate_owner_id(ac
/*
 * Construct encoded ID from the index and bit 
position
 *
-* Note: Last [j].k (bit 255) is never used and 
is marked
+* Note: Last [j].k (bit 1023) is never used 
and is marked
 * permanently allocated (prevents +1 overflow)
 */
*owner_id =
@@ -175,7 +175,7 @@ acpi_status acpi_ut_allocate_owner_id(ac
 */
status = AE_OWNER_ID_LIMIT;
ACPI_ERROR((AE_INFO,
-   "Could not allocate new OwnerId (255 max), 
AE_OWNER_ID_LIMIT"));
+   "Could not allocate new OwnerId (1023 max), 
AE_OWNER_ID_LIMIT"));
 
   exit:
(void)acpi_ut_release_mutex(ACPI_MTX_CACHES);
@@ -192,7 +192,7 @@ acpi_status acpi_ut_allocate_owner_id(ac
  *  control method or unloading a table. Either way, we would
  *  ignore any error anyway.
  *
- * DESCRIPTION: Release a table or method owner ID.  Valid IDs are 1 - 255
+ * DESCRIPTION: Release a table or method owner ID.  Valid IDs are 1 - 1023
  *
  
**/
 
Index: linux/include/acpi/acconfig.h
===
--- linux.orig/include/acpi/acconfig.h  2007-01-25 11:27:25.577267818 -0600
+++ linux/include/acpi/acconfig.h   2007-01-26 13:17:14.111002597 -0600
@@ -111,9 +111,9 @@
 
 #define ACPI_SYSMEM_REGION_WINDOW_SIZE  4096
 
-/* owner_id tracking. 8 entries allows for 255 owner_ids */
+/* owner_id tracking. 32 entries allow for 1023 owner_ids */
 
-#define ACPI_NUM_OWNERID_MASKS  8
+#define ACPI_NUM_OWNERID_MASKS 32
 
 /**
  *
Index: linux/include/acpi/aclocal.h
===
--- linux.orig/include/acpi/aclocal.h   2007-01-25 11:27:25.585268807 -0600
+++ linux/include/acpi/aclocal.h2007-01-26 13:20:06.148115848 -0600
@@ -122,8 +122,8 @@ static char *acpi_gbl_mutex_names[ACPI_N
 
 /* Owner IDs are used to track namespace nodes for selective deletion */
 
-typedef u8 acpi_owner_id;
-#define ACPI_OWNER_ID_MAX   0xFF
+typedef u16 acpi_owner_id;
+#define ACPI_OWNER_ID_MAX   0x3FF
 
 /* This Thread ID means that the mutex is not in use (unlocked) */
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/1] - increase acpi owner_id max

2007-01-26 Thread John Keller
To support systems with large IO configurations,
this patch increases the number of available ACPI
owner ids to 1023.

On SN platforms, we represent every populated root
bus slot with an ACPI SSDT table containing info
for every device and PPB attached to the slot.
Each SSDT requires a unique ACPI owner id.

Signed-off-by: John Keller [EMAIL PROTECTED]
---

 drivers/acpi/utilities/utmisc.c |6 +++---
 include/acpi/acconfig.h |4 ++--
 include/acpi/aclocal.h  |4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)


Index: linux/drivers/acpi/utilities/utmisc.c
===
--- linux.orig/drivers/acpi/utilities/utmisc.c  2007-01-25 11:27:25.509259412 
-0600
+++ linux/drivers/acpi/utilities/utmisc.c   2007-01-26 13:16:09.551081284 
-0600
@@ -147,7 +147,7 @@ acpi_status acpi_ut_allocate_owner_id(ac
/*
 * Construct encoded ID from the index and bit 
position
 *
-* Note: Last [j].k (bit 255) is never used and 
is marked
+* Note: Last [j].k (bit 1023) is never used 
and is marked
 * permanently allocated (prevents +1 overflow)
 */
*owner_id =
@@ -175,7 +175,7 @@ acpi_status acpi_ut_allocate_owner_id(ac
 */
status = AE_OWNER_ID_LIMIT;
ACPI_ERROR((AE_INFO,
-   Could not allocate new OwnerId (255 max), 
AE_OWNER_ID_LIMIT));
+   Could not allocate new OwnerId (1023 max), 
AE_OWNER_ID_LIMIT));
 
   exit:
(void)acpi_ut_release_mutex(ACPI_MTX_CACHES);
@@ -192,7 +192,7 @@ acpi_status acpi_ut_allocate_owner_id(ac
  *  control method or unloading a table. Either way, we would
  *  ignore any error anyway.
  *
- * DESCRIPTION: Release a table or method owner ID.  Valid IDs are 1 - 255
+ * DESCRIPTION: Release a table or method owner ID.  Valid IDs are 1 - 1023
  *
  
**/
 
Index: linux/include/acpi/acconfig.h
===
--- linux.orig/include/acpi/acconfig.h  2007-01-25 11:27:25.577267818 -0600
+++ linux/include/acpi/acconfig.h   2007-01-26 13:17:14.111002597 -0600
@@ -111,9 +111,9 @@
 
 #define ACPI_SYSMEM_REGION_WINDOW_SIZE  4096
 
-/* owner_id tracking. 8 entries allows for 255 owner_ids */
+/* owner_id tracking. 32 entries allow for 1023 owner_ids */
 
-#define ACPI_NUM_OWNERID_MASKS  8
+#define ACPI_NUM_OWNERID_MASKS 32
 
 /**
  *
Index: linux/include/acpi/aclocal.h
===
--- linux.orig/include/acpi/aclocal.h   2007-01-25 11:27:25.585268807 -0600
+++ linux/include/acpi/aclocal.h2007-01-26 13:20:06.148115848 -0600
@@ -122,8 +122,8 @@ static char *acpi_gbl_mutex_names[ACPI_N
 
 /* Owner IDs are used to track namespace nodes for selective deletion */
 
-typedef u8 acpi_owner_id;
-#define ACPI_OWNER_ID_MAX   0xFF
+typedef u16 acpi_owner_id;
+#define ACPI_OWNER_ID_MAX   0x3FF
 
 /* This Thread ID means that the mutex is not in use (unlocked) */
 
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/1] - Altix: ACPI _PRT support

2006-12-22 Thread John Keller
Provide ACPI _PRT support for SN Altix systems.

The SN Altix platform does not conform to the 
IOSAPIC IRQ routing model, so a new acpi_irq_model
(ACPI_IRQ_MODEL_PLATFORM) has been defined. The SN
platform specific code sets acpi_irq_model to
this new value, and keys off of it in acpi_register_gsi()
to avoid the iosapic code path.

Signed-off-by: John Keller <[EMAIL PROTECTED]>
---

To avoid future regression/backward compatibilty issues
when _PRT support is added to our PROM, we'd like to
see this pushed into 2.6.20, if at all possible.


 arch/ia64/kernel/acpi.c|3 +++
 arch/ia64/sn/kernel/io_acpi_init.c |3 +++
 drivers/acpi/bus.c |3 +++
 include/linux/acpi.h   |1 +
 4 files changed, 10 insertions(+)


Index: linux/arch/ia64/kernel/acpi.c
===
--- linux.orig/arch/ia64/kernel/acpi.c  2006-10-24 02:38:54.0 -0500
+++ linux/arch/ia64/kernel/acpi.c   2006-12-22 10:54:36.930343639 -0600
@@ -590,6 +590,9 @@ void __init acpi_numa_arch_fixup(void)
  */
 int acpi_register_gsi(u32 gsi, int triggering, int polarity)
 {
+   if (acpi_irq_model == ACPI_IRQ_MODEL_PLATFORM)
+   return gsi;
+
if (has_8259 && gsi < 16)
return isa_irq_to_vector(gsi);
 
Index: linux/arch/ia64/sn/kernel/io_acpi_init.c
===
--- linux.orig/arch/ia64/sn/kernel/io_acpi_init.c   2006-12-21 
00:51:59.0 -0600
+++ linux/arch/ia64/sn/kernel/io_acpi_init.c2006-12-22 10:53:45.504213484 
-0600
@@ -223,6 +223,9 @@ sn_io_acpi_init(void)
u64 result;
s64 status;
 
+   /* SN Altix does not follow the IOSAPIC IRQ routing model */
+   acpi_irq_model = ACPI_IRQ_MODEL_PLATFORM;
+
acpi_bus_register_driver(_sn_hubdev_driver);
status = sal_ioif_init();
if (status || result)
Index: linux/drivers/acpi/bus.c
===
--- linux.orig/drivers/acpi/bus.c   2006-08-28 20:40:10.0 -0500
+++ linux/drivers/acpi/bus.c2006-12-22 10:52:32.155474439 -0600
@@ -561,6 +561,9 @@ static int __init acpi_bus_init_irq(void
case ACPI_IRQ_MODEL_IOSAPIC:
message = "IOSAPIC";
break;
+   case ACPI_IRQ_MODEL_PLATFORM:
+   message = "platform specific model";
+   break;
default:
printk(KERN_WARNING PREFIX "Unknown interrupt routing model\n");
return -ENODEV;
Index: linux/include/linux/acpi.h
===
--- linux.orig/include/linux/acpi.h 2006-10-24 02:38:54.0 -0500
+++ linux/include/linux/acpi.h  2006-12-22 10:52:53.337997675 -0600
@@ -47,6 +47,7 @@ enum acpi_irq_model_id {
ACPI_IRQ_MODEL_PIC = 0,
ACPI_IRQ_MODEL_IOAPIC,
ACPI_IRQ_MODEL_IOSAPIC,
+   ACPI_IRQ_MODEL_PLATFORM,
ACPI_IRQ_MODEL_COUNT
 };
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/1] - Altix: ACPI _PRT support

2006-12-22 Thread John Keller
Provide ACPI _PRT support for SN Altix systems.

The SN Altix platform does not conform to the 
IOSAPIC IRQ routing model, so a new acpi_irq_model
(ACPI_IRQ_MODEL_PLATFORM) has been defined. The SN
platform specific code sets acpi_irq_model to
this new value, and keys off of it in acpi_register_gsi()
to avoid the iosapic code path.

Signed-off-by: John Keller [EMAIL PROTECTED]
---

To avoid future regression/backward compatibilty issues
when _PRT support is added to our PROM, we'd like to
see this pushed into 2.6.20, if at all possible.


 arch/ia64/kernel/acpi.c|3 +++
 arch/ia64/sn/kernel/io_acpi_init.c |3 +++
 drivers/acpi/bus.c |3 +++
 include/linux/acpi.h   |1 +
 4 files changed, 10 insertions(+)


Index: linux/arch/ia64/kernel/acpi.c
===
--- linux.orig/arch/ia64/kernel/acpi.c  2006-10-24 02:38:54.0 -0500
+++ linux/arch/ia64/kernel/acpi.c   2006-12-22 10:54:36.930343639 -0600
@@ -590,6 +590,9 @@ void __init acpi_numa_arch_fixup(void)
  */
 int acpi_register_gsi(u32 gsi, int triggering, int polarity)
 {
+   if (acpi_irq_model == ACPI_IRQ_MODEL_PLATFORM)
+   return gsi;
+
if (has_8259  gsi  16)
return isa_irq_to_vector(gsi);
 
Index: linux/arch/ia64/sn/kernel/io_acpi_init.c
===
--- linux.orig/arch/ia64/sn/kernel/io_acpi_init.c   2006-12-21 
00:51:59.0 -0600
+++ linux/arch/ia64/sn/kernel/io_acpi_init.c2006-12-22 10:53:45.504213484 
-0600
@@ -223,6 +223,9 @@ sn_io_acpi_init(void)
u64 result;
s64 status;
 
+   /* SN Altix does not follow the IOSAPIC IRQ routing model */
+   acpi_irq_model = ACPI_IRQ_MODEL_PLATFORM;
+
acpi_bus_register_driver(acpi_sn_hubdev_driver);
status = sal_ioif_init(result);
if (status || result)
Index: linux/drivers/acpi/bus.c
===
--- linux.orig/drivers/acpi/bus.c   2006-08-28 20:40:10.0 -0500
+++ linux/drivers/acpi/bus.c2006-12-22 10:52:32.155474439 -0600
@@ -561,6 +561,9 @@ static int __init acpi_bus_init_irq(void
case ACPI_IRQ_MODEL_IOSAPIC:
message = IOSAPIC;
break;
+   case ACPI_IRQ_MODEL_PLATFORM:
+   message = platform specific model;
+   break;
default:
printk(KERN_WARNING PREFIX Unknown interrupt routing model\n);
return -ENODEV;
Index: linux/include/linux/acpi.h
===
--- linux.orig/include/linux/acpi.h 2006-10-24 02:38:54.0 -0500
+++ linux/include/linux/acpi.h  2006-12-22 10:52:53.337997675 -0600
@@ -47,6 +47,7 @@ enum acpi_irq_model_id {
ACPI_IRQ_MODEL_PIC = 0,
ACPI_IRQ_MODEL_IOAPIC,
ACPI_IRQ_MODEL_IOSAPIC,
+   ACPI_IRQ_MODEL_PLATFORM,
ACPI_IRQ_MODEL_COUNT
 };
 
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/3] - Add support for acpi_load_table/acpi_unload_table_id

2006-11-30 Thread John Keller

 This patch makes acpi_load_table() available
 for use by removing it from the #ifdef ACPI_FUTURE_USAGE.

 It also adds a new routine used to unload an ACPI table
 of a given type and "id" - acpi_unload_table_id().
 The implementation of this new routine was almost a direct
 copy of existing routine acpi_unload_table() - only difference
 being that it only removes a specific table id instead of
 ALL tables of a given type.
 The SN hotplug driver (sgi_hotplug.c) now uses both of these
 interfaces to dynamically load and unload SSDT ACPI tables.

Signed-off-by: Aaron Young <[EMAIL PROTECTED]>

---

Andrew,
  Can you take this update and replace the current version in
  your -mm tree:
   add-support-for-acpi_load_table-acpi_unload_table_id.patch

Len,
  What do we need to do to resolve any licensing issues related to
  these changes?

Thanks.


Resend #2
   Code has been improved to no longer use ACPI "internal" routines
   (such as acpi_ns_get_next_node()). To this end, a new public interface
   to obtain the owner_id for a handle was added (acpi_get_id()). It is
   very similar to existing routine acpi_get_type().

Resend #1
   Original send of this patch was outdated and did not have
   acpi_ut_acquire_mutex() and acpi_ut_release_mutex() calls
   in acpi_unload_table_id().


 drivers/acpi/namespace/nsxfobj.c |   44 +++
 drivers/acpi/tables/tbxface.c|   54 -
 include/acpi/acpixf.h|7 ++-
 3 files changed, 102 insertions(+), 3 deletions(-)

Index: release/drivers/acpi/tables/tbxface.c
===
--- release.orig/drivers/acpi/tables/tbxface.c  2006-11-29 14:14:23.532910707 
-0600
+++ release/drivers/acpi/tables/tbxface.c   2006-11-29 14:15:04.173937975 
-0600
@@ -123,7 +123,6 @@ acpi_status acpi_load_tables(void)
 
 ACPI_EXPORT_SYMBOL(acpi_load_tables)
 
-#ifdef ACPI_FUTURE_USAGE
 
/***
  *
  * FUNCTION:acpi_load_table
@@ -221,6 +220,59 @@ ACPI_EXPORT_SYMBOL(acpi_load_table)
 
 
/***
  *
+ * FUNCTION:acpi_unload_table_id
+ *
+ * PARAMETERS:  table_type- Type of table to be unloaded
+ *  id- Owner ID of the table to be removed.
+ *
+ * RETURN:  Status
+ *
+ * DESCRIPTION: This routine is used to force the unload of a table (by id)
+ *
+ 
**/
+acpi_status acpi_unload_table_id(acpi_table_type table_type, acpi_owner_id id)
+{
+   struct acpi_table_desc *table_desc;
+   acpi_status status;
+
+   ACPI_FUNCTION_TRACE(acpi_unload_table);
+
+   /* Parameter validation */
+   if (table_type > ACPI_TABLE_ID_MAX)
+   return_ACPI_STATUS(AE_BAD_PARAMETER);
+
+   /* Find table from the requested type list */
+   table_desc = acpi_gbl_table_lists[table_type].next;
+   while (table_desc && table_desc->owner_id != id)
+   table_desc = table_desc->next;
+
+   if (!table_desc)
+   return_ACPI_STATUS(AE_NOT_EXIST);
+
+   /*
+* Delete all namespace objects owned by this table. Note that these
+* objects can appear anywhere in the namespace by virtue of the AML
+* "Scope" operator. Thus, we need to track ownership by an ID, not
+* simply a position within the hierarchy
+*/
+   acpi_ns_delete_namespace_by_owner(table_desc->owner_id);
+
+   status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
+   if (ACPI_FAILURE(status))
+   return_ACPI_STATUS(status);
+
+   (void)acpi_tb_uninstall_table(table_desc);
+
+   (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
+
+   return_ACPI_STATUS(AE_OK);
+}
+
+ACPI_EXPORT_SYMBOL(acpi_unload_table_id)
+
+#ifdef ACPI_FUTURE_USAGE
+/***
+ *
  * FUNCTION:acpi_unload_table
  *
  * PARAMETERS:  table_type- Type of table to be unloaded
Index: release/include/acpi/acpixf.h
===
--- release.orig/include/acpi/acpixf.h  2006-11-29 14:14:23.556913676 -0600
+++ release/include/acpi/acpixf.h   2006-11-29 14:18:55.966606388 -0600
@@ -97,11 +97,12 @@ acpi_find_root_pointer(u32 flags, struct
 
 acpi_status acpi_load_tables(void);
 
-#ifdef ACPI_FUTURE_USAGE
 acpi_status acpi_load_table(struct acpi_table_header *table_ptr);
 
-acpi_status acpi_unload_table(acpi_table_type table_type);
+acpi_status acpi_unload_table_id(acpi_table_type table_type, acpi_owner_id id);
 
+#ifdef ACPI_FUTURE_USAGE
+acpi_status acpi_unload_table(acpi_table_type table_type);
 acpi_status
 acpi_get_table_header(acpi_table_type table_type,
  u32 instance, struct acpi_table_header *out_table_header);
@@ -180,6 +181,8 @@ 

Re: [PATCH 2/3] - Altix: Add ACPI SSDT PCI device support (hotplug)

2006-11-30 Thread John Keller
 Support for dynamic loading and unloading of ACPI
 SSDT tables upon slot hotplugs and unplugs.

 On SN platforms, we now represent every
 populated root bus slot with a single ACPI
 SSDT table containing info for every
 device and PPB attached to the slot. These SSDTs
 are generated by the prom at initial boot
 and hotplug time. The info in these SSDT tables is
 used by the SN kernel IO "fixup" code (which is called
 at boot and hotplug time).

 On hotplugs (i.e. enable_slot()), if running with
 an ACPI capable prom, attempt to obtain a new ACPI SSDT
 table for the slot being hotplugged. If successful, add
 the table to the ACPI namespace (acpi_load_table()) and
 then walk the new devices and add them to the ACPI
 infrastructure (acpi_bus_add()).

 On hot unplugs (i.e. disable_slot()), if running with
 an ACPI capable prom, attempt to remove the SSDT table
 associated with the slot from the ACPI namespace
 (acpi_unload_table_id()) and infastructure (acpi_bus_trim()).

Signed-off-by:  Aaron Young <[EMAIL PROTECTED]>

---

Andrew,
  Can you take this update and replace the current version in
  your -mm tree:
   altix-add-acpi-ssdt-pci-device-support-hotplug.patch

Thanks.


Resend #1
 A bug was fixed where the sgi hotplug driver was removing
 the slot's SSDT table from the ACPI namespace a bit too early in
 disable_slot(). Also, we now call acpi_bus_start() subsequent
 to acpi_bus_add().


 Note: This patch is dependent on a previous set of SN ACPI
   patches.

altix-add-initial-acpi-io-support.patch
altix-sn-acpi-hotplug-support.patch
altix-initial-acpi-support-rom-shadowing.patch


 drivers/pci/hotplug/sgi_hotplug.c |  155 ++--
 1 file changed, 148 insertions(+), 7 deletions(-)


Index: release/drivers/pci/hotplug/sgi_hotplug.c
===
--- release.orig/drivers/pci/hotplug/sgi_hotplug.c  2006-11-28 
11:17:27.429699131 -0600
+++ release/drivers/pci/hotplug/sgi_hotplug.c   2006-11-29 14:19:58.814378288 
-0600
@@ -28,6 +28,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include "../pci.h"
 
@@ -35,14 +37,17 @@ MODULE_LICENSE("GPL");
 MODULE_AUTHOR("SGI ([EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED])");
 MODULE_DESCRIPTION("SGI Altix Hot Plug PCI Controller Driver");
 
-#define PCIIO_ASIC_TYPE_TIOCA  4
+
+/* SAL call error codes. Keep in sync with prom header io/include/pcibr.h */
 #define PCI_SLOT_ALREADY_UP2   /* slot already up */
 #define PCI_SLOT_ALREADY_DOWN  3   /* slot already down */
 #define PCI_L1_ERR 7   /* L1 console command error */
 #define PCI_EMPTY_33MHZ15  /* empty 33 MHz bus */
+
+
+#define PCIIO_ASIC_TYPE_TIOCA  4
 #define PCI_L1_QSIZE   128 /* our L1 message buffer size */
 #define SN_MAX_HP_SLOTS32  /* max hotplug slots */
-#define SGI_HOTPLUG_PROM_REV   0x0430  /* Min. required PROM version */
 #define SN_SLOT_NAME_SIZE  33  /* size of name string */
 
 /* internal list head */
@@ -227,7 +232,7 @@ static void sn_bus_free_data(struct pci_
 }
 
 static int sn_slot_enable(struct hotplug_slot *bss_hotplug_slot,
- int device_num)
+ int device_num, char **ssdt)
 {
struct slot *slot = bss_hotplug_slot->private;
struct pcibus_info *pcibus_info;
@@ -240,7 +245,8 @@ static int sn_slot_enable(struct hotplug
 * Power-on and initialize the slot in the SN
 * PCI infrastructure.
 */
-   rc = sal_pcibr_slot_enable(pcibus_info, device_num, );
+   rc = sal_pcibr_slot_enable(pcibus_info, device_num, , ssdt);
+
 
if (rc == PCI_SLOT_ALREADY_UP) {
dev_dbg(slot->pci_bus->self, "is already active\n");
@@ -335,6 +341,7 @@ static int enable_slot(struct hotplug_sl
int func, num_funcs;
int new_ppb = 0;
int rc;
+   char *ssdt = NULL;
void pcibios_fixup_device_resources(struct pci_dev *);
 
/* Serialize the Linux PCI infrastructure */
@@ -342,14 +349,29 @@ static int enable_slot(struct hotplug_sl
 
/*
 * Power-on and initialize the slot in the SN
-* PCI infrastructure.
+* PCI infrastructure. Also, retrieve the ACPI SSDT
+* table for the slot (if ACPI capable PROM).
 */
-   rc = sn_slot_enable(bss_hotplug_slot, slot->device_num);
+   rc = sn_slot_enable(bss_hotplug_slot, slot->device_num, );
if (rc) {
mutex_unlock(_hotplug_mutex);
return rc;
}
 
+   if (ssdt)
+   ssdt = __va(ssdt);
+   /* Add the new SSDT for the slot to the ACPI namespace */
+   if (SN_ACPI_BASE_SUPPORT() && ssdt) {
+   acpi_status ret;
+
+   ret = acpi_load_table((struct acpi_table_header *)ssdt);
+   if 

Re: [PATCH 2/3] - Altix: Add ACPI SSDT PCI device support (hotplug)

2006-11-30 Thread John Keller
 Support for dynamic loading and unloading of ACPI
 SSDT tables upon slot hotplugs and unplugs.

 On SN platforms, we now represent every
 populated root bus slot with a single ACPI
 SSDT table containing info for every
 device and PPB attached to the slot. These SSDTs
 are generated by the prom at initial boot
 and hotplug time. The info in these SSDT tables is
 used by the SN kernel IO fixup code (which is called
 at boot and hotplug time).

 On hotplugs (i.e. enable_slot()), if running with
 an ACPI capable prom, attempt to obtain a new ACPI SSDT
 table for the slot being hotplugged. If successful, add
 the table to the ACPI namespace (acpi_load_table()) and
 then walk the new devices and add them to the ACPI
 infrastructure (acpi_bus_add()).

 On hot unplugs (i.e. disable_slot()), if running with
 an ACPI capable prom, attempt to remove the SSDT table
 associated with the slot from the ACPI namespace
 (acpi_unload_table_id()) and infastructure (acpi_bus_trim()).

Signed-off-by:  Aaron Young [EMAIL PROTECTED]

---

Andrew,
  Can you take this update and replace the current version in
  your -mm tree:
   altix-add-acpi-ssdt-pci-device-support-hotplug.patch

Thanks.


Resend #1
 A bug was fixed where the sgi hotplug driver was removing
 the slot's SSDT table from the ACPI namespace a bit too early in
 disable_slot(). Also, we now call acpi_bus_start() subsequent
 to acpi_bus_add().


 Note: This patch is dependent on a previous set of SN ACPI
   patches.

altix-add-initial-acpi-io-support.patch
altix-sn-acpi-hotplug-support.patch
altix-initial-acpi-support-rom-shadowing.patch


 drivers/pci/hotplug/sgi_hotplug.c |  155 ++--
 1 file changed, 148 insertions(+), 7 deletions(-)


Index: release/drivers/pci/hotplug/sgi_hotplug.c
===
--- release.orig/drivers/pci/hotplug/sgi_hotplug.c  2006-11-28 
11:17:27.429699131 -0600
+++ release/drivers/pci/hotplug/sgi_hotplug.c   2006-11-29 14:19:58.814378288 
-0600
@@ -28,6 +28,8 @@
 #include asm/sn/sn_feature_sets.h
 #include asm/sn/sn_sal.h
 #include asm/sn/types.h
+#include linux/acpi.h
+#include asm/sn/acpi.h
 
 #include ../pci.h
 
@@ -35,14 +37,17 @@ MODULE_LICENSE(GPL);
 MODULE_AUTHOR(SGI ([EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]));
 MODULE_DESCRIPTION(SGI Altix Hot Plug PCI Controller Driver);
 
-#define PCIIO_ASIC_TYPE_TIOCA  4
+
+/* SAL call error codes. Keep in sync with prom header io/include/pcibr.h */
 #define PCI_SLOT_ALREADY_UP2   /* slot already up */
 #define PCI_SLOT_ALREADY_DOWN  3   /* slot already down */
 #define PCI_L1_ERR 7   /* L1 console command error */
 #define PCI_EMPTY_33MHZ15  /* empty 33 MHz bus */
+
+
+#define PCIIO_ASIC_TYPE_TIOCA  4
 #define PCI_L1_QSIZE   128 /* our L1 message buffer size */
 #define SN_MAX_HP_SLOTS32  /* max hotplug slots */
-#define SGI_HOTPLUG_PROM_REV   0x0430  /* Min. required PROM version */
 #define SN_SLOT_NAME_SIZE  33  /* size of name string */
 
 /* internal list head */
@@ -227,7 +232,7 @@ static void sn_bus_free_data(struct pci_
 }
 
 static int sn_slot_enable(struct hotplug_slot *bss_hotplug_slot,
- int device_num)
+ int device_num, char **ssdt)
 {
struct slot *slot = bss_hotplug_slot-private;
struct pcibus_info *pcibus_info;
@@ -240,7 +245,8 @@ static int sn_slot_enable(struct hotplug
 * Power-on and initialize the slot in the SN
 * PCI infrastructure.
 */
-   rc = sal_pcibr_slot_enable(pcibus_info, device_num, resp);
+   rc = sal_pcibr_slot_enable(pcibus_info, device_num, resp, ssdt);
+
 
if (rc == PCI_SLOT_ALREADY_UP) {
dev_dbg(slot-pci_bus-self, is already active\n);
@@ -335,6 +341,7 @@ static int enable_slot(struct hotplug_sl
int func, num_funcs;
int new_ppb = 0;
int rc;
+   char *ssdt = NULL;
void pcibios_fixup_device_resources(struct pci_dev *);
 
/* Serialize the Linux PCI infrastructure */
@@ -342,14 +349,29 @@ static int enable_slot(struct hotplug_sl
 
/*
 * Power-on and initialize the slot in the SN
-* PCI infrastructure.
+* PCI infrastructure. Also, retrieve the ACPI SSDT
+* table for the slot (if ACPI capable PROM).
 */
-   rc = sn_slot_enable(bss_hotplug_slot, slot-device_num);
+   rc = sn_slot_enable(bss_hotplug_slot, slot-device_num, ssdt);
if (rc) {
mutex_unlock(sn_hotplug_mutex);
return rc;
}
 
+   if (ssdt)
+   ssdt = __va(ssdt);
+   /* Add the new SSDT for the slot to the ACPI namespace */
+   if (SN_ACPI_BASE_SUPPORT()  ssdt) {
+   acpi_status ret;
+
+   ret = 

Re: [PATCH 3/3] - Add support for acpi_load_table/acpi_unload_table_id

2006-11-30 Thread John Keller

 This patch makes acpi_load_table() available
 for use by removing it from the #ifdef ACPI_FUTURE_USAGE.

 It also adds a new routine used to unload an ACPI table
 of a given type and id - acpi_unload_table_id().
 The implementation of this new routine was almost a direct
 copy of existing routine acpi_unload_table() - only difference
 being that it only removes a specific table id instead of
 ALL tables of a given type.
 The SN hotplug driver (sgi_hotplug.c) now uses both of these
 interfaces to dynamically load and unload SSDT ACPI tables.

Signed-off-by: Aaron Young [EMAIL PROTECTED]

---

Andrew,
  Can you take this update and replace the current version in
  your -mm tree:
   add-support-for-acpi_load_table-acpi_unload_table_id.patch

Len,
  What do we need to do to resolve any licensing issues related to
  these changes?

Thanks.


Resend #2
   Code has been improved to no longer use ACPI internal routines
   (such as acpi_ns_get_next_node()). To this end, a new public interface
   to obtain the owner_id for a handle was added (acpi_get_id()). It is
   very similar to existing routine acpi_get_type().

Resend #1
   Original send of this patch was outdated and did not have
   acpi_ut_acquire_mutex() and acpi_ut_release_mutex() calls
   in acpi_unload_table_id().


 drivers/acpi/namespace/nsxfobj.c |   44 +++
 drivers/acpi/tables/tbxface.c|   54 -
 include/acpi/acpixf.h|7 ++-
 3 files changed, 102 insertions(+), 3 deletions(-)

Index: release/drivers/acpi/tables/tbxface.c
===
--- release.orig/drivers/acpi/tables/tbxface.c  2006-11-29 14:14:23.532910707 
-0600
+++ release/drivers/acpi/tables/tbxface.c   2006-11-29 14:15:04.173937975 
-0600
@@ -123,7 +123,6 @@ acpi_status acpi_load_tables(void)
 
 ACPI_EXPORT_SYMBOL(acpi_load_tables)
 
-#ifdef ACPI_FUTURE_USAGE
 
/***
  *
  * FUNCTION:acpi_load_table
@@ -221,6 +220,59 @@ ACPI_EXPORT_SYMBOL(acpi_load_table)
 
 
/***
  *
+ * FUNCTION:acpi_unload_table_id
+ *
+ * PARAMETERS:  table_type- Type of table to be unloaded
+ *  id- Owner ID of the table to be removed.
+ *
+ * RETURN:  Status
+ *
+ * DESCRIPTION: This routine is used to force the unload of a table (by id)
+ *
+ 
**/
+acpi_status acpi_unload_table_id(acpi_table_type table_type, acpi_owner_id id)
+{
+   struct acpi_table_desc *table_desc;
+   acpi_status status;
+
+   ACPI_FUNCTION_TRACE(acpi_unload_table);
+
+   /* Parameter validation */
+   if (table_type  ACPI_TABLE_ID_MAX)
+   return_ACPI_STATUS(AE_BAD_PARAMETER);
+
+   /* Find table from the requested type list */
+   table_desc = acpi_gbl_table_lists[table_type].next;
+   while (table_desc  table_desc-owner_id != id)
+   table_desc = table_desc-next;
+
+   if (!table_desc)
+   return_ACPI_STATUS(AE_NOT_EXIST);
+
+   /*
+* Delete all namespace objects owned by this table. Note that these
+* objects can appear anywhere in the namespace by virtue of the AML
+* Scope operator. Thus, we need to track ownership by an ID, not
+* simply a position within the hierarchy
+*/
+   acpi_ns_delete_namespace_by_owner(table_desc-owner_id);
+
+   status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
+   if (ACPI_FAILURE(status))
+   return_ACPI_STATUS(status);
+
+   (void)acpi_tb_uninstall_table(table_desc);
+
+   (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
+
+   return_ACPI_STATUS(AE_OK);
+}
+
+ACPI_EXPORT_SYMBOL(acpi_unload_table_id)
+
+#ifdef ACPI_FUTURE_USAGE
+/***
+ *
  * FUNCTION:acpi_unload_table
  *
  * PARAMETERS:  table_type- Type of table to be unloaded
Index: release/include/acpi/acpixf.h
===
--- release.orig/include/acpi/acpixf.h  2006-11-29 14:14:23.556913676 -0600
+++ release/include/acpi/acpixf.h   2006-11-29 14:18:55.966606388 -0600
@@ -97,11 +97,12 @@ acpi_find_root_pointer(u32 flags, struct
 
 acpi_status acpi_load_tables(void);
 
-#ifdef ACPI_FUTURE_USAGE
 acpi_status acpi_load_table(struct acpi_table_header *table_ptr);
 
-acpi_status acpi_unload_table(acpi_table_type table_type);
+acpi_status acpi_unload_table_id(acpi_table_type table_type, acpi_owner_id id);
 
+#ifdef ACPI_FUTURE_USAGE
+acpi_status acpi_unload_table(acpi_table_type table_type);
 acpi_status
 acpi_get_table_header(acpi_table_type table_type,
  u32 instance, struct acpi_table_header *out_table_header);
@@ -180,6 +181,8 @@ acpi_get_next_object(acpi_object_type