LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/4] powerpc/64: Honor swiotlb limit in coherent allocations
From: Scott Wood @ 2014-08-08 23:40 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Scott Wood, linuxppc-dev, Shaohui Xie
In-Reply-To: <1407541245-27617-1-git-send-email-scottwood@freescale.com>

FSL PCI cannot directly address the whole lower 4 GiB due to
conflicts with PCICSRBAR and outbound windows, and thus
max_direct_dma_addr is less than 4GiB.  Honor that limit in
dma_direct_alloc_coherent().

Note that setting the DMA mask to 31 bits is not an option, since many
PCI drivers would fail if we reject 32-bit DMA in dma_supported(), and
we have no control over the setting of coherent_dma_mask if
dma_supported() returns true.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Cc: Shaohui Xie <Shaohui.Xie@freescale.com>
---
 arch/powerpc/kernel/dma.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c
index dfd99ef..a7b0156 100644
--- a/arch/powerpc/kernel/dma.c
+++ b/arch/powerpc/kernel/dma.c
@@ -15,6 +15,7 @@
 #include <asm/vio.h>
 #include <asm/bug.h>
 #include <asm/machdep.h>
+#include <asm/swiotlb.h>
 
 /*
  * Generic direct DMA implementation
@@ -25,6 +26,18 @@
  * default the offset is PCI_DRAM_OFFSET.
  */
 
+static u64 __maybe_unused get_pfn_limit(struct device *dev)
+{
+	u64 pfn = (dev->coherent_dma_mask >> PAGE_SHIFT) + 1;
+	struct dev_archdata __maybe_unused *sd = &dev->archdata;
+
+#ifdef CONFIG_SWIOTLB
+	if (sd->max_direct_dma_addr && sd->dma_ops == &swiotlb_dma_ops)
+		pfn = min_t(u64, pfn, sd->max_direct_dma_addr >> PAGE_SHIFT);
+#endif
+
+	return pfn;
+}
 
 void *dma_direct_alloc_coherent(struct device *dev, size_t size,
 				dma_addr_t *dma_handle, gfp_t flag,
@@ -40,7 +53,7 @@ void *dma_direct_alloc_coherent(struct device *dev, size_t size,
 #else
 	struct page *page;
 	int node = dev_to_node(dev);
-	u64 pfn = (dev->coherent_dma_mask >> PAGE_SHIFT) + 1;
+	u64 pfn = get_pfn_limit(dev);
 	int zone;
 
 	zone = dma_pfn_limit_to_zone(pfn);
-- 
1.9.1

^ permalink raw reply related

* [PATCH 3/4] powerpc/64: Limit ZONE_DMA32 to 4GiB in swiotlb_detect_4g()
From: Scott Wood @ 2014-08-08 23:40 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Scott Wood, linuxppc-dev, Shaohui Xie
In-Reply-To: <1407541245-27617-1-git-send-email-scottwood@freescale.com>

A DMA zone is still needed with swiotlb, for coherent allocations.
This doesn't affect platforms that don't use swiotlb or that don't call
swiotlb_detect_4g().

Signed-off-by: Scott Wood <scottwood@freescale.com>
Cc: Shaohui Xie <Shaohui.Xie@freescale.com>
---
 arch/powerpc/kernel/dma-swiotlb.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c
index bd1a2ab..7359797 100644
--- a/arch/powerpc/kernel/dma-swiotlb.c
+++ b/arch/powerpc/kernel/dma-swiotlb.c
@@ -106,10 +106,14 @@ int __init swiotlb_setup_bus_notifier(void)
 	return 0;
 }
 
-void swiotlb_detect_4g(void)
+void __init swiotlb_detect_4g(void)
 {
-	if ((memblock_end_of_DRAM() - 1) > 0xffffffff)
+	if ((memblock_end_of_DRAM() - 1) > 0xffffffff) {
 		ppc_swiotlb_enable = 1;
+#ifdef CONFIG_ZONE_DMA32
+		limit_zone_pfn(ZONE_DMA32, (1ULL << 32) >> PAGE_SHIFT);
+#endif
+	}
 }
 
 static int __init swiotlb_late_init(void)
-- 
1.9.1

^ permalink raw reply related

* [PATCH 4/4] powerpc/fsl-pci: Limit ZONE_DMA32 to 2GiB on 64-bit platforms
From: Scott Wood @ 2014-08-08 23:40 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Scott Wood, linuxppc-dev, Shaohui Xie
In-Reply-To: <1407541245-27617-1-git-send-email-scottwood@freescale.com>

FSL PCI cannot directly address the whole lower 4 GiB due to
conflicts with PCICSRBAR and outbound windows.  By the time
max_direct_dma_addr is set to the precise limit, it will be too late to
alter the zone limits, but we should always have at least 2 GiB mapped
(unless RAM is smaller than that).

Signed-off-by: Scott Wood <scottwood@freescale.com>
Cc: Shaohui Xie <Shaohui.Xie@freescale.com>
---
 arch/powerpc/platforms/85xx/corenet_generic.c | 11 +++++++++++
 arch/powerpc/platforms/85xx/qemu_e500.c       | 10 ++++++++++
 2 files changed, 21 insertions(+)

diff --git a/arch/powerpc/platforms/85xx/corenet_generic.c b/arch/powerpc/platforms/85xx/corenet_generic.c
index d22dd85..c2adb00 100644
--- a/arch/powerpc/platforms/85xx/corenet_generic.c
+++ b/arch/powerpc/platforms/85xx/corenet_generic.c
@@ -20,6 +20,7 @@
 #include <asm/time.h>
 #include <asm/machdep.h>
 #include <asm/pci-bridge.h>
+#include <asm/pgtable.h>
 #include <asm/ppc-pci.h>
 #include <mm/mmu_decl.h>
 #include <asm/prom.h>
@@ -67,6 +68,16 @@ void __init corenet_gen_setup_arch(void)
 
 	swiotlb_detect_4g();
 
+#if defined(CONFIG_FSL_PCI) && defined(CONFIG_ZONE_DMA32)
+	/*
+	 * Inbound windows don't cover the full lower 4 GiB
+	 * due to conflicts with PCICSRBAR and outbound windows,
+	 * so limit the DMA32 zone to 2 GiB, to allow consistent
+	 * allocations to succeed.
+	 */
+	limit_zone_pfn(ZONE_DMA32, 1UL << (31 - PAGE_SHIFT));
+#endif
+
 	pr_info("%s board\n", ppc_md.name);
 
 	mpc85xx_qe_init();
diff --git a/arch/powerpc/platforms/85xx/qemu_e500.c b/arch/powerpc/platforms/85xx/qemu_e500.c
index 7f26732..8ad2fe6 100644
--- a/arch/powerpc/platforms/85xx/qemu_e500.c
+++ b/arch/powerpc/platforms/85xx/qemu_e500.c
@@ -18,6 +18,7 @@
 #include <linux/kernel.h>
 #include <linux/of_fdt.h>
 #include <asm/machdep.h>
+#include <asm/pgtable.h>
 #include <asm/time.h>
 #include <asm/udbg.h>
 #include <asm/mpic.h>
@@ -44,6 +45,15 @@ static void __init qemu_e500_setup_arch(void)
 
 	fsl_pci_assign_primary();
 	swiotlb_detect_4g();
+#if defined(CONFIG_FSL_PCI) && defined(CONFIG_ZONE_DMA32)
+	/*
+	 * Inbound windows don't cover the full lower 4 GiB
+	 * due to conflicts with PCICSRBAR and outbound windows,
+	 * so limit the DMA32 zone to 2 GiB, to allow consistent
+	 * allocations to succeed.
+	 */
+	limit_zone_pfn(ZONE_DMA32, 1UL << (31 - PAGE_SHIFT));
+#endif
 	mpc85xx_smp_init();
 }
 
-- 
1.9.1

^ permalink raw reply related

* [PATCH v2] powerpc/nohash: Split __early_init_mmu() into boot and secondary
From: Scott Wood @ 2014-08-08 23:44 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Scott Wood, linuxppc-dev

__early_init_mmu() does some things that are really only needed by the
boot cpu.  On FSL booke, This includes calling
memblock_enforce_memory_limit(), which is labelled __init.  Secondary
cpu init code can't be __init as that would break CPU hotplug.

While it's probably a bug that memblock_enforce_memory_limit() isn't
__init_memblock instead, there's no reason why we should be doing this
stuff for secondary cpus in the first place.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
v2: Rename early_init_this_mmu(), and factor early_init_mmu_global()
and early_mmu_set_memory_limit() out from early_init_mmu().

 arch/powerpc/mm/tlb_nohash.c | 111 +++++++++++++++++++++++++------------------
 1 file changed, 66 insertions(+), 45 deletions(-)

diff --git a/arch/powerpc/mm/tlb_nohash.c b/arch/powerpc/mm/tlb_nohash.c
index 92cb18d..f38ea4d 100644
--- a/arch/powerpc/mm/tlb_nohash.c
+++ b/arch/powerpc/mm/tlb_nohash.c
@@ -581,42 +581,10 @@ static void setup_mmu_htw(void)
 /*
  * Early initialization of the MMU TLB code
  */
-static void __early_init_mmu(int boot_cpu)
+static void early_init_this_mmu(void)
 {
 	unsigned int mas4;
 
-	/* XXX This will have to be decided at runtime, but right
-	 * now our boot and TLB miss code hard wires it. Ideally
-	 * we should find out a suitable page size and patch the
-	 * TLB miss code (either that or use the PACA to store
-	 * the value we want)
-	 */
-	mmu_linear_psize = MMU_PAGE_1G;
-
-	/* XXX This should be decided at runtime based on supported
-	 * page sizes in the TLB, but for now let's assume 16M is
-	 * always there and a good fit (which it probably is)
-	 *
-	 * Freescale booke only supports 4K pages in TLB0, so use that.
-	 */
-	if (mmu_has_feature(MMU_FTR_TYPE_FSL_E))
-		mmu_vmemmap_psize = MMU_PAGE_4K;
-	else
-		mmu_vmemmap_psize = MMU_PAGE_16M;
-
-	/* XXX This code only checks for TLB 0 capabilities and doesn't
-	 *     check what page size combos are supported by the HW. It
-	 *     also doesn't handle the case where a separate array holds
-	 *     the IND entries from the array loaded by the PT.
-	 */
-	if (boot_cpu) {
-		/* Look for supported page sizes */
-		setup_page_sizes();
-
-		/* Look for HW tablewalk support */
-		setup_mmu_htw();
-	}
-
 	/* Set MAS4 based on page table setting */
 
 	mas4 = 0x4 << MAS4_WIMGED_SHIFT;
@@ -650,11 +618,6 @@ static void __early_init_mmu(int boot_cpu)
 	}
 	mtspr(SPRN_MAS4, mas4);
 
-	/* Set the global containing the top of the linear mapping
-	 * for use by the TLB miss code
-	 */
-	linear_map_top = memblock_end_of_DRAM();
-
 #ifdef CONFIG_PPC_FSL_BOOK3E
 	if (mmu_has_feature(MMU_FTR_TYPE_FSL_E)) {
 		unsigned int num_cams;
@@ -662,10 +625,49 @@ static void __early_init_mmu(int boot_cpu)
 		/* use a quarter of the TLBCAM for bolted linear map */
 		num_cams = (mfspr(SPRN_TLB1CFG) & TLBnCFG_N_ENTRY) / 4;
 		linear_map_top = map_mem_in_cams(linear_map_top, num_cams);
+	}
+#endif
 
-		/* limit memory so we dont have linear faults */
-		memblock_enforce_memory_limit(linear_map_top);
+	/* A sync won't hurt us after mucking around with
+	 * the MMU configuration
+	 */
+	mb();
+}
 
+static void __init early_init_mmu_global(void)
+{
+	/* XXX This will have to be decided at runtime, but right
+	 * now our boot and TLB miss code hard wires it. Ideally
+	 * we should find out a suitable page size and patch the
+	 * TLB miss code (either that or use the PACA to store
+	 * the value we want)
+	 */
+	mmu_linear_psize = MMU_PAGE_1G;
+
+	/* XXX This should be decided at runtime based on supported
+	 * page sizes in the TLB, but for now let's assume 16M is
+	 * always there and a good fit (which it probably is)
+	 *
+	 * Freescale booke only supports 4K pages in TLB0, so use that.
+	 */
+	if (mmu_has_feature(MMU_FTR_TYPE_FSL_E))
+		mmu_vmemmap_psize = MMU_PAGE_4K;
+	else
+		mmu_vmemmap_psize = MMU_PAGE_16M;
+
+	/* XXX This code only checks for TLB 0 capabilities and doesn't
+	 *     check what page size combos are supported by the HW. It
+	 *     also doesn't handle the case where a separate array holds
+	 *     the IND entries from the array loaded by the PT.
+	 */
+	/* Look for supported page sizes */
+	setup_page_sizes();
+
+	/* Look for HW tablewalk support */
+	setup_mmu_htw();
+
+#ifdef CONFIG_PPC_FSL_BOOK3E
+	if (mmu_has_feature(MMU_FTR_TYPE_FSL_E)) {
 		if (book3e_htw_mode == PPC_HTW_NONE) {
 			extlb_level_exc = EX_TLB_SIZE;
 			patch_exception(0x1c0, exc_data_tlb_miss_bolted_book3e);
@@ -675,22 +677,41 @@ static void __early_init_mmu(int boot_cpu)
 	}
 #endif
 
-	/* A sync won't hurt us after mucking around with
-	 * the MMU configuration
+	/* Set the global containing the top of the linear mapping
+	 * for use by the TLB miss code
 	 */
-	mb();
+	linear_map_top = memblock_end_of_DRAM();
+}
+
+static void __init early_mmu_set_memory_limit(void)
+{
+#ifdef CONFIG_PPC_FSL_BOOK3E
+	if (mmu_has_feature(MMU_FTR_TYPE_FSL_E)) {
+		/*
+		 * Limit memory so we dont have linear faults.
+		 * Unlike memblock_set_current_limit, which limits
+		 * memory available during early boot, this permanently
+		 * reduces the memory available to Linux.  We need to
+		 * do this because highmem is not supported on 64-bit.
+		 */
+		memblock_enforce_memory_limit(linear_map_top);
+	}
+#endif
 
 	memblock_set_current_limit(linear_map_top);
 }
 
+/* boot cpu only */
 void __init early_init_mmu(void)
 {
-	__early_init_mmu(1);
+	early_init_mmu_global();
+	early_init_this_mmu();
+	early_mmu_set_memory_limit();
 }
 
 void early_init_mmu_secondary(void)
 {
-	__early_init_mmu(0);
+	early_init_this_mmu();
 }
 
 void setup_initial_memory_limit(phys_addr_t first_memblock_base,
-- 
1.9.1

^ permalink raw reply related

* [PATCH] powerpc: Fix "attempt to move .org backwards" error
From: Guenter Roeck @ 2014-08-09  5:22 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Mahesh Salgaonkar, linuxppc-dev, linux-kernel, Guenter Roeck

Once again, we see

arch/powerpc/kernel/exceptions-64s.S: Assembler messages:
arch/powerpc/kernel/exceptions-64s.S:865: Error: attempt to move .org backwards
arch/powerpc/kernel/exceptions-64s.S:866: Error: attempt to move .org backwards
arch/powerpc/kernel/exceptions-64s.S:890: Error: attempt to move .org backwards

when compiling ppc:allmodconfig.

This time the problem has been caused by to commit 0869b6fd209bda
("powerpc/book3s: Add basic infrastructure to handle HMI in Linux"),
which adds functions hmi_exception_early and hmi_exception_after_realmode
into a critical (size-limited) code area, even though that does not appear
to be necessary.

Move those functions to a non-critical area of the file.

Cc: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
Compile tested with all ppc configurations.
The reported checkpatch error appears to be a false positive.

 arch/powerpc/kernel/exceptions-64s.S | 110 +++++++++++++++++------------------
 1 file changed, 55 insertions(+), 55 deletions(-)

diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index 6144d5a..050f79a 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -592,61 +592,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_CFAR)
 	MASKABLE_EXCEPTION_HV_OOL(0xe62, hmi_exception)
 	KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe62)
 
-	.globl hmi_exception_early
-hmi_exception_early:
-	EXCEPTION_PROLOG_1(PACA_EXGEN, NOTEST, 0xe60)
-	mr	r10,r1			/* Save r1			*/
-	ld	r1,PACAEMERGSP(r13)	/* Use emergency stack		*/
-	subi	r1,r1,INT_FRAME_SIZE	/* alloc stack frame		*/
-	std	r9,_CCR(r1)		/* save CR in stackframe	*/
-	mfspr	r11,SPRN_HSRR0		/* Save HSRR0 */
-	std	r11,_NIP(r1)		/* save HSRR0 in stackframe	*/
-	mfspr	r12,SPRN_HSRR1		/* Save SRR1 */
-	std	r12,_MSR(r1)		/* save SRR1 in stackframe	*/
-	std	r10,0(r1)		/* make stack chain pointer	*/
-	std	r0,GPR0(r1)		/* save r0 in stackframe	*/
-	std	r10,GPR1(r1)		/* save r1 in stackframe	*/
-	EXCEPTION_PROLOG_COMMON_2(PACA_EXGEN)
-	EXCEPTION_PROLOG_COMMON_3(0xe60)
-	addi	r3,r1,STACK_FRAME_OVERHEAD
-	bl	hmi_exception_realmode
-	/* Windup the stack. */
-	/* Clear MSR_RI before setting SRR0 and SRR1. */
-	li	r0,MSR_RI
-	mfmsr	r9			/* get MSR value */
-	andc	r9,r9,r0
-	mtmsrd	r9,1			/* Clear MSR_RI */
-	/* Move original HSRR0 and HSRR1 into the respective regs */
-	ld	r9,_MSR(r1)
-	mtspr	SPRN_HSRR1,r9
-	ld	r3,_NIP(r1)
-	mtspr	SPRN_HSRR0,r3
-	ld	r9,_CTR(r1)
-	mtctr	r9
-	ld	r9,_XER(r1)
-	mtxer	r9
-	ld	r9,_LINK(r1)
-	mtlr	r9
-	REST_GPR(0, r1)
-	REST_8GPRS(2, r1)
-	REST_GPR(10, r1)
-	ld	r11,_CCR(r1)
-	mtcr	r11
-	REST_GPR(11, r1)
-	REST_2GPRS(12, r1)
-	/* restore original r1. */
-	ld	r1,GPR1(r1)
-
-	/*
-	 * Go to virtual mode and pull the HMI event information from
-	 * firmware.
-	 */
-	.globl hmi_exception_after_realmode
-hmi_exception_after_realmode:
-	SET_SCRATCH0(r13)
-	EXCEPTION_PROLOG_0(PACA_EXGEN)
-	b	hmi_exception_hv
-
 	MASKABLE_EXCEPTION_HV_OOL(0xe82, h_doorbell)
 	KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe82)
 
@@ -1306,6 +1251,61 @@ fwnmi_data_area:
 	. = 0x8000
 #endif /* defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV) */
 
+	.globl hmi_exception_early
+hmi_exception_early:
+	EXCEPTION_PROLOG_1(PACA_EXGEN, NOTEST, 0xe60)
+	mr	r10,r1			/* Save r1			*/
+	ld	r1,PACAEMERGSP(r13)	/* Use emergency stack		*/
+	subi	r1,r1,INT_FRAME_SIZE	/* alloc stack frame		*/
+	std	r9,_CCR(r1)		/* save CR in stackframe	*/
+	mfspr	r11,SPRN_HSRR0		/* Save HSRR0 */
+	std	r11,_NIP(r1)		/* save HSRR0 in stackframe	*/
+	mfspr	r12,SPRN_HSRR1		/* Save SRR1 */
+	std	r12,_MSR(r1)		/* save SRR1 in stackframe	*/
+	std	r10,0(r1)		/* make stack chain pointer	*/
+	std	r0,GPR0(r1)		/* save r0 in stackframe	*/
+	std	r10,GPR1(r1)		/* save r1 in stackframe	*/
+	EXCEPTION_PROLOG_COMMON_2(PACA_EXGEN)
+	EXCEPTION_PROLOG_COMMON_3(0xe60)
+	addi	r3,r1,STACK_FRAME_OVERHEAD
+	bl	hmi_exception_realmode
+	/* Windup the stack. */
+	/* Clear MSR_RI before setting SRR0 and SRR1. */
+	li	r0,MSR_RI
+	mfmsr	r9			/* get MSR value */
+	andc	r9,r9,r0
+	mtmsrd	r9,1			/* Clear MSR_RI */
+	/* Move original HSRR0 and HSRR1 into the respective regs */
+	ld	r9,_MSR(r1)
+	mtspr	SPRN_HSRR1,r9
+	ld	r3,_NIP(r1)
+	mtspr	SPRN_HSRR0,r3
+	ld	r9,_CTR(r1)
+	mtctr	r9
+	ld	r9,_XER(r1)
+	mtxer	r9
+	ld	r9,_LINK(r1)
+	mtlr	r9
+	REST_GPR(0, r1)
+	REST_8GPRS(2, r1)
+	REST_GPR(10, r1)
+	ld	r11,_CCR(r1)
+	mtcr	r11
+	REST_GPR(11, r1)
+	REST_2GPRS(12, r1)
+	/* restore original r1. */
+	ld	r1,GPR1(r1)
+
+	/*
+	 * Go to virtual mode and pull the HMI event information from
+	 * firmware.
+	 */
+	.globl hmi_exception_after_realmode
+hmi_exception_after_realmode:
+	SET_SCRATCH0(r13)
+	EXCEPTION_PROLOG_0(PACA_EXGEN)
+	b	hmi_exception_hv
+
 #ifdef CONFIG_PPC_POWERNV
 _GLOBAL(opal_mc_secondary_handler)
 	HMT_MEDIUM_PPR_DISCARD
-- 
1.9.1

^ permalink raw reply related

* [PATCH v3 1/2] printk: Add function to return log buffer address and size
From: Vasant Hegde @ 2014-08-09  5:45 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Andrew Morton, Linus Torvalds, linux-kernel

Platforms like IBM Power Systems supports service processor
assisted dump. It provides interface to add memory region to
be captured when system is crashed.

During initialization/running we can add kernel memory region
to be collected.

Presently we don't have a way to get the log buffer base address
and size. This patch adds support to return log buffer address
and size.

Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

---
Next patch extends arch specific code to add log buffer to platform
dump.

Changes in v3:
  As Andrew suggested changed function names and return type.
  (https://lists.ozlabs.org/pipermail/linuxppc-dev/2014-August/119802.html).

Ben,
  - This patchset applies cleanly on powerpc next branch.
  - Andrew Morton suggested to include this patch in powerpc tree.
    (https://lists.ozlabs.org/pipermail/linuxppc-dev/2014-August/119802.html)


 include/linux/printk.h |    3 +++
 kernel/printk/printk.c |   12 ++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/include/linux/printk.h b/include/linux/printk.h
index 319ff7e..b8c0316 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -10,6 +10,9 @@
 extern const char linux_banner[];
 extern const char linux_proc_banner[];
 
+extern char *log_buf_addr_get(void);
+extern u32 log_buf_len_get(void);
+
 static inline int printk_get_level(const char *buffer)
 {
 	if (buffer[0] == KERN_SOH_ASCII && buffer[1]) {
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index ea2d5f6..d6a984c 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -270,6 +270,18 @@ static char __log_buf[__LOG_BUF_LEN] __aligned(LOG_ALIGN);
 static char *log_buf = __log_buf;
 static u32 log_buf_len = __LOG_BUF_LEN;
 
+/* Return log buffer address */
+char *log_buf_addr_get(void)
+{
+	return log_buf;
+}
+
+/* Return log buffer size */
+u32 log_buf_len_get(void)
+{
+	return log_buf_len;
+}
+
 /* human readable text of the record */
 static char *log_text(const struct printk_log *msg)
 {

^ permalink raw reply related

* [PATCH v3 2/2] powerpc/powernv: Interface to register/unregister opal dump region
From: Vasant Hegde @ 2014-08-09  5:45 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Andrew Morton, Linus Torvalds, linux-kernel
In-Reply-To: <20140809054424.17676.1090.stgit@hegdevasant.in.ibm.com>

PowerNV platform is capable of capturing host memory region when system
crashes (because of host/firmware). We have new OPAL API to register/
unregister memory region to be captured when system crashes.

This patch adds support for new API. Also during boot time we register
kernel log buffer and unregister before doing kexec.

Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 arch/powerpc/include/asm/opal.h                |   11 +++++++++++
 arch/powerpc/platforms/powernv/opal-wrappers.S |    2 ++
 arch/powerpc/platforms/powernv/opal.c          |   23 +++++++++++++++++++++++
 3 files changed, 36 insertions(+)

diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index b2f8ce1..86055e5 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -149,6 +149,8 @@ struct opal_sg_list {
 #define OPAL_DUMP_INFO2				94
 #define OPAL_PCI_EEH_FREEZE_SET			97
 #define OPAL_HANDLE_HMI				98
+#define OPAL_REGISTER_DUMP_REGION		101
+#define OPAL_UNREGISTER_DUMP_REGION		102
 
 #ifndef __ASSEMBLY__
 
@@ -920,6 +922,8 @@ int64_t opal_set_param(uint64_t token, uint32_t param_id, uint64_t buffer,
 		uint64_t length);
 int64_t opal_sensor_read(uint32_t sensor_hndl, int token, __be32 *sensor_data);
 int64_t opal_handle_hmi(void);
+int64_t opal_register_dump_region(uint32_t id, uint64_t start, uint64_t end);
+int64_t opal_unregister_dump_region(uint32_t id);
 
 /* Internal functions */
 extern int early_init_dt_scan_opal(unsigned long node, const char *uname,
@@ -974,6 +978,13 @@ struct opal_sg_list *opal_vmalloc_to_sg_list(void *vmalloc_addr,
 					     unsigned long vmalloc_size);
 void opal_free_sg_list(struct opal_sg_list *sg);
 
+/*
+ * Dump region ID range usable by the OS
+ */
+#define OPAL_DUMP_REGION_HOST_START		0x80
+#define OPAL_DUMP_REGION_LOG_BUF		0x80
+#define OPAL_DUMP_REGION_HOST_END		0xFF
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __OPAL_H */
diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S
index a328be4..2e6ce1b 100644
--- a/arch/powerpc/platforms/powernv/opal-wrappers.S
+++ b/arch/powerpc/platforms/powernv/opal-wrappers.S
@@ -245,3 +245,5 @@ OPAL_CALL(opal_sensor_read,			OPAL_SENSOR_READ);
 OPAL_CALL(opal_get_param,			OPAL_GET_PARAM);
 OPAL_CALL(opal_set_param,			OPAL_SET_PARAM);
 OPAL_CALL(opal_handle_hmi,			OPAL_HANDLE_HMI);
+OPAL_CALL(opal_register_dump_region,		OPAL_REGISTER_DUMP_REGION);
+OPAL_CALL(opal_unregister_dump_region,		OPAL_UNREGISTER_DUMP_REGION);
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index f0a01a4..b44eec3 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -605,6 +605,24 @@ static int opal_sysfs_init(void)
 	return 0;
 }
 
+static void __init opal_dump_region_init(void)
+{
+	void *addr;
+	uint64_t size;
+	int rc;
+
+	/* Register kernel log buffer */
+	addr = log_buf_addr_get();
+	size = log_buf_len_get();
+	rc = opal_register_dump_region(OPAL_DUMP_REGION_LOG_BUF,
+				       __pa(addr), size);
+	/* Don't warn if this is just an older OPAL that doesn't
+	 * know about that call
+	 */
+	if (rc && rc != OPAL_UNSUPPORTED)
+		pr_warn("DUMP: Failed to register kernel log buffer. "
+			"rc = %d\n", rc);
+}
 static int __init opal_init(void)
 {
 	struct device_node *np, *consoles;
@@ -654,6 +672,8 @@ static int __init opal_init(void)
 	/* Create "opal" kobject under /sys/firmware */
 	rc = opal_sysfs_init();
 	if (rc == 0) {
+		/* Setup dump region interface */
+		opal_dump_region_init();
 		/* Setup error log interface */
 		rc = opal_elog_init();
 		/* Setup code update interface */
@@ -694,6 +714,9 @@ void opal_shutdown(void)
 		else
 			mdelay(10);
 	}
+
+	/* Unregister memory dump region */
+	opal_unregister_dump_region(OPAL_DUMP_REGION_LOG_BUF);
 }
 
 /* Export this so that test modules can use it */

^ permalink raw reply related

* Re: [PATCH 00/20] powerpc/8xx: Optimise MMU TLB handling and add support of 16k pages
From: Joakim Tjernlund @ 2014-08-10  9:01 UTC (permalink / raw)
  To: Christophe Leroy; +Cc: linux-kernel, Paul Mackerras, scottwood, linuxppc-dev
In-Reply-To: <20140808070339.48C4D1ABCF0@localhost.localdomain>

=20
 This looks really cool! I am on vacation for one more week but I will have=
 a closer
 look once I get back and things get back to normal.

  Jocke
=20

 -----Christophe Leroy <christophe.leroy@c-s.fr> wrote: -----

 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 To: Benjamin Herrenschmidt <benh@kernel.crashing.org>, Paul Mackerras <pau=
lus@samba.org>
 From: Christophe Leroy <christophe.leroy@c-s.fr>
 Date: 08/08/2014 9:04=20
 Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Joakim Tj=
ernlund <joakim.tjernlund@transmode.se>, scottwood@freescale.com
 Subject: [PATCH 00/20] powerpc/8xx: Optimise MMU TLB handling and add supp=
ort of 16k pages
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
   This patchset:
* provides several MMU TLB handling optimisation on MPC8xx.
* adds support of 16k pages on MPC8xx.
All changes have been successfully tested on a custom board equipped with M=
PC885

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Tested-by: Christophe Leroy <christophe.leroy@c-s.fr>
    

^ permalink raw reply

* [PATCH] net: ugg_geth: Fix build error in -next
From: Guenter Roeck @ 2014-08-10 16:19 UTC (permalink / raw)
  To: Li Yang
  Cc: netdev, linux-kernel, Uwe Kleine-König, linuxppc-dev,
	David S. Miller, Guenter Roeck

powerpc:mpc83xx_defconfig and other builds fail with

drivers/net/ethernet/freescale/ucc_geth.c: In function 'ucc_geth_remove':
drivers/net/ethernet/freescale/ucc_geth.c:3927:19: error:
	'struct ucc_geth_private' has no member named 'info'
  of_node_put(ugeth->info->tbi_node);
                     ^
drivers/net/ethernet/freescale/ucc_geth.c:3928:19: error:
	     'struct ucc_geth_private' has no member named 'info'
  of_node_put(ugeth->info->phy_node);
  		     ^

Introduced by commit "net: ucc_geth: drop acquired references in probe error
path and remove".

>From the context, it appears that the variable is named ug_info.

Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
Only seen in -next.

 drivers/net/ethernet/freescale/ucc_geth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c
index d6b64e3..3cf0478 100644
--- a/drivers/net/ethernet/freescale/ucc_geth.c
+++ b/drivers/net/ethernet/freescale/ucc_geth.c
@@ -3924,8 +3924,8 @@ static int ucc_geth_remove(struct platform_device* ofdev)
 	unregister_netdev(dev);
 	free_netdev(dev);
 	ucc_geth_memclean(ugeth);
-	of_node_put(ugeth->info->tbi_node);
-	of_node_put(ugeth->info->phy_node);
+	of_node_put(ugeth->ug_info->tbi_node);
+	of_node_put(ugeth->ug_info->phy_node);
 
 	return 0;
 }
-- 
1.9.1

^ permalink raw reply related

* Re: [PATCH] net: ugg_geth: Fix build error in -next
From: Guenter Roeck @ 2014-08-10 17:46 UTC (permalink / raw)
  To: Li Yang
  Cc: netdev, Uwe Kleine-König, linuxppc-dev, David S. Miller,
	linux-kernel
In-Reply-To: <1407687554-14539-1-git-send-email-linux@roeck-us.net>

Grumble. Headline should be s/ugg/ucc, obviously.

Guenter

On 08/10/2014 09:19 AM, Guenter Roeck wrote:
> powerpc:mpc83xx_defconfig and other builds fail with
>
> drivers/net/ethernet/freescale/ucc_geth.c: In function 'ucc_geth_remove':
> drivers/net/ethernet/freescale/ucc_geth.c:3927:19: error:
> 	'struct ucc_geth_private' has no member named 'info'
>    of_node_put(ugeth->info->tbi_node);
>                       ^
> drivers/net/ethernet/freescale/ucc_geth.c:3928:19: error:
> 	     'struct ucc_geth_private' has no member named 'info'
>    of_node_put(ugeth->info->phy_node);
>    		     ^
>
> Introduced by commit "net: ucc_geth: drop acquired references in probe error
> path and remove".
>
>>From the context, it appears that the variable is named ug_info.
>
> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> Only seen in -next.
>
>   drivers/net/ethernet/freescale/ucc_geth.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c
> index d6b64e3..3cf0478 100644
> --- a/drivers/net/ethernet/freescale/ucc_geth.c
> +++ b/drivers/net/ethernet/freescale/ucc_geth.c
> @@ -3924,8 +3924,8 @@ static int ucc_geth_remove(struct platform_device* ofdev)
>   	unregister_netdev(dev);
>   	free_netdev(dev);
>   	ucc_geth_memclean(ugeth);
> -	of_node_put(ugeth->info->tbi_node);
> -	of_node_put(ugeth->info->phy_node);
> +	of_node_put(ugeth->ug_info->tbi_node);
> +	of_node_put(ugeth->ug_info->phy_node);
>
>   	return 0;
>   }
>

^ permalink raw reply

* [PATCH] net: ucc_geth: fix build failure
From: Uwe Kleine-König @ 2014-08-10 18:32 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linuxppc-dev, Florian Fainelli, kernel
In-Reply-To: <20140808.135237.120203200807493642.davem@davemloft.net>

My series to fix the reference counting of dt nodes introduced a build
failure. Fix it.

Fixes: fa310789a488 ("net: ucc_geth: drop acquired references in probe error path and remove")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hello,

I found a powerpc toolchain now, so this really builds now. Sorry for the
inconvenience.

Uwe

 drivers/net/ethernet/freescale/ucc_geth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c
index d6b64e316527..3cf0478b3728 100644
--- a/drivers/net/ethernet/freescale/ucc_geth.c
+++ b/drivers/net/ethernet/freescale/ucc_geth.c
@@ -3924,8 +3924,8 @@ static int ucc_geth_remove(struct platform_device* ofdev)
 	unregister_netdev(dev);
 	free_netdev(dev);
 	ucc_geth_memclean(ugeth);
-	of_node_put(ugeth->info->tbi_node);
-	of_node_put(ugeth->info->phy_node);
+	of_node_put(ugeth->ug_info->tbi_node);
+	of_node_put(ugeth->ug_info->phy_node);
 
 	return 0;
 }
-- 
2.0.1

^ permalink raw reply related

* Re: [PATCH] net: ugg_geth: Fix build error in -next
From: Uwe Kleine-König @ 2014-08-10 18:36 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: netdev, linuxppc-dev, David S. Miller, linux-kernel
In-Reply-To: <1407687554-14539-1-git-send-email-linux@roeck-us.net>

Hello Guenter,

On Sun, Aug 10, 2014 at 09:19:14AM -0700, Guenter Roeck wrote:
> powerpc:mpc83xx_defconfig and other builds fail with
> 
> drivers/net/ethernet/freescale/ucc_geth.c: In function 'ucc_geth_remove':
> drivers/net/ethernet/freescale/ucc_geth.c:3927:19: error:
> 	'struct ucc_geth_private' has no member named 'info'
>   of_node_put(ugeth->info->tbi_node);
>                      ^
> drivers/net/ethernet/freescale/ucc_geth.c:3928:19: error:
> 	     'struct ucc_geth_private' has no member named 'info'
>   of_node_put(ugeth->info->phy_node);
>   		     ^
> 
> Introduced by commit "net: ucc_geth: drop acquired references in probe error
> path and remove".
> 
> From the context, it appears that the variable is named ug_info.
> 
> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> Only seen in -next.
My patch was only sent just now, but it has the subject right:

	http://mid.gmane.org/1407695525-32227-1-git-send-email-u.kleine-koenig@pengutronix.de

Another upside is that it contains a Fixes: header.

Other than that my patch is the same. In case davem picks up yours:

Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Best regards and thanks
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply

* Re: [PATCH] net: ugg_geth: Fix build error in -next
From: Guenter Roeck @ 2014-08-10 18:42 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: netdev, linuxppc-dev, David S. Miller, linux-kernel
In-Reply-To: <20140810183622.GC5134@pengutronix.de>

On 08/10/2014 11:36 AM, Uwe Kleine-König wrote:
> Hello Guenter,
>
> On Sun, Aug 10, 2014 at 09:19:14AM -0700, Guenter Roeck wrote:
>> powerpc:mpc83xx_defconfig and other builds fail with
>>
>> drivers/net/ethernet/freescale/ucc_geth.c: In function 'ucc_geth_remove':
>> drivers/net/ethernet/freescale/ucc_geth.c:3927:19: error:
>> 	'struct ucc_geth_private' has no member named 'info'
>>    of_node_put(ugeth->info->tbi_node);
>>                       ^
>> drivers/net/ethernet/freescale/ucc_geth.c:3928:19: error:
>> 	     'struct ucc_geth_private' has no member named 'info'
>>    of_node_put(ugeth->info->phy_node);
>>    		     ^
>>
>> Introduced by commit "net: ucc_geth: drop acquired references in probe error
>> path and remove".
>>
>>  From the context, it appears that the variable is named ug_info.
>>
>> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>> ---
>> Only seen in -next.
> My patch was only sent just now, but it has the subject right:
>
Excellent.

> 	http://mid.gmane.org/1407695525-32227-1-git-send-email-u.kleine-koenig@pengutronix.de
>
The link doesn't seem to work for some reason.

> Another upside is that it contains a Fixes: header.
>
Even better. I need to start using that.

> Other than that my patch is the same. In case davem picks up yours:
>
> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
>

I don't need the glory ;-). Dave, please pick Uwe's patch.

Thanks,
Guenter

^ permalink raw reply

* Re: [PATCH] powerpc: Fix "attempt to move .org backwards" error
From: Stephen Rothwell @ 2014-08-11  0:20 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linuxppc-dev, linux-kernel, Mahesh Salgaonkar
In-Reply-To: <1407561732-817-1-git-send-email-linux@roeck-us.net>

[-- Attachment #1: Type: text/plain, Size: 1217 bytes --]

Hi Guenter,

On Fri,  8 Aug 2014 22:22:12 -0700 Guenter Roeck <linux@roeck-us.net> wrote:
>
> Once again, we see
> 
> arch/powerpc/kernel/exceptions-64s.S: Assembler messages:
> arch/powerpc/kernel/exceptions-64s.S:865: Error: attempt to move .org backwards
> arch/powerpc/kernel/exceptions-64s.S:866: Error: attempt to move .org backwards
> arch/powerpc/kernel/exceptions-64s.S:890: Error: attempt to move .org backwards
> 
> when compiling ppc:allmodconfig.
> 
> This time the problem has been caused by to commit 0869b6fd209bda
> ("powerpc/book3s: Add basic infrastructure to handle HMI in Linux"),
> which adds functions hmi_exception_early and hmi_exception_after_realmode
> into a critical (size-limited) code area, even though that does not appear
> to be necessary.
> 
> Move those functions to a non-critical area of the file.
> 
> Cc: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> Compile tested with all ppc configurations.
> The reported checkpatch error appears to be a false positive.

Thanks.

I have added that to my fixes tree for today.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply

* Re: [PATCH v3 1/2] printk: Add function to return log buffer address and size
From: Benjamin Herrenschmidt @ 2014-08-11  1:13 UTC (permalink / raw)
  To: Vasant Hegde; +Cc: Linus Torvalds, Andrew Morton, linuxppc-dev, linux-kernel
In-Reply-To: <20140809054424.17676.1090.stgit@hegdevasant.in.ibm.com>

On Sat, 2014-08-09 at 11:15 +0530, Vasant Hegde wrote:

> Ben,
>   - This patchset applies cleanly on powerpc next branch.
>   - Andrew Morton suggested to include this patch in powerpc tree.
>     (https://lists.ozlabs.org/pipermail/linuxppc-dev/2014-August/119802.html)
> 

Ok, Andrew, can I have an Ack ?

Cheers,
Ben.

>  include/linux/printk.h |    3 +++
>  kernel/printk/printk.c |   12 ++++++++++++
>  2 files changed, 15 insertions(+)
> 
> diff --git a/include/linux/printk.h b/include/linux/printk.h
> index 319ff7e..b8c0316 100644
> --- a/include/linux/printk.h
> +++ b/include/linux/printk.h
> @@ -10,6 +10,9 @@
>  extern const char linux_banner[];
>  extern const char linux_proc_banner[];
>  
> +extern char *log_buf_addr_get(void);
> +extern u32 log_buf_len_get(void);
> +
>  static inline int printk_get_level(const char *buffer)
>  {
>  	if (buffer[0] == KERN_SOH_ASCII && buffer[1]) {
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index ea2d5f6..d6a984c 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -270,6 +270,18 @@ static char __log_buf[__LOG_BUF_LEN] __aligned(LOG_ALIGN);
>  static char *log_buf = __log_buf;
>  static u32 log_buf_len = __LOG_BUF_LEN;
>  
> +/* Return log buffer address */
> +char *log_buf_addr_get(void)
> +{
> +	return log_buf;
> +}
> +
> +/* Return log buffer size */
> +u32 log_buf_len_get(void)
> +{
> +	return log_buf_len;
> +}
> +
>  /* human readable text of the record */
>  static char *log_text(const struct printk_log *msg)
>  {

^ permalink raw reply

* Re: [PATCH 7/14] cpu: delete unneeded test before of_node_put
From: Benjamin Herrenschmidt @ 2014-08-11  2:56 UTC (permalink / raw)
  To: Julia Lawall
  Cc: kernel-janitors, linux-kernel, Paul Mackerras,
	Uwe Kleine-König, linuxppc-dev
In-Reply-To: <1407492475-26283-3-git-send-email-Julia.Lawall@lip6.fr>

On Fri, 2014-08-08 at 12:07 +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Simplify the error path to avoid calling of_node_put when it is not needed.
> 
> The semantic patch that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)

Change the subject to powerpc/4xx/cpm or something like that,
appart from that:

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

> 
> // <smpl>
> @@
> expression e;
> @@
> 
> -if (e)
>    of_node_put(e);
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> ---
>  arch/powerpc/sysdev/ppc4xx_cpm.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/powerpc/sysdev/ppc4xx_cpm.c b/arch/powerpc/sysdev/ppc4xx_cpm.c
> index 82e2cfe..ba95adf 100644
> --- a/arch/powerpc/sysdev/ppc4xx_cpm.c
> +++ b/arch/powerpc/sysdev/ppc4xx_cpm.c
> @@ -281,7 +281,7 @@ static int __init cpm_init(void)
>  		printk(KERN_ERR "cpm: could not parse dcr property for %s\n",
>  		       np->full_name);
>  		ret = -EINVAL;
> -		goto out;
> +		goto node_put;
>  	}
>  
>  	cpm.dcr_host = dcr_map(np, dcr_base, dcr_len);
> @@ -290,7 +290,7 @@ static int __init cpm_init(void)
>  		printk(KERN_ERR "cpm: failed to map dcr property for %s\n",
>  		       np->full_name);
>  		ret = -EINVAL;
> -		goto out;
> +		goto node_put;
>  	}
>  
>  	/* All 4xx SoCs with a CPM controller have one of two
> @@ -330,9 +330,9 @@ static int __init cpm_init(void)
>  
>  	if (cpm.standby || cpm.suspend)
>  		suspend_set_ops(&cpm_suspend_ops);
> +node_put:
> +	of_node_put(np);
>  out:
> -	if (np)
> -		of_node_put(np);
>  	return ret;
>  }
>  

^ permalink raw reply

* Re: [PATCH 6/14] powerpc/fsl: fsl_soc: delete unneeded test before of_node_put
From: Benjamin Herrenschmidt @ 2014-08-11  2:56 UTC (permalink / raw)
  To: Julia Lawall
  Cc: kernel-janitors, linux-kernel, Paul Mackerras,
	Uwe Kleine-König, linuxppc-dev
In-Reply-To: <1407492475-26283-4-git-send-email-Julia.Lawall@lip6.fr>

On Fri, 2014-08-08 at 12:07 +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Of_node_put supports NULL as its argument, so the initial test is not
> necessary.
> 
> Suggested by Uwe Kleine-König.
> 
> The semantic patch that fixes this problem is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> expression e;
> @@
> 
> -if (e)
>    of_node_put(e);
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

> ---
>  arch/powerpc/sysdev/fsl_soc.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
> index ffd1169..bfb5b6c 100644
> --- a/arch/powerpc/sysdev/fsl_soc.c
> +++ b/arch/powerpc/sysdev/fsl_soc.c
> @@ -197,8 +197,7 @@ static int __init setup_rstcr(void)
>  	if (!rstcr && ppc_md.restart == fsl_rstcr_restart)
>  		printk(KERN_ERR "No RSTCR register, warm reboot won't work\n");
>  
> -	if (np)
> -		of_node_put(np);
> +	of_node_put(np);
>  
>  	return 0;
>  }
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply

* Re: [PATCH 2/2] powerpc/powernv: Remove duplicate check in tce_iommu_bus_notifier()
From: Benjamin Herrenschmidt @ 2014-08-11  3:11 UTC (permalink / raw)
  To: Gavin Shan; +Cc: linuxppc-dev
In-Reply-To: <1407309017-13870-2-git-send-email-gwshan@linux.vnet.ibm.com>

On Wed, 2014-08-06 at 17:10 +1000, Gavin Shan wrote:
> The called function iommu_del_device() checks if the device has
> attached IOMMU group, we needn't check it again in the parent
> function call tce_iommu_bus_notifier().

The patch does more than that... it also refactors the function, which
it should either not do or document.

> Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
> ---
>  arch/powerpc/platforms/powernv/pci.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
> index f91a4e5..b562b0d 100644
> --- a/arch/powerpc/platforms/powernv/pci.c
> +++ b/arch/powerpc/platforms/powernv/pci.c
> @@ -820,17 +820,18 @@ static int tce_iommu_bus_notifier(struct notifier_block *nb,
>  		unsigned long action, void *data)
>  {
>  	struct device *dev = data;
> +	int ret = 0;
>  
>  	switch (action) {
>  	case BUS_NOTIFY_ADD_DEVICE:
> -		return iommu_add_device(dev);
> +		ret = iommu_add_device(dev);
> +		break;
>  	case BUS_NOTIFY_DEL_DEVICE:
> -		if (dev->iommu_group)
> -			iommu_del_device(dev);
> -		return 0;
> -	default:
> -		return 0;
> +		iommu_del_device(dev);
> +		break;
>  	}
> +
> +	return ret;
>  }
>  
>  static struct notifier_block tce_iommu_bus_nb = {

^ permalink raw reply

* Re: [PATCH] powerpc: non-GPL export for eeh_dev_check_failure
From: Benjamin Herrenschmidt @ 2014-08-11  3:16 UTC (permalink / raw)
  To: One Thousand Gnomes; +Cc: linuxppc-dev, Vishal Mansur, gwshan, linux-kernel
In-Reply-To: <20140805155140.2b200061@alan.etchedpixels.co.uk>

On Tue, 2014-08-05 at 15:51 +0100, One Thousand Gnomes wrote:
> On Tue, 05 Aug 2014 20:12:09 +0530
> Vishal Mansur <vmansur@linux.vnet.ibm.com> wrote:
> 
> > EEH kernel services are inconsistently exported by the 
> > kernel. eeh_check_failure is exported for any use, but 
> > eeh_dev_check_failure is exported only for GPL use. 
> > While eeh_check_failure is implemented for a specific 
> > purpose to be used by services such as readl, it is 
> > not suited for a purpose where caller needs eeh status. 
> > This functionality is provided by eeh_dev_check_failure.
> > 
> > This patch relaxes the export for eeh_dev_check_failure
> > to make it consistent with eeh_check_failure() and 
> > usable by non-GPL modules.
> 
> The GPL covers all derivative works. Tweaking this doesn't magically
> allow you to use the feature in non GPL code. Your legal department can I
> am sure explain in detail further.

This is an interesting case... I assume this has to do with a well known
GPU manufacturer...

The PCI APIs are generally exported in such a way that a non-GPL driver
can use them (regardless of whether one considers a non-GPL driver to be
legal here or not, this is besides the point).

eeh_dev_check_failure() can be considered as powerpc specific extension
of the PCI API for use by PCI drivers and as such, it *could* be
construed that we should be consistent (and consistent with
eeh_check_failure()) and expose it as an EXPORT_SYMBOL without the GPL
suffix.

So I'm somewhat tempted to take this patch, but Vishal, the driver in
question could, I suppose, as a workaround, use a readl to some scratch
register of some description, no ?

Cheers,
Ben.

> Alan
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply

* Re: [PATCH 4/14] powerpc/pseries: delete unneeded test before of_node_put
From: Benjamin Herrenschmidt @ 2014-08-11  2:57 UTC (permalink / raw)
  To: Julia Lawall
  Cc: kernel-janitors, linux-kernel, Paul Mackerras,
	Uwe Kleine-König, linuxppc-dev
In-Reply-To: <1407492475-26283-6-git-send-email-Julia.Lawall@lip6.fr>

On Fri, 2014-08-08 at 12:07 +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Of_node_put supports NULL as its argument, so the initial test is not
> necessary.
> 
> Suggested by Uwe Kleine-König.
> 
> The semantic patch that fixes this problem is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> expression e;
> @@
> 
> -if (e)
>    of_node_put(e);
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

> 
> ---
>  arch/powerpc/platforms/pseries/iommu.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
> index 33b552f..2ea6831 100644
> --- a/arch/powerpc/platforms/pseries/iommu.c
> +++ b/arch/powerpc/platforms/pseries/iommu.c
> @@ -575,8 +575,7 @@ static void pci_dma_bus_setup_pSeries(struct pci_bus *bus)
>  	while (isa_dn && isa_dn != dn)
>  		isa_dn = isa_dn->parent;
>  
> -	if (isa_dn_orig)
> -		of_node_put(isa_dn_orig);
> +	of_node_put(isa_dn_orig);
>  
>  	/* Count number of direct PCI children of the PHB. */
>  	for (children = 0, tmp = dn->child; tmp; tmp = tmp->sibling)
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply

* Re: [PATCH v3] powerpc/kvm: support to handle sw breakpoint
From: Madhavan Srinivasan @ 2014-08-11  3:59 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: kvm, agraf, kvm-ppc, paulus, linuxppc-dev
In-Reply-To: <20140803155108.GA19710@gate.crashing.org>

On Sunday 03 August 2014 09:21 PM, Segher Boessenkool wrote:
>> +/*
>> + * KVMPPC_INST_BOOK3S_DEBUG is debug Instruction for supporting Software Breakpoint.
>> + * Based on PowerISA v2.07, Instruction with opcode 0s will be treated as illegal
>> + * instruction.
>> + */
> 
> "primary opcode 0" instead?
> 
ok sure.

>> +#define OP_ZERO                 0x0
> 
> Using 0x0 where you mean 0, making a #define for 0 in the first place...
> This all looks rather silly doesn't it.
> 

I wanted to avoid zero mentioned in the case statement, but can add a
comment explaining it.

>> +	case OP_ZERO:
>> +		if((inst & 0x00FFFF00) == KVMPPC_INST_BOOK3S_DEBUG) {
> 
> You either shouldn't mask at all here, or the mask is wrong (the primary
> op is the top six bits, not the top eight).
>
Yes. I guess I dont need to check here. Will resend the patch.

Thanks for review
Regards
Maddy

> 
> Segher
> 

^ permalink raw reply

* Re: [tip:timers/core] timekeeping: Fixup typo in update_vsyscall_old definition
From: Benjamin Herrenschmidt @ 2014-08-11  4:19 UTC (permalink / raw)
  To: john.stultz; +Cc: sfr, peterz, linux-kernel, linuxppc-dev, hpa, tglx, mingo
In-Reply-To: <tip-953dec21aed4038464fec02f96a2f1b8701a5bce@git.kernel.org>

On Wed, 2014-07-30 at 00:31 -0700, tip-bot for John Stultz wrote:
> Commit-ID:  953dec21aed4038464fec02f96a2f1b8701a5bce
> Gitweb:     http://git.kernel.org/tip/953dec21aed4038464fec02f96a2f1b8701a5bce
> Author:     John Stultz <john.stultz@linaro.org>
> AuthorDate: Fri, 25 Jul 2014 21:37:19 -0700
> Committer:  Thomas Gleixner <tglx@linutronix.de>
> CommitDate: Wed, 30 Jul 2014 09:26:25 +0200
> 
> timekeeping: Fixup typo in update_vsyscall_old definition
> 
> In commit 4a0e637738f0 ("clocksource: Get rid of cycle_last"),
> currently in the -tip tree, there was a small typo where cycles_t
> was used intstead of cycle_t. This broke ppc64 builds.

There's another bug in there... You fix timespec vs. timespec64 for the
first argument of update_vsyscall_old but not the second one ...
(wall_to_monotonic).

Also, in e2dff1ec0 you claim this is "minor", you seem to forget that
arch/powerpc also deals with 32-bit kernels which use the same time
keeping code, so we have a pretty serious regressions here...

BTW. Is there some documentation you can point me to to figure out what
replace that "_OLD" stuff so we can update to whatever is "new" ?

Cheers,
Ben.

^ permalink raw reply

* [PATCH] powerpc/boot: Use correct zlib types for comparison
From: Benjamin Herrenschmidt @ 2014-08-11  4:37 UTC (permalink / raw)
  To: linuxppc-dev

Avoids this warning:

arch/powerpc/boot/gunzip_util.c:118:9: warning: comparison of distinct pointer types lacks a cast

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 arch/powerpc/boot/gunzip_util.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/boot/gunzip_util.c b/arch/powerpc/boot/gunzip_util.c
index ef2aed0..9dc5250 100644
--- a/arch/powerpc/boot/gunzip_util.c
+++ b/arch/powerpc/boot/gunzip_util.c
@@ -112,10 +112,10 @@ int gunzip_partial(struct gunzip_state *state, void *dst, int dstlen)
 		r = zlib_inflate(&state->s, Z_FULL_FLUSH);
 		if (r != Z_OK && r != Z_STREAM_END)
 			fatal("inflate returned %d msg: %s\n\r", r, state->s.msg);
-		len = state->s.next_out - (unsigned char *)dst;
+		len = state->s.next_out - (Byte *)dst;
 	} else {
 		/* uncompressed image */
-		len = min(state->s.avail_in, (unsigned)dstlen);
+		len = min(state->s.avail_in, (uLong)dstlen);
 		memcpy(dst, state->s.next_in, len);
 		state->s.next_in += len;
 		state->s.avail_in -= len;

^ permalink raw reply related

* Re: [PATCH] net: ucc_geth: fix build failure
From: David Miller @ 2014-08-11  4:40 UTC (permalink / raw)
  To: u.kleine-koenig; +Cc: netdev, linuxppc-dev, f.fainelli, kernel
In-Reply-To: <1407695525-32227-1-git-send-email-u.kleine-koenig@pengutronix.de>

From: Uwe Kleine-K=F6nig <u.kleine-koenig@pengutronix.de>
Date: Sun, 10 Aug 2014 20:32:05 +0200

> My series to fix the reference counting of dt nodes introduced a buil=
d
> failure. Fix it.
> =

> Fixes: fa310789a488 ("net: ucc_geth: drop acquired references in prob=
e error path and remove")
> Signed-off-by: Uwe Kleine-K=F6nig <u.kleine-koenig@pengutronix.de>

Applied, thanks.

^ permalink raw reply

* Re: [PATCH] net: ugg_geth: Fix build error in -next
From: Uwe Kleine-König @ 2014-08-11  5:35 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: netdev, linuxppc-dev, David S. Miller, linux-kernel
In-Reply-To: <53E7BD21.6010301@roeck-us.net>

Hello Guenter,

On Sun, Aug 10, 2014 at 11:42:41AM -0700, Guenter Roeck wrote:
> On 08/10/2014 11:36 AM, Uwe Kleine-König wrote:
> >On Sun, Aug 10, 2014 at 09:19:14AM -0700, Guenter Roeck wrote:
> >>powerpc:mpc83xx_defconfig and other builds fail with
> >>
> >>drivers/net/ethernet/freescale/ucc_geth.c: In function 'ucc_geth_remove':
> >>drivers/net/ethernet/freescale/ucc_geth.c:3927:19: error:
> >>	'struct ucc_geth_private' has no member named 'info'
> >>   of_node_put(ugeth->info->tbi_node);
> >>                      ^
> >>drivers/net/ethernet/freescale/ucc_geth.c:3928:19: error:
> >>	     'struct ucc_geth_private' has no member named 'info'
> >>   of_node_put(ugeth->info->phy_node);
> >>   		     ^
> >>
> >>Introduced by commit "net: ucc_geth: drop acquired references in probe error
> >>path and remove".
> >>
> >> From the context, it appears that the variable is named ug_info.
> >>
> >>Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> >>Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> >>---
> >>Only seen in -next.
> >My patch was only sent just now, but it has the subject right:
> >
> Excellent.
> 
> >	http://mid.gmane.org/1407695525-32227-1-git-send-email-u.kleine-koenig@pengutronix.de
> >
> The link doesn't seem to work for some reason.
It didn't work for me when I sent the mail either. I thought gmane will
have indexed the mail in a few minutes though. Gmane is broken somehow,
when I follow the Subject link of
http://article.gmane.org/gmane.linux.network/326013 I also get a No such
article page?! :-(

http://patchwork.ozlabs.org/patch/378854/ is a link that works for me.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox