diff mbox series

[3/4] target/ppc: Add stubs for tcg functions, so it builds

Message ID 20210409151916.97326-4-bruno.larsen@eldorado.org.br
State New
Headers show
Series target/ppc: add disable-tcg option | expand

Commit Message

Bruno Larsen (billionai) April 9, 2021, 3:19 p.m. UTC
This file basically adds all stubs required to build the project
with disable-tcg. most of these are not going to remain stubs by the
end, but this part is where it got complicated, and I wanted to get
an RFC ASAP. Most of these have to do with mmu emulation, so they'll
probably be replaced by a KVM implementation in the final product,
but I'm not sure which ones have to be replace, which can remain
stubs, and which should not be called at all. Input in general is
very much welcome.

Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
---
 target/ppc/tcg-stub.c | 139 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 139 insertions(+)
 create mode 100644 target/ppc/tcg-stub.c

Comments

David Gibson April 19, 2021, 5:28 a.m. UTC | #1
On Fri, Apr 09, 2021 at 12:19:15PM -0300, Bruno Larsen (billionai) wrote:
> This file basically adds all stubs required to build the project
> with disable-tcg. most of these are not going to remain stubs by the
> end, but this part is where it got complicated, and I wanted to get
> an RFC ASAP. Most of these have to do with mmu emulation, so they'll
> probably be replaced by a KVM implementation in the final product,
> but I'm not sure which ones have to be replace, which can remain
> stubs, and which should not be called at all. Input in general is
> very much welcome.
> 
> Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
> ---
>  target/ppc/tcg-stub.c | 139 ++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 139 insertions(+)
>  create mode 100644 target/ppc/tcg-stub.c
> 
> diff --git a/target/ppc/tcg-stub.c b/target/ppc/tcg-stub.c
> new file mode 100644
> index 0000000000..5dc8cf8911
> --- /dev/null
> +++ b/target/ppc/tcg-stub.c
> @@ -0,0 +1,139 @@
> +#include "qemu/osdep.h"
> +#include "cpu.h"
> +#include "mmu-hash64.h"
> +
> +/* STUFF FOR FIRST LINKER ERROR */
> +/* This stuff happens in target/ppc files */
> +
> +#if !defined(CONFIG_USER_ONLY)
> +
> +void ppc_store_sdr1(CPUPPCState *env, target_ulong value) {

In general stubbing ppc_store_*() functions doesn't look seem like a
good idea.  At the very least the KVM code will need to update the
register in env so that it gets synced with KVM later.  I think you're
going to be better off moving those ppc_store_*() functions used from
KVM code into somewhere common, then #ifdefing to remove any TCG
specific operations from them (or else providing KVM stubs for the TCG
things they call).

> +    /* stub to make things compile */
> +    return;
> +}
> +
> +void ppc_store_ptcr(CPUPPCState *env, target_ulong value) {
> +    /* stub to make things compile */
> +    return;
> +}
> +
> +#endif /* !defined(CONFIG_USER_ONLY) */
> +void ppc_store_msr(CPUPPCState *env, target_ulong value) {
> +    /* stub to make things compile */
> +    return;
> +}
> +
> +void dump_mmu(CPUPPCState *env){
> +    /* stub to make things compile */
> +    return;
> +}
> +
> +void store_fpscr(CPUPPCState *env, uint64_t arg, uint32_t mask) {
> +    /* stub to make things compile */
> +    return;
> +}
> +
> +void ppc_cpu_do_interrupt(CPUState *cpu) {
> +    /* stub to make things compile */
> +    return;
> +}
> +
> +/* STUFF FOR SECOND LINKER ERROR*/
> +/* these errors happen mostly in hw/ppc */
> +
> +#ifdef TARGET_PPC64
> +int ppc_store_slb(PowerPCCPU *cpu, target_ulong slot,
> +                  target_ulong esid, target_ulong vsid) {
> +    /* rquired by kvm.c and machine.c */
> +    return 0;
> +}
> +
> +void ppc_hash64_filter_pagesizes(PowerPCCPU *cpu,
> +                                 bool (*cb)(void *, uint32_t, uint32_t),
> +                                 void *opaque) {
> +    /* required by spapr_caps.c */
> +    return; 
> +}
> +
> +void ppc_store_lpcr(PowerPCCPU *cpu, target_ulong val) {
> +    /* required by spapr_* */
> +    return;
> +}
> +
> +const ppc_hash_pte64_t *ppc_hash64_map_hptes(PowerPCCPU *cpu,
> +                                             hwaddr ptex, int n) {
> +    /* used by spapr_hcall a bunch */
> +    return NULL;
> +}
> +
> +void ppc_hash64_unmap_hptes(PowerPCCPU *cpu, const ppc_hash_pte64_t *hptes,
> +                            hwaddr ptex, int n) {
> +    /* used a bunch by spapr_hcall */
> +    return; 
> +}
> +
> +void ppc_hash64_tlb_flush_hpte(PowerPCCPU *cpu,
> +                               target_ulong pte_index,
> +                               target_ulong pte0, target_ulong pte1){
> +    return; 
> +}
> +
> +unsigned ppc_hash64_hpte_page_shift_noslb(PowerPCCPU *cpu,
> +                                          uint64_t pte0, uint64_t pte1) {
> +    return 0;
> +}
> +#endif
> +
> +void ppc_cpu_do_fwnmi_machine_check(CPUState *cs, target_ulong vector) {
> +    /* required by spapr_events spapr_mce_dispatch_elog */
> +    return;
> +}
> +#ifndef CONFIG_USER_ONLY
> +void ppc_cpu_do_system_reset(CPUState *cs){
> +    /* required by pnv and spapr */
> +    return;
> +}
> +#endif
> +
> +bool ppc64_v3_get_pate(PowerPCCPU *cpu, target_ulong lpid,
> +                       ppc_v3_pate_t *entry);
> +
> +bool ppc64_v3_get_pate(PowerPCCPU *cpu, target_ulong lpid,
> +                       ppc_v3_pate_t *entry) {
> +    /* used by spapr_hcall: ppc_hash64_hpt_mask */
> +    return true;
> +}
> +
> +/* THIRD BATCH OF ERRORS, AFTER MOVING STUFF FROM TRANSLATE TO CPU.C */
> +
> +/* they are all coming from cpu.c, probably */
> +
> +void create_ppc_opcodes(PowerPCCPU *cpu, Error **errp) {
> +    return;
> +}
> +
> +void init_ppc_proc(PowerPCCPU *cpu) {
> +    return;
> +}
> +
> +void destroy_ppc_opcodes(PowerPCCPU *cpu) {
> +    return;
> +}
> +
> +void ppc_tlb_invalidate_all(CPUPPCState *env) {
> +    return;
> +}
> +
> +void ppc_cpu_dump_state(CPUState *cpu, FILE *f, int flags) {
> +    return;
> +}
> +
> +void ppc_cpu_dump_statistics(CPUState *cpu, int flags) {
> +    return;
> +}
> +
> +#include "exec/hwaddr.h"
> +
> +hwaddr ppc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr) {
> +    return 0;
> +}
diff mbox series

