Received: by 10.223.185.116 with SMTP id b49csp5020181wrg; Tue, 27 Feb 2018 06:36:28 -0800 (PST) X-Google-Smtp-Source: AG47ELshucj95o3M5N/3rtArpBnIKhBV/b3Bhx4jV7BenPTRHzkGz4svi8BHeULSajXF8iWM+of1 X-Received: by 2002:a17:902:aa89:: with SMTP id d9-v6mr9196904plr.337.1519742188222; Tue, 27 Feb 2018 06:36:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519742188; cv=none; d=google.com; s=arc-20160816; b=HZ76Gh55LpXsZ6On06IXsHvFNZAePTQDkFETInoVgjbFz9qOXn7ZytrRYHXew5IEaI UlBBF/7mJuFfZGyLaV+O/T+yVg2+MPr96EqquyyhsgF+xxH0a7PyOHMuR7iU5emWQphU ggYf//FIy0XmwuZviW4P9B/NyACQyMToiV7H9WuEomFWl49BapBF43ZExRiWyAq88k4l hx7CBZArXB/VFlkHq7kHeIw1FxUf9xbzYtjLuNT9DrmxQPvypAbdOv7Yl7tAksHbOrkH EiCp+QGPu8Gwi2R/2TQiKfv5+IGz01gqmm73eOx1F+0UezGn1GByfRtqSCtgyRtQJVVH /MXA== 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=oP/eGtwZu6Sbv6ADK3fNaUCBblLP9oEp5wcXhCPN3bSoVvy79Ye4F+OGThlmPLBhlB iydT27eTn41409rtpn49PBI1+/CfFDr+wxckAy5We9K7DpIoicEzbGT7//KDyHkt7mag Z3ehMAoH3Er0zUo63ajJRl5GBnEGvGwoJR9SpEAzapzCGj6/754A0uBzX+Q3UcktuCzI SIutP8Blz+h8FQ39Oy7Z8pl2dHwoWKR2xW0q57Z4aIdrM/u619NRgxpIg1sG4vauxKJP YCd2bB8+h3w0NED0iAxJCH4LiG5+wHX+AVaOmOcWANZT/f7gedR7hi+35kiJI1WcYfSc sqzw== 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 124si7070415pgj.673.2018.02.27.06.36.13; Tue, 27 Feb 2018 06:36:28 -0800 (PST) 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 S1753967AbeB0Oeq (ORCPT + 99 others); Tue, 27 Feb 2018 09:34:46 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:44118 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753618AbeB0Oao (ORCPT ); Tue, 27 Feb 2018 09:30:44 -0500 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w1REUMqc092317 for ; Tue, 27 Feb 2018 09:30:44 -0500 Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.153]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gd6kh7f3k-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 27 Feb 2018 09:30:26 -0500 Received: from localhost by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 27 Feb 2018 07:29:04 -0700 Received: from b03cxnp08028.gho.boulder.ibm.com (9.17.130.20) by e35.co.us.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 27 Feb 2018 07:29:01 -0700 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 w1RESxiu8388938; Tue, 27 Feb 2018 07:28:59 -0700 Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A902E78041; Tue, 27 Feb 2018 07:28:59 -0700 (MST) Received: from localhost.localdomain (unknown [9.60.75.238]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTPS id D89627803F; Tue, 27 Feb 2018 07:28:57 -0700 (MST) 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, fiuczy@linux.vnet.ibm.com, buendgen@de.ibm.com, Tony Krowiak Subject: [PATCH v2 12/15] s390: vfio-ap: sysfs interface to view matrix mdev matrix Date: Tue, 27 Feb 2018 09:28:10 -0500 X-Mailer: git-send-email 1.7.1 In-Reply-To: <1519741693-17440-1-git-send-email-akrowiak@linux.vnet.ibm.com> References: <1519741693-17440-1-git-send-email-akrowiak@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18022714-0012-0000-0000-000015CFC906 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008601; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000254; SDB=6.00995862; UDB=6.00506230; IPR=6.00775186; MB=3.00019761; MTD=3.00000008; XFM=3.00000015; UTC=2018-02-27 14:29:03 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18022714-0013-0000-0000-000051A8E797 Message-Id: <1519741693-17440-13-git-send-email-akrowiak@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-02-27_05:,, 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-1802270183 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