Received: by 10.223.185.116 with SMTP id b49csp6543399wrg; Wed, 28 Feb 2018 11:13:16 -0800 (PST) X-Google-Smtp-Source: AG47ELutVGrnQEH7ybLF5Jd/Hur2L2Dtbld1uffaXBa3gplxjnz3syJcIanECSRVtMooTi+EEqZH X-Received: by 2002:a17:902:4025:: with SMTP id b34-v6mr10911640pld.359.1519845196041; Wed, 28 Feb 2018 11:13:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519845195; cv=none; d=google.com; s=arc-20160816; b=TSXDfhW7syOp8Ree19N+/1WN1Fqv2tO0anoO5jBsra6c+6ZdSv98LCERo7MQ8z0aGO DIA5ZZxUPxj3nthwsS3Hw/b2M2STz+MG8qF1Y2ZaMpmxAqBla8gT+pt2Zm4xMlHukTDC VnohVyvQQWheXz5zJKtMXRxItAv1N0fsO24TMZ4eQyh0iGbXc8Q/qRsharKwn+4QEnDG Vtf6c7wnbd4+BILJlw++dYdvYtkKdtspRCjZ7kDoosXyVDJytzV1EWCCzzyROj2NccDT RDFUNxmbVlnqVQ/9gLL6h8Trpb5apc/O0kt6t6QgHI6Q5QTLaWA7tC5th//PTXI4gbWj w6QA== 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=ziBWuGMGWzvFgl6K2/WuI5Be+SidQ0qpxwfk0IaC4Co=; b=yllXXDZBOYbMSQExrzkGsdSu4uNJ9/rEtYlwdsrl3RpPbW+NiuzFe5biU5rhKjf1i/ bkMxbuALomuqbQ+L9LbNKndIQcA3KwiDTwYTLupT+ZeCrX097WpMEM74R0lWLmjClZC/ LIHvZH3NMlWy9Xtt5biYiJWoeJvMM9uHNewY12NWqjrx54q41tYiWK13bdh7b7wXsLky 9SLudIBYKoudrMpPtyJ4U6BOmskkHwtYkO7jX901c2yYdtLJbmbpCmkGeYj6ePjSOAIF xXePxnqIgN5zaGuDV/H0LlE+nptAm6wzorUWK4k/5HSRNt4ymb6JbYGcASAaFth4eIf1 rA4A== 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 q9si1338628pgc.623.2018.02.28.11.13.00; Wed, 28 Feb 2018 11:13:15 -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 S933233AbeB1TMR (ORCPT + 99 others); Wed, 28 Feb 2018 14:12:17 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:46354 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932367AbeB1TMQ (ORCPT ); Wed, 28 Feb 2018 14:12:16 -0500 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w1SJCFWB073983 for ; Wed, 28 Feb 2018 14:12:16 -0500 Received: from e17.ny.us.ibm.com (e17.ny.us.ibm.com [129.33.205.207]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ge06hx3de-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 28 Feb 2018 14:12:09 -0500 Received: from localhost by e17.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Feb 2018 14:11:45 -0500 Received: from b01cxnp23033.gho.pok.ibm.com (9.57.198.28) by e17.ny.us.ibm.com (146.89.104.204) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 28 Feb 2018 14:11:41 -0500 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w1SJBdQQ58261644; Wed, 28 Feb 2018 19:11:39 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0237AAE04E; Wed, 28 Feb 2018 14:13:03 -0500 (EST) Received: from oc8043147753.ibm.com (unknown [9.60.75.238]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP id DAC3CAE03C; Wed, 28 Feb 2018 14:13:01 -0500 (EST) Subject: Re: [PATCH v2 07/15] KVM: s390: Interfaces to configure/deconfigure guest's AP matrix To: Pierre Morel , 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: Tony Krowiak Date: Wed, 28 Feb 2018 14:11:38 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 18022819-0040-0000-0000-000003FF1AF9 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008603; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000254; SDB=6.00996434; UDB=6.00506572; IPR=6.00775756; MB=3.00019782; MTD=3.00000008; XFM=3.00000015; UTC=2018-02-28 19:11:43 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18022819-0041-0000-0000-000008001B13 Message-Id: <6e2fb969-4470-06e4-aab9-43969a75367b@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-02-28_11:,, 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-1802280233 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/28/2018 11:15 AM, Pierre Morel wrote: > 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? Right you are! I'll initialize the value based on what is returned from the QCI call. > > >> + 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 ditto > >> + 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 ditto > > > Pierre >