Re: [PATCH 10/10] powerpc/xive: fix the size of the cpumask used in xive_find_target_in_mask()

2017-08-23 Thread Michael Ellerman
Michael Ellerman  writes:

> Cédric Le Goater  writes:
>> When called from xive_irq_startup(), the size of the cpumask can be
>> larger than nr_cpu_ids. Most of time, its value is NR_CPUS (2048).
...
>
> I guess this patch is a good fix, I'll expand the change log a bit.

Actually this got lost, because it was part of the larger series, and
then you sent a v2 of the series and so v1 was marked superseeded :/

Anyway I've pulled this out of the series and will merge it.

cheers


[PATCH] powerpc/xive: Fix the size of the cpumask used in xive_find_target_in_mask()

2017-08-23 Thread Michael Ellerman
From: Cédric Le Goater 

When called from xive_irq_startup(), the size of the cpumask can be
larger than nr_cpu_ids. This can result in a WARN_ON such as:

  WARNING: CPU: 10 PID: 1 at ../arch/powerpc/sysdev/xive/common.c:476 
xive_find_target_in_mask+0x110/0x2f0
  ...
  NIP [c008a310] xive_find_target_in_mask+0x110/0x2f0
  LR [c008a2e4] xive_find_target_in_mask+0xe4/0x2f0
  Call Trace:
xive_find_target_in_mask+0x74/0x2f0 (unreliable)
xive_pick_irq_target.isra.1+0x200/0x230
xive_irq_startup+0x60/0x180
irq_startup+0x70/0xd0
__setup_irq+0x7bc/0x880
request_threaded_irq+0x14c/0x2c0
request_event_sources_irqs+0x100/0x180
__machine_initcall_pseries_init_ras_IRQ+0x104/0x134
do_one_initcall+0x68/0x1d0
kernel_init_freeable+0x290/0x374
kernel_init+0x24/0x170
ret_from_kernel_thread+0x5c/0x74

This happens because we're being called with our affinity mask set to
irq_default_affinity. That in turn was populated using
cpumask_setall(), which sets NR_CPUs worth of bits, not nr_cpu_ids
worth. Finally cpumask_weight() will return > nr_cpu_ids when passed a
mask which has > nr_cpu_ids bits set.

Fix it by limiting the value returned by cpumask_weight().

Signed-off-by: Cédric Le Goater 
[mpe: Add change log details on actual cause]
Signed-off-by: Michael Ellerman 
---
 arch/powerpc/sysdev/xive/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/sysdev/xive/common.c 
b/arch/powerpc/sysdev/xive/common.c
index 0db4c45bc561..558df6542b1a 100644
--- a/arch/powerpc/sysdev/xive/common.c
+++ b/arch/powerpc/sysdev/xive/common.c
@@ -447,7 +447,7 @@ static int xive_find_target_in_mask(const struct cpumask 
*mask,
int cpu, first, num, i;
 
/* Pick up a starting point CPU in the mask based on  fuzz */
-   num = cpumask_weight(mask);
+   num = min_t(int, cpumask_weight(mask), nr_cpu_ids);
first = fuzz % num;
 
/* Locate it */
-- 
2.7.4



Re: [PATCH kernel 0/5] powerpc/eeh: Some cleanups

2017-08-23 Thread Andrew Donnellan

On 24/08/17 12:19, Alexey Kardashevskiy wrote:

On 24/08/17 11:13, Russell Currey wrote:

On Wed, 2017-08-23 at 20:18 +1000, Alexey Kardashevskiy wrote:

Here are few patches to get rid of some cached pointers across EEH and
powernv code as I was struggling to figure out about lifetime of
structures and so on.


Thanks for the patches.  For the whole series:

Acked-by: Russell Currey 



The patches are labelled as "Needs Review / ACK" in the patchworks, and
until you reply to each individual patch, the "A" part of the "A/R/T"
column will remain "- - -".


https://github.com/getpatchwork/patchwork/issues/113

Too late for the just-released patchwork 2.0, but maybe 2.1 won't be 
that far off. :)


--
Andrew Donnellan  OzLabs, ADL Canberra
andrew.donnel...@au1.ibm.com  IBM Australia Limited



Re: [PATCH] cxl: Add support for POWER9 DD2

2017-08-23 Thread Andrew Donnellan

On 24/08/17 00:58, Christophe Lombard wrote:

The PSL initialization sequence has been updated to DD2.
This patch adapts to the changes, retaining compatibility with DD1.

Tests performed on some of the new hardware.


If we're retaining compatibility with DD1 I assume it's been tested on 
some of the old hardware too?


It seems this includes some changes to DD1 fix-ups as well.



Signed-off-by: Christophe Lombard  > ---
  drivers/misc/cxl/cxl.h |  2 ++
  drivers/misc/cxl/pci.c | 57 +++---
  2 files changed, 38 insertions(+), 21 deletions(-)

diff --git a/drivers/misc/cxl/cxl.h b/drivers/misc/cxl/cxl.h
index b1afecc..0167df8 100644
--- a/drivers/misc/cxl/cxl.h
+++ b/drivers/misc/cxl/cxl.h
@@ -100,6 +100,8 @@ static const cxl_p1_reg_t CXL_XSL_FEC   = {0x0158};
  static const cxl_p1_reg_t CXL_XSL_DSNCTL= {0x0168};
  /* PSL registers - CAIA 2 */
  static const cxl_p1_reg_t CXL_PSL9_CONTROL  = {0x0020};
+static const cxl_p1_reg_t CXL_XSL9_INV  = {0x0110};
+static const cxl_p1_reg_t CXL_XSL9_DEF  = {0x0140};
  static const cxl_p1_reg_t CXL_XSL9_DSNCTL   = {0x0168};
  static const cxl_p1_reg_t CXL_PSL9_FIR1 = {0x0300};
  static const cxl_p1_reg_t CXL_PSL9_FIR2 = {0x0308};
diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c
index d18b3d9..a981c65 100644
--- a/drivers/misc/cxl/pci.c
+++ b/drivers/misc/cxl/pci.c
@@ -475,37 +475,52 @@ static int init_implementation_adapter_regs_psl9(struct 
cxl *adapter,
psl_fircntl |= 0x1ULL; /* ce_thresh */
cxl_p1_write(adapter, CXL_PSL9_FIR_CNTL, psl_fircntl);
  
-	/* vccredits=0x1  pcklat=0x4 */

-   cxl_p1_write(adapter, CXL_PSL9_DSNDCTL, 0x1810ULL);
-
-   /*
-* For debugging with trace arrays.
-* Configure RX trace 0 segmented mode.
-* Configure CT trace 0 segmented mode.
-* Configure LA0 trace 0 segmented mode.
-* Configure LA1 trace 0 segmented mode.
+   /* Setup the PSL to transmit packets on the PCIe before the
+* CAPP is enabled
 */
-   cxl_p1_write(adapter, CXL_PSL9_TRACECFG, 0x804080008000ULL);
-   cxl_p1_write(adapter, CXL_PSL9_TRACECFG, 0x804080008003ULL);
-   cxl_p1_write(adapter, CXL_PSL9_TRACECFG, 0x804080008005ULL);
-   cxl_p1_write(adapter, CXL_PSL9_TRACECFG, 0x804080008006ULL);
+   cxl_p1_write(adapter, CXL_PSL9_DSNDCTL, 0x000100102A10ULL);
+
+   /* For debugging with trace arrays */
+   /* Configure RX trace 0 segmented mode */
+   cxl_p1_write(adapter, CXL_PSL9_TRACECFG, 0x8200ULL);
+   /* Configure RX trace 1 segmented mode */
+   cxl_p1_write(adapter, CXL_PSL9_TRACECFG, 0xAA01ULL);
+   /* Configure CT trace 0 segmented mode */
+   cxl_p1_write(adapter, CXL_PSL9_TRACECFG, 0xA2B80003ULL);
+   /* Configure LA0 trace 0 segmented mode */
+   cxl_p1_write(adapter, CXL_PSL9_TRACECFG, 0x83FFC005ULL);
+   /* Configure JM0 trace 0 segmented mode */
+   cxl_p1_write(adapter, CXL_PSL9_TRACECFG, 0x8207ULL);
+   /* Configure DMA trace 0 segmented mode */
+   cxl_p1_write(adapter, CXL_PSL9_TRACECFG, 0x8208ULL);
+   /* Configure DMA trace 1 segmented mode */
+   cxl_p1_write(adapter, CXL_PSL9_TRACECFG, 0x8209ULL);
  
  	/*

 * A response to an ASB_Notify request is returned by the
 * system as an MMIO write to the address defined in
 * the PSL_TNR_ADDR register
 */
-   /* PSL_TNR_ADDR */
+   /* keep the Reset Value: 0x0002E000 */


I was confused by this comment for a while - maybe keep PSL_TNR_ADDR at 
the beginning of the comment, it's not completely clear from the 
previous block alone.



+
+   /* Enable XSL rty limit */
+   cxl_p1_write(adapter, CXL_XSL9_DEF, 0x51F80005ULL);
  
-	/* NORST */

-   cxl_p1_write(adapter, CXL_PSL9_DEBUG, 0x8000ULL);
+   /* Change XSL_INV dummy readtheshold */


read threshold?


+   cxl_p1_write(adapter, CXL_XSL9_INV, 0x040007FFC200ULL);
  
-	/* allocate the apc machines */

-   cxl_p1_write(adapter, CXL_PSL9_APCDEDTYPE, 0x4003ULL);
+   if (phb_index == 3) {
+   /* disable machines 31-47 and 20-27 for DMA */
+   cxl_p1_write(adapter, CXL_PSL9_APCDEDTYPE, 
0x4FF3ULL);
+   }
+
+   /* Snoop machines */
+   cxl_p1_write(adapter, CXL_PSL9_APCDEDALLOC, 0x800F0002ULL);
  
-	/* Disable vc dd1 fix */

-   if (cxl_is_power9_dd1())
-   cxl_p1_write(adapter, CXL_PSL9_GP_CT, 0x0401ULL);
+   if (cxl_is_power9_dd1()) {
+   /* Disabling deadlock counter CAR */
+   cxl_p1_write(adapter, CXL_PSL9_GP_CT, 0x0021ULL);
+   }
  
  	return 0;

  }



--
Andrew Donnellan  OzLabs, ADL Canberra
andrew.donnel...@au1.ibm.com  IBM Australia 

Re: [PATCH kernel 5/5] powerpc/eeh: Remove unnecessary node from pci_dn

2017-08-23 Thread Andrew Donnellan

On 23/08/17 20:19, Alexey Kardashevskiy wrote:

The pci_dn struct caches a OF device node pointer in order to access
the "ibm,loc-code" property when EEH is recovering.

However, when this happens in eeh_dev_check_failure(), we also have
a pci_dev pointer which should have a valid pointer to the device node
when pci_dn has one (both pointers are not NULL for physical functions
and are NULL for virtual functions).

This removes the node pointer from the pci_dn struct and used pdev
in eeh_dev_check_failure() instead.

This changes pci_remove_device_node_info() to look for a parent of
the node being removed, just like pci_add_device_node_info() does when it
references the parent node.

Signed-off-by: Alexey Kardashevskiy 


Reviewed-by: Andrew Donnellan 


---
  arch/powerpc/include/asm/pci-bridge.h | 1 -
  arch/powerpc/kernel/eeh.c | 9 +
  arch/powerpc/kernel/pci_dn.c  | 8 +---
  3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/include/asm/pci-bridge.h 
b/arch/powerpc/include/asm/pci-bridge.h
index 56c67d3f0108..0b8aa1fe2d5f 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -195,7 +195,6 @@ struct pci_dn {
struct  pci_dn *parent;
struct  pci_controller *phb;/* for pci devices */
struct  iommu_table_group *table_group; /* for phb's or bridges */
-   struct  device_node *node;  /* back-pointer to the device_node */
  
  	int	pci_ext_config_space;	/* for pci devices */
  
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c

index c877014d11ce..2c926029adbe 100644
--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -435,7 +435,7 @@ int eeh_dev_check_failure(struct eeh_dev *edev)
int ret;
int active_flags = (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE);
unsigned long flags;
-   struct pci_dn *pdn;
+   struct device_node *dn;
struct pci_dev *dev;
struct eeh_pe *pe, *parent_pe, *phb_pe;
int rc = 0;
@@ -493,9 +493,10 @@ int eeh_dev_check_failure(struct eeh_dev *edev)
if (pe->state & EEH_PE_ISOLATED) {
pe->check_count++;
if (pe->check_count % EEH_MAX_FAILS == 0) {
-   pdn = eeh_dev_to_pdn(edev);
-   if (pdn->node)
-   location = of_get_property(pdn->node, 
"ibm,loc-code", NULL);
+   dn = pci_device_to_OF_node(dev);
+   if (dn)
+   location = of_get_property(dn, "ibm,loc-code",
+   NULL);
printk(KERN_ERR "EEH: %d reads ignored for recovering device 
at "
"location=%s driver=%s pci addr=%s\n",
pe->check_count,
diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c
index 0256372b72de..0e395afbf0f4 100644
--- a/arch/powerpc/kernel/pci_dn.c
+++ b/arch/powerpc/kernel/pci_dn.c
@@ -293,7 +293,6 @@ struct pci_dn *pci_add_device_node_info(struct 
pci_controller *hose,
if (pdn == NULL)
return NULL;
dn->data = pdn;
-   pdn->node = dn;
pdn->phb = hose;
  #ifdef CONFIG_PPC_POWERNV
pdn->pe_number = IODA_INVALID_PE;
@@ -342,6 +341,7 @@ EXPORT_SYMBOL_GPL(pci_add_device_node_info);
  void pci_remove_device_node_info(struct device_node *dn)
  {
struct pci_dn *pdn = dn ? PCI_DN(dn) : NULL;
+   struct device_node *parent;
  #ifdef CONFIG_EEH
struct eeh_dev *edev = pdn_to_eeh_dev(pdn);
  
@@ -354,8 +354,10 @@ void pci_remove_device_node_info(struct device_node *dn)
  
  	WARN_ON(!list_empty(>child_list));

list_del(>list);
-   if (pdn->parent)
-   of_node_put(pdn->parent->node);
+
+   parent = of_get_parent(dn);
+   if (parent)
+   of_node_put(parent);
  
  	dn->data = NULL;

kfree(pdn);



--
Andrew Donnellan  OzLabs, ADL Canberra
andrew.donnel...@au1.ibm.com  IBM Australia Limited



Re: [PATCH kernel 4/5] powerpc/eeh: Remove unnecessary config_addr from eeh_dev

2017-08-23 Thread Andrew Donnellan

On 23/08/17 20:19, Alexey Kardashevskiy wrote:

The eeh_dev struct hold a config space address of an associated node
and the very same address is also stored in the pci_dn struct which
is always present during the eeh_dev lifetime.

This uses bus:devfn directly from pci_dn instead of cached and packed
config_addr.

Since config_addr is made from device's bus:dev.fn, there is no point
in keeping it in the debugfs either so remove that too.

Signed-off-by: Alexey Kardashevskiy 


Reviewed-by: Andrew Donnellan 


---
  arch/powerpc/include/asm/eeh.h   |  1 -
  arch/powerpc/kernel/eeh_pe.c | 42 ++--
  arch/powerpc/kernel/eeh_sysfs.c  |  3 --
  arch/powerpc/platforms/powernv/eeh-powernv.c |  9 +++---
  4 files changed, 26 insertions(+), 29 deletions(-)

diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
index 777d37aa0a7f..9847ae3a12d1 100644
--- a/arch/powerpc/include/asm/eeh.h
+++ b/arch/powerpc/include/asm/eeh.h
@@ -131,7 +131,6 @@ static inline bool eeh_pe_passed(struct eeh_pe *pe)
  struct eeh_dev {
int mode;   /* EEH mode */
int class_code; /* Class code of the device */
-   int config_addr;/* Config address   */
int pe_config_addr; /* PE config address*/
u32 config_space[16];   /* Saved PCI config space   */
int pcix_cap;   /* Saved PCIx capability*/
diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c
index 419c3f07afd5..2e8d1b2b5af4 100644
--- a/arch/powerpc/kernel/eeh_pe.c
+++ b/arch/powerpc/kernel/eeh_pe.c
@@ -340,11 +340,12 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
  {
struct eeh_pe *pe, *parent;
struct pci_dn *pdn = eeh_dev_to_pdn(edev);
+   int config_addr = (pdn->busno << 8) | (pdn->devfn);
  
  	/* Check if the PE number is valid */

if (!eeh_has_flag(EEH_VALID_PE_ZERO) && !edev->pe_config_addr) {
pr_err("%s: Invalid PE#0 for edev 0x%x on PHB#%x\n",
-  __func__, edev->config_addr, pdn->phb->global_number);
+  __func__, config_addr, pdn->phb->global_number);
return -EINVAL;
}
  
@@ -354,8 +355,7 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)

 * PE should be composed of PCI bus and its subordinate
 * components.
 */
-   pe = eeh_pe_get(pdn->phb, edev->pe_config_addr,
-   edev->config_addr);
+   pe = eeh_pe_get(pdn->phb, edev->pe_config_addr, config_addr);
if (pe && !(pe->type & EEH_PE_INVALID)) {
/* Mark the PE as type of PCI bus */
pe->type = EEH_PE_BUS;
@@ -365,10 +365,10 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
list_add_tail(>list, >edevs);
pr_debug("EEH: Add %04x:%02x:%02x.%01x to Bus PE#%x\n",
 pdn->phb->global_number,
-   edev->config_addr >> 8,
-   PCI_SLOT(edev->config_addr & 0xFF),
-   PCI_FUNC(edev->config_addr & 0xFF),
-   pe->addr);
+pdn->busno,
+PCI_SLOT(pdn->devfn),
+PCI_FUNC(pdn->devfn),
+pe->addr);
return 0;
} else if (pe && (pe->type & EEH_PE_INVALID)) {
list_add_tail(>list, >edevs);
@@ -388,10 +388,10 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
pr_debug("EEH: Add %04x:%02x:%02x.%01x to Device "
 "PE#%x, Parent PE#%x\n",
 pdn->phb->global_number,
-   edev->config_addr >> 8,
-PCI_SLOT(edev->config_addr & 0xFF),
-PCI_FUNC(edev->config_addr & 0xFF),
-   pe->addr, pe->parent->addr);
+pdn->busno,
+PCI_SLOT(pdn->devfn),
+PCI_FUNC(pdn->devfn),
+pe->addr, pe->parent->addr);
return 0;
}
  
@@ -405,7 +405,7 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)

return -ENOMEM;
}
pe->addr = edev->pe_config_addr;
-   pe->config_addr  = edev->config_addr;
+   pe->config_addr  = config_addr;
  
  	/*

 * Put the new EEH PE into hierarchy tree. If the parent
@@ -436,9 +436,9 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
pr_debug("EEH: Add %04x:%02x:%02x.%01x to "
 "Device PE#%x, Parent PE#%x\n",
 pdn->phb->global_number,
-edev->config_addr >> 8,
-PCI_SLOT(edev->config_addr & 0xFF),
-PCI_FUNC(edev->config_addr & 0xFF),
+pdn->busno,
+

Re: [PATCH kernel 3/5] powerpc/eeh: Remove unnecessary pointer to phb from eeh_dev

2017-08-23 Thread Andrew Donnellan

On 23/08/17 20:18, Alexey Kardashevskiy wrote:

The eeh_dev struct already holds a pointer to pci_dn which it does not
exist without and pci_dn itself holds the very same pointer so just
use it.

Signed-off-by: Alexey Kardashevskiy 


Reviewed-by: Andrew Donnellan 


---
  arch/powerpc/include/asm/eeh.h   |  1 -
  arch/powerpc/kernel/eeh.c|  7 +++
  arch/powerpc/kernel/eeh_dev.c|  2 --
  arch/powerpc/kernel/eeh_driver.c |  2 +-
  arch/powerpc/kernel/eeh_pe.c | 24 +---
  arch/powerpc/platforms/powernv/eeh-powernv.c |  5 ++---
  6 files changed, 19 insertions(+), 22 deletions(-)

diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
index 26a6a43f8799..777d37aa0a7f 100644
--- a/arch/powerpc/include/asm/eeh.h
+++ b/arch/powerpc/include/asm/eeh.h
@@ -141,7 +141,6 @@ struct eeh_dev {
struct eeh_pe *pe;  /* Associated PE*/
struct list_head list;  /* Form link list in the PE */
struct list_head rmv_list;  /* Record the removed edevs */
-   struct pci_controller *phb; /* Associated PHB   */
struct pci_dn *pdn; /* Associated PCI device node   */
struct pci_dev *pdev;   /* Associated PCI device*/
bool in_error;  /* Error flag for edev  */
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
index 63992b2d8e15..c877014d11ce 100644
--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -169,10 +169,10 @@ static size_t eeh_dump_dev_log(struct eeh_dev *edev, char 
*buf, size_t len)
char buffer[128];
  
  	n += scnprintf(buf+n, len-n, "%04x:%02x:%02x.%01x\n",

-  edev->phb->global_number, pdn->busno,
+  pdn->phb->global_number, pdn->busno,
   PCI_SLOT(pdn->devfn), PCI_FUNC(pdn->devfn));
pr_warn("EEH: of node=%04x:%02x:%02x.%01x\n",
-   edev->phb->global_number, pdn->busno,
+   pdn->phb->global_number, pdn->busno,
PCI_SLOT(pdn->devfn), PCI_FUNC(pdn->devfn));
  
  	eeh_ops->read_config(pdn, PCI_VENDOR_ID, 4, );

@@ -1064,7 +1064,7 @@ core_initcall_sync(eeh_init);
   */
  void eeh_add_device_early(struct pci_dn *pdn)
  {
-   struct pci_controller *phb;
+   struct pci_controller *phb = pdn ? pdn->phb : NULL;
struct eeh_dev *edev = pdn_to_eeh_dev(pdn);
  
  	if (!edev)

@@ -1074,7 +1074,6 @@ void eeh_add_device_early(struct pci_dn *pdn)
return;
  
  	/* USB Bus children of PCI devices will not have BUID's */

-   phb = edev->phb;
if (NULL == phb ||
(eeh_has_flag(EEH_PROBE_MODE_DEVTREE) && 0 == phb->buid))
return;
diff --git a/arch/powerpc/kernel/eeh_dev.c b/arch/powerpc/kernel/eeh_dev.c
index d6b2ca70d14d..bdf4a3698a35 100644
--- a/arch/powerpc/kernel/eeh_dev.c
+++ b/arch/powerpc/kernel/eeh_dev.c
@@ -50,7 +50,6 @@
   */
  struct eeh_dev *eeh_dev_init(struct pci_dn *pdn)
  {
-   struct pci_controller *phb = pdn->phb;
struct eeh_dev *edev;
  
  	/* Allocate EEH device */

@@ -64,7 +63,6 @@ struct eeh_dev *eeh_dev_init(struct pci_dn *pdn)
/* Associate EEH device with OF node */
pdn->edev = edev;
edev->pdn = pdn;
-   edev->phb = phb;
INIT_LIST_HEAD(>list);
INIT_LIST_HEAD(>rmv_list);
  
diff --git a/arch/powerpc/kernel/eeh_driver.c b/arch/powerpc/kernel/eeh_driver.c

index c405c79e50cd..8b840191df59 100644
--- a/arch/powerpc/kernel/eeh_driver.c
+++ b/arch/powerpc/kernel/eeh_driver.c
@@ -428,7 +428,7 @@ static void *eeh_add_virt_device(void *data, void *userdata)
  
  	if (!(edev->physfn)) {

pr_warn("%s: EEH dev %04x:%02x:%02x.%01x not for VF\n",
-   __func__, edev->phb->global_number, pdn->busno,
+   __func__, pdn->phb->global_number, pdn->busno,
PCI_SLOT(pdn->devfn), PCI_FUNC(pdn->devfn));
return NULL;
}
diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c
index 84d79f3da7d6..419c3f07afd5 100644
--- a/arch/powerpc/kernel/eeh_pe.c
+++ b/arch/powerpc/kernel/eeh_pe.c
@@ -339,11 +339,12 @@ static struct eeh_pe *eeh_pe_get_parent(struct eeh_dev 
*edev)
  int eeh_add_to_parent_pe(struct eeh_dev *edev)
  {
struct eeh_pe *pe, *parent;
+   struct pci_dn *pdn = eeh_dev_to_pdn(edev);
  
  	/* Check if the PE number is valid */

if (!eeh_has_flag(EEH_VALID_PE_ZERO) && !edev->pe_config_addr) {
pr_err("%s: Invalid PE#0 for edev 0x%x on PHB#%x\n",
-  __func__, edev->config_addr, edev->phb->global_number);
+  __func__, edev->config_addr, pdn->phb->global_number);
return -EINVAL;
}
  
@@ -353,7 +354,7 @@ int 

Re: [PATCH] powerpc/powernv/idle: Round up latency and residency values

2017-08-23 Thread Gautham R Shenoy
Hi Vaidy,
On Thu, Aug 24, 2017 at 12:28:41AM +0530, Vaidyanathan Srinivasan
wrote:

Cc'ing Rafael and linux-pm list.

> On PowerNV platforms, firmware provides exit latency and
> target residency for each of the idle states in nano
> seconds.  Cpuidle framework expects the values in micro
> seconds.  Round up to nearest micro seconds to avoid errors
> in cases where the values are defined as fractional micro
> seconds.
> 
> Default idle state of 'snooze' has exit latency of zero.  If
> other states have fractional micro second exit latency, they
> would get rounded down to zero micro second and make cpuidle
> framework choose deeper idle state when snooze loop is the
> right choice.
> 
> Reported-by: Anton Blanchard 
> Signed-off-by: Vaidyanathan Srinivasan 

This looks good to me.

Reviewed-by: Gautham R. Shenoy 
> ---
>  drivers/cpuidle/cpuidle-powernv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cpuidle/cpuidle-powernv.c 
> b/drivers/cpuidle/cpuidle-powernv.c
> index 42896a67aeae..5f3922392059 100644
> --- a/drivers/cpuidle/cpuidle-powernv.c
> +++ b/drivers/cpuidle/cpuidle-powernv.c
> @@ -383,9 +383,9 @@ static int powernv_add_idle_states(void)
>* Firmware passes residency and latency values in ns.
>* cpuidle expects it in us.
>*/
> - exit_latency = latency_ns[i] / 1000;
> + exit_latency = DIV_ROUND_UP(latency_ns[i], 1000);
>   if (!rc)
> - target_residency = residency_ns[i] / 1000;
> + target_residency = DIV_ROUND_UP(residency_ns[i], 1000);
>   else
>   target_residency = 0;
> 
> -- 
> 2.13.5
> 



Re: [PATCH kernel 2/5] powerpc/eeh: Reduce to one the number of places where edev is allocated

2017-08-23 Thread Andrew Donnellan

On 23/08/17 20:18, Alexey Kardashevskiy wrote:

arch/powerpc/kernel/eeh_dev.c:57 is the only legit place where edev
is allocated; other 2 places allocate it on stack and in the heap for
a very short period of time to use eeh_pe_get() as takes edev.

This changes eeh_pe_get() to receive required parameters explicitly.

This removes unnecessary temporary allocation of edev.

This uses the "pe_no" name instead of the "pe_config_addr" name as
it actually is a PE number and not a config space address as it seemed.

Signed-off-by: Alexey Kardashevskiy 


Reviewed-by: Andrew Donnellan 


---
  arch/powerpc/include/asm/eeh.h   |  3 ++-
  arch/powerpc/kernel/eeh_pe.c | 32 ++--
  arch/powerpc/platforms/powernv/eeh-powernv.c | 15 ++---
  3 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
index 8e37b71674f4..26a6a43f8799 100644
--- a/arch/powerpc/include/asm/eeh.h
+++ b/arch/powerpc/include/asm/eeh.h
@@ -262,7 +262,8 @@ typedef void *(*eeh_traverse_func)(void *data, void *flag);
  void eeh_set_pe_aux_size(int size);
  int eeh_phb_pe_create(struct pci_controller *phb);
  struct eeh_pe *eeh_phb_pe_get(struct pci_controller *phb);
-struct eeh_pe *eeh_pe_get(struct eeh_dev *edev);
+struct eeh_pe *eeh_pe_get(struct pci_controller *phb,
+ int pe_no, int config_addr);
  int eeh_add_to_parent_pe(struct eeh_dev *edev);
  int eeh_rmv_from_parent_pe(struct eeh_dev *edev);
  void eeh_pe_update_time_stamp(struct eeh_pe *pe);
diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c
index cc4b206f77e4..84d79f3da7d6 100644
--- a/arch/powerpc/kernel/eeh_pe.c
+++ b/arch/powerpc/kernel/eeh_pe.c
@@ -230,10 +230,15 @@ void *eeh_pe_dev_traverse(struct eeh_pe *root,
   * Bus/Device/Function number. The extra data referred by flag
   * indicates which type of address should be used.
   */
+struct eeh_pe_get_flag {
+   int pe_no;
+   int config_addr;
+};
+
  static void *__eeh_pe_get(void *data, void *flag)
  {
struct eeh_pe *pe = (struct eeh_pe *)data;
-   struct eeh_dev *edev = (struct eeh_dev *)flag;
+   struct eeh_pe_get_flag *tmp = (struct eeh_pe_get_flag *) flag;
  
  	/* Unexpected PHB PE */

if (pe->type & EEH_PE_PHB)
@@ -244,17 +249,17 @@ static void *__eeh_pe_get(void *data, void *flag)
 * have non-zero PE address
 */
if (eeh_has_flag(EEH_VALID_PE_ZERO)) {
-   if (edev->pe_config_addr == pe->addr)
+   if (tmp->pe_no == pe->addr)
return pe;
} else {
-   if (edev->pe_config_addr &&
-   (edev->pe_config_addr == pe->addr))
+   if (tmp->pe_no &&
+   (tmp->pe_no == pe->addr))
return pe;
}
  
  	/* Try BDF address */

-   if (edev->config_addr &&
-  (edev->config_addr == pe->config_addr))
+   if (tmp->config_addr &&
+  (tmp->config_addr == pe->config_addr))
return pe;
  
  	return NULL;

@@ -262,7 +267,9 @@ static void *__eeh_pe_get(void *data, void *flag)
  
  /**

   * eeh_pe_get - Search PE based on the given address
- * @edev: EEH device
+ * @phb: PCI controller
+ * @pe_no: PE number
+ * @config_addr: Config address
   *
   * Search the corresponding PE based on the specified address which
   * is included in the eeh device. The function is used to check if
@@ -271,12 +278,14 @@ static void *__eeh_pe_get(void *data, void *flag)
   * which is composed of PCI bus/device/function number, or unified
   * PE address.
   */
-struct eeh_pe *eeh_pe_get(struct eeh_dev *edev)
+struct eeh_pe *eeh_pe_get(struct pci_controller *phb,
+   int pe_no, int config_addr)
  {
-   struct eeh_pe *root = eeh_phb_pe_get(edev->phb);
+   struct eeh_pe *root = eeh_phb_pe_get(phb);
+   struct eeh_pe_get_flag tmp = { pe_no, config_addr };
struct eeh_pe *pe;
  
-	pe = eeh_pe_traverse(root, __eeh_pe_get, edev);

+   pe = eeh_pe_traverse(root, __eeh_pe_get, );
  
  	return pe;

  }
@@ -344,7 +353,8 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
 * PE should be composed of PCI bus and its subordinate
 * components.
 */
-   pe = eeh_pe_get(edev);
+   pe = eeh_pe_get(edev->pdn->phb, edev->pe_config_addr,
+   edev->config_addr);
if (pe && !(pe->type & EEH_PE_INVALID)) {
/* Mark the PE as type of PCI bus */
pe->type = EEH_PE_BUS;
diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c 
b/arch/powerpc/platforms/powernv/eeh-powernv.c
index 3f48f6df1cf3..ac8c01cd251c 100644
--- a/arch/powerpc/platforms/powernv/eeh-powernv.c
+++ b/arch/powerpc/platforms/powernv/eeh-powernv.c
@@ -113,7 +113,6 @@ static ssize_t pnv_eeh_ei_write(struct file *filp,
size_t count, 

Re: [PATCH kernel 1/5] powerpc/pci: Remove unused parameter from add_one_dev_pci_data()

2017-08-23 Thread Andrew Donnellan

On 23/08/17 20:18, Alexey Kardashevskiy wrote:

pdev is always NULL, remove it.

To make checkpatch.pl happy, this also removes the "out of memory"
message.

Signed-off-by: Alexey Kardashevskiy 


Reviewed-by: Andrew Donnellan 


---
  arch/powerpc/kernel/pci_dn.c | 14 ++
  1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c
index 592693437070..0256372b72de 100644
--- a/arch/powerpc/kernel/pci_dn.c
+++ b/arch/powerpc/kernel/pci_dn.c
@@ -139,7 +139,6 @@ struct pci_dn *pci_get_pdn(struct pci_dev *pdev)
  
  #ifdef CONFIG_PCI_IOV

  static struct pci_dn *add_one_dev_pci_data(struct pci_dn *parent,
-  struct pci_dev *pdev,
   int vf_index,
   int busno, int devfn)
  {
@@ -150,10 +149,8 @@ static struct pci_dn *add_one_dev_pci_data(struct pci_dn 
*parent,
return NULL;
  
  	pdn = kzalloc(sizeof(*pdn), GFP_KERNEL);

-   if (!pdn) {
-   dev_warn(>dev, "%s: Out of memory!\n", __func__);
+   if (!pdn)
return NULL;
-   }
  
  	pdn->phb = parent->phb;

pdn->parent = parent;
@@ -167,13 +164,6 @@ static struct pci_dn *add_one_dev_pci_data(struct pci_dn 
*parent,
INIT_LIST_HEAD(>list);
list_add_tail(>list, >child_list);
  
-	/*

-* If we already have PCI device instance, lets
-* bind them.
-*/
-   if (pdev)
-   pdev->dev.archdata.pci_data = pdn;
-
return pdn;
  }
  #endif
@@ -201,7 +191,7 @@ struct pci_dn *add_dev_pci_data(struct pci_dev *pdev)
for (i = 0; i < pci_sriov_get_totalvfs(pdev); i++) {
struct eeh_dev *edev __maybe_unused;
  
-		pdn = add_one_dev_pci_data(parent, NULL, i,

+   pdn = add_one_dev_pci_data(parent, i,
   pci_iov_virtfn_bus(pdev, i),
   pci_iov_virtfn_devfn(pdev, i));
if (!pdn) {



--
Andrew Donnellan  OzLabs, ADL Canberra
andrew.donnel...@au1.ibm.com  IBM Australia Limited



Re: [PATCH] KVM: PPC: Book3S: Fix race and leak in kvm_vm_ioctl_create_spapr_tce()

2017-08-23 Thread David Gibson
On Thu, Aug 24, 2017 at 01:40:08PM +1000, Paul Mackerras wrote:
> Nixiaoming pointed out that there is a memory leak in
> kvm_vm_ioctl_create_spapr_tce() if the call to anon_inode_getfd()
> fails; the memory allocated for the kvmppc_spapr_tce_table struct
> is not freed, and nor are the pages allocated for the iommu
> tables.  In addition, we have already incremented the process's
> count of locked memory pages, and this doesn't get restored on
> error.
> 
> David Hildenbrand pointed out that there is a race in that the
> function checks early on that there is not already an entry in the
> stt->iommu_tables list with the same LIOBN, but an entry with the
> same LIOBN could get added between then and when the new entry is
> added to the list.
> 
> This fixes all three problems.  To simplify things, we now call
> anon_inode_getfd() before placing the new entry in the list.  The
> check for an existing entry is done while holding the kvm->lock
> mutex, immediately before adding the new entry to the list.
> Finally, on failure we now call kvmppc_account_memlimit to
> decrement the process's count of locked memory pages.
> 
> Reported-by: Nixiaoming 
> Reported-by: David Hildenbrand 
> Signed-off-by: Paul Mackerras 

Reviewed-by: David Gibson 

> ---
>  arch/powerpc/kvm/book3s_64_vio.c | 55 
> 
>  1 file changed, 33 insertions(+), 22 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/book3s_64_vio.c 
> b/arch/powerpc/kvm/book3s_64_vio.c
> index a160c14304eb..d463c1cd0d8d 100644
> --- a/arch/powerpc/kvm/book3s_64_vio.c
> +++ b/arch/powerpc/kvm/book3s_64_vio.c
> @@ -297,29 +297,22 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
>   unsigned long npages, size;
>   int ret = -ENOMEM;
>   int i;
> + int fd = -1;
>  
>   if (!args->size)
>   return -EINVAL;
>  
> - /* Check this LIOBN hasn't been previously allocated */
> - list_for_each_entry(stt, >arch.spapr_tce_tables, list) {
> - if (stt->liobn == args->liobn)
> - return -EBUSY;
> - }
> -
>   size = _ALIGN_UP(args->size, PAGE_SIZE >> 3);
>   npages = kvmppc_tce_pages(size);
>   ret = kvmppc_account_memlimit(kvmppc_stt_pages(npages), true);
> - if (ret) {
> - stt = NULL;
> - goto fail;
> - }
> + if (ret)
> + return ret;
>  
>   ret = -ENOMEM;
>   stt = kzalloc(sizeof(*stt) + npages * sizeof(struct page *),
> GFP_KERNEL);
>   if (!stt)
> - goto fail;
> + goto fail_acct;
>  
>   stt->liobn = args->liobn;
>   stt->page_shift = args->page_shift;
> @@ -334,24 +327,42 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
>   goto fail;
>   }
>  
> - kvm_get_kvm(kvm);
> + ret = fd = anon_inode_getfd("kvm-spapr-tce", _spapr_tce_fops,
> + stt, O_RDWR | O_CLOEXEC);
> + if (ret < 0)
> + goto fail;
>  
>   mutex_lock(>lock);
> - list_add_rcu(>list, >arch.spapr_tce_tables);
> +
> + /* Check this LIOBN hasn't been previously allocated */
> + ret = 0;
> + list_for_each_entry(stt, >arch.spapr_tce_tables, list) {
> + if (stt->liobn == args->liobn) {
> + ret = -EBUSY;
> + break;
> + }
> + }
> +
> + if (!ret) {
> + list_add_rcu(>list, >arch.spapr_tce_tables);
> + kvm_get_kvm(kvm);
> + }
>  
>   mutex_unlock(>lock);
>  
> - return anon_inode_getfd("kvm-spapr-tce", _spapr_tce_fops,
> - stt, O_RDWR | O_CLOEXEC);
> + if (!ret)
> + return fd;
>  
> -fail:
> - if (stt) {
> - for (i = 0; i < npages; i++)
> - if (stt->pages[i])
> - __free_page(stt->pages[i]);
> + put_unused_fd(fd);
>  
> - kfree(stt);
> - }
> + fail:
> + for (i = 0; i < npages; i++)
> + if (stt->pages[i])
> + __free_page(stt->pages[i]);
> +
> + kfree(stt);
> + fail_acct:
> + kvmppc_account_memlimit(kvmppc_stt_pages(npages), false);
>   return ret;
>  }
>  

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson


signature.asc
Description: PGP signature


[PATCH] KVM: PPC: Book3S: Fix race and leak in kvm_vm_ioctl_create_spapr_tce()

2017-08-23 Thread Paul Mackerras
Nixiaoming pointed out that there is a memory leak in
kvm_vm_ioctl_create_spapr_tce() if the call to anon_inode_getfd()
fails; the memory allocated for the kvmppc_spapr_tce_table struct
is not freed, and nor are the pages allocated for the iommu
tables.  In addition, we have already incremented the process's
count of locked memory pages, and this doesn't get restored on
error.

David Hildenbrand pointed out that there is a race in that the
function checks early on that there is not already an entry in the
stt->iommu_tables list with the same LIOBN, but an entry with the
same LIOBN could get added between then and when the new entry is
added to the list.

This fixes all three problems.  To simplify things, we now call
anon_inode_getfd() before placing the new entry in the list.  The
check for an existing entry is done while holding the kvm->lock
mutex, immediately before adding the new entry to the list.
Finally, on failure we now call kvmppc_account_memlimit to
decrement the process's count of locked memory pages.

Reported-by: Nixiaoming 
Reported-by: David Hildenbrand 
Signed-off-by: Paul Mackerras 
---
 arch/powerpc/kvm/book3s_64_vio.c | 55 
 1 file changed, 33 insertions(+), 22 deletions(-)

diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c
index a160c14304eb..d463c1cd0d8d 100644
--- a/arch/powerpc/kvm/book3s_64_vio.c
+++ b/arch/powerpc/kvm/book3s_64_vio.c
@@ -297,29 +297,22 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
unsigned long npages, size;
int ret = -ENOMEM;
int i;
+   int fd = -1;
 
if (!args->size)
return -EINVAL;
 
-   /* Check this LIOBN hasn't been previously allocated */
-   list_for_each_entry(stt, >arch.spapr_tce_tables, list) {
-   if (stt->liobn == args->liobn)
-   return -EBUSY;
-   }
-
size = _ALIGN_UP(args->size, PAGE_SIZE >> 3);
npages = kvmppc_tce_pages(size);
ret = kvmppc_account_memlimit(kvmppc_stt_pages(npages), true);
-   if (ret) {
-   stt = NULL;
-   goto fail;
-   }
+   if (ret)
+   return ret;
 
ret = -ENOMEM;
stt = kzalloc(sizeof(*stt) + npages * sizeof(struct page *),
  GFP_KERNEL);
if (!stt)
-   goto fail;
+   goto fail_acct;
 
stt->liobn = args->liobn;
stt->page_shift = args->page_shift;
@@ -334,24 +327,42 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
goto fail;
}
 
-   kvm_get_kvm(kvm);
+   ret = fd = anon_inode_getfd("kvm-spapr-tce", _spapr_tce_fops,
+   stt, O_RDWR | O_CLOEXEC);
+   if (ret < 0)
+   goto fail;
 
mutex_lock(>lock);
-   list_add_rcu(>list, >arch.spapr_tce_tables);
+
+   /* Check this LIOBN hasn't been previously allocated */
+   ret = 0;
+   list_for_each_entry(stt, >arch.spapr_tce_tables, list) {
+   if (stt->liobn == args->liobn) {
+   ret = -EBUSY;
+   break;
+   }
+   }
+
+   if (!ret) {
+   list_add_rcu(>list, >arch.spapr_tce_tables);
+   kvm_get_kvm(kvm);
+   }
 
mutex_unlock(>lock);
 
-   return anon_inode_getfd("kvm-spapr-tce", _spapr_tce_fops,
-   stt, O_RDWR | O_CLOEXEC);
+   if (!ret)
+   return fd;
 
-fail:
-   if (stt) {
-   for (i = 0; i < npages; i++)
-   if (stt->pages[i])
-   __free_page(stt->pages[i]);
+   put_unused_fd(fd);
 
-   kfree(stt);
-   }
+ fail:
+   for (i = 0; i < npages; i++)
+   if (stt->pages[i])
+   __free_page(stt->pages[i]);
+
+   kfree(stt);
+ fail_acct:
+   kvmppc_account_memlimit(kvmppc_stt_pages(npages), false);
return ret;
 }
 
-- 
2.11.0



Re: [PATCH kernel 0/5] powerpc/eeh: Some cleanups

2017-08-23 Thread Alexey Kardashevskiy
On 24/08/17 11:13, Russell Currey wrote:
> On Wed, 2017-08-23 at 20:18 +1000, Alexey Kardashevskiy wrote:
>> Here are few patches to get rid of some cached pointers across EEH and
>> powernv code as I was struggling to figure out about lifetime of
>> structures and so on.
> 
> Thanks for the patches.  For the whole series:
> 
> Acked-by: Russell Currey 


The patches are labelled as "Needs Review / ACK" in the patchworks, and
until you reply to each individual patch, the "A" part of the "A/R/T"
column will remain "- - -".


> 
>>
>>
>> This is based on sha1
>> 98b9f8a45499 Linus Torvalds Merge tag 'ext4_for_linus_stable' of
>> git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
>>
>> Please comment. Thanks.
>>
>>
>>
>> Alexey Kardashevskiy (5):
>>   powerpc/pci: Remove unused parameter from add_one_dev_pci_data()
>>   powerpc/eeh: Reduce to one the number of places where edev is
>> allocated
>>   powerpc/eeh: Remove unnecessary pointer to phb from eeh_dev
>>   powerpc/eeh: Remove unnecessary config_addr from eeh_dev
>>   powerpc/eeh: Remove unnecessary node from pci_dn
>>
>>  arch/powerpc/include/asm/eeh.h   |  5 +-
>>  arch/powerpc/include/asm/pci-bridge.h|  1 -
>>  arch/powerpc/kernel/eeh.c| 16 ++---
>>  arch/powerpc/kernel/eeh_dev.c|  2 -
>>  arch/powerpc/kernel/eeh_driver.c |  2 +-
>>  arch/powerpc/kernel/eeh_pe.c | 90 
>> ---
>> -
>>  arch/powerpc/kernel/eeh_sysfs.c  |  3 -
>>  arch/powerpc/kernel/pci_dn.c | 22 +++
>>  arch/powerpc/platforms/powernv/eeh-powernv.c | 29 +++--
>>  9 files changed, 78 insertions(+), 92 deletions(-)
>>
> 


-- 
Alexey


Re: [PATCH kernel 0/5] powerpc/eeh: Some cleanups

2017-08-23 Thread Russell Currey
On Wed, 2017-08-23 at 20:18 +1000, Alexey Kardashevskiy wrote:
> Here are few patches to get rid of some cached pointers across EEH and
> powernv code as I was struggling to figure out about lifetime of
> structures and so on.

Thanks for the patches.  For the whole series:

Acked-by: Russell Currey 

> 
> 
> This is based on sha1
> 98b9f8a45499 Linus Torvalds Merge tag 'ext4_for_linus_stable' of
> git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
> 
> Please comment. Thanks.
> 
> 
> 
> Alexey Kardashevskiy (5):
>   powerpc/pci: Remove unused parameter from add_one_dev_pci_data()
>   powerpc/eeh: Reduce to one the number of places where edev is
> allocated
>   powerpc/eeh: Remove unnecessary pointer to phb from eeh_dev
>   powerpc/eeh: Remove unnecessary config_addr from eeh_dev
>   powerpc/eeh: Remove unnecessary node from pci_dn
> 
>  arch/powerpc/include/asm/eeh.h   |  5 +-
>  arch/powerpc/include/asm/pci-bridge.h|  1 -
>  arch/powerpc/kernel/eeh.c| 16 ++---
>  arch/powerpc/kernel/eeh_dev.c|  2 -
>  arch/powerpc/kernel/eeh_driver.c |  2 +-
>  arch/powerpc/kernel/eeh_pe.c | 90 ---
> -
>  arch/powerpc/kernel/eeh_sysfs.c  |  3 -
>  arch/powerpc/kernel/pci_dn.c | 22 +++
>  arch/powerpc/platforms/powernv/eeh-powernv.c | 29 +++--
>  9 files changed, 78 insertions(+), 92 deletions(-)
> 



Re: [PATCH] fix memory leak on kvm_vm_ioctl_create_spapr_tce

2017-08-23 Thread Nixiaoming
>On 23.08.2017 08:06, Paul Mackerras wrote:
>> On Wed, Aug 23, 2017 at 01:43:08AM +, Nixiaoming wrote:
 On 22.08.2017 17:15, David Hildenbrand wrote:
> On 22.08.2017 16:28, nixiaoming wrote:
>> miss kfree(stt) when anon_inode_getfd return fail so add check 
>> anon_inode_getfd return val, and kfree stt
>>
>> Signed-off-by: nixiaoming 
>> ---
>>  arch/powerpc/kvm/book3s_64_vio.c | 5 -
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/powerpc/kvm/book3s_64_vio.c
>> b/arch/powerpc/kvm/book3s_64_vio.c
>> index a160c14..a0b4459 100644
>> --- a/arch/powerpc/kvm/book3s_64_vio.c
>> +++ b/arch/powerpc/kvm/book3s_64_vio.c
>> @@ -341,8 +341,11 @@ long kvm_vm_ioctl_create_spapr_tce(struct 
>> kvm *kvm,
>>  
>>  mutex_unlock(>lock);
>>  
>> -return anon_inode_getfd("kvm-spapr-tce", _spapr_tce_fops,
>> +ret = anon_inode_getfd("kvm-spapr-tce", _spapr_tce_fops,
>>  stt, O_RDWR | O_CLOEXEC);
>> +if (ret < 0)
>> +goto fail;
>> +return ret;
>>  
>>  fail:
>>  if (stt) {
>>
>
>
> stt has already been added to kvm->arch.spapr_tce_tables, so 
> freeing it is evil IMHO. I don't know that code, so I don't know 
> if there is some other place that will make sure that everything 
> in
> kvm->arch.spapr_tce_tables will properly get freed, even when no 
> kvm->release
> function has been called (kvm_spapr_tce_release).
>

 If it is really not freed, than also kvm_put_kvm(stt->kvm) is missing.

 --

 Thanks,

 David

>>>
>>> if (!stt) return -ENOMEM;
>>> kvm_get_kvm(kvm);
>>> if anon_inode_getfd return -ENOMEM
>>> The user can not determine whether kvm_get_kvm has been called so 
>>> need add kvm_pet_kvm when anon_inode_getfd fail
>>>
>>> stt has already been added to kvm->arch.spapr_tce_tables, but if 
>>> anon_inode_getfd fail, stt is unused val, so call list_del_rcu, and  
>>> free as quickly as possible
>>>
>>> new patch:
>>>
>>> ---
>>>  arch/powerpc/kvm/book3s_64_vio.c | 10 +-
>>>  1 file changed, 9 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/arch/powerpc/kvm/book3s_64_vio.c 
>>> b/arch/powerpc/kvm/book3s_64_vio.c
>>> index a160c14..e2228f1 100644
>>> --- a/arch/powerpc/kvm/book3s_64_vio.c
>>> +++ b/arch/powerpc/kvm/book3s_64_vio.c
>>> @@ -341,8 +341,16 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm 
>>> *kvm,
>>>
>>> mutex_unlock(>lock);
>>>
>>> -   return anon_inode_getfd("kvm-spapr-tce", _spapr_tce_fops,
>>> +   ret = anon_inode_getfd("kvm-spapr-tce", _spapr_tce_fops,
>>> stt, O_RDWR | O_CLOEXEC);
>>> +   if (ret < 0) {
>>> +   mutex_lock(>lock);
>>> +   list_del_rcu(>list);
>
>... don't we have to take care of rcu synchronization before freeing it?
>
>>> +   mutex_unlock(>lock);
>>> +   kvm_put_kvm(kvm);
>>> +   goto fail;
>>> +   }
>>> +   return ret;
>
>of simply
>
>if (!ret)
>   return 0;
>
>mutex_lock(>lock);
>list_del_rcu(>list);
>mutex_unlock(>lock);
>kvm_put_kvm(kvm);
>
>
>> 
>> It seems to me that it would be better to do the anon_inode_getfd() 
>> call before the kvm_get_kvm() call, and go to the fail label if it 
>> fails.
>
>I would have suggested to not add it to the list before it has been 
>fully created (so nobody can have access to it). But I guess than we 
>need another level of protection(e.g. kvm->lock).
>
>Am I missing something, or is kvm_vm_ioctl_create_spapr_tce() racy?
>
>The -EBUSY check is done without any locking, so two parallel creators 
>could create an inconsistency, no? Shouldn't this all be protected by
>kvm->lock?
>
>> 
>> Paul.
>> 
>
>Independent of the fix, I'd suggest the following cleanup.
>
>
>From 979f55083ee965e25827a8743e8a9fdb85231a6f Mon Sep 17 00:00:00 2001
>From: David Hildenbrand 
>Date: Wed, 23 Aug 2017 10:08:58 +0200
>Subject: [PATCH v1 1/1] KVM: PPC: cleanup kvm_vm_ioctl_create_spapr_tce
>
>Let's simplify error handling.
>
>Signed-off-by: David Hildenbrand 
>---
> arch/powerpc/kvm/book3s_64_vio.c | 29 +++--
> 1 file changed, 11 insertions(+), 18 deletions(-)
>
>diff --git a/arch/powerpc/kvm/book3s_64_vio.c
>b/arch/powerpc/kvm/book3s_64_vio.c
>index a160c14304eb..6bac49292296 100644
>--- a/arch/powerpc/kvm/book3s_64_vio.c
>+++ b/arch/powerpc/kvm/book3s_64_vio.c
>@@ -295,8 +295,7 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,  
>{
>   struct kvmppc_spapr_tce_table *stt = NULL;
>   unsigned long npages, size;
>-  int ret = -ENOMEM;
>-  int i;
>+  int i, ret;
>
>   if (!args->size)
>   return -EINVAL;
>@@ -310,16 +309,13 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
>   size = 

Re: [PATCH v2 1/1] Split VGA default device handler out of VGA arbiter

2017-08-23 Thread Dave Airlie
> Yeah, maybe it's time to disconnect the "default display device" idea
> from the VGA arbiter.  I have no idea what (if any) dependencies X has
> on the legacy VGA resources.  I assume X works fine on power, where it
> sounds like those resources are rarely or never available.

The question on non-x86 archs, is what is the correct device to default to.

On x86 we use the legacy VGA resources as a pointer, as this is the device
the BIOS appeared on at boot so hopefully should be one you can see stuff on.

On non-x86 I've no idea how to decide if there are multiple devices, maybe the
firmware needs to tag something for the kernel if there are. Otherwise
you'd just
be picking something in probe order.

I think the idea of these patches is to separate default display
device from the arbiter.

X uses the arbiter on x86 if required (it's horrible, and it's rare we
have to nowadays),
but for finding the default device it justs uses the sysfs boot_vga flag.

Dave.


Re: [PATCH 06/11] ASoC: pxa: make snd_soc_platform_driver const

2017-08-23 Thread Robert Jarzmik
Bhumika Goyal  writes:

> Make these const as they are only passed as the 2nd argument to the
> function devm_snd_soc_register_platform, which is of type const.
> Done using Coccinelle.
>
> Signed-off-by: Bhumika Goyal 
> ---
>  sound/soc/pxa/mmp-pcm.c| 2 +-
>  sound/soc/pxa/pxa2xx-pcm.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

For sound/soc/pxa/pxa2xx-pcm.c :
Acked-by: Robert Jarzmik 

Cheers.

--
Robert


[PATCH] powerpc/powernv/idle: Round up latency and residency values

2017-08-23 Thread Vaidyanathan Srinivasan
On PowerNV platforms, firmware provides exit latency and
target residency for each of the idle states in nano
seconds.  Cpuidle framework expects the values in micro
seconds.  Round up to nearest micro seconds to avoid errors
in cases where the values are defined as fractional micro
seconds.

Default idle state of 'snooze' has exit latency of zero.  If
other states have fractional micro second exit latency, they
would get rounded down to zero micro second and make cpuidle
framework choose deeper idle state when snooze loop is the
right choice.

Reported-by: Anton Blanchard 
Signed-off-by: Vaidyanathan Srinivasan 
---
 drivers/cpuidle/cpuidle-powernv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/cpuidle/cpuidle-powernv.c 
b/drivers/cpuidle/cpuidle-powernv.c
index 42896a67aeae..5f3922392059 100644
--- a/drivers/cpuidle/cpuidle-powernv.c
+++ b/drivers/cpuidle/cpuidle-powernv.c
@@ -383,9 +383,9 @@ static int powernv_add_idle_states(void)
 * Firmware passes residency and latency values in ns.
 * cpuidle expects it in us.
 */
-   exit_latency = latency_ns[i] / 1000;
+   exit_latency = DIV_ROUND_UP(latency_ns[i], 1000);
if (!rc)
-   target_residency = residency_ns[i] / 1000;
+   target_residency = DIV_ROUND_UP(residency_ns[i], 1000);
else
target_residency = 0;
 
-- 
2.13.5



Re: [PATCH] powerpc/pseries: Don't attempt to acquire drc during memory hot add for assigned lmbs

2017-08-23 Thread Nathan Fontenot
On 08/23/2017 12:18 PM, John Allen wrote:
> Check if an LMB is assigned before attempting to call dlpar_acquire_drc in
> order to avoid any unnecessary rtas calls. This substantially reduces the
> running time of memory hot add on lpars with large amounts of memory.
> 
> Signed-off-by: John Allen 
> ---
> diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c 
> b/arch/powerpc/platforms/pseries/hotplug-memory.c
> index ca9b2f4..95cf2ff 100644
> --- a/arch/powerpc/platforms/pseries/hotplug-memory.c
> +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
> @@ -817,6 +817,9 @@ static int dlpar_memory_add_by_count(u32 lmbs_to_add, 
> struct property *prop)
>   return -EINVAL;
> 
>   for (i = 0; i < num_lmbs && lmbs_to_add != lmbs_added; i++) {
> + if (lmbs[i].flags & DRCONF_MEM_ASSIGNED)
> + continue;
> +

Reviewed-by: Nathan Fontenot 

>   rc = dlpar_acquire_drc(lmbs[i].drc_index);
>   if (rc)
>   continue;
> 



[PATCH] powerpc/pseries: Don't attempt to acquire drc during memory hot add for assigned lmbs

2017-08-23 Thread John Allen
Check if an LMB is assigned before attempting to call dlpar_acquire_drc in
order to avoid any unnecessary rtas calls. This substantially reduces the
running time of memory hot add on lpars with large amounts of memory.

Signed-off-by: John Allen 
---
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c 
b/arch/powerpc/platforms/pseries/hotplug-memory.c
index ca9b2f4..95cf2ff 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -817,6 +817,9 @@ static int dlpar_memory_add_by_count(u32 lmbs_to_add, 
struct property *prop)
return -EINVAL;

for (i = 0; i < num_lmbs && lmbs_to_add != lmbs_added; i++) {
+   if (lmbs[i].flags & DRCONF_MEM_ASSIGNED)
+   continue;
+
rc = dlpar_acquire_drc(lmbs[i].drc_index);
if (rc)
continue;



Re: [PATCH V9 2/2] powerpc/nodes: Ensure enough nodes avail for operations

2017-08-23 Thread kbuild test robot
Hi Michael,

[auto build test ERROR on powerpc/next]
[also build test ERROR on v4.13-rc6 next-20170823]
[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/Michael-Bringmann/powerpc-numa-Update-CPU-topology-when-VPHN-enabled/20170823-173526
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-defconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=powerpc 

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All errors (new ones prefixed by >>):

   arch/powerpc/mm/numa.c: In function 'initmem_init':
>> arch/powerpc/mm/numa.c:923:3: error: 'levelval' may be used uninitialized in 
>> this function [-Werror=maybe-uninitialized]
  printk(KERN_INFO "Numa nodes avail: %d (%d) \n", (int) levelval, (int) 
entries);
  
^~~
   arch/powerpc/mm/numa.c:904:21: note: 'levelval' was declared here
  u32 len, entries, levelval, i;
^~~~
   cc1: all warnings being treated as errors

vim +/levelval +923 arch/powerpc/mm/numa.c

   895  
   896  static void __init node_associativity_setup(void)
   897  {
   898  struct device_node *rtas;
   899  printk(KERN_INFO "%s:%d\n", __FUNCTION__, __LINE__);
   900  
   901  rtas = of_find_node_by_path("/rtas");
   902  if (rtas) {
   903  const __be32 *prop;
   904  u32 len, entries, levelval, i;
   905  printk(KERN_INFO "%s:%d\n", __FUNCTION__, __LINE__);
   906  
   907  prop = of_get_property(rtas, 
"ibm,max-associativity-domains", );
   908  if (!prop || len < sizeof(unsigned int)) {
   909  printk(KERN_INFO "%s:%d\n", __FUNCTION__, __LINE__);
   910  goto endit;
   911  }
   912  
   913  entries = of_read_number(prop++, 1);
   914  
   915  if (len < (entries * sizeof(unsigned int))) {
   916  printk(KERN_INFO "%s:%d\n", __FUNCTION__, __LINE__);
   917  goto endit;
   918  }
   919  
   920  for (i = 0; i < entries; i++)
   921  levelval = of_read_number(prop++, 1);
   922  
 > 923  printk(KERN_INFO "Numa nodes avail: %d (%d) \n", (int) 
 > levelval, (int) entries);
   924  
   925  for (i = 0; i < levelval; i++) {
   926  if (!node_possible(i)) {
   927  setup_node_data(i, 0, 0);
   928  node_set(i, node_possible_map);
   929  }
   930  }
   931  }
   932  
   933  endit:
   934  if (rtas)
   935  of_node_put(rtas);
   936  }
   937  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [RFC Part1 PATCH v3 14/17] x86/boot: Add early boot support when running with SEV active

2017-08-23 Thread Borislav Petkov
On Mon, Jul 24, 2017 at 02:07:54PM -0500, Brijesh Singh wrote:
> From: Tom Lendacky 
> 
> Early in the boot process, add checks to determine if the kernel is
> running with Secure Encrypted Virtualization (SEV) active.
> 
> Checking for SEV requires checking that the kernel is running under a
> hypervisor (CPUID 0x0001, bit 31), that the SEV feature is available
> (CPUID 0x801f, bit 1) and then check a non-interceptable SEV MSR
> (0xc0010131, bit 0).
> 
> This check is required so that during early compressed kernel booting the
> pagetables (both the boot pagetables and KASLR pagetables (if enabled) are
> updated to include the encryption mask so that when the kernel is
> decompressed into encrypted memory.

, it can boot properly.

:)

> After the kernel is decompressed and continues booting the same logic is
> used to check if SEV is active and set a flag indicating so.  This allows
> us to distinguish between SME and SEV, each of which have unique
> differences in how certain things are handled: e.g. DMA (always bounce
> buffered with SEV) or EFI tables (always access decrypted with SME).
> 
> Signed-off-by: Tom Lendacky 
> Signed-off-by: Brijesh Singh 
> ---
>  arch/x86/boot/compressed/Makefile  |   2 +
>  arch/x86/boot/compressed/head_64.S |  16 +
>  arch/x86/boot/compressed/mem_encrypt.S | 103 
> +
>  arch/x86/boot/compressed/misc.h|   2 +
>  arch/x86/boot/compressed/pagetable.c   |   8 ++-
>  arch/x86/include/asm/mem_encrypt.h |   3 +
>  arch/x86/include/asm/msr-index.h   |   3 +
>  arch/x86/include/uapi/asm/kvm_para.h   |   1 -
>  arch/x86/mm/mem_encrypt.c  |  42 +++---
>  9 files changed, 169 insertions(+), 11 deletions(-)
>  create mode 100644 arch/x86/boot/compressed/mem_encrypt.S
> 
> diff --git a/arch/x86/boot/compressed/Makefile 
> b/arch/x86/boot/compressed/Makefile
> index 2c860ad..d2fe901 100644
> --- a/arch/x86/boot/compressed/Makefile
> +++ b/arch/x86/boot/compressed/Makefile
> @@ -72,6 +72,8 @@ vmlinux-objs-y := $(obj)/vmlinux.lds $(obj)/head_$(BITS).o 
> $(obj)/misc.o \
>   $(obj)/string.o $(obj)/cmdline.o $(obj)/error.o \
>   $(obj)/piggy.o $(obj)/cpuflags.o
>  
> +vmlinux-objs-$(CONFIG_X86_64) += $(obj)/mem_encrypt.o

There's a

ifdef CONFIG_X86_64

a couple of lines below. Just put it there.

...

> +++ b/arch/x86/boot/compressed/mem_encrypt.S
> @@ -0,0 +1,103 @@
> +/*
> + * AMD Memory Encryption Support
> + *
> + * Copyright (C) 2017 Advanced Micro Devices, Inc.
> + *
> + * Author: Tom Lendacky 
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +
> + .text
> + .code32
> +ENTRY(get_sev_encryption_bit)
> + xor %eax, %eax
> +
> +#ifdef CONFIG_AMD_MEM_ENCRYPT
> + push%ebx
> + push%ecx
> + push%edx
> +
> + /* Check if running under a hypervisor */
> + movl$1, %eax
> + cpuid
> + bt  $31, %ecx   /* Check the hypervisor bit */
> + jnc .Lno_sev
> +
> + movl$0x8000, %eax   /* CPUID to check the highest leaf */
> + cpuid
> + cmpl$0x801f, %eax   /* See if 0x801f is available */
> + jb  .Lno_sev
> +
> + /*
> +  * Check for the SEV feature:
> +  *   CPUID Fn8000_001F[EAX] - Bit 1
> +  *   CPUID Fn8000_001F[EBX] - Bits 5:0
> +  * Pagetable bit position used to indicate encryption
> +  */
> + movl$0x801f, %eax
> + cpuid
> + bt  $1, %eax/* Check if SEV is available */
> + jnc .Lno_sev
> +
> + movl$MSR_F17H_SEV, %ecx /* Read the SEV MSR */
> + rdmsr
> + bt  $MSR_F17H_SEV_ENABLED_BIT, %eax /* Check if SEV is active */
> + jnc .Lno_sev
> +
> + /*
> +  * Get memory encryption information:
> +  */

The side-comment is enough. This one above can go.

> + movl%ebx, %eax
> + andl$0x3f, %eax /* Return the encryption bit location */
> + jmp .Lsev_exit
> +
> +.Lno_sev:
> + xor %eax, %eax
> +
> +.Lsev_exit:
> + pop %edx
> + pop %ecx
> + pop %ebx
> +
> +#endif   /* CONFIG_AMD_MEM_ENCRYPT */
> +
> + ret
> +ENDPROC(get_sev_encryption_bit)
> +
> + .code64
> +ENTRY(get_sev_encryption_mask)
> + xor %rax, %rax
> +
> +#ifdef CONFIG_AMD_MEM_ENCRYPT
> + push%rbp
> + push%rdx
> +
> + movq%rsp, %rbp  /* Save current stack pointer */
> +
> + callget_sev_encryption_bit  /* Get the encryption bit position */

So we get to call get_sev_encryption_bit() here again and noodle through
the CPUID discovery and 

[PATCH] cxl: Add support for POWER9 DD2

2017-08-23 Thread Christophe Lombard
The PSL initialization sequence has been updated to DD2.
This patch adapts to the changes, retaining compatibility with DD1.

Tests performed on some of the new hardware.

Signed-off-by: Christophe Lombard 
---
 drivers/misc/cxl/cxl.h |  2 ++
 drivers/misc/cxl/pci.c | 57 +++---
 2 files changed, 38 insertions(+), 21 deletions(-)

diff --git a/drivers/misc/cxl/cxl.h b/drivers/misc/cxl/cxl.h
index b1afecc..0167df8 100644
--- a/drivers/misc/cxl/cxl.h
+++ b/drivers/misc/cxl/cxl.h
@@ -100,6 +100,8 @@ static const cxl_p1_reg_t CXL_XSL_FEC   = {0x0158};
 static const cxl_p1_reg_t CXL_XSL_DSNCTL= {0x0168};
 /* PSL registers - CAIA 2 */
 static const cxl_p1_reg_t CXL_PSL9_CONTROL  = {0x0020};
+static const cxl_p1_reg_t CXL_XSL9_INV  = {0x0110};
+static const cxl_p1_reg_t CXL_XSL9_DEF  = {0x0140};
 static const cxl_p1_reg_t CXL_XSL9_DSNCTL   = {0x0168};
 static const cxl_p1_reg_t CXL_PSL9_FIR1 = {0x0300};
 static const cxl_p1_reg_t CXL_PSL9_FIR2 = {0x0308};
diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c
index d18b3d9..a981c65 100644
--- a/drivers/misc/cxl/pci.c
+++ b/drivers/misc/cxl/pci.c
@@ -475,37 +475,52 @@ static int init_implementation_adapter_regs_psl9(struct 
cxl *adapter,
psl_fircntl |= 0x1ULL; /* ce_thresh */
cxl_p1_write(adapter, CXL_PSL9_FIR_CNTL, psl_fircntl);
 
-   /* vccredits=0x1  pcklat=0x4 */
-   cxl_p1_write(adapter, CXL_PSL9_DSNDCTL, 0x1810ULL);
-
-   /*
-* For debugging with trace arrays.
-* Configure RX trace 0 segmented mode.
-* Configure CT trace 0 segmented mode.
-* Configure LA0 trace 0 segmented mode.
-* Configure LA1 trace 0 segmented mode.
+   /* Setup the PSL to transmit packets on the PCIe before the
+* CAPP is enabled
 */
-   cxl_p1_write(adapter, CXL_PSL9_TRACECFG, 0x804080008000ULL);
-   cxl_p1_write(adapter, CXL_PSL9_TRACECFG, 0x804080008003ULL);
-   cxl_p1_write(adapter, CXL_PSL9_TRACECFG, 0x804080008005ULL);
-   cxl_p1_write(adapter, CXL_PSL9_TRACECFG, 0x804080008006ULL);
+   cxl_p1_write(adapter, CXL_PSL9_DSNDCTL, 0x000100102A10ULL);
+
+   /* For debugging with trace arrays */
+   /* Configure RX trace 0 segmented mode */
+   cxl_p1_write(adapter, CXL_PSL9_TRACECFG, 0x8200ULL);
+   /* Configure RX trace 1 segmented mode */
+   cxl_p1_write(adapter, CXL_PSL9_TRACECFG, 0xAA01ULL);
+   /* Configure CT trace 0 segmented mode */
+   cxl_p1_write(adapter, CXL_PSL9_TRACECFG, 0xA2B80003ULL);
+   /* Configure LA0 trace 0 segmented mode */
+   cxl_p1_write(adapter, CXL_PSL9_TRACECFG, 0x83FFC005ULL);
+   /* Configure JM0 trace 0 segmented mode */
+   cxl_p1_write(adapter, CXL_PSL9_TRACECFG, 0x8207ULL);
+   /* Configure DMA trace 0 segmented mode */
+   cxl_p1_write(adapter, CXL_PSL9_TRACECFG, 0x8208ULL);
+   /* Configure DMA trace 1 segmented mode */
+   cxl_p1_write(adapter, CXL_PSL9_TRACECFG, 0x8209ULL);
 
/*
 * A response to an ASB_Notify request is returned by the
 * system as an MMIO write to the address defined in
 * the PSL_TNR_ADDR register
 */
-   /* PSL_TNR_ADDR */
+   /* keep the Reset Value: 0x0002E000 */
+
+   /* Enable XSL rty limit */
+   cxl_p1_write(adapter, CXL_XSL9_DEF, 0x51F80005ULL);
 
-   /* NORST */
-   cxl_p1_write(adapter, CXL_PSL9_DEBUG, 0x8000ULL);
+   /* Change XSL_INV dummy readtheshold */
+   cxl_p1_write(adapter, CXL_XSL9_INV, 0x040007FFC200ULL);
 
-   /* allocate the apc machines */
-   cxl_p1_write(adapter, CXL_PSL9_APCDEDTYPE, 0x4003ULL);
+   if (phb_index == 3) {
+   /* disable machines 31-47 and 20-27 for DMA */
+   cxl_p1_write(adapter, CXL_PSL9_APCDEDTYPE, 
0x4FF3ULL);
+   }
+
+   /* Snoop machines */
+   cxl_p1_write(adapter, CXL_PSL9_APCDEDALLOC, 0x800F0002ULL);
 
-   /* Disable vc dd1 fix */
-   if (cxl_is_power9_dd1())
-   cxl_p1_write(adapter, CXL_PSL9_GP_CT, 0x0401ULL);
+   if (cxl_is_power9_dd1()) {
+   /* Disabling deadlock counter CAR */
+   cxl_p1_write(adapter, CXL_PSL9_GP_CT, 0x0021ULL);
+   }
 
return 0;
 }
-- 
2.7.4



[PATCH 4/4] powerpc/32: remove a NOP from memset()

2017-08-23 Thread Christophe Leroy
memset() is patched after initialisation to activate the
optimised part which uses cache instructions.

Today we have a 'b 2f' to skip the optimised patch, which then gets
replaced by a NOP, implying a useless cycle consumption.
As we have a 'bne 2f' just before, we could use that instruction
for the live patching, hence removing the need to have a
dedicated 'b 2f' to be replaced by a NOP.

This patch changes the 'bne 2f' by a 'b 2f'. During init, that
'b 2f' is then replaced by 'bne 2f'

Signed-off-by: Christophe Leroy 
---
 arch/powerpc/kernel/setup_32.c | 7 ++-
 arch/powerpc/lib/copy_32.S | 7 +--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 2f88f6cf1a42..51ebc01fff52 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -98,6 +98,9 @@ extern unsigned int memset_nocache_branch; /* Insn to be 
replaced by NOP */
 
 notrace void __init machine_init(u64 dt_ptr)
 {
+   unsigned int *addr = _nocache_branch;
+   unsigned long insn;
+
/* Configure static keys first, now that we're relocated. */
setup_feature_keys();
 
@@ -105,7 +108,9 @@ notrace void __init machine_init(u64 dt_ptr)
udbg_early_init();
 
patch_instruction((unsigned int *), PPC_INST_NOP);
-   patch_instruction(_nocache_branch, PPC_INST_NOP);
+
+   insn = create_cond_branch(addr, branch_target(addr), 0x82);
+   patch_instruction(addr, insn);  /* replace b by bne cr0 */
 
/* Do some early initialization based on the flat device tree */
early_init_devtree(__va(dt_ptr));
diff --git a/arch/powerpc/lib/copy_32.S b/arch/powerpc/lib/copy_32.S
index 05aaee20590f..da425bb6b369 100644
--- a/arch/powerpc/lib/copy_32.S
+++ b/arch/powerpc/lib/copy_32.S
@@ -103,9 +103,12 @@ _GLOBAL(memset)
add r5,r0,r5
subfr6,r0,r3
cmplwi  0,r4,0
-   bne 2f  /* Use normal procedure if r4 is not zero */
+   /*
+* Skip optimised bloc until cache is enabled. Will be replaced
+* by 'bne' during boot to use normal procedure if r4 is not zero
+*/
 _GLOBAL(memset_nocache_branch)
-   b   2f  /* Skip optimised bloc until cache is enabled */
+   b   2f
 
clrlwi  r7,r6,32-LG_CACHELINE_BYTES
add r8,r7,r5
-- 
2.13.3



[PATCH 3/4] powerpc/32: optimise memset()

2017-08-23 Thread Christophe Leroy
There is no need to extend the set value to an int when the length
is lower than 4 as in that case we only do byte stores.
We can therefore immediately branch to the part handling it.
By separating it from the normal case, we are able to eliminate
a few actions on the destination pointer.

Signed-off-by: Christophe Leroy 
---
 arch/powerpc/lib/copy_32.S | 21 ++---
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/lib/copy_32.S b/arch/powerpc/lib/copy_32.S
index a3ffeac69eca..05aaee20590f 100644
--- a/arch/powerpc/lib/copy_32.S
+++ b/arch/powerpc/lib/copy_32.S
@@ -91,17 +91,17 @@ EXPORT_SYMBOL(memset16)
  * replaced by a nop once cache is active. This is done in machine_init()
  */
 _GLOBAL(memset)
+   cmplwi  0,r5,4
+   blt 7f
+
rlwimi  r4,r4,8,16,23
rlwimi  r4,r4,16,0,15
 
-   addir6,r3,-4
-   cmplwi  0,r5,4
-   blt 7f
-   stwur4,4(r6)
+   stw r4,0(r3)
beqlr
-   andi.   r0,r6,3
+   andi.   r0,r3,3
add r5,r0,r5
-   subfr6,r0,r6
+   subfr6,r0,r3
cmplwi  0,r4,0
bne 2f  /* Use normal procedure if r4 is not zero */
 _GLOBAL(memset_nocache_branch)
@@ -132,13 +132,20 @@ _GLOBAL(memset_nocache_branch)
 1: stwur4,4(r6)
bdnz1b
 6: andi.   r5,r5,3
-7: cmpwi   0,r5,0
beqlr
mtctr   r5
addir6,r6,3
 8: stbur4,1(r6)
bdnz8b
blr
+
+7: cmpwi   0,r5,0
+   beqlr
+   mtctr   r5
+   addir6,r3,-1
+9: stbur4,1(r6)
+   bdnz9b
+   blr
 EXPORT_SYMBOL(memset)
 
 /*
-- 
2.13.3



[PATCH 2/4] powerpc: fix location of two EXPORT_SYMBOL

2017-08-23 Thread Christophe Leroy
Commit 9445aa1a3062a ("ppc: move exports to definitions")
added EXPORT_SYMBOL() for memset() and flush_hash_pages() in
the middle of the functions.

This patch moves them at the end of the two functions.

Signed-off-by: Christophe Leroy 
---
 arch/powerpc/lib/copy_32.S| 2 +-
 arch/powerpc/mm/hash_low_32.S | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/lib/copy_32.S b/arch/powerpc/lib/copy_32.S
index a14d4df2ebc9..a3ffeac69eca 100644
--- a/arch/powerpc/lib/copy_32.S
+++ b/arch/powerpc/lib/copy_32.S
@@ -104,7 +104,6 @@ _GLOBAL(memset)
subfr6,r0,r6
cmplwi  0,r4,0
bne 2f  /* Use normal procedure if r4 is not zero */
-EXPORT_SYMBOL(memset)
 _GLOBAL(memset_nocache_branch)
b   2f  /* Skip optimised bloc until cache is enabled */
 
@@ -140,6 +139,7 @@ _GLOBAL(memset_nocache_branch)
 8: stbur4,1(r6)
bdnz8b
blr
+EXPORT_SYMBOL(memset)
 
 /*
  * This version uses dcbz on the complete cache lines in the
diff --git a/arch/powerpc/mm/hash_low_32.S b/arch/powerpc/mm/hash_low_32.S
index 6f962e5cb5e1..ffbd7c0bda96 100644
--- a/arch/powerpc/mm/hash_low_32.S
+++ b/arch/powerpc/mm/hash_low_32.S
@@ -575,7 +575,6 @@ _GLOBAL(flush_hash_pages)
rlwinm  r8,r8,0,31,29   /* clear HASHPTE bit */
stwcx.  r8,0,r5 /* update the pte */
bne-33b
-EXPORT_SYMBOL(flush_hash_pages)
 
/* Get the address of the primary PTE group in the hash table (r3) */
 _GLOBAL(flush_hash_patch_A)
@@ -634,6 +633,7 @@ _GLOBAL(flush_hash_patch_B)
SYNC_601
isync
blr
+EXPORT_SYMBOL(flush_hash_pages)
 
 /*
  * Flush an entry from the TLB
-- 
2.13.3



[PATCH 1/4] powerpc/32: add memset16()

2017-08-23 Thread Christophe Leroy
Commit 694fc88ce271f ("powerpc/string: Implement optimized
memset variants") added memset16(), memset32() and memset64()
for the 64 bits PPC.

On 32 bits, memset64() is not relevant, and as shown below,
the generic version of memset32() gives a good code, so only
memset16() is candidate for an optimised version.

09c0 :
 9c0:   2c 05 00 00 cmpwi   r5,0
 9c4:   39 23 ff fc addir9,r3,-4
 9c8:   4d 82 00 20 beqlr
 9cc:   7c a9 03 a6 mtctr   r5
 9d0:   94 89 00 04 stwur4,4(r9)
 9d4:   42 00 ff fc bdnz9d0 
 9d8:   4e 80 00 20 blr

The last part of memset() handling the not 4-bytes multiples
operates on bytes, making it unsuitable for handling word without
modification. As it would increase memset() complexity, it is
better to implement memset16() from scratch. In addition it
has the advantage of allowing a more optimised memset16() than what
we would have by using the memset() function.

Signed-off-by: Christophe Leroy 
---
 arch/powerpc/include/asm/string.h |  4 +++-
 arch/powerpc/lib/copy_32.S| 14 ++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/string.h 
b/arch/powerpc/include/asm/string.h
index b0e82466d4e8..b9f54bb34db6 100644
--- a/arch/powerpc/include/asm/string.h
+++ b/arch/powerpc/include/asm/string.h
@@ -10,6 +10,7 @@
 #define __HAVE_ARCH_MEMMOVE
 #define __HAVE_ARCH_MEMCMP
 #define __HAVE_ARCH_MEMCHR
+#define __HAVE_ARCH_MEMSET16
 
 extern char * strcpy(char *,const char *);
 extern char * strncpy(char *,const char *, __kernel_size_t);
@@ -24,7 +25,6 @@ extern int memcmp(const void *,const void *,__kernel_size_t);
 extern void * memchr(const void *,int,__kernel_size_t);
 
 #ifdef CONFIG_PPC64
-#define __HAVE_ARCH_MEMSET16
 #define __HAVE_ARCH_MEMSET32
 #define __HAVE_ARCH_MEMSET64
 
@@ -46,6 +46,8 @@ static inline void *memset64(uint64_t *p, uint64_t v, 
__kernel_size_t n)
 {
return __memset64(p, v, n * 8);
 }
+#else
+extern void *memset16(uint16_t *, uint16_t, __kernel_size_t);
 #endif
 #endif /* __KERNEL__ */
 
diff --git a/arch/powerpc/lib/copy_32.S b/arch/powerpc/lib/copy_32.S
index 8aedbb5f4b86..a14d4df2ebc9 100644
--- a/arch/powerpc/lib/copy_32.S
+++ b/arch/powerpc/lib/copy_32.S
@@ -67,6 +67,20 @@ CACHELINE_BYTES = L1_CACHE_BYTES
 LG_CACHELINE_BYTES = L1_CACHE_SHIFT
 CACHELINE_MASK = (L1_CACHE_BYTES-1)
 
+_GLOBAL(memset16)
+   rlwinm. r0 ,r5, 31, 1, 31
+   addir6, r3, -4
+   beq-2f
+   rlwimi  r4 ,r4 ,16 ,0 ,15
+   mtctr   r0
+1: stwur4, 4(r6)
+   bdnz1b
+2: andi.   r0, r5, 1
+   beqlr
+   sth r4, 4(r6)
+   blr
+EXPORT_SYMBOL(memset16)
+
 /*
  * Use dcbz on the complete cache lines in the destination
  * to set them to zero.  This requires that the destination
-- 
2.13.3



[PATCH 0/4] powerpc/32: memset() optimisations

2017-08-23 Thread Christophe Leroy
This serie provide small optimisation of memset() for PPC32.

Christophe Leroy (4):
  powerpc/32: add memset16()
  powerpc: fix location of two EXPORT_SYMBOL
  powerpc/32: optimise memset()
  powerpc/32: remove a NOP from memset()

 arch/powerpc/include/asm/string.h |  4 +++-
 arch/powerpc/kernel/setup_32.c|  7 ++-
 arch/powerpc/lib/copy_32.S| 44 ++-
 arch/powerpc/mm/hash_low_32.S |  2 +-
 4 files changed, 44 insertions(+), 13 deletions(-)

-- 
2.13.3



Re: [PATCH V9 2/2] powerpc/nodes: Ensure enough nodes avail for operations

2017-08-23 Thread Nathan Fontenot
On 08/21/2017 04:44 PM, Michael Bringmann wrote:
> To: linuxppc-dev@lists.ozlabs.org
> 
> From: Michael Bringmann 
> 
> To: linux-ker...@vger.kernel.org
> Cc: Michael Ellerman 
> Cc: Michael Bringmann 
> Cc: John Allen 
> Cc: Nathan Fontenot 
> Subject: [PATCH V9 2/2] powerpc/nodes: Ensure enough nodes avail for 
> operations
> 
> powerpc/nodes: On systems like PowerPC which allow 'hot-add' of CPU
> or memory resources, it may occur that the new resources are to be
> inserted into nodes that were not used for these resources at bootup.
> In the kernel, any node that is used must be defined and initialized
> at boot.
> 
> This patch extracts the value of the lowest domain level (number of
> allocable resources) from the "rtas" device tree property
> "ibm,max-associativity-domains" to use as the maximum number of nodes
> to setup as possibly available in the system.  This new setting will
> override the instruction,
> 
> nodes_and(node_possible_map, node_possible_map, node_online_map);
> 
> presently seen in the function arch/powerpc/mm/numa.c:initmem_init().
> 
> If the property is not present at boot, no operation will be performed
> to define or enable additional nodes.
> 
> Signed-off-by: Michael Bringmann 
> ---
>  arch/powerpc/mm/numa.c |   44 
>  1 file changed, 44 insertions(+)
> 
> diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
> index 3fd4536..3ae6510 100644
> --- a/arch/powerpc/mm/numa.c
> +++ b/arch/powerpc/mm/numa.c
> @@ -893,6 +893,48 @@ static void __init setup_node_data(int nid, u64 
> start_pfn, u64 end_pfn)
>   NODE_DATA(nid)->node_spanned_pages = spanned_pages;
>  }
> 
> +static void __init node_associativity_setup(void)
> +{
> + struct device_node *rtas;
> + printk(KERN_INFO "%s:%d\n", __FUNCTION__, __LINE__);

Is there a reson we need to have all these KERN_INFO printk's?

This looks like debug statements that accidentally were left in.

> +
> + rtas = of_find_node_by_path("/rtas");
> + if (rtas) {
> + const __be32 *prop;
> + u32 len, entries, levelval, i;
> + printk(KERN_INFO "%s:%d\n", __FUNCTION__, __LINE__);
> +
> + prop = of_get_property(rtas, "ibm,max-associativity-domains", 
> );

You could put the of_node_put() call here after getting the property and get
rid of all the goto's.

> + if (!prop || len < sizeof(unsigned int)) {
> + printk(KERN_INFO "%s:%d\n", __FUNCTION__, __LINE__);
> + goto endit;
> + }
> +
> + entries = of_read_number(prop++, 1);
> +
> + if (len < (entries * sizeof(unsigned int))) {
> + printk(KERN_INFO "%s:%d\n", __FUNCTION__, __LINE__);
> + goto endit;
> + }
> +
> + for (i = 0; i < entries; i++)
> + levelval = of_read_number(prop++, 1);

Couldn't you just read the last enbtry instead of doing a loop reading each
entry until you get to the last one?

-Nathan

> +
> + printk(KERN_INFO "Numa nodes avail: %d (%d) \n", (int) 
> levelval, (int) entries);
> +
> + for (i = 0; i < levelval; i++) {
> + if (!node_possible(i)) {
> + setup_node_data(i, 0, 0);
> + node_set(i, node_possible_map);
> + }
> + }
> + }
> +
> +endit:
> + if (rtas)
> + of_node_put(rtas)> +}
> +
>  void __init initmem_init(void)
>  {
>   int nid, cpu;
> @@ -912,6 +954,8 @@ void __init initmem_init(void)
>*/
>   nodes_and(node_possible_map, node_possible_map, node_online_map);
> 
> + node_associativity_setup();
> +
>   for_each_online_node(nid) {
>   unsigned long start_pfn, end_pfn;
> 



Re: [PATCH V9 1/2] powerpc/numa: Update CPU topology when VPHN enabled

2017-08-23 Thread Nathan Fontenot
On 08/23/2017 06:41 AM, Michael Ellerman wrote:
> Michael Bringmann  writes:
> 
>> powerpc/numa: Correct the currently broken capability to set the
>> topology for shared CPUs in LPARs.  At boot time for shared CPU
>> lpars, the topology for each shared CPU is set to node zero, however,
>> this is now updated correctly using the Virtual Processor Home Node
>> (VPHN) capabilities information provided by the pHyp.
>>
>> Also, update initialization checks for device-tree attributes to
>> independently recognize PRRN or VPHN usage.
> 
> Did you ever do anything to address Nathan's comments on v4 ?
> 
>   http://patchwork.ozlabs.org/patch/767587/

Looking at this patch I do not see that VPHN is always enabled.

> 
> 
> Also your change log doesn't describe anything about what the patch does
> and why it is the correct fix for the problem.
> 
> When a DLPAR happens you modify the VPHN timer to run in 1 nsec, but you
> don't wait for it. Why would we not just run the logic synchronously?
> 
> It also seems to make VPHN and PRRN no longer exclusive, which looking
> at PAPR seems like it might be correct, but is also a major change so
> please justify it in detail.

This is correct, they are not exclusive. When we first added PRRN support
we mistakenly thought they were exclusive which is why the code currently
only starts PRRN, or VPHN if PRRN is not present.

> 
> Comments below.
> 
> 
>> diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
>> index b95c584..3fd4536 100644
>> --- a/arch/powerpc/mm/numa.c
>> +++ b/arch/powerpc/mm/numa.c
>> @@ -906,7 +907,7 @@ void __init initmem_init(void)
>>  
>>  /*
>>   * Reduce the possible NUMA nodes to the online NUMA nodes,
>> - * since we do not support node hotplug. This ensures that  we
>> + * since we do not support node hotplug. This ensures that we
> 
> Please do whitespace/spelling changes in a separate patch.
> 
>>   * lower the maximum NUMA node ID to what is actually present.
>>   */
>>  nodes_and(node_possible_map, node_possible_map, node_online_map);
>> @@ -1148,11 +1149,32 @@ struct topology_update_data {
>>  int new_nid;
>>  };
>>  
>> +#define TOPOLOGY_DEF_TIMER_SECS 60
>> +
>>  static u8 vphn_cpu_change_counts[NR_CPUS][MAX_DISTANCE_REF_POINTS];
>>  static cpumask_t cpu_associativity_changes_mask;
>>  static int vphn_enabled;
>>  static int prrn_enabled;
>>  static void reset_topology_timer(void);
>> +static int topology_timer_secs = TOPOLOGY_DEF_TIMER_SECS;
>> +static int topology_inited;
>> +static int topology_update_needed;
> 
> None of this code should be in numa.c. Which is not your fault but I'm
> inclined to move it before we make it worse.

Agreed. Perhaps this should all be in mm/vphn.c

-Nathan

> 
>> +
>> +/*
>> + * Change polling interval for associativity changes.
>> + */
>> +int timed_topology_update(int nsecs)
>> +{
>> +if (nsecs > 0)
>> +topology_timer_secs = nsecs;
>> +else
>> +topology_timer_secs = TOPOLOGY_DEF_TIMER_SECS;
>> +
>> +if (vphn_enabled)
>> +reset_topology_timer();
>> +
>> +return 0;
>> +}
>>  
>>  /*
>>   * Store the current values of the associativity change counters in the
>> @@ -1246,6 +1268,12 @@ static long vphn_get_associativity(unsigned long cpu,
>>  "hcall_vphn() experienced a hardware fault "
>>  "preventing VPHN. Disabling polling...\n");
>>  stop_topology_update();
>> +break;
>> +case H_SUCCESS:
>> +printk(KERN_INFO
>> +"VPHN hcall succeeded. Reset polling...\n");
> 
> We don't need that to hit everyone's console once a minute. Remove it or
> pr_debug() if you like.
> 
>> @@ -1363,6 +1394,8 @@ int numa_update_cpu_topology(bool cpus_locked)
>>  cpumask_andnot(_associativity_changes_mask,
>>  _associativity_changes_mask,
>>  cpu_sibling_mask(cpu));
>> +pr_info("Assoc chg gives same node %d for cpu%d\n",
>> +new_nid, cpu);
> 
> No thanks.
> 
>> @@ -1379,6 +1412,9 @@ int numa_update_cpu_topology(bool cpus_locked)
>>  cpu = cpu_last_thread_sibling(cpu);
>>  }
>>  
>> +if (i)
>> +updates[i-1].next = NULL;
> 
> ???
> 
>> @@ -1453,6 +1490,14 @@ static void topology_schedule_update(void)
>>  schedule_work(_work);
>>  }
>>  
>> +void shared_topology_update(void)
>> +{
>> +if (firmware_has_feature(FW_FEATURE_VPHN) &&
>> +   lppaca_shared_proc(get_lppaca()))
>> +topology_schedule_update();
>> +}
>> +EXPORT_SYMBOL(shared_topology_update);
> 
> There's no reason for that to be exported AFAICS.
> 
>> diff --git a/arch/powerpc/platforms/pseries/dlpar.c 
>> b/arch/powerpc/platforms/pseries/dlpar.c
>> index 3918769..ba9a4a0 100644
>> --- a/arch/powerpc/platforms/pseries/dlpar.c
>> +++ 

Re: [PATCH] tpm: vtpm: constify vio_device_id

2017-08-23 Thread Michael Ellerman
Jarkko Sakkinen  writes:

> On Fri, Aug 18, 2017 at 02:31:56PM -0600, Jason Gunthorpe wrote:
>> On Fri, Aug 18, 2017 at 09:32:46PM +1000, Michael Ellerman wrote:
>> 
>> > >>  drivers/char/tpm/tpm_ibmvtpm.c | 2 +-
>> > 
>> > Who merges changes for this driver? I assume it's Jarkko?
>> 
>> Yes
>> 
>> Jason
>
> Applied.

Thanks.

cheers


Re: [PATCH v2 1/1] Split VGA default device handler out of VGA arbiter

2017-08-23 Thread Bjorn Helgaas
On Wed, Aug 23, 2017 at 02:48:42PM +0100, Ard Biesheuvel wrote:
> On 22 August 2017 at 23:19, Bjorn Helgaas  wrote:
> > On Mon, Aug 21, 2017 at 11:53:01AM +0100, Lorenzo Pieralisi wrote:
> >> On Thu, Aug 17, 2017 at 09:30:28PM +1000, Daniel Axtens wrote:
> >> > A system without PCI legacy resources (e.g. ARM64) may find that no
> >> > default/boot VGA device has been marked, because the VGA arbiter
> >> > checks for legacy resource decoding before marking a card as default.
> >>
> >> I do not understand this paragraph, in particular:
> >>
> >> - "A system without PCI legacy resources (e.g. ARM64)". What does this
> >>   mean ? I take this as "ARM64 does not support IO space"; if a PCI host
> >>   bridge supports IO space, there is nothing from an architectural
> >>   point of view that prevents an MMIO based IO space implementation to
> >>   work on ARM64. It is PCI bridge specific, not arch specific.
> >
> > This reference to ARM64 is the same thing I stumbled over.  Maybe it
> > could be written along the lines of:
> >
> >   The VGA arbiter selects a default VGA device that is enabled and
> >   reachable via the legacy VGA resources (mem 0xa-0xb, io
> >   0x3b0-0x3bb, io 0x3c0-0x3df, etc).
> >
> >   If there is no such device, e.g., because there's no enabled VGA
> >   device, the host bridge doesn't support access to those legacy
> >   resources, or a PCI-PCI bridge doesn't have VGA Enable set, a
> >   platform may select an arbitrary device by calling
> >   vga_set_default_device().
> >
> > Then I think this patch changes the previous behavior by allowing the
> > arbiter to select a device that is enabled and has a driver but may
> > not be reachable via the legacy VGA resources.
> >
> > I don't know what all the consequences of that would be, but it does
> > muddy the VGA arbiter waters a bit.  AIUI, the main reason for the
> > arbiter is to allow multiple legacy VGA devices by manipulating bridge
> > VGA Enable bits so only one receives the legacy resources at a time.
> >
> > These devices that do not need the legacy resources don't need that
> > special treatment because they don't care about the bridge VGA Enable
> > bits and several can coexist in the system with no need for VGA
> > arbitration.
> >
> > I guess the powerpc fixup_vga() already selects a device that doesn't
> > need the VGA resources, so we already have that situation.
> >
> 
> Perhaps it is unclear that the whole point of tinkering with the VGA
> arbiter is that X may refuse to use a GFX card if it is not tagged as
> the default VGA device by the arbiter. I have suggested before that
> fixing X may be more appropriate in this case, given that ownership of
> the legacy VGA resources may not correlate at all with being the
> primary display device on non-x86 architectures.

Yeah, maybe it's time to disconnect the "default display device" idea
from the VGA arbiter.  I have no idea what (if any) dependencies X has
on the legacy VGA resources.  I assume X works fine on power, where it
sounds like those resources are rarely or never available.


[PATCH 4/5] powerpc/oops: Print CR/XER on same line as MSR

2017-08-23 Thread Michael Ellerman
Somehow we missed this when the pr_cont() changes went in. Fix CR/XER
to go on the same line as MSR, as they have historically, eg:

  MSR: 80009032   CR: 4804408a  XER: 2000

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/kernel/process.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 34bd94b090e2..91f9819cb51b 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1386,7 +1386,7 @@ void show_regs(struct pt_regs * regs)
   regs, regs->trap, print_tainted(), init_utsname()->release);
printk("MSR: "REG" ", regs->msr);
print_msr_bits(regs->msr);
-   printk("  CR: %08lx  XER: %08lx\n", regs->ccr, regs->xer);
+   pr_cont("  CR: %08lx  XER: %08lx\n", regs->ccr, regs->xer);
trap = TRAP(regs);
if ((regs->trap != 0xc00) && cpu_has_feature(CPU_FTR_CFAR))
pr_cont("CFAR: "REG" ", regs->orig_gpr3);
-- 
2.7.4



[PATCH 5/5] powerpc/oops: Line up NIP & MSR with other rows

2017-08-23 Thread Michael Ellerman
This is purely cosmetic, but does look nicer IMHO:

Before:

  task: c1453400 task.stack: c1c6c000
  NIP: c0a0fbfc LR: c0a0fbf4 CTR: c0ba6220
  REGS: c001fffef820 TRAP: 0300   Not tainted  
(4.13.0-rc6-gcc-6.3.1-00234-g423af27f7d81)
  MSR: 80009033   CR: 88088242  XER: 
  CFAR: c00b3488 DAR:  DSISR: 4200 SOFTE: 0

After:
  task: c1453400 task.stack: c1c6c000
  NIP:  c0a0fbfc LR: c0a0fbf4 CTR: c0ba6220
  REGS: c001fffef820 TRAP: 0300   Not tainted  
(4.13.0-rc6-gcc-6.3.1-00234-g423af27f7d81-dirty)
  MSR:  80009033   CR: 88088242  XER: 
  CFAR: c00b34a4 DAR:  DSISR: 4200 SOFTE: 0

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/kernel/process.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 91f9819cb51b..234b1ee7864e 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1380,11 +1380,11 @@ void show_regs(struct pt_regs * regs)
 
show_regs_print_info(KERN_DEFAULT);
 
-   printk("NIP: "REG" LR: "REG" CTR: "REG"\n",
+   printk("NIP:  "REG" LR: "REG" CTR: "REG"\n",
   regs->nip, regs->link, regs->ctr);
printk("REGS: %p TRAP: %04lx   %s  (%s)\n",
   regs, regs->trap, print_tainted(), init_utsname()->release);
-   printk("MSR: "REG" ", regs->msr);
+   printk("MSR:  "REG" ", regs->msr);
print_msr_bits(regs->msr);
pr_cont("  CR: %08lx  XER: %08lx\n", regs->ccr, regs->xer);
trap = TRAP(regs);
-- 
2.7.4



[PATCH 3/5] powerpc/oops: Use IS_ENABLED() for oops markers

2017-08-23 Thread Michael Ellerman
Just because it looks less gross.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/kernel/traps.c | 19 ++-
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 5a54a6f54f70..f77d954f6622 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -208,17 +208,18 @@ static int __die(const char *str, struct pt_regs *regs, 
long err)
else
printk("BE ");
 
-#ifdef CONFIG_PREEMPT
-   pr_cont("PREEMPT ");
-#endif
-#ifdef CONFIG_SMP
-   pr_cont("SMP NR_CPUS=%d ", NR_CPUS);
-#endif
+   if (IS_ENABLED(CONFIG_PREEMPT))
+   pr_cont("PREEMPT ");
+
+   if (IS_ENABLED(CONFIG_SMP))
+   pr_cont("SMP NR_CPUS=%d ", NR_CPUS);
+
if (debug_pagealloc_enabled())
pr_cont("DEBUG_PAGEALLOC ");
-#ifdef CONFIG_NUMA
-   pr_cont("NUMA ");
-#endif
+
+   if (IS_ENABLED(CONFIG_NUMA))
+   pr_cont("NUMA ");
+
pr_cont("%s\n", ppc_md.name ? ppc_md.name : "");
 
if (notify_die(DIE_OOPS, str, regs, err, 255, SIGSEGV) == NOTIFY_STOP)
-- 
2.7.4



[PATCH 2/5] powerpc/oops: Print the kernel's endian in the oops

2017-08-23 Thread Michael Ellerman
Although the MSR tells you what endian you're in it's possible that
isn't the same endian the kernel was built for, and if that happens
you're usually having a very bad day. So print a marker to make
it 100% clear which endian the kernel was built for.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/kernel/traps.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 82d0ce236f9d..5a54a6f54f70 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -202,6 +202,12 @@ NOKPROBE_SYMBOL(oops_end);
 static int __die(const char *str, struct pt_regs *regs, long err)
 {
printk("Oops: %s, sig: %ld [#%d]\n", str, err, ++die_counter);
+
+   if (IS_ENABLED(CONFIG_CPU_LITTLE_ENDIAN))
+   printk("LE ");
+   else
+   printk("BE ");
+
 #ifdef CONFIG_PREEMPT
pr_cont("PREEMPT ");
 #endif
-- 
2.7.4



[PATCH 1/5] powerpc/oops: Fix the oops markers to use pr_cont()

2017-08-23 Thread Michael Ellerman
When we oops we print a few markers for significant config options
such as PREEMPT, SMP etc. Currently these appear on separate lines
because we're not using pr_cont() properly. Fix it.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/kernel/traps.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 675d5d2bfcde..82d0ce236f9d 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -203,17 +203,17 @@ static int __die(const char *str, struct pt_regs *regs, 
long err)
 {
printk("Oops: %s, sig: %ld [#%d]\n", str, err, ++die_counter);
 #ifdef CONFIG_PREEMPT
-   printk("PREEMPT ");
+   pr_cont("PREEMPT ");
 #endif
 #ifdef CONFIG_SMP
-   printk("SMP NR_CPUS=%d ", NR_CPUS);
+   pr_cont("SMP NR_CPUS=%d ", NR_CPUS);
 #endif
if (debug_pagealloc_enabled())
-   printk("DEBUG_PAGEALLOC ");
+   pr_cont("DEBUG_PAGEALLOC ");
 #ifdef CONFIG_NUMA
-   printk("NUMA ");
+   pr_cont("NUMA ");
 #endif
-   printk("%s\n", ppc_md.name ? ppc_md.name : "");
+   pr_cont("%s\n", ppc_md.name ? ppc_md.name : "");
 
if (notify_die(DIE_OOPS, str, regs, err, 255, SIGSEGV) == NOTIFY_STOP)
return 1;
-- 
2.7.4



Re: [PATCH v2 1/1] Split VGA default device handler out of VGA arbiter

2017-08-23 Thread Ard Biesheuvel
On 22 August 2017 at 23:19, Bjorn Helgaas  wrote:
> On Mon, Aug 21, 2017 at 11:53:01AM +0100, Lorenzo Pieralisi wrote:
>> On Thu, Aug 17, 2017 at 09:30:28PM +1000, Daniel Axtens wrote:
>> > A system without PCI legacy resources (e.g. ARM64) may find that no
>> > default/boot VGA device has been marked, because the VGA arbiter
>> > checks for legacy resource decoding before marking a card as default.
>>
>> I do not understand this paragraph, in particular:
>>
>> - "A system without PCI legacy resources (e.g. ARM64)". What does this
>>   mean ? I take this as "ARM64 does not support IO space"; if a PCI host
>>   bridge supports IO space, there is nothing from an architectural
>>   point of view that prevents an MMIO based IO space implementation to
>>   work on ARM64. It is PCI bridge specific, not arch specific.
>
> This reference to ARM64 is the same thing I stumbled over.  Maybe it
> could be written along the lines of:
>
>   The VGA arbiter selects a default VGA device that is enabled and
>   reachable via the legacy VGA resources (mem 0xa-0xb, io
>   0x3b0-0x3bb, io 0x3c0-0x3df, etc).
>
>   If there is no such device, e.g., because there's no enabled VGA
>   device, the host bridge doesn't support access to those legacy
>   resources, or a PCI-PCI bridge doesn't have VGA Enable set, a
>   platform may select an arbitrary device by calling
>   vga_set_default_device().
>
> Then I think this patch changes the previous behavior by allowing the
> arbiter to select a device that is enabled and has a driver but may
> not be reachable via the legacy VGA resources.
>
> I don't know what all the consequences of that would be, but it does
> muddy the VGA arbiter waters a bit.  AIUI, the main reason for the
> arbiter is to allow multiple legacy VGA devices by manipulating bridge
> VGA Enable bits so only one receives the legacy resources at a time.
>
> These devices that do not need the legacy resources don't need that
> special treatment because they don't care about the bridge VGA Enable
> bits and several can coexist in the system with no need for VGA
> arbitration.
>
> I guess the powerpc fixup_vga() already selects a device that doesn't
> need the VGA resources, so we already have that situation.
>

Perhaps it is unclear that the whole point of tinkering with the VGA
arbiter is that X may refuse to use a GFX card if it is not tagged as
the default VGA device by the arbiter. I have suggested before that
fixing X may be more appropriate in this case, given that ownership of
the legacy VGA resources may not correlate at all with being the
primary display device on non-x86 architectures.


Re: [PATCH 1/2] powerpc/workqueue: update list of possible CPUs

2017-08-23 Thread Tejun Heo
Hello, Michael.

On Wed, Aug 23, 2017 at 09:00:39PM +1000, Michael Ellerman wrote:
> > I don't think that's true.  The CPU id used in kernel doesn't have to
> > match the physical one and arch code should be able to pre-map CPU IDs
> > to nodes and use the matching one when hotplugging CPUs.  I'm not
> > saying that's the best way to solve the problem tho.
> 
> We already virtualise the CPU numbers, but not the node IDs. And it's
> the node IDs that are really the problem.

Yeah, it just needs to match up new cpus to the cpu ids assigned to
the right node.

> > It could be that the best way forward is making cpu <-> node mapping
> > dynamic and properly synchronized.
> 
> We don't need it to be dynamic (at least for this bug).

The node mapping for that cpu id changes *dynamically* while the
system is running and that can race with node-affinity sensitive
operations such as memory allocations.

> Laurent is booting Qemu with a fixed CPU <-> Node mapping, it's just
> that because some CPUs aren't present at boot we don't know what the
> node mapping is. (Correct me if I'm wrong Laurent).
> 
> So all we need is:
>  - the workqueue code to cope with CPUs that are possible but not online
>having NUMA_NO_NODE to begin with.
>  - a way to update the workqueue cpumask when the CPU comes online.
> 
> Which seems reasonable to me?

Please take a step back and think through the problem again.  You
can't bandaid it this way.

Thanks.

-- 
tejun


Re: [3/6] powerpc/mm: Ensure cpumask update is ordered

2017-08-23 Thread Michael Ellerman
On Mon, 2017-07-24 at 04:28:00 UTC, Benjamin Herrenschmidt wrote:
> There is no guarantee that the various isync's involved with
> the context switch will order the update of the CPU mask with
> the first TLB entry for the new context being loaded by the HW.
> 
> Be safe here and add a memory barrier to order any subsequent
> load/store which may bring entries into the TLB.
> 
> The corresponding barrier on the other side already exists as
> pte updates use pte_xchg() which uses __cmpxchg_u64 which has
> a sync after the atomic operation.
> 
> Signed-off-by: Benjamin Herrenschmidt 
> Reviewed-by: Nicholas Piggin 

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/1a92a80ad386a1a6e3b36d576d52a1

cheers


Re: [PATCH RFC 0/7] powerpc: Beef up single-stepping/instruction emulation infrastructure

2017-08-23 Thread Michael Ellerman
Michael Neuling  writes:

> Paulus, 
>
>> This patch series extends the code in arch/powerpc/lib/sstep.c so that
>> it handles almost all load and store instructions -- all except the
>> atomic memory operations (lwat, stwat, etc.).  It also makes sure that
>> we use the largest possible aligned accesses to access memory and that
>> we don't access the CPU FP/VMX/VSX registers when they don't contain
>> user data.
>
> Do you have any test cases we can put in selftests for this?

We have lots of plans for them, but no code yet.

cheers


Re: [PATCH V9 1/2] powerpc/numa: Update CPU topology when VPHN enabled

2017-08-23 Thread Michael Ellerman
Michael Bringmann  writes:

> powerpc/numa: Correct the currently broken capability to set the
> topology for shared CPUs in LPARs.  At boot time for shared CPU
> lpars, the topology for each shared CPU is set to node zero, however,
> this is now updated correctly using the Virtual Processor Home Node
> (VPHN) capabilities information provided by the pHyp.
>
> Also, update initialization checks for device-tree attributes to
> independently recognize PRRN or VPHN usage.

Did you ever do anything to address Nathan's comments on v4 ?

  http://patchwork.ozlabs.org/patch/767587/


Also your change log doesn't describe anything about what the patch does
and why it is the correct fix for the problem.

When a DLPAR happens you modify the VPHN timer to run in 1 nsec, but you
don't wait for it. Why would we not just run the logic synchronously?

It also seems to make VPHN and PRRN no longer exclusive, which looking
at PAPR seems like it might be correct, but is also a major change so
please justify it in detail.

Comments below.


> diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
> index b95c584..3fd4536 100644
> --- a/arch/powerpc/mm/numa.c
> +++ b/arch/powerpc/mm/numa.c
> @@ -906,7 +907,7 @@ void __init initmem_init(void)
>  
>   /*
>* Reduce the possible NUMA nodes to the online NUMA nodes,
> -  * since we do not support node hotplug. This ensures that  we
> +  * since we do not support node hotplug. This ensures that we

Please do whitespace/spelling changes in a separate patch.

>* lower the maximum NUMA node ID to what is actually present.
>*/
>   nodes_and(node_possible_map, node_possible_map, node_online_map);
> @@ -1148,11 +1149,32 @@ struct topology_update_data {
>   int new_nid;
>  };
>  
> +#define  TOPOLOGY_DEF_TIMER_SECS 60
> +
>  static u8 vphn_cpu_change_counts[NR_CPUS][MAX_DISTANCE_REF_POINTS];
>  static cpumask_t cpu_associativity_changes_mask;
>  static int vphn_enabled;
>  static int prrn_enabled;
>  static void reset_topology_timer(void);
> +static int topology_timer_secs = TOPOLOGY_DEF_TIMER_SECS;
> +static int topology_inited;
> +static int topology_update_needed;

None of this code should be in numa.c. Which is not your fault but I'm
inclined to move it before we make it worse.

> +
> +/*
> + * Change polling interval for associativity changes.
> + */
> +int timed_topology_update(int nsecs)
> +{
> + if (nsecs > 0)
> + topology_timer_secs = nsecs;
> + else
> + topology_timer_secs = TOPOLOGY_DEF_TIMER_SECS;
> +
> + if (vphn_enabled)
> + reset_topology_timer();
> +
> + return 0;
> +}
>  
>  /*
>   * Store the current values of the associativity change counters in the
> @@ -1246,6 +1268,12 @@ static long vphn_get_associativity(unsigned long cpu,
>   "hcall_vphn() experienced a hardware fault "
>   "preventing VPHN. Disabling polling...\n");
>   stop_topology_update();
> + break;
> + case H_SUCCESS:
> + printk(KERN_INFO
> + "VPHN hcall succeeded. Reset polling...\n");

We don't need that to hit everyone's console once a minute. Remove it or
pr_debug() if you like.

> @@ -1363,6 +1394,8 @@ int numa_update_cpu_topology(bool cpus_locked)
>   cpumask_andnot(_associativity_changes_mask,
>   _associativity_changes_mask,
>   cpu_sibling_mask(cpu));
> + pr_info("Assoc chg gives same node %d for cpu%d\n",
> + new_nid, cpu);

No thanks.

> @@ -1379,6 +1412,9 @@ int numa_update_cpu_topology(bool cpus_locked)
>   cpu = cpu_last_thread_sibling(cpu);
>   }
>  
> + if (i)
> + updates[i-1].next = NULL;

???

> @@ -1453,6 +1490,14 @@ static void topology_schedule_update(void)
>   schedule_work(_work);
>  }
>  
> +void shared_topology_update(void)
> +{
> + if (firmware_has_feature(FW_FEATURE_VPHN) &&
> +lppaca_shared_proc(get_lppaca()))
> + topology_schedule_update();
> +}
> +EXPORT_SYMBOL(shared_topology_update);

There's no reason for that to be exported AFAICS.

> diff --git a/arch/powerpc/platforms/pseries/dlpar.c 
> b/arch/powerpc/platforms/pseries/dlpar.c
> index 3918769..ba9a4a0 100644
> --- a/arch/powerpc/platforms/pseries/dlpar.c
> +++ b/arch/powerpc/platforms/pseries/dlpar.c
> @@ -592,6 +592,8 @@ static ssize_t dlpar_show(struct class *class, struct 
> class_attribute *attr,
>  
>  static int __init pseries_dlpar_init(void)
>  {
> + shared_topology_update();
> +

I don't see any reason to call that from here.

It could just as easily be a machine init call in the file where it lives.


cheers


Re: [PATCH V9 2/2] powerpc/nodes: Ensure enough nodes avail for operations

2017-08-23 Thread Michael Ellerman
Michael Bringmann  writes:

> To: linuxppc-dev@lists.ozlabs.org
>
> From: Michael Bringmann 
>
> To: linux-ker...@vger.kernel.org
> Cc: Michael Ellerman 
> Cc: Michael Bringmann 
> Cc: John Allen 
> Cc: Nathan Fontenot 
> Subject: [PATCH V9 2/2] powerpc/nodes: Ensure enough nodes avail for 
> operations
>
> powerpc/nodes: On systems like PowerPC which allow 'hot-add' of CPU
> or memory resources, it may occur that the new resources are to be
> inserted into nodes that were not used for these resources at bootup.
> In the kernel, any node that is used must be defined and initialized
> at boot.
>
> This patch extracts the value of the lowest domain level (number of
> allocable resources) from the "rtas" device tree property
> "ibm,max-associativity-domains" to use as the maximum number of nodes
> to setup as possibly available in the system.  This new setting will
> override the instruction,

Thanks for implementing my suggestion of using "ibm,max-associativity-domains".

However I don't think it's correct to use the lowest domain level.

It's not very clearly specified in PAPR, but I think you need to treat
it like an associativity property and index into based on the
associativity reference points.

You should be able to use min_common_depth as the index.

cheers


Re: [PATCH 1/2] powerpc/workqueue: update list of possible CPUs

2017-08-23 Thread Laurent Vivier
On 23/08/2017 13:00, Michael Ellerman wrote:
> Hi Tejun,
> 
> Tejun Heo  writes:
>> Hello, Michael.
>>
>> On Tue, Aug 22, 2017 at 11:41:41AM +1000, Michael Ellerman wrote:
 This is something powerpc needs to fix.
>>>
>>> There is no way for us to fix it.
>>
>> I don't think that's true.  The CPU id used in kernel doesn't have to
>> match the physical one and arch code should be able to pre-map CPU IDs
>> to nodes and use the matching one when hotplugging CPUs.  I'm not
>> saying that's the best way to solve the problem tho.
> 
> We already virtualise the CPU numbers, but not the node IDs. And it's
> the node IDs that are really the problem.
> 
> So yeah I guess we might be able to make that work, but I'd have to
> think about it a bit more.
> 
>> It could be that the best way forward is making cpu <-> node mapping
>> dynamic and properly synchronized.
> 
> We don't need it to be dynamic (at least for this bug).
> 
> Laurent is booting Qemu with a fixed CPU <-> Node mapping, it's just
> that because some CPUs aren't present at boot we don't know what the
> node mapping is. (Correct me if I'm wrong Laurent).

You're correct.

Qemu is started with:

-numa node,cpus=0-1 -numa node,cpus=2-3 \
-smp 2,maxcpus=4,cores=4,threads=1,sockets=1

Which means we have 2 nodes with cpu ids 0 and 1 on node 0, and cpu ids
2 and 3 on node 1, but at boot only 2 CPUs are present.

The problem I try to fix with this series is when we hotplug a third
CPU, to node 1 with id 2.

Thanks,
Laurent


Re: [PATCH 1/2] powerpc/workqueue: update list of possible CPUs

2017-08-23 Thread Michael Ellerman
Hi Tejun,

Tejun Heo  writes:
> Hello, Michael.
>
> On Tue, Aug 22, 2017 at 11:41:41AM +1000, Michael Ellerman wrote:
>> > This is something powerpc needs to fix.
>> 
>> There is no way for us to fix it.
>
> I don't think that's true.  The CPU id used in kernel doesn't have to
> match the physical one and arch code should be able to pre-map CPU IDs
> to nodes and use the matching one when hotplugging CPUs.  I'm not
> saying that's the best way to solve the problem tho.

We already virtualise the CPU numbers, but not the node IDs. And it's
the node IDs that are really the problem.

So yeah I guess we might be able to make that work, but I'd have to
think about it a bit more.

> It could be that the best way forward is making cpu <-> node mapping
> dynamic and properly synchronized.

We don't need it to be dynamic (at least for this bug).

Laurent is booting Qemu with a fixed CPU <-> Node mapping, it's just
that because some CPUs aren't present at boot we don't know what the
node mapping is. (Correct me if I'm wrong Laurent).

So all we need is:
 - the workqueue code to cope with CPUs that are possible but not online
   having NUMA_NO_NODE to begin with.
 - a way to update the workqueue cpumask when the CPU comes online.


Which seems reasonable to me?

cheers


[PATCH kernel 1/5] powerpc/pci: Remove unused parameter from add_one_dev_pci_data()

2017-08-23 Thread Alexey Kardashevskiy
pdev is always NULL, remove it.

To make checkpatch.pl happy, this also removes the "out of memory"
message.

Signed-off-by: Alexey Kardashevskiy 
---
 arch/powerpc/kernel/pci_dn.c | 14 ++
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c
index 592693437070..0256372b72de 100644
--- a/arch/powerpc/kernel/pci_dn.c
+++ b/arch/powerpc/kernel/pci_dn.c
@@ -139,7 +139,6 @@ struct pci_dn *pci_get_pdn(struct pci_dev *pdev)
 
 #ifdef CONFIG_PCI_IOV
 static struct pci_dn *add_one_dev_pci_data(struct pci_dn *parent,
-  struct pci_dev *pdev,
   int vf_index,
   int busno, int devfn)
 {
@@ -150,10 +149,8 @@ static struct pci_dn *add_one_dev_pci_data(struct pci_dn 
*parent,
return NULL;
 
pdn = kzalloc(sizeof(*pdn), GFP_KERNEL);
-   if (!pdn) {
-   dev_warn(>dev, "%s: Out of memory!\n", __func__);
+   if (!pdn)
return NULL;
-   }
 
pdn->phb = parent->phb;
pdn->parent = parent;
@@ -167,13 +164,6 @@ static struct pci_dn *add_one_dev_pci_data(struct pci_dn 
*parent,
INIT_LIST_HEAD(>list);
list_add_tail(>list, >child_list);
 
-   /*
-* If we already have PCI device instance, lets
-* bind them.
-*/
-   if (pdev)
-   pdev->dev.archdata.pci_data = pdn;
-
return pdn;
 }
 #endif
@@ -201,7 +191,7 @@ struct pci_dn *add_dev_pci_data(struct pci_dev *pdev)
for (i = 0; i < pci_sriov_get_totalvfs(pdev); i++) {
struct eeh_dev *edev __maybe_unused;
 
-   pdn = add_one_dev_pci_data(parent, NULL, i,
+   pdn = add_one_dev_pci_data(parent, i,
   pci_iov_virtfn_bus(pdev, i),
   pci_iov_virtfn_devfn(pdev, i));
if (!pdn) {
-- 
2.11.0



[PATCH kernel 5/5] powerpc/eeh: Remove unnecessary node from pci_dn

2017-08-23 Thread Alexey Kardashevskiy
The pci_dn struct caches a OF device node pointer in order to access
the "ibm,loc-code" property when EEH is recovering.

However, when this happens in eeh_dev_check_failure(), we also have
a pci_dev pointer which should have a valid pointer to the device node
when pci_dn has one (both pointers are not NULL for physical functions
and are NULL for virtual functions).

This removes the node pointer from the pci_dn struct and used pdev
in eeh_dev_check_failure() instead.

This changes pci_remove_device_node_info() to look for a parent of
the node being removed, just like pci_add_device_node_info() does when it
references the parent node.

Signed-off-by: Alexey Kardashevskiy 
---
 arch/powerpc/include/asm/pci-bridge.h | 1 -
 arch/powerpc/kernel/eeh.c | 9 +
 arch/powerpc/kernel/pci_dn.c  | 8 +---
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/include/asm/pci-bridge.h 
b/arch/powerpc/include/asm/pci-bridge.h
index 56c67d3f0108..0b8aa1fe2d5f 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -195,7 +195,6 @@ struct pci_dn {
struct  pci_dn *parent;
struct  pci_controller *phb;/* for pci devices */
struct  iommu_table_group *table_group; /* for phb's or bridges */
-   struct  device_node *node;  /* back-pointer to the device_node */
 
int pci_ext_config_space;   /* for pci devices */
 
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
index c877014d11ce..2c926029adbe 100644
--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -435,7 +435,7 @@ int eeh_dev_check_failure(struct eeh_dev *edev)
int ret;
int active_flags = (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE);
unsigned long flags;
-   struct pci_dn *pdn;
+   struct device_node *dn;
struct pci_dev *dev;
struct eeh_pe *pe, *parent_pe, *phb_pe;
int rc = 0;
@@ -493,9 +493,10 @@ int eeh_dev_check_failure(struct eeh_dev *edev)
if (pe->state & EEH_PE_ISOLATED) {
pe->check_count++;
if (pe->check_count % EEH_MAX_FAILS == 0) {
-   pdn = eeh_dev_to_pdn(edev);
-   if (pdn->node)
-   location = of_get_property(pdn->node, 
"ibm,loc-code", NULL);
+   dn = pci_device_to_OF_node(dev);
+   if (dn)
+   location = of_get_property(dn, "ibm,loc-code",
+   NULL);
printk(KERN_ERR "EEH: %d reads ignored for recovering 
device at "
"location=%s driver=%s pci addr=%s\n",
pe->check_count,
diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c
index 0256372b72de..0e395afbf0f4 100644
--- a/arch/powerpc/kernel/pci_dn.c
+++ b/arch/powerpc/kernel/pci_dn.c
@@ -293,7 +293,6 @@ struct pci_dn *pci_add_device_node_info(struct 
pci_controller *hose,
if (pdn == NULL)
return NULL;
dn->data = pdn;
-   pdn->node = dn;
pdn->phb = hose;
 #ifdef CONFIG_PPC_POWERNV
pdn->pe_number = IODA_INVALID_PE;
@@ -342,6 +341,7 @@ EXPORT_SYMBOL_GPL(pci_add_device_node_info);
 void pci_remove_device_node_info(struct device_node *dn)
 {
struct pci_dn *pdn = dn ? PCI_DN(dn) : NULL;
+   struct device_node *parent;
 #ifdef CONFIG_EEH
struct eeh_dev *edev = pdn_to_eeh_dev(pdn);
 
@@ -354,8 +354,10 @@ void pci_remove_device_node_info(struct device_node *dn)
 
WARN_ON(!list_empty(>child_list));
list_del(>list);
-   if (pdn->parent)
-   of_node_put(pdn->parent->node);
+
+   parent = of_get_parent(dn);
+   if (parent)
+   of_node_put(parent);
 
dn->data = NULL;
kfree(pdn);
-- 
2.11.0



[PATCH kernel 4/5] powerpc/eeh: Remove unnecessary config_addr from eeh_dev

2017-08-23 Thread Alexey Kardashevskiy
The eeh_dev struct hold a config space address of an associated node
and the very same address is also stored in the pci_dn struct which
is always present during the eeh_dev lifetime.

This uses bus:devfn directly from pci_dn instead of cached and packed
config_addr.

Since config_addr is made from device's bus:dev.fn, there is no point
in keeping it in the debugfs either so remove that too.

Signed-off-by: Alexey Kardashevskiy 
---
 arch/powerpc/include/asm/eeh.h   |  1 -
 arch/powerpc/kernel/eeh_pe.c | 42 ++--
 arch/powerpc/kernel/eeh_sysfs.c  |  3 --
 arch/powerpc/platforms/powernv/eeh-powernv.c |  9 +++---
 4 files changed, 26 insertions(+), 29 deletions(-)

diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
index 777d37aa0a7f..9847ae3a12d1 100644
--- a/arch/powerpc/include/asm/eeh.h
+++ b/arch/powerpc/include/asm/eeh.h
@@ -131,7 +131,6 @@ static inline bool eeh_pe_passed(struct eeh_pe *pe)
 struct eeh_dev {
int mode;   /* EEH mode */
int class_code; /* Class code of the device */
-   int config_addr;/* Config address   */
int pe_config_addr; /* PE config address*/
u32 config_space[16];   /* Saved PCI config space   */
int pcix_cap;   /* Saved PCIx capability*/
diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c
index 419c3f07afd5..2e8d1b2b5af4 100644
--- a/arch/powerpc/kernel/eeh_pe.c
+++ b/arch/powerpc/kernel/eeh_pe.c
@@ -340,11 +340,12 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
 {
struct eeh_pe *pe, *parent;
struct pci_dn *pdn = eeh_dev_to_pdn(edev);
+   int config_addr = (pdn->busno << 8) | (pdn->devfn);
 
/* Check if the PE number is valid */
if (!eeh_has_flag(EEH_VALID_PE_ZERO) && !edev->pe_config_addr) {
pr_err("%s: Invalid PE#0 for edev 0x%x on PHB#%x\n",
-  __func__, edev->config_addr, pdn->phb->global_number);
+  __func__, config_addr, pdn->phb->global_number);
return -EINVAL;
}
 
@@ -354,8 +355,7 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
 * PE should be composed of PCI bus and its subordinate
 * components.
 */
-   pe = eeh_pe_get(pdn->phb, edev->pe_config_addr,
-   edev->config_addr);
+   pe = eeh_pe_get(pdn->phb, edev->pe_config_addr, config_addr);
if (pe && !(pe->type & EEH_PE_INVALID)) {
/* Mark the PE as type of PCI bus */
pe->type = EEH_PE_BUS;
@@ -365,10 +365,10 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
list_add_tail(>list, >edevs);
pr_debug("EEH: Add %04x:%02x:%02x.%01x to Bus PE#%x\n",
 pdn->phb->global_number,
-   edev->config_addr >> 8,
-   PCI_SLOT(edev->config_addr & 0xFF),
-   PCI_FUNC(edev->config_addr & 0xFF),
-   pe->addr);
+pdn->busno,
+PCI_SLOT(pdn->devfn),
+PCI_FUNC(pdn->devfn),
+pe->addr);
return 0;
} else if (pe && (pe->type & EEH_PE_INVALID)) {
list_add_tail(>list, >edevs);
@@ -388,10 +388,10 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
pr_debug("EEH: Add %04x:%02x:%02x.%01x to Device "
 "PE#%x, Parent PE#%x\n",
 pdn->phb->global_number,
-   edev->config_addr >> 8,
-PCI_SLOT(edev->config_addr & 0xFF),
-PCI_FUNC(edev->config_addr & 0xFF),
-   pe->addr, pe->parent->addr);
+pdn->busno,
+PCI_SLOT(pdn->devfn),
+PCI_FUNC(pdn->devfn),
+pe->addr, pe->parent->addr);
return 0;
}
 
@@ -405,7 +405,7 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
return -ENOMEM;
}
pe->addr= edev->pe_config_addr;
-   pe->config_addr = edev->config_addr;
+   pe->config_addr = config_addr;
 
/*
 * Put the new EEH PE into hierarchy tree. If the parent
@@ -436,9 +436,9 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
pr_debug("EEH: Add %04x:%02x:%02x.%01x to "
 "Device PE#%x, Parent PE#%x\n",
 pdn->phb->global_number,
-edev->config_addr >> 8,
-PCI_SLOT(edev->config_addr & 0xFF),
-PCI_FUNC(edev->config_addr & 0xFF),
+pdn->busno,
+PCI_SLOT(pdn->devfn),
+PCI_FUNC(pdn->devfn),
 pe->addr, pe->parent->addr);
 
 

[PATCH kernel 3/5] powerpc/eeh: Remove unnecessary pointer to phb from eeh_dev

2017-08-23 Thread Alexey Kardashevskiy
The eeh_dev struct already holds a pointer to pci_dn which it does not
exist without and pci_dn itself holds the very same pointer so just
use it.

Signed-off-by: Alexey Kardashevskiy 
---
 arch/powerpc/include/asm/eeh.h   |  1 -
 arch/powerpc/kernel/eeh.c|  7 +++
 arch/powerpc/kernel/eeh_dev.c|  2 --
 arch/powerpc/kernel/eeh_driver.c |  2 +-
 arch/powerpc/kernel/eeh_pe.c | 24 +---
 arch/powerpc/platforms/powernv/eeh-powernv.c |  5 ++---
 6 files changed, 19 insertions(+), 22 deletions(-)

diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
index 26a6a43f8799..777d37aa0a7f 100644
--- a/arch/powerpc/include/asm/eeh.h
+++ b/arch/powerpc/include/asm/eeh.h
@@ -141,7 +141,6 @@ struct eeh_dev {
struct eeh_pe *pe;  /* Associated PE*/
struct list_head list;  /* Form link list in the PE */
struct list_head rmv_list;  /* Record the removed edevs */
-   struct pci_controller *phb; /* Associated PHB   */
struct pci_dn *pdn; /* Associated PCI device node   */
struct pci_dev *pdev;   /* Associated PCI device*/
bool in_error;  /* Error flag for edev  */
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
index 63992b2d8e15..c877014d11ce 100644
--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -169,10 +169,10 @@ static size_t eeh_dump_dev_log(struct eeh_dev *edev, char 
*buf, size_t len)
char buffer[128];
 
n += scnprintf(buf+n, len-n, "%04x:%02x:%02x.%01x\n",
-  edev->phb->global_number, pdn->busno,
+  pdn->phb->global_number, pdn->busno,
   PCI_SLOT(pdn->devfn), PCI_FUNC(pdn->devfn));
pr_warn("EEH: of node=%04x:%02x:%02x.%01x\n",
-   edev->phb->global_number, pdn->busno,
+   pdn->phb->global_number, pdn->busno,
PCI_SLOT(pdn->devfn), PCI_FUNC(pdn->devfn));
 
eeh_ops->read_config(pdn, PCI_VENDOR_ID, 4, );
@@ -1064,7 +1064,7 @@ core_initcall_sync(eeh_init);
  */
 void eeh_add_device_early(struct pci_dn *pdn)
 {
-   struct pci_controller *phb;
+   struct pci_controller *phb = pdn ? pdn->phb : NULL;
struct eeh_dev *edev = pdn_to_eeh_dev(pdn);
 
if (!edev)
@@ -1074,7 +1074,6 @@ void eeh_add_device_early(struct pci_dn *pdn)
return;
 
/* USB Bus children of PCI devices will not have BUID's */
-   phb = edev->phb;
if (NULL == phb ||
(eeh_has_flag(EEH_PROBE_MODE_DEVTREE) && 0 == phb->buid))
return;
diff --git a/arch/powerpc/kernel/eeh_dev.c b/arch/powerpc/kernel/eeh_dev.c
index d6b2ca70d14d..bdf4a3698a35 100644
--- a/arch/powerpc/kernel/eeh_dev.c
+++ b/arch/powerpc/kernel/eeh_dev.c
@@ -50,7 +50,6 @@
  */
 struct eeh_dev *eeh_dev_init(struct pci_dn *pdn)
 {
-   struct pci_controller *phb = pdn->phb;
struct eeh_dev *edev;
 
/* Allocate EEH device */
@@ -64,7 +63,6 @@ struct eeh_dev *eeh_dev_init(struct pci_dn *pdn)
/* Associate EEH device with OF node */
pdn->edev = edev;
edev->pdn = pdn;
-   edev->phb = phb;
INIT_LIST_HEAD(>list);
INIT_LIST_HEAD(>rmv_list);
 
diff --git a/arch/powerpc/kernel/eeh_driver.c b/arch/powerpc/kernel/eeh_driver.c
index c405c79e50cd..8b840191df59 100644
--- a/arch/powerpc/kernel/eeh_driver.c
+++ b/arch/powerpc/kernel/eeh_driver.c
@@ -428,7 +428,7 @@ static void *eeh_add_virt_device(void *data, void *userdata)
 
if (!(edev->physfn)) {
pr_warn("%s: EEH dev %04x:%02x:%02x.%01x not for VF\n",
-   __func__, edev->phb->global_number, pdn->busno,
+   __func__, pdn->phb->global_number, pdn->busno,
PCI_SLOT(pdn->devfn), PCI_FUNC(pdn->devfn));
return NULL;
}
diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c
index 84d79f3da7d6..419c3f07afd5 100644
--- a/arch/powerpc/kernel/eeh_pe.c
+++ b/arch/powerpc/kernel/eeh_pe.c
@@ -339,11 +339,12 @@ static struct eeh_pe *eeh_pe_get_parent(struct eeh_dev 
*edev)
 int eeh_add_to_parent_pe(struct eeh_dev *edev)
 {
struct eeh_pe *pe, *parent;
+   struct pci_dn *pdn = eeh_dev_to_pdn(edev);
 
/* Check if the PE number is valid */
if (!eeh_has_flag(EEH_VALID_PE_ZERO) && !edev->pe_config_addr) {
pr_err("%s: Invalid PE#0 for edev 0x%x on PHB#%x\n",
-  __func__, edev->config_addr, edev->phb->global_number);
+  __func__, edev->config_addr, pdn->phb->global_number);
return -EINVAL;
}
 
@@ -353,7 +354,7 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
 * PE should be composed of PCI bus and its subordinate
 * components.
  

[PATCH kernel 2/5] powerpc/eeh: Reduce to one the number of places where edev is allocated

2017-08-23 Thread Alexey Kardashevskiy
arch/powerpc/kernel/eeh_dev.c:57 is the only legit place where edev
is allocated; other 2 places allocate it on stack and in the heap for
a very short period of time to use eeh_pe_get() as takes edev.

This changes eeh_pe_get() to receive required parameters explicitly.

This removes unnecessary temporary allocation of edev.

This uses the "pe_no" name instead of the "pe_config_addr" name as
it actually is a PE number and not a config space address as it seemed.

Signed-off-by: Alexey Kardashevskiy 
---
 arch/powerpc/include/asm/eeh.h   |  3 ++-
 arch/powerpc/kernel/eeh_pe.c | 32 ++--
 arch/powerpc/platforms/powernv/eeh-powernv.c | 15 ++---
 3 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
index 8e37b71674f4..26a6a43f8799 100644
--- a/arch/powerpc/include/asm/eeh.h
+++ b/arch/powerpc/include/asm/eeh.h
@@ -262,7 +262,8 @@ typedef void *(*eeh_traverse_func)(void *data, void *flag);
 void eeh_set_pe_aux_size(int size);
 int eeh_phb_pe_create(struct pci_controller *phb);
 struct eeh_pe *eeh_phb_pe_get(struct pci_controller *phb);
-struct eeh_pe *eeh_pe_get(struct eeh_dev *edev);
+struct eeh_pe *eeh_pe_get(struct pci_controller *phb,
+ int pe_no, int config_addr);
 int eeh_add_to_parent_pe(struct eeh_dev *edev);
 int eeh_rmv_from_parent_pe(struct eeh_dev *edev);
 void eeh_pe_update_time_stamp(struct eeh_pe *pe);
diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c
index cc4b206f77e4..84d79f3da7d6 100644
--- a/arch/powerpc/kernel/eeh_pe.c
+++ b/arch/powerpc/kernel/eeh_pe.c
@@ -230,10 +230,15 @@ void *eeh_pe_dev_traverse(struct eeh_pe *root,
  * Bus/Device/Function number. The extra data referred by flag
  * indicates which type of address should be used.
  */
+struct eeh_pe_get_flag {
+   int pe_no;
+   int config_addr;
+};
+
 static void *__eeh_pe_get(void *data, void *flag)
 {
struct eeh_pe *pe = (struct eeh_pe *)data;
-   struct eeh_dev *edev = (struct eeh_dev *)flag;
+   struct eeh_pe_get_flag *tmp = (struct eeh_pe_get_flag *) flag;
 
/* Unexpected PHB PE */
if (pe->type & EEH_PE_PHB)
@@ -244,17 +249,17 @@ static void *__eeh_pe_get(void *data, void *flag)
 * have non-zero PE address
 */
if (eeh_has_flag(EEH_VALID_PE_ZERO)) {
-   if (edev->pe_config_addr == pe->addr)
+   if (tmp->pe_no == pe->addr)
return pe;
} else {
-   if (edev->pe_config_addr &&
-   (edev->pe_config_addr == pe->addr))
+   if (tmp->pe_no &&
+   (tmp->pe_no == pe->addr))
return pe;
}
 
/* Try BDF address */
-   if (edev->config_addr &&
-  (edev->config_addr == pe->config_addr))
+   if (tmp->config_addr &&
+  (tmp->config_addr == pe->config_addr))
return pe;
 
return NULL;
@@ -262,7 +267,9 @@ static void *__eeh_pe_get(void *data, void *flag)
 
 /**
  * eeh_pe_get - Search PE based on the given address
- * @edev: EEH device
+ * @phb: PCI controller
+ * @pe_no: PE number
+ * @config_addr: Config address
  *
  * Search the corresponding PE based on the specified address which
  * is included in the eeh device. The function is used to check if
@@ -271,12 +278,14 @@ static void *__eeh_pe_get(void *data, void *flag)
  * which is composed of PCI bus/device/function number, or unified
  * PE address.
  */
-struct eeh_pe *eeh_pe_get(struct eeh_dev *edev)
+struct eeh_pe *eeh_pe_get(struct pci_controller *phb,
+   int pe_no, int config_addr)
 {
-   struct eeh_pe *root = eeh_phb_pe_get(edev->phb);
+   struct eeh_pe *root = eeh_phb_pe_get(phb);
+   struct eeh_pe_get_flag tmp = { pe_no, config_addr };
struct eeh_pe *pe;
 
-   pe = eeh_pe_traverse(root, __eeh_pe_get, edev);
+   pe = eeh_pe_traverse(root, __eeh_pe_get, );
 
return pe;
 }
@@ -344,7 +353,8 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
 * PE should be composed of PCI bus and its subordinate
 * components.
 */
-   pe = eeh_pe_get(edev);
+   pe = eeh_pe_get(edev->pdn->phb, edev->pe_config_addr,
+   edev->config_addr);
if (pe && !(pe->type & EEH_PE_INVALID)) {
/* Mark the PE as type of PCI bus */
pe->type = EEH_PE_BUS;
diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c 
b/arch/powerpc/platforms/powernv/eeh-powernv.c
index 3f48f6df1cf3..ac8c01cd251c 100644
--- a/arch/powerpc/platforms/powernv/eeh-powernv.c
+++ b/arch/powerpc/platforms/powernv/eeh-powernv.c
@@ -113,7 +113,6 @@ static ssize_t pnv_eeh_ei_write(struct file *filp,
size_t count, loff_t *ppos)
 {
struct pci_controller *hose = filp->private_data;
-   struct eeh_dev *edev;
struct 

[PATCH kernel 0/5] powerpc/eeh: Some cleanups

2017-08-23 Thread Alexey Kardashevskiy
Here are few patches to get rid of some cached pointers across EEH and
powernv code as I was struggling to figure out about lifetime of
structures and so on.


This is based on sha1
98b9f8a45499 Linus Torvalds Merge tag 'ext4_for_linus_stable' of 
git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4

Please comment. Thanks.



Alexey Kardashevskiy (5):
  powerpc/pci: Remove unused parameter from add_one_dev_pci_data()
  powerpc/eeh: Reduce to one the number of places where edev is
allocated
  powerpc/eeh: Remove unnecessary pointer to phb from eeh_dev
  powerpc/eeh: Remove unnecessary config_addr from eeh_dev
  powerpc/eeh: Remove unnecessary node from pci_dn

 arch/powerpc/include/asm/eeh.h   |  5 +-
 arch/powerpc/include/asm/pci-bridge.h|  1 -
 arch/powerpc/kernel/eeh.c| 16 ++---
 arch/powerpc/kernel/eeh_dev.c|  2 -
 arch/powerpc/kernel/eeh_driver.c |  2 +-
 arch/powerpc/kernel/eeh_pe.c | 90 
 arch/powerpc/kernel/eeh_sysfs.c  |  3 -
 arch/powerpc/kernel/pci_dn.c | 22 +++
 arch/powerpc/platforms/powernv/eeh-powernv.c | 29 +++--
 9 files changed, 78 insertions(+), 92 deletions(-)

-- 
2.11.0



答复: [PATCH] fix memory leak on kvm_vm_ioctl_create_spapr_tce

2017-08-23 Thread Nixiaoming
>On 23.08.2017 08:06, Paul Mackerras wrote:
>> On Wed, Aug 23, 2017 at 01:43:08AM +, Nixiaoming wrote:
 On 22.08.2017 17:15, David Hildenbrand wrote:
> On 22.08.2017 16:28, nixiaoming wrote:
>> miss kfree(stt) when anon_inode_getfd return fail so add check 
>> anon_inode_getfd return val, and kfree stt
>>
>> Signed-off-by: nixiaoming 
>> ---
>>  arch/powerpc/kvm/book3s_64_vio.c | 5 -
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/powerpc/kvm/book3s_64_vio.c 
>> b/arch/powerpc/kvm/book3s_64_vio.c
>> index a160c14..a0b4459 100644
>> --- a/arch/powerpc/kvm/book3s_64_vio.c
>> +++ b/arch/powerpc/kvm/book3s_64_vio.c
>> @@ -341,8 +341,11 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm 
>> *kvm,
>>  
>>  mutex_unlock(>lock);
>>  
>> -return anon_inode_getfd("kvm-spapr-tce", _spapr_tce_fops,
>> +ret = anon_inode_getfd("kvm-spapr-tce", _spapr_tce_fops,
>>  stt, O_RDWR | O_CLOEXEC);
>> +if (ret < 0)
>> +goto fail;
>> +return ret;
>>  
>>  fail:
>>  if (stt) {
>>
>
>
> stt has already been added to kvm->arch.spapr_tce_tables, so freeing 
> it is evil IMHO. I don't know that code, so I don't know if there is 
> some other place that will make sure that everything in
> kvm->arch.spapr_tce_tables will properly get freed, even when no 
> kvm->release
> function has been called (kvm_spapr_tce_release).
>

 If it is really not freed, than also kvm_put_kvm(stt->kvm) is missing.

 -- 

 Thanks,

 David

>>>
>>> if (!stt) return -ENOMEM;
>>> kvm_get_kvm(kvm);
>>> if anon_inode_getfd return -ENOMEM
>>> The user can not determine whether kvm_get_kvm has been called
>>> so need add kvm_pet_kvm when anon_inode_getfd fail
>>>
>>> stt has already been added to kvm->arch.spapr_tce_tables,
>>> but if anon_inode_getfd fail, stt is unused val, 
>>> so call list_del_rcu, and  free as quickly as possible
>>>
>>> new patch:
>>>
>>> ---
>>>  arch/powerpc/kvm/book3s_64_vio.c | 10 +-
>>>  1 file changed, 9 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/arch/powerpc/kvm/book3s_64_vio.c 
>>> b/arch/powerpc/kvm/book3s_64_vio.c
>>> index a160c14..e2228f1 100644
>>> --- a/arch/powerpc/kvm/book3s_64_vio.c
>>> +++ b/arch/powerpc/kvm/book3s_64_vio.c
>>> @@ -341,8 +341,16 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
>>>
>>> mutex_unlock(>lock);
>>>
>>> -   return anon_inode_getfd("kvm-spapr-tce", _spapr_tce_fops,
>>> +   ret = anon_inode_getfd("kvm-spapr-tce", _spapr_tce_fops,
>>> stt, O_RDWR | O_CLOEXEC);
>>> +   if (ret < 0) {
>>> +   mutex_lock(>lock);
>>> +   list_del_rcu(>list);
>
>... don't we have to take care of rcu synchronization before freeing it?
>
>>> +   mutex_unlock(>lock);
>>> +   kvm_put_kvm(kvm);
>>> +   goto fail;
>>> +   }
>>> +   return ret;
>
>of simply
>
>if (!ret)
>   return 0;
>
>mutex_lock(>lock);
>list_del_rcu(>list);
>mutex_unlock(>lock);
>kvm_put_kvm(kvm);
>
>
>> 
>> It seems to me that it would be better to do the anon_inode_getfd()
>> call before the kvm_get_kvm() call, and go to the fail label if it
>> fails.
>
>I would have suggested to not add it to the list before it has been
>fully created (so nobody can have access to it). But I guess than we
>need another level of protection(e.g. kvm->lock).
>
>Am I missing something, or is kvm_vm_ioctl_create_spapr_tce() racy?
>
>The -EBUSY check is done without any locking, so two parallel creators
>could create an inconsistency, no? Shouldn't this all be protected by
>kvm->lock?
>
>> 
>> Paul.
>> 
>
>Independent of the fix, I'd suggest the following cleanup.
>
>
>From 979f55083ee965e25827a8743e8a9fdb85231a6f Mon Sep 17 00:00:00 2001
>From: David Hildenbrand 
>Date: Wed, 23 Aug 2017 10:08:58 +0200
>Subject: [PATCH v1 1/1] KVM: PPC: cleanup kvm_vm_ioctl_create_spapr_tce
>
>Let's simplify error handling.
>
>Signed-off-by: David Hildenbrand 
>---
> arch/powerpc/kvm/book3s_64_vio.c | 29 +++--
> 1 file changed, 11 insertions(+), 18 deletions(-)
>
>diff --git a/arch/powerpc/kvm/book3s_64_vio.c
>b/arch/powerpc/kvm/book3s_64_vio.c
>index a160c14304eb..6bac49292296 100644
>--- a/arch/powerpc/kvm/book3s_64_vio.c
>+++ b/arch/powerpc/kvm/book3s_64_vio.c
>@@ -295,8 +295,7 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
> {
>   struct kvmppc_spapr_tce_table *stt = NULL;
>   unsigned long npages, size;
>-  int ret = -ENOMEM;
>-  int i;
>+  int i, ret;
>
>   if (!args->size)
>   return -EINVAL;
>@@ -310,16 +309,13 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
>   size = _ALIGN_UP(args->size, 

Re: [PATCH RFC 0/7] powerpc: Beef up single-stepping/instruction emulation infrastructure

2017-08-23 Thread Michael Neuling
Paulus, 

> This patch series extends the code in arch/powerpc/lib/sstep.c so that
> it handles almost all load and store instructions -- all except the
> atomic memory operations (lwat, stwat, etc.).  It also makes sure that
> we use the largest possible aligned accesses to access memory and that
> we don't access the CPU FP/VMX/VSX registers when they don't contain
> user data.

Do you have any test cases we can put in selftests for this?

> With this, it should be possible to replace the body of the alignment
> interrupt handler with a call to emulate_step() or something quite
> similar.

Exercise for the reader? :-)

Mikey


Re: [PATCH RFC 2/7] powerpc: Change analyse_instr so it doesn't modify *regs

2017-08-23 Thread Michael Neuling
On Wed, 2017-08-23 at 09:47 +1000, Paul Mackerras wrote:
> The analyse_instr function currently doesn't just work out what an
> instruction does, it also executes those instructions whose effect
> is only to update CPU registers that are stored in struct pt_regs.
> This is undesirable because optprobes uses analyse_instr to work out
> if an instruction could be successfully emulated in future.
> 
> This changes analyse_instr so it doesn't modify *regs; instead it
> stores information in the instruction_op structure to indicate what
> registers (GPRs, CR, XER, LR) would be set and what value they would
> be set to.  A companion function called emulate_update_regs() can
> then use that information to update a pt_regs struct appropriately.
> 
> As a minor cleanup, this replaces inline asm using the cntlzw and
> cntlzd instructions with calls to __builtin_clz() and __builtin_clzl().

+1 ! This is super useful!

As mentioned offline, this clashes with the recent changes to sstep.c in powerpc
next.  In fact, the new instructions added there need to have these changes
applied.

Mikey



Re: [PATCH] fix memory leak on kvm_vm_ioctl_create_spapr_tce

2017-08-23 Thread David Hildenbrand

>>> +   mutex_unlock(>lock);
>>> +   kvm_put_kvm(kvm);
>>> +   goto fail;
>>> +   }
>>> +   return ret;
> 
> of simply
> 
> if (!ret)

if (ret >= 0)
return ret;

is of course what I meant :)

>   return 0;
> 
> mutex_lock(>lock);
> list_del_rcu(>list);
> mutex_unlock(>lock);
> kvm_put_kvm(kvm);


-- 

Thanks,

David


Re: [PATCH] fix memory leak on kvm_vm_ioctl_create_spapr_tce

2017-08-23 Thread David Hildenbrand
On 23.08.2017 08:06, Paul Mackerras wrote:
> On Wed, Aug 23, 2017 at 01:43:08AM +, Nixiaoming wrote:
>>> On 22.08.2017 17:15, David Hildenbrand wrote:
 On 22.08.2017 16:28, nixiaoming wrote:
> miss kfree(stt) when anon_inode_getfd return fail so add check 
> anon_inode_getfd return val, and kfree stt
>
> Signed-off-by: nixiaoming 
> ---
>  arch/powerpc/kvm/book3s_64_vio.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/kvm/book3s_64_vio.c 
> b/arch/powerpc/kvm/book3s_64_vio.c
> index a160c14..a0b4459 100644
> --- a/arch/powerpc/kvm/book3s_64_vio.c
> +++ b/arch/powerpc/kvm/book3s_64_vio.c
> @@ -341,8 +341,11 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm 
> *kvm,
>  
>   mutex_unlock(>lock);
>  
> - return anon_inode_getfd("kvm-spapr-tce", _spapr_tce_fops,
> + ret = anon_inode_getfd("kvm-spapr-tce", _spapr_tce_fops,
>   stt, O_RDWR | O_CLOEXEC);
> + if (ret < 0)
> + goto fail;
> + return ret;
>  
>  fail:
>   if (stt) {
>


 stt has already been added to kvm->arch.spapr_tce_tables, so freeing 
 it is evil IMHO. I don't know that code, so I don't know if there is 
 some other place that will make sure that everything in
 kvm->arch.spapr_tce_tables will properly get freed, even when no 
 kvm->release
 function has been called (kvm_spapr_tce_release).

>>>
>>> If it is really not freed, than also kvm_put_kvm(stt->kvm) is missing.
>>>
>>> -- 
>>>
>>> Thanks,
>>>
>>> David
>>>
>>
>> if (!stt) return -ENOMEM;
>> kvm_get_kvm(kvm);
>> if anon_inode_getfd return -ENOMEM
>> The user can not determine whether kvm_get_kvm has been called
>> so need add kvm_pet_kvm when anon_inode_getfd fail
>>
>> stt has already been added to kvm->arch.spapr_tce_tables,
>> but if anon_inode_getfd fail, stt is unused val, 
>> so call list_del_rcu, and  free as quickly as possible
>>
>> new patch:
>>
>> ---
>>  arch/powerpc/kvm/book3s_64_vio.c | 10 +-
>>  1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/powerpc/kvm/book3s_64_vio.c 
>> b/arch/powerpc/kvm/book3s_64_vio.c
>> index a160c14..e2228f1 100644
>> --- a/arch/powerpc/kvm/book3s_64_vio.c
>> +++ b/arch/powerpc/kvm/book3s_64_vio.c
>> @@ -341,8 +341,16 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
>>
>> mutex_unlock(>lock);
>>
>> -   return anon_inode_getfd("kvm-spapr-tce", _spapr_tce_fops,
>> +   ret = anon_inode_getfd("kvm-spapr-tce", _spapr_tce_fops,
>> stt, O_RDWR | O_CLOEXEC);
>> +   if (ret < 0) {
>> +   mutex_lock(>lock);
>> +   list_del_rcu(>list);

... don't we have to take care of rcu synchronization before freeing it?

>> +   mutex_unlock(>lock);
>> +   kvm_put_kvm(kvm);
>> +   goto fail;
>> +   }
>> +   return ret;

of simply

if (!ret)
return 0;

mutex_lock(>lock);
list_del_rcu(>list);
mutex_unlock(>lock);
kvm_put_kvm(kvm);


> 
> It seems to me that it would be better to do the anon_inode_getfd()
> call before the kvm_get_kvm() call, and go to the fail label if it
> fails.

I would have suggested to not add it to the list before it has been
fully created (so nobody can have access to it). But I guess than we
need another level of protection(e.g. kvm->lock).

Am I missing something, or is kvm_vm_ioctl_create_spapr_tce() racy?

The -EBUSY check is done without any locking, so two parallel creators
could create an inconsistency, no? Shouldn't this all be protected by
kvm->lock?

> 
> Paul.
> 

Independent of the fix, I'd suggest the following cleanup.


>From 979f55083ee965e25827a8743e8a9fdb85231a6f Mon Sep 17 00:00:00 2001
From: David Hildenbrand 
Date: Wed, 23 Aug 2017 10:08:58 +0200
Subject: [PATCH v1 1/1] KVM: PPC: cleanup kvm_vm_ioctl_create_spapr_tce

Let's simplify error handling.

Signed-off-by: David Hildenbrand 
---
 arch/powerpc/kvm/book3s_64_vio.c | 29 +++--
 1 file changed, 11 insertions(+), 18 deletions(-)

diff --git a/arch/powerpc/kvm/book3s_64_vio.c
b/arch/powerpc/kvm/book3s_64_vio.c
index a160c14304eb..6bac49292296 100644
--- a/arch/powerpc/kvm/book3s_64_vio.c
+++ b/arch/powerpc/kvm/book3s_64_vio.c
@@ -295,8 +295,7 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
 {
struct kvmppc_spapr_tce_table *stt = NULL;
unsigned long npages, size;
-   int ret = -ENOMEM;
-   int i;
+   int i, ret;

if (!args->size)
return -EINVAL;
@@ -310,16 +309,13 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
size = _ALIGN_UP(args->size, PAGE_SIZE >> 3);
npages = kvmppc_tce_pages(size);
ret = kvmppc_account_memlimit(kvmppc_stt_pages(npages), true);
-   if (ret) {
-   stt = NULL;
-   goto fail;

Re: Re: [PATCH] fix memory leak on kvm_vm_ioctl_create_spapr_tce

2017-08-23 Thread Paul Mackerras
On Wed, Aug 23, 2017 at 01:43:08AM +, Nixiaoming wrote:
> >On 22.08.2017 17:15, David Hildenbrand wrote:
> >> On 22.08.2017 16:28, nixiaoming wrote:
> >>> miss kfree(stt) when anon_inode_getfd return fail so add check 
> >>> anon_inode_getfd return val, and kfree stt
> >>>
> >>> Signed-off-by: nixiaoming 
> >>> ---
> >>>  arch/powerpc/kvm/book3s_64_vio.c | 5 -
> >>>  1 file changed, 4 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/arch/powerpc/kvm/book3s_64_vio.c 
> >>> b/arch/powerpc/kvm/book3s_64_vio.c
> >>> index a160c14..a0b4459 100644
> >>> --- a/arch/powerpc/kvm/book3s_64_vio.c
> >>> +++ b/arch/powerpc/kvm/book3s_64_vio.c
> >>> @@ -341,8 +341,11 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm 
> >>> *kvm,
> >>>  
> >>>   mutex_unlock(>lock);
> >>>  
> >>> - return anon_inode_getfd("kvm-spapr-tce", _spapr_tce_fops,
> >>> + ret = anon_inode_getfd("kvm-spapr-tce", _spapr_tce_fops,
> >>>   stt, O_RDWR | O_CLOEXEC);
> >>> + if (ret < 0)
> >>> + goto fail;
> >>> + return ret;
> >>>  
> >>>  fail:
> >>>   if (stt) {
> >>>
> >> 
> >> 
> >> stt has already been added to kvm->arch.spapr_tce_tables, so freeing 
> >> it is evil IMHO. I don't know that code, so I don't know if there is 
> >> some other place that will make sure that everything in
> >> kvm->arch.spapr_tce_tables will properly get freed, even when no 
> >> kvm->release
> >> function has been called (kvm_spapr_tce_release).
> >> 
> >
> >If it is really not freed, than also kvm_put_kvm(stt->kvm) is missing.
> >
> >-- 
> >
> >Thanks,
> >
> >David
> >
> 
> if (!stt) return -ENOMEM;
> kvm_get_kvm(kvm);
> if anon_inode_getfd return -ENOMEM
> The user can not determine whether kvm_get_kvm has been called
> so need add kvm_pet_kvm when anon_inode_getfd fail
> 
> stt has already been added to kvm->arch.spapr_tce_tables,
> but if anon_inode_getfd fail, stt is unused val, 
> so call list_del_rcu, and  free as quickly as possible
> 
> new patch:
> 
> ---
>  arch/powerpc/kvm/book3s_64_vio.c | 10 +-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kvm/book3s_64_vio.c 
> b/arch/powerpc/kvm/book3s_64_vio.c
> index a160c14..e2228f1 100644
> --- a/arch/powerpc/kvm/book3s_64_vio.c
> +++ b/arch/powerpc/kvm/book3s_64_vio.c
> @@ -341,8 +341,16 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
> 
> mutex_unlock(>lock);
> 
> -   return anon_inode_getfd("kvm-spapr-tce", _spapr_tce_fops,
> +   ret = anon_inode_getfd("kvm-spapr-tce", _spapr_tce_fops,
> stt, O_RDWR | O_CLOEXEC);
> +   if (ret < 0) {
> +   mutex_lock(>lock);
> +   list_del_rcu(>list);
> +   mutex_unlock(>lock);
> +   kvm_put_kvm(kvm);
> +   goto fail;
> +   }
> +   return ret;

It seems to me that it would be better to do the anon_inode_getfd()
call before the kvm_get_kvm() call, and go to the fail label if it
fails.

Paul.


[PATCH] powerpc/vio: Use device_type to detect family

2017-08-23 Thread Michael Ellerman
Currently in the vio.c code we use a comparision against the parent
device node's full path to decide if the device is a PFO or VIO family
device.

Both the ibm,platform-facilities and vdevice nodes are defined by PAPR,
and must have a matching device_type. So instead of using the path we
can instead compare the device_type.

I've checked Qemu and kvmtool both do this correctly, and all the
PowerVM systems I have access to do also. So it seems to be safe.

This removes the dependency on full_name, which is being removed
upstream.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/platforms/pseries/vio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/vio.c 
b/arch/powerpc/platforms/pseries/vio.c
index 8a47f168476b..f26f906e6021 100644
--- a/arch/powerpc/platforms/pseries/vio.c
+++ b/arch/powerpc/platforms/pseries/vio.c
@@ -1357,9 +1357,9 @@ struct vio_dev *vio_register_device_node(struct 
device_node *of_node)
 */
parent_node = of_get_parent(of_node);
if (parent_node) {
-   if (!strcmp(parent_node->full_name, "/ibm,platform-facilities"))
+   if (!strcmp(parent_node->type, "ibm,platform-facilities"))
family = PFO;
-   else if (!strcmp(parent_node->full_name, "/vdevice"))
+   else if (!strcmp(parent_node->type, "vdevice"))
family = VDEVICE;
else {
pr_warn("%s: parent(%s) of %s not recognized.\n",
-- 
2.7.4



[PATCH 46/46] powerpc/configs/6xx: Drop removed CONFIG_USB_LED

2017-08-23 Thread Michael Ellerman
In commit a335aaf3125c ("usb: misc: remove outdated USB LED driver")
CONFIG_USB_LED was removed, so drop it from our defconfigs.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/ppc6xx_defconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/configs/ppc6xx_defconfig 
b/arch/powerpc/configs/ppc6xx_defconfig
index 7a1e952b714c..da0e8d535eb8 100644
--- a/arch/powerpc/configs/ppc6xx_defconfig
+++ b/arch/powerpc/configs/ppc6xx_defconfig
@@ -960,7 +960,6 @@ CONFIG_USB_ADUTUX=m
 CONFIG_USB_SEVSEG=m
 CONFIG_USB_LEGOTOWER=m
 CONFIG_USB_LCD=m
-CONFIG_USB_LED=m
 CONFIG_USB_IDMOUSE=m
 CONFIG_USB_FTDI_ELAN=m
 CONFIG_USB_APPLEDISPLAY=m
-- 
2.7.4



[PATCH 45/46] powerpc/configs/6xx: Drop no longer selectable CONFIG_BT_HCIUART_LL

2017-08-23 Thread Michael Ellerman
Since commit 76c4969fecb1 ("Bluetooth: hci_uart: fix kconfig
dependency") we can no longer select CONFIG_BT_HCIUART_LL.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/ppc6xx_defconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/configs/ppc6xx_defconfig 
b/arch/powerpc/configs/ppc6xx_defconfig
index 39ba8a03c9ab..7a1e952b714c 100644
--- a/arch/powerpc/configs/ppc6xx_defconfig
+++ b/arch/powerpc/configs/ppc6xx_defconfig
@@ -331,7 +331,6 @@ CONFIG_BT_BNEP_PROTO_FILTER=y
 CONFIG_BT_HIDP=m
 CONFIG_BT_HCIUART=m
 CONFIG_BT_HCIUART_BCSP=y
-CONFIG_BT_HCIUART_LL=y
 CONFIG_BT_HCIBCM203X=m
 CONFIG_BT_HCIBPA10X=m
 CONFIG_BT_HCIBFUSB=m
-- 
2.7.4



[PATCH 44/46] powerpc/configs/c2k: Switch CONFIG_GEN_RTC from =m to =y

2017-08-23 Thread Michael Ellerman
In commit 835ea93e9d26 ("char/genrtc: remove powerpc support"),
CONFIG_GEN_RTC switch from tristate to bool, update the defconfig to
match.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/c2k_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/configs/c2k_defconfig 
b/arch/powerpc/configs/c2k_defconfig
index d23507223ab4..f1552af9eecc 100644
--- a/arch/powerpc/configs/c2k_defconfig
+++ b/arch/powerpc/configs/c2k_defconfig
@@ -27,6 +27,7 @@ CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
 CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
 CONFIG_CPU_FREQ_GOV_POWERSAVE=m
 CONFIG_CPU_FREQ_GOV_ONDEMAND=m
+CONFIG_GEN_RTC=y
 CONFIG_HIGHMEM=y
 CONFIG_PREEMPT_VOLUNTARY=y
 CONFIG_BINFMT_MISC=y
@@ -208,7 +209,6 @@ CONFIG_SERIAL_NONSTANDARD=y
 CONFIG_SERIAL_MPSC=y
 CONFIG_SERIAL_MPSC_CONSOLE=y
 CONFIG_NVRAM=m
-CONFIG_GEN_RTC=m
 CONFIG_RAW_DRIVER=y
 CONFIG_MAX_RAW_DEVS=8192
 CONFIG_I2C=m
-- 
2.7.4



[PATCH 43/46] powerpc/configs/6xx: Switch CONFIG_USB_EHCI_FSL to =m

2017-08-23 Thread Michael Ellerman
In commit ca07e1c1e4a6 ("drivers:usb:fsl:Make fsl ehci drv an
independent driver module"), CONFIG_USB_EHCI_FSL was switched from
built-in to modular. Update the defconfig.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/ppc6xx_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/configs/ppc6xx_defconfig 
b/arch/powerpc/configs/ppc6xx_defconfig
index 81bc64e1bb4c..39ba8a03c9ab 100644
--- a/arch/powerpc/configs/ppc6xx_defconfig
+++ b/arch/powerpc/configs/ppc6xx_defconfig
@@ -893,7 +893,7 @@ CONFIG_USB=y
 CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
 CONFIG_USB_MON=y
 CONFIG_USB_EHCI_HCD=m
-CONFIG_USB_EHCI_FSL=y
+CONFIG_USB_EHCI_FSL=m
 CONFIG_USB_OHCI_HCD=m
 CONFIG_USB_OHCI_HCD_PPC_OF_BE=y
 CONFIG_USB_OHCI_HCD_PPC_OF_LE=y
-- 
2.7.4



[PATCH 42/46] powerpc/configs/6xx: Drop no longer needed CONFIG_BT_HCIUART_H4

2017-08-23 Thread Michael Ellerman
Since commit 943cc592195e ("Bluetooth: bpa10x: Use h4_recv_buf helper
for frame reassembly") we no longer need to set CONFIG_BT_HCIUART_H4
in our defconfigs.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/ppc6xx_defconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/configs/ppc6xx_defconfig 
b/arch/powerpc/configs/ppc6xx_defconfig
index 40d81eb00202..81bc64e1bb4c 100644
--- a/arch/powerpc/configs/ppc6xx_defconfig
+++ b/arch/powerpc/configs/ppc6xx_defconfig
@@ -330,7 +330,6 @@ CONFIG_BT_BNEP_MC_FILTER=y
 CONFIG_BT_BNEP_PROTO_FILTER=y
 CONFIG_BT_HIDP=m
 CONFIG_BT_HCIUART=m
-CONFIG_BT_HCIUART_H4=y
 CONFIG_BT_HCIUART_BCSP=y
 CONFIG_BT_HCIUART_LL=y
 CONFIG_BT_HCIBCM203X=m
-- 
2.7.4



[PATCH 41/46] powerpc/configs/6xx: Drop no longer needed CONFIG_NETFILTER_XT_MATCH_SOCKET

2017-08-23 Thread Michael Ellerman
Since commit 8db4c5be88f6 ("netfilter: move socket lookup
infrastructure to nf_socket_ipv{4,6}.c") we no longer need to set
CONFIG_NETFILTER_XT_MATCH_SOCKET in our defconfigs.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/ppc6xx_defconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/configs/ppc6xx_defconfig 
b/arch/powerpc/configs/ppc6xx_defconfig
index de771d5e564a..40d81eb00202 100644
--- a/arch/powerpc/configs/ppc6xx_defconfig
+++ b/arch/powerpc/configs/ppc6xx_defconfig
@@ -185,7 +185,6 @@ CONFIG_NETFILTER_XT_MATCH_QUOTA=m
 CONFIG_NETFILTER_XT_MATCH_RATEEST=m
 CONFIG_NETFILTER_XT_MATCH_REALM=m
 CONFIG_NETFILTER_XT_MATCH_RECENT=m
-CONFIG_NETFILTER_XT_MATCH_SOCKET=m
 CONFIG_NETFILTER_XT_MATCH_STATE=m
 CONFIG_NETFILTER_XT_MATCH_STATISTIC=m
 CONFIG_NETFILTER_XT_MATCH_STRING=m
-- 
2.7.4



[PATCH 40/46] powerpc/configs/6xx: Reinstate CONFIG_CPU_FREQ_STAT

2017-08-23 Thread Michael Ellerman
In commit 1aefc75b2449 ("cpufreq: stats: Make the stats code
non-modular"), the CPU_FREQ_STAT code was made non-modular. Our
defconfig still said =m though, which meant we no longer got the
code at all. Switch the defconfig to =y.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/ppc6xx_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/configs/ppc6xx_defconfig 
b/arch/powerpc/configs/ppc6xx_defconfig
index 3d5ca6e8c414..de771d5e564a 100644
--- a/arch/powerpc/configs/ppc6xx_defconfig
+++ b/arch/powerpc/configs/ppc6xx_defconfig
@@ -61,7 +61,7 @@ CONFIG_SBC8641D=y
 CONFIG_MPC8610_HPCD=y
 CONFIG_GEF_SBC610=y
 CONFIG_CPU_FREQ=y
-CONFIG_CPU_FREQ_STAT=m
+CONFIG_CPU_FREQ_STAT=y
 CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
 CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
 CONFIG_CPU_FREQ_GOV_POWERSAVE=m
-- 
2.7.4



[PATCH 39/46] powerpc/configs/6xx: Drop no longer needed CONFIG_NF_CONNTRACK_PROC_COMPAT

2017-08-23 Thread Michael Ellerman
Since commit adf0516845bc ("netfilter: remove ip_conntrack* sysctl
compat code") we no longer need to set CONFIG_NF_CONNTRACK_PROC_COMPAT
in our defconfigs.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/ppc6xx_defconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/configs/ppc6xx_defconfig 
b/arch/powerpc/configs/ppc6xx_defconfig
index ddb100f4e034..3d5ca6e8c414 100644
--- a/arch/powerpc/configs/ppc6xx_defconfig
+++ b/arch/powerpc/configs/ppc6xx_defconfig
@@ -193,7 +193,6 @@ CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
 CONFIG_NETFILTER_XT_MATCH_TIME=m
 CONFIG_NETFILTER_XT_MATCH_U32=m
 CONFIG_NF_CONNTRACK_IPV4=m
-# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set
 CONFIG_IP_NF_IPTABLES=m
 CONFIG_IP_NF_MATCH_AH=m
 CONFIG_IP_NF_MATCH_ECN=m
-- 
2.7.4



[PATCH 38/46] powerpc/configs/6xx: Drop removed CONFIG_BLK_DEV_HD

2017-08-23 Thread Michael Ellerman
In commit 8e14be53f470 ("remove the obsolete hd driver") the
CONFIG_BLK_DEV_HD symbol was removed, so drop it from the defconfig.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/ppc6xx_defconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/configs/ppc6xx_defconfig 
b/arch/powerpc/configs/ppc6xx_defconfig
index bef9a2247702..ddb100f4e034 100644
--- a/arch/powerpc/configs/ppc6xx_defconfig
+++ b/arch/powerpc/configs/ppc6xx_defconfig
@@ -368,7 +368,6 @@ CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_SIZE=16384
 CONFIG_CDROM_PKTCDVD=m
 CONFIG_VIRTIO_BLK=m
-CONFIG_BLK_DEV_HD=y
 CONFIG_ENCLOSURE_SERVICES=m
 CONFIG_SENSORS_TSL2550=m
 CONFIG_EEPROM_AT24=m
-- 
2.7.4



[PATCH 37/46] powerpc/configs/6xx: Clean up duplicate CONFIG_EXT4 values

2017-08-23 Thread Michael Ellerman
We had two values for CONFIG_EXT4, =m and =y, just use =y.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/ppc6xx_defconfig | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/powerpc/configs/ppc6xx_defconfig 
b/arch/powerpc/configs/ppc6xx_defconfig
index ac3730fb28e0..bef9a2247702 100644
--- a/arch/powerpc/configs/ppc6xx_defconfig
+++ b/arch/powerpc/configs/ppc6xx_defconfig
@@ -1023,10 +1023,9 @@ CONFIG_EXT2_FS=m
 CONFIG_EXT2_FS_XATTR=y
 CONFIG_EXT2_FS_POSIX_ACL=y
 CONFIG_EXT2_FS_SECURITY=y
-CONFIG_EXT4_FS=m
+CONFIG_EXT4_FS=y
 CONFIG_EXT4_FS_POSIX_ACL=y
 CONFIG_EXT4_FS_SECURITY=y
-CONFIG_EXT4_FS=y
 CONFIG_JBD2_DEBUG=y
 CONFIG_REISERFS_FS=m
 CONFIG_REISERFS_PROC_INFO=y
-- 
2.7.4



[PATCH 36/46] powerpc/configs/6xx: Drop no longer needed CONFIG_TIMER_STATS

2017-08-23 Thread Michael Ellerman
Since commit dfb4357da6dd ("time: Remove CONFIG_TIMER_STATS") we no
longer need to set CONFIG_TIMER_STATS in our defconfigs.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/ppc6xx_defconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/configs/ppc6xx_defconfig 
b/arch/powerpc/configs/ppc6xx_defconfig
index 4d845c49e77f..ac3730fb28e0 100644
--- a/arch/powerpc/configs/ppc6xx_defconfig
+++ b/arch/powerpc/configs/ppc6xx_defconfig
@@ -1145,7 +1145,6 @@ CONFIG_DEBUG_VM=y
 CONFIG_DEBUG_HIGHMEM=y
 CONFIG_DEBUG_STACKOVERFLOW=y
 CONFIG_DEBUG_SHIRQ=y
-CONFIG_TIMER_STATS=y
 CONFIG_DEBUG_RT_MUTEXES=y
 CONFIG_DEBUG_SPINLOCK=y
 CONFIG_DEBUG_MUTEXES=y
-- 
2.7.4



[PATCH 35/46] powerpc/configs/6xx: Turn CONFIG_DRM_RADEON back on

2017-08-23 Thread Michael Ellerman
In commit d92d9c3a1448 ("drm: hide legacy drivers with CONFIG_DRM_LEGACY")
CONFIG_DRM_RADEON was moved behind CONFIG_DRM_LEGACY meaning it
stopped being enabled by ppc6xx_defconfig. Although no one has
noticed, given this is basically a legacy platform, it seems anyone
who is using it probably still wants this driver. So turn it back on
for now.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/ppc6xx_defconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/configs/ppc6xx_defconfig 
b/arch/powerpc/configs/ppc6xx_defconfig
index 60ccfa966ea9..4d845c49e77f 100644
--- a/arch/powerpc/configs/ppc6xx_defconfig
+++ b/arch/powerpc/configs/ppc6xx_defconfig
@@ -744,9 +744,10 @@ CONFIG_MFD_SM501_GPIO=y
 CONFIG_AGP=y
 CONFIG_AGP_UNINORTH=y
 CONFIG_DRM=m
+CONFIG_DRM_RADEON=m
+CONFIG_DRM_LEGACY=y
 CONFIG_DRM_TDFX=m
 CONFIG_DRM_R128=m
-CONFIG_DRM_RADEON=m
 CONFIG_DRM_MGA=m
 CONFIG_DRM_SIS=m
 CONFIG_DRM_VIA=m
-- 
2.7.4



[PATCH 34/46] powerpc/configs/mpc5200: Drop no longer needed CONFIG_FB

2017-08-23 Thread Michael Ellerman
Since commit a03fdcb18632 ("drm: Add top level Kconfig option for DRM
fbdev emulation") we no longer need to set CONFIG_FB in our
defconfigs.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/mpc5200_defconfig | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/powerpc/configs/mpc5200_defconfig 
b/arch/powerpc/configs/mpc5200_defconfig
index faa3d5789db8..7a2b2aa37def 100644
--- a/arch/powerpc/configs/mpc5200_defconfig
+++ b/arch/powerpc/configs/mpc5200_defconfig
@@ -70,12 +70,10 @@ CONFIG_SENSORS_LM87=m
 CONFIG_WATCHDOG=y
 CONFIG_MFD_SM501=m
 CONFIG_DRM=y
-CONFIG_FB=y
 CONFIG_FB_FOREIGN_ENDIAN=y
 CONFIG_FB_RADEON=y
 CONFIG_FB_SM501=m
 # CONFIG_VGA_CONSOLE is not set
-CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_LOGO=y
 CONFIG_SOUND=y
 CONFIG_SND=y
-- 
2.7.4



[PATCH 33/46] powerpc/configs: Update for CONFIG_SND changes

2017-08-23 Thread Michael Ellerman
Commit eb3b705aaed9 ("ALSA: Make CONFIG_SND_OSSEMUL user-selectable")
means we need to set CONFIG_SND_OSSEMUL in our configs, otherwise we
lose some of the SND symbols.

And commit 0181307abc1d ("ALSA: seq: Reorganize kconfig and build")
reorganised things, which causes the churn.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/g5_defconfig   | 5 +++--
 arch/powerpc/configs/gamecube_defconfig | 5 +++--
 arch/powerpc/configs/pasemi_defconfig   | 3 ++-
 arch/powerpc/configs/pmac32_defconfig   | 7 ---
 arch/powerpc/configs/ppc64_defconfig| 7 ---
 arch/powerpc/configs/ppc64e_defconfig   | 7 ---
 arch/powerpc/configs/ppc6xx_defconfig   | 7 ---
 arch/powerpc/configs/wii_defconfig  | 5 +++--
 8 files changed, 27 insertions(+), 19 deletions(-)

diff --git a/arch/powerpc/configs/g5_defconfig 
b/arch/powerpc/configs/g5_defconfig
index e084fa548d73..063817fee61c 100644
--- a/arch/powerpc/configs/g5_defconfig
+++ b/arch/powerpc/configs/g5_defconfig
@@ -138,10 +138,11 @@ CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_LOGO=y
 CONFIG_SOUND=m
 CONFIG_SND=m
-CONFIG_SND_SEQUENCER=m
+CONFIG_SND_OSSEMUL=y
 CONFIG_SND_MIXER_OSS=m
 CONFIG_SND_PCM_OSS=m
-CONFIG_SND_SEQUENCER_OSS=y
+CONFIG_SND_SEQUENCER=m
+CONFIG_SND_SEQUENCER_OSS=m
 CONFIG_SND_POWERMAC=m
 CONFIG_SND_AOA=m
 CONFIG_SND_AOA_FABRIC_LAYOUT=m
diff --git a/arch/powerpc/configs/gamecube_defconfig 
b/arch/powerpc/configs/gamecube_defconfig
index 79bbc8238b32..805b0f87653c 100644
--- a/arch/powerpc/configs/gamecube_defconfig
+++ b/arch/powerpc/configs/gamecube_defconfig
@@ -64,11 +64,12 @@ CONFIG_LOGO=y
 # CONFIG_LOGO_LINUX_CLUT224 is not set
 CONFIG_SOUND=y
 CONFIG_SND=y
-CONFIG_SND_SEQUENCER=y
+CONFIG_SND_OSSEMUL=y
 CONFIG_SND_MIXER_OSS=y
 CONFIG_SND_PCM_OSS=y
-CONFIG_SND_SEQUENCER_OSS=y
 # CONFIG_SND_VERBOSE_PROCFS is not set
+CONFIG_SND_SEQUENCER=y
+CONFIG_SND_SEQUENCER_OSS=y
 # CONFIG_USB_SUPPORT is not set
 CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_GENERIC=y
diff --git a/arch/powerpc/configs/pasemi_defconfig 
b/arch/powerpc/configs/pasemi_defconfig
index 8cf4a46bef86..6daa56f8895c 100644
--- a/arch/powerpc/configs/pasemi_defconfig
+++ b/arch/powerpc/configs/pasemi_defconfig
@@ -115,9 +115,10 @@ CONFIG_VGACON_SOFT_SCROLLBACK=y
 CONFIG_LOGO=y
 CONFIG_SOUND=y
 CONFIG_SND=y
-CONFIG_SND_SEQUENCER=y
+CONFIG_SND_OSSEMUL=y
 CONFIG_SND_MIXER_OSS=y
 CONFIG_SND_PCM_OSS=y
+CONFIG_SND_SEQUENCER=y
 CONFIG_SND_SEQUENCER_OSS=y
 CONFIG_SND_USB_AUDIO=y
 CONFIG_SND_USB_USX2Y=y
diff --git a/arch/powerpc/configs/pmac32_defconfig 
b/arch/powerpc/configs/pmac32_defconfig
index 8e798b1fbc99..1aab9a62a681 100644
--- a/arch/powerpc/configs/pmac32_defconfig
+++ b/arch/powerpc/configs/pmac32_defconfig
@@ -227,11 +227,12 @@ CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_LOGO=y
 CONFIG_SOUND=m
 CONFIG_SND=m
-CONFIG_SND_SEQUENCER=m
-CONFIG_SND_SEQ_DUMMY=m
+CONFIG_SND_OSSEMUL=y
 CONFIG_SND_MIXER_OSS=m
 CONFIG_SND_PCM_OSS=m
-CONFIG_SND_SEQUENCER_OSS=y
+CONFIG_SND_SEQUENCER=m
+CONFIG_SND_SEQ_DUMMY=m
+CONFIG_SND_SEQUENCER_OSS=m
 CONFIG_SND_DUMMY=m
 CONFIG_SND_POWERMAC=m
 CONFIG_SND_AOA=m
diff --git a/arch/powerpc/configs/ppc64_defconfig 
b/arch/powerpc/configs/ppc64_defconfig
index 3a1697f97fef..8b8ee9e83010 100644
--- a/arch/powerpc/configs/ppc64_defconfig
+++ b/arch/powerpc/configs/ppc64_defconfig
@@ -220,11 +220,12 @@ CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_LOGO=y
 CONFIG_SOUND=m
 CONFIG_SND=m
-CONFIG_SND_SEQUENCER=m
-CONFIG_SND_SEQ_DUMMY=m
+CONFIG_SND_OSSEMUL=y
 CONFIG_SND_MIXER_OSS=m
 CONFIG_SND_PCM_OSS=m
-CONFIG_SND_SEQUENCER_OSS=y
+CONFIG_SND_SEQUENCER=m
+CONFIG_SND_SEQ_DUMMY=m
+CONFIG_SND_SEQUENCER_OSS=m
 CONFIG_SND_POWERMAC=m
 CONFIG_SND_AOA=m
 CONFIG_SND_AOA_FABRIC_LAYOUT=m
diff --git a/arch/powerpc/configs/ppc64e_defconfig 
b/arch/powerpc/configs/ppc64e_defconfig
index d0fe0f8f77c2..41d85cb3c9a2 100644
--- a/arch/powerpc/configs/ppc64e_defconfig
+++ b/arch/powerpc/configs/ppc64e_defconfig
@@ -141,11 +141,12 @@ CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_LOGO=y
 CONFIG_SOUND=m
 CONFIG_SND=m
-CONFIG_SND_SEQUENCER=m
-CONFIG_SND_SEQ_DUMMY=m
+CONFIG_SND_OSSEMUL=y
 CONFIG_SND_MIXER_OSS=m
 CONFIG_SND_PCM_OSS=m
-CONFIG_SND_SEQUENCER_OSS=y
+CONFIG_SND_SEQUENCER=m
+CONFIG_SND_SEQ_DUMMY=m
+CONFIG_SND_SEQUENCER_OSS=m
 CONFIG_HID_DRAGONRISE=y
 CONFIG_HID_GYRATION=y
 CONFIG_HID_TWINHAN=y
diff --git a/arch/powerpc/configs/ppc6xx_defconfig 
b/arch/powerpc/configs/ppc6xx_defconfig
index ef817c7e83d4..60ccfa966ea9 100644
--- a/arch/powerpc/configs/ppc6xx_defconfig
+++ b/arch/powerpc/configs/ppc6xx_defconfig
@@ -793,17 +793,18 @@ CONFIG_LOGO=y
 # CONFIG_LOGO_LINUX_VGA16 is not set
 CONFIG_SOUND=m
 CONFIG_SND=m
-CONFIG_SND_SEQUENCER=m
-CONFIG_SND_SEQ_DUMMY=m
+CONFIG_SND_OSSEMUL=y
 CONFIG_SND_MIXER_OSS=m
 CONFIG_SND_PCM_OSS=m
-CONFIG_SND_SEQUENCER_OSS=y
 CONFIG_SND_DYNAMIC_MINORS=y
 # CONFIG_SND_SUPPORT_OLD_API is not set
 CONFIG_SND_VERBOSE_PRINTK=y
 CONFIG_SND_DEBUG=y
 CONFIG_SND_DEBUG_VERBOSE=y
 CONFIG_SND_PCM_XRUN_DEBUG=y
+CONFIG_SND_SEQUENCER=m
+CONFIG_SND_SEQ_DUMMY=m

[PATCH 32/46] powerpc/configs: Update for CONFIG_INPUT_MOUSEDEV=n

2017-08-23 Thread Michael Ellerman
In commit 73d8ef76006b ("Input: mousedev - stop offering PS/2 to
userspace by default") the symbol INPUT_MOUSEDEV went from being
'default y' to 'default n' (implied).

That means we no longer need to explicitly disable it in our
defconfigs.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/83xx/asp8347_defconfig | 1 -
 arch/powerpc/configs/83xx/mpc8313_rdb_defconfig | 1 -
 arch/powerpc/configs/83xx/mpc8315_rdb_defconfig | 1 -
 arch/powerpc/configs/83xx/mpc832x_mds_defconfig | 1 -
 arch/powerpc/configs/83xx/mpc832x_rdb_defconfig | 1 -
 arch/powerpc/configs/83xx/mpc834x_mds_defconfig | 1 -
 arch/powerpc/configs/83xx/mpc836x_mds_defconfig | 1 -
 arch/powerpc/configs/83xx/mpc836x_rdk_defconfig | 1 -
 arch/powerpc/configs/83xx/mpc837x_mds_defconfig | 1 -
 arch/powerpc/configs/83xx/mpc837x_rdb_defconfig | 1 -
 arch/powerpc/configs/83xx/sbc834x_defconfig | 1 -
 arch/powerpc/configs/85xx/ksi8560_defconfig | 1 -
 arch/powerpc/configs/85xx/mpc8540_ads_defconfig | 1 -
 arch/powerpc/configs/85xx/mpc8560_ads_defconfig | 1 -
 arch/powerpc/configs/85xx/mpc85xx_cds_defconfig | 1 -
 arch/powerpc/configs/85xx/sbc8548_defconfig | 1 -
 arch/powerpc/configs/85xx/tqm8540_defconfig | 1 -
 arch/powerpc/configs/85xx/tqm8541_defconfig | 1 -
 arch/powerpc/configs/85xx/tqm8548_defconfig | 1 -
 arch/powerpc/configs/85xx/tqm8555_defconfig | 1 -
 arch/powerpc/configs/85xx/tqm8560_defconfig | 1 -
 arch/powerpc/configs/85xx/xes_mpc85xx_defconfig | 1 -
 arch/powerpc/configs/gamecube_defconfig | 1 -
 arch/powerpc/configs/holly_defconfig| 1 -
 arch/powerpc/configs/mpc7448_hpc2_defconfig | 1 -
 arch/powerpc/configs/mpc83xx_defconfig  | 1 -
 26 files changed, 26 deletions(-)

diff --git a/arch/powerpc/configs/83xx/asp8347_defconfig 
b/arch/powerpc/configs/83xx/asp8347_defconfig
index 9f4467abe3d0..dd884df32dfd 100644
--- a/arch/powerpc/configs/83xx/asp8347_defconfig
+++ b/arch/powerpc/configs/83xx/asp8347_defconfig
@@ -42,7 +42,6 @@ CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_SIZE=32768
 CONFIG_NETDEVICES=y
 CONFIG_GIANFAR=y
-# CONFIG_INPUT_MOUSEDEV is not set
 # CONFIG_INPUT_KEYBOARD is not set
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_SERIO is not set
diff --git a/arch/powerpc/configs/83xx/mpc8313_rdb_defconfig 
b/arch/powerpc/configs/83xx/mpc8313_rdb_defconfig
index 45e7146e2ea3..1f69f4edf074 100644
--- a/arch/powerpc/configs/83xx/mpc8313_rdb_defconfig
+++ b/arch/powerpc/configs/83xx/mpc8313_rdb_defconfig
@@ -48,7 +48,6 @@ CONFIG_NETDEVICES=y
 CONFIG_GIANFAR=y
 CONFIG_E100=y
 CONFIG_CICADA_PHY=y
-# CONFIG_INPUT_MOUSEDEV is not set
 # CONFIG_INPUT_KEYBOARD is not set
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_SERIO is not set
diff --git a/arch/powerpc/configs/83xx/mpc8315_rdb_defconfig 
b/arch/powerpc/configs/83xx/mpc8315_rdb_defconfig
index d22cc8ee92ab..797fc3ffddee 100644
--- a/arch/powerpc/configs/83xx/mpc8315_rdb_defconfig
+++ b/arch/powerpc/configs/83xx/mpc8315_rdb_defconfig
@@ -47,7 +47,6 @@ CONFIG_MD_RAID1=y
 CONFIG_NETDEVICES=y
 CONFIG_GIANFAR=y
 CONFIG_E100=y
-# CONFIG_INPUT_MOUSEDEV is not set
 # CONFIG_INPUT_KEYBOARD is not set
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_SERIO is not set
diff --git a/arch/powerpc/configs/83xx/mpc832x_mds_defconfig 
b/arch/powerpc/configs/83xx/mpc832x_mds_defconfig
index 507d5af9fa99..4f914906ee4b 100644
--- a/arch/powerpc/configs/83xx/mpc832x_mds_defconfig
+++ b/arch/powerpc/configs/83xx/mpc832x_mds_defconfig
@@ -35,7 +35,6 @@ CONFIG_SCSI=y
 CONFIG_NETDEVICES=y
 CONFIG_UCC_GETH=y
 CONFIG_DAVICOM_PHY=y
-# CONFIG_INPUT_MOUSEDEV is not set
 # CONFIG_INPUT_KEYBOARD is not set
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_SERIO is not set
diff --git a/arch/powerpc/configs/83xx/mpc832x_rdb_defconfig 
b/arch/powerpc/configs/83xx/mpc832x_rdb_defconfig
index aabd75860cfe..a484eb8401e8 100644
--- a/arch/powerpc/configs/83xx/mpc832x_rdb_defconfig
+++ b/arch/powerpc/configs/83xx/mpc832x_rdb_defconfig
@@ -38,7 +38,6 @@ CONFIG_NETDEVICES=y
 CONFIG_UCC_GETH=y
 CONFIG_E1000=y
 CONFIG_ICPLUS_PHY=y
-# CONFIG_INPUT_MOUSEDEV is not set
 # CONFIG_INPUT_KEYBOARD is not set
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_SERIO is not set
diff --git a/arch/powerpc/configs/83xx/mpc834x_mds_defconfig 
b/arch/powerpc/configs/83xx/mpc834x_mds_defconfig
index 48575b3e8949..d7ce3551529d 100644
--- a/arch/powerpc/configs/83xx/mpc834x_mds_defconfig
+++ b/arch/powerpc/configs/83xx/mpc834x_mds_defconfig
@@ -35,7 +35,6 @@ CONFIG_NETDEVICES=y
 CONFIG_GIANFAR=y
 CONFIG_E100=y
 CONFIG_MARVELL_PHY=y
-# CONFIG_INPUT_MOUSEDEV is not set
 # CONFIG_INPUT_KEYBOARD is not set
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_SERIO is not set
diff --git a/arch/powerpc/configs/83xx/mpc836x_mds_defconfig 
b/arch/powerpc/configs/83xx/mpc836x_mds_defconfig
index ffcbf10b3244..92134cee3f37 100644
--- a/arch/powerpc/configs/83xx/mpc836x_mds_defconfig
+++ b/arch/powerpc/configs/83xx/mpc836x_mds_defconfig
@@ -40,7 +40,6 @@ CONFIG_SCSI=y
 CONFIG_NETDEVICES=y
 

[PATCH 31/46] powerpc/configs: Drop removed CONFIG_LOGFS

2017-08-23 Thread Michael Ellerman
In commit 1d0fd57a50aa ("logfs: remove from tree"), logfs was removed
from the tree, so we can drop it from our defconfigs.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/ppc44x_defconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/configs/ppc44x_defconfig 
b/arch/powerpc/configs/ppc44x_defconfig
index 3587527921ec..66dd6bf45cde 100644
--- a/arch/powerpc/configs/ppc44x_defconfig
+++ b/arch/powerpc/configs/ppc44x_defconfig
@@ -94,7 +94,6 @@ CONFIG_PROC_KCORE=y
 CONFIG_TMPFS=y
 CONFIG_JFFS2_FS=y
 CONFIG_UBIFS_FS=m
-CONFIG_LOGFS=m
 CONFIG_CRAMFS=y
 CONFIG_SQUASHFS=m
 CONFIG_SQUASHFS_XATTR=y
-- 
2.7.4



[PATCH 30/46] powerpc/configs: Turn CONFIG_R128 back in pmac32_defconfig

2017-08-23 Thread Michael Ellerman
In commit d92d9c3a1448 ("drm: hide legacy drivers with
CONFIG_DRM_LEGACY") CONFIG_R128 was moved behind CONFIG_DRM_LEGACY
meaning it stopped being enabled by pmac32_defconfig. Although no one
has noticed, given this is basically a legacy platform, it seems
anyone who is using it probably still wants this driver. So turn it
back on for now.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/pmac32_defconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/configs/pmac32_defconfig 
b/arch/powerpc/configs/pmac32_defconfig
index 441139e744d3..8e798b1fbc99 100644
--- a/arch/powerpc/configs/pmac32_defconfig
+++ b/arch/powerpc/configs/pmac32_defconfig
@@ -201,8 +201,9 @@ CONFIG_HWMON=m
 CONFIG_AGP=m
 CONFIG_AGP_UNINORTH=m
 CONFIG_DRM=m
-CONFIG_DRM_R128=m
 CONFIG_DRM_RADEON=m
+CONFIG_DRM_LEGACY=y
+CONFIG_DRM_R128=m
 CONFIG_FB=y
 CONFIG_FB_OF=y
 CONFIG_FB_CONTROL=y
-- 
2.7.4



[PATCH 29/46] powerpc/configs: Drop no longer needed CONFIG_LIBCRC32C

2017-08-23 Thread Michael Ellerman
Since commit 300ae149468f ("netfilter: select LIBCRC32C together with
SCTP conntrack") we no longer need to set CONFIG_LIBCRC32C in our
defconfigs.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/pmac32_defconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/configs/pmac32_defconfig 
b/arch/powerpc/configs/pmac32_defconfig
index ed0a0bb6a271..441139e744d3 100644
--- a/arch/powerpc/configs/pmac32_defconfig
+++ b/arch/powerpc/configs/pmac32_defconfig
@@ -300,7 +300,6 @@ CONFIG_NFSD_V4=y
 CONFIG_NLS_CODEPAGE_437=m
 CONFIG_NLS_ISO8859_1=m
 CONFIG_CRC_T10DIF=y
-CONFIG_LIBCRC32C=m
 CONFIG_MAGIC_SYSRQ=y
 CONFIG_DEBUG_KERNEL=y
 CONFIG_DETECT_HUNG_TASK=y
-- 
2.7.4



[PATCH 28/46] powerpc/configs: Drop unnecessary CONFIG_EDAC from ppc64e

2017-08-23 Thread Michael Ellerman
There are no EDAC drivers for ppc64e.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/ppc64e_defconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/configs/ppc64e_defconfig 
b/arch/powerpc/configs/ppc64e_defconfig
index 1f5e0b107083..d0fe0f8f77c2 100644
--- a/arch/powerpc/configs/ppc64e_defconfig
+++ b/arch/powerpc/configs/ppc64e_defconfig
@@ -170,7 +170,6 @@ CONFIG_INFINIBAND=m
 CONFIG_INFINIBAND_MTHCA=m
 CONFIG_INFINIBAND_IPOIB=m
 CONFIG_INFINIBAND_ISER=m
-CONFIG_EDAC=y
 CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_DS1307=y
 CONFIG_EXT2_FS=y
-- 
2.7.4



[PATCH 27/46] powerpc/configs: Drop no longer needed CONFIG_SCSI

2017-08-23 Thread Michael Ellerman
Since commit 67f6d6655993 ("powerpc: convert amigaone_defconfig to use
libata PATA drivers") we no longer need to set CONFIG_SCSI in our
defconfigs.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/amigaone_defconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/configs/amigaone_defconfig 
b/arch/powerpc/configs/amigaone_defconfig
index abd0a8dc9507..12f397d403c6 100644
--- a/arch/powerpc/configs/amigaone_defconfig
+++ b/arch/powerpc/configs/amigaone_defconfig
@@ -45,7 +45,6 @@ CONFIG_PARPORT_PC_FIFO=y
 CONFIG_BLK_DEV_FD=y
 CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_RAM=y
-CONFIG_SCSI=y
 CONFIG_BLK_DEV_SD=y
 CONFIG_CHR_DEV_ST=y
 CONFIG_BLK_DEV_SR=y
-- 
2.7.4



[PATCH 26/46] powerpc/configs: Drop no longer needed CONFIG_IPV6

2017-08-23 Thread Michael Ellerman
Since commit de551f2eb22a ("net: Build IPv6 into kernel by default")
we no longer need to set CONFIG_IPV6 in our defconfigs.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/85xx/xes_mpc85xx_defconfig | 1 -
 arch/powerpc/configs/cell_defconfig | 1 -
 2 files changed, 2 deletions(-)

diff --git a/arch/powerpc/configs/85xx/xes_mpc85xx_defconfig 
b/arch/powerpc/configs/85xx/xes_mpc85xx_defconfig
index c096c9a07da7..185302fb5bce 100644
--- a/arch/powerpc/configs/85xx/xes_mpc85xx_defconfig
+++ b/arch/powerpc/configs/85xx/xes_mpc85xx_defconfig
@@ -54,7 +54,6 @@ CONFIG_IP_PIMSM_V2=y
 # CONFIG_INET_XFRM_MODE_TRANSPORT is not set
 # CONFIG_INET_XFRM_MODE_TUNNEL is not set
 # CONFIG_INET_XFRM_MODE_BEET is not set
-CONFIG_IPV6=y
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 CONFIG_MTD=y
 CONFIG_MTD_REDBOOT_PARTS=y
diff --git a/arch/powerpc/configs/cell_defconfig 
b/arch/powerpc/configs/cell_defconfig
index 31a7fe3ac4a8..560a93a84efe 100644
--- a/arch/powerpc/configs/cell_defconfig
+++ b/arch/powerpc/configs/cell_defconfig
@@ -52,7 +52,6 @@ CONFIG_IP_PNP_RARP=y
 CONFIG_NET_IPIP=y
 CONFIG_SYN_COOKIES=y
 # CONFIG_INET_XFRM_MODE_BEET is not set
-CONFIG_IPV6=y
 CONFIG_INET6_AH=m
 CONFIG_INET6_ESP=m
 CONFIG_INET6_IPCOMP=m
-- 
2.7.4



[PATCH 25/46] powerpc/configs: Add CONFIG_RAS now required for CONFIG_EDAC

2017-08-23 Thread Michael Ellerman
In commit e3c4ff6d8c94 ("EDAC: Remove EDAC_MM_EDAC") CONFIG_EDAC grew
a dependency on CONFIG_RAS. Some of our defconfigs don't have the
latter, which means we lose CONFIG_EDAC, so add CONFIG_RAS to fix
that.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/pasemi_defconfig | 1 +
 arch/powerpc/configs/ppc64_defconfig  | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/powerpc/configs/pasemi_defconfig 
b/arch/powerpc/configs/pasemi_defconfig
index 9d43214a4de4..8cf4a46bef86 100644
--- a/arch/powerpc/configs/pasemi_defconfig
+++ b/arch/powerpc/configs/pasemi_defconfig
@@ -144,6 +144,7 @@ CONFIG_EDAC=y
 CONFIG_EDAC_PASEMI=y
 CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_DS1307=y
+CONFIG_RAS=y
 CONFIG_EXT2_FS=y
 CONFIG_EXT2_FS_XATTR=y
 CONFIG_EXT2_FS_POSIX_ACL=y
diff --git a/arch/powerpc/configs/ppc64_defconfig 
b/arch/powerpc/configs/ppc64_defconfig
index 119273e6ba04..3a1697f97fef 100644
--- a/arch/powerpc/configs/ppc64_defconfig
+++ b/arch/powerpc/configs/ppc64_defconfig
@@ -264,6 +264,7 @@ CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_DS1307=y
 CONFIG_VIRTIO_PCI=m
 CONFIG_VIRTIO_BALLOON=m
+CONFIG_RAS=y
 CONFIG_EXT2_FS=y
 CONFIG_EXT2_FS_XATTR=y
 CONFIG_EXT2_FS_POSIX_ACL=y
-- 
2.7.4



[PATCH 24/46] powerpc/configs: Drop no longer needed CONFIG_AUDITSYSCALL

2017-08-23 Thread Michael Ellerman
Since commit cb74ed278f80 ("audit: always enable syscall auditing when
supported and audit is enabled") we no longer need to set
CONFIG_AUDITSYSCALL in our defconfigs.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/pseries_defconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/configs/pseries_defconfig 
b/arch/powerpc/configs/pseries_defconfig
index 08cf7bb14233..8131e12df6b7 100644
--- a/arch/powerpc/configs/pseries_defconfig
+++ b/arch/powerpc/configs/pseries_defconfig
@@ -3,7 +3,6 @@ CONFIG_NR_CPUS=2048
 CONFIG_SYSVIPC=y
 CONFIG_POSIX_MQUEUE=y
 CONFIG_AUDIT=y
-CONFIG_AUDITSYSCALL=y
 CONFIG_IRQ_DOMAIN_DEBUG=y
 CONFIG_NO_HZ=y
 CONFIG_HIGH_RES_TIMERS=y
-- 
2.7.4



[PATCH 23/46] powerpc/configs: Drop CONFIG_SERIAL_TXX9_* from cell/ppc64

2017-08-23 Thread Michael Ellerman
In commit bf4981a00636 ("powerpc: Remove the celleb support") we
dropped the celleb support, which made these symbols unselectable
because we no longer select HAS_TX99_SERIAL. So drop them from the
defconfigs.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/cell_defconfig  | 2 --
 arch/powerpc/configs/ppc64_defconfig | 1 -
 2 files changed, 3 deletions(-)

diff --git a/arch/powerpc/configs/cell_defconfig 
b/arch/powerpc/configs/cell_defconfig
index c6fb2092af38..31a7fe3ac4a8 100644
--- a/arch/powerpc/configs/cell_defconfig
+++ b/arch/powerpc/configs/cell_defconfig
@@ -147,8 +147,6 @@ CONFIG_SPIDER_NET=y
 CONFIG_SERIAL_NONSTANDARD=y
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
-CONFIG_SERIAL_TXX9_NR_UARTS=2
-CONFIG_SERIAL_TXX9_CONSOLE=y
 CONFIG_SERIAL_OF_PLATFORM=y
 CONFIG_HVC_RTAS=y
 CONFIG_IPMI_HANDLER=m
diff --git a/arch/powerpc/configs/ppc64_defconfig 
b/arch/powerpc/configs/ppc64_defconfig
index c3ff99646dcd..119273e6ba04 100644
--- a/arch/powerpc/configs/ppc64_defconfig
+++ b/arch/powerpc/configs/ppc64_defconfig
@@ -192,7 +192,6 @@ CONFIG_INPUT_PCSPKR=m
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_SERIAL_ICOM=m
-CONFIG_SERIAL_TXX9_CONSOLE=y
 CONFIG_SERIAL_JSM=m
 CONFIG_HVC_CONSOLE=y
 CONFIG_HVC_RTAS=y
-- 
2.7.4



[PATCH 22/46] powerpc/configs: Drop MEMORY_HOTREMOVE from ppc64/cell

2017-08-23 Thread Michael Ellerman


In commit 577ec789a79e ("powerpc/cell: Drop select of MEMORY_HOTPLUG")
we removed the last traces of any dependency between
---
 arch/powerpc/configs/cell_defconfig  | 1 -
 arch/powerpc/configs/ppc64_defconfig | 1 -
 2 files changed, 2 deletions(-)

diff --git a/arch/powerpc/configs/cell_defconfig 
b/arch/powerpc/configs/cell_defconfig
index 65299b2846bb..c6fb2092af38 100644
--- a/arch/powerpc/configs/cell_defconfig
+++ b/arch/powerpc/configs/cell_defconfig
@@ -37,7 +37,6 @@ CONFIG_GEN_RTC=y
 CONFIG_BINFMT_MISC=m
 CONFIG_IRQ_ALL_CPUS=y
 CONFIG_NUMA=y
-CONFIG_MEMORY_HOTREMOVE=y
 CONFIG_PPC_64K_PAGES=y
 CONFIG_SCHED_SMT=y
 CONFIG_PCIEPORTBUS=y
diff --git a/arch/powerpc/configs/ppc64_defconfig 
b/arch/powerpc/configs/ppc64_defconfig
index a5bd462bc61f..c3ff99646dcd 100644
--- a/arch/powerpc/configs/ppc64_defconfig
+++ b/arch/powerpc/configs/ppc64_defconfig
@@ -49,7 +49,6 @@ CONFIG_KEXEC=y
 CONFIG_KEXEC_FILE=y
 CONFIG_CRASH_DUMP=y
 CONFIG_IRQ_ALL_CPUS=y
-CONFIG_MEMORY_HOTREMOVE=y
 CONFIG_KSM=y
 CONFIG_SCHED_SMT=y
 CONFIG_HOTPLUG_PCI=y
-- 
2.7.4



[PATCH 20/46] powerpc/configs: Drop no longer needed PCI_MSI on powernv

2017-08-23 Thread Michael Ellerman
In commit a311e738b6d8 ("powerpc/powernv: Make PCI non-optional") we
made PCI (and therefore PCI_MSI) non-optional on powernv, so it
doesn't need to be in the defconfig anymore.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/powernv_defconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/configs/powernv_defconfig 
b/arch/powerpc/configs/powernv_defconfig
index 48c69c75136b..a911ff57105a 100644
--- a/arch/powerpc/configs/powernv_defconfig
+++ b/arch/powerpc/configs/powernv_defconfig
@@ -60,7 +60,6 @@ CONFIG_PPC_64K_PAGES=y
 CONFIG_PPC_SUBPAGE_PROT=y
 CONFIG_SCHED_SMT=y
 CONFIG_PM=y
-CONFIG_PCI_MSI=y
 CONFIG_HOTPLUG_PCI=y
 CONFIG_NET=y
 CONFIG_PACKET=y
-- 
2.7.4



[PATCH 21/46] powerpc/configs: Drop unnecessary CONFIG_POWERNV_OP_PANEL

2017-08-23 Thread Michael Ellerman
In commit 43a1dd9b5fc6 ("powerpc/powernv: Add driver for operator
panel on FSP machines") we added CONFIG_POWERNV_OP_PANEL=m to the
powernv defconfig, but it's default m so that's no necessary.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/powernv_defconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/configs/powernv_defconfig 
b/arch/powerpc/configs/powernv_defconfig
index a911ff57105a..f89d9b1799b6 100644
--- a/arch/powerpc/configs/powernv_defconfig
+++ b/arch/powerpc/configs/powernv_defconfig
@@ -187,7 +187,6 @@ CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_SERIAL_JSM=m
 CONFIG_VIRTIO_CONSOLE=m
-CONFIG_POWERNV_OP_PANEL=m
 CONFIG_IPMI_HANDLER=y
 CONFIG_IPMI_DEVICE_INTERFACE=y
 CONFIG_IPMI_POWERNV=y
-- 
2.7.4



[PATCH 19/46] powerpc/configs: Drop no longer needed CONFIG_SMP for pseries/ppc64/powernv

2017-08-23 Thread Michael Ellerman
In commit 40e275653e2c ("powerpc/powernv: Always enable SMP when
building powernv") and 270e2dc9b803 ("powerpc/pseries: Always enable
SMP when building pseries") we forced CONFIG_SMP on for some configs.
Therefore we don't need to set it in those configs anymore.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/powernv_defconfig | 1 -
 arch/powerpc/configs/ppc64_defconfig   | 1 -
 arch/powerpc/configs/pseries_defconfig | 1 -
 3 files changed, 3 deletions(-)

diff --git a/arch/powerpc/configs/powernv_defconfig 
b/arch/powerpc/configs/powernv_defconfig
index e10e57b5c7e2..48c69c75136b 100644
--- a/arch/powerpc/configs/powernv_defconfig
+++ b/arch/powerpc/configs/powernv_defconfig
@@ -1,5 +1,4 @@
 CONFIG_PPC64=y
-CONFIG_SMP=y
 CONFIG_NR_CPUS=2048
 CONFIG_CPU_LITTLE_ENDIAN=y
 CONFIG_SYSVIPC=y
diff --git a/arch/powerpc/configs/ppc64_defconfig 
b/arch/powerpc/configs/ppc64_defconfig
index ee626d3c5ba8..a5bd462bc61f 100644
--- a/arch/powerpc/configs/ppc64_defconfig
+++ b/arch/powerpc/configs/ppc64_defconfig
@@ -1,5 +1,4 @@
 CONFIG_PPC64=y
-CONFIG_SMP=y
 CONFIG_SYSVIPC=y
 CONFIG_POSIX_MQUEUE=y
 CONFIG_IRQ_DOMAIN_DEBUG=y
diff --git a/arch/powerpc/configs/pseries_defconfig 
b/arch/powerpc/configs/pseries_defconfig
index 7f8f9f7314c2..08cf7bb14233 100644
--- a/arch/powerpc/configs/pseries_defconfig
+++ b/arch/powerpc/configs/pseries_defconfig
@@ -1,5 +1,4 @@
 CONFIG_PPC64=y
-CONFIG_SMP=y
 CONFIG_NR_CPUS=2048
 CONFIG_SYSVIPC=y
 CONFIG_POSIX_MQUEUE=y
-- 
2.7.4



[PATCH 18/46] powerpc/configs: Drop unnecessary CONFIG_UPROBE_EVENT

2017-08-23 Thread Michael Ellerman
In commit 6b0b7551428e ("perf/core: Rename CONFIG_[UK]PROBE_EVENT to
CONFIG_[UK]PROBE_EVENTS") it was renamed to CONFIG_UPROBE_EVENTS.

Additionally it's default y, and we have the prerequisites enabled, so
we don't need it in our defconfigs.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/powernv_defconfig | 1 -
 arch/powerpc/configs/ppc64_defconfig   | 1 -
 arch/powerpc/configs/pseries_defconfig | 1 -
 3 files changed, 3 deletions(-)

diff --git a/arch/powerpc/configs/powernv_defconfig 
b/arch/powerpc/configs/powernv_defconfig
index 2c8c4011f38a..e10e57b5c7e2 100644
--- a/arch/powerpc/configs/powernv_defconfig
+++ b/arch/powerpc/configs/powernv_defconfig
@@ -294,7 +294,6 @@ CONFIG_HARDLOCKUP_DETECTOR=y
 CONFIG_LATENCYTOP=y
 CONFIG_SCHED_TRACER=y
 CONFIG_BLK_DEV_IO_TRACE=y
-CONFIG_UPROBE_EVENT=y
 CONFIG_CODE_PATCHING_SELFTEST=y
 CONFIG_FTR_FIXUP_SELFTEST=y
 CONFIG_MSI_BITMAP_SELFTEST=y
diff --git a/arch/powerpc/configs/ppc64_defconfig 
b/arch/powerpc/configs/ppc64_defconfig
index 7b1d17d85169..ee626d3c5ba8 100644
--- a/arch/powerpc/configs/ppc64_defconfig
+++ b/arch/powerpc/configs/ppc64_defconfig
@@ -330,7 +330,6 @@ CONFIG_DEBUG_MUTEXES=y
 CONFIG_LATENCYTOP=y
 CONFIG_SCHED_TRACER=y
 CONFIG_BLK_DEV_IO_TRACE=y
-CONFIG_UPROBE_EVENT=y
 CONFIG_CODE_PATCHING_SELFTEST=y
 CONFIG_FTR_FIXUP_SELFTEST=y
 CONFIG_MSI_BITMAP_SELFTEST=y
diff --git a/arch/powerpc/configs/pseries_defconfig 
b/arch/powerpc/configs/pseries_defconfig
index b5dbcaa1ec41..7f8f9f7314c2 100644
--- a/arch/powerpc/configs/pseries_defconfig
+++ b/arch/powerpc/configs/pseries_defconfig
@@ -294,7 +294,6 @@ CONFIG_HARDLOCKUP_DETECTOR=y
 CONFIG_LATENCYTOP=y
 CONFIG_SCHED_TRACER=y
 CONFIG_BLK_DEV_IO_TRACE=y
-CONFIG_UPROBE_EVENT=y
 CONFIG_CODE_PATCHING_SELFTEST=y
 CONFIG_FTR_FIXUP_SELFTEST=y
 CONFIG_MSI_BITMAP_SELFTEST=y
-- 
2.7.4



[PATCH 16/46] powerpc/configs: Drop no longer needed CONFIG_DEVPTS_MULTIPLE_INSTANCES

2017-08-23 Thread Michael Ellerman
Since commit eedf265aa003 ("devpts: Make each mount of devpts an
independent filesystem.") we no longer need to set
CONFIG_DEVPTS_MULTIPLE_INSTANCES in our defconfigs.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/powernv_defconfig | 1 -
 arch/powerpc/configs/pseries_defconfig | 1 -
 2 files changed, 2 deletions(-)

diff --git a/arch/powerpc/configs/powernv_defconfig 
b/arch/powerpc/configs/powernv_defconfig
index d4ee4abf461d..2c8c4011f38a 100644
--- a/arch/powerpc/configs/powernv_defconfig
+++ b/arch/powerpc/configs/powernv_defconfig
@@ -185,7 +185,6 @@ CONFIG_PPP_SYNC_TTY=m
 CONFIG_INPUT_EVDEV=m
 CONFIG_INPUT_MISC=y
 # CONFIG_SERIO_SERPORT is not set
-CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_SERIAL_JSM=m
diff --git a/arch/powerpc/configs/pseries_defconfig 
b/arch/powerpc/configs/pseries_defconfig
index 47dcef819697..8ea2db865fa7 100644
--- a/arch/powerpc/configs/pseries_defconfig
+++ b/arch/powerpc/configs/pseries_defconfig
@@ -185,7 +185,6 @@ CONFIG_INPUT_EVDEV=m
 CONFIG_INPUT_MISC=y
 CONFIG_INPUT_PCSPKR=m
 # CONFIG_SERIO_SERPORT is not set
-CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_SERIAL_ICOM=m
-- 
2.7.4



[PATCH 17/46] powerpc/configs: Drop unnecessary CONFIG_NUMA_BALANCING_DEFAULT_ENABLED

2017-08-23 Thread Michael Ellerman
In commit 9654f95a081a ("powerpc: Enable NUMA balancing in
pseries[_le]_defconfig") we added CONFIG_NUMA_BALANCING_DEFAULT_ENABLED
to our defconfigs. But it's already enabled by default, so drop it.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/pseries_defconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/configs/pseries_defconfig 
b/arch/powerpc/configs/pseries_defconfig
index 8ea2db865fa7..b5dbcaa1ec41 100644
--- a/arch/powerpc/configs/pseries_defconfig
+++ b/arch/powerpc/configs/pseries_defconfig
@@ -17,7 +17,6 @@ CONFIG_IKCONFIG_PROC=y
 CONFIG_LOG_BUF_SHIFT=18
 CONFIG_LOG_CPU_MAX_BUF_SHIFT=13
 CONFIG_NUMA_BALANCING=y
-CONFIG_NUMA_BALANCING_DEFAULT_ENABLED=y
 CONFIG_CGROUPS=y
 CONFIG_MEMCG=y
 CONFIG_MEMCG_SWAP=y
-- 
2.7.4



[PATCH 15/46] powerpc/configs: Drop no longer needed CONFIG_CRYPTO_GCM

2017-08-23 Thread Michael Ellerman
Since commit 00b9cfa3ff38 ("mac80111: Add GCMP and GCMP-256 ciphers")
we no longer need to set CONFIG_CRYPTO_GCM in our defconfigs.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/configs/ppc6xx_defconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/configs/ppc6xx_defconfig 
b/arch/powerpc/configs/ppc6xx_defconfig
index bad3e04163d0..ef817c7e83d4 100644
--- a/arch/powerpc/configs/ppc6xx_defconfig
+++ b/arch/powerpc/configs/ppc6xx_defconfig
@@ -1170,7 +1170,6 @@ CONFIG_SECURITY_SELINUX=y
 CONFIG_SECURITY_SELINUX_BOOTPARAM=y
 CONFIG_SECURITY_SELINUX_DISABLE=y
 CONFIG_CRYPTO_TEST=m
-CONFIG_CRYPTO_GCM=m
 CONFIG_CRYPTO_CTS=m
 CONFIG_CRYPTO_LRW=m
 CONFIG_CRYPTO_PCBC=m
-- 
2.7.4