• P
    exec: add page_mask for flatview_do_translate · d5e5fafd
    Peter Xu 提交于
    The function is originally used for flatview_space_translate() and what
    we care about most is (xlat, plen) range. However for iotlb requests, we
    don't really care about "plen", but the size of the page that "xlat" is
    located on. While, plen cannot really contain this information.
    
    A simple example to show why "plen" is not good for IOTLB translations:
    
    E.g., for huge pages, it is possible that guest mapped 1G huge page on
    device side that used this GPA range:
    
      0x100000000 - 0x13fffffff
    
    Then let's say we want to translate one IOVA that finally mapped to GPA
    0x13ffffe00 (which is located on this 1G huge page). Then here we'll
    get:
    
      (xlat, plen) = (0x13fffe00, 0x200)
    
    So the IOTLB would be only covering a very small range since from
    "plen" (which is 0x200 bytes) we cannot tell the size of the page.
    
    Actually we can really know that this is a huge page - we just throw the
    information away in flatview_do_translate().
    
    This patch introduced "page_mask" optional parameter to capture that
    page mask info. Also, I made "plen" an optional parameter as well, with
    some comments for the whole function.
    
    No functional change yet.
    Signed-off-by: NPeter Xu <peterx@redhat.com>
    Signed-off-by: NMaxime Coquelin <maxime.coquelin@redhat.com>
    Message-Id: <20171010094247.10173-2-maxime.coquelin@redhat.com>
    Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
    d5e5fafd
exec.c 106.8 KB