Skip to content

Commit 2cf026a

Browse files
committed
Merge branch 'linux-4.10' of git://github.com/skeggsb/linux into drm-next
- Regression fix from atomic conversion (rotation on the original G80). - Concurrency fix when clearing compression tags. - Fixes DP link training issues on GP102/4/6. - Fixes backlight handling in the presence of Apple GMUX. - Improvements to GPU error recovery in a number of scenarios. - GP106 support. * 'linux-4.10' of git://github.com/skeggsb/linux: drm/nouveau/kms/nv50: fix atomic regression on original G80 drm/nouveau/bl: Do not register interface if Apple GMUX detected drm/nouveau/bl: Assign different names to interfaces drm/nouveau/bios/dp: fix handling of LevelEntryTableIndex on DP table 4.2 drm/nouveau/ltc: protect clearing of comptags with mutex drm/nouveau/gr/gf100-: handle GPC/TPC/MPC trap drm/nouveau/core: recognise GP106 chipset drm/nouveau/ttm: wait for bo fence to signal before unmapping vmas drm/nouveau/gr/gf100-: FECS intr handling is not relevant on proprietary ucode drm/nouveau/gr/gf100-: properly ack all FECS error interrupts drm/nouveau/fifo/gf100-: recover from host mmu faults
2 parents a77a1ad + 19d53d0 commit 2cf026a

File tree

14 files changed

+171
-38
lines changed

14 files changed

+171
-38
lines changed

drivers/gpu/drm/nouveau/nouveau_backlight.c

Lines changed: 76 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,37 @@
3030
* Register locations derived from NVClock by Roderick Colenbrander
3131
*/
3232

33+
#include <linux/apple-gmux.h>
3334
#include <linux/backlight.h>
35+
#include <linux/idr.h>
3436

3537
#include "nouveau_drv.h"
3638
#include "nouveau_reg.h"
3739
#include "nouveau_encoder.h"
3840

