Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp7842982ybl; Thu, 16 Jan 2020 06:32:43 -0800 (PST) X-Google-Smtp-Source: APXvYqwQ/J1pQKvincPH95CyEMyv0kZlGGP4Qsk1Xr0za+GwJddcVXzWih26qGzotDfSBI1r0qQp X-Received: by 2002:a05:6808:10d:: with SMTP id b13mr4272233oie.69.1579185163753; Thu, 16 Jan 2020 06:32:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579185163; cv=none; d=google.com; s=arc-20160816; b=LBq86laUFsPSNnAIt90btpcrz1sdNs5/08qVWv7g2IjV3G3xT+o8QvIfzdppO044KG f4qHivdCRJ4DrWIHLpH5Si2zqkFy3k3HnkYSJ3IAiUpn4wueDq9kwPTdCbrnw0k3P4qD 3L02OP5yCDXB5Lxms/Wpwd2npqmlo3eBo3i9fz042iqQE89qg8WS48g8TPJbLf+Xnm2r WxJm7VrTVEiWoOX0ij3u0zRbSiT3BX+OoP95RjsixVPAcTBPz6kA/iibhc0Fo6lrleMx eXEUJy9O4cKGQ+e8q98JEFGUNWPglrMXfmuRSr/6aNgyvGPnzv3jn8tytcuKG+25kgzW e+Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=hbtwPXrWoZv9bWzmHEC/Oim/IpJdlGcSPakqLgyOCAA=; b=L7SFECjxTuXUe4JwJ2Na6KD/W+LJk1QXQqLArZpiz07QhnanAa+LOljF8ln0z2P03r WpNJqwzPP+1HvgOV5yKoYTq4U7XRPeO+eEYvrbkj0nkt3cBR7m5lPwy+4vJkgHXBaw3x Dqu5lto2U4a8aEUldAzcjf+LArPJ+TOt0hvBYMrqacVUAx9V4SNG/Miq8iRfpHnbnAXE pbtUFwJx9ohZoXhPhOrxFOjdVj1V6G+pengqWojprMcc++DT+JHzetQcVKq+dsQ8nUJZ 9ZLYWvH0juydNV95f860Ah1AKAanBc+COmb492bBF1u71OZ/I22OBqHkNkvoBOcxwdfL vCtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=C6rSz7HJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p24si807922otq.194.2020.01.16.06.32.29; Thu, 16 Jan 2020 06:32:43 -0800 (PST) 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=@kernel.org header.s=default header.b=C6rSz7HJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726744AbgAPObQ (ORCPT + 99 others); Thu, 16 Jan 2020 09:31:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:55162 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726088AbgAPObQ (ORCPT ); Thu, 16 Jan 2020 09:31:16 -0500 Received: from localhost.localdomain (unknown [223.93.147.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DA34B2051A; Thu, 16 Jan 2020 14:31:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579185075; bh=aNIZP0dqOD9QCY2VJP0mhbwIgadV/RggmEj83ztZ9Dk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C6rSz7HJ5DXz5+He4/0Lr83XYdV6HdCf3vazyo+RITOP/jrNw386F/7pJF55ck3Ys uL2IDoR+zNYPvlzj/urPIJNVQnjt1Havb17BL/qjzM1Ekfc3euBGHALlVZtJ0xWzyP inxH1npqGMN80RdmoccjfMu/oFEJ1pv+uerzPILg= From: guoren@kernel.org To: paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, Anup.Patel@wdc.com, vincent.chen@sifive.com, zong.li@sifive.com, greentime.hu@sifive.com, bmeng.cn@gmail.com, atish.patra@wdc.com, schwab@linux-m68k.org Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, arnd@arndb.de, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org, Guo Ren Subject: [PATCH V2 3/4] riscv: Extending cpufeature.c to detect V-extension Date: Thu, 16 Jan 2020 22:30:28 +0800 Message-Id: <20200116143029.31441-3-guoren@kernel.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20200116143029.31441-1-guoren@kernel.org> References: <20200116143029.31441-1-guoren@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Guo Ren Current cpufeature.c doesn't support detecting V-extension, because "rv64" also contain a 'v' letter and we need to skip it. Signed-off-by: Guo Ren Cc: Anup Patel --- arch/riscv/include/uapi/asm/hwcap.h | 1 + arch/riscv/kernel/cpufeature.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/riscv/include/uapi/asm/hwcap.h b/arch/riscv/include/uapi/asm/hwcap.h index dee98ee28318..a913e9a38819 100644 --- a/arch/riscv/include/uapi/asm/hwcap.h +++ b/arch/riscv/include/uapi/asm/hwcap.h @@ -21,5 +21,6 @@ #define COMPAT_HWCAP_ISA_F (1 << ('F' - 'A')) #define COMPAT_HWCAP_ISA_D (1 << ('D' - 'A')) #define COMPAT_HWCAP_ISA_C (1 << ('C' - 'A')) +#define COMPAT_HWCAP_ISA_V (1 << ('V' - 'A')) #endif /* _UAPI_ASM_RISCV_HWCAP_H */ diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index a5ad00043104..c8527d770c98 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -30,6 +30,7 @@ void riscv_fill_hwcap(void) isa2hwcap['f'] = isa2hwcap['F'] = COMPAT_HWCAP_ISA_F; isa2hwcap['d'] = isa2hwcap['D'] = COMPAT_HWCAP_ISA_D; isa2hwcap['c'] = isa2hwcap['C'] = COMPAT_HWCAP_ISA_C; + isa2hwcap['v'] = isa2hwcap['V'] = COMPAT_HWCAP_ISA_V; elf_hwcap = 0; @@ -44,7 +45,8 @@ void riscv_fill_hwcap(void) continue; } - for (i = 0; i < strlen(isa); ++i) + /* Skip rv64/rv32 to support v/V:vector */ + for (i = 4; i < strlen(isa); ++i) this_hwcap |= isa2hwcap[(unsigned char)(isa[i])]; /* -- 2.17.0