mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 17:23:56 -06:00
vfio: Introduce a new header file for VFIOcontainer declarations
Gather all VFIOcontainer related declarations into
"hw/vfio/vfio-container.h" to reduce exposure of VFIO internals in
"hw/vfio/vfio-common.h". These declarations were initially introduced
in commit 65501a745d
("vfio: vfio-pci device assignment driver").
They are made available externally for PPC and s390x.
Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: John Levon <john.levon@nutanix.com>
Link: https://lore.kernel.org/qemu-devel/20250318095415.670319-12-clg@redhat.com
Link: https://lore.kernel.org/qemu-devel/20250326075122.1299361-13-clg@redhat.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
parent
499e53cce9
commit
aa90d775f0
6 changed files with 40 additions and 20 deletions
|
@ -25,6 +25,7 @@
|
||||||
#include "hw/pci/msix.h"
|
#include "hw/pci/msix.h"
|
||||||
#include "hw/pci/pci_device.h"
|
#include "hw/pci/pci_device.h"
|
||||||
#include "hw/vfio/vfio-common.h"
|
#include "hw/vfio/vfio-common.h"
|
||||||
|
#include "hw/vfio/vfio-container.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include CONFIG_DEVICES /* CONFIG_VFIO_PCI */
|
#include CONFIG_DEVICES /* CONFIG_VFIO_PCI */
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "hw/s390x/s390-pci-clp.h"
|
#include "hw/s390x/s390-pci-clp.h"
|
||||||
#include "hw/s390x/s390-pci-vfio.h"
|
#include "hw/s390x/s390-pci-vfio.h"
|
||||||
#include "hw/vfio/pci.h"
|
#include "hw/vfio/pci.h"
|
||||||
#include "hw/vfio/vfio-common.h"
|
#include "hw/vfio/vfio-container.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the current DMA available count from vfio. Returns true if vfio is
|
* Get the current DMA available count from vfio. Returns true if vfio is
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "pci.h"
|
#include "pci.h"
|
||||||
|
#include "hw/vfio/vfio-container.h"
|
||||||
|
|
||||||
VFIOGroupList vfio_group_list =
|
VFIOGroupList vfio_group_list =
|
||||||
QLIST_HEAD_INITIALIZER(vfio_group_list);
|
QLIST_HEAD_INITIALIZER(vfio_group_list);
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "system/address-spaces.h"
|
#include "system/address-spaces.h"
|
||||||
|
|
||||||
#include "hw/vfio/vfio-common.h"
|
#include "hw/vfio/vfio-common.h"
|
||||||
|
#include "hw/vfio/vfio-container.h"
|
||||||
#include "hw/hw.h"
|
#include "hw/hw.h"
|
||||||
#include "system/ram_addr.h"
|
#include "system/ram_addr.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
|
|
|
@ -39,16 +39,6 @@ enum {
|
||||||
VFIO_DEVICE_TYPE_CCW = 2,
|
VFIO_DEVICE_TYPE_CCW = 2,
|
||||||
VFIO_DEVICE_TYPE_AP = 3,
|
VFIO_DEVICE_TYPE_AP = 3,
|
||||||
};
|
};
|
||||||
struct VFIOGroup;
|
|
||||||
|
|
||||||
typedef struct VFIOContainer {
|
|
||||||
VFIOContainerBase bcontainer;
|
|
||||||
int fd; /* /dev/vfio/vfio, empowered by the attached groups */
|
|
||||||
unsigned iommu_type;
|
|
||||||
QLIST_HEAD(, VFIOGroup) group_list;
|
|
||||||
} VFIOContainer;
|
|
||||||
|
|
||||||
OBJECT_DECLARE_SIMPLE_TYPE(VFIOContainer, VFIO_IOMMU_LEGACY);
|
|
||||||
|
|
||||||
typedef struct VFIODeviceOps VFIODeviceOps;
|
typedef struct VFIODeviceOps VFIODeviceOps;
|
||||||
typedef struct VFIOMigration VFIOMigration;
|
typedef struct VFIOMigration VFIOMigration;
|
||||||
|
@ -125,15 +115,6 @@ struct VFIODeviceOps {
|
||||||
int (*vfio_load_config)(VFIODevice *vdev, QEMUFile *f);
|
int (*vfio_load_config)(VFIODevice *vdev, QEMUFile *f);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct VFIOGroup {
|
|
||||||
int fd;
|
|
||||||
int groupid;
|
|
||||||
VFIOContainer *container;
|
|
||||||
QLIST_HEAD(, VFIODevice) device_list;
|
|
||||||
QLIST_ENTRY(VFIOGroup) next;
|
|
||||||
QLIST_ENTRY(VFIOGroup) container_next;
|
|
||||||
bool ram_block_discard_allowed;
|
|
||||||
} VFIOGroup;
|
|
||||||
|
|
||||||
#define TYPE_HOST_IOMMU_DEVICE_LEGACY_VFIO TYPE_HOST_IOMMU_DEVICE "-legacy-vfio"
|
#define TYPE_HOST_IOMMU_DEVICE_LEGACY_VFIO TYPE_HOST_IOMMU_DEVICE "-legacy-vfio"
|
||||||
#define TYPE_HOST_IOMMU_DEVICE_IOMMUFD_VFIO \
|
#define TYPE_HOST_IOMMU_DEVICE_IOMMUFD_VFIO \
|
||||||
|
|
36
include/hw/vfio/vfio-container.h
Normal file
36
include/hw/vfio/vfio-container.h
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
* VFIO container
|
||||||
|
*
|
||||||
|
* Copyright Red Hat, Inc. 2025
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HW_VFIO_CONTAINER_H
|
||||||
|
#define HW_VFIO_CONTAINER_H
|
||||||
|
|
||||||
|
#include "hw/vfio/vfio-container-base.h"
|
||||||
|
|
||||||
|
typedef struct VFIOContainer VFIOContainer;
|
||||||
|
typedef struct VFIODevice VFIODevice;
|
||||||
|
|
||||||
|
typedef struct VFIOGroup {
|
||||||
|
int fd;
|
||||||
|
int groupid;
|
||||||
|
VFIOContainer *container;
|
||||||
|
QLIST_HEAD(, VFIODevice) device_list;
|
||||||
|
QLIST_ENTRY(VFIOGroup) next;
|
||||||
|
QLIST_ENTRY(VFIOGroup) container_next;
|
||||||
|
bool ram_block_discard_allowed;
|
||||||
|
} VFIOGroup;
|
||||||
|
|
||||||
|
typedef struct VFIOContainer {
|
||||||
|
VFIOContainerBase bcontainer;
|
||||||
|
int fd; /* /dev/vfio/vfio, empowered by the attached groups */
|
||||||
|
unsigned iommu_type;
|
||||||
|
QLIST_HEAD(, VFIOGroup) group_list;
|
||||||
|
} VFIOContainer;
|
||||||
|
|
||||||
|
OBJECT_DECLARE_SIMPLE_TYPE(VFIOContainer, VFIO_IOMMU_LEGACY);
|
||||||
|
|
||||||
|
#endif /* HW_VFIO_CONTAINER_H */
|
Loading…
Add table
Add a link
Reference in a new issue