Received: by 10.213.65.68 with SMTP id h4csp1165475imn; Wed, 14 Mar 2018 11:31:06 -0700 (PDT) X-Google-Smtp-Source: AG47ELt9/699B5vuQqqZYJA6oyywm1rTTmZoL+cB6dfT27Ollp0I1Wp4FpfLHuo+p0m1PfGsz1T6 X-Received: by 2002:a17:902:69ce:: with SMTP id m14-v6mr3922663pln.358.1521052265960; Wed, 14 Mar 2018 11:31:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521052265; cv=none; d=google.com; s=arc-20160816; b=ajkTFTDAmnp9AVensVAMmjs5lRjc7SrAfZ4ynRjFE1rRVedId3JqQN5TcA2pUhv+VW i8zhfpqoLfaNWpEqNHOuFlK5/3P6efEDGjP2gkYHz/ExJuZUILqBNKurMj446N+fSOW7 AwVGtd2ZSkWVrgHZ/M/MVFWH3BmoujJaZsgbpg4H+TV451djLpxUfK7Ktiy4YEk4VSNO huGbvuQmiRwJaO68aIATpJKN4GfxDNxk2xX2hy+xXXAtdZN9GgFXvyyRtpAwUfX+2t12 xWhQR45+50PIoKXX6Ti86G9C/FNgU2zHw9P1Ost/P7G0pvwo3uq2fBlxRbhzuJK83r+j GJtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from:arc-authentication-results; bh=e6RvM3DZ1xF14L77va/9EQA99mshBP02KG+ZtHFurgY=; b=ILUoW3Itj/b8pwb+QsKFqEEfAr6rToslK1zeiFqJMpTh9hoTe1b87gfvrNGtCsx6Pw U1WjmZrqB+ORRXMv1CqJkr3ZZOLzoZnl6zMAMQTKdT6fdOzk6XydSkLgEBYTcUXeAtWS Cu22Pgc3yQDXZiaGiheF8gEzbPQtmCatwXJpgLMedoH1KihbCJETjAJfGSGc8OVP2m3T Q6Y5nUaGlI3DJIypnmsrbFykoXJ1pDX2FCgDVfCa1ZsIumcU+1+/NTmOWYDrOcpw/O5Z Mkb/ORsO3SWonYtJ8S6Px07fjWWD8sprH4WEbpfTYRZeFCURQla1Dah5K8SDdVkekKy7 uBbQ== 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 k33-v6si2362395pld.303.2018.03.14.11.30.50; Wed, 14 Mar 2018 11:31:05 -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 S1752695AbeCNS0x (ORCPT + 99 others); Wed, 14 Mar 2018 14:26:53 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:46358 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752301AbeCNS0v (ORCPT ); Wed, 14 Mar 2018 14:26:51 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2EIQiw0076109 for ; Wed, 14 Mar 2018 14:26:51 -0400 Received: from e34.co.us.ibm.com (e34.co.us.ibm.com [32.97.110.152]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gq8w689kf-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Wed, 14 Mar 2018 14:26:51 -0400 Received: from localhost by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 14 Mar 2018 12:26:50 -0600 Received: from b03cxnp08025.gho.boulder.ibm.com (9.17.130.17) by e34.co.us.ibm.com (192.168.1.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 14 Mar 2018 12:26:45 -0600 Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w2EIQint13042042; Wed, 14 Mar 2018 11:26:44 -0700 Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 055C813603C; Wed, 14 Mar 2018 12:26:44 -0600 (MDT) Received: from localhost.localdomain (unknown [9.85.151.171]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTPS id 74B5113603A; Wed, 14 Mar 2018 12:26:41 -0600 (MDT) From: Tony Krowiak To: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: 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, akrowiak@linux.vnet.ibm.com Subject: [PATCH v3 11/14] s390: vfio-ap: sysfs interface to view matrix mdev matrix Date: Wed, 14 Mar 2018 14:25:51 -0400 X-Mailer: git-send-email 1.7.1 In-Reply-To: <1521051954-25715-1-git-send-email-akrowiak@linux.vnet.ibm.com> References: <1521051954-25715-1-git-send-email-akrowiak@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18031418-0016-0000-0000-000008644F57 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008674; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000254; SDB=6.01003025; UDB=6.00510424; IPR=6.00782355; MB=3.00020035; MTD=3.00000008; XFM=3.00000015; UTC=2018-03-14 18:26:48 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18031418-0017-0000-0000-00003DD7A011 Message-Id: <1521051954-25715-12-git-send-email-akrowiak@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-03-14_09:,, 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=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803140201 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: cat matrix Signed-off-by: Tony Krowiak --- drivers/s390/crypto/vfio_ap_ops.c | 39 +++++++++++++++++++++++++++++++++++++ 1 files changed, 39 insertions(+), 0 deletions(-) diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c index 461d450..04f7a92 100644 --- a/drivers/s390/crypto/vfio_ap_ops.c +++ b/drivers/s390/crypto/vfio_ap_ops.c @@ -692,6 +692,44 @@ 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; + int nchars = 0; + int n; + + n = sprintf(bufpos, "ADAPTER.DOMAIN\n"); + bufpos += n; + nchars += n; + + n = sprintf(bufpos, "--------------\n"); + bufpos += n; + nchars += n; + + for_each_set_bit_inv(apid, matrix_mdev->matrix->apm, + matrix_mdev->matrix->apm_max) { + n = sprintf(bufpos, "%02lx\n", apid); + bufpos += n; + nchars += n; + + for_each_set_bit_inv(apqi, matrix_mdev->matrix->aqm, + matrix_mdev->matrix->aqm_max) { + 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, @@ -700,6 +738,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, }; -- 1.7.1