Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1819135imm; Thu, 23 Aug 2018 09:14:28 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdat+j8IFJIexgPwni7G9noP0wX01LKz/YWtW7UY0llzh55dJgh4yFrOGq52V1EtQjqY4aqO X-Received: by 2002:a65:508b:: with SMTP id r11-v6mr9579704pgp.271.1535040867973; Thu, 23 Aug 2018 09:14:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535040867; cv=none; d=google.com; s=arc-20160816; b=dQPxLyj2Y46nYR5Fru3Bqww0i8ceRNk81tb9gBPUgNTSew3fSuIvFUhFqoEvPqAEvO v1J5SOp7S8UtT99KJZCRAe2V+m9yTZ3eViZa/LGbSDm3T9w9K6l1RvfuAdbpguOBP0en ISygNyON3kTwE0OAPSbULbeaU8FcRzpkfYkZmG7lD72HUb3j1zLJ3pzoO/SjDpGfw49M y1UM8389KTGW9+Iut5iMkYfXamwF+g1UomzqzpPmwh+vY1+7ORahXXNlwUKgY1/jc0MH ioVI4oLtfvBKiEkdXx7DtG73vzXdq2JV5Zht7za62bf+sNcLe6uuN2DpoGXG9HEhClsu NCcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:in-reply-to:mime-version :user-agent:date:autocrypt:openpgp:from:references:cc:to:subject :arc-authentication-results; bh=nUAMwjqHrCjXGqymg+FMCRLbeb3BbpQMcB5hz/WV/tA=; b=igtiY3J7RfO7JZuCLfjd5Ba9PFGaqdIetlOnzgb/SbnXM3sLW3oQvLx+H74noGpZVV h3BqLBcB3loMJj+Fm6c51IlYqv+6G/SWrN5un+8XRpMv5MdjN9fktAC5Sik4BXlpbulB X/z27SwWZYqZpd0eV6hRBWrecGT2bjAt/kDTH6A3yOLbm7+KlKEzhWX9PTywzjP7h4Y+ FSas1SO0ZpNhpA0pUEkOubNztbGXicjhkT+DkNdQRqgINFORB6nphYF5Lsb47TFde9er TppCuHBZXiF5pU+iN9oZ5ZS7aB4Yl7TmnP7WS4m+2csE4Jpx+c/wnsVwS5uiHU6Igj6b xgXA== 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 q20-v6si4252229pll.10.2018.08.23.09.14.12; Thu, 23 Aug 2018 09:14:27 -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 S1730297AbeHWPED (ORCPT + 99 others); Thu, 23 Aug 2018 11:04:03 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:54354 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726246AbeHWPEC (ORCPT ); Thu, 23 Aug 2018 11:04:02 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w7NBYcQt042033 for ; Thu, 23 Aug 2018 07:34:44 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 2m1s1rfnsm-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 23 Aug 2018 07:34:41 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 23 Aug 2018 12:33:54 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 23 Aug 2018 12:33:52 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w7NBXp9342008694 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 23 Aug 2018 11:33:51 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4E5174C044; Thu, 23 Aug 2018 14:33:52 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EE56C4C058; Thu, 23 Aug 2018 14:33:51 +0100 (BST) Received: from [9.152.224.110] (unknown [9.152.224.110]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 23 Aug 2018 14:33:51 +0100 (BST) Subject: Re: [PATCH v3 3/3] KVM: s390: vsie: Make use of CRYCB FORMAT2 clear To: David Hildenbrand , Pierre Morel Cc: linux-kernel@vger.kernel.org, cohuck@redhat.com, linux-s390@vger.kernel.org, kvm@vger.kernel.org, akrowiak@linux.ibm.com, borntraeger@de.ibm.com, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com References: <1535019956-23539-1-git-send-email-pmorel@linux.ibm.com> <1535019956-23539-4-git-send-email-pmorel@linux.ibm.com> <912d013c-c925-fb3e-ed1d-2d778a60c189@linux.ibm.com> From: Janosch Frank Openpgp: preference=signencrypt Autocrypt: addr=frank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+0fWSX6cNr3Yp9GAEtKEfcUWnjttHgSQ2B B7J+WOIlmlhIhDFKBQrXT/sYxIu055o7YGxgO+cqJVrC5n2HoaCeTAVA6r1xKQARAQABwsFl BBgBAgAPBQJX6iFiAhsMBQkSzAMAAAoJEBcO/8Q8ZEV5R+oQAJgaEDxy1cpGmGva0s0Oxvia s5b4+otopF5pnlElTZcqWY1bx3vh2c5NZjCCubY1tb8548x6IprwAYtpmx3XlOXb12Jki/HT qHgeSscyleLbneNO+s8LfhJKY15smPqVKG6leCbtIpliZ0TI2Zif+gYvDZRruHYgHwi9bQzH +wEVDrgess/1dDq3Pt+W7NRhFoKKq7ZQOYkyHE1qdck/cGvq4/XCL9np7+3CBEql+QOtuR2o AdES5cnZwKm7peagQBEaFqgni26de11pW294pJRG0U36mSqxEoyqe97vKUYzsdy1hPPbOPfy 7img6Ifh6WL1b4FIIn9TFbooQ1WRSQvbOzxL+E2x+vmEPfNxpzAuuS+ASLJ6Zv9QCOUAvzBn Lfg7BvkfUhALMIZnAoyYmxutcWL4XYYAvMG13l8hFYpoQcF4WEnUoP0UuNwXmR4QZvOuiE8u CyL9U2LEYbrPVTIsEtUVmDlCyD1Kq+6LE3aU+n06soITGp9a3/WNLpXUbUYfzRvYJ3p6jssI Pe50r3yPfdgbWIWzeWuLimNVTlbIZAi1Y0VIdCDbDQpXl2DDTB9zZw2yz0kRKxasMCAEsvlA CT0NLoyQplUjM1ir5e6QTwy9+v3niCCesupe7owsFfrg/YZsE9jCy8vWgdPjSnRJkwQqV2Fw lFM6NIuMAY1Y Date: Thu, 23 Aug 2018 13:33:50 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="4MAqB4dxe1Spjn5UhYyX85elQCGUgA7aO" X-TM-AS-GCONF: 00 x-cbid: 18082311-0012-0000-0000-0000029DA751 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18082311-0013-0000-0000-000020D0EEF0 Message-Id: <58427761-072c-e420-a881-4decbe9088bb@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-08-23_05:,, 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=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808230125 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --4MAqB4dxe1Spjn5UhYyX85elQCGUgA7aO Content-Type: multipart/mixed; boundary="cIYfBJInpBEcmqcR3KweZUG3Yyzk7rYKp"; protected-headers="v1" From: Janosch Frank To: David Hildenbrand , Pierre Morel Cc: linux-kernel@vger.kernel.org, cohuck@redhat.com, linux-s390@vger.kernel.org, kvm@vger.kernel.org, akrowiak@linux.ibm.com, borntraeger@de.ibm.com, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com Message-ID: <58427761-072c-e420-a881-4decbe9088bb@linux.ibm.com> Subject: Re: [PATCH v3 3/3] KVM: s390: vsie: Make use of CRYCB FORMAT2 clear References: <1535019956-23539-1-git-send-email-pmorel@linux.ibm.com> <1535019956-23539-4-git-send-email-pmorel@linux.ibm.com> <912d013c-c925-fb3e-ed1d-2d778a60c189@linux.ibm.com> In-Reply-To: --cIYfBJInpBEcmqcR3KweZUG3Yyzk7rYKp Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 8/23/18 1:21 PM, David Hildenbrand wrote: > On 23.08.2018 13:05, Janosch Frank wrote: >> On 8/23/18 12:25 PM, Pierre Morel wrote: >>> The comment preceding the shadow_crycb function is >>> misleading, we effectively accept FORMAT2 CRYCB in the >>> guest. >> >> I beg to differ: >> >> if (!(crycbd_o & vcpu->arch.sie_block->crycbd & CRYCB_FORMAT1)) >> return 0; >=20 > FORMAT2 includes bit FORMAT1 (backwards compatible) Right, this check is very misleading because of the constant, we effectively test against Format 0 and Format 2. Can we make this clearer by explicitly ANDing 0x01 or adding a comment? Code makes sense: Reviewed-by: Janosch Frank >=20 >> >>> >>> When using FORMAT2 in the host we do not need to or with >>> FORMAT1. >>> >>> Signed-off-by: Pierre Morel >>> --- >>> arch/s390/kvm/vsie.c | 6 +++--- >>> 1 file changed, 3 insertions(+), 3 deletions(-) >>> >>> diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c >>> index 38ea5da..e0e6fbf 100644 >>> --- a/arch/s390/kvm/vsie.c >>> +++ b/arch/s390/kvm/vsie.c >>> @@ -140,7 +140,8 @@ static int prepare_cpuflags(struct kvm_vcpu *vcpu= , struct vsie_page *vsie_page) >>> * Create a shadow copy of the crycb block and setup key wrapping, i= f >>> * requested for guest 3 and enabled for guest 2. >>> * >>> - * We only accept format-1 (no AP in g2), but convert it into format= -2 >>> + * We accept format-1 or format-2, but we treat it as a format-1 (no= AP in g2), >>> + * and we convert it into format-2 in the shadow CRYCB. >>> * There is nothing to do for format-0. >>> * >>> * Returns: - 0 if shadowed or nothing to do >>> @@ -179,8 +180,7 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, st= ruct vsie_page *vsie_page) >>> return set_validity_icpt(scb_s, 0x0035U); >>> =20 >>> scb_s->ecb3 |=3D ecb3_flags; >>> - scb_s->crycbd =3D ((__u32)(__u64) &vsie_page->crycb) | CRYCB_FORMAT= 1 | >>> - CRYCB_FORMAT2; >>> + scb_s->crycbd =3D ((__u32)(__u64) &vsie_page->crycb) | CRYCB_FORMAT= 2; >> >> That's purely cosmetic but valid. >> >>> =20 >>> /* xor both blocks in one run */ >>> b1 =3D (unsigned long *) vsie_page->crycb.dea_wrapping_key_mask; >=20 > Reviewed-by: David Hildenbrand >=20 --cIYfBJInpBEcmqcR3KweZUG3Yyzk7rYKp-- --4MAqB4dxe1Spjn5UhYyX85elQCGUgA7aO Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJbfpueAAoJEBcO/8Q8ZEV5BKcP/0YYXNq7RmLfyLaoUDEub/Im ERPEfp/VhwLfRfk6VzYxtqlqoqWvQNccgymf1B0ZA6tNyy98Iu7gMU2TdN0mh0W+ XLCQmuoAvnZwvesxtCrYPmD3tbVCbexavTaV6IAxBqResQUNmIjdBTqrXqSqs6O1 7VYl9InnQd8+5zqxXbws0uYge+AaOh98qxPW6IgvjoVFFnMhQjNvz+XTBKSHkvcL uTAWGyeiA9Oy2EWDYg0E6iaymVL0NtOvboFgwhmWzWs/fpZ1rc3KktAvUjZpxs3C JHnXG87cO46Ux1NUDImb4Kw3AaPaM2LXGtk3292ohNTgH/1NPxQ5aQD4mfg2jhj3 5Mxe6c3GnVHPtObdvtPuLtKK/JWEIsMVhXCt1bRHD1dRj/WUaBlPY74+OvsVhLBD MKvSQtT3OQy+XszOQTDOq/aTCcUzu6mgWDQ/0mkEJp0OrOOz58v70atYB95Muq5K XrcQHiT5RdV8arnqgv5dI7yhaVPnREC2+WLvdWYhIDl8nUph3wlivS7UnQl+2R16 Sj3/eR3plYDu4NUFcXzLSStCksHdfxYD+dLYcSLiYbqo6vJ0JGGRkg3T10tIB5yB BxOvMlD1OOeeJSJt1KazFfgBkmqdfSINJJLre4I2Kah2Vcyq7t+uXFAZbgZBxLzE V0SGSkIcAuex9gH2RDVi =nXQz -----END PGP SIGNATURE----- --4MAqB4dxe1Spjn5UhYyX85elQCGUgA7aO--