mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 14:53:54 -06:00

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>
47 lines
1.3 KiB
C
47 lines
1.3 KiB
C
/*
|
|
* 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 */
|