Blob Blame History Raw
From 5d5fe176155e6cfa4a53accb90e4010baa5266d0 Mon Sep 17 00:00:00 2001
From: Changbin Du <changbin.du@intel.com>
Date: Tue, 15 Aug 2017 13:20:51 +0800
Subject: [PATCH] drm/i915/kvmgt: Sanitize PCI bar emulation
Git-commit: 5d5fe176155e6cfa4a53accb90e4010baa5266d0
Patch-mainline: v4.15-rc1
References: FATE#322643 bsc#1055900

For PCI, 64bit bar consumes two BAR registers, but this doesn't mean
both of two BAR are valid. Actually the second BAR is regarded as
reserved in this case. So we shouldn't emulate the second BAR.

Signed-off-by: Changbin Du <changbin.du@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Acked-by: Takashi Iwai <tiwai@suse.de>

---
 drivers/gpu/drm/i915/gvt/kvmgt.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/gpu/drm/i915/gvt/kvmgt.c
+++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
@@ -661,7 +661,6 @@ static ssize_t intel_vgpu_rw(struct mdev
 						buf, count);
 		break;
 	case VFIO_PCI_BAR0_REGION_INDEX:
-	case VFIO_PCI_BAR1_REGION_INDEX:
 		if (is_write) {
 			uint64_t bar0_start = intel_vgpu_get_bar0_addr(vgpu);
 
@@ -674,6 +673,7 @@ static ssize_t intel_vgpu_rw(struct mdev
 						bar0_start + pos, buf, count);
 		}
 		break;
+	case VFIO_PCI_BAR1_REGION_INDEX:
 	case VFIO_PCI_BAR2_REGION_INDEX:
 	case VFIO_PCI_BAR3_REGION_INDEX:
 	case VFIO_PCI_BAR4_REGION_INDEX: