diff mbox

[v4,12/14] hvmloader: Specific bios_load function required

Message ID 1457978150-27201-13-git-send-email-anthony.perard@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Anthony PERARD March 14, 2016, 5:55 p.m. UTC
All BIOS but ROMBIOS needs to be loaded via modules.

ROMBIOS is handled as a special case.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
---
No change in V4.

Change in V3:
- reprint Main BIOS in bios map with now available information from bios
  modules.
- handle rombios, and keep its built-in ROMs.
---
 tools/firmware/hvmloader/hvmloader.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

Comments

Konrad Rzeszutek Wilk March 16, 2016, 1:38 a.m. UTC | #1
On Mon, Mar 14, 2016 at 05:55:47PM +0000, Anthony PERARD wrote:

The title says:

" Specific bios_load function required "

But I am not sure what you mean?


> All BIOS but ROMBIOS needs to be loaded via modules.

All BIOSes but ROMBIOS needs to be loaded via modules?

> 
> ROMBIOS is handled as a special case.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> Acked-by: Jan Beulich <jbeulich@suse.com>
> ---
> No change in V4.
> 
> Change in V3:
> - reprint Main BIOS in bios map with now available information from bios
>   modules.
> - handle rombios, and keep its built-in ROMs.
> ---
>  tools/firmware/hvmloader/hvmloader.c | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/firmware/hvmloader/hvmloader.c b/tools/firmware/hvmloader/hvmloader.c
> index 460efb9..bb2a309 100644
> --- a/tools/firmware/hvmloader/hvmloader.c
> +++ b/tools/firmware/hvmloader/hvmloader.c
> @@ -323,21 +323,25 @@ int main(void)
>  
>      printf("Loading %s ...\n", bios->name);
>      bios_module = get_module_entry(hvm_start_info, "bios");
> -    if ( bios_module && bios->bios_load )
> +    if ( bios_module )
>      {
>          uint32_t paddr = bios_module->paddr;
>          bios->bios_load(bios, (void*)paddr, bios_module->size);
>      }
> -    else if ( bios->bios_load )
> +#ifdef ENABLE_ROMBIOS
> +    else if ( bios == &rombios_config )
>      {
>          bios->bios_load(bios, 0, 0);
>      }
> +#endif
>      else
>      {
> -        BUG_ON(bios->bios_address + bios->image_size >
> -               HVMLOADER_PHYSICAL_ADDRESS);
> -        memcpy((void *)bios->bios_address, bios->image,
> -               bios->image_size);
> +        /*
> +         * If there is no BIOS module supplied and if there is no embeded BIOS
> +         * image, then we failed. Only rombios might have an embedded bios blob.
> +         */
> +        printf("no BIOS ROM image found\n");
> +        BUG();
>      }
>  
>      if ( (hvm_info->nr_vcpus > 1) || hvm_info->apic_mode )
> -- 
> Anthony PERARD
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
Anthony PERARD March 17, 2016, 6:25 p.m. UTC | #2
On Tue, Mar 15, 2016 at 09:38:18PM -0400, Konrad Rzeszutek Wilk wrote:
> On Mon, Mar 14, 2016 at 05:55:47PM +0000, Anthony PERARD wrote:
> 
> The title says:
> 
> " Specific bios_load function required "
> 
> But I am not sure what you mean?

I meant that bios_config->bios_load() need to be defined and can not be
NULL anymore.

What about: "bios->bios_load() now needs to be defined"?

> > All BIOS but ROMBIOS needs to be loaded via modules.
> 
> All BIOSes but ROMBIOS needs to be loaded via modules?

OK.

> > 
> > ROMBIOS is handled as a special case.
> > 
> > Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> > Acked-by: Jan Beulich <jbeulich@suse.com>
> > ---
> > No change in V4.
> > 
> > Change in V3:
> > - reprint Main BIOS in bios map with now available information from bios
> >   modules.
> > - handle rombios, and keep its built-in ROMs.
> > ---
> >  tools/firmware/hvmloader/hvmloader.c | 16 ++++++++++------
> >  1 file changed, 10 insertions(+), 6 deletions(-)
> > 
> > diff --git a/tools/firmware/hvmloader/hvmloader.c b/tools/firmware/hvmloader/hvmloader.c
> > index 460efb9..bb2a309 100644
> > --- a/tools/firmware/hvmloader/hvmloader.c
> > +++ b/tools/firmware/hvmloader/hvmloader.c
> > @@ -323,21 +323,25 @@ int main(void)
> >  
> >      printf("Loading %s ...\n", bios->name);
> >      bios_module = get_module_entry(hvm_start_info, "bios");
> > -    if ( bios_module && bios->bios_load )
> > +    if ( bios_module )
> >      {
> >          uint32_t paddr = bios_module->paddr;
> >          bios->bios_load(bios, (void*)paddr, bios_module->size);
> >      }
> > -    else if ( bios->bios_load )
> > +#ifdef ENABLE_ROMBIOS
> > +    else if ( bios == &rombios_config )
> >      {
> >          bios->bios_load(bios, 0, 0);
> >      }
> > +#endif
> >      else
> >      {
> > -        BUG_ON(bios->bios_address + bios->image_size >
> > -               HVMLOADER_PHYSICAL_ADDRESS);
> > -        memcpy((void *)bios->bios_address, bios->image,
> > -               bios->image_size);
> > +        /*
> > +         * If there is no BIOS module supplied and if there is no embeded BIOS
> > +         * image, then we failed. Only rombios might have an embedded bios blob.
> > +         */
> > +        printf("no BIOS ROM image found\n");
> > +        BUG();
> >      }
> >  
> >      if ( (hvm_info->nr_vcpus > 1) || hvm_info->apic_mode )
diff mbox

Patch

diff --git a/tools/firmware/hvmloader/hvmloader.c b/tools/firmware/hvmloader/hvmloader.c
index 460efb9..bb2a309 100644
--- a/tools/firmware/hvmloader/hvmloader.c
+++ b/tools/firmware/hvmloader/hvmloader.c
@@ -323,21 +323,25 @@  int main(void)
 
     printf("Loading %s ...\n", bios->name);
     bios_module = get_module_entry(hvm_start_info, "bios");
-    if ( bios_module && bios->bios_load )
+    if ( bios_module )
     {
         uint32_t paddr = bios_module->paddr;
         bios->bios_load(bios, (void*)paddr, bios_module->size);
     }
-    else if ( bios->bios_load )
+#ifdef ENABLE_ROMBIOS
+    else if ( bios == &rombios_config )
     {
         bios->bios_load(bios, 0, 0);
     }
+#endif
     else
     {
-        BUG_ON(bios->bios_address + bios->image_size >
-               HVMLOADER_PHYSICAL_ADDRESS);
-        memcpy((void *)bios->bios_address, bios->image,
-               bios->image_size);
+        /*
+         * If there is no BIOS module supplied and if there is no embeded BIOS
+         * image, then we failed. Only rombios might have an embedded bios blob.
+         */
+        printf("no BIOS ROM image found\n");
+        BUG();
     }
 
     if ( (hvm_info->nr_vcpus > 1) || hvm_info->apic_mode )