Received: by 10.192.165.148 with SMTP id m20csp2531473imm; Sun, 29 Apr 2018 00:54:07 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqLOm3CCh379eaxvUmI38YnOZHifo4ZED3CFXuB9jIv274BDWD5GoevqnJfR8Y4rjq+9e+t X-Received: by 2002:a63:7101:: with SMTP id m1-v6mr7053678pgc.45.1524988447681; Sun, 29 Apr 2018 00:54:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524988447; cv=none; d=google.com; s=arc-20160816; b=oI1cNN0VQG6dORoBrLQYBgf8+6TACmkjS7dsWBLcr8aD3cWCxZv1HQ/Vi3TpuV+ut8 Od6D3CEn3WhdIm82v6FpG23Jpv24rlhTCHEe96647ozJjNYTKZwXcm0TMZgsxqqelspR tx+M4iB5M6mnW14kmGaYrJbSca1nk2522dhGWHy6+C3Cjv1adAjSP9BIGZqy7Tjcs07x VtO+XPLxQNhgTxeZzQv9OG36diuN0Kyerk2v4TjVIsY7wyB68pokqBBio7LfAW6Dzf0s hUDQuje4vYmJlzgn65skD9ogW1lj8vScGrTsnuggBCeWGKR88hD2OV/9IJFAI8aBubSt oKVg== 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 :mime-version:references:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=4J8Uh+jwLB0dw62tuJIySjkpP9AEq94uRsq+Mc93JOo=; b=oOIAdJoZcmR2tHRRRhKKdBM85t6O4I9tdk3mwZZEWcUM7TC2Oj2CEowGnGfwY55bo4 d+50MLM2UjdhPWSfgTCz5BsK0gnCK27R4UlrdQYoNLj14y/z6BDuCRvZ7dqn/nYh8DfY TikTuEt8A0A7W/pMt2sAnvzAyLNyHhBk/oqfcCbiH0tGgfBFoXdIgOrOt/s2nFgr7jep 8+igPm8MzfncIXK2hgIymE1hHU46u2ZpTtqoegB5xri1yWKMZ4RsMeDEZ8ltBa3KlRdA cxbYaKwo9Cu2CCMgsfNrGbkUUvTxgIFwzSiEmRXtAxw4wetms+USJeIojRYbb7ncyzR7 3vKg== 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 b12-v6si4433565pge.252.2018.04.29.00.53.42; Sun, 29 Apr 2018 00:54:07 -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 S1752866AbeD2Hvh convert rfc822-to-8bit (ORCPT + 99 others); Sun, 29 Apr 2018 03:51:37 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:45716 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752220AbeD2Hvf (ORCPT ); Sun, 29 Apr 2018 03:51:35 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3T7nupf105439 for ; Sun, 29 Apr 2018 03:51:34 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hmmy4fm59-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 29 Apr 2018 03:51:34 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 29 Apr 2018 08:51:32 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sun, 29 Apr 2018 08:51:30 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3T7pUbK11534780; Sun, 29 Apr 2018 07:51:30 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D651B11C054; Sun, 29 Apr 2018 08:43:09 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E89C411C04C; Sun, 29 Apr 2018 08:43:08 +0100 (BST) Received: from mschwideX1 (unknown [9.145.12.62]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sun, 29 Apr 2018 08:43:08 +0100 (BST) Date: Sun, 29 Apr 2018 09:51:27 +0200 From: Martin Schwidefsky To: Christian Borntraeger Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, stable@vger.kernel.org, David Hildenbrand , Cornelia Huck , Radim =?UTF-8?B?S3LEjW3DocWZ?= Subject: Re: [PATCH 4.4 12/50] KVM: s390: wire up bpb feature In-Reply-To: References: <20180427135655.623669681@linuxfoundation.org> <20180427135656.428437126@linuxfoundation.org> <2764478b-8acb-653b-779f-1fb51d9a5931@de.ibm.com> <20180427151715.GA3876@kroah.com> <20180427154650.GA15121@kroah.com> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-TM-AS-GCONF: 00 x-cbid: 18042907-0040-0000-0000-00000453234E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18042907-0041-0000-0000-000020F73701 Message-Id: <20180429095127.59f76a1e@mschwideX1> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-04-29_04:,, 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=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804290078 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 27 Apr 2018 17:53:46 +0200 Christian Borntraeger wrote: > On 04/27/2018 05:46 PM, Greg Kroah-Hartman wrote: > > On Fri, Apr 27, 2018 at 05:17:15PM +0200, Greg Kroah-Hartman wrote: > >> On Fri, Apr 27, 2018 at 05:10:04PM +0200, Christian Borntraeger wrote: > >>> > >>> > >>> On 04/27/2018 03:58 PM, Greg Kroah-Hartman wrote: > >>>> 4.4-stable review patch. If anyone has any objections, please let me know. > >>>> > >>>> ------------------ > >>>> > >>>> From: Martin Schwidefsky > >>>> > >>>> > >>>> From: Christian Borntraeger > >> > >> Ick, that is wrong right there, my scripts messed up, this should not > >> have 2 author lines :( > >> > >> I'll go look at all of these, odds are it made the same error > >> everywhere... > > > > Yes, I've now fixed that up in the queue. > > As this patch backport was also functionally incorrect and Martin is already away > do you want me to send an updated version? Checked my 4.4 backport git branch and indeed the hunk is misplaced. Sometime I wonder about the patch tool and the hickups it can produce. My take on the replacement patch looks as follows: --- From 82f20b6237a8d04378c8f4a1614bf32a6c8d8a8b Mon Sep 17 00:00:00 2001 From: Christian Borntraeger Date: Wed, 17 Jan 2018 14:44:34 +0100 Subject: [PATCH 03/18] KVM: s390: wire up bpb feature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [ Upstream commit 35b3fde6203b932b2b1a5b53b3d8808abc9c4f60 ] The new firmware interfaces for branch prediction behaviour changes are transparently available for the guest. Nevertheless, there is new state attached that should be migrated and properly resetted. Provide a mechanism for handling reset, migration and VSIE. Signed-off-by: Christian Borntraeger Reviewed-by: David Hildenbrand Reviewed-by: Cornelia Huck [Changed capability number to 152. - Radim] Signed-off-by: Radim Krčmář Signed-off-by: Martin Schwidefsky --- arch/s390/include/asm/kvm_host.h | 3 ++- arch/s390/include/uapi/asm/kvm.h | 3 +++ arch/s390/kvm/kvm-s390.c | 12 ++++++++++++ include/uapi/linux/kvm.h | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h index e9a983f40a24..7d9c5917da2b 100644 --- a/arch/s390/include/asm/kvm_host.h +++ b/arch/s390/include/asm/kvm_host.h @@ -136,7 +136,8 @@ struct kvm_s390_sie_block { __u16 ipa; /* 0x0056 */ __u32 ipb; /* 0x0058 */ __u32 scaoh; /* 0x005c */ - __u8 reserved60; /* 0x0060 */ +#define FPF_BPBC 0x20 + __u8 fpf; /* 0x0060 */ __u8 ecb; /* 0x0061 */ __u8 ecb2; /* 0x0062 */ #define ECB3_AES 0x04 diff --git a/arch/s390/include/uapi/asm/kvm.h b/arch/s390/include/uapi/asm/kvm.h index ef1a5fcc6c66..3aec52253c04 100644 --- a/arch/s390/include/uapi/asm/kvm.h +++ b/arch/s390/include/uapi/asm/kvm.h @@ -151,6 +151,7 @@ struct kvm_guest_debug_arch { #define KVM_SYNC_ARCH0 (1UL << 4) #define KVM_SYNC_PFAULT (1UL << 5) #define KVM_SYNC_VRS (1UL << 6) +#define KVM_SYNC_BPBC (1UL << 10) /* definition of registers in kvm_run */ struct kvm_sync_regs { __u64 prefix; /* prefix register */ @@ -168,6 +169,8 @@ struct kvm_sync_regs { __u64 vrs[32][2]; /* vector registers */ __u8 reserved[512]; /* for future vector expansion */ __u32 fpc; /* only valid with vector registers */ + __u8 bpbc : 1; /* bp mode */ + __u8 reserved2 : 7; }; #define KVM_REG_S390_TODPR (KVM_REG_S390 | KVM_REG_SIZE_U32 | 0x1) diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 23e3f5d77a24..ca03c847127a 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -257,6 +257,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) case KVM_CAP_S390_VECTOR_REGISTERS: r = MACHINE_HAS_VX; break; + case KVM_CAP_S390_BPB: + r = test_facility(82); + break; default: r = 0; } @@ -1262,6 +1265,8 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) KVM_SYNC_CRS | KVM_SYNC_ARCH0 | KVM_SYNC_PFAULT; + if (test_kvm_facility(vcpu->kvm, 82)) + vcpu->run->kvm_valid_regs |= KVM_SYNC_BPBC; if (test_kvm_facility(vcpu->kvm, 129)) vcpu->run->kvm_valid_regs |= KVM_SYNC_VRS; @@ -1327,6 +1332,7 @@ static void kvm_s390_vcpu_initial_reset(struct kvm_vcpu *vcpu) current->thread.fpu.fpc = 0; vcpu->arch.sie_block->gbea = 1; vcpu->arch.sie_block->pp = 0; + vcpu->arch.sie_block->fpf &= ~FPF_BPBC; vcpu->arch.pfault_token = KVM_S390_PFAULT_TOKEN_INVALID; kvm_clear_async_pf_completion_queue(vcpu); if (!kvm_s390_user_cpu_state_ctrl(vcpu->kvm)) @@ -2145,6 +2151,11 @@ static void sync_regs(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) if (vcpu->arch.pfault_token == KVM_S390_PFAULT_TOKEN_INVALID) kvm_clear_async_pf_completion_queue(vcpu); } + if ((kvm_run->kvm_dirty_regs & KVM_SYNC_BPBC) && + test_kvm_facility(vcpu->kvm, 82)) { + vcpu->arch.sie_block->fpf &= ~FPF_BPBC; + vcpu->arch.sie_block->fpf |= kvm_run->s.regs.bpbc ? FPF_BPBC : 0; + } kvm_run->kvm_dirty_regs = 0; } @@ -2162,6 +2173,7 @@ static void store_regs(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) kvm_run->s.regs.pft = vcpu->arch.pfault_token; kvm_run->s.regs.pfs = vcpu->arch.pfault_select; kvm_run->s.regs.pfc = vcpu->arch.pfault_compare; + kvm_run->s.regs.bpbc = (vcpu->arch.sie_block->fpf & FPF_BPBC) == FPF_BPBC; } int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index 03f3618612aa..376d0ab5b9f2 100644 --- a/include/uapi/linux/kvm.h +++ b/include/uapi/linux/kvm.h @@ -831,6 +831,7 @@ struct kvm_ppc_smmu_info { #define KVM_CAP_GUEST_DEBUG_HW_WPS 120 #define KVM_CAP_SPLIT_IRQCHIP 121 #define KVM_CAP_IOEVENTFD_ANY_LENGTH 122 +#define KVM_CAP_S390_BPB 152 #ifdef KVM_CAP_IRQ_ROUTING -- 2.13.5