Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2188081pxb; Fri, 25 Mar 2022 12:39:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx19Z32v3tXuaeAZ+t/luQex7qqF8kaBFzmPjF63kBIQwW7XXsAuwBIwGvkOre6q1qnFoZJ X-Received: by 2002:a17:902:ccd2:b0:14f:8182:96c4 with SMTP id z18-20020a170902ccd200b0014f818296c4mr13574111ple.67.1648237189340; Fri, 25 Mar 2022 12:39:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648237189; cv=none; d=google.com; s=arc-20160816; b=tRYHGkrwU5tqJF/+mAVM+YqefWFvTL1Os8mPMKXDpOBqn2SbdG08rILlcrCSLMla4e zFNP8zso0Y4mnp0w/8Q9TCZQydERrUGooeekdI9dDR8mXj3iJeu1MdYly/ps0gZJ5Z1b 6g/2I+17aFg2kAa528QaCOLn8gOZTz29RHuY44/byAiXFWd2C7NfWU2u3Mx2UUVoZmcX azGIL42gRX352gtgAhc9yI4D0HKGmqS7kKa0qyi5ZUKJHjW//A230bUc8j4lNuM0nalY 2JF6Ig1pSbx7c5jsKhtMKCQnAwv9U4Q0wpReOTlIXZLwNS3L3dcYL4E22oPl7KWjmHQ5 OxIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:mime-version:references:subject:cc:to:from :dkim-signature:dkim-signature:message-id; bh=mkdnb+b1Zmv6jwoILxAAtMLYCIJRUKxiXjyexb3mvlA=; b=LFM28Vy0b7zZD84S1Pyn/eDpgrmKUuZlEexC0XYjkqxtjvu8CXz5lrRr4SXsf5m8gX o4gtPKLg8feJPxkAV1AmYNIbVGm9gz3WCRU6Z8OtE4/dxdYJ3hP/9bctTBWnQQYUp+N0 IhE91xvOdVVgI8HllDIBrgJs0BrZral8Ubz5fmPwiB4uF4CPanHjcm+t9DiVVPWkDFi6 2zEAPzKTAiIy93PgFvDdBIj342wKy14tWnQ2ajgclfPbjbgai6LN9qgj5rmfU6O32zNY HjbVD0ijVU6vcfsg2t5FnZkV7tUJ3J5PhC5KLrnRd6PTkRxnJDx4TMBJDrX0KYO23t4z Q7NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Mu+EzWTB; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id j13-20020a17090a694d00b001c7469269b5si6522286pjm.56.2022.03.25.12.39.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 12:39:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Mu+EzWTB; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 65E9327B617; Fri, 25 Mar 2022 11:30:35 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350614AbiCXNs5 (ORCPT + 99 others); Thu, 24 Mar 2022 09:48:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350576AbiCXNsp (ORCPT ); Thu, 24 Mar 2022 09:48:45 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B73A18F9A9 for ; Thu, 24 Mar 2022 06:47:12 -0700 (PDT) Message-ID: <20220324134623.519411939@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1648129631; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=mkdnb+b1Zmv6jwoILxAAtMLYCIJRUKxiXjyexb3mvlA=; b=Mu+EzWTBgKIHpxaq1AnEAX1K+gbnmR0RU9b3Ffo+n1SdY6JvSJQgPBP8rWccsOQuy8mPgX g0FO+UT1RksBZfZisj3fKshuJ9U20clfDMDjHpumeHKWyhrWVy+MVFMS5fnEQEjeV3Xs6e 0fv5gBOywntqh5edJowL8NgGnuiBqFUSwV0FhmzopZnLF29QpwsX0eaayjp4+5Nw+5pRLR I/mZrwwznKTHmjGGwmQwtIQ3ZP3K+84/5PI40YRQACLhJRTw+PUtjkodBjiFAsGLxo49ai 0nPe8ytoY5aJ+I/h3cgjPA0g4hBjui9x+Dn29oBM6Z/kJRI6dkR4GLUtnq0J/A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1648129631; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=mkdnb+b1Zmv6jwoILxAAtMLYCIJRUKxiXjyexb3mvlA=; b=uuDif5DOITAoan4/wx31IbVAYrNBc+4hI0H66CtiwKIL6dfp4uCJYb94WVpud9cvrkTTFx 8ExKi3x+XLs877AA== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, "Chang S. Bae" Subject: [patch 3/7] x86/fpu/xsave: Initialize offset/size cache early References: <20220324134548.432837672@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Thu, 24 Mar 2022 14:47:11 +0100 (CET) X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Reading XSTATE feature information from CPUID over and over does not make sense. The information has to be cached anyway, so it can be done early. This prepares for runtime calculation of XSTATE offsets and allows consolidation of the size calculation functions in a later step. Rename the function while at it as it does not setup any features. Signed-off-by: Thomas Gleixner --- arch/x86/kernel/fpu/xstate.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/arch/x86/kernel/fpu/xstate.c +++ b/arch/x86/kernel/fpu/xstate.c @@ -180,7 +180,7 @@ static bool xfeature_enabled(enum xfeatu * Record the offsets and sizes of various xstates contained * in the XSAVE state memory layout. */ -static void __init setup_xstate_features(void) +static void __init setup_xstate_cache(void) { u32 eax, ebx, ecx, edx, i; /* start at the beginning of the "extended state" */ @@ -390,7 +390,6 @@ static void __init setup_init_fpu_buf(vo if (!boot_cpu_has(X86_FEATURE_XSAVE)) return; - setup_xstate_features(); print_xstate_features(); xstate_init_xcomp_bv(&init_fpstate.regs.xsave, fpu_kernel_cfg.max_features); @@ -906,6 +905,10 @@ void __init fpu__init_system_xstate(unsi /* Enable xstate instructions to be able to continue with initialization: */ fpu__init_cpu_xstate(); + + /* Cache size, offset and flags for initialization */ + setup_xstate_cache(); + err = init_xstate_size(); if (err) goto out_disable;