From: Peter Maydell <peter.maydell@linaro.org>
To: Sergey Sorokin <afarallax@yandex.ru>
Cc: QEMU Developers <qemu-devel@nongnu.org>, qemu-arm <qemu-arm@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v2] target-arm: Fix descriptor address masking in ARM address translation
Date: Wed, 4 May 2016 17:59:10 +0100 [thread overview]
Message-ID: <CAFEAcA-jZ3OfSNE7mkHSBY+19oiFP9uO4u3tuX_rrpQhvxaPsw@mail.gmail.com> (raw)
In-Reply-To: <1460996853-22117-1-git-send-email-afarallax@yandex.ru>
On 18 April 2016 at 17:27, Sergey Sorokin <afarallax@yandex.ru> wrote:
> There is a bug in ARM address translation regime with a long-descriptor
> format. On the descriptor reading its address is formed from an index
> which is a part of the input address. And on the first iteration this index
> is incorrectly masked with 'grainsize' mask. But it can be wider according
> to pseudo-code.
> On the other hand on the iterations other than first the descriptor address
> is formed from the previous level descriptor by masking with 'descaddrmask'
> value. It always clears just 12 lower bits, but it must clear 'grainsize'
> lower bits instead according to pseudo-code.
> The patch fixes both cases.
>
> Signed-off-by: Sergey Sorokin <afarallax@yandex.ru>
> /* The address field in the descriptor goes up to bit 39 for ARMv7
> - * but up to bit 47 for ARMv8.
> + * but up to bit 47 for ARMv8, but we use the descaddrmask
> + * up to bit 39 for AArch32, because we don't need other bits in that case
> + * to construct next descriptor address (anyway they should be all zeroes).
> */
> - if (arm_feature(env, ARM_FEATURE_V8)) {
> - descaddrmask = 0xfffffffff000ULL;
> - } else {
> - descaddrmask = 0xfffffff000ULL;
> - }
> + descaddrmask = ((1ull << (va_size == 64 ? 48 : 40)) - 1) &
> + ~indexmask_grainsize;
I still think we are going to end up wanting to revert the
"look at va_size rather than ARM_FEATURE_V8" part of this when
we come to implement AddressSize faults, but let's get this
bug fix in for now rather than continuing to argue about it.
Applied to target-arm.next, thanks.
-- PMM
prev parent reply other threads:[~2016-05-04 17:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-18 16:27 [Qemu-devel] [PATCH v2] target-arm: Fix descriptor address masking in ARM address translation Sergey Sorokin
2016-05-04 16:59 ` Peter Maydell [this message]
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=CAFEAcA-jZ3OfSNE7mkHSBY+19oiFP9uO4u3tuX_rrpQhvxaPsw@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=afarallax@yandex.ru \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@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).