@samitouri / QOSamiQemu / commits / ed713ddec5

hw/ppc/spapr: Un-inline rtas_load/store() helpers

The 32-bit binary doesn't use these helpers, so don't need to compile them. Rather than using 64-bit target #ifdef'ry in a global header, un-inline the calls since the helpers are called from I/O (cold) path. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com> Reviewed-by: Chinmay Rath <rathc@linux.ibm.com> Acked-by: Glenn Miles <milesg@linux.ibm.com> Message-Id: <20260319111936.68041-2-philmd@linaro.org>

Philippe Mathieu-Daudé committed Mar 18, 2026 at 17:37 UTC ed713ddec5972c2795b06da767facfdc94f7e997
2 files changed +18 -15
hw/ppc/spapr_rtas.c
+15
@@ -52,6 +52,21 @@
52 #include "migration/blocker.h"
53 #include "helper_regs.h"
54
55 +uint32_t rtas_ld(target_ulong phys, int n)
56 +{
57 + return ldl_be_phys(&address_space_memory, ppc64_phys_to_real(phys + 4 * n));
58 +}
59 +
60 +uint64_t rtas_ldq(target_ulong phys, int n)
61 +{
62 + return (uint64_t)rtas_ld(phys, n) << 32 | rtas_ld(phys, n + 1);
63 +}
64 +
65 +void rtas_st(target_ulong phys, int n, uint32_t val)
66 +{
67 + stl_be_phys(&address_space_memory, ppc64_phys_to_real(phys + 4 * n), val);
68 +}
69 +
70 static void rtas_display_character(PowerPCCPU *cpu, SpaprMachineState *spapr,
71 uint32_t token, uint32_t nargs,
72 target_ulong args,
include/hw/ppc/spapr.h
+3 -15
@@ -796,21 +796,9 @@ static inline uint64_t ppc64_phys_to_real(uint64_t addr)
796 return addr & ~0xF000000000000000ULL;
797 }
798
799 -static inline uint32_t rtas_ld(target_ulong phys, int n)
800 -{
801 - return ldl_be_phys(&address_space_memory,
802 - ppc64_phys_to_real(phys + 4 * n));
803 -}
804 -
805 -static inline uint64_t rtas_ldq(target_ulong phys, int n)
806 -{
807 - return (uint64_t)rtas_ld(phys, n) << 32 | rtas_ld(phys, n + 1);
808 -}
809 -
810 -static inline void rtas_st(target_ulong phys, int n, uint32_t val)
811 -{
812 - stl_be_phys(&address_space_memory, ppc64_phys_to_real(phys + 4 * n), val);
813 -}
799 +uint32_t rtas_ld(target_ulong phys, int n);
800 +uint64_t rtas_ldq(target_ulong phys, int n);
801 +void rtas_st(target_ulong phys, int n, uint32_t val);
802
803 typedef void (*spapr_rtas_fn)(PowerPCCPU *cpu, SpaprMachineState *sm,
804 uint32_t token,