From nobody Wed Feb 11 03:02:29 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1494632632380717.7112740612866; Fri, 12 May 2017 16:43:52 -0700 (PDT) Received: from localhost ([::1]:55698 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d9KDu-0004FH-UB for importer@patchew.org; Fri, 12 May 2017 19:43:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45576) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d9KAV-0001Bv-O6 for qemu-devel@nongnu.org; Fri, 12 May 2017 19:40:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d9KAU-0003zV-Qf for qemu-devel@nongnu.org; Fri, 12 May 2017 19:40:19 -0400 Received: from mail-qk0-x243.google.com ([2607:f8b0:400d:c09::243]:34180) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d9KAU-0003zC-N7 for qemu-devel@nongnu.org; Fri, 12 May 2017 19:40:18 -0400 Received: by mail-qk0-x243.google.com with SMTP id u75so9817232qka.1 for ; Fri, 12 May 2017 16:40:18 -0700 (PDT) Received: from bigtime.twiddle.net.com ([2602:47:d954:1500:5e51:4fff:fe40:9c64]) by smtp.gmail.com with ESMTPSA id z65sm3367460qkz.29.2017.05.12.16.40.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 May 2017 16:40:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=PF3/J1k7RKLbsOuiOCZdszMrp0mbUFlWU7Srw5HAU5c=; b=cMD+aLCrirjUqKYMl59YrN6+sqnxQazGu2jfHz6Wg0SgQpjNruG16Fc8yLYsrU5kej RVWePBpJwhBK4qWO63WcH/80GVsLgjnyUFExjt2TuYo7hP74v4nqY8eOgQuHYBZxJDWw UijHcvBYqR3pY2fgY59GZ1TGg4pEk8HedUy1fyVUPI8ZD8ApHrLnBDOi5/ILfr0NV17N im4vtOHSSHXttqXbwAj5x/qKY0pd6c5f6/c0C9qy0nPw7o3jsnebd5jHNkS3DBhjI2PW n5YSfYQ0EWslIBPftXymuFwjUgZtxh93gxQjbRLas33UrmW7rV+P5xyaDPQeK36pdPn9 xMcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=PF3/J1k7RKLbsOuiOCZdszMrp0mbUFlWU7Srw5HAU5c=; b=clJHE4JyvPvWDUDpHJXHFxScNQlpMD3Ay46IPFTvYWiUFd9nZ+6RN31V6s7B18Chj3 V6chkX5KmyYVJRLODQA5txsAAcb4WrZH9R0AlyuLZrOdTYJkyQSGq1dBLkfrQAFJDkhN MOs1XJ5U3Dbw+GaHV6J+KgVX/zrHOPqimSAJLVujHLtOB4fwBzVStmKIj+X7cjOEmYch OX2XZX2boZNc41M+GttW0J9wTh9hQzHIkV51pQoAeUCbF4W+ITf1/ULFoTHSAs4ASLZS QnLLoRWGALprpvnE2Q4hM4/tx99mR34UpYkeUtmU8Y5tbNKz3sBYVVVR/8bWZ8jksflz wSyw== X-Gm-Message-State: AODbwcD1SRM/Cix7aKdi2CHHUN/he2K84hM4zQQR/D28mg7wYIe3FZsg WfGHyPRM5kHy1Q== X-Received: by 10.55.24.9 with SMTP id j9mr5680426qkh.25.1494632418257; Fri, 12 May 2017 16:40:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 12 May 2017 16:40:03 -0700 Message-Id: <20170512234009.32557-4-rth@twiddle.net> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170512234009.32557-1-rth@twiddle.net> References: <20170512234009.32557-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::243 Subject: [Qemu-devel] [PULL 3/9] target/s390x: Diagnose specification exception for atomics 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: stefanha@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" All of the interlocked access facility instructions raise a specification exception for unaligned accesses. Do this by using the (previously unused) unaligned_access hook. Reviewed-by: Aurelien Jarno Signed-off-by: Richard Henderson --- target/s390x/cpu.c | 1 + target/s390x/cpu.h | 3 +++ target/s390x/helper.c | 16 ++++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 066dcd1..a1bf2ba 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -430,6 +430,7 @@ static void s390_cpu_class_init(ObjectClass *oc, void *= data) cc->write_elf64_note =3D s390_cpu_write_elf64_note; cc->cpu_exec_interrupt =3D s390_cpu_exec_interrupt; cc->debug_excp_handler =3D s390x_cpu_debug_excp_handler; + cc->do_unaligned_access =3D s390x_cpu_do_unaligned_access; #endif cc->disas_set_info =3D s390_cpu_disas_set_info; =20 diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 058ddad..bbed320 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -480,6 +480,9 @@ int s390_cpu_handle_mmu_fault(CPUState *cpu, vaddr addr= ess, int rw, =20 #ifndef CONFIG_USER_ONLY void do_restart_interrupt(CPUS390XState *env); +void s390x_cpu_do_unaligned_access(CPUState *cs, vaddr addr, + MMUAccessType access_type, + int mmu_idx, uintptr_t retaddr); =20 static inline hwaddr decode_basedisp_s(CPUS390XState *env, uint32_t ipb, uint8_t *ar) diff --git a/target/s390x/helper.c b/target/s390x/helper.c index 68bd2f9..9978490 100644 --- a/target/s390x/helper.c +++ b/target/s390x/helper.c @@ -718,4 +718,20 @@ void s390x_cpu_debug_excp_handler(CPUState *cs) cpu_loop_exit_noexc(cs); } } + +/* Unaligned accesses are only diagnosed with MO_ALIGN. At the moment, + this is only for the atomic operations, for which we want to raise a + specification exception. */ +void s390x_cpu_do_unaligned_access(CPUState *cs, vaddr addr, + MMUAccessType access_type, + int mmu_idx, uintptr_t retaddr) +{ + S390CPU *cpu =3D S390_CPU(cs); + CPUS390XState *env =3D &cpu->env; + + if (retaddr) { + cpu_restore_state(cs, retaddr); + } + program_interrupt(env, PGM_SPECIFICATION, ILEN_LATER); +} #endif /* CONFIG_USER_ONLY */ --=20 2.9.3