mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 02:50:43 +00:00
x86/mm/cpa: Use flush_tlb_kernel_range()
Both cpa_flush_range() and cpa_flush_array() have a well specified range, use that to do a range based TLB invalidate. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Dave Hansen <dave.hansen@intel.com> Cc: Bin Yang <bin.yang@intel.com> Cc: Mark Gross <mark.gross@intel.com> Link: https://lkml.kernel.org/r/20180919085947.985193217@infradead.org
This commit is contained in:
parent
ddd07b7503
commit
a7295fd53c
1 changed files with 5 additions and 4 deletions
|
@ -293,7 +293,7 @@ static void cpa_flush_range(unsigned long start, int numpages, int cache)
|
||||||
BUG_ON(irqs_disabled() && !early_boot_irqs_disabled);
|
BUG_ON(irqs_disabled() && !early_boot_irqs_disabled);
|
||||||
WARN_ON(PAGE_ALIGN(start) != start);
|
WARN_ON(PAGE_ALIGN(start) != start);
|
||||||
|
|
||||||
flush_tlb_all();
|
flush_tlb_kernel_range(start, start + PAGE_SIZE * numpages);
|
||||||
|
|
||||||
if (!cache)
|
if (!cache)
|
||||||
return;
|
return;
|
||||||
|
@ -315,14 +315,15 @@ static void cpa_flush_range(unsigned long start, int numpages, int cache)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cpa_flush_array(unsigned long *start, int numpages, int cache,
|
static void cpa_flush_array(unsigned long baddr, unsigned long *start,
|
||||||
|
int numpages, int cache,
|
||||||
int in_flags, struct page **pages)
|
int in_flags, struct page **pages)
|
||||||
{
|
{
|
||||||
unsigned int i, level;
|
unsigned int i, level;
|
||||||
|
|
||||||
BUG_ON(irqs_disabled() && !early_boot_irqs_disabled);
|
BUG_ON(irqs_disabled() && !early_boot_irqs_disabled);
|
||||||
|
|
||||||
flush_tlb_all();
|
flush_tlb_kernel_range(baddr, baddr + PAGE_SIZE * numpages);
|
||||||
|
|
||||||
if (!cache)
|
if (!cache)
|
||||||
return;
|
return;
|
||||||
|
@ -1757,7 +1758,7 @@ static int change_page_attr_set_clr(unsigned long *addr, int numpages,
|
||||||
*/
|
*/
|
||||||
if (!ret && boot_cpu_has(X86_FEATURE_CLFLUSH)) {
|
if (!ret && boot_cpu_has(X86_FEATURE_CLFLUSH)) {
|
||||||
if (cpa.flags & (CPA_PAGES_ARRAY | CPA_ARRAY)) {
|
if (cpa.flags & (CPA_PAGES_ARRAY | CPA_ARRAY)) {
|
||||||
cpa_flush_array(addr, numpages, cache,
|
cpa_flush_array(baddr, addr, numpages, cache,
|
||||||
cpa.flags, pages);
|
cpa.flags, pages);
|
||||||
} else
|
} else
|
||||||
cpa_flush_range(baddr, numpages, cache);
|
cpa_flush_range(baddr, numpages, cache);
|
||||||
|
|
Loading…
Reference in a new issue