Re: [PATCH v2 4/4] vga/cirrus: deprecate, don't build by default

2024-05-30 Thread BALATON Zoltan
->deprecation_note = "use stdvga instead"; Excepr some old OSes work better with this than stdvga so could this be left and not removed? Does it cause a lot of work to keep this device? I thought it's stable already and were not many changes for it lately. If something works

Re: TCG change broke MorphOS boot on sam460ex

2024-05-27 Thread BALATON Zoltan
On Tue, 28 May 2024, BALATON Zoltan wrote: On Wed, 3 Apr 2024, Nicholas Piggin wrote: On Tue Apr 2, 2024 at 9:32 PM AEST, BALATON Zoltan wrote: On Thu, 21 Mar 2024, BALATON Zoltan wrote: On 27/2/24 17:47, BALATON Zoltan wrote: Hello, Commit 18a536f1f8 (accel/tcg: Always require can_do_io

Re: TCG change broke MorphOS boot on sam460ex

2024-05-27 Thread BALATON Zoltan
On Wed, 3 Apr 2024, Nicholas Piggin wrote: On Tue Apr 2, 2024 at 9:32 PM AEST, BALATON Zoltan wrote: On Thu, 21 Mar 2024, BALATON Zoltan wrote: On 27/2/24 17:47, BALATON Zoltan wrote: Hello, Commit 18a536f1f8 (accel/tcg: Always require can_do_io) broke booting MorphOS on sam460ex

Re: [PATCH 00/43] Remaining MMU clean up patches

2024-05-27 Thread BALATON Zoltan
On Mon, 27 May 2024, BALATON Zoltan wrote: This is the rest of the MMU clean up series the first part of which was merged. Here are the remaining patches rebased and some more added. Besides cleaning up this code my other goal with this and previous already merged series was trying

[PATCH 29/43] target/ppc/mmu-hash32.c: Move get_pteg_offset32() to the header

2024-05-26 Thread BALATON Zoltan
This function is a simple shared function, move it to other similar static inline functions in the header. Signed-off-by: BALATON Zoltan --- target/ppc/mmu-hash32.c | 7 --- target/ppc/mmu-hash32.h | 6 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/target/ppc/mmu

[PATCH 31/43] target/ppc/mmu-radix64: Remove externally unused parts from header

2024-05-26 Thread BALATON Zoltan
Move the parts not needed outside of mmu-radix64.c from the header to the C file to leave only parts in the header that need to be exported. Also drop unneded include of this header. Signed-off-by: BALATON Zoltan --- target/ppc/mmu-book3s-v3.c | 1 - target/ppc/mmu-radix64.c | 49

[PATCH 41/43] target/ppc: Change MMU xlate functions to take CPUState

2024-05-26 Thread BALATON Zoltan
The callers of xlate functions get CPUState which is then cast to PowerPCCPU that is then cast back to CPUState by most xlate functions. Avoid this back and forth casting by passing the existing CPUState to xlate functions and let them convert it as needed. Signed-off-by: BALATON Zoltan

[PATCH 15/43] target/ppc/mmu_common.c: Simplify a switch statement

2024-05-26 Thread BALATON Zoltan
In mmu6xx_get_physical_address() the switch handles all cases so the default is never reached and can be dropped. Also group together cases which just return -4. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 19 --- 1 file changed, 4 insertions(+), 15 deletions

[PATCH 34/43] target/ppc/internal.h: Consolidate ifndef CONFIG_USER_ONLY blocks

2024-05-26 Thread BALATON Zoltan
-by: BALATON Zoltan --- target/ppc/internal.h | 23 ++- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/target/ppc/internal.h b/target/ppc/internal.h index 8e5a241f74..66ce22bbe9 100644 --- a/target/ppc/internal.h +++ b/target/ppc/internal.h @@ -224,6 +224,10 @@ void

[PATCH 43/43] target/ppc/mmu-hash32.c: Change parameter type of ppc_hash32_direct_store

2024-05-26 Thread BALATON Zoltan
This function needs CPUState and env but takes PowerPCCPU and cast that. We already have the right types in the caller so pass them to this function to avoid casting. Signed-off-by: BALATON Zoltan --- target/ppc/mmu-hash32.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff

[PATCH 10/43] target/ppc/mmu_common.c: Remove hash field from mmu_ctx_t

2024-05-26 Thread BALATON Zoltan
Return hash value via a parameter and remove it from mmu_ctx.t. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 19 --- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index 0a07023f48..e3537c63c0

[PATCH 16/43] target/ppc/mmu_common.c: Inline and remove ppc6xx_tlb_pte_check()

2024-05-26 Thread BALATON Zoltan
This function is only called once and we can make the caller simpler by inlining it. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 71 + 1 file changed, 22 insertions(+), 49 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc

[PATCH 11/43] target/ppc/mmu_common.c: Remove pte_update_flags()

2024-05-26 Thread BALATON Zoltan
This function is used only once, its return value is ignored and one of its parameter is a return value from a previous call. It is better to inline it in the caller and remove it. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 41 + 1 file

[PATCH 37/43] target/ppc/mmu-hash32.c: Return and use pte address instead of base + offset

2024-05-26 Thread BALATON Zoltan
Change ppc_hash32_pteg_search() to return pte address instead of an offset to avoid needing to get the base and add offset to it when we already have the address we need. Signed-off-by: BALATON Zoltan --- target/ppc/mmu-hash32.c | 51 - 1 file changed, 20

[PATCH 36/43] target/ppc/mmu-hash32: Remove some static inlines from header

2024-05-26 Thread BALATON Zoltan
Two of these are not used anywhere and the other two are used only once and can be inlined and removed from the header. Signed-off-by: BALATON Zoltan --- target/ppc/mmu-hash32.c | 5 +++-- target/ppc/mmu-hash32.h | 32 2 files changed, 3 insertions(+), 34

[PATCH 27/43] target/ppc/mmu_common.c: Remove mmu_ctx_t

2024-05-26 Thread BALATON Zoltan
Completely get rid of mmu_ctx_t after converting the remaining functions to pass raddr and prot without the context struct. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 25 +++-- 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/target/ppc

[PATCH 33/43] target/ppc: Remove single use static inline function

2024-05-26 Thread BALATON Zoltan
The ger_pack_masks() function is only used once and the inverse of this operation is already inlined so it can be inlined too in the only caller and removed from the header. Signed-off-by: BALATON Zoltan --- target/ppc/internal.h | 9 - target/ppc/translate/vsx-impl.c.inc

[PATCH 32/43] target/ppc: Remove includes from mmu-book3s-v3.h

2024-05-26 Thread BALATON Zoltan
Drop includes from header that is not needed by the header itself and only include them from C files that really need it. Signed-off-by: BALATON Zoltan --- target/ppc/mmu-book3s-v3.h | 3 --- target/ppc/mmu-hash64.c| 1 + target/ppc/mmu-radix64.c | 1 + 3 files changed, 2 insertions(+), 3

[PATCH 04/43] target/ppc/mmu_common.c: Remove single use local variable

2024-05-26 Thread BALATON Zoltan
The ptev variable in ppc6xx_tlb_pte_check() is used only once and just obfuscates an otherwise clear value. Get rid of it. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc

[PATCH 38/43] target/ppc/mmu-hash32.c: Use pte address as parameter instead of offset

2024-05-26 Thread BALATON Zoltan
Instead of getting base and adding an offset to it pass pte address to ppc_hash32_pteg_search() that the only caller of this function already has and can easily pass it. Also add a local variable in the caller to avoid getting base multiple times. Signed-off-by: BALATON Zoltan --- target/ppc

[PATCH 17/43] target/ppc/mmu_common.c: Remove ptem field from mmu_ctx_t

2024-05-26 Thread BALATON Zoltan
Instead of passing around ptem in context use it once in the same function so it can be removed from mmu_ctx_t. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 23 ++- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/target/ppc/mmu_common.c b/target

[PATCH 12/43] target/ppc/mmu_common.c: Remove nx field from mmu_ctx_t

2024-05-26 Thread BALATON Zoltan
Pass it as a parameter instead. Also use named constants instead of hex values when extracting bits from SR. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/target/ppc/mmu_common.c b/target

[PATCH 30/43] target/ppc: Unexport some functions from mmu-book3s-v3.h

2024-05-26 Thread BALATON Zoltan
-off-by: BALATON Zoltan --- hw/ppc/spapr_vhyp_mmu.c| 21 target/ppc/mmu-book3s-v3.h | 40 --- target/ppc/mmu-hash64.c| 49 ++ target/ppc/mmu-hash64.h| 1 + 4 files changed, 54 insertions(+), 57 deletions

[PATCH 25/43] target/ppc: Remove bat_size_prot()

2024-05-26 Thread BALATON Zoltan
There is already a hash32_bat_prot() function that does most if this and the rest can be inlined. Export hash32_bat_prot() and rename it to ppc_hash32_bat_prot() to match other functions and use it in get_bat_6xx_tlb(). Signed-off-by: BALATON Zoltan --- target/ppc/mmu-hash32.c | 18

[PATCH 02/43] target/ppc/mmu_common.c: Remove local name for a constant

2024-05-26 Thread BALATON Zoltan
The mmask local variable is a less descriptive local name for a constant. Drop it and use the constant directly in the two places it is needed. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/target/ppc

[PATCH 42/43] target/ppc/mmu-hash32.c: Change parameter type of ppc_hash32_set_[rc]

2024-05-26 Thread BALATON Zoltan
These functions need AddressSpace from CPUState but take PowerPCCPU instead and cast that. We have the right type in the caller so change the parameter type and pass the needed value to avoid casting. Signed-off-by: BALATON Zoltan --- target/ppc/mmu-hash32.c | 14 -- 1 file changed

[PATCH 22/43] target/ppc/mmu_common.c: Stop using ctx in ppc6xx_tlb_check()

2024-05-26 Thread BALATON Zoltan
Pass raddr and prot in function parameters instead. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index be09c3b1a3..ede409eb99 100644

[PATCH 28/43] target/ppc/mmu-hash32.c: Inline and remove ppc_hash32_pte_raddr()

2024-05-26 Thread BALATON Zoltan
This function is used only once and does not add more clarity than doing it inline. Signed-off-by: BALATON Zoltan --- target/ppc/mmu-hash32.c | 18 +- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/target/ppc/mmu-hash32.c b/target/ppc/mmu-hash32.c index

[PATCH 01/43] target/ppc: Reorganise and rename ppc_hash32_pp_prot()

2024-05-26 Thread BALATON Zoltan
Reorganise ppc_hash32_pp_prot() swapping the if legs so it does not test for negative first and clean up to make it shorter. Also rename it to ppc_hash32_prot(). Signed-off-by: BALATON Zoltan --- target/ppc/mmu-hash32.c | 2 +- target/ppc/mmu-hash32.h | 35

[PATCH 40/43] target/ppc: Change parameter type of ppc64_v3_radix()

2024-05-26 Thread BALATON Zoltan
This function takes PowerPCCPU but only needs the env from it. Change its parameter to CPUPPCState *env. Signed-off-by: BALATON Zoltan --- hw/ppc/spapr_rtas.c| 2 +- target/ppc/mmu-book3s-v3.h | 4 ++-- target/ppc/mmu_common.c| 4 ++-- 3 files changed, 5 insertions(+), 5 deletions

[PATCH 24/43] target/ppc/mmu_common.c: Use defines instead of numeric constants

2024-05-26 Thread BALATON Zoltan
Replace some BAT related constants with defines from mmu-hash32.h Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index 110936ca83

[PATCH 23/43] target/ppc/mmu_common.c: Rename function parameter

2024-05-26 Thread BALATON Zoltan
Rename parameter of get_bat_6xx_tlb() from virtual to eaddr to match other functions. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index

[PATCH 35/43] target/ppc/mmu-hash32.c: Change parameter type of ppc_hash32_bat_lookup()

2024-05-26 Thread BALATON Zoltan
This function takes PowerPCCPU but only needs the env from it. Change its parameter to CPUPPCState *env. Signed-off-by: BALATON Zoltan --- target/ppc/mmu-hash32.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/target/ppc/mmu-hash32.c b/target/ppc/mmu-hash32.c index

[PATCH 20/43] target/ppc/mmu_common.c: Init variable in function that relies on it

2024-05-26 Thread BALATON Zoltan
The ppc6xx_tlb_check() relies on the caller to initialise raddr field in ctx. Move this init from the only caller into the function. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/ppc/mmu_common.c b/target

[PATCH 07/43] target/ppc/mmu_common.c: Return directly in ppc6xx_tlb_pte_check()

2024-05-26 Thread BALATON Zoltan
Instead of using a local ret variable return directly and remove the local. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index 799d2ced9b..a5ae11394d

[PATCH 26/43] target/ppc/mmu_common.c: Stop using ctx in get_bat_6xx_tlb()

2024-05-26 Thread BALATON Zoltan
Pass raddr and prot in function parameters instead Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index 624ed51a92..4770b43630 100644 --- a/target

[PATCH 39/43] target/ppc: Change parameter type of some inline functions

2024-05-26 Thread BALATON Zoltan
These functions take PowerPCCPU but only need the env from it. Change their parameter to CPUPPCState *env. Signed-off-by: BALATON Zoltan --- target/ppc/mmu-hash32.c | 13 +++-- target/ppc/mmu-hash32.h | 12 ++-- target/ppc/mmu_common.c | 20 +--- 3 files changed

[PATCH 09/43] target/ppc/mmu_common.c: Remove unused field from mmu_ctx_t

2024-05-26 Thread BALATON Zoltan
The eaddr field of mmu_ctx_t is set once but never used so can be removed. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index 28adb3ca10..0a07023f48 100644 --- a/target/ppc

[PATCH 18/43] target/ppc: Add function to get protection key for hash32 MMU

2024-05-26 Thread BALATON Zoltan
Add a function to get key bit from SR and use it instead of open coded version. Signed-off-by: BALATON Zoltan --- target/ppc/mmu-hash32.c | 9 ++--- target/ppc/mmu-hash32.h | 5 + target/ppc/mmu_common.c | 3 +-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/target/ppc

[PATCH 05/43] target/ppc/mmu_common.c: Remove another single use local variable

2024-05-26 Thread BALATON Zoltan
In ppc6xx_tlb_pte_check() the pteh variable is used only once to compare to the h parameter of the function. Inline its value and use pteh name for the function parameter which is more descriptive. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 7 +++ 1 file changed, 3

[PATCH 13/43] target/ppc/mmu_common.c: Convert local variable to bool

2024-05-26 Thread BALATON Zoltan
In mmu6xx_get_physical_address() ds is used as bool, declare it as such. Also use named constant instead of hex value. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc

[PATCH 19/43] target/ppc/mmu-hash32.c: Inline and remove ppc_hash32_pte_prot()

2024-05-26 Thread BALATON Zoltan
This is used only once and can be inlined. Signed-off-by: BALATON Zoltan --- target/ppc/mmu-hash32.c | 19 --- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/target/ppc/mmu-hash32.c b/target/ppc/mmu-hash32.c index 93559447ff..160311de87 100644 --- a/target/ppc

[PATCH 08/43] target/ppc/mmu_common.c: Simplify ppc6xx_tlb_pte_check()

2024-05-26 Thread BALATON Zoltan
Invert conditions to avoid deep nested ifs and return early instead. Remove some obvious comments that don't add more clarity. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 43 ++--- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git

[PATCH 00/43] Remaining MMU clean up patches

2024-05-26 Thread BALATON Zoltan
This is the rest of the MMU clean up series the first part of which was merged. Here are the remaining patches rebased and some more added. Regards, BALATON Zoltan BALATON Zoltan (43): target/ppc: Reorganise and rename ppc_hash32_pp_prot() target/ppc/mmu_common.c: Remove local name

[PATCH 14/43] target/ppc/mmu_common.c: Remove single use local variable

2024-05-26 Thread BALATON Zoltan
In mmu6xx_get_physical_address() tagtet_page_bits local is declared only to use TARGET_PAGE_BITS once. Drop the unneeded variable. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/target/ppc/mmu_common.c b/target

[PATCH 21/43] target/ppc/mmu_common.c: Remove key field from mmu_ctx_t

2024-05-26 Thread BALATON Zoltan
Pass it as a function parameter and remove it from mmu_ctx_t. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 26 ++ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index fe321ab49c..be09c3b1a3

[PATCH 06/43] target/ppc/mmu_common.c: Remove yet another single use local variable

2024-05-26 Thread BALATON Zoltan
In ppc6xx_tlb_pte_check() the pp variable is used only once to pass it to a function parameter with the same name. Remove the local and inline the value. Also use named constant for the hex value to make it clearer. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 5 ++--- 1 file

[PATCH 03/43] target/ppc/mmu_common.c: Remove single use local variable

2024-05-26 Thread BALATON Zoltan
The ptem variable in ppc6xx_tlb_pte_check() is used only once, simplify by removing it as the value is already clear itself without adding a local name for it. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/target

Re: [PATCH 6/6] target/ppc: redue code duplication across Power9/10 init code

2024-05-20 Thread BALATON Zoltan
it POWERPC_FAMILY_POWER9_10_INSNS_FLAGS or similar but I think using earlier features where unchanged in newer CPU models would be OK and show these are the same). Regards, BALATON Zoltan + +#define POWERPC_FAMILY_POWER9_INSNS_FLAGS2_COMMON \ +PPC2_VSX | PPC2_VSX207 | PPC2_DFP

