[PATCH] hw/hyperv: Replace legacy ld_phys() -> address_space_ld()

Philippe Mathieu-Daudé posted 1 patch 2 weeks, 4 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260319082954.65069-1-philmd@linaro.org
hw/hyperv/hyperv.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
[PATCH] hw/hyperv: Replace legacy ld_phys() -> address_space_ld()
Posted by Philippe Mathieu-Daudé 2 weeks, 4 days ago
Prefer the address_space_ld/st API over the legacy ld/st_phys()
because it allow checking for bus access fault, which shouldn't
happen here.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/hyperv/hyperv.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/hyperv/hyperv.c b/hw/hyperv/hyperv.c
index 27e323a8196..5a0e00892d8 100644
--- a/hw/hyperv/hyperv.c
+++ b/hw/hyperv/hyperv.c
@@ -704,13 +704,16 @@ uint16_t hyperv_hcall_signal_event(uint64_t param, bool fast)
     EventFlagHandler *handler;
 
     if (unlikely(!fast)) {
+        MemTxResult result;
         hwaddr addr = param;
 
         if (addr & (__alignof__(addr) - 1)) {
             return HV_STATUS_INVALID_ALIGNMENT;
         }
 
-        param = ldq_phys(&address_space_memory, addr);
+        param = address_space_ldq_le(&address_space_memory, addr,
+                                     MEMTXATTRS_UNSPECIFIED, &result);
+        assert(result == MEMTX_OK);
     }
 
     /*
-- 
2.53.0


Re: [PATCH] hw/hyperv: Replace legacy ld_phys() -> address_space_ld()
Posted by Philippe Mathieu-Daudé 5 days ago
On 19/3/26 09:29, Philippe Mathieu-Daudé wrote:
> Prefer the address_space_ld/st API over the legacy ld/st_phys()
> because it allow checking for bus access fault, which shouldn't
> happen here.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/hyperv/hyperv.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)

Patch queued via hw-misc, thanks!

Re: [PATCH] hw/hyperv: Replace legacy ld_phys() -> address_space_ld()
Posted by Maciej S. Szmigiero 5 days ago
On 19.03.2026 09:29, Philippe Mathieu-Daudé wrote:
> Prefer the address_space_ld/st API over the legacy ld/st_phys()
> because it allow checking for bus access fault, which shouldn't
> happen here.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/hyperv/hyperv.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/hyperv/hyperv.c b/hw/hyperv/hyperv.c
> index 27e323a8196..5a0e00892d8 100644
> --- a/hw/hyperv/hyperv.c
> +++ b/hw/hyperv/hyperv.c
> @@ -704,13 +704,16 @@ uint16_t hyperv_hcall_signal_event(uint64_t param, bool fast)
>       EventFlagHandler *handler;
>   
>       if (unlikely(!fast)) {
> +        MemTxResult result;
>           hwaddr addr = param;
>   
>           if (addr & (__alignof__(addr) - 1)) {
>               return HV_STATUS_INVALID_ALIGNMENT;
>           }
>   
> -        param = ldq_phys(&address_space_memory, addr);
> +        param = address_space_ldq_le(&address_space_memory, addr,
> +                                     MEMTXATTRS_UNSPECIFIED, &result);
> +        assert(result == MEMTX_OK);
>       }
>   
>       /*

Acked-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>

Thanks,
Maciej