Skip to content

Commit

Permalink
Merge tag 'v5.10.81' into 5.10-main
Browse files Browse the repository at this point in the history
This is the 5.10.81 stable release

# gpg verification failed.
  • Loading branch information
frank-w committed Dec 22, 2021
2 parents 9348725 + 99957dc commit afb43f1
Show file tree
Hide file tree
Showing 25 changed files with 375 additions and 131 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
VERSION = 5
PATCHLEVEL = 10
SUBLEVEL = 80
SUBLEVEL = 81
EXTRAVERSION =
NAME = Dare mighty things

Expand Down
2 changes: 1 addition & 1 deletion arch/parisc/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -1849,7 +1849,7 @@ syscall_restore:

/* Are we being ptraced? */
LDREG TI_FLAGS-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r19
ldi _TIF_SYSCALL_TRACE_MASK,%r2
ldi _TIF_SINGLESTEP|_TIF_BLOCKSTEP,%r2
and,COND(=) %r19,%r2,%r0
b,n syscall_restore_rfi

Expand Down
1 change: 1 addition & 0 deletions arch/x86/include/asm/insn-eval.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ int insn_get_modrm_rm_off(struct insn *insn, struct pt_regs *regs);
int insn_get_modrm_reg_off(struct insn *insn, struct pt_regs *regs);
unsigned long insn_get_seg_base(struct pt_regs *regs, int seg_reg_idx);
int insn_get_code_seg_params(struct pt_regs *regs);
unsigned long insn_get_effective_ip(struct pt_regs *regs);
int insn_fetch_from_user(struct pt_regs *regs,
unsigned char buf[MAX_INSN_SIZE]);
int insn_fetch_from_user_inatomic(struct pt_regs *regs,
Expand Down
1 change: 1 addition & 0 deletions arch/x86/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ struct thread_struct {
*/
unsigned long iopl_emul;

unsigned int iopl_warn:1;
unsigned int sig_on_uaccess_err:1;

/* Floating point and extended processor state */
Expand Down
1 change: 1 addition & 0 deletions arch/x86/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, unsigned long arg,
frame->ret_addr = (unsigned long) ret_from_fork;
p->thread.sp = (unsigned long) fork_frame;
p->thread.io_bitmap = NULL;
p->thread.iopl_warn = 0;
memset(p->thread.ptrace_bps, 0, sizeof(p->thread.ptrace_bps));

#ifdef CONFIG_X86_64
Expand Down
34 changes: 34 additions & 0 deletions arch/x86/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,37 @@ static enum kernel_gp_hint get_kernel_gp_address(struct pt_regs *regs,

#define GPFSTR "general protection fault"

static bool fixup_iopl_exception(struct pt_regs *regs)
{
struct thread_struct *t = &current->thread;
unsigned char byte;
unsigned long ip;

if (!IS_ENABLED(CONFIG_X86_IOPL_IOPERM) || t->iopl_emul != 3)
return false;

ip = insn_get_effective_ip(regs);
if (!ip)
return false;

if (get_user(byte, (const char __user *)ip))
return false;

if (byte != 0xfa && byte != 0xfb)
return false;

if (!t->iopl_warn && printk_ratelimit()) {
pr_err("%s[%d] attempts to use CLI/STI, pretending it's a NOP, ip:%lx",
current->comm, task_pid_nr(current), ip);
print_vma_addr(KERN_CONT " in ", ip);
pr_cont("\n");
t->iopl_warn = 1;
}

regs->ip += 1;
return true;
}

DEFINE_IDTENTRY_ERRORCODE(exc_general_protection)
{
char desc[sizeof(GPFSTR) + 50 + 2*sizeof(unsigned long) + 1] = GPFSTR;
Expand All @@ -548,6 +579,9 @@ DEFINE_IDTENTRY_ERRORCODE(exc_general_protection)
tsk = current;

if (user_mode(regs)) {
if (fixup_iopl_exception(regs))
goto exit;

tsk->thread.error_code = error_code;
tsk->thread.trap_nr = X86_TRAP_GP;

Expand Down
2 changes: 1 addition & 1 deletion arch/x86/lib/insn-eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -1415,7 +1415,7 @@ void __user *insn_get_addr_ref(struct insn *insn, struct pt_regs *regs)
}
}

static unsigned long insn_get_effective_ip(struct pt_regs *regs)
unsigned long insn_get_effective_ip(struct pt_regs *regs)
{
unsigned long seg_base = 0;

Expand Down
17 changes: 2 additions & 15 deletions drivers/block/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,19 +228,6 @@ static void __loop_update_dio(struct loop_device *lo, bool dio)
blk_mq_unfreeze_queue(lo->lo_queue);
}

/**
* loop_validate_block_size() - validates the passed in block size
* @bsize: size to validate
*/
static int
loop_validate_block_size(unsigned short bsize)
{
if (bsize < 512 || bsize > PAGE_SIZE || !is_power_of_2(bsize))
return -EINVAL;

return 0;
}

/**
* loop_set_size() - sets device size and notifies userspace
* @lo: struct loop_device to set the size for
Expand Down Expand Up @@ -1121,7 +1108,7 @@ static int loop_configure(struct loop_device *lo, fmode_t mode,
}

if (config->block_size) {
error = loop_validate_block_size(config->block_size);
error = blk_validate_block_size(config->block_size);
if (error)
goto out_unlock;
}
Expand Down Expand Up @@ -1617,7 +1604,7 @@ static int loop_set_block_size(struct loop_device *lo, unsigned long arg)
if (lo->lo_state != Lo_bound)
return -ENXIO;

err = loop_validate_block_size(arg);
err = blk_validate_block_size(arg);
if (err)
return err;

Expand Down
9 changes: 0 additions & 9 deletions drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <linux/delay.h>
#include <linux/mfd/syscon.h>
#include <linux/regmap.h>
#include <linux/pm_runtime.h>

#include "stmmac_platform.h"

Expand Down Expand Up @@ -1336,9 +1335,6 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp_priv)
return ret;
}

pm_runtime_enable(dev);
pm_runtime_get_sync(dev);

if (bsp_priv->integrated_phy)
rk_gmac_integrated_phy_powerup(bsp_priv);

Expand All @@ -1347,14 +1343,9 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp_priv)

static void rk_gmac_powerdown(struct rk_priv_data *gmac)
{
struct device *dev = &gmac->pdev->dev;

if (gmac->integrated_phy)
rk_gmac_integrated_phy_powerdown(gmac);

pm_runtime_put_sync(dev);
pm_runtime_disable(dev);

phy_power_on(gmac, false);
gmac_clk_enable(gmac, false);
}
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/stmicro/stmmac/stmmac.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ void stmmac_disable_eee_mode(struct stmmac_priv *priv);
bool stmmac_eee_init(struct stmmac_priv *priv);
int stmmac_reinit_queues(struct net_device *dev, u32 rx_cnt, u32 tx_cnt);
int stmmac_reinit_ringparam(struct net_device *dev, u32 rx_size, u32 tx_size);
int stmmac_bus_clks_config(struct stmmac_priv *priv, bool enabled);

#if IS_ENABLED(CONFIG_STMMAC_SELFTESTS)
void stmmac_selftest_run(struct net_device *dev,
Expand Down
87 changes: 77 additions & 10 deletions drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <linux/if_vlan.h>
#include <linux/dma-mapping.h>
#include <linux/slab.h>
#include <linux/pm_runtime.h>
#include <linux/prefetch.h>
#include <linux/pinctrl/consumer.h>
#ifdef CONFIG_DEBUG_FS
Expand Down Expand Up @@ -113,6 +114,28 @@ static void stmmac_exit_fs(struct net_device *dev);

#define STMMAC_COAL_TIMER(x) (jiffies + usecs_to_jiffies(x))

int stmmac_bus_clks_config(struct stmmac_priv *priv, bool enabled)
{
int ret = 0;

if (enabled) {
ret = clk_prepare_enable(priv->plat->stmmac_clk);
if (ret)
return ret;
ret = clk_prepare_enable(priv->plat->pclk);
if (ret) {
clk_disable_unprepare(priv->plat->stmmac_clk);
return ret;
}
} else {
clk_disable_unprepare(priv->plat->stmmac_clk);
clk_disable_unprepare(priv->plat->pclk);
}

return ret;
}
EXPORT_SYMBOL_GPL(stmmac_bus_clks_config);

/**
* stmmac_verify_args - verify the driver parameters.
* Description: it checks the driver parameters and set a default in case of
Expand Down Expand Up @@ -2792,6 +2815,12 @@ static int stmmac_open(struct net_device *dev)
u32 chan;
int ret;

ret = pm_runtime_get_sync(priv->device);
if (ret < 0) {
pm_runtime_put_noidle(priv->device);
return ret;
}

if (priv->hw->pcs != STMMAC_PCS_TBI &&
priv->hw->pcs != STMMAC_PCS_RTBI &&
priv->hw->xpcs == NULL) {
Expand All @@ -2800,7 +2829,7 @@ static int stmmac_open(struct net_device *dev)
netdev_err(priv->dev,
"%s: Cannot attach to PHY (error: %d)\n",
__func__, ret);
return ret;
goto init_phy_error;
}
}

Expand Down Expand Up @@ -2915,6 +2944,8 @@ static int stmmac_open(struct net_device *dev)
free_dma_desc_resources(priv);
dma_desc_error:
phylink_disconnect_phy(priv->phylink);
init_phy_error:
pm_runtime_put(priv->device);
return ret;
}

Expand Down Expand Up @@ -2965,6 +2996,8 @@ static int stmmac_release(struct net_device *dev)

stmmac_release_ptp(priv);

pm_runtime_put(priv->device);

return 0;
}

Expand Down Expand Up @@ -4291,12 +4324,21 @@ static int stmmac_set_mac_address(struct net_device *ndev, void *addr)
struct stmmac_priv *priv = netdev_priv(ndev);
int ret = 0;

ret = pm_runtime_get_sync(priv->device);
if (ret < 0) {
pm_runtime_put_noidle(priv->device);
return ret;
}

ret = eth_mac_addr(ndev, addr);
if (ret)
return ret;
goto set_mac_error;

stmmac_set_umac_addr(priv, priv->hw, ndev->dev_addr, 0);

set_mac_error:
pm_runtime_put(priv->device);

return ret;
}

Expand Down Expand Up @@ -4616,6 +4658,12 @@ static int stmmac_vlan_rx_kill_vid(struct net_device *ndev, __be16 proto, u16 vi
bool is_double = false;
int ret;

ret = pm_runtime_get_sync(priv->device);
if (ret < 0) {
pm_runtime_put_noidle(priv->device);
return ret;
}

if (be16_to_cpu(proto) == ETH_P_8021AD)
is_double = true;

Expand All @@ -4624,10 +4672,15 @@ static int stmmac_vlan_rx_kill_vid(struct net_device *ndev, __be16 proto, u16 vi
if (priv->hw->num_vlan) {
ret = stmmac_del_hw_vlan_rx_fltr(priv, ndev, priv->hw, proto, vid);
if (ret)
return ret;
goto del_vlan_error;
}

return stmmac_vlan_update(priv, is_double);
ret = stmmac_vlan_update(priv, is_double);

del_vlan_error:
pm_runtime_put(priv->device);

return ret;
}

static const struct net_device_ops stmmac_netdev_ops = {
Expand Down Expand Up @@ -5066,6 +5119,10 @@ int stmmac_dvr_probe(struct device *device,

stmmac_check_pcs_mode(priv);

pm_runtime_get_noresume(device);
pm_runtime_set_active(device);
pm_runtime_enable(device);

if (priv->hw->pcs != STMMAC_PCS_TBI &&
priv->hw->pcs != STMMAC_PCS_RTBI) {
/* MDIO bus Registration */
Expand Down Expand Up @@ -5103,6 +5160,11 @@ int stmmac_dvr_probe(struct device *device,
stmmac_init_fs(ndev);
#endif

/* Let pm_runtime_put() disable the clocks.
* If CONFIG_PM is not enabled, the clocks will stay powered.
*/
pm_runtime_put(device);

return ret;

error_serdes_powerup:
Expand Down Expand Up @@ -5152,8 +5214,8 @@ int stmmac_dvr_remove(struct device *dev)
phylink_destroy(priv->phylink);
if (priv->plat->stmmac_rst)
reset_control_assert(priv->plat->stmmac_rst);
clk_disable_unprepare(priv->plat->pclk);
clk_disable_unprepare(priv->plat->stmmac_clk);
pm_runtime_put(dev);
pm_runtime_disable(dev);
if (priv->hw->pcs != STMMAC_PCS_TBI &&
priv->hw->pcs != STMMAC_PCS_RTBI)
stmmac_mdio_unregister(ndev);
Expand All @@ -5176,6 +5238,7 @@ int stmmac_suspend(struct device *dev)
struct net_device *ndev = dev_get_drvdata(dev);
struct stmmac_priv *priv = netdev_priv(ndev);
u32 chan;
int ret;

if (!ndev || !netif_running(ndev))
return 0;
Expand Down Expand Up @@ -5219,8 +5282,11 @@ int stmmac_suspend(struct device *dev)
pinctrl_pm_select_sleep_state(priv->device);
/* Disable clock in case of PWM is off */
clk_disable_unprepare(priv->plat->clk_ptp_ref);
clk_disable_unprepare(priv->plat->pclk);
clk_disable_unprepare(priv->plat->stmmac_clk);
ret = pm_runtime_force_suspend(dev);
if (ret) {
mutex_unlock(&priv->lock);
return ret;
}
}
mutex_unlock(&priv->lock);

Expand Down Expand Up @@ -5286,8 +5352,9 @@ int stmmac_resume(struct device *dev)
} else {
pinctrl_pm_select_default_state(priv->device);
/* enable the clk previously disabled */
clk_prepare_enable(priv->plat->stmmac_clk);
clk_prepare_enable(priv->plat->pclk);
ret = pm_runtime_force_resume(dev);
if (ret)
return ret;
if (priv->plat->clk_ptp_ref)
clk_prepare_enable(priv->plat->clk_ptp_ref);
/* reset the phy so that it's ready */
Expand Down
Loading

0 comments on commit afb43f1

Please sign in to comment.