Skip to content

Commit 82cce5f

Browse files
committed
Merge tag 'drm-fixes-2021-08-13' of git://anongit.freedesktop.org/drm/drm
Pull drm fixes from Dave Airlie: "Another week, another set of pretty regular fixes, nothing really stands out too much. amdgpu: - Yellow carp update - RAS EEPROM fixes - BACO/BOCO fixes - Fix a memory leak in an error path - Freesync fix - VCN harvesting fix - Display fixes i915: - GVT fix for Windows VM hang. - Display fix of 12 BPC bits for display 12 and newer. - Don't try to access some media register for fused off domains. - Fix kerneldoc build warnings. mediatek: - Fix dpi bridge bug. - Fix cursor plane no update. meson: - Fix colors when booting with HDR" * tag 'drm-fixes-2021-08-13' of git://anongit.freedesktop.org/drm/drm: drm/doc/rfc: drop lmem uapi section drm/i915: Only access SFC_DONE when media domain is not fused off drm/i915/display: Fix the 12 BPC bits for PIPE_MISC reg drm/amd/display: use GFP_ATOMIC in amdgpu_dm_irq_schedule_work drm/amd/display: Remove invalid assert for ODM + MPC case drm/amd/pm: bug fix for the runtime pm BACO drm/amdgpu: handle VCN instances when harvesting (v2) drm/meson: fix colour distortion from HDR set during vendor u-boot drm/i915/gvt: Fix cached atomics setting for Windows VM drm/amdgpu: Add preferred mode in modeset when freesync video mode's enabled. drm/amd/pm: Fix a memory leak in an error handling path in 'vangogh_tables_init()' drm/amdgpu: don't enable baco on boco platforms in runpm drm/amdgpu: set RAS EEPROM address from VBIOS drm/amd/pm: update smu v13.0.1 firmware header drm/mediatek: Fix cursor plane no update drm/mediatek: mtk-dpi: Set out_fmt from config if not the last bridge drm/mediatek: dpi: Fix NULL dereference in mtk_dpi_bridge_atomic_check
2 parents f8fbb47 + a1fa726 commit 82cce5f

23 files changed

Lines changed: 175 additions & 167 deletions

Documentation/gpu/rfc/i915_gem_lmem.rst

