Re: [PATCH 1/3] selftests/resctrl: Add CPU vendor detection for Hygon
From: Xiaochen Shen
Date: Fri Dec 05 2025 - 02:01:56 EST
Hi Reinette,
On 12/5/2025 7:48 AM, Reinette Chatre wrote:
>> #define ARCH_INTEL 1
>> #define ARCH_AMD 2
>> +#define ARCH_HYGON 3
> The comment before these defines attempts to provide guidance but it is clearly still
> quite subtle that these values are required to be unique bits. Consider for example
> their usage in test_vendor_specific_check():
> return get_vendor() & test->vendor_specific
>
> This should either be 4 or a better solution is probably to switch all of these to use
> BIT() (linux/bits.h is available via tools/include that is already in include path).
>
> Reinette
Thank you. How about this code change?
+#include <linux/bits.h>
...
-#define ARCH_INTEL 1
-#define ARCH_AMD 2
+#define ARCH_INTEL BIT(0)
+#define ARCH_AMD BIT(1)
+#define ARCH_HYGON BIT(2)
Best regards,
Xiaochen Shen