Re: [PATCH 2/2] clk: ppc-corenet: don't use platform_driver to init the clock device
On Fri, 2014-10-17 at 06:55 +0800, Kevin Hao wrote: > On Thu, Oct 16, 2014 at 11:55:23PM +0200, Scott Wood wrote: > > On Thu, 2014-10-16 at 19:18 +0800, Kevin Hao wrote: > > > diff --git a/arch/powerpc/platforms/85xx/corenet_generic.c > > > b/arch/powerpc/platforms/85xx/corenet_generic.c > > > index e56b89a792ed..7677cfecb787 100644 > > > --- a/arch/powerpc/platforms/85xx/corenet_generic.c > > > +++ b/arch/powerpc/platforms/85xx/corenet_generic.c > > > @@ -16,6 +16,7 @@ > > > #include > > > #include > > > #include > > > +#include > > > > > > #include > > > #include > > > @@ -188,11 +189,17 @@ static int __init corenet_generic_probe(void) > > > return 0; > > > } > > > > > > +static void __init corenet_gen_init(void) > > > +{ > > > + of_clk_init(NULL); > > > +} > > > > Why is this board-specific? > > I have thought about to put it in a more common place such as time_init(), > but this will be in conflict with mpc512x board. How about add an > arch_initcall(mpc85xx_clk_init) in arch/powerpc/platforms/85xx/common.c? Gerhard, does 512x really require of_clk_init() to be called at that specific time, or can it be replaced by a common of_clk_init()? -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH V2 2/2] arch/powerpc: Switch to generic RCU get_user_pages_fast
This patch switch the ppc arch to use the generic RCU based gup implementation. Signed-off-by: Aneesh Kumar K.V --- Changes from V1: * added pgd_huge definition back 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 | 5 - arch/powerpc/mm/Makefile | 2 +- arch/powerpc/mm/gup.c| 235 --- arch/powerpc/mm/hugetlbpage.c| 27 ++-- 8 files changed, 21 insertions(+), 261 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 623f2971ce0e..7855cce9c969 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 26fe1ae15212..aeca81947dc6 100644 --- a/arch/powerpc/include/asm/page.h +++ b/arch/powerpc/include/asm/page.h @@ -379,12 +379,13 @@ 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)) 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 ae153c40ab7c..29c36242cc6a 100644 --- a/arch/powerpc/include/asm/pgtable-ppc64.h +++ b/arch/powerpc/include/asm/pgtable-ppc64.h @@ -575,6 +575,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..4a67c1ddb91b 100644 --- a/arch/powerpc/include/asm/pgtable.h +++ b/arch/powerpc/include/asm/pgtable.h @@ -274,11 +274,6 @@ 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); #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/power
[PATCH V2 1/2] mm: Update generic gup implementation to handle hugepage directory
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. Signed-off-by: Aneesh Kumar K.V --- Changes from V1: * Folded arm/arm64 related changes into the patch * Dropped pgd_huge from generic header arch/arm/include/asm/pgtable.h | 2 + arch/arm64/include/asm/pgtable.h | 2 + include/linux/mm.h | 26 + mm/gup.c | 113 +++ 4 files changed, 84 insertions(+), 59 deletions(-) diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h index 90aa4583b308..46f81fbaa4a5 100644 --- a/arch/arm/include/asm/pgtable.h +++ b/arch/arm/include/asm/pgtable.h @@ -181,6 +181,8 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; /* to find an entry in a kernel page-table-directory */ #define pgd_offset_k(addr) pgd_offset(&init_mm, addr) +#define pgd_huge(pgd) (0) + #define pmd_none(pmd) (!pmd_val(pmd)) #define pmd_present(pmd) (pmd_val(pmd)) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index cefd3e825612..ed8f42497ac4 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -464,6 +464,8 @@ static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot) extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; extern pgd_t idmap_pg_dir[PTRS_PER_PGD]; +#define pgd_huge(pgd) (0) + /* * Encode and decode a swap entry: * bits 0-1: present (must be zero) diff --git a/include/linux/mm.h b/include/linux/mm.h index 02d11ee7f19d..f97732412cb4 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1219,6 +1219,32 @@ long get_user_pages(struct task_struct *tsk, struct mm_struct *mm, struct vm_area_struct **vmas); int get_user_pages_fast(unsigned long start, int nr_pages, int write, struct page **pages); + +#ifdef CONFIG_HAVE_GENERIC_RCU_GUP +#ifndef is_hugepd +/* + * Some architectures support hugepage directory format that is + * required to support different hugetlbfs sizes. + */ +typedef struct { unsigned long pd; } hugepd_t; +#define is_hugepd(hugepd) (0) +#define __hugepd(x) ((hugepd_t) { (x) }) +static inline int gup_hugepd(hugepd_t hugepd, unsigned long addr, +unsigned pdshift, unsigned long end, +int write, struct page **pages, int *nr) +{ + return 0; +} +#else +extern int gup_hugepd(hugepd_t hugepd, unsigned long addr, + unsigned pdshift, unsigned long end, + int write, struct page **pages, int *nr); +#endif +extern int gup_huge_pte(pte_t orig, pte_t *ptep, unsigned long addr, + unsigned long sz, unsigned long end, int write, + struct page **pages, int *nr); +#endif + struct kvec; int get_kernel_pages(const struct kvec *iov, int nr_pages, int write, struct page **pages); diff --git a/mm/gup.c b/mm/gup.c index cd62c8c90d4a..13c560ef9ddf 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -786,65 +786,31 @@ static int gup_pte_range(pmd_t pmd, unsigned long addr, unsigned long end, } #endif /* __HAVE_ARCH_PTE_SPECIAL */ -static int gup_huge_pmd(pmd_t orig, pmd_t *pmdp, unsigned long addr, - unsigned long end, int write, struct page **pages, int *nr) +int gup_huge_pte(pte_t orig, pte_t *ptep, unsigned long addr, +unsigned long sz, unsigned long end, int write, +struct page **pages, int *nr) { - struct page *head, *page, *tail; int refs; + unsigned long pte_end; + struct page *head, *page, *tail; - if (write && !pmd_write(orig)) - return 0; - - refs = 0; - head = pmd_page(orig); - page = head + ((addr & ~PMD_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; + if (write && !pte_write(orig)) return 0; - } - if (unlikely(pmd_val(orig) != pmd_val(*pmdp))) { - *nr -= refs; - while (refs--) - put_page(head); + if (!pte_present(orig)) return 0; - } - /* -* Any tail pages need their mapcount reference taken before we -* return. (This allows the THP code to bump their ref count when -* they are split into base pages). -*/ - while (refs--) { - if (PageTail(tail)) - get_huge_page_tail(tail); - tail++; - } - - return 1; -} - -static int gup_huge_pud(pud_t orig, pud_t
Re: [PATCH 1/3] qe-uart: modify qe-uart to adapt both powerpc and arm
On Mon, 2014-10-13 at 11:30 -0500, Timur Tabi wrote: > On Fri, Oct 10, 2014 at 1:05 PM, Scott Wood wrote: > > There are many changes in here that ought to be separate patches with > > separate justification. > > > > Also, some of the QE changes seem to be reasonable cleanup, but not > > related to making the code work on ARM. > > I agree with Scott. This patch already makes significant code > changes, so you should have one patch that just makes the > out_be32->iowrite32be changes. Changes to the QE library should NOT > be in the same patch as changes to ucc_uart.c. > > In addition, changes like this: > > - iprop = of_get_property(np, "port-number", NULL); > - if (!iprop) { > + ret = of_property_read_u32_index(np, "port-number", 0, &val); > + if (ret) { > > should be changed to remove the OF dependency. If you're going to > replace of_get_property, replace it with device_property_read_u32(), > to remove the OF dependency. > > >> diff --git a/arch/arm/include/asm/delay.h b/arch/arm/include/asm/delay.h > >> index dff714d..a932f99 100644 > >> --- a/arch/arm/include/asm/delay.h > >> +++ b/arch/arm/include/asm/delay.h > >> @@ -57,6 +57,22 @@ extern void __bad_udelay(void); > >> __const_udelay((n) * UDELAY_MULT)) :\ > >> __udelay(n)) > >> > >> +#define spin_event_timeout(condition, timeout, delay) > >> \ > >> +({ > >> \ > >> + typeof(condition) __ret; > >> \ > >> + int i = 0; > >> \ > >> + while (!(__ret = (condition)) && (i++ < timeout)) { > >> \ > >> + if (delay) > >> \ > >> + udelay(delay); > >> \ > >> + else > >> \ > >> + cpu_relax(); > >> \ > >> + udelay(1); > >> \ > >> + } > >> \ > > > > This will delay too long if "delay" is used. > > Shouldn't ARM have a version of tb_ticks_since() by now? There's get_cycles(), but it's not clear to me whether loops_per_jiffy is OK to use with get_cycles() on 32-bit ARM. Is avoiding the udelay worth making this non-generic? > > >> + if (!__ret) > >> \ > >> + __ret = (condition); > >> \ > >> + __ret; > >> \ > > > > Timur, do you remember why that final "if (!__ret) __ret = (condition);" > > is needed? > > powerpc: Fix spin_event_timeout() to be robust over context switches > > Current implementation of spin_event_timeout can be interrupted by an > IRQ or context switch after testing the condition, but before checking > the timeout. This can cause the loop to report a timeout when the > condition actually became true in the middle. > > This patch adds one final check of the condition upon exit of the loop > if the last test of the condition was still false. OK, so this shouldn't be needed in the udelay version, since an interrupt shouldn't cause a significant difference in the timeout count. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] cpufreq: qoriq: Make the driver usable on all QorIQ platforms
From: Tang Yuantian Freescale introduced new ARM core-based SoCs which support dynamic frequency switch feature. DFS on new SoCs are compatible with current PowerPC CoreNet platforms. In order to support those new platforms, this driver needs to be slightly adjusted. The main changes include: 1. Changed the names of driver and functions in driver. 2. Added two new functions get_cpu_physical_id() and get_bus_freq(). 3. Used a new way to get all the CPUs which sharing clock wire. Signed-off-by: Tang Yuantian --- drivers/cpufreq/Kconfig.arm| 8 ++ drivers/cpufreq/Kconfig.powerpc| 11 +- drivers/cpufreq/Makefile | 2 +- .../{ppc-corenet-cpufreq.c => qoriq-cpufreq.c} | 150 ++--- 4 files changed, 114 insertions(+), 57 deletions(-) rename drivers/cpufreq/{ppc-corenet-cpufreq.c => qoriq-cpufreq.c} (72%) diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm index 83a75dc..1925ae94 100644 --- a/drivers/cpufreq/Kconfig.arm +++ b/drivers/cpufreq/Kconfig.arm @@ -247,3 +247,11 @@ config ARM_TEGRA_CPUFREQ default y help This adds the CPUFreq driver support for TEGRA SOCs. + +config QORIQ_CPUFREQ + tristate "CPU frequency scaling driver for Freescale QorIQ SoCs" + depends on OF && COMMON_CLK + select CLK_PPC_CORENET + help + This adds the CPUFreq driver support for Freescale QorIQ SoCs + which are capable of changing the CPU's frequency dynamically. diff --git a/drivers/cpufreq/Kconfig.powerpc b/drivers/cpufreq/Kconfig.powerpc index 72564b7..3a34248 100644 --- a/drivers/cpufreq/Kconfig.powerpc +++ b/drivers/cpufreq/Kconfig.powerpc @@ -23,14 +23,13 @@ config CPU_FREQ_MAPLE This adds support for frequency switching on Maple 970FX Evaluation Board and compatible boards (IBM JS2x blades). -config PPC_CORENET_CPUFREQ - tristate "CPU frequency scaling driver for Freescale E500MC SoCs" - depends on PPC_E500MC && OF && COMMON_CLK +config QORIQ_CPUFREQ + tristate "CPU frequency scaling driver for Freescale QorIQ SoCs" + depends on OF && COMMON_CLK select CLK_PPC_CORENET help - This adds the CPUFreq driver support for Freescale e500mc, - e5500 and e6500 series SoCs which are capable of changing - the CPU's frequency dynamically. + This adds the CPUFreq driver support for Freescale QorIQ SoCs + which are capable of changing the CPU's frequency dynamically. config CPU_FREQ_PMAC bool "Support for Apple PowerBooks" diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile index 40c53dc..0020049 100644 --- a/drivers/cpufreq/Makefile +++ b/drivers/cpufreq/Makefile @@ -84,7 +84,7 @@ obj-$(CONFIG_CPU_FREQ_CBE)+= ppc-cbe-cpufreq.o ppc-cbe-cpufreq-y += ppc_cbe_cpufreq_pervasive.o ppc_cbe_cpufreq.o obj-$(CONFIG_CPU_FREQ_CBE_PMI) += ppc_cbe_cpufreq_pmi.o obj-$(CONFIG_CPU_FREQ_MAPLE) += maple-cpufreq.o -obj-$(CONFIG_PPC_CORENET_CPUFREQ) += ppc-corenet-cpufreq.o +obj-$(CONFIG_QORIQ_CPUFREQ)+= qoriq-cpufreq.o obj-$(CONFIG_CPU_FREQ_PMAC)+= pmac32-cpufreq.o obj-$(CONFIG_CPU_FREQ_PMAC64) += pmac64-cpufreq.o obj-$(CONFIG_PPC_PASEMI_CPUFREQ) += pasemi-cpufreq.o diff --git a/drivers/cpufreq/ppc-corenet-cpufreq.c b/drivers/cpufreq/qoriq-cpufreq.c similarity index 72% rename from drivers/cpufreq/ppc-corenet-cpufreq.c rename to drivers/cpufreq/qoriq-cpufreq.c index bee5df7..80def0c 100644 --- a/drivers/cpufreq/ppc-corenet-cpufreq.c +++ b/drivers/cpufreq/qoriq-cpufreq.c @@ -1,7 +1,7 @@ /* * Copyright 2013 Freescale Semiconductor, Inc. * - * CPU Frequency Scaling driver for Freescale PowerPC corenet SoCs. + * CPU Frequency Scaling driver for Freescale QorIQ SoCs. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -20,7 +20,6 @@ #include #include #include -#include /** * struct cpu_data - per CPU data struct @@ -69,9 +68,6 @@ static const u32 *fmask; static DEFINE_PER_CPU(struct cpu_data *, cpu_data); -/* cpumask in a cluster */ -static DEFINE_PER_CPU(cpumask_var_t, cpu_mask); - #ifndef CONFIG_SMP static inline const struct cpumask *cpu_core_mask(int cpu) { @@ -79,6 +75,79 @@ static inline const struct cpumask *cpu_core_mask(int cpu) } #endif +#if defined(CONFIG_PPC_E500MC) +static int get_cpu_physical_id(int cpu) +{ + return get_hard_smp_processor_id(cpu); +} +#elif defined(CONFIG_ARM) +static int get_cpu_physical_id(int cpu) +{ + return topology_core_id(cpu); +} +#endif + +static u32 get_bus_freq(void) +{ + struct device_node *soc; + u32 sysfreq; + + soc = of_find_node_by_type(NULL, "soc"); + if (!soc) + return 0; + + if (of_property_read_u32(soc, "bus-frequency", &sysfreq)) +
RE: [PATCH v3] dmaengine: driver support for FSL RaidEngine device.
Hi Dan & Vinod, I have sent out the v4 of this patch and not received any further feedback yet. This patch looks ruled out from the patchwork. https://patchwork.kernel.org/project/linux-dmaengine/list/?page=2 So do you know what happened to this patch? Thanks, Xuelin Shi -Original Message- From: Shi Xuelin-B29237 Sent: 2014年4月15日 11:08 To: 'Dan Williams' Cc: Koul, Vinod; andriy.shevche...@intel.com; dmaeng...@vger.kernel.org; linuxppc-dev; Rai Harninder-B01044; Burmi Naveen-B16502 Subject: RE: [PATCH v3] dmaengine: driver support for FSL RaidEngine device. Yes, "depend on !ASYNC_TX_CHANNEL_SWITCH" is better since fsldma selects this condition. Thanks, Xuelin Shi -Original Message- From: Dan Williams [mailto:dan.j.willi...@intel.com] Sent: 2014年4月15日 8:30 To: Shi Xuelin-B29237 Cc: Koul, Vinod; andriy.shevche...@intel.com; dmaeng...@vger.kernel.org; linuxppc-dev; Rai Harninder-B01044; Burmi Naveen-B16502 Subject: Re: [PATCH v3] dmaengine: driver support for FSL RaidEngine device. On Sun, Apr 13, 2014 at 7:48 PM, Xuelin Shi wrote: > Hi Dan, > > fsl dma device and fsl raid device are two differenct devices that > both provide async_memcpy capability, so I use !FSL_DMA to disable the fsl > dma device. > > That's to say, either select fsldma device, either fsl raid device. > Right, but that's not what your proposed Kconfig dependency line does. You want something like "depends on FSL_SOC && !(FSL_DMA || FSL_DMA=m)" However, the more problematic option is ASYNC_TX_CHANNEL_SWITCH. That option is problematic for RAID, so I propose "depend on !ASYNC_TX_CHANNEL_SWITCH" since that addresses both problems. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v3 22/27] s390/MSI: Use MSI chip framework to configure MSI/MSI-X irq
On 2014/10/16 20:13, Sebastian Ott wrote: > On Wed, 15 Oct 2014, Yijing Wang wrote: >> Use MSI chip framework instead of arch MSI functions to configure >> MSI/MSI-X irq. So we can manage MSI/MSI-X irq in a unified framework. >> >> Signed-off-by: Yijing Wang >> --- >> Hi Sebastian, >>I dropped the Acked-by , because this version has a >> lot changes compared to last. So, I guess you may want to check it again. > > I did and I agree with that one too. Thanks very much! Thanks! Yijing. > > Regards, > Sebastian > >> --- >> arch/s390/include/asm/pci.h |9 + >> arch/s390/pci/pci.c | 12 ++-- >> 2 files changed, 19 insertions(+), 2 deletions(-) >> >> diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h >> index c030900..4d41f08 100644 >> --- a/arch/s390/include/asm/pci.h >> +++ b/arch/s390/include/asm/pci.h >> @@ -88,6 +88,8 @@ struct zpci_dev { >> u32 uid;/* user defined id */ >> u8 util_str[CLP_UTIL_STR_LEN]; /* utility string */ >> >> +struct msi_chip *msi_chip; >> + >> /* IRQ stuff */ >> u64 msi_addr; /* MSI address */ >> struct airq_iv *aibv; /* adapter interrupt bit vector */ >> @@ -121,6 +123,13 @@ struct zpci_dev { >> struct dentry *debugfs_perf; >> }; >> >> +static inline struct msi_chip *pci_msi_chip(struct pci_bus *bus) >> +{ >> +struct zpci_dev *zpci = bus->sysdata; >> + >> +return zpci->msi_chip; >> +} >> + >> static inline bool zdev_enabled(struct zpci_dev *zdev) >> { >> return (zdev->fh & (1UL << 31)) ? true : false; >> diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c >> index 552b990..bf6732f 100644 >> --- a/arch/s390/pci/pci.c >> +++ b/arch/s390/pci/pci.c >> @@ -358,7 +358,8 @@ static void zpci_irq_handler(struct airq_struct *airq) >> } >> } >> >> -int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) >> +static int zpci_setup_msi_irqs(struct msi_chip *chip, >> +struct pci_dev *pdev, int nvec, int type) >> { >> struct zpci_dev *zdev = get_zdev(pdev); >> unsigned int hwirq, msi_vecs; >> @@ -434,7 +435,8 @@ out: >> return rc; >> } >> >> -void arch_teardown_msi_irqs(struct pci_dev *pdev) >> +static void zpci_teardown_msi_irqs(struct msi_chip *chip, >> +struct pci_dev *pdev) >> { >> struct zpci_dev *zdev = get_zdev(pdev); >> struct msi_desc *msi; >> @@ -464,6 +466,11 @@ void arch_teardown_msi_irqs(struct pci_dev *pdev) >> airq_iv_free_bit(zpci_aisb_iv, zdev->aisb); >> } >> >> +static struct msi_chip zpci_msi_chip = { >> +.setup_irqs = zpci_setup_msi_irqs, >> +.teardown_irqs = zpci_teardown_msi_irqs, >> +}; >> + >> static void zpci_map_resources(struct zpci_dev *zdev) >> { >> struct pci_dev *pdev = zdev->pdev; >> @@ -749,6 +756,7 @@ static int zpci_scan_bus(struct zpci_dev *zdev) >> if (ret) >> return ret; >> >> +zdev->msi_chip = &zpci_msi_chip; >> zdev->bus = pci_scan_root_bus(NULL, ZPCI_BUS_NR, &pci_root_ops, >>zdev, &resources); >> if (!zdev->bus) { >> -- >> 1.7.1 >> >> > > > . > -- Thanks! Yijing ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 2/2] clk: ppc-corenet: don't use platform_driver to init the clock device
On Thu, Oct 16, 2014 at 11:55:23PM +0200, Scott Wood wrote: > On Thu, 2014-10-16 at 19:18 +0800, Kevin Hao wrote: > > diff --git a/arch/powerpc/platforms/85xx/corenet_generic.c > > b/arch/powerpc/platforms/85xx/corenet_generic.c > > index e56b89a792ed..7677cfecb787 100644 > > --- a/arch/powerpc/platforms/85xx/corenet_generic.c > > +++ b/arch/powerpc/platforms/85xx/corenet_generic.c > > @@ -16,6 +16,7 @@ > > #include > > #include > > #include > > +#include > > > > #include > > #include > > @@ -188,11 +189,17 @@ static int __init corenet_generic_probe(void) > > return 0; > > } > > > > +static void __init corenet_gen_init(void) > > +{ > > + of_clk_init(NULL); > > +} > > Why is this board-specific? I have thought about to put it in a more common place such as time_init(), but this will be in conflict with mpc512x board. How about add an arch_initcall(mpc85xx_clk_init) in arch/powerpc/platforms/85xx/common.c? Thanks, Kevin pgpi6xgSN8uoY.pgp Description: PGP signature ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] drivers/crypto/nx: prevent oops on module exit
On Fri, 2014-10-17 at 09:43 +1100, Michael Ellerman wrote: > On Thu, 2014-10-16 at 15:30 -0400, Dan Streetman wrote: > > Check old_devdata->dev in nx-842 driver before accessing it, as > > on systems without any nx-842 hardware, the ->dev will never be > > set. Currently, the module will cause an oops during unload > > since old_devdata->dev is null. > > Hi Dan, > > Patch looks reasonable. But I can't merge it, at least not without an ACK: > > $ ./scripts/get_maintainer.pl -f drivers/crypto/nx/ > Nathan Fontenot (supporter:IBM Power 842 com...) > Marcelo Henrique Cerri (supporter:IBM Power > in-Nest...) > Fionnuala Gunter (supporter:IBM Power in-Nest...) > Herbert Xu (maintainer:CRYPTO API) > "David S. Miller" (maintainer:CRYPTO API) > linux-cry...@vger.kernel.org (open list:IBM Power in-Nest...) > linux-ker...@vger.kernel.org (open list) > > > If any of the above is out of date please send me a patch for MAINTAINERS. I think Dan now owns that driver, Dan, please confirm. Cheers, Ben. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] drivers/crypto/nx: prevent oops on module exit
On Thu, 2014-10-16 at 15:30 -0400, Dan Streetman wrote: > Check old_devdata->dev in nx-842 driver before accessing it, as > on systems without any nx-842 hardware, the ->dev will never be > set. Currently, the module will cause an oops during unload > since old_devdata->dev is null. Hi Dan, Patch looks reasonable. But I can't merge it, at least not without an ACK: $ ./scripts/get_maintainer.pl -f drivers/crypto/nx/ Nathan Fontenot (supporter:IBM Power 842 com...) Marcelo Henrique Cerri (supporter:IBM Power in-Nest...) Fionnuala Gunter (supporter:IBM Power in-Nest...) Herbert Xu (maintainer:CRYPTO API) "David S. Miller" (maintainer:CRYPTO API) linux-cry...@vger.kernel.org (open list:IBM Power in-Nest...) linux-ker...@vger.kernel.org (open list) If any of the above is out of date please send me a patch for MAINTAINERS. cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/2] powerpc: move ppc_init() to common place
On Thu, Oct 16, 2014 at 11:54:46PM +0200, Scott Wood wrote: > On Thu, 2014-10-16 at 19:18 +0800, Kevin Hao wrote: > > So they can be used by ppc64 board. Also remove the unneeded {} to > > make checkpatch happy. > > > > Signed-off-by: Kevin Hao > > --- > > arch/powerpc/include/asm/machdep.h | 2 +- > > arch/powerpc/kernel/setup-common.c | 15 +++ > > arch/powerpc/kernel/setup_32.c | 15 --- > > 3 files changed, 16 insertions(+), 16 deletions(-) > > This is unnecessary -- why not just use machine_arch_initcall? OK, I will drop this patch. Thanks, Kevin pgpfQDvy1QLfz.pgp Description: PGP signature ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 0/2] fix a kernel panic on fsl corenet board when CONFIG_CLK_PPC_CORENET is enabled
On Thu, Oct 16, 2014 at 11:49:22PM +0200, Scott Wood wrote: > On Thu, 2014-10-16 at 19:18 +0800, Kevin Hao wrote: > > Hi, > > > > This tries to fix a kernel panic introduced by commit da788acb2838 > > ("clk: ppc-corenet: Fix Section mismatch warning"). > > That patch is just wrong and should be reverted, separately from any new > attempt to fix the section mismatch warning. OK, I will make a patch to revert that first. Thanks, Kevin pgpbD3YgQX_VU.pgp Description: PGP signature ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 2/2] clk: ppc-corenet: don't use platform_driver to init the clock device
On Thu, 2014-10-16 at 19:18 +0800, Kevin Hao wrote: > In commit da788acb2838 ("clk: ppc-corenet: Fix Section mismatch > warning"), we put the ppc_corenet_clk_driver struct to init section > in order to fix section mismatch warning. This is definitely wrong > because the kernel would free the memories occupied by > ppc_corenet_clk_driver after boot while this driver is still registered > in the driver core. The kernel would panic when accessing this driver > struct. So choose to use CLK_OF_DECLARE to scan and init the clock devices. > > Signed-off-by: Kevin Hao > --- > arch/powerpc/platforms/85xx/corenet_generic.c | 7 + > drivers/clk/clk-ppc-corenet.c | 43 > --- > 2 files changed, 13 insertions(+), 37 deletions(-) > > diff --git a/arch/powerpc/platforms/85xx/corenet_generic.c > b/arch/powerpc/platforms/85xx/corenet_generic.c > index e56b89a792ed..7677cfecb787 100644 > --- a/arch/powerpc/platforms/85xx/corenet_generic.c > +++ b/arch/powerpc/platforms/85xx/corenet_generic.c > @@ -16,6 +16,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -188,11 +189,17 @@ static int __init corenet_generic_probe(void) > return 0; > } > > +static void __init corenet_gen_init(void) > +{ > + of_clk_init(NULL); > +} Why is this board-specific? -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/2] powerpc: move ppc_init() to common place
On Thu, 2014-10-16 at 19:18 +0800, Kevin Hao wrote: > So they can be used by ppc64 board. Also remove the unneeded {} to > make checkpatch happy. > > Signed-off-by: Kevin Hao > --- > arch/powerpc/include/asm/machdep.h | 2 +- > arch/powerpc/kernel/setup-common.c | 15 +++ > arch/powerpc/kernel/setup_32.c | 15 --- > 3 files changed, 16 insertions(+), 16 deletions(-) This is unnecessary -- why not just use machine_arch_initcall? -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 0/2] fix a kernel panic on fsl corenet board when CONFIG_CLK_PPC_CORENET is enabled
On Thu, 2014-10-16 at 19:18 +0800, Kevin Hao wrote: > Hi, > > This tries to fix a kernel panic introduced by commit da788acb2838 > ("clk: ppc-corenet: Fix Section mismatch warning"). That patch is just wrong and should be reverted, separately from any new attempt to fix the section mismatch warning. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v2] powerpc: Only do dynamic DMA zone limits on platforms that need it
On Thu, 2014-10-16 at 17:47 +1100, Michael Ellerman wrote: > Scott's patch 1c98025c6c95 "Dynamic DMA zone limits" changed > dma_direct_alloc_coherent() to start using dev->coherent_dma_mask. > > That seems fair enough, but it exposes the fact that some of the drivers > we care about on IBM platforms aren't setting the coherent mask. > > The proper fix is to have drivers set the coherent mask and also have > the platform code honor it. > > For now, just restrict the dynamic DMA zone limits to the platforms that > need it. > > Signed-off-by: Michael Ellerman > --- > arch/powerpc/kernel/dma.c | 8 > 1 file changed, 8 insertions(+) > > v2: Use FSL_SOC. Acked-by: Scott Wood -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] drivers/crypto/nx: prevent oops on module exit
Check old_devdata->dev in nx-842 driver before accessing it, as on systems without any nx-842 hardware, the ->dev will never be set. Currently, the module will cause an oops during unload since old_devdata->dev is null. Signed-off-by: Dan Streetman --- Also Seth and Rob, you guys should change your emails in this driver, your IBM emails are still listed. drivers/crypto/nx/nx-842.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/nx/nx-842.c b/drivers/crypto/nx/nx-842.c index 061407d..809a220 100644 --- a/drivers/crypto/nx/nx-842.c +++ b/drivers/crypto/nx/nx-842.c @@ -1269,7 +1269,7 @@ static void __exit nx842_exit(void) RCU_INIT_POINTER(devdata, NULL); spin_unlock_irqrestore(&devdata_mutex, flags); synchronize_rcu(); - if (old_devdata) + if (old_devdata && old_devdata->dev) dev_set_drvdata(old_devdata->dev, NULL); kfree(old_devdata); vio_unregister_driver(&nx842_driver); -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/2] mm: Update generic gup implementation to handle hugepage directory
Steve Capper writes: > Can we not just add a: > #define pgd_huge(pgd) (0) > above the "#endif /* CONFIG_HUGETLB_PAGE */" line in the second patch? > (or, more precisely, prevent the second patch from removing this line). > > That way we get a clearer code overall? it is strange to have both pmd_huge and pud_huge in hugetlb.h and pgd_huge in page.h. But if that is what we want then we may need. diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h index aa430ec14895..aeca81947dc6 100644 --- a/arch/powerpc/include/asm/page.h +++ b/arch/powerpc/include/asm/page.h @@ -383,6 +383,7 @@ static inline int hugepd_ok(hugepd_t hpd) 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) }) ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/2] mm: Update generic gup implementation to handle hugepage directory
On Thu, Oct 16, 2014 at 08:48:20PM +0530, Aneesh Kumar K.V wrote: > Steve Capper writes: > > > On Wed, Oct 15, 2014 at 10:04:47PM +0530, Aneesh Kumar K.V wrote: > >> 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. > >> > >> Signed-off-by: Aneesh Kumar K.V > > > > Hi, > > This patch causes compiler errors on arm and arm64 due to pgd_huge > > being undefined. I've attached a fixup below, this fixup will require > > that #define pgd_huge(pgd) 0 be added back into: > > arch/powerpc/include/asm/page.h > > For the second patch in this series. > > > > Another avenue would be to do something like: > > #ifndef pgd_huge > > #define pgd_huge(pgd) (0) > > #endif > > > > Then no changes would be required to arm and arm64 (or other > > architectures). > > > > To help with bisectability, could we please have a suitable fix applied > > to the two patches in the -mm tree: > > http://ozlabs.org/~akpm/mmots/broken-out/mm-update-generic-gup-implementation-to-handle-hugepage-directory.patch > > http://ozlabs.org/~akpm/mmots/broken-out/arch-powerpc-switch-to-generic-rcu-get_user_pages_fast.patch > > > > rather than applied afterwards? > > > > With pgd_huge(x) defined, this patch passes my futex test on arm > > (Arndale platform) and arm64(Juno). > > > > Cheers, > > -- > > Steve > > > > > > > > From 2fb7b0308f0aca94c50611257ba82d656abb0768 Mon Sep 17 00:00:00 2001 > > From: Steve Capper > > Date: Thu, 16 Oct 2014 09:09:48 +0100 > > Subject: [PATCH] Fixup for Update generic gup implementation > > > > The patch: > > mm: Update generic gup implementation to handle hugepage directory > > > > will not compile for arm or arm64 due to pgd_huge being undefined. > > > > Signed-off-by: Steve Capper > > --- > > arch/arm/include/asm/pgtable.h | 2 ++ > > arch/arm64/include/asm/pgtable.h | 2 ++ > > include/linux/hugetlb.h | 1 - > > 3 files changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h > > index 90aa4583..46f81fb 100644 > > --- a/arch/arm/include/asm/pgtable.h > > +++ b/arch/arm/include/asm/pgtable.h > > @@ -181,6 +181,8 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; > > /* to find an entry in a kernel page-table-directory */ > > #define pgd_offset_k(addr) pgd_offset(&init_mm, addr) > > > > +#define pgd_huge(pgd) (0) > > + > > #define pmd_none(pmd) (!pmd_val(pmd)) > > #define pmd_present(pmd) (pmd_val(pmd)) > > > > diff --git a/arch/arm64/include/asm/pgtable.h > > b/arch/arm64/include/asm/pgtable.h > > index 464c5ce..d4462ca 100644 > > --- a/arch/arm64/include/asm/pgtable.h > > +++ b/arch/arm64/include/asm/pgtable.h > > @@ -462,6 +462,8 @@ static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t > > newprot) > > extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; > > extern pgd_t idmap_pg_dir[PTRS_PER_PGD]; > > > > +#define pgd_huge(pgd) (0) > > + > > /* > > * Encode and decode a swap entry: > > * bits 0-1: present (must be zero) > > diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h > > index 65e12a2..6e6d338 100644 > > --- a/include/linux/hugetlb.h > > +++ b/include/linux/hugetlb.h > > @@ -138,7 +138,6 @@ static inline void hugetlb_show_meminfo(void) > > #define prepare_hugepage_range(file, addr, len)(-EINVAL) > > #define pmd_huge(x)0 > > #define pud_huge(x)0 > > -#define pgd_huge(x)0 > > #define is_hugepage_only_range(mm, addr, len) 0 > > #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; > > }) > > #define hugetlb_fault(mm, vma, addr, flags)({ BUG(); 0; }) > > don't do the last hunk, that will result in build failures on sub > platforms on ppc64. can you do the arm patch without making the change > to hugetlb.h ? > Hi Aneesh, The problem with leaving the empty pgd_huge in hugetlb.h is that we would then have to resort to patterns like this for both arm and arm64: #ifdef CONFIG_HUGETLB_PAGE #define pgd_huge(pgd) (0) #endif If possible, I'd much rather just have: #define pgd_huge(pgd) (0) After the second patch in this series we already have the following code pattern in arch/powerpc/include/asm/page.h: #define is_hugepd(hpd) (hugepd_ok(hpd)) int pgd_huge(pgd_t pgd); #else /* CONFIG_HUGETLB_PAGE */ #define is_hugepd(pdep)0 #endif /* CONFIG_HUGETLB_PAGE */ #define __hugepd(x) ((hugepd_t) { (x) }) Can we not just add a: #define pgd_huge(pgd) (0) above the "#endif /* CONFIG_HUGETLB_PAGE */" line in the second patch? (or, more precisely, prevent the second patch from removing this line). That way we get a clearer code overall? Cheers, -- Steve ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/2] mm: Update generic gup implementation to handle hugepage directory
Steve Capper writes: > On Wed, Oct 15, 2014 at 10:04:47PM +0530, Aneesh Kumar K.V wrote: >> 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. >> >> Signed-off-by: Aneesh Kumar K.V > > Hi, > This patch causes compiler errors on arm and arm64 due to pgd_huge > being undefined. I've attached a fixup below, this fixup will require > that #define pgd_huge(pgd) 0 be added back into: > arch/powerpc/include/asm/page.h > For the second patch in this series. > > Another avenue would be to do something like: > #ifndef pgd_huge > #define pgd_huge(pgd) (0) > #endif > > Then no changes would be required to arm and arm64 (or other > architectures). > > To help with bisectability, could we please have a suitable fix applied > to the two patches in the -mm tree: > http://ozlabs.org/~akpm/mmots/broken-out/mm-update-generic-gup-implementation-to-handle-hugepage-directory.patch > http://ozlabs.org/~akpm/mmots/broken-out/arch-powerpc-switch-to-generic-rcu-get_user_pages_fast.patch > > rather than applied afterwards? > > With pgd_huge(x) defined, this patch passes my futex test on arm > (Arndale platform) and arm64(Juno). > > Cheers, > -- > Steve > > > > From 2fb7b0308f0aca94c50611257ba82d656abb0768 Mon Sep 17 00:00:00 2001 > From: Steve Capper > Date: Thu, 16 Oct 2014 09:09:48 +0100 > Subject: [PATCH] Fixup for Update generic gup implementation > > The patch: > mm: Update generic gup implementation to handle hugepage directory > > will not compile for arm or arm64 due to pgd_huge being undefined. > > Signed-off-by: Steve Capper > --- > arch/arm/include/asm/pgtable.h | 2 ++ > arch/arm64/include/asm/pgtable.h | 2 ++ > include/linux/hugetlb.h | 1 - > 3 files changed, 4 insertions(+), 1 deletion(-) > > diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h > index 90aa4583..46f81fb 100644 > --- a/arch/arm/include/asm/pgtable.h > +++ b/arch/arm/include/asm/pgtable.h > @@ -181,6 +181,8 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; > /* to find an entry in a kernel page-table-directory */ > #define pgd_offset_k(addr) pgd_offset(&init_mm, addr) > > +#define pgd_huge(pgd)(0) > + > #define pmd_none(pmd)(!pmd_val(pmd)) > #define pmd_present(pmd) (pmd_val(pmd)) > > diff --git a/arch/arm64/include/asm/pgtable.h > b/arch/arm64/include/asm/pgtable.h > index 464c5ce..d4462ca 100644 > --- a/arch/arm64/include/asm/pgtable.h > +++ b/arch/arm64/include/asm/pgtable.h > @@ -462,6 +462,8 @@ static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t > newprot) > extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; > extern pgd_t idmap_pg_dir[PTRS_PER_PGD]; > > +#define pgd_huge(pgd)(0) > + > /* > * Encode and decode a swap entry: > * bits 0-1: present (must be zero) > diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h > index 65e12a2..6e6d338 100644 > --- a/include/linux/hugetlb.h > +++ b/include/linux/hugetlb.h > @@ -138,7 +138,6 @@ static inline void hugetlb_show_meminfo(void) > #define prepare_hugepage_range(file, addr, len) (-EINVAL) > #define pmd_huge(x) 0 > #define pud_huge(x) 0 > -#define pgd_huge(x) 0 > #define is_hugepage_only_range(mm, addr, len)0 > #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; }) > #define hugetlb_fault(mm, vma, addr, flags) ({ BUG(); 0; }) don't do the last hunk, that will result in build failures on sub platforms on ppc64. can you do the arm patch without making the change to hugetlb.h ? -aneesh ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] powerpc/pci: Fix IO space breakage after of_pci_range_to_resource() change
(hope my email makes it everywhere, using a webmail client at the moment as I'm at plumbersconf Michael Ellerman hat am 16. Oktober 2014 um 05:22 geschrieben: > > > Commit 0b0b0893d49b "of/pci: Fix the conversion of IO ranges into IO > resources" changed the behaviour of of_pci_range_to_resource(). I just looked at this after benh mentioned the problem on IRC, here's a log dump :26 AMargh 9:27 AMthe whole ARM OF PCI rework seems to completely break PIO on powerpc 9:30 AM → willy joined (^willy@62.156.150.204) 9:35 AMand reverting it would mean reverting all of ARM new PCI stuff 9:35 AMcrap 9:35 AMthat business with IO space allocation taking over our code without understanding what it does 9:35 AMyuck 9:41 AM → markf , olaf , sarnold , gospo , cmarinas , Mahesh1 , joern , clark_ and benhjoined ⇐ gcl and clark quit ↔ willy , jbarnes , jbrandeb_ and Mahesh popped in ↔ sameo , jbrandeb , steved and jj nipped out • srikar → srikar_away , raghu → raghu_away Thursday, October 16th, 2014 12:06 AM → fweisbec , Mahesh , kamalesh , heiko , olaf , riel and willy joined ⇐ shaggy , sammj , sameo , clark_ , lenb and jj quit ↔ jbrandeb , cdub , Mahesh1 and gcl popped in ↔ jbrandeb_ , benh, joern and BenC nipped out • mpe|away → mpe|away , raghu_away → raghu , srikar_away → srikar 10:16 AMbenh: is it the of_pci_range_to_resource change? 10:17 AMthe new pci_ioremap_iospace logic should not get used on powerpc at all, so I didn't expect any breakage 10:18 AMI wasn't too happy with all the details of Liviu's series, bit in the end it seemed reasonable enough 10:20 AMhe really wanted to use the pci_address_to_pio code from powerpc and in the end I stopped complaining 10:21 AMthe new code can do a few things that simpler versions could not, e.g. handling multiple host bridges getting registered when they have the same I/O space window 10:23 AM → jj joined (^j...@static-50-53-60-87.bvtn.or.frontiernet.net) 10:33 AMbenh: I can see how it breaks your pci_process_bridge_OF_ranges, we had the same problem in some of the ARM platforms and Liviu fixed those but apparently didn't realize he had to change the ppc implementation (and get your ack) too 10:35 AMthe good news is that it should in fact simplify your code to fix it, but the fact that this bug got into the kernel in the first place is extremely annoying 10:39 AMbenh: the fixup that is done in your pcibios_reserve_legacy_regions is now already performed in of_pci_range_to_resource 10:39 AMwe had duplicated the same thing in each pci host driver (and they all got it wrong), so the intent was to move it into a common place 10:40 AMbut of course it's a bug to do it twice 10:43 AMpci_register_io_range is trying to do a more generalized version of how you assign hose->io_base_virt, you should probably override that to keep the current behavior 10:45 AMpcibios_map_phb_io_space I mean, for ppc64 10:52 AM → cmarinas joined (~cmari...@fw-tnat.cambridge.arm.com) 10:53 AMbenh: for 3.18, the best approach is likely to #ifdef <%23ifdef> PCI_IOBASE the changes in of_pci_range_to_resource 10:54 AMI suspect you are fine with effectively reverting Liviu's changes that way, and you can decide whether or not you want to later make the powerpc code use the common logic 11:01 AM → cdub and sarnold joined ⇐ cmarinas quit 11:28 AMarnd_: can you shoot the above in an email CCed to mpe ? 11:28 AMarnd_: he did a band aid that works 11:28 AMarnd_: and see the comment I made today about using his stuff if I can specify where I want the IO ranges 11:28 AMarnd_: I want to keep the way I do the layout on ppc64 > Previously it simply populated the resource based on the arguments. Now > it calls pci_register_io_range() and pci_address_to_pio(). These both > have two implementations depending on whether PCI_IOBASE is defined, > which it is not for powerpc. > > Further complicating matters, both routines are weak, and powerpc > implements it's own version of one - pci_address_to_pio(). However > powerpc's implementation depends on other initialisations which are done > later in boot. Right, sorry for missing this during the last review of the broken patches. > The end result is incorrectly initialised IO space. Often we can get > away with that, because we don't make much use of IO space. However > virtio requires it, so we see eg: > > pci_bus :00: root bus resource [io 0x] (bus address > [0x-0x]) > PCI: Cannot allocate resource region 0 of device :00:01.0, will remap > virtio-pci :00:01.0: can't enable device: BAR 0 [io size 0x0020] not > assigned > > The simplest fix for now is to just stop using of_pci_range_to_resource(), > and open-code the original imp`lementation, that's all we want it to do. The same bug is likely to
Re: [PATCH v3 22/27] s390/MSI: Use MSI chip framework to configure MSI/MSI-X irq
On Wed, 15 Oct 2014, Yijing Wang wrote: > Use MSI chip framework instead of arch MSI functions to configure > MSI/MSI-X irq. So we can manage MSI/MSI-X irq in a unified framework. > > Signed-off-by: Yijing Wang > --- > Hi Sebastian, >I dropped the Acked-by , because this version has a > lot changes compared to last. So, I guess you may want to check it again. I did and I agree with that one too. Regards, Sebastian > --- > arch/s390/include/asm/pci.h |9 + > arch/s390/pci/pci.c | 12 ++-- > 2 files changed, 19 insertions(+), 2 deletions(-) > > diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h > index c030900..4d41f08 100644 > --- a/arch/s390/include/asm/pci.h > +++ b/arch/s390/include/asm/pci.h > @@ -88,6 +88,8 @@ struct zpci_dev { > u32 uid;/* user defined id */ > u8 util_str[CLP_UTIL_STR_LEN]; /* utility string */ > > + struct msi_chip *msi_chip; > + > /* IRQ stuff */ > u64 msi_addr; /* MSI address */ > struct airq_iv *aibv; /* adapter interrupt bit vector */ > @@ -121,6 +123,13 @@ struct zpci_dev { > struct dentry *debugfs_perf; > }; > > +static inline struct msi_chip *pci_msi_chip(struct pci_bus *bus) > +{ > + struct zpci_dev *zpci = bus->sysdata; > + > + return zpci->msi_chip; > +} > + > static inline bool zdev_enabled(struct zpci_dev *zdev) > { > return (zdev->fh & (1UL << 31)) ? true : false; > diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c > index 552b990..bf6732f 100644 > --- a/arch/s390/pci/pci.c > +++ b/arch/s390/pci/pci.c > @@ -358,7 +358,8 @@ static void zpci_irq_handler(struct airq_struct *airq) > } > } > > -int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) > +static int zpci_setup_msi_irqs(struct msi_chip *chip, > + struct pci_dev *pdev, int nvec, int type) > { > struct zpci_dev *zdev = get_zdev(pdev); > unsigned int hwirq, msi_vecs; > @@ -434,7 +435,8 @@ out: > return rc; > } > > -void arch_teardown_msi_irqs(struct pci_dev *pdev) > +static void zpci_teardown_msi_irqs(struct msi_chip *chip, > + struct pci_dev *pdev) > { > struct zpci_dev *zdev = get_zdev(pdev); > struct msi_desc *msi; > @@ -464,6 +466,11 @@ void arch_teardown_msi_irqs(struct pci_dev *pdev) > airq_iv_free_bit(zpci_aisb_iv, zdev->aisb); > } > > +static struct msi_chip zpci_msi_chip = { > + .setup_irqs = zpci_setup_msi_irqs, > + .teardown_irqs = zpci_teardown_msi_irqs, > +}; > + > static void zpci_map_resources(struct zpci_dev *zdev) > { > struct pci_dev *pdev = zdev->pdev; > @@ -749,6 +756,7 @@ static int zpci_scan_bus(struct zpci_dev *zdev) > if (ret) > return ret; > > + zdev->msi_chip = &zpci_msi_chip; > zdev->bus = pci_scan_root_bus(NULL, ZPCI_BUS_NR, &pci_root_ops, > zdev, &resources); > if (!zdev->bus) { > -- > 1.7.1 > > ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 2/2] clk: ppc-corenet: don't use platform_driver to init the clock device
In commit da788acb2838 ("clk: ppc-corenet: Fix Section mismatch warning"), we put the ppc_corenet_clk_driver struct to init section in order to fix section mismatch warning. This is definitely wrong because the kernel would free the memories occupied by ppc_corenet_clk_driver after boot while this driver is still registered in the driver core. The kernel would panic when accessing this driver struct. So choose to use CLK_OF_DECLARE to scan and init the clock devices. Signed-off-by: Kevin Hao --- arch/powerpc/platforms/85xx/corenet_generic.c | 7 + drivers/clk/clk-ppc-corenet.c | 43 --- 2 files changed, 13 insertions(+), 37 deletions(-) diff --git a/arch/powerpc/platforms/85xx/corenet_generic.c b/arch/powerpc/platforms/85xx/corenet_generic.c index e56b89a792ed..7677cfecb787 100644 --- a/arch/powerpc/platforms/85xx/corenet_generic.c +++ b/arch/powerpc/platforms/85xx/corenet_generic.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -188,11 +189,17 @@ static int __init corenet_generic_probe(void) return 0; } +static void __init corenet_gen_init(void) +{ + of_clk_init(NULL); +} + define_machine(corenet_generic) { .name = "CoreNet Generic", .probe = corenet_generic_probe, .setup_arch = corenet_gen_setup_arch, .init_IRQ = corenet_gen_pic_init, + .init = corenet_gen_init, #ifdef CONFIG_PCI .pcibios_fixup_bus = fsl_pcibios_fixup_bus, .pcibios_fixup_phb = fsl_pcibios_fixup_phb, diff --git a/drivers/clk/clk-ppc-corenet.c b/drivers/clk/clk-ppc-corenet.c index 8e58edfeeb37..bf0fe565ce4e 100644 --- a/drivers/clk/clk-ppc-corenet.c +++ b/drivers/clk/clk-ppc-corenet.c @@ -268,40 +268,9 @@ static void __init sysclk_init(struct device_node *node) of_clk_add_provider(np, of_clk_src_simple_get, clk); } -static const struct of_device_id clk_match[] __initconst = { - { .compatible = "fsl,qoriq-sysclk-1.0", .data = sysclk_init, }, - { .compatible = "fsl,qoriq-sysclk-2.0", .data = sysclk_init, }, - { .compatible = "fsl,qoriq-core-pll-1.0", .data = core_pll_init, }, - { .compatible = "fsl,qoriq-core-pll-2.0", .data = core_pll_init, }, - { .compatible = "fsl,qoriq-core-mux-1.0", .data = core_mux_init, }, - { .compatible = "fsl,qoriq-core-mux-2.0", .data = core_mux_init, }, - {} -}; - -static int __init ppc_corenet_clk_probe(struct platform_device *pdev) -{ - of_clk_init(clk_match); - - return 0; -} - -static const struct of_device_id ppc_clk_ids[] __initconst = { - { .compatible = "fsl,qoriq-clockgen-1.0", }, - { .compatible = "fsl,qoriq-clockgen-2.0", }, - {} -}; - -static struct platform_driver ppc_corenet_clk_driver __initdata = { - .driver = { - .name = "ppc_corenet_clock", - .owner = THIS_MODULE, - .of_match_table = ppc_clk_ids, - }, - .probe = ppc_corenet_clk_probe, -}; - -static int __init ppc_corenet_clk_init(void) -{ - return platform_driver_register(&ppc_corenet_clk_driver); -} -subsys_initcall(ppc_corenet_clk_init); +CLK_OF_DECLARE(qoriq_sysclk_1, "fsl,qoriq-sysclk-1.0", sysclk_init); +CLK_OF_DECLARE(qoriq_sysclk_2, "fsl,qoriq-sysclk-2.0", sysclk_init); +CLK_OF_DECLARE(qoriq_core_pll_1, "fsl,qoriq-core-pll-1.0", core_pll_init); +CLK_OF_DECLARE(qoriq_core_pll_2, "fsl,qoriq-core-pll-2.0", core_pll_init); +CLK_OF_DECLARE(qoriq_core_mux_1, "fsl,qoriq-core-mux-1.0", core_mux_init); +CLK_OF_DECLARE(qoriq_core_mux_2, "fsl,qoriq-core-mux-2.0", core_mux_init); -- 1.9.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 1/2] powerpc: move ppc_init() to common place
So they can be used by ppc64 board. Also remove the unneeded {} to make checkpatch happy. Signed-off-by: Kevin Hao --- arch/powerpc/include/asm/machdep.h | 2 +- arch/powerpc/kernel/setup-common.c | 15 +++ arch/powerpc/kernel/setup_32.c | 15 --- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h index 307347f8ddbd..4b913d5b 100644 --- a/arch/powerpc/include/asm/machdep.h +++ b/arch/powerpc/include/asm/machdep.h @@ -213,11 +213,11 @@ struct machdep_calls { int (*set_dawr)(unsigned long dawr, unsigned long dawrx); -#ifdef CONFIG_PPC32/* XXX for now */ /* A general init function, called by ppc_init in init/main.c. May be NULL. */ void(*init)(void); +#ifdef CONFIG_PPC32/* XXX for now */ void(*kgdb_map_scc)(void); /* diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index 1362cd62b3fa..f76d4a1dbe73 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c @@ -750,3 +750,18 @@ void arch_setup_pdev_archdata(struct platform_device *pdev) pdev->dev.dma_mask = &pdev->archdata.dma_mask; set_dma_ops(&pdev->dev, &dma_direct_ops); } + +int __init ppc_init(void) +{ + /* clear the progress line */ + if (ppc_md.progress) + ppc_md.progress(" ", 0x); + + /* call platform init */ + if (ppc_md.init != NULL) + ppc_md.init(); + + return 0; +} + +arch_initcall(ppc_init); diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c index 07831ed0d9ef..59d8c6e15782 100644 --- a/arch/powerpc/kernel/setup_32.c +++ b/arch/powerpc/kernel/setup_32.c @@ -208,21 +208,6 @@ EXPORT_SYMBOL(nvram_sync); #endif /* CONFIG_NVRAM */ -int __init ppc_init(void) -{ - /* clear the progress line */ - if (ppc_md.progress) - ppc_md.progress(" ", 0x); - - /* call platform init */ - if (ppc_md.init != NULL) { - ppc_md.init(); - } - return 0; -} - -arch_initcall(ppc_init); - static void __init irqstack_early_init(void) { unsigned int i; -- 1.9.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 0/2] fix a kernel panic on fsl corenet board when CONFIG_CLK_PPC_CORENET is enabled
Hi, This tries to fix a kernel panic introduced by commit da788acb2838 ("clk: ppc-corenet: Fix Section mismatch warning"). Kevin Hao (2): powerpc: move ppc_init() to common place clk: ppc-corenet: don't use platform_driver to init the clock device arch/powerpc/include/asm/machdep.h| 2 +- arch/powerpc/kernel/setup-common.c| 15 ++ arch/powerpc/kernel/setup_32.c| 15 -- arch/powerpc/platforms/85xx/corenet_generic.c | 7 + drivers/clk/clk-ppc-corenet.c | 43 --- 5 files changed, 29 insertions(+), 53 deletions(-) -- 1.9.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 26/53] dmaengine: fsl-dma: Split device_control
Split the device_control callback of the Freescale Elo DMA driver to make use of the newly introduced callbacks, that will eventually be used to retrieve slave capabilities. While we're at it, remove the useless prep_sg callback. Signed-off-by: Maxime Ripard --- drivers/dma/fsldma.c | 100 --- 1 file changed, 46 insertions(+), 54 deletions(-) diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index d5d6885ab341..4da5b4dcb45c 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c @@ -927,35 +927,7 @@ fail: return NULL; } -/** - * fsl_dma_prep_slave_sg - prepare descriptors for a DMA_SLAVE transaction - * @chan: DMA channel - * @sgl: scatterlist to transfer to/from - * @sg_len: number of entries in @scatterlist - * @direction: DMA direction - * @flags: DMAEngine flags - * @context: transaction context (ignored) - * - * Prepare a set of descriptors for a DMA_SLAVE transaction. Following the - * DMA_SLAVE API, this gets the device-specific information from the - * chan->private variable. - */ -static struct dma_async_tx_descriptor *fsl_dma_prep_slave_sg( - struct dma_chan *dchan, struct scatterlist *sgl, unsigned int sg_len, - enum dma_transfer_direction direction, unsigned long flags, - void *context) -{ - /* -* This operation is not supported on the Freescale DMA controller -* -* However, we need to provide the function pointer to allow the -* device_control() method to work. -*/ - return NULL; -} - -static int fsl_dma_device_control(struct dma_chan *dchan, - enum dma_ctrl_cmd cmd, unsigned long arg) +static int fsl_dma_device_terminate_all(struct dma_chan *dchan) { struct dma_slave_config *config; struct fsldma_chan *chan; @@ -966,38 +938,57 @@ static int fsl_dma_device_control(struct dma_chan *dchan, chan = to_fsl_chan(dchan); - switch (cmd) { - case DMA_TERMINATE_ALL: - spin_lock_bh(&chan->desc_lock); + spin_lock_bh(&chan->desc_lock); + + /* Halt the DMA engine */ + dma_halt(chan); - /* Halt the DMA engine */ - dma_halt(chan); + /* Remove and free all of the descriptors in the LD queue */ + fsldma_free_desc_list(chan, &chan->ld_pending); + fsldma_free_desc_list(chan, &chan->ld_running); + fsldma_free_desc_list(chan, &chan->ld_completed); + chan->idle = true; - /* Remove and free all of the descriptors in the LD queue */ - fsldma_free_desc_list(chan, &chan->ld_pending); - fsldma_free_desc_list(chan, &chan->ld_running); - fsldma_free_desc_list(chan, &chan->ld_completed); - chan->idle = true; + spin_unlock_bh(&chan->desc_lock); + return 0; +} - spin_unlock_bh(&chan->desc_lock); - return 0; +static int fsl_dma_device_config(struct dma_chan *dchan, +struct dma_slave_config *config) +{ + struct fsldma_chan *chan; + int size; - case DMA_SLAVE_CONFIG: - config = (struct dma_slave_config *)arg; + if (!dchan) + return -EINVAL; - /* make sure the channel supports setting burst size */ - if (!chan->set_request_count) - return -ENXIO; + chan = to_fsl_chan(dchan); - /* we set the controller burst size depending on direction */ - if (config->direction == DMA_MEM_TO_DEV) - size = config->dst_addr_width * config->dst_maxburst; - else - size = config->src_addr_width * config->src_maxburst; + /* make sure the channel supports setting burst size */ + if (!chan->set_request_count) + return -ENXIO; - chan->set_request_count(chan, size); - return 0; + /* we set the controller burst size depending on direction */ + if (config->direction == DMA_MEM_TO_DEV) + size = config->dst_addr_width * config->dst_maxburst; + else + size = config->src_addr_width * config->src_maxburst; + chan->set_request_count(chan, size); + return 0; +} + +static int fsl_dma_device_control(struct dma_chan *dchan, + enum dma_ctrl_cmd cmd, unsigned long arg) +{ + struct fsldma_chan *chan; + + if (!dchan) + return -EINVAL; + + chan = to_fsl_chan(dchan); + + switch (cmd) { case FSLDMA_EXTERNAL_START: /* make sure the channel supports external start */ @@ -1391,8 +1382,9 @@ static int fsldma_of_probe(struct platform_device *op) fdev->common.device_prep_dma_sg = fsl_dma_prep_sg; fdev->common.device_tx_status = fsl_tx_status; fdev->common.device_issue_pending = fsl_dma_memcpy_issue_pendin
Re: [PATCH 1/2] mm: Update generic gup implementation to handle hugepage directory
On Wed, Oct 15, 2014 at 10:04:47PM +0530, Aneesh Kumar K.V wrote: > 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. > > Signed-off-by: Aneesh Kumar K.V Hi, This patch causes compiler errors on arm and arm64 due to pgd_huge being undefined. I've attached a fixup below, this fixup will require that #define pgd_huge(pgd) 0 be added back into: arch/powerpc/include/asm/page.h For the second patch in this series. Another avenue would be to do something like: #ifndef pgd_huge #define pgd_huge(pgd) (0) #endif Then no changes would be required to arm and arm64 (or other architectures). To help with bisectability, could we please have a suitable fix applied to the two patches in the -mm tree: http://ozlabs.org/~akpm/mmots/broken-out/mm-update-generic-gup-implementation-to-handle-hugepage-directory.patch http://ozlabs.org/~akpm/mmots/broken-out/arch-powerpc-switch-to-generic-rcu-get_user_pages_fast.patch rather than applied afterwards? With pgd_huge(x) defined, this patch passes my futex test on arm (Arndale platform) and arm64(Juno). Cheers, -- Steve From 2fb7b0308f0aca94c50611257ba82d656abb0768 Mon Sep 17 00:00:00 2001 From: Steve Capper Date: Thu, 16 Oct 2014 09:09:48 +0100 Subject: [PATCH] Fixup for Update generic gup implementation The patch: mm: Update generic gup implementation to handle hugepage directory will not compile for arm or arm64 due to pgd_huge being undefined. Signed-off-by: Steve Capper --- arch/arm/include/asm/pgtable.h | 2 ++ arch/arm64/include/asm/pgtable.h | 2 ++ include/linux/hugetlb.h | 1 - 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h index 90aa4583..46f81fb 100644 --- a/arch/arm/include/asm/pgtable.h +++ b/arch/arm/include/asm/pgtable.h @@ -181,6 +181,8 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; /* to find an entry in a kernel page-table-directory */ #define pgd_offset_k(addr) pgd_offset(&init_mm, addr) +#define pgd_huge(pgd) (0) + #define pmd_none(pmd) (!pmd_val(pmd)) #define pmd_present(pmd) (pmd_val(pmd)) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index 464c5ce..d4462ca 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -462,6 +462,8 @@ static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot) extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; extern pgd_t idmap_pg_dir[PTRS_PER_PGD]; +#define pgd_huge(pgd) (0) + /* * Encode and decode a swap entry: * bits 0-1: present (must be zero) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 65e12a2..6e6d338 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -138,7 +138,6 @@ static inline void hugetlb_show_meminfo(void) #define prepare_hugepage_range(file, addr, len)(-EINVAL) #define pmd_huge(x)0 #define pud_huge(x)0 -#define pgd_huge(x)0 #define is_hugepage_only_range(mm, addr, len) 0 #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; }) #define hugetlb_fault(mm, vma, addr, flags)({ BUG(); 0; }) -- 1.9.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 04/11] dmaengine: fsldma: Remove chancnt affectations
chanctnt is already filled by dma_async_device_register, which uses the channel list to know how much channels there is. Since it's already filled, we can safely remove it from the drivers' probe function. Signed-off-by: Maxime Ripard --- drivers/dma/fsldma.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index d5d6885ab341..75ae6405a5ee 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c @@ -1332,7 +1332,6 @@ static int fsl_dma_chan_probe(struct fsldma_device *fdev, /* Add the channel to DMA device channel list */ list_add_tail(&chan->common.device_node, &fdev->common.channels); - fdev->common.chancnt++; dev_info(fdev->dev, "#%d (%s), irq %d\n", chan->id, compatible, chan->irq != NO_IRQ ? chan->irq : fdev->irq); -- 2.1.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCHv9 2/5] ppc/cell: trivial: replace get_unused_fd() by get_unused_fd_flags(0)
Hi, Le mardi 14 octobre 2014 à 12:57 +1100, Michael Ellerman a écrit : > On Mon, 2014-10-13 at 21:30 +0200, Yann Droneaud wrote: > > This patch replaces calls to get_unused_fd() with equivalent call to > > get_unused_fd_flags(0) to preserve current behavor for existing code. > > > > In a further patch, get_unused_fd() will be removed so that new code > > start using get_unused_fd_flags(), with the hope O_CLOEXEC could be > > used, either by default or choosen by userspace. > > > > Link: http://lkml.kernel.org/r/cover.1413223900.git.ydrone...@opteya.com > > Cc: Al Viro > > Cc: Andrew Morton > > Cc: triv...@kernel.org > > Signed-off-by: Yann Droneaud > > This is fine by me, do you want an ack, or do you want us to take it via the > powerpc tree? > The patch was added in -mm by Andrew, so I guess the patch will be merged sooner or later. Anyway, you could investigate to check if O_CLOEXEC could be used instead of 0 in call to get_unused_fd_flags(). > If the former: > > Acked-by: Michael Ellerman > Thanks a lot. Regards. -- Yann Droneaud OPTEYA ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V7 00/17] Enable SRIOV on POWER8
On Wed, Oct 15, 2014 at 07:52:16AM -0600, Bjorn Helgaas wrote: >On Wed, Oct 15, 2014 at 3:00 AM, Wei Yang wrote: >> On Thu, Oct 02, 2014 at 09:59:43AM -0600, Bjorn Helgaas wrote: >... >>>I haven't seen any more on this series, and I'm assuming you'll post a >>>rebased series (maybe you're waiting for v3.18-rc1?). I'm just checking to >>>make sure you're not waiting for something from me... >>> >> >> Hi, Bjorn >> >> Haven't seen you for a long time :-) I am just back from vocation and the >> mail >> box doesn't work well for previous two days. >> >> Yep, I am rebasing the code on top of v3.17, is this fine for you? > >When I apply your patches, they will be on a branch based on >v3.18-rc1, so the easiest thing for me would be if you generate them >from that base. Here's why: > > - Linus released v3.17 on Oct 5, 2014 > - Merge window for v3.18 opened when v3.17 released > - All changes intended for v3.18 will be merged during window >(theoretically, at least) > - Merge window closes when Linus releases v3.18-rc1 (probably Oct 19 or 26) > >Your changes will miss the v3.18 merge window, so the next chance to >merge them will be during the v3.19 merge window that opens when v3.18 >releases. v3.18-rc1 is a close approximation of what v3.18 will >eventually be, so rebasing to v3.18-rc1 will minimize merge conflicts >when we eventually merge your changes on top of v3.18. > >v3.18-rc1 isn't out yet, but if you rebase to the current head of >Linus' tree, that should be fairly close. The PCI changes are already >in (80213c03c415), and at least some of the powerpc changes are in >(fd9879b9bb32). > Thanks for your explanation. I will do some rebase and test on v3.17. Then rebase it on v3.18-rc1 when it is released. And finally give you the one on v3.18-rc1. >Bjorn -- Richard Yang Help you, Help me ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC 11/11] powerpc: kvm: Kconfig add an option for enabling secondary hwthread
Signed-off-by: Liu Ping Fan --- arch/powerpc/kvm/Kconfig | 4 1 file changed, 4 insertions(+) diff --git a/arch/powerpc/kvm/Kconfig b/arch/powerpc/kvm/Kconfig index 602eb51..de38566 100644 --- a/arch/powerpc/kvm/Kconfig +++ b/arch/powerpc/kvm/Kconfig @@ -93,6 +93,10 @@ config KVM_BOOK3S_64_HV If unsure, say N. +config KVMPPC_ENABLE_SECONDARY + tristate "KVM support for running on secondary hwthread in host" + depends on KVM_BOOK3S_64_HV + config KVM_BOOK3S_64_PR tristate "KVM support without using hypervisor mode in host" depends on KVM_BOOK3S_64 -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC 10/11] powerpc: kvm: on_primary_thread() force the secondary threads into NAP mode
The primary hwthread ceases the scheduler of secondary hwthread by bringing them into NAP. Then, the secondary is ready for guest. Signed-off-by: Liu Ping Fan --- arch/powerpc/kvm/book3s_hv.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 4348abd..7896c31 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -1593,15 +1593,22 @@ static int on_primary_thread(void) { int cpu = smp_processor_id(); int thr; + struct cpumask msk; /* Are we on a primary subcore? */ if (cpu_thread_in_subcore(cpu)) return 0; thr = 0; +#ifdef KVMPPC_ENABLE_SECONDARY + while (++thr < threads_per_subcore) + cpumask_set_cpu(thr, &msk); + stop_cpus_async(&msk, kvmppc_secondary_stopper, NULL); +#else while (++thr < threads_per_subcore) if (cpu_online(cpu + thr)) return 0; +#endif /* Grab all hw threads so they can't go into the kernel */ for (thr = 1; thr < threads_per_subcore; ++thr) { -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC 09/11] powerpc: kvm: handle time base on secondary hwthread
(This is a place holder patch.) We need to store the time base for host on secondary hwthread. Later when switching back, we need to reprogram it with elapse time. Signed-off-by: Liu Ping Fan --- arch/powerpc/kvm/book3s_hv_rmhandlers.S | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S index 89ea16c..a817ba6 100644 --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S @@ -371,6 +371,8 @@ _GLOBAL_TOC(kvmppc_secondary_stopper_enter) /* fixme: store other register such as msr */ + /* fixme: store the tb, and set it as MAX, so we cease the tick on secondary */ + /* prevent us to enter kernel */ li r0, 1 stb r0, HSTATE_HWTHREAD_REQ(r13) @@ -382,6 +384,10 @@ _GLOBAL_TOC(kvmppc_secondary_stopper_enter) /* enter with vmode */ kvmppc_secondary_stopper_exit: + /* fixme: restore the tb, with the orig val plus time elapse + * so we can fire the hrtimer as soon as possible + */ + /* fixme, restore the stack which we store on lpaca */ ld r0, 112+PPC_LR_STKOFF(r1) -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC 08/11] powerpc: kvm: add a flag in vcore to sync primary with secondry hwthread
The secondary thread can only jump back to host until primary has set up the env. Add host_ready field in kvm_vcore to sync this action. Signed-off-by: Liu Ping Fan --- arch/powerpc/include/asm/kvm_host.h | 3 +++ arch/powerpc/kernel/asm-offsets.c | 3 +++ arch/powerpc/kvm/book3s_hv_rmhandlers.S | 11 ++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h index 9a3355e..1310e03 100644 --- a/arch/powerpc/include/asm/kvm_host.h +++ b/arch/powerpc/include/asm/kvm_host.h @@ -305,6 +305,9 @@ struct kvmppc_vcore { u32 arch_compat; ulong pcr; ulong dpdes;/* doorbell state (POWER8) */ +#ifdef CONFIG_KVMPPC_ENABLE_SECONDARY + u8 host_ready; +#endif void *mpp_buffer; /* Micro Partition Prefetch buffer */ bool mpp_buffer_is_valid; }; diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index 0faa8fe..9c04ac2 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c @@ -562,6 +562,9 @@ int main(void) DEFINE(VCORE_LPCR, offsetof(struct kvmppc_vcore, lpcr)); DEFINE(VCORE_PCR, offsetof(struct kvmppc_vcore, pcr)); DEFINE(VCORE_DPDES, offsetof(struct kvmppc_vcore, dpdes)); +#ifdef CONFIG_KVMPPC_ENABLE_SECONDARY + DEFINE(VCORE_HOST_READY, offsetof(struct kvmppc_vcore, host_ready)); +#endif DEFINE(VCPU_SLB_E, offsetof(struct kvmppc_slb, orige)); DEFINE(VCPU_SLB_V, offsetof(struct kvmppc_slb, origv)); DEFINE(VCPU_SLB_SIZE, sizeof(struct kvmppc_slb)); diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S index 254038b..89ea16c 100644 --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S @@ -351,7 +351,11 @@ kvm_do_nap: kvm_secondary_exit_trampoline: /* all register is free to use, later kvmppc_secondary_stopper_exit set up them*/ - //loop-wait for the primary to signal that host env is ready + /* wait until the primary to set up host env */ + ld r5, HSTATE_KVM_VCORE(r13) + ld r0, VCORE_HOST_READY(r5) + cmp r0, //primary is ready? + bne kvm_secondary_exit_trampoline LOAD_REG_ADDR(r5, kvmppc_secondary_stopper_exit) /* fixme, load msr from lpaca stack */ @@ -1821,6 +1825,11 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) li r0, KVM_GUEST_MODE_NONE stb r0, HSTATE_IN_GUEST(r13) +#ifdef PPCKVM_ENABLE_SECONDARY + /* signal the secondary that host env is ready */ + li r0, 1 + stb r0, VCORE_HOST_READY(r5) +#endif ld r0, 112+PPC_LR_STKOFF(r1) addir1, r1, 112 mtlrr0 -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC 07/11] powerpc: kvm: the stopper func to cease secondary hwthread
To enter guest, primary hwtherad schedules the stopper func on secondary threads and force them into NAP mode. When exit to host,secondary threads hardcode to restore the stack, then switch back to the stopper func, i.e host. Signed-off-by: Liu Ping Fan --- arch/powerpc/kvm/book3s_hv.c| 15 +++ arch/powerpc/kvm/book3s_hv_rmhandlers.S | 34 + 2 files changed, 49 insertions(+) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index ba258c8..4348abd 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -1486,6 +1486,21 @@ static void kvmppc_remove_runnable(struct kvmppc_vcore *vc, list_del(&vcpu->arch.run_list); } +#ifdef KVMPPC_ENABLE_SECONDARY + +extern void kvmppc_secondary_stopper_enter(); + +static int kvmppc_secondary_stopper(void *data) +{ + int cpu =smp_processor_id(); + struct paca_struct *lpaca = get_paca(); + BUG_ON(!(cpu%thread_per_core)); + + kvmppc_secondary_stopper_enter(); +} + +#endif + static int kvmppc_grab_hwthread(int cpu) { struct paca_struct *tpaca; diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S index d5594b0..254038b 100644 --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S @@ -349,7 +349,41 @@ kvm_do_nap: #ifdef PPCKVM_ENABLE_SECONDARY kvm_secondary_exit_trampoline: + + /* all register is free to use, later kvmppc_secondary_stopper_exit set up them*/ + //loop-wait for the primary to signal that host env is ready + + LOAD_REG_ADDR(r5, kvmppc_secondary_stopper_exit) + /* fixme, load msr from lpaca stack */ + li r6, MSR_IR | MSR_DR + mtsrr0 r5 + mtsrr1 r6 + RFI + +_GLOBAL_TOC(kvmppc_secondary_stopper_enter) + mflrr0 + std r0, PPC_LR_STKOFF(r1) + stdur1, -112(r1) + + /* fixme: store other register such as msr */ + + /* prevent us to enter kernel */ + li r0, 1 + stb r0, HSTATE_HWTHREAD_REQ(r13) + /* tell the primary that we are ready */ +li r0,KVM_HWTHREAD_IN_KERNEL +stb r0,HSTATE_HWTHREAD_STATE(r13) + nap b . + +/* enter with vmode */ +kvmppc_secondary_stopper_exit: + /* fixme, restore the stack which we store on lpaca */ + + ld r0, 112+PPC_LR_STKOFF(r1) + addir1, r1, 112 + mtlrr0 + blr #endif /** -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC 06/11] powerpc: kvm: introduce online in paca to indicate whether cpu is needed by host
Nowadays, powerKVM runs with secondary hwthread offline. Although we can make all secondary hwthread online later, we still preserve this behavior for dedicated KVM env. Achieve this by setting paca->online as false. Signed-off-by: Liu Ping Fan --- arch/powerpc/include/asm/paca.h | 3 +++ arch/powerpc/kernel/asm-offsets.c | 3 +++ arch/powerpc/kernel/smp.c | 3 +++ arch/powerpc/kvm/book3s_hv_rmhandlers.S | 12 4 files changed, 21 insertions(+) diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h index a5139ea..67c2500 100644 --- a/arch/powerpc/include/asm/paca.h +++ b/arch/powerpc/include/asm/paca.h @@ -84,6 +84,9 @@ struct paca_struct { u8 cpu_start; /* At startup, processor spins until */ /* this becomes non-zero. */ u8 kexec_state; /* set when kexec down has irqs off */ +#ifdef CONFIG_KVMPPC_ENABLE_SECONDARY + u8 online; +#endif #ifdef CONFIG_PPC_STD_MMU_64 struct slb_shadow *slb_shadow_ptr; struct dtl_entry *dispatch_log; diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index 9d7dede..0faa8fe 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c @@ -182,6 +182,9 @@ int main(void) DEFINE(PACATOC, offsetof(struct paca_struct, kernel_toc)); DEFINE(PACAKBASE, offsetof(struct paca_struct, kernelbase)); DEFINE(PACAKMSR, offsetof(struct paca_struct, kernel_msr)); +#ifdef CONFIG_KVMPPC_ENABLE_SECONDARY + DEFINE(PACAONLINE, offsetof(struct paca_struct, online)); +#endif DEFINE(PACASOFTIRQEN, offsetof(struct paca_struct, soft_enabled)); DEFINE(PACAIRQHAPPENED, offsetof(struct paca_struct, irq_happened)); DEFINE(PACACONTEXTID, offsetof(struct paca_struct, context.id)); diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index a0738af..4c3843e 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -736,6 +736,9 @@ void start_secondary(void *unused) cpu_startup_entry(CPUHP_ONLINE); +#ifdef CONFIG_KVMPPC_ENABLE_SECONDARY + get_paca()->online = true; +#endif BUG(); } diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S index f0c4db7..d5594b0 100644 --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S @@ -322,6 +322,13 @@ kvm_no_guest: li r0, KVM_HWTHREAD_IN_NAP stb r0, HSTATE_HWTHREAD_STATE(r13) kvm_do_nap: +#ifdef PPCKVM_ENABLE_SECONDARY + /* check the cpu is needed by host or not */ + ld r2, PACAONLINE(r13) + ld r3, 0 + cmp r2, r3 + bne kvm_secondary_exit_trampoline +#endif /* Clear the runlatch bit before napping */ mfspr r2, SPRN_CTRLF clrrdi r2, r2, 1 @@ -340,6 +347,11 @@ kvm_do_nap: nap b . +#ifdef PPCKVM_ENABLE_SECONDARY +kvm_secondary_exit_trampoline: + b . +#endif + /** ** * Entry code * -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC 05/11] sched: introduce stop_cpus_async() to schedule special tsk on cpu
The proto will be: cpu1 cpuX stop_cpus_async() bring cpuX to a special state signal flag and trapped check for flag The func help powerpc to reuse the scheme of cpu_stopper_task to force the secondary hwthread goto NAP state, in which state, cpu will not run any longer until the master cpu tells them to go. Signed-off-by: Liu Ping Fan --- include/linux/stop_machine.h | 2 ++ kernel/stop_machine.c| 25 - 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h index d2abbdb..871c1bf 100644 --- a/include/linux/stop_machine.h +++ b/include/linux/stop_machine.h @@ -32,6 +32,8 @@ int stop_two_cpus(unsigned int cpu1, unsigned int cpu2, cpu_stop_fn_t fn, void * void stop_one_cpu_nowait(unsigned int cpu, cpu_stop_fn_t fn, void *arg, struct cpu_stop_work *work_buf); int stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg); +int stop_cpus_async(const struct cpumask *cpumask, cpu_stop_fn_t fn, + void *arg); int try_stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg); #else /* CONFIG_SMP */ diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c index 695f0c6..d26fd6a 100644 --- a/kernel/stop_machine.c +++ b/kernel/stop_machine.c @@ -354,13 +354,15 @@ static void queue_stop_cpus_work(const struct cpumask *cpumask, } static int __stop_cpus(const struct cpumask *cpumask, - cpu_stop_fn_t fn, void *arg) + cpu_stop_fn_t fn, void *arg, bool sync) { struct cpu_stop_done done; - cpu_stop_init_done(&done, cpumask_weight(cpumask)); + if (sync) + cpu_stop_init_done(&done, cpumask_weight(cpumask)); queue_stop_cpus_work(cpumask, fn, arg, &done); - wait_for_completion(&done.completion); + if (sync) + wait_for_completion(&done.completion); return done.executed ? done.ret : -ENOENT; } @@ -398,7 +400,20 @@ int stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg) /* static works are used, process one request at a time */ mutex_lock(&stop_cpus_mutex); - ret = __stop_cpus(cpumask, fn, arg); + ret = __stop_cpus(cpumask, fn, arg, true); + mutex_unlock(&stop_cpus_mutex); + return ret; +} + +/* similar to stop_cpus(), but not wait for the ack. */ +int stop_cpus_async(const struct cpumask *cpumask, cpu_stop_fn_t fn, + void *arg) +{ + int ret; + + /* static works are used, process one request at a time */ + mutex_lock(&stop_cpus_mutex); + ret = __stop_cpus(cpumask, fn, arg, false); mutex_unlock(&stop_cpus_mutex); return ret; } @@ -428,7 +443,7 @@ int try_stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg) /* static works are used, process one request at a time */ if (!mutex_trylock(&stop_cpus_mutex)) return -EAGAIN; - ret = __stop_cpus(cpumask, fn, arg); + ret = __stop_cpus(cpumask, fn, arg, true); mutex_unlock(&stop_cpus_mutex); return ret; } -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC 04/11] powerpc: kvm: introduce a kthread on primary thread to anti tickless
(This patch is a place holder.) If there is only one vcpu thread is ready(the other vcpu thread can wait for it to execute), the primary thread can enter tickless mode, which causes the primary keeps running, so the secondary has no opportunity to exit to host, even they have other tsk on them. Introduce a kthread (anti_tickless) on primary, so when there is only one vcpu thread on primary, the secondary can resort to anti_tickless to keep the primary out of tickless mode. (I thought that anti_tickless thread can goto NAP, so we can let the secondary run). Signed-off-by: Liu Ping Fan --- arch/powerpc/kernel/sysfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c index a2595dd..f0b110e 100644 --- a/arch/powerpc/kernel/sysfs.c +++ b/arch/powerpc/kernel/sysfs.c @@ -575,9 +575,11 @@ static ssize_t __used store_kvm_enable(struct device *dev, if (!test_bit(core, &kvm_on_core)) for (thr = 1; thr< threads_per_core; thr++) if (cpu_online(thr * threads_per_core + thr)) - cpumask_set_cpu(thr * threads_per_core + thr, &stop_cpus); + cpumask_set_cpu(core * threads_per_core + thr, &stop_cpus); stop_machine(xics_migrate_irqs_away_secondary, NULL, &stop_cpus); + /* fixme, create a kthread on primary hwthread to handle tickless mode */ + //kthread_create_on_cpu(prevent_tickless, NULL, core * threads_per_core, "ppckvm_prevent_tickless"); set_bit(core, &kvm_on_core); return count; } -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC 03/11] powerpc: kvm: add interface to control kvm function on a core
When kvm is enabled on a core, we migrate all external irq to primary thread. Since currently, the kvmirq logic is handled by the primary hwthread. Todo: this patch lacks re-enable of irqbalance when kvm is disable on the core Signed-off-by: Liu Ping Fan --- arch/powerpc/kernel/sysfs.c| 39 ++ arch/powerpc/sysdev/xics/xics-common.c | 12 +++ 2 files changed, 51 insertions(+) diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c index 67fd2fd..a2595dd 100644 --- a/arch/powerpc/kernel/sysfs.c +++ b/arch/powerpc/kernel/sysfs.c @@ -552,6 +552,45 @@ static void sysfs_create_dscr_default(void) if (cpu_has_feature(CPU_FTR_DSCR)) err = device_create_file(cpu_subsys.dev_root, &dev_attr_dscr_default); } + +#ifdef CONFIG_KVMPPC_ENABLE_SECONDARY +#define NR_CORES (CONFIG_NR_CPUS/threads_per_core) +static DECLARE_BITMAP(kvm_on_core, NR_CORES) __read_mostly + +static ssize_t show_kvm_enable(struct device *dev, + struct device_attribute *attr, char *buf) +{ +} + +static ssize_t __used store_kvm_enable(struct device *dev, + struct device_attribute *attr, const char *buf, + size_t count) +{ + struct cpumask stop_cpus; + unsigned long core, thr; + + sscanf(buf, "%lx", &core); + if (core > NR_CORES) + return -1; + if (!test_bit(core, &kvm_on_core)) + for (thr = 1; thr< threads_per_core; thr++) + if (cpu_online(thr * threads_per_core + thr)) + cpumask_set_cpu(thr * threads_per_core + thr, &stop_cpus); + + stop_machine(xics_migrate_irqs_away_secondary, NULL, &stop_cpus); + set_bit(core, &kvm_on_core); + return count; +} + +static DEVICE_ATTR(kvm_enable, 0600, + show_kvm_enable, store_kvm_enable); + +static void sysfs_create_kvm_enable(void) +{ + device_create_file(cpu_subsys.dev_root, &dev_attr_kvm_enable); +} +#endif + #endif /* CONFIG_PPC64 */ #ifdef HAS_PPC_PMC_PA6T diff --git a/arch/powerpc/sysdev/xics/xics-common.c b/arch/powerpc/sysdev/xics/xics-common.c index fe0cca4..68b33d8 100644 --- a/arch/powerpc/sysdev/xics/xics-common.c +++ b/arch/powerpc/sysdev/xics/xics-common.c @@ -258,6 +258,18 @@ unlock: raw_spin_unlock_irqrestore(&desc->lock, flags); } } + +int xics_migrate_irqs_away_secondary(void *data) +{ + int cpu = smp_processor_id(); + if(cpu%thread_per_core != 0) { + WARN(condition, format...); + return 0; + } + /* In fact, if we can migrate the primary, it will be more fine */ + xics_migrate_irqs_away(); + return 0; +} #endif /* CONFIG_HOTPLUG_CPU */ #ifdef CONFIG_SMP -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC 02/11] powerpc: kvm: ensure vcpu-thread run only on primary hwthread
When vcpu thread runs at the first time, it will ensure to stick to the primary thread. Signed-off-by: Liu Ping Fan --- arch/powerpc/include/asm/kvm_host.h | 3 +++ arch/powerpc/kvm/book3s_hv.c| 17 + 2 files changed, 20 insertions(+) diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h index 98d9dd5..9a3355e 100644 --- a/arch/powerpc/include/asm/kvm_host.h +++ b/arch/powerpc/include/asm/kvm_host.h @@ -666,6 +666,9 @@ struct kvm_vcpu_arch { spinlock_t tbacct_lock; u64 busy_stolen; u64 busy_preempt; +#ifdef CONFIG_KVMPPC_ENABLE_SECONDARY + bool cpu_selected; +#endif #endif }; diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 27cced9..ba258c8 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -1909,6 +1909,23 @@ static int kvmppc_vcpu_run_hv(struct kvm_run *run, struct kvm_vcpu *vcpu) { int r; int srcu_idx; +#ifdef CONFIG_KVMPPC_ENABLE_SECONDARY + int cpu = smp_processor_id(); + int target_cpu; + unsigned int cpu; + struct task_struct *p = current; + + if (unlikely(!vcpu->arch.cpu_selected)) { + vcpu->arch.cpu_selected = true; + for (cpu = 0; cpu < NR_CPUS; cpu+=threads_per_core) { + cpumask_set_cpu(cpu, &p->sys_allowed); + } + if (cpu%threads_per_core != 0) { + target_cpu = cpu/threads_per_core*threads_per_core; + migrate_task_to(current, target_cpu); + } + } +#endif if (!vcpu->arch.sane) { run->exit_reason = KVM_EXIT_INTERNAL_ERROR; -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC 01/11] sched: introduce sys_cpumask in tsk to adapt asymmetric system
Some system such as powerpc, some tsk (vcpu thread) can only run on the dedicated cpu. Since we adapt some asymmetric method to monitor the whole physical cpu. (powerKVM only allows the primary hwthread to set up runtime env for the secondary when entering guest). Nowadays, powerKVM run with all the secondary hwthread offline to ensure the vcpu threads only run on the primary thread. But we plan to keep all cpus online when running powerKVM to give more power when switching back to host, so introduce sys_allowed cpumask to reflect the cpuset which the vcpu thread can run on. Signed-off-by: Liu Ping Fan --- include/linux/init_task.h | 1 + include/linux/sched.h | 6 ++ kernel/sched/core.c | 10 -- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 2bb4c4f3..c56f69e 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h @@ -172,6 +172,7 @@ extern struct task_group root_task_group; .normal_prio= MAX_PRIO-20, \ .policy = SCHED_NORMAL, \ .cpus_allowed = CPU_MASK_ALL, \ + .sys_allowed = CPU_MASK_ALL,\ .nr_cpus_allowed= NR_CPUS, \ .mm = NULL, \ .active_mm = &init_mm, \ diff --git a/include/linux/sched.h b/include/linux/sched.h index 5c2c885..ce429f3 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1260,7 +1260,10 @@ struct task_struct { unsigned int policy; int nr_cpus_allowed; + /* Anded user and sys_allowed */ cpumask_t cpus_allowed; + /* due to the feature of asymmetric, some tsk can only run on such cpu */ + cpumask_t sys_allowed; #ifdef CONFIG_PREEMPT_RCU int rcu_read_lock_nesting; @@ -2030,6 +2033,9 @@ static inline void tsk_restore_flags(struct task_struct *task, } #ifdef CONFIG_SMP +extern void set_cpus_sys_allowed(struct task_struct *p, + const struct cpumask *new_mask); + extern void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask); diff --git a/kernel/sched/core.c b/kernel/sched/core.c index ec1a286..2cd1ae3 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -4596,13 +4596,19 @@ void init_idle(struct task_struct *idle, int cpu) } #ifdef CONFIG_SMP +void set_cpus_sys_allowed(struct task_struct *p, + const struct cpumask *new_mask) +{ + cpumask_copy(&p->sys_allowed, new_mask); +} + void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask) { if (p->sched_class && p->sched_class->set_cpus_allowed) p->sched_class->set_cpus_allowed(p, new_mask); - cpumask_copy(&p->cpus_allowed, new_mask); - p->nr_cpus_allowed = cpumask_weight(new_mask); + cpumask_and(&p->cpus_allowed, &p->sys_allowed, new_mask); + p->nr_cpus_allowed = cpumask_weight(&p->cpus_allowed); } /* -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC 00/11]: powerKVM, release the compute power of secondary hwthread on host
Nowadays, when running powerKVM(book3s, hv mode), we should make the secondary hwthread offline. Which means that if we run misc tsks other than dedicated KVM (e.g mix java and KVM), we will lose the compute power of the secondary hwthread on host env. This series aim to make the powerpc adaptive to the misc tsks on host. ( This series is just a sketch, with some broken patch. Sorry to bring up it in a hurry, I am afraid that I am on the wrong direction too far. So I hope I can get some advice and feedback in advance. I will go on the work on the "place holder" patch if my idea is reasonable. Please consider the code as the explaining of my idea. ) The internal: -1.To enter guest, the primary hwthread schedule stopper func on the secondary to bring them into NAP mode. The proto will be: cpu1 cpuX stop_cpus_async() bring cpuX to a special state signal flag and trapped check for flag set up guest env and ipi cpuX -2.When exit to host, the secondary hardcode to jmp back to the stopper func, i.e back to host. Drawbacks that I can think so far: -1. increase the sched interval on secondary but the schduler do NOT know it.(can it cause problem?) -2. lose some presice of hrtime on secondary hwthread for host.(To avoid the primary has too small time slice, we need to impose a threshold,so we may lose the presice) Any suggestion? Thanks! Liu Ping Fan (11): sched: introduce sys_cpumask in tsk to adapt asymmetric system powerpc: kvm: ensure vcpu-thread run only on primary hwthread powerpc: kvm: add interface to control kvm function on a core powerpc: kvm: introduce a kthread on primary thread to anti tickless sched: introduce stop_cpus_async() to schedule special tsk on cpu powerpc: kvm: introduce online in paca to indicate whether cpu is needed by host powerpc: kvm: the stopper func to cease secondary hwthread powerpc: kvm: add a flag in vcore to sync primary with secondry hwthread powerpc: kvm: handle time base on secondary hwthread powerpc: kvm: on_primary_thread() force the secondary threads into NAP mode powerpc: kvm: Kconfig add an option for enabling secondary hwthread arch/powerpc/include/asm/kvm_host.h | 6 arch/powerpc/include/asm/paca.h | 3 ++ arch/powerpc/kernel/asm-offsets.c | 6 arch/powerpc/kernel/smp.c | 3 ++ arch/powerpc/kernel/sysfs.c | 41 ++ arch/powerpc/kvm/Kconfig| 4 +++ arch/powerpc/kvm/book3s_hv.c| 39 + arch/powerpc/kvm/book3s_hv_rmhandlers.S | 61 + arch/powerpc/sysdev/xics/xics-common.c | 12 +++ include/linux/init_task.h | 1 + include/linux/sched.h | 6 include/linux/stop_machine.h| 2 ++ kernel/sched/core.c | 10 -- kernel/stop_machine.c | 25 +++--- 14 files changed, 212 insertions(+), 7 deletions(-) -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev