Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4541057pxb; Mon, 27 Sep 2021 20:52:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyW5SSVSj5ya6OdlKroAc7tWeFqzu/Xia4agFya9yTXYGIes/iHYmIya4ShMdg/oAVSl/L4 X-Received: by 2002:a50:e101:: with SMTP id h1mr4897415edl.245.1632801145068; Mon, 27 Sep 2021 20:52:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632801145; cv=none; d=google.com; s=arc-20160816; b=iu+c/J5ckZoTzn0VzHLUSmIIRvJM0t4kq+0T00ogw6gTyzVnfOSPrsVyeZy+9c8t1M 1ZCr01rSUjbqTvVYf9T7i99Yue1DKb6+tt6ZykWica38D3RTqtnKNRNwDLdz2n1l2jlL bGBl6M1FsW7SqTKQ+XUE+z9sdC0fnYNSAdK19av0no0v6rSSHpbLSoDgxfnJU7rLn/dM zQeSJ1HHRKwyoJX/zJ5l5+M37qZucHFaIrkswXorFv4MrAEwYWX72aDrlrWaF0zn1O+T dAXtw/Rb8LXFTe5LrYyJOvKawHdrbivYntRQJ4/E0AH/DDuXnJ7wmNkuEjApo3Iu/dH+ uMVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=GGTQElJtl5mpUB6QPkkm10aMhOfJ7ChPo3DKsQZG/IM=; b=VefCIcLZbCue+21YLDwtnYC0w/h92OUE+zfBWIBQOGA9YHqDJeJW6y+TkfPgCg/3/U yX6v2SaNpVSlUqN662ARCuf3soz2BfCacI4qDck818MFKhJ7Ln/xFAR1/mJg+z/3xBGZ oqBz5uQ2kBoc1oS1Fnfq6rp//LdzpmgFowGxkdmPmcs6xZsnRKKpqZwE4L1XhPstkmEO 5SiUWb+4BaYX9W3wxKwO9ghvPTfu84a9WFmKFMRdQrRUrVVOIk9rkTtp+G9R4hJcGC5X 0C2oF5wlqT2UTFINnzBNw5hFlTNxFJoU/2NDxGdFz6I3heI7O8fwltjZKBgpLOvIwIm5 XoWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20210112.gappssmtp.com header.s=20210112 header.b=4aWrxSP5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z29si21879542edl.497.2021.09.27.20.52.01; Mon, 27 Sep 2021 20:52:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@brainfault-org.20210112.gappssmtp.com header.s=20210112 header.b=4aWrxSP5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238878AbhI1DwR (ORCPT + 99 others); Mon, 27 Sep 2021 23:52:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238850AbhI1DwL (ORCPT ); Mon, 27 Sep 2021 23:52:11 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE18BC061575 for ; Mon, 27 Sep 2021 20:50:31 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id g16so55485117wrb.3 for ; Mon, 27 Sep 2021 20:50:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=GGTQElJtl5mpUB6QPkkm10aMhOfJ7ChPo3DKsQZG/IM=; b=4aWrxSP5DQIFQrbo7iVY+qyKl54ratZ5R+7yXw+fPvYcfNqzMl3s23B/z5fi6lRMtd vTolleMK8gGQ4xj/0he5l4aSkQ0H0ADrEYwH3H5NzAYGolhhk/aGH+rvA8+rpQ8PFpj8 8qM//UJieTlE4u4+M8R/VftCz66yydY211gYotIjtuYPlZs20/3sAuiIFRcSk26dfUon KILFOsFkep1l5Traig1MFsXSR1KlCkQgHIFpyAFg2zbHKDzQdwtTju2/9Y2L/QafDH7D 199sh+G7yNaZO1CaDeQFs6+9ZxvXWvku/Fip17hsOiRlEuBaJ7N0+j8nRMs/yFGoKhao dMtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=GGTQElJtl5mpUB6QPkkm10aMhOfJ7ChPo3DKsQZG/IM=; b=l6CuCbSHBYAc/mBd56MdBFF9bfc43FjHYPoOjsu6LGBRCH5Wmz1/8PfBqUknEmTJ/1 KHGOSK3DQO19VyjStsuIYmqig0Wjk1NMY1LExaULNFSPwhMMxBX0KDRCzYxU6mTAwhYN eF0dW8/W61y5pjVqtuuV4Eak9H+cb7e6loUY6YzyXcW05q3K0BjOYM4zA5DP/h5LzRmc icbOvflLcDFyJPPWt/rO4Hqm8HMMJjfaG3TwqhR++d7ddMA1yI/6e9peec4Exi3d+lKy Ml9kuMtXH0Uu1ecbPbt6iboF326wBI7+nfPjuiVxNBp+JVG/3s1VGrxQlORLX3DbHdwm WExg== X-Gm-Message-State: AOAM531y4lGOh3wr+sdmGbQ7xlprbjra/i8Fywxy/A+j9LWTMzbAtu89 FW3VGxOgxPM3LkV17Gr+4B1+SMQ+MKjfUlUvOha1hg== X-Received: by 2002:adf:e387:: with SMTP id e7mr3941847wrm.199.1632801029905; Mon, 27 Sep 2021 20:50:29 -0700 (PDT) MIME-Version: 1.0 References: <20210923172107.1117604-1-guoren@kernel.org> <0790abcfa1174e0e9b5e7b185f87ced9@mailhost.ics.forth.gr> In-Reply-To: <0790abcfa1174e0e9b5e7b185f87ced9@mailhost.ics.forth.gr> From: Anup Patel Date: Tue, 28 Sep 2021 09:20:18 +0530 Message-ID: Subject: Re: [PATCH V2 1/2] riscv: Add RISC-V svpbmt extension To: Nick Kossifidis Cc: Atish Patra , Guo Ren , Palmer Dabbelt , Anup Patel , Atish Patra , Palmer Dabbelt , =?UTF-8?Q?Christoph_M=C3=BCllner?= , Philipp Tomsich , Christoph Hellwig , liush , wefu@redhat.com, =?UTF-8?B?V2VpIFd1ICjlkLTkvJ8p?= , Drew Fustini , linux-riscv , "linux-kernel@vger.kernel.org List" , taiten.peng@canonical.com, Aniket Ponkshe , Heinrich Schuchardt , Gordan Markus , Guo Ren , Arnd Bergmann , Chen-Yu Tsai , Maxime Ripard , Daniel Lustig , Greg Favor , Andrea Mondelli , Jonathan Behrens , Xinhaoqu , Bill Huffman , Allen Baum , Josh Scheid , Richard Trauben Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 28, 2021 at 6:32 AM Nick Kossifidis wrote: > > =CE=A3=CF=84=CE=B9=CF=82 2021-09-27 23:13, Atish Patra =CE=AD=CE=B3=CF=81= =CE=B1=CF=88=CE=B5: > >> We need to decide whether we should support the upstream kernel for > >> D1. Few things to consider. > >> =E2=80=93 Can it be considered as an errata ? > > It's one thing to follow the spec and have an error in the > implementation, and another to not follow the spec. > > >> =E2=80=93 Does it set a bad precedent and open can of worms in future = ? > > IMHO yes, I'm thinking of Kendryte 210 devs for example coming up and > asking for MMU support, they 've also shipped many chips already. I can > also imagine other vendors in the future coming up with implementations > that violate the spec in which case handling the standard stuff will > become messy and complex, and hurt performance/security. We'll end up > filling the code with exceptions and tweaks all over the place. We need > to be strict about what is "riscv" and what's "draft riscv" or "riscv > inspired", and what we are willing to support upstream. I can understand > supporting vendor extensions upstream but they need to fit within the > standard spec, we can't have for example extensions that use encoding > space/csrs/fields etc reserved for standard use, they may only use > what's reserved for custom/vendor use. At least let's agree on that. Totally agree with Nick here. It's a slippery slope. Including D1 PTE bits (or Kendryte K210 MMU) part of the Linux RISC-V means future hardware which intentionally violates specs will also have to be merged and the RISC-V patch acceptance policy will have no significance. > > >> =E2=80=93 Can we just ignore D1 given the mass volume ? > >> > > IMHO no, we need to find a way to support it upstream but I believe > there is another question to answer: > > Do we also guarantee "one image to rule them all" approach, required by > binary distros, for implementations that violate the spec ? Are we ok > for example to support Allwinner D1 upstream but require a custom > configuration/build instead of supporting it with the "generic" image ? > In one case we need to handle the violation at runtime and introduce > overhead for everyone (like looking up __riscv_svpbmt every time we set > a PTE in this case), in the other it's an #ifdef. At least, we should not have hardware violating specs as part of the unified kernel image instead have these intentional deviations/violations under separate kconfig which will not be enabled by default. This means vendors (of such hardware) and distros will have to explicitly enable support for such violations/deviations. Regards, Anup