reverted: --- linux-raspi2-4.8.0/arch/powerpc/include/asm/asm-prototypes.h +++ linux-raspi2-4.8.0.orig/arch/powerpc/include/asm/asm-prototypes.h @@ -15,8 +15,6 @@ #include #include -#include - /* SMP */ extern struct thread_info *current_set[NR_CPUS]; extern struct thread_info *secondary_ti; @@ -74,39 +72,4 @@ void machine_check_exception(struct pt_regs *regs); void __kprobes emulation_assist_interrupt(struct pt_regs *regs); -/* signals, syscalls and interrupts */ -#ifdef CONFIG_PPC64 -int sys_swapcontext(struct ucontext __user *old_ctx, - struct ucontext __user *new_ctx, - long ctx_size, long r6, long r7, long r8, struct pt_regs *regs); -#else -long sys_swapcontext(struct ucontext __user *old_ctx, - struct ucontext __user *new_ctx, - int ctx_size, int r6, int r7, int r8, struct pt_regs *regs); -#endif -long sys_switch_endian(void); -notrace unsigned int __check_irq_replay(void); -void notrace restore_interrupts(void); - -/* ptrace */ -long do_syscall_trace_enter(struct pt_regs *regs); -void do_syscall_trace_leave(struct pt_regs *regs); - -/* process */ -void restore_math(struct pt_regs *regs); -void restore_tm_state(struct pt_regs *regs); - -/* prom_init (OpenFirmware) */ -unsigned long __init prom_init(unsigned long r3, unsigned long r4, - unsigned long pp, - unsigned long r6, unsigned long r7, - unsigned long kbase); - -/* setup */ -void __init early_setup(unsigned long dt_ptr); -void early_setup_secondary(void); - -/* time */ -void accumulate_stolen_time(void); - #endif /* _ASM_POWERPC_ASM_PROTOTYPES_H */ reverted: --- linux-raspi2-4.8.0/arch/powerpc/include/asm/book3s/32/pgalloc.h +++ linux-raspi2-4.8.0.orig/arch/powerpc/include/asm/book3s/32/pgalloc.h @@ -2,42 +2,14 @@ #define _ASM_POWERPC_BOOK3S_32_PGALLOC_H #include -#include +/* For 32-bit, all levels of page tables are just drawn from get_free_page() */ +#define MAX_PGTABLE_INDEX_SIZE 0 -/* - * Functions that deal with pagetables that could be at any level of - * the table need to be passed an "index_size" so they know how to - * handle allocation. For PTE pages (which are linked to a struct - * page for now, and drawn from the main get_free_pages() pool), the - * allocation size will be (2^index_size * sizeof(pointer)) and - * allocations are drawn from the kmem_cache in PGT_CACHE(index_size). - * - * The maximum index size needs to be big enough to allow any - * pagetable sizes we need, but small enough to fit in the low bits of - * any page table pointer. In other words all pagetables, even tiny - * ones, must be aligned to allow at least enough low 0 bits to - * contain this value. This value is also used as a mask, so it must - * be one less than a power of two. - */ -#define MAX_PGTABLE_INDEX_SIZE 0xf extern void __bad_pte(pmd_t *pmd); +extern pgd_t *pgd_alloc(struct mm_struct *mm); +extern void pgd_free(struct mm_struct *mm, pgd_t *pgd); -extern struct kmem_cache *pgtable_cache[]; -#define PGT_CACHE(shift) ({ \ - BUG_ON(!(shift)); \ - pgtable_cache[(shift) - 1]; \ - }) - -static inline pgd_t *pgd_alloc(struct mm_struct *mm) -{ - return kmem_cache_alloc(PGT_CACHE(PGD_INDEX_SIZE), GFP_KERNEL); -} - -static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) -{ - kmem_cache_free(PGT_CACHE(PGD_INDEX_SIZE), pgd); -} /* * We don't have any real pmd's, and this code never triggers because @@ -96,12 +68,8 @@ static inline void pgtable_free(void *table, unsigned index_size) { + BUG_ON(index_size); /* 32-bit doesn't use this */ + free_page((unsigned long)table); - if (!index_size) { - free_page((unsigned long)table); - } else { - BUG_ON(index_size > MAX_PGTABLE_INDEX_SIZE); - kmem_cache_free(PGT_CACHE(index_size), table); - } } #define check_pgt_cache() do { } while (0) diff -u linux-raspi2-4.8.0/arch/powerpc/include/asm/book3s/32/pgtable.h linux-raspi2-4.8.0/arch/powerpc/include/asm/book3s/32/pgtable.h --- linux-raspi2-4.8.0/arch/powerpc/include/asm/book3s/32/pgtable.h +++ linux-raspi2-4.8.0/arch/powerpc/include/asm/book3s/32/pgtable.h @@ -8,23 +8,6 @@ /* And here we include common definitions */ #include -#define PTE_INDEX_SIZE PTE_SHIFT -#define PMD_INDEX_SIZE 0 -#define PUD_INDEX_SIZE 0 -#define PGD_INDEX_SIZE (32 - PGDIR_SHIFT) - -#define PMD_CACHE_INDEX PMD_INDEX_SIZE - -#ifndef __ASSEMBLY__ -#define PTE_TABLE_SIZE (sizeof(pte_t) << PTE_INDEX_SIZE) -#define PMD_TABLE_SIZE 0 -#define PUD_TABLE_SIZE 0 -#define PGD_TABLE_SIZE (sizeof(pgd_t) << PGD_INDEX_SIZE) -#endif /* __ASSEMBLY__ */ - -#define PTRS_PER_PTE (1 << PTE_INDEX_SIZE) -#define PTRS_PER_PGD (1 << PGD_INDEX_SIZE) - /* * The normal case is that PTEs are 32-bits and we have a 1-page * 1024-entry pgdir pointing to 1-page 1024-entry PTE pages. -- paulus @@ -36,10 +19,14 @@ * -Matt */ /* PGDIR_SHIFT determines what a top-level page table entry can map */ -#define PGDIR_SHIFT (PAGE_SHIFT + PTE_INDEX_SIZE) +#define PGDIR_SHIFT (PAGE_SHIFT + PTE_SHIFT) #define PGDIR_SIZE (1UL << PGDIR_SHIFT) #define PGDIR_MASK (~(PGDIR_SIZE-1)) +#define PTRS_PER_PTE (1 << PTE_SHIFT) +#define PTRS_PER_PMD 1 +#define PTRS_PER_PGD (1 << (32 - PGDIR_SHIFT)) + #define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE) /* * This is the bottom of the PKMAP area with HIGHMEM or an arbitrary @@ -95,8 +82,12 @@ extern unsigned long ioremap_bot; -/* Bits to mask out from a PGD to get to the PUD page */ -#define PGD_MASKED_BITS 0 +/* + * entries per page directory level: our page-table tree is two-level, so + * we don't really have any PMD directory. + */ +#define PTE_TABLE_SIZE (sizeof(pte_t) << PTE_SHIFT) +#define PGD_TABLE_SIZE (sizeof(pgd_t) << (32 - PGDIR_SHIFT)) #define pte_ERROR(e) \ pr_err("%s:%d: bad pte %llx.\n", __FILE__, __LINE__, \ @@ -293,6 +284,15 @@ #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) >> 3 }) #define __swp_entry_to_pte(x) ((pte_t) { (x).val << 3 }) +#ifndef CONFIG_PPC_4K_PAGES +void pgtable_cache_init(void); +#else +/* + * No page table caches to initialise + */ +#define pgtable_cache_init() do { } while (0) +#endif + extern int get_pteptr(struct mm_struct *mm, unsigned long addr, pte_t **ptep, pmd_t **pmdp); reverted: --- linux-raspi2-4.8.0/arch/powerpc/include/asm/book3s/64/mmu.h +++ linux-raspi2-4.8.0.orig/arch/powerpc/include/asm/book3s/64/mmu.h @@ -138,11 +138,5 @@ extern int (*register_process_table)(unsigned long base, unsigned long page_size, unsigned long tbl_size); -#ifdef CONFIG_PPC_PSERIES -extern void radix_init_pseries(void); -#else -static inline void radix_init_pseries(void) { }; -#endif - #endif /* __ASSEMBLY__ */ #endif /* _ASM_POWERPC_BOOK3S_64_MMU_H_ */ diff -u linux-raspi2-4.8.0/arch/powerpc/include/asm/book3s/64/pgtable.h linux-raspi2-4.8.0/arch/powerpc/include/asm/book3s/64/pgtable.h --- linux-raspi2-4.8.0/arch/powerpc/include/asm/book3s/64/pgtable.h +++ linux-raspi2-4.8.0/arch/powerpc/include/asm/book3s/64/pgtable.h @@ -371,23 +371,6 @@ return __pte(old); } -#define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL -static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, - unsigned long addr, - pte_t *ptep, int full) -{ - if (full && radix_enabled()) { - /* - * Let's skip the DD1 style pte update here. We know that - * this is a full mm pte clear and hence can be sure there is - * no parallel set_pte. - */ - return radix__ptep_get_and_clear_full(mm, addr, ptep, full); - } - return ptep_get_and_clear(mm, addr, ptep); -} - - static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t * ptep) { @@ -817,6 +800,9 @@ #define pgd_ERROR(e) \ pr_err("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) +void pgtable_cache_add(unsigned shift, void (*ctor)(void *)); +void pgtable_cache_init(void); + static inline int map_kernel_page(unsigned long ea, unsigned long pa, unsigned long flags) { diff -u linux-raspi2-4.8.0/arch/powerpc/include/asm/book3s/64/radix.h linux-raspi2-4.8.0/arch/powerpc/include/asm/book3s/64/radix.h --- linux-raspi2-4.8.0/arch/powerpc/include/asm/book3s/64/radix.h +++ linux-raspi2-4.8.0/arch/powerpc/include/asm/book3s/64/radix.h @@ -139,43 +139,30 @@ unsigned long new_pte; - old_pte = __radix_pte_update(ptep, ~0ul, 0); + old_pte = __radix_pte_update(ptep, ~0, 0); /* * new value of pte */ new_pte = (old_pte | set) & ~clr; - radix__flush_tlb_pte_p9_dd1(old_pte, mm, addr); - if (new_pte) + /* + * If we are trying to clear the pte, we can skip + * the below sequence and batch the tlb flush. The + * tlb flush batching is done by mmu gather code + */ + if (new_pte) { + asm volatile("ptesync" : : : "memory"); + radix__flush_tlb_pte_p9_dd1(old_pte, mm, addr); __radix_pte_update(ptep, 0, new_pte); + } } else old_pte = __radix_pte_update(ptep, clr, set); + asm volatile("ptesync" : : : "memory"); if (!huge) assert_pte_locked(mm, addr); return old_pte; } -static inline pte_t radix__ptep_get_and_clear_full(struct mm_struct *mm, - unsigned long addr, - pte_t *ptep, int full) -{ - unsigned long old_pte; - - if (full) { - /* - * If we are trying to clear the pte, we can skip - * the DD1 pte update sequence and batch the tlb flush. The - * tlb flush batching is done by mmu gather code. We - * still keep the cmp_xchg update to make sure we get - * correct R/C bit which might be updated via Nest MMU. - */ - old_pte = __radix_pte_update(ptep, ~0ul, 0); - } else - old_pte = radix__pte_update(mm, addr, ptep, ~0ul, 0, 0); - - return __pte(old_pte); -} - /* * Set the dirty and/or accessed bits atomically in a linux PTE, this * function doesn't need to invalidate tlb. @@ -193,6 +180,7 @@ unsigned long old_pte, new_pte; old_pte = __radix_pte_update(ptep, ~0, 0); + asm volatile("ptesync" : : : "memory"); /* * new value of pte */ reverted: --- linux-raspi2-4.8.0/arch/powerpc/include/asm/fadump.h +++ linux-raspi2-4.8.0.orig/arch/powerpc/include/asm/fadump.h @@ -45,6 +45,10 @@ #define memblock_num_regions(memblock_type) (memblock.memblock_type.cnt) +#ifndef ELF_CORE_EFLAGS +#define ELF_CORE_EFLAGS 0 +#endif + /* Firmware provided dump sections */ #define FADUMP_CPU_STATE_DATA 0x0001 #define FADUMP_HPTE_REGION 0x0002 reverted: --- linux-raspi2-4.8.0/arch/powerpc/include/asm/hvcall.h +++ linux-raspi2-4.8.0.orig/arch/powerpc/include/asm/hvcall.h @@ -275,10 +275,7 @@ #define H_COP 0x304 #define H_GET_MPP_X 0x314 #define H_SET_MODE 0x31C +#define MAX_HCALL_OPCODE H_SET_MODE -#define H_CLEAR_HPT 0x358 -#define H_REGISTER_PROC_TBL 0x37C -#define H_SIGNAL_SYS_RESET 0x380 -#define MAX_HCALL_OPCODE H_SIGNAL_SYS_RESET /* H_VIOCTL functions */ #define H_GET_VIOA_DUMP_SIZE 0x01 @@ -309,21 +306,6 @@ #define H_SET_MODE_RESOURCE_ADDR_TRANS_MODE 3 #define H_SET_MODE_RESOURCE_LE 4 -/* Values for argument to H_SIGNAL_SYS_RESET */ -#define H_SIGNAL_SYS_RESET_ALL -1 -#define H_SIGNAL_SYS_RESET_ALL_OTHERS -2 -/* >= 0 values are CPU number */ - -/* Flag values used in H_REGISTER_PROC_TBL hcall */ -#define PROC_TABLE_OP_MASK 0x18 -#define PROC_TABLE_DEREG 0x10 -#define PROC_TABLE_NEW 0x18 -#define PROC_TABLE_TYPE_MASK 0x06 -#define PROC_TABLE_HPT_SLB 0x00 -#define PROC_TABLE_HPT_PT 0x02 -#define PROC_TABLE_RADIX 0x04 -#define PROC_TABLE_GTSE 0x01 - #ifndef __ASSEMBLY__ /** @@ -430,6 +412,27 @@ } } +#ifdef CONFIG_PPC_PSERIES +extern int CMO_PrPSP; +extern int CMO_SecPSP; +extern unsigned long CMO_PageSize; + +static inline int cmo_get_primary_psp(void) +{ + return CMO_PrPSP; +} + +static inline int cmo_get_secondary_psp(void) +{ + return CMO_SecPSP; +} + +static inline unsigned long cmo_get_page_size(void) +{ + return CMO_PageSize; +} +#endif /* CONFIG_PPC_PSERIES */ + #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_HVCALL_H */ reverted: --- linux-raspi2-4.8.0/arch/powerpc/include/asm/nohash/32/pgalloc.h +++ linux-raspi2-4.8.0.orig/arch/powerpc/include/asm/nohash/32/pgalloc.h @@ -2,42 +2,14 @@ #define _ASM_POWERPC_PGALLOC_32_H #include -#include +/* For 32-bit, all levels of page tables are just drawn from get_free_page() */ +#define MAX_PGTABLE_INDEX_SIZE 0 -/* - * Functions that deal with pagetables that could be at any level of - * the table need to be passed an "index_size" so they know how to - * handle allocation. For PTE pages (which are linked to a struct - * page for now, and drawn from the main get_free_pages() pool), the - * allocation size will be (2^index_size * sizeof(pointer)) and - * allocations are drawn from the kmem_cache in PGT_CACHE(index_size). - * - * The maximum index size needs to be big enough to allow any - * pagetable sizes we need, but small enough to fit in the low bits of - * any page table pointer. In other words all pagetables, even tiny - * ones, must be aligned to allow at least enough low 0 bits to - * contain this value. This value is also used as a mask, so it must - * be one less than a power of two. - */ -#define MAX_PGTABLE_INDEX_SIZE 0xf extern void __bad_pte(pmd_t *pmd); +extern pgd_t *pgd_alloc(struct mm_struct *mm); +extern void pgd_free(struct mm_struct *mm, pgd_t *pgd); -extern struct kmem_cache *pgtable_cache[]; -#define PGT_CACHE(shift) ({ \ - BUG_ON(!(shift)); \ - pgtable_cache[(shift) - 1]; \ - }) - -static inline pgd_t *pgd_alloc(struct mm_struct *mm) -{ - return kmem_cache_alloc(PGT_CACHE(PGD_INDEX_SIZE), GFP_KERNEL); -} - -static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) -{ - kmem_cache_free(PGT_CACHE(PGD_INDEX_SIZE), pgd); -} /* * We don't have any real pmd's, and this code never triggers because @@ -96,12 +68,8 @@ static inline void pgtable_free(void *table, unsigned index_size) { + BUG_ON(index_size); /* 32-bit doesn't use this */ + free_page((unsigned long)table); - if (!index_size) { - free_page((unsigned long)table); - } else { - BUG_ON(index_size > MAX_PGTABLE_INDEX_SIZE); - kmem_cache_free(PGT_CACHE(index_size), table); - } } #define check_pgt_cache() do { } while (0) diff -u linux-raspi2-4.8.0/arch/powerpc/include/asm/nohash/32/pgtable.h linux-raspi2-4.8.0/arch/powerpc/include/asm/nohash/32/pgtable.h --- linux-raspi2-4.8.0/arch/powerpc/include/asm/nohash/32/pgtable.h +++ linux-raspi2-4.8.0/arch/powerpc/include/asm/nohash/32/pgtable.h @@ -16,23 +16,6 @@ #endif /* __ASSEMBLY__ */ -#define PTE_INDEX_SIZE PTE_SHIFT -#define PMD_INDEX_SIZE 0 -#define PUD_INDEX_SIZE 0 -#define PGD_INDEX_SIZE (32 - PGDIR_SHIFT) - -#define PMD_CACHE_INDEX PMD_INDEX_SIZE - -#ifndef __ASSEMBLY__ -#define PTE_TABLE_SIZE (sizeof(pte_t) << PTE_INDEX_SIZE) -#define PMD_TABLE_SIZE 0 -#define PUD_TABLE_SIZE 0 -#define PGD_TABLE_SIZE (sizeof(pgd_t) << PGD_INDEX_SIZE) -#endif /* __ASSEMBLY__ */ - -#define PTRS_PER_PTE (1 << PTE_INDEX_SIZE) -#define PTRS_PER_PGD (1 << PGD_INDEX_SIZE) - /* * The normal case is that PTEs are 32-bits and we have a 1-page * 1024-entry pgdir pointing to 1-page 1024-entry PTE pages. -- paulus @@ -44,12 +27,22 @@ * -Matt */ /* PGDIR_SHIFT determines what a top-level page table entry can map */ -#define PGDIR_SHIFT (PAGE_SHIFT + PTE_INDEX_SIZE) +#define PGDIR_SHIFT (PAGE_SHIFT + PTE_SHIFT) #define PGDIR_SIZE (1UL << PGDIR_SHIFT) #define PGDIR_MASK (~(PGDIR_SIZE-1)) -/* Bits to mask out from a PGD to get to the PUD page */ -#define PGD_MASKED_BITS 0 +/* + * entries per page directory level: our page-table tree is two-level, so + * we don't really have any PMD directory. + */ +#ifndef __ASSEMBLY__ +#define PTE_TABLE_SIZE (sizeof(pte_t) << PTE_SHIFT) +#define PGD_TABLE_SIZE (sizeof(pgd_t) << (32 - PGDIR_SHIFT)) +#endif /* __ASSEMBLY__ */ + +#define PTRS_PER_PTE (1 << PTE_SHIFT) +#define PTRS_PER_PMD 1 +#define PTRS_PER_PGD (1 << (32 - PGDIR_SHIFT)) #define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE) #define FIRST_USER_ADDRESS 0UL @@ -336,6 +329,15 @@ #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) >> 3 }) #define __swp_entry_to_pte(x) ((pte_t) { (x).val << 3 }) +#ifndef CONFIG_PPC_4K_PAGES +void pgtable_cache_init(void); +#else +/* + * No page table caches to initialise + */ +#define pgtable_cache_init() do { } while (0) +#endif + extern int get_pteptr(struct mm_struct *mm, unsigned long addr, pte_t **ptep, pmd_t **pmdp); diff -u linux-raspi2-4.8.0/arch/powerpc/include/asm/nohash/64/pgtable.h linux-raspi2-4.8.0/arch/powerpc/include/asm/nohash/64/pgtable.h --- linux-raspi2-4.8.0/arch/powerpc/include/asm/nohash/64/pgtable.h +++ linux-raspi2-4.8.0/arch/powerpc/include/asm/nohash/64/pgtable.h @@ -359,6 +359,8 @@ #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val((pte)) }) #define __swp_entry_to_pte(x) __pte((x).val) +void pgtable_cache_add(unsigned shift, void (*ctor)(void *)); +void pgtable_cache_init(void); extern int map_kernel_page(unsigned long ea, unsigned long pa, unsigned long flags); extern int __meminit vmemmap_create_mapping(unsigned long start, reverted: --- linux-raspi2-4.8.0/arch/powerpc/include/asm/pgtable.h +++ linux-raspi2-4.8.0.orig/arch/powerpc/include/asm/pgtable.h @@ -78,8 +78,6 @@ unsigned long vmalloc_to_phys(void *vmalloc_addr); -void pgtable_cache_add(unsigned shift, void (*ctor)(void *)); -void pgtable_cache_init(void); #endif /* __ASSEMBLY__ */ #endif /* _ASM_POWERPC_PGTABLE_H */ reverted: --- linux-raspi2-4.8.0/arch/powerpc/include/asm/plpar_wrappers.h +++ linux-raspi2-4.8.0.orig/arch/powerpc/include/asm/plpar_wrappers.h @@ -93,6 +93,38 @@ return vpa_call(H_VPA_REG_DTL, cpu, vpa); } +static inline long plpar_page_set_loaned(unsigned long vpa) +{ + unsigned long cmo_page_sz = cmo_get_page_size(); + long rc = 0; + int i; + + for (i = 0; !rc && i < PAGE_SIZE; i += cmo_page_sz) + rc = plpar_hcall_norets(H_PAGE_INIT, H_PAGE_SET_LOANED, vpa + i, 0); + + for (i -= cmo_page_sz; rc && i != 0; i -= cmo_page_sz) + plpar_hcall_norets(H_PAGE_INIT, H_PAGE_SET_ACTIVE, + vpa + i - cmo_page_sz, 0); + + return rc; +} + +static inline long plpar_page_set_active(unsigned long vpa) +{ + unsigned long cmo_page_sz = cmo_get_page_size(); + long rc = 0; + int i; + + for (i = 0; !rc && i < PAGE_SIZE; i += cmo_page_sz) + rc = plpar_hcall_norets(H_PAGE_INIT, H_PAGE_SET_ACTIVE, vpa + i, 0); + + for (i -= cmo_page_sz; rc && i != 0; i -= cmo_page_sz) + plpar_hcall_norets(H_PAGE_INIT, H_PAGE_SET_LOANED, + vpa + i - cmo_page_sz, 0); + + return rc; +} + extern void vpa_init(int cpu); static inline long plpar_pte_enter(unsigned long flags, @@ -308,9 +340,4 @@ return plpar_set_mode(0, H_SET_MODE_RESOURCE_SET_DAWR, dawr0, dawrx0); } -static inline long plapr_signal_sys_reset(long cpu) -{ - return plpar_hcall_norets(H_SIGNAL_SYS_RESET, cpu); -} - #endif /* _ASM_POWERPC_PLPAR_WRAPPERS_H */ reverted: --- linux-raspi2-4.8.0/arch/powerpc/include/asm/prom.h +++ linux-raspi2-4.8.0.orig/arch/powerpc/include/asm/prom.h @@ -121,8 +121,6 @@ #define OV1_PPC_2_06 0x02 /* set if we support PowerPC 2.06 */ #define OV1_PPC_2_07 0x01 /* set if we support PowerPC 2.07 */ -#define OV1_PPC_3_00 0x80 /* set if we support PowerPC 3.00 */ - /* Option vector 2: Open Firmware options supported */ #define OV2_REAL_MODE 0x20 /* set if we want OF in real mode */ @@ -153,28 +151,19 @@ #define OV5_XCMO 0x0440 /* Page Coalescing */ #define OV5_TYPE1_AFFINITY 0x0580 /* Type 1 NUMA affinity */ #define OV5_PRRN 0x0540 /* Platform Resource Reassignment */ +#define OV5_PFO_HW_RNG 0x0E80 /* PFO Random Number Generator */ +#define OV5_PFO_HW_842 0x0E40 /* PFO Compression Accelerator */ +#define OV5_PFO_HW_ENCR 0x0E20 /* PFO Encryption Accelerator */ +#define OV5_SUB_PROCESSORS 0x0F01 /* 1,2,or 4 Sub-Processors supported */ -#define OV5_HP_EVT 0x0604 /* Hot Plug Event support */ -#define OV5_RESIZE_HPT 0x0601 /* Hash Page Table resizing */ -#define OV5_PFO_HW_RNG 0x1180 /* PFO Random Number Generator */ -#define OV5_PFO_HW_842 0x1140 /* PFO Compression Accelerator */ -#define OV5_PFO_HW_ENCR 0x1120 /* PFO Encryption Accelerator */ -#define OV5_SUB_PROCESSORS 0x1501 /* 1,2,or 4 Sub-Processors supported */ -#define OV5_XIVE_EXPLOIT 0x1701 /* XIVE exploitation supported */ -/* MMU Base Architecture */ -#define OV5_MMU_SUPPORT 0x18C0 /* MMU Mode Support Mask */ -#define OV5_MMU_HASH 0x1800 /* Hash MMU Only */ -#define OV5_MMU_RADIX 0x1840 /* Radix MMU Only */ -#define OV5_MMU_EITHER 0x1880 /* Hash or Radix Supported */ -#define OV5_MMU_DYNAMIC 0x18C0 /* Hash or Radix Can Switch Later */ -#define OV5_NMMU 0x1820 /* Nest MMU Available */ -/* Hash Table Extensions */ -#define OV5_HASH_SEG_TBL 0x1980 /* In Memory Segment Tables Available */ -#define OV5_HASH_GTSE 0x1940 /* Guest Translation Shoot Down Avail */ -/* Radix Table Extensions */ -#define OV5_RADIX_GTSE 0x1A40 /* Guest Translation Shoot Down Avail */ /* Option Vector 6: IBM PAPR hints */ #define OV6_LINUX 0x02 /* Linux is our OS */ +/* + * The architecture vector has an array of PVR mask/value pairs, + * followed by # option vectors - 1, followed by the option vectors. + */ +extern unsigned char ibm_architecture_vec[]; + #endif /* __KERNEL__ */ #endif /* _POWERPC_PROM_H */ reverted: --- linux-raspi2-4.8.0/arch/powerpc/include/asm/trace.h +++ linux-raspi2-4.8.0.orig/arch/powerpc/include/asm/trace.h @@ -54,7 +54,7 @@ ); #ifdef CONFIG_PPC_PSERIES +extern void hcall_tracepoint_regfunc(void); -extern int hcall_tracepoint_regfunc(void); extern void hcall_tracepoint_unregfunc(void); TRACE_EVENT_FN_COND(hcall_entry, @@ -104,7 +104,7 @@ #endif #ifdef CONFIG_PPC_POWERNV +extern void opal_tracepoint_regfunc(void); -extern int opal_tracepoint_regfunc(void); extern void opal_tracepoint_unregfunc(void); TRACE_EVENT_FN(opal_entry, diff -u linux-raspi2-4.8.0/arch/powerpc/kernel/cpu_setup_power.S linux-raspi2-4.8.0/arch/powerpc/kernel/cpu_setup_power.S --- linux-raspi2-4.8.0/arch/powerpc/kernel/cpu_setup_power.S +++ linux-raspi2-4.8.0/arch/powerpc/kernel/cpu_setup_power.S @@ -101,8 +101,6 @@ mfspr r3,SPRN_LPCR LOAD_REG_IMMEDIATE(r4, LPCR_PECEDH | LPCR_PECE_HVEE | LPCR_HVICE) or r3, r3, r4 - LOAD_REG_IMMEDIATE(r4, LPCR_UPRT | LPCR_HR) - andc r3, r3, r4 bl __init_LPCR bl __init_HFSCR bl __init_tlb_power9 @@ -124,8 +122,6 @@ mfspr r3,SPRN_LPCR LOAD_REG_IMMEDIATE(r4, LPCR_PECEDH | LPCR_PECE_HVEE | LPCR_HVICE) or r3, r3, r4 - LOAD_REG_IMMEDIATE(r4, LPCR_UPRT | LPCR_HR) - andc r3, r3, r4 bl __init_LPCR bl __init_HFSCR bl __init_tlb_power9 reverted: --- linux-raspi2-4.8.0/arch/powerpc/kernel/fadump.c +++ linux-raspi2-4.8.0.orig/arch/powerpc/kernel/fadump.c @@ -778,11 +778,7 @@ elf->e_entry = 0; elf->e_phoff = sizeof(struct elfhdr); elf->e_shoff = 0; + elf->e_flags = ELF_CORE_EFLAGS; -#if defined(_CALL_ELF) - elf->e_flags = _CALL_ELF; -#else - elf->e_flags = 0; -#endif elf->e_ehsize = sizeof(struct elfhdr); elf->e_phentsize = sizeof(struct elf_phdr); elf->e_phnum = 0; reverted: --- linux-raspi2-4.8.0/arch/powerpc/kernel/irq.c +++ linux-raspi2-4.8.0.orig/arch/powerpc/kernel/irq.c @@ -67,7 +67,6 @@ #include #include #include -#include #ifdef CONFIG_PPC64 #include diff -u linux-raspi2-4.8.0/arch/powerpc/kernel/process.c linux-raspi2-4.8.0/arch/powerpc/kernel/process.c --- linux-raspi2-4.8.0/arch/powerpc/kernel/process.c +++ linux-raspi2-4.8.0/arch/powerpc/kernel/process.c @@ -59,7 +59,6 @@ #include #include #include -#include #include #include diff -u linux-raspi2-4.8.0/arch/powerpc/kernel/prom_init.c linux-raspi2-4.8.0/arch/powerpc/kernel/prom_init.c --- linux-raspi2-4.8.0/arch/powerpc/kernel/prom_init.c +++ linux-raspi2-4.8.0/arch/powerpc/kernel/prom_init.c @@ -42,7 +42,6 @@ #include #include #include -#include #include @@ -168,14 +167,6 @@ static unsigned long __initdata prom_tce_alloc_end; #endif -static bool __initdata prom_radix_disable; - -struct platform_support { - bool hash_mmu; - bool radix_mmu; - bool radix_gtse; -}; - /* Platforms codes are now obsolete in the kernel. Now only used within this * file and ultimately gone too. Feel free to change them if you need, they * are not shared with anything outside of this file anymore @@ -469,14 +460,14 @@ } } -static inline int prom_getprop(phandle node, const char *pname, +static int inline prom_getprop(phandle node, const char *pname, void *value, size_t valuelen) { return call_prom("getprop", 4, 1, node, ADDR(pname), (u32)(unsigned long) value, (u32) valuelen); } -static inline int prom_getproplen(phandle node, const char *pname) +static int inline prom_getproplen(phandle node, const char *pname) { return call_prom("getproplen", 2, 1, node, ADDR(pname)); } @@ -634,12 +625,6 @@ prom_memory_limit = ALIGN(prom_memory_limit, 0x1000000); #endif } - - opt = strstr(prom_cmd_line, "disable_radix"); - if (opt) { - prom_debug("Radix disabled from cmdline\n"); - prom_radix_disable = true; - } } #if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV) @@ -649,7 +634,13 @@ * * See prom.h for the definition of the bits specified in the * architecture vector. + * + * Because the description vector contains a mix of byte and word + * values, we declare it as an unsigned char array, and use this + * macro to put word values in. */ +#define W(x) ((x) >> 24) & 0xff, ((x) >> 16) & 0xff, \ + ((x) >> 8) & 0xff, (x) & 0xff /* Firmware expects the value to be n - 1, where n is the # of vectors */ #define NUM_VECTORS(n) ((n) - 1) @@ -660,224 +651,92 @@ */ #define VECTOR_LENGTH(n) (1 + (n) - 2) -struct option_vector1 { - u8 byte1; - u8 arch_versions; - u8 arch_versions3; -} __packed; - -struct option_vector2 { - u8 byte1; - __be16 reserved; - __be32 real_base; - __be32 real_size; - __be32 virt_base; - __be32 virt_size; - __be32 load_base; - __be32 min_rma; - __be32 min_load; - u8 min_rma_percent; - u8 max_pft_size; -} __packed; - -struct option_vector3 { - u8 byte1; - u8 byte2; -} __packed; - -struct option_vector4 { - u8 byte1; - u8 min_vp_cap; -} __packed; - -struct option_vector5 { - u8 byte1; - u8 byte2; - u8 byte3; - u8 cmo; - u8 associativity; - u8 bin_opts; - u8 micro_checkpoint; - u8 reserved0; - __be32 max_cpus; - __be16 papr_level; - __be16 reserved1; - u8 platform_facilities; - u8 reserved2; - __be16 reserved3; - u8 subprocessors; - u8 byte22; - u8 intarch; - u8 mmu; - u8 hash_ext; - u8 radix_ext; -} __packed; - -struct option_vector6 { - u8 reserved; - u8 secondary_pteg; - u8 os_name; -} __packed; - -struct ibm_arch_vec { - struct { u32 mask, val; } pvrs[12]; - - u8 num_vectors; - - u8 vec1_len; - struct option_vector1 vec1; - - u8 vec2_len; - struct option_vector2 vec2; - - u8 vec3_len; - struct option_vector3 vec3; - - u8 vec4_len; - struct option_vector4 vec4; - - u8 vec5_len; - struct option_vector5 vec5; - - u8 vec6_len; - struct option_vector6 vec6; -} __packed; - -struct ibm_arch_vec __cacheline_aligned ibm_architecture_vec = { - .pvrs = { - { - .mask = cpu_to_be32(0xfffe0000), /* POWER5/POWER5+ */ - .val = cpu_to_be32(0x003a0000), - }, - { - .mask = cpu_to_be32(0xffff0000), /* POWER6 */ - .val = cpu_to_be32(0x003e0000), - }, - { - .mask = cpu_to_be32(0xffff0000), /* POWER7 */ - .val = cpu_to_be32(0x003f0000), - }, - { - .mask = cpu_to_be32(0xffff0000), /* POWER8E */ - .val = cpu_to_be32(0x004b0000), - }, - { - .mask = cpu_to_be32(0xffff0000), /* POWER8NVL */ - .val = cpu_to_be32(0x004c0000), - }, - { - .mask = cpu_to_be32(0xffff0000), /* POWER8 */ - .val = cpu_to_be32(0x004d0000), - }, - { - .mask = cpu_to_be32(0xffff0000), /* POWER9 */ - .val = cpu_to_be32(0x004e0000), - }, - { - .mask = cpu_to_be32(0xffffffff), /* all 3.00-compliant */ - .val = cpu_to_be32(0x0f000005), - }, - { - .mask = cpu_to_be32(0xffffffff), /* all 2.07-compliant */ - .val = cpu_to_be32(0x0f000004), - }, - { - .mask = cpu_to_be32(0xffffffff), /* all 2.06-compliant */ - .val = cpu_to_be32(0x0f000003), - }, - { - .mask = cpu_to_be32(0xffffffff), /* all 2.05-compliant */ - .val = cpu_to_be32(0x0f000002), - }, - { - .mask = cpu_to_be32(0xfffffffe), /* all 2.04-compliant and earlier */ - .val = cpu_to_be32(0x0f000001), - }, - }, - - .num_vectors = NUM_VECTORS(6), - - .vec1_len = VECTOR_LENGTH(sizeof(struct option_vector1)), - .vec1 = { - .byte1 = 0, - .arch_versions = OV1_PPC_2_00 | OV1_PPC_2_01 | OV1_PPC_2_02 | OV1_PPC_2_03 | - OV1_PPC_2_04 | OV1_PPC_2_05 | OV1_PPC_2_06 | OV1_PPC_2_07, - .arch_versions3 = OV1_PPC_3_00, - }, +unsigned char ibm_architecture_vec[] = { + W(0xfffe0000), W(0x003a0000), /* POWER5/POWER5+ */ + W(0xffff0000), W(0x003e0000), /* POWER6 */ + W(0xffff0000), W(0x003f0000), /* POWER7 */ + W(0xffff0000), W(0x004b0000), /* POWER8E */ + W(0xffff0000), W(0x004c0000), /* POWER8NVL */ + W(0xffff0000), W(0x004d0000), /* POWER8 */ + W(0xffffffff), W(0x0f000004), /* all 2.07-compliant */ + W(0xffffffff), W(0x0f000003), /* all 2.06-compliant */ + W(0xffffffff), W(0x0f000002), /* all 2.05-compliant */ + W(0xfffffffe), W(0x0f000001), /* all 2.04-compliant and earlier */ + NUM_VECTORS(6), /* 6 option vectors */ + + /* option vector 1: processor architectures supported */ + VECTOR_LENGTH(2), /* length */ + 0, /* don't ignore, don't halt */ + OV1_PPC_2_00 | OV1_PPC_2_01 | OV1_PPC_2_02 | OV1_PPC_2_03 | + OV1_PPC_2_04 | OV1_PPC_2_05 | OV1_PPC_2_06 | OV1_PPC_2_07, - .vec2_len = VECTOR_LENGTH(sizeof(struct option_vector2)), /* option vector 2: Open Firmware options supported */ - .vec2 = { - .byte1 = OV2_REAL_MODE, - .reserved = 0, - .real_base = cpu_to_be32(0xffffffff), - .real_size = cpu_to_be32(0xffffffff), - .virt_base = cpu_to_be32(0xffffffff), - .virt_size = cpu_to_be32(0xffffffff), - .load_base = cpu_to_be32(0xffffffff), - .min_rma = cpu_to_be32(256), /* 256MB min RMA */ - .min_load = cpu_to_be32(0xffffffff), /* full client load */ - .min_rma_percent = 0, /* min RMA percentage of total RAM */ - .max_pft_size = 48, /* max log_2(hash table size) */ - }, + VECTOR_LENGTH(33), /* length */ + OV2_REAL_MODE, + 0, 0, + W(0xffffffff), /* real_base */ + W(0xffffffff), /* real_size */ + W(0xffffffff), /* virt_base */ + W(0xffffffff), /* virt_size */ + W(0xffffffff), /* load_base */ + W(512), /* 512MB min RMA */ + W(0xffffffff), /* full client load */ + 0, /* min RMA percentage of total RAM */ + 48, /* max log_2(hash table size) */ - .vec3_len = VECTOR_LENGTH(sizeof(struct option_vector3)), /* option vector 3: processor options supported */ - .vec3 = { - .byte1 = 0, /* don't ignore, don't halt */ - .byte2 = OV3_FP | OV3_VMX | OV3_DFP, - }, + VECTOR_LENGTH(2), /* length */ + 0, /* don't ignore, don't halt */ + OV3_FP | OV3_VMX | OV3_DFP, - .vec4_len = VECTOR_LENGTH(sizeof(struct option_vector4)), /* option vector 4: IBM PAPR implementation */ - .vec4 = { - .byte1 = 0, /* don't halt */ - .min_vp_cap = OV4_MIN_ENT_CAP, /* minimum VP entitled capacity */ - }, + VECTOR_LENGTH(2), /* length */ + 0, /* don't halt */ + OV4_MIN_ENT_CAP, /* minimum VP entitled capacity */ - .vec5_len = VECTOR_LENGTH(sizeof(struct option_vector5)), /* option vector 5: PAPR/OF options */ - .vec5 = { - .byte1 = 0, /* don't ignore, don't halt */ - .byte2 = OV5_FEAT(OV5_LPAR) | OV5_FEAT(OV5_SPLPAR) | OV5_FEAT(OV5_LARGE_PAGES) | - OV5_FEAT(OV5_DRCONF_MEMORY) | OV5_FEAT(OV5_DONATE_DEDICATE_CPU) | + VECTOR_LENGTH(21), /* length */ + 0, /* don't ignore, don't halt */ + OV5_FEAT(OV5_LPAR) | OV5_FEAT(OV5_SPLPAR) | OV5_FEAT(OV5_LARGE_PAGES) | + OV5_FEAT(OV5_DRCONF_MEMORY) | OV5_FEAT(OV5_DONATE_DEDICATE_CPU) | #ifdef CONFIG_PCI_MSI - /* PCIe/MSI support. Without MSI full PCIe is not supported */ - OV5_FEAT(OV5_MSI), + /* PCIe/MSI support. Without MSI full PCIe is not supported */ + OV5_FEAT(OV5_MSI), #else - 0, + 0, #endif - .byte3 = 0, - .cmo = + 0, #ifdef CONFIG_PPC_SMLPAR - OV5_FEAT(OV5_CMO) | OV5_FEAT(OV5_XCMO), + OV5_FEAT(OV5_CMO) | OV5_FEAT(OV5_XCMO), #else - 0, + 0, #endif - .associativity = OV5_FEAT(OV5_TYPE1_AFFINITY) | OV5_FEAT(OV5_PRRN), - .bin_opts = OV5_FEAT(OV5_RESIZE_HPT) | OV5_FEAT(OV5_HP_EVT), - .micro_checkpoint = 0, - .reserved0 = 0, - .max_cpus = cpu_to_be32(NR_CPUS), /* number of cores supported */ - .papr_level = 0, - .reserved1 = 0, - .platform_facilities = OV5_FEAT(OV5_PFO_HW_RNG) | OV5_FEAT(OV5_PFO_HW_ENCR) | OV5_FEAT(OV5_PFO_HW_842), - .reserved2 = 0, - .reserved3 = 0, - .subprocessors = 1, - .intarch = 0, - .mmu = 0, - .hash_ext = 0, - .radix_ext = 0, - }, + OV5_FEAT(OV5_TYPE1_AFFINITY) | OV5_FEAT(OV5_PRRN), + 0, + 0, + 0, + /* WARNING: The offset of the "number of cores" field below + * must match by the macro below. Update the definition if + * the structure layout changes. + */ +#define IBM_ARCH_VEC_NRCORES_OFFSET 133 + W(NR_CPUS), /* number of cores supported */ + 0, + 0, + 0, + 0, + OV5_FEAT(OV5_PFO_HW_RNG) | OV5_FEAT(OV5_PFO_HW_ENCR) | + OV5_FEAT(OV5_PFO_HW_842), /* Byte 17 */ + 0, /* Byte 18 */ + 0, /* Byte 19 */ + 0, /* Byte 20 */ + OV5_FEAT(OV5_SUB_PROCESSORS), /* Byte 21 */ /* option vector 6: IBM PAPR hints */ - .vec6_len = VECTOR_LENGTH(sizeof(struct option_vector6)), - .vec6 = { - .reserved = 0, - .secondary_pteg = 0, - .os_name = OV6_LINUX, - }, + VECTOR_LENGTH(3), /* length */ + 0, + 0, + OV6_LINUX, }; /* Old method - ELF header with PT_NOTE sections only works on BE */ @@ -1007,101 +866,13 @@ } -static void __init prom_parse_mmu_model(u8 val, - struct platform_support *support) -{ - switch (val) { - case OV5_FEAT(OV5_MMU_DYNAMIC): - case OV5_FEAT(OV5_MMU_EITHER): /* Either Available */ - prom_debug("MMU - either supported\n"); - support->radix_mmu = !prom_radix_disable; - support->hash_mmu = true; - break; - case OV5_FEAT(OV5_MMU_RADIX): /* Only Radix */ - prom_debug("MMU - radix only\n"); - if (prom_radix_disable) { - /* - * If we __have__ to do radix, we're better off ignoring - * the command line rather than not booting. - */ - prom_printf("WARNING: Ignoring cmdline option disable_radix\n"); - } - support->radix_mmu = true; - break; - case OV5_FEAT(OV5_MMU_HASH): - prom_debug("MMU - hash only\n"); - support->hash_mmu = true; - break; - default: - prom_debug("Unknown mmu support option: 0x%x\n", val); - break; - } -} - -static void __init prom_parse_platform_support(u8 index, u8 val, - struct platform_support *support) -{ - switch (index) { - case OV5_INDX(OV5_MMU_SUPPORT): /* MMU Model */ - prom_parse_mmu_model(val & OV5_FEAT(OV5_MMU_SUPPORT), support); - break; - case OV5_INDX(OV5_RADIX_GTSE): /* Radix Extensions */ - if (val & OV5_FEAT(OV5_RADIX_GTSE)) { - prom_debug("Radix - GTSE supported\n"); - support->radix_gtse = true; - } - break; - } -} - -static void __init prom_check_platform_support(void) -{ - struct platform_support supported = { - .hash_mmu = false, - .radix_mmu = false, - .radix_gtse = false - }; - int prop_len = prom_getproplen(prom.chosen, - "ibm,arch-vec-5-platform-support"); - if (prop_len > 1) { - int i; - u8 vec[prop_len]; - prom_debug("Found ibm,arch-vec-5-platform-support, len: %d\n", - prop_len); - prom_getprop(prom.chosen, "ibm,arch-vec-5-platform-support", - &vec, sizeof(vec)); - for (i = 0; i < prop_len; i += 2) { - prom_debug("%d: index = 0x%x val = 0x%x\n", i / 2 - , vec[i] - , vec[i + 1]); - prom_parse_platform_support(vec[i], vec[i + 1], - &supported); - } - } - - if (supported.radix_mmu && supported.radix_gtse) { - /* Radix preferred - but we require GTSE for now */ - prom_debug("Asking for radix with GTSE\n"); - ibm_architecture_vec.vec5.mmu = OV5_FEAT(OV5_MMU_RADIX); - ibm_architecture_vec.vec5.radix_ext = OV5_FEAT(OV5_RADIX_GTSE); - } else if (supported.hash_mmu) { - /* Default to hash mmu (if we can) */ - prom_debug("Asking for hash\n"); - ibm_architecture_vec.vec5.mmu = OV5_FEAT(OV5_MMU_HASH); - } else { - /* We're probably on a legacy hypervisor */ - prom_debug("Assuming legacy hash support\n"); - } -} static void __init prom_send_capabilities(void) { ihandle root; prom_arg_t ret; u32 cores; - - /* Check ibm,arch-vec-5-platform-support and fixup vec5 if required */ - prom_check_platform_support(); + unsigned char *ptcores; root = call_prom("open", 1, 1, ADDR("/")); if (root != 0) { @@ -1112,18 +883,37 @@ * divide NR_CPUS. */ - cores = DIV_ROUND_UP(NR_CPUS, prom_count_smt_threads()); - prom_printf("Max number of cores passed to firmware: %lu (NR_CPUS = %lu)\n", - cores, NR_CPUS); - - ibm_architecture_vec.vec5.max_cpus = cpu_to_be32(cores); + /* The core value may start at an odd address. If such a word + * access is made at a cache line boundary, this leads to an + * exception which may not be handled at this time. + * Forcing a per byte access to avoid exception. + */ + ptcores = &ibm_architecture_vec[IBM_ARCH_VEC_NRCORES_OFFSET]; + cores = 0; + cores |= ptcores[0] << 24; + cores |= ptcores[1] << 16; + cores |= ptcores[2] << 8; + cores |= ptcores[3]; + if (cores != NR_CPUS) { + prom_printf("WARNING ! " + "ibm_architecture_vec structure inconsistent: %lu!\n", + cores); + } else { + cores = DIV_ROUND_UP(NR_CPUS, prom_count_smt_threads()); + prom_printf("Max number of cores passed to firmware: %lu (NR_CPUS = %lu)\n", + cores, NR_CPUS); + ptcores[0] = (cores >> 24) & 0xff; + ptcores[1] = (cores >> 16) & 0xff; + ptcores[2] = (cores >> 8) & 0xff; + ptcores[3] = cores & 0xff; + } /* try calling the ibm,client-architecture-support method */ prom_printf("Calling ibm,client-architecture-support..."); if (call_prom_ret("call-method", 3, 2, &ret, ADDR("ibm,client-architecture-support"), root, - ADDR(&ibm_architecture_vec)) == 0) { + ADDR(ibm_architecture_vec)) == 0) { /* the call exists... */ if (ret) prom_printf("\nWARNING: ibm,client-architecture" @@ -2853,86 +2643,6 @@ #define fixup_device_tree_efika() #endif -#ifdef CONFIG_PPC_PASEMI_NEMO -/* - * CFE supplied on Nemo is broken in several ways, biggest - * problem is that it reassigns ISA interrupts to unused mpic ints. - * Add an interrupt-controller property for the io-bridge to use - * and correct the ints so we can attach them to an irq_domain - */ -static void __init fixup_device_tree_pasemi(void) -{ - u32 interrupts[2], parent, rval, val = 0; - char *name, *pci_name; - phandle iob, node; - - /* Find the root pci node */ - name = "/pxp@0,e0000000"; - iob = call_prom("finddevice", 1, 1, ADDR(name)); - if (!PHANDLE_VALID(iob)) - return; - - /* check if interrupt-controller node set yet */ - if (prom_getproplen(iob, "interrupt-controller") !=PROM_ERROR) - return; - - prom_printf("adding interrupt-controller property for SB600...\n"); - - prom_setprop(iob, name, "interrupt-controller", &val, 0); - - pci_name = "/pxp@0,e0000000/pci@11"; - node = call_prom("finddevice", 1, 1, ADDR(pci_name)); - parent = ADDR(iob); - - for( ; prom_next_node(&node); ) { - /* scan each node for one with an interrupt */ - if (!PHANDLE_VALID(node)) - continue; - - rval = prom_getproplen(node, "interrupts"); - if (rval == 0 || rval == PROM_ERROR) - continue; - - prom_getprop(node, "interrupts", &interrupts, sizeof(interrupts)); - if ((interrupts[0] < 212) || (interrupts[0] > 222)) - continue; - - /* found a node, update both interrupts and interrupt-parent */ - if ((interrupts[0] >= 212) && (interrupts[0] <= 215)) - interrupts[0] -= 203; - if ((interrupts[0] >= 216) && (interrupts[0] <= 220)) - interrupts[0] -= 213; - if (interrupts[0] == 221) - interrupts[0] = 14; - if (interrupts[0] == 222) - interrupts[0] = 8; - - prom_setprop(node, pci_name, "interrupts", interrupts, - sizeof(interrupts)); - prom_setprop(node, pci_name, "interrupt-parent", &parent, - sizeof(parent)); - } - - /* - * The io-bridge has device_type set to 'io-bridge' change it to 'isa' - * so that generic isa-bridge code can add the SB600 and its on-board - * peripherals. - */ - name = "/pxp@0,e0000000/io-bridge@0"; - iob = call_prom("finddevice", 1, 1, ADDR(name)); - if (!PHANDLE_VALID(iob)) - return; - - /* device_type is already set, just change it. */ - - prom_printf("Changing device_type of SB600 node...\n"); - - prom_setprop(iob, name, "device_type", "isa", sizeof("isa")); -} -#else /* !CONFIG_PPC_PASEMI_NEMO */ -static inline void fixup_device_tree_pasemi(void) { } -#endif - static void __init fixup_device_tree(void) { fixup_device_tree_maple(); @@ -2940,7 +2650,6 @@ fixup_device_tree_chrp(); fixup_device_tree_pmac(); fixup_device_tree_efika(); - fixup_device_tree_pasemi(); } static void __init prom_find_boot_cpu(void) @@ -2956,9 +2665,6 @@ cpu_pkg = call_prom("instance-to-package", 1, 1, prom_cpu); - if (!PHANDLE_VALID(cpu_pkg)) - return; - prom_getprop(cpu_pkg, "reg", &rval, sizeof(rval)); prom.cpu = be32_to_cpu(rval); @@ -3099,11 +2805,6 @@ */ prom_check_initrd(r3, r4); - /* - * Do early parsing of command line - */ - early_cmdline_parse(); - #if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV) /* * On pSeries, inform the firmware about our capabilities @@ -3120,6 +2821,11 @@ copy_and_flush(0, kbase, 0x100, 0); /* + * Do early parsing of command line + */ + early_cmdline_parse(); + + /* * Initialize memory management within prom_init */ prom_init_mem(); reverted: --- linux-raspi2-4.8.0/arch/powerpc/kernel/ptrace.c +++ linux-raspi2-4.8.0.orig/arch/powerpc/kernel/ptrace.c @@ -39,7 +39,6 @@ #include #include #include -#include #define CREATE_TRACE_POINTS #include reverted: --- linux-raspi2-4.8.0/arch/powerpc/kernel/signal_32.c +++ linux-raspi2-4.8.0.orig/arch/powerpc/kernel/signal_32.c @@ -44,7 +44,6 @@ #include #include #include -#include #ifdef CONFIG_PPC64 #include "ppc32.h" #include reverted: --- linux-raspi2-4.8.0/arch/powerpc/kernel/signal_64.c +++ linux-raspi2-4.8.0.orig/arch/powerpc/kernel/signal_64.c @@ -35,7 +35,6 @@ #include #include #include -#include #include "signal.h" reverted: --- linux-raspi2-4.8.0/arch/powerpc/kernel/syscalls.c +++ linux-raspi2-4.8.0.orig/arch/powerpc/kernel/syscalls.c @@ -40,7 +40,6 @@ #include #include #include -#include static inline unsigned long do_mmap2(unsigned long addr, size_t len, unsigned long prot, unsigned long flags, reverted: --- linux-raspi2-4.8.0/arch/powerpc/kernel/time.c +++ linux-raspi2-4.8.0.orig/arch/powerpc/kernel/time.c @@ -73,7 +73,6 @@ #include #include #include -#include /* powerpc clocksource/clockevent code */ reverted: --- linux-raspi2-4.8.0/arch/powerpc/kvm/book3s_32_mmu.c +++ linux-raspi2-4.8.0.orig/arch/powerpc/kvm/book3s_32_mmu.c @@ -224,8 +224,7 @@ ptem = kvmppc_mmu_book3s_32_get_ptem(sre, eaddr, primary); if(copy_from_user(pteg, (void __user *)ptegp, sizeof(pteg))) { + printk(KERN_ERR "KVM: Can't copy data from 0x%lx!\n", ptegp); - printk_ratelimited(KERN_ERR - "KVM: Can't copy data from 0x%lx!\n", ptegp); goto no_page_found; } reverted: --- linux-raspi2-4.8.0/arch/powerpc/kvm/book3s_64_mmu.c +++ linux-raspi2-4.8.0.orig/arch/powerpc/kvm/book3s_64_mmu.c @@ -265,8 +265,7 @@ goto no_page_found; if(copy_from_user(pteg, (void __user *)ptegp, sizeof(pteg))) { + printk(KERN_ERR "KVM can't copy data from 0x%lx!\n", ptegp); - printk_ratelimited(KERN_ERR - "KVM: Can't copy data from 0x%lx!\n", ptegp); goto no_page_found; } reverted: --- linux-raspi2-4.8.0/arch/powerpc/mm/Makefile +++ linux-raspi2-4.8.0.orig/arch/powerpc/mm/Makefile @@ -8,8 +8,7 @@ obj-y := fault.o mem.o pgtable.o mmap.o \ init_$(CONFIG_WORD_SIZE).o \ + pgtable_$(CONFIG_WORD_SIZE).o - pgtable_$(CONFIG_WORD_SIZE).o \ - init-common.o obj-$(CONFIG_PPC_MMU_NOHASH) += mmu_context_nohash.o tlb_nohash.o \ tlb_nohash_low.o obj-$(CONFIG_PPC_BOOK3E) += tlb_low_$(CONFIG_WORD_SIZE)e.o diff -u linux-raspi2-4.8.0/arch/powerpc/mm/copro_fault.c linux-raspi2-4.8.0/arch/powerpc/mm/copro_fault.c --- linux-raspi2-4.8.0/arch/powerpc/mm/copro_fault.c +++ linux-raspi2-4.8.0/arch/powerpc/mm/copro_fault.c @@ -67,13 +67,11 @@ if (!(vma->vm_flags & (VM_READ | VM_EXEC))) goto out_unlock; /* - * PROT_NONE is covered by the VMA check above. - * and hash should get a NOHPTE fault instead of - * a PROTFAULT in case fixup is needed for things - * like autonuma. + * protfault should only happen due to us + * mapping a region readonly temporarily. PROT_NONE + * is also covered by the VMA check above. */ - if (!radix_enabled()) - WARN_ON_ONCE(dsisr & DSISR_PROTFAULT); + WARN_ON_ONCE(dsisr & DSISR_PROTFAULT); } ret = 0; diff -u linux-raspi2-4.8.0/arch/powerpc/mm/fault.c linux-raspi2-4.8.0/arch/powerpc/mm/fault.c --- linux-raspi2-4.8.0/arch/powerpc/mm/fault.c +++ linux-raspi2-4.8.0/arch/powerpc/mm/fault.c @@ -407,6 +407,15 @@ (cpu_has_feature(CPU_FTR_NOEXECUTE) || !(vma->vm_flags & (VM_READ | VM_WRITE)))) goto bad_area; + +#ifdef CONFIG_PPC_STD_MMU + /* + * protfault should only happen due to us + * mapping a region readonly temporarily. PROT_NONE + * is also covered by the VMA check above. + */ + WARN_ON_ONCE(error_code & DSISR_PROTFAULT); +#endif /* CONFIG_PPC_STD_MMU */ /* a write */ } else if (is_write) { if (!(vma->vm_flags & VM_WRITE)) @@ -416,40 +425,8 @@ } else { if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE))) goto bad_area; - } -#ifdef CONFIG_PPC_STD_MMU - /* - * For hash translation mode, we should never get a - * PROTFAULT. Any update to pte to reduce access will result in us - * removing the hash page table entry, thus resulting in a DSISR_NOHPTE - * fault instead of DSISR_PROTFAULT. - * - * A pte update to relax the access will not result in a hash page table - * entry invalidate and hence can result in DSISR_PROTFAULT. - * ptep_set_access_flags() doesn't do a hpte flush. This is why we have - * the special !is_write in the below conditional. - * - * For platforms that doesn't supports coherent icache and do support - * per page noexec bit, we do setup things such that we do the - * sync between D/I cache via fault. But that is handled via low level - * hash fault code (hash_page_do_lazy_icache()) and we should not reach - * here in such case. - * - * For wrong access that can result in PROTFAULT, the above vma->vm_flags - * check should handle those and hence we should fall to the bad_area - * handling correctly. - * - * For embedded with per page exec support that doesn't support coherent - * icache we do get PROTFAULT and we handle that D/I cache sync in - * set_pte_at while taking the noexec/prot fault. Hence this is WARN_ON - * is conditional for server MMU. - * - * For radix, we can get prot fault for autonuma case, because radix - * page table will have them marked noaccess for user. - */ - if (!radix_enabled() && !is_write) WARN_ON_ONCE(error_code & DSISR_PROTFAULT); -#endif /* CONFIG_PPC_STD_MMU */ + } /* * If for any reason at all we couldn't handle the fault, reverted: --- linux-raspi2-4.8.0/arch/powerpc/mm/init-common.c +++ linux-raspi2-4.8.0.orig/arch/powerpc/mm/init-common.c @@ -1,107 +0,0 @@ -/* - * PowerPC version - * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) - * - * Modifications by Paul Mackerras (PowerMac) (paulus@cs.anu.edu.au) - * and Cort Dougan (PReP) (cort@cs.nmt.edu) - * Copyright (C) 1996 Paul Mackerras - * - * Derived from "arch/i386/mm/init.c" - * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds - * - * Dave Engebretsen - * Rework for PPC64 port. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - * - */ - -#undef DEBUG - -#include -#include -#include - -static void pgd_ctor(void *addr) -{ - memset(addr, 0, PGD_TABLE_SIZE); -} - -static void pud_ctor(void *addr) -{ - memset(addr, 0, PUD_TABLE_SIZE); -} - -static void pmd_ctor(void *addr) -{ - memset(addr, 0, PMD_TABLE_SIZE); -} - -struct kmem_cache *pgtable_cache[MAX_PGTABLE_INDEX_SIZE]; - -/* - * Create a kmem_cache() for pagetables. This is not used for PTE - * pages - they're linked to struct page, come from the normal free - * pages pool and have a different entry size (see real_pte_t) to - * everything else. Caches created by this function are used for all - * the higher level pagetables, and for hugepage pagetables. - */ -void pgtable_cache_add(unsigned shift, void (*ctor)(void *)) -{ - char *name; - unsigned long table_size = sizeof(void *) << shift; - unsigned long align = table_size; - - /* When batching pgtable pointers for RCU freeing, we store - * the index size in the low bits. Table alignment must be - * big enough to fit it. - * - * Likewise, hugeapge pagetable pointers contain a (different) - * shift value in the low bits. All tables must be aligned so - * as to leave enough 0 bits in the address to contain it. */ - unsigned long minalign = max(MAX_PGTABLE_INDEX_SIZE + 1, - HUGEPD_SHIFT_MASK + 1); - struct kmem_cache *new; - - /* It would be nice if this was a BUILD_BUG_ON(), but at the - * moment, gcc doesn't seem to recognize is_power_of_2 as a - * constant expression, so so much for that. */ - BUG_ON(!is_power_of_2(minalign)); - BUG_ON((shift < 1) || (shift > MAX_PGTABLE_INDEX_SIZE)); - - if (PGT_CACHE(shift)) - return; /* Already have a cache of this size */ - - align = max_t(unsigned long, align, minalign); - name = kasprintf(GFP_KERNEL, "pgtable-2^%d", shift); - new = kmem_cache_create(name, table_size, align, 0, ctor); - kfree(name); - pgtable_cache[shift - 1] = new; - pr_debug("Allocated pgtable cache for order %d\n", shift); -} - - -void pgtable_cache_init(void) -{ - pgtable_cache_add(PGD_INDEX_SIZE, pgd_ctor); - - if (PMD_INDEX_SIZE && !PGT_CACHE(PMD_INDEX_SIZE)) - pgtable_cache_add(PMD_CACHE_INDEX, pmd_ctor); - /* - * In all current configs, when the PUD index exists it's the - * same size as either the pgd or pmd index except with THP enabled - * on book3s 64 - */ - if (PUD_INDEX_SIZE && !PGT_CACHE(PUD_INDEX_SIZE)) - pgtable_cache_add(PUD_INDEX_SIZE, pud_ctor); - - if (!PGT_CACHE(PGD_INDEX_SIZE)) - panic("Couldn't allocate pgd cache"); - if (PMD_INDEX_SIZE && !PGT_CACHE(PMD_INDEX_SIZE)) - panic("Couldn't allocate pmd pgtable caches"); - if (PUD_INDEX_SIZE && !PGT_CACHE(PUD_INDEX_SIZE)) - panic("Couldn't allocate pud pgtable caches"); -} reverted: --- linux-raspi2-4.8.0/arch/powerpc/mm/init_64.c +++ linux-raspi2-4.8.0.orig/arch/powerpc/mm/init_64.c @@ -42,8 +42,6 @@ #include #include #include -#include -#include #include #include @@ -82,6 +80,83 @@ phys_addr_t kernstart_addr; EXPORT_SYMBOL_GPL(kernstart_addr); +static void pgd_ctor(void *addr) +{ + memset(addr, 0, PGD_TABLE_SIZE); +} + +static void pud_ctor(void *addr) +{ + memset(addr, 0, PUD_TABLE_SIZE); +} + +static void pmd_ctor(void *addr) +{ + memset(addr, 0, PMD_TABLE_SIZE); +} + +struct kmem_cache *pgtable_cache[MAX_PGTABLE_INDEX_SIZE]; + +/* + * Create a kmem_cache() for pagetables. This is not used for PTE + * pages - they're linked to struct page, come from the normal free + * pages pool and have a different entry size (see real_pte_t) to + * everything else. Caches created by this function are used for all + * the higher level pagetables, and for hugepage pagetables. + */ +void pgtable_cache_add(unsigned shift, void (*ctor)(void *)) +{ + char *name; + unsigned long table_size = sizeof(void *) << shift; + unsigned long align = table_size; + + /* When batching pgtable pointers for RCU freeing, we store + * the index size in the low bits. Table alignment must be + * big enough to fit it. + * + * Likewise, hugeapge pagetable pointers contain a (different) + * shift value in the low bits. All tables must be aligned so + * as to leave enough 0 bits in the address to contain it. */ + unsigned long minalign = max(MAX_PGTABLE_INDEX_SIZE + 1, + HUGEPD_SHIFT_MASK + 1); + struct kmem_cache *new; + + /* It would be nice if this was a BUILD_BUG_ON(), but at the + * moment, gcc doesn't seem to recognize is_power_of_2 as a + * constant expression, so so much for that. */ + BUG_ON(!is_power_of_2(minalign)); + BUG_ON((shift < 1) || (shift > MAX_PGTABLE_INDEX_SIZE)); + + if (PGT_CACHE(shift)) + return; /* Already have a cache of this size */ + + align = max_t(unsigned long, align, minalign); + name = kasprintf(GFP_KERNEL, "pgtable-2^%d", shift); + new = kmem_cache_create(name, table_size, align, 0, ctor); + kfree(name); + pgtable_cache[shift - 1] = new; + pr_debug("Allocated pgtable cache for order %d\n", shift); +} + + +void pgtable_cache_init(void) +{ + pgtable_cache_add(PGD_INDEX_SIZE, pgd_ctor); + pgtable_cache_add(PMD_CACHE_INDEX, pmd_ctor); + /* + * In all current configs, when the PUD index exists it's the + * same size as either the pgd or pmd index except with THP enabled + * on book3s 64 + */ + if (PUD_INDEX_SIZE && !PGT_CACHE(PUD_INDEX_SIZE)) + pgtable_cache_add(PUD_INDEX_SIZE, pud_ctor); + + if (!PGT_CACHE(PGD_INDEX_SIZE) || !PGT_CACHE(PMD_CACHE_INDEX)) + panic("Couldn't allocate pgtable caches"); + if (PUD_INDEX_SIZE && !PGT_CACHE(PUD_INDEX_SIZE)) + panic("Couldn't allocate pud pgtable caches"); +} + #ifdef CONFIG_SPARSEMEM_VMEMMAP /* * Given an address within the vmemmap, determine the pfn of the page that @@ -346,70 +421,12 @@ } early_param("disable_radix", parse_disable_radix); -/* - * If we're running under a hypervisor, we need to check the contents of - * /chosen/ibm,architecture-vec-5 to see if the hypervisor is willing to do - * radix. If not, we clear the radix feature bit so we fall back to hash. - */ -static void early_check_vec5(void) -{ - unsigned long root, chosen; - int size; - const u8 *vec5; - u8 mmu_supported; - - root = of_get_flat_dt_root(); - chosen = of_get_flat_dt_subnode_by_name(root, "chosen"); - if (chosen == -FDT_ERR_NOTFOUND) { - cur_cpu_spec->mmu_features &= ~MMU_FTR_TYPE_RADIX; - return; - } - vec5 = of_get_flat_dt_prop(chosen, "ibm,architecture-vec-5", &size); - if (!vec5) { - cur_cpu_spec->mmu_features &= ~MMU_FTR_TYPE_RADIX; - return; - } - if (size <= OV5_INDX(OV5_MMU_SUPPORT)) { - cur_cpu_spec->mmu_features &= ~MMU_FTR_TYPE_RADIX; - return; - } - - /* Check for supported configuration */ - mmu_supported = vec5[OV5_INDX(OV5_MMU_SUPPORT)] & - OV5_FEAT(OV5_MMU_SUPPORT); - if (mmu_supported == OV5_FEAT(OV5_MMU_RADIX)) { - /* Hypervisor only supports radix - check enabled && GTSE */ - if (!early_radix_enabled()) { - pr_warn("WARNING: Ignoring cmdline option disable_radix\n"); - } - if (!(vec5[OV5_INDX(OV5_RADIX_GTSE)] & - OV5_FEAT(OV5_RADIX_GTSE))) { - pr_warn("WARNING: Hypervisor doesn't support RADIX with GTSE\n"); - } - /* Do radix anyway - the hypervisor said we had to */ - cur_cpu_spec->mmu_features |= MMU_FTR_TYPE_RADIX; - } else if (mmu_supported == OV5_FEAT(OV5_MMU_HASH)) { - /* Hypervisor only supports hash - disable radix */ - cur_cpu_spec->mmu_features &= ~MMU_FTR_TYPE_RADIX; - } -} - void __init mmu_early_init_devtree(void) { /* Disable radix mode based on kernel command line. */ + if (disable_radix) - /* We don't yet have the machinery to do radix as a guest. */ - if (disable_radix || !(mfmsr() & MSR_HV)) cur_cpu_spec->mmu_features &= ~MMU_FTR_TYPE_RADIX; - /* - * Check /chosen/ibm,architecture-vec-5 if running as a guest. - * When running bare-metal, we can use radix if we like - * even though the ibm,architecture-vec-5 property created by - * skiboot doesn't have the necessary bits set. - */ - if (!(mfmsr() & MSR_HV)) - early_check_vec5(); - if (early_radix_enabled()) radix__early_init_devtree(); else diff -u linux-raspi2-4.8.0/arch/powerpc/mm/pgtable-radix.c linux-raspi2-4.8.0/arch/powerpc/mm/pgtable-radix.c --- linux-raspi2-4.8.0/arch/powerpc/mm/pgtable-radix.c +++ linux-raspi2-4.8.0/arch/powerpc/mm/pgtable-radix.c @@ -401,8 +401,6 @@ mtspr(SPRN_LPCR, lpcr | LPCR_UPRT | LPCR_HR); radix_init_partition_table(); radix_init_amor(); - } else { - radix_init_pseries(); } memblock_set_current_limit(MEMBLOCK_ALLOC_ANYWHERE); reverted: --- linux-raspi2-4.8.0/arch/powerpc/mm/pgtable_32.c +++ linux-raspi2-4.8.0.orig/arch/powerpc/mm/pgtable_32.c @@ -42,6 +42,43 @@ extern char etext[], _stext[], _sinittext[], _einittext[]; +#define PGDIR_ORDER (32 + PGD_T_LOG2 - PGDIR_SHIFT) + +#ifndef CONFIG_PPC_4K_PAGES +static struct kmem_cache *pgtable_cache; + +void pgtable_cache_init(void) +{ + pgtable_cache = kmem_cache_create("PGDIR cache", 1 << PGDIR_ORDER, + 1 << PGDIR_ORDER, 0, NULL); + if (pgtable_cache == NULL) + panic("Couldn't allocate pgtable caches"); +} +#endif + +pgd_t *pgd_alloc(struct mm_struct *mm) +{ + pgd_t *ret; + + /* pgdir take page or two with 4K pages and a page fraction otherwise */ +#ifndef CONFIG_PPC_4K_PAGES + ret = kmem_cache_alloc(pgtable_cache, GFP_KERNEL | __GFP_ZERO); +#else + ret = (pgd_t *)__get_free_pages(GFP_KERNEL|__GFP_ZERO, + PGDIR_ORDER - PAGE_SHIFT); +#endif + return ret; +} + +void pgd_free(struct mm_struct *mm, pgd_t *pgd) +{ +#ifndef CONFIG_PPC_4K_PAGES + kmem_cache_free(pgtable_cache, (void *)pgd); +#else + free_pages((unsigned long)pgd, PGDIR_ORDER - PAGE_SHIFT); +#endif +} + __ref pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) { pte_t *pte; reverted: --- linux-raspi2-4.8.0/arch/powerpc/platforms/powernv/opal-tracepoints.c +++ linux-raspi2-4.8.0.orig/arch/powerpc/platforms/powernv/opal-tracepoints.c @@ -6,10 +6,9 @@ #ifdef HAVE_JUMP_LABEL struct static_key opal_tracepoint_key = STATIC_KEY_INIT; +void opal_tracepoint_regfunc(void) -int opal_tracepoint_regfunc(void) { static_key_slow_inc(&opal_tracepoint_key); - return 0; } void opal_tracepoint_unregfunc(void) @@ -26,10 +25,9 @@ /* NB: reg/unreg are called while guarded with the tracepoints_mutex */ extern long opal_tracepoint_refcount; +void opal_tracepoint_regfunc(void) -int opal_tracepoint_regfunc(void) { opal_tracepoint_refcount++; - return 0; } void opal_tracepoint_unregfunc(void) reverted: --- linux-raspi2-4.8.0/arch/powerpc/platforms/pseries/cmm.c +++ linux-raspi2-4.8.0.orig/arch/powerpc/platforms/pseries/cmm.c @@ -41,8 +41,6 @@ #include #include -#include "pseries.h" - #define CMM_DRIVER_VERSION "1.0.0" #define CMM_DEFAULT_DELAY 1 #define CMM_HOTPLUG_DELAY 5 @@ -111,38 +109,6 @@ static struct task_struct *cmm_thread_ptr; -static long plpar_page_set_loaned(unsigned long vpa) -{ - unsigned long cmo_page_sz = cmo_get_page_size(); - long rc = 0; - int i; - - for (i = 0; !rc && i < PAGE_SIZE; i += cmo_page_sz) - rc = plpar_hcall_norets(H_PAGE_INIT, H_PAGE_SET_LOANED, vpa + i, 0); - - for (i -= cmo_page_sz; rc && i != 0; i -= cmo_page_sz) - plpar_hcall_norets(H_PAGE_INIT, H_PAGE_SET_ACTIVE, - vpa + i - cmo_page_sz, 0); - - return rc; -} - -static long plpar_page_set_active(unsigned long vpa) -{ - unsigned long cmo_page_sz = cmo_get_page_size(); - long rc = 0; - int i; - - for (i = 0; !rc && i < PAGE_SIZE; i += cmo_page_sz) - rc = plpar_hcall_norets(H_PAGE_INIT, H_PAGE_SET_ACTIVE, vpa + i, 0); - - for (i -= cmo_page_sz; rc && i != 0; i -= cmo_page_sz) - plpar_hcall_norets(H_PAGE_INIT, H_PAGE_SET_LOANED, - vpa + i - cmo_page_sz, 0); - - return rc; -} - /** * cmm_alloc_pages - Allocate pages and mark them as loaned * @nr: number of pages to allocate reverted: --- linux-raspi2-4.8.0/arch/powerpc/platforms/pseries/firmware.c +++ linux-raspi2-4.8.0.orig/arch/powerpc/platforms/pseries/firmware.c @@ -126,7 +126,7 @@ index = OV5_INDX(vec5_fw_features_table[i].feature); feat = OV5_FEAT(vec5_fw_features_table[i].feature); + if (vec5[index] & feat) - if (index < len && (vec5[index] & feat)) powerpc_firmware_features |= vec5_fw_features_table[i].val; } diff -u linux-raspi2-4.8.0/arch/powerpc/platforms/pseries/lpar.c linux-raspi2-4.8.0/arch/powerpc/platforms/pseries/lpar.c --- linux-raspi2-4.8.0/arch/powerpc/platforms/pseries/lpar.c +++ linux-raspi2-4.8.0/arch/powerpc/platforms/pseries/lpar.c @@ -221,7 +221,7 @@ return -1; } -static void manual_hpte_clear_all(void) +static void pSeries_lpar_hptab_clear(void) { unsigned long size_bytes = 1UL << ppc64_pft_size; unsigned long hpte_count = size_bytes >> 4; @@ -249,26 +249,6 @@ &(ptes[j].pteh), &(ptes[j].ptel)); } } -} - -static int hcall_hpte_clear_all(void) -{ - int rc; - - do { - rc = plpar_hcall_norets(H_CLEAR_HPT); - } while (rc == H_CONTINUE); - - return rc; -} - -static void pseries_hpte_clear_all(void) -{ - int rc; - - rc = hcall_hpte_clear_all(); - if (rc != H_SUCCESS) - manual_hpte_clear_all(); #ifdef __LITTLE_ENDIAN__ /* @@ -609,29 +589,6 @@ __setup("bulk_remove=", disable_bulk_remove); -/* Actually only used for radix, so far */ -static int pseries_lpar_register_process_table(unsigned long base, - unsigned long page_size, unsigned long table_size) -{ - long rc; - unsigned long flags = PROC_TABLE_NEW; - - if (radix_enabled()) - flags |= PROC_TABLE_RADIX | PROC_TABLE_GTSE; - for (;;) { - rc = plpar_hcall_norets(H_REGISTER_PROC_TBL, flags, base, - page_size, table_size); - if (!H_IS_LONG_BUSY(rc)) - break; - mdelay(get_longbusy_msecs(rc)); - } - if (rc != H_SUCCESS) { - pr_err("Failed to register process table (rc=%ld)\n", rc); - BUG(); - } - return rc; -} - void __init hpte_init_pseries(void) { mmu_hash_ops.hpte_invalidate = pSeries_lpar_hpte_invalidate; @@ -641,16 +598,10 @@ mmu_hash_ops.hpte_remove = pSeries_lpar_hpte_remove; mmu_hash_ops.hpte_removebolted = pSeries_lpar_hpte_removebolted; mmu_hash_ops.flush_hash_range = pSeries_lpar_flush_hash_range; - mmu_hash_ops.hpte_clear_all = pseries_hpte_clear_all; + mmu_hash_ops.hpte_clear_all = pSeries_lpar_hptab_clear; mmu_hash_ops.hugepage_invalidate = pSeries_lpar_hugepage_invalidate; } -void radix_init_pseries(void) -{ - pr_info("Using radix MMU under hypervisor\n"); - register_process_table = pseries_lpar_register_process_table; -} - #ifdef CONFIG_PPC_SMLPAR #define CMO_FREE_HINT_DEFAULT 1 static int cmo_free_hint_flag = CMO_FREE_HINT_DEFAULT; @@ -710,10 +661,9 @@ #ifdef HAVE_JUMP_LABEL struct static_key hcall_tracepoint_key = STATIC_KEY_INIT; -int hcall_tracepoint_regfunc(void) +void hcall_tracepoint_regfunc(void) { static_key_slow_inc(&hcall_tracepoint_key); - return 0; } void hcall_tracepoint_unregfunc(void) @@ -730,10 +680,9 @@ /* NB: reg/unreg are called while guarded with the tracepoints_mutex */ extern long hcall_tracepoint_refcount; -int hcall_tracepoint_regfunc(void) +void hcall_tracepoint_regfunc(void) { hcall_tracepoint_refcount++; - return 0; } void hcall_tracepoint_unregfunc(void) reverted: --- linux-raspi2-4.8.0/arch/powerpc/platforms/pseries/lparcfg.c +++ linux-raspi2-4.8.0.orig/arch/powerpc/platforms/pseries/lparcfg.c @@ -37,7 +37,6 @@ #include #include -#include "pseries.h" /* * This isn't a module but we expose that to userspace reverted: --- linux-raspi2-4.8.0/arch/powerpc/platforms/pseries/pseries.h +++ linux-raspi2-4.8.0.orig/arch/powerpc/platforms/pseries/pseries.h @@ -79,23 +79,4 @@ unsigned long pseries_memory_block_size(void); -extern int CMO_PrPSP; -extern int CMO_SecPSP; -extern unsigned long CMO_PageSize; - -static inline int cmo_get_primary_psp(void) -{ - return CMO_PrPSP; -} - -static inline int cmo_get_secondary_psp(void) -{ - return CMO_SecPSP; -} - -static inline unsigned long cmo_get_page_size(void) -{ - return CMO_PageSize; -} - #endif /* _PSERIES_PSERIES_H */ reverted: --- linux-raspi2-4.8.0/arch/x86/include/asm/trace/exceptions.h +++ linux-raspi2-4.8.0.orig/arch/x86/include/asm/trace/exceptions.h @@ -6,7 +6,7 @@ #include +extern void trace_irq_vector_regfunc(void); -extern int trace_irq_vector_regfunc(void); extern void trace_irq_vector_unregfunc(void); DECLARE_EVENT_CLASS(x86_exceptions, reverted: --- linux-raspi2-4.8.0/arch/x86/include/asm/trace/irq_vectors.h +++ linux-raspi2-4.8.0.orig/arch/x86/include/asm/trace/irq_vectors.h @@ -6,7 +6,7 @@ #include +extern void trace_irq_vector_regfunc(void); -extern int trace_irq_vector_regfunc(void); extern void trace_irq_vector_unregfunc(void); DECLARE_EVENT_CLASS(x86_irq_vector, reverted: --- linux-raspi2-4.8.0/arch/x86/kernel/tracepoint.c +++ linux-raspi2-4.8.0.orig/arch/x86/kernel/tracepoint.c @@ -34,7 +34,7 @@ local_irq_restore(flags); } +void trace_irq_vector_regfunc(void) -int trace_irq_vector_regfunc(void) { mutex_lock(&irq_vector_mutex); if (!trace_irq_vector_refcount) { @@ -44,7 +44,6 @@ } trace_irq_vector_refcount++; mutex_unlock(&irq_vector_mutex); - return 0; } void trace_irq_vector_unregfunc(void) diff -u linux-raspi2-4.8.0/debian.master/changelog linux-raspi2-4.8.0/debian.master/changelog --- linux-raspi2-4.8.0/debian.master/changelog +++ linux-raspi2-4.8.0/debian.master/changelog @@ -1,82 +1,31 @@ -linux (4.8.0-43.46) yakkety; urgency=low +linux (4.8.0-44.47) yakkety; urgency=low - * linux: 4.8.0-43.46 -proposed tracker (LP: #1673222) + * linux: 4.8.0-44.47 -proposed tracker (LP: #1674986) - * POWER9: Improve CAS negotiation (LP: #1671169) - - powerpc: Parse the command line before calling CAS - - powerpc: Add missing error check to prom_find_boot_cpu() - - powerpc/pseries: Advertise HPT resizing support via CAS - - powerpc/64: Disable use of radix under a hypervisor - - powerpc/pseries: Advertise Hot Plug Event support to firmware - - powerpc: Update to new option-vector-5 format for CAS + * snaps with classic + jailmode confinement started to fail on zesty + (LP: #1666897) + - Revert "UBUNTU: SAUCE: apparmor: fix link auditing failure due to, + uninitialized var" + - Revert "UBUNTU: SAUCE: fix regression with domain change in complain mode" + - Revert "UBUNTU: SAUCE: apparmor: flock mediation is not being enforced on + cache check" + - Revert "UBUNTU: SAUCE: apparmor: null profiles should inherit parent control + flags" + - Revert "UBUNTU: SAUCE: apparmor: fix ns ref count link when removing + profiles from policy" + - Revert "UBUNTU: SAUCE: apparmor: Fix no_new_privs blocking change_onexec + when using stacked namespaces" + - Revert "UBUNTU: SAUCE: apparmor: fix oops in bind_mnt when dev_path lookup + fails" + - Revert "UBUNTU: SAUCE: apparmor: Don't audit denied access of special + apparmor .null file" + - Revert "UBUNTU: SAUCE: apparmor: fix label leak when new label is unused" + - Revert "UBUNTU: SAUCE: apparmor: fix reference count bug in + label_merge_insert()" + - Revert "UBUNTU: SAUCE: apparmor: fix replacement race in reading rawdata" + - Revert "UBUNTU: SAUCE: apparmor: fix cross ns perm of unix domain sockets" - * Power9 kernel: add virtualization patches (LP: #1670800) - - powerpc/fadump: Set core e_flags using kernel's ELF ABI version - - powerpc/sparse: Add more assembler prototypes - - powerpc/pasemi: Fix Nemo SB600 i8259 interrupts. - - powerpc/pasemi: Fix device_type of Nemo SB600 node. - - powerpc/pseries: Use H_CLEAR_HPT to clear MMU hash table during kexec - - powerpc/pseries: Move CMO code from plapr_wrappers.h to platforms/pseries - - powerpc: Fix old style declaration GCC warnings - - powerpc/pseries: add definitions for new H_SIGNAL_SYS_RESET hcall - - powerpc/prom: Define structs for client architecture vectors - - powerpc/prom: Switch to using structs for ibm_architecture_vec - - tracing: Have the reg function allow to fail - - powerpc: port 64 bits pgtable_cache to 32 bits - - powerpc/64: Don't try to use radix MMU under a hypervisor - - powerpc/pseries: Fixes for the "ibm,architecture-vec-5" options - - powerpc/64: Enable use of radix MMU under hypervisor on POWER9 - - * lsattr 32bit does not work on 64bit kernel (Inappropriate ioctl error) - (LP: #1619918) - - btrfs: fix btrfs_compat_ioctl failures on non-compat ioctls - - * linux-tools-common should Depends: lsb-release (LP: #1667571) - - [Config] linux-tools-common depends on lsb-release - - * CAPI:Ubuntu: Kernel panic while rebooting (LP: #1667599) - - pci/hotplug/pnv-php: Remove WARN_ON() in pnv_php_put_slot() - - * Add Use-After-Free Patch for Ubuntu16.10 - EEH on BELL3 adapter fails to - recover (serial/tty) (LP: #1669153) - - 8250_pci: Fix potential use-after-free in error path - - * Request to backport cxlflash patches to Xenial SRU stream (LP: #1623750) - - scsi: cxlflash: Scan host only after the port is ready for I/O - - scsi: cxlflash: Fix to avoid EEH and host reset collisions - - scsi: cxlflash: Improve EEH recovery time - - * FlashGT Integration and Setup: fsbmc30: After 17th reboot of soft bootme, - HTX & Linux errors seen with 256 virtual LUNs (LP: #1667239) - - cxl: Fix coredump generation when cxl_get_fd() is used - - * POWER9: Additional patches for 17.04 and 16.04.2 (LP: #1667116) - - powerpc/mm: Update PROTFAULT handling in the page fault path - - powerpc/mm/radix: Update pte update sequence for pte clear case - - powerpc/mm/radix: Use ptep_get_and_clear_full when clearing pte for full mm - - powerpc/mm/radix: Skip ptesync in pte update helpers - - SAUCE: powerpc/mm/hash: Always clear UPRT and Host Radix bits when setting - up CPU - - * [Hyper-V] Ubuntu 14.04.2 LTS Generation 2 SCSI Errors on VSS Based Backups - (LP: #1470250) - - Drivers: hv: vss: Operation timeouts should match host expectation - - SAUCE: Tools: hv: vss: Thaw the filesystem and continue after freeze fails - - * PowerNV: No rate limit for kernel error "KVM can't copy data from" - (LP: #1667416) - - SAUCE: KVM: PPC: Book3S: Ratelimit copy data failure error messages - - * kernel 4.4.0-63 with USB WLAN RTL8192CU freezes desktop (LP: #1666421) - - rtlwifi: rtl_usb: Fix missing entry in USB driver's private data - - * Export symbol "dev_pm_qos_update_user_latency_tolerance" (LP: #1666401) - - PM / QoS: Export dev_pm_qos_update_user_latency_tolerance - - * Linux ZFS port doesn't respect RLIMIT_FSIZE (LP: #1656259) - - SAUCE: (noup) Update zfs to 0.6.5.8-0ubuntu4.2 - - -- Thadeu Lima de Souza Cascardo Wed, 15 Mar 2017 17:02:15 -0300 + -- Thadeu Lima de Souza Cascardo Wed, 22 Mar 2017 10:22:27 -0300 linux (4.8.0-42.45) yakkety; urgency=low diff -u linux-raspi2-4.8.0/debian.master/control.stub.in linux-raspi2-4.8.0/debian.master/control.stub.in --- linux-raspi2-4.8.0/debian.master/control.stub.in +++ linux-raspi2-4.8.0/debian.master/control.stub.in @@ -115,7 +115,7 @@ Multi-Arch: foreign Section: kernel Priority: optional -Depends: ${misc:Depends}, lsb-release +Depends: ${misc:Depends} Description: Linux kernel version specific tools for version PKGVER This package provides the architecture independent parts for kernel version locked tools (such as perf and x86_energy_perf_policy) for diff -u linux-raspi2-4.8.0/debian.raspi2/changelog linux-raspi2-4.8.0/debian.raspi2/changelog --- linux-raspi2-4.8.0/debian.raspi2/changelog +++ linux-raspi2-4.8.0/debian.raspi2/changelog @@ -1,72 +1,36 @@ -linux-raspi2 (4.8.0-1030.33) yakkety; urgency=low +linux-raspi2 (4.8.0-1031.34) yakkety; urgency=low - * linux-raspi2: 4.8.0-1030.33 -proposed tracker (LP: #1673228) + [ Thadeu Lima de Souza Cascardo ] - [ Ubuntu: 4.8.0-43.46 ] + * linux-raspi2: 4.8.0-1031.34 -proposed tracker (LP: #1674989) - * linux: 4.8.0-43.46 -proposed tracker (LP: #1673222) - * POWER9: Improve CAS negotiation (LP: #1671169) - - powerpc: Parse the command line before calling CAS - - powerpc: Add missing error check to prom_find_boot_cpu() - - powerpc/pseries: Advertise HPT resizing support via CAS - - powerpc/64: Disable use of radix under a hypervisor - - powerpc/pseries: Advertise Hot Plug Event support to firmware - - powerpc: Update to new option-vector-5 format for CAS - * Power9 kernel: add virtualization patches (LP: #1670800) - - powerpc/fadump: Set core e_flags using kernel's ELF ABI version - - powerpc/sparse: Add more assembler prototypes - - powerpc/pasemi: Fix Nemo SB600 i8259 interrupts. - - powerpc/pasemi: Fix device_type of Nemo SB600 node. - - powerpc/pseries: Use H_CLEAR_HPT to clear MMU hash table during kexec - - powerpc/pseries: Move CMO code from plapr_wrappers.h to platforms/pseries - - powerpc: Fix old style declaration GCC warnings - - powerpc/pseries: add definitions for new H_SIGNAL_SYS_RESET hcall - - powerpc/prom: Define structs for client architecture vectors - - powerpc/prom: Switch to using structs for ibm_architecture_vec - - tracing: Have the reg function allow to fail - - powerpc: port 64 bits pgtable_cache to 32 bits - - powerpc/64: Don't try to use radix MMU under a hypervisor - - powerpc/pseries: Fixes for the "ibm,architecture-vec-5" options - - powerpc/64: Enable use of radix MMU under hypervisor on POWER9 - * lsattr 32bit does not work on 64bit kernel (Inappropriate ioctl error) - (LP: #1619918) - - btrfs: fix btrfs_compat_ioctl failures on non-compat ioctls - * linux-tools-common should Depends: lsb-release (LP: #1667571) - - [Config] linux-tools-common depends on lsb-release - * CAPI:Ubuntu: Kernel panic while rebooting (LP: #1667599) - - pci/hotplug/pnv-php: Remove WARN_ON() in pnv_php_put_slot() - * Add Use-After-Free Patch for Ubuntu16.10 - EEH on BELL3 adapter fails to - recover (serial/tty) (LP: #1669153) - - 8250_pci: Fix potential use-after-free in error path - * Request to backport cxlflash patches to Xenial SRU stream (LP: #1623750) - - scsi: cxlflash: Scan host only after the port is ready for I/O - - scsi: cxlflash: Fix to avoid EEH and host reset collisions - - scsi: cxlflash: Improve EEH recovery time - * FlashGT Integration and Setup: fsbmc30: After 17th reboot of soft bootme, - HTX & Linux errors seen with 256 virtual LUNs (LP: #1667239) - - cxl: Fix coredump generation when cxl_get_fd() is used - * POWER9: Additional patches for 17.04 and 16.04.2 (LP: #1667116) - - powerpc/mm: Update PROTFAULT handling in the page fault path - - powerpc/mm/radix: Update pte update sequence for pte clear case - - powerpc/mm/radix: Use ptep_get_and_clear_full when clearing pte for full mm - - powerpc/mm/radix: Skip ptesync in pte update helpers - - SAUCE: powerpc/mm/hash: Always clear UPRT and Host Radix bits when setting - up CPU - * [Hyper-V] Ubuntu 14.04.2 LTS Generation 2 SCSI Errors on VSS Based Backups - (LP: #1470250) - - Drivers: hv: vss: Operation timeouts should match host expectation - - SAUCE: Tools: hv: vss: Thaw the filesystem and continue after freeze fails - * PowerNV: No rate limit for kernel error "KVM can't copy data from" - (LP: #1667416) - - SAUCE: KVM: PPC: Book3S: Ratelimit copy data failure error messages - * kernel 4.4.0-63 with USB WLAN RTL8192CU freezes desktop (LP: #1666421) - - rtlwifi: rtl_usb: Fix missing entry in USB driver's private data - * Export symbol "dev_pm_qos_update_user_latency_tolerance" (LP: #1666401) - - PM / QoS: Export dev_pm_qos_update_user_latency_tolerance - * Linux ZFS port doesn't respect RLIMIT_FSIZE (LP: #1656259) - - SAUCE: (noup) Update zfs to 0.6.5.8-0ubuntu4.2 + [ Ubuntu: 4.8.0-44.47 ] - -- Thadeu Lima de Souza Cascardo Thu, 16 Mar 2017 12:42:10 -0300 + * linux: 4.8.0-44.47 -proposed tracker (LP: #1674986) + * snaps with classic + jailmode confinement started to fail on zesty + (LP: #1666897) + - Revert "UBUNTU: SAUCE: apparmor: fix link auditing failure due to, + uninitialized var" + - Revert "UBUNTU: SAUCE: fix regression with domain change in complain mode" + - Revert "UBUNTU: SAUCE: apparmor: flock mediation is not being enforced on + cache check" + - Revert "UBUNTU: SAUCE: apparmor: null profiles should inherit parent control + flags" + - Revert "UBUNTU: SAUCE: apparmor: fix ns ref count link when removing + profiles from policy" + - Revert "UBUNTU: SAUCE: apparmor: Fix no_new_privs blocking change_onexec + when using stacked namespaces" + - Revert "UBUNTU: SAUCE: apparmor: fix oops in bind_mnt when dev_path lookup + fails" + - Revert "UBUNTU: SAUCE: apparmor: Don't audit denied access of special + apparmor .null file" + - Revert "UBUNTU: SAUCE: apparmor: fix label leak when new label is unused" + - Revert "UBUNTU: SAUCE: apparmor: fix reference count bug in + label_merge_insert()" + - Revert "UBUNTU: SAUCE: apparmor: fix replacement race in reading rawdata" + - Revert "UBUNTU: SAUCE: apparmor: fix cross ns perm of unix domain sockets" + + -- Thadeu Lima de Souza Cascardo Wed, 22 Mar 2017 15:06:21 -0300 linux-raspi2 (4.8.0-1029.32) yakkety; urgency=low diff -u linux-raspi2-4.8.0/debian.raspi2/reconstruct linux-raspi2-4.8.0/debian.raspi2/reconstruct --- linux-raspi2-4.8.0/debian.raspi2/reconstruct +++ linux-raspi2-4.8.0/debian.raspi2/reconstruct @@ -8,6 +8,8 @@ [ ! -L 'ubuntu/vbox/vboxvideo/include' ] && ln -sf '../include' 'ubuntu/vbox/vboxvideo/include' [ ! -L 'ubuntu/vbox/vboxvideo/r0drv' ] && ln -sf '../r0drv' 'ubuntu/vbox/vboxvideo/r0drv' # Remove any files deleted from the orig. +rm -f 'arch/powerpc/include/asm/book3s/64/hugetlb-radix.h' +rm -f 'arch/sparc/lib/user_fixup.c' rm -f 'firmware/acenic/tg1.bin.ihex' rm -f 'firmware/acenic/tg2.bin.ihex' rm -f 'firmware/adaptec/starfire_rx.bin.ihex' diff -u linux-raspi2-4.8.0/debian/changelog linux-raspi2-4.8.0/debian/changelog --- linux-raspi2-4.8.0/debian/changelog +++ linux-raspi2-4.8.0/debian/changelog @@ -1,72 +1,36 @@ -linux-raspi2 (4.8.0-1030.33) yakkety; urgency=low +linux-raspi2 (4.8.0-1031.34) yakkety; urgency=low - * linux-raspi2: 4.8.0-1030.33 -proposed tracker (LP: #1673228) + [ Thadeu Lima de Souza Cascardo ] - [ Ubuntu: 4.8.0-43.46 ] + * linux-raspi2: 4.8.0-1031.34 -proposed tracker (LP: #1674989) - * linux: 4.8.0-43.46 -proposed tracker (LP: #1673222) - * POWER9: Improve CAS negotiation (LP: #1671169) - - powerpc: Parse the command line before calling CAS - - powerpc: Add missing error check to prom_find_boot_cpu() - - powerpc/pseries: Advertise HPT resizing support via CAS - - powerpc/64: Disable use of radix under a hypervisor - - powerpc/pseries: Advertise Hot Plug Event support to firmware - - powerpc: Update to new option-vector-5 format for CAS - * Power9 kernel: add virtualization patches (LP: #1670800) - - powerpc/fadump: Set core e_flags using kernel's ELF ABI version - - powerpc/sparse: Add more assembler prototypes - - powerpc/pasemi: Fix Nemo SB600 i8259 interrupts. - - powerpc/pasemi: Fix device_type of Nemo SB600 node. - - powerpc/pseries: Use H_CLEAR_HPT to clear MMU hash table during kexec - - powerpc/pseries: Move CMO code from plapr_wrappers.h to platforms/pseries - - powerpc: Fix old style declaration GCC warnings - - powerpc/pseries: add definitions for new H_SIGNAL_SYS_RESET hcall - - powerpc/prom: Define structs for client architecture vectors - - powerpc/prom: Switch to using structs for ibm_architecture_vec - - tracing: Have the reg function allow to fail - - powerpc: port 64 bits pgtable_cache to 32 bits - - powerpc/64: Don't try to use radix MMU under a hypervisor - - powerpc/pseries: Fixes for the "ibm,architecture-vec-5" options - - powerpc/64: Enable use of radix MMU under hypervisor on POWER9 - * lsattr 32bit does not work on 64bit kernel (Inappropriate ioctl error) - (LP: #1619918) - - btrfs: fix btrfs_compat_ioctl failures on non-compat ioctls - * linux-tools-common should Depends: lsb-release (LP: #1667571) - - [Config] linux-tools-common depends on lsb-release - * CAPI:Ubuntu: Kernel panic while rebooting (LP: #1667599) - - pci/hotplug/pnv-php: Remove WARN_ON() in pnv_php_put_slot() - * Add Use-After-Free Patch for Ubuntu16.10 - EEH on BELL3 adapter fails to - recover (serial/tty) (LP: #1669153) - - 8250_pci: Fix potential use-after-free in error path - * Request to backport cxlflash patches to Xenial SRU stream (LP: #1623750) - - scsi: cxlflash: Scan host only after the port is ready for I/O - - scsi: cxlflash: Fix to avoid EEH and host reset collisions - - scsi: cxlflash: Improve EEH recovery time - * FlashGT Integration and Setup: fsbmc30: After 17th reboot of soft bootme, - HTX & Linux errors seen with 256 virtual LUNs (LP: #1667239) - - cxl: Fix coredump generation when cxl_get_fd() is used - * POWER9: Additional patches for 17.04 and 16.04.2 (LP: #1667116) - - powerpc/mm: Update PROTFAULT handling in the page fault path - - powerpc/mm/radix: Update pte update sequence for pte clear case - - powerpc/mm/radix: Use ptep_get_and_clear_full when clearing pte for full mm - - powerpc/mm/radix: Skip ptesync in pte update helpers - - SAUCE: powerpc/mm/hash: Always clear UPRT and Host Radix bits when setting - up CPU - * [Hyper-V] Ubuntu 14.04.2 LTS Generation 2 SCSI Errors on VSS Based Backups - (LP: #1470250) - - Drivers: hv: vss: Operation timeouts should match host expectation - - SAUCE: Tools: hv: vss: Thaw the filesystem and continue after freeze fails - * PowerNV: No rate limit for kernel error "KVM can't copy data from" - (LP: #1667416) - - SAUCE: KVM: PPC: Book3S: Ratelimit copy data failure error messages - * kernel 4.4.0-63 with USB WLAN RTL8192CU freezes desktop (LP: #1666421) - - rtlwifi: rtl_usb: Fix missing entry in USB driver's private data - * Export symbol "dev_pm_qos_update_user_latency_tolerance" (LP: #1666401) - - PM / QoS: Export dev_pm_qos_update_user_latency_tolerance - * Linux ZFS port doesn't respect RLIMIT_FSIZE (LP: #1656259) - - SAUCE: (noup) Update zfs to 0.6.5.8-0ubuntu4.2 + [ Ubuntu: 4.8.0-44.47 ] - -- Thadeu Lima de Souza Cascardo Thu, 16 Mar 2017 12:42:10 -0300 + * linux: 4.8.0-44.47 -proposed tracker (LP: #1674986) + * snaps with classic + jailmode confinement started to fail on zesty + (LP: #1666897) + - Revert "UBUNTU: SAUCE: apparmor: fix link auditing failure due to, + uninitialized var" + - Revert "UBUNTU: SAUCE: fix regression with domain change in complain mode" + - Revert "UBUNTU: SAUCE: apparmor: flock mediation is not being enforced on + cache check" + - Revert "UBUNTU: SAUCE: apparmor: null profiles should inherit parent control + flags" + - Revert "UBUNTU: SAUCE: apparmor: fix ns ref count link when removing + profiles from policy" + - Revert "UBUNTU: SAUCE: apparmor: Fix no_new_privs blocking change_onexec + when using stacked namespaces" + - Revert "UBUNTU: SAUCE: apparmor: fix oops in bind_mnt when dev_path lookup + fails" + - Revert "UBUNTU: SAUCE: apparmor: Don't audit denied access of special + apparmor .null file" + - Revert "UBUNTU: SAUCE: apparmor: fix label leak when new label is unused" + - Revert "UBUNTU: SAUCE: apparmor: fix reference count bug in + label_merge_insert()" + - Revert "UBUNTU: SAUCE: apparmor: fix replacement race in reading rawdata" + - Revert "UBUNTU: SAUCE: apparmor: fix cross ns perm of unix domain sockets" + + -- Thadeu Lima de Souza Cascardo Wed, 22 Mar 2017 15:06:21 -0300 linux-raspi2 (4.8.0-1029.32) yakkety; urgency=low diff -u linux-raspi2-4.8.0/debian/control linux-raspi2-4.8.0/debian/control --- linux-raspi2-4.8.0/debian/control +++ linux-raspi2-4.8.0/debian/control @@ -47,7 +47,7 @@ XS-Testsuite: autopkgtest #XS-Testsuite-Depends: gcc-4.7 binutils -Package: linux-raspi2-headers-4.8.0-1030 +Package: linux-raspi2-headers-4.8.0-1031 Build-Profiles: Architecture: armhf arm64 Multi-Arch: foreign @@ -57,23 +57,23 @@ Description: Header files related to Linux kernel version 4.8.0 This package provides kernel header files for version 4.8.0, for sites that want the latest kernel headers. Please read - /usr/share/doc/linux-raspi2-headers-4.8.0-1030/debian.README.gz for details + /usr/share/doc/linux-raspi2-headers-4.8.0-1031/debian.README.gz for details -Package: linux-raspi2-tools-4.8.0-1030 +Package: linux-raspi2-tools-4.8.0-1031 Build-Profiles: Architecture: armhf arm64 Section: devel Priority: optional Depends: ${misc:Depends}, ${shlibs:Depends}, linux-tools-common -Description: Linux kernel version specific tools for version 4.8.0-1030 +Description: Linux kernel version specific tools for version 4.8.0-1031 This package provides the architecture dependant parts for kernel version locked tools (such as perf and x86_energy_perf_policy) for - version 4.8.0-1030 on + version 4.8.0-1031 on . You probabaly want to install the linux-tools- meta package. -Package: linux-image-4.8.0-1030-raspi2 +Package: linux-image-4.8.0-1031-raspi2 Build-Profiles: Architecture: armhf arm64 Section: kernel @@ -83,7 +83,7 @@ Depends: ${misc:Depends}, ${shlibs:Depends}, initramfs-tools (>= 0.36ubuntu6) | linux-initramfs-tool, kmod Conflicts: hotplug (<< 0.0.20040105-1) Recommends: grub-pc [i386 amd64 x32] | grub-efi-amd64 [amd64 x32] | grub-efi-ia32 [i386 amd64 x32] | grub [i386 amd64 x32] | lilo (>= 19.1) [i386 amd64 x32] | flash-kernel [armhf arm64] | grub-ieee1275 [ppc64el] -Suggests: fdutils, linux-raspi2-tools, linux-headers-4.8.0-1030-raspi2 +Suggests: fdutils, linux-raspi2-tools, linux-headers-4.8.0-1031-raspi2 Description: Linux kernel image for version 4.8.0 on SMP This package contains the Linux kernel image for version 4.8.0 on SMP. @@ -100,21 +100,21 @@ the linux-raspi2 meta-package, which will ensure that upgrades work correctly, and that supporting packages are also installed. -Package: linux-headers-4.8.0-1030-raspi2 +Package: linux-headers-4.8.0-1031-raspi2 Build-Profiles: Architecture: armhf arm64 Section: devel Priority: optional -Depends: ${misc:Depends}, linux-raspi2-headers-4.8.0-1030, ${shlibs:Depends} +Depends: ${misc:Depends}, linux-raspi2-headers-4.8.0-1031, ${shlibs:Depends} Provides: linux-headers, linux-headers-3.0 Description: Linux kernel headers for version 4.8.0 on SMP This package provides kernel header files for version 4.8.0 on SMP. . This is for sites that want the latest kernel headers. Please read - /usr/share/doc/linux-headers-4.8.0-1030/debian.README.gz for details. + /usr/share/doc/linux-headers-4.8.0-1031/debian.README.gz for details. -Package: linux-image-4.8.0-1030-raspi2-dbgsym +Package: linux-image-4.8.0-1031-raspi2-dbgsym Build-Profiles: Architecture: armhf arm64 Section: devel @@ -132,14 +132,14 @@ unstripped modules. -Package: linux-tools-4.8.0-1030-raspi2 +Package: linux-tools-4.8.0-1031-raspi2 Build-Profiles: Architecture: armhf arm64 Section: devel Priority: optional -Depends: ${misc:Depends}, linux-raspi2-tools-4.8.0-1030 -Description: Linux kernel version specific tools for version 4.8.0-1030 +Depends: ${misc:Depends}, linux-raspi2-tools-4.8.0-1031 +Description: Linux kernel version specific tools for version 4.8.0-1031 This package provides the architecture dependant parts for kernel version locked tools (such as perf and x86_energy_perf_policy) for - version 4.8.0-1030 on + version 4.8.0-1031 on . reverted: --- linux-raspi2-4.8.0/drivers/base/power/qos.c +++ linux-raspi2-4.8.0.orig/drivers/base/power/qos.c @@ -883,7 +883,6 @@ mutex_unlock(&dev_pm_qos_mtx); return ret; } -EXPORT_SYMBOL_GPL(dev_pm_qos_update_user_latency_tolerance); /** * dev_pm_qos_expose_latency_tolerance - Expose latency tolerance to userspace diff -u linux-raspi2-4.8.0/drivers/hv/hv_snapshot.c linux-raspi2-4.8.0/drivers/hv/hv_snapshot.c --- linux-raspi2-4.8.0/drivers/hv/hv_snapshot.c +++ linux-raspi2-4.8.0/drivers/hv/hv_snapshot.c @@ -31,10 +31,7 @@ #define VSS_MINOR 0 #define VSS_VERSION (VSS_MAJOR << 16 | VSS_MINOR) -/* - * Timeout values are based on expecations from host - */ -#define VSS_FREEZE_TIMEOUT (15 * 60) +#define VSS_USERSPACE_TIMEOUT (msecs_to_jiffies(10 * 1000)) /* * Global state maintained for transaction that is being processed. For a class @@ -182,8 +179,7 @@ vss_transaction.state = HVUTIL_USERSPACE_REQ; - schedule_delayed_work(&vss_timeout_work, op == VSS_OP_FREEZE ? - VSS_FREEZE_TIMEOUT * HZ : HV_UTIL_TIMEOUT * HZ); + schedule_delayed_work(&vss_timeout_work, VSS_USERSPACE_TIMEOUT); rc = hvutil_transport_send(hvt, vss_msg, sizeof(*vss_msg), NULL); if (rc) { diff -u linux-raspi2-4.8.0/drivers/i2c/i2c-core.c linux-raspi2-4.8.0/drivers/i2c/i2c-core.c --- linux-raspi2-4.8.0/drivers/i2c/i2c-core.c +++ linux-raspi2-4.8.0/drivers/i2c/i2c-core.c @@ -77,10 +77,9 @@ static struct static_key i2c_trace_msg = STATIC_KEY_INIT_FALSE; static bool is_registered; -int i2c_transfer_trace_reg(void) +void i2c_transfer_trace_reg(void) { static_key_slow_inc(&i2c_trace_msg); - return 0; } void i2c_transfer_trace_unreg(void) diff -u linux-raspi2-4.8.0/drivers/misc/cxl/api.c linux-raspi2-4.8.0/drivers/misc/cxl/api.c --- linux-raspi2-4.8.0/drivers/misc/cxl/api.c +++ linux-raspi2-4.8.0/drivers/misc/cxl/api.c @@ -9,119 +9,18 @@ #include #include +#include #include #include +#include #include #include -#include -#include #include "cxl.h" -/* - * Since we want to track memory mappings to be able to force-unmap - * when the AFU is no longer reachable, we need an inode. For devices - * opened through the cxl user API, this is not a problem, but a - * userland process can also get a cxl fd through the cxl_get_fd() - * API, which is used by the cxlflash driver. - * - * Therefore we implement our own simple pseudo-filesystem and inode - * allocator. We don't use the anonymous inode, as we need the - * meta-data associated with it (address_space) and it is shared by - * other drivers/processes, so it could lead to cxl unmapping VMAs - * from random processes. - */ - -#define CXL_PSEUDO_FS_MAGIC 0x1697697f - -static int cxl_fs_cnt; -static struct vfsmount *cxl_vfs_mount; - -static const struct dentry_operations cxl_fs_dops = { - .d_dname = simple_dname, -}; - -static struct dentry *cxl_fs_mount(struct file_system_type *fs_type, int flags, - const char *dev_name, void *data) -{ - return mount_pseudo(fs_type, "cxl:", NULL, &cxl_fs_dops, - CXL_PSEUDO_FS_MAGIC); -} - -static struct file_system_type cxl_fs_type = { - .name = "cxl", - .owner = THIS_MODULE, - .mount = cxl_fs_mount, - .kill_sb = kill_anon_super, -}; - - -void cxl_release_mapping(struct cxl_context *ctx) -{ - if (ctx->kernelapi && ctx->mapping) - simple_release_fs(&cxl_vfs_mount, &cxl_fs_cnt); -} - -static struct file *cxl_getfile(const char *name, - const struct file_operations *fops, - void *priv, int flags) -{ - struct qstr this; - struct path path; - struct file *file; - struct inode *inode = NULL; - int rc; - - /* strongly inspired by anon_inode_getfile() */ - - if (fops->owner && !try_module_get(fops->owner)) - return ERR_PTR(-ENOENT); - - rc = simple_pin_fs(&cxl_fs_type, &cxl_vfs_mount, &cxl_fs_cnt); - if (rc < 0) { - pr_err("Cannot mount cxl pseudo filesystem: %d\n", rc); - file = ERR_PTR(rc); - goto err_module; - } - - inode = alloc_anon_inode(cxl_vfs_mount->mnt_sb); - if (IS_ERR(inode)) { - file = ERR_CAST(inode); - goto err_fs; - } - - file = ERR_PTR(-ENOMEM); - this.name = name; - this.len = strlen(name); - this.hash = 0; - path.dentry = d_alloc_pseudo(cxl_vfs_mount->mnt_sb, &this); - if (!path.dentry) - goto err_inode; - - path.mnt = mntget(cxl_vfs_mount); - d_instantiate(path.dentry, inode); - - file = alloc_file(&path, OPEN_FMODE(flags), fops); - if (IS_ERR(file)) - goto err_dput; - file->f_flags = flags & (O_ACCMODE | O_NONBLOCK); - file->private_data = priv; - - return file; - -err_dput: - path_put(&path); -err_inode: - iput(inode); -err_fs: - simple_release_fs(&cxl_vfs_mount, &cxl_fs_cnt); -err_module: - module_put(fops->owner); - return file; -} - struct cxl_context *cxl_dev_context_init(struct pci_dev *dev) { + struct address_space *mapping; struct cxl_afu *afu; struct cxl_context *ctx; int rc; @@ -138,13 +37,28 @@ ctx->kernelapi = true; + /* + * Make our own address space since we won't have one from the + * filesystem like the user api has, and even if we do associate a file + * with this context we don't want to use the global anonymous inode's + * address space as that can invalidate unrelated users: + */ + mapping = kmalloc(sizeof(struct address_space), GFP_KERNEL); + if (!mapping) { + rc = -ENOMEM; + goto err_ctx; + } + address_space_init_once(mapping); + /* Make it a slave context. We can promote it later? */ - rc = cxl_context_init(ctx, afu, false); + rc = cxl_context_init(ctx, afu, false, mapping); if (rc) - goto err_ctx; + goto err_mapping; return ctx; +err_mapping: + kfree(mapping); err_ctx: kfree(ctx); err_dev: @@ -426,11 +340,6 @@ { struct file *file; int rc, flags, fdtmp; - char *name = NULL; - - /* only allow one per context */ - if (ctx->mapping) - return ERR_PTR(-EEXIST); flags = O_RDWR | O_CLOEXEC; @@ -454,13 +363,12 @@ } else /* use default ops */ fops = (struct file_operations *)&afu_fops; - name = kasprintf(GFP_KERNEL, "cxl:%d", ctx->pe); - file = cxl_getfile(name, fops, ctx, flags); - kfree(name); + file = anon_inode_getfile("cxl", fops, ctx, flags); if (IS_ERR(file)) goto err_fd; - cxl_context_set_mapping(ctx, file->f_mapping); + file->f_mapping = ctx->mapping; + *fd = fdtmp; return file; diff -u linux-raspi2-4.8.0/drivers/misc/cxl/context.c linux-raspi2-4.8.0/drivers/misc/cxl/context.c --- linux-raspi2-4.8.0/drivers/misc/cxl/context.c +++ linux-raspi2-4.8.0/drivers/misc/cxl/context.c @@ -34,7 +34,8 @@ /* * Initialises a CXL context. */ -int cxl_context_init(struct cxl_context *ctx, struct cxl_afu *afu, bool master) +int cxl_context_init(struct cxl_context *ctx, struct cxl_afu *afu, bool master, + struct address_space *mapping) { int i; @@ -43,7 +44,7 @@ ctx->master = master; ctx->pid = ctx->glpid = NULL; /* Set in start work ioctl */ mutex_init(&ctx->mapping_lock); - ctx->mapping = NULL; + ctx->mapping = mapping; /* * Allocate the segment table before we put it in the IDR so that we @@ -113,14 +114,6 @@ return 0; } -void cxl_context_set_mapping(struct cxl_context *ctx, - struct address_space *mapping) -{ - mutex_lock(&ctx->mapping_lock); - ctx->mapping = mapping; - mutex_unlock(&ctx->mapping_lock); -} - static int cxl_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf) { struct cxl_context *ctx = vma->vm_file->private_data; @@ -307,6 +300,8 @@ if (ctx->ff_page) __free_page(ctx->ff_page); ctx->sstp = NULL; + if (ctx->kernelapi) + kfree(ctx->mapping); kfree(ctx->irq_bitmap); @@ -318,8 +313,6 @@ void cxl_context_free(struct cxl_context *ctx) { - if (ctx->kernelapi && ctx->mapping) - cxl_release_mapping(ctx); mutex_lock(&ctx->afu->contexts_lock); idr_remove(&ctx->afu->contexts_idr, ctx->pe); mutex_unlock(&ctx->afu->contexts_lock); diff -u linux-raspi2-4.8.0/drivers/misc/cxl/cxl.h linux-raspi2-4.8.0/drivers/misc/cxl/cxl.h --- linux-raspi2-4.8.0/drivers/misc/cxl/cxl.h +++ linux-raspi2-4.8.0/drivers/misc/cxl/cxl.h @@ -817,9 +817,8 @@ void init_cxl_native(void); struct cxl_context *cxl_context_alloc(void); -int cxl_context_init(struct cxl_context *ctx, struct cxl_afu *afu, bool master); -void cxl_context_set_mapping(struct cxl_context *ctx, - struct address_space *mapping); +int cxl_context_init(struct cxl_context *ctx, struct cxl_afu *afu, bool master, + struct address_space *mapping); void cxl_context_free(struct cxl_context *ctx); int cxl_context_iomap(struct cxl_context *ctx, struct vm_area_struct *vma); unsigned int cxl_map_irq(struct cxl *adapter, irq_hw_number_t hwirq, @@ -878,7 +877,6 @@ void cxl_stop_trace(struct cxl *cxl); int cxl_pci_vphb_add(struct cxl_afu *afu); void cxl_pci_vphb_remove(struct cxl_afu *afu); -void cxl_release_mapping(struct cxl_context *ctx); extern struct pci_driver cxl_pci_driver; extern struct platform_driver cxl_of_driver; diff -u linux-raspi2-4.8.0/drivers/misc/cxl/file.c linux-raspi2-4.8.0/drivers/misc/cxl/file.c --- linux-raspi2-4.8.0/drivers/misc/cxl/file.c +++ linux-raspi2-4.8.0/drivers/misc/cxl/file.c @@ -86,12 +86,9 @@ goto err_put_afu; } - rc = cxl_context_init(ctx, afu, master); - if (rc) + if ((rc = cxl_context_init(ctx, afu, master, inode->i_mapping))) goto err_put_afu; - cxl_context_set_mapping(ctx, inode->i_mapping); - pr_devel("afu_open pe: %i\n", ctx->pe); file->private_data = ctx; cxl_ctx_get(); reverted: --- linux-raspi2-4.8.0/drivers/net/wireless/realtek/rtlwifi/usb.c +++ linux-raspi2-4.8.0.orig/drivers/net/wireless/realtek/rtlwifi/usb.c @@ -1073,7 +1073,6 @@ return -ENOMEM; } rtlpriv = hw->priv; - rtlpriv->hw = hw; rtlpriv->usb_data = kzalloc(RTL_USB_MAX_RX_COUNT * sizeof(u32), GFP_KERNEL); if (!rtlpriv->usb_data) reverted: --- linux-raspi2-4.8.0/drivers/pci/hotplug/pnv_php.c +++ linux-raspi2-4.8.0.orig/drivers/pci/hotplug/pnv_php.c @@ -42,7 +42,7 @@ static inline void pnv_php_put_slot(struct pnv_php_slot *php_slot) { + if (WARN_ON(!php_slot)) - if (!php_slot) return; kref_put(&php_slot->kref, pnv_php_free_slot); diff -u linux-raspi2-4.8.0/drivers/scsi/cxlflash/main.c linux-raspi2-4.8.0/drivers/scsi/cxlflash/main.c --- linux-raspi2-4.8.0/drivers/scsi/cxlflash/main.c +++ linux-raspi2-4.8.0/drivers/scsi/cxlflash/main.c @@ -1040,8 +1040,6 @@ do { msleep(delay_us / 1000); status = readq_be(&fc_regs[FC_MTIP_STATUS / 8]); - if (status == U64_MAX) - nretry /= 2; } while ((status & FC_MTIP_STATUS_MASK) != FC_MTIP_STATUS_ONLINE && nretry--); @@ -1073,8 +1071,6 @@ do { msleep(delay_us / 1000); status = readq_be(&fc_regs[FC_MTIP_STATUS / 8]); - if (status == U64_MAX) - nretry /= 2; } while ((status & FC_MTIP_STATUS_MASK) != FC_MTIP_STATUS_OFFLINE && nretry--); @@ -1185,7 +1181,7 @@ {SISL_ASTATUS_FC0_LOGI_F, "login failed", 0, CLR_FC_ERROR}, {SISL_ASTATUS_FC0_LOGI_S, "login succeeded", 0, SCAN_HOST}, {SISL_ASTATUS_FC0_LINK_DN, "link down", 0, 0}, - {SISL_ASTATUS_FC0_LINK_UP, "link up", 0, 0}, + {SISL_ASTATUS_FC0_LINK_UP, "link up", 0, SCAN_HOST}, {SISL_ASTATUS_FC1_OTHER, "other error", 1, CLR_FC_ERROR | LINK_RESET}, {SISL_ASTATUS_FC1_LOGO, "target initiated LOGO", 1, 0}, {SISL_ASTATUS_FC1_CRC_T, "CRC threshold exceeded", 1, LINK_RESET}, @@ -1193,7 +1189,7 @@ {SISL_ASTATUS_FC1_LOGI_F, "login failed", 1, CLR_FC_ERROR}, {SISL_ASTATUS_FC1_LOGI_S, "login succeeded", 1, SCAN_HOST}, {SISL_ASTATUS_FC1_LINK_DN, "link down", 1, 0}, - {SISL_ASTATUS_FC1_LINK_UP, "link up", 1, 0}, + {SISL_ASTATUS_FC1_LINK_UP, "link up", 1, SCAN_HOST}, {0x0, "", 0, 0} /* terminator */ }; @@ -2046,11 +2042,6 @@ * cxlflash_eh_host_reset_handler() - reset the host adapter * @scp: SCSI command from stack identifying host. * - * Following a reset, the state is evaluated again in case an EEH occurred - * during the reset. In such a scenario, the host reset will either yield - * until the EEH recovery is complete or return success or failure based - * upon the current device state. - * * Return: * SUCCESS as defined in scsi/scsi.h * FAILED as defined in scsi/scsi.h @@ -2083,8 +2074,7 @@ } else cfg->state = STATE_NORMAL; wake_up_all(&cfg->reset_waitq); - ssleep(1); - /* fall through */ + break; case STATE_RESET: wait_event(cfg->reset_waitq, cfg->state != STATE_RESET); if (cfg->state == STATE_NORMAL) @@ -2600,9 +2590,6 @@ * @pdev: PCI device struct. * @state: PCI channel state. * - * When an EEH occurs during an active reset, wait until the reset is - * complete and then take action based upon the device state. - * * Return: PCI_ERS_RESULT_NEED_RESET or PCI_ERS_RESULT_DISCONNECT */ static pci_ers_result_t cxlflash_pci_error_detected(struct pci_dev *pdev, @@ -2616,10 +2603,6 @@ switch (state) { case pci_channel_io_frozen: - wait_event(cfg->reset_waitq, cfg->state != STATE_RESET); - if (cfg->state == STATE_FAILTERM) - return PCI_ERS_RESULT_DISCONNECT; - cfg->state = STATE_RESET; scsi_block_requests(cfg->host); drain_ioctls(cfg); diff -u linux-raspi2-4.8.0/drivers/tty/serial/8250/8250_pci.c linux-raspi2-4.8.0/drivers/tty/serial/8250/8250_pci.c --- linux-raspi2-4.8.0/drivers/tty/serial/8250/8250_pci.c +++ linux-raspi2-4.8.0/drivers/tty/serial/8250/8250_pci.c @@ -5834,15 +5834,17 @@ static void serial8250_io_resume(struct pci_dev *dev) { struct serial_private *priv = pci_get_drvdata(dev); - struct serial_private *new; + const struct pciserial_board *board; if (!priv) return; - new = pciserial_init_ports(dev, priv->board); - if (!IS_ERR(new)) { - pci_set_drvdata(dev, new); - kfree(priv); + board = priv->board; + kfree(priv); + priv = pciserial_init_ports(dev, board); + + if (!IS_ERR(priv)) { + pci_set_drvdata(dev, priv); } } diff -u linux-raspi2-4.8.0/fs/btrfs/ioctl.c linux-raspi2-4.8.0/fs/btrfs/ioctl.c --- linux-raspi2-4.8.0/fs/btrfs/ioctl.c +++ linux-raspi2-4.8.0/fs/btrfs/ioctl.c @@ -5646,10 +5646,6 @@ #ifdef CONFIG_COMPAT long btrfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { - /* - * These all access 32-bit values anyway so no further - * handling is necessary. - */ switch (cmd) { case FS_IOC32_GETFLAGS: cmd = FS_IOC_GETFLAGS; @@ -5660,6 +5656,8 @@ case FS_IOC32_GETVERSION: cmd = FS_IOC_GETVERSION; break; + default: + return -ENOIOCTLCMD; } return btrfs_ioctl(file, cmd, (unsigned long) compat_ptr(arg)); reverted: --- linux-raspi2-4.8.0/include/linux/tracepoint-defs.h +++ linux-raspi2-4.8.0.orig/include/linux/tracepoint-defs.h @@ -29,7 +29,7 @@ struct tracepoint { const char *name; /* Tracepoint name */ struct static_key key; + void (*regfunc)(void); - int (*regfunc)(void); void (*unregfunc)(void); struct tracepoint_func __rcu *funcs; }; reverted: --- linux-raspi2-4.8.0/include/linux/tracepoint.h +++ linux-raspi2-4.8.0.orig/include/linux/tracepoint.h @@ -81,7 +81,7 @@ } #ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS +extern void syscall_regfunc(void); -extern int syscall_regfunc(void); extern void syscall_unregfunc(void); #endif /* CONFIG_HAVE_SYSCALL_TRACEPOINTS */ reverted: --- linux-raspi2-4.8.0/include/trace/events/i2c.h +++ linux-raspi2-4.8.0.orig/include/trace/events/i2c.h @@ -20,7 +20,7 @@ /* * drivers/i2c/i2c-core.c */ +extern void i2c_transfer_trace_reg(void); -extern int i2c_transfer_trace_reg(void); extern void i2c_transfer_trace_unreg(void); /* reverted: --- linux-raspi2-4.8.0/kernel/trace/trace_benchmark.c +++ linux-raspi2-4.8.0.orig/kernel/trace/trace_benchmark.c @@ -164,12 +164,11 @@ * When the benchmark tracepoint is enabled, it calls this * function and the thread that calls the tracepoint is created. */ +void trace_benchmark_reg(void) -int trace_benchmark_reg(void) { bm_event_thread = kthread_run(benchmark_event_kthread, NULL, "event_benchmark"); WARN_ON(!bm_event_thread); - return 0; } /* reverted: --- linux-raspi2-4.8.0/kernel/trace/trace_benchmark.h +++ linux-raspi2-4.8.0.orig/kernel/trace/trace_benchmark.h @@ -6,7 +6,7 @@ #include +extern void trace_benchmark_reg(void); -extern int trace_benchmark_reg(void); extern void trace_benchmark_unreg(void); #define BENCHMARK_EVENT_STRLEN 128 reverted: --- linux-raspi2-4.8.0/kernel/tracepoint.c +++ linux-raspi2-4.8.0.orig/kernel/tracepoint.c @@ -194,13 +194,9 @@ struct tracepoint_func *func, int prio) { struct tracepoint_func *old, *tp_funcs; - int ret; + if (tp->regfunc && !static_key_enabled(&tp->key)) + tp->regfunc(); - if (tp->regfunc && !static_key_enabled(&tp->key)) { - ret = tp->regfunc(); - if (ret < 0) - return ret; - } tp_funcs = rcu_dereference_protected(tp->funcs, lockdep_is_held(&tracepoints_mutex)); @@ -533,7 +529,7 @@ /* NB: reg/unreg are called while guarded with the tracepoints_mutex */ static int sys_tracepoint_refcount; +void syscall_regfunc(void) -int syscall_regfunc(void) { struct task_struct *p, *t; @@ -545,8 +541,6 @@ read_unlock(&tasklist_lock); } sys_tracepoint_refcount++; - - return 0; } void syscall_unregfunc(void) reverted: --- linux-raspi2-4.8.0/samples/trace_events/trace-events-sample.c +++ linux-raspi2-4.8.0.orig/samples/trace_events/trace-events-sample.c @@ -79,7 +79,7 @@ static DEFINE_MUTEX(thread_mutex); +void foo_bar_reg(void) -int foo_bar_reg(void) { pr_info("Starting thread for foo_bar_fn\n"); /* @@ -90,7 +90,6 @@ mutex_lock(&thread_mutex); simple_tsk_fn = kthread_run(simple_thread_fn, NULL, "event-sample-fn"); mutex_unlock(&thread_mutex); - return 0; } void foo_bar_unreg(void) reverted: --- linux-raspi2-4.8.0/samples/trace_events/trace-events-sample.h +++ linux-raspi2-4.8.0.orig/samples/trace_events/trace-events-sample.h @@ -354,7 +354,7 @@ TP_printk("foo %s %d", __get_str(foo), __entry->bar) ); +void foo_bar_reg(void); -int foo_bar_reg(void); void foo_bar_unreg(void); /* diff -u linux-raspi2-4.8.0/security/apparmor/af_unix.c linux-raspi2-4.8.0/security/apparmor/af_unix.c --- linux-raspi2-4.8.0/security/apparmor/af_unix.c +++ linux-raspi2-4.8.0/security/apparmor/af_unix.c @@ -515,7 +515,7 @@ addr, len, &aad(sa)->info); if (!peer_label) peer_label = peer_ctx->label; - return fn_for_each_in_ns(peer_label, peerp, + return fn_for_each(peer_label, peerp, match_label(profile, peerp, state, request, sa)); } diff -u linux-raspi2-4.8.0/security/apparmor/apparmorfs.c linux-raspi2-4.8.0/security/apparmor/apparmorfs.c --- linux-raspi2-4.8.0/security/apparmor/apparmorfs.c +++ linux-raspi2-4.8.0/security/apparmor/apparmorfs.c @@ -766,7 +766,7 @@ static int rawdata_release(struct inode *inode, struct file *file) { /* TODO: switch to loaddata when profile switched to symlink */ - aa_put_loaddata(file->private_data); + aa_put_proxy(file->private_data); return 0; } @@ -832,24 +832,22 @@ static ssize_t rawdata_read(struct file *file, char __user *buf, size_t size, loff_t *ppos) { - struct aa_loaddata *rawdata = file->private_data; + struct aa_proxy *proxy = file->private_data; + struct aa_label *label = aa_get_label_rcu(&proxy->label); + struct aa_profile *profile = labels_profile(label); + + ssize_t ret = simple_read_from_buffer(buf, size, ppos, profile->rawdata->data, profile->rawdata->size); + aa_put_label(label); - return simple_read_from_buffer(buf, size, ppos, rawdata->data, - rawdata->size); + return ret; } static int rawdata_open(struct inode *inode, struct file *file) { - struct aa_proxy *proxy = inode->i_private; - struct aa_label *label; - struct aa_profile *profile; - if (!policy_view_capable(NULL)) return -EACCES; - label = aa_get_label_rcu(&proxy->label); - profile = labels_profile(label); - file->private_data = aa_get_loaddata(profile->rawdata); - aa_put_label(label); + + file->private_data = aa_get_proxy(inode->i_private); return 0; } diff -u linux-raspi2-4.8.0/security/apparmor/domain.c linux-raspi2-4.8.0/security/apparmor/domain.c --- linux-raspi2-4.8.0/security/apparmor/domain.c +++ linux-raspi2-4.8.0/security/apparmor/domain.c @@ -496,7 +496,6 @@ const char *info = NULL, *name = NULL, *target = NULL; unsigned int state = profile->file.start; struct aa_perms perms = {}; - bool nonewprivs = false; int error = 0; AA_BUG(!profile); @@ -560,22 +559,6 @@ if (!new) goto audit; - /* Policy has specified a domain transitions. if no_new_privs and - * confined and not transitioning to the current domain fail. - * - * NOTE: Domain transitions from unconfined and to stritly stacked - * subsets are allowed even when no_new_privs is set because this - * aways results in a further reduction of permissions. - */ - if ((bprm->unsafe & LSM_UNSAFE_NO_NEW_PRIVS) && - !profile_unconfined(profile) && - !aa_label_is_subset(new, &profile->label)) { - error = -EPERM; - info = "no new privs"; - nonewprivs = true; - goto audit; - } - if (!(perms.xindex & AA_X_UNSAFE)) { if (DEBUG_ON) { dbg_printk("apparmor: scrubbing environment variables " @@ -589,10 +572,8 @@ audit: aa_audit_file(profile, &perms, OP_EXEC, MAY_EXEC, name, target, new, cond->uid, info, error); - if (!new || nonewprivs) { - aa_put_label(new); + if (!new) return ERR_PTR(error); - } return new; } @@ -650,21 +631,6 @@ if (error) goto audit; - /* Policy has specified a domain transitions. if no_new_privs and - * confined and not transitioning to the current domain fail. - * - * NOTE: Domain transitions from unconfined and to stritly stacked - * subsets are allowed even when no_new_privs is set because this - * aways results in a further reduction of permissions. - */ - if ((bprm->unsafe & LSM_UNSAFE_NO_NEW_PRIVS) && - !profile_unconfined(profile) && - !aa_label_is_subset(onexec, &profile->label)) { - error = -EPERM; - info = "no new privs"; - goto audit; - } - if (!(perms.xindex & AA_X_UNSAFE)) { if (DEBUG_ON) { dbg_printk("appaarmor: scrubbing environment " @@ -784,7 +750,19 @@ goto done; } - /* TODO: Add ns level no_new_privs subset test */ + /* Policy has specified a domain transitions. if no_new_privs and + * confined and not transitioning to the current domain fail. + * + * NOTE: Domain transitions from unconfined and to stritly stacked + * subsets are allowed even when no_new_privs is set because this + * aways results in a further reduction of permissions. + */ + if ((bprm->unsafe & LSM_UNSAFE_NO_NEW_PRIVS) && + !unconfined(label) && !aa_label_is_subset(new, label)) { + error = -EPERM; + info = "no new privs"; + goto audit; + } if (bprm->unsafe & LSM_UNSAFE_SHARE) { /* FIXME: currently don't mediate shared state */ @@ -1119,30 +1097,12 @@ struct aa_label *target, bool stack, u32 request, struct aa_perms *perms) { - const char *info = NULL; - int error = 0; - - /* - * Fail explicitly requested domain transitions when no_new_privs - * and not unconfined OR the transition results in a stack on - * the current label. - * Stacking domain transitions and transitions from unconfined are - * allowed even when no_new_privs is set because this aways results - * in a reduction of permissions. - */ - if (task_no_new_privs(current) && !stack && - !profile_unconfined(profile) && - !aa_label_is_subset(target, &profile->label)) { - info = "no new privs"; - error = -EPERM; - } - - if (!error) - error = change_profile_perms(profile, target, stack, request, - profile->file.start, perms); + int error = change_profile_perms(profile, target, + stack, request, + profile->file.start, perms); if (error) error = aa_audit_file(profile, perms, op, request, name, - NULL, target, GLOBAL_ROOT_UID, info, + NULL, target, GLOBAL_ROOT_UID, NULL, error); return error; @@ -1222,6 +1182,21 @@ goto check; } + /* + * Fail explicitly requested domain transitions when no_new_privs + * and not unconfined OR the transition results in a stack on + * the current label. + * Stacking domain transitions and transitions from unconfined are + * allowed even when no_new_privs is set because this aways results + * in a reduction of permissions. + */ + if (task_no_new_privs(current) && !stack && !unconfined(label) && + !aa_label_is_subset(target, label)) { + info = "no new privs"; + error = -EPERM; + goto audit; + } + /* self directed transitions only apply to current policy ns */ /* TODO: currently requiring perms for stacking and straight change * stacking doesn't strictly need this. Determine how much diff -u linux-raspi2-4.8.0/security/apparmor/file.c linux-raspi2-4.8.0/security/apparmor/file.c --- linux-raspi2-4.8.0/security/apparmor/file.c +++ linux-raspi2-4.8.0/security/apparmor/file.c @@ -374,7 +374,7 @@ struct path_cond *cond) { const char *lname, *tname = NULL; - struct aa_perms lperms = {}, perms; + struct aa_perms lperms, perms; const char *info = NULL; u32 request = AA_MAY_LINK; unsigned int state; @@ -536,23 +536,18 @@ error = fn_for_each_not_in_set(flabel, label, profile, profile_path_perm(op, profile, &file->f_path, buffer, request, &cond, flags, &perms)); - if (denied && !error) { + if (denied) { /* check every profile in file label that was not tested * in the initial check above. */ /* TODO: cache full perms so this only happens because of * conditionals */ /* TODO: don't audit here */ - if (label == flabel) - error = fn_for_each(label, profile, + last_error(error, + fn_for_each_not_in_set(label, flabel, profile, profile_path_perm(op, profile, &file->f_path, buffer, request, &cond, flags, - &perms)); - else - error = fn_for_each_not_in_set(label, flabel, profile, - profile_path_perm(op, profile, &file->f_path, - buffer, request, &cond, flags, - &perms)); + &perms))); } if (!error) update_file_ctx(file_ctx(file), label, request); diff -u linux-raspi2-4.8.0/security/apparmor/label.c linux-raspi2-4.8.0/security/apparmor/label.c --- linux-raspi2-4.8.0/security/apparmor/label.c +++ linux-raspi2-4.8.0/security/apparmor/label.c @@ -308,8 +308,6 @@ static void label_destroy(struct aa_label *label) { - struct aa_label *tmp; - AA_BUG(!label); if (label_is_stale(label)) @@ -331,11 +329,6 @@ rcu_assign_pointer(label->proxy->label, NULL); aa_free_sid(label->sid); - - tmp = rcu_dereference_protected(label->proxy->label, true); - if (tmp == label) - rcu_assign_pointer(label->proxy->label, NULL); - aa_put_proxy(label->proxy); label->proxy = (struct aa_proxy *) PROXY_POISON + 1; } @@ -387,15 +380,6 @@ call_rcu(&label->rcu, label_free_rcu); } -static void label_free_or_put_new(struct aa_label *label, struct aa_label *new) -{ - if (label != new) - /* need to free directly to break circular ref with proxy */ - aa_label_free(new); - else - aa_put_label(new); -} - bool aa_label_init(struct aa_label *label, int size) { AA_BUG(!label); @@ -858,7 +842,7 @@ write_lock_irqsave(&ls->lock, flags); label = __label_insert(ls, new, false); write_unlock_irqrestore(&ls->lock, flags); - label_free_or_put_new(label, new); + aa_put_label(new); return label; } @@ -1099,6 +1083,7 @@ /* TODO: deal with reference labels */ if (new->size == 1) { label = aa_get_label(&new->vec[0]->label); + aa_put_label(new); return label; } } else if (!stale) { @@ -1257,7 +1242,7 @@ goto out; label = label_merge_insert(new, a, b); - label_free_or_put_new(label, new); + aa_put_label(new); out: aa_put_label(a); aa_put_label(b); @@ -2058,7 +2043,8 @@ /* ensure label is removed, and redirected correctly */ __label_remove(label, tmp); write_unlock_irqrestore(&ls->lock, flags); - label_free_or_put_new(tmp, new); + + aa_put_label(new); return tmp; } diff -u linux-raspi2-4.8.0/security/apparmor/lsm.c linux-raspi2-4.8.0/security/apparmor/lsm.c --- linux-raspi2-4.8.0/security/apparmor/lsm.c +++ linux-raspi2-4.8.0/security/apparmor/lsm.c @@ -443,9 +443,6 @@ struct aa_label *label; int error = 0; - if (file->f_path.dentry == aa_null.dentry) - return -EACCES; - label = aa_begin_current_label(NO_UPDATE); error = aa_file_perm(op, label, file, mask); aa_end_current_label(label); diff -u linux-raspi2-4.8.0/security/apparmor/mount.c linux-raspi2-4.8.0/security/apparmor/mount.c --- linux-raspi2-4.8.0/security/apparmor/mount.c +++ linux-raspi2-4.8.0/security/apparmor/mount.c @@ -335,7 +335,6 @@ goto audit; if (IS_ERR(devname)) { error = PTR_ERR(devname); - devname = NULL; info = devinfo; goto audit; } diff -u linux-raspi2-4.8.0/security/apparmor/policy.c linux-raspi2-4.8.0/security/apparmor/policy.c --- linux-raspi2-4.8.0/security/apparmor/policy.c +++ linux-raspi2-4.8.0/security/apparmor/policy.c @@ -350,7 +350,6 @@ profile->label.flags |= FLAG_NULL; if (hat) profile->label.flags |= FLAG_HAT; - profile->path_flags = parent->path_flags; /* released on free_profile */ rcu_assign_pointer(profile->parent, aa_get_profile(parent)); @@ -1105,13 +1104,11 @@ /* don't fail removal if audit fails */ (void) audit_policy(label, OP_PROF_RM, ns_name, name, info, error); - aa_put_ns(ns); aa_put_profile(profile); return size; fail_ns_lock: mutex_unlock(&ns->lock); - aa_put_ns(ns); fail: (void) audit_policy(label, OP_PROF_RM, ns_name, name, info, error); diff -u linux-raspi2-4.8.0/tools/hv/hv_vss_daemon.c linux-raspi2-4.8.0/tools/hv/hv_vss_daemon.c --- linux-raspi2-4.8.0/tools/hv/hv_vss_daemon.c +++ linux-raspi2-4.8.0/tools/hv/hv_vss_daemon.c @@ -261,9 +261,7 @@ if (len != sizeof(struct hv_vss_msg)) { syslog(LOG_ERR, "write failed; error: %d %s", errno, strerror(errno)); - - if (op == VSS_OP_FREEZE) - vss_operate(VSS_OP_THAW); + exit(EXIT_FAILURE); } } diff -u linux-raspi2-4.8.0/zfs/META linux-raspi2-4.8.0/zfs/META --- linux-raspi2-4.8.0/zfs/META +++ linux-raspi2-4.8.0/zfs/META @@ -2,7 +2,7 @@ Name: zfs Branch: 1.0 Version: 0.6.5.8 -Release: 0ubuntu4.2 +Release: 0ubuntu4.1 Release-Tags: relext License: CDDL Author: OpenZFS on Linux diff -u linux-raspi2-4.8.0/zfs/config/kernel-vfs-rw-iterate.m4 linux-raspi2-4.8.0/zfs/config/kernel-vfs-rw-iterate.m4 --- linux-raspi2-4.8.0/zfs/config/kernel-vfs-rw-iterate.m4 +++ linux-raspi2-4.8.0/zfs/config/kernel-vfs-rw-iterate.m4 @@ -28,21 +27,0 @@ - -dnl # -dnl # Linux 4.1.x API -dnl # -AC_DEFUN([ZFS_AC_KERNEL_GENERIC_WRITE_CHECKS], - [AC_MSG_CHECKING([whether generic_write_checks() takes kiocb]) - ZFS_LINUX_TRY_COMPILE([ - #include - - ],[ - struct kiocb *iocb = NULL; - struct iov_iter *iov = NULL; - generic_write_checks(iocb, iov); - ],[ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_GENERIC_WRITE_CHECKS_KIOCB, 1, - [generic_write_checks() takes kiocb]) - ],[ - AC_MSG_RESULT(no) - ]) -]) diff -u linux-raspi2-4.8.0/zfs/config/kernel.m4 linux-raspi2-4.8.0/zfs/config/kernel.m4 --- linux-raspi2-4.8.0/zfs/config/kernel.m4 +++ linux-raspi2-4.8.0/zfs/config/kernel.m4 @@ -94,7 +94,6 @@ ZFS_AC_KERNEL_LSEEK_EXECUTE ZFS_AC_KERNEL_VFS_ITERATE ZFS_AC_KERNEL_VFS_RW_ITERATE - ZFS_AC_KERNEL_GENERIC_WRITE_CHECKS ZFS_AC_KERNEL_KMAP_ATOMIC_ARGS ZFS_AC_KERNEL_FOLLOW_DOWN_ONE ZFS_AC_KERNEL_MAKE_REQUEST_FN diff -u linux-raspi2-4.8.0/zfs/configure linux-raspi2-4.8.0/zfs/configure --- linux-raspi2-4.8.0/zfs/configure +++ linux-raspi2-4.8.0/zfs/configure @@ -23082,73 +23082,6 @@ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether generic_write_checks() takes kiocb" >&5 -$as_echo_n "checking whether generic_write_checks() takes kiocb... " >&6; } - - -cat confdefs.h - <<_ACEOF >conftest.c - - - #include - - -int -main (void) -{ - - struct kiocb *iocb = NULL; - struct iov_iter *iov = NULL; - generic_write_checks(iocb, iov); - - ; - return 0; -} - -_ACEOF - - - -cat - <<_ACEOF >conftest.h - -_ACEOF - - - rm -Rf build && mkdir -p build && touch build/conftest.mod.c - echo "obj-m := conftest.o" >build/Makefile - modpost_flag='' - test "x$enable_linux_builtin" = xyes && modpost_flag='modpost=true' # fake modpost stage - if { ac_try='cp conftest.c conftest.h build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build $modpost_flag' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; } >/dev/null && { ac_try='test -s build/conftest.o' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -$as_echo "#define HAVE_GENERIC_WRITE_CHECKS_KIOCB 1" >>confdefs.h - - -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - - - -fi - rm -Rf build - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether kmap_atomic wants 1 args" >&5 $as_echo_n "checking whether kmap_atomic wants 1 args... " >&6; } @@ -33137,73 +33070,6 @@ else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - - - -fi - rm -Rf build - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether generic_write_checks() takes kiocb" >&5 -$as_echo_n "checking whether generic_write_checks() takes kiocb... " >&6; } - - -cat confdefs.h - <<_ACEOF >conftest.c - - - #include - - -int -main (void) -{ - - struct kiocb *iocb = NULL; - struct iov_iter *iov = NULL; - generic_write_checks(iocb, iov); - - ; - return 0; -} - -_ACEOF - - - -cat - <<_ACEOF >conftest.h - -_ACEOF - - - rm -Rf build && mkdir -p build && touch build/conftest.mod.c - echo "obj-m := conftest.o" >build/Makefile - modpost_flag='' - test "x$enable_linux_builtin" = xyes && modpost_flag='modpost=true' # fake modpost stage - if { ac_try='cp conftest.c conftest.h build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build $modpost_flag' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; } >/dev/null && { ac_try='test -s build/conftest.o' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -$as_echo "#define HAVE_GENERIC_WRITE_CHECKS_KIOCB 1" >>confdefs.h - - -else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 diff -u linux-raspi2-4.8.0/zfs/module/zfs/zpl_file.c linux-raspi2-4.8.0/zfs/module/zfs/zpl_file.c --- linux-raspi2-4.8.0/zfs/module/zfs/zpl_file.c +++ linux-raspi2-4.8.0/zfs/module/zfs/zpl_file.c @@ -251,6 +251,20 @@ } static ssize_t +zpl_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos) +{ + cred_t *cr = CRED(); + ssize_t read; + + crhold(cr); + read = zpl_read_common(filp->f_mapping->host, buf, len, ppos, + UIO_USERSPACE, filp->f_flags, cr); + crfree(cr); + + return (read); +} + +static ssize_t zpl_iter_read_common(struct kiocb *kiocb, const struct iovec *iovp, unsigned long nr_segs, size_t count, uio_seg_t seg, size_t skip) { @@ -287,7 +301,7 @@ zpl_aio_read(struct kiocb *kiocb, const struct iovec *iovp, unsigned long nr_segs, loff_t pos) { - return (zpl_iter_read_common(kiocb, iovp, nr_segs, count, + return (zpl_iter_read_common(kiocb, iovp, nr_segs, kiocb->ki_nbytes, UIO_USERSPACE, 0)); } #endif /* HAVE_VFS_RW_ITERATE */ @@ -339,6 +353,20 @@ } static ssize_t +zpl_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos) +{ + cred_t *cr = CRED(); + ssize_t wrote; + + crhold(cr); + wrote = zpl_write_common(filp->f_mapping->host, buf, len, ppos, + UIO_USERSPACE, filp->f_flags, cr); + crfree(cr); + + return (wrote); +} + +static ssize_t zpl_iter_write_common(struct kiocb *kiocb, const struct iovec *iovp, unsigned long nr_segs, size_t count, uio_seg_t seg, size_t skip) { @@ -358,40 +386,16 @@ static ssize_t zpl_iter_write(struct kiocb *kiocb, struct iov_iter *from) { - size_t count; ssize_t ret; uio_seg_t seg = UIO_USERSPACE; - -#ifndef HAVE_GENERIC_WRITE_CHECKS_KIOCB - struct file *file = kiocb->ki_filp; - struct address_space *mapping = file->f_mapping; - struct inode *ip = mapping->host; - int isblk = S_ISBLK(ip->i_mode); - - count = iov_iter_count(from); - ret = generic_write_checks(file, &kiocb->ki_pos, &count, isblk); -#else - /* - * XXX - ideally this check should be in the same lock region with - * write operations, so that there's no TOCTTOU race when doing - * append and someone else grow the file. - */ - ret = generic_write_checks(kiocb, from); - count = ret; -#endif - if (ret <= 0) - return (ret); - if (from->type & ITER_KVEC) seg = UIO_SYSSPACE; if (from->type & ITER_BVEC) seg = UIO_BVEC; - ret = zpl_iter_write_common(kiocb, from->iov, from->nr_segs, - count, seg, from->iov_offset); + iov_iter_count(from), seg, from->iov_offset); if (ret > 0) iov_iter_advance(from, ret); - return (ret); } #else @@ -399,22 +403,7 @@ zpl_aio_write(struct kiocb *kiocb, const struct iovec *iovp, unsigned long nr_segs, loff_t pos) { - struct file *file = kiocb->ki_filp; - struct address_space *mapping = file->f_mapping; - struct inode *ip = mapping->host; - int isblk = S_ISBLK(ip->i_mode); - size_t count; - ssize_t ret; - - ret = generic_segment_checks(iovp, &nr_segs, &count, VERIFY_READ); - if (ret) - return (ret); - - ret = generic_write_checks(file, &pos, &count, isblk); - if (ret) - return (ret); - - return (zpl_iter_write_common(kiocb, iovp, nr_segs, count, + return (zpl_iter_write_common(kiocb, iovp, nr_segs, kiocb->ki_nbytes, UIO_USERSPACE, 0)); } #endif /* HAVE_VFS_RW_ITERATE */ @@ -838,6 +827,8 @@ .open = zpl_open, .release = zpl_release, .llseek = zpl_llseek, + .read = zpl_read, + .write = zpl_write, #ifdef HAVE_VFS_RW_ITERATE .read_iter = zpl_iter_read, .write_iter = zpl_iter_write, diff -u linux-raspi2-4.8.0/zfs/zfs_config.h.in linux-raspi2-4.8.0/zfs/zfs_config.h.in --- linux-raspi2-4.8.0/zfs/zfs_config.h.in +++ linux-raspi2-4.8.0/zfs/zfs_config.h.in @@ -183,9 +183,6 @@ /* generic_start_io_acct()/generic_end_io_acct() avaliable */ #undef HAVE_GENERIC_IO_ACCT -/* generic_write_checks() takes kiocb */ -#undef HAVE_GENERIC_WRITE_CHECKS_KIOCB - /* iops->get_acl() exists */ #undef HAVE_GET_ACL