Re: [PATCH 5/6] target/ppc: reduce duplicate code between init_proc_POWER{9, 10}

2024-05-20 Thread BALATON Zoltan
.) Regards, BALATON Zoltan { /* Common Registers */ init_proc_book3s_common(env); @@ -6326,7 +6326,6 @@ static void init_proc_POWER9(CPUPPCState *env) register_power5p_ear_sprs(env); register_power5p_tb_sprs(env); register_power6_common_sprs(env); -register_HEIR32_spr(env

Re: [PATCH 4/6] target/ppc: optimize p9 exception handling routines

2024-05-20 Thread BALATON Zoltan
On Mon, 20 May 2024, BALATON Zoltan wrote: On Mon, 20 May 2024, Harsh Prateek Bora wrote: Currently, p9 exception handling has multiple if-condition checks where it does an indirect access to pending_interrupts via env. Cache the value during entry and reuse later to avoid multiple indirect

Re: [PATCH 4/6] target/ppc: optimize p9 exception handling routines

2024-05-20 Thread BALATON Zoltan
so maybe you could change these functions to take the pending_interrupts and lpcr as parameters and pass them from the caller that already have it so even this dereference could be saved? Regards, BALATON Zoltan /* External Exception */ -if ((env->pending_interrupts & PPC_INT

Re: [PATCH 3/6] target/ppc: optimize hreg_compute_pmu_hflags_value

2024-05-20 Thread BALATON Zoltan
On Mon, 20 May 2024, Harsh Prateek Bora wrote: The second if-condition can be true only if the first one above is true. Enclose the latter into the former to avoid un-necessary check if first condition fails. Signed-off-by: Harsh Prateek Bora Reviewed-by: BALATON Zoltan --- target/ppc

Re: [PATCH 2/6] target/ppc: optimize hreg_compute_pmu_hflags_value

2024-05-20 Thread BALATON Zoltan
make it more readable but I'd call it just mmcr0 for readability. Regards, BALATON Zoltan + +if (spr_power_mmcr0 & MMCR0_PMCC0) { hflags |= 1 << HFLAGS_PMCC0; } -if (env->spr[SPR_POWER_MMCR0] & MMCR0_PMCC1) { +if (spr_power_mmcr0 & MMCR0_PMCC1) {

[PATCH] macio: Add unimp region for debugging

2024-05-20 Thread BALATON Zoltan
to get logs when the guest accesses unassigned areas. Signed-off-by: BALATON Zoltan --- Here's a patch that should help getting logs for unimplemented registers in macio with -d unimp which may help finding out where the writes go and what needs to be implemented. hw/misc/Kconfig | 1 + hw

Re: [PATCH v7 52/61] target/ppc/mmu-hash32.c: Inline and remove ppc_hash32_pte_prot()

2024-05-18 Thread BALATON Zoltan
On Fri, 17 May 2024, Nicholas Piggin wrote: On Mon May 13, 2024 at 9:28 AM AEST, BALATON Zoltan wrote: This is used only once and can be inlined. This reminds me, ppc_hash32_pp_prot() calculates prot from pp and nx (which is not from pp but from segment) and from key of course. It could

Re: [PATCH 02/14] target/ppc: Remove redundant MEMOP_GET_SIZE macro

2024-05-18 Thread BALATON Zoltan
On Sat, 18 May 2024, Nicholas Piggin wrote: There is a memop_size() function for this. Signed-off-by: Nicholas Piggin Reviewed-by: BALATON Zoltan --- target/ppc/translate.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc

Re: [PATCH v7 00/61] Misc PPC exception and BookE MMU clean ups

2024-05-18 Thread BALATON Zoltan
On Sat, 18 May 2024, Nicholas Piggin wrote: On Mon May 13, 2024 at 9:27 AM AEST, BALATON Zoltan wrote: This series does some further clean up mostly around BookE MMU to untangle it from other MMU models. It also contains some other changes that I've come up with while working

Re: [PATCH v7 36/61] target/ppc/mmu_common.c: Remove local name for a constant

2024-05-17 Thread BALATON Zoltan
On Fri, 17 May 2024, Nicholas Piggin wrote: On Mon May 13, 2024 at 9:28 AM AEST, BALATON Zoltan wrote: The mmask local variable is a less descriptive local name for a constant. Drop it and use the constant directly in the two places it is needed. Wow, lots more. I might take up to patch 34ish

Re: [PATCH v7 35/61] target/ppc: Remove pp_check() and reuse ppc_hash32_pp_prot()

2024-05-17 Thread BALATON Zoltan
On Fri, 17 May 2024, Nicholas Piggin wrote: On Mon May 13, 2024 at 9:28 AM AEST, BALATON Zoltan wrote: The ppc_hash32_pp_prot() function in mmu-hash32.c is the same as pp_check() in mmu_common.c, merge these to remove duplicated code. Define the common function as static lnline otherwise

[PATCH v7 44/61] target/ppc/mmu_common.c: Remove hash field from mmu_ctx_t

2024-05-12 Thread BALATON Zoltan
Return hash value via a parameter and remove it from mmu_ctx.t. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 19 --- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index 07c127d673..ccacc70ba6

[PATCH v7 36/61] target/ppc/mmu_common.c: Remove local name for a constant

2024-05-12 Thread BALATON Zoltan
The mmask local variable is a less descriptive local name for a constant. Drop it and use the constant directly in the two places it is needed. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/target/ppc

[PATCH v7 21/61] target/ppc/mmu_common.c: Split off BookE handling from ppc_jumbo_xlate()

2024-05-12 Thread BALATON Zoltan
Introduce ppc_booke_xlate() to handle BookE and BookE 2.06 cases to reduce ppc_jumbo_xlate() further. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- target/ppc/mmu_common.c | 146 ++-- 1 file changed, 96 insertions(+), 50 deletions(-) diff

[PATCH v7 05/61] target/ppc/mmu_common.c: Simplify checking for real mode

2024-05-12 Thread BALATON Zoltan
In get_physical_address_wtlb() the real_mode flag depends on either the MSR[IR] or MSR[DR] bit depending on access_type. Extract just the needed bit in a more straight forward way instead of doing unnecessary computation. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- target

[PATCH v7 17/61] target/ppc/mmu_common.c: Don't use mmu_ctx_t for mmu40x_get_physical_address()

2024-05-12 Thread BALATON Zoltan
mmu40x_get_physical_address() only uses the raddr and prot fields from mmu_ctx_t. Pass these directly instead of using a ctx struct. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- target/ppc/mmu_common.c | 37 +++-- 1 file changed, 15 insertions

[PATCH v7 37/61] target/ppc/mmu_common.c: Remove single use local variable

2024-05-12 Thread BALATON Zoltan
The ptem variable in ppc6xx_tlb_pte_check() is used only once, simplify by removing it as the value is already clear itself without adding a local name for it. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/target

[PATCH v7 14/61] target/ppc/mmu_common.c: Fix misindented qemu_log_mask() calls

2024-05-12 Thread BALATON Zoltan
Fix several qemu_log_mask() calls that are misindented. Signed-off-by: BALATON Zoltan Acked-by: Nicholas Piggin --- target/ppc/mmu_common.c | 42 - 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc

[PATCH v7 04/61] target/ppc/mmu_common.c: Remove unneeded local variable

2024-05-12 Thread BALATON Zoltan
In mmubooke_check_tlb() and mmubooke206_check_tlb() we can assign the value of prot2 directly to the destination, no need to have a separate local variable for it. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- target/ppc/mmu_common.c | 30 +- 1 file

[PATCH v7 25/61] target/ppc/mmu_common.c: Split off 40x cases from ppc_jumbo_xlate()

2024-05-12 Thread BALATON Zoltan
Introduce ppc_40x_xlate() to split off 40x handlning leaving only 6xx in ppc_jumbo_xlate() now. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 150 +--- 1 file changed, 93 insertions(+), 57 deletions(-) diff --git a/target/ppc/mmu_common.c b

[PATCH v7 59/61] target/ppc/mmu_common.c: Stop using ctx in get_bat_6xx_tlb()

2024-05-12 Thread BALATON Zoltan
Pass raddr and prot in function parameters instead Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index ba54c40048..6d588b6795 100644 --- a/target

[PATCH v7 32/61] target/ppc/mmu-radix64.c: Drop a local variable

2024-05-12 Thread BALATON Zoltan
The value is only used once so no need to introduce a local variable for it. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- target/ppc/mmu-radix64.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/target/ppc/mmu-radix64.c b/target/ppc/mmu-radix64.c

[PATCH v7 56/61] target/ppc/mmu_common.c: Rename function parameter

2024-05-12 Thread BALATON Zoltan
Rename parameter of get_bat_6xx_tlb() from virtual to eaddr to match other functions. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index

[PATCH v7 48/61] target/ppc/mmu_common.c: Simplify a switch statement

2024-05-12 Thread BALATON Zoltan
In mmu6xx_get_physical_address() the switch handles all cases so the default is never reached and can be dropped. Also group together cases which just return -4. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 19 --- 1 file changed, 4 insertions(+), 15 deletions

[PATCH v7 33/61] target/ppc: Add a function to check for page protection bit

2024-05-12 Thread BALATON Zoltan
. Signed-off-by: BALATON Zoltan --- target/ppc/cpu_init.c| 5 + target/ppc/internal.h| 23 +-- target/ppc/mmu-hash32.c | 6 +++--- target/ppc/mmu-hash64.c | 2 +- target/ppc/mmu-radix64.c | 2 +- target/ppc/mmu_common.c | 26 +- 6

[PATCH v7 61/61] target/ppc/mmu_common.c: Remove a local variable

2024-05-12 Thread BALATON Zoltan
In mmu6xx_get_physical_address() the cpu variable is only used for debug logging which is normally disabled. Inline the value and remove local variable to avoid computing it when not needed. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2

[PATCH v7 57/61] targe/ppc/mmu_common.c: Use defines instead of numeric constants

2024-05-12 Thread BALATON Zoltan
Replace some BAT related constants with defines from mmu-hash32.h Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index fd8767879d

[PATCH v7 03/61] target/ppc/mmu_common.c: Move calculation of a value closer to its usage

2024-05-12 Thread BALATON Zoltan
-by: BALATON Zoltan Reviwed-by: Nicholas Piggin --- target/ppc/mmu_common.c | 36 +--- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index 4fde7fd3bf..f79e390306 100644 --- a/target/ppc

[PATCH v7 58/61] target/ppc: Remove bat_size_prot()

2024-05-12 Thread BALATON Zoltan
There is already a hash32_bat_prot() function that does most if this and the rest can be inlined. Export hash32_bat_prot() and rename it to ppc_hash32_bat_prot() to match other functions and use it in get_bat_6xx_tlb(). Signed-off-by: BALATON Zoltan --- target/ppc/mmu-hash32.c | 18

[PATCH v7 16/61] target/ppc/mmu_common.c: Replace hard coded constants in ppc_jumbo_xlate()

2024-05-12 Thread BALATON Zoltan
re as well that yields the same result. This also makes these calls the same as the data access branch further down. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- target/ppc/mmu_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/ppc/mmu_common.c b/

[PATCH v7 51/61] target/ppc: Add function to get protection key for hash32 MMU

2024-05-12 Thread BALATON Zoltan
Add a function to get key bit from SR and use it instead of open coded version. Signed-off-by: BALATON Zoltan --- target/ppc/mmu-hash32.c | 9 ++--- target/ppc/mmu-hash32.h | 5 + target/ppc/mmu_common.c | 3 +-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/target/ppc

[PATCH v7 52/61] target/ppc/mmu-hash32.c: Inline and remove ppc_hash32_pte_prot()

2024-05-12 Thread BALATON Zoltan
This is used only once and can be inlined. Signed-off-by: BALATON Zoltan --- target/ppc/mmu-hash32.c | 19 --- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/target/ppc/mmu-hash32.c b/target/ppc/mmu-hash32.c index 8e5e83f46a..9de42713b3 100644 --- a/target/ppc

[PATCH v7 54/61] target/ppc/mmu_common.c: Remove key field from mmu_ctx_t

2024-05-12 Thread BALATON Zoltan
Pass it as a function argument and remove it from mmu_ctx_t. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 26 ++ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index ccc1c76a06..331e00b71c

[PATCH v7 60/61] target/ppc/mmu_common.c: Remove mmu_ctx_t

2024-05-12 Thread BALATON Zoltan
Completely get rid of mmu_ctx_t after converting the remaining functions to pass raddr and prot without the context struct. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 25 +++-- 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/target/ppc

[PATCH v7 23/61] target/ppc/mmu_common.c: Simplify ppc_booke_xlate() part 2

2024-05-12 Thread BALATON Zoltan
Merge the code fetch and data access cases in a common switch. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- target/ppc/mmu_common.c | 52 - 1 file changed, 20 insertions(+), 32 deletions(-) diff --git a/target/ppc/mmu_common.c b/target

[PATCH v7 50/61] target/ppc/mmu_common.c: Remove ptem field from mmu_ctx_t

2024-05-12 Thread BALATON Zoltan
Instead of passing around ptem in context use it once in the same function so it can be removed from mmu_ctx_t. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 23 ++- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/target/ppc/mmu_common.c b/target

[PATCH v7 12/61] target/ppc/mmu_common.c: Split off real mode cases in get_physical_address_wtlb()

2024-05-12 Thread BALATON Zoltan
The real mode handling is identical in the remaining switch cases. Split off these common real mode cases into a separate conditional to leave only the else branches in the switch that are different. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- target/ppc/mmu_common.c | 34

[PATCH v7 38/61] target/ppc/mmu_common.c: Remove single use local variable

2024-05-12 Thread BALATON Zoltan
The ptev variable in ppc6xx_tlb_pte_check() is used only once and just obfuscates an otherwise clear value. Get rid of it. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc

[PATCH v7 08/61] target/ppc/mmu_common.c: Move else branch to avoid large if block

2024-05-12 Thread BALATON Zoltan
In mmu6xx_get_physical_address() we have a large if block with a two line else branch that effectively returns. Invert the condition and move the else there to allow deindenting the large if block to make the flow easier to follow. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin

[PATCH v7 47/61] target/ppc/mmu_common.c: Remove single use local variable

2024-05-12 Thread BALATON Zoltan
In mmu6xx_get_physical_address() tagtet_page_bits local is declared only to use TARGET_PAGE_BITS once. Drop the unneeded variable. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/target/ppc/mmu_common.c b/target

[PATCH v7 39/61] target/ppc/mmu_common.c: Remove another single use local

2024-05-12 Thread BALATON Zoltan
In ppc6xx_tlb_pte_check() the pteh variable is used only once to compare to the h parameter of the function. Inline its value and use pteh name for the function parameter which is more descriptive. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 7 +++ 1 file changed, 3

[PATCH v7 19/61] target/ppc/mmu_common.c: Don't use mmu_ctx_t in mmubooke206_get_physical_address()

2024-05-12 Thread BALATON Zoltan
mmubooke206_get_physical_address() only uses the raddr and prot fields from mmu_ctx_t. Pass these directly instead of using a ctx struct. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- target/ppc/mmu_common.c | 32 ++-- 1 file changed, 10 insertions

[PATCH v7 45/61] target/ppc/mmu_common.c: Remove nx field from mmu_ctx_t

2024-05-12 Thread BALATON Zoltan
Pass it as a parameter instead. Also use named constants instead of hex values when extracting bits from SR. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/target/ppc/mmu_common.c b/target

[PATCH v7 34/61] target/ppc: Move out BookE and related MMU functions from mmu_common.c

2024-05-12 Thread BALATON Zoltan
Add a new mmu-booke.c file for BookE and related MMU bits from mmu_common.c. Signed-off-by: BALATON Zoltan Acked-by: Nicholas Piggin --- target/ppc/cpu.h| 4 - target/ppc/meson.build | 1 + target/ppc/mmu-booke.c | 531 target/ppc/mmu

[PATCH v7 29/61] target/ppc: Remove id_tlbs flag from CPU env

2024-05-12 Thread BALATON Zoltan
This flag for split instruction/data TLBs is only set for 6xx soft TLB MMU model and not used otherwise so no need to have a separate flag for that. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- hw/ppc/pegasos2.c| 2 +- target/ppc/cpu.h | 5 - target/ppc

[PATCH v7 43/61] target/ppc/mmu_common.c: Remove unused field from mmu_ctx_t

2024-05-12 Thread BALATON Zoltan
The eaddr field of mmu_ctx_t is set once but never used so can be removed. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index 564fcc7cfb..07c127d673 100644 --- a/target/ppc

[PATCH v7 13/61] target/ppc/mmu_common.c: Inline and remove check_physical()

2024-05-12 Thread BALATON Zoltan
This function just does two assignments and and unnecessary check that is always true so inline it in the only caller left and remove it. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- target/ppc/mmu_common.c | 26 +++--- 1 file changed, 3 insertions(+), 23

[PATCH v7 46/61] target/ppc/mmu_common.c: Convert local variable to bool

2024-05-12 Thread BALATON Zoltan
In mmu6xx_get_physical_address() ds is used as bool, declare it as such. Also use named constant instead of hex value. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc

[PATCH v7 00/61] Misc PPC exception and BookE MMU clean ups

2024-05-12 Thread BALATON Zoltan
- Add some more patches I've done since last version v2: - Fix user mode issue in patch 1 by keeping old behaviour for user mode - Add some more MMU clean up patches Regards, BALATON Zoltan Dr. David Alan Gilbert (1): target/ppc: Remove unused struct 'mmu_ctx_hash32' BALATON Zoltan (60

[PATCH v7 11/61] target/ppc/mmu_common.c: Split out BookE cases before checking real mode

2024-05-12 Thread BALATON Zoltan
BookE does not have real mode so split off and handle it first in get_physical_address_wtlb() before checking for real mode for other MMU models. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- target/ppc/mmu_common.c | 14 +++--- 1 file changed, 7 insertions(+), 7

[PATCH v7 41/61] target/ppc/mmu_common.c: Return directly in ppc6xx_tlb_pte_check()

2024-05-12 Thread BALATON Zoltan
Instead of using a local ret variable return directly and remove the local. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index 0c7cbab2bc..a035cefcad

  1   2   3   4   5   6   7   8   9   10   >