lkml.org 
[lkml]   [2014]   [Jul]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[RFC PATCH 10/11] x86, xen: Cleanup PWT/PCD bit manipulation in Xen
    Date
    This patch cleans up the PWT & PCD bit manipulation for the kernel
    memory types in Xen, and uses _PAGE_CACHE_<type> macros, instead.
    This keeps the Xen code independent from the PAT slot assignment.

    Signed-off-by: Toshi Kani <toshi.kani@hp.com>
    ---
    arch/x86/xen/enlighten.c | 2 +-
    arch/x86/xen/mmu.c | 8 ++++----
    2 files changed, 5 insertions(+), 5 deletions(-)

    diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
    index ffb101e..1917bef 100644
    --- a/arch/x86/xen/enlighten.c
    +++ b/arch/x86/xen/enlighten.c
    @@ -1557,7 +1557,7 @@ asmlinkage __visible void __init xen_start_kernel(void)
    #if 0
    if (!xen_initial_domain())
    #endif
    - __supported_pte_mask &= ~(_PAGE_PWT | _PAGE_PCD);
    + __supported_pte_mask &= ~_PAGE_CACHE_MASK;

    __supported_pte_mask |= _PAGE_IOMAP;

    diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
    index e8a1201..8ef154a 100644
    --- a/arch/x86/xen/mmu.c
    +++ b/arch/x86/xen/mmu.c
    @@ -438,7 +438,7 @@ __visible pteval_t xen_pte_val(pte_t pte)
    /* If this is a WC pte, convert back from Xen WC to Linux WC */
    if ((pteval & (_PAGE_PAT | _PAGE_PCD | _PAGE_PWT)) == _PAGE_PAT) {
    WARN_ON(!pat_enabled);
    - pteval = (pteval & ~_PAGE_PAT) | _PAGE_PWT;
    + pteval = (pteval & ~_PAGE_PAT) | _PAGE_CACHE_WC;
    }
    #endif
    if (xen_initial_domain() && (pteval & _PAGE_IOMAP))
    @@ -465,11 +465,11 @@ PV_CALLEE_SAVE_REGS_THUNK(xen_pgd_val);
    * 0 WB WB WB
    * 1 PWT WC WT WT
    * 2 PCD UC- UC- UC-
    - * 3 PCD PWT UC UC UC
    + * 3 PCD PWT WT UC UC
    * 4 PAT WB WC WB
    * 5 PAT PWT WC WP WT
    * 6 PAT PCD UC- rsv UC-
    - * 7 PAT PCD PWT UC rsv UC
    + * 7 PAT PCD PWT WT rsv UC
    */

    void xen_set_pat(u64 pat)
    @@ -492,7 +492,7 @@ __visible pte_t xen_make_pte(pteval_t pte)
    * but we could see hugetlbfs mappings, I think.).
    */
    if (pat_enabled && !WARN_ON(pte & _PAGE_PAT)) {
    - if ((pte & (_PAGE_PCD | _PAGE_PWT)) == _PAGE_PWT)
    + if ((pte & _PAGE_CACHE_MASK) == _PAGE_CACHE_WC)
    pte = (pte & ~(_PAGE_PCD | _PAGE_PWT)) | _PAGE_PAT;
    }
    #endif

    \
     
     \ /
      Last update: 2014-07-18 14:21    [W:4.324 / U:0.144 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site