Received: by 10.223.185.116 with SMTP id b49csp6628242wrg; Wed, 28 Feb 2018 12:38:55 -0800 (PST) X-Google-Smtp-Source: AH8x225HLFfJ6mMkFgz3IMsIyrpK0tKcUZnAs7QUH2apaHwISHKztyIA8rf7BRQ5BGXDI8rBiPxz X-Received: by 10.99.116.10 with SMTP id p10mr15296775pgc.97.1519850335836; Wed, 28 Feb 2018 12:38:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519850335; cv=none; d=google.com; s=arc-20160816; b=kMyZb4uXjGxqq2xTH6CNoxW+T6Q9NKY6hq75W8BFU6+/jK6z0DthT5xwxo3/ZLG+8R zhslg000VT6LLN3B9HumqNlhIx9QcsSih1SnAH8fcI+kiSReaaDuSIYnULkeBWtzNYuL yoFhhO3G11MinAA4REM8SaeK4w0AKTwEZodVqsqolggV+S5rAtsdoy7BQ/VX6dwzRRtV 4109NSUi1bkUwtkP/F7JE4gxAvqdURx2h6wrdL21o65yv6FmnCLCF3rawwj0H+TFopYY J43ZJM5O9XT1nBO1Y+nsXKnjFEubg5yi6J3tLo/pQKKxjDNXMjC7tY//BKJRXeaqK8uv pVbA== 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=FJT2KItG7qmB3usOPHfFPFU1lrr7gUT/mxwzKGHoZOA=; b=uMm0XnUhrroSFovQmiNbxG4wKDGwepQtrFowQduaBphTvMvtdkGSeBdJxba6WDsrj1 hlcXl8BfJAgAUa7TA5DAOw0DKd8UbyxZfYFyASDN8PCnVdFZqzBHxBMQC+4snxpR12GR xertZ7/bixgJt19NTBsK+SfuD4ZpLAVWaYg3EcZQdbAEGmwIVgfaB5eLFgSsoNBRwRKi dNVXOFWckvv+mjHQx9i2cFJFeKstbT95kEjvU19H6fVaUqKD5TUUhG2UUGvlWSH7ctaw s6ENCg6+hgiPJajPGJEvZxgEJKX1NjaAfgBPALICqcxXp+x9/acGl5cRvtgmZMlREbL7 4QCw== 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 o3-v6si1786014pld.591.2018.02.28.12.38.40; Wed, 28 Feb 2018 12:38:55 -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 S934702AbeB1Uh7 (ORCPT + 99 others); Wed, 28 Feb 2018 15:37:59 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:58458 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934642AbeB1Uh5 (ORCPT ); Wed, 28 Feb 2018 15:37:57 -0500 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w1SKY5cx146829 for ; Wed, 28 Feb 2018 15:37:57 -0500 Received: from e13.ny.us.ibm.com (e13.ny.us.ibm.com [129.33.205.203]) by mx0b-001b2d01.pphosted.com with ESMTP id 2ge29x3a2s-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 28 Feb 2018 15:37:56 -0500 Received: from localhost by e13.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Feb 2018 15:37:56 -0500 Received: from b01cxnp22035.gho.pok.ibm.com (9.57.198.25) by e13.ny.us.ibm.com (146.89.104.200) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 28 Feb 2018 15:37:51 -0500 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w1SKbokV49938460; Wed, 28 Feb 2018 20:37:50 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8A002AE03B; Wed, 28 Feb 2018 15:39:13 -0500 (EST) Received: from oc8043147753.ibm.com (unknown [9.60.75.238]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP id 6ACA1AE034; Wed, 28 Feb 2018 15:39:12 -0500 (EST) Subject: Re: [PATCH v2 08/15] KVM: s390: interface to enable AP execution mode To: David Hildenbrand , 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: Tony Krowiak Date: Wed, 28 Feb 2018 15:37:49 -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: 18022820-0008-0000-0000-000002DD2507 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.00996463; UDB=6.00506589; IPR=6.00775785; MB=3.00019783; MTD=3.00000008; XFM=3.00000015; UTC=2018-02-28 20:37:54 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18022820-0009-0000-0000-0000386ACC08 Message-Id: <47808b6f-9e6d-1f17-c26b-3e03d1f1e2ca@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-1802280250 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/28/2018 04:42 AM, David Hildenbrand wrote: > 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)) >> > What about VSIE? That is a good question. I'm beginning to think introducing AP on second level guests ought to be postponed for now. I'm going to look into this further. >