[2/2] drm/i915/gvt: Return error at the failure of finding page_track

Submitted by Xiong Zhang on March 5, 2018, 10:07 p.m.

Details

Message ID 1520287648-23759-2-git-send-email-xiong.y.zhang@intel.com
State New
Headers show
Series "Series without cover letter" ( rev: 2 1 ) in Intel GVT devel

Not browsing as part of any series.

Commit Message

Xiong Zhang March 5, 2018, 10:07 p.m.
In XenGT, ioreq copy is used to trap mmio write and ppgtt write. Both
of them are memory write, ioreq handler couldn't distinguish them. So
ioreq handler probe the ppgtt write handler, if it is succuess, this
ioreq is ppgtt write, otherwise it is mmio write.

So ppgtt write handler should return an error at the failure of finding
page track, it is fatal to implement ioreq handler in XenGT.

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
---
 drivers/gpu/drm/i915/gvt/page_track.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/i915/gvt/page_track.c b/drivers/gpu/drm/i915/gvt/page_track.c
index 2d03054..53e2bd7 100644
--- a/drivers/gpu/drm/i915/gvt/page_track.c
+++ b/drivers/gpu/drm/i915/gvt/page_track.c
@@ -164,8 +164,10 @@  int intel_vgpu_page_track_handler(struct intel_vgpu *vgpu, u64 gpa,
 	mutex_lock(&gvt->lock);
 
 	page_track = intel_vgpu_find_page_track(vgpu, gpa >> PAGE_SHIFT);
-	if (!page_track)
+	if (!page_track) {
+		ret = -ENXIO;
 		goto out;
+	}
 
 	if (unlikely(vgpu->failsafe)) {
 		/* Remove write protection to prevent furture traps. */

Comments

On 2018.03.06 06:07:28 +0800, Xiong Zhang wrote:
> In XenGT, ioreq copy is used to trap mmio write and ppgtt write. Both
> of them are memory write, ioreq handler couldn't distinguish them. So
> ioreq handler probe the ppgtt write handler, if it is succuess, this
> ioreq is ppgtt write, otherwise it is mmio write.
> 
> So ppgtt write handler should return an error at the failure of finding
> page track, it is fatal to implement ioreq handler in XenGT.
> 
> Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
> ---
>  drivers/gpu/drm/i915/gvt/page_track.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/gvt/page_track.c b/drivers/gpu/drm/i915/gvt/page_track.c
> index 2d03054..53e2bd7 100644
> --- a/drivers/gpu/drm/i915/gvt/page_track.c
> +++ b/drivers/gpu/drm/i915/gvt/page_track.c
> @@ -164,8 +164,10 @@ int intel_vgpu_page_track_handler(struct intel_vgpu *vgpu, u64 gpa,
>  	mutex_lock(&gvt->lock);
>  
>  	page_track = intel_vgpu_find_page_track(vgpu, gpa >> PAGE_SHIFT);
> -	if (!page_track)
> +	if (!page_track) {
> +		ret = -ENXIO;
>  		goto out;
> +	}
>  
>  	if (unlikely(vgpu->failsafe)) {
>  		/* Remove write protection to prevent furture traps. */
> -- 

Reasonable to keep original return design. Applied, thanks!