#include <linux/mutex.h>
#include <linux/mm_types.h>
#include <linux/mmu_context.h>
+#include <linux/xarray.h>
#include <asm/copro.h>
#include <asm/pnv-ocxl.h>
#include <misc/ocxl.h>
struct ocxl_process_element *spa_mem;
int spa_order;
struct mutex spa_lock;
- struct radix_tree_root pe_tree; /* Maps PE handles to pe_data */
+ struct xarray pe_array; /* Maps PE handles to pe_data */
char *irq_name;
int virq;
void __iomem *reg_dsisr;
}
rcu_read_lock();
- pe_data = radix_tree_lookup(&spa->pe_tree, pe_handle);
+ pe_data = xa_load(&spa->pe_array, pe_handle);
if (!pe_data) {
/*
* Could only happen if the driver didn't notify the
return -ENOMEM;
mutex_init(&spa->spa_lock);
- INIT_RADIX_TREE(&spa->pe_tree, GFP_KERNEL);
+ xa_init(&spa->pe_array);
INIT_WORK(&spa->xsl_fault.fault_work, xsl_fault_handler_bh);
spa->spa_order = SPA_SPA_SIZE_LOG - PAGE_SHIFT;
* invalidation
*/
mb();
- radix_tree_insert(&spa->pe_tree, pe_handle, pe_data);
+ xa_store(&spa->pe_array, pe_handle, pe_data, GFP_KERNEL);
/*
* The mm must stay valid for as long as the device uses it. We
* sure the PASID is no longer in use, including pending
* interrupts. However, there's no way to be sure...
*
- * We clear the PE and remove the context from our radix
- * tree. From that point on, any new interrupt for that
+ * We clear the PE and remove the context from our array.
+ * From that point on, any new interrupt for that
* context will fail silently, which is ok. As mentioned
* above, that's not expected, but it could happen if the
* driver or AFU didn't do the right thing.
*
* There could still be a bottom half running, but we don't
* need to wait/flush, as it is managing a reference count on
- * the mm it reads from the radix tree.
+ * the mm it reads from the array.
*/
pe_handle = pasid & SPA_PE_MASK;
pe = spa->spa_mem + pe_handle;
rc = pnv_ocxl_spa_remove_pe_from_cache(link->platform_data, pe_handle);
WARN_ON(rc);
- pe_data = radix_tree_delete(&spa->pe_tree, pe_handle);
+ pe_data = xa_erase(&spa->pe_array, pe_handle);
if (!pe_data) {
WARN(1, "Couldn't find pe data when removing PE\n");
} else {