diff --git a/include/lib/ap.h b/include/lib/ap.h index 057a78e4..e749f47a 100644 --- a/include/lib/ap.h +++ b/include/lib/ap.h @@ -72,6 +72,7 @@ char *path_get_ap_udev(void); void vfio_ap_parse_matrix(struct vfio_ap_device *dev, char *matrix); void vfio_ap_sort_matrix_results(struct vfio_ap_device *dev); void vfio_ap_parse_control(struct vfio_ap_device *dev, char *control); +bool vfio_ap_need_dynamic_config(struct vfio_ap_device *dev); /* Functions for reading JSON device config */ int vfio_ap_read_device_config(const char *path, struct vfio_ap_device *dev); diff --git a/libap/ap.c b/libap/ap.c index 6a2aa746..d5116d8d 100644 --- a/libap/ap.c +++ b/libap/ap.c @@ -416,6 +416,28 @@ void vfio_ap_parse_control(struct vfio_ap_device *dev, char *control) } } +/** + * Determine if the specified device is currently active. If so, see if + * it is enabled for dynamic configuration support. + * + * @param[in] dev Vfio-ap struct + * + * @retval True Device is active and enabled for dynamic config + * @retval False Device is not active OR no dynamic config support + */ +bool vfio_ap_need_dynamic_config(struct vfio_ap_device *dev) +{ + char *attr = path_get_vfio_ap_attr(dev->uuid, "ap_config"); + + if (!attr) + return false; + + if (!util_path_is_readable(attr)) + return false; + + return true; +} + #ifdef HAVE_JSONC /**