Re: [PATCH] powerpc: use device_online/offline() instead of cpu_up/down()

2014-11-02 Thread Bharata B Rao
On Fri, Oct 31, 2014 at 03:41:34PM -0400, Dan Streetman wrote: In powerpc pseries platform dlpar operations, Use device_online() and device_offline() instead of cpu_up() and cpu_down(). Calling cpu_up/down directly does not update the cpu device offline field, which is used to online/offline

[PATCH V2] powerpc/TM: Disable/Enable TM looking at the ibm, pa-features device tree entry

2014-11-02 Thread Aneesh Kumar K.V
Runtime disable transactional memory feature looking at pa-features device tree entry. We need to do this so that we can run a kernel built with TM config in PR mode. For PR guest we provide a device tree entry with TM feature disabled in pa-features Signed-off-by: Aneesh Kumar K.V

[PATCH V9 00/18] Enable SRIOV on PowerNV

2014-11-02 Thread Wei Yang
This patchset enables the SRIOV on POWER8. The gerneral idea is put each VF into one individual PE and allocate required resources like MMIO/DMA/MSI. The major difficulty comes from the MMIO allocation and adjustment for PF's IOV BAR. On P8, we use M64BT to cover a PF's IOV BAR, which could make

[PATCH V9 01/18] PCI/IOV: Export interface for retrieve VF's BDF

2014-11-02 Thread Wei Yang
When implementing the SR-IOV on PowerNV platform, some resource reservation is needed for VFs which don't exist at the bootup stage. To do the match between resources and VFs, the code need to get the VF's BDF in advance. In this patch, it exports the interface to retrieve VF's BDF: * Make the

[PATCH V9 02/18] PCI: Add weak pcibios_iov_resource_alignment() interface

2014-11-02 Thread Wei Yang
The alignment of PF's IOV BAR is designed to be the individual size of a VF's BAR size. This works fine for many platforms, but on PowerNV platform it needs some change. The original alignment works, since at sizing and assigning stage the requirement is from an individual VF's BAR size instead

[PATCH V9 03/18] PCI: Add weak pcibios_iov_resource_size() interface

2014-11-02 Thread Wei Yang
When retrieving VF IOV BAR in virtfn_add(), it will divide the total PF's IOV BAR size with the totalVF number. This is true for most cases, while may not be correct on some specific platform. For example on PowerNV platform, in order to fix PF's IOV BAR into a hardware alignment, the PF's IOV

[PATCH V9 04/18] PCI: Take additional PF's IOV BAR alignment in sizing and assigning

2014-11-02 Thread Wei Yang
At resource sizing/assigning stage, resources are divided into two lists, requested list and additional list, while the alignement of the additional IOV BAR is not taken into the sizing and assigning procedure. This is reasonable in the original implementation, since IOV BAR's alignment is mostly

[PATCH V9 05/18] powerpc/pci: Add PCI resource alignment documentation

2014-11-02 Thread Wei Yang
In order to enable SRIOV on PowerNV platform, the PF's IOV BAR needs to be adjusted: 1. size expaned 2. aligned to M64BT size This patch documents this change on the reason and how. Signed-off-by: Wei Yang weiy...@linux.vnet.ibm.com --- .../powerpc/pci_iov_resource_on_powernv.txt

[PATCH V9 06/18] powerpc/pci: Don't unset pci resources for VFs

2014-11-02 Thread Wei Yang
If we're going to reassign resources with flag PCI_REASSIGN_ALL_RSRC, all resources will be cleaned out during device header fixup time and then get reassigned by PCI core. However, the VF resources won't be reassigned and thus, we shouldn't clean them out. This patch adds a condition. If the

[PATCH V9 07/18] powerpc/pci: Define pcibios_disable_device() on powerpc

