Skip to content

Commit 0cb65c8

Browse files
committed
Merge tag 'drm-fixes-for-v4.9-rc8' of git://people.freedesktop.org/~airlied/linux
Pull drm fixes from Dave Airlie: "A pretty small pull request: a couple of AMD powerxpress regression fixes and a power management fix, a couple of i915 fixes and one hdlcd fix, along with one core don't oops because of incorrect API usage fix" * tag 'drm-fixes-for-v4.9-rc8' of git://people.freedesktop.org/~airlied/linux: drm/i915: drop the struct_mutex when wedged or trying to reset drm/i915: Don't touch NULL sg on i915_gem_object_get_pages_gtt() error drm: Don't call drm_for_each_crtc with a non-KMS driver drm/radeon: fix check for port PM availability drm/amdgpu: fix check for port PM availability drm/amd/powerplay: initialize the soft_regs offset in struct smu7_hwmgr drm: hdlcd: Fix cleanup order
2 parents 3c49de5 + ab7cd8d commit 0cb65c8

File tree

7 files changed

+34
-13
lines changed

7 files changed

+34
-13
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,6 @@ static int amdgpu_atpx_power_state(enum vga_switcheroo_client_id id,
485485
*/
486486
static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)
487487
{
488-
struct pci_dev *parent_pdev = pci_upstream_bridge(pdev);
489488
acpi_handle dhandle, atpx_handle;
490489
acpi_status status;
491490

@@ -500,7 +499,6 @@ static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)
500499
}
501500
amdgpu_atpx_priv.dhandle = dhandle;
502501
amdgpu_atpx_priv.atpx.handle = atpx_handle;
503-
amdgpu_atpx_priv.bridge_pm_usable = parent_pdev && parent_pdev->bridge_d3;
504502
return true;
505503
}
506504

@@ -562,24 +560,33 @@ static bool amdgpu_atpx_detect(void)
562560
struct pci_dev *pdev = NULL;
563561
bool has_atpx = false;
564562
int vga_count = 0;
563+
bool d3_supported = false;
564+
struct pci_dev *parent_pdev;
565565

566566
while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {
567567
vga_count++;
568568

569569
has_atpx |= (amdgpu_atpx_pci_probe_handle(pdev) == true);
570+
571+
parent_pdev = pci_upstream_bridge(pdev);
572+
d3_supported |= parent_pdev && parent_pdev->bridge_d3;
570573
}
571574

572575
while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) {
573576
vga_count++;
574577

575578
has_atpx |= (amdgpu_atpx_pci_probe_handle(pdev) == true);
579+
580+
parent_pdev = pci_upstream_bridge(pdev);
581+
d3_supported |= parent_pdev && parent_pdev->bridge_d3;
576582
}
577583

578584
if (has_atpx && vga_count == 2) {
579585
acpi_get_name(amdgpu_atpx_priv.atpx.handle, ACPI_FULL_PATHNAME, &buffer);
580586
printk(KERN_INFO "vga_switcheroo: detected switching method %s handle\n",
581587
acpi_method_name);
582588
amdgpu_atpx_priv.atpx_detected = true;
589+
amdgpu_atpx_priv.bridge_pm_usable = d3_supported;
583590
amdgpu_atpx_init();
584591
return true;
585592
}

drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2214,6 +2214,7 @@ uint32_t polaris10_get_mac_definition(uint32_t value)
22142214
int polaris10_process_firmware_header(struct pp_hwmgr *hwmgr)
22152215
{
22162216
struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smumgr->backend);
2217+
struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
22172218
uint32_t tmp;
22182219
int result;
22192220
bool error = false;
@@ -2233,8 +2234,10 @@ int polaris10_process_firmware_header(struct pp_hwmgr *hwmgr)
22332234
offsetof(SMU74_Firmware_Header, SoftRegisters),
22342235
&tmp, SMC_RAM_END);
22352236

2236-
if (!result)
2237+
if (!result) {
2238+
data->soft_regs_start = tmp;
22372239
smu_data->smu7_data.soft_regs_start = tmp;
2240+
}
22382241

22392242
error |= (0 != result);
22402243

drivers/gpu/drm/arm/hdlcd_drv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,6 @@ static int hdlcd_drm_bind(struct device *dev)
375375

376376
err_fbdev:
377377
drm_kms_helper_poll_fini(drm);
378-
drm_mode_config_cleanup(drm);
379378
drm_vblank_cleanup(drm);
380379
err_vblank:
381380
pm_runtime_disable(drm->dev);
@@ -387,6 +386,7 @@ static int hdlcd_drm_bind(struct device *dev)
387386
drm_irq_uninstall(drm);
388387
of_reserved_mem_device_release(drm->dev);
389388
err_free:
389+
drm_mode_config_cleanup(drm);
390390
dev_set_drvdata(dev, NULL);
391391
drm_dev_unref(drm);
392392

