lkml.org 
[lkml]   [2020]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
Subject[PATCH v2 0/8] Allow setting caching mode in arch_add_memory() for P2PDMA
Hi,

The main feedback from v1 was around the interface for arch_add_memory().
Per Dan's suggestions I've renamed the mhp_restrictions structure to
mhp_modifiers and put a pgprot_t field in that structure. I've also
included patch to drop the unused flags field.

Thanks,

Logan

--

Changes in v2:
* Rebased onto v5.5-rc5
* Renamed mhp_restrictions to mhp_modifiers and added the pgprot field
to that structure instead of using an argument for
arch_add_memory().
* Add patch to drop the unused flags field in mhp_restrictions

A git branch is available here:

https://github.com/sbates130272/linux-p2pmem remap_pages_cache_v2

--

Currently, the page tables created using memremap_pages() are always
created with the PAGE_KERNEL cacheing mode. However, the P2PDMA code
is creating pages for PCI BAR memory which should never be accessed
through the cache and instead use either WC or UC. This still works in
most cases, on x86, because the MTRR registers typically override the
caching settings in the page tables for all of the IO memory to be
UC-. However, this tends not to work so well on other arches or
some rare x86 machines that have firmware which does not setup the
MTRR registers in this way.

Instead of this, this series proposes a change to arch_add_memory()
to take the pgprot required by the mapping which allows us to
explicitly set pagetable entries for P2PDMA memory to WC.

This changes is pretty routine for most of the arches: x86_64, s390, arm64
and powerpc simply need to thread the pgprot through to where the page
tables are setup. x86_32 unfortunately sets up the page tables at boot so
must use _set_memory_prot() to change their caching mode. ia64 and sh
don't appear to have an easy way to change the page tables so, for now
at least, we just return -EINVAL on such mappings and thus they will
not support P2PDMA memory until the work for this is done.

--

Logan Gunthorpe (8):
mm/memory_hotplug: Drop the flags field from struct mhp_restrictions
mm/memory_hotplug: Rename mhp_restrictions to mhp_modifiers
x86/mm: Thread pgprot_t through init_memory_mapping()
x86/mm: Introduce _set_memory_prot()
powerpc/mm: Thread pgprot_t through create_section_mapping()
s390/mm: Thread pgprot_t through vmem_add_mapping()
mm/memory_hotplug: Add pgprot_t to mhp_modifiers
mm/memremap: Set caching mode for PCI P2PDMA memory to WC

arch/arm64/mm/mmu.c | 7 ++--
arch/ia64/mm/init.c | 6 +++-
arch/powerpc/include/asm/book3s/64/hash.h | 3 +-
arch/powerpc/include/asm/book3s/64/radix.h | 3 +-
arch/powerpc/include/asm/sparsemem.h | 3 +-
arch/powerpc/mm/book3s64/hash_utils.c | 5 +--
arch/powerpc/mm/book3s64/pgtable.c | 7 ++--
arch/powerpc/mm/book3s64/radix_pgtable.c | 18 ++++++----
arch/powerpc/mm/mem.c | 10 +++---
arch/s390/include/asm/pgtable.h | 3 +-
arch/s390/mm/extmem.c | 3 +-
arch/s390/mm/init.c | 8 ++---
arch/s390/mm/vmem.c | 10 +++---
arch/sh/mm/init.c | 7 ++--
arch/x86/include/asm/page_types.h | 3 --
arch/x86/include/asm/pgtable.h | 3 ++
arch/x86/include/asm/set_memory.h | 1 +
arch/x86/kernel/amd_gart_64.c | 3 +-
arch/x86/mm/init.c | 9 ++---
arch/x86/mm/init_32.c | 12 +++++--
arch/x86/mm/init_64.c | 40 ++++++++++++----------
arch/x86/mm/mm_internal.h | 3 +-
arch/x86/mm/pageattr.c | 7 ++++
arch/x86/platform/efi/efi_64.c | 3 +-
include/linux/memory_hotplug.h | 16 ++++-----
mm/memory_hotplug.c | 8 ++---
mm/memremap.c | 17 +++++----
27 files changed, 132 insertions(+), 86 deletions(-)

--
2.20.1

\
 
 \ /
  Last update: 2020-01-07 22:11    [W:0.140 / U:10.908 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site