From patchwork Wed May 24 03:03:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 20554 Received: (qmail 93337 invoked by alias); 24 May 2017 03:03:41 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 93307 invoked by uid 89); 24 May 2017 03:03:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=spells, xxx X-HELO: mail-oi0-f45.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=qrelzD9/1yU+4YOWw3B0OdaUX4dc77skYXRIexotvgQ=; b=iA7/2+5kzC9FTq5QB0qu2Y7kGUdHV8X0JMMdhmGPWuoWIGjZ+HVcS4/txm7qRDsFEQ jXp613NSF2DLxXapyJvSDoag2cNbRXnopKRBbs/zupcbK8+lHZNEcQjUahox6PSW1PTc OVnEZH0AhiyBTkvZnyFUDHnKD56r+FmYzXRG50D6CLycbhfG1uEvat/XefNCaAzbGPgW 5fnWJq8zBis+PlSUCS7vm4bpZlJGDEYESnW5XPX+gbQGVHxZn3UBkQNKQdxioNec6bi9 5oNJDJZ+9LmshSpWxxTVD1EHmhrxW0crkfqqTyxRgTXuzsNPPh+cXJUW635xK2gHtj2e iTUQ== X-Gm-Message-State: AODbwcAbl7fy3lIgCZ3Eh+bfN56APWxXLOvsKaymkyaASCcvec2kdNzy E54NNWOZCtdfWKD1 X-Received: by 10.157.48.116 with SMTP id w49mr3944834otd.142.1495595020917; Tue, 23 May 2017 20:03:40 -0700 (PDT) Date: Tue, 23 May 2017 20:03:39 -0700 From: "H.J. Lu" To: GNU C Library Subject: [PATCH] x86: Use __get_cpu_features to get cpu_features Message-ID: <20170524030339.GA8933@gmail.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.8.0 (2017-02-23) Remove is_intel, is_amd and max_cpuid macros. Use __get_cpu_features to get cpu_features instead. Any comments? H.J. --- * sysdeps/x86/cacheinfo.c (is_intel): Removed. (is_amd): Likewise. (max_cpuid): Likewise. (__cache_sysconf): Use __get_cpu_features to get cpu_features. (init_cacheinfo): Likewise. --- sysdeps/x86/cacheinfo.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sysdeps/x86/cacheinfo.c b/sysdeps/x86/cacheinfo.c index 1ccbe41..43c0b63 100644 --- a/sysdeps/x86/cacheinfo.c +++ b/sysdeps/x86/cacheinfo.c @@ -23,10 +23,6 @@ #include #include -#define is_intel GLRO(dl_x86_cpu_features).kind == arch_kind_intel -#define is_amd GLRO(dl_x86_cpu_features).kind == arch_kind_amd -#define max_cpuid GLRO(dl_x86_cpu_features).max_cpuid - static const struct intel_02_cache_info { unsigned char idx; @@ -436,10 +432,12 @@ long int attribute_hidden __cache_sysconf (int name) { - if (is_intel) - return handle_intel (name, max_cpuid); + const struct cpu_features *cpu_features = __get_cpu_features (); + + if (cpu_features->kind == arch_kind_intel) + return handle_intel (name, cpu_features->max_cpuid); - if (is_amd) + if (cpu_features->kind == arch_kind_amd) return handle_amd (name); // XXX Fill in more vendors. @@ -489,8 +487,10 @@ init_cacheinfo (void) long int shared = -1; unsigned int level; unsigned int threads = 0; + const struct cpu_features *cpu_features = __get_cpu_features (); + int max_cpuid = cpu_features->max_cpuid; - if (is_intel) + if (cpu_features->kind == arch_kind_intel) { data = handle_intel (_SC_LEVEL1_DCACHE_SIZE, max_cpuid); @@ -692,7 +692,7 @@ intel_bug_no_cache_info: } } /* This spells out "AuthenticAMD". */ - else if (is_amd) + else if (cpu_features->kind == arch_kind_amd) { data = handle_amd (_SC_LEVEL1_DCACHE_SIZE); long int core = handle_amd (_SC_LEVEL2_CACHE_SIZE);