41+
static struct ida bl_ida;
42+
#define BL_NAME_SIZE 15 // 12 for name + 2 for digits + 1 for '\0'
43+
44+
struct backlight_connector {
45+
struct list_head head;
46+
int id;
47+
};
48+
49+
static bool
50+
nouveau_get_backlight_name(char backlight_name[BL_NAME_SIZE], struct backlight_connector
51+
*connector)
52+
{
53+
const int nb = ida_simple_get(&bl_ida, 0, 0, GFP_KERNEL);
54+
if (nb < 0 || nb >= 100)
55+
return false;
56+
if (nb > 0)
57+
snprintf(backlight_name, BL_NAME_SIZE, "nv_backlight%d", nb);
58+
else
59+
snprintf(backlight_name, BL_NAME_SIZE, "nv_backlight");
60+
connector->id = nb;
61+
return true;
62+
}
63+
3964
static int
4065
nv40_get_intensity(struct backlight_device *bd)
4166
{
@@ -74,17 +99,28 @@ nv40_backlight_init(struct drm_connector *connector)
7499
struct nvif_object *device = &drm->device.object;
75100
struct backlight_properties props;
76101
struct backlight_device *bd;
102+
struct backlight_connector bl_connector;
103+
char backlight_name[BL_NAME_SIZE];
77104

78105
if (!(nvif_rd32(device, NV40_PMC_BACKLIGHT) & NV40_PMC_BACKLIGHT_MASK))
79106
return 0;
80107

81108
memset(&props, 0, sizeof(struct backlight_properties));
82109
props.type = BACKLIGHT_RAW;
83110
props.max_brightness = 31;
84-
bd = backlight_device_register("nv_backlight", connector->kdev, drm,
111+
if (!nouveau_get_backlight_name(backlight_name, &bl_connector)) {
112+
NV_ERROR(drm, "Failed to retrieve a unique name for the backlight interface\n");
113+
return 0;
114+
}
115+
bd = backlight_device_register(backlight_name , connector->kdev, drm,
85116
&nv40_bl_ops, &props);
86-
if (IS_ERR(bd))
117+
118+
if (IS_ERR(bd)) {
119+
if (bl_connector.id > 0)
120+
ida_simple_remove(&bl_ida, bl_connector.id);
87121
return PTR_ERR(bd);
122+
}
123+
list_add(&bl_connector.head, &drm->bl_connectors);
88124
drm->backlight = bd;
89125
bd->props.brightness = nv40_get_intensity(bd);
90126
backlight_update_status(bd);
@@ -182,6 +218,8 @@ nv50_backlight_init(struct drm_connector *connector)
182218
struct backlight_properties props;
183219
struct backlight_device *bd;
184220
const struct backlight_ops *ops;
221+
struct backlight_connector bl_connector;
222+
char backlight_name[BL_NAME_SIZE];
185223

186224
nv_encoder = find_encoder(connector, DCB_OUTPUT_LVDS);
187225
if (!nv_encoder) {
@@ -203,11 +241,20 @@ nv50_backlight_init(struct drm_connector *connector)
203241
memset(&props, 0, sizeof(struct backlight_properties));
204242
props.type = BACKLIGHT_RAW;
205243
props.max_brightness = 100;
206-
bd = backlight_device_register("nv_backlight", connector->kdev,
244+
if (!nouveau_get_backlight_name(backlight_name, &bl_connector)) {
245+
NV_ERROR(drm, "Failed to retrieve a unique name for the backlight interface\n");
246+
return 0;
247+
}
248+
bd = backlight_device_register(backlight_name , connector->kdev,
207249
nv_encoder, ops, &props);
208-
if (IS_ERR(bd))
250+
251+
if (IS_ERR(bd)) {
252+
if (bl_connector.id > 0)
253+
ida_simple_remove(&bl_ida, bl_connector.id);
209254
return PTR_ERR(bd);
255+
}
210256

257+
list_add(&bl_connector.head, &drm->bl_connectors);
211258
drm->backlight = bd;
212259
bd->props.brightness = bd->ops->get_brightness(bd);
213260
backlight_update_status(bd);
@@ -221,6 +268,13 @@ nouveau_backlight_init(struct drm_device *dev)
221268
struct nvif_device *device = &drm->device;
222269
struct drm_connector *connector;
223270

271+
if (apple_gmux_present()) {
272+
NV_INFO(drm, "Apple GMUX detected: not registering Nouveau backlight interface\n");
273+
return 0;
274+
}
275+
276+
INIT_LIST_HEAD(&drm->bl_connectors);
277+
224278
list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
225279
if (connector->connector_type != DRM_MODE_CONNECTOR_LVDS &&
226280
connector->connector_type != DRM_MODE_CONNECTOR_eDP)
@@ -247,9 +301,27 @@ void
247301
nouveau_backlight_exit(struct drm_device *dev)
248302
{
249303
struct nouveau_drm *drm = nouveau_drm(dev);
304+
struct backlight_connector *connector;
305+
306+
list_for_each_entry(connector, &drm->bl_connectors, head) {
307+
if (connector->id >= 0)
308+
ida_simple_remove(&bl_ida, connector->id);
309+
}
250310

251311
if (drm->backlight) {
252312
backlight_device_unregister(drm->backlight);
253313
drm->backlight = NULL;
254314
}
255315
}
316+
317+
void
318+
nouveau_backlight_ctor(void)
319+
{
320+
ida_init(&bl_ida);
321+
}
322+
323+
void
324+
nouveau_backlight_dtor(void)
325+
{
326+
ida_destroy(&bl_ida);
327+
}

drivers/gpu/drm/nouveau/nouveau_bo.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,6 +1209,7 @@ nouveau_bo_move_ntfy(struct ttm_buffer_object *bo, struct ttm_mem_reg *new_mem)
12091209
nvbo->page_shift != vma->vm->mmu->lpg_shift)) {
12101210
nvkm_vm_map(vma, new_mem->mm_node);
12111211
} else {
1212+
WARN_ON(ttm_bo_wait(bo, false, false));
12121213
nvkm_vm_unmap(vma);
12131214
}
12141215
}

drivers/gpu/drm/nouveau/nouveau_display.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ int nouveau_crtc_set_config(struct drm_mode_set *set);
9191
#ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT
9292
extern int nouveau_backlight_init(struct drm_device *);
9393
extern void nouveau_backlight_exit(struct drm_device *);
94+
extern void nouveau_backlight_ctor(void);
95+
extern void nouveau_backlight_dtor(void);
9496
#else
9597
static inline int
9698
nouveau_backlight_init(struct drm_device *dev)
@@ -101,6 +103,14 @@ nouveau_backlight_init(struct drm_device *dev)
101103
static inline void
102104
nouveau_backlight_exit(struct drm_device *dev) {
103105
}
106+
107+
static inline void
108+
nouveau_backlight_ctor(void) {
109+
}
110+
111+
static inline void
112+
nouveau_backlight_dtor(void) {
113+
}
104114
#endif
105115

106116
struct drm_framebuffer *

drivers/gpu/drm/nouveau/nouveau_drm.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,6 +1122,7 @@ nouveau_drm_init(void)
11221122
#endif
11231123

11241124
nouveau_register_dsm_handler();
1125+
nouveau_backlight_ctor();
11251126
return drm_pci_init(&driver_pci, &nouveau_drm_pci_driver);
11261127
}
11271128

