@@ -319,82 +319,105 @@ static void pseries_lpar_idle(void)
319319 * to ever be a problem in practice we can move this into a kernel thread to
320320 * finish off the process later in boot.
321321 */
322- long pSeries_enable_reloc_on_exc (void )
322+ void pseries_enable_reloc_on_exc (void )
323323{
324324 long rc ;
325325 unsigned int delay , total_delay = 0 ;
326326
327327 while (1 ) {
328328 rc = enable_reloc_on_exceptions ();
329- if (!H_IS_LONG_BUSY (rc ))
330- return rc ;
329+ if (!H_IS_LONG_BUSY (rc )) {
330+ if (rc == H_P2 ) {
331+ pr_info ("Relocation on exceptions not"
332+ " supported\n" );
333+ } else if (rc != H_SUCCESS ) {
334+ pr_warn ("Unable to enable relocation"
335+ " on exceptions: %ld\n" , rc );
336+ }
337+ break ;
338+ }
331339
332340 delay = get_longbusy_msecs (rc );
333341 total_delay += delay ;
334342 if (total_delay > 1000 ) {
335343 pr_warn ("Warning: Giving up waiting to enable "
336344 "relocation on exceptions (%u msec)!\n" ,
337345 total_delay );
338- return rc ;
346+ return ;
339347 }
340348
341349 mdelay (delay );
342350 }
343351}
344- EXPORT_SYMBOL (pSeries_enable_reloc_on_exc );
352+ EXPORT_SYMBOL (pseries_enable_reloc_on_exc );
345353
346- long pSeries_disable_reloc_on_exc (void )
354+ void pseries_disable_reloc_on_exc (void )
347355{
348356 long rc ;
349357
350358 while (1 ) {
351359 rc = disable_reloc_on_exceptions ();
352360 if (!H_IS_LONG_BUSY (rc ))
353- return rc ;
361+ break ;
354362 mdelay (get_longbusy_msecs (rc ));
355363 }
364+ if (rc != H_SUCCESS )
365+ pr_warning ("Warning: Failed to disable relocation on "
366+ "exceptions: %ld\n" , rc );
356367}
357- EXPORT_SYMBOL (pSeries_disable_reloc_on_exc );
368+ EXPORT_SYMBOL (pseries_disable_reloc_on_exc );
358369
359370#ifdef CONFIG_KEXEC
360371static void pSeries_machine_kexec (struct kimage * image )
361372{
362- long rc ;
363-
364- if (firmware_has_feature (FW_FEATURE_SET_MODE )) {
365- rc = pSeries_disable_reloc_on_exc ();
366- if (rc != H_SUCCESS )
367- pr_warning ("Warning: Failed to disable relocation on "
368- "exceptions: %ld\n" , rc );
369- }
373+ if (firmware_has_feature (FW_FEATURE_SET_MODE ))
374+ pseries_disable_reloc_on_exc ();
370375
371376 default_machine_kexec (image );
372377}
373378#endif
374379
375380#ifdef __LITTLE_ENDIAN__
376- long pseries_big_endian_exceptions (void )
381+ void pseries_big_endian_exceptions (void )
377382{
378383 long rc ;
379384
380385 while (1 ) {
381386 rc = enable_big_endian_exceptions ();
382387 if (!H_IS_LONG_BUSY (rc ))
383- return rc ;
388+ break ;
384389 mdelay (get_longbusy_msecs (rc ));
385390 }
391+
392+ /*
393+ * At this point it is unlikely panic() will get anything
394+ * out to the user, since this is called very late in kexec
395+ * but at least this will stop us from continuing on further
396+ * and creating an even more difficult to debug situation.
397+ *
398+ * There is a known problem when kdump'ing, if cpus are offline
399+ * the above call will fail. Rather than panicking again, keep
400+ * going and hope the kdump kernel is also little endian, which
401+ * it usually is.
402+ */
403+ if (rc && !kdump_in_progress ())
404+ panic ("Could not enable big endian exceptions" );
386405}
387406
388- static long pseries_little_endian_exceptions (void )
407+ void pseries_little_endian_exceptions (void )
389408{
390409 long rc ;
391410
392411 while (1 ) {
393412 rc = enable_little_endian_exceptions ();
394413 if (!H_IS_LONG_BUSY (rc ))
395- return rc ;
414+ break ;
396415 mdelay (get_longbusy_msecs (rc ));
397416 }
417+ if (rc ) {
418+ ppc_md .progress ("H_SET_MODE LE exception fail" , 0 );
419+ panic ("Could not enable little endian exceptions" );
420+ }
398421}
399422#endif
400423
@@ -464,18 +487,6 @@ static void __init pSeries_setup_arch(void)
464487 }
465488
466489 ppc_md .pcibios_root_bridge_prepare = pseries_root_bridge_prepare ;
467-
468- if (firmware_has_feature (FW_FEATURE_SET_MODE )) {
469- long rc ;
470-
471- rc = pSeries_enable_reloc_on_exc ();
472- if (rc == H_P2 ) {
473- pr_info ("Relocation on exceptions not supported\n" );
474- } else if (rc != H_SUCCESS ) {
475- pr_warn ("Unable to enable relocation on exceptions: "
476- "%ld\n" , rc );
477- }
478- }
479490}
480491
481492static int __init pSeries_init_panel (void )
@@ -678,23 +689,6 @@ static int __init pSeries_probe(void)
678689
679690 pr_debug ("pSeries detected, looking for LPAR capability...\n" );
680691
681-
682- #ifdef __LITTLE_ENDIAN__
683- if (firmware_has_feature (FW_FEATURE_SET_MODE )) {
684- long rc ;
685- /*
686- * Tell the hypervisor that we want our exceptions to
687- * be taken in little endian mode. If this fails we don't
688- * want to use BUG() because it will trigger an exception.
689- */
690- rc = pseries_little_endian_exceptions ();
691- if (rc ) {
692- ppc_md .progress ("H_SET_MODE LE exception fail" , 0 );
693- panic ("Could not enable little endian exceptions" );
694- }
695- }
696- #endif
697-
698692 if (firmware_has_feature (FW_FEATURE_LPAR ))
699693 hpte_init_lpar ();
700694 else
0 commit comments