diff mbox series

[20/34] drm/i915: Convert page_track_tree to XArray

Message ID 20190221184226.2149-40-willy@infradead.org (mailing list archive)
State New, archived
Headers show
Series Convert DRM to XArray | expand

Commit Message

Matthew Wilcox (Oracle) Feb. 21, 2019, 6:41 p.m. UTC
No locking changes.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
---
 drivers/gpu/drm/i915/gvt/gvt.h        | 2 +-
 drivers/gpu/drm/i915/gvt/page_track.c | 6 +++---
 drivers/gpu/drm/i915/gvt/vgpu.c       | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gvt/gvt.h b/drivers/gpu/drm/i915/gvt/gvt.h
index b4ab1dad0143..e5bf20dcdd7d 100644
--- a/drivers/gpu/drm/i915/gvt/gvt.h
+++ b/drivers/gpu/drm/i915/gvt/gvt.h
@@ -198,7 +198,7 @@  struct intel_vgpu {
 	struct intel_vgpu_opregion opregion;
 	struct intel_vgpu_display display;
 	struct intel_vgpu_submission submission;
-	struct radix_tree_root page_track_tree;
+	struct xarray page_track;
 	u32 hws_pga[I915_NUM_ENGINES];
 
 	struct dentry *debugfs;
diff --git a/drivers/gpu/drm/i915/gvt/page_track.c b/drivers/gpu/drm/i915/gvt/page_track.c
index 84856022528e..8e8b5935f344 100644
--- a/drivers/gpu/drm/i915/gvt/page_track.c
+++ b/drivers/gpu/drm/i915/gvt/page_track.c
@@ -34,7 +34,7 @@ 
 struct intel_vgpu_page_track *intel_vgpu_find_page_track(
 		struct intel_vgpu *vgpu, unsigned long gfn)
 {
-	return radix_tree_lookup(&vgpu->page_track_tree, gfn);
+	return xa_load(&vgpu->page_track, gfn);
 }
 
 /**
@@ -64,7 +64,7 @@  int intel_vgpu_register_page_track(struct intel_vgpu *vgpu, unsigned long gfn,
 	track->handler = handler;
 	track->priv_data = priv;
 
-	ret = radix_tree_insert(&vgpu->page_track_tree, gfn, track);
+	ret = xa_err(xa_store(&vgpu->page_track, gfn, track, GFP_KERNEL));
 	if (ret) {
 		kfree(track);
 		return ret;
@@ -84,7 +84,7 @@  void intel_vgpu_unregister_page_track(struct intel_vgpu *vgpu,
 {
 	struct intel_vgpu_page_track *track;
 
-	track = radix_tree_delete(&vgpu->page_track_tree, gfn);
+	track = xa_erase(&vgpu->page_track, gfn);
 	if (track) {
 		if (track->tracked)
 			intel_gvt_hypervisor_disable_page_track(vgpu, gfn);
diff --git a/drivers/gpu/drm/i915/gvt/vgpu.c b/drivers/gpu/drm/i915/gvt/vgpu.c
index c628be05fbfe..6ec5d16f4e06 100644
--- a/drivers/gpu/drm/i915/gvt/vgpu.c
+++ b/drivers/gpu/drm/i915/gvt/vgpu.c
@@ -382,7 +382,7 @@  static struct intel_vgpu *__intel_gvt_create_vgpu(struct intel_gvt *gvt,
 	mutex_init(&vgpu->vgpu_lock);
 	mutex_init(&vgpu->dmabuf_lock);
 	INIT_LIST_HEAD(&vgpu->dmabuf_obj_list_head);
-	INIT_RADIX_TREE(&vgpu->page_track_tree, GFP_KERNEL);
+	xa_init(&vgpu->page_track);
 	idr_init(&vgpu->object_idr);
 	intel_vgpu_init_cfg_space(vgpu, param->primary);