[PATCH 04/15] hw/alpha/dp264: Use rom_add_blob_fixed() for initrd params

Yodel Eldar posted 15 patches 4 weeks ago
Maintainers: Richard Henderson <richard.henderson@linaro.org>
[PATCH 04/15] hw/alpha/dp264: Use rom_add_blob_fixed() for initrd params
Posted by Yodel Eldar 4 weeks ago
Replace address_space_stq_le() invocations with rom_add_blob_fixed().
This will prove helpful when the Clipper becomes resettable, because
the params will be reloaded without the initrd file.

Signed-off-by: Yodel Eldar <yodel.eldar@yodel.dev>
---
 hw/alpha/dp264.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
index 87af919895..f036d72268 100644
--- a/hw/alpha/dp264.c
+++ b/hw/alpha/dp264.c
@@ -183,6 +183,7 @@ static void clipper_init(MachineState *machine)
         if (initrd_filename) {
             hwaddr initrd_base;
             int64_t initrd_size;
+            uint64_t initrd_info[2];
 
             initrd_size = get_image_size(initrd_filename, NULL);
             if (initrd_size < 0) {
@@ -204,11 +205,11 @@ static void clipper_init(MachineState *machine)
             load_image_targphys(initrd_filename, initrd_base,
                                 ram_size - initrd_base, NULL);
 
-            address_space_stq_le(&address_space_memory, param_offset + 0x100,
-                                 initrd_base + 0xfffffc0000000000ULL,
-                                 MEMTXATTRS_UNSPECIFIED, NULL);
-            address_space_stq_le(&address_space_memory, param_offset + 0x108,
-                                 initrd_size, MEMTXATTRS_UNSPECIFIED, NULL);
+            stq_le_p(&initrd_info[0], initrd_base + 0xfffffc0000000000ULL);
+            stq_le_p(&initrd_info[1], initrd_size);
+
+            rom_add_blob_fixed("initrd_info", initrd_info, sizeof(initrd_info),
+                               param_offset + 0x100);
         }
     }
 }

-- 
2.53.0
Re: [PATCH 04/15] hw/alpha/dp264: Use rom_add_blob_fixed() for initrd params
Posted by Richard Henderson 1 week, 6 days ago
On 3/11/26 08:31, Yodel Eldar wrote:
> Replace address_space_stq_le() invocations with rom_add_blob_fixed().
> This will prove helpful when the Clipper becomes resettable, because
> the params will be reloaded without the initrd file.
> 
> Signed-off-by: Yodel Eldar <yodel.eldar@yodel.dev>
> ---
>   hw/alpha/dp264.c | 11 ++++++-----
>   1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
> index 87af919895..f036d72268 100644
> --- a/hw/alpha/dp264.c
> +++ b/hw/alpha/dp264.c
> @@ -183,6 +183,7 @@ static void clipper_init(MachineState *machine)
>           if (initrd_filename) {
>               hwaddr initrd_base;
>               int64_t initrd_size;
> +            uint64_t initrd_info[2];
>   
>               initrd_size = get_image_size(initrd_filename, NULL);
>               if (initrd_size < 0) {
> @@ -204,11 +205,11 @@ static void clipper_init(MachineState *machine)
>               load_image_targphys(initrd_filename, initrd_base,
>                                   ram_size - initrd_base, NULL);
>   
> -            address_space_stq_le(&address_space_memory, param_offset + 0x100,
> -                                 initrd_base + 0xfffffc0000000000ULL,
> -                                 MEMTXATTRS_UNSPECIFIED, NULL);
> -            address_space_stq_le(&address_space_memory, param_offset + 0x108,
> -                                 initrd_size, MEMTXATTRS_UNSPECIFIED, NULL);
> +            stq_le_p(&initrd_info[0], initrd_base + 0xfffffc0000000000ULL);
> +            stq_le_p(&initrd_info[1], initrd_size);

You don't need stq_*_p, as initrd_info will never be misaligned.
Use

     initrd_info[0] = cpu_to_le64(initrd_base + 0xfffffc0000000000ULL);

etc


r~