Lines changed: 0 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -18,114 +18,5 @@ real, with all the uAPI bits is:
1818
* Route shmem backend over to TTM SYSTEM for discrete
1919
* TTM purgeable object support
2020
* Move i915 buddy allocator over to TTM
21-
* MMAP ioctl mode(see `I915 MMAP`_)
22-
* SET/GET ioctl caching(see `I915 SET/GET CACHING`_)
2321
* Send RFC(with mesa-dev on cc) for final sign off on the uAPI
2422
* Add pciid for DG1 and turn on uAPI for real
25-
26-
New object placement and region query uAPI
27-
==========================================
28-
Starting from DG1 we need to give userspace the ability to allocate buffers from
29-
device local-memory. Currently the driver supports gem_create, which can place
30-
buffers in system memory via shmem, and the usual assortment of other
31-
interfaces, like dumb buffers and userptr.
32-
33-
To support this new capability, while also providing a uAPI which will work
34-
beyond just DG1, we propose to offer three new bits of uAPI:
35-
36-
DRM_I915_QUERY_MEMORY_REGIONS
37-
-----------------------------
38-
New query ID which allows userspace to discover the list of supported memory
39-
regions(like system-memory and local-memory) for a given device. We identify
40-
each region with a class and instance pair, which should be unique. The class
41-
here would be DEVICE or SYSTEM, and the instance would be zero, on platforms
42-
like DG1.
43-
44-
Side note: The class/instance design is borrowed from our existing engine uAPI,
45-
where we describe every physical engine in terms of its class, and the
46-
particular instance, since we can have more than one per class.
47-
48-
In the future we also want to expose more information which can further
49-
describe the capabilities of a region.
50-
51-
.. kernel-doc:: include/uapi/drm/i915_drm.h
52-
:functions: drm_i915_gem_memory_class drm_i915_gem_memory_class_instance drm_i915_memory_region_info drm_i915_query_memory_regions
53-
54-
GEM_CREATE_EXT
55-
--------------
56-
New ioctl which is basically just gem_create but now allows userspace to provide
57-
a chain of possible extensions. Note that if we don't provide any extensions and
58-
set flags=0 then we get the exact same behaviour as gem_create.
59-
60-
Side note: We also need to support PXP[1] in the near future, which is also
61-
applicable to integrated platforms, and adds its own gem_create_ext extension,
62-
which basically lets userspace mark a buffer as "protected".
63-
64-
.. kernel-doc:: include/uapi/drm/i915_drm.h
65-
:functions: drm_i915_gem_create_ext
66-
67-
I915_GEM_CREATE_EXT_MEMORY_REGIONS
68-
----------------------------------
69-
Implemented as an extension for gem_create_ext, we would now allow userspace to
70-
optionally provide an immutable list of preferred placements at creation time,
71-
in priority order, for a given buffer object. For the placements we expect
72-
them each to use the class/instance encoding, as per the output of the regions
73-
query. Having the list in priority order will be useful in the future when
74-
placing an object, say during eviction.
75-
76-
.. kernel-doc:: include/uapi/drm/i915_drm.h
77-
:functions: drm_i915_gem_create_ext_memory_regions
78-
79-
One fair criticism here is that this seems a little over-engineered[2]. If we
80-
just consider DG1 then yes, a simple gem_create.flags or something is totally
81-
all that's needed to tell the kernel to allocate the buffer in local-memory or
82-
whatever. However looking to the future we need uAPI which can also support
83-
upcoming Xe HP multi-tile architecture in a sane way, where there can be
84-
multiple local-memory instances for a given device, and so using both class and
85-
instance in our uAPI to describe regions is desirable, although specifically
86-
for DG1 it's uninteresting, since we only have a single local-memory instance.
87-
88-
Existing uAPI issues
89-
====================
90-
Some potential issues we still need to resolve.
91-
92-
I915 MMAP
93-
---------
94-
In i915 there are multiple ways to MMAP GEM object, including mapping the same
95-
object using different mapping types(WC vs WB), i.e multiple active mmaps per
96-
object. TTM expects one MMAP at most for the lifetime of the object. If it
97-
turns out that we have to backpedal here, there might be some potential
98-
userspace fallout.
99-
100-
I915 SET/GET CACHING
101-
--------------------
102-
In i915 we have set/get_caching ioctl. TTM doesn't let us to change this, but
103-
DG1 doesn't support non-snooped pcie transactions, so we can just always
104-
allocate as WB for smem-only buffers. If/when our hw gains support for
105-
non-snooped pcie transactions then we must fix this mode at allocation time as
106-
a new GEM extension.
107-
108-
This is related to the mmap problem, because in general (meaning, when we're
109-
not running on intel cpus) the cpu mmap must not, ever, be inconsistent with
110-
allocation mode.
111-
112-
Possible idea is to let the kernel picks the mmap mode for userspace from the
113-
following table:
114-
115-
smem-only: WB. Userspace does not need to call clflush.
116-
117-
smem+lmem: We only ever allow a single mode, so simply allocate this as uncached
118-
memory, and always give userspace a WC mapping. GPU still does snooped access
119-
here(assuming we can't turn it off like on DG1), which is a bit inefficient.
120-
121-
lmem only: always WC
122-
123-
This means on discrete you only get a single mmap mode, all others must be
124-
rejected. That's probably going to be a new default mode or something like
125-
that.
126-
127-
Links
128-
=====
129-
[1] https://patchwork.freedesktop.org/series/86798/
130-
131-
[2] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5599#note_553791

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

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,46 @@ bool amdgpu_atomfirmware_dynamic_boot_config_supported(struct amdgpu_device *ade
468468
return (fw_cap & ATOM_FIRMWARE_CAP_DYNAMIC_BOOT_CFG_ENABLE) ? true : false;
469469
}
470470

471+
/*
472+
* Helper function to query RAS EEPROM address
473+
*
474+
* @adev: amdgpu_device pointer
475+
*
476+
* Return true if vbios supports ras rom address reporting
477+
*/
478+
bool amdgpu_atomfirmware_ras_rom_addr(struct amdgpu_device *adev, uint8_t* i2c_address)
479+
{
480+
struct amdgpu_mode_info *mode_info = &adev->mode_info;
481+
int index;
482+
u16 data_offset, size;
483+
union firmware_info *firmware_info;
484+
u8 frev, crev;
485+
486+
if (i2c_address == NULL)
487+
return false;
488+
489+
*i2c_address = 0;
490+
491+
index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
492+
firmwareinfo);
493+
494+
if (amdgpu_atom_parse_data_header(adev->mode_info.atom_context,
495+
index, &size, &frev, &crev, &data_offset)) {
496+
/* support firmware_info 3.4 + */
497+
if ((frev == 3 && crev >=4) || (frev > 3)) {
498+
firmware_info = (union firmware_info *)
499+
(mode_info->atom_context->bios + data_offset);
500+
*i2c_address = firmware_info->v34.ras_rom_i2c_slave_addr;
501+
}
502+
}
503+
504+
if (*i2c_address != 0)
505+
return true;
506+
507+
return false;
508+
}
509+
510+
471511
union smu_info {
472512
struct atom_smu_info_v3_1 v31;
473513
};

drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ int amdgpu_atomfirmware_get_clock_info(struct amdgpu_device *adev);
3636
int amdgpu_atomfirmware_get_gfx_info(struct amdgpu_device *adev);
3737
bool amdgpu_atomfirmware_mem_ecc_supported(struct amdgpu_device *adev);
3838
bool amdgpu_atomfirmware_sram_ecc_supported(struct amdgpu_device *adev);
39+
bool amdgpu_atomfirmware_ras_rom_addr(struct amdgpu_device *adev, uint8_t* i2c_address);
3940
bool amdgpu_atomfirmware_mem_training_supported(struct amdgpu_device *adev);
4041
bool amdgpu_atomfirmware_dynamic_boot_config_supported(struct amdgpu_device *adev);
4142
int amdgpu_atomfirmware_get_fw_reserved_fb_size(struct amdgpu_device *adev);

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,9 @@ int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)
299299
ip->major, ip->minor,
300300
ip->revision);
301301

302+
if (le16_to_cpu(ip->hw_id) == VCN_HWID)
303+
adev->vcn.num_vcn_inst++;
304+
302305
for (k = 0; k < num_base_address; k++) {
303306
/*
304307
* convert the endianness of base addresses in place,
@@ -385,7 +388,7 @@ void amdgpu_discovery_harvest_ip(struct amdgpu_device *adev)
385388
{
386389
struct binary_header *bhdr;
387390
struct harvest_table *harvest_info;
388-
int i;
391+
int i, vcn_harvest_count = 0;
389392

390393
bhdr = (struct binary_header *)adev->mman.discovery_bin;
391394
harvest_info = (struct harvest_table *)(adev->mman.discovery_bin +
@@ -397,8 +400,7 @@ void amdgpu_discovery_harvest_ip(struct amdgpu_device *adev)
397400

398401
switch (le32_to_cpu(harvest_info->list[i].hw_id)) {
399402
case VCN_HWID:
400-
adev->harvest_ip_mask |= AMD_HARVEST_IP_VCN_MASK;
401-
adev->harvest_ip_mask |= AMD_HARVEST_IP_JPEG_MASK;
403+
vcn_harvest_count++;
402404
break;
403405
case DMU_HWID:
404406
adev->harvest_ip_mask |= AMD_HARVEST_IP_DMU_MASK;
@@ -407,6 +409,10 @@ void amdgpu_discovery_harvest_ip(struct amdgpu_device *adev)
407409
break;
408410
}
409411
}
412+
if (vcn_harvest_count == adev->vcn.num_vcn_inst) {
413+
adev->harvest_ip_mask |= AMD_HARVEST_IP_VCN_MASK;
414+
adev->harvest_ip_mask |= AMD_HARVEST_IP_JPEG_MASK;
415+
}
410416
}
411417

412418
int amdgpu_discovery_get_gfx_info(struct amdgpu_device *adev)

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,6 +1571,8 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
15711571
pci_ignore_hotplug(pdev);
15721572
pci_set_power_state(pdev, PCI_D3cold);
15731573
drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF;
1574+
} else if (amdgpu_device_supports_boco(drm_dev)) {
1575+
/* nothing to do */
15741576
} else if (amdgpu_device_supports_baco(drm_dev)) {
15751577
amdgpu_device_baco_enter(drm_dev);
15761578
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "amdgpu_ras.h"
2727
#include <linux/bits.h>
2828
#include "atom.h"
29+
#include "amdgpu_atomfirmware.h"
2930

3031
#define EEPROM_I2C_TARGET_ADDR_VEGA20 0xA0
3132
#define EEPROM_I2C_TARGET_ADDR_ARCTURUS 0xA8
@@ -96,6 +97,9 @@ static bool __get_eeprom_i2c_addr(struct amdgpu_device *adev,
9697
if (!i2c_addr)
9798
return false;
9899

100+
if (amdgpu_atomfirmware_ras_rom_addr(adev, (uint8_t*)i2c_addr))
101+
return true;
102+
99103
switch (adev->asic_type) {
100104
case CHIP_VEGA20:
101105
*i2c_addr = EEPROM_I2C_TARGET_ADDR_VEGA20;

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9605,7 +9605,12 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm,
96059605
} else if (amdgpu_freesync_vid_mode && aconnector &&
96069606
is_freesync_video_mode(&new_crtc_state->mode,
96079607
aconnector)) {
9608-
set_freesync_fixed_config(dm_new_crtc_state);
9608+
struct drm_display_mode *high_mode;
9609+
9610+
high_mode = get_highest_refresh_rate_mode(aconnector, false);
9611+
if (!drm_mode_equal(&new_crtc_state->mode, high_mode)) {
9612+
set_freesync_fixed_config(dm_new_crtc_state);
9613+
}
96099614
}
96109615

96119616
ret = dm_atomic_get_state(state, &dm_state);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ static void amdgpu_dm_irq_schedule_work(struct amdgpu_device *adev,
584584
handler_data = container_of(handler_list->next, struct amdgpu_dm_irq_handler_data, list);
585585

586586
/*allocate a new amdgpu_dm_irq_handler_data*/
587-
handler_data_add = kzalloc(sizeof(*handler_data), GFP_KERNEL);
587+
handler_data_add = kzalloc(sizeof(*handler_data), GFP_ATOMIC);
588588
if (!handler_data_add) {
589589
DRM_ERROR("DM_IRQ: failed to allocate irq handler!\n");
590590
return;

drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1788,7 +1788,6 @@ static bool dcn30_split_stream_for_mpc_or_odm(
17881788
}
17891789
pri_pipe->next_odm_pipe = sec_pipe;
17901790
sec_pipe->prev_odm_pipe = pri_pipe;
1791-
ASSERT(sec_pipe->top_pipe == NULL);
17921791

17931792
if (!sec_pipe->top_pipe)
17941793
sec_pipe->stream_res.opp = pool->opps[pipe_idx];

drivers/gpu/drm/amd/include/atomfirmware.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ struct atom_firmware_info_v3_4 {
590590
uint8_t board_i2c_feature_id; // enum of atom_board_i2c_feature_id_def
591591
uint8_t board_i2c_feature_gpio_id; // i2c id find in gpio_lut data table gpio_id
592592
uint8_t board_i2c_feature_slave_addr;
593-
uint8_t reserved3;
593+
uint8_t ras_rom_i2c_slave_addr;
594594
uint16_t bootup_mvddq_mv;
595595
uint16_t bootup_mvpp_mv;
596596
uint32_t zfbstartaddrin16mb;

0 commit comments

Comments
 (0)