From: Sasha Levin Date: Fri, 28 Aug 2020 04:35:14 +0000 (-0400) Subject: Fixes for 5.8 X-Git-Tag: v4.4.235~71 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cede6320e8ad79d5c38cfe2d4ebf49dbe7fb449a;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.8 Signed-off-by: Sasha Levin --- diff --git a/queue-5.8/arm64-fix-__cpu_logical_map-undefined-issue.patch b/queue-5.8/arm64-fix-__cpu_logical_map-undefined-issue.patch new file mode 100644 index 00000000000..648c64553f5 --- /dev/null +++ b/queue-5.8/arm64-fix-__cpu_logical_map-undefined-issue.patch @@ -0,0 +1,110 @@ +From 19d7d8eda55a53d3bf6f7e59a611733a41210e5e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 27 Jul 2020 23:29:38 +0800 +Subject: arm64: Fix __cpu_logical_map undefined issue + +From: Kefeng Wang + +[ Upstream commit eaecca9e7710281be7c31d892c9f447eafd7ddd9 ] + +The __cpu_logical_map undefined issue occued when the new +tegra194-cpufreq drvier building as a module. + +ERROR: modpost: "__cpu_logical_map" [drivers/cpufreq/tegra194-cpufreq.ko] undefined! + +The driver using cpu_logical_map() macro which will expand to +__cpu_logical_map, we can't access it in a drvier. Let's turn +cpu_logical_map() into a C wrapper and export it to fix the +build issue. + +Also create a function set_cpu_logical_map(cpu, hwid) when assign +a value to cpu_logical_map(cpu). + +Reported-by: Hulk Robot +Signed-off-by: Kefeng Wang +Signed-off-by: Catalin Marinas +Signed-off-by: Sasha Levin +--- + arch/arm64/include/asm/smp.h | 7 ++++++- + arch/arm64/kernel/setup.c | 8 +++++++- + arch/arm64/kernel/smp.c | 6 +++--- + 3 files changed, 16 insertions(+), 5 deletions(-) + +diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/include/asm/smp.h +index a0c8a0b652593..0eadbf933e359 100644 +--- a/arch/arm64/include/asm/smp.h ++++ b/arch/arm64/include/asm/smp.h +@@ -46,7 +46,12 @@ DECLARE_PER_CPU_READ_MOSTLY(int, cpu_number); + * Logical CPU mapping. + */ + extern u64 __cpu_logical_map[NR_CPUS]; +-#define cpu_logical_map(cpu) __cpu_logical_map[cpu] ++extern u64 cpu_logical_map(int cpu); ++ ++static inline void set_cpu_logical_map(int cpu, u64 hwid) ++{ ++ __cpu_logical_map[cpu] = hwid; ++} + + struct seq_file; + +diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c +index 93b3844cf4421..07b7940951e28 100644 +--- a/arch/arm64/kernel/setup.c ++++ b/arch/arm64/kernel/setup.c +@@ -85,7 +85,7 @@ u64 __cacheline_aligned boot_args[4]; + void __init smp_setup_processor_id(void) + { + u64 mpidr = read_cpuid_mpidr() & MPIDR_HWID_BITMASK; +- cpu_logical_map(0) = mpidr; ++ set_cpu_logical_map(0, mpidr); + + /* + * clear __my_cpu_offset on boot CPU to avoid hang caused by +@@ -276,6 +276,12 @@ arch_initcall(reserve_memblock_reserved_regions); + + u64 __cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = INVALID_HWID }; + ++u64 cpu_logical_map(int cpu) ++{ ++ return __cpu_logical_map[cpu]; ++} ++EXPORT_SYMBOL_GPL(cpu_logical_map); ++ + void __init setup_arch(char **cmdline_p) + { + init_mm.start_code = (unsigned long) _text; +diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c +index e43a8ff19f0f6..8cd6316a0d833 100644 +--- a/arch/arm64/kernel/smp.c ++++ b/arch/arm64/kernel/smp.c +@@ -567,7 +567,7 @@ acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor) + return; + + /* map the logical cpu id to cpu MPIDR */ +- cpu_logical_map(cpu_count) = hwid; ++ set_cpu_logical_map(cpu_count, hwid); + + cpu_madt_gicc[cpu_count] = *processor; + +@@ -681,7 +681,7 @@ static void __init of_parse_and_init_cpus(void) + goto next; + + pr_debug("cpu logical map 0x%llx\n", hwid); +- cpu_logical_map(cpu_count) = hwid; ++ set_cpu_logical_map(cpu_count, hwid); + + early_map_cpu_to_node(cpu_count, of_node_to_nid(dn)); + next: +@@ -722,7 +722,7 @@ void __init smp_init_cpus(void) + for (i = 1; i < nr_cpu_ids; i++) { + if (cpu_logical_map(i) != INVALID_HWID) { + if (smp_cpu_setup(i)) +- cpu_logical_map(i) = INVALID_HWID; ++ set_cpu_logical_map(i, INVALID_HWID); + } + } + } +-- +2.25.1 + diff --git a/queue-5.8/brcmfmac-set-timeout-value-when-configuring-power-sa.patch b/queue-5.8/brcmfmac-set-timeout-value-when-configuring-power-sa.patch new file mode 100644 index 00000000000..b77679b44bc --- /dev/null +++ b/queue-5.8/brcmfmac-set-timeout-value-when-configuring-power-sa.patch @@ -0,0 +1,50 @@ +From cc3266d42d5d9768155739771b2c4e52268fcc3d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 Jul 2020 13:23:02 +0200 +Subject: brcmfmac: Set timeout value when configuring power save + +From: Nicolas Saenz Julienne + +[ Upstream commit 3dc05ffb04436020f63138186dbc4f37bd938552 ] + +Set the timeout value as per cfg80211's set_power_mgmt() request. If the +requested value value is left undefined we set it to 2 seconds, the +maximum supported value. + +Signed-off-by: Nicolas Saenz Julienne +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20200721112302.22718-1-nsaenzjulienne@suse.de +Signed-off-by: Sasha Levin +--- + .../net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +index a757abd7a5999..f4db818cccae7 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -84,6 +84,8 @@ + + #define BRCMF_ND_INFO_TIMEOUT msecs_to_jiffies(2000) + ++#define BRCMF_PS_MAX_TIMEOUT_MS 2000 ++ + #define BRCMF_ASSOC_PARAMS_FIXED_SIZE \ + (sizeof(struct brcmf_assoc_params_le) - sizeof(u16)) + +@@ -2941,6 +2943,12 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev, + else + bphy_err(drvr, "error (%d)\n", err); + } ++ ++ err = brcmf_fil_iovar_int_set(ifp, "pm2_sleep_ret", ++ min_t(u32, timeout, BRCMF_PS_MAX_TIMEOUT_MS)); ++ if (err) ++ bphy_err(drvr, "Unable to set pm timeout, (%d)\n", err); ++ + done: + brcmf_dbg(TRACE, "Exit\n"); + return err; +-- +2.25.1 + diff --git a/queue-5.8/dmaengine-idxd-fix-pci_msi-build-errors.patch b/queue-5.8/dmaengine-idxd-fix-pci_msi-build-errors.patch new file mode 100644 index 00000000000..82bdb0f611c --- /dev/null +++ b/queue-5.8/dmaengine-idxd-fix-pci_msi-build-errors.patch @@ -0,0 +1,41 @@ +From 77fa06ca5fd0fd3c46c8de982f006f5917b586d3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 Aug 2020 18:40:23 -0400 +Subject: dmaengine: idxd: fix PCI_MSI build errors + +[ Upstream commit d6a7bb869dd8a516901591136a9a895fd829d6c6 ] + +Fix build errors when CONFIG_PCI_MSI is not enabled by making the +driver depend on PCI_MSI: + +ld: drivers/dma/idxd/device.o: in function `idxd_mask_msix_vector': +device.c:(.text+0x26f): undefined reference to `pci_msi_mask_irq' +ld: drivers/dma/idxd/device.o: in function `idxd_unmask_msix_vector': +device.c:(.text+0x2af): undefined reference to `pci_msi_unmask_irq' + +Signed-off-by: Randy Dunlap +Cc: Dave Jiang +Cc: dmaengine@vger.kernel.org +Cc: Vinod Koul +Link: https://lore.kernel.org/r/9dee3f46-70d9-ea75-10cb-5527ab297d1d@infradead.org +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig +index de41d7928bff2..984354ca877de 100644 +--- a/drivers/dma/Kconfig ++++ b/drivers/dma/Kconfig +@@ -285,6 +285,7 @@ config INTEL_IDMA64 + config INTEL_IDXD + tristate "Intel Data Accelerators support" + depends on PCI && X86_64 ++ depends on PCI_MSI + select DMA_ENGINE + select SBITMAP + help +-- +2.25.1 + diff --git a/queue-5.8/drm-amd-display-change-global-buffer-to-local-buffer.patch b/queue-5.8/drm-amd-display-change-global-buffer-to-local-buffer.patch new file mode 100644 index 00000000000..762af9aad71 --- /dev/null +++ b/queue-5.8/drm-amd-display-change-global-buffer-to-local-buffer.patch @@ -0,0 +1,625 @@ +From 1734b6732e5b83cda9a31b65834ca7a6a4801c0c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 20 May 2020 18:03:05 +0800 +Subject: drm/amd/display: change global buffer to local buffer + +From: Lewis Huang + +[ Upstream commit 8ae5b155928c9183c2f37b5c4eec21037d958699 ] + +[Why] +Multi-adapter calculate regamma table at the same time. +Two thread used the same global variable cause race +condition. + +[How] +Change global buffer to local buffer + +Signed-off-by: Lewis Huang +Reviewed-by: Aric Cyr +Acked-by: Qingqing Zhuo +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + .../amd/display/amdgpu_dm/amdgpu_dm_color.c | 10 +- + .../drm/amd/display/modules/color/Makefile | 4 + + .../amd/display/modules/color/color_gamma.c | 115 ++++++++++-------- + .../amd/display/modules/color/color_gamma.h | 18 ++- + .../amd/display/modules/color/color_table.c | 48 ++++++++ + .../amd/display/modules/color/color_table.h | 47 +++++++ + 6 files changed, 183 insertions(+), 59 deletions(-) + create mode 100644 drivers/gpu/drm/amd/display/modules/color/color_table.c + create mode 100644 drivers/gpu/drm/amd/display/modules/color/color_table.h + +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +index 4dfb6b55bb2ed..b321ff654df42 100644 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +@@ -195,10 +195,13 @@ static int __set_legacy_tf(struct dc_transfer_func *func, + bool has_rom) + { + struct dc_gamma *gamma = NULL; ++ struct calculate_buffer cal_buffer = {0}; + bool res; + + ASSERT(lut && lut_size == MAX_COLOR_LEGACY_LUT_ENTRIES); + ++ cal_buffer.buffer_index = -1; ++ + gamma = dc_create_gamma(); + if (!gamma) + return -ENOMEM; +@@ -208,7 +211,7 @@ static int __set_legacy_tf(struct dc_transfer_func *func, + __drm_lut_to_dc_gamma(lut, gamma, true); + + res = mod_color_calculate_regamma_params(func, gamma, true, has_rom, +- NULL); ++ NULL, &cal_buffer); + + dc_gamma_release(&gamma); + +@@ -221,10 +224,13 @@ static int __set_output_tf(struct dc_transfer_func *func, + bool has_rom) + { + struct dc_gamma *gamma = NULL; ++ struct calculate_buffer cal_buffer = {0}; + bool res; + + ASSERT(lut && lut_size == MAX_COLOR_LUT_ENTRIES); + ++ cal_buffer.buffer_index = -1; ++ + gamma = dc_create_gamma(); + if (!gamma) + return -ENOMEM; +@@ -248,7 +254,7 @@ static int __set_output_tf(struct dc_transfer_func *func, + */ + gamma->type = GAMMA_CS_TFM_1D; + res = mod_color_calculate_regamma_params(func, gamma, false, +- has_rom, NULL); ++ has_rom, NULL, &cal_buffer); + } + + dc_gamma_release(&gamma); +diff --git a/drivers/gpu/drm/amd/display/modules/color/Makefile b/drivers/gpu/drm/amd/display/modules/color/Makefile +index 65c33a76951a4..3ee7f27ff93b9 100644 +--- a/drivers/gpu/drm/amd/display/modules/color/Makefile ++++ b/drivers/gpu/drm/amd/display/modules/color/Makefile +@@ -25,6 +25,10 @@ + + MOD_COLOR = color_gamma.o + ++ifdef CONFIG_DRM_AMD_DC_DCN ++MOD_COLOR += color_table.o ++endif ++ + AMD_DAL_MOD_COLOR = $(addprefix $(AMDDALPATH)/modules/color/,$(MOD_COLOR)) + #$(info ************ DAL COLOR MODULE MAKEFILE ************) + +diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c +index bcfe34ef8c28d..b8695660b480e 100644 +--- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c ++++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c +@@ -30,20 +30,10 @@ + #include "opp.h" + #include "color_gamma.h" + +-#define NUM_PTS_IN_REGION 16 +-#define NUM_REGIONS 32 +-#define MAX_HW_POINTS (NUM_PTS_IN_REGION*NUM_REGIONS) +- + static struct hw_x_point coordinates_x[MAX_HW_POINTS + 2]; + +-static struct fixed31_32 pq_table[MAX_HW_POINTS + 2]; +-static struct fixed31_32 de_pq_table[MAX_HW_POINTS + 2]; +- + // these are helpers for calculations to reduce stack usage + // do not depend on these being preserved across calls +-static struct fixed31_32 scratch_1; +-static struct fixed31_32 scratch_2; +-static struct translate_from_linear_space_args scratch_gamma_args; + + /* Helper to optimize gamma calculation, only use in translate_from_linear, in + * particular the dc_fixpt_pow function which is very expensive +@@ -56,9 +46,6 @@ static struct translate_from_linear_space_args scratch_gamma_args; + * just multiply with 2^gamma which can be computed once, and save the result so we + * recursively compute all the values. + */ +-static struct fixed31_32 pow_buffer[NUM_PTS_IN_REGION]; +-static struct fixed31_32 gamma_of_2; // 2^gamma +-int pow_buffer_ptr = -1; + /*sRGB 709 2.2 2.4 P3*/ + static const int32_t gamma_numerator01[] = { 31308, 180000, 0, 0, 0}; + static const int32_t gamma_numerator02[] = { 12920, 4500, 0, 0, 0}; +@@ -66,9 +53,6 @@ static const int32_t gamma_numerator03[] = { 55, 99, 0, 0, 0}; + static const int32_t gamma_numerator04[] = { 55, 99, 0, 0, 0}; + static const int32_t gamma_numerator05[] = { 2400, 2200, 2200, 2400, 2600}; + +-static bool pq_initialized; /* = false; */ +-static bool de_pq_initialized; /* = false; */ +- + /* one-time setup of X points */ + void setup_x_points_distribution(void) + { +@@ -250,6 +234,8 @@ void precompute_pq(void) + struct fixed31_32 scaling_factor = + dc_fixpt_from_fraction(80, 10000); + ++ struct fixed31_32 *pq_table = mod_color_get_table(type_pq_table); ++ + /* pow function has problems with arguments too small */ + for (i = 0; i < 32; i++) + pq_table[i] = dc_fixpt_zero; +@@ -269,7 +255,7 @@ void precompute_de_pq(void) + uint32_t begin_index, end_index; + + struct fixed31_32 scaling_factor = dc_fixpt_from_int(125); +- ++ struct fixed31_32 *de_pq_table = mod_color_get_table(type_de_pq_table); + /* X points is 2^-25 to 2^7 + * De-gamma X is 2^-12 to 2^0 – we are skipping first -12-(-25) = 13 regions + */ +@@ -339,6 +325,9 @@ static struct fixed31_32 translate_from_linear_space( + { + const struct fixed31_32 one = dc_fixpt_from_int(1); + ++ struct fixed31_32 scratch_1, scratch_2; ++ struct calculate_buffer *cal_buffer = args->cal_buffer; ++ + if (dc_fixpt_le(one, args->arg)) + return one; + +@@ -352,21 +341,21 @@ static struct fixed31_32 translate_from_linear_space( + + return scratch_1; + } else if (dc_fixpt_le(args->a0, args->arg)) { +- if (pow_buffer_ptr == 0) { +- gamma_of_2 = dc_fixpt_pow(dc_fixpt_from_int(2), ++ if (cal_buffer->buffer_index == 0) { ++ cal_buffer->gamma_of_2 = dc_fixpt_pow(dc_fixpt_from_int(2), + dc_fixpt_recip(args->gamma)); + } + scratch_1 = dc_fixpt_add(one, args->a3); +- if (pow_buffer_ptr < 16) ++ if (cal_buffer->buffer_index < 16) + scratch_2 = dc_fixpt_pow(args->arg, + dc_fixpt_recip(args->gamma)); + else +- scratch_2 = dc_fixpt_mul(gamma_of_2, +- pow_buffer[pow_buffer_ptr%16]); ++ scratch_2 = dc_fixpt_mul(cal_buffer->gamma_of_2, ++ cal_buffer->buffer[cal_buffer->buffer_index%16]); + +- if (pow_buffer_ptr != -1) { +- pow_buffer[pow_buffer_ptr%16] = scratch_2; +- pow_buffer_ptr++; ++ if (cal_buffer->buffer_index != -1) { ++ cal_buffer->buffer[cal_buffer->buffer_index%16] = scratch_2; ++ cal_buffer->buffer_index++; + } + + scratch_1 = dc_fixpt_mul(scratch_1, scratch_2); +@@ -413,15 +402,17 @@ static struct fixed31_32 translate_from_linear_space_long( + args->a1); + } + +-static struct fixed31_32 calculate_gamma22(struct fixed31_32 arg, bool use_eetf) ++static struct fixed31_32 calculate_gamma22(struct fixed31_32 arg, bool use_eetf, struct calculate_buffer *cal_buffer) + { + struct fixed31_32 gamma = dc_fixpt_from_fraction(22, 10); ++ struct translate_from_linear_space_args scratch_gamma_args; + + scratch_gamma_args.arg = arg; + scratch_gamma_args.a0 = dc_fixpt_zero; + scratch_gamma_args.a1 = dc_fixpt_zero; + scratch_gamma_args.a2 = dc_fixpt_zero; + scratch_gamma_args.a3 = dc_fixpt_zero; ++ scratch_gamma_args.cal_buffer = cal_buffer; + scratch_gamma_args.gamma = gamma; + + if (use_eetf) +@@ -467,14 +458,18 @@ static struct fixed31_32 translate_to_linear_space( + static struct fixed31_32 translate_from_linear_space_ex( + struct fixed31_32 arg, + struct gamma_coefficients *coeff, +- uint32_t color_index) ++ uint32_t color_index, ++ struct calculate_buffer *cal_buffer) + { ++ struct translate_from_linear_space_args scratch_gamma_args; ++ + scratch_gamma_args.arg = arg; + scratch_gamma_args.a0 = coeff->a0[color_index]; + scratch_gamma_args.a1 = coeff->a1[color_index]; + scratch_gamma_args.a2 = coeff->a2[color_index]; + scratch_gamma_args.a3 = coeff->a3[color_index]; + scratch_gamma_args.gamma = coeff->user_gamma[color_index]; ++ scratch_gamma_args.cal_buffer = cal_buffer; + + return translate_from_linear_space(&scratch_gamma_args); + } +@@ -742,10 +737,11 @@ static void build_pq(struct pwl_float_data_ex *rgb_regamma, + struct fixed31_32 output; + struct fixed31_32 scaling_factor = + dc_fixpt_from_fraction(sdr_white_level, 10000); ++ struct fixed31_32 *pq_table = mod_color_get_table(type_pq_table); + +- if (!pq_initialized && sdr_white_level == 80) { ++ if (!mod_color_is_table_init(type_pq_table) && sdr_white_level == 80) { + precompute_pq(); +- pq_initialized = true; ++ mod_color_set_table_init_state(type_pq_table, true); + } + + /* TODO: start index is from segment 2^-24, skipping first segment +@@ -787,12 +783,12 @@ static void build_de_pq(struct pwl_float_data_ex *de_pq, + { + uint32_t i; + struct fixed31_32 output; +- ++ struct fixed31_32 *de_pq_table = mod_color_get_table(type_de_pq_table); + struct fixed31_32 scaling_factor = dc_fixpt_from_int(125); + +- if (!de_pq_initialized) { ++ if (!mod_color_is_table_init(type_de_pq_table)) { + precompute_de_pq(); +- de_pq_initialized = true; ++ mod_color_set_table_init_state(type_de_pq_table, true); + } + + +@@ -811,7 +807,9 @@ static void build_de_pq(struct pwl_float_data_ex *de_pq, + + static bool build_regamma(struct pwl_float_data_ex *rgb_regamma, + uint32_t hw_points_num, +- const struct hw_x_point *coordinate_x, enum dc_transfer_func_predefined type) ++ const struct hw_x_point *coordinate_x, ++ enum dc_transfer_func_predefined type, ++ struct calculate_buffer *cal_buffer) + { + uint32_t i; + bool ret = false; +@@ -827,20 +825,21 @@ static bool build_regamma(struct pwl_float_data_ex *rgb_regamma, + if (!build_coefficients(coeff, type)) + goto release; + +- memset(pow_buffer, 0, NUM_PTS_IN_REGION * sizeof(struct fixed31_32)); +- pow_buffer_ptr = 0; // see variable definition for more info ++ memset(cal_buffer->buffer, 0, NUM_PTS_IN_REGION * sizeof(struct fixed31_32)); ++ cal_buffer->buffer_index = 0; // see variable definition for more info ++ + i = 0; + while (i <= hw_points_num) { + /*TODO use y vs r,g,b*/ + rgb->r = translate_from_linear_space_ex( +- coord_x->x, coeff, 0); ++ coord_x->x, coeff, 0, cal_buffer); + rgb->g = rgb->r; + rgb->b = rgb->r; + ++coord_x; + ++rgb; + ++i; + } +- pow_buffer_ptr = -1; // reset back to no optimize ++ cal_buffer->buffer_index = -1; + ret = true; + release: + kvfree(coeff); +@@ -932,7 +931,8 @@ static void hermite_spline_eetf(struct fixed31_32 input_x, + static bool build_freesync_hdr(struct pwl_float_data_ex *rgb_regamma, + uint32_t hw_points_num, + const struct hw_x_point *coordinate_x, +- const struct freesync_hdr_tf_params *fs_params) ++ const struct freesync_hdr_tf_params *fs_params, ++ struct calculate_buffer *cal_buffer) + { + uint32_t i; + struct pwl_float_data_ex *rgb = rgb_regamma; +@@ -969,7 +969,7 @@ static bool build_freesync_hdr(struct pwl_float_data_ex *rgb_regamma, + max_content = max_display; + + if (!use_eetf) +- pow_buffer_ptr = 0; // see var definition for more info ++ cal_buffer->buffer_index = 0; // see var definition for more info + rgb += 32; // first 32 points have problems with fixed point, too small + coord_x += 32; + for (i = 32; i <= hw_points_num; i++) { +@@ -988,7 +988,7 @@ static bool build_freesync_hdr(struct pwl_float_data_ex *rgb_regamma, + if (dc_fixpt_lt(scaledX, dc_fixpt_zero)) + output = dc_fixpt_zero; + else +- output = calculate_gamma22(scaledX, use_eetf); ++ output = calculate_gamma22(scaledX, use_eetf, cal_buffer); + + rgb->r = output; + rgb->g = output; +@@ -1008,7 +1008,7 @@ static bool build_freesync_hdr(struct pwl_float_data_ex *rgb_regamma, + ++coord_x; + ++rgb; + } +- pow_buffer_ptr = -1; ++ cal_buffer->buffer_index = -1; + + return true; + } +@@ -1606,7 +1606,7 @@ static void build_new_custom_resulted_curve( + } + + static void apply_degamma_for_user_regamma(struct pwl_float_data_ex *rgb_regamma, +- uint32_t hw_points_num) ++ uint32_t hw_points_num, struct calculate_buffer *cal_buffer) + { + uint32_t i; + +@@ -1619,7 +1619,7 @@ static void apply_degamma_for_user_regamma(struct pwl_float_data_ex *rgb_regamma + i = 0; + while (i != hw_points_num + 1) { + rgb->r = translate_from_linear_space_ex( +- coord_x->x, &coeff, 0); ++ coord_x->x, &coeff, 0, cal_buffer); + rgb->g = rgb->r; + rgb->b = rgb->r; + ++coord_x; +@@ -1674,7 +1674,8 @@ static bool map_regamma_hw_to_x_user( + #define _EXTRA_POINTS 3 + + bool calculate_user_regamma_coeff(struct dc_transfer_func *output_tf, +- const struct regamma_lut *regamma) ++ const struct regamma_lut *regamma, ++ struct calculate_buffer *cal_buffer) + { + struct gamma_coefficients coeff; + const struct hw_x_point *coord_x = coordinates_x; +@@ -1706,11 +1707,11 @@ bool calculate_user_regamma_coeff(struct dc_transfer_func *output_tf, + } + while (i != MAX_HW_POINTS + 1) { + output_tf->tf_pts.red[i] = translate_from_linear_space_ex( +- coord_x->x, &coeff, 0); ++ coord_x->x, &coeff, 0, cal_buffer); + output_tf->tf_pts.green[i] = translate_from_linear_space_ex( +- coord_x->x, &coeff, 1); ++ coord_x->x, &coeff, 1, cal_buffer); + output_tf->tf_pts.blue[i] = translate_from_linear_space_ex( +- coord_x->x, &coeff, 2); ++ coord_x->x, &coeff, 2, cal_buffer); + ++coord_x; + ++i; + } +@@ -1723,7 +1724,8 @@ bool calculate_user_regamma_coeff(struct dc_transfer_func *output_tf, + } + + bool calculate_user_regamma_ramp(struct dc_transfer_func *output_tf, +- const struct regamma_lut *regamma) ++ const struct regamma_lut *regamma, ++ struct calculate_buffer *cal_buffer) + { + struct dc_transfer_func_distributed_points *tf_pts = &output_tf->tf_pts; + struct dividers dividers; +@@ -1756,7 +1758,7 @@ bool calculate_user_regamma_ramp(struct dc_transfer_func *output_tf, + scale_user_regamma_ramp(rgb_user, ®amma->ramp, dividers); + + if (regamma->flags.bits.applyDegamma == 1) { +- apply_degamma_for_user_regamma(rgb_regamma, MAX_HW_POINTS); ++ apply_degamma_for_user_regamma(rgb_regamma, MAX_HW_POINTS, cal_buffer); + copy_rgb_regamma_to_coordinates_x(coordinates_x, + MAX_HW_POINTS, rgb_regamma); + } +@@ -1943,7 +1945,8 @@ static bool calculate_curve(enum dc_transfer_func_predefined trans, + struct dc_transfer_func_distributed_points *points, + struct pwl_float_data_ex *rgb_regamma, + const struct freesync_hdr_tf_params *fs_params, +- uint32_t sdr_ref_white_level) ++ uint32_t sdr_ref_white_level, ++ struct calculate_buffer *cal_buffer) + { + uint32_t i; + bool ret = false; +@@ -1979,7 +1982,8 @@ static bool calculate_curve(enum dc_transfer_func_predefined trans, + build_freesync_hdr(rgb_regamma, + MAX_HW_POINTS, + coordinates_x, +- fs_params); ++ fs_params, ++ cal_buffer); + + ret = true; + } else if (trans == TRANSFER_FUNCTION_HLG) { +@@ -2008,7 +2012,8 @@ static bool calculate_curve(enum dc_transfer_func_predefined trans, + build_regamma(rgb_regamma, + MAX_HW_POINTS, + coordinates_x, +- trans); ++ trans, ++ cal_buffer); + + ret = true; + } +@@ -2018,7 +2023,8 @@ static bool calculate_curve(enum dc_transfer_func_predefined trans, + + bool mod_color_calculate_regamma_params(struct dc_transfer_func *output_tf, + const struct dc_gamma *ramp, bool mapUserRamp, bool canRomBeUsed, +- const struct freesync_hdr_tf_params *fs_params) ++ const struct freesync_hdr_tf_params *fs_params, ++ struct calculate_buffer *cal_buffer) + { + struct dc_transfer_func_distributed_points *tf_pts = &output_tf->tf_pts; + struct dividers dividers; +@@ -2090,7 +2096,8 @@ bool mod_color_calculate_regamma_params(struct dc_transfer_func *output_tf, + tf_pts, + rgb_regamma, + fs_params, +- output_tf->sdr_ref_white_level); ++ output_tf->sdr_ref_white_level, ++ cal_buffer); + + if (ret) { + map_regamma_hw_to_x_user(ramp, coeff, rgb_user, +diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.h b/drivers/gpu/drm/amd/display/modules/color/color_gamma.h +index 7f56226ba77a9..37ffbef6602b0 100644 +--- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.h ++++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.h +@@ -26,6 +26,8 @@ + #ifndef COLOR_MOD_COLOR_GAMMA_H_ + #define COLOR_MOD_COLOR_GAMMA_H_ + ++#include "color_table.h" ++ + struct dc_transfer_func; + struct dc_gamma; + struct dc_transfer_func_distributed_points; +@@ -83,6 +85,12 @@ struct freesync_hdr_tf_params { + unsigned int skip_tm; // skip tm + }; + ++struct calculate_buffer { ++ int buffer_index; ++ struct fixed31_32 buffer[NUM_PTS_IN_REGION]; ++ struct fixed31_32 gamma_of_2; ++}; ++ + struct translate_from_linear_space_args { + struct fixed31_32 arg; + struct fixed31_32 a0; +@@ -90,6 +98,7 @@ struct translate_from_linear_space_args { + struct fixed31_32 a2; + struct fixed31_32 a3; + struct fixed31_32 gamma; ++ struct calculate_buffer *cal_buffer; + }; + + void setup_x_points_distribution(void); +@@ -99,7 +108,8 @@ void precompute_de_pq(void); + + bool mod_color_calculate_regamma_params(struct dc_transfer_func *output_tf, + const struct dc_gamma *ramp, bool mapUserRamp, bool canRomBeUsed, +- const struct freesync_hdr_tf_params *fs_params); ++ const struct freesync_hdr_tf_params *fs_params, ++ struct calculate_buffer *cal_buffer); + + bool mod_color_calculate_degamma_params(struct dc_color_caps *dc_caps, + struct dc_transfer_func *output_tf, +@@ -109,10 +119,12 @@ bool mod_color_calculate_degamma_curve(enum dc_transfer_func_predefined trans, + struct dc_transfer_func_distributed_points *points); + + bool calculate_user_regamma_coeff(struct dc_transfer_func *output_tf, +- const struct regamma_lut *regamma); ++ const struct regamma_lut *regamma, ++ struct calculate_buffer *cal_buffer); + + bool calculate_user_regamma_ramp(struct dc_transfer_func *output_tf, +- const struct regamma_lut *regamma); ++ const struct regamma_lut *regamma, ++ struct calculate_buffer *cal_buffer); + + + #endif /* COLOR_MOD_COLOR_GAMMA_H_ */ +diff --git a/drivers/gpu/drm/amd/display/modules/color/color_table.c b/drivers/gpu/drm/amd/display/modules/color/color_table.c +new file mode 100644 +index 0000000000000..692e536e7d057 +--- /dev/null ++++ b/drivers/gpu/drm/amd/display/modules/color/color_table.c +@@ -0,0 +1,48 @@ ++/* ++ * Copyright (c) 2019 Advanced Micro Devices, Inc. (unpublished) ++ * ++ * All rights reserved. This notice is intended as a precaution against ++ * inadvertent publication and does not imply publication or any waiver ++ * of confidentiality. The year included in the foregoing notice is the ++ * year of creation of the work. ++ */ ++ ++#include "color_table.h" ++ ++static struct fixed31_32 pq_table[MAX_HW_POINTS + 2]; ++static struct fixed31_32 de_pq_table[MAX_HW_POINTS + 2]; ++static bool pq_initialized; ++static bool de_pg_initialized; ++ ++bool mod_color_is_table_init(enum table_type type) ++{ ++ bool ret = false; ++ ++ if (type == type_pq_table) ++ ret = pq_initialized; ++ if (type == type_de_pq_table) ++ ret = de_pg_initialized; ++ ++ return ret; ++} ++ ++struct fixed31_32 *mod_color_get_table(enum table_type type) ++{ ++ struct fixed31_32 *table = NULL; ++ ++ if (type == type_pq_table) ++ table = pq_table; ++ if (type == type_de_pq_table) ++ table = de_pq_table; ++ ++ return table; ++} ++ ++void mod_color_set_table_init_state(enum table_type type, bool state) ++{ ++ if (type == type_pq_table) ++ pq_initialized = state; ++ if (type == type_de_pq_table) ++ de_pg_initialized = state; ++} ++ +diff --git a/drivers/gpu/drm/amd/display/modules/color/color_table.h b/drivers/gpu/drm/amd/display/modules/color/color_table.h +new file mode 100644 +index 0000000000000..2621dd6194027 +--- /dev/null ++++ b/drivers/gpu/drm/amd/display/modules/color/color_table.h +@@ -0,0 +1,47 @@ ++/* ++ * Copyright 2016 Advanced Micro Devices, Inc. ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining a ++ * copy of this software and associated documentation files (the "Software"), ++ * to deal in the Software without restriction, including without limitation ++ * the rights to use, copy, modify, merge, publish, distribute, sublicense, ++ * and/or sell copies of the Software, and to permit persons to whom the ++ * Software is furnished to do so, subject to the following conditions: ++ * ++ * The above copyright notice and this permission notice shall be included in ++ * all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ++ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR ++ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ++ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ++ * OTHER DEALINGS IN THE SOFTWARE. ++ * ++ * Authors: AMD ++ * ++ */ ++ ++ ++#ifndef COLOR_MOD_COLOR_TABLE_H_ ++#define COLOR_MOD_COLOR_TABLE_H_ ++ ++#include "dc_types.h" ++ ++#define NUM_PTS_IN_REGION 16 ++#define NUM_REGIONS 32 ++#define MAX_HW_POINTS (NUM_PTS_IN_REGION*NUM_REGIONS) ++ ++enum table_type { ++ type_pq_table, ++ type_de_pq_table ++}; ++ ++bool mod_color_is_table_init(enum table_type type); ++ ++struct fixed31_32 *mod_color_get_table(enum table_type type); ++ ++void mod_color_set_table_init_state(enum table_type type, bool state); ++ ++#endif /* COLOR_MOD_COLOR_TABLE_H_ */ +-- +2.25.1 + diff --git a/queue-5.8/drm-amd-display-fix-compilation-error-on-allmodconfi.patch b/queue-5.8/drm-amd-display-fix-compilation-error-on-allmodconfi.patch new file mode 100644 index 00000000000..cf334d66ef9 --- /dev/null +++ b/queue-5.8/drm-amd-display-fix-compilation-error-on-allmodconfi.patch @@ -0,0 +1,60 @@ +From cace7e835a419265592dc7d17ce03472e9bddefd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 18 Jun 2020 13:46:18 -0400 +Subject: drm/amd/display: fix compilation error on allmodconfig + +From: Qingqing Zhuo + +[ Upstream commit 8c823e4ff67c78659ab403d63d071103416f49eb ] + +when compiled with allmodconfig option, there are error +messages as below: + +ERROR: modpost: +"mod_color_is_table_init" +[drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined! +ERROR: modpost: +"mod_color_get_table" +[drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined! +ERROR: modpost: +"mod_color_set_table_init_state" +[drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined! + +To fix the issue, this commits removes +CONFIG_DRM_AMD_DC_DCN guard in color/makefile. + +Signed-off-by: Qingqing Zhuo +CC: Lewis Huang +CC: Aric Cyr +CC: Alexander Deucher +CC: Harry Wentland +CC: Nicholas Kazlauskas +CC: Bhawanpreet Lakha +CC: Stephen Rothwell +Acked-by: Alex Deucher +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/display/modules/color/Makefile | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/drivers/gpu/drm/amd/display/modules/color/Makefile b/drivers/gpu/drm/amd/display/modules/color/Makefile +index 3ee7f27ff93b9..e66c19a840c29 100644 +--- a/drivers/gpu/drm/amd/display/modules/color/Makefile ++++ b/drivers/gpu/drm/amd/display/modules/color/Makefile +@@ -23,11 +23,7 @@ + # Makefile for the color sub-module of DAL. + # + +-MOD_COLOR = color_gamma.o +- +-ifdef CONFIG_DRM_AMD_DC_DCN +-MOD_COLOR += color_table.o +-endif ++MOD_COLOR = color_gamma.o color_table.o + + AMD_DAL_MOD_COLOR = $(addprefix $(AMDDALPATH)/modules/color/,$(MOD_COLOR)) + #$(info ************ DAL COLOR MODULE MAKEFILE ************) +-- +2.25.1 + diff --git a/queue-5.8/efi-provide-empty-efi_enter_virtual_mode-implementat.patch b/queue-5.8/efi-provide-empty-efi_enter_virtual_mode-implementat.patch new file mode 100644 index 00000000000..7077d413b13 --- /dev/null +++ b/queue-5.8/efi-provide-empty-efi_enter_virtual_mode-implementat.patch @@ -0,0 +1,52 @@ +From c4411a39f17d963dc1516069fbe22f80019e09f8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 6 Aug 2020 23:25:01 -0700 +Subject: efi: provide empty efi_enter_virtual_mode implementation + +From: Andrey Konovalov + +[ Upstream commit 2c547f9da0539ad1f7ef7f08c8c82036d61b011a ] + +When CONFIG_EFI is not enabled, we might get an undefined reference to +efi_enter_virtual_mode() error, if this efi_enabled() call isn't inlined +into start_kernel(). This happens in particular, if start_kernel() is +annodated with __no_sanitize_address. + +Reported-by: kernel test robot +Signed-off-by: Andrey Konovalov +Signed-off-by: Andrew Morton +Acked-by: Ard Biesheuvel +Cc: Alexander Potapenko +Cc: Andrey Ryabinin +Cc: Catalin Marinas +Cc: Dmitry Vyukov +Cc: Elena Petrova +Cc: Marco Elver +Cc: Vincenzo Frascino +Cc: Walter Wu +Link: http://lkml.kernel.org/r/6514652d3a32d3ed33d6eb5c91d0af63bf0d1a0c.1596544734.git.andreyknvl@google.com +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + include/linux/efi.h | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/include/linux/efi.h b/include/linux/efi.h +index 05c47f857383e..73db1ae04cef8 100644 +--- a/include/linux/efi.h ++++ b/include/linux/efi.h +@@ -606,7 +606,11 @@ extern void *efi_get_pal_addr (void); + extern void efi_map_pal_code (void); + extern void efi_memmap_walk (efi_freemem_callback_t callback, void *arg); + extern void efi_gettimeofday (struct timespec64 *ts); ++#ifdef CONFIG_EFI + extern void efi_enter_virtual_mode (void); /* switch EFI to virtual mode, if possible */ ++#else ++static inline void efi_enter_virtual_mode (void) {} ++#endif + #ifdef CONFIG_X86 + extern efi_status_t efi_query_variable_store(u32 attributes, + unsigned long size, +-- +2.25.1 + diff --git a/queue-5.8/kvm-arm64-fix-symbol-dependency-in-__hyp_call_panic_.patch b/queue-5.8/kvm-arm64-fix-symbol-dependency-in-__hyp_call_panic_.patch new file mode 100644 index 00000000000..d82e1de2ad0 --- /dev/null +++ b/queue-5.8/kvm-arm64-fix-symbol-dependency-in-__hyp_call_panic_.patch @@ -0,0 +1,42 @@ +From 53557fae773620da540a43e17766420029c28c64 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 25 Jun 2020 14:14:06 +0100 +Subject: KVM: arm64: Fix symbol dependency in __hyp_call_panic_nvhe + +From: David Brazdil + +[ Upstream commit b38b298aa4397e2dc74a89b4dd3eac9e59b64c96 ] + +__hyp_call_panic_nvhe contains inline assembly which did not declare +its dependency on the __hyp_panic_string symbol. + +The static-declared string has previously been kept alive because of a use in +__hyp_call_panic_vhe. Fix this in preparation for separating the source files +between VHE and nVHE when the two users land in two different compilation +units. The static variable otherwise gets dropped when compiling the nVHE +source file, causing an undefined symbol linker error later. + +Signed-off-by: David Brazdil +Signed-off-by: Marc Zyngier +Link: https://lore.kernel.org/r/20200625131420.71444-2-dbrazdil@google.com +Signed-off-by: Sasha Levin +--- + arch/arm64/kvm/hyp/switch.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c +index db1c4487d95d1..9270b14157b55 100644 +--- a/arch/arm64/kvm/hyp/switch.c ++++ b/arch/arm64/kvm/hyp/switch.c +@@ -897,7 +897,7 @@ static void __hyp_text __hyp_call_panic_nvhe(u64 spsr, u64 elr, u64 par, + * making sure it is a kernel address and not a PC-relative + * reference. + */ +- asm volatile("ldr %0, =__hyp_panic_string" : "=r" (str_va)); ++ asm volatile("ldr %0, =%1" : "=r" (str_va) : "S" (__hyp_panic_string)); + + __hyp_do_panic(str_va, + spsr, elr, +-- +2.25.1 + diff --git a/queue-5.8/media-davinci-vpif_capture-fix-potential-double-free.patch b/queue-5.8/media-davinci-vpif_capture-fix-potential-double-free.patch new file mode 100644 index 00000000000..195c9d21597 --- /dev/null +++ b/queue-5.8/media-davinci-vpif_capture-fix-potential-double-free.patch @@ -0,0 +1,40 @@ +From bb1af900411cddcdcbe8827f8379971547983312 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 23 Jul 2020 19:04:53 +0200 +Subject: media: davinci: vpif_capture: fix potential double free + +From: Evgeny Novikov + +[ Upstream commit 602649eadaa0c977e362e641f51ec306bc1d365d ] + +In case of errors vpif_probe_complete() releases memory for vpif_obj.sd +and unregisters the V4L2 device. But then this is done again by +vpif_probe() itself. The patch removes the cleaning from +vpif_probe_complete(). + +Found by Linux Driver Verification project (linuxtesting.org). + +Signed-off-by: Evgeny Novikov +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Sasha Levin +--- + drivers/media/platform/davinci/vpif_capture.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c +index d9ec439faefa6..72a0e94e2e21a 100644 +--- a/drivers/media/platform/davinci/vpif_capture.c ++++ b/drivers/media/platform/davinci/vpif_capture.c +@@ -1482,8 +1482,6 @@ probe_out: + /* Unregister video device */ + video_unregister_device(&ch->video_dev); + } +- kfree(vpif_obj.sd); +- v4l2_device_unregister(&vpif_obj.v4l2_dev); + + return err; + } +-- +2.25.1 + diff --git a/queue-5.8/media-i2c-imx290-fix-reset-gpio-pin-handling.patch b/queue-5.8/media-i2c-imx290-fix-reset-gpio-pin-handling.patch new file mode 100644 index 00000000000..1f0a525cf91 --- /dev/null +++ b/queue-5.8/media-i2c-imx290-fix-reset-gpio-pin-handling.patch @@ -0,0 +1,69 @@ +From 73d2acc4033881276ab29da34a1bed753c9f4429 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 12 Jun 2020 15:53:48 +0200 +Subject: media: i2c: imx290: fix reset GPIO pin handling + +From: Andrey Konovalov + +[ Upstream commit 3909a92d7df622b41b9ceeeea694e641cad7667b ] + +According to https://www.kernel.org/doc/Documentation/gpio/consumer.txt, + +- all of the gpiod_set_value_xxx() functions operate with the *logical* +value. So in imx290_power_on() the reset signal should be cleared +(de-asserted) with gpiod_set_value_cansleep(imx290->rst_gpio, 0), and in +imx290_power_off() the value of 1 must be used to apply/assert the reset +to the sensor. In the device tree the reset pin is described as +GPIO_ACTIVE_LOW, and gpiod_set_value_xxx() functions take this into +account, + +- when devm_gpiod_get_optional() is called with GPIOD_ASIS, the GPIO is +not initialized, and the direction must be set later; using a GPIO +without setting its direction first is illegal and will result in undefined +behavior. Fix this by using GPIOD_OUT_HIGH instead of GPIOD_ASIS (this +asserts the reset signal to the sensor initially). + +Signed-off-by: Andrey Konovalov +Reviewed-by: Manivannan Sadhasivam +Signed-off-by: Sakari Ailus +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Sasha Levin +--- + drivers/media/i2c/imx290.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/drivers/media/i2c/imx290.c b/drivers/media/i2c/imx290.c +index f7678e5a5d879..157a0ed0a8856 100644 +--- a/drivers/media/i2c/imx290.c ++++ b/drivers/media/i2c/imx290.c +@@ -628,7 +628,7 @@ static int imx290_power_on(struct device *dev) + } + + usleep_range(1, 2); +- gpiod_set_value_cansleep(imx290->rst_gpio, 1); ++ gpiod_set_value_cansleep(imx290->rst_gpio, 0); + usleep_range(30000, 31000); + + return 0; +@@ -641,7 +641,7 @@ static int imx290_power_off(struct device *dev) + struct imx290 *imx290 = to_imx290(sd); + + clk_disable_unprepare(imx290->xclk); +- gpiod_set_value_cansleep(imx290->rst_gpio, 0); ++ gpiod_set_value_cansleep(imx290->rst_gpio, 1); + regulator_bulk_disable(IMX290_NUM_SUPPLIES, imx290->supplies); + + return 0; +@@ -760,7 +760,8 @@ static int imx290_probe(struct i2c_client *client) + goto free_err; + } + +- imx290->rst_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_ASIS); ++ imx290->rst_gpio = devm_gpiod_get_optional(dev, "reset", ++ GPIOD_OUT_HIGH); + if (IS_ERR(imx290->rst_gpio)) { + dev_err(dev, "Cannot get reset gpio\n"); + ret = PTR_ERR(imx290->rst_gpio); +-- +2.25.1 + diff --git a/queue-5.8/mmc-sdhci-of-arasan-fix-timings-allocation-code.patch b/queue-5.8/mmc-sdhci-of-arasan-fix-timings-allocation-code.patch new file mode 100644 index 00000000000..aa0bdfde173 --- /dev/null +++ b/queue-5.8/mmc-sdhci-of-arasan-fix-timings-allocation-code.patch @@ -0,0 +1,82 @@ +From d7b613c0a4e1abf466e60bcf831934f945374c0d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 15 Jul 2020 00:42:33 +0530 +Subject: mmc: sdhci-of-arasan: fix timings allocation code + +From: Manish Narani + +[ Upstream commit 88e1d0b175ec0bfa775c8629eae2a728726e2c6a ] + +The initial code that was adding delays was doing a cast over undefined +memory. This meant that the delays would be all gibberish. + +This change, allocates all delays on the stack, and assigns them from the +ZynqMP & Versal macros/phase-list. And then finally copies them over the +common iclk_phase & oclk_phase variables. + +Signed-off-by: Manish Narani +Link: https://lore.kernel.org/r/1594753953-62980-1-git-send-email-manish.narani@xilinx.com +Signed-off-by: Ulf Hansson +Signed-off-by: Sasha Levin +--- + drivers/mmc/host/sdhci-of-arasan.c | 25 ++++++++++++++----------- + 1 file changed, 14 insertions(+), 11 deletions(-) + +diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c +index fb26e743e1fd4..d0a80bfb953b0 100644 +--- a/drivers/mmc/host/sdhci-of-arasan.c ++++ b/drivers/mmc/host/sdhci-of-arasan.c +@@ -1025,7 +1025,6 @@ static void arasan_dt_read_clk_phase(struct device *dev, + static void arasan_dt_parse_clk_phases(struct device *dev, + struct sdhci_arasan_clk_data *clk_data) + { +- int *iclk_phase, *oclk_phase; + u32 mio_bank = 0; + int i; + +@@ -1037,28 +1036,32 @@ static void arasan_dt_parse_clk_phases(struct device *dev, + clk_data->set_clk_delays = sdhci_arasan_set_clk_delays; + + if (of_device_is_compatible(dev->of_node, "xlnx,zynqmp-8.9a")) { +- iclk_phase = (int [MMC_TIMING_MMC_HS400 + 1]) ZYNQMP_ICLK_PHASE; +- oclk_phase = (int [MMC_TIMING_MMC_HS400 + 1]) ZYNQMP_OCLK_PHASE; ++ u32 zynqmp_iclk_phase[MMC_TIMING_MMC_HS400 + 1] = ++ ZYNQMP_ICLK_PHASE; ++ u32 zynqmp_oclk_phase[MMC_TIMING_MMC_HS400 + 1] = ++ ZYNQMP_OCLK_PHASE; + + of_property_read_u32(dev->of_node, "xlnx,mio-bank", &mio_bank); + if (mio_bank == 2) { +- oclk_phase[MMC_TIMING_UHS_SDR104] = 90; +- oclk_phase[MMC_TIMING_MMC_HS200] = 90; ++ zynqmp_oclk_phase[MMC_TIMING_UHS_SDR104] = 90; ++ zynqmp_oclk_phase[MMC_TIMING_MMC_HS200] = 90; + } + + for (i = 0; i <= MMC_TIMING_MMC_HS400; i++) { +- clk_data->clk_phase_in[i] = iclk_phase[i]; +- clk_data->clk_phase_out[i] = oclk_phase[i]; ++ clk_data->clk_phase_in[i] = zynqmp_iclk_phase[i]; ++ clk_data->clk_phase_out[i] = zynqmp_oclk_phase[i]; + } + } + + if (of_device_is_compatible(dev->of_node, "xlnx,versal-8.9a")) { +- iclk_phase = (int [MMC_TIMING_MMC_HS400 + 1]) VERSAL_ICLK_PHASE; +- oclk_phase = (int [MMC_TIMING_MMC_HS400 + 1]) VERSAL_OCLK_PHASE; ++ u32 versal_iclk_phase[MMC_TIMING_MMC_HS400 + 1] = ++ VERSAL_ICLK_PHASE; ++ u32 versal_oclk_phase[MMC_TIMING_MMC_HS400 + 1] = ++ VERSAL_OCLK_PHASE; + + for (i = 0; i <= MMC_TIMING_MMC_HS400; i++) { +- clk_data->clk_phase_in[i] = iclk_phase[i]; +- clk_data->clk_phase_out[i] = oclk_phase[i]; ++ clk_data->clk_phase_in[i] = versal_iclk_phase[i]; ++ clk_data->clk_phase_out[i] = versal_oclk_phase[i]; + } + } + +-- +2.25.1 + diff --git a/queue-5.8/pinctrl-mediatek-avoid-virtual-gpio-trying-to-set-re.patch b/queue-5.8/pinctrl-mediatek-avoid-virtual-gpio-trying-to-set-re.patch new file mode 100644 index 00000000000..9d842fc6a53 --- /dev/null +++ b/queue-5.8/pinctrl-mediatek-avoid-virtual-gpio-trying-to-set-re.patch @@ -0,0 +1,98 @@ +From 84702b6823055e5be3b7ef1810c66fbf66e92d32 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 23 Jul 2020 19:19:53 +0800 +Subject: pinctrl: mediatek: avoid virtual gpio trying to set reg + +From: Hanks Chen + +[ Upstream commit edd546465002621665a3a275abe908a30efdce5b ] + +for virtual gpios, they should not do reg setting and +should behave as expected for eint function. + +Signed-off-by: Mars Cheng +Signed-off-by: Hanks Chen +Acked-by: Sean Wang +Link: https://lore.kernel.org/r/1595503197-15246-4-git-send-email-hanks.chen@mediatek.com +Signed-off-by: Linus Walleij +Signed-off-by: Sasha Levin +--- + .../pinctrl/mediatek/pinctrl-mtk-common-v2.c | 25 +++++++++++++++++++ + .../pinctrl/mediatek/pinctrl-mtk-common-v2.h | 1 + + drivers/pinctrl/mediatek/pinctrl-paris.c | 7 ++++++ + 3 files changed, 33 insertions(+) + +diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c +index b77b18fe5adcf..c53e2c391e32b 100644 +--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c ++++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c +@@ -243,6 +243,28 @@ static int mtk_xt_find_eint_num(struct mtk_pinctrl *hw, unsigned long eint_n) + return EINT_NA; + } + ++/* ++ * Virtual GPIO only used inside SOC and not being exported to outside SOC. ++ * Some modules use virtual GPIO as eint (e.g. pmif or usb). ++ * In MTK platform, external interrupt (EINT) and GPIO is 1-1 mapping ++ * and we can set GPIO as eint. ++ * But some modules use specific eint which doesn't have real GPIO pin. ++ * So we use virtual GPIO to map it. ++ */ ++ ++bool mtk_is_virt_gpio(struct mtk_pinctrl *hw, unsigned int gpio_n) ++{ ++ const struct mtk_pin_desc *desc; ++ bool virt_gpio = false; ++ ++ desc = (const struct mtk_pin_desc *)&hw->soc->pins[gpio_n]; ++ ++ if (desc->funcs && !desc->funcs[desc->eint.eint_m].name) ++ virt_gpio = true; ++ ++ return virt_gpio; ++} ++ + static int mtk_xt_get_gpio_n(void *data, unsigned long eint_n, + unsigned int *gpio_n, + struct gpio_chip **gpio_chip) +@@ -295,6 +317,9 @@ static int mtk_xt_set_gpio_as_eint(void *data, unsigned long eint_n) + if (err) + return err; + ++ if (mtk_is_virt_gpio(hw, gpio_n)) ++ return 0; ++ + desc = (const struct mtk_pin_desc *)&hw->soc->pins[gpio_n]; + + err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_MODE, +diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h +index 27df087363960..bd079f4fb1d6f 100644 +--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h ++++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h +@@ -315,4 +315,5 @@ int mtk_pinconf_adv_drive_set(struct mtk_pinctrl *hw, + int mtk_pinconf_adv_drive_get(struct mtk_pinctrl *hw, + const struct mtk_pin_desc *desc, u32 *val); + ++bool mtk_is_virt_gpio(struct mtk_pinctrl *hw, unsigned int gpio_n); + #endif /* __PINCTRL_MTK_COMMON_V2_H */ +diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c +index 90a432bf9fedc..a23c18251965e 100644 +--- a/drivers/pinctrl/mediatek/pinctrl-paris.c ++++ b/drivers/pinctrl/mediatek/pinctrl-paris.c +@@ -769,6 +769,13 @@ static int mtk_gpio_get_direction(struct gpio_chip *chip, unsigned int gpio) + if (gpio >= hw->soc->npins) + return -EINVAL; + ++ /* ++ * "Virtual" GPIOs are always and only used for interrupts ++ * Since they are only used for interrupts, they are always inputs ++ */ ++ if (mtk_is_virt_gpio(hw, gpio)) ++ return 1; ++ + desc = (const struct mtk_pin_desc *)&hw->soc->pins[gpio]; + + err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_DIR, &value); +-- +2.25.1 + diff --git a/queue-5.8/pinctrl-mediatek-fix-build-for-tristate-changes.patch b/queue-5.8/pinctrl-mediatek-fix-build-for-tristate-changes.patch new file mode 100644 index 00000000000..fd46cecb0af --- /dev/null +++ b/queue-5.8/pinctrl-mediatek-fix-build-for-tristate-changes.patch @@ -0,0 +1,44 @@ +From 1d646f23278ceacd7e46cefd42173cb92fb640fa Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 27 Jul 2020 22:55:45 -0700 +Subject: pinctrl: mediatek: fix build for tristate changes + +From: Randy Dunlap + +[ Upstream commit 047cd9a6bd8a2a73e8d92eb97a1b50c7bcd59279 ] + +Export mtk_is_virt_gpio() for the case when +CONFIG_PINCTRL_MTK=y +CONFIG_PINCTRL_MTK_V2=y +CONFIG_PINCTRL_MTK_MOORE=y +CONFIG_PINCTRL_MTK_PARIS=m + +to fix this build error: + +ERROR: modpost: "mtk_is_virt_gpio" [drivers/pinctrl/mediatek/pinctrl-paris.ko] undefined! + +Signed-off-by: Randy Dunlap +Cc: Sean Wang +Cc: linux-mediatek@lists.infradead.org +Link: https://lore.kernel.org/r/d15827a3-d0c8-e231-9f61-8507b3d7be3a@infradead.org +Signed-off-by: Linus Walleij +Signed-off-by: Sasha Levin +--- + drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c +index c53e2c391e32b..2f3dfb56c3fa4 100644 +--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c ++++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c +@@ -264,6 +264,7 @@ bool mtk_is_virt_gpio(struct mtk_pinctrl *hw, unsigned int gpio_n) + + return virt_gpio; + } ++EXPORT_SYMBOL_GPL(mtk_is_virt_gpio); + + static int mtk_xt_get_gpio_n(void *data, unsigned long eint_n, + unsigned int *gpio_n, +-- +2.25.1 + diff --git a/queue-5.8/powerpc-spufs-add-config_coredump-dependency.patch b/queue-5.8/powerpc-spufs-add-config_coredump-dependency.patch new file mode 100644 index 00000000000..fe95af0a0ca --- /dev/null +++ b/queue-5.8/powerpc-spufs-add-config_coredump-dependency.patch @@ -0,0 +1,47 @@ +From a01384c098724e9e2381d4261cf1374131e6d1a8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Jul 2020 15:22:46 +0200 +Subject: powerpc/spufs: add CONFIG_COREDUMP dependency + +From: Arnd Bergmann + +[ Upstream commit b648a5132ca3237a0f1ce5d871fff342b0efcf8a ] + +The kernel test robot pointed out a slightly different error message +after recent commit 5456ffdee666 ("powerpc/spufs: simplify spufs core +dumping") to spufs for a configuration that never worked: + + powerpc64-linux-ld: arch/powerpc/platforms/cell/spufs/file.o: in function `.spufs_proxydma_info_dump': +>> file.c:(.text+0x4c68): undefined reference to `.dump_emit' + powerpc64-linux-ld: arch/powerpc/platforms/cell/spufs/file.o: in function `.spufs_dma_info_dump': + file.c:(.text+0x4d70): undefined reference to `.dump_emit' + powerpc64-linux-ld: arch/powerpc/platforms/cell/spufs/file.o: in function `.spufs_wbox_info_dump': + file.c:(.text+0x4df4): undefined reference to `.dump_emit' + +Add a Kconfig dependency to prevent this from happening again. + +Reported-by: kernel test robot +Signed-off-by: Arnd Bergmann +Acked-by: Jeremy Kerr +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20200706132302.3885935-1-arnd@arndb.de +Signed-off-by: Sasha Levin +--- + arch/powerpc/platforms/cell/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/powerpc/platforms/cell/Kconfig b/arch/powerpc/platforms/cell/Kconfig +index 0f7c8241912b9..f2ff359041eec 100644 +--- a/arch/powerpc/platforms/cell/Kconfig ++++ b/arch/powerpc/platforms/cell/Kconfig +@@ -44,6 +44,7 @@ config SPU_FS + tristate "SPU file system" + default m + depends on PPC_CELL ++ depends on COREDUMP + select SPU_BASE + help + The SPU file system is used to access Synergistic Processing +-- +2.25.1 + diff --git a/queue-5.8/series b/queue-5.8/series index ac8218a3ee1..de75e03f852 100644 --- a/queue-5.8/series +++ b/queue-5.8/series @@ -61,3 +61,17 @@ scsi-fcoe-memory-leak-fix-in-fcoe_sysfs_fcf_del.patch i2c-i801-add-support-for-intel-tiger-lake-pch-h.patch edac-ie31200-fallback-if-host-bridge-device-is-alrea.patch hugetlbfs-prevent-filesystem-stacking-of-hugetlbfs.patch +media-davinci-vpif_capture-fix-potential-double-free.patch +media-i2c-imx290-fix-reset-gpio-pin-handling.patch +drm-amd-display-change-global-buffer-to-local-buffer.patch +drm-amd-display-fix-compilation-error-on-allmodconfi.patch +kvm-arm64-fix-symbol-dependency-in-__hyp_call_panic_.patch +powerpc-spufs-add-config_coredump-dependency.patch +dmaengine-idxd-fix-pci_msi-build-errors.patch +usb-sisusbvga-fix-a-potential-ub-casued-by-left-shif.patch +mmc-sdhci-of-arasan-fix-timings-allocation-code.patch +brcmfmac-set-timeout-value-when-configuring-power-sa.patch +pinctrl-mediatek-avoid-virtual-gpio-trying-to-set-re.patch +pinctrl-mediatek-fix-build-for-tristate-changes.patch +efi-provide-empty-efi_enter_virtual_mode-implementat.patch +arm64-fix-__cpu_logical_map-undefined-issue.patch diff --git a/queue-5.8/usb-sisusbvga-fix-a-potential-ub-casued-by-left-shif.patch b/queue-5.8/usb-sisusbvga-fix-a-potential-ub-casued-by-left-shif.patch new file mode 100644 index 00000000000..afbfa327163 --- /dev/null +++ b/queue-5.8/usb-sisusbvga-fix-a-potential-ub-casued-by-left-shif.patch @@ -0,0 +1,41 @@ +From 6bd316ca5b5f4b373d977fe48004c73d1ace633d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 11 Jul 2020 00:30:18 -0400 +Subject: USB: sisusbvga: Fix a potential UB casued by left shifting a negative + value + +From: Changming Liu + +[ Upstream commit 2b53a19284f537168fb506f2f40d7fda40a01162 ] + +The char buffer buf, receives data directly from user space, +so its content might be negative and its elements are left +shifted to form an unsigned integer. + +Since left shifting a negative value is undefined behavior, thus +change the char to u8 to elimintate this UB. + +Signed-off-by: Changming Liu +Link: https://lore.kernel.org/r/20200711043018.928-1-charley.ashbringer@gmail.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/usb/misc/sisusbvga/sisusb.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c +index fc8a5da4a07c9..0734e6dd93862 100644 +--- a/drivers/usb/misc/sisusbvga/sisusb.c ++++ b/drivers/usb/misc/sisusbvga/sisusb.c +@@ -761,7 +761,7 @@ static int sisusb_write_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr, + u8 swap8, fromkern = kernbuffer ? 1 : 0; + u16 swap16; + u32 swap32, flag = (length >> 28) & 1; +- char buf[4]; ++ u8 buf[4]; + + /* if neither kernbuffer not userbuffer are given, assume + * data in obuf +-- +2.25.1 +