Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1074159iog; Fri, 17 Jun 2022 23:12:37 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ts8U2SOdgytI+y91l97HJFFvt7olyxaaKDHGXokttA4NKjlzZqGNADMq8F+eMRBOqmN+vo X-Received: by 2002:a05:6402:3322:b0:42d:f984:92fa with SMTP id e34-20020a056402332200b0042df98492famr16431628eda.106.1655532757120; Fri, 17 Jun 2022 23:12:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655532757; cv=none; d=google.com; s=arc-20160816; b=LeaHb9mFQu60ZRVImTvnzzzjIhYlmzLlcQAJdW5wU+1psox9dMf3m9N4hU4RyS6qI6 i390IB868CRY3Ny0rAmrRjSzL8q97Aa3CtmzpBpAsQmI7BCu9DQS6Jl2CX3k92eoSUJV srzeceLq6HLyAGhz6X3yh7k1LKOhNTuQDpvBiCQdtb+5Kz3naJ6mBTtOEa7D9VKz8Hta t7LiFD8mPC9p1Q3KAzLL2zdl3xzdr4mAi0btJvr7upvAkxZSo8BCPUT4ZdzeZhl+oj6K ntrrncNS0E6AHUs3lpUiJb/LsorzkS8X5+M7PvYHQRhNXLlvk6zhfmRJK7treLdHqjIt xqrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=JubV1plKV6+fUQj4icCr70xefpb3+XQaocBR6vCAop4=; b=j2bQJQnEUzKlcQ6RZ3HpF6IKbwV0HGDcIQiPZCBZxRgUWyc8iYVjyIoHLYauDyNOeq P+MCh7XdEPYoBcfsyymigBkWWIns3B7EiW1b7/WqkCyLisGag9aZ6HJiagbtyFuDN4GR 10SEGXLihouxz1COfJE/Jmppfb7Orc7DZIbbPEffass7tluQWJtPRtYxppFpywxBY8Ys jxUpquQ7ko9b9PlELl1wuQ0nsbQyusJIVL6x3fya6pS91zY9rUtxJN7fLysb+Bn1k+Nn m+ztUWgMJ54OuZmFbxR4vnSGmhpWXmfKvYweEX1lsk6izhFe6d6jJisDU7rgpz2VtMIi Pfzw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j7-20020a05640211c700b00435583af2b3si6712660edw.86.2022.06.17.23.12.11; Fri, 17 Jun 2022 23:12:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231355AbiFREui (ORCPT + 99 others); Sat, 18 Jun 2022 00:50:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229478AbiFREuh (ORCPT ); Sat, 18 Jun 2022 00:50:37 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EDB3F50079 for ; Fri, 17 Jun 2022 21:50:34 -0700 (PDT) Received: from linux.localdomain (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9Dx70yXWa1icBlKAA--.14762S2; Sat, 18 Jun 2022 12:50:32 +0800 (CST) From: Tiezhu Yang To: Huacai Chen , WANG Xuerui Cc: Xuefeng Li , linux-kernel@vger.kernel.org Subject: [PATCH] LoongArch: Fix wrong fpu version Date: Sat, 18 Jun 2022 12:50:31 +0800 Message-Id: <1655527831-3661-1-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-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C2KfnxnUUI43ZEXa7VUjoa0DUUUUU== X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org According to the configuration information accessible by the CPUCFG instruction in LoongArch Reference Manual [1], FP_ver is stored in bit [5: 3] of CPUCFG2, the current code to get fpu version is wrong, use CPUCFG2_FPVERS to fix it. [1] https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html Fixes: 628c3bb40e9a ("LoongArch: Add boot and setup routines") Signed-off-by: Tiezhu Yang --- arch/loongarch/kernel/cpu-probe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/loongarch/kernel/cpu-probe.c b/arch/loongarch/kernel/cpu-probe.c index 6c87ea3..529ab8f4 100644 --- a/arch/loongarch/kernel/cpu-probe.c +++ b/arch/loongarch/kernel/cpu-probe.c @@ -263,7 +263,7 @@ void cpu_probe(void) c->cputype = CPU_UNKNOWN; c->processor_id = read_cpucfg(LOONGARCH_CPUCFG0); - c->fpu_vers = (read_cpucfg(LOONGARCH_CPUCFG2) >> 3) & 0x3; + c->fpu_vers = (read_cpucfg(LOONGARCH_CPUCFG2) & CPUCFG2_FPVERS) >> 3; c->fpu_csr0 = FPU_CSR_RN; c->fpu_mask = FPU_CSR_RSVD; -- 2.1.0