From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60107) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1boVHC-0008CE-ND for qemu-devel@nongnu.org; Mon, 26 Sep 2016 08:44:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1boVH8-00088n-M8 for qemu-devel@nongnu.org; Mon, 26 Sep 2016 08:44:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36780) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1boVH8-00088a-G9 for qemu-devel@nongnu.org; Mon, 26 Sep 2016 08:44:50 -0400 References: <00a3b0f8e865f9b04e813e63e4c9d4a6d98da210.1474886798.git.sagark@eecs.berkeley.edu> <4606a059-a1be-62ab-d3eb-c432f1be4c6c@redhat.com> From: Paolo Bonzini Message-ID: Date: Mon, 26 Sep 2016 14:44:45 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 12/18] target-riscv: Add system instructions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bastian Koppelmann , Sagar Karandikar , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, rth@twiddle.net On 26/09/2016 14:38, Bastian Koppelmann wrote: > On 09/26/2016 02:21 PM, Paolo Bonzini wrote: >> >> >> On 26/09/2016 12:56, Sagar Karandikar wrote: >>> +#ifndef CONFIG_USER_ONLY >>> +DEF_HELPER_4(csrrw, tl, env, tl, tl, tl) >>> +DEF_HELPER_5(csrrs, tl, env, tl, tl, tl, tl) >>> +DEF_HELPER_5(csrrc, tl, env, tl, tl, tl, tl) >>> +DEF_HELPER_2(sret, tl, env, tl) >>> +DEF_HELPER_2(mret, tl, env, tl) >>> +DEF_HELPER_1(tlb_flush, void, env) >>> +DEF_HELPER_1(fence_i, void, env) >>> +#endif /* !CONFIG_USER_ONLY */ >> >> The system emulation spec is still in flux, I think we should only add >> user-mode emulation for now. >> >=20 > Hi Paolo, >=20 > by user-mode emulation you still mean softmmu and not linux-user, right= ? > So just drop the system instructions for now. I don't think that's possible; all RISC-V machines include at least M-mode, whose precise definitions requires the privileged interface specification which hasn't been finalized yet. So only linux-user is stable enough. In fact, based on some recent discussions on the RISC-V isa-dev mailing list, it looks like some memory protection features _beyond_ the privileged interface specification are in practice required to secure M-mode from the supervisor. I'm not sure what's the point in defining a separate mandatory M-mode (supervisor mode cannot even enable paging without help from M-mode, on the other hand a processor that only has M- and U-modes cannot enable paging) but not providing the tools to actually enforce privilege separation for it. All in all, while I'm happy that the RISC-V project uses QEMU for development, I don't think that the privileged interface specification is mature enough for inclusion in QEMU. It's very different for linux-user user-mode emulation of course, it's great to have that upstrea= m. Thanks, Paolo