• Alex Sierra's avatar
    lib: add support for device coherent type in test_hmm · 4c2e0f76
    Alex Sierra authored
    Device Coherent type uses device memory that is coherently accesible by
    the CPU.  This could be shown as SP (special purpose) memory range at the
    BIOS-e820 memory enumeration.  If no SP memory is supported in system,
    this could be faked by setting CONFIG_EFI_FAKE_MEMMAP.
    
    Currently, test_hmm only supports two different SP ranges of at least
    256MB size. This could be specified in the kernel parameter variable
    efi_fake_mem. Ex. Two SP ranges of 1GB starting at 0x100000000 &
    0x140000000 physical address. Ex.
    efi_fake_mem=1G@0x100000000:0x40000,1G@0x140000000:0x40000
    
    Private and coherent device mirror instances can be created in the same
    probed.  This is done by passing the module parameters spm_addr_dev0 &
    spm_addr_dev1.  In this case, it will create four instances of
    device_mirror.  The first two correspond to private device type, the last
    two to coherent type.  Then, they can be easily accessed from user space
    through /dev/hmm_mirror<num_device>.  Usually num_device 0 and 1 are for
    private, and 2 and 3 for coherent types.  If no module parameters are
    passed, two instances of private type device_mirror will be created only.
    
    Link: https://lkml.kernel.org/r/20220715150521.18165-11-alex.sierra@amd.comSigned-off-by: default avatarAlex Sierra <alex.sierra@amd.com>
    Acked-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
    Reviewed-by: default avatarAlistair Poppple <apopple@nvidia.com>
    Cc: Christoph Hellwig <hch@lst.de>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: Jason Gunthorpe <jgg@nvidia.com>
    Cc: Jerome Glisse <jglisse@redhat.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Ralph Campbell <rcampbell@nvidia.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    4c2e0f76
test_hmm.c 35.4 KB