Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2400636imm; Mon, 24 Sep 2018 03:51:02 -0700 (PDT) X-Google-Smtp-Source: ACcGV60DYfhVngnHI4bL/ZEwHKfjLb9bDYFWnyPeRf9+UC/Snhj7eK04LZ6ZQEWo6rycJzWzizrB X-Received: by 2002:a63:8dc1:: with SMTP id z184-v6mr8883143pgd.328.1537786262268; Mon, 24 Sep 2018 03:51:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537786262; cv=none; d=google.com; s=arc-20160816; b=MSwNTPSNM/rLu0Y+DZXd0A3Xa4Qd2xW/GN2LSImQxfXKO74KgwRmRNubH7Wd+J6Y4l BHao49WjX1jDKjER5kQlW5eQxPLGw8q7oSE0VNgoSXct17kBltdZV3XAZkRcE52nDTFW IsQUoBo2tCfbXg1QByX1E7qzuJIJ7lC/7m/UQ3M7DDvA6eIlTJ5SOumWt2fdXnsEXo5k smZdKoVGtLqlw0NJ5Gg6r5k4Ts7jsEctXC91liN+LR68GO508vxRget+GFPDOQN674ud rEip+gq9fEGl+57XyNHEVQvVAbdiTVbKdSSzDGe89cW1lwwF6Fi7g4a6bo7TFHTHApnT VtUA== 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; bh=NGzanxUnk3+eEIbitt+/a0sR/3A5lz/1ZjEAPBfmMVA=; b=0huyOPGs9OCgGXL/3/E0+aF7bI8C1BsVFd9QvGWI3PVhuzy5JlR6jUufm2rxg/h8Wq UNzWR7HA/8o01M0ql474o71PvffRqIaAEBiL+yms9sEnlskVc5c4tZAq4k/qQjUrKOyw GuTQW+niXhROHOEGRlF3Z9wtIcQBOu7YmACJjF5HQs+fmLHTPoWFeGlgK5xpw0bTqthZ O4n55VTzhrLd88qVZsO0i94RYPZAyQnF81uFB6iVmKdKUePygE2pmp3bNIjq3Ot6L7Lw pGGX37CyVDTNnHXrUqGd5//u38Ar6sSWHeNcBH4miet09iQDg5O/alzpUCJiJCOeu3v5 xZig== 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 s25-v6si34791525pgd.539.2018.09.24.03.50.47; Mon, 24 Sep 2018 03:51:02 -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 S1728169AbeIXQrH (ORCPT + 99 others); Mon, 24 Sep 2018 12:47:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45394 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727816AbeIXQrH (ORCPT ); Mon, 24 Sep 2018 12:47:07 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 846393082E54; Mon, 24 Sep 2018 10:45:39 +0000 (UTC) Received: from gondolin (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id 61839104C529; Mon, 24 Sep 2018 10:45:32 +0000 (UTC) Date: Mon, 24 Sep 2018 12:45:30 +0200 From: Cornelia Huck To: Tony Krowiak Cc: 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, 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, frankja@linux.ibm.com, Tony Krowiak Subject: Re: [PATCH v10 07/26] s390: vfio-ap: sysfs interfaces to configure domains Message-ID: <20180924124530.0efe5f37.cohuck@redhat.com> In-Reply-To: <1536781396-13601-8-git-send-email-akrowiak@linux.vnet.ibm.com> References: <1536781396-13601-1-git-send-email-akrowiak@linux.vnet.ibm.com> <1536781396-13601-8-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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Mon, 24 Sep 2018 10:45:40 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 12 Sep 2018 15:42:57 -0400 Tony Krowiak wrote: > From: Tony Krowiak > > Introduces two new sysfs attributes for the VFIO mediated > matrix device for assigning AP domains to and unassigning > AP domains from a mediated matrix device. The IDs of the > AP domains assigned to the mediated matrix device will be > stored in an AP queue mask (AQM). > > The bits in the AQM, from most significant to least > significant bit, correspond to AP queue index (APQI) 0 to > 255 (note that an APQI is synonymous with with a domain ID). > On some systems, the maximum allowable domain number may be > less than 255 - depending upon the host's AP configuration - > and assignment may be rejected if the input domain ID exceeds > the limit. > > When a domain is assigned, the bit corresponding to the APQI > will be set in the AQM. Likewise, when a domain is unassigned, > the bit corresponding to the APQI will be cleared from the AQM. > > In order to successfully assign a domain, the APQNs derived from > the domain ID being assigned and the adapter numbers of all > adapters previously assigned: > > 1. Must be bound to the vfio_ap device driver. > > 2. Must not be assigned to any other mediated matrix device. > > If there are no adapters assigned to the mdev, then there must > be an AP queue bound to the vfio_ap device driver with an > APQN containing the domain ID (i.e., APQI), otherwise all > adapters subsequently assigned will fail because there will be no > AP queues bound with an APQN containing the APQI. > > Assigning or un-assigning an AP domain will also be rejected if > a guest using the mediated matrix device is running. > > The relevant sysfs structures are: > > /sys/devices/vfio_ap/matrix/ > ...... [mdev_supported_types] > ......... [vfio_ap-passthrough] > ............ [devices] > ...............[$uuid] > .................. assign_domain > .................. unassign_domain > > To assign a domain to the $uuid mediated matrix device, > write the domain's ID to the assign_domain file. To > unassign a domain, write the domain's ID to the > unassign_domain file. The ID is specified using > conventional semantics: If it begins with 0x, the number > will be parsed as a hexadecimal (case insensitive) number; > if it begins with 0, it will be parsed as an octal number; > otherwise, it will be parsed as a decimal number. > > For example, to assign domain 173 (0xad) to the mediated matrix > device $uuid: > > echo 173 > assign_domain > > or > > echo 0255 > assign_domain > > or > > echo 0xad > assign_domain > > To unassign domain 173 (0xad): > > echo 173 > unassign_domain > > or > > echo 0255 > unassign_domain > > or > > echo 0xad > unassign_domain > > Signed-off-by: Tony Krowiak > Reviewed-by: Halil Pasic > Tested-by: Michael Mueller > Tested-by: Farhan Ali > Tested-by: Pierre Morel > Signed-off-by: Christian Borntraeger > --- > drivers/s390/crypto/vfio_ap_ops.c | 138 ++++++++++++++++++++++++++++++++++++- > 1 files changed, 137 insertions(+), 1 deletions(-) Might have been good to add some documentation for the new attributes in the sysfs API directory, but as that one seems to be rather hit-and-miss anyway (and you provide a documentation file for the whole thing), Reviewed-by: Cornelia Huck