i386: Add new Hygon 'Dhyana' CPU model
PATCH v2 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
---v1->v2:
- Remove CPU model 'Dhyana' and rename the CPU model 'Dhyana-IBPB' to 'Dhyana' because Dhyana CPUs already have the IBPB feature.
hw/i386/pc.c | 3 +++ target/i386/cpu.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ target/i386/cpu.h | 2 ++ 3 files changed, 55 insertions(+)
hw/i386/pc.c +3 -0
@@ -128,6 +128,8 @@ GlobalProperty pc_compat_3_1[] = { { "EPYC" "-" TYPE_X86_CPU, "nrip-save", "off" }, { "EPYC-IBPB" "-" TYPE_X86_CPU, "npt", "off" }, { "EPYC-IBPB" "-" TYPE_X86_CPU, "nrip-save", "off" }, + { "Dhyana" "-" TYPE_X86_CPU, "npt", "off" }, + { "Dhyana" "-" TYPE_X86_CPU, "nrip-save", "off" }, { "Skylake-Client" "-" TYPE_X86_CPU, "mpx", "on" }, { "Skylake-Client-IBRS" "-" TYPE_X86_CPU, "mpx", "on" }, { "Skylake-Server" "-" TYPE_X86_CPU, "mpx", "on" },
@@ -152,6 +154,7 @@ GlobalProperty pc_compat_2_12[] = { { TYPE_X86_CPU, "topoext", "off" }, { "EPYC-" TYPE_X86_CPU, "xlevel", "0x8000000a" }, { "EPYC-IBPB-" TYPE_X86_CPU, "xlevel", "0x8000000a" }, + { "Dhyana-" TYPE_X86_CPU, "xlevel", "0x8000000a" }, };const size_t pc_compat_2_12_len =G_N_ELEMENTS (pc_compat_2_12);
target/i386/cpu.c +50 -0
56 lines not on this page · raw message
target/i386/cpu.h +2 -0
@@ -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
Quoted 38 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_niThe 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/fec98069fb72fb656304a3e52265e0c2fc9adf87Signed-off-by Pu Wen <[email protected]>---
v1->v2:
- Remove CPU model 'Dhyana' and rename the CPU model 'Dhyana-IBPB' to 'Dhyana' because Dhyana CPUs already have the IBPB feature.hw/i386/pc.c | 3 +++ target/i386/cpu.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ target/i386/cpu.h | 2 ++ 3 files changed, 55 insertions(+)hw/i386/pc.c +2
-0@@ -128,6 +128,8 @@ GlobalProperty pc_compat_3_1[] = { { "EPYC" "-" TYPE_X86_CPU, "nrip-save", "off" }, { "EPYC-IBPB" "-" TYPE_X86_CPU, "npt", "off" }, { "EPYC-IBPB" "-" TYPE_X86_CPU, "nrip-save", "off" }, + { "Dhyana" "-" TYPE_X86_CPU, "npt", "off" }, + { "Dhyana" "-" TYPE_X86_CPU, "nrip-save", "off" }, { "Skylake-Client" "-" TYPE_X86_CPU, "mpx", "on" }, { "Skylake-Client-IBRS" "-" TYPE_X86_CPU, "mpx", "on" }, { "Skylake-Server" "-" TYPE_X86_CPU, "mpx", "on" },
hw/i386/pc.c GlobalProperty pc_compat_2_12[] = { · line 159
Quoted 6 lines
hw/i386/pc.c +1
-0@@ -152,6 +154,7 @@ GlobalProperty pc_compat_2_12[] = { { TYPE_X86_CPU, "topoext", "off" }, { "EPYC-" TYPE_X86_CPU, "xlevel", "0x8000000a" }, { "EPYC-IBPB-" TYPE_X86_CPU, "xlevel", "0x8000000a" }, + { "Dhyana-" TYPE_X86_CPU, "xlevel", "0x8000000a" }, };const size_t pc_compat_2_12_len =G_N_ELEMENTS (pc_compat_2_12);
You can drop the changes in this file. This CPU model didn't exist in any older QEMU releases, so there's no machine type backcompat required, at least from upstream QEMU POV.
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 :|
Quoted 1 line · Daniel P. Berrangé
On Sat, Apr 13, 2019 at 10:54:40AM +0800, Pu Wen wrote:
...
Quoted 16 lines
Quoted 16 lines
hw/i386/pc.c +2
-0@@ -128,6 +128,8 @@ GlobalProperty pc_compat_3_1[] = { { "EPYC" "-" TYPE_X86_CPU, "nrip-save", "off" }, { "EPYC-IBPB" "-" TYPE_X86_CPU, "npt", "off" }, { "EPYC-IBPB" "-" TYPE_X86_CPU, "nrip-save", "off" }, + { "Dhyana" "-" TYPE_X86_CPU, "npt", "off" }, + { "Dhyana" "-" TYPE_X86_CPU, "nrip-save", "off" }, { "Skylake-Client" "-" TYPE_X86_CPU, "mpx", "on" }, { "Skylake-Client-IBRS" "-" TYPE_X86_CPU, "mpx", "on" }, { "Skylake-Server" "-" TYPE_X86_CPU, "mpx", "on" },@@ -152,6 +154,7 @@ GlobalProperty pc_compat_2_12[] = { { TYPE_X86_CPU, "topoext", "off" }, { "EPYC-" TYPE_X86_CPU, "xlevel", "0x8000000a" },
Quoted 8 lines
hw/i386/pc.c GlobalProperty pc_compat_2_12[] = { · line 159
Quoted 4 lines
hw/i386/pc.c +1
-0{ "EPYC-IBPB-" TYPE_X86_CPU, "xlevel", "0x8000000a" }, + { "Dhyana-" TYPE_X86_CPU, "xlevel", "0x8000000a" }, };const size_t pc_compat_2_12_len =G_N_ELEMENTS (pc_compat_2_12);You can drop the changes in this file. This CPU model didn't exist in any older QEMU releases, so there's no machine type backcompat required, at least from upstream QEMU POV.
Then how about running QEMU with the parameter like "-M pc-i440fx-2.12"? Although the default machine is newer than that.
Signature · 2 lines
Regards, Pu Wen
Quoted 28 lines · Pu Wen
Quoted 1 line · Daniel P. Berrangé
On Sat, Apr 13, 2019 at 10:54:40AM +0800, Pu Wen wrote:
...
Quoted 16 lines
Quoted 16 lines
hw/i386/pc.c +2
-0@@ -128,6 +128,8 @@ GlobalProperty pc_compat_3_1[] = { { "EPYC" "-" TYPE_X86_CPU, "nrip-save", "off" }, { "EPYC-IBPB" "-" TYPE_X86_CPU, "npt", "off" }, { "EPYC-IBPB" "-" TYPE_X86_CPU, "nrip-save", "off" }, + { "Dhyana" "-" TYPE_X86_CPU, "npt", "off" }, + { "Dhyana" "-" TYPE_X86_CPU, "nrip-save", "off" }, { "Skylake-Client" "-" TYPE_X86_CPU, "mpx", "on" }, { "Skylake-Client-IBRS" "-" TYPE_X86_CPU, "mpx", "on" }, { "Skylake-Server" "-" TYPE_X86_CPU, "mpx", "on" },@@ -152,6 +154,7 @@ GlobalProperty pc_compat_2_12[] = { { TYPE_X86_CPU, "topoext", "off" }, { "EPYC-" TYPE_X86_CPU, "xlevel", "0x8000000a" },Quoted 8 lines
hw/i386/pc.c GlobalProperty pc_compat_2_12[] = { · line 159
Quoted 4 lines
hw/i386/pc.c +1
-0{ "EPYC-IBPB-" TYPE_X86_CPU, "xlevel", "0x8000000a" }, + { "Dhyana-" TYPE_X86_CPU, "xlevel", "0x8000000a" }, };const size_t pc_compat_2_12_len =G_N_ELEMENTS (pc_compat_2_12);You can drop the changes in this file. This CPU model didn't exist in any older QEMU releases, so there's no machine type backcompat required, at least from upstream QEMU POV.
Quoted 2 lines
Then how about running QEMU with the parameter like "-M pc-i440fx-2.12"? Although the default machine is newer than that.
That doesnt matter. This back-compat property table is about ensuring that "-cpu Skylake-Client -M pc-i440fx-2.12" run on QEMU 4.0.0 release works the same way as when run on QEMU 2.12.0 release.
Since there is no Dhyana CPU model in QEMU 2.12.0 release, there's no back compat issue to fix.
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 :|
Quoted 18 lines · Daniel P. Berrangé
Quoted 14 lines · Pu Wen
Quoted 12 lines · Daniel P. Berrangé
hw/i386/pc.c GlobalProperty pc_compat_2_12[] = { · line 159
Quoted 7 lines · Pu Wen
hw/i386/pc.c +1
-0@@ -152,6 +154,7 @@ GlobalProperty pc_compat_2_12[] = { { TYPE_X86_CPU, "topoext", "off" }, { "EPYC-" TYPE_X86_CPU, "xlevel", "0x8000000a" }, { "EPYC-IBPB-" TYPE_X86_CPU, "xlevel", "0x8000000a" }, + { "Dhyana-" TYPE_X86_CPU, "xlevel", "0x8000000a" }, };const size_t pc_compat_2_12_len =G_N_ELEMENTS (pc_compat_2_12);You can drop the changes in this file. This CPU model didn't exist in any older QEMU releases, so there's no machine type backcompat required, at least from upstream QEMU POV.
Quoted 2 lines
Then how about running QEMU with the parameter like "-M pc-i440fx-2.12"? Although the default machine is newer than that.
Quoted 6 lines
That doesnt matter. This back-compat property table is about ensuring that "-cpu Skylake-Client -M pc-i440fx-2.12" run on QEMU 4.0.0 release works the same way as when run on QEMU 2.12.0 release.
Since there is no Dhyana CPU model in QEMU 2.12.0 release, there's no back compat issue to fix.
Thanks for the explanation. Will drop the changes in next version patch.
Signature · 2 lines
Regards, 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/fec98069fb72fb656304a3e52265e0c2fc9adf87Signed-off-by Pu Wen <[email protected]>
Thanks for the patch.
I'm wondering if we should let the CPU model be used only on Hygon hosts, to avoid confusion.
Signature · 1 line
Eduardo
Quoted 14 lines · Eduardo Habkost
Quoted 13 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_niThe 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
Quoted 6 lines
Quoted 1 line
Signed-off-by Pu Wen <[email protected]>Thanks for the patch.
I'm wondering if we should let the CPU model be used only on Hygon hosts, to avoid confusion.
Yes, it should be. But how to achieve this?
Signature · 2 lines
Regards, Pu Wen
Quoted 14 lines · Eduardo Habkost
Quoted 13 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_niThe 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
Quoted 6 lines
Quoted 1 line
Signed-off-by Pu Wen <[email protected]>Thanks for the patch.
I'm wondering if we should let the CPU model be used only on Hygon hosts, to avoid confusion.
Why should we artificially restrict it ? All the other CPUs are able to be used on any host that is able to support the feature list required by the CPU model. If some other host has sufficient features to run Dhyana the CPU model we shouldn't block it.
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 :|
Quoted 19 lines · Daniel P. Berrangé
Quoted 18 lines · Eduardo Habkost
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_niQuoted 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/fec98069fb72fb656304a3e52265e0c2fc9adf87Signed-off-by Pu Wen <[email protected]>Thanks for the patch.
Quoted 7 lines
Quoted 2 lines
I'm wondering if we should let the CPU model be used only on Hygon hosts, to avoid confusion.
Why should we artificially restrict it ? All the other CPUs are able to be used on any host that is able to support the feature list required by the CPU model. If some other host has sufficient features to run Dhyana the CPU model we shouldn't block it.
Running it on Intel or AMD hosts will create a frankenstein CPU with vendor=AuthenticAMD|GenuineIntel but with family/model/stepping/model_id values that make sense only on Hygon CPUs. I don't see why this is preferable to simply telling the user that the CPU model is unavailable.
If somebody really needs that specific set of features and know they are runnable on their AMD host, they can easily run "-cpu EPYC,+aes,+pclmulqdq,+sha-ni".
We have the same issue with Intel & AMD CPUs. The only reason we don't prevent this with AMD or Intel CPU models is our huge fear of breaking backwards compatibility.
Signature · 1 line
Eduardo
Quoted 28 lines · Eduardo Habkost
Quoted 19 lines · Daniel P. Berrangé
Quoted 18 lines · Eduardo Habkost
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_niQuoted 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/fec98069fb72fb656304a3e52265e0c2fc9adf87Signed-off-by Pu Wen <[email protected]>Thanks for the patch.
Quoted 7 lines
Quoted 2 lines
I'm wondering if we should let the CPU model be used only on Hygon hosts, to avoid confusion.
Why should we artificially restrict it ? All the other CPUs are able to be used on any host that is able to support the feature list required by the CPU model. If some other host has sufficient features to run Dhyana the CPU model we shouldn't block it.
Quoted 5 lines
Running it on Intel or AMD hosts will create a frankenstein CPU with vendor=AuthenticAMD|GenuineIntel but with family/model/stepping/model_id values that make sense only on Hygon CPUs. I don't see why this is preferable to simply telling the user that the CPU model is unavailable.
IIUC, you're saying that we don't (can't?) honour the "vendor" field QEMU has listed against the CPU model, so the guest sees the vendor of the real physical host ?
If so that's news to me, and does indeed make it interesting to disable the mismatched combination.
Quoted 7 lines
If somebody really needs that specific set of features and know they are runnable on their AMD host, they can easily run "-cpu EPYC,+aes,+pclmulqdq,+sha-ni".
We have the same issue with Intel & AMD CPUs. The only reason we don't prevent this with AMD or Intel CPU models is our huge fear of breaking backwards compatibility.
We could put a deprecation warning that we intended to stop allowing this mismatch Intel/AMD guest vs host models and tie it to machine type.
ie, if we deprecate in 4.1, then in 5.0 we can make pc-i440fx-5.0 machine type refuse to allow this combination.
That way existing deployed guests keep working, and users get some warning that we're going to stop future guests doing this.
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 :|
Quoted 54 lines · Daniel P. Berrangé
Quoted 28 lines · Eduardo Habkost
Quoted 19 lines · Daniel P. Berrangé
Quoted 18 lines · Eduardo Habkost
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_niQuoted 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/fec98069fb72fb656304a3e52265e0c2fc9adf87Signed-off-by Pu Wen <[email protected]>Thanks for the patch.
Quoted 7 lines
Quoted 2 lines
I'm wondering if we should let the CPU model be used only on Hygon hosts, to avoid confusion.
Why should we artificially restrict it ? All the other CPUs are able to be used on any host that is able to support the feature list required by the CPU model. If some other host has sufficient features to run Dhyana the CPU model we shouldn't block it.
Quoted 5 lines
Running it on Intel or AMD hosts will create a frankenstein CPU with vendor=AuthenticAMD|GenuineIntel but with family/model/stepping/model_id values that make sense only on Hygon CPUs. I don't see why this is preferable to simply telling the user that the CPU model is unavailable.
IIUC, you're saying that we don't (can't?) honour the "vendor" field QEMU has listed against the CPU model, so the guest sees the vendor of the real physical host ?
If so that's news to me, and does indeed make it interesting to disable the mismatched combination.
Quoted 7 lines
If somebody really needs that specific set of features and know they are runnable on their AMD host, they can easily run "-cpu EPYC,+aes,+pclmulqdq,+sha-ni".
We have the same issue with Intel & AMD CPUs. The only reason we don't prevent this with AMD or Intel CPU models is our huge fear of breaking backwards compatibility.
We could put a deprecation warning that we intended to stop allowing this mismatch Intel/AMD guest vs host models and tie it to machine type.
Quoted 5 lines
ie, if we deprecate in 4.1, then in 5.0 we can make pc-i440fx-5.0 machine type refuse to allow this combination.
That way existing deployed guests keep working, and users get some warning that we're going to stop future guests doing this.
Yes, it makes sense.
I would prefer to make pc-4.2 refuse to allow this combination, but this would require making libvirt versions released before QEMU 4.2 not translate "pc" to "pc-4.2".
Signature · 1 line
Eduardo