@@ -1132,6 +1133,7 @@ nouveau_drm_exit(void)
11321133
return;
11331134

11341135
drm_pci_exit(&driver_pci, &nouveau_drm_pci_driver);
1136+
nouveau_backlight_dtor();
11351137
nouveau_unregister_dsm_handler();
11361138

11371139
#ifdef CONFIG_NOUVEAU_PLATFORM_DRIVER

drivers/gpu/drm/nouveau/nouveau_drv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ struct nouveau_drm {
163163
struct nvbios vbios;
164164
struct nouveau_display *display;
165165
struct backlight_device *backlight;
166+
struct list_head bl_connectors;
166167
struct work_struct hpd_work;
167168
#ifdef CONFIG_ACPI
168169
struct notifier_block acpi_nb;

drivers/gpu/drm/nouveau/nv50_display.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,6 +1726,11 @@ nv50_head_core_set(struct nv50_head *head, struct nv50_head_atom *asyh)
17261726
evo_data(push, asyh->core.handle);
17271727
evo_mthd(push, 0x08c0 + head->base.index * 0x400, 1);
17281728
evo_data(push, (asyh->core.y << 16) | asyh->core.x);
1729+
/* EVO will complain with INVALID_STATE if we have an
1730+
* active cursor and (re)specify HeadSetContextDmaIso
1731+
* without also updating HeadSetOffsetCursor.
1732+
*/
1733+
asyh->set.curs = asyh->curs.visible;
17291734
} else
17301735
if (core->base.user.oclass < GF110_DISP_CORE_CHANNEL_DMA) {
17311736
evo_mthd(push, 0x0860 + head->base.index * 0x400, 1);

drivers/gpu/drm/nouveau/nvkm/engine/device/base.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2241,6 +2241,35 @@ nv134_chipset = {
22412241
.fifo = gp100_fifo_new,
22422242
};
22432243

2244+
static const struct nvkm_device_chip
2245+
nv136_chipset = {
2246+
.name = "GP106",
2247+
.bar = gf100_bar_new,
2248+
.bios = nvkm_bios_new,
2249+
.bus = gf100_bus_new,
2250+
.devinit = gm200_devinit_new,
2251+
.fb = gp102_fb_new,
2252+
.fuse = gm107_fuse_new,
2253+
.gpio = gk104_gpio_new,
2254+
.i2c = gm200_i2c_new,
2255+
.ibus = gm200_ibus_new,
2256+
.imem = nv50_instmem_new,
2257+
.ltc = gp100_ltc_new,
2258+
.mc = gp100_mc_new,
2259+
.mmu = gf100_mmu_new,
2260+
.pci = gp100_pci_new,
2261+
.pmu = gp102_pmu_new,
2262+
.timer = gk20a_timer_new,
2263+
.top = gk104_top_new,
2264+
.ce[0] = gp102_ce_new,
2265+
.ce[1] = gp102_ce_new,
2266+
.ce[2] = gp102_ce_new,
2267+
.ce[3] = gp102_ce_new,
2268+
.disp = gp102_disp_new,
2269+
.dma = gf119_dma_new,
2270+
.fifo = gp100_fifo_new,
2271+
};
2272+
22442273
static int
22452274
nvkm_device_event_ctor(struct nvkm_object *object, void *data, u32 size,
22462275
struct nvkm_notify *notify)
@@ -2677,6 +2706,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
26772706
case 0x130: device->chip = &nv130_chipset; break;
26782707
case 0x132: device->chip = &nv132_chipset; break;
26792708
case 0x134: device->chip = &nv134_chipset; break;
2709+
case 0x136: device->chip = &nv136_chipset; break;
26802710
default:
26812711
nvdev_error(device, "unknown chipset (%08x)\n", boot0);
26822712
goto done;

drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ gf100_fifo_recover(struct gf100_fifo *fifo, struct nvkm_engine *engine,
180180
list_del_init(&chan->head);
181181
chan->killed = true;
182182

183-
fifo->recover.mask |= 1ULL << engine->subdev.index;
183+
if (engine != &fifo->base.engine)
184+
fifo->recover.mask |= 1ULL << engine->subdev.index;
184185
schedule_work(&fifo->recover.work);
185186
}
186187

drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -743,14 +743,14 @@ gk104_fifo_fault_engine[] = {
743743
{ 0x04, "BAR1", NULL, NVKM_SUBDEV_BAR },
744744
{ 0x05, "BAR2", NULL, NVKM_SUBDEV_INSTMEM },
745745
{ 0x06, "SCHED" },
746-
{ 0x07, "HOST0" },
747-
{ 0x08, "HOST1" },
748-
{ 0x09, "HOST2" },
749-
{ 0x0a, "HOST3" },
750-
{ 0x0b, "HOST4" },
751-
{ 0x0c, "HOST5" },
752-
{ 0x0d, "HOST6" },
753-
{ 0x0e, "HOST7" },
746+
{ 0x07, "HOST0", NULL, NVKM_ENGINE_FIFO },
747+
{ 0x08, "HOST1", NULL, NVKM_ENGINE_FIFO },
748+
{ 0x09, "HOST2", NULL, NVKM_ENGINE_FIFO },
749+
{ 0x0a, "HOST3", NULL, NVKM_ENGINE_FIFO },
750+
{ 0x0b, "HOST4", NULL, NVKM_ENGINE_FIFO },
751+
{ 0x0c, "HOST5", NULL, NVKM_ENGINE_FIFO },
752+
{ 0x0d, "HOST6", NULL, NVKM_ENGINE_FIFO },
753+
{ 0x0e, "HOST7", NULL, NVKM_ENGINE_FIFO },
754754
{ 0x0f, "HOSTSR" },
755755
{ 0x10, "MSVLD", NULL, NVKM_ENGINE_MSVLD },
756756
{ 0x11, "MSPPP", NULL, NVKM_ENGINE_MSPPP },

drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm107.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ gm107_fifo_fault_engine[] = {
3232
{ 0x04, "BAR1", NULL, NVKM_SUBDEV_BAR },
3333
{ 0x05, "BAR2", NULL, NVKM_SUBDEV_INSTMEM },
3434
{ 0x06, "SCHED" },
35-
{ 0x07, "HOST0" },
36-
{ 0x08, "HOST1" },
37-
{ 0x09, "HOST2" },
38-
{ 0x0a, "HOST3" },
39-
{ 0x0b, "HOST4" },
40-
{ 0x0c, "HOST5" },
41-
{ 0x0d, "HOST6" },
42-
{ 0x0e, "HOST7" },
35+
{ 0x07, "HOST0", NULL, NVKM_ENGINE_FIFO },
36+
{ 0x08, "HOST1", NULL, NVKM_ENGINE_FIFO },
37+
{ 0x09, "HOST2", NULL, NVKM_ENGINE_FIFO },
38+
{ 0x0a, "HOST3", NULL, NVKM_ENGINE_FIFO },
39+
{ 0x0b, "HOST4", NULL, NVKM_ENGINE_FIFO },
40+
{ 0x0c, "HOST5", NULL, NVKM_ENGINE_FIFO },
41+
{ 0x0d, "HOST6", NULL, NVKM_ENGINE_FIFO },
42+
{ 0x0e, "HOST7", NULL, NVKM_ENGINE_FIFO },
4343
{ 0x0f, "HOSTSR" },
4444
{ 0x13, "PERF" },
4545
{ 0x17, "PMU" },

0 commit comments

Comments
 (0)