tcg/e2k: MCST LCC sucks

This commit is contained in:
Denis Drakhnia 2024-05-01 15:10:51 +03:00
parent 12639a7710
commit 462543a92f
27 changed files with 535 additions and 3 deletions

View File

@ -9,6 +9,8 @@ if have_system
subdir('kvm')
subdir('xen')
subdir('stubs')
elif mcst_lcc_sucks
subdir('stubs')
endif
# qtest

View File

@ -12,7 +12,9 @@
#include "qemu/osdep.h"
#include "sysemu/kvm.h"
#if defined(CONFIG_SOFTMMU)
#include "hw/pci/msi.h"
#endif
KVMState *kvm_state;
bool kvm_kernel_irqchip;
@ -61,11 +63,13 @@ void kvm_irqchip_release_virq(KVMState *s, int virq)
{
}
#if defined(CONFIG_SOFTMMU)
int kvm_irqchip_update_msi_route(KVMState *s, int virq, MSIMessage msg,
PCIDevice *dev)
{
return -ENOSYS;
}
#endif
void kvm_irqchip_commit_routes(KVMState *s)
{
@ -141,3 +145,13 @@ int kvm_irqchip_remove_irqfd_notifier(KVMState *s, EventNotifier *n,
{
return -ENOSYS;
}
bool kvm_kernel_irqchip_allowed(void)
{
g_assert_not_reached();
}
bool kvm_kernel_irqchip_required(void)
{
g_assert_not_reached();
}

View File

@ -4,3 +4,7 @@ system_stubs_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c'))
system_stubs_ss.add(when: 'CONFIG_TCG', if_false: files('tcg-stub.c'))
specific_ss.add_all(when: ['CONFIG_SYSTEM_ONLY'], if_true: system_stubs_ss)
if mcst_lcc_sucks
specific_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c'))
endif

17
hw/i386/kvm/kvm-stub.c Normal file
View File

@ -0,0 +1,17 @@
#include "qemu/osdep.h"
#include "hw/isa/i8259_internal.h"
void kvm_pc_setup_irq_routing(bool pci_enabled)
{
g_assert_not_reached();
}
void kvmclock_create(bool create_always)
{
g_assert_not_reached();
}
qemu_irq *kvm_i8259_init(ISABus *bus)
{
g_assert_not_reached();
}

View File

@ -21,3 +21,7 @@ xen_stubs_ss.add(when: 'CONFIG_XEN_EMU', if_false: files(
))
specific_ss.add_all(when: 'CONFIG_SYSTEM_ONLY', if_true: xen_stubs_ss)
if mcst_lcc_sucks
i386_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c'))
endif

View File

@ -73,3 +73,8 @@ specific_ss.add(when: 'CONFIG_LOONGARCH_IPI', if_true: files('loongarch_ipi.c'))
specific_ss.add(when: 'CONFIG_LOONGARCH_PCH_PIC', if_true: files('loongarch_pch_pic.c'))
specific_ss.add(when: 'CONFIG_LOONGARCH_PCH_MSI', if_true: files('loongarch_pch_msi.c'))
specific_ss.add(when: 'CONFIG_LOONGARCH_EXTIOI', if_true: files('loongarch_extioi.c'))
if mcst_lcc_sucks
specific_ss.add(when: 'CONFIG_PSERIES',
if_true: files('xics_kvm_stub.c', 'spapr_xive_kvm_stub.c'))
endif

View File

@ -0,0 +1,99 @@
#include "qemu/osdep.h"
#include "target/ppc/cpu.h"
#include "hw/ppc/spapr.h"
#include "hw/ppc/spapr_cpu_core.h"
#include "hw/ppc/spapr_xive.h"
#include "hw/ppc/xive.h"
#include "target/ppc/kvm_ppc.h"
int kvmppc_xive_pre_save(SpaprXive *xive)
{
g_assert_not_reached();
}
int kvmppc_xive_post_load(SpaprXive *xive, int version_id)
{
g_assert_not_reached();
}
void kvmppc_xive_synchronize_state(SpaprXive *xive, Error **errp)
{
g_assert_not_reached();
}
int kvmppc_xive_source_reset_one(XiveSource *xsrc, int srcno, Error **errp)
{
g_assert_not_reached();
}
void kvmppc_xive_source_set_irq(void *opaque, int srcno, int val)
{
g_assert_not_reached();
}
int kvmppc_xive_connect(SpaprInterruptController *intc, uint32_t nr_servers,
Error **errp)
{
g_assert_not_reached();
}
void kvmppc_xive_disconnect(SpaprInterruptController *intc)
{
g_assert_not_reached();
}
int kvmppc_xive_set_source_config(SpaprXive *xive, uint32_t lisn, XiveEAS *eas,
Error **errp)
{
g_assert_not_reached();
}
int kvmppc_xive_set_queue_config(SpaprXive *xive, uint8_t end_blk,
uint32_t end_idx, XiveEND *end,
Error **errp)
{
g_assert_not_reached();
}
int kvmppc_xive_get_queue_config(SpaprXive *xive, uint8_t end_blk,
uint32_t end_idx, XiveEND *end,
Error **errp)
{
g_assert_not_reached();
}
uint64_t kvmppc_xive_esb_rw(XiveSource *xsrc, int srcno, uint32_t offset,
uint64_t data, bool write)
{
g_assert_not_reached();
}
void kvmppc_xive_sync_source(SpaprXive *xive, uint32_t lisn, Error **errp)
{
g_assert_not_reached();
}
void kvmppc_xive_reset(SpaprXive *xive, Error **errp)
{
g_assert_not_reached();
}
int kvmppc_xive_cpu_synchronize_state(XiveTCTX *tctx, Error **errp)
{
g_assert_not_reached();
}
int kvmppc_xive_cpu_connect(XiveTCTX *tctx, Error **errp)
{
g_assert_not_reached();
}
int kvmppc_xive_cpu_get_state(XiveTCTX *tctx, Error **errp)
{
g_assert_not_reached();
}
int kvmppc_xive_cpu_set_state(XiveTCTX *tctx, Error **errp)
{
g_assert_not_reached();
}

69
hw/intc/xics_kvm_stub.c Normal file
View File

@ -0,0 +1,69 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "trace.h"
#include "sysemu/kvm.h"
#include "hw/ppc/spapr.h"
#include "hw/ppc/spapr_cpu_core.h"
#include "hw/ppc/xics.h"
#include "hw/ppc/xics_spapr.h"
#include "target/ppc/kvm_ppc.h"
#include "qemu/config-file.h"
#include "qemu/error-report.h"
#include <sys/ioctl.h>
void icp_synchronize_state(ICPState *icp)
{
g_assert_not_reached();
}
void icp_get_kvm_state(ICPState *icp)
{
g_assert_not_reached();
}
void ics_get_kvm_state(ICSState *ics)
{
g_assert_not_reached();
}
int icp_set_kvm_state(ICPState *icp, Error **errp)
{
g_assert_not_reached();
}
int ics_set_kvm_state(ICSState *ics, Error **errp)
{
g_assert_not_reached();
}
int ics_set_kvm_state_one(ICSState *ics, int srcno, Error **errp)
{
g_assert_not_reached();
}
void icp_kvm_realize(DeviceState *dev, Error **errp)
{
g_assert_not_reached();
}
void ics_kvm_set_irq(ICSState *ics, int srcno, int val)
{
g_assert_not_reached();
}
void ics_synchronize_state(ICSState *ics)
{
g_assert_not_reached();
}
int xics_kvm_connect(SpaprInterruptController *intc, uint32_t nr_servers,
Error **errp)
{
g_assert_not_reached();
}
void xics_kvm_disconnect(SpaprInterruptController *intc)
{
g_assert_not_reached();
}

View File

@ -227,4 +227,9 @@
#define SECOND_ARG(first, second, ...) second
#define IS_EMPTY_(junk_maybecomma) SECOND_ARG(junk_maybecomma 1, 0)
/* MCST LCC tries to be like GCC, but it is not GCC */
#if defined(__MCST__) && defined(__LCC__)
# define MCST_LCC_SUCKS
#endif
#endif /* COMPILER_H */

View File

@ -42,6 +42,11 @@
#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 0
#endif
/* XXX: some compilers may generate call with -O0 */
#if defined(MCST_LCC_SUCKS) && !TARGET_ARCH_HAS_SIGTRAMP_PAGE
void setup_sigtramp(abi_ulong) {}
#endif
typedef struct {
const uint8_t *image;
const uint32_t *relocs;

View File

@ -270,12 +270,14 @@ endif
# Compiler flags #
##################
mcst_lcc_sucks = false
foreach lang : all_languages
compiler = meson.get_compiler(lang)
if compiler.get_id() == 'gcc' and compiler.version().version_compare('>=7.4')
# ok
elif compiler.get_id() == 'lcc' and compiler.version().version_compare('>=1.25')
# ok
mcst_lcc_sucks = true
elif compiler.get_id() == 'clang' and compiler.compiles('''
#ifdef __apple_build_version__
# if __clang_major__ < 12 || (__clang_major__ == 12 && __clang_minor__ < 0)

View File

@ -22,3 +22,18 @@ bool write_list_to_kvmstate(ARMCPU *cpu, int level)
{
g_assert_not_reached();
}
void kvm_arm_cpu_pre_save(ARMCPU *cpu)
{
g_assert_not_reached();
}
void kvm_arm_cpu_post_load(ARMCPU *cpu)
{
g_assert_not_reached();
}
void kvm_arm_reset_vcpu(ARMCPU *cpu)
{
g_assert_not_reached();
}

View File

@ -0,0 +1,7 @@
#include "qemu/osdep.h"
uint32_t hvf_get_supported_cpuid(uint32_t func, uint32_t idx,
int reg)
{
g_assert_not_reached();
}

View File

@ -11,3 +11,7 @@ i386_system_ss.add(when: [hvf, 'CONFIG_HVF'], if_true: files(
'x86hvf.c',
'hvf-cpu.c',
))
if mcst_lcc_sucks
i386_ss.add(when: [hvf, 'CONFIG_HVF'], if_false: files('hvf-stub.c'))
endif

View File

@ -0,0 +1,53 @@
/*
* x86 KVM stubs
*/
#include "qemu/osdep.h"
#include "cpu.h"
#include "kvm_i386.h"
uint32_t kvm_arch_get_supported_cpuid(KVMState *env, uint32_t function,
uint32_t index, int reg)
{
g_assert_not_reached();
}
void kvm_arch_reset_vcpu(X86CPU *cs)
{
g_assert_not_reached();
}
void kvm_arch_after_reset_vcpu(X86CPU *cpu)
{
g_assert_not_reached();
}
void kvm_arch_do_init_vcpu(X86CPU *cs)
{
g_assert_not_reached();
}
uint64_t kvm_arch_get_supported_msr_feature(KVMState *s, uint32_t index)
{
g_assert_not_reached();
}
void kvm_request_xsave_components(X86CPU *cpu, uint64_t mask)
{
g_assert_not_reached();
}
void kvm_set_max_apic_id(uint32_t max_apic_id)
{
g_assert_not_reached();
}
bool kvm_has_smm(void)
{
g_assert_not_reached();
}
bool kvm_enable_sgx_provisioning(KVMState *s)
{
g_assert_not_reached();
}

View File

@ -12,3 +12,7 @@ i386_kvm_ss.add(when: 'CONFIG_SEV', if_false: files('sev-stub.c'))
i386_system_ss.add(when: 'CONFIG_HYPERV', if_true: files('hyperv.c'), if_false: files('hyperv-stub.c'))
i386_system_ss.add_all(when: 'CONFIG_KVM', if_true: i386_kvm_ss)
if mcst_lcc_sucks
i386_ss.add(files('kvm-stub.c', 'sev-stub.c'))
endif

View File

@ -19,3 +19,18 @@ int sev_kvm_init(ConfidentialGuestSupport *cgs, Error **errp)
/* If we get here, cgs must be some non-SEV thing */
return 0;
}
uint32_t sev_get_cbit_position(void)
{
g_assert_not_reached();
}
uint32_t sev_get_reduced_phys_bits(void)
{
g_assert_not_reached();
}
bool sev_add_kernel_loader_hashes(SevKernelLoaderContext *ctx, Error **errp)
{
g_assert_not_reached();
}

View File

@ -0,0 +1,13 @@
#include "qemu/osdep.h"
#include "kvm_loongarch.h"
int kvm_loongarch_set_interrupt(LoongArchCPU *cpu, int irq, int level)
{
g_assert_not_reached();
}
void kvm_arch_reset_vcpu(CPULoongArchState *env)
{
g_assert_not_reached();
}

View File

@ -1 +1,3 @@
loongarch_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c'))
loongarch_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c'), if_false: files(
'kvm-stub.c',
))

19
target/mips/kvm-stub.c Normal file
View File

@ -0,0 +1,19 @@
#include "qemu/osdep.h"
#include "cpu.h"
#include "kvm_mips.h"
void kvm_mips_reset_vcpu(MIPSCPU *cpu)
{
g_assert_not_reached();
}
int kvm_mips_set_interrupt(MIPSCPU *cpu, int irq, int level)
{
g_assert_not_reached();
}
int kvm_mips_set_ipi_interrupt(MIPSCPU *cpu, int irq, int level)
{
g_assert_not_reached();
}

View File

@ -16,7 +16,7 @@ if 'CONFIG_TCG' in config_all_accel
subdir('tcg')
endif
mips_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c'))
mips_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c'), if_false: files('kvm-stub.c'))
target_arch += {'mips': mips_ss}
target_system_arch += {'mips': mips_system_ss}

View File

@ -35,3 +35,7 @@ mips_ss.add(when: 'TARGET_MIPS64', if_true: files(
if have_system
subdir('sysemu')
endif
if mcst_lcc_sucks
mips_ss.add(when: 'TARGET_MIPS64', if_true: files('mxu-stubs.c'))
endif

View File

@ -0,0 +1,12 @@
#include "qemu/osdep.h"
#include "translate.h"
void mxu_translate_init(void)
{
g_assert_not_reached();
}
bool decode_ase_mxu(DisasContext *ctx, uint32_t insn)
{
g_assert_not_reached();
}

View File

@ -0,0 +1,40 @@
/*
* RISC-V stubs of KVM hooks
*/
#include "qemu/osdep.h"
#include "cpu.h"
#include "kvm_riscv.h"
void kvm_riscv_reset_vcpu(RISCVCPU *cpu)
{
g_assert_not_reached();
}
void kvm_riscv_set_irq(RISCVCPU *cpu, int irq, int level)
{
g_assert_not_reached();
}
void riscv_kvm_aplic_request(void *opaque, int irq, int level)
{
g_assert_not_reached();
}
void riscv_kvm_cpu_finalize_features(RISCVCPU *cpu, Error **errp)
{
g_assert_not_reached();
}
uint64_t kvm_riscv_get_timebase_frequency(CPUState *cs)
{
g_assert_not_reached();
}
void kvm_riscv_aia_create(MachineState *machine, uint64_t group_shift,
uint64_t aia_irq_num, uint64_t aia_msi_num,
uint64_t aplic_base, uint64_t imsic_base,
uint64_t guest_num)
{
g_assert_not_reached();
}

View File

@ -1 +1 @@
riscv_ss.add(when: 'CONFIG_KVM', if_true: files('kvm-cpu.c'))
riscv_ss.add(when: 'CONFIG_KVM', if_true: files('kvm-cpu.c'), if_false: files('kvm-stub.c'))

View File

@ -5,8 +5,124 @@
#include "qemu/osdep.h"
#include "kvm_s390x.h"
#include "target/s390x/kvm/pv.h"
int kvm_s390_get_protected_dump(void)
{
return false;
}
void kvm_s390_program_interrupt(S390CPU *cpu, uint16_t code)
{
g_assert_not_reached();
}
void kvm_s390_reset_vcpu_clear(S390CPU *cpu)
{
g_assert_not_reached();
}
void kvm_s390_reset_vcpu_normal(S390CPU *cpu)
{
g_assert_not_reached();
}
void kvm_s390_reset_vcpu_initial(S390CPU *cpu)
{
g_assert_not_reached();
}
#if defined(MCST_LCC_SUCKS) && !defined(CONFIG_SOFTMMU)
void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data)
{
g_assert_not_reached();
}
#endif
int kvm_s390_vcpu_interrupt_post_load(S390CPU *cpu)
{
g_assert_not_reached();
}
void kvm_s390_access_exception(S390CPU *cpu, uint16_t code, uint64_t te_code)
{
g_assert_not_reached();
}
int kvm_s390_mem_op(S390CPU *cpu, vaddr addr, uint8_t ar, void *hostbuf,
int len, bool is_write)
{
g_assert_not_reached();
}
int kvm_s390_mem_op_pv(S390CPU *cpu, vaddr addr, void *hostbuf, int len,
bool is_write)
{
g_assert_not_reached();
}
int kvm_s390_set_cpu_state(S390CPU *cpu, uint8_t cpu_state)
{
g_assert_not_reached();
}
int kvm_s390_set_mem_limit(uint64_t new_limit, uint64_t *hw_limit)
{
g_assert_not_reached();
}
void kvm_s390_set_max_pagesize(uint64_t pagesize, Error **errp)
{
g_assert_not_reached();
}
void kvm_s390_cmma_reset(void)
{
g_assert_not_reached();
}
int kvm_s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch,
int vq, bool assign)
{
g_assert_not_reached();
}
void kvm_s390_crypto_reset(void)
{
g_assert_not_reached();
}
void kvm_s390_enable_css_support(S390CPU *cpu)
{
g_assert_not_reached();
}
void kvm_s390_set_diag318(CPUState *cs, uint64_t diag318_info)
{
g_assert_not_reached();
}
int kvm_s390_topology_set_mtcr(uint64_t attr)
{
g_assert_not_reached();
}
void kvm_s390_restart_interrupt(S390CPU *cpu)
{
g_assert_not_reached();
}
void kvm_s390_stop_interrupt(S390CPU *cpu)
{
g_assert_not_reached();
}
int s390_pv_kvm_init(ConfidentialGuestSupport *cgs, Error **errp)
{
g_assert_not_reached();
}
void kvm_s390_vcpu_interrupt_pre_save(S390CPU *cpu)
{
g_assert_not_reached();
}

View File

@ -1851,9 +1851,11 @@ static uint32_t do_csst(CPUS390XState *env, uint32_t r3, uint64_t a1,
nv = ov;
}
cpu_st16_mmu(env, a1, nv, oi16, ra);
#if HAVE_CMPXCHG128
} else if (HAVE_CMPXCHG128) {
ov = cpu_atomic_cmpxchgo_be_mmu(env, a1, cv, nv, oi16, ra);
cc = !int128_eq(ov, cv);
#endif
} else {
/* Note that we asserted !parallel above. */
g_assert_not_reached();