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
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!
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
© 2016 - 2026 Red Hat, Inc.