Skip to contentSkip to conversation

ppc64: PCI cleanup

PATCH New Anton Blanchard 1 participant 5 messages Jan 10, 2005 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc64: PCI cleanup

- remove pci_fix_bus_sysdata. We required it for the old pci dma subsystem, but now it is useless.
- remove PCI_GET_PHB_PTR and use pci_bus_to_host instead
- remove pci_find_hose_for_OF_device
- remove some unused fields in struct pci_controller
- remove pci_device_loc stale prototype
- remove an old mask of pci bus number that was left around from the pre PCI domains days

arch/ppc64/kernel/maple_pci.c renamed from arch/ppc64/kernel/maple_pci.c~remove_pci_find_hose_for_OF_device +0 -3
diff -puN arch/ppc64/kernel/maple_pci.c~remove_pci_find_hose_for_OF_device arch/ppc64/kernel/maple_pci.c
@@ -382,9 +382,6 @@ void __init maple_pcibios_fixup(void)
 	/* Do the mapping of the IO space */
 	phbs_remap_io();
 
-	/* Fixup the pci_bus sysdata pointers */
-	pci_fix_bus_sysdata();
-
 	DBG(" <- maple_pcibios_fixup\n");
 }
 
arch/ppc64/kernel/pSeries_pci.c renamed from arch/ppc64/kernel/pSeries_pci.c~remove_pci_find_hose_for_OF_device +0 -1
diff -puN arch/ppc64/kernel/pSeries_pci.c~remove_pci_find_hose_for_OF_device arch/ppc64/kernel/pSeries_pci.c
@@ -552,7 +552,6 @@ void __init pSeries_final_fixup(void)
 
 	phbs_remap_io();
 	pSeries_request_regions();
-	pci_fix_bus_sysdata();
 
 	pci_addr_cache_build();
 }
