[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH V1 17/26] vfio: pass ramblock to vfio_container_dma_map
From: |
Steve Sistare |
Subject: |
[PATCH V1 17/26] vfio: pass ramblock to vfio_container_dma_map |
Date: |
Wed, 29 Jan 2025 06:43:13 -0800 |
Pass ramblock to vfio_container_dma_map for use in a subsequent patch.
No functional change.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
---
hw/vfio/common.c | 11 +++++++----
hw/vfio/container-base.c | 3 ++-
include/hw/vfio/vfio-container-base.h | 3 ++-
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index 4bbc29f..aceb0cf 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -282,6 +282,7 @@ static void vfio_iommu_map_notify(IOMMUNotifier *n,
IOMMUTLBEntry *iotlb)
VFIOGuestIOMMU *giommu = container_of(n, VFIOGuestIOMMU, n);
VFIOContainerBase *bcontainer = giommu->bcontainer;
hwaddr iova = iotlb->iova + giommu->iommu_offset;
+ MemoryRegion *mr;
void *vaddr;
int ret;
Error *local_err = NULL;
@@ -301,7 +302,7 @@ static void vfio_iommu_map_notify(IOMMUNotifier *n,
IOMMUTLBEntry *iotlb)
if ((iotlb->perm & IOMMU_RW) != IOMMU_NONE) {
bool read_only;
- if (!vfio_get_xlat_addr(iotlb, &vaddr, NULL, &read_only, NULL,
+ if (!vfio_get_xlat_addr(iotlb, &vaddr, NULL, &read_only, &mr,
&local_err)) {
error_report_err(local_err);
goto out;
@@ -315,7 +316,7 @@ static void vfio_iommu_map_notify(IOMMUNotifier *n,
IOMMUTLBEntry *iotlb)
*/
ret = vfio_container_dma_map(bcontainer, iova,
iotlb->addr_mask + 1, vaddr,
- read_only);
+ read_only, mr->ram_block);
if (ret) {
error_report("vfio_container_dma_map(%p, 0x%"HWADDR_PRIx", "
"0x%"HWADDR_PRIx", %p) = %d (%s)",
@@ -380,7 +381,8 @@ static int
vfio_ram_discard_notify_populate(RamDiscardListener *rdl,
vaddr = memory_region_get_ram_ptr(section->mr) + start;
ret = vfio_container_dma_map(bcontainer, iova, next - start,
- vaddr, section->readonly);
+ vaddr, section->readonly,
+ section->mr->ram_block);
if (ret) {
/* Rollback */
vfio_ram_discard_notify_discard(rdl, section);
@@ -729,7 +731,8 @@ void vfio_container_region_add(VFIOContainerBase
*bcontainer,
}
ret = vfio_container_dma_map(bcontainer, iova, int128_get64(llsize),
- vaddr, section->readonly);
+ vaddr, section->readonly,
+ section->mr->ram_block);
if (ret) {
error_setg(&err, "vfio_container_dma_map(%p, 0x%"HWADDR_PRIx", "
"0x%"HWADDR_PRIx", %p) = %d (%s)",
diff --git a/hw/vfio/container-base.c b/hw/vfio/container-base.c
index 749a3fd..302cd4c 100644
--- a/hw/vfio/container-base.c
+++ b/hw/vfio/container-base.c
@@ -17,7 +17,8 @@
int vfio_container_dma_map(VFIOContainerBase *bcontainer,
hwaddr iova, ram_addr_t size,
- void *vaddr, bool readonly)
+ void *vaddr, bool readonly,
+ RAMBlock *rb)
{
VFIOIOMMUClass *vioc = VFIO_IOMMU_GET_CLASS(bcontainer);
diff --git a/include/hw/vfio/vfio-container-base.h
b/include/hw/vfio/vfio-container-base.h
index 4cff994..d82e256 100644
--- a/include/hw/vfio/vfio-container-base.h
+++ b/include/hw/vfio/vfio-container-base.h
@@ -73,7 +73,8 @@ typedef struct VFIORamDiscardListener {
int vfio_container_dma_map(VFIOContainerBase *bcontainer,
hwaddr iova, ram_addr_t size,
- void *vaddr, bool readonly);
+ void *vaddr, bool readonly,
+ RAMBlock *rb);
int vfio_container_dma_unmap(VFIOContainerBase *bcontainer,
hwaddr iova, ram_addr_t size,
IOMMUTLBEntry *iotlb);
--
1.8.3.1
- [PATCH V1 20/26] vfio/iommufd: export iommufd_cdev_get_info_iova_range, (continued)
- [PATCH V1 20/26] vfio/iommufd: export iommufd_cdev_get_info_iova_range, Steve Sistare, 2025/01/29
- [PATCH V1 08/26] pci: skip reset during cpr, Steve Sistare, 2025/01/29
- [PATCH V1 05/26] vfio/container: preserve descriptors, Steve Sistare, 2025/01/29
- [PATCH V1 09/26] pci: export msix_is_pending, Steve Sistare, 2025/01/29
- [PATCH V1 13/26] vfio-pci: preserve INTx, Steve Sistare, 2025/01/29
- [PATCH V1 14/26] migration: close kvm after cpr, Steve Sistare, 2025/01/29
- [PATCH V1 19/26] vfio/iommufd: use IOMMU_IOAS_MAP_FILE, Steve Sistare, 2025/01/29
- [PATCH V1 21/26] iommufd: change process ioctl, Steve Sistare, 2025/01/29
- [PATCH V1 12/26] vfio-pci: preserve MSI, Steve Sistare, 2025/01/29
- [PATCH V1 16/26] vfio: return mr from vfio_get_xlat_addr, Steve Sistare, 2025/01/29
- [PATCH V1 17/26] vfio: pass ramblock to vfio_container_dma_map,
Steve Sistare <=
- [PATCH V1 15/26] migration: cpr_get_fd_param helper, Steve Sistare, 2025/01/29
- [PATCH V1 18/26] vfio/iommufd: define iommufd_cdev_make_hwpt, Steve Sistare, 2025/01/29
- [PATCH V1 10/26] vfio-pci: refactor for cpr, Steve Sistare, 2025/01/29
- [PATCH V1 23/26] vfio/iommufd: register container for cpr, Steve Sistare, 2025/01/29
- [PATCH V1 22/26] vfio/iommufd: invariant device name, Steve Sistare, 2025/01/29
- [PATCH V1 24/26] vfio/iommufd: preserve descriptors, Steve Sistare, 2025/01/29
- [PATCH V1 25/26] vfio/iommufd: reconstruct device, Steve Sistare, 2025/01/29
- [PATCH V1 26/26] iommufd: preserve DMA mappings, Steve Sistare, 2025/01/29