1 Star 0 Fork 109

panchenbo / qemu

forked from src-openEuler / qemu 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Revert-vfio-pci-Implement-the-DMA-fault-handler.patch 3.21 KB
一键复制 编辑 原始数据 按行查看 历史
yezengruan 提交于 2022-11-22 17:45 . Qemu update to version 6.2.0-59
From 013220b686022a2e4ddb6a3d50af467275d25070 Mon Sep 17 00:00:00 2001
From: Kunkun Jiang <jiangkunkun@huawei.com>
Date: Fri, 18 Nov 2022 15:22:37 +0800
Subject: [PATCH 18/36] Revert "vfio/pci: Implement the DMA fault handler"
This reverts commit d33cc7eccb68c6a1488804c94ff5c1197ee0fc6e.
Signed-off-by: Kunkun Jiang <jiangkunkun@huawei.com>
---
hw/vfio/pci.c | 50 --------------------------------------------------
hw/vfio/pci.h | 1 -
2 files changed, 51 deletions(-)
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index c54e62fe8f..76bc9d3506 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -2953,60 +2953,10 @@ static PCIPASIDOps vfio_pci_pasid_ops = {
static void vfio_dma_fault_notifier_handler(void *opaque)
{
VFIOPCIExtIRQ *ext_irq = opaque;
- VFIOPCIDevice *vdev = ext_irq->vdev;
- PCIDevice *pdev = &vdev->pdev;
- AddressSpace *as = pci_device_iommu_address_space(pdev);
- IOMMUMemoryRegion *iommu_mr = IOMMU_MEMORY_REGION(as->root);
- struct vfio_region_dma_fault header;
- struct iommu_fault *queue;
- char *queue_buffer = NULL;
- ssize_t bytes;
if (!event_notifier_test_and_clear(&ext_irq->notifier)) {
return;
}
-
- bytes = pread(vdev->vbasedev.fd, &header, sizeof(header),
- vdev->dma_fault_region.fd_offset);
- if (bytes != sizeof(header)) {
- error_report("%s unable to read the fault region header (0x%lx)",
- __func__, bytes);
- return;
- }
-
- /* Normally the fault queue is mmapped */
- queue = (struct iommu_fault *)vdev->dma_fault_region.mmaps[0].mmap;
- if (!queue) {
- size_t queue_size = header.nb_entries * header.entry_size;
-
- error_report("%s: fault queue not mmapped: slower fault handling",
- vdev->vbasedev.name);
-
- queue_buffer = g_malloc(queue_size);
- bytes = pread(vdev->vbasedev.fd, queue_buffer, queue_size,
- vdev->dma_fault_region.fd_offset + header.offset);
- if (bytes != queue_size) {
- error_report("%s unable to read the fault queue (0x%lx)",
- __func__, bytes);
- return;
- }
-
- queue = (struct iommu_fault *)queue_buffer;
- }
-
- while (vdev->fault_tail_index != header.head) {
- memory_region_inject_faults(iommu_mr, 1,
- &queue[vdev->fault_tail_index]);
- vdev->fault_tail_index =
- (vdev->fault_tail_index + 1) % header.nb_entries;
- }
- bytes = pwrite(vdev->vbasedev.fd, &vdev->fault_tail_index, 4,
- vdev->dma_fault_region.fd_offset);
- if (bytes != 4) {
- error_report("%s unable to write the fault region tail index (0x%lx)",
- __func__, bytes);
- }
- g_free(queue_buffer);
}
static int vfio_register_ext_irq_handler(VFIOPCIDevice *vdev,
diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h
index 03ac8919ef..eef91065f1 100644
--- a/hw/vfio/pci.h
+++ b/hw/vfio/pci.h
@@ -146,7 +146,6 @@ struct VFIOPCIDevice {
EventNotifier req_notifier;
VFIOPCIExtIRQ *ext_irqs;
VFIORegion dma_fault_region;
- uint32_t fault_tail_index;
int (*resetfn)(struct VFIOPCIDevice *);
uint32_t vendor_id;
uint32_t device_id;
--
2.27.0
1
https://gitee.com/panchenbo/qemu.git
git@gitee.com:panchenbo/qemu.git
panchenbo
qemu
qemu
master

搜索帮助