Re: [PATCH] ibmveth: Fix more little endian issues

2013-12-23 Thread Alexander Graf
On 23.12.2013, at 07:38, Anton Blanchard wrote: > > Hi Alex, > >> The ibmveth driver is memcpy()'ing the mac address between a variable >> (register) and memory. This assumes a certain endianness of the >> system, so let's make that implicit assumption work again. > > Nice catch! I don't like

[PATCH 1/3] powerpc/xmon: Don't loop forever in get_output_lock()

2013-12-23 Thread Michael Ellerman
From: Michael Ellerman If we enter with xmon_speaker != 0 we skip the first cmpxchg(), we also skip the while loop because xmon_speaker != last_speaker (0) - meaning we skip the second cmpxchg() also. Following that code path the compiler sees no memory barriers and so is within its rights to ne

[PATCH 2/3] powerpc/xmon: Fix timeout loop in get_output_lock()

2013-12-23 Thread Michael Ellerman
As far as I can tell, our 70s era timeout loop in get_output_lock() is generating no code. This leads to the hostile takeover happening more or less simultaneously on all cpus. The result is "interesting", some example output that is more readable than most: cpu 0x1: Vector: 100 (Scypsut e0mx

[PATCH 3/3] powerpc/xmon: Don't signal we've entered until we're finished printing

2013-12-23 Thread Michael Ellerman
Currently we set our cpu's bit in cpus_in_xmon, and then we take the output lock and print the exception information. This can race with the master cpu entering the command loop and printing the backtrace. The result is that the backtrace gets garbled with another cpu's exception print out. Fix i

Re: [PATCH] ibmveth: Fix more little endian issues

2013-12-23 Thread Joe Perches
On Mon, 2013-12-23 at 17:38 +1100, Anton Blanchard wrote: > The hypervisor expects MAC addresses passed in registers to be big > endian u64. So maybe use __be64 declarations? > +static unsigned long ibmveth_encode_mac_addr(char *mac) static __be64 ibmveth_encode_mac_addr(const char *mac) ? etc

Re: [PATCH] powerpc: Make 64-bit non-VMX __copy_tofrom_user bi-endian

2013-12-23 Thread Anton Blanchard
Hi Michael, > > To try and catch any screw ups in our ppc64 memcpy and > > copy_tofrom_user loops, I wrote a quick test: > > > > http://ozlabs.org/~anton/junkcode/validate_kernel_copyloops.tar.gz > > Nice! How's this look? Love it! At the moment my other copy_to/from_user tests run against the

[PATCH] ibmveth: Fix more little endian issues

2013-12-23 Thread Anton Blanchard
The hypervisor expects MAC addresses passed in registers to be big endian u64. Create a helper function called ibmveth_encode_mac_addr which does the right thing in both big and little endian. We were storing the MAC address in a long in struct ibmveth_adapter. It's never used so remove it - we d

Re: [PATCH V4 08/10] powerpc, perf: Enable SW filtering in branch stack sampling framework

2013-12-23 Thread Michael Ellerman
On Fri, 2013-12-20 at 16:31 +0530, Anshuman Khandual wrote: > On 12/09/2013 11:51 AM, Michael Ellerman wrote: > > On Wed, 2013-04-12 at 10:32:40 UTC, Anshuman Khandual wrote: > >> + > >> + if (bhrb_sw_filter & PERF_SAMPLE_BRANCH_IND_CALL) { > >> + /* XL-form instruction */ > >> +

Re: [PATCH] powerpc: Make 64-bit non-VMX __copy_tofrom_user bi-endian

2013-12-23 Thread Michael Ellerman
On Tue, 2013-12-24 at 12:02 +1100, Anton Blanchard wrote: > Hi Michael, > > > > To try and catch any screw ups in our ppc64 memcpy and > > > copy_tofrom_user loops, I wrote a quick test: > > > > > > http://ozlabs.org/~anton/junkcode/validate_kernel_copyloops.tar.gz > > > > Nice! How's this look?

Re: [PATCH V4 08/10] powerpc, perf: Enable SW filtering in branch stack sampling framework

2013-12-23 Thread Anshuman Khandual
On 12/24/2013 08:59 AM, Michael Ellerman wrote: > On Fri, 2013-12-20 at 16:31 +0530, Anshuman Khandual wrote: >> On 12/09/2013 11:51 AM, Michael Ellerman wrote: >>> On Wed, 2013-04-12 at 10:32:40 UTC, Anshuman Khandual wrote: + + if (bhrb_sw_filter & PERF_SAMPLE_BRANCH_IND_CALL) { +

Re: [PATCH V4 08/10] powerpc, perf: Enable SW filtering in branch stack sampling framework

2013-12-23 Thread Michael Ellerman
On Tue, 2013-12-24 at 09:20 +0530, Anshuman Khandual wrote: > On 12/24/2013 08:59 AM, Michael Ellerman wrote: > > On Fri, 2013-12-20 at 16:31 +0530, Anshuman Khandual wrote: > >> On 12/09/2013 11:51 AM, Michael Ellerman wrote: > >>> On Wed, 2013-04-12 at 10:32:40 UTC, Anshuman Khandual wrote: > >>>

Re: [PATCH] ibmveth: Fix more little endian issues

2013-12-23 Thread Benjamin Herrenschmidt
On Mon, 2013-12-23 at 06:52 -0800, Joe Perches wrote: > On Mon, 2013-12-23 at 17:38 +1100, Anton Blanchard wrote: > > The hypervisor expects MAC addresses passed in registers to be big > > endian u64. > > So maybe use __be64 declarations? > > > +static unsigned long ibmveth_encode_mac_addr(char *

Re: [PATCH] iommu: Add empty stub for iommu_group_get_by_id()

2013-12-23 Thread Alexey Kardashevskiy
On 11/21/2013 05:41 PM, Alexey Kardashevskiy wrote: > Almost every function in include/linux/iommu.h has an empty stub > but the iommu_group_get_by_id() did not get one by mistake. > > This adds an empty stub for iommu_group_get_by_id() for IOMMU_API > disabled config. Ping? > Signed-off-by: Al

[PATCH v4 01/10] powerpc/fsl_booke: protect the access to MAS7

2013-12-23 Thread Kevin Hao
The e500v1 doesn't implement the MAS7, so we should avoid to access this register on that implementations. In the current kernel, the access to MAS7 are protected by either CONFIG_PHYS_64BIT or MMU_FTR_BIG_PHYS. Since some code are executed before the code patching, we have to use CONFIG_PHYS_64BIT

[PATCH v4 00/10] powerpc: enable the relocatable support for fsl booke 32bit kernel

2013-12-23 Thread Kevin Hao
v4: - Fix the bug when booting above 64M. - Rebase onto v3.13-rc5 - Pass the following test on a p5020ds board: boot kernel at 0x500 and 0x900 kdump test with kernel option "crashkernel=64M@80M" v3: The main changes include: * Drop the patch 5 in v2 (memblock: introdu

[PATCH v4 02/10] powerpc/fsl_booke: introduce get_phys_addr function

2013-12-23 Thread Kevin Hao
Move the codes which translate a effective address to physical address to a separate function. So it can be reused by other code. Signed-off-by: Kevin Hao --- v4: No change. v3: Use ifdef CONFIG_PHYS_64BIT to protect the access to MAS7 v2: A new patch in v2. arch/powerpc/kernel/head_fsl_booke

[PATCH v4 03/10] powerpc: introduce macro LOAD_REG_ADDR_PIC

2013-12-23 Thread Kevin Hao
This is used to get the address of a variable when the kernel is not running at the linked or relocated address. Signed-off-by: Kevin Hao --- v4: A new patch in v4. arch/powerpc/include/asm/ppc_asm.h | 13 + 1 file changed, 13 insertions(+) diff --git a/arch/powerpc/include/asm/ppc

[PATCH v4 05/10] powerpc/fsl_booke: set the tlb entry for the kernel address in AS1

2013-12-23 Thread Kevin Hao
We use the tlb1 entries to map low mem to the kernel space. In the current code, it assumes that the first tlb entry would cover the kernel image. But this is not true for some special cases, such as when we run a relocatable kernel above the 64M or set CONFIG_KERNEL_START above 64M. So we choose t

[PATCH v4 04/10] powerpc: enable the relocatable support for the fsl booke 32bit kernel

2013-12-23 Thread Kevin Hao
This is based on the codes in the head_44x.S. The difference is that the init tlb size we used is 64M. With this patch we can only load the kernel at address between memstart_addr ~ memstart_addr + 64M. We will fix this restriction in the following patches. Signed-off-by: Kevin Hao --- v4: Use ma

[PATCH v4 06/10] powerpc: introduce early_get_first_memblock_info

2013-12-23 Thread Kevin Hao
For a relocatable kernel since it can be loaded at any place, there is no any relation between the kernel start addr and the memstart_addr. So we can't calculate the memstart_addr from kernel start addr. And also we can't wait to do the relocation after we get the real memstart_addr from device tre

[PATCH v4 07/10] powerpc/fsl_booke: introduce map_mem_in_cams_addr

2013-12-23 Thread Kevin Hao
Introduce this function so we can set both the physical and virtual address for the map in cams. This will be used by the relocation code. Signed-off-by: Kevin Hao --- v4: A new patch in v4. arch/powerpc/mm/fsl_booke_mmu.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) di

[PATCH v4 09/10] powerpc/fsl_booke: smp support for booting a relocatable kernel above 64M

2013-12-23 Thread Kevin Hao
When booting above the 64M for a secondary cpu, we also face the same issue as the boot cpu that the PAGE_OFFSET map two different physical address for the init tlb and the final map. So we have to use switch_to_as1/restore_to_as0 between the conversion of these two maps. When restoring to as0 for

[PATCH v4 08/10] powerpc/fsl_booke: make sure PAGE_OFFSET map to memstart_addr for relocatable kernel

2013-12-23 Thread Kevin Hao
This is always true for a non-relocatable kernel. Otherwise the kernel would get stuck. But for a relocatable kernel, it seems a little complicated. When booting a relocatable kernel, we just align the kernel start addr to 64M and map the PAGE_OFFSET from there. The relocation will base on this vir

[PATCH v4 10/10] powerpc/fsl_booke: enable the relocatable for the kdump kernel

2013-12-23 Thread Kevin Hao
The RELOCATABLE is more flexible and without any alignment restriction. And it is a superset of DYNAMIC_MEMSTART. So use it by default for a kdump kernel. Signed-off-by: Kevin Hao --- v4: No change. v3: No change. v2: A new patch in v2. arch/powerpc/Kconfig | 3 +-- 1 file changed, 1 insertio