aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/pseries
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms/pseries')
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c4
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c52
-rw-r--r--arch/powerpc/platforms/pseries/rtasd.c76
-rw-r--r--arch/powerpc/platforms/pseries/setup.c25
4 files changed, 117 insertions, 40 deletions
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index 3ee01b4f425..661c8e02bcb 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -388,7 +388,7 @@ static void pci_dma_bus_setup_pSeries(struct pci_bus *bus)
388 388
389 while (pci->phb->dma_window_size * children > 0x80000000ul) 389 while (pci->phb->dma_window_size * children > 0x80000000ul)
390 pci->phb->dma_window_size >>= 1; 390 pci->phb->dma_window_size >>= 1;
391 pr_debug("No ISA/IDE, window size is 0x%lx\n", 391 pr_debug("No ISA/IDE, window size is 0x%llx\n",
392 pci->phb->dma_window_size); 392 pci->phb->dma_window_size);
393 pci->phb->dma_window_base_cur = 0; 393 pci->phb->dma_window_base_cur = 0;
394 394
@@ -414,7 +414,7 @@ static void pci_dma_bus_setup_pSeries(struct pci_bus *bus)
414 while (pci->phb->dma_window_size * children > 0x70000000ul) 414 while (pci->phb->dma_window_size * children > 0x70000000ul)
415 pci->phb->dma_window_size >>= 1; 415 pci->phb->dma_window_size >>= 1;
416 416
417 pr_debug("ISA/IDE, window size is 0x%lx\n", pci->phb->dma_window_size); 417 pr_debug("ISA/IDE, window size is 0x%llx\n", pci->phb->dma_window_size);
418} 418}
419 419
420 420
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 52a80e5840e..e3139fa5e55 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -609,3 +609,55 @@ void __init hpte_init_lpar(void)
609 ppc_md.flush_hash_range = pSeries_lpar_flush_hash_range; 609 ppc_md.flush_hash_range = pSeries_lpar_flush_hash_range;
610 ppc_md.hpte_clear_all = pSeries_lpar_hptab_clear; 610 ppc_md.hpte_clear_all = pSeries_lpar_hptab_clear;
611} 611}
612
613#ifdef CONFIG_PPC_SMLPAR
614#define CMO_FREE_HINT_DEFAULT 1
615static int cmo_free_hint_flag = CMO_FREE_HINT_DEFAULT;
616
617static int __init cmo_free_hint(char *str)
618{
619 char *parm;
620 parm = strstrip(str);
621
622 if (strcasecmp(parm, "no") == 0 || strcasecmp(parm, "off") == 0) {
623 printk(KERN_INFO "cmo_free_hint: CMO free page hinting is not active.\n");
624 cmo_free_hint_flag = 0;
625 return 1;
626 }
627
628 cmo_free_hint_flag = 1;
629 printk(KERN_INFO "cmo_free_hint: CMO free page hinting is active.\n");
630
631 if (strcasecmp(parm, "yes") == 0 || strcasecmp(parm, "on") == 0)
632 return 1;
633
634 return 0;
635}
636
637__setup("cmo_free_hint=", cmo_free_hint);
638
639static void pSeries_set_page_state(struct page *page, int order,
640 unsigned long state)
641{
642 int i, j;
643 unsigned long cmo_page_sz, addr;
644
645 cmo_page_sz = cmo_get_page_size();
646 addr = __pa((unsigned long)page_address(page));
647
648 for (i = 0; i < (1 << order); i++, addr += PAGE_SIZE) {
649 for (j = 0; j < PAGE_SIZE; j += cmo_page_sz)
650 plpar_hcall_norets(H_PAGE_INIT, state, addr + j, 0);
651 }
652}
653
654void arch_free_page(struct page *page, int order)
655{
656 if (!cmo_free_hint_flag || !firmware_has_feature(FW_FEATURE_CMO))
657 return;
658
659 pSeries_set_page_state(page, order, H_PAGE_SET_UNUSED);
660}
661EXPORT_SYMBOL(arch_free_page);
662
663#endif
diff --git a/arch/powerpc/platforms/pseries/rtasd.c b/arch/powerpc/platforms/pseries/rtasd.c
index afad9f5ac0a..b3cbac85592 100644
--- a/arch/powerpc/platforms/pseries/rtasd.c
+++ b/arch/powerpc/platforms/pseries/rtasd.c
@@ -19,7 +19,7 @@
19#include <linux/vmalloc.h> 19#include <linux/vmalloc.h>
20#include <linux/spinlock.h> 20#include <linux/spinlock.h>
21#include <linux/cpu.h> 21#include <linux/cpu.h>
22#include <linux/delay.h> 22#include <linux/workqueue.h>
23 23
24#include <asm/uaccess.h> 24#include <asm/uaccess.h>
25#include <asm/io.h> 25#include <asm/io.h>
@@ -387,36 +387,51 @@ static void do_event_scan(void)
387 } while(error == 0); 387 } while(error == 0);
388} 388}
389 389
390static void do_event_scan_all_cpus(long delay) 390static void rtas_event_scan(struct work_struct *w);
391DECLARE_DELAYED_WORK(event_scan_work, rtas_event_scan);
392
393/*
394 * Delay should be at least one second since some machines have problems if
395 * we call event-scan too quickly.
396 */
397static unsigned long event_scan_delay = 1*HZ;
398static int first_pass = 1;
399
400static void rtas_event_scan(struct work_struct *w)
391{ 401{
392 int cpu; 402 unsigned int cpu;
403
404 do_event_scan();
393 405
394 get_online_cpus(); 406 get_online_cpus();
395 cpu = first_cpu(cpu_online_map); 407
396 for (;;) { 408 cpu = next_cpu(smp_processor_id(), cpu_online_map);
397 set_cpus_allowed(current, cpumask_of_cpu(cpu)); 409 if (cpu == NR_CPUS) {
398 do_event_scan(); 410 cpu = first_cpu(cpu_online_map);
399 set_cpus_allowed(current, CPU_MASK_ALL); 411
400 412 if (first_pass) {
401 /* Drop hotplug lock, and sleep for the specified delay */ 413 first_pass = 0;
402 put_online_cpus(); 414 event_scan_delay = 30*HZ/rtas_event_scan_rate;
403 msleep_interruptible(delay); 415
404 get_online_cpus(); 416 if (surveillance_timeout != -1) {
405 417 pr_debug("rtasd: enabling surveillance\n");
406 cpu = next_cpu(cpu, cpu_online_map); 418 enable_surveillance(surveillance_timeout);
407 if (cpu == NR_CPUS) 419 pr_debug("rtasd: surveillance enabled\n");
408 break; 420 }
421 }
409 } 422 }
423
424 schedule_delayed_work_on(cpu, &event_scan_work,
425 __round_jiffies_relative(event_scan_delay, cpu));
426
410 put_online_cpus(); 427 put_online_cpus();
411} 428}
412 429
413static int rtasd(void *unused) 430static void start_event_scan(void)
414{ 431{
415 unsigned int err_type; 432 unsigned int err_type;
416 int rc; 433 int rc;
417 434
418 daemonize("rtasd");
419
420 printk(KERN_DEBUG "RTAS daemon started\n"); 435 printk(KERN_DEBUG "RTAS daemon started\n");
421 pr_debug("rtasd: will sleep for %d milliseconds\n", 436 pr_debug("rtasd: will sleep for %d milliseconds\n",
422 (30000 / rtas_event_scan_rate)); 437 (30000 / rtas_event_scan_rate));
@@ -434,22 +449,8 @@ static int rtasd(void *unused)
434 } 449 }
435 } 450 }
436 451
437 /* First pass. */ 452 schedule_delayed_work_on(first_cpu(cpu_online_map), &event_scan_work,
438 do_event_scan_all_cpus(1000); 453 event_scan_delay);
439
440 if (surveillance_timeout != -1) {
441 pr_debug("rtasd: enabling surveillance\n");
442 enable_surveillance(surveillance_timeout);
443 pr_debug("rtasd: surveillance enabled\n");
444 }
445
446 /* Delay should be at least one second since some
447 * machines have problems if we call event-scan too
448 * quickly. */
449 for (;;)
450 do_event_scan_all_cpus(30000/rtas_event_scan_rate);
451
452 return -EINVAL;
453} 454}
454 455
455static int __init rtas_init(void) 456static int __init rtas_init(void)
@@ -487,8 +488,7 @@ static int __init rtas_init(void)
487 if (!entry) 488 if (!entry)
488 printk(KERN_ERR "Failed to create error_log proc entry\n"); 489 printk(KERN_ERR "Failed to create error_log proc entry\n");
489 490
490 if (kernel_thread(rtasd, NULL, CLONE_FS) < 0) 491 start_event_scan();
491 printk(KERN_ERR "Failed to start RTAS daemon\n");
492 492
493 return 0; 493 return 0;
494} 494}
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index ec341707e41..8d75ea21296 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -63,6 +63,7 @@
63#include <asm/smp.h> 63#include <asm/smp.h>
64#include <asm/firmware.h> 64#include <asm/firmware.h>
65#include <asm/eeh.h> 65#include <asm/eeh.h>
66#include <asm/pSeries_reconfig.h>
66 67
67#include "plpar_wrappers.h" 68#include "plpar_wrappers.h"
68#include "pseries.h" 69#include "pseries.h"
@@ -254,6 +255,29 @@ static void __init pseries_discover_pic(void)
254 " interrupt-controller\n"); 255 " interrupt-controller\n");
255} 256}
256 257
258static int pci_dn_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node)
259{
260 struct device_node *np = node;
261 struct pci_dn *pci = NULL;
262 int err = NOTIFY_OK;
263
264 switch (action) {
265 case PSERIES_RECONFIG_ADD:
266 pci = np->parent->data;
267 if (pci)
268 update_dn_pci_info(np, pci->phb);
269 break;
270 default:
271 err = NOTIFY_DONE;
272 break;
273 }
274 return err;
275}
276
277static struct notifier_block pci_dn_reconfig_nb = {
278 .notifier_call = pci_dn_reconfig_notifier,
279};
280
257static void __init pSeries_setup_arch(void) 281static void __init pSeries_setup_arch(void)
258{ 282{
259 /* Discover PIC type and setup ppc_md accordingly */ 283 /* Discover PIC type and setup ppc_md accordingly */
@@ -271,6 +295,7 @@ static void __init pSeries_setup_arch(void)
271 /* Find and initialize PCI host bridges */ 295 /* Find and initialize PCI host bridges */
272 init_pci_config_tokens(); 296 init_pci_config_tokens();
273 find_and_init_phbs(); 297 find_and_init_phbs();
298 pSeries_reconfig_notifier_register(&pci_dn_reconfig_nb);
274 eeh_init(); 299 eeh_init();
275 300
276 pSeries_nvram_init(); 301 pSeries_nvram_init();