Received: by 10.192.165.156 with SMTP id m28csp2993784imm; Sun, 15 Apr 2018 14:27:15 -0700 (PDT) X-Google-Smtp-Source: AIpwx49sbdoaqtnV9G0EdjWnCRvCl0uZvxhDc+oUPyfB9Cgre6MaCYPV5bGJUoSxMme+ke0tQNaB X-Received: by 2002:a17:902:7d86:: with SMTP id a6-v6mr13293863plm.264.1523827635731; Sun, 15 Apr 2018 14:27:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523827635; cv=none; d=google.com; s=arc-20160816; b=wtd2FBQLgronz6X3iU/CtyUTrFPc/M0dMlhLvzeFekgVXvDRwCaVlSHfeaDcUHwdjV y+zXCbfof68eUg223g9HiBgsTWMc31g/Sgl4a7/e6kH3lbxmFVu9DW8hCE0io/96N+UI OX2xeGha4BkTGkuw9nRQJdv9IV0EEBhbpufImSVT0+naGJiSvC8XueD+SXLF7Dsyh14W EVii6jKk4Noh4C+ZmLMIkHUu2UULqsa9qkTFO3tPUNZ2Li8xYAACiEfwUwaNZfrO6c9s ZN2KGRjYW6+Q1REpNdXUofyhKJ5WYCTfgAclvcEpoVURrXUv4WFBBbJgwY6wM0rmEo6w He5Q== 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=5Aw9QUmXQgAiQ5VtoUE5jdzZoFY0eUYMpd946slbL6U=; b=jR5VtmMaX8hIpM1D2mOv7CJWbzBGAaNoZcvSa4RNxEfhIvPtSL4X189Ft340hmrfYK lOOku+86G5jrjhWsSW5GauOB+vy3G4MBy867J+OpfbrGT0umjlTHTqF6YtRTF+hReIyK k1O7QRO5SFzjHtzQrOrwRZPjvH+rQMEvBFUVMg2GzYoO9MvPQEYMkkloNxu2P4DNQxuu tNNV3l6xxVM0HS5qYoWb+0xESuf+rli4qHqNkLyBOmT40aOvPZFn1kyN8AqWIkbU+H20 1RvpkQzXKNG9kmyrs0iy0gY8afS6aHzcXJdNgOb91f3ktcnWwE4xwHtQjtYMyyPbGe2T lnhA== 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 b3si100769pfm.201.2018.04.15.14.26.27; Sun, 15 Apr 2018 14:27:15 -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 S1753362AbeDOVX6 (ORCPT + 99 others); Sun, 15 Apr 2018 17:23:58 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:57336 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753187AbeDOVXA (ORCPT ); Sun, 15 Apr 2018 17:23:00 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3FLJW6B007455 for ; Sun, 15 Apr 2018 17:22:59 -0400 Received: from e14.ny.us.ibm.com (e14.ny.us.ibm.com [129.33.205.204]) by mx0b-001b2d01.pphosted.com with ESMTP id 2hbyjx8g2g-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Sun, 15 Apr 2018 17:22:59 -0400 Received: from localhost by e14.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 15 Apr 2018 17:22:58 -0400 Received: from b01cxnp22035.gho.pok.ibm.com (9.57.198.25) by e14.ny.us.ibm.com (146.89.104.201) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sun, 15 Apr 2018 17:22:55 -0400 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3FLMsF856164464; Sun, 15 Apr 2018 21:22:54 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5E982AE03B; Sun, 15 Apr 2018 17:24:40 -0400 (EDT) Received: from localhost.localdomain (unknown [9.85.139.141]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTPS id 516EDAE034; Sun, 15 Apr 2018 17:24:39 -0400 (EDT) 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 v4 12/15] s390: vfio-ap: sysfs interface to view matrix mdev matrix Date: Sun, 15 Apr 2018 17:22:22 -0400 X-Mailer: git-send-email 1.7.1 In-Reply-To: <1523827345-11600-1-git-send-email-akrowiak@linux.vnet.ibm.com> References: <1523827345-11600-1-git-send-email-akrowiak@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18041521-0052-0000-0000-000002DB5A21 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008862; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000257; SDB=6.01018429; UDB=6.00519481; IPR=6.00797666; MB=3.00020592; MTD=3.00000008; XFM=3.00000015; UTC=2018-04-15 21:22:57 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18041521-0053-0000-0000-00005C578077 Message-Id: <1523827345-11600-13-git-send-email-akrowiak@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-04-15_10:,, 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-1804150214 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 | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c index 413ecbb..bc2b05e 100644 --- a/drivers/s390/crypto/vfio_ap_ops.c +++ b/drivers/s390/crypto/vfio_ap_ops.c @@ -701,6 +701,32 @@ 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; + + for_each_set_bit_inv(apid, matrix_mdev->matrix->apm, + matrix_mdev->matrix->apm_max) { + 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, @@ -709,6 +735,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