Message ID | 20250414012528.4075447-5-maobibo@loongson.cn (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | target/loongarch: Code cleanup with function loongarch_map_address | expand |
On 14/4/25 03:25, Bibo Mao wrote: > Function loongarch_map_address is to get physical address from virtual > address, it is used by qmp commands to dump memeory from virtual Typo "memory", > address. > > It is used by kvm mode also, here move function loongarch_map_address() > out of macro CONFIG_TCG. And it is common code, the similiar with "similar". > function loongarch_page_table_walker(). > > Signed-off-by: Bibo Mao <maobibo@loongson.cn> > --- > target/loongarch/cpu_helper.c | 17 ++++++++--------- > 1 file changed, 8 insertions(+), 9 deletions(-) > > diff --git a/target/loongarch/cpu_helper.c b/target/loongarch/cpu_helper.c > index 6736a9a330..7a56482282 100644 > --- a/target/loongarch/cpu_helper.c > +++ b/target/loongarch/cpu_helper.c > @@ -155,6 +155,14 @@ static int loongarch_get_addr_from_tlb(CPULoongArchState *env, hwaddr *physical, > > return TLBRET_NOMATCH; > } > +#else > +static int loongarch_get_addr_from_tlb(CPULoongArchState *env, hwaddr *physical, > + int *prot, target_ulong address, > + MMUAccessType access_type, int mmu_idx) > +{ > + return TLBRET_NOMATCH; > +} > +#endif > > void get_dir_base_width(CPULoongArchState *env, uint64_t *dir_base, > uint64_t *dir_width, target_ulong level) > @@ -283,15 +291,6 @@ static int loongarch_map_address(CPULoongArchState *env, hwaddr *physical, > > return TLBRET_NOMATCH; > } > -#else > -static int loongarch_map_address(CPULoongArchState *env, hwaddr *physical, > - int *prot, target_ulong address, > - MMUAccessType access_type, int mmu_idx, > - int is_debug) > -{ > - return TLBRET_NOMATCH; > -} > -#endif The change seems incomplete but fixed in the next patch. Maybe rebase issue?
On 2025/4/14 下午6:51, Philippe Mathieu-Daudé wrote: > On 14/4/25 03:25, Bibo Mao wrote: >> Function loongarch_map_address is to get physical address from virtual >> address, it is used by qmp commands to dump memeory from virtual > > Typo "memory", Will fix in next version. > >> address. >> >> It is used by kvm mode also, here move function loongarch_map_address() >> out of macro CONFIG_TCG. And it is common code, the similiar with > > "similar". Will fix in next version. > >> function loongarch_page_table_walker(). >> >> Signed-off-by: Bibo Mao <maobibo@loongson.cn> >> --- >> target/loongarch/cpu_helper.c | 17 ++++++++--------- >> 1 file changed, 8 insertions(+), 9 deletions(-) >> >> diff --git a/target/loongarch/cpu_helper.c >> b/target/loongarch/cpu_helper.c >> index 6736a9a330..7a56482282 100644 >> --- a/target/loongarch/cpu_helper.c >> +++ b/target/loongarch/cpu_helper.c >> @@ -155,6 +155,14 @@ static int >> loongarch_get_addr_from_tlb(CPULoongArchState *env, hwaddr *physical, >> return TLBRET_NOMATCH; >> } >> +#else >> +static int loongarch_get_addr_from_tlb(CPULoongArchState *env, hwaddr >> *physical, >> + int *prot, target_ulong address, >> + MMUAccessType access_type, int >> mmu_idx) >> +{ >> + return TLBRET_NOMATCH; >> +} >> +#endif >> void get_dir_base_width(CPULoongArchState *env, uint64_t *dir_base, >> uint64_t *dir_width, target_ulong level) >> @@ -283,15 +291,6 @@ static int >> loongarch_map_address(CPULoongArchState *env, hwaddr *physical, >> return TLBRET_NOMATCH; >> } >> -#else >> -static int loongarch_map_address(CPULoongArchState *env, hwaddr >> *physical, >> - int *prot, target_ulong address, >> - MMUAccessType access_type, int mmu_idx, >> - int is_debug) >> -{ >> - return TLBRET_NOMATCH; >> -} >> -#endif > > The change seems incomplete but fixed in the next patch. Maybe rebase > issue? Here removes CONFIG_TCG maro with loongarch_map_address() function, so that it can be used with KVM only mode. Maybe it should be split into two patches so that it is easier to understand, one is to add stub function loongarch_get_addr_from_tlb() without CONFIG_TCG defined, the other is to remove stub loongarch_map_address() and make it common for KVM only mode. Regards Bibo Mao
diff --git a/target/loongarch/cpu_helper.c b/target/loongarch/cpu_helper.c index 6736a9a330..7a56482282 100644 --- a/target/loongarch/cpu_helper.c +++ b/target/loongarch/cpu_helper.c @@ -155,6 +155,14 @@ static int loongarch_get_addr_from_tlb(CPULoongArchState *env, hwaddr *physical, return TLBRET_NOMATCH; } +#else +static int loongarch_get_addr_from_tlb(CPULoongArchState *env, hwaddr *physical, + int *prot, target_ulong address, + MMUAccessType access_type, int mmu_idx) +{ + return TLBRET_NOMATCH; +} +#endif void get_dir_base_width(CPULoongArchState *env, uint64_t *dir_base, uint64_t *dir_width, target_ulong level) @@ -283,15 +291,6 @@ static int loongarch_map_address(CPULoongArchState *env, hwaddr *physical, return TLBRET_NOMATCH; } -#else -static int loongarch_map_address(CPULoongArchState *env, hwaddr *physical, - int *prot, target_ulong address, - MMUAccessType access_type, int mmu_idx, - int is_debug) -{ - return TLBRET_NOMATCH; -} -#endif static hwaddr dmw_va2pa(CPULoongArchState *env, target_ulong va, target_ulong dmw)
Function loongarch_map_address is to get physical address from virtual address, it is used by qmp commands to dump memeory from virtual address. It is used by kvm mode also, here move function loongarch_map_address() out of macro CONFIG_TCG. And it is common code, the similiar with function loongarch_page_table_walker(). Signed-off-by: Bibo Mao <maobibo@loongson.cn> --- target/loongarch/cpu_helper.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)