Skip to content

Commit 545aabc

Browse files
committed
Merge tag 'drm-fixes-2019-02-15-1' of git://anongit.freedesktop.org/drm/drm
Pull drm fixes from Dave Airlie: "Usual pull request, little larger than I'd like but nothing too strange in it. Willy found an bug in the lease ioctl calculations, but it's a drm master only ioctl which makes it harder to mess with. i915: - combo phy programming fix - opregion version check fix for VBT RVDA lookup - gem mmap ioctl race fix - fbdev hpd during suspend fix - array size bounds check fix in pmu amdgpu: - Vega20 psp fix - Add vrr range to debugfs for freesync debugging sched: - Scheduler race fix vkms: - license header fixups imx: - Fix CSI register offsets for i.MX51 and i.MX53. - Fix delayed page flip completion events on i.MX6QP due to unexpected behaviour of the PRE when issuing NOP buffer updates to the same buffer address. - Stop throwing errors for plane updates on disabled CRTCs when a userspace process is killed while a plane update is pending. - Add missing of_node_put cleanup in imx_ldb_bind" * tag 'drm-fixes-2019-02-15-1' of git://anongit.freedesktop.org/drm/drm: drm: Use array_size() when creating lease drm/amdgpu/psp11: TA firmware is optional (v3) drm/i915/opregion: rvda is relative from opregion base in opregion 2.1+ drm/i915/opregion: fix version check drm/i915: Prevent a race during I915_GEM_MMAP ioctl with WC set drm/i915: Block fbdev HPD processing during suspend drm/i915/pmu: Fix enable count array size and bounds checking drm/i915/cnl: Fix CNL macros for Voltage Swing programming drm/i915/icl: combo port vswing programming changes per BSPEC drm/vkms: Fix license inconsistent drm/amd/display: Expose connector VRR range via debugfs drm/sched: Always trace the dependencies we wait on, to fix a race. gpu: ipu-v3: pre: don't trigger update if buffer address doesn't change gpu: ipu-v3: Fix CSI offsets for imx53 drm/imx: imx-ldb: add missing of_node_puts gpu: ipu-v3: Fix i.MX51 CSI control registers offset drm/imx: ignore plane updates on disabled crtcs
2 parents 2aba322 + 69ef943 commit 545aabc

26 files changed

+294
-248
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,10 @@ static int psp_sw_fini(void *handle)
9090
adev->psp.sos_fw = NULL;
9191
release_firmware(adev->psp.asd_fw);
9292
adev->psp.asd_fw = NULL;
93-
release_firmware(adev->psp.ta_fw);
94-
adev->psp.ta_fw = NULL;
93+
if (adev->psp.ta_fw) {
94+
release_firmware(adev->psp.ta_fw);
95+
adev->psp.ta_fw = NULL;
96+
}
9597
return 0;
9698
}
9799

@@ -435,6 +437,9 @@ static int psp_xgmi_initialize(struct psp_context *psp)
435437
struct ta_xgmi_shared_memory *xgmi_cmd;
436438
int ret;
437439

