From patchwork Fri Jan 12 14:34:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10161151 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3B00660327 for ; Fri, 12 Jan 2018 14:36:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A246223C6 for ; Fri, 12 Jan 2018 14:36:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E7BE288F7; Fri, 12 Jan 2018 14:36:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C7055223C6 for ; Fri, 12 Jan 2018 14:36:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933948AbeALOgX (ORCPT ); Fri, 12 Jan 2018 09:36:23 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35438 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933810AbeALOgW (ORCPT ); Fri, 12 Jan 2018 09:36:22 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3DB9FA0B21; Fri, 12 Jan 2018 14:36:22 +0000 (UTC) Received: from t460s.redhat.com (unknown [10.36.118.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id A006A65620; Fri, 12 Jan 2018 14:36:06 +0000 (UTC) From: David Hildenbrand To: kvm@vger.kernel.org Cc: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Thomas Huth , Christian Borntraeger , Cornelia Huck , David Hildenbrand Subject: [PATCH kvm-unit-tests v2 09/11] s390x: enable DAT in PGM interrupt handler Date: Fri, 12 Jan 2018 15:34:15 +0100 Message-Id: <20180112143417.16743-10-david@redhat.com> In-Reply-To: <20180112143417.16743-1-david@redhat.com> References: <20180112143417.16743-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 12 Jan 2018 14:36:22 +0000 (UTC) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Configure it in setup_vm(). Signed-off-by: David Hildenbrand --- lib/s390x/asm/arch_def.h | 2 ++ lib/s390x/mmu.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h index f934120..ac3754e 100644 --- a/lib/s390x/asm/arch_def.h +++ b/lib/s390x/asm/arch_def.h @@ -15,6 +15,8 @@ struct psw { uint64_t addr; }; +#define PSW_MASK_DAT 0x0400000000000000UL + struct lowcore { uint8_t pad_0x0000[0x0080 - 0x0000]; /* 0x0000 */ uint32_t ext_int_param; /* 0x0080 */ diff --git a/lib/s390x/mmu.c b/lib/s390x/mmu.c index 9febb18..be0358f 100644 --- a/lib/s390x/mmu.c +++ b/lib/s390x/mmu.c @@ -47,6 +47,7 @@ void configure_dat(int enable) static void mmu_enable(pgd_t *pgtable) { + struct lowcore *lc = NULL; const uint64_t asce = __pa(pgtable) | ASCE_DT_REGION1 | REGION_TABLE_LENGTH; @@ -56,6 +57,9 @@ static void mmu_enable(pgd_t *pgtable) /* enable dat (primary == 0 set as default) */ configure_dat(1); + + /* we can now also use DAT unconditionally in our PGM handler */ + lc->pgm_new_psw.mask |= PSW_MASK_DAT; } static pteval_t *get_pte(pgd_t *pgtable, uintptr_t vaddr)