diff options
Diffstat (limited to 'arch/sparc')
25 files changed, 123 insertions, 107 deletions
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 84437a4c6545..8535e19062f6 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -32,6 +32,7 @@ config SPARC  	select GENERIC_IRQ_SHOW  	select ARCH_WANT_IPC_PARSE_VERSION  	select GENERIC_PCI_IOMAP +	select HAS_IOPORT  	select HAVE_NMI_WATCHDOG if SPARC64  	select HAVE_CBPF_JIT if SPARC32  	select HAVE_EBPF_JIT if SPARC64 @@ -270,18 +271,17 @@ config ARCH_SPARSEMEM_DEFAULT  	def_bool y if SPARC64  config ARCH_FORCE_MAX_ORDER -	int "Maximum zone order" -	default "13" +	int "Order of maximal physically contiguous allocations" +	default "12"  	help -	  The kernel memory allocator divides physically contiguous memory -	  blocks into "zones", where each zone is a power of two number of -	  pages.  This option selects the largest power of two that the kernel -	  keeps in the memory allocator.  If you need to allocate very large -	  blocks of physically contiguous memory, then you may need to -	  increase this value. - -	  This config option is actually maximum order plus one. For example, -	  a value of 13 means that the largest free memory block is 2^12 pages. +	  The kernel page allocator limits the size of maximal physically +	  contiguous allocations. The limit is called MAX_ORDER and it +	  defines the maximal power of two of number of pages that can be +	  allocated as a single contiguous block. This option allows +	  overriding the default setting when ability to allocate very +	  large blocks of physically contiguous memory is required. + +	  Don't change if unsure.  if SPARC64 || COMPILE_TEST  source "kernel/power/Kconfig" diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile index a4ea5b05f288..74be90529a18 100644 --- a/arch/sparc/Makefile +++ b/arch/sparc/Makefile @@ -83,18 +83,11 @@ vdso_install:  KBUILD_IMAGE := $(boot)/zImage  # Don't use tabs in echo arguments. -ifeq ($(ARCH),sparc)  define archhelp -  echo  '* image        - kernel image ($(boot)/image)' -  echo  '* zImage       - stripped kernel image ($(boot)/zImage)' +  echo  '* vmlinux      - standard SPARC kernel' +  echo  '  image        - kernel image ($(boot)/image)' +  echo  '* zImage       - stripped/compressed kernel image ($(boot)/zImage)'    echo  '  uImage       - U-Boot SPARC32 Image (only for LEON)' +  echo  '  vmlinux.aout - a.out kernel for SPARC64'    echo  '  tftpboot.img - image prepared for tftp'  endef -else -define archhelp -  echo  '* vmlinux      - standard sparc64 kernel' -  echo  '* zImage       - stripped and compressed sparc64 kernel ($(boot)/zImage)' -  echo  '  vmlinux.aout - a.out kernel for sparc64' -  echo  '  tftpboot.img - image prepared for tftp' -endef -endif diff --git a/arch/sparc/include/asm/cmpxchg_32.h b/arch/sparc/include/asm/cmpxchg_32.h index 27a57a3a7597..7a1339533d1d 100644 --- a/arch/sparc/include/asm/cmpxchg_32.h +++ b/arch/sparc/include/asm/cmpxchg_32.h @@ -15,7 +15,7 @@  unsigned long __xchg_u32(volatile u32 *m, u32 new);  void __xchg_called_with_bad_pointer(void); -static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, int size) +static inline unsigned long __arch_xchg(unsigned long x, __volatile__ void * ptr, int size)  {  	switch (size) {  	case 4: @@ -25,7 +25,7 @@ static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, int  	return x;  } -#define arch_xchg(ptr,x) ({(__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)));}) +#define arch_xchg(ptr,x) ({(__typeof__(*(ptr)))__arch_xchg((unsigned long)(x),(ptr),sizeof(*(ptr)));})  /* Emulate cmpxchg() the same way we emulate atomics,   * by hashing the object address and indexing into an array diff --git a/arch/sparc/include/asm/cmpxchg_64.h b/arch/sparc/include/asm/cmpxchg_64.h index 12d00a42c0a3..66cd61dde9ec 100644 --- a/arch/sparc/include/asm/cmpxchg_64.h +++ b/arch/sparc/include/asm/cmpxchg_64.h @@ -55,7 +55,7 @@ static inline unsigned long xchg64(__volatile__ unsigned long *m, unsigned long  #define arch_xchg(ptr,x)							\  ({	__typeof__(*(ptr)) __ret;					\  	__ret = (__typeof__(*(ptr)))					\ -		__xchg((unsigned long)(x), (ptr), sizeof(*(ptr)));	\ +		__arch_xchg((unsigned long)(x), (ptr), sizeof(*(ptr)));	\  	__ret;								\  }) @@ -87,8 +87,8 @@ xchg16(__volatile__ unsigned short *m, unsigned short val)  	return (load32 & mask) >> bit_shift;  } -static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, -				       int size) +static inline unsigned long +__arch_xchg(unsigned long x, __volatile__ void * ptr, int size)  {  	switch (size) {  	case 2: diff --git a/arch/sparc/include/asm/mmu_context_64.h b/arch/sparc/include/asm/mmu_context_64.h index 7a8380c63aab..799e797c5cdd 100644 --- a/arch/sparc/include/asm/mmu_context_64.h +++ b/arch/sparc/include/asm/mmu_context_64.h @@ -185,6 +185,12 @@ static inline void finish_arch_post_lock_switch(void)  	}  } +#define mm_untag_mask mm_untag_mask +static inline unsigned long mm_untag_mask(struct mm_struct *mm) +{ +       return -1UL >> adi_nbits(); +} +  #include <asm-generic/mmu_context.h>  #endif /* !(__ASSEMBLY__) */ diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h index 2dc8d4641734..5563efa1a19f 100644 --- a/arch/sparc/include/asm/pgtable_64.h +++ b/arch/sparc/include/asm/pgtable_64.h @@ -357,6 +357,42 @@ static inline pgprot_t pgprot_noncached(pgprot_t prot)   */  #define pgprot_noncached pgprot_noncached +static inline unsigned long pte_dirty(pte_t pte) +{ +	unsigned long mask; + +	__asm__ __volatile__( +	"\n661:	mov		%1, %0\n" +	"	nop\n" +	"	.section	.sun4v_2insn_patch, \"ax\"\n" +	"	.word		661b\n" +	"	sethi		%%uhi(%2), %0\n" +	"	sllx		%0, 32, %0\n" +	"	.previous\n" +	: "=r" (mask) +	: "i" (_PAGE_MODIFIED_4U), "i" (_PAGE_MODIFIED_4V)); + +	return (pte_val(pte) & mask); +} + +static inline unsigned long pte_write(pte_t pte) +{ +	unsigned long mask; + +	__asm__ __volatile__( +	"\n661:	mov		%1, %0\n" +	"	nop\n" +	"	.section	.sun4v_2insn_patch, \"ax\"\n" +	"	.word		661b\n" +	"	sethi		%%uhi(%2), %0\n" +	"	sllx		%0, 32, %0\n" +	"	.previous\n" +	: "=r" (mask) +	: "i" (_PAGE_WRITE_4U), "i" (_PAGE_WRITE_4V)); + +	return (pte_val(pte) & mask); +} +  #if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)  pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags);  #define arch_make_huge_pte arch_make_huge_pte @@ -418,28 +454,43 @@ static inline bool is_hugetlb_pte(pte_t pte)  }  #endif +static inline pte_t __pte_mkhwwrite(pte_t pte) +{ +	unsigned long val = pte_val(pte); + +	/* +	 * Note: we only want to set the HW writable bit if the SW writable bit +	 * and the SW dirty bit are set. +	 */ +	__asm__ __volatile__( +	"\n661:	or		%0, %2, %0\n" +	"	.section	.sun4v_1insn_patch, \"ax\"\n" +	"	.word		661b\n" +	"	or		%0, %3, %0\n" +	"	.previous\n" +	: "=r" (val) +	: "0" (val), "i" (_PAGE_W_4U), "i" (_PAGE_W_4V)); + +	return __pte(val); +} +  static inline pte_t pte_mkdirty(pte_t pte)  { -	unsigned long val = pte_val(pte), tmp; +	unsigned long val = pte_val(pte), mask;  	__asm__ __volatile__( -	"\n661:	or		%0, %3, %0\n" -	"	nop\n" -	"\n662:	nop\n" +	"\n661:	mov		%1, %0\n"  	"	nop\n"  	"	.section	.sun4v_2insn_patch, \"ax\"\n"  	"	.word		661b\n" -	"	sethi		%%uhi(%4), %1\n" -	"	sllx		%1, 32, %1\n" -	"	.word		662b\n" -	"	or		%1, %%lo(%4), %1\n" -	"	or		%0, %1, %0\n" +	"	sethi		%%uhi(%2), %0\n" +	"	sllx		%0, 32, %0\n"  	"	.previous\n" -	: "=r" (val), "=r" (tmp) -	: "0" (val), "i" (_PAGE_MODIFIED_4U | _PAGE_W_4U), -	  "i" (_PAGE_MODIFIED_4V | _PAGE_W_4V)); +	: "=r" (mask) +	: "i" (_PAGE_MODIFIED_4U), "i" (_PAGE_MODIFIED_4V)); -	return __pte(val); +	pte = __pte(val | mask); +	return pte_write(pte) ? __pte_mkhwwrite(pte) : pte;  }  static inline pte_t pte_mkclean(pte_t pte) @@ -481,7 +532,8 @@ static inline pte_t pte_mkwrite(pte_t pte)  	: "=r" (mask)  	: "i" (_PAGE_WRITE_4U), "i" (_PAGE_WRITE_4V)); -	return __pte(val | mask); +	pte = __pte(val | mask); +	return pte_dirty(pte) ? __pte_mkhwwrite(pte) : pte;  }  static inline pte_t pte_wrprotect(pte_t pte) @@ -584,42 +636,6 @@ static inline unsigned long pte_young(pte_t pte)  	return (pte_val(pte) & mask);  } -static inline unsigned long pte_dirty(pte_t pte) -{ -	unsigned long mask; - -	__asm__ __volatile__( -	"\n661:	mov		%1, %0\n" -	"	nop\n" -	"	.section	.sun4v_2insn_patch, \"ax\"\n" -	"	.word		661b\n" -	"	sethi		%%uhi(%2), %0\n" -	"	sllx		%0, 32, %0\n" -	"	.previous\n" -	: "=r" (mask) -	: "i" (_PAGE_MODIFIED_4U), "i" (_PAGE_MODIFIED_4V)); - -	return (pte_val(pte) & mask); -} - -static inline unsigned long pte_write(pte_t pte) -{ -	unsigned long mask; - -	__asm__ __volatile__( -	"\n661:	mov		%1, %0\n" -	"	nop\n" -	"	.section	.sun4v_2insn_patch, \"ax\"\n" -	"	.word		661b\n" -	"	sethi		%%uhi(%2), %0\n" -	"	sllx		%0, 32, %0\n" -	"	.previous\n" -	: "=r" (mask) -	: "i" (_PAGE_WRITE_4U), "i" (_PAGE_WRITE_4V)); - -	return (pte_val(pte) & mask); -} -  static inline unsigned long pte_exec(pte_t pte)  {  	unsigned long mask; diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h index 587edb8b5a65..8184575b1336 100644 --- a/arch/sparc/include/asm/prom.h +++ b/arch/sparc/include/asm/prom.h @@ -19,11 +19,14 @@  #include <linux/mutex.h>  #include <linux/atomic.h>  #include <linux/irqdomain.h> +#include <linux/spinlock.h>  #define of_compat_cmp(s1, s2, l)	strncmp((s1), (s2), (l))  #define of_prop_cmp(s1, s2)		strcasecmp((s1), (s2))  #define of_node_cmp(s1, s2)		strcmp((s1), (s2)) +extern raw_spinlock_t devtree_lock; +  struct of_irq_controller {  	unsigned int	(*irq_build)(struct device_node *, unsigned int, void *);  	void		*data; diff --git a/arch/sparc/include/asm/smp_64.h b/arch/sparc/include/asm/smp_64.h index e75783b6abc4..505b6700805d 100644 --- a/arch/sparc/include/asm/smp_64.h +++ b/arch/sparc/include/asm/smp_64.h @@ -49,7 +49,7 @@ int hard_smp_processor_id(void);  void smp_fill_in_cpu_possible_map(void);  void smp_fill_in_sib_core_maps(void); -void cpu_play_dead(void); +void __noreturn cpu_play_dead(void);  void smp_fetch_global_regs(void);  void smp_fetch_global_pmu(void); diff --git a/arch/sparc/include/asm/uaccess_64.h b/arch/sparc/include/asm/uaccess_64.h index 94266a5c5b04..b825a5dd0210 100644 --- a/arch/sparc/include/asm/uaccess_64.h +++ b/arch/sparc/include/asm/uaccess_64.h @@ -8,8 +8,10 @@  #include <linux/compiler.h>  #include <linux/string.h> +#include <linux/mm_types.h>  #include <asm/asi.h>  #include <asm/spitfire.h> +#include <asm/pgtable.h>  #include <asm/processor.h>  #include <asm-generic/access_ok.h> diff --git a/arch/sparc/kernel/leon_pci.c b/arch/sparc/kernel/leon_pci.c index e5e5ff6b9a5c..b6663a3fbae9 100644 --- a/arch/sparc/kernel/leon_pci.c +++ b/arch/sparc/kernel/leon_pci.c @@ -62,15 +62,14 @@ void leon_pci_init(struct platform_device *ofdev, struct leon_pci_info *info)  int pcibios_enable_device(struct pci_dev *dev, int mask)  { +	struct resource *res;  	u16 cmd, oldcmd;  	int i;  	pci_read_config_word(dev, PCI_COMMAND, &cmd);  	oldcmd = cmd; -	for (i = 0; i < PCI_NUM_RESOURCES; i++) { -		struct resource *res = &dev->resource[i]; - +	pci_dev_for_each_resource(dev, res, i) {  		/* Only set up the requested stuff */  		if (!(mask & (1<<i)))  			continue; diff --git a/arch/sparc/kernel/of_device_32.c b/arch/sparc/kernel/of_device_32.c index 4ebf51e6e78e..b60f58e04164 100644 --- a/arch/sparc/kernel/of_device_32.c +++ b/arch/sparc/kernel/of_device_32.c @@ -29,7 +29,7 @@ static int of_bus_pci_match(struct device_node *np)  		 * parent as-is, not with the PCI translate  		 * method which chops off the top address cell.  		 */ -		if (!of_find_property(np, "ranges", NULL)) +		if (!of_property_present(np, "ranges"))  			return 0;  		return 1; @@ -223,7 +223,7 @@ static int __init build_one_resource(struct device_node *parent,  static int __init use_1to1_mapping(struct device_node *pp)  {  	/* If we have a ranges property in the parent, use it.  */ -	if (of_find_property(pp, "ranges", NULL) != NULL) +	if (of_property_present(pp, "ranges"))  		return 0;  	/* Some SBUS devices use intermediate nodes to express diff --git a/arch/sparc/kernel/of_device_64.c b/arch/sparc/kernel/of_device_64.c index 5a9f86b1d4e7..5b5143e17ba3 100644 --- a/arch/sparc/kernel/of_device_64.c +++ b/arch/sparc/kernel/of_device_64.c @@ -58,7 +58,7 @@ static int of_bus_pci_match(struct device_node *np)  		 * parent as-is, not with the PCI translate  		 * method which chops off the top address cell.  		 */ -		if (!of_find_property(np, "ranges", NULL)) +		if (!of_property_present(np, "ranges"))  			return 0;  		return 1; @@ -78,7 +78,7 @@ static int of_bus_simba_match(struct device_node *np)  	 * simba.  	 */  	if (of_node_name_eq(np, "pci")) { -		if (!of_find_property(np, "ranges", NULL)) +		if (!of_property_present(np, "ranges"))  			return 1;  	} @@ -283,7 +283,7 @@ static int __init build_one_resource(struct device_node *parent,  static int __init use_1to1_mapping(struct device_node *pp)  {  	/* If we have a ranges property in the parent, use it.  */ -	if (of_find_property(pp, "ranges", NULL) != NULL) +	if (of_property_present(pp, "ranges"))  		return 0;  	/* If the parent is the dma node of an ISA bus, pass diff --git a/arch/sparc/kernel/of_device_common.c b/arch/sparc/kernel/of_device_common.c index e717a56efc5d..60f86b837658 100644 --- a/arch/sparc/kernel/of_device_common.c +++ b/arch/sparc/kernel/of_device_common.c @@ -162,7 +162,7 @@ int of_bus_sbus_match(struct device_node *np)  		 * don't have some intervening real bus that provides  		 * ranges based translations.  		 */ -		if (of_find_property(dp, "ranges", NULL) != NULL) +		if (of_property_present(dp, "ranges"))  			break;  		dp = dp->parent; diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c index cb1ef25116e9..a948a49817c7 100644 --- a/arch/sparc/kernel/pci.c +++ b/arch/sparc/kernel/pci.c @@ -663,11 +663,10 @@ static void pci_claim_bus_resources(struct pci_bus *bus)  	struct pci_dev *dev;  	list_for_each_entry(dev, &bus->devices, bus_list) { +		struct resource *r;  		int i; -		for (i = 0; i < PCI_NUM_RESOURCES; i++) { -			struct resource *r = &dev->resource[i]; - +		pci_dev_for_each_resource(dev, r, i) {  			if (r->parent || !r->start || !r->flags)  				continue; @@ -724,15 +723,14 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,  int pcibios_enable_device(struct pci_dev *dev, int mask)  { +	struct resource *res;  	u16 cmd, oldcmd;  	int i;  	pci_read_config_word(dev, PCI_COMMAND, &cmd);  	oldcmd = cmd; -	for (i = 0; i < PCI_NUM_RESOURCES; i++) { -		struct resource *res = &dev->resource[i]; - +	pci_dev_for_each_resource(dev, res, i) {  		/* Only set up the requested stuff */  		if (!(mask & (1<<i)))  			continue; diff --git a/arch/sparc/kernel/pci_schizo.c b/arch/sparc/kernel/pci_schizo.c index 421aba00e6b0..23b47f7fdb1d 100644 --- a/arch/sparc/kernel/pci_schizo.c +++ b/arch/sparc/kernel/pci_schizo.c @@ -1270,7 +1270,7 @@ static void schizo_pbm_hw_init(struct pci_pbm_info *pbm)  	    pbm->chip_version >= 0x2)  		tmp |= 0x3UL << SCHIZO_PCICTRL_PTO_SHIFT; -	if (!of_find_property(pbm->op->dev.of_node, "no-bus-parking", NULL)) +	if (!of_property_read_bool(pbm->op->dev.of_node, "no-bus-parking"))  		tmp |= SCHIZO_PCICTRL_PARK;  	else  		tmp &= ~SCHIZO_PCICTRL_PARK; diff --git a/arch/sparc/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c index 384480971805..7d91ca6aa675 100644 --- a/arch/sparc/kernel/pci_sun4v.c +++ b/arch/sparc/kernel/pci_sun4v.c @@ -193,7 +193,7 @@ static void *dma_4v_alloc_coherent(struct device *dev, size_t size,  	size = IO_PAGE_ALIGN(size);  	order = get_order(size); -	if (unlikely(order >= MAX_ORDER)) +	if (unlikely(order > MAX_ORDER))  		return NULL;  	npages = size >> IO_PAGE_SHIFT; diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c index ee4c9a9a171c..25fe0a061732 100644 --- a/arch/sparc/kernel/pcic.c +++ b/arch/sparc/kernel/pcic.c @@ -643,15 +643,14 @@ void pcibios_fixup_bus(struct pci_bus *bus)  int pcibios_enable_device(struct pci_dev *dev, int mask)  { +	struct resource *res;  	u16 cmd, oldcmd;  	int i;  	pci_read_config_word(dev, PCI_COMMAND, &cmd);  	oldcmd = cmd; -	for (i = 0; i < PCI_NUM_RESOURCES; i++) { -		struct resource *res = &dev->resource[i]; - +	pci_dev_for_each_resource(dev, res, i) {  		/* Only set up the requested stuff */  		if (!(mask & (1<<i)))  			continue; diff --git a/arch/sparc/kernel/power.c b/arch/sparc/kernel/power.c index d941875dd718..8147985a1dc4 100644 --- a/arch/sparc/kernel/power.c +++ b/arch/sparc/kernel/power.c @@ -28,7 +28,7 @@ static int has_button_interrupt(unsigned int irq, struct device_node *dp)  {  	if (irq == 0xffffffff)  		return 0; -	if (!of_find_property(dp, "button", NULL)) +	if (!of_property_read_bool(dp, "button"))  		return 0;  	return 1; diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c index 91c2b8124527..b51d8fb0ecdc 100644 --- a/arch/sparc/kernel/process_64.c +++ b/arch/sparc/kernel/process_64.c @@ -95,7 +95,7 @@ void arch_cpu_idle(void)  }  #ifdef CONFIG_HOTPLUG_CPU -void arch_cpu_idle_dead(void) +void __noreturn arch_cpu_idle_dead(void)  {  	sched_preempt_enable_no_resched();  	cpu_play_dead(); diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c index f883a50fa333..998aa693d491 100644 --- a/arch/sparc/kernel/prom_64.c +++ b/arch/sparc/kernel/prom_64.c @@ -502,7 +502,7 @@ static void *fill_in_one_cpu(struct device_node *dp, int cpuid, int arg)  	struct device_node *portid_parent = NULL;  	int portid = -1; -	if (of_find_property(dp, "cpuid", NULL)) { +	if (of_property_present(dp, "cpuid")) {  		int limit = 2;  		portid_parent = dp; diff --git a/arch/sparc/kernel/smp_32.c b/arch/sparc/kernel/smp_32.c index ad8094d955eb..87eaa7719fa2 100644 --- a/arch/sparc/kernel/smp_32.c +++ b/arch/sparc/kernel/smp_32.c @@ -120,7 +120,7 @@ void cpu_panic(void)  struct linux_prom_registers smp_penguin_ctable = { 0 }; -void smp_send_reschedule(int cpu) +void arch_smp_send_reschedule(int cpu)  {  	/*  	 * CPU model dependent way of implementing IPI generation targeting diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c index a55295d1b924..e5964d1d8b37 100644 --- a/arch/sparc/kernel/smp_64.c +++ b/arch/sparc/kernel/smp_64.c @@ -1430,7 +1430,7 @@ static unsigned long send_cpu_poke(int cpu)  	return hv_err;  } -void smp_send_reschedule(int cpu) +void arch_smp_send_reschedule(int cpu)  {  	if (cpu == smp_processor_id()) {  		WARN_ON_ONCE(preemptible()); diff --git a/arch/sparc/kernel/time_32.c b/arch/sparc/kernel/time_32.c index 8a08830e4a65..958c2cf4479b 100644 --- a/arch/sparc/kernel/time_32.c +++ b/arch/sparc/kernel/time_32.c @@ -277,7 +277,7 @@ static int clock_probe(struct platform_device *op)  		return -ENODEV;  	/* Only the primary RTC has an address property */ -	if (!of_find_property(dp, "address", NULL)) +	if (!of_property_present(dp, "address"))  		return -ENODEV;  	m48t59_rtc.resource = &op->resource[0]; diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c index 5b4de4a89dec..08ffd17d5ec3 100644 --- a/arch/sparc/kernel/traps_64.c +++ b/arch/sparc/kernel/traps_64.c @@ -897,7 +897,7 @@ void __init cheetah_ecache_flush_init(void)  	/* Now allocate error trap reporting scoreboard. */  	sz = NR_CPUS * (2 * sizeof(struct cheetah_err_info)); -	for (order = 0; order < MAX_ORDER; order++) { +	for (order = 0; order <= MAX_ORDER; order++) {  		if ((PAGE_SIZE << order) >= sz)  			break;  	} diff --git a/arch/sparc/mm/tsb.c b/arch/sparc/mm/tsb.c index 912205787161..5e2931a18409 100644 --- a/arch/sparc/mm/tsb.c +++ b/arch/sparc/mm/tsb.c @@ -402,8 +402,8 @@ void tsb_grow(struct mm_struct *mm, unsigned long tsb_index, unsigned long rss)  	unsigned long new_rss_limit;  	gfp_t gfp_flags; -	if (max_tsb_size > (PAGE_SIZE << MAX_ORDER)) -		max_tsb_size = (PAGE_SIZE << MAX_ORDER); +	if (max_tsb_size > PAGE_SIZE << MAX_ORDER) +		max_tsb_size = PAGE_SIZE << MAX_ORDER;  	new_cache_index = 0;  	for (new_size = 8192; new_size < max_tsb_size; new_size <<= 1UL) {  |