arch/ppc64/kernel/pci.c renamed from arch/ppc64/kernel/pci.c~remove_pci_find_hose_for_OF_device +8 -25
diff -puN arch/ppc64/kernel/pci.c~remove_pci_find_hose_for_OF_device arch/ppc64/kernel/pci.c
@@ -91,7 +91,7 @@ void  pcibios_resource_to_bus(struct pci
 			      struct resource *res)
 {
 	unsigned long offset = 0;
-	struct pci_controller *hose = PCI_GET_PHB_PTR(dev);
+	struct pci_controller *hose = pci_bus_to_host(dev->bus);
 
 	if (!hose)
 		return;
@@ -127,7 +127,7 @@ void pcibios_align_resource(void *data, 
 			    unsigned long size, unsigned long align)
 {
 	struct pci_dev *dev = data;
-	struct pci_controller *hose = PCI_GET_PHB_PTR(dev);
+	struct pci_controller *hose = pci_bus_to_host(dev->bus);
 	unsigned long start = res->start;
 	unsigned long alignto;
 
@@ -292,7 +292,7 @@ int pci_domain_nr(struct pci_bus *bus)
 #ifdef CONFIG_PPC_ISERIES
 	return 0;
 #else
-	struct pci_controller *hose = PCI_GET_PHB_PTR(bus);
+	struct pci_controller *hose = pci_bus_to_host(bus);
 
 	return hose->global_number;
 #endif
@@ -304,7 +304,7 @@ EXPORT_SYMBOL(pci_domain_nr);
 int pci_name_bus(char *name, struct pci_bus *bus)
 {
 #ifndef CONFIG_PPC_ISERIES
-	struct pci_controller *hose = PCI_GET_PHB_PTR(bus);
+	struct pci_controller *hose = pci_bus_to_host(bus);
 
 	if (hose->buid)
 		sprintf(name, "%04x:%02x", pci_domain_nr(bus), bus->number);
@@ -336,7 +336,7 @@ static __inline__ int __pci_mmap_make_of
 					     struct vm_area_struct *vma,
 					     enum pci_mmap_state mmap_state)
 {
-	struct pci_controller *hose = PCI_GET_PHB_PTR(dev);
+	struct pci_controller *hose = pci_bus_to_host(dev->bus);
 	unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
 	unsigned long io_offset = 0;
 	int i, res_bit;
@@ -643,7 +643,7 @@ void __devinit pci_setup_phb_io_dynamic(
 static int get_bus_io_range(struct pci_bus *bus, unsigned long *start_phys,
 				unsigned long *start_virt, unsigned long *size)
 {
-	struct pci_controller *hose = PCI_GET_PHB_PTR(bus);
+	struct pci_controller *hose = pci_bus_to_host(bus);
 	struct pci_bus_region region;
 	struct resource *res;
 
@@ -728,23 +728,6 @@ void phbs_remap_io(void)
 		remap_bus_range(hose->bus);
 }
 
-
-/*
- * This function finds the PHB that matching device_node in the 
- * OpenFirmware by scanning all the pci_controllers.
- */
-struct pci_controller* pci_find_hose_for_OF_device(struct device_node *node)
-{
-	while (node) {
-		struct pci_controller *hose, *tmp;
-		list_for_each_entry_safe(hose, tmp, &hose_list, list_node)
-			if (hose->arch_data == node)
-				return hose;
-		node=node->parent;
-	}
-	return NULL;
-}
-
 /*
  * ppc64 can have multifunction devices that do not respond to function 0.
  * In this case we must scan all functions.
@@ -778,7 +761,7 @@ void __devinit pcibios_fixup_device_reso
 					   struct pci_bus *bus)
 {
 	/* Update device resources.  */
-	struct pci_controller *hose = PCI_GET_PHB_PTR(bus);
+	struct pci_controller *hose = pci_bus_to_host(bus);
 	int i;
 
 	for (i = 0; i < PCI_NUM_RESOURCES; i++) {
@@ -814,7 +797,7 @@ EXPORT_SYMBOL(pcibios_fixup_device_resou
 
 void __devinit pcibios_fixup_bus(struct pci_bus *bus)
 {
-	struct pci_controller *hose = PCI_GET_PHB_PTR(bus);
+	struct pci_controller *hose = pci_bus_to_host(bus);
 	struct pci_dev *dev = bus->self;
 	struct resource *res;
 	int i;
arch/ppc64/kernel/pci.h renamed from arch/ppc64/kernel/pci.h~remove_pci_find_hose_for_OF_device +0 -4
diff -puN arch/ppc64/kernel/pci.h~remove_pci_find_hose_for_OF_device arch/ppc64/kernel/pci.h
@@ -17,7 +17,6 @@ extern unsigned long isa_io_base;
 extern void pci_setup_pci_controller(struct pci_controller *hose);
 extern void pci_setup_phb_io(struct pci_controller *hose, int primary);
 
-extern struct pci_controller* pci_find_hose_for_OF_device(struct device_node* node);
 extern void pci_setup_phb_io_dynamic(struct pci_controller *hose);
 
 
@@ -36,11 +35,8 @@ void *traverse_pci_devices(struct device
 
 void pci_devs_phb_init(void);
 void pci_devs_phb_init_dynamic(struct pci_controller *phb);
-void pci_fix_bus_sysdata(void);
 struct device_node *fetch_dev_dn(struct pci_dev *dev);
 
-#define PCI_GET_PHB_PTR(dev)    (((struct device_node *)(dev)->sysdata)->phb)
-
 /* PCI address cache management routines */
 void pci_addr_cache_insert_device(struct pci_dev *dev);
 void pci_addr_cache_remove_device(struct pci_dev *dev);
arch/ppc64/kernel/pci_dn.c renamed from arch/ppc64/kernel/pci_dn.c~remove_pci_find_hose_for_OF_device +0 -33
diff -puN arch/ppc64/kernel/pci_dn.c~remove_pci_find_hose_for_OF_device arch/ppc64/kernel/pci_dn.c
@@ -21,19 +21,12 @@
  */
 #include <linux/kernel.h>
 #include <linux/pci.h>
-#include <linux/delay.h>
 #include <linux/string.h>
 #include <linux/init.h>
-#include <linux/bootmem.h>
 
 #include <asm/io.h>
-#include <asm/pgtable.h>
-#include <asm/irq.h>
 #include <asm/prom.h>
-#include <asm/machdep.h>
 #include <asm/pci-bridge.h>
-#include <asm/ppcdebug.h>
-#include <asm/iommu.h>
 
 #include "pci.h"
 
@@ -178,29 +171,3 @@ void __init pci_devs_phb_init(void)
 	list_for_each_entry_safe(phb, tmp, &hose_list, list_node)
 		pci_devs_phb_init_dynamic(phb);
 }
-
-
-static void __init pci_fixup_bus_sysdata_list(struct list_head *bus_list)
-{
-	struct pci_bus *bus;
-
-	list_for_each_entry(bus, bus_list, node) {
-		if (bus->self)
-			bus->sysdata = bus->self->sysdata;
-		pci_fixup_bus_sysdata_list(&bus->children);
-	}
-}
-
-/*
- * Fixup the bus->sysdata ptrs to point to the bus' device_node.
- * This is done late in pcibios_init().  We do this mostly for
- * sanity, but pci_dma.c uses these at DMA time so they must be
- * correct.
- * To do this we recurse down the bus hierarchy.  Note that PHB's
- * have bus->self == NULL, but fortunately bus->sysdata is already
- * correct in this case.
- */
-void __init pci_fix_bus_sysdata(void)
-{
-	pci_fixup_bus_sysdata_list(&pci_root_buses);
-}
arch/ppc64/kernel/pmac_pci.c renamed from arch/ppc64/kernel/pmac_pci.c~remove_pci_find_hose_for_OF_device +0 -2
diff -puN arch/ppc64/kernel/pmac_pci.c~remove_pci_find_hose_for_OF_device arch/ppc64/kernel/pmac_pci.c
@@ -664,8 +664,6 @@ void __init pmac_pcibios_fixup(void)
 
 	for_each_pci_dev(dev)
 		pci_read_irq_line(dev);
-
-	pci_fix_bus_sysdata();
 }
 
 static void __init pmac_fixup_phb_resources(void)
include/asm-ppc64/pci-bridge.h renamed from include/asm-ppc64/pci-bridge.h~remove_pci_find_hose_for_OF_device +3 -20
diff -puN include/asm-ppc64/pci-bridge.h~remove_pci_find_hose_for_OF_device include/asm-ppc64/pci-bridge.h
@@ -11,18 +11,10 @@
  * 2 of the License, or (at your option) any later version.
  */
 
-struct device_node;
-struct pci_controller;
-
-/* Get the PCI host controller for an OF device */
-extern struct pci_controller*
-pci_find_hose_for_OF_device(struct device_node* node);
-
 /*
  * Structure of a PCI controller (host bridge)
  */
 struct pci_controller {
-	char what[8];                     /* Eye catcher      */
 	struct pci_bus *bus;
 	char is_dynamic;
 	void *arch_data;
@@ -49,7 +41,6 @@ struct pci_controller {
 	 */
 	struct resource io_resource;
 	struct resource mem_resources[3];
-	int mem_resource_count;
 	int global_number;		
 	int local_number;		
 	unsigned long buid;
@@ -57,14 +48,6 @@ struct pci_controller {
 	unsigned long dma_window_size;
 };
 
-/*
- * pci_device_loc returns the bus number and device/function number
- * for a device on a PCI bus, given its device_node struct.
- * It returns 0 if OK, -1 on error.
- */
-extern int pci_device_loc(struct device_node *dev, unsigned char *bus_ptr,
-			  unsigned char *devfn_ptr);
-
 struct device_node *fetch_dev_dn(struct pci_dev *dev);
 
 /* Get a device_node from a pci_dev.  This code must be fast except in the case
@@ -72,8 +55,9 @@ struct device_node *fetch_dev_dn(struct 
  */
 static inline struct device_node *pci_device_to_OF_node(struct pci_dev *dev)
 {
-	struct device_node *dn = (struct device_node *)(dev->sysdata);
-	if (dn->devfn == dev->devfn && dn->busno == (dev->bus->number&0xff))
+	struct device_node *dn = dev->sysdata;
+
+	if (dn->devfn == dev->devfn && dn->busno == dev->bus->number)
 		return dn;	/* fast path.  sysdata is good */
 	else
 		return fetch_dev_dn(dev);
@@ -102,6 +86,5 @@ static inline struct pci_controller *pci
 	return busdn->phb;
 }
 
-
 #endif
 #endif /* __KERNEL__ */

_

#1 lore raw

PATCH 1/1 ppc64: Remove flush_instruction_cache

Remove flush_instruction_cache, we cant touch HID bits on LPAR machines.

arch/ppc64/kernel/misc.S renamed from arch/ppc64/kernel/misc.S~canttouchhids +0 -20
diff -puN arch/ppc64/kernel/misc.S~canttouchhids arch/ppc64/kernel/misc.S
@@ -167,27 +167,7 @@ _GLOBAL(call_with_mmu_off)
 	xori	r0,r0,MSR_IR|MSR_DR
 	mtspr	SPRN_SRR1,r0
 	rfid
-	
-/*
- * Flush instruction cache.
- */
-_GLOBAL(flush_instruction_cache)
 
-/*
- * This is called by kgdb code
- * and should probably go away
- * to be replaced by invalidating
- * the cache lines that are actually
- * modified
- */
-	/* use invalidate-all bit in HID0
-	 *  - is this consistent across all 64-bit cpus?  -- paulus */
-	mfspr	r3,HID0
-	ori	r3,r3,HID0_ICFI
-	mtspr	HID0,r3
-	sync
-	isync
-	blr
 
 	.section	".toc","aw"
 PPC64_CACHES:
include/asm-ppc64/system.h renamed from include/asm-ppc64/system.h~canttouchhids +0 -1
diff -puN include/asm-ppc64/system.h~canttouchhids include/asm-ppc64/system.h
@@ -108,7 +108,6 @@ extern void show_regs(struct pt_regs * r
 extern void low_hash_fault(struct pt_regs *regs, unsigned long address);
 extern int die(const char *str, struct pt_regs *regs, long err);
 
-extern void flush_instruction_cache(void);
 extern int _get_PVR(void);
 extern void giveup_fpu(struct task_struct *);
 extern void disable_kernel_fp(void);
arch/ppc64/kernel/ppc_ksyms.c renamed from arch/ppc64/kernel/ppc_ksyms.c~canttouchhids +0 -1
diff -puN arch/ppc64/kernel/ppc_ksyms.c~canttouchhids arch/ppc64/kernel/ppc_ksyms.c
@@ -114,7 +114,6 @@ EXPORT_SYMBOL(iounmap);
 EXPORT_SYMBOL(start_thread);
 EXPORT_SYMBOL(kernel_thread);
 
-EXPORT_SYMBOL(flush_instruction_cache);
 EXPORT_SYMBOL(giveup_fpu);
 #ifdef CONFIG_ALTIVEC
 EXPORT_SYMBOL(giveup_altivec);

_

#2 lore raw

PATCH 1/1 ppc64: interrupt code cleanup

- Move some function prototypes into header files.
- Remove late_setup_cpu, put the set indicator and vpa init into xics probe instead
- rtas-proc was doing weird stuff with the 9005 indicator. Get rid of it.
- Dont open code the set_indicator call in the hotplug code

arch/ppc64/kernel/pSeries_smp.c renamed from arch/ppc64/kernel/pSeries_smp.c~debug_gqirm +13 -33
diff -puN arch/ppc64/kernel/pSeries_smp.c~debug_gqirm arch/ppc64/kernel/pSeries_smp.c
@@ -19,9 +19,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/smp.h>
-#include <linux/smp_lock.h>
 #include <linux/interrupt.h>
-#include <linux/kernel_stat.h>
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/spinlock.h>
@@ -40,7 +38,6 @@
 #include <asm/smp.h>
 #include <asm/paca.h>
 #include <asm/time.h>
-#include <asm/ppcdebug.h>
 #include <asm/machdep.h>
 #include <asm/xics.h>
 #include <asm/cputable.h>
@@ -89,9 +86,6 @@ static int query_cpu_stopped(unsigned in
 
 int __cpu_disable(void)
 {
-	/* FIXME: go put this in a header somewhere */
-	extern void xics_migrate_irqs_away(void);
-
 	systemcfg->processorCount--;
 
 	/*fix boot_cpuid here*/
@@ -250,8 +244,6 @@ static void smp_xics_message_pass(int ta
 	}
 }
 
-extern void xics_request_IPIs(void);
-
 static int __init smp_xics_probe(void)
 {
 	xics_request_IPIs();
@@ -263,6 +255,18 @@ static void __devinit smp_xics_setup_cpu
 {
 	if (cpu != boot_cpuid)
 		xics_setup_cpu();
+
+	if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR)
+		vpa_init(cpu);
+
+#ifdef CONFIG_IRQ_ALL_CPUS
+	/*
+	 * Put the calling processor into the GIQ.  This is really only
+	 * necessary from a secondary thread as the OF start-cpu interface
+	 * performs this function for us on primary threads.
+	 */
+	rtas_set_indicator(GLOBAL_INTERRUPT_QUEUE, default_distrib_server, 1);
+#endif
 }
 
 static spinlock_t timebase_lock = SPIN_LOCK_UNLOCKED;
@@ -290,26 +294,7 @@ static void __devinit pSeries_take_timeb
 	spin_unlock(&timebase_lock);
 }
 
-static void __devinit pSeries_late_setup_cpu(int cpu)
-{
-	extern unsigned int default_distrib_server;
-
-	if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) {
-		vpa_init(cpu); 
-	}
-
-#ifdef CONFIG_IRQ_ALL_CPUS
-	/* Put the calling processor into the GIQ.  This is really only
-	 * necessary from a secondary thread as the OF start-cpu interface
-	 * performs this function for us on primary threads.
-	 */
-	/* TODO: 9005 is #defined in rtas-proc.c -- move to a header */
-	rtas_set_indicator(9005, default_distrib_server, 1);
-#endif
-}
-
-
-void __devinit smp_pSeries_kick_cpu(int nr)
+static void __devinit smp_pSeries_kick_cpu(int nr)
 {
 	BUG_ON(nr < 0 || nr >= NR_CPUS);
 
@@ -329,7 +314,6 @@ static struct smp_ops_t pSeries_mpic_smp
 	.probe		= smp_mpic_probe,
 	.kick_cpu	= smp_pSeries_kick_cpu,
 	.setup_cpu	= smp_mpic_setup_cpu,
-	.late_setup_cpu	= pSeries_late_setup_cpu,
 };
 
 static struct smp_ops_t pSeries_xics_smp_ops = {
@@ -337,7 +321,6 @@ static struct smp_ops_t pSeries_xics_smp
 	.probe		= smp_xics_probe,
 	.kick_cpu	= smp_pSeries_kick_cpu,
 	.setup_cpu	= smp_xics_setup_cpu,
-	.late_setup_cpu	= pSeries_late_setup_cpu,
 };
 
 /* This is called very early */
@@ -367,9 +350,6 @@ void __init smp_init_pSeries(void)
 		}
 	}
 
-	if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR)
-		vpa_init(boot_cpuid);
-
 	/* Non-lpar has additional take/give timebase */
 	if (rtas_token("freeze-time-base") != RTAS_UNKNOWN_SERVICE) {
 		smp_ops->give_timebase = pSeries_give_timebase;
arch/ppc64/kernel/rtas-proc.c renamed from arch/ppc64/kernel/rtas-proc.c~debug_gqirm +0 -12
diff -puN arch/ppc64/kernel/rtas-proc.c~debug_gqirm arch/ppc64/kernel/rtas-proc.c
@@ -52,7 +52,6 @@
 #define IBM_VOLTAGE		0x232a /* 9002 */
 #define IBM_DRCONNECTOR		0x232b /* 9003 */
 #define IBM_POWERSUPPLY		0x232c /* 9004 */
-#define IBM_INTQUEUE		0x232d /* 9005 */
 
 /* Status return values */
 #define SENSOR_CRITICAL_HIGH	13
@@ -107,7 +106,6 @@
 #define DR_ACTION		0x2329 /* 9001 */
 #define DR_INDICATOR		0x232a /* 9002 */
 /* 9003 - 9004: Vendor specific */
-#define GLOBAL_INTERRUPT_QUEUE	0x232d /* 9005 */
 /* 9006 - 9999: Vendor specific */
 
 /* other */
@@ -553,7 +551,6 @@ static void ppc_rtas_process_sensor(stru
 						"No current flow" };
 	const char * ibm_drconnector[]     = { "Empty", "Present", "Unusable", 
 						"Exchange" };
-	const char * ibm_intqueue[]        = { "Disabled", "Enabled" };
 
 	int have_strings = 0;
 	int num_states = 0;
@@ -665,15 +662,6 @@ static void ppc_rtas_process_sensor(stru
 		case IBM_POWERSUPPLY:
 			seq_printf(m, "Powersupply:\t");
 			break;
-		case IBM_INTQUEUE:
-			seq_printf(m, "Interrupt queue:\t");
-			num_states = sizeof(ibm_intqueue) / sizeof(char *);
-			if (state < num_states) {
-				seq_printf(m, "%s\t", 
-						ibm_intqueue[state]);
-				have_strings = 1;
-			}
-			break;
 		default:
 			seq_printf(m,  "Unknown sensor (type %d), ignoring it\n",
 					s->token);
arch/ppc64/kernel/smp.c renamed from arch/ppc64/kernel/smp.c~debug_gqirm +0 -12
diff -puN arch/ppc64/kernel/smp.c~debug_gqirm arch/ppc64/kernel/smp.c
@@ -22,9 +22,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/smp.h>
-#include <linux/smp_lock.h>
 #include <linux/interrupt.h>
-#include <linux/kernel_stat.h>
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/spinlock.h>
@@ -38,12 +36,10 @@
 #include <asm/irq.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
-#include <asm/io.h>
 #include <asm/prom.h>
 #include <asm/smp.h>
 #include <asm/paca.h>
 #include <asm/time.h>
-#include <asm/ppcdebug.h>
 #include <asm/machdep.h>
 #include <asm/cputable.h>
 #include <asm/system.h>
@@ -58,7 +54,6 @@
 #endif
 
 int smp_threads_ready;
-unsigned long cache_decay_ticks;
 
 cpumask_t cpu_possible_map = CPU_MASK_NONE;
 cpumask_t cpu_online_map = CPU_MASK_NONE;
@@ -77,10 +72,6 @@ void smp_call_function_interrupt(void);
 
 int smt_enabled_at_boot = 1;
 
-/* Low level assembly function used to backup CPU 0 state */
-extern void __save_cpu_setup(void);
-
-
 #ifdef CONFIG_PPC_MULTIPLATFORM
 void smp_mpic_message_pass(int target, int msg)
 {
@@ -507,9 +498,6 @@ int __devinit start_secondary(void *unus
 	if (smp_ops->take_timebase)
 		smp_ops->take_timebase();
 
-	if (smp_ops->late_setup_cpu)
-		smp_ops->late_setup_cpu(cpu);
-
 	spin_lock(&call_lock);
 	cpu_set(cpu, cpu_online_map);
 	spin_unlock(&call_lock);
arch/ppc64/kernel/xics.c renamed from arch/ppc64/kernel/xics.c~debug_gqirm +3 -7
diff -puN arch/ppc64/kernel/xics.c~debug_gqirm arch/ppc64/kernel/xics.c
@@ -643,20 +643,16 @@ static void xics_set_affinity(unsigned i
 /* Interrupts are disabled. */
 void xics_migrate_irqs_away(void)
 {
-	int set_indicator = rtas_token("set-indicator");
-	const unsigned int giqs = 9005UL; /* Global Interrupt Queue Server */
-	int status = 0;
+	int status;
 	unsigned int irq, virq, cpu = smp_processor_id();
 
-	BUG_ON(set_indicator == RTAS_UNKNOWN_SERVICE);
-
 	/* Reject any interrupt that was queued to us... */
 	ops->cppr_info(cpu, 0);
 	iosync();
 
 	/* Refuse any new interrupts... */
-	rtas_call(set_indicator, 3, 1, &status, giqs,
-		  hard_smp_processor_id(), 0);
+	status = rtas_set_indicator(GLOBAL_INTERRUPT_QUEUE,
+				    hard_smp_processor_id(), 0);
 	WARN_ON(status != 0);
 
 	/* Allow IPIs again... */
include/asm-ppc64/machdep.h renamed from include/asm-ppc64/machdep.h~debug_gqirm +0 -1
diff -puN include/asm-ppc64/machdep.h~debug_gqirm include/asm-ppc64/machdep.h
@@ -28,7 +28,6 @@ struct smp_ops_t {
 	int   (*probe)(void);
 	void  (*kick_cpu)(int nr);
 	void  (*setup_cpu)(int nr);
-	void  (*late_setup_cpu)(int nr);
 	void  (*take_timebase)(void);
 	void  (*give_timebase)(void);
 };
include/asm-ppc64/rtas.h renamed from include/asm-ppc64/rtas.h~debug_gqirm +2 -0
diff -puN include/asm-ppc64/rtas.h~debug_gqirm include/asm-ppc64/rtas.h
@@ -241,4 +241,6 @@ extern void rtas_stop_self(void);
 /* RMO buffer reserved for user-space RTAS use */
 extern unsigned long rtas_rmo_buf;
 
+#define GLOBAL_INTERRUPT_QUEUE 9005
+
 #endif /* _PPC64_RTAS_H */
include/asm-ppc64/xics.h renamed from include/asm-ppc64/xics.h~debug_gqirm +4 -0
diff -puN include/asm-ppc64/xics.h~debug_gqirm include/asm-ppc64/xics.h
@@ -18,6 +18,8 @@ void xics_init_IRQ(void);
 int xics_get_irq(struct pt_regs *);
 void xics_setup_cpu(void);
 void xics_cause_IPI(int cpu);
+void xics_request_IPIs(void);
+void xics_migrate_irqs_away(void);
 
 /* first argument is ignored for now*/
 void pSeriesLP_cppr_info(int n_cpu, u8 value);
@@ -28,4 +30,6 @@ struct xics_ipi_struct {
 
 extern struct xics_ipi_struct xics_ipi_message[NR_CPUS] __cacheline_aligned;
 
+extern unsigned int default_distrib_server;
+
 #endif /* _PPC64_KERNEL_XICS_H */

_

#3 lore raw

PATCH 1/1 ppc64: Fix rtas_set_indicator(9005)

It turns out we were passing in the wrong thing to the rtas_set_indicator call. Luckily we got away with it because it looks like firmware does not check arguments and just inserts or removes the current cpu from the global server group.

Fix it.

Anton

arch/ppc64/kernel/pSeries_smp.c renamed from arch/ppc64/kernel/pSeries_smp.c~fix_gqirm_set_indicator +2 -1
diff -puN arch/ppc64/kernel/pSeries_smp.c~fix_gqirm_set_indicator arch/ppc64/kernel/pSeries_smp.c
@@ -265,7 +265,8 @@ static void __devinit smp_xics_setup_cpu
 	 * necessary from a secondary thread as the OF start-cpu interface
 	 * performs this function for us on primary threads.
 	 */
-	rtas_set_indicator(GLOBAL_INTERRUPT_QUEUE, default_distrib_server, 1);
+	rtas_set_indicator(GLOBAL_INTERRUPT_QUEUE,
+		(1UL << interrupt_server_size) - 1 - default_distrib_server, 1);
 #endif
 }
 
arch/ppc64/kernel/xics.c renamed from arch/ppc64/kernel/xics.c~fix_gqirm_set_indicator +7 -2
diff -puN arch/ppc64/kernel/xics.c~fix_gqirm_set_indicator arch/ppc64/kernel/xics.c
@@ -91,6 +91,7 @@ static int xics_irq_8259_cascade_real = 
 static unsigned int default_server = 0xFF;
 /* also referenced in smp.c... */
 unsigned int default_distrib_server = 0;
+unsigned int interrupt_server_size = 8;
 
 /*
  * XICS only has a single IPI, so encode the messages per CPU
@@ -511,6 +512,10 @@ nextnode:
 				default_server = ireg[0];
 				default_distrib_server = ireg[i-1]; /* take last element */
 			}
+			ireg = (uint *)get_property(np,
+					"ibm,interrupt-server#-size", NULL);
+			if (ireg)
+				interrupt_server_size = *ireg;
 			break;
 		}
 	}
@@ -650,9 +655,9 @@ void xics_migrate_irqs_away(void)
 	ops->cppr_info(cpu, 0);
 	iosync();
 
-	/* Refuse any new interrupts... */
+	/* remove ourselves from the global interrupt queue */
 	status = rtas_set_indicator(GLOBAL_INTERRUPT_QUEUE,
-				    hard_smp_processor_id(), 0);
+		(1UL << interrupt_server_size) - 1 - default_distrib_server, 0);
 	WARN_ON(status != 0);
 
 	/* Allow IPIs again... */
include/asm-ppc64/xics.h renamed from include/asm-ppc64/xics.h~fix_gqirm_set_indicator +1 -0
diff -puN include/asm-ppc64/xics.h~fix_gqirm_set_indicator include/asm-ppc64/xics.h
@@ -31,5 +31,6 @@ struct xics_ipi_struct {
 extern struct xics_ipi_struct xics_ipi_message[NR_CPUS] __cacheline_aligned;
 
 extern unsigned int default_distrib_server;
+extern unsigned int interrupt_server_size;
 
 #endif /* _PPC64_KERNEL_XICS_H */

_

#4 lore raw

PATCH 1/1 ppc64: Make NUMA code handle unexpected layouts

From: Nathan Lynch <[email protected]>

Ran into this on a 4GB partition - all but about ~300MB was thrown away.

Does this look ok? It works for me, but I've not tested on firmware without the bug.

Fall back to non-numa setup upon discovering unexpected memory layout as presented by firmware, instead of throwing away regions.

arch/ppc64/mm/numa.c renamed from arch/ppc64/mm/numa.c~numa_broke_fix +17 -6
diff -puN arch/ppc64/mm/numa.c~numa_broke_fix arch/ppc64/mm/numa.c
@@ -345,8 +345,6 @@ new_range:
 			numa_domain = 0;
 		}
 
-		node_set_online(numa_domain);
-
 		if (max_domain < numa_domain)
 			max_domain = numa_domain;
 
@@ -361,14 +359,19 @@ new_range:
 				init_node_data[numa_domain].node_start_pfn +
 				init_node_data[numa_domain].node_spanned_pages;
 			if (shouldstart != (start / PAGE_SIZE)) {
-				printk(KERN_ERR "WARNING: Hole in node, "
-						"disabling region start %lx "
-						"length %lx\n", start, size);
-				continue;
+				/* Revert to non-numa for now */
+				printk(KERN_ERR
+				       "WARNING: Unexpected node layout: "
+				       "region start %lx length %lx\n",
+				       start, size);
+				printk(KERN_ERR "NUMA is disabled\n");
+				goto err;
 			}
 			init_node_data[numa_domain].node_spanned_pages +=
 				size / PAGE_SIZE;
 		} else {
+			node_set_online(numa_domain);
+
 			init_node_data[numa_domain].node_start_pfn =
 				start / PAGE_SIZE;
 			init_node_data[numa_domain].node_spanned_pages =
@@ -388,6 +391,14 @@ new_range:
 		node_set_online(i);
 
 	return 0;
+err:
+	/* Something has gone wrong; revert any setup we've done */
+	for_each_node(i) {
+		node_set_offline(i);
+		init_node_data[i].node_start_pfn = 0;
+		init_node_data[i].node_spanned_pages = 0;
+	}
+	return -1;
 }
 
 static void __init setup_nonnuma(void)

_