There's an existing helper function designed to obtain the block size.
Modify ram_block_attribute_create() to use this function for
consistency.
Tested-by: Farrah Chen <farrah.chen@intel.com>
Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
---
Changes in v2:
- Newly added.
---
system/ram-block-attributes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/system/ram-block-attributes.c b/system/ram-block-attributes.c
index a7579de5b46..cf8f5f41966 100644
--- a/system/ram-block-attributes.c
+++ b/system/ram-block-attributes.c
@@ -390,7 +390,7 @@ int ram_block_attributes_state_change(RamBlockAttributes *attr,
RamBlockAttributes *ram_block_attributes_create(RAMBlock *ram_block)
{
- const int block_size = qemu_real_host_page_size();
+ const int block_size = ram_block_attributes_get_block_size();
RamBlockAttributes *attr;
MemoryRegion *mr = ram_block->mr;
--
2.43.5
On 10/23/2025 5:55 PM, Chenyi Qiang wrote:
> There's an existing helper function designed to obtain the block size.
> Modify ram_block_attribute_create() to use this function for
> consistency.
>
> Tested-by: Farrah Chen <farrah.chen@intel.com>
> Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
> ---
> Changes in v2:
> - Newly added.
> ---
> system/ram-block-attributes.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/system/ram-block-attributes.c b/system/ram-block-attributes.c
> index a7579de5b46..cf8f5f41966 100644
> --- a/system/ram-block-attributes.c
> +++ b/system/ram-block-attributes.c
> @@ -390,7 +390,7 @@ int ram_block_attributes_state_change(RamBlockAttributes *attr,
>
> RamBlockAttributes *ram_block_attributes_create(RAMBlock *ram_block)
> {
> - const int block_size = qemu_real_host_page_size();
> + const int block_size = ram_block_attributes_get_block_size();
> RamBlockAttributes *attr;
> MemoryRegion *mr = ram_block->mr;
>
On 23.10.25 11:55, Chenyi Qiang wrote:
> There's an existing helper function designed to obtain the block size.
> Modify ram_block_attribute_create() to use this function for
> consistency.
>
> Tested-by: Farrah Chen <farrah.chen@intel.com>
> Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
> ---
> Changes in v2:
> - Newly added.
> ---
> system/ram-block-attributes.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/system/ram-block-attributes.c b/system/ram-block-attributes.c
> index a7579de5b46..cf8f5f41966 100644
> --- a/system/ram-block-attributes.c
> +++ b/system/ram-block-attributes.c
> @@ -390,7 +390,7 @@ int ram_block_attributes_state_change(RamBlockAttributes *attr,
>
> RamBlockAttributes *ram_block_attributes_create(RAMBlock *ram_block)
> {
> - const int block_size = qemu_real_host_page_size();
> + const int block_size = ram_block_attributes_get_block_size();
Double space before the " " can be removed while you touch this.
--
Cheers
David / dhildenb
On 10/23/2025 6:17 PM, David Hildenbrand wrote:
> On 23.10.25 11:55, Chenyi Qiang wrote:
>> There's an existing helper function designed to obtain the block size.
>> Modify ram_block_attribute_create() to use this function for
>> consistency.
>>
>> Tested-by: Farrah Chen <farrah.chen@intel.com>
>> Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
>> ---
>> Changes in v2:
>> - Newly added.
>> ---
>> system/ram-block-attributes.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/system/ram-block-attributes.c b/system/ram-block-attributes.c
>> index a7579de5b46..cf8f5f41966 100644
>> --- a/system/ram-block-attributes.c
>> +++ b/system/ram-block-attributes.c
>> @@ -390,7 +390,7 @@ int ram_block_attributes_state_change(RamBlockAttributes *attr,
>> RamBlockAttributes *ram_block_attributes_create(RAMBlock *ram_block)
>> {
>> - const int block_size = qemu_real_host_page_size();
>> + const int block_size = ram_block_attributes_get_block_size();
>
> Double space before the " " can be removed while you touch this.
Oops, so careless I was. To fixup this patch:
===
From 3c224dfb946feccf6f94af8aa1068cc72bf5ddc7 Mon Sep 17 00:00:00 2001
From: Chenyi Qiang <chenyi.qiang@intel.com>
Date: Thu, 23 Oct 2025 19:43:52 +0800
Subject: [PATCH] fixup! ram-block-attributes: Unify the retrieval of the block
size
Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
---
system/ram-block-attributes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/system/ram-block-attributes.c b/system/ram-block-attributes.c
index cf8f5f41966..fb7c5c27467 100644
--- a/system/ram-block-attributes.c
+++ b/system/ram-block-attributes.c
@@ -390,7 +390,7 @@ int ram_block_attributes_state_change(RamBlockAttributes *attr,
RamBlockAttributes *ram_block_attributes_create(RAMBlock *ram_block)
{
- const int block_size = ram_block_attributes_get_block_size();
+ const int block_size = ram_block_attributes_get_block_size();
RamBlockAttributes *attr;
MemoryRegion *mr = ram_block->mr;
--
2.43.5
>
© 2016 - 2025 Red Hat, Inc.