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

2024-04-23 Thread BALATON Zoltan
since tha last series. Please review. Regards, BALATON Zoltan BALATON Zoltan (24): target/ppc: Fix gen_sc to use correct nip target/ppc: Move patching nip from exception handler to helper_scv target/ppc: Simplify syscall exception handlers target/ppc: Remove unused helper target/p

[PATCH 11/24] target/ppc/mmu_common.c: Split off real mode cases in get_physical_address_wtlb()

2024-04-23 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 --- target/ppc/mmu_common.c | 34

[PATCH 02/24] target/ppc: Move patching nip from exception handler to helper_scv

2024-04-23 Thread BALATON Zoltan
ge it. [balaton: added commit message] Signed-off-by: BALATON Zoltan --- target/ppc/excp_helper.c | 2 +- target/ppc/translate.c | 6 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index b6a5241a4d..fd145200dd 100644 --- a/t

[PATCH 22/24] target/ppc/mmu_common.c: Remove BookE handling from get_physical_address_wtlb()

2024-04-23 Thread BALATON Zoltan
This function is no longer called for BookE MMU model so remove parts related to it. This has uncovered a few may be used uninitialised warnings that are also fixed. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 25 + 1 file changed, 5 insertions(+), 20

[PATCH 24/24] target/ppc/mmu_common.c: Move BookE MMU functions together

2024-04-23 Thread BALATON Zoltan
Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 300 1 file changed, 150 insertions(+), 150 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index ad64ec1647..18e49aa2f1 100644 --- a/target/ppc/mmu_common.c +++ b

[PATCH 13/24] target/ppc/mmu_common.c: Simplify mmubooke_get_physical_address()

2024-04-23 Thread BALATON Zoltan
Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 25 + 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index 843f909619..d40ddb6fc3 100644 --- a/target/ppc/mmu_common.c +++ b/target/ppc

[PATCH 05/24] target/ppc/mmu_common.c: Move calculation of a value closer to its usage

2024-04-23 Thread BALATON Zoltan
In mmubooke_check_tlb() prot2 is calculated first but only used after an unrelated check that can return before tha value is used. Move the calculation after the check, closer to where it is used, to keep them together and avoid computing it when not needed. Signed-off-by: BALATON Zoltan

[PATCH 04/24] target/ppc: Remove unused helper

2024-04-23 Thread BALATON Zoltan
The helper_rac function is defined but not used, remove it. Fixes: 005b69fdcc (target/ppc: Remove PowerPC 601 CPUs) Signed-off-by: BALATON Zoltan --- target/ppc/helper.h | 2 -- target/ppc/mmu_helper.c | 24 2 files changed, 26 deletions(-) diff --git a/target/ppc

[PATCH 08/24] target/ppc/mmu_common.c: Introduce mmu6xx_get_physical_address()

2024-04-23 Thread BALATON Zoltan
caller allowing further restructuring. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 32 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index c4fafebbe3..47346adb88 100644 --- a/target

[PATCH 18/24] target/ppc/mmu_common.c: Make get_physical_address_wtlb() static

2024-04-23 Thread BALATON Zoltan
This function is not used from any other files so make it static and fix the maybe used uninitialised warnings this has uncovered. Signed-off-by: BALATON Zoltan --- target/ppc/internal.h | 5 + target/ppc/mmu_common.c | 5 - 2 files changed, 5 insertions(+), 5 deletions(-) diff --git

[PATCH 20/24] target/ppc: Remove ppc_hash32_pp_prot() and reuse common function

2024-04-23 Thread BALATON Zoltan
The ppc_hash32_pp_prot() function in mmu-hash32.c is the same as pp_check() in mmu_common.c. Rename the latter to ppc_pte_prot() and merge with ppc_hash32_pp_prot() to remove duplicated code. Signed-off-by: BALATON Zoltan --- target/ppc/internal.h | 2 +- target/ppc/mmu-hash32.c | 47

[PATCH 23/24] target/ppc/mmu_common.c: Simplify ppc_booke_xlate()

2024-04-23 Thread BALATON Zoltan
Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 147 +++- 1 file changed, 56 insertions(+), 91 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index ce1cf5cb77..ad64ec1647 100644 --- a/target/ppc/mmu_common.c +++ b

[PATCH 16/24] target/ppc/mmu_common.c: Deindent ppc_jumbo_xlate()

2024-04-23 Thread BALATON Zoltan
Instead of putting a large block of code in an if, invert the condition and return early to be able to deindent the code block. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 319 1 file changed, 159 insertions(+), 160 deletions(-) diff

[PATCH 14/24] target/ppc/mmu_common.c: Simplify mmubooke206_get_physical_address()

2024-04-23 Thread BALATON Zoltan
This function is similar to mmubooke_get_physical_address() and can be simplified the same way. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 28 ++-- 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc

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

2024-04-23 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 --- target/ppc/mmu_common.c | 180 ++-- 1 file changed, 138 insertions(+), 42 deletions(-) diff --git a/target/ppc

[PATCH 12/24] target/ppc/mmu_common.c: Inline and remove check_physical()

2024-04-23 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 --- target/ppc/mmu_common.c | 26 +++--- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a

[PATCH 17/24] target/ppc/mmu_common.c: Replace hard coded constants in ppc_jumbo_xlate()

2024-04-23 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 --- target/ppc/mmu_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c i

[PATCH 09/24] target/ppc/mmu_common.c: Rename get_bat_6xx_tlb()

2024-04-23 Thread BALATON Zoltan
Rename to ppc6xx_tlb_get_bat() to match other similar names in the same file. 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/mmu_common.c index 47346adb88..1fbf5a1bb0 100644

[PATCH 03/24] target/ppc: Simplify syscall exception handlers

2024-04-23 Thread BALATON Zoltan
After previous changes the hypercall handling in 7xx and 74xx exception handlers can be folded into one if statement to simplify this code. Also add "unlikely" to mark the less frequently used branch for the compiler. Signed-off-by: BALATON Zoltan Reviewed-by: Harsh Prateek Bora ---

[PATCH 19/24] target/ppc: Move mmu_ctx_t definition to mmu_common.c

2024-04-23 Thread BALATON Zoltan
This type is only used within mmu_common.c. Move its definition from internal.h to there. Signed-off-by: BALATON Zoltan --- target/ppc/internal.h | 12 target/ppc/mmu_common.c | 11 +++ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/target/ppc/internal.h

[PATCH 10/24] target/ppc/mmu_common.c: Split out BookE cases before checking real mode

2024-04-23 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 --- target/ppc/mmu_common.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/target

[PATCH 07/24] target/ppc/mmu_common.c: Drop cases for unimplemented MPC8xx MMU

2024-04-23 Thread BALATON Zoltan
The default case will catch this and abort the same way and there is still a warning about it in ppc_tlb_invalidate_all() so drop these from mmu_common.c to simplify this code. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 9 - 1 file changed, 9 deletions(-) diff --git a

[PATCH 15/24] target/ppc/mmu_common.c: Fix misindented qemu_log_mask() calls

2024-04-23 Thread BALATON Zoltan
Fix several qemu_log_mask() calls that are misindented. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 42 - 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index 5cb550da7e

[PATCH 06/24] target/ppc/mmu_common.c: Simplify checking for real mode

2024-04-23 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 --- target/ppc/mmu_common.c | 6 -- 1

[PATCH 01/24] target/ppc: Fix gen_sc to use correct nip

2024-04-23 Thread BALATON Zoltan
is in the exception handlers. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- target/ppc/excp_helper.c | 43 ++-- target/ppc/translate.c | 6 ++ 2 files changed, 4 insertions(+), 45 deletions(-) diff --git a/target/ppc/excp_helper.c b/t

