diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2011-05-23 04:24:35 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2011-05-23 04:24:30 -0400 |
commit | 7dd8fe1f910f9644167ef91ddab44107d0d668c5 (patch) | |
tree | 4dea8d9be416c839f5270f5caefb8ed393267fa8 /arch | |
parent | f2db2e6cb3f5f766cbb3788af44705685ff2445a (diff) |
[S390] pfault: cleanup code
Small code cleanup.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/s390/mm/fault.c | 67 |
1 files changed, 37 insertions, 30 deletions
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c index 1ca65647832..a0f9e730f26 100644 --- a/arch/s390/mm/fault.c +++ b/arch/s390/mm/fault.c | |||
@@ -452,22 +452,28 @@ static int __init nopfault(char *str) | |||
452 | 452 | ||
453 | __setup("nopfault", nopfault); | 453 | __setup("nopfault", nopfault); |
454 | 454 | ||
455 | typedef struct { | 455 | struct pfault_refbk { |
456 | __u16 refdiagc; | 456 | u16 refdiagc; |
457 | __u16 reffcode; | 457 | u16 reffcode; |
458 | __u16 refdwlen; | 458 | u16 refdwlen; |
459 | __u16 refversn; | 459 | u16 refversn; |
460 | __u64 refgaddr; | 460 | u64 refgaddr; |
461 | __u64 refselmk; | 461 | u64 refselmk; |
462 | __u64 refcmpmk; | 462 | u64 refcmpmk; |
463 | __u64 reserved; | 463 | u64 reserved; |
464 | } __attribute__ ((packed, aligned(8))) pfault_refbk_t; | 464 | } __attribute__ ((packed, aligned(8))); |
465 | 465 | ||
466 | int pfault_init(void) | 466 | int pfault_init(void) |
467 | { | 467 | { |
468 | pfault_refbk_t refbk = | 468 | struct pfault_refbk refbk = { |
469 | { 0x258, 0, 5, 2, __LC_CURRENT_PID, 1ULL << 48, 1ULL << 48, | 469 | .refdiagc = 0x258, |
470 | __PF_RES_FIELD }; | 470 | .reffcode = 0, |
471 | .refdwlen = 5, | ||
472 | .refversn = 2, | ||
473 | .refgaddr = __LC_CURRENT_PID, | ||
474 | .refselmk = 1ULL << 48, | ||
475 | .refcmpmk = 1ULL << 48, | ||
476 | .reserved = __PF_RES_FIELD }; | ||
471 | int rc; | 477 | int rc; |
472 | 478 | ||
473 | if (!MACHINE_IS_VM || pfault_disable) | 479 | if (!MACHINE_IS_VM || pfault_disable) |
@@ -485,8 +491,12 @@ int pfault_init(void) | |||
485 | 491 | ||
486 | void pfault_fini(void) | 492 | void pfault_fini(void) |
487 | { | 493 | { |
488 | pfault_refbk_t refbk = | 494 | struct pfault_refbk refbk = { |
489 | { 0x258, 1, 5, 2, 0ULL, 0ULL, 0ULL, 0ULL }; | 495 | .refdiagc = 0x258, |
496 | .reffcode = 1, | ||
497 | .refdwlen = 5, | ||
498 | .refversn = 2, | ||
499 | }; | ||
490 | 500 | ||
491 | if (!MACHINE_IS_VM || pfault_disable) | 501 | if (!MACHINE_IS_VM || pfault_disable) |
492 | return; | 502 | return; |
@@ -599,24 +609,21 @@ static int __init pfault_irq_init(void) | |||
599 | 609 | ||
600 | if (!MACHINE_IS_VM) | 610 | if (!MACHINE_IS_VM) |
601 | return 0; | 611 | return 0; |
602 | /* | ||
603 | * Try to get pfault pseudo page faults going. | ||
604 | */ | ||
605 | rc = register_external_interrupt(0x2603, pfault_interrupt); | 612 | rc = register_external_interrupt(0x2603, pfault_interrupt); |
606 | if (rc) { | 613 | if (rc) |
607 | pfault_disable = 1; | 614 | goto out_extint; |
608 | return rc; | 615 | rc = pfault_init() == 0 ? 0 : -EOPNOTSUPP; |
609 | } | 616 | if (rc) |
610 | if (pfault_init() == 0) { | 617 | goto out_pfault; |
611 | hotcpu_notifier(pfault_cpu_notify, 0); | 618 | hotcpu_notifier(pfault_cpu_notify, 0); |
612 | return 0; | 619 | return 0; |
613 | } | ||
614 | 620 | ||
615 | /* Tough luck, no pfault. */ | 621 | out_pfault: |
616 | pfault_disable = 1; | ||
617 | unregister_external_interrupt(0x2603, pfault_interrupt); | 622 | unregister_external_interrupt(0x2603, pfault_interrupt); |
618 | return 0; | 623 | out_extint: |
624 | pfault_disable = 1; | ||
625 | return rc; | ||
619 | } | 626 | } |
620 | early_initcall(pfault_irq_init); | 627 | early_initcall(pfault_irq_init); |
621 | 628 | ||
622 | #endif | 629 | #endif /* CONFIG_PFAULT */ |