All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH RFC] spapr: by-pass SLOF when -kernel is provided
@ 2016-07-05 14:42 Laurent Vivier
  2016-07-05 17:58 ` [Qemu-devel] [Qemu-ppc] " Cédric Le Goater
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Laurent Vivier @ 2016-07-05 14:42 UTC (permalink / raw)
  To: David Gibson
  Cc: qemu-ppc, qemu-devel, Richard W.M. Jones, Thomas Huth,
	Andrew Jones, Laurent Vivier

As device-tree is now fully built by QEMU, we don't need SLOF
anymore if the kernel is provided on the command line.

In this case, don't load SLOF and boot directly into the
kernel.

This saves at least 5 seconds on the boot sequence.

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 hw/ppc/spapr.c | 37 ++++++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 7f33a1b..bbdb21d 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1219,8 +1219,11 @@ static void ppc_spapr_reset(void)
     first_ppc_cpu->env.gpr[3] = spapr->fdt_addr;
     first_ppc_cpu->env.gpr[5] = 0;
     first_cpu->halted = 0;
-    first_ppc_cpu->env.nip = SPAPR_ENTRY_POINT;
-
+    if (machine->kernel_filename) {
+        first_ppc_cpu->env.nip = KERNEL_LOAD_ADDR;
+    } else {
+        first_ppc_cpu->env.nip = SPAPR_ENTRY_POINT;
+    }
 }
 
 static void spapr_create_nvram(sPAPRMachineState *spapr)
@@ -2023,23 +2026,23 @@ static void ppc_spapr_init(MachineState *machine)
             initrd_base = 0;
             initrd_size = 0;
         }
+    } else {
+        if (bios_name == NULL) {
+            bios_name = FW_FILE_NAME;
+        }
+        filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
+        if (!filename) {
+            error_report("Could not find LPAR firmware '%s'", bios_name);
+            exit(1);
+        }
+        fw_size = load_image_targphys(filename, 0, FW_MAX_SIZE);
+        if (fw_size <= 0) {
+            error_report("Could not load LPAR firmware '%s'", filename);
+            exit(1);
+        }
+        g_free(filename);
     }
 
-    if (bios_name == NULL) {
-        bios_name = FW_FILE_NAME;
-    }
-    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
-    if (!filename) {
-        error_report("Could not find LPAR firmware '%s'", bios_name);
-        exit(1);
-    }
-    fw_size = load_image_targphys(filename, 0, FW_MAX_SIZE);
-    if (fw_size <= 0) {
-        error_report("Could not load LPAR firmware '%s'", filename);
-        exit(1);
-    }
-    g_free(filename);
-
     /* FIXME: Should register things through the MachineState's qdev
      * interface, this is a legacy from the sPAPREnvironment structure
      * which predated MachineState but had a similar function */
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH RFC] spapr: by-pass SLOF when -kernel is provided
  2016-07-05 14:42 [Qemu-devel] [PATCH RFC] spapr: by-pass SLOF when -kernel is provided Laurent Vivier
@ 2016-07-05 17:58 ` Cédric Le Goater
  2016-07-05 18:44 ` Greg Kurz
  2016-07-06  1:35 ` [Qemu-devel] " David Gibson
  2 siblings, 0 replies; 11+ messages in thread
From: Cédric Le Goater @ 2016-07-05 17:58 UTC (permalink / raw)
  To: Laurent Vivier, David Gibson; +Cc: Andrew Jones

On 07/05/2016 04:42 PM, Laurent Vivier wrote:
> As device-tree is now fully built by QEMU, we don't need SLOF
> anymore if the kernel is provided on the command line.
> 
> In this case, don't load SLOF and boot directly into the
> kernel.
> 
> This saves at least 5 seconds on the boot sequence.
> 
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>

Looks good to me. 

It would also be good to have a trimmed version of slof for a kvm 
environment, with only virtio devices. I think Nikunj had started 
to work on a minimal version.

C.


