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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D36AC433F5 for ; Thu, 14 Oct 2021 23:09:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 827CA610F8 for ; Thu, 14 Oct 2021 23:09:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234377AbhJNXLt (ORCPT ); Thu, 14 Oct 2021 19:11:49 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:45622 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234326AbhJNXLh (ORCPT ); Thu, 14 Oct 2021 19:11:37 -0400 Message-ID: <20211014230739.126107370@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1634252970; 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=QVaekX9bXV3d6X1DWoFzjhPj7QWVsMVJXuCognxNjoU=; b=AMsMNFqGhXraF4N1pYoEZhBNpOaOIApNa2/55yFVeTvbPHdjXcxmUx6LjX4A/6+qrIVfnB E6tMC5OCIFE5oYAuoUfAsqIitCqrRLWX5A/1SsnUsKuZt4qvyCDiDEMxExjXJ59QLCbF6N f4J5y5Cpxcb5r84aOJy/ML0gzIgXKHom/GwdafmWoEjX8Fo8CHbdPhxra2AoisazvQTYEN sNPEqJF+WWtuHjxye7DEIm/iL818fZ279Bhd5JTsdDVazaCUurjuVSqx9bsmYrQDM0RMtG 5Ncm8X2IQZNb1Pts1RIRMN5YElgktzK4qxoqNJ2BpvmBGdB9Igj+A97hW81pWw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1634252970; 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=QVaekX9bXV3d6X1DWoFzjhPj7QWVsMVJXuCognxNjoU=; b=ZVwuDUAKPdx/TicDk1bOeye6fC4eTCFnvXKRw9WG6Ut589rPXm2u2wl98mCHvfx+s0aTs5 eiBf+zGdgickiSAw== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, "Chang S. Bae" , Dave Hansen , Arjan van de Ven , kvm@vger.kernel.org, Paolo Bonzini Subject: [patch 1/8] x86/fpu: Provide struct fpu_config References: <20211014225711.615197738@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Fri, 15 Oct 2021 01:09:29 +0200 (CEST) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Provide a struct to store information about the maximum supported and the default feature set and buffer sizes for both user and kernel space. This allows quick retrieval of this information for the upcoming support for dynamically enabled features. Signed-off-by: Thomas Gleixner --- arch/x86/include/asm/fpu/types.h | 39 +++++++++++++++++++++++++++++++++++++++ arch/x86/kernel/fpu/core.c | 4 ++++ 2 files changed, 43 insertions(+) --- a/arch/x86/include/asm/fpu/types.h +++ b/arch/x86/include/asm/fpu/types.h @@ -378,4 +378,43 @@ struct fpu { */ }; +/* + * FPU state configuration data. Initialized at boot time. Read only after init. + */ +struct fpu_state_config { + /* + * @max_size: + * + * The maximum size of the register state buffer. Includes all + * supported features except independent managed features. + */ + unsigned int max_size; + /* + * @default_size: + * + * The default size of the register state buffer. Includes all + * supported features except independent managed features and + * features which have to be requested by user space before usage. + */ + unsigned int default_size; + /* + * @max_features: + * + * The maximum supported features bitmap. Does not include + * independent managed features. + */ + u64 max_features; + /* + * @default_features: + * + * The default supported features bitmap. Does not include + * independent managed features and features which have to + * be requested by user space before usage. + */ + u64 default_features; +}; + +/* FPU state configuration information */ +extern struct fpu_state_config fpu_kernel_cfg, fpu_user_cfg; + #endif /* _ASM_X86_FPU_H */ --- a/arch/x86/kernel/fpu/core.c +++ b/arch/x86/kernel/fpu/core.c @@ -25,6 +25,10 @@ #define CREATE_TRACE_POINTS #include +/* The FPU state configuration data for kernel and user space */ +struct fpu_state_config fpu_kernel_cfg __ro_after_init; +struct fpu_state_config fpu_user_cfg __ro_after_init; + /* * Represents the initial FPU state. It's mostly (but not completely) zeroes, * depending on the FPU hardware format: