From patchwork Thu Nov 30 16:27:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 843089 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ynjl66K4tz9s83 for ; Fri, 1 Dec 2017 03:38:26 +1100 (AEDT) Received: from localhost ([::1]:49188 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRqy-0004FY-Tw for incoming@patchwork.ozlabs.org; Thu, 30 Nov 2017 11:38:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33972) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKRhJ-0005EG-DQ for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:28:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKRhI-0003Cu-Gs for qemu-devel@nongnu.org; Thu, 30 Nov 2017 11:28:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48040) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eKRhI-0003CY-Am; Thu, 30 Nov 2017 11:28:24 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7239A6A7DD; Thu, 30 Nov 2017 16:28:23 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-82.ams2.redhat.com [10.36.116.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id CF0C6620B6; Thu, 30 Nov 2017 16:28:19 +0000 (UTC) From: David Hildenbrand To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Date: Thu, 30 Nov 2017 17:27:36 +0100 Message-Id: <20171130162744.25442-9-david@redhat.com> In-Reply-To: <20171130162744.25442-1-david@redhat.com> References: <20171130162744.25442-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 30 Nov 2017 16:28:23 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 for-2.12 08/16] s390x/tcg: don't exit the cpu loop in s390_cpu_virt_mem_rw() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Cornelia Huck , Alexander Graf , Christian Borntraeger , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" s390_cpu_virt_mem_rw() must always return, so callers can react on an exception (e.g. see ioinst_handle_stcrw()). Therefore, using program_interrupt() is wrong. Fix that up. Signed-off-by: David Hildenbrand --- target/s390x/mmu_helper.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c index dbe2f511f8..f477cc006a 100644 --- a/target/s390x/mmu_helper.c +++ b/target/s390x/mmu_helper.c @@ -64,7 +64,9 @@ static void trigger_access_exception(CPUS390XState *env, uint32_t type, kvm_s390_access_exception(cpu, type, tec); } else { CPUState *cs = CPU(cpu); - stq_phys(cs->as, env->psa + offsetof(LowCore, trans_exc_code), tec); + if (type != PGM_ADDRESSING) { + stq_phys(cs->as, env->psa + offsetof(LowCore, trans_exc_code), tec); + } trigger_pgm_exception(env, type, ilen); } } @@ -443,7 +445,8 @@ int mmu_translate(CPUS390XState *env, target_ulong vaddr, int rw, uint64_t asc, /** * translate_pages: Translate a set of consecutive logical page addresses - * to absolute addresses + * to absolute addresses. This function is used for TCG and old KVM without + * the MEMOP interface. */ static int translate_pages(S390CPU *cpu, vaddr addr, int nr_pages, target_ulong *pages, bool is_write) @@ -459,7 +462,7 @@ static int translate_pages(S390CPU *cpu, vaddr addr, int nr_pages, } if (!address_space_access_valid(&address_space_memory, pages[i], TARGET_PAGE_SIZE, is_write)) { - program_interrupt(env, PGM_ADDRESSING, ILEN_AUTO); + trigger_access_exception(env, PGM_ADDRESSING, ILEN_AUTO, 0); return -EFAULT; } addr += TARGET_PAGE_SIZE;