qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Cc: qemu-s390x@nongnu.org, Cornelia Huck <cohuck@redhat.com>,
	Thomas Huth <thuth@redhat.com>
Subject: Re: [PATCH v5 1/2] target/s390x: Implement the MVPG condition-code-option bit
Date: Thu, 11 Mar 2021 19:16:25 +0100	[thread overview]
Message-ID: <5b929a10-4561-d596-b43b-33ca4022ea54@redhat.com> (raw)
In-Reply-To: <39285cf8-2214-2257-679d-231e0c6a0652@linaro.org>

On 11.03.21 18:52, Richard Henderson wrote:
> On 3/11/21 10:17 AM, David Hildenbrand wrote:
>> +#if !defined(CONFIG_USER_ONLY)
>> +    /*
>> +     * For !CONFIG_USER_ONLY, we cannot rely on TLB_INVALID_MASK or haddr==NULL
>> +     * to detect if there was an exception during tlb_fill().
>> +     */
>> +    env->tlb_fill_exc = 0;
>> +#endif
>> +    flags = probe_access_flags(env, vaddr1, access_type, mmu_idx,
>> +                               nofault, &haddr1, ra);
>> +#if !defined(CONFIG_USER_ONLY)
>> +    if (env->tlb_fill_exc) {
>> +        return env->tlb_fill_exc;
>> +    }
>> +#else
>> +    if (!haddr1) {
>> +        env->__excp_addr = vaddr1;
>> +        return PGM_ADDRESSING;
>> +    }
>> +#endif
> 
> The assumption of PGM_ADDRESSING is incorrect here -- it could still be
> PGM_PROTECTION, depending on how the page is mapped.
> 

Interesting, I was only looking at the s390x tlb_fill() implementation. 
But I assume these checks are performed in common code.

> I guess this should be done like
> 
> #ifdef CONFIG_USER_ONLY
>       flags = page_get_flags(vaddr1);
>       if (!flags & (access_type == MMU_DATA_LOAD
>                     ? PAGE_READ : PAGE_WRITE)) {
>           env->__excp_addr = vaddr1;
>           if (nofault) {
>               return (flags & PAGE_VALID
>                   ? PGM_PROTECTION : PGM_ADDRESSING);
>           }
>           raise exception.
>       }
>       haddr1 = g2h(vaddr1);
> #else
>       env->tlb_fill_exc = 0;
>       flags = probe_access_flags(...);
>       if (env->tlb_fill_exc) {
>           return env->tlb_fill_exc;
>       }
> #endif
> 
> which is pretty ugly, but no worse than what you have above.

Thanks, maybe I can factor that out in a nice way. I guess we could do 
the access via probe_access_flags() and only on error do the 
page_get_flags()?


-- 
Thanks,

David / dhildenb



  reply	other threads:[~2021-03-11 18:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-11 16:17 [PATCH v5 0/2] target/s390x: Implement the MVPG condition-code-option bit David Hildenbrand
2021-03-11 16:17 ` [PATCH v5 1/2] " David Hildenbrand
2021-03-11 17:02   ` Richard Henderson
2021-03-11 17:12     ` David Hildenbrand
2021-03-11 17:26       ` Richard Henderson
2021-03-11 17:52   ` Richard Henderson
2021-03-11 18:16     ` David Hildenbrand [this message]
2021-03-11 18:24       ` Richard Henderson
2021-03-11 16:17 ` [PATCH v5 2/2] target/s390x: Store r1/r2 for page-translation exceptions during MVPG David Hildenbrand
2021-03-11 16:26   ` David Hildenbrand

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=5b929a10-4561-d596-b43b-33ca4022ea54@redhat.com \
    --to=david@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.com \
    /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).