Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp534200rwe; Fri, 14 Apr 2023 06:35:18 -0700 (PDT) X-Google-Smtp-Source: AKy350YF3O/2WN7RGT0zXH0Xf87FI6JIyjPWmy923VEGbnUYhEHXbSrp0zzTafReJ7HCiJ71JfnC X-Received: by 2002:a17:903:11cd:b0:1a5:1f13:67fc with SMTP id q13-20020a17090311cd00b001a51f1367fcmr1809775plh.31.1681479318304; Fri, 14 Apr 2023 06:35:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681479318; cv=none; d=google.com; s=arc-20160816; b=V8B+WWPqDDiYg/E9tl+3AmVtWBUjoopOMn8tFqDXzCUZ4ZSk/ZkItSyS4dh25oBN9S ypHKWK5Q2ISu3JWI4hEqucSFyxFF7TyEAI/25VeYbXLbk+q9fbohCU0MAq06X2WOA2hU jVI66D7AlVydFOZzvm6wF5dFvHK5qeH9xWVDSX8D0D7vRIftZ9YPbiP4KYYn+OamQUbZ JUYIHiKATjE4yO/pqi6570vH3Eac45LrlxwXo3j5qS+Em4VLz5F5HwzNMDTZW499hkKD JT0Ra73voF7UY9ch6w5/CCMiaT8nBzvP5RxyOArv/rgtsmKQDyFG0k7xEzuYl533Rgop XuXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=UqWELnJrDe7BuruMG12W81uaIfaJFXX0L3V9rtdnaWU=; b=NY6pIrwByCCQDfjZdmlT/j1SHpXbAe1ucXLVqgaruDS00MV4daKzZyo9vmdLuwwjMa a61qRfz3Pl650Bld1Nvd4LRn90/9Q/dyxlA1svr+bIs07uVber7rew+fGL5Np/baPkAl wLd7OL+p42pZ0X8TZrJ2JWdW33GU5/kYoPCSlR5rFdl8EnJfUV7rUx1UOY4v28I2JYgP mKmRE1HbHLliYJlFoht9PBC11JvxvLkpmJtOe8iTmaD5yll3novseMOGfZOK6XLS/YWH TcC4h5j8Iqfq6H0VMlNiK3gKFxi//+fyLyGwjum1ZBUp6G9xLCYi5iG3fK0JjRgxJkEr Xynw== 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 j3-20020a170902c3c300b0019e69892709si4335444plj.596.2023.04.14.06.34.58; Fri, 14 Apr 2023 06:35:18 -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 S229744AbjDNN1t (ORCPT + 99 others); Fri, 14 Apr 2023 09:27:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229543AbjDNN1s (ORCPT ); Fri, 14 Apr 2023 09:27:48 -0400 X-Greylist: delayed 773 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 14 Apr 2023 06:27:45 PDT Received: from mx2.zhaoxin.com (mx2.zhaoxin.com [203.110.167.99]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB8CD6A59 for ; Fri, 14 Apr 2023 06:27:45 -0700 (PDT) X-ASG-Debug-ID: 1681478088-1eb14e638601c30001-xx1T2L Received: from ZXSHMBX2.zhaoxin.com (ZXSHMBX2.zhaoxin.com [10.28.252.164]) by mx2.zhaoxin.com with ESMTP id oaC3tpWSXUbpeUsq (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Fri, 14 Apr 2023 21:14:48 +0800 (CST) X-Barracuda-Envelope-From: TonyWWang-oc@zhaoxin.com X-Barracuda-RBL-Trusted-Forwarder: 10.28.252.164 Received: from zxbjmbx1.zhaoxin.com (10.29.252.163) by ZXSHMBX2.zhaoxin.com (10.28.252.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Fri, 14 Apr 2023 21:14:48 +0800 Received: from [10.32.65.162] (10.32.65.162) by zxbjmbx1.zhaoxin.com (10.29.252.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Fri, 14 Apr 2023 21:14:46 +0800 X-Barracuda-RBL-Trusted-Forwarder: 10.28.252.164 Message-ID: <7866e99a-df88-14fa-92ae-c5b5d176724b@zhaoxin.com> X-Barracuda-RBL-Trusted-Forwarder: 10.32.65.162 Date: Fri, 14 Apr 2023 21:14:17 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH] x86/cpufeatures: extend CPUID leaf 0xc0000001 support for Zhaoxin Content-Language: en-US X-ASG-Orig-Subj: Re: [PATCH] x86/cpufeatures: extend CPUID leaf 0xc0000001 support for Zhaoxin To: Borislav Petkov CC: , , , , , , , , , , , , , , , References: <20230414095334.8743-1-TonyWWang-oc@zhaoxin.com> <20230414104808.GBZDkvaJechZSM+SI9@fat_crate.local> From: Tony W Wang-oc In-Reply-To: <20230414104808.GBZDkvaJechZSM+SI9@fat_crate.local> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.32.65.162] X-ClientProxiedBy: ZXSHCAS2.zhaoxin.com (10.28.252.162) To zxbjmbx1.zhaoxin.com (10.29.252.163) X-Barracuda-Connect: ZXSHMBX2.zhaoxin.com[10.28.252.164] X-Barracuda-Start-Time: 1681478088 X-Barracuda-Encrypted: ECDHE-RSA-AES128-GCM-SHA256 X-Barracuda-URL: https://10.28.252.36:4443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at zhaoxin.com X-Barracuda-Scan-Msg-Size: 2276 X-Barracuda-BRTS-Status: 0 X-Barracuda-Bayes: INNOCENT GLOBAL 0.0000 1.0000 -2.0210 X-Barracuda-Spam-Score: -2.02 X-Barracuda-Spam-Status: No, SCORE=-2.02 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.107406 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,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 On 4/14/23 18:48, Borislav Petkov wrote: > On Fri, Apr 14, 2023 at 05:53:34PM +0800, Tony W Wang-oc wrote: >> Extend CPUID leaf 0xc0000001 to support SM2, SM3, SM4, PARALLAX, TM3, >> RNG2, PHE2, RSA. >> >> CPUID.(EAX=0xc0000001,ECX=0):EDX[bit 0] SM2 >> CPUID.(EAX=0xc0000001,ECX=0):EDX[bit 1] SM2_EN >> CPUID.(EAX=0xc0000001,ECX=0):EDX[bit 4] SM3 SM4 >> CPUID.(EAX=0xc0000001,ECX=0):EDX[bit 5] SM3_EN SM4_EN >> CPUID.(EAX=0xc0000001,ECX=0):EDX[bit 16] PARALLAX >> CPUID.(EAX=0xc0000001,ECX=0):EDX[bit 17] PARALLAX_EN >> CPUID.(EAX=0xc0000001,ECX=0):EDX[bit 20] TM3 >> CPUID.(EAX=0xc0000001,ECX=0):EDX[bit 21] TM3_EN >> CPUID.(EAX=0xc0000001,ECX=0):EDX[bit 22] RNG2 >> CPUID.(EAX=0xc0000001,ECX=0):EDX[bit 23] RNG2_EN >> CPUID.(EAX=0xc0000001,ECX=0):EDX[bit 25] PHE2 >> CPUID.(EAX=0xc0000001,ECX=0):EDX[bit 26] PHE2_EN >> CPUID.(EAX=0xc0000001,ECX=0):EDX[bit 27] RSA >> CPUID.(EAX=0xc0000001,ECX=0):EDX[bit 28] RSA_EN > > None of those flags are used in code, why do we need this patch? > The instructions about these flags can be executed at any privilege level. I think using these flags in kernel mode is a case. This patch shows the statement of these flags to the user mode explicitly. So users can see and use these CPU features conveniently. > If you want to dump them on the hardware to know what's set or not, > there's tools/arch/x86/kcpuid/ for that. > >> SM2/SM3/SM4 imply the instructions support for Chinese cipher security >> algorithm generations 2/3/4. >> PARALLAX is the feature of Zhaoxin CPU that automatically adjusts >> processors's voltage as a function of temperature. >> TM3 is the abbreviation of Thermal Monitor version 3. >> RNG2 is the abbreviation of Random Number Generation version 2. >> PHE2 is the abbreviation of Padlock Hash Engine version 2. >> RSA implies Zhaoxin hardware support for RSA algorithm. >> >> All these features have two relative CPUID bits, one bit implies the >> existence of the feature and the other bit with postfix "EN" implies >> the availability of this feature. > > That's a lot of waste of CPUID bits but that's your decision. > Sorry about that. This implementation aimed to control or statement these features independently. Sincerely TonyWWangoc