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 ED80DC10DCE for ; Fri, 20 Mar 2020 14:39:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C57AA20782 for ; Fri, 20 Mar 2020 14:39:29 +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 S1727426AbgCTOj0 (ORCPT ); Fri, 20 Mar 2020 10:39:26 -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-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Shevchenko Subject: Re: [patch 02/22] x86/cpu: Add conistent CPU match macros Date: Fri, 20 Mar 2020 16:39:16 +0200 Message-ID: References: <20200320131345.635023594@linutronix.de> <20200320131508.826011988@linutronix.de> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: In-Reply-To: <20200320131508.826011988@linutronix.de> Sender: linux-crypto-owner@vger.kernel.org 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 List-Id: platform-driver-x86.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 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.7 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,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 EDCEFC4332B for ; Mon, 23 Mar 2020 13:51:07 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7AC7E2072D for ; Mon, 23 Mar 2020 13:51:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="vsaoiC9c"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qNBIADHA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7AC7E2072D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id AF8121661; Mon, 23 Mar 2020 14:50:15 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AF8121661 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1584971465; bh=wktbysbpKxk2uFZnMfs8IfIeWAzW64HR1aVhyGDBRfg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=vsaoiC9cQZQxN+DltyKgJQwvYfmkFrGC9Omt6u+tO1JSZGodrTunNX/1wp4tBwOT0 liDwVXJNnAbknol74q93r+YI5kq4Rx9HiyZkCeDO8o5H7Z/3Sxi/s8/006cnJr8E0O dWXPV7hwLu1RoAciymHZVeRlJjDLkZ+kvRiUfA8E= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B44A8F80292; Mon, 23 Mar 2020 14:47:43 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C5235F800C0; Fri, 20 Mar 2020 15:39:28 +0100 (CET) Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C9467F800C0 for ; Fri, 20 Mar 2020 15:39:25 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C9467F800C0 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qNBIADHA" Received: by mail-pl1-x642.google.com with SMTP id f8so2557922plt.10 for ; Fri, 20 Mar 2020 07:39:25 -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=A76KKeKoN6jqjUtz8l7mL0ExyZvASHBPlLiP18QHPg8vAo+MhlET39KjoNjYYacGuL AVbY5h4zx9x0heaK5ySmWcd6n/PNczGCDL8F3PAVgA95GgW/L6om5i4kQ1PYwV8+WLBc 4dS/f2XbgRhW7zm999ufC6oCuJn2BRnFCYW9Bja3vpEy6atIBPHmWITWaAViZqKms1Wu QJ2sAgeRW6TUOtKwDBsxz6Zp3kJosenrD5sIHVgTCL4UDNdoYx4IY7J6l93juEM7qjje UUPGy6XER23kz9UuZFu88TqWEkYcOKZnOcXbYO2ZPJTNBtDafGddANn1N0ZlJBuQB6qH MrpA== X-Gm-Message-State: ANhLgQ0sd4Iz1Y9m+jvr+tfNd1Q6Yqx/TloagBMujtelhCeNCMD7eou+ lsrzAvs57UPfysiaXs/dY2nNoS1dEY4Swkh9jWs= 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 Content-Type: text/plain; charset="UTF-8" X-Mailman-Approved-At: Mon, 23 Mar 2020 14:47:37 +0100 Cc: Ulf Hansson , "maintainer:X86 ARCHITECTURE \(32-BIT AND 64-BIT\)" , Viresh Kumar , ALSA Development Mailing List , Platform Driver , Jacob Pan , Srinivas Pandruvada , Amit Kucheria , Mark Gross , Herbert Xu , Chanwoo Choi , Daniel Lezcano , ACPI Devel Maling List , linux-pci@vger.kernel.org, Darren Hart , Zhang Rui , Guenter Roeck , Len Brown , Jean Delvare , Linux PM , linux-mmc , Bjorn Helgaas , Takashi Iwai , Adrian Hunter , linux-edac@vger.kernel.org, linux-hwmon@vger.kernel.org, Tony Luck , Greg Kroah-Hartman , "Rafael J. Wysocki" , LKML , linux-crypto , Paolo Bonzini , "David S. Miller" , Andy Shevchenko X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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