[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-arm] [Qemu-devel] [PATCH for-3.0] target/arm: Correctly handle
From: |
Richard Henderson |
Subject: |
Re: [Qemu-arm] [Qemu-devel] [PATCH for-3.0] target/arm: Correctly handle overlapping small MPU regions |
Date: |
Tue, 17 Jul 2018 10:29:38 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 |
On 07/16/2018 06:33 AM, Peter Maydell wrote:
> @@ -9963,6 +9994,21 @@ static bool pmsav8_mpu_lookup(CPUARMState *env,
> uint32_t address,
> }
>
> if (address < base || address > limit) {> + /*> +
> * Address not in this region. We must
check whether the> + * region covers addresses in the same page
as our address.> + * In that case we must not report a size
that covers the> + * whole page for a subsequent hit against a
different MPU> + * region or the background region, because it
would result in> + * incorrect TLB hits for subsequent accesses
to addresses that> + * are in this MPU region.> +
*/> + if (limit >= base &&> +
ranges_overlap(base, limit - base + 1,> +
addr_page_base,> + TARGET_PAGE_SIZE)) {> +
*is_subpage = true;> + }
I don't understand why this is necessary in the v8m case.
AP APL
<----B1----|----L1-B2-A-------|---L2--->
Your comment posits two regions [B1,L1] and [B2,L2], that A is not within
[B1,L1] but is within [B2,L2] (otherwise we would not report a hit at all).
Further, that [B1,L1] intersects [AP,APL] but does not intersect [B2,L2]
(otherwise we would report a fault for overlapping regions).
Surely this combination of ranges implies that [B2,L2] must itself set
IS_SUBPAGE (otherwise the first region would not overlap the page of A, or
would not overlap the second region).
Because of the non-fault for region overlap in v7m, I can see that the test is
required in get_phys_addr_pmsav7, but AFAICS only there.
r~