From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB349C43332 for ; Fri, 20 Mar 2020 14:39:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C262A2076E for ; Fri, 20 Mar 2020 14:39:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qNBIADHA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726997AbgCTOjZ (ORCPT ); Fri, 20 Mar 2020 10:39:25 -0400 Received: from mail-pj1-f68.google.com ([209.85.216.68]:55402 "EHLO mail-pj1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726970AbgCTOjZ (ORCPT ); Fri, 20 Mar 2020 10:39:25 -0400 Received: by mail-pj1-f68.google.com with SMTP id mj6so2548711pjb.5; Fri, 20 Mar 2020 07:39:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=a54IW0oB44nJzFv1TQssWnIGDqT1Lq9rUj5K2IpDqwI=; b=qNBIADHAq6ehPS/ovZWHrsu7MGd/UxDlnzD+zweINjMHVHnMtBB6FOCc8mZ4AK2sn+ 0jf8BXHyflIAVz+hE0NX3UYbiaCl06w8BZxkazyhDNur8jMHzNsTQkS/jbggtOTtNowT abxarJPlIPxtpGpCYE1GeC+BvrILbtVOFTMLCHOuHtnuAT321KZ6Vp8xTeoVRAuqnnII Jalcy7DC+PP0+sC6IxYTuGSL5qsSGRtQsmKX6oTK8VYKu5/Uc580sGHivzbxojUFrSa0 tGef9gFQWBsjqWIyKiY7khPTi39m+Xc80oV4jD0C4fVyEBhyhfePUTBSh/KTrfeWNzWs FoTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=a54IW0oB44nJzFv1TQssWnIGDqT1Lq9rUj5K2IpDqwI=; b=lGdYQsS1lMTFL2f3HE/C4uGOLhdeyOQyBbf2ng39wLcOX3LJnWU5RbpCq79QzX1yaK FyVWtHLDapbzRC38FCge9lXbKSlnZuAprcoAlyC+Nwx1yNux303YpcfOL4brxHjWXB5k V9TaiyJaG0t+kFB7V9JjvL6y+36Q0l9JhRjlarCl6bSKGvIPUBu07B8j+qOmBYFcPCT/ uIs9EB3YVVxNRPhmi65WqKDZJCQ+qRPfBIa2IO9kSK2QLhXY4licGdQ2xxMDBwGGQ5/i H1EMWC6b/po99zYdhQuNXtxY4eTRxG8YmedMsBEh7hXz94sYFiP4b9iHAeZKMkewMKj0 eTEQ== X-Gm-Message-State: ANhLgQ0QWljoUU8vHe2lFNJ2rioNk8B0ayuxDxM/6voAPljVvgx9NkpL 0z+REK/k/x0V2IRmjXeGhEXu+n5SZF+HD/zKvFg= X-Google-Smtp-Source: ADFU+vvvaVCkXdplje1O4GxrsGz4U6GUkJ3qUTDhDx4G7N8RLK5zRd1Pc/WBHOoPDY8ll979CQXu9IGQKSDD2UQAADM= X-Received: by 2002:a17:90a:fb49:: with SMTP id iq9mr9739946pjb.143.1584715163452; Fri, 20 Mar 2020 07:39:23 -0700 (PDT) MIME-Version: 1.0 References: <20200320131345.635023594@linutronix.de> <20200320131508.826011988@linutronix.de> In-Reply-To: <20200320131508.826011988@linutronix.de> From: Andy Shevchenko Date: Fri, 20 Mar 2020 16:39:16 +0200 Message-ID: Subject: Re: [patch 02/22] x86/cpu: Add conistent CPU match macros To: Thomas Gleixner Cc: LKML , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , Greg Kroah-Hartman , Mark Gross , Tony Luck , Paolo Bonzini , Darren Hart , Andy Shevchenko , "Rafael J. Wysocki" , Len Brown , ACPI Devel Maling List , Viresh Kumar , Linux PM , Srinivas Pandruvada , linux-edac@vger.kernel.org, Platform Driver , Jean Delvare , Guenter Roeck , linux-hwmon@vger.kernel.org, Zhang Rui , Daniel Lezcano , Amit Kucheria , Chanwoo Choi , Jacob Pan , Adrian Hunter , Ulf Hansson , linux-mmc , Bjorn Helgaas , linux-pci@vger.kernel.org, Takashi Iwai , ALSA Development Mailing List , Herbert Xu , "David S. Miller" , linux-crypto Content-Type: text/plain; charset="UTF-8" Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Fri, Mar 20, 2020 at 3:18 PM Thomas Gleixner wrote: > > Finding all places which build x86_cpu_id match tables is tedious and the > logic is hidden in lots of differently named macro wrappers. > > Most of these initializer macros use plain C89 initializers which rely on > the ordering of the struct members. So new members could only be added at > the end of the struct, but that's ugly as hell and C99 initializers are > really the right thing to use. > > Provide a set of macros which: > > - Have a proper naming scheme, starting with X86_MATCH_ > > - Use C99 initializers > > The set of provided macros are all subsets of the base macro > > X86_MATCH_VENDOR_FAM_MODEL_FEATURE() > > which allows to supply all possible selection criteria: > > vendor, family, model, feature > > The other macros shorten this to avoid typing all arguments when they are > not needed and would require one of the _ANY constants. They have been > created due to the requirements of the existing usage sites. > > Also a add a few model constants for Centaur CPUs and QUARK. I would perhaps made this as a separate change(s). ... > +#define X86_MATCH_VENDOR_FAM_MODEL_FEATURE(_vendor, _family, _model, \ > + _feature, _data) { \ I would leave it on one line despite the length, but it's up to you. > + .vendor = X86_VENDOR_##_vendor, \ > + .family = _family, \ > + .model = _model, \ > + .feature = _feature, \ > + .driver_data = (unsigned long) _data \ For sake of consistency shouldn't be this kernel_ulong_t ? Or we are going to get rid of that type? > } ... > +#define X86_MATCH_VENDOR_FAM_FEATURE(vendor, family, feature, data) \ > + X86_MATCH_VENDOR_FAM_MODEL_FEATURE(vendor, family, \ > + X86_MODEL_ANY, feature, data) I would leave it on one line despite the length, but it's up to you. ... > +#define X86_MATCH_VENDOR_FAM_MODEL(vendor, family, model, data) \ > + X86_MATCH_VENDOR_FAM_MODEL_FEATURE(vendor, family, model, \ > + X86_FEATURE_ANY, data) Ditto. ... > + * X86_MATCH_VENDOR_FAM_MODEL_FEATURE(INTEL, 6, INTEL_FAM6_BROADWELL, > + * X86_FEATURE_ANY, NULL); Perhaps one line? -- With Best Regards, Andy Shevchenko