Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp446727pxu; Fri, 11 Dec 2020 06:15:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJzCZNgZwjteo1XV/nN27dgbqr+P1+lOMKwZJszR0jY185SUacIQuEAgCCeHqPiJ6oHl2Fow X-Received: by 2002:aa7:cfd7:: with SMTP id r23mr11969698edy.298.1607696111909; Fri, 11 Dec 2020 06:15:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607696111; cv=none; d=google.com; s=arc-20160816; b=vEJHwIkSa/vjW1iMMyua9bYLQp95PY0oC+iSZ3q08zUtjbB0Eg4Xv5m0aMmS45uTj5 oyHJ8SNEwGSr08UYugA3zbK4lNHWD6PMDvPfMQpL/ig7REctSxENQGyAOik+VTxjrZbH og9aaACerysHMTt2qAG8XgRwGYHAssVNK3+Og82fZX5FPACEY8sPu9u6WVMRvnQVtZC9 2QdJmnRJiLL3mogscDeiRsDL2bhBjxrVrzRx0Ec9lq9VicNRi4mfJ6d7nPCwruYgQnPs S6ec8I2Eb/udpaIJurRqqj268YInpyvSFVCwR0aiApoUyGUoaatpzYO6uMS1sDHBHTG3 KXRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rMzTkRBHUwuuyWZIHH9a6s635U0L90G4G36xFMgcyhQ=; b=C3pK52YNmVa/UW8hSLs+DbGmG5o1XSV+iKWPGGX7C5ZG1uhtL2mhfp+oLiOJF6VrxS idERr4KfckP43h5wtbieLpjZqNzVMuW4GxDUSq4wjHY3L4wS2KEMUBP2rA8CgEgvqEsZ T/pUN/6nnpCWeyyWcSdrqGNNEAmBDsaKYbhrVlk1rNkO/Mk4f8vLcBPdOAXeMHJ9e8JV qxHQCZVxNF2GQ1zgzeBhPjVa9bq0YJJcXg/carrVCofJL6UWnYVwZbeiaELy6HotfRC7 ReA2FSj44MBnZSbP0JSc7+pNZOHYmyS917focJhnuFJmwSIn4q+Tlh1jDBVl0H1Ciz5I H6BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=SOQLHFFA; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x13si4421142ejb.243.2020.12.11.06.14.47; Fri, 11 Dec 2020 06:15:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=SOQLHFFA; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405989AbgLKNC3 (ORCPT + 99 others); Fri, 11 Dec 2020 08:02:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391594AbgLKNCD (ORCPT ); Fri, 11 Dec 2020 08:02:03 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDDAAC0613CF; Fri, 11 Dec 2020 05:01:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=rMzTkRBHUwuuyWZIHH9a6s635U0L90G4G36xFMgcyhQ=; b=SOQLHFFA+ehnBJ6pZS21QAMZ2c +GapFcfuB5gMQaGWgZxgCIOLVTNEN0MLdahOuJ433N4ftNOGaGGzrkTGK3YWXWHbD191JZV/+5+5y EmM31xnO2wyysHgltCGQfzZOMH8iVQ/skAxfvmBa6Z9OZf2PLXJzLlu0+Jy1WzG0XndSoYXHS3Btb Pn4HGZo+fw94dSBKWO8puOxBHnbFTzNt69RleROZ7grLB6i7OaiRVistU90KytjQL4ryLqC91URkH KSukG70kZhkCzEG67gLomMPn+ZZTdoJxGtLsDNBsYwGayHKM0DRLf7ues3fIG1C4gBWdBTMy4q2Z5 tA+ymCXw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kni2g-00036R-5c; Fri, 11 Dec 2020 13:01:02 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id B43883003E5; Fri, 11 Dec 2020 14:00:58 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 9D8D221BE8D82; Fri, 11 Dec 2020 14:00:58 +0100 (CET) Date: Fri, 11 Dec 2020 14:00:58 +0100 From: Peter Zijlstra To: Tony W Wang-oc Cc: herbert@gondor.apana.org.au, davem@davemloft.net, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, TimGuo-oc@zhaoxin.com, CooperYan@zhaoxin.com, QiyuanWang@zhaoxin.com, HerryYang@zhaoxin.com, CobeChen@zhaoxin.com, SilviaZhao@zhaoxin.com, thomas.lendacky@amd.com Subject: Re: [PATCH] crypto: x86/crc32c-intel - Don't match some Zhaoxin CPUs Message-ID: <20201211130058.GZ2414@hirez.programming.kicks-ass.net> References: <1607686144-2604-1-git-send-email-TonyWWang-oc@zhaoxin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1607686144-2604-1-git-send-email-TonyWWang-oc@zhaoxin.com> Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Fri, Dec 11, 2020 at 07:29:04PM +0800, Tony W Wang-oc wrote: > The driver crc32c-intel match CPUs supporting X86_FEATURE_XMM4_2. > On platforms with Zhaoxin CPUs supporting this X86 feature, When > crc32c-intel and crc32c-generic are both registered, system will > use crc32c-intel because its .cra_priority is greater than > crc32c-generic. This case expect to use crc32c-generic driver for > some Zhaoxin CPUs to get performance gain, So remove these Zhaoxin > CPUs support from crc32c-intel. > > Signed-off-by: Tony W Wang-oc > --- > arch/x86/crypto/crc32c-intel_glue.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/arch/x86/crypto/crc32c-intel_glue.c b/arch/x86/crypto/crc32c-intel_glue.c > index feccb52..6dafdae 100644 > --- a/arch/x86/crypto/crc32c-intel_glue.c > +++ b/arch/x86/crypto/crc32c-intel_glue.c > @@ -222,8 +222,16 @@ MODULE_DEVICE_TABLE(x86cpu, crc32c_cpu_id); > > static int __init crc32c_intel_mod_init(void) > { > + struct cpuinfo_x86 *c = &boot_cpu_data; > + > if (!x86_match_cpu(crc32c_cpu_id)) > return -ENODEV; > + > + if (c->x86_vendor == X86_VENDOR_ZHAOXIN || c->x86_vendor == X86_VENDOR_CENTAUR) { > + if (c->x86 == 0x6 || (c->x86 == 0x7 && c->x86_model <= 0x3b)) > + return -ENODEV; > + } Egads, why can't you use that x86_match_cpu() above, and also this really wants a comment on why you're excluding these chips. Also, since (IIRC) ZHAOXIN is basically AND, shouldn't they also be listed? That is; write it like: m = x86_match_cpu(crc32_cpu_id); if (!m || !m->data) return -ENODEV; That way you can have positive and negative matches in the array (obviously the existing FEATURE test would need data=1 and be last).