Received: by 10.223.185.116 with SMTP id b49csp6379916wrg; Wed, 28 Feb 2018 08:27:41 -0800 (PST) X-Google-Smtp-Source: AG47ELuLzlmG0UU3Hud+7j6fbn6ByPGIO2p3PI5tBk3dw/c1J0ymU476QA9CXh//as+l9AxZJXZB X-Received: by 2002:a17:902:8a4:: with SMTP id 33-v6mr9555421pll.274.1519835260888; Wed, 28 Feb 2018 08:27:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519835260; cv=none; d=google.com; s=arc-20160816; b=WbrATAmJGqLWttzFIHySdn6TCk0EtSW8ys/QVj/oxzVNOFAlv0ApX8JxmPdEQ7uDEg 2x9eTzM5+kAWSnRyYJ6YJ7JyHb8Ewroj4XwVqXZrZAxOy//VDD8aLWKwLeY/x6JVcw5k OJSxhXS2Ndk7rKJs8gUkB08Pr8pFx1gCapCP6jnH4vJvk3/YIIDjhn6gge+bcJbHoAaZ DqwIQT4j7IXlLhXFxmNZAiS0xtqCxfU2B5PYGovksZoNbamta/c2w8KcbSef3Ng8OphA /eSl0Ol0uUQpcgFvljuTLm26ZaWK9ZwrEY55NBiq74AL0REoOuDrOK2bFPHCUgzQ+q/4 Y8Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :from:references:cc:to:subject:arc-authentication-results; bh=LAZ0KrCBefeXQSSiJAy1dLzMXYTrSlBL0C2ODqxWUFI=; b=xX8Lj04EWVYmO3I7eWg/gizsdUPbb7JO10lf4van718axnpjL8St8tpXhG431bIftz t/n+eH/bwRU9cR+iOPTGR6AVeWC1PZh2v1SosXxXCgNnwgN5Lm1Kw0UhB1Okh1QBg6qo DN0TcrfHtHSUtaICO1jJqFQxAs8nmB2z9WfAieUKO5Uqwz38SlzOM44gaRBUFHTwQ09M 9Z6tPTp/dKBwkpq/eWDqAa/i8EKLOt1jv1d/RiPsUk5ssjb7jNa/OWptv0uS7j2075X4 LTJ1FvocwXiOYpjAeEhO2ki2pYuPhhyN7Bu1DcZ51xtWZPLrTuKC4MHt8RM3+vf3s61R DsuA== 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 y6si1189888pgo.735.2018.02.28.08.27.25; Wed, 28 Feb 2018 08:27:40 -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 S934911AbeB1QP7 (ORCPT + 99 others); Wed, 28 Feb 2018 11:15:59 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:35196 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933001AbeB1QPy (ORCPT ); Wed, 28 Feb 2018 11:15:54 -0500 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 w1SGBP4v028367 for ; Wed, 28 Feb 2018 11:15:53 -0500 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gdx7ed5ks-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 28 Feb 2018 11:15:53 -0500 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Feb 2018 16:15:49 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 28 Feb 2018 16:15:47 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w1SGFk0F64749660; Wed, 28 Feb 2018 16:15:46 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A167A4C050; Wed, 28 Feb 2018 16:09:15 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0F6C34C040; Wed, 28 Feb 2018 16:09:15 +0000 (GMT) Received: from [9.152.224.97] (unknown [9.152.224.97]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 28 Feb 2018 16:09:14 +0000 (GMT) Subject: Re: [PATCH v2 07/15] KVM: s390: Interfaces to configure/deconfigure guest's AP matrix To: Tony Krowiak , 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, 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 References: <1519741693-17440-1-git-send-email-akrowiak@linux.vnet.ibm.com> <1519741693-17440-8-git-send-email-akrowiak@linux.vnet.ibm.com> From: Pierre Morel Date: Wed, 28 Feb 2018 17:15:45 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1519741693-17440-8-git-send-email-akrowiak@linux.vnet.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 18022816-0040-0000-0000-000004190EE6 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18022816-0041-0000-0000-0000261C0F83 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-02-28_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-1802280196 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27/02/2018 15:28, Tony Krowiak wrote: > Provides interfaces to assign AP adapters, usage domains > and control domains to a KVM guest. > > A KVM guest is started by executing the Start Interpretive Execution (SIE) > instruction. The SIE state description is a control block that contains the > state information for a KVM guest and is supplied as input to the SIE > instruction. The SIE state description has a satellite structure called the > Crypto Control Block (CRYCB). The CRYCB contains three bitmask fields > identifying the adapters, queues (domains) and control domains assigned to > the KVM guest: > > * The AP Adapter Mask (APM) field identifies the AP adapters assigned to > the KVM guest > > * The AP Queue Mask (AQM) field identifies the AP queues assigned to > the KVM guest. Each AP queue is connected to a usage domain within > an AP adapter. > > * The AP Domain Mask (ADM) field identifies the control domains > assigned to the KVM guest. > > Each adapter, queue (usage domain) and control domain are identified by > a number from 0 to 255. The bits in each mask, from most significant to > least significant bit, correspond to the numbers 0-255. When a bit is > set, the corresponding adapter, queue (usage domain) or control domain > is assigned to the KVM guest. ...snip... > static int kvm_ap_apxa_installed(void) > { > int ret; > @@ -50,3 +170,140 @@ void kvm_ap_set_crycb_format(struct kvm *kvm, __u32 *crycbd) > *crycbd |= CRYCB_FORMAT1; > } > } > + > +static int kvm_ap_matrix_apm_create(struct kvm_ap_matrix *ap_matrix, int apxa) > +{ > + if (apxa) > + ap_matrix->apm_max = 256; AFAIK the number of possible bits in the masks for a system is not a generic value but is returned by the QCI instruction. Is there a reason to use a fix value? > + else > + ap_matrix->apm_max = 64; > + > + ap_matrix->apm = kzalloc(KVM_AP_MASK_BYTES(ap_matrix->apm_max), > + GFP_KERNEL); > + if (!ap_matrix->apm) > + return -ENOMEM; > + > + return 0; > +} > + > +static int kvm_ap_matrix_aqm_create(struct kvm_ap_matrix *ap_matrix, int apxa) > +{ > + if (apxa) > + ap_matrix->aqm_max = 256; same here > + else > + ap_matrix->aqm_max = 16; > + > + ap_matrix->aqm = kzalloc(KVM_AP_MASK_BYTES(ap_matrix->aqm_max), > + GFP_KERNEL); > + if (!ap_matrix->aqm) > + return -ENOMEM; > + > + return 0; > +} > + > +static int kvm_ap_matrix_adm_create(struct kvm_ap_matrix *ap_matrix, int apxa) > +{ > + if (apxa) > + ap_matrix->adm_max = 256; and here Pierre -- Pierre Morel Linux/KVM/QEMU in Böblingen - Germany