Received: by 10.213.65.68 with SMTP id h4csp536268imn; Tue, 27 Mar 2018 04:20:41 -0700 (PDT) X-Google-Smtp-Source: AG47ELvf1E24QC/9exuy6p/4AjIun1o9kQJz41rHQVZSWJR18hydZXmaKBNkC4Lf/ih3tAh+oXPz X-Received: by 10.98.201.194 with SMTP id l63mr36277309pfk.126.1522149641711; Tue, 27 Mar 2018 04:20:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522149641; cv=none; d=google.com; s=arc-20160816; b=gEWucEWTG6T61JrivDLuJjxLHwK1ia1DEzNctVdzBmjCZeo42Qb/mrbcT2pVFb0GAb l4Kx1BPbMOg/uTeCno2JdvNA/evRVrKrJME0tTIRkS/ikFdfdK+rJgGMwt3Xdp9QDL0A u7Yrs7gZg3SxoUHtEUf2RctwUhyd4/QQhVGi/jZzZ9MhhV7Kz129kF8kgcqWjc1NYNZ6 RaaNaPu4vKOu4GRyuQedYhOK22TtwpKxv4nLkDq15XwlzcZfovcR6+RzFRVdtqDc4VzB sZ40B4N24N/Qc4JKfLHPp3TGMrYE64d8OkvlS7UhPgTQ/L8SBzT02/7Wjc/vcN/kZXL3 nfjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=hUqihAm1ys/6qFwev5DR6HE7+0FZ9UcoerBJwdUqQmk=; b=paIQry8OXjn1eO3bQhdmt3Ss9HH9yWqfI/KtWis/sOZuno79Lt6jnmw2dZi4f0U37i MtbqmggNC1cNzZveasczLCrDWque8PP8ZGn6idmfF6VSCypwJOtj4wCgeMDIJuFxHh6o cS0xR0Ov2a6tKageBwBicwcj4k9Phr8wdmMgvlYerHDdPBT6Ua4Fi7lCamfbAVh0hcWv /G25MTW/8HfG2LWFNu5s8kr+O3svSW48GHVJ6l6whnKn0f/zXYuAHGP3gUA7JvXED0FB H2N+Ky62+rP+hfz5ZOdVXxN0jSXp0u35LcBk3eVnB3848GtDu9MmoZc/sIw6wN4UYVWH NsbA== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3-v6si1068358plq.142.2018.03.27.04.20.27; Tue, 27 Mar 2018 04:20:41 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751202AbeC0LTX (ORCPT + 99 others); Tue, 27 Mar 2018 07:19:23 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:43130 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750907AbeC0LTV (ORCPT ); Tue, 27 Mar 2018 07:19:21 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 026818151D49; Tue, 27 Mar 2018 11:19:21 +0000 (UTC) Received: from gondolin (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id 318D2215CDB5; Tue, 27 Mar 2018 11:19:18 +0000 (UTC) Date: Tue, 27 Mar 2018 13:19:16 +0200 From: Cornelia Huck To: Pierre Morel Cc: Tony Krowiak , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, freude@de.ibm.com, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, borntraeger@de.ibm.com, kwankhede@nvidia.com, bjsdjshi@linux.vnet.ibm.com, pbonzini@redhat.com, alex.williamson@redhat.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 v3 11/14] s390: vfio-ap: sysfs interface to view matrix mdev matrix Message-ID: <20180327131916.44f285bd.cohuck@redhat.com> In-Reply-To: References: <1521051954-25715-1-git-send-email-akrowiak@linux.vnet.ibm.com> <1521051954-25715-12-git-send-email-akrowiak@linux.vnet.ibm.com> Organization: Red Hat GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 27 Mar 2018 11:19:21 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 27 Mar 2018 11:19:21 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'cohuck@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 15 Mar 2018 10:42:33 +0100 Pierre Morel wrote: > On 14/03/2018 19:25, 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: > > > > 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"); > > For easy parsing it is better to only report the interesting data > and let a user space utility make fancy presentation. +1. Attributes should normally be simple, one-value things. > > > + 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, > > }; > > >