hw/core: Update docs for get_phys_addr_{attrs_, }debug
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 <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-id: 20260417173105.1648172-11-peter.maydell@linaro.org Message-ID: <20260430093810.2762539-12-peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Peter Maydell committed
Apr 30, 2026 at 10:37 UTC
d4cbf7dabc89194f535e4ca04a437b0088a724e8
2 files changed
+15
-5
include/hw/core/cpu.h
+11
-5
@@ -740,15 +740,18 @@ void cpu_dump_state(CPUState *cpu, FILE *f, int flags);
740
741
/**
742
* cpu_get_phys_addr_attrs_debug:
743
- * @cpu: The CPU to obtain the physical page address for.
743
+ * @cpu: The CPU to use for the virtual-to-physical translation
744
* @addr: The virtual address.
745
* @attrs: Updated on return with the memory transaction attributes to use
746
* for this access.
747
*
748
- * Obtains the physical page corresponding to a virtual one, together
748
+ * Obtains the physical address corresponding to a virtual one, together
749
* with the corresponding memory transaction attributes to use for the access.
750
* Use it only for debugging because no protection checks are done.
751
*
752
+ * The address need not be page-aligned; the returned address will
753
+ * be the physical address corresponding to that virtual address.
754
+ *
755
* Returns: Corresponding physical page address or -1 if no page found.
756
*/
757
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,
759
760
/**
761
* cpu_get_phys_addr_debug:
759
- * @cpu: The CPU to obtain the physical page address for.
762
+ * @cpu: The CPU to use for the virtual-to-physical translation
763
* @addr: The virtual address.
764
*
762
- * Obtains the physical page corresponding to a virtual one.
765
+ * Obtains the physical address corresponding to a virtual one.
766
* Use it only for debugging because no protection checks are done.
767
*
765
- * Returns: Corresponding physical page address or -1 if no page found.
768
+ * The address need not be page-aligned; the returned address will
769
+ * be the physical address corresponding to that virtual address.
770
+ *
771
+ * Returns: Corresponding physical address, or -1 if no page found.
772
*/
773
hwaddr cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr);
774
include/hw/core/sysemu-cpu-ops.h
+4
@@ -31,6 +31,8 @@ typedef struct SysemuCPUOps {
31
bool (*get_paging_enabled)(const CPUState *cpu);
32
/**
33
* @get_phys_addr_debug: Callback for obtaining a physical address.
34
+ * This must be able to handle a non-page-aligned address, and will
35
+ * return the physical address corresponding to that address.
36
*/
37
hwaddr (*get_phys_addr_debug)(CPUState *cpu, vaddr addr);
38
/**
@@ -39,6 +41,8 @@ typedef struct SysemuCPUOps {
41
* access.
42
* CPUs which use memory transaction attributes should implement this
43
* instead of get_phys_addr_debug.
44
+ * This must be able to handle a non-page-aligned address, and will
45
+ * return the physical address corresponding to that address.
46
*/
47
hwaddr (*get_phys_addr_attrs_debug)(CPUState *cpu, vaddr addr,
48
MemTxAttrs *attrs);