From: Peter Maydell <[email protected]> Update the documentation for the get_phys_addr_{attrs_,}debug methods and wrapper functions to state that they can handle non-page aligned addresses and will return the corresponding exact physaddr for them.
Signed-off-by: Peter Maydell <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Message-id: [email protected] Message-ID: <[email protected]> Signed-off-by: Philippe Mathieu-Daudé <[email protected]> --- include/hw/core/cpu.h | 16 +++++++++++----- include/hw/core/sysemu-cpu-ops.h | 4 ++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 75e47768d43..e3436a1766f 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -740,15 +740,18 @@ void cpu_dump_state(CPUState *cpu, FILE *f, int flags); /** * cpu_get_phys_addr_attrs_debug: - * @cpu: The CPU to obtain the physical page address for. + * @cpu: The CPU to use for the virtual-to-physical translation * @addr: The virtual address. * @attrs: Updated on return with the memory transaction attributes to use * for this access. * - * Obtains the physical page corresponding to a virtual one, together + * Obtains the physical address corresponding to a virtual one, together * with the corresponding memory transaction attributes to use for the access. * Use it only for debugging because no protection checks are done. * + * The address need not be page-aligned; the returned address will + * be the physical address corresponding to that virtual address. + * * Returns: Corresponding physical page address or -1 if no page found. */ hwaddr cpu_get_phys_addr_attrs_debug(CPUState *cpu, vaddr addr, @@ -756,13 +759,16 @@ hwaddr cpu_get_phys_addr_attrs_debug(CPUState *cpu, vaddr addr, /** * cpu_get_phys_addr_debug: - * @cpu: The CPU to obtain the physical page address for. + * @cpu: The CPU to use for the virtual-to-physical translation * @addr: The virtual address. * - * Obtains the physical page corresponding to a virtual one. + * Obtains the physical address corresponding to a virtual one. * Use it only for debugging because no protection checks are done. * - * Returns: Corresponding physical page address or -1 if no page found. + * The address need not be page-aligned; the returned address will + * be the physical address corresponding to that virtual address. + * + * Returns: Corresponding physical address, or -1 if no page found. */ hwaddr cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr); diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-ops.h index 1524d6f25bb..c0e9e726708 100644 --- a/include/hw/core/sysemu-cpu-ops.h +++ b/include/hw/core/sysemu-cpu-ops.h @@ -31,6 +31,8 @@ typedef struct SysemuCPUOps { bool (*get_paging_enabled)(const CPUState *cpu); /** * @get_phys_addr_debug: Callback for obtaining a physical address. + * This must be able to handle a non-page-aligned address, and will + * return the physical address corresponding to that address. */ hwaddr (*get_phys_addr_debug)(CPUState *cpu, vaddr addr); /** @@ -39,6 +41,8 @@ typedef struct SysemuCPUOps { * access. * CPUs which use memory transaction attributes should implement this * instead of get_phys_addr_debug. + * This must be able to handle a non-page-aligned address, and will + * return the physical address corresponding to that address. */ hwaddr (*get_phys_addr_attrs_debug)(CPUState *cpu, vaddr addr, MemTxAttrs *attrs); -- 2.53.0
