Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp216653imm; Wed, 22 Aug 2018 02:57:46 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyRXRc/SegEm+Dbq58A97MwfKDSamc9dMcpt1R+et3/hyhhi0xaFYmn+c6rCaAJAD1WwVED X-Received: by 2002:a63:5856:: with SMTP id i22-v6mr11408602pgm.232.1534931866617; Wed, 22 Aug 2018 02:57:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534931866; cv=none; d=google.com; s=arc-20160816; b=uOoBIVJxJdOqxH8bySDxruObOeXTkpD4CslvvUyWGFpYtivK163sdf4YhYss19D/Yw 0Vm+Ls8HQiKLLwVUZj6qTpsw18l5Jbv6zEsICAqrhfDC+KRXoTJxXaSvgs34eIvcRad1 UOc6Dhn7loeztzHSpt3daI6FcI1GrwZy9lF1Gj5YmIT68gWnw+bsC8CB8ev/VSyCKq28 813eIfpDYzSWWCCGkodNeQyn7qn/O8/FMKv+8eg33X1JAskoFnMdfKN2B+YB3cbXOrlU V77u+D4XKhUKCYCNuJxjjwxoVmc9FLxDSpeQ5kmB+rlNAVjXvz4HN5uM5/586ODohpDU s2kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=O3fUE0wg7kjT5H+9RWFdCIyzSO6Og3UdTQRJ6wol2XI=; b=FGvhFt1gTancustfv2MALUmy0YJarK9emKyhieImwSPi3vlccyg2/+ALQoOqa/SIXn kTQtlGug/J2gnlm7LsqHgdN7iZlcKJngFE6ecGsbK8XASV1ISytqoOz8+U9Anqg/2/1P Fp/Y0g8WhhAM/6afFZ58IQ9u4mniEuV54IZpSCq1bSs9xt/bPk9GNya2sZZ54YOeNcv6 kh3vRCf05YlpJdJZP0ufrtQ1ejLgjkal635AAmpB8/fGtSOI4O+kV2x5dUwr9mhpFNpc WkuRg+GgGo540o9cR96frmI+k7vnBbBkFbFQnufLQXzKrtlL7lVgCyajemv6MWd0Xam1 Ge6Q== 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 o23-v6si1270204pgv.518.2018.08.22.02.57.32; Wed, 22 Aug 2018 02:57:46 -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 S1728633AbeHVNRY (ORCPT + 99 others); Wed, 22 Aug 2018 09:17:24 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:51580 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728518AbeHVNRY (ORCPT ); Wed, 22 Aug 2018 09:17:24 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D44448076894; Wed, 22 Aug 2018 09:53:13 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-232.ams2.redhat.com [10.36.116.232]) by smtp.corp.redhat.com (Postfix) with ESMTP id BC1762026D74; Wed, 22 Aug 2018 09:53:10 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-s390@vger.kernel.org, Heiko Carstens , Martin Schwidefsky , Cornelia Huck , David Hildenbrand , Janosch Frank , Christian Borntraeger , Hendrik Brueckner Subject: [PATCH v1] KVM: s390: store DXC/VXC in fpc on DATA/Vector-processing exceptions Date: Wed, 22 Aug 2018 11:53:10 +0200 Message-Id: <20180822095310.29145-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 22 Aug 2018 09:53:13 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 22 Aug 2018 09:53:13 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.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 When DATA exceptions and vector-processing exceptions (program interrupts) are injected, the DXC/VXC is also to be stored in the fpc, if AFP is enabled in CR0. This can happen inside KVM when reinjecting an interrupt during program interrupt intercepts. These are triggered for example when debugging the guest (concurrent PER events result in an intercept instead of an injection of such interrupts). Signed-off-by: David Hildenbrand --- Only compile-tested. arch/s390/include/asm/ctl_reg.h | 1 + arch/s390/kvm/interrupt.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/arch/s390/include/asm/ctl_reg.h b/arch/s390/include/asm/ctl_reg.h index 4600453536c2..88f3f14baee9 100644 --- a/arch/s390/include/asm/ctl_reg.h +++ b/arch/s390/include/asm/ctl_reg.h @@ -11,6 +11,7 @@ #include #define CR0_CLOCK_COMPARATOR_SIGN _BITUL(63 - 10) +#define CR0_AFP_REGISTER_CONTROL _BITUL(63 - 45) #define CR0_EMERGENCY_SIGNAL_SUBMASK _BITUL(63 - 49) #define CR0_EXTERNAL_CALL_SUBMASK _BITUL(63 - 50) #define CR0_CLOCK_COMPARATOR_SUBMASK _BITUL(63 - 52) diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c index fcb55b02990e..5b5754d8f460 100644 --- a/arch/s390/kvm/interrupt.c +++ b/arch/s390/kvm/interrupt.c @@ -765,6 +765,14 @@ static int __must_check __deliver_prog(struct kvm_vcpu *vcpu) break; case PGM_VECTOR_PROCESSING: case PGM_DATA: + if (vcpu->arch.sie_block->gcr[0] & CR0_AFP_REGISTER_CONTROL) { + /* make sure the new fpc will be lazily loaded */ + save_fpu_regs(); + /* the DXC/VXC cannot make the fpc invalid */ + current->thread.fpu.fpc &= ~0xff00u; + current->thread.fpu.fpc |= (pgm_info.data_exc_code << 8) + & 0xff00u; + } rc = put_guest_lc(vcpu, pgm_info.data_exc_code, (u32 *)__LC_DATA_EXC_CODE); break; -- 2.17.1