From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: linux-hyperv@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-pci@vger.kernel.org, Bjorn Helgaas <bhelgaas@google.com>,
Wei Liu <wei.liu@kernel.org>,
Deepak Rawat <drawat.floss@gmail.com>,
"K. Y. Srinivasan" <kys@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
Stephen Hemminger <sthemmin@microsoft.com>,
Dexuan Cui <decui@microsoft.com>,
Michael Kelley <mikelley@microsoft.com>
Subject: [PATCH v2 0/3] Drivers: hv: Avoid allocating MMIO from framebuffer region for other passed through PCI devices
Date: Thu, 25 Aug 2022 11:00:21 +0200 [thread overview]
Message-ID: <20220825090024.1007883-1-vkuznets@redhat.com> (raw)
Changes since v1:
- Dropped PATCH2 as it is no longer needed.
- Move PCI ids to linux/pci_ids.h [Michael]
- Correctly handle "!(pdev->resource[0].flags & IORESOURCE_MEM)" case
[Michael].
Passed through PCI device sometimes misbehave on Gen1 VMs when Hyper-V
DRM driver is also loaded. Looking at IOMEM assignment, we can see e.g.
$ cat /proc/iomem
...
f8000000-fffbffff : PCI Bus 0000:00
f8000000-fbffffff : 0000:00:08.0
f8000000-f8001fff : bb8c4f33-2ba2-4808-9f7f-02f3b4da22fe
...
fe0000000-fffffffff : PCI Bus 0000:00
fe0000000-fe07fffff : bb8c4f33-2ba2-4808-9f7f-02f3b4da22fe
fe0000000-fe07fffff : 2ba2:00:02.0
fe0000000-fe07fffff : mlx4_core
the interesting part is the 'f8000000' region as it is actually the
VM's framebuffer:
$ lspci -v
...
0000:00:08.0 VGA compatible controller: Microsoft Corporation Hyper-V virtual VGA (prog-if 00 [VGA controller])
Flags: bus master, fast devsel, latency 0, IRQ 11
Memory at f8000000 (32-bit, non-prefetchable) [size=64M]
...
Recently merged commit a0ab5abced55 ("drm/hyperv : Removing the restruction of
VRAM allocation with PCI bar size") improved the situation as resources,
reserved through vmbus_allocate_mmio() can't be allocated twice:
...
f8000000-fffbffff : PCI Bus 0000:00
f8000000-fbffffff : 0000:00:08.0
f8000000-f8001fff : bb8c4f33-2ba2-4808-9f7f-02f3b4da22fe
f8100000-f88fffff : 5620e0c7-8062-4dce-aeb7-520c7ef76171
...
Always reserve FB region on Gen1 VMs (PATCH2) and make sure we never allocate
anything besides framebuffer from there (PATCH3).
Vitaly Kuznetsov (3):
PCI: Move PCI_VENDOR_ID_MICROSOFT/PCI_DEVICE_ID_HYPERV_VIDEO
definitions to pci_ids.h
Drivers: hv: Always reserve framebuffer region for Gen1 VMs
Drivers: hv: Never allocate anything besides framebuffer from
framebuffer memory region
drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 3 -
drivers/hv/vmbus_drv.c | 56 ++++++++++++++-----
.../net/ethernet/microsoft/mana/gdma_main.c | 4 --
drivers/video/fbdev/hyperv_fb.c | 4 --
include/linux/pci_ids.h | 3 +
5 files changed, 44 insertions(+), 26 deletions(-)
--
2.37.1
WARNING: multiple messages have this Message-ID (diff)
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: linux-hyperv@vger.kernel.org
Cc: Wei Liu <wei.liu@kernel.org>,
Stephen Hemminger <sthemmin@microsoft.com>,
linux-pci@vger.kernel.org, Haiyang Zhang <haiyangz@microsoft.com>,
Dexuan Cui <decui@microsoft.com>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
Michael Kelley <mikelley@microsoft.com>,
Deepak Rawat <drawat.floss@gmail.com>,
Bjorn Helgaas <bhelgaas@google.com>,
"K. Y. Srinivasan" <kys@microsoft.com>
Subject: [PATCH v2 0/3] Drivers: hv: Avoid allocating MMIO from framebuffer region for other passed through PCI devices
Date: Thu, 25 Aug 2022 11:00:21 +0200 [thread overview]
Message-ID: <20220825090024.1007883-1-vkuznets@redhat.com> (raw)
Changes since v1:
- Dropped PATCH2 as it is no longer needed.
- Move PCI ids to linux/pci_ids.h [Michael]
- Correctly handle "!(pdev->resource[0].flags & IORESOURCE_MEM)" case
[Michael].
Passed through PCI device sometimes misbehave on Gen1 VMs when Hyper-V
DRM driver is also loaded. Looking at IOMEM assignment, we can see e.g.
$ cat /proc/iomem
...
f8000000-fffbffff : PCI Bus 0000:00
f8000000-fbffffff : 0000:00:08.0
f8000000-f8001fff : bb8c4f33-2ba2-4808-9f7f-02f3b4da22fe
...
fe0000000-fffffffff : PCI Bus 0000:00
fe0000000-fe07fffff : bb8c4f33-2ba2-4808-9f7f-02f3b4da22fe
fe0000000-fe07fffff : 2ba2:00:02.0
fe0000000-fe07fffff : mlx4_core
the interesting part is the 'f8000000' region as it is actually the
VM's framebuffer:
$ lspci -v
...
0000:00:08.0 VGA compatible controller: Microsoft Corporation Hyper-V virtual VGA (prog-if 00 [VGA controller])
Flags: bus master, fast devsel, latency 0, IRQ 11
Memory at f8000000 (32-bit, non-prefetchable) [size=64M]
...
Recently merged commit a0ab5abced55 ("drm/hyperv : Removing the restruction of
VRAM allocation with PCI bar size") improved the situation as resources,
reserved through vmbus_allocate_mmio() can't be allocated twice:
...
f8000000-fffbffff : PCI Bus 0000:00
f8000000-fbffffff : 0000:00:08.0
f8000000-f8001fff : bb8c4f33-2ba2-4808-9f7f-02f3b4da22fe
f8100000-f88fffff : 5620e0c7-8062-4dce-aeb7-520c7ef76171
...
Always reserve FB region on Gen1 VMs (PATCH2) and make sure we never allocate
anything besides framebuffer from there (PATCH3).
Vitaly Kuznetsov (3):
PCI: Move PCI_VENDOR_ID_MICROSOFT/PCI_DEVICE_ID_HYPERV_VIDEO
definitions to pci_ids.h
Drivers: hv: Always reserve framebuffer region for Gen1 VMs
Drivers: hv: Never allocate anything besides framebuffer from
framebuffer memory region
drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 3 -
drivers/hv/vmbus_drv.c | 56 ++++++++++++++-----
.../net/ethernet/microsoft/mana/gdma_main.c | 4 --
drivers/video/fbdev/hyperv_fb.c | 4 --
include/linux/pci_ids.h | 3 +
5 files changed, 44 insertions(+), 26 deletions(-)
--
2.37.1
next reply other threads:[~2022-08-25 9:00 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-25 9:00 Vitaly Kuznetsov [this message]
2022-08-25 9:00 ` [PATCH v2 0/3] Drivers: hv: Avoid allocating MMIO from framebuffer region for other passed through PCI devices Vitaly Kuznetsov
2022-08-25 9:00 ` [PATCH v2 1/3] PCI: Move PCI_VENDOR_ID_MICROSOFT/PCI_DEVICE_ID_HYPERV_VIDEO definitions to pci_ids.h Vitaly Kuznetsov
2022-08-25 9:00 ` Vitaly Kuznetsov
2022-08-25 14:36 ` Michael Kelley (LINUX)
2022-08-25 14:36 ` Michael Kelley (LINUX)
2022-08-25 15:43 ` Bjorn Helgaas
2022-08-25 15:43 ` Bjorn Helgaas
2022-08-25 9:00 ` [PATCH v2 2/3] Drivers: hv: Always reserve framebuffer region for Gen1 VMs Vitaly Kuznetsov
2022-08-25 9:00 ` Vitaly Kuznetsov
2022-08-25 14:43 ` Michael Kelley (LINUX)
2022-08-25 14:43 ` Michael Kelley (LINUX)
2022-08-27 12:44 ` Vitaly Kuznetsov
2022-08-27 12:44 ` Vitaly Kuznetsov
2022-08-25 9:00 ` [PATCH v2 3/3] Drivers: hv: Never allocate anything besides framebuffer from framebuffer memory region Vitaly Kuznetsov
2022-08-25 9:00 ` Vitaly Kuznetsov
2022-08-25 15:13 ` Michael Kelley (LINUX)
2022-08-25 15:13 ` Michael Kelley (LINUX)
2022-08-27 12:46 ` Vitaly Kuznetsov
2022-08-27 12:46 ` Vitaly Kuznetsov
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=20220825090024.1007883-1-vkuznets@redhat.com \
--to=vkuznets@redhat.com \
--cc=bhelgaas@google.com \
--cc=decui@microsoft.com \
--cc=drawat.floss@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=haiyangz@microsoft.com \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mikelley@microsoft.com \
--cc=sthemmin@microsoft.com \
--cc=wei.liu@kernel.org \
/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.