Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f66e5ff7 authored by Changbin Du's avatar Changbin Du Committed by Zhenyu Wang
Browse files

drm/i915/gvt: Rename mpt api {set, unset}_wp_page to {enable, disable}_page_track



The kvmgt's implementation of mpt api {set,unset}_wp_page is not real
write-protection - the data get written before invoke this two api.
As discussed, change the mpt api to match the real behavior.

Signed-off-by: default avatarChangbin Du <changbin.du@intel.com>
Signed-off-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
parent d87f5ff3
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -44,8 +44,8 @@ struct intel_gvt_mpt {
	void (*detach_vgpu)(unsigned long handle);
	int (*inject_msi)(unsigned long handle, u32 addr, u16 data);
	unsigned long (*from_virt_to_mfn)(void *p);
	int (*set_wp_page)(unsigned long handle, u64 gfn);
	int (*unset_wp_page)(unsigned long handle, u64 gfn);
	int (*enable_page_track)(unsigned long handle, u64 gfn);
	int (*disable_page_track)(unsigned long handle, u64 gfn);
	int (*read_gpa)(unsigned long handle, unsigned long gpa, void *buf,
			unsigned long len);
	int (*write_gpa)(unsigned long handle, unsigned long gpa, void *buf,
+4 −4
Original line number Diff line number Diff line
@@ -1321,7 +1321,7 @@ static void kvmgt_host_exit(struct device *dev, void *gvt)
	mdev_unregister_device(dev);
}

static int kvmgt_write_protect_add(unsigned long handle, u64 gfn)
static int kvmgt_page_track_add(unsigned long handle, u64 gfn)
{
	struct kvmgt_guest_info *info;
	struct kvm *kvm;
@@ -1355,7 +1355,7 @@ static int kvmgt_write_protect_add(unsigned long handle, u64 gfn)
	return 0;
}

static int kvmgt_write_protect_remove(unsigned long handle, u64 gfn)
static int kvmgt_page_track_remove(unsigned long handle, u64 gfn)
{
	struct kvmgt_guest_info *info;
	struct kvm *kvm;
@@ -1629,8 +1629,8 @@ struct intel_gvt_mpt kvmgt_mpt = {
	.detach_vgpu = kvmgt_detach_vgpu,
	.inject_msi = kvmgt_inject_msi,
	.from_virt_to_mfn = kvmgt_virt_to_pfn,
	.set_wp_page = kvmgt_write_protect_add,
	.unset_wp_page = kvmgt_write_protect_remove,
	.enable_page_track = kvmgt_page_track_add,
	.disable_page_track = kvmgt_page_track_remove,
	.read_gpa = kvmgt_read_gpa,
	.write_gpa = kvmgt_write_gpa,
	.gfn_to_mfn = kvmgt_gfn_to_pfn,
+4 −5
Original line number Diff line number Diff line
@@ -154,7 +154,7 @@ static inline unsigned long intel_gvt_hypervisor_virt_to_mfn(void *p)
}

/**
 * intel_gvt_hypervisor_enable - set a guest page to write-protected
 * intel_gvt_hypervisor_enable_page_track - track a guest page
 * @vgpu: a vGPU
 * @t: page track data structure
 *
@@ -170,7 +170,7 @@ static inline int intel_gvt_hypervisor_enable_page_track(
	if (t->tracked)
		return 0;

	ret = intel_gvt_host.mpt->set_wp_page(vgpu->handle, t->gfn);
	ret = intel_gvt_host.mpt->enable_page_track(vgpu->handle, t->gfn);
	if (ret)
		return ret;
	t->tracked = true;
@@ -179,8 +179,7 @@ static inline int intel_gvt_hypervisor_enable_page_track(
}

/**
 * intel_gvt_hypervisor_disable_page_track - remove the write-protection of a
 * guest page
 * intel_gvt_hypervisor_disable_page_track - untrack a guest page
 * @vgpu: a vGPU
 * @t: page track data structure
 *
@@ -196,7 +195,7 @@ static inline int intel_gvt_hypervisor_disable_page_track(
	if (!t->tracked)
		return 0;

	ret = intel_gvt_host.mpt->unset_wp_page(vgpu->handle, t->gfn);
	ret = intel_gvt_host.mpt->disable_page_track(vgpu->handle, t->gfn);
	if (ret)
		return ret;
	t->tracked = false;