1. 13 Aug, 2019 3 commits
    • John Garry's avatar
      lib: logic_pio: Add logic_pio_unregister_range() · b884e2de
      John Garry authored
      
      
      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: default avatarJohn Garry <john.garry@huawei.com>
      Signed-off-by: default avatarWei Xu <xuwei5@hisilicon.com>
      b884e2de
    • John Garry's avatar
      lib: logic_pio: Avoid possible overlap for unregistering regions · 0a27142b
      John Garry authored
      
      
      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: default avatarJohn Garry <john.garry@huawei.com>
      Signed-off-by: default avatarWei Xu <xuwei5@hisilicon.com>
      0a27142b
    • John Garry's avatar
      lib: logic_pio: Fix RCU usage · 06709e81
      John Garry authored
      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: 031e3601
      
       ("lib: Add generic PIO mapping method")
      Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
      Signed-off-by: default avatarWei Xu <xuwei5@hisilicon.com>
      06709e81
  2. 21 Mar, 2018 1 commit