440+
if (!psp->adev->psp.ta_fw)
441+
return -ENOENT;
442+
438443
if (!psp->xgmi_context.initialized) {
439444
ret = psp_xgmi_init_shared_buf(psp);
440445
if (ret)

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

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -152,18 +152,22 @@ static int psp_v11_0_init_microcode(struct psp_context *psp)
152152

153153
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ta.bin", chip_name);
154154
err = request_firmware(&adev->psp.ta_fw, fw_name, adev->dev);
155-
if (err)
156-
goto out2;
157-
158-
err = amdgpu_ucode_validate(adev->psp.ta_fw);
159-
if (err)
160-
goto out2;
161-
162-
ta_hdr = (const struct ta_firmware_header_v1_0 *)adev->psp.ta_fw->data;
163-
adev->psp.ta_xgmi_ucode_version = le32_to_cpu(ta_hdr->ta_xgmi_ucode_version);
164-
adev->psp.ta_xgmi_ucode_size = le32_to_cpu(ta_hdr->ta_xgmi_size_bytes);
165-
adev->psp.ta_xgmi_start_addr = (uint8_t *)ta_hdr +
166-
le32_to_cpu(ta_hdr->header.ucode_array_offset_bytes);
155+
if (err) {
156+
release_firmware(adev->psp.ta_fw);
157+
adev->psp.ta_fw = NULL;
158+
dev_info(adev->dev,
159+
"psp v11.0: Failed to load firmware \"%s\"\n", fw_name);
160+
} else {
161+
err = amdgpu_ucode_validate(adev->psp.ta_fw);
162+
if (err)
163+
goto out2;
164+
165+
ta_hdr = (const struct ta_firmware_header_v1_0 *)adev->psp.ta_fw->data;
166+
adev->psp.ta_xgmi_ucode_version = le32_to_cpu(ta_hdr->ta_xgmi_ucode_version);
167+
adev->psp.ta_xgmi_ucode_size = le32_to_cpu(ta_hdr->ta_xgmi_size_bytes);
168+
adev->psp.ta_xgmi_start_addr = (uint8_t *)ta_hdr +
169+
le32_to_cpu(ta_hdr->header.ucode_array_offset_bytes);
170+
}
167171

168172
return 0;
169173

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,25 @@ static ssize_t dp_phy_test_pattern_debugfs_write(struct file *f, const char __us
671671
return bytes_from_user;
672672
}
673673

674+
/*
675+
* Returns the min and max vrr vfreq through the connector's debugfs file.
676+
* Example usage: cat /sys/kernel/debug/dri/0/DP-1/vrr_range
677+
*/
678+
static int vrr_range_show(struct seq_file *m, void *data)
679+
{
680+
struct drm_connector *connector = m->private;
681+
struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
682+
683+
if (connector->status != connector_status_connected)
684+
return -ENODEV;
685+
686+
seq_printf(m, "Min: %u\n", (unsigned int)aconnector->min_vfreq);
687+
seq_printf(m, "Max: %u\n", (unsigned int)aconnector->max_vfreq);
688+
689+
return 0;
690+
}
691+
DEFINE_SHOW_ATTRIBUTE(vrr_range);
692+
674693
static const struct file_operations dp_link_settings_debugfs_fops = {
675694
.owner = THIS_MODULE,
676695
.read = dp_link_settings_read,
@@ -697,7 +716,8 @@ static const struct {
697716
} dp_debugfs_entries[] = {
698717
{"link_settings", &dp_link_settings_debugfs_fops},
699718
{"phy_settings", &dp_phy_settings_debugfs_fop},
700-
{"test_pattern", &dp_phy_test_pattern_fops}
719+
{"test_pattern", &dp_phy_test_pattern_fops},
720+
{"vrr_range", &vrr_range_fops}
701721
};
702722

703723
int connector_debugfs_init(struct amdgpu_dm_connector *connector)

drivers/gpu/drm/drm_lease.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,8 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev,
528528

529529
object_count = cl->object_count;
530530

531-
object_ids = memdup_user(u64_to_user_ptr(cl->object_ids), object_count * sizeof(__u32));
531+
object_ids = memdup_user(u64_to_user_ptr(cl->object_ids),
532+
array_size(object_count, sizeof(__u32)));
532533
if (IS_ERR(object_ids))
533534
return PTR_ERR(object_ids);
534535

drivers/gpu/drm/i915/i915_gem.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1824,6 +1824,16 @@ i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,
18241824
return 0;
18251825
}
18261826

1827+
static inline bool
1828+
__vma_matches(struct vm_area_struct *vma, struct file *filp,
1829+
unsigned long addr, unsigned long size)
1830+
{
1831+
if (vma->vm_file != filp)
1832+
return false;
1833+
1834+
return vma->vm_start == addr && (vma->vm_end - vma->vm_start) == size;
1835+
}
1836+
18271837
/**
18281838
* i915_gem_mmap_ioctl - Maps the contents of an object, returning the address
18291839
* it is mapped to.
@@ -1882,7 +1892,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
18821892
return -EINTR;
18831893
}
18841894
vma = find_vma(mm, addr);
1885-
if (vma)
1895+
if (vma && __vma_matches(vma, obj->base.filp, addr, args->size))
18861896
vma->vm_page_prot =
18871897
pgprot_writecombine(vm_get_page_prot(vma->vm_flags));
18881898
else

drivers/gpu/drm/i915/i915_pmu.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,8 @@ static void i915_pmu_enable(struct perf_event *event)
594594
* Update the bitmask of enabled events and increment
595595
* the event reference counter.
596596
*/
597-
GEM_BUG_ON(bit >= I915_PMU_MASK_BITS);
597+
BUILD_BUG_ON(ARRAY_SIZE(i915->pmu.enable_count) != I915_PMU_MASK_BITS);
598+
GEM_BUG_ON(bit >= ARRAY_SIZE(i915->pmu.enable_count));
598599
GEM_BUG_ON(i915->pmu.enable_count[bit] == ~0);
599600
i915->pmu.enable |= BIT_ULL(bit);
600601
i915->pmu.enable_count[bit]++;
@@ -615,11 +616,16 @@ static void i915_pmu_enable(struct perf_event *event)
615616
engine = intel_engine_lookup_user(i915,
616617
engine_event_class(event),
617618
engine_event_instance(event));
618-
GEM_BUG_ON(!engine);
619-
engine->pmu.enable |= BIT(sample);
620619

621-
GEM_BUG_ON(sample >= I915_PMU_SAMPLE_BITS);
620+
BUILD_BUG_ON(ARRAY_SIZE(engine->pmu.enable_count) !=
621+
I915_ENGINE_SAMPLE_COUNT);
622+
BUILD_BUG_ON(ARRAY_SIZE(engine->pmu.sample) !=
623+
I915_ENGINE_SAMPLE_COUNT);
624+
GEM_BUG_ON(sample >= ARRAY_SIZE(engine->pmu.enable_count));
625+
GEM_BUG_ON(sample >= ARRAY_SIZE(engine->pmu.sample));
622626
GEM_BUG_ON(engine->pmu.enable_count[sample] == ~0);
627+
628+
engine->pmu.enable |= BIT(sample);
623629
engine->pmu.enable_count[sample]++;
624630
}
625631

