Skip to contentSkip to conversation

i386: Add new Hygon 'Dhyana' CPU model

PATCH Applied Pu Wen 4 participants 12 messages Apr 16, 2019 – Apr 18, 2019

lore
Share & tools
lore

Pu Wen

author
#0 lore raw

PATCH v3 1/1 i386: Add new Hygon 'Dhyana' CPU model

Add a new base CPU model called 'Dhyana' to model processors from Hygon Dhyana(family 18h), which derived from AMD EPYC(family 17h).

The following features bits have been removed compare to AMD EPYC:
aes, pclmulqdq, sha_ni

The Hygon Dhyana support to KVM in Linux is already accepted upstream[1]. So add Hygon Dhyana support to Qemu is necessary to create Hygon's own CPU model.

Reference:
[1] https://git.kernel.org/tip/fec98069fb72fb656304a3e52265e0c2fc9adf87

---
v2->v3:
- Remove the Dhyana machine types in the back-compat property tables since there is no Dhyana CPU model in older QEMU releases.

v1->v2:
- Remove CPU model 'Dhyana' and rename the CPU model 'Dhyana-IBPB' to 'Dhyana' because Dhyana CPUs already have the IBPB feature.

 target/i386/cpu.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 target/i386/cpu.h |  2 ++
 2 files changed, 52 insertions(+)
target/i386/cpu.c +50 -0
index d6bb57d..d314c5f 100644
@@ -2934,6 +2934,56 @@ static X86CPUDefinition builtin_x86_defs[] = {
         .model_id = "AMD EPYC Processor (with IBPB)",
         .cache_info = &epyc_cache_info,
     },
