From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755054AbdK1LSN (ORCPT ); Tue, 28 Nov 2017 06:18:13 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:11445 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754993AbdK1LR6 (ORCPT ); Tue, 28 Nov 2017 06:17:58 -0500 To: , "mark.rutland@arm.com" , Linux Kernel Mailing List From: gengdongjiu Subject: [question] extract the feature bits width to 4 Message-ID: <17ab0a11-7ca2-ff22-35d6-7446dbccc3ea@huawei.com> Date: Tue, 28 Nov 2017 19:17:40 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.142.68.147] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090201.5A1D45DD.00DA,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 24d2561595709058c0aca30a936eaf60 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi,suzuki/mark, very sorry to disturb you, I have a question that want to consult with you. For the CPU feature detection, why we use extract 4 bits width for the feature match instead of the actual bits number[1]? may be the actual hardware feature bit more than 4 bits. thanks! static inline int __attribute_const__ cpuid_feature_extract_field(u64 features, int field, bool sign) { return cpuid_feature_extract_field_width(features, field, 4, sign); } static bool feature_matches(u64 reg, const struct arm64_cpu_capabilities *entry) { int val = cpuid_feature_extract_field(reg, entry->field_pos, entry->sign); return val >= entry->min_field_value; }