From: Sasha Levin Date: Tue, 15 Oct 2019 22:05:50 +0000 (-0400) Subject: fixes for 5.3 X-Git-Tag: v4.4.197~19^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=11dd322cefc4bd55fc5195c8120e174851f8f47a;p=thirdparty%2Fkernel%2Fstable-queue.git fixes for 5.3 Signed-off-by: Sasha Levin --- diff --git a/queue-5.3/acpi-pptt-add-support-for-acpi-6.3-thread-flag.patch b/queue-5.3/acpi-pptt-add-support-for-acpi-6.3-thread-flag.patch new file mode 100644 index 00000000000..4039f3ac2ee --- /dev/null +++ b/queue-5.3/acpi-pptt-add-support-for-acpi-6.3-thread-flag.patch @@ -0,0 +1,119 @@ +From c8311aa87ddd539613e61ff3ca0e68635e1fe8ac Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 14 Oct 2019 19:56:01 +0800 +Subject: ACPI/PPTT: Add support for ACPI 6.3 thread flag + +From: Jeremy Linton + +Commit bbd1b70639f785a970d998f35155c713f975e3ac upstream. + +ACPI 6.3 adds a flag to the CPU node to indicate whether +the given PE is a thread. Add a function to return that +information for a given linux logical CPU. + +Signed-off-by: Jeremy Linton +Reviewed-by: Sudeep Holla +Reviewed-by: Robert Richter +Acked-by: Rafael J. Wysocki +Signed-off-by: Will Deacon +Signed-off-by: John Garry +Signed-off-by: Sasha Levin +--- + drivers/acpi/pptt.c | 52 ++++++++++++++++++++++++++++++++++++++++++++ + include/linux/acpi.h | 5 +++++ + 2 files changed, 57 insertions(+) + +diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c +index 1e7ac0bd0d3a0..9497298018a91 100644 +--- a/drivers/acpi/pptt.c ++++ b/drivers/acpi/pptt.c +@@ -540,6 +540,44 @@ static int find_acpi_cpu_topology_tag(unsigned int cpu, int level, int flag) + return retval; + } + ++/** ++ * check_acpi_cpu_flag() - Determine if CPU node has a flag set ++ * @cpu: Kernel logical CPU number ++ * @rev: The minimum PPTT revision defining the flag ++ * @flag: The flag itself ++ * ++ * Check the node representing a CPU for a given flag. ++ * ++ * Return: -ENOENT if the PPTT doesn't exist, the CPU cannot be found or ++ * the table revision isn't new enough. ++ * 1, any passed flag set ++ * 0, flag unset ++ */ ++static int check_acpi_cpu_flag(unsigned int cpu, int rev, u32 flag) ++{ ++ struct acpi_table_header *table; ++ acpi_status status; ++ u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu); ++ struct acpi_pptt_processor *cpu_node = NULL; ++ int ret = -ENOENT; ++ ++ status = acpi_get_table(ACPI_SIG_PPTT, 0, &table); ++ if (ACPI_FAILURE(status)) { ++ acpi_pptt_warn_missing(); ++ return ret; ++ } ++ ++ if (table->revision >= rev) ++ cpu_node = acpi_find_processor_node(table, acpi_cpu_id); ++ ++ if (cpu_node) ++ ret = (cpu_node->flags & flag) != 0; ++ ++ acpi_put_table(table); ++ ++ return ret; ++} ++ + /** + * acpi_find_last_cache_level() - Determines the number of cache levels for a PE + * @cpu: Kernel logical CPU number +@@ -604,6 +642,20 @@ int cache_setup_acpi(unsigned int cpu) + return status; + } + ++/** ++ * acpi_pptt_cpu_is_thread() - Determine if CPU is a thread ++ * @cpu: Kernel logical CPU number ++ * ++ * Return: 1, a thread ++ * 0, not a thread ++ * -ENOENT ,if the PPTT doesn't exist, the CPU cannot be found or ++ * the table revision isn't new enough. ++ */ ++int acpi_pptt_cpu_is_thread(unsigned int cpu) ++{ ++ return check_acpi_cpu_flag(cpu, 2, ACPI_PPTT_ACPI_PROCESSOR_IS_THREAD); ++} ++ + /** + * find_acpi_cpu_topology() - Determine a unique topology value for a given CPU + * @cpu: Kernel logical CPU number +diff --git a/include/linux/acpi.h b/include/linux/acpi.h +index 9426b9aaed86f..9d0e20a2ac831 100644 +--- a/include/linux/acpi.h ++++ b/include/linux/acpi.h +@@ -1302,11 +1302,16 @@ static inline int lpit_read_residency_count_address(u64 *address) + #endif + + #ifdef CONFIG_ACPI_PPTT ++int acpi_pptt_cpu_is_thread(unsigned int cpu); + int find_acpi_cpu_topology(unsigned int cpu, int level); + int find_acpi_cpu_topology_package(unsigned int cpu); + int find_acpi_cpu_topology_hetero_id(unsigned int cpu); + int find_acpi_cpu_cache_topology(unsigned int cpu, int level); + #else ++static inline int acpi_pptt_cpu_is_thread(unsigned int cpu) ++{ ++ return -EINVAL; ++} + static inline int find_acpi_cpu_topology(unsigned int cpu, int level) + { + return -EINVAL; +-- +2.20.1 + diff --git a/queue-5.3/arm64-topology-use-pptt-to-determine-if-pe-is-a-thre.patch b/queue-5.3/arm64-topology-use-pptt-to-determine-if-pe-is-a-thre.patch new file mode 100644 index 00000000000..c2602071f6f --- /dev/null +++ b/queue-5.3/arm64-topology-use-pptt-to-determine-if-pe-is-a-thre.patch @@ -0,0 +1,73 @@ +From 553471812304a6b2a6e018d3e32e12879068ab3b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 14 Oct 2019 19:56:02 +0800 +Subject: arm64: topology: Use PPTT to determine if PE is a thread + +From: Jeremy Linton + +Commit 98dc19902a0b2e5348e43d6a2c39a0a7d0fc639e upstream. + +ACPI 6.3 adds a thread flag to represent if a CPU/PE is +actually a thread. Given that the MPIDR_MT bit may not +represent this information consistently on homogeneous machines +we should prefer the PPTT flag if its available. + +Signed-off-by: Jeremy Linton +Reviewed-by: Sudeep Holla +Reviewed-by: Robert Richter +[will: made acpi_cpu_is_threaded() return 'bool'] +Signed-off-by: Will Deacon +Signed-off-by: John Garry +Signed-off-by: Sasha Levin +--- + arch/arm64/kernel/topology.c | 19 +++++++++++++++---- + 1 file changed, 15 insertions(+), 4 deletions(-) + +diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c +index 0825c4a856e33..6106c49f84bc8 100644 +--- a/arch/arm64/kernel/topology.c ++++ b/arch/arm64/kernel/topology.c +@@ -340,17 +340,28 @@ void remove_cpu_topology(unsigned int cpu) + } + + #ifdef CONFIG_ACPI ++static bool __init acpi_cpu_is_threaded(int cpu) ++{ ++ int is_threaded = acpi_pptt_cpu_is_thread(cpu); ++ ++ /* ++ * if the PPTT doesn't have thread information, assume a homogeneous ++ * machine and return the current CPU's thread state. ++ */ ++ if (is_threaded < 0) ++ is_threaded = read_cpuid_mpidr() & MPIDR_MT_BITMASK; ++ ++ return !!is_threaded; ++} ++ + /* + * Propagate the topology information of the processor_topology_node tree to the + * cpu_topology array. + */ + static int __init parse_acpi_topology(void) + { +- bool is_threaded; + int cpu, topology_id; + +- is_threaded = read_cpuid_mpidr() & MPIDR_MT_BITMASK; +- + for_each_possible_cpu(cpu) { + int i, cache_id; + +@@ -358,7 +369,7 @@ static int __init parse_acpi_topology(void) + if (topology_id < 0) + return topology_id; + +- if (is_threaded) { ++ if (acpi_cpu_is_threaded(cpu)) { + cpu_topology[cpu].thread_id = topology_id; + topology_id = find_acpi_cpu_topology(cpu, 1); + cpu_topology[cpu].core_id = topology_id; +-- +2.20.1 + diff --git a/queue-5.3/iio-light-fix-vcnl4000-devicetree-hooks.patch b/queue-5.3/iio-light-fix-vcnl4000-devicetree-hooks.patch new file mode 100644 index 00000000000..fa4b25d5ca4 --- /dev/null +++ b/queue-5.3/iio-light-fix-vcnl4000-devicetree-hooks.patch @@ -0,0 +1,61 @@ +From 4b1ef1c048c287006b16b86835d4e6422eb7514e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 17 Sep 2019 16:56:36 +0200 +Subject: iio: light: fix vcnl4000 devicetree hooks + +From: Marco Felsch + +[ Upstream commit 1436a78c63495dd94c8d4f84a76d78d5317d481b ] + +Since commit ebd457d55911 ("iio: light: vcnl4000 add devicetree hooks") +the of_match_table is supported but the data shouldn't be a string. +Instead it shall be one of 'enum vcnl4000_device_ids'. Also the matching +logic for the vcnl4020 was wrong. Since the data retrieve mechanism is +still based on the i2c_device_id no failures did appeared till now. + +Fixes: ebd457d55911 ("iio: light: vcnl4000 add devicetree hooks") +Signed-off-by: Marco Felsch +Reviewed-by: Angus Ainslie (Purism) angus@akkea.ca +Cc: +Signed-off-by: Jonathan Cameron +Signed-off-by: Sasha Levin +--- + drivers/iio/light/vcnl4000.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c +index ca0d27b46ea22..16dacea9eadfa 100644 +--- a/drivers/iio/light/vcnl4000.c ++++ b/drivers/iio/light/vcnl4000.c +@@ -398,15 +398,15 @@ static int vcnl4000_probe(struct i2c_client *client, + static const struct of_device_id vcnl_4000_of_match[] = { + { + .compatible = "vishay,vcnl4000", +- .data = "VCNL4000", ++ .data = (void *)VCNL4000, + }, + { + .compatible = "vishay,vcnl4010", +- .data = "VCNL4010", ++ .data = (void *)VCNL4010, + }, + { +- .compatible = "vishay,vcnl4010", +- .data = "VCNL4020", ++ .compatible = "vishay,vcnl4020", ++ .data = (void *)VCNL4010, + }, + { + .compatible = "vishay,vcnl4040", +@@ -414,7 +414,7 @@ static const struct of_device_id vcnl_4000_of_match[] = { + }, + { + .compatible = "vishay,vcnl4200", +- .data = "VCNL4200", ++ .data = (void *)VCNL4200, + }, + {}, + }; +-- +2.20.1 + diff --git a/queue-5.3/series b/queue-5.3/series index 90528e9cb3f..807321255ec 100644 --- a/queue-5.3/series +++ b/queue-5.3/series @@ -81,3 +81,6 @@ ib-core-fix-wrong-iterating-on-ports.patch firmware-google-increment-vpd-key_len-properly.patch gpio-fix-getting-nonexclusive-gpiods-from-dt.patch gpiolib-don-t-clear-flag_is_out-when-emulating-open-.patch +acpi-pptt-add-support-for-acpi-6.3-thread-flag.patch +arm64-topology-use-pptt-to-determine-if-pe-is-a-thre.patch +iio-light-fix-vcnl4000-devicetree-hooks.patch