Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp927615imm; Wed, 23 May 2018 07:39:39 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo9otBckQT9fD3hWKgxlXZNH8NuJu/SuJNzsG5n1UAp/a6PC0QInGW7mhEbOnAsGDQRFnau X-Received: by 2002:a65:4443:: with SMTP id e3-v6mr2615884pgq.348.1527086379255; Wed, 23 May 2018 07:39:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527086379; cv=none; d=google.com; s=arc-20160816; b=ycNYmdJXXEzX7rVWDqgMPD3EEqql+IB2kJ741uN2Gub8dpM/wMd2F9lLE16NAJ1vEg /hkKyEsN9NQEE3RcHxr5t+pfSirqdsKf8uOq++vauWjg8FgZ0v5vE0kreJt+p0miOkOB QRKgU4jZEU7VAcHyJgJgwfe/XhD1ZqIFxp7OLDKgNAGWWqOK0eoxyIXqSc7+HYQL5Xhs t0wBYNifcCTHSwHzY2dU6Ej6kNRXcTne5FjeT5WJLQSsZT32VGs/kJJpIXXHfD+ZfGkr uoUuCOQfnGknmj8Y8YrSJU6quq5gzCw/9lHPBi1Xr3EqKdLWzohfpCsHJEgBN/y/VuqI vygA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :from:references:to:subject:cc:arc-authentication-results; bh=wlUFU4zD37bjEnAQ/szKuKTTqRxrc2rIwt3fldCrRAA=; b=aRcH6zthaMRI9QC4YkopkwQhOwhyVcKginobVVu+lQF7cg0t1YxemwaomMM5RAxn55 Env/cwTPC6uClTilROcwtIW/aCihlvBAN0jgJphZJaGi+2NbY8i/O9z5lrcMuzlf+GeE 0QrbAgwl0yfy8oHMkTaRdzCdd0Wa3ziyUdU60pkI3hbtbK7FFg9kOZrTaaTQ3gvHg+kL rsRelC+zVg3weJc1PxuCQqpVvdeuRmGFsk3gaGYJU4cwN7u+qOeBdyjOJ/UpC6jHZDzT GRexEsMflkAT6hYjXnrLIySn9oSp7cr/8T941LeR671ImcqwQD/mje6VhcprYxuYDwrY e0iw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l3-v6si18342629pfa.368.2018.05.23.07.39.23; Wed, 23 May 2018 07:39:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933414AbeEWOiy (ORCPT + 99 others); Wed, 23 May 2018 10:38:54 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:35648 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933399AbeEWOim (ORCPT ); Wed, 23 May 2018 10:38:42 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w4NEcaC5082251 for ; Wed, 23 May 2018 10:38:42 -0400 Received: from e36.co.us.ibm.com (e36.co.us.ibm.com [32.97.110.154]) by mx0b-001b2d01.pphosted.com with ESMTP id 2j5a8a8070-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 23 May 2018 10:38:41 -0400 Received: from localhost by e36.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 23 May 2018 08:38:41 -0600 Received: from b03cxnp08028.gho.boulder.ibm.com (9.17.130.20) by e36.co.us.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 23 May 2018 08:38:37 -0600 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w4NEcY4Y6881540 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 23 May 2018 07:38:34 -0700 Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2200D78038; Wed, 23 May 2018 08:38:34 -0600 (MDT) Received: from oc8043147753.ibm.com (unknown [9.85.159.1]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP id BF0807803F; Wed, 23 May 2018 08:38:30 -0600 (MDT) Cc: akrowiak@linux.vnet.ibm.com, freude@de.ibm.com, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, borntraeger@de.ibm.com, cohuck@redhat.com, kwankhede@nvidia.com, bjsdjshi@linux.vnet.ibm.com, pbonzini@redhat.com, alex.williamson@redhat.com, pmorel@linux.vnet.ibm.com, alifm@linux.vnet.ibm.com, mjrosato@linux.vnet.ibm.com, jjherne@linux.vnet.ibm.com, thuth@redhat.com, pasic@linux.vnet.ibm.com, berrange@redhat.com, fiuczy@linux.vnet.ibm.com, buendgen@de.ibm.com Subject: Re: [PATCH v5 10/13] s390: vfio-ap: sysfs interface to view matrix mdev matrix To: pmorel@linux.ibm.com, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org References: <1525705912-12815-1-git-send-email-akrowiak@linux.vnet.ibm.com> <1525705912-12815-11-git-send-email-akrowiak@linux.vnet.ibm.com> From: Tony Krowiak Date: Wed, 23 May 2018 10:38:30 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 18052314-0020-0000-0000-00000DFEB088 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009072; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000261; SDB=6.01036525; UDB=6.00530262; IPR=6.00815653; MB=3.00021258; MTD=3.00000008; XFM=3.00000015; UTC=2018-05-23 14:38:40 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18052314-0021-0000-0000-000061868597 Message-Id: <53275110-45fb-d50f-c97e-93141378f094@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-05-23_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805230148 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/16/2018 03:55 AM, Pierre Morel wrote: > On 07/05/2018 17:11, Tony Krowiak wrote: >> Provides a sysfs interface to view the AP matrix configured for the >> mediated matrix device. >> >> The relevant sysfs structures are: >> >> /sys/devices/vfio_ap >> ... [matrix] >> ...... [mdev_supported_types] >> ......... [vfio_ap-passthrough] >> ............ [devices] >> ...............[$uuid] >> .................. matrix >> >> To view the matrix configured for the mediated matrix device, >> print the matrix file: > > This is the configured matrix, not the one used by the guest. > Nothing in the patches protect against binding a queue and assigning > a new AP when the guest runs. > The card and queue will be showed by this entry. Of course, as stated above, this is the matrix configured for the mediated matrix device. Are you suggesting here that the driver should prevent assigning a new adapter or domain while a guest is running? Couldn't this be a step in the process for hot (un)plugging AP queues? > > > >> >> cat matrix >> >> Signed-off-by: Tony Krowiak >> --- >> drivers/s390/crypto/vfio_ap_ops.c | 31 >> +++++++++++++++++++++++++++++++ >> 1 files changed, 31 insertions(+), 0 deletions(-) >> >> diff --git a/drivers/s390/crypto/vfio_ap_ops.c >> b/drivers/s390/crypto/vfio_ap_ops.c >> index 755be1d..81e03b8 100644 >> --- a/drivers/s390/crypto/vfio_ap_ops.c >> +++ b/drivers/s390/crypto/vfio_ap_ops.c >> @@ -716,6 +716,36 @@ static ssize_t control_domains_show(struct >> device *dev, >> } >> DEVICE_ATTR_RO(control_domains); >> >> +static ssize_t matrix_show(struct device *dev, struct >> device_attribute *attr, >> + char *buf) >> +{ >> + struct mdev_device *mdev = mdev_from_dev(dev); >> + struct ap_matrix_mdev *matrix_mdev = mdev_get_drvdata(mdev); >> + char *bufpos = buf; >> + unsigned long apid; >> + unsigned long apqi; >> + unsigned long napm = matrix_mdev->matrix.apm_max + 1; >> + unsigned long naqm = matrix_mdev->matrix.aqm_max + 1; >> + int nchars = 0; >> + int n; >> + >> + for_each_set_bit_inv(apid, matrix_mdev->matrix.apm, napm) { >> + n = sprintf(bufpos, "%02lx\n", apid); >> + bufpos += n; >> + nchars += n; >> + >> + for_each_set_bit_inv(apqi, matrix_mdev->matrix.aqm, naqm) { >> + n = sprintf(bufpos, "%02lx.%04lx\n", apid, apqi); >> + bufpos += n; >> + nchars += n; >> + } >> + } >> + >> + return nchars; >> +} >> +DEVICE_ATTR_RO(matrix); >> + >> + >> static struct attribute *vfio_ap_mdev_attrs[] = { >> &dev_attr_assign_adapter.attr, >> &dev_attr_unassign_adapter.attr, >> @@ -724,6 +754,7 @@ static ssize_t control_domains_show(struct device >> *dev, >> &dev_attr_assign_control_domain.attr, >> &dev_attr_unassign_control_domain.attr, >> &dev_attr_control_domains.attr, >> + &dev_attr_matrix.attr, >> NULL, >> }; >> >