diff mbox series

[RFC,v3,24/26] hw/core/loader: Add fields to RomLoaderNotify

Message ID 20241125195626.856992-26-jean-philippe@linaro.org
State New
Headers show
Series arm: Run Arm CCA VMs with KVM | expand

Commit Message

Jean-Philippe Brucker Nov. 25, 2024, 7:56 p.m. UTC
In order to write an event log, the ROM load notification handler needs
two more fields.

Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
---
v2->v3: New
---
 include/hw/loader.h | 2 ++
 hw/core/loader.c    | 2 ++
 2 files changed, 4 insertions(+)

Comments

Philippe Mathieu-Daudé Dec. 5, 2024, 10:21 p.m. UTC | #1
On 25/11/24 20:56, Jean-Philippe Brucker wrote:
> In order to write an event log, the ROM load notification handler needs
> two more fields.

IMHO it makes more sense to squash that in the "hw/core/loader:
Add ROM loader notifier" patch introducing that API.

> 
> Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
> ---
> v2->v3: New
> ---
>   include/hw/loader.h | 2 ++
>   hw/core/loader.c    | 2 ++
>   2 files changed, 4 insertions(+)
> 
> diff --git a/include/hw/loader.h b/include/hw/loader.h
> index 0cd9905f97..73f317966d 100644
> --- a/include/hw/loader.h
> +++ b/include/hw/loader.h
> @@ -355,6 +355,8 @@ ssize_t rom_add_option(const char *file, int32_t bootindex);
>   
>   typedef struct RomLoaderNotify {
>       /* Parameters passed to rom_add_blob() */
> +    const char *name;

Description of the loaded ROM.

> +    uint8_t *data;

Or 'blob', blob_ptr. Maybe declare as 'const void *'?

>       hwaddr addr;

Now easier to document, where 'data' is addressed in guest memory.

>       size_t len;

Size of 'data'.

>       size_t max_len;

Still unused. Drop?
Jean-Philippe Brucker Dec. 10, 2024, 7:04 p.m. UTC | #2
On Thu, Dec 05, 2024 at 11:21:19PM +0100, Philippe Mathieu-Daudé wrote:
> On 25/11/24 20:56, Jean-Philippe Brucker wrote:
> > In order to write an event log, the ROM load notification handler needs
> > two more fields.
> 
> IMHO it makes more sense to squash that in the "hw/core/loader:
> Add ROM loader notifier" patch introducing that API.

Yes I'd squash it if we decide that the patch 25, which needs this, is
useful. But it's possible that no one actually needs it so I left this
separate for the moment.

> 
> > 
> > Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
> > ---
> > v2->v3: New
> > ---
> >   include/hw/loader.h | 2 ++
> >   hw/core/loader.c    | 2 ++
> >   2 files changed, 4 insertions(+)
> > 
> > diff --git a/include/hw/loader.h b/include/hw/loader.h
> > index 0cd9905f97..73f317966d 100644
> > --- a/include/hw/loader.h
> > +++ b/include/hw/loader.h
> > @@ -355,6 +355,8 @@ ssize_t rom_add_option(const char *file, int32_t bootindex);
> >   typedef struct RomLoaderNotify {
> >       /* Parameters passed to rom_add_blob() */
> > +    const char *name;
> 
> Description of the loaded ROM.
> 
> > +    uint8_t *data;
> 
> Or 'blob', blob_ptr. Maybe declare as 'const void *'?
> 
> >       hwaddr addr;
> 
> Now easier to document, where 'data' is addressed in guest memory.
> 
> >       size_t len;
> 
> Size of 'data'.

Thanks, I'll fix those

> 
> >       size_t max_len;
> 
> Still unused. Drop?

Yes

Thanks,
Jean
diff mbox series

Patch

diff --git a/include/hw/loader.h b/include/hw/loader.h
index 0cd9905f97..73f317966d 100644
--- a/include/hw/loader.h
+++ b/include/hw/loader.h
@@ -355,6 +355,8 @@  ssize_t rom_add_option(const char *file, int32_t bootindex);
 
 typedef struct RomLoaderNotify {
     /* Parameters passed to rom_add_blob() */
+    const char *name;
+    uint8_t *data;
     hwaddr addr;
     size_t len;
     size_t max_len;
diff --git a/hw/core/loader.c b/hw/core/loader.c
index 759a62cf58..4ff40e8762 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -1278,6 +1278,8 @@  static void rom_reset(void *unused)
         trace_loader_write_rom(rom->name, rom->addr, rom->datasize, rom->isrom);
 
         notify = (RomLoaderNotify) {
+            .name = rom->name,
+            .data = rom->data,
             .addr = rom->addr,
             .len = rom->datasize,
             .max_len = rom->romsize,