mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
libap: add routine to check for dynamic config support
For a given vfio-ap mdev, determine whether or not the device will need dynamic config operations. This boils down to whether or not the device is currently active + whether or not the kernel is detected to support dynamic config operations (via the 'ap_config' sysfs attribute). Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com> Reviewed-by: Anthony Krowiak <akrowiak@linux.ibm.com> Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
9c8d117cc2
commit
46dadc8cc4
@@ -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);
|
||||
|
||||
22
libap/ap.c
22
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
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user