2014-11-02 Thread Wei Yang
When driver remove a pci_dev, it will call pcibios_disable_device() which is platform dependent. This gives flexibility to platforms. This patch defines this weak function on powerpc architecture. Signed-off-by: Wei Yang weiy...@linux.vnet.ibm.com --- arch/powerpc/include/asm/machdep.h |5

[PATCH V9 09/18] powerpc/pci: remove pci_dn-pcidev field

2014-11-02 Thread Wei Yang
The field pci_dn-pcidev is assigned but not used. This patch removes this field. Signed-off-by: Wei Yang weiy...@linux.vnet.ibm.com Acked-by: Gavin Shan gws...@linux.vnet.ibm.com --- arch/powerpc/include/asm/pci-bridge.h |1 - arch/powerpc/platforms/powernv/pci-ioda.c |1 - 2 files

[PATCH V9 08/18] powrepc/pci: Refactor pci_dn

2014-11-02 Thread Wei Yang
From: Gavin Shan gws...@linux.vnet.ibm.com pci_dn is the extension of PCI device node and it's created from device node. Unfortunately, VFs that are enabled dynamically by PF's driver and they don't have corresponding device nodes, and pci_dn. The patch refactors pci_dn to support VFs: *

[PATCH V9 10/18] powerpc/powernv: Use pci_dn in PCI config accessor

2014-11-02 Thread Wei Yang
The PCI config accessors rely on device node. Unfortunately, VFs don't have corresponding device nodes. So we have to switch to pci_dn for PCI config access. Signed-off-by: Gavin Shan gws...@linux.vnet.ibm.com --- arch/powerpc/platforms/powernv/eeh-powernv.c | 14 +-

[PATCH V9 11/18] powerpc/powernv: Allocate pe-iommu_table dynamically

2014-11-02 Thread Wei Yang
Current iommu_table of a PE is a static field. This will have a problem when iommu_free_table is called. This patch allocate iommu_table dynamically. Signed-off-by: Wei Yang weiy...@linux.vnet.ibm.com --- arch/powerpc/include/asm/iommu.h |3 +++

[PATCH V9 12/18] powerpc/powernv: Expand VF resources according to the number of total_pe

2014-11-02 Thread Wei Yang
On PHB3, PF IOV BAR will be covered by M64 BAR to have better PE isolation. Mostly the total_pe number is different from the total_VFs, which will lead to a conflict between MMIO space and the PE number. For example, total_VFs is 128 and total_pe is 256, then the second half of M64 BAR space will

[PATCH V9 14/18] powerpc/powernv: Implement pcibios_iov_resource_size() on powernv

2014-11-02 Thread Wei Yang
On PowerNV platform, the PF's IOV BAR size would be expanded, which is different from the normal case. This patch retrieves the VF BAR size by total size dividing the expanded number of VFs. Signed-off-by: Wei Yang weiy...@linux.vnet.ibm.com --- arch/powerpc/include/asm/machdep.h|1

[PATCH V9 13/18] powerpc/powernv: Implement pcibios_iov_resource_alignment() on powernv

2014-11-02 Thread Wei Yang
This patch implements the pcibios_iov_resource_alignment() on powernv platform. On PowerNV platform, there are 3 cases for the IOV BAR: 1. initial state, the IOV BAR size is multiple times of VF BAR size 2. after expanded, the IOV BAR size is expanded to meet the M64 segment size 3. sizing stage,

[PATCH V9 15/18] powerpc/powernv: Shift VF resource with an offset

2014-11-02 Thread Wei Yang
On PowrNV platform, resource position in M64 implies the PE# the resource belongs to. In some particular case, adjustment of a resource is necessary to locate it to a correct position in M64. This patch introduces a function to shift the 'real' PF IOV BAR address according to an offset.

[PATCH V9 16/18] powerpc/powernv: Allocate VF PE

2014-11-02 Thread Wei Yang
VFs are created, when pci device is enabled. This patch tries best to assign maximum resources and PEs for VF when pci device is enabled. Enough M64 assigned to cover the IOV BAR, IOV BAR is shifted to meet the PE# indicated by M64. VF's pdn-pdev and pdn-pe_number are fixed. Signed-off-by: Wei

[PATCH V9 17/18] powerpc/powernv: Expanding IOV BAR, with m64_per_iov supported

2014-11-02 Thread Wei Yang
M64 aperture size is limited on PHB3. When the IOV BAR is too big, this will exceed the limitation and failed to be assigned. This patch introduce a different expanding based on the IOV BAR size: IOV BAR size is smaller than 64M, expand to total_pe. IOV BAR size is bigger than 64M, roundup

[PATCH V9 18/18] powerpc/powernv: Group VF PE when IOV BAR is big on PHB3

2014-11-02 Thread Wei Yang
When IOV BAR is big, each of it is covered by 4 M64 window. This leads to several VF PE sits in one PE in terms of M64. This patch group VF PEs according to the M64 allocation. Signed-off-by: Wei Yang weiy...@linux.vnet.ibm.com --- arch/powerpc/include/asm/pci-bridge.h |2 +-

[PATCH V3 1/2] powerpc/mm/thp: Remove code duplication

2014-11-02 Thread Aneesh Kumar K.V
Rename invalidate_old_hpte to flush_hash_hugepage and use that in other places. Signed-off-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com --- Changes from V2: * split the patch for easier review * Rebase to latest linus tree arch/powerpc/include/asm/tlbflush.h | 3 +-

[PATCH V3 2/2] powerpc/mm/thp: Use tlbiel if possible

2014-11-02 Thread Aneesh Kumar K.V
If we know that user address space has never executed on other cpus we could use tlbiel. Signed-off-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com --- arch/powerpc/include/asm/machdep.h| 2 +- arch/powerpc/include/asm/tlbflush.h | 3 ++- arch/powerpc/mm/hash_native_64.c | 4

Re: [PATCH] powerpc: Replace cc constraint in inline assembly with cr0

2014-11-02 Thread Anton Blanchard
Hi Segher, Our inline assembly only clobbers the first condition register field, but we mark all of them as being clobbered. No, we don't. cc has been an alias for cr0 for over twenty two and a half years now; it has never changed meaning. This is an LLVM bug. Thanks! I opened

[PATCH] powerpc/pseries: Quieten ibm,pcie-link-speed-stats warning

2014-11-02 Thread Anton Blanchard
The ibm,pcie-link-speed-stats isn't mandatory, so we shouldn't print a high priority error message when missing. One example where we see this is QEMU. Reduce it to pr_debug. Signed-off-by: Anton Blanchard an...@samba.org --- arch/powerpc/platforms/pseries/pci.c | 2 +- 1 file changed, 1

[PATCH] powerpc/pseries: Quieten relocation on exceptions warning

2014-11-02 Thread Anton Blanchard
The H_SET_MODE hcall returns H_P2 if a function is not implemented and all callers should handle this case. The call to enable relocation on exceptions currently prints an error message if the feature is not implemented. While H_SET_MODE was first introduced on POWER8 (which has relocation on

[PATCH 2/2] powerpc: Fix compilation of emulate_step()

2014-11-02 Thread Paul Mackerras
Commit be96f63375a1 (powerpc: Split out instruction analysis part of emulate_step()) added some calls to do_fp_load() and do_fp_store(), which fail to compile on configs with CONFIG_PPC_FPU=n and CONFIG_PPC_EMULATE_SSTEP=y. This fixes the compile by adding #ifdef CONFIG_PPC_FPU around the code

[PATCH 1/2] powerpc: Save/restore PPR for KVM hypercalls

2014-11-02 Thread Paul Mackerras
From: Suresh E. Warrier warr...@linux.vnet.ibm.com The system call FLIH (first-level interrupt handler) at 0xc00 unconditionally sets hardware priority to medium. For hypercalls, this means we lose guest OS priority. The front end (do_kvm_0x**) to the KVM interrupt handler always assumes that PPR