From 9be26f4c4b138c425598bd3cc50411bd87fce287 Mon Sep 17 00:00:00 2001 From: vignesh babu Date: Thu, 7 Jun 2007 15:27:46 +0530 Subject: [IA64] is_power_of_2-ia64/mm/hugetlbpage.c Replacing (n & (n-1)) in the context of power of 2 checks with is_power_of_2 Signed-off-by: vignesh babu Signed-off-by: Tony Luck diff --git a/arch/ia64/mm/hugetlbpage.c b/arch/ia64/mm/hugetlbpage.c index 1346b7f..d22861c 100644 --- a/arch/ia64/mm/hugetlbpage.c +++ b/arch/ia64/mm/hugetlbpage.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -182,7 +183,7 @@ static int __init hugetlb_setup_sz(char *str) tr_pages = 0x15557000UL; size = memparse(str, &str); - if (*str || (size & (size-1)) || !(tr_pages & size) || + if (*str || !is_power_of_2(size) || !(tr_pages & size) || size <= PAGE_SIZE || size >= (1UL << PAGE_SHIFT << MAX_ORDER)) { printk(KERN_WARNING "Invalid huge page size specified\n"); -- cgit v0.10.2 From 66fa9b107e259d01929fe647796b3021d3a83c4a Mon Sep 17 00:00:00 2001 From: Keith Owens Date: Tue, 26 Jun 2007 16:25:22 +1000 Subject: [IA64] Correct unwind validation code Both rp_loc and pfs_loc can be in the register stack area _or_ they can be in the memory stack area, the latter occurs when a struct pt_regs is pushed. Correct the validation check on these fields to check for both stack areas. Not allowing for memory stack locations means no backtrace past ia64_leave_kernel, or any other code that uses PT_REGS_UNWIND_INFO. Signed-off-by: Keith Owens Signed-off-by: Tony Luck diff --git a/arch/ia64/kernel/unwind.c b/arch/ia64/kernel/unwind.c index b0b08b5..c1bdb51 100644 --- a/arch/ia64/kernel/unwind.c +++ b/arch/ia64/kernel/unwind.c @@ -1856,11 +1856,19 @@ find_save_locs (struct unw_frame_info *info) return 0; } +static int +unw_valid(const struct unw_frame_info *info, unsigned long* p) +{ + unsigned long loc = (unsigned long)p; + return (loc >= info->regstk.limit && loc < info->regstk.top) || + (loc >= info->memstk.top && loc < info->memstk.limit); +} + int unw_unwind (struct unw_frame_info *info) { unsigned long prev_ip, prev_sp, prev_bsp; - unsigned long ip, pr, num_regs, rp_loc, pfs_loc; + unsigned long ip, pr, num_regs; STAT(unsigned long start, flags;) int retval; @@ -1871,8 +1879,7 @@ unw_unwind (struct unw_frame_info *info) prev_bsp = info->bsp; /* validate the return IP pointer */ - rp_loc = (unsigned long) info->rp_loc; - if ((rp_loc < info->regstk.limit) || (rp_loc > info->regstk.top)) { + if (!unw_valid(info, info->rp_loc)) { /* FIXME: should really be level 0 but it occurs too often. KAO */ UNW_DPRINT(1, "unwind.%s: failed to locate return link (ip=0x%lx)!\n", __FUNCTION__, info->ip); @@ -1888,8 +1895,7 @@ unw_unwind (struct unw_frame_info *info) } /* validate the previous stack frame pointer */ - pfs_loc = (unsigned long) info->pfs_loc; - if ((pfs_loc < info->regstk.limit) || (pfs_loc > info->regstk.top)) { + if (!unw_valid(info, info->pfs_loc)) { UNW_DPRINT(0, "unwind.%s: failed to locate ar.pfs!\n", __FUNCTION__); STAT(unw.stat.api.unwind_time += ia64_get_itc() - start; local_irq_restore(flags)); return -1; -- cgit v0.10.2 From 2e77ff21d225f7676517ac895df2be8ada573f4f Mon Sep 17 00:00:00 2001 From: MUNEDA Takahiro Date: Wed, 20 Jun 2007 13:00:00 +0900 Subject: [IA64] remove duplicate header include line Remove duplicate header include line from arch/ia64/kernel/time.c. Signed-off-by: MUNEDA Takahiro Signed-off-by: Tony Luck diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c index a06667c..3486fe7 100644 --- a/arch/ia64/kernel/time.c +++ b/arch/ia64/kernel/time.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include -- cgit v0.10.2 From eaf6c766446c0faa326b339900f975e6f1f62b01 Mon Sep 17 00:00:00 2001 From: Dean Nelson Date: Tue, 19 Jun 2007 06:26:17 -0500 Subject: [IA64] change sh_change_coherence oemcall to use nolock Change sn_change_coherence's ia64_sal_oemcall to the nolock variety since PROM does the locking for this function internally. Signed-off-by: Dean Nelson Signed-off-by: Tony Luck diff --git a/include/asm-ia64/sn/sn_sal.h b/include/asm-ia64/sn/sn_sal.h index 291e8ce..d3566a2 100644 --- a/include/asm-ia64/sn/sn_sal.h +++ b/include/asm-ia64/sn/sn_sal.h @@ -696,8 +696,8 @@ static inline int sn_change_coherence(u64 *new_domain, u64 *old_domain) { struct ia64_sal_retval ret_stuff; - ia64_sal_oemcall(&ret_stuff, SN_SAL_COHERENCE, (u64)new_domain, - (u64)old_domain, 0, 0, 0, 0, 0); + ia64_sal_oemcall_nolock(&ret_stuff, SN_SAL_COHERENCE, (u64)new_domain, + (u64)old_domain, 0, 0, 0, 0, 0); return ret_stuff.status; } -- cgit v0.10.2 From c034637967881830979b5415e55578e42f806659 Mon Sep 17 00:00:00 2001 From: Russ Anderson Date: Thu, 14 Jun 2007 16:01:24 -0500 Subject: [IA64] Force error to surface in nofault code Montecito behaves slightly differently than previous processors, resulting in the MCA due to a failed PIO read to sometimes surfacing outside the nofault code. Adding an additional or and stop bits ensures the MCA surfaces in the nofault code. Signed-off-by: Russ Anderson Signed-off-by: Tony Luck diff --git a/arch/ia64/sn/kernel/xp_nofault.S b/arch/ia64/sn/kernel/xp_nofault.S index b772543..54e8973 100644 --- a/arch/ia64/sn/kernel/xp_nofault.S +++ b/arch/ia64/sn/kernel/xp_nofault.S @@ -21,7 +21,8 @@ xp_nofault_PIOR: mov r8=r0 // Stage a success return value ld8.acq r9=[r32];; // PIO Read the specified register - adds r9=1,r9 // Add to force a consume + adds r9=1,r9;; // Add to force consumption + or r9=r9,r9;; // Or to force consumption br.ret.sptk.many b0;; // Return success .global xp_error_PIOR -- cgit v0.10.2 From 1ee27a4eedf3cc08245d395936c1bfaf80c074cc Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 18 Jun 2007 17:19:05 +0200 Subject: [IA64] Make SN2 PCI code use ioremap rather than manually mangle the address This one changes the SN2 specific PCI drivers to use ioremap() for obtaining the real address to access for the PCI registers instead of manually calculating them with __IA64_UNCACHED_OFFSET. The patch should have no real change when running on a normal Linux kernel, but when running as a paravirtualized it is needed. Signed-off-by: Jes Sorenson Signed-off-by: Tony Luck diff --git a/arch/ia64/sn/pci/pcibr/pcibr_provider.c b/arch/ia64/sn/pci/pcibr/pcibr_provider.c index 04a82560..b42bfca 100644 --- a/arch/ia64/sn/pci/pcibr/pcibr_provider.c +++ b/arch/ia64/sn/pci/pcibr/pcibr_provider.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include "xtalk/xwidgetdev.h" #include "xtalk/hubdev.h" @@ -130,9 +131,9 @@ pcibr_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont } memcpy(soft, prom_bussoft, sizeof(struct pcibus_info)); - soft->pbi_buscommon.bs_base = - (((u64) soft->pbi_buscommon. - bs_base << 4) >> 4) | __IA64_UNCACHED_OFFSET; + soft->pbi_buscommon.bs_base = (unsigned long) + ioremap(REGION_OFFSET(soft->pbi_buscommon.bs_base), + sizeof(struct pic)); spin_lock_init(&soft->pbi_lock); diff --git a/arch/ia64/sn/pci/tioca_provider.c b/arch/ia64/sn/pci/tioca_provider.c index b9bedbd..d798dd4 100644 --- a/arch/ia64/sn/pci/tioca_provider.c +++ b/arch/ia64/sn/pci/tioca_provider.c @@ -610,7 +610,9 @@ tioca_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont return NULL; memcpy(tioca_common, prom_bussoft, sizeof(struct tioca_common)); - tioca_common->ca_common.bs_base |= __IA64_UNCACHED_OFFSET; + tioca_common->ca_common.bs_base = (unsigned long) + ioremap(REGION_OFFSET(tioca_common->ca_common.bs_base), + sizeof(struct tioca_common)); /* init kernel-private area */ diff --git a/arch/ia64/sn/pci/tioce_provider.c b/arch/ia64/sn/pci/tioce_provider.c index f4c0b96..84b72b2 100644 --- a/arch/ia64/sn/pci/tioce_provider.c +++ b/arch/ia64/sn/pci/tioce_provider.c @@ -1002,7 +1002,9 @@ tioce_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont return NULL; memcpy(tioce_common, prom_bussoft, sizeof(struct tioce_common)); - tioce_common->ce_pcibus.bs_base |= __IA64_UNCACHED_OFFSET; + tioce_common->ce_pcibus.bs_base = (unsigned long) + ioremap(REGION_OFFSET(tioce_common->ce_pcibus.bs_base), + sizeof(struct tioce_common)); tioce_kern = tioce_kern_init(tioce_common); if (tioce_kern == NULL) { -- cgit v0.10.2