Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3616197rwi; Wed, 12 Oct 2022 04:45:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4pbIOSLlzDylww+k0D9PeQnCgMiM+1tWBqiGc0dRWrv6PUfEP+QN2LacuC/jtvGFPTqJ1X X-Received: by 2002:a17:90a:6405:b0:203:6eaa:4999 with SMTP id g5-20020a17090a640500b002036eaa4999mr4751586pjj.8.1665575136125; Wed, 12 Oct 2022 04:45:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665575136; cv=none; d=google.com; s=arc-20160816; b=hwmh9xa7Q7QfNlXcuB6aKoBKY/ZxVW48bnsmCqDTxIa4bGAlq8WdkYTqpufHBAEAlj mvdnbM8iTtPdy1fxtoSA0/UsNH+9YsbR8ZL/9eaSwSWcpohPPsV4ADFO49rHNwtPyb2c 1j5FLVA9AuQzNbfxKxnMi0h0kmEgvtwwl6DdKEOus3XjNQBaR/oHxLB0/JDcyw8Du6Qe 4anJ2Yc6HudzwopHiuOO3gt2fBOLWhduGJy7iBqfLclKm8W2etWW4FdnMewff8F4NvoB 39amNxvQfCGDsu7Mzs3t9H3oD6yzS24jg+dQjekeS7Nnr63G4QbFfrreDOa5vWpppSUR Xh0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=IFFgWBEJb2JXtDCY4OEeErncx9gsRnIWb2vs8iP4pwY=; b=LSsrTtgW53gTuhbUcN3m6Rzxh2iWFBU7CwEEZQeeaCrcSSOzuiHRWiIz1k3rYxD0Xo 2OZk3vkWATX8FnfrztSz0JfxnaMGmy6iTLo9OqZTc7gPUnH0gAqLbT4EGifHeKJOTp/f WLOgVqWBvy8+umR+PkIC7fQylfJDhhqiomwqdS4pFxVjbULK7rKxGL2EXPT8O9ffNQCp QLGZbgotUmqt7qa035vXITV4jb7DF0CRzkL66BQUZeMiuuVJwGa7xl9cP5ukO2auXxrv WQQ/TFtNDaFN2+Fp5VDNKQpSCddNbcA8X8v8S5R25efDfLol2UFnlujvYW8V+8Wb8aqp hCqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xen0n.name header.s=mail header.b=YInqk2tX; 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 s8-20020a170902988800b00174cfdbe39bsi16976790plp.89.2022.10.12.04.45.23; Wed, 12 Oct 2022 04:45:36 -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; dkim=pass header.i=@xen0n.name header.s=mail header.b=YInqk2tX; 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 S229749AbiJLLN3 (ORCPT + 99 others); Wed, 12 Oct 2022 07:13:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229693AbiJLLNI (ORCPT ); Wed, 12 Oct 2022 07:13:08 -0400 Received: from mailbox.box.xen0n.name (mail.xen0n.name [115.28.160.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADAEFC2C96 for ; Wed, 12 Oct 2022 04:13:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xen0n.name; s=mail; t=1665573181; bh=jQXI5aEReKrw+ZRZjXWpuy3D8HVFbu5pIl125t8w5MA=; h=From:To:Cc:Subject:Date:From; b=YInqk2tXDllQoaKT8SucQez+0E2IhD+nG3xXtlMN3R1btmb5/JqcpxxxIK//2m/ib INpXBiREeIuwhCsrF1PyMWMFcLviOZxsoscEoMPhulmLn4rdSrsit+2KSF8Vhdz2nC YoxTD/DCAKibg5q494Tnp0z2P7dnez0l05hUsIVE= Received: from ld50.lan (unknown [101.88.135.226]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mailbox.box.xen0n.name (Postfix) with ESMTPSA id 334E1600CF; Wed, 12 Oct 2022 19:12:59 +0800 (CST) From: WANG Xuerui To: Huacai Chen Cc: WANG Xuerui , loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH] LoongArch: Expose LBT features in cpuinfo and ELF HWCAP Date: Wed, 12 Oct 2022 19:12:54 +0800 Message-Id: <20221012111254.3194431-1-kernel@xen0n.name> X-Mailer: git-send-email 2.38.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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 From: WANG Xuerui Although proper context switching support for LBT is not present yet, this fixes an apparent oversight where other similarly not-yet-supported features e.g. LSX, LASX, Crypto, or LVZ are being reported but the LBT ones are not. Fixes: 628c3bb40e9a ("LoongArch: Add boot and setup routines") Signed-off-by: WANG Xuerui Cc: loongarch@lists.linux.dev Cc: linux-kernel@vger.kernel.org --- arch/loongarch/kernel/cpu-probe.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/loongarch/kernel/cpu-probe.c b/arch/loongarch/kernel/cpu-probe.c index 529ab8f44ec6..82de5264d2c9 100644 --- a/arch/loongarch/kernel/cpu-probe.c +++ b/arch/loongarch/kernel/cpu-probe.c @@ -123,6 +123,18 @@ static void cpu_probe_common(struct cpuinfo_loongarch *c) c->options |= LOONGARCH_CPU_LVZ; elf_hwcap |= HWCAP_LOONGARCH_LVZ; } + if (config & CPUCFG2_X86BT) { + c->options |= LOONGARCH_CPU_LBT_X86; + elf_hwcap |= HWCAP_LOONGARCH_LBT_X86; + } + if (config & CPUCFG2_ARMBT) { + c->options |= LOONGARCH_CPU_LBT_ARM; + elf_hwcap |= HWCAP_LOONGARCH_LBT_ARM; + } + if (config & CPUCFG2_MIPSBT) { + c->options |= LOONGARCH_CPU_LBT_MIPS; + elf_hwcap |= HWCAP_LOONGARCH_LBT_MIPS; + } config = read_cpucfg(LOONGARCH_CPUCFG6); if (config & CPUCFG6_PMP) -- 2.38.0