From: "Nicholas Piggin" <npiggin@gmail.com>
To: "BALATON Zoltan" <balaton@eik.bme.hu>
Cc: <qemu-devel@nongnu.org>, <qemu-ppc@nongnu.org>,
"Daniel Henrique Barboza" <danielhb413@gmail.com>
Subject: Re: [PATCH v2 24/28] target/ppc/mmu_common.c: Remove BookE handling from get_physical_address_wtlb()
Date: Wed, 08 May 2024 22:54:47 +1000 [thread overview]
Message-ID: <D14A1N415IER.161PBQJVFBY8L@gmail.com> (raw)
In-Reply-To: <alpine.LMD.2.03.2405080129400.14319@eik.bme.hu>
On Wed May 8, 2024 at 9:40 AM AEST, BALATON Zoltan wrote:
> 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 Zoltan <balaton@eik.bme.hu>
> >> ---
> >> target/ppc/mmu_common.c | 25 +++++--------------------
> >> 1 file changed, 5 insertions(+), 20 deletions(-)
> >>
> >> diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c
> >> index a1f98f8de4..d61c41d8c9 100644
> >> --- a/target/ppc/mmu_common.c
> >> +++ b/target/ppc/mmu_common.c
> >> @@ -684,12 +684,10 @@ static int mmubooke_get_physical_address(CPUPPCState *env, mmu_ctx_t *ctx,
> >> ret = mmubooke_check_tlb(env, tlb, &raddr, &ctx->prot, address,
> >> access_type, i);
> >> if (ret != -1) {
> >> - if (ret >= 0) {
> >> - ctx->raddr = raddr;
> >> - }
> >> break;
> >> }
> >> }
> >> + ctx->raddr = raddr;
> >> qemu_log_mask(CPU_LOG_MMU,
> >> "%s: access %s " TARGET_FMT_lx " => " HWADDR_FMT_plx
> >> " %d %d\n", __func__, ret < 0 ? "refused" : "granted",
> >> @@ -897,9 +895,6 @@ static int mmubooke206_get_physical_address(CPUPPCState *env, mmu_ctx_t *ctx,
> >> ret = mmubooke206_check_tlb(env, tlb, &raddr, &ctx->prot, address,
> >> access_type, mmu_idx);
> >> if (ret != -1) {
> >> - if (ret >= 0) {
> >> - ctx->raddr = raddr;
> >> - }
> >> goto found_tlb;
> >> }
> >> }
> >> @@ -907,6 +902,7 @@ static int mmubooke206_get_physical_address(CPUPPCState *env, mmu_ctx_t *ctx,
> >>
> >> found_tlb:
> >>
> >> + ctx->raddr = raddr;
> >
> > Not sure about the uninitialized warnings here either, caller probably
> > should not be using ctx->raddr unless we returned 0...
> >
> >> qemu_log_mask(CPU_LOG_MMU, "%s: access %s " TARGET_FMT_lx " => "
> >> HWADDR_FMT_plx " %d %d\n", __func__,
> >> ret < 0 ? "refused" : "granted", address, raddr,
> >> @@ -1163,20 +1159,9 @@ static int get_physical_address_wtlb(CPUPPCState *env, mmu_ctx_t *ctx,
> >> MMUAccessType access_type, int type,
> >> int mmu_idx)
> >> {
> >> - bool real_mode;
> >> -
> >> - if (env->mmu_model == POWERPC_MMU_BOOKE) {
> >> - return mmubooke_get_physical_address(env, ctx, eaddr, access_type);
> >> - } else if (env->mmu_model == POWERPC_MMU_BOOKE206) {
> >> - return mmubooke206_get_physical_address(env, ctx, eaddr, access_type,
> >> - mmu_idx);
> >> - }
> >
> > This could just go in the previous patch when you split booke xlate?
>
> Removing this uncovers the warnings so I keep it here to separate it from
> the previous change. I gave up on trying to resolve these warnings and
> untangle the embedded functions from mmu_ctx_t which would be needed to
> move these booke functions out from this file. The other problem is that
> these booke get_physical_address functions and mmu40x_get_physical_address
> all use ppcemb_tlb_check which then needs to be in the same file and
> static to be inlined and not run too slow but 40x is still in jumbo_xlate
> so I just leave it for now and may return to it later or let somebody else
> continue from here. I think this series moves forward enough for now and I
> don't have more time now.
If you can't easily drop the path or solve the problem okay, just put
a comment or something on the zeroing and I'll take a closer look
when I merge.
>
> >> -
> >> - real_mode = (type == ACCESS_CODE) ? !FIELD_EX64(env->msr, MSR, IR)
> >> - : !FIELD_EX64(env->msr, MSR, DR);
> >> - if (real_mode && (env->mmu_model == POWERPC_MMU_SOFT_6xx ||
> >> - env->mmu_model == POWERPC_MMU_SOFT_4xx ||
> >> - env->mmu_model == POWERPC_MMU_REAL)) {
> >> + bool real_mode = (type == ACCESS_CODE) ? !FIELD_EX64(env->msr, MSR, IR)
> >> + : !FIELD_EX64(env->msr, MSR, DR);
> >> + if (real_mode) {
> >> memset(ctx, 0, sizeof(*ctx));
> >> ctx->raddr = eaddr;
> >> ctx->prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
> >
> > This still changes beahviour of MPC8xx MMU doesn't it? It's supposed
> > to abort always.
>
> I don't think it can get here because there's still an abort case in
> ppc_tlb_invalidate_all() which is called from ppc_cpu_reset_hold() so it
> will likely crash before it could call anything here. But if you think
> it's necessary I could add a case for it in ppc_xlate() maybe.
I would rather not change it here. You can remove it with another patch.
Thanks,
Nick
next prev parent reply other threads:[~2024-05-08 12:55 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-01 23:43 [PATCH v2 00/28] Misc PPC exception and BookE MMU clean ups BALATON Zoltan
2024-05-01 23:43 ` [PATCH v2 01/28] target/ppc: Fix gen_sc to use correct nip BALATON Zoltan
2024-05-01 23:43 ` [PATCH v2 02/28] target/ppc: Move patching nip from exception handler to helper_scv BALATON Zoltan
2024-05-01 23:43 ` [PATCH v2 03/28] target/ppc: Simplify syscall exception handlers BALATON Zoltan
2024-05-01 23:43 ` [PATCH v2 04/28] target/ppc: Remove unused helper BALATON Zoltan
2024-05-07 9:18 ` Nicholas Piggin
2024-05-01 23:43 ` [PATCH v2 05/28] target/ppc/mmu_common.c: Move calculation of a value closer to its usage BALATON Zoltan
2024-05-07 9:19 ` Nicholas Piggin
2024-05-01 23:43 ` [PATCH v2 06/28] " BALATON Zoltan
2024-05-07 9:20 ` Nicholas Piggin
2024-05-01 23:43 ` [PATCH v2 07/28] target/ppc/mmu_common.c: Remove unneeded local variable BALATON Zoltan
2024-05-07 9:30 ` Nicholas Piggin
2024-05-01 23:43 ` [PATCH v2 08/28] target/ppc/mmu_common.c: Simplify checking for real mode BALATON Zoltan
2024-05-07 9:34 ` Nicholas Piggin
2024-05-01 23:43 ` [PATCH v2 09/28] target/ppc/mmu_common.c: Drop cases for unimplemented MPC8xx MMU BALATON Zoltan
2024-05-07 9:36 ` Nicholas Piggin
2024-05-01 23:43 ` [PATCH v2 10/28] target/ppc/mmu_common.c: Introduce mmu6xx_get_physical_address() BALATON Zoltan
2024-05-07 9:42 ` Nicholas Piggin
2024-05-01 23:43 ` [PATCH v2 11/28] target/ppc/mmu_common.c: Rename get_bat_6xx_tlb() BALATON Zoltan
2024-05-07 9:43 ` Nicholas Piggin
2024-05-01 23:43 ` [PATCH v2 12/28] target/ppc/mmu_common.c: Split out BookE cases before checking real mode BALATON Zoltan
2024-05-07 9:50 ` Nicholas Piggin
2024-05-01 23:43 ` [PATCH v2 13/28] target/ppc/mmu_common.c: Split off real mode cases in get_physical_address_wtlb() BALATON Zoltan
2024-05-07 9:58 ` Nicholas Piggin
2024-05-01 23:43 ` [PATCH v2 14/28] target/ppc/mmu_common.c: Inline and remove check_physical() BALATON Zoltan
2024-05-07 10:00 ` Nicholas Piggin
2024-05-01 23:43 ` [PATCH v2 15/28] target/ppc/mmu_common.c: Simplify mmubooke_get_physical_address() BALATON Zoltan
2024-05-07 10:03 ` Nicholas Piggin
2024-05-01 23:43 ` [PATCH v2 16/28] target/ppc/mmu_common.c: Simplify mmubooke206_get_physical_address() BALATON Zoltan
2024-05-07 10:04 ` Nicholas Piggin
2024-05-01 23:43 ` [PATCH v2 17/28] target/ppc/mmu_common.c: Fix misindented qemu_log_mask() calls BALATON Zoltan
2024-05-07 10:05 ` Nicholas Piggin
2024-05-01 23:43 ` [PATCH v2 18/28] target/ppc/mmu_common.c: Deindent ppc_jumbo_xlate() BALATON Zoltan
2024-05-07 10:06 ` Nicholas Piggin
2024-05-01 23:43 ` [PATCH v2 19/28] target/ppc/mmu_common.c: Replace hard coded constants in ppc_jumbo_xlate() BALATON Zoltan
2024-05-07 10:11 ` Nicholas Piggin
2024-05-01 23:43 ` [PATCH v2 20/28] target/ppc/mmu_common.c: Make get_physical_address_wtlb() static BALATON Zoltan
2024-05-07 10:47 ` Nicholas Piggin
2024-05-07 15:31 ` BALATON Zoltan
2024-05-01 23:43 ` [PATCH v2 21/28] target/ppc: Move mmu_ctx_t definition to mmu_common.c BALATON Zoltan
2024-05-07 10:49 ` Nicholas Piggin
2024-05-01 23:43 ` [PATCH v2 22/28] target/ppc: Remove ppc_hash32_pp_prot() and reuse common function BALATON Zoltan
2024-05-07 11:35 ` Nicholas Piggin
2024-05-01 23:43 ` [PATCH v2 23/28] target/ppc/mmu_common.c: Split off BookE handling from ppc_jumbo_xlate() BALATON Zoltan
2024-05-07 11:51 ` Nicholas Piggin
2024-05-01 23:43 ` [PATCH v2 24/28] target/ppc/mmu_common.c: Remove BookE handling from get_physical_address_wtlb() BALATON Zoltan
2024-05-07 12:05 ` Nicholas Piggin
2024-05-07 23:40 ` BALATON Zoltan
2024-05-08 12:54 ` Nicholas Piggin [this message]
2024-05-01 23:43 ` [PATCH v2 25/28] target/ppc/mmu_common.c: Simplify ppc_booke_xlate() BALATON Zoltan
2024-05-07 12:15 ` Nicholas Piggin
2024-05-01 23:43 ` [PATCH v2 26/28] target/ppc/mmu_common.c: Move BookE MMU functions together BALATON Zoltan
2024-05-07 12:17 ` Nicholas Piggin
2024-05-07 12:31 ` BALATON Zoltan
2024-05-08 12:30 ` Nicholas Piggin
2024-05-08 23:33 ` BALATON Zoltan
2024-05-09 5:57 ` Nicholas Piggin
2024-05-07 15:54 ` BALATON Zoltan
2024-05-01 23:43 ` [PATCH v2 27/28] target/ppc: Remove id_tlbs flag from CPU env BALATON Zoltan
2024-05-07 12:30 ` Nicholas Piggin
2024-05-07 16:02 ` BALATON Zoltan
2024-05-08 12:37 ` Nicholas Piggin
2024-05-01 23:43 ` [PATCH v2 28/28] target/ppc: Split off common 4xx TLB init BALATON Zoltan
2024-05-07 12:40 ` Nicholas Piggin
2024-05-07 12:45 ` [PATCH v2 00/28] Misc PPC exception and BookE MMU clean ups Nicholas Piggin
2024-05-07 12:51 ` BALATON Zoltan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=D14A1N415IER.161PBQJVFBY8L@gmail.com \
--to=npiggin@gmail.com \
--cc=balaton@eik.bme.hu \
--cc=danielhb413@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).