Received: by 10.223.185.116 with SMTP id b49csp5977896wrg; Wed, 28 Feb 2018 01:45:47 -0800 (PST) X-Google-Smtp-Source: AG47ELsopSKuXykWmYZZES8jqov729frBJ4pQjlOTGASxYh7FkACO8wqZlzfLJFhhVtOmKndVu05 X-Received: by 2002:a17:902:a511:: with SMTP id s17-v6mr2034974plq.206.1519811147281; Wed, 28 Feb 2018 01:45:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519811147; cv=none; d=google.com; s=arc-20160816; b=WUiZNEychKOxRZ4PGnOSI6f4iSYuMARrJnuQwtGU7JXr0H9payBwm9OLrzLyY+lvGq z469VbHSYtozelF0VN2npbUNVlhp5Y4g2aHBoYvOjsnF/G1B/EbRw/nqGijQ/NNh8rBC xkGEsplHILgF40y2t16ZdvvJGZ1JKpl6EQAk+BRkrDfJyyxkUDu/Y6qZFO20wg8Yrjno kcoKNV5NLehCWvoeIly9EkjVbh/iWdYbSGoLfLbwOtqkHkJQNZe0SjUWEi3UGtFIZCBd BmERioi6d5YEi0QyCo6MD+jAmsGcPHc1po71M8OQjosJm7qprNaz4gzjCqNiUKQg+MW8 UsHA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :arc-authentication-results; bh=V28PRKgAnGUY9IjJRaFInHlkRU7btr3ZBcSzlFWHx+o=; b=XZKOeFeykC5jr1fbspWBzy4M1QYeYlEb+ePVuRX+DsZa1+UJ8YFDN2HccJxIcmImK5 KKq+paX9GHTTkQJcs6jE3WkV/4znGy5yhn1SqoYMNBwn2CNz0viCBtqHdCvFjaC8fYfA 4ScxsQdzpL1wdKmlXl3Km1ArFh0SluNt621lfT5qvpI4YiQmnGgam+zSlXA1n/FiV7cl cesdvFOAgj3DwZYGaSaXt87yLUNg/UfvjROR7F5Dz/O9UI8D4ptu5gaBmLsnYi4LNnAR 2J6UPCecnzSIQSOJkUQ+3tY2qk539z6vb7Bw3vwZbT7JjcaoIOTFLW/5DAG9ZN2DnPEr ZrlQ== 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 i22-v6si1052697pll.175.2018.02.28.01.45.30; Wed, 28 Feb 2018 01:45:47 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752428AbeB1Joi (ORCPT + 99 others); Wed, 28 Feb 2018 04:44:38 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:59398 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751126AbeB1Jog (ORCPT ); Wed, 28 Feb 2018 04:44:36 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BB29A404085A; Wed, 28 Feb 2018 09:44:35 +0000 (UTC) Received: from [10.36.118.20] (unknown [10.36.118.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9752A112C243; Wed, 28 Feb 2018 09:44:30 +0000 (UTC) Subject: Re: [PATCH v2 08/15] KVM: s390: interface to enable AP execution mode 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, fiuczy@linux.vnet.ibm.com, buendgen@de.ibm.com References: <1519741693-17440-1-git-send-email-akrowiak@linux.vnet.ibm.com> <1519741693-17440-9-git-send-email-akrowiak@linux.vnet.ibm.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <532c0f98-83d0-c687-55d6-a6c5cb263360@redhat.com> Date: Wed, 28 Feb 2018 10:44:29 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <1519741693-17440-9-git-send-email-akrowiak@linux.vnet.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 28 Feb 2018 09:44:35 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 28 Feb 2018 09:44:35 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'david@redhat.com' RCPT:'' 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: > Introduces a new interface to enable AP interpretive > execution (IE) mode for the KVM guest. When running > with IE mode enabled, AP instructions executed on the > KVM guest will be interpreted by the firmware and > passed directly through to an AP device installed on > the system. The CPU model feature for AP must > be enabled for the KVM guest in order to enable > interpretive execution mode. > > This interface will be used in a subsequent patch > by the VFIO AP device driver. > > Signed-off-by: Tony Krowiak > --- > arch/s390/include/asm/kvm-ap.h | 2 ++ > arch/s390/include/asm/kvm_host.h | 1 + > arch/s390/kvm/kvm-ap.c | 27 +++++++++++++++++++++++++++ > arch/s390/kvm/kvm-s390.h | 1 + > 4 files changed, 31 insertions(+), 0 deletions(-) > > diff --git a/arch/s390/include/asm/kvm-ap.h b/arch/s390/include/asm/kvm-ap.h > index 46e7c5b..6bd6bfb 100644 > --- a/arch/s390/include/asm/kvm-ap.h > +++ b/arch/s390/include/asm/kvm-ap.h > @@ -51,4 +51,6 @@ struct kvm_ap_matrix { > > void kvm_ap_deconfigure_matrix(struct kvm *kvm); > > +int kvm_ap_enable_ie_mode(struct kvm *kvm); > + > #endif /* _ASM_KVM_AP */ > diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h > index a4c77d3..1eebdd6 100644 > --- a/arch/s390/include/asm/kvm_host.h > +++ b/arch/s390/include/asm/kvm_host.h > @@ -186,6 +186,7 @@ struct kvm_s390_sie_block { > #define ECA_AIV 0x00200000 > #define ECA_VX 0x00020000 > #define ECA_PROTEXCI 0x00002000 > +#define ECA_APIE 0x00000008 > #define ECA_SII 0x00000001 > __u32 eca; /* 0x004c */ > #define ICPT_INST 0x04 > diff --git a/arch/s390/kvm/kvm-ap.c b/arch/s390/kvm/kvm-ap.c > index bb29045..862e54b 100644 > --- a/arch/s390/kvm/kvm-ap.c > +++ b/arch/s390/kvm/kvm-ap.c > @@ -307,3 +307,30 @@ void kvm_ap_deconfigure_matrix(struct kvm *kvm) > kvm_ap_clear_crycb_masks(kvm); > } > EXPORT_SYMBOL(kvm_ap_deconfigure_matrix); > + > +/** > + * kvm_ap_enable_ie_mode > + * > + * Enable interpretrive execution of AP instructions for the guest. When > + * enabled, AP instructions executed on the guest will be interpreted and > + * passed through to an AP installed on the host system. > + * > + * Returns 0 if interpretrive execution is enabled. Returns -EOPNOTSUPP > + * if AP facilities are not installed for the guest. > + * > + * @kvm: the guest's kvm structure > + */ > +int kvm_ap_enable_ie_mode(struct kvm *kvm) > +{ > + int i; > + struct kvm_vcpu *vcpu; > + > + if (!test_kvm_cpu_feat(kvm, KVM_S390_VM_CPU_FEAT_AP)) > + return -EOPNOTSUPP; > + > + kvm_for_each_vcpu(i, vcpu, kvm) > + vcpu->arch.sie_block->eca |= ECA_APIE; > + > + return 0; > +} > +EXPORT_SYMBOL(kvm_ap_enable_ie_mode); > diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h > index 1b5621f..3142541 100644 > --- a/arch/s390/kvm/kvm-s390.h > +++ b/arch/s390/kvm/kvm-s390.h > @@ -18,6 +18,7 @@ > #include > #include > #include > +#include > > /* Transactional Memory Execution related macros */ > #define IS_TE_ENABLED(vcpu) ((vcpu->arch.sie_block->ecb & ECB_TE)) > And also, what about hot-plugged CPUs? -- Thanks, David / dhildenb