summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Boyer <jwboyer@fedoraproject.org>2015-09-08 08:34:33 -0400
committerJosh Boyer <jwboyer@fedoraproject.org>2015-09-08 08:34:33 -0400
commit31448c54f6beec3379570633eef2436db361b26f (patch)
tree70db236286c758ba8e346e3b770b8fe1d60adfe8
parentf88858c592075f9b1ac9149d8c150025e944ebcc (diff)
downloadkernel-31448c54f6beec3379570633eef2436db361b26f.tar.gz
kernel-31448c54f6beec3379570633eef2436db361b26f.tar.xz
kernel-31448c54f6beec3379570633eef2436db361b26f.zip
Linux v4.2-9700-g7d9071a09502
-rw-r--r--config-arm644
-rw-r--r--config-armv72
-rw-r--r--config-armv7-generic7
-rw-r--r--config-generic14
-rw-r--r--config-x86-generic1
-rw-r--r--disable-i8042-check-on-apple-mac.patch12
-rw-r--r--drm-i915-hush-check-crtc-state.patch18
-rw-r--r--drm-vmwgfx-Allow-dropped-masters-render-node-like-ac.patch60
-rw-r--r--kernel.spec12
-rw-r--r--nv46-Change-mc-subdev-oclass-from-nv44-to-nv4c.patch33
-rw-r--r--sources2
-rw-r--r--vmwgfx-Rework-device-initialization.patch890
12 files changed, 52 insertions, 1003 deletions
diff --git a/config-arm64 b/config-arm64
index b67c48243..5773c1cb5 100644
--- a/config-arm64
+++ b/config-arm64
@@ -41,6 +41,10 @@ CONFIG_ARCH_REQUIRE_GPIOLIB=y
CONFIG_ARM64_64K_PAGES=y
# CONFIG_COMPAT is not set
+CONFIG_ARM64_HW_AFDBM=y
+CONFIG_ARM64_PAN=y
+CONFIG_ARM64_LSE_ATOMICS=y
+
CONFIG_BCMA_POSSIBLE=y
CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
CONFIG_BRCMUTIL=m
diff --git a/config-armv7 b/config-armv7
index f9369e44c..2f9e02ba7 100644
--- a/config-armv7
+++ b/config-armv7
@@ -278,6 +278,7 @@ CONFIG_PINCTRL_MSM8960=m
CONFIG_PINCTRL_MSM8X74=m
CONFIG_PINCTRL_MSM8916=m
CONFIG_PINCTRL_QCOM_SPMI_PMIC=m
+CONFIG_PINCTRL_QCOM_SSBI_PMIC=m
CONFIG_COMMON_CLK_QCOM=m
# CONFIG_MSM_GCC_8916 is not set
# CONFIG_IPQ_LCC_806X is not set
@@ -610,6 +611,7 @@ CONFIG_CADENCE_WATCHDOG=m
CONFIG_REGULATOR_ISL9305=m
CONFIG_EDAC_SYNOPSYS=m
CONFIG_PINCTRL_ZYNQ=y
+CONFIG_AXI_DMAC=m
# Multi function devices
CONFIG_MFD_88PM800=m
diff --git a/config-armv7-generic b/config-armv7-generic
index 19964c5df..73be11503 100644
--- a/config-armv7-generic
+++ b/config-armv7-generic
@@ -183,6 +183,7 @@ CONFIG_MACH_SUN7I=y
CONFIG_MACH_SUN8I=y
# CONFIG_MACH_SUN9I is not set
CONFIG_SUNXI_SRAM=y
+# CONFIG_DMA_SUN4I is not set
CONFIG_DMA_SUN6I=m
CONFIG_SUNXI_WATCHDOG=m
CONFIG_NET_VENDOR_ALLWINNER=y
@@ -350,6 +351,8 @@ CONFIG_DRM_ROCKCHIP=m
CONFIG_ROCKCHIP_DW_HDMI=m
CONFIG_PHY_ROCKCHIP_USB=m
CONFIG_DWMAC_ROCKCHIP=m
+CONFIG_SND_SOC_ROCKCHIP_MAX98090=m
+CONFIG_SND_SOC_ROCKCHIP_RT5645=m
# Tegra
CONFIG_ARCH_TEGRA_114_SOC=y
@@ -465,6 +468,9 @@ CONFIG_DRM_PANEL_SIMPLE=m
CONFIG_DRM_PANEL_LD9040=m
CONFIG_DRM_PANEL_S6E8AA0=m
CONFIG_DRM_PANEL_SHARP_LQ101R1SX01=m
+CONFIG_DRM_PANEL_LG_LG4573=m
+CONFIG_DRM_PANEL_SAMSUNG_LD9040=m
+CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0=m
CONFIG_DRM_DW_HDMI=m
# regmap
@@ -856,6 +862,7 @@ CONFIG_R8188EU=m
# CONFIG_DRM_TILCDC is not set
# CONFIG_DRM_IMX is not set
# CONFIG_DRM_STI is not set
+# CONFIG_DRM_FSL_DCU is not set
# CONFIG_AHCI_IMX is not set
# CONFIG_IMX_THERMAL is not set
# CONFIG_TI_DAC7512 is not set
diff --git a/config-generic b/config-generic
index 243263547..5e8c88c2f 100644
--- a/config-generic
+++ b/config-generic
@@ -54,6 +54,7 @@ CONFIG_FUTEX=y
# CONFIG_FAIL_FUTEX is not set
CONFIG_EPOLL=y
CONFIG_BPF_SYSCALL=y
+CONFIG_USERFAULTFD=y
CONFIG_IOSCHED_NOOP=y
CONFIG_IOSCHED_DEADLINE=y
CONFIG_IOSCHED_CFQ=y
@@ -3162,6 +3163,7 @@ CONFIG_VGA_ARB_MAX_GPUS=16
CONFIG_DRM=m
+CONFIG_DRM_FBDEV_EMULATION=y
CONFIG_DRM_LOAD_EDID_FIRMWARE=y
CONFIG_DRM_AST=m # do not enable on f17 or older
CONFIG_DRM_CIRRUS_QEMU=m # do not enable on f17 or older
@@ -3190,6 +3192,8 @@ CONFIG_DRM_NOUVEAU_BACKLIGHT=y
CONFIG_DRM_I2C_ADV7511=m
CONFIG_DRM_I2C_CH7006=m
CONFIG_DRM_I2C_SIL164=m
+# CONFIG_DRM_NXP_PTN3460 is not set
+# CONFIG_DRM_PARADE_PS8622 is not set
CONFIG_DRM_I2C_NXP_TDA998X=m
CONFIG_DRM_UDL=m
CONFIG_DRM_VMWGFX=m
@@ -3202,6 +3206,7 @@ CONFIG_DRM_PS8622=m
# CONFIG_DRM_PANEL is not set
# CONFIG_DRM_PANEL_SIMPLE is not set
# CONFIG_DRM_PANEL_S6E8AA0 is not set
+# CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0 is not set
CONFIG_DRM_VGEM=m
#
@@ -3373,6 +3378,7 @@ CONFIG_DVB_FIREDTV=m
CONFIG_DVB_NGENE=m
CONFIG_DVB_DDBRIDGE=m
CONFIG_DVB_SMIPCIE=m
+CONFIG_DVB_NETUP_UNIDVB=m
CONFIG_DVB_USB_TECHNISAT_USB2=m
CONFIG_DVB_USB_V2=m
@@ -3474,6 +3480,7 @@ CONFIG_V4L_MEM2MEM_DRIVERS=y
# CONFIG_VIDEO_SH_VEU is not set
# CONFIG_VIDEO_RENESAS_VSP1 is not set
# CONFIG_V4L_TEST_DRIVERS is not set
+# CONFIG_DVB_PLATFORM_DRIVERS is not set
#
# Broadcom Crystal HD video decoder driver
@@ -4295,6 +4302,7 @@ CONFIG_MFD_VIPERBOARD=m
# CONFIG_MFD_RT5033 is not set
# CONFIG_MFD_SKY81452 is not set
# CONFIG_MFD_MAX77843 is not set
+# CONFIG_MFD_DA9062 is not set
# CONFIG_EZX_PCAP is not set
# CONFIG_INTEL_SOC_PMIC is not set
@@ -4882,6 +4890,7 @@ CONFIG_BACKLIGHT_LP855X=m
# CONFIG_BACKLIGHT_GPIO is not set
# CONFIG_BACKLIGHT_LV5207LP is not set
# CONFIG_BACKLIGHT_BD6107 is not set
+# CONFIG_BACKLIGHT_PM8941_WLED is not set
CONFIG_LCD_CLASS_DEVICE=m
CONFIG_LCD_PLATFORM=m
@@ -5102,6 +5111,10 @@ CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y
# CONFIG_SND_SOC_TS3A227E is not set
# CONFIG_SND_SOC_XTFPGA_I2S is not set
# CONFIG_SND_SOC_STA32X is not set
+# CONFIG_SND_SOC_CS4349 is not set
+# CONFIG_SND_SOC_GTM601 is not set
+# CONFIG_SND_SOC_STI_SAS is not set
+#
CONFIG_BALLOON_COMPACTION=y
CONFIG_COMPACTION=y
@@ -5567,6 +5580,7 @@ CONFIG_GPIO_VIPERBOARD=m
# CONFIG_GPIO_MCP23S08 is not set
# CONFIG_GPIO_XILINX is not set
# CONFIG_GPIO_ALTERA is not set
+# CONFIG_GPIO_ZX is not set
# FIXME: Why?
diff --git a/config-x86-generic b/config-x86-generic
index b5cb19625..9177a0102 100644
--- a/config-x86-generic
+++ b/config-x86-generic
@@ -113,6 +113,7 @@ CONFIG_XPOWER_PMIC_OPREGION=y
CONFIG_GPIO_CRYSTAL_COVE=y
CONFIG_AXP288_ADC=y
CONFIG_AXP288_FUEL_GAUGE=y
+# CONFIG_PWM_CRC is not set
CONFIG_X86_INTEL_PSTATE=y
diff --git a/disable-i8042-check-on-apple-mac.patch b/disable-i8042-check-on-apple-mac.patch
index 970d833d4..e75028da2 100644
--- a/disable-i8042-check-on-apple-mac.patch
+++ b/disable-i8042-check-on-apple-mac.patch
@@ -1,3 +1,4 @@
+From 31e64826785b5bafef7a6361516c060be2bca253 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Thu, 20 May 2010 10:30:31 -0400
Subject: [PATCH] disable i8042 check on apple mac
@@ -17,11 +18,11 @@ Signed-off-by: Bastien Nocera <hadess@hadess.net>
1 file changed, 22 insertions(+)
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
-index 4022b75eaad7..1aaf06aa7b0f 100644
+index c9c98f0ab284..5137185e14a9 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
-@@ -1506,6 +1506,22 @@ static struct platform_driver i8042_driver = {
- .shutdown = i8042_shutdown,
+@@ -1540,6 +1540,22 @@ static struct notifier_block i8042_kbd_bind_notifier_block = {
+ .notifier_call = i8042_kbd_bind_notifier,
};
+#ifdef CONFIG_DMI
@@ -43,7 +44,7 @@ index 4022b75eaad7..1aaf06aa7b0f 100644
static int __init i8042_init(void)
{
struct platform_device *pdev;
-@@ -1513,6 +1529,12 @@ static int __init i8042_init(void)
+@@ -1547,6 +1563,12 @@ static int __init i8042_init(void)
dbg_init();
@@ -56,3 +57,6 @@ index 4022b75eaad7..1aaf06aa7b0f 100644
err = i8042_platform_init();
if (err)
return err;
+--
+2.4.3
+
diff --git a/drm-i915-hush-check-crtc-state.patch b/drm-i915-hush-check-crtc-state.patch
index 31df993a0..fa4baffbf 100644
--- a/drm-i915-hush-check-crtc-state.patch
+++ b/drm-i915-hush-check-crtc-state.patch
@@ -1,3 +1,4 @@
+From 02f47b49ab1cdbe62ceb71b658e2c469799ae368 Mon Sep 17 00:00:00 2001
From: Adam Jackson <ajax@redhat.com>
Date: Wed, 13 Nov 2013 10:17:24 -0500
Subject: [PATCH] drm/i915: hush check crtc state
@@ -14,15 +15,18 @@ Upstream-status: http://lists.freedesktop.org/archives/intel-gfx/2013-November/0
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
-index 647b1404c441..e102a06f26e0 100644
+index ca9278be49f7..308ac0539a87 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
-@@ -12322,7 +12322,7 @@ check_crtc_state(struct drm_device *dev)
-
- if (active &&
- !intel_pipe_config_compare(dev, crtc->config, &pipe_config)) {
+@@ -12688,7 +12688,7 @@ check_crtc_state(struct drm_device *dev, struct drm_atomic_state *old_state)
+ sw_config = to_intel_crtc_state(crtc->state);
+ if (!intel_pipe_config_compare(dev, sw_config,
+ pipe_config, false)) {
- I915_STATE_WARN(1, "pipe state doesn't match!\n");
+ DRM_DEBUG_KMS("pipe state doesn't match!\n");
- intel_dump_pipe_config(crtc, &pipe_config,
+ intel_dump_pipe_config(intel_crtc, pipe_config,
"[hw state]");
- intel_dump_pipe_config(crtc, crtc->config,
+ intel_dump_pipe_config(intel_crtc, sw_config,
+--
+2.4.3
+
diff --git a/drm-vmwgfx-Allow-dropped-masters-render-node-like-ac.patch b/drm-vmwgfx-Allow-dropped-masters-render-node-like-ac.patch
deleted file mode 100644
index 70204e5e9..000000000
--- a/drm-vmwgfx-Allow-dropped-masters-render-node-like-ac.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-From a19afebb883f2a02ecf4b8d5a114ce6957a59238 Mon Sep 17 00:00:00 2001
-From: Thomas Hellstrom <thellstrom@vmware.com>
-Date: Wed, 26 Aug 2015 05:49:21 -0700
-Subject: [PATCH 2/2] drm/vmwgfx: Allow dropped masters render-node like access
- on legacy nodes v2
-
-Applications like gnome-shell may try to render after dropping master
-privileges. Since the driver should now be safe against this scenario,
-allow those applications to use their legacy node like a render node.
-
-v2: Add missing return statement.
-
-Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
-Reviewed-by: Sinclair Yeh <syeh@vmware.com>
----
- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 7 ++++++-
- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 6 ++++++
- 2 files changed, 12 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
-index a4766acd0ea2..d022b509f1ac 100644
---- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
-+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
-@@ -993,10 +993,15 @@ static struct vmw_master *vmw_master_check(struct drm_device *dev,
- }
-
- /*
-- * Check if we were previously master, but now dropped.
-+ * Check if we were previously master, but now dropped. In that
-+ * case, allow at least render node functionality.
- */
- if (vmw_fp->locked_master) {
- mutex_unlock(&dev->master_mutex);
-+
-+ if (flags & DRM_RENDER_ALLOW)
-+ return NULL;
-+
- DRM_ERROR("Dropped master trying to access ioctl that "
- "requires authentication.\n");
- return ERR_PTR(-EACCES);
-diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
-index 4d0c98edeb6a..7fc3e8abd0c4 100644
---- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
-+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
-@@ -906,6 +906,12 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv,
- "surface reference.\n");
- return -EACCES;
- }
-+ if (ACCESS_ONCE(vmw_fpriv(file_priv)->locked_master)) {
-+ DRM_ERROR("Locked master refused legacy "
-+ "surface reference.\n");
-+ return -EACCES;
-+ }
-+
- handle = u_handle;
- }
-
---
-2.4.3
-
diff --git a/kernel.spec b/kernel.spec
index 06cdeaee8..1f6556b94 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -67,7 +67,7 @@ Summary: The Linux kernel
# The rc snapshot level
%define rcrev 0
# The git snapshot level
-%define gitrev 7
+%define gitrev 8
# Set rpm version accordingly
%define rpmversion 4.%{upstream_sublevel}.0
%endif
@@ -587,16 +587,9 @@ Patch508: kexec-uefi-copy-secure_boot-flag-in-boot-params.patch
#rhbz 1239050
Patch509: ideapad-laptop-Add-Lenovo-Yoga-3-14-to-no_hw_rfkill-.patch
-#rhbz 1257534
-Patch513: nv46-Change-mc-subdev-oclass-from-nv44-to-nv4c.patch
-
#rhbz 1212201
Patch514: drm-qxl-validate-monitors-config-modes.patch
-#rhbz 1227193
-Patch517: vmwgfx-Rework-device-initialization.patch
-Patch518: drm-vmwgfx-Allow-dropped-masters-render-node-like-ac.patch
-
Patch519: security-device_cgroup-fix-RCU-lockdep-splat.patch
Patch520: ARM-dts-Fix-Makefile-target-for-sun4i-a10-itead-itea.patch
@@ -2050,6 +2043,9 @@ fi
#
#
%changelog
+* Sun Sep 06 2015 Josh Boyer <jwboyer@fedoraproject.org> - 4.3.0-0.rc0.git8.1
+- Linux v4.2-9700-g7d9071a09502
+
* Fri Sep 04 2015 Josh Boyer <jwboyer@fedoraproject.org>
- Add patch to fix alternatives oops from Thomas Gleixner (rhbz 1258223)
diff --git a/nv46-Change-mc-subdev-oclass-from-nv44-to-nv4c.patch b/nv46-Change-mc-subdev-oclass-from-nv44-to-nv4c.patch
deleted file mode 100644
index a6996faa1..000000000
--- a/nv46-Change-mc-subdev-oclass-from-nv44-to-nv4c.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 16f4f5f0dc33698b841bce71cbc0dd991935b7e1 Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Thu, 23 Jul 2015 17:20:12 +0200
-Subject: [PATCH] nv46: Change mc subdev oclass from nv44 to nv4c
-
-MSI interrupts appear to not work for nv46 based cards. Change the mc
-subdev oclass for these cards from nv44 to nv4c, the nv4c mc code is
-identical to the nv44 mc code except that it does not use msi
-(it does not define a msi_rearm callback).
-
-BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=90435
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
----
- drivers/gpu/drm/nouveau/nvkm/engine/device/nv40.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/nv40.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/nv40.c
-index c6301361d14f..b4ad791b4851 100644
---- a/drivers/gpu/drm/nouveau/nvkm/engine/device/nv40.c
-+++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/nv40.c
-@@ -265,7 +265,7 @@ nv40_identify(struct nvkm_device *device)
- device->oclass[NVDEV_SUBDEV_CLK ] = &nv40_clk_oclass;
- device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass;
- device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass;
-- device->oclass[NVDEV_SUBDEV_MC ] = nv44_mc_oclass;
-+ device->oclass[NVDEV_SUBDEV_MC ] = nv4c_mc_oclass;
- device->oclass[NVDEV_SUBDEV_BUS ] = nv31_bus_oclass;
- device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
- device->oclass[NVDEV_SUBDEV_FB ] = nv46_fb_oclass;
---
-2.4.3
-
diff --git a/sources b/sources
index db87ea025..067031b0b 100644
--- a/sources
+++ b/sources
@@ -1,3 +1,3 @@
3d5ea06d767e2f35c999eeadafc76523 linux-4.2.tar.xz
4c964bfba54d65b5b54cc898baddecad perf-man-4.2.tar.gz
-389256a3f09eeca30f035d5a05a7db53 patch-4.2-git7.xz
+ffc4f5b6a69dfe089d5025f88cccf360 patch-4.2-git8.xz
diff --git a/vmwgfx-Rework-device-initialization.patch b/vmwgfx-Rework-device-initialization.patch
deleted file mode 100644
index 183ba9c28..000000000
--- a/vmwgfx-Rework-device-initialization.patch
+++ /dev/null
@@ -1,890 +0,0 @@
-From c1d9b32d8ee2e97e2867fa759eb84d436cca0311 Mon Sep 17 00:00:00 2001
-From: Thomas Hellstrom <thellstrom@vmware.com>
-Date: Thu, 25 Jun 2015 10:47:43 -0700
-Subject: [PATCH 1/2] vmwgfx: Rework device initialization
-
-This commit reworks device initialization so that we always enable the
-FIFO at driver load, deferring SVGA enable until either first modeset
-or fbdev enable.
-This should always leave the fifo properly enabled for render- and
-control nodes.
-In addition,
-*) We disable the use of VRAM when SVGA is not enabled.
-*) We simplify PM support so that we only throw out resources on hibernate,
-not on suspend, since the device keeps its state on suspend.
-
-Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
-Reviewed-by: Sinclair Yeh <syeh@vmware.com>
----
- drivers/gpu/drm/vmwgfx/vmwgfx_context.c | 8 +-
- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 337 ++++++++++++++++++--------------
- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 19 +-
- drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | 4 +
- drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c | 12 +-
- drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 1 +
- drivers/gpu/drm/vmwgfx/vmwgfx_mob.c | 6 +-
- drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 1 +
- drivers/gpu/drm/vmwgfx/vmwgfx_shader.c | 4 +-
- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 12 +-
- 10 files changed, 230 insertions(+), 174 deletions(-)
-
-diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
-index 5ac92874404d..a8e370a55e90 100644
---- a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
-+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
-@@ -140,7 +140,7 @@ static void vmw_hw_context_destroy(struct vmw_resource *res)
- cmd->body.cid = cpu_to_le32(res->id);
-
- vmw_fifo_commit(dev_priv, sizeof(*cmd));
-- vmw_3d_resource_dec(dev_priv, false);
-+ vmw_fifo_resource_dec(dev_priv);
- }
-
- static int vmw_gb_context_init(struct vmw_private *dev_priv,
-@@ -220,7 +220,7 @@ static int vmw_context_init(struct vmw_private *dev_priv,
- cmd->body.cid = cpu_to_le32(res->id);
-
- vmw_fifo_commit(dev_priv, sizeof(*cmd));
-- (void) vmw_3d_resource_inc(dev_priv, false);
-+ vmw_fifo_resource_inc(dev_priv);
- vmw_resource_activate(res, vmw_hw_context_destroy);
- return 0;
-
-@@ -281,7 +281,7 @@ static int vmw_gb_context_create(struct vmw_resource *res)
- cmd->header.size = sizeof(cmd->body);
- cmd->body.cid = res->id;
- vmw_fifo_commit(dev_priv, sizeof(*cmd));
-- (void) vmw_3d_resource_inc(dev_priv, false);
-+ vmw_fifo_resource_inc(dev_priv);
-
- return 0;
-
-@@ -414,7 +414,7 @@ static int vmw_gb_context_destroy(struct vmw_resource *res)
- if (dev_priv->query_cid == res->id)
- dev_priv->query_cid_valid = false;
- vmw_resource_release_id(res);
-- vmw_3d_resource_dec(dev_priv, false);
-+ vmw_fifo_resource_dec(dev_priv);
-
- return 0;
- }
-diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
-index 620bb5cf617c..a4766acd0ea2 100644
---- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
-+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
-@@ -339,24 +339,47 @@ static int vmw_dummy_query_bo_create(struct vmw_private *dev_priv)
- return ret;
- }
-
--static int vmw_request_device(struct vmw_private *dev_priv)
-+/**
-+ * vmw_request_device_late - Perform late device setup
-+ *
-+ * @dev_priv: Pointer to device private.
-+ *
-+ * This function performs setup of otables and enables large command
-+ * buffer submission. These tasks are split out to a separate function
-+ * because it reverts vmw_release_device_early and is intended to be used
-+ * by an error path in the hibernation code.
-+ */
-+static int vmw_request_device_late(struct vmw_private *dev_priv)
- {
- int ret;
-
-- ret = vmw_fifo_init(dev_priv, &dev_priv->fifo);
-- if (unlikely(ret != 0)) {
-- DRM_ERROR("Unable to initialize FIFO.\n");
-- return ret;
-- }
-- vmw_fence_fifo_up(dev_priv->fman);
- if (dev_priv->has_mob) {
- ret = vmw_otables_setup(dev_priv);
- if (unlikely(ret != 0)) {
- DRM_ERROR("Unable to initialize "
- "guest Memory OBjects.\n");
-- goto out_no_mob;
-+ return ret;
- }
- }
-+
-+ return 0;
-+}
-+
-+static int vmw_request_device(struct vmw_private *dev_priv)
-+{
-+ int ret;
-+
-+ ret = vmw_fifo_init(dev_priv, &dev_priv->fifo);
-+ if (unlikely(ret != 0)) {
-+ DRM_ERROR("Unable to initialize FIFO.\n");
-+ return ret;
-+ }
-+ vmw_fence_fifo_up(dev_priv->fman);
-+
-+ ret = vmw_request_device_late(dev_priv);
-+ if (ret)
-+ goto out_no_mob;
-+
- ret = vmw_dummy_query_bo_create(dev_priv);
- if (unlikely(ret != 0))
- goto out_no_query_bo;
-@@ -364,15 +387,25 @@ static int vmw_request_device(struct vmw_private *dev_priv)
- return 0;
-
- out_no_query_bo:
-- if (dev_priv->has_mob)
-+ if (dev_priv->has_mob) {
-+ (void) ttm_bo_evict_mm(&dev_priv->bdev, VMW_PL_MOB);
- vmw_otables_takedown(dev_priv);
-+ }
- out_no_mob:
- vmw_fence_fifo_down(dev_priv->fman);
- vmw_fifo_release(dev_priv, &dev_priv->fifo);
- return ret;
- }
-
--static void vmw_release_device(struct vmw_private *dev_priv)
-+/**
-+ * vmw_release_device_early - Early part of fifo takedown.
-+ *
-+ * @dev_priv: Pointer to device private struct.
-+ *
-+ * This is the first part of command submission takedown, to be called before
-+ * buffer management is taken down.
-+ */
-+static void vmw_release_device_early(struct vmw_private *dev_priv)
- {
- /*
- * Previous destructions should've released
-@@ -382,64 +415,24 @@ static void vmw_release_device(struct vmw_private *dev_priv)
- BUG_ON(dev_priv->pinned_bo != NULL);
-
- ttm_bo_unref(&dev_priv->dummy_query_bo);
-- if (dev_priv->has_mob)
-+ if (dev_priv->has_mob) {
-+ ttm_bo_evict_mm(&dev_priv->bdev, VMW_PL_MOB);
- vmw_otables_takedown(dev_priv);
-- vmw_fence_fifo_down(dev_priv->fman);
-- vmw_fifo_release(dev_priv, &dev_priv->fifo);
--}
--
--
--/**
-- * Increase the 3d resource refcount.
-- * If the count was prevously zero, initialize the fifo, switching to svga
-- * mode. Note that the master holds a ref as well, and may request an
-- * explicit switch to svga mode if fb is not running, using @unhide_svga.
-- */
--int vmw_3d_resource_inc(struct vmw_private *dev_priv,
-- bool unhide_svga)
--{
-- int ret = 0;
--
-- mutex_lock(&dev_priv->release_mutex);
-- if (unlikely(dev_priv->num_3d_resources++ == 0)) {
-- ret = vmw_request_device(dev_priv);
-- if (unlikely(ret != 0))
-- --dev_priv->num_3d_resources;
-- } else if (unhide_svga) {
-- vmw_write(dev_priv, SVGA_REG_ENABLE,
-- vmw_read(dev_priv, SVGA_REG_ENABLE) &
-- ~SVGA_REG_ENABLE_HIDE);
- }
--
-- mutex_unlock(&dev_priv->release_mutex);
-- return ret;
- }
-
- /**
-- * Decrease the 3d resource refcount.
-- * If the count reaches zero, disable the fifo, switching to vga mode.
-- * Note that the master holds a refcount as well, and may request an
-- * explicit switch to vga mode when it releases its refcount to account
-- * for the situation of an X server vt switch to VGA with 3d resources
-- * active.
-+ * vmw_release_device_late - Late part of fifo takedown.
-+ *
-+ * @dev_priv: Pointer to device private struct.
-+ *
-+ * This is the last part of the command submission takedown, to be called when
-+ * command submission is no longer needed. It may wait on pending fences.
- */
--void vmw_3d_resource_dec(struct vmw_private *dev_priv,
-- bool hide_svga)
-+static void vmw_release_device_late(struct vmw_private *dev_priv)
- {
-- int32_t n3d;
--
-- mutex_lock(&dev_priv->release_mutex);
-- if (unlikely(--dev_priv->num_3d_resources == 0))
-- vmw_release_device(dev_priv);
-- else if (hide_svga)
-- vmw_write(dev_priv, SVGA_REG_ENABLE,
-- vmw_read(dev_priv, SVGA_REG_ENABLE) |
-- SVGA_REG_ENABLE_HIDE);
--
-- n3d = (int32_t) dev_priv->num_3d_resources;
-- mutex_unlock(&dev_priv->release_mutex);
--
-- BUG_ON(n3d < 0);
-+ vmw_fence_fifo_down(dev_priv->fman);
-+ vmw_fifo_release(dev_priv, &dev_priv->fifo);
- }
-
- /**
-@@ -603,6 +596,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
- spin_lock_init(&dev_priv->hw_lock);
- spin_lock_init(&dev_priv->waiter_lock);
- spin_lock_init(&dev_priv->cap_lock);
-+ spin_lock_init(&dev_priv->svga_lock);
-
- for (i = vmw_res_context; i < vmw_res_max; ++i) {
- idr_init(&dev_priv->res_idr[i]);
-@@ -714,17 +708,6 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
- dev_priv->active_master = &dev_priv->fbdev_master;
-
-
-- ret = ttm_bo_device_init(&dev_priv->bdev,
-- dev_priv->bo_global_ref.ref.object,
-- &vmw_bo_driver,
-- dev->anon_inode->i_mapping,
-- VMWGFX_FILE_PAGE_OFFSET,
-- false);
-- if (unlikely(ret != 0)) {
-- DRM_ERROR("Failed initializing TTM buffer object driver.\n");
-- goto out_err1;
-- }
--
- dev_priv->mmio_mtrr = arch_phys_wc_add(dev_priv->mmio_start,
- dev_priv->mmio_size);
-
-@@ -787,13 +770,28 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
- goto out_no_fman;
- }
-
-+ ret = ttm_bo_device_init(&dev_priv->bdev,
-+ dev_priv->bo_global_ref.ref.object,
-+ &vmw_bo_driver,
-+ dev->anon_inode->i_mapping,
-+ VMWGFX_FILE_PAGE_OFFSET,
-+ false);
-+ if (unlikely(ret != 0)) {
-+ DRM_ERROR("Failed initializing TTM buffer object driver.\n");
-+ goto out_no_bdev;
-+ }
-
-+ /*
-+ * Enable VRAM, but initially don't use it until SVGA is enabled and
-+ * unhidden.
-+ */
- ret = ttm_bo_init_mm(&dev_priv->bdev, TTM_PL_VRAM,
- (dev_priv->vram_size >> PAGE_SHIFT));
- if (unlikely(ret != 0)) {
- DRM_ERROR("Failed initializing memory manager for VRAM.\n");
- goto out_no_vram;
- }
-+ dev_priv->bdev.man[TTM_PL_VRAM].use_type = false;
-
- dev_priv->has_gmr = true;
- if (((dev_priv->capabilities & (SVGA_CAP_GMR | SVGA_CAP_GMR2)) == 0) ||
-@@ -814,18 +812,18 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
- }
- }
-
-- vmw_kms_save_vga(dev_priv);
--
-- /* Start kms and overlay systems, needs fifo. */
- ret = vmw_kms_init(dev_priv);
- if (unlikely(ret != 0))
- goto out_no_kms;
- vmw_overlay_init(dev_priv);
-
-+ ret = vmw_request_device(dev_priv);
-+ if (ret)
-+ goto out_no_fifo;
-+
- if (dev_priv->enable_fb) {
-- ret = vmw_3d_resource_inc(dev_priv, true);
-- if (unlikely(ret != 0))
-- goto out_no_fifo;
-+ vmw_fifo_resource_inc(dev_priv);
-+ vmw_svga_enable(dev_priv);
- vmw_fb_init(dev_priv);
- }
-
-@@ -838,13 +836,14 @@ out_no_fifo:
- vmw_overlay_close(dev_priv);
- vmw_kms_close(dev_priv);
- out_no_kms:
-- vmw_kms_restore_vga(dev_priv);
- if (dev_priv->has_mob)
- (void) ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_MOB);
- if (dev_priv->has_gmr)
- (void) ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_GMR);
- (void)ttm_bo_clean_mm(&dev_priv->bdev, TTM_PL_VRAM);
- out_no_vram:
-+ (void)ttm_bo_device_release(&dev_priv->bdev);
-+out_no_bdev:
- vmw_fence_manager_takedown(dev_priv->fman);
- out_no_fman:
- if (dev_priv->capabilities & SVGA_CAP_IRQMASK)
-@@ -860,8 +859,6 @@ out_err4:
- iounmap(dev_priv->mmio_virt);
- out_err3:
- arch_phys_wc_del(dev_priv->mmio_mtrr);
-- (void)ttm_bo_device_release(&dev_priv->bdev);
--out_err1:
- vmw_ttm_global_release(dev_priv);
- out_err0:
- for (i = vmw_res_context; i < vmw_res_max; ++i)
-@@ -883,18 +880,22 @@ static int vmw_driver_unload(struct drm_device *dev)
- vfree(dev_priv->ctx.cmd_bounce);
- if (dev_priv->enable_fb) {
- vmw_fb_close(dev_priv);
-- vmw_kms_restore_vga(dev_priv);
-- vmw_3d_resource_dec(dev_priv, false);
-+ vmw_fifo_resource_dec(dev_priv);
-+ vmw_svga_disable(dev_priv);
- }
-+
- vmw_kms_close(dev_priv);
- vmw_overlay_close(dev_priv);
-
-- if (dev_priv->has_mob)
-- (void) ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_MOB);
- if (dev_priv->has_gmr)
- (void)ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_GMR);
- (void)ttm_bo_clean_mm(&dev_priv->bdev, TTM_PL_VRAM);
-
-+ vmw_release_device_early(dev_priv);
-+ if (dev_priv->has_mob)
-+ (void) ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_MOB);
-+ (void) ttm_bo_device_release(&dev_priv->bdev);
-+ vmw_release_device_late(dev_priv);
- vmw_fence_manager_takedown(dev_priv->fman);
- if (dev_priv->capabilities & SVGA_CAP_IRQMASK)
- drm_irq_uninstall(dev_priv->dev);
-@@ -1148,27 +1149,13 @@ static int vmw_master_set(struct drm_device *dev,
- struct vmw_master *vmaster = vmw_master(file_priv->master);
- int ret = 0;
-
-- if (!dev_priv->enable_fb) {
-- ret = vmw_3d_resource_inc(dev_priv, true);
-- if (unlikely(ret != 0))
-- return ret;
-- vmw_kms_save_vga(dev_priv);
-- vmw_write(dev_priv, SVGA_REG_TRACES, 0);
-- }
--
- if (active) {
- BUG_ON(active != &dev_priv->fbdev_master);
- ret = ttm_vt_lock(&active->lock, false, vmw_fp->tfile);
- if (unlikely(ret != 0))
-- goto out_no_active_lock;
-+ return ret;
-
- ttm_lock_set_kill(&active->lock, true, SIGTERM);
-- ret = ttm_bo_evict_mm(&dev_priv->bdev, TTM_PL_VRAM);
-- if (unlikely(ret != 0)) {
-- DRM_ERROR("Unable to clean VRAM on "
-- "master drop.\n");
-- }
--
- dev_priv->active_master = NULL;
- }
-
-@@ -1182,14 +1169,6 @@ static int vmw_master_set(struct drm_device *dev,
- dev_priv->active_master = vmaster;
-
- return 0;
--
--out_no_active_lock:
-- if (!dev_priv->enable_fb) {
-- vmw_kms_restore_vga(dev_priv);
-- vmw_3d_resource_dec(dev_priv, true);
-- vmw_write(dev_priv, SVGA_REG_TRACES, 1);
-- }
-- return ret;
- }
-
- static void vmw_master_drop(struct drm_device *dev,
-@@ -1214,16 +1193,9 @@ static void vmw_master_drop(struct drm_device *dev,
- }
-
- ttm_lock_set_kill(&vmaster->lock, false, SIGTERM);
-- vmw_execbuf_release_pinned_bo(dev_priv);
-
-- if (!dev_priv->enable_fb) {
-- ret = ttm_bo_evict_mm(&dev_priv->bdev, TTM_PL_VRAM);
-- if (unlikely(ret != 0))
-- DRM_ERROR("Unable to clean VRAM on master drop.\n");
-- vmw_kms_restore_vga(dev_priv);
-- vmw_3d_resource_dec(dev_priv, true);
-- vmw_write(dev_priv, SVGA_REG_TRACES, 1);
-- }
-+ if (!dev_priv->enable_fb)
-+ vmw_svga_disable(dev_priv);
-
- dev_priv->active_master = &dev_priv->fbdev_master;
- ttm_lock_set_kill(&dev_priv->fbdev_master.lock, false, SIGTERM);
-@@ -1233,6 +1205,74 @@ static void vmw_master_drop(struct drm_device *dev,
- vmw_fb_on(dev_priv);
- }
-
-+/**
-+ * __vmw_svga_enable - Enable SVGA mode, FIFO and use of VRAM.
-+ *
-+ * @dev_priv: Pointer to device private struct.
-+ * Needs the reservation sem to be held in non-exclusive mode.
-+ */
-+void __vmw_svga_enable(struct vmw_private *dev_priv)
-+{
-+ spin_lock(&dev_priv->svga_lock);
-+ if (!dev_priv->bdev.man[TTM_PL_VRAM].use_type) {
-+ vmw_write(dev_priv, SVGA_REG_ENABLE, SVGA_REG_ENABLE);
-+ dev_priv->bdev.man[TTM_PL_VRAM].use_type = true;
-+ }
-+ spin_unlock(&dev_priv->svga_lock);
-+}
-+
-+/**
-+ * vmw_svga_enable - Enable SVGA mode, FIFO and use of VRAM.
-+ *
-+ * @dev_priv: Pointer to device private struct.
-+ */
-+void vmw_svga_enable(struct vmw_private *dev_priv)
-+{
-+ ttm_read_lock(&dev_priv->reservation_sem, false);
-+ __vmw_svga_enable(dev_priv);
-+ ttm_read_unlock(&dev_priv->reservation_sem);
-+}
-+
-+/**
-+ * __vmw_svga_disable - Disable SVGA mode and use of VRAM.
-+ *
-+ * @dev_priv: Pointer to device private struct.
-+ * Needs the reservation sem to be held in exclusive mode.
-+ * Will not empty VRAM. VRAM must be emptied by caller.
-+ */
-+void __vmw_svga_disable(struct vmw_private *dev_priv)
-+{
-+ spin_lock(&dev_priv->svga_lock);
-+ if (dev_priv->bdev.man[TTM_PL_VRAM].use_type) {
-+ dev_priv->bdev.man[TTM_PL_VRAM].use_type = false;
-+ vmw_write(dev_priv, SVGA_REG_ENABLE,
-+ SVGA_REG_ENABLE_ENABLE_HIDE);
-+ }
-+ spin_unlock(&dev_priv->svga_lock);
-+}
-+
-+/**
-+ * vmw_svga_disable - Disable SVGA_MODE, and use of VRAM. Keep the fifo
-+ * running.
-+ *
-+ * @dev_priv: Pointer to device private struct.
-+ * Will empty VRAM.
-+ */
-+void vmw_svga_disable(struct vmw_private *dev_priv)
-+{
-+ ttm_write_lock(&dev_priv->reservation_sem, false);
-+ spin_lock(&dev_priv->svga_lock);
-+ if (dev_priv->bdev.man[TTM_PL_VRAM].use_type) {
-+ dev_priv->bdev.man[TTM_PL_VRAM].use_type = false;
-+ vmw_write(dev_priv, SVGA_REG_ENABLE,
-+ SVGA_REG_ENABLE_ENABLE_HIDE);
-+ spin_unlock(&dev_priv->svga_lock);
-+ if (ttm_bo_evict_mm(&dev_priv->bdev, TTM_PL_VRAM))
-+ DRM_ERROR("Failed evicting VRAM buffers.\n");
-+ } else
-+ spin_unlock(&dev_priv->svga_lock);
-+ ttm_write_unlock(&dev_priv->reservation_sem);
-+}
-
- static void vmw_remove(struct pci_dev *pdev)
- {
-@@ -1250,21 +1290,21 @@ static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val,
-
- switch (val) {
- case PM_HIBERNATION_PREPARE:
-- case PM_SUSPEND_PREPARE:
- ttm_suspend_lock(&dev_priv->reservation_sem);
-
-- /**
-+ /*
- * This empties VRAM and unbinds all GMR bindings.
- * Buffer contents is moved to swappable memory.
- */
- vmw_execbuf_release_pinned_bo(dev_priv);
- vmw_resource_evict_all(dev_priv);
-+ vmw_release_device_early(dev_priv);
- ttm_bo_swapout_all(&dev_priv->bdev);
--
-+ vmw_fence_fifo_down(dev_priv->fman);
- break;
- case PM_POST_HIBERNATION:
-- case PM_POST_SUSPEND:
- case PM_POST_RESTORE:
-+ vmw_fence_fifo_up(dev_priv->fman);
- ttm_suspend_unlock(&dev_priv->reservation_sem);
-
- break;
-@@ -1276,20 +1316,13 @@ static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val,
- return 0;
- }
-
--/**
-- * These might not be needed with the virtual SVGA device.
-- */
--
- static int vmw_pci_suspend(struct pci_dev *pdev, pm_message_t state)
- {
- struct drm_device *dev = pci_get_drvdata(pdev);
- struct vmw_private *dev_priv = vmw_priv(dev);
-
-- if (dev_priv->num_3d_resources != 0) {
-- DRM_INFO("Can't suspend or hibernate "
-- "while 3D resources are active.\n");
-+ if (dev_priv->refuse_hibernation)
- return -EBUSY;
-- }
-
- pci_save_state(pdev);
- pci_disable_device(pdev);
-@@ -1321,56 +1354,62 @@ static int vmw_pm_resume(struct device *kdev)
- return vmw_pci_resume(pdev);
- }
-
--static int vmw_pm_prepare(struct device *kdev)
-+static int vmw_pm_freeze(struct device *kdev)
- {
- struct pci_dev *pdev = to_pci_dev(kdev);
- struct drm_device *dev = pci_get_drvdata(pdev);
- struct vmw_private *dev_priv = vmw_priv(dev);
-
-- /**
-- * Release 3d reference held by fbdev and potentially
-- * stop fifo.
-- */
- dev_priv->suspended = true;
- if (dev_priv->enable_fb)
-- vmw_3d_resource_dec(dev_priv, true);
--
-- if (dev_priv->num_3d_resources != 0) {
--
-- DRM_INFO("Can't suspend or hibernate "
-- "while 3D resources are active.\n");
-+ vmw_fifo_resource_dec(dev_priv);
-
-+ if (atomic_read(&dev_priv->num_fifo_resources) != 0) {
-+ DRM_ERROR("Can't hibernate while 3D resources are active.\n");
- if (dev_priv->enable_fb)
-- vmw_3d_resource_inc(dev_priv, true);
-+ vmw_fifo_resource_inc(dev_priv);
-+ WARN_ON(vmw_request_device_late(dev_priv));
- dev_priv->suspended = false;
- return -EBUSY;
- }
-
-+ if (dev_priv->enable_fb)
-+ __vmw_svga_disable(dev_priv);
-+
-+ vmw_release_device_late(dev_priv);
-+
- return 0;
- }
-
--static void vmw_pm_complete(struct device *kdev)
-+static int vmw_pm_restore(struct device *kdev)
- {
- struct pci_dev *pdev = to_pci_dev(kdev);
- struct drm_device *dev = pci_get_drvdata(pdev);
- struct vmw_private *dev_priv = vmw_priv(dev);
-+ int ret;
-
- vmw_write(dev_priv, SVGA_REG_ID, SVGA_ID_2);
- (void) vmw_read(dev_priv, SVGA_REG_ID);
-
-- /**
-- * Reclaim 3d reference held by fbdev and potentially
-- * start fifo.
-- */
- if (dev_priv->enable_fb)
-- vmw_3d_resource_inc(dev_priv, false);
-+ vmw_fifo_resource_inc(dev_priv);
-+
-+ ret = vmw_request_device(dev_priv);
-+ if (ret)
-+ return ret;
-+
-+ if (dev_priv->enable_fb)
-+ __vmw_svga_enable(dev_priv);
-
- dev_priv->suspended = false;
-+
-+ return 0;
- }
-
- static const struct dev_pm_ops vmw_pm_ops = {
-- .prepare = vmw_pm_prepare,
-- .complete = vmw_pm_complete,
-+ .freeze = vmw_pm_freeze,
-+ .thaw = vmw_pm_restore,
-+ .restore = vmw_pm_restore,
- .suspend = vmw_pm_suspend,
- .resume = vmw_pm_resume,
- };
-diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
-index d26a6daa9719..a5f221eaf076 100644
---- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
-+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
-@@ -484,6 +484,7 @@ struct vmw_private {
-
- bool stealth;
- bool enable_fb;
-+ spinlock_t svga_lock;
-
- /**
- * Master management.
-@@ -493,9 +494,10 @@ struct vmw_private {
- struct vmw_master fbdev_master;
- struct notifier_block pm_nb;
- bool suspended;
-+ bool refuse_hibernation;
-
- struct mutex release_mutex;
-- uint32_t num_3d_resources;
-+ atomic_t num_fifo_resources;
-
- /*
- * Replace this with an rwsem as soon as we have down_xx_interruptible()
-@@ -587,8 +589,9 @@ static inline uint32_t vmw_read(struct vmw_private *dev_priv,
- return val;
- }
-
--int vmw_3d_resource_inc(struct vmw_private *dev_priv, bool unhide_svga);
--void vmw_3d_resource_dec(struct vmw_private *dev_priv, bool hide_svga);
-+extern void vmw_svga_enable(struct vmw_private *dev_priv);
-+extern void vmw_svga_disable(struct vmw_private *dev_priv);
-+
-
- /**
- * GMR utilities - vmwgfx_gmr.c
-@@ -1116,4 +1119,14 @@ static inline struct ttm_mem_global *vmw_mem_glob(struct vmw_private *dev_priv)
- {
- return (struct ttm_mem_global *) dev_priv->mem_global_ref.object;
- }
-+
-+static inline void vmw_fifo_resource_inc(struct vmw_private *dev_priv)
-+{
-+ atomic_inc(&dev_priv->num_fifo_resources);
-+}
-+
-+static inline void vmw_fifo_resource_dec(struct vmw_private *dev_priv)
-+{
-+ atomic_dec(&dev_priv->num_fifo_resources);
-+}
- #endif
-diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
-index 0a474f391fad..0e062613a7db 100644
---- a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
-+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
-@@ -596,7 +596,10 @@ int vmw_fb_off(struct vmw_private *vmw_priv)
-
- info = vmw_priv->fb_info;
- par = info->par;
-+ if (!par->bo_ptr)
-+ return 0;
-
-+ vmw_kms_save_vga(vmw_priv);
- spin_lock_irqsave(&par->dirty.lock, flags);
- par->dirty.active = false;
- spin_unlock_irqrestore(&par->dirty.lock, flags);
-@@ -648,6 +651,7 @@ int vmw_fb_on(struct vmw_private *vmw_priv)
- spin_lock_irqsave(&par->dirty.lock, flags);
- par->dirty.active = true;
- spin_unlock_irqrestore(&par->dirty.lock, flags);
-+ vmw_kms_restore_vga(vmw_priv);
-
- err_no_buffer:
- vmw_fb_set_par(info);
-diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
-index 39f2b03888e7..cd5d9f3fe0e0 100644
---- a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
-+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
-@@ -98,7 +98,6 @@ int vmw_fifo_init(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo)
- __le32 __iomem *fifo_mem = dev_priv->mmio_virt;
- uint32_t max;
- uint32_t min;
-- uint32_t dummy;
-
- fifo->static_buffer_size = VMWGFX_FIFO_STATIC_SIZE;
- fifo->static_buffer = vmalloc(fifo->static_buffer_size);
-@@ -112,10 +111,6 @@ int vmw_fifo_init(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo)
- mutex_init(&fifo->fifo_mutex);
- init_rwsem(&fifo->rwsem);
-
-- /*
-- * Allow mapping the first page read-only to user-space.
-- */
--
- DRM_INFO("width %d\n", vmw_read(dev_priv, SVGA_REG_WIDTH));
- DRM_INFO("height %d\n", vmw_read(dev_priv, SVGA_REG_HEIGHT));
- DRM_INFO("bpp %d\n", vmw_read(dev_priv, SVGA_REG_BITS_PER_PIXEL));
-@@ -123,7 +118,9 @@ int vmw_fifo_init(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo)
- dev_priv->enable_state = vmw_read(dev_priv, SVGA_REG_ENABLE);
- dev_priv->config_done_state = vmw_read(dev_priv, SVGA_REG_CONFIG_DONE);
- dev_priv->traces_state = vmw_read(dev_priv, SVGA_REG_TRACES);
-- vmw_write(dev_priv, SVGA_REG_ENABLE, 1);
-+
-+ vmw_write(dev_priv, SVGA_REG_ENABLE, SVGA_REG_ENABLE_ENABLE_HIDE);
-+ vmw_write(dev_priv, SVGA_REG_TRACES, 0);
-
- min = 4;
- if (dev_priv->capabilities & SVGA_CAP_EXTENDED_FIFO)
-@@ -155,7 +152,8 @@ int vmw_fifo_init(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo)
- atomic_set(&dev_priv->marker_seq, dev_priv->last_read_seqno);
- iowrite32(dev_priv->last_read_seqno, fifo_mem + SVGA_FIFO_FENCE);
- vmw_marker_queue_init(&fifo->marker_queue);
-- return vmw_fifo_send_fence(dev_priv, &dummy);
-+
-+ return 0;
- }
-
- void vmw_fifo_ping_host(struct vmw_private *dev_priv, uint32_t reason)
-diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
-index 5c289f748ab4..53579f278b63 100644
---- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
-+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
-@@ -280,6 +280,7 @@ static int vmw_ldu_crtc_set_config(struct drm_mode_set *set)
- }
-
- vmw_fb_off(dev_priv);
-+ vmw_svga_enable(dev_priv);
-
- crtc->primary->fb = fb;
- encoder->crtc = crtc;
-diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c b/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c
-index 04a64b8cd3cd..f06d60f41fa7 100644
---- a/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c
-+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c
-@@ -574,7 +574,7 @@ void vmw_mob_unbind(struct vmw_private *dev_priv,
- vmw_fence_single_bo(bo, NULL);
- ttm_bo_unreserve(bo);
- }
-- vmw_3d_resource_dec(dev_priv, false);
-+ vmw_fifo_resource_dec(dev_priv);
- }
-
- /*
-@@ -627,7 +627,7 @@ int vmw_mob_bind(struct vmw_private *dev_priv,
- mob->pt_level += VMW_MOBFMT_PTDEPTH_1 - SVGA3D_MOBFMT_PTDEPTH_1;
- }
-
-- (void) vmw_3d_resource_inc(dev_priv, false);
-+ vmw_fifo_resource_inc(dev_priv);
-
- cmd = vmw_fifo_reserve(dev_priv, sizeof(*cmd));
- if (unlikely(cmd == NULL)) {
-@@ -648,7 +648,7 @@ int vmw_mob_bind(struct vmw_private *dev_priv,
- return 0;
-
- out_no_cmd_space:
-- vmw_3d_resource_dec(dev_priv, false);
-+ vmw_fifo_resource_dec(dev_priv);
- if (pt_set_up)
- ttm_bo_unref(&mob->pt_bo);
-
-diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
-index 7dc591d04d9a..9e8eb364a6ac 100644
---- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
-+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
-@@ -332,6 +332,7 @@ static int vmw_sou_crtc_set_config(struct drm_mode_set *set)
- }
-
- vmw_fb_off(dev_priv);
-+ vmw_svga_enable(dev_priv);
-
- if (mode->hdisplay != crtc->mode.hdisplay ||
- mode->vdisplay != crtc->mode.vdisplay) {
-diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
-index 6a4584a43aa6..6110a433ebfe 100644
---- a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
-+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
-@@ -165,7 +165,7 @@ static int vmw_gb_shader_create(struct vmw_resource *res)
- cmd->body.type = shader->type;
- cmd->body.sizeInBytes = shader->size;
- vmw_fifo_commit(dev_priv, sizeof(*cmd));
-- (void) vmw_3d_resource_inc(dev_priv, false);
-+ vmw_fifo_resource_inc(dev_priv);
-
- return 0;
-
-@@ -275,7 +275,7 @@ static int vmw_gb_shader_destroy(struct vmw_resource *res)
- vmw_fifo_commit(dev_priv, sizeof(*cmd));
- mutex_unlock(&dev_priv->binding_mutex);
- vmw_resource_release_id(res);
-- vmw_3d_resource_dec(dev_priv, false);
-+ vmw_fifo_resource_dec(dev_priv);
-
- return 0;
- }
-diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
-index 4ecdbf3e59da..4d0c98edeb6a 100644
---- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
-+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
-@@ -340,7 +340,7 @@ static void vmw_hw_surface_destroy(struct vmw_resource *res)
- dev_priv->used_memory_size -= res->backup_size;
- mutex_unlock(&dev_priv->cmdbuf_mutex);
- }
-- vmw_3d_resource_dec(dev_priv, false);
-+ vmw_fifo_resource_dec(dev_priv);
- }
-
- /**
-@@ -576,14 +576,14 @@ static int vmw_surface_init(struct vmw_private *dev_priv,
-
- BUG_ON(res_free == NULL);
- if (!dev_priv->has_mob)
-- (void) vmw_3d_resource_inc(dev_priv, false);
-+ vmw_fifo_resource_inc(dev_priv);
- ret = vmw_resource_init(dev_priv, res, true, res_free,
- (dev_priv->has_mob) ? &vmw_gb_surface_func :
- &vmw_legacy_surface_func);
-
- if (unlikely(ret != 0)) {
- if (!dev_priv->has_mob)
-- vmw_3d_resource_dec(dev_priv, false);
-+ vmw_fifo_resource_dec(dev_priv);
- res_free(res);
- return ret;
- }
-@@ -1028,7 +1028,7 @@ static int vmw_gb_surface_create(struct vmw_resource *res)
- if (likely(res->id != -1))
- return 0;
-
-- (void) vmw_3d_resource_inc(dev_priv, false);
-+ vmw_fifo_resource_inc(dev_priv);
- ret = vmw_resource_alloc_id(res);
- if (unlikely(ret != 0)) {
- DRM_ERROR("Failed to allocate a surface id.\n");
-@@ -1068,7 +1068,7 @@ static int vmw_gb_surface_create(struct vmw_resource *res)
- out_no_fifo:
- vmw_resource_release_id(res);
- out_no_id:
-- vmw_3d_resource_dec(dev_priv, false);
-+ vmw_fifo_resource_dec(dev_priv);
- return ret;
- }
-
-@@ -1213,7 +1213,7 @@ static int vmw_gb_surface_destroy(struct vmw_resource *res)
- vmw_fifo_commit(dev_priv, sizeof(*cmd));
- mutex_unlock(&dev_priv->binding_mutex);
- vmw_resource_release_id(res);
-- vmw_3d_resource_dec(dev_priv, false);
-+ vmw_fifo_resource_dec(dev_priv);
-
- return 0;
- }
---
-2.4.3
-