> ---
>  hw/ppc/spapr.c | 37 ++++++++++++++++++++-----------------
>  1 file changed, 20 insertions(+), 17 deletions(-)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 7f33a1b..bbdb21d 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -1219,8 +1219,11 @@ static void ppc_spapr_reset(void)
>      first_ppc_cpu->env.gpr[3] = spapr->fdt_addr;
>      first_ppc_cpu->env.gpr[5] = 0;
>      first_cpu->halted = 0;
> -    first_ppc_cpu->env.nip = SPAPR_ENTRY_POINT;
> -
> +    if (machine->kernel_filename) {
> +        first_ppc_cpu->env.nip = KERNEL_LOAD_ADDR;
> +    } else {
> +        first_ppc_cpu->env.nip = SPAPR_ENTRY_POINT;
> +    }
>  }
>  
>  static void spapr_create_nvram(sPAPRMachineState *spapr)
> @@ -2023,23 +2026,23 @@ static void ppc_spapr_init(MachineState *machine)
>              initrd_base = 0;
>              initrd_size = 0;
>          }
> +    } else {
> +        if (bios_name == NULL) {
> +            bios_name = FW_FILE_NAME;
> +        }
> +        filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
> +        if (!filename) {
> +            error_report("Could not find LPAR firmware '%s'", bios_name);
> +            exit(1);
> +        }
> +        fw_size = load_image_targphys(filename, 0, FW_MAX_SIZE);
> +        if (fw_size <= 0) {
> +            error_report("Could not load LPAR firmware '%s'", filename);
> +            exit(1);
> +        }
> +        g_free(filename);
>      }
>  
> -    if (bios_name == NULL) {
> -        bios_name = FW_FILE_NAME;
> -    }
> -    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
> -    if (!filename) {
> -        error_report("Could not find LPAR firmware '%s'", bios_name);
> -        exit(1);
> -    }
> -    fw_size = load_image_targphys(filename, 0, FW_MAX_SIZE);
> -    if (fw_size <= 0) {
> -        error_report("Could not load LPAR firmware '%s'", filename);
> -        exit(1);
> -    }
> -    g_free(filename);
> -
>      /* FIXME: Should register things through the MachineState's qdev
>       * interface, this is a legacy from the sPAPREnvironment structure
>       * which predated MachineState but had a similar function */
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH RFC] spapr: by-pass SLOF when -kernel is provided
  2016-07-05 14:42 [Qemu-devel] [PATCH RFC] spapr: by-pass SLOF when -kernel is provided Laurent Vivier
  2016-07-05 17:58 ` [Qemu-devel] [Qemu-ppc] " Cédric Le Goater
@ 2016-07-05 18:44 ` Greg Kurz
  2016-07-05 18:51   ` Laurent Vivier
  2016-07-06  1:35 ` [Qemu-devel] " David Gibson
  2 siblings, 1 reply; 11+ messages in thread
From: Greg Kurz @ 2016-07-05 18:44 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: David Gibson, Andrew Jones

On Tue,  5 Jul 2016 16:42:37 +0200
Laurent Vivier <lvivier@redhat.com> wrote:

> As device-tree is now fully built by QEMU, we don't need SLOF
> anymore if the kernel is provided on the command line.
> 
> In this case, don't load SLOF and boot directly into the
> kernel.
> 
> This saves at least 5 seconds on the boot sequence.
> 

The concept looks great so I gave a try with a fedora24 guest.

I copied the kernel and initramfs to the host and passed the kernel arguments
taken from grub.

The kernel starts but the boot sequence stalls at:

[  OK  ] Reached target Basic System.
[  126.238400] dracut-initqueue[290]: Warning: dracut-initqueue timeout - starting timeout scripts

I also noticed this error:

[    0.127303] WARNING: nvram corruption detected: 0-length partition
[    0.127610] nvram: No room to create ibm,rtas-log partition, deleting any obsolete OS partitions...
[    0.128011] nvram: Failed to find or create ibm,rtas-log partition, err -28
[    0.128300] nvram: No room to create lnx,oops-log partition, deleting any obsolete OS partitions...
[    0.128701] nvram: Failed to find or create lnx,oops-log partition, err -28
Linux ppc6400] nvram: Failed to initialize oops partition!

Cc'ing Nikunj who has already worked on booting a guest without SLOF.


> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
>  hw/ppc/spapr.c | 37 ++++++++++++++++++++-----------------
>  1 file changed, 20 insertions(+), 17 deletions(-)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 7f33a1b..bbdb21d 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -1219,8 +1219,11 @@ static void ppc_spapr_reset(void)
>      first_ppc_cpu->env.gpr[3] = spapr->fdt_addr;
>      first_ppc_cpu->env.gpr[5] = 0;
>      first_cpu->halted = 0;
> -    first_ppc_cpu->env.nip = SPAPR_ENTRY_POINT;
> -
> +    if (machine->kernel_filename) {
> +        first_ppc_cpu->env.nip = KERNEL_LOAD_ADDR;
> +    } else {
> +        first_ppc_cpu->env.nip = SPAPR_ENTRY_POINT;
> +    }
>  }
>  
>  static void spapr_create_nvram(sPAPRMachineState *spapr)
> @@ -2023,23 +2026,23 @@ static void ppc_spapr_init(MachineState *machine)
>              initrd_base = 0;
>              initrd_size = 0;
>          }
> +    } else {
> +        if (bios_name == NULL) {
> +            bios_name = FW_FILE_NAME;
> +        }
> +        filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
> +        if (!filename) {
> +            error_report("Could not find LPAR firmware '%s'", bios_name);
> +            exit(1);
> +        }
> +        fw_size = load_image_targphys(filename, 0, FW_MAX_SIZE);
> +        if (fw_size <= 0) {
> +            error_report("Could not load LPAR firmware '%s'", filename);
> +            exit(1);
> +        }
> +        g_free(filename);
>      }
>  
> -    if (bios_name == NULL) {
> -        bios_name = FW_FILE_NAME;
> -    }
> -    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
> -    if (!filename) {
> -        error_report("Could not find LPAR firmware '%s'", bios_name);
> -        exit(1);
> -    }
> -    fw_size = load_image_targphys(filename, 0, FW_MAX_SIZE);
> -    if (fw_size <= 0) {
> -        error_report("Could not load LPAR firmware '%s'", filename);
> -        exit(1);
> -    }
> -    g_free(filename);
> -
>      /* FIXME: Should register things through the MachineState's qdev
>       * interface, this is a legacy from the sPAPREnvironment structure
>       * which predated MachineState but had a similar function */

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH RFC] spapr: by-pass SLOF when -kernel is provided
  2016-07-05 18:44 ` Greg Kurz
@ 2016-07-05 18:51   ` Laurent Vivier
  2016-07-06  7:03     ` Greg Kurz
  0 siblings, 1 reply; 11+ messages in thread
From: Laurent Vivier @ 2016-07-05 18:51 UTC (permalink / raw)
  To: Greg Kurz; +Cc: David Gibson, Andrew Jones



On 05/07/2016 20:44, Greg Kurz wrote:
> On Tue,  5 Jul 2016 16:42:37 +0200
> Laurent Vivier <lvivier@redhat.com> wrote:
> 
>> As device-tree is now fully built by QEMU, we don't need SLOF
>> anymore if the kernel is provided on the command line.
>>
>> In this case, don't load SLOF and boot directly into the
>> kernel.
>>
>> This saves at least 5 seconds on the boot sequence.
>>
> 
> The concept looks great so I gave a try with a fedora24 guest.

I did the same test with a rhel7 vmlinuz adn intramfs and it works fine.

> 
> I copied the kernel and initramfs to the host and passed the kernel arguments
> taken from grub.
> 
> The kernel starts but the boot sequence stalls at:
> 
> [  OK  ] Reached target Basic System.
> [  126.238400] dracut-initqueue[290]: Warning: dracut-initqueue timeout - starting timeout scripts

It happens when the initramfs didn't have the disk driver: do you use
the same disk controller with the "-kernel" than the one which was used
when the initramfs has been created?

> 
> I also noticed this error:
> 
> [    0.127303] WARNING: nvram corruption detected: 0-length partition
> [    0.127610] nvram: No room to create ibm,rtas-log partition, deleting any obsolete OS partitions...
> [    0.128011] nvram: Failed to find or create ibm,rtas-log partition, err -28
> [    0.128300] nvram: No room to create lnx,oops-log partition, deleting any obsolete OS partitions...
> [    0.128701] nvram: Failed to find or create lnx,oops-log partition, err -28
> Linux ppc6400] nvram: Failed to initialize oops partition!

I've also that: perhaps SLOF is initializing the NVRAM when it is empty,
and qemu doesn't?

I will check.

Thanks,
Laurent

> 
> Cc'ing Nikunj who has already worked on booting a guest without SLOF.
> 
> 
>> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
>> ---
>>  hw/ppc/spapr.c | 37 ++++++++++++++++++++-----------------
>>  1 file changed, 20 insertions(+), 17 deletions(-)
>>
>> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
>> index 7f33a1b..bbdb21d 100644
>> --- a/hw/ppc/spapr.c
>> +++ b/hw/ppc/spapr.c
>> @@ -1219,8 +1219,11 @@ static void ppc_spapr_reset(void)
>>      first_ppc_cpu->env.gpr[3] = spapr->fdt_addr;
>>      first_ppc_cpu->env.gpr[5] = 0;
>>      first_cpu->halted = 0;
>> -    first_ppc_cpu->env.nip = SPAPR_ENTRY_POINT;
>> -
>> +    if (machine->kernel_filename) {
>> +        first_ppc_cpu->env.nip = KERNEL_LOAD_ADDR;
>> +    } else {
>> +        first_ppc_cpu->env.nip = SPAPR_ENTRY_POINT;
>> +    }
>>  }
>>  
>>  static void spapr_create_nvram(sPAPRMachineState *spapr)
>> @@ -2023,23 +2026,23 @@ static void ppc_spapr_init(MachineState *machine)
>>              initrd_base = 0;
>>              initrd_size = 0;
>>          }
>> +    } else {
>> +        if (bios_name == NULL) {
>> +            bios_name = FW_FILE_NAME;
>> +        }
>> +        filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
>> +        if (!filename) {
>> +            error_report("Could not find LPAR firmware '%s'", bios_name);
>> +            exit(1);
>> +        }
>> +        fw_size = load_image_targphys(filename, 0, FW_MAX_SIZE);
>> +        if (fw_size <= 0) {
>> +            error_report("Could not load LPAR firmware '%s'", filename);
>> +            exit(1);
>> +        }
>> +        g_free(filename);
>>      }
>>  
>> -    if (bios_name == NULL) {
>> -        bios_name = FW_FILE_NAME;
>> -    }
>> -    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
>> -    if (!filename) {
>> -        error_report("Could not find LPAR firmware '%s'", bios_name);
>> -        exit(1);
>> -    }
>> -    fw_size = load_image_targphys(filename, 0, FW_MAX_SIZE);
>> -    if (fw_size <= 0) {
>> -        error_report("Could not load LPAR firmware '%s'", filename);
>> -        exit(1);
>> -    }
>> -    g_free(filename);
>> -
>>      /* FIXME: Should register things through the MachineState's qdev
>>       * interface, this is a legacy from the sPAPREnvironment structure
>>       * which predated MachineState but had a similar function */
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH RFC] spapr: by-pass SLOF when -kernel is provided
  2016-07-05 14:42 [Qemu-devel] [PATCH RFC] spapr: by-pass SLOF when -kernel is provided Laurent Vivier
  2016-07-05 17:58 ` [Qemu-devel] [Qemu-ppc] " Cédric Le Goater
  2016-07-05 18:44 ` Greg Kurz
@ 2016-07-06  1:35 ` David Gibson
  2016-07-06  3:33   ` Alexey Kardashevskiy
  2 siblings, 1 reply; 11+ messages in thread
From: David Gibson @ 2016-07-06  1:35 UTC (permalink / raw)
  To: Laurent Vivier
  Cc: qemu-ppc, qemu-devel, Richard W.M. Jones, Thomas Huth, Andrew Jones

[-- Attachment #1: Type: text/plain, Size: 3159 bytes --]

On Tue, Jul 05, 2016 at 04:42:37PM +0200, Laurent Vivier wrote:
> As device-tree is now fully built by QEMU, we don't need SLOF
> anymore if the kernel is provided on the command line.
> 
> In this case, don't load SLOF and boot directly into the
> kernel.
> 
> This saves at least 5 seconds on the boot sequence.
> 
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>

I'm not comfortable applying this.  We actually used to do this ages
ago, but changed to always running through SLOF, and there were
reasons for doing so.

I don't remember exactly what they were, but I think it boiled down to
slight differences in state between booting from SLOF and booting
without SLOF leading to confusing errors from the guest kernel.

> ---
>  hw/ppc/spapr.c | 37 ++++++++++++++++++++-----------------
>  1 file changed, 20 insertions(+), 17 deletions(-)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 7f33a1b..bbdb21d 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -1219,8 +1219,11 @@ static void ppc_spapr_reset(void)
>      first_ppc_cpu->env.gpr[3] = spapr->fdt_addr;
>      first_ppc_cpu->env.gpr[5] = 0;
>      first_cpu->halted = 0;
> -    first_ppc_cpu->env.nip = SPAPR_ENTRY_POINT;
> -
> +    if (machine->kernel_filename) {
> +        first_ppc_cpu->env.nip = KERNEL_LOAD_ADDR;
> +    } else {
> +        first_ppc_cpu->env.nip = SPAPR_ENTRY_POINT;
> +    }
>  }
>  
>  static void spapr_create_nvram(sPAPRMachineState *spapr)
> @@ -2023,23 +2026,23 @@ static void ppc_spapr_init(MachineState *machine)
>              initrd_base = 0;
>              initrd_size = 0;
>          }
> +    } else {
> +        if (bios_name == NULL) {
> +            bios_name = FW_FILE_NAME;
> +        }
> +        filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
> +        if (!filename) {
> +            error_report("Could not find LPAR firmware '%s'", bios_name);
> +            exit(1);
> +        }
> +        fw_size = load_image_targphys(filename, 0, FW_MAX_SIZE);
> +        if (fw_size <= 0) {
> +            error_report("Could not load LPAR firmware '%s'", filename);
> +            exit(1);
> +        }
> +        g_free(filename);
>      }
>  
> -    if (bios_name == NULL) {
> -        bios_name = FW_FILE_NAME;
> -    }
> -    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
> -    if (!filename) {
> -        error_report("Could not find LPAR firmware '%s'", bios_name);
> -        exit(1);
> -    }
> -    fw_size = load_image_targphys(filename, 0, FW_MAX_SIZE);
> -    if (fw_size <= 0) {
> -        error_report("Could not load LPAR firmware '%s'", filename);
> -        exit(1);
> -    }
> -    g_free(filename);
> -
>      /* FIXME: Should register things through the MachineState's qdev
>       * interface, this is a legacy from the sPAPREnvironment structure
>       * which predated MachineState but had a similar function */

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH RFC] spapr: by-pass SLOF when -kernel is provided
  2016-07-06  1:35 ` [Qemu-devel] " David Gibson
