Bluetooth: hci_sock: purge socket queues in the destruct() callback
Subsystems (37)
Sasha Levin
maintainerPATCH 7/217 fs: dlm: filter user dlm messages for kernel locks
In reply to Sasha LevinFrom: Alexander Aring <[email protected]>
[ Upstream commit 6c2e3bf68f3e5e5a647aa52be246d5f552d7496d ]
This patch fixes the following crash by receiving a invalid message:
[ 160.672220] ================================================================== [ 160.676206] BUG: KASAN: user-memory-access in dlm_user_add_ast+0xc3/0x370 [ 160.679659] Read of size 8 at addr 00000000deadbeef by task kworker/u32:13/319 [ 160.681447] [ 160.681824] CPU: 10 PID: 319 Comm: kworker/u32:13 Not tainted 5.14.0-rc2+ #399 [ 160.683472] Hardware name: Red Hat KVM/RHEL-AV, BIOS 1.14.0-1.module+el8.6.0+12648+6ede71a5 04/01/2014 [ 160.685574] Workqueue: dlm_recv process_recv_sockets [ 160.686721] Call Trace: [ 160.687310] dump_stack_lvl+0x56/0x6f [ 160.688169] ? dlm_user_add_ast+0xc3/0x370 [ 160.689116] kasan_report.cold.14+0x116/0x11b [ 160.690138] ? dlm_user_add_ast+0xc3/0x370 [ 160.690832] dlm_user_add_ast+0xc3/0x370 [ 160.691502] _receive_unlock_reply+0x103/0x170 [ 160.692241] _receive_message+0x11df/0x1ec0 [ 160.692926] ? rcu_read_lock_sched_held+0xa1/0xd0 [ 160.693700] ? rcu_read_lock_bh_held+0xb0/0xb0 [ 160.694427] ? lock_acquire+0x175/0x400 [ 160.695058] ? do_purge.isra.51+0x200/0x200 [ 160.695744] ? lock_acquired+0x360/0x5d0 [ 160.696400] ? lock_contended+0x6a0/0x6a0 [ 160.697055] ? lock_release+0x21d/0x5e0 [ 160.697686] ? lock_is_held_type+0xe0/0x110 [ 160.698352] ? lock_is_held_type+0xe0/0x110 [ 160.699026] ? ___might_sleep+0x1cc/0x1e0 [ 160.699698] ? dlm_wait_requestqueue+0x94/0x140 [ 160.700451] ? dlm_process_requestqueue+0x240/0x240 [ 160.701249] ? down_write_killable+0x2b0/0x2b0 [ 160.701988] ? do_raw_spin_unlock+0xa2/0x130 [ 160.702690] dlm_receive_buffer+0x1a5/0x210 [ 160.703385] dlm_process_incoming_buffer+0x726/0x9f0 [ 160.704210] receive_from_sock+0x1c0/0x3b0 [ 160.704886] ? dlm_tcp_shutdown+0x30/0x30 [ 160.705561] ? lock_acquire+0x175/0x400 [ 160.706197] ? rcu_read_lock_sched_held+0xa1/0xd0 [ 160.706941] ? rcu_read_lock_bh_held+0xb0/0xb0 [ 160.707681] process_recv_sockets+0x32/0x40 [ 160.708366] process_one_work+0x55e/0xad0 [ 160.709045] ? pwq_dec_nr_in_flight+0x110/0x110 [ 160.709820] worker_thread+0x65/0x5e0 [ 160.710423] ? process_one_work+0xad0/0xad0 [ 160.711087] kthread+0x1ed/0x220 [ 160.711628] ? set_kthread_struct+0x80/0x80 [ 160.712314] ret_from_fork+0x22/0x30
The issue is that we received a DLM message for a user lock but the destination lock is a kernel lock. Note that the address which is trying to derefence is 00000000deadbeef, which is in a kernel lock lkb->lkb_astparam, this field should never be derefenced by the DLM kernel stack. In case of a user lock lkb->lkb_astparam is lkb->lkb_ua (memory is shared by a union field). The struct lkb_ua will be handled by the DLM kernel stack but on a kernel lock it will contain invalid data and ends in most likely crashing the kernel.
It can be reproduced with two cluster nodes.
node 2:dlm_tool join test
echo "862 fooobaar 1 2 1" > /sys/kernel/debug/dlm/test_locks echo "862 3 1" > /sys/kernel/debug/dlm/test_waiters
node 1:dlm_tool join test
python:
foo = DLM(h_cmd=3, o_nextcmd=1, h_nodeid=1, h_lockspace=0x77222027, \
m_type=7, m_flags=0x1, m_remid=0x862, m_result=0xFFFEFFFE)newFile = open("/sys/kernel/debug/dlm/comms/2/rawmsg", "wb") newFile.write(bytes(foo))
--- fs/dlm/lock.c | 9 +++++++++ 1 file changed, 9 insertions(+)
fs/dlm/lock.c +9 -0
@@ -3973,6 +3973,14 @@ static int validate_message(struct dlm_lkb *lkb, struct dlm_message *ms)int from = ms->m_header.h_nodeid;int error =0 ; +/* currently mixing of user/kernel locks are not supported */ +if (ms->m_flags &DLM_IFL_USER && ~lkb->lkb_flags &DLM_IFL_USER ) { +log_error (lkb->lkb_resource->res_ls, +"got user dlm message for a kernel lock" ); + error = -EINVAL ; + goto out; + } +switch (ms->m_type) {case DLM_MSG_CONVERT :case DLM_MSG_UNLOCK :
@@ -4001,6 +4009,7 @@ static int validate_message(struct dlm_lkb *lkb, struct dlm_message *ms) error = -EINVAL ; } +out:if (error) log_error(lkb->lkb_resource->res_ls, "ignore invalid message %d from %d %x %x %x %d",
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 25/217 batman-adv: allow netlink usage in unprivileged containers
In reply to Sasha LevinFrom: Linus Lüssing <[email protected]>
[ Upstream commit 9057d6c23e7388ee9d037fccc9a7bc8557ce277b ]
Currently, creating a batman-adv interface in an unprivileged LXD container and attaching secondary interfaces to it with "ip" or "batctl" works fine. However all batctl debug and configuration commands fail:
root@container:~# batctl originators Error received: Operation not permitted root@container:~# batctl orig_interval 1000 root@container:~# batctl orig_interval 2000 root@container:~# batctl orig_interval 1000
To fix this change the generic netlink permissions from GENL_ADMIN_PERM to GENL_UNS_ADMIN_PERM. This way a batman-adv interface is fully maintainable as root from within a user namespace, from an unprivileged container.
All except one batman-adv netlink setting are per interface and do not leak information or change settings from the host system and are therefore save to retrieve or modify as root from within an unprivileged container.
"batctl routing_algo" / BATADV_CMD_GET_ROUTING_ALGOS is the only
exception: It provides the batman-adv kernel module wide default routing algorithm. However it is read-only from netlink and an unprivileged container is still not allowed to modify /sys/module/batman_adv/parameters/routing_algo. Instead it is advised to use the newly introduced "batctl if create routing_algo RA_NAME" / IFLA_BATADV_ALGO_NAME to set the routing algorithm on interface creation, which already works fine in an unprivileged container.
--- net/batman-adv/netlink.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
net/batman-adv/netlink.c +15 -15
@@ -1368,21 +1368,21 @@ static const struct genl_small_ops batadv_netlink_ops[] = { { .cmd = BATADV_CMD_TP_METER, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags = GENL_ADMIN_PERM, + .flags = GENL_UNS_ADMIN_PERM, .doit = batadv_netlink_tp_meter_start, .internal_flags = BATADV_FLAG_NEED_MESH, }, { .cmd = BATADV_CMD_TP_METER_CANCEL, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags = GENL_ADMIN_PERM, + .flags = GENL_UNS_ADMIN_PERM, .doit = batadv_netlink_tp_meter_cancel, .internal_flags = BATADV_FLAG_NEED_MESH, }, { .cmd = BATADV_CMD_GET_ROUTING_ALGOS, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags = GENL_ADMIN_PERM, + .flags = GENL_UNS_ADMIN_PERM, .dumpit = batadv_algo_dump, }, {
@@ -1397,68 +1397,68 @@ static const struct genl_small_ops batadv_netlink_ops[] = { { .cmd = BATADV_CMD_GET_TRANSTABLE_LOCAL, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags = GENL_ADMIN_PERM, + .flags = GENL_UNS_ADMIN_PERM, .dumpit = batadv_tt_local_dump, }, { .cmd = BATADV_CMD_GET_TRANSTABLE_GLOBAL, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags = GENL_ADMIN_PERM, + .flags = GENL_UNS_ADMIN_PERM, .dumpit = batadv_tt_global_dump, }, { .cmd = BATADV_CMD_GET_ORIGINATORS, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags = GENL_ADMIN_PERM, + .flags = GENL_UNS_ADMIN_PERM, .dumpit = batadv_orig_dump, }, { .cmd = BATADV_CMD_GET_NEIGHBORS, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags = GENL_ADMIN_PERM, + .flags = GENL_UNS_ADMIN_PERM, .dumpit = batadv_hardif_neigh_dump, }, { .cmd = BATADV_CMD_GET_GATEWAYS, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags = GENL_ADMIN_PERM, + .flags = GENL_UNS_ADMIN_PERM, .dumpit = batadv_gw_dump, }, { .cmd = BATADV_CMD_GET_BLA_CLAIM, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags = GENL_ADMIN_PERM, + .flags = GENL_UNS_ADMIN_PERM, .dumpit = batadv_bla_claim_dump, }, { .cmd = BATADV_CMD_GET_BLA_BACKBONE, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags = GENL_ADMIN_PERM, + .flags = GENL_UNS_ADMIN_PERM, .dumpit = batadv_bla_backbone_dump, }, { .cmd = BATADV_CMD_GET_DAT_CACHE, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags = GENL_ADMIN_PERM, + .flags = GENL_UNS_ADMIN_PERM, .dumpit = batadv_dat_cache_dump, }, { .cmd = BATADV_CMD_GET_MCAST_FLAGS, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags = GENL_ADMIN_PERM, + .flags = GENL_UNS_ADMIN_PERM, .dumpit = batadv_mcast_flags_dump, }, { .cmd = BATADV_CMD_SET_MESH, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags = GENL_ADMIN_PERM, + .flags = GENL_UNS_ADMIN_PERM, .doit = batadv_netlink_set_mesh, .internal_flags = BATADV_FLAG_NEED_MESH, }, { .cmd = BATADV_CMD_SET_HARDIF, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags = GENL_ADMIN_PERM, + .flags = GENL_UNS_ADMIN_PERM, .doit = batadv_netlink_set_hardif, .internal_flags = BATADV_FLAG_NEED_MESH | BATADV_FLAG_NEED_HARDIF,
@@ -1474,7 +1474,7 @@ static const struct genl_small_ops batadv_netlink_ops[] = { { .cmd = BATADV_CMD_SET_VLAN, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags = GENL_ADMIN_PERM, + .flags = GENL_UNS_ADMIN_PERM, .doit = batadv_netlink_set_vlan, .internal_flags =BATADV_FLAG_NEED_MESH | BATADV_FLAG_NEED_VLAN,
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 115/217 gpio: aspeed: Convert aspeed_gpio.lock to raw_spinlock
In reply to Sasha LevinFrom: Iwona Winiarska <[email protected]>
[ Upstream commit 61a7904b6ace99b1bde0d0e867fa3097f5c8cee2 ]
The gpio-aspeed driver implements an irq_chip which need to be invoked from hardirq context. Since spin_lock() can sleep with PREEMPT_RT, it is no longer legal to invoke it while interrupts are disabled. This also causes lockdep to complain about:
[ 0.649797] [ BUG: Invalid wait context ]
because aspeed_gpio.lock (spin_lock_t) is taken under irq_desc.lock (raw_spinlock_t).
Let's use of raw_spinlock_t instead of spinlock_t.
--- drivers/gpio/gpio-aspeed.c | 52 +++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 26 deletions(-)
drivers/gpio/gpio-aspeed.c +26 -26
@@ -53,7 +53,7 @@ struct aspeed_gpio_config {struct aspeed_gpio {struct gpio_chip chip;struct irq_chip irqc; -spinlock_t lock; +raw_spinlock_t lock;void __iomem *base;int irq;const struct aspeed_gpio_config *config;
@@ -413,14 +413,14 @@ static void aspeed_gpio_set(struct gpio_chip *gc, unsigned int offset,unsigned long flags;bool copro; -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags); copro =aspeed_gpio_copro_request (gpio, offset);__aspeed_gpio_set (gc, offset, val);if (copro)aspeed_gpio_copro_release (gpio, offset); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags); }static int aspeed_gpio_dir_in (struct gpio_chip *gc,unsigned int offset)
@@ -435,7 +435,7 @@ static int aspeed_gpio_dir_in(struct gpio_chip *gc, unsigned int offset)if (!have_input (gpio, offset))return -ENOTSUPP ; -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags); reg =ioread32 (addr); reg &= ~GPIO_BIT (offset);
@@ -445,7 +445,7 @@ static int aspeed_gpio_dir_in(struct gpio_chip *gc, unsigned int offset)if (copro)aspeed_gpio_copro_release (gpio, offset); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags);return 0 ; }
@@ -463,7 +463,7 @@ static int aspeed_gpio_dir_out(struct gpio_chip *gc,if (!have_output (gpio, offset))return -ENOTSUPP ; -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags); reg =ioread32 (addr); reg |=GPIO_BIT (offset);
@@ -474,7 +474,7 @@ static int aspeed_gpio_dir_out(struct gpio_chip *gc,if (copro)aspeed_gpio_copro_release (gpio, offset); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags);return 0 ; }
@@ -492,11 +492,11 @@ static int aspeed_gpio_get_direction(struct gpio_chip *gc, unsigned int offset)if (!have_output (gpio, offset))return GPIO_LINE_DIRECTION_IN ; -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags); val =ioread32 (bank_reg (gpio, bank, reg_dir)) &GPIO_BIT (offset); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags);return val ?GPIO_LINE_DIRECTION_OUT :GPIO_LINE_DIRECTION_IN ; }
@@ -539,14 +539,14 @@ static void aspeed_gpio_irq_ack(struct irq_data *d) status_addr =bank_reg (gpio, bank, reg_irq_status); -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags); copro =aspeed_gpio_copro_request (gpio, offset);iowrite32 (bit, status_addr);if (copro)aspeed_gpio_copro_release (gpio, offset); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags); }static void aspeed_gpio_irq_set_mask (struct irq_data *d,bool set)
@@ -565,7 +565,7 @@ static void aspeed_gpio_irq_set_mask(struct irq_data *d, bool set) addr =bank_reg (gpio, bank, reg_irq_enable); -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags); copro =aspeed_gpio_copro_request (gpio, offset); reg =ioread32 (addr);
@@ -577,7 +577,7 @@ static void aspeed_gpio_irq_set_mask(struct irq_data *d, bool set)if (copro)aspeed_gpio_copro_release (gpio, offset); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags); }static void aspeed_gpio_irq_mask (struct irq_data *d)
@@ -629,7 +629,7 @@ static int aspeed_gpio_set_type(struct irq_data *d, unsigned int type)return -EINVAL ; } -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags); copro =aspeed_gpio_copro_request (gpio, offset); addr =bank_reg (gpio, bank, reg_irq_type0);
@@ -649,7 +649,7 @@ static int aspeed_gpio_set_type(struct irq_data *d, unsigned int type)if (copro)aspeed_gpio_copro_release (gpio, offset); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags);irq_set_handler_locked (d, handler);
@@ -716,7 +716,7 @@ static int aspeed_gpio_reset_tolerance(struct gpio_chip *chip, treg =bank_reg (gpio,to_bank (offset), reg_tolerance); -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags); copro =aspeed_gpio_copro_request (gpio, offset); val =readl (treg);
@@ -730,7 +730,7 @@ static int aspeed_gpio_reset_tolerance(struct gpio_chip *chip,if (copro)aspeed_gpio_copro_release (gpio, offset); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags);return 0 ; }
@@ -856,7 +856,7 @@ static int enable_debounce(struct gpio_chip *chip, unsigned int offset,return rc; } -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags);if (timer_allocation_registered (gpio, offset)) { rc =unregister_allocated_timer (gpio, offset);
@@ -916,7 +916,7 @@ static int enable_debounce(struct gpio_chip *chip, unsigned int offset,configure_timer (gpio, offset, i); out: -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags);return rc; }
@@ -927,13 +927,13 @@ static int disable_debounce(struct gpio_chip *chip, unsigned int offset)unsigned long flags;int rc; -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags); rc =unregister_allocated_timer (gpio, offset);if (!rc)configure_timer (gpio, offset,0 ); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags);return rc; }
@@ -1015,7 +1015,7 @@ int aspeed_gpio_copro_grab_gpio(struct gpio_desc *desc,return -EINVAL ; bindex = offset >>3 ; -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags);/* Sanity check, this shouldn't happen */ if (gpio->cf_copro_bankmap[bindex] ==0xff ) {
@@ -1036,7 +1036,7 @@ int aspeed_gpio_copro_grab_gpio(struct gpio_desc *desc,if (bit) *bit =GPIO_OFFSET (offset); bail: -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags);return rc; }EXPORT_SYMBOL_GPL (aspeed_gpio_copro_grab_gpio);
@@ -1060,7 +1060,7 @@ int aspeed_gpio_copro_release_gpio(struct gpio_desc *desc)return -EINVAL ; bindex = offset >>3 ; -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags);/* Sanity check, this shouldn't happen */ if (gpio->cf_copro_bankmap[bindex] ==0 ) {
@@ -1074,7 +1074,7 @@ int aspeed_gpio_copro_release_gpio(struct gpio_desc *desc)aspeed_gpio_change_cmd_source (gpio, bank, bindex,GPIO_CMDSRC_ARM ); bail: -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags);return rc; }EXPORT_SYMBOL_GPL (aspeed_gpio_copro_release_gpio);
@@ -1148,7 +1148,7 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev)if (IS_ERR (gpio->base))return PTR_ERR (gpio->base); -spin_lock_init (&gpio->lock); +raw_spin_lock_init (&gpio->lock); gpio_id =of_match_node (aspeed_gpio_of_table, pdev->dev.of_node);if (!gpio_id)
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 116/217 gpio: aspeed-sgpio: Convert aspeed_sgpio.lock to raw_spinlock
In reply to Sasha LevinFrom: Iwona Winiarska <[email protected]>
[ Upstream commit ab39d6988dd53f354130438d8afa5596a2440fed ]
The gpio-aspeed-sgpio driver implements an irq_chip which need to be invoked from hardirq context. Since spin_lock() can sleep with PREEMPT_RT, it is no longer legal to invoke it while interrupts are disabled.
This also causes lockdep to complain about:
[ 25.919465] [ BUG: Invalid wait context ]
because aspeed_sgpio.lock (spin_lock_t) is taken under irq_desc.lock (raw_spinlock_t).
Let's use of raw_spinlock_t instead of spinlock_t.
--- drivers/gpio/gpio-aspeed-sgpio.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/gpio/gpio-aspeed-sgpio.c +16 -16
@@ -31,7 +31,7 @@ struct aspeed_sgpio {struct gpio_chip chip;struct irq_chip intc;struct clk *pclk; -spinlock_t lock; +raw_spinlock_t lock;void __iomem *base;int irq; };
@@ -173,12 +173,12 @@ static int aspeed_sgpio_get(struct gpio_chip *gc, unsigned int offset)enum aspeed_sgpio_reg reg;int rc =0 ; -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags); reg =aspeed_sgpio_is_input (offset) ? reg_val : reg_rdata; rc = !!(ioread32 (bank_reg (gpio, bank, reg)) &GPIO_BIT (offset)); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags);return rc; }
@@ -215,11 +215,11 @@ static void aspeed_sgpio_set(struct gpio_chip *gc, unsigned int offset, int val)struct aspeed_sgpio *gpio =gpiochip_get_data (gc);unsigned long flags; -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags);sgpio_set_value (gc, offset, val); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags); }static int aspeed_sgpio_dir_in (struct gpio_chip *gc,unsigned int offset)
@@ -236,9 +236,9 @@ static int aspeed_sgpio_dir_out(struct gpio_chip *gc, unsigned int offset, int v/* No special action is required for setting the direction; we'll * error-out in sgpio_set_value if this isn't an output GPIO */ -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags); rc =sgpio_set_value (gc, offset, val); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags);return rc; }
@@ -277,11 +277,11 @@ static void aspeed_sgpio_irq_ack(struct irq_data *d) status_addr =bank_reg (gpio, bank, reg_irq_status); -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags);iowrite32 (bit, status_addr); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags); }static void aspeed_sgpio_irq_set_mask (struct irq_data *d,bool set)
@@ -296,7 +296,7 @@ static void aspeed_sgpio_irq_set_mask(struct irq_data *d, bool set)irqd_to_aspeed_sgpio_data (d, &gpio, &bank, &bit, &offset); addr =bank_reg (gpio, bank, reg_irq_enable); -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags); reg =ioread32 (addr);if (set)
@@ -306,7 +306,7 @@ static void aspeed_sgpio_irq_set_mask(struct irq_data *d, bool set)iowrite32 (reg, addr); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags); }static void aspeed_sgpio_irq_mask (struct irq_data *d)
@@ -355,7 +355,7 @@ static int aspeed_sgpio_set_type(struct irq_data *d, unsigned int type)return -EINVAL ; } -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags); addr =bank_reg (gpio, bank, reg_irq_type0); reg =ioread32 (addr);
@@ -372,7 +372,7 @@ static int aspeed_sgpio_set_type(struct irq_data *d, unsigned int type) reg = (reg & ~bit) | type2;iowrite32 (reg, addr); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags);irq_set_handler_locked (d, handler);
@@ -467,7 +467,7 @@ static int aspeed_sgpio_reset_tolerance(struct gpio_chip *chip, reg =bank_reg (gpio,to_bank (offset), reg_tolerance); -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags); val =readl (reg);
@@ -478,7 +478,7 @@ static int aspeed_sgpio_reset_tolerance(struct gpio_chip *chip,writel (val, reg); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags);return 0 ; }
@@ -575,7 +575,7 @@ static int __init aspeed_sgpio_probe(struct platform_device *pdev)iowrite32 (FIELD_PREP (ASPEED_SGPIO_CLK_DIV_MASK , sgpio_clk_div) | gpio_cnt_regval |ASPEED_SGPIO_ENABLE , gpio->base +ASPEED_SGPIO_CTRL ); -spin_lock_init (&gpio->lock); +raw_spin_lock_init (&gpio->lock); gpio->chip.parent = &pdev->dev; gpio->chip.ngpio = nr_gpios *2 ;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 1/217 Bluetooth: hci_sock: purge socket queues in the destruct() callback
From: Nguyen Dinh Phi <[email protected]>
[ Upstream commit 709fca500067524381e28a5f481882930eebac88 ]
The receive path may take the socket right before hci_sock_release(), but it may enqueue the packets to the socket queues after the call to skb_queue_purge(), therefore the socket can be destroyed without clear its queues completely.
Moving these skb_queue_purge() to the hci_sock_destruct() will fix this issue, because nothing is referencing the socket at this point.
--- net/bluetooth/hci_sock.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
net/bluetooth/hci_sock.c +7 -4
@@ -889,10 +889,6 @@ static int hci_sock_release(struct socket *sock) }sock_orphan (sk); - -skb_queue_purge (&sk->sk_receive_queue); -skb_queue_purge (&sk->sk_write_queue); -release_sock (sk);sock_put (sk);return 0 ;
@@ -2058,6 +2054,12 @@ static int hci_sock_getsockopt(struct socket *sock, int level, int optname,return err; } +static void hci_sock_destruct (struct sock *sk) +{ +skb_queue_purge (&sk->sk_receive_queue); +skb_queue_purge (&sk->sk_write_queue); +} +static const struct proto_ops hci_sock_ops = { .family =PF_BLUETOOTH , .owner =THIS_MODULE ,
@@ -2111,6 +2113,7 @@ static int hci_sock_create(struct net *net, struct socket *sock, int protocol, sock->state =SS_UNCONNECTED ; sk->sk_state =BT_OPEN ; + sk->sk_destruct = hci_sock_destruct;bt_sock_link (&hci_sk_list, sk);return 0 ;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 4/217 drm/panel: Delete panel on mipi_dsi_attach() failure
From: Brian Norris <[email protected]>
[ Upstream commit 9bf7123bb07f98dc76acb5daa91248e6f95713cb ]
Many DSI panel drivers fail to clean up their panel references on mipi_dsi_attach() failure, so we're leaving a dangling drm_panel reference to freed memory. Clean that up on failure.
Noticed by inspection, after seeing similar problems on other drivers. Therefore, I'm not marking Fixes/stable.
--- drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c | 8 +++++++- drivers/gpu/drm/panel/panel-jdi-lt070me05000.c | 8 +++++++- drivers/gpu/drm/panel/panel-novatek-nt36672a.c | 8 +++++++- drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c | 8 +++++++- drivers/gpu/drm/panel/panel-ronbo-rb070d30.c | 8 +++++++- drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c | 1 + drivers/gpu/drm/panel/panel-samsung-sofef00.c | 1 + drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c | 8 +++++++- 8 files changed, 44 insertions(+), 6 deletions(-)
drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c +7 -1
@@ -227,7 +227,13 @@ static int feiyang_dsi_probe(struct mipi_dsi_device *dsi) dsi->format =MIPI_DSI_FMT_RGB888 ; dsi->lanes =4 ; -return mipi_dsi_attach (dsi); + ret =mipi_dsi_attach (dsi); +if (ret <0 ) { +drm_panel_remove (&ctx->panel); +return ret; + } + +return 0 ; }static int feiyang_dsi_remove (struct mipi_dsi_device *dsi)
drivers/gpu/drm/panel/panel-jdi-lt070me05000.c +7 -1
@@ -473,7 +473,13 @@ static int jdi_panel_probe(struct mipi_dsi_device *dsi)if (ret <0 )return ret; -return mipi_dsi_attach (dsi); + ret =mipi_dsi_attach (dsi); +if (ret <0 ) { +jdi_panel_del (jdi); +return ret; + } + +return 0 ; }static int jdi_panel_remove (struct mipi_dsi_device *dsi)
drivers/gpu/drm/panel/panel-novatek-nt36672a.c +7 -1
@@ -656,7 +656,13 @@ static int nt36672a_panel_probe(struct mipi_dsi_device *dsi)if (err <0 )return err; -return mipi_dsi_attach (dsi); + err =mipi_dsi_attach (dsi); +if (err <0 ) { +drm_panel_remove (&pinfo->base); +return err; + } + +return 0 ; }static int nt36672a_panel_remove (struct mipi_dsi_device *dsi)
drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c +7 -1
@@ -241,7 +241,13 @@ static int wuxga_nt_panel_probe(struct mipi_dsi_device *dsi)if (ret <0 )return ret; -return mipi_dsi_attach (dsi); + ret =mipi_dsi_attach (dsi); +if (ret <0 ) { +wuxga_nt_panel_del (wuxga_nt); +return ret; + } + +return 0 ; }static int wuxga_nt_panel_remove (struct mipi_dsi_device *dsi)
drivers/gpu/drm/panel/panel-ronbo-rb070d30.c +7 -1
@@ -199,7 +199,13 @@ static int rb070d30_panel_dsi_probe(struct mipi_dsi_device *dsi) dsi->format =MIPI_DSI_FMT_RGB888 ; dsi->lanes =4 ; -return mipi_dsi_attach (dsi); + ret =mipi_dsi_attach (dsi); +if (ret <0 ) { +drm_panel_remove (&ctx->panel); +return ret; + } + +return 0 ; }static int rb070d30_panel_dsi_remove (struct mipi_dsi_device *dsi)
drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c +1 -0
@@ -247,6 +247,7 @@ static int s6e88a0_ams452ef01_probe(struct mipi_dsi_device *dsi) ret =mipi_dsi_attach (dsi);if (ret <0 ) {dev_err (dev,"Failed to attach to DSI host: %d\n" , ret); +drm_panel_remove (&ctx->panel);return ret; }
drivers/gpu/drm/panel/panel-samsung-sofef00.c +1 -0
@@ -302,6 +302,7 @@ static int sofef00_panel_probe(struct mipi_dsi_device *dsi) ret =mipi_dsi_attach (dsi);if (ret <0 ) {dev_err (dev,"Failed to attach to DSI host: %d\n" , ret); +drm_panel_remove (&ctx->panel);return ret; }
drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c +7 -1
@@ -296,7 +296,13 @@ static int sharp_nt_panel_probe(struct mipi_dsi_device *dsi)if (ret <0 )return ret; -return mipi_dsi_attach (dsi); + ret =mipi_dsi_attach (dsi); +if (ret <0 ) { +sharp_nt_panel_del (sharp_nt); +return ret; + } + +return 0 ; }static int sharp_nt_panel_remove (struct mipi_dsi_device *dsi)
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 2/217 Bluetooth: Fix debugfs entry leak in hci_register_dev()
In reply to Sasha LevinFrom: Wei Yongjun <[email protected]>
[ Upstream commit 5a4bb6a8e981d3d0d492aa38412ee80b21033177 ]
Fault injection test report debugfs entry leak as follows:
debugfs: Directory 'hci0' with parent 'bluetooth' already present!
When register_pm_notifier() failed in hci_register_dev(), the debugfs create by debugfs_create_dir() do not removed in the error handing path.
Add the remove debugfs code to fix it.
--- net/bluetooth/hci_core.c | 1 + 1 file changed, 1 insertion(+)
net/bluetooth/hci_core.c +1 -0
@@ -3882,6 +3882,7 @@ int hci_register_dev(struct hci_dev *hdev)return id; err_wqueue: +debugfs_remove_recursive (hdev->debugfs);destroy_workqueue (hdev->workqueue);destroy_workqueue (hdev->req_workqueue); err:
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 3/217 Bluetooth: Fix memory leak of hci device
In reply to Sasha LevinFrom: Wei Yongjun <[email protected]>
[ Upstream commit 75d9b8559ac36e059238ee4f8e33cd86086586ba ]
Fault injection test reported memory leak of hci device as follows:
unreferenced object 0xffff88800b858000 (size 8192):
comm "kworker/0:2", pid 167, jiffies 4294955747 (age 557.148s) hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 ad 4e ad de .............N..
backtrace:
[<0000000070eb1059>] kmem_cache_alloc_trace mm/slub.c:3208
[<00000000015eb521>] hci_alloc_dev_priv include/linux/slab.h:591
[<00000000dcfc1e21>] bpa10x_probe include/net/bluetooth/hci_core.h:1240
[<000000005d3028c7>] usb_probe_interface drivers/usb/core/driver.c:397
[<00000000cbac9243>] really_probe drivers/base/dd.c:517
[<0000000024cab3f0>] __driver_probe_device drivers/base/dd.c:751
[<00000000202135cb>] driver_probe_device drivers/base/dd.c:782
[<000000000761f2bc>] __device_attach_driver drivers/base/dd.c:899
[<00000000f7d63134>] bus_for_each_drv drivers/base/bus.c:427
[<00000000c9551f0b>] __device_attach drivers/base/dd.c:971
[<000000007f79bd16>] bus_probe_device drivers/base/bus.c:487
[<000000007bb8b95a>] device_add drivers/base/core.c:3364
[<000000009564d9ea>] usb_set_configuration drivers/usb/core/message.c:2171
[<00000000e4657087>] usb_generic_driver_probe drivers/usb/core/generic.c:239
[<0000000071ede518>] usb_probe_device drivers/usb/core/driver.c:294
[<00000000cbac9243>] really_probe drivers/base/dd.c:517hci_alloc_dev() do not init the device's flag. And hci_free_dev() using put_device() to free the memory allocated for this device, but it calls just put_device(dev) only in case of HCI_UNREGISTER flag is set, So any error handing before hci_register_dev() success will cause memory leak.
To avoid this behaviour we can using kfree() to release dev before hci_register_dev() success.
--- net/bluetooth/hci_sysfs.c | 2 ++ 1 file changed, 2 insertions(+)
net/bluetooth/hci_sysfs.c +2 -0
@@ -86,6 +86,8 @@ static void bt_host_release(struct device *dev)if (hci_dev_test_flag (hdev,HCI_UNREGISTER ))hci_release_dev (hdev); +else +kfree (hdev);module_put (THIS_MODULE ); }
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 6/217 drm/sched: Avoid lockdep spalt on killing a processes
In reply to Sasha LevinFrom: Andrey Grodzovsky <[email protected]>
[ Upstream commit 542cff7893a37445f98ece26aeb3c9c1055e9ea4 ]
Probelm:
Singlaning one sched fence from within another's sched fence singal callback generates lockdep splat because the both have same lockdep class of their fence->lock
Fix:
Fix bellow stack by rescheduling to irq work of signaling and killing of jobs that left when entity is killed.
[11176.741181] dump_stack+0x10/0x12 [11176.741186] __lock_acquire.cold+0x208/0x2df [11176.741197] lock_acquire+0xc6/0x2d0 [11176.741204] ? dma_fence_signal+0x28/0x80 [11176.741212] _raw_spin_lock_irqsave+0x4d/0x70 [11176.741219] ? dma_fence_signal+0x28/0x80 [11176.741225] dma_fence_signal+0x28/0x80 [11176.741230] drm_sched_fence_finished+0x12/0x20 [gpu_sched] [11176.741240] drm_sched_entity_kill_jobs_cb+0x1c/0x50 [gpu_sched] [11176.741248] dma_fence_signal_timestamp_locked+0xac/0x1a0 [11176.741254] dma_fence_signal+0x3b/0x80 [11176.741260] drm_sched_fence_finished+0x12/0x20 [gpu_sched] [11176.741268] drm_sched_job_done.isra.0+0x7f/0x1a0 [gpu_sched] [11176.741277] drm_sched_job_done_cb+0x12/0x20 [gpu_sched] [11176.741284] dma_fence_signal_timestamp_locked+0xac/0x1a0 [11176.741290] dma_fence_signal+0x3b/0x80 [11176.741296] amdgpu_fence_process+0xd1/0x140 [amdgpu] [11176.741504] sdma_v4_0_process_trap_irq+0x8c/0xb0 [amdgpu] [11176.741731] amdgpu_irq_dispatch+0xce/0x250 [amdgpu] [11176.741954] amdgpu_ih_process+0x81/0x100 [amdgpu] [11176.742174] amdgpu_irq_handler+0x26/0xa0 [amdgpu] [11176.742393] __handle_irq_event_percpu+0x4f/0x2c0 [11176.742402] handle_irq_event_percpu+0x33/0x80 [11176.742408] handle_irq_event+0x39/0x60 [11176.742414] handle_edge_irq+0x93/0x1d0 [11176.742419] __common_interrupt+0x50/0xe0 [11176.742426] common_interrupt+0x80/0x90
--- drivers/gpu/drm/scheduler/sched_entity.c | 15 ++++++++++++--- include/drm/gpu_scheduler.h | 12 +++++++++++- 2 files changed, 23 insertions(+), 4 deletions(-)
drivers/gpu/drm/scheduler/sched_entity.c +12 -3
@@ -190,6 +190,16 @@ long drm_sched_entity_flush(struct drm_sched_entity *entity, long timeout) }EXPORT_SYMBOL (drm_sched_entity_flush); +static void drm_sched_entity_kill_jobs_irq_work (struct irq_work *wrk) +{ +struct drm_sched_job *job =container_of (wrk,typeof (*job), work); + +drm_sched_fence_finished (job->s_fence); +WARN_ON (job->s_fence->parent); + job->sched->ops->free_job (job); +} + +/* Signal the scheduler finished fence when the entity in question is killed. */ static void drm_sched_entity_kill_jobs_cb (struct dma_fence *f,struct dma_fence_cb *cb)
@@ -197,9 +207,8 @@ static void drm_sched_entity_kill_jobs_cb(struct dma_fence *f, struct drm_sched_job *job = container_of(cb, struct drm_sched_job, finish_cb); -drm_sched_fence_finished (job->s_fence); -WARN_ON (job->s_fence->parent); - job->sched->ops->free_job (job); +init_irq_work (&job->work, drm_sched_entity_kill_jobs_irq_work); +irq_work_queue (&job->work); } static struct dma_fence *
include/drm/gpu_scheduler.h +11 -1
@@ -28,6 +28,7 @@#include <linux/dma-fence.h> #include <linux/completion.h> #include <linux/xarray.h> +#include <linux/irq_work.h> #define MAX_WAIT_SCHED_ENTITY_Q_EMPTY msecs_to_jiffies(1000)
@@ -286,7 +287,16 @@ struct drm_sched_job {struct list_head list;struct drm_gpu_scheduler *sched;struct drm_sched_fence *s_fence; -struct dma_fence_cb finish_cb; + +/* +* work is used only after finish_cb has been used and will not be +* accessed anymore. +*/ +union { +struct dma_fence_cb finish_cb; +struct irq_work work; + }; +uint64_t id;atomic_t karma;enum drm_sched_priority s_priority;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 5/217 Bluetooth: Fix removing adv when processing cmd complete
In reply to Sasha LevinFrom: Archie Pusaka <[email protected]>
[ Upstream commit 2128939fe2e771645dd88e1938c27fdf96bd1cd0 ]
If we remove one instance of adv using Set Extended Adv Enable, there is a possibility of issue occurs when processing the Command Complete event. Especially, the adv_info might not be found since we already remove it in hci_req_clear_adv_instance() -> hci_remove_adv_instance(). If that's the case, we will mistakenly proceed to remove all adv instances instead of just one single instance.
This patch fixes the issue by checking the content of the HCI command instead of checking whether the adv_info is found.
--- net/bluetooth/hci_event.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/bluetooth/hci_event.c +4 -2
@@ -1326,8 +1326,10 @@ static void hci_cc_le_set_ext_adv_enable(struct hci_dev *hdev, &conn->le_conn_timeout, conn->conn_timeout); }else { -if (adv) { - adv->enabled = false; +if (cp->num_of_sets) { +if (adv) + adv->enabled = false; +/* If just one instance was disabled check if there are * any other instance enabled before clearing HCI_LE_ADV */
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 9/217 libbpf: Improve sanity checking during BTF fix up
In reply to Sasha LevinFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 88918dc12dc357a06d8d722a684617b1c87a4654 ]
If BTF is corrupted DATASEC's variable type ID might be incorrect. Prevent this easy to detect situation with extra NULL check. Reported by oss-fuzz project.
--- tools/lib/bpf/libbpf.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
tools/lib/bpf/libbpf.c +2 -3
@@ -2752,13 +2752,12 @@ static int btf_fixup_datasec(struct bpf_object *obj, struct btf *btf,for (i =0 , vsi =btf_var_secinfos (t); i < vars; i++, vsi++) { t_var =btf__type_by_id (btf, vsi->type); - var =btf_var (t_var); - -if (!btf_is_var (t_var)) { +if (!t_var || !btf_is_var (t_var)) {pr_debug ("Non-VAR type seen in section %s\n" , name);return -EINVAL ; } + var =btf_var (t_var);if (var->linkage ==BTF_VAR_STATIC )continue ;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 11/217 drm/lima: fix warning when CONFIG_DEBUG_SG=y & CONFIG_DMA_API_DEBUG=y
In reply to Sasha LevinFrom: Qiang Yu <[email protected]>
[ Upstream commit 89636a06fa2ee7826a19c39c19a9bc99ab9340a9 ]
Otherwise get following warning:
DMA-API: lima 1c40000.gpu: mapping sg segment longer than device claims to support [len=4149248] [max=65536]
See: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5496
--- drivers/gpu/drm/lima/lima_device.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/lima/lima_device.c +1 -0
@@ -358,6 +358,7 @@ int lima_device_init(struct lima_device *ldev)int err, i;dma_set_coherent_mask (ldev->dev,DMA_BIT_MASK (32 )); +dma_set_max_seg_size (ldev->dev,UINT_MAX ); err =lima_clk_init (ldev);if (err)
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 8/217 libbpf: Detect corrupted ELF symbols section
In reply to Sasha LevinFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 833907876be55205d0ec153dcd819c014404ee16 ]
Prevent divide-by-zero if ELF is corrupted and has zero sh_entsize. Reported by oss-fuzz project.
--- tools/lib/bpf/libbpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/bpf/libbpf.c +1 -1
@@ -3555,7 +3555,7 @@ static int bpf_object__collect_externs(struct bpf_object *obj) scn =elf_sec_by_idx (obj, obj->efile.symbols_shndx); sh =elf_sec_hdr (obj, scn); -if (!sh) +if (!sh || sh->sh_entsize !=sizeof (Elf64_Sym))return -LIBBPF_ERRNO__FORMAT ; dummy_var_btf_id =add_dummy_ksym_var (obj->btf);
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 10/217 libbpf: Validate that .BTF and .BTF.ext sections contain data
In reply to Sasha LevinFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 62554d52e71797eefa3fc15b54008038837bb2d4 ]
.BTF and .BTF.ext ELF sections should have SHT_PROGBITS type and contain data. If they are not, ELF is invalid or corrupted, so bail out. Otherwise this can lead to data->d_buf being NULL and SIGSEGV later on. Reported by oss-fuzz project.
--- tools/lib/bpf/libbpf.c | 4 ++++ 1 file changed, 4 insertions(+)
tools/lib/bpf/libbpf.c +4 -0
@@ -3270,8 +3270,12 @@ static int bpf_object__elf_collect(struct bpf_object *obj) }else if (strcmp (name,MAPS_ELF_SEC ) ==0 ) { obj->efile.btf_maps_shndx = idx; }else if (strcmp (name,BTF_ELF_SEC ) ==0 ) { +if (sh->sh_type !=SHT_PROGBITS ) +return -LIBBPF_ERRNO__FORMAT ; btf_data = data; }else if (strcmp (name,BTF_EXT_ELF_SEC ) ==0 ) { +if (sh->sh_type !=SHT_PROGBITS ) +return -LIBBPF_ERRNO__FORMAT ; btf_ext_data = data; }else if (sh->sh_type ==SHT_SYMTAB ) {/* already processed during the first pass above */
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 12/217 selftests/bpf: Fix memory leaks in btf_type_c_dump() helper
In reply to Sasha LevinFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 8ba285874913da21ca39a46376e9cc5ce0f45f94 ]
Free up memory and resources used by temporary allocated memstream and btf_dump instance.
--- tools/testing/selftests/bpf/btf_helpers.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/btf_helpers.c +7 -2
@@ -251,18 +251,23 @@ const char *btf_type_c_dump(const struct btf *btf) d =btf_dump__new (btf,NULL , &opts, btf_dump_printf);if (libbpf_get_error (d)) {fprintf (stderr,"Failed to create btf_dump instance: %ld\n" ,libbpf_get_error (d)); -return NULL ; + goto err_out; }for (i =1 ; i <btf__type_cnt (btf); i++) { err =btf_dump__dump_type (d, i);if (err) {fprintf (stderr,"Failed to dump type [%d]: %d\n" , i, err); -return NULL ; + goto err_out; } } +btf_dump__free (d);fflush (buf_file);fclose (buf_file);return buf; +err_out: +btf_dump__free (d); +fclose (buf_file); +return NULL ; }
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 16/217 drm/bridge: dw-hdmi: handle ELD when DRM_BRIDGE_ATTACH_NO_CONNECTOR
In reply to Sasha LevinFrom: Neil Armstrong <[email protected]>
[ Upstream commit 3f2532d65a571ca02258b547b5b68ab2e9406fdb ]
The current ELD handling takes the internal connector ELD buffer and shares it to the I2S and AHB sub-driver.
But with DRM_BRIDGE_ATTACH_NO_CONNECTOR, the connector is created elsewhere (or not), and an eventual connector is known only if the bridge chain up to a connector is enabled.
The current dw-hdmi code gets the current connector from atomic_enable() so use the already stored connector pointer and replace the buffer pointer with a callback returning the current connector ELD buffer.
Since a connector is not always available, either pass an empty ELD to the alsa HDMI driver or don't call snd_pcm_hw_constraint_eld() in AHB driver.
--- drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c | 10 +++++++--- drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h | 4 ++-- drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 9 ++++++++- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 12 ++++++++++-- 4 files changed, 27 insertions(+), 8 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c +7 -3
@@ -320,13 +320,17 @@ static int dw_hdmi_open(struct snd_pcm_substream *substream)struct snd_pcm_runtime *runtime = substream->runtime;struct snd_dw_hdmi *dw = substream->private_data;void __iomem *base = dw->data.base; +u8 *eld;int ret; runtime->hw = dw_hdmi_hw; - ret =snd_pcm_hw_constraint_eld (runtime, dw->data.eld); -if (ret <0 ) -return ret; + eld = dw->data.get_eld (dw->data.hdmi); +if (eld) { + ret =snd_pcm_hw_constraint_eld (runtime, eld); +if (ret <0 ) +return ret; + } ret =snd_pcm_limit_hw_rates (runtime);if (ret <0 )
drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h +2 -2
@@ -9,15 +9,15 @@ struct dw_hdmi_audio_data {void __iomem *base;int irq;struct dw_hdmi *hdmi; - u8 *eld; + u8 *(*get_eld)(struct dw_hdmi *hdmi); };struct dw_hdmi_i2s_audio_data {struct dw_hdmi *hdmi; -u8 *eld;void (*write)(struct dw_hdmi *hdmi,u8 val,int offset);u8 (*read)(struct dw_hdmi *hdmi,int offset); +u8 *(*get_eld)(struct dw_hdmi *hdmi); };#endif
drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +8 -1
@@ -135,8 +135,15 @@ static int dw_hdmi_i2s_get_eld(struct device *dev, void *data, uint8_t *buf, size_t len) {struct dw_hdmi_i2s_audio_data *audio = data; +u8 *eld; + + eld = audio->get_eld (audio->hdmi); +if (eld) +memcpy (buf, eld,min_t (size_t,MAX_ELD_BYTES , len)); +else +/* Pass en empty ELD if connector not available */ +memset (buf,0 , len); -memcpy (buf, audio->eld,min_t (size_t,MAX_ELD_BYTES , len));return 0 ; }
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +10 -2
@@ -757,6 +757,14 @@ static void hdmi_enable_audio_clk(struct dw_hdmi *hdmi, bool enable)hdmi_writeb (hdmi, hdmi->mc_clkdis,HDMI_MC_CLKDIS ); } +static u8 *hdmi_audio_get_eld (struct dw_hdmi *hdmi) +{ +if (!hdmi->curr_conn) +return NULL ; + +return hdmi->curr_conn->eld; +} +static void dw_hdmi_ahb_audio_enable (struct dw_hdmi *hdmi) {hdmi_set_cts_n (hdmi, hdmi->audio_cts, hdmi->audio_n);
@@ -3431,7 +3439,7 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev, audio.base = hdmi->regs; audio.irq = irq; audio.hdmi = hdmi; - audio.eld = hdmi->connector.eld; + audio.get_eld = hdmi_audio_get_eld; hdmi->enable_audio = dw_hdmi_ahb_audio_enable; hdmi->disable_audio = dw_hdmi_ahb_audio_disable;
@@ -3444,7 +3452,7 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev,struct dw_hdmi_i2s_audio_data audio; audio.hdmi = hdmi; - audio.eld = hdmi->connector.eld; + audio.get_eld = hdmi_audio_get_eld; audio.write = hdmi_writeb; audio.read = hdmi_readb; hdmi->enable_audio = dw_hdmi_i2s_audio_enable;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 17/217 drm/nouveau/pmu/gm200-: avoid touching PMU outside of DEVINIT/PREOS/ACR
In reply to Sasha LevinFrom: Ben Skeggs <[email protected]>
[ Upstream commit 1d2271d2fb85e54bfc9630a6c30ac0feb9ffb983 ]
There have been reports of the WFI timing out on some boards, and a patch was proposed to just remove it. This stuff is rather fragile, and I believe the WFI might be needed with our FW prior to GM200.
However, we probably should not be touching PMU during init on GPUs where we depend on NVIDIA FW, outside of limited circumstances, so this should be a somewhat safer change that achieves the desired result.
--- .../gpu/drm/nouveau/nvkm/subdev/pmu/base.c | 37 +++++++++++-------- 1 file changed, 21 insertions(+), 16 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c +21 -16
@@ -94,20 +94,13 @@ nvkm_pmu_fini(struct nvkm_subdev *subdev, bool suspend)return 0 ; } -static int +static void nvkm_pmu_reset (struct nvkm_pmu *pmu) {struct nvkm_device *device = pmu->subdev.device;if (!pmu->func->enabled (pmu)) -return 0 ; - -/* Inhibit interrupts, and wait for idle. */ -nvkm_wr32 (device,0x10a014 ,0x0000ffff ); -nvkm_msec (device,2000 , - if (!nvkm_rd32(device, 0x10a04c)) - break; - ); +return ;/* Reset. */ if (pmu->func->reset)
@@ -118,25 +111,37 @@ nvkm_pmu_reset(struct nvkm_pmu *pmu)if (!(nvkm_rd32 (device,0x10a10c ) &0x00000006 ))break ; ); - -return 0 ; }static int nvkm_pmu_preinit (struct nvkm_subdev *subdev) {struct nvkm_pmu *pmu =nvkm_pmu (subdev); -return nvkm_pmu_reset (pmu); +nvkm_pmu_reset (pmu); +return 0 ; }static int nvkm_pmu_init (struct nvkm_subdev *subdev) {struct nvkm_pmu *pmu =nvkm_pmu (subdev); -int ret =nvkm_pmu_reset (pmu); -if (ret ==0 && pmu->func->init) - ret = pmu->func->init (pmu); -return ret; +struct nvkm_device *device = pmu->subdev.device; + +if (!pmu->func->init) +return 0 ; + +if (pmu->func->enabled (pmu)) { +/* Inhibit interrupts, and wait for idle. */ +nvkm_wr32 (device,0x10a014 ,0x0000ffff ); +nvkm_msec (device,2000 , + if (!nvkm_rd32(device, 0x10a04c)) + break; + ); + +nvkm_pmu_reset (pmu); + } + +return pmu->func->init (pmu); } static void *
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 13/217 selftests/bpf: Destroy XDP link correctly
In reply to Sasha LevinFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit f91231eeeed752119f49eb6620cae44ec745a007 ]
bpf_link__detach() was confused with bpf_link__destroy() and leaves leaked FD in the process. Fix the problem.
--- tools/testing/selftests/bpf/prog_tests/migrate_reuseport.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/prog_tests/migrate_reuseport.c +2 -2
@@ -204,8 +204,8 @@ static int pass_ack(struct migrate_reuseport_test_case *test_case) {int err; - err =bpf_link__detach (test_case->link); -if (!ASSERT_OK (err,"bpf_link__detach" )) + err =bpf_link__destroy (test_case->link); +if (!ASSERT_OK (err,"bpf_link__destroy" ))return -1 ; test_case->link =NULL ;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 18/217 media: atomisp: add NULL check for asd obtained from atomisp_video_pipe
In reply to Sasha LevinFrom: Tsuchiya Yuto <[email protected]>
[ Upstream commit c10bcb13462e9cf43111d17f1e08b4bb4d4401b0 ]
This is almost a BUG report with RFC patch that just avoids kernel oopses. Thus, prefixed with [BUG][RFC].
Here is the kernel log after running v4l2-compliance -d /dev/video4 with this patch applied:
kern :err : [25507.580392] atomisp-isp2 0000:00:03.0: can't change power state from D3cold to D0 (config space inaccessible) kern :warn : [25507.592343] isys dma store at addr(0xcd408) val(0) kern :err : [25507.592995] atomisp-isp2 0000:00:03.0: atomisp_queryctl(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.593685] atomisp-isp2 0000:00:03.0: atomisp_g_input(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.593719] atomisp-isp2 0000:00:03.0: atomisp_g_parm(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.593727] atomisp-isp2 0000:00:03.0: atomisp_queryctl(): asd is NULL, device is ATOMISP ISP ACC [omitting 42 same messages] kern :err : [25507.593976] atomisp-isp2 0000:00:03.0: atomisp_queryctl(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.594191] atomisp-isp2 0000:00:03.0: atomisp_g_input(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.594449] atomisp-isp2 0000:00:03.0: atomisp_queryctl(): asd is NULL, device is ATOMISP ISP ACC [omitting 43 same messages] kern :err : [25507.594756] atomisp-isp2 0000:00:03.0: atomisp_queryctl(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.594779] atomisp-isp2 0000:00:03.0: atomisp_g_ctrl(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.594787] atomisp-isp2 0000:00:03.0: atomisp_s_ctrl(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.594803] atomisp-isp2 0000:00:03.0: atomisp_camera_g_ext_ctrls(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.594880] atomisp-isp2 0000:00:03.0: atomisp_enum_fmt_cap(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.594915] atomisp-isp2 0000:00:03.0: atomisp_g_parm(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.595058] atomisp-isp2 0000:00:03.0: atomisp_try_fmt(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.595089] atomisp-isp2 0000:00:03.0: atomisp_set_fmt(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.595124] atomisp-isp2 0000:00:03.0: atomisp_set_fmt(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.595221] atomisp-isp2 0000:00:03.0: atomisp_set_fmt(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.595241] atomisp-isp2 0000:00:03.0: atomisp_set_fmt(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.601571] atomisp-isp2 0000:00:03.0: can't change power state from D3cold to D0 (config space inaccessible) kern :warn : [25507.607496] isys dma store at addr(0xcd408) val(0) kern :err : [25507.608604] atomisp-isp2 0000:00:03.0: atomisp_queryctl(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.611988] atomisp-isp2 0000:00:03.0: can't change power state from D3cold to D0 (config space inaccessible) kern :warn : [25507.617420] isys dma store at addr(0xcd408) val(0) kern :err : [25507.618429] atomisp-isp2 0000:00:03.0: atomisp_queryctl(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.618811] atomisp-isp2 0000:00:03.0: atomisp_g_parm(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.622193] atomisp-isp2 0000:00:03.0: can't change power state from D3cold to D0 (config space inaccessible) kern :warn : [25507.627355] isys dma store at addr(0xcd408) val(0) kern :err : [25507.628391] atomisp-isp2 0000:00:03.0: atomisp_queryctl(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.631143] atomisp-isp2 0000:00:03.0: can't change power state from D3cold to D0 (config space inaccessible) kern :warn : [25507.635813] isys dma store at addr(0xcd408) val(0) kern :err : [25507.636489] atomisp-isp2 0000:00:03.0: atomisp_queryctl(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.636504] atomisp-isp2 0000:00:03.0: atomisp_s_input(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.636516] atomisp-isp2 0000:00:03.0: atomisp_set_fmt(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.639111] atomisp-isp2 0000:00:03.0: can't change power state from D3cold to D0 (config space inaccessible) kern :warn : [25507.646152] isys dma store at addr(0xcd408) val(0) kern :err : [25507.646831] atomisp-isp2 0000:00:03.0: atomisp_queryctl(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.646847] atomisp-isp2 0000:00:03.0: atomisp_s_input(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.650079] atomisp-isp2 0000:00:03.0: can't change power state from D3cold to D0 (config space inaccessible) kern :warn : [25507.657476] isys dma store at addr(0xcd408) val(0) kern :err : [25507.658741] atomisp-isp2 0000:00:03.0: atomisp_queryctl(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.658759] atomisp-isp2 0000:00:03.0: atomisp_s_input(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.658771] atomisp-isp2 0000:00:03.0: atomisp_set_fmt(): asd is NULL, device is ATOMISP ISP ACC kern :err : [25507.660959] atomisp-isp2 0000:00:03.0: can't change power state from D3cold to D0 (config space inaccessible) kern :warn : [25507.666665] isys dma store at addr(0xcd408) val(0) kern :err : [25507.667397] atomisp-isp2 0000:00:03.0: atomisp_queryctl(): asd is NULL, device is ATOMISP ISP ACC
--- .../staging/media/atomisp/pci/atomisp_cmd.c | 73 +++++++++++++++ .../staging/media/atomisp/pci/atomisp_fops.c | 6 ++ .../staging/media/atomisp/pci/atomisp_ioctl.c | 90 +++++++++++++++++++ 3 files changed, 169 insertions(+)
drivers/staging/media/atomisp/pci/atomisp_cmd.c +73 -0
@@ -1715,6 +1715,12 @@ void atomisp_wdt_refresh_pipe(struct atomisp_video_pipe *pipe, {unsigned long next; +if (!pipe->asd) { +dev_err (pipe->isp->dev,"%s(): asd is NULL, device is %s\n" , + __func__, pipe->vdev.name); +return ; + } +if (delay !=ATOMISP_WDT_KEEP_CURRENT_DELAY ) pipe->wdt_duration = delay;
@@ -1777,6 +1783,12 @@ void atomisp_wdt_refresh(struct atomisp_sub_device *asd, unsigned int delay)/* ISP2401 */ void atomisp_wdt_stop_pipe (struct atomisp_video_pipe *pipe,bool sync) { +if (!pipe->asd) { +dev_err (pipe->isp->dev,"%s(): asd is NULL, device is %s\n" , + __func__, pipe->vdev.name); +return ; + } +if (!atomisp_is_wdt_running (pipe))return ;
@@ -4109,6 +4121,12 @@ void atomisp_handle_parameter_and_buffer(struct atomisp_video_pipe *pipe)unsigned long irqflags;bool need_to_enqueue_buffer = false; +if (!asd) { +dev_err (pipe->isp->dev,"%s(): asd is NULL, device is %s\n" , + __func__, pipe->vdev.name); +return ; + } +if (atomisp_is_vf_pipe (pipe))return ;
@@ -4196,6 +4214,12 @@ int atomisp_set_parameters(struct video_device *vdev,struct atomisp_css_params *css_param = &asd->params.css_param;int ret; +if (!asd) { +dev_err (pipe->isp->dev,"%s(): asd is NULL, device is %s\n" , + __func__, vdev->name); +return -EINVAL ; + } +if (!asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL ].stream) {dev_err (asd->isp->dev,"%s: internal error!\n" , __func__);return -EINVAL ;
@@ -4857,6 +4881,12 @@ int atomisp_try_fmt(struct video_device *vdev, struct v4l2_pix_format *f,int source_pad =atomisp_subdev_source_pad (vdev);int ret; +if (!asd) { +dev_err (isp->dev,"%s(): asd is NULL, device is %s\n" , + __func__, vdev->name); +return -EINVAL ; + } +if (!isp->inputs[asd->input_curr].camera)return -EINVAL ;
@@ -5198,6 +5228,12 @@ static int atomisp_set_fmt_to_isp(struct video_device *vdev,const struct atomisp_in_fmt_conv *fc;int ret, i; +if (!asd) { +dev_err (isp->dev,"%s(): asd is NULL, device is %s\n" , + __func__, vdev->name); +return -EINVAL ; + } +v4l2_fh_init (&fh.vfh, vdev); isp_sink_crop = atomisp_subdev_get_rect(
@@ -5494,6 +5530,7 @@ static int atomisp_set_fmt_to_snr(struct video_device *vdev, unsigned int dvs_env_w, unsigned int dvs_env_h) { struct atomisp_sub_device *asd = atomisp_to_video_pipe(vdev)->asd; +struct atomisp_video_pipe *pipe =atomisp_to_video_pipe (vdev);const struct atomisp_format_bridge *format;struct v4l2_subdev_pad_config pad_cfg; struct v4l2_subdev_state pad_state = {
@@ -5512,6 +5549,12 @@ static int atomisp_set_fmt_to_snr(struct video_device *vdev,struct v4l2_subdev_fh fh;int ret; +if (!asd) { +dev_err (pipe->isp->dev,"%s(): asd is NULL, device is %s\n" , + __func__, vdev->name); +return -EINVAL ; + } +v4l2_fh_init (&fh.vfh, vdev); stream_index =atomisp_source_pad_to_stream_id (asd, source_pad);
@@ -5602,6 +5645,12 @@ int atomisp_set_fmt(struct video_device *vdev, struct v4l2_format *f)struct v4l2_subdev_fh fh;int ret; +if (!asd) { +dev_err (isp->dev,"%s(): asd is NULL, device is %s\n" , + __func__, vdev->name); +return -EINVAL ; + } +if (source_pad >=ATOMISP_SUBDEV_PADS_NUM )return -EINVAL ;
@@ -6034,6 +6083,12 @@ int atomisp_set_fmt_file(struct video_device *vdev, struct v4l2_format *f)struct v4l2_subdev_fh fh;int ret; +if (!asd) { +dev_err (isp->dev,"%s(): asd is NULL, device is %s\n" , + __func__, vdev->name); +return -EINVAL ; + } +v4l2_fh_init (&fh.vfh, vdev); dev_dbg(isp->dev, "setting fmt %ux%u 0x%x for file inject\n",
@@ -6359,6 +6414,12 @@ bool atomisp_is_vf_pipe(struct atomisp_video_pipe *pipe) {struct atomisp_sub_device *asd = pipe->asd; +if (!asd) { +dev_err (pipe->isp->dev,"%s(): asd is NULL, device is %s\n" , + __func__, pipe->vdev.name); +return false; + } +if (pipe == &asd->video_out_vf)return true;
@@ -6572,6 +6633,12 @@ static int atomisp_get_pipe_id(struct atomisp_video_pipe *pipe) {struct atomisp_sub_device *asd = pipe->asd; +if (!asd) { +dev_err (pipe->isp->dev,"%s(): asd is NULL, device is %s\n" , + __func__, pipe->vdev.name); +return -EINVAL ; + } +if (ATOMISP_USE_YUVPP (asd)) {return IA_CSS_PIPE_ID_YUVPP ; }else if (asd->vfpp->val ==ATOMISP_VFPP_DISABLE_SCALER ) {
@@ -6609,6 +6676,12 @@ int atomisp_get_invalid_frame_num(struct video_device *vdev,struct ia_css_pipe_info p_info;int ret; +if (!asd) { +dev_err (pipe->isp->dev,"%s(): asd is NULL, device is %s\n" , + __func__, vdev->name); +return -EINVAL ; + } +if (asd->isp->inputs[asd->input_curr].camera_caps-> sensor[asd->sensor_curr].stream_num >1 ) {/* External ISP */
drivers/staging/media/atomisp/pci/atomisp_fops.c +6 -0
@@ -1171,6 +1171,12 @@ static int atomisp_mmap(struct file *file, struct vm_area_struct *vma)u32 origin_size, new_size;int ret; +if (!asd) { +dev_err (isp->dev,"%s(): asd is NULL, device is %s\n" , + __func__, vdev->name); +return -EINVAL ; + } +if (!(vma->vm_flags & (VM_WRITE |VM_READ )))return -EACCES ;
drivers/staging/media/atomisp/pci/atomisp_ioctl.c +90 -0
180 lines not on this page · raw message
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 19/217 media: atomisp: fix try_fmt logic
In reply to Sasha LevinFrom: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit c9e9094c4e42124af909b2f5f6ded0498e0854ac ]
The internal try_fmt logic is not meant to provide everything that the V4L2 API should provide. Also, it doesn't decrement the pads that are used only internally by the driver, but aren't part of the device's output.
Fix it.
--- .../staging/media/atomisp/pci/atomisp_ioctl.c | 72 ++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-)
drivers/staging/media/atomisp/pci/atomisp_ioctl.c +71 -1
@@ -852,6 +852,72 @@ static int atomisp_g_fmt_file(struct file *file, void *fh,return 0 ; } +static int atomisp_adjust_fmt (struct v4l2_format *f) +{ +const struct atomisp_format_bridge *format_bridge; +u32 padded_width; + + format_bridge =atomisp_get_format_bridge (f->fmt.pix.pixelformat); + + padded_width = f->fmt.pix.width + pad_w; + +if (format_bridge->planar) { + f->fmt.pix.bytesperline = padded_width; + f->fmt.pix.sizeimage =PAGE_ALIGN (f->fmt.pix.height * +DIV_ROUND_UP (format_bridge->depth * + padded_width,8 )); + }else { + f->fmt.pix.bytesperline =DIV_ROUND_UP (format_bridge->depth * + padded_width,8 ); + f->fmt.pix.sizeimage =PAGE_ALIGN (f->fmt.pix.height * f->fmt.pix.bytesperline); + } + +if (f->fmt.pix.field ==V4L2_FIELD_ANY ) + f->fmt.pix.field =V4L2_FIELD_NONE ; + + format_bridge =atomisp_get_format_bridge (f->fmt.pix.pixelformat); +if (!format_bridge) +return -EINVAL ; + +/* Currently, raw formats are broken!!! */ +if (format_bridge->sh_fmt ==IA_CSS_FRAME_FORMAT_RAW ) { + f->fmt.pix.pixelformat =V4L2_PIX_FMT_YUV420 ; + + format_bridge =atomisp_get_format_bridge (f->fmt.pix.pixelformat); +if (!format_bridge) +return -EINVAL ; + } + + padded_width = f->fmt.pix.width + pad_w; + +if (format_bridge->planar) { + f->fmt.pix.bytesperline = padded_width; + f->fmt.pix.sizeimage =PAGE_ALIGN (f->fmt.pix.height * +DIV_ROUND_UP (format_bridge->depth * + padded_width,8 )); + }else { + f->fmt.pix.bytesperline =DIV_ROUND_UP (format_bridge->depth * + padded_width,8 ); + f->fmt.pix.sizeimage =PAGE_ALIGN (f->fmt.pix.height * f->fmt.pix.bytesperline); + } + +if (f->fmt.pix.field ==V4L2_FIELD_ANY ) + f->fmt.pix.field =V4L2_FIELD_NONE ; + +/* +* FIXME: do we need to setup this differently, depending on the +* sensor or the pipeline? +*/ + f->fmt.pix.colorspace =V4L2_COLORSPACE_REC709 ; + f->fmt.pix.ycbcr_enc =V4L2_YCBCR_ENC_709 ; + f->fmt.pix.xfer_func =V4L2_XFER_FUNC_709 ; + + f->fmt.pix.width -= pad_w; + f->fmt.pix.height -= pad_h; + +return 0 ; +} +/* This function looks up the closest available resolution. */ static int atomisp_try_fmt_cap (struct file *file,void *fh,struct v4l2_format *f)
@@ -863,7 +929,11 @@ static int atomisp_try_fmt_cap(struct file *file, void *fh,rt_mutex_lock (&isp->mutex); ret =atomisp_try_fmt (vdev, &f->fmt.pix,NULL );rt_mutex_unlock (&isp->mutex); -return ret; + +if (ret) +return ret; + +return atomisp_adjust_fmt (f); } static int atomisp_s_fmt_cap(struct file *file, void *fh,
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 15/217 ar5523: Fix null-ptr-deref with unexpected WDCMSG_TARGET_START reply
In reply to Sasha LevinFrom: Zekun Shen <[email protected]>
[ Upstream commit ae80b6033834342601e99f74f6a62ff5092b1cee ]
Unexpected WDCMSG_TARGET_START replay can lead to null-ptr-deref when ar->tx_cmd->odata is NULL. The patch adds a null check to prevent such case.
KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] ar5523_cmd+0x46a/0x581 [ar5523] ar5523_probe.cold+0x1b7/0x18da [ar5523] ? ar5523_cmd_rx_cb+0x7a0/0x7a0 [ar5523] ? __pm_runtime_set_status+0x54a/0x8f0 ? _raw_spin_trylock_bh+0x120/0x120 ? pm_runtime_barrier+0x220/0x220 ? __pm_runtime_resume+0xb1/0xf0 usb_probe_interface+0x25b/0x710 really_probe+0x209/0x5d0 driver_probe_device+0xc6/0x1b0 device_driver_attach+0xe2/0x120
I found the bug using a custome USBFuzz port. It's a research work to fuzz USB stack/drivers. I modified it to fuzz ath9k driver only, providing hand-crafted usb descriptors to QEMU.
After fixing the code (fourth byte in usb packet) to WDCMSG_TARGET_START, I got the null-ptr-deref bug. I believe the bug is triggerable whenever cmd->odata is NULL. After patching, I tested with the same input and no longer see the KASAN report.
This was NOT tested on a real device.
--- drivers/net/wireless/ath/ar5523/ar5523.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/ath/ar5523/ar5523.c +4 -0
@@ -153,6 +153,10 @@ static void ar5523_cmd_rx_cb(struct urb *urb)ar5523_err (ar,"Invalid reply to WDCMSG_TARGET_START" );return ; } +if (!cmd->odata) { +ar5523_err (ar,"Unexpected WDCMSG_TARGET_START reply" ); +return ; + }memcpy (cmd->odata, hdr +1 ,sizeof (u32)); cmd->olen =sizeof (u32); cmd->res =0 ;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 20/217 media: atomisp: set per-device's default mode
In reply to Sasha LevinFrom: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit 2c45e343c581091835c9047ed5298518aa133163 ]
The atomisp driver originally used the s_parm command to initialize the run_mode type to the driver. So, before start setting up the streaming, s_parm should be called.
So, even having 5 "normal" video devices, one meant to be used for each type, the run_mode was actually selected when s_parm is called.
Without setting the run mode, applications that don't call VIDIOC_SET_PARM with a custom atomisp parameters won't work, as the pipeline won't be set:
atomisp-isp2 0000:00:03.0: can't create streams atomisp-isp2 0000:00:03.0: __get_frame_info 1600x1200 (padded to 0) returned -22
However, commit 8a7c5594c020 ("media: v4l2-ioctl: clear fields in s_parm") broke support for it, with a good reason, as drivers shoudn't be extending the API for their own purposes.
So, as an step to allow generic apps to use this driver, put the device's run_mode in preview after open.
After this patch, using v4l2grab starts to work on preview mode (/dev/video2):
$ v4l2grab -f YUYV -x 1600 -y 1200 -d /dev/video2 -n 1 -u $ feh out000.pnm
So, let's just setup the default run_mode that each video devnode should assume, setting it at open() time.
--- drivers/staging/media/atomisp/pci/atomisp_fops.c | 5 +++++ .../staging/media/atomisp/pci/atomisp_subdev.c | 15 ++++++++++----- .../staging/media/atomisp/pci/atomisp_subdev.h | 3 +++ drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 4 +++- drivers/staging/media/atomisp/pci/atomisp_v4l2.h | 3 ++- 5 files changed, 23 insertions(+), 7 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_fops.c +5 -0
@@ -877,6 +877,11 @@ static int atomisp_open(struct file *file)else pipe->users++;rt_mutex_unlock (&isp->mutex); + +/* Ensure that a mode is set */ +if (asd) +v4l2_ctrl_s_ctrl (asd->run_mode, pipe->default_run_mode); +return 0 ; css_error:
drivers/staging/media/atomisp/pci/atomisp_subdev.c +10 -5
@@ -1164,23 +1164,28 @@ static int isp_subdev_init_entities(struct atomisp_sub_device *asd)atomisp_init_acc_pipe (asd, &asd->video_acc); - ret =atomisp_video_init (&asd->video_in,"MEMORY" ); + ret =atomisp_video_init (&asd->video_in,"MEMORY" , +ATOMISP_RUN_MODE_SDV );if (ret <0 )return ret; - ret =atomisp_video_init (&asd->video_out_capture,"CAPTURE" ); + ret =atomisp_video_init (&asd->video_out_capture,"CAPTURE" , +ATOMISP_RUN_MODE_STILL_CAPTURE );if (ret <0 )return ret; - ret =atomisp_video_init (&asd->video_out_vf,"VIEWFINDER" ); + ret =atomisp_video_init (&asd->video_out_vf,"VIEWFINDER" , +ATOMISP_RUN_MODE_CONTINUOUS_CAPTURE );if (ret <0 )return ret; - ret =atomisp_video_init (&asd->video_out_preview,"PREVIEW" ); + ret =atomisp_video_init (&asd->video_out_preview,"PREVIEW" , +ATOMISP_RUN_MODE_PREVIEW );if (ret <0 )return ret; - ret =atomisp_video_init (&asd->video_out_video_capture,"VIDEO" ); + ret =atomisp_video_init (&asd->video_out_video_capture,"VIDEO" , +ATOMISP_RUN_MODE_VIDEO );if (ret <0 )return ret;
drivers/staging/media/atomisp/pci/atomisp_subdev.h +3 -0
@@ -81,6 +81,9 @@ struct atomisp_video_pipe {/* the link list to store per_frame parameters */ struct list_head per_frame_params; +/* Store here the initial run mode */ +unsigned int default_run_mode; +unsigned int buffers_in_css;/* irq_lock is used to protect video buffer state change operations and
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +3 -1
@@ -447,7 +447,8 @@ const struct atomisp_dfs_config dfs_config_cht_soc = { .dfs_table_size = ARRAY_SIZE(dfs_rules_cht_soc), }; -int atomisp_video_init (struct atomisp_video_pipe *video,const char *name) +int atomisp_video_init (struct atomisp_video_pipe *video,const char *name, +unsigned int run_mode) {int ret;const char *direction;
@@ -478,6 +479,7 @@ int atomisp_video_init(struct atomisp_video_pipe *video, const char *name) "ATOMISP ISP %s %s", name, direction); video->vdev.release = video_device_release_empty;video_set_drvdata (&video->vdev, video->isp); + video->default_run_mode = run_mode;return 0 ; }
drivers/staging/media/atomisp/pci/atomisp_v4l2.h +2 -1
@@ -27,7 +27,8 @@ struct v4l2_device;struct atomisp_device ;struct firmware ; -int atomisp_video_init (struct atomisp_video_pipe *video,const char *name); +int atomisp_video_init (struct atomisp_video_pipe *video,const char *name, +unsigned int run_mode);void atomisp_acc_init (struct atomisp_acc_pipe *video,const char *name);void atomisp_video_unregister (struct atomisp_video_pipe *video);void atomisp_acc_unregister (struct atomisp_acc_pipe *video);
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 21/217 media: atomisp-ov2680: Fix ov2680_set_fmt() clobbering the exposure
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 4492289c31364d28c2680b43b18883385a5d216c ]
Now that we restore the default or last user set exposure setting on power_up() there is no need for the registers written by ov2680_set_fmt() to write to the exposure register.
Not doing so fixes the exposure always being reset to the value from the res->regs array after a set_fmt().
--- drivers/staging/media/atomisp/i2c/ov2680.h | 24 ---------------------- 1 file changed, 24 deletions(-)
drivers/staging/media/atomisp/i2c/ov2680.h +0 -24
@@ -289,8 +289,6 @@ static struct ov2680_reg const ov2680_global_setting[] = {*/ static struct ov2680_reg const ov2680_QCIF_30fps[] = { {0x3086 ,0x01 }, - {0x3501 ,0x24 }, - {0x3502 ,0x40 }, {0x370a ,0x23 }, {0x3801 ,0xa0 }, {0x3802 ,0x00 },
@@ -334,8 +332,6 @@ static struct ov2680_reg const ov2680_QCIF_30fps[] = {*/ static struct ov2680_reg const ov2680_CIF_30fps[] = { {0x3086 ,0x01 }, - {0x3501 ,0x24 }, - {0x3502 ,0x40 }, {0x370a ,0x23 }, {0x3801 ,0xa0 }, {0x3802 ,0x00 },
@@ -377,8 +373,6 @@ static struct ov2680_reg const ov2680_CIF_30fps[] = {*/ static struct ov2680_reg const ov2680_QVGA_30fps[] = { {0x3086 ,0x01 }, - {0x3501 ,0x24 }, - {0x3502 ,0x40 }, {0x370a ,0x23 }, {0x3801 ,0xa0 }, {0x3802 ,0x00 },
@@ -420,8 +414,6 @@ static struct ov2680_reg const ov2680_QVGA_30fps[] = {*/ static struct ov2680_reg const ov2680_656x496_30fps[] = { {0x3086 ,0x01 }, - {0x3501 ,0x24 }, - {0x3502 ,0x40 }, {0x370a ,0x23 }, {0x3801 ,0xa0 }, {0x3802 ,0x00 },
@@ -463,8 +455,6 @@ static struct ov2680_reg const ov2680_656x496_30fps[] = {*/ static struct ov2680_reg const ov2680_720x592_30fps[] = { {0x3086 ,0x01 }, - {0x3501 ,0x26 }, - {0x3502 ,0x40 }, {0x370a ,0x23 }, {0x3801 ,0x00 },// X_ADDR_START; {0x3802 ,0x00 },
@@ -508,8 +498,6 @@ static struct ov2680_reg const ov2680_720x592_30fps[] = {*/ static struct ov2680_reg const ov2680_800x600_30fps[] = { {0x3086 ,0x01 }, - {0x3501 ,0x26 }, - {0x3502 ,0x40 }, {0x370a ,0x23 }, {0x3801 ,0x00 }, {0x3802 ,0x00 },
@@ -551,8 +539,6 @@ static struct ov2680_reg const ov2680_800x600_30fps[] = {*/ static struct ov2680_reg const ov2680_720p_30fps[] = { {0x3086 ,0x00 }, - {0x3501 ,0x48 }, - {0x3502 ,0xe0 }, {0x370a ,0x21 }, {0x3801 ,0xa0 }, {0x3802 ,0x00 },
@@ -594,8 +580,6 @@ static struct ov2680_reg const ov2680_720p_30fps[] = {*/ static struct ov2680_reg const ov2680_1296x976_30fps[] = { {0x3086 ,0x00 }, - {0x3501 ,0x48 }, - {0x3502 ,0xe0 }, {0x370a ,0x21 }, {0x3801 ,0xa0 }, {0x3802 ,0x00 },
@@ -637,8 +621,6 @@ static struct ov2680_reg const ov2680_1296x976_30fps[] = {*/ static struct ov2680_reg const ov2680_1456x1096_30fps[] = { {0x3086 ,0x00 }, - {0x3501 ,0x48 }, - {0x3502 ,0xe0 }, {0x370a ,0x21 }, {0x3801 ,0x90 }, {0x3802 ,0x00 },
@@ -682,8 +664,6 @@ static struct ov2680_reg const ov2680_1456x1096_30fps[] = {static struct ov2680_reg const ov2680_1616x916_30fps[] = { {0x3086 ,0x00 }, - {0x3501 ,0x48 }, - {0x3502 ,0xe0 }, {0x370a ,0x21 }, {0x3801 ,0x00 }, {0x3802 ,0x00 },
@@ -726,8 +706,6 @@ static struct ov2680_reg const ov2680_1616x916_30fps[] = {#if 0 static struct ov2680_reg const ov2680_1616x1082_30fps[] = { {0x3086 ,0x00 }, - {0x3501 ,0x48 }, - {0x3502 ,0xe0 }, {0x370a ,0x21 }, {0x3801 ,0x00 }, {0x3802, 0x00},
@@ -769,8 +747,6 @@ static struct ov2680_reg const ov2680_1616x1082_30fps[] = {*/ static struct ov2680_reg const ov2680_1616x1216_30fps[] = { {0x3086 ,0x00 }, - {0x3501 ,0x48 }, - {0x3502 ,0xe0 }, {0x370a ,0x21 }, {0x3801 ,0x00 }, {0x3802 ,0x00 },
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 14/217 selftests/bpf: Fix bpf_object leak in skb_ctx selftest
In reply to Sasha LevinFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 8c7a95520184b6677ca6075e12df9c208d57d088 ]
skb_ctx selftest didn't close bpf_object implicitly allocated by bpf_prog_test_load() helper. Fix the problem by explicitly calling bpf_object__close() at the end of the test.
--- tools/testing/selftests/bpf/prog_tests/skb_ctx.c | 2 ++ 1 file changed, 2 insertions(+)
tools/testing/selftests/bpf/prog_tests/skb_ctx.c +2 -0
@@ -111,4 +111,6 @@ void test_skb_ctx(void)"ctx_out_mark" ,"skb->mark == %u, expected %d\n" , skb.mark, 10); + +bpf_object__close (obj); }
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 22/217 media: atomisp: check before deference asd variable
In reply to Sasha LevinFrom: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit 71665d816214124d6bc4eb80314ac8f84ecacd78 ]
The asd->isp was referenced before checking if asd is not NULL.
This fixes this warning:
../drivers/staging/media/atomisp/pci/atomisp_cmd.c:5548 atomisp_set_fmt_to_snr() warn: variable dereferenced before check 'asd' (see line 5540)
While here, avoid getting the pipe pointer twice.
--- drivers/staging/media/atomisp/pci/atomisp_cmd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_cmd.c +4 -2
@@ -5529,8 +5529,8 @@ static int atomisp_set_fmt_to_snr(struct video_device *vdev, unsigned int padding_w, unsigned int padding_h, unsigned int dvs_env_w, unsigned int dvs_env_h) { - struct atomisp_sub_device *asd = atomisp_to_video_pipe(vdev)->asd; struct atomisp_video_pipe *pipe = atomisp_to_video_pipe(vdev); +struct atomisp_sub_device *asd = pipe->asd;const struct atomisp_format_bridge *format;struct v4l2_subdev_pad_config pad_cfg; struct v4l2_subdev_state pad_state = {
@@ -5541,7 +5541,7 @@ static int atomisp_set_fmt_to_snr(struct video_device *vdev, };struct v4l2_mbus_framefmt *ffmt = &vformat.format;struct v4l2_mbus_framefmt *req_ffmt; -struct atomisp_device *isp = asd->isp; +struct atomisp_device *isp;struct atomisp_input_stream_info *stream_info = (struct atomisp_input_stream_info *)ffmt->reserved;u16 stream_index =ATOMISP_INPUT_STREAM_GENERAL ;
@@ -5555,6 +5555,8 @@ static int atomisp_set_fmt_to_snr(struct video_device *vdev,return -EINVAL ; } + isp = asd->isp; +v4l2_fh_init (&fh.vfh, vdev); stream_index =atomisp_source_pad_to_stream_id (asd, source_pad);
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 27/217 media: atomisp: handle errors at sh_css_create_isp_params()
In reply to Sasha LevinFrom: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit 58043dbf6d1ae9deab4f5aa1e039c70112017682 ]
The succ var tracks memory allocation erros on this function.
Fix it, in order to stop this W=1 Werror in clang:
drivers/staging/media/atomisp/pci/sh_css_params.c:2430:7: error: variable 'succ' set but not used [-Werror,-Wunused-but-set-variable]
bool succ = true;
^--- drivers/staging/media/atomisp/pci/sh_css_params.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/staging/media/atomisp/pci/sh_css_params.c +6 -2
@@ -2431,7 +2431,7 @@ sh_css_create_isp_params(struct ia_css_stream *stream,unsigned int i;struct sh_css_ddr_address_map *ddr_ptrs;struct sh_css_ddr_address_map_size *ddr_ptrs_size; -int err =0 ; +int err;size_t params_size;struct ia_css_isp_parameters *params =kvmalloc (sizeof (struct ia_css_isp_parameters ),GFP_KERNEL );
@@ -2473,7 +2473,11 @@ sh_css_create_isp_params(struct ia_css_stream *stream, succ &= (ddr_ptrs->macc_tbl != mmgr_NULL); *isp_params_out = params; -return err; + +if (!succ) +return -ENOMEM ; + +return 0 ; } static bool
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 24/217 ath11k: enable IEEE80211_VHT_EXT_NSS_BW_CAPABLE if NSS ratio enabled
In reply to Sasha LevinFrom: Wen Gong <[email protected]>
[ Upstream commit 78406044bdd0cc8987bc082b76867c63ab1c6af8 ]
When NSS ratio enabled reported by firmware, SUPPORTS_VHT_EXT_NSS_BW is set in ath11k, meanwhile IEEE80211_VHT_EXT_NSS_BW_CAPABLE also need to be set, otherwise it is invalid because spec in IEEE Std 802.11™‐2020 as below.
Table 9-273-Supported VHT-MCS and NSS Set subfields, it has subfield VHT Extended NSS BW Capable, its definition is:
Indicates whether the STA is capable of interpreting the Extended NSS BW Support subfield of the VHT Capabilities Information field.
dmesg have a message without this patch:
ieee80211 phy0: copying sband (band 1) due to VHT EXT NSS BW flag
It means mac80211 will set IEEE80211_VHT_EXT_NSS_BW_CAPABLE if ath11k not set it in ieee80211_register_hw(). So it is better to set it in ath11k.
Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1
--- drivers/net/wireless/ath/ath11k/mac.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/ath/ath11k/mac.c +4 -0
@@ -4561,6 +4561,10 @@ ath11k_create_vht_cap(struct ath11k *ar, u32 rate_cap_tx_chainmask, vht_cap.vht_supported =1 ; vht_cap.cap = ar->pdev->cap.vht_cap; +if (ar->pdev->cap.nss_ratio_enabled) + vht_cap.vht_mcs.tx_highest |= +cpu_to_le16 (IEEE80211_VHT_EXT_NSS_BW_CAPABLE ); +ath11k_set_vht_txbf_cap (ar, &vht_cap.cap); rxmcs_map =0 ;
Signature · 7 lines
2.34.1 -- ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
Sasha Levin
maintainerPATCH 28/217 ath11k: Fix crash caused by uninitialized TX ring
In reply to Sasha LevinFrom: Baochen Qiang <[email protected]>
[ Upstream commit 273703ebdb01b6c5f1aaf4b98fb57b177609055c ]
Commit 31582373a4a8 ("ath11k: Change number of TCL rings to one for QCA6390") avoids initializing the other entries of dp->tx_ring cause the corresponding TX rings on QCA6390/WCN6855 are not used, but leaves those ring masks in ath11k_hw_ring_mask_qca6390.tx unchanged. Normally this is OK because we will only get interrupts from the first TX ring on these chips and thus only the first entry of dp->tx_ring is involved.
In case of one MSI vector, all DP rings share the same IRQ. For each interrupt, all rings have to be checked, which means the other entries of dp->tx_ring are involved. However since they are not initialized, system crashes.
Fix this issue by simply removing those ring masks.
crash stack:
[ 102.907438] BUG: kernel NULL pointer dereference, address: 0000000000000028 [ 102.907447] #PF: supervisor read access in kernel mode [ 102.907451] #PF: error_code(0x0000) - not-present page [ 102.907453] PGD 1081f0067 P4D 1081f0067 PUD 1081f1067 PMD 0 [ 102.907460] Oops: 0000 [#1] SMP DEBUG_PAGEALLOC NOPTI [ 102.907465] CPU: 0 PID: 3511 Comm: apt-check Kdump: loaded Tainted: G E 5.15.0-rc4-wt-ath+ #20 [ 102.907470] Hardware name: AMD Celadon-RN/Celadon-RN, BIOS RCD1005E 10/08/2020 [ 102.907472] RIP: 0010:ath11k_dp_tx_completion_handler+0x201/0x830 [ath11k] [ 102.907497] Code: 3c 24 4e 8d ac 37 10 04 00 00 4a 8d bc 37 68 04 00 00 48 89 3c 24 48 63 c8 89 83 84 18 00 00 48 c1 e1 05 48 03 8b 78 18 00 00 <8b> 51 08 89 d6 83 e6 07 89 74 24 24 83 fe 03 74 04 85 f6 75 63 41 [ 102.907501] RSP: 0000:ffff9b7340003e08 EFLAGS: 00010202 [ 102.907505] RAX: 0000000000000001 RBX: ffff8e21530c0100 RCX: 0000000000000020 [ 102.907508] RDX: 0000000000000000 RSI: 00000000fffffe00 RDI: ffff8e21530c1938 [ 102.907511] RBP: ffff8e21530c0000 R08: 0000000000000001 R09: 0000000000000000 [ 102.907513] R10: ffff8e2145534c10 R11: 0000000000000001 R12: ffff8e21530c2938 [ 102.907515] R13: ffff8e21530c18e0 R14: 0000000000000100 R15: ffff8e21530c2978 [ 102.907518] FS: 00007f5d4297e740(0000) GS:ffff8e243d600000(0000) knlGS:0000000000000000 [ 102.907521] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 102.907524] CR2: 0000000000000028 CR3: 00000001034ea000 CR4: 0000000000350ef0 [ 102.907527] Call Trace: [ 102.907531] <IRQ> [ 102.907537] ath11k_dp_service_srng+0x5c/0x2f0 [ath11k] [ 102.907556] ath11k_pci_ext_grp_napi_poll+0x21/0x70 [ath11k_pci] [ 102.907562] __napi_poll+0x2c/0x160 [ 102.907570] net_rx_action+0x251/0x310 [ 102.907576] __do_softirq+0x107/0x2fc [ 102.907585] irq_exit_rcu+0x74/0x90 [ 102.907593] common_interrupt+0x83/0xa0 [ 102.907600] </IRQ> [ 102.907601] asm_common_interrupt+0x1e/0x40
Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1
--- drivers/net/wireless/ath/ath11k/hw.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/wireless/ath/ath11k/hw.c +0 -2
@@ -1061,8 +1061,6 @@ const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_ipq8074 = {const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_qca6390 = { .tx = {ATH11K_TX_RING_MASK_0 , -ATH11K_TX_RING_MASK_1 , -ATH11K_TX_RING_MASK_2 , }, .rx_mon_status = {0 ,0 ,0 ,0 ,
Signature · 7 lines
2.34.1 -- ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
Sasha Levin
maintainerPATCH 29/217 usb: dwc3: meson-g12a: fix shared reset control use
In reply to Sasha LevinFrom: Amjad Ouled-Ameur <[email protected]>
[ Upstream commit 4ce3b45704d5ef46fb4b28083c8aba6716fabf3b ]
reset_control_(de)assert() calls are called on a shared reset line when reset_control_reset has been used. This is not allowed by the reset framework.
Use reset_control_rearm() call in suspend() and remove() as a way to state that the resource is no longer used, hence the shared reset line may be triggered again by other devices. Use reset_control_rearm() also in case probe fails after reset() has been called.
reset_control_rearm() keeps use of triggered_count sane in the reset framework, use of reset_control_reset() on shared reset line should be balanced with reset_control_rearm().
--- drivers/usb/dwc3/dwc3-meson-g12a.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/usb/dwc3/dwc3-meson-g12a.c +12 -5
@@ -755,16 +755,16 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) ret =dwc3_meson_g12a_get_phys (priv);if (ret) - goto err_disable_clks; + goto err_rearm; ret = priv->drvdata->setup_regmaps (priv, base);if (ret) - goto err_disable_clks; + goto err_rearm;if (priv->vbus) { ret =regulator_enable (priv->vbus);if (ret) - goto err_disable_clks; + goto err_rearm; }/* Get dr_mode */
@@ -825,6 +825,9 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev)if (priv->vbus)regulator_disable (priv->vbus); +err_rearm: +reset_control_rearm (priv->reset); + err_disable_clks:clk_bulk_disable_unprepare (priv->drvdata->num_clks, priv->drvdata->clks);
@@ -852,6 +855,8 @@ static int dwc3_meson_g12a_remove(struct platform_device *pdev)pm_runtime_put_noidle (dev);pm_runtime_set_suspended (dev); +reset_control_rearm (priv->reset); +clk_bulk_disable_unprepare (priv->drvdata->num_clks, priv->drvdata->clks);
@@ -892,7 +897,7 @@ static int __maybe_unused dwc3_meson_g12a_suspend(struct device *dev)phy_exit (priv->phys[i]); } -reset_control_assert (priv->reset); +reset_control_rearm (priv->reset);return 0 ; }
@@ -902,7 +907,9 @@ static int __maybe_unused dwc3_meson_g12a_resume(struct device *dev)struct dwc3_meson_g12a *priv =dev_get_drvdata (dev);int i, ret; -reset_control_deassert (priv->reset); + ret =reset_control_reset (priv->reset); +if (ret) +return ret; ret = priv->drvdata->usb_init (priv);if (ret)
Signature · 7 lines
2.34.1 _______________________________________________ linux-amlogic mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-amlogic
Sasha Levin
maintainerPATCH 33/217 drm: panel-orientation-quirks: Add quirk for the Lenovo Yoga Book X91F/L
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit bc30c3b0c8a1904d83d5f0d60fb8650a334b207b ]
The Lenovo Yoga Book X91F/L uses a panel which has been mounted 90 degrees rotated. Add a quirk for this.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +6 -0
@@ -262,6 +262,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad D330-10IGM"), }, .driver_data = (void *)&lcd1200x1920_rightside_up, + }, { /* Lenovo Yoga Book X90F / X91F / X91L */ + .matches = { +/* Non exact match to match all versions */ + DMI_MATCH(DMI_PRODUCT_NAME, "Lenovo YB1-X9"), + }, + .driver_data = (void *)&lcd1200x1920_rightside_up, }, { /* OneGX1 Pro */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "SYSTEM_MANUFACTURER"),
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 26/217 bpf: Change value of MAX_TAIL_CALL_CNT from 32 to 33
In reply to Sasha LevinFrom: Tiezhu Yang <[email protected]>
[ Upstream commit ebf7f6f0a6cdcc17a3da52b81e4b3a98c4005028 ]
In the current code, the actual max tail call count is 33 which is greater than MAX_TAIL_CALL_CNT (defined as 32). The actual limit is not consistent with the meaning of MAX_TAIL_CALL_CNT and thus confusing at first glance. We can see the historical evolution from commit 04fd61ab36ec ("bpf: allow bpf programs to tail-call other bpf programs") and commit f9dabe016b63 ("bpf: Undo off-by-one in interpreter tail call count limit"). In order to avoid changing existing behavior, the actual limit is 33 now, this is reasonable.
After commit 874be05f525e ("bpf, tests: Add tail call test suite"), we can see there exists failed testcase.
On all archs when CONFIG_BPF_JIT_ALWAYS_ON is not set:
# echo 0 > /proc/sys/net/core/bpf_jit_enable # modprobe test_bpf # dmesg | grep -w FAIL Tail call error path, max count reached jited:0 ret 34 != 33 FAIL
On some archs:
# echo 1 > /proc/sys/net/core/bpf_jit_enable # modprobe test_bpf # dmesg | grep -w FAIL Tail call error path, max count reached jited:1 ret 34 != 33 FAIL
Although the above failed testcase has been fixed in commit 18935a72eb25 ("bpf/tests: Fix error in tail call limit tests"), it would still be good to change the value of MAX_TAIL_CALL_CNT from 32 to 33 to make the code more readable.
The 32-bit x86 JIT was using a limit of 32, just fix the wrong comments and limit to 33 tail calls as the constant MAX_TAIL_CALL_CNT updated. For the mips64 JIT, use "ori" instead of "addiu" as suggested by Johan Almbladh. For the riscv JIT, use RV_REG_TCC directly to save one register move as suggested by Björn Töpel. For the other implementations, no function changes, it does not change the current limit 33, the new value of MAX_TAIL_CALL_CNT can reflect the actual max tail call count, the related tail call testcases in test_bpf module and selftests can work well for the interpreter and the JIT.
Here are the test results on x86_64:
# uname -m x86_64 # echo 0 > /proc/sys/net/core/bpf_jit_enable # modprobe test_bpf test_suite=test_tail_calls # dmesg | tail -1 test_bpf: test_tail_calls: Summary: 8 PASSED, 0 FAILED, [0/8 JIT'ed] # rmmod test_bpf # echo 1 > /proc/sys/net/core/bpf_jit_enable # modprobe test_bpf test_suite=test_tail_calls # dmesg | tail -1 test_bpf: test_tail_calls: Summary: 8 PASSED, 0 FAILED, [8/8 JIT'ed] # rmmod test_bpf # ./test_progs -t tailcalls #142 tailcalls:OK Summary: 1/11 PASSED, 0 SKIPPED, 0 FAILED
--- arch/arm/net/bpf_jit_32.c | 5 +++-- arch/arm64/net/bpf_jit_comp.c | 5 +++-- arch/mips/net/bpf_jit_comp32.c | 3 +-- arch/mips/net/bpf_jit_comp64.c | 2 +- arch/powerpc/net/bpf_jit_comp32.c | 4 ++-- arch/powerpc/net/bpf_jit_comp64.c | 4 ++-- arch/riscv/net/bpf_jit_comp32.c | 6 ++---- arch/riscv/net/bpf_jit_comp64.c | 7 +++---- arch/s390/net/bpf_jit_comp.c | 6 +++--- arch/sparc/net/bpf_jit_comp_64.c | 2 +- arch/x86/net/bpf_jit_comp.c | 10 +++++----- arch/x86/net/bpf_jit_comp32.c | 4 ++-- include/linux/bpf.h | 2 +- include/uapi/linux/bpf.h | 2 +- kernel/bpf/core.c | 3 ++- lib/test_bpf.c | 4 ++-- tools/include/uapi/linux/bpf.h | 2 +- 17 files changed, 35 insertions(+), 36 deletions(-)
arch/arm/net/bpf_jit_32.c +3 -2
@@ -1199,7 +1199,8 @@ static int emit_bpf_tail_call(struct jit_ctx *ctx)/* tmp2[0] = array, tmp2[1] = index */ -/* if (tail_call_cnt > MAX_TAIL_CALL_CNT) +/* +* if (tail_call_cnt >= MAX_TAIL_CALL_CNT) * goto out; * tail_call_cnt++; */
@@ -1208,7 +1209,7 @@ static int emit_bpf_tail_call(struct jit_ctx *ctx) tc =arm_bpf_get_reg64 (tcc, tmp, ctx);emit (ARM_CMP_I (tc[0 ], hi), ctx);_emit (ARM_COND_EQ ,ARM_CMP_I (tc[1 ], lo), ctx); -_emit (ARM_COND_HI ,ARM_B (jmp_offset), ctx); +_emit (ARM_COND_CS ,ARM_B (jmp_offset), ctx);emit (ARM_ADDS_I (tc[1 ], tc[1 ],1 ), ctx);emit (ARM_ADC_I (tc[0 ], tc[0 ],0 ), ctx);arm_bpf_put_reg64 (tcc, tmp, ctx);
arch/arm64/net/bpf_jit_comp.c +3 -2
@@ -287,13 +287,14 @@ static int emit_bpf_tail_call(struct jit_ctx *ctx)emit (A64_CMP (0 , r3, tmp), ctx);emit (A64_B_ (A64_COND_CS , jmp_offset), ctx); -/* if (tail_call_cnt > MAX_TAIL_CALL_CNT) +/* +* if (tail_call_cnt >= MAX_TAIL_CALL_CNT) * goto out; * tail_call_cnt++; */ emit_a64_mov_i64 (tmp,MAX_TAIL_CALL_CNT , ctx);emit (A64_CMP (1 , tcc, tmp), ctx); -emit (A64_B_ (A64_COND_HI , jmp_offset), ctx); +emit (A64_B_ (A64_COND_CS , jmp_offset), ctx);emit (A64_ADD_I (1 , tcc, tcc,1 ), ctx);/* prog = array->ptrs[index];
arch/mips/net/bpf_jit_comp32.c +1 -2
@@ -1381,8 +1381,7 @@ void build_prologue(struct jit_context *ctx)* 16-byte area in the parent's stack frame. On a tail call, the * calling function jumps into the prologue after these instructions. */ -emit (ctx, ori,MIPS_R_T9 ,MIPS_R_ZERO , -min (MAX_TAIL_CALL_CNT +1 ,0xffff )); +emit (ctx, ori,MIPS_R_T9 ,MIPS_R_ZERO ,min (MAX_TAIL_CALL_CNT ,0xffff ));emit (ctx, sw,MIPS_R_T9 ,0 ,MIPS_R_SP );/*
arch/mips/net/bpf_jit_comp64.c +1 -1
@@ -552,7 +552,7 @@ void build_prologue(struct jit_context *ctx)* On a tail call, the calling function jumps into the prologue * after this instruction. */ -emit (ctx, addiu, tc,MIPS_R_ZERO ,min (MAX_TAIL_CALL_CNT +1 ,0xffff )); +emit (ctx, ori, tc,MIPS_R_ZERO ,min (MAX_TAIL_CALL_CNT ,0xffff ));/* === Entry-point for tail calls === */
arch/powerpc/net/bpf_jit_comp32.c +2 -2
@@ -221,13 +221,13 @@ static int bpf_jit_emit_tail_call(u32 *image, struct codegen_context *ctx, u32 oPPC_BCC (COND_GE , out);/* -* if (tail_call_cnt > MAX_TAIL_CALL_CNT) +* if (tail_call_cnt >= MAX_TAIL_CALL_CNT) * goto out; */ EMIT (PPC_RAW_CMPLWI (_R0,MAX_TAIL_CALL_CNT ));/* tail_call_cnt++; */ EMIT (PPC_RAW_ADDIC (_R0, _R0,1 )); -PPC_BCC (COND_GT , out); +PPC_BCC (COND_GE , out);/* prog = array->ptrs[index]; */ EMIT (PPC_RAW_RLWINM (_R3, b2p_index,2 ,0 ,29 ));
arch/powerpc/net/bpf_jit_comp64.c +2 -2
@@ -228,12 +228,12 @@ static int bpf_jit_emit_tail_call(u32 *image, struct codegen_context *ctx, u32 oPPC_BCC (COND_GE , out);/* -* if (tail_call_cnt > MAX_TAIL_CALL_CNT) +* if (tail_call_cnt >= MAX_TAIL_CALL_CNT) * goto out; */ PPC_BPF_LL (b2p[TMP_REG_1 ],1 ,bpf_jit_stack_tailcallcnt (ctx));EMIT (PPC_RAW_CMPLWI (b2p[TMP_REG_1 ],MAX_TAIL_CALL_CNT )); -PPC_BCC (COND_GT , out); +PPC_BCC (COND_GE , out);/* * tail_call_cnt++;
arch/riscv/net/bpf_jit_comp32.c +2 -4
@@ -799,11 +799,10 @@ static int emit_bpf_tail_call(int insn, struct rv_jit_context *ctx)emit_bcc (BPF_JGE ,lo (idx_reg),RV_REG_T1 , off, ctx);/* -* temp_tcc = tcc - 1; -* if (tcc < 0) +* if (--tcc < 0) * goto out; */ -emit (rv_addi (RV_REG_T1 ,RV_REG_TCC ,-1 ), ctx); +emit (rv_addi (RV_REG_TCC ,RV_REG_TCC ,-1 ), ctx); off =ninsns_rvoff (tc_ninsn - (ctx->ninsns - start_insn));emit_bcc (BPF_JSLT ,RV_REG_TCC ,RV_REG_ZERO , off, ctx);
@@ -829,7 +828,6 @@ static int emit_bpf_tail_call(int insn, struct rv_jit_context *ctx)if (is_12b_check (off, insn))return -1 ;emit (rv_lw (RV_REG_T0 , off,RV_REG_T0 ), ctx); -emit (rv_addi (RV_REG_TCC ,RV_REG_T1 ,0 ), ctx);/* Epilogue jumps to *(t0 + 4). */ __build_epilogue (true, ctx);return 0 ;
arch/riscv/net/bpf_jit_comp64.c +3 -4
@@ -327,12 +327,12 @@ static int emit_bpf_tail_call(int insn, struct rv_jit_context *ctx) off =ninsns_rvoff (tc_ninsn - (ctx->ninsns - start_insn));emit_branch (BPF_JGE ,RV_REG_A2 ,RV_REG_T1 , off, ctx); -/* if (TCC-- < 0) +/* if (--TCC < 0) * goto out; */ -emit_addi (RV_REG_T1 , tcc,-1 , ctx); +emit_addi (RV_REG_TCC , tcc,-1 , ctx); off =ninsns_rvoff (tc_ninsn - (ctx->ninsns - start_insn)); -emit_branch (BPF_JSLT , tcc,RV_REG_ZERO , off, ctx); +emit_branch (BPF_JSLT ,RV_REG_TCC ,RV_REG_ZERO , off, ctx);/* prog = array->ptrs[index]; * if (!prog)
@@ -352,7 +352,6 @@ static int emit_bpf_tail_call(int insn, struct rv_jit_context *ctx)if (is_12b_check (off, insn))return -1 ;emit_ld (RV_REG_T3 , off,RV_REG_T2 , ctx); -emit_mv (RV_REG_TCC ,RV_REG_T1 , ctx);__build_epilogue (true, ctx);return 0 ; }
arch/s390/net/bpf_jit_comp.c +3 -3
@@ -1369,7 +1369,7 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, jit->prg);/* -* if (tail_call_cnt++ > MAX_TAIL_CALL_CNT) +* if (tail_call_cnt++ >= MAX_TAIL_CALL_CNT) * goto out; */
@@ -1381,9 +1381,9 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp,EMIT4_IMM (0xa7080000 ,REG_W0 ,1 );/* laal %w1,%w0,off(%r15) */ EMIT6_DISP_LH (0xeb000000 ,0x00fa ,REG_W1 ,REG_W0 ,REG_15 , off); -/* clij %w1,MAX_TAIL_CALL_CNT,0x2,out */ +/* clij %w1,MAX_TAIL_CALL_CNT-1,0x2,out */ patch_2_clij = jit->prg; -EMIT6_PCREL_RIEC (0xec000000 ,0x007f ,REG_W1 ,MAX_TAIL_CALL_CNT , +EMIT6_PCREL_RIEC (0xec000000 ,0x007f ,REG_W1 ,MAX_TAIL_CALL_CNT -1 ,2 , jit->prg);/*
arch/sparc/net/bpf_jit_comp_64.c +1 -1
@@ -867,7 +867,7 @@ static void emit_tail_call(struct jit_ctx *ctx)emit (LD32 |IMMED |RS1 (SP ) |S13 (off) |RD (tmp), ctx);emit_cmpi (tmp,MAX_TAIL_CALL_CNT , ctx);#define OFFSET2 13 -emit_branch (BGU , ctx->idx, ctx->idx +OFFSET2 , ctx); +emit_branch (BGEU , ctx->idx, ctx->idx +OFFSET2 , ctx);emit_nop (ctx);emit_alu_K (ADD , tmp,1 , ctx);
arch/x86/net/bpf_jit_comp.c +5 -5
@@ -412,7 +412,7 @@ static void emit_indirect_jump(u8 **pprog, int reg, u8 *ip)* ... bpf_tail_call(void *ctx, struct bpf_array *array, u64 index) ... * if (index >= array->map.max_entries) * goto out; -* if (++tail_call_cnt > MAX_TAIL_CALL_CNT) +* if (tail_call_cnt++ >= MAX_TAIL_CALL_CNT) * goto out; * prog = array->ptrs[index]; * if (prog == NULL)
@@ -446,14 +446,14 @@ static void emit_bpf_tail_call_indirect(u8 **pprog, bool *callee_regs_used,EMIT2 (X86_JBE , offset);/* jbe out */ /* -* if (tail_call_cnt > MAX_TAIL_CALL_CNT) +* if (tail_call_cnt++ >= MAX_TAIL_CALL_CNT) * goto out; */ EMIT2_off32 (0x8B ,0x85 , tcc_off);/* mov eax, dword ptr [rbp - tcc_off] */ EMIT3 (0x83 ,0xF8 ,MAX_TAIL_CALL_CNT );/* cmp eax, MAX_TAIL_CALL_CNT */ offset = ctx->tail_call_indirect_label - (prog +2 - start); -EMIT2 (X86_JA , offset);/* ja out */ +EMIT2 (X86_JAE , offset);/* jae out */ EMIT3 (0x83 ,0xC0 ,0x01 );/* add eax, 1 */ EMIT2_off32 (0x89 ,0x85 , tcc_off);/* mov dword ptr [rbp - tcc_off], eax */
@@ -504,14 +504,14 @@ static void emit_bpf_tail_call_direct(struct bpf_jit_poke_descriptor *poke,int offset;/* -* if (tail_call_cnt > MAX_TAIL_CALL_CNT) +* if (tail_call_cnt++ >= MAX_TAIL_CALL_CNT) * goto out; */ EMIT2_off32 (0x8B ,0x85 , tcc_off);/* mov eax, dword ptr [rbp - tcc_off] */ EMIT3 (0x83 ,0xF8 ,MAX_TAIL_CALL_CNT );/* cmp eax, MAX_TAIL_CALL_CNT */ offset = ctx->tail_call_direct_label - (prog +2 - start); -EMIT2 (X86_JA , offset);/* ja out */ +EMIT2 (X86_JAE , offset);/* jae out */ EMIT3 (0x83 ,0xC0 ,0x01 );/* add eax, 1 */ EMIT2_off32 (0x89 ,0x85 , tcc_off);/* mov dword ptr [rbp - tcc_off], eax */
arch/x86/net/bpf_jit_comp32.c +2 -2
@@ -1323,7 +1323,7 @@ static void emit_bpf_tail_call(u8 **pprog, u8 *ip)EMIT2 (IA32_JBE ,jmp_label (jmp_label1,2 ));/* -* if (tail_call_cnt > MAX_TAIL_CALL_CNT) +* if (tail_call_cnt++ >= MAX_TAIL_CALL_CNT) * goto out; */ lo = (u32 )MAX_TAIL_CALL_CNT ;
@@ -1337,7 +1337,7 @@ static void emit_bpf_tail_call(u8 **pprog, u8 *ip)/* cmp ecx,lo */ EMIT3 (0x83 ,add_1reg (0xF8 ,IA32_ECX ), lo); -/* ja out */ +/* jae out */ EMIT2 (IA32_JAE ,jmp_label (jmp_label1,2 ));/* add eax,0x1 */
include/linux/bpf.h +1 -1
@@ -1082,7 +1082,7 @@ struct bpf_array { };#define BPF_COMPLEXITY_LIMIT_INSNS 1000000/* yes. 1M insns */ -#define MAX_TAIL_CALL_CNT 32 +#define MAX_TAIL_CALL_CNT 33#define BPF_F_ACCESS_MASK (BPF_F_RDONLY | \ BPF_F_RDONLY_PROG | \
include/uapi/linux/bpf.h +1 -1
@@ -1744,7 +1744,7 @@ union bpf_attr {* if the maximum number of tail calls has been reached for this * chain of programs. This limit is defined in the kernel by the * macro **MAX_TAIL_CALL_CNT** (not accessible to user space), -* which is currently set to 32. +* which is currently set to 33. * Return * 0 on success, or a negative error in case of failure. *
kernel/bpf/core.c +2 -1
@@ -1574,7 +1574,8 @@ static u64 ___bpf_prog_run(u64 *regs, const struct bpf_insn *insn)if (unlikely (index >= array->map.max_entries)) goto out; -if (unlikely (tail_call_cnt >MAX_TAIL_CALL_CNT )) + +if (unlikely (tail_call_cnt >=MAX_TAIL_CALL_CNT )) goto out; tail_call_cnt++;
lib/test_bpf.c +2 -2
@@ -14683,7 +14683,7 @@ static struct tail_call_test tail_call_tests[] = { BPF_EXIT_INSN(), }, .flags = FLAG_NEED_STATE | FLAG_RESULT_IN_STATE, - .result = (MAX_TAIL_CALL_CNT +1 +1 ) *MAX_TESTRUNS , + .result = (MAX_TAIL_CALL_CNT +1 ) *MAX_TESTRUNS , }, { "Tail call count preserved across function calls",
@@ -14705,7 +14705,7 @@ static struct tail_call_test tail_call_tests[] = { }, .stack_depth = 8, .flags = FLAG_NEED_STATE | FLAG_RESULT_IN_STATE, - .result = (MAX_TAIL_CALL_CNT + 1 + 1) * MAX_TESTRUNS, + .result = (MAX_TAIL_CALL_CNT + 1) * MAX_TESTRUNS, }, { "Tail call error path, NULL target",
tools/include/uapi/linux/bpf.h +1 -1
@@ -1744,7 +1744,7 @@ union bpf_attr {* if the maximum number of tail calls has been reached for this * chain of programs. This limit is defined in the kernel by the * macro **MAX_TAIL_CALL_CNT** (not accessible to user space), -* which is currently set to 32. +* which is currently set to 33. * Return * 0 on success, or a negative error in case of failure. *
Signature · 7 lines
2.34.1 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
Sasha Levin
maintainerPATCH 23/217 ARM: shmobile: rcar-gen2: Add missing of_node_put()
In reply to Sasha LevinFrom: Wan Jiabing <[email protected]>
[ Upstream commit 85744f2d938c5f3cfc44cb6533c157469634da93 ]
Fix following coccicheck warning:
./arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c:156:1-33: Function for_each_matching_node_and_match should have of_node_put() before break and goto.
Early exits from for_each_matching_node_and_match() should decrement the node reference counter.
--- arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c +4 -1
@@ -154,8 +154,10 @@ static int __init rcar_gen2_regulator_quirk(void)return -ENODEV ;for_each_matching_node_and_match (np, rcar_gen2_quirk_match, &id) { -if (!of_device_is_available (np)) +if (!of_device_is_available (np)) { +of_node_put (np);break ; + } ret =of_property_read_u32 (np,"reg" , &addr);if (ret)/* Skip invalid entry and continue */
@@ -164,6 +166,7 @@ static int __init rcar_gen2_regulator_quirk(void) quirk =kzalloc (sizeof (*quirk),GFP_KERNEL );if (!quirk) { ret = -ENOMEM ; +of_node_put (np); goto err_mem; }
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 37/217 amd: hplance: use eth_hw_addr_set()
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 21942eef062781429b356974589d7965952940fb ]
Byte by byte assignments.
Fixes build on m68k.
--- drivers/net/ethernet/amd/hplance.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/amd/hplance.c +3 -1
@@ -129,6 +129,7 @@ static void hplance_init(struct net_device *dev, struct dio_dev *d) {unsigned long va = (d->resource.start +DIO_VIRADDRBASE );struct hplance_private *lp; +u8 addr[ETH_ALEN ];int i;/* reset the board */
@@ -144,9 +145,10 @@ static void hplance_init(struct net_device *dev, struct dio_dev *d)/* The NVRAM holds our ethernet address, one nibble per byte, * at bytes NVRAMOFF+1,3,5,7,9... */ - dev->dev_addr[i] = ((in_8 (va +HPLANCE_NVRAMOFF + i*4 +1 ) &0xF ) <<4 ) + addr[i] = ((in_8 (va +HPLANCE_NVRAMOFF + i*4 +1 ) &0xF ) <<4 ) | (in_8 (va +HPLANCE_NVRAMOFF + i*4 +3 ) &0xF ); } +eth_hw_addr_set (dev, addr); lp =netdev_priv (dev); lp->lance.name = d->name;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 38/217 amd: atarilance: use eth_hw_addr_set()
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit c3dc2f7196ca0f59d9baeb5d3b927e703944dc6c ]
Byte by byte assignments.
Fixes build on m68k.
--- drivers/net/ethernet/amd/atarilance.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/ethernet/amd/atarilance.c +5 -2
@@ -471,6 +471,7 @@ static unsigned long __init lance_probe1( struct net_device *dev,int i;static int did_version;unsigned short save1, save2; +u8 addr[ETH_ALEN ];PROBE_PRINT (("Probing for Lance card at mem %#lx io %#lx\n" , (long )memaddr, (long )ioaddr ));
@@ -585,14 +586,16 @@ static unsigned long __init lance_probe1( struct net_device *dev,eth_hw_addr_set (dev, OldRieblDefHwaddr);break ;case NEW_RIEBL : - lp->memcpy_f (dev->dev_addr,RIEBL_HWADDR_ADDR ,ETH_ALEN ); + lp->memcpy_f (addr,RIEBL_HWADDR_ADDR ,ETH_ALEN ); +eth_hw_addr_set (dev, addr);break ;case PAM_CARD : i =IO ->eeprom;for ( i =0 ; i <6 ; ++i ) - dev->dev_addr[i] = + addr[i] = ((((unsigned short *)MEM )[i*2 ] &0x0f ) <<4 ) | ((((unsigned short *)MEM )[i*2 +1 ] &0x0f )); +eth_hw_addr_set (dev, addr); i =IO ->mem;break ; }
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 41/217 8390: hydra: use eth_hw_addr_set()
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit d7d28e90e229a8af0472421015c5828f5cd1ad2e ]
Loop with offsetting to every second byte, so use a temp buffer.
Fixes m68k build.
--- drivers/net/ethernet/8390/hydra.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/8390/hydra.c +3 -1
@@ -116,6 +116,7 @@ static int hydra_init(struct zorro_dev *z)unsigned long ioaddr = board+HYDRA_NIC_BASE ;const char name[] ="NE2000" ;int start_page, stop_page; +u8 macaddr[ETH_ALEN ];int j;int err;
@@ -129,7 +130,8 @@ static int hydra_init(struct zorro_dev *z)return -ENOMEM ;for (j =0 ; j <ETH_ALEN ; j++) - dev->dev_addr[j] = *((u8 *)(board +HYDRA_ADDRPROM +2 *j)); + macaddr[j] = *((u8 *)(board +HYDRA_ADDRPROM +2 *j)); +eth_hw_addr_set (dev, macaddr);/* We must set the 8390 for word mode. */ z_writeb (0x4b , ioaddr +NE_EN0_DCFG );
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 43/217 8390: wd: use eth_hw_addr_set()
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit f95f8e890a2aa576425402fea44bfa657e8ccaa6 ]
IO reads, so save to an array then eth_hw_addr_set().
Fixes build on x86 (32bit).
--- drivers/net/ethernet/8390/wd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/8390/wd.c +3 -1
@@ -168,6 +168,7 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr)int checksum =0 ;int ancient =0 ;/* An old card without config registers. */ int word16 =0 ;/* 0 = 8 bit, 1 = 16 bit */ +u8 addr[ETH_ALEN ];const char *model_name;static unsigned version_printed;struct ei_device *ei_local =netdev_priv (dev);
@@ -191,7 +192,8 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr)netdev_info (dev, version);for (i =0 ; i <6 ; i++) - dev->dev_addr[i] =inb (ioaddr +8 + i); + addr[i] =inb (ioaddr +8 + i); +eth_hw_addr_set (dev, addr);netdev_info (dev,"WD80x3 at %#3x, %pM" , ioaddr, dev->dev_addr);
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 42/217 8390: mac8390: use eth_hw_addr_set()
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 973a34c087f43b61b26570110a284faf48d08d5d ]
Use temp to pass to the reading function, the function is generic so can't fix there.
Fixes m68k build.
--- drivers/net/ethernet/8390/mac8390.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/8390/mac8390.c +3 -1
@@ -292,6 +292,7 @@ static bool mac8390_rsrc_init(struct net_device *dev,struct nubus_dirent ent;int offset;volatile unsigned short *i; +u8 addr[ETH_ALEN ]; dev->irq =SLOT2IRQ (board->slot);/* This is getting to be a habit */
@@ -314,7 +315,8 @@ static bool mac8390_rsrc_init(struct net_device *dev,return false; } -nubus_get_rsrc_mem (dev->dev_addr, &ent,6 ); +nubus_get_rsrc_mem (addr, &ent,6 ); +eth_hw_addr_set (dev, addr);if (useresources[cardtype] ==1 ) {nubus_rewinddir (&dir);
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 44/217 smc9194: use eth_hw_addr_set()
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 80db345e7df0c507a83bd12ac7766fb054443804 ]
dev_addr is set from IO reads, and broken from a u16 value.
Fixes build on Alpha.
--- drivers/net/ethernet/smsc/smc9194.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/smsc/smc9194.c +4 -2
@@ -856,6 +856,7 @@ static int __init smc_probe(struct net_device *dev, int ioaddr)word configuration_register;word memory_info_register;word memory_cfg_register; +u8 addr[ETH_ALEN ];/* Grab the region so that no one else tries to probe our ioports. */ if (!request_region (ioaddr,SMC_IO_EXTENT ,DRV_NAME ))
@@ -924,9 +925,10 @@ static int __init smc_probe(struct net_device *dev, int ioaddr)word address; address =inw ( ioaddr +ADDR0 + i ); - dev->dev_addr[ i +1 ] = address >>8 ; - dev->dev_addr[ i ] = address &0xFF ; + addr[i +1 ] = address >>8 ; + addr[i] = address &0xFF ; } +eth_hw_addr_set (dev, addr);/* get the memory information */
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 40/217 8390: smc-ultra: use eth_hw_addr_set()
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 5114ddf8dd881f9059147d3f130e9415ce94125e ]
IO reads, so save to an array then eth_hw_addr_set().
Fixes build on Alpha.
--- drivers/net/ethernet/8390/smc-ultra.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/8390/smc-ultra.c +3 -1
@@ -204,6 +204,7 @@ static int __init ultra_probe1(struct net_device *dev, int ioaddr) {int i, retval;int checksum =0 ; +u8 macaddr[ETH_ALEN ];const char *model_name;unsigned char eeprom_irq =0 ;static unsigned version_printed;
@@ -239,7 +240,8 @@ static int __init ultra_probe1(struct net_device *dev, int ioaddr) model_name = (idreg &0xF0 ) ==0x20 ?"SMC Ultra" :"SMC EtherEZ" ;for (i =0 ; i <6 ; i++) - dev->dev_addr[i] =inb (ioaddr +8 + i); + macaddr[i] =inb (ioaddr +8 + i); +eth_hw_addr_set (dev, macaddr);netdev_info (dev,"%s at %#3x, %pM" , model_name, ioaddr, dev->dev_addr);
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 39/217 amd: mvme147: use eth_hw_addr_set()
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit cc71b8b9376ff5072d23b191654408c144dac6aa ]
Byte by byte assignments.
Fixes build on m68k.
--- drivers/net/ethernet/amd/mvme147.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/net/ethernet/amd/mvme147.c +8 -6
@@ -74,6 +74,7 @@ static struct net_device * __init mvme147lance_probe(void)static int called;static const char name[] ="MVME147 LANCE" ;struct m147lance_private *lp; +u8 macaddr[ETH_ALEN ];u_long *addr;u_long address;int err;
@@ -93,15 +94,16 @@ static struct net_device * __init mvme147lance_probe(void) addr = (u_long *)ETHERNET_ADDRESS ; address = *addr; - dev->dev_addr[0 ] =0x08 ; - dev->dev_addr[1 ] =0x00 ; - dev->dev_addr[2 ] =0x3e ; + macaddr[0 ] =0x08 ; + macaddr[1 ] =0x00 ; + macaddr[2 ] =0x3e ; address = address >>8 ; - dev->dev_addr[5 ] = address&0xff ; + macaddr[5 ] = address&0xff ; address = address >>8 ; - dev->dev_addr[4 ] = address&0xff ; + macaddr[4 ] = address&0xff ; address = address >>8 ; - dev->dev_addr[3 ] = address&0xff ; + macaddr[3 ] = address&0xff ; +eth_hw_addr_set (dev, macaddr); printk("%s: MVME147 at 0x%08lx, irq %d, Hardware Address %pM\n", dev->name, dev->base_addr, MVME147_LANCE_IRQ,
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 36/217 amd: a2065/ariadne: use eth_hw_addr_set()
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 285e4c664d6461b175b4613fc77126b5006a1912 ]
dev_addr is initialized byte by byte from series.
Fixes build on x86 (32bit).
--- drivers/net/ethernet/amd/a2065.c | 18 ++++++++++-------- drivers/net/ethernet/amd/ariadne.c | 20 +++++++++++--------- 2 files changed, 21 insertions(+), 17 deletions(-)
drivers/net/ethernet/amd/a2065.c +10 -8
@@ -680,6 +680,7 @@ static int a2065_init_one(struct zorro_dev *z,unsigned long base_addr = board +A2065_LANCE ;unsigned long mem_start = board +A2065_RAM ;struct resource *r1, *r2; +u8 addr[ETH_ALEN ];u32 serial;int err;
@@ -706,17 +707,18 @@ static int a2065_init_one(struct zorro_dev *z, r2->name = dev->name; serial =be32_to_cpu (z->rom.er_SerialNumber); - dev->dev_addr[0 ] =0x00 ; + addr[0 ] =0x00 ;if (z->id !=ZORRO_PROD_AMERISTAR_A2065 ) {/* Commodore */ - dev->dev_addr[1 ] =0x80 ; - dev->dev_addr[2 ] =0x10 ; + addr[1 ] =0x80 ; + addr[2 ] =0x10 ; }else {/* Ameristar */ - dev->dev_addr[1 ] =0x00 ; - dev->dev_addr[2 ] =0x9f ; + addr[1 ] =0x00 ; + addr[2 ] =0x9f ; } - dev->dev_addr[3 ] = (serial >>16 ) &0xff ; - dev->dev_addr[4 ] = (serial >>8 ) &0xff ; - dev->dev_addr[5 ] = serial &0xff ; + addr[3 ] = (serial >>16 ) &0xff ; + addr[4 ] = (serial >>8 ) &0xff ; + addr[5 ] = serial &0xff ; +eth_hw_addr_set (dev, addr); dev->base_addr = (unsigned long )ZTWO_VADDR (base_addr); dev->mem_start = (unsigned long )ZTWO_VADDR (mem_start); dev->mem_end = dev->mem_start +A2065_RAM_SIZE ;
drivers/net/ethernet/amd/ariadne.c +11 -9
@@ -441,11 +441,11 @@ static int ariadne_open(struct net_device *dev)/* Set the Ethernet Hardware Address */ lance->RAP =CSR12 ;/* Physical Address Register, PADR[15:0] */ - lance->RDP = ((u_short *)&dev->dev_addr[0 ])[0 ]; + lance->RDP = ((const u_short *)&dev->dev_addr[0 ])[0 ]; lance->RAP =CSR13 ;/* Physical Address Register, PADR[31:16] */ - lance->RDP = ((u_short *)&dev->dev_addr[0 ])[1 ]; + lance->RDP = ((const u_short *)&dev->dev_addr[0 ])[1 ]; lance->RAP =CSR14 ;/* Physical Address Register, PADR[47:32] */ - lance->RDP = ((u_short *)&dev->dev_addr[0 ])[2 ]; + lance->RDP = ((const u_short *)&dev->dev_addr[0 ])[2 ];/* Set the Init Block Mode */ lance->RAP =CSR15 ;/* Mode Register */
@@ -717,6 +717,7 @@ static int ariadne_init_one(struct zorro_dev *z,unsigned long mem_start = board +ARIADNE_RAM ;struct resource *r1, *r2;struct net_device *dev; +u8 addr[ETH_ALEN ];u32 serial;int err;
@@ -740,12 +741,13 @@ static int ariadne_init_one(struct zorro_dev *z, r2->name = dev->name; serial =be32_to_cpu (z->rom.er_SerialNumber); - dev->dev_addr[0 ] =0x00 ; - dev->dev_addr[1 ] =0x60 ; - dev->dev_addr[2 ] =0x30 ; - dev->dev_addr[3 ] = (serial >>16 ) &0xff ; - dev->dev_addr[4 ] = (serial >>8 ) &0xff ; - dev->dev_addr[5 ] = serial &0xff ; + addr[0 ] =0x00 ; + addr[1 ] =0x60 ; + addr[2 ] =0x30 ; + addr[3 ] = (serial >>16 ) &0xff ; + addr[4 ] = (serial >>8 ) &0xff ; + addr[5 ] = serial &0xff ; +eth_hw_addr_set (dev, addr); dev->base_addr = (unsigned long )ZTWO_VADDR (base_addr); dev->mem_start = (unsigned long )ZTWO_VADDR (mem_start); dev->mem_end = dev->mem_start +ARIADNE_RAM_SIZE ;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 45/217 lasi_82594: use eth_hw_addr_set()
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 5b6d5affd27486ec9152a66df1741cf67782712a ]
dev_addr is set from IO reads, passed to an arch-specific helper. Note that the helper never reads it so uninitialized temp is fine.
Fixes build on parisc.
--- drivers/net/ethernet/i825xx/lasi_82596.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/i825xx/lasi_82596.c +4 -2
@@ -147,6 +147,7 @@ lan_init_chip(struct parisc_device *dev)struct net_device *netdevice;struct i596_private *lp;int retval = -ENOMEM ; +u8 addr[ETH_ALEN ];int i;if (!dev->irq) {
@@ -167,13 +168,14 @@ lan_init_chip(struct parisc_device *dev) netdevice->base_addr = dev->hpa.start; netdevice->irq = dev->irq; -if (pdc_lan_station_id (netdevice->dev_addr, netdevice->base_addr)) { +if (pdc_lan_station_id (addr, netdevice->base_addr)) {for (i =0 ; i <6 ; i++) { - netdevice->dev_addr[i] =gsc_readb (LAN_PROM_ADDR + i); + addr[i] =gsc_readb (LAN_PROM_ADDR + i); }printk (KERN_INFO "%s: MAC of HP700 LAN read from EEPROM\n" , __FILE__); } +eth_hw_addr_set (netdevice, addr); lp =netdev_priv (netdevice); lp->options = dev->id.sversion ==0x72 ?OPT_SWAP_PORT :0 ;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 35/217 amd: ni65: use eth_hw_addr_set()
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 69ede3097b871dbc793dd6e21f38fde56d273963 ]
IO reads, so save to an array then eth_hw_addr_set().
Fixes build on x86 (32bit).
--- drivers/net/ethernet/amd/ni65.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/ethernet/amd/ni65.c +5 -3
@@ -251,7 +251,7 @@ static void ni65_recv_intr(struct net_device *dev,int);static void ni65_xmit_intr (struct net_device *dev,int );static int ni65_open (struct net_device *dev);static int ni65_lance_reinit (struct net_device *dev); -static void ni65_init_lance (struct priv *p,unsigned char *,int ,int ); +static void ni65_init_lance (struct priv *p,const unsigned char *,int ,int );static netdev_tx_t ni65_send_packet (struct sk_buff *skb,struct net_device *dev);static void ni65_timeout (struct net_device *dev,unsigned int txqueue);
@@ -418,6 +418,7 @@ static int __init ni65_probe1(struct net_device *dev,int ioaddr) {int i,j;struct priv *p; +u8 addr[ETH_ALEN ];unsigned long flags; dev->irq = irq;
@@ -444,7 +445,8 @@ static int __init ni65_probe1(struct net_device *dev,int ioaddr)return -ENODEV ;for (j=0 ;j<6 ;j++) - dev->dev_addr[j] =inb (ioaddr+cards[i].addr_offset+j); + addr[j] =inb (ioaddr+cards[i].addr_offset+j); +eth_hw_addr_set (dev, addr);if ( (j=ni65_alloc_buffer (dev)) <0 ) {release_region (ioaddr, cards[i].total_size);
@@ -566,7 +568,7 @@ static int __init ni65_probe1(struct net_device *dev,int ioaddr)/* * set lance register and trigger init */ -static void ni65_init_lance (struct priv *p,unsigned char *daddr,int filter,int mode) +static void ni65_init_lance (struct priv *p,const unsigned char *daddr,int filter,int mode) {int i;u32 pib;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 60/217 drm/amd/display: check top_pipe_to_program pointer
In reply to Sasha LevinFrom: Yang Li <[email protected]>
[ Upstream commit a689e8d1f80012f90384ebac9dcfac4201f9f77e ]
Clang static analysis reports this error
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:2870:7: warning:
Dereference of null pointer [clang-analyzer-core.NullDereference]
if
(top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable) {
^top_pipe_to_program being NULL is caught as an error But then it is used to report the error.
So add a check before using it.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +2 -1
@@ -2870,7 +2870,8 @@ static void commit_planes_for_stream(struct dc *dc,#endif if ((update_type !=UPDATE_TYPE_FAST ) && stream->update_flags.bits.dsc_changed) -if (top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable) { +if (top_pipe_to_program && + top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable) {if (should_use_dmub_lock (stream->link)) {union dmub_hw_lock_flags hw_locks = {0 };struct dmub_hw_lock_inst_flags inst_flags = {0 };
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 46/217 apple: macmace: use eth_hw_addr_set()
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit e217fc4affc8c7392e4db48488b36d2a5d446e9d ]
Byte by byte assignments.
Fixes build on m68k.
--- drivers/net/ethernet/apple/macmace.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/net/ethernet/apple/macmace.c +9 -5
@@ -92,7 +92,7 @@ static void mace_reset(struct net_device *dev);static irqreturn_t mace_interrupt (int irq,void *dev_id);static irqreturn_t mace_dma_intr (int irq,void *dev_id);static void mace_tx_timeout (struct net_device *dev,unsigned int txqueue); -static void __mace_set_address (struct net_device *dev,void *addr); +static void __mace_set_address (struct net_device *dev,const void *addr);/* * Load a receive DMA channel with a base address and ring length
@@ -197,6 +197,7 @@ static int mace_probe(struct platform_device *pdev)unsigned char *addr;struct net_device *dev;unsigned char checksum =0 ; +u8 macaddr[ETH_ALEN ];int err; dev =alloc_etherdev (PRIV_BYTES );
@@ -229,8 +230,9 @@ static int mace_probe(struct platform_device *pdev)for (j =0 ; j <6 ; ++j) {u8 v =bitrev8 (addr[j<<4 ]); checksum ^= v; - dev->dev_addr[j] = v; + macaddr[j] = v; } +eth_hw_addr_set (dev, macaddr);for (; j <8 ; ++j) { checksum ^=bitrev8 (addr[j<<4 ]); }
@@ -315,11 +317,12 @@ static void mace_reset(struct net_device *dev)* Load the address on a mace controller. */ -static void __mace_set_address (struct net_device *dev,void *addr) +static void __mace_set_address (struct net_device *dev,const void *addr) {struct mace_data *mp =netdev_priv (dev);volatile struct mace *mb = mp->mace; -unsigned char *p = addr; +const unsigned char *p = addr; +u8 macaddr[ETH_ALEN ];int i;/* load up the hardware address */
@@ -331,7 +334,8 @@ static void __mace_set_address(struct net_device *dev, void *addr) ; }for (i =0 ; i <6 ; ++i) - mb->padr = dev->dev_addr[i] = p[i]; + mb->padr = macaddr[i] = p[i]; +eth_hw_addr_set (dev, macaddr);if (mp->chipid !=BROKEN_ADDRCHG_REV ) mb->iac =0 ; }
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 34/217 amd: lance: use eth_hw_addr_set()
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 0222ee53c483df7572eea7ba8585dda59328d46e ]
IO reads, so save to an array then eth_hw_addr_set().
Fixes build on x86 (32bit).
--- drivers/net/ethernet/amd/lance.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/amd/lance.c +3 -1
@@ -480,6 +480,7 @@ static int __init lance_probe1(struct net_device *dev, int ioaddr, int irq, intunsigned long flags;int err = -ENOMEM ;void __iomem *bios; +u8 addr[ETH_ALEN ];/* First we look for special cases. Check for HP's on-board ethernet by looking for 'HP' in the BIOS.
@@ -541,7 +542,8 @@ static int __init lance_probe1(struct net_device *dev, int ioaddr, int irq, int/* There is a 16 byte station address PROM at the base address. The first six bytes are the station address. */ for (i =0 ; i <6 ; i++) - dev->dev_addr[i] =inb (ioaddr + i); + addr[i] =inb (ioaddr + i); +eth_hw_addr_set (dev, addr);printk ("%pM" , dev->dev_addr); dev->base_addr = ioaddr;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 32/217 psi: Fix PSI_MEM_FULL state when tasks are in memstall and doing reclaim
In reply to Sasha LevinFrom: Brian Chen <[email protected]>
[ Upstream commit cb0e52b7748737b2cf6481fdd9b920ce7e1ebbdf ]
We've noticed cases where tasks in a cgroup are stalled on memory but there is little memory FULL pressure since tasks stay on the runqueue in reclaim.
A simple example involves a single threaded program that keeps leaking and touching large amounts of memory. It runs in a cgroup with swap enabled, memory.high set at 10M and cpu.max ratio set at 5%. Though there is significant CPU pressure and memory SOME, there is barely any memory FULL since the task enters reclaim and stays on the runqueue. However, this memory-bound task is effectively stalled on memory and we expect memory FULL to match memory SOME in this scenario.
The code is confused about memstall && running, thinking there is a stalled task and a productive task when there's only one task: a reclaimer that's counted as both. To fix this, we redefine the condition for PSI_MEM_FULL to check that all running tasks are in an active memstall instead of checking that there are no running tasks.
case PSI_MEM_FULL:
- return unlikely(tasks[NR_MEMSTALL] && !tasks[NR_RUNNING]);
+ return unlikely(tasks[NR_MEMSTALL] &&
+ tasks[NR_RUNNING] == tasks[NR_MEMSTALL_RUNNING]);
This will capture reclaimers. It will also capture tasks that called psi_memstall_enter() and are about to sleep, but this should be negligible noise.
--- include/linux/psi_types.h | 13 ++++++++++- kernel/sched/psi.c | 45 ++++++++++++++++++++++++--------------- kernel/sched/stats.h | 5 ++++- 3 files changed, 44 insertions(+), 19 deletions(-)
include/linux/psi_types.h +12 -1
@@ -21,7 +21,17 @@ enum psi_task_count {* don't have to special case any state tracking for it. */ NR_ONCPU , - NR_PSI_TASK_COUNTS = 4, +/* +* For IO and CPU stalls the presence of running/oncpu tasks +* in the domain means a partial rather than a full stall. +* For memory it's not so simple because of page reclaimers: +* they are running/oncpu while representing a stall. To tell +* whether a domain has productivity left or not, we need to +* distinguish between regular running (i.e. productive) +* threads and memstall ones. +*/ +NR_MEMSTALL_RUNNING , + NR_PSI_TASK_COUNTS = 5, };/* Task state bitmasks */
@@ -29,6 +39,7 @@ enum psi_task_count {#define TSK_MEMSTALL (1 << NR_MEMSTALL)#define TSK_RUNNING (1 << NR_RUNNING)#define TSK_ONCPU (1 << NR_ONCPU) +#define TSK_MEMSTALL_RUNNING (1 << NR_MEMSTALL_RUNNING)/* Resources that workloads could be stalled on */ enum psi_res {
kernel/sched/psi.c +28 -17
104 lines not on this page · raw message
kernel/sched/stats.h +4 -1
@@ -118,6 +118,9 @@ static inline void psi_enqueue(struct task_struct *p, bool wakeup)if (static_branch_likely (&psi_disabled))return ; +if (p->in_memstall) + set |=TSK_MEMSTALL_RUNNING ; +if (!wakeup || p->sched_psi_wake_requeue) {if (p->in_memstall) set |=TSK_MEMSTALL ;
@@ -148,7 +151,7 @@ static inline void psi_dequeue(struct task_struct *p, bool sleep)return ;if (p->in_memstall) - clear |=TSK_MEMSTALL ; + clear |= (TSK_MEMSTALL |TSK_MEMSTALL_RUNNING );psi_task_change (p, clear,0 ); }
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 48/217 HID: magicmouse: Report battery level over USB
In reply to Sasha LevinFrom: José Expósito <[email protected]>
[ Upstream commit 0b91b4e4dae63cd43871fc2012370b86ee588f91 ]
When connected over USB, the Apple Magic Mouse 2 and the Apple Magic Trackpad 2 register multiple interfaces, one of them is used to report the battery level.
However, unlike when connected over Bluetooth, the battery level is not reported automatically and it is required to fetch it manually.
Fix the battery report descriptor and add a timer to fetch the battery level.
--- drivers/hid/hid-magicmouse.c | 94 +++++++++++++++++++++++++++++++++--- 1 file changed, 88 insertions(+), 6 deletions(-)
drivers/hid/hid-magicmouse.c +88 -6
@@ -57,6 +57,8 @@ MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state fie#define MOUSE_REPORT_ID 0x29#define MOUSE2_REPORT_ID 0x12#define DOUBLE_REPORT_ID 0xf7 +#define USB_BATTERY_TIMEOUT_MS 60000 +/* These definitions are not precise, but they're close enough. (Bits * 0x03 seem to indicate the aspect ratio of the touch, bits 0x70 seem * to be some kind of bit mask -- 0x20 may be a near-field reading,
@@ -140,6 +142,7 @@ struct magicmouse_sc {struct hid_device *hdev;struct delayed_work work; +struct timer_list battery_timer; };static int magicmouse_firm_touch (struct magicmouse_sc *msc)
@@ -738,6 +741,44 @@ static void magicmouse_enable_mt_work(struct work_struct *work)hid_err (msc->hdev,"unable to request touch data (%d)\n" , ret); } +static int magicmouse_fetch_battery (struct hid_device *hdev) +{ +#ifdef CONFIG_HID_BATTERY_STRENGTH +struct hid_report_enum *report_enum; +struct hid_report *report; + +if (!hdev->battery || hdev->vendor !=USB_VENDOR_ID_APPLE || + (hdev->product !=USB_DEVICE_ID_APPLE_MAGICMOUSE2 && + hdev->product !=USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 )) +return -1 ; + + report_enum = &hdev->report_enum[hdev->battery_report_type]; + report = report_enum->report_id_hash[hdev->battery_report_id]; + +if (!report || report->maxfield <1 ) +return -1 ; + +if (hdev->battery_capacity == hdev->battery_max) +return -1 ; + +hid_hw_request (hdev, report,HID_REQ_GET_REPORT ); +return 0 ; +#else +return -1 ; +#endif +} + +static void magicmouse_battery_timer_tick (struct timer_list *t) +{ +struct magicmouse_sc *msc =from_timer (msc, t, battery_timer); +struct hid_device *hdev = msc->hdev; + +if (magicmouse_fetch_battery (hdev) ==0 ) { +mod_timer (&msc->battery_timer, + jiffies +msecs_to_jiffies (USB_BATTERY_TIMEOUT_MS )); + } +} +static int magicmouse_probe (struct hid_device *hdev,const struct hid_device_id *id) {
@@ -745,11 +786,6 @@ static int magicmouse_probe(struct hid_device *hdev,struct hid_report *report;int ret; -if (id->vendor ==USB_VENDOR_ID_APPLE && - id->product ==USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 && - hdev->type !=HID_TYPE_USBMOUSE ) -return -ENODEV ; - msc =devm_kzalloc (&hdev->dev,sizeof (*msc),GFP_KERNEL );if (msc ==NULL ) {hid_err (hdev,"can't alloc magicmouse descriptor\n" );
@@ -775,6 +811,16 @@ static int magicmouse_probe(struct hid_device *hdev,return ret; } +timer_setup (&msc->battery_timer, magicmouse_battery_timer_tick,0 ); +mod_timer (&msc->battery_timer, + jiffies +msecs_to_jiffies (USB_BATTERY_TIMEOUT_MS )); +magicmouse_fetch_battery (hdev); + +if (id->vendor ==USB_VENDOR_ID_APPLE && + (id->product ==USB_DEVICE_ID_APPLE_MAGICMOUSE2 || + (id->product ==USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 && hdev->type !=HID_TYPE_USBMOUSE ))) +return 0 ; +if (!msc->input) {hid_err (hdev,"magicmouse input not registered\n" ); ret = -ENOMEM ;
@@ -835,17 +881,52 @@ static void magicmouse_remove(struct hid_device *hdev) {struct magicmouse_sc *msc =hid_get_drvdata (hdev); -if (msc) +if (msc) {cancel_delayed_work_sync (&msc->work); +del_timer_sync (&msc->battery_timer); + }hid_hw_stop (hdev); } +static __u8 *magicmouse_report_fixup (struct hid_device *hdev,__u8 *rdesc, +unsigned int *rsize) +{ +/* +* Change the usage from: +* 0x06, 0x00, 0xff, // Usage Page (Vendor Defined Page 1) 0 +* 0x09, 0x0b, // Usage (Vendor Usage 0x0b) 3 +* To: +* 0x05, 0x01, // Usage Page (Generic Desktop) 0 +* 0x09, 0x02, // Usage (Mouse) 2 +*/ +if (hdev->vendor ==USB_VENDOR_ID_APPLE && + (hdev->product ==USB_DEVICE_ID_APPLE_MAGICMOUSE2 || + hdev->product ==USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 ) && + *rsize ==83 && rdesc[46 ] ==0x84 && rdesc[58 ] ==0x85 ) { +hid_info (hdev, +"fixing up magicmouse battery report descriptor\n" ); + *rsize = *rsize -1 ; + rdesc =kmemdup (rdesc +1 , *rsize,GFP_KERNEL ); +if (!rdesc) +return NULL ; + + rdesc[0 ] =0x05 ; + rdesc[1 ] =0x01 ; + rdesc[2 ] =0x09 ; + rdesc[3 ] =0x02 ; + } + +return rdesc; +} +static const struct hid_device_id magic_mice[] = { {HID_BLUETOOTH_DEVICE (USB_VENDOR_ID_APPLE ,USB_DEVICE_ID_APPLE_MAGICMOUSE ), .driver_data =0 }, {HID_BLUETOOTH_DEVICE (BT_VENDOR_ID_APPLE ,USB_DEVICE_ID_APPLE_MAGICMOUSE2 ), .driver_data =0 }, + {HID_USB_DEVICE (USB_VENDOR_ID_APPLE , +USB_DEVICE_ID_APPLE_MAGICMOUSE2 ), .driver_data =0 }, {HID_BLUETOOTH_DEVICE (USB_VENDOR_ID_APPLE ,USB_DEVICE_ID_APPLE_MAGICTRACKPAD ), .driver_data =0 }, { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE,
@@ -861,6 +942,7 @@ static struct hid_driver magicmouse_driver = { .id_table = magic_mice, .probe = magicmouse_probe, .remove = magicmouse_remove, + .report_fixup = magicmouse_report_fixup, .raw_event = magicmouse_raw_event, .event = magicmouse_event, .input_mapping = magicmouse_input_mapping,
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 47/217 cirrus: mac89x0: use eth_hw_addr_set()
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 9a962aedd30f7fceb828d3161a80e0526e358eb5 ]
Byte by byte assignments.
Fixes build on m68k.
--- drivers/net/ethernet/cirrus/mac89x0.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/ethernet/cirrus/mac89x0.c +5 -2
@@ -242,12 +242,15 @@ static int mac89x0_device_probe(struct platform_device *pdev)pr_info ("No EEPROM, giving up now.\n" ); goto out1; }else { +u8 addr[ETH_ALEN ]; +for (i =0 ; i <ETH_ALEN ; i +=2 ) {/* Big-endian (why??!) */ unsigned short s =readreg (dev,PP_IA + i); - dev->dev_addr[i] = s >>8 ; - dev->dev_addr[i+1 ] = s &0xff ; + addr[i] = s >>8 ; + addr[i+1 ] = s &0xff ; } +eth_hw_addr_set (dev, addr); } dev->irq =SLOT2IRQ (slot);
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 61/217 drm/amdgpu/display: set vblank_disable_immediate for DC
In reply to Sasha LevinFrom: Alex Deucher <[email protected]>
[ Upstream commit 92020e81ddbeac351ea4a19bcf01743f32b9c800 ]
Disable vblanks immediately to save power. I think this was missed when we merged DC support.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 1 - drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +0 -1
@@ -333,7 +333,6 @@ int amdgpu_irq_init(struct amdgpu_device *adev)if (!amdgpu_device_has_dc_support (adev)) {if (!adev->enable_virtual_display)/* Disable vblank IRQs aggressively for power-saving */ -/* XXX: can this be enabled for DC? */ adev_to_drm (adev)->vblank_disable_immediate = true; r =drm_vblank_init (adev_to_drm (adev), adev->mode_info.num_crtc);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -0
@@ -1597,6 +1597,9 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)adev_to_drm (adev)->mode_config.cursor_width = adev->dm.dc->caps.max_cursor_size;adev_to_drm (adev)->mode_config.cursor_height = adev->dm.dc->caps.max_cursor_size; +/* Disable vblank IRQs aggressively for power-saving */ +adev_to_drm (adev)->vblank_disable_immediate = true; +if (drm_vblank_init (adev_to_drm (adev), adev->dm.display_indexes_num)) {DRM_ERROR ("amdgpu: failed to initialize sw for display support.\n" );
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 31/217 usb: gadget: f_fs: Use stream_open() for endpoint files
In reply to Sasha LevinFrom: Pavankumar Kondeti <[email protected]>
[ Upstream commit c76ef96fc00eb398c8fc836b0eb2f82bcc619dc7 ]
Function fs endpoint file operations are synchronized via an interruptible mutex wait. However we see threads that do ep file operations concurrently are getting blocked for the mutex lock in __fdget_pos(). This is an uninterruptible wait and we see hung task warnings and kernel panic if hung_task_panic systcl is enabled if host does not send/receive the data for long time.
The reason for threads getting blocked in __fdget_pos() is due to the file position protection introduced by the commit 9c225f2655e3 ("vfs: atomic f_pos accesses as per POSIX"). Since function fs endpoint files does not have the notion of the file position, switch to the stream mode. This will bypass the file position mutex and threads will be blocked in interruptible state for the function fs mutex.
It should not affects user space as we are only changing the task state changes the task state from UNINTERRUPTIBLE to INTERRUPTIBLE while waiting for the USB transfers to be finished. However there is a slight change to the O_NONBLOCK behavior. Earlier threads that are using O_NONBLOCK are also getting blocked inside fdget_pos(). Now they reach to function fs and error code is returned. The non blocking behavior is actually honoured now.
--- drivers/usb/gadget/function/f_fs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/gadget/function/f_fs.c +2 -2
@@ -614,7 +614,7 @@ static int ffs_ep0_open(struct inode *inode, struct file *file) file->private_data = ffs;ffs_data_opened (ffs); -return 0 ; +return stream_open (inode, file); }static int ffs_ep0_release (struct inode *inode,struct file *file)
@@ -1154,7 +1154,7 @@ ffs_epfile_open(struct inode *inode, struct file *file) file->private_data = epfile;ffs_data_opened (epfile->ffs); -return 0 ; +return stream_open (inode, file); }static int ffs_aio_cancel (struct kiocb *kiocb)
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 49/217 HID: apple: Do not reset quirks when the Fn key is not found
In reply to Sasha LevinFrom: José Expósito <[email protected]>
[ Upstream commit a5fe7864d8ada170f19cc47d176bf8260ffb4263 ]
When a keyboard without a function key is detected, instead of removing all quirks, remove only the APPLE_HAS_FN quirk.
--- drivers/hid/hid-apple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-apple.c +1 -1
@@ -428,7 +428,7 @@ static int apple_input_configured(struct hid_device *hdev,if ((asc->quirks &APPLE_HAS_FN ) && !asc->fn_found) {hid_info (hdev,"Fn key not found (Apple Wireless Keyboard clone?), disabling Fn key handling\n" ); - asc->quirks =0 ; + asc->quirks &= ~APPLE_HAS_FN ; }return 0 ;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 64/217 drm/amd/display: add else to avoid double destroy clk_mgr
In reply to Sasha LevinFrom: Martin Leung <[email protected]>
[ Upstream commit 11dff0e871037a6ad978e52f826a2eb7f5fb274a ]
[Why & How]
when changing some code we accidentally
changed else if-> if. reverting that.
--- drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c +1 -2
@@ -308,8 +308,7 @@ void dc_destroy_clk_mgr(struct clk_mgr *clk_mgr_base)case FAMILY_NV :if (ASICREV_IS_SIENNA_CICHLID_P (clk_mgr_base->ctx->asic_id.hw_internal_rev)) {dcn3_clk_mgr_destroy (clk_mgr); - } -if (ASICREV_IS_DIMGREY_CAVEFISH_P (clk_mgr_base->ctx->asic_id.hw_internal_rev)) { + }else if (ASICREV_IS_DIMGREY_CAVEFISH_P (clk_mgr_base->ctx->asic_id.hw_internal_rev)) {dcn3_clk_mgr_destroy (clk_mgr); }if (ASICREV_IS_BEIGE_GOBY_P (clk_mgr_base->ctx->asic_id.hw_internal_rev)) {
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 65/217 drm/bridge: megachips: Ensure both bridges are probed before registration
In reply to Sasha LevinFrom: Martyn Welch <[email protected]>
[ Upstream commit 11632d4aa2b3f126790e81a4415d6c23103cf8bb ]
In the configuration used by the b850v3, the STDP2690 is used to read EDID data whilst it's the STDP4028 which can detect when monitors are connected.
This can result in problems at boot with monitors connected when the STDP4028 is probed first, a monitor is detected and an attempt is made to read the EDID data before the STDP2690 has probed:
[ 3.795721] Unable to handle kernel NULL pointer dereference at virtual address 00000018 [ 3.803845] pgd = (ptrval) [ 3.806581] [00000018] *pgd=00000000 [ 3.810180] Internal error: Oops: 5 [#1] SMP ARM [ 3.814813] Modules linked in: [ 3.817879] CPU: 0 PID: 64 Comm: kworker/u4:1 Not tainted 5.15.0 #1 [ 3.824161] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) [ 3.830705] Workqueue: events_unbound deferred_probe_work_func [ 3.836565] PC is at stdp2690_get_edid+0x44/0x19c [ 3.841286] LR is at ge_b850v3_lvds_get_modes+0x2c/0x5c [ 3.846526] pc : [<805eae10>] lr : [<805eb138>] psr: 80000013 [ 3.852802] sp : 81c359d0 ip : 7dbb550b fp : 81c35a1c [ 3.858037] r10: 81c73840 r9 : 81c73894 r8 : 816d9800 [ 3.863270] r7 : 00000000 r6 : 81c34000 r5 : 00000000 r4 : 810c35f0 [ 3.869808] r3 : 80e3e294 r2 : 00000080 r1 : 00000cc0 r0 : 81401180 [ 3.876349] Flags: Nzcv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none [ 3.883499] Control: 10c5387d Table: 1000404a DAC: 00000051 [ 3.889254] Register r0 information: slab kmem_cache start 81401180 pointer offset 0 [ 3.897034] Register r1 information: non-paged memory [ 3.902097] Register r2 information: non-paged memory [ 3.907160] Register r3 information: non-slab/vmalloc memory [ 3.912832] Register r4 information: non-slab/vmalloc memory [ 3.918503] Register r5 information: NULL pointer [ 3.923217] Register r6 information: non-slab/vmalloc memory [ 3.928887] Register r7 information: NULL pointer [ 3.933601] Register r8 information: slab kmalloc-1k start 816d9800 pointer offset 0 size 1024 [ 3.942244] Register r9 information: slab kmalloc-2k start 81c73800 pointer offset 148 size 2048 [ 3.951058] Register r10 information: slab kmalloc-2k start 81c73800 pointer offset 64 size 2048 [ 3.959873] Register r11 information: non-slab/vmalloc memory [ 3.965632] Register r12 information: non-paged memory [ 3.970781] Process kworker/u4:1 (pid: 64, stack limit = 0x(ptrval)) [ 3.977148] Stack: (0x81c359d0 to 0x81c36000) [ 3.981517] 59c0: 80b2b668 80b2b5bc 000002e2 0000034e [ 3.989712] 59e0: 81c35a8c 816d98e8 81c35a14 7dbb550b 805bfcd0 810c35f0 81c73840 824addc0 [ 3.997906] 5a00: 00001000 816d9800 81c73894 81c73840 81c35a34 81c35a20 805eb138 805eadd8 [ 4.006099] 5a20: 810c35f0 00000045 81c35adc 81c35a38 80594188 805eb118 80d7c788 80dd1848 [ 4.014292] 5a40: 00000000 81c35a50 80dca950 811194d3 80dca7c4 80dca944 80dca91c 816d9800 [ 4.022485] 5a60: 81c34000 81c760a8 816d9800 80c58c98 810c35f0 816d98e8 00001000 00001000 [ 4.030678] 5a80: 00000000 00000000 8017712c 81c60000 00000002 00000001 00000000 00000000 [ 4.038870] 5aa0: 816d9900 816d9900 00000000 7dbb550b 805c700c 00000008 826282c8 826282c8 [ 4.047062] 5ac0: 00001000 81e1ce40 00001000 00000002 81c35bf4 81c35ae0 805d9694 80593fc0 [ 4.055255] 5ae0: 8017a970 80179ad8 00000179 00000000 81c35bcc 81c35b00 80177108 8017a950 [ 4.063447] 5b00: 00000000 81c35b10 81c34000 00000000 81004fd8 81010a38 00000000 00000059 [ 4.071639] 5b20: 816d98d4 81fbb718 00000013 826282c8 8017a940 81c35b40 81134448 00000400 [ 4.079831] 5b40: 00000178 00000000 e063b9c1 00000000 c2000049 00000040 00000000 00000008 [ 4.088024] 5b60: 82628300 82628380 00000000 00000000 81c34000 00000000 81fbb700 82628340 [ 4.096216] 5b80: 826283c0 00001000 00000000 00000010 816d9800 826282c0 801766f8 00000000 [ 4.104408] 5ba0: 00000000 81004fd8 00000049 00000000 00000000 00000001 80dcf940 80178de4 [ 4.112601] 5bc0: 81c35c0c 7dbb550b 80178de4 81fbb700 00000010 00000010 810c35f4 81e1ce40 [ 4.120793] 5be0: 81c40908 0000000c 81c35c64 81c35bf8 805a7f18 805d94a0 81c35c3c 816d9800 [ 4.128985] 5c00: 00000010 81c34000 81c35c2c 81c35c18 8012fce0 805be90c 81c35c3c 81c35c28 [ 4.137178] 5c20: 805be90c 80173210 81fbb600 81fbb6b4 81c35c5c 7dbb550b 81c35c64 81fbb700 [ 4.145370] 5c40: 816d9800 00000010 810c35f4 81e1ce40 81c40908 0000000c 81c35c84 81c35c68 [ 4.153565] 5c60: 805a8c78 805a7ed0 816d9800 81fbb700 00000010 00000000 81c35cac 81c35c88 [ 4.161758] 5c80: 805a8dc4 805a8b68 816d9800 00000000 816d9800 00000000 8179f810 810c42d0 [ 4.169950] 5ca0: 81c35ccc 81c35cb0 805e47b0 805a8d18 824aa240 81e1ea80 81c40908 81126b60 [ 4.178144] 5cc0: 81c35d14 81c35cd0 8060db1c 805e46cc 81c35d14 81c35ce0 80dd90f8 810c4d58 [ 4.186338] 5ce0: 80dd90dc 81fe9740 fffffffe 81fe9740 81e1ea80 00000000 810c4d6c 80c4b95c [ 4.194531] 5d00: 80dd9a3c 815c6810 81c35d34 81c35d18 8060dc9c 8060d8fc 8246b440 815c6800 [ 4.202724] 5d20: 815c6810 eefd8e00 81c35d44 81c35d38 8060dd80 8060dbec 81c35d6c 81c35d48 [ 4.210918] 5d40: 805e98a4 8060dd70 00000000 815c6810 810c45b0 81126e90 81126e90 80dd9a3c [ 4.219112] 5d60: 81c35d8c 81c35d70 80619574 805e9808 815c6810 00000000 810c45b0 81126e90 [ 4.227305] 5d80: 81c35db4 81c35d90 806168dc 80619514 80625df0 80623c80 815c6810 810c45b0 [ 4.235498] 5da0: 81c35e6c 815c6810 81c35dec 81c35db8 80616d04 80616800 81c35de4 81c35dc8 [ 4.243691] 5dc0: 808382b0 80b2f444 8116e310 8116e314 81c35e6c 815c6810 00000003 80dd9a3c [ 4.251884] 5de0: 81c35e14 81c35df0 80616ec8 80616c60 00000001 810c45b0 81c35e6c 815c6810 [ 4.260076] 5e00: 00000001 80dd9a3c 81c35e34 81c35e18 80617338 80616e90 00000000 81c35e6c [ 4.268269] 5e20: 80617284 81c34000 81c35e64 81c35e38 80614730 80617290 81c35e64 8171a06c [ 4.276461] 5e40: 81e220b8 7dbb550b 815c6810 81c34000 815c6854 81126e90 81c35e9c 81c35e68 [ 4.284654] 5e60: 8061673c 806146a8 8060f5e0 815c6810 00000001 7dbb550b 00000000 810c5080 [ 4.292847] 5e80: 810c5320 815c6810 81126e90 00000000 81c35eac 81c35ea0 80617554 80616650 [ 4.301040] 5ea0: 81c35ecc 81c35eb0 80615694 80617544 810c5080 810c5080 810c5094 81126e90 [ 4.309233] 5ec0: 81c35efc 81c35ed0 80615c6c 8061560c 80615bc0 810c50c0 817eeb00 81412800 [ 4.317425] 5ee0: 814c3000 00000000 814c300d 81119a60 81c35f3c 81c35f00 80141488 80615bcc [ 4.325618] 5f00: 81c60000 81c34000 81c35f24 81c35f18 80143078 817eeb00 81412800 817eeb18 [ 4.333811] 5f20: 81412818 81003d00 00000088 81412800 81c35f74 81c35f40 80141a48 80141298 [ 4.342005] 5f40: 81c35f74 81c34000 801481ac 817efa40 817efc00 801417d8 817eeb00 00000000 [ 4.350199] 5f60: 815a7e7c 81c34000 81c35fac 81c35f78 80149b1c 801417e4 817efc20 817efc20 [ 4.358391] 5f80: ffffe000 817efa40 801499a8 00000000 00000000 00000000 00000000 00000000 [ 4.366583] 5fa0: 00000000 81c35fb0 80100130 801499b4 00000000 00000000 00000000 00000000 [ 4.374774] 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 4.382966] 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000 [ 4.391155] Backtrace: [ 4.393613] [<805eadcc>] (stdp2690_get_edid) from [<805eb138>] (ge_b850v3_lvds_get_modes+0x2c/0x5c) [ 4.402691] r10:81c73840 r9:81c73894 r8:816d9800 r7:00001000 r6:824addc0 r5:81c73840 [ 4.410534] r4:810c35f0 [ 4.413073] [<805eb10c>] (ge_b850v3_lvds_get_modes) from [<80594188>] (drm_helper_probe_single_connector_modes+0x1d4/0x84c) [ 4.424240] r5:00000045 r4:810c35f0 [ 4.427822] [<80593fb4>] (drm_helper_probe_single_connector_modes) from [<805d9694>] (drm_client_modeset_probe+0x200/0x1384) [ 4.439074] r10:00000002 r9:00001000 r8:81e1ce40 r7:00001000 r6:826282c8 r5:826282c8 [ 4.446917] r4:00000008 [ 4.449455] [<805d9494>] (drm_client_modeset_probe) from [<805a7f18>] (__drm_fb_helper_initial_config_and_unlock+0x54/0x5b4) [ 4.460713] r10:0000000c r9:81c40908 r8:81e1ce40 r7:810c35f4 r6:00000010 r5:00000010 [ 4.468556] r4:81fbb700 [ 4.471095] [<805a7ec4>] (__drm_fb_helper_initial_config_and_unlock) from [<805a8c78>] (drm_fbdev_client_hotplug+0x11c/0x1b0) [ 4.482434] r10:0000000c r9:81c40908 r8:81e1ce40 r7:810c35f4 r6:00000010 r5:816d9800 [ 4.490276] r4:81fbb700 [ 4.492814] [<805a8b5c>] (drm_fbdev_client_hotplug) from [<805a8dc4>] (drm_fbdev_generic_setup+0xb8/0x1a4) [ 4.502494] r7:00000000 r6:00000010 r5:81fbb700 r4:816d9800 [ 4.508160] [<805a8d0c>] (drm_fbdev_generic_setup) from [<805e47b0>] (imx_drm_bind+0xf0/0x130) [ 4.516805] r7:810c42d0 r6:8179f810 r5:00000000 r4:816d9800 [ 4.522474] [<805e46c0>] (imx_drm_bind) from [<8060db1c>] (try_to_bring_up_master+0x22c/0x2f0) [ 4.531116] r7:81126b60 r6:81c40908 r5:81e1ea80 r4:824aa240 [ 4.536783] [<8060d8f0>] (try_to_bring_up_master) from [<8060dc9c>] (__component_add+0xbc/0x184) [ 4.545597] r10:815c6810 r9:80dd9a3c r8:80c4b95c r7:810c4d6c r6:00000000 r5:81e1ea80 [ 4.553440] r4:81fe9740 [ 4.555980] [<8060dbe0>] (__component_add) from [<8060dd80>] (component_add+0x1c/0x20) [ 4.563921] r7:eefd8e00 r6:815c6810 r5:815c6800 r4:8246b440 [ 4.569589] [<8060dd64>] (component_add) from [<805e98a4>] (dw_hdmi_imx_probe+0xa8/0xe8) [ 4.577702] [<805e97fc>] (dw_hdmi_imx_probe) from [<80619574>] (platform_probe+0x6c/0xc8) [ 4.585908] r9:80dd9a3c r8:81126e90 r7:81126e90 r6:810c45b0 r5:815c6810 r4:00000000 [ 4.593662] [<80619508>] (platform_probe) from [<806168dc>] (really_probe+0xe8/0x460) [ 4.601524] r7:81126e90 r6:810c45b0 r5:00000000 r4:815c6810 [ 4.607191] [<806167f4>] (really_probe) from [<80616d04>] (__driver_probe_device+0xb0/0x230) [ 4.615658] r7:815c6810 r6:81c35e6c r5:810c45b0 r4:815c6810 [ 4.621326] [<80616c54>] (__driver_probe_device) from [<80616ec8>] (driver_probe_device+0x44/0xe0) [ 4.630313] r9:80dd9a3c r8:00000003 r7:815c6810 r6:81c35e6c r5:8116e314 r4:8116e310 [ 4.638068] [<80616e84>] (driver_probe_device) from [<80617338>] (__device_attach_driver+0xb4/0x12c) [ 4.647227] r9:80dd9a3c r8:00000001 r7:815c6810 r6:81c35e6c r5:810c45b0 r4:00000001 [ 4.654981] [<80617284>] (__device_attach_driver) from [<80614730>] (bus_for_each_drv+0x94/0xd8) [ 4.663794] r7:81c34000 r6:80617284 r5:81c35e6c r4:00000000 [ 4.669461] [<8061469c>] (bus_for_each_drv) from [<8061673c>] (__device_attach+0xf8/0x190) [ 4.677753] r7:81126e90 r6:815c6854 r5:81c34000 r4:815c6810 [ 4.683419] [<80616644>] (__device_attach) from [<80617554>] (device_initial_probe+0x1c/0x20) [ 4.691971] r8:00000000 r7:81126e90 r6:815c6810 r5:810c5320 r4:810c5080 [ 4.698681] [<80617538>] (device_initial_probe) from [<80615694>] (bus_probe_device+0x94/0x9c) [ 4.707318] [<80615600>] (bus_probe_device) from [<80615c6c>] (deferred_probe_work_func+0xac/0xf0) [ 4.716305] r7:81126e90 r6:810c5094 r5:810c5080 r4:810c5080 [ 4.721973] [<80615bc0>] (deferred_probe_work_func) from [<80141488>] (process_one_work+0x1fc/0x54c) [ 4.731139] r10:81119a60 r9:814c300d r8:00000000 r7:814c3000 r6:81412800 r5:817eeb00 [ 4.738981] r4:810c50c0 r3:80615bc0 [ 4.742563] [<8014128c>] (process_one_work) from [<80141a48>] (worker_thread+0x270/0x570) [ 4.750765] r10:81412800 r9:00000088 r8:81003d00 r7:81412818 r6:817eeb18 r5:81412800 [ 4.758608] r4:817eeb00 [ 4.761147] [<801417d8>] (worker_thread) from [<80149b1c>] (kthread+0x174/0x190) [ 4.768574] r10:81c34000 r9:815a7e7c r8:00000000 r7:817eeb00 r6:801417d8 r5:817efc00 [ 4.776417] r4:817efa40 [ 4.778955] [<801499a8>] (kthread) from [<80100130>] (ret_from_fork+0x14/0x24) [ 4.786201] Exception stack(0x81c35fb0 to 0x81c35ff8) [ 4.791266] 5fa0: 00000000 00000000 00000000 00000000 [ 4.799459] 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 4.807651] 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000 [ 4.814279] r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:801499a8 [ 4.822120] r4:817efa40 [ 4.824664] Code: e3a02080 e593001c e3a01d33 e3a05000 (e5979018)
Split the registration from the STDP4028 probe routine and only perform registration once both the STDP4028 and STDP2690 have probed.
--- .../bridge/megachips-stdpxxxx-ge-b850v3-fw.c | 40 +++++++++++++------ 1 file changed, 28 insertions(+), 12 deletions(-)
drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c +28 -12
@@ -306,19 +306,10 @@ static void ge_b850v3_lvds_remove(void)mutex_unlock (&ge_b850v3_lvds_dev_mutex); } -static int stdp4028_ge_b850v3_fw_probe (struct i2c_client *stdp4028_i2c, -const struct i2c_device_id *id) +static int ge_b850v3_register (void ) { +struct i2c_client *stdp4028_i2c = ge_b850v3_lvds_ptr->stdp4028_i2c;struct device *dev = &stdp4028_i2c->dev; -int ret; - - ret =ge_b850v3_lvds_init (dev); - -if (ret) -return ret; - - ge_b850v3_lvds_ptr->stdp4028_i2c = stdp4028_i2c; -i2c_set_clientdata (stdp4028_i2c, ge_b850v3_lvds_ptr);/* drm bridge initialization */ ge_b850v3_lvds_ptr->bridge.funcs = &ge_b850v3_lvds_funcs;
@@ -343,6 +334,27 @@ static int stdp4028_ge_b850v3_fw_probe(struct i2c_client *stdp4028_i2c, "ge-b850v3-lvds-dp", ge_b850v3_lvds_ptr); } +static int stdp4028_ge_b850v3_fw_probe (struct i2c_client *stdp4028_i2c, +const struct i2c_device_id *id) +{ +struct device *dev = &stdp4028_i2c->dev; +int ret; + + ret =ge_b850v3_lvds_init (dev); + +if (ret) +return ret; + + ge_b850v3_lvds_ptr->stdp4028_i2c = stdp4028_i2c; +i2c_set_clientdata (stdp4028_i2c, ge_b850v3_lvds_ptr); + +/* Only register after both bridges are probed */ +if (!ge_b850v3_lvds_ptr->stdp2690_i2c) +return 0 ; + +return ge_b850v3_register (); +} +static int stdp4028_ge_b850v3_fw_remove (struct i2c_client *stdp4028_i2c) {ge_b850v3_lvds_remove ();
@@ -386,7 +398,11 @@ static int stdp2690_ge_b850v3_fw_probe(struct i2c_client *stdp2690_i2c, ge_b850v3_lvds_ptr->stdp2690_i2c = stdp2690_i2c;i2c_set_clientdata (stdp2690_i2c, ge_b850v3_lvds_ptr); -return 0 ; +/* Only register after both bridges are probed */ +if (!ge_b850v3_lvds_ptr->stdp4028_i2c) +return 0 ; + +return ge_b850v3_register (); }static int stdp2690_ge_b850v3_fw_remove (struct i2c_client *stdp2690_i2c)
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 51/217 libbpf: Accommodate DWARF/compiler bug with duplicated structs
In reply to Sasha LevinFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit efdd3eb8015e7447095f02a26eaabd164cd18004 ]
According to [0], compilers sometimes might produce duplicate DWARF definitions for exactly the same struct/union within the same compilation unit (CU). We've had similar issues with identical arrays and handled them with a similar workaround in 6b6e6b1d09aa ("libbpf:
Accomodate DWARF/compiler bug with duplicated identical arrays"). Do the same for struct/union by ensuring that two structs/unions are exactly the same, down to the integer values of field referenced type IDs.
Solving this more generically (allowing referenced types to be equivalent, but using different type IDs, all within a single CU) requires a huge complexity increase to handle many-to-many mappings between canonidal and candidate type graphs. Before we invest in that, let's see if this approach handles all the instances of this issue in practice. Thankfully it's pretty rare, it seems.
[0] https://lore.kernel.org/bpf/YXr2NFlJTAhHdZqq@krava/
--- tools/lib/bpf/btf.c | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-)
tools/lib/bpf/btf.c +41 -4
@@ -3443,8 +3443,8 @@ static long btf_hash_struct(struct btf_type *t) }/* -* Check structural compatibility of two FUNC_PROTOs, ignoring referenced type -* IDs. This check is performed during type graph equivalence check and +* Check structural compatibility of two STRUCTs/UNIONs, ignoring referenced +* type IDs. This check is performed during type graph equivalence check and * referenced types equivalence is checked separately. */ static bool btf_shallow_equal_struct (struct btf_type *t1,struct btf_type *t2)
@@ -3817,6 +3817,31 @@ static int btf_dedup_identical_arrays(struct btf_dedup *d, __u32 id1, __u32 id2)return btf_equal_array (t1, t2); } +/* Check if given two types are identical STRUCT/UNION definitions */ +static bool btf_dedup_identical_structs (struct btf_dedup *d,__u32 id1,__u32 id2) +{ +const struct btf_member *m1, *m2; +struct btf_type *t1, *t2; +int n, i; + + t1 =btf_type_by_id (d->btf, id1); + t2 =btf_type_by_id (d->btf, id2); + +if (!btf_is_composite (t1) ||btf_kind (t1) !=btf_kind (t2)) +return false; + +if (!btf_shallow_equal_struct (t1, t2)) +return false; + + m1 =btf_members (t1); + m2 =btf_members (t2); +for (i =0 , n =btf_vlen (t1); i < n; i++, m1++, m2++) { +if (m1->type != m2->type) +return false; + } +return true; +} +/* * Check equivalence of BTF type graph formed by candidate struct/union (we'll * call it "candidate graph" in this description for brevity) to a type graph
@@ -3928,6 +3953,8 @@ static int btf_dedup_is_equiv(struct btf_dedup *d, __u32 cand_id, hypot_type_id = d->hypot_map[canon_id];if (hypot_type_id <=BTF_MAX_NR_TYPES ) { +if (hypot_type_id == cand_id) +return 1 ;/* In some cases compiler will generate different DWARF types * for *identical* array type definitions and use them for * different fields within the *same* struct. This breaks type
@@ -3936,8 +3963,18 @@ static int btf_dedup_is_equiv(struct btf_dedup *d, __u32 cand_id,* types within a single CU. So work around that by explicitly * allowing identical array types here. */ -return hypot_type_id == cand_id || -btf_dedup_identical_arrays (d, hypot_type_id, cand_id); +if (btf_dedup_identical_arrays (d, hypot_type_id, cand_id)) +return 1 ; +/* It turns out that similar situation can happen with +* struct/union sometimes, sigh... Handle the case where +* structs/unions are exactly the same, down to the referenced +* type IDs. Anything more complicated (e.g., if referenced +* types are different, but equivalent) is *way more* +* complicated and requires a many-to-many equivalence mapping. +*/ +if (btf_dedup_identical_structs (d, hypot_type_id, cand_id)) +return 1 ; +return 0 ; }if (btf_dedup_hypot_map_add (d, canon_id, cand_id))
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 59/217 ath11k: Fix mon status ring rx tlv processing
In reply to Sasha LevinFrom: Anilkumar Kolli <[email protected]>
[ Upstream commit 09f16f7390f302937409738d6cb6ce99b265f455 ]
In HE monitor capture, HAL_TLV_STATUS_PPDU_DONE is received on processing multiple skb. Do not clear the ppdu_info till the HAL_TLV_STATUS_PPDU_DONE is received.
This fixes below warning and packet drops in monitor mode.
"Rate marked as an HE rate but data is invalid: MCS: 6, NSS: 0"
WARNING: at
PC is at ieee80211_rx_napi+0x624/0x840 [mac80211]
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-01693-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath11k/dp_rx.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/wireless/ath/ath11k/dp_rx.c +7 -7
@@ -3064,10 +3064,10 @@ int ath11k_dp_rx_process_mon_status(struct ath11k_base *ab, int mac_id,if (!num_buffs_reaped) goto exit; -while ((skb =__skb_dequeue (&skb_list))) { -memset (&ppdu_info,0 ,sizeof (ppdu_info)); - ppdu_info.peer_id =HAL_INVALID_PEERID ; +memset (&ppdu_info,0 ,sizeof (ppdu_info)); + ppdu_info.peer_id =HAL_INVALID_PEERID ; +while ((skb =__skb_dequeue (&skb_list))) {if (ath11k_debugfs_is_pktlog_lite_mode_enabled (ar)) { log_type =ATH11K_PKTLOG_TYPE_LITE_RX ; rx_buf_sz =DP_RX_BUFFER_SIZE_LITE ;
@@ -3095,10 +3095,7 @@ int ath11k_dp_rx_process_mon_status(struct ath11k_base *ab, int mac_id,ath11k_dbg (ab,ATH11K_DBG_DATA ,"failed to find the peer with peer_id %d\n" , ppdu_info.peer_id); -spin_unlock_bh (&ab->base_lock); -rcu_read_unlock (); -dev_kfree_skb_any (skb); -continue ; + goto next_skb; } arsta = (struct ath11k_sta *)peer->sta->drv_priv;
@@ -3107,10 +3104,13 @@ int ath11k_dp_rx_process_mon_status(struct ath11k_base *ab, int mac_id,if (ath11k_debugfs_is_pktlog_peer_valid (ar, peer->addr))trace_ath11k_htt_rxdesc (ar, skb->data, log_type, rx_buf_sz); +next_skb:spin_unlock_bh (&ab->base_lock);rcu_read_unlock ();dev_kfree_skb_any (skb); +memset (&ppdu_info,0 ,sizeof (ppdu_info)); + ppdu_info.peer_id =HAL_INVALID_PEERID ; } exit:return num_buffs_reaped;
Signature · 7 lines
2.34.1 -- ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
Sasha Levin
maintainerPATCH 50/217 media: b2c2: Add missing check in flexcop_pci_isr:
In reply to Sasha LevinFrom: Zheyu Ma <[email protected]>
[ Upstream commit b13203032e679674c7c518f52a7ec0801ca3a829 ]
A out-of-bounds bug can be triggered by an interrupt, the reason for this bug is the lack of checking of register values.
In flexcop_pci_isr, the driver reads value from a register and uses it as a dma address. Finally, this address will be passed to the count parameter of find_next_packet. If this value is larger than the size of dma, the index of buffer will be out-of-bounds.
Fix this by adding a check after reading the value of the register.
The following KASAN report reveals it:
BUG: KASAN: slab-out-of-bounds in find_next_packet drivers/media/dvb-core/dvb_demux.c:528 [inline] BUG: KASAN: slab-out-of-bounds in _dvb_dmx_swfilter drivers/media/dvb-core/dvb_demux.c:572 [inline] BUG: KASAN: slab-out-of-bounds in dvb_dmx_swfilter+0x3fa/0x420 drivers/media/dvb-core/dvb_demux.c:603 Read of size 1 at addr ffff8880608c00a0 by task swapper/2/0 CPU: 2 PID: 0 Comm: swapper/2 Not tainted 4.19.177-gdba4159c14ef #25 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014 Call Trace: <IRQ> __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0xec/0x156 lib/dump_stack.c:118 print_address_description+0x78/0x290 mm/kasan/report.c:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report+0x25b/0x380 mm/kasan/report.c:412 __asan_report_load1_noabort+0x19/0x20 mm/kasan/report.c:430 find_next_packet drivers/media/dvb-core/dvb_demux.c:528 [inline] _dvb_dmx_swfilter drivers/media/dvb-core/dvb_demux.c:572 [inline] dvb_dmx_swfilter+0x3fa/0x420 drivers/media/dvb-core/dvb_demux.c:603 flexcop_pass_dmx_data+0x2e/0x40 drivers/media/common/b2c2/flexcop.c:167 flexcop_pci_isr+0x3d1/0x5d0 drivers/media/pci/b2c2/flexcop-pci.c:212 __handle_irq_event_percpu+0xfb/0x770 kernel/irq/handle.c:149 handle_irq_event_percpu+0x79/0x150 kernel/irq/handle.c:189 handle_irq_event+0xac/0x140 kernel/irq/handle.c:206 handle_fasteoi_irq+0x232/0x5c0 kernel/irq/chip.c:725 generic_handle_irq_desc include/linux/irqdesc.h:155 [inline] handle_irq+0x230/0x3a0 arch/x86/kernel/irq_64.c:87 do_IRQ+0xa7/0x1e0 arch/x86/kernel/irq.c:247 common_interrupt+0xf/0xf arch/x86/entry/entry_64.S:670 </IRQ> RIP: 0010:native_safe_halt+0x28/0x30 arch/x86/include/asm/irqflags.h:61 Code: 00 00 55 be 04 00 00 00 48 c7 c7 00 62 2f 8c 48 89 e5 e8 fb 31
e8 f8 8b 05 75 4f 8e 03 85 c0 7e 07 0f 00 2d 8a 61 66 00 fb f4 <5d> c3 90 90 90 90 90 90 0f 1f 44 00 00 55 48 89 e5 41 57 41 56 41
RSP: 0018:ffff88806b71fcc8 EFLAGS: 00000246 ORIG_RAX: ffffffffffffffde
RAX: 0000000000000000 RBX: ffffffff8bde44c8 RCX: ffffffff88a11285
RDX: 0000000000000000 RSI: 0000000000000004 RDI: ffffffff8c2f6200
RBP: ffff88806b71fcc8 R08: fffffbfff185ec40 R09: fffffbfff185ec40
R10: 0000000000000001 R11: fffffbfff185ec40 R12: 0000000000000002
R13: ffffffff8be9d6e0 R14: 0000000000000000 R15: 0000000000000000
arch_safe_halt arch/x86/include/asm/paravirt.h:94 [inline] default_idle+0x6f/0x360 arch/x86/kernel/process.c:557 arch_cpu_idle+0xf/0x20 arch/x86/kernel/process.c:548 default_idle_call+0x3b/0x60 kernel/sched/idle.c:93 cpuidle_idle_call kernel/sched/idle.c:153 [inline] do_idle+0x2ab/0x3c0 kernel/sched/idle.c:263 cpu_startup_entry+0xcb/0xe0 kernel/sched/idle.c:369 start_secondary+0x3b8/0x4e0 arch/x86/kernel/smpboot.c:271 secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:243 Allocated by task 1: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:553 kasan_slab_alloc+0x11/0x20 mm/kasan/kasan.c:490 slab_post_alloc_hook mm/slab.h:445 [inline] slab_alloc_node mm/slub.c:2741 [inline] slab_alloc mm/slub.c:2749 [inline] kmem_cache_alloc+0xeb/0x280 mm/slub.c:2754 kmem_cache_zalloc include/linux/slab.h:699 [inline] __kernfs_new_node+0xe2/0x6f0 fs/kernfs/dir.c:633 kernfs_new_node+0x9a/0x120 fs/kernfs/dir.c:693 __kernfs_create_file+0x5f/0x340 fs/kernfs/file.c:992 sysfs_add_file_mode_ns+0x22a/0x4e0 fs/sysfs/file.c:306 create_files fs/sysfs/group.c:63 [inline] internal_create_group+0x34e/0xc30 fs/sysfs/group.c:147 sysfs_create_group fs/sysfs/group.c:173 [inline] sysfs_create_groups+0x9c/0x140 fs/sysfs/group.c:200 driver_add_groups+0x3e/0x50 drivers/base/driver.c:129 bus_add_driver+0x3a5/0x790 drivers/base/bus.c:684 driver_register+0x1cd/0x410 drivers/base/driver.c:170 __pci_register_driver+0x197/0x200 drivers/pci/pci-driver.c:1411 cx88_audio_pci_driver_init+0x23/0x25 drivers/media/pci/cx88/cx88-alsa.c: 1017 do_one_initcall+0xe0/0x610 init/main.c:884 do_initcall_level init/main.c:952 [inline] do_initcalls init/main.c:960 [inline] do_basic_setup init/main.c:978 [inline] kernel_init_freeable+0x4d0/0x592 init/main.c:1145 kernel_init+0x18/0x190 init/main.c:1062 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415 Freed by task 0:
(stack is not available)
The buggy address belongs to the object at ffff8880608c0000
which belongs to the cache kernfs_node_cache of size 160
The buggy address is located 0 bytes to the right of
160-byte region [ffff8880608c0000, ffff8880608c00a0)
The buggy address belongs to the page:
page:ffffea0001823000 count:1 mapcount:0 mapping:ffff88806bed1e00
index:0x0 compound_mapcount: 0
flags: 0x100000000008100(slab|head)
raw: 0100000000008100 dead000000000100 dead000000000200 ffff88806bed1e00
raw: 0000000000000000 0000000000240024 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff8880608bff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8880608c0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880608c0080: 00 00 00 00 fc fc fc fc fc fc fc fc 00 00 00 00
^
ffff8880608c0100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8880608c0180: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00
==================================================================--- drivers/media/pci/b2c2/flexcop-pci.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/pci/b2c2/flexcop-pci.c +3 -0
@@ -185,6 +185,8 @@ static irqreturn_t flexcop_pci_isr(int irq, void *dev_id)dma_addr_t cur_addr = fc->read_ibi_reg (fc,dma1_008).dma_0x8.dma_cur_addr <<2 ;u32 cur_pos = cur_addr - fc_pci->dma[0 ].dma_addr0; +if (cur_pos > fc_pci->dma[0 ].size *2 ) + goto error; deb_irq("%u irq: %08x cur_addr: %llx: cur_pos: %08x, last_cur_pos: %08x ", jiffies_to_usecs(jiffies - fc_pci->last_irq),
@@ -225,6 +227,7 @@ static irqreturn_t flexcop_pci_isr(int irq, void *dev_id) ret =IRQ_NONE ; } +error:spin_unlock_irqrestore (&fc_pci->irq_lock, flags);return ret; }
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 30/217 USB: ehci_brcm_hub_control: Improve port index sanitizing
In reply to Sasha LevinFrom: Haimin Zhang <[email protected]>
[ Upstream commit 9933698f6119886c110750e67c10ac66f12b730f ]
Due to (wIndex & 0xff) - 1 can get an integer greater than 15, this can cause array index to be out of bounds since the size of array port_status is 15. This change prevents a possible out-of-bounds pointer computation by forcing the use of a valid port number.
--- drivers/usb/host/ehci-brcm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/host/ehci-brcm.c +5 -1
@@ -62,8 +62,12 @@ static int ehci_brcm_hub_control(u32 __iomem *status_reg;unsigned long flags;int retval, irq_disabled =0 ; +u32 temp; - status_reg = &ehci->regs->port_status[(wIndex &0xff ) -1 ]; + temp = (wIndex &0xff ) -1 ; +if (temp >=HCS_N_PORTS_MAX )/* Avoid index-out-of-bounds warning */ + temp =0 ; + status_reg = &ehci->regs->port_status[temp];/* * RESUME is cleared when GetPortStatus() is called 20ms after start
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 52/217 ethernet: renesas: Use div64_ul instead of do_div
In reply to Sasha LevinFrom: Yang Li <[email protected]>
[ Upstream commit d9f31aeaa1e5aefa68130878af3c3513d41c1e2d ]
do_div() does a 64-by-32 division. Here the divisor is an unsigned long which on some platforms is 64 bit wide. So use div64_ul instead of do_div to avoid a possible truncation.
Eliminate the following coccicheck warning:
./drivers/net/ethernet/renesas/ravb_main.c:2492:1-7: WARNING:do_div() does a 64-by-32 division, please consider using div64_ul instead.
--- drivers/net/ethernet/renesas/ravb_main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/renesas/ravb_main.c +2 -4
@@ -30,8 +30,7 @@#include <linux/spinlock.h> #include <linux/sys_soc.h> #include <linux/reset.h> - -#include <asm/div64.h> +#include <linux/math64.h> #include "ravb.h"
@@ -2488,8 +2487,7 @@ static int ravb_set_gti(struct net_device *ndev)if (!rate)return -EINVAL ; - inc =1000000000ULL <<20 ; -do_div (inc, rate); + inc =div64_ul (1000000000ULL <<20 , rate);if (inc <GTI_TIV_MIN || inc >GTI_TIV_MAX ) { dev_err(dev, "gti.tiv increment 0x%llx is outside the range 0x%x - 0x%x\n",
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 56/217 arm64: dts: qcom: sm8350: Shorten camera-thermal-bottom name
In reply to Sasha LevinFrom: Konrad Dybcio <[email protected]>
[ Upstream commit f52dd33943ca5f84ae76890f352f6d9e12512c3f ]
Thermal zone names should not be longer than 20 names, which is indicated by a message at boot. Change "camera-thermal-bottom" to "cam-thermal-bottom" to fix it.
--- arch/arm64/boot/dts/qcom/sm8350.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm8350.dtsi +1 -1
@@ -2447,7 +2447,7 @@ camera1_alert0: trip-point0 { }; }; - camera-thermal-bottom { + cam-thermal-bottom { polling-delay-passive = <250>; polling-delay = <1000>;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 54/217 EDAC/synopsys: Use the quirk for version instead of ddr version
In reply to Sasha LevinFrom: Dinh Nguyen <[email protected]>
[ Upstream commit bd1d6da17c296bd005bfa656952710d256e77dd3 ]
Version 2.40a supports DDR_ECC_INTR_SUPPORT for a quirk, so use that quirk to determine a call to setup_address_map().
--- drivers/edac/synopsys_edac.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/edac/synopsys_edac.c +1 -2
@@ -1352,8 +1352,7 @@ static int mc_probe(struct platform_device *pdev) } } -if (of_device_is_compatible (pdev->dev.of_node, -"xlnx,zynqmp-ddrc-2.40a" )) +if (priv->p_data->quirks &DDR_ECC_INTR_SUPPORT )setup_address_map (priv);#endif
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 55/217 arm64: dts: qcom: sm[68]350: Use interrupts-extended with pdc interrupts
In reply to Sasha LevinFrom: Konrad Dybcio <[email protected]>
[ Upstream commit 9e7f7b65c7f04c5cfda97d6bd0d452a49e60f24e ]
Using interrupts = <&pdc X Y> makes the interrupt framework interpret this as the &pdc-nth range of the main interrupt controller (GIC). Fix it.
--- arch/arm64/boot/dts/qcom/sm6350.dtsi | 4 ++-- arch/arm64/boot/dts/qcom/sm8350.dtsi | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/qcom/sm6350.dtsi +2 -2
@@ -631,7 +631,7 @@ tsens0: thermal-sensor@c263000 { reg = <0 0x0c263000 0 0x1ff>, /* TM */ <0 0x0c222000 0 0x8>; /* SROT */ #qcom,sensors = <16>; - interrupts = <&pdc 26 IRQ_TYPE_LEVEL_HIGH>, + interrupts-extended = <&pdc 26 IRQ_TYPE_LEVEL_HIGH>, <&pdc 28 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "uplow", "critical"; #thermal-sensor-cells = <1>;
@@ -642,7 +642,7 @@ tsens1: thermal-sensor@c265000 { reg = <0 0x0c265000 0 0x1ff>, /* TM */ <0 0x0c223000 0 0x8>; /* SROT */ #qcom,sensors = <16>; - interrupts = <&pdc 27 IRQ_TYPE_LEVEL_HIGH>, + interrupts-extended = <&pdc 27 IRQ_TYPE_LEVEL_HIGH>, <&pdc 29 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "uplow", "critical"; #thermal-sensor-cells = <1>;
arch/arm64/boot/dts/qcom/sm8350.dtsi +2 -2
@@ -910,7 +910,7 @@ tsens0: thermal-sensor@c263000 { reg = <0 0x0c263000 0 0x1ff>, /* TM */ <0 0x0c222000 0 0x8>; /* SROT */ #qcom,sensors = <15>; - interrupts = <&pdc 26 IRQ_TYPE_LEVEL_HIGH>, + interrupts-extended = <&pdc 26 IRQ_TYPE_LEVEL_HIGH>, <&pdc 28 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "uplow", "critical"; #thermal-sensor-cells = <1>;
@@ -921,7 +921,7 @@ tsens1: thermal-sensor@c265000 { reg = <0 0x0c265000 0 0x1ff>, /* TM */ <0 0x0c223000 0 0x8>; /* SROT */ #qcom,sensors = <14>; - interrupts = <&pdc 27 IRQ_TYPE_LEVEL_HIGH>, + interrupts-extended = <&pdc 27 IRQ_TYPE_LEVEL_HIGH>, <&pdc 29 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "uplow", "critical"; #thermal-sensor-cells = <1>;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 53/217 82596: use eth_hw_addr_set()
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 0f98d7e478430b64d9520a23585e02be5f8b1b2a ]
Byte by byte assignments.
Fixes build on m68k.
--- drivers/net/ethernet/i825xx/82596.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/i825xx/82596.c +2 -1
@@ -1178,7 +1178,8 @@ static struct net_device * __init i82596_probe(void)DEB (DEB_PROBE ,printk (KERN_INFO "%s: 82596 at %#3lx," , dev->name, dev->base_addr));for (i =0 ; i <6 ; i++) -DEB (DEB_PROBE ,printk (" %2.2X" , dev->dev_addr[i] = eth_addr[i])); +DEB (DEB_PROBE ,printk (" %2.2X" , eth_addr[i])); +eth_hw_addr_set (dev, eth_addr);DEB (DEB_PROBE ,printk (" IRQ %d.\n" , dev->irq));
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 82/217 drm/vmwgfx: Release ttm memory if probe fails
In reply to Sasha LevinFrom: Zack Rusin <[email protected]>
[ Upstream commit 28b5f3b6121b7db2a44be499cfca0b6b801588b6 ]
The ttm mem global state was leaking if the vmwgfx driver load failed.
In case of a driver load failure we have to make sure we also release the ttm mem global state.
--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +16 -10
@@ -1617,34 +1617,40 @@ static int vmw_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ret =drm_aperture_remove_conflicting_pci_framebuffers (pdev, &driver);if (ret) -return ret; + goto out_error; ret =pcim_enable_device (pdev);if (ret) -return ret; + goto out_error; vmw =devm_drm_dev_alloc (&pdev->dev, &driver, struct vmw_private, drm); -if (IS_ERR (vmw)) -return PTR_ERR (vmw); +if (IS_ERR (vmw)) { + ret =PTR_ERR (vmw); + goto out_error; + }pci_set_drvdata (pdev, &vmw->drm); ret =ttm_mem_global_init (&ttm_mem_glob, &pdev->dev);if (ret) -return ret; + goto out_error; ret =vmw_driver_load (vmw, ent->device);if (ret) -return ret; + goto out_release; ret =drm_dev_register (&vmw->drm,0 ); -if (ret) { -vmw_driver_unload (&vmw->drm); -return ret; - } +if (ret) + goto out_unload;return 0 ; +out_unload: +vmw_driver_unload (&vmw->drm); +out_release: +ttm_mem_global_release (&ttm_mem_glob); +out_error: +return ret; }static int __init vmwgfx_init (void )
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 57/217 soc: imx: gpcv2: Synchronously suspend MIX domains
In reply to Sasha LevinFrom: Marek Vasut <[email protected]>
[ Upstream commit f756f435f7dd823f2d4bd593ce1bf3168def1308 ]
In case the following power domain sequence happens, iMX8M Mini always hangs:
gpumix:on -> gpu:on -> gpu:off -> gpu:on
This is likely due to another quirk of the GPC block. This situation can be prevented by always synchronously powering off both the domain and MIX domain. Make it so. This turns the aforementioned sequence into:
gpumix:on -> gpu:on -> gpu:off -> gpumix:off -> gpumix:on -> gpu:on
--- drivers/soc/imx/gpcv2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/imx/gpcv2.c +1 -1
@@ -377,7 +377,7 @@ static int imx_pgc_power_down(struct generic_pm_domain *genpd) } } -pm_runtime_put (domain->dev); +pm_runtime_put_sync_suspend (domain->dev);return 0 ;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 83/217 drm/vmwgfx: Introduce a new placement for MOB page tables
In reply to Sasha LevinFrom: Zack Rusin <[email protected]>
[ Upstream commit f6be23264bbac88d1e2bb39658e1b8a397e3f46d ]
For larger (bigger than a page) and noncontiguous mobs we have to create page tables that allow the host to find the memory. Those page tables just used regular system memory. Unfortunately in TTM those BO's are not allowed to be busy thus can't be fenced and we have to fence those bo's because we don't want to destroy the page tables while the host is still executing the command buffers which might be accessing them.
To solve it we introduce a new placement VMW_PL_SYSTEM which is very similar to TTM_PL_SYSTEM except that it allows fencing. This fixes kernel oops'es during unloading of the driver (and pci hot remove/add) which were caused by busy BO's in TTM_PL_SYSTEM being present in the delayed deletion list in TTM (TTM_PL_SYSTEM manager is destroyed before the delayed deletions are executed)
--- drivers/gpu/drm/vmwgfx/Makefile | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 14 ++- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 12 ++- .../gpu/drm/vmwgfx/vmwgfx_system_manager.c | 90 +++++++++++++++++++ drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 58 ++++++------ 5 files changed, 138 insertions(+), 38 deletions(-) create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_system_manager.c
drivers/gpu/drm/vmwgfx/Makefile +1 -1
@@ -9,7 +9,7 @@ vmwgfx-y := vmwgfx_execbuf.o vmwgfx_gmr.o vmwgfx_kms.o vmwgfx_drv.o \ vmwgfx_cotable.o vmwgfx_so.o vmwgfx_binding.o vmwgfx_msg.o \ vmwgfx_simple_resource.o vmwgfx_va.o vmwgfx_blit.o \ vmwgfx_validation.o vmwgfx_page_dirty.o vmwgfx_streamoutput.o \ - vmwgfx_devcaps.o ttm_object.o ttm_memory.o + vmwgfx_devcaps.o ttm_object.o ttm_memory.o vmwgfx_system_manager.o vmwgfx-$(CONFIG_DRM_FBDEV_EMULATION) += vmwgfx_fb.o vmwgfx-$(CONFIG_TRANSPARENT_HUGEPAGE) += vmwgfx_thp.o
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +12 -2
@@ -1071,6 +1071,12 @@ static int vmw_driver_load(struct vmw_private *dev_priv, u32 pci_id) "3D will be disabled.\n"); dev_priv->has_mob = false; } +if (vmw_sys_man_init (dev_priv) !=0 ) { +drm_info (&dev_priv->drm, +"No MOB page table memory available. " +"3D will be disabled.\n" ); + dev_priv->has_mob = false; + } }if (dev_priv->has_mob && (dev_priv->capabilities &SVGA_CAP_DX )) {
@@ -1121,8 +1127,10 @@ static int vmw_driver_load(struct vmw_private *dev_priv, u32 pci_id)vmw_overlay_close (dev_priv);vmw_kms_close (dev_priv); out_no_kms: -if (dev_priv->has_mob) +if (dev_priv->has_mob) {vmw_gmrid_man_fini (dev_priv,VMW_PL_MOB ); +vmw_sys_man_fini (dev_priv); + }if (dev_priv->has_gmr)vmw_gmrid_man_fini (dev_priv,VMW_PL_GMR );vmw_devcaps_destroy (dev_priv);
@@ -1172,8 +1180,10 @@ static void vmw_driver_unload(struct drm_device *dev)vmw_gmrid_man_fini (dev_priv,VMW_PL_GMR );vmw_release_device_early (dev_priv); -if (dev_priv->has_mob) +if (dev_priv->has_mob) {vmw_gmrid_man_fini (dev_priv,VMW_PL_MOB ); +vmw_sys_man_fini (dev_priv); + }vmw_devcaps_destroy (dev_priv);vmw_vram_manager_fini (dev_priv);ttm_device_fini (&dev_priv->bdev);
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +9 -3
@@ -82,8 +82,9 @@ VMWGFX_NUM_GB_SURFACE +\ VMWGFX_NUM_GB_SCREEN_TARGET) -#define VMW_PL_GMR (TTM_PL_PRIV + 0) -#define VMW_PL_MOB (TTM_PL_PRIV + 1) +#define VMW_PL_GMR (TTM_PL_PRIV + 0) +#define VMW_PL_MOB (TTM_PL_PRIV + 1) +#define VMW_PL_SYSTEM (TTM_PL_PRIV + 2)#define VMW_RES_CONTEXT ttm_driver_type0#define VMW_RES_SURFACE ttm_driver_type1
@@ -1039,7 +1040,6 @@ extern struct ttm_placement vmw_vram_placement;extern struct ttm_placement vmw_vram_sys_placement;extern struct ttm_placement vmw_vram_gmr_placement;extern struct ttm_placement vmw_sys_placement; -extern struct ttm_placement vmw_evictable_placement;extern struct ttm_placement vmw_srf_placement;extern struct ttm_placement vmw_mob_placement;extern struct ttm_placement vmw_nonfixed_placement;
@@ -1251,6 +1251,12 @@ int vmw_overlay_num_free_overlays(struct vmw_private *dev_priv);int vmw_gmrid_man_init (struct vmw_private *dev_priv,int type);void vmw_gmrid_man_fini (struct vmw_private *dev_priv,int type); +/** +* System memory manager +*/ +int vmw_sys_man_init (struct vmw_private *dev_priv); +void vmw_sys_man_fini (struct vmw_private *dev_priv); +/** * Prime - vmwgfx_prime.c */
drivers/gpu/drm/vmwgfx/vmwgfx_system_manager.c new file +90 -0
90 lines not on this page · raw message
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +26 -32
118 lines not on this page · raw message
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 58/217 ARM: imx: rename DEBUG_IMX21_IMX27_UART to DEBUG_IMX27_UART
In reply to Sasha LevinFrom: Lukas Bulwahn <[email protected]>
[ Upstream commit b0100bce4ff82ec1ccd3c1f3d339fd2df6a81784 ]
Since commit 4b563a066611 ("ARM: imx: Remove imx21 support"), the config DEBUG_IMX21_IMX27_UART is really only debug support for IMX27.
So, rename this option to DEBUG_IMX27_UART and adjust dependencies in Kconfig and rename the definitions to IMX27 as further clean-up.
This issue was discovered with ./scripts/checkkconfigsymbols.py, which reported that DEBUG_IMX21_IMX27_UART depends on the non-existing config SOC_IMX21.
--- arch/arm/Kconfig.debug | 14 +++++++------- arch/arm/include/debug/imx-uart.h | 18 +++++++++--------- 2 files changed, 16 insertions(+), 16 deletions(-)
arch/arm/Kconfig.debug +7 -7
@@ -410,12 +410,12 @@ choice Say Y here if you want kernel low-level debugging support on i.MX25. - config DEBUG_IMX21_IMX27_UART - bool "i.MX21 and i.MX27 Debug UART" - depends on SOC_IMX21 || SOC_IMX27 + config DEBUG_IMX27_UART + bool "i.MX27 Debug UART" + depends on SOC_IMX27 help Say Y here if you want kernel low-level debugging support - on i.MX21 or i.MX27. + on i.MX27. config DEBUG_IMX28_UART bool "i.MX28 Debug UART"
@@ -1481,7 +1481,7 @@ config DEBUG_IMX_UART_PORT int "i.MX Debug UART Port Selection" depends on DEBUG_IMX1_UART || \ DEBUG_IMX25_UART || \ - DEBUG_IMX21_IMX27_UART || \ + DEBUG_IMX27_UART || \ DEBUG_IMX31_UART || \ DEBUG_IMX35_UART || \ DEBUG_IMX50_UART || \
@@ -1540,12 +1540,12 @@ config DEBUG_LL_INCLUDE default "debug/icedcc.S" if DEBUG_ICEDCC default "debug/imx.S" if DEBUG_IMX1_UART || \ DEBUG_IMX25_UART || \ - DEBUG_IMX21_IMX27_UART || \ + DEBUG_IMX27_UART || \ DEBUG_IMX31_UART || \ DEBUG_IMX35_UART || \ DEBUG_IMX50_UART || \ DEBUG_IMX51_UART || \ - DEBUG_IMX53_UART ||\ + DEBUG_IMX53_UART || \ DEBUG_IMX6Q_UART || \ DEBUG_IMX6SL_UART || \ DEBUG_IMX6SX_UART || \
arch/arm/include/debug/imx-uart.h +9 -9
@@ -11,13 +11,6 @@#define IMX1_UART_BASE_ADDR (n) IMX1_UART##n##_BASE_ADDR#define IMX1_UART_BASE (n) IMX1_UART_BASE_ADDR(n) -#define IMX21_UART1_BASE_ADDR 0x1000a000 -#define IMX21_UART2_BASE_ADDR 0x1000b000 -#define IMX21_UART3_BASE_ADDR 0x1000c000 -#define IMX21_UART4_BASE_ADDR 0x1000d000 -#define IMX21_UART_BASE_ADDR (n) IMX21_UART##n##_BASE_ADDR -#define IMX21_UART_BASE (n) IMX21_UART_BASE_ADDR(n) -#define IMX25_UART1_BASE_ADDR 0x43f90000#define IMX25_UART2_BASE_ADDR 0x43f94000#define IMX25_UART3_BASE_ADDR 0x5000c000
@@ -26,6 +19,13 @@#define IMX25_UART_BASE_ADDR (n) IMX25_UART##n##_BASE_ADDR#define IMX25_UART_BASE (n) IMX25_UART_BASE_ADDR(n) +#define IMX27_UART1_BASE_ADDR 0x1000a000 +#define IMX27_UART2_BASE_ADDR 0x1000b000 +#define IMX27_UART3_BASE_ADDR 0x1000c000 +#define IMX27_UART4_BASE_ADDR 0x1000d000 +#define IMX27_UART_BASE_ADDR (n) IMX27_UART##n##_BASE_ADDR +#define IMX27_UART_BASE (n) IMX27_UART_BASE_ADDR(n) +#define IMX31_UART1_BASE_ADDR 0x43f90000#define IMX31_UART2_BASE_ADDR 0x43f94000#define IMX31_UART3_BASE_ADDR 0x5000c000
@@ -112,10 +112,10 @@#ifdef CONFIG_DEBUG_IMX1_UART #define UART_PADDR IMX_DEBUG_UART_BASE(IMX1) -#elif defined(CONFIG_DEBUG_IMX21_IMX27_UART ) -#define UART_PADDR IMX_DEBUG_UART_BASE(IMX21)#elif defined(CONFIG_DEBUG_IMX25_UART )#define UART_PADDR IMX_DEBUG_UART_BASE(IMX25) +#elif defined(CONFIG_DEBUG_IMX27_UART ) +#define UART_PADDR IMX_DEBUG_UART_BASE(IMX27)#elif defined(CONFIG_DEBUG_IMX31_UART )#define UART_PADDR IMX_DEBUG_UART_BASE(IMX31)#elif defined(CONFIG_DEBUG_IMX35_UART )
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 88/217 drm: Return error codes from struct drm_driver.gem_create_object
In reply to Sasha LevinFrom: Thomas Zimmermann <[email protected]>
[ Upstream commit 4ff22f487f8c26b99cbe1678344595734c001a39 ]
GEM helper libraries use struct drm_driver.gem_create_object to let drivers override GEM object allocation. On failure, the call returns NULL.
Change the semantics to make the calls return a pointer-encoded error. This aligns the callback with its callers. Fixes the ingenic driver, which already returns an error pointer.
Also update the callers to handle the involved types more strictly.
--- drivers/gpu/drm/drm_gem_cma_helper.c | 17 ++++++++++------- drivers/gpu/drm/drm_gem_shmem_helper.c | 17 ++++++++++------- drivers/gpu/drm/drm_gem_vram_helper.c | 4 ++-- drivers/gpu/drm/lima/lima_gem.c | 2 +- drivers/gpu/drm/panfrost/panfrost_gem.c | 2 +- drivers/gpu/drm/v3d/v3d_bo.c | 4 ++-- drivers/gpu/drm/vgem/vgem_drv.c | 2 +- drivers/gpu/drm/virtio/virtgpu_object.c | 2 +- include/drm/drm_drv.h | 5 +++-- 9 files changed, 31 insertions(+), 24 deletions(-)
drivers/gpu/drm/drm_gem_cma_helper.c +10 -7
@@ -62,18 +62,21 @@ __drm_gem_cma_create(struct drm_device *drm, size_t size, bool private)struct drm_gem_object *gem_obj;int ret =0 ; -if (drm->driver->gem_create_object) +if (drm->driver->gem_create_object) { gem_obj = drm->driver->gem_create_object (drm, size); -else - gem_obj =kzalloc (sizeof (*cma_obj),GFP_KERNEL ); -if (!gem_obj) -return ERR_PTR (-ENOMEM ); +if (IS_ERR (gem_obj)) +return ERR_CAST (gem_obj); + cma_obj =to_drm_gem_cma_obj (gem_obj); + }else { + cma_obj =kzalloc (sizeof (*cma_obj),GFP_KERNEL ); +if (!cma_obj) +return ERR_PTR (-ENOMEM ); + gem_obj = &cma_obj->base; + }if (!gem_obj->funcs) gem_obj->funcs = &drm_gem_cma_default_funcs; - cma_obj = container_of(gem_obj, struct drm_gem_cma_object, base); -if (private) {drm_gem_private_object_init (drm, gem_obj, size);
drivers/gpu/drm/drm_gem_shmem_helper.c +10 -7
@@ -51,14 +51,17 @@ __drm_gem_shmem_create(struct drm_device *dev, size_t size, bool private) size =PAGE_ALIGN (size); -if (dev->driver->gem_create_object) +if (dev->driver->gem_create_object) { obj = dev->driver->gem_create_object (dev, size); -else - obj =kzalloc (sizeof (*shmem),GFP_KERNEL ); -if (!obj) -return ERR_PTR (-ENOMEM ); - - shmem =to_drm_gem_shmem_obj (obj); +if (IS_ERR (obj)) +return ERR_CAST (obj); + shmem =to_drm_gem_shmem_obj (obj); + }else { + shmem =kzalloc (sizeof (*shmem),GFP_KERNEL ); +if (!shmem) +return ERR_PTR (-ENOMEM ); + obj = &shmem->base; + }if (!obj->funcs) obj->funcs = &drm_gem_shmem_funcs;
drivers/gpu/drm/drm_gem_vram_helper.c +2 -2
@@ -197,8 +197,8 @@ struct drm_gem_vram_object *drm_gem_vram_create(struct drm_device *dev,if (dev->driver->gem_create_object) { gem = dev->driver->gem_create_object (dev, size); -if (!gem) -return ERR_PTR (-ENOMEM ); +if (IS_ERR (gem)) +return ERR_CAST (gem); gbo =drm_gem_vram_of_gem (gem); }else { gbo =kzalloc (sizeof (*gbo),GFP_KERNEL );
drivers/gpu/drm/lima/lima_gem.c +1 -1
@@ -221,7 +221,7 @@ struct drm_gem_object *lima_gem_create_object(struct drm_device *dev, size_t siz bo =kzalloc (sizeof (*bo),GFP_KERNEL );if (!bo) -return NULL ; +return ERR_PTR (-ENOMEM );mutex_init (&bo->lock);INIT_LIST_HEAD (&bo->va);
drivers/gpu/drm/panfrost/panfrost_gem.c +1 -1
@@ -221,7 +221,7 @@ struct drm_gem_object *panfrost_gem_create_object(struct drm_device *dev, size_t obj =kzalloc (sizeof (*obj),GFP_KERNEL );if (!obj) -return NULL ; +return ERR_PTR (-ENOMEM );INIT_LIST_HEAD (&obj->mappings.list);mutex_init (&obj->mappings.lock);
drivers/gpu/drm/v3d/v3d_bo.c +2 -2
@@ -70,11 +70,11 @@ struct drm_gem_object *v3d_create_object(struct drm_device *dev, size_t size)struct drm_gem_object *obj;if (size ==0 ) -return NULL ; +return ERR_PTR (-EINVAL ); bo =kzalloc (sizeof (*bo),GFP_KERNEL );if (!bo) -return NULL ; +return ERR_PTR (-ENOMEM ); obj = &bo->base.base; obj->funcs = &v3d_gem_funcs;
drivers/gpu/drm/vgem/vgem_drv.c +1 -1
@@ -97,7 +97,7 @@ static struct drm_gem_object *vgem_gem_create_object(struct drm_device *dev, siz obj =kzalloc (sizeof (*obj),GFP_KERNEL );if (!obj) -return NULL ; +return ERR_PTR (-ENOMEM );/* * vgem doesn't have any begin/end cpu access ioctls, therefore must use
drivers/gpu/drm/virtio/virtgpu_object.c +1 -1
@@ -140,7 +140,7 @@ struct drm_gem_object *virtio_gpu_create_object(struct drm_device *dev, shmem =kzalloc (sizeof (*shmem),GFP_KERNEL );if (!shmem) -return NULL ; +return ERR_PTR (-ENOMEM ); dshmem = &shmem->base.base; dshmem->base.funcs = &virtio_gpu_shmem_funcs;
include/drm/drm_drv.h +3 -2
@@ -291,8 +291,9 @@ struct drm_driver {/** * @gem_create_object: constructor for gem objects * -* Hook for allocating the GEM object struct, for use by the CMA and -* SHMEM GEM helpers. +* Hook for allocating the GEM object struct, for use by the CMA +* and SHMEM GEM helpers. Returns a GEM object on success, or an +* ERR_PTR()-encoded error code otherwise. */ struct drm_gem_object *(*gem_create_object)(struct drm_device *dev,size_t size);
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 89/217 drm/amd/display: Use oriented source size when checking cursor scaling
In reply to Sasha LevinFrom: Vlad Zahorodnii <[email protected]>
[ Upstream commit 69cb56290d9d10cdcc461aa2685e67e540507a96 ]
dm_check_crtc_cursor() doesn't take into account plane transforms when calculating plane scaling, this can result in false positives.
For example, if there's an output with resolution 3840x2160 and the output is rotated 90 degrees, CRTC_W and CRTC_H will be 3840 and 2160, respectively, but SRC_W and SRC_H will be 2160 and 3840, respectively.
Since the cursor plane usually has a square buffer attached to it, the dm_check_crtc_cursor() will think that there's a scale factor mismatch even though there isn't really.
This fixes an issue where kwin fails to use hardware plane transforms.
Changes since version 1:
- s/orientated/oriented/g
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 35 ++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +27 -8
@@ -10661,6 +10661,24 @@ static int dm_update_plane_state(struct dc *dc,return ret; } +static void dm_get_oriented_plane_size (struct drm_plane_state *plane_state, +int *src_w,int *src_h) +{ +switch (plane_state->rotation &DRM_MODE_ROTATE_MASK ) { +case DRM_MODE_ROTATE_90 : +case DRM_MODE_ROTATE_270 : + *src_w = plane_state->src_h >>16 ; + *src_h = plane_state->src_w >>16 ; +break ; +case DRM_MODE_ROTATE_0 : +case DRM_MODE_ROTATE_180 : +default : + *src_w = plane_state->src_w >>16 ; + *src_h = plane_state->src_h >>16 ; +break ; + } +} +static int dm_check_crtc_cursor (struct drm_atomic_state *state,struct drm_crtc *crtc,struct drm_crtc_state *new_crtc_state)
@@ -10669,6 +10687,8 @@ static int dm_check_crtc_cursor(struct drm_atomic_state *state,struct drm_plane_state *new_cursor_state, *new_underlying_state;int i;int cursor_scale_w, cursor_scale_h, underlying_scale_w, underlying_scale_h; +int cursor_src_w, cursor_src_h; +int underlying_src_w, underlying_src_h;/* On DCE and DCN there is no dedicated hardware cursor plane. We get a * cursor per pipe but it's going to inherit the scaling and
@@ -10680,10 +10700,9 @@ static int dm_check_crtc_cursor(struct drm_atomic_state *state,return 0 ; } - cursor_scale_w = new_cursor_state->crtc_w *1000 / - (new_cursor_state->src_w >>16 ); - cursor_scale_h = new_cursor_state->crtc_h *1000 / - (new_cursor_state->src_h >>16 ); +dm_get_oriented_plane_size (new_cursor_state, &cursor_src_w, &cursor_src_h); + cursor_scale_w = new_cursor_state->crtc_w *1000 / cursor_src_w; + cursor_scale_h = new_cursor_state->crtc_h *1000 / cursor_src_h;for_each_new_plane_in_state_reverse (state, underlying, new_underlying_state, i) {/* Narrow down to non-cursor planes on the same CRTC as the cursor */
@@ -10694,10 +10713,10 @@ static int dm_check_crtc_cursor(struct drm_atomic_state *state,if (!new_underlying_state->fb)continue ; - underlying_scale_w = new_underlying_state->crtc_w *1000 / - (new_underlying_state->src_w >>16 ); - underlying_scale_h = new_underlying_state->crtc_h *1000 / - (new_underlying_state->src_h >>16 ); +dm_get_oriented_plane_size (new_underlying_state, + &underlying_src_w, &underlying_src_h); + underlying_scale_w = new_underlying_state->crtc_w *1000 / underlying_src_w; + underlying_scale_h = new_underlying_state->crtc_h *1000 / underlying_src_h;if (cursor_scale_w != underlying_scale_w || cursor_scale_h != underlying_scale_h) {
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 96/217 drm: rcar-du: Fix CRTC timings when CMM is used
In reply to Sasha LevinFrom: Laurent Pinchart <[email protected]>
[ Upstream commit f0ce591dc9a97067c6e783a2eaccd22c5476144d ]
When the CMM is enabled, an offset of 25 pixels must be subtracted from the HDS (horizontal display start) and HDE (horizontal display end) registers. Fix the timings calculation, and take this into account in the mode validation.
This fixes a visible horizontal offset in the image with VGA monitors. HDMI monitors seem to be generally more tolerant to incorrect timings, but may be affected too.
--- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
drivers/gpu/drm/rcar-du/rcar_du_crtc.c +16 -4
@@ -215,6 +215,7 @@ static void rcar_du_crtc_set_display_timing(struct rcar_du_crtc *rcrtc)const struct drm_display_mode *mode = &rcrtc->crtc.state->adjusted_mode;struct rcar_du_device *rcdu = rcrtc->dev;unsigned long mode_clock = mode->clock *1000 ; +unsigned int hdse_offset;u32 dsmr;u32 escr;
@@ -298,10 +299,15 @@ static void rcar_du_crtc_set_display_timing(struct rcar_du_crtc *rcrtc) | DSMR_DIPM_DISP | DSMR_CSPM;rcar_du_crtc_write (rcrtc,DSMR , dsmr); + hdse_offset =19 ; +if (rcrtc->group->cmms_mask &BIT (rcrtc->index %2 )) + hdse_offset +=25 ; +/* Display timings */ -rcar_du_crtc_write (rcrtc,HDSR , mode->htotal - mode->hsync_start -19 ); +rcar_du_crtc_write (rcrtc,HDSR , mode->htotal - mode->hsync_start - + hdse_offset);rcar_du_crtc_write (rcrtc,HDER , mode->htotal - mode->hsync_start + - mode->hdisplay -19 ); + mode->hdisplay - hdse_offset);rcar_du_crtc_write (rcrtc,HSWR , mode->hsync_end - mode->hsync_start -1 );rcar_du_crtc_write (rcrtc,HCR , mode->htotal -1 );
@@ -836,6 +842,7 @@ rcar_du_crtc_mode_valid(struct drm_crtc *crtc,struct rcar_du_crtc *rcrtc =to_rcar_crtc (crtc);struct rcar_du_device *rcdu = rcrtc->dev;bool interlaced = mode->flags &DRM_MODE_FLAG_INTERLACE ; +unsigned int min_sync_porch;unsigned int vbp;if (interlaced && !rcar_du_has (rcdu,RCAR_DU_FEATURE_INTERLACED ))
@@ -843,9 +850,14 @@ rcar_du_crtc_mode_valid(struct drm_crtc *crtc,/* * The hardware requires a minimum combined horizontal sync and back -* porch of 20 pixels and a minimum vertical back porch of 3 lines. +* porch of 20 pixels (when CMM isn't used) or 45 pixels (when CMM is +* used), and a minimum vertical back porch of 3 lines. */ -if (mode->htotal - mode->hsync_start <20 ) + min_sync_porch =20 ; +if (rcrtc->group->cmms_mask &BIT (rcrtc->index %2 )) + min_sync_porch +=25 ; + +if (mode->htotal - mode->hsync_start < min_sync_porch)return MODE_HBLANK_NARROW ; vbp = (mode->vtotal - mode->vsync_end) / (interlaced ?2 :1 );
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 100/217 media: atomisp: fix "variable dereferenced before check 'asd'"
In reply to Sasha LevinFrom: Tsuchiya Yuto <[email protected]>
[ Upstream commit ac56760a8bbb4e654b2fd54e5de79dd5d72f937d ]
There are two occurrences where the variable 'asd' is dereferenced before check. Fix this issue by using the variable after the check.
--- drivers/staging/media/atomisp/pci/atomisp_cmd.c | 3 ++- drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_cmd.c +2 -1
@@ -5224,7 +5224,7 @@ static int atomisp_set_fmt_to_isp(struct video_device *vdev,int (*configure_pp_input)(struct atomisp_sub_device *asd,unsigned int width,unsigned int height) = configure_pp_input_nop; -u16 stream_index =atomisp_source_pad_to_stream_id (asd, source_pad); +u16 stream_index;const struct atomisp_in_fmt_conv *fc;int ret, i;
@@ -5233,6 +5233,7 @@ static int atomisp_set_fmt_to_isp(struct video_device *vdev, __func__, vdev->name);return -EINVAL ; } + stream_index =atomisp_source_pad_to_stream_id (asd, source_pad);v4l2_fh_init (&fh.vfh, vdev);
drivers/staging/media/atomisp/pci/atomisp_ioctl.c +2 -1
@@ -1112,7 +1112,7 @@ int __atomisp_reqbufs(struct file *file, void *fh,struct ia_css_frame *frame;struct videobuf_vmalloc_memory *vm_mem;u16 source_pad =atomisp_subdev_source_pad (vdev); -u16 stream_id =atomisp_source_pad_to_stream_id (asd, source_pad); +u16 stream_id;int ret =0 , i =0 ;if (!asd) {
@@ -1120,6 +1120,7 @@ int __atomisp_reqbufs(struct file *file, void *fh, __func__, vdev->name);return -EINVAL ; } + stream_id =atomisp_source_pad_to_stream_id (asd, source_pad);if (req->count ==0 ) {mutex_lock (&pipe->capq.vb_lock);
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 62/217 soc: ti: pruss: fix referenced node in error message
In reply to Sasha LevinFrom: Jan Kiszka <[email protected]>
[ Upstream commit 8aa35e0bb5eaa42bac415ad0847985daa7b4890c ]
So far, "(null)" is reported for the node that is missing clocks.
--- drivers/soc/ti/pruss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/ti/pruss.c +1 -1
@@ -129,7 +129,7 @@ static int pruss_clk_init(struct pruss *pruss, struct device_node *cfg_node) clks_np =of_get_child_by_name (cfg_node,"clocks" );if (!clks_np) { -dev_err (dev,"%pOF is missing its 'clocks' node\n" , clks_np); +dev_err (dev,"%pOF is missing its 'clocks' node\n" , cfg_node);return -ENODEV ; }
Signature · 7 lines
2.34.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 70/217 tty: serial: imx: disable UCR4_OREN in .stop_rx() instead of .shutdown()
In reply to Sasha LevinFrom: Fugang Duan <[email protected]>
[ Upstream commit 028e083832b06fdeeb290e1e57dc1f6702c4c215 ]
The UCR4_OREN should be disabled before disabling the uart receiver in .stop_rx() instead of in the .shutdown().
Otherwise, if we have the overrun error during the receiver disable process, the overrun interrupt will keep trigging until we disable the OREN interrupt in the .shutdown(), because the ORE status can only be cleared when read the rx FIFO or reset the controller. Although the called time between the receiver disable and OREN disable in .shutdown() is very short, there is still the risk of endless interrupt during this short period of time. So here change to disable OREN before the receiver been disabled in .stop_rx().
--- drivers/tty/serial/imx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/tty/serial/imx.c +5 -2
@@ -486,18 +486,21 @@ static void imx_uart_stop_tx(struct uart_port *port)static void imx_uart_stop_rx (struct uart_port *port) {struct imx_port *sport = (struct imx_port *)port; -u32 ucr1, ucr2; +u32 ucr1, ucr2, ucr4; ucr1 =imx_uart_readl (sport,UCR1 ); ucr2 =imx_uart_readl (sport,UCR2 ); + ucr4 =imx_uart_readl (sport,UCR4 );if (sport->dma_is_enabled) { ucr1 &= ~(UCR1_RXDMAEN |UCR1_ATDMAEN ); }else { ucr1 &= ~UCR1_RRDYEN ; ucr2 &= ~UCR2_ATEN ; + ucr4 &= ~UCR4_OREN ; }imx_uart_writel (sport, ucr1,UCR1 ); +imx_uart_writel (sport, ucr4,UCR4 ); ucr2 &= ~UCR2_RXEN ;imx_uart_writel (sport, ucr2,UCR2 );
@@ -1544,7 +1547,7 @@ static void imx_uart_shutdown(struct uart_port *port)imx_uart_writel (sport, ucr1,UCR1 ); ucr4 =imx_uart_readl (sport,UCR4 ); - ucr4 &= ~(UCR4_OREN |UCR4_TCEN ); + ucr4 &= ~UCR4_TCEN ;imx_uart_writel (sport, ucr4,UCR4 );spin_unlock_irqrestore (&sport->port.lock, flags);
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 66/217 mxser: keep only !tty test in ISR
In reply to Sasha LevinFrom: Jiri Slaby <[email protected]>
[ Upstream commit 274ab58dc2b460cc474ffc7ccfcede4b2be1a3f5 ]
The others are superfluous with tty refcounting in place now. And they are racy in fact:
* tty_port_initialized() reports false for a small moment after interrupts are enabled.
* closing is 1 while the port is still alive.
The queues are flushed later during close anyway. So there is no need for this special handling. Actually, the ISR should not flush the queues. It should behave as every other driver, just queue the chars into tty buffer and go on. But this will be changed later. There is still a lot code depending on having tty in ISR (and not only tty_port).
--- drivers/tty/mxser.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/tty/mxser.c +1 -4
@@ -262,7 +262,6 @@ struct mxser_port {unsigned int xmit_head;unsigned int xmit_tail;unsigned int xmit_cnt; -int closing;spinlock_t slock; };
@@ -918,7 +917,6 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)return ;if (tty_port_close_start (port, tty, filp) ==0 )return ; - info->closing =1 ;mutex_lock (&port->mutex);mxser_close_port (port);mxser_flush_buffer (tty);
@@ -927,7 +925,6 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)mxser_shutdown_port (port);tty_port_set_initialized (port,0 );mutex_unlock (&port->mutex); - info->closing =0 ;/* Right now the tty_port set is done outside of the close_end helper as we don't yet have everyone using refcounts */ tty_port_close_end (port, tty);
@@ -1683,7 +1680,7 @@ static bool mxser_port_isr(struct mxser_port *port) iir &=MOXA_MUST_IIR_MASK ; tty =tty_port_tty_get (&port->port); -if (!tty || port->closing || !tty_port_initialized (&port->port)) { +if (!tty) { status =inb (port->ioaddr +UART_LSR );outb (port->FCR |UART_FCR_CLEAR_RCVR |UART_FCR_CLEAR_XMIT , port->ioaddr +UART_FCR );
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 71/217 gpiolib: acpi: Do not set the IRQ type if the IRQ is already in use
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit bdfd6ab8fdccd8b138837efff66f4a1911496378 ]
If the IRQ is already in use, then acpi_dev_gpio_irq_get_by() really should not change the type underneath the current owner.
I specifically hit an issue with this an a Chuwi Hi8 Super (CWI509) Bay Trail tablet, when the Boot OS selection in the BIOS is set to Android. In this case _STA for a MAX17047 ACPI I2C device wrongly returns 0xf and the _CRS resources for this device include a GpioInt pointing to a GPIO already in use by an _AEI handler, with a different type then specified in the _CRS for the MAX17047 device. Leading to the acpi_dev_gpio_irq_get() call done by the i2c-core-acpi.c code changing the type breaking the _AEI handler.
Now this clearly is a bug in the DSDT of this tablet (in Android mode), but in general calling irq_set_irq_type() on an IRQ which already is in use seems like a bad idea.
--- drivers/gpio/gpiolib-acpi.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/gpio/gpiolib-acpi.c +11 -4
@@ -1056,10 +1056,17 @@ int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, const char *name, int ind irq_flags =acpi_dev_get_irq_type (info.triggering, info.polarity); -/* Set type if specified and different than the current one */ -if (irq_flags !=IRQ_TYPE_NONE && - irq_flags !=irq_get_trigger_type (irq)) -irq_set_irq_type (irq, irq_flags); +/* +* If the IRQ is not already in use then set type +* if specified and different than the current one. +*/ +if (can_request_irq (irq, irq_flags)) { +if (irq_flags !=IRQ_TYPE_NONE && + irq_flags !=irq_get_trigger_type (irq)) +irq_set_irq_type (irq, irq_flags); + }else { +dev_dbg (&adev->dev,"IRQ %d already in use\n" , irq); + }return irq; }
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 67/217 mxser: don't throttle manually
In reply to Sasha LevinFrom: Jiri Slaby <[email protected]>
[ Upstream commit c6693e6e07805f1b7822b13a5b482bf2b6a1f312 ]
First, checking tty->receive_room to signalize whether there is enough space in the tty buffers does not make much sense. Provided the tty buffers are in tty_port and those are not checked at all.
Second, if the rx path is throttled, with CRTSCTS, RTS is deasserted, but is never asserted again. This leads to port "lockup", not accepting any more input.
So:
1) stty -F /dev/ttyMI0 crtscts # the mxser port
2) stty -F /dev/ttyS6 crtscts # the connected port
3) cat /dev/ttyMI0
4) "write in a loop" to /dev/ttyS6
5) cat from 3) produces the bytes from 4)
6) killall -STOP cat (the 3)'s one)
7) wait for RTS to drop on /dev/ttyMI0
8) killall -CONT cat (again the 3)'s one)
cat erroneously produces no more output now (i.e. no data sent from ttyS6 to ttyMI can be seen).
Note that the step 7) is performed twice: once from n_tty by tty_throttle_safe(), once by mxser_stoprx() from the receive path. Then after step 7), n_tty correctly unthrottles the input, but mxser calls mxser_stoprx() again as there is still only a little space in n_tty buffers (tty->receive_room mentioned at the beginning), but the device's FIFO is/can be already filled.
After this patch, the output is correctly resumed, i.e. n_tty both throttles and unthrottles without interfering with mxser's attempts.
This allows us to get rid of the non-standard ldisc_stop_rx flag from struct mxser_port.
--- drivers/tty/mxser.c | 36 ++++++------------------------------ 1 file changed, 6 insertions(+), 30 deletions(-)
drivers/tty/mxser.c +6 -30
@@ -251,8 +251,6 @@ struct mxser_port {u8 MCR ;/* Modem control register */ u8 FCR ;/* FIFO control register */ -bool ldisc_stop_rx; -struct async_icount icount;/* kernel counters for 4 input interrupts */ unsigned int timeout;
@@ -1323,11 +1321,14 @@ static int mxser_get_icount(struct tty_struct *tty,return 0 ; } -static void mxser_stoprx (struct tty_struct *tty) +/* +* This routine is called by the upper-layer tty layer to signal that +* incoming characters should be throttled. +*/ +static void mxser_throttle (struct tty_struct *tty) {struct mxser_port *info = tty->driver_data; - info->ldisc_stop_rx = true;if (I_IXOFF (tty)) {if (info->board->must_hwid) { info->IER &= ~MOXA_MUST_RECV_ISR ;
@@ -1346,21 +1347,11 @@ static void mxser_stoprx(struct tty_struct *tty) } } -/* -* This routine is called by the upper-layer tty layer to signal that -* incoming characters should be throttled. -*/ -static void mxser_throttle (struct tty_struct *tty) -{ -mxser_stoprx (tty); -} -static void mxser_unthrottle (struct tty_struct *tty) {struct mxser_port *info = tty->driver_data;/* startrx */ - info->ldisc_stop_rx = false;if (I_IXOFF (tty)) {if (info->x_char) info->x_char =0 ;
@@ -1543,9 +1534,6 @@ static bool mxser_receive_chars_new(struct tty_struct *tty,if (hwid ==MOXA_MUST_MU150_HWID ) gdl &=MOXA_MUST_GDL_MASK ; -if (gdl >= tty->receive_room && !port->ldisc_stop_rx) -mxser_stoprx (tty); -while (gdl--) {u8 ch =inb (port->ioaddr +UART_RX );tty_insert_flip_char (&port->port, ch,0 );
@@ -1558,10 +1546,8 @@ static u8 mxser_receive_chars_old(struct tty_struct *tty, struct mxser_port *port, u8 status) {enum mxser_must_hwid hwid = port->board->must_hwid; -int recv_room = tty->receive_room;int ignored =0 ;int max =256 ; -int cnt =0 ;u8 ch; do {
@@ -1596,14 +1582,8 @@ static u8 mxser_receive_chars_old(struct tty_struct *tty, port->icount.overrun++; } } -tty_insert_flip_char (&port->port, ch, flag); - cnt++; -if (cnt >= recv_room) { -if (!port->ldisc_stop_rx) -mxser_stoprx (tty); +if (!tty_insert_flip_char (&port->port, ch, flag))break ; - } - }if (hwid)
@@ -1618,9 +1598,6 @@ static u8 mxser_receive_chars_old(struct tty_struct *tty,static u8 mxser_receive_chars (struct tty_struct *tty,struct mxser_port *port,u8 status) { -if (tty->receive_room ==0 && !port->ldisc_stop_rx) -mxser_stoprx (tty); -if (!mxser_receive_chars_new (tty, port, status)) status =mxser_receive_chars_old (tty, port, status);
@@ -1833,7 +1810,6 @@ static void mxser_initbrd(struct mxser_board *brd, bool high_baud)tty_port_init (&info->port); info->port.ops = &mxser_port_ops; info->board = brd; - info->ldisc_stop_rx = false;/* Enhance mode enabled here */ if (brd->must_hwid !=MOXA_OTHER_UART )
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 72/217 HSI: core: Fix return freed object in hsi_new_client
In reply to Sasha LevinFrom: Chengfeng Ye <[email protected]>
[ Upstream commit a1ee1c08fcd5af03187dcd41dcab12fd5b379555 ]
cl is freed on error of calling device_register, but this object is return later, which will cause uaf issue. Fix it by return NULL on error.
--- drivers/hsi/hsi_core.c | 1 + 1 file changed, 1 insertion(+)
drivers/hsi/hsi_core.c +1 -0
@@ -102,6 +102,7 @@ struct hsi_client *hsi_new_client(struct hsi_port *port,if (device_register (&cl->device) <0 ) {pr_err ("hsi: failed to register client: %s\n" , info->name);put_device (&cl->device); + goto err; }return cl;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 69/217 serial: 8250_dw: Add StarFive JH7100 quirk
In reply to Sasha LevinFrom: Emil Renner Berthing <[email protected]>
[ Upstream commit 57dcb6ec85d59e04285b7dcf10924bb819c8e46f ]
On the StarFive JH7100 RISC-V SoC the UART core clocks can't be set to exactly 16 * 115200Hz and many other common bitrates. Trying this will only result in a higher input clock, but low enough that the UART's internal divisor can't come close enough to the baud rate target. So rather than try to set the input clock it's better to skip the clk_set_rate call and rely solely on the UART's internal divisor.
--- drivers/tty/serial/8250/8250_dw.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/tty/serial/8250/8250_dw.c +3 -0
@@ -414,6 +414,8 @@ static void dw8250_quirks(struct uart_port *p, struct dw8250_data *data)if (of_device_is_compatible (np,"marvell,armada-38x-uart" )) p->serial_out = dw8250_serial_out38x; +if (of_device_is_compatible (np,"starfive,jh7100-uart" )) + p->set_termios = dw8250_do_set_termios; }else if (acpi_dev_present ("APMC0D08" ,NULL ,-1 )) { p->iotype =UPIO_MEM32 ;
@@ -696,6 +698,7 @@ static const struct of_device_id dw8250_of_match[] = { { .compatible = "cavium,octeon-3860-uart" }, { .compatible = "marvell,armada-38x-uart" }, { .compatible = "renesas,rzn1-uart" }, + { .compatible = "starfive,jh7100-uart" }, {/* Sentinel */ } };MODULE_DEVICE_TABLE (of, dw8250_of_match);
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 73/217 crypto: jitter - consider 32 LSB for APT
In reply to Sasha LevinFrom: Stephan Müller <[email protected]>
[ Upstream commit 552d03a223eda3df84526ab2c1f4d82e15eaee7a ]
The APT compares the current time stamp with a pre-set value. The current code only considered the 4 LSB only. Yet, after reviews by mathematicians of the user space Jitter RNG version >= 3.1.0, it was concluded that the APT can be calculated on the 32 LSB of the time delta. Thi change is applied to the kernel.
This fixes a bug where an AMD EPYC fails this test as its RDTSC value contains zeros in the LSB. The most appropriate fix would have been to apply a GCD calculation and divide the time stamp by the GCD. Yet, this is a significant code change that will be considered for a future update. Note, tests showed that constantly the GCD always was 32 on these systems, i.e. the 5 LSB were always zero (thus failing the APT since it only considered the 4 LSB for its calculation).
--- crypto/jitterentropy.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
crypto/jitterentropy.c +1 -2
@@ -265,7 +265,6 @@ static int jent_stuck(struct rand_data *ec, __u64 current_delta) {__u64 delta2 =jent_delta (ec->last_delta, current_delta);__u64 delta3 =jent_delta (ec->last_delta2, delta2); -unsigned int delta_masked = current_delta &JENT_APT_WORD_MASK ; ec->last_delta = current_delta; ec->last_delta2 = delta2;
@@ -274,7 +273,7 @@ static int jent_stuck(struct rand_data *ec, __u64 current_delta)* Insert the result of the comparison of two back-to-back time * deltas. */ -jent_apt_insert (ec, delta_masked); +jent_apt_insert (ec, current_delta);if (!current_delta || !delta2 || !delta3) {/* RCT with a stuck bit */
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 76/217 mwifiex: Fix skb_over_panic in mwifiex_usb_recv()
In reply to Sasha LevinFrom: Zekun Shen <[email protected]>
[ Upstream commit 04d80663f67ccef893061b49ec8a42ff7045ae84 ]
Currently, with an unknown recv_type, mwifiex_usb_recv just return -1 without restoring the skb. Next time mwifiex_usb_rx_complete is invoked with the same skb, calling skb_put causes skb_over_panic.
The bug is triggerable with a compromised/malfunctioning usb device. After applying the patch, skb_over_panic no longer shows up with the same input.
Attached is the panic report from fuzzing.
skbuff: skb_over_panic: text:000000003bf1b5fa
len:2048 put:4 head:00000000dd6a115b data:000000000a9445d8 tail:0x844 end:0x840 dev:<NULL>
kernel BUG at net/core/skbuff.c:109!
invalid opcode: 0000 [#1] SMP KASAN NOPTI
CPU: 0 PID: 198 Comm: in:imklog Not tainted 5.6.0 #60 RIP: 0010:skb_panic+0x15f/0x161 Call Trace: <IRQ> ? mwifiex_usb_rx_complete+0x26b/0xfcd [mwifiex_usb] skb_put.cold+0x24/0x24 mwifiex_usb_rx_complete+0x26b/0xfcd [mwifiex_usb] __usb_hcd_giveback_urb+0x1e4/0x380 usb_giveback_urb_bh+0x241/0x4f0 ? __hrtimer_run_queues+0x316/0x740 ? __usb_hcd_giveback_urb+0x380/0x380 tasklet_action_common.isra.0+0x135/0x330 __do_softirq+0x18c/0x634 irq_exit+0x114/0x140 smp_apic_timer_interrupt+0xde/0x380 apic_timer_interrupt+0xf/0x20 </IRQ>
--- drivers/net/wireless/marvell/mwifiex/usb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/marvell/mwifiex/usb.c +2 -1
@@ -130,7 +130,8 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter,default :mwifiex_dbg (adapter,ERROR ,"unknown recv_type %#x\n" , recv_type); -return -1 ; + ret =-1 ; + goto exit_restore_skb; }break ;case MWIFIEX_USB_EP_DATA :
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 74/217 rtw89: fix potentially access out of range of RF register array
In reply to Sasha LevinFrom: Ping-Ke Shih <[email protected]>
[ Upstream commit 30101812a09b37bc8aa409a83f603d4c072198f2 ]
The RF register array is used to help firmware to restore RF settings. The original code can potentially access out of range, if the size is between (RTW89_H2C_RF_PAGE_SIZE * RTW89_H2C_RF_PAGE_NUM + 1) to ((RTW89_H2C_RF_PAGE_SIZE + 1) * RTW89_H2C_RF_PAGE_NUM). Fortunately, current used size doesn't fall into the wrong case, and the size will not change if we don't update RF parameter.
--- drivers/net/wireless/realtek/rtw89/phy.c | 33 ++++++++++++++---------- 1 file changed, 19 insertions(+), 14 deletions(-)
drivers/net/wireless/realtek/rtw89/phy.c +19 -14
@@ -654,6 +654,12 @@ rtw89_phy_cofig_rf_reg_store(struct rtw89_dev *rtwdev,u16 idx = info->curr_idx %RTW89_H2C_RF_PAGE_SIZE ;u8 page = info->curr_idx /RTW89_H2C_RF_PAGE_SIZE ; +if (page >=RTW89_H2C_RF_PAGE_NUM ) { +rtw89_warn (rtwdev,"RF parameters exceed size. path=%d, idx=%d" , + rf_path, info->curr_idx); +return ; + } + info->rtw89_phy_config_rf_h2c[page][idx] =cpu_to_le32 ((reg->addr <<20 ) | reg->data); info->curr_idx++;
@@ -662,30 +668,29 @@ rtw89_phy_cofig_rf_reg_store(struct rtw89_dev *rtwdev,static int rtw89_phy_config_rf_reg_fw (struct rtw89_dev *rtwdev,struct rtw89_fw_h2c_rf_reg_info *info) { -u16 page = info->curr_idx /RTW89_H2C_RF_PAGE_SIZE ; -u16 len = (info->curr_idx %RTW89_H2C_RF_PAGE_SIZE ) *4 ; +u16 remain = info->curr_idx; +u16 len =0 ;u8 i;int ret =0 ; -if (page >RTW89_H2C_RF_PAGE_NUM ) { +if (remain >RTW89_H2C_RF_PAGE_NUM *RTW89_H2C_RF_PAGE_SIZE ) {rtw89_warn (rtwdev, -"rf reg h2c total page num %d larger than %d (RTW89_H2C_RF_PAGE_NUM)\n" , - page,RTW89_H2C_RF_PAGE_NUM ); -return -EINVAL ; +"rf reg h2c total len %d larger than %d\n" , + remain,RTW89_H2C_RF_PAGE_NUM *RTW89_H2C_RF_PAGE_SIZE ); + ret = -EINVAL ; + goto out; } -for (i =0 ; i < page; i++) { - ret =rtw89_fw_h2c_rf_reg (rtwdev, info, -RTW89_H2C_RF_PAGE_SIZE *4 , i); +for (i =0 ; i <RTW89_H2C_RF_PAGE_NUM && remain; i++, remain -= len) { + len = remain >RTW89_H2C_RF_PAGE_SIZE ?RTW89_H2C_RF_PAGE_SIZE : remain; + ret =rtw89_fw_h2c_rf_reg (rtwdev, info, len *4 , i);if (ret) -return ret; + goto out; } - ret =rtw89_fw_h2c_rf_reg (rtwdev, info, len, i); -if (ret) -return ret; +out: info->curr_idx =0 ; -return 0 ; +return ret; } static void rtw89_phy_config_rf_reg(struct rtw89_dev *rtwdev,
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 75/217 rtw88: add quirk to disable pci caps on HP 250 G7 Notebook PC
In reply to Sasha LevinFrom: Ping-Ke Shih <[email protected]>
[ Upstream commit c81edb8dddaa36c4defa26240cc19127f147283f ]
8821CE causes random freezes on HP 250 G7 Notebook PC. Add a quirk to disable pci ASPM capability.
--- drivers/net/wireless/realtek/rtw88/pci.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/net/wireless/realtek/rtw88/pci.c +9 -0
@@ -1738,6 +1738,15 @@ static const struct dmi_system_id rtw88_pci_quirks[] = { }, .driver_data = (void *)BIT(QUIRK_DIS_PCI_CAP_ASPM), }, + { + .callback = disable_pci_caps, + .ident = "HP HP 250 G7 Notebook PC", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "HP"), + DMI_MATCH(DMI_PRODUCT_NAME, "HP 250 G7 Notebook PC"), + }, + .driver_data = (void *)BIT(QUIRK_DIS_PCI_CAP_ASPM), + }, {} };
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 78/217 rsi: Fix out-of-bounds read in rsi_read_pkt()
In reply to Sasha LevinFrom: Zekun Shen <[email protected]>
[ Upstream commit f1cb3476e48b60c450ec3a1d7da0805bffc6e43a ]
rsi_get_* functions rely on an offset variable from usb input. The size of usb input is RSI_MAX_RX_USB_PKT_SIZE(3000), while 2-byte offset can be up to 0xFFFF. Thus a large offset can cause out-of-bounds read.
The patch adds a bound checking condition when rcv_pkt_len is 0, indicating it's USB. It's unclear whether this is triggerable from other type of bus. The following check might help in that case. offset > rcv_pkt_len - FRAME_DESC_SZ
The bug is trigerrable with conpromised/malfunctioning USB devices. I tested the patch with the crashing input and got no more bug report.
Attached is the KASAN report from fuzzing.
BUG: KASAN: slab-out-of-bounds in rsi_read_pkt+0x42e/0x500 [rsi_91x] Read of size 2 at addr ffff888019439fdb by task RX-Thread/227 CPU: 0 PID: 227 Comm: RX-Thread Not tainted 5.6.0 #66 Call Trace: dump_stack+0x76/0xa0 print_address_description.constprop.0+0x16/0x200 ? rsi_read_pkt+0x42e/0x500 [rsi_91x] ? rsi_read_pkt+0x42e/0x500 [rsi_91x] __kasan_report.cold+0x37/0x7c ? rsi_read_pkt+0x42e/0x500 [rsi_91x] kasan_report+0xe/0x20 rsi_read_pkt+0x42e/0x500 [rsi_91x] rsi_usb_rx_thread+0x1b1/0x2fc [rsi_usb] ? rsi_probe+0x16a0/0x16a0 [rsi_usb] ? _raw_spin_lock_irqsave+0x7b/0xd0 ? _raw_spin_trylock_bh+0x120/0x120 ? __wake_up_common+0x10b/0x520 ? rsi_probe+0x16a0/0x16a0 [rsi_usb] kthread+0x2b5/0x3b0 ? kthread_create_on_node+0xd0/0xd0 ret_from_fork+0x22/0x40
--- drivers/net/wireless/rsi/rsi_91x_main.c | 4 ++++ drivers/net/wireless/rsi/rsi_91x_usb.c | 1 - drivers/net/wireless/rsi/rsi_usb.h | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-)
drivers/net/wireless/rsi/rsi_91x_main.c +4 -0
@@ -23,6 +23,7 @@#include "rsi_common.h" #include "rsi_coex.h" #include "rsi_hal.h" +#include "rsi_usb.h" u32 rsi_zone_enabled =/* INFO_ZONE | INIT_ZONE |
@@ -168,6 +169,9 @@ int rsi_read_pkt(struct rsi_common *common, u8 *rx_pkt, s32 rcv_pkt_len) frame_desc = &rx_pkt[index]; actual_length = *(u16 *)&frame_desc[0 ]; offset = *(u16 *)&frame_desc[2 ]; +if (!rcv_pkt_len && offset > +RSI_MAX_RX_USB_PKT_SIZE -FRAME_DESC_SZ ) + goto fail; queueno =rsi_get_queueno (frame_desc, offset); length =rsi_get_length (frame_desc, offset);
drivers/net/wireless/rsi/rsi_91x_usb.c +0 -1
@@ -330,7 +330,6 @@ static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num, gfp_t mem_flags)struct sk_buff *skb;u8 dword_align_bytes =0 ; -#define RSI_MAX_RX_USB_PKT_SIZE 3000 skb =dev_alloc_skb (RSI_MAX_RX_USB_PKT_SIZE );if (!skb)return -ENOMEM ;
drivers/net/wireless/rsi/rsi_usb.h +2 -0
@@ -44,6 +44,8 @@#define RSI_USB_BUF_SIZE 4096#define RSI_USB_CTRL_BUF_SIZE 0x04 +#define RSI_MAX_RX_USB_PKT_SIZE 3000 +struct rx_usb_ctrl_block {u8 *data;struct urb *rx_urb;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 85/217 ACPI: Change acpi_device_always_present() into acpi_device_override_status()
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 1a68b346a2c9969c05e80a3b99a9ab160b5655c0 ]
Currently, acpi_bus_get_status() calls acpi_device_always_present() to allow platform quirks to override the _STA return to report that a device is present (status = ACPI_STA_DEFAULT) independent of the _STA return.
In some cases it might also be useful to have the opposite functionality and have a platform quirk which marks a device as not present (status = 0) to work around ACPI table bugs.
Change acpi_device_always_present() into a more generic acpi_device_override_status() function to allow this.
--- drivers/acpi/bus.c | 4 +-- drivers/acpi/x86/utils.c | 64 +++++++++++++++++++++++----------------- include/acpi/acpi_bus.h | 5 ++-- 3 files changed, 42 insertions(+), 31 deletions(-)
drivers/acpi/bus.c +2 -2
@@ -98,8 +98,8 @@ int acpi_bus_get_status(struct acpi_device *device)acpi_status status;unsigned long long sta; -if (acpi_device_always_present (device)) { -acpi_set_device_status (device,ACPI_STA_DEFAULT ); +if (acpi_device_override_status (device, &sta)) { +acpi_set_device_status (device, sta);return 0 ; }
drivers/acpi/x86/utils.c +37 -27
136 lines not on this page · raw message
include/acpi/acpi_bus.h +3 -2
@@ -613,9 +613,10 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state);int acpi_disable_wakeup_device_power (struct acpi_device *dev);#ifdef CONFIG_X86 -bool acpi_device_always_present (struct acpi_device *adev); +bool acpi_device_override_status (struct acpi_device *adev,unsigned long long *status);#else -static inline bool acpi_device_always_present (struct acpi_device *adev) +static inline bool acpi_device_override_status (struct acpi_device *adev, +unsigned long long *status) {return false; }
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 79/217 ath11k: Avoid NULL ptr access during mgmt tx cleanup
In reply to Sasha LevinFrom: Sriram R <[email protected]>
[ Upstream commit a93789ae541c7d5c1c2a4942013adb6bcc5e2848 ]
Currently 'ar' reference is not added in skb_cb during WMI mgmt tx. Though this is generally not used during tx completion callbacks, on interface removal the remaining idr cleanup callback uses the ar ptr from skb_cb from mgmt txmgmt_idr. Hence fill them during tx call for proper usage.
Also free the skb which is missing currently in these callbacks.
Crash_info:
[19282.489476] Unable to handle kernel NULL pointer dereference at virtual address 00000000 [19282.489515] pgd = 91eb8000 [19282.496702] [00000000] *pgd=00000000 [19282.502524] Internal error: Oops: 5 [#1] PREEMPT SMP ARM [19282.783728] PC is at ath11k_mac_vif_txmgmt_idr_remove+0x28/0xd8 [ath11k] [19282.789170] LR is at idr_for_each+0xa0/0xc8
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-00729-QCAHKSWPL_SILICONZ-3 v2
--- drivers/net/wireless/ath/ath11k/mac.c | 35 +++++++++++++++------------ 1 file changed, 20 insertions(+), 15 deletions(-)
drivers/net/wireless/ath/ath11k/mac.c +20 -15
@@ -1,6 +1,7 @@// SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. +* Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. */ #include <net/mac80211.h>
@@ -4930,23 +4931,32 @@ static int __ath11k_set_antenna(struct ath11k *ar, u32 tx_ant, u32 rx_ant)return 0 ; } -int ath11k_mac_tx_mgmt_pending_free (int buf_id,void *skb,void *ctx) +static void ath11k_mac_tx_mgmt_free (struct ath11k *ar,int buf_id) { -struct sk_buff *msdu = skb; +struct sk_buff *msdu;struct ieee80211_tx_info *info; -struct ath11k *ar = ctx; -struct ath11k_base *ab = ar->ab;spin_lock_bh (&ar->txmgmt_idr_lock); -idr_remove (&ar->txmgmt_idr, buf_id); + msdu =idr_remove (&ar->txmgmt_idr, buf_id);spin_unlock_bh (&ar->txmgmt_idr_lock); -dma_unmap_single (ab->dev,ATH11K_SKB_CB (msdu)->paddr, msdu->len, + +if (!msdu) +return ; + +dma_unmap_single (ar->ab->dev,ATH11K_SKB_CB (msdu)->paddr, msdu->len,DMA_TO_DEVICE ); info =IEEE80211_SKB_CB (msdu);memset (&info->status,0 ,sizeof (info->status));ieee80211_free_txskb (ar->hw, msdu); +} + +int ath11k_mac_tx_mgmt_pending_free (int buf_id,void *skb,void *ctx) +{ +struct ath11k *ar = ctx; + +ath11k_mac_tx_mgmt_free (ar, buf_id);return 0 ; }
@@ -4955,17 +4965,10 @@ static int ath11k_mac_vif_txmgmt_idr_remove(int buf_id, void *skb, void *ctx) {struct ieee80211_vif *vif = ctx;struct ath11k_skb_cb *skb_cb =ATH11K_SKB_CB ((struct sk_buff *)skb); -struct sk_buff *msdu = skb;struct ath11k *ar = skb_cb->ar; -struct ath11k_base *ab = ar->ab; -if (skb_cb->vif == vif) { -spin_lock_bh (&ar->txmgmt_idr_lock); -idr_remove (&ar->txmgmt_idr, buf_id); -spin_unlock_bh (&ar->txmgmt_idr_lock); -dma_unmap_single (ab->dev, skb_cb->paddr, msdu->len, -DMA_TO_DEVICE ); - } +if (skb_cb->vif == vif) +ath11k_mac_tx_mgmt_free (ar, buf_id);return 0 ; }
@@ -4980,6 +4983,8 @@ static int ath11k_mac_mgmt_tx_wmi(struct ath11k *ar, struct ath11k_vif *arvif,int buf_id;int ret; +ATH11K_SKB_CB (skb)->ar = ar; +spin_lock_bh (&ar->txmgmt_idr_lock); buf_id =idr_alloc (&ar->txmgmt_idr, skb,0 ,ATH11K_TX_MGMT_NUM_PENDING_MAX ,GFP_ATOMIC );
Signature · 7 lines
2.34.1 -- ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
Sasha Levin
maintainerPATCH 77/217 rsi: Fix use-after-free in rsi_rx_done_handler()
In reply to Sasha LevinFrom: Zekun Shen <[email protected]>
[ Upstream commit b07e3c6ebc0c20c772c0f54042e430acec2945c3 ]
When freeing rx_cb->rx_skb, the pointer is not set to NULL, a later rsi_rx_done_handler call will try to read the freed address.
This bug will very likley lead to double free, although detected early as use-after-free bug.
The bug is triggerable with a compromised/malfunctional usb device. After applying the patch, the same input no longer triggers the use-after-free.
Attached is the kasan report from fuzzing.
BUG: KASAN: use-after-free in rsi_rx_done_handler+0x354/0x430 [rsi_usb] Read of size 4 at addr ffff8880188e5930 by task modprobe/231 Call Trace: <IRQ> dump_stack+0x76/0xa0 print_address_description.constprop.0+0x16/0x200 ? rsi_rx_done_handler+0x354/0x430 [rsi_usb] ? rsi_rx_done_handler+0x354/0x430 [rsi_usb] __kasan_report.cold+0x37/0x7c ? dma_direct_unmap_page+0x90/0x110 ? rsi_rx_done_handler+0x354/0x430 [rsi_usb] kasan_report+0xe/0x20 rsi_rx_done_handler+0x354/0x430 [rsi_usb] __usb_hcd_giveback_urb+0x1e4/0x380 usb_giveback_urb_bh+0x241/0x4f0 ? __usb_hcd_giveback_urb+0x380/0x380 ? apic_timer_interrupt+0xa/0x20 tasklet_action_common.isra.0+0x135/0x330 __do_softirq+0x18c/0x634 ? handle_irq_event+0xcd/0x157 ? handle_edge_irq+0x1eb/0x7b0 irq_exit+0x114/0x140 do_IRQ+0x91/0x1e0 common_interrupt+0xf/0xf </IRQ>
--- drivers/net/wireless/rsi/rsi_91x_usb.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/wireless/rsi/rsi_91x_usb.c +7 -1
@@ -269,8 +269,12 @@ static void rsi_rx_done_handler(struct urb *urb)struct rsi_91x_usbdev *dev = (struct rsi_91x_usbdev *)rx_cb->data;int status = -EINVAL ; +if (!rx_cb->rx_skb) +return ; +if (urb->status) {dev_kfree_skb (rx_cb->rx_skb); + rx_cb->rx_skb =NULL ;return ; }
@@ -294,8 +298,10 @@ static void rsi_rx_done_handler(struct urb *urb)if (rsi_rx_urb_submit (dev->priv, rx_cb->ep_num,GFP_ATOMIC ))rsi_dbg (ERR_ZONE ,"%s: Failed in urb submission" , __func__); -if (status) +if (status) {dev_kfree_skb (rx_cb->rx_skb); + rx_cb->rx_skb =NULL ; + } }static void rsi_rx_urb_kill (struct rsi_hw *adapter,u8 ep_num)
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 130/217 drm/amdkfd: Fix error handling in svm_range_add
In reply to Sasha LevinFrom: Felix Kuehling <[email protected]>
[ Upstream commit 726be40607264b180a2b336c81e1dcff941de618 ]
Add null-pointer check after the last svm_range_new call. This was originally reported by Zhou Qingyang <[email protected]> based on a static analyzer.
To avoid duplicating the unwinding code from svm_range_handle_overlap, I merged the two functions into one.
--- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 138 ++++++++++----------------- 1 file changed, 49 insertions(+), 89 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +49 -89
@@ -943,7 +943,7 @@ svm_range_split(struct svm_range *prange, uint64_t start, uint64_t last, }static int -svm_range_split_tail (struct svm_range *prange,struct svm_range *new, +svm_range_split_tail (struct svm_range *prange,uint64_t new_last,struct list_head *insert_list) {struct svm_range *tail;
@@ -955,7 +955,7 @@ svm_range_split_tail(struct svm_range *prange, struct svm_range *new, }static int -svm_range_split_head (struct svm_range *prange,struct svm_range *new, +svm_range_split_head (struct svm_range *prange,uint64_t new_start,struct list_head *insert_list) {struct svm_range *head;
@@ -1764,49 +1764,54 @@ static struct svm_range *svm_range_clone(struct svm_range *old) }/** -* svm_range_handle_overlap - split overlap ranges -* @svms: svm range list header -* @new: range added with this attributes -* @start: range added start address, in pages -* @last: range last address, in pages -* @update_list: output, the ranges attributes are updated. For set_attr, this -* will do validation and map to GPUs. For unmap, this will be -* removed and unmap from GPUs -* @insert_list: output, the ranges will be inserted into svms, attributes are -* not changes. For set_attr, this will add into svms. -* @remove_list:output, the ranges will be removed from svms -* @left: the remaining range after overlap, For set_attr, this will be added -* as new range. +* svm_range_add - add svm range and handle overlap +* @p: the range add to this process svms +* @start: page size aligned +* @size: page size aligned +* @nattr: number of attributes +* @attrs: array of attributes +* @update_list: output, the ranges need validate and update GPU mapping +* @insert_list: output, the ranges need insert to svms +* @remove_list: output, the ranges are replaced and need remove from svms * -* Total have 5 overlap cases. +* Check if the virtual address range has overlap with any existing ranges, +* split partly overlapping ranges and add new ranges in the gaps. All changes +* should be applied to the range_list and interval tree transactionally. If +* any range split or allocation fails, the entire update fails. Therefore any +* existing overlapping svm_ranges are cloned and the original svm_ranges left +* unchanged. * -* This function handles overlap of an address interval with existing -* struct svm_ranges for applying new attributes. This may require -* splitting existing struct svm_ranges. All changes should be applied to -* the range_list and interval tree transactionally. If any split operation -* fails, the entire update fails. Therefore the existing overlapping -* svm_ranges are cloned and the original svm_ranges left unchanged. If the -* transaction succeeds, the modified clones are added and the originals -* freed. Otherwise the clones are removed and the old svm_ranges remain. +* If the transaction succeeds, the caller can update and insert clones and +* new ranges, then free the originals. * -* Context: The caller must hold svms->lock +* Otherwise the caller can free the clones and new ranges, while the old +* svm_ranges remain unchanged. +* +* Context: Process context, caller must hold svms->lock +* +* Return: +* 0 - OK, otherwise error code */ static int -svm_range_handle_overlap (struct svm_range_list *svms,struct svm_range *new, -unsigned long start,unsigned long last, -struct list_head *update_list, -struct list_head *insert_list, -struct list_head *remove_list, -unsigned long *left) +svm_range_add (struct kfd_process *p,uint64_t start,uint64_t size, +uint32_t nattr,struct kfd_ioctl_svm_attribute *attrs, +struct list_head *update_list,struct list_head *insert_list, +struct list_head *remove_list) { +unsigned long last = start + size -1UL ; +struct svm_range_list *svms = &p->svms;struct interval_tree_node *node; +struct svm_range new = {0 };struct svm_range *prange;struct svm_range *tmp;int r =0 ; +pr_debug ("svms 0x%p [0x%llx 0x%lx]\n" , &p->svms, start, last); +INIT_LIST_HEAD (update_list);INIT_LIST_HEAD (insert_list);INIT_LIST_HEAD (remove_list); +svm_range_apply_attrs (p, &new, nattr, attrs); node =interval_tree_iter_first (&svms->objects, start, last);while (node) {
@@ -1834,14 +1839,14 @@ svm_range_handle_overlap(struct svm_range_list *svms, struct svm_range *new,if (node->start < start) {pr_debug ("change old range start\n" ); - r =svm_range_split_head (prange, new, start, + r =svm_range_split_head (prange, start, insert_list);if (r) goto out; }if (node->last > last) {pr_debug ("change old range last\n" ); - r =svm_range_split_tail (prange, new, last, + r =svm_range_split_tail (prange, last, insert_list);if (r) goto out;
@@ -1853,7 +1858,7 @@ svm_range_handle_overlap(struct svm_range_list *svms, struct svm_range *new, prange = old; } -if (!svm_range_is_same_attrs (prange, new)) +if (!svm_range_is_same_attrs (prange, &new))list_add (&prange->update_list, update_list);/* insert a new node if needed */
@@ -1873,8 +1878,16 @@ svm_range_handle_overlap(struct svm_range_list *svms, struct svm_range *new, start = next_start; } -if (left && start <= last) - *left = last - start +1 ; +/* add a final range at the end if needed */ +if (start <= last) { + prange =svm_range_new (svms, start, last); +if (!prange) { + r = -ENOMEM ; + goto out; + } +list_add (&prange->insert_list, insert_list); +list_add (&prange->update_list, update_list); + } out:if (r)
@@ -2894,59 +2907,6 @@ svm_range_is_valid(struct kfd_process *p, uint64_t start, uint64_t size) NULL); } -/** -* svm_range_add - add svm range and handle overlap -* @p: the range add to this process svms -* @start: page size aligned -* @size: page size aligned -* @nattr: number of attributes -* @attrs: array of attributes -* @update_list: output, the ranges need validate and update GPU mapping -* @insert_list: output, the ranges need insert to svms -* @remove_list: output, the ranges are replaced and need remove from svms -* -* Check if the virtual address range has overlap with the registered ranges, -* split the overlapped range, copy and adjust pages address and vram nodes in -* old and new ranges. -* -* Context: Process context, caller must hold svms->lock -* -* Return: -* 0 - OK, otherwise error code -*/ -static int -svm_range_add (struct kfd_process *p,uint64_t start,uint64_t size, -uint32_t nattr,struct kfd_ioctl_svm_attribute *attrs, -struct list_head *update_list,struct list_head *insert_list, -struct list_head *remove_list) -{ -uint64_t last = start + size -1UL ; -struct svm_range_list *svms; -struct svm_range new = {0 }; -struct svm_range *prange; -unsigned long left =0 ; -int r =0 ; - -pr_debug ("svms 0x%p [0x%llx 0x%llx]\n" , &p->svms, start, last); - -svm_range_apply_attrs (p, &new, nattr, attrs); - - svms = &p->svms; - - r =svm_range_handle_overlap (svms, &new, start, last, update_list, - insert_list, remove_list, &left); -if (r) -return r; - -if (left) { - prange =svm_range_new (svms, last - left +1 , last); -list_add (&prange->insert_list, insert_list); -list_add (&prange->update_list, update_list); - } - -return 0 ; -} -/** * svm_range_best_prefetch_location - decide the best prefetch location * @prange: svm range structure
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 80/217 media: venus: avoid calling core_clk_setrate() concurrently during concurrent video sessions
In reply to Sasha LevinFrom: Mansur Alisha Shaik <[email protected]>
[ Upstream commit 91f2b7d269e5c885c38c7ffa261f5276bd42f907 ]
In existing implementation, core_clk_setrate() is getting called concurrently in concurrent video sessions. Before the previous call to core_clk_setrate returns, new call to core_clk_setrate is invoked from another video session running concurrently. This results in latest calculated frequency being set (higher/lower) instead of actual frequency required for that video session. It also results in stability crashes mention below. These resources are specific to video core, hence keeping under core lock would ensure that they are estimated for all running video sessions and called once for the video core.
Crash logs:
[ 1.900089] WARNING: CPU: 4 PID: 1 at drivers/opp/debugfs.c:33 opp_debug_remove_one+0x2c/0x48 [ 1.908493] Modules linked in: [ 1.911524] CPU: 4 PID: 1 Comm: swapper/0 Not tainted 5.10.67 #35 f8edb8c30cf2dd6838495dd9ef9be47af7f5f60c [ 1.921036] Hardware name: Qualcomm Technologies, Inc. sc7280 IDP SKU2 platform (DT) [ 1.928673] pstate: 60800009 (nZCv daif -PAN +UAO -TCO BTYPE=--) [ 1.934608] pc : opp_debug_remove_one+0x2c/0x48 [ 1.939080] lr : opp_debug_remove_one+0x2c/0x48 [ 1.943560] sp : ffffffc011d7b7f0 [ 1.946836] pmr_save: 000000e0 [ 1.949854] x29: ffffffc011d7b7f0 x28: ffffffc010733bbc [ 1.955104] x27: ffffffc010733ba8 x26: ffffff8083cedd00 [ 1.960355] x25: 0000000000000001 x24: 0000000000000000 [ 1.965603] x23: ffffff8083cc2878 x22: ffffff8083ceb900 [ 1.970852] x21: ffffff8083ceb910 x20: ffffff8083cc2800 [ 1.976101] x19: ffffff8083ceb900 x18: 00000000ffff0a10 [ 1.981352] x17: ffffff80837a5620 x16: 00000000000000ec [ 1.986601] x15: ffffffc010519ad4 x14: 0000000000000003 [ 1.991849] x13: 0000000000000004 x12: 0000000000000001 [ 1.997100] x11: c0000000ffffdfff x10: 00000000ffffffff [ 2.002348] x9 : d2627c580300dc00 x8 : d2627c580300dc00 [ 2.007596] x7 : 0720072007200720 x6 : ffffff80802ecf00 [ 2.012845] x5 : 0000000000190004 x4 : 0000000000000000 [ 2.018094] x3 : ffffffc011d7b478 x2 : ffffffc011d7b480 [ 2.023343] x1 : 00000000ffffdfff x0 : 0000000000000017 [ 2.028594] Call trace: [ 2.031022] opp_debug_remove_one+0x2c/0x48 [ 2.035160] dev_pm_opp_put+0x94/0xb0 [ 2.038780] _opp_remove_all+0x7c/0xc8 [ 2.042486] _opp_remove_all_static+0x54/0x7c [ 2.046796] dev_pm_opp_remove_table+0x74/0x98 [ 2.051183] devm_pm_opp_of_table_release+0x18/0x24 [ 2.056001] devm_action_release+0x1c/0x28 [ 2.060053] release_nodes+0x23c/0x2b8 [ 2.063760] devres_release_group+0xcc/0xd0 [ 2.067900] component_bind+0xac/0x168 [ 2.071608] component_bind_all+0x98/0x124 [ 2.075664] msm_drm_bind+0x1e8/0x678 [ 2.079287] try_to_bring_up_master+0x60/0x134 [ 2.083674] component_master_add_with_match+0xd8/0x120 [ 2.088834] msm_pdev_probe+0x20c/0x2a0 [ 2.092629] platform_drv_probe+0x9c/0xbc [ 2.096598] really_probe+0x11c/0x46c [ 2.100217] driver_probe_device+0x8c/0xf0 [ 2.104270] device_driver_attach+0x54/0x78 [ 2.108407] __driver_attach+0x48/0x148 [ 2.112201] bus_for_each_dev+0x88/0xd4 [ 2.115998] driver_attach+0x2c/0x38 [ 2.119534] bus_add_driver+0x10c/0x200 [ 2.123330] driver_register+0x6c/0x104 [ 2.127122] __platform_driver_register+0x4c/0x58 [ 2.131767] msm_drm_register+0x6c/0x70 [ 2.135560] do_one_initcall+0x64/0x23c [ 2.139357] do_initcall_level+0xac/0x15c [ 2.143321] do_initcalls+0x5c/0x9c [ 2.146778] do_basic_setup+0x2c/0x38 [ 2.150401] kernel_init_freeable+0xf8/0x15c [ 2.154622] kernel_init+0x1c/0x11c [ 2.158079] ret_from_fork+0x10/0x30 [ 2.161615] ---[ end trace a2cc45a0f784b212 ]---
[ 2.166272] Removing OPP: 300000000
--- .../media/platform/qcom/venus/pm_helpers.c | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/media/platform/qcom/venus/pm_helpers.c +14 -14
@@ -163,14 +163,12 @@ static u32 load_per_type(struct venus_core *core, u32 session_type)struct venus_inst *inst =NULL ;u32 mbs_per_sec =0 ; -mutex_lock (&core->lock);list_for_each_entry (inst, &core->instances, list) {if (inst->session_type != session_type)continue ; mbs_per_sec +=load_per_instance (inst); } -mutex_unlock (&core->lock);return mbs_per_sec; }
@@ -219,14 +217,12 @@ static int load_scale_bw(struct venus_core *core)struct venus_inst *inst =NULL ;u32 mbs_per_sec, avg, peak, total_avg =0 , total_peak =0 ; -mutex_lock (&core->lock);list_for_each_entry (inst, &core->instances, list) { mbs_per_sec =load_per_instance (inst);mbs_to_bw (inst, mbs_per_sec, &avg, &peak); total_avg += avg; total_peak += peak; } -mutex_unlock (&core->lock);/* * keep minimum bandwidth vote for "video-mem" path,
@@ -253,8 +249,9 @@ static int load_scale_v1(struct venus_inst *inst)struct device *dev = core->dev;u32 mbs_per_sec;unsigned int i; -int ret; +int ret =0 ; +mutex_lock (&core->lock); mbs_per_sec =load_per_type (core,VIDC_SESSION_TYPE_ENC ) +load_per_type (core,VIDC_SESSION_TYPE_DEC );
@@ -279,17 +276,19 @@ static int load_scale_v1(struct venus_inst *inst)if (ret) {dev_err (dev,"failed to set clock rate %lu (%d)\n" , freq, ret); -return ret; + goto exit; } ret =load_scale_bw (core);if (ret) {dev_err (dev,"failed to set bandwidth (%d)\n" , ret); -return ret; + goto exit; } -return 0 ; +exit: +mutex_unlock (&core->lock); +return ret; }static int core_get_v1 (struct venus_core *core)
@@ -1116,13 +1115,13 @@ static int load_scale_v4(struct venus_inst *inst)struct device *dev = core->dev;unsigned long freq =0 , freq_core1 =0 , freq_core2 =0 ;unsigned long filled_len =0 ; -int i, ret; +int i, ret =0 ;for (i =0 ; i < inst->num_input_bufs; i++) filled_len =max (filled_len, inst->payloads[i]);if (inst->session_type ==VIDC_SESSION_TYPE_DEC && !filled_len) -return 0 ; +return ret; freq =calculate_inst_freq (inst, filled_len); inst->clk_data.freq = freq;
@@ -1138,7 +1137,6 @@ static int load_scale_v4(struct venus_inst *inst) freq_core2 += inst->clk_data.freq; } } -mutex_unlock (&core->lock); freq =max (freq_core1, freq_core2);
@@ -1163,17 +1161,19 @@ static int load_scale_v4(struct venus_inst *inst)if (ret) {dev_err (dev,"failed to set clock rate %lu (%d)\n" , freq, ret); -return ret; + goto exit; } ret =load_scale_bw (core);if (ret) {dev_err (dev,"failed to set bandwidth (%d)\n" , ret); -return ret; + goto exit; } -return 0 ; +exit: +mutex_unlock (&core->lock); +return ret; }static const struct venus_pm_ops pm_ops_v4 = {
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 131/217 drm/amdgpu: fix amdgpu_ras_mca_query_error_status scope
In reply to Sasha LevinFrom: Isabella Basso <[email protected]>
[ Upstream commit 929bb8e200412da36aca4b61209ec26283f9c184 ]
This commit fixes the compile-time warning below:
warning: no previous prototype for ‘amdgpu_ras_mca_query_error_status’ [-Wmissing-prototypes]
Changes since v1:
- As suggested by Alexander Deucher:
1. Make function static instead of adding prototype.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +3 -3
@@ -867,9 +867,9 @@ static int amdgpu_ras_enable_all_features(struct amdgpu_device *adev,/* feature ctl end */ -void amdgpu_ras_mca_query_error_status (struct amdgpu_device *adev, -struct ras_common_if *ras_block, -struct ras_err_data *err_data) +static void amdgpu_ras_mca_query_error_status (struct amdgpu_device *adev, +struct ras_common_if *ras_block, +struct ras_err_data *err_data) {switch (ras_block->sub_block_index) {case AMDGPU_RAS_MCA_BLOCK__MP0 :
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 81/217 regulator: da9121: Prevent current limit change when enabled
In reply to Sasha LevinFrom: Adam Ward <[email protected]>
[ Upstream commit 24f0853228f3b98f1ef08d5824376c69bb8124d2 ]
Prevent changing current limit when enabled as a precaution against possibile instability due to tight integration with switching cycle
--- drivers/regulator/da9121-regulator.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/regulator/da9121-regulator.c +5 -0
@@ -253,6 +253,11 @@ static int da9121_set_current_limit(struct regulator_dev *rdev, goto error; } +if (rdev->desc->ops->is_enabled (rdev)) { + ret = -EBUSY ; + goto error; + } + ret =da9121_ceiling_selector (rdev, min_ua, max_ua, &sel);if (ret <0 ) goto error;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 68/217 mxser: increase buf_overrun if tty_insert_flip_char() fails
In reply to Sasha LevinFrom: Jiri Slaby <[email protected]>
[ Upstream commit eb68ac0462bffc2ceb63b3a76737d6c9f186e6de ]
mxser doesn't increase port->icount.buf_overrun at all. Do so if overrun happens, so that it can be read from the stats.
--- drivers/tty/mxser.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/tty/mxser.c +5 -2
@@ -1536,7 +1536,8 @@ static bool mxser_receive_chars_new(struct tty_struct *tty,while (gdl--) {u8 ch =inb (port->ioaddr +UART_RX ); -tty_insert_flip_char (&port->port, ch,0 ); +if (!tty_insert_flip_char (&port->port, ch,0 )) + port->icount.buf_overrun++; }return true;
@@ -1582,8 +1583,10 @@ static u8 mxser_receive_chars_old(struct tty_struct *tty, port->icount.overrun++; } } -if (!tty_insert_flip_char (&port->port, ch, flag)) +if (!tty_insert_flip_char (&port->port, ch, flag)) { + port->icount.buf_overrun++;break ; + } }if (hwid)
Signature · 7 lines
2.34.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 92/217 usb: uhci: add aspeed ast2600 uhci support
In reply to Sasha LevinFrom: Neal Liu <[email protected]>
[ Upstream commit 554abfe2eadec97d12c71d4a69da1518478f69eb ]
Enable ast2600 uhci quirks.
--- drivers/usb/host/uhci-platform.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/host/uhci-platform.c +2 -1
@@ -113,7 +113,8 @@ static int uhci_hcd_platform_probe(struct platform_device *pdev) num_ports); }if (of_device_is_compatible (np,"aspeed,ast2400-uhci" ) || -of_device_is_compatible (np,"aspeed,ast2500-uhci" )) { +of_device_is_compatible (np,"aspeed,ast2500-uhci" ) || +of_device_is_compatible (np,"aspeed,ast2600-uhci" )) { uhci->is_aspeed =1 ;dev_info (&pdev->dev,"Enabled Aspeed implementation workarounds\n" );
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 63/217 mlxsw: pci: Add shutdown method in PCI driver
In reply to Sasha LevinFrom: Danielle Ratson <[email protected]>
[ Upstream commit c1020d3cf4752f61a6a413f632ea2ce2370e150d ]
On an arm64 platform with the Spectrum ASIC, after loading and executing a new kernel via kexec, the following trace [1] is observed. This seems to be caused by the fact that the device is not properly shutdown before executing the new kernel.
Fix this by implementing a shutdown method which mirrors the remove method, as recommended by the kexec maintainer [2][3].
[1]
BUG: Bad page state in process devlink pfn:22f73d page:fffffe00089dcf40 refcount:-1 mapcount:0 mapping:0000000000000000 index:0x0 flags: 0x2ffff00000000000() raw: 2ffff00000000000 0000000000000000 ffffffff089d0201 0000000000000000 raw: 0000000000000000 0000000000000000 ffffffffffffffff 0000000000000000 page dumped because: nonzero _refcount Modules linked in: CPU: 1 PID: 16346 Comm: devlink Tainted: G B 5.8.0-rc6-custom-273020-gac6b365b1bf5 #44 Hardware name: Marvell Armada 7040 TX4810M (DT) Call trace: dump_backtrace+0x0/0x1d0 show_stack+0x1c/0x28 dump_stack+0xbc/0x118 bad_page+0xcc/0xf8 check_free_page_bad+0x80/0x88 __free_pages_ok+0x3f8/0x418 __free_pages+0x38/0x60 kmem_freepages+0x200/0x2a8 slab_destroy+0x28/0x68 slabs_destroy+0x60/0x90 ___cache_free+0x1b4/0x358 kfree+0xc0/0x1d0 skb_free_head+0x2c/0x38 skb_release_data+0x110/0x1a0 skb_release_all+0x2c/0x38 consume_skb+0x38/0x130 __dev_kfree_skb_any+0x44/0x50 mlxsw_pci_rdq_fini+0x8c/0xb0 mlxsw_pci_queue_fini.isra.0+0x28/0x58 mlxsw_pci_queue_group_fini+0x58/0x88 mlxsw_pci_aqs_fini+0x2c/0x60 mlxsw_pci_fini+0x34/0x50 mlxsw_core_bus_device_unregister+0x104/0x1d0 mlxsw_devlink_core_bus_device_reload_down+0x2c/0x48 devlink_reload+0x44/0x158 devlink_nl_cmd_reload+0x270/0x290 genl_rcv_msg+0x188/0x2f0 netlink_rcv_skb+0x5c/0x118 genl_rcv+0x3c/0x50 netlink_unicast+0x1bc/0x278 netlink_sendmsg+0x194/0x390 __sys_sendto+0xe0/0x158 __arm64_sys_sendto+0x2c/0x38 el0_svc_common.constprop.0+0x70/0x168 do_el0_svc+0x28/0x88 el0_sync_handler+0x88/0x190 el0_sync+0x140/0x180
[2]
https://www.mail-archive.com/[email protected]/msg1195432.html
[3]
https://patchwork.kernel.org/project/linux-scsi/patch/[email protected]/#20116693
--- drivers/net/ethernet/mellanox/mlxsw/pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlxsw/pci.c +1 -0
@@ -1973,6 +1973,7 @@ int mlxsw_pci_driver_register(struct pci_driver *pci_driver) { pci_driver->probe = mlxsw_pci_probe; pci_driver->remove = mlxsw_pci_remove; + pci_driver->shutdown = mlxsw_pci_remove;return pci_register_driver (pci_driver); }EXPORT_SYMBOL (mlxsw_pci_driver_register);
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 94/217 x86/mm: Flush global TLB when switching to trampoline page-table
In reply to Sasha LevinFrom: Joerg Roedel <[email protected]>
[ Upstream commit 71d5049b053876afbde6c3273250b76935494ab2 ]
Move the switching code into a function so that it can be re-used and add a global TLB flush. This makes sure that usage of memory which is not mapped in the trampoline page-table is reliably caught.
Also move the clearing of CR4.PCIDE before the CR3 switch because the cr4_clear_bits() function will access data not mapped into the trampoline page-table.
--- arch/x86/include/asm/realmode.h | 1 + arch/x86/kernel/reboot.c | 12 ++---------- arch/x86/realmode/init.c | 26 ++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 10 deletions(-)
arch/x86/include/asm/realmode.h +1 -0
@@ -89,6 +89,7 @@ static inline void set_real_mode_mem(phys_addr_t mem) }void reserve_real_mode (void ); +void load_trampoline_pgtable (void );#endif /* __ASSEMBLY__ */
arch/x86/kernel/reboot.c +2 -10
@@ -113,17 +113,9 @@ void __noreturn machine_real_restart(unsigned int type)spin_unlock (&rtc_lock);/* -* Switch back to the initial page table. +* Switch to the trampoline page table. */ -#ifdef CONFIG_X86_32 -load_cr3 (initial_page_table); -#else -write_cr3 (real_mode_header->trampoline_pgd); - -/* Exiting long mode will fail if CR4.PCIDE is set. */ -if (boot_cpu_has (X86_FEATURE_PCID )) -cr4_clear_bits (X86_CR4_PCIDE ); -#endif +load_trampoline_pgtable ();/* Jump to the identity-mapped low memory code */ #ifdef CONFIG_X86_32
arch/x86/realmode/init.c +26 -0
@@ -17,6 +17,32 @@ u32 *trampoline_cr4_features;/* Hold the pgd entry used on booting additional CPUs */ pgd_t trampoline_pgd_entry; +void load_trampoline_pgtable (void ) +{ +#ifdef CONFIG_X86_32 +load_cr3 (initial_page_table); +#else +/* +* This function is called before exiting to real-mode and that will +* fail with CR4.PCIDE still set. +*/ +if (boot_cpu_has (X86_FEATURE_PCID )) +cr4_clear_bits (X86_CR4_PCIDE ); + +write_cr3 (real_mode_header->trampoline_pgd); +#endif + +/* +* The CR3 write above will not flush global TLB entries. +* Stale, global entries from previous page tables may still be +* present. Flush those stale entries. +* +* This ensures that memory accessed while running with +* trampoline_pgd is *actually* mapped into trampoline_pgd. +*/ +__flush_tlb_all (); +} +void __init reserve_real_mode (void ) {phys_addr_t mem;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 95/217 s390/nmi: add missing __pa/__va address conversion of extended save area
In reply to Sasha LevinFrom: Heiko Carstens <[email protected]>
[ Upstream commit 402ff5a3387dc8ec6987a80d3ce26b0c25773622 ]
Add missing __pa/__va address conversion of machine check extended save area designation, which is an absolute address.
Note: this currently doesn't fix a real bug, since virtual addresses are indentical to physical ones.
--- arch/s390/kernel/machine_kexec.c | 2 +- arch/s390/kernel/nmi.c | 10 +++++----- arch/s390/kernel/smp.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-)
arch/s390/kernel/machine_kexec.c +1 -1
@@ -86,7 +86,7 @@ static noinline void __machine_kdump(void *image)continue ; }/* Store status of the boot CPU */ - mcesa = (struct mcesa *)(S390_lowcore.mcesad &MCESA_ORIGIN_MASK ); + mcesa =__va (S390_lowcore.mcesad &MCESA_ORIGIN_MASK );if (MACHINE_HAS_VX )save_vx_regs ((__vector128 *) mcesa->vector_save_area);if (MACHINE_HAS_GS ) {
arch/s390/kernel/nmi.c +5 -5
@@ -68,7 +68,7 @@ void __init nmi_alloc_boot_cpu(struct lowcore *lc) {if (!nmi_needs_mcesa ())return ; - lc->mcesad = (unsigned long ) &boot_mcesa; + lc->mcesad =__pa (&boot_mcesa);if (MACHINE_HAS_GS ) lc->mcesad |=ilog2 (MCESA_MAX_SIZE ); }
@@ -94,7 +94,7 @@ static int __init nmi_init(void)__ctl_store (cr0,0 ,0 );__ctl_clear_bit (0 ,28 );/* disable lowcore protection */ /* Replace boot_mcesa on the boot CPU */ - S390_lowcore.mcesad = origin | mcesa_origin_lc; + S390_lowcore.mcesad =__pa (origin) | mcesa_origin_lc;__ctl_load (cr0,0 ,0 );return 0 ; }
@@ -111,7 +111,7 @@ int nmi_alloc_per_cpu(struct lowcore *lc)return -ENOMEM ;/* The pointer is stored with mcesa_bits ORed in */ kmemleak_not_leak ((void *) origin); - lc->mcesad = origin | mcesa_origin_lc; + lc->mcesad =__pa (origin) | mcesa_origin_lc;return 0 ; }
@@ -119,7 +119,7 @@ void nmi_free_per_cpu(struct lowcore *lc) {if (!nmi_needs_mcesa ())return ; -kmem_cache_free (mcesa_cache, (void *)(lc->mcesad &MCESA_ORIGIN_MASK )); +kmem_cache_free (mcesa_cache,__va (lc->mcesad &MCESA_ORIGIN_MASK )); } static notrace void s390_handle_damage(void)
@@ -246,7 +246,7 @@ static int notrace s390_validate_registers(union mci mci, int umode) : "Q" (S390_lowcore.fpt_creg_save_area)); } - mcesa = (struct mcesa *)(S390_lowcore.mcesad &MCESA_ORIGIN_MASK ); + mcesa =__va (S390_lowcore.mcesad &MCESA_ORIGIN_MASK );if (!MACHINE_HAS_VX ) {/* Validate floating point registers */ asm volatile(
arch/s390/kernel/smp.c +1 -1
@@ -622,7 +622,7 @@ int smp_store_status(int cpu)return -EIO ;if (!MACHINE_HAS_VX && !MACHINE_HAS_GS )return 0 ; - pa =__pa (lc->mcesad &MCESA_ORIGIN_MASK ); + pa = lc->mcesad &MCESA_ORIGIN_MASK ;if (MACHINE_HAS_GS ) pa |= lc->mcesad &MCESA_LC_MASK ; if (__pcpu_sigp_relax(pcpu->address, SIGP_STORE_ADDITIONAL_STATUS,
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 84/217 ACPI / x86: Drop PWM2 device on Lenovo Yoga Book from always present table
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit d431dfb764b145369be820fcdfd50f2159b9bbc2 ]
It turns out that there is a WMI object which controls the PWM2 device used for the keyboard backlight and that WMI object also provides some other useful functionality.
The upcoming lenovo-yogabook-wmi driver will offer both backlight control and the other functionality, so there no longer is a need to have the lpss-pwm driver binding to PWM2 for backlight control; and this is now actually undesirable because this will cause both the WMI code and the lpss-pwm driver to poke at the same PWM controller.
Drop the always-present quirk for the PWM2 ACPI-device, so that the
lpss-pwm controller will no longer bind to it.
--- drivers/acpi/x86/utils.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/acpi/x86/utils.c +0 -4
@@ -54,10 +54,6 @@ static const struct always_present_id always_present_ids[] = {ENTRY ("80860F09" ,"1" ,X86_MATCH (ATOM_SILVERMONT ), {}), ENTRY("80862288", "1", X86_MATCH(ATOM_AIRMONT), {}), -/* Lenovo Yoga Book uses PWM2 for keyboard backlight control */ -ENTRY ("80862289" ,"2" ,X86_MATCH (ATOM_AIRMONT ), { - DMI_MATCH(DMI_PRODUCT_NAME, "Lenovo YB1-X9"), - }),/* * The INT0002 device is necessary to clear wakeup interrupt sources * on Cherry Trail devices, without it we get nobody cared IRQ msgs.
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 140/217 drm/amd/amdgpu: fix psp tmr bo pin count leak in SRIOV
In reply to Sasha LevinFrom: Jingwen Chen <[email protected]>
[ Upstream commit 85dfc1d692c9434c37842e610be37cd4ae4e0081 ]
[Why]
psp tmr bo will be pinned during loading amdgpu and reset in SRIOV while only unpinned in unload amdgpu
[How]
add amdgpu_in_reset and sriov judgement to skip pin bo
v2: fix wrong judgement
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +4 -0
@@ -2017,12 +2017,16 @@ static int psp_hw_start(struct psp_context *psp)return ret; } +if (amdgpu_sriov_vf (adev) &&amdgpu_in_reset (adev)) + goto skip_pin_bo; + ret =psp_tmr_init (psp);if (ret) {DRM_ERROR ("PSP tmr init failed!\n" );return ret; } +skip_pin_bo:/* * For ASICs with DF Cstate management centralized * to PMFW, TMR setup should be performed after PMFW
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 105/217 iwlwifi: mvm: avoid clearing a just saved session protection id
In reply to Sasha LevinFrom: Shaul Triebitz <[email protected]>
[ Upstream commit 8e967c137df3b236d2075f9538cb888129425d1a ]
When scheduling a session protection the id is saved but then it may be cleared when calling iwl_mvm_te_clear_data (if a previous session protection is currently active). Fix it by saving the id after calling iwl_mvm_te_clear_data.
--- drivers/net/wireless/intel/iwlwifi/mvm/time-event.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/time-event.c +6 -6
@@ -1158,15 +1158,10 @@ void iwl_mvm_schedule_session_protection(struct iwl_mvm *mvm,cpu_to_le32 (FW_CMD_ID_AND_COLOR (mvmvif->id, mvmvif->color)), .action = cpu_to_le32(FW_CTXT_ACTION_ADD), + .conf_id = cpu_to_le32(SESSION_PROTECT_CONF_ASSOC), .duration_tu =cpu_to_le32 (MSEC_TO_TU (duration)), }; -/* The time_event_data.id field is reused to save session -* protection's configuration. -*/ - mvmvif->time_event_data.id =SESSION_PROTECT_CONF_ASSOC ; - cmd.conf_id =cpu_to_le32 (mvmvif->time_event_data.id); -lockdep_assert_held (&mvm->mutex);spin_lock_bh (&mvm->time_event_lock);
@@ -1180,6 +1175,11 @@ void iwl_mvm_schedule_session_protection(struct iwl_mvm *mvm, }iwl_mvm_te_clear_data (mvm, te_data); +/* +* The time_event_data.id field is reused to save session +* protection's configuration. +*/ + te_data->id =le32_to_cpu (cmd.conf_id); te_data->duration =le32_to_cpu (cmd.duration_tu); te_data->vif = vif;spin_unlock_bh (&mvm->time_event_lock);
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 141/217 drm/amd/amdgpu: fix gmc bo pin count leak in SRIOV
In reply to Sasha LevinFrom: Jingwen Chen <[email protected]>
[ Upstream commit 948e7ce01413b71395723aaf846015062aea3a43 ]
[Why]
gmc bo will be pinned during loading amdgpu and reset in SRIOV while only unpinned in unload amdgpu
[How]
add amdgpu_in_reset and sriov judgement to skip pin bo
v2: fix wrong judgement
--- drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 4 ++++ 2 files changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +4 -0
@@ -992,10 +992,14 @@ static int gmc_v10_0_gart_enable(struct amdgpu_device *adev)return -EINVAL ; } +if (amdgpu_sriov_vf (adev) &&amdgpu_in_reset (adev)) + goto skip_pin_bo; + r =amdgpu_gart_table_vram_pin (adev);if (r)return r; +skip_pin_bo: r = adev->gfxhub.funcs->gart_enable (adev);if (r)return r;
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +4 -0
@@ -1714,10 +1714,14 @@ static int gmc_v9_0_gart_enable(struct amdgpu_device *adev)return -EINVAL ; } +if (amdgpu_sriov_vf (adev) &&amdgpu_in_reset (adev)) + goto skip_pin_bo; + r =amdgpu_gart_table_vram_pin (adev);if (r)return r; +skip_pin_bo: r = adev->gfxhub.funcs->gart_enable (adev);if (r)return r;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 104/217 iwlwifi: mvm: synchronize with FW after multicast commands
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit db66abeea3aefed481391ecc564fb7b7fb31d742 ]
If userspace installs a lot of multicast groups very quickly, then we may run out of command queue space as we send the updates in an asynchronous fashion (due to locking concerns), and the CPU can create them faster than the firmware can process them. This is true even when mac80211 has a work struct that gets scheduled.
Fix this by synchronizing with the firmware after sending all those commands - outside of the iteration we can send a synchronous echo command that just has the effect of the CPU waiting for the prior asynchronous commands to finish. This also will cause fewer of the commands to be sent to the firmware overall, because the work will only run once when rescheduled multiple times while it's running.
--- .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +17 -0
@@ -1688,6 +1688,7 @@ static void iwl_mvm_recalc_multicast(struct iwl_mvm *mvm)struct iwl_mvm_mc_iter_data iter_data = { .mvm = mvm, }; +int ret;lockdep_assert_held (&mvm->mutex);
@@ -1697,6 +1698,22 @@ static void iwl_mvm_recalc_multicast(struct iwl_mvm *mvm)ieee80211_iterate_active_interfaces_atomic ( mvm->hw,IEEE80211_IFACE_ITER_NORMAL , iwl_mvm_mc_iface_iterator, &iter_data); + +/* +* Send a (synchronous) ech command so that we wait for the +* multiple asynchronous MCAST_FILTER_CMD commands sent by +* the interface iterator. Otherwise, we might get here over +* and over again (by userspace just sending a lot of these) +* and the CPU can send them faster than the firmware can +* process them. +* Note that the CPU is still faster - but with this we'll +* actually send fewer commands overall because the CPU will +* not schedule the work in mac80211 as frequently if it's +* still running when rescheduled (possibly multiple times). +*/ + ret =iwl_mvm_send_cmd_pdu (mvm,ECHO_CMD ,0 ,0 ,NULL ); +if (ret) +IWL_ERR (mvm,"Failed to synchronize multicast groups update\n" ); } static u64 iwl_mvm_prepare_multicast(struct ieee80211_hw *hw,
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 87/217 ACPI / x86: Add not-present quirk for the PCI0.SDHB.BRC1 device on the GPD win
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 57d2dbf710d832841872fb15ebb79429cab90fae ]
The GPD win and its sibling the GPD pocket (99% the same electronics in a different case) use a PCI wifi card. But the ACPI tables on both variants contain a bug where the SDIO MMC controller for SDIO wifi cards is enabled despite this. This SDIO MMC controller has a PCI0.SDHB.BRC1 child-device which _PS3 method sets a GPIO causing the PCI wifi card to turn off.
At the moment there is a pretty ugly kludge in the sdhci-acpi.c code, just to work around the bug in the DSDT of this single design. This can be solved cleaner/simply with a quirk overriding the _STA return of the broken PCI0.SDHB.BRC1 PCI0.SDHB.BRC1 child with a status value of 0, so that its power_manageable flag gets cleared, avoiding this problem.
Note that even though it is not used, the _STA method for the MMC controller is deliberately not overridden. If the status of the MMC controller were forced to 0 it would never get suspended, which would cause these mini-laptops to not reach S0i3 level when suspended.
--- drivers/acpi/x86/utils.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/acpi/x86/utils.c +17 -3
@@ -94,9 +94,10 @@ static const struct override_status_id override_status_ids[] = {/* * The GPD win BIOS dated 20170221 has disabled the accelerometer, the * drivers sometimes cause crashes under Windows and this is how the -* manufacturer has solved this :| Note that the the DMI data is less -* generic then it seems, a board_vendor of "AMI Corporation" is quite -* rare and a board_name of "Default String" also is rare. +* manufacturer has solved this :| The DMI match may not seem unique, +* but it is. In the 67000+ DMI decode dumps from linux-hardware.org +* only 116 have board_vendor set to "AMI Corporation" and of those 116 +* only the GPD win and pocket entries' board_name is "Default string". * * Unfortunately the GPD pocket also uses these strings and its BIOS * was copy-pasted from the GPD win, so it has a disabled KIOX000A
@@ -120,6 +121,19 @@ static const struct override_status_id override_status_ids[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Default string"), DMI_MATCH(DMI_BIOS_DATE, "05/25/2017") }), + +/* +* The GPD win/pocket have a PCI wifi card, but its DSDT has the SDIO +* mmc controller enabled and that has a child-device which _PS3 +* method sets a GPIO causing the PCI wifi card to turn off. +* See above remark about uniqueness of the DMI match. +*/ + NOT_PRESENT_ENTRY_PATH("\\_SB_.PCI0.SDHB.BRC1", ATOM_AIRMONT, { + DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), + DMI_EXACT_MATCH(DMI_BOARD_NAME, "Default string"), + DMI_EXACT_MATCH(DMI_BOARD_SERIAL, "Default string"), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Default string"), + }), }; bool acpi_device_override_status(struct acpi_device *adev, unsigned long long *status)
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 144/217 drm/tegra: dc: rgb: Allow changing PLLD rate on Tegra30+
In reply to Sasha LevinFrom: Dmitry Osipenko <[email protected]>
[ Upstream commit 0c921b6d4ba06bc899fd84d3ce1c1afd3d00bc1c ]
Asus Transformer TF700T is a Tegra30 tablet device which uses RGB->DSI bridge that requires a precise clock rate in order to operate properly. Tegra30 has a dedicated PLL for each display controller, hence the PLL rate can be changed freely. Allow PLL rate changes on Tegra30+ for RGB output. Configure the clock rate before display controller is enabled since DC itself may be running off this PLL and it's not okay to change the rate of the active PLL that doesn't support dynamic frequency switching since hardware will hang.
--- drivers/gpu/drm/tegra/dc.c | 27 ++++++++++++-------- drivers/gpu/drm/tegra/dc.h | 1 + drivers/gpu/drm/tegra/rgb.c | 49 +++++++++++++++++++++++++++++++++++-- 3 files changed, 65 insertions(+), 12 deletions(-)
drivers/gpu/drm/tegra/dc.c +17 -10
@@ -1762,10 +1762,9 @@ int tegra_dc_state_setup_clock(struct tegra_dc *dc,return 0 ; } -static void tegra_dc_commit_state (struct tegra_dc *dc, -struct tegra_dc_state *state) +static void tegra_dc_set_clock_rate (struct tegra_dc *dc, +struct tegra_dc_state *state) { -u32 value;int err; err =clk_set_parent (dc->clk, state->clk);
@@ -1796,11 +1795,6 @@ static void tegra_dc_commit_state(struct tegra_dc *dc,DRM_DEBUG_KMS ("rate: %lu, div: %u\n" ,clk_get_rate (dc->clk), state->div);DRM_DEBUG_KMS ("pclk: %lu\n" , state->pclk); - -if (!dc->soc->has_nvdisplay) { - value =SHIFT_CLK_DIVIDER (state->div) |PIXEL_CLK_DIVIDER_PCD1 ; -tegra_dc_writel (dc, value,DC_DISP_DISP_CLOCK_CONTROL ); - } }static void tegra_dc_stop (struct tegra_dc *dc)
@@ -2002,6 +1996,9 @@ static void tegra_crtc_atomic_enable(struct drm_crtc *crtc,u32 value;int err; +/* apply PLL changes */ +tegra_dc_set_clock_rate (dc, crtc_state); + err =host1x_client_resume (&dc->client);if (err <0 ) {dev_err (dc->dev,"failed to resume: %d\n" , err);
@@ -2076,8 +2073,11 @@ static void tegra_crtc_atomic_enable(struct drm_crtc *crtc,else tegra_dc_writel (dc,0 ,DC_DISP_BORDER_COLOR ); -/* apply PLL and pixel clock changes */ -tegra_dc_commit_state (dc, crtc_state); +/* apply pixel clock changes */ +if (!dc->soc->has_nvdisplay) { + value =SHIFT_CLK_DIVIDER (crtc_state->div) |PIXEL_CLK_DIVIDER_PCD1 ; +tegra_dc_writel (dc, value,DC_DISP_DISP_CLOCK_CONTROL ); + }/* program display mode */ tegra_dc_set_timings (dc, mode);
@@ -2685,6 +2685,7 @@ static const struct tegra_dc_soc_info tegra20_dc_soc_info = { .has_win_b_vfilter_mem_client = true, .has_win_c_without_vert_filter = true, .plane_tiled_memory_bandwidth_x2 = false, + .has_pll_d2_out0 = false, };static const struct tegra_dc_soc_info tegra30_dc_soc_info = {
@@ -2707,6 +2708,7 @@ static const struct tegra_dc_soc_info tegra30_dc_soc_info = { .has_win_b_vfilter_mem_client = true, .has_win_c_without_vert_filter = false, .plane_tiled_memory_bandwidth_x2 = true, + .has_pll_d2_out0 = true, };static const struct tegra_dc_soc_info tegra114_dc_soc_info = {
@@ -2729,6 +2731,7 @@ static const struct tegra_dc_soc_info tegra114_dc_soc_info = { .has_win_b_vfilter_mem_client = false, .has_win_c_without_vert_filter = false, .plane_tiled_memory_bandwidth_x2 = true, + .has_pll_d2_out0 = true, };static const struct tegra_dc_soc_info tegra124_dc_soc_info = {
@@ -2751,6 +2754,7 @@ static const struct tegra_dc_soc_info tegra124_dc_soc_info = { .has_win_b_vfilter_mem_client = false, .has_win_c_without_vert_filter = false, .plane_tiled_memory_bandwidth_x2 = false, + .has_pll_d2_out0 = true, };static const struct tegra_dc_soc_info tegra210_dc_soc_info = {
@@ -2773,6 +2777,7 @@ static const struct tegra_dc_soc_info tegra210_dc_soc_info = { .has_win_b_vfilter_mem_client = false, .has_win_c_without_vert_filter = false, .plane_tiled_memory_bandwidth_x2 = false, + .has_pll_d2_out0 = true, };static const struct tegra_windowgroup_soc tegra186_dc_wgrps[] = {
@@ -2823,6 +2828,7 @@ static const struct tegra_dc_soc_info tegra186_dc_soc_info = { .wgrps = tegra186_dc_wgrps, .num_wgrps = ARRAY_SIZE(tegra186_dc_wgrps), .plane_tiled_memory_bandwidth_x2 = false, + .has_pll_d2_out0 = false, };static const struct tegra_windowgroup_soc tegra194_dc_wgrps[] = {
@@ -2873,6 +2879,7 @@ static const struct tegra_dc_soc_info tegra194_dc_soc_info = { .wgrps = tegra194_dc_wgrps, .num_wgrps = ARRAY_SIZE(tegra194_dc_wgrps), .plane_tiled_memory_bandwidth_x2 = false, + .has_pll_d2_out0 = false, };static const struct of_device_id tegra_dc_of_match[] = {
drivers/gpu/drm/tegra/dc.h +1 -0
@@ -76,6 +76,7 @@ struct tegra_dc_soc_info {bool has_win_b_vfilter_mem_client;bool has_win_c_without_vert_filter;bool plane_tiled_memory_bandwidth_x2; +bool has_pll_d2_out0; };struct tegra_dc {
drivers/gpu/drm/tegra/rgb.c +47 -2
82 lines not on this page · raw message
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 101/217 media: m920x: don't use stack on USB reads
In reply to Sasha LevinFrom: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit a2ab06d7c4d6bfd0b545a768247a70463e977e27 ]
Using stack-allocated pointers for USB message data don't work. This driver is almost OK with that, except for the I2C read logic.
Fix it by using a temporary read buffer, just like on all other calls to m920x_read().
--- drivers/media/usb/dvb-usb/m920x.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/media/usb/dvb-usb/m920x.c +11 -1
@@ -274,6 +274,13 @@ static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int nu/* Should check for ack here, if we knew how. */ }if (msg[i].flags &I2C_M_RD ) { +char *read =kmalloc (1 ,GFP_KERNEL ); +if (!read) { + ret = -ENOMEM ; +kfree (read); + goto unlock; + } +for (j =0 ; j < msg[i].len; j++) {/* Last byte of transaction? * Send STOP, otherwise send ACK. */
@@ -281,9 +288,12 @@ static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int nuif ((ret =m920x_read (d->udev,M9206_I2C ,0x0 ,0x20 | stop, - &msg[i].buf[j],1 )) !=0 ) + read,1 )) !=0 ) goto unlock; + msg[i].buf[j] = read[0 ]; } + +kfree (read); }else {for (j =0 ; j < msg[i].len; j++) {/* Last byte of transaction? Then send STOP. */
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 106/217 iwlwifi: acpi: fix wgds rev 3 size
In reply to Sasha LevinFrom: Miri Korenblit <[email protected]>
[ Upstream commit dc276ffd0754e94080565c10b964f3c211879fdd ]
The exact size of WGDS revision 3 was calculated using the wrong parameters. Fix it.
--- drivers/net/wireless/intel/iwlwifi/fw/acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/fw/acpi.c +1 -1
@@ -789,7 +789,7 @@ int iwl_sar_get_wgds_table(struct iwl_fw_runtime *fwrt)* looking up in ACPI */ if (wifi_pkg->package.count != - min_size + profile_size * num_profiles) { + hdr_size + profile_size * num_profiles) { ret = -EINVAL ; goto out_free; }
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 91/217 arm64: dts: ti: j721e-main: Fix 'dtbs_check' in serdes_ln_ctrl node
In reply to Sasha LevinFrom: Kishon Vijay Abraham I <[email protected]>
[ Upstream commit 3f92a5be6084b77f764a8bbb881ac0d12cb9e863 ]
Fix 'dtbs_check' in serdes_ln_ctrl (mux@4080) node by changing the node name to mux-controller@4080.
--- arch/arm64/boot/dts/ti/k3-j721e-main.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/ti/k3-j721e-main.dtsi +1 -1
@@ -42,7 +42,7 @@ scm_conf: scm-conf@100000 { #size-cells = <1>; ranges = <0x0 0x0 0x00100000 0x1c000>; - serdes_ln_ctrl: mux@4080 { + serdes_ln_ctrl: mux-controller@4080 { compatible = "mmio-mux"; reg = <0x00004080 0x50>; #mux-control-cells = <1>;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 93/217 floppy: Add max size check for user space request
In reply to Sasha LevinFrom: Xiongwei Song <[email protected]>
[ Upstream commit 545a32498c536ee152331cd2e7d2416aa0f20e01 ]
We need to check the max request size that is from user space before allocating pages. If the request size exceeds the limit, return -EINVAL. This check can avoid the warning below from page allocator.
WARNING: CPU: 3 PID: 16525 at mm/page_alloc.c:5344 current_gfp_context include/linux/sched/mm.h:195 [inline] WARNING: CPU: 3 PID: 16525 at mm/page_alloc.c:5344 __alloc_pages+0x45d/0x500 mm/page_alloc.c:5356 Modules linked in: CPU: 3 PID: 16525 Comm: syz-executor.3 Not tainted 5.15.0-syzkaller #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 RIP: 0010:__alloc_pages+0x45d/0x500 mm/page_alloc.c:5344 Code: be c9 00 00 00 48 c7 c7 20 4a 97 89 c6 05 62 32 a7 0b 01 e8 74 9a 42 07 e9 6a ff ff ff 0f 0b e9 a0 fd ff ff 40 80 e5 3f eb 88 <0f> 0b e9 18 ff ff ff 4c 89 ef 44 89 e6 45 31 ed e8 1e 76 ff ff e9 RSP: 0018:ffffc90023b87850 EFLAGS: 00010246 RAX: 0000000000000000 RBX: 1ffff92004770f0b RCX: dffffc0000000000 RDX: 0000000000000000 RSI: 0000000000000033 RDI: 0000000000010cc1 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000001 R10: ffffffff81bb4686 R11: 0000000000000001 R12: ffffffff902c1960 R13: 0000000000000033 R14: 0000000000000000 R15: ffff88804cf64a30 FS: 0000000000000000(0000) GS:ffff88802cd00000(0063) knlGS:00000000f44b4b40 CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033 CR2: 000000002c921000 CR3: 000000004f507000 CR4: 0000000000150ee0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> alloc_pages+0x1a7/0x300 mm/mempolicy.c:2191 __get_free_pages+0x8/0x40 mm/page_alloc.c:5418 raw_cmd_copyin drivers/block/floppy.c:3113 [inline] raw_cmd_ioctl drivers/block/floppy.c:3160 [inline] fd_locked_ioctl+0x12e5/0x2820 drivers/block/floppy.c:3528 fd_ioctl drivers/block/floppy.c:3555 [inline] fd_compat_ioctl+0x891/0x1b60 drivers/block/floppy.c:3869 compat_blkdev_ioctl+0x3b8/0x810 block/ioctl.c:662 __do_compat_sys_ioctl+0x1c7/0x290 fs/ioctl.c:972 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c
--- drivers/block/floppy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/block/floppy.c +3 -1
@@ -3081,6 +3081,8 @@ static void raw_cmd_free(struct floppy_raw_cmd **ptr) } } +#define MAX_LEN (1UL << MAX_ORDER << PAGE_SHIFT) +static int raw_cmd_copyin (int cmd,void __user *param,struct floppy_raw_cmd **rcmd) {
@@ -3108,7 +3110,7 @@ static int raw_cmd_copyin(int cmd, void __user *param, ptr->resultcode =0 ;if (ptr->flags & (FD_RAW_READ |FD_RAW_WRITE )) { -if (ptr->length <=0 ) +if (ptr->length <=0 || ptr->length >=MAX_LEN )return -EINVAL ; ptr->kernel_data = (char *)fd_dma_mem_alloc (ptr->length);fallback_on_nodma_alloc (&ptr->kernel_data, ptr->length);
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 112/217 net-sysfs: update the queue counts in the unregistration path
In reply to Sasha LevinFrom: Antoine Tenart <[email protected]>
[ Upstream commit d7dac083414eb5bb99a6d2ed53dc2c1b405224e5 ]
When updating Rx and Tx queue kobjects, the queue count should always be updated to match the queue kobjects count. This was not done in the net device unregistration path, fix it. Tracking all queue count updates will allow in a following up patch to detect illegal updates.
--- net/core/net-sysfs.c | 3 +++ 1 file changed, 3 insertions(+)
net/core/net-sysfs.c +3 -0
@@ -1820,6 +1820,9 @@ static void remove_queue_kobjects(struct net_device *dev)net_rx_queue_update_kobjects (dev, real_rx,0 );netdev_queue_update_kobjects (dev, real_tx,0 ); + + dev->real_num_rx_queues =0 ; + dev->real_num_tx_queues =0 ;#ifdef CONFIG_SYSFS kset_unregister (dev->queues_kset);#endif
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 90/217 arm64: dts: ti: j7200-main: Fix 'dtbs_check' serdes_ln_ctrl node
In reply to Sasha LevinFrom: Kishon Vijay Abraham I <[email protected]>
[ Upstream commit 4d3984906397581dc0ccb6a02bf16b6ff82c9192 ]
Fix 'dtbs_check' in serdes_ln_ctrl (serdes-ln-ctrl@4080) node by changing the node name to mux-controller@4080.
--- arch/arm64/boot/dts/ti/k3-j7200-main.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/ti/k3-j7200-main.dtsi +1 -1
@@ -32,7 +32,7 @@ scm_conf: scm-conf@100000 { #size-cells = <1>; ranges = <0x00 0x00 0x00100000 0x1c000>; - serdes_ln_ctrl: serdes-ln-ctrl@4080 { + serdes_ln_ctrl: mux-controller@4080 { compatible = "mmio-mux"; #mux-control-cells = <1>; mux-reg-masks = <0x4080 0x3>, <0x4084 0x3>, /* SERDES0 lane0/1 select */
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 118/217 net: Enable neighbor sysctls that is save for userns root
In reply to Sasha LevinFrom: xu xin <[email protected]>
[ Upstream commit 8c8b7aa7fb0cf9e1cc9204e6bc6e1353b8393502 ]
Inside netns owned by non-init userns, sysctls about ARP/neighbor is currently not visible and configurable.
For the attributes these sysctls correspond to, any modifications make effects on the performance of networking(ARP, especilly) only in the scope of netns, which does not affect other netns.
Actually, some tools via netlink can modify these attribute. iproute2 is an example. see as follows:
$ unshare -ur -n
$ cat /proc/sys/net/ipv4/neigh/lo/retrans_time
cat: can't open '/proc/sys/net/ipv4/neigh/lo/retrans_time': No such file
or directory
$ ip ntable show dev lo
inet arp_cache
dev lo
refcnt 1 reachable 19494 base_reachable 30000 retrans 1000
gc_stale 60000 delay_probe 5000 queue 101
app_probes 0 ucast_probes 3 mcast_probes 3
anycast_delay 1000 proxy_delay 800 proxy_queue 64 locktime 1000inet6 ndisc_cache
dev lo
refcnt 1 reachable 42394 base_reachable 30000 retrans 1000 gc_stale 60000 delay_probe 5000 queue 101 app_probes 0 ucast_probes 3 mcast_probes 3 anycast_delay 1000 proxy_delay 800 proxy_queue 64 locktime 0
$ ip ntable change name arp_cache dev <if> retrans 2000
inet arp_cache
dev lo
refcnt 1 reachable 22917 base_reachable 30000 retrans 2000
gc_stale 60000 delay_probe 5000 queue 101
app_probes 0 ucast_probes 3 mcast_probes 3
anycast_delay 1000 proxy_delay 800 proxy_queue 64 locktime 1000inet6 ndisc_cache
dev lo
refcnt 1 reachable 35524 base_reachable 30000 retrans 1000 gc_stale 60000 delay_probe 5000 queue 101 app_probes 0 ucast_probes 3 mcast_probes 3 anycast_delay 1000 proxy_delay 800 proxy_queue 64 locktime 0
--- net/core/neighbour.c | 4 ---- 1 file changed, 4 deletions(-)
net/core/neighbour.c +0 -4
@@ -3770,10 +3770,6 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p, neigh_proc_base_reachable_time; } -/* Don't export sysctls to unprivileged users */ -if (neigh_parms_net (p)->user_ns != &init_user_ns) - t->neigh_vars[0 ].procname =NULL ; -switch (neigh_parms_family (p)) {case AF_INET : p_name ="ipv4" ;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 119/217 arm64: dts: rockchip: Fix Bluetooth on ROCK Pi 4 boards
In reply to Sasha LevinFrom: Jagan Teki <[email protected]>
[ Upstream commit f471b1b2db0819917c54099ab68349ad6a7e9e19 ]
This patch fixes the Bluetooth on ROCK Pi 4 boards.
ROCK Pi 4 boards has BCM4345C5 and now it is supported on Mainline Linux, brcm,bcm43438-bt still working but observed the BT Audio issues with latest test.
So, use the BCM4345C5 compatible and its associated properties like clock-names as lpo and max-speed.
Attach vbat and vddio supply rails as well.
--- arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4b-plus.dts | 7 +++++-- arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4b.dts | 7 +++++-- arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4c.dts | 7 +++++-- 3 files changed, 15 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4b-plus.dts +5 -2
@@ -35,13 +35,16 @@ &uart0 { status = "okay"; bluetooth { - compatible = "brcm,bcm43438-bt"; + compatible = "brcm,bcm4345c5"; clocks = <&rk808 1>; - clock-names = "ext_clock"; + clock-names = "lpo"; device-wakeup-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>; host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>; + max-speed = <1500000>; pinctrl-names = "default"; pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>; + vbat-supply = <&vcc3v3_sys>; + vddio-supply = <&vcc_1v8>; }; };
arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4b.dts +5 -2
@@ -34,13 +34,16 @@ &uart0 { status = "okay"; bluetooth { - compatible = "brcm,bcm43438-bt"; + compatible = "brcm,bcm4345c5"; clocks = <&rk808 1>; - clock-names = "ext_clock"; + clock-names = "lpo"; device-wakeup-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>; host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>; + max-speed = <1500000>; pinctrl-names = "default"; pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>; + vbat-supply = <&vcc3v3_sys>; + vddio-supply = <&vcc_1v8>; }; };
arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4c.dts +5 -2
@@ -35,14 +35,17 @@ &uart0 { status = "okay"; bluetooth { - compatible = "brcm,bcm43438-bt"; + compatible = "brcm,bcm4345c5"; clocks = <&rk808 1>; - clock-names = "ext_clock"; + clock-names = "lpo"; device-wakeup-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>; host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>; + max-speed = <1500000>; pinctrl-names = "default"; pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>; + vbat-supply = <&vcc3v3_sys>; + vddio-supply = <&vcc_1v8>; }; };
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 120/217 ath11k: Avoid false DEADLOCK warning reported by lockdep
In reply to Sasha LevinFrom: Baochen Qiang <[email protected]>
[ Upstream commit 767c94caf0efad136157110787fe221b74cb5c8a ]
With CONFIG_LOCKDEP=y and CONFIG_DEBUG_SPINLOCK=y, lockdep reports below warning:
[ 166.059415] ============================================
[ 166.059416] WARNING: possible recursive locking detected
[ 166.059418] 5.15.0-wt-ath+ #10 Tainted: G W O
[ 166.059420] --------------------------------------------
[ 166.059421] kworker/0:2/116 is trying to acquire lock:
[ 166.059423] ffff9905f2083160 (&srng->lock){+.-.}-{2:2}, at: ath11k_hal_reo_cmd_send+0x20/0x490 [ath11k]
[ 166.059440]
but task is already holding lock:
[ 166.059442] ffff9905f2083230 (&srng->lock){+.-.}-{2:2}, at: ath11k_dp_process_reo_status+0x95/0x2d0 [ath11k]
[ 166.059491]
other info that might help us debug this:
[ 166.059492] Possible unsafe locking scenario:[ 166.059493] CPU0
[ 166.059494] ----
[ 166.059495] lock(&srng->lock);
[ 166.059498] lock(&srng->lock);
[ 166.059500]
*** DEADLOCK ***[ 166.059501] May be due to missing lock nesting notation
[ 166.059502] 3 locks held by kworker/0:2/116:
[ 166.059504] #0: ffff9905c0081548 ((wq_completion)events){+.+.}-{0:0}, at: process_one_work+0x1f6/0x660
[ 166.059511] #1: ffff9d2400a5fe68 ((debug_obj_work).work){+.+.}-{0:0}, at: process_one_work+0x1f6/0x660
[ 166.059517] #2: ffff9905f2083230 (&srng->lock){+.-.}-{2:2}, at: ath11k_dp_process_reo_status+0x95/0x2d0 [ath11k]
[ 166.059532]
stack backtrace:
[ 166.059534] CPU: 0 PID: 116 Comm: kworker/0:2 Kdump: loaded Tainted: G W O 5.15.0-wt-ath+ #10
[ 166.059537] Hardware name: Intel(R) Client Systems NUC8i7HVK/NUC8i7HVB, BIOS HNKBLi70.86A.0059.2019.1112.1124 11/12/2019
[ 166.059539] Workqueue: events free_obj_work
[ 166.059543] Call Trace:
[ 166.059545] <IRQ>
[ 166.059547] dump_stack_lvl+0x56/0x7b
[ 166.059552] __lock_acquire+0xb9a/0x1a50
[ 166.059556] lock_acquire+0x1e2/0x330
[ 166.059560] ? ath11k_hal_reo_cmd_send+0x20/0x490 [ath11k]
[ 166.059571] _raw_spin_lock_bh+0x33/0x70
[ 166.059574] ? ath11k_hal_reo_cmd_send+0x20/0x490 [ath11k]
[ 166.059584] ath11k_hal_reo_cmd_send+0x20/0x490 [ath11k]
[ 166.059594] ath11k_dp_tx_send_reo_cmd+0x3f/0x130 [ath11k]
[ 166.059605] ath11k_dp_rx_tid_del_func+0x221/0x370 [ath11k]
[ 166.059618] ath11k_dp_process_reo_status+0x22f/0x2d0 [ath11k]
[ 166.059632] ? ath11k_dp_service_srng+0x2ea/0x2f0 [ath11k]
[ 166.059643] ath11k_dp_service_srng+0x2ea/0x2f0 [ath11k]
[ 166.059655] ath11k_pci_ext_grp_napi_poll+0x1c/0x70 [ath11k_pci]
[ 166.059659] __napi_poll+0x28/0x230
[ 166.059664] net_rx_action+0x285/0x310
[ 166.059668] __do_softirq+0xe6/0x4d2
[ 166.059672] irq_exit_rcu+0xd2/0xf0
[ 166.059675] common_interrupt+0xa5/0xc0
[ 166.059678] </IRQ>
[ 166.059679] <TASK>
[ 166.059680] asm_common_interrupt+0x1e/0x40
[ 166.059683] RIP: 0010:_raw_spin_unlock_irqrestore+0x38/0x70
[ 166.059686] Code: 83 c7 18 e8 2a 95 43 ff 48 89 ef e8 22 d2 43 ff 81 e3 00 02 00 00 75 25 9c 58 f6 c4 02 75 2d 48 85 db 74 01 fb bf 01 00 00 00 <e8> 63 2e 40 ff 65 8b 05 8c 59 97 5c 85 c0 74 0a 5b 5d c3 e8 00 6a
[ 166.059689] RSP: 0018:ffff9d2400a5fca0 EFLAGS: 00000206
[ 166.059692] RAX: 0000000000000002 RBX: 0000000000000200 RCX: 0000000000000006
[ 166.059694] RDX: 0000000000000000 RSI: ffffffffa404879b RDI: 0000000000000001
[ 166.059696] RBP: ffff9905c0053000 R08: 0000000000000001 R09: 0000000000000001
[ 166.059698] R10: ffff9d2400a5fc50 R11: 0000000000000001 R12: ffffe186c41e2840
[ 166.059700] R13: 0000000000000001 R14: ffff9905c78a1c68 R15: 0000000000000001
[ 166.059704] free_debug_processing+0x257/0x3d0
[ 166.059708] ? free_obj_work+0x1f5/0x250
[ 166.059712] __slab_free+0x374/0x5a0
[ 166.059718] ? kmem_cache_free+0x2e1/0x370
[ 166.059721] ? free_obj_work+0x1f5/0x250
[ 166.059724] kmem_cache_free+0x2e1/0x370
[ 166.059727] free_obj_work+0x1f5/0x250
[ 166.059731] process_one_work+0x28b/0x660
[ 166.059735] ? process_one_work+0x660/0x660
[ 166.059738] worker_thread+0x37/0x390
[ 166.059741] ? process_one_work+0x660/0x660
[ 166.059743] kthread+0x176/0x1a0
[ 166.059746] ? set_kthread_struct+0x40/0x40
[ 166.059749] ret_from_fork+0x22/0x30
[ 166.059754] </TASK>Since these two lockes are both initialized in ath11k_hal_srng_setup, they are assigned with the same key. As a result lockdep suspects that the task is trying to acquire the same lock (due to same key) while already holding it, and thus reports the DEADLOCK warning. However as they are different spinlock instances, the warning is false positive.
On the other hand, even no dead lock indeed, this is a major issue for upstream regression testing as it disables lockdep functionality.
Fix it by assigning separate lock class key for each srng->lock.
Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1
--- drivers/net/wireless/ath/ath11k/hal.c | 22 ++++++++++++++++++++++ drivers/net/wireless/ath/ath11k/hal.h | 2 ++ 2 files changed, 24 insertions(+)
drivers/net/wireless/ath/ath11k/hal.c +22 -0
@@ -947,6 +947,7 @@ int ath11k_hal_srng_setup(struct ath11k_base *ab, enum hal_ring_type type, srng->msi_data = params->msi_data; srng->initialized =1 ;spin_lock_init (&srng->lock); +lockdep_set_class (&srng->lock, hal->srng_key + ring_id);for (i =0 ; i <HAL_SRNG_NUM_REG_GRP ; i++) { srng->hwreg_base[i] = srng_config->reg_start[i] +
@@ -1233,6 +1234,24 @@ static int ath11k_hal_srng_create_config(struct ath11k_base *ab)return 0 ; } +static void ath11k_hal_register_srng_key (struct ath11k_base *ab) +{ +struct ath11k_hal *hal = &ab->hal; +u32 ring_id; + +for (ring_id =0 ; ring_id <HAL_SRNG_RING_ID_MAX ; ring_id++) +lockdep_register_key (hal->srng_key + ring_id); +} + +static void ath11k_hal_unregister_srng_key (struct ath11k_base *ab) +{ +struct ath11k_hal *hal = &ab->hal; +u32 ring_id; + +for (ring_id =0 ; ring_id <HAL_SRNG_RING_ID_MAX ; ring_id++) +lockdep_unregister_key (hal->srng_key + ring_id); +} +int ath11k_hal_srng_init (struct ath11k_base *ab) {struct ath11k_hal *hal = &ab->hal;
@@ -1252,6 +1271,8 @@ int ath11k_hal_srng_init(struct ath11k_base *ab)if (ret) goto err_free_cont_rdp; +ath11k_hal_register_srng_key (ab); +return 0 ; err_free_cont_rdp:
@@ -1266,6 +1287,7 @@ void ath11k_hal_srng_deinit(struct ath11k_base *ab) {struct ath11k_hal *hal = &ab->hal; +ath11k_hal_unregister_srng_key (ab);ath11k_hal_free_cont_rdp (ab);ath11k_hal_free_cont_wrp (ab);kfree (hal->srng_config);
drivers/net/wireless/ath/ath11k/hal.h +2 -0
@@ -901,6 +901,8 @@ struct ath11k_hal {/* shadow register configuration */ u32 shadow_reg_addr[HAL_SHADOW_NUM_REGS ];int num_shadow_reg_configured; + +struct lock_class_key srng_key[HAL_SRNG_RING_ID_MAX ]; };u32 ath11k_hal_reo_qdesc_size (u32 ba_window_size,u8 tid);
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 125/217 x86/mce: Mark mce_end() noinstr
In reply to Sasha LevinFrom: Borislav Petkov <[email protected]>
[ Upstream commit b4813539d37fa31fed62cdfab7bd2dd8929c5b2e ]
It is called by the #MC handler which is noinstr.
Fixes
vmlinux.o: warning: objtool: do_machine_check()+0xbd6: call to memset() leaves .noinstr.text section
--- arch/x86/kernel/cpu/mce/core.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
arch/x86/kernel/cpu/mce/core.c +11 -3
@@ -1063,10 +1063,13 @@ static int mce_start(int *no_way_out)* Synchronize between CPUs after main scanning loop. * This invokes the bulk of the Monarch processing. */ -static int mce_end (int order) +static noinstr int mce_end(int order) { -int ret =-1 ;u64 timeout = (u64 )mca_cfg.monarch_timeout *NSEC_PER_USEC ; +int ret =-1 ; + +/* Allow instrumentation around external facilities. */ +instrumentation_begin ();if (!timeout) goto reset;
@@ -1110,7 +1113,8 @@ static int mce_end(int order)/* * Don't reset anything. That's done by the Monarch. */ -return 0 ; + ret =0 ; + goto out; }/*
@@ -1126,6 +1130,10 @@ static int mce_end(int order)* Let others run again. */ atomic_set (&mce_executing,0 ); + +out: +instrumentation_end (); +return ret; }
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 132/217 HID: quirks: Allow inverting the absolute X/Y values
In reply to Sasha LevinFrom: Alistair Francis <[email protected]>
[ Upstream commit fd8d135b2c5e88662f2729e034913f183455a667 ]
Add a HID_QUIRK_X_INVERT/HID_QUIRK_Y_INVERT quirk that can be used to invert the X/Y values.
--- drivers/hid/hid-input.c | 6 ++++++ include/linux/hid.h | 2 ++ 2 files changed, 8 insertions(+)
drivers/hid/hid-input.c +6 -0
@@ -1333,6 +1333,12 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct input = field->hidinput->input; +if (usage->type ==EV_ABS && + (((*quirks &HID_QUIRK_X_INVERT ) && usage->code ==ABS_X ) || + ((*quirks &HID_QUIRK_Y_INVERT ) && usage->code ==ABS_Y ))) { + value = field->logical_maximum - value; + } +if (usage->hat_min < usage->hat_max || usage->hat_dir) {int hat_dir = usage->hat_dir;if (!hat_dir)
include/linux/hid.h +2 -0
@@ -349,6 +349,8 @@ struct hid_item {/* BIT(9) reserved for backward compatibility, was NO_INIT_INPUT_REPORTS */ #define HID_QUIRK_ALWAYS_POLL BIT(10)#define HID_QUIRK_INPUT_PER_APP BIT(11) +#define HID_QUIRK_X_INVERT BIT(12) +#define HID_QUIRK_Y_INVERT BIT(13)#define HID_QUIRK_SKIP_OUTPUT_REPORTS BIT(16)#define HID_QUIRK_SKIP_OUTPUT_REPORT_ID BIT(17)#define HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP BIT(18)
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 98/217 media: rcar-vin: Update format alignment constraints
In reply to Sasha LevinFrom: Niklas Söderlund <[email protected]>
[ Upstream commit da6911f330d40cfe115a37249e47643eff555e82 ]
This change fixes two issues with the size constraints for buffers.
- There is no width alignment constraint for RGB formats. Prior to this change they were treated as YUV and as a result were more restricted than needed. Add a new check to differentiate between the two.
- The minimum width and height supported is 5x2, not 2x4, this is an artifact from the driver's soc-camera days. Fix this incorrect assumption.
--- drivers/media/platform/rcar-vin/rcar-v4l2.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/media/platform/rcar-vin/rcar-v4l2.c +11 -4
@@ -179,20 +179,27 @@ static void rvin_format_align(struct rvin_dev *vin, struct v4l2_pix_format *pix)break ; } -/* HW limit width to a multiple of 32 (2^5) for NV12/16 else 2 (2^1) */ +/* Hardware limits width alignment based on format. */ switch (pix->pixelformat) { +/* Multiple of 32 (2^5) for NV12/16. */ case V4L2_PIX_FMT_NV12 :case V4L2_PIX_FMT_NV16 : walign =5 ;break ; -default : +/* Multiple of 2 (2^1) for YUV. */ +case V4L2_PIX_FMT_YUYV : +case V4L2_PIX_FMT_UYVY : walign =1 ;break ; +/* No multiple for RGB. */ +default : + walign =0 ; +break ; }/* Limit to VIN capabilities */ -v4l_bound_align_image (&pix->width,2 , vin->info->max_width, walign, - &pix->height,4 , vin->info->max_height,2 ,0 ); +v4l_bound_align_image (&pix->width,5 , vin->info->max_width, walign, + &pix->height,2 , vin->info->max_height,0 ,0 ); pix->bytesperline =rvin_format_bytesperline (vin, pix); pix->sizeimage =rvin_format_sizeimage (pix);
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 109/217 ath11k: avoid deadlock by change ieee80211_queue_work for regd_update_work
In reply to Sasha LevinFrom: Wen Gong <[email protected]>
[ Upstream commit ed05c7cf1286d7e31e7623bce55ff135723591bf ]
When enable debug config, it print below warning while shut down wlan interface shuh as run "ifconfig wlan0 down".
The reason is because ar->regd_update_work is ran once, and it is will call wiphy_lock(ar->hw->wiphy) in function ath11k_regd_update() which is running in workqueue of ieee80211_local queued by ieee80211_queue_work(). Another thread from "ifconfig wlan0 down" will also accuqire the lock by wiphy_lock(sdata->local->hw.wiphy) in function ieee80211_stop(), and then it call ieee80211_stop_device() to flush_workqueue(local->workqueue), this will wait the workqueue of ieee80211_local finished. Then deadlock will happen easily if the two thread run meanwhile.
Below warning disappeared after this change.
[ 914.088798] ath11k_pci 0000:05:00.0: mac remove interface (vdev 0) [ 914.088806] ath11k_pci 0000:05:00.0: mac stop 11d scan [ 914.088810] ath11k_pci 0000:05:00.0: mac stop 11d vdev id 0 [ 914.088827] ath11k_pci 0000:05:00.0: htc ep 2 consumed 1 credits (total 0) [ 914.088841] ath11k_pci 0000:05:00.0: send 11d scan stop vdev id 0 [ 914.088849] ath11k_pci 0000:05:00.0: htc insufficient credits ep 2 required 1 available 0 [ 914.088856] ath11k_pci 0000:05:00.0: htc insufficient credits ep 2 required 1 available 0 [ 914.096434] ath11k_pci 0000:05:00.0: rx ce pipe 2 len 16 [ 914.096442] ath11k_pci 0000:05:00.0: htc ep 2 got 1 credits (total 1) [ 914.096481] ath11k_pci 0000:05:00.0: htc ep 2 consumed 1 credits (total 0) [ 914.096491] ath11k_pci 0000:05:00.0: WMI vdev delete id 0 [ 914.111598] ath11k_pci 0000:05:00.0: rx ce pipe 2 len 16 [ 914.111628] ath11k_pci 0000:05:00.0: htc ep 2 got 1 credits (total 1) [ 914.114659] ath11k_pci 0000:05:00.0: rx ce pipe 2 len 20 [ 914.114742] ath11k_pci 0000:05:00.0: htc rx completion ep 2 skb pK-error [ 914.115977] ath11k_pci 0000:05:00.0: vdev delete resp for vdev id 0 [ 914.116685] ath11k_pci 0000:05:00.0: vdev 00:03:7f:29:61:11 deleted, vdev_id 0
[ 914.117583] ======================================================
[ 914.117592] WARNING: possible circular locking dependency detected
[ 914.117600] 5.16.0-rc1-wt-ath+ #1 Tainted: G OE
[ 914.117611] ------------------------------------------------------
[ 914.117618] ifconfig/2805 is trying to acquire lock:
[ 914.117628] ffff9c00a62bb548 ((wq_completion)phy0){+.+.}-{0:0}, at: flush_workqueue+0x87/0x470
[ 914.117674]
but task is already holding lock:
[ 914.117682] ffff9c00baea07d0 (&rdev->wiphy.mtx){+.+.}-{4:4}, at: ieee80211_stop+0x38/0x180 [mac80211]
[ 914.117872]
which lock already depends on the new lock.[ 914.117880]
the existing dependency chain (in reverse order) is:
[ 914.117888]
-> #3 (&rdev->wiphy.mtx){+.+.}-{4:4}:
[ 914.117910] __mutex_lock+0xa0/0x9c0
[ 914.117930] mutex_lock_nested+0x1b/0x20
[ 914.117944] reg_process_self_managed_hints+0x3a/0xb0 [cfg80211]
[ 914.118093] wiphy_regulatory_register+0x47/0x80 [cfg80211]
[ 914.118229] wiphy_register+0x84f/0x9c0 [cfg80211]
[ 914.118353] ieee80211_register_hw+0x6b1/0xd90 [mac80211]
[ 914.118486] ath11k_mac_register+0x6af/0xb60 [ath11k]
[ 914.118550] ath11k_core_qmi_firmware_ready+0x383/0x4a0 [ath11k]
[ 914.118598] ath11k_qmi_driver_event_work+0x347/0x4a0 [ath11k]
[ 914.118656] process_one_work+0x228/0x670
[ 914.118669] worker_thread+0x4d/0x440
[ 914.118680] kthread+0x16d/0x1b0
[ 914.118697] ret_from_fork+0x22/0x30
[ 914.118714]
-> #2 (rtnl_mutex){+.+.}-{4:4}:
[ 914.118736] __mutex_lock+0xa0/0x9c0
[ 914.118751] mutex_lock_nested+0x1b/0x20
[ 914.118767] rtnl_lock+0x17/0x20
[ 914.118783] ath11k_regd_update+0x15a/0x260 [ath11k]
[ 914.118841] ath11k_regd_update_work+0x15/0x20 [ath11k]
[ 914.118897] process_one_work+0x228/0x670
[ 914.118909] worker_thread+0x4d/0x440
[ 914.118920] kthread+0x16d/0x1b0
[ 914.118934] ret_from_fork+0x22/0x30
[ 914.118948]
-> #1 ((work_completion)(&ar->regd_update_work)){+.+.}-{0:0}:
[ 914.118972] process_one_work+0x1fa/0x670
[ 914.118984] worker_thread+0x4d/0x440
[ 914.118996] kthread+0x16d/0x1b0
[ 914.119010] ret_from_fork+0x22/0x30
[ 914.119023]
-> #0 ((wq_completion)phy0){+.+.}-{0:0}:
[ 914.119045] __lock_acquire+0x146d/0x1cf0
[ 914.119057] lock_acquire+0x19b/0x360
[ 914.119067] flush_workqueue+0xae/0x470
[ 914.119084] ieee80211_stop_device+0x3b/0x50 [mac80211]
[ 914.119260] ieee80211_do_stop+0x5d7/0x830 [mac80211]
[ 914.119409] ieee80211_stop+0x45/0x180 [mac80211]
[ 914.119557] __dev_close_many+0xb3/0x120
[ 914.119573] __dev_change_flags+0xc3/0x1d0
[ 914.119590] dev_change_flags+0x29/0x70
[ 914.119605] devinet_ioctl+0x653/0x810
[ 914.119620] inet_ioctl+0x193/0x1e0
[ 914.119631] sock_do_ioctl+0x4d/0xf0
[ 914.119649] sock_ioctl+0x262/0x340
[ 914.119665] __x64_sys_ioctl+0x96/0xd0
[ 914.119678] do_syscall_64+0x3d/0xd0
[ 914.119694] entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 914.119709]
other info that might help us debug this:[ 914.119717] Chain exists of:
(wq_completion)phy0 --> rtnl_mutex --> &rdev->wiphy.mtx[ 914.119745] Possible unsafe locking scenario:
[ 914.119752] CPU0 CPU1
[ 914.119758] ---- ----
[ 914.119765] lock(&rdev->wiphy.mtx);
[ 914.119778] lock(rtnl_mutex);
[ 914.119792] lock(&rdev->wiphy.mtx);
[ 914.119807] lock((wq_completion)phy0);
[ 914.119819]
*** DEADLOCK ***[ 914.119827] 2 locks held by ifconfig/2805:
[ 914.119837] #0: ffffffffba3dc010 (rtnl_mutex){+.+.}-{4:4}, at: rtnl_lock+0x17/0x20
[ 914.119872] #1: ffff9c00baea07d0 (&rdev->wiphy.mtx){+.+.}-{4:4}, at: ieee80211_stop+0x38/0x180 [mac80211]
[ 914.120039]
stack backtrace:
[ 914.120048] CPU: 0 PID: 2805 Comm: ifconfig Tainted: G OE 5.16.0-rc1-wt-ath+ #1
[ 914.120064] Hardware name: LENOVO 418065C/418065C, BIOS 83ET63WW (1.33 ) 07/29/2011
[ 914.120074] Call Trace:
[ 914.120084] <TASK>
[ 914.120094] dump_stack_lvl+0x73/0xa4
[ 914.120119] dump_stack+0x10/0x12
[ 914.120135] print_circular_bug.isra.44+0x221/0x2e0
[ 914.120165] check_noncircular+0x106/0x150
[ 914.120203] __lock_acquire+0x146d/0x1cf0
[ 914.120215] ? __lock_acquire+0x146d/0x1cf0
[ 914.120245] lock_acquire+0x19b/0x360
[ 914.120259] ? flush_workqueue+0x87/0x470
[ 914.120286] ? lockdep_init_map_type+0x6b/0x250
[ 914.120310] flush_workqueue+0xae/0x470
[ 914.120327] ? flush_workqueue+0x87/0x470
[ 914.120344] ? lockdep_hardirqs_on+0xd7/0x150
[ 914.120391] ieee80211_stop_device+0x3b/0x50 [mac80211]
[ 914.120565] ? ieee80211_stop_device+0x3b/0x50 [mac80211]
[ 914.120736] ieee80211_do_stop+0x5d7/0x830 [mac80211]
[ 914.120906] ieee80211_stop+0x45/0x180 [mac80211]
[ 914.121060] __dev_close_many+0xb3/0x120
[ 914.121081] __dev_change_flags+0xc3/0x1d0
[ 914.121109] dev_change_flags+0x29/0x70
[ 914.121131] devinet_ioctl+0x653/0x810
[ 914.121149] ? __might_fault+0x77/0x80
[ 914.121179] inet_ioctl+0x193/0x1e0
[ 914.121194] ? inet_ioctl+0x193/0x1e0
[ 914.121218] ? __might_fault+0x77/0x80
[ 914.121238] ? _copy_to_user+0x68/0x80
[ 914.121266] sock_do_ioctl+0x4d/0xf0
[ 914.121283] ? inet_stream_connect+0x60/0x60
[ 914.121297] ? sock_do_ioctl+0x4d/0xf0
[ 914.121329] sock_ioctl+0x262/0x340
[ 914.121347] ? sock_ioctl+0x262/0x340
[ 914.121362] ? exit_to_user_mode_prepare+0x13b/0x280
[ 914.121388] ? syscall_enter_from_user_mode+0x20/0x50
[ 914.121416] __x64_sys_ioctl+0x96/0xd0
[ 914.121430] ? br_ioctl_call+0x90/0x90
[ 914.121445] ? __x64_sys_ioctl+0x96/0xd0
[ 914.121465] do_syscall_64+0x3d/0xd0
[ 914.121482] entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 914.121497] RIP: 0033:0x7f0ed051737b
[ 914.121513] Code: 0f 1e fa 48 8b 05 15 3b 0d 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d e5 3a 0d 00 f7 d8 64 89 01 48
[ 914.121527] RSP: 002b:00007fff7be38b98 EFLAGS: 00000202 ORIG_RAX: 0000000000000010
[ 914.121544] RAX: ffffffffffffffda RBX: 00007fff7be38ba0 RCX: 00007f0ed051737b
[ 914.121555] RDX: 00007fff7be38ba0 RSI: 0000000000008914 RDI: 0000000000000004
[ 914.121566] RBP: 00007fff7be38c60 R08: 000000000000000a R09: 0000000000000001
[ 914.121576] R10: 0000000000000000 R11: 0000000000000202 R12: 00000000fffffffe
[ 914.121586] R13: 0000000000000004 R14: 0000000000000000 R15: 0000000000000000
[ 914.121620] </TASK>Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1
--- drivers/net/wireless/ath/ath11k/wmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath11k/wmi.c +1 -1
@@ -5911,7 +5911,7 @@ static int ath11k_reg_chan_list_event(struct ath11k_base *ab, struct sk_buff *sk ar = ab->pdevs[pdev_idx].ar;kfree (ab->new_regd[pdev_idx]); ab->new_regd[pdev_idx] = regd; -ieee80211_queue_work (ar->hw, &ar->regd_update_work); +queue_work (ab->workqueue, &ar->regd_update_work); }else {/* This regd would be applied during mac registration and is * held constant throughout for regd intersection purpose
Signature · 7 lines
2.34.1 -- ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
Sasha Levin
maintainerPATCH 97/217 media: uvcvideo: Increase UVC_CTRL_CONTROL_TIMEOUT to 5 seconds.
In reply to Sasha LevinFrom: James Hilliard <[email protected]>
[ Upstream commit c8ed7d2f614cd8b315981d116c7a2fb01829500d ]
Some uvc devices appear to require the maximum allowed USB timeout for GET_CUR/SET_CUR requests.
So lets just bump the UVC control timeout to 5 seconds which is the same as the usb ctrl get/set defaults:USB_CTRL_GET_TIMEOUT 5000USB_CTRL_SET_TIMEOUT 5000
It fixes the following runtime warnings:
Failed to query (GET_CUR) UVC control 11 on unit 2: -110 (exp. 1). Failed to query (SET_CUR) UVC control 3 on unit 2: -110 (exp. 2).
--- drivers/media/usb/uvc/uvcvideo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/uvc/uvcvideo.h +1 -1
@@ -189,7 +189,7 @@/* Maximum status buffer size in bytes of interrupt URB. */ #define UVC_MAX_STATUS_SIZE 16 -#define UVC_CTRL_CONTROL_TIMEOUT 500 +#define UVC_CTRL_CONTROL_TIMEOUT 5000#define UVC_CTRL_STREAMING_TIMEOUT 5000/* Maximum allowed number of control mappings per device */
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 102/217 thunderbolt: Runtime PM activate both ends of the device link
In reply to Sasha LevinFrom: Mika Westerberg <[email protected]>
[ Upstream commit f3380cac0c0b3a6f49ab161e2a057c363962f48d ]
If protocol tunnels are already up when the driver is loaded, for instance if the boot firmware implements connection manager of its own, runtime PM reference count of the consumer devices behind the tunnel might have been increased already before the device link is created but the supplier device runtime PM reference count is not. This leads to a situation where the supplier (the Thunderbolt driver) can runtime suspend even if it should not because the corresponding protocol tunnel needs to be up causing the devices to be removed from the corresponding native bus.
Prevent this from happening by making both sides of the link runtime PM active briefly. The pm_runtime_put() for the consumer (PCIe root/downstream port, xHCI) then allows it to runtime suspend again but keeps the supplier runtime resumed the whole time it is runtime active.
--- drivers/thunderbolt/acpi.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/thunderbolt/acpi.c +13 -0
@@ -7,6 +7,7 @@*/ #include <linux/acpi.h> +#include <linux/pm_runtime.h> #include "tb.h"
@@ -74,8 +75,18 @@ static acpi_status tb_acpi_add_link(acpi_handle handle, u32 level, void *data, pci_pcie_type(pdev) == PCI_EXP_TYPE_DOWNSTREAM))) {const struct device_link *link; +/* +* Make them both active first to make sure the NHI does +* not runtime suspend before the consumer. The +* pm_runtime_put() below then allows the consumer to +* runtime suspend again (which then allows NHI runtime +* suspend too now that the device link is established). +*/ +pm_runtime_get_sync (&pdev->dev); + link =device_link_add (&pdev->dev, &nhi->pdev->dev,DL_FLAG_AUTOREMOVE_SUPPLIER | +DL_FLAG_RPM_ACTIVE |DL_FLAG_PM_RUNTIME );if (link) { dev_dbg(&nhi->pdev->dev, "created link from %s\n",
@@ -84,6 +95,8 @@ static acpi_status tb_acpi_add_link(acpi_handle handle, u32 level, void *data,dev_warn (&nhi->pdev->dev,"device link creation from %s failed\n" ,dev_name (&pdev->dev)); } + +pm_runtime_put (&pdev->dev); } out_put:
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 133/217 HID: i2c-hid-of: Expose the touchscreen-inverted properties
In reply to Sasha LevinFrom: Alistair Francis <[email protected]>
[ Upstream commit b60d3c803d7603432a08aeaf988aff53b3a5ec64 ]
Allow the touchscreen-inverted-x/y device tree properties to control the HID_QUIRK_X_INVERT/HID_QUIRK_Y_INVERT quirks for the hid-input device.
--- .../devicetree/bindings/input/hid-over-i2c.txt | 2 ++ drivers/hid/i2c-hid/i2c-hid-acpi.c | 2 +- drivers/hid/i2c-hid/i2c-hid-core.c | 4 +++- drivers/hid/i2c-hid/i2c-hid-of-goodix.c | 2 +- drivers/hid/i2c-hid/i2c-hid-of.c | 10 +++++++++- drivers/hid/i2c-hid/i2c-hid.h | 2 +- 6 files changed, 17 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/input/hid-over-i2c.txt +2 -0
@@ -32,6 +32,8 @@ device-specific compatible properties, which should be used in addition to the - vdd-supply: phandle of the regulator that provides the supply voltage. - post-power-on-delay-ms: time required by the device after enabling its regulators or powering it on, before it is ready for communication. +- touchscreen-inverted-x: See touchscreen.txt +- touchscreen-inverted-y: See touchscreen.txt Example:
drivers/hid/i2c-hid/i2c-hid-acpi.c +1 -1
@@ -111,7 +111,7 @@ static int i2c_hid_acpi_probe(struct i2c_client *client) }return i2c_hid_core_probe (client, &ihid_acpi->ops, - hid_descriptor_address); + hid_descriptor_address,0 ); }static const struct acpi_device_id i2c_hid_acpi_match[] = {
drivers/hid/i2c-hid/i2c-hid-core.c +3 -1
@@ -912,7 +912,7 @@ static void i2c_hid_core_shutdown_tail(struct i2c_hid *ihid) }int i2c_hid_core_probe (struct i2c_client *client,struct i2chid_ops *ops, -u16 hid_descriptor_address) +u16 hid_descriptor_address,u32 quirks) {int ret;struct i2c_hid *ihid;
@@ -1009,6 +1009,8 @@ int i2c_hid_core_probe(struct i2c_client *client, struct i2chid_ops *ops, goto err_mem_free; } + hid->quirks |= quirks; +return 0 ; err_mem_free:
drivers/hid/i2c-hid/i2c-hid-of-goodix.c +1 -1
@@ -150,7 +150,7 @@ static int i2c_hid_of_goodix_probe(struct i2c_client *client,goodix_i2c_hid_deassert_reset (ihid_goodix, true);mutex_unlock (&ihid_goodix->regulator_mutex); -return i2c_hid_core_probe (client, &ihid_goodix->ops,0x0001 ); +return i2c_hid_core_probe (client, &ihid_goodix->ops,0x0001 ,0 ); }static const struct goodix_i2c_hid_timing_data goodix_gt7375p_timing_data = {
drivers/hid/i2c-hid/i2c-hid-of.c +9 -1
@@ -21,6 +21,7 @@#include <linux/delay.h> #include <linux/device.h> +#include <linux/hid.h> #include <linux/i2c.h> #include <linux/kernel.h> #include <linux/module.h>
@@ -71,6 +72,7 @@ static int i2c_hid_of_probe(struct i2c_client *client,struct device *dev = &client->dev;struct i2c_hid_of *ihid_of;u16 hid_descriptor_address; +u32 quirks =0 ;int ret;u32 val;
@@ -105,8 +107,14 @@ static int i2c_hid_of_probe(struct i2c_client *client,if (ret)return ret; +if (device_property_read_bool (dev,"touchscreen-inverted-x" )) + quirks |=HID_QUIRK_X_INVERT ; + +if (device_property_read_bool (dev,"touchscreen-inverted-y" )) + quirks |=HID_QUIRK_Y_INVERT ; +return i2c_hid_core_probe (client, &ihid_of->ops, - hid_descriptor_address); + hid_descriptor_address, quirks); }static const struct of_device_id i2c_hid_of_match[] = {
drivers/hid/i2c-hid/i2c-hid.h +1 -1
@@ -32,7 +32,7 @@ struct i2chid_ops { };int i2c_hid_core_probe (struct i2c_client *client,struct i2chid_ops *ops, -u16 hid_descriptor_address); +u16 hid_descriptor_address,u32 quirks);int i2c_hid_core_remove (struct i2c_client *client);void i2c_hid_core_shutdown (struct i2c_client *client);
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 134/217 media: igorplugusb: receiver overflow should be reported
In reply to Sasha LevinFrom: Sean Young <[email protected]>
[ Upstream commit 8fede658e7ddb605bbd68ed38067ddb0af033db4 ]
Without this, some IR will be missing mid-stream and we might decode something which never really occurred.
--- drivers/media/rc/igorplugusb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/rc/igorplugusb.c +3 -1
@@ -64,9 +64,11 @@ static void igorplugusb_irdata(struct igorplugusb *ir, unsigned len)if (start >= len) {dev_err (ir->dev,"receive overflow invalid: %u" , overflow); }else { -if (overflow >0 ) +if (overflow >0 ) {dev_warn (ir->dev,"receive overflow, at least %u lost" , overflow); +ir_raw_event_reset (ir->rc); + } do { rawir.duration = ir->buf_in[i] * 85;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 135/217 media: rockchip: rkisp1: use device name for debugfs subdir name
In reply to Sasha LevinFrom: Mikhail Rudenko <[email protected]>
[ Upstream commit c2611e479f5d9b05108270e1ab423955486b4457 ]
While testing Rockchip RK3399 with both ISPs enabled, a dmesg error was observed:
``` [ 15.559141] debugfs: Directory 'rkisp1' with parent '/' already present! ```
Fix it by using the device name for the debugfs subdirectory name instead of the driver name, thus preventing name collision.
--- drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c +1 -1
@@ -462,7 +462,7 @@ static void rkisp1_debug_init(struct rkisp1_device *rkisp1) {struct rkisp1_debug *debug = &rkisp1->debug; - debug->debugfs_dir =debugfs_create_dir (RKISP1_DRIVER_NAME ,NULL ); + debug->debugfs_dir =debugfs_create_dir (dev_name (rkisp1->dev),NULL );debugfs_create_ulong ("data_loss" ,0444 , debug->debugfs_dir, &debug->data_loss); debugfs_create_ulong("outform_size_err", 0444, debug->debugfs_dir,
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 136/217 media: saa7146: hexium_gemini: Fix a NULL pointer dereference in hexium_attach()
In reply to Sasha LevinFrom: Zhou Qingyang <[email protected]>
[ Upstream commit 3af86b046933ba513d08399dba0d4d8b50d607d0 ]
In hexium_attach(dev, info), saa7146_vv_init() is called to allocate a new memory for dev->vv_data. saa7146_vv_release() will be called on failure of saa7146_register_device(). There is a dereference of dev->vv_data in saa7146_vv_release(), which could lead to a NULL pointer dereference on failure of saa7146_vv_init().
Fix this bug by adding a check of saa7146_vv_init().
This bug was found by a static analyzer. The analysis employs differential checking to identify inconsistent security operations (e.g., checks or kfrees) between two code paths and confirms that the inconsistent operations are not recovered in the current function or the callers, so they constitute bugs.
Note that, as a bug found by static analysis, it can be a false positive or hard to trigger. Multiple researchers have cross-reviewed the bug.
Builds with CONFIG_VIDEO_HEXIUM_GEMINI=m show no new warnings, and our static analyzer no longer warns about this code.
--- drivers/media/common/saa7146/saa7146_fops.c | 2 +- drivers/media/pci/saa7146/hexium_gemini.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/media/common/saa7146/saa7146_fops.c +1 -1
@@ -521,7 +521,7 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)ERR ("out of memory. aborting.\n" );kfree (vv);v4l2_ctrl_handler_free (hdl); -return -1 ; +return -ENOMEM ; } saa7146_video_uops.init (dev,vv);
drivers/media/pci/saa7146/hexium_gemini.c +6 -1
@@ -284,7 +284,12 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_dhexium_set_input (hexium,0 ); hexium->cur_input =0 ; -saa7146_vv_init (dev, &vv_data); + ret =saa7146_vv_init (dev, &vv_data); +if (ret) { +i2c_del_adapter (&hexium->i2c_adapter); +kfree (hexium); +return ret; + } vv_data.vid_ops.vidioc_enum_input = vidioc_enum_input; vv_data.vid_ops.vidioc_g_input = vidioc_g_input;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 137/217 mmc: tmio: reinit card irqs in reset routine
In reply to Sasha LevinFrom: Biju Das <[email protected]>
[ Upstream commit e315b1f3a170f368da5618f8a598e68880302ed1 ]
Refactor the code so that card detect irqs are always reenabled after a reset. This avoids doing it manually all over the code or forgetting to do this in the future.
--- drivers/mmc/host/tmio_mmc_core.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/mmc/host/tmio_mmc_core.c +3 -12
@@ -960,14 +960,8 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)case MMC_POWER_OFF :tmio_mmc_power_off (host);/* For R-Car Gen2+, we need to reset SDHI specific SCC */ -if (host->pdata->flags &TMIO_MMC_MIN_RCAR2 ) { - host->reset (host); - -if (host->native_hotplug) -tmio_mmc_enable_mmc_irqs (host, -TMIO_STAT_CARD_REMOVE | -TMIO_STAT_CARD_INSERT ); - } +if (host->pdata->flags &TMIO_MMC_MIN_RCAR2 ) +tmio_mmc_reset (host); host->set_clock (host,0 );break ;
@@ -1175,6 +1169,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host)if (mmc_can_gpio_cd (mmc)) _host->ops.get_cd = mmc_gpio_get_cd; +/* must be set before tmio_mmc_reset() */ _host->native_hotplug = !(mmc_can_gpio_cd (mmc) || mmc->caps &MMC_CAP_NEEDS_POLL || !mmc_card_is_removable (mmc));
@@ -1295,10 +1290,6 @@ int tmio_mmc_host_runtime_resume(struct device *dev)if (host->clk_cache) host->set_clock (host, host->clk_cache); -if (host->native_hotplug) -tmio_mmc_enable_mmc_irqs (host, -TMIO_STAT_CARD_REMOVE |TMIO_STAT_CARD_INSERT ); -tmio_mmc_enable_dma (host, true);return 0 ;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 113/217 ath10k: drop beacon and probe response which leak from other channel
In reply to Sasha LevinFrom: Wen Gong <[email protected]>
[ Upstream commit 3bf2537ec2e33310b431b53fd84be8833736c256 ]
When scan request on channel 1, it also receive beacon from other channels, and the beacon also indicate to mac80211 and wpa_supplicant, and then the bss info appears in radio measurement report of radio measurement sent from wpa_supplicant, thus lead RRM case fail.
This is to drop the beacon and probe response which is not the same channel of scanning.
Tested-on: QCA6174 hw3.2 SDIO WLAN.RMH.4.4.1-00049
--- drivers/net/wireless/ath/ath10k/wmi.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/wmi.c +26 -1
@@ -2611,9 +2611,30 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)ath10k_mac_handle_beacon (ar, skb);if (ieee80211_is_beacon (hdr->frame_control) || -ieee80211_is_probe_resp (hdr->frame_control)) +ieee80211_is_probe_resp (hdr->frame_control)) { +struct ieee80211_mgmt *mgmt = (void *)skb->data; +u8 *ies; +int ies_ch; + status->boottime_ns =ktime_get_boottime_ns (); +if (!ar->scan_channel) + goto drop; + + ies = mgmt->u.beacon.variable; + + ies_ch =cfg80211_get_ies_channel_number (mgmt->u.beacon.variable, +skb_tail_pointer (skb) - ies, + sband->band); + +if (ies_ch >0 && ies_ch != channel) { +ath10k_dbg (ar,ATH10K_DBG_MGMT , +"channel mismatched ds channel %d scan channel %d\n" , + ies_ch, channel); + goto drop; + } + } + ath10k_dbg(ar, ATH10K_DBG_MGMT, "event mgmt rx skb %pK len %d ftype %02x stype %02x\n", skb, skb->len,
@@ -2627,6 +2648,10 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)ieee80211_rx_ni (ar->hw, skb);return 0 ; + +drop: +dev_kfree_skb (skb); +return 0 ; }static int freq_to_idx (struct ath10k *ar,int freq)
Signature · 7 lines
2.34.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Sasha Levin
maintainerPATCH 110/217 ath10k: Fix tx hanging
In reply to Sasha LevinFrom: Sebastian Gottschall <[email protected]>
[ Upstream commit e8a91863eba3966a447d2daa1526082d52b5db2a ]
While running stress tests in roaming scenarios (switching ap's every 5 seconds, we discovered a issue which leads to tx hangings of exactly 5 seconds while or after scanning for new accesspoints. We found out that this hanging is triggered by ath10k_mac_wait_tx_complete since the empty_tx_wq was not wake when the num_tx_pending counter reaches zero. To fix this, we simply move the wake_up call to htt_tx_dec_pending, since this call was missed on several locations within the ath10k code.
--- drivers/net/wireless/ath/ath10k/htt_tx.c | 3 +++ drivers/net/wireless/ath/ath10k/txrx.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath10k/htt_tx.c +3 -0
@@ -147,6 +147,9 @@ void ath10k_htt_tx_dec_pending(struct ath10k_htt *htt) htt->num_pending_tx--;if (htt->num_pending_tx == htt->max_num_pending_tx -1 )ath10k_mac_tx_unlock (htt->ar,ATH10K_TX_PAUSE_Q_FULL ); + +if (htt->num_pending_tx ==0 ) +wake_up (&htt->empty_tx_wq); }int ath10k_htt_tx_inc_pending (struct ath10k_htt *htt)
drivers/net/wireless/ath/ath10k/txrx.c +0 -2
@@ -82,8 +82,6 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt, flags = skb_cb->flags;ath10k_htt_tx_free_msdu_id (htt, tx_done->msdu_id);ath10k_htt_tx_dec_pending (htt); -if (htt->num_pending_tx ==0 ) -wake_up (&htt->empty_tx_wq);spin_unlock_bh (&htt->tx_lock);rcu_read_lock ();
Signature · 7 lines
2.34.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Sasha Levin
maintainerPATCH 142/217 audit: ensure userspace is penalized the same as the kernel when under pressure
In reply to Sasha LevinFrom: Paul Moore <[email protected]>
[ Upstream commit 8f110f530635af44fff1f4ee100ecef0bac62510 ]
Due to the audit control mutex necessary for serializing audit userspace messages we haven't been able to block/penalize userspace processes that attempt to send audit records while the system is under audit pressure. The result is that privileged userspace applications have a priority boost with respect to audit as they are not bound by the same audit queue throttling as the other tasks on the system.
This patch attempts to restore some balance to the system when under audit pressure by blocking these privileged userspace tasks after they have finished their audit processing, and dropped the audit control mutex, but before they return to userspace.
--- kernel/audit.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
kernel/audit.c +17 -1
@@ -1540,6 +1540,20 @@ static void audit_receive(struct sk_buff *skb) nlh =nlmsg_next (nlh, &len); }audit_ctl_unlock (); + +/* can't block with the ctrl lock, so penalize the sender now */ +if (audit_backlog_limit && + (skb_queue_len (&audit_queue) > audit_backlog_limit)) { +DECLARE_WAITQUEUE (wait, current); + +/* wake kauditd to try and flush the queue */ +wake_up_interruptible (&kauditd_wait); + +add_wait_queue_exclusive (&audit_backlog_wait, &wait); +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (audit_backlog_wait_time); +remove_wait_queue (&audit_backlog_wait, &wait); + } }/* Log information about who is connecting to the audit multicast socket */
@@ -1824,7 +1838,9 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask,* task_tgid_vnr() since auditd_pid is set in audit_receive_msg() * using a PID anchored in the caller's namespace * 2. generator holding the audit_cmd_mutex - we don't want to block -* while holding the mutex */ +* while holding the mutex, although we do penalize the sender +* later in audit_receive() when it is safe to block +*/ if (!(auditd_test_task (current) ||audit_ctl_owner_current ())) {long stime = audit_backlog_wait_time;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 145/217 arm64: tegra: Adjust length of CCPLEX cluster MMIO region
In reply to Sasha LevinFrom: Thierry Reding <[email protected]>
[ Upstream commit 2b14cbd643feea5fc17c6e8bead4e71088c69acd ]
The Tegra186 CCPLEX cluster register region is 4 MiB is length, not 4 MiB - 1. This was likely presumed to be the "limit" rather than length. Fix it up.
--- arch/arm64/boot/dts/nvidia/tegra186.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/nvidia/tegra186.dtsi +1 -1
@@ -1199,7 +1199,7 @@ sdmmc3_1v8: sdmmc3-1v8 { ccplex@e000000 { compatible = "nvidia,tegra186-ccplex-cluster"; - reg = <0x0 0x0e000000 0x0 0x3fffff>; + reg = <0x0 0x0e000000 0x0 0x400000>; nvidia,bpmp = <&bpmp>; };
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 146/217 crypto: ccp - Move SEV_INIT retry for corrupted data
In reply to Sasha LevinFrom: Peter Gonda <[email protected]>
[ Upstream commit e423b9d75e779d921e6adf5ac3d0b59400d6ba7e ]
Move the data corrupted retry of SEV_INIT into the __sev_platform_init_locked() function. This is for upcoming INIT_EX support as well as helping direct callers of __sev_platform_init_locked() which currently do not support the retry.
--- drivers/crypto/ccp/sev-dev.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-)
drivers/crypto/ccp/sev-dev.c +16 -14
@@ -241,7 +241,7 @@ static int __sev_platform_init_locked(int *error)struct psp_device *psp = psp_master;struct sev_data_init data;struct sev_device *sev; -int rc =0 ; +int psp_ret, rc =0 ;if (!psp || !psp->sev_data)return -ENODEV ;
@@ -266,7 +266,21 @@ static int __sev_platform_init_locked(int *error) data.tmr_len =SEV_ES_TMR_SIZE ; } - rc =__sev_do_cmd_locked (SEV_CMD_INIT , &data, error); + rc =__sev_do_cmd_locked (SEV_CMD_INIT , &data, &psp_ret); +if (rc && psp_ret ==SEV_RET_SECURE_DATA_INVALID ) { +/* +* Initialization command returned an integrity check failure +* status code, meaning that firmware load and validation of SEV +* related persistent data has failed. Retrying the +* initialization function should succeed by replacing the state +* with a reset state. +*/ +dev_dbg (sev->dev,"SEV: retrying INIT command" ); + rc =__sev_do_cmd_locked (SEV_CMD_INIT , &data, &psp_ret); + } +if (error) + *error = psp_ret; +if (rc)return rc;
@@ -1091,18 +1105,6 @@ void sev_pci_init(void)/* Initialize the platform */ rc =sev_platform_init (&error); -if (rc && (error ==SEV_RET_SECURE_DATA_INVALID )) { -/* -* INIT command returned an integrity check failure -* status code, meaning that firmware load and -* validation of SEV related persistent data has -* failed and persistent state has been erased. -* Retrying INIT command here should succeed. -*/ -dev_dbg (sev->dev,"SEV: retrying INIT command" ); - rc =sev_platform_init (&error); - } -if (rc) {dev_err (sev->dev,"SEV: failed to INIT error %#x\n" , error);return ;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 107/217 rcutorture: Avoid soft lockup during cpu stall
In reply to Sasha LevinFrom: Wander Lairson Costa <[email protected]>
[ Upstream commit 5ff7c9f9d7e3e0f6db5b81945fa11b69d62f433a ]
If we use the module stall_cpu option, we may get a soft lockup warning in case we also don't pass the stall_cpu_block option.
Introduce the stall_no_softlockup option to avoid a soft lockup on cpu stall even if we don't use the stall_cpu_block option.
--- kernel/rcu/rcutorture.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/rcu/rcutorture.c +5 -0
@@ -46,6 +46,7 @@#include <linux/oom.h> #include <linux/tick.h> #include <linux/rcupdate_trace.h> +#include <linux/nmi.h> #include "rcu.h"
@@ -109,6 +110,8 @@ torture_param(int, shutdown_secs, 0, "Shutdown time (s), <= zero to disable.");torture_param (int, stall_cpu,0 ,"Stall duration (s), zero to disable." );torture_param (int, stall_cpu_holdoff,10 ,"Time to wait before starting stall (s)." ); +torture_param (bool, stall_no_softlockup, false, +"Avoid softlockup warning during cpu stall." );torture_param (int, stall_cpu_irqsoff,0 ,"Disable interrupts while stalling." );torture_param (int, stall_cpu_block,0 ,"Sleep while stalling." ); torture_param(int, stall_gp_kthread, 0,
@@ -2052,6 +2055,8 @@ static int rcu_torture_stall(void *args)#else schedule_timeout_uninterruptible (HZ );#endif + }else if (stall_no_softlockup) { +touch_softlockup_watchdog (); }if (stall_cpu_irqsoff)local_irq_enable ();
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 171/217 um: registers: Rename function names to avoid conflicts and build problems
In reply to Sasha LevinFrom: Randy Dunlap <[email protected]>
[ Upstream commit 077b7320942b64b0da182aefd83c374462a65535 ]
The function names init_registers() and restore_registers() are used in several net/ethernet/ and gpu/drm/ drivers for other purposes (not calls to UML functions), so rename them.
This fixes multiple build errors.
--- arch/um/include/shared/registers.h | 4 ++-- arch/um/os-Linux/registers.c | 4 ++-- arch/um/os-Linux/start_up.c | 2 +- arch/x86/um/syscalls_64.c | 3 ++- 4 files changed, 7 insertions(+), 6 deletions(-)
arch/um/include/shared/registers.h +2 -2
@@ -16,8 +16,8 @@ extern int restore_fp_registers(int pid, unsigned long *fp_regs);extern int save_fpx_registers (int pid,unsigned long *fp_regs);extern int restore_fpx_registers (int pid,unsigned long *fp_regs);extern int save_registers (int pid,struct uml_pt_regs *regs); -extern int restore_registers (int pid,struct uml_pt_regs *regs); -extern int init_registers (int pid); +extern int restore_pid_registers (int pid,struct uml_pt_regs *regs); +extern int init_pid_registers (int pid);extern void get_safe_registers (unsigned long *regs,unsigned long *fp_regs);extern unsigned long get_thread_reg (int reg,jmp_buf *buf);extern int get_fp_registers (int pid,unsigned long *regs);
arch/um/os-Linux/registers.c +2 -2
@@ -21,7 +21,7 @@ int save_registers(int pid, struct uml_pt_regs *regs)return 0 ; } -int restore_registers (int pid,struct uml_pt_regs *regs) +int restore_pid_registers (int pid,struct uml_pt_regs *regs) {int err;
@@ -36,7 +36,7 @@ int restore_registers(int pid, struct uml_pt_regs *regs)static unsigned long exec_regs[MAX_REG_NR ];static unsigned long exec_fp_regs[FP_SIZE ]; -int init_registers (int pid) +int init_pid_registers (int pid) {int err;
arch/um/os-Linux/start_up.c +1 -1
@@ -368,7 +368,7 @@ void __init os_early_checks(void)check_tmpexec (); pid =start_ptraced_child (); -if (init_registers (pid)) +if (init_pid_registers (pid))fatal ("Failed to initialize default registers" );stop_ptraced_child (pid,1 ,1 ); }
arch/x86/um/syscalls_64.c +2 -1
@@ -11,6 +11,7 @@#include <linux/uaccess.h> #include <asm/prctl.h> /* XXX This should get the constants from libc */ #include <os.h> +#include <registers.h> long arch_prctl (struct task_struct *task,int option,unsigned long __user *arg2)
@@ -35,7 +36,7 @@ long arch_prctl(struct task_struct *task, int option,switch (option) {case ARCH_SET_FS :case ARCH_SET_GS : - ret =restore_registers (pid, ¤t->thread.regs.regs); + ret =restore_pid_registers (pid, ¤t->thread.regs.regs);if (ret)return ret;break ;
Signature · 7 lines
2.34.1 _______________________________________________ linux-um mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-um
Sasha Levin
maintainerPATCH 177/217 drm/etnaviv: consider completed fence seqno in hang check
In reply to Sasha LevinFrom: Lucas Stach <[email protected]>
[ Upstream commit cdd156955f946beaa5f3a00d8ccf90e5a197becc ]
Some GPU heavy test programs manage to trigger the hangcheck quite often. If there are no other GPU users in the system and the test program exhibits a very regular structure in the commandstreams that are being submitted, we can end up with two distinct submits managing to trigger the hangcheck with the FE in a very similar address range. This leads the hangcheck to believe that the GPU is stuck, while in reality the GPU is already busy working on a different job. To avoid those spurious GPU resets, also remember and consider the last completed fence seqno in the hang check.
--- drivers/gpu/drm/etnaviv/etnaviv_gpu.h | 1 + drivers/gpu/drm/etnaviv/etnaviv_sched.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/etnaviv/etnaviv_gpu.h +1 -0
@@ -130,6 +130,7 @@ struct etnaviv_gpu {/* hang detection */ u32 hangcheck_dma_addr; +u32 hangcheck_fence;void __iomem *mmio;int irq;
drivers/gpu/drm/etnaviv/etnaviv_sched.c +3 -1
@@ -107,8 +107,10 @@ static enum drm_gpu_sched_stat etnaviv_sched_timedout_job(struct drm_sched_job*/ dma_addr =gpu_read (gpu,VIVS_FE_DMA_ADDRESS ); change = dma_addr - gpu->hangcheck_dma_addr; -if (change <0 || change >16 ) { +if (gpu->completed_fence != gpu->hangcheck_fence || + change <0 || change >16 ) { gpu->hangcheck_dma_addr = dma_addr; + gpu->hangcheck_fence = gpu->completed_fence; goto out_no_timeout; }
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 151/217 usb: hub: Add delay for SuperSpeed hub resume to let links transit to U0
In reply to Sasha LevinFrom: Kai-Heng Feng <[email protected]>
[ Upstream commit 00558586382891540c59c9febc671062425a6e47 ]
When a new USB device gets plugged to nested hubs, the affected hub, which connects to usb 2-1.4-port2, doesn't report there's any change, hence the nested hubs go back to runtime suspend like nothing happened:
[ 281.032951] usb usb2: usb wakeup-resume [ 281.032959] usb usb2: usb auto-resume [ 281.032974] hub 2-0:1.0: hub_resume [ 281.033011] usb usb2-port1: status 0263 change 0000 [ 281.033077] hub 2-0:1.0: state 7 ports 4 chg 0000 evt 0000 [ 281.049797] usb 2-1: usb wakeup-resume [ 281.069800] usb 2-1: Waited 0ms for CONNECT [ 281.069810] usb 2-1: finish resume [ 281.070026] hub 2-1:1.0: hub_resume [ 281.070250] usb 2-1-port4: status 0203 change 0000 [ 281.070272] usb usb2-port1: resume, status 0 [ 281.070282] hub 2-1:1.0: state 7 ports 4 chg 0010 evt 0000 [ 281.089813] usb 2-1.4: usb wakeup-resume [ 281.109792] usb 2-1.4: Waited 0ms for CONNECT [ 281.109801] usb 2-1.4: finish resume [ 281.109991] hub 2-1.4:1.0: hub_resume [ 281.110147] usb 2-1.4-port2: status 0263 change 0000 [ 281.110234] usb 2-1-port4: resume, status 0 [ 281.110239] usb 2-1-port4: status 0203, change 0000, 10.0 Gb/s [ 281.110266] hub 2-1.4:1.0: state 7 ports 4 chg 0000 evt 0000 [ 281.110426] hub 2-1.4:1.0: hub_suspend [ 281.110565] usb 2-1.4: usb auto-suspend, wakeup 1 [ 281.130998] hub 2-1:1.0: hub_suspend [ 281.137788] usb 2-1: usb auto-suspend, wakeup 1 [ 281.142935] hub 2-0:1.0: state 7 ports 4 chg 0000 evt 0000 [ 281.177828] usb 2-1: usb wakeup-resume [ 281.197839] usb 2-1: Waited 0ms for CONNECT [ 281.197850] usb 2-1: finish resume [ 281.197984] hub 2-1:1.0: hub_resume [ 281.198203] usb 2-1-port4: status 0203 change 0000 [ 281.198228] usb usb2-port1: resume, status 0 [ 281.198237] hub 2-1:1.0: state 7 ports 4 chg 0010 evt 0000 [ 281.217835] usb 2-1.4: usb wakeup-resume [ 281.237834] usb 2-1.4: Waited 0ms for CONNECT [ 281.237845] usb 2-1.4: finish resume [ 281.237990] hub 2-1.4:1.0: hub_resume [ 281.238067] usb 2-1.4-port2: status 0263 change 0000 [ 281.238148] usb 2-1-port4: resume, status 0 [ 281.238152] usb 2-1-port4: status 0203, change 0000, 10.0 Gb/s [ 281.238166] hub 2-1.4:1.0: state 7 ports 4 chg 0000 evt 0000 [ 281.238385] hub 2-1.4:1.0: hub_suspend [ 281.238523] usb 2-1.4: usb auto-suspend, wakeup 1 [ 281.258076] hub 2-1:1.0: hub_suspend [ 281.265744] usb 2-1: usb auto-suspend, wakeup 1 [ 281.285976] hub 2-0:1.0: hub_suspend [ 281.285988] usb usb2: bus auto-suspend, wakeup 1
USB 3.2 spec, 9.2.5.4 "Changing Function Suspend State" says that "If the link is in a non-U0 state, then the device must transition the link to U0 prior to sending the remote wake message", but the hub only transits the link to U0 after signaling remote wakeup.
So be more forgiving and use a 20ms delay to let the link transit to U0 for remote wakeup.
--- drivers/usb/core/hub.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/usb/core/hub.c +4 -1
@@ -1110,7 +1110,10 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) }else {hub_power_on (hub, true); } - } +/* Give some time on remote wakeup to let links to transit to U0 */ + }else if (hub_is_superspeed (hub->hdev)) +msleep (20 ); + init2:/*
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 117/217 selftests/ftrace: make kprobe profile testcase description unique
In reply to Sasha LevinFrom: Heiko Carstens <[email protected]>
[ Upstream commit e5992f373c6eed6d09e5858e9623df1259b3ce30 ]
Commit 32f6e5da83c7 ("selftests/ftrace: Add kprobe profile testcase") added a new kprobes testcase, but has a description which does not describe what the test case is doing and is duplicating the description of another test case.
Therefore change the test case description, so it is unique and then allows easily to tell which test case actually passed or failed.
--- tools/testing/selftests/ftrace/test.d/kprobe/profile.tc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/ftrace/test.d/kprobe/profile.tc +1 -1
@@ -1,6 +1,6 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 -# description: Kprobe dynamic event - adding and removing +# description: Kprobe profile # requires: kprobe_events ! grep -q 'myevent' kprobe_profile
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 185/217 drm/amdgpu: Don't inherit GEM object VMAs in child process
In reply to Sasha LevinFrom: Rajneesh Bhardwaj <[email protected]>
[ Upstream commit fbcdbfde87509d523132b59f661a355c731139d0 ]
When an application having open file access to a node forks, its shared mappings also get reflected in the address space of child process even though it cannot access them with the object permissions applied. With the existing permission checks on the gem objects, it might be reasonable to also create the VMAs with VM_DONTCOPY flag so a user space application doesn't need to explicitly call the madvise(addr, len, MADV_DONTFORK) system call to prevent the pages in the mapped range to appear in the address space of the child process. It also prevents the memory leaks due to additional reference counts on the mapped BOs in the child process that prevented freeing the memory in the parent for which we had worked around earlier in the user space inside the thunk library.
Additionally, we faced this issue when using CRIU to checkpoint restore an application that had such inherited mappings in the child which confuse CRIU when it mmaps on restore. Having this flag set for the render node VMAs helps. VMAs mapped via KFD already take care of this so this is needed only for the render nodes.
To limit the impact of the change to user space consumers such as OpenGL etc, limit it to KFD BOs only.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +3 -0
@@ -264,6 +264,9 @@ static int amdgpu_gem_object_mmap(struct drm_gem_object *obj, struct vm_area_str !(vma->vm_flags & (VM_READ | VM_WRITE | VM_EXEC))) vma->vm_flags &= ~VM_MAYWRITE; +if (bo->kfd_bo) + vma->vm_flags |=VM_DONTCOPY ; +return drm_gem_ttm_mmap (obj, vma); }
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 186/217 drm/amdgpu: fixup bad vram size on gmc v8
In reply to Sasha LevinFrom: Zongmin Zhou <[email protected]>
[ Upstream commit 11544d77e3974924c5a9c8a8320b996a3e9b2f8b ]
Some boards(like RX550) seem to have garbage in the upper 16 bits of the vram size register. Check for this and clamp the size properly. Fixes
boards reporting bogus amounts of vram.
after add this patch,the maximum GPU VRAM size is 64GB, otherwise only 64GB vram size will be used.
--- drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +10 -3
@@ -515,10 +515,10 @@ static void gmc_v8_0_mc_program(struct amdgpu_device *adev)static int gmc_v8_0_mc_init (struct amdgpu_device *adev) {int r; +u32 tmp; adev->gmc.vram_width =amdgpu_atombios_get_vram_width (adev);if (!adev->gmc.vram_width) { -u32 tmp;int chansize, numchan;/* Get VRAM informations */
@@ -562,8 +562,15 @@ static int gmc_v8_0_mc_init(struct amdgpu_device *adev) adev->gmc.vram_width = numchan * chansize; }/* size in MB on si */ - adev->gmc.mc_vram_size =RREG32 (mmCONFIG_MEMSIZE) *1024ULL *1024ULL ; - adev->gmc.real_vram_size =RREG32 (mmCONFIG_MEMSIZE) *1024ULL *1024ULL ; + tmp =RREG32 (mmCONFIG_MEMSIZE); +/* some boards may have garbage in the upper 16 bits */ +if (tmp &0xffff0000 ) { +DRM_INFO ("Probable bad vram size: 0x%08x\n" , tmp); +if (tmp &0xffff ) + tmp &=0xffff ; + } + adev->gmc.mc_vram_size = tmp *1024ULL *1024ULL ; + adev->gmc.real_vram_size = adev->gmc.mc_vram_size;if (!(adev->flags &AMD_IS_APU )) { r =amdgpu_device_resize_fb_bar (adev);
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 188/217 amdgpu/pm: Make sysfs pm attributes as read-only for VFs
In reply to Sasha LevinFrom: Marina Nikolic <[email protected]>
[ Upstream commit 11c9cc95f818f0f187e9b579a7f136f532b42445 ]
== Description ==
Setting values of pm attributes through sysfs should not be allowed in SRIOV mode.
These calls will not be processed by FW anyway, but error handling on sysfs level should be improved.
== Changes ==
This patch prohibits performing of all set commands in SRIOV mode on sysfs level.
It offers better error handling as calls that are not allowed will not be propagated further.
== Test ==
Writing to any sysfs file in passthrough mode will succeed. Writing to any sysfs file in ONEVF mode will yield error:
"calling process does not have sufficient permission to execute a command".
--- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +6 -0
@@ -2123,6 +2123,12 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_ } } +/* setting should not be allowed from VF */ +if (amdgpu_sriov_vf (adev)) { + dev_attr->attr.mode &= ~S_IWUGO ; + dev_attr->store =NULL ; + } +#undef DEVICE_ATTR_ISreturn 0 ;
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 196/217 dm btree: add a defensive bounds check to insert_at()
In reply to Sasha LevinFrom: Joe Thornber <[email protected]>
[ Upstream commit 85bca3c05b6cca31625437eedf2060e846c4bbad ]
Corrupt metadata could trigger an out of bounds write.
--- drivers/md/persistent-data/dm-btree.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/md/persistent-data/dm-btree.c +5 -3
@@ -81,14 +81,16 @@ void inc_children(struct dm_transaction_manager *tm, struct btree_node *n, }static int insert_at (size_t value_size,struct btree_node *node,unsigned index, -uint64_t key,void *value) -__dm_written_to_disk (value) +uint64_t key,void *value) +__dm_written_to_disk (value) {uint32_t nr_entries =le32_to_cpu (node->header.nr_entries); +uint32_t max_entries =le32_to_cpu (node->header.max_entries);__le64 key_le =cpu_to_le64 (key);if (index > nr_entries || - index >=le32_to_cpu (node->header.max_entries)) { + index >= max_entries || + nr_entries >= max_entries) {DMERR ("too many entries in btree node for insert" );__dm_unbless_for_disk (value);return -ENOMEM ;
Signature · 7 lines
2.34.1 -- dm-devel mailing list [email protected] https://listman.redhat.com/mailman/listinfo/dm-devel
Sasha Levin
maintainerPATCH 197/217 dm space map common: add bounds check to sm_ll_lookup_bitmap()
In reply to Sasha LevinFrom: Joe Thornber <[email protected]>
[ Upstream commit cba23ac158db7f3cd48a923d6861bee2eb7a2978 ]
Corrupted metadata could warrant returning error from sm_ll_lookup_bitmap().
--- drivers/md/persistent-data/dm-space-map-common.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/md/persistent-data/dm-space-map-common.c +5 -0
@@ -283,6 +283,11 @@ int sm_ll_lookup_bitmap(struct ll_disk *ll, dm_block_t b, uint32_t *result)struct disk_index_entry ie_disk;struct dm_block *blk; +if (b >= ll->nr_blocks) { +DMERR_LIMIT ("metadata block out of bounds" ); +return -EINVAL ; + } + b =do_div (index, ll->entries_per_block); r = ll->load_ie (ll, index, &ie_disk);if (r <0 )
Signature · 7 lines
2.34.1 -- dm-devel mailing list [email protected] https://listman.redhat.com/mailman/listinfo/dm-devel
Sasha Levin
maintainerPATCH 198/217 can: do not increase rx statistics when generating a CAN rx error message frame
In reply to Sasha LevinFrom: Vincent Mailhol <[email protected]>
[ Upstream commit 676068db69b847f06fe054fca15bf6b107bd24da ]
The CAN error message frames (i.e. error skb) are an interface specific to socket CAN. The payload of the CAN error message frames does not correspond to any actual data sent on the wire. Only an error flag and a delimiter are transmitted when an error occurs (c.f. ISO 11898-1 section 10.4.4.2 "Error flag").
For this reason, it makes no sense to increment the rx_packets and rx_bytes fields of struct net_device_stats because no actual payload were transmitted on the wire.
This patch fixes all the CAN drivers.
--- drivers/net/can/at91_can.c | 6 ------ drivers/net/can/c_can/c_can_main.c | 5 ----- drivers/net/can/cc770/cc770.c | 3 --- drivers/net/can/dev/dev.c | 4 ---- drivers/net/can/dev/rx-offload.c | 6 ++++-- drivers/net/can/ifi_canfd/ifi_canfd.c | 5 ----- drivers/net/can/kvaser_pciefd.c | 5 ----- drivers/net/can/m_can/m_can.c | 7 ------- drivers/net/can/mscan/mscan.c | 9 +++++---- drivers/net/can/pch_can.c | 3 --- drivers/net/can/peak_canfd/peak_canfd.c | 4 ---- drivers/net/can/rcar/rcar_can.c | 6 +----- drivers/net/can/rcar/rcar_canfd.c | 4 ---- drivers/net/can/sja1000/sja1000.c | 2 -- drivers/net/can/sun4i_can.c | 7 ++----- drivers/net/can/usb/ems_usb.c | 2 -- drivers/net/can/usb/esd_usb2.c | 2 -- drivers/net/can/usb/etas_es58x/es58x_core.c | 7 ------- drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c | 2 -- drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c | 8 -------- drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 4 ---- drivers/net/can/usb/peak_usb/pcan_usb.c | 2 -- drivers/net/can/usb/peak_usb/pcan_usb_fd.c | 3 --- drivers/net/can/usb/peak_usb/pcan_usb_pro.c | 2 -- drivers/net/can/usb/ucan.c | 6 ++++-- drivers/net/can/usb/usb_8dev.c | 2 -- drivers/net/can/xilinx_can.c | 9 +-------- 27 files changed, 17 insertions(+), 108 deletions(-)
drivers/net/can/at91_can.c +0 -6
@@ -553,8 +553,6 @@ static void at91_rx_overflow_err(struct net_device *dev) cf->can_id |=CAN_ERR_CRTL ; cf->data[1 ] =CAN_ERR_CRTL_RX_OVERFLOW ; - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_receive_skb (skb); }
@@ -779,8 +777,6 @@ static int at91_poll_err(struct net_device *dev, int quota, u32 reg_sr)at91_poll_err_frame (dev, cf, reg_sr); - dev->stats.rx_packets++; - dev->stats.rx_bytes += cf->len;netif_receive_skb (skb);return 1 ;
@@ -1037,8 +1033,6 @@ static void at91_irq_err(struct net_device *dev)at91_irq_err_state (dev, cf, new_state); - dev->stats.rx_packets++; - dev->stats.rx_bytes += cf->len;netif_rx (skb); priv->can.state = new_state;
drivers/net/can/c_can/c_can_main.c +0 -5
@@ -920,7 +920,6 @@ static int c_can_handle_state_change(struct net_device *dev,unsigned int reg_err_counter;unsigned int rx_err_passive;struct c_can_priv *priv =netdev_priv (dev); -struct net_device_stats *stats = &dev->stats;struct can_frame *cf;struct sk_buff *skb;struct can_berr_counter bec;
@@ -996,8 +995,6 @@ static int c_can_handle_state_change(struct net_device *dev,break ; } - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_receive_skb (skb);return 1 ;
@@ -1064,8 +1061,6 @@ static int c_can_handle_bus_err(struct net_device *dev,break ; } - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_receive_skb (skb);return 1 ; }
drivers/net/can/cc770/cc770.c +0 -3
@@ -499,7 +499,6 @@ static void cc770_rx(struct net_device *dev, unsigned int mo, u8 ctrl1)static int cc770_err (struct net_device *dev,u8 status) {struct cc770_priv *priv =netdev_priv (dev); -struct net_device_stats *stats = &dev->stats;struct can_frame *cf;struct sk_buff *skb;u8 lec;
@@ -571,8 +570,6 @@ static int cc770_err(struct net_device *dev, u8 status) } - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_rx (skb);return 0 ;
drivers/net/can/dev/dev.c +0 -4
@@ -136,7 +136,6 @@ EXPORT_SYMBOL_GPL(can_change_state);static void can_restart (struct net_device *dev) {struct can_priv *priv =netdev_priv (dev); -struct net_device_stats *stats = &dev->stats;struct sk_buff *skb;struct can_frame *cf;int err;
@@ -155,9 +154,6 @@ static void can_restart(struct net_device *dev) cf->can_id |=CAN_ERR_RESTARTED ; - stats->rx_packets++; - stats->rx_bytes += cf->len; -netif_rx_ni (skb); restart:
drivers/net/can/dev/rx-offload.c +4 -2
@@ -54,8 +54,10 @@ static int can_rx_offload_napi_poll(struct napi_struct *napi, int quota)struct can_frame *cf = (struct can_frame *)skb->data; work_done++; - stats->rx_packets++; - stats->rx_bytes += cf->len; +if (!(cf->can_id &CAN_ERR_FLAG )) { + stats->rx_packets++; + stats->rx_bytes += cf->len; + }netif_receive_skb (skb); }
drivers/net/can/ifi_canfd/ifi_canfd.c +0 -5
@@ -430,8 +430,6 @@ static int ifi_canfd_handle_lec_err(struct net_device *ndev) priv->base + IFI_CANFD_INTERRUPT);writel (IFI_CANFD_ERROR_CTR_ER_ENABLE , priv->base +IFI_CANFD_ERROR_CTR ); - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_receive_skb (skb);return 1 ;
@@ -456,7 +454,6 @@ static int ifi_canfd_handle_state_change(struct net_device *ndev, enum can_state new_state) {struct ifi_canfd_priv *priv =netdev_priv (ndev); -struct net_device_stats *stats = &ndev->stats;struct can_frame *cf;struct sk_buff *skb;struct can_berr_counter bec;
@@ -522,8 +519,6 @@ static int ifi_canfd_handle_state_change(struct net_device *ndev,break ; } - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_receive_skb (skb);return 1 ;
drivers/net/can/kvaser_pciefd.c +0 -5
@@ -1310,9 +1310,6 @@ static int kvaser_pciefd_rx_error_frame(struct kvaser_pciefd_can *can, cf->data[6 ] = bec.txerr; cf->data[7 ] = bec.rxerr; - stats->rx_packets++; - stats->rx_bytes += cf->len; -netif_rx (skb);return 0 ; }
@@ -1510,8 +1507,6 @@ static void kvaser_pciefd_handle_nack_packet(struct kvaser_pciefd_can *can,if (skb) { cf->can_id |=CAN_ERR_BUSERROR ; - stats->rx_bytes += cf->len; - stats->rx_packets++;netif_rx (skb); }else { stats->rx_dropped++;
drivers/net/can/m_can/m_can.c +0 -7
@@ -647,9 +647,6 @@ static int m_can_handle_lec_err(struct net_device *dev,break ; } - stats->rx_packets++; - stats->rx_bytes += cf->len; -if (cdev->is_peripheral) timestamp =m_can_get_timestamp (cdev);
@@ -706,7 +703,6 @@ static int m_can_handle_state_change(struct net_device *dev, enum can_state new_state) {struct m_can_classdev *cdev =netdev_priv (dev); -struct net_device_stats *stats = &dev->stats;struct can_frame *cf;struct sk_buff *skb;struct can_berr_counter bec;
@@ -771,9 +767,6 @@ static int m_can_handle_state_change(struct net_device *dev,break ; } - stats->rx_packets++; - stats->rx_bytes += cf->len; -if (cdev->is_peripheral) timestamp =m_can_get_timestamp (cdev);
drivers/net/can/mscan/mscan.c +5 -4
@@ -401,13 +401,14 @@ static int mscan_rx_poll(struct napi_struct *napi, int quota)continue ; } -if (canrflg &MSCAN_RXF ) +if (canrflg &MSCAN_RXF ) {mscan_get_rx_frame (dev, frame); -else if (canrflg &MSCAN_ERR_IF ) + stats->rx_packets++; + stats->rx_bytes += frame->len; + }else if (canrflg &MSCAN_ERR_IF ) {mscan_get_err_frame (dev, frame, canrflg); + } - stats->rx_packets++; - stats->rx_bytes += frame->len; work_done++;netif_receive_skb (skb); }
drivers/net/can/pch_can.c +0 -3
@@ -561,9 +561,6 @@ static void pch_can_error(struct net_device *ndev, u32 status) priv->can.state = state;netif_receive_skb (skb); - - stats->rx_packets++; - stats->rx_bytes += cf->len; }static irqreturn_t pch_can_interrupt (int irq,void *dev_id)
drivers/net/can/peak_canfd/peak_canfd.c +0 -4
@@ -409,8 +409,6 @@ static int pucan_handle_status(struct peak_canfd_priv *priv,return -ENOMEM ; } - stats->rx_packets++; - stats->rx_bytes += cf->len;pucan_netif_rx (skb, msg->ts_low, msg->ts_high);return 0 ;
@@ -438,8 +436,6 @@ static int pucan_handle_cache_critical(struct peak_canfd_priv *priv) cf->data[6 ] = priv->bec.txerr; cf->data[7 ] = priv->bec.rxerr; - stats->rx_bytes += cf->len; - stats->rx_packets++;netif_rx (skb);return 0 ;
drivers/net/can/rcar/rcar_can.c +1 -5
@@ -223,7 +223,6 @@ static void tx_failure_cleanup(struct net_device *ndev)static void rcar_can_error (struct net_device *ndev) {struct rcar_can_priv *priv =netdev_priv (ndev); -struct net_device_stats *stats = &ndev->stats;struct can_frame *cf;struct sk_buff *skb;u8 eifr, txerr =0 , rxerr =0 ;
@@ -362,11 +361,8 @@ static void rcar_can_error(struct net_device *ndev) } } -if (skb) { - stats->rx_packets++; - stats->rx_bytes += cf->len; +if (skb)netif_rx (skb); - } }static void rcar_can_tx_done (struct net_device *ndev)
drivers/net/can/rcar/rcar_canfd.c +0 -4
@@ -1033,8 +1033,6 @@ static void rcar_canfd_error(struct net_device *ndev, u32 cerfl,/* Clear channel error interrupts that are handled */ rcar_canfd_write (priv->base,RCANFD_CERFL (ch),RCANFD_CERFL_ERR (~cerfl)); - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_rx (skb); }
@@ -1174,8 +1172,6 @@ static void rcar_canfd_state_change(struct net_device *ndev, rx_state = txerr <= rxerr ? state :0 ;can_change_state (ndev, cf, tx_state, rx_state); - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_rx (skb); } }
drivers/net/can/sja1000/sja1000.c +0 -2
@@ -487,8 +487,6 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)can_bus_off (dev); } - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_rx (skb);return 0 ;
drivers/net/can/sun4i_can.c +2 -5
@@ -622,13 +622,10 @@ static int sun4i_can_err(struct net_device *dev, u8 isrc, u8 status)can_bus_off (dev); } -if (likely (skb)) { - stats->rx_packets++; - stats->rx_bytes += cf->len; +if (likely (skb))netif_rx (skb); - }else { +else return -ENOMEM ; - }return 0 ; }
drivers/net/can/usb/ems_usb.c +0 -2
@@ -397,8 +397,6 @@ static void ems_usb_rx_err(struct ems_usb *dev, struct ems_cpc_msg *msg) stats->rx_errors++; } - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_rx (skb); }
drivers/net/can/usb/esd_usb2.c +0 -2
@@ -293,8 +293,6 @@ static void esd_usb2_rx_event(struct esd_usb2_net_priv *priv, priv->bec.txerr = txerr; priv->bec.rxerr = rxerr; - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_rx (skb); } }
drivers/net/can/usb/etas_es58x/es58x_core.c +0 -7
@@ -849,13 +849,6 @@ int es58x_rx_err_msg(struct net_device *netdev, enum es58x_err error,break ; } -/* driver/net/can/dev.c:can_restart() takes in account error -* messages in the RX stats. Doing the same here for -* consistency. -*/ - netdev->stats.rx_packets++; - netdev->stats.rx_bytes +=CAN_ERR_DLC ; -if (cf) {if (cf->data[1 ]) cf->can_id |=CAN_ERR_CRTL ;
drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +0 -2
@@ -279,8 +279,6 @@ int kvaser_usb_can_rx_over_error(struct net_device *netdev) cf->can_id |=CAN_ERR_CRTL ; cf->data[1 ] =CAN_ERR_CRTL_RX_OVERFLOW ; - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_rx (skb);return 0 ;
drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c +0 -8
@@ -869,7 +869,6 @@ static void kvaser_usb_hydra_update_state(struct kvaser_usb_net_priv *priv,struct net_device *netdev = priv->netdev;struct can_frame *cf;struct sk_buff *skb; -struct net_device_stats *stats;enum can_state new_state, old_state; old_state = priv->can.state;
@@ -919,9 +918,6 @@ static void kvaser_usb_hydra_update_state(struct kvaser_usb_net_priv *priv, cf->data[6 ] = bec->txerr; cf->data[7 ] = bec->rxerr; - stats = &netdev->stats; - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_rx (skb); }
@@ -1074,8 +1070,6 @@ kvaser_usb_hydra_error_frame(struct kvaser_usb_net_priv *priv, cf->data[6 ] = bec.txerr; cf->data[7 ] = bec.rxerr; - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_rx (skb); priv->bec.txerr = bec.txerr;
@@ -1109,8 +1103,6 @@ static void kvaser_usb_hydra_one_shot_fail(struct kvaser_usb_net_priv *priv, } stats->tx_errors++; - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_rx (skb); }
drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +0 -4
@@ -641,8 +641,6 @@ static void kvaser_usb_leaf_tx_acknowledge(const struct kvaser_usb *dev,if (skb) { cf->can_id |=CAN_ERR_RESTARTED ; - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_rx (skb); }else { netdev_err(priv->netdev,
@@ -843,8 +841,6 @@ static void kvaser_usb_leaf_rx_error(const struct kvaser_usb *dev, cf->data[6 ] = es->txerr; cf->data[7 ] = es->rxerr; - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_rx (skb); }
drivers/net/can/usb/peak_usb/pcan_usb.c +0 -2
@@ -520,8 +520,6 @@ static int pcan_usb_decode_error(struct pcan_usb_msg_context *mc, u8 n, &hwts->hwtstamp); } - mc->netdev->stats.rx_packets++; - mc->netdev->stats.rx_bytes += cf->len;netif_rx (skb);return 0 ;
drivers/net/can/usb/peak_usb/pcan_usb_fd.c +0 -3
@@ -577,9 +577,6 @@ static int pcan_usb_fd_decode_status(struct pcan_usb_fd_if *usb_if,if (!skb)return -ENOMEM ; - netdev->stats.rx_packets++; - netdev->stats.rx_bytes += cf->len; -peak_usb_netif_rx_64 (skb,le32_to_cpu (sm->ts_low),le32_to_cpu (sm->ts_high));
drivers/net/can/usb/peak_usb/pcan_usb_pro.c +0 -2
@@ -660,8 +660,6 @@ static int pcan_usb_pro_handle_error(struct pcan_usb_pro_interface *usb_if, hwts =skb_hwtstamps (skb);peak_usb_get_ts_time (&usb_if->time_ref,le32_to_cpu (er->ts32), &hwts->hwtstamp); - netdev->stats.rx_packets++; - netdev->stats.rx_bytes += can_frame->len;netif_rx (skb);return 0 ;
drivers/net/can/usb/ucan.c +4 -2
@@ -621,8 +621,10 @@ static void ucan_rx_can_msg(struct ucan_priv *up, struct ucan_message_in *m)memcpy (cf->data, m->msg.can_msg.data, cf->len);/* don't count error frames as real packets */ - stats->rx_packets++; - stats->rx_bytes += cf->len; +if (!(cf->can_id &CAN_ERR_FLAG )) { + stats->rx_packets++; + stats->rx_bytes += cf->len; + }/* pass it to Linux */ netif_rx (skb);
drivers/net/can/usb/usb_8dev.c +0 -2
@@ -449,8 +449,6 @@ static void usb_8dev_rx_err_msg(struct usb_8dev_priv *priv, priv->bec.txerr = txerr; priv->bec.rxerr = rxerr; - stats->rx_packets++; - stats->rx_bytes += cf->len;netif_rx (skb); }
drivers/net/can/xilinx_can.c +1 -8
@@ -965,13 +965,8 @@ static void xcan_update_error_state_after_rxtx(struct net_device *ndev)xcan_set_error_state (ndev, new_state, skb ? cf :NULL ); -if (skb) { -struct net_device_stats *stats = &ndev->stats; - - stats->rx_packets++; - stats->rx_bytes += cf->len; +if (skb)netif_rx (skb); - } } }
@@ -1095,8 +1090,6 @@ static void xcan_err_interrupt(struct net_device *ndev, u32 isr)if (skb) { skb_cf->can_id |= cf.can_id;memcpy (skb_cf->data, cf.data,CAN_ERR_DLC ); - stats->rx_packets++; - stats->rx_bytes +=CAN_ERR_DLC ;netif_rx (skb); } }
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 153/217 mt76: mt7915: fix SMPS operation fail
In reply to Sasha LevinFrom: Ryder Lee <[email protected]>
[ Upstream commit 8f05835425ce3f669e4b6d7c2c39a9aa22e1506c ]
TGn fails sending SM power save mode action frame to the AP to switch from dynamic SMPS mode to static mode.
--- .../net/wireless/mediatek/mt76/mt7915/mcu.c | 81 ++++++++++++------- .../net/wireless/mediatek/mt76/mt7915/mcu.h | 8 ++ 2 files changed, 61 insertions(+), 28 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +53 -28
@@ -1752,33 +1752,6 @@ int mt7915_mcu_sta_update_hdr_trans(struct mt7915_dev *dev, true); } -int mt7915_mcu_add_smps (struct mt7915_dev *dev,struct ieee80211_vif *vif, -struct ieee80211_sta *sta) -{ -struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; -struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; -struct wtbl_req_hdr *wtbl_hdr; -struct tlv *sta_wtbl; -struct sk_buff *skb; - - skb =mt7915_mcu_alloc_sta_req (dev, mvif, msta, -MT7915_STA_UPDATE_MAX_SIZE ); -if (IS_ERR (skb)) -return PTR_ERR (skb); - - sta_wtbl =mt7915_mcu_add_tlv (skb,STA_REC_WTBL ,sizeof (struct tlv )); - - wtbl_hdr =mt7915_mcu_alloc_wtbl_req (dev, msta,WTBL_SET , sta_wtbl, - &skb); -if (IS_ERR (wtbl_hdr)) -return PTR_ERR (wtbl_hdr); - -mt7915_mcu_wtbl_smps_tlv (skb, sta, sta_wtbl, wtbl_hdr); - -return mt76_mcu_skb_send_msg (&dev->mt76, skb, -MCU_EXT_CMD (STA_REC_UPDATE ), true); -} -static inline bool mt7915_is_ebf_supported (struct mt7915_phy *phy,struct ieee80211_vif *vif,struct ieee80211_sta *sta,bool bfee)
@@ -2049,6 +2022,21 @@ mt7915_mcu_sta_bfee_tlv(struct mt7915_dev *dev, struct sk_buff *skb, bfee->fb_identity_matrix = (nrow ==1 && tx_ant ==2 ); } +static enum mcu_mmps_mode +mt7915_mcu_get_mmps_mode (enum ieee80211_smps_mode smps) +{ +switch (smps) { +case IEEE80211_SMPS_OFF : +return MCU_MMPS_DISABLE ; +case IEEE80211_SMPS_STATIC : +return MCU_MMPS_STATIC ; +case IEEE80211_SMPS_DYNAMIC : +return MCU_MMPS_DYNAMIC ; +default : +return MCU_MMPS_DISABLE ; + } +} + int mt7915_mcu_set_fixed_rate_ctrl(struct mt7915_dev *dev, struct ieee80211_vif *vif, struct ieee80211_sta *sta,
@@ -2076,7 +2064,11 @@ int mt7915_mcu_set_fixed_rate_ctrl(struct mt7915_dev *dev,case RATE_PARAM_FIXED_MCS :case RATE_PARAM_FIXED_GI :case RATE_PARAM_FIXED_HE_LTF : - ra->phy = *phy; +if (phy) + ra->phy = *phy; +break ; +case RATE_PARAM_MMPS_UPDATE : + ra->mmps_mode =mt7915_mcu_get_mmps_mode (sta->smps_mode);break ;default :break ;
@@ -2087,6 +2079,39 @@ int mt7915_mcu_set_fixed_rate_ctrl(struct mt7915_dev *dev, MCU_EXT_CMD(STA_REC_UPDATE), true); } +int mt7915_mcu_add_smps (struct mt7915_dev *dev,struct ieee80211_vif *vif, +struct ieee80211_sta *sta) +{ +struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; +struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; +struct wtbl_req_hdr *wtbl_hdr; +struct tlv *sta_wtbl; +struct sk_buff *skb; +int ret; + + skb =mt7915_mcu_alloc_sta_req (dev, mvif, msta, +MT7915_STA_UPDATE_MAX_SIZE ); +if (IS_ERR (skb)) +return PTR_ERR (skb); + + sta_wtbl =mt7915_mcu_add_tlv (skb,STA_REC_WTBL ,sizeof (struct tlv )); + + wtbl_hdr =mt7915_mcu_alloc_wtbl_req (dev, msta,WTBL_SET , sta_wtbl, + &skb); +if (IS_ERR (wtbl_hdr)) +return PTR_ERR (wtbl_hdr); + +mt7915_mcu_wtbl_smps_tlv (skb, sta, sta_wtbl, wtbl_hdr); + + ret =mt76_mcu_skb_send_msg (&dev->mt76, skb, +MCU_EXT_CMD (STA_REC_UPDATE ), true); +if (ret) +return ret; + +return mt7915_mcu_set_fixed_rate_ctrl (dev, vif, sta,NULL , +RATE_PARAM_MMPS_UPDATE ); +} + static int mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev, struct ieee80211_vif *vif,
drivers/net/wireless/mediatek/mt76/mt7915/mcu.h +8 -0
@@ -365,6 +365,13 @@ enum { MCU_PHY_STATE_OFDMLQ_CNINFO, }; +enum mcu_mmps_mode { +MCU_MMPS_STATIC , +MCU_MMPS_DYNAMIC , +MCU_MMPS_RSV , +MCU_MMPS_DISABLE , +}; +#define STA_TYPE_STA BIT(0)#define STA_TYPE_AP BIT(1)#define STA_TYPE_ADHOC BIT(2)
@@ -960,6 +967,7 @@ struct sta_rec_ra_fixed {enum {RATE_PARAM_FIXED =3 , +RATE_PARAM_MMPS_UPDATE =5 ,RATE_PARAM_FIXED_HE_LTF =7 ,RATE_PARAM_FIXED_MCS ,RATE_PARAM_FIXED_GI =11 ,
Signature · 1 line
2.34.1
Sasha Levin
maintainerPATCH 114/217 net: phy: prefer 1000baseT over 1000baseKX
In reply to Sasha LevinFrom: "Russell King (Oracle)" <[email protected]>
[ Upstream commit f20f94f7f52c4685c81754f489ffcc72186e8bdb ]
The PHY settings table is supposed to be sorted by descending match priority - in other words, earlier entries are preferred over later entries.
The order of 1000baseKX/Full and 1000baseT/Full is such that we prefer 1000baseKX/Full over 1000baseT/Full, but 1000baseKX/Full is a lot rarer than 1000baseT/Full, and thus is much less likely to be preferred.
This causes phylink problems - it means a fixed link specifying a speed of 1G and full duplex gets an ethtool linkmode of 1000baseKX/Full rather than 1000baseT/Full as would be expected - and since we offer userspace a software emulation of a conventional copper PHY, we want to offer copper modes in preference to anything else. However, we do still want to allow the rarer modes as well.
Hence, let's reorder these two modes to prefer copper.
--- drivers/net/phy/phy-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phy-core.c +1 -1
@@ -162,11 +162,11 @@ static const struct phy_setting settings[] = { PHY_SETTING( 2500, FULL, 2500baseT_Full ), PHY_SETTING( 2500, FULL, 2500baseX_Full ),/* 1G */ - PHY_SETTING( 1000, FULL, 1000baseKX_Full ), PHY_SETTING( 1000, FULL, 1000baseT_Full ), PHY_SETTING( 1000, HALF, 1000baseT_Half ), PHY_SETTING( 1000, FULL, 1000baseT1_Full ), PHY_SETTING( 1000, FULL, 1000baseX_Full ), + PHY_SETTING( 1000, FULL, 1000baseKX_Full ),/* 100M */ PHY_SETTING( 100, FULL, 100baseT_Full ), PHY_SETTING( 100, FULL, 100baseT1_Full ),
Signature · 1 line
2.34.1