+    {
+        .name = "Dhyana",
+        .level = 0xd,
+        .vendor = CPUID_VENDOR_HYGON,
+        .family = 24,
+        .model = 0,
+        .stepping = 1,
+        .features[FEAT_1_EDX] =
+            CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX | CPUID_CLFLUSH |
+            CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_MCA | CPUID_PGE |
+            CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 | CPUID_MCE |
+            CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE | CPUID_DE |
+            CPUID_VME | CPUID_FP87,
+        .features[FEAT_1_ECX] =
+            CPUID_EXT_RDRAND | CPUID_EXT_F16C | CPUID_EXT_AVX |
+            CPUID_EXT_XSAVE | CPUID_EXT_POPCNT |
+            CPUID_EXT_MOVBE | CPUID_EXT_SSE42 | CPUID_EXT_SSE41 |
+            CPUID_EXT_CX16 | CPUID_EXT_FMA | CPUID_EXT_SSSE3 |
+            CPUID_EXT_MONITOR | CPUID_EXT_SSE3,
+        .features[FEAT_8000_0001_EDX] =
+            CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_PDPE1GB |
+            CPUID_EXT2_FFXSR | CPUID_EXT2_MMXEXT | CPUID_EXT2_NX |
+            CPUID_EXT2_SYSCALL,
+        .features[FEAT_8000_0001_ECX] =
+            CPUID_EXT3_OSVW | CPUID_EXT3_3DNOWPREFETCH |
+            CPUID_EXT3_MISALIGNSSE | CPUID_EXT3_SSE4A | CPUID_EXT3_ABM |
+            CPUID_EXT3_CR8LEG | CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM |
+            CPUID_EXT3_TOPOEXT,
+        .features[FEAT_8000_0008_EBX] =
+            CPUID_8000_0008_EBX_IBPB,
+        .features[FEAT_7_0_EBX] =
+            CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 | CPUID_7_0_EBX_AVX2 |
+            CPUID_7_0_EBX_SMEP | CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_RDSEED |
+            CPUID_7_0_EBX_ADX | CPUID_7_0_EBX_SMAP | CPUID_7_0_EBX_CLFLUSHOPT,
+        /*
+         * Missing: XSAVES (not supported by some Linux versions,
+         * including v4.1 to v4.12).
+         * KVM doesn't yet expose any XSAVES state save component.
+         */
+        .features[FEAT_XSAVE] =
+            CPUID_XSAVE_XSAVEOPT | CPUID_XSAVE_XSAVEC |
+            CPUID_XSAVE_XGETBV1,
+        .features[FEAT_6_EAX] =
+            CPUID_6_EAX_ARAT,
+        .features[FEAT_SVM] =
+            CPUID_SVM_NPT | CPUID_SVM_NRIPSAVE,
+        .xlevel = 0x8000001E,
+        .model_id = "Hygon Dhyana Processor",
+        .cache_info = &epyc_cache_info,
+    },
 };
 
 typedef struct PropValue {
target/i386/cpu.h +2 -0
index 83fb522..553dbe7 100644
@@ -726,6 +726,8 @@ typedef uint32_t FeatureWordArray[FEATURE_WORDS];
 
 #define CPUID_VENDOR_VIA   "CentaurHauls"
 
+#define CPUID_VENDOR_HYGON    "HygonGenuine"
+
 #define CPUID_MWAIT_IBE     (1U << 1) /* Interrupts can exit capability */
 #define CPUID_MWAIT_EMX     (1U << 0) /* enumeration supported */
 
Signature · 1 line
2.7.4
Reviewed-by on v3 1/1
#1 lore raw
Quoted 19 lines · Pu Wen

Add a new base CPU model called 'Dhyana' to model processors from Hygon Dhyana(family 18h), which derived from AMD EPYC(family 17h).

The following features bits have been removed compare to AMD EPYC:
aes, pclmulqdq, sha_ni

The Hygon Dhyana support to KVM in Linux is already accepted upstream[1]. So add Hygon Dhyana support to Qemu is necessary to create Hygon's own CPU model.

Reference:
[1] https://git.kernel.org/tip/fec98069fb72fb656304a3e52265e0c2fc9adf87

---
v2->v3:
- Remove the Dhyana machine types in the back-compat property tables since there is no Dhyana CPU model in older QEMU releases.

Quoted 7 lines

v1->v2:
- Remove CPU model 'Dhyana' and rename the CPU model 'Dhyana-IBPB' to 'Dhyana' because Dhyana CPUs already have the IBPB feature.

 target/i386/cpu.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 target/i386/cpu.h |  2 ++
 2 files changed, 52 insertions(+)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#2 lore raw
In reply to Pu Wen
Quoted 9 lines · Pu Wen

Add a new base CPU model called 'Dhyana' to model processors from Hygon Dhyana(family 18h), which derived from AMD EPYC(family 17h).

The following features bits have been removed compare to AMD EPYC:
aes, pclmulqdq, sha_ni

The Hygon Dhyana support to KVM in Linux is already accepted upstream[1]. So add Hygon Dhyana support to Qemu is necessary to create Hygon's own CPU model.

I have once question that we will have to solve for EPYC CPUs as well. The name should not be based on the Product name or Model name as that usually doesn't change with introduction of new microarchitecture.

With EPYC we made a mistake to name the CPU like that, luckily with Intel we already use the microarchitecture name, so the EPYC CPU should have been named ZEN-Server and for Ryzen CPUs there should be ZEN-Client if there is any difference or otherwise we can simply use ZEN.

The issue here is what happens once the ZEN2 microarchitecture is out wihch introduces new features and we will have to come up with a CPU name.

Obviously we cannot change/remove the EPYC models so the question is what is the difference between the AMD EPYC CPU and this new Dhyana CPU if they are both based on the ZEN microarchitecture?

In addition is there any way how we can introduce ZEN-Server & ZEN-Client or simply ZEN, if there is no difference, as an alias or a new model next to the EPYC?

Pavel

#3 lore raw
Quoted 24 lines · Pavel Hrdina
Quoted 9 lines · Pu Wen

Add a new base CPU model called 'Dhyana' to model processors from Hygon Dhyana(family 18h), which derived from AMD EPYC(family 17h).

The following features bits have been removed compare to AMD EPYC:
aes, pclmulqdq, sha_ni

The Hygon Dhyana support to KVM in Linux is already accepted upstream[1]. So add Hygon Dhyana support to Qemu is necessary to create Hygon's own CPU model.

I have once question that we will have to solve for EPYC CPUs as well. The name should not be based on the Product name or Model name as that usually doesn't change with introduction of new microarchitecture.

With EPYC we made a mistake to name the CPU like that, luckily with Intel we already use the microarchitecture name, so the EPYC CPU should have been named ZEN-Server and for Ryzen CPUs there should be ZEN-Client if there is any difference or otherwise we can simply use ZEN.

The issue here is what happens once the ZEN2 microarchitecture is out wihch introduces new features and we will have to come up with a CPU name.

Quoted 7 lines

Obviously we cannot change/remove the EPYC models so the question is what is the difference between the AMD EPYC CPU and this new Dhyana CPU if they are both based on the ZEN microarchitecture?

In addition is there any way how we can introduce ZEN-Server & ZEN-Client or simply ZEN, if there is no difference, as an alias or a new model next to the EPYC?

Currently there's no CPU model alias or inheritance system in x86 (yet), but feel free to submit a CPU model that's a copy of EPYC, including the justification above.

When we implement CPU model versioning, we can make "EPYC" be translated to "ZEN" by the CPU model version resolution API.

Signature · 1 line
Eduardo
author
#4 lore raw
In reply to Pavel Hrdina
Quoted 20 lines · Pavel Hrdina
Quoted 9 lines · Pu Wen

Add a new base CPU model called 'Dhyana' to model processors from Hygon Dhyana(family 18h), which derived from AMD EPYC(family 17h).

The following features bits have been removed compare to AMD EPYC:
aes, pclmulqdq, sha_ni

The Hygon Dhyana support to KVM in Linux is already accepted upstream[1]. So add Hygon Dhyana support to Qemu is necessary to create Hygon's own CPU model.

I have once question that we will have to solve for EPYC CPUs as well. The name should not be based on the Product name or Model name as that usually doesn't change with introduction of new microarchitecture.

With EPYC we made a mistake to name the CPU like that, luckily with Intel we already use the microarchitecture name, so the EPYC CPU should have been named ZEN-Server and for Ryzen CPUs there should be ZEN-Client if there is any difference or otherwise we can simply use ZEN.

Quoted 7 lines

The issue here is what happens once the ZEN2 microarchitecture is out wihch introduces new features and we will have to come up with a CPU name.

Obviously we cannot change/remove the EPYC models so the question is what is the difference between the AMD EPYC CPU and this new Dhyana CPU if they are both based on the ZEN microarchitecture?

Right now there's no much difference between Dhyana and EPYC from the software's view. Dhyana removed the instructions aes, pclmulqdq, sha_ni compared to EPYC, but will have it's own implementation such as for aes in future CPU models. Hygon also will implement something different from AMD in the future.

Quoted 3 lines

In addition is there any way how we can introduce ZEN-Server & ZEN-Client or simply ZEN, if there is no difference, as an alias or a new model next to the EPYC?

Also as Eduardo mentioned that there's no CPU model alias or inheritance system in x86, so I think it's worthwhile to keep a separate CPU model for Hygon.

Signature · 2 lines
Regards,
Pu Wen
#5 lore raw
Quoted 35 lines · Pu Wen
Quoted 20 lines · Pavel Hrdina
Quoted 9 lines · Pu Wen

Add a new base CPU model called 'Dhyana' to model processors from Hygon Dhyana(family 18h), which derived from AMD EPYC(family 17h).

The following features bits have been removed compare to AMD EPYC:
aes, pclmulqdq, sha_ni

The Hygon Dhyana support to KVM in Linux is already accepted upstream[1]. So add Hygon Dhyana support to Qemu is necessary to create Hygon's own CPU model.

I have once question that we will have to solve for EPYC CPUs as well. The name should not be based on the Product name or Model name as that usually doesn't change with introduction of new microarchitecture.

With EPYC we made a mistake to name the CPU like that, luckily with Intel we already use the microarchitecture name, so the EPYC CPU should have been named ZEN-Server and for Ryzen CPUs there should be ZEN-Client if there is any difference or otherwise we can simply use ZEN.

Quoted 7 lines

The issue here is what happens once the ZEN2 microarchitecture is out wihch introduces new features and we will have to come up with a CPU name.

Obviously we cannot change/remove the EPYC models so the question is what is the difference between the AMD EPYC CPU and this new Dhyana CPU if they are both based on the ZEN microarchitecture?

Right now there's no much difference between Dhyana and EPYC from the software's view. Dhyana removed the instructions aes, pclmulqdq, sha_ni compared to EPYC, but will have it's own implementation such as for aes in future CPU models. Hygon also will implement something different from AMD in the future.

Quoted 7 lines
Quoted 3 lines

In addition is there any way how we can introduce ZEN-Server & ZEN-Client or simply ZEN, if there is no difference, as an alias or a new model next to the EPYC?

Also as Eduardo mentioned that there's no CPU model alias or inheritance system in x86, so I think it's worthwhile to keep a separate CPU model for Hygon.

So what happens once Zen2 is out and there are new Dhyana CPUs based on the Zen2 microarchitecture with some new features, what CPU models we will introduce, EPYC-G2 and Dhyana-G2, but that will not correspond to the CPU model anymore.

My idea was that we should probably introduce CPU model Zen-Server which could cover both EPYC and Dhyana as they are both based on the Zen microarchitecture. The fact that Dhyana doesn't support all the features is not an issue as QEMU will not use them if they are not available on the host.

Another possibility is to introduce Zen-Server (or AMD-Zen-Server) and Hygon-Zen-Server with different set of features.

In the future when new microarchitecture is introduced we can simply use the exact name of the microarchitecture and we don't have to follow the road as we did with AMD Opteron CPUs where we have different suffixes.

The whole point is that we should name the CPUs the same way for all vendors and stop introducing new CPU names that will create more confusion.

Pavel

#6 lore raw
Quoted 49 lines · Pavel Hrdina
Quoted 35 lines · Pu Wen
Quoted 20 lines · Pavel Hrdina
Quoted 9 lines · Pu Wen

Add a new base CPU model called 'Dhyana' to model processors from Hygon Dhyana(family 18h), which derived from AMD EPYC(family 17h).

The following features bits have been removed compare to AMD EPYC:
aes, pclmulqdq, sha_ni

The Hygon Dhyana support to KVM in Linux is already accepted upstream[1]. So add Hygon Dhyana support to Qemu is necessary to create Hygon's own CPU model.

I have once question that we will have to solve for EPYC CPUs as well. The name should not be based on the Product name or Model name as that usually doesn't change with introduction of new microarchitecture.

With EPYC we made a mistake to name the CPU like that, luckily with Intel we already use the microarchitecture name, so the EPYC CPU should have been named ZEN-Server and for Ryzen CPUs there should be ZEN-Client if there is any difference or otherwise we can simply use ZEN.

Quoted 7 lines

The issue here is what happens once the ZEN2 microarchitecture is out wihch introduces new features and we will have to come up with a CPU name.

Obviously we cannot change/remove the EPYC models so the question is what is the difference between the AMD EPYC CPU and this new Dhyana CPU if they are both based on the ZEN microarchitecture?

Right now there's no much difference between Dhyana and EPYC from the software's view. Dhyana removed the instructions aes, pclmulqdq, sha_ni compared to EPYC, but will have it's own implementation such as for aes in future CPU models. Hygon also will implement something different from AMD in the future.

Quoted 7 lines
Quoted 3 lines

In addition is there any way how we can introduce ZEN-Server & ZEN-Client or simply ZEN, if there is no difference, as an alias or a new model next to the EPYC?

Also as Eduardo mentioned that there's no CPU model alias or inheritance system in x86, so I think it's worthwhile to keep a separate CPU model for Hygon.

So what happens once Zen2 is out and there are new Dhyana CPUs based on the Zen2 microarchitecture with some new features, what CPU models we will introduce, EPYC-G2 and Dhyana-G2, but that will not correspond to the CPU model anymore.

Quoted 5 lines

My idea was that we should probably introduce CPU model Zen-Server which could cover both EPYC and Dhyana as they are both based on the Zen microarchitecture. The fact that Dhyana doesn't support all the features is not an issue as QEMU will not use them if they are not available on the host.

I don't think this is a good idea. AFAICT, Dhyana and EPYC should not be thought of as the same microarchitecture. Dhyana is a fork of the Zen microarchitecture as illustrated by the dropping of a number of CPU features. The Dhyana SEV patches show that it has had other significant changes, which are likely to require extra work in QEMU to support too.

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#7 lore raw
Quoted 56 lines · Daniel P. Berrangé
Quoted 49 lines · Pavel Hrdina
Quoted 35 lines · Pu Wen
Quoted 20 lines · Pavel Hrdina
Quoted 9 lines · Pu Wen

Add a new base CPU model called 'Dhyana' to model processors from Hygon Dhyana(family 18h), which derived from AMD EPYC(family 17h).

The following features bits have been removed compare to AMD EPYC:
aes, pclmulqdq, sha_ni

The Hygon Dhyana support to KVM in Linux is already accepted upstream[1]. So add Hygon Dhyana support to Qemu is necessary to create Hygon's own CPU model.

I have once question that we will have to solve for EPYC CPUs as well. The name should not be based on the Product name or Model name as that usually doesn't change with introduction of new microarchitecture.

With EPYC we made a mistake to name the CPU like that, luckily with Intel we already use the microarchitecture name, so the EPYC CPU should have been named ZEN-Server and for Ryzen CPUs there should be ZEN-Client if there is any difference or otherwise we can simply use ZEN.

Quoted 7 lines

The issue here is what happens once the ZEN2 microarchitecture is out wihch introduces new features and we will have to come up with a CPU name.

Obviously we cannot change/remove the EPYC models so the question is what is the difference between the AMD EPYC CPU and this new Dhyana CPU if they are both based on the ZEN microarchitecture?

Right now there's no much difference between Dhyana and EPYC from the software's view. Dhyana removed the instructions aes, pclmulqdq, sha_ni compared to EPYC, but will have it's own implementation such as for aes in future CPU models. Hygon also will implement something different from AMD in the future.

Quoted 7 lines
Quoted 3 lines

In addition is there any way how we can introduce ZEN-Server & ZEN-Client or simply ZEN, if there is no difference, as an alias or a new model next to the EPYC?

Also as Eduardo mentioned that there's no CPU model alias or inheritance system in x86, so I think it's worthwhile to keep a separate CPU model for Hygon.

So what happens once Zen2 is out and there are new Dhyana CPUs based on the Zen2 microarchitecture with some new features, what CPU models we will introduce, EPYC-G2 and Dhyana-G2, but that will not correspond to the CPU model anymore.

Quoted 5 lines

My idea was that we should probably introduce CPU model Zen-Server which could cover both EPYC and Dhyana as they are both based on the Zen microarchitecture. The fact that Dhyana doesn't support all the features is not an issue as QEMU will not use them if they are not available on the host.

Quoted 5 lines

I don't think this is a good idea. AFAICT, Dhyana and EPYC should not be thought of as the same microarchitecture. Dhyana is a fork of the Zen microarchitecture as illustrated by the dropping of a number of CPU features. The Dhyana SEV patches show that it has had other significant changes, which are likely to require extra work in QEMU to support too.

Fair enough, still the point stands that we should use the name of the microarchitecture.

Pavel

#8 lore raw
Quoted 51 lines · Pavel Hrdina
Quoted 50 lines · Daniel P. Berrangé
Quoted 49 lines · Pavel Hrdina
Quoted 35 lines · Pu Wen
Quoted 20 lines · Pavel Hrdina
Quoted 9 lines · Pu Wen

Add a new base CPU model called 'Dhyana' to model processors from Hygon Dhyana(family 18h), which derived from AMD EPYC(family 17h).

The following features bits have been removed compare to AMD EPYC:
aes, pclmulqdq, sha_ni

The Hygon Dhyana support to KVM in Linux is already accepted upstream[1]. So add Hygon Dhyana support to Qemu is necessary to create Hygon's own CPU model.

I have once question that we will have to solve for EPYC CPUs as well. The name should not be based on the Product name or Model name as that usually doesn't change with introduction of new microarchitecture.

With EPYC we made a mistake to name the CPU like that, luckily with Intel we already use the microarchitecture name, so the EPYC CPU should have been named ZEN-Server and for Ryzen CPUs there should be ZEN-Client if there is any difference or otherwise we can simply use ZEN.

Quoted 7 lines

The issue here is what happens once the ZEN2 microarchitecture is out wihch introduces new features and we will have to come up with a CPU name.

Obviously we cannot change/remove the EPYC models so the question is what is the difference between the AMD EPYC CPU and this new Dhyana CPU if they are both based on the ZEN microarchitecture?

Right now there's no much difference between Dhyana and EPYC from the software's view. Dhyana removed the instructions aes, pclmulqdq, sha_ni compared to EPYC, but will have it's own implementation such as for aes in future CPU models. Hygon also will implement something different from AMD in the future.

Quoted 7 lines
Quoted 3 lines

In addition is there any way how we can introduce ZEN-Server & ZEN-Client or simply ZEN, if there is no difference, as an alias or a new model next to the EPYC?

Also as Eduardo mentioned that there's no CPU model alias or inheritance system in x86, so I think it's worthwhile to keep a separate CPU model for Hygon.

So what happens once Zen2 is out and there are new Dhyana CPUs based on the Zen2 microarchitecture with some new features, what CPU models we will introduce, EPYC-G2 and Dhyana-G2, but that will not correspond to the CPU model anymore.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

My idea was that we should probably introduce CPU model Zen-Server which could cover both EPYC and Dhyana as they are both based on the Zen microarchitecture. The fact that Dhyana doesn't support all the features is not an issue as QEMU will not use them if they are not available on the host.

It is an issue. The fact that features are missing has huge importance for most virtualization management software that supports live migration.

Not having the "enforce" flag enabled by default was a mistake, but it's hard to fix because we don't want to break backwards compatibility.

Quoted 9 lines
Quoted 6 lines

I don't think this is a good idea. AFAICT, Dhyana and EPYC should not be thought of as the same microarchitecture. Dhyana is a fork of the Zen microarchitecture as illustrated by the dropping of a number of CPU features. The Dhyana SEV patches show that it has had other significant changes, which are likely to require extra work in QEMU to support too.

Fair enough, still the point stands that we should use the name of the microarchitecture.

Note that using "microarchitecture[-variant]" is likely to be necessary if there's variation inside the same microarchitecture. We absolutely need to use different names for different sets of CPU features if we want to support them out of the box.

Note that we can't (and don't need to) enumerate all possible combinations of features that exist in the world. I let CPU vendors who submit patches decide which combinations of features are important to be supported out of the box.

Dhyana adds to the complexity, because of the new CPU vendor ID. Different vendor IDs require different CPU models because the CPU model contains family/model/stepping/model_id values that make sense only in conjunction with the vendor ID. Should we call it Zen-Dhyana? Dhyana_G1? I think I'll just let the Hygon developers decide.

Signature · 1 line
Eduardo
#9 lore raw
Quoted 86 lines · Eduardo Habkost
Quoted 51 lines · Pavel Hrdina
Quoted 50 lines · Daniel P. Berrangé
Quoted 49 lines · Pavel Hrdina
Quoted 35 lines · Pu Wen
Quoted 20 lines · Pavel Hrdina
Quoted 9 lines · Pu Wen

Add a new base CPU model called 'Dhyana' to model processors from Hygon Dhyana(family 18h), which derived from AMD EPYC(family 17h).

The following features bits have been removed compare to AMD EPYC:
aes, pclmulqdq, sha_ni

The Hygon Dhyana support to KVM in Linux is already accepted upstream[1]. So add Hygon Dhyana support to Qemu is necessary to create Hygon's own CPU model.

I have once question that we will have to solve for EPYC CPUs as well. The name should not be based on the Product name or Model name as that usually doesn't change with introduction of new microarchitecture.

With EPYC we made a mistake to name the CPU like that, luckily with Intel we already use the microarchitecture name, so the EPYC CPU should have been named ZEN-Server and for Ryzen CPUs there should be ZEN-Client if there is any difference or otherwise we can simply use ZEN.

Quoted 7 lines

The issue here is what happens once the ZEN2 microarchitecture is out wihch introduces new features and we will have to come up with a CPU name.

Obviously we cannot change/remove the EPYC models so the question is what is the difference between the AMD EPYC CPU and this new Dhyana CPU if they are both based on the ZEN microarchitecture?

Right now there's no much difference between Dhyana and EPYC from the software's view. Dhyana removed the instructions aes, pclmulqdq, sha_ni compared to EPYC, but will have it's own implementation such as for aes in future CPU models. Hygon also will implement something different from AMD in the future.

Quoted 7 lines
Quoted 3 lines

In addition is there any way how we can introduce ZEN-Server & ZEN-Client or simply ZEN, if there is no difference, as an alias or a new model next to the EPYC?

Also as Eduardo mentioned that there's no CPU model alias or inheritance system in x86, so I think it's worthwhile to keep a separate CPU model for Hygon.

So what happens once Zen2 is out and there are new Dhyana CPUs based on the Zen2 microarchitecture with some new features, what CPU models we will introduce, EPYC-G2 and Dhyana-G2, but that will not correspond to the CPU model anymore.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

My idea was that we should probably introduce CPU model Zen-Server which could cover both EPYC and Dhyana as they are both based on the Zen microarchitecture. The fact that Dhyana doesn't support all the features is not an issue as QEMU will not use them if they are not available on the host.

It is an issue. The fact that features are missing has huge importance for most virtualization management software that supports live migration.

Not having the "enforce" flag enabled by default was a mistake, but it's hard to fix because we don't want to break backwards compatibility.

Quoted 9 lines
Quoted 6 lines

I don't think this is a good idea. AFAICT, Dhyana and EPYC should not be thought of as the same microarchitecture. Dhyana is a fork of the Zen microarchitecture as illustrated by the dropping of a number of CPU features. The Dhyana SEV patches show that it has had other significant changes, which are likely to require extra work in QEMU to support too.

Fair enough, still the point stands that we should use the name of the microarchitecture.

Note that using "microarchitecture[-variant]" is likely to be necessary if there's variation inside the same microarchitecture. We absolutely need to use different names for different sets of CPU features if we want to support them out of the box.

Note that we can't (and don't need to) enumerate all possible combinations of features that exist in the world. I let CPU vendors who submit patches decide which combinations of features are important to be supported out of the box.

Quoted 6 lines

Dhyana adds to the complexity, because of the new CPU vendor ID. Different vendor IDs require different CPU models because the CPU model contains family/model/stepping/model_id values that make sense only in conjunction with the vendor ID. Should we call it Zen-Dhyana? Dhyana_G1? I think I'll just let the Hygon developers decide.

