On Wed, Feb 19, 2025 at 07:07:38PM -0500, Anthony Krowiak wrote:
-#define MDEV_SHARING_ERR "Userspace may not re-assign queue %02lx.%04lx " \Please do not split error messages across several lines, so it is easy
- "already assigned to %s"
+#define MDEV_SHARING_ERR "Userspace may not assign queue %02lx.%04lx " \
+ "to mdev: already assigned to %s"
to grep such for messages. If this would have been used for printk
directly checkpatch would have emitted a message.
+#define MDEV_IN_USE_ERR "Can not reserve queue %02lx.%04lx for host driver: " \Same here.
+ "in use by mdev"
for_each_set_bit_inv(apid, apm, AP_DEVICES)Braces are missing. Even it the above is not a bug: bodies of for
for_each_set_bit_inv(apqi, aqm, AP_DOMAINS)
- dev_warn(dev, MDEV_SHARING_ERR, apid, apqi, mdev_name);
+ dev_warn(mdev_dev(assignee->mdev), MDEV_SHARING_ERR,
+ apid, apqi, dev_name(mdev_dev(assigned_to->mdev)));
statements must be enclosed with braces if they have more than one
line:
for_each_set_bit_inv(apid, apm, AP_DEVICES) {
for_each_set_bit_inv(apqi, aqm, AP_DOMAINS) {
dev_warn(mdev_dev(assignee->mdev), MDEV_SHARING_ERR,
apid, apqi, dev_name(mdev_dev(assigned_to->mdev))
}
}
+static void vfio_ap_mdev_log_in_use_err(struct ap_matrix_mdev *assignee,Same here.
+ unsigned long *apm, unsigned long *aqm)
+{
+ unsigned long apid, apqi;
+
+ for_each_set_bit_inv(apid, apm, AP_DEVICES)
+ for_each_set_bit_inv(apqi, aqm, AP_DOMAINS)
+ dev_warn(mdev_dev(assignee->mdev), MDEV_IN_USE_ERR,
+ apid, apqi);
+}
+Stray "assigned" - as a result this is not kernel doc anymore.
+/**assigned
* vfio_ap_mdev_verify_no_sharing - verify APQNs are not shared by matrix mdevs
+ * @assignee the matrix mdev to which @mdev_apm and @mdev_aqm are beingMissing ":" behind @assignee. Please keep this consistent.
+ * assigned; or, NULL if this function was called by the AP bus driver
+ * in_use callback to verify none of the APQNs being reserved for the
+ * host device driver are in use by a vfio_ap mediated device
* @mdev_apm: mask indicating the APIDs of the APQNs to be verified
* @mdev_aqm: mask indicating the APQIs of the APQNs to be verified
@@ -912,17 +930,21 @@ static int vfio_ap_mdev_verify_no_sharing(unsigned long *mdev_apm,Another random "assigned" word.
/*
* We work on full longs, as we can only exclude the leftover
- * bits in non-inverse order. The leftover is all zeros.
+ * bits in non-inverse order. The leftover is all zeros.assigned
*/
+ if (assignee)if body with multiple lines -> braces. Or better make that
+ vfio_ap_mdev_log_sharing_err(assignee, assigned_to,
+ apm, aqm);
+ else
+ vfio_ap_mdev_log_in_use_err(assigned_to, apm, aqm);
vfio_ap_mdev_log_sharing_err() call a long line. If you want to keep
the line-break add braces to both the if and else branch.