From: "tip-bot2 for Christoph Hellwig" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Christoph Hellwig <hch@lst.de>, Borislav Petkov <bp@suse.de>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
x86 <x86@kernel.org>, LKML <linux-kernel@vger.kernel.org>
Subject: [tip: x86/mm] x86/mm: Move pgprot2cachemode out of line
Date: Mon, 20 Apr 2020 13:30:28 -0000 [thread overview]
Message-ID: <158738942809.28353.13983068811778486058.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20200408152745.1565832-3-hch@lst.de>
The following commit has been merged into the x86/mm branch of tip:
Commit-ID: 7fa3e10f0f3646108a1018004d0f571c3222dc9f
Gitweb: https://git.kernel.org/tip/7fa3e10f0f3646108a1018004d0f571c3222dc9f
Author: Christoph Hellwig <hch@lst.de>
AuthorDate: Wed, 08 Apr 2020 17:27:43 +02:00
Committer: Borislav Petkov <bp@suse.de>
CommitterDate: Mon, 20 Apr 2020 12:39:17 +02:00
x86/mm: Move pgprot2cachemode out of line
This helper is only used by x86 low-level MM code. Also remove the
entirely pointless __pte2cachemode_tbl export as that symbol can be
marked static now.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20200408152745.1565832-3-hch@lst.de
---
arch/x86/include/asm/memtype.h | 1 +
arch/x86/include/asm/pgtable_types.h | 10 ----------
arch/x86/mm/init.c | 13 +++++++++++--
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/arch/x86/include/asm/memtype.h b/arch/x86/include/asm/memtype.h
index 1e4e99b..9ca760e 100644
--- a/arch/x86/include/asm/memtype.h
+++ b/arch/x86/include/asm/memtype.h
@@ -25,5 +25,6 @@ extern void memtype_free_io(resource_size_t start, resource_size_t end);
extern bool pat_pfn_immune_to_uc_mtrr(unsigned long pfn);
bool x86_has_pat_wp(void);
+enum page_cache_mode pgprot2cachemode(pgprot_t pgprot);
#endif /* _ASM_X86_MEMTYPE_H */
diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h
index b6606fe..75fe903 100644
--- a/arch/x86/include/asm/pgtable_types.h
+++ b/arch/x86/include/asm/pgtable_types.h
@@ -468,7 +468,6 @@ static inline pteval_t pte_flags(pte_t pte)
}
extern uint16_t __cachemode2pte_tbl[_PAGE_CACHE_MODE_NUM];
-extern uint8_t __pte2cachemode_tbl[8];
#define __pte2cm_idx(cb) \
((((cb) >> (_PAGE_BIT_PAT - 2)) & 4) | \
@@ -489,15 +488,6 @@ static inline pgprot_t cachemode2pgprot(enum page_cache_mode pcm)
{
return __pgprot(cachemode2protval(pcm));
}
-static inline enum page_cache_mode pgprot2cachemode(pgprot_t pgprot)
-{
- unsigned long masked;
-
- masked = pgprot_val(pgprot) & _PAGE_CACHE_MASK;
- if (likely(masked == 0))
- return 0;
- return __pte2cachemode_tbl[__pte2cm_idx(masked)];
-}
static inline pgprot_t pgprot_4k_2_large(pgprot_t pgprot)
{
pgprotval_t val = pgprot_val(pgprot);
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 6005f83..4a55d68 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -59,7 +59,7 @@ uint16_t __cachemode2pte_tbl[_PAGE_CACHE_MODE_NUM] = {
};
EXPORT_SYMBOL(__cachemode2pte_tbl);
-uint8_t __pte2cachemode_tbl[8] = {
+static uint8_t __pte2cachemode_tbl[8] = {
[__pte2cm_idx( 0 | 0 | 0 )] = _PAGE_CACHE_MODE_WB,
[__pte2cm_idx(_PAGE_PWT | 0 | 0 )] = _PAGE_CACHE_MODE_UC_MINUS,
[__pte2cm_idx( 0 | _PAGE_PCD | 0 )] = _PAGE_CACHE_MODE_UC_MINUS,
@@ -69,7 +69,6 @@ uint8_t __pte2cachemode_tbl[8] = {
[__pte2cm_idx(0 | _PAGE_PCD | _PAGE_PAT)] = _PAGE_CACHE_MODE_UC_MINUS,
[__pte2cm_idx(_PAGE_PWT | _PAGE_PCD | _PAGE_PAT)] = _PAGE_CACHE_MODE_UC,
};
-EXPORT_SYMBOL(__pte2cachemode_tbl);
/* Check that the write-protect PAT entry is set for write-protect */
bool x86_has_pat_wp(void)
@@ -77,6 +76,16 @@ bool x86_has_pat_wp(void)
return __pte2cachemode_tbl[_PAGE_CACHE_MODE_WP] == _PAGE_CACHE_MODE_WP;
}
+enum page_cache_mode pgprot2cachemode(pgprot_t pgprot)
+{
+ unsigned long masked;
+
+ masked = pgprot_val(pgprot) & _PAGE_CACHE_MASK;
+ if (likely(masked == 0))
+ return 0;
+ return __pte2cachemode_tbl[__pte2cm_idx(masked)];
+}
+
static unsigned long __initdata pgt_buf_start;
static unsigned long __initdata pgt_buf_end;
static unsigned long __initdata pgt_buf_top;
next prev parent reply other threads:[~2020-04-20 13:30 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-08 15:27 hide __pte2cachemode_tbl and __cachemode2pte_tbl Christoph Hellwig
2020-04-08 15:27 ` [PATCH 1/4] x86/mm: Add a x86_has_pat_wp helper Christoph Hellwig
2020-04-20 13:30 ` [tip: x86/mm] x86/mm: Add a x86_has_pat_wp() helper tip-bot2 for Christoph Hellwig
2020-04-08 15:27 ` [PATCH 2/4] x86/mm: Move pgprot2cachemode out of line Christoph Hellwig
2020-04-20 13:30 ` tip-bot2 for Christoph Hellwig [this message]
2020-04-08 15:27 ` [PATCH 3/4] x86/mm: Cleanup pgprot_4k_2_large and pgprot_large_2_4k Christoph Hellwig
2020-04-20 13:30 ` [tip: x86/mm] x86/mm: Cleanup pgprot_4k_2_large() and pgprot_large_2_4k() tip-bot2 for Christoph Hellwig
2020-04-23 12:26 ` tip-bot2 for Christoph Hellwig
2020-04-08 15:27 ` [PATCH 4/4] x86/mm: Unexport __cachemode2pte_tbl Christoph Hellwig
2020-04-20 13:30 ` [tip: x86/mm] " tip-bot2 for Christoph Hellwig
2020-04-23 12:26 ` tip-bot2 for Christoph Hellwig
2020-04-20 8:46 ` hide __pte2cachemode_tbl and __cachemode2pte_tbl Christoph Hellwig
2020-04-20 10:30 ` Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=158738942809.28353.13983068811778486058.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=bp@suse.de \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).