[PATCH 1/7] stubs: Merge physmem.c within ram-block.c

Philippe Mathieu-Daudé posted 7 patches 3 days, 10 hours ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Peter Xu <peterx@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>
[PATCH 1/7] stubs: Merge physmem.c within ram-block.c
Posted by Philippe Mathieu-Daudé 3 days, 10 hours ago
physmem.c defines 2 stubs which are related to ram-block:
qemu_ram_block_from_host() and qemu_ram_get_fd().
Move them with the other ram-block stubs.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 stubs/physmem.c   | 13 -------------
 stubs/ram-block.c | 11 +++++++++++
 stubs/meson.build |  1 -
 3 files changed, 11 insertions(+), 14 deletions(-)
 delete mode 100644 stubs/physmem.c

diff --git a/stubs/physmem.c b/stubs/physmem.c
deleted file mode 100644
index 14667f2bd8f..00000000000
--- a/stubs/physmem.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include "qemu/osdep.h"
-#include "system/ramblock.h"
-
-RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset,
-                                   ram_addr_t *offset)
-{
-    return NULL;
-}
-
-int qemu_ram_get_fd(RAMBlock *rb)
-{
-    return -1;
-}
diff --git a/stubs/ram-block.c b/stubs/ram-block.c
index 8790a59593e..f0650b19ac6 100644
--- a/stubs/ram-block.c
+++ b/stubs/ram-block.c
@@ -35,3 +35,14 @@ int ram_block_discard_disable(bool state)
 {
     return 0;
 }
+
+RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset,
+                                   ram_addr_t *offset)
+{
+    return NULL;
+}
+
+int qemu_ram_get_fd(RAMBlock *rb)
+{
+    return -1;
+}
diff --git a/stubs/meson.build b/stubs/meson.build
index 8a07059500d..0171f531523 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -20,7 +20,6 @@ if have_block
   stub_ss.add(files('get-vm-name.c'))
   stub_ss.add(files('iothread-lock-block.c'))
   stub_ss.add(files('migr-blocker.c'))
-  stub_ss.add(files('physmem.c'))
   stub_ss.add(files('ram-block.c'))
   stub_ss.add(files('runstate-check.c'))
   stub_ss.add(files('uuid.c'))
-- 
2.52.0


Re: [PATCH 1/7] stubs: Merge physmem.c within ram-block.c
Posted by BALATON Zoltan 3 days, 10 hours ago
On Thu, 26 Feb 2026, Philippe Mathieu-Daudé wrote:
> physmem.c defines 2 stubs which are related to ram-block:
> qemu_ram_block_from_host() and qemu_ram_get_fd().
> Move them with the other ram-block stubs.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> stubs/physmem.c   | 13 -------------
> stubs/ram-block.c | 11 +++++++++++

Maybe should be the other way around moving what's in subs/ram-block.c to 
stubs/physmem.c considering the the functions these stub out are in 
system/physmem.c and there's no system/ram-block.c.

Regards,
BALATON Zoltan

> stubs/meson.build |  1 -
> 3 files changed, 11 insertions(+), 14 deletions(-)
> delete mode 100644 stubs/physmem.c
>
> diff --git a/stubs/physmem.c b/stubs/physmem.c
> deleted file mode 100644
> index 14667f2bd8f..00000000000
> --- a/stubs/physmem.c
> +++ /dev/null
> @@ -1,13 +0,0 @@
> -#include "qemu/osdep.h"
> -#include "system/ramblock.h"
> -
> -RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset,
> -                                   ram_addr_t *offset)
> -{
> -    return NULL;
> -}
> -
> -int qemu_ram_get_fd(RAMBlock *rb)
> -{
> -    return -1;
> -}
> diff --git a/stubs/ram-block.c b/stubs/ram-block.c
> index 8790a59593e..f0650b19ac6 100644
> --- a/stubs/ram-block.c
> +++ b/stubs/ram-block.c
> @@ -35,3 +35,14 @@ int ram_block_discard_disable(bool state)
> {
>     return 0;
> }
> +
> +RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset,
> +                                   ram_addr_t *offset)
> +{
> +    return NULL;
> +}
> +
> +int qemu_ram_get_fd(RAMBlock *rb)
> +{
> +    return -1;
> +}
> diff --git a/stubs/meson.build b/stubs/meson.build
> index 8a07059500d..0171f531523 100644
> --- a/stubs/meson.build
> +++ b/stubs/meson.build
> @@ -20,7 +20,6 @@ if have_block
>   stub_ss.add(files('get-vm-name.c'))
>   stub_ss.add(files('iothread-lock-block.c'))
>   stub_ss.add(files('migr-blocker.c'))
> -  stub_ss.add(files('physmem.c'))
>   stub_ss.add(files('ram-block.c'))
>   stub_ss.add(files('runstate-check.c'))
>   stub_ss.add(files('uuid.c'))
>
Re: [PATCH 1/7] stubs: Merge physmem.c within ram-block.c
Posted by Akihiko Odaki 2 hours ago
On 2026/02/27 7:22, BALATON Zoltan wrote:
> On Thu, 26 Feb 2026, Philippe Mathieu-Daudé wrote:
>> physmem.c defines 2 stubs which are related to ram-block:
>> qemu_ram_block_from_host() and qemu_ram_get_fd().
>> Move them with the other ram-block stubs.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> stubs/physmem.c   | 13 -------------
>> stubs/ram-block.c | 11 +++++++++++
> 
> Maybe should be the other way around moving what's in subs/ram-block.c 
> to stubs/physmem.c considering the the functions these stub out are in 
> system/physmem.c and there's no system/ram-block.c.

But this stubs out functions in "ramblock.h" (though it's not
"ram-block.h")

Regards,
Akihiko Odaki

> 
> Regards,
> BALATON Zoltan
> 
>> stubs/meson.build |  1 -
>> 3 files changed, 11 insertions(+), 14 deletions(-)
>> delete mode 100644 stubs/physmem.c
>>
>> diff --git a/stubs/physmem.c b/stubs/physmem.c
>> deleted file mode 100644
>> index 14667f2bd8f..00000000000
>> --- a/stubs/physmem.c
>> +++ /dev/null
>> @@ -1,13 +0,0 @@
>> -#include "qemu/osdep.h"
>> -#include "system/ramblock.h"
>> -
>> -RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset,
>> -                                   ram_addr_t *offset)
>> -{
>> -    return NULL;
>> -}
>> -
>> -int qemu_ram_get_fd(RAMBlock *rb)
>> -{
>> -    return -1;
>> -}
>> diff --git a/stubs/ram-block.c b/stubs/ram-block.c
>> index 8790a59593e..f0650b19ac6 100644
>> --- a/stubs/ram-block.c
>> +++ b/stubs/ram-block.c
>> @@ -35,3 +35,14 @@ int ram_block_discard_disable(bool state)
>> {
>>     return 0;
>> }
>> +
>> +RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset,
>> +                                   ram_addr_t *offset)
>> +{
>> +    return NULL;
>> +}
>> +
>> +int qemu_ram_get_fd(RAMBlock *rb)
>> +{
>> +    return -1;
>> +}
>> diff --git a/stubs/meson.build b/stubs/meson.build
>> index 8a07059500d..0171f531523 100644
>> --- a/stubs/meson.build
>> +++ b/stubs/meson.build
>> @@ -20,7 +20,6 @@ if have_block
>>   stub_ss.add(files('get-vm-name.c'))
>>   stub_ss.add(files('iothread-lock-block.c'))
>>   stub_ss.add(files('migr-blocker.c'))
>> -  stub_ss.add(files('physmem.c'))
>>   stub_ss.add(files('ram-block.c'))
>>   stub_ss.add(files('runstate-check.c'))
>>   stub_ss.add(files('uuid.c'))
>>


Re: [PATCH 1/7] stubs: Merge physmem.c within ram-block.c
Posted by Pierrick Bouvier 3 days, 10 hours ago
On 2/26/26 2:02 PM, Philippe Mathieu-Daudé wrote:
> physmem.c defines 2 stubs which are related to ram-block:
> qemu_ram_block_from_host() and qemu_ram_get_fd().
> Move them with the other ram-block stubs.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   stubs/physmem.c   | 13 -------------
>   stubs/ram-block.c | 11 +++++++++++
>   stubs/meson.build |  1 -
>   3 files changed, 11 insertions(+), 14 deletions(-)
>   delete mode 100644 stubs/physmem.c
> 

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>