* [PULL 0/4] Build fix patches for 2023-09-13
@ 2023-09-13 12:08 Paolo Bonzini
2023-09-13 12:08 ` [PULL 1/4] meson: Fix targetos match for illumos and Solaris Paolo Bonzini
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Paolo Bonzini @ 2023-09-13 12:08 UTC (permalink / raw)
To: qemu-devel
The following changes since commit 9ef497755afc252fb8e060c9ea6b0987abfd20b6:
Merge tag 'pull-vfio-20230911' of https://github.com/legoater/qemu into staging (2023-09-11 09:13:08 -0400)
are available in the Git repository at:
https://gitlab.com/bonzini/qemu.git tags/for-upstream
for you to fetch changes up to d04740243604389b6f05baa28fe3a28f016ed37b:
target/i386: Call accel-agnostic x86_cpu_get_supported_cpuid() (2023-09-13 12:16:41 +0200)
----------------------------------------------------------------
* target/i386: fix non-optimized compilation on clang
* fix detection of Solaris/IllumOS
----------------------------------------------------------------
Jonathan Perkin (1):
meson: Fix targetos match for illumos and Solaris.
Philippe Mathieu-Daudé (3):
target/i386: Check kvm_hyperv_expand_features() return value
target/i386: Drop accel_uses_host_cpuid before x86_cpu_get_supported_cpuid
target/i386: Call accel-agnostic x86_cpu_get_supported_cpuid()
meson.build | 4 ++--
net/meson.build | 2 +-
target/i386/cpu.c | 46 ++++++++++++++++++++++------------------------
3 files changed, 25 insertions(+), 27 deletions(-)
--
2.41.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PULL 1/4] meson: Fix targetos match for illumos and Solaris.
2023-09-13 12:08 [PULL 0/4] Build fix patches for 2023-09-13 Paolo Bonzini
@ 2023-09-13 12:08 ` Paolo Bonzini
2023-09-13 12:08 ` [PULL 2/4] target/i386: Check kvm_hyperv_expand_features() return value Paolo Bonzini
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2023-09-13 12:08 UTC (permalink / raw)
To: qemu-devel; +Cc: Jonathan Perkin, qemu-stable
From: Jonathan Perkin <jonathan@perkin.org.uk>
qemu 8.1.0 breaks on illumos platforms due to _XOPEN_SOURCE and others no longer being set correctly, leading to breakage such as:
https://us-central.manta.mnx.io/pkgsrc/public/reports/trunk/tools/20230908.1404/qemu-8.1.0/build.log
This is a result of meson conversion which incorrectly matches against 'solaris' instead of 'sunos' for uname.
First time submitting a patch here, hope I did it correctly. Thanks.
Signed-off-by: Jonathan Perkin <jonathan@perkin.org.uk>
Message-ID: <ZPtdxtum9UVPy58J@perkin.org.uk>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
meson.build | 4 ++--
net/meson.build | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/meson.build b/meson.build
index 0e31bdfabf1..5150a74831b 100644
--- a/meson.build
+++ b/meson.build
@@ -226,7 +226,7 @@ if targetos == 'darwin'
if compiler.get_id() == 'gcc'
qemu_common_flags += '-DOS_OBJECT_USE_OBJC=0'
endif
-elif targetos == 'solaris'
+elif targetos == 'sunos'
# needed for CMSG_ macros in sys/socket.h
qemu_common_flags += '-D_XOPEN_SOURCE=600'
# needed for TIOCWIN* defines in termios.h
@@ -2048,7 +2048,7 @@ have_slirp_smbd = get_option('slirp_smbd') \
if have_slirp_smbd
smbd_path = get_option('smbd')
if smbd_path == ''
- smbd_path = (targetos == 'solaris' ? '/usr/sfw/sbin/smbd' : '/usr/sbin/smbd')
+ smbd_path = (targetos == 'sunos' ? '/usr/sfw/sbin/smbd' : '/usr/sbin/smbd')
endif
config_host_data.set_quoted('CONFIG_SMBD_COMMAND', smbd_path)
endif
diff --git a/net/meson.build b/net/meson.build
index d2d70634e5e..51caa42c9d2 100644
--- a/net/meson.build
+++ b/net/meson.build
@@ -47,7 +47,7 @@ elif targetos == 'linux'
system_ss.add(files('tap.c', 'tap-linux.c'))
elif targetos in bsd_oses
system_ss.add(files('tap.c', 'tap-bsd.c'))
-elif targetos == 'solaris'
+elif targetos == 'sunos'
system_ss.add(files('tap.c', 'tap-solaris.c'))
else
system_ss.add(files('tap.c', 'tap-stub.c'))
--
2.41.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PULL 2/4] target/i386: Check kvm_hyperv_expand_features() return value
2023-09-13 12:08 [PULL 0/4] Build fix patches for 2023-09-13 Paolo Bonzini
2023-09-13 12:08 ` [PULL 1/4] meson: Fix targetos match for illumos and Solaris Paolo Bonzini
@ 2023-09-13 12:08 ` Paolo Bonzini
2023-09-13 12:08 ` [PULL 3/4] target/i386: Drop accel_uses_host_cpuid before x86_cpu_get_supported_cpuid Paolo Bonzini
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2023-09-13 12:08 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <philmd@linaro.org>
In case more code is added after the kvm_hyperv_expand_features()
call, check its return value (since it can fail).
Fixes: 071ce4b03b ("i386: expand Hyper-V features during CPU feature expansion time")
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20230913093009.83520-2-philmd@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target/i386/cpu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 24ee67b42d0..bd6a932d088 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -7121,8 +7121,8 @@ void x86_cpu_expand_features(X86CPU *cpu, Error **errp)
env->cpuid_xlevel2 = env->cpuid_min_xlevel2;
}
- if (kvm_enabled()) {
- kvm_hyperv_expand_features(cpu, errp);
+ if (kvm_enabled() && !kvm_hyperv_expand_features(cpu, errp)) {
+ return;
}
}
--
2.41.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PULL 3/4] target/i386: Drop accel_uses_host_cpuid before x86_cpu_get_supported_cpuid
2023-09-13 12:08 [PULL 0/4] Build fix patches for 2023-09-13 Paolo Bonzini
2023-09-13 12:08 ` [PULL 1/4] meson: Fix targetos match for illumos and Solaris Paolo Bonzini
2023-09-13 12:08 ` [PULL 2/4] target/i386: Check kvm_hyperv_expand_features() return value Paolo Bonzini
@ 2023-09-13 12:08 ` Paolo Bonzini
2023-09-13 12:08 ` [PULL 4/4] target/i386: Call accel-agnostic x86_cpu_get_supported_cpuid() Paolo Bonzini
2023-09-13 19:17 ` [PULL 0/4] Build fix patches for 2023-09-13 Stefan Hajnoczi
4 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2023-09-13 12:08 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <philmd@linaro.org>
x86_cpu_get_supported_cpuid() already checks for KVM/HVF
accelerators, so it is not needed to manually check it via
a call to accel_uses_host_cpuid() before calling it.
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20230913093009.83520-3-philmd@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target/i386/cpu.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index bd6a932d088..94b1ba0cf1a 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -6207,7 +6207,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
break;
case 0xA:
/* Architectural Performance Monitoring Leaf */
- if (accel_uses_host_cpuid() && cpu->enable_pmu) {
+ if (cpu->enable_pmu) {
x86_cpu_get_supported_cpuid(0xA, count, eax, ebx, ecx, edx);
} else {
*eax = 0;
@@ -6247,8 +6247,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
*ebx &= 0xffff; /* The count doesn't need to be reliable. */
break;
case 0x1C:
- if (accel_uses_host_cpuid() && cpu->enable_pmu &&
- (env->features[FEAT_7_0_EDX] & CPUID_7_0_EDX_ARCH_LBR)) {
+ if (cpu->enable_pmu && (env->features[FEAT_7_0_EDX] & CPUID_7_0_EDX_ARCH_LBR)) {
x86_cpu_get_supported_cpuid(0x1C, 0, eax, ebx, ecx, edx);
*edx = 0;
}
@@ -6322,9 +6321,8 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
} else {
*ecx &= ~XSTATE_ARCH_LBR_MASK;
}
- } else if (count == 0xf &&
- accel_uses_host_cpuid() && cpu->enable_pmu &&
- (env->features[FEAT_7_0_EDX] & CPUID_7_0_EDX_ARCH_LBR)) {
+ } else if (count == 0xf && cpu->enable_pmu
+ && (env->features[FEAT_7_0_EDX] & CPUID_7_0_EDX_ARCH_LBR)) {
x86_cpu_get_supported_cpuid(0xD, count, eax, ebx, ecx, edx);
} else if (count < ARRAY_SIZE(x86_ext_save_areas)) {
const ExtSaveArea *esa = &x86_ext_save_areas[count];
--
2.41.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PULL 4/4] target/i386: Call accel-agnostic x86_cpu_get_supported_cpuid()
2023-09-13 12:08 [PULL 0/4] Build fix patches for 2023-09-13 Paolo Bonzini
` (2 preceding siblings ...)
2023-09-13 12:08 ` [PULL 3/4] target/i386: Drop accel_uses_host_cpuid before x86_cpu_get_supported_cpuid Paolo Bonzini
@ 2023-09-13 12:08 ` Paolo Bonzini
2023-09-13 19:17 ` [PULL 0/4] Build fix patches for 2023-09-13 Stefan Hajnoczi
4 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2023-09-13 12:08 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, qemu-stable, Kevin Wolf
From: Philippe Mathieu-Daudé <philmd@linaro.org>
x86_cpu_get_supported_cpuid() is generic and handles the different
accelerators. Use it instead of kvm_arch_get_supported_cpuid().
That fixes a link failure introduced by commit 3adce820cf
("target/i386: Remove unused KVM stubs") when QEMU is configured
as:
$ ./configure --cc=clang \
--target-list=x86_64-linux-user,x86_64-softmmu \
--enable-debug
We were getting:
[71/71] Linking target qemu-x86_64
FAILED: qemu-x86_64
/usr/bin/ld: libqemu-x86_64-linux-user.fa.p/target_i386_cpu.c.o: in function `cpu_x86_cpuid':
cpu.c:(.text+0x1374): undefined reference to `kvm_arch_get_supported_cpuid'
/usr/bin/ld: libqemu-x86_64-linux-user.fa.p/target_i386_cpu.c.o: in function `x86_cpu_filter_features':
cpu.c:(.text+0x81c2): undefined reference to `kvm_arch_get_supported_cpuid'
/usr/bin/ld: cpu.c:(.text+0x81da): undefined reference to `kvm_arch_get_supported_cpuid'
/usr/bin/ld: cpu.c:(.text+0x81f2): undefined reference to `kvm_arch_get_supported_cpuid'
/usr/bin/ld: cpu.c:(.text+0x820a): undefined reference to `kvm_arch_get_supported_cpuid'
/usr/bin/ld: libqemu-x86_64-linux-user.fa.p/target_i386_cpu.c.o:cpu.c:(.text+0x8225): more undefined references to `kvm_arch_get_supported_cpuid' follow
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
For the record, this is because '--enable-debug' disables
optimizations (CFLAGS=-O0).
While at this (un)optimization level GCC eliminate the
following dead code (CPP output of mentioned build):
static void x86_cpu_get_supported_cpuid(uint32_t func, uint32_t index,
uint32_t *eax, uint32_t *ebx,
uint32_t *ecx, uint32_t *edx)
{
if ((0)) {
*eax = kvm_arch_get_supported_cpuid(kvm_state, func, index, R_EAX);
*ebx = kvm_arch_get_supported_cpuid(kvm_state, func, index, R_EBX);
*ecx = kvm_arch_get_supported_cpuid(kvm_state, func, index, R_ECX);
*edx = kvm_arch_get_supported_cpuid(kvm_state, func, index, R_EDX);
} else if (0) {
*eax = 0;
*ebx = 0;
*ecx = 0;
*edx = 0;
} else {
*eax = 0;
*ebx = 0;
*ecx = 0;
*edx = 0;
}
Clang does not (see commit 2140cfa51d "i386: Fix build by
providing stub kvm_arch_get_supported_cpuid()").
Cc: qemu-stable@nongnu.org
Fixes: 3adce820cf ("target/i386: Remove unused KVM stubs")
Reported-by: Kevin Wolf <kwolf@redhat.com>
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20230913093009.83520-4-philmd@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target/i386/cpu.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 94b1ba0cf1a..b2a20365e10 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -6154,6 +6154,8 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
case 7:
/* Structured Extended Feature Flags Enumeration Leaf */
if (count == 0) {
+ uint32_t eax_0_unused, ebx_0, ecx_0, edx_0_unused;
+
/* Maximum ECX value for sub-leaves */
*eax = env->cpuid_level_func7;
*ebx = env->features[FEAT_7_0_EBX]; /* Feature flags */
@@ -6168,17 +6170,15 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
* support enabling SGX and/or SGX flexible launch control,
* then we need to update the VM's CPUID values accordingly.
*/
- if ((*ebx & CPUID_7_0_EBX_SGX) &&
- (!kvm_enabled() ||
- !(kvm_arch_get_supported_cpuid(cs->kvm_state, 0x7, 0, R_EBX) &
- CPUID_7_0_EBX_SGX))) {
+ x86_cpu_get_supported_cpuid(0x7, 0,
+ &eax_0_unused, &ebx_0,
+ &ecx_0, &edx_0_unused);
+ if ((*ebx & CPUID_7_0_EBX_SGX) && !(ebx_0 & CPUID_7_0_EBX_SGX)) {
*ebx &= ~CPUID_7_0_EBX_SGX;
}
- if ((*ecx & CPUID_7_0_ECX_SGX_LC) &&
- (!(*ebx & CPUID_7_0_EBX_SGX) || !kvm_enabled() ||
- !(kvm_arch_get_supported_cpuid(cs->kvm_state, 0x7, 0, R_ECX) &
- CPUID_7_0_ECX_SGX_LC))) {
+ if ((*ecx & CPUID_7_0_ECX_SGX_LC)
+ && (!(*ebx & CPUID_7_0_EBX_SGX) || !(ecx_0 & CPUID_7_0_ECX_SGX_LC))) {
*ecx &= ~CPUID_7_0_ECX_SGX_LC;
}
} else if (count == 1) {
@@ -7150,14 +7150,14 @@ static void x86_cpu_filter_features(X86CPU *cpu, bool verbose)
mark_unavailable_features(cpu, w, unavailable_features, prefix);
}
- if ((env->features[FEAT_7_0_EBX] & CPUID_7_0_EBX_INTEL_PT) &&
- kvm_enabled()) {
- KVMState *s = CPU(cpu)->kvm_state;
- uint32_t eax_0 = kvm_arch_get_supported_cpuid(s, 0x14, 0, R_EAX);
- uint32_t ebx_0 = kvm_arch_get_supported_cpuid(s, 0x14, 0, R_EBX);
- uint32_t ecx_0 = kvm_arch_get_supported_cpuid(s, 0x14, 0, R_ECX);
- uint32_t eax_1 = kvm_arch_get_supported_cpuid(s, 0x14, 1, R_EAX);
- uint32_t ebx_1 = kvm_arch_get_supported_cpuid(s, 0x14, 1, R_EBX);
+ if (env->features[FEAT_7_0_EBX] & CPUID_7_0_EBX_INTEL_PT) {
+ uint32_t eax_0, ebx_0, ecx_0, edx_0_unused;
+ uint32_t eax_1, ebx_1, ecx_1_unused, edx_1_unused;
+
+ x86_cpu_get_supported_cpuid(0x14, 0,
+ &eax_0, &ebx_0, &ecx_0, &edx_0_unused);
+ x86_cpu_get_supported_cpuid(0x14, 1,
+ &eax_1, &ebx_1, &ecx_1_unused, &edx_1_unused);
if (!eax_0 ||
((ebx_0 & INTEL_PT_MINIMAL_EBX) != INTEL_PT_MINIMAL_EBX) ||
--
2.41.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PULL 0/4] Build fix patches for 2023-09-13
2023-09-13 12:08 [PULL 0/4] Build fix patches for 2023-09-13 Paolo Bonzini
` (3 preceding siblings ...)
2023-09-13 12:08 ` [PULL 4/4] target/i386: Call accel-agnostic x86_cpu_get_supported_cpuid() Paolo Bonzini
@ 2023-09-13 19:17 ` Stefan Hajnoczi
4 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2023-09-13 19:17 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 115 bytes --]
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/8.2 for any user-visible changes.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-09-13 19:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-13 12:08 [PULL 0/4] Build fix patches for 2023-09-13 Paolo Bonzini
2023-09-13 12:08 ` [PULL 1/4] meson: Fix targetos match for illumos and Solaris Paolo Bonzini
2023-09-13 12:08 ` [PULL 2/4] target/i386: Check kvm_hyperv_expand_features() return value Paolo Bonzini
2023-09-13 12:08 ` [PULL 3/4] target/i386: Drop accel_uses_host_cpuid before x86_cpu_get_supported_cpuid Paolo Bonzini
2023-09-13 12:08 ` [PULL 4/4] target/i386: Call accel-agnostic x86_cpu_get_supported_cpuid() Paolo Bonzini
2023-09-13 19:17 ` [PULL 0/4] Build fix patches for 2023-09-13 Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).