Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4850062ybi; Tue, 30 Jul 2019 09:11:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqzE3H316jetomF9V1+Wx/Ag8Gl3VbnyEzpKxtz4zYeOCuipUXI2MmqH1RVt9OzHU2AfhITv X-Received: by 2002:a63:c23:: with SMTP id b35mr75820173pgl.265.1564503118485; Tue, 30 Jul 2019 09:11:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564503118; cv=none; d=google.com; s=arc-20160816; b=j1acys6I+s+V/mwZ4fW9OoWj6bP6EI5f/NHU7LRoaMYbGr45ez1+wWpCNi0445lTzk EeAEnOXiH6DH4+OBqOfe73jNBQRK0F/pleKAdLbgIrc+Tovk1dbyaq5DlqxRxO+g3wQu EZFQ37K3mgrOV87EF6r504MX1XyvHUDkygGaloZlsftnhrFDc/VnTqRDlwI+1jprt/JQ b6+feWhFgqlzf/9eT9KHHAehOzyoRXk42WJ1tyc7h+uns+2YyVu+3ljz79VqcgXx6uYf 7py+oYgNPuFNDBegEvDlIy5n7MBPEnjXu/gGwpdvpYdRO9PnPVnMPeRq5/6um9B+GmO5 UeDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=NG5L1QTdBmlmtrEe2guVH/gymGPjaWoNXWl+si7exOk=; b=iulkV2HunUvmWwnP7IS1U2vhrapdyiXGbPlomJdkaTrCsLZqiUJ9Xz9IK9GCxsVKYn mDj9OYqDBbvNSA2dg3O9J6cOVNGSAxQe1wS2hLaYXy6fb+uCmRyQWuZcktfUdGldbvu0 Rklsbs4DYI1zxBUj9DdcYvwKWe84AJhDOKawaegZW5cZBKKdjqBaKpLXPgIwI8m6RKrt fv/5uEE7GTrvjIBn3HOEsd98nGEEt/G3d7zgFb/vmsyFUnV8lYcpsZczy+Ex6wlN/Uhn 5JX4UZcjfUrRNerB9UFeITJwgFeUKn7vmvxe2IWBesK5DuL3IbLRgdI5sg68g7xvOxZj hypg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=XSdmFwgu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s132si29966773pfc.244.2019.07.30.09.11.42; Tue, 30 Jul 2019 09:11:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=XSdmFwgu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729433AbfG3Nfz (ORCPT + 99 others); Tue, 30 Jul 2019 09:35:55 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:50394 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727860AbfG3Nfz (ORCPT ); Tue, 30 Jul 2019 09:35:55 -0400 Received: by mail-wm1-f66.google.com with SMTP id v15so57220062wml.0 for ; Tue, 30 Jul 2019 06:35:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NG5L1QTdBmlmtrEe2guVH/gymGPjaWoNXWl+si7exOk=; b=XSdmFwgubGe6ca2jGD5P1QJGT8CMbYWIzlLpz6Eoj+crQJqBbRxtfRD03xHciSbZGR HgUyaRoMJGBJUl9AwrhDY+LY7BICoqGRLUutuIVrFlpmCSbb/YaPHn24DdtSWT8nSQNJ HNbIoQ24ijM0pkBajjUiUloMmrG1qV2j02BgwU/pfsCZOMg8nrkLHj5PugJjNWUI08i6 46IURZmK0iph3Xtai5f296l4eygKizR6AshPA/dYIsTcknbdn5XbSr701seqEAcIstYg ECXNyvnLr3qFLKD8U3sno1GkJ0fpfMp6BHMaI5Cx9/og+JT02Rb8tm2Ntr6rNFYwen4k M4bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=NG5L1QTdBmlmtrEe2guVH/gymGPjaWoNXWl+si7exOk=; b=DAqkEpmvp9gHMPOmh04ROts4/oJBhbm3AJ7nHI+H7sCYuRWeR+TJonsKeQ1jm6m7Zb Im/lpRyHXGoIOBGH/PzylNXOXCKZoAyNliemhX+SUeIU3nLuFgQyaLzyKOpYiu54T4+k rVAgSq3cs3k8/aSERcHyiTiGJTvPygn27czCo4bRNcMjFs0/dKQXjZkKE4WZ2j3mVxOQ nsxiE6xqe273oVKWGd1PyqsoBaHN71kjYszU2SwmFblNTQF7Wvgn+cf5DOLCrqKIhxs+ zEYFOALphWe/3fH3DJHPyULJueiG1eiLoeGeV0E4s5rVW1fppKi9K0m0VFE30wLFBaay AN/Q== X-Gm-Message-State: APjAAAV/1Z7dHNXw8dKcTabnqEWJRV6wPvp6z7N6QYO9Jw4THfj26kG8 UZICddF72AKS0XRrEj3kltrOStjqETpidpG5UxI= X-Received: by 2002:a1c:9d53:: with SMTP id g80mr100562254wme.103.1564493752815; Tue, 30 Jul 2019 06:35:52 -0700 (PDT) MIME-Version: 1.0 References: <20190729115544.17895-1-anup.patel@wdc.com> <20190729115544.17895-6-anup.patel@wdc.com> <9f9d09e5-49bc-f8e3-cfe1-bd5221e3b683@redhat.com> <66c4e468-7a69-31e7-778b-228908f0e737@redhat.com> <828f01a9-2f11-34b6-7753-dc8fa7aa0d18@redhat.com> In-Reply-To: <828f01a9-2f11-34b6-7753-dc8fa7aa0d18@redhat.com> From: Anup Patel Date: Tue, 30 Jul 2019 19:05:40 +0530 Message-ID: Subject: Re: [RFC PATCH 05/16] RISC-V: KVM: Implement VCPU interrupts and requests handling To: Paolo Bonzini Cc: Anup Patel , Palmer Dabbelt , Paul Walmsley , Radim K , Daniel Lezcano , Thomas Gleixner , Atish Patra , Alistair Francis , Damien Le Moal , Christoph Hellwig , "kvm@vger.kernel.org" , "linux-riscv@lists.infradead.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 30, 2019 at 6:48 PM Paolo Bonzini wrote: > > On 30/07/19 14:45, Anup Patel wrote: > > Here's some text from RISC-V spec regarding SIP CSR: > > "software interrupt-pending (SSIP) bit in the sip register. A pending > > supervisor-level software interrupt can be cleared by writing 0 to the SSIP bit > > in sip. Supervisor-level software interrupts are disabled when the SSIE bit in > > the sie register is clear." > > > > Without RISC-V hypervisor extension, the SIP is essentially a restricted > > view of MIP CSR. Also as-per above, S-mode SW can only write 0 to SSIP > > bit in SIP CSR whereas it can only be set by M-mode SW or some HW > > mechanism (such as S-mode CLINT). > > But that's not what the spec says. It just says (just before the > sentence you quoted): > > A supervisor-level software interrupt is triggered on the current > hart by writing 1 to its supervisor software interrupt-pending (SSIP) > bit in the sip register. Unfortunately, this statement does not state who is allowed to write 1 in SIP.SSIP bit. I quoted MIP CSR documentation to highlight the fact that only M-mode SW can set SSIP bit. In fact, I had same understanding as you have regarding SSIP bit until we had MSIP issue in OpenSBI. (https://github.com/riscv/opensbi/issues/128) > > and it's not written anywhere that S-mode SW cannot write 1. In fact > that text is even under sip, not under mip, so IMO there's no doubt that > S-mode SW _can_ write 1, and the hypervisor must operate accordingly. Without hypervisor support, SIP CSR is nothing but a restricted view of MIP CSR thats why MIP CSR documentation applies here. I think this discussion deserves a Github issue on RISC-V ISA manual. If my interpretation is incorrect then it would be really strange that HART in S-mode SW can inject IPI to itself by writing 1 to SIP.SSIP bit. > > In fact I'm sure that if Windows were ever ported to RISC-V, it would be > very happy to use that feature. On x86, Intel even accelerated it > specifically for Microsoft. :) That would be indeed very strange usage. :) Regards, Anup