Re: [PATCH v4] powerpc/pseries: use pci_host_bridge.release_fn() to kfree(phb)

2016-08-11 Thread Gavin Shan
On Thu, Aug 11, 2016 at 05:25:40PM -0300, Mauricio Faria de Oliveira wrote: >This patch leverages 'struct pci_host_bridge' from the PCI subsystem >in order to free the pci_controller only after the last reference to >its devices is dropped (avoiding an oops in pcibios_release_device() >if the last

Re: [PATCH] powerpc: populate the default bus with machine_arch_initcall

2016-08-11 Thread Kevin Hao
On Fri, Aug 12, 2016 at 02:39:32PM +1000, Michael Ellerman wrote: > Kevin Hao writes: > > > With the commit 44a7185c2ae6 ("of/platform: Add common method to > > populate default bus"), a default function is introduced to populate > > the default bus and this function is

Re: [PATCH kernel 14/15] vfio/spapr_tce: Export container API for external users

2016-08-11 Thread David Gibson
On Wed, Aug 03, 2016 at 06:40:55PM +1000, Alexey Kardashevskiy wrote: > This exports helpers which are needed to keep a VFIO container in > memory while there are external users such as KVM. > > Signed-off-by: Alexey Kardashevskiy I'll address Alex W's broader concerns in a

Re: [PATCH kernel 14/15] vfio/spapr_tce: Export container API for external users

2016-08-11 Thread David Gibson
On Wed, Aug 10, 2016 at 10:46:30AM -0600, Alex Williamson wrote: > On Wed, 10 Aug 2016 15:37:17 +1000 > Alexey Kardashevskiy wrote: > > > On 09/08/16 22:16, Alex Williamson wrote: > > > On Tue, 9 Aug 2016 15:19:39 +1000 > > > Alexey Kardashevskiy wrote: > > >

[PATCH v4 4/5] PCI: Add a new option for resource_alignment to reassign alignment

2016-08-11 Thread Yongji Xie
When using resource_alignment kernel parameter, the current implement reassigns the alignment by changing resources' size which can potentially break some drivers. For example, the driver uses the size to locate some register whose length is related to the size. This patch adds a new option

[PATCH v4 5/5] PCI: Add a macro to set default alignment for all PCI devices

2016-08-11 Thread Yongji Xie
When vfio passthroughs a PCI device of which MMIO BARs are smaller than PAGE_SIZE, guest will not handle the mmio accesses to the BARs which leads to mmio emulations in host. This is because vfio will not allow to passthrough one BAR's mmio page which may be shared with other BARs. Otherwise,

[PATCH v4 3/5] PCI: Do not disable memory decoding in pci_reassigndev_resource_alignment()

2016-08-11 Thread Yongji Xie
We should not disable memory decoding when we reassign alignment in pci_reassigndev_resource_alignment(). It's meaningless and have some side effects. For example, we found it would break this kind of P2P bridge: 0001:02:02.0 PCI bridge: PLX Technology, Inc. PEX 8718 16-Lane, 5-Port PCI Express

[PATCH v4 2/5] PCI: Ignore enforced alignment to VF BARs

2016-08-11 Thread Yongji Xie
VF BARs are read-only zeroes according to SRIOV spec, the normal way(writing BARs) of allocating resources wouldn't be applied to VFs. The VFs' resources would be allocated when we enable SR-IOV capability. So we should not try to reassign alignment after we enable VFs. It's meaningless and will

[PATCH v4 0/5] PCI: Introduce a way to enforce all MMIO BARs not to share PAGE_SIZE

2016-08-11 Thread Yongji Xie
This series introduces a way for PCI resource allocator to force MMIO BARs not to share PAGE_SIZE. This would make sense to VFIO driver. Because current VFIO implementation disallows to mmap sub-page(size < PAGE_SIZE) MMIO BARs which may share the same page with other BARs for security reasons.

[PATCH v4 1/5] PCI: Ignore enforced alignment when kernel uses existing firmware setup

2016-08-11 Thread Yongji Xie
PCI resources allocator will use firmware setup and not try to reassign resource when PCI_PROBE_ONLY or IORESOURCE_PCI_FIXED is set. The enforced alignment in pci_reassigndev_resource_alignment() should be ignored in this case. Otherwise, some PCI devices' resources would be released here and not

[PATCH 1/1] pci: host: pci-layerscape: add missing of_node_put after calling of_parse_phandle

2016-08-11 Thread Peter Chen
of_node_put needs to be called when the device node which is got from of_parse_phandle has finished using. Cc: Minghuan Lian Cc: Mingkai Hu Cc: Roy Zang Signed-off-by: Peter Chen ---

Re: [PATCH kernel 05/15] powerpc/iommu: Stop using @current in mm_iommu_xxx

2016-08-11 Thread Alexey Kardashevskiy
On 12/08/16 12:57, David Gibson wrote: > On Wed, Aug 03, 2016 at 06:40:46PM +1000, Alexey Kardashevskiy wrote: >> In some situations the userspace memory context may live longer than >> the userspace process itself so if we need to do proper memory context >> cleanup, we better cache @mm and use

Re: [PATCH kernel 13/15] KVM: PPC: Pass kvm* to kvmppc_find_table()

2016-08-11 Thread David Gibson
On Wed, Aug 03, 2016 at 06:40:54PM +1000, Alexey Kardashevskiy wrote: > The guest view TCE tables are per KVM anyway (not per VCPU) so pass kvm* > there. This will be used in the following patches where we will be > attaching VFIO containers to LIOBNs via ioctl() to KVM (rather than > to VCPU). >

Re: [PATCH kernel 11/15] powerpc/powernv/iommu: Add real mode version of iommu_table_ops::exchange()

2016-08-11 Thread David Gibson
On Wed, Aug 03, 2016 at 06:40:52PM +1000, Alexey Kardashevskiy wrote: > In real mode, TCE tables are invalidated using special > cache-inhibited store instructions which are not available in > virtual mode > > This defines and implements exchange_rm() callback. This does not > define

Re: [PATCH kernel 12/15] KVM: PPC: Enable IOMMU_API for KVM_BOOK3S_64 permanently

2016-08-11 Thread David Gibson
On Wed, Aug 03, 2016 at 06:40:53PM +1000, Alexey Kardashevskiy wrote: > It does not make much sense to have KVM in book3s-64 and > not to have IOMMU bits for PCI pass through support as it costs little > and allows VFIO to function on book3s KVM. > > Having IOMMU_API always enabled makes it

Re: [PATCH kernel 09/15] powerpc/mmu: Add real mode support for IOMMU preregistered memory

2016-08-11 Thread David Gibson
On Wed, Aug 03, 2016 at 06:40:50PM +1000, Alexey Kardashevskiy wrote: > This makes mm_iommu_lookup() able to work in realmode by replacing > list_for_each_entry_rcu() (which can do debug stuff which can fail in > real mode) with list_for_each_entry_lockless(). > > This adds realmode version of

Re: [PATCH kernel 10/15] KVM: PPC: Use preregistered memory API to access TCE list

2016-08-11 Thread David Gibson
On Wed, Aug 03, 2016 at 06:40:51PM +1000, Alexey Kardashevskiy wrote: > VFIO on sPAPR already implements guest memory pre-registration > when the entire guest RAM gets pinned. This can be used to translate > the physical address of a guest page containing the TCE list > from H_PUT_TCE_INDIRECT. >

Re: [PATCH] powerpc: populate the default bus with machine_arch_initcall

2016-08-11 Thread Michael Ellerman
Kevin Hao writes: > With the commit 44a7185c2ae6 ("of/platform: Add common method to > populate default bus"), a default function is introduced to populate > the default bus and this function is invoked at the arch_initcall_sync > level. This will override the arch specific

Re: [PATCH kernel 08/15] powerpc/vfio_spapr_tce: Add reference counting to iommu_table

2016-08-11 Thread David Gibson
On Wed, Aug 03, 2016 at 06:40:49PM +1000, Alexey Kardashevskiy wrote: > So far iommu_table obejcts were only used in virtual mode and had > a single owner. We are going to change by implementing in-kernel > acceleration of DMA mapping requests, including real mode. > > This adds a kref to

Re: [PATCH kernel 06/15] powerpc/mm/iommu: Put pages on process exit

2016-08-11 Thread David Gibson
On Wed, Aug 03, 2016 at 06:40:47PM +1000, Alexey Kardashevskiy wrote: > At the moment VFIO IOMMU SPAPR v2 driver pins all guest RAM pages when > the userspace starts using VFIO. This doesn't sound accurate. Isn't it userspace that decides what gets pinned, not the VFIO driver? >When the

Re: [PATCH kernel 07/15] powerpc/iommu: Cleanup iommu_table disposal

2016-08-11 Thread David Gibson
On Wed, Aug 03, 2016 at 06:40:48PM +1000, Alexey Kardashevskiy wrote: > At the moment iommu_table could be disposed by either calling > iommu_table_free() directly or it_ops::free() which only implementation > for IODA2 calls iommu_table_free() anyway. > > As we are going to have reference

Re: [PATCH kernel 05/15] powerpc/iommu: Stop using @current in mm_iommu_xxx

2016-08-11 Thread David Gibson
On Wed, Aug 03, 2016 at 06:40:46PM +1000, Alexey Kardashevskiy wrote: > In some situations the userspace memory context may live longer than > the userspace process itself so if we need to do proper memory context > cleanup, we better cache @mm and use it later when the process is gone > (@current

Re: [PATCH 0/2] ibmvfc: FC-TAPE Support

2016-08-11 Thread Martin K. Petersen
> "Tyrel" == Tyrel Datwyler writes: Tyrel> On 08/03/2016 02:36 PM, Tyrel Datwyler wrote: >> This patchset introduces optional FC-TAPE/FC Class 3 Error Recovery >> to the ibmvfc client driver. >> >> Tyrel Datwyler (2): ibmvfc: Set READ FCP_XFER_READY DISABLED bit

Re: [PATCH v2 02/20] powerpc: Always restore FPU/VEC/VSX if hardware transactional memory in use

2016-08-11 Thread kbuild test robot
Hi Cyril, [auto build test ERROR on powerpc/next] [also build test ERROR on v4.8-rc1 next-20160811] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Cyril-Bur/Consistent-TM-structures/20160812

Re: [PATCH] powerpc: populate the default bus with machine_arch_initcall

2016-08-11 Thread Kevin Hao
On Thu, Aug 11, 2016 at 08:17:52AM -0500, Rob Herring wrote: > On Thu, Aug 11, 2016 at 6:09 AM, Kevin Hao wrote: > > With the commit 44a7185c2ae6 ("of/platform: Add common method to > > populate default bus"), a default function is introduced to populate > > the default bus

Re: [PATCH] mm: Initialize per_cpu_nodestats for hotadded pgdats

2016-08-11 Thread Balbir Singh
On 12/08/16 02:04, Reza Arbab wrote: > The following oops occurs after a pgdat is hotadded: > > [ 86.839956] Unable to handle kernel paging request for data at address > 0x00c30001 > [ 86.840132] Faulting instruction address: 0xc022f8f4 > [ 86.840328] Oops: Kernel access of bad

Re: [PATCH 3/4] powerpc/mm: allow memory hotplug into a memoryless node

2016-08-11 Thread Balbir Singh
On 09/08/16 04:27, Reza Arbab wrote: > Remove the check which prevents us from hotplugging into an empty node. > > Signed-off-by: Reza Arbab > --- > arch/powerpc/mm/numa.c | 13 + > 1 file changed, 1 insertion(+), 12 deletions(-) > > diff --git

Re: [PATCH 2/4] powerpc/mm: create numa nodes for hotplug memory

2016-08-11 Thread Balbir Singh
On 09/08/16 04:27, Reza Arbab wrote: > When scanning the device tree to initialize the system NUMA topology, > process dt elements with compatible id "ibm,hotplug-aperture" to create > memoryless numa nodes. > > These nodes will be filled when hotplug occurs within the associated > address

Re: [PATCH v5 11/13] powerpc: Allow userspace to set device tree properties in kexec_file_load

2016-08-11 Thread Thiago Jung Bauermann
Hello Sam, Thanks for the quick response. Am Freitag, 12 August 2016, 10:45:00 schrieb Samuel Mendoza-Jonas: > On Thu, 2016-08-11 at 20:08 -0300, Thiago Jung Bauermann wrote: > > @@ -908,4 +909,245 @@ bool find_debug_console(const void *fdt, int > > chosen_node) return false; > > } > > > >

Re: [PATCH v5 11/13] powerpc: Allow userspace to set device tree properties in kexec_file_load

2016-08-11 Thread Samuel Mendoza-Jonas
On Thu, 2016-08-11 at 20:08 -0300, Thiago Jung Bauermann wrote: > Implement the arch_kexec_verify_buffer hook to verify that a device > tree blob passed by userspace via kexec_file_load contains only nodes > and properties from a whitelist. > > In elf64_load we merge those properties into the

Re: [PATCH] soc: fsl/qe: fix Oops on CPM1 (and likely CPM2)

2016-08-11 Thread Scott Wood
On Mon, 2016-08-08 at 18:08 +0200, Christophe Leroy wrote: > Commit 0e6e01ff694ee ("CPM/QE: use genalloc to manage CPM/QE muram") > has changed the way muram is managed. > genalloc uses kmalloc(), hence requires the SLAB to be up and running. > > On powerpc 8xx, cpm_reset() is called early during

[PATCH v2 06/20] selftests/powerpc: Check for VSX preservation across userspace preemption

2016-08-11 Thread Cyril Bur
Ensure the kernel correctly switches VSX registers correctly. VSX registers are all volatile, and despite the kernel preserving VSX across syscalls, it doesn't have to. Test that during interrupts and timeslices ending the VSX regs remain the same. Signed-off-by: Cyril Bur

[PATCH v2 01/20] selftests/powerpc: Compile selftests against headers without AT_HWCAP2

2016-08-11 Thread Cyril Bur
It might be nice to compile selftests against older kernels and headers but which may not have HWCAP2. Signed-off-by: Cyril Bur --- tools/testing/selftests/powerpc/utils.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/tools/testing/selftests/powerpc/utils.h

[PATCH v2 19/20] powerpc: tm: Rename transct_(*) to ck(\1)_state

2016-08-11 Thread Cyril Bur
Make the structures being used for checkpointed state named consistently with the pt_regs/ckpt_regs. Signed-off-by: Cyril Bur --- arch/powerpc/include/asm/processor.h | 8 ++--- arch/powerpc/kernel/asm-offsets.c| 12 arch/powerpc/kernel/fpu.S| 2 +-

[PATCH v2 20/20] powerpc: Remove do_load_up_transact_{fpu,altivec}

2016-08-11 Thread Cyril Bur
Previous rework of TM code leaves these functions unused Signed-off-by: Cyril Bur --- arch/powerpc/include/asm/tm.h | 5 - arch/powerpc/kernel/fpu.S | 26 -- arch/powerpc/kernel/vector.S | 25 - 3 files changed, 56

[PATCH v2 18/20] powerpc: tm: Always use fp_state and vr_state to store live registers

2016-08-11 Thread Cyril Bur
There is currently an inconsistency as to how the entire CPU register state is saved and restored when a thread uses transactional memory (TM). Using transactional memory results in the CPU having duplicated (almost all) of its register state. This duplication results in a set of registers which

[PATCH v2 17/20] selftests/powerpc: Add checks for transactional VSXs in signal contexts

2016-08-11 Thread Cyril Bur
If a thread receives a signal while transactional the kernel creates a second context to show the transactional state of the process. This test loads some known values and waits for a signal and confirms that the expected values are in the signal context. Signed-off-by: Cyril Bur

[PATCH v2 16/20] selftests/powerpc: Add checks for transactional VMXs in signal contexts

2016-08-11 Thread Cyril Bur
If a thread receives a signal while transactional the kernel creates a second context to show the transactional state of the process. This test loads some known values and waits for a signal and confirms that the expected values are in the signal context. Signed-off-by: Cyril Bur

[PATCH v2 15/20] selftests/powerpc: Add checks for transactional FPUs in signal contexts

2016-08-11 Thread Cyril Bur
If a thread receives a signal while transactional the kernel creates a second context to show the transactional state of the process. This test loads some known values and waits for a signal and confirms that the expected values are in the signal context. Signed-off-by: Cyril Bur

[PATCH v2 14/20] selftests/powerpc: Add checks for transactional GPRs in signal contexts

2016-08-11 Thread Cyril Bur
If a thread receives a signal while transactional the kernel creates a second context to show the transactional state of the process. This test loads some known values and waits for a signal and confirms that the expected values are in the signal context. Signed-off-by: Cyril Bur

[PATCH v2 13/20] selftests/powerpc: Check that signals always get delivered

2016-08-11 Thread Cyril Bur
Signed-off-by: Cyril Bur --- tools/testing/selftests/powerpc/Makefile | 1 + tools/testing/selftests/powerpc/signal/Makefile| 12 +++ tools/testing/selftests/powerpc/signal/signal.S| 50 ++ tools/testing/selftests/powerpc/signal/signal.c| 111

[PATCH v2 12/20] selftests/powerpc: Add TM tcheck helpers in C

2016-08-11 Thread Cyril Bur
Signed-off-by: Cyril Bur --- tools/testing/selftests/powerpc/tm/tm.h | 27 +++ 1 file changed, 27 insertions(+) diff --git a/tools/testing/selftests/powerpc/tm/tm.h b/tools/testing/selftests/powerpc/tm/tm.h index 60318ba..2c8da74 100644 ---

[PATCH v2 09/20] selftests/powerpc: Introduce GPR asm helper header file

2016-08-11 Thread Cyril Bur
Signed-off-by: Cyril Bur --- tools/testing/selftests/powerpc/gpr_asm.h | 96 +++ 1 file changed, 96 insertions(+) create mode 100644 tools/testing/selftests/powerpc/gpr_asm.h diff --git a/tools/testing/selftests/powerpc/gpr_asm.h

[PATCH v2 10/20] selftests/powerpc: Add transactional memory defines

2016-08-11 Thread Cyril Bur
Signed-off-by: Cyril Bur --- tools/testing/selftests/powerpc/basic_asm.h | 4 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/powerpc/basic_asm.h b/tools/testing/selftests/powerpc/basic_asm.h index 3349a07..5131059 100644 ---

[PATCH v2 11/20] selftests/powerpc: Allow tests to extend their kill timeout

2016-08-11 Thread Cyril Bur
Signed-off-by: Cyril Bur --- tools/testing/selftests/powerpc/harness.c | 9 +++-- tools/testing/selftests/powerpc/utils.h | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/powerpc/harness.c

[PATCH v2 08/20] selftests/powerpc: Move VMX stack frame macros to header file

2016-08-11 Thread Cyril Bur
Signed-off-by: Cyril Bur --- tools/testing/selftests/powerpc/math/vmx_asm.S | 85 +- tools/testing/selftests/powerpc/vmx_asm.h | 98 ++ 2 files changed, 99 insertions(+), 84 deletions(-) create mode 100644

[PATCH v2 04/20] powerpc: Return the new MSR from msr_check_and_set()

2016-08-11 Thread Cyril Bur
mfmsr() is a fairly expensive call and callers of msr_check_and_set() may want to make decisions bits in the MSR that it did not change but may not know the value of. This patch would avoid a two calls to mfmsr(). Signed-off-by: Cyril Bur --- arch/powerpc/include/asm/reg.h

[PATCH v2 07/20] selftests/powerpc: Rework FPU stack placement macros and move to header file

2016-08-11 Thread Cyril Bur
The FPU regs are placed at the top of the stack frame. Currently the position expected to be passed to the macro. The macros now should be passed the stack frame size and from there they can calculate where to put the regs, this makes the use simpler. Also move them to a header file to be used in

[PATCH v2 05/20] powerpc: Never giveup a reclaimed thread when enabling kernel {fp, altivec, vsx}

2016-08-11 Thread Cyril Bur
After a thread is reclaimed from its active or suspended transactional state the checkpointed state exists on CPU, this state (along with the live/transactional state) has been saved in its entirety by the reclaiming process. There exists a sequence of events that would cause the kernel to call

[PATCH v2 03/20] powerpc: Add check_if_tm_restore_required() to giveup_all()

2016-08-11 Thread Cyril Bur
giveup_all() causes FPU/VMX/VSX facilitities to be disabled in a threads MSR. If this thread was transactional this should be recorded as reclaiming/recheckpointing code will need to know. Fixes: c208505 ("powerpc: create giveup_all()") Signed-off-by: Cyril Bur ---

[PATCH v2 02/20] powerpc: Always restore FPU/VEC/VSX if hardware transactional memory in use

2016-08-11 Thread Cyril Bur
Comment from arch/powerpc/kernel/process.c:967: If userspace is inside a transaction (whether active or suspended) and FP/VMX/VSX instructions have ever been enabled inside that transaction, then we have to keep them enabled and keep the FP/VMX/VSX state loaded while ever the transaction

[PATCH v2 00/20] Consistent TM structures

2016-08-11 Thread Cyril Bur
Hello, This series has grown considerably from v1. Similarities with v1 include: - Selftests are all the same, they have simply been split into several patches with comments from MPE and Daniel Axtens incorporated. It is possible some things slipped through the cracks selftest wise as the

[PATCH v5 12/13] powerpc: Add purgatory for kexec_file_load implementation.

2016-08-11 Thread Thiago Jung Bauermann
This purgatory implementation comes from kexec-tools, almost unchanged. The only changes were that the sha256_regions global variable was renamed to sha_regions to match what kexec_file_load expects, and to use the sha256.c file from x86's purgatory to avoid adding yet another SHA-256

[PATCH v5 13/13] powerpc: Enable CONFIG_KEXEC_FILE in powerpc server defconfigs.

2016-08-11 Thread Thiago Jung Bauermann
Enable CONFIG_KEXEC_FILE in powernv_defconfig, ppc64_defconfig and pseries_defconfig. It depends on CONFIG_CRYPTO_SHA256=y, so add that as well. Signed-off-by: Thiago Jung Bauermann --- arch/powerpc/configs/powernv_defconfig | 2 ++

[PATCH v5 11/13] powerpc: Allow userspace to set device tree properties in kexec_file_load

2016-08-11 Thread Thiago Jung Bauermann
Implement the arch_kexec_verify_buffer hook to verify that a device tree blob passed by userspace via kexec_file_load contains only nodes and properties from a whitelist. In elf64_load we merge those properties into the device tree that will be passed to the next kernel. Suggested-by: Michael

[PATCH v5 10/13] powerpc: Add support for loading ELF kernels with kexec_file_load.

2016-08-11 Thread Thiago Jung Bauermann
This uses all the infrastructure built up by the previous patches in the series to load an ELF vmlinux file and an initrd. It uses the flattened device tree at initial_boot_params as a base and adjusts memory reservations and its /chosen node for the next kernel. Signed-off-by: Thiago Jung

[PATCH v5 09/13] powerpc: Add code to work with device trees in kexec_file_load.

2016-08-11 Thread Thiago Jung Bauermann
kexec_file_load needs to set up the device tree that will be used by the next kernel and check whether it provides a console that can be used by the purgatory. Signed-off-by: Thiago Jung Bauermann --- arch/powerpc/include/asm/kexec.h | 3 +

[PATCH v5 07/13] powerpc: Add functions to read ELF files of any endianness.

2016-08-11 Thread Thiago Jung Bauermann
A little endian kernel might need to kexec a big endian kernel (the opposite is less likely but could happen as well), so we can't just cast the buffer with the binary to ELF structs and use them as is done elsewhere. This patch adds functions which do byte-swapping as necessary when populating

[PATCH v5 08/13] powerpc: Implement kexec_file_load.

2016-08-11 Thread Thiago Jung Bauermann
arch_kexec_walk_mem and arch_kexec_apply_relocations_add are used by generic kexec code, while setup_purgatory is powerpc-specific and sets runtime variables needed by the powerpc purgatory implementation. Signed-off-by: Josh Sklar Signed-off-by: Thiago Jung Bauermann

[PATCH v5 06/13] powerpc: Adapt elf64_apply_relocate_add for kexec_file_load.

2016-08-11 Thread Thiago Jung Bauermann
Extend elf64_apply_relocate_add to support relative symbols. This is necessary because there is a difference between how the module loading mechanism and the kexec purgatory loading code use Elf64_Sym.st_value at relocation time: the former changes st_value to point to the absolute memory address

[PATCH v5 05/13] powerpc: Generalize elf64_apply_relocate_add.

2016-08-11 Thread Thiago Jung Bauermann
When apply_relocate_add is called, modules are already loaded at their final location in memory so Elf64_Shdr.sh_addr can be used for accessing the section contents as well as the base address for relocations. This is not the case for kexec's purgatory, because it will only be copied to its final

[PATCH v5 04/13] powerpc: Factor out relocation code from module_64.c to elf_util_64.c.

2016-08-11 Thread Thiago Jung Bauermann
The kexec_file_load system call needs to relocate the purgatory, so factor out the module relocation code so that it can be shared. This patch's purpose is to move the ELF relocation logic from apply_relocate_add to elf_util_64.c with as few changes as possible. The following changes were needed:

[PATCH v5 02/13] kexec_file: Change kexec_add_buffer to take kexec_buf as argument.

2016-08-11 Thread Thiago Jung Bauermann
Adapt all callers to the new function prototype. In addition, change the type of kexec_buf.buffer from char * to void *. There is no particular reason for it to be a char *, and the change allows us to get rid of 3 existing casts to char * in the code. Signed-off-by: Thiago Jung Bauermann

[PATCH v5 03/13] kexec_file: Factor out kexec_locate_mem_hole from kexec_add_buffer.

2016-08-11 Thread Thiago Jung Bauermann
kexec_locate_mem_hole will be used by the PowerPC kexec_file_load implementation to find free memory for the purgatory stack. Signed-off-by: Thiago Jung Bauermann Acked-by: Dave Young --- include/linux/kexec.h | 1 + kernel/kexec_file.c | 25

[PATCH v5 01/13] kexec_file: Allow arch-specific memory walking for kexec_add_buffer

2016-08-11 Thread Thiago Jung Bauermann
Allow architectures to specify a different memory walking function for kexec_add_buffer. x86 uses iomem to track reserved memory ranges, but PowerPC uses the memblock subsystem. Signed-off-by: Thiago Jung Bauermann Acked-by: Dave Young ---

[PATCH v5 00/13] kexec_file_load implementation for PowerPC

2016-08-11 Thread Thiago Jung Bauermann
[ Andrew, since this series touches generic code, x86 and powerpc, Michael Ellerman and Dave Young think it should go via your tree. ] The main differences in this version are (more detailed changelog at the end of this email): - The code which is not specific to loading ELF format kernels

[PATCH v2 2/2] kexec: extend kexec_file_load system call

2016-08-11 Thread Thiago Jung Bauermann
From: AKASHI Takahiro Device tree blob must be passed to a second kernel on DTB-capable archs, like powerpc and arm64, but the current kernel interface lacks this support. This patch extends kexec_file_load system call by adding an extra argument to this syscall so

[PATCH v2 1/2] kexec: add dtb info to struct kimage

2016-08-11 Thread Thiago Jung Bauermann
From: AKASHI Takahiro Device tree blob must be passed to a second kernel on DTB-capable archs, like powerpc and arm64, but the current kernel interface lacks this support. This patch adds dtb buffer information to struct kimage. When users don't specify dtb

[PATCH v2 0/2] extend kexec_file_load system call

2016-08-11 Thread Thiago Jung Bauermann
This patch series is from AKASHI Takahiro. I will use it in my next version of the kexec_file_load implementation for powerpc, so I am rebasing it on top of v4.8-rc1. I dropped the patch which adds __NR_kexec_file_load to for simplicity, since the powerpc patches already add it to powerpc's . I

Re: [PATCH] powerpc/32: Remove one insn in __bswapdi2

2016-08-11 Thread Segher Boessenkool
On Thu, Aug 11, 2016 at 11:34:37PM +0200, Gabriel Paubert wrote: > On the other hand gcc did at the time a very poor job (quite an > understatement) at bswapdi when compiling for 64 bit processors > (see the example). > > But what do modern compilers generate for bswapdi these days? Do they >

Re: [PATCH] powerpc/32: Remove one insn in __bswapdi2

2016-08-11 Thread Gabriel Paubert
On Wed, Aug 10, 2016 at 12:18:15PM +0200, Christophe Leroy wrote: > > > Le 10/08/2016 à 10:56, Gabriel Paubert a écrit : > >On Fri, Aug 05, 2016 at 01:28:02PM +0200, Christophe Leroy wrote: > >>Signed-off-by: Christophe Leroy > >>--- > >> arch/powerpc/kernel/misc_32.S |

Re: [PATCH 0/2] ibmvfc: FC-TAPE Support

2016-08-11 Thread Tyrel Datwyler
On 08/03/2016 02:36 PM, Tyrel Datwyler wrote: > This patchset introduces optional FC-TAPE/FC Class 3 Error Recovery to the > ibmvfc client driver. > > Tyrel Datwyler (2): > ibmvfc: Set READ FCP_XFER_READY DISABLED bit in PRLI > ibmvfc: add FC Class 3 Error Recovery support > >

[PATCH v4] powerpc/pseries: use pci_host_bridge.release_fn() to kfree(phb)

2016-08-11 Thread Mauricio Faria de Oliveira
This patch leverages 'struct pci_host_bridge' from the PCI subsystem in order to free the pci_controller only after the last reference to its devices is dropped (avoiding an oops in pcibios_release_device() if the last reference is dropped after pcibios_free_controller()). The patch relies on

Re: [PATCH v3] powerpc/pseries: use pci_host_bridge.release_fn() to kfree(phb)

2016-08-11 Thread Mauricio Faria de Oliveira
Hi Gavin, tl;dr: thanks for the comments & suggestions; i'll submit v4. On 08/11/2016 03:40 AM, Gavin Shan wrote: [added some line breaks] It seems the user has two options here: (1) Setup bridge's release_fn() and call pcibios_free_controller() explicitly; I think the v3 design was

Re: [PATCH 1/4] dt-bindings: add doc for ibm,hotplug-aperture

2016-08-11 Thread Reza Arbab
On Thu, Aug 11, 2016 at 02:39:23PM +1000, Stewart Smith wrote: Forgive me for being absent on the whole discussion here, but is this an OPAL specific binding? If so, shouldn't the docs also appear in the skiboot tree? Good question. I guess it's not necessarily OPAL-specific, even though

Re: [PATCH v3] powerpc/pseries: use pci_host_bridge.release_fn() to kfree(phb)

2016-08-11 Thread Mauricio Faria de Oliveira
On 08/11/2016 02:01 AM, Andrew Donnellan wrote: In cxl, we currently call: pci_remove_root_bus(phb->bus); pcibios_free_controller(phb); which appears to break with this patch after I wire up pci_set_host_bridge_release() in cxl, as phb can be freed before we call

[PATCH] mm: Initialize per_cpu_nodestats for hotadded pgdats

2016-08-11 Thread Reza Arbab
The following oops occurs after a pgdat is hotadded: [ 86.839956] Unable to handle kernel paging request for data at address 0x00c30001 [ 86.840132] Faulting instruction address: 0xc022f8f4 [ 86.840328] Oops: Kernel access of bad area, sig: 11 [#1] [ 86.840468] SMP NR_CPUS=2048

Re: mm: Initialise per_cpu_nodestats for all online pgdats at boot

2016-08-11 Thread Reza Arbab
On Thu, Aug 11, 2016 at 10:28:08AM +0100, Mel Gorman wrote: Fix looks ok. Can you add a proper changelog to it including an example oops or do you need me to do it? Sure, no problem. Patch to follow. -- Reza Arbab

Re: [TESTING] kbuild: link drivers subdirectories separately

2016-08-11 Thread Arnd Bergmann
On Thursday, August 11, 2016 3:49:03 PM CEST Arnd Bergmann wrote: > @@ -137,7 +134,8 @@ obj-$(CONFIG_PPC_PS3) += ps3/ > obj-$(CONFIG_OF) += of/ > obj-$(CONFIG_SSB) += ssb/ > obj-$(CONFIG_BCMA) += bcma/ > -obj-y +=

[pasemi] Internal CompactFlash (CF) card device not recognised after the powerpc-4.8-1 merge

2016-08-11 Thread Christian Zigotzky
Hi All, I was able to patch the RC1 with the Nemo and PHB-numbering patch. Additionally I added some printks in the file pata_of_platform.c. I wanted to know which values have the following variables: ctl_res = io_res; io_res.start += 0x800; ctl_res.start = ctl_res.start + 0x80e; io_res.end

[TESTING] kbuild: link drivers subdirectories separately

2016-08-11 Thread Arnd Bergmann
On ARM, relative branches between functions can not span more than 32MB, which limits the size of an ELF section. In the final link, the linker will introduce trampolines that perform long calls to avoid the limit, and during a recursive link, trampolines are added within the section. However,

Re: [PATCH] powerpc: populate the default bus with machine_arch_initcall

2016-08-11 Thread Rob Herring
On Thu, Aug 11, 2016 at 6:09 AM, Kevin Hao wrote: > With the commit 44a7185c2ae6 ("of/platform: Add common method to > populate default bus"), a default function is introduced to populate > the default bus and this function is invoked at the arch_initcall_sync > level. This

Re: powerpc allyesconfig / allmodconfig linux-next next-20160729 - next-20160729 build failures

2016-08-11 Thread Nicholas Piggin
On Thu, 11 Aug 2016 15:04:00 +0200 Arnd Bergmann wrote: > On Thursday, August 11, 2016 10:43:20 PM CEST Nicholas Piggin wrote: > > On Wed, 03 Aug 2016 22:13:28 +0200 > > Final ld time > > inclink > > real0m0.378s > > user0m0.304s > > sys 0m0.076s > > > > thinarc

[PATCH v2] powerpc: move hmi.c to arch/powerpc/kvm/

2016-08-11 Thread Paolo Bonzini
hmi.c functions are unused unless sibling_subcore_state is nonzero, and that in turn happens only if KVM is in use. So move the code to arch/powerpc/kvm/, putting it under CONFIG_KVM_BOOK3S_HV_POSSIBLE rather than CONFIG_PPC_BOOK3S_64. The sibling_subcore_state is also included in struct

Re: powerpc allyesconfig / allmodconfig linux-next next-20160729 - next-20160729 build failures

2016-08-11 Thread Arnd Bergmann
On Thursday, August 11, 2016 10:43:20 PM CEST Nicholas Piggin wrote: > On Wed, 03 Aug 2016 22:13:28 +0200 > Arnd Bergmann wrote: > > > On Wednesday, August 3, 2016 2:44:29 PM CEST Segher Boessenkool wrote: > > > Hi Arnd, > > > > > > On Wed, Aug 03, 2016 at 08:52:48PM +0200, Arnd

Re: powerpc allyesconfig / allmodconfig linux-next next-20160729 - next-20160729 build failures

2016-08-11 Thread Nicholas Piggin
On Wed, 03 Aug 2016 22:13:28 +0200 Arnd Bergmann wrote: > On Wednesday, August 3, 2016 2:44:29 PM CEST Segher Boessenkool wrote: > > Hi Arnd, > > > > On Wed, Aug 03, 2016 at 08:52:48PM +0200, Arnd Bergmann wrote: > > > From my first look, it seems that all of lib/*.o is now

Re: [PATCH] perf/core: Fix the mask in perf_output_sample_regs

2016-08-11 Thread Peter Zijlstra
Sorry, found it in my inbox while clearing out backlog.. On Sun, Jul 03, 2016 at 11:31:58PM +0530, Madhavan Srinivasan wrote: > When decoding the perf_regs mask in perf_output_sample_regs(), > we loop through the mask using find_first_bit and find_next_bit functions. > While the exisitng code

Re: [PATCH] powerpc: sysdev: cpm: fix gpio save_regs functions

2016-08-11 Thread Linus Walleij
On Thu, Aug 11, 2016 at 10:50 AM, Christophe Leroy wrote: > of_mm_gpiochip_add_data() calls mm_gc->save_regs() before > setting the data. Therefore ->save_regs() cannot use > gpiochip_get_data() > > [0.275940] Unable to handle kernel paging request for data at

Re: [PATCH 0/7] ima: carry the measurement list across kexec

2016-08-11 Thread Mimi Zohar
On Thu, 2016-08-11 at 17:38 +1000, Balbir Singh wrote: > > On 09/08/16 22:36, Mimi Zohar wrote: > > On Tue, 2016-08-09 at 15:19 +1000, Balbir Singh wrote: > >> > >> On 04/08/16 22:24, Mimi Zohar wrote: > >>> The TPM PCRs are only reset on a hard reboot. In order to validate a > >>> TPM's quote

Re: powerpc/Makefile: Use cflags-y/aflags-y for setting endian options

2016-08-11 Thread Michael Ellerman
On Tue, 2016-09-08 at 12:43:46 UTC, Michael Ellerman wrote: > When we introduced the little endian support, we added the endian flags > to CC directly using override. I don't know the history of why we did > that, I suspect no one does. > > Although this mostly works, it has one bug, which is

Re: selftests/powerpc: Specify we expect to build with std=gnu99

2016-08-11 Thread Michael Ellerman
On Fri, 2016-29-07 at 10:48:09 UTC, Michael Ellerman wrote: > We have some tests that assume we're using std=gnu99, which is fine on > most compilers, but some old compilers use a different default. > > So make it explicit that we want to use std=gnu99. > > Signed-off-by: Michael Ellerman

Re: powerpc: Update obsolete comment in setup_32.c about early_init()

2016-08-11 Thread Michael Ellerman
On Wed, 2016-10-08 at 07:32:38 UTC, Benjamin Herrenschmidt wrote: > We don't identify the machine type anymore... > > Signed-off-by: Benjamin Herrenschmidt Applied to powerpc fixes, thanks. https://git.kernel.org/powerpc/c/f9cc1d1f808dbdfd56978259d2 cheers

Re: powerpc: rebuild vdsos correctly

2016-08-11 Thread Michael Ellerman
On Mon, 2016-08-08 at 09:35:43 UTC, Nicholas Piggin wrote: > When using if_changed, we need to add FORCE to dependencies, otherwise > we don't get command line change checking amongst other things. This > has resulted in vdsos not being rebuilt when switching between big and > little endian. > >

Re: powerpc: Fix crash during static key init on ppc32

2016-08-11 Thread Michael Ellerman
On Wed, 2016-10-08 at 07:27:34 UTC, Benjamin Herrenschmidt wrote: > We cannot do those initializations from apply_feature_fixups() as > this function runs in a very restricted environment in 32-bit where > the kernel isn't running at its linked address and the PTRRELOC() > macro must be used for

Re: powerpc: Print the kernel load address at the end of prom_init

2016-08-11 Thread Michael Ellerman
On Wed, 2016-10-08 at 07:29:29 UTC, Benjamin Herrenschmidt wrote: > This makes it easier to debug crashes that happen very early before > the kernel takes over Open Firmware by allowing us to relate the OF > reported crashing addresses to offsets within the kernel. > > Signed-off-by: Benjamin

[PATCH] powerpc: populate the default bus with machine_arch_initcall

2016-08-11 Thread Kevin Hao
With the commit 44a7185c2ae6 ("of/platform: Add common method to populate default bus"), a default function is introduced to populate the default bus and this function is invoked at the arch_initcall_sync level. This will override the arch specific population of default bus which run at a lower

Re: [PATCH] powerpc: move hmi.c to arch/powerpc/kvm/

2016-08-11 Thread Michael Ellerman
Michael Ellerman writes: > Radim Krčmář writes: > >> 2016-08-03 13:36+0200, Paolo Bonzini: >>> hmi.c functions are unused unless sibling_subcore_state is nonzero, and >>> that in turn happens only if KVM is in use. So move the code to >>>

Re: mm: Initialise per_cpu_nodestats for all online pgdats at boot

2016-08-11 Thread Mel Gorman
On Wed, Aug 10, 2016 at 12:59:40PM -0500, Reza Arbab wrote: > On Thu, Aug 04, 2016 at 10:24:04AM +0100, Mel Gorman wrote: > >[1.713998] Unable to handle kernel paging request for data at address > >0xff7a1 > >[1.714164] Faulting instruction address: 0xc0270cd0 > >[

[PATCH] powerpc: sysdev: cpm: fix gpio save_regs functions

2016-08-11 Thread Christophe Leroy
of_mm_gpiochip_add_data() calls mm_gc->save_regs() before setting the data. Therefore ->save_regs() cannot use gpiochip_get_data() [0.275940] Unable to handle kernel paging request for data at address 0x0130 [0.283120] Faulting instruction address: 0xc01b44cc [0.288175] Oops:

Re: [PATCH 0/7] ima: carry the measurement list across kexec

2016-08-11 Thread Balbir Singh
On 09/08/16 22:36, Mimi Zohar wrote: > On Tue, 2016-08-09 at 15:19 +1000, Balbir Singh wrote: >> >> On 04/08/16 22:24, Mimi Zohar wrote: >>> The TPM PCRs are only reset on a hard reboot. In order to validate a >>> TPM's quote after a soft reboot (eg. kexec -e), the IMA measurement list >>> of

  1   2   >