qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 2/4] target/ppc: divided mmu_helper.c in 2 files


From: Lucas Mateus Martins Araujo e Castro
Subject: Re: [PATCH v3 2/4] target/ppc: divided mmu_helper.c in 2 files
Date: Wed, 14 Jul 2021 14:04:45 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0


On 14/07/2021 08:23, Lucas Mateus Martins Araujo e Castro wrote:
On 08/07/2021 15:09, Richard Henderson wrote:

On 7/8/21 9:49 AM, Lucas Mateus Castro (alqotel) wrote:
+++ b/target/ppc/cpu.h
@@ -1327,6 +1327,26 @@ void store_40x_dbcr0(CPUPPCState *env,
uint32_t val);
  void store_40x_sler(CPUPPCState *env, uint32_t val);
  void store_booke_tcr(CPUPPCState *env, target_ulong val);
  void store_booke_tsr(CPUPPCState *env, target_ulong val);
+typedef struct mmu_ctx_t mmu_ctx_t;
+bool ppc_xlate(PowerPCCPU *cpu, vaddr eaddr, MMUAccessType access_type,
+                      hwaddr *raddrp, int *psizep, int *protp,
+                      int mmu_idx, bool guest_visible);
+int ppcmas_tlb_check(CPUPPCState *env, ppcmas_tlb_t *tlb,
+                            hwaddr *raddrp, target_ulong address,
+                            uint32_t pid);
+int ppcemb_tlb_check(CPUPPCState *env, ppcemb_tlb_t *tlb,
+                            hwaddr *raddrp,
+                            target_ulong address, uint32_t pid, int
ext,
+                            int i);
+int get_physical_address_wtlb(CPUPPCState *env, mmu_ctx_t *ctx,
+                                     target_ulong eaddr,
+                                     MMUAccessType access_type, int
type,
+                                     int mmu_idx);
+hwaddr booke206_tlb_to_page_size(CPUPPCState *env,
+                                        ppcmas_tlb_t *tlb);
+/* Software driven TLB helpers */
+int ppc6xx_tlb_getnum(CPUPPCState *env, target_ulong eaddr,
+                                    int way, int is_code);

Why are any of these going into cpu.h?
Surely they are not used outside of target/ppc/.
At first I divided between internal.h and cpu.h based on what I thought
really shouldn't be used outside target/ppc, but looking back my logic
was flawed since all of this was inside mmu_helper.c, so it was only
visible inside mmu_helper.c, therefore none of it should be used outside
target/ppc. I'll fix this in the next version.

Actually I spoke too soon, while most of these functions should just be moved to internal.h some functions are in cpu.h because they need some structures declared in cpu.h, more specifically ppcmas_tlb_t and ppcemb_tlb_t.

These functions are: ppcmas_tlb_check, ppcemb_tlb_check and booke206_tlb_to_page_size, from what I gather these functions should be in mmu_helper.c, but as they're still called in some _get_physical_address functions they're in mmu_common.c for now.

So for this patch is it better to leave this functions declaration in cpu.h or do something else?



r~

--
Lucas Mateus M. Araujo e Castro
Instituto de Pesquisas ELDORADO
Departamento Computação Embarcada
Estagiario
Aviso Legal - Disclaimer

reply via email to

[Prev in Thread] Current Thread [Next in Thread]