07 May, 2020

2 commits


05 Nov, 2019

1 commit


13 Aug, 2019

3 commits

  • Add a function to unregister a logical PIO range.

    Logical PIO space can still be leaked when unregistering certain
    LOGIC_PIO_CPU_MMIO regions, but this acceptable for now since there are no
    callers to unregister LOGIC_PIO_CPU_MMIO regions, and the logical PIO
    region allocation scheme would need significant work to improve this.

    Cc: stable@vger.kernel.org
    Signed-off-by: John Garry
    Signed-off-by: Wei Xu

    John Garry
     
  • The code was originally written to not support unregistering logical PIO
    regions.

    To accommodate supporting unregistering logical PIO regions, subtly modify
    LOGIC_PIO_CPU_MMIO region registration code, such that the "end" of the
    registered regions is the "end" of the last region, and not the sum of
    the sizes of all the registered regions.

    Cc: stable@vger.kernel.org
    Signed-off-by: John Garry
    Signed-off-by: Wei Xu

    John Garry
     
  • The traversing of io_range_list with list_for_each_entry_rcu()
    is not properly protected by rcu_read_lock() and rcu_read_unlock(),
    so add them.

    These functions mark the critical section scope where the list is
    protected for the reader, it cannot be "reclaimed". Any updater - in
    this case, the logical PIO registration functions - cannot update the
    list until the reader exits this critical section.

    In addition, the list traversing used in logic_pio_register_range()
    does not need to use the rcu variant.

    This is because we are already using io_range_mutex to guarantee mutual
    exclusion from mutating the list.

    Cc: stable@vger.kernel.org
    Fixes: 031e3601869c ("lib: Add generic PIO mapping method")
    Signed-off-by: John Garry
    Signed-off-by: Wei Xu

    John Garry
     

22 Mar, 2018

1 commit

  • 41f8bba7f555 ("of/pci: Add pci_register_io_range() and
    pci_pio_to_address()") added support for PCI I/O space mapped into CPU
    physical memory space. With that support, the I/O ranges configured for
    PCI/PCIe hosts on some architectures can be mapped to logical PIO and
    converted easily between CPU address and the corresponding logical PIO.
    Based on this, PCI I/O port space can be accessed via in/out accessors that
    use memory read/write.

    But on some platforms, there are bus hosts that access I/O port space with
    host-local I/O port addresses rather than memory addresses.

    Add a more generic I/O mapping method to support those devices. With this
    patch, both the CPU addresses and the host-local port can be mapped into
    the logical PIO space with different logical/fake PIOs. After this, all
    the I/O accesses to either PCI MMIO devices or host-local I/O peripherals
    can be unified into the existing I/O accessors defined in asm-generic/io.h
    and be redirected to the right device-specific hooks based on the input
    logical PIO.

    Tested-by: dann frazier
    Signed-off-by: Zhichang Yuan
    Signed-off-by: Gabriele Paoloni
    Signed-off-by: John Garry
    [bhelgaas: remove -EFAULT return from logic_pio_register_range() per
    https://lkml.kernel.org/r/20180403143909.GA21171@ulmo, fix NULL pointer
    checking per https://lkml.kernel.org/r/20180403211505.GA29612@embeddedor.com]
    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Andy Shevchenko

    Zhichang Yuan