Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp1142276imd; Thu, 1 Nov 2018 10:51:09 -0700 (PDT) X-Google-Smtp-Source: AJdET5dkuyQGE4UvFxwK2nuNViqF//StdARBoVrBWTvjuzWH1rMU/HSTwsV82mVmpM7MM6Y7erpr X-Received: by 2002:a62:2a04:: with SMTP id q4-v6mr8520399pfq.61.1541094669856; Thu, 01 Nov 2018 10:51:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541094669; cv=none; d=google.com; s=arc-20160816; b=qY+7cFjiznS8e7AClwB5S6PyDZUYhV49HfiGrLKjjpoKn3slfV308BwZFWUl8V58Rx WgdFWr1ICaE6tyVmw0Frlrntegbteh0ogr7QXEMMULEdX84Iar2f29mgTy13fcMAYzH4 25ThtrQnFq9uAC8uiwWWjgHETA+FFgBQKrW7uk91f5ZXw3xIGs1i2DFKLUDafFZVi8Tq h4e+YXq6bGGI43zPwWjcVyYoVFd8E3bvNOitdVPXNMeN6KSkCuoD6Cq9erjlw86qYpyT UBNPB+g9spD9/ZL/wm4IZdwnmbvL4+/GPtdL419nwqIP9D2F0XD9jFWcinjX1d/A4Mlm MR5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=GFlRgMZkJ4YMHOMTHBQoUQxMJc7k1tC+EcFFH8tZutg=; b=SFHKX0UMWZkTOzkr2dNhURit3fjMScP9ugGhs5QA64ubaJiNzEyZqaLlsgsEsyHNnx KYGSf+d0YhDPYo1fUE6z8kAM0d/2nbV8QwUHVS1VAWA79wxlN3zmOlkL1d6XbC3RccjQ un8NF8bUCHwVPFXVASGmnc1pwIuOq/KFRQYts9vBwKzXwwRbUi/f+kqSyOFy0flfA4CR PugJAooRiJTUfgJnA3xC40NtjeaKdU+29asSmJLJIMXHRUCXUOHm8KjrI9kz1tQjKcoc rqVNsuh0DtHZGiQpoEsaaiYY7uvvQOIFuE4kif7pDAxdIaVcAIZh18az4AlF0mi0SF1G k6hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=Z41bLBSy; 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 m72-v6si4800039pga.114.2018.11.01.10.50.54; Thu, 01 Nov 2018 10:51:09 -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=@sifive.com header.s=google header.b=Z41bLBSy; 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 S1727978AbeKBCyF (ORCPT + 99 others); Thu, 1 Nov 2018 22:54:05 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:44170 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727465AbeKBCyF (ORCPT ); Thu, 1 Nov 2018 22:54:05 -0400 Received: by mail-pg1-f195.google.com with SMTP id w3-v6so9349451pgs.11 for ; Thu, 01 Nov 2018 10:50:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=GFlRgMZkJ4YMHOMTHBQoUQxMJc7k1tC+EcFFH8tZutg=; b=Z41bLBSysABsyy3IHVEJQzoULwqyc7jqXN9vEKH2igPsZdi+icv34TVdjtHQvBO+H6 Q+bovyQIsXPKifThtKOnL7+5S82ju/4mEOunOz33ariVVn9WAg5n7hEEwqsLObjwrRqi FGfHxCI8l81g8Jec6j82EThH6FYowKHNi/7j607WNt9ydRTKHvJwp881H67qIGkfDMg7 r7Rh7bI1GMlEJVmmxnIxW5lpHrm6zSqOwwmbg5YH2IydUa6RgOJXHNbabwBR6fhk8iOL ObOKPyG1UIR9YXYL6zA9VO7mIz4KtPq6zbsT4cirJHaKqar4FqS8EsmTb429KQNXAJci BJ9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=GFlRgMZkJ4YMHOMTHBQoUQxMJc7k1tC+EcFFH8tZutg=; b=OaMnzlf3TEj5ScDnPBCUOBqBmTTQG3CGwfViVZlW5aDnCpFjy7gvITad5AwgL4sN61 E6S22Edbp5pfu9wXcxMc3VrsLR+B43GhgXm/5f7EZMD+9OJXy1q9BU7fJwj7Y54KCHI9 JysXThEA1pQ5paUfzUIkRXFoxbsLA3n2q5voOpQbymiGV/ewP1ApC2hNSwHghk4Pl6io Q81kzq8XMk5cfJVPHqNoGSPIi3Jzb4uvOYpOFRTpGBsq+1zMmg/u6dHI1bYcw/PpPaMZ P0EyxPT0vE6DL7wCvt1pcm12BJoZ4KGnYXqZHcx+313bxEoteRjGPeN2m5bHKp1cYxLa ZvSQ== X-Gm-Message-State: AGRZ1gLx4n/z6PfpsmFOq+64IUMcU4feyJaBB4yxVLnmUPAST1EDg3Mn areui7xQ0JRdt98Ymdmqm+WvFg== X-Received: by 2002:a63:6ac5:: with SMTP id f188mr8071804pgc.165.1541094605708; Thu, 01 Nov 2018 10:50:05 -0700 (PDT) Received: from localhost ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id m20-v6sm38421157pfj.171.2018.11.01.10.50.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Nov 2018 10:50:04 -0700 (PDT) Date: Thu, 01 Nov 2018 10:50:04 -0700 (PDT) X-Google-Original-Date: Thu, 01 Nov 2018 10:49:38 PDT (-0700) Subject: Re: [RFC 0/2] RISC-V: A proposal to add vendor-specific code In-Reply-To: <20181101005541.GA25604@andestech.com> CC: Christoph Hellwig , anup@brainfault.org, zong@andestech.com, aou@eecs.berkeley.edu, Arnd Bergmann , greentime@andestech.com, linux-kernel@vger.kernel.org, vincentc@andestech.com, linux-riscv@lists.infradead.org, deanbo422@gmail.com From: Palmer Dabbelt To: alankao@andestech.com Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.