drivers/gpu/drm/drm_ioctl.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,12 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
254254
req->value = dev->mode_config.async_page_flip;
255255
break;
256256
case DRM_CAP_PAGE_FLIP_TARGET:
257-
req->value = 1;
258-
drm_for_each_crtc(crtc, dev) {
259-
if (!crtc->funcs->page_flip_target)
260-
req->value = 0;
257+
if (drm_core_check_feature(dev, DRIVER_MODESET)) {
258+
req->value = 1;
259+
drm_for_each_crtc(crtc, dev) {
260+
if (!crtc->funcs->page_flip_target)
261+
req->value = 0;
262+
}
261263
}
262264
break;
263265
case DRM_CAP_CURSOR_WIDTH:

drivers/gpu/drm/i915/i915_gem.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2268,7 +2268,7 @@ i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj)
22682268
page = shmem_read_mapping_page(mapping, i);
22692269
if (IS_ERR(page)) {
22702270
ret = PTR_ERR(page);
2271-
goto err_pages;
2271+
goto err_sg;
22722272
}
22732273
}
22742274
#ifdef CONFIG_SWIOTLB
@@ -2311,8 +2311,9 @@ i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj)
23112311

23122312
return 0;
23132313

2314-
err_pages:
2314+
err_sg:
23152315
sg_mark_end(sg);
2316+
err_pages:
23162317
for_each_sgt_page(page, sgt_iter, st)
23172318
put_page(page);
23182319
sg_free_table(st);

drivers/gpu/drm/i915/intel_display.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12260,7 +12260,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
1226012260
intel_crtc->reset_count = i915_reset_count(&dev_priv->gpu_error);
1226112261
if (i915_reset_in_progress_or_wedged(&dev_priv->gpu_error)) {
1226212262
ret = -EIO;
12263-
goto cleanup;
12263+
goto unlock;
1226412264
}
1226512265

1226612266
atomic_inc(&intel_crtc->unpin_work_count);
@@ -12352,6 +12352,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
1235212352
intel_unpin_fb_obj(fb, crtc->primary->state->rotation);
1235312353
cleanup_pending:
1235412354
atomic_dec(&intel_crtc->unpin_work_count);
12355+
unlock:
1235512356
mutex_unlock(&dev->struct_mutex);
1235612357
cleanup:
1235712358
crtc->primary->fb = old_fb;

drivers/gpu/drm/radeon/radeon_atpx_handler.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,6 @@ static int radeon_atpx_power_state(enum vga_switcheroo_client_id id,
479479
*/
480480
static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev)
481481
{
482-
struct pci_dev *parent_pdev = pci_upstream_bridge(pdev);
483482
acpi_handle dhandle, atpx_handle;
484483
acpi_status status;
485484

@@ -493,7 +492,6 @@ static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev)
493492

494493
radeon_atpx_priv.dhandle = dhandle;
495494
radeon_atpx_priv.atpx.handle = atpx_handle;
496-
radeon_atpx_priv.bridge_pm_usable = parent_pdev && parent_pdev->bridge_d3;
497495
return true;
498496
}
499497

@@ -555,25 +553,34 @@ static bool radeon_atpx_detect(void)
555553
struct pci_dev *pdev = NULL;
556554
bool has_atpx = false;
557555
int vga_count = 0;
556+
bool d3_supported = false;
557+
struct pci_dev *parent_pdev;
558558

559559
while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {
560560
vga_count++;
561561

562562
has_atpx |= (radeon_atpx_pci_probe_handle(pdev) == true);
563+
564+
parent_pdev = pci_upstream_bridge(pdev);
565+
d3_supported |= parent_pdev && parent_pdev->bridge_d3;
563566
}
564567

565568
/* some newer PX laptops mark the dGPU as a non-VGA display device */
566569
while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) {
567570
vga_count++;
568571

569572
has_atpx |= (radeon_atpx_pci_probe_handle(pdev) == true);
573+
574+
parent_pdev = pci_upstream_bridge(pdev);
575+
d3_supported |= parent_pdev && parent_pdev->bridge_d3;
570576
}
571577

572578
if (has_atpx && vga_count == 2) {
573579
acpi_get_name(radeon_atpx_priv.atpx.handle, ACPI_FULL_PATHNAME, &buffer);
574580
printk(KERN_INFO "vga_switcheroo: detected switching method %s handle\n",
575581
acpi_method_name);
576582
radeon_atpx_priv.atpx_detected = true;
583+
radeon_atpx_priv.bridge_pm_usable = d3_supported;
577584
radeon_atpx_init();
578585
return true;
579586
}

0 commit comments

Comments
 (0)