ASoC: dapm: Fix NULL pointer deference on CODEC to CODEC DAIs
Sasha Levin
maintainerPATCH 1/48 ASoC: dapm: Fix NULL pointer deference on CODEC to CODEC DAIs
From: Charles Keepax <[email protected]>
[ Upstream commit 249dc49576fc953a7378b916c6a6d47ea81e4da2 ]
Commit a655de808cbde ("ASoC: core: Allow topology to override machine driver FE DAI link config.") caused soc_dai_hw_params to be come dependent on the substream private_data being set with a pointer to the snd_soc_pcm_runtime. Currently, CODEC to CODEC links don't set this, which causes a NULL pointer dereference:
[<4069de54>] (soc_dai_hw_params) from
[<40694b68>] (snd_soc_dai_link_event+0x1a0/0x380)
Since the ASoC core in general assumes that the substream private_data will be set to a pointer to the snd_soc_pcm_runtime, update the CODEC to CODEC links to respect this.
--- include/sound/soc-dapm.h | 1 + sound/soc/soc-core.c | 4 ++-- sound/soc/soc-dapm.c | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-)
include/sound/soc-dapm.h +1 -0
@@ -410,6 +410,7 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm,int snd_soc_dapm_link_dai_widgets (struct snd_soc_card *card);void snd_soc_dapm_connect_dai_link_widgets (struct snd_soc_card *card); int snd_soc_dapm_new_pcm(struct snd_soc_card *card, + struct snd_soc_pcm_runtime *rtd, const struct snd_soc_pcm_stream *params, unsigned int num_params, struct snd_soc_dapm_widget *source,
sound/soc/soc-core.c +2 -2
@@ -1430,7 +1430,7 @@ static int soc_link_dai_widgets(struct snd_soc_card *card, sink = codec_dai->playback_widget; source = cpu_dai->capture_widget;if (sink && source) { - ret =snd_soc_dapm_new_pcm (card, dai_link->params, + ret =snd_soc_dapm_new_pcm (card, rtd, dai_link->params, dai_link->num_params, source, sink);if (ret !=0 ) {
@@ -1443,7 +1443,7 @@ static int soc_link_dai_widgets(struct snd_soc_card *card, sink = cpu_dai->playback_widget; source = codec_dai->capture_widget;if (sink && source) { - ret =snd_soc_dapm_new_pcm (card, dai_link->params, + ret =snd_soc_dapm_new_pcm (card, rtd, dai_link->params, dai_link->num_params, source, sink);if (ret !=0 ) {
sound/soc/soc-dapm.c +4 -0
@@ -3658,6 +3658,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, {struct snd_soc_dapm_path *source_p, *sink_p;struct snd_soc_dai *source, *sink; +struct snd_soc_pcm_runtime *rtd = w->priv;const struct snd_soc_pcm_stream *config = w->params + w->params_select;struct snd_pcm_substream substream;struct snd_pcm_hw_params *params =NULL ;
@@ -3717,6 +3718,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, goto out; } substream.runtime = runtime; + substream.private_data = rtd;switch (event) {case SND_SOC_DAPM_PRE_PMU :
@@ -3901,6 +3903,7 @@ snd_soc_dapm_alloc_kcontrol(struct snd_soc_card *card, } int snd_soc_dapm_new_pcm(struct snd_soc_card *card, + struct snd_soc_pcm_runtime *rtd, const struct snd_soc_pcm_stream *params, unsigned int num_params, struct snd_soc_dapm_widget *source,
@@ -3969,6 +3972,7 @@ int snd_soc_dapm_new_pcm(struct snd_soc_card *card, w->params = params; w->num_params = num_params; + w->priv = rtd; ret =snd_soc_dapm_add_path (&card->dapm, source, w,NULL ,NULL );if (ret)
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 2/48 ASoC: max98373: Added speaker FS gain cotnrol register to volatile.
From: Ryan Lee <[email protected]>
[ Upstream commit 0d22825255f25adb6a609f130b42c752d3fd0f5d ]
--- sound/soc/codecs/max98373.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/codecs/max98373.c +1 -0
@@ -519,6 +519,7 @@ static bool max98373_volatile_reg(struct device *dev, unsigned int reg) {switch (reg) { case MAX98373_R2000_SW_RESET ... MAX98373_R2009_INT_FLAG3: +case MAX98373_R203E_AMP_PATH_GAIN :case MAX98373_R2054_MEAS_ADC_PVDD_CH_READBACK :case MAX98373_R2055_MEAS_ADC_THERM_CH_READBACK :case MAX98373_R20B6_BDE_CUR_STATE_READBACK :
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 3/48 ASoC: rt5514: Fix the issue of the delay volume applied again
In reply to Sasha LevinFrom: Oder Chiou <[email protected]>
[ Upstream commit 6f0a256253f48095ba2e5bcdfbed41f21643c105 ]
After our evaluation, we need to modify the default values to make sure the volume applied immediately.
--- sound/soc/codecs/rt5514.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/soc/codecs/rt5514.c +4 -4
@@ -64,8 +64,8 @@ static const struct reg_sequence rt5514_patch[] = { {RT5514_ANA_CTRL_LDO10, 0x00028604}, {RT5514_ANA_CTRL_ADCFED, 0x00000800}, {RT5514_ASRC_IN_CTRL1, 0x00000003}, - {RT5514_DOWNFILTER0_CTRL3, 0x10000352}, - {RT5514_DOWNFILTER1_CTRL3, 0x10000352}, + {RT5514_DOWNFILTER0_CTRL3, 0x10000342}, + {RT5514_DOWNFILTER1_CTRL3, 0x10000342}, }; static const struct reg_default rt5514_reg[] = {
@@ -92,10 +92,10 @@ static const struct reg_default rt5514_reg[] = { {RT5514_ASRC_IN_CTRL1, 0x00000003}, {RT5514_DOWNFILTER0_CTRL1, 0x00020c2f}, {RT5514_DOWNFILTER0_CTRL2, 0x00020c2f}, - {RT5514_DOWNFILTER0_CTRL3, 0x10000352}, + {RT5514_DOWNFILTER0_CTRL3, 0x10000342}, {RT5514_DOWNFILTER1_CTRL1, 0x00020c2f}, {RT5514_DOWNFILTER1_CTRL2, 0x00020c2f}, - {RT5514_DOWNFILTER1_CTRL3, 0x10000352}, + {RT5514_DOWNFILTER1_CTRL3, 0x10000342}, {RT5514_ANA_CTRL_LDO10, 0x00028604}, {RT5514_ANA_CTRL_LDO18_16, 0x02000345}, {RT5514_ANA_CTRL_ADC12, 0x0000a2a8},
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 4/48 selftests: android: move config up a level
In reply to Sasha LevinFrom: Anders Roxell <[email protected]>
[ Upstream commit 88bc243a3f22b9938c0b53c577dee28025cdb920 ]
'make kselftest-merge' assumes that the config files for the tests are located under the 'main' test dir, like tools/testing/selftests/android/ and not in a subdir to android.
---
tools/testing/selftests/android/{ion => }/config | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename tools/testing/selftests/android/{ion => }/config (100%)tools/testing/selftests/android/config renamed from tools/testing/selftests/android/ion/config +0 -0
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 5/48 selftests: kselftest: Remove outdated comment
In reply to Sasha LevinFrom: Thiago Jung Bauermann <[email protected]>
[ Upstream commit c31d02d1290e1e82a08015199e408228e152991f ]
Commit 3c07aaef6598 ("selftests: kselftest: change KSFT_SKIP=4 instead of KSFT_PASS") reverted commit 11867a77eb85 ("selftests: kselftest framework:
change skip exit code to 0") but missed removing the comment which that commit added, so do that now.
--- tools/testing/selftests/kselftest.h | 1 - 1 file changed, 1 deletion(-)
tools/testing/selftests/kselftest.h +0 -1
@@ -19,7 +19,6 @@#define KSFT_FAIL 1#define KSFT_XFAIL 2#define KSFT_XPASS 3 -/* Treat skip as pass */ #define KSFT_SKIP 4/* counters */
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 6/48 ASoC: max98373: Added 10ms sleep after amp software reset
In reply to Sasha LevinFrom: Ryan Lee <[email protected]>
[ Upstream commit ca917f9fe1a0fab3dde41bba4bbd173c5a3c5805 ]
--- sound/soc/codecs/max98373.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/codecs/max98373.c +2 -0
@@ -729,6 +729,7 @@ static int max98373_probe(struct snd_soc_component *component)/* Software Reset */ regmap_write (max98373->regmap,MAX98373_R2000_SW_RESET ,MAX98373_SOFT_RESET ); +usleep_range (10000 ,11000 );/* IV default slot configuration */ regmap_write(max98373->regmap,
@@ -817,6 +818,7 @@ static int max98373_resume(struct device *dev)regmap_write (max98373->regmap,MAX98373_R2000_SW_RESET ,MAX98373_SOFT_RESET ); +usleep_range (10000 ,11000 );regcache_cache_only (max98373->regmap, false);regcache_sync (max98373->regmap);return 0 ;
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 7/48 ASoC: wm8804: Add ACPI support
In reply to Sasha LevinFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 960cdd50ca9fdfeb82c2757107bcb7f93c8d7d41 ]
HID made of either Wolfson/CirrusLogic PCI ID + 8804 identifier.
This helps enumerate the HifiBerry Digi+ HAT boards on the Up2 platform.
The scripts at https://github.com/thesofproject/acpi-scripts can be used to add the ACPI initrd overlays.
--- sound/soc/codecs/wm8804-i2c.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
sound/soc/codecs/wm8804-i2c.c +14 -1
@@ -13,6 +13,7 @@#include <linux/init.h> #include <linux/module.h> #include <linux/i2c.h> +#include <linux/acpi.h> #include "wm8804.h"
@@ -40,17 +41,29 @@ static const struct i2c_device_id wm8804_i2c_id[] = { };MODULE_DEVICE_TABLE (i2c, wm8804_i2c_id); +#if defined(CONFIG_OF )static const struct of_device_id wm8804_of_match[] = { { .compatible ="wlf,wm8804" , }, { } };MODULE_DEVICE_TABLE (of, wm8804_of_match); +#endif + +#ifdef CONFIG_ACPI +static const struct acpi_device_id wm8804_acpi_match[] = { + {"1AEC8804" ,0 },/* Wolfson PCI ID + part ID */ + {"10138804" ,0 },/* Cirrus Logic PCI ID + part ID */ + { }, +}; +MODULE_DEVICE_TABLE (acpi, wm8804_acpi_match); +#endif static struct i2c_driver wm8804_i2c_driver = { .driver = { .name ="wm8804" , .pm = &wm8804_pm, - .of_match_table = wm8804_of_match, + .of_match_table =of_match_ptr (wm8804_of_match), + .acpi_match_table =ACPI_PTR (wm8804_acpi_match), }, .probe = wm8804_i2c_probe, .remove = wm8804_i2c_remove,
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 8/48 ASoC: sigmadsp: safeload should not have lower byte limit
In reply to Sasha LevinFrom: Danny Smith <[email protected]>
[ Upstream commit 5ea752c6efdf5aa8a57aed816d453a8f479f1b0a ]
Fixed range in safeload conditional to allow safeload to up to 20 bytes, without a lower limit.
--- sound/soc/codecs/sigmadsp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/codecs/sigmadsp.c +1 -2
@@ -117,8 +117,7 @@ static int sigmadsp_ctrl_write(struct sigmadsp *sigmadsp, struct sigmadsp_control *ctrl, void *data) {/* safeload loads up to 20 bytes in a atomic operation */ -if (ctrl->num_bytes >4 && ctrl->num_bytes <=20 && sigmadsp->ops && - sigmadsp->ops->safeload) +if (ctrl->num_bytes <=20 && sigmadsp->ops && sigmadsp->ops->safeload)return sigmadsp->ops->safeload (sigmadsp, ctrl->addr, data, ctrl->num_bytes);else
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 9/48 ASoC: q6routing: initialize data correctly
In reply to Sasha LevinFrom: Srinivas Kandagatla <[email protected]>
[ Upstream commit 7aa09ff24301535491cd4de1b93107ee91449a12 ]
Some of the router data fields are left as default zeros which are valid dai ids, so initialize these to invalid value of -1.
Without intializing these correctly get_session_from_id() can return incorrect session resulting in not closing the opened copp and messing up with the copp ref count.
--- sound/soc/qcom/qdsp6/q6routing.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/qcom/qdsp6/q6routing.c +3 -1
@@ -933,8 +933,10 @@ static int msm_routing_probe(struct snd_soc_component *c) {int i; -for (i =0 ; i <MAX_SESSIONS ; i++) +for (i =0 ; i <MAX_SESSIONS ; i++) { routing_data->sessions[i].port_id =-1 ; + routing_data->sessions[i].fedai_id =-1 ; + }return 0 ; }
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 10/48 selftests: add headers_install to lib.mk
In reply to Sasha LevinFrom: Anders Roxell <[email protected]>
[ Upstream commit b2d35fa5fc80c27e868e393dcab4c94a0d71737f ]
If the kernel headers aren't installed we can't build all the tests. Add a new make target rule 'khdr' in the file lib.mk to generate the kernel headers and that gets include for every test-dir Makefile that includes lib.mk If the testdir in turn have its own sub-dirs the top_srcdir needs to be set to the linux-rootdir to be able to generate the kernel headers.
--- Makefile | 14 +------------- scripts/subarch.include | 13 +++++++++++++ tools/testing/selftests/android/Makefile | 2 +- tools/testing/selftests/android/ion/Makefile | 2 ++ tools/testing/selftests/futex/functional/Makefile | 1 + tools/testing/selftests/gpio/Makefile | 7 ++----- tools/testing/selftests/kvm/Makefile | 7 ++----- tools/testing/selftests/lib.mk | 12 ++++++++++++ tools/testing/selftests/net/Makefile | 1 + .../selftests/networking/timestamping/Makefile | 1 + tools/testing/selftests/vm/Makefile | 4 ---- 11 files changed, 36 insertions(+), 28 deletions(-) create mode 100644 scripts/subarch.include
Makefile +1 -13
@@ -298,19 +298,7 @@ KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION -# SUBARCH tells the usermode build what the underlying arch is. That is set -# first, and if a usermode build is happening, the "ARCH=um" on the command -# line overrides the setting of ARCH below. If a native build is happening, -# then ARCH is assigned, getting whatever value it gets normally, and -# SUBARCH is subsequently ignored. - -SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \ - -e s/sun4u/sparc64/ \ - -e s/arm.*/arm/ -e s/sa110/arm/ \ - -e s/s390x/s390/ -e s/parisc64/parisc/ \ - -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ - -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \ - -e s/riscv.*/riscv/) +include scripts/subarch.include # Cross compiling and selecting different set of gcc/bin-utils # ---------------------------------------------------------------------------
scripts/subarch.include new file +13 -0
@@ -0,0 +1,13 @@ +# SUBARCH tells the usermode build what the underlying arch is. That is set +# first, and if a usermode build is happening, the "ARCH=um" on the command +# line overrides the setting of ARCH below. If a native build is happening, +# then ARCH is assigned, getting whatever value it gets normally, and +# SUBARCH is subsequently ignored. + +SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \ + -e s/sun4u/sparc64/ \ + -e s/arm.*/arm/ -e s/sa110/arm/ \ + -e s/s390x/s390/ -e s/parisc64/parisc/ \ + -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ + -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \ + -e s/riscv.*/riscv/)
tools/testing/selftests/android/Makefile +1 -1
@@ -6,7 +6,7 @@ TEST_PROGS := run.sh include ../lib.mk -all: +all: khdr @for DIR in $(SUBDIRS); do \ BUILD_TARGET=$(OUTPUT)/$$DIR; \ mkdir $$BUILD_TARGET -p; \
tools/testing/selftests/android/ion/Makefile +2 -0
@@ -10,6 +10,8 @@ $(TEST_GEN_FILES): ipcsocket.c ionutils.c TEST_PROGS := ion_test.sh +KSFT_KHDR_INSTALL := 1 +top_srcdir = ../../../../.. include ../../lib.mk $(OUTPUT)/ionapp_export: ionapp_export.c ipcsocket.c ionutils.c
tools/testing/selftests/futex/functional/Makefile +1 -0
@@ -18,6 +18,7 @@ TEST_GEN_FILES := \ TEST_PROGS := run.sh +top_srcdir = ../../../../.. include ../../lib.mk $(TEST_GEN_FILES): $(HEADERS)
tools/testing/selftests/gpio/Makefile +2 -5
@@ -21,11 +21,8 @@ endef CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/ LDLIBS += -lmount -I/usr/include/libmount -$(BINARIES): ../../../gpio/gpio-utils.o ../../../../usr/include/linux/gpio.h +$(BINARIES):| khdr +$(BINARIES): ../../../gpio/gpio-utils.o ../../../gpio/gpio-utils.o: make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio - -../../../../usr/include/linux/gpio.h: - make -C ../../../.. headers_install INSTALL_HDR_PATH=$(shell pwd)/../../../../usr/ -
tools/testing/selftests/kvm/Makefile +2 -5
@@ -32,9 +32,6 @@ $(LIBKVM_OBJ): $(OUTPUT)/%.o: %.c $(OUTPUT)/libkvm.a: $(LIBKVM_OBJ) $(AR) crs $@ $^ -$(LINUX_HDR_PATH): - make -C $(top_srcdir) headers_install - -all: $(STATIC_LIBS) $(LINUX_HDR_PATH) +all: $(STATIC_LIBS) $(TEST_GEN_PROGS): $(STATIC_LIBS) -$(TEST_GEN_PROGS) $(LIBKVM_OBJ): | $(LINUX_HDR_PATH) +$(STATIC_LIBS):| khdr
tools/testing/selftests/lib.mk +12 -0
@@ -16,8 +16,20 @@ TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS)) TEST_GEN_PROGS_EXTENDED := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS_EXTENDED)) TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES)) +top_srcdir ?= ../../../.. +include $(top_srcdir)/scripts/subarch.include +ARCH ?= $(SUBARCH) + all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) +.PHONY: khdr +khdr: + make ARCH=$(ARCH) -C $(top_srcdir) headers_install + +ifdef KSFT_KHDR_INSTALL +$(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES):| khdr +endif + .ONESHELL: define RUN_TEST_PRINT_RESULT TEST_HDR_MSG="selftests: "`basename $$PWD`:" $$BASENAME_TEST"; \
tools/testing/selftests/net/Makefile +1 -0
@@ -15,6 +15,7 @@ TEST_GEN_FILES += udpgso udpgso_bench_tx udpgso_bench_rx TEST_GEN_PROGS = reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa TEST_GEN_PROGS += reuseport_dualstack reuseaddr_conflict +KSFT_KHDR_INSTALL := 1 include ../lib.mk $(OUTPUT)/reuseport_bpf_numa: LDFLAGS += -lnuma
tools/testing/selftests/networking/timestamping/Makefile +1 -0
@@ -5,6 +5,7 @@ TEST_PROGS := hwtstamp_config rxtimestamp timestamping txtimestamp all: $(TEST_PROGS) +top_srcdir = ../../../../.. include ../../lib.mk clean:
tools/testing/selftests/vm/Makefile +0 -4
@@ -25,10 +25,6 @@ TEST_PROGS := run_vmtests include ../lib.mk -$(OUTPUT)/userfaultfd: ../../../../usr/include/linux/kernel.h $(OUTPUT)/userfaultfd: LDLIBS += -lpthread $(OUTPUT)/mlock-random-test: LDLIBS += -lcap - -../../../../usr/include/linux/kernel.h: - make -C ../../../.. headers_install
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 11/48 selftests/efivarfs: add required kernel configs
In reply to Sasha LevinFrom: Lei Yang <[email protected]>
[ Upstream commit 53cf59d6c0ad3edc4f4449098706a8f8986258b6 ]
add config file
--- tools/testing/selftests/efivarfs/config | 1 + 1 file changed, 1 insertion(+) create mode 100644 tools/testing/selftests/efivarfs/config
tools/testing/selftests/efivarfs/config new file +1 -0
@@ -0,0 +1 @@ +CONFIG_EFIVAR_FS=y
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 12/48 selftests: memory-hotplug: add required configs
In reply to Sasha LevinFrom: Lei Yang <[email protected]>
[ Upstream commit 4d85af102a66ee6aeefa596f273169e77fb2b48e ]
add CONFIG_MEMORY_HOTREMOVE=y in config
without this config, /sys/devices/system/memory/memory*/removable always return 0, I endup getting an early skip during test
--- tools/testing/selftests/memory-hotplug/config | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/memory-hotplug/config +1 -0
@@ -2,3 +2,4 @@ CONFIG_MEMORY_HOTPLUG=y CONFIG_MEMORY_HOTPLUG_SPARSE=y CONFIG_NOTIFIER_ERROR_INJECTION=y CONFIG_MEMORY_NOTIFIER_ERROR_INJECT=m +CONFIG_MEMORY_HOTREMOVE=y
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 13/48 ASoC: rsnd: adg: care clock-frequency size
In reply to Sasha LevinFrom: Kuninori Morimoto <[email protected]>
[ Upstream commit 69235ccf491d2e26aefd465c0d3ccd1e3b2a9a9c ]
ADG has buffer over flow bug if DT has more than 3 clock-frequency. This patch fixup this issue, and uses first 2 values.
clock-frequency = <x y>; /* this is OK */
clock-frequency = <x y z>; /* this is NG */
--- sound/soc/sh/rcar/adg.c | 5 +++++ 1 file changed, 5 insertions(+)
sound/soc/sh/rcar/adg.c +5 -0
@@ -465,6 +465,11 @@ static void rsnd_adg_get_clkout(struct rsnd_priv *priv, goto rsnd_adg_get_clkout_end; req_size = prop->length /sizeof (u32); +if (req_size >REQ_SIZE ) { +dev_err (dev, +"too many clock-frequency, use top %d\n" ,REQ_SIZE ); + req_size =REQ_SIZE ; + }of_property_read_u32_array (np,"clock-frequency" , req_rate, req_size); req_48kHz_rate =0 ;
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 14/48 ASoC: rsnd: don't fallback to PIO mode when -EPROBE_DEFER
In reply to Sasha LevinFrom: Kuninori Morimoto <[email protected]>
[ Upstream commit 6c92d5a2744e27619a8fcc9d74b91ee9f1cdebd1 ]
Current rsnd driver will fallback to PIO mode if it can't get DMA handler. But, DMA might return -EPROBE_DEFER when probe timing. This driver always fallback to PIO mode especially from commit ac6bbf0cdf4206c ("iommu: Remove IOMMU_OF_DECLARE") because of this reason.
The DMA driver will be probed later, but sound driver might be probed as PIO mode in such case. This patch fixup this issue. Then, -EPROBE_DEFER is not error. Thus, let's don't indicate error message in such case.
And it needs to call rsnd_adg_remove() individually if probe failed, because it registers clk which should be unregister.
Maybe PIO fallback feature itself is not needed,
but let's keep it so far.
--- sound/soc/sh/rcar/core.c | 10 +++++++++- sound/soc/sh/rcar/dma.c | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-)
sound/soc/sh/rcar/core.c +9 -1
@@ -482,7 +482,7 @@ static int rsnd_status_update(u32 *status, (func_call && (mod)->ops->fn) ? #fn : ""); \ if (func_call && (mod)->ops->fn) \ tmp = (mod)->ops->fn(mod, io, param); \ - if (tmp) \ + if (tmp && (tmp != -EPROBE_DEFER)) \ dev_err(dev, "%s[%d] : %s error %d\n", \ rsnd_mod_name(mod), rsnd_mod_id(mod), \ #fn, tmp); \
@@ -1550,6 +1550,14 @@ static int rsnd_probe(struct platform_device *pdev)rsnd_dai_call (remove, &rdai->capture, priv); } +/* +* adg is very special mod which can't use rsnd_dai_call(remove), +* and it registers ADG clock on probe. +* It should be unregister if probe failed. +* Mainly it is assuming -EPROBE_DEFER case +*/ +rsnd_adg_remove (priv); +return ret; }
sound/soc/sh/rcar/dma.c +4 -0
@@ -244,6 +244,10 @@ static int rsnd_dmaen_attach(struct rsnd_dai_stream *io,/* try to get DMAEngine channel */ chan =rsnd_dmaen_request_channel (io, mod_from, mod_to);if (IS_ERR_OR_NULL (chan)) { +/* Let's follow when -EPROBE_DEFER case */ +if (PTR_ERR (chan) == -EPROBE_DEFER ) +return PTR_ERR (chan); +/* * DMA failed. try to PIO mode * see
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 15/48 hwmon: (nct6775) Fix access to fan pulse registers
In reply to Sasha LevinFrom: Guenter Roeck <[email protected]>
[ Upstream commit c793279c77035053e67937f5743c6ebfc303e7c5 ]
Not all fans have a fan pulse register. This can result in reading beyond the end of REG_FAN_PULSES and FAN_PULSE_SHIFT arrays, and was reported by smatch as possible error.
1672 for (i = 0; i < ARRAY_SIZE(data->rpm); i++) {
^^^^^^^^^^^^^^^^^^^^^^^^ This is a 7 element array.
...
1685 data->fan_pulses[i] =
1686 (nct6775_read_value(data, data->REG_FAN_PULSES[i])
1687 >> data->FAN_PULSE_SHIFT[i]) & 0x03;
^^^^^^^^^^^^^^^^^^^^^^^^ FAN_PULSE_SHIFT is either 5 or 6 elements.
To fix the problem, we have to ensure that all REG_FAN_PULSES and FAN_PULSE_SHIFT have the appropriate length, and that REG_FAN_PULSES is only read if the register actually exists.
--- drivers/hwmon/nct6775.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-)
drivers/hwmon/nct6775.c +16 -11
@@ -299,8 +299,9 @@ static const u16 NCT6775_REG_PWM_READ[] = {static const u16 NCT6775_REG_FAN [] = {0x630 ,0x632 ,0x634 ,0x636 ,0x638 };static const u16 NCT6775_REG_FAN_MIN [] = {0x3b ,0x3c ,0x3d }; -static const u16 NCT6775_REG_FAN_PULSES [] = {0x641 ,0x642 ,0x643 ,0x644 ,0 }; -static const u16 NCT6775_FAN_PULSE_SHIFT [] = {0 ,0 ,0 ,0 ,0 ,0 }; +static const u16 NCT6775_REG_FAN_PULSES [NUM_FAN ] = { +0x641 ,0x642 ,0x643 ,0x644 }; +static const u16 NCT6775_FAN_PULSE_SHIFT [NUM_FAN ] = { };static const u16 NCT6775_REG_TEMP [] = {0x27 ,0x150 ,0x250 ,0x62b ,0x62c ,0x62d };
@@ -425,8 +426,8 @@ static const u8 NCT6776_PWM_MODE_MASK[] = { 0x01, 0, 0, 0, 0, 0 };static const u16 NCT6776_REG_FAN_MIN [] = {0x63a ,0x63c ,0x63e ,0x640 ,0x642 ,0x64a ,0x64c }; -static const u16 NCT6776_REG_FAN_PULSES [] = { -0x644 ,0x645 ,0x646 ,0x647 ,0x648 ,0x649 ,0 }; +static const u16 NCT6776_REG_FAN_PULSES [NUM_FAN ] = { +0x644 ,0x645 ,0x646 ,0x647 ,0x648 ,0x649 };static const u16 NCT6776_REG_WEIGHT_DUTY_BASE [] = {0x13e ,0x23e ,0x33e ,0x83e ,0x93e ,0xa3e };
@@ -502,8 +503,8 @@ static const s8 NCT6779_BEEP_BITS[] = {static const u16 NCT6779_REG_FAN [] = {0x4b0 ,0x4b2 ,0x4b4 ,0x4b6 ,0x4b8 ,0x4ba ,0x660 }; -static const u16 NCT6779_REG_FAN_PULSES [] = { -0x644 ,0x645 ,0x646 ,0x647 ,0x648 ,0x649 ,0 }; +static const u16 NCT6779_REG_FAN_PULSES [NUM_FAN ] = { +0x644 ,0x645 ,0x646 ,0x647 ,0x648 ,0x649 };static const u16 NCT6779_REG_CRITICAL_PWM_ENABLE [] = {0x136 ,0x236 ,0x336 ,0x836 ,0x936 ,0xa36 ,0xb36 };
@@ -779,8 +780,8 @@ static const u16 NCT6106_REG_TEMP_CONFIG[] = {static const u16 NCT6106_REG_FAN [] = {0x20 ,0x22 ,0x24 };static const u16 NCT6106_REG_FAN_MIN [] = {0xe0 ,0xe2 ,0xe4 }; -static const u16 NCT6106_REG_FAN_PULSES [] = {0xf6 ,0xf6 ,0xf6 ,0 ,0 }; -static const u16 NCT6106_FAN_PULSE_SHIFT [] = {0 ,2 ,4 ,0 ,0 }; +static const u16 NCT6106_REG_FAN_PULSES [] = {0xf6 ,0xf6 ,0xf6 }; +static const u16 NCT6106_FAN_PULSE_SHIFT [] = {0 ,2 ,4 };static const u8 NCT6106_REG_PWM_MODE [] = {0xf3 ,0xf3 ,0xf3 };static const u8 NCT6106_PWM_MODE_MASK [] = {0x01 ,0x02 ,0x04 };
@@ -1682,9 +1683,13 @@ static struct nct6775_data *nct6775_update_device(struct device *dev)if (data->has_fan_min &BIT (i)) data->fan_min[i] =nct6775_read_value (data, data->REG_FAN_MIN[i]); - data->fan_pulses[i] = - (nct6775_read_value (data, data->REG_FAN_PULSES[i]) - >> data->FAN_PULSE_SHIFT[i]) &0x03 ; + +if (data->REG_FAN_PULSES[i]) { + data->fan_pulses[i] = + (nct6775_read_value (data, + data->REG_FAN_PULSES[i]) + >> data->FAN_PULSE_SHIFT[i]) &0x03 ; + }nct6775_select_fan_div (dev, data, i, reg); }
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 16/48 Fix cg_read_strcmp()
In reply to Sasha LevinFrom: Jay Kamat <[email protected]>
[ Upstream commit 48c2bb0b9cf863e0ed78e269f188ce65b73e0fd1 ]
Fix a couple issues with cg_read_strcmp(), to improve correctness of cgroup tests
- Fix cg_read_strcmp() always returning 0 for empty "needle" strings. Previously, this function read to a size = 1 buffer when comparing against empty strings, which would lead to cg_read_strcmp() comparing two empty strings.
- Fix a memory leak in cg_read_strcmp()
--- tools/testing/selftests/cgroup/cgroup_util.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
tools/testing/selftests/cgroup/cgroup_util.c +14 -3
@@ -89,17 +89,28 @@ int cg_read(const char *cgroup, const char *control, char *buf, size_t len)int cg_read_strcmp (const char *cgroup,const char *control,const char *expected) { -size_t size =strlen (expected) +1 ; +size_t size;char *buf; +int ret; + +/* Handle the case of comparing against empty string */ +if (!expected) + size =32 ; +else + size =strlen (expected) +1 ; buf =malloc (size);if (!buf)return -1 ; -if (cg_read (cgroup, control, buf, size)) +if (cg_read (cgroup, control, buf, size)) { +free (buf);return -1 ; + } -return strcmp (expected, buf); + ret =strcmp (expected, buf); +free (buf); +return ret; }int cg_read_strstr (const char *cgroup,const char *control,const char *needle)
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 17/48 Add tests for memory.oom.group
In reply to Sasha LevinFrom: Jay Kamat <[email protected]>
[ Upstream commit a987785dcd6c8ae2915460582aebd6481c81eb67 ]
Add tests for memory.oom.group for the following cases:
- Killing all processes in a leaf cgroup, but leaving the parent untouched
- Killing all processes in a parent and leaf cgroup
- Keeping processes marked by OOM_SCORE_ADJ_MIN alive when considered for being killed by the group oom killer.
--- tools/testing/selftests/cgroup/cgroup_util.c | 21 ++ tools/testing/selftests/cgroup/cgroup_util.h | 1 + .../selftests/cgroup/test_memcontrol.c | 205 ++++++++++++++++++ 3 files changed, 227 insertions(+)
tools/testing/selftests/cgroup/cgroup_util.c +21 -0
@@ -340,3 +340,24 @@ int is_swap_enabled(void)return cnt >1 ; } + +int set_oom_adj_score (int pid,int score) +{ +char path[PATH_MAX ]; +int fd, len; + +sprintf (path,"/proc/%d/oom_score_adj" , pid); + + fd =open (path,O_WRONLY |O_APPEND ); +if (fd <0 ) +return fd; + + len =dprintf (fd,"%d" , score); +if (len <0 ) { +close (fd); +return len; + } + +close (fd); +return 0 ; +}
tools/testing/selftests/cgroup/cgroup_util.h +1 -0
@@ -39,3 +39,4 @@ extern int get_temp_fd(void);extern int alloc_pagecache (int fd,size_t size);extern int alloc_anon (const char *cgroup,void *arg);extern int is_swap_enabled (void ); +extern int set_oom_adj_score (int pid,int score);
tools/testing/selftests/cgroup/test_memcontrol.c +205 -0
229 lines not on this page · raw message
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 18/48 ASoC: AMD: Ensure reset bit is cleared before configuring
In reply to Sasha LevinFrom: Akshu Agrawal <[email protected]>
[ Upstream commit 2a665dba016d5493c7d826fec82b0cb643b30d42 ]
HW register descriptions says:
"DMA Channel Reset...Software must confirm that this bit is cleared before reprogramming any of the channel configuration registers." There could be cases where dma stop errored out leaving dma channel in reset state. We need to ensure that before the start of another dma, channel is out of the reset state.
--- sound/soc/amd/acp-pcm-dma.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
sound/soc/amd/acp-pcm-dma.c +21 -0
@@ -16,6 +16,7 @@#include <linux/module.h> #include <linux/delay.h> #include <linux/io.h> +#include <linux/iopoll.h> #include <linux/sizes.h> #include <linux/pm_runtime.h>
@@ -184,6 +185,24 @@ static void config_dma_descriptor_in_sram(void __iomem *acp_mmio,acp_reg_write (descr_info->xfer_val, acp_mmio, mmACP_SRBM_Targ_Idx_Data); } +static void pre_config_reset (void __iomem *acp_mmio,u16 ch_num) +{ +u32 dma_ctrl; +int ret; + +/* clear the reset bit */ + dma_ctrl =acp_reg_read (acp_mmio, mmACP_DMA_CNTL_0 + ch_num); + dma_ctrl &= ~ACP_DMA_CNTL_0__DMAChRst_MASK; +acp_reg_write (dma_ctrl, acp_mmio, mmACP_DMA_CNTL_0 + ch_num); +/* check the reset bit before programming configuration registers */ + ret =readl_poll_timeout (acp_mmio + ((mmACP_DMA_CNTL_0 + ch_num) *4 ), + dma_ctrl, + !(dma_ctrl & ACP_DMA_CNTL_0__DMAChRst_MASK), +100 ,ACP_DMA_RESET_TIME ); +if (ret <0 ) +pr_err ("Failed to clear reset of channel : %d\n" , ch_num); +} +/* * Initialize the DMA descriptor information for transfer between * system memory <-> ACP SRAM
@@ -238,6 +257,7 @@ static void set_acp_sysmem_dma_descriptors(void __iomem *acp_mmio,config_dma_descriptor_in_sram (acp_mmio, dma_dscr_idx, &dmadscr[i]); } +pre_config_reset (acp_mmio, ch); config_acp_dma_channel(acp_mmio, ch, dma_dscr_idx - 1, NUM_DSCRS_PER_CHANNEL,
@@ -277,6 +297,7 @@ static void set_acp_to_i2s_dma_descriptors(void __iomem *acp_mmio, u32 size,config_dma_descriptor_in_sram (acp_mmio, dma_dscr_idx, &dmadscr[i]); } +pre_config_reset (acp_mmio, ch);/* Configure the DMA channel with the above descriptore */ config_acp_dma_channel(acp_mmio, ch, dma_dscr_idx - 1, NUM_DSCRS_PER_CHANNEL,
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 19/48 drm/pl111: Make sure of_device_id tables are NULL terminated
In reply to Sasha LevinFrom: zhong jiang <[email protected]>
[ Upstream commit 7eb33224572636248d5b6cfa1a6b2472207be5c4 ]
We prefer to of_device_id tables are NULL terminated. So make vexpress_muxfpga_match is NULL terminated.
--- drivers/gpu/drm/pl111/pl111_vexpress.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/pl111/pl111_vexpress.c +2 -1
@@ -111,7 +111,8 @@ static int vexpress_muxfpga_probe(struct platform_device *pdev) }static const struct of_device_id vexpress_muxfpga_match[] = { - { .compatible ="arm,vexpress-muxfpga" , } + { .compatible ="arm,vexpress-muxfpga" , }, + {} };static struct platform_driver vexpress_muxfpga_driver = {
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 20/48 Bluetooth: SMP: Fix trying to use non-existent local OOB data
In reply to Sasha LevinFrom: Johan Hedberg <[email protected]>
[ Upstream commit 94f14e4728125f979629b2b020d31cd718191626 ]
A remote device may claim that it has received our OOB data, even though we never geneated it. Add a new flag to track whether we actually have OOB data, and ignore the remote peer's flag if haven't generated OOB data.
--- net/bluetooth/smp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/bluetooth/smp.c +6 -2
@@ -83,6 +83,7 @@ enum {struct smp_dev {/* Secure Connections OOB data */ +bool local_oob;u8 local_pk[64 ];u8 local_rand[16 ];bool debug_key;
@@ -599,6 +600,8 @@ int smp_generate_oob(struct hci_dev *hdev, u8 hash[16], u8 rand[16])memcpy (rand, smp->local_rand,16 ); + smp->local_oob = true; +return 0 ; }
@@ -1785,7 +1788,7 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb)* successfully received our local OOB data - therefore set the * flag to indicate that local OOB is in use. */ -if (req->oob_flag ==SMP_OOB_PRESENT ) +if (req->oob_flag ==SMP_OOB_PRESENT &&SMP_DEV (hdev)->local_oob)set_bit (SMP_FLAG_LOCAL_OOB , &smp->flags);/* SMP over BR/EDR requires special treatment */
@@ -1967,7 +1970,7 @@ static u8 smp_cmd_pairing_rsp(struct l2cap_conn *conn, struct sk_buff *skb)* successfully received our local OOB data - therefore set the * flag to indicate that local OOB is in use. */ -if (rsp->oob_flag ==SMP_OOB_PRESENT ) +if (rsp->oob_flag ==SMP_OOB_PRESENT &&SMP_DEV (hdev)->local_oob)set_bit (SMP_FLAG_LOCAL_OOB , &smp->flags); smp->prsp[0 ] =SMP_CMD_PAIRING_RSP ;
@@ -3230,6 +3233,7 @@ static struct l2cap_chan *smp_add_cid(struct hci_dev *hdev, u16 cid)return ERR_CAST (tfm_ecdh); } + smp->local_oob = false; smp->tfm_aes = tfm_aes; smp->tfm_cmac = tfm_cmac; smp->tfm_ecdh = tfm_ecdh;
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 21/48 Bluetooth: Use correct tfm to generate OOB data
In reply to Sasha LevinFrom: Matias Karhumaa <[email protected]>
[ Upstream commit 4ba5175f2c10affd412fa41855cecda02b66cd71 ]
In case local OOB data was generated and other device initiated pairing claiming that it has got OOB data, following crash occurred:
[ 222.847853] general protection fault: 0000 [#1] SMP PTI [ 222.848025] CPU: 1 PID: 42 Comm: kworker/u5:0 Tainted: G C 4.18.0-custom #4 [ 222.848158] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 [ 222.848307] Workqueue: hci0 hci_rx_work [bluetooth] [ 222.848416] RIP: 0010:compute_ecdh_secret+0x5a/0x270 [bluetooth] [ 222.848540] Code: 0c af f5 48 8b 3d 46 de f0 f6 ba 40 00 00 00 be c0 00 60 00 e8 b7 7b c5 f5 48 85 c0 0f 84 ea 01 00 00 48 89 c3 e8 16 0c af f5 <49> 8b 47 38 be c0 00 60 00 8b 78 f8 48 83 c7 48 e8 51 84 c5 f5 48 [ 222.848914] RSP: 0018:ffffb1664087fbc0 EFLAGS: 00010293 [ 222.849021] RAX: ffff8a5750d7dc00 RBX: ffff8a5671096780 RCX: ffffffffc08bc32a [ 222.849111] RDX: 0000000000000000 RSI: 00000000006000c0 RDI: ffff8a5752003800 [ 222.849192] RBP: ffffb1664087fc60 R08: ffff8a57525280a0 R09: ffff8a5752003800 [ 222.849269] R10: ffffb1664087fc70 R11: 0000000000000093 R12: ffff8a5674396e00 [ 222.849350] R13: ffff8a574c2e79aa R14: ffff8a574c2e796a R15: 020e0e100d010101 [ 222.849429] FS: 0000000000000000(0000) GS:ffff8a5752500000(0000) knlGS:0000000000000000 [ 222.849518] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 222.849586] CR2: 000055856016a038 CR3: 0000000110d2c005 CR4: 00000000000606e0 [ 222.849671] Call Trace: [ 222.849745] ? sc_send_public_key+0x110/0x2a0 [bluetooth] [ 222.849825] ? sc_send_public_key+0x115/0x2a0 [bluetooth] [ 222.849925] smp_recv_cb+0x959/0x2490 [bluetooth] [ 222.850023] ? _cond_resched+0x19/0x40 [ 222.850105] ? mutex_lock+0x12/0x40 [ 222.850202] l2cap_recv_frame+0x109d/0x3420 [bluetooth] [ 222.850315] ? l2cap_recv_frame+0x109d/0x3420 [bluetooth] [ 222.850426] ? __switch_to_asm+0x34/0x70 [ 222.850515] ? __switch_to_asm+0x40/0x70 [ 222.850625] ? __switch_to_asm+0x34/0x70 [ 222.850724] ? __switch_to_asm+0x40/0x70 [ 222.850786] ? __switch_to_asm+0x34/0x70 [ 222.850846] ? __switch_to_asm+0x40/0x70 [ 222.852581] ? __switch_to_asm+0x34/0x70 [ 222.854976] ? __switch_to_asm+0x40/0x70 [ 222.857475] ? __switch_to_asm+0x40/0x70 [ 222.859775] ? __switch_to_asm+0x34/0x70 [ 222.861218] ? __switch_to_asm+0x40/0x70 [ 222.862327] ? __switch_to_asm+0x34/0x70 [ 222.863758] l2cap_recv_acldata+0x266/0x3c0 [bluetooth] [ 222.865122] hci_rx_work+0x1c9/0x430 [bluetooth] [ 222.867144] process_one_work+0x210/0x4c0 [ 222.868248] worker_thread+0x41/0x4d0 [ 222.869420] kthread+0x141/0x160 [ 222.870694] ? process_one_work+0x4c0/0x4c0 [ 222.871668] ? kthread_create_worker_on_cpu+0x90/0x90 [ 222.872896] ret_from_fork+0x35/0x40 [ 222.874132] Modules linked in: algif_hash algif_skcipher af_alg rfcomm bnep btusb btrtl btbcm btintel snd_intel8x0 cmac intel_rapl_perf vboxvideo(C) snd_ac97_codec bluetooth ac97_bus joydev ttm snd_pcm ecdh_generic drm_kms_helper snd_timer snd input_leds drm serio_raw fb_sys_fops soundcore syscopyarea sysfillrect sysimgblt mac_hid sch_fq_codel ib_iser rdma_cm iw_cm ib_cm ib_core iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi ip_tables x_tables autofs4 btrfs zstd_compress raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid1 raid0 multipath linear hid_generic usbhid hid crct10dif_pclmul crc32_pclmul ghash_clmulni_intel pcbc aesni_intel aes_x86_64 crypto_simd cryptd glue_helper ahci psmouse libahci i2c_piix4 video e1000 pata_acpi [ 222.883153] fbcon_switch: detected unhandled fb_set_par error, error code -16 [ 222.886774] fbcon_switch: detected unhandled fb_set_par error, error code -16 [ 222.890503] ---[ end trace 6504aa7a777b5316 ]--- [ 222.890541] RIP: 0010:compute_ecdh_secret+0x5a/0x270 [bluetooth] [ 222.890551] Code: 0c af f5 48 8b 3d 46 de f0 f6 ba 40 00 00 00 be c0 00 60 00 e8 b7 7b c5 f5 48 85 c0 0f 84 ea 01 00 00 48 89 c3 e8 16 0c af f5 <49> 8b 47 38 be c0 00 60 00 8b 78 f8 48 83 c7 48 e8 51 84 c5 f5 48 [ 222.890555] RSP: 0018:ffffb1664087fbc0 EFLAGS: 00010293 [ 222.890561] RAX: ffff8a5750d7dc00 RBX: ffff8a5671096780 RCX: ffffffffc08bc32a [ 222.890565] RDX: 0000000000000000 RSI: 00000000006000c0 RDI: ffff8a5752003800 [ 222.890571] RBP: ffffb1664087fc60 R08: ffff8a57525280a0 R09: ffff8a5752003800 [ 222.890576] R10: ffffb1664087fc70 R11: 0000000000000093 R12: ffff8a5674396e00 [ 222.890581] R13: ffff8a574c2e79aa R14: ffff8a574c2e796a R15: 020e0e100d010101 [ 222.890586] FS: 0000000000000000(0000) GS:ffff8a5752500000(0000) knlGS:0000000000000000 [ 222.890591] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 222.890594] CR2: 000055856016a038 CR3: 0000000110d2c005 CR4: 00000000000606e0
This commit fixes a bug where invalid pointer to crypto tfm was used for SMP SC ECDH calculation when OOB was in use. Solution is to use same crypto tfm than when generating OOB material on generate_oob() function.
This bug was introduced in commit c0153b0b901a ("Bluetooth: let the crypto subsystem generate the ecc privkey"). Bug was found by fuzzing kernel SMP implementation using Synopsys Defensics.
--- net/bluetooth/smp.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
net/bluetooth/smp.c +7 -1
@@ -2700,7 +2700,13 @@ static int smp_cmd_public_key(struct l2cap_conn *conn, struct sk_buff *skb)* key was set/generated. */ if (test_bit (SMP_FLAG_LOCAL_OOB , &smp->flags)) { -struct smp_dev *smp_dev = chan->data; +struct l2cap_chan *hchan = hdev->smp_data; +struct smp_dev *smp_dev; + +if (!hchan || !hchan->data) +return SMP_UNSPECIFIED ; + + smp_dev = hchan->data; tfm_ecdh = smp_dev->tfm_ecdh; }else {
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 22/48 Bluetooth: hci_ldisc: Free rw_semaphore on close
In reply to Sasha LevinFrom: Hermes Zhang <[email protected]>
[ Upstream commit e6a57d22f787e73635ce0d29eef0abb77928b3e9 ]
The percpu_rw_semaphore is not currently freed, and this leads to a crash when the stale rcu callback is invoked. DEBUG_OBJECTS detects this.
ODEBUG: free active (active state 1) object type: rcu_head hint: (null)
------------[ cut here ]------------ WARNING: CPU: 1 PID: 2024 at debug_print_object+0xac/0xc8 PC is at debug_print_object+0xac/0xc8 LR is at debug_print_object+0xac/0xc8 Call trace: [<ffffff80082e2c2c>] debug_print_object+0xac/0xc8 [<ffffff80082e40b0>] debug_check_no_obj_freed+0x1e8/0x228 [<ffffff8008191254>] kfree+0x1cc/0x250 [<ffffff80083cc03c>] hci_uart_tty_close+0x54/0x108 [<ffffff800832e118>] tty_ldisc_close.isra.1+0x40/0x58 [<ffffff800832e14c>] tty_ldisc_kill+0x1c/0x40 [<ffffff800832e3dc>] tty_ldisc_release+0x94/0x170 [<ffffff8008325554>] tty_release_struct+0x1c/0x58 [<ffffff8008326400>] tty_release+0x3b0/0x490 [<ffffff80081a3fe8>] __fput+0x88/0x1d0 [<ffffff80081a418c>] ____fput+0xc/0x18 [<ffffff80080c0624>] task_work_run+0x9c/0xc0 [<ffffff80080a9e24>] do_exit+0x24c/0x8a0 [<ffffff80080aa4e0>] do_group_exit+0x38/0xa0 [<ffffff80080aa558>] __wake_up_parent+0x0/0x28 [<ffffff8008082c00>] el0_svc_naked+0x34/0x38 ---[ end trace bfe08cbd89098cdf ]---
--- drivers/bluetooth/hci_ldisc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/bluetooth/hci_ldisc.c +2 -0
@@ -543,6 +543,8 @@ static void hci_uart_tty_close(struct tty_struct *tty) }clear_bit (HCI_UART_PROTO_SET , &hu->flags); +percpu_free_rwsem (&hu->proto_lock); +kfree (hu); }
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 23/48 mfd: omap-usb-host: Fix dts probe of children
In reply to Sasha LevinFrom: Tony Lindgren <[email protected]>
[ Upstream commit 10492ee8ed9188d6d420e1f79b2b9bdbc0624e65 ]
It currently only works if the parent bus uses "simple-bus". We currently try to probe children with non-existing compatible values. And we're missing .probe.
I noticed this while testing devices configured to probe using ti-sysc interconnect target module driver. For that we also may want to rebind the driver, so let's remove __init and __exit.
--- drivers/mfd/omap-usb-host.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/mfd/omap-usb-host.c +6 -5
@@ -528,8 +528,8 @@ static int usbhs_omap_get_dt_pdata(struct device *dev, }static const struct of_device_id usbhs_child_match_table[] = { - { .compatible ="ti,omap-ehci" , }, - { .compatible ="ti,omap-ohci" , }, + { .compatible ="ti,ehci-omap" , }, + { .compatible ="ti,ohci-omap3" , }, { } };
@@ -855,6 +855,7 @@ static struct platform_driver usbhs_omap_driver = { .pm = &usbhsomap_dev_pm_ops, .of_match_table = usbhs_omap_dt_ids, }, + .probe = usbhs_omap_probe, .remove = usbhs_omap_remove, };
@@ -864,9 +865,9 @@ MODULE_ALIAS("platform:" USBHS_DRIVER_NAME);MODULE_LICENSE ("GPL v2" );MODULE_DESCRIPTION ("usb host common core driver for omap EHCI and OHCI" ); -static int __init omap_usbhs_drvinit (void ) +static int omap_usbhs_drvinit (void ) { -return platform_driver_probe (&usbhs_omap_driver, usbhs_omap_probe); +return platform_driver_register (&usbhs_omap_driver); }/*
@@ -878,7 +879,7 @@ static int __init omap_usbhs_drvinit(void)*/ fs_initcall_sync (omap_usbhs_drvinit); -static void __exit omap_usbhs_drvexit(void) +static void omap_usbhs_drvexit (void ) {platform_driver_unregister (&usbhs_omap_driver); }
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 24/48 KVM: PPC: Book3S HV: Don't use compound_order to determine host mapping size
In reply to Sasha LevinFrom: Nicholas Piggin <[email protected]>
[ Upstream commit 71d29f43b6332badc5598c656616a62575e83342 ]
THP paths can defer splitting compound pages until after the actual remap and TLB flushes to split a huge PMD/PUD. This causes radix partition scope page table mappings to get out of synch with the host qemu page table mappings.
This results in random memory corruption in the guest when running with THP. The easiest way to reproduce is use KVM balloon to free up a lot of memory in the guest and then shrink the balloon to give the memory back, while some work is being done in the guest.
--- arch/powerpc/kvm/book3s_64_mmu_radix.c | 91 +++++++++++--------------- 1 file changed, 37 insertions(+), 54 deletions(-)
arch/powerpc/kvm/book3s_64_mmu_radix.c +37 -54
@@ -538,8 +538,8 @@ int kvmppc_book3s_radix_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu, unsigned long ea, unsigned long dsisr) {struct kvm *kvm = vcpu->kvm; -unsigned long mmu_seq, pte_size; -unsigned long gpa, gfn, hva, pfn; +unsigned long mmu_seq; +unsigned long gpa, gfn, hva;struct kvm_memory_slot *memslot;struct page *page =NULL ;long ret;
@@ -636,9 +636,10 @@ int kvmppc_book3s_radix_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,*/ hva =gfn_to_hva_memslot (memslot, gfn);if (upgrade_p &&__get_user_pages_fast (hva,1 ,1 , &page) =1 ) { - pfn =page_to_pfn (page); upgrade_write = true; }else { +unsigned long pfn; +/* Call KVM generic code to do the slow-path check */ pfn =__gfn_to_pfn_memslot (memslot, gfn, false,NULL , writing, upgrade_p);
@@ -652,63 +653,45 @@ int kvmppc_book3s_radix_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu, } } -/* See if we can insert a 1GB or 2MB large PTE here */ - level =0 ; -if (page &&PageCompound (page)) { - pte_size =PAGE_SIZE <<compound_order (compound_head (page)); -if (pte_size >=PUD_SIZE && - (gpa & (PUD_SIZE -PAGE_SIZE )) = - (hva & (PUD_SIZE -PAGE_SIZE ))) { - level =2 ; - pfn &= ~((PUD_SIZE >>PAGE_SHIFT ) -1 ); - }else if (pte_size >=PMD_SIZE && - (gpa & (PMD_SIZE -PAGE_SIZE )) = - (hva & (PMD_SIZE -PAGE_SIZE ))) { - level =1 ; - pfn &= ~((PMD_SIZE >>PAGE_SHIFT ) -1 ); - } - } -/* -* Compute the PTE value that we need to insert. +* Read the PTE from the process' radix tree and use that +* so we get the shift and attribute bits. */ -if (page) { - pgflags = _PAGE_READ | _PAGE_EXEC | _PAGE_PRESENT | _PAGE_PTE | - _PAGE_ACCESSED; -if (writing || upgrade_write) - pgflags |= _PAGE_WRITE | _PAGE_DIRTY; - pte =pfn_pte (pfn,__pgprot (pgflags)); +local_irq_disable (); + ptep =__find_linux_pte (vcpu->arch.pgdir, hva,NULL , &shift); + pte = *ptep; +local_irq_enable (); + +/* Get pte level from shift/size */ +if (shift =PUD_SHIFT && + (gpa & (PUD_SIZE -PAGE_SIZE )) = + (hva & (PUD_SIZE -PAGE_SIZE ))) { + level =2 ; + }else if (shift =PMD_SHIFT && + (gpa & (PMD_SIZE -PAGE_SIZE )) = + (hva & (PMD_SIZE -PAGE_SIZE ))) { + level =1 ; }else { -/* -* Read the PTE from the process' radix tree and use that -* so we get the attribute bits. -*/ -local_irq_disable (); - ptep =__find_linux_pte (vcpu->arch.pgdir, hva,NULL , &shift); - pte = *ptep; -local_irq_enable (); -if (shift =PUD_SHIFT && - (gpa & (PUD_SIZE -PAGE_SIZE )) = - (hva & (PUD_SIZE -PAGE_SIZE ))) { - level =2 ; - }else if (shift =PMD_SHIFT && - (gpa & (PMD_SIZE -PAGE_SIZE )) = - (hva & (PMD_SIZE -PAGE_SIZE ))) { - level =1 ; - }else if (shift && shift !=PAGE_SHIFT ) { -/* Adjust PFN */ -unsigned long mask = (1ul << shift) -PAGE_SIZE ; - pte =__pte (pte_val (pte) | (hva & mask)); - } - pte =__pte (pte_val (pte) | _PAGE_EXEC | _PAGE_ACCESSED); -if (writing || upgrade_write) { -if (pte_val (pte) & _PAGE_WRITE) - pte =__pte (pte_val (pte) | _PAGE_DIRTY); - }else { - pte =__pte (pte_val (pte) & ~(_PAGE_WRITE | _PAGE_DIRTY)); + level =0 ; +if (shift >PAGE_SHIFT ) { +/* +* If the pte maps more than one page, bring over +* bits from the virtual address to get the real +* address of the specific single page we want. +*/ +unsigned long rpnmask = (1ul << shift) -PAGE_SIZE ; + pte =__pte (pte_val (pte) | (hva & rpnmask)); } } + pte =__pte (pte_val (pte) | _PAGE_EXEC | _PAGE_ACCESSED); +if (writing || upgrade_write) { +if (pte_val (pte) & _PAGE_WRITE) + pte =__pte (pte_val (pte) | _PAGE_DIRTY); + }else { + pte =__pte (pte_val (pte) & ~(_PAGE_WRITE | _PAGE_DIRTY)); + } +/* Allocate space in the tree and write the PTE */ ret =kvmppc_create_pte (kvm, pte, gpa, level, mmu_seq);
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 25/48 scsi: iscsi: target: Don't use stack buffer for scatterlist
In reply to Sasha LevinFrom: Laura Abbott <[email protected]>
[ Upstream commit 679fcae46c8b2352bba3485d521da070cfbe68e6 ]
Fedora got a bug report of a crash with iSCSI:
kernel BUG at include/linux/scatterlist.h:143!
...
RIP: 0010:iscsit_do_crypto_hash_buf+0x154/0x180 [iscsi_target_mod] ... Call Trace: ? iscsi_target_tx_thread+0x200/0x200 [iscsi_target_mod] iscsit_get_rx_pdu+0x4cd/0xa90 [iscsi_target_mod] ? native_sched_clock+0x3e/0xa0 ? iscsi_target_tx_thread+0x200/0x200 [iscsi_target_mod] iscsi_target_rx_thread+0x81/0xf0 [iscsi_target_mod] kthread+0x120/0x140 ? kthread_create_worker_on_cpu+0x70/0x70 ret_from_fork+0x3a/0x50
This is a BUG_ON for using a stack buffer with a scatterlist. There are two cases that trigger this bug. Switch to using a dynamically allocated buffer for one case and do not assign a NULL buffer in another case.
--- drivers/target/iscsi/iscsi_target.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
drivers/target/iscsi/iscsi_target.c +14 -8
@@ -1419,7 +1419,8 @@ static void iscsit_do_crypto_hash_buf(struct ahash_request *hash,sg_init_table (sg,ARRAY_SIZE (sg));sg_set_buf (sg, buf, payload_length); -sg_set_buf (sg +1 , pad_bytes, padding); +if (padding) +sg_set_buf (sg +1 , pad_bytes, padding);ahash_request_set_crypt (hash, sg, data_crc, payload_length + padding);
@@ -3913,10 +3914,14 @@ static bool iscsi_target_check_conn_state(struct iscsi_conn *conn)static void iscsit_get_rx_pdu (struct iscsi_conn *conn) {int ret; -u8 buffer[ISCSI_HDR_LEN ], opcode; +u8 *buffer, opcode;u32 checksum =0 , digest =0 ;struct kvec iov; + buffer =kcalloc (ISCSI_HDR_LEN ,sizeof (*buffer),GFP_KERNEL ); +if (!buffer) +return ; +while (!kthread_should_stop ()) {/* * Ensure that both TX and RX per connection kthreads
@@ -3924,7 +3929,6 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn)*/ iscsit_thread_check_cpumask (conn, current,0 ); -memset (buffer,0 ,ISCSI_HDR_LEN );memset (&iov,0 ,sizeof (struct kvec )); iov.iov_base = buffer;
@@ -3933,7 +3937,7 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn) ret =rx_data (conn, &iov,1 ,ISCSI_HDR_LEN );if (ret !=ISCSI_HDR_LEN ) {iscsit_rx_thread_wait_for_tcp (conn); -return ; +break ; }if (conn->conn_ops->HeaderDigest) {
@@ -3943,7 +3947,7 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn) ret =rx_data (conn, &iov,1 ,ISCSI_CRC_LEN );if (ret !=ISCSI_CRC_LEN ) {iscsit_rx_thread_wait_for_tcp (conn); -return ; +break ; } iscsit_do_crypto_hash_buf(conn->conn_rx_hash, buffer,
@@ -3967,7 +3971,7 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn) }if (conn->conn_state ==TARG_CONN_STATE_IN_LOGOUT ) -return ; +break ; opcode = buffer[0 ] &ISCSI_OPCODE_MASK ;
@@ -3978,13 +3982,15 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *conn) " while in Discovery Session, rejecting.\n", opcode);iscsit_add_reject (conn,ISCSI_REASON_PROTOCOL_ERROR , buffer); -return ; +break ; } ret =iscsi_target_rx_opcode (conn, buffer);if (ret <0 ) -return ; +break ; } + +kfree (buffer); }int iscsi_target_rx_thread (void *arg)
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 26/48 scsi: qla2xxx: Fix an endian bug in fcpcmd_is_corrupted()
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit cbe3fd39d223f14b1c60c80fe9347a3dd08c2edb ]
We should first do the le16_to_cpu endian conversion and then apply the FCP_CMD_LENGTH_MASK mask.
--- drivers/scsi/qla2xxx/qla_target.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_target.h +2 -2
@@ -374,8 +374,8 @@ struct atio_from_isp {static inline int fcpcmd_is_corrupted (struct atio *atio) {if (atio->entry_type ==ATIO_TYPE7 && - (le16_to_cpu (atio->attr_n_length &FCP_CMD_LENGTH_MASK ) < -FCP_CMD_LENGTH_MIN )) + ((le16_to_cpu (atio->attr_n_length) &FCP_CMD_LENGTH_MASK ) < +FCP_CMD_LENGTH_MIN ))return 1 ;else return 0 ;
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 27/48 sound: enable interrupt after dma buffer initialization
In reply to Sasha LevinFrom: Yu Zhao <[email protected]>
[ Upstream commit b61749a89f826eb61fc59794d9e4697bd246eb61 ]
In snd_hdac_bus_init_chip(), we enable interrupt before snd_hdac_bus_init_cmd_io() initializing dma buffers. If irq has been acquired and irq handler uses the dma buffer, kernel may crash when interrupt comes in.
Fix the problem by postponing enabling irq after dma buffer initialization. And warn once on null dma buffer pointer during the initialization.
--- sound/hda/hdac_controller.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/hda/hdac_controller.c +6 -2
@@ -40,6 +40,8 @@ static void azx_clear_corbrp(struct hdac_bus *bus)*/ void snd_hdac_bus_init_cmd_io (struct hdac_bus *bus) { +WARN_ON_ONCE (!bus->rb.area); +spin_lock_irq (&bus->reg_lock);/* CORB set up */ bus->corb.addr = bus->rb.addr;
@@ -479,13 +481,15 @@ bool snd_hdac_bus_init_chip(struct hdac_bus *bus, bool full_reset)/* reset controller */ azx_reset (bus, full_reset); -/* initialize interrupts */ +/* clear interrupts */ azx_int_clear (bus); -azx_int_enable (bus);/* initialize the codec command I/O */ snd_hdac_bus_init_cmd_io (bus); +/* enable interrupts after CORB/RIRB buffers are initialized above */ +azx_int_enable (bus); +/* program the position buffer */ if (bus->use_posbuf && bus->posbuf.addr) {snd_hdac_chip_writel (bus,DPLBASE , (u32 )bus->posbuf.addr);
Signature · 1 line
2.17.1
Re: [PATCH AUTOSEL 4.18 27/48] sound: enable interrupt after dma buffer initialization
Quoted 8 lines · Sasha Levin
From: Yu Zhao <[email protected]>
[ Upstream commit
b61749a89f826eb61fc59794d9e4697bd246eb61]In
snd_hdac_bus_init_chip(), we enable interrupt beforesnd_hdac_bus_init_cmd_io()initializing dma buffers. If irq has been acquired and irq handler uses the dma buffer, kernel may crash when interrupt comes in.
CCing Takashi who's the maintainer here for review.
Quoted 47 lines
Fix the problem by postponing enabling irq after dma buffer initialization. And warn once on null dma buffer pointer during the initialization.
Reviewed-by Takashi Iwai <[email protected]>Signed-off-by Yu Zhao <[email protected]>Signed-off-by Mark Brown <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- sound/hda/hdac_controller.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)sound/hda/hdac_controller.c +6
-2@@ -40,6 +40,8 @@ static void azx_clear_corbrp(struct hdac_bus *bus)*/ void snd_hdac_bus_init_cmd_io (struct hdac_bus *bus) { +WARN_ON_ONCE (!bus->rb.area); +spin_lock_irq (&bus->reg_lock);/* CORB set up */ bus->corb.addr = bus->rb.addr;@@ -479,13 +481,15 @@ bool snd_hdac_bus_init_chip(struct hdac_bus *bus, bool full_reset)/* reset controller */ azx_reset (bus, full_reset); -/* initialize interrupts */ +/* clear interrupts */ azx_int_clear (bus); -azx_int_enable (bus);/* initialize the codec command I/O */ snd_hdac_bus_init_cmd_io (bus); +/* enable interrupts after CORB/RIRB buffers are initialized above */ +azx_int_enable (bus); +/* program the position buffer */ if (bus->use_posbuf && bus->posbuf.addr) {snd_hdac_chip_writel (bus,DPLBASE , (u32 )bus->posbuf.addr);Signature · 1 line
2.17.1
Re: [PATCH AUTOSEL 4.18 27/48] sound: enable interrupt after dma buffer initialization
Quoted 4 lines · Mark Brown
Quoted 2 lines · Sasha Levin
From: Yu Zhao <[email protected]>
Quoted 8 lines
Quoted 6 lines
[ Upstream commit
b61749a89f826eb61fc59794d9e4697bd246eb61]In
snd_hdac_bus_init_chip(), we enable interrupt beforesnd_hdac_bus_init_cmd_io()initializing dma buffers. If irq has been acquired and irq handler uses the dma buffer, kernel may crash when interrupt comes in.CCing Takashi who's the maintainer here for review.
This is OK to take as a stable. This shouldn't break, at least.
thanks,
Takashi
Quoted 49 lines
Quoted 47 lines
Fix the problem by postponing enabling irq after dma buffer initialization. And warn once on null dma buffer pointer during the initialization.
Reviewed-by Takashi Iwai <[email protected]>Signed-off-by Yu Zhao <[email protected]>Signed-off-by Mark Brown <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- sound/hda/hdac_controller.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)sound/hda/hdac_controller.c +6
-2@@ -40,6 +40,8 @@ static void azx_clear_corbrp(struct hdac_bus *bus)*/ void snd_hdac_bus_init_cmd_io (struct hdac_bus *bus) { +WARN_ON_ONCE (!bus->rb.area); +spin_lock_irq (&bus->reg_lock);/* CORB set up */ bus->corb.addr = bus->rb.addr;@@ -479,13 +481,15 @@ bool snd_hdac_bus_init_chip(struct hdac_bus *bus, bool full_reset)/* reset controller */ azx_reset (bus, full_reset); -/* initialize interrupts */ +/* clear interrupts */ azx_int_clear (bus); -azx_int_enable (bus);/* initialize the codec command I/O */ snd_hdac_bus_init_cmd_io (bus); +/* enable interrupts after CORB/RIRB buffers are initialized above */ +azx_int_enable (bus); +/* program the position buffer */ if (bus->use_posbuf && bus->posbuf.addr) {snd_hdac_chip_writel (bus,DPLBASE , (u32 )bus->posbuf.addr);Signature · 1 line
2.17.1[2 signature.asc <application/pgp-signature (7bit)>]
Sasha Levin
maintainerPATCH 28/48 sound: don't call skl_init_chip() to reset intel skl soc
In reply to Sasha LevinFrom: Yu Zhao <[email protected]>
[ Upstream commit 75383f8d39d4c0fb96083dd460b7b139fbdac492 ]
Internally, skl_init_chip() calls snd_hdac_bus_init_chip() which
1) sets bus->chip_init to prevent multiple entrances before device is stopped; 2) enables interrupt.
We shouldn't use it for the purpose of resetting device only because
1) when we really want to initialize device, we won't be able to do so; 2) we are ready to handle interrupt yet, and kernel crashes when interrupt comes in.
Rename azx_reset() to snd_hdac_bus_reset_link(), and use it to reset device properly.
--- include/sound/hdaudio.h | 1 + sound/hda/hdac_controller.c | 7 ++++--- sound/soc/intel/skylake/skl.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-)
include/sound/hdaudio.h +1 -0
@@ -355,6 +355,7 @@ void snd_hdac_bus_init_cmd_io(struct hdac_bus *bus);void snd_hdac_bus_stop_cmd_io (struct hdac_bus *bus);void snd_hdac_bus_enter_link_reset (struct hdac_bus *bus);void snd_hdac_bus_exit_link_reset (struct hdac_bus *bus); +int snd_hdac_bus_reset_link (struct hdac_bus *bus,bool full_reset);void snd_hdac_bus_update_rirb (struct hdac_bus *bus); int snd_hdac_bus_handle_stream_irq(struct hdac_bus *bus, unsigned int status,
sound/hda/hdac_controller.c +4 -3
@@ -385,7 +385,7 @@ void snd_hdac_bus_exit_link_reset(struct hdac_bus *bus)EXPORT_SYMBOL_GPL (snd_hdac_bus_exit_link_reset);/* reset codec link */ -static int azx_reset (struct hdac_bus *bus,bool full_reset) +int snd_hdac_bus_reset_link (struct hdac_bus *bus,bool full_reset) {if (!full_reset) goto skip_reset;
@@ -410,7 +410,7 @@ static int azx_reset(struct hdac_bus *bus, bool full_reset) skip_reset:/* check to see if controller is ready */ if (!snd_hdac_chip_readb (bus,GCTL )) { -dev_dbg (bus->dev,"azx_reset: controller not ready!\n" ); +dev_dbg (bus->dev,"controller not ready!\n" );return -EBUSY ; }
@@ -425,6 +425,7 @@ static int azx_reset(struct hdac_bus *bus, bool full_reset)return 0 ; } +EXPORT_SYMBOL_GPL (snd_hdac_bus_reset_link);/* enable interrupts */ static void azx_int_enable (struct hdac_bus *bus)
@@ -479,7 +480,7 @@ bool snd_hdac_bus_init_chip(struct hdac_bus *bus, bool full_reset)return false;/* reset controller */ -azx_reset (bus, full_reset); +snd_hdac_bus_reset_link (bus, full_reset);/* clear interrupts */ azx_int_clear (bus);
sound/soc/intel/skylake/skl.c +1 -1
@@ -844,7 +844,7 @@ static int skl_first_init(struct hdac_ext_bus *ebus)return -ENXIO ; } -skl_init_chip (bus, true); +snd_hdac_bus_reset_link (bus, true);snd_hdac_bus_parse_capabilities (bus);
Signature · 1 line
2.17.1
Re: [PATCH AUTOSEL 4.18 28/48] sound: don't call skl_init_chip() to reset intel skl soc
Quoted 7 lines · Sasha Levin
From: Yu Zhao <[email protected]>
[ Upstream commit
75383f8d39d4c0fb96083dd460b7b139fbdac492]Internally,
skl_init_chip()callssnd_hdac_bus_init_chip()which
1) setsbus->chip_initto prevent multiple entrances before device is stopped; 2) enables interrupt.
And here.
Quoted 87 lines
We shouldn't use it for the purpose of resetting device only because
1) when we really want to initialize device, we won't be able to do so; 2) we are ready to handle interrupt yet, and kernel crashes when interrupt comes in.Rename
azx_reset()tosnd_hdac_bus_reset_link(), and use it to reset device properly.Fixes 60767abcea3d ("ASoC: Intel: Skylake: Reset the controller in probe")Reviewed-by Takashi Iwai <[email protected]>Signed-off-by Yu Zhao <[email protected]>Signed-off-by Mark Brown <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- include/sound/hdaudio.h | 1 + sound/hda/hdac_controller.c | 7 ++++--- sound/soc/intel/skylake/skl.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-)include/sound/hdaudio.h +1
-0@@ -355,6 +355,7 @@ void snd_hdac_bus_init_cmd_io(struct hdac_bus *bus);void snd_hdac_bus_stop_cmd_io (struct hdac_bus *bus);void snd_hdac_bus_enter_link_reset (struct hdac_bus *bus);void snd_hdac_bus_exit_link_reset (struct hdac_bus *bus); +int snd_hdac_bus_reset_link (struct hdac_bus *bus,bool full_reset);void snd_hdac_bus_update_rirb (struct hdac_bus *bus); int snd_hdac_bus_handle_stream_irq(struct hdac_bus *bus, unsigned int status,sound/hda/hdac_controller.c +4
-3@@ -385,7 +385,7 @@ void snd_hdac_bus_exit_link_reset(struct hdac_bus *bus)EXPORT_SYMBOL_GPL (snd_hdac_bus_exit_link_reset);/* reset codec link */ -static int azx_reset (struct hdac_bus *bus,bool full_reset) +int snd_hdac_bus_reset_link (struct hdac_bus *bus,bool full_reset) {if (!full_reset) goto skip_reset;@@ -410,7 +410,7 @@ static int azx_reset(struct hdac_bus *bus, bool full_reset) skip_reset:/* check to see if controller is ready */ if (!snd_hdac_chip_readb (bus,GCTL )) { -dev_dbg (bus->dev,"azx_reset: controller not ready!\n" ); +dev_dbg (bus->dev,"controller not ready!\n" );return -EBUSY ; }@@ -425,6 +425,7 @@ static int azx_reset(struct hdac_bus *bus, bool full_reset)return 0 ; } +EXPORT_SYMBOL_GPL (snd_hdac_bus_reset_link);/* enable interrupts */ static void azx_int_enable (struct hdac_bus *bus)@@ -479,7 +480,7 @@ bool snd_hdac_bus_init_chip(struct hdac_bus *bus, bool full_reset)return false;/* reset controller */ -azx_reset (bus, full_reset); +snd_hdac_bus_reset_link (bus, full_reset);/* clear interrupts */ azx_int_clear (bus);sound/soc/intel/skylake/skl.c +1
-1@@ -844,7 +844,7 @@ static int skl_first_init(struct hdac_ext_bus *ebus)return -ENXIO ; } -skl_init_chip (bus, true); +snd_hdac_bus_reset_link (bus, true);snd_hdac_bus_parse_capabilities (bus);Signature · 1 line
2.17.1
Re: [PATCH AUTOSEL 4.18 28/48] sound: don't call skl_init_chip() to reset intel skl soc
Quoted 11 lines · Mark Brown
Quoted 7 lines · Sasha Levin
From: Yu Zhao <[email protected]>
[ Upstream commit
75383f8d39d4c0fb96083dd460b7b139fbdac492]Internally,
skl_init_chip()callssnd_hdac_bus_init_chip()which
1) setsbus->chip_initto prevent multiple entrances before device is stopped; 2) enables interrupt.And here.
This one should be OK as a stable fix, too.
thanks,
Takashi
Quoted 89 lines
Quoted 87 lines
We shouldn't use it for the purpose of resetting device only because
1) when we really want to initialize device, we won't be able to do so; 2) we are ready to handle interrupt yet, and kernel crashes when interrupt comes in.Rename
azx_reset()tosnd_hdac_bus_reset_link(), and use it to reset device properly.Fixes 60767abcea3d ("ASoC: Intel: Skylake: Reset the controller in probe")Reviewed-by Takashi Iwai <[email protected]>Signed-off-by Yu Zhao <[email protected]>Signed-off-by Mark Brown <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- include/sound/hdaudio.h | 1 + sound/hda/hdac_controller.c | 7 ++++--- sound/soc/intel/skylake/skl.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-)include/sound/hdaudio.h +1
-0@@ -355,6 +355,7 @@ void snd_hdac_bus_init_cmd_io(struct hdac_bus *bus);void snd_hdac_bus_stop_cmd_io (struct hdac_bus *bus);void snd_hdac_bus_enter_link_reset (struct hdac_bus *bus);void snd_hdac_bus_exit_link_reset (struct hdac_bus *bus); +int snd_hdac_bus_reset_link (struct hdac_bus *bus,bool full_reset);void snd_hdac_bus_update_rirb (struct hdac_bus *bus); int snd_hdac_bus_handle_stream_irq(struct hdac_bus *bus, unsigned int status,sound/hda/hdac_controller.c +4
-3@@ -385,7 +385,7 @@ void snd_hdac_bus_exit_link_reset(struct hdac_bus *bus)EXPORT_SYMBOL_GPL (snd_hdac_bus_exit_link_reset);/* reset codec link */ -static int azx_reset (struct hdac_bus *bus,bool full_reset) +int snd_hdac_bus_reset_link (struct hdac_bus *bus,bool full_reset) {if (!full_reset) goto skip_reset;@@ -410,7 +410,7 @@ static int azx_reset(struct hdac_bus *bus, bool full_reset) skip_reset:/* check to see if controller is ready */ if (!snd_hdac_chip_readb (bus,GCTL )) { -dev_dbg (bus->dev,"azx_reset: controller not ready!\n" ); +dev_dbg (bus->dev,"controller not ready!\n" );return -EBUSY ; }@@ -425,6 +425,7 @@ static int azx_reset(struct hdac_bus *bus, bool full_reset)return 0 ; } +EXPORT_SYMBOL_GPL (snd_hdac_bus_reset_link);/* enable interrupts */ static void azx_int_enable (struct hdac_bus *bus)@@ -479,7 +480,7 @@ bool snd_hdac_bus_init_chip(struct hdac_bus *bus, bool full_reset)return false;/* reset controller */ -azx_reset (bus, full_reset); +snd_hdac_bus_reset_link (bus, full_reset);/* clear interrupts */ azx_int_clear (bus);sound/soc/intel/skylake/skl.c +1
-1@@ -844,7 +844,7 @@ static int skl_first_init(struct hdac_ext_bus *ebus)return -ENXIO ; } -skl_init_chip (bus, true); +snd_hdac_bus_reset_link (bus, true);snd_hdac_bus_parse_capabilities (bus);Signature · 1 line
2.17.1[2 signature.asc <application/pgp-signature (7bit)>]
Sasha Levin
maintainerPATCH 29/48 bpf: btf: Fix end boundary calculation for type section
In reply to Sasha LevinFrom: Martin KaFai Lau <[email protected]>
[ Upstream commit 4b1c5d917d34f705096bb7dd8a2bd19b0881970e ]
The end boundary math for type section is incorrect in btf_check_all_metas(). It just happens that hdr->type_off is always 0 for now because there are only two sections (type and string) and string section must be at the end (ensured in btf_parse_str_sec).
However, type_off may not be 0 if a new section would be added later. This patch fixes it.
--- kernel/bpf/btf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/btf.c +1 -1
@@ -1844,7 +1844,7 @@ static int btf_check_all_metas(struct btf_verifier_env *env) hdr = &btf->hdr; cur = btf->nohdr_data + hdr->type_off; - end = btf->nohdr_data + hdr->type_len; + end = cur + hdr->type_len; env->log_type_id =1 ;while (cur < end) {
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 30/48 bpf: use __GFP_COMP while allocating page
In reply to Sasha LevinFrom: Tushar Dave <[email protected]>
[ Upstream commit 4c3d795cb012a378855543a775408fba1ccff6f2 ]
Helper bpg_msg_pull_data() can allocate multiple pages while linearizing multiple scatterlist elements into one shared page. However, if the shared page has size > PAGE_SIZE, using copy_page_to_iter() causes below warning.
e.g.
[ 6367.019832] WARNING: CPU: 2 PID: 7410 at lib/iov_iter.c:825
page_copy_sane.part.8+0x0/0x8
To avoid above warning, use __GFP_COMP while allocating multiple contiguous pages.
--- net/core/filter.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/core/filter.c +2 -1
@@ -2328,7 +2328,8 @@ BPF_CALL_4(bpf_msg_pull_data,if (unlikely (copy < end - start))return -EINVAL ; - page =alloc_pages (__GFP_NOWARN |GFP_ATOMIC ,get_order (copy)); + page =alloc_pages (__GFP_NOWARN |GFP_ATOMIC | __GFP_COMP, +get_order (copy));if (unlikely (!page))return -ENOMEM ; p =page_address (page);
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 31/48 hwmon: (nct6775) Fix virtual temperature sources for NCT6796D
In reply to Sasha LevinFrom: Guenter Roeck <[email protected]>
[ Upstream commit 37196ba4ae95a2077d78715eb12e879e57613d43 ]
The following kernel log message is reported for the nct6775 driver on ASUS WS X299 SAGE.
nct6775: Found NCT6796D or compatible chip at 0x2e:0x290 nct6775 nct6775.656: Invalid temperature source 11 at index 0,
source register 0x100, temp register 0x73 nct6775 nct6775.656: Invalid temperature source 11 at index 2, source register 0x300, temp register 0x77 nct6775 nct6775.656: Invalid temperature source 11 at index 3, source register 0x800, temp register 0x79 nct6775 nct6775.656: Invalid temperature source 11 at index 4, source register 0x900, temp register 0x7b
A recent version of the datasheet lists temperature source 11 as reserved. However, an older version of the datasheet lists temperature sources 10 and 11 as supported virtual temperature sources. Apparently the older version of the datasheet is correct, so list those temperature sources as supported.
Virtual temperature sources are different than other temperature sources:
Values are not read from a temperature sensor, but written either from BIOS or an embedded controller. As such, each virtual temperature has to be reported. Since there is now more than one temperature source, we have to keep virtual temperature sources in a chip-specific mask and can no longer rely on the assumption that there is only one virtual temperature source with a fixed index. This accounts for most of the complexity of this patch.
--- drivers/hwmon/nct6775.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-)
drivers/hwmon/nct6775.c +22 -6
@@ -207,8 +207,6 @@ superio_exit(int ioreg)#define NUM_FAN 7 -#define TEMP_SOURCE_VIRTUAL 0x1f -/* Common and NCT6775 specific data */ /* Voltage min/max registers for nr=7..14 are in bank 5 */
@@ -374,6 +372,7 @@ static const char *const nct6775_temp_label[] = { };#define NCT6775_TEMP_MASK 0x001ffffe +#define NCT6775_VIRT_TEMP_MASK 0x00000000static const u16 NCT6775_REG_TEMP_ALTERNATE [32 ] = { [13 ] =0x661 ,
@@ -462,6 +461,7 @@ static const char *const nct6776_temp_label[] = { };#define NCT6776_TEMP_MASK 0x007ffffe +#define NCT6776_VIRT_TEMP_MASK 0x00000000static const u16 NCT6776_REG_TEMP_ALTERNATE [32 ] = { [14 ] =0x401 ,
@@ -560,7 +560,9 @@ static const char *const nct6779_temp_label[] = { };#define NCT6779_TEMP_MASK 0x07ffff7e +#define NCT6779_VIRT_TEMP_MASK 0x00000000#define NCT6791_TEMP_MASK 0x87ffff7e +#define NCT6791_VIRT_TEMP_MASK 0x80000000static const u16 NCT6779_REG_TEMP_ALTERNATE [32 ] = {0x490 ,0x491 ,0x492 ,0x493 ,0x494 ,0x495 ,0 ,0 ,
@@ -639,6 +641,7 @@ static const char *const nct6792_temp_label[] = { };#define NCT6792_TEMP_MASK 0x9fffff7e +#define NCT6792_VIRT_TEMP_MASK 0x80000000static const char *const nct6793_temp_label[] = {"" ,
@@ -676,6 +679,7 @@ static const char *const nct6793_temp_label[] = { };#define NCT6793_TEMP_MASK 0xbfff037e +#define NCT6793_VIRT_TEMP_MASK 0x80000000static const char *const nct6795_temp_label[] = {"" ,
@@ -713,6 +717,7 @@ static const char *const nct6795_temp_label[] = { };#define NCT6795_TEMP_MASK 0xbfffff7e +#define NCT6795_VIRT_TEMP_MASK 0x80000000static const char *const nct6796_temp_label[] = {"" ,
@@ -725,8 +730,8 @@ static const char *const nct6796_temp_label[] = {"AUXTIN4" ,"SMBUSMASTER 0" ,"SMBUSMASTER 1" , -"" , -"" , +"Virtual_TEMP" , +"Virtual_TEMP" ,"" ,"" , "",
@@ -749,7 +754,8 @@ static const char *const nct6796_temp_label[] = { "Virtual_TEMP" }; -#define NCT6796_TEMP_MASK 0xbfff03fe +#define NCT6796_TEMP_MASK 0xbfff0ffe +#define NCT6796_VIRT_TEMP_MASK 0x80000c00/* NCT6102D/NCT6106D specific data */
@@ -970,6 +976,7 @@ struct nct6775_data {u16 reg_temp_config[NUM_TEMP ];const char *const *temp_label;u32 temp_mask; +u32 virt_temp_mask;u16 REG_CONFIG ;u16 REG_VBAT ;
@@ -3644,6 +3651,7 @@ static int nct6775_probe(struct platform_device *pdev) data->temp_label = nct6776_temp_label; data->temp_mask =NCT6776_TEMP_MASK ; + data->virt_temp_mask =NCT6776_VIRT_TEMP_MASK ; data->REG_VBAT =NCT6106_REG_VBAT ; data->REG_DIODE =NCT6106_REG_DIODE ;
@@ -3722,6 +3730,7 @@ static int nct6775_probe(struct platform_device *pdev) data->temp_label = nct6775_temp_label; data->temp_mask =NCT6775_TEMP_MASK ; + data->virt_temp_mask =NCT6775_VIRT_TEMP_MASK ; data->REG_CONFIG =NCT6775_REG_CONFIG ; data->REG_VBAT =NCT6775_REG_VBAT ;
@@ -3794,6 +3803,7 @@ static int nct6775_probe(struct platform_device *pdev) data->temp_label = nct6776_temp_label; data->temp_mask =NCT6776_TEMP_MASK ; + data->virt_temp_mask =NCT6776_VIRT_TEMP_MASK ; data->REG_CONFIG =NCT6775_REG_CONFIG ; data->REG_VBAT =NCT6775_REG_VBAT ;
@@ -3866,6 +3876,7 @@ static int nct6775_probe(struct platform_device *pdev) data->temp_label = nct6779_temp_label; data->temp_mask =NCT6779_TEMP_MASK ; + data->virt_temp_mask =NCT6779_VIRT_TEMP_MASK ; data->REG_CONFIG =NCT6775_REG_CONFIG ; data->REG_VBAT =NCT6775_REG_VBAT ;
@@ -3949,22 +3960,27 @@ static int nct6775_probe(struct platform_device *pdev)case nct6791: data->temp_label = nct6779_temp_label; data->temp_mask =NCT6791_TEMP_MASK ; + data->virt_temp_mask =NCT6791_VIRT_TEMP_MASK ;break ;case nct6792: data->temp_label = nct6792_temp_label; data->temp_mask =NCT6792_TEMP_MASK ; + data->virt_temp_mask =NCT6792_VIRT_TEMP_MASK ;break ;case nct6793: data->temp_label = nct6793_temp_label; data->temp_mask =NCT6793_TEMP_MASK ; + data->virt_temp_mask =NCT6793_VIRT_TEMP_MASK ;break ;case nct6795: data->temp_label = nct6795_temp_label; data->temp_mask =NCT6795_TEMP_MASK ; + data->virt_temp_mask =NCT6795_VIRT_TEMP_MASK ;break ;case nct6796: data->temp_label = nct6796_temp_label; data->temp_mask =NCT6796_TEMP_MASK ; + data->virt_temp_mask =NCT6796_VIRT_TEMP_MASK ;break ; }
@@ -4148,7 +4164,7 @@ static int nct6775_probe(struct platform_device *pdev)* for each fan reflects a different temperature, and there * are no duplicates. */ -if (src !=TEMP_SOURCE_VIRTUAL ) { +if (!(data->virt_temp_mask &BIT (src))) {if (mask &BIT (src))continue ; mask |=BIT (src);
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 32/48 hwmon: (nct6775) Fix RPM output for fan7 on NCT6796D
In reply to Sasha LevinFrom: Guenter Roeck <[email protected]>
[ Upstream commit f6de298806d9cbc63a4907bca34a06162b9d7dce ]
fan7 on NCT6796D does not have a fan count register; it only has an RPM register. Switch to using RPM registers to read the fan speed for all chips supporting it to solve the problem for good.
--- drivers/hwmon/nct6775.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/hwmon/nct6775.c +9 -4
@@ -502,7 +502,7 @@ static const s8 NCT6779_BEEP_BITS[] = { 30, 31 }; /* intrusion0, intrusion1 */static const u16 NCT6779_REG_FAN [] = { -0x4b0 ,0x4b2 ,0x4b4 ,0x4b6 ,0x4b8 ,0x4ba ,0x660 }; +0x4c0 ,0x4c2 ,0x4c4 ,0x4c6 ,0x4c8 ,0x4ca ,0x660 };static const u16 NCT6779_REG_FAN_PULSES [NUM_FAN ] = {0x644 ,0x645 ,0x646 ,0x647 ,0x648 ,0x649 };
@@ -924,6 +924,11 @@ static unsigned int fan_from_reg16(u16 reg, unsigned int divreg)return 1350000U / (reg << divreg); } +static unsigned int fan_from_reg_rpm (u16 reg,unsigned int divreg) +{ +return reg; +} +static u16 fan_to_reg (u32 fan,unsigned int divreg) {if (!fan)
@@ -1284,7 +1289,7 @@ static bool is_word_sized(struct nct6775_data *data, u16 reg)case nct6795:case nct6796:return reg ==0x150 || reg ==0x153 || reg ==0x155 || - ((reg &0xfff0 ) ==0x4b0 && (reg &0x000f ) <0x0b ) || + (reg &0xfff0 ) ==0x4c0 || reg ==0x402 || reg ==0x63a || reg ==0x63c || reg ==0x63e || reg == 0x640 || reg == 0x642 || reg == 0x64a ||
@@ -3868,7 +3873,7 @@ static int nct6775_probe(struct platform_device *pdev) data->ALARM_BITS =NCT6779_ALARM_BITS ; data->BEEP_BITS =NCT6779_BEEP_BITS ; - data->fan_from_reg = fan_from_reg13; + data->fan_from_reg = fan_from_reg_rpm; data->fan_from_reg_min = fan_from_reg13; data->target_temp_mask =0xff ; data->tolerance_mask =0x07 ;
@@ -3949,7 +3954,7 @@ static int nct6775_probe(struct platform_device *pdev) data->ALARM_BITS =NCT6791_ALARM_BITS ; data->BEEP_BITS =NCT6779_BEEP_BITS ; - data->fan_from_reg = fan_from_reg13; + data->fan_from_reg = fan_from_reg_rpm; data->fan_from_reg_min = fan_from_reg13; data->target_temp_mask =0xff ; data->tolerance_mask =0x07 ;
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 33/48 stmmac: fix valid numbers of unicast filter entries
In reply to Sasha LevinFrom: Jongsung Kim <[email protected]>
[ Upstream commit edf2ef7242805e53ec2e0841db26e06d8bc7da70 ]
Synopsys DWC Ethernet MAC can be configured to have 1..32, 64, or 128 unicast filter entries. (Table 7-8 MAC Address Registers from databook) Fix dwmac1000_validate_ucast_entries() to accept values between 1 and 32 in addition.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +2 -3
@@ -67,7 +67,7 @@ static int dwmac1000_validate_mcast_bins(int mcast_bins)* Description: * This function validates the number of Unicast address entries supported * by a particular Synopsys 10/100/1000 controller. The Synopsys controller -* supports 1, 32, 64, or 128 Unicast filter entries for it's Unicast filter +* supports 1..32, 64, or 128 Unicast filter entries for it's Unicast filter * logic. This function validates a valid, supported configuration is * selected, and defaults to 1 Unicast address if an unsupported * configuration is selected.
@@ -77,8 +77,7 @@ static int dwmac1000_validate_ucast_entries(int ucast_entries)int x = ucast_entries;switch (x) { -case 1 : -case 32 : + case 1 ... 32:case 64 :case 128 :break ;
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 34/48 hwmon: (nct6775) Use different register to get fan RPM for fan7
In reply to Sasha LevinFrom: Guenter Roeck <[email protected]>
[ Upstream commit 55066354285b36ee09dc50e2527f43a97c567177 ]
The documented register to retrieve the fan RPM for fan7 is found to be unreliable at least with NCT6796D revision 3. Let's use register 0x4ce instead. This is undocumented for NCT6796D, but documented for NCT6797D and NCT6798D and known to be working.
--- drivers/hwmon/nct6775.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hwmon/nct6775.c +2 -2
@@ -502,7 +502,7 @@ static const s8 NCT6779_BEEP_BITS[] = { 30, 31 }; /* intrusion0, intrusion1 */static const u16 NCT6779_REG_FAN [] = { -0x4c0 ,0x4c2 ,0x4c4 ,0x4c6 ,0x4c8 ,0x4ca ,0x660 }; +0x4c0 ,0x4c2 ,0x4c4 ,0x4c6 ,0x4c8 ,0x4ca ,0x4ce };static const u16 NCT6779_REG_FAN_PULSES [NUM_FAN ] = {0x644 ,0x645 ,0x646 ,0x647 ,0x648 ,0x649 };
@@ -1293,7 +1293,7 @@ static bool is_word_sized(struct nct6775_data *data, u16 reg) reg ==0x402 || reg ==0x63a || reg ==0x63c || reg ==0x63e || reg ==0x640 || reg ==0x642 || reg ==0x64a || - reg ==0x64c || reg ==0x660 || + reg ==0x64c || reg ==0x73 || reg ==0x75 || reg ==0x77 || reg ==0x79 || reg ==0x7b || reg ==0x7d ; }
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 35/48 net: ethernet: ti: add missing GENERIC_ALLOCATOR dependency
In reply to Sasha LevinFrom: Corentin Labbe <[email protected]>
[ Upstream commit f025571e96caa95ffc3c1792f762a584893de582 ]
This patch mades TI_DAVINCI_CPDMA select GENERIC_ALLOCATOR. without that, the following sparc64 build failure happen
drivers/net/ethernet/ti/davinci_cpdma.o: In function `cpdma_check_free_tx_desc':
(.text+0x278): undefined reference to gen_pool_avail' drivers/net/ethernet/ti/davinci_cpdma.o: In function cpdma_chan_submit':
(.text+0x340): undefined reference to `gen_pool_alloc'
(.text+0x5c4): undefined reference to gen_pool_free' drivers/net/ethernet/ti/davinci_cpdma.o: In function __cpdma_chan_free':
davinci_cpdma.c:(.text+0x64c): undefined reference to gen_pool_free' drivers/net/ethernet/ti/davinci_cpdma.o: In function cpdma_desc_pool_destroy.isra.6':
davinci_cpdma.c:(.text+0x17ac): undefined reference to gen_pool_size' davinci_cpdma.c:(.text+0x17b8): undefined reference to gen_pool_avail' davinci_cpdma.c:(.text+0x1824): undefined reference to gen_pool_size' davinci_cpdma.c:(.text+0x1830): undefined reference to gen_pool_avail' drivers/net/ethernet/ti/davinci_cpdma.o: In function `cpdma_ctlr_create':
(.text+0x19f8): undefined reference to devm_gen_pool_create' (.text+0x1a90): undefined reference to gen_pool_add_virt' Makefile:1011: recipe for target 'vmlinux' failed
--- drivers/net/ethernet/ti/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/ti/Kconfig +1 -0
@@ -41,6 +41,7 @@ config TI_DAVINCI_MDIO config TI_DAVINCI_CPDMA tristate "TI DaVinci CPDMA Support" depends on ARCH_DAVINCI || ARCH_OMAP2PLUS || COMPILE_TEST + select GENERIC_ALLOCATOR ---help--- This driver supports TI's DaVinci CPDMA dma engine.
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 36/48 net: macb: disable scatter-gather for macb on sama5d3
In reply to Sasha LevinFrom: Nicolas Ferre <[email protected]>
[ Upstream commit eb4ed8e2d7fecb5f40db38e4498b9ee23cddf196 ]
Create a new configuration for the sama5d3-macb new compatibility string. This configuration disables scatter-gather because we experienced lock down of the macb interface of this particular SoC under very high load.
--- drivers/net/ethernet/cadence/macb_main.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/ethernet/cadence/macb_main.c +8 -0
@@ -3765,6 +3765,13 @@ static const struct macb_config at91sam9260_config = { .init = macb_init, }; +static const struct macb_config sama5d3macb_config = { + .caps =MACB_CAPS_SG_DISABLED + |MACB_CAPS_USRIO_HAS_CLKEN |MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII , + .clk_init = macb_clk_init, + .init = macb_init, +}; +static const struct macb_config pc302gem_config = { .caps =MACB_CAPS_SG_DISABLED |MACB_CAPS_GIGABIT_MODE_AVAILABLE , .dma_burst_length =16 ,
@@ -3832,6 +3839,7 @@ static const struct of_device_id macb_dt_ids[] = { { .compatible = "cdns,gem", .data = &pc302gem_config }, { .compatible = "atmel,sama5d2-gem", .data = &sama5d2_config }, { .compatible = "atmel,sama5d3-gem", .data = &sama5d3_config }, + { .compatible = "atmel,sama5d3-macb", .data = &sama5d3macb_config }, { .compatible = "atmel,sama5d4-gem", .data = &sama5d4_config }, { .compatible = "cdns,at91rm9200-emac", .data = &emac_config }, { .compatible = "cdns,emac", .data = &emac_config },
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 37/48 ARM: dts: at91: add new compatibility string for macb on sama5d3
In reply to Sasha LevinFrom: Nicolas Ferre <[email protected]>
[ Upstream commit 321cc359d899a8e988f3725d87c18a628e1cc624 ]
We need this new compatibility string as we experienced different behavior for this 10/100Mbits/s macb interface on this particular SoC. Backward compatibility is preserved as we keep the alternative strings.
--- Documentation/devicetree/bindings/net/macb.txt | 1 + arch/arm/boot/dts/sama5d3_emac.dtsi | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/net/macb.txt +1 -0
@@ -10,6 +10,7 @@ Required properties: Use "cdns,pc302-gem" for Picochip picoXcell pc302 and later devices based on the Cadence GEM, or the generic form: "cdns,gem". Use "atmel,sama5d2-gem" for the GEM IP (10/100) available on Atmel sama5d2 SoCs. + Use "atmel,sama5d3-macb" for the 10/100Mbit IP available on Atmel sama5d3 SoCs. Use "atmel,sama5d3-gem" for the Gigabit IP available on Atmel sama5d3 SoCs. Use "atmel,sama5d4-gem" for the GEM IP (10/100) available on Atmel sama5d4 SoCs. Use "cdns,zynq-gem" Xilinx Zynq-7xxx SoC.
arch/arm/boot/dts/sama5d3_emac.dtsi +1 -1
@@ -41,7 +41,7 @@ }; macb1: ethernet@f802c000 { - compatible = "cdns,at91sam9260-macb", "cdns,macb"; + compatible = "atmel,sama5d3-macb", "cdns,at91sam9260-macb", "cdns,macb"; reg = <0xf802c000 0x100>; interrupts = <35 IRQ_TYPE_LEVEL_HIGH 3>; pinctrl-names = "default";
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 38/48 PCI: hv: support reporting serial number as slot information
In reply to Sasha LevinFrom: Stephen Hemminger <[email protected]>
[ Upstream commit a15f2c08c70811f120d99288d81f70d7f3d104f1 ]
The Hyper-V host API for PCI provides a unique "serial number" which can be used as basis for sysfs PCI slot table. This can be useful for cases where userspace wants to find the PCI device based on serial number.
When an SR-IOV NIC is added, the host sends an attach message with serial number. The kernel doesn't use the serial number, but it is useful when doing the same thing in a userspace driver such as the DPDK. By having /sys/bus/pci/slots/N it provides a direct way to find the matching PCI device.
There maybe some cases where serial number is not unique such as when using GPU's. But the PCI slot infrastructure will handle that.
This has a side effect which may also be useful. The common udev network device naming policy uses the slot information (rather than PCI address).
--- drivers/pci/controller/pci-hyperv.c | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
drivers/pci/controller/pci-hyperv.c +37 -0
@@ -89,6 +89,9 @@ static enum pci_protocol_version_t pci_protocol_version;#define STATUS_REVISION_MISMATCH 0xC0000059 +/* space for 32bit serial number as string */ +#define SLOT_NAME_SIZE 11 +/* * Message Types */
@@ -494,6 +497,7 @@ struct hv_pci_dev {struct list_head list_entry;refcount_t refs;enum hv_pcichild_state state; +struct pci_slot *pci_slot;struct pci_function_description desc;bool reported_missing;struct hv_pcibus_device *hbus;
@@ -1457,6 +1461,34 @@ static void prepopulate_bars(struct hv_pcibus_device *hbus)spin_unlock_irqrestore (&hbus->device_list_lock, flags); } +/* +* Assign entries in sysfs pci slot directory. +* +* Note that this function does not need to lock the children list +* because it is called from pci_devices_present_work which +* is serialized with hv_eject_device_work because they are on the +* same ordered workqueue. Therefore hbus->children list will not change +* even when pci_create_slot sleeps. +*/ +static void hv_pci_assign_slots (struct hv_pcibus_device *hbus) +{ +struct hv_pci_dev *hpdev; +char name[SLOT_NAME_SIZE ]; +int slot_nr; + +list_for_each_entry (hpdev, &hbus->children, list_entry) { +if (hpdev->pci_slot) +continue ; + + slot_nr =PCI_SLOT (wslot_to_devfn (hpdev->desc.win_slot.slot)); +snprintf (name,SLOT_NAME_SIZE ,"%u" , hpdev->desc.ser); + hpdev->pci_slot =pci_create_slot (hbus->pci_bus, slot_nr, + name,NULL ); +if (!hpdev->pci_slot) +pr_warn ("pci_create slot %s failed\n" , name); + } +} +/** * create_root_hv_pci_bus() - Expose a new root PCI bus * @hbus: Root PCI bus, as understood by this driver
@@ -1480,6 +1512,7 @@ static int create_root_hv_pci_bus(struct hv_pcibus_device *hbus)pci_lock_rescan_remove ();pci_scan_child_bus (hbus->pci_bus);pci_bus_assign_resources (hbus->pci_bus); +hv_pci_assign_slots (hbus);pci_bus_add_devices (hbus->pci_bus);pci_unlock_rescan_remove (); hbus->state = hv_pcibus_installed;
@@ -1742,6 +1775,7 @@ static void pci_devices_present_work(struct work_struct *work)*/ pci_lock_rescan_remove ();pci_scan_child_bus (hbus->pci_bus); +hv_pci_assign_slots (hbus);pci_unlock_rescan_remove ();break ;
@@ -1858,6 +1892,9 @@ static void hv_eject_device_work(struct work_struct *work)list_del (&hpdev->list_entry);spin_unlock_irqrestore (&hpdev->hbus->device_list_lock, flags); +if (hpdev->pci_slot) +pci_destroy_slot (hpdev->pci_slot); +memset (&ctxt,0 ,sizeof (ctxt)); ejct_pkt = (struct pci_eject_response *)&ctxt.pkt.message; ejct_pkt->message_type.type =PCI_EJECTION_COMPLETE ;
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 39/48 hv_netvsc: pair VF based on serial number
In reply to Sasha LevinFrom: Stephen Hemminger <[email protected]>
[ Upstream commit 00d7ddba1143623b31bc2c15d18216e2da031b14 ]
Matching network device based on MAC address is problematic since a non VF network device can be creted with a duplicate MAC address causing confusion and problems. The VMBus API does provide a serial number that is a better matching method.
--- drivers/net/hyperv/netvsc.c | 3 ++ drivers/net/hyperv/netvsc_drv.c | 58 +++++++++++++++++++-------------- 2 files changed, 36 insertions(+), 25 deletions(-)
drivers/net/hyperv/netvsc.c +3 -0
@@ -1203,6 +1203,9 @@ static void netvsc_send_vf(struct net_device *ndev, net_device_ctx->vf_alloc = nvmsg->msg.v4_msg.vf_assoc.allocated; net_device_ctx->vf_serial = nvmsg->msg.v4_msg.vf_assoc.serial; +netdev_info (ndev,"VF slot %u %s\n" , + net_device_ctx->vf_serial, + net_device_ctx->vf_alloc ?"added" :"removed" ); } static void netvsc_receive_inband(struct net_device *ndev,
drivers/net/hyperv/netvsc_drv.c +33 -25
79 lines not on this page · raw message
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 40/48 clk: x86: add "ether_clk" alias for Bay Trail / Cherry Trail
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit b1e3454d39f992e5409cd19f97782185950df6e7 ]
Commit d31fd43c0f9a ("clk: x86: Do not gate clocks enabled by the firmware") causes all unclaimed PMC clocks on Cherry Trail devices to be on all the time, resulting on the device not being able to reach S0i2 or S0i3 when suspended.
The reason for this commit is that on some Bay Trail / Cherry Trail devices the ethernet controller uses pmc_plt_clk_4. This commit adds an "ether_clk" alias, so that the relevant ethernet drivers can try to (optionally) use this, without needing X86 specific code / hacks, thus fixing ethernet on these devices without breaking S0i3 support.
This commit uses clkdev_hw_create() to create the alias, mirroring the code for the already existing "mclk" alias for pmc_plt_clk_3.
--- drivers/clk/x86/clk-pmc-atom.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/clk/x86/clk-pmc-atom.c +11 -0
@@ -55,6 +55,7 @@ struct clk_plt_data {u8 nparents;struct clk_plt *clks[PMC_CLK_NUM ];struct clk_lookup *mclk_lookup; +struct clk_lookup *ether_clk_lookup; };/* Return an index in parent table */
@@ -351,11 +352,20 @@ static int plt_clk_probe(struct platform_device *pdev) goto err_unreg_clk_plt; } + data->ether_clk_lookup =clkdev_hw_create (&data->clks[4 ]->hw, +"ether_clk" ,NULL ); +if (!data->ether_clk_lookup) { + err = -ENOMEM ; + goto err_drop_mclk; + } +plt_clk_free_parent_names_loop (parent_names, data->nparents);platform_set_drvdata (pdev, data);return 0 ; +err_drop_mclk: +clkdev_drop (data->mclk_lookup); err_unreg_clk_plt:plt_clk_unregister_loop (data, i);plt_clk_unregister_parents (data);
@@ -369,6 +379,7 @@ static int plt_clk_remove(struct platform_device *pdev) data =platform_get_drvdata (pdev); +clkdev_drop (data->ether_clk_lookup);clkdev_drop (data->mclk_lookup);plt_clk_unregister_loop (data,PMC_CLK_NUM );plt_clk_unregister_parents (data);
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 41/48 clk: x86: Stop marking clocks as CLK_IS_CRITICAL
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 648e921888ad96ea3dc922739e96716ad3225d7f ]
Commit d31fd43c0f9a ("clk: x86: Do not gate clocks enabled by the firmware"), which added the code to mark clocks as CLK_IS_CRITICAL, causes all unclaimed PMC clocks on Cherry Trail devices to be on all the time, resulting on the device not being able to reach S0i3 when suspended.
The reason for this commit is that on some Bay Trail / Cherry Trail devices the r8169 ethernet controller uses pmc_plt_clk_4. Now that the clk-pmc-atom driver exports an "ether_clk" alias for pmc_plt_clk_4 and the r8169 driver has been modified to get and enable this clock (if present) the marking of the clocks as CLK_IS_CRITICAL is no longer necessary.
This commit removes the CLK_IS_CRITICAL marking, fixing Cherry Trail devices not being able to reach S0i3 greatly decreasing their battery drain when suspended.
--- drivers/clk/x86/clk-pmc-atom.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/clk/x86/clk-pmc-atom.c +0 -7
@@ -187,13 +187,6 @@ static struct clk_plt *plt_clk_register(struct platform_device *pdev, int id, pclk->reg = base +PMC_CLK_CTL_OFFSET + id *PMC_CLK_CTL_SIZE ;spin_lock_init (&pclk->lock); -/* -* If the clock was already enabled by the firmware mark it as critical -* to avoid it being gated by the clock framework if no driver owns it. -*/ -if (plt_clk_is_enabled (&pclk->hw)) - init.flags |=CLK_IS_CRITICAL ; - ret =devm_clk_hw_register (&pdev->dev, &pclk->hw);if (ret) { pclk =ERR_PTR (ret);
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 42/48 pinctrl: cannonlake: Fix gpio base for GPP-E
In reply to Sasha LevinFrom: Simon Detheridge <[email protected]>
[ Upstream commit 8e2aac333785f91ff74e219a1e78e6bdc1ef2c41 ]
The gpio base for GPP-E was set incorrectly to 258 instead of 256, preventing the touchpad working on my Tong Fang GK5CN5Z laptop.
--- drivers/pinctrl/intel/pinctrl-cannonlake.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/intel/pinctrl-cannonlake.c +1 -1
@@ -382,7 +382,7 @@ static const struct intel_padgroup cnlh_community1_gpps[] = {static const struct intel_padgroup cnlh_community3_gpps[] = {CNL_GPP (0 ,155 ,178 ,192 ),/* GPP_K */ CNL_GPP (1 ,179 ,202 ,224 ),/* GPP_H */ -CNL_GPP (2 ,203 ,215 ,258 ),/* GPP_E */ +CNL_GPP (2 ,203 ,215 ,256 ),/* GPP_E */ CNL_GPP (3 ,216 ,239 ,288 ),/* GPP_F */ CNL_GPP (4 ,240 ,248 ,CNL_NO_GPIO ),/* SPI */ };
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 43/48 x86/kvm/lapic: always disable MMIO interface in x2APIC mode
In reply to Sasha LevinFrom: Vitaly Kuznetsov <[email protected]>
[ Upstream commit d1766202779e81d0f2a94c4650a6ba31497d369d ]
When VMX is used with flexpriority disabled (because of no support or if disabled with module parameter) MMIO interface to lAPIC is still available in x2APIC mode while it shouldn't be (kvm-unit-tests):
PASS: apic_disable: Local apic enabled in x2APIC mode
PASS: apic_disable: CPUID.1H:EDX.APIC[bit 9] is set
FAIL: apic_disable: *0xfee00030: 50014
The issue appears because we basically do nothing while switching to x2APIC mode when APIC access page is not used. apic_mmio_{read,write} only check if lAPIC is disabled before proceeding to actual write.
When APIC access is virtualized we correctly manipulate with VMX controls in vmx_set_virtual_apic_mode() and we don't get vmexits from memory writes in x2APIC mode so there's no issue.
Disabling MMIO interface seems to be easy. The question is: what do we do with these reads and writes? If we add apic_x2apic_mode() check to apic_mmio_in_range() and return -EOPNOTSUPP these reads and writes will go to userspace. When lAPIC is in kernel, Qemu uses this interface to inject MSIs only (see kvm_apic_mem_write() in hw/i386/kvm/apic.c). This somehow works with disabled lAPIC but when we're in xAPIC mode we will get a real injected MSI from every write to lAPIC. Not good.
The simplest solution seems to be to just ignore writes to the region and return ~0 for all reads when we're in x2APIC mode. This is what this patch does. However, this approach is inconsistent with what currently happens when flexpriority is enabled: we allocate APIC access page and create KVM memory region so in x2APIC modes all reads and writes go to this pre-allocated page which is, btw, the same for all vCPUs.
--- arch/x86/include/uapi/asm/kvm.h | 1 + arch/x86/kvm/lapic.c | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-)
arch/x86/include/uapi/asm/kvm.h +1 -0
@@ -377,5 +377,6 @@ struct kvm_sync_regs {#define KVM_X86_QUIRK_LINT0_REENABLED (1 << 0)#define KVM_X86_QUIRK_CD_NW_CLEARED (1 << 1) +#define KVM_X86_QUIRK_LAPIC_MMIO_HOLE (1 << 2)#endif /* _ASM_X86_KVM_H */
arch/x86/kvm/lapic.c +19 -3
@@ -1291,9 +1291,8 @@ EXPORT_SYMBOL_GPL(kvm_lapic_reg_read);static int apic_mmio_in_range (struct kvm_lapic *apic,gpa_t addr) { -return kvm_apic_hw_enabled (apic) && - addr >= apic->base_address && - addr < apic->base_address +LAPIC_MMIO_LENGTH ; +return addr >= apic->base_address && + addr < apic->base_address +LAPIC_MMIO_LENGTH ; } static int apic_mmio_read(struct kvm_vcpu *vcpu, struct kvm_io_device *this,
@@ -1305,6 +1304,15 @@ static int apic_mmio_read(struct kvm_vcpu *vcpu, struct kvm_io_device *this,if (!apic_mmio_in_range (apic, address))return -EOPNOTSUPP ; +if (!kvm_apic_hw_enabled (apic) ||apic_x2apic_mode (apic)) { +if (!kvm_check_has_quirk (vcpu->kvm, +KVM_X86_QUIRK_LAPIC_MMIO_HOLE )) +return -EOPNOTSUPP ; + +memset (data,0xff , len); +return 0 ; + } +kvm_lapic_reg_read (apic, offset, len, data);return 0 ;
@@ -1864,6 +1872,14 @@ static int apic_mmio_write(struct kvm_vcpu *vcpu, struct kvm_io_device *this,if (!apic_mmio_in_range (apic, address))return -EOPNOTSUPP ; +if (!kvm_apic_hw_enabled (apic) ||apic_x2apic_mode (apic)) { +if (!kvm_check_has_quirk (vcpu->kvm, +KVM_X86_QUIRK_LAPIC_MMIO_HOLE )) +return -EOPNOTSUPP ; + +return 0 ; + } +/* * APIC register must be aligned on 128-bits boundary. * 32/64/128 bits registers must be accessed thru 32 bits.
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 44/48 drm/amdgpu: Fix SDMA HQD destroy error on gfx_v7
In reply to Sasha LevinFrom: Amber Lin <[email protected]>
[ Upstream commit caaa4c8a6be2a275bd14f2369ee364978ff74704 ]
A wrong register bit was examinated for checking SDMA status so it reports false failures. This typo only appears on gfx_v7. gfx_v8 checks the correct bit.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c +1 -1
@@ -677,7 +677,7 @@ static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd,while (true) { temp =RREG32 (sdma_base_addr + mmSDMA0_RLC0_CONTEXT_STATUS); -if (temp &SDMA0_STATUS_REG__RB_CMD_IDLE__SHIFT ) +if (temp &SDMA0_RLC0_CONTEXT_STATUS__IDLE_MASK )break ;if (time_after (jiffies, end_jiffies))return -ETIME ;
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 45/48 drm/amdkfd: Change the control stack MTYPE from UC to NC on GFX9
In reply to Sasha LevinFrom: Yong Zhao <[email protected]>
[ Upstream commit 15426dbb65c5b37680d27e84d58a1ed3b8532518 ]
CWSR fails on Raven if the control stack is MTYPE_UC, which is used for regular GART mappings. As a workaround we map it using MTYPE_NC.
The MEC firmware expects the control stack at one page offset from the start of the MQD so it is part of the MQD allocation on GFXv9. AMDGPU added a memory allocation flag just for this purpose.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 6 +++++- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 3 ++- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c | 2 +- drivers/gpu/drm/amd/include/kgd_kfd_interface.h | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +5 -1
@@ -245,7 +245,7 @@ int amdgpu_amdkfd_resume(struct amdgpu_device *adev)int alloc_gtt_mem (struct kgd_dev *kgd,size_t size,void **mem_obj,uint64_t *gpu_addr, -void **cpu_ptr) +void **cpu_ptr,bool mqd_gfx9) {struct amdgpu_device *adev = (struct amdgpu_device *)kgd;struct amdgpu_bo *bo =NULL ;
@@ -261,6 +261,10 @@ int alloc_gtt_mem(struct kgd_dev *kgd, size_t size, bp.flags =AMDGPU_GEM_CREATE_CPU_GTT_USWC ; bp.type = ttm_bo_type_kernel; bp.resv =NULL ; + +if (mqd_gfx9) + bp.flags |=AMDGPU_GEM_CREATE_MQD_GFX9 ; + r =amdgpu_bo_create (adev, &bp, &bo);if (r) { dev_err(adev->dev,
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +1 -1
@@ -129,7 +129,7 @@ bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev, u32 vmid);/* Shared API */ int alloc_gtt_mem (struct kgd_dev *kgd,size_t size,void **mem_obj,uint64_t *gpu_addr, -void **cpu_ptr); +void **cpu_ptr,bool mqd_gfx9);void free_gtt_mem (struct kgd_dev *kgd,void *mem_obj);void get_local_mem_info (struct kgd_dev *kgd,struct kfd_local_mem_info *mem_info);
drivers/gpu/drm/amd/amdkfd/kfd_device.c +2 -1
@@ -423,7 +423,8 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,if (kfd->kfd2kgd->init_gtt_mem_allocation ( kfd->kgd, size, &kfd->gtt_mem, - &kfd->gtt_start_gpu_addr, &kfd->gtt_start_cpu_ptr)){ + &kfd->gtt_start_gpu_addr, &kfd->gtt_start_cpu_ptr, + false)) {dev_err (kfd_device,"Could not allocate %d bytes\n" , size); goto out; }
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +1 -1
@@ -63,7 +63,7 @@ static int init_mqd(struct mqd_manager *mm, void **mqd,ALIGN (sizeof (struct v9_mqd ),PAGE_SIZE ), &((*mqd_mem_obj)->gtt_mem), &((*mqd_mem_obj)->gpu_addr), - (void *)&((*mqd_mem_obj)->cpu_ptr)); + (void *)&((*mqd_mem_obj)->cpu_ptr), true); }else retval =kfd_gtt_sa_allocate (mm->dev,sizeof (struct v9_mqd ), mqd_mem_obj);
drivers/gpu/drm/amd/include/kgd_kfd_interface.h +1 -1
@@ -266,7 +266,7 @@ struct tile_config {struct kfd2kgd_calls {int (*init_gtt_mem_allocation)(struct kgd_dev *kgd,size_t size,void **mem_obj,uint64_t *gpu_addr, -void **cpu_ptr); +void **cpu_ptr,bool mqd_gfx9);void (*free_gtt_mem)(struct kgd_dev *kgd,void *mem_obj);
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 46/48 drm/amdkfd: Fix ATS capablity was not reported correctly on some APUs
In reply to Sasha LevinFrom: Yong Zhao <[email protected]>
[ Upstream commit 44d8cc6f1a905e4bb1d4221a898abb0d7e9d100a ]
Because CRAT_CU_FLAGS_IOMMU_PRESENT was not set in some BIOS crat, we need to workaround this.
For future compatibility, we also overwrite the bit in capability according to the value of needs_iommu_device.
--- drivers/gpu/drm/amd/amdkfd/kfd_iommu.c | 13 ++++++++++++- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 1 + drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 21 ++++++++++++++++----- 3 files changed, 29 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_iommu.c +12 -1
@@ -62,9 +62,20 @@ int kfd_iommu_device_init(struct kfd_dev *kfd)struct amd_iommu_device_info iommu_info;unsigned int pasid_limit;int err; +struct kfd_topology_device *top_dev; -if (!kfd->device_info->needs_iommu_device) + top_dev =kfd_topology_device_by_id (kfd->id); + +/* +* Overwrite ATS capability according to needs_iommu_device to fix +* potential missing corresponding bit in CRAT of BIOS. +*/ +if (!kfd->device_info->needs_iommu_device) { + top_dev->node_props.capability &= ~HSA_CAP_ATS_PRESENT ;return 0 ; + } + + top_dev->node_props.capability |=HSA_CAP_ATS_PRESENT ; iommu_info.flags =0 ; err =amd_iommu_device_info (kfd->pdev, &iommu_info);
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +1 -0
@@ -796,6 +796,7 @@ int kfd_topology_add_device(struct kfd_dev *gpu);int kfd_topology_remove_device (struct kfd_dev *gpu);struct kfd_topology_device *kfd_topology_device_by_proximity_domain (uint32_t proximity_domain); +struct kfd_topology_device *kfd_topology_device_by_id (uint32_t gpu_id);struct kfd_dev *kfd_device_by_id (uint32_t gpu_id);struct kfd_dev *kfd_device_by_pci_dev (const struct pci_dev *pdev);int kfd_topology_enum_kfd_devices (uint8_t idx,struct kfd_dev **kdev);
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +16 -5
@@ -63,22 +63,33 @@ struct kfd_topology_device *kfd_topology_device_by_proximity_domain(return device; } -struct kfd_dev *kfd_device_by_id (uint32_t gpu_id) +struct kfd_topology_device *kfd_topology_device_by_id (uint32_t gpu_id) { -struct kfd_topology_device *top_dev; -struct kfd_dev *device =NULL ; +struct kfd_topology_device *top_dev =NULL ; +struct kfd_topology_device *ret =NULL ;down_read (&topology_lock);list_for_each_entry (top_dev, &topology_device_list, list)if (top_dev->gpu_id == gpu_id) { - device = top_dev->gpu; + ret = top_dev;break ; }up_read (&topology_lock); -return device; +return ret; +} + +struct kfd_dev *kfd_device_by_id (uint32_t gpu_id) +{ +struct kfd_topology_device *top_dev; + + top_dev =kfd_topology_device_by_id (gpu_id); +if (!top_dev) +return NULL ; + +return top_dev->gpu; }struct kfd_dev *kfd_device_by_pci_dev (const struct pci_dev *pdev)
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 47/48 ubifs: Check for name being NULL while mounting
In reply to Sasha LevinFrom: Richard Weinberger <[email protected]>
[ Upstream commit 37f31b6ca4311b94d985fb398a72e5399ad57925 ]
The requested device name can be NULL or an empty string. Check for that and refuse to continue. UBIFS has to do this manually since we cannot use mount_bdev(), which checks for this condition.
--- fs/ubifs/super.c | 3 +++ 1 file changed, 3 insertions(+)
fs/ubifs/super.c +3 -0
@@ -1929,6 +1929,9 @@ static struct ubi_volume_desc *open_ubi(const char *name, int mode)int dev, vol;char *endptr; +if (!name || !*name) +return ERR_PTR (-EINVAL ); +/* First, try to open using the device node path method */ ubi =ubi_open_volume_path (name, mode);if (!IS_ERR (ubi))
Signature · 1 line
2.17.1
Sasha Levin
maintainerPATCH 48/48 mm: slowly shrink slabs with a relatively small number of objects
In reply to Sasha LevinFrom: Roman Gushchin <[email protected]>
[ Upstream commit 172b06c32b949759fe6313abec514bc4f15014f4 ]
9092c71bb724 ("mm: use sc->priority for slab shrink targets") changed the way that the target slab pressure is calculated and made it priority-based:
delta = freeable >> priority;
delta *= 4;
do_div(delta, shrinker->seeks);The problem is that on a default priority (which is 12) no pressure is applied at all, if the number of potentially reclaimable objects is less than 4096 (1<<12).
This causes the last objects on slab caches of no longer used cgroups to (almost) never get reclaimed. It's obviously a waste of memory.
It can be especially painful, if these stale objects are holding a reference to a dying cgroup. Slab LRU lists are reparented on memcg offlining, but corresponding objects are still holding a reference to the dying cgroup. If we don't scan these objects, the dying cgroup can't go away. Most likely, the parent cgroup hasn't any directly charged objects, only remaining objects from dying children cgroups. So it can easily hold a reference to hundreds of dying cgroups.
If there are no big spikes in memory pressure, and new memory cgroups are created and destroyed periodically, this causes the number of dying cgroups grow steadily, causing a slow-ish and hard-to-detect memory "leak". It's not a real leak, as the memory can be eventually reclaimed, but it could not happen in a real life at all. I've seen hosts with a steadily climbing number of dying cgroups, which doesn't show any signs of a decline in months, despite the host is loaded with a production workload.
It is an obvious waste of memory, and to prevent it, let's apply a minimal pressure even on small shrinker lists. E.g. if there are freeable objects, let's scan at least min(freeable, scan_batch) objects.
This fix significantly improves a chance of a dying cgroup to be reclaimed, and together with some previous patches stops the steady growth of the dying cgroups number on some of our hosts.
--- mm/vmscan.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
mm/vmscan.c +11 -0
@@ -386,6 +386,17 @@ static unsigned long do_shrink_slab(struct shrink_control *shrinkctl, delta = freeable >> priority; delta *=4 ;do_div (delta, shrinker->seeks); + +/* +* Make sure we apply some minimal pressure on default priority +* even on small cgroups. Stale objects are not only consuming memory +* by themselves, but can also hold a reference to a dying cgroup, +* preventing it from being reclaimed. A dying cgroup with all +* corresponding structures like per-cpu stats and kmem caches +* can be really big, so it may lead to a significant waste of memory. +*/ + delta = max_t(unsigned long long, delta, min(freeable, batch_size)); + total_scan += delta;if (total_scan <0 ) { pr_err("shrink_slab: %pF negative objects to delete nr=%ld\n",
Signature · 1 line
2.17.1