mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
vfio: return mr from vfio_get_xlat_addr
Modify memory_get_xlat_addr and vfio_get_xlat_addr to return the memory region that the translated address is found in. This will be needed by CPR in a subsequent patch to map blocks using IOMMU_IOAS_MAP_FILE. Also return the xlat offset, so we can simplify the interface by removing the out parameters that can be trivially derived from mr and xlat. Lastly, rename the functions to to memory_translate_iotlb() and vfio_translate_iotlb(). Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Acked-by: David Hildenbrand <david@redhat.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Reviewed-by: John Levon <john.levon@nutanix.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Link: https://lore.kernel.org/qemu-devel/1747661203-136490-1-git-send-email-steven.sistare@oracle.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
parent
0992ea07db
commit
e3353d63e1
4 changed files with 45 additions and 48 deletions
|
@ -739,21 +739,20 @@ void ram_discard_manager_unregister_listener(RamDiscardManager *rdm,
|
|||
RamDiscardListener *rdl);
|
||||
|
||||
/**
|
||||
* memory_get_xlat_addr: Extract addresses from a TLB entry
|
||||
* memory_translate_iotlb: Extract addresses from a TLB entry.
|
||||
* Called with rcu_read_lock held.
|
||||
*
|
||||
* @iotlb: pointer to an #IOMMUTLBEntry
|
||||
* @vaddr: virtual address
|
||||
* @ram_addr: RAM address
|
||||
* @read_only: indicates if writes are allowed
|
||||
* @mr_has_discard_manager: indicates memory is controlled by a
|
||||
* RamDiscardManager
|
||||
* @xlat_p: return the offset of the entry from the start of the returned
|
||||
* MemoryRegion.
|
||||
* @errp: pointer to Error*, to store an error if it happens.
|
||||
*
|
||||
* Return: true on success, else false setting @errp with error.
|
||||
* Return: On success, return the MemoryRegion containing the @iotlb translated
|
||||
* addr. The MemoryRegion must not be accessed after rcu_read_unlock.
|
||||
* On failure, return NULL, setting @errp with error.
|
||||
*/
|
||||
bool memory_get_xlat_addr(IOMMUTLBEntry *iotlb, void **vaddr,
|
||||
ram_addr_t *ram_addr, bool *read_only,
|
||||
bool *mr_has_discard_manager, Error **errp);
|
||||
MemoryRegion *memory_translate_iotlb(IOMMUTLBEntry *iotlb, hwaddr *xlat_p,
|
||||
Error **errp);
|
||||
|
||||
typedef struct CoalescedMemoryRange CoalescedMemoryRange;
|
||||
typedef struct MemoryRegionIoeventfd MemoryRegionIoeventfd;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue