12 Feb, 2016

1 commit

  • The pfn_t type uses an unsigned long to store a pfn + flags value. On a
    64-bit platform the upper 12 bits of an unsigned long are never used for
    storing the value of a pfn. However, this is not true on highmem
    platforms, all 32-bits of a pfn value are used to address a 44-bit
    physical address space. A pfn_t needs to store a 64-bit value.

    Link: https://bugzilla.kernel.org/show_bug.cgi?id=112211
    Fixes: 01c8f1c44b83 ("mm, dax, gpu: convert vm_insert_mixed to pfn_t")
    Signed-off-by: Dan Williams
    Reported-by: Stuart Foster
    Reported-by: Julian Margetson
    Tested-by: Julian Margetson
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dan Williams
     

16 Jan, 2016

1 commit

  • For the purpose of communicating the optional presence of a 'struct
    page' for the pfn returned from ->direct_access(), introduce a type that
    encapsulates a page-frame-number plus flags. These flags contain the
    historical "page_link" encoding for a scatterlist entry, but can also
    denote "device memory". Where "device memory" is a set of pfns that are
    not part of the kernel's linear mapping by default, but are accessed via
    the same memory controller as ram.

    The motivation for this new type is large capacity persistent memory
    that needs struct page entries in the 'memmap' to support 3rd party DMA
    (i.e. O_DIRECT I/O with a persistent memory source/target). However,
    we also need it in support of maintaining a list of mapped inodes which
    need to be unmapped at driver teardown or freeze_bdev() time.

    Signed-off-by: Dan Williams
    Cc: Christoph Hellwig
    Cc: Dave Hansen
    Cc: Ross Zwisler
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dan Williams
     

15 Jan, 2016

1 commit

  • __phys_to_pfn and __pfn_to_phys are symmetric, PHYS_PFN and PFN_PHYS are
    semmetric:

    - y = (phys_addr_t)x << PAGE_SHIFT

    - y >> PAGE_SHIFT = (phys_add_t)x

    - (unsigned long)(y >> PAGE_SHIFT) = x

    [akpm@linux-foundation.org: use macro arg name `x']
    [arnd@arndb.de: include linux/pfn.h for PHYS_PFN definition]
    Signed-off-by: Chen Gang
    Cc: Oleg Nesterov
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Chen Gang
     

14 Sep, 2008

1 commit

  • PFN_PHYS, as its name suggests, turns a pfn into a physical address.
    However, it is a macro which just operates on its argument without
    modifying its type. pfns are typed unsigned long, but an unsigned
    long may not be long enough to hold a physical address (32-bit systems
    with more than 32 bits of physcial address).

    Make sure we cast to phys_addr_t to return a complete result.

    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Ingo Molnar

    Jeremy Fitzhardinge
     

28 Mar, 2006

1 commit

  • Just about every architecture defines some macros to do operations on pfns.
    They're all virtually identical. This patch consolidates all of them.

    One minor glitch is that at least i386 uses them in a very skeletal header
    file. To keep away from #include dependency hell, I stuck the new
    definitions in a new, isolated header.

    Of all of the implementations, sh64 is the only one that varied by a bit.
    It used some masks to ensure that any sign-extension got ripped away before
    the arithmetic is done. This has been posted to that sh64 maintainers and
    the development list.

    Compiles on x86, x86_64, ia64 and ppc64.

    Signed-off-by: Dave Hansen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dave Hansen