]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.6.5/drm-radeon-fix-asic-initialization-for-virtualized-environments.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.6.5 / drm-radeon-fix-asic-initialization-for-virtualized-environments.patch
1 From 05082b8bbd1a0ffc74235449c4b8930a8c240f85 Mon Sep 17 00:00:00 2001
2 From: Alex Deucher <alexander.deucher@amd.com>
3 Date: Mon, 13 Jun 2016 15:37:34 -0400
4 Subject: drm/radeon: fix asic initialization for virtualized environments
5
6 From: Alex Deucher <alexander.deucher@amd.com>
7
8 commit 05082b8bbd1a0ffc74235449c4b8930a8c240f85 upstream.
9
10 When executing in a PCI passthrough based virtuzliation environment, the
11 hypervisor will usually attempt to send a PCIe bus reset signal to the
12 ASIC when the VM reboots. In this scenario, the card is not correctly
13 initialized, but we still consider it to be posted. Therefore, in a
14 passthrough based environemnt we should always post the card to guarantee
15 it is in a good state for driver initialization.
16
17 Ported from amdgpu commit:
18 amdgpu: fix asic initialization for virtualized environments
19
20 Cc: Andres Rodriguez <andres.rodriguez@amd.com>
21 Cc: Alex Williamson <alex.williamson@redhat.com>
22 Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
23 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24
25 ---
26 drivers/gpu/drm/radeon/radeon_device.c | 21 +++++++++++++++++++++
27 1 file changed, 21 insertions(+)
28
29 --- a/drivers/gpu/drm/radeon/radeon_device.c
30 +++ b/drivers/gpu/drm/radeon/radeon_device.c
31 @@ -630,6 +630,23 @@ void radeon_gtt_location(struct radeon_d
32 /*
33 * GPU helpers function.
34 */
35 +
36 +/**
37 + * radeon_device_is_virtual - check if we are running is a virtual environment
38 + *
39 + * Check if the asic has been passed through to a VM (all asics).
40 + * Used at driver startup.
41 + * Returns true if virtual or false if not.
42 + */
43 +static bool radeon_device_is_virtual(void)
44 +{
45 +#ifdef CONFIG_X86
46 + return boot_cpu_has(X86_FEATURE_HYPERVISOR);
47 +#else
48 + return false;
49 +#endif
50 +}
51 +
52 /**
53 * radeon_card_posted - check if the hw has already been initialized
54 *
55 @@ -643,6 +660,10 @@ bool radeon_card_posted(struct radeon_de
56 {
57 uint32_t reg;
58
59 + /* for pass through, always force asic_init */
60 + if (radeon_device_is_virtual())
61 + return false;
62 +
63 /* required for EFI mode on macbook2,1 which uses an r5xx asic */
64 if (efi_enabled(EFI_BOOT) &&
65 (rdev->pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE) &&