Re: [PATCH v8 09/16] s390/vfio_ap: add qlink from ap_matrix_mdev struct to vfio_ap_queue struct

2020-06-05 Thread kernel test robot
Hi Tony,

I love your patch! Perhaps something to improve:

[auto build test WARNING on kvms390/next]
[also build test WARNING on linus/master v5.7]
[cannot apply to s390/features linux/master next-20200605]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:
https://github.com/0day-ci/linux/commits/Tony-Krowiak/s390-vfio-ap-dynamic-configuration-support/20200606-054350
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git next
config: s390-allyesconfig (attached as .config)
compiler: s390-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross 
ARCH=s390 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All warnings (new ones prefixed by >>, old ones prefixed by <<):

>> drivers/s390/crypto/vfio_ap_ops.c:53:23: warning: no previous prototype for 
>> 'vfio_ap_get_mdev_queue' [-Wmissing-prototypes]
53 | struct vfio_ap_queue *vfio_ap_get_mdev_queue(struct ap_matrix_mdev 
*matrix_mdev,
|   ^~
drivers/s390/crypto/vfio_ap_ops.c:143:24: warning: no previous prototype for 
'vfio_ap_irq_disable' [-Wmissing-prototypes]
143 | struct ap_queue_status vfio_ap_irq_disable(struct vfio_ap_queue *q)
|^~~
drivers/s390/crypto/vfio_ap_ops.c:1453:5: warning: no previous prototype for 
'vfio_ap_mdev_reset_queue' [-Wmissing-prototypes]
1453 | int vfio_ap_mdev_reset_queue(unsigned int apid, unsigned int apqi,
| ^~~~

vim +/vfio_ap_get_mdev_queue +53 drivers/s390/crypto/vfio_ap_ops.c

52  
  > 53  struct vfio_ap_queue *vfio_ap_get_mdev_queue(struct ap_matrix_mdev 
*matrix_mdev,
54   unsigned long apqn)
55  {
56  struct vfio_ap_queue *q;
57  
58  hash_for_each_possible(matrix_mdev->qtable, q, mdev_qnode, 
apqn) {
59  if (q && (q->apqn == apqn))
60  return q;
61  }
62  
63  return NULL;
64  }
65  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


.config.gz
Description: application/gzip


[PATCH v8 09/16] s390/vfio_ap: add qlink from ap_matrix_mdev struct to vfio_ap_queue struct

2020-06-05 Thread Tony Krowiak
In order to make retrieval of a vfio_ap_queue struct more
efficient when we already have a pointer to the ap_matrix_mdev to which the
queue's APQN is assigned, let's go ahead and add a link from the
ap_matrix_mdev struct to the vfio_ap_queue struct.

Signed-off-by: Tony Krowiak 
---
 drivers/s390/crypto/vfio_ap_ops.c | 102 ++
 drivers/s390/crypto/vfio_ap_private.h |   2 +
 2 files changed, 72 insertions(+), 32 deletions(-)

diff --git a/drivers/s390/crypto/vfio_ap_ops.c 
b/drivers/s390/crypto/vfio_ap_ops.c
index add442977b9a..9a019b2b86f8 100644
--- a/drivers/s390/crypto/vfio_ap_ops.c
+++ b/drivers/s390/crypto/vfio_ap_ops.c
@@ -50,6 +50,19 @@ static struct vfio_ap_queue *vfio_ap_get_queue(unsigned long 
apqn)
return q;
 }
 
+struct vfio_ap_queue *vfio_ap_get_mdev_queue(struct ap_matrix_mdev 
*matrix_mdev,
+unsigned long apqn)
+{
+   struct vfio_ap_queue *q;
+
+   hash_for_each_possible(matrix_mdev->qtable, q, mdev_qnode, apqn) {
+   if (q && (q->apqn == apqn))
+   return q;
+   }
+
+   return NULL;
+}
+
 /**
  * vfio_ap_wait_for_irqclear
  * @apqn: The AP Queue number
@@ -337,6 +350,7 @@ static int vfio_ap_mdev_create(struct kobject *kobj, struct 
mdev_device *mdev)
matrix_mdev->mdev = mdev;
vfio_ap_matrix_init(_dev->info, _mdev->matrix);
vfio_ap_matrix_init(_dev->info, _mdev->shadow_apcb);
+   hash_init(matrix_mdev->qtable);
mdev_set_drvdata(mdev, matrix_mdev);
matrix_mdev->pqap_hook.hook = handle_pqap;
matrix_mdev->pqap_hook.owner = THIS_MODULE;
@@ -639,7 +653,7 @@ static int vfio_ap_mdev_filter_matrix(struct ap_matrix_mdev 
*matrix_mdev,
 * filter the APQI.
 */
apqn = AP_MKQID(apid, apqi);
-   if (!vfio_ap_get_queue(apqn)) {
+   if (!vfio_ap_get_mdev_queue(matrix_mdev, apqn)) {
if (filter_apids)
clear_bit_inv(apid, shadow_apcb->apm);
else
@@ -682,7 +696,6 @@ static bool vfio_ap_mdev_config_shadow_apcb(struct 
ap_matrix_mdev *matrix_mdev)
vfio_ap_matrix_init(_dev->info, _apcb);
napm = bitmap_weight(matrix_mdev->matrix.apm, AP_DEVICES);
naqm = bitmap_weight(matrix_mdev->matrix.aqm, AP_DOMAINS);
-
/*
 * If there are no APIDs or no APQIs assigned to the matrix mdev,
 * then no APQNs shall be assigned to the guest CRYCB.
@@ -694,6 +707,7 @@ static bool vfio_ap_mdev_config_shadow_apcb(struct 
ap_matrix_mdev *matrix_mdev)
 */
napm = vfio_ap_mdev_filter_matrix(matrix_mdev, _apcb,
  true);
+
/*
 * If there are no APQNs that can be assigned to the guest's
 * CRYCB after filtering, then try filtering the APQIs.
@@ -742,56 +756,75 @@ enum qlink_type {
UNLINK_APQI,
 };
 
+static void vfio_ap_mdev_link_queue(struct ap_matrix_mdev *matrix_mdev,
+   unsigned long apid, unsigned long apqi)
+{
+   struct vfio_ap_queue *q;
+
+   q = vfio_ap_get_queue(AP_MKQID(apid, apqi));
+   if (q) {
+   q->matrix_mdev = matrix_mdev;
+   hash_add(matrix_mdev->qtable,
+>mdev_qnode, q->apqn);
+   }
+}
+
+static void vfio_ap_mdev_unlink_queue(unsigned long apid, unsigned long apqi)
+{
+   struct vfio_ap_queue *q;
+
+   q = vfio_ap_get_queue(AP_MKQID(apid, apqi));
+   if (q) {
+   q->matrix_mdev = NULL;
+   hash_del(>mdev_qnode);
+   }
+}
+
 /**
  * vfio_ap_mdev_link_queues
  *
  * @matrix_mdev: The matrix mdev to link.
- * @type:   The type of link.
+ * @type:   The type of @qlink_id.
  * @qlink_id:   The APID or APQI of the queues to link.
  *
- * Sets the link from the queues with the specified @qlink_id (i.e., APID or
- * APQI) to @matrix_mdev:
- * qlink_id == LINK_APID: Link @matrix_mdev to the queues with the
- * specified APID>
- * qlink_id == UNLINK_APID: Unlink @matrix_mdev from the queues with the
- * specified APID>
- * qlink_id == LINK_APQI: Link @matrix_mdev to the queues with the
- * specified APQI>
- * qlink_id == UNLINK_APQI: Unlink @matrix_mdev from the queues with the
- * specified APQI>
+ * Sets or clears the links between the queues with the specified @qlink_id
+ * and the @matrix_mdev:
+ * @type == LINK_APID: Set the links between the @matrix_mdev and the
+ * queues with the specified @qlink_id (APID)
+ * @type == LINK_APQI: Set the links between the @matrix_mdev and the
+ * queues with the specified @qlink_id (APQI)
+ * @type == UNLINK_APID: Clear the links between the