Hygon CPUs (HygonGenuine) share the same AES-NI and other crypto
instruction sets with AMD Zen architecture. However, they were previously
falling back to the generic software provider because the vendor check
only recognized Intel and AMD.
This fallback to the software provider (Nettle wrapper) could lead to
numerical issues or crashes (e.g., divide-by-zero) in certain
environments like Photoshop.
This patch:
1. Adds X86_CPU_VENDOR_HYGON to x86_cpu_vendor enum.
2. Updates check_x86_cpu_vendor() to recognize Hygon CPUs.
3. Enables hardware acceleration for Hygon CPUs.
Signed-off-by: xinpeng.wang <wangxinpeng@uniontech.com>
X86_CPU_VENDOR_OTHER,
X86_CPU_VENDOR_INTEL,
X86_CPU_VENDOR_AMD,
+ X86_CPU_VENDOR_HYGON,
};
static enum x86_cpu_vendor check_x86_cpu_vendor(void)
return X86_CPU_VENDOR_AMD;
}
+ if (memcmp(&b, "Hygo", 4) == 0 && memcmp(&d, "nGen", 4) == 0 &&
+ memcmp(&c, "uine", 4) == 0) {
+ return X86_CPU_VENDOR_HYGON;
+ }
+
return X86_CPU_VENDOR_OTHER;
}