From: Zhi Wang <zhi.a.wang@intel.com>
To: qemu-devel@nongnu.org
Cc: chuanxiao.dong@intel.com, daniel.vetter@ffwll.ch,
xiong.y.zhang@intel.com, joonas.lahtinen@linux.intel.com,
zhiyuan.lv@intel.com, zhenyuw@linux.intel.com,
kevin.tian@intel.com, Zhi Wang <zhi.a.wang@intel.com>
Subject: [Qemu-devel] [RFC 4/6] vfio: Refine GGTT clearing
Date: Tue, 30 May 2017 01:30:34 +0800 [thread overview]
Message-ID: <1496079043-26694-5-git-send-email-zhi.a.wang@intel.com> (raw)
In-Reply-To: <1496079043-26694-1-git-send-email-zhi.a.wang@intel.com>
Clear the whole GGTT page tables after the quirk is initialized. Obtain
the total size of GGTT and the entry size of one GGTT entry from
intel_device_info().
Suggested-by: Xiong Zhang <xiong.y.zhang@intel.com>
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com>
---
hw/vfio/pci-quirks.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c
index 5a083c1..618c43c 100644
--- a/hw/vfio/pci-quirks.c
+++ b/hw/vfio/pci-quirks.c
@@ -1365,7 +1365,7 @@ static void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr)
const struct intel_device_info *info;
void *stolen;
PCIDevice *lpc_bridge;
- int i, ret;
+ int i, j, ret;
uint64_t bdsm_size;
uint32_t gmch;
uint16_t cmd_orig, cmd;
@@ -1570,9 +1570,11 @@ static void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr)
vdev->vbasedev.name);
}
- for (i = 1; i < vfio_igd_gtt_max(vdev); i += 4) {
- vfio_region_write(&vdev->bars[4].region, 0, i, 4);
- vfio_region_write(&vdev->bars[4].region, 4, 0, 4);
+ for (i = 1; i < info->get_gtt_size(gmch); i += info->gtt_entry_size) {
+ for (j = 0; j < info->gtt_entry_size; j += 4) {
+ vfio_region_write(&vdev->bars[4].region, 0, i + j, 4);
+ vfio_region_write(&vdev->bars[4].region, 4, 0, 4);
+ }
}
if (pwrite(vdev->vbasedev.fd, &cmd_orig, sizeof(cmd_orig),
--
2.7.4
next prev parent reply other threads:[~2017-05-29 8:33 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-29 17:30 [Qemu-devel] [RFC 0/6] Refine IGD stolen memory support in VFIO Zhi Wang
2017-05-29 8:29 ` Zhi Wang
2017-05-31 22:13 ` Wang, Zhi A
2017-05-29 8:43 ` no-reply
2017-05-29 8:45 ` no-reply
2017-05-29 8:50 ` no-reply
2017-05-29 17:30 ` [Qemu-devel] [RFC 1/6] vfio: Add Intel platform definitions Zhi Wang
2017-05-29 17:30 ` [Qemu-devel] [RFC 2/6] vfio: Setup IGD quirks earlier Zhi Wang
2017-06-01 20:34 ` Alex Williamson
2017-05-29 17:30 ` [Qemu-devel] [RFC 3/6] vfio: Setup IGD stolen memory Zhi Wang
2017-06-01 21:10 ` Alex Williamson
2017-05-29 17:30 ` Zhi Wang [this message]
2017-05-29 17:30 ` [Qemu-devel] [RFC 5/6] vfio: Remove extra quirks and old definitions Zhi Wang
2017-05-29 17:30 ` [Qemu-devel] [RFC 6/6] vfio: Setup IGD stolen memory under secondary mode Zhi Wang
2017-05-29 17:30 ` [Qemu-devel] [RFC 0/6] Refine IGD stolen memory support in VFIO Zhi Wang
2017-06-01 2:52 ` Tian, Kevin
2017-05-29 17:30 ` [Qemu-devel] [RFC 1/6] vfio: Add Intel platform definitions Zhi Wang
2017-06-01 20:22 ` Alex Williamson
2017-05-29 17:30 ` [Qemu-devel] [RFC 2/6] vfio: Setup IGD quirks earlier Zhi Wang
2017-05-29 17:30 ` [Qemu-devel] [RFC 3/6] vfio: Setup IGD stolen memory Zhi Wang
2017-05-29 17:30 ` [Qemu-devel] [RFC 4/6] vfio: Refine GGTT clearing Zhi Wang
2017-05-29 17:30 ` [Qemu-devel] [RFC 5/6] vfio: Remove extra quirks and old definitions Zhi Wang
2017-05-29 17:30 ` [Qemu-devel] [RFC 6/6] vfio: Setup IGD stolen memory under secondary mode Zhi Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1496079043-26694-5-git-send-email-zhi.a.wang@intel.com \
--to=zhi.a.wang@intel.com \
--cc=chuanxiao.dong@intel.com \
--cc=daniel.vetter@ffwll.ch \
--cc=joonas.lahtinen@linux.intel.com \
--cc=kevin.tian@intel.com \
--cc=qemu-devel@nongnu.org \
--cc=xiong.y.zhang@intel.com \
--cc=zhenyuw@linux.intel.com \
--cc=zhiyuan.lv@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.