From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Tue, 28 Jan 2014 05:11:26 +0000 (-0800)
Subject: Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1b17366d695c8ab03f98d0155357e97a427e1dce;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git

Merge branch 'next' of git://git./linux/kernel/git/benh/powerpc

Pull powerpc updates from Ben Herrenschmidt:
 "So here's my next branch for powerpc.  A bit late as I was on vacation
  last week.  It's mostly the same stuff that was in next already, I
  just added two patches today which are the wiring up of lockref for
  powerpc, which for some reason fell through the cracks last time and
  is trivial.

  The highlights are, in addition to a bunch of bug fixes:

   - Reworked Machine Check handling on kernels running without a
     hypervisor (or acting as a hypervisor).  Provides hooks to handle
     some errors in real mode such as TLB errors, handle SLB errors,
     etc...

   - Support for retrieving memory error information from the service
     processor on IBM servers running without a hypervisor and routing
     them to the memory poison infrastructure.

   - _PAGE_NUMA support on server processors

   - 32-bit BookE relocatable kernel support

   - FSL e6500 hardware tablewalk support

   - A bunch of new/revived board support

   - FSL e6500 deeper idle states and altivec powerdown support

  You'll notice a generic mm change here, it has been acked by the
  relevant authorities and is a pre-req for our _PAGE_NUMA support"

* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (121 commits)
  powerpc: Implement arch_spin_is_locked() using arch_spin_value_unlocked()
  powerpc: Add support for the optimised lockref implementation
  powerpc/powernv: Call OPAL sync before kexec'ing
  powerpc/eeh: Escalate error on non-existing PE
  powerpc/eeh: Handle multiple EEH errors
  powerpc: Fix transactional FP/VMX/VSX unavailable handlers
  powerpc: Don't corrupt transactional state when using FP/VMX in kernel
  powerpc: Reclaim two unused thread_info flag bits
  powerpc: Fix races with irq_work
  Move precessing of MCE queued event out from syscall exit path.
  pseries/cpuidle: Remove redundant call to ppc64_runlatch_off() in cpu idle routines
  powerpc: Make add_system_ram_resources() __init
  powerpc: add SATA_MV to ppc64_defconfig
  powerpc/powernv: Increase candidate fw image size
  powerpc: Add debug checks to catch invalid cpu-to-node mappings
  powerpc: Fix the setup of CPU-to-Node mappings during CPU online
  powerpc/iommu: Don't detach device without IOMMU group
  powerpc/eeh: Hotplug improvement
  powerpc/eeh: Call opal_pci_reinit() on powernv for restoring config space
  powerpc/eeh: Add restore_config operation
  ...
---

1b17366d695c8ab03f98d0155357e97a427e1dce
diff --cc arch/powerpc/include/asm/spinlock.h
index f6e78d63fb6a,a30ef6999d66..35aa339410bd
--- a/arch/powerpc/include/asm/spinlock.h
+++ b/arch/powerpc/include/asm/spinlock.h
@@@ -28,10 -28,6 +28,8 @@@
  #include <asm/synch.h>
  #include <asm/ppc-opcode.h>
  
 +#define smp_mb__after_unlock_lock()	smp_mb()  /* Full ordering for lock. */
 +
- #define arch_spin_is_locked(x)		((x)->slock != 0)
- 
  #ifdef CONFIG_PPC64
  /* use 0x800000yy when locked, where yy == CPU number */
  #ifdef __BIG_ENDIAN__
diff --cc arch/powerpc/kernel/eeh_driver.c
index c17f90d0f73c,baa3b06e6dab..7bb30dca4e19
--- a/arch/powerpc/kernel/eeh_driver.c
+++ b/arch/powerpc/kernel/eeh_driver.c
@@@ -637,86 -630,90 +641,92 @@@ static void eeh_handle_special_event(vo
  {
  	struct eeh_pe *pe, *phb_pe;
  	struct pci_bus *bus;
- 	struct pci_controller *hose, *tmp;
+ 	struct pci_controller *hose;
  	unsigned long flags;
- 	int rc = 0;
+ 	int rc;
  
- 	/*
- 	 * The return value from next_error() has been classified as follows.
- 	 * It might be good to enumerate them. However, next_error() is only
- 	 * supported by PowerNV platform for now. So it would be fine to use
- 	 * integer directly:
- 	 *
- 	 * 4 - Dead IOC           3 - Dead PHB
- 	 * 2 - Fenced PHB         1 - Frozen PE
- 	 * 0 - No error found
- 	 *
- 	 */
- 	rc = eeh_ops->next_error(&pe);
- 	if (rc <= 0)
- 		return;
  
- 	switch (rc) {
- 	case 4:
- 		/* Mark all PHBs in dead state */
- 		eeh_serialize_lock(&flags);
- 		list_for_each_entry_safe(hose, tmp,
- 				&hose_list, list_node) {
- 			phb_pe = eeh_phb_pe_get(hose);
- 			if (!phb_pe) continue;
- 
- 			eeh_pe_state_mark(phb_pe,
- 				EEH_PE_ISOLATED | EEH_PE_PHB_DEAD);
+ 	do {
+ 		rc = eeh_ops->next_error(&pe);
+ 
+ 		switch (rc) {
+ 		case EEH_NEXT_ERR_DEAD_IOC:
+ 			/* Mark all PHBs in dead state */
+ 			eeh_serialize_lock(&flags);
+ 
+ 			/* Purge all events */
+ 			eeh_remove_event(NULL);
+ 
+ 			list_for_each_entry(hose, &hose_list, list_node) {
+ 				phb_pe = eeh_phb_pe_get(hose);
+ 				if (!phb_pe) continue;
+ 
+ 				eeh_pe_state_mark(phb_pe,
+ 					EEH_PE_ISOLATED | EEH_PE_PHB_DEAD);
+ 			}
+ 
+ 			eeh_serialize_unlock(flags);
+ 
+ 			break;
+ 		case EEH_NEXT_ERR_FROZEN_PE:
+ 		case EEH_NEXT_ERR_FENCED_PHB:
+ 		case EEH_NEXT_ERR_DEAD_PHB:
+ 			/* Mark the PE in fenced state */
+ 			eeh_serialize_lock(&flags);
+ 
+ 			/* Purge all events of the PHB */
+ 			eeh_remove_event(pe);
+ 
+ 			if (rc == EEH_NEXT_ERR_DEAD_PHB)
+ 				eeh_pe_state_mark(pe,
+ 					EEH_PE_ISOLATED | EEH_PE_PHB_DEAD);
+ 			else
+ 				eeh_pe_state_mark(pe,
+ 					EEH_PE_ISOLATED | EEH_PE_RECOVERING);
+ 
+ 			eeh_serialize_unlock(flags);
+ 
+ 			break;
+ 		case EEH_NEXT_ERR_NONE:
+ 			return;
+ 		default:
+ 			pr_warn("%s: Invalid value %d from next_error()\n",
+ 				__func__, rc);
+ 			return;
  		}
- 		eeh_serialize_unlock(flags);
- 
- 		/* Purge all events */
- 		eeh_remove_event(NULL);
- 		break;
- 	case 3:
- 	case 2:
- 	case 1:
- 		/* Mark the PE in fenced state */
- 		eeh_serialize_lock(&flags);
- 		if (rc == 3)
- 			eeh_pe_state_mark(pe,
- 				EEH_PE_ISOLATED | EEH_PE_PHB_DEAD);
- 		else
- 			eeh_pe_state_mark(pe,
- 				EEH_PE_ISOLATED | EEH_PE_RECOVERING);
- 		eeh_serialize_unlock(flags);
- 
- 		/* Purge all events of the PHB */
- 		eeh_remove_event(pe);
- 		break;
- 	default:
- 		pr_err("%s: Invalid value %d from next_error()\n",
- 		       __func__, rc);
- 		return;
- 	}
  
- 	/*
- 	 * For fenced PHB and frozen PE, it's handled as normal
- 	 * event. We have to remove the affected PHBs for dead
- 	 * PHB and IOC
- 	 */
- 	if (rc == 2 || rc == 1)
- 		eeh_handle_normal_event(pe);
- 	else {
- 		pci_lock_rescan_remove();
- 		list_for_each_entry_safe(hose, tmp,
- 			&hose_list, list_node) {
- 			phb_pe = eeh_phb_pe_get(hose);
- 			if (!phb_pe || !(phb_pe->state & EEH_PE_PHB_DEAD))
- 				continue;
- 
- 			bus = eeh_pe_bus_get(phb_pe);
- 			/* Notify all devices that they're about to go down. */
- 			eeh_pe_dev_traverse(pe, eeh_report_failure, NULL);
- 			pcibios_remove_pci_devices(bus);
+ 		/*
+ 		 * For fenced PHB and frozen PE, it's handled as normal
+ 		 * event. We have to remove the affected PHBs for dead
+ 		 * PHB and IOC
+ 		 */
+ 		if (rc == EEH_NEXT_ERR_FROZEN_PE ||
+ 		    rc == EEH_NEXT_ERR_FENCED_PHB) {
+ 			eeh_handle_normal_event(pe);
+ 		} else {
++			pci_lock_rescan_remove();
+ 			list_for_each_entry(hose, &hose_list, list_node) {
+ 				phb_pe = eeh_phb_pe_get(hose);
+ 				if (!phb_pe ||
+ 				    !(phb_pe->state & EEH_PE_PHB_DEAD))
+ 					continue;
+ 
+ 				/* Notify all devices to be down */
+ 				bus = eeh_pe_bus_get(phb_pe);
+ 				eeh_pe_dev_traverse(pe,
+ 					eeh_report_failure, NULL);
+ 				pcibios_remove_pci_devices(bus);
+ 			}
++			pci_unlock_rescan_remove();
  		}
- 		pci_unlock_rescan_remove();
- 	}
+ 
+ 		/*
+ 		 * If we have detected dead IOC, we needn't proceed
+ 		 * any more since all PHBs would have been removed
+ 		 */
+ 		if (rc == EEH_NEXT_ERR_DEAD_IOC)
+ 			break;
+ 	} while (rc != EEH_NEXT_ERR_NONE);
  }
  
  /**
diff --cc arch/powerpc/platforms/powernv/opal-flash.c
index d8773079ce19,16e571ba4c60..714ef972406b
--- a/arch/powerpc/platforms/powernv/opal-flash.c
+++ b/arch/powerpc/platforms/powernv/opal-flash.c
@@@ -103,30 -103,9 +103,9 @@@ struct image_header_t 
  	uint32_t	size;
  };
  
- /* Scatter/gather entry */
- struct opal_sg_entry {
- 	void	*data;
- 	long	length;
- };
- 
- /* We calculate number of entries based on PAGE_SIZE */
- #define SG_ENTRIES_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct opal_sg_entry))
- 
- /*
-  * This struct is very similar but not identical to that
-  * needed by the opal flash update. All we need to do for
-  * opal is rewrite num_entries into a version/length and
-  * translate the pointers to absolute.
-  */
- struct opal_sg_list {
- 	unsigned long num_entries;
- 	struct opal_sg_list *next;
- 	struct opal_sg_entry entry[SG_ENTRIES_PER_NODE];
- };
- 
  struct validate_flash_t {
  	int		status;		/* Return status */
 -	void		*buf;		/* Candiate image buffer */
 +	void		*buf;		/* Candidate image buffer */
  	uint32_t	buf_size;	/* Image size */
  	uint32_t	result;		/* Update results token */
  };