History

Merge tag 'drm-misc-fixes-2026-02-05' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-fixes

drm-misc-fixes for v6.19 final: nouveau ------- Revert adding atomic commit functions as it regresses pre-nv50. Fix bugs exposed by enabling 570 firmware. gma500 ------ Revert a regression caused by vblank changes. mgag200 ------- Replace a busy loop with a polling loop to fix that blocking 1 cpu for 300 ms roughly every 20 minutes. bridge ------ imx8mp-hdmi-pa: Use runtime pm to fix a bug in channel ordering.

Dave Airlie committed 9 months ago

Commit 4e3b2f02 parents 18f7fcd 40b24d967 files · +207 −138Browse files

Unified · Split

67 files
  1. drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c +15 −0
  2. drivers/gpu/drm/gma500/psb_irq.c +13 −23
  3. drivers/gpu/drm/mgag200/mgag200_bmc.c +12 −19
  4. drivers/gpu/drm/mgag200/mgag200_drv.h +6 −0
  5. drivers/gpu/drm/nouveau/include/nvif/client.h +1 −1
  6. drivers/gpu/drm/nouveau/include/nvif/driver.h +1 −1
  7. drivers/gpu/drm/nouveau/include/nvkm/core/device.h +2 −1
  8. drivers/gpu/drm/nouveau/include/nvkm/core/engine.h +1 −1
  9. drivers/gpu/drm/nouveau/include/nvkm/core/object.h +3 −2
  10. drivers/gpu/drm/nouveau/include/nvkm/core/oproxy.h +1 −1
  11. drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h +2 −2
  12. drivers/gpu/drm/nouveau/include/nvkm/core/suspend_state.h +11 −0
  13. drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +6 −0
  14. drivers/gpu/drm/nouveau/nouveau_display.c +0 −2
  15. drivers/gpu/drm/nouveau/nouveau_drm.c +1 −1
  16. drivers/gpu/drm/nouveau/nouveau_nvif.c +8 −2
  17. drivers/gpu/drm/nouveau/nvif/client.c +2 −2
  18. drivers/gpu/drm/nouveau/nvkm/core/engine.c +2 −2
  19. drivers/gpu/drm/nouveau/nvkm/core/ioctl.c +2 −2
  20. drivers/gpu/drm/nouveau/nvkm/core/object.c +16 −4
  21. drivers/gpu/drm/nouveau/nvkm/core/oproxy.c +1 −1
  22. drivers/gpu/drm/nouveau/nvkm/core/subdev.c +15 −3
  23. drivers/gpu/drm/nouveau/nvkm/core/uevent.c +1 −1
  24. drivers/gpu/drm/nouveau/nvkm/engine/ce/ga100.c +1 −1
  25. drivers/gpu/drm/nouveau/nvkm/engine/ce/priv.h +1 −1
  26. drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +17 −5
  27. drivers/gpu/drm/nouveau/nvkm/engine/device/pci.c +2 −2
  28. drivers/gpu/drm/nouveau/nvkm/engine/device/priv.h +1 −1
  29. drivers/gpu/drm/nouveau/nvkm/engine/device/user.c +1 −1
  30. drivers/gpu/drm/nouveau/nvkm/engine/disp/base.c +2 −2
  31. drivers/gpu/drm/nouveau/nvkm/engine/disp/chan.c +1 −1
  32. drivers/gpu/drm/nouveau/nvkm/engine/falcon.c +2 −2
  33. drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c +1 −1
  34. drivers/gpu/drm/nouveau/nvkm/engine/fifo/uchan.c +3 −3
  35. drivers/gpu/drm/nouveau/nvkm/engine/gr/base.c +2 −2
  36. drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c +1 −1
  37. drivers/gpu/drm/nouveau/nvkm/engine/gr/nv04.c +1 −1
  38. drivers/gpu/drm/nouveau/nvkm/engine/gr/nv10.c +1 −1
  39. drivers/gpu/drm/nouveau/nvkm/engine/gr/nv20.c +1 −1
  40. drivers/gpu/drm/nouveau/nvkm/engine/gr/nv20.h +1 −1
  41. drivers/gpu/drm/nouveau/nvkm/engine/gr/nv40.c +2 −2
  42. drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv44.c +1 −1
  43. drivers/gpu/drm/nouveau/nvkm/engine/sec2/base.c +1 −1
  44. drivers/gpu/drm/nouveau/nvkm/engine/xtensa.c +2 −2
  45. drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c +1 −1
  46. drivers/gpu/drm/nouveau/nvkm/subdev/bar/base.c +1 −1
  47. drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c +1 −1
  48. drivers/gpu/drm/nouveau/nvkm/subdev/devinit/base.c +2 −2
  49. drivers/gpu/drm/nouveau/nvkm/subdev/fault/base.c +1 −1
  50. drivers/gpu/drm/nouveau/nvkm/subdev/fault/user.c +1 −1
  51. drivers/gpu/drm/nouveau/nvkm/subdev/gpio/base.c +1 −1
  52. drivers/gpu/drm/nouveau/nvkm/subdev/gsp/base.c +1 −1
  53. drivers/gpu/drm/nouveau/nvkm/subdev/gsp/gh100.c +1 −1
  54. drivers/gpu/drm/nouveau/nvkm/subdev/gsp/priv.h +4 −4
  55. drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fbsr.c +1 −1
  56. drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c +4 −4
  57. drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/rpc.c +6 −0
  58. drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/fbsr.c +4 −4
  59. drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/gsp.c +1 −1
  60. drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/rm.h +1 −1
  61. drivers/gpu/drm/nouveau/nvkm/subdev/gsp/tu102.c +1 −1
  62. drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c +1 −1
  63. drivers/gpu/drm/nouveau/nvkm/subdev/instmem/base.c +1 −1
  64. drivers/gpu/drm/nouveau/nvkm/subdev/pci/base.c +1 −1
  65. drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c +1 −1
  66. drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c +3 −3
  67. drivers/gpu/drm/nouveau/nvkm/subdev/timer/base.c +1 −1
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c+15−0
@@ -8,6 +8,7 @@ · 7 unmodified lines
88 #include <linux/module.h>
99 #include <linux/of_platform.h>
1010 #include <linux/platform_device.h>
11+#include <linux/pm_runtime.h>
1112 #include <linux/regmap.h>
1213 #include <drm/bridge/dw_hdmi.h>
1314 #include <sound/asoundef.h>
@@ -33,6 +34,7 @@ · 19 unmodified lines
3334
3435 struct imx8mp_hdmi_pai {
3536 struct regmap *regmap;
37+ struct device *dev;
3638 };
3739
3840 static void imx8mp_hdmi_pai_enable(struct dw_hdmi *dw_hdmi, int channel,
@@ -43,6 +45,9 @@ static void imx8mp_hdmi_pai_enable(struct dw_hdmi *dw_hdmi, int channel, · 4 unmodified lines
4345 struct imx8mp_hdmi_pai *hdmi_pai = pdata->priv_audio;
4446 int val;
4547
48+ if (pm_runtime_resume_and_get(hdmi_pai->dev) < 0)
49+ return;
50+
4651 /* PAI set control extended */
4752 val = WTMK_HIGH(3) | WTMK_LOW(3);
4853 val |= NUM_CH(channel);
@@ -85,6 +90,8 @@ static void imx8mp_hdmi_pai_disable(struct dw_hdmi *dw_hdmi) · 36 unmodified lines
8590
8691 /* Stop PAI */
8792 regmap_write(hdmi_pai->regmap, HTX_PAI_CTRL, 0);
93+
94+ pm_runtime_put_sync(hdmi_pai->dev);
8895 }
8996
9097 static const struct regmap_config imx8mp_hdmi_pai_regmap_config = {
@@ -101,6 +108,7 @@ static int imx8mp_hdmi_pai_bind(struct device *dev, struct device *master, void · 10 unmodified lines
101108 struct imx8mp_hdmi_pai *hdmi_pai;
102109 struct resource *res;
103110 void __iomem *base;
111+ int ret;
104112
105113 hdmi_pai = devm_kzalloc(dev, sizeof(*hdmi_pai), GFP_KERNEL);
106114 if (!hdmi_pai)
@@ -121,6 +129,13 @@ static int imx8mp_hdmi_pai_bind(struct device *dev, struct device *master, void · 14 unmodified lines
121129 plat_data->disable_audio = imx8mp_hdmi_pai_disable;
122130 plat_data->priv_audio = hdmi_pai;
123131
132+ hdmi_pai->dev = dev;
133+ ret = devm_pm_runtime_enable(dev);
134+ if (ret < 0) {
135+ dev_err(dev, "failed to enable PM runtime: %d\n", ret);
136+ return ret;
137+ }
138+
124139 return 0;
125140 }
126141
drivers/gpu/drm/gma500/psb_irq.c+13−23
@@ -250,7 +250,6 @@ static irqreturn_t gma_irq_handler(int irq, void *arg) · 249 unmodified lines
250250 void gma_irq_preinstall(struct drm_device *dev)
251251 {
252252 struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
253− struct drm_crtc *crtc;
254253 unsigned long irqflags;
255254
256255 spin_lock_irqsave(&dev_priv->irqmask_lock, irqflags);
@@ -261,15 +260,10 @@ void gma_irq_preinstall(struct drm_device *dev) · 4 unmodified lines
261260 PSB_WSGX32(0x00000000, PSB_CR_EVENT_HOST_ENABLE);
262261 PSB_RSGX32(PSB_CR_EVENT_HOST_ENABLE);
263262
264− drm_for_each_crtc(crtc, dev) {
265− struct drm_vblank_crtc *vblank = drm_crtc_vblank_crtc(crtc);
266−
267− if (vblank->enabled) {
268− u32 mask = drm_crtc_index(crtc) ? _PSB_VSYNC_PIPEB_FLAG :
269− _PSB_VSYNC_PIPEA_FLAG;
270− dev_priv->vdc_irq_mask |= mask;
271− }
272− }
263+ if (dev->vblank[0].enabled)
264+ dev_priv->vdc_irq_mask |= _PSB_VSYNC_PIPEA_FLAG;
265+ if (dev->vblank[1].enabled)
266+ dev_priv->vdc_irq_mask |= _PSB_VSYNC_PIPEB_FLAG;
273267
274268 /* Revisit this area - want per device masks ? */
275269 if (dev_priv->ops->hotplug)
@@ -284,8 +278,8 @@ void gma_irq_preinstall(struct drm_device *dev) · 8 unmodified lines
284278 void gma_irq_postinstall(struct drm_device *dev)
285279 {
286280 struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
287− struct drm_crtc *crtc;
288281 unsigned long irqflags;
282+ unsigned int i;
289283
290284 spin_lock_irqsave(&dev_priv->irqmask_lock, irqflags);
291285
@@ -298,13 +292,11 @@ void gma_irq_postinstall(struct drm_device *dev) · 6 unmodified lines
298292 PSB_WVDC32(dev_priv->vdc_irq_mask, PSB_INT_ENABLE_R);
299293 PSB_WVDC32(0xFFFFFFFF, PSB_HWSTAM);
300294
301− drm_for_each_crtc(crtc, dev) {
302− struct drm_vblank_crtc *vblank = drm_crtc_vblank_crtc(crtc);
303−
304− if (vblank->enabled)
305− gma_enable_pipestat(dev_priv, drm_crtc_index(crtc), PIPE_VBLANK_INTERRUPT_ENABLE);
295+ for (i = 0; i < dev->num_crtcs; ++i) {
296+ if (dev->vblank[i].enabled)
297+ gma_enable_pipestat(dev_priv, i, PIPE_VBLANK_INTERRUPT_ENABLE);
306298 else
307− gma_disable_pipestat(dev_priv, drm_crtc_index(crtc), PIPE_VBLANK_INTERRUPT_ENABLE);
299+ gma_disable_pipestat(dev_priv, i, PIPE_VBLANK_INTERRUPT_ENABLE);
308300 }
309301
310302 if (dev_priv->ops->hotplug_enable)
@@ -345,8 +337,8 @@ void gma_irq_uninstall(struct drm_device *dev) · 34 unmodified lines
345337 {
346338 struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
347339 struct pci_dev *pdev = to_pci_dev(dev->dev);
348− struct drm_crtc *crtc;
349340 unsigned long irqflags;
341+ unsigned int i;
350342
351343 if (!dev_priv->irq_enabled)
352344 return;
@@ -358,11 +350,9 @@ void gma_irq_uninstall(struct drm_device *dev) · 5 unmodified lines
358350
359351 PSB_WVDC32(0xFFFFFFFF, PSB_HWSTAM);
360352
361− drm_for_each_crtc(crtc, dev) {
362− struct drm_vblank_crtc *vblank = drm_crtc_vblank_crtc(crtc);
363−
364− if (vblank->enabled)
365− gma_disable_pipestat(dev_priv, drm_crtc_index(crtc), PIPE_VBLANK_INTERRUPT_ENABLE);
353+ for (i = 0; i < dev->num_crtcs; ++i) {
354+ if (dev->vblank[i].enabled)
355+ gma_disable_pipestat(dev_priv, i, PIPE_VBLANK_INTERRUPT_ENABLE);
366356 }
367357
368358 dev_priv->vdc_irq_mask &= _PSB_IRQ_SGX_FLAG |
drivers/gpu/drm/mgag200/mgag200_bmc.c+12−19
@@ -1,6 +1,7 @@
11 // SPDX-License-Identifier: GPL-2.0-only
22
33 #include <linux/delay.h>
4+#include <linux/iopoll.h>
45
56 #include <drm/drm_atomic_helper.h>
67 #include <drm/drm_edid.h>
@@ -12,7 +13,7 @@ · 5 unmodified lines
1213 void mgag200_bmc_stop_scanout(struct mga_device *mdev)
1314 {
1415 u8 tmp;
15− int iter_max;
16+ int ret;
1617
1718 /*
1819 * 1 - The first step is to inform the BMC of an upcoming mode
@@ -42,30 +43,22 @@ void mgag200_bmc_stop_scanout(struct mga_device *mdev) · 23 unmodified lines
4243
4344 /*
4445 * 3a- The third step is to verify if there is an active scan.
45− * We are waiting for a 0 on remhsyncsts <XSPAREREG<0>).
46+ * We are waiting for a 0 on remhsyncsts (<XSPAREREG<0>).
4647 */
47− iter_max = 300;
48− while (!(tmp & 0x1) && iter_max) {
49− WREG8(DAC_INDEX, MGA1064_SPAREREG);
50− tmp = RREG8(DAC_DATA);
51− udelay(1000);
52− iter_max--;
53− }
48+ ret = read_poll_timeout(RREG_DAC, tmp, !(tmp & 0x1),
49+ 1000, 300000, false,
50+ MGA1064_SPAREREG);
51+ if (ret == -ETIMEDOUT)
52+ return;
5453
5554 /*
56− * 3b- This step occurs only if the remove is actually
55+ * 3b- This step occurs only if the remote BMC is actually
5756 * scanning. We are waiting for the end of the frame which is
5857 * a 1 on remvsyncsts (XSPAREREG<1>)
5958 */
60− if (iter_max) {
61− iter_max = 300;
62− while ((tmp & 0x2) && iter_max) {
63− WREG8(DAC_INDEX, MGA1064_SPAREREG);
64− tmp = RREG8(DAC_DATA);
65− udelay(1000);
66− iter_max--;
67− }
68− }
59+ (void)read_poll_timeout(RREG_DAC, tmp, (tmp & 0x2),
60+ 1000, 300000, false,
61+ MGA1064_SPAREREG);
6962 }
7063
7164 void mgag200_bmc_start_scanout(struct mga_device *mdev)
drivers/gpu/drm/mgag200/mgag200_drv.h+6−0
@@ -111,6 +111,12 @@ · 110 unmodified lines
111111 #define DAC_INDEX 0x3c00
112112 #define DAC_DATA 0x3c0a
113113
114+#define RREG_DAC(reg) \
115+ ({ \
116+ WREG8(DAC_INDEX, reg); \
117+ RREG8(DAC_DATA); \
118+ }) \
119+
114120 #define WREG_DAC(reg, v) \
115121 do { \
116122 WREG8(DAC_INDEX, reg); \
drivers/gpu/drm/nouveau/include/nvif/client.h+1−1
@@ -11,7 +11,7 @@ struct nvif_client { · 10 unmodified lines
1111
1212 int nvif_client_ctor(struct nvif_client *parent, const char *name, struct nvif_client *);
1313 void nvif_client_dtor(struct nvif_client *);
14−int nvif_client_suspend(struct nvif_client *);
14+int nvif_client_suspend(struct nvif_client *, bool);
1515 int nvif_client_resume(struct nvif_client *);
1616
1717 /*XXX*/
drivers/gpu/drm/nouveau/include/nvif/driver.h+1−1
@@ -8,7 +8,7 @@ struct nvif_driver { · 7 unmodified lines
88 const char *name;
99 int (*init)(const char *name, u64 device, const char *cfg,
1010 const char *dbg, void **priv);
11− int (*suspend)(void *priv);
11+ int (*suspend)(void *priv, bool runtime);
1212 int (*resume)(void *priv);
1313 int (*ioctl)(void *priv, void *data, u32 size, void **hack);
1414 void __iomem *(*map)(void *priv, u64 handle, u32 size);
drivers/gpu/drm/nouveau/include/nvkm/core/device.h+2−1
@@ -2,6 +2,7 @@ · 1 unmodified line
22 #ifndef __NVKM_DEVICE_H__
33 #define __NVKM_DEVICE_H__
44 #include <core/oclass.h>
5+#include <core/suspend_state.h>
56 #include <core/intr.h>
67 enum nvkm_subdev_type;
78
@@ -93,7 +94,7 @@ struct nvkm_device_func { · 85 unmodified lines
9394 void *(*dtor)(struct nvkm_device *);
9495 int (*preinit)(struct nvkm_device *);
9596 int (*init)(struct nvkm_device *);
96− void (*fini)(struct nvkm_device *, bool suspend);
97+ void (*fini)(struct nvkm_device *, enum nvkm_suspend_state suspend);
9798 int (*irq)(struct nvkm_device *);
9899 resource_size_t (*resource_addr)(struct nvkm_device *, enum nvkm_bar_id);
99100 resource_size_t (*resource_size)(struct nvkm_device *, enum nvkm_bar_id);
drivers/gpu/drm/nouveau/include/nvkm/core/engine.h+1−1
@@ -20,7 +20,7 @@ struct nvkm_engine_func { · 19 unmodified lines
2020 int (*oneinit)(struct nvkm_engine *);
2121 int (*info)(struct nvkm_engine *, u64 mthd, u64 *data);
2222 int (*init)(struct nvkm_engine *);
23− int (*fini)(struct nvkm_engine *, bool suspend);
23+ int (*fini)(struct nvkm_engine *, enum nvkm_suspend_state suspend);
2424 int (*reset)(struct nvkm_engine *);
2525 int (*nonstall)(struct nvkm_engine *);
2626 void (*intr)(struct nvkm_engine *);
drivers/gpu/drm/nouveau/include/nvkm/core/object.h+3−2
@@ -2,6 +2,7 @@ · 1 unmodified line
22 #ifndef __NVKM_OBJECT_H__
33 #define __NVKM_OBJECT_H__
44 #include <core/oclass.h>
5+#include <core/suspend_state.h>
56 struct nvkm_event;
67 struct nvkm_gpuobj;
78 struct nvkm_uevent;
@@ -27,7 +28,7 @@ enum nvkm_object_map { · 19 unmodified lines
2728 struct nvkm_object_func {
2829 void *(*dtor)(struct nvkm_object *);
2930 int (*init)(struct nvkm_object *);
30− int (*fini)(struct nvkm_object *, bool suspend);
31+ int (*fini)(struct nvkm_object *, enum nvkm_suspend_state suspend);
3132 int (*mthd)(struct nvkm_object *, u32 mthd, void *data, u32 size);
3233 int (*ntfy)(struct nvkm_object *, u32 mthd, struct nvkm_event **);
3334 int (*map)(struct nvkm_object *, void *argv, u32 argc,
@@ -49,7 +50,7 @@ int nvkm_object_new(const struct nvkm_oclass *, void *data, u32 size, · 15 unmodified lines
4950 void nvkm_object_del(struct nvkm_object **);
5051 void *nvkm_object_dtor(struct nvkm_object *);
5152 int nvkm_object_init(struct nvkm_object *);
52−int nvkm_object_fini(struct nvkm_object *, bool suspend);
53+int nvkm_object_fini(struct nvkm_object *, enum nvkm_suspend_state);
5354 int nvkm_object_mthd(struct nvkm_object *, u32 mthd, void *data, u32 size);
5455 int nvkm_object_ntfy(struct nvkm_object *, u32 mthd, struct nvkm_event **);
5556 int nvkm_object_map(struct nvkm_object *, void *argv, u32 argc,
drivers/gpu/drm/nouveau/include/nvkm/core/oproxy.h+1−1
@@ -13,7 +13,7 @@ struct nvkm_oproxy { · 12 unmodified lines
1313 struct nvkm_oproxy_func {
1414 void (*dtor[2])(struct nvkm_oproxy *);
1515 int (*init[2])(struct nvkm_oproxy *);
16− int (*fini[2])(struct nvkm_oproxy *, bool suspend);
16+ int (*fini[2])(struct nvkm_oproxy *, enum nvkm_suspend_state suspend);
1717 };
1818
1919 void nvkm_oproxy_ctor(const struct nvkm_oproxy_func *,
drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h+2−2
@@ -40,7 +40,7 @@ struct nvkm_subdev_func { · 39 unmodified lines
4040 int (*oneinit)(struct nvkm_subdev *);
4141 int (*info)(struct nvkm_subdev *, u64 mthd, u64 *data);
4242 int (*init)(struct nvkm_subdev *);
43− int (*fini)(struct nvkm_subdev *, bool suspend);
43+ int (*fini)(struct nvkm_subdev *, enum nvkm_suspend_state suspend);
4444 void (*intr)(struct nvkm_subdev *);
4545 };
4646
@@ -65,7 +65,7 @@ void nvkm_subdev_unref(struct nvkm_subdev *); · 18 unmodified lines
6565 int nvkm_subdev_preinit(struct nvkm_subdev *);
6666 int nvkm_subdev_oneinit(struct nvkm_subdev *);
6767 int nvkm_subdev_init(struct nvkm_subdev *);
68−int nvkm_subdev_fini(struct nvkm_subdev *, bool suspend);
68+int nvkm_subdev_fini(struct nvkm_subdev *, enum nvkm_suspend_state suspend);
6969 int nvkm_subdev_info(struct nvkm_subdev *, u64, u64 *);
7070 void nvkm_subdev_intr(struct nvkm_subdev *);
7171
drivers/gpu/drm/nouveau/include/nvkm/core/suspend_state.h+11−0
@@ -0,0 +1,11 @@
1+/* SPDX-License-Identifier: MIT */
2+#ifndef __NVKM_SUSPEND_STATE_H__
3+#define __NVKM_SUSPEND_STATE_H__
4+
5+enum nvkm_suspend_state {
6+ NVKM_POWEROFF,
7+ NVKM_SUSPEND,
8+ NVKM_RUNTIME_SUSPEND,
9+};
10+
11+#endif
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h+6−0
@@ -44,6 +44,9 @@ typedef void (*nvkm_gsp_event_func)(struct nvkm_gsp_event *, void *repv, u32 rep · 43 unmodified lines
4444 * NVKM_GSP_RPC_REPLY_NOWAIT - If specified, immediately return to the
4545 * caller after the GSP RPC command is issued.
4646 *
47+ * NVKM_GSP_RPC_REPLY_NOSEQ - If specified, exactly like NOWAIT
48+ * but don't emit RPC sequence number.
49+ *
4750 * NVKM_GSP_RPC_REPLY_RECV - If specified, wait and receive the entire GSP
4851 * RPC message after the GSP RPC command is issued.
4952 *
@@ -53,6 +56,7 @@ typedef void (*nvkm_gsp_event_func)(struct nvkm_gsp_event *, void *repv, u32 rep · 3 unmodified lines
5356 */
5457 enum nvkm_gsp_rpc_reply_policy {
5558 NVKM_GSP_RPC_REPLY_NOWAIT = 0,
59+ NVKM_GSP_RPC_REPLY_NOSEQ,
5660 NVKM_GSP_RPC_REPLY_RECV,
5761 NVKM_GSP_RPC_REPLY_POLL,
5862 };
@@ -242,6 +246,8 @@ struct nvkm_gsp { · 183 unmodified lines
242246 /* The size of the registry RPC */
243247 size_t registry_rpc_size;
244248
249+ u32 rpc_seq;
250+
245251 #ifdef CONFIG_DEBUG_FS
246252 /*
247253 * Logging buffers in debugfs. The wrapper objects need to remain
drivers/gpu/drm/nouveau/nouveau_display.c+0−2
@@ -352,8 +352,6 @@ nouveau_user_framebuffer_create(struct drm_device *dev, · 351 unmodified lines
352352
353353 static const struct drm_mode_config_funcs nouveau_mode_config_funcs = {
354354 .fb_create = nouveau_user_framebuffer_create,
355− .atomic_commit = drm_atomic_helper_commit,
356− .atomic_check = drm_atomic_helper_check,
357355 };
358356
359357
drivers/gpu/drm/nouveau/nouveau_drm.c+1−1
@@ -983,7 +983,7 @@ nouveau_do_suspend(struct nouveau_drm *drm, bool runtime) · 982 unmodified lines
983983 }
984984
985985 NV_DEBUG(drm, "suspending object tree...\n");
986− ret = nvif_client_suspend(&drm->_client);
986+ ret = nvif_client_suspend(&drm->_client, runtime);
987987 if (ret)
988988 goto fail_client;
989989
drivers/gpu/drm/nouveau/nouveau_nvif.c+8−2
@@ -62,10 +62,16 @@ nvkm_client_resume(void *priv) · 61 unmodified lines
6262 }
6363
6464 static int
65−nvkm_client_suspend(void *priv)
65+nvkm_client_suspend(void *priv, bool runtime)
6666 {
6767 struct nvkm_client *client = priv;
68− return nvkm_object_fini(&client->object, true);
68+ enum nvkm_suspend_state state;
69+
70+ if (runtime)
71+ state = NVKM_RUNTIME_SUSPEND;
72+ else
73+ state = NVKM_SUSPEND;
74+ return nvkm_object_fini(&client->object, state);
6975 }
7076
7177 static int
drivers/gpu/drm/nouveau/nvif/client.c+2−2
@@ -30,9 +30,9 @@ · 29 unmodified lines
3030 #include <nvif/if0000.h>
3131
3232 int
33−nvif_client_suspend(struct nvif_client *client)
33+nvif_client_suspend(struct nvif_client *client, bool runtime)
3434 {
35− return client->driver->suspend(client->object.priv);
35+ return client->driver->suspend(client->object.priv, runtime);
3636 }
3737
3838 int
drivers/gpu/drm/nouveau/nvkm/core/engine.c+2−2
@@ -41,7 +41,7 @@ nvkm_engine_reset(struct nvkm_engine *engine) · 40 unmodified lines
4141 if (engine->func->reset)
4242 return engine->func->reset(engine);
4343
44− nvkm_subdev_fini(&engine->subdev, false);
44+ nvkm_subdev_fini(&engine->subdev, NVKM_POWEROFF);
4545 return nvkm_subdev_init(&engine->subdev);
4646 }
4747
@@ -98,7 +98,7 @@ nvkm_engine_info(struct nvkm_subdev *subdev, u64 mthd, u64 *data) · 50 unmodified lines
9898 }
9999
100100 static int
101−nvkm_engine_fini(struct nvkm_subdev *subdev, bool suspend)
101+nvkm_engine_fini(struct nvkm_subdev *subdev, enum nvkm_suspend_state suspend)
102102 {
103103 struct nvkm_engine *engine = nvkm_engine(subdev);
104104 if (engine->func->fini)
drivers/gpu/drm/nouveau/nvkm/core/ioctl.c+2−2
@@ -141,7 +141,7 @@ nvkm_ioctl_new(struct nvkm_client *client, · 140 unmodified lines
141141 }
142142 ret = -EEXIST;
143143 }
144− nvkm_object_fini(object, false);
144+ nvkm_object_fini(object, NVKM_POWEROFF);
145145 }
146146
147147 nvkm_object_del(&object);
@@ -160,7 +160,7 @@ nvkm_ioctl_del(struct nvkm_client *client, · 12 unmodified lines
160160 nvif_ioctl(object, "delete size %d\n", size);
161161 if (!(ret = nvif_unvers(ret, &data, &size, args->none))) {
162162 nvif_ioctl(object, "delete\n");
163− nvkm_object_fini(object, false);
163+ nvkm_object_fini(object, NVKM_POWEROFF);
164164 nvkm_object_del(&object);
165165 }
166166
drivers/gpu/drm/nouveau/nvkm/core/object.c+16−4
@@ -142,13 +142,25 @@ nvkm_object_bind(struct nvkm_object *object, struct nvkm_gpuobj *gpuobj, · 141 unmodified lines
142142 }
143143
144144 int
145−nvkm_object_fini(struct nvkm_object *object, bool suspend)
145+nvkm_object_fini(struct nvkm_object *object, enum nvkm_suspend_state suspend)
146146 {
147− const char *action = suspend ? "suspend" : "fini";
147+ const char *action;
148148 struct nvkm_object *child;
149149 s64 time;
150150 int ret;
151151
152+ switch (suspend) {
153+ case NVKM_POWEROFF:
154+ default:
155+ action = "fini";
156+ break;
157+ case NVKM_SUSPEND:
158+ action = "suspend";
159+ break;
160+ case NVKM_RUNTIME_SUSPEND:
161+ action = "runtime";
162+ break;
163+ }
152164 nvif_debug(object, "%s children...\n", action);
153165 time = ktime_to_us(ktime_get());
154166 list_for_each_entry_reverse(child, &object->tree, head) {
@@ -212,11 +224,11 @@ nvkm_object_init(struct nvkm_object *object) · 57 unmodified lines
212224
213225 fail_child:
214226 list_for_each_entry_continue_reverse(child, &object->tree, head)
215− nvkm_object_fini(child, false);
227+ nvkm_object_fini(child, NVKM_POWEROFF);
216228 fail:
217229 nvif_error(object, "init failed with %d\n", ret);
218230 if (object->func->fini)
219− object->func->fini(object, false);
231+ object->func->fini(object, NVKM_POWEROFF);
220232 return ret;
221233 }
222234
drivers/gpu/drm/nouveau/nvkm/core/oproxy.c+1−1
@@ -87,7 +87,7 @@ nvkm_oproxy_uevent(struct nvkm_object *object, void *argv, u32 argc, · 86 unmodified lines
8787 }
8888
8989 static int
90−nvkm_oproxy_fini(struct nvkm_object *object, bool suspend)
90+nvkm_oproxy_fini(struct nvkm_object *object, enum nvkm_suspend_state suspend)
9191 {
9292 struct nvkm_oproxy *oproxy = nvkm_oproxy(object);
9393 int ret;
drivers/gpu/drm/nouveau/nvkm/core/subdev.c+15−3
@@ -51,12 +51,24 @@ nvkm_subdev_info(struct nvkm_subdev *subdev, u64 mthd, u64 *data) · 50 unmodified lines
5151 }
5252
5353 int
54−nvkm_subdev_fini(struct nvkm_subdev *subdev, bool suspend)
54+nvkm_subdev_fini(struct nvkm_subdev *subdev, enum nvkm_suspend_state suspend)
5555 {
5656 struct nvkm_device *device = subdev->device;
57− const char *action = suspend ? "suspend" : subdev->use.enabled ? "fini" : "reset";
57+ const char *action;
5858 s64 time;
5959
60+ switch (suspend) {
61+ case NVKM_POWEROFF:
62+ default:
63+ action = subdev->use.enabled ? "fini" : "reset";
64+ break;
65+ case NVKM_SUSPEND:
66+ action = "suspend";
67+ break;
68+ case NVKM_RUNTIME_SUSPEND:
69+ action = "runtime";
70+ break;
71+ }
6072 nvkm_trace(subdev, "%s running...\n", action);
6173 time = ktime_to_us(ktime_get());
6274
@@ -186,7 +198,7 @@ void · 123 unmodified lines
186198 nvkm_subdev_unref(struct nvkm_subdev *subdev)
187199 {
188200 if (refcount_dec_and_mutex_lock(&subdev->use.refcount, &subdev->use.mutex)) {
189− nvkm_subdev_fini(subdev, false);
201+ nvkm_subdev_fini(subdev, NVKM_POWEROFF);
190202 mutex_unlock(&subdev->use.mutex);
191203 }
192204 }
drivers/gpu/drm/nouveau/nvkm/core/uevent.c+1−1
@@ -73,7 +73,7 @@ nvkm_uevent_mthd(struct nvkm_object *object, u32 mthd, void *argv, u32 argc) · 72 unmodified lines
7373 }
7474
7575 static int
76−nvkm_uevent_fini(struct nvkm_object *object, bool suspend)
76+nvkm_uevent_fini(struct nvkm_object *object, enum nvkm_suspend_state suspend)
7777 {
7878 struct nvkm_uevent *uevent = nvkm_uevent(object);
7979
drivers/gpu/drm/nouveau/nvkm/engine/ce/ga100.c+1−1
@@ -46,7 +46,7 @@ ga100_ce_nonstall(struct nvkm_engine *engine) · 45 unmodified lines
4646 }
4747
4848 int
49−ga100_ce_fini(struct nvkm_engine *engine, bool suspend)
49+ga100_ce_fini(struct nvkm_engine *engine, enum nvkm_suspend_state suspend)
5050 {
5151 nvkm_inth_block(&engine->subdev.inth);
5252 return 0;
drivers/gpu/drm/nouveau/nvkm/engine/ce/priv.h+1−1
@@ -14,7 +14,7 @@ extern const struct nvkm_object_func gv100_ce_cclass; · 13 unmodified lines
1414
1515 int ga100_ce_oneinit(struct nvkm_engine *);
1616 int ga100_ce_init(struct nvkm_engine *);
17−int ga100_ce_fini(struct nvkm_engine *, bool);
17+int ga100_ce_fini(struct nvkm_engine *, enum nvkm_suspend_state);
1818 int ga100_ce_nonstall(struct nvkm_engine *);
1919
2020 u32 gb202_ce_grce_mask(struct nvkm_device *);
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c+17−5
@@ -2936,13 +2936,25 @@ nvkm_device_engine(struct nvkm_device *device, int type, int inst) · 2935 unmodified lines
29362936 }
29372937
29382938 int
2939−nvkm_device_fini(struct nvkm_device *device, bool suspend)
2939+nvkm_device_fini(struct nvkm_device *device, enum nvkm_suspend_state suspend)
29402940 {
2941− const char *action = suspend ? "suspend" : "fini";
2941+ const char *action;
29422942 struct nvkm_subdev *subdev;
29432943 int ret;
29442944 s64 time;
29452945
2946+ switch (suspend) {
2947+ case NVKM_POWEROFF:
2948+ default:
2949+ action = "fini";
2950+ break;
2951+ case NVKM_SUSPEND:
2952+ action = "suspend";
2953+ break;
2954+ case NVKM_RUNTIME_SUSPEND:
2955+ action = "runtime";
2956+ break;
2957+ }
29462958 nvdev_trace(device, "%s running...\n", action);
29472959 time = ktime_to_us(ktime_get());
29482960
@@ -3032,7 +3044,7 @@ nvkm_device_init(struct nvkm_device *device) · 83 unmodified lines
30323044 if (ret)
30333045 return ret;
30343046
3035− nvkm_device_fini(device, false);
3047+ nvkm_device_fini(device, NVKM_POWEROFF);
30363048
30373049 nvdev_trace(device, "init running...\n");
30383050 time = ktime_to_us(ktime_get());
@@ -3060,9 +3072,9 @@ nvkm_device_init(struct nvkm_device *device) · 21 unmodified lines
30603072
30613073 fail_subdev:
30623074 list_for_each_entry_from(subdev, &device->subdev, head)
3063− nvkm_subdev_fini(subdev, false);
3075+ nvkm_subdev_fini(subdev, NVKM_POWEROFF);
30643076 fail:
3065− nvkm_device_fini(device, false);
3077+ nvkm_device_fini(device, NVKM_POWEROFF);
30663078
30673079 nvdev_error(device, "init failed with %d\n", ret);
30683080 return ret;
drivers/gpu/drm/nouveau/nvkm/engine/device/pci.c+2−2
@@ -1605,10 +1605,10 @@ nvkm_device_pci_irq(struct nvkm_device *device) · 1604 unmodified lines
16051605 }
16061606
16071607 static void
1608−nvkm_device_pci_fini(struct nvkm_device *device, bool suspend)
1608+nvkm_device_pci_fini(struct nvkm_device *device, enum nvkm_suspend_state suspend)
16091609 {
16101610 struct nvkm_device_pci *pdev = nvkm_device_pci(device);
1611− if (suspend) {
1611+ if (suspend != NVKM_POWEROFF) {
16121612 pci_disable_device(pdev->pdev);
16131613 pdev->suspend = true;
16141614 }
drivers/gpu/drm/nouveau/nvkm/engine/device/priv.h+1−1
@@ -56,5 +56,5 @@ int nvkm_device_ctor(const struct nvkm_device_func *, · 55 unmodified lines
5656 const char *name, const char *cfg, const char *dbg,
5757 struct nvkm_device *);
5858 int nvkm_device_init(struct nvkm_device *);
59−int nvkm_device_fini(struct nvkm_device *, bool suspend);
59+int nvkm_device_fini(struct nvkm_device *, enum nvkm_suspend_state suspend);
6060 #endif
drivers/gpu/drm/nouveau/nvkm/engine/device/user.c+1−1
@@ -218,7 +218,7 @@ nvkm_udevice_map(struct nvkm_object *object, void *argv, u32 argc, · 217 unmodified lines
218218 }
219219
220220 static int
221−nvkm_udevice_fini(struct nvkm_object *object, bool suspend)
221+nvkm_udevice_fini(struct nvkm_object *object, enum nvkm_suspend_state suspend)
222222 {
223223 struct nvkm_udevice *udev = nvkm_udevice(object);
224224 struct nvkm_device *device = udev->device;
drivers/gpu/drm/nouveau/nvkm/engine/disp/base.c+2−2
@@ -99,13 +99,13 @@ nvkm_disp_intr(struct nvkm_engine *engine) · 98 unmodified lines
9999 }
100100
101101 static int
102−nvkm_disp_fini(struct nvkm_engine *engine, bool suspend)
102+nvkm_disp_fini(struct nvkm_engine *engine, enum nvkm_suspend_state suspend)
103103 {
104104 struct nvkm_disp *disp = nvkm_disp(engine);
105105 struct nvkm_outp *outp;
106106
107107 if (disp->func->fini)
108− disp->func->fini(disp, suspend);
108+ disp->func->fini(disp, suspend != NVKM_POWEROFF);
109109
110110 list_for_each_entry(outp, &disp->outps, head) {
111111 if (outp->func->fini)
drivers/gpu/drm/nouveau/nvkm/engine/disp/chan.c+1−1
@@ -128,7 +128,7 @@ nvkm_disp_chan_child_get(struct nvkm_object *object, int index, struct nvkm_ocla · 127 unmodified lines
128128 }
129129
130130 static int
131−nvkm_disp_chan_fini(struct nvkm_object *object, bool suspend)
131+nvkm_disp_chan_fini(struct nvkm_object *object, enum nvkm_suspend_state suspend)
132132 {
133133 struct nvkm_disp_chan *chan = nvkm_disp_chan(object);
134134
drivers/gpu/drm/nouveau/nvkm/engine/falcon.c+2−2
@@ -93,13 +93,13 @@ nvkm_falcon_intr(struct nvkm_engine *engine) · 92 unmodified lines
9393 }
9494
9595 static int
96−nvkm_falcon_fini(struct nvkm_engine *engine, bool suspend)
96+nvkm_falcon_fini(struct nvkm_engine *engine, enum nvkm_suspend_state suspend)
9797 {
9898 struct nvkm_falcon *falcon = nvkm_falcon(engine);
9999 struct nvkm_device *device = falcon->engine.subdev.device;
100100 const u32 base = falcon->addr;
101101
102− if (!suspend) {
102+ if (suspend == NVKM_POWEROFF) {
103103 nvkm_memory_unref(&falcon->core);
104104 if (falcon->external) {
105105 vfree(falcon->data.data);
drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c+1−1
@@ -122,7 +122,7 @@ nvkm_fifo_class_get(struct nvkm_oclass *oclass, int index, const struct nvkm_dev · 121 unmodified lines
122122 }
123123
124124 static int
125−nvkm_fifo_fini(struct nvkm_engine *engine, bool suspend)
125+nvkm_fifo_fini(struct nvkm_engine *engine, enum nvkm_suspend_state suspend)
126126 {
127127 struct nvkm_fifo *fifo = nvkm_fifo(engine);
128128 struct nvkm_runl *runl;
drivers/gpu/drm/nouveau/nvkm/engine/fifo/uchan.c+3−3
@@ -72,7 +72,7 @@ struct nvkm_uobj { · 71 unmodified lines
7272 };
7373
7474 static int
75−nvkm_uchan_object_fini_1(struct nvkm_oproxy *oproxy, bool suspend)
75+nvkm_uchan_object_fini_1(struct nvkm_oproxy *oproxy, enum nvkm_suspend_state suspend)
7676 {
7777 struct nvkm_uobj *uobj = container_of(oproxy, typeof(*uobj), oproxy);
7878 struct nvkm_chan *chan = uobj->chan;
@@ -87,7 +87,7 @@ nvkm_uchan_object_fini_1(struct nvkm_oproxy *oproxy, bool suspend) · 8 unmodified lines
8787 nvkm_chan_cctx_bind(chan, ectx->engn, NULL);
8888
8989 if (refcount_dec_and_test(&ectx->uses))
90− nvkm_object_fini(ectx->object, false);
90+ nvkm_object_fini(ectx->object, NVKM_POWEROFF);
9191 mutex_unlock(&chan->cgrp->mutex);
9292 }
9393
@@ -269,7 +269,7 @@ nvkm_uchan_map(struct nvkm_object *object, void *argv, u32 argc, · 175 unmodified lines
269269 }
270270
271271 static int
272−nvkm_uchan_fini(struct nvkm_object *object, bool suspend)
272+nvkm_uchan_fini(struct nvkm_object *object, enum nvkm_suspend_state suspend)
273273 {
274274 struct nvkm_chan *chan = nvkm_uchan(object)->chan;
275275
drivers/gpu/drm/nouveau/nvkm/engine/gr/base.c+2−2
@@ -168,11 +168,11 @@ nvkm_gr_init(struct nvkm_engine *engine) · 167 unmodified lines
168168 }
169169
170170 static int
171−nvkm_gr_fini(struct nvkm_engine *engine, bool suspend)
171+nvkm_gr_fini(struct nvkm_engine *engine, enum nvkm_suspend_state suspend)
172172 {
173173 struct nvkm_gr *gr = nvkm_gr(engine);
174174 if (gr->func->fini)
175− return gr->func->fini(gr, suspend);
175+ return gr->func->fini(gr, suspend != NVKM_POWEROFF);
176176 return 0;
177177 }
178178
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c+1−1
@@ -2330,7 +2330,7 @@ gf100_gr_reset(struct nvkm_gr *base) · 2329 unmodified lines
23302330
23312331 WARN_ON(gf100_gr_fecs_halt_pipeline(gr));
23322332
2333− subdev->func->fini(subdev, false);
2333+ subdev->func->fini(subdev, NVKM_POWEROFF);
23342334 nvkm_mc_disable(device, subdev->type, subdev->inst);
23352335 if (gr->func->gpccs.reset)
23362336 gr->func->gpccs.reset(gr);
drivers/gpu/drm/nouveau/nvkm/engine/gr/nv04.c+1−1
@@ -1158,7 +1158,7 @@ nv04_gr_chan_dtor(struct nvkm_object *object) · 1157 unmodified lines
11581158 }
11591159
11601160 static int
1161−nv04_gr_chan_fini(struct nvkm_object *object, bool suspend)
1161+nv04_gr_chan_fini(struct nvkm_object *object, enum nvkm_suspend_state suspend)
11621162 {
11631163 struct nv04_gr_chan *chan = nv04_gr_chan(object);
11641164 struct nv04_gr *gr = chan->gr;
drivers/gpu/drm/nouveau/nvkm/engine/gr/nv10.c+1−1
@@ -951,7 +951,7 @@ nv10_gr_context_switch(struct nv10_gr *gr) · 950 unmodified lines
951951 }
952952
953953 static int
954−nv10_gr_chan_fini(struct nvkm_object *object, bool suspend)
954+nv10_gr_chan_fini(struct nvkm_object *object, enum nvkm_suspend_state suspend)
955955 {
956956 struct nv10_gr_chan *chan = nv10_gr_chan(object);
957957 struct nv10_gr *gr = chan->gr;
drivers/gpu/drm/nouveau/nvkm/engine/gr/nv20.c+1−1
@@ -27,7 +27,7 @@ nv20_gr_chan_init(struct nvkm_object *object) · 26 unmodified lines
2727 }
2828
2929 int
30−nv20_gr_chan_fini(struct nvkm_object *object, bool suspend)
30+nv20_gr_chan_fini(struct nvkm_object *object, enum nvkm_suspend_state suspend)
3131 {
3232 struct nv20_gr_chan *chan = nv20_gr_chan(object);
3333 struct nv20_gr *gr = chan->gr;
drivers/gpu/drm/nouveau/nvkm/engine/gr/nv20.h+1−1
@@ -31,5 +31,5 @@ struct nv20_gr_chan { · 30 unmodified lines
3131
3232 void *nv20_gr_chan_dtor(struct nvkm_object *);
3333 int nv20_gr_chan_init(struct nvkm_object *);
34−int nv20_gr_chan_fini(struct nvkm_object *, bool);
34+int nv20_gr_chan_fini(struct nvkm_object *, enum nvkm_suspend_state);
3535 #endif
drivers/gpu/drm/nouveau/nvkm/engine/gr/nv40.c+2−2
@@ -89,7 +89,7 @@ nv40_gr_chan_bind(struct nvkm_object *object, struct nvkm_gpuobj *parent, · 88 unmodified lines
8989 }
9090
9191 static int
92−nv40_gr_chan_fini(struct nvkm_object *object, bool suspend)
92+nv40_gr_chan_fini(struct nvkm_object *object, enum nvkm_suspend_state suspend)
9393 {
9494 struct nv40_gr_chan *chan = nv40_gr_chan(object);
9595 struct nv40_gr *gr = chan->gr;
@@ -101,7 +101,7 @@ nv40_gr_chan_fini(struct nvkm_object *object, bool suspend) · 5 unmodified lines
101101 nvkm_mask(device, 0x400720, 0x00000001, 0x00000000);
102102
103103 if (nvkm_rd32(device, 0x40032c) == inst) {
104− if (suspend) {
104+ if (suspend != NVKM_POWEROFF) {
105105 nvkm_wr32(device, 0x400720, 0x00000000);
106106 nvkm_wr32(device, 0x400784, inst);
107107 nvkm_mask(device, 0x400310, 0x00000020, 0x00000020);
drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv44.c+1−1
@@ -65,7 +65,7 @@ nv44_mpeg_chan_bind(struct nvkm_object *object, struct nvkm_gpuobj *parent, · 64 unmodified lines
6565 }
6666
6767 static int
68−nv44_mpeg_chan_fini(struct nvkm_object *object, bool suspend)
68+nv44_mpeg_chan_fini(struct nvkm_object *object, enum nvkm_suspend_state suspend)
6969 {
7070
7171 struct nv44_mpeg_chan *chan = nv44_mpeg_chan(object);
drivers/gpu/drm/nouveau/nvkm/engine/sec2/base.c+1−1
@@ -37,7 +37,7 @@ nvkm_sec2_finimsg(void *priv, struct nvfw_falcon_msg *hdr) · 36 unmodified lines
3737 }
3838
3939 static int
40−nvkm_sec2_fini(struct nvkm_engine *engine, bool suspend)
40+nvkm_sec2_fini(struct nvkm_engine *engine, enum nvkm_suspend_state suspend)
4141 {
4242 struct nvkm_sec2 *sec2 = nvkm_sec2(engine);
4343 struct nvkm_subdev *subdev = &sec2->engine.subdev;
drivers/gpu/drm/nouveau/nvkm/engine/xtensa.c+2−2
@@ -76,7 +76,7 @@ nvkm_xtensa_intr(struct nvkm_engine *engine) · 75 unmodified lines
7676 }
7777
7878 static int
79−nvkm_xtensa_fini(struct nvkm_engine *engine, bool suspend)
79+nvkm_xtensa_fini(struct nvkm_engine *engine, enum nvkm_suspend_state suspend)
8080 {
8181 struct nvkm_xtensa *xtensa = nvkm_xtensa(engine);
8282 struct nvkm_device *device = xtensa->engine.subdev.device;
@@ -85,7 +85,7 @@ nvkm_xtensa_fini(struct nvkm_engine *engine, bool suspend) · 2 unmodified lines
8585 nvkm_wr32(device, base + 0xd84, 0); /* INTR_EN */
8686 nvkm_wr32(device, base + 0xd94, 0); /* FIFO_CTRL */
8787
88− if (!suspend)
88+ if (suspend == NVKM_POWEROFF)
8989 nvkm_memory_unref(&xtensa->gpu_fw);
9090 return 0;
9191 }
drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c+1−1
@@ -182,7 +182,7 @@ nvkm_acr_managed_falcon(struct nvkm_device *device, enum nvkm_acr_lsf_id id) · 181 unmodified lines
182182 }
183183
184184 static int
185−nvkm_acr_fini(struct nvkm_subdev *subdev, bool suspend)
185+nvkm_acr_fini(struct nvkm_subdev *subdev, enum nvkm_suspend_state suspend)
186186 {
187187 if (!subdev->use.enabled)
188188 return 0;
drivers/gpu/drm/nouveau/nvkm/subdev/bar/base.c+1−1
@@ -90,7 +90,7 @@ nvkm_bar_bar2_init(struct nvkm_device *device) · 89 unmodified lines
9090 }
9191
9292 static int
93−nvkm_bar_fini(struct nvkm_subdev *subdev, bool suspend)
93+nvkm_bar_fini(struct nvkm_subdev *subdev, enum nvkm_suspend_state suspend)
9494 {
9595 struct nvkm_bar *bar = nvkm_bar(subdev);
9696
drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c+1−1
@@ -577,7 +577,7 @@ nvkm_clk_read(struct nvkm_clk *clk, enum nv_clk_src src) · 576 unmodified lines
577577 }
578578
579579 static int
580−nvkm_clk_fini(struct nvkm_subdev *subdev, bool suspend)
580+nvkm_clk_fini(struct nvkm_subdev *subdev, enum nvkm_suspend_state suspend)
581581 {
582582 struct nvkm_clk *clk = nvkm_clk(subdev);
583583 flush_work(&clk->work);
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/base.c+2−2
@@ -67,11 +67,11 @@ nvkm_devinit_post(struct nvkm_devinit *init) · 66 unmodified lines
6767 }
6868
6969 static int
70−nvkm_devinit_fini(struct nvkm_subdev *subdev, bool suspend)
70+nvkm_devinit_fini(struct nvkm_subdev *subdev, enum nvkm_suspend_state suspend)
7171 {
7272 struct nvkm_devinit *init = nvkm_devinit(subdev);
7373 /* force full reinit on resume */
74− if (suspend)
74+ if (suspend != NVKM_POWEROFF)
7575 init->post = true;
7676 return 0;
7777 }
drivers/gpu/drm/nouveau/nvkm/subdev/fault/base.c+1−1
@@ -51,7 +51,7 @@ nvkm_fault_intr(struct nvkm_subdev *subdev) · 50 unmodified lines
5151 }
5252
5353 static int
54−nvkm_fault_fini(struct nvkm_subdev *subdev, bool suspend)
54+nvkm_fault_fini(struct nvkm_subdev *subdev, enum nvkm_suspend_state suspend)
5555 {
5656 struct nvkm_fault *fault = nvkm_fault(subdev);
5757 if (fault->func->fini)
drivers/gpu/drm/nouveau/nvkm/subdev/fault/user.c+1−1
@@ -56,7 +56,7 @@ nvkm_ufault_map(struct nvkm_object *object, void *argv, u32 argc, · 55 unmodified lines
5656 }
5757
5858 static int
59−nvkm_ufault_fini(struct nvkm_object *object, bool suspend)
59+nvkm_ufault_fini(struct nvkm_object *object, enum nvkm_suspend_state suspend)
6060 {
6161 struct nvkm_fault_buffer *buffer = nvkm_fault_buffer(object);
6262 buffer->fault->func->buffer.fini(buffer);
drivers/gpu/drm/nouveau/nvkm/subdev/gpio/base.c+1−1
@@ -144,7 +144,7 @@ nvkm_gpio_intr(struct nvkm_subdev *subdev) · 143 unmodified lines
144144 }
145145
146146 static int
147−nvkm_gpio_fini(struct nvkm_subdev *subdev, bool suspend)
147+nvkm_gpio_fini(struct nvkm_subdev *subdev, enum nvkm_suspend_state suspend)
148148 {
149149 struct nvkm_gpio *gpio = nvkm_gpio(subdev);
150150 u32 mask = (1ULL << gpio->func->lines) - 1;
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/base.c+1−1
@@ -48,7 +48,7 @@ nvkm_gsp_intr_stall(struct nvkm_gsp *gsp, enum nvkm_subdev_type type, int inst) · 47 unmodified lines
4848 }
4949
5050 static int
51−nvkm_gsp_fini(struct nvkm_subdev *subdev, bool suspend)
51+nvkm_gsp_fini(struct nvkm_subdev *subdev, enum nvkm_suspend_state suspend)
5252 {
5353 struct nvkm_gsp *gsp = nvkm_gsp(subdev);
5454
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/gh100.c+1−1
@@ -17,7 +17,7 @@ · 16 unmodified lines
1717 #include <nvhw/ref/gh100/dev_riscv_pri.h>
1818
1919 int
20−gh100_gsp_fini(struct nvkm_gsp *gsp, bool suspend)
20+gh100_gsp_fini(struct nvkm_gsp *gsp, enum nvkm_suspend_state suspend)
2121 {
2222 struct nvkm_falcon *falcon = &gsp->falcon;
2323 int ret, time = 4000;
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/priv.h+4−4
@@ -59,7 +59,7 @@ struct nvkm_gsp_func { · 58 unmodified lines
5959 void (*dtor)(struct nvkm_gsp *);
6060 int (*oneinit)(struct nvkm_gsp *);
6161 int (*init)(struct nvkm_gsp *);
62− int (*fini)(struct nvkm_gsp *, bool suspend);
62+ int (*fini)(struct nvkm_gsp *, enum nvkm_suspend_state suspend);
6363 int (*reset)(struct nvkm_gsp *);
6464
6565 struct {
@@ -75,7 +75,7 @@ int tu102_gsp_fwsec_sb_ctor(struct nvkm_gsp *); · 9 unmodified lines
7575 void tu102_gsp_fwsec_sb_dtor(struct nvkm_gsp *);
7676 int tu102_gsp_oneinit(struct nvkm_gsp *);
7777 int tu102_gsp_init(struct nvkm_gsp *);
78−int tu102_gsp_fini(struct nvkm_gsp *, bool suspend);
78+int tu102_gsp_fini(struct nvkm_gsp *, enum nvkm_suspend_state suspend);
7979 int tu102_gsp_reset(struct nvkm_gsp *);
8080 u64 tu102_gsp_wpr_heap_size(struct nvkm_gsp *);
8181
@@ -87,12 +87,12 @@ int ga102_gsp_reset(struct nvkm_gsp *); · 5 unmodified lines
8787
8888 int gh100_gsp_oneinit(struct nvkm_gsp *);
8989 int gh100_gsp_init(struct nvkm_gsp *);
90−int gh100_gsp_fini(struct nvkm_gsp *, bool suspend);
90+int gh100_gsp_fini(struct nvkm_gsp *, enum nvkm_suspend_state suspend);
9191
9292 void r535_gsp_dtor(struct nvkm_gsp *);
9393 int r535_gsp_oneinit(struct nvkm_gsp *);
9494 int r535_gsp_init(struct nvkm_gsp *);
95−int r535_gsp_fini(struct nvkm_gsp *, bool suspend);
95+int r535_gsp_fini(struct nvkm_gsp *, enum nvkm_suspend_state suspend);
9696
9797 int nvkm_gsp_new_(const struct nvkm_gsp_fwif *, struct nvkm_device *, enum nvkm_subdev_type, int,
9898 struct nvkm_gsp **);
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fbsr.c+1−1
@@ -208,7 +208,7 @@ r535_fbsr_resume(struct nvkm_gsp *gsp) · 207 unmodified lines
208208 }
209209
210210 static int
211−r535_fbsr_suspend(struct nvkm_gsp *gsp)
211+r535_fbsr_suspend(struct nvkm_gsp *gsp, bool runtime)
212212 {
213213 struct nvkm_subdev *subdev = &gsp->subdev;
214214 struct nvkm_device *device = subdev->device;
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c+4−4
@@ -704,7 +704,7 @@ r535_gsp_rpc_set_registry(struct nvkm_gsp *gsp) · 703 unmodified lines
704704
705705 build_registry(gsp, rpc);
706706
707− return nvkm_gsp_rpc_wr(gsp, rpc, NVKM_GSP_RPC_REPLY_NOWAIT);
707+ return nvkm_gsp_rpc_wr(gsp, rpc, NVKM_GSP_RPC_REPLY_NOSEQ);
708708
709709 fail:
710710 clean_registry(gsp);
@@ -921,7 +921,7 @@ r535_gsp_set_system_info(struct nvkm_gsp *gsp) · 210 unmodified lines
921921 info->pciConfigMirrorSize = device->pci->func->cfg.size;
922922 r535_gsp_acpi_info(gsp, &info->acpiMethodData);
923923
924− return nvkm_gsp_rpc_wr(gsp, info, NVKM_GSP_RPC_REPLY_NOWAIT);
924+ return nvkm_gsp_rpc_wr(gsp, info, NVKM_GSP_RPC_REPLY_NOSEQ);
925925 }
926926
927927 static int
@@ -1721,7 +1721,7 @@ r535_gsp_sr_data_size(struct nvkm_gsp *gsp) · 793 unmodified lines
17211721 }
17221722
17231723 int
1724−r535_gsp_fini(struct nvkm_gsp *gsp, bool suspend)
1724+r535_gsp_fini(struct nvkm_gsp *gsp, enum nvkm_suspend_state suspend)
17251725 {
17261726 struct nvkm_rm *rm = gsp->rm;
17271727 int ret;
@@ -1748,7 +1748,7 @@ r535_gsp_fini(struct nvkm_gsp *gsp, bool suspend) · 20 unmodified lines
17481748 sr->sysmemAddrOfSuspendResumeData = gsp->sr.radix3.lvl0.addr;
17491749 sr->sizeOfSuspendResumeData = len;
17501750
1751− ret = rm->api->fbsr->suspend(gsp);
1751+ ret = rm->api->fbsr->suspend(gsp, suspend == NVKM_RUNTIME_SUSPEND);
17521752 if (ret) {
17531753 nvkm_gsp_mem_dtor(&gsp->sr.meta);
17541754 nvkm_gsp_radix3_dtor(gsp, &gsp->sr.radix3);
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/rpc.c+6−0
@@ -557,6 +557,7 @@ r535_gsp_rpc_handle_reply(struct nvkm_gsp *gsp, u32 fn, · 556 unmodified lines
557557
558558 switch (policy) {
559559 case NVKM_GSP_RPC_REPLY_NOWAIT:
560+ case NVKM_GSP_RPC_REPLY_NOSEQ:
560561 break;
561562 case NVKM_GSP_RPC_REPLY_RECV:
562563 reply = r535_gsp_msg_recv(gsp, fn, gsp_rpc_len);
@@ -588,6 +589,11 @@ r535_gsp_rpc_send(struct nvkm_gsp *gsp, void *payload, · 25 unmodified lines
588589 rpc->data, rpc->length - sizeof(*rpc), true);
589590 }
590591
592+ if (policy == NVKM_GSP_RPC_REPLY_NOSEQ)
593+ rpc->sequence = 0;
594+ else
595+ rpc->sequence = gsp->rpc_seq++;
596+
591597 ret = r535_gsp_cmdq_push(gsp, rpc);
592598 if (ret)
593599 return ERR_PTR(ret);
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/fbsr.c+4−4
@@ -62,7 +62,7 @@ r570_fbsr_resume(struct nvkm_gsp *gsp) · 61 unmodified lines
6262 }
6363
6464 static int
65−r570_fbsr_init(struct nvkm_gsp *gsp, struct sg_table *sgt, u64 size)
65+r570_fbsr_init(struct nvkm_gsp *gsp, struct sg_table *sgt, u64 size, bool runtime)
6666 {
6767 NV2080_CTRL_INTERNAL_FBSR_INIT_PARAMS *ctrl;
6868 struct nvkm_gsp_object memlist;
@@ -81,7 +81,7 @@ r570_fbsr_init(struct nvkm_gsp *gsp, struct sg_table *sgt, u64 size) · 12 unmodified lines
8181 ctrl->hClient = gsp->internal.client.object.handle;
8282 ctrl->hSysMem = memlist.handle;
8383 ctrl->sysmemAddrOfSuspendResumeData = gsp->sr.meta.addr;
84− ctrl->bEnteringGcoffState = 1;
84+ ctrl->bEnteringGcoffState = runtime ? 1 : 0;
8585
8686 ret = nvkm_gsp_rm_ctrl_wr(&gsp->internal.device.subdevice, ctrl);
8787 if (ret)
@@ -92,7 +92,7 @@ r570_fbsr_init(struct nvkm_gsp *gsp, struct sg_table *sgt, u64 size) · 4 unmodified lines
9292 }
9393
9494 static int
95−r570_fbsr_suspend(struct nvkm_gsp *gsp)
95+r570_fbsr_suspend(struct nvkm_gsp *gsp, bool runtime)
9696 {
9797 struct nvkm_subdev *subdev = &gsp->subdev;
9898 struct nvkm_device *device = subdev->device;
@@ -133,7 +133,7 @@ r570_fbsr_suspend(struct nvkm_gsp *gsp) · 34 unmodified lines
133133 return ret;
134134
135135 /* Initialise FBSR on RM. */
136− ret = r570_fbsr_init(gsp, &gsp->sr.fbsr, size);
136+ ret = r570_fbsr_init(gsp, &gsp->sr.fbsr, size, runtime);
137137 if (ret) {
138138 nvkm_gsp_sg_free(device, &gsp->sr.fbsr);
139139 return ret;
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/gsp.c+1−1
@@ -176,7 +176,7 @@ r570_gsp_set_system_info(struct nvkm_gsp *gsp) · 175 unmodified lines
176176 info->bIsPrimary = video_is_primary_device(device->dev);
177177 info->bPreserveVideoMemoryAllocations = false;
178178
179− return nvkm_gsp_rpc_wr(gsp, info, NVKM_GSP_RPC_REPLY_NOWAIT);
179+ return nvkm_gsp_rpc_wr(gsp, info, NVKM_GSP_RPC_REPLY_NOSEQ);
180180 }
181181
182182 static void
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/rm.h+1−1
@@ -78,7 +78,7 @@ struct nvkm_rm_api { · 77 unmodified lines
7878 } *device;
7979
8080 const struct nvkm_rm_api_fbsr {
81− int (*suspend)(struct nvkm_gsp *);
81+ int (*suspend)(struct nvkm_gsp *, bool runtime);
8282 void (*resume)(struct nvkm_gsp *);
8383 } *fbsr;
8484
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/tu102.c+1−1
@@ -161,7 +161,7 @@ tu102_gsp_reset(struct nvkm_gsp *gsp) · 160 unmodified lines
161161 }
162162
163163 int
164−tu102_gsp_fini(struct nvkm_gsp *gsp, bool suspend)
164+tu102_gsp_fini(struct nvkm_gsp *gsp, enum nvkm_suspend_state suspend)
165165 {
166166 u32 mbox0 = 0xff, mbox1 = 0xff;
167167 int ret;
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c+1−1
@@ -135,7 +135,7 @@ nvkm_i2c_intr(struct nvkm_subdev *subdev) · 134 unmodified lines
135135 }
136136
137137 static int
138−nvkm_i2c_fini(struct nvkm_subdev *subdev, bool suspend)
138+nvkm_i2c_fini(struct nvkm_subdev *subdev, enum nvkm_suspend_state suspend)
139139 {
140140 struct nvkm_i2c *i2c = nvkm_i2c(subdev);
141141 struct nvkm_i2c_pad *pad;
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/base.c+1−1
@@ -176,7 +176,7 @@ nvkm_instmem_boot(struct nvkm_instmem *imem) · 175 unmodified lines
176176 }
177177
178178 static int
179−nvkm_instmem_fini(struct nvkm_subdev *subdev, bool suspend)
179+nvkm_instmem_fini(struct nvkm_subdev *subdev, enum nvkm_suspend_state suspend)
180180 {
181181 struct nvkm_instmem *imem = nvkm_instmem(subdev);
182182 int ret;
drivers/gpu/drm/nouveau/nvkm/subdev/pci/base.c+1−1
@@ -74,7 +74,7 @@ nvkm_pci_rom_shadow(struct nvkm_pci *pci, bool shadow) · 73 unmodified lines
7474 }
7575
7676 static int
77−nvkm_pci_fini(struct nvkm_subdev *subdev, bool suspend)
77+nvkm_pci_fini(struct nvkm_subdev *subdev, enum nvkm_suspend_state suspend)
7878 {
7979 struct nvkm_pci *pci = nvkm_pci(subdev);
8080
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c+1−1
@@ -77,7 +77,7 @@ nvkm_pmu_intr(struct nvkm_subdev *subdev) · 76 unmodified lines
7777 }
7878
7979 static int
80−nvkm_pmu_fini(struct nvkm_subdev *subdev, bool suspend)
80+nvkm_pmu_fini(struct nvkm_subdev *subdev, enum nvkm_suspend_state suspend)
8181 {
8282 struct nvkm_pmu *pmu = nvkm_pmu(subdev);
8383
drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c+3−3
@@ -341,15 +341,15 @@ nvkm_therm_intr(struct nvkm_subdev *subdev) · 340 unmodified lines
341341 }
342342
343343 static int
344−nvkm_therm_fini(struct nvkm_subdev *subdev, bool suspend)
344+nvkm_therm_fini(struct nvkm_subdev *subdev, enum nvkm_suspend_state suspend)
345345 {
346346 struct nvkm_therm *therm = nvkm_therm(subdev);
347347
348348 if (therm->func->fini)
349349 therm->func->fini(therm);
350350
351− nvkm_therm_fan_fini(therm, suspend);
352− nvkm_therm_sensor_fini(therm, suspend);
351+ nvkm_therm_fan_fini(therm, suspend != NVKM_POWEROFF);
352+ nvkm_therm_sensor_fini(therm, suspend != NVKM_POWEROFF);
353353
354354 if (suspend) {
355355 therm->suspend = therm->mode;
drivers/gpu/drm/nouveau/nvkm/subdev/timer/base.c+1−1
@@ -149,7 +149,7 @@ nvkm_timer_intr(struct nvkm_subdev *subdev) · 148 unmodified lines
149149 }
150150
151151 static int
152−nvkm_timer_fini(struct nvkm_subdev *subdev, bool suspend)
152+nvkm_timer_fini(struct nvkm_subdev *subdev, enum nvkm_suspend_state suspend)
153153 {
154154 struct nvkm_timer *tmr = nvkm_timer(subdev);
155155 tmr->func->alarm_fini(tmr);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t