Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1204009imm; Wed, 11 Jul 2018 20:04:44 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeUj2jU9+aZtQoC88n9KkKL/aqq5FDA4MQ8bqYypOqE4f4gEF0nRF4+FJxTsLXy7kiFUgni X-Received: by 2002:a17:902:a9ca:: with SMTP id b10-v6mr439328plr.275.1531364684652; Wed, 11 Jul 2018 20:04:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531364684; cv=none; d=google.com; s=arc-20160816; b=Pqu3t0uggIEpLcJK38vahPHpWPf/Bg8WNs/x8BNvGxP4b/4k6k6D8UkTjin3siudyC puJ7TrkAjsgW0NtmNhZu2zKXM/zX/mqvB9G9UejsEfE57wLuHBOGn/Pm1Z0gk0j0/VFZ WIn5ttW5MUvaD9wB3VYnZntzbRPbEPc9LudMmMv/J/F/mVWVixu6bg+259svp4KzYOXP 0WpARuysbzuI4/0j4tvkCPjVa4rKCpVByAdziCHkMVMRKfe7R1ublKNmQlr4FNnTunFx ydE+vhuMwom6Va5yA3yF4nSwEyj2kHEqOUAFh+wNuxZpGBHWR6T936QGcwcznHsSbg6J OsNg== 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-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date:from :references:cc:to:subject:arc-authentication-results; bh=RF5haPBQ8aDsrqfkFOdrW2uWZh3j5wbWTaf4h1wChEg=; b=NiuYtUmUVbXfaBIDFTIu+ne3okvJE/WsBdIu2anUAeiIDLBMMl2K+0VQo7wXAAgyoX tKxQUA5O/E9A1wsk6QYG4tEtHjhuQUrkXBTn9oYfycpPumriQwOD7F4lNK2MEZnfQwOV P/+ebD5FyS5lb1FTHHD7aqUtCn0m7xT7BS3z1BA0OK8kyCnHm/721dxUzk3366BgiBjV AMUD7y+ZEjCyFOeK9GsFNyDRSTpBGmkZ9eyStaEccBsRCP6xVWxsg47sBDe7fwcGrZYv 5LKIsvKR+ufHyV6lOE85KHCx08NSJMwa2gmkGOoPN0QDW4WWvP2E9PNVhFe0/Qkglm4Q CZDw== 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 s9-v6si20092725plp.182.2018.07.11.20.04.29; Wed, 11 Jul 2018 20:04:44 -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 S2390810AbeGKX3p (ORCPT + 99 others); Wed, 11 Jul 2018 19:29:45 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:41290 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388171AbeGKX3o (ORCPT ); Wed, 11 Jul 2018 19:29:44 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w6BNE0E6049761 for ; Wed, 11 Jul 2018 19:23:06 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2k5s8w4fad-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 11 Jul 2018 19:23:05 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 12 Jul 2018 00:23:03 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 12 Jul 2018 00:23:00 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w6BNMxZp13893730 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 11 Jul 2018 23:22:59 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B5A3F11C04A; Thu, 12 Jul 2018 02:23:20 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6D82811C04C; Thu, 12 Jul 2018 02:23:19 +0100 (BST) Received: from oc0155643701.ibm.com (unknown [9.145.191.79]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 Jul 2018 02:23:19 +0100 (BST) Subject: Re: [PATCH v6 15/21] s390: vfio-ap: configure the 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, 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, Tony Krowiak References: <1530306683-7270-1-git-send-email-akrowiak@linux.vnet.ibm.com> <1530306683-7270-16-git-send-email-akrowiak@linux.vnet.ibm.com> From: Halil Pasic Date: Thu, 12 Jul 2018 01:22:57 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <1530306683-7270-16-git-send-email-akrowiak@linux.vnet.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 18071123-0020-0000-0000-000002A587FF X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18071123-0021-0000-0000-000020F1D0D7 Message-Id: <74beb5b9-1a49-ca42-4ffe-3bf042718ed0@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-07-11_06:,, 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 mlxscore=0 impostorscore=0 mlxlogscore=974 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807110243 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/29/2018 11:11 PM, Tony Krowiak wrote: > From: Tony Krowiak > > Configures the AP adapters, usage domains and control domains for the > KVM guest from the matrix configured via the mediated matrix device's > sysfs attribute files. > [..] > + > +static void kvm_ap_set_crycb_masks(struct ap_matrix_mdev *matrix_mdev) > +{ > + int nbytes; > + unsigned long *apm, *aqm, *adm; > + > + kvm_ap_clear_crycb_masks(matrix_mdev); > + > + apm = kvm_ap_get_crycb_apm(matrix_mdev); > + aqm = kvm_ap_get_crycb_aqm(matrix_mdev); > + adm = kvm_ap_get_crycb_adm(matrix_mdev); > + > + nbytes = KVM_AP_MASK_BYTES(matrix_mdev->matrix.apm_max + 1); > + memcpy(apm, matrix_mdev->matrix.apm, nbytes); > + > + nbytes = KVM_AP_MASK_BYTES(matrix_mdev->matrix.aqm_max + 1); > + memcpy(aqm, matrix_mdev->matrix.aqm, nbytes); > + > + /* > + * Merge the AQM and ADM since the ADM is a superset of the > + * AQM by agreed-upon convention. > + */ > + bitmap_or(adm, matrix_mdev->matrix.adm, matrix_mdev->matrix.aqm, > + matrix_mdev->matrix.adm_max + 1); Are you sure this or works as expected? E.g. if adm_max == 15 the bitmaps include the least significant 2 bytes but you want the other two. > +}