@ 2016-07-06  3:33   ` Alexey Kardashevskiy
  2016-07-06  7:04     ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
  2016-07-06  8:02     ` Nikunj A Dadhania
  0 siblings, 2 replies; 11+ messages in thread
From: Alexey Kardashevskiy @ 2016-07-06  3:33 UTC (permalink / raw)
  To: David Gibson, Laurent Vivier
  Cc: Andrew Jones, Thomas Huth, qemu-ppc, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1111 bytes --]

On 06/07/16 11:35, David Gibson wrote:
> On Tue, Jul 05, 2016 at 04:42:37PM +0200, Laurent Vivier wrote:
>> As device-tree is now fully built by QEMU, we don't need SLOF
>> anymore if the kernel is provided on the command line.
>>
>> In this case, don't load SLOF and boot directly into the
>> kernel.
>>
>> This saves at least 5 seconds on the boot sequence.
>>
>> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> 
> I'm not comfortable applying this.  We actually used to do this ages
> ago, but changed to always running through SLOF, and there were
> reasons for doing so.
> 
> I don't remember exactly what they were, but I think it boiled down to
> slight differences in state between booting from SLOF and booting
> without SLOF leading to confusing errors from the guest kernel.
> 

PCI resource allocation is still done by SLOF (however having them not set
will trigger allocation in the guest but this is rather unexpected
workaround than a feature); "client-architecture-support" won't work
without SLOF either (i.e. compatibile PowerISA 2.0x CPUs).



