Introduce (x86) CPU model deprecation API
PATCH 1/2 Introduce (x86) CPU model deprecation API
Complement versioned CPU model framework with the ability of marking some versions deprecated. When that CPU model is chosen, get some warning. The warning message is customized, e.g. telling in which future QEMU version will it be obsoleted.
The deprecation message will also appear by x86_cpu_list_entry(), e.g. '-cpu help'.
QMP 'query-cpu-definitions' will also return a bool value indicating the deprecation status.
--- exec.c | 3 +++ include/hw/core/cpu.h | 1 + qapi/machine-target.json | 3 ++- target/i386/cpu.c | 45 +++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 49 insertions(+), 3 deletions(-)
exec.c +3 -0
@@ -981,6 +981,9 @@ const char *parse_cpu_option(const char *cpu_option) cpu_type =object_class_get_name (oc); cc =CPU_CLASS (oc); cc->parse_features (cpu_type, model_pieces[1 ], &error_fatal); +if (cc->deprecation_check) { + cc->deprecation_check (oc); + }g_strfreev (model_pieces);return cpu_type; }
include/hw/core/cpu.h +1 -0
@@ -218,6 +218,7 @@ typedef struct CPUClass {void (*disas_set_info)(CPUState *cpu,disassemble_info *info);vaddr (*adjust_watchpoint_address)(CPUState *cpu,vaddr addr,int len);void (*tcg_initialize)(void ); +void (*deprecation_check)(ObjectClass *oc);/* Keep non-pointer data at the end to minimize holes. */ int gdb_num_core_regs;
qapi/machine-target.json +2 -1
@@ -309,7 +309,8 @@ 'static': 'bool', '*unavailable-features': [ 'str' ], 'typename': 'str', - '*alias-of' : 'str' }, + '*alias-of' : 'str', + 'deprecated' : 'bool' }, 'if': 'defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS)' } ##
target/i386/cpu.c +43 -2
93 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 2/2 Mark Icelake-Client CPU models deprecated
Going to obsolete Icelake-Client CPU models in the future.
--- target/i386/cpu.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
target/i386/cpu.c +9 -1
@@ -3350,7 +3350,12 @@ static X86CPUDefinition builtin_x86_defs[] = { .xlevel = 0x80000008, .model_id = "Intel Core Processor (Icelake)", .versions = (X86CPUVersionDefinition []) { - { .version =1 }, + { + .version =1 , + .deprecated = true, + .note ="Deprecated. Will be obsoleted in v5.1. Please use " +"'Icelake-Server-v1' CPU model" , + }, { .version =2 , .alias ="Icelake-Client-noTSX" ,
@@ -3359,6 +3364,9 @@ static X86CPUDefinition builtin_x86_defs[] = { { "rtm", "off" }, { /* end of list */ } }, + .deprecated = true, + .note = "Deprecated. Will be obsoleted in v5.1. Please use " + "'Icelake-Server-v2' CPU model", }, { /* end of list */ } }
Signature · 1 line
1.8.3.1
Quoted 19 lines · Robert Hoo
Complement versioned CPU model framework with the ability of marking some versions deprecated. When that CPU model is chosen, get some warning. The warning message is customized, e.g. telling in which future QEMU version will it be obsoleted.
The deprecation message will also appear byx86_cpu_list_entry(), e.g. '-cpu help'.
QMP 'query-cpu-definitions' will also return a bool value indicating the deprecation status.Signed-off-by Robert Hoo <[email protected]>--- exec.c | 3 +++ include/hw/core/cpu.h | 1 + qapi/machine-target.json | 3 ++- target/i386/cpu.c | 45 +++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 49 insertions(+), 3 deletions(-)+++
b/qapi/machine-target.json
qapi/machine-target.json line 313
Quoted 6 lines
qapi/machine-target.json +2
-1@@ -309,7 +309,8 @@ 'static': 'bool', '*unavailable-features': [ 'str' ], 'typename': 'str', - '*alias-of' : 'str' }, + '*alias-of' : 'str', + 'deprecated' : 'bool' },
Missing documentation of the new member. Should it be optional (present only when true)?
target/i386/cpu.c struct X86CPUModel { · line 1644
Quoted 7 lines
target/i386/cpu.c +3
-0@@ -1638,6 +1639,11 @@ struct X86CPUModel {* This matters only for "-cpu help" and query-cpu-definitions */ bool is_alias; +/* +* If true, this is deprecated and obsoleted in the future. +* Trying to use deprecated CPU model shall be warned.
If true, this model is deprecated, and may be removed in the future. Trying to use it now will cause a warning.
Quoted 4 lines
target/i386/cpu.c +2
-0+*/ +bool deprecated; };
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Quoted 27 lines · Eric Blake
Quoted 26 lines · Robert Hoo
Complement versioned CPU model framework with the ability of marking some
versions deprecated. When that CPU model is chosen, get some warning. The
warning message is customized, e.g. telling in which future QEMU version will
it be obsoleted.
The deprecation message will also appear byx86_cpu_list_entry(), e.g. '-cpu
help'.
QMP 'query-cpu-definitions' will also return a bool value indicating the
deprecation status.Signed-off-by Robert Hoo <[email protected]>--- exec.c | 3 +++ include/hw/core/cpu.h | 1 + qapi/machine-target.json | 3 ++- target/i386/cpu.c | 45 +++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 49 insertions(+), 3 deletions(-)+++
b/qapi/machine-target.jsonqapi/machine-target.json +0
-0@@ -309,7 +309,8 @@ 'static': 'bool', '*unavailable-features': [ 'str' ],
Quoted 8 lines
qapi/machine-target.json line 313
Quoted 4 lines
qapi/machine-target.json +2
-1'typename': 'str', - '*alias-of' : 'str' }, + '*alias-of' : 'str', + 'deprecated' : 'bool' },Missing documentation of the new member. Should it be optional (present
only when true)?
Which document do you mean?
How to make it optional?
(Sorry, new to QMP)
Quoted 12 lines
target/i386/cpu.c struct X86CPUModel { · line 1644
Quoted 9 lines
(quoted diff) +0
-0@@ -1638,6 +1639,11 @@ struct X86CPUModel { * This matters only for "-cpu help" and query-cpu-definitions
*/ bool is_alias;target/i386/cpu.c +3
-0+/* +* If true, this is deprecated and obsoleted in the future. +* Trying to use deprecated CPU model shall be warned. If true, this model is deprecated, and may be removed in the future. Trying to use it now will cause a warning.
Thanks Eric:)
Quoted 7 lines
Quoted 5 lines
target/i386/cpu.c +2
-0+*/ +bool deprecated; };
Quoted 12 lines · Robert Hoo
Quoted 4 lines
Quoted 4 lines
+++
b/qapi/machine-target.jsonqapi/machine-target.json +0
-0@@ -309,7 +309,8 @@ 'static': 'bool', '*unavailable-features': [ 'str' ],Quoted 8 lines
qapi/machine-target.json line 313
Quoted 4 lines
qapi/machine-target.json +2
-1'typename': 'str', - '*alias-of' : 'str' }, + '*alias-of' : 'str', + 'deprecated' : 'bool' },Missing documentation of the new member. Should it be optional (present
only when true)?
Quoted 1 line
Which document do you mean?
A few lines earlier is '@alias-of: ...'; you'll need to add a similar line for '@deprecated', mentioning it is '(since 5.1)'.
Quoted 1 line
How to make it optional?
Name it '*deprecated', then deal with 'has_deprecated' in the C code for the cases where the member should be output.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Quoted 15 lines · Eric Blake
Quoted 13 lines · Robert Hoo
Quoted 12 lines
qapi/machine-target.json line 313
Quoted 8 lines
+++
b/qapi/machine-target.jsonqapi/machine-target.json +2
-1@@ -309,7 +309,8 @@ 'static': 'bool', '*unavailable-features': [ 'str' ], 'typename': 'str', - '*alias-of' : 'str' }, + '*alias-of' : 'str', + 'deprecated' : 'bool' },Missing documentation of the new member. Should it be optional (present
only when true)?
Quoted 1 line
Quoted 1 line
Which document do you mean?
Thanks Eric:)
Quoted 6 lines
A few lines earlier is '@alias-of: ...'; you'll need to add a similar
line for '@deprecated', mentioning it is '(since 5.1)'.Quoted 1 line
How to make it optional?
How about not making it optional? refer to Machineinfo::deprecated.
Quoted 5 lines
Name it '*deprecated', then deal with '
has_deprecated' in the C code for
the cases where the member should be output.
Quoted 21 lines · Robert Hoo
Quoted 15 lines · Eric Blake
Quoted 13 lines · Robert Hoo
Quoted 12 lines
qapi/machine-target.json line 313
Quoted 8 lines
+++
b/qapi/machine-target.jsonqapi/machine-target.json +2
-1@@ -309,7 +309,8 @@ 'static': 'bool', '*unavailable-features': [ 'str' ], 'typename': 'str', - '*alias-of' : 'str' }, + '*alias-of' : 'str', + 'deprecated' : 'bool' },Missing documentation of the new member. Should it be optional (present
only when true)?Quoted 1 line
Quoted 1 line
Which document do you mean?
Thanks Eric:)
Quoted 1 line
Quoted 7 lines
Quoted 5 lines
A few lines earlier is '@alias-of: ...'; you'll need to add a similar
line for '@deprecated', mentioning it is '(since 5.1)'.Quoted 1 line
How to make it optional?
How about not making it optional? refer to
Machineinfo::deprecated.
Always providing it doesn't hurt. If there is precedence for not making it optional, mentioning that precedence in the commit message can't hurt.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Quoted 27 lines · Eric Blake
Quoted 26 lines · Robert Hoo
Quoted 16 lines · Eric Blake
Quoted 14 lines · Robert Hoo
Quoted 13 lines
qapi/machine-target.json line 313
Quoted 8 lines
+++
b/qapi/machine-target.jsonqapi/machine-target.json +2
-1@@ -309,7 +309,8 @@ 'static': 'bool', '*unavailable-features': [ 'str' ], 'typename': 'str', - '*alias-of' : 'str' }, + '*alias-of' : 'str', + 'deprecated' : 'bool' },Missing documentation of the new member. Should it be optional
(present
only when true)?Quoted 1 line
Quoted 1 line
Which document do you mean?
Thanks Eric:)
Quoted 5 lines
A few lines earlier is '@alias-of: ...'; you'll need to add a similar
line for '@deprecated', mentioning it is '(since 5.1)'.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
How to make it optional?
How about not making it optional? refer to
Machineinfo::deprecated.Always providing it doesn't hurt. If there is precedence for not making
it optional, mentioning that precedence in the commit message can't hurt.
No specific precedence. Just feel a little weird that adding an additional boolean, just for judging another boolean should present or not. esp. given that Machineinfo::deprecated is not optional.