<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <div class="moz-cite-prefix">On 5/22/2024 9:04 PM, Borislav Petkov
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:20240522153433.GCZk4QiX4Hf0OuI48E@fat_crate.local">
      <pre class="moz-quote-pre" wrap="">Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.


On Wed, May 22, 2024 at 06:42:55PM +0530, Balasubrmanian, Vignesh wrote:
</pre>
      <blockquote type="cite">
        <blockquote type="cite">
          <blockquote type="cite">
            <pre class="moz-quote-pre" wrap="">+enum custom_feature {
+     FEATURE_XSAVE_FP = 0,
+     FEATURE_XSAVE_SSE = 1,
+     FEATURE_XSAVE_YMM = 2,
+     FEATURE_XSAVE_BNDREGS = 3,
+     FEATURE_XSAVE_BNDCSR = 4,
+     FEATURE_XSAVE_OPMASK = 5,
+     FEATURE_XSAVE_ZMM_Hi256 = 6,
+     FEATURE_XSAVE_Hi16_ZMM = 7,
+     FEATURE_XSAVE_PT = 8,
+     FEATURE_XSAVE_PKRU = 9,
+     FEATURE_XSAVE_PASID = 10,
+     FEATURE_XSAVE_CET_USER = 11,
+     FEATURE_XSAVE_CET_SHADOW_STACK = 12,
+     FEATURE_XSAVE_HDC = 13,
+     FEATURE_XSAVE_UINTR = 14,
+     FEATURE_XSAVE_LBR = 15,
+     FEATURE_XSAVE_HWP = 16,
+     FEATURE_XSAVE_XTILE_CFG = 17,
+     FEATURE_XSAVE_XTILE_DATA = 18,
+     FEATURE_MAX,
+     FEATURE_XSAVE_EXTENDED_START = FEATURE_XSAVE_YMM,
+     FEATURE_XSAVE_EXTENDED_END = FEATURE_XSAVE_XTILE_DATA,
+};
</pre>
          </blockquote>
          <pre class="moz-quote-pre" wrap="">Why can't this use the existing 'enum xfeature' which is providing
exactly the same information already?
</pre>
        </blockquote>
        <pre class="moz-quote-pre" wrap="">First version of patch was similar to what you mentioned here and other
review comments to use existing kernel definitions.
<a class="moz-txt-link-freetext" href="https://lore.kernel.org/linux-mm/20240314112359.50713-1-vigbalas@amd.com/T/">https://lore.kernel.org/linux-mm/20240314112359.50713-1-vigbalas@amd.com/T/</a>

As per the review comment <a class="moz-txt-link-freetext" href="https://lore.kernel.org/linux-mm/20240314162954.GAZfMmAnYQoRjRbRzc@fat_crate.local/">https://lore.kernel.org/linux-mm/20240314162954.GAZfMmAnYQoRjRbRzc@fat_crate.local/</a>
, modified the patch to be a independent of kernel internal definitions.
Though this enum and below function  "get_sub_leaf" are not useful now,  it
will be required when we extend for a new/different features.
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
No, Thomas' sugggestion is to use the existing xfeature enum - not
define the same thing again.

Why do you need that enum custom_feature thing if you can use

/*
 * List of XSAVE features Linux knows about:
 */
enum xfeature {

from arch/x86/include/asm/fpu/types.h

?
</pre>
    </blockquote>
    <span><span class="ui-provider a b c d e f g h i j k l m n o p q r s t u v w x y z ab ac ae af ag ah ai aj ak" dir="ltr">As discussed here :<a aria-label="Link https://lore.kernel.org/linux-mm/24f71d52-0891-4cfc-8dec-9f13ed618eee@intel.com/" href="https://lore.kernel.org/linux-mm/24f71d52-0891-4cfc-8dec-9f13ed618eee@intel.com/" rel="noreferrer noopener" target="_blank" class="fui-Link ___1rxvrpe f2hkw1w f3rmtva f1ewtqcl fyind8e f1k6fduh f1w7gpdv fk6fouc fjoy568 figsok6 f1hu3pq6 f11qmguv f19f4twv f1tyq0we f1g0x7ka fhxju0i f1qch9an f1cnd47f fqv5qza f1vmzxwi f1o700av f13mvf36 f1cmlufx f9n3di6 f1ids18y f1tx3yz7 f1deo86v f1eh06m1 f1iescvh fhgqx19 f1olyrje f1p93eir f1nev41a f1h8hb77 f1lqvz6u f10aw75t fsle3fq f17ae5zn moz-txt-link-freetext" title="https://lore.kernel.org/linux-mm/24f71d52-0891-4cfc-8dec-9f13ed618eee@intel.com/">https://lore.kernel.org/linux-mm/24f71d52-0891-4cfc-8dec-9f13ed618eee@intel.com/</a><br>
        My understanding is that, if/when we extend this for other/new
        featured outside of XSAVE we might end up modifying the enum
        that is very specific to XSAVE.<br>
        Currently, this enum is the same as XSAVE, but when we add other
        features, this enum might have a different value of the XSAVE
        features and can be modified without disturbing the existing
        kernel code.<br>
        Please correct me if my understanding is wrong.</span></span>
    <blockquote type="cite" cite="mid:20240522153433.GCZk4QiX4Hf0OuI48E@fat_crate.local">
      <pre class="moz-quote-pre" wrap="">
--
Regards/Gruss,
    Boris.

<a class="moz-txt-link-freetext" href="https://people.kernel.org/tglx/notes-about-netiquette">https://people.kernel.org/tglx/notes-about-netiquette</a>
</pre>
    </blockquote>
  </body>
</html>