-- 
Alexey


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH RFC] spapr: by-pass SLOF when -kernel is provided
  2016-07-05 18:51   ` Laurent Vivier
@ 2016-07-06  7:03     ` Greg Kurz
  2016-07-06  8:37       ` Laurent Vivier
  0 siblings, 1 reply; 11+ messages in thread
From: Greg Kurz @ 2016-07-06  7:03 UTC (permalink / raw)
  To: Laurent Vivier
  Cc: Thomas Huth, Richard W.M. Jones, Andrew Jones, qemu-devel,
	qemu-ppc, David Gibson

On Tue, 5 Jul 2016 20:51:41 +0200
Laurent Vivier <lvivier@redhat.com> wrote:

> On 05/07/2016 20:44, Greg Kurz wrote:
> > On Tue,  5 Jul 2016 16:42:37 +0200
> > Laurent Vivier <lvivier@redhat.com> wrote:
> >   
> >> As device-tree is now fully built by QEMU, we don't need SLOF
> >> anymore if the kernel is provided on the command line.
> >>
> >> In this case, don't load SLOF and boot directly into the
> >> kernel.
> >>
> >> This saves at least 5 seconds on the boot sequence.
> >>  
> > 
> > The concept looks great so I gave a try with a fedora24 guest.  
> 
> I did the same test with a rhel7 vmlinuz adn intramfs and it works fine.
> 
> > 
> > I copied the kernel and initramfs to the host and passed the kernel arguments
> > taken from grub.
> > 
> > The kernel starts but the boot sequence stalls at:
> > 
> > [  OK  ] Reached target Basic System.
> > [  126.238400] dracut-initqueue[290]: Warning: dracut-initqueue timeout - starting timeout scripts  
> 
> It happens when the initramfs didn't have the disk driver: do you use
> the same disk controller with the "-kernel" than the one which was used
> when the initramfs has been created?
> 

Yes. The very same QEMU command line (except -kernel/-initrd/-append) works with
SLOF and fails without SLOF.

> > 
> > I also noticed this error:
> > 
> > [    0.127303] WARNING: nvram corruption detected: 0-length partition
> > [    0.127610] nvram: No room to create ibm,rtas-log partition, deleting any obsolete OS partitions...
> > [    0.128011] nvram: Failed to find or create ibm,rtas-log partition, err -28
> > [    0.128300] nvram: No room to create lnx,oops-log partition, deleting any obsolete OS partitions...
> > [    0.128701] nvram: Failed to find or create lnx,oops-log partition, err -28
> > Linux ppc6400] nvram: Failed to initialize oops partition!  
> 
> I've also that: perhaps SLOF is initializing the NVRAM when it is empty,
> and qemu doesn't?
> 
> I will check.
> 
> Thanks,
> Laurent
> 
> > 
> > Cc'ing Nikunj who has already worked on booting a guest without SLOF.
> > 
> >   
> >> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> >> ---
> >>  hw/ppc/spapr.c | 37 ++++++++++++++++++++-----------------
> >>  1 file changed, 20 insertions(+), 17 deletions(-)
> >>
> >> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> >> index 7f33a1b..bbdb21d 100644
> >> --- a/hw/ppc/spapr.c
> >> +++ b/hw/ppc/spapr.c
> >> @@ -1219,8 +1219,11 @@ static void ppc_spapr_reset(void)
> >>      first_ppc_cpu->env.gpr[3] = spapr->fdt_addr;
> >>      first_ppc_cpu->env.gpr[5] = 0;
> >>      first_cpu->halted = 0;
> >> -    first_ppc_cpu->env.nip = SPAPR_ENTRY_POINT;
> >> -
> >> +    if (machine->kernel_filename) {
> >> +        first_ppc_cpu->env.nip = KERNEL_LOAD_ADDR;
> >> +    } else {
> >> +        first_ppc_cpu->env.nip = SPAPR_ENTRY_POINT;
> >> +    }
> >>  }
> >>  
> >>  static void spapr_create_nvram(sPAPRMachineState *spapr)
> >> @@ -2023,23 +2026,23 @@ static void ppc_spapr_init(MachineState *machine)
> >>              initrd_base = 0;
> >>              initrd_size = 0;
> >>          }
> >> +    } else {
> >> +        if (bios_name == NULL) {
> >> +            bios_name = FW_FILE_NAME;
> >> +        }
> >> +        filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
> >> +        if (!filename) {
> >> +            error_report("Could not find LPAR firmware '%s'", bios_name);
> >> +            exit(1);
> >> +        }
> >> +        fw_size = load_image_targphys(filename, 0, FW_MAX_SIZE);
> >> +        if (fw_size <= 0) {
> >> +            error_report("Could not load LPAR firmware '%s'", filename);
> >> +            exit(1);
> >> +        }
> >> +        g_free(filename);
> >>      }
> >>  
> >> -    if (bios_name == NULL) {
> >> -        bios_name = FW_FILE_NAME;
> >> -    }
> >> -    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
> >> -    if (!filename) {
> >> -        error_report("Could not find LPAR firmware '%s'", bios_name);
> >> -        exit(1);
> >> -    }
> >> -    fw_size = load_image_targphys(filename, 0, FW_MAX_SIZE);
> >> -    if (fw_size <= 0) {
> >> -        error_report("Could not load LPAR firmware '%s'", filename);
> >> -        exit(1);
> >> -    }
> >> -    g_free(filename);
> >> -
> >>      /* FIXME: Should register things through the MachineState's qdev
> >>       * interface, this is a legacy from the sPAPREnvironment structure
> >>       * which predated MachineState but had a similar function */  
> >   
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH RFC] spapr: by-pass SLOF when -kernel is provided
  2016-07-06  3:33   ` Alexey Kardashevskiy
@ 2016-07-06  7:04     ` Greg Kurz
  2016-07-06  8:02     ` Nikunj A Dadhania
  1 sibling, 0 replies; 11+ messages in thread
From: Greg Kurz @ 2016-07-06  7:04 UTC (permalink / raw)
  To: Alexey Kardashevskiy
  Cc: David Gibson, Laurent Vivier, Andrew Jones, qemu-ppc, Thomas Huth

[-- Attachment #1: Type: text/plain, Size: 1706 bytes --]

On Wed, 6 Jul 2016 13:33:49 +1000
Alexey Kardashevskiy <aik@ozlabs.ru> wrote:

> On 06/07/16 11:35, David Gibson wrote:
> > On Tue, Jul 05, 2016 at 04:42:37PM +0200, Laurent Vivier wrote:  
> >> As device-tree is now fully built by QEMU, we don't need SLOF
> >> anymore if the kernel is provided on the command line.
> >>
> >> In this case, don't load SLOF and boot directly into the
> >> kernel.
> >>
> >> This saves at least 5 seconds on the boot sequence.
> >>
> >> Signed-off-by: Laurent Vivier <lvivier@redhat.com>  
> > 
> > I'm not comfortable applying this.  We actually used to do this ages
> > ago, but changed to always running through SLOF, and there were
> > reasons for doing so.
> > 
> > I don't remember exactly what they were, but I think it boiled down to
> > slight differences in state between booting from SLOF and booting
> > without SLOF leading to confusing errors from the guest kernel.
> >   
> 
> PCI resource allocation is still done by SLOF (however having them not set
> will trigger allocation in the guest but this is rather unexpected
> workaround than a feature); "client-architecture-support" won't work
> without SLOF either (i.e. compatibile PowerISA 2.0x CPUs).
> 

Not even sure the workaround actually works:

I retried with a ppc64le guest and this time I get:

[    1.055922] virtio-pci 0000:00:01.0: virtio_pci: leaving for legacy driver
[    1.056048] virtio-pci: probe of 0000:00:01.0 failed with error -12
[    1.056263] virtio-pci 0000:00:00.0: virtio_pci: leaving for legacy driver
[    1.056373] virtio-pci: probe of 0000:00:00.0 failed with error -12

i.e. virtio_reset() isn't called during probing :-\

--
Greg

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH RFC] spapr: by-pass SLOF when -kernel is provided
  2016-07-06  3:33   ` Alexey Kardashevskiy
  2016-07-06  7:04     ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
@ 2016-07-06  8:02     ` Nikunj A Dadhania
  2016-07-06  8:04       ` Alexey Kardashevskiy
  1 sibling, 1 reply; 11+ messages in thread
From: Nikunj A Dadhania @ 2016-07-06  8:02 UTC (permalink / raw)
  To: Alexey Kardashevskiy, David Gibson, Laurent Vivier
  Cc: Andrew Jones, qemu-ppc, Thomas Huth

Alexey Kardashevskiy <aik@ozlabs.ru> writes:

> [ Unknown signature status ]
> On 06/07/16 11:35, David Gibson wrote:
>> On Tue, Jul 05, 2016 at 04:42:37PM +0200, Laurent Vivier wrote:
>>> As device-tree is now fully built by QEMU, we don't need SLOF
>>> anymore if the kernel is provided on the command line.
>>>
>>> In this case, don't load SLOF and boot directly into the
>>> kernel.
>>>
>>> This saves at least 5 seconds on the boot sequence.
>>>
>>> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
>> 
>> I'm not comfortable applying this.  We actually used to do this ages
>> ago, but changed to always running through SLOF, and there were
>> reasons for doing so.
>> 
>> I don't remember exactly what they were, but I think it boiled down to
>> slight differences in state between booting from SLOF and booting
>> without SLOF leading to confusing errors from the guest kernel.
>> 
>
> PCI resource allocation is still done by SLOF (however having them not set
> will trigger allocation in the guest but this is rather unexpected
> workaround than a feature);

I am not sure that works well, i had a work around in qemu for this to get
triggered in guest kernel.

> "client-architecture-support" won't work
> without SLOF either (i.e. compatibile PowerISA 2.0x CPUs).

Right.

Regards
Nikunj

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH RFC] spapr: by-pass SLOF when -kernel is provided
  2016-07-06  8:02     ` Nikunj A Dadhania
@ 2016-07-06  8:04       ` Alexey Kardashevskiy
  0 siblings, 0 replies; 11+ messages in thread
From: Alexey Kardashevskiy @ 2016-07-06  8:04 UTC (permalink / raw)
  To: Nikunj A Dadhania, David Gibson, Laurent Vivier
  Cc: Andrew Jones, qemu-ppc, Thomas Huth

On 06/07/16 18:02, Nikunj A Dadhania wrote:
> Alexey Kardashevskiy <aik@ozlabs.ru> writes:
> 
>> [ Unknown signature status ]
>> On 06/07/16 11:35, David Gibson wrote:
>>> On Tue, Jul 05, 2016 at 04:42:37PM +0200, Laurent Vivier wrote:
>>>> As device-tree is now fully built by QEMU, we don't need SLOF
>>>> anymore if the kernel is provided on the command line.
>>>>
>>>> In this case, don't load SLOF and boot directly into the
>>>> kernel.
>>>>
>>>> This saves at least 5 seconds on the boot sequence.
>>>>
>>>> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
>>>
>>> I'm not comfortable applying this.  We actually used to do this ages
>>> ago, but changed to always running through SLOF, and there were
>>> reasons for doing so.
>>>
>>> I don't remember exactly what they were, but I think it boiled down to
>>> slight differences in state between booting from SLOF and booting
>>> without SLOF leading to confusing errors from the guest kernel.
>>>
>>
>> PCI resource allocation is still done by SLOF (however having them not set
>> will trigger allocation in the guest but this is rather unexpected
>> workaround than a feature);
> 
> I am not sure that works well, i had a work around in qemu for this to get
> triggered in guest kernel.
> 

Creating resource properties (i.e. BARs) with FFFFFFFF in QEMU did the
trick if I remember correctly. Either way, this is a hack.


>> "client-architecture-support" won't work
>> without SLOF either (i.e. compatibile PowerISA 2.0x CPUs).
> 
> Right.
> 
> Regards
> Nikunj
> 


-- 
Alexey

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH RFC] spapr: by-pass SLOF when -kernel is provided
  2016-07-06  7:03     ` Greg Kurz
@ 2016-07-06  8:37       ` Laurent Vivier
  0 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2016-07-06  8:37 UTC (permalink / raw)
  To: Greg Kurz
  Cc: Thomas Huth, Richard W.M. Jones, Andrew Jones, qemu-devel,
	qemu-ppc, David Gibson



On 06/07/2016 09:03, Greg Kurz wrote:
> On Tue, 5 Jul 2016 20:51:41 +0200
> Laurent Vivier <lvivier@redhat.com> wrote:
> 
>> On 05/07/2016 20:44, Greg Kurz wrote:
>>> On Tue,  5 Jul 2016 16:42:37 +0200
>>> Laurent Vivier <lvivier@redhat.com> wrote:
>>>   
>>>> As device-tree is now fully built by QEMU, we don't need SLOF
>>>> anymore if the kernel is provided on the command line.
>>>>
>>>> In this case, don't load SLOF and boot directly into the
>>>> kernel.
>>>>
>>>> This saves at least 5 seconds on the boot sequence.
>>>>  
>>>
>>> The concept looks great so I gave a try with a fedora24 guest.  
>>
>> I did the same test with a rhel7 vmlinuz adn intramfs and it works fine.
>>
>>>
>>> I copied the kernel and initramfs to the host and passed the kernel arguments
>>> taken from grub.
>>>
>>> The kernel starts but the boot sequence stalls at:
>>>
>>> [  OK  ] Reached target Basic System.
>>> [  126.238400] dracut-initqueue[290]: Warning: dracut-initqueue timeout - starting timeout scripts  
>>
>> It happens when the initramfs didn't have the disk driver: do you use
>> the same disk controller with the "-kernel" than the one which was used
>> when the initramfs has been created?
>>
> 
> Yes. The very same QEMU command line (except -kernel/-initrd/-append) works with
> SLOF and fails without SLOF.

I think it works for me because I use spapr-vscsi  and spapr-vlan.

Laurent

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-07-06  8:38 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-05 14:42 [Qemu-devel] [PATCH RFC] spapr: by-pass SLOF when -kernel is provided Laurent Vivier
2016-07-05 17:58 ` [Qemu-devel] [Qemu-ppc] " Cédric Le Goater
2016-07-05 18:44 ` Greg Kurz
2016-07-05 18:51   ` Laurent Vivier
2016-07-06  7:03     ` Greg Kurz
2016-07-06  8:37       ` Laurent Vivier
2016-07-06  1:35 ` [Qemu-devel] " David Gibson
2016-07-06  3:33   ` Alexey Kardashevskiy
2016-07-06  7:04     ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2016-07-06  8:02     ` Nikunj A Dadhania
2016-07-06  8:04       ` Alexey Kardashevskiy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.