Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp6767515imm; Tue, 28 Aug 2018 00:12:44 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZAXvksNxyjK+foh2sR//itkR7ESkc09xnt9IyqSr0vWLfqJWtQEjMEymKkrEhsfh9ODgu6 X-Received: by 2002:a17:902:8345:: with SMTP id z5-v6mr279203pln.147.1535440364161; Tue, 28 Aug 2018 00:12:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535440364; cv=none; d=google.com; s=arc-20160816; b=oFl65fZFpzY4nupGyZGAjV4z2cy9ej5DhdY1yH01dnkkXGot/0yqN445Oa4zjzkl1p eTjk9pi6VhWTqYPWC8JrQT90OqXPipQO3l9OS8cgC40D3RnK4x8P+YM/9kS33ib82duY nvcilj2nYbWmQ/8Xi2eT30aTPabchxZaw2Q5yJPT6VI04XZxT/oMYxoBMfzWR/igZiOu UWt/IwjZn9J0gZ9i531ywX+EK0pZW05CVRkJ+bA/ftQSnEY2iq6KqSqc/ztx8VKywaGu MLPcBxck5g2wG8pQslULM7r9LH8wIE1tvEHwDgdyLNMLzMI9G3wk7P2mR6dN8/Rw7sEX XGjg== 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:arc-authentication-results; bh=pbRdPMJT11yrSJha5G16e05otutiYZglsp2pyNDV77U=; b=rZc5YY1pTfni0IEH7VvA+5tv/qSgTJyXu7VO93fyNKK9AIYGXzdLKIsF6IrRiKzhSo 9BHWlDihz/rSXtLHmOkGkbg1Sj+Ix7wPbBIxo07zfOSM2gLn8kq3oIIRBAe9hjcCtLT0 bt5Cy7Ye3O8GWQKfjvwRWglo2CMHM91w4KKcQbSnDY/QcHjOyXEwmoEbKh3dMREKYsYQ c0RVA/QQl1iVl1+uhlSBpF8eWFfY/GVaTAG2ybBOvZ2LZKdAPy4nOiUqzqXt7R7yX5CV eKdZNyR3Ru4wL4n0CLXPqUsjgsANqE8akDQ3zxko4JKVGBfmqmQ+xFGViwGBsiH3Hufj cN2g== 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 a8-v6si283250pgm.201.2018.08.28.00.12.28; Tue, 28 Aug 2018 00:12:44 -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 S1727240AbeH1LBV (ORCPT + 99 others); Tue, 28 Aug 2018 07:01:21 -0400 Received: from exmail.andestech.com ([59.124.169.137]:29445 "EHLO ATCSQR.andestech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726446AbeH1LBU (ORCPT ); Tue, 28 Aug 2018 07:01:20 -0400 Received: from mail.andestech.com (atcpcs16.andestech.com [10.0.1.222]) by ATCSQR.andestech.com with ESMTP id w7S781Xu039142; Tue, 28 Aug 2018 15:08:02 +0800 (GMT-8) (envelope-from alankao@andestech.com) Received: from andestech.com (10.0.1.85) by ATCPCS16.andestech.com (10.0.1.222) with Microsoft SMTP Server id 14.3.123.3; Tue, 28 Aug 2018 15:10:31 +0800 Date: Tue, 28 Aug 2018 15:10:32 +0800 From: Alan Kao To: Palmer Dabbelt CC: , , , Subject: Re: [PATCH] RISC-V: Mask out the F extension on systems without D Message-ID: <20180828071032.GA16806@andestech.com> References: <20180827220352.24301-1-palmer@sifive.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20180827220352.24301-1-palmer@sifive.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Originating-IP: [10.0.1.85] X-DNSRBL: X-MAIL: ATCSQR.andestech.com w7S781Xu039142 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Palmer, On Mon, Aug 27, 2018 at 03:03:52PM -0700, Palmer Dabbelt wrote: > The RISC-V Linux port doesn't support systems that have the F extension > but don't have the D extension -- we actually don't support systems > without D either, but Alan's patch set is rectifying that soon. For now > I think we can leave this in a semi-broken state and just wait for > Alan's patch set to get merged for proper non-FPU support -- the patch > set is starting to look good, so doing something in-between doesn't seem > like it's worth the work. > > I don't think it's worth fretting about support for systems with F but > not D for now: our glibc ABIs are IMAC and IMAFDC so they probably won't > end up being popular. We can always extend this in the future. > > CC: Alan Kao > Signed-off-by: Palmer Dabbelt > --- > arch/riscv/kernel/cpufeature.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c > index 17011a870044..652d102ffa06 100644 > --- a/arch/riscv/kernel/cpufeature.c > +++ b/arch/riscv/kernel/cpufeature.c > @@ -57,5 +57,12 @@ void riscv_fill_hwcap(void) > for (i = 0; i < strlen(isa); ++i) > elf_hwcap |= isa2hwcap[(unsigned char)(isa[i])]; > > + /* We don't support systems with F but without D, so mask those out > + * here. */ > + if ((elf_hwcap & COMPAT_HWCAP_ISA_F) && !(elf_hwcap & COMPAT_HWCAP_ISA_D)) { > + pr_info("This kernel does not support systems with F but not D"); > + elf_hwcap &= ~COMPAT_HWCAP_ISA_F; > + } > + The commit message does address the problem and this patch does provide checks and helpful information to users, but I wonder if we really need this patch, for two reasons: * Just as you mentioned, current glibc ABI does not support such a thing as IMAFC, so probably no one has had trouble with this. To be honest, I suppose that anybody (RISC-V enthusiasts or vendors) who really need F-only support in kernel should get themself involved in the development by sending patches to improve. * There are corner cases to let a F-only machine to pass the check in this patch. For instance, a vendor decides to name her extension ISA as doom, and supports single-precision FP only, so her ISA string would be IMAFCXdoom. The variable elf_hwcap is calculated at the loop in line 57,58, the 'd' from Xdoom would bypass the check, while the underlying machine does not support double-precision FP. > pr_info("elf_hwcap is 0x%lx", elf_hwcap); > } > -- > 2.16.4 > I don't know if the reasons make sense to you, but anyway that's all I would like to say about this patch. Alan