Just for the reference, this discussion happened last year and AMD developer Brijesh agreed [1] that the microarchitecture name would be better, one of the reasons I've objected again.

Pavel

[1] <https://lists.gnu.org/archive/html/qemu-devel/2018-07/msg03902.html>

#10 lore raw
In reply to Pu Wen
Quoted 6 lines · Pu Wen

Add a new base CPU model called 'Dhyana' to model processors from Hygon Dhyana(family 18h), which derived from AMD EPYC(family 17h).

The following features bits have been removed compare to AMD EPYC:
aes, pclmulqdq, sha_ni

Quoted 8 lines

The Hygon Dhyana support to KVM in Linux is already accepted upstream[1]. So add Hygon Dhyana support to Qemu is necessary to create Hygon's own CPU model.

Reference:
[1] https://git.kernel.org/tip/fec98069fb72fb656304a3e52265e0c2fc9adf87

Queued for 4.1, thanks!

Signature · 1 line
Eduardo
author
#11 lore raw
Quoted 11 lines · Eduardo Habkost
Quoted 10 lines · Pu Wen

Add a new base CPU model called 'Dhyana' to model processors from Hygon Dhyana(family 18h), which derived from AMD EPYC(family 17h).

The following features bits have been removed compare to AMD EPYC:
aes, pclmulqdq, sha_ni

The Hygon Dhyana support to KVM in Linux is already accepted upstream[1]. So add Hygon Dhyana support to Qemu is necessary to create Hygon's own CPU model.

Quoted 6 lines
Quoted 4 lines

Reference:
[1] https://git.kernel.org/tip/fec98069fb72fb656304a3e52265e0c2fc9adf87

Queued for 4.1, thanks!

Thanks a lot!

Signature · 2 lines
Regards,
Pu Wen