Re: [PATCH-for-9.1 05/21] target/m68k: Replace qemu_printf() by monitor_printf() in monitor

2024-04-24 Thread BALATON Zoltan
mentioned above may be renaming monitor_puts to something that tells it's a low level function (and add a momitor_puts that behaves as expected) but I can't come up with a name either. Maybe the low level function could be called hmp_putt? Or add a comment near monitor_puts to explain this for now. Regards, BALATON Zoltan

Re: [PATCH-for-9.1 05/21] target/m68k: Replace qemu_printf() by monitor_printf() in monitor

2024-04-24 Thread BALATON Zoltan
On Wed, 24 Apr 2024, BALATON Zoltan wrote: On Wed, 24 Apr 2024, Markus Armbruster wrote: Philippe Mathieu-Daudé writes: Replace qemu_printf() by monitor_printf() / monitor_puts() in monitor. Why? Here's my attempt at an answer: because this runs only within HMP command "info tl

Re: [PATCH v2 1/2] net: Provide MemReentrancyGuard * to qemu_new_nic()

2024-04-26 Thread BALATON Zoltan
' It seems to actually be commit a2e1753b8054344f32cf94f31c6399a58794a380 Regards, BALATON Zoltan

[PATCH v2 03/28] target/ppc: Simplify syscall exception handlers

2024-05-01 Thread BALATON Zoltan
After previous changes the hypercall handling in 7xx and 74xx exception handlers can be folded into one if statement to simplify this code. Also add "unlikely" to mark the less frequently used branch for the compiler. Signed-off-by: BALATON Zoltan Reviewed-by: Harsh Prateek Bora ---

[PATCH v2 12/28] target/ppc/mmu_common.c: Split out BookE cases before checking real mode

2024-05-01 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 --- target/ppc/mmu_common.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/target

[PATCH v2 21/28] target/ppc: Move mmu_ctx_t definition to mmu_common.c

2024-05-01 Thread BALATON Zoltan
This type is only used within mmu_common.c. Move its definition from internal.h to there. Signed-off-by: BALATON Zoltan --- target/ppc/internal.h | 12 target/ppc/mmu_common.c | 11 +++ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/target/ppc/internal.h

[PATCH v2 22/28] target/ppc: Remove ppc_hash32_pp_prot() and reuse common function

2024-05-01 Thread BALATON Zoltan
The ppc_hash32_pp_prot() function in mmu-hash32.c is the same as pp_check() in mmu_common.c. Rename the latter to ppc_pte_prot() and merge with ppc_hash32_pp_prot() to remove duplicated code. Signed-off-by: BALATON Zoltan --- target/ppc/internal.h | 2 +- target/ppc/mmu-hash32.c | 47

[PATCH v2 20/28] target/ppc/mmu_common.c: Make get_physical_address_wtlb() static

2024-05-01 Thread BALATON Zoltan
This function is not used from any other files so make it static and fix the maybe used uninitialised warnings this has uncovered. Signed-off-by: BALATON Zoltan --- target/ppc/internal.h | 5 + target/ppc/mmu_common.c | 5 - 2 files changed, 5 insertions(+), 5 deletions(-) diff --git

[PATCH v2 25/28] target/ppc/mmu_common.c: Simplify ppc_booke_xlate()

2024-05-01 Thread BALATON Zoltan
Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 147 +++- 1 file changed, 56 insertions(+), 91 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index d61c41d8c9..b76611da80 100644 --- a/target/ppc/mmu_common.c +++ b

[PATCH v2 09/28] target/ppc/mmu_common.c: Drop cases for unimplemented MPC8xx MMU

2024-05-01 Thread BALATON Zoltan
The default case will catch this and abort the same way and there is still a warning about it in ppc_tlb_invalidate_all() so drop these from mmu_common.c to simplify this code. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 9 - 1 file changed, 9 deletions(-) diff --git a

[PATCH v2 23/28] target/ppc/mmu_common.c: Split off BookE handling from ppc_jumbo_xlate()

2024-05-01 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 --- target/ppc/mmu_common.c | 180 ++-- 1 file changed, 138 insertions(+), 42 deletions(-) diff --git a/target/ppc

[PATCH v2 00/28] Misc PPC exception and BookE MMU clean ups

2024-05-01 Thread BALATON Zoltan
since tha last series. Please review. 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 BALATON Zoltan (28): target/ppc: Fix gen_sc to use correct nip target/ppc: Move patching nip from exception handle

[PATCH v2 15/28] target/ppc/mmu_common.c: Simplify mmubooke_get_physical_address()

2024-05-01 Thread BALATON Zoltan
Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 25 + 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index fab86a8f3e..760e4072b2 100644 --- a/target/ppc/mmu_common.c +++ b/target/ppc

[PATCH v2 06/28] target/ppc/mmu_common.c: Move calculation of a value closer to its usage

2024-05-01 Thread BALATON Zoltan
In mmubooke206_check_tlb() prot2 is calculated first but only used after an unrelated check that can return before tha value is used. Move the calculation after the check, closer to where it is used, to keep them together and avoid computing it when not needed. Signed-off-by: BALATON Zoltan

[PATCH v2 08/28] target/ppc/mmu_common.c: Simplify checking for real mode

2024-05-01 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 --- target/ppc/mmu_common.c | 6 -- 1

[PATCH v2 14/28] target/ppc/mmu_common.c: Inline and remove check_physical()

2024-05-01 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 --- target/ppc/mmu_common.c | 26 +++--- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a

[PATCH v2 27/28] target/ppc: Remove id_tlbs flag from CPU env

2024-05-01 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 --- hw/ppc/pegasos2.c| 2 +- target/ppc/cpu.h | 1 - target/ppc/cpu_init.c| 19

[PATCH v2 16/28] target/ppc/mmu_common.c: Simplify mmubooke206_get_physical_address()

2024-05-01 Thread BALATON Zoltan
This function is similar to mmubooke_get_physical_address() and can be simplified the same way. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 28 ++-- 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc

[PATCH v2 13/28] target/ppc/mmu_common.c: Split off real mode cases in get_physical_address_wtlb()

2024-05-01 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 --- target/ppc/mmu_common.c | 34

[PATCH v2 02/28] target/ppc: Move patching nip from exception handler to helper_scv

2024-05-01 Thread BALATON Zoltan
ge it. [balaton: added commit message] Signed-off-by: BALATON Zoltan --- target/ppc/excp_helper.c | 2 +- target/ppc/translate.c | 6 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 92fe535815..5aa84bccd2 100644 --- a/t

[PATCH v2 17/28] target/ppc/mmu_common.c: Fix misindented qemu_log_mask() calls

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

[PATCH v2 24/28] target/ppc/mmu_common.c: Remove BookE handling from get_physical_address_wtlb()

2024-05-01 Thread BALATON Zoltan
This function is no longer called for BookE MMU model so remove parts related to it. This has uncovered a few may be used uninitialised warnings that are also fixed. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 25 + 1 file changed, 5 insertions(+), 20

[PATCH v2 11/28] target/ppc/mmu_common.c: Rename get_bat_6xx_tlb()

2024-05-01 Thread BALATON Zoltan
Rename to ppc6xx_tlb_get_bat() to match other similar names in the same file. 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/mmu_common.c index ef1669b01d..a069e4083f 100644

[PATCH v2 19/28] target/ppc/mmu_common.c: Replace hard coded constants in ppc_jumbo_xlate()

2024-05-01 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 --- target/ppc/mmu_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c i

[PATCH v2 05/28] target/ppc/mmu_common.c: Move calculation of a value closer to its usage

2024-05-01 Thread BALATON Zoltan
In mmubooke_check_tlb() prot2 is calculated first but only used after an unrelated check that can return before tha value is used. Move the calculation after the check, closer to where it is used, to keep them together and avoid computing it when not needed. Signed-off-by: BALATON Zoltan

[PATCH v2 04/28] target/ppc: Remove unused helper

2024-05-01 Thread BALATON Zoltan
The helper_rac function is defined but not used, remove it. Fixes: 005b69fdcc (target/ppc: Remove PowerPC 601 CPUs) Signed-off-by: BALATON Zoltan --- target/ppc/helper.h | 2 -- target/ppc/mmu_helper.c | 24 2 files changed, 26 deletions(-) diff --git a/target/ppc

[PATCH v2 07/28] target/ppc/mmu_common.c: Remove unneeded local variable

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

[PATCH v2 28/28] target/ppc: Split off common 4xx TLB init

2024-05-01 Thread BALATON Zoltan
Several 4xx related CPUs have the same TLB settings. Split it off in a common function in cpu_init. Signed-off-by: BALATON Zoltan --- target/ppc/cpu_init.c | 46 --- 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/target/ppc/cpu_init.c b

[PATCH v2 10/28] target/ppc/mmu_common.c: Introduce mmu6xx_get_physical_address()

2024-05-01 Thread BALATON Zoltan
caller allowing further restructuring. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 32 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index 98730035b1..ef1669b01d 100644 --- a/target

[PATCH v2 18/28] target/ppc/mmu_common.c: Deindent ppc_jumbo_xlate()

2024-05-01 Thread BALATON Zoltan
Instead of putting a large block of code in an if, invert the condition and return early to be able to deindent the code block. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 319 1 file changed, 159 insertions(+), 160 deletions(-) diff

[PATCH v2 26/28] target/ppc/mmu_common.c: Move BookE MMU functions together

2024-05-01 Thread BALATON Zoltan
Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 300 1 file changed, 150 insertions(+), 150 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index b76611da80..204b8af455 100644 --- a/target/ppc/mmu_common.c +++ b

[PATCH v2 01/28] target/ppc: Fix gen_sc to use correct nip

2024-05-01 Thread BALATON Zoltan
is in the exception handlers. Signed-off-by: BALATON Zoltan --- target/ppc/excp_helper.c | 43 ++-- target/ppc/translate.c | 15 ++ 2 files changed, 8 insertions(+), 50 deletions(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c

[PATCH] include/exec/cpu-common.h: Rename PAGE_BITS macro to PAGE_RWX

2024-05-05 Thread BALATON Zoltan
This macro can be used to abbreviate PAGE_READ | PAGE_WRITE | PAGE_EXEC for which PAGE_RWX is a better name and renaming it also shows it is not related to TARGET_PAGE_BITS. Signed-off-by: BALATON Zoltan --- accel/tcg/user-exec.c | 2 +- bsd-user/mmap.c| 6 +++--- include/exec

Re: [PATCH 6/7] target/ppc: Remove unused struct 'mmu_ctx_hash32'

2024-05-05 Thread BALATON Zoltan
On Sun, 5 May 2024, Dr. David Alan Gilbert wrote: I think it's use was removed by Commit 5883d8b296 ("mmu-hash*: Don't use full ppc_hash{32, 64}_translate() path for get_phys_page_debug()") Signed-off-by: Dr. David Alan Gilbert Reviewed-by: BALATON Zoltan --- target/

Re: [PATCH v2 26/28] target/ppc/mmu_common.c: Move BookE MMU functions together

2024-05-07 Thread BALATON Zoltan
not sure I got some of your requests so that may need another round. Regards, BALATON Zoltan

Re: [PATCH v2 00/28] Misc PPC exception and BookE MMU clean ups

2024-05-07 Thread BALATON Zoltan
On Tue, 7 May 2024, Nicholas Piggin wrote: On Thu May 2, 2024 at 9:43 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 on this. The fi

Re: [PATCH v2 20/28] target/ppc/mmu_common.c: Make get_physical_address_wtlb() static

2024-05-07 Thread BALATON Zoltan
On Tue, 7 May 2024, Nicholas Piggin wrote: On Thu May 2, 2024 at 9:43 AM AEST, BALATON Zoltan wrote: This function is not used from any other files so make it static and fix the maybe used uninitialised warnings this has uncovered. Signed-off-by: BALATON Zoltan --- target/ppc/internal.h

Re: [PATCH v2 26/28] target/ppc/mmu_common.c: Move BookE MMU functions together

2024-05-07 Thread BALATON Zoltan
ninit warnings but I'm not sure it would. Regards, BALATON Zoltan

Re: [PATCH v2 27/28] target/ppc: Remove id_tlbs flag from CPU env

2024-05-07 Thread BALATON Zoltan
On Tue, 7 May 2024, Nicholas Piggin wrote: On Thu May 2, 2024 at 9:43 AM AEST, BALATON Zoltan wrote: 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 --- hw/ppc

Re: [PATCH v2 24/28] target/ppc/mmu_common.c: Remove BookE handling from get_physical_address_wtlb()

2024-05-07 Thread BALATON Zoltan
On Tue, 7 May 2024, Nicholas Piggin wrote: On Thu May 2, 2024 at 9:43 AM AEST, BALATON Zoltan wrote: This function is no longer called for BookE MMU model so remove parts related to it. This has uncovered a few may be used uninitialised warnings that are also fixed. Signed-off-by: BALATON

[PATCH v3 05/33] target/ppc/mmu_common.c: Move calculation of a value closer to its usage

2024-05-07 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 v3 00/33] Misc PPC exception and BookE MMU clean ups

