From 63028aa7f581d9d4e6889f9dc06ded2534250a76 Mon Sep 17 00:00:00 2001 From: Kiyoshi Ueda Date: Wed, 24 Aug 2005 18:03:43 -0400 Subject: [PATCH 1/9] [IA64] page_not_present fault in region 5 is normal When copying data from user-space to kernel-space by __copy_user(), a page_not_present fault sometimes occurs at vmalloced kernel address because of VHPT pre-fetching. Ignore the page_not_present fault in ia64_do_page_fault() before jumping into exception handlers. Signed-off-by: Kiyoshi Ueda Signed-off-by: Jun'ichi Nomura Signed-off-by: Tony Luck --- arch/ia64/mm/fault.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/ia64/mm/fault.c b/arch/ia64/mm/fault.c index ff62551eb3a1..839d4f1234ee 100644 --- a/arch/ia64/mm/fault.c +++ b/arch/ia64/mm/fault.c @@ -229,9 +229,6 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re return; } - if (ia64_done_with_exception(regs)) - return; - /* * Since we have no vma's for region 5, we might get here even if the address is * valid, due to the VHPT walker inserting a non present translation that becomes @@ -242,6 +239,9 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re if (REGION_NUMBER(address) == 5 && mapped_kernel_page_is_present(address)) return; + if (ia64_done_with_exception(regs)) + return; + /* * Oops. The kernel tried to access some bad page. We'll have to terminate things * with extreme prejudice. From 295bd89279aad6959f0d363ee8e946d4766f9ad8 Mon Sep 17 00:00:00 2001 From: "Chen, Kenneth W" Date: Tue, 6 Sep 2005 16:05:23 -0700 Subject: [PATCH 2/9] [IA64] make exception handler in copy_user more robust The exception handler in copy user always expects fault occurs only on user space address and the fall back recovery code is written with that very assumption in mind. Recent source code inspection revealed that while it worked splendid and to the expectation under normal circumstances, It broke down under unexpected condition where some address calculation might go outside the legal address range the original copy_user was called for. This patch is to make copy_user exception handler more robust and to prevent potential memory corruption. Signed-off-by: Ken Chen Signed-off-by: Tony Luck --- arch/ia64/lib/memcpy_mck.S | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/ia64/lib/memcpy_mck.S b/arch/ia64/lib/memcpy_mck.S index 6f308e62c137..46c9331e7ab5 100644 --- a/arch/ia64/lib/memcpy_mck.S +++ b/arch/ia64/lib/memcpy_mck.S @@ -625,8 +625,11 @@ EK(.ex_handler, (p17) st8 [dst1]=r39,8); \ clrrrb ;; alloc saved_pfs_stack=ar.pfs,3,3,3,0 + cmp.lt p8,p0=A,r0 sub B = dst0, saved_in0 // how many byte copied so far ;; +(p8) mov A = 0; // A shouldn't be negative, cap it + ;; sub C = A, B sub D = saved_in2, A ;; From 02326223247c773bc007629d54622d750c0371c1 Mon Sep 17 00:00:00 2001 From: "Chen, Kenneth W" Date: Wed, 7 Sep 2005 01:00:37 -0700 Subject: [PATCH 3/9] [IA64] minor performance tune-up in ia64_switch_to The reenabling of psr.ic should really belong to dtr mapping code block. It make the fall through code fast since it doesn't need to execute the predicated-off instruction. Logically make more sense as well since psr.ic was turned off in .map code block. Signed-off-by: Ken Chen Signed-off-by: Tony Luck --- arch/ia64/kernel/entry.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S index 9be53e1ea404..3c8821024509 100644 --- a/arch/ia64/kernel/entry.S +++ b/arch/ia64/kernel/entry.S @@ -204,9 +204,6 @@ GLOBAL_ENTRY(ia64_switch_to) (p6) br.cond.dpnt .map ;; .done: -(p6) ssm psr.ic // if we had to map, reenable the psr.ic bit FIRST!!! - ;; -(p6) srlz.d ld8 sp=[r21] // load kernel stack pointer of new task mov IA64_KR(CURRENT)=in0 // update "current" application register mov r8=r13 // return pointer to previously running task @@ -234,6 +231,9 @@ GLOBAL_ENTRY(ia64_switch_to) mov IA64_KR(CURRENT_STACK)=r26 // remember last page we mapped... ;; itr.d dtr[r25]=r23 // wire in new mapping... + ssm psr.ic // reenable the psr.ic bit + ;; + srlz.d br.cond.sptk .done END(ia64_switch_to) From a52ac87eb249f5e87f43e1a0adeb1a737f4a2b43 Mon Sep 17 00:00:00 2001 From: Kenji Kaneshige Date: Wed, 7 Sep 2005 14:04:14 +0900 Subject: [PATCH 4/9] [IA64] Minor cleanups - remove unnecessary function prototype in irq.h The function prototype for handl_IRQ_event() in include/asm-ia64/irq.h is no longer needed. This patch removes it. Signed-off-by: Kenji Kaneshige Signed-off-by: Tony Luck --- include/asm-ia64/irq.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/include/asm-ia64/irq.h b/include/asm-ia64/irq.h index bd07d11d9f37..585644c6b21c 100644 --- a/include/asm-ia64/irq.h +++ b/include/asm-ia64/irq.h @@ -36,8 +36,4 @@ extern void move_irq(int irq); #define move_irq(irq) #endif -struct irqaction; -struct pt_regs; -int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); - #endif /* _ASM_IA64_IRQ_H */ From 697eaad417f9f2e40f62282e8b396208b72990cf Mon Sep 17 00:00:00 2001 From: Kenji Kaneshige Date: Wed, 7 Sep 2005 14:06:25 +0900 Subject: [PATCH 5/9] [IA64] Minor cleanups - remove CONFIG_ACPI_DEALLOCATE_IRQ The config option 'CONFIG_ACPI_DEALLOCATE_IRQ' is no longer needed. This patch removes it. Signed-off-by: Kenji Kaneshige Signed-off-by: Tony Luck --- arch/ia64/Kconfig | 5 ----- arch/ia64/configs/sn2_defconfig | 1 - arch/ia64/configs/tiger_defconfig | 1 - arch/ia64/configs/zx1_defconfig | 1 - arch/ia64/defconfig | 1 - arch/ia64/kernel/acpi.c | 2 -- arch/ia64/kernel/iosapic.c | 2 -- arch/ia64/pci/pci.c | 2 -- include/asm-ia64/iosapic.h | 2 -- 9 files changed, 17 deletions(-) diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index 3deced637f07..d0743c6da6d8 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig @@ -338,11 +338,6 @@ config IA64_PALINFO To use this option, you have to ensure that the "/proc file system support" (CONFIG_PROC_FS) is enabled, too. -config ACPI_DEALLOCATE_IRQ - bool - depends on IOSAPIC && EXPERIMENTAL - default y - source "drivers/firmware/Kconfig" source "fs/Kconfig.binfmt" diff --git a/arch/ia64/configs/sn2_defconfig b/arch/ia64/configs/sn2_defconfig index dccf35c60b94..5f1cceb590cd 100644 --- a/arch/ia64/configs/sn2_defconfig +++ b/arch/ia64/configs/sn2_defconfig @@ -111,7 +111,6 @@ CONFIG_COMPAT=y CONFIG_IA64_MCA_RECOVERY=y CONFIG_PERFMON=y CONFIG_IA64_PALINFO=y -CONFIG_ACPI_DEALLOCATE_IRQ=y # # Firmware Drivers diff --git a/arch/ia64/configs/tiger_defconfig b/arch/ia64/configs/tiger_defconfig index c853cfcd2d11..d536ec7f129c 100644 --- a/arch/ia64/configs/tiger_defconfig +++ b/arch/ia64/configs/tiger_defconfig @@ -109,7 +109,6 @@ CONFIG_COMPAT=y CONFIG_IA64_MCA_RECOVERY=y CONFIG_PERFMON=y CONFIG_IA64_PALINFO=y -CONFIG_ACPI_DEALLOCATE_IRQ=y # # Firmware Drivers diff --git a/arch/ia64/configs/zx1_defconfig b/arch/ia64/configs/zx1_defconfig index 88e8867fa8e8..d569036a4cea 100644 --- a/arch/ia64/configs/zx1_defconfig +++ b/arch/ia64/configs/zx1_defconfig @@ -109,7 +109,6 @@ CONFIG_COMPAT=y CONFIG_IA64_MCA_RECOVERY=y CONFIG_PERFMON=y CONFIG_IA64_PALINFO=y -CONFIG_ACPI_DEALLOCATE_IRQ=y # # Firmware Drivers diff --git a/arch/ia64/defconfig b/arch/ia64/defconfig index 8444add76380..e3a907bd960e 100644 --- a/arch/ia64/defconfig +++ b/arch/ia64/defconfig @@ -99,7 +99,6 @@ CONFIG_COMPAT=y CONFIG_IA64_MCA_RECOVERY=y CONFIG_PERFMON=y CONFIG_IA64_PALINFO=y -CONFIG_ACPI_DEALLOCATE_IRQ=y # # Firmware Drivers diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c index 9609f243e5d0..66970d7b6c87 100644 --- a/arch/ia64/kernel/acpi.c +++ b/arch/ia64/kernel/acpi.c @@ -575,14 +575,12 @@ acpi_register_gsi (u32 gsi, int edge_level, int active_high_low) } EXPORT_SYMBOL(acpi_register_gsi); -#ifdef CONFIG_ACPI_DEALLOCATE_IRQ void acpi_unregister_gsi (u32 gsi) { iosapic_unregister_intr(gsi); } EXPORT_SYMBOL(acpi_unregister_gsi); -#endif /* CONFIG_ACPI_DEALLOCATE_IRQ */ static int __init acpi_parse_fadt (unsigned long phys_addr, unsigned long size) diff --git a/arch/ia64/kernel/iosapic.c b/arch/ia64/kernel/iosapic.c index 7936b62f7a2e..c0c3f55b0231 100644 --- a/arch/ia64/kernel/iosapic.c +++ b/arch/ia64/kernel/iosapic.c @@ -776,7 +776,6 @@ again: return vector; } -#ifdef CONFIG_ACPI_DEALLOCATE_IRQ void iosapic_unregister_intr (unsigned int gsi) { @@ -859,7 +858,6 @@ iosapic_unregister_intr (unsigned int gsi) spin_unlock(&iosapic_lock); spin_unlock_irqrestore(&idesc->lock, flags); } -#endif /* CONFIG_ACPI_DEALLOCATE_IRQ */ /* * ACPI calls this when it finds an entry for a platform interrupt. diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index 9977c122e9fa..9b5de589b82f 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c @@ -498,13 +498,11 @@ pcibios_enable_device (struct pci_dev *dev, int mask) return acpi_pci_irq_enable(dev); } -#ifdef CONFIG_ACPI_DEALLOCATE_IRQ void pcibios_disable_device (struct pci_dev *dev) { acpi_pci_irq_disable(dev); } -#endif /* CONFIG_ACPI_DEALLOCATE_IRQ */ void pcibios_align_resource (void *data, struct resource *res, diff --git a/include/asm-ia64/iosapic.h b/include/asm-ia64/iosapic.h index a429fe225b07..9a18820f22a2 100644 --- a/include/asm-ia64/iosapic.h +++ b/include/asm-ia64/iosapic.h @@ -83,9 +83,7 @@ extern int gsi_to_irq (unsigned int gsi); extern void iosapic_enable_intr (unsigned int vector); extern int iosapic_register_intr (unsigned int gsi, unsigned long polarity, unsigned long trigger); -#ifdef CONFIG_ACPI_DEALLOCATE_IRQ extern void iosapic_unregister_intr (unsigned int irq); -#endif extern void __init iosapic_override_isa_irq (unsigned int isa_irq, unsigned int gsi, unsigned long polarity, unsigned long trigger); From 9799e4d39a7e2763a614084f6ae6cc936047de70 Mon Sep 17 00:00:00 2001 From: Kenji Kaneshige Date: Wed, 7 Sep 2005 14:08:18 +0900 Subject: [PATCH 6/9] [IA64] Minor cleanups - remove unnecessary function prototype in iosapic.h The function prototypes for iosapic_enable_intr() and iosapic_pci_fixup() in include/asm-ia64/iosapic.h are no longer needed. This patch removes them. The original patch has been posted by Satoru Takeuchi. Signed-off-by: Satoru Takeuchi Signed-off-by: Kenji Kaneshige Signed-off-by: Tony Luck --- include/asm-ia64/iosapic.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/asm-ia64/iosapic.h b/include/asm-ia64/iosapic.h index 9a18820f22a2..20f98f1751a1 100644 --- a/include/asm-ia64/iosapic.h +++ b/include/asm-ia64/iosapic.h @@ -80,7 +80,6 @@ extern int iosapic_remove (unsigned int gsi_base); #endif /* CONFIG_HOTPLUG */ extern int gsi_to_vector (unsigned int gsi); extern int gsi_to_irq (unsigned int gsi); -extern void iosapic_enable_intr (unsigned int vector); extern int iosapic_register_intr (unsigned int gsi, unsigned long polarity, unsigned long trigger); extern void iosapic_unregister_intr (unsigned int irq); @@ -95,7 +94,6 @@ extern int __init iosapic_register_platform_intr (u32 int_type, unsigned long trigger); extern unsigned int iosapic_version (char __iomem *addr); -extern void iosapic_pci_fixup (int); #ifdef CONFIG_NUMA extern void __devinit map_iosapic_to_node (unsigned int, int); #endif From 087f902686beb6c02157c271e3fc95606dbdfdbf Mon Sep 17 00:00:00 2001 From: Martin Hicks Date: Thu, 8 Sep 2005 11:28:11 -0400 Subject: [PATCH 7/9] [IA64] defconfig: turn off QLOGIC_FC Turn off the QLOGIC_FC driver. Supposedly qla2xxx should support these devices. Do any ia64 machines have one of these devices as the boot device? Signed-off-by: Martin Hicks Signed-off-by: Tony Luck --- arch/ia64/defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/ia64/defconfig b/arch/ia64/defconfig index e3a907bd960e..2aa32f020707 100644 --- a/arch/ia64/defconfig +++ b/arch/ia64/defconfig @@ -340,7 +340,7 @@ CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16 CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64 # CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set # CONFIG_SCSI_IPR is not set -CONFIG_SCSI_QLOGIC_FC=y +# CONFIG_SCSI_QLOGIC_FC is not set # CONFIG_SCSI_QLOGIC_FC_FIRMWARE is not set CONFIG_SCSI_QLOGIC_1280=y # CONFIG_SCSI_QLOGIC_1280_1040 is not set From 408865ce4829376120489ac8011b72125453dcff Mon Sep 17 00:00:00 2001 From: Dean Nelson Date: Thu, 8 Sep 2005 10:46:58 -0500 Subject: [PATCH 8/9] [IA64] ensure XPC and XPNET are loaded on sn2 platforms only These are SN2 only drivers. They should have platform checks to prevent them from doing evil stuff in GENERIC kernels. Signed-off-by: Martin Hicks Acked-by: Dean Nelson Signed-off-by: Tony Luck --- arch/ia64/sn/kernel/xpc_main.c | 4 ++++ arch/ia64/sn/kernel/xpnet.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/arch/ia64/sn/kernel/xpc_main.c b/arch/ia64/sn/kernel/xpc_main.c index bb1d5cf30440..ed7c21586e98 100644 --- a/arch/ia64/sn/kernel/xpc_main.c +++ b/arch/ia64/sn/kernel/xpc_main.c @@ -885,6 +885,10 @@ xpc_init(void) pid_t pid; + if (!ia64_platform_is("sn2")) { + return -ENODEV; + } + /* * xpc_remote_copy_buffer is used as a temporary buffer for bte_copy'ng * both a partition's reserved page and its XPC variables. Its size was diff --git a/arch/ia64/sn/kernel/xpnet.c b/arch/ia64/sn/kernel/xpnet.c index 78c13d676fa6..d0c2c114a459 100644 --- a/arch/ia64/sn/kernel/xpnet.c +++ b/arch/ia64/sn/kernel/xpnet.c @@ -636,6 +636,10 @@ xpnet_init(void) int result = -ENOMEM; + if (!ia64_platform_is("sn2")) { + return -ENODEV; + } + dev_info(xpnet, "registering network device %s\n", XPNET_DEVICE_NAME); /* From 9b17e7e74e767d8a494a74c3c459aeecd1e08c5f Mon Sep 17 00:00:00 2001 From: Jack Steiner Date: Thu, 8 Sep 2005 15:28:28 -0500 Subject: [PATCH 9/9] [IA64] Increase max physical address for SN platforms Increase the value for the maximum physical address on SN systems. Signed-off-by: Jack Steiner Signed-off-by: Tony Luck --- arch/ia64/sn/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c index a594aca959e6..14908ad7db8c 100644 --- a/arch/ia64/sn/kernel/setup.c +++ b/arch/ia64/sn/kernel/setup.c @@ -56,7 +56,7 @@ DEFINE_PER_CPU(struct pda_s, pda_percpu); -#define MAX_PHYS_MEMORY (1UL << 49) /* 1 TB */ +#define MAX_PHYS_MEMORY (1UL << IA64_MAX_PHYS_BITS) /* Max physical address supported */ lboard_t *root_lboard[MAX_COMPACT_NODES];