mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 01:33:56 -06:00
vfio: Introduce new files for VFIORegion definitions and declarations
Gather all VFIORegion related declarations and definitions into their own files to reduce exposure of VFIO internals in "hw/vfio/vfio-common.h". They were introduced for 'vfio-platform' support in commitsdb0da029a1
("vfio: Generalize region support") anda664477db8
("hw/vfio/pci: Introduce VFIORegion"). To be noted that the 'vfio-platform' devices have been deprecated and will be removed in QEMU 10.2. Until then, make the declarations available externally for 'sysbus-fdt.c'. Cc: Eric Auger <eric.auger@redhat.com> Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Link: https://lore.kernel.org/qemu-devel/20250326075122.1299361-12-clg@redhat.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
parent
d4a8f286e9
commit
499e53cce9
11 changed files with 458 additions and 401 deletions
|
@ -39,25 +39,6 @@ enum {
|
|||
VFIO_DEVICE_TYPE_CCW = 2,
|
||||
VFIO_DEVICE_TYPE_AP = 3,
|
||||
};
|
||||
|
||||
typedef struct VFIOMmap {
|
||||
MemoryRegion mem;
|
||||
void *mmap;
|
||||
off_t offset;
|
||||
size_t size;
|
||||
} VFIOMmap;
|
||||
|
||||
typedef struct VFIORegion {
|
||||
struct VFIODevice *vbasedev;
|
||||
off_t fd_offset; /* offset of region within device fd */
|
||||
MemoryRegion *mem; /* slow, read/write access */
|
||||
size_t size;
|
||||
uint32_t flags; /* VFIO region flags (rd/wr/mmap) */
|
||||
uint32_t nr_mmaps;
|
||||
VFIOMmap *mmaps;
|
||||
uint8_t nr; /* cache the region number for debug */
|
||||
} VFIORegion;
|
||||
|
||||
struct VFIOGroup;
|
||||
|
||||
typedef struct VFIOContainer {
|
||||
|
@ -168,17 +149,7 @@ void vfio_unmask_single_irqindex(VFIODevice *vbasedev, int index);
|
|||
void vfio_mask_single_irqindex(VFIODevice *vbasedev, int index);
|
||||
bool vfio_set_irq_signaling(VFIODevice *vbasedev, int index, int subindex,
|
||||
int action, int fd, Error **errp);
|
||||
void vfio_region_write(void *opaque, hwaddr addr,
|
||||
uint64_t data, unsigned size);
|
||||
uint64_t vfio_region_read(void *opaque,
|
||||
hwaddr addr, unsigned size);
|
||||
int vfio_region_setup(Object *obj, VFIODevice *vbasedev, VFIORegion *region,
|
||||
int index, const char *name);
|
||||
int vfio_region_mmap(VFIORegion *region);
|
||||
void vfio_region_mmaps_set_enabled(VFIORegion *region, bool enabled);
|
||||
void vfio_region_unmap(VFIORegion *region);
|
||||
void vfio_region_exit(VFIORegion *region);
|
||||
void vfio_region_finalize(VFIORegion *region);
|
||||
|
||||
void vfio_reset_handler(void *opaque);
|
||||
struct vfio_device_info *vfio_get_device_info(int fd);
|
||||
bool vfio_device_is_mdev(VFIODevice *vbasedev);
|
||||
|
@ -194,7 +165,6 @@ int vfio_kvm_device_del_fd(int fd, Error **errp);
|
|||
bool vfio_cpr_register_container(VFIOContainerBase *bcontainer, Error **errp);
|
||||
void vfio_cpr_unregister_container(VFIOContainerBase *bcontainer);
|
||||
|
||||
extern const MemoryRegionOps vfio_region_ops;
|
||||
typedef QLIST_HEAD(VFIOGroupList, VFIOGroup) VFIOGroupList;
|
||||
typedef QLIST_HEAD(VFIODeviceList, VFIODevice) VFIODeviceList;
|
||||
extern VFIOGroupList vfio_group_list;
|
||||
|
|
|
@ -47,6 +47,8 @@ typedef struct VFIOINTp {
|
|||
/* function type for user side eventfd handler */
|
||||
typedef void (*eventfd_user_side_handler_t)(VFIOINTp *intp);
|
||||
|
||||
typedef struct VFIORegion VFIORegion;
|
||||
|
||||
struct VFIOPlatformDevice {
|
||||
SysBusDevice sbdev;
|
||||
VFIODevice vbasedev; /* not a QOM object */
|
||||
|
|
47
include/hw/vfio/vfio-region.h
Normal file
47
include/hw/vfio/vfio-region.h
Normal file
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* VFIO region
|
||||
*
|
||||
* Copyright Red Hat, Inc. 2025
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef HW_VFIO_REGION_H
|
||||
#define HW_VFIO_REGION_H
|
||||
|
||||
#include "system/memory.h"
|
||||
|
||||
typedef struct VFIOMmap {
|
||||
MemoryRegion mem;
|
||||
void *mmap;
|
||||
off_t offset;
|
||||
size_t size;
|
||||
} VFIOMmap;
|
||||
|
||||
typedef struct VFIODevice VFIODevice;
|
||||
|
||||
typedef struct VFIORegion {
|
||||
struct VFIODevice *vbasedev;
|
||||
off_t fd_offset; /* offset of region within device fd */
|
||||
MemoryRegion *mem; /* slow, read/write access */
|
||||
size_t size;
|
||||
uint32_t flags; /* VFIO region flags (rd/wr/mmap) */
|
||||
uint32_t nr_mmaps;
|
||||
VFIOMmap *mmaps;
|
||||
uint8_t nr; /* cache the region number for debug */
|
||||
} VFIORegion;
|
||||
|
||||
|
||||
void vfio_region_write(void *opaque, hwaddr addr,
|
||||
uint64_t data, unsigned size);
|
||||
uint64_t vfio_region_read(void *opaque,
|
||||
hwaddr addr, unsigned size);
|
||||
int vfio_region_setup(Object *obj, VFIODevice *vbasedev, VFIORegion *region,
|
||||
int index, const char *name);
|
||||
int vfio_region_mmap(VFIORegion *region);
|
||||
void vfio_region_mmaps_set_enabled(VFIORegion *region, bool enabled);
|
||||
void vfio_region_unmap(VFIORegion *region);
|
||||
void vfio_region_exit(VFIORegion *region);
|
||||
void vfio_region_finalize(VFIORegion *region);
|
||||
|
||||
#endif /* HW_VFIO_REGION_H */
|
Loading…
Add table
Add a link
Reference in a new issue