2024-05-07 Thread BALATON Zoltan
e for easier review. v3: - Address review comments from Nick - Rebase on master - Squashed some patches together - 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, BALA

[PATCH v3 01/33] target/ppc: Fix gen_sc to use correct nip

2024-05-07 Thread BALATON Zoltan
is in the exception handlers. Signed-off-by: BALATON Zoltan --- target/ppc/excp_helper.c | 43 ++-- target/ppc/translate.c | 15 ++ 2 files changed, 8 insertions(+), 50 deletions(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c

[PATCH v3 07/33] target/ppc/mmu_common.c: Simplify checking for real mode

2024-05-07 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 v3 02/33] target/ppc: Move patching nip from exception handler to helper_scv

2024-05-07 Thread BALATON Zoltan
ge it. [balaton: added commit message] Signed-off-by: BALATON Zoltan --- target/ppc/excp_helper.c | 2 +- target/ppc/translate.c | 6 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 92fe535815..5aa84bccd2 100644 --- a/t

[PATCH v3 03/33] target/ppc: Simplify syscall exception handlers

2024-05-07 Thread BALATON Zoltan
After previous changes the hypercall handling in 7xx and 74xx exception handlers can be folded into one if statement to simplify this code. Also add "unlikely" to mark the less frequently used branch for the compiler. Signed-off-by: BALATON Zoltan Reviewed-by: Harsh Prateek Bora ---

[PATCH v3 08/33] target/ppc/mmu_common.c: Drop cases for unimplemented MPC8xx MMU

2024-05-07 Thread BALATON Zoltan
The default case will catch this and abort the same way and there is still a warning about it in ppc_tlb_invalidate_all() so drop these from mmu_common.c to simplify this code. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- target/ppc/mmu_common.c | 9 - 1 file changed

[PATCH v3 11/33] target/ppc/mmu_common.c: Move some debug logging

2024-05-07 Thread BALATON Zoltan
Move the debug logging within ppc6xx_tlb_check() from after its only call to simplify the caller. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 55 +++-- 1 file changed, 26 insertions(+), 29 deletions(-) diff --git a/target/ppc/mmu_common.c b

