Message ID | 20210517115525.1088693-3-f4bug@amsat.org |
---|---|
State | New |
Headers | show |
Series | softmmu: Make various objects target agnostic | expand |
On 5/17/21 4:55 AM, Philippe Mathieu-Daudé wrote: > whpx_apic_in_platform() is called from: > > - pic_irq_request() in hw/i386/x86.c > - cpu_thread_is_idle() softmmu/cpus.c > - apic_get_class() in target/i386/cpu-sysemu.c > > whpx_enabled() is called from: > > - cpu_report_tpr_access() in target/i386/helper.c > > By converting macros to a function, we can remove the > NEED_CPU_H dependency and build softmmu/cpus.c once > for all targets. > > Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> > --- > include/sysemu/whpx.h | 15 +-------------- > accel/stubs/whpx-stub.c | 21 +++++++++++++++++++++ > target/i386/whpx/whpx-all.c | 2 +- > MAINTAINERS | 1 + > accel/stubs/meson.build | 1 + > 5 files changed, 25 insertions(+), 15 deletions(-) > create mode 100644 accel/stubs/whpx-stub.c > > diff --git a/include/sysemu/whpx.h b/include/sysemu/whpx.h > index 2889fa2278b..b32f46f9ebf 100644 > --- a/include/sysemu/whpx.h > +++ b/include/sysemu/whpx.h > @@ -13,20 +13,7 @@ > #ifndef QEMU_WHPX_H > #define QEMU_WHPX_H > > -#ifdef NEED_CPU_H > - > -#ifdef CONFIG_WHPX > - > -int whpx_enabled(void); > +bool whpx_enabled(void); > bool whpx_apic_in_platform(void); > > -#else /* CONFIG_WHPX */ > - > -#define whpx_enabled() (0) > -#define whpx_apic_in_platform() (0) I think the loss of whpx_enabled as false is unfortunate. I'd like to see this file mirror sysemu/kvm.h with CONFIG_WHPX_IS_POSSIBLE. As I mentioned vs patch 1, whpx_apic_in_platform would be handled via AccelOpsClass with whatever hook we come up with for cpu_thread_is_idle. r~
diff --git a/include/sysemu/whpx.h b/include/sysemu/whpx.h index 2889fa2278b..b32f46f9ebf 100644 --- a/include/sysemu/whpx.h +++ b/include/sysemu/whpx.h @@ -13,20 +13,7 @@ #ifndef QEMU_WHPX_H #define QEMU_WHPX_H -#ifdef NEED_CPU_H - -#ifdef CONFIG_WHPX - -int whpx_enabled(void); +bool whpx_enabled(void); bool whpx_apic_in_platform(void); -#else /* CONFIG_WHPX */ - -#define whpx_enabled() (0) -#define whpx_apic_in_platform() (0) - -#endif /* CONFIG_WHPX */ - -#endif /* NEED_CPU_H */ - #endif /* QEMU_WHPX_H */ diff --git a/accel/stubs/whpx-stub.c b/accel/stubs/whpx-stub.c new file mode 100644 index 00000000000..794a992acc6 --- /dev/null +++ b/accel/stubs/whpx-stub.c @@ -0,0 +1,21 @@ +/* + * QEMU WHPX stub + * + * Copyright (c) 2019 Philippe Mathieu-Daudé <f4bug@amsat.org> + * + * SPDX-License-Identifier: GPL-2.0-or-later + * + */ + +#include "qemu/osdep.h" +#include "sysemu/whpx.h" + +bool whpx_enabled(void) +{ + return false; +} + +bool whpx_apic_in_platform(void) +{ + return false; +} diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index f832f286ac3..6709a89f8f0 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -1862,7 +1862,7 @@ error: return ret; } -int whpx_enabled(void) +bool whpx_enabled(void) { return whpx_allowed; } diff --git a/MAINTAINERS b/MAINTAINERS index 78561a223f9..7877710e372 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -439,6 +439,7 @@ F: include/sysemu/hvf.h WHPX CPUs M: Sunil Muthuswamy <sunilmut@microsoft.com> S: Supported +F: accel/stubs/whpx-stub.c F: target/i386/whpx/ F: include/sysemu/whpx.h diff --git a/accel/stubs/meson.build b/accel/stubs/meson.build index 12dd1539afa..3fbe34e5bb3 100644 --- a/accel/stubs/meson.build +++ b/accel/stubs/meson.build @@ -2,3 +2,4 @@ specific_ss.add(when: 'CONFIG_XEN', if_false: files('xen-stub.c')) specific_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c')) specific_ss.add(when: 'CONFIG_TCG', if_false: files('tcg-stub.c')) +specific_ss.add(when: 'CONFIG_WHPX', if_false: files('whpx-stub.c'))
whpx_apic_in_platform() is called from: - pic_irq_request() in hw/i386/x86.c - cpu_thread_is_idle() softmmu/cpus.c - apic_get_class() in target/i386/cpu-sysemu.c whpx_enabled() is called from: - cpu_report_tpr_access() in target/i386/helper.c By converting macros to a function, we can remove the NEED_CPU_H dependency and build softmmu/cpus.c once for all targets. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> --- include/sysemu/whpx.h | 15 +-------------- accel/stubs/whpx-stub.c | 21 +++++++++++++++++++++ target/i386/whpx/whpx-all.c | 2 +- MAINTAINERS | 1 + accel/stubs/meson.build | 1 + 5 files changed, 25 insertions(+), 15 deletions(-) create mode 100644 accel/stubs/whpx-stub.c