qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/4] target/arm: Fixup contiguous first-fault and no-fault lo


From: LIU Zhiwei
Subject: Re: [PATCH 2/4] target/arm: Fixup contiguous first-fault and no-fault loads
Date: Thu, 10 Dec 2020 19:54:46 +0800
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1



On 2020/12/9 4:16, Richard Henderson wrote:
On 12/6/20 10:46 PM, LIU Zhiwei wrote:
First-fault or no-fault doesn't mean only access one page.
But the implementation is *allowed* to access only one page.
Thus the comment:

-    /*
-     * MemSingleNF is allowed to fail for any reason.  We have special
-     * code above to handle the first element crossing a page boundary.
-     * As an implementation choice, decline to handle a cross-page element
-     * in any other position.
-     */
From the pseudo code,  I see  that we should handle the first element in first-fault follow Mem. And the other elements in this function should follow  MemNF.

I have some questions here:

1. Why  do special process to the first element if it crosses pages in no-fault? Because it's not aligned?

// MemNF[] - non-assignment form
// =============================
(bits(8*size), boolean) MemNF[bits(64) address, integer size, AccType acctype]
assert size IN {1, 2, 4, 8, 16};
bits(8*size) value;
aligned = (address == Align(address, size));
A = SCTLR[].A;
if !aligned && (A == '1') then
    return (bits(8*size) UNKNOWN, TRUE);
atomic = aligned || size == 1;
if !atomic then
    (value<7:0>, bad) = MemSingleNF[address, 1, acctype, aligned];
    if bad then
        return (bits(8*size) UNKNOWN, TRUE);
    // For subsequent bytes it is CONSTRAINED UNPREDICTABLE whether an unaligned Device memory
    // access will generate an Alignment Fault, as to get this far means the first byte did
    // not, so we must be changing to a new translation page.
    if !aligned then
           c = ConstrainUnpredictable(Unpredictable_DEVPAGE2);
    assert c IN {Constraint_FAULT, Constraint_NONE};
    if c == Constraint_NONE then aligned = TRUE;
    for i = 1 to size-1
        (value<8*i+7:8*i>, bad) = MemSingleNF[address+i, 1, acctype, aligned];
    if bad then
        return (bits(8*size) UNKNOWN, TRUE);
else
    (value, bad) = MemSingleNF[address, size, acctype, aligned];
    if bad then
        return (bits(8*size) UNKNOWN, TRUE);
return (value, FALSE);


2.  Why it doesn't access the second page like the first page? I think they should obey the same MemSingleNF implementation.

r~


reply via email to

[Prev in Thread] Current Thread [Next in Thread]