xref: /openbmc/qemu/include/hw/vfio/vfio-cpr.h (revision 7e9f21411302d823e9ee563ff6a2a40b1ffc1266)
13ed34463SSteve Sistare /*
23ed34463SSteve Sistare  * VFIO CPR
33ed34463SSteve Sistare  *
43ed34463SSteve Sistare  * Copyright (c) 2025 Oracle and/or its affiliates.
53ed34463SSteve Sistare  *
63ed34463SSteve Sistare  * SPDX-License-Identifier: GPL-2.0-or-later
73ed34463SSteve Sistare  */
83ed34463SSteve Sistare 
93ed34463SSteve Sistare #ifndef HW_VFIO_VFIO_CPR_H
103ed34463SSteve Sistare #define HW_VFIO_VFIO_CPR_H
113ed34463SSteve Sistare 
1254857b08SSteve Sistare #include "migration/misc.h"
1354857b08SSteve Sistare 
1454857b08SSteve Sistare struct VFIOContainer;
153ed34463SSteve Sistare struct VFIOContainerBase;
16c29a65edSSteve Sistare struct VFIOGroup;
173ed34463SSteve Sistare 
1854857b08SSteve Sistare typedef struct VFIOContainerCPR {
1954857b08SSteve Sistare     Error *blocker;
20*7e9f2141SSteve Sistare     int (*saved_dma_map)(const struct VFIOContainerBase *bcontainer,
21*7e9f2141SSteve Sistare                          hwaddr iova, ram_addr_t size,
22*7e9f2141SSteve Sistare                          void *vaddr, bool readonly, MemoryRegion *mr);
2354857b08SSteve Sistare } VFIOContainerCPR;
2454857b08SSteve Sistare 
2554857b08SSteve Sistare 
2654857b08SSteve Sistare bool vfio_legacy_cpr_register_container(struct VFIOContainer *container,
2754857b08SSteve Sistare                                         Error **errp);
2854857b08SSteve Sistare void vfio_legacy_cpr_unregister_container(struct VFIOContainer *container);
2954857b08SSteve Sistare 
3054857b08SSteve Sistare int vfio_cpr_reboot_notifier(NotifierWithReturn *notifier, MigrationEvent *e,
3154857b08SSteve Sistare                              Error **errp);
3254857b08SSteve Sistare 
333ed34463SSteve Sistare bool vfio_cpr_register_container(struct VFIOContainerBase *bcontainer,
343ed34463SSteve Sistare                                  Error **errp);
353ed34463SSteve Sistare void vfio_cpr_unregister_container(struct VFIOContainerBase *bcontainer);
363ed34463SSteve Sistare 
37c29a65edSSteve Sistare int vfio_cpr_group_get_device_fd(int d, const char *name);
38c29a65edSSteve Sistare 
39c29a65edSSteve Sistare bool vfio_cpr_container_match(struct VFIOContainer *container,
40c29a65edSSteve Sistare                               struct VFIOGroup *group, int fd);
41c29a65edSSteve Sistare 
423ed34463SSteve Sistare #endif /* HW_VFIO_VFIO_CPR_H */
43