* [PATCH V5 3/3] powerpc/mm: Switch to generic RCU get_user_pages_fast
From: Aneesh Kumar K.V @ 2014-11-05 16:27 UTC (permalink / raw)
To: akpm, Steve Capper, Andrea Arcangeli, benh, mpe, David Miller
Cc: linux-arch, linux-mm, linuxppc-dev, linux-kernel,
Aneesh Kumar K.V
In-Reply-To: <1415204861-22016-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>
This patch switch the ppc arch to use the generic RCU based
gup implementation.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
arch/powerpc/Kconfig | 1 +
arch/powerpc/include/asm/hugetlb.h | 8 +-
arch/powerpc/include/asm/page.h | 3 +-
arch/powerpc/include/asm/pgtable-ppc64.h | 1 -
arch/powerpc/include/asm/pgtable.h | 6 +-
arch/powerpc/mm/Makefile | 2 +-
arch/powerpc/mm/gup.c | 235 -------------------------------
arch/powerpc/mm/hugetlbpage.c | 33 ++---
8 files changed, 22 insertions(+), 267 deletions(-)
delete mode 100644 arch/powerpc/mm/gup.c
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 88eace4e28c3..7af887dc6aed 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -148,6 +148,7 @@ config PPC
select HAVE_ARCH_AUDITSYSCALL
select ARCH_SUPPORTS_ATOMIC_RMW
select DCACHE_WORD_ACCESS if PPC64 && CPU_LITTLE_ENDIAN
+ select HAVE_GENERIC_RCU_GUP
config GENERIC_CSUM
def_bool CPU_LITTLE_ENDIAN
diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h
index 766b77d527ac..1d53a65b4ec1 100644
--- a/arch/powerpc/include/asm/hugetlb.h
+++ b/arch/powerpc/include/asm/hugetlb.h
@@ -48,7 +48,7 @@ static inline unsigned int hugepd_shift(hugepd_t hpd)
#endif /* CONFIG_PPC_BOOK3S_64 */
-static inline pte_t *hugepte_offset(hugepd_t *hpdp, unsigned long addr,
+static inline pte_t *hugepte_offset(hugepd_t hpd, unsigned long addr,
unsigned pdshift)
{
/*
@@ -58,9 +58,9 @@ static inline pte_t *hugepte_offset(hugepd_t *hpdp, unsigned long addr,
*/
unsigned long idx = 0;
- pte_t *dir = hugepd_page(*hpdp);
+ pte_t *dir = hugepd_page(hpd);
#ifndef CONFIG_PPC_FSL_BOOK3E
- idx = (addr & ((1UL << pdshift) - 1)) >> hugepd_shift(*hpdp);
+ idx = (addr & ((1UL << pdshift) - 1)) >> hugepd_shift(hpd);
#endif
return dir + idx;
@@ -193,7 +193,7 @@ static inline void flush_hugetlb_page(struct vm_area_struct *vma,
}
#define hugepd_shift(x) 0
-static inline pte_t *hugepte_offset(hugepd_t *hpdp, unsigned long addr,
+static inline pte_t *hugepte_offset(hugepd_t hpd, unsigned long addr,
unsigned pdshift)
{
return 0;
diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h
index f973fce73a43..69c059887a2c 100644
--- a/arch/powerpc/include/asm/page.h
+++ b/arch/powerpc/include/asm/page.h
@@ -379,13 +379,14 @@ static inline int hugepd_ok(hugepd_t hpd)
}
#endif
-#define is_hugepd(pdep) (hugepd_ok(*((hugepd_t *)(pdep))))
+#define is_hugepd(hpd) (hugepd_ok(hpd))
#define pgd_huge pgd_huge
int pgd_huge(pgd_t pgd);
#else /* CONFIG_HUGETLB_PAGE */
#define is_hugepd(pdep) 0
#define pgd_huge(pgd) 0
#endif /* CONFIG_HUGETLB_PAGE */
+#define __hugepd(x) ((hugepd_t) { (x) })
struct page;
extern void clear_user_page(void *page, unsigned long vaddr, struct page *pg);
diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h
index d12092420560..5600e434332f 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64.h
@@ -600,6 +600,5 @@ static inline int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl,
*/
return true;
}
-
#endif /* __ASSEMBLY__ */
#endif /* _ASM_POWERPC_PGTABLE_PPC64_H_ */
diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h
index 316f9a5da173..a8805fee0df9 100644
--- a/arch/powerpc/include/asm/pgtable.h
+++ b/arch/powerpc/include/asm/pgtable.h
@@ -274,11 +274,9 @@ extern void paging_init(void);
*/
extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *);
-extern int gup_hugepd(hugepd_t *hugepd, unsigned pdshift, unsigned long addr,
- unsigned long end, int write, struct page **pages, int *nr);
-
extern int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr,
- unsigned long end, int write, struct page **pages, int *nr);
+ unsigned long end, int write,
+ struct page **pages, int *nr);
#ifndef CONFIG_TRANSPARENT_HUGEPAGE
#define pmd_large(pmd) 0
#define has_transparent_hugepage() 0
diff --git a/arch/powerpc/mm/Makefile b/arch/powerpc/mm/Makefile
index 325e861616a1..438dcd3fd0d1 100644
--- a/arch/powerpc/mm/Makefile
+++ b/arch/powerpc/mm/Makefile
@@ -6,7 +6,7 @@ subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
ccflags-$(CONFIG_PPC64) := $(NO_MINIMAL_TOC)
-obj-y := fault.o mem.o pgtable.o gup.o mmap.o \
+obj-y := fault.o mem.o pgtable.o mmap.o \
init_$(CONFIG_WORD_SIZE).o \
pgtable_$(CONFIG_WORD_SIZE).o
obj-$(CONFIG_PPC_MMU_NOHASH) += mmu_context_nohash.o tlb_nohash.o \
diff --git a/arch/powerpc/mm/gup.c b/arch/powerpc/mm/gup.c
deleted file mode 100644
index d8746684f606..000000000000
--- a/arch/powerpc/mm/gup.c
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * Lockless get_user_pages_fast for powerpc
- *
- * Copyright (C) 2008 Nick Piggin
- * Copyright (C) 2008 Novell Inc.
- */
-#undef DEBUG
-
-#include <linux/sched.h>
-#include <linux/mm.h>
-#include <linux/hugetlb.h>
-#include <linux/vmstat.h>
-#include <linux/pagemap.h>
-#include <linux/rwsem.h>
-#include <asm/pgtable.h>
-
-#ifdef __HAVE_ARCH_PTE_SPECIAL
-
-/*
- * The performance critical leaf functions are made noinline otherwise gcc
- * inlines everything into a single function which results in too much
- * register pressure.
- */
-static noinline int gup_pte_range(pmd_t pmd, unsigned long addr,
- unsigned long end, int write, struct page **pages, int *nr)
-{
- unsigned long mask, result;
- pte_t *ptep;
-
- result = _PAGE_PRESENT|_PAGE_USER;
- if (write)
- result |= _PAGE_RW;
- mask = result | _PAGE_SPECIAL;
-
- ptep = pte_offset_kernel(&pmd, addr);
- do {
- pte_t pte = ACCESS_ONCE(*ptep);
- struct page *page;
- /*
- * Similar to the PMD case, NUMA hinting must take slow path
- */
- if (pte_numa(pte))
- return 0;
-
- if ((pte_val(pte) & mask) != result)
- return 0;
- VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
- page = pte_page(pte);
- if (!page_cache_get_speculative(page))
- return 0;
- if (unlikely(pte_val(pte) != pte_val(*ptep))) {
- put_page(page);
- return 0;
- }
- pages[*nr] = page;
- (*nr)++;
-
- } while (ptep++, addr += PAGE_SIZE, addr != end);
-
- return 1;
-}
-
-static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end,
- int write, struct page **pages, int *nr)
-{
- unsigned long next;
- pmd_t *pmdp;
-
- pmdp = pmd_offset(&pud, addr);
- do {
- pmd_t pmd = ACCESS_ONCE(*pmdp);
-
- next = pmd_addr_end(addr, end);
- /*
- * If we find a splitting transparent hugepage we
- * return zero. That will result in taking the slow
- * path which will call wait_split_huge_page()
- * if the pmd is still in splitting state
- */
- if (pmd_none(pmd) || pmd_trans_splitting(pmd))
- return 0;
- if (pmd_huge(pmd) || pmd_large(pmd)) {
- /*
- * NUMA hinting faults need to be handled in the GUP
- * slowpath for accounting purposes and so that they
- * can be serialised against THP migration.
- */
- if (pmd_numa(pmd))
- return 0;
-
- if (!gup_hugepte((pte_t *)pmdp, PMD_SIZE, addr, next,
- write, pages, nr))
- return 0;
- } else if (is_hugepd(pmdp)) {
- if (!gup_hugepd((hugepd_t *)pmdp, PMD_SHIFT,
- addr, next, write, pages, nr))
- return 0;
- } else if (!gup_pte_range(pmd, addr, next, write, pages, nr))
- return 0;
- } while (pmdp++, addr = next, addr != end);
-
- return 1;
-}
-
-static int gup_pud_range(pgd_t pgd, unsigned long addr, unsigned long end,
- int write, struct page **pages, int *nr)
-{
- unsigned long next;
- pud_t *pudp;
-
- pudp = pud_offset(&pgd, addr);
- do {
- pud_t pud = ACCESS_ONCE(*pudp);
-
- next = pud_addr_end(addr, end);
- if (pud_none(pud))
- return 0;
- if (pud_huge(pud)) {
- if (!gup_hugepte((pte_t *)pudp, PUD_SIZE, addr, next,
- write, pages, nr))
- return 0;
- } else if (is_hugepd(pudp)) {
- if (!gup_hugepd((hugepd_t *)pudp, PUD_SHIFT,
- addr, next, write, pages, nr))
- return 0;
- } else if (!gup_pmd_range(pud, addr, next, write, pages, nr))
- return 0;
- } while (pudp++, addr = next, addr != end);
-
- return 1;
-}
-
-int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
- struct page **pages)
-{
- struct mm_struct *mm = current->mm;
- unsigned long addr, len, end;
- unsigned long next;
- unsigned long flags;
- pgd_t *pgdp;
- int nr = 0;
-
- pr_devel("%s(%lx,%x,%s)\n", __func__, start, nr_pages, write ? "write" : "read");
-
- start &= PAGE_MASK;
- addr = start;
- len = (unsigned long) nr_pages << PAGE_SHIFT;
- end = start + len;
-
- if (unlikely(!access_ok(write ? VERIFY_WRITE : VERIFY_READ,
- start, len)))
- return 0;
-
- pr_devel(" aligned: %lx .. %lx\n", start, end);
-
- /*
- * XXX: batch / limit 'nr', to avoid large irq off latency
- * needs some instrumenting to determine the common sizes used by
- * important workloads (eg. DB2), and whether limiting the batch size
- * will decrease performance.
- *
- * It seems like we're in the clear for the moment. Direct-IO is
- * the main guy that batches up lots of get_user_pages, and even
- * they are limited to 64-at-a-time which is not so many.
- */
- /*
- * This doesn't prevent pagetable teardown, but does prevent
- * the pagetables from being freed on powerpc.
- *
- * So long as we atomically load page table pointers versus teardown,
- * we can follow the address down to the the page and take a ref on it.
- */
- local_irq_save(flags);
-
- pgdp = pgd_offset(mm, addr);
- do {
- pgd_t pgd = ACCESS_ONCE(*pgdp);
-
- pr_devel(" %016lx: normal pgd %p\n", addr,
- (void *)pgd_val(pgd));
- next = pgd_addr_end(addr, end);
- if (pgd_none(pgd))
- break;
- if (pgd_huge(pgd)) {
- if (!gup_hugepte((pte_t *)pgdp, PGDIR_SIZE, addr, next,
- write, pages, &nr))
- break;
- } else if (is_hugepd(pgdp)) {
- if (!gup_hugepd((hugepd_t *)pgdp, PGDIR_SHIFT,
- addr, next, write, pages, &nr))
- break;
- } else if (!gup_pud_range(pgd, addr, next, write, pages, &nr))
- break;
- } while (pgdp++, addr = next, addr != end);
-
- local_irq_restore(flags);
-
- return nr;
-}
-
-int get_user_pages_fast(unsigned long start, int nr_pages, int write,
- struct page **pages)
-{
- struct mm_struct *mm = current->mm;
- int nr, ret;
-
- start &= PAGE_MASK;
- nr = __get_user_pages_fast(start, nr_pages, write, pages);
- ret = nr;
-
- if (nr < nr_pages) {
- pr_devel(" slow path ! nr = %d\n", nr);
-
- /* Try to get the remaining pages with get_user_pages */
- start += nr << PAGE_SHIFT;
- pages += nr;
-
- down_read(&mm->mmap_sem);
- ret = get_user_pages(current, mm, start,
- nr_pages - nr, write, 0, pages, NULL);
- up_read(&mm->mmap_sem);
-
- /* Have to be a bit careful with return values */
- if (nr > 0) {
- if (ret < 0)
- ret = nr;
- else
- ret += nr;
- }
- }
-
- return ret;
-}
-
-#endif /* __HAVE_ARCH_PTE_SPECIAL */
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index 2e35b9a82929..d54d74ccdc5a 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -233,7 +233,7 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr, unsigned long sz
if (hugepd_none(*hpdp) && __hugepte_alloc(mm, hpdp, addr, pdshift, pshift))
return NULL;
- return hugepte_offset(hpdp, addr, pdshift);
+ return hugepte_offset(*hpdp, addr, pdshift);
}
#else
@@ -273,7 +273,7 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr, unsigned long sz
if (hugepd_none(*hpdp) && __hugepte_alloc(mm, hpdp, addr, pdshift, pshift))
return NULL;
- return hugepte_offset(hpdp, addr, pdshift);
+ return hugepte_offset(*hpdp, addr, pdshift);
}
#endif
@@ -541,7 +541,7 @@ static void hugetlb_free_pmd_range(struct mmu_gather *tlb, pud_t *pud,
do {
pmd = pmd_offset(pud, addr);
next = pmd_addr_end(addr, end);
- if (!is_hugepd(pmd)) {
+ if (!is_hugepd(__hugepd(pmd_val(*pmd)))) {
/*
* if it is not hugepd pointer, we should already find
* it cleared.
@@ -590,7 +590,7 @@ static void hugetlb_free_pud_range(struct mmu_gather *tlb, pgd_t *pgd,
do {
pud = pud_offset(pgd, addr);
next = pud_addr_end(addr, end);
- if (!is_hugepd(pud)) {
+ if (!is_hugepd(__hugepd(pud_val(*pud)))) {
if (pud_none_or_clear_bad(pud))
continue;
hugetlb_free_pmd_range(tlb, pud, addr, next, floor,
@@ -656,7 +656,7 @@ void hugetlb_free_pgd_range(struct mmu_gather *tlb,
do {
next = pgd_addr_end(addr, end);
pgd = pgd_offset(tlb->mm, addr);
- if (!is_hugepd(pgd)) {
+ if (!is_hugepd(__hugepd(pgd_val(*pgd)))) {
if (pgd_none_or_clear_bad(pgd))
continue;
hugetlb_free_pud_range(tlb, pgd, addr, next, floor, ceiling);
@@ -716,12 +716,11 @@ static unsigned long hugepte_addr_end(unsigned long addr, unsigned long end,
return (__boundary - 1 < end - 1) ? __boundary : end;
}
-int gup_hugepd(hugepd_t *hugepd, unsigned pdshift,
- unsigned long addr, unsigned long end,
- int write, struct page **pages, int *nr)
+int gup_huge_pd(hugepd_t hugepd, unsigned long addr, unsigned pdshift,
+ unsigned long end, int write, struct page **pages, int *nr)
{
pte_t *ptep;
- unsigned long sz = 1UL << hugepd_shift(*hugepd);
+ unsigned long sz = 1UL << hugepd_shift(hugepd);
unsigned long next;
ptep = hugepte_offset(hugepd, addr, pdshift);
@@ -964,7 +963,7 @@ pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea, unsigned *shift
else if (pgd_huge(pgd)) {
ret_pte = (pte_t *) pgdp;
goto out;
- } else if (is_hugepd(&pgd))
+ } else if (is_hugepd(__hugepd(pgd_val(pgd))))
hpdp = (hugepd_t *)&pgd;
else {
/*
@@ -981,7 +980,7 @@ pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea, unsigned *shift
else if (pud_huge(pud)) {
ret_pte = (pte_t *) pudp;
goto out;
- } else if (is_hugepd(&pud))
+ } else if (is_hugepd(__hugepd(pud_val(pud))))
hpdp = (hugepd_t *)&pud;
else {
pdshift = PMD_SHIFT;
@@ -1002,7 +1001,7 @@ pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea, unsigned *shift
if (pmd_huge(pmd) || pmd_large(pmd)) {
ret_pte = (pte_t *) pmdp;
goto out;
- } else if (is_hugepd(&pmd))
+ } else if (is_hugepd(__hugepd(pmd_val(pmd))))
hpdp = (hugepd_t *)&pmd;
else
return pte_offset_kernel(&pmd, ea);
@@ -1011,7 +1010,7 @@ pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea, unsigned *shift
if (!hpdp)
return NULL;
- ret_pte = hugepte_offset(hpdp, ea, pdshift);
+ ret_pte = hugepte_offset(*hpdp, ea, pdshift);
pdshift = hugepd_shift(*hpdp);
out:
if (shift)
@@ -1041,14 +1040,6 @@ int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr,
if ((pte_val(pte) & mask) != mask)
return 0;
-#ifdef CONFIG_TRANSPARENT_HUGEPAGE
- /*
- * check for splitting here
- */
- if (pmd_trans_splitting(pte_pmd(pte)))
- return 0;
-#endif
-
/* hugepages are never "special" */
VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
--
2.1.0
^ permalink raw reply related
* [PATCH V5 1/3] powerpc/mm: Add missing pmd accessors
From: Aneesh Kumar K.V @ 2014-11-05 16:27 UTC (permalink / raw)
To: akpm, Steve Capper, Andrea Arcangeli, benh, mpe, David Miller
Cc: linux-arch, linux-mm, linuxppc-dev, linux-kernel,
Aneesh Kumar K.V
This patch add documentation and missing accessors.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/pgtable-ppc64-4k.h | 16 ++++++++-
arch/powerpc/include/asm/pgtable-ppc64-64k.h | 3 ++
arch/powerpc/include/asm/pgtable-ppc64.h | 51 +++++++++++++++++++++-------
arch/powerpc/mm/hugetlbpage.c | 3 ++
arch/powerpc/mm/pgtable_64.c | 22 ++++++++++--
5 files changed, 78 insertions(+), 17 deletions(-)
diff --git a/arch/powerpc/include/asm/pgtable-ppc64-4k.h b/arch/powerpc/include/asm/pgtable-ppc64-4k.h
index 7b935683f268..132ee1d482c2 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64-4k.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64-4k.h
@@ -57,7 +57,21 @@
#define pgd_present(pgd) (pgd_val(pgd) != 0)
#define pgd_clear(pgdp) (pgd_val(*(pgdp)) = 0)
#define pgd_page_vaddr(pgd) (pgd_val(pgd) & ~PGD_MASKED_BITS)
-#define pgd_page(pgd) virt_to_page(pgd_page_vaddr(pgd))
+
+#ifndef __ASSEMBLY__
+
+static inline pte_t pgd_pte(pgd_t pgd)
+{
+ return __pte(pgd_val(pgd));
+}
+
+static inline pgd_t pte_pgd(pte_t pte)
+{
+ return __pgd(pte_val(pte));
+}
+extern struct page *pgd_page(pgd_t pgd);
+
+#endif /* !__ASSEMBLY__ */
#define pud_offset(pgdp, addr) \
(((pud_t *) pgd_page_vaddr(*(pgdp))) + \
diff --git a/arch/powerpc/include/asm/pgtable-ppc64-64k.h b/arch/powerpc/include/asm/pgtable-ppc64-64k.h
index a56b82fb0609..1de35bbd02a6 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64-64k.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64-64k.h
@@ -38,4 +38,7 @@
/* Bits to mask out from a PGD/PUD to get to the PMD page */
#define PUD_MASKED_BITS 0x1ff
+#define pgd_pte(pgd) (pud_pte(((pud_t){ pgd })))
+#define pte_pgd(pte) ((pgd_t)pte_pud(pte))
+
#endif /* _ASM_POWERPC_PGTABLE_PPC64_64K_H */
diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h
index ae153c40ab7c..d12092420560 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64.h
@@ -152,7 +152,7 @@
#define pmd_none(pmd) (!pmd_val(pmd))
#define pmd_bad(pmd) (!is_kernel_addr(pmd_val(pmd)) \
|| (pmd_val(pmd) & PMD_BAD_BITS))
-#define pmd_present(pmd) (pmd_val(pmd) != 0)
+#define pmd_present(pmd) (!pmd_none(pmd))
#define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0)
#define pmd_page_vaddr(pmd) (pmd_val(pmd) & ~PMD_MASKED_BITS)
extern struct page *pmd_page(pmd_t pmd);
@@ -164,9 +164,21 @@ extern struct page *pmd_page(pmd_t pmd);
#define pud_present(pud) (pud_val(pud) != 0)
#define pud_clear(pudp) (pud_val(*(pudp)) = 0)
#define pud_page_vaddr(pud) (pud_val(pud) & ~PUD_MASKED_BITS)
-#define pud_page(pud) virt_to_page(pud_page_vaddr(pud))
+extern struct page *pud_page(pud_t pud);
+
+static inline pte_t pud_pte(pud_t pud)
+{
+ return __pte(pud_val(pud));
+}
+
+static inline pud_t pte_pud(pte_t pte)
+{
+ return __pud(pte_val(pte));
+}
+#define pud_write(pud) pte_write(pud_pte(pud))
#define pgd_set(pgdp, pudp) ({pgd_val(*(pgdp)) = (unsigned long)(pudp);})
+#define pgd_write(pgd) pte_write(pgd_pte(pgd))
/*
* Find an entry in a page-table-directory. We combine the address region
@@ -422,7 +434,22 @@ extern void set_pmd_at(struct mm_struct *mm, unsigned long addr,
pmd_t *pmdp, pmd_t pmd);
extern void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long addr,
pmd_t *pmd);
-
+/*
+ *
+ * For core kernel code by design pmd_trans_huge is never run on any hugetlbfs
+ * page. The hugetlbfs page table walking and mangling paths are totally
+ * separated form the core VM paths and they're differentiated by
+ * VM_HUGETLB being set on vm_flags well before any pmd_trans_huge could run.
+ *
+ * pmd_trans_huge() is defined as false at build time if
+ * CONFIG_TRANSPARENT_HUGEPAGE=n to optimize away code blocks at build
+ * time in such case.
+ *
+ * For ppc64 we need to differntiate from explicit hugepages from THP, because
+ * for THP we also track the subpage details at the pmd level. We don't do
+ * that for explicit huge pages.
+ *
+ */
static inline int pmd_trans_huge(pmd_t pmd)
{
/*
@@ -431,16 +458,6 @@ static inline int pmd_trans_huge(pmd_t pmd)
return (pmd_val(pmd) & 0x3) && (pmd_val(pmd) & _PAGE_THP_HUGE);
}
-static inline int pmd_large(pmd_t pmd)
-{
- /*
- * leaf pte for huge page, bottom two bits != 00
- */
- if (pmd_trans_huge(pmd))
- return pmd_val(pmd) & _PAGE_PRESENT;
- return 0;
-}
-
static inline int pmd_trans_splitting(pmd_t pmd)
{
if (pmd_trans_huge(pmd))
@@ -451,6 +468,14 @@ static inline int pmd_trans_splitting(pmd_t pmd)
extern int has_transparent_hugepage(void);
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
+static inline int pmd_large(pmd_t pmd)
+{
+ /*
+ * leaf pte for huge page, bottom two bits != 00
+ */
+ return ((pmd_val(pmd) & 0x3) != 0x0);
+}
+
static inline pte_t pmd_pte(pmd_t pmd)
{
return __pte(pmd_val(pmd));
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index 7e70ae968e5f..2e35b9a82929 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -62,6 +62,9 @@ static unsigned nr_gpages;
/*
* We have PGD_INDEX_SIZ = 12 and PTE_INDEX_SIZE = 8, so that we can have
* 16GB hugepage pte in PGD and 16MB hugepage pte at PMD;
+ *
+ * Defined in such a way that we can optimize away code block at build time
+ * if CONFIG_HUGETLB_PAGE=n.
*/
int pmd_huge(pmd_t pmd)
{
diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c
index c8d709ab489d..e40ca0e3f2bf 100644
--- a/arch/powerpc/mm/pgtable_64.c
+++ b/arch/powerpc/mm/pgtable_64.c
@@ -36,6 +36,7 @@
#include <linux/bootmem.h>
#include <linux/memblock.h>
#include <linux/slab.h>
+#include <linux/hugetlb.h>
#include <asm/pgalloc.h>
#include <asm/page.h>
@@ -352,16 +353,31 @@ EXPORT_SYMBOL(iounmap);
EXPORT_SYMBOL(__iounmap);
EXPORT_SYMBOL(__iounmap_at);
+#ifndef __PAGETABLE_PUD_FOLDED
+/* 4 level page table */
+struct page *pgd_page(pgd_t pgd)
+{
+ if (pgd_huge(pgd))
+ return pte_page(pgd_pte(pgd));
+ return virt_to_page(pgd_page_vaddr(pgd));
+}
+#endif
+
+struct page *pud_page(pud_t pud)
+{
+ if (pud_huge(pud))
+ return pte_page(pud_pte(pud));
+ return virt_to_page(pud_page_vaddr(pud));
+}
+
/*
* For hugepage we have pfn in the pmd, we use PTE_RPN_SHIFT bits for flags
* For PTE page, we have a PTE_FRAG_SIZE (4K) aligned virtual address.
*/
struct page *pmd_page(pmd_t pmd)
{
-#ifdef CONFIG_TRANSPARENT_HUGEPAGE
- if (pmd_trans_huge(pmd))
+ if (pmd_trans_huge(pmd) || pmd_huge(pmd))
return pfn_to_page(pmd_pfn(pmd));
-#endif
return virt_to_page(pmd_page_vaddr(pmd));
}
--
2.1.0
^ permalink raw reply related
* [PATCH V5 2/3] mm: Update generic gup implementation to handle hugepage directory
From: Aneesh Kumar K.V @ 2014-11-05 16:27 UTC (permalink / raw)
To: akpm, Steve Capper, Andrea Arcangeli, benh, mpe, David Miller
Cc: linux-arch, linux-mm, linuxppc-dev, linux-kernel,
Aneesh Kumar K.V
In-Reply-To: <1415204861-22016-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>
Update generic gup implementation with powerpc specific details.
On powerpc at pmd level we can have hugepte, normal pmd pointer
or a pointer to the hugepage directory.
Tested-by: Steve Capper <steve.capper@linaro.org>
Acked-by: Steve Capper <steve.capper@linaro.org>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
Changes from V4:
* Add pmd accessor needed for the change to ppc64
* Drop the assumption that we can access pmd using pte_* functions.
arch/powerpc/include/asm/page.h | 1 +
include/linux/hugetlb.h | 46 +++++++++++++++++++++++
mm/gup.c | 81 +++++++++++++++++++++++++++++++++++++----
3 files changed, 120 insertions(+), 8 deletions(-)
diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h
index 26fe1ae15212..f973fce73a43 100644
--- a/arch/powerpc/include/asm/page.h
+++ b/arch/powerpc/include/asm/page.h
@@ -380,6 +380,7 @@ static inline int hugepd_ok(hugepd_t hpd)
#endif
#define is_hugepd(pdep) (hugepd_ok(*((hugepd_t *)(pdep))))
+#define pgd_huge pgd_huge
int pgd_huge(pgd_t pgd);
#else /* CONFIG_HUGETLB_PAGE */
#define is_hugepd(pdep) 0
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 6e6d338641fe..e6b62f30ab21 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -175,6 +175,52 @@ static inline void __unmap_hugepage_range(struct mmu_gather *tlb,
}
#endif /* !CONFIG_HUGETLB_PAGE */
+/*
+ * hugepages at page global directory. If arch support
+ * hugepages at pgd level, they need to define this.
+ */
+#ifndef pgd_huge
+#define pgd_huge(x) 0
+#endif
+
+#ifndef pgd_write
+static inline int pgd_write(pgd_t pgd)
+{
+ BUG();
+ return 0;
+}
+#endif
+
+#ifndef pud_write
+static inline int pud_write(pud_t pud)
+{
+ BUG();
+ return 0;
+}
+#endif
+
+#ifndef is_hugepd
+/*
+ * Some architectures requires a hugepage directory format that is
+ * required to support multiple hugepage sizes. For example
+ * a4fe3ce76 "powerpc/mm: Allow more flexible layouts for hugepage pagetables"
+ * introduced the same on powerpc. This allows for a more flexible hugepage
+ * pagetable layout.
+ */
+typedef struct { unsigned long pd; } hugepd_t;
+#define is_hugepd(hugepd) (0)
+#define __hugepd(x) ((hugepd_t) { (x) })
+static inline int gup_huge_pd(hugepd_t hugepd, unsigned long addr,
+ unsigned pdshift, unsigned long end,
+ int write, struct page **pages, int *nr)
+{
+ return 0;
+}
+#else
+extern int gup_huge_pd(hugepd_t hugepd, unsigned long addr,
+ unsigned pdshift, unsigned long end,
+ int write, struct page **pages, int *nr);
+#endif
#define HUGETLB_ANON_FILE "anon_hugepage"
diff --git a/mm/gup.c b/mm/gup.c
index cd62c8c90d4a..0ca1df9075ab 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -3,7 +3,6 @@
#include <linux/err.h>
#include <linux/spinlock.h>
-#include <linux/hugetlb.h>
#include <linux/mm.h>
#include <linux/pagemap.h>
#include <linux/rmap.h>
@@ -12,6 +11,7 @@
#include <linux/sched.h>
#include <linux/rwsem.h>
+#include <linux/hugetlb.h>
#include <asm/pgtable.h>
#include "internal.h"
@@ -875,6 +875,49 @@ static int gup_huge_pud(pud_t orig, pud_t *pudp, unsigned long addr,
return 1;
}
+static int gup_huge_pgd(pgd_t orig, pgd_t *pgdp, unsigned long addr,
+ unsigned long end, int write,
+ struct page **pages, int *nr)
+{
+ int refs;
+ struct page *head, *page, *tail;
+
+ if (write && !pgd_write(orig))
+ return 0;
+
+ refs = 0;
+ head = pgd_page(orig);
+ page = head + ((addr & ~PGDIR_MASK) >> PAGE_SHIFT);
+ tail = page;
+ do {
+ VM_BUG_ON_PAGE(compound_head(page) != head, page);
+ pages[*nr] = page;
+ (*nr)++;
+ page++;
+ refs++;
+ } while (addr += PAGE_SIZE, addr != end);
+
+ if (!page_cache_add_speculative(head, refs)) {
+ *nr -= refs;
+ return 0;
+ }
+
+ if (unlikely(pgd_val(orig) != pgd_val(*pgdp))) {
+ *nr -= refs;
+ while (refs--)
+ put_page(head);
+ return 0;
+ }
+
+ while (refs--) {
+ if (PageTail(tail))
+ get_huge_page_tail(tail);
+ tail++;
+ }
+
+ return 1;
+}
+
static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end,
int write, struct page **pages, int *nr)
{
@@ -902,6 +945,14 @@ static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end,
pages, nr))
return 0;
+ } else if (unlikely(is_hugepd(__hugepd(pmd_val(pmd))))) {
+ /*
+ * architecture have different format for hugetlbfs
+ * pmd format and THP pmd format
+ */
+ if (!gup_huge_pd(__hugepd(pmd_val(pmd)), addr,
+ PMD_SHIFT, next, write, pages, nr))
+ return 0;
} else if (!gup_pte_range(pmd, addr, next, write, pages, nr))
return 0;
} while (pmdp++, addr = next, addr != end);
@@ -909,22 +960,26 @@ static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end,
return 1;
}
-static int gup_pud_range(pgd_t *pgdp, unsigned long addr, unsigned long end,
- int write, struct page **pages, int *nr)
+static int gup_pud_range(pgd_t pgd, unsigned long addr, unsigned long end,
+ int write, struct page **pages, int *nr)
{
unsigned long next;
pud_t *pudp;
- pudp = pud_offset(pgdp, addr);
+ pudp = pud_offset(&pgd, addr);
do {
pud_t pud = ACCESS_ONCE(*pudp);
next = pud_addr_end(addr, end);
if (pud_none(pud))
return 0;
- if (pud_huge(pud)) {
+ if (unlikely(pud_huge(pud))) {
if (!gup_huge_pud(pud, pudp, addr, next, write,
- pages, nr))
+ pages, nr))
+ return 0;
+ } else if (unlikely(is_hugepd(__hugepd(pud_val(pud))))) {
+ if (!gup_huge_pd(__hugepd(pud_val(pud)), addr,
+ PUD_SHIFT, next, write, pages, nr))
return 0;
} else if (!gup_pmd_range(pud, addr, next, write, pages, nr))
return 0;
@@ -970,10 +1025,20 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
local_irq_save(flags);
pgdp = pgd_offset(mm, addr);
do {
+ pgd_t pgd = ACCESS_ONCE(*pgdp);
+
next = pgd_addr_end(addr, end);
- if (pgd_none(*pgdp))
+ if (pgd_none(pgd))
break;
- else if (!gup_pud_range(pgdp, addr, next, write, pages, &nr))
+ if (unlikely(pgd_huge(pgd))) {
+ if (!gup_huge_pgd(pgd, pgdp, addr, next, write,
+ pages, &nr))
+ break;
+ } else if (unlikely(is_hugepd(__hugepd(pgd_val(pgd))))) {
+ if (!gup_huge_pd(__hugepd(pgd_val(pgd)), addr,
+ PGDIR_SHIFT, next, write, pages, &nr))
+ break;
+ } else if (!gup_pud_range(pgd, addr, next, write, pages, &nr))
break;
} while (pgdp++, addr = next, addr != end);
local_irq_restore(flags);
--
2.1.0
^ permalink raw reply related
* [PATCH v3 2/4] dt/bindings: Introduce the FSL QorIQ DPAA BMan portal(s)
From: Emil Medve @ 2014-11-05 15:18 UTC (permalink / raw)
To: scottwood, galak, corbet, robh+dt, ijc+devicetree, galak,
pawel.moll, mark.rutland, grant.likely, Geoff.Thorpe,
linuxppc-dev, devicetree, linux-doc
Cc: Emil Medve
In-Reply-To: <1415200734-6978-1-git-send-email-Emilian.Medve@Freescale.com>
Portals are memory mapped interfaces to BMan that allow low-latency,
lock-less interaction by software running on processor cores, accelerators
and network interfaces with the BMan
Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
Change-Id: I6d245ffc14ba3d0e91d403ac7c3b91b75a9e6a95
---
.../devicetree/bindings/soc/fsl/bman-portals.txt | 56 ++++++++++++++++++++++
1 file changed, 56 insertions(+)
create mode 100644 Documentation/devicetree/bindings/soc/fsl/bman-portals.txt
diff --git a/Documentation/devicetree/bindings/soc/fsl/bman-portals.txt b/Documentation/devicetree/bindings/soc/fsl/bman-portals.txt
new file mode 100644
index 0000000..2a00e14
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/fsl/bman-portals.txt
@@ -0,0 +1,56 @@
+QorIQ DPAA Buffer Manager Portals Device Tree Binding
+
+Copyright (C) 2008 - 2014 Freescale Semiconductor Inc.
+
+CONTENTS
+
+ - BMan Portal
+ - Example
+
+BMan Portal Node
+
+Portals are memory mapped interfaces to BMan that allow low-latency, lock-less
+interaction by software running on processor cores, accelerators and network
+interfaces with the BMan
+
+PROPERTIES
+
+- compatible
+ Usage: Required
+ Value type: <stringlist>
+ Definition: Must include "fsl,bman-portal-<hardware revision>"
+ May include "fsl,<SoC>-bman-portal" or "fsl,bman-portal"
+
+- reg
+ Usage: Required
+ Value type: <prop-encoded-array>
+ Definition: Two regions. The first is the cache-enabled region of
+ the portal. The second is the cache-inhibited region of
+ the portal
+
+- interrupts
+ Usage: Required
+ Value type: <prop-encoded-array>
+ Definition: Standard property
+
+EXAMPLE
+
+The example below shows a (P4080) BMan portals container/bus node with two portals
+
+ bman-portals@ff4000000 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "simple-bus";
+ ranges = <0 0xf 0xf4000000 0x200000>;
+
+ bman-portal@0 {
+ compatible = "fsl,bman-portal-1.0.0", "fsl,bman-portal";
+ reg = <0x0 0x4000>, <0x100000 0x1000>;
+ interrupts = <105 2 0 0>;
+ };
+ bman-portal@4000 {
+ compatible = "fsl,bman-portal-1.0.0", "fsl,bman-portal";
+ reg = <0x4000 0x4000>, <0x101000 0x1000>;
+ interrupts = <107 2 0 0>;
+ };
+ };
--
2.1.3
^ permalink raw reply related
* [PATCH v3 4/4] dt/bindings: Introduce the FSL QorIQ DPAA QMan portal(s)
From: Emil Medve @ 2014-11-05 15:18 UTC (permalink / raw)
To: scottwood, galak, corbet, robh+dt, ijc+devicetree, galak,
pawel.moll, mark.rutland, grant.likely, Geoff.Thorpe,
linuxppc-dev, devicetree, linux-doc
Cc: Emil Medve
In-Reply-To: <1415200734-6978-1-git-send-email-Emilian.Medve@Freescale.com>
Portals are memory mapped interfaces to QMan that allow low-latency,
lock-less interaction by software running on processor cores,
accelerators and network interfaces with the QMan
Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
Change-Id: I29764fa8093b5ce65460abc879446795c50d7185
---
.../devicetree/bindings/soc/fsl/qman-portals.txt | 154 +++++++++++++++++++++
1 file changed, 154 insertions(+)
create mode 100644 Documentation/devicetree/bindings/soc/fsl/qman-portals.txt
diff --git a/Documentation/devicetree/bindings/soc/fsl/qman-portals.txt b/Documentation/devicetree/bindings/soc/fsl/qman-portals.txt
new file mode 100644
index 0000000..48c4dae
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/fsl/qman-portals.txt
@@ -0,0 +1,154 @@
+QorIQ DPAA Queue Manager Portals Device Tree Binding
+
+Copyright (C) 2008 - 2014 Freescale Semiconductor Inc.
+
+CONTENTS
+
+ - QMan Portal
+ - QMan Pool Channel
+ - Example
+
+QMan Portal Node
+
+Portals are memory mapped interfaces to QMan that allow low-latency, lock-less
+interaction by software running on processor cores, accelerators and network
+interfaces with the QMan
+
+PROPERTIES
+
+- compatible
+ Usage: Required
+ Value type: <stringlist>
+ Definition: Must include "fsl,qman-portal-<hardware revision>"
+ May include "fsl,<SoC>-qman-portal" or "fsl,qman-portal"
+
+- reg
+ Usage: Required
+ Value type: <prop-encoded-array>
+ Definition: Two regions. The first is the cache-enabled region of
+ the portal. The second is the cache-inhibited region of
+ the portal
+
+- interrupts
+ Usage: Required
+ Value type: <prop-encoded-array>
+ Definition: Standard property
+
+- fsl,liodn
+ Usage: See pamu.txt
+ Value type: <prop-encoded-array>
+ Definition: Two LIODN(s). DQRR LIODN (DLIODN) and Frame LIODN
+ (FLIODN)
+
+- fsl,iommu-parent
+ Usage: See pamu.txt
+ Value type: <phandle>
+ Definition: PAMU property used for dynamic LIODN assignment
+
+ For additional details about the PAMU/LIODN binding(s) see pamu.txt
+
+- fsl,qman-channel-id
+ Usage: Required
+ Value type: <u32>
+ Definition: The hardware index of the channel. This can also be
+ determined by dividing any of the channel's 8 work queue
+ IDs by 8
+
+In addition to these properties the qman-portals should have sub-nodes to
+represent the HW devices/portals that are connected to the software portal
+described here
+
+The currently supported sub-nodes are:
+ * fman0
+ * fman1
+ * pme
+ * crypto
+
+These subnodes should have the following properties:
+
+- fsl,liodn
+ Usage: See pamu.txt
+ Value type: <prop-encoded-array>
+ Definition: PAMU property used for static LIODN assignment
+
+- fsl,iommu-parent
+ Usage: See pamu.txt
+ Value type: <phandle>
+ Definition: PAMU property used for dynamic LIODN assignment
+
+- dev-handle
+ Usage: Required
+ Value type: <phandle>
+ Definition: The phandle to the particular hardware device that this
+ portal is connected to.
+
+DPAA QMan Pool Channel Nodes
+
+Pool Channels are defined with the following properties.
+
+PROPERTIES
+
+- compatible
+ Usage: Required
+ Value type: <stringlist>
+ Definition: Must include "fsl,qman-pool-channel"
+ May include "fsl,<SoC>-qman-pool-channel"
+
+- fsl,qman-channel-id
+ Usage: Required
+ Value type: <u32>
+ Definition: The hardware index of the channel. This can also be
+ determined by dividing any of the channel's 8 work queue
+ IDs by 8
+
+EXAMPLE
+
+The example below shows a (P4080) QMan portals container/bus node with two portals
+
+ qman-portals@ff4200000 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "simple-bus";
+ ranges = <0 0xf 0xf4200000 0x200000>;
+
+ qman-portal@0 {
+ compatible = "fsl,qman-portal-1.2.0", "fsl,qman-portal";
+ reg = <0 0x4000>, <0x100000 0x1000>;
+ interrupts = <104 2 0 0>;
+ fsl,liodn = <1 2>;
+ fsl,qman-channel-id = <0>;
+
+ fman0 {
+ fsl,liodn = <0x21>;
+ dev-handle = <&fman0>;
+ };
+ fman1 {
+ fsl,liodn = <0xa1>;
+ dev-handle = <&fman1>;
+ };
+ crypto {
+ fsl,liodn = <0x41 0x66>;
+ dev-handle = <&crypto>;
+ };
+ };
+ qman-portal@4000 {
+ compatible = "fsl,qman-portal-1.2.0", "fsl,qman-portal";
+ reg = <0x4000 0x4000>, <0x101000 0x1000>;
+ interrupts = <106 2 0 0>;
+ fsl,liodn = <3 4>;
+ fsl,qman-channel-id = <1>;
+
+ fman0 {
+ fsl,liodn = <0x22>;
+ dev-handle = <&fman0>;
+ };
+ fman1 {
+ fsl,liodn = <0xa2>;
+ dev-handle = <&fman1>;
+ };
+ crypto {
+ fsl,liodn = <0x42 0x67>;
+ dev-handle = <&crypto>;
+ };
+ };
+ };
--
2.1.3
^ permalink raw reply related
* [PATCH v3 0/4] dt/bindings: Introduce the FSL QorIQ DPAA B/QMan
From: Emil Medve @ 2014-11-05 15:18 UTC (permalink / raw)
To: scottwood, galak, corbet, robh+dt, ijc+devicetree, galak,
pawel.moll, mark.rutland, grant.likely, Geoff.Thorpe,
linuxppc-dev, devicetree, linux-doc
Cc: Emil Medve
Outstanding topics:
- Scott's reserved-memory updates proposal
- Some LIODN loose ends
- Private memory sizing
v3: Address feedback from Kumar Gala
- Move bindings from Documentation/devicetree/bindings/powerpc/fsl to
Documentation/devicetree/bindings/soc/fsl to support ARM based SoC(s)
- Add phandles to link the reserved-memory to the B/QMan nodes to support
multiple B/QMan nodes per SoC
- Better handle acronyms
Address feedback from Scott Wood
- Spelling error
- Extra phandles to reflect DPAA blocks links to the B/QMan nodes in
order to support multiple B/QMan nodes per SoC
- Add version register(s) information to highlight differences in the
programming model
- Detail LIODN types/usage
- Update nodes names without a 'reg' property
v2: Incorporate feedback from Mark Rutland
- Remove "subject to change" notes
- Add/document the 'interrupts' properties
- Make multiple windows 'reg' properties more readable
- Improve portal description
Emil Medve (4):
dt/bindings: Introduce the FSL QorIQ DPAA BMan
dt/bindings: Introduce the FSL QorIQ DPAA BMan portal(s)
dt/bindings: Introduce the FSL QorIQ DPAA QMan
dt/bindings: Introduce the FSL QorIQ DPAA QMan portal(s)
.../devicetree/bindings/soc/fsl/bman-portals.txt | 56 +++++++
Documentation/devicetree/bindings/soc/fsl/bman.txt | 125 ++++++++++++++++
.../devicetree/bindings/soc/fsl/qman-portals.txt | 154 +++++++++++++++++++
Documentation/devicetree/bindings/soc/fsl/qman.txt | 165 +++++++++++++++++++++
4 files changed, 500 insertions(+)
create mode 100644 Documentation/devicetree/bindings/soc/fsl/bman-portals.txt
create mode 100644 Documentation/devicetree/bindings/soc/fsl/bman.txt
create mode 100644 Documentation/devicetree/bindings/soc/fsl/qman-portals.txt
create mode 100644 Documentation/devicetree/bindings/soc/fsl/qman.txt
--
2.1.3
^ permalink raw reply
* [PATCH v3 3/4] dt/bindings: Introduce the FSL QorIQ DPAA QMan
From: Emil Medve @ 2014-11-05 15:18 UTC (permalink / raw)
To: scottwood, galak, corbet, robh+dt, ijc+devicetree, galak,
pawel.moll, mark.rutland, grant.likely, Geoff.Thorpe,
linuxppc-dev, devicetree, linux-doc
Cc: Emil Medve
In-Reply-To: <1415200734-6978-1-git-send-email-Emilian.Medve@Freescale.com>
The Queue Manager is part of the Data-Path Acceleration Architecture (DPAA).
QMan supports queuing and QoS scheduling of frames to CPUs, network interfaces
and DPAA logic modules, maintains packet ordering within flows. Besides
providing flow-level queuing, is also responsible for congestion management
functions such as RED/WRED, congestion notifications and tail discards. This
binding covers the CCSR space programming model
Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
Change-Id: I3acb223893e42003d6c9dc061db568ec0b10d29b
---
Documentation/devicetree/bindings/soc/fsl/qman.txt | 165 +++++++++++++++++++++
1 file changed, 165 insertions(+)
create mode 100644 Documentation/devicetree/bindings/soc/fsl/qman.txt
diff --git a/Documentation/devicetree/bindings/soc/fsl/qman.txt b/Documentation/devicetree/bindings/soc/fsl/qman.txt
new file mode 100644
index 0000000..063e3a0
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/fsl/qman.txt
@@ -0,0 +1,165 @@
+QorIQ DPAA Queue Manager Device Tree Binding
+
+Copyright (C) 2008 - 2014 Freescale Semiconductor Inc.
+
+CONTENTS
+
+ - QMan Node
+ - QMan Private Memory Nodes
+ - Example
+
+QMan Node
+
+The Queue Manager is part of the Data-Path Acceleration Architecture (DPAA). QMan
+supports queuing and QoS scheduling of frames to CPUs, network interfaces and
+DPAA logic modules, maintains packet ordering within flows. Besides providing
+flow-level queuing, is also responsible for congestion management functions such
+as RED/WRED, congestion notifications and tail discards. This binding covers the
+CCSR space programming model
+
+PROPERTIES
+
+- compatible
+ Usage: Required
+ Value type: <stringlist>
+ Definition: Must include "fsl,qman"
+ May include "fsl,<SoC>-qman"
+
+- reg
+ Usage: Required
+ Value type: <prop-encoded-array>
+ Definition: Registers region within the CCSR address space
+
+The QMan revision information is located in the QMAN_IP_REV_1/2 registers which
+are located at offsets 0xbf8 and 0xbfc
+
+- interrupts
+ Usage: Required
+ Value type: <prop-encoded-array>
+ Definition: Standard property. The error interrupt
+
+- fsl,liodn
+ Usage: See pamu.txt
+ Value type: <prop-encoded-array>
+ Definition: PAMU property used for static LIODN assignment
+
+- fsl,iommu-parent
+ Usage: See pamu.txt
+ Value type: <phandle>
+ Definition: PAMU property used for dynamic LIODN assignment
+
+ For additional details about the PAMU/LIODN binding(s) see pamu.txt
+
+- clocks
+ Usage: See clock-bindings.txt and qoriq-clock.txt
+ Value type: <prop-encoded-array>
+ Definition: Reference input clock. Its frequency is half of the
+ platform clock
+
+Devices connected to a QMan instance via Direct Connect Portals (DCP) must link
+to the respective QMan instance
+
+- fsl,qman
+ Usage: Required
+ Value type: <prop-encoded-array>
+ Description: List of phandle and DCP index pairs, to the QMan instance
+ to which this device is connected via the DCP
+
+QMan Private Memory Nodes
+
+QMan requires two contiguous range of physical memory used for the backing store
+for QMan Frame Queue Descriptor (FQD) and Packed Frame Descriptor Record (PFDR).
+This memory is reserved/allocated as a nodes under the /reserved-memory node
+
+The QMan FQD memory node must be named "qman-fqd"
+
+PROPERTIES
+
+- compatible
+ Usage: required
+ Value type: <stringlist>
+ Definition: Must inclide "fsl,qman-fqd"
+
+The QMan PFDR memory node must be named "qman-pfdr"
+
+PROPERTIES
+
+- compatible
+ Usage: required
+ Value type: <stringlist>
+ Definition: Must inclide "fsl,qman-pfdr"
+
+The following constraints are relevant to the FQD and PFDR private memory:
+ - The size must be 2^(size + 1), with size = 11..29. That is 4 KiB to
+ 1 GiB
+ - The alignment must be a muliptle of the memory size
+
+The size of the FQD and PFDP must be chosen by observing the hardware features
+configured via the Reset Configuration Word (RCW) and that are relevant to a
+specific board (e.g. number of MAC(s) pinned-out, number of offline/host command
+FMan ports, etc.). The size configured in the DT must reflect the hardware
+capabilities and not the specific needs of an application
+
+For additional details about reserved memory regions see reserved-memory.txt
+
+EXAMPLE
+
+The example below shows a QMan FQD and a PFDR dynamic allocation memory nodes
+
+ reserved-memory {
+ #address-cells = <2>;
+ #size-cells = <2>;
+ ranges;
+
+ qman_fqd: qman-fqd {
+ compatible = "fsl,qman-fqd";
+ alloc-ranges = <0 0 0xf 0xffffffff>;
+ size = <0 0x400000>;
+ alignment = <0 0x400000>;
+ };
+ qman_pfdr: qman-pfdr {
+ compatible = "fsl,qman-pfdr";
+ alloc-ranges = <0 0 0xf 0xffffffff>;
+ size = <0 0x2000000>;
+ alignment = <0 0x2000000>;
+ };
+ };
+
+The example below shows a (P4080) QMan CCSR-space node
+
+ clockgen: global-utilities@e1000 {
+ ...
+ sysclk: sysclk {
+ ...
+ };
+ ...
+ platform_pll: platform-pll@c00 {
+ #clock-cells = <1>;
+ reg = <0xc00 0x4>;
+ compatible = "fsl,qoriq-platform-pll-1.0";
+ clocks = <&sysclk>;
+ clock-output-names = "platform-pll", "platform-pll-div2";
+ };
+ ...
+ };
+
+ crypto@300000 {
+ ...
+ fsl,qman = <&qman, 2>;
+ ...
+ };
+
+ qman: qman@318000 {
+ compatible = "fsl,qman";
+ reg = <0x318000 0x1000>;
+ interrupts = <16 2 1 3>
+ fsl,liodn = <0x16>;
+ memory-region = <&qman_fqd &qman_pfdr>;
+ clocks = <&platform_pll 1>;
+ };
+
+ fman@400000 {
+ ...
+ fsl,qman = <&qman, 0>;
+ ...
+ };
--
2.1.3
^ permalink raw reply related
* [PATCH v3 1/4] dt/bindings: Introduce the FSL QorIQ DPAA BMan
From: Emil Medve @ 2014-11-05 15:18 UTC (permalink / raw)
To: scottwood, galak, corbet, robh+dt, ijc+devicetree, galak,
pawel.moll, mark.rutland, grant.likely, Geoff.Thorpe,
linuxppc-dev, devicetree, linux-doc
Cc: Emil Medve
In-Reply-To: <1415200734-6978-1-git-send-email-Emilian.Medve@Freescale.com>
The Buffer Manager is part of the Data-Path Acceleration Architecture (DPAA).
BMan supports hardware allocation and deallocation of buffers belonging to
pools originally created by software with configurable depletion thresholds.
This binding covers the CCSR space programming model
Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
Change-Id: I3ec479bfb3c91951e96902f091f5d7d2adbef3b2
---
Documentation/devicetree/bindings/soc/fsl/bman.txt | 125 +++++++++++++++++++++
1 file changed, 125 insertions(+)
create mode 100644 Documentation/devicetree/bindings/soc/fsl/bman.txt
diff --git a/Documentation/devicetree/bindings/soc/fsl/bman.txt b/Documentation/devicetree/bindings/soc/fsl/bman.txt
new file mode 100644
index 0000000..9f80bf8
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/fsl/bman.txt
@@ -0,0 +1,125 @@
+QorIQ DPAA Buffer Manager Device Tree Bindings
+
+Copyright (C) 2008 - 2014 Freescale Semiconductor Inc.
+
+CONTENTS
+
+ - BMan Node
+ - BMan Private Memory Node
+ - Example
+
+BMan Node
+
+The Buffer Manager is part of the Data-Path Acceleration Architecture (DPAA).
+BMan supports hardware allocation and deallocation of buffers belonging to pools
+originally created by software with configurable depletion thresholds. This
+binding covers the CCSR space programming model
+
+PROPERTIES
+
+- compatible
+ Usage: Required
+ Value type: <stringlist>
+ Definition: Must include "fsl,bman"
+ May include "fsl,<SoC>-bman"
+
+- reg
+ Usage: Required
+ Value type: <prop-encoded-array>
+ Definition: Registers region within the CCSR address space
+
+The BMan revision information is located in the BMAN_IP_REV_1/2 registers which
+are located at offsets 0xbf8 and 0xbfc
+
+- interrupts
+ Usage: Required
+ Value type: <prop-encoded-array>
+ Definition: Standard property. The error interrupt
+
+- fsl,liodn
+ Usage: See pamu.txt
+ Value type: <prop-encoded-array>
+ Definition: PAMU property used for static LIODN assignment
+
+- fsl,iommu-parent
+ Usage: See pamu.txt
+ Value type: <phandle>
+ Definition: PAMU property used for dynamic LIODN assignment
+
+ For additional details about the PAMU/LIODN binding(s) see pamu.txt
+
+Devices connected to a BMan instance via Direct Connect Portals (DCP) must link
+to the respective BMan instance
+
+- fsl,bman
+ Usage: Required
+ Value type: <prop-encoded-array>
+ Description: List of phandle and DCP index pairs, to the BMan instance
+ to which this device is connected via the DCP
+
+BMan Private Memory Node
+
+BMan requires a contiguous range of physical memory used for the backing store
+for BMan Free Buffer Proxy Records (FBPR). This memory is reserved/allocated as a
+node under the /reserved-memory node
+
+The BMan FBPR memory node must be named "bman-fbpr"
+
+PROPERTIES
+
+- compatible
+ Usage: required
+ Value type: <stringlist>
+ Definition: Must inclide "fsl,bman-fbpr"
+
+The following constraints are relevant to the FBPR private memory:
+ - The size must be 2^(size + 1), with size = 11..33. That is 4 KiB to
+ 16 GiB
+ - The alignment must be a muliptle of the memory size
+
+The size of the FBPR must be chosen by observing the hardware features configured
+via the Reset Configuration Word (RCW) and that are relevant to a specific board
+(e.g. number of MAC(s) pinned-out, number of offline/host command FMan ports,
+etc.). The size configured in the DT must reflect the hardware capabilities and
+not the specific needs of an application
+
+For additional details about reserved memory regions see reserved-memory.txt
+
+EXAMPLE
+
+The example below shows a BMan FBPR dynamic allocation memory node
+
+ reserved-memory {
+ #address-cells = <2>;
+ #size-cells = <2>;
+ ranges;
+
+ bman_fbpr: bman-fbpr {
+ compatible = "fsl,bman-fbpr";
+ alloc-ranges = <0 0 0xf 0xffffffff>;
+ size = <0 0x1000000>;
+ alignment = <0 0x1000000>;
+ };
+ };
+
+The example below shows a (P4080) BMan CCSR-space node
+
+ crypto@300000 {
+ ...
+ fsl,bman = <&bman, 2>;
+ ...
+ };
+
+ bman: bman@31a000 {
+ compatible = "fsl,bman";
+ reg = <0x31a000 0x1000>;
+ interrupts = <16 2 1 2>;
+ fsl,liodn = <0x17>;
+ memory-region = <&bman_fbpr>;
+ };
+
+ fman@400000 {
+ ...
+ fsl,bman = <&bman, 0>;
+ ...
+ };
--
2.1.3
^ permalink raw reply related
* Re: powerpc: Convert power off logic to pm_power_off topic branch
From: Guenter Roeck @ 2014-11-05 14:24 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev list, agraf
In-Reply-To: <1415076451.24950.4.camel@concordia>
On Tue, Nov 04, 2014 at 03:47:31PM +1100, Michael Ellerman wrote:
> Hi Guenter,
>
> I've put the pm_power_off patch in a topic branch:
>
> https://git.kernel.org/cgit/linux/kernel/git/mpe/linux.git/log/?h=topic/pm-power-off
>
> I'll pull this into my next when I open it.
>
> Let me know if there's any issue with it.
>
Seems to work fine. I rebased my branch on top of it and converted the ppc code
to use the power-off handler.
I'll just resubmit the entire series in a day or two. Can't wait forever.
Guenter
^ permalink raw reply
* Re: [PATCH v2] hwmon: (ibmpowernv) Use platform 'id_table' to probe the device
From: Guenter Roeck @ 2014-11-05 14:21 UTC (permalink / raw)
To: Neelesh Gupta
Cc: benh, michaele, linux-kernel, lm-sensors, linuxppc-dev, jdelvare
In-Reply-To: <20141105110848.6183.55611.stgit@localhost.localdomain>
On Wed, Nov 05, 2014 at 04:45:14PM +0530, Neelesh Gupta wrote:
> The current driver probe() function assumes the sensor device to be
> alwary present and gets executed every time if the driver is loaded,
> but the appropriate hardware could not be present.
>
> So, move the platform device creation as part of platform init code
> and use the 'id_table' to check if the device present or not.
>
> Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com>
Looks good. We'll need an ack from one of the powerpc maintainers to proceed.
Guenter
> ---
>
> Changes in v2
> =============
> - Improve readability in error case if 'sensors' not found, also log
> the using 'pr_err'.
>
> arch/powerpc/platforms/powernv/opal-sensor.c | 20 ++++++++
> drivers/hwmon/ibmpowernv.c | 67 +++++++-------------------
> 2 files changed, 39 insertions(+), 48 deletions(-)
>
> diff --git a/arch/powerpc/platforms/powernv/opal-sensor.c b/arch/powerpc/platforms/powernv/opal-sensor.c
> index 10271ad..4ab67ef 100644
> --- a/arch/powerpc/platforms/powernv/opal-sensor.c
> +++ b/arch/powerpc/platforms/powernv/opal-sensor.c
> @@ -20,7 +20,9 @@
>
> #include <linux/delay.h>
> #include <linux/mutex.h>
> +#include <linux/of_platform.h>
> #include <asm/opal.h>
> +#include <asm/machdep.h>
>
> static DEFINE_MUTEX(opal_sensor_mutex);
>
> @@ -64,3 +66,21 @@ out:
> return ret;
> }
> EXPORT_SYMBOL_GPL(opal_get_sensor_data);
> +
> +static __init int opal_sensor_init(void)
> +{
> + struct platform_device *pdev;
> + struct device_node *sensor;
> +
> + sensor = of_find_node_by_path("/ibm,opal/sensors");
> + if (!sensor) {
> + pr_err("Opal node 'sensors' not found\n");
> + return -ENODEV;
> + }
> +
> + pdev = of_platform_device_create(sensor, "opal-sensor", NULL);
> + of_node_put(sensor);
> +
> + return PTR_ERR_OR_ZERO(pdev);
> +}
> +machine_subsys_initcall(powernv, opal_sensor_init);
> diff --git a/drivers/hwmon/ibmpowernv.c b/drivers/hwmon/ibmpowernv.c
> index 6a30eee..c7577b8 100644
> --- a/drivers/hwmon/ibmpowernv.c
> +++ b/drivers/hwmon/ibmpowernv.c
> @@ -74,9 +74,6 @@ struct platform_data {
> u32 sensors_count; /* Total count of sensors from each group */
> };
>
> -/* Platform device representing all the ibmpowernv sensors */
> -static struct platform_device *pdevice;
> -
> static ssize_t show_sensor(struct device *dev, struct device_attribute *devattr,
> char *buf)
> {
> @@ -99,7 +96,7 @@ static ssize_t show_sensor(struct device *dev, struct device_attribute *devattr,
> return sprintf(buf, "%u\n", x);
> }
>
> -static int __init get_sensor_index_attr(const char *name, u32 *index,
> +static int get_sensor_index_attr(const char *name, u32 *index,
> char *attr)
> {
> char *hash_pos = strchr(name, '#');
> @@ -136,7 +133,7 @@ static int __init get_sensor_index_attr(const char *name, u32 *index,
> * which need to be mapped as fan2_input, temp1_max respectively before
> * populating them inside hwmon device class.
> */
> -static int __init create_hwmon_attr_name(struct device *dev, enum sensors type,
> +static int create_hwmon_attr_name(struct device *dev, enum sensors type,
> const char *node_name,
> char *hwmon_attr_name)
> {
> @@ -172,7 +169,7 @@ static int __init create_hwmon_attr_name(struct device *dev, enum sensors type,
> return 0;
> }
>
> -static int __init populate_attr_groups(struct platform_device *pdev)
> +static int populate_attr_groups(struct platform_device *pdev)
> {
> struct platform_data *pdata = platform_get_drvdata(pdev);
> const struct attribute_group **pgroups = pdata->attr_groups;
> @@ -180,11 +177,6 @@ static int __init populate_attr_groups(struct platform_device *pdev)
> enum sensors type;
>
> opal = of_find_node_by_path("/ibm,opal/sensors");
> - if (!opal) {
> - dev_dbg(&pdev->dev, "Opal node 'sensors' not found\n");
> - return -ENODEV;
> - }
> -
> for_each_child_of_node(opal, np) {
> if (np->name == NULL)
> continue;
> @@ -221,7 +213,7 @@ static int __init populate_attr_groups(struct platform_device *pdev)
> * to the name required by the higher 'hwmon' driver like fan1_input, temp1_max
> * etc..
> */
> -static int __init create_device_attrs(struct platform_device *pdev)
> +static int create_device_attrs(struct platform_device *pdev)
> {
> struct platform_data *pdata = platform_get_drvdata(pdev);
> const struct attribute_group **pgroups = pdata->attr_groups;
> @@ -280,7 +272,7 @@ exit_put_node:
> return err;
> }
>
> -static int __init ibmpowernv_probe(struct platform_device *pdev)
> +static int ibmpowernv_probe(struct platform_device *pdev)
> {
> struct platform_data *pdata;
> struct device *hwmon_dev;
> @@ -309,52 +301,31 @@ static int __init ibmpowernv_probe(struct platform_device *pdev)
> return PTR_ERR_OR_ZERO(hwmon_dev);
> }
>
> +static const struct platform_device_id opal_sensor_driver_ids[] = {
> + {
> + .name = "opal-sensor",
> + },
> + { }
> +};
> +MODULE_DEVICE_TABLE(platform, opal_sensor_driver_ids);
> +
> static struct platform_driver ibmpowernv_driver = {
> - .driver = {
> - .owner = THIS_MODULE,
> - .name = DRVNAME,
> + .probe = ibmpowernv_probe,
> + .id_table = opal_sensor_driver_ids,
> + .driver = {
> + .owner = THIS_MODULE,
> + .name = DRVNAME,
> },
> };
>
> static int __init ibmpowernv_init(void)
> {
> - int err;
> -
> - pdevice = platform_device_alloc(DRVNAME, 0);
> - if (!pdevice) {
> - pr_err("Device allocation failed\n");
> - err = -ENOMEM;
> - goto exit;
> - }
> -
> - err = platform_device_add(pdevice);
> - if (err) {
> - pr_err("Device addition failed (%d)\n", err);
> - goto exit_device_put;
> - }
> -
> - err = platform_driver_probe(&ibmpowernv_driver, ibmpowernv_probe);
> - if (err) {
> - if (err != -ENODEV)
> - pr_err("Platform driver probe failed (%d)\n", err);
> -
> - goto exit_device_del;
> - }
> -
> - return 0;
> -
> -exit_device_del:
> - platform_device_del(pdevice);
> -exit_device_put:
> - platform_device_put(pdevice);
> -exit:
> - return err;
> + return platform_driver_register(&ibmpowernv_driver);
> }
>
> static void __exit ibmpowernv_exit(void)
> {
> platform_driver_unregister(&ibmpowernv_driver);
> - platform_device_unregister(pdevice);
> }
>
> MODULE_AUTHOR("Neelesh Gupta <neelegup@linux.vnet.ibm.com>");
>
^ permalink raw reply
* Re: linux-next: build failure after merge of the iommu tree
From: Joerg Roedel @ 2014-11-05 11:16 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: Olav Haugan, linux-next, ppc-dev, linux-kernel
In-Reply-To: <20141105134731.799a1a3d@canb.auug.org.au>
On Wed, Nov 05, 2014 at 01:47:31PM +1100, Stephen Rothwell wrote:
> Hi Joerg,
>
> After merging the iommu tree, today's linux-next build (powerpc
> pc64_defconfig) failed like this:
>
> In file included from arch/powerpc/platforms/powernv/pci.c:33:0:
> arch/powerpc/include/asm/iommu.h:140:12: error: conflicting types for 'iommu_map_sg'
> extern int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
> ^
> In file included from arch/powerpc/platforms/powernv/pci.c:23:0:
> include/linux/iommu.h:311:22: note: previous definition of 'iommu_map_sg' was here
> static inline size_t iommu_map_sg(struct iommu_domain *domain,
> ^
>
> Caused by commit 315786ebbf4a ("iommu: Add iommu_map_sg() function").
> Grep is your friend ...
>
> I have used the iommu tree from next-20141104 for today.
Thanks Stephen, I exluded the my core branch from next for now until the
issue is fixed.
Joerg
^ permalink raw reply
* powerpc test branch for 3.19
From: Michael Ellerman @ 2014-11-05 10:59 UTC (permalink / raw)
To: linuxppc-dev list
Cc: kyle, agraf, Julia.Lawall, anton, simon.kagstrom, cl, jslaby
Hi folks,
Here's the current contents of my test branch. This will become the powerpc
next branch for 3.19 in the next day or two.
If there's a patch in here you object to please let me know asap.
The tree is at:
git://git.kernel.org/pub/scm/linux/kernel/git/mpe/linux.git test
Also if you have stuff you are targetting for 3.19, now is a good time to start
thinking about posting it. I will try to do things properly this cycle and
close my next branch prior to the 3.18 release. You have been warned! :)
cheers
----------------------------------------------------------------
Alexander Graf (1):
powerpc: Convert power off logic to pm_power_off
Anton Blanchard (17):
powerpc: Use probe_kernel_address in show_instructions
powerpc/pci: Quieten unset I/O resource warning
powerpc: Remove ppc64_boot_msg
powerpc: Remove ppc_md.remove_memory
powerpc: Remove bootmem allocator
powerpc: Remove some old bootmem related comments
powerpc: Remove superfluous bootmem includes
powerpc: Move sparse_init() into initmem_init
powerpc: make __ffs return unsigned long
powerpc/ftrace: Remove mod_return_to_handler
powerpc/ftrace: simplify prepare_ftrace_return
powerpc/jump_label: Use HAVE_JUMP_LABEL
powerpc: Don't use local named register variable in current_thread_info
powerpc: Remove double braces in alignment code.
powerpc: LLVM complains about forward declaration of struct rtas_sensors
powerpc/pseries: Quieten ibm,pcie-link-speed-stats warning
powerpc/pseries: Quieten relocation on exceptions warning
Christoph Lameter (1):
powerpc: Replace __get_cpu_var uses
Jiri Slaby (1):
powerpc/ftrace: Fix obsolete comment
Julia Lawall (5):
powerpc/4xx/cpm: delete unneeded test before of_node_put
powerpc/fsl: fsl_soc: delete unneeded test before of_node_put
powerpc/mpc5xxx: delete unneeded test before of_node_put
powerpc/pseries: delete unneeded test before of_node_put
powerpc/gamecube/wii: delete unneeded test before of_node_put
Kyle McMartin (1):
powerpc: Remove unused devm_ioremap_prot()
Michael Ellerman (5):
Merge branch 'topic/pm-power-off' into next
Merge branch 'topic/get-cpu-var' into next
powerpc: Remove CPU_FTR_HVMODE from CPU_FTRS_ALWAYS
powerpc: Remove unused CPU_FTRS_A2
powerpc: Remove unused vgacon_remap_base & fix build break
Simon Kagstrom (1):
powerpc/boot: Parse chosen/cmdline-timeout parameter
arch/powerpc/Kconfig | 1 +
arch/powerpc/boot/main.c | 15 +-
arch/powerpc/boot/ops.h | 2 +-
arch/powerpc/boot/serial.c | 6 +-
arch/powerpc/include/asm/bitops.h | 2 +-
arch/powerpc/include/asm/cputable.h | 10 +-
arch/powerpc/include/asm/hardirq.h | 7 +-
arch/powerpc/include/asm/io.h | 3 -
arch/powerpc/include/asm/machdep.h | 15 --
arch/powerpc/include/asm/setup.h | 3 +-
arch/powerpc/include/asm/thread_info.h | 5 +-
arch/powerpc/include/asm/tlbflush.h | 4 +-
arch/powerpc/include/asm/vga.h | 4 +-
arch/powerpc/include/asm/xics.h | 8 +-
arch/powerpc/kernel/align.c | 2 +-
arch/powerpc/kernel/crash_dump.c | 1 -
arch/powerpc/kernel/dbell.c | 2 +-
arch/powerpc/kernel/entry_32.S | 12 +-
arch/powerpc/kernel/entry_64.S | 35 +---
arch/powerpc/kernel/ftrace.c | 73 ++-----
arch/powerpc/kernel/hw_breakpoint.c | 6 +-
arch/powerpc/kernel/iommu.c | 2 +-
arch/powerpc/kernel/irq.c | 5 +-
arch/powerpc/kernel/kgdb.c | 2 +-
arch/powerpc/kernel/kprobes.c | 6 +-
arch/powerpc/kernel/mce.c | 24 +--
arch/powerpc/kernel/pci-common.c | 2 +-
arch/powerpc/kernel/pci_64.c | 1 -
arch/powerpc/kernel/process.c | 27 +--
arch/powerpc/kernel/prom.c | 5 +-
arch/powerpc/kernel/rtas-proc.c | 20 +-
arch/powerpc/kernel/rtas.c | 4 +-
arch/powerpc/kernel/rtas_pci.c | 1 -
arch/powerpc/kernel/setup-common.c | 6 +-
arch/powerpc/kernel/setup_32.c | 11 +-
arch/powerpc/kernel/setup_64.c | 33 +--
arch/powerpc/kernel/smp.c | 6 +-
arch/powerpc/kernel/sysfs.c | 4 +-
arch/powerpc/kernel/time.c | 22 +-
arch/powerpc/kernel/traps.c | 8 +-
arch/powerpc/kernel/vdso.c | 1 -
arch/powerpc/kvm/book3s_hv_builtin.c | 3 +-
arch/powerpc/kvm/e500.c | 14 +-
arch/powerpc/kvm/e500mc.c | 4 +-
arch/powerpc/lib/Makefile | 1 -
arch/powerpc/lib/devres.c | 43 ----
arch/powerpc/mm/hash_native_64.c | 2 +-
arch/powerpc/mm/hash_utils_64.c | 2 +-
arch/powerpc/mm/hugetlbpage-book3e.c | 6 +-
arch/powerpc/mm/hugetlbpage.c | 6 +-
arch/powerpc/mm/init_32.c | 10 -
arch/powerpc/mm/init_64.c | 1 -
arch/powerpc/mm/mem.c | 77 ++-----
arch/powerpc/mm/numa.c | 224 ++++-----------------
arch/powerpc/mm/pgtable_32.c | 3 +-
arch/powerpc/mm/pgtable_64.c | 12 +-
arch/powerpc/perf/core-book3s.c | 22 +-
arch/powerpc/perf/core-fsl-emb.c | 6 +-
arch/powerpc/platforms/44x/ppc476.c | 2 +-
arch/powerpc/platforms/512x/mpc512x_shared.c | 7 +-
arch/powerpc/platforms/52xx/efika.c | 3 +-
arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c | 8 +-
arch/powerpc/platforms/85xx/corenet_generic.c | 2 +-
arch/powerpc/platforms/85xx/sgy_cts1000.c | 4 +-
arch/powerpc/platforms/cell/celleb_scc_epci.c | 1 -
arch/powerpc/platforms/cell/celleb_scc_pciex.c | 1 -
arch/powerpc/platforms/cell/celleb_setup.c | 4 +-
arch/powerpc/platforms/cell/interrupt.c | 6 +-
arch/powerpc/platforms/cell/qpace_setup.c | 2 +-
arch/powerpc/platforms/cell/setup.c | 2 +-
arch/powerpc/platforms/chrp/setup.c | 3 +-
arch/powerpc/platforms/embedded6xx/gamecube.c | 3 +-
arch/powerpc/platforms/embedded6xx/linkstation.c | 4 +-
arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c | 6 +-
arch/powerpc/platforms/embedded6xx/wii.c | 3 +-
arch/powerpc/platforms/maple/pci.c | 1 -
arch/powerpc/platforms/maple/setup.c | 4 +-
arch/powerpc/platforms/powermac/pci.c | 1 -
arch/powerpc/platforms/powermac/setup.c | 3 +-
arch/powerpc/platforms/powernv/eeh-ioda.c | 1 -
arch/powerpc/platforms/powernv/opal-tracepoints.c | 4 +-
arch/powerpc/platforms/powernv/opal-wrappers.S | 2 +-
arch/powerpc/platforms/powernv/pci.c | 1 -
arch/powerpc/platforms/powernv/setup.c | 4 +-
arch/powerpc/platforms/ps3/interrupt.c | 2 +-
arch/powerpc/platforms/ps3/setup.c | 2 +-
arch/powerpc/platforms/pseries/dtl.c | 2 +-
arch/powerpc/platforms/pseries/hotplug-memory.c | 21 --
arch/powerpc/platforms/pseries/hvCall.S | 4 +-
arch/powerpc/platforms/pseries/hvCall_inst.c | 4 +-
arch/powerpc/platforms/pseries/iommu.c | 11 +-
arch/powerpc/platforms/pseries/lpar.c | 6 +-
arch/powerpc/platforms/pseries/pci.c | 2 +-
arch/powerpc/platforms/pseries/ras.c | 4 +-
arch/powerpc/platforms/pseries/setup.c | 65 +++---
arch/powerpc/sysdev/fsl_msi.c | 1 -
arch/powerpc/sysdev/fsl_pci.c | 2 +-
arch/powerpc/sysdev/fsl_soc.c | 5 +-
arch/powerpc/sysdev/ipic.c | 1 -
arch/powerpc/sysdev/mpc5xxx_clocks.c | 3 +-
arch/powerpc/sysdev/mpic.c | 1 -
arch/powerpc/sysdev/mpic_pasemi_msi.c | 1 -
arch/powerpc/sysdev/mpic_u3msi.c | 1 -
arch/powerpc/sysdev/ppc4xx_cpm.c | 8 +-
arch/powerpc/sysdev/ppc4xx_msi.c | 1 -
arch/powerpc/sysdev/ppc4xx_pci.c | 1 -
arch/powerpc/sysdev/qe_lib/qe.c | 1 -
arch/powerpc/sysdev/qe_lib/qe_ic.c | 1 -
arch/powerpc/sysdev/uic.c | 1 -
arch/powerpc/sysdev/xics/xics-common.c | 2 +-
arch/powerpc/xmon/xmon.c | 3 +-
111 files changed, 333 insertions(+), 747 deletions(-)
delete mode 100644 arch/powerpc/lib/devres.c
^ permalink raw reply
* [PATCH 1/2] powerpc: Add ADT7461 to device tree for supported boards
From: Jia Hongtao @ 2014-11-05 6:59 UTC (permalink / raw)
To: galak, scottwood; +Cc: hongtao.jia, devicetree, linuxppc-dev
Including: T104xRDB T208xQDS B4QDS
Signed-off-by: Jia Hongtao <hongtao.jia@freescale.com>
---
arch/powerpc/boot/dts/b4qds.dtsi | 11 +++++++++++
arch/powerpc/boot/dts/t104xrdb.dtsi | 7 +++++++
arch/powerpc/boot/dts/t208xqds.dtsi | 11 +++++++++++
3 files changed, 29 insertions(+)
diff --git a/arch/powerpc/boot/dts/b4qds.dtsi b/arch/powerpc/boot/dts/b4qds.dtsi
index 8b47edc..bccc986 100644
--- a/arch/powerpc/boot/dts/b4qds.dtsi
+++ b/arch/powerpc/boot/dts/b4qds.dtsi
@@ -152,6 +152,17 @@
reg = <0x68>;
};
};
+
+ i2c@3 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <0x3>;
+
+ adt7461@4c {
+ compatible = "adi,adt7461";
+ reg = <0x4c>;
+ };
+ };
};
};
diff --git a/arch/powerpc/boot/dts/t104xrdb.dtsi b/arch/powerpc/boot/dts/t104xrdb.dtsi
index 1cf0f3c..187add8 100644
--- a/arch/powerpc/boot/dts/t104xrdb.dtsi
+++ b/arch/powerpc/boot/dts/t104xrdb.dtsi
@@ -83,6 +83,13 @@
};
};
+ i2c@118000 {
+ adt7461@4c {
+ compatible = "adi,adt7461";
+ reg = <0x4c>;
+ };
+ };
+
i2c@118100 {
pca9546@77 {
compatible = "nxp,pca9546";
diff --git a/arch/powerpc/boot/dts/t208xqds.dtsi b/arch/powerpc/boot/dts/t208xqds.dtsi
index 555dc6e..5906183 100644
--- a/arch/powerpc/boot/dts/t208xqds.dtsi
+++ b/arch/powerpc/boot/dts/t208xqds.dtsi
@@ -169,6 +169,17 @@
shunt-resistor = <1000>;
};
};
+
+ i2c@3 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <0x3>;
+
+ adt7461@4c {
+ compatible = "adi,adt7461";
+ reg = <0x4c>;
+ };
+ };
};
};
--
2.1.0.27.g96db324
^ permalink raw reply related
* [PATCH 2/2] powerpc: Add INA220 to device tree for supported boards
From: Jia Hongtao @ 2014-11-05 6:59 UTC (permalink / raw)
To: galak, scottwood; +Cc: hongtao.jia, devicetree, linuxppc-dev
In-Reply-To: <1415170793-13196-1-git-send-email-hongtao.jia@freescale.com>
Including: P3041DS P5020DS P5040DS B4QDS
Signed-off-by: Jia Hongtao <hongtao.jia@freescale.com>
---
arch/powerpc/boot/dts/b4qds.dtsi | 12 ++++++++++++
arch/powerpc/boot/dts/p3041ds.dts | 20 ++++++++++++++++++++
arch/powerpc/boot/dts/p5020ds.dts | 20 ++++++++++++++++++++
arch/powerpc/boot/dts/p5040ds.dts | 20 ++++++++++++++++++++
4 files changed, 72 insertions(+)
diff --git a/arch/powerpc/boot/dts/b4qds.dtsi b/arch/powerpc/boot/dts/b4qds.dtsi
index bccc986..e5bde0b 100644
--- a/arch/powerpc/boot/dts/b4qds.dtsi
+++ b/arch/powerpc/boot/dts/b4qds.dtsi
@@ -153,6 +153,18 @@
};
};
+ i2c@2 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <0x2>;
+
+ ina220@40 {
+ compatible = "ti,ina220";
+ reg = <0x40>;
+ shunt-resistor = <1000>;
+ };
+ };
+
i2c@3 {
#address-cells = <1>;
#size-cells = <0>;
diff --git a/arch/powerpc/boot/dts/p3041ds.dts b/arch/powerpc/boot/dts/p3041ds.dts
index 2fed3bc..394ea9c 100644
--- a/arch/powerpc/boot/dts/p3041ds.dts
+++ b/arch/powerpc/boot/dts/p3041ds.dts
@@ -98,6 +98,26 @@
reg = <0x68>;
interrupts = <0x1 0x1 0 0>;
};
+ ina220@40 {
+ compatible = "ti,ina220";
+ reg = <0x40>;
+ shunt-resistor = <1000>;
+ };
+ ina220@41 {
+ compatible = "ti,ina220";
+ reg = <0x41>;
+ shunt-resistor = <1000>;
+ };
+ ina220@44 {
+ compatible = "ti,ina220";
+ reg = <0x44>;
+ shunt-resistor = <1000>;
+ };
+ ina220@45 {
+ compatible = "ti,ina220";
+ reg = <0x45>;
+ shunt-resistor = <1000>;
+ };
adt7461@4c {
compatible = "adi,adt7461";
reg = <0x4c>;
diff --git a/arch/powerpc/boot/dts/p5020ds.dts b/arch/powerpc/boot/dts/p5020ds.dts
index 2869fea..b7f3057 100644
--- a/arch/powerpc/boot/dts/p5020ds.dts
+++ b/arch/powerpc/boot/dts/p5020ds.dts
@@ -98,6 +98,26 @@
reg = <0x68>;
interrupts = <0x1 0x1 0 0>;
};
+ ina220@40 {
+ compatible = "ti,ina220";
+ reg = <0x40>;
+ shunt-resistor = <1000>;
+ };
+ ina220@41 {
+ compatible = "ti,ina220";
+ reg = <0x41>;
+ shunt-resistor = <1000>;
+ };
+ ina220@44 {
+ compatible = "ti,ina220";
+ reg = <0x44>;
+ shunt-resistor = <1000>;
+ };
+ ina220@45 {
+ compatible = "ti,ina220";
+ reg = <0x45>;
+ shunt-resistor = <1000>;
+ };
adt7461@4c {
compatible = "adi,adt7461";
reg = <0x4c>;
diff --git a/arch/powerpc/boot/dts/p5040ds.dts b/arch/powerpc/boot/dts/p5040ds.dts
index 860b5cc..7e04bf4 100644
--- a/arch/powerpc/boot/dts/p5040ds.dts
+++ b/arch/powerpc/boot/dts/p5040ds.dts
@@ -95,6 +95,26 @@
reg = <0x68>;
interrupts = <0x1 0x1 0 0>;
};
+ ina220@40 {
+ compatible = "ti,ina220";
+ reg = <0x40>;
+ shunt-resistor = <1000>;
+ };
+ ina220@41 {
+ compatible = "ti,ina220";
+ reg = <0x41>;
+ shunt-resistor = <1000>;
+ };
+ ina220@44 {
+ compatible = "ti,ina220";
+ reg = <0x44>;
+ shunt-resistor = <1000>;
+ };
+ ina220@45 {
+ compatible = "ti,ina220";
+ reg = <0x45>;
+ shunt-resistor = <1000>;
+ };
adt7461@4c {
compatible = "adi,adt7461";
reg = <0x4c>;
--
2.1.0.27.g96db324
^ permalink raw reply related
* Re: powerpc: Convert power off logic to pm_power_off topic branch
From: Michael Ellerman @ 2014-11-05 6:56 UTC (permalink / raw)
To: Guenter Roeck; +Cc: linuxppc-dev list, agraf
In-Reply-To: <54585FF0.2030609@roeck-us.net>
On Mon, 2014-11-03 at 21:11 -0800, Guenter Roeck wrote:
> On 11/03/2014 08:47 PM, Michael Ellerman wrote:
> > I've put the pm_power_off patch in a topic branch:
> >
> > https://git.kernel.org/cgit/linux/kernel/git/mpe/linux.git/log/?h=topic/pm-power-off
> Excellent.
>
> Right now all I can do is to wait for Rafael. He was not happy with earlier versions
> of the series and did not yet comment on the most recent version. Since we are already
> at 3.18-rc3 without making real progress, it may well be that the series is going
> to miss 3.19.
OK.
I'll merge the powerpc bits for 3.19 anyway, so if your stuff misses 3.19 then
it will be even simpler for 3.20.
cheers
^ permalink raw reply
* linux-next: build failure after merge of the iommu tree
From: Stephen Rothwell @ 2014-11-05 2:47 UTC (permalink / raw)
To: Joerg Roedel; +Cc: Olav Haugan, linux-next, ppc-dev, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 823 bytes --]
Hi Joerg,
After merging the iommu tree, today's linux-next build (powerpc
pc64_defconfig) failed like this:
In file included from arch/powerpc/platforms/powernv/pci.c:33:0:
arch/powerpc/include/asm/iommu.h:140:12: error: conflicting types for 'iommu_map_sg'
extern int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
^
In file included from arch/powerpc/platforms/powernv/pci.c:23:0:
include/linux/iommu.h:311:22: note: previous definition of 'iommu_map_sg' was here
static inline size_t iommu_map_sg(struct iommu_domain *domain,
^
Caused by commit 315786ebbf4a ("iommu: Add iommu_map_sg() function").
Grep is your friend ...
I have used the iommu tree from next-20141104 for today.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* [PATCH] powerpc: Add ppc64 hard lockup detector support
From: Anton Blanchard @ 2014-11-04 21:46 UTC (permalink / raw)
To: benh, paulus, mpe; +Cc: linuxppc-dev
The hard lockup detector uses a PMU event as a periodic NMI to
detect if we are stuck (where stuck means no timer interrupts have
occurred).
Ben's rework of the ppc64 soft disable code has made ppc64 PMU
exceptions a partial NMI. They can get disabled if an external
interrupt comes in, but otherwise PMU interrupts will fire in
interrupt disabled regions.
We disable the hard lockup detector by default for a few reasons:
- It breaks userspace event based branches on POWER8.
- It is likely to produce false positives on KVM guests.
- Since PMCs can only count to 2^31, counting cycles means we might
take multiple PMU exceptions per second per hardware thread even
if our hard lockup timeout is 10 seconds.
It can be enabled via a boot option, or via procfs.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
arch/Kconfig | 2 +-
arch/powerpc/Kconfig | 1 +
arch/powerpc/include/asm/nmi.h | 4 ++++
arch/powerpc/kernel/setup_64.c | 20 ++++++++++++++++++++
4 files changed, 26 insertions(+), 1 deletion(-)
create mode 100644 arch/powerpc/include/asm/nmi.h
diff --git a/arch/Kconfig b/arch/Kconfig
index 05d7a8a..a8551b0 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -32,7 +32,7 @@ config HAVE_OPROFILE
config OPROFILE_NMI_TIMER
def_bool y
- depends on PERF_EVENTS && HAVE_PERF_EVENTS_NMI
+ depends on (PERF_EVENTS && HAVE_PERF_EVENTS_NMI) && !PPC
config KPROBES
bool "Kprobes"
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 88eace4..03791c4 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -148,6 +148,7 @@ config PPC
select HAVE_ARCH_AUDITSYSCALL
select ARCH_SUPPORTS_ATOMIC_RMW
select DCACHE_WORD_ACCESS if PPC64 && CPU_LITTLE_ENDIAN
+ select HAVE_PERF_EVENTS_NMI if PPC64
config GENERIC_CSUM
def_bool CPU_LITTLE_ENDIAN
diff --git a/arch/powerpc/include/asm/nmi.h b/arch/powerpc/include/asm/nmi.h
new file mode 100644
index 0000000..ff1ccb3
--- /dev/null
+++ b/arch/powerpc/include/asm/nmi.h
@@ -0,0 +1,4 @@
+#ifndef _ASM_NMI_H
+#define _ASM_NMI_H
+
+#endif /* _ASM_NMI_H */
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 1b56320..c368397 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -37,6 +37,7 @@
#include <linux/memblock.h>
#include <linux/hugetlb.h>
#include <linux/memory.h>
+#include <linux/nmi.h>
#include <asm/io.h>
#include <asm/kdump.h>
@@ -781,3 +782,22 @@ unsigned long memory_block_size_bytes(void)
struct ppc_pci_io ppc_pci_io;
EXPORT_SYMBOL(ppc_pci_io);
#endif
+
+#ifdef CONFIG_HARDLOCKUP_DETECTOR
+u64 hw_nmi_get_sample_period(int watchdog_thresh)
+{
+ return ppc_proc_freq * watchdog_thresh;
+}
+
+/*
+ * The hardlockup detector breaks PMU event based branches and is likely
+ * to get false positives in KVM guests, so disable it by default.
+ */
+static int __init disable_hardlockup_detector(void)
+{
+ watchdog_enable_hardlockup_detector(false);
+
+ return 0;
+}
+early_initcall(disable_hardlockup_detector);
+#endif
--
1.9.1
^ permalink raw reply related
* Re: [RFC PATCH] make CONFIG_STRICT_DEVMEM a core non-debug feature
From: Leif Lindholm @ 2014-11-04 20:18 UTC (permalink / raw)
To: Kees Cook
Cc: Catalin Marinas, Will Deacon, Oleg Nesterov, paulus,
H. Peter Anvin, Guan Xuetao, linux-s390, Russell King - ARM Linux,
x86@kernel.org, Christoph Hellwig, Ingo Molnar, dave.long,
eiko.carstens, Arnd Bergmann, Chris Metcalf, Thomas Gleixner,
Arjan van de Ven, linux-arm-kernel@lists.infradead.org, Greg KH,
LKML, Andy Lutomirski, Martin Schwidefsky, linux390,
Andrew Morton, linuxppc-dev
In-Reply-To: <CAGXu5jJnaAFMUBR50TgapRzRcvKS0j=XO7u9z6fdNouwMb=_sQ@mail.gmail.com>
On Tue, Nov 04, 2014 at 12:02:32PM -0800, Kees Cook wrote:
> > I considered doing that, but didn't want to risk listing too many
> > details of one architecture, and too few of others.
>
> Well, the others only say "memory mapped peripherals", so that's what
> I was suggesting adding the x86 language: it was the most detailed
> about what that would really mean to the end-user.
The problem is that this currently isn't strictly speaking true for
some architectures (at least not arm*). Without a standardised memory
map, we are exposing mapping anything not system RAM.
(Patches related to that will follow later this month.)
/
Leif
^ permalink raw reply
* Re: [RFC PATCH] make CONFIG_STRICT_DEVMEM a core non-debug feature
From: Kees Cook @ 2014-11-04 20:02 UTC (permalink / raw)
To: Leif Lindholm
Cc: Catalin Marinas, Will Deacon, Oleg Nesterov, paulus,
H. Peter Anvin, Guan Xuetao, linux-s390, Russell King - ARM Linux,
x86@kernel.org, Christoph Hellwig, Ingo Molnar, dave.long,
eiko.carstens, Arnd Bergmann, Chris Metcalf, Thomas Gleixner,
Arjan van de Ven, linux-arm-kernel@lists.infradead.org, Greg KH,
LKML, Andy Lutomirski, Martin Schwidefsky, linux390,
Andrew Morton, linuxppc-dev
In-Reply-To: <20141104195914.GY22224@bivouac.eciton.net>
On Tue, Nov 4, 2014 at 11:59 AM, Leif Lindholm <leif.lindholm@linaro.org> wrote:
> On Tue, Nov 04, 2014 at 10:43:00AM -0800, Kees Cook wrote:
>> > diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
>> > index efefd12..39f7817 100644
>> > --- a/drivers/char/Kconfig
>> > +++ b/drivers/char/Kconfig
>> > @@ -6,6 +6,22 @@ menu "Character devices"
>> >
>> > source "drivers/tty/Kconfig"
>> >
>> > +config STRICT_DEVMEM
>> > + bool "Reduced access to /dev/mem"
>> > + depends on HAVE_ARCH_RESTRICTED_DEVMEM
>> > + default y
>> > + help
>> > + If this option is disabled, you allow userspace (root) access to all
>> > + of memory, including kernel and userspace memory. Accidental
>> > + access to this is obviously disastrous, but specific access can
>> > + be used by people debugging the kernel.
>> > +
>> > + If this option is switched on, the /dev/mem file restricts userspace
>> > + access to an architecture-specific subset of the physical address
>> > + space.
>>
>> Great consolidation, thanks! I would probably expand this help text a
>> bit to include some of details mentioned in the x86 portion of the
>> option. For example:
>>
>>
>> If this option is switched on, the /dev/mem file restricts userspace
>> access to an architecture-specific subset of the physical address
>> space. For example on x86, PCI space and BIOS code and data
>> regions. This is sufficient for things like dosemu and non-KMS
>> Xorg and all common users of /dev/mem.
>
> I considered doing that, but didn't want to risk listing too many
> details of one architecture, and too few of others.
Well, the others only say "memory mapped peripherals", so that's what
I was suggesting adding the x86 language: it was the most detailed
about what that would really mean to the end-user.
> One alternative would be to add a devmem.txt somewhere in
> Documentation, listing the behaviours on different architectures (this
> would also be a good place to describe restrictions on types of
> mappings and suchlike). The help message could then contain a mention
> of that file. Would that work for you?
That's fine too, but feels like overkill to me. Just adding the x86
example to the common help text seemed like a reasonable consolidation
of the existing help texts. I just didn't want to lose detail when
dropping the x86 text.
> I really don't have a strong opinion however, and would be happy to go
> along with whatever the most people would like to see.
Either way, I'm all for the consolidation. :)
-Kees
--
Kees Cook
Chrome OS Security
^ permalink raw reply
* Re: [RFC PATCH] make CONFIG_STRICT_DEVMEM a core non-debug feature
From: Leif Lindholm @ 2014-11-04 19:59 UTC (permalink / raw)
To: Kees Cook
Cc: Catalin Marinas, Will Deacon, Oleg Nesterov, paulus,
H. Peter Anvin, Guan Xuetao, linux-s390, Russell King - ARM Linux,
x86@kernel.org, Christoph Hellwig, Ingo Molnar, dave.long,
eiko.carstens, Arnd Bergmann, cmetcalf, Thomas Gleixner,
Arjan van de Ven, linux-arm-kernel@lists.infradead.org, Greg KH,
LKML, Andy Lutomirski, Martin Schwidefsky, linux390,
Andrew Morton, linuxppc-dev
In-Reply-To: <CAGXu5jL1BBAvoxVqFa1YHJSMCbGdLiPey-dyC15YKVPB2xGfig@mail.gmail.com>
On Tue, Nov 04, 2014 at 10:43:00AM -0800, Kees Cook wrote:
> > diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
> > index efefd12..39f7817 100644
> > --- a/drivers/char/Kconfig
> > +++ b/drivers/char/Kconfig
> > @@ -6,6 +6,22 @@ menu "Character devices"
> >
> > source "drivers/tty/Kconfig"
> >
> > +config STRICT_DEVMEM
> > + bool "Reduced access to /dev/mem"
> > + depends on HAVE_ARCH_RESTRICTED_DEVMEM
> > + default y
> > + help
> > + If this option is disabled, you allow userspace (root) access to all
> > + of memory, including kernel and userspace memory. Accidental
> > + access to this is obviously disastrous, but specific access can
> > + be used by people debugging the kernel.
> > +
> > + If this option is switched on, the /dev/mem file restricts userspace
> > + access to an architecture-specific subset of the physical address
> > + space.
>
> Great consolidation, thanks! I would probably expand this help text a
> bit to include some of details mentioned in the x86 portion of the
> option. For example:
>
>
> If this option is switched on, the /dev/mem file restricts userspace
> access to an architecture-specific subset of the physical address
> space. For example on x86, PCI space and BIOS code and data
> regions. This is sufficient for things like dosemu and non-KMS
> Xorg and all common users of /dev/mem.
I considered doing that, but didn't want to risk listing too many
details of one architecture, and too few of others.
One alternative would be to add a devmem.txt somewhere in
Documentation, listing the behaviours on different architectures (this
would also be a good place to describe restrictions on types of
mappings and suchlike). The help message could then contain a mention
of that file. Would that work for you?
I really don't have a strong opinion however, and would be happy to go
along with whatever the most people would like to see.
/
Leif
^ permalink raw reply
* Re: [RFC PATCH] make CONFIG_STRICT_DEVMEM a core non-debug feature
From: Kees Cook @ 2014-11-04 18:43 UTC (permalink / raw)
To: Leif Lindholm
Cc: Catalin Marinas, Will Deacon, Oleg Nesterov, metcalf,
H. Peter Anvin, Guan Xuetao, linux-s390, Russell King - ARM Linux,
x86@kernel.org, Christoph Hellwig, Ingo Molnar, dave.long,
eiko.carstens, Arnd Bergmann, linux390, Thomas Gleixner,
Arjan van de Ven, linux-arm-kernel@lists.infradead.org, Greg KH,
LKML, Andy Lutomirski, Martin Schwidefsky, paulus, Andrew Morton,
linuxppc-dev
In-Reply-To: <1415121836-16241-1-git-send-email-leif.lindholm@linaro.org>
On Tue, Nov 4, 2014 at 9:23 AM, Leif Lindholm <leif.lindholm@linaro.org> wrote:
> Most, but not all, architectures supporting CONFIG_STRICT_DEVMEM treat
> it as a debug feature - although its function is pretty much the
> opposite of debug.
>
> This patch deletes all architecture-specific config options and moves
> the option to core code, as a non-debug option.
>
> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
> ---
> Apologies for wide distribution, but this is a bit invasive,
> if trivial.
>
> arch/Kconfig | 3 +++
> arch/arm/Kconfig | 1 +
> arch/arm/Kconfig.debug | 14 --------------
> arch/arm64/Kconfig | 1 +
> arch/arm64/Kconfig.debug | 14 --------------
> arch/powerpc/Kconfig | 1 +
> arch/powerpc/Kconfig.debug | 12 ------------
> arch/s390/Kconfig | 1 +
> arch/s390/Kconfig.debug | 12 ------------
> arch/tile/Kconfig | 4 +---
> arch/unicore32/Kconfig | 1 +
> arch/unicore32/Kconfig.debug | 14 --------------
> arch/x86/Kconfig | 1 +
> arch/x86/Kconfig.debug | 17 -----------------
> drivers/char/Kconfig | 16 ++++++++++++++++
> 15 files changed, 26 insertions(+), 86 deletions(-)
>
> diff --git a/arch/Kconfig b/arch/Kconfig
> index 05d7a8a..e5f4f03 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -484,6 +484,9 @@ config HAVE_IRQ_EXIT_ON_IRQ_STACK
> This spares a stack switch and improves cache usage on softirq
> processing.
>
> +config HAVE_ARCH_RESTRICTED_DEVMEM
> + bool
> +
> #
> # ABI hall of shame
> #
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 89c4b5c..e04910f 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -30,6 +30,7 @@ config ARM
> select HAVE_ARCH_AUDITSYSCALL if (AEABI && !OABI_COMPAT)
> select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
> select HAVE_ARCH_KGDB
> + select HAVE_ARCH_RESTRICTED_DEVMEM if MMU
> select HAVE_ARCH_SECCOMP_FILTER if (AEABI && !OABI_COMPAT)
> select HAVE_ARCH_TRACEHOOK
> select HAVE_BPF_JIT
> diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
> index d8f6a2e..2a02a7d 100644
> --- a/arch/arm/Kconfig.debug
> +++ b/arch/arm/Kconfig.debug
> @@ -14,20 +14,6 @@ config ARM_PTDUMP
> kernel.
> If in doubt, say "N"
>
> -config STRICT_DEVMEM
> - bool "Filter access to /dev/mem"
> - depends on MMU
> - ---help---
> - If this option is disabled, you allow userspace (root) access to all
> - of memory, including kernel and userspace memory. Accidental
> - access to this is obviously disastrous, but specific access can
> - be used by people debugging the kernel.
> -
> - If this option is switched on, the /dev/mem file only allows
> - userspace access to memory mapped peripherals.
> -
> - If in doubt, say Y.
> -
> # RMK wants arm kernels compiled with frame pointers or stack unwinding.
> # If you know what you are doing and are willing to live without stack
> # traces, you can get a slightly smaller kernel by setting this option to
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 9532f8d..90abbb2 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -37,6 +37,7 @@ config ARM64
> select HAVE_ARCH_AUDITSYSCALL
> select HAVE_ARCH_JUMP_LABEL
> select HAVE_ARCH_KGDB
> + select HAVE_ARCH_RESTRICTED_DEVMEM if MMU
> select HAVE_ARCH_TRACEHOOK
> select HAVE_BPF_JIT
> select HAVE_C_RECORDMCOUNT
> diff --git a/arch/arm64/Kconfig.debug b/arch/arm64/Kconfig.debug
> index 0a12933..d0036dd 100644
> --- a/arch/arm64/Kconfig.debug
> +++ b/arch/arm64/Kconfig.debug
> @@ -6,20 +6,6 @@ config FRAME_POINTER
> bool
> default y
>
> -config STRICT_DEVMEM
> - bool "Filter access to /dev/mem"
> - depends on MMU
> - help
> - If this option is disabled, you allow userspace (root) access to all
> - of memory, including kernel and userspace memory. Accidental
> - access to this is obviously disastrous, but specific access can
> - be used by people debugging the kernel.
> -
> - If this option is switched on, the /dev/mem file only allows
> - userspace access to memory mapped peripherals.
> -
> - If in doubt, say Y.
> -
> config PID_IN_CONTEXTIDR
> bool "Write the current PID to the CONTEXTIDR register"
> help
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 88eace4..cd35068 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -148,6 +148,7 @@ config PPC
> select HAVE_ARCH_AUDITSYSCALL
> select ARCH_SUPPORTS_ATOMIC_RMW
> select DCACHE_WORD_ACCESS if PPC64 && CPU_LITTLE_ENDIAN
> + select HAVE_ARCH_RESTRICTED_DEVMEM
>
> config GENERIC_CSUM
> def_bool CPU_LITTLE_ENDIAN
> diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
> index ec2e40f..6f11382 100644
> --- a/arch/powerpc/Kconfig.debug
> +++ b/arch/powerpc/Kconfig.debug
> @@ -334,18 +334,6 @@ config PPC_EARLY_DEBUG_CPM_ADDR
> platform probing is done, all platforms selected must
> share the same address.
>
> -config STRICT_DEVMEM
> - def_bool y
> - prompt "Filter access to /dev/mem"
> - help
> - This option restricts access to /dev/mem. If this option is
> - disabled, you allow userspace access to all memory, including
> - kernel and userspace memory. Accidental memory access is likely
> - to be disastrous.
> - Memory access is required for experts who want to debug the kernel.
> -
> - If you are unsure, say Y.
> -
> config FAIL_IOMMU
> bool "Fault-injection capability for IOMMU"
> depends on FAULT_INJECTION
> diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
> index f2cf1f9..fe92272 100644
> --- a/arch/s390/Kconfig
> +++ b/arch/s390/Kconfig
> @@ -109,6 +109,7 @@ config S390
> select HAVE_ALIGNED_STRUCT_PAGE if SLUB
> select HAVE_ARCH_AUDITSYSCALL
> select HAVE_ARCH_JUMP_LABEL if !MARCH_G5
> + select HAVE_ARCH_RESTRICTED_DEVMEM
> select HAVE_ARCH_SECCOMP_FILTER
> select HAVE_ARCH_TRACEHOOK
> select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT
> diff --git a/arch/s390/Kconfig.debug b/arch/s390/Kconfig.debug
> index c56878e..26c5d5be 100644
> --- a/arch/s390/Kconfig.debug
> +++ b/arch/s390/Kconfig.debug
> @@ -5,18 +5,6 @@ config TRACE_IRQFLAGS_SUPPORT
>
> source "lib/Kconfig.debug"
>
> -config STRICT_DEVMEM
> - def_bool y
> - prompt "Filter access to /dev/mem"
> - ---help---
> - This option restricts access to /dev/mem. If this option is
> - disabled, you allow userspace access to all memory, including
> - kernel and userspace memory. Accidental memory access is likely
> - to be disastrous.
> - Memory access is required for experts who want to debug the kernel.
> -
> - If you are unsure, say Y.
> -
> config S390_PTDUMP
> bool "Export kernel pagetable layout to userspace via debugfs"
> depends on DEBUG_KERNEL
> diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
> index 7cca418..f881168 100644
> --- a/arch/tile/Kconfig
> +++ b/arch/tile/Kconfig
> @@ -27,6 +27,7 @@ config TILE
> select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
> select HAVE_DEBUG_STACKOVERFLOW
> select ARCH_WANT_FRAME_POINTERS
> + select HAVE_ARCH_RESTRICTED_DEVMEM
>
> # FIXME: investigate whether we need/want these options.
> # select HAVE_IOREMAP_PROT
> @@ -110,9 +111,6 @@ config ARCH_DISCONTIGMEM_DEFAULT
> config TRACE_IRQFLAGS_SUPPORT
> def_bool y
>
> -config STRICT_DEVMEM
> - def_bool y
> -
> # SMP is required for Tilera Linux.
> config SMP
> def_bool y
> diff --git a/arch/unicore32/Kconfig b/arch/unicore32/Kconfig
> index 928237a..574b07f 100644
> --- a/arch/unicore32/Kconfig
> +++ b/arch/unicore32/Kconfig
> @@ -18,6 +18,7 @@ config UNICORE32
> select ARCH_WANT_FRAME_POINTERS
> select GENERIC_IOMAP
> select MODULES_USE_ELF_REL
> + select HAVE_ARCH_RESTRICTED_DEVMEM if MMU
> help
> UniCore-32 is 32-bit Instruction Set Architecture,
> including a series of low-power-consumption RISC chip
> diff --git a/arch/unicore32/Kconfig.debug b/arch/unicore32/Kconfig.debug
> index 1a36262..f075bbe 100644
> --- a/arch/unicore32/Kconfig.debug
> +++ b/arch/unicore32/Kconfig.debug
> @@ -2,20 +2,6 @@ menu "Kernel hacking"
>
> source "lib/Kconfig.debug"
>
> -config STRICT_DEVMEM
> - bool "Filter access to /dev/mem"
> - depends on MMU
> - ---help---
> - If this option is disabled, you allow userspace (root) access to all
> - of memory, including kernel and userspace memory. Accidental
> - access to this is obviously disastrous, but specific access can
> - be used by people debugging the kernel.
> -
> - If this option is switched on, the /dev/mem file only allows
> - userspace access to memory mapped peripherals.
> -
> - If in doubt, say Y.
> -
> config EARLY_PRINTK
> def_bool DEBUG_OCD
> help
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index ded8a67..91392bf 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -137,6 +137,7 @@ config X86
> select HAVE_ACPI_APEI_NMI if ACPI
> select ACPI_LEGACY_TABLES_LOOKUP if ACPI
> select X86_FEATURE_NAMES if PROC_FS
> + select HAVE_ARCH_RESTRICTED_DEVMEM
>
> config INSTRUCTION_DECODER
> def_bool y
> diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
> index 61bd2ad..e35d4a1 100644
> --- a/arch/x86/Kconfig.debug
> +++ b/arch/x86/Kconfig.debug
> @@ -5,23 +5,6 @@ config TRACE_IRQFLAGS_SUPPORT
>
> source "lib/Kconfig.debug"
>
> -config STRICT_DEVMEM
> - bool "Filter access to /dev/mem"
> - ---help---
> - If this option is disabled, you allow userspace (root) access to all
> - of memory, including kernel and userspace memory. Accidental
> - access to this is obviously disastrous, but specific access can
> - be used by people debugging the kernel. Note that with PAT support
> - enabled, even in this case there are restrictions on /dev/mem
> - use due to the cache aliasing requirements.
> -
> - If this option is switched on, the /dev/mem file only allows
> - userspace access to PCI space and the BIOS code and data regions.
> - This is sufficient for dosemu and X and all common users of
> - /dev/mem.
> -
> - If in doubt, say Y.
> -
> config X86_VERBOSE_BOOTUP
> bool "Enable verbose x86 bootup info messages"
> default y
> diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
> index efefd12..39f7817 100644
> --- a/drivers/char/Kconfig
> +++ b/drivers/char/Kconfig
> @@ -6,6 +6,22 @@ menu "Character devices"
>
> source "drivers/tty/Kconfig"
>
> +config STRICT_DEVMEM
> + bool "Reduced access to /dev/mem"
> + depends on HAVE_ARCH_RESTRICTED_DEVMEM
> + default y
> + help
> + If this option is disabled, you allow userspace (root) access to all
> + of memory, including kernel and userspace memory. Accidental
> + access to this is obviously disastrous, but specific access can
> + be used by people debugging the kernel.
> +
> + If this option is switched on, the /dev/mem file restricts userspace
> + access to an architecture-specific subset of the physical address
> + space.
Great consolidation, thanks! I would probably expand this help text a
bit to include some of details mentioned in the x86 portion of the
option. For example:
If this option is switched on, the /dev/mem file restricts userspace
access to an architecture-specific subset of the physical address
space. For example on x86, PCI space and BIOS code and data
regions. This is sufficient for things like dosemu and non-KMS
Xorg and all common users of /dev/mem.
Thanks!
-Kees
> +
> + If in doubt, say Y.
> +
> config DEVKMEM
> bool "/dev/kmem virtual device support"
> default y
> --
> 1.7.10.4
>
--
Kees Cook
Chrome OS Security
^ permalink raw reply
* [RFC PATCH] make CONFIG_STRICT_DEVMEM a core non-debug feature
From: Leif Lindholm @ 2014-11-04 17:23 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel, linuxppc-dev, linux-s390
Cc: catalin.marinas, will.deacon, metcalf, hpa, gxt, keescook, linux,
x86, hch, mingo, dave.long, eiko.carstens, arnd, linux390, tglx,
arjan, gregkh, oleg, luto, schwidefsky, paulus, akpm
Most, but not all, architectures supporting CONFIG_STRICT_DEVMEM treat
it as a debug feature - although its function is pretty much the
opposite of debug.
This patch deletes all architecture-specific config options and moves
the option to core code, as a non-debug option.
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
---
Apologies for wide distribution, but this is a bit invasive,
if trivial.
arch/Kconfig | 3 +++
arch/arm/Kconfig | 1 +
arch/arm/Kconfig.debug | 14 --------------
arch/arm64/Kconfig | 1 +
arch/arm64/Kconfig.debug | 14 --------------
arch/powerpc/Kconfig | 1 +
arch/powerpc/Kconfig.debug | 12 ------------
arch/s390/Kconfig | 1 +
arch/s390/Kconfig.debug | 12 ------------
arch/tile/Kconfig | 4 +---
arch/unicore32/Kconfig | 1 +
arch/unicore32/Kconfig.debug | 14 --------------
arch/x86/Kconfig | 1 +
arch/x86/Kconfig.debug | 17 -----------------
drivers/char/Kconfig | 16 ++++++++++++++++
15 files changed, 26 insertions(+), 86 deletions(-)
diff --git a/arch/Kconfig b/arch/Kconfig
index 05d7a8a..e5f4f03 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -484,6 +484,9 @@ config HAVE_IRQ_EXIT_ON_IRQ_STACK
This spares a stack switch and improves cache usage on softirq
processing.
+config HAVE_ARCH_RESTRICTED_DEVMEM
+ bool
+
#
# ABI hall of shame
#
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 89c4b5c..e04910f 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -30,6 +30,7 @@ config ARM
select HAVE_ARCH_AUDITSYSCALL if (AEABI && !OABI_COMPAT)
select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
select HAVE_ARCH_KGDB
+ select HAVE_ARCH_RESTRICTED_DEVMEM if MMU
select HAVE_ARCH_SECCOMP_FILTER if (AEABI && !OABI_COMPAT)
select HAVE_ARCH_TRACEHOOK
select HAVE_BPF_JIT
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index d8f6a2e..2a02a7d 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -14,20 +14,6 @@ config ARM_PTDUMP
kernel.
If in doubt, say "N"
-config STRICT_DEVMEM
- bool "Filter access to /dev/mem"
- depends on MMU
- ---help---
- If this option is disabled, you allow userspace (root) access to all
- of memory, including kernel and userspace memory. Accidental
- access to this is obviously disastrous, but specific access can
- be used by people debugging the kernel.
-
- If this option is switched on, the /dev/mem file only allows
- userspace access to memory mapped peripherals.
-
- If in doubt, say Y.
-
# RMK wants arm kernels compiled with frame pointers or stack unwinding.
# If you know what you are doing and are willing to live without stack
# traces, you can get a slightly smaller kernel by setting this option to
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 9532f8d..90abbb2 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -37,6 +37,7 @@ config ARM64
select HAVE_ARCH_AUDITSYSCALL
select HAVE_ARCH_JUMP_LABEL
select HAVE_ARCH_KGDB
+ select HAVE_ARCH_RESTRICTED_DEVMEM if MMU
select HAVE_ARCH_TRACEHOOK
select HAVE_BPF_JIT
select HAVE_C_RECORDMCOUNT
diff --git a/arch/arm64/Kconfig.debug b/arch/arm64/Kconfig.debug
index 0a12933..d0036dd 100644
--- a/arch/arm64/Kconfig.debug
+++ b/arch/arm64/Kconfig.debug
@@ -6,20 +6,6 @@ config FRAME_POINTER
bool
default y
-config STRICT_DEVMEM
- bool "Filter access to /dev/mem"
- depends on MMU
- help
- If this option is disabled, you allow userspace (root) access to all
- of memory, including kernel and userspace memory. Accidental
- access to this is obviously disastrous, but specific access can
- be used by people debugging the kernel.
-
- If this option is switched on, the /dev/mem file only allows
- userspace access to memory mapped peripherals.
-
- If in doubt, say Y.
-
config PID_IN_CONTEXTIDR
bool "Write the current PID to the CONTEXTIDR register"
help
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 88eace4..cd35068 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -148,6 +148,7 @@ config PPC
select HAVE_ARCH_AUDITSYSCALL
select ARCH_SUPPORTS_ATOMIC_RMW
select DCACHE_WORD_ACCESS if PPC64 && CPU_LITTLE_ENDIAN
+ select HAVE_ARCH_RESTRICTED_DEVMEM
config GENERIC_CSUM
def_bool CPU_LITTLE_ENDIAN
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index ec2e40f..6f11382 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -334,18 +334,6 @@ config PPC_EARLY_DEBUG_CPM_ADDR
platform probing is done, all platforms selected must
share the same address.
-config STRICT_DEVMEM
- def_bool y
- prompt "Filter access to /dev/mem"
- help
- This option restricts access to /dev/mem. If this option is
- disabled, you allow userspace access to all memory, including
- kernel and userspace memory. Accidental memory access is likely
- to be disastrous.
- Memory access is required for experts who want to debug the kernel.
-
- If you are unsure, say Y.
-
config FAIL_IOMMU
bool "Fault-injection capability for IOMMU"
depends on FAULT_INJECTION
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index f2cf1f9..fe92272 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -109,6 +109,7 @@ config S390
select HAVE_ALIGNED_STRUCT_PAGE if SLUB
select HAVE_ARCH_AUDITSYSCALL
select HAVE_ARCH_JUMP_LABEL if !MARCH_G5
+ select HAVE_ARCH_RESTRICTED_DEVMEM
select HAVE_ARCH_SECCOMP_FILTER
select HAVE_ARCH_TRACEHOOK
select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT
diff --git a/arch/s390/Kconfig.debug b/arch/s390/Kconfig.debug
index c56878e..26c5d5be 100644
--- a/arch/s390/Kconfig.debug
+++ b/arch/s390/Kconfig.debug
@@ -5,18 +5,6 @@ config TRACE_IRQFLAGS_SUPPORT
source "lib/Kconfig.debug"
-config STRICT_DEVMEM
- def_bool y
- prompt "Filter access to /dev/mem"
- ---help---
- This option restricts access to /dev/mem. If this option is
- disabled, you allow userspace access to all memory, including
- kernel and userspace memory. Accidental memory access is likely
- to be disastrous.
- Memory access is required for experts who want to debug the kernel.
-
- If you are unsure, say Y.
-
config S390_PTDUMP
bool "Export kernel pagetable layout to userspace via debugfs"
depends on DEBUG_KERNEL
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
index 7cca418..f881168 100644
--- a/arch/tile/Kconfig
+++ b/arch/tile/Kconfig
@@ -27,6 +27,7 @@ config TILE
select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
select HAVE_DEBUG_STACKOVERFLOW
select ARCH_WANT_FRAME_POINTERS
+ select HAVE_ARCH_RESTRICTED_DEVMEM
# FIXME: investigate whether we need/want these options.
# select HAVE_IOREMAP_PROT
@@ -110,9 +111,6 @@ config ARCH_DISCONTIGMEM_DEFAULT
config TRACE_IRQFLAGS_SUPPORT
def_bool y
-config STRICT_DEVMEM
- def_bool y
-
# SMP is required for Tilera Linux.
config SMP
def_bool y
diff --git a/arch/unicore32/Kconfig b/arch/unicore32/Kconfig
index 928237a..574b07f 100644
--- a/arch/unicore32/Kconfig
+++ b/arch/unicore32/Kconfig
@@ -18,6 +18,7 @@ config UNICORE32
select ARCH_WANT_FRAME_POINTERS
select GENERIC_IOMAP
select MODULES_USE_ELF_REL
+ select HAVE_ARCH_RESTRICTED_DEVMEM if MMU
help
UniCore-32 is 32-bit Instruction Set Architecture,
including a series of low-power-consumption RISC chip
diff --git a/arch/unicore32/Kconfig.debug b/arch/unicore32/Kconfig.debug
index 1a36262..f075bbe 100644
--- a/arch/unicore32/Kconfig.debug
+++ b/arch/unicore32/Kconfig.debug
@@ -2,20 +2,6 @@ menu "Kernel hacking"
source "lib/Kconfig.debug"
-config STRICT_DEVMEM
- bool "Filter access to /dev/mem"
- depends on MMU
- ---help---
- If this option is disabled, you allow userspace (root) access to all
- of memory, including kernel and userspace memory. Accidental
- access to this is obviously disastrous, but specific access can
- be used by people debugging the kernel.
-
- If this option is switched on, the /dev/mem file only allows
- userspace access to memory mapped peripherals.
-
- If in doubt, say Y.
-
config EARLY_PRINTK
def_bool DEBUG_OCD
help
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index ded8a67..91392bf 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -137,6 +137,7 @@ config X86
select HAVE_ACPI_APEI_NMI if ACPI
select ACPI_LEGACY_TABLES_LOOKUP if ACPI
select X86_FEATURE_NAMES if PROC_FS
+ select HAVE_ARCH_RESTRICTED_DEVMEM
config INSTRUCTION_DECODER
def_bool y
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index 61bd2ad..e35d4a1 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -5,23 +5,6 @@ config TRACE_IRQFLAGS_SUPPORT
source "lib/Kconfig.debug"
-config STRICT_DEVMEM
- bool "Filter access to /dev/mem"
- ---help---
- If this option is disabled, you allow userspace (root) access to all
- of memory, including kernel and userspace memory. Accidental
- access to this is obviously disastrous, but specific access can
- be used by people debugging the kernel. Note that with PAT support
- enabled, even in this case there are restrictions on /dev/mem
- use due to the cache aliasing requirements.
-
- If this option is switched on, the /dev/mem file only allows
- userspace access to PCI space and the BIOS code and data regions.
- This is sufficient for dosemu and X and all common users of
- /dev/mem.
-
- If in doubt, say Y.
-
config X86_VERBOSE_BOOTUP
bool "Enable verbose x86 bootup info messages"
default y
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index efefd12..39f7817 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -6,6 +6,22 @@ menu "Character devices"
source "drivers/tty/Kconfig"
+config STRICT_DEVMEM
+ bool "Reduced access to /dev/mem"
+ depends on HAVE_ARCH_RESTRICTED_DEVMEM
+ default y
+ help
+ If this option is disabled, you allow userspace (root) access to all
+ of memory, including kernel and userspace memory. Accidental
+ access to this is obviously disastrous, but specific access can
+ be used by people debugging the kernel.
+
+ If this option is switched on, the /dev/mem file restricts userspace
+ access to an architecture-specific subset of the physical address
+ space.
+
+ If in doubt, say Y.
+
config DEVKMEM
bool "/dev/kmem virtual device support"
default y
--
1.7.10.4
^ permalink raw reply related
* Re: [PATCH v3 1/3] QE: move qe code from arch/powerpc to drivers/soc
From: Kumar Gala @ 2014-11-04 17:11 UTC (permalink / raw)
To: qiang.zhao
Cc: Scott Wood, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org, Xiaobo Xie
In-Reply-To: <58731211e1a24702a8b5e18834e88663@BLUPR03MB341.namprd03.prod.outlook.com>
On Oct 31, 2014, at 2:24 AM, qiang.zhao@freescale.com wrote:
> On Oct 30, 2014, at 9:37 AM, Kumar Gala wrote:
>
>
>> -----Original Message-----
>> From: Kumar Gala [mailto:galak@kernel.crashing.org]
>> Sent: Thursday, October 30, 2014 9:37 PM
>> To: Zhao Qiang-B45475
>> Cc: linuxppc-dev@lists.ozlabs.org; linux-kernel@vger.kernel.org; Wood
>> Scott-B07421; Xie Xiaobo-R63061
>> Subject: Re: [PATCH v3 1/3] QE: move qe code from arch/powerpc to
>> drivers/soc
>>
>>
>> On Oct 30, 2014, at 2:31 AM, Zhao Qiang <B45475@freescale.com> wrote:
>>
>>> LS1 is arm cpu and it has qe ip block.
>>> move qe code from platform directory to public directory.
>>>
>>> QE is an IP block integrates several comunications peripheral
>>> controllers. It can implement a variety of applications, such as uart,
>>> usb and tdm and so on.
>>>
>>> Signed-off-by: Zhao Qiang <B45475@freescale.com>
>>> ---
>>> Changes for v2:
>>> - move code to driver/soc
>>> Changes for v3:
>>> - change drivers/soc/qe to drivers/soc/fsl-qe
>>>
>>> arch/powerpc/Kconfig | 2 -
>>> arch/powerpc/platforms/83xx/km83xx.c | 4 +-
>>> arch/powerpc/platforms/83xx/misc.c | 2 +-
>>> arch/powerpc/platforms/83xx/mpc832x_mds.c | 4 +-
>>> arch/powerpc/platforms/83xx/mpc832x_rdb.c | 4 +-
>>> arch/powerpc/platforms/83xx/mpc836x_mds.c | 4 +-
>>> arch/powerpc/platforms/83xx/mpc836x_rdk.c | 4 +-
>>> arch/powerpc/platforms/85xx/common.c | 2 +-
>>> arch/powerpc/platforms/85xx/corenet_generic.c | 2 +-
>>> arch/powerpc/platforms/85xx/mpc85xx_mds.c | 4 +-
>>> arch/powerpc/platforms/85xx/mpc85xx_rdb.c | 4 +-
>>> arch/powerpc/platforms/85xx/twr_p102x.c | 4 +-
>>> arch/powerpc/platforms/Kconfig | 19 ---------
>>> arch/powerpc/sysdev/Makefile | 1 -
>>> arch/powerpc/sysdev/qe_lib/Kconfig | 27 -------------
>>> drivers/net/ethernet/freescale/fsl_pq_mdio.c | 2 +-
>>> drivers/net/ethernet/freescale/ucc_geth.c | 8 ++--
>>> drivers/net/ethernet/freescale/ucc_geth.h | 8 ++--
>>> drivers/soc/Kconfig | 2 +
>>> drivers/soc/Makefile | 1 +
>>> drivers/soc/fsl-qe/Kconfig | 45
>> ++++++++++++++++++++++
>>> .../sysdev/qe_lib => drivers/soc/fsl-qe}/Makefile | 0
>>> .../sysdev/qe_lib => drivers/soc/fsl-qe}/gpio.c | 2 +-
>>> .../sysdev/qe_lib => drivers/soc/fsl-qe}/qe.c | 4 +-
>>> .../sysdev/qe_lib => drivers/soc/fsl-qe}/qe_ic.c | 2 +-
>>> .../sysdev/qe_lib => drivers/soc/fsl-qe}/qe_ic.h | 2 +-
>>> .../sysdev/qe_lib => drivers/soc/fsl-qe}/qe_io.c | 2 +-
>>> .../sysdev/qe_lib => drivers/soc/fsl-qe}/ucc.c | 6 +--
>>> .../qe_lib => drivers/soc/fsl-qe}/ucc_fast.c | 8 ++--
>>> .../qe_lib => drivers/soc/fsl-qe}/ucc_slow.c | 8 ++--
>>> .../sysdev/qe_lib => drivers/soc/fsl-qe}/usb.c | 4 +-
>>> drivers/spi/spi-fsl-cpm.c | 2 +-
>>> drivers/tty/serial/ucc_uart.c | 2 +-
>>> drivers/usb/gadget/fsl_qe_udc.c | 2 +-
>>> drivers/usb/host/fhci-hcd.c | 2 +-
>>> drivers/usb/host/fhci-hub.c | 2 +-
>>> drivers/usb/host/fhci-sched.c | 2 +-
>>> drivers/usb/host/fhci.h | 4 +-
>>> .../include/asm => include/linux/fsl}/immap_qe.h | 0
>>> .../powerpc/include/asm => include/linux/fsl}/qe.h | 2 +-
>>> .../include/asm => include/linux/fsl}/qe_ic.h | 0
>>> .../include/asm => include/linux/fsl}/ucc.h | 4 +-
>>> .../include/asm => include/linux/fsl}/ucc_fast.h | 6 +--
>>> .../include/asm => include/linux/fsl}/ucc_slow.h | 6 +--
>>> 44 files changed, 112 insertions(+), 113 deletions(-) delete mode
>>> 100644 arch/powerpc/sysdev/qe_lib/Kconfig
>>> create mode 100644 drivers/soc/fsl-qe/Kconfig rename
>>> {arch/powerpc/sysdev/qe_lib => drivers/soc/fsl-qe}/Makefile (100%)
>>> rename {arch/powerpc/sysdev/qe_lib => drivers/soc/fsl-qe}/gpio.c (99%)
>>> rename {arch/powerpc/sysdev/qe_lib => drivers/soc/fsl-qe}/qe.c (99%)
>>> rename {arch/powerpc/sysdev/qe_lib => drivers/soc/fsl-qe}/qe_ic.c
>>> (99%) rename {arch/powerpc/sysdev/qe_lib =>
>>> drivers/soc/fsl-qe}/qe_ic.h (98%) rename {arch/powerpc/sysdev/qe_lib
>>> => drivers/soc/fsl-qe}/qe_io.c (99%) rename
>>> {arch/powerpc/sysdev/qe_lib => drivers/soc/fsl-qe}/ucc.c (98%) rename
>>> {arch/powerpc/sysdev/qe_lib => drivers/soc/fsl-qe}/ucc_fast.c (98%)
>>> rename {arch/powerpc/sysdev/qe_lib => drivers/soc/fsl-qe}/ucc_slow.c
>>> (98%) rename {arch/powerpc/sysdev/qe_lib => drivers/soc/fsl-qe}/usb.c
>>> (96%) rename {arch/powerpc/include/asm =>
>>> include/linux/fsl}/immap_qe.h (100%) rename {arch/powerpc/include/asm
>>> => include/linux/fsl}/qe.h (99%) rename {arch/powerpc/include/asm =>
>>> include/linux/fsl}/qe_ic.h (100%) rename {arch/powerpc/include/asm =>
>>> include/linux/fsl}/ucc.h (96%) rename {arch/powerpc/include/asm =>
>>> include/linux/fsl}/ucc_fast.h (98%) rename {arch/powerpc/include/asm
>>> => include/linux/fsl}/ucc_slow.h (99%)
>>
>>
>> So you should be moving things to drivers/soc/fsl/qe/ not
>> drivers/soc/fsl-qe/
>>
>> The headers should be in include/soc/fsl, not include/linux/fsl
>
> I don't understand why I need to put headers in include/soc/fsl,
> Can you explain more?
Because that is the location of headers associated with drivers/soc
- k
^ permalink raw reply
* Re: [PATCH] of/platform: Move platform devices under /sys/devices/platform
From: Greg Kroah-Hartman @ 2014-11-04 16:07 UTC (permalink / raw)
To: Grant Likely
Cc: devicetree, Arnd Bergmann, linux-kernel, Rob Herring,
linuxppc-dev, linux-arm-kernel
In-Reply-To: <1415097920-30014-1-git-send-email-grant.likely@linaro.org>
On Tue, Nov 04, 2014 at 10:45:20AM +0000, Grant Likely wrote:
> Currently the devices created by drivers/of/platform.c get created at
> the root of /sys/devices. This goes against the typical pattern for
> sysfs where the top level /sys/devices structure contains categories of
> devices, and the structure of devices is placed below that. To fix this,
> make the code in drivers/of/platform.c follow the drivers/base/platform.c
> behaviour, and use &platform_bus as the default parent for all new
> platform_devices and amba_devices.
>
> This change has been discussed for a long time, but nobody has actually
> acted on it. Userspace code that expects to find devices under a fixed
> /sys/devices/... path will be affected. It isn't /supposed/ to do that,
> but if anyone complains then I'll add a default-off workaround option to
> put them back into the root.
>
> Signed-off-by: Grant Likely <grant.likely@linaro.org>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply
* Re: [PATCH] of/platform: Move platform devices under /sys/devices/platform
From: Benjamin Herrenschmidt @ 2014-11-04 13:42 UTC (permalink / raw)
To: Grant Likely
Cc: devicetree, Arnd Bergmann, Greg Kroah-Hartman, linux-kernel,
Rob Herring, linuxppc-dev, linux-arm-kernel
In-Reply-To: <1415097920-30014-1-git-send-email-grant.likely@linaro.org>
On Tue, 2014-11-04 at 10:45 +0000, Grant Likely wrote:
> Currently the devices created by drivers/of/platform.c get created at
> the root of /sys/devices. This goes against the typical pattern for
> sysfs where the top level /sys/devices structure contains categories of
> devices, and the structure of devices is placed below that. To fix this,
> make the code in drivers/of/platform.c follow the drivers/base/platform.c
> behaviour, and use &platform_bus as the default parent for all new
> platform_devices and amba_devices.
>
> This change has been discussed for a long time, but nobody has actually
> acted on it. Userspace code that expects to find devices under a fixed
> /sys/devices/... path will be affected. It isn't /supposed/ to do that,
> but if anyone complains then I'll add a default-off workaround option to
> put them back into the root.
Ack !
Cheers,
Ben.
>
> Signed-off-by: Grant Likely <grant.likely@linaro.org>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
> drivers/of/platform.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
> index 3b64d0bf5bba..7c6771986c06 100644
> --- a/drivers/of/platform.c
> +++ b/drivers/of/platform.c
> @@ -138,7 +138,7 @@ struct platform_device *of_device_alloc(struct device_node *np,
> }
>
> dev->dev.of_node = of_node_get(np);
> - dev->dev.parent = parent;
> + dev->dev.parent = parent ? : &platform_bus;
>
> if (bus_id)
> dev_set_name(&dev->dev, "%s", bus_id);
> @@ -291,7 +291,7 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
>
> /* setup generic device info */
> dev->dev.of_node = of_node_get(node);
> - dev->dev.parent = parent;
> + dev->dev.parent = parent ? : &platform_bus;
> dev->dev.platform_data = platform_data;
> if (bus_id)
> dev_set_name(&dev->dev, "%s", bus_id);
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox