diff mbox series

hw/loongarch: Modify flash block size to 256K

Message ID 20240624033319.999631-1-lixianglai@loongson.cn (mailing list archive)
State New
Headers show
Series hw/loongarch: Modify flash block size to 256K | expand

Commit Message

lixianglai June 24, 2024, 3:33 a.m. UTC
loongarch added a common library for edk2 to
parse flash base addresses through fdt.
For compatibility with other architectures,
the flash block size in qemu is now changed to 256k.

Signed-off-by: Xianglai Li <lixianglai@loongson.cn>
---
Cc: Bibo Mao <maobibo@loongson.cn>
Cc: Song Gao <gaosong@loongson.cn>

 include/hw/loongarch/virt.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Philippe Mathieu-Daudé June 24, 2024, 8:01 a.m. UTC | #1
Hi Xianglai,

On 24/6/24 05:33, Xianglai Li wrote:
> loongarch added a common library for edk2 to
> parse flash base addresses through fdt.
> For compatibility with other architectures,
> the flash block size in qemu is now changed to 256k.

Why is that an issue / concern?

> Signed-off-by: Xianglai Li <lixianglai@loongson.cn>
> ---
> Cc: Bibo Mao <maobibo@loongson.cn>
> Cc: Song Gao <gaosong@loongson.cn>
> 
>   include/hw/loongarch/virt.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/hw/loongarch/virt.h b/include/hw/loongarch/virt.h
> index 8fdfacf268..603c1cebdb 100644
> --- a/include/hw/loongarch/virt.h
> +++ b/include/hw/loongarch/virt.h
> @@ -20,7 +20,7 @@
>   #define VIRT_FWCFG_BASE         0x1e020000UL
>   #define VIRT_BIOS_BASE          0x1c000000UL
>   #define VIRT_BIOS_SIZE          (16 * MiB)
> -#define VIRT_FLASH_SECTOR_SIZE  (128 * KiB)
> +#define VIRT_FLASH_SECTOR_SIZE  (256 * KiB)
>   #define VIRT_FLASH0_BASE        VIRT_BIOS_BASE
>   #define VIRT_FLASH0_SIZE        VIRT_BIOS_SIZE
>   #define VIRT_FLASH1_BASE        0x1d000000UL
lixianglai June 24, 2024, 11:22 a.m. UTC | #2
Hi Philippe:
> Hi Xianglai,
>
> On 24/6/24 05:33, Xianglai Li wrote:
>> loongarch added a common library for edk2 to
>> parse flash base addresses through fdt.
>> For compatibility with other architectures,
>> the flash block size in qemu is now changed to 256k.
>
> Why is that an issue / concern?
>

The patch submitted in edk2 is as follows:
https://edk2.groups.io/g/devel/message/118988
The commit ID is:
cac1ea6c2a6eac1772556e718154a00fcb093b88

+
+#include <Protocol/FdtClient.h>
+#include <stdbool.h>
+
+#define QEMU_NOR_BLOCK_SIZE  SIZE_256KB

In this patch, only the flash base address is resolved from the fdt,
and there is no flash block size information.
The default flash block size of the old implementation is 256K.
In order to be compatible with the flash block size used by the existing
architecture to achieve the purpose of minimum modification,
The default flash block size in this patch is 256K.

The subsequent bios of loongarch will also use the lib library provided by this patch,
so the flash block size needs to be changed to 256K。

Thanks,
Xianglai.

>> Signed-off-by: Xianglai Li <lixianglai@loongson.cn>
>> ---
>> Cc: Bibo Mao <maobibo@loongson.cn>
>> Cc: Song Gao <gaosong@loongson.cn>
>>
>>   include/hw/loongarch/virt.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/include/hw/loongarch/virt.h b/include/hw/loongarch/virt.h
>> index 8fdfacf268..603c1cebdb 100644
>> --- a/include/hw/loongarch/virt.h
>> +++ b/include/hw/loongarch/virt.h
>> @@ -20,7 +20,7 @@
>>   #define VIRT_FWCFG_BASE         0x1e020000UL
>>   #define VIRT_BIOS_BASE          0x1c000000UL
>>   #define VIRT_BIOS_SIZE          (16 * MiB)
>> -#define VIRT_FLASH_SECTOR_SIZE  (128 * KiB)
>> +#define VIRT_FLASH_SECTOR_SIZE  (256 * KiB)
>>   #define VIRT_FLASH0_BASE        VIRT_BIOS_BASE
>>   #define VIRT_FLASH0_SIZE        VIRT_BIOS_SIZE
>>   #define VIRT_FLASH1_BASE        0x1d000000UL
>
diff mbox series

Patch

diff --git a/include/hw/loongarch/virt.h b/include/hw/loongarch/virt.h
index 8fdfacf268..603c1cebdb 100644
--- a/include/hw/loongarch/virt.h
+++ b/include/hw/loongarch/virt.h
@@ -20,7 +20,7 @@ 
 #define VIRT_FWCFG_BASE         0x1e020000UL
 #define VIRT_BIOS_BASE          0x1c000000UL
 #define VIRT_BIOS_SIZE          (16 * MiB)
-#define VIRT_FLASH_SECTOR_SIZE  (128 * KiB)
+#define VIRT_FLASH_SECTOR_SIZE  (256 * KiB)
 #define VIRT_FLASH0_BASE        VIRT_BIOS_BASE
 #define VIRT_FLASH0_SIZE        VIRT_BIOS_SIZE
 #define VIRT_FLASH1_BASE        0x1d000000UL