[PATCH v3 04/33] target/ppc: Remove unused helper

2024-05-07 Thread BALATON Zoltan
The helper_rac function is defined but not used, remove it. Fixes: 005b69fdcc (target/ppc: Remove PowerPC 601 CPUs) Signed-off-by: BALATON Zoltan Reviwed-by: Nicholas Piggin --- target/ppc/helper.h | 2 -- target/ppc/mmu_helper.c | 24 2 files changed, 26

[PATCH v3 26/33] target/ppc/mmu_common.c: Simplify ppc_booke_xlate() part 1

2024-05-07 Thread BALATON Zoltan
Move setting error_code that appears in every case out in front and hoist the common fall through case for BOOKE206 as well which allows removing the nested switches. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 41 - 1 file changed, 12

[PATCH v3 24/33] target/ppc/mmu_common.c: Split off BookE handling from ppc_jumbo_xlate()

2024-05-07 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 --- target/ppc/mmu_common.c | 128 +--- 1 file changed, 92 insertions(+), 36 deletions(-) diff --git a/target/ppc/mmu_common.c

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

2024-05-07 Thread BALATON Zoltan
The value is only used once so no need to introduce a local variable for it. Signed-off-by: BALATON Zoltan --- 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 index 8daf71d2db..395ce3b782

[PATCH v3 20/33] target/ppc/mmu_common.c: Replace hard coded constants in ppc_jumbo_xlate()

2024-05-07 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

[PATCH v3 14/33] target/ppc/mmu_common.c: Split off real mode cases in get_physical_address_wtlb()

2024-05-07 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 v3 22/33] target/ppc: Remove pp_check() and reuse ppc_hash32_pp_prot()

2024-05-07 Thread BALATON Zoltan
slightly lower performance. Signed-off-by: BALATON Zoltan --- target/ppc/internal.h | 35 target/ppc/mmu-hash32.c | 45 - target/ppc/mmu_common.c | 44 ++-- 3 files changed, 37 insertions

[PATCH v3 28/33] target/ppc/mmu_common.c: Move BookE MMU functions together

2024-05-07 Thread BALATON Zoltan
Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 226 1 file changed, 113 insertions(+), 113 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index 04e5ad661d..a6e7b64049 100644 --- a/target/ppc/mmu_common.c +++ b

[PATCH v3 09/33] target/ppc/mmu_common.c: Introduce mmu6xx_get_physical_address()

2024-05-07 Thread BALATON Zoltan
caller allowing further restructuring. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 26 -- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index aa137123a4..181273579b 100644 --- a/target/ppc

[PATCH v3 18/33] target/ppc/mmu_common.c: Fix misindented qemu_log_mask() calls

2024-05-07 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 v3 19/33] target/ppc/mmu_common.c: Deindent ppc_jumbo_xlate()

2024-05-07 Thread BALATON Zoltan
Instead of putting a large block of code in an if, invert the condition and return early to be able to deindent the code block. Signed-off-by: BALATON Zoltan Acked-by: Nicholas Piggin --- target/ppc/mmu_common.c | 319 1 file changed, 159 insertions

[PATCH v3 06/33] target/ppc/mmu_common.c: Remove unneeded local variable

2024-05-07 Thread BALATON Zoltan
In mmubooke_check_tlb() and mmubooke206_check_tlb() we can assign the value directly the 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 changed

[PATCH v3 15/33] target/ppc/mmu_common.c: Inline and remove check_physical()

2024-05-07 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 v3 16/33] target/ppc/mmu_common.c: Simplify mmubooke_get_physical_address()

2024-05-07 Thread BALATON Zoltan
Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- target/ppc/mmu_common.c | 25 + 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index 7283eafe27..9793e6d282 100644 --- a/target/ppc

[PATCH v3 23/33] target/ppc/mmu_common.c: Remove BookE from direct store handling

