summaryrefslogtreecommitdiff
path: root/arch/x86/include/asm/memtype.h
AgeCommit message (Collapse)Author
2022-11-10x86: Decouple PAT and MTRR handlingJuergen Gross
Today, PAT is usable only with MTRR being active, with some nasty tweaks to make PAT usable when running as a Xen PV guest which doesn't support MTRR. The reason for this coupling is that both PAT MSR changes and MTRR changes require a similar sequence and so full PAT support was added using the already available MTRR handling. Xen PV PAT handling can work without MTRR, as it just needs to consume the PAT MSR setting done by the hypervisor without the ability and need to change it. This in turn has resulted in a convoluted initialization sequence and wrong decisions regarding cache mode availability due to misguiding PAT availability flags. Fix all of that by allowing to use PAT without MTRR and by reworking the current PAT initialization sequence to match better with the newly introduced generic cache initialization. This removes the need of the recently added pat_force_disabled flag, so remove the remnants of the patch adding it. Signed-off-by: Juergen Gross <jgross@suse.com> Signed-off-by: Borislav Petkov <bp@suse.de> Link: https://lore.kernel.org/r/20221102074713.21493-14-jgross@suse.com Signed-off-by: Borislav Petkov <bp@suse.de>
2020-04-20x86/mm: Move pgprot2cachemode out of lineChristoph Hellwig
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
2020-04-20x86/mm: Add a x86_has_pat_wp() helperChristoph Hellwig
Abstract the ioremap code away from the caching mode internals. 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-2-hch@lst.de
2019-12-10x86/mm/pat: Clean up <asm/memtype.h> externsIngo Molnar
Half of the declarations have an 'extern', half of them not, use 'extern' consistently. This makes grepping for APIs easier, such as: dagon:~/tip> git grep -E '\<memtype_.*\(' arch/x86/ | grep extern arch/x86/include/asm/memtype.h:extern int memtype_reserve(u64 start, u64 end, arch/x86/include/asm/memtype.h:extern int memtype_free(u64 start, u64 end); arch/x86/include/asm/memtype.h:extern int memtype_kernel_map_sync(u64 base, unsigned long size, arch/x86/include/asm/memtype.h:extern int memtype_reserve_io(resource_size_t start, resource_size_t end, arch/x86/include/asm/memtype.h:extern void memtype_free_io(resource_size_t start, resource_size_t end); arch/x86/mm/pat/memtype.h:extern int memtype_check_insert(struct memtype *entry_new, arch/x86/mm/pat/memtype.h:extern struct memtype *memtype_erase(u64 start, u64 end); arch/x86/mm/pat/memtype.h:extern struct memtype *memtype_lookup(u64 addr); arch/x86/mm/pat/memtype.h:extern int memtype_copy_nth_element(struct memtype *entry_out, loff_t pos); Signed-off-by: Ingo Molnar <mingo@kernel.org>
2019-12-10x86/mm/pat: Rename <asm/pat.h> => <asm/memtype.h>Ingo Molnar
pat.h is a file whose main purpose is to provide the memtype_*() APIs. PAT is the low level hardware mechanism - but the high level abstraction is memtype. So name the header <memtype.h> as well - this goes hand in hand with memtype.c and memtype_interval.c. Signed-off-by: Ingo Molnar <mingo@kernel.org>