ALSA: hda: do not override bus codec_mask in link_get()
Subsystems (15)
Sasha Levin
maintainerPATCH 1/66 ALSA: hda: do not override bus codec_mask in link_get()
From: Kai Vehmanen <[email protected]>
[ Upstream commit 43bcb1c0507858cdc95e425017dcc33f8105df39 ]
snd_hdac_ext_bus_link_get() does not work correctly in case there are multiple codecs on the bus. It unconditionally resets the bus->codec_mask value. As per documentation in hdaudio.h and existing use in client code, this field should be used to store bit flag of detected codecs on the bus.
By overwriting value of the codec_mask, information on all detected codecs is lost. No current user of hdac is impacted, but use of bus->codec_mask is planned in future patches for SOF.
--- sound/hda/ext/hdac_ext_controller.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
sound/hda/ext/hdac_ext_controller.c +6 -3
@@ -254,6 +254,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_power_down_all);int snd_hdac_ext_bus_link_get (struct hdac_bus *bus,struct hdac_ext_link *link) { +unsigned long codec_mask;int ret =0 ;mutex_lock (&bus->lock);
@@ -280,9 +281,11 @@ int snd_hdac_ext_bus_link_get(struct hdac_bus *bus,* HDA spec section 4.3 - Codec Discovery */ udelay (521 ); - bus->codec_mask =snd_hdac_chip_readw (bus,STATESTS ); -dev_dbg (bus->dev,"codec_mask = 0x%lx\n" , bus->codec_mask); -snd_hdac_chip_writew (bus,STATESTS , bus->codec_mask); + codec_mask =snd_hdac_chip_readw (bus,STATESTS ); +dev_dbg (bus->dev,"codec_mask = 0x%lx\n" , codec_mask); +snd_hdac_chip_writew (bus,STATESTS , codec_mask); +if (!bus->codec_mask) + bus->codec_mask = codec_mask; }mutex_unlock (&bus->lock);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 2/66 usb: charger: assign specific number for enum value
From: Peter Chen <[email protected]>
[ Upstream commit ca4b43c14cd88d28cfc6467d2fa075aad6818f1d ]
To work properly on every architectures and compilers, the enum value needs to be specific numbers.
--- include/uapi/linux/usb/charger.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
include/uapi/linux/usb/charger.h +8 -8
@@ -14,18 +14,18 @@* ACA (Accessory Charger Adapters) */ enum usb_charger_type { -UNKNOWN_TYPE , -SDP_TYPE , -DCP_TYPE , -CDP_TYPE , -ACA_TYPE , +UNKNOWN_TYPE =0 , +SDP_TYPE =1 , +DCP_TYPE =2 , +CDP_TYPE =3 , +ACA_TYPE =4 , };/* USB charger state */ enum usb_charger_state { -USB_CHARGER_DEFAULT , -USB_CHARGER_PRESENT , -USB_CHARGER_ABSENT , +USB_CHARGER_DEFAULT =0 , +USB_CHARGER_PRESENT =1 , +USB_CHARGER_ABSENT =2 , };#endif /* _UAPI__LINUX_USB_CHARGER_H */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 3/66 serial: ar933x_uart: set UART_CS_{RX,TX}_READY_ORIDE
In reply to Sasha LevinFrom: Daniel Golle <[email protected]>
[ Upstream commit 87c5cbf71ecbb9e289d60a2df22eb686c70bf196 ]
On AR934x this UART is usually not initialized by the bootloader as it is only used as a secondary serial port while the primary UART is a newly introduced NS16550-compatible.
In order to make use of the ar933x-uart on AR934x without RTS/CTS hardware flow control, one needs to set the UART_CS_{RX,TX}_READY_ORIDE bits as other than on AR933x where this UART is used as primary/console, the bootloader on AR934x typically doesn't set those bits.
Setting them explicitely on AR933x should not do any harm, so just set them unconditionally.
--- drivers/tty/serial/ar933x_uart.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/tty/serial/ar933x_uart.c +8 -0
@@ -286,6 +286,10 @@ static void ar933x_uart_set_termios(struct uart_port *port,ar933x_uart_rmw_set (up,AR933X_UART_CS_REG ,AR933X_UART_CS_HOST_INT_EN ); +/* enable RX and TX ready overide */ +ar933x_uart_rmw_set (up,AR933X_UART_CS_REG , +AR933X_UART_CS_TX_READY_ORIDE |AR933X_UART_CS_RX_READY_ORIDE ); +/* reenable the UART */ ar933x_uart_rmw(up, AR933X_UART_CS_REG, AR933X_UART_CS_IF_MODE_M << AR933X_UART_CS_IF_MODE_S,
@@ -418,6 +422,10 @@ static int ar933x_uart_startup(struct uart_port *port)ar933x_uart_rmw_set (up,AR933X_UART_CS_REG ,AR933X_UART_CS_HOST_INT_EN ); +/* enable RX and TX ready overide */ +ar933x_uart_rmw_set (up,AR933X_UART_CS_REG , +AR933X_UART_CS_TX_READY_ORIDE |AR933X_UART_CS_RX_READY_ORIDE ); +/* Enable RX interrupts */ up->ier =AR933X_UART_INT_RX_VALID ;ar933x_uart_write (up,AR933X_UART_INT_EN_REG , up->ier);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 4/66 Kernel selftests: tpm2: check for tpm support
In reply to Sasha LevinFrom: Nikita Sobolev <[email protected]>
[ Upstream commit b32694cd0724d4ceca2c62cc7c3d3a8d1ffa11fc ]
tpm2 tests set fails if there is no /dev/tpm0 and /dev/tpmrm0 supported. Check if these files exist before run and mark test as skipped in case of absence.
--- tools/testing/selftests/tpm2/test_smoke.sh | 13 +++++++++++-- tools/testing/selftests/tpm2/test_space.sh | 9 ++++++++- 2 files changed, 19 insertions(+), 3 deletions(-)
tools/testing/selftests/tpm2/test_smoke.sh +11 -2
@@ -1,8 +1,17 @@ #!/bin/bash # SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) +self.flags = flags -python -m unittest -v tpm2_tests.SmokeTest -python -m unittest -v tpm2_tests.AsyncTest +# Kselftest framework requirement - SKIP code is 4. +ksft_skip=4 + + +if [ -f /dev/tpm0 ] ; then + python -m unittest -v tpm2_tests.SmokeTest + python -m unittest -v tpm2_tests.AsyncTest +else + exit $ksft_skip +fi CLEAR_CMD=$(which tpm2_clear) if [ -n $CLEAR_CMD ]; then
tools/testing/selftests/tpm2/test_space.sh +8 -1
@@ -1,4 +1,11 @@ #!/bin/bash # SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) -python -m unittest -v tpm2_tests.SpaceTest +# Kselftest framework requirement - SKIP code is 4. +ksft_skip=4 + +if [ -f /dev/tpmrm0 ] ; then + python -m unittest -v tpm2_tests.SpaceTest +else + exit $ksft_skip +fi
Signature · 1 line
2.20.1
shuah
maintainerRe: [PATCH AUTOSEL 5.5 04/66] Kernel selftests: tpm2: check for tpm support
Quoted 8 lines · Sasha Levin
From: Nikita Sobolev <[email protected]>
[ Upstream commit
b32694cd0724d4ceca2c62cc7c3d3a8d1ffa11fc]tpm2 tests set fails if there is no
/dev/tpm0and/dev/tpmrm0supported. Check if these files exist before run and mark test as skipped in case of absence.
Quoted 8 lines
Signed-off-by Nikita Sobolev <[email protected]>Signed-off-by Shuah Khan <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- tools/testing/selftests/tpm2/test_smoke.sh | 13 +++++++++++-- tools/testing/selftests/tpm2/test_space.sh | 9 ++++++++- 2 files changed, 19 insertions(+), 3 deletions(-)
Let's drop this unless it already made it into stables. Jarkko Sakkinen found regressions and send in a revert for this patch.
thanks,
-- Shuah
Re: [PATCH AUTOSEL 5.5 04/66] Kernel selftests: tpm2: check for tpm support
Quoted 18 lines · shuah
Quoted 8 lines · Sasha Levin
From: Nikita Sobolev <[email protected]>
[ Upstream commit
b32694cd0724d4ceca2c62cc7c3d3a8d1ffa11fc]tpm2 tests set fails if there is no
/dev/tpm0and/dev/tpmrm0supported. Check if these files exist before run and mark test as skipped in case of absence.Quoted 8 lines
Signed-off-by Nikita Sobolev <[email protected]>Signed-off-by Shuah Khan <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- tools/testing/selftests/tpm2/test_smoke.sh | 13 +++++++++++-- tools/testing/selftests/tpm2/test_space.sh | 9 ++++++++- 2 files changed, 19 insertions(+), 3 deletions(-)
Quoted 6 lines
Let's drop this unless it already made it into stables. Jarkko Sakkinen found regressions and send in a revert for this patch.
thanks,
-- Shuah
Thanks, can ack this.
/Jarkko
Sasha Levin
maintainerPATCH 5/66 selftests: fix too long argument
In reply to Sasha LevinFrom: Jiri Benc <[email protected]>
[ Upstream commit c363eb48ada5cf732b3f489fab799fc881097842 ]
With some shells, the command construed for install of bpf selftests becomes too large due to long list of files:
make[1]: execvp: /bin/sh: Argument list too long
make[1]: *** [../lib.mk:73: install] Error 127
Currently, each of the file lists is replicated three times in the command:
in the shell 'if' condition, in the 'echo' and in the 'rsync'. Reduce that by one instance by using make conditionals and separate the echo and rsync into two shell commands. (One would be inclined to just remove the '@' at the beginning of the rsync command and let 'make' echo it by itself; unfortunately, it appears that the '@' in the front of mkdir silences output also for the following commands.)
Also, separate handling of each of the lists to its own shell command.
The semantics of the makefile is unchanged before and after the patch. The ability of individual test directories to override INSTALL_RULE is retained.
--- tools/testing/selftests/lib.mk | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
tools/testing/selftests/lib.mk +13 -10
@@ -83,17 +83,20 @@ else $(call RUN_TESTS, $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) $(TEST_PROGS)) endif +define INSTALL_SINGLE_RULE + $(if $(INSTALL_LIST),@mkdir -p $(INSTALL_PATH)) + $(if $(INSTALL_LIST),@echo rsync -a $(INSTALL_LIST) $(INSTALL_PATH)/) + $(if $(INSTALL_LIST),@rsync -a $(INSTALL_LIST) $(INSTALL_PATH)/) +endef + define INSTALL_RULE - @if [ "X$(TEST_PROGS)$(TEST_PROGS_EXTENDED)$(TEST_FILES)" != "X" ]; then \ - mkdir -p ${INSTALL_PATH}; \ - echo "rsync -a $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(INSTALL_PATH)/"; \ - rsync -a $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(INSTALL_PATH)/; \ - fi - @if [ "X$(TEST_GEN_PROGS)$(TEST_CUSTOM_PROGS)$(TEST_GEN_PROGS_EXTENDED)$(TEST_GEN_FILES)" != "X" ]; then \ - mkdir -p ${INSTALL_PATH}; \ - echo "rsync -a $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(INSTALL_PATH)/"; \ - rsync -a $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(INSTALL_PATH)/; \ - fi + $(eval INSTALL_LIST = $(TEST_PROGS)) $(INSTALL_SINGLE_RULE) + $(eval INSTALL_LIST = $(TEST_PROGS_EXTENDED)) $(INSTALL_SINGLE_RULE) + $(eval INSTALL_LIST = $(TEST_FILES)) $(INSTALL_SINGLE_RULE) + $(eval INSTALL_LIST = $(TEST_GEN_PROGS)) $(INSTALL_SINGLE_RULE) + $(eval INSTALL_LIST = $(TEST_CUSTOM_PROGS)) $(INSTALL_SINGLE_RULE) + $(eval INSTALL_LIST = $(TEST_GEN_PROGS_EXTENDED)) $(INSTALL_SINGLE_RULE) + $(eval INSTALL_LIST = $(TEST_GEN_FILES)) $(INSTALL_SINGLE_RULE) endef install: all
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 6/66 usb: gadget: composite: Support more than 500mA MaxPower
In reply to Sasha LevinFrom: Jack Pham <[email protected]>
[ Upstream commit a2035411fa1d1206cea7d5dfe833e78481844a76 ]
USB 3.x SuperSpeed peripherals can draw up to 900mA of VBUS power when in configured state. However, if a configuration wanting to take advantage of this is added with MaxPower greater than 500 (currently possible if using a ConfigFS gadget) the composite driver fails to accommodate this for a couple reasons:
- usb_gadget_vbus_draw() when called from set_config() and composite_resume() will be passed the MaxPower value without regard for the current connection speed, resulting in a violation for USB 2.0 since the max is 500mA.
- the bMaxPower of the configuration descriptor would be incorrectly encoded, again if the connection speed is only at USB 2.0 or below, likely wrapping around U8_MAX since the 2mA multiplier corresponds to a maximum of 510mA.
Fix these by adding checks against the current gadget->speed when the c->MaxPower value is used (set_config() and composite_resume()) and appropriately limit based on whether it is currently at a low-/full-/high- or super-speed connection.
Because 900 is not divisible by 8, with the round-up division currently used in encode_bMaxPower() a MaxPower of 900mA will result in an encoded value of 0x71. When a host stack (including Linux and Windows) enumerates this on a single port root hub, it reads this value back and decodes (multiplies by 8) to get 904mA which is strictly greater than 900mA that is typically budgeted for that port, causing it to reject the configuration. Instead, we should be using the round-down behavior of normal integral division so that 900 / 8 -> 0x70 or 896mA to stay within range. And we might as well change it for the high/full/low case as well for consistency.
N.B. USB 3.2 Gen N x 2 allows for up to 1500mA but there doesn't seem to be any any peripheral controller supported by Linux that does two lane operation, so for now keeping the clamp at 900 should be fine.
--- drivers/usb/gadget/composite.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)
drivers/usb/gadget/composite.c +18 -6
@@ -438,9 +438,13 @@ static u8 encode_bMaxPower(enum usb_device_speed speed,if (!val)return 0 ;if (speed <USB_SPEED_SUPER ) -return DIV_ROUND_UP (val,2 ); +return min (val,500U ) /2 ;else -return DIV_ROUND_UP (val,8 ); +/* +* USB 3.x supports up to 900mA, but since 900 isn't divisible +* by 8 the integral division will effectively cap to 896mA. +*/ +return min (val,900U ) /8 ; } static int config_buf(struct usb_configuration *config,
@@ -852,6 +856,10 @@ static int set_config(struct usb_composite_dev *cdev,/* when we return, be sure our power usage is valid */ power = c->MaxPower ? c->MaxPower :CONFIG_USB_GADGET_VBUS_DRAW ; +if (gadget->speed <USB_SPEED_SUPER ) + power =min (power,500U ); +else + power =min (power,900U ); done:usb_gadget_vbus_draw (gadget, power);if (result >=0 && cdev->delayed_status)
@@ -2278,7 +2286,7 @@ void composite_resume(struct usb_gadget *gadget) {struct usb_composite_dev *cdev =get_gadget_data (gadget);struct usb_function *f; -u16 maxpower; +unsigned maxpower;/* REVISIT: should we have config level * suspend/resume callbacks?
@@ -2292,10 +2300,14 @@ void composite_resume(struct usb_gadget *gadget) f->resume (f); } - maxpower = cdev->config->MaxPower; + maxpower = cdev->config->MaxPower ? + cdev->config->MaxPower :CONFIG_USB_GADGET_VBUS_DRAW ; +if (gadget->speed <USB_SPEED_SUPER ) + maxpower =min (maxpower,500U ); +else + maxpower =min (maxpower,900U ); -usb_gadget_vbus_draw (gadget, maxpower ? - maxpower :CONFIG_USB_GADGET_VBUS_DRAW ); +usb_gadget_vbus_draw (gadget, maxpower); } cdev->suspended =0 ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 7/66 usb: gadget: ffs: ffs_aio_cancel(): Save/restore IRQ flags
In reply to Sasha LevinFrom: Lars-Peter Clausen <[email protected]>
[ Upstream commit 43d565727a3a6fd24e37c7c2116475106af71806 ]
ffs_aio_cancel() can be called from both interrupt and thread context. Make sure that the current IRQ state is saved and restored by using spin_{un,}lock_irq{save,restore}().
Otherwise undefined behavior might occur.
--- drivers/usb/gadget/function/f_fs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/gadget/function/f_fs.c +3 -2
@@ -1162,18 +1162,19 @@ static int ffs_aio_cancel(struct kiocb *kiocb) {struct ffs_io_data *io_data = kiocb->private;struct ffs_epfile *epfile = kiocb->ki_filp->private_data; +unsigned long flags;int value;ENTER (); -spin_lock_irq (&epfile->ffs->eps_lock); +spin_lock_irqsave (&epfile->ffs->eps_lock, flags);if (likely (io_data && io_data->ep && io_data->req)) value =usb_ep_dequeue (io_data->ep, io_data->req);else value = -EINVAL ; -spin_unlock_irq (&epfile->ffs->eps_lock); +spin_unlock_irqrestore (&epfile->ffs->eps_lock, flags);return value; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 8/66 usb: gadget: serial: fix Tx stall after buffer overflow
In reply to Sasha LevinFrom: Sergey Organov <[email protected]>
[ Upstream commit e4bfded56cf39b8d02733c1e6ef546b97961e18a ]
Symptom: application opens /dev/ttyGS0 and starts sending (writing) to it while either USB cable is not connected, or nobody listens on the other side of the cable. If driver circular buffer overflows before connection is established, no data will be written to the USB layer until/unless /dev/ttyGS0 is closed and re-opened again by the application (the latter besides having no means of being notified about the event of establishing of the connection.)
Fix: on open and/or connect, kick Tx to flush circular buffer data to USB layer.
--- drivers/usb/gadget/function/u_serial.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/gadget/function/u_serial.c +3 -1
@@ -561,8 +561,10 @@ static int gs_start_io(struct gs_port *port) port->n_read =0 ; started =gs_start_rx (port); -/* unblock any pending writes into our circular buffer */ if (started) { +gs_start_tx (port); +/* Unblock any pending writes into our circular buffer, in case +* we didn't in gs_start_tx() */ tty_wakeup (port->port.tty); }else {gs_free_requests (ep, head, &port->read_allocated);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 9/66 habanalabs: halt the engines before hard-reset
In reply to Sasha LevinFrom: Oded Gabbay <[email protected]>
[ Upstream commit 908087ffbe896c100ed73d5f0ce11a5b7264af4a ]
The driver must halt the engines before doing hard-reset, otherwise the device can go into undefined state. There is a place where the driver didn't do that and this patch fixes it.
--- drivers/misc/habanalabs/device.c | 1 + drivers/misc/habanalabs/goya/goya.c | 42 +++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+)
drivers/misc/habanalabs/device.c +1 -0
@@ -1189,6 +1189,7 @@ int hl_device_init(struct hl_device *hdev, struct class *hclass)if (hdev->asic_funcs->get_hw_state (hdev) ==HL_DEVICE_HW_STATE_DIRTY ) {dev_info (hdev->dev,"H/W state is dirty, must reset before initializing\n" ); + hdev->asic_funcs->halt_engines (hdev, true); hdev->asic_funcs->hw_fini (hdev, true); }
drivers/misc/habanalabs/goya/goya.c +42 -0
95 lines not on this page · raw message
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 10/66 habanalabs: do not halt CoreSight during hard reset
In reply to Sasha LevinFrom: Omer Shpigelman <[email protected]>
[ Upstream commit a37e47192dfa98f79a0cd5ab991c224b5980c982 ]
During hard reset we must not write to the device.
Hence avoid halting CoreSight during user context close if it is done during hard reset.
In addition, we must not re-enable clock gating afterwards as it was deliberately disabled in the beginning of the hard reset flow.
--- drivers/misc/habanalabs/device.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/misc/habanalabs/device.c +3 -1
@@ -598,7 +598,9 @@ int hl_device_set_debug_mode(struct hl_device *hdev, bool enable) goto out; } - hdev->asic_funcs->halt_coresight (hdev); +if (!hdev->hard_reset_pending) + hdev->asic_funcs->halt_coresight (hdev); + hdev->in_debug =0 ; goto out;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 11/66 habanalabs: patched cb equals user cb in device memset
In reply to Sasha LevinFrom: Oded Gabbay <[email protected]>
[ Upstream commit cf01514c5c6efa2d521d35e68dff2e0674d08e91 ]
During device memory memset, the driver allocates and use a CB (command buffer). To reuse existing code, it keeps a pointer to the CB in two variables, user_cb and patched_cb. Therefore, there is no need to "put" both the user_cb and patched_cb, as it will cause an underflow of the refcnt of the CB.
--- drivers/misc/habanalabs/goya/goya.c | 2 -- 1 file changed, 2 deletions(-)
drivers/misc/habanalabs/goya/goya.c +0 -2
@@ -4690,8 +4690,6 @@ static int goya_memset_device_memory(struct hl_device *hdev, u64 addr, u64 size, rc =goya_send_job_on_qman0 (hdev, job); -hl_cb_put (job->patched_cb); -hl_debugfs_remove_job (hdev, job);kfree (job); cb->cs_cnt--;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 12/66 drm/msm/mdp5: rate limit pp done timeout warnings
In reply to Sasha LevinFrom: Brian Masney <[email protected]>
[ Upstream commit ef8c9809acb0805c991bba8bdd4749fc46d44a98 ]
Add rate limiting of the 'pp done time out' warnings since these warnings can quickly fill the dmesg buffer.
--- drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +2 -2
@@ -1109,8 +1109,8 @@ static void mdp5_crtc_wait_for_pp_done(struct drm_crtc *crtc) ret =wait_for_completion_timeout (&mdp5_crtc->pp_completion,msecs_to_jiffies (50 ));if (ret ==0 ) -dev_warn (dev->dev,"pp done time out, lm=%d\n" , - mdp5_cstate->pipeline.mixer->lm); +dev_warn_ratelimited (dev->dev,"pp done time out, lm=%d\n" , + mdp5_cstate->pipeline.mixer->lm); }static void mdp5_crtc_wait_for_flush_done (struct drm_crtc *crtc)
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 13/66 drm: msm: Fix return type of dsi_mgr_connector_mode_valid for kCFI
In reply to Sasha LevinFrom: John Stultz <[email protected]>
[ Upstream commit 7fd2dfc3694922eb7ace4801b7208cf9f62ebc7d ]
I was hitting kCFI crashes when building with clang, and after some digging finally narrowed it down to the dsi_mgr_connector_mode_valid() function being implemented as returning an int, instead of an enum drm_mode_status.
This patch fixes it, and appeases the opaque word of the kCFI gods (seriously, clang inlining everything makes the kCFI backtraces only really rough estimates of where things went wrong).
Thanks as always to Sami for his help narrowing this down.
--- drivers/gpu/drm/msm/dsi/dsi_manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/dsi/dsi_manager.c +1 -1
@@ -336,7 +336,7 @@ static int dsi_mgr_connector_get_modes(struct drm_connector *connector)return num; } -static int dsi_mgr_connector_mode_valid (struct drm_connector *connector, +static enum drm_mode_status dsi_mgr_connector_mode_valid (struct drm_connector *connector,struct drm_display_mode *mode) {int id =dsi_mgr_connector_get_id (connector);
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 14/66 drm/modes: Make sure to parse valid rotation value from cmdline
In reply to Sasha LevinFrom: Stephan Gerhold <[email protected]>
[ Upstream commit e6980a727154b793adb218fbc7b4d6af52a7e364 ]
A rotation value should have exactly one rotation angle. At the moment there is no validation for this when parsing video= parameters from the command line. This causes problems later on when we try to combine the command line rotation with the panel orientation.
To make sure that we generate a valid rotation value:
- Set DRM_MODE_ROTATE_0 by default (if no rotate= option is set)
- Validate that there is exactly one rotation angle set (i.e. specifying the rotate= option multiple times is invalid)
--- drivers/gpu/drm/drm_modes.c | 7 +++++++ drivers/gpu/drm/selftests/drm_cmdline_selftests.h | 1 + .../gpu/drm/selftests/test-drm_cmdline_parser.c | 15 +++++++++++++-- 3 files changed, 21 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_modes.c +7 -0
@@ -1672,6 +1672,13 @@ static int drm_mode_parse_cmdline_options(char *str, size_t len, } } +if (!(rotation &DRM_MODE_ROTATE_MASK )) + rotation |=DRM_MODE_ROTATE_0 ; + +/* Make sure there is exactly one rotation defined */ +if (!is_power_of_2 (rotation &DRM_MODE_ROTATE_MASK )) +return -EINVAL ; + mode->rotation_reflection = rotation;return 0 ;
drivers/gpu/drm/selftests/drm_cmdline_selftests.h +1 -0
@@ -53,6 +53,7 @@ cmdline_test(drm_cmdline_test_rotate_0) cmdline_test(drm_cmdline_test_rotate_90) cmdline_test(drm_cmdline_test_rotate_180) cmdline_test(drm_cmdline_test_rotate_270) +cmdline_test(drm_cmdline_test_rotate_multiple) cmdline_test(drm_cmdline_test_rotate_invalid_val) cmdline_test(drm_cmdline_test_rotate_truncated) cmdline_test(drm_cmdline_test_hmirror)
drivers/gpu/drm/selftests/test-drm_cmdline_parser.c +13 -2
@@ -856,6 +856,17 @@ static int drm_cmdline_test_rotate_270(void *ignored)return 0 ; } +static int drm_cmdline_test_rotate_multiple (void *ignored) +{ +struct drm_cmdline_mode mode = { }; + +FAIL_ON (drm_mode_parse_command_line_for_connector ("720x480,rotate=0,rotate=90" , + &no_connector, + &mode)); + +return 0 ; +} +static int drm_cmdline_test_rotate_invalid_val (void *ignored) {struct drm_cmdline_mode mode = { };
@@ -888,7 +899,7 @@ static int drm_cmdline_test_hmirror(void *ignored)FAIL_ON (!mode.specified);FAIL_ON (mode.xres !=720 );FAIL_ON (mode.yres !=480 ); -FAIL_ON (mode.rotation_reflection !=DRM_MODE_REFLECT_X ); +FAIL_ON (mode.rotation_reflection != (DRM_MODE_ROTATE_0 |DRM_MODE_REFLECT_X ));FAIL_ON (mode.refresh_specified);
@@ -913,7 +924,7 @@ static int drm_cmdline_test_vmirror(void *ignored)FAIL_ON (!mode.specified);FAIL_ON (mode.xres !=720 );FAIL_ON (mode.yres !=480 ); -FAIL_ON (mode.rotation_reflection !=DRM_MODE_REFLECT_Y ); +FAIL_ON (mode.rotation_reflection != (DRM_MODE_ROTATE_0 |DRM_MODE_REFLECT_Y ));FAIL_ON (mode.refresh_specified);
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 15/66 drm/modes: Allow DRM_MODE_ROTATE_0 when applying video mode parameters
In reply to Sasha LevinFrom: Stephan Gerhold <[email protected]>
[ Upstream commit 5c320b6ce7510653bce68cecf80cf5b2d67e907f ]
At the moment, only DRM_MODE_ROTATE_180 is allowed when we try to apply the rotation from the video mode parameters. It is also useful to allow DRM_MODE_ROTATE_0 in case there is only a reflect option in the video mode parameter (e.g. video=540x960,reflect_x).
DRM_MODE_ROTATE_0 means "no rotation" and should therefore not require any special handling, so we can just add it to the if condition.
--- drivers/gpu/drm/drm_client_modeset.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_client_modeset.c +2 -1
@@ -951,7 +951,8 @@ bool drm_client_rotation(struct drm_mode_set *modeset, unsigned int *rotation)* depending on the hardware this may require the framebuffer * to be in a specific tiling format. */ -if ((*rotation &DRM_MODE_ROTATE_MASK ) !=DRM_MODE_ROTATE_180 || +if (((*rotation &DRM_MODE_ROTATE_MASK ) !=DRM_MODE_ROTATE_0 && + (*rotation &DRM_MODE_ROTATE_MASK ) !=DRM_MODE_ROTATE_180 ) || !plane->rotation_property)return false;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 16/66 scsi: megaraid_sas: silence a warning
In reply to Sasha LevinFrom: Tomas Henzl <[email protected]>
[ Upstream commit 0e99b2c625da181aebf1a3d13493e3f7a5057a9c ]
Add a flag to DMA memory allocation to silence a warning.
This driver allocates DMA memory for IO frames. This allocation may exceed MAX_ORDER pages for few megaraid_sas controllers (controllers with very high queue depth). Consequently, the driver has logic to keep reducing the controller queue depth until the DMA memory allocation succeeds.
On impacted megaraid_sas controllers there would be multiple DMA allocation failures until driver settled on an allocation that fit. These failed DMA allocation requests caused stack traces in system logs. These were not harmful and this patch silences those warnings/stack traces.
[mkp: clarified commit desc]
--- drivers/scsi/megaraid/megaraid_sas_fusion.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/megaraid/megaraid_sas_fusion.c +3 -2
@@ -594,7 +594,8 @@ megasas_alloc_request_fusion(struct megasas_instance *instance) fusion->io_request_frames =dma_pool_alloc (fusion->io_request_frames_pool, -GFP_KERNEL , &fusion->io_request_frames_phys); +GFP_KERNEL | __GFP_NOWARN, + &fusion->io_request_frames_phys);if (!fusion->io_request_frames) {if (instance->max_fw_cmds >= (MEGASAS_REDUCE_QD_COUNT *2 )) { instance->max_fw_cmds -=MEGASAS_REDUCE_QD_COUNT ;
@@ -632,7 +633,7 @@ megasas_alloc_request_fusion(struct megasas_instance *instance) fusion->io_request_frames =dma_pool_alloc (fusion->io_request_frames_pool, -GFP_KERNEL , +GFP_KERNEL | __GFP_NOWARN, &fusion->io_request_frames_phys);if (!fusion->io_request_frames) {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 17/66 drm/msm/dsi: save pll state before dsi host is powered off
In reply to Sasha LevinFrom: Harigovindan P <[email protected]>
[ Upstream commit a1028dcfd0dd97884072288d0c8ed7f30399b528 ]
Save pll state before dsi host is powered off. Without this change some register values gets resetted.
--- drivers/gpu/drm/msm/dsi/dsi_manager.c | 5 +++++ drivers/gpu/drm/msm/dsi/phy/dsi_phy.c | 4 ---- 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_manager.c +5 -0
@@ -479,6 +479,7 @@ static void dsi_mgr_bridge_post_disable(struct drm_bridge *bridge)struct msm_dsi *msm_dsi1 =dsi_mgr_get_dsi (DSI_1 );struct mipi_dsi_host *host = msm_dsi->host;struct drm_panel *panel = msm_dsi->panel; +struct msm_dsi_pll *src_pll;bool is_dual_dsi =IS_DUAL_DSI ();int ret;
@@ -519,6 +520,10 @@ static void dsi_mgr_bridge_post_disable(struct drm_bridge *bridge) id, ret); } +/* Save PLL status if it is a clock source */ + src_pll =msm_dsi_phy_get_pll (msm_dsi->phy); +msm_dsi_pll_save_state (src_pll); + ret =msm_dsi_host_power_off (host);if (ret)pr_err ("%s: host %d power off failed,%d\n" , __func__, id, ret);
drivers/gpu/drm/msm/dsi/phy/dsi_phy.c +0 -4
@@ -724,10 +724,6 @@ void msm_dsi_phy_disable(struct msm_dsi_phy *phy)if (!phy || !phy->cfg->ops.disable)return ; -/* Save PLL status if it is a clock source */ -if (phy->usecase !=MSM_DSI_PHY_SLAVE ) -msm_dsi_pll_save_state (phy->pll); - phy->cfg->ops.disable (phy);dsi_phy_regulator_disable (phy);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 18/66 drm/msm/dsi/pll: call vco set rate explicitly
In reply to Sasha LevinFrom: Harigovindan P <[email protected]>
[ Upstream commit c6659785dfb3f8d75f1fe637e4222ff8178f5280 ]
For a given byte clock, if VCO recalc value is exactly same as vco set rate value, vco_set_rate does not get called assuming VCO is already set to required value. But Due to GDSC toggle, VCO values are erased in the HW. To make sure VCO is programmed correctly, we forcefully call set_rate from vco_prepare.
--- drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c +6 -0
@@ -411,6 +411,12 @@ static int dsi_pll_10nm_vco_prepare(struct clk_hw *hw)if (pll_10nm->slave)dsi_pll_enable_pll_bias (pll_10nm->slave); + rc =dsi_pll_10nm_vco_set_rate (hw,pll_10nm->vco_current_rate,0 ); +if (rc) { +pr_err ("vco_set_rate failed, rc=%d\n" , rc); +return rc; + } +/* Start PLL */ pll_write (pll_10nm->phy_cmn_mmio + REG_DSI_10nm_PHY_CMN_PLL_CNTRL,0x01 );
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 19/66 selftests: forwarding: use proto icmp for {gretap, ip6gretap}_mac testing
In reply to Sasha LevinFrom: Hangbin Liu <[email protected]>
[ Upstream commit e8023b030ce1748930e2dc76353a262fe47d4745 ]
For tc ip_proto filter, when we extract the flow via __skb_flow_dissect() without flag FLOW_DISSECTOR_F_STOP_AT_ENCAP, we will continue extract to the inner proto.
So for GRE + ICMP messages, we should not track GRE proto, but inner ICMP proto.
For test mirror_gre.sh, it may make user confused if we capture ICMP message on $h3(since the flow is GRE message). So I move the capture dev to h3-gt{4,6}, and only capture ICMP message.
Before the fix:
]# ./mirror_gre.sh
TEST: ingress mirror to gretap (skip_hw) [ OK ]
TEST: egress mirror to gretap (skip_hw) [ OK ]
TEST: ingress mirror to ip6gretap (skip_hw) [ OK ]
TEST: egress mirror to ip6gretap (skip_hw) [ OK ]
TEST: ingress mirror to gretap: envelope MAC (skip_hw) [FAIL]
Expected to capture 10 packets, got 0.
TEST: egress mirror to gretap: envelope MAC (skip_hw) [FAIL]
Expected to capture 10 packets, got 0.
TEST: ingress mirror to ip6gretap: envelope MAC (skip_hw) [FAIL]
Expected to capture 10 packets, got 0.
TEST: egress mirror to ip6gretap: envelope MAC (skip_hw) [FAIL]
Expected to capture 10 packets, got 0.
TEST: two simultaneously configured mirrors (skip_hw) [ OK ]
WARN: Could not test offloaded functionality
After fix:
]# ./mirror_gre.sh
TEST: ingress mirror to gretap (skip_hw) [ OK ]
TEST: egress mirror to gretap (skip_hw) [ OK ]
TEST: ingress mirror to ip6gretap (skip_hw) [ OK ]
TEST: egress mirror to ip6gretap (skip_hw) [ OK ]
TEST: ingress mirror to gretap: envelope MAC (skip_hw) [ OK ]
TEST: egress mirror to gretap: envelope MAC (skip_hw) [ OK ]
TEST: ingress mirror to ip6gretap: envelope MAC (skip_hw) [ OK ]
TEST: egress mirror to ip6gretap: envelope MAC (skip_hw) [ OK ]
TEST: two simultaneously configured mirrors (skip_hw) [ OK ]
WARN: Could not test offloaded functionality
--- .../selftests/net/forwarding/mirror_gre.sh | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-)
tools/testing/selftests/net/forwarding/mirror_gre.sh +13 -12
@@ -63,22 +63,23 @@ test_span_gre_mac() { local tundev=$1; shift local direction=$1; shift - local prot=$1; shift local what=$1; shift - local swp3mac=$(mac_get $swp3) - local h3mac=$(mac_get $h3) + case "$direction" in + ingress) local src_mac=$(mac_get $h1); local dst_mac=$(mac_get $h2) + ;; + egress) local src_mac=$(mac_get $h2); local dst_mac=$(mac_get $h1) + ;; + esac RET=0 mirror_install $swp1 $direction $tundev "matchall $tcflags" - tc filter add dev $h3 ingress pref 77 prot $prot \ - flower ip_proto 0x2f src_mac $swp3mac dst_mac $h3mac \ - action pass + icmp_capture_install h3-${tundev} "src_mac $src_mac dst_mac $dst_mac" - mirror_test v$h1 192.0.2.1 192.0.2.2 $h3 77 10 + mirror_test v$h1 192.0.2.1 192.0.2.2 h3-${tundev} 100 10 - tc filter del dev $h3 ingress pref 77 + icmp_capture_uninstall h3-${tundev} mirror_uninstall $swp1 $direction log_test "$direction $what: envelope MAC ($tcflags)"
@@ -120,14 +121,14 @@ test_ip6gretap() test_gretap_mac() { - test_span_gre_mac gt4 ingress ip "mirror to gretap" - test_span_gre_mac gt4 egress ip "mirror to gretap" + test_span_gre_mac gt4 ingress "mirror to gretap" + test_span_gre_mac gt4 egress "mirror to gretap" } test_ip6gretap_mac() { - test_span_gre_mac gt6 ingress ipv6 "mirror to ip6gretap" - test_span_gre_mac gt6 egress ipv6 "mirror to ip6gretap" + test_span_gre_mac gt6 ingress "mirror to ip6gretap" + test_span_gre_mac gt6 egress "mirror to ip6gretap" } test_all()
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 20/66 net: macb: ensure interface is not suspended on at91rm9200
In reply to Sasha LevinFrom: Alexandre Belloni <[email protected]>
[ Upstream commit e6a41c23df0d5da01540d2abef41591589c0b4be ]
Because of autosuspend, at91ether_start is called with clocks disabled. Ensure that pm_runtime doesn't suspend the interface as soon as it is opened as there is no pm_runtime support is the other relevant parts of the platform support for at91rm9200.
--- drivers/net/ethernet/cadence/macb_main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/cadence/macb_main.c +5 -1
@@ -3751,6 +3751,10 @@ static int at91ether_open(struct net_device *dev)u32 ctl;int ret; + ret =pm_runtime_get_sync (&lp->pdev->dev); +if (ret <0 ) +return ret; +/* Clear internal statistics */ ctl =macb_readl (lp,NCR );macb_writel (lp,NCR , ctl |MACB_BIT (CLRSTAT ));
@@ -3815,7 +3819,7 @@ static int at91ether_close(struct net_device *dev) q->rx_buffers, q->rx_buffers_dma); q->rx_buffers =NULL ; -return 0 ; +return pm_runtime_put (&lp->pdev->dev); }/* Transmit packet */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 21/66 selftests: forwarding: vxlan_bridge_1d: fix tos value
In reply to Sasha LevinFrom: Hangbin Liu <[email protected]>
[ Upstream commit 4e867c9a50ff1a07ed0b86c3b1c8bc773933d728 ]
After commit 71130f29979c ("vxlan: fix tos value before xmit") we start strict vxlan xmit tos value by RT_TOS(), which limits the tos value less than 0x1E. With current value 0x40 the test will failed with "v1: Expected to capture 10 packets, got 0". So let's choose a smaller tos value for testing.
--- tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh +3 -3
@@ -516,9 +516,9 @@ test_tos() RET=0 tc filter add dev v1 egress pref 77 prot ip \ - flower ip_tos 0x40 action pass - vxlan_ping_test $h1 192.0.2.3 "-Q 0x40" v1 egress 77 10 - vxlan_ping_test $h1 192.0.2.3 "-Q 0x30" v1 egress 77 0 + flower ip_tos 0x11 action pass + vxlan_ping_test $h1 192.0.2.3 "-Q 0x11" v1 egress 77 10 + vxlan_ping_test $h1 192.0.2.3 "-Q 0x12" v1 egress 77 0 tc filter del dev v1 egress pref 77 prot ip log_test "VXLAN: envelope TOS inheritance"
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 22/66 net: atlantic: checksum compat issue
In reply to Sasha LevinFrom: Dmitry Bezrukov <[email protected]>
[ Upstream commit 15beab0a9d797be1b7c67458da007a62269be29a ]
Yet another checksum offload compatibility issue was found.
The known issue is that AQC HW marks tcp packets with 0xFFFF checksum as invalid (1). This is workarounded in driver, passing all the suspicious packets up to the stack for further csum validation.
Another HW problem (2) is that it hides invalid csum of LRO aggregated packets inside of the individual descriptors. That was workarounded by forced scan of all LRO descriptors for checksum errors.
However the scan logic was joint for both LRO and multi-descriptor packets (jumbos). And this causes the issue.
We have to drop LRO packets with the detected bad checksum because of (2), but we have to pass jumbo packets to stack because of (1).
When using windows tcp partner with jumbo frames but with LSO disabled driver discards such frames as bad checksummed. But only LRO frames should be dropped, not jumbos.
On such a configurations tcp stream have a chance of drops and stucks.
(1) 76f254d4afe2 ("net: aquantia: tcp checksum 0xffff being handled incorrectly")
(2) d08b9a0a3ebd ("net: aquantia: do not pass lro session with invalid tcp checksum")
--- drivers/net/ethernet/aquantia/atlantic/aq_ring.c | 3 ++- drivers/net/ethernet/aquantia/atlantic/aq_ring.h | 3 ++- drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_ring.c +2 -1
@@ -351,7 +351,8 @@ int aq_ring_rx_clean(struct aq_ring_s *self, err =0 ; goto err_exit; } -if (buff->is_error || buff->is_cso_err) { +if (buff->is_error || + (buff->is_lro && buff->is_cso_err)) { buff_ = buff; do { next_ = buff_->next,
drivers/net/ethernet/aquantia/atlantic/aq_ring.h +2 -1
@@ -78,7 +78,8 @@ struct __packed aq_ring_buff_s { u32 is_cleaned:1; u32 is_error:1; u32 is_vlan:1; - u32 rsvd3:4; + u32 is_lro:1; + u32 rsvd3:3;u16 eop_index;u16 rsvd4; };
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +3 -2
@@ -823,6 +823,8 @@ static int hw_atl_b0_hw_ring_rx_receive(struct aq_hw_s *self, } } + buff->is_lro = !!(HW_ATL_B0_RXD_WB_STAT2_RSCCNT & + rxd_wb->status);if (HW_ATL_B0_RXD_WB_STAT2_EOP & rxd_wb->status) { buff->len = rxd_wb->pkt_len %AQ_CFG_RX_FRAME_MAX ;
@@ -835,8 +837,7 @@ static int hw_atl_b0_hw_ring_rx_receive(struct aq_hw_s *self, rxd_wb->pkt_len >AQ_CFG_RX_FRAME_MAX ?AQ_CFG_RX_FRAME_MAX : rxd_wb->pkt_len; -if (HW_ATL_B0_RXD_WB_STAT2_RSCCNT & - rxd_wb->status) { +if (buff->is_lro) {/* LRO */ buff->next = rxd_wb->next_desc_ptr; ++ring->stats.rx.lro_packets;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 23/66 net: atlantic: check rpc result and wait for rpc address
In reply to Sasha LevinFrom: Igor Russkikh <[email protected]>
[ Upstream commit e7b5f97e6574dc4918e375d5f8d24ec31653cd6d ]
Artificial HW reliability tests revealed a possible hangup in the driver. Normally, when device disappears from bus, all register reads returns 0xFFFFFFFF.
At remote procedure invocation towards FW there is a logic where result is compared with -1 in a loop.
That caused an infinite loop if hardware due to some issues disappears from bus.
Add extra result checks to prevent this.
--- .../aquantia/atlantic/hw_atl/hw_atl_utils.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c +17 -2
@@ -22,6 +22,7 @@#define HW_ATL_MIF_ADDR 0x0208U#define HW_ATL_MIF_VAL 0x020CU +#define HW_ATL_MPI_RPC_ADDR 0x0334U#define HW_ATL_RPC_CONTROL_ADR 0x0338U#define HW_ATL_RPC_STATE_ADR 0x033CU
@@ -53,15 +54,14 @@ enum mcp_area { };static int hw_atl_utils_ver_match (u32 ver_expected,u32 ver_actual); -static int hw_atl_utils_mpi_set_state (struct aq_hw_s *self,enum hal_atl_utils_fw_state_e state); -static u32 hw_atl_utils_get_mpi_mbox_tid (struct aq_hw_s *self);static u32 hw_atl_utils_mpi_get_state (struct aq_hw_s *self);static u32 hw_atl_utils_mif_cmd_get (struct aq_hw_s *self);static u32 hw_atl_utils_mif_addr_get (struct aq_hw_s *self);static u32 hw_atl_utils_rpc_state_get (struct aq_hw_s *self); +static u32 aq_fw1x_rpc_get (struct aq_hw_s *self);int hw_atl_utils_initfw (struct aq_hw_s *self,const struct aq_fw_ops **fw_ops) {
@@ -476,6 +476,10 @@ static int hw_atl_utils_init_ucp(struct aq_hw_s *self, self, self->mbox_addr, self->mbox_addr !=0U , 1000U, 10000U); + err =readx_poll_timeout_atomic (aq_fw1x_rpc_get, self, + self->rpc_addr, + self->rpc_addr !=0U , +1000U ,100000U );return err; }
@@ -531,6 +535,12 @@ int hw_atl_utils_fw_rpc_wait(struct aq_hw_s *self, self, fw.val, sw.tid == fw.tid, 1000U, 100000U); +if (err <0 ) + goto err_exit; + + err =aq_hw_err_from_flags (self); +if (err <0 ) + goto err_exit;if (fw.len ==0xFFFFU ) { err =hw_atl_utils_fw_rpc_call (self, sw.len);
@@ -1025,6 +1035,11 @@ static u32 hw_atl_utils_rpc_state_get(struct aq_hw_s *self)return aq_hw_read_reg (self,HW_ATL_RPC_STATE_ADR ); } +static u32 aq_fw1x_rpc_get (struct aq_hw_s *self) +{ +return aq_hw_read_reg (self,HW_ATL_MPI_RPC_ADDR ); +} +const struct aq_fw_ops aq_fw_1x_ops = { .init = hw_atl_utils_mpi_create, .deinit = hw_atl_fw1x_deinit,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 24/66 net: atlantic: ptp gpio adjustments
In reply to Sasha LevinFrom: Egor Pomozov <[email protected]>
[ Upstream commit f08a464c27ca0a4050333baa271504b27ce834b7 ]
Clock adjustment data should be passed to FW as well, otherwise in some cases a drift was observed when using GPIO features.
--- drivers/net/ethernet/aquantia/atlantic/aq_hw.h | 2 ++ .../ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 4 +++- .../aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c | 12 ++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-)
drivers/net/ethernet/aquantia/atlantic/aq_hw.h +2 -0
@@ -337,6 +337,8 @@ struct aq_fw_ops {void (*enable_ptp)(struct aq_hw_s *self,int enable); +void (*adjust_ptp)(struct aq_hw_s *self,uint64_t adj); +int (*set_eee_rate)(struct aq_hw_s *self,u32 speed); int (*get_eee_rate)(struct aq_hw_s *self, u32 *rate,
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +3 -1
@@ -1162,6 +1162,8 @@ static int hw_atl_b0_adj_sys_clock(struct aq_hw_s *self, s64 delta) { self->ptp_clk_offset += delta; + self->aq_fw_ops->adjust_ptp (self, self->ptp_clk_offset); +return 0 ; }
@@ -1212,7 +1214,7 @@ static int hw_atl_b0_gpio_pulse(struct aq_hw_s *self, u32 index, fwreq.ptp_gpio_ctrl.index = index; fwreq.ptp_gpio_ctrl.period = period;/* Apply time offset */ - fwreq.ptp_gpio_ctrl.start = start - self->ptp_clk_offset; + fwreq.ptp_gpio_ctrl.start = start; size =sizeof (fwreq.msg_id) +sizeof (fwreq.ptp_gpio_ctrl);return self->aq_fw_ops->send_fw_request (self, &fwreq, size);
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c +12 -0
@@ -30,6 +30,9 @@#define HW_ATL_FW3X_EXT_CONTROL_ADDR 0x378#define HW_ATL_FW3X_EXT_STATE_ADDR 0x37c +#define HW_ATL_FW3X_PTP_ADJ_LSW_ADDR 0x50a0 +#define HW_ATL_FW3X_PTP_ADJ_MSW_ADDR 0x50a4 +#define HW_ATL_FW2X_CAP_PAUSE BIT(CAPS_HI_PAUSE)#define HW_ATL_FW2X_CAP_ASYM_PAUSE BIT(CAPS_HI_ASYMMETRIC_PAUSE)#define HW_ATL_FW2X_CAP_SLEEP_PROXY BIT(CAPS_HI_SLEEP_PROXY)
@@ -475,6 +478,14 @@ static void aq_fw3x_enable_ptp(struct aq_hw_s *self, int enable)aq_hw_write_reg (self,HW_ATL_FW3X_EXT_CONTROL_ADDR , ptp_opts); } +static void aq_fw3x_adjust_ptp (struct aq_hw_s *self,uint64_t adj) +{ +aq_hw_write_reg (self,HW_ATL_FW3X_PTP_ADJ_LSW_ADDR , + (adj >>0 ) &0xffffffff ); +aq_hw_write_reg (self,HW_ATL_FW3X_PTP_ADJ_MSW_ADDR , + (adj >>32 ) &0xffffffff ); +} +static int aq_fw2x_led_control (struct aq_hw_s *self,u32 mode) {if (self->fw_ver_actual <HW_ATL_FW_VER_LED )
@@ -633,4 +644,5 @@ const struct aq_fw_ops aq_fw_2x_ops = { .enable_ptp = aq_fw3x_enable_ptp, .led_control = aq_fw2x_led_control, .set_phyloopback = aq_fw2x_set_phyloopback, + .adjust_ptp = aq_fw3x_adjust_ptp, };
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 25/66 net: atlantic: better loopback mode handling
In reply to Sasha LevinFrom: Nikita Danilov <[email protected]>
[ Upstream commit b42726fcf76e9367e524392e0ead7e672cc0791c ]
Add checks to not enable multiple loopback modes simultaneously, It was also discovered that for dma loopback to function correctly promisc mode should be enabled on device.
--- drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c | 5 +++++ .../ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 13 ++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c +5 -0
@@ -722,6 +722,11 @@ static int aq_ethtool_set_priv_flags(struct net_device *ndev, u32 flags)if (flags & ~AQ_PRIV_FLAGS_MASK )return -EOPNOTSUPP ; +if (hweight32 ((flags | priv_flags) &AQ_HW_LOOPBACK_MASK ) >1 ) { +netdev_info (ndev,"Can't enable more than one loopback simultaneously\n" ); +return -EINVAL ; + } + cfg->priv_flags = flags;if ((priv_flags ^ flags) &BIT (AQ_HW_LOOPBACK_DMA_NET )) {
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +8 -5
@@ -885,13 +885,16 @@ static int hw_atl_b0_hw_packet_filter_set(struct aq_hw_s *self, {struct aq_nic_cfg_s *cfg = self->aq_nic_cfg;unsigned int i =0U ; +u32 vlan_promisc; +u32 l2_promisc; -hw_atl_rpfl2promiscuous_mode_en_set (self, -IS_FILTER_ENABLED (IFF_PROMISC )); + l2_promisc =IS_FILTER_ENABLED (IFF_PROMISC ) || + !!(cfg->priv_flags &BIT (AQ_HW_LOOPBACK_DMA_NET )); + vlan_promisc = l2_promisc || cfg->is_vlan_force_promisc; -hw_atl_rpf_vlan_prom_mode_en_set (self, -IS_FILTER_ENABLED (IFF_PROMISC ) || - cfg->is_vlan_force_promisc); +hw_atl_rpfl2promiscuous_mode_en_set (self, l2_promisc); + +hw_atl_rpf_vlan_prom_mode_en_set (self, vlan_promisc); hw_atl_rpfl2multicast_flr_en_set(self, IS_FILTER_ENABLED(IFF_ALLMULTI) &&
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 26/66 net: atlantic: fix use after free kasan warn
In reply to Sasha LevinFrom: Pavel Belous <[email protected]>
[ Upstream commit a4980919ad6a7be548d499bc5338015e1a9191c6 ]
skb->len is used to calculate statistics after xmit invocation.
Under a stress load it may happen that skb will be xmited, rx interrupt will come and skb will be freed, all before xmit function is even returned.
Eventually, skb->len will access unallocated area.
Moving stats calculation into tx_clean routine.
--- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 4 ---- drivers/net/ethernet/aquantia/atlantic/aq_ring.c | 7 +++++-- 2 files changed, 5 insertions(+), 6 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +0 -4
@@ -655,10 +655,6 @@ int aq_nic_xmit(struct aq_nic_s *self, struct sk_buff *skb)if (likely (frags)) { err = self->aq_hw_ops->hw_ring_tx_xmit (self->aq_hw, ring, frags); -if (err >=0 ) { - ++ring->stats.tx.packets; - ring->stats.tx.bytes += skb->len; - } }else { err =NETDEV_TX_BUSY ; }
drivers/net/ethernet/aquantia/atlantic/aq_ring.c +5 -2
@@ -272,9 +272,12 @@ bool aq_ring_tx_clean(struct aq_ring_s *self) } } -if (unlikely (buff->is_eop)) -dev_kfree_skb_any (buff->skb); +if (unlikely (buff->is_eop)) { + ++self->stats.rx.packets; + self->stats.tx.bytes += buff->skb->len; +dev_kfree_skb_any (buff->skb); + } buff->pa =0U ; buff->eop_index =0xffffU ; self->sw_head =aq_ring_next_dx (self, self->sw_head);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 27/66 net: atlantic: fix potential error handling
In reply to Sasha LevinFrom: Pavel Belous <[email protected]>
[ Upstream commit 380ec5b9af7f0d57dbf6ac067fd9f33cff2fef71 ]
Code inspection found that in case of mapping error we do return current 'ret' value. But beside error, it is used to count number of descriptors allocated for the packet. In that case map_skb function could return '1'.
Changing it to return zero (number of mapped descriptors for skb)
--- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +3 -1
@@ -533,8 +533,10 @@ unsigned int aq_nic_map_skb(struct aq_nic_s *self, struct sk_buff *skb, dx_buff->len, DMA_TO_DEVICE); -if (unlikely (dma_mapping_error (aq_nic_get_dev (self), dx_buff->pa))) +if (unlikely (dma_mapping_error (aq_nic_get_dev (self), dx_buff->pa))) { + ret =0 ; goto exit; + } first = dx_buff; dx_buff->len_pkt = skb->len;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 28/66 net: atlantic: possible fault in transition to hibernation
In reply to Sasha LevinFrom: Pavel Belous <[email protected]>
[ Upstream commit 52a22f4d6ff95e8bdca557765c04893eb5dd83fd ]
during hibernation freeze, aq_nic_stop could be invoked on a stopped device. That may cause panic on access to not yet allocated vector/ring structures.
Add a check to stop device if it is not yet stopped.
Similiarly after freeze in hibernation thaw, aq_nic_start could be invoked on a not initialized net device. Result will be the same.
Add a check to start device if it is initialized. In our case, this is the same as started.
--- .../net/ethernet/aquantia/atlantic/aq_pci_func.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c +8 -5
@@ -359,7 +359,8 @@ static int aq_suspend_common(struct device *dev, bool deep)netif_device_detach (nic->ndev);netif_tx_stop_all_queues (nic->ndev); -aq_nic_stop (nic); +if (netif_running (nic->ndev)) +aq_nic_stop (nic);if (deep) {aq_nic_deinit (nic, !nic->aq_hw->aq_nic_cfg->wol);
@@ -375,7 +376,7 @@ static int atl_resume_common(struct device *dev, bool deep) {struct pci_dev *pdev =to_pci_dev (dev);struct aq_nic_s *nic; -int ret; +int ret =0 ; nic =pci_get_drvdata (pdev);
@@ -390,9 +391,11 @@ static int atl_resume_common(struct device *dev, bool deep) goto err_exit; } - ret =aq_nic_start (nic); -if (ret) - goto err_exit; +if (netif_running (nic->ndev)) { + ret =aq_nic_start (nic); +if (ret) + goto err_exit; + }netif_device_attach (nic->ndev);netif_tx_start_all_queues (nic->ndev);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 29/66 net: atlantic: fix out of range usage of active_vlans array
In reply to Sasha LevinFrom: Dmitry Bogdanov <[email protected]>
[ Upstream commit 5a292c89a84d49b598f8978f154bdda48b1072c0 ]
fix static checker warning:
drivers/net/ethernet/aquantia/atlantic/aq_filters.c:166 aq_check_approve_fvlan()
error: passing untrusted data to 'test_bit()'
--- drivers/net/ethernet/aquantia/atlantic/aq_filters.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/aquantia/atlantic/aq_filters.c +1 -1
@@ -163,7 +163,7 @@ aq_check_approve_fvlan(struct aq_nic_s *aq_nic, }if ((aq_nic->ndev->features &NETIF_F_HW_VLAN_CTAG_FILTER ) && - (!test_bit (be16_to_cpu (fsp->h_ext.vlan_tci), + (!test_bit (be16_to_cpu (fsp->h_ext.vlan_tci) &VLAN_VID_MASK , aq_nic->active_vlans))) {netdev_err (aq_nic->ndev,"ethtool: unknown vlan-id specified" );
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 30/66 net: phy: restore mdio regs in the iproc mdio driver
In reply to Sasha LevinFrom: Arun Parameswaran <[email protected]>
[ Upstream commit 6f08e98d62799e53c89dbf2c9a49d77e20ca648c ]
The mii management register in iproc mdio block
does not have a retention register so it is lost on suspend. Save and restore value of register while resuming from suspend.
--- drivers/net/phy/mdio-bcm-iproc.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/net/phy/mdio-bcm-iproc.c +20 -0
@@ -178,6 +178,23 @@ static int iproc_mdio_remove(struct platform_device *pdev)return 0 ; } +#ifdef CONFIG_PM_SLEEP +int iproc_mdio_resume (struct device *dev) +{ +struct platform_device *pdev =to_platform_device (dev); +struct iproc_mdio_priv *priv =platform_get_drvdata (pdev); + +/* restore the mii clock configuration */ +iproc_mdio_config_clk (priv->base); + +return 0 ; +} + +static const struct dev_pm_ops iproc_mdio_pm_ops = { + .resume = iproc_mdio_resume +}; +#endif /* CONFIG_PM_SLEEP */ +static const struct of_device_id iproc_mdio_of_match[] = { { .compatible ="brcm,iproc-mdio" , }, {/* sentinel */ },
@@ -188,6 +205,9 @@ static struct platform_driver iproc_mdio_driver = { .driver = { .name = "iproc-mdio", .of_match_table = iproc_mdio_of_match, +#ifdef CONFIG_PM_SLEEP + .pm = &iproc_mdio_pm_ops, +#endif }, .probe = iproc_mdio_probe, .remove = iproc_mdio_remove,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 31/66 net: dsa: b53: Ensure the default VID is untagged
In reply to Sasha LevinFrom: Florian Fainelli <[email protected]>
[ Upstream commit d965a5432d4c3e6b9c3d2bc1d4a800013bbf76f6 ]
We need to ensure that the default VID is untagged otherwise the switch will be sending tagged frames and the results can be problematic. This is especially true with b53 switches that use VID 0 as their default VLAN since VID 0 has a special meaning.
--- drivers/net/dsa/b53/b53_common.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/dsa/b53/b53_common.c +3 -0
@@ -1353,6 +1353,9 @@ void b53_vlan_add(struct dsa_switch *ds, int port,b53_get_vlan_entry (dev, vid, vl); +if (vid ==0 && vid ==b53_default_pvid (dev)) + untagged = true; + vl->members |=BIT (port);if (untagged && !dsa_is_cpu_port (ds, port)) vl->untag |=BIT (port);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 32/66 bonding: add missing netdev_update_lockdep_key()
In reply to Sasha LevinFrom: Taehee Yoo <[email protected]>
[ Upstream commit 064ff66e2bef84f1153087612032b5b9eab005bd ]
After bond_release(), netdev_update_lockdep_key() should be called. But both ioctl path and attribute path don't call netdev_update_lockdep_key().
This patch adds missing netdev_update_lockdep_key().
Test commands:
ip link add bond0 type bond
ip link add bond1 type bond
ifenslave bond0 bond1
ifenslave -d bond0 bond1
ifenslave bond1 bond0
Splat looks like:
[ 29.501182][ T1046] WARNING: possible circular locking dependency detected
[ 29.501945][ T1039] hardirqs last disabled at (1962): [<ffffffffac6c807f>] handle_mm_fault+0x13f/0x700
[ 29.503442][ T1046] 5.5.0+ #322 Not tainted
[ 29.503447][ T1046] ------------------------------------------------------
[ 29.504277][ T1039] softirqs last enabled at (1180): [<ffffffffade00678>] __do_softirq+0x678/0x981
[ 29.505443][ T1046] ifenslave/1046 is trying to acquire lock:
[ 29.505886][ T1039] softirqs last disabled at (1169): [<ffffffffac19c18a>] irq_exit+0x17a/0x1a0
[ 29.509997][ T1046] ffff88805d5da280 (&dev->addr_list_lock_key#3){+...}, at: dev_mc_sync_multiple+0x95/0x120
[ 29.511243][ T1046]
[ 29.511243][ T1046] but task is already holding lock:
[ 29.512192][ T1046] ffff8880460f2280 (&dev->addr_list_lock_key#4){+...}, at: bond_enslave+0x4482/0x47b0 [bonding]
[ 29.514124][ T1046]
[ 29.514124][ T1046] which lock already depends on the new lock.
[ 29.514124][ T1046]
[ 29.517297][ T1046]
[ 29.517297][ T1046] the existing dependency chain (in reverse order) is:
[ 29.518231][ T1046]
[ 29.518231][ T1046] -> #1 (&dev->addr_list_lock_key#4){+...}:
[ 29.519076][ T1046] _raw_spin_lock+0x30/0x70
[ 29.519588][ T1046] dev_mc_sync_multiple+0x95/0x120
[ 29.520208][ T1046] bond_enslave+0x448d/0x47b0 [bonding]
[ 29.520862][ T1046] bond_option_slaves_set+0x1a3/0x370 [bonding]
[ 29.521640][ T1046] __bond_opt_set+0x1ff/0xbb0 [bonding]
[ 29.522438][ T1046] __bond_opt_set_notify+0x2b/0xf0 [bonding]
[ 29.523251][ T1046] bond_opt_tryset_rtnl+0x92/0xf0 [bonding]
[ 29.524082][ T1046] bonding_sysfs_store_option+0x8a/0xf0 [bonding]
[ 29.524959][ T1046] kernfs_fop_write+0x276/0x410
[ 29.525620][ T1046] vfs_write+0x197/0x4a0
[ 29.526218][ T1046] ksys_write+0x141/0x1d0
[ 29.526818][ T1046] do_syscall_64+0x99/0x4f0
[ 29.527430][ T1046] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[ 29.528265][ T1046]
[ 29.528265][ T1046] -> #0 (&dev->addr_list_lock_key#3){+...}:
[ 29.529272][ T1046] __lock_acquire+0x2d8d/0x3de0
[ 29.529935][ T1046] lock_acquire+0x164/0x3b0
[ 29.530638][ T1046] _raw_spin_lock+0x30/0x70
[ 29.531187][ T1046] dev_mc_sync_multiple+0x95/0x120
[ 29.531790][ T1046] bond_enslave+0x448d/0x47b0 [bonding]
[ 29.532451][ T1046] bond_option_slaves_set+0x1a3/0x370 [bonding]
[ 29.533163][ T1046] __bond_opt_set+0x1ff/0xbb0 [bonding]
[ 29.533789][ T1046] __bond_opt_set_notify+0x2b/0xf0 [bonding]
[ 29.534595][ T1046] bond_opt_tryset_rtnl+0x92/0xf0 [bonding]
[ 29.535500][ T1046] bonding_sysfs_store_option+0x8a/0xf0 [bonding]
[ 29.536379][ T1046] kernfs_fop_write+0x276/0x410
[ 29.537057][ T1046] vfs_write+0x197/0x4a0
[ 29.537640][ T1046] ksys_write+0x141/0x1d0
[ 29.538251][ T1046] do_syscall_64+0x99/0x4f0
[ 29.538870][ T1046] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[ 29.539659][ T1046]
[ 29.539659][ T1046] other info that might help us debug this:
[ 29.539659][ T1046]
[ 29.540953][ T1046] Possible unsafe locking scenario:
[ 29.540953][ T1046]
[ 29.541883][ T1046] CPU0 CPU1
[ 29.542540][ T1046] ---- ----
[ 29.543209][ T1046] lock(&dev->addr_list_lock_key#4);
[ 29.543880][ T1046] lock(&dev->addr_list_lock_key#3);
[ 29.544873][ T1046] lock(&dev->addr_list_lock_key#4);
[ 29.545863][ T1046] lock(&dev->addr_list_lock_key#3);
[ 29.546525][ T1046]
[ 29.546525][ T1046] *** DEADLOCK ***
[ 29.546525][ T1046]
[ 29.547542][ T1046] 5 locks held by ifenslave/1046:
[ 29.548196][ T1046] #0: ffff88806044c478 (sb_writers#5){.+.+}, at: vfs_write+0x3bb/0x4a0
[ 29.549248][ T1046] #1: ffff88805af00890 (&of->mutex){+.+.}, at: kernfs_fop_write+0x1cf/0x410
[ 29.550343][ T1046] #2: ffff88805b8b54b0 (kn->count#157){.+.+}, at: kernfs_fop_write+0x1f2/0x410
[ 29.551575][ T1046] #3: ffffffffaecf4cf0 (rtnl_mutex){+.+.}, at: bond_opt_tryset_rtnl+0x5f/0xf0 [bonding]
[ 29.552819][ T1046] #4: ffff8880460f2280 (&dev->addr_list_lock_key#4){+...}, at: bond_enslave+0x4482/0x47b0 [bonding]
[ 29.554175][ T1046]
[ 29.554175][ T1046] stack backtrace:
[ 29.554907][ T1046] CPU: 0 PID: 1046 Comm: ifenslave Not tainted 5.5.0+ #322
[ 29.555854][ T1046] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
[ 29.557064][ T1046] Call Trace:
[ 29.557504][ T1046] dump_stack+0x96/0xdb
[ 29.558054][ T1046] check_noncircular+0x371/0x450
[ 29.558723][ T1046] ? print_circular_bug.isra.35+0x310/0x310
[ 29.559486][ T1046] ? hlock_class+0x130/0x130
[ 29.560100][ T1046] ? __lock_acquire+0x2d8d/0x3de0
[ 29.560761][ T1046] __lock_acquire+0x2d8d/0x3de0
[ 29.561366][ T1046] ? register_lock_class+0x14d0/0x14d0
[ 29.562045][ T1046] ? find_held_lock+0x39/0x1d0
[ 29.562641][ T1046] lock_acquire+0x164/0x3b0
[ 29.563199][ T1046] ? dev_mc_sync_multiple+0x95/0x120
[ 29.563872][ T1046] _raw_spin_lock+0x30/0x70
[ 29.564464][ T1046] ? dev_mc_sync_multiple+0x95/0x120
[ 29.565146][ T1046] dev_mc_sync_multiple+0x95/0x120
[ 29.565793][ T1046] bond_enslave+0x448d/0x47b0 [bonding]
[ 29.566487][ T1046] ? bond_update_slave_arr+0x940/0x940 [bonding]
[ 29.567279][ T1046] ? bstr_printf+0xc20/0xc20
[ 29.567857][ T1046] ? stack_trace_consume_entry+0x160/0x160
[ 29.568614][ T1046] ? deactivate_slab.isra.77+0x2c5/0x800
[ 29.569320][ T1046] ? check_chain_key+0x236/0x5d0
[ 29.569939][ T1046] ? sscanf+0x93/0xc0
[ 29.570442][ T1046] ? vsscanf+0x1e20/0x1e20
[ 29.571003][ T1046] bond_option_slaves_set+0x1a3/0x370 [bonding][ ... ]
--- drivers/net/bonding/bond_main.c | 2 ++ drivers/net/bonding/bond_options.c | 2 ++ 2 files changed, 4 insertions(+)
drivers/net/bonding/bond_main.c +2 -0
@@ -3640,6 +3640,8 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmdcase BOND_RELEASE_OLD :case SIOCBONDRELEASE : res =bond_release (bond_dev, slave_dev); +if (!res) +netdev_update_lockdep_key (slave_dev);break ;case BOND_SETHWADDR_OLD :case SIOCBONDSETHWADDR :
drivers/net/bonding/bond_options.c +2 -0
@@ -1398,6 +1398,8 @@ static int bond_option_slaves_set(struct bonding *bond,case '-' :slave_dbg (bond->dev, dev,"Releasing interface\n" ); ret =bond_release (bond->dev, dev); +if (!ret) +netdev_update_lockdep_key (dev);break ;default :
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 33/66 net: ks8851-ml: Remove 8-bit bus accessors
In reply to Sasha LevinFrom: Marek Vasut <[email protected]>
[ Upstream commit 69233bba6543a37755158ca3382765387b8078df ]
This driver is mixing 8-bit and 16-bit bus accessors for reasons unknown, however the speculation is that this was some sort of attempt to support the 8-bit bus mode.
As per the KS8851-16MLL documentation, all two registers accessed via the 8-bit accessors are internally 16-bit registers, so reading them using 16-bit accessors is fine. The KS_CCR read can be converted to 16-bit read outright, as it is already a concatenation of two 8-bit reads of that register. The KS_RXQCR accesses are 8-bit only, however writing the top 8 bits of the register is OK as well, since the driver caches the entire 16-bit register value anyway.
Finally, the driver is not used by any hardware in the kernel right now. The only hardware available to me is one with 16-bit bus, so I have no way to test the 8-bit bus mode, however it is unlikely this ever really worked anyway. If the 8-bit bus mode is ever required, it can be easily added by adjusting the 16-bit accessors to do 2 consecutive accesses, which is how this should have been done from the beginning.
--- drivers/net/ethernet/micrel/ks8851_mll.c | 45 +++--------------------- 1 file changed, 5 insertions(+), 40 deletions(-)
drivers/net/ethernet/micrel/ks8851_mll.c +5 -40
@@ -156,24 +156,6 @@ static int msg_enable;* chip is busy transferring packet data (RX/TX FIFO accesses). */ -/** -* ks_rdreg8 - read 8 bit register from device -* @ks : The chip information -* @offset: The register address -* -* Read a 8bit register from the chip, returning the result -*/ -static u8 ks_rdreg8 (struct ks_net *ks,int offset) -{ -u16 data; -u8 shift_bit = offset &0x03 ; -u8 shift_data = (offset &1 ) <<3 ; - ks->cmd_reg_cache = (u16 ) offset | (u16)(BE0 << shift_bit); -iowrite16 (ks->cmd_reg_cache, ks->hw_addr_cmd); - data =ioread16 (ks->hw_addr); -return (u8)(data >> shift_data); -} -/** * ks_rdreg16 - read 16 bit register from device * @ks : The chip information
@@ -189,22 +171,6 @@ static u16 ks_rdreg16(struct ks_net *ks, int offset)return ioread16 (ks->hw_addr); } -/** -* ks_wrreg8 - write 8bit register value to chip -* @ks: The chip information -* @offset: The register address -* @value: The value to write -* -*/ -static void ks_wrreg8 (struct ks_net *ks,int offset,u8 value) -{ -u8 shift_bit = (offset &0x03 ); -u16 value_write = (u16)(value << ((offset &1 ) <<3 )); - ks->cmd_reg_cache = (u16 )offset | (BE0 << shift_bit); -iowrite16 (ks->cmd_reg_cache, ks->hw_addr_cmd); -iowrite16 (value_write, ks->hw_addr); -} -/** * ks_wrreg16 - write 16bit register value to chip * @ks: The chip information
@@ -324,8 +290,7 @@ static void ks_read_config(struct ks_net *ks)u16 reg_data =0 ;/* Regardless of bus width, 8 bit read should always work.*/ - reg_data =ks_rdreg8 (ks,KS_CCR ) &0x00FF ; - reg_data |=ks_rdreg8 (ks,KS_CCR +1 ) <<8 ; + reg_data =ks_rdreg16 (ks,KS_CCR );/* addr/data bus are multiplexed */ ks->sharedbus = (reg_data &CCR_SHARED ) ==CCR_SHARED ;
@@ -429,7 +394,7 @@ static inline void ks_read_qmu(struct ks_net *ks, u16 *buf, u32 len)/* 1. set sudo DMA mode */ ks_wrreg16 (ks,KS_RXFDPR ,RXFDPR_RXFPAI ); -ks_wrreg8 (ks,KS_RXQCR , (ks->rc_rxqcr |RXQCR_SDA ) &0xff ); +ks_wrreg16 (ks,KS_RXQCR , ks->rc_rxqcr |RXQCR_SDA );/* 2. read prepend data */ /**
@@ -446,7 +411,7 @@ static inline void ks_read_qmu(struct ks_net *ks, u16 *buf, u32 len)ks_inblk (ks, buf,ALIGN (len,4 ));/* 4. reset sudo DMA Mode */ -ks_wrreg8 (ks,KS_RXQCR , ks->rc_rxqcr); +ks_wrreg16 (ks,KS_RXQCR , ks->rc_rxqcr); }/**
@@ -679,13 +644,13 @@ static void ks_write_qmu(struct ks_net *ks, u8 *pdata, u16 len) ks->txh.txw[1 ] =cpu_to_le16 (len);/* 1. set sudo-DMA mode */ -ks_wrreg8 (ks,KS_RXQCR , (ks->rc_rxqcr |RXQCR_SDA ) &0xff ); +ks_wrreg16 (ks,KS_RXQCR , ks->rc_rxqcr |RXQCR_SDA );/* 2. write status/lenth info */ ks_outblk (ks, ks->txh.txw,4 );/* 3. write pkt data */ ks_outblk (ks, (u16 *)pdata,ALIGN (len,4 ));/* 4. reset sudo-DMA mode */ -ks_wrreg8 (ks,KS_RXQCR , ks->rc_rxqcr); +ks_wrreg16 (ks,KS_RXQCR , ks->rc_rxqcr);/* 5. Enqueue Tx(move the pkt from TX buffer into TXQ) */ ks_wrreg16 (ks,KS_TXQCR ,TXQCR_METFE );/* 6. wait until TXQCR_METFE is auto-cleared */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 34/66 net: ks8851-ml: Fix 16-bit data access
In reply to Sasha LevinFrom: Marek Vasut <[email protected]>
[ Upstream commit edacb098ea9c31589276152f09b4439052c0f2b1 ]
The packet data written to and read from Micrel KSZ8851-16MLLI must be byte-swapped in 16-bit mode, add this byte-swapping.
--- drivers/net/ethernet/micrel/ks8851_mll.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/micrel/ks8851_mll.c +2 -2
@@ -197,7 +197,7 @@ static inline void ks_inblk(struct ks_net *ks, u16 *wptr, u32 len) { len >>=1 ;while (len--) - *wptr++ = (u16 )ioread16 (ks->hw_addr); + *wptr++ =be16_to_cpu (ioread16 (ks->hw_addr)); }/**
@@ -211,7 +211,7 @@ static inline void ks_outblk(struct ks_net *ks, u16 *wptr, u32 len) { len >>=1 ;while (len--) -iowrite16 (*wptr++, ks->hw_addr); +iowrite16 (cpu_to_be16 (*wptr++), ks->hw_addr); }static void ks_disable_int (struct ks_net *ks)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 35/66 net: ks8851-ml: Fix 16-bit IO operation
In reply to Sasha LevinFrom: Marek Vasut <[email protected]>
[ Upstream commit 58292104832fef6cb4a89f736012c0e0724c3442 ]
The Micrel KSZ8851-16MLLI datasheet DS00002357B page 12 states that BE[3:0] signals are active high. This contradicts the measurements of the behavior of the actual chip, where these signals behave as active low. For example, to read the CIDER register, the bus must expose 0xc0c0 during the address phase, which means BE[3:0]=4'b1100.
--- drivers/net/ethernet/micrel/ks8851_mll.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/micrel/ks8851_mll.c +2 -2
@@ -166,7 +166,7 @@ static int msg_enable;static u16 ks_rdreg16 (struct ks_net *ks,int offset) { - ks->cmd_reg_cache = (u16 )offset | ((BE1 |BE0 ) << (offset &0x02 )); + ks->cmd_reg_cache = (u16 )offset | ((BE3 |BE2 ) >> (offset &0x02 ));iowrite16 (ks->cmd_reg_cache, ks->hw_addr_cmd);return ioread16 (ks->hw_addr); }
@@ -181,7 +181,7 @@ static u16 ks_rdreg16(struct ks_net *ks, int offset)static void ks_wrreg16 (struct ks_net *ks,int offset,u16 value) { - ks->cmd_reg_cache = (u16 )offset | ((BE1 |BE0 ) << (offset &0x02 )); + ks->cmd_reg_cache = (u16 )offset | ((BE3 |BE2 ) >> (offset &0x02 ));iowrite16 (ks->cmd_reg_cache, ks->hw_addr_cmd);iowrite16 (value, ks->hw_addr); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 36/66 net: ethernet: dm9000: Handle -EPROBE_DEFER in dm9000_parse_dt()
In reply to Sasha LevinFrom: Paul Cercueil <[email protected]>
[ Upstream commit 9a6a0dea16177ccaecc116f560232e63bec115f1 ]
The call to of_get_mac_address() can return -EPROBE_DEFER, for instance when the MAC address is read from a NVMEM driver that did not probe yet.
--- drivers/net/ethernet/davicom/dm9000.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/davicom/dm9000.c +2 -0
@@ -1405,6 +1405,8 @@ static struct dm9000_plat_data *dm9000_parse_dt(struct device *dev) mac_addr =of_get_mac_address (np);if (!IS_ERR (mac_addr))ether_addr_copy (pdata->dev_addr, mac_addr); +else if (PTR_ERR (mac_addr) == -EPROBE_DEFER ) +return ERR_CAST (mac_addr);return pdata; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 37/66 watchdog: da9062: do not ping the hw during stop()
In reply to Sasha LevinFrom: Marco Felsch <[email protected]>
[ Upstream commit e9a0e65eda3f78d0b04ec6136c591c000cbc3b76 ]
The da9062 hw has a minimum ping cool down phase of at least 200ms. The driver takes that into account by setting the min_hw_heartbeat_ms to 300ms and the core guarantees that the hw limit is observed for the ping() calls. But the core can't guarantee the required minimum ping cool down phase if a stop() command is send immediately after the ping() command. So it is not allowed to ping the watchdog within the stop() command as the driver does. Remove the ping can be done without doubts because the watchdog gets disabled anyway and a (re)start resets the watchdog counter too.
--- drivers/watchdog/da9062_wdt.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/watchdog/da9062_wdt.c +0 -7
@@ -94,13 +94,6 @@ static int da9062_wdt_stop(struct watchdog_device *wdd)struct da9062_watchdog *wdt =watchdog_get_drvdata (wdd);int ret; - ret =da9062_reset_watchdog_timer (wdt); -if (ret) { -dev_err (wdt->hw->dev,"Failed to ping the watchdog (err = %d)\n" , - ret); -return ret; - } - ret = regmap_update_bits(wdt->hw->regmap, DA9062AA_CONTROL_D, DA9062AA_TWDSCALE_MASK,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 38/66 s390/cio: cio_ignore_proc_seq_next should increase position index
In reply to Sasha LevinFrom: Vasily Averin <[email protected]>
[ Upstream commit 8b101a5e14f2161869636ff9cb4907b7749dc0c2 ]
if seq_file .next fuction does not change position index, read after some lseek can generate unexpected output.
--- drivers/s390/cio/blacklist.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/s390/cio/blacklist.c +3 -2
@@ -303,8 +303,10 @@ static void * cio_ignore_proc_seq_next(struct seq_file *s, void *it, loff_t *offset) { struct ccwdev_iter *iter; +loff_t p = *offset; -if (*offset >= (__MAX_SUBCHANNEL +1 ) * (__MAX_SSID +1 )) + (*offset)++; +if (p >= (__MAX_SUBCHANNEL +1 ) * (__MAX_SSID +1 ))return NULL ; iter = it;if (iter->devno == __MAX_SUBCHANNEL) {
@@ -314,7 +316,6 @@ cio_ignore_proc_seq_next(struct seq_file *s, void *it, loff_t *offset)return NULL ; }else iter->devno++; - (*offset)++;return iter; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 39/66 s390: make 'install' not depend on vmlinux
In reply to Sasha LevinFrom: Masahiro Yamada <[email protected]>
[ Upstream commit 94e90f727f7424d827256023cace829cad6896f4 ]
For the same reason as commit 19514fc665ff ("arm, kbuild: make "make install" not depend on vmlinux"), the install targets should never trigger the rebuild of the kernel.
The variable, CONFIGURE, is not set by anyone. Remove it as well.
--- arch/s390/Makefile | 2 +- arch/s390/boot/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/s390/Makefile +1 -1
@@ -146,7 +146,7 @@ all: bzImage #KBUILD_IMAGE is necessary for packaging targets like rpm-pkg, deb-pkg... KBUILD_IMAGE := $(boot)/bzImage -install: vmlinux +install: $(Q)$(MAKE) $(build)=$(boot) $@ bzImage: vmlinux
arch/s390/boot/Makefile +1 -1
@@ -70,7 +70,7 @@ $(obj)/compressed/vmlinux: $(obj)/startup.a FORCE $(obj)/startup.a: $(OBJECTS) FORCE $(call if_changed,ar) -install: $(CONFIGURE) $(obj)/bzImage +install: sh -x $(srctree)/$(obj)/install.sh $(KERNELRELEASE) $(obj)/bzImage \ System.map "$(INSTALL_PATH)"
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 40/66 net: mscc: fix in frame extraction
In reply to Sasha LevinFrom: Horatiu Vultur <[email protected]>
[ Upstream commit a81541041ceb55bcec9a8bb8ad3482263f0a205a ]
Each extracted frame on Ocelot has an IFH. The frame and IFH are extracted by reading chuncks of 4 bytes from a register.
In case the IFH and frames were read corretly it would try to read the next frame. In case there are no more frames in the queue, it checks if there were any previous errors and in that case clear the queue. But this check will always succeed also when there are no errors. Because when extracting the IFH the error is checked against 4(number of bytes read) and then the error is set only if the extraction of the frame failed. So in a happy case where there are no errors the err variable is still 4. So it could be a case where after the check that there are no more frames in the queue, a frame will arrive in the queue but because the error is not reseted, it would try to flush the queue. So the frame will be lost.
The fix consist in resetting the error after reading the IFH.
--- drivers/net/ethernet/mscc/ocelot_board.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/ethernet/mscc/ocelot_board.c +8 -0
@@ -114,6 +114,14 @@ static irqreturn_t ocelot_xtr_irq_handler(int irq, void *arg)if (err !=4 )break ; +/* At this point the IFH was read correctly, so it is safe to +* presume that there is no error. The err needs to be reset +* otherwise a frame could come in CPU queue between the while +* condition and the check for error later on. And in that case +* the new frame is just removed and not processed. +*/ + err =0 ; +ocelot_parse_ifh (ifh, &info); ocelot_port = ocelot->ports[info.port];
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 41/66 efi: Only print errors about failing to get certs if EFI vars are found
In reply to Sasha LevinFrom: Javier Martinez Canillas <[email protected]>
[ Upstream commit 3be54d558c75562e42bc83d665df024bd79d399b ]
If CONFIG_LOAD_UEFI_KEYS is enabled, the kernel attempts to load the certs from the db, dbx and MokListRT EFI variables into the appropriate keyrings.
But it just assumes that the variables will be present and prints an error if the certs can't be loaded, even when is possible that the variables may not exist. For example the MokListRT variable will only be present if shim is used.
So only print an error message about failing to get the certs list from an EFI variable if this is found. Otherwise these printed errors just pollute the kernel log ring buffer with confusing messages like the following:
[ 5.427251] Couldn't get size: 0x800000000000000e [ 5.427261] MODSIGN: Couldn't get UEFI db list [ 5.428012] Couldn't get size: 0x800000000000000e [ 5.428023] Couldn't get UEFI MokListRT
--- security/integrity/platform_certs/load_uefi.c | 40 ++++++++++++------- 1 file changed, 26 insertions(+), 14 deletions(-)
security/integrity/platform_certs/load_uefi.c +26 -14
@@ -35,16 +35,18 @@ static __init bool uefi_check_ignore_db(void)* Get a certificate list blob from the named EFI variable. */ static __init void *get_cert_list (efi_char16_t *name,efi_guid_t *guid, -unsigned long *size) +unsigned long *size,efi_status_t *status) { -efi_status_t status;unsigned long lsize =4 ;unsigned long tmpdb[4 ];void *db; - status = efi.get_variable (name, guid,NULL , &lsize, &tmpdb); -if (status !=EFI_BUFFER_TOO_SMALL ) { -pr_err ("Couldn't get size: 0x%lx\n" , status); + *status = efi.get_variable (name, guid,NULL , &lsize, &tmpdb); +if (*status ==EFI_NOT_FOUND ) +return NULL ; + +if (*status !=EFI_BUFFER_TOO_SMALL ) { +pr_err ("Couldn't get size: 0x%lx\n" , *status);return NULL ; }
@@ -52,10 +54,10 @@ static __init void *get_cert_list(efi_char16_t *name, efi_guid_t *guid,if (!db)return NULL ; - status = efi.get_variable (name, guid,NULL , &lsize, db); -if (status !=EFI_SUCCESS ) { + *status = efi.get_variable (name, guid,NULL , &lsize, db); +if (*status !=EFI_SUCCESS ) {kfree (db); -pr_err ("Error reading db var: 0x%lx\n" , status); +pr_err ("Error reading db var: 0x%lx\n" , *status);return NULL ; }
@@ -74,6 +76,7 @@ static int __init load_uefi_certs(void)efi_guid_t mok_var =EFI_SHIM_LOCK_GUID ;void *db =NULL , *dbx =NULL , *mok =NULL ;unsigned long dbsize =0 , dbxsize =0 , moksize =0 ; +efi_status_t status;int rc =0 ;if (!efi.get_variable)
@@ -83,9 +86,12 @@ static int __init load_uefi_certs(void)* an error if we can't get them. */ if (!uefi_check_ignore_db ()) { - db =get_cert_list (L"db" , &secure_var, &dbsize); + db =get_cert_list (L"db" , &secure_var, &dbsize, &status);if (!db) { -pr_err ("MODSIGN: Couldn't get UEFI db list\n" ); +if (status ==EFI_NOT_FOUND ) +pr_debug ("MODSIGN: db variable wasn't found\n" ); +else +pr_err ("MODSIGN: Couldn't get UEFI db list\n" ); }else { rc =parse_efi_signature_list ("UEFI:db" , db, dbsize, get_handler_for_db);
@@ -96,9 +102,12 @@ static int __init load_uefi_certs(void) } } - mok =get_cert_list (L"MokListRT" , &mok_var, &moksize); + mok =get_cert_list (L"MokListRT" , &mok_var, &moksize, &status);if (!mok) { -pr_info ("Couldn't get UEFI MokListRT\n" ); +if (status ==EFI_NOT_FOUND ) +pr_debug ("MokListRT variable wasn't found\n" ); +else +pr_info ("Couldn't get UEFI MokListRT\n" ); }else { rc =parse_efi_signature_list ("UEFI:MokListRT" , mok, moksize, get_handler_for_db);
@@ -107,9 +116,12 @@ static int __init load_uefi_certs(void)kfree (mok); } - dbx =get_cert_list (L"dbx" , &secure_var, &dbxsize); + dbx =get_cert_list (L"dbx" , &secure_var, &dbxsize, &status);if (!dbx) { -pr_info ("Couldn't get UEFI dbx list\n" ); +if (status ==EFI_NOT_FOUND ) +pr_debug ("dbx variable wasn't found\n" ); +else +pr_info ("Couldn't get UEFI dbx list\n" ); }else { rc = parse_efi_signature_list("UEFI:dbx", dbx, dbxsize,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 42/66 qede: Fix race between rdma destroy workqueue and link change event
In reply to Sasha LevinFrom: Michal Kalderon <[email protected]>
[ Upstream commit af6565adb02d3129d3fae4d9d5da945abaf4417a ]
If an event is added while the rdma workqueue is being destroyed it could lead to several races, list corruption, null pointer dereference during queue_work or init_queue.
This fixes the race between the two flows which can occur during shutdown.
A kref object and a completion object are added to the rdma_dev structure, these are initialized before the workqueue is created. The refcnt is used to indicate work is being added to the workqueue and ensures the cleanup flow won't start while we're in the middle of adding the event.
Once the work is added, the refcnt is decreased and the cleanup flow is safe to run.
--- drivers/net/ethernet/qlogic/qede/qede.h | 2 ++ drivers/net/ethernet/qlogic/qede/qede_rdma.c | 29 +++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-)
drivers/net/ethernet/qlogic/qede/qede.h +2 -0
@@ -163,6 +163,8 @@ struct qede_rdma_dev {struct list_head entry;struct list_head rdma_event_list;struct workqueue_struct *rdma_wq; +struct kref refcnt; +struct completion event_comp;bool exp_recovery; };
drivers/net/ethernet/qlogic/qede/qede_rdma.c +28 -1
@@ -59,6 +59,9 @@ static void _qede_rdma_dev_add(struct qede_dev *edev)static int qede_rdma_create_wq (struct qede_dev *edev) {INIT_LIST_HEAD (&edev->rdma_info.rdma_event_list); +kref_init (&edev->rdma_info.refcnt); +init_completion (&edev->rdma_info.event_comp); + edev->rdma_info.rdma_wq =create_singlethread_workqueue ("rdma_wq" );if (!edev->rdma_info.rdma_wq) {DP_NOTICE (edev,"qedr: Could not create workqueue\n" );
@@ -83,8 +86,23 @@ static void qede_rdma_cleanup_event(struct qede_dev *edev) } } +static void qede_rdma_complete_event (struct kref *ref) +{ +struct qede_rdma_dev *rdma_dev = + container_of(ref, struct qede_rdma_dev, refcnt); + +/* no more events will be added after this */ +complete (&rdma_dev->event_comp); +} +static void qede_rdma_destroy_wq (struct qede_dev *edev) { +/* Avoid race with add_event flow, make sure it finishes before +* we start accessing the list and cleaning up the work +*/ +kref_put (&edev->rdma_info.refcnt, qede_rdma_complete_event); +wait_for_completion (&edev->rdma_info.event_comp); +qede_rdma_cleanup_event (edev);destroy_workqueue (edev->rdma_info.rdma_wq); }
@@ -310,15 +328,24 @@ static void qede_rdma_add_event(struct qede_dev *edev,if (!edev->rdma_info.qedr_dev)return ; +/* We don't want the cleanup flow to start while we're allocating and +* scheduling the work +*/ +if (!kref_get_unless_zero (&edev->rdma_info.refcnt)) +return ;/* already being destroyed */ + event_node =qede_rdma_get_free_event_node (edev);if (!event_node) -return ; + goto out; event_node->event = event; event_node->ptr = edev;INIT_WORK (&event_node->work, qede_rdma_handle_event);queue_work (edev->rdma_info.rdma_wq, &event_node->work); + +out: +kref_put (&edev->rdma_info.refcnt, qede_rdma_complete_event); }void qede_rdma_dev_event_open (struct qede_dev *edev)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 43/66 net/mlx5: DR, Fix matching on vport gvmi
In reply to Sasha LevinFrom: Hamdan Igbaria <[email protected]>
[ Upstream commit 52d214976d4f64504c1bbb52d47b46a5a3d5ee42 ]
Set vport gvmi in the tag, only when source gvmi is set in the bit mask.
--- drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c +4 -1
@@ -2307,7 +2307,9 @@ static int dr_ste_build_src_gvmi_qpn_tag(struct mlx5dr_match_param *value,struct mlx5dr_cmd_vport_cap *vport_cap;struct mlx5dr_domain *dmn = sb->dmn;struct mlx5dr_cmd_caps *caps; +u8 *bit_mask = sb->bit_mask;u8 *tag = hw_ste->tag; +bool source_gvmi_set;DR_STE_SET_TAG (src_gvmi_qp, tag, source_qp, misc, source_sqn);
@@ -2328,7 +2330,8 @@ static int dr_ste_build_src_gvmi_qpn_tag(struct mlx5dr_match_param *value,if (!vport_cap)return -EINVAL ; -if (vport_cap->vport_gvmi) + source_gvmi_set =MLX5_GET (ste_src_gvmi_qp, bit_mask, source_gvmi); +if (vport_cap->vport_gvmi && source_gvmi_set)MLX5_SET (ste_src_gvmi_qp, tag, source_gvmi, vport_cap->vport_gvmi); misc->source_eswitch_owner_vhca_id =0 ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 44/66 iommu/amd: Disable IOMMU on Stoney Ridge systems
In reply to Sasha LevinFrom: Kai-Heng Feng <[email protected]>
[ Upstream commit 3dfee47b215e49788cfc80e474820ea2e948c031 ]
Serious screen flickering when Stoney Ridge outputs to a 4K monitor.
Use identity-mapping and PCI ATS doesn't help this issue.
According to Alex Deucher, IOMMU isn't enabled on Windows, so let's do the same here to avoid screen flickering on 4K monitor.
--- drivers/iommu/amd_iommu_init.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/iommu/amd_iommu_init.c +12 -1
@@ -2533,6 +2533,7 @@ static int __init early_amd_iommu_init(void)struct acpi_table_header *ivrs_base;acpi_status status;int i, remap_cache_sz, ret =0 ; +u32 pci_id;if (!amd_iommu_detected)return -ENODEV ;
@@ -2620,6 +2621,16 @@ static int __init early_amd_iommu_init(void)if (ret) goto out; +/* Disable IOMMU if there's Stoney Ridge graphics */ +for (i =0 ; i <32 ; i++) { + pci_id =read_pci_config (0 , i,0 ,0 ); +if ((pci_id &0xffff ) ==0x1002 && (pci_id >>16 ) ==0x98e4 ) { +pr_info ("Disable IOMMU on Stoney Ridge\n" ); + amd_iommu_disabled = true; +break ; + } + } +/* Disable any previously enabled IOMMUs */ if (!is_kdump_kernel () || amd_iommu_disabled)disable_iommus ();
@@ -2728,7 +2739,7 @@ static int __init state_next(void) ret =early_amd_iommu_init (); init_state = ret ?IOMMU_INIT_ERROR :IOMMU_ACPI_FINISHED ;if (init_state ==IOMMU_ACPI_FINISHED && amd_iommu_disabled) { -pr_info ("AMD IOMMU disabled on kernel command-line\n" ); +pr_info ("AMD IOMMU disabled\n" ); init_state =IOMMU_CMDLINE_DISABLED ; ret = -EINVAL ; }
Signature · 6 lines
2.20.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Sasha Levin
maintainerPATCH 45/66 nvme/pci: Add sleep quirk for Samsung and Toshiba drives
In reply to Sasha LevinFrom: Shyjumon N <[email protected]>
[ Upstream commit 1fae37accfc5872af3905d4ba71dc6ab15829be7 ]
The Samsung SSD SM981/PM981 and Toshiba SSD KBG40ZNT256G on the Lenovo C640 platform experience runtime resume issues when the SSDs are kept in sleep/suspend mode for long time.
This patch applies the 'Simple Suspend' quirk to these configurations. With this patch, the issue had not been observed in a 1+ day test.
--- drivers/nvme/host/pci.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/nvme/host/pci.c +12 -0
@@ -2734,6 +2734,18 @@ static unsigned long check_vendor_combination_bug(struct pci_dev *pdev) (dmi_match(DMI_BOARD_NAME, "PRIME B350M-A") || dmi_match(DMI_BOARD_NAME, "PRIME Z370-A")))return NVME_QUIRK_NO_APST ; + }else if ((pdev->vendor ==0x144d && (pdev->device ==0xa801 || + pdev->device ==0xa808 || pdev->device ==0xa809 )) || + (pdev->vendor ==0x1e0f && pdev->device ==0x0001 )) { +/* +* Forcing to use host managed nvme power settings for +* lowest idle power with quick resume latency on +* Samsung and Toshiba SSDs based on suspend behavior +* on Coffee Lake board for LENOVO C640 +*/ +if ((dmi_match (DMI_BOARD_VENDOR ,"LENOVO" )) && +dmi_match (DMI_BOARD_NAME ,"LNVNB161216" )) +return NVME_QUIRK_SIMPLE_SUSPEND ; }return 0 ;
Signature · 7 lines
2.20.1 _______________________________________________ linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Sasha Levin
maintainerPATCH 46/66 nvme-pci: Use single IRQ vector for old Apple models
In reply to Sasha LevinFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 98f7b86a0becc1154b1a6df6e75c9695dfd87e0d ]
People reported that old Apple machines are not working properly if the non-first IRQ vector is in use.
Set quirk for that models to limit IRQ to use first vector only.
Based on original patch by GitHub user npx001.
--- drivers/nvme/host/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/host/pci.c +2 -1
@@ -3108,7 +3108,8 @@ static const struct pci_device_id nvme_id_table[] = { .driver_data = NVME_QUIRK_NO_DEEPEST_PS | NVME_QUIRK_IGNORE_DEV_SUBNQN, }, { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) }, - { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001) }, + { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001), + .driver_data = NVME_QUIRK_SINGLE_VECTOR }, { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2003) }, { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2005), .driver_data = NVME_QUIRK_SINGLE_VECTOR |
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 47/66 x86/boot/compressed: Don't declare __force_order in kaslr_64.c
In reply to Sasha LevinFrom: "H.J. Lu" <[email protected]>
[ Upstream commit df6d4f9db79c1a5d6f48b59db35ccd1e9ff9adfc ]
GCC 10 changed the default to -fno-common, which leads to
LD arch/x86/boot/compressed/vmlinux
ld: arch/x86/boot/compressed/pgtable_64.o:(.bss+0x0): multiple definition of `__force_order'; \
arch/x86/boot/compressed/kaslr_64.o:(.bss+0x0): first defined here make[2]: *** [arch/x86/boot/compressed/Makefile:119: arch/x86/boot/compressed/vmlinux] Error 1
Since __force_order is already provided in pgtable_64.c, there is no need to declare __force_order in kaslr_64.c.
--- arch/x86/boot/compressed/kaslr_64.c | 3 --- 1 file changed, 3 deletions(-)
arch/x86/boot/compressed/kaslr_64.c +0 -3
@@ -29,9 +29,6 @@#define __PAGE_OFFSET __PAGE_OFFSET_BASE#include "../../mm/ident_map.c" -/* Used by pgtable.h asm code to force instruction serialization. */ -unsigned long __force_order; -/* Used to track our page table allocation area. */ struct alloc_pgt_data {unsigned char *pgt_buf;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 48/66 s390/qdio: fill SL with absolute addresses
In reply to Sasha LevinFrom: Julian Wiedmann <[email protected]>
[ Upstream commit e9091ffd6a0aaced111b5d6ead5eaab5cd7101bc ]
As the comment says, sl->sbal holds an absolute address. qeth currently solves this through wild casting, while zfcp doesn't care.
Handle this properly in the code that actually builds the SL.
--- arch/s390/include/asm/qdio.h | 2 +- drivers/s390/cio/qdio_setup.c | 3 ++- drivers/s390/net/qeth_core_main.c | 23 +++++++++++------------ 3 files changed, 14 insertions(+), 14 deletions(-)
arch/s390/include/asm/qdio.h +1 -1
@@ -227,7 +227,7 @@ struct qdio_buffer {* @sbal: absolute SBAL address */ struct sl_element { -unsigned long sbal; +u64 sbal; } __attribute__ ((packed));/**
drivers/s390/cio/qdio_setup.c +2 -1
@@ -8,6 +8,7 @@#include <linux/kernel.h> #include <linux/slab.h> #include <linux/export.h> +#include <linux/io.h> #include <asm/qdio.h> #include "cio.h"
@@ -205,7 +206,7 @@ static void setup_storage_lists(struct qdio_q *q, struct qdio_irq *irq_ptr,/* fill in sl */ for (j =0 ; j <QDIO_MAX_BUFFERS_PER_Q ; j++) - q->sl->element[j].sbal = (unsigned long )q->sbal[j]; + q->sl->element[j].sbal =virt_to_phys (q->sbal[j]); } static void setup_queues(struct qdio_irq *irq_ptr,
drivers/s390/net/qeth_core_main.c +11 -12
@@ -4749,10 +4749,10 @@ static void qeth_qdio_establish_cq(struct qeth_card *card,if (card->options.cq ==QETH_CQ_ENABLED ) {int offset =QDIO_MAX_BUFFERS_PER_Q * (card->qdio.no_in_queues -1 ); -for (i =0 ; i <QDIO_MAX_BUFFERS_PER_Q ; ++i) { - in_sbal_ptrs[offset + i] = (struct qdio_buffer *) -virt_to_phys (card->qdio.c_q->bufs[i].buffer); - } + +for (i =0 ; i <QDIO_MAX_BUFFERS_PER_Q ; i++) + in_sbal_ptrs[offset + i] = + card->qdio.c_q->bufs[i].buffer; queue_start_poll[card->qdio.no_in_queues -1 ] =NULL ; }
@@ -4786,10 +4786,9 @@ static int qeth_qdio_establish(struct qeth_card *card) rc = -ENOMEM ; goto out_free_qib_param; } -for (i =0 ; i <QDIO_MAX_BUFFERS_PER_Q ; ++i) { - in_sbal_ptrs[i] = (struct qdio_buffer *) -virt_to_phys (card->qdio.in_q->bufs[i].buffer); - } + +for (i =0 ; i <QDIO_MAX_BUFFERS_PER_Q ; i++) + in_sbal_ptrs[i] = card->qdio.in_q->bufs[i].buffer; queue_start_poll =kcalloc (card->qdio.no_in_queues,sizeof (void *),GFP_KERNEL );
@@ -4810,11 +4809,11 @@ static int qeth_qdio_establish(struct qeth_card *card) rc = -ENOMEM ; goto out_free_queue_start_poll; } +for (i =0 , k =0 ; i < card->qdio.no_out_queues; ++i) -for (j =0 ; j <QDIO_MAX_BUFFERS_PER_Q ; ++j, ++k) { - out_sbal_ptrs[k] = (struct qdio_buffer *)virt_to_phys ( - card->qdio.out_qs[i]->bufs[j]->buffer); - } +for (j =0 ; j <QDIO_MAX_BUFFERS_PER_Q ; j++, k++) + out_sbal_ptrs[k] = + card->qdio.out_qs[i]->bufs[j]->buffer;memset (&init_data,0 ,sizeof (struct qdio_initialize )); init_data.cdev =CARD_DDEV (card);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 49/66 nvme: Fix uninitialized-variable warning
In reply to Sasha LevinFrom: Keith Busch <[email protected]>
[ Upstream commit 15755854d53b4bbb0bb37a0fce66f0156cfc8a17 ]
gcc may detect a false positive on nvme using an unintialized variable if setting features fails. Since this is not a fast path, explicitly initialize this variable to suppress the warning.
--- drivers/nvme/host/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/core.c +1 -1
@@ -1165,8 +1165,8 @@ static int nvme_identify_ns(struct nvme_ctrl *ctrl,static int nvme_features (struct nvme_ctrl *dev,u8 op,unsigned int fid,unsigned int dword11,void *buffer,size_t buflen,u32 *result) { +union nvme_result res = {0 };struct nvme_command c; -union nvme_result res;int ret;memset (&c,0 ,sizeof (c));
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 50/66 nfc: pn544: Fix occasional HW initialization failure
In reply to Sasha LevinFrom: Dmitry Osipenko <[email protected]>
[ Upstream commit c3331d2fe3fd4d5e321f2467d01f72de7edfb5d0 ]
The PN544 driver checks the "enable" polarity during of driver's probe and it's doing that by turning ON and OFF NFC with different polarities until enabling succeeds. It takes some time for the hardware to power-down, and thus, to deassert the IRQ that is raised by turning ON the hardware. Since the delay after last power-down of the polarity-checking process is missed in the code, the interrupt may trigger immediately after installing the IRQ handler (right after the checking is done), which results in IRQ handler trying to touch the disabled HW and ends with marking NFC as 'DEAD' during of the driver's probe:
pn544_hci_i2c 1-002a: NFC: nfc_en polarity : active high pn544_hci_i2c 1-002a: NFC: invalid len byte
shdlc: llc_shdlc_recv_frame: NULL Frame -> link is dead
This patch fixes the occasional NFC initialization failure on Nexus 7 device.
--- drivers/nfc/pn544/i2c.c | 1 + 1 file changed, 1 insertion(+)
drivers/nfc/pn544/i2c.c +1 -0
@@ -225,6 +225,7 @@ static void pn544_hci_i2c_platform_init(struct pn544_i2c_phy *phy) out:gpiod_set_value_cansleep (phy->gpiod_en, !phy->en_polarity); +usleep_range (10000 ,15000 ); }static void pn544_hci_i2c_enable_mode (struct pn544_i2c_phy *phy,int run_mode)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 51/66 ice: Don't tell the OS that link is going down
In reply to Sasha LevinFrom: Michal Swiatkowski <[email protected]>
[ Upstream commit 8a55c08d3bbc9ffc9639f69f742e59ebd99f913b ]
Remove code that tell the OS that link is going down when user change flow control via ethtool. When link is up it isn't certain that link goes down after 0x0605 aq command. If link doesn't go down, OS thinks that link is down, but physical link is up. To reset this state user have to take interface down and up.
If link goes down after 0x0605 command, FW send information about that and after that driver tells the OS that the link goes down. So this code in ethtool is unnecessary.
--- drivers/net/ethernet/intel/ice/ice_ethtool.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/net/ethernet/intel/ice/ice_ethtool.c +0 -7
@@ -2966,13 +2966,6 @@ ice_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *pause)else return -EINVAL ; -/* Tell the OS link is going down, the link will go back up when fw -* says it is ready asynchronously -*/ -ice_print_link_msg (vsi, false); -netif_carrier_off (netdev); -netif_tx_stop_all_queues (netdev); -/* Set the FC mode and only restart AN if link is up */ status =ice_set_fc (pi, &aq_failures, link_up);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 52/66 x86/xen: Distribute switch variables for initialization
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit 9038ec99ceb94fb8d93ade5e236b2928f0792c7c ]
Variables declared in a switch statement before any case statements cannot be automatically initialized with compiler instrumentation (as they are not part of any execution flow). With GCC's proposed automatic stack variable initialization feature, this triggers a warning (and they don't get initialized). Clang's automatic stack variable initialization (via CONFIG_INIT_STACK_ALL=y) doesn't throw a warning, but it also doesn't initialize such variables[1]. Note that these warnings (or silent skipping) happen before the dead-store elimination optimization phase, so even when the automatic initializations are later elided in favor of direct initializations, the warnings remain.
To avoid these problems, move such variables into the "case" where they're used or lift them up into the main function body.
arch/x86/xen/enlighten_pv.c: In function ‘xen_write_msr_safe’:arch/x86/xen/enlighten_pv.c:904:12: warning: statement will never be executed [-Wswitch-unreachable]
904 | unsigned which;
| ^~~~~[1] https://bugs.llvm.org/show_bug.cgi?id=44916
--- arch/x86/xen/enlighten_pv.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
arch/x86/xen/enlighten_pv.c +4 -3
@@ -896,14 +896,15 @@ static u64 xen_read_msr_safe(unsigned int msr, int *err)static int xen_write_msr_safe (unsigned int msr,unsigned low,unsigned high) {int ret; +#ifdef CONFIG_X86_64 +unsigned int which; +u64 base; +#endif ret =0 ;switch (msr) {#ifdef CONFIG_X86_64 -unsigned which; -u64 base; -case MSR_FS_BASE : which =SEGBASE_FS ; goto set;case MSR_KERNEL_GS_BASE : which =SEGBASE_GS_USER ; goto set;case MSR_GS_BASE : which =SEGBASE_GS_KERNEL ; goto set;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 53/66 s390/qeth: vnicc Fix EOPNOTSUPP precedence
In reply to Sasha LevinFrom: Alexandra Winter <[email protected]>
[ Upstream commit 6f3846f0955308b6d1b219419da42b8de2c08845 ]
When getting or setting VNICC parameters, the error code EOPNOTSUPP should have precedence over EBUSY.
EBUSY is used because vnicc feature and bridgeport feature are mutually exclusive, which is a temporary condition.
Whereas EOPNOTSUPP indicates that the HW does not support all or parts of the vnicc feature.
This issue causes the vnicc sysfs params to show 'blocked by bridgeport' for HW that does not support VNICC at all.
--- drivers/s390/net/qeth_l2_main.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-)
drivers/s390/net/qeth_l2_main.c +13 -16
@@ -1815,15 +1815,14 @@ int qeth_l2_vnicc_set_state(struct qeth_card *card, u32 vnicc, bool state)QETH_CARD_TEXT (card,2 ,"vniccsch" ); -/* do not change anything if BridgePort is enabled */ -if (qeth_bridgeport_is_in_use (card)) -return -EBUSY ; -/* check if characteristic and enable/disable are supported */ if (!(card->options.vnicc.sup_chars & vnicc) || !(card->options.vnicc.set_char_sup & vnicc))return -EOPNOTSUPP ; +if (qeth_bridgeport_is_in_use (card)) +return -EBUSY ; +/* set enable/disable command and store wanted characteristic */ if (state) { cmd =IPA_VNICC_ENABLE ;
@@ -1869,14 +1868,13 @@ int qeth_l2_vnicc_get_state(struct qeth_card *card, u32 vnicc, bool *state)QETH_CARD_TEXT (card,2 ,"vniccgch" ); -/* do not get anything if BridgePort is enabled */ -if (qeth_bridgeport_is_in_use (card)) -return -EBUSY ; -/* check if characteristic is supported */ if (!(card->options.vnicc.sup_chars & vnicc))return -EOPNOTSUPP ; +if (qeth_bridgeport_is_in_use (card)) +return -EBUSY ; +/* if card is ready, query current VNICC state */ if (qeth_card_hw_is_reachable (card)) rc =qeth_l2_vnicc_query_chars (card);
@@ -1894,15 +1892,14 @@ int qeth_l2_vnicc_set_timeout(struct qeth_card *card, u32 timeout)QETH_CARD_TEXT (card,2 ,"vniccsto" ); -/* do not change anything if BridgePort is enabled */ -if (qeth_bridgeport_is_in_use (card)) -return -EBUSY ; -/* check if characteristic and set_timeout are supported */ if (!(card->options.vnicc.sup_chars &QETH_VNICC_LEARNING ) || !(card->options.vnicc.getset_timeout_sup &QETH_VNICC_LEARNING ))return -EOPNOTSUPP ; +if (qeth_bridgeport_is_in_use (card)) +return -EBUSY ; +/* do we need to do anything? */ if (card->options.vnicc.learning_timeout == timeout)return rc;
@@ -1931,14 +1928,14 @@ int qeth_l2_vnicc_get_timeout(struct qeth_card *card, u32 *timeout)QETH_CARD_TEXT (card,2 ,"vniccgto" ); -/* do not get anything if BridgePort is enabled */ -if (qeth_bridgeport_is_in_use (card)) -return -EBUSY ; -/* check if characteristic and get_timeout are supported */ if (!(card->options.vnicc.sup_chars &QETH_VNICC_LEARNING ) || !(card->options.vnicc.getset_timeout_sup &QETH_VNICC_LEARNING ))return -EOPNOTSUPP ; + +if (qeth_bridgeport_is_in_use (card)) +return -EBUSY ; +/* if card is ready, get timeout. Otherwise, just return stored value */ *timeout = card->options.vnicc.learning_timeout;if (qeth_card_hw_is_reachable (card))
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 54/66 s390/qeth: fix off-by-one in RX copybreak check
In reply to Sasha LevinFrom: Julian Wiedmann <[email protected]>
[ Upstream commit 54a61fbc020fd2e305680871c453abcf7fc0339b ]
The RX copybreak is intended as the _max_ value where the frame's data should be copied. So for frame_len == copybreak, don't build an SG skb.
--- drivers/s390/net/qeth_core_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/net/qeth_core_main.c +1 -1
@@ -5141,7 +5141,7 @@ struct sk_buff *qeth_core_get_next_skb(struct qeth_card *card, } use_rx_sg = (card->options.cq ==QETH_CQ_ENABLED ) || - ((skb_len >= card->options.rx_sg_cb) && + (skb_len > card->options.rx_sg_cb && !atomic_read (&card->force_alloc_skb) && !IS_OSN (card));
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 55/66 net: macb: Properly handle phylink on at91rm9200
In reply to Sasha LevinFrom: Alexandre Belloni <[email protected]>
[ Upstream commit ac2fcfa9fd26db67d7000677c05629c34cc94564 ]
at91ether_init was handling the phy mode and speed but since the switch to phylink, the NCFGR register got overwritten by macb_mac_config(). The issue is that the RM9200_RMII bit and the MACB_CLK_DIV32 field are cleared but never restored as they conflict with the PAE, GBE and PCSSEL bits.
Add new capability to differentiate between EMAC and the other versions of the IP and use it to set and avoid clearing the relevant bits.
Also, this fixes a NULL pointer dereference in macb_mac_link_up as the EMAC doesn't use any rings/bufffers/queues.
--- drivers/net/ethernet/cadence/macb.h | 1 + drivers/net/ethernet/cadence/macb_main.c | 60 +++++++++++++----------- 2 files changed, 33 insertions(+), 28 deletions(-)
drivers/net/ethernet/cadence/macb.h +1 -0
@@ -645,6 +645,7 @@#define MACB_CAPS_GEM_HAS_PTP 0x00000040#define MACB_CAPS_BD_RD_PREFETCH 0x00000080#define MACB_CAPS_NEEDS_RSTONUBR 0x00000100 +#define MACB_CAPS_MACB_IS_EMAC 0x08000000#define MACB_CAPS_FIFO_MODE 0x10000000#define MACB_CAPS_GIGABIT_MODE_AVAILABLE 0x20000000#define MACB_CAPS_SG_DISABLED 0x40000000
drivers/net/ethernet/cadence/macb_main.c +32 -28
104 lines not on this page · raw message
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 56/66 ionic: fix fw_status read
In reply to Sasha LevinFrom: Shannon Nelson <[email protected]>
[ Upstream commit 68b759a75d6257759d1e37ff13f2d0659baf1112 ]
The fw_status field is only 8 bits, so fix the read. Also, we only want to look at the one status bit, to allow for future use of the other bits, and watch for a bad PCI read.
--- drivers/net/ethernet/pensando/ionic/ionic_dev.c | 11 +++++++---- drivers/net/ethernet/pensando/ionic/ionic_if.h | 1 + 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/net/ethernet/pensando/ionic/ionic_dev.c +7 -4
@@ -103,7 +103,7 @@ int ionic_heartbeat_check(struct ionic *ionic) {struct ionic_dev *idev = &ionic->idev;unsigned long hb_time; -u32 fw_status; +u8 fw_status;u32 hb;/* wait a little more than one second before testing again */
@@ -111,9 +111,12 @@ int ionic_heartbeat_check(struct ionic *ionic)if (time_before (hb_time, (idev->last_hb_time + ionic->watchdog_period)))return 0 ; -/* firmware is useful only if fw_status is non-zero */ - fw_status =ioread32 (&idev->dev_info_regs->fw_status); -if (!fw_status) +/* firmware is useful only if the running bit is set and +* fw_status != 0xff (bad PCI read) +*/ + fw_status =ioread8 (&idev->dev_info_regs->fw_status); +if (fw_status ==0xff || + !(fw_status &IONIC_FW_STS_F_RUNNING ))return -ENXIO ;/* early FW has no heartbeat, else FW will return non-zero */
drivers/net/ethernet/pensando/ionic/ionic_if.h +1 -0
@@ -2348,6 +2348,7 @@ union ionic_dev_info_regs {u8 version;u8 asic_type;u8 asic_rev; +#define IONIC_FW_STS_F_RUNNING 0x1u8 fw_status;u32 fw_heartbeat;char fw_version[IONIC_DEVINFO_FWVERS_BUFLEN ];
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 57/66 net: thunderx: workaround BGX TX Underflow issue
In reply to Sasha LevinFrom: Tim Harvey <[email protected]>
[ Upstream commit 971617c3b761c876d686a2188220a33898c90e99 ]
While it is not yet understood why a TX underflow can easily occur for SGMII interfaces resulting in a TX wedge. It has been found that disabling/re-enabling the LMAC resolves the issue.
--- .../net/ethernet/cavium/thunder/thunder_bgx.c | 62 ++++++++++++++++++- .../net/ethernet/cavium/thunder/thunder_bgx.h | 9 +++ 2 files changed, 68 insertions(+), 3 deletions(-)
drivers/net/ethernet/cavium/thunder/thunder_bgx.c +59 -3
@@ -410,10 +410,19 @@ void bgx_lmac_rx_tx_enable(int node, int bgx_idx, int lmacid, bool enable) lmac = &bgx->lmac[lmacid]; cfg =bgx_reg_read (bgx, lmacid,BGX_CMRX_CFG ); -if (enable) +if (enable) { cfg |=CMR_PKT_RX_EN |CMR_PKT_TX_EN ; -else + +/* enable TX FIFO Underflow interrupt */ +bgx_reg_modify (bgx, lmacid,BGX_GMP_GMI_TXX_INT_ENA_W1S , +GMI_TXX_INT_UNDFLW ); + }else { cfg &= ~(CMR_PKT_RX_EN |CMR_PKT_TX_EN ); + +/* Disable TX FIFO Underflow interrupt */ +bgx_reg_modify (bgx, lmacid,BGX_GMP_GMI_TXX_INT_ENA_W1C , +GMI_TXX_INT_UNDFLW ); + }bgx_reg_write (bgx, lmacid,BGX_CMRX_CFG , cfg);if (bgx->is_rgx)
@@ -1535,6 +1544,48 @@ static int bgx_init_phy(struct bgx *bgx)return bgx_init_of_phy (bgx); } +static irqreturn_t bgx_intr_handler (int irq,void *data) +{ +struct bgx *bgx = (struct bgx *)data; +u64 status, val; +int lmac; + +for (lmac =0 ; lmac < bgx->lmac_count; lmac++) { + status =bgx_reg_read (bgx, lmac,BGX_GMP_GMI_TXX_INT ); +if (status &GMI_TXX_INT_UNDFLW ) { +pci_err (bgx->pdev,"BGX%d lmac%d UNDFLW\n" , + bgx->bgx_id, lmac); + val =bgx_reg_read (bgx, lmac,BGX_CMRX_CFG ); + val &= ~CMR_EN ; +bgx_reg_write (bgx, lmac,BGX_CMRX_CFG , val); + val |=CMR_EN ; +bgx_reg_write (bgx, lmac,BGX_CMRX_CFG , val); + } +/* clear interrupts */ +bgx_reg_write (bgx, lmac,BGX_GMP_GMI_TXX_INT , status); + } + +return IRQ_HANDLED ; +} + +static void bgx_register_intr (struct pci_dev *pdev) +{ +struct bgx *bgx =pci_get_drvdata (pdev); +int ret; + + ret =pci_alloc_irq_vectors (pdev,BGX_LMAC_VEC_OFFSET , +BGX_LMAC_VEC_OFFSET ,PCI_IRQ_ALL_TYPES ); +if (ret <0 ) { +pci_err (pdev,"Req for #%d msix vectors failed\n" , +BGX_LMAC_VEC_OFFSET ); +return ; + } + ret =pci_request_irq (pdev,GMPX_GMI_TX_INT , bgx_intr_handler,NULL , + bgx,"BGX%d" , bgx->bgx_id); +if (ret) +pci_free_irq (pdev,GMPX_GMI_TX_INT , bgx); +} +static int bgx_probe (struct pci_dev *pdev,const struct pci_device_id *ent) {int err;
@@ -1550,7 +1601,7 @@ static int bgx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)pci_set_drvdata (pdev, bgx); - err =pci_enable_device (pdev); + err =pcim_enable_device (pdev);if (err) {dev_err (dev,"Failed to enable PCI device\n" );pci_set_drvdata (pdev,NULL );
@@ -1604,6 +1655,8 @@ static int bgx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)bgx_init_hw (bgx); +bgx_register_intr (pdev); +/* Enable all LMACs */ for (lmac =0 ; lmac < bgx->lmac_count; lmac++) { err =bgx_lmac_enable (bgx, lmac);
@@ -1620,6 +1673,7 @@ static int bgx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) err_enable: bgx_vnic[bgx->bgx_id] =NULL ; +pci_free_irq (pdev,GMPX_GMI_TX_INT , bgx); err_release_regions:pci_release_regions (pdev); err_disable_device:
@@ -1637,6 +1691,8 @@ static void bgx_remove(struct pci_dev *pdev)for (lmac =0 ; lmac < bgx->lmac_count; lmac++)bgx_lmac_disable (bgx, lmac); +pci_free_irq (pdev,GMPX_GMI_TX_INT , bgx); + bgx_vnic[bgx->bgx_id] =NULL ;pci_release_regions (pdev);pci_disable_device (pdev);
drivers/net/ethernet/cavium/thunder/thunder_bgx.h +9 -0
@@ -180,6 +180,15 @@#define BGX_GMP_GMI_TXX_BURST 0x38228#define BGX_GMP_GMI_TXX_MIN_PKT 0x38240#define BGX_GMP_GMI_TXX_SGMII_CTL 0x38300 +#define BGX_GMP_GMI_TXX_INT 0x38500 +#define BGX_GMP_GMI_TXX_INT_W1S 0x38508 +#define BGX_GMP_GMI_TXX_INT_ENA_W1C 0x38510 +#define BGX_GMP_GMI_TXX_INT_ENA_W1S 0x38518 +#define GMI_TXX_INT_PTP_LOST BIT_ULL(4) +#define GMI_TXX_INT_LATE_COL BIT_ULL(3) +#define GMI_TXX_INT_XSDEF BIT_ULL(2) +#define GMI_TXX_INT_XSCOL BIT_ULL(1) +#define GMI_TXX_INT_UNDFLW BIT_ULL(0)#define BGX_MSIX_VEC_0_29_ADDR 0x400000/* +(0..29) << 4 */ #define BGX_MSIX_VEC_0_29_CTL 0x400008
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 58/66 bnxt_en: Improve device shutdown method.
In reply to Sasha LevinFrom: Vasundhara Volam <[email protected]>
[ Upstream commit 5567ae4a8d569d996d0d88d0eceb76205e4c7ce5 ]
Especially when bnxt_shutdown() is called during kexec, we need to disable MSIX and disable Bus Master to completely quiesce the device. Make these 2 calls unconditionally in the shutdown method.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +2 -2
@@ -11972,10 +11972,10 @@ static void bnxt_shutdown(struct pci_dev *pdev)dev_close (dev);bnxt_ulp_shutdown (bp); +bnxt_clear_int_mode (bp); +pci_disable_device (pdev);if (system_state ==SYSTEM_POWER_OFF ) { -bnxt_clear_int_mode (bp); -pci_disable_device (pdev);pci_wake_from_d3 (pdev, bp->wol);pci_set_power_state (pdev, PCI_D3hot); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 59/66 bnxt_en: Issue PCIe FLR in kdump kernel to cleanup pending DMAs.
In reply to Sasha LevinFrom: Vasundhara Volam <[email protected]>
[ Upstream commit 8743db4a9acfd51f805ac0c87bcaae92c42d1061 ]
If crashed kernel does not shutdown the NIC properly, PCIe FLR is required in the kdump kernel in order to initialize all the functions properly.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +8 -0
@@ -11775,6 +11775,14 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)if (version_printed++ ==0 )pr_info ("%s" , version); +/* Clear any pending DMA transactions from crash kernel +* while loading driver in capture kernel. +*/ +if (is_kdump_kernel ()) { +pci_clear_master (pdev); +pcie_flr (pdev); + } + max_irqs =bnxt_get_max_irq (pdev); dev =alloc_etherdev_mq (sizeof (*bp), max_irqs);if (!dev)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 60/66 csky/mm: Fixup export invalid_pte_table symbol
In reply to Sasha LevinFrom: Guo Ren <[email protected]>
[ Upstream commit 7f4a567332f035ab16b29010fbd04a0f10183c77 ]
There is no present bit in csky pmd hardware, so we need to prepare invalid_pte_table for empty pmd entry and the functions (pmd_none & pmd_present) in pgtable.h need invalid_pte_talbe to get result. If a module use these functions, we need export the symbol for it.
--- arch/csky/mm/init.c | 1 + 1 file changed, 1 insertion(+)
arch/csky/mm/init.c +1 -0
@@ -31,6 +31,7 @@ pgd_t swapper_pg_dir[PTRS_PER_PGD] __page_aligned_bss; pte_t invalid_pte_table[PTRS_PER_PTE] __page_aligned_bss; +EXPORT_SYMBOL (invalid_pte_table); unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)] __page_aligned_bss;EXPORT_SYMBOL (empty_zero_page);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 61/66 csky: Set regs->usp to kernel sp, when the exception is from kernel
In reply to Sasha LevinFrom: Guo Ren <[email protected]>
[ Upstream commit f8e17c17b81070f38062dce79ca7f4541851dadd ]
In the past, we didn't care about kernel sp when saving pt_reg. But in some cases, we still need pt_reg->usp to represent the kernel stack before enter exception.
For cmpxhg in atomic.S, we need save and restore usp for above.
--- arch/csky/abiv1/inc/abi/entry.h | 19 ++++++++++++++----- arch/csky/abiv2/inc/abi/entry.h | 11 +++++++++++ arch/csky/kernel/atomic.S | 8 ++++++-- 3 files changed, 31 insertions(+), 7 deletions(-)
arch/csky/abiv1/inc/abi/entry.h +14 -5
@@ -16,14 +16,16 @@#define LSAVE_A4 40#define LSAVE_A5 44 +#define usp ss1 + .macro USPTOKSP -mtcr sp, ss1 +mtcr sp, usp mfcr sp, ss0 .endm .macro KSPTOUSP mtcr sp, ss0 - mfcr sp, ss1 + mfcr sp, usp .endm .macro SAVE_ALL epc_inc
@@ -45,7 +47,13 @@add lr, r13 stw lr, (sp, 8) + mov lr, sp + addi lr, 32 + addi lr, 32 + addi lr, 16 + bt 2f mfcr lr, ss1 +2: stw lr, (sp, 16) stw a0, (sp, 20)
@@ -79,9 +87,10 @@ ldw a0, (sp, 12) mtcr a0, epsr btsti a0, 31 + bt 1f ldw a0, (sp, 16) mtcr a0, ss1 - +1: ldw a0, (sp, 24) ldw a1, (sp, 28) ldw a2, (sp, 32)
@@ -102,9 +111,9 @@ addi sp, 32 addi sp, 8 - bt 1f + bt 2f KSPTOUSP -1: +2: rte .endm
arch/csky/abiv2/inc/abi/entry.h +11 -0
@@ -31,7 +31,13 @@mfcr lr, epsr stw lr, (sp, 12) + btsti lr, 31 + bf 1f + addi lr, sp, 152 + br 2f +1: mfcr lr, usp +2: stw lr, (sp, 16) stw a0, (sp, 20)
@@ -64,8 +70,10 @@mtcr a0, epc ldw a0, (sp, 12) mtcr a0, epsr + btsti a0, 31 ldw a0, (sp, 16) mtcr a0, usp + mtcr a0, ss0 #ifdef CONFIG_CPU_HAS_HILO ldw a0, (sp, 140)
@@ -86,6 +94,9 @@ addi sp, 40 ldm r16-r30, (sp) addi sp, 72 + bf 1f + mfcr sp, ss0 +1: rte .endm
arch/csky/kernel/atomic.S +6 -2
@@ -17,10 +17,12 @@ ENTRY(csky_cmpxchg) mfcr a3, epc addi a3, TRAP0_SIZE - subi sp, 8 + subi sp, 16 stw a3, (sp, 0) mfcr a3, epsr stw a3, (sp, 4) + mfcr a3, usp + stw a3, (sp, 8) psrset ee #ifdef CONFIG_CPU_HAS_LDSTEX
@@ -47,7 +49,9 @@ ENTRY(csky_cmpxchg) mtcr a3, epc ldw a3, (sp, 4) mtcr a3, epsr - addi sp, 8 + ldw a3, (sp, 8) + mtcr a3, usp + addi sp, 16 KSPTOUSP rte END(csky_cmpxchg)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 62/66 csky/smp: Fixup boot failed when CONFIG_SMP
In reply to Sasha LevinFrom: Guo Ren <[email protected]>
[ Upstream commit c9492737b25ca32679ba3163609d938c9abfd508 ]
If we use a non-ipi-support interrupt controller, it will cause panic here. We should let cpu up and work with CONFIG_SMP, when we use a non-ipi intc.
--- arch/csky/kernel/smp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/csky/kernel/smp.c +1 -1
@@ -120,7 +120,7 @@ void __init setup_smp_ipi(void)int rc;if (ipi_irq ==0 ) -panic ("%s IRQ mapping failed\n" , __func__); +return ; rc =request_percpu_irq (ipi_irq, handle_ipi,"IPI Interrupt" , &ipi_dummy_dev);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 63/66 csky: Fixup ftrace modify panic
In reply to Sasha LevinFrom: Guo Ren <[email protected]>
[ Upstream commit 359ae00d12589c31cf103894d0f32588d523ca83 ]
During ftrace init, linux will replace all function prologues (call_mcout) with nops, but it need flush_dcache and invalidate_icache to make it work. So flush_cache functions couldn't be nested called by ftrace framework.
--- arch/csky/mm/Makefile | 2 ++ 1 file changed, 2 insertions(+)
arch/csky/mm/Makefile +2 -0
@@ -1,8 +1,10 @@ # SPDX-License-Identifier: GPL-2.0-only ifeq ($(CONFIG_CPU_HAS_CACHEV2),y) obj-y += cachev2.o +CFLAGS_REMOVE_cachev2.o = $(CC_FLAGS_FTRACE) else obj-y += cachev1.o +CFLAGS_REMOVE_cachev1.o = $(CC_FLAGS_FTRACE) endif obj-y += dma-mapping.o
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 64/66 csky: Fixup compile warning for three unimplemented syscalls
In reply to Sasha LevinFrom: Guo Ren <[email protected]>
[ Upstream commit 2305f60b76110cb3e8658a4ae85d1f7eb0c66a5b ]
Implement fstat64, fstatat64, clone3 syscalls to fixup checksyscalls.sh compile warnings.
--- arch/csky/include/uapi/asm/unistd.h | 3 +++ 1 file changed, 3 insertions(+)
arch/csky/include/uapi/asm/unistd.h +3 -0
@@ -1,7 +1,10 @@/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd. +#define __ARCH_WANT_STAT64 +#define __ARCH_WANT_NEW_STAT#define __ARCH_WANT_SYS_CLONE +#define __ARCH_WANT_SYS_CLONE3#define __ARCH_WANT_SET_GET_RLIMIT#define __ARCH_WANT_TIME32_SYSCALLS#include <asm-generic/unistd.h>
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 65/66 arch/csky: fix some Kconfig typos
In reply to Sasha LevinFrom: Randy Dunlap <[email protected]>
[ Upstream commit bebd26ab623616728d6e72b5c74a47bfff5287d8 ]
Fix wording in help text for the CPU_HAS_LDSTEX symbol.
--- arch/csky/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/csky/Kconfig +1 -1
@@ -75,7 +75,7 @@ config CPU_HAS_TLBI config CPU_HAS_LDSTEX bool help - For SMP, CPU needs "ldex&stex" instrcutions to atomic operations. + For SMP, CPU needs "ldex&stex" instructions for atomic operations. config CPU_NEED_TLBSYNC bool
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 66/66 selftests: forwarding: vxlan_bridge_1d: use more proper tos value
In reply to Sasha LevinFrom: Hangbin Liu <[email protected]>
[ Upstream commit 9b64208f74fbd0e920475ecfe9326f8443fdc3a5 ]
0x11 and 0x12 set the ECN bits based on RFC2474, it would be better to avoid that. 0x14 and 0x18 would be better and works as well.
--- tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh +3 -3
@@ -516,9 +516,9 @@ test_tos() RET=0 tc filter add dev v1 egress pref 77 prot ip \ - flower ip_tos 0x11 action pass - vxlan_ping_test $h1 192.0.2.3 "-Q 0x11" v1 egress 77 10 - vxlan_ping_test $h1 192.0.2.3 "-Q 0x12" v1 egress 77 0 + flower ip_tos 0x14 action pass + vxlan_ping_test $h1 192.0.2.3 "-Q 0x14" v1 egress 77 10 + vxlan_ping_test $h1 192.0.2.3 "-Q 0x18" v1 egress 77 0 tc filter del dev v1 egress pref 77 prot ip log_test "VXLAN: envelope TOS inheritance"
Signature · 1 line
2.20.1