2024-05-07 Thread BALATON Zoltan
As BookE never returns -4 we can drop BookE from the direct store case in ppc_jumbo_xlate(). Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index 87cac12d68

[PATCH v3 27/33] target/ppc/mmu_common.c: Simplify ppc_booke_xlate() part 2

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

[PATCH v3 12/33] target/ppc/mmu_common.c: Eliminate ret from mmu6xx_get_physical_address()

2024-05-07 Thread BALATON Zoltan
Return directly, which is simpler than dragging a return value through multpile if and else blocks. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 84 +++-- 1 file changed, 39 insertions(+), 45 deletions(-) diff --git a/target/ppc/mmu_common.c b

[PATCH v3 21/33] target/ppc/mmu_common.c: Make get_physical_address_wtlb() static

2024-05-07 Thread BALATON Zoltan
This function is not used from any other files so make it static and fix the maybe used uninitialised warnings this has uncovered. Also remove mmu_ctx_t definition from internal.h as this type is only used within this file. Signed-off-by: BALATON Zoltan --- target/ppc/internal.h | 17

[PATCH v3 30/33] target/ppc: Split off common embedded TLB init

2024-05-07 Thread BALATON Zoltan
Several 4xx CPUs and e200 share the same TLB settings enclosed in an ifdef. Split it off in a common function to reduce code duplication and the number of ifdefs. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- target/ppc/cpu_init.c | 46

[PATCH v3 10/33] target/ppc/mmu_common.c: Move else branch to avoid large if block

2024-05-07 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 --- target/ppc/mmu_common.c | 71

[PATCH v3 17/33] target/ppc/mmu_common.c: Simplify mmubooke206_get_physical_address()

2024-05-07 Thread BALATON Zoltan
This function is similar to mmubooke_get_physical_address() and can be simplified the same way. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- target/ppc/mmu_common.c | 26 +- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/target/ppc

[PATCH v3 13/33] target/ppc/mmu_common.c: Split out BookE cases before checking real mode

2024-05-07 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 v3 33/33] target/ppc: Add a macro to check for page protection bit

2024-05-07 Thread BALATON Zoltan
that this assumption holds. Signed-off-by: BALATON Zoltan --- target/ppc/cpu_init.c| 4 target/ppc/internal.h| 20 ++-- target/ppc/mmu-hash32.c | 6 +++--- target/ppc/mmu-hash64.c | 2 +- target/ppc/mmu-radix64.c | 2 +- target/ppc/mmu_common.c | 26

[PATCH v3 25/33] target/ppc/mmu_common.c: Remove BookE handling from get_physical_address_wtlb()

2024-05-07 Thread BALATON Zoltan
This function is no longer called for BookE MMU model so remove parts related to it. This has uncovered a few may be used uninitialised warnings that are also fixed. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 25 + 1 file changed, 5 insertions(+), 20

[PATCH v3 29/33] target/ppc: Remove id_tlbs flag from CPU env

2024-05-07 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 | 1 - target/ppc

[PATCH v3 31/33] target/ppc/mmu-hash32.c: Drop a local variable

2024-05-07 Thread BALATON Zoltan
makes these checks using it similar to other places with such checks. Signed-off-by: BALATON Zoltan --- target/ppc/mmu-hash32.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/target/ppc/mmu-hash32.c b/target/ppc/mmu-hash32.c index 960751a50e..b5d7aeed4e 100644 --- a

Re: [PATCH v3 01/33] target/ppc: Fix gen_sc to use correct nip

2024-05-08 Thread BALATON Zoltan
On Wed, 8 May 2024, Nicholas Piggin wrote: On Wed May 8, 2024 at 10:14 AM AEST, BALATON Zoltan wrote: Most exceptions are raised with nip pointing to the faulting instruction but the sc instruction generating a syscall exception leaves nip pointing to next instruction. Fix gen_sc to not use

<    1   2   3   4   5   6   7   8   9   10   >