From patchwork Tue Nov 13 23:50:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 10681659 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AB5DE14BA for ; Tue, 13 Nov 2018 23:52:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D4012B559 for ; Tue, 13 Nov 2018 23:52:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 90FD52B5D3; Tue, 13 Nov 2018 23:52:32 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0D1BB2B5B2 for ; Tue, 13 Nov 2018 23:52:31 +0000 (UTC) Received: from localhost ([::1]:56537 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMiTu-000468-Jk for patchwork-qemu-devel@patchwork.kernel.org; Tue, 13 Nov 2018 18:52:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51381) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMiSr-0003Re-5D for qemu-devel@nongnu.org; Tue, 13 Nov 2018 18:51:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMiSj-0006Vu-7O for qemu-devel@nongnu.org; Tue, 13 Nov 2018 18:51:24 -0500 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:46907) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gMiSi-0006Uy-O6 for qemu-devel@nongnu.org; Tue, 13 Nov 2018 18:51:17 -0500 Received: by mail-pg1-x536.google.com with SMTP id w7so6441110pgp.13 for ; Tue, 13 Nov 2018 15:51:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=subject:date:message-id:cc:from:to; bh=AxWN8Qplcd2YOTtl4ih2cfRqU5arnKW6U66ILx92bLY=; b=Udns5JdaLHOdzXRlKmb9C6ahfH6LGDzrGrAfLhKUMtMPdhM7Q313HijnMCWGnfXR0x Ash1Xu3/emGZ1gCrmSbPVxP2blGwvRfbYMHeXSj8UmqlKdR0fR4iEu5rC2DvPiDlwpyc FqW20rmEkDGz2qvX2b1P3BKnN4hmeYrEGsNulVCCNfHSgnZQFswly6A/CWgV02GhDOIS fMMiyyMM54coIJl9Ja7to2SlTHwTZdd11wB2MN3Jo8/ffanfvWMNefLbjjBLBH/L2x6o 0AQnYp5B26xwx1bC9CwIdZd23Wc2kJN/eqiBFRbGFt7+9E71Z+SgwoSIJ3ck9AYZaVbx GEAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:date:message-id:cc:from:to; bh=AxWN8Qplcd2YOTtl4ih2cfRqU5arnKW6U66ILx92bLY=; b=ItxyDoiDjgB5SWHYMiaGoH4NMSmAu2ARzJmPcM5igQfDdrJYDTCz1sIlGT4JytgCiq 37a+1wsb7b7Ap9wHMNMMP9XY58nDXPYcfSChpwR26RpLOh8EQujT1FHJSXKsgM6N4j+S z6u33xJZWkJwDpgx9l9w2MREp97O+EHKuthr/v/idF7q5gtQ/sr6Z/EieFA+VDNDvDCe 7UkXlpPc9wWdXEzU3brePR+HqRb/cUnVsFvDBfEgFnBUY6t+ype07+blA5ZV7N0xx3HD ugeDXuMoXymUqvrPErS4L6iyANp3UpScNVd6Eomv6Km8FVVZKw+NnYB/Pz/jMJQniFwh 0aWg== X-Gm-Message-State: AGRZ1gK9qihODT7XoKMwE8eJnEVxOiUeJ5CxzZkfXYGAC/X88UvgTjIp WdUCn13rOABHyILBCfiMUHuyLeM7ph1xTg== X-Google-Smtp-Source: AJdET5ePw9bkjoKdgEx0OR3wbY/ijiHDIgvdC+zZy4x8SFfaUYIZKhu+NaoecB77HhL23b+ospMIdQ== X-Received: by 2002:a62:34c5:: with SMTP id b188-v6mr7532925pfa.65.1542153074204; Tue, 13 Nov 2018 15:51:14 -0800 (PST) Received: from localhost ([64.114.255.114]) by smtp.gmail.com with ESMTPSA id p38sm11634059pgm.40.2018.11.13.15.51.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 15:51:13 -0800 (PST) Date: Tue, 13 Nov 2018 15:50:41 -0800 Message-Id: <20181113235045.14155-1-palmer@sifive.com> X-Mailer: git-send-email 2.18.1 From: Palmer Dabbelt To: qemu-riscv@nongnu.org X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::536 Subject: [Qemu-devel] [PR RFC] RISC-V Patches for 3.1-rc2 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: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The following changes since commit cb968d275c145467c8b385a3618a207ec111eab1: Update version for v3.1.0-rc1 release (2018-11-13 18:16:14 +0000) are available in the Git repository at: git://github.com/riscv/riscv-qemu.git tags/riscv-for-master-3.1-rc2 for you to fetch changes up to 3502dc824a7b0218abb49f4350e80a49829748cf: RISC-V: Respect fences for user-only emulators (2018-11-13 15:12:15 -0800) ---------------------------------------------------------------- RISC-V Patches for 3.1-rc2 This pull request contains four patches that aren't really related to each other aside from all being bug fixes that I think should go in for 3.1.0: * The second half of Alistair's memory leak patch set that I missed last week. * A fix to make fclass.d availiable only on RV64IFD systems (without this it's availiable on RV32IFD systems, truncating the result). * A fix to make sfence.vm availiable only in priv-1.9.1, and sfence.vma only availiable in priv-1.10. * A change to respect fences in user-mode emulators, which were previously treated as NOPs. As usual, this builds and boot Linux for me. I don't think I have anything else planned for 3.1.0, but I may be wrong as things are a bit hectic this week. ---------------------------------------------------------------- Alistair Francis (1): hw/riscv/virt: Free the test device tree node name Bastian Koppelmann (2): target/riscv: Fix FCLASS_D being treated as RV64 only target/riscv: Fix sfence.vm/a both available in any priv version Palmer Dabbelt (1): RISC-V: Respect fences for user-only emulators hw/riscv/virt.c | 1 + target/riscv/translate.c | 24 ++++++++++++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) From patchwork Tue Nov 13 23:50:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 10681667 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C4AD013B5 for ; Tue, 13 Nov 2018 23:55:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B378B2A65E for ; Tue, 13 Nov 2018 23:55:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A3F5E2A93F; Tue, 13 Nov 2018 23:55:05 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 50BC92A65E for ; Tue, 13 Nov 2018 23:55:05 +0000 (UTC) Received: from localhost ([::1]:56549 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMiWO-0006Et-NR for patchwork-qemu-devel@patchwork.kernel.org; Tue, 13 Nov 2018 18:55:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51474) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMiT4-0003ay-Kq for qemu-devel@nongnu.org; Tue, 13 Nov 2018 18:51:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMiSx-0006do-J2 for qemu-devel@nongnu.org; Tue, 13 Nov 2018 18:51:36 -0500 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]:45334) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gMiSv-0006YW-16 for qemu-devel@nongnu.org; Tue, 13 Nov 2018 18:51:29 -0500 Received: by mail-pl1-x632.google.com with SMTP id a14so2209061plm.12 for ; Tue, 13 Nov 2018 15:51:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=subject:date:message-id:in-reply-to:references:cc:from:to; bh=LrSNAK5VmQ6c5x3kGvqXMw47hLHndptPmbk4QMAiCLc=; b=VQmxS9mUaXnBt5okfj5aiQ5eNoB6vEicU2WVVT5hiTbMosDgZjc6dWKjTXbXxOvSlb bdvxvn5xSe0Q6cNdZKjJuQ5HRHcn3zH/AKbibnkkJjnqwTw/W2ZGNvQSz1cqFhT/zGPt c9uMLujT4gqCvB2YRcnRkLGPENkwmMUOBp+HXZDbC2g4RDn8JP0NJSCBgWrkfcLqKyCb 8XdRYC48glbfDGUMDQMVTyel8Rv2buFc0dg3xeeJyKK7AJTvKQzOpCM+BdALX8rhORJw 7qr0ni7xj6xaIsS3u4xHS0VupMsYrUpP7+fUt9YUWXncgB3mAeHAU48+kSfv2NvrQms1 sNsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:date:message-id:in-reply-to:references :cc:from:to; bh=LrSNAK5VmQ6c5x3kGvqXMw47hLHndptPmbk4QMAiCLc=; b=TCkhOQ0Lq0D7g5560JtWu0HEJZk0dtzP4Zzvy0PYjjLmteMSopqTpaWm+N1rcT530F zV06pmdubH5Nh9iz5p5Dv3fNvwKL4iDKfWfY92cQloo32jmLJAe8t8EKFIShV7edxIdc iDopDi5KXo5Ky7B8wvg1+hFXhVbtJlMyvYDBzpCNtIGrKLOmF+uWqgwVWe4vSy1TpRDQ TGbGPpZEK5itigUm6jzmp0vhLVa7QPbka8J0QMd1ZmtYeWZI4ztDqDXSztMV3PQdU3Iq 0h8IxJEHO6VrAP+kHLv7nEV8UUDXePgicLZ96md0EqjV9OZ4q9zvjnzdjsJ5TrM2bM1e V1VQ== X-Gm-Message-State: AGRZ1gI6EM3AAKpwt1Uje0nodZAVyJ7VEHh+ZtZ0CpgJDOaafdFkXAZ3 zXosHIwYuJN8jVQznhF1UkhVWgMN7cQ5PA== X-Google-Smtp-Source: AJdET5fAs7vwWEMIN7Kzqlp//nj+SDeCyjMZf6x3HpJZAGFrRLFcjf1Iee2yMoF/TRWjWf4xE3GBFw== X-Received: by 2002:a17:902:3103:: with SMTP id w3-v6mr7308825plb.18.1542153080578; Tue, 13 Nov 2018 15:51:20 -0800 (PST) Received: from localhost ([64.114.255.114]) by smtp.gmail.com with ESMTPSA id g7-v6sm22813127pfo.139.2018.11.13.15.51.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 15:51:19 -0800 (PST) Date: Tue, 13 Nov 2018 15:50:43 -0800 Message-Id: <20181113235045.14155-3-palmer@sifive.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20181113235045.14155-1-palmer@sifive.com> References: <20181113235045.14155-1-palmer@sifive.com> From: Palmer Dabbelt To: qemu-riscv@nongnu.org X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::632 Subject: [Qemu-devel] [PULL 2/4] target/riscv: Fix FCLASS_D being treated as RV64 only 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: Bastian Koppelmann , Palmer Dabbelt , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Bastian Koppelmann Signed-off-by: Bastian Koppelmann Reviewed-by: Richard Henderson Signed-off-by: Palmer Dabbelt --- target/riscv/translate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/riscv/translate.c b/target/riscv/translate.c index 18d7b6d1471d..5359088e24bc 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -1237,13 +1237,14 @@ static void gen_fp_arith(DisasContext *ctx, uint32_t opc, int rd, tcg_temp_free(t0); break; -#if defined(TARGET_RISCV64) case OPC_RISC_FMV_X_D: /* also OPC_RISC_FCLASS_D */ switch (rm) { +#if defined(TARGET_RISCV64) case 0: /* FMV */ gen_set_gpr(rd, cpu_fpr[rs1]); break; +#endif case 1: t0 = tcg_temp_new(); gen_helper_fclass_d(t0, cpu_fpr[rs1]); @@ -1255,6 +1256,7 @@ static void gen_fp_arith(DisasContext *ctx, uint32_t opc, int rd, } break; +#if defined(TARGET_RISCV64) case OPC_RISC_FMV_D_X: t0 = tcg_temp_new(); gen_get_gpr(t0, rs1); From patchwork Tue Nov 13 23:50:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 10681663 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4C35214BA for ; Tue, 13 Nov 2018 23:53:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E14F295A5 for ; Tue, 13 Nov 2018 23:53:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 320D22B5F0; Tue, 13 Nov 2018 23:53:02 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BC8BE295A5 for ; Tue, 13 Nov 2018 23:53:01 +0000 (UTC) Received: from localhost ([::1]:56539 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMiUK-0004VU-0g for patchwork-qemu-devel@patchwork.kernel.org; Tue, 13 Nov 2018 18:52:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51475) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMiT4-0003az-LA for qemu-devel@nongnu.org; Tue, 13 Nov 2018 18:51:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMiSx-0006e0-Oy for qemu-devel@nongnu.org; Tue, 13 Nov 2018 18:51:36 -0500 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:34325) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gMiSv-0006ZL-5n for qemu-devel@nongnu.org; Tue, 13 Nov 2018 18:51:31 -0500 Received: by mail-pg1-x542.google.com with SMTP id 17so6196752pgg.1 for ; Tue, 13 Nov 2018 15:51:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=subject:date:message-id:in-reply-to:references:cc:from:to; bh=v8thlYChsOVWo1muMkMOtoqaVRzSIwN5qBNyohP/GZI=; b=g/0ZoLa/6hOSVcbxsf6LhvQmJ78j8RGRzY77SQsviG3VLBbDF0Pku4DZnTArlQg3zv 34YKAz5jnytHkObVj3/jRBrsyDNSV72zpGcyBhtvrOr62fUsXGpHKhAxhOnoJHmO5qjH X6LGbvIOtsMJjfuXluocDcG13F7nhGW1fiWI8BsSt1rpQcXFsXYTUBuDosuVQ0erqWB7 aiQJMf8XKutg4F4jzqDwaNd9S5Fm4Okq9eB9ynnM1jnyhRGDJzQlxuGIVBiTUDC2aumR V78BGwoLH9tJzZMMyqtlPYAeGi1wxaAwqEUkHSptv2B/oZ5K/dhjV1/PI4G9MaZ+SE7v bxbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:date:message-id:in-reply-to:references :cc:from:to; bh=v8thlYChsOVWo1muMkMOtoqaVRzSIwN5qBNyohP/GZI=; b=jPdbS9L+07eCYWjKu2XsC/nC79aQ7KDfjy8QtTl3uyR5TAzVpVUq4Uo0ybD8xqoSVd D0aPMndJSUrWPZ1B7pQw9rvNjZCihqWhhvjFQK1lBRjXb8wwzGXKJXIN+bzqbeLZLpFR 7EDHuLj4Hj3diif/f81xU70vesOvJSxfQ7Q1gCXwwFYGe/1DbQprQJ33zgbrR6ziwris VfWQtUHciLJ8eiAcG9w39BxB30a3OXzZ0Sb75UL2VySgZazMsZI0bfgAxsPmWewcxBwD b4wjm+rjEjjWxP6bXevcP6uQESoqdVbN0mhQSim5KAQuawaUsmgNRekf9E07LWumtrcw A1Hw== X-Gm-Message-State: AGRZ1gI01AGjwiHeBWPdscJpRQXTjYF6DH70pKxAwyd2iWztD+LHehsi yYIZI2KsdPXlaifdUTl+Qi8iJ0fljH4VBQ== X-Google-Smtp-Source: AJdET5c4PqvB2Q/qFxqFjPa+fVPck1GCrvW4QGad3rhTRDtQbe0SXHBWQSB5lCmdNjfKtKDhe3VEXA== X-Received: by 2002:a62:682:: with SMTP id 124-v6mr7240462pfg.161.1542153082487; Tue, 13 Nov 2018 15:51:22 -0800 (PST) Received: from localhost ([64.114.255.114]) by smtp.gmail.com with ESMTPSA id u5-v6sm25512059pgk.46.2018.11.13.15.51.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 15:51:21 -0800 (PST) Date: Tue, 13 Nov 2018 15:50:44 -0800 Message-Id: <20181113235045.14155-4-palmer@sifive.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20181113235045.14155-1-palmer@sifive.com> References: <20181113235045.14155-1-palmer@sifive.com> From: Palmer Dabbelt To: qemu-riscv@nongnu.org X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::542 Subject: [Qemu-devel] [PULL 3/4] target/riscv: Fix sfence.vm/a both available in any priv version 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: Bastian Koppelmann , Palmer Dabbelt , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Bastian Koppelmann sfence.vm has been replaced in priv v1.10 spec by sfence.vma. Reported-by: Richard Henderson Signed-off-by: Bastian Koppelmann Reviewed-by: Richard Henderson Signed-off-by: Palmer Dabbelt --- target/riscv/translate.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/target/riscv/translate.c b/target/riscv/translate.c index 5359088e24bc..f44eb9c41b48 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -1292,10 +1292,14 @@ static void gen_system(CPURISCVState *env, DisasContext *ctx, uint32_t opc, #ifndef CONFIG_USER_ONLY /* Extract funct7 value and check whether it matches SFENCE.VMA */ if ((opc == OPC_RISC_ECALL) && ((csr >> 5) == 9)) { - /* sfence.vma */ - /* TODO: handle ASID specific fences */ - gen_helper_tlb_flush(cpu_env); - return; + if (env->priv_ver == PRIV_VERSION_1_10_0) { + /* sfence.vma */ + /* TODO: handle ASID specific fences */ + gen_helper_tlb_flush(cpu_env); + return; + } else { + gen_exception_illegal(ctx); + } } #endif @@ -1342,7 +1346,11 @@ static void gen_system(CPURISCVState *env, DisasContext *ctx, uint32_t opc, gen_helper_wfi(cpu_env); break; case 0x104: /* SFENCE.VM */ - gen_helper_tlb_flush(cpu_env); + if (env->priv_ver <= PRIV_VERSION_1_09_1) { + gen_helper_tlb_flush(cpu_env); + } else { + gen_exception_illegal(ctx); + } break; #endif default: From patchwork Tue Nov 13 23:50:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 10681661 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A51B7139B for ; Tue, 13 Nov 2018 23:52:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 981842B5D8 for ; Tue, 13 Nov 2018 23:52:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8C51D2B5E5; Tue, 13 Nov 2018 23:52:55 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 167EC2B5DA for ; Tue, 13 Nov 2018 23:52:55 +0000 (UTC) Received: from localhost ([::1]:56538 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMiUI-0004Uu-9u for patchwork-qemu-devel@patchwork.kernel.org; Tue, 13 Nov 2018 18:52:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51480) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMiT4-0003b3-Nr for qemu-devel@nongnu.org; Tue, 13 Nov 2018 18:51:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMiT2-0006hU-NT for qemu-devel@nongnu.org; Tue, 13 Nov 2018 18:51:38 -0500 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:39174) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gMiSx-0006ae-OF for qemu-devel@nongnu.org; Tue, 13 Nov 2018 18:51:34 -0500 Received: by mail-pl1-x643.google.com with SMTP id b5-v6so6815050pla.6 for ; Tue, 13 Nov 2018 15:51:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=subject:date:message-id:in-reply-to:references:cc:from:to; bh=jiJQ+JOIMV0I2GJ3MV1g+OOMPgoMF7Rval6G4QIiJEo=; b=QkhHVdjwgtGGWGUd1dLi8WNBR+H5NZ/x1xjM86786xmx555L12jnK+N7FntYwhAchb PiuDK5crQYQcwrgU8ElnQsZx9IwYSUM0el9Xs1fKdhB9Hp5QfJQ8itJ1VpvaipCcQ7vS ivCUjyEvhXoI+7XoM1LhPgRyqC9Wf7z2YnIOkWcFBKpGop9rrsz4ctHwLSfihD4637/v AYB7uWI9cqNZD8qk2jc8h73ujCDGmRo11nYR6z8hRwZbiuEyXv53MZjtF2Rl9as/aoR/ 9ehSL/yp7Za9vbWPLI9Cen3pcDtJef8MRapJDBXGdeXQZKgwmrapT/ziT06uau16OXss uugA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:date:message-id:in-reply-to:references :cc:from:to; bh=jiJQ+JOIMV0I2GJ3MV1g+OOMPgoMF7Rval6G4QIiJEo=; b=MvcXsWNo0suP9gqZADeKxr3dTumYTSphXlzT6mrUwyHMFVQXkFmoXiocwYB077LN2X 68D2LHz0lpBVPJy0l40hbiT+el6jZxOgh+MSo75clOatdclPevwj5j7XSQMH7fkXZyC1 A8b1mHRmfda18dSzbUqrx6Ia7o1apwRVvThYIL3XRW5EnWkhDVo0V0h8BMPLoC5qynBq g0XFFQBa9Z08jTay7kcKV8H7UrsDa0lIrqrJ8TCXIk8r5pHSR9ie5cBaCt2UTTsP0AXO 9/AE/zFqzTYMQrv/F57KK/rolZWRLWEaauVxsg7gUzb2JRKXNz7x9AXnTA8U7kz09IxF 2vPA== X-Gm-Message-State: AGRZ1gLrBxjhwLg2Xqgvjex44LS9oRIFaSiv3w6UmJe0OTi36wDjznYR obQeyWcCpgD8hRGyp5Tor1kJ/ija0jemVA== X-Google-Smtp-Source: AJdET5fOfG7Gum2pl418WZGURlWpvspf1CkdOB0jOOdFKTtoqHcey6MnQgkTgbs65ObdDIRC5Gsilw== X-Received: by 2002:a17:902:2ac3:: with SMTP id j61mr2840766plb.185.1542153084393; Tue, 13 Nov 2018 15:51:24 -0800 (PST) Received: from localhost ([64.114.255.114]) by smtp.gmail.com with ESMTPSA id y25-v6sm99114pfa.136.2018.11.13.15.51.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 15:51:23 -0800 (PST) Date: Tue, 13 Nov 2018 15:50:45 -0800 Message-Id: <20181113235045.14155-5-palmer@sifive.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20181113235045.14155-1-palmer@sifive.com> References: <20181113235045.14155-1-palmer@sifive.com> From: Palmer Dabbelt To: qemu-riscv@nongnu.org X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::643 Subject: [Qemu-devel] [PULL 4/4] RISC-V: Respect fences for user-only emulators 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: Palmer Dabbelt , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Our current fence implementation ignores fences for the user-only configurations. This is incorrect but unlikely to manifest: it requires multi-threaded user-only code that takes advantage of the weakness in the host's memory model and can be inlined by TCG. This patch simply treats fences the same way for all our emulators. I've given it to testing as I don't want to construct a test that would actually trigger the failure. Our fence implementation has an additional deficiency where we map all RISC-V fences to full fences. Now that we have a formal memory model for RISC-V we can start to take advantage of the strength bits on our fence instructions. This requires a bit more though, so I'm going to split it out because the implementation is still correct without taking advantage of these weaker fences. Thanks to Richard Henderson for pointing out both of the issues. Signed-off-by: Palmer Dabbelt Reviewed-by: Alistair Francis Reviewed-by: Richard Henderson Reviewed-by: Michael Clark --- target/riscv/translate.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/target/riscv/translate.c b/target/riscv/translate.c index f44eb9c41b48..312bf298b3c2 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -1776,7 +1776,6 @@ static void decode_RV32_64G(CPURISCVState *env, DisasContext *ctx) GET_RM(ctx->opcode)); break; case OPC_RISC_FENCE: -#ifndef CONFIG_USER_ONLY if (ctx->opcode & 0x1000) { /* FENCE_I is a no-op in QEMU, * however we need to end the translation block */ @@ -1787,7 +1786,6 @@ static void decode_RV32_64G(CPURISCVState *env, DisasContext *ctx) /* FENCE is a full memory barrier. */ tcg_gen_mb(TCG_MO_ALL | TCG_BAR_SC); } -#endif break; case OPC_RISC_SYSTEM: gen_system(env, ctx, MASK_OP_SYSTEM(ctx->opcode), rd, rs1,