Re: [PULL 03/33] i386: split cpu accelerators from cpu.c, using AccelCPUClass

2021-08-20 Thread Peter Maydell
On Fri, 20 Aug 2021 at 18:02, Philippe Mathieu-Daudé  wrote:
>
> On 8/20/21 6:55 PM, Peter Maydell wrote:
> > On Tue, 11 May 2021 at 09:22, Paolo Bonzini  wrote:
> >>
> >> From: Claudio Fontana 
> >>
> >> i386 is the first user of AccelCPUClass, allowing to split
> >> cpu.c into:
> >>
> >> cpu.ccpuid and common x86 cpu functionality
> >> host-cpu.c   host x86 cpu functions and "host" cpu type
> >> kvm/kvm-cpu.cKVM x86 AccelCPUClass
> >> hvf/hvf-cpu.cHVF x86 AccelCPUClass
> >> tcg/tcg-cpu.cTCG x86 AccelCPUClass
> >>
> >> Signed-off-by: Claudio Fontana 
> >> Reviewed-by: Alex Bennée 
> >> Reviewed-by: Richard Henderson 
> >>
> >> [claudio]:
> >> Rebased on commit b8184135 ("target/i386: allow modifying TCG 
> >> phys-addr-bits")
> >>
> >> Signed-off-by: Claudio Fontana 
> >> Message-Id: <20210322132800.7470-5-cfont...@suse.de>
> >> Signed-off-by: Paolo Bonzini 
> >> ---
> >
> >> diff --git a/MAINTAINERS b/MAINTAINERS
> >> index b692c8fbee..c2723b32cb 100644
> >> --- a/MAINTAINERS
> >> +++ b/MAINTAINERS
> >> @@ -351,7 +351,7 @@ M: Paolo Bonzini 
> >>  M: Richard Henderson 
> >>  M: Eduardo Habkost 
> >>  S: Maintained
> >> -F: target/i386/
> >> +F: target/i386/tcg/
> >>  F: tests/tcg/i386/
> >>  F: tests/tcg/x86_64/
> >>  F: hw/i386/
> >
> > This change to MAINTAINERS has left all the .c files
> > in target/i386 that are not in one of the tcg, hvf, whpx,
> > kvm, hax, nvmm subdirectories orphaned -- they are no
> > longer covered by any MAINTAINERS section.
> >
> > Where should those files be listed ?
> >
> > (I just discovered this when get_maintainers.pl said it couldn't
> > find a maintainer for a change I made to target/i386/sev.c.)
>
> This patch maybe got lost:
> https://www.mail-archive.com/qemu-devel@nongnu.org/msg816326.html

Looks like it, but we should have a general fallback for target/i386
as well...

-- PMM



Re: [PULL 03/33] i386: split cpu accelerators from cpu.c, using AccelCPUClass

2021-08-20 Thread Philippe Mathieu-Daudé
On 8/20/21 6:55 PM, Peter Maydell wrote:
> On Tue, 11 May 2021 at 09:22, Paolo Bonzini  wrote:
>>
>> From: Claudio Fontana 
>>
>> i386 is the first user of AccelCPUClass, allowing to split
>> cpu.c into:
>>
>> cpu.ccpuid and common x86 cpu functionality
>> host-cpu.c   host x86 cpu functions and "host" cpu type
>> kvm/kvm-cpu.cKVM x86 AccelCPUClass
>> hvf/hvf-cpu.cHVF x86 AccelCPUClass
>> tcg/tcg-cpu.cTCG x86 AccelCPUClass
>>
>> Signed-off-by: Claudio Fontana 
>> Reviewed-by: Alex Bennée 
>> Reviewed-by: Richard Henderson 
>>
>> [claudio]:
>> Rebased on commit b8184135 ("target/i386: allow modifying TCG 
>> phys-addr-bits")
>>
>> Signed-off-by: Claudio Fontana 
>> Message-Id: <20210322132800.7470-5-cfont...@suse.de>
>> Signed-off-by: Paolo Bonzini 
>> ---
> 
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index b692c8fbee..c2723b32cb 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -351,7 +351,7 @@ M: Paolo Bonzini 
>>  M: Richard Henderson 
>>  M: Eduardo Habkost 
>>  S: Maintained
>> -F: target/i386/
>> +F: target/i386/tcg/
>>  F: tests/tcg/i386/
>>  F: tests/tcg/x86_64/
>>  F: hw/i386/
> 
> This change to MAINTAINERS has left all the .c files
> in target/i386 that are not in one of the tcg, hvf, whpx,
> kvm, hax, nvmm subdirectories orphaned -- they are no
> longer covered by any MAINTAINERS section.
> 
> Where should those files be listed ?
> 
> (I just discovered this when get_maintainers.pl said it couldn't
> find a maintainer for a change I made to target/i386/sev.c.)

This patch maybe got lost:
https://www.mail-archive.com/qemu-devel@nongnu.org/msg816326.html




Re: [PULL 03/33] i386: split cpu accelerators from cpu.c, using AccelCPUClass

2021-08-20 Thread Peter Maydell
On Tue, 11 May 2021 at 09:22, Paolo Bonzini  wrote:
>
> From: Claudio Fontana 
>
> i386 is the first user of AccelCPUClass, allowing to split
> cpu.c into:
>
> cpu.ccpuid and common x86 cpu functionality
> host-cpu.c   host x86 cpu functions and "host" cpu type
> kvm/kvm-cpu.cKVM x86 AccelCPUClass
> hvf/hvf-cpu.cHVF x86 AccelCPUClass
> tcg/tcg-cpu.cTCG x86 AccelCPUClass
>
> Signed-off-by: Claudio Fontana 
> Reviewed-by: Alex Bennée 
> Reviewed-by: Richard Henderson 
>
> [claudio]:
> Rebased on commit b8184135 ("target/i386: allow modifying TCG phys-addr-bits")
>
> Signed-off-by: Claudio Fontana 
> Message-Id: <20210322132800.7470-5-cfont...@suse.de>
> Signed-off-by: Paolo Bonzini 
> ---

> diff --git a/MAINTAINERS b/MAINTAINERS
> index b692c8fbee..c2723b32cb 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -351,7 +351,7 @@ M: Paolo Bonzini 
>  M: Richard Henderson 
>  M: Eduardo Habkost 
>  S: Maintained
> -F: target/i386/
> +F: target/i386/tcg/
>  F: tests/tcg/i386/
>  F: tests/tcg/x86_64/
>  F: hw/i386/

This change to MAINTAINERS has left all the .c files
in target/i386 that are not in one of the tcg, hvf, whpx,
kvm, hax, nvmm subdirectories orphaned -- they are no
longer covered by any MAINTAINERS section.

Where should those files be listed ?

(I just discovered this when get_maintainers.pl said it couldn't
find a maintainer for a change I made to target/i386/sev.c.)

thanks
-- PMM



[PULL 03/33] i386: split cpu accelerators from cpu.c, using AccelCPUClass

2021-05-11 Thread Paolo Bonzini
From: Claudio Fontana 

i386 is the first user of AccelCPUClass, allowing to split
cpu.c into:

cpu.ccpuid and common x86 cpu functionality
host-cpu.c   host x86 cpu functions and "host" cpu type
kvm/kvm-cpu.cKVM x86 AccelCPUClass
hvf/hvf-cpu.cHVF x86 AccelCPUClass
tcg/tcg-cpu.cTCG x86 AccelCPUClass

Signed-off-by: Claudio Fontana 
Reviewed-by: Alex Bennée 
Reviewed-by: Richard Henderson 

[claudio]:
Rebased on commit b8184135 ("target/i386: allow modifying TCG phys-addr-bits")

Signed-off-by: Claudio Fontana 
Message-Id: <20210322132800.7470-5-cfont...@suse.de>
Signed-off-by: Paolo Bonzini 
---
 MAINTAINERS |   2 +-
 hw/i386/pc_piix.c   |   1 +
 target/i386/cpu.c   | 383 
 target/i386/cpu.h   |  20 +-
 target/i386/host-cpu.c  | 201 +++
 target/i386/host-cpu.h  |  19 ++
 target/i386/hvf/hvf-cpu.c   |  68 +++
 target/i386/hvf/meson.build |   1 +
 target/i386/kvm/kvm-cpu.c   | 151 ++
 target/i386/kvm/kvm-cpu.h   |  41 
 target/i386/kvm/kvm.c   |   3 +-
 target/i386/kvm/meson.build |   7 +-
 target/i386/meson.build |   6 +-
 target/i386/tcg/tcg-cpu.c   | 113 ++-
 target/i386/tcg/tcg-cpu.h   |  15 --
 15 files changed, 652 insertions(+), 379 deletions(-)
 create mode 100644 target/i386/host-cpu.c
 create mode 100644 target/i386/host-cpu.h
 create mode 100644 target/i386/hvf/hvf-cpu.c
 create mode 100644 target/i386/kvm/kvm-cpu.c
 create mode 100644 target/i386/kvm/kvm-cpu.h
 delete mode 100644 target/i386/tcg/tcg-cpu.h

diff --git a/MAINTAINERS b/MAINTAINERS
index b692c8fbee..c2723b32cb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -351,7 +351,7 @@ M: Paolo Bonzini 
 M: Richard Henderson 
 M: Eduardo Habkost 
 S: Maintained
-F: target/i386/
+F: target/i386/tcg/
 F: tests/tcg/i386/
 F: tests/tcg/x86_64/
 F: hw/i386/
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 5ac2edbf1f..30b8bd6ea9 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -61,6 +61,7 @@
 #include "hw/hyperv/vmbus-bridge.h"
 #include "hw/mem/nvdimm.h"
 #include "hw/i386/acpi-build.h"
+#include "kvm/kvm-cpu.h"
 
 #define MAX_IDE_BUS 2
 
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index ad99cad0e7..da4142a69f 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -22,38 +22,25 @@
 #include "qemu/cutils.h"
 #include "qemu/bitops.h"
 #include "qemu/qemu-print.h"
-
 #include "cpu.h"
-#include "tcg/tcg-cpu.h"
 #include "tcg/helper-tcg.h"
 #include "exec/exec-all.h"
 #include "sysemu/kvm.h"
 #include "sysemu/reset.h"
 #include "sysemu/hvf.h"
-#include "sysemu/cpus.h"
+#include "hw/core/accel-cpu.h"
 #include "sysemu/xen.h"
 #include "sysemu/whpx.h"
 #include "kvm/kvm_i386.h"
 #include "sev_i386.h"
-
-#include "qemu/error-report.h"
 #include "qemu/module.h"
-#include "qemu/option.h"
-#include "qemu/config-file.h"
-#include "qapi/error.h"
 #include "qapi/qapi-visit-machine.h"
 #include "qapi/qapi-visit-run-state.h"
 #include "qapi/qmp/qdict.h"
 #include "qapi/qmp/qerror.h"
-#include "qapi/visitor.h"
 #include "qom/qom-qobject.h"
-#include "sysemu/arch_init.h"
 #include "qapi/qapi-commands-machine-target.h"
-
 #include "standard-headers/asm-x86/kvm_para.h"
-
-#include "sysemu/sysemu.h"
-#include "sysemu/tcg.h"
 #include "hw/qdev-properties.h"
 #include "hw/i386/topology.h"
 #ifndef CONFIG_USER_ONLY
@@ -595,8 +582,8 @@ static CPUCacheInfo legacy_l3_cache = {
 #define INTEL_PT_CYCLE_BITMAP0x1fff /* Support 0,2^(0~11) */
 #define INTEL_PT_PSB_BITMAP  (0x003f << 16) /* Support 
2K,4K,8K,16K,32K,64K */
 
-static void x86_cpu_vendor_words2str(char *dst, uint32_t vendor1,
- uint32_t vendor2, uint32_t vendor3)
+void x86_cpu_vendor_words2str(char *dst, uint32_t vendor1,
+  uint32_t vendor2, uint32_t vendor3)
 {
 int i;
 for (i = 0; i < 4; i++) {
@@ -1589,25 +1576,6 @@ void host_cpuid(uint32_t function, uint32_t count,
 *edx = vec[3];
 }
 
-void host_vendor_fms(char *vendor, int *family, int *model, int *stepping)
-{
-uint32_t eax, ebx, ecx, edx;
-
-host_cpuid(0x0, 0, , , , );
-x86_cpu_vendor_words2str(vendor, ebx, edx, ecx);
-
-host_cpuid(0x1, 0, , , , );
-if (family) {
-*family = ((eax >> 8) & 0x0F) + ((eax >> 20) & 0xFF);
-}
-if (model) {
-*model = ((eax >> 4) & 0x0F) | ((eax & 0xF) >> 12);
-}
-if (stepping) {
-*stepping = eax & 0x0F;
-}
-}
-
 /* CPU class name definitions: */
 
 /* Return type name for a given CPU model name
@@ -1632,10 +1600,6 @@ static char *x86_cpu_class_get_model_name(X86CPUClass 
*cc)
  strlen(class_name) - strlen(X86_CPU_TYPE_SUFFIX));
 }
 
-typedef struct PropValue {
-const char *prop, *value;
-} PropValue;
-
 typedef struct X86CPUVersionDefinition {
 X86CPUVersion version;
 const char *alias;
@@ -4249,32 +4213,6 @@ static X86CPUDefinition builtin_x86_defs[] =