Commit 14c90746 authored by Dave Airlie's avatar Dave Airlie

Merge tag 'amd-drm-fixes-5.10-2020-10-29' of...

Merge tag 'amd-drm-fixes-5.10-2020-10-29' of git://people.freedesktop.org/~agd5f/linux into drm-fixes

amd-drm-fixes-5.10-2020-10-29:

amdgpu:
- Add new navi1x PCI ID
- GPUVM reserved area fixes
- Misc display fixes
- Fix bad interactions between display code and CONFIG_KGDB
- Fixes for SMU manual fan control and i2c
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
From: Alex Deucher <alexdeucher@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201029061549.4133-1-alexander.deucher@amd.com
parents 3650b228 65d437b8
...@@ -1066,6 +1066,7 @@ static const struct pci_device_id pciidlist[] = { ...@@ -1066,6 +1066,7 @@ static const struct pci_device_id pciidlist[] = {
{0x1002, 0x7319, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10}, {0x1002, 0x7319, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10},
{0x1002, 0x731A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10}, {0x1002, 0x731A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10},
{0x1002, 0x731B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10}, {0x1002, 0x731B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10},
{0x1002, 0x731E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10},
{0x1002, 0x731F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10}, {0x1002, 0x731F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI10},
/* Navi14 */ /* Navi14 */
{0x1002, 0x7340, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI14}, {0x1002, 0x7340, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI14},
......
...@@ -596,6 +596,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data, ...@@ -596,6 +596,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
struct ww_acquire_ctx ticket; struct ww_acquire_ctx ticket;
struct list_head list, duplicates; struct list_head list, duplicates;
uint64_t va_flags; uint64_t va_flags;
uint64_t vm_size;
int r = 0; int r = 0;
if (args->va_address < AMDGPU_VA_RESERVED_SIZE) { if (args->va_address < AMDGPU_VA_RESERVED_SIZE) {
...@@ -616,6 +617,15 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data, ...@@ -616,6 +617,15 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
args->va_address &= AMDGPU_GMC_HOLE_MASK; args->va_address &= AMDGPU_GMC_HOLE_MASK;
vm_size = adev->vm_manager.max_pfn * AMDGPU_GPU_PAGE_SIZE;
vm_size -= AMDGPU_VA_RESERVED_SIZE;
if (args->va_address + args->map_size > vm_size) {
dev_dbg(&dev->pdev->dev,
"va_address 0x%llx is in top reserved area 0x%llx\n",
args->va_address + args->map_size, vm_size);
return -EINVAL;
}
if ((args->flags & ~valid_flags) && (args->flags & ~prt_flags)) { if ((args->flags & ~valid_flags) && (args->flags & ~prt_flags)) {
dev_dbg(&dev->pdev->dev, "invalid flags combination 0x%08X\n", dev_dbg(&dev->pdev->dev, "invalid flags combination 0x%08X\n",
args->flags); args->flags);
......
...@@ -112,8 +112,8 @@ struct amdgpu_bo_list_entry; ...@@ -112,8 +112,8 @@ struct amdgpu_bo_list_entry;
#define AMDGPU_MMHUB_0 1 #define AMDGPU_MMHUB_0 1
#define AMDGPU_MMHUB_1 2 #define AMDGPU_MMHUB_1 2
/* hardcode that limit for now */ /* Reserve 2MB at top/bottom of address space for kernel use */
#define AMDGPU_VA_RESERVED_SIZE (1ULL << 20) #define AMDGPU_VA_RESERVED_SIZE (2ULL << 20)
/* max vmids dedicated for process */ /* max vmids dedicated for process */
#define AMDGPU_VM_MAX_RESERVED_VMID 1 #define AMDGPU_VM_MAX_RESERVED_VMID 1
......
...@@ -455,6 +455,14 @@ void nv_set_virt_ops(struct amdgpu_device *adev) ...@@ -455,6 +455,14 @@ void nv_set_virt_ops(struct amdgpu_device *adev)
adev->virt.ops = &xgpu_nv_virt_ops; adev->virt.ops = &xgpu_nv_virt_ops;
} }
static bool nv_is_blockchain_sku(struct pci_dev *pdev)
{
if (pdev->device == 0x731E &&
(pdev->revision == 0xC6 || pdev->revision == 0xC7))
return true;
return false;
}
int nv_set_ip_blocks(struct amdgpu_device *adev) int nv_set_ip_blocks(struct amdgpu_device *adev)
{ {
int r; int r;
...@@ -483,7 +491,8 @@ int nv_set_ip_blocks(struct amdgpu_device *adev) ...@@ -483,7 +491,8 @@ int nv_set_ip_blocks(struct amdgpu_device *adev)
if (adev->enable_virtual_display || amdgpu_sriov_vf(adev)) if (adev->enable_virtual_display || amdgpu_sriov_vf(adev))
amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block); amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block);
#if defined(CONFIG_DRM_AMD_DC) #if defined(CONFIG_DRM_AMD_DC)
else if (amdgpu_device_has_dc_support(adev)) else if (amdgpu_device_has_dc_support(adev) &&
!nv_is_blockchain_sku(adev->pdev))
amdgpu_device_ip_block_add(adev, &dm_ip_block); amdgpu_device_ip_block_add(adev, &dm_ip_block);
#endif #endif
amdgpu_device_ip_block_add(adev, &gfx_v10_0_ip_block); amdgpu_device_ip_block_add(adev, &gfx_v10_0_ip_block);
...@@ -491,7 +500,8 @@ int nv_set_ip_blocks(struct amdgpu_device *adev) ...@@ -491,7 +500,8 @@ int nv_set_ip_blocks(struct amdgpu_device *adev)
if (adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT && if (adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT &&
!amdgpu_sriov_vf(adev)) !amdgpu_sriov_vf(adev))
amdgpu_device_ip_block_add(adev, &smu_v11_0_ip_block); amdgpu_device_ip_block_add(adev, &smu_v11_0_ip_block);
amdgpu_device_ip_block_add(adev, &vcn_v2_0_ip_block); if (!nv_is_blockchain_sku(adev->pdev))
amdgpu_device_ip_block_add(adev, &vcn_v2_0_ip_block);
amdgpu_device_ip_block_add(adev, &jpeg_v2_0_ip_block); amdgpu_device_ip_block_add(adev, &jpeg_v2_0_ip_block);
if (adev->enable_mes) if (adev->enable_mes)
amdgpu_device_ip_block_add(adev, &mes_v10_1_ip_block); amdgpu_device_ip_block_add(adev, &mes_v10_1_ip_block);
......
...@@ -42,6 +42,7 @@ config DRM_AMD_DC_SI ...@@ -42,6 +42,7 @@ config DRM_AMD_DC_SI
config DEBUG_KERNEL_DC config DEBUG_KERNEL_DC
bool "Enable kgdb break in DC" bool "Enable kgdb break in DC"
depends on DRM_AMD_DC depends on DRM_AMD_DC
depends on KGDB
help help
Choose this option if you want to hit kdgb_break in assert. Choose this option if you want to hit kdgb_break in assert.
......
...@@ -1571,8 +1571,8 @@ static void init_state(struct dc *dc, struct dc_state *context) ...@@ -1571,8 +1571,8 @@ static void init_state(struct dc *dc, struct dc_state *context)
struct dc_state *dc_create_state(struct dc *dc) struct dc_state *dc_create_state(struct dc *dc)
{ {
struct dc_state *context = kzalloc(sizeof(struct dc_state), struct dc_state *context = kvzalloc(sizeof(struct dc_state),
GFP_KERNEL); GFP_KERNEL);
if (!context) if (!context)
return NULL; return NULL;
......
...@@ -1149,7 +1149,8 @@ static uint32_t dcn3_get_pix_clk_dividers( ...@@ -1149,7 +1149,8 @@ static uint32_t dcn3_get_pix_clk_dividers(
static const struct clock_source_funcs dcn3_clk_src_funcs = { static const struct clock_source_funcs dcn3_clk_src_funcs = {
.cs_power_down = dce110_clock_source_power_down, .cs_power_down = dce110_clock_source_power_down,
.program_pix_clk = dcn3_program_pix_clk, .program_pix_clk = dcn3_program_pix_clk,
.get_pix_clk_dividers = dcn3_get_pix_clk_dividers .get_pix_clk_dividers = dcn3_get_pix_clk_dividers,
.get_pixel_clk_frequency_100hz = get_pixel_clk_frequency_100hz
}; };
#endif #endif
/*****************************************/ /*****************************************/
......
...@@ -2105,12 +2105,12 @@ static bool dcn30_internal_validate_bw( ...@@ -2105,12 +2105,12 @@ static bool dcn30_internal_validate_bw(
if (split[i]) { if (split[i]) {
if (odm) { if (odm) {
if (split[i] == 4 && old_pipe->next_odm_pipe->next_odm_pipe) if (split[i] == 4 && old_pipe->next_odm_pipe && old_pipe->next_odm_pipe->next_odm_pipe)
old_index = old_pipe->next_odm_pipe->next_odm_pipe->pipe_idx; old_index = old_pipe->next_odm_pipe->next_odm_pipe->pipe_idx;
else if (old_pipe->next_odm_pipe) else if (old_pipe->next_odm_pipe)
old_index = old_pipe->next_odm_pipe->pipe_idx; old_index = old_pipe->next_odm_pipe->pipe_idx;
} else { } else {
if (split[i] == 4 && old_pipe->bottom_pipe->bottom_pipe && if (split[i] == 4 && old_pipe->bottom_pipe && old_pipe->bottom_pipe->bottom_pipe &&
old_pipe->bottom_pipe->bottom_pipe->plane_state == old_pipe->plane_state) old_pipe->bottom_pipe->bottom_pipe->plane_state == old_pipe->plane_state)
old_index = old_pipe->bottom_pipe->bottom_pipe->pipe_idx; old_index = old_pipe->bottom_pipe->bottom_pipe->pipe_idx;
else if (old_pipe->bottom_pipe && else if (old_pipe->bottom_pipe &&
...@@ -2150,10 +2150,12 @@ static bool dcn30_internal_validate_bw( ...@@ -2150,10 +2150,12 @@ static bool dcn30_internal_validate_bw(
goto validate_fail; goto validate_fail;
newly_split[pipe_4to1->pipe_idx] = true; newly_split[pipe_4to1->pipe_idx] = true;
if (odm && old_pipe->next_odm_pipe->next_odm_pipe->next_odm_pipe) if (odm && old_pipe->next_odm_pipe && old_pipe->next_odm_pipe->next_odm_pipe
&& old_pipe->next_odm_pipe->next_odm_pipe->next_odm_pipe)
old_index = old_pipe->next_odm_pipe->next_odm_pipe->next_odm_pipe->pipe_idx; old_index = old_pipe->next_odm_pipe->next_odm_pipe->next_odm_pipe->pipe_idx;
else if (!odm && old_pipe->bottom_pipe->bottom_pipe->bottom_pipe && else if (!odm && old_pipe->bottom_pipe && old_pipe->bottom_pipe->bottom_pipe &&
old_pipe->bottom_pipe->bottom_pipe->bottom_pipe->plane_state == old_pipe->plane_state) old_pipe->bottom_pipe->bottom_pipe->bottom_pipe &&
old_pipe->bottom_pipe->bottom_pipe->bottom_pipe->plane_state == old_pipe->plane_state)
old_index = old_pipe->bottom_pipe->bottom_pipe->bottom_pipe->pipe_idx; old_index = old_pipe->bottom_pipe->bottom_pipe->bottom_pipe->pipe_idx;
else else
old_index = -1; old_index = -1;
......
...@@ -117,6 +117,12 @@ static const struct ddc_registers ddc_data_regs_dcn[] = { ...@@ -117,6 +117,12 @@ static const struct ddc_registers ddc_data_regs_dcn[] = {
ddc_data_regs_dcn2(4), ddc_data_regs_dcn2(4),
ddc_data_regs_dcn2(5), ddc_data_regs_dcn2(5),
ddc_data_regs_dcn2(6), ddc_data_regs_dcn2(6),
{
DDC_GPIO_VGA_REG_LIST(DATA),
.ddc_setup = 0,
.phy_aux_cntl = 0,
.dc_gpio_aux_ctrl_5 = 0
}
}; };
static const struct ddc_registers ddc_clk_regs_dcn[] = { static const struct ddc_registers ddc_clk_regs_dcn[] = {
...@@ -126,6 +132,12 @@ static const struct ddc_registers ddc_clk_regs_dcn[] = { ...@@ -126,6 +132,12 @@ static const struct ddc_registers ddc_clk_regs_dcn[] = {
ddc_clk_regs_dcn2(4), ddc_clk_regs_dcn2(4),
ddc_clk_regs_dcn2(5), ddc_clk_regs_dcn2(5),
ddc_clk_regs_dcn2(6), ddc_clk_regs_dcn2(6),
{
DDC_GPIO_VGA_REG_LIST(CLK),
.ddc_setup = 0,
.phy_aux_cntl = 0,
.dc_gpio_aux_ctrl_5 = 0
}
}; };
static const struct ddc_sh_mask ddc_shift[] = { static const struct ddc_sh_mask ddc_shift[] = {
......
...@@ -63,13 +63,13 @@ enum gpio_result dal_gpio_open_ex( ...@@ -63,13 +63,13 @@ enum gpio_result dal_gpio_open_ex(
enum gpio_mode mode) enum gpio_mode mode)
{ {
if (gpio->pin) { if (gpio->pin) {
ASSERT_CRITICAL(false); BREAK_TO_DEBUGGER();
return GPIO_RESULT_ALREADY_OPENED; return GPIO_RESULT_ALREADY_OPENED;
} }
// No action if allocation failed during gpio construct // No action if allocation failed during gpio construct
if (!gpio->hw_container.ddc) { if (!gpio->hw_container.ddc) {
ASSERT_CRITICAL(false); BREAK_TO_DEBUGGER();
return GPIO_RESULT_NON_SPECIFIC_ERROR; return GPIO_RESULT_NON_SPECIFIC_ERROR;
} }
gpio->mode = mode; gpio->mode = mode;
......
...@@ -94,36 +94,27 @@ ...@@ -94,36 +94,27 @@
* general debug capabilities * general debug capabilities
* *
*/ */
#if defined(CONFIG_HAVE_KGDB) || defined(CONFIG_KGDB) #ifdef CONFIG_DEBUG_KERNEL_DC
#define ASSERT_CRITICAL(expr) do { \ #define dc_breakpoint() kgdb_breakpoint()
if (WARN_ON(!(expr))) { \
kgdb_breakpoint(); \
} \
} while (0)
#else #else
#define ASSERT_CRITICAL(expr) do { \ #define dc_breakpoint() do {} while (0)
if (WARN_ON(!(expr))) { \
; \
} \
} while (0)
#endif #endif
#if defined(CONFIG_DEBUG_KERNEL_DC) #define ASSERT_CRITICAL(expr) do { \
#define ASSERT(expr) ASSERT_CRITICAL(expr) if (WARN_ON(!(expr))) \
dc_breakpoint(); \
} while (0)
#else #define ASSERT(expr) do { \
#define ASSERT(expr) WARN_ON_ONCE(!(expr)) if (WARN_ON_ONCE(!(expr))) \
#endif dc_breakpoint(); \
} while (0)
#if defined(CONFIG_DEBUG_KERNEL_DC) && (defined(CONFIG_HAVE_KGDB) || defined(CONFIG_KGDB))
#define BREAK_TO_DEBUGGER() \ #define BREAK_TO_DEBUGGER() \
do { \ do { \
DRM_DEBUG_DRIVER("%s():%d\n", __func__, __LINE__); \ DRM_DEBUG_DRIVER("%s():%d\n", __func__, __LINE__); \
kgdb_breakpoint(); \ dc_breakpoint(); \
} while (0) } while (0)
#else
#define BREAK_TO_DEBUGGER() DRM_DEBUG_DRIVER("%s():%d\n", __func__, __LINE__)
#endif
#define DC_ERR(...) do { \ #define DC_ERR(...) do { \
dm_error(__VA_ARGS__); \ dm_error(__VA_ARGS__); \
......
...@@ -1361,14 +1361,9 @@ static int navi10_get_fan_speed_rpm(struct smu_context *smu, ...@@ -1361,14 +1361,9 @@ static int navi10_get_fan_speed_rpm(struct smu_context *smu,
if (!speed) if (!speed)
return -EINVAL; return -EINVAL;
switch (smu_v11_0_get_fan_control_mode(smu)) { return navi10_get_smu_metrics_data(smu,
case AMD_FAN_CTRL_AUTO: METRICS_CURR_FANSPEED,
return navi10_get_smu_metrics_data(smu, speed);
METRICS_CURR_FANSPEED,
speed);
default:
return smu_v11_0_get_fan_speed_rpm(smu, speed);
}
} }
static int navi10_get_fan_parameters(struct smu_context *smu) static int navi10_get_fan_parameters(struct smu_context *smu)
...@@ -2534,29 +2529,6 @@ static const struct i2c_algorithm navi10_i2c_algo = { ...@@ -2534,29 +2529,6 @@ static const struct i2c_algorithm navi10_i2c_algo = {
.functionality = navi10_i2c_func, .functionality = navi10_i2c_func,
}; };
static int navi10_i2c_control_init(struct smu_context *smu, struct i2c_adapter *control)
{
struct amdgpu_device *adev = to_amdgpu_device(control);
int res;
control->owner = THIS_MODULE;
control->class = I2C_CLASS_SPD;
control->dev.parent = &adev->pdev->dev;
control->algo = &navi10_i2c_algo;
snprintf(control->name, sizeof(control->name), "AMDGPU SMU");
res = i2c_add_adapter(control);
if (res)
DRM_ERROR("Failed to register hw i2c, err: %d\n", res);
return res;
}
static void navi10_i2c_control_fini(struct smu_context *smu, struct i2c_adapter *control)
{
i2c_del_adapter(control);
}
static ssize_t navi10_get_gpu_metrics(struct smu_context *smu, static ssize_t navi10_get_gpu_metrics(struct smu_context *smu,
void **table) void **table)
{ {
...@@ -2687,8 +2659,6 @@ static const struct pptable_funcs navi10_ppt_funcs = { ...@@ -2687,8 +2659,6 @@ static const struct pptable_funcs navi10_ppt_funcs = {
.set_default_dpm_table = navi10_set_default_dpm_table, .set_default_dpm_table = navi10_set_default_dpm_table,
.dpm_set_vcn_enable = navi10_dpm_set_vcn_enable, .dpm_set_vcn_enable = navi10_dpm_set_vcn_enable,
.dpm_set_jpeg_enable = navi10_dpm_set_jpeg_enable, .dpm_set_jpeg_enable = navi10_dpm_set_jpeg_enable,
.i2c_init = navi10_i2c_control_init,
.i2c_fini = navi10_i2c_control_fini,
.print_clk_levels = navi10_print_clk_levels, .print_clk_levels = navi10_print_clk_levels,
.force_clk_levels = navi10_force_clk_levels, .force_clk_levels = navi10_force_clk_levels,
.populate_umd_state_clk = navi10_populate_umd_state_clk, .populate_umd_state_clk = navi10_populate_umd_state_clk,
......
...@@ -1177,14 +1177,9 @@ static int sienna_cichlid_get_fan_speed_rpm(struct smu_context *smu, ...@@ -1177,14 +1177,9 @@ static int sienna_cichlid_get_fan_speed_rpm(struct smu_context *smu,
if (!speed) if (!speed)
return -EINVAL; return -EINVAL;
switch (smu_v11_0_get_fan_control_mode(smu)) { return sienna_cichlid_get_smu_metrics_data(smu,
case AMD_FAN_CTRL_AUTO: METRICS_CURR_FANSPEED,
return sienna_cichlid_get_smu_metrics_data(smu, speed);
METRICS_CURR_FANSPEED,
speed);
default:
return smu_v11_0_get_fan_speed_rpm(smu, speed);
}
} }
static int sienna_cichlid_get_fan_parameters(struct smu_context *smu) static int sienna_cichlid_get_fan_parameters(struct smu_context *smu)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment