Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp1522697imd; Thu, 1 Nov 2018 17:42:04 -0700 (PDT) X-Google-Smtp-Source: AJdET5fNPWGPI0KNgXeIpQ1olA3r/SJP8SXh4P+6YjecoB4/8J6CoaXavzpg9eyjgI5JaG6ZnebN X-Received: by 2002:a17:902:d24:: with SMTP id 33-v6mr377768plu.319.1541119324412; Thu, 01 Nov 2018 17:42:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541119324; cv=none; d=google.com; s=arc-20160816; b=MPPi1yfrnkwHY25dbpCpLSNPaKuQM9yMNDaHqj0QvGt2SEX4y8KvJGantMbp9Vif/T 10ji/g7Ajp5Rc/7Hw8Hwio4o3IaU3BIOllF1l34JndTm6kMUvZKeQu2Vlp821IyDvo8h GbsxSy/JMvkmbtminWuB3La3I5F0Wp2d5NLtnZsLRxQQHzkRTQ8+ubViH5DR7IG9cFAG eZrKELuxR1YphuqXSaQV+oUZkzg1PS2FRIPKIGIa5w2n9QGrQ9f8kVrQCibzE0ys0IUH cxwkxosCl84FmfbD4llR1BDZ6pC4lhGuZ2BktftFv8h9iYgMYwZF9uyjUoQYBN79HqLt TVng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=C7TuqUB5JQsXMIsb6ydecIxp7uKXOnZldc1+XxXrsKc=; b=lquqgjY2XTdmfK6MFKim/OsKNLS2JUyPOqTZ9VTG05J7R4HBSQ4u9y/lMi45WKxtga E5+hVtqo7BdCo0z/vbG9BrA1zINlgNpbfJGd4rzTnOuuZsioi2RsNLUNa33wveple4Pr 3dj/opnjd/iRqVRQuCOthQQxxuDK/QLBZ/dzMN0QybzdDBDGQ/ZTI4Tuz6Q4tOHMmQqX R/Fr+uvueaLcuxFSeNGHsQxI2g5SvtrBJd+AI7Fc/+N7GgA6LowRPhbjbwP0SuiYM58h LaQHtH1IsM2U9K0mJbZiti8tCTy0Xp/GmXnzBi1RDKy56XvxZZ6o4vNo3kB147Qy6upL xJbA== ARC-Authentication-Results: i=1; mx.google.com; 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 3-v6si20271166pll.361.2018.11.01.17.41.49; Thu, 01 Nov 2018 17:42:04 -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; 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 S1728153AbeKBJql (ORCPT + 99 others); Fri, 2 Nov 2018 05:46:41 -0400 Received: from 59-120-53-16.HINET-IP.hinet.net ([59.120.53.16]:48486 "EHLO ATCSQR.andestech.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726886AbeKBJql (ORCPT ); Fri, 2 Nov 2018 05:46:41 -0400 Received: from mail.andestech.com (atcpcs16.andestech.com [10.0.1.222]) by ATCSQR.andestech.com with ESMTP id wA20g6Nt003936; Fri, 2 Nov 2018 08:42:06 +0800 (GMT-8) (envelope-from alankao@andestech.com) Received: from andestech.com (10.0.15.65) by ATCPCS16.andestech.com (10.0.1.222) with Microsoft SMTP Server id 14.3.123.3; Fri, 2 Nov 2018 08:41:21 +0800 Date: Fri, 2 Nov 2018 08:41:22 +0800 From: Alan Kao To: Palmer Dabbelt CC: Christoph Hellwig , , , , Arnd Bergmann , , , , , Subject: Re: [RFC 0/2] RISC-V: A proposal to add vendor-specific code Message-ID: <20181102004122.GA22741@andestech.com> References: <20181101005541.GA25604@andestech.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Originating-IP: [10.0.15.65] X-DNSRBL: X-MAIL: ATCSQR.andestech.com wA20g6Nt003936 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 01, 2018 at 10:50:04AM -0700, Palmer Dabbelt wrote: > On Wed, 31 Oct 2018 17:55:42 PDT (-0700), alankao@andestech.com wrote: > >On Wed, Oct 31, 2018 at 07:17:45AM -0700, Christoph Hellwig wrote: > >>On Wed, Oct 31, 2018 at 04:46:10PM +0530, Anup Patel wrote: > >>> I agree that we need a place for vendor-specific ISA extensions and > >>> having vendor-specific directories is also good. > >> > >>The only sensible answer is that we should not allow vendor specific > >>extensions in the kernel at all. ... > > > >How can this even be possible if a extension includes an extra register > >set as some domain-specific context? In such a case, kernel should > >at least process the context during any context switch, just like how it > >deals with the FP context. > > Ya, I think there are cases where vendor-specific extensions are going to be > necessary to handle within the kernel. Right now the only one I can think > of is the performance counter stuff, where we explicitly allow > vendor-specific counters as part of the ISA spec. > > For stateful extensions, we currently have a standard mechanism where the XS > bits get set in sstatus and the actual save/restore code is hidden behind an > SBI call. That call doesn't currently exist, but if we just go ahead and > add one it should be easy to support this from within Linux. We'll need to > figure out how to enable these custom extensions from userspace, but that > seems tractable as well. We'll probably also want some fast-path for the V > extension (and any other stateful standard extensions), but I think as long > as the V extension adds a quick check for dirtiness then it's not a big > deal. > > Do you guys have stateful extensions? We're trying really hard to avoid > them at SiFive because they're a huge headache, so unless there's a > compelling base of software using one I don't want to go add support if we > can avoid it. Currently no, but the future is hard to see. As long as the extensible freedom claimed by the RISC-V foundation remains true, such extensions may have their role to play. Don't worry now, I was just to give a example that in some possible vendor-specific cases the kernel cannot keep itself from involving.