Patch

diff --git a/target/ppc/tcg-stub.c b/target/ppc/tcg-stub.c
new file mode 100644
index 0000000000..5dc8cf8911
--- /dev/null
+++ b/target/ppc/tcg-stub.c
@@ -0,0 +1,139 @@ 
+#include "qemu/osdep.h"
+#include "cpu.h"
+#include "mmu-hash64.h"
+
+/* STUFF FOR FIRST LINKER ERROR */
+/* This stuff happens in target/ppc files */
+
+#if !defined(CONFIG_USER_ONLY)
+
+void ppc_store_sdr1(CPUPPCState *env, target_ulong value) {
+    /* stub to make things compile */
+    return;
+}
+
+void ppc_store_ptcr(CPUPPCState *env, target_ulong value) {
+    /* stub to make things compile */
+    return;
+}
+
+#endif /* !defined(CONFIG_USER_ONLY) */
+void ppc_store_msr(CPUPPCState *env, target_ulong value) {
+    /* stub to make things compile */
+    return;
+}
+
+void dump_mmu(CPUPPCState *env){
+    /* stub to make things compile */
+    return;
+}
+
+void store_fpscr(CPUPPCState *env, uint64_t arg, uint32_t mask) {
+    /* stub to make things compile */
+    return;
+}
+
+void ppc_cpu_do_interrupt(CPUState *cpu) {
+    /* stub to make things compile */
+    return;
+}
+
+/* STUFF FOR SECOND LINKER ERROR*/
+/* these errors happen mostly in hw/ppc */
+
+#ifdef TARGET_PPC64
+int ppc_store_slb(PowerPCCPU *cpu, target_ulong slot,
+                  target_ulong esid, target_ulong vsid) {
+    /* rquired by kvm.c and machine.c */
+    return 0;
+}
+
+void ppc_hash64_filter_pagesizes(PowerPCCPU *cpu,
+                                 bool (*cb)(void *, uint32_t, uint32_t),
+                                 void *opaque) {
+    /* required by spapr_caps.c */
+    return; 
+}
+
+void ppc_store_lpcr(PowerPCCPU *cpu, target_ulong val) {
+    /* required by spapr_* */
+    return;
+}
+
+const ppc_hash_pte64_t *ppc_hash64_map_hptes(PowerPCCPU *cpu,
+                                             hwaddr ptex, int n) {
+    /* used by spapr_hcall a bunch */
+    return NULL;
+}
+
+void ppc_hash64_unmap_hptes(PowerPCCPU *cpu, const ppc_hash_pte64_t *hptes,
+                            hwaddr ptex, int n) {
+    /* used a bunch by spapr_hcall */
+    return; 
+}
+
+void ppc_hash64_tlb_flush_hpte(PowerPCCPU *cpu,
+                               target_ulong pte_index,
+                               target_ulong pte0, target_ulong pte1){
+    return; 
+}
+
+unsigned ppc_hash64_hpte_page_shift_noslb(PowerPCCPU *cpu,
+                                          uint64_t pte0, uint64_t pte1) {
+    return 0;
+}
+#endif
+
+void ppc_cpu_do_fwnmi_machine_check(CPUState *cs, target_ulong vector) {
+    /* required by spapr_events spapr_mce_dispatch_elog */
+    return;
+}
+#ifndef CONFIG_USER_ONLY
+void ppc_cpu_do_system_reset(CPUState *cs){
+    /* required by pnv and spapr */
+    return;
+}
+#endif
+
+bool ppc64_v3_get_pate(PowerPCCPU *cpu, target_ulong lpid,
+                       ppc_v3_pate_t *entry);
+
+bool ppc64_v3_get_pate(PowerPCCPU *cpu, target_ulong lpid,
+                       ppc_v3_pate_t *entry) {
+    /* used by spapr_hcall: ppc_hash64_hpt_mask */
+    return true;
+}
+
+/* THIRD BATCH OF ERRORS, AFTER MOVING STUFF FROM TRANSLATE TO CPU.C */
+
+/* they are all coming from cpu.c, probably */
+
+void create_ppc_opcodes(PowerPCCPU *cpu, Error **errp) {
+    return;
+}
+
+void init_ppc_proc(PowerPCCPU *cpu) {
+    return;
+}
+
+void destroy_ppc_opcodes(PowerPCCPU *cpu) {
+    return;
+}
+
+void ppc_tlb_invalidate_all(CPUPPCState *env) {
+    return;
+}
+
+void ppc_cpu_dump_state(CPUState *cpu, FILE *f, int flags) {
+    return;
+}
+
+void ppc_cpu_dump_statistics(CPUState *cpu, int flags) {
+    return;
+}
+
+#include "exec/hwaddr.h"
+
+hwaddr ppc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr) {
+    return 0;
+}