@@ -649,9 +655,11 @@ static void i915_pmu_disable(struct perf_event *event)
649655
engine = intel_engine_lookup_user(i915,
650656
engine_event_class(event),
651657
engine_event_instance(event));
652-
GEM_BUG_ON(!engine);
653-
GEM_BUG_ON(sample >= I915_PMU_SAMPLE_BITS);
658+
659+
GEM_BUG_ON(sample >= ARRAY_SIZE(engine->pmu.enable_count));
660+
GEM_BUG_ON(sample >= ARRAY_SIZE(engine->pmu.sample));
654661
GEM_BUG_ON(engine->pmu.enable_count[sample] == 0);
662+
655663
/*
656664
* Decrement the reference count and clear the enabled
657665
* bitmask when the last listener on an event goes away.
@@ -660,7 +668,7 @@ static void i915_pmu_disable(struct perf_event *event)
660668
engine->pmu.enable &= ~BIT(sample);
661669
}
662670

663-
GEM_BUG_ON(bit >= I915_PMU_MASK_BITS);
671+
GEM_BUG_ON(bit >= ARRAY_SIZE(i915->pmu.enable_count));
664672
GEM_BUG_ON(i915->pmu.enable_count[bit] == 0);
665673
/*
666674
* Decrement the reference count and clear the enabled

drivers/gpu/drm/i915/i915_pmu.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ enum {
3131
((1 << I915_PMU_SAMPLE_BITS) + \
3232
(I915_PMU_LAST + 1 - __I915_PMU_OTHER(0)))
3333

34+
#define I915_ENGINE_SAMPLE_COUNT (I915_SAMPLE_SEMA + 1)
35+
3436
struct i915_pmu_sample {
3537
u64 cur;
3638
};

drivers/gpu/drm/i915/i915_reg.h

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1790,15 +1790,15 @@ enum i915_power_well_id {
17901790
#define _CNL_PORT_TX_C_LN0_OFFSET 0x162C40
17911791
#define _CNL_PORT_TX_D_LN0_OFFSET 0x162E40
17921792
#define _CNL_PORT_TX_F_LN0_OFFSET 0x162840
1793-
#define _CNL_PORT_TX_DW_GRP(port, dw) (_PICK((port), \
1793+
#define _CNL_PORT_TX_DW_GRP(dw, port) (_PICK((port), \
17941794
_CNL_PORT_TX_AE_GRP_OFFSET, \
17951795
_CNL_PORT_TX_B_GRP_OFFSET, \
17961796
_CNL_PORT_TX_B_GRP_OFFSET, \
17971797
_CNL_PORT_TX_D_GRP_OFFSET, \
17981798
_CNL_PORT_TX_AE_GRP_OFFSET, \
17991799
_CNL_PORT_TX_F_GRP_OFFSET) + \
18001800
4 * (dw))
1801-
#define _CNL_PORT_TX_DW_LN0(port, dw) (_PICK((port), \
1801+
#define _CNL_PORT_TX_DW_LN0(dw, port) (_PICK((port), \
18021802
_CNL_PORT_TX_AE_LN0_OFFSET, \
18031803
_CNL_PORT_TX_B_LN0_OFFSET, \
18041804
_CNL_PORT_TX_B_LN0_OFFSET, \
@@ -1834,9 +1834,9 @@ enum i915_power_well_id {
18341834

18351835
#define _CNL_PORT_TX_DW4_LN0_AE 0x162450
18361836
#define _CNL_PORT_TX_DW4_LN1_AE 0x1624D0
1837-
#define CNL_PORT_TX_DW4_GRP(port) _MMIO(_CNL_PORT_TX_DW_GRP((port), 4))
1838-
#define CNL_PORT_TX_DW4_LN0(port) _MMIO(_CNL_PORT_TX_DW_LN0((port), 4))
1839-
#define CNL_PORT_TX_DW4_LN(port, ln) _MMIO(_CNL_PORT_TX_DW_LN0((port), 4) + \
1837+
#define CNL_PORT_TX_DW4_GRP(port) _MMIO(_CNL_PORT_TX_DW_GRP(4, (port)))
1838+
#define CNL_PORT_TX_DW4_LN0(port) _MMIO(_CNL_PORT_TX_DW_LN0(4, (port)))
1839+
#define CNL_PORT_TX_DW4_LN(port, ln) _MMIO(_CNL_PORT_TX_DW_LN0(4, (port)) + \
18401840
((ln) * (_CNL_PORT_TX_DW4_LN1_AE - \
18411841
_CNL_PORT_TX_DW4_LN0_AE)))
18421842
#define ICL_PORT_TX_DW4_AUX(port) _MMIO(_ICL_PORT_TX_DW_AUX(4, port))
@@ -1864,8 +1864,12 @@ enum i915_power_well_id {
18641864
#define RTERM_SELECT(x) ((x) << 3)
18651865
#define RTERM_SELECT_MASK (0x7 << 3)
18661866

1867-
#define CNL_PORT_TX_DW7_GRP(port) _MMIO(_CNL_PORT_TX_DW_GRP((port), 7))
1868-
#define CNL_PORT_TX_DW7_LN0(port) _MMIO(_CNL_PORT_TX_DW_LN0((port), 7))
1867+
#define CNL_PORT_TX_DW7_GRP(port) _MMIO(_CNL_PORT_TX_DW_GRP(7, (port)))
1868+
#define CNL_PORT_TX_DW7_LN0(port) _MMIO(_CNL_PORT_TX_DW_LN0(7, (port)))
1869+
#define ICL_PORT_TX_DW7_AUX(port) _MMIO(_ICL_PORT_TX_DW_AUX(7, port))
1870+
#define ICL_PORT_TX_DW7_GRP(port) _MMIO(_ICL_PORT_TX_DW_GRP(7, port))
1871+
#define ICL_PORT_TX_DW7_LN0(port) _MMIO(_ICL_PORT_TX_DW_LN(7, 0, port))
1872+
#define ICL_PORT_TX_DW7_LN(port, ln) _MMIO(_ICL_PORT_TX_DW_LN(7, ln, port))
18691873
#define N_SCALAR(x) ((x) << 24)
18701874
#define N_SCALAR_MASK (0x7F << 24)
18711875

0 commit comments

Comments
 (0)