Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1930147imm; Wed, 16 May 2018 05:23:03 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpsUGhFny7XSJK9uDgWYy0wrpZ86r/zCIXDiuUbbzvn3WlXAfGv4QYRPtTm8K//Y4CCZjLu X-Received: by 2002:a63:9c01:: with SMTP id f1-v6mr578774pge.223.1526473383047; Wed, 16 May 2018 05:23:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526473382; cv=none; d=google.com; s=arc-20160816; b=Zc+q4++cHKKvzpCZDpLfM2NsZcT2S8jMAvrVr+MdGqmyIigjfwcj8T0VtXso2dV3Rg n4aoNkzJxQJCbILz7/6/AGLiLS/nCdBnazGfJtRkSJ/qyuLmWx6Uny7fexz4u/+CGbkW b3x6taTuBL/8BJEV5DEvUvMeaBR6UL9jqYqgh+Q/ma/BEvTtyxr31LJVPjddQ4r23Qps aiRPXft2WVVWvXxWp3iakNa1uyOTG2A3hiBF1IG1OJx5bG/kGTWK9/ALcosLmM4aiKNe 8eSG3fT4KFNOQIuPJikrZAPRJqQqto5GH+cc6EM57VKpS5hdOKKxJL4aDP2wqOqTK0P/ ifsA== 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:arc-authentication-results; bh=N4ln3tm4bc5/wmK4DrG2xwl2XIR5agz2CO0Ek1BhVmk=; b=MnYAjRuiO9/kc8/sxu9D23inkRXMBd2qNCq7RQ5l9O6+i81/pCwW1Z7oRRzAK3/kjU 9yKwyi4B87MFI5ZbGn0iHoQBQc7o59XurY0YFKYW8ESVHDdxqSi4rV8YNBRFSYjYU2Kl YV9qN0ICj1Q6uAFxj9vUetgpTtGphaGf3Z1+uhTK6fWHhtrewVcLdcplVdXKj7kd/t4g hsUDiKa1EZUUNhgA8N3yYMj9kDsXXXa8tsEpR1ds5jDXEs6SCKmULYl0gcKVfKFeryNh FkWudqLnP7S5dMfdR919qQ7HZyELfBK3dcvU8a95xo3Rw0GsWfBdzNIfHShvd+uO/1y8 fCXg== 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 w3-v6si2022431pge.89.2018.05.16.05.22.48; Wed, 16 May 2018 05:23: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 S1752485AbeEPMVV convert rfc822-to-8bit (ORCPT + 99 others); Wed, 16 May 2018 08:21:21 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:52108 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751151AbeEPMVU (ORCPT ); Wed, 16 May 2018 08:21:20 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 944074201AF0; Wed, 16 May 2018 12:21:19 +0000 (UTC) Received: from gondolin (ovpn-117-216.ams2.redhat.com [10.36.117.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id 13ED22166BAD; Wed, 16 May 2018 12:21:15 +0000 (UTC) Date: Wed, 16 May 2018 14:21:13 +0200 From: Cornelia Huck To: Pierre Morel Cc: Tony Krowiak , 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 Subject: Re: [PATCH v5 02/13] KVM: s390: refactor crypto initialization Message-ID: <20180516142113.3d23d356.cohuck@redhat.com> In-Reply-To: <40b5c7d2-a855-f11b-3dbd-afdc8fae268d@linux.ibm.com> References: <1525705912-12815-1-git-send-email-akrowiak@linux.vnet.ibm.com> <1525705912-12815-3-git-send-email-akrowiak@linux.vnet.ibm.com> <67656726-4d9b-44e1-1e2b-ab11de83f513@linux.ibm.com> <6835f3b9-c660-fe7c-5583-8706cc1fa732@linux.vnet.ibm.com> <40b5c7d2-a855-f11b-3dbd-afdc8fae268d@linux.ibm.com> Organization: Red Hat GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 16 May 2018 12:21:19 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 16 May 2018 12:21:19 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'cohuck@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 16 May 2018 14:17:52 +0200 Pierre Morel wrote: > On 16/05/2018 13:14, Tony Krowiak wrote: > > On 05/16/2018 04:51 AM, Pierre Morel wrote: > >> On 07/05/2018 17:11, Tony Krowiak wrote: > >>> @@ -1896,19 +1917,17 @@ static u64 kvm_s390_get_initial_cpuid(void) > >>> > >>>   static void kvm_s390_crypto_init(struct kvm *kvm) > >>>   { > >>> -    if (!test_kvm_facility(kvm, 76)) > >>> +    /* > >>> +     * If neither the AP instructions nor the message security assist > >>> +     * extension 3 (MSAX3) are installed, there is no need to > >>> initialize a > >>> +     * crypto control block (CRYCB) for the guest. > >>> +     */ > >>> +    if (!kvm_ap_instructions_available() && !test_kvm_facility(kvm, > >>> 76)) > >>>           return; > >>> > >>>       kvm->arch.crypto.crycb = &kvm->arch.sie_page2->crycb; > >>> -    kvm_s390_set_crycb_format(kvm); > >> > >> > >> For my point of view the all patch can be reduced to putting this > >> call (kvm_s390_set_crycb_format(kvm);) before testing for facility 76. > >> > >> (and setting the format correctly in kvm_s390_set_crycb_format(kvm)) > > > > I don't see what that buys us; it will just be reshuffling of the logic. > > The idea here is that all of the code related to formatting the CRYCB for > > use by the guest is contained in the kvm_s390_format_crycb(kvm) function. > > We don't need a CRYCB, however, if the AP instructions are not installed > > and the MSAX3 facility is not installed, so why even call > > kvm_s390_format_crycb(kvm) in that case? > > It byes a lot of lines. > I mean that you do exactly the same by only using 3 lines inserted > instead of 65 changes. > No logic change. Sounds like a winner from my POV :)