From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752823AbaIJRDS (ORCPT ); Wed, 10 Sep 2014 13:03:18 -0400 Received: from g6t1524.atlanta.hp.com ([15.193.200.67]:3409 "EHLO g6t1524.atlanta.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752752AbaIJRCt (ORCPT ); Wed, 10 Sep 2014 13:02:49 -0400 From: Toshi Kani To: hpa@zytor.com, tglx@linutronix.de, mingo@redhat.com, akpm@linux-foundation.org, arnd@arndb.de Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, jgross@suse.com, stefan.bader@canonical.com, luto@amacapital.net, hmh@hmh.eng.br, yigal@plexistor.com, konrad.wilk@oracle.com, Toshi Kani Subject: [PATCH v2 5/6] x86, mm, pat: Add pgprot_writethrough() for WT Date: Wed, 10 Sep 2014 10:51:49 -0600 Message-Id: <1410367910-6026-6-git-send-email-toshi.kani@hp.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1410367910-6026-1-git-send-email-toshi.kani@hp.com> References: <1410367910-6026-1-git-send-email-toshi.kani@hp.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds pgprot_writethrough() for setting WT to a given pgprot_t. Signed-off-by: Toshi Kani --- arch/x86/include/asm/pgtable_types.h | 3 +++ arch/x86/mm/pat.c | 10 ++++++++++ include/asm-generic/pgtable.h | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h index bd2f50f..cc7c65d 100644 --- a/arch/x86/include/asm/pgtable_types.h +++ b/arch/x86/include/asm/pgtable_types.h @@ -394,6 +394,9 @@ extern int nx_enabled; #define pgprot_writecombine pgprot_writecombine extern pgprot_t pgprot_writecombine(pgprot_t prot); +#define pgprot_writethrough pgprot_writethrough +extern pgprot_t pgprot_writethrough(pgprot_t prot); + /* Indicate that x86 has its own track and untrack pfn vma functions */ #define __HAVE_PFNMAP_TRACKING diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c index 7644967..97aab95 100644 --- a/arch/x86/mm/pat.c +++ b/arch/x86/mm/pat.c @@ -875,6 +875,16 @@ pgprot_t pgprot_writecombine(pgprot_t prot) } EXPORT_SYMBOL_GPL(pgprot_writecombine); +pgprot_t pgprot_writethrough(pgprot_t prot) +{ + if (pat_enabled) + return __pgprot(pgprot_val(prot) | + cachemode2protval(_PAGE_CACHE_MODE_WT)); + else + return pgprot_noncached(prot); +} +EXPORT_SYMBOL_GPL(pgprot_writethrough); + #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_X86_PAT) static struct memtype *memtype_get_idx(loff_t pos) diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index 53b2acc..1af0ed9 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h @@ -249,6 +249,10 @@ static inline int pmd_same(pmd_t pmd_a, pmd_t pmd_b) #define pgprot_writecombine pgprot_noncached #endif +#ifndef pgprot_writethrough +#define pgprot_writethrough pgprot_noncached +#endif + /* * When walking page tables, get the address of the next boundary, * or the end address of the range if that comes earlier. Although no From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa0-f44.google.com (mail-oa0-f44.google.com [209.85.219.44]) by kanga.kvack.org (Postfix) with ESMTP id AE4656B004D for ; Wed, 10 Sep 2014 13:02:49 -0400 (EDT) Received: by mail-oa0-f44.google.com with SMTP id o6so13290295oag.17 for ; Wed, 10 Sep 2014 10:02:49 -0700 (PDT) Received: from g6t1524.atlanta.hp.com (g6t1524.atlanta.hp.com. [15.193.200.67]) by mx.google.com with ESMTPS id ix2si23144370obc.32.2014.09.10.10.02.48 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 10 Sep 2014 10:02:48 -0700 (PDT) From: Toshi Kani Subject: [PATCH v2 5/6] x86, mm, pat: Add pgprot_writethrough() for WT Date: Wed, 10 Sep 2014 10:51:49 -0600 Message-Id: <1410367910-6026-6-git-send-email-toshi.kani@hp.com> In-Reply-To: <1410367910-6026-1-git-send-email-toshi.kani@hp.com> References: <1410367910-6026-1-git-send-email-toshi.kani@hp.com> Sender: owner-linux-mm@kvack.org List-ID: To: hpa@zytor.com, tglx@linutronix.de, mingo@redhat.com, akpm@linux-foundation.org, arnd@arndb.de Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, jgross@suse.com, stefan.bader@canonical.com, luto@amacapital.net, hmh@hmh.eng.br, yigal@plexistor.com, konrad.wilk@oracle.com, Toshi Kani This patch adds pgprot_writethrough() for setting WT to a given pgprot_t. Signed-off-by: Toshi Kani --- arch/x86/include/asm/pgtable_types.h | 3 +++ arch/x86/mm/pat.c | 10 ++++++++++ include/asm-generic/pgtable.h | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h index bd2f50f..cc7c65d 100644 --- a/arch/x86/include/asm/pgtable_types.h +++ b/arch/x86/include/asm/pgtable_types.h @@ -394,6 +394,9 @@ extern int nx_enabled; #define pgprot_writecombine pgprot_writecombine extern pgprot_t pgprot_writecombine(pgprot_t prot); +#define pgprot_writethrough pgprot_writethrough +extern pgprot_t pgprot_writethrough(pgprot_t prot); + /* Indicate that x86 has its own track and untrack pfn vma functions */ #define __HAVE_PFNMAP_TRACKING diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c index 7644967..97aab95 100644 --- a/arch/x86/mm/pat.c +++ b/arch/x86/mm/pat.c @@ -875,6 +875,16 @@ pgprot_t pgprot_writecombine(pgprot_t prot) } EXPORT_SYMBOL_GPL(pgprot_writecombine); +pgprot_t pgprot_writethrough(pgprot_t prot) +{ + if (pat_enabled) + return __pgprot(pgprot_val(prot) | + cachemode2protval(_PAGE_CACHE_MODE_WT)); + else + return pgprot_noncached(prot); +} +EXPORT_SYMBOL_GPL(pgprot_writethrough); + #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_X86_PAT) static struct memtype *memtype_get_idx(loff_t pos) diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index 53b2acc..1af0ed9 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h @@ -249,6 +249,10 @@ static inline int pmd_same(pmd_t pmd_a, pmd_t pmd_b) #define pgprot_writecombine pgprot_noncached #endif +#ifndef pgprot_writethrough +#define pgprot_writethrough pgprot_noncached +#endif + /* * When walking page tables, get the address of the next boundary, * or the end address of the range if that comes earlier. Although no -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org