All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Cc: qemu-devel@nongnu.org, peter.maydell@linaro.org,
	qemu-arm@nongnu.org, edgar.iglesias@xilinx.com
Subject: Re: [PATCH v1 3/3] target-arm: Implement the S2 MMU inputsize < pamax check
Date: Thu, 21 Jan 2016 12:52:54 +0000	[thread overview]
Message-ID: <877fj3ccwp.fsf@linaro.org> (raw)
In-Reply-To: <20160120172355.GW29396@toto>


Edgar E. Iglesias <edgar.iglesias@gmail.com> writes:

> On Wed, Jan 20, 2016 at 02:49:40PM +0100, Edgar E. Iglesias wrote:
>> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
>>
>> Implement the inputsize < pamax check for Stage 2 translations.
>> We have multiple choices for how to respond to errors and
>> choose to fault.
>>
>> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
>> ---
>>  target-arm/helper.c | 15 +++++++++++----
>>  1 file changed, 11 insertions(+), 4 deletions(-)
>>
>> diff --git a/target-arm/helper.c b/target-arm/helper.c
>> index 4abeb4d..e1fa209 100644
>> --- a/target-arm/helper.c
>> +++ b/target-arm/helper.c
>> @@ -6808,7 +6808,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
>>           */
>>          int startlevel = extract32(tcr->raw_tcr, 6, 2);
>>          unsigned int pamax = arm_pamax(cpu);
>> -        bool ok;
>> +        bool ok = true;
>>
>>          if (va_size == 32 || stride == 9) {
>>              /* AArch32 or 4KB pages */
>> @@ -6818,9 +6818,16 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
>>              level = 3 - startlevel;
>>          }
>>
>> -        /* Check that the starting level is valid. */
>> -        ok = check_s2_startlevel(cpu, va_size == 64, level,
>> -                                 inputsize, stride, pamax);
>> +        if (inputsize > pamax &&
>> +            (arm_el_is_aa64(env, 1) || inputsize > 40)) {
>
> I realized that this check should only be done for AArch64...
> Will fix that for v2.
>
> Something like the following:
>
>         if (arm_el_is_aa64(env, el) &&
>             inputsize > pamax &&
>             (arm_el_is_aa64(env, 1) || inputsize > 40)) {
>             /* We have multiple choices but choose to fault.  */
>             ok = false;
>         }
>

OK, I'll await the next revision.

>
> Cheers,
> Edgar
>
>
>> +            /* We have multiple choices but choose to fault.  */
>> +            ok = false;
>> +        }
>> +        if (ok) {
>> +            /* Check that the starting level is valid. */
>> +            ok = check_s2_startlevel(cpu, va_size == 64, level,
>> +                                     inputsize, stride, pamax);
>> +        }
>>          if (!ok) {
>>              /* AArch64 reports these as level 0 faults.
>>               * AArch32 reports these as level 1 faults.
>> --
>> 1.9.1
>>


--
Alex Bennée

WARNING: multiple messages have this Message-ID (diff)
From: "Alex Bennée" <alex.bennee@linaro.org>
To: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org,
	qemu-arm@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v1 3/3] target-arm: Implement the S2 MMU inputsize < pamax check
Date: Thu, 21 Jan 2016 12:52:54 +0000	[thread overview]
Message-ID: <877fj3ccwp.fsf@linaro.org> (raw)
In-Reply-To: <20160120172355.GW29396@toto>


Edgar E. Iglesias <edgar.iglesias@gmail.com> writes:

> On Wed, Jan 20, 2016 at 02:49:40PM +0100, Edgar E. Iglesias wrote:
>> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
>>
>> Implement the inputsize < pamax check for Stage 2 translations.
>> We have multiple choices for how to respond to errors and
>> choose to fault.
>>
>> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
>> ---
>>  target-arm/helper.c | 15 +++++++++++----
>>  1 file changed, 11 insertions(+), 4 deletions(-)
>>
>> diff --git a/target-arm/helper.c b/target-arm/helper.c
>> index 4abeb4d..e1fa209 100644
>> --- a/target-arm/helper.c
>> +++ b/target-arm/helper.c
>> @@ -6808,7 +6808,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
>>           */
>>          int startlevel = extract32(tcr->raw_tcr, 6, 2);
>>          unsigned int pamax = arm_pamax(cpu);
>> -        bool ok;
>> +        bool ok = true;
>>
>>          if (va_size == 32 || stride == 9) {
>>              /* AArch32 or 4KB pages */
>> @@ -6818,9 +6818,16 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
>>              level = 3 - startlevel;
>>          }
>>
>> -        /* Check that the starting level is valid. */
>> -        ok = check_s2_startlevel(cpu, va_size == 64, level,
>> -                                 inputsize, stride, pamax);
>> +        if (inputsize > pamax &&
>> +            (arm_el_is_aa64(env, 1) || inputsize > 40)) {
>
> I realized that this check should only be done for AArch64...
> Will fix that for v2.
>
> Something like the following:
>
>         if (arm_el_is_aa64(env, el) &&
>             inputsize > pamax &&
>             (arm_el_is_aa64(env, 1) || inputsize > 40)) {
>             /* We have multiple choices but choose to fault.  */
>             ok = false;
>         }
>

OK, I'll await the next revision.

>
> Cheers,
> Edgar
>
>
>> +            /* We have multiple choices but choose to fault.  */
>> +            ok = false;
>> +        }
>> +        if (ok) {
>> +            /* Check that the starting level is valid. */
>> +            ok = check_s2_startlevel(cpu, va_size == 64, level,
>> +                                     inputsize, stride, pamax);
>> +        }
>>          if (!ok) {
>>              /* AArch64 reports these as level 0 faults.
>>               * AArch32 reports these as level 1 faults.
>> --
>> 1.9.1
>>


--
Alex Bennée

  reply	other threads:[~2016-01-21 12:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-20 13:49 [PATCH v1 0/3] target-arm: Add a few more S2 MMU input checks Edgar E. Iglesias
2016-01-20 13:49 ` [Qemu-devel] " Edgar E. Iglesias
2016-01-20 13:49 ` [PATCH v1 1/3] target-arm: Apply S2 MMU startlevel table size check to AArch64 Edgar E. Iglesias
2016-01-20 13:49   ` [Qemu-devel] " Edgar E. Iglesias
2016-01-20 19:29   ` Alex Bennée
2016-01-20 19:29     ` [Qemu-devel] " Alex Bennée
2016-01-20 13:49 ` [PATCH v1 2/3] target-arm: Make pamax an argument to check_s2_startlevel Edgar E. Iglesias
2016-01-20 13:49   ` [Qemu-devel] " Edgar E. Iglesias
2016-01-21 12:26   ` Alex Bennée
2016-01-21 12:26     ` [Qemu-devel] " Alex Bennée
2016-01-21 15:04     ` Edgar E. Iglesias
2016-01-21 15:04       ` [Qemu-devel] " Edgar E. Iglesias
2016-01-20 13:49 ` [PATCH v1 3/3] target-arm: Implement the S2 MMU inputsize < pamax check Edgar E. Iglesias
2016-01-20 13:49   ` [Qemu-devel] " Edgar E. Iglesias
2016-01-20 17:23   ` Edgar E. Iglesias
2016-01-20 17:23     ` [Qemu-devel] " Edgar E. Iglesias
2016-01-21 12:52     ` Alex Bennée [this message]
2016-01-21 12:52       ` Alex Bennée
2016-01-21 15:05       ` Edgar E. Iglesias
2016-01-21 15:05         ` [Qemu-devel] " Edgar E. Iglesias

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=877fj3ccwp.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=edgar.iglesias@gmail.com \
    --cc=edgar.iglesias@xilinx.com \
    --cc=peter.maydell@linaro.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.