mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
vfio queue:
* Support for VFIODisplay migration with ramfb * Preliminary work for IOMMUFD support -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEoPZlSPBIlev+awtgUaNDx8/77KEFAmUvlEYACgkQUaNDx8/7 7KFlaw//X2053de2eTdo38/UMSzi5ACWWn2j1iGQZf/3+J2LcdlixZarZr/2DN56 4axmwF6+GKozt5+EnvWtgodDn6U9iyMNaAB3CGBHFHsH8uqKeZd/Ii754q4Rcmy9 ZufBOPWm9Ff7s2MMFiAZvso75jP2wuwVEe1YPRjeJnsNSNIJ6WZfemh3Sl96yRBb r38uqzqetKwl7HziMMWP3yb8v+dU8A9bqI1hf1FZGttfFz3XA+pmjXKA6XxdfiZF AAotu5x9w86a08sAlr/qVsZFLR37oQykkXM0D840DafJDyr5fbJiq8cwfOjMw9+D w6+udRm5KoBWPsvb/T3dR88GRMO22PChjH9Vjl51TstMNhdTxuKJTKhhSoUFZbXV 8CMjwfALk5ggIOyCk1LRd04ed+9qkqgcbw1Guy5pYnyPnY/X6XurxxaxS6Gemgtn UvgRYhSjio+LgHLO77IVkWJMooTEPzUTty2Zxa7ldbbE+utPUtsmac9+1m2pnpqk 5VQmB074QnsJuvf+7HPU6vYCzQWoXHsH1UY/A0fF7MPedNUAbVYzKrdGPyqEMqHy xbilAIaS3oO0pMT6kUpRv5c5vjbwkx94Nf/ii8fQVjWzPfCcaF3yEfaam62jMUku stySaRpavKIx2oYLlucBqeKaBGaUofk13gGTQlsFs8pKCOAV7r4= =s0fN -----END PGP SIGNATURE----- Merge tag 'pull-vfio-20231018' of https://github.com/legoater/qemu into staging vfio queue: * Support for VFIODisplay migration with ramfb * Preliminary work for IOMMUFD support # -----BEGIN PGP SIGNATURE----- # # iQIzBAABCAAdFiEEoPZlSPBIlev+awtgUaNDx8/77KEFAmUvlEYACgkQUaNDx8/7 # 7KFlaw//X2053de2eTdo38/UMSzi5ACWWn2j1iGQZf/3+J2LcdlixZarZr/2DN56 # 4axmwF6+GKozt5+EnvWtgodDn6U9iyMNaAB3CGBHFHsH8uqKeZd/Ii754q4Rcmy9 # ZufBOPWm9Ff7s2MMFiAZvso75jP2wuwVEe1YPRjeJnsNSNIJ6WZfemh3Sl96yRBb # r38uqzqetKwl7HziMMWP3yb8v+dU8A9bqI1hf1FZGttfFz3XA+pmjXKA6XxdfiZF # AAotu5x9w86a08sAlr/qVsZFLR37oQykkXM0D840DafJDyr5fbJiq8cwfOjMw9+D # w6+udRm5KoBWPsvb/T3dR88GRMO22PChjH9Vjl51TstMNhdTxuKJTKhhSoUFZbXV # 8CMjwfALk5ggIOyCk1LRd04ed+9qkqgcbw1Guy5pYnyPnY/X6XurxxaxS6Gemgtn # UvgRYhSjio+LgHLO77IVkWJMooTEPzUTty2Zxa7ldbbE+utPUtsmac9+1m2pnpqk # 5VQmB074QnsJuvf+7HPU6vYCzQWoXHsH1UY/A0fF7MPedNUAbVYzKrdGPyqEMqHy # xbilAIaS3oO0pMT6kUpRv5c5vjbwkx94Nf/ii8fQVjWzPfCcaF3yEfaam62jMUku # stySaRpavKIx2oYLlucBqeKaBGaUofk13gGTQlsFs8pKCOAV7r4= # =s0fN # -----END PGP SIGNATURE----- # gpg: Signature made Wed 18 Oct 2023 04:16:06 EDT # gpg: using RSA key A0F66548F04895EBFE6B0B6051A343C7CFFBECA1 # gpg: Good signature from "Cédric Le Goater <clg@redhat.com>" [unknown] # gpg: aka "Cédric Le Goater <clg@kaod.org>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: A0F6 6548 F048 95EB FE6B 0B60 51A3 43C7 CFFB ECA1 * tag 'pull-vfio-20231018' of https://github.com/legoater/qemu: (22 commits) hw/vfio: add ramfb migration support ramfb-standalone: add migration support ramfb: add migration support vfio/pci: Remove vfio_detach_device from vfio_realize error path vfio/ccw: Remove redundant definition of TYPE_VFIO_CCW vfio/ap: Remove pointless apdev variable vfio/pci: Fix a potential memory leak in vfio_listener_region_add vfio/common: Move legacy VFIO backend code into separate container.c vfio/common: Introduce a global VFIODevice list vfio/common: Store the parent container in VFIODevice vfio/common: Introduce a per container device list vfio/common: Move VFIO reset handler registration to a group agnostic function vfio/ccw: Use vfio_[attach/detach]_device vfio/ap: Use vfio_[attach/detach]_device vfio/platform: Use vfio_[attach/detach]_device vfio/pci: Introduce vfio_[attach/detach]_device vfio/common: Extract out vfio_kvm_device_[add/del]_fd vfio/common: Introduce vfio_container_add|del_section_window() vfio/common: Propagate KVM_SET_DEVICE_ATTR error if any vfio/common: Move IOMMU agnostic helpers to a separate file ... Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
commit
deaca3fd30
20 changed files with 2576 additions and 1976 deletions
|
@ -1,11 +1,15 @@
|
|||
#ifndef RAMFB_H
|
||||
#define RAMFB_H
|
||||
|
||||
#include "migration/vmstate.h"
|
||||
|
||||
/* ramfb.c */
|
||||
typedef struct RAMFBState RAMFBState;
|
||||
void ramfb_display_update(QemuConsole *con, RAMFBState *s);
|
||||
RAMFBState *ramfb_setup(Error **errp);
|
||||
|
||||
extern const VMStateDescription ramfb_vmstate;
|
||||
|
||||
/* ramfb-standalone.c */
|
||||
#define TYPE_RAMFB_DEVICE "ramfb"
|
||||
|
||||
|
|
|
@ -22,6 +22,4 @@
|
|||
#define TYPE_VFIO_CCW "vfio-ccw"
|
||||
OBJECT_DECLARE_SIMPLE_TYPE(VFIOCCWDevice, VFIO_CCW)
|
||||
|
||||
#define TYPE_VFIO_CCW "vfio-ccw"
|
||||
|
||||
#endif
|
||||
|
|
|
@ -98,6 +98,7 @@ typedef struct VFIOContainer {
|
|||
QLIST_HEAD(, VFIOGroup) group_list;
|
||||
QLIST_HEAD(, VFIORamDiscardListener) vrdl_list;
|
||||
QLIST_ENTRY(VFIOContainer) next;
|
||||
QLIST_HEAD(, VFIODevice) device_list;
|
||||
} VFIOContainer;
|
||||
|
||||
typedef struct VFIOGuestIOMMU {
|
||||
|
@ -129,7 +130,10 @@ typedef struct VFIODeviceOps VFIODeviceOps;
|
|||
|
||||
typedef struct VFIODevice {
|
||||
QLIST_ENTRY(VFIODevice) next;
|
||||
QLIST_ENTRY(VFIODevice) container_next;
|
||||
QLIST_ENTRY(VFIODevice) global_next;
|
||||
struct VFIOGroup *group;
|
||||
VFIOContainer *container;
|
||||
char *sysfsdev;
|
||||
char *name;
|
||||
DeviceState *dev;
|
||||
|
@ -196,7 +200,36 @@ typedef struct VFIODisplay {
|
|||
} dmabuf;
|
||||
} VFIODisplay;
|
||||
|
||||
void vfio_put_base_device(VFIODevice *vbasedev);
|
||||
typedef struct {
|
||||
unsigned long *bitmap;
|
||||
hwaddr size;
|
||||
hwaddr pages;
|
||||
} VFIOBitmap;
|
||||
|
||||
void vfio_host_win_add(VFIOContainer *container,
|
||||
hwaddr min_iova, hwaddr max_iova,
|
||||
uint64_t iova_pgsizes);
|
||||
int vfio_host_win_del(VFIOContainer *container, hwaddr min_iova,
|
||||
hwaddr max_iova);
|
||||
VFIOAddressSpace *vfio_get_address_space(AddressSpace *as);
|
||||
void vfio_put_address_space(VFIOAddressSpace *space);
|
||||
bool vfio_devices_all_running_and_saving(VFIOContainer *container);
|
||||
|
||||
/* container->fd */
|
||||
int vfio_dma_unmap(VFIOContainer *container, hwaddr iova,
|
||||
ram_addr_t size, IOMMUTLBEntry *iotlb);
|
||||
int vfio_dma_map(VFIOContainer *container, hwaddr iova,
|
||||
ram_addr_t size, void *vaddr, bool readonly);
|
||||
int vfio_set_dirty_page_tracking(VFIOContainer *container, bool start);
|
||||
int vfio_query_dirty_bitmap(VFIOContainer *container, VFIOBitmap *vbmap,
|
||||
hwaddr iova, hwaddr size);
|
||||
|
||||
int vfio_container_add_section_window(VFIOContainer *container,
|
||||
MemoryRegionSection *section,
|
||||
Error **errp);
|
||||
void vfio_container_del_section_window(VFIOContainer *container,
|
||||
MemoryRegionSection *section);
|
||||
|
||||
void vfio_disable_irqindex(VFIODevice *vbasedev, int index);
|
||||
void vfio_unmask_single_irqindex(VFIODevice *vbasedev, int index);
|
||||
void vfio_mask_single_irqindex(VFIODevice *vbasedev, int index);
|
||||
|
@ -214,15 +247,22 @@ void vfio_region_unmap(VFIORegion *region);
|
|||
void vfio_region_exit(VFIORegion *region);
|
||||
void vfio_region_finalize(VFIORegion *region);
|
||||
void vfio_reset_handler(void *opaque);
|
||||
VFIOGroup *vfio_get_group(int groupid, AddressSpace *as, Error **errp);
|
||||
void vfio_put_group(VFIOGroup *group);
|
||||
struct vfio_device_info *vfio_get_device_info(int fd);
|
||||
int vfio_get_device(VFIOGroup *group, const char *name,
|
||||
VFIODevice *vbasedev, Error **errp);
|
||||
int vfio_attach_device(char *name, VFIODevice *vbasedev,
|
||||
AddressSpace *as, Error **errp);
|
||||
void vfio_detach_device(VFIODevice *vbasedev);
|
||||
|
||||
int vfio_kvm_device_add_fd(int fd, Error **errp);
|
||||
int vfio_kvm_device_del_fd(int fd, Error **errp);
|
||||
|
||||
extern const MemoryRegionOps vfio_region_ops;
|
||||
typedef QLIST_HEAD(VFIOGroupList, VFIOGroup) VFIOGroupList;
|
||||
typedef QLIST_HEAD(VFIODeviceList, VFIODevice) VFIODeviceList;
|
||||
extern VFIOGroupList vfio_group_list;
|
||||
extern VFIODeviceList vfio_device_list;
|
||||
|
||||
extern const MemoryListener vfio_memory_listener;
|
||||
extern int vfio_kvm_device_fd;
|
||||
|
||||
bool vfio_mig_active(void);
|
||||
int vfio_block_multiple_devices_migration(VFIODevice *vbasedev, Error **errp);
|
||||
|
@ -245,6 +285,8 @@ bool vfio_get_info_dma_avail(struct vfio_iommu_type1_info *info,
|
|||
unsigned int *avail);
|
||||
struct vfio_info_cap_header *
|
||||
vfio_get_device_info_cap(struct vfio_device_info *info, uint16_t id);
|
||||
struct vfio_info_cap_header *
|
||||
vfio_get_cap(void *ptr, uint32_t cap_offset, uint16_t id);
|
||||
#endif
|
||||
extern const MemoryListener vfio_prereg_listener;
|
||||
|
||||
|
@ -257,4 +299,12 @@ int vfio_spapr_remove_window(VFIOContainer *container,
|
|||
bool vfio_migration_realize(VFIODevice *vbasedev, Error **errp);
|
||||
void vfio_migration_exit(VFIODevice *vbasedev);
|
||||
|
||||
int vfio_bitmap_alloc(VFIOBitmap *vbmap, hwaddr size);
|
||||
bool vfio_devices_all_running_and_mig_active(VFIOContainer *container);
|
||||
bool vfio_devices_all_device_dirty_tracking(VFIOContainer *container);
|
||||
int vfio_devices_query_dirty_bitmap(VFIOContainer *container,
|
||||
VFIOBitmap *vbmap, hwaddr iova,
|
||||
hwaddr size);
|
||||
int vfio_get_dirty_bitmap(VFIOContainer *container, uint64_t iova,
|
||||
uint64_t size, ram_addr_t ram_addr);
|
||||
#endif /* HW_VFIO_VFIO_COMMON_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue