From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf2a.google.com (mail-qv1-xf2a.google.com [IPv6:2607:f8b0:4864:20::f2a]) by sourceware.org (Postfix) with ESMTPS id 20ED33858C51 for ; Mon, 21 Mar 2022 22:05:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 20ED33858C51 Received: by mail-qv1-xf2a.google.com with SMTP id k7so7027908qvc.4 for ; Mon, 21 Mar 2022 15:05:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8ILVFVSJROV54TjFhmM3LGLx9M7BI/AYGYJjgytuaUI=; b=ZI08MV2n7Y51lTktKKT4HxTO1hWpsQS06puvNZewrjYT0bgwQDWbY9q7RZQ+Ij6UJ+ ZfP+Z1EJDg0KPgPhW381MPVRZH0K2X268zZERyL315v/3hVHgo8NNgzjB39rTh3L8FB8 uM4jdFI2QrS8uq3zJ6raMhAwwnQwJsPJqoWzDNyjtDwSfT0Dj4/+7lvS491Ri2Hfy7Xo Lnv6HG46X72vKx+YTCma7rKIy45M3zMZ0J5xbhyIZz+kwCythM1lvJzdD4XA4uuqFsHG /r0D8s1tFLlRr2H0NEj0XHP0kLAVDTnQqHDTuKzZG1FFhfuqbfQYYhGRuTOC4tA+kakY l0mw== X-Gm-Message-State: AOAM5304x8SBdgbXVta+VuWdD06cb5RBVDrTl3rVdrzjyG83m2m0tjG6 FkDbuPjMtqnkKM6GMh/xEkuitk36wVOGVUPzJlI= X-Google-Smtp-Source: ABdhPJwYfjWTWhQES2TTtHz1k4FXAc+qVLz+env6UYSlJNeH9+w8UuxNxZTGg4xS58hODMDEDWNU7Cb5jMP2aOYejjg= X-Received: by 2002:a0c:ab07:0:b0:432:5c6e:8703 with SMTP id h7-20020a0cab07000000b004325c6e8703mr17866473qvb.31.1647900336415; Mon, 21 Mar 2022 15:05:36 -0700 (PDT) MIME-Version: 1.0 References: <20220321135628.382868-1-hjl.tools@gmail.com> In-Reply-To: From: Uros Bizjak Date: Mon, 21 Mar 2022 23:05:25 +0100 Message-ID: Subject: Re: [PATCH] x86: Properly check FEATURE_AESKLE To: "H.J. Lu" Cc: "gcc-patches@gcc.gnu.org" , liuhongt Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.4 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Mar 2022 22:05:38 -0000 On Mon, Mar 21, 2022 at 10:51 PM H.J. Lu wrote: > > On Mon, Mar 21, 2022 at 2:29 PM Uros Bizjak wrote: > > > > On Mon, Mar 21, 2022 at 2:56 PM H.J. Lu 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.