Message ID | 20220321135628.382868-1-hjl.tools@gmail.com |
---|---|
State | Committed |
Commit | d0363a80690a299179d010c1d8a6d6430e7eb73f |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B53E3385EC44 for <patchwork@sourceware.org>; Mon, 21 Mar 2022 13:57:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B53E3385EC44 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1647871021; bh=oRnYmsh5fakestv4xy/ypqKflQ3w30cl2FsqTmKX6OA=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=k7QRG/ZTbQ+Z7f7PfuSxYCW8JoAraU8kBAFuPfbBBpKeshqMlEMPyV8ZVj6FFuhpN OwUZvsLYCAZwgSmiz6mYQ/B8TJhvo/xL+tE8JFHuwgGgtusxlj5XSxxV2iDJQOF9Lv ugiYJohKoOEq/5nFZgT77ofMKpV1J48aiYNdtJno= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by sourceware.org (Postfix) with ESMTPS id 958233858403 for <gcc-patches@gcc.gnu.org>; Mon, 21 Mar 2022 13:56:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 958233858403 Received: by mail-pj1-x102d.google.com with SMTP id mm17-20020a17090b359100b001c6da62a559so4704735pjb.3 for <gcc-patches@gcc.gnu.org>; Mon, 21 Mar 2022 06:56:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=oRnYmsh5fakestv4xy/ypqKflQ3w30cl2FsqTmKX6OA=; b=kbD+Xse06x4OMM0hag5/42I5+IWWTJ/kSzj1rTegtb6KhSUL5Lb4KBV8g/GF9Ee51V iquf+rHNcGi7Nq0nJqFsmpyYf7hb521RKNZSa0G+DKNyonn3S6xOhZ0zdfCFnQek6UAd 4QRJNbs/rRmFzKVwK43Ye5rezs+anmivQl6f2sy2pP79cKl2NvciLRHgmQjFkguYp23M bSlByKvdZ63nVk+uxJD5oDqfM4nGZaYJv+pSZOM4J3SDFvMQG24skjmKWxMD0tn7282v RITqjzi1dLh6iQ+Q6w9ls+7ubu841dMro3CaxiCwMn/LRfZxLlgVNMtPNU/C4wi78ie3 bl/A== X-Gm-Message-State: AOAM533qt7DQGSXVGMnb3AkmT6+w9A1NlpK+88yFeOe5AWZsHJQ4U8aq uXWnboWdJJwaDo6xWidcDH3Ubc3tYn8= X-Google-Smtp-Source: ABdhPJwINcp9pTvWqBNwIpKFUTf5hAMjkNVvbnUwKTb+hsbIVxrnIPuBjgy+8TU3j4Pfb54GUgSoeg== X-Received: by 2002:a17:902:a982:b0:14f:f55:a09a with SMTP id bh2-20020a170902a98200b0014f0f55a09amr12784860plb.33.1647870990267; Mon, 21 Mar 2022 06:56:30 -0700 (PDT) Received: from gnu-tgl-3.localdomain ([172.58.38.226]) by smtp.gmail.com with ESMTPSA id ot17-20020a17090b3b5100b001c746bfba10sm655888pjb.35.2022.03.21.06.56.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 06:56:29 -0700 (PDT) Received: from gnu-tgl-3.. (localhost [IPv6:::1]) by gnu-tgl-3.localdomain (Postfix) with ESMTP id DB781C0164; Mon, 21 Mar 2022 06:56:28 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [PATCH] x86: Properly check FEATURE_AESKLE Date: Mon, 21 Mar 2022 06:56:28 -0700 Message-Id: <20220321135628.382868-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3029.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: "H.J. Lu via Gcc-patches" <gcc-patches@gcc.gnu.org> Reply-To: "H.J. Lu" <hjl.tools@gmail.com> Cc: liuhongt <hongtao.liu@intel.com> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
x86: Properly check FEATURE_AESKLE
|
|
Commit Message
H.J. Lu
March 21, 2022, 1:56 p.m. UTC
1. Pass 0x19 to __cpuid for bit_AESKLE. 2. Enable FEATURE_AESKLE only if bit_AESKLE is set. PR target/104998 * common/config/i386/cpuinfo.h (get_available_features): Pass 0x19 to __cpuid for bit_AESKLE. Enable FEATURE_AESKLE only if bit_AESKLE is set. --- gcc/common/config/i386/cpuinfo.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On Mon, Mar 21, 2022 at 2:56 PM H.J. Lu <hjl.tools@gmail.com> wrote: > > 1. Pass 0x19 to __cpuid for bit_AESKLE. > 2. Enable FEATURE_AESKLE only if bit_AESKLE is set. > > PR target/104998 > * common/config/i386/cpuinfo.h (get_available_features): Pass > 0x19 to __cpuid for bit_AESKLE. Enable FEATURE_AESKLE only if > bit_AESKLE is set. LGTM. Thanks, Uros. > --- > gcc/common/config/i386/cpuinfo.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h > index 61b1a0f291c..239759dc766 100644 > --- a/gcc/common/config/i386/cpuinfo.h > +++ b/gcc/common/config/i386/cpuinfo.h > @@ -779,11 +779,11 @@ get_available_features (struct __processor_model *cpu_model, > /* Get Advanced Features at level 0x19 (eax = 0x19). */ > if (max_cpuid_level >= 0x19) > { > - set_feature (FEATURE_AESKLE); > - __cpuid (19, eax, ebx, ecx, edx); > + __cpuid (0x19, eax, ebx, ecx, edx); > /* Check if OS support keylocker. */ > if (ebx & bit_AESKLE) > { > + set_feature (FEATURE_AESKLE); > if (ebx & bit_WIDEKL) > set_feature (FEATURE_WIDEKL); > if (has_kl) > -- > 2.35.1 >
On Mon, Mar 21, 2022 at 2:29 PM Uros Bizjak <ubizjak@gmail.com> wrote: > > On Mon, Mar 21, 2022 at 2:56 PM H.J. Lu <hjl.tools@gmail.com> wrote: > > > > 1. Pass 0x19 to __cpuid for bit_AESKLE. > > 2. Enable FEATURE_AESKLE only if bit_AESKLE is set. > > > > PR target/104998 > > * common/config/i386/cpuinfo.h (get_available_features): Pass > > 0x19 to __cpuid for bit_AESKLE. Enable FEATURE_AESKLE only if > > bit_AESKLE is set. > > LGTM. OK for backport? Thanks. > Thanks, > Uros. > > > --- > > gcc/common/config/i386/cpuinfo.h | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h > > index 61b1a0f291c..239759dc766 100644 > > --- a/gcc/common/config/i386/cpuinfo.h > > +++ b/gcc/common/config/i386/cpuinfo.h > > @@ -779,11 +779,11 @@ get_available_features (struct __processor_model *cpu_model, > > /* Get Advanced Features at level 0x19 (eax = 0x19). */ > > if (max_cpuid_level >= 0x19) > > { > > - set_feature (FEATURE_AESKLE); > > - __cpuid (19, eax, ebx, ecx, edx); > > + __cpuid (0x19, eax, ebx, ecx, edx); > > /* Check if OS support keylocker. */ > > if (ebx & bit_AESKLE) > > { > > + set_feature (FEATURE_AESKLE); > > if (ebx & bit_WIDEKL) > > set_feature (FEATURE_WIDEKL); > > if (has_kl) > > -- > > 2.35.1 > >
On Mon, Mar 21, 2022 at 10:51 PM H.J. Lu <hjl.tools@gmail.com> wrote: > > On Mon, Mar 21, 2022 at 2:29 PM Uros Bizjak <ubizjak@gmail.com> wrote: > > > > On Mon, Mar 21, 2022 at 2:56 PM H.J. Lu <hjl.tools@gmail.com> wrote: > > > > > > 1. Pass 0x19 to __cpuid for bit_AESKLE. > > > 2. Enable FEATURE_AESKLE only if bit_AESKLE is set. > > > > > > PR target/104998 > > > * common/config/i386/cpuinfo.h (get_available_features): Pass > > > 0x19 to __cpuid for bit_AESKLE. Enable FEATURE_AESKLE only if > > > bit_AESKLE is set. > > > > LGTM. > > OK for backport? Looks safe, so OK. Thanks, Uros. > > Thanks. > > > Thanks, > > Uros. > > > > > --- > > > gcc/common/config/i386/cpuinfo.h | 4 ++-- > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h > > > index 61b1a0f291c..239759dc766 100644 > > > --- a/gcc/common/config/i386/cpuinfo.h > > > +++ b/gcc/common/config/i386/cpuinfo.h > > > @@ -779,11 +779,11 @@ get_available_features (struct __processor_model *cpu_model, > > > /* Get Advanced Features at level 0x19 (eax = 0x19). */ > > > if (max_cpuid_level >= 0x19) > > > { > > > - set_feature (FEATURE_AESKLE); > > > - __cpuid (19, eax, ebx, ecx, edx); > > > + __cpuid (0x19, eax, ebx, ecx, edx); > > > /* Check if OS support keylocker. */ > > > if (ebx & bit_AESKLE) > > > { > > > + set_feature (FEATURE_AESKLE); > > > if (ebx & bit_WIDEKL) > > > set_feature (FEATURE_WIDEKL); > > > if (has_kl) > > > -- > > > 2.35.1 > > > > > > > -- > H.J.
diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h index 61b1a0f291c..239759dc766 100644 --- a/gcc/common/config/i386/cpuinfo.h +++ b/gcc/common/config/i386/cpuinfo.h @@ -779,11 +779,11 @@ get_available_features (struct __processor_model *cpu_model, /* Get Advanced Features at level 0x19 (eax = 0x19). */ if (max_cpuid_level >= 0x19) { - set_feature (FEATURE_AESKLE); - __cpuid (19, eax, ebx, ecx, edx); + __cpuid (0x19, eax, ebx, ecx, edx); /* Check if OS support keylocker. */ if (ebx & bit_AESKLE) { + set_feature (FEATURE_AESKLE); if (ebx & bit_WIDEKL) set_feature (FEATURE_WIDEKL); if (has_kl)