7.3.6-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 66/2651 drm/omap: dsi: avoid sending bta sync all the time in writes
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Kemnade <[email protected]>
[ Upstream commit 20207f78382ff339f3a7f7c5db2c0219b157d32a ]
Some chips need configuration commands to be sent first, before they can send data. TC358762 for example needs PPI_LPTXTIMECNT configured and PPI_STARTPPI set to 1 to be able to transmit anything. To be able to configure such chips, do not send bta sync during writes if no acks are requested. Instead just wait for the packet to be sent to avoid FIFO overflows. There might be more to do about acks, but there seem to be virtually no users of that flag.
This came to light when fiddling with the Epson Moverio BT-200 display which consists of 2 TC358762 bridges with SPI funneled through to the unknown display chip. With that patch the bridge can be accessed, Reading back registers works, when the above-mentioned registers are set.
In Command-Mode update, there was a nop sent, apparently the most relevant part was the bta sync to actually force low power mode.
Video mode panel at OMAP4 (BT-200) and video mode at OMAP5 was tested.
--- drivers/gpu/drm/omapdrm/dss/dsi.c | 63 +++++++++++++++---------------- 1 file changed, 31 insertions(+), 32 deletions(-)
drivers/gpu/drm/omapdrm/dss/dsi.c +31 -32
@@ -59,9 +59,6 @@ static void dsi_uninit_dispc(struct dsi_data *dsi);static int dsi_vc_send_null (struct dsi_data *dsi,int vc,int channel); -static ssize_t _omap_dsi_host_transfer (struct dsi_data *dsi,int vc, -const struct mipi_dsi_msg *msg); -#ifdef DSI_PERF_MEASURE static bool dsi_perf;module_param (dsi_perf, bool,0644 );
@@ -2190,28 +2187,45 @@ static int dsi_vc_send_null(struct dsi_data *dsi, int vc, int channel)static int dsi_vc_write_common (struct omap_dss_device *dssdev,int vc,const struct mipi_dsi_msg *msg) { +DECLARE_COMPLETION_ONSTACK (completion);struct dsi_data *dsi =to_dsi_data (dssdev); +u32 err;int r; +/* wait for IRQ for packet transmission confirmation */ + r =dsi_register_isr_vc (dsi, vc, dsi_completion_handler, + &completion,DSI_VC_IRQ_PACKET_SENT ); +if (r) +return r; +if (mipi_dsi_packet_format_is_short (msg->type)) r =dsi_vc_send_short (dsi, vc, msg);else r =dsi_vc_send_long (dsi, vc, msg); -if (r <0 ) +if ((!r) &&wait_for_completion_timeout (&completion, +msecs_to_jiffies (500 )) ==0 ) + r = -EIO ; + +dsi_unregister_isr_vc (dsi, vc, dsi_completion_handler, + &completion,DSI_VC_IRQ_PACKET_SENT ); +if (r)return r; -/* -* TODO: we do not always have to do the BTA sync, for example -* we can improve performance by setting the update window -* information without sending BTA sync between the commands. -* In that case we can return early. -*/ +/* TODO: find out if more needs to be done for MIPI_DSI_MSG_REQ_ACK */ - r =dsi_vc_send_bta_sync (dssdev, vc); -if (r) { -DSSERR ("bta sync failed\n" ); -return r; +if (msg->flags &MIPI_DSI_MSG_REQ_ACK ) { + r =dsi_vc_send_bta_sync (dssdev, vc); +if (r) { +DSSERR ("bta sync failed\n" ); +return r; + } + }else { + err =dsi_get_errors (dsi); +if (err) { +DSSERR ("Error while sending: %x\n" , err); +return -EIO ; + } }/* RX_FIFO_NOT_EMPTY */
@@ -3229,21 +3243,6 @@ static int _dsi_update(struct dsi_data *dsi)return 0 ; } -static int _dsi_send_nop (struct dsi_data *dsi,int vc,int channel) -{ -const u8 payload[] = {MIPI_DCS_NOP }; -const struct mipi_dsi_msg msg = { - .channel = channel, - .type =MIPI_DSI_DCS_SHORT_WRITE , - .tx_len =1 , - .tx_buf = payload, - }; - -WARN_ON (!dsi_bus_is_locked (dsi)); - -return _omap_dsi_host_transfer (dsi, vc, &msg); -} -static int dsi_update_channel (struct omap_dss_device *dssdev,int vc) {struct dsi_data *dsi =to_dsi_data (dssdev);
@@ -3264,13 +3263,13 @@ static int dsi_update_channel(struct omap_dss_device *dssdev, int vc)DSSDBG ("dsi_update_channel: %d" , vc);/* -* Send NOP between the frames. If we don't send something here, the +* Transition to LP here. If we don't send something here, the * updates stop working. This is probably related to DSI spec stating * that the DSI host should transition to LP at least once per frame. */ - r =_dsi_send_nop (dsi,VC_CMD , dsi->dsidev->channel); + r =dsi_vc_send_bta_sync (dssdev,VC_CMD );if (r <0 ) { -DSSWARN ("failed to send nop between frames: %d\n" , r); +DSSWARN ("failed to send bta sync between frames: %d\n" , r); goto err; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 67/2651 drm: of: Fix drm_of_get_data_lanes_count_ep() return value documentation
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
[ Upstream commit e3eca845ef7d6cd8c407f9b42beb45af94ff096b ]
Update drm_of_get_data_lanes_count_ep() return value documentation to match the drm_of_get_data_lanes_count() return value documentation. The drm_of_get_data_lanes_count_ep() is only a wrapper around the drm_of_get_data_lanes_count() and therefore returns the same error codes.
Simplify the return code description of drm_of_get_data_lanes_count() and drm_of_get_data_lanes_count_ep() to -ENODATA and -EINVAL.
--- drivers/gpu/drm/drm_of.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_of.c +4 -4
@@ -550,8 +550,8 @@ EXPORT_SYMBOL_GPL(drm_of_lvds_get_data_mapping);* * Return: * * min..max - positive integer count of "data-lanes" elements -* * -ve - the "data-lanes" property is missing or invalid -* * -EINVAL - the "data-lanes" property is unsupported +* * -ENODATA - the property does not have a value. +* * -EINVAL - the "data-lanes" property is missing or invalid */ int drm_of_get_data_lanes_count (const struct device_node *endpoint,const unsigned int min,const unsigned int max)
@@ -582,8 +582,8 @@ EXPORT_SYMBOL_GPL(drm_of_get_data_lanes_count);* * Return: * * min..max - positive integer count of "data-lanes" elements -* * -EINVAL - the "data-mapping" property is unsupported -* * -ENODEV - the "data-mapping" property is missing +* * -ENODATA - the property does not have a value. +* * -EINVAL - the "data-lanes" property is missing or invalid */ int drm_of_get_data_lanes_count_ep(const struct device_node *port, int port_reg, int reg,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 68/2651 libbpf: Avoid overflow in BTF.ext bounds check
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Darren Carreras <[email protected]>
[ Upstream commit e40f61a31688898e7cf81e91074a42f805883e4d ]
A malformed BTF.ext subsection length in an ELF input can wrap the pointer addition used by btf_ext_parse_sec_info() on 32-bit builds. The wrapped pointer passes the bounds check and parsing then reads beyond the copied BTF.ext data.
Ensure the header fits in the copied data, then validate the subsection offset and length with subtraction before forming its pointer.
--- tools/lib/bpf/btf.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
tools/lib/bpf/btf.c +9 -5
@@ -3364,7 +3364,7 @@ static int btf_ext_parse_sec_info(struct btf_ext *btf_ext, {const struct btf_ext_info_sec *sinfo;struct btf_ext_info *ext_info; -__u32 info_left, record_size; +__u32 data_left, info_left, record_size;size_t sec_cnt =0 ;void *info;
@@ -3377,16 +3377,20 @@ static int btf_ext_parse_sec_info(struct btf_ext *btf_ext,return -EINVAL ; } -/* The start of the info sec (including the __u32 record_size). */ - info = btf_ext->data + btf_ext->hdr->hdr_len + ext_sec->off; - info_left = ext_sec->len; +if (btf_ext->hdr->hdr_len > btf_ext->data_size) +return -EINVAL ; -if (btf_ext->data + btf_ext->data_size < info + ext_sec->len) { + data_left = btf_ext->data_size - btf_ext->hdr->hdr_len; +if (ext_sec->off > data_left || ext_sec->len > data_left - ext_sec->off) {pr_debug ("%s section (off:%u len:%u) is beyond the end of the ELF section .BTF.ext\n" , ext_sec->desc, ext_sec->off, ext_sec->len);return -EINVAL ; } +/* The start of the info sec (including the __u32 record_size). */ + info = btf_ext->data + btf_ext->hdr->hdr_len + ext_sec->off; + info_left = ext_sec->len; +/* At least a record size */ if (info_left <sizeof (__u32)) {pr_debug (".BTF.ext %s record size not found\n" , ext_sec->desc);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 69/2651 selftests/bpf: Allocate a larger timeout for connection
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexis Lothoré (eBPF Foundation) <[email protected]>
[ Upstream commit 669e4fa766000ae4137bb02eb22ce75ba78ad32d ]
Some tests, like tc_tunnel or tc_edt, sporadically fail in CI with the following logs:
(network_helpers.c:309: errno: Operation now in progress) \
Failed to connect to server
send_and_test_data:FAIL:connect to server unexpected error: -115
This is due to SO_RCVTIMEO and SO_SNDTIMEO being set on the client socket (see settimeo() in client_socket()), allowing connect() to return an error and to set errno to EINPROGRESS instead of ETIMEDOUT. Increasing the timeout value for those tests is likely not a good solution (and it has already been done by commit 2790db208b44 ("selftests/bpf: Improve tc_tunnel test reliability")): some tests expect some data transfer to fail, and so the timeout value would increase overall test execution duration again (not only the connection, but any socket operation).
Another solution is to allocate a timeout budget specific to the
connection: we can apply a larger timeout only for connections, and once the connection is established, set back the timeout configured through opts->timeout_ms; this would allow connection to succeed under heavy CI load, while keeping timeout reasonable for the rest of the test traffic.
Create a dedicated connect helper that sets a large timeout for the connect step, tries to connect, and if successful, finally sets the timeout value to the one configured by the test.
--- tools/testing/selftests/bpf/network_helpers.c | 46 ++++++++++++++----- 1 file changed, 35 insertions(+), 11 deletions(-)
tools/testing/selftests/bpf/network_helpers.c +35 -11
@@ -49,6 +49,8 @@ errno = __save; \ }) +#define CONNECT_MIN_TIMEOUT_MS 5000 +struct ipv4_packet pkt_v4 = { .eth.h_proto =__bpf_constant_htons (ETH_P_IP ), .iph.ihl =5 ,
@@ -291,6 +293,37 @@ int client_socket(int family, int type,return -1 ; } +static int connect_with_timeout (int fd,const struct sockaddr_storage *addr, +socklen_t addrlen,int timeout_ms) +{ +int connect_timeout_ms =MAX (timeout_ms,CONNECT_MIN_TIMEOUT_MS ); + +/* +* Override timeout configuration with a larger value for the +* connection +*/ +if (settimeo (fd, connect_timeout_ms)) { +log_err ("Failed to set connect timeout" ); +return -1 ; + } + +if (connect (fd, (const struct sockaddr *)addr, addrlen)) { +log_err ("Failed to connect" ); +return -1 ; + } + +/* +* If the timeout configured by the test is different from the +* connect timeout, restore it +*/ +if (timeout_ms != connect_timeout_ms &&settimeo (fd, timeout_ms)) { +log_err ("Failed to set timeout for connected socket" ); +return -1 ; + } + +return 0 ; +} +int connect_to_addr (int type,const struct sockaddr_storage *addr,socklen_t addrlen,const struct network_helper_opts *opts) {
@@ -305,8 +338,7 @@ int connect_to_addr(int type, const struct sockaddr_storage *addr, socklen_t addreturn -1 ; } -if (connect (fd, (const struct sockaddr *)addr, addrlen)) { -log_err ("Failed to connect to server" ); +if (connect_with_timeout (fd, addr, addrlen, opts->timeout_ms)) {save_errno_close (fd);return -1 ; }
@@ -376,20 +408,12 @@ int connect_fd_to_fd(int client_fd, int server_fd, int timeout_ms)struct sockaddr_storage addr;socklen_t len =sizeof (addr); -if (settimeo (client_fd, timeout_ms)) -return -1 ; -if (getsockname (server_fd, (struct sockaddr *)&addr, &len)) {log_err ("Failed to get server addr" );return -1 ; } -if (connect (client_fd, (const struct sockaddr *)&addr, len)) { -log_err ("Failed to connect to server" ); -return -1 ; - } - -return 0 ; +return connect_with_timeout (client_fd, &addr, len, timeout_ms); } int make_sockaddr(int family, const char *addr_str, __u16 port,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 70/2651 gpu: nova-core: write initial RPCs before booting GSP-RM
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Timur Tabi <[email protected]>
[ Upstream commit 6556f7556d622dbbc5c936df9d39c2f33600adfb ]
Make sure that the two setup RPCs, SetSystemInfo and SetRegistry, are in the command queue before booting GSP-RM. These message are expected to already be present, because GSP-RM will process the queue early in boot but will silently ignore the error if absent. GSP-RM then continues booting, but since the registry is not set up, it fails to initialize.
--- drivers/gpu/nova-core/gsp/boot.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/nova-core/gsp/boot.rs +5 -5
@@ -44,6 +44,11 @@ pub(crate) fn boot(let gsp_fw =KBox ::pin_init (GspFirmware ::new (dev, chipset),GFP_KERNEL )?; + self.cmdq + .send_command_no_wait (bar, commands::SetSystemInfo ::new (pdev, chipset))?; + self.cmdq + .send_command_no_wait (bar, commands::SetRegistry ::new (ctx.vgpu.state ())?)?; +// Perform the chipset-specific boot sequence, and retrieve the unload bundle. let unload_bundle = hal.boot(&self, &mut ctx, &gsp_fw)?.or_else(|| { dev_warn!(dev, "The GSP won't be able to unload properly on unbind.\n");
@@ -73,11 +78,6 @@ pub(crate) fn boot(dev_dbg! (pdev,"RISC-V active? {}\n" , gsp_falcon.is_riscv_active (),); - self.cmdq - .send_command_no_wait (bar, commands::SetSystemInfo ::new (pdev, chipset))?; - self.cmdq - .send_command_no_wait (bar, commands::SetRegistry ::new (ctx.vgpu.state ())?)?; - hal.post_boot (&self, ctx, &gsp_fw)?;// Wait until GSP is fully initialized.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 71/2651 bpf: Roll back stream capacity when allocation fails
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jianlin Shi <[email protected]>
[ Upstream commit bd2466ed8fc2ee54408bfe433e75f9f46bfa04f7 ]
bpf_stream_push_str() accounts the string length before allocating a stream element. If the allocation fails, the length remains charged even though no element is queued and therefore cannot be released by a reader. Repeated failures can exhaust the stream capacity permanently until the BPF program is freed.
Refactor bpf_stream_release_capacity() to take a length so the consume and release sides are symmetric, and use it to roll back the charge when creating the stream element fails.
--- kernel/bpf/stream.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
kernel/bpf/stream.c +10 -5
@@ -68,10 +68,8 @@ static int bpf_stream_consume_capacity(struct bpf_stream *stream, int len)return 0 ; } -static void bpf_stream_release_capacity (struct bpf_stream *stream,struct bpf_stream_elem *elem) +static void bpf_stream_release_capacity (struct bpf_stream *stream,int len) { -int len = elem->total_len; -atomic_sub (len, &stream->capacity); }
@@ -79,7 +77,14 @@ static int bpf_stream_push_str(struct bpf_stream *stream, const char *str, int l {int ret =bpf_stream_consume_capacity (stream, len); -return ret ?:__bpf_stream_push_str (&stream->log, str, len); +if (ret) +return ret; + + ret =__bpf_stream_push_str (&stream->log, str, len); +if (ret) +bpf_stream_release_capacity (stream, len); + +return ret; }static struct bpf_stream *bpf_stream_get (enum bpf_stream_id stream_id,struct bpf_prog_aux *aux)
@@ -188,7 +193,7 @@ static int bpf_stream_read(struct bpf_stream *stream, void __user *buf, int len)if (cont)continue ;bpf_stream_backlog_pop (stream); -bpf_stream_release_capacity (stream, elem); +bpf_stream_release_capacity (stream, elem->total_len);bpf_stream_free_elem (elem); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 72/2651 bpf: Fix stream capacity leak in staging path
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jianlin Shi <[email protected]>
[ Upstream commit effa6370ba89e7839c9bfeb802d8f05d6843ddf1 ]
bpf_stream_stage_printk() increments ss->len before pushing the formatted string to the staging log. If element allocation fails, ss->len remains inflated and bpf_stream_stage_commit() permanently charges the stream capacity for data that was never queued.
Only account the string length after a successful push, and use vscnprintf() so the staged length is the truncated payload without the trailing NUL.
--- kernel/bpf/stream.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
kernel/bpf/stream.c +5 -4
@@ -316,17 +316,18 @@ int bpf_stream_stage_printk(struct bpf_stream_stage *ss, const char *fmt, ...) {struct bpf_bprintf_buffers *buf;va_list args; -int ret; +int len, ret;if (bpf_try_get_buffers (&buf))return -EBUSY ;va_start (args, fmt); - ret =vsnprintf (buf->buf,ARRAY_SIZE (buf->buf), fmt, args); + len =vscnprintf (buf->buf,ARRAY_SIZE (buf->buf), fmt, args);va_end (args); - ss->len += ret;/* Exclude NULL byte during push. */ - ret =__bpf_stream_push_str (&ss->log, buf->buf, ret); + ret =__bpf_stream_push_str (&ss->log, buf->buf, len); +if (!ret) + ss->len += len;bpf_put_buffers ();return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 73/2651 bpf: Return partial progress from bpf_stream_read on fault
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jianlin Shi <[email protected]>
[ Upstream commit 16790357a50baae10de1f619b608a85145d54bc2 ]
bpf_stream_read() pops and frees stream elements after a successful copy_to_user(). If a later copy_to_user() fails, it currently restores only the current element's consumed_len and returns -EFAULT, hiding bytes already delivered to userspace and making the consumed data unrecoverable on retry.
On a short copy, keep the successfully copied prefix of the current element and return the number of bytes copied. Return -EFAULT only when no bytes were copied for the call.
--- kernel/bpf/stream.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
kernel/bpf/stream.c +9 -7
@@ -167,6 +167,7 @@ static int bpf_stream_read(struct bpf_stream *stream, void __user *buf, int len)while (rem_len) {int pos = len - rem_len; +int chunk, n;bool cont; node =bpf_stream_backlog_peek (stream);
@@ -180,13 +181,14 @@ static int bpf_stream_read(struct bpf_stream *stream, void __user *buf, int len) cons_len = elem->consumed_len; cont =bpf_stream_consume_elem (elem, &rem_len) == false; - - ret =copy_to_user (buf + pos, elem->str + cons_len, - elem->consumed_len - cons_len); -/* Restore in case of error. */ -if (ret) { - ret = -EFAULT ; - elem->consumed_len = cons_len; + chunk = elem->consumed_len - cons_len; + + n =copy_to_user (buf + pos, elem->str + cons_len, chunk); +if (n) { +/* Keep any successfully copied bytes; -EFAULT only if none. */ + elem->consumed_len -= n; + rem_len += n; + ret = (len == rem_len) ? -EFAULT :0 ;break ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 74/2651 bpf: Reject oversized bpf_stream_vprintk output with -E2BIG
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jianlin Shi <[email protected]>
[ Upstream commit 41c0348f6e65c26df4866d5dc96c57b1995fe36c ]
bstr_printf() returns the would-be length excluding the trailing NUL. When that value is >= MAX_BPRINTF_BUF the message was truncated, but bpf_stream_push_str() still tried to allocate with the inflated length and failed with -ENOMEM. The boundary case of exactly MAX_BPRINTF_BUF could also copy the trailing NUL into the stream element.
Reject such lengths with -E2BIG before charging stream capacity, and tighten bpf_stream_elem_alloc() to accept only payloads strictly shorter than the bprintf buffer.
--- kernel/bpf/stream.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
kernel/bpf/stream.c +9 -4
@@ -22,11 +22,11 @@ static struct bpf_stream_elem *bpf_stream_elem_alloc(int len)size_t alloc_size;/* -* Length denotes the amount of data to be written as part of stream element, -* thus includes '\0' byte. We're capped by how much bpf_bprintf_buffers can -* accomodate, therefore deny allocations that won't fit into them. +* Length is the payload pushed into the stream, excluding the +* trailing NUL of the bprintf buffer. Reject anything that cannot +* fit without copying that NUL into the stream element. */ -if (len <0 || len > max_len) +if (len <0 || len >= max_len)return NULL ; alloc_size = offsetof(struct bpf_stream_elem, str[len]);
@@ -245,6 +245,11 @@ __bpf_kfunc int bpf_stream_vprintk(int stream_id, const char *fmt__str, const voreturn ret; ret =bstr_printf (data.buf,MAX_BPRINTF_BUF , fmt__str, data.bin_args); +/* Truncation: reject before capacity charge (not -ENOMEM). */ +if (ret >=MAX_BPRINTF_BUF ) { +bpf_bprintf_cleanup (&data); +return -E2BIG ; + }/* Exclude NULL byte during push. */ ret =bpf_stream_push_str (stream, data.buf, ret);bpf_bprintf_cleanup (&data);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 75/2651 drm/panthor: Add tracepoint for cache flushing
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Frattaroli <[email protected]>
[ Upstream commit 3fc4721629c40bb5f7bc7696875a9df633e6a35a ]
Add a new event tracepoint: gpu_cache_flush to be emitted after a GPU cache flush completes, with duration and return status arguments.
This allows debugging the duration a flush takes irrespective of initial function entry lock contention, and communicates information about whether the flush timed out or errored out in other ways, and which caches were flushed.
Stable-dep-of: 4fd08b3d1da7 ("drm/panthor: Revisit reqs_lock handling in flush/reset paths")
--- drivers/gpu/drm/panthor/panthor_gpu.c | 26 ++++++++++++++++- drivers/gpu/drm/panthor/panthor_trace.h | 38 +++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-)
drivers/gpu/drm/panthor/panthor_gpu.c +25 -1
@@ -317,6 +317,21 @@ int panthor_gpu_l2_power_on(struct panthor_device *ptdev)return panthor_gpu_power_on (ptdev,L2 ,1 ,20000 ); } +static inline void panthor_gpu_emit_flush_caches_tp (struct panthor_device *ptdev, +u64 start,u32 l2,u32 lsc, +u32 other,int ret) +{ +u32 duration; + +if (!tracepoint_enabled (gpu_cache_flush) || !start) +return ; + +if (check_sub_overflow (ktime_get_ns (), start, &duration)) + duration =U32_MAX ; + +trace_gpu_cache_flush (ptdev->base.dev, l2, lsc, other, duration, ret); +} +/** * panthor_gpu_flush_caches() - Flush caches * @ptdev: Device.
@@ -331,12 +346,17 @@ int panthor_gpu_flush_caches(struct panthor_device *ptdev, {struct panthor_gpu *gpu = ptdev->gpu;unsigned long flags; +u64 start =0 ;int ret =0 ;/* Serialize cache flush operations. */ guard (mutex)(&ptdev->gpu->cache_flush_lock);spin_lock_irqsave (&ptdev->gpu->reqs_lock, flags); + +if (tracepoint_enabled (gpu_cache_flush)) + start =ktime_get_ns (); +if (!(ptdev->gpu->pending_reqs &GPU_IRQ_CLEAN_CACHES_COMPLETED )) { ptdev->gpu->pending_reqs |=GPU_IRQ_CLEAN_CACHES_COMPLETED ;gpu_write (gpu->iomem,GPU_CMD ,GPU_FLUSH_CACHES (l2, lsc, other));
@@ -345,8 +365,10 @@ int panthor_gpu_flush_caches(struct panthor_device *ptdev, }spin_unlock_irqrestore (&ptdev->gpu->reqs_lock, flags); -if (ret) +if (ret) { +panthor_gpu_emit_flush_caches_tp (ptdev, start, l2, lsc, other, ret);return ret; + } if (!wait_event_timeout(ptdev->gpu->reqs_acked, !(ptdev->gpu->pending_reqs & GPU_IRQ_CLEAN_CACHES_COMPLETED),
@@ -360,6 +382,8 @@ int panthor_gpu_flush_caches(struct panthor_device *ptdev,spin_unlock_irqrestore (&ptdev->gpu->reqs_lock, flags); } +panthor_gpu_emit_flush_caches_tp (ptdev, start, l2, lsc, other, ret); +if (ret) {panthor_device_schedule_reset (ptdev);drm_err (&ptdev->base,"Flush caches timeout" );
drivers/gpu/drm/panthor/panthor_trace.h +38 -0
@@ -76,6 +76,44 @@ TRACE_EVENT(gpu_job_irq, __entry->events, __entry->duration_ns) ); +/** +* gpu_cache_flush - emitted after cache flush completes +* @dev: pointer to the &struct device, for printing the device name +* @l2: "l2" flush flags +* @lsc: "lsc" flush flags +* @other: "other" flush flags +* @duration_ns: how long the cache flush operation took, in nanoseconds +* @ret: return status, 0 == success, negative errno on error +* +* Begins measuring after any initial lock contention around the locks needed +* for flushing caches, but before the actual cache flush is requested. Stops +* measuring and is emitted after flush operation is over. +*/ +TRACE_EVENT (gpu_cache_flush, + TP_PROTO(const struct device *dev, u32 l2, u32 lsc, u32 other, + u32 duration_ns, int ret), +TP_ARGS (dev, l2, lsc, other, duration_ns, ret), +TP_STRUCT__entry ( + __string(dev_name, dev_name(dev)) + __field(u32, l2) + __field(u32, lsc) + __field(u32, other) + __field(u32, duration_ns) +__field (int, ret) + ), +TP_fast_assign ( + __assign_str(dev_name); + __entry->l2 = l2; + __entry->lsc = lsc; + __entry->other = other; + __entry->duration_ns = duration_ns; + __entry->ret = ret; + ), +TP_printk ("%s: l2=0x%x lsc=0x%x other=0x%x duration_ns=%u ret=%d" , +__get_str (dev_name), __entry->l2, __entry->lsc, + __entry->other, __entry->duration_ns, __entry->ret) +); +#endif /* __PANTHOR_TRACE_H__ */ #undef TRACE_INCLUDE_PATH
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 76/2651 drm/panthor: Revisit reqs_lock handling in flush/reset paths
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Frattaroli <[email protected]>
[ Upstream commit 4fd08b3d1da78e33cb5939f0086e61f9d660cd6c ]
panthor_gpu_flush_caches() and panthor_gpu_soft_reset() acquire their reqs_lock spinlock with the IRQ-disabling variants of the spinlocking functions. This isn't necessary, as the lock is never taken from an atomic context, as Panthor uses threaded interrupt handlers. The result of this overly strict locking is that IRQs may be disabled more frequently and for longer than they should be, resulting in increased system latency.
Switch the locking to use non-IRQ-disabling scoped_guard statements for locking. The wait_event_timeout read of pending_reqs outside of the spinlock is fine as wait_event_timeout is a memory barrier according to the Linux Memory Model.
--- drivers/gpu/drm/panthor/panthor_gpu.c | 72 ++++++++++++--------------- 1 file changed, 33 insertions(+), 39 deletions(-)
drivers/gpu/drm/panthor/panthor_gpu.c +33 -39
@@ -345,41 +345,36 @@ int panthor_gpu_flush_caches(struct panthor_device *ptdev, u32 l2, u32 lsc, u32 other) {struct panthor_gpu *gpu = ptdev->gpu; -unsigned long flags;u64 start =0 ;int ret =0 ;/* Serialize cache flush operations. */ guard (mutex)(&ptdev->gpu->cache_flush_lock); -spin_lock_irqsave (&ptdev->gpu->reqs_lock, flags); - -if (tracepoint_enabled (gpu_cache_flush)) - start =ktime_get_ns (); - -if (!(ptdev->gpu->pending_reqs &GPU_IRQ_CLEAN_CACHES_COMPLETED )) { - ptdev->gpu->pending_reqs |=GPU_IRQ_CLEAN_CACHES_COMPLETED ; -gpu_write (gpu->iomem,GPU_CMD ,GPU_FLUSH_CACHES (l2, lsc, other)); - }else { - ret = -EIO ; - } -spin_unlock_irqrestore (&ptdev->gpu->reqs_lock, flags); - -if (ret) { -panthor_gpu_emit_flush_caches_tp (ptdev, start, l2, lsc, other, ret); -return ret; + scoped_guard(spinlock, &ptdev->gpu->reqs_lock) { +if (tracepoint_enabled (gpu_cache_flush)) + start =ktime_get_ns (); + +if (!(ptdev->gpu->pending_reqs &GPU_IRQ_CLEAN_CACHES_COMPLETED )) { + ptdev->gpu->pending_reqs |=GPU_IRQ_CLEAN_CACHES_COMPLETED ; +gpu_write (gpu->iomem,GPU_CMD ,GPU_FLUSH_CACHES (l2, lsc, other)); + }else { +panthor_gpu_emit_flush_caches_tp (ptdev, start, l2, lsc, + other, -EIO ); +return -EIO ; + } }if (!wait_event_timeout (ptdev->gpu->reqs_acked, !(ptdev->gpu->pending_reqs &GPU_IRQ_CLEAN_CACHES_COMPLETED ),msecs_to_jiffies (100 ))) { -spin_lock_irqsave (&ptdev->gpu->reqs_lock, flags); -if ((ptdev->gpu->pending_reqs &GPU_IRQ_CLEAN_CACHES_COMPLETED ) !=0 && - !(gpu_read (gpu->irq.iomem,INT_RAWSTAT ) &GPU_IRQ_CLEAN_CACHES_COMPLETED )) - ret = -ETIMEDOUT ; -else - ptdev->gpu->pending_reqs &= ~GPU_IRQ_CLEAN_CACHES_COMPLETED ; -spin_unlock_irqrestore (&ptdev->gpu->reqs_lock, flags); + scoped_guard(spinlock, &ptdev->gpu->reqs_lock) { +if ((ptdev->gpu->pending_reqs &GPU_IRQ_CLEAN_CACHES_COMPLETED ) !=0 && + !(gpu_read (gpu->irq.iomem,INT_RAWSTAT ) &GPU_IRQ_CLEAN_CACHES_COMPLETED )) + ret = -ETIMEDOUT ; +else + ptdev->gpu->pending_reqs &= ~GPU_IRQ_CLEAN_CACHES_COMPLETED ; + } }panthor_gpu_emit_flush_caches_tp (ptdev, start, l2, lsc, other, ret);
@@ -402,27 +397,26 @@ int panthor_gpu_soft_reset(struct panthor_device *ptdev) {struct panthor_gpu *gpu = ptdev->gpu;bool timedout = false; -unsigned long flags; -spin_lock_irqsave (&ptdev->gpu->reqs_lock, flags); -if (!drm_WARN_ON (&ptdev->base, - ptdev->gpu->pending_reqs &GPU_IRQ_RESET_COMPLETED )) { - ptdev->gpu->pending_reqs |=GPU_IRQ_RESET_COMPLETED ; -gpu_write (gpu->irq.iomem,INT_CLEAR ,GPU_IRQ_RESET_COMPLETED ); -gpu_write (gpu->iomem,GPU_CMD ,GPU_SOFT_RESET ); + scoped_guard(spinlock, &ptdev->gpu->reqs_lock) { +if (!drm_WARN_ON (&ptdev->base, + ptdev->gpu->pending_reqs &GPU_IRQ_RESET_COMPLETED )) { + ptdev->gpu->pending_reqs |=GPU_IRQ_RESET_COMPLETED ; +gpu_write (gpu->irq.iomem,INT_CLEAR ,GPU_IRQ_RESET_COMPLETED ); +gpu_write (gpu->iomem,GPU_CMD ,GPU_SOFT_RESET ); + } } -spin_unlock_irqrestore (&ptdev->gpu->reqs_lock, flags);if (!wait_event_timeout (ptdev->gpu->reqs_acked, !(ptdev->gpu->pending_reqs &GPU_IRQ_RESET_COMPLETED ),msecs_to_jiffies (100 ))) { -spin_lock_irqsave (&ptdev->gpu->reqs_lock, flags); -if ((ptdev->gpu->pending_reqs &GPU_IRQ_RESET_COMPLETED ) !=0 && - !(gpu_read (gpu->irq.iomem,INT_RAWSTAT ) &GPU_IRQ_RESET_COMPLETED )) - timedout = true; -else - ptdev->gpu->pending_reqs &= ~GPU_IRQ_RESET_COMPLETED ; -spin_unlock_irqrestore (&ptdev->gpu->reqs_lock, flags); + scoped_guard(spinlock, &ptdev->gpu->reqs_lock) { +if ((ptdev->gpu->pending_reqs &GPU_IRQ_RESET_COMPLETED ) !=0 && + !(gpu_read (gpu->irq.iomem,INT_RAWSTAT ) &GPU_IRQ_RESET_COMPLETED )) + timedout = true; +else + ptdev->gpu->pending_reqs &= ~GPU_IRQ_RESET_COMPLETED ; + } }if (timedout) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 77/2651 drm/panthor: Take reqs_lock in soft_reset for clearing pending_reqs
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Frattaroli <[email protected]>
[ Upstream commit 2d354adc5bbabe2e818be09bbe13f6bfde4a30c7 ]
panthor_gpu_soft_reset() sets pending_reqs to 0 without taking the requisite reqs_lock.
Fix this by taking the lock for the duration of the modification.
--- drivers/gpu/drm/panthor/panthor_gpu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/panthor/panthor_gpu.c +4 -1
@@ -424,7 +424,10 @@ int panthor_gpu_soft_reset(struct panthor_device *ptdev)return -ETIMEDOUT ; } - ptdev->gpu->pending_reqs =0 ; + scoped_guard(spinlock, &ptdev->gpu->reqs_lock) { + ptdev->gpu->pending_reqs =0 ; + } +return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 78/2651 bpf: Reject oversized stream read buffers
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kumar Kartikeya Dwivedi <[email protected]>
[ Upstream commit ea0b60fae724aa1147d4a07eda5131d3a9a9977e ]
BPF_PROG_STREAM_READ_BY_FD exposes stream_buf_len as a u32, but the internal stream reader accepts an int. Values above INT_MAX therefore become negative before bpf_stream_read(), producing negative consumption lengths. The generic usercopy size check prevents the oversized copy, but emits a warning and reports EFAULT for an unchecked argument.
Change bpf_prog_stream_read() to accept u32 and reject values that the signed reader cannot represent.
--- include/linux/bpf.h | 2 +- kernel/bpf/stream.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-)
include/linux/bpf.h +1 -1
@@ -4140,7 +4140,7 @@ void bpf_put_buffers(void);void bpf_prog_stream_init (struct bpf_prog *prog);void bpf_prog_stream_free (struct bpf_prog *prog); -int bpf_prog_stream_read (struct bpf_prog *prog,enum bpf_stream_id stream_id,void __user *buf,int len); +int bpf_prog_stream_read (struct bpf_prog *prog,enum bpf_stream_id stream_id,void __user *buf,u32 len);void bpf_stream_stage_init (struct bpf_stream_stage *ss);void bpf_stream_stage_free (struct bpf_stream_stage *ss);__printf (2 ,3 )
kernel/bpf/stream.c +3 -1
@@ -203,13 +203,15 @@ static int bpf_stream_read(struct bpf_stream *stream, void __user *buf, int len)return ret ? ret : len - rem_len; } -int bpf_prog_stream_read (struct bpf_prog *prog,enum bpf_stream_id stream_id,void __user *buf,int len) +int bpf_prog_stream_read (struct bpf_prog *prog,enum bpf_stream_id stream_id,void __user *buf,u32 len) {struct bpf_stream *stream; stream =bpf_stream_get (stream_id, prog->aux);if (!stream)return -ENOENT ; +if (len >INT_MAX ) +return -EINVAL ;return bpf_stream_read (stream, buf, len); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 79/2651 libbpf: Fix usdt attach failure when nop10 crosses page boundary
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiayuan Chen <[email protected]>
[ Upstream commit 8b94878b2572f0f41e6002d0fe2cc4086ddc2a47 ]
The kernel refuses to attach to a nop10 that crosses a page boundary, since it can't be atomically rewritten:
/* can_optimize(), arch/x86/kernel/uprobes.c */ /* We can't do cross page atomic writes yet. */ return PAGE_SIZE - (vaddr & ~PAGE_MASK) >= OPT_INSN_SIZE;
Whether the nop10 crosses a page is purely up to the binary layout, so this does happen in practice. libbpf doesn't check for it and blindly shifts the uprobe onto the nop10, and the attach then fails with -ENOTSUPP. Just keep the uprobe on the preceding 1-byte nop in that case, it works everywhere as a regular int3 uprobe.
--- tools/lib/bpf/usdt.c | 4 ++++ 1 file changed, 4 insertions(+)
tools/lib/bpf/usdt.c +4 -0
@@ -608,8 +608,12 @@ static bool has_nop_combo(int fd, long off)unsigned char nop_combo[11 ] = {0x90 ,0x66 ,0x2e ,0x0f ,0x1f ,0x84 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , }; +long page_sz =getpagesize ();unsigned char buf[11 ]; +/* the kernel can't attach to a nop10 that crosses a page boundary */ +if ((off +1 ) % page_sz +10 > page_sz) +return false;if (pread (fd, buf,11 , off) !=11 )return false;return memcmp (buf, nop_combo,11 ) ==0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 80/2651 drm/amd/pm: Remove unused functions in smu_v15_0
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivasan Shanmugam <[email protected]>
[ Upstream commit f65ae77aac72caed6d99c7d73f16b71cebbc6753 ]
smu_v15_0_load_microcode() and smu_v15_0_set_single_dpm_table() are not called anywhere; the latter is a carry-over from a previous version. The static helpers smu_v15_0_get_dpm_freq_by_index(), smu_v15_0_get_dpm_level_count() and smu_v15_0_get_fine_grained_status() were only called from smu_v15_0_set_single_dpm_table(), so remove those as well. Remove all functions along with their declarations from the header.
--- drivers/gpu/drm/amd/pm/swsmu/inc/smu_v15_0.h | 6 - .../gpu/drm/amd/pm/swsmu/smu15/smu_v15_0.c | 166 ------------------ 2 files changed, 172 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/inc/smu_v15_0.h +0 -6
@@ -113,8 +113,6 @@ int smu_v15_0_init_microcode(struct smu_context *smu);void smu_v15_0_fini_microcode (struct smu_context *smu); -int smu_v15_0_load_microcode (struct smu_context *smu); -int smu_v15_0_init_smc_tables (struct smu_context *smu);int smu_v15_0_fini_smc_tables (struct smu_context *smu);
@@ -183,10 +181,6 @@ int smu_v15_0_set_performance_level(struct smu_context *smu,int smu_v15_0_set_power_source (struct smu_context *smu,enum smu_power_src_type power_src); -int smu_v15_0_set_single_dpm_table (struct smu_context *smu, -enum smu_clk_type clk_type, -struct smu_dpm_table *single_dpm_table); -int smu_v15_0_gfx_ulv_control (struct smu_context *smu,bool enablement);
drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0.c +0 -166
178 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 81/2651 gpio: pcf857x: implement get_direction()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tapio Reijonen <[email protected]>
[ Upstream commit ed14364ae8c310cc3f3f649ffcbc7f82befe1579 ]
The GPIO core warns (and taints the kernel) when a gpiochip lacks .get_direction() and a consumer queries a line's direction, for example via /sys/kernel/debug/gpio. pcf857x provided direction_input/output but no get_direction.
These quasi-bidirectional expanders cannot report direction in hardware, and the 'out' software latch alone is ambiguous - a released (input) line and an output driven high both read back as a set bit. Track the direction explicitly in a 'dir' latch updated by the direction_input(), direction_output() and set_multiple() paths, and return it from get_direction(). Initialise it from the same reset state as 'out':
released lines are inputs, lines flagged in the power-on latch are driven-low outputs.
--- drivers/gpio/gpio-pcf857x.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/gpio/gpio-pcf857x.c +15 -1
@@ -71,8 +71,9 @@ MODULE_DEVICE_TABLE(of, pcf857x_of_table);struct pcf857x {struct gpio_chip chip;struct i2c_client *client; -struct mutex lock;/* protect 'out' */ +struct mutex lock;/* protect 'out' and 'dir' */ unsigned int out;/* software latch */ +unsigned int dir;/* direction latch (1 = input) */ unsigned int status;/* current status */ unsigned int irq_enabled;/* enabled irqs */
@@ -126,12 +127,21 @@ static int pcf857x_input(struct gpio_chip *chip, unsigned int offset)mutex_lock (&gpio->lock); gpio->out |= (1 << offset); + gpio->dir |= (1 << offset); status = gpio->write (gpio->client, gpio->out);mutex_unlock (&gpio->lock);return status; } +static int pcf857x_get_direction (struct gpio_chip *chip,unsigned int offset) +{ +struct pcf857x *gpio =gpiochip_get_data (chip); + +return (gpio->dir & (1 << offset)) ?GPIO_LINE_DIRECTION_IN + :GPIO_LINE_DIRECTION_OUT ; +} +static int pcf857x_get (struct gpio_chip *chip,unsigned int offset) {struct pcf857x *gpio =gpiochip_get_data (chip);
@@ -167,6 +177,7 @@ static int pcf857x_output(struct gpio_chip *chip, unsigned int offset, int value gpio->out |= bit; else gpio->out &= ~bit; + gpio->dir &= ~bit; status = gpio->write (gpio->client, gpio->out);mutex_unlock (&gpio->lock);
@@ -187,6 +198,7 @@ static int pcf857x_set_multiple(struct gpio_chip *chip, unsigned long *mask,mutex_lock (&gpio->lock); gpio->out &= ~*mask; gpio->out |= *bits & *mask; + gpio->dir &= ~*mask; status = gpio->write (gpio->client, gpio->out);mutex_unlock (&gpio->lock);
@@ -301,6 +313,7 @@ static int pcf857x_probe(struct i2c_client *client) gpio->chip.set_multiple = pcf857x_set_multiple; gpio->chip.direction_input = pcf857x_input; gpio->chip.direction_output = pcf857x_output; + gpio->chip.get_direction = pcf857x_get_direction; gpio->chip.ngpio = (uintptr_t )i2c_get_match_data (client); reset_gpio =devm_gpiod_get_optional (&client->dev,"reset" ,GPIOD_OUT_HIGH );
@@ -396,6 +409,7 @@ static int pcf857x_probe(struct i2c_client *client)* reset state. Otherwise it flags pins to be driven low. */ gpio->out = ~n_latch; + gpio->dir = ~n_latch; gpio->status = gpio->read (gpio->client);/* Enable irqchip if we have an interrupt */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 82/2651 drm/vkms: Fix limited-range YCbCr to RGB conversion scaling
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harry Wentland <[email protected]>
[ Upstream commit 8af5fccd9e8af443efd6f0fec5ba56366f57309a ]
The limited-/studio-range YCbCr to RGB conversion matrices were generated with colour.matrix_YCbCr(is_legal=True, bits=8), which normalises the narrow range by 2^bits (256 for 8-bit) rather than by the full-range maximum 2^bits - 1 (255). As a result the luma scale was 256/219 and the chroma scale 256/224 instead of the correct 255/219 and 255/224.
This over-scales every limited-range conversion by a factor of 256/255, producing an error of up to ~3/255 (8-bit) and causing IGT tests that compare software-computed surfaces against VKMS-processed ones to fail.
Recompute the three limited-range matrices from first principles rather than relying on colour's is_legal scaling:
1. Start from the standard ITU-R YCbCr -> RGB relations for the luma weights Kr, Kb (Kg = 1 - Kr - Kb) of each encoding (BT.601, BT.709 and BT.2020 non-constant luminance). These are the same relations that produce the existing full-range matrices.
2. Expand the studio input range to full range relative to a full-range maximum of 2^n - 1: the luma coefficient by 255/(235 - 16) and the chroma coefficients by 255/(240 - 16). This matches the DRM UAPI definition and IGT's igt_ycbcr_to_rgb_matrix().
3. Convert each coefficient to S31.32 fixed point (round(coeff * 2^32)).
Update the limited-range reference values in the vkms-format KUnit test accordingly. Provide a python script to show how the kunit test value are calculated.
--- .../gpu/drm/vkms/tests/gen_yuv_conversion.py | 87 +++++++++++++++++++ drivers/gpu/drm/vkms/tests/vkms_format_test.c | 38 ++++---- drivers/gpu/drm/vkms/vkms_formats.c | 55 ++++++++---- 3 files changed, 144 insertions(+), 36 deletions(-) create mode 100755 drivers/gpu/drm/vkms/tests/gen_yuv_conversion.py
drivers/gpu/drm/vkms/tests/gen_yuv_conversion.py new file +87 -0
@@ -0,0 +1,87 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-2.0+ +""" +Derive the VKMS YCbCr -> RGB conversion constants and the vkms-format KUnit +reference values. + +It produces: + 1. The S31.32 fixed-point conversion matrices used in + drivers/gpu/drm/vkms/vkms_formats.c and asserted by + vkms_format_test_conversion_matrix. + 2. The 16-bit reference YCbCr inputs for the limited-range + yuv_u16_to_argb_u16 round-trip cases (the values changed by the fix). + +Requires numpy. +""" + +import numpy as np + +FP = 1 << 32 # S31.32 scale: fixed = round(coeff * 2^32) + +# ITU-R luma weights (Kr, Kb); Kg = 1 - Kr - Kb. +ENCODINGS = { + "BT601": (0.299, 0.114), + "BT709": (0.2126, 0.0722), + "BT2020": (0.2627, 0.0593), # non-constant luminance +} + +# 8-bit studio-range levels: luma 16..235 (range 219), chroma 16..240 +# (range 224, neutral 128); full-range maximum is 2^n - 1 = 255. +FULL_MAX = 255 +Y_RANGE = 235 - 16 # 219 +C_RANGE = 240 - 16 # 224 + +# 16-bit RGB test colors. +COLORS = { + "white": (0xffff, 0xffff, 0xffff), + "gray": (0x8080, 0x8080, 0x8080), + "black": (0x0000, 0x0000, 0x0000), + "red": (0xffff, 0x0000, 0x0000), + "green": (0x0000, 0xffff, 0x0000), + "blue": (0x0000, 0x0000, 0xffff), +} + + +def rgb_matrix(kr, kb, limited): + """Normalized YCbCr -> RGB (Y in [0,1], Cb/Cr in [-0.5, 0.5]).""" + kg = 1.0 - kr - kb + # Standard full-range relations. + m = [[1.0, 0.0, 2 * (1 - kr)], + [1.0, -2 * (1 - kb) * kb / kg, -2 * (1 - kr) * kr / kg], + [1.0, 2 * (1 - kb), 0.0]] + if limited: + # Expand studio input range to full range: luma by 255/219, + # chroma by 255/224 (relative to full-range maximum 2^n - 1). + ys, cs = FULL_MAX / Y_RANGE, FULL_MAX / C_RANGE + m = [[r[0] * ys, r[1] * cs, r[2] * cs] for r in m] + return m + + +def ref_yuv(m, y_offset): + """16-bit YCbCr that VKMS decodes back to each RGB color. + + VKMS decode: [R,G,B] = M . [Y - y_offset*257, Cb - 128*257, Cr - 128*257] + (8-bit offsets lifted to 16-bit by *257 = 65535/255), so invert and + re-add the offsets. + """ + inv = np.linalg.inv(np.array(m, float)) + off = np.array([y_offset * 257, 128 * 257, 128 * 257]) + return {name: tuple(int(min(max(round(v), 0), 0xffff)) + for v in inv @ np.array(rgb, float) + off) + for name, rgb in COLORS.items()} + +print(f"== RGB REFERENCE VALUES ==") +for name, rgb in COLORS.items(): + print(f" {name:6} {{ {rgb[0]:#06x}, {rgb[1]:#06x}, {rgb[2]:#06x} }}") +print() + +for enc, (kr, kb) in ENCODINGS.items(): + for limited in (False, True): + m = rgb_matrix(kr, kb, limited) + y_offset = 16 if limited else 0 + print(f"== {enc} {'LIMITED' if limited else 'FULL'} (y_offset={y_offset}) ==") + for row in m: + print(" { " + ", ".join(str(round(v * FP)) for v in row) + " },") + for name, yuv in ref_yuv(m, y_offset).items(): + print(f" {name:6} {{ {yuv[0]:#06x}, {yuv[1]:#06x}, {yuv[2]:#06x} }}") + print()
drivers/gpu/drm/vkms/tests/vkms_format_test.c +20 -18
@@ -54,6 +54,8 @@ struct yuv_u16_to_argb_u16_case {* The YUV color representation were acquired via the colour python framework. * Below are the function calls used for generating each case. * +* The limited-range cases are generated by gen_yuv_conversion.py. +* * For more information got to the docs: * https://colour.readthedocs.io/en/master/generated/colour.RGB_to_YCbCr.html */
@@ -101,12 +103,12 @@ static struct yuv_u16_to_argb_u16_case yuv_u16_to_argb_u16_cases[] = { .range = DRM_COLOR_YCBCR_LIMITED_RANGE, .n_colors = 6, .colors = { - { "white", { 0xeb00, 0x8000, 0x8000 }, { 0xffff, 0xffff, 0xffff, 0xffff }}, - { "gray", { 0x7dee, 0x8000, 0x8000 }, { 0xffff, 0x8080, 0x8080, 0x8080 }}, - { "black", { 0x1000, 0x8000, 0x8000 }, { 0xffff, 0x0000, 0x0000, 0x0000 }}, - { "red", { 0x517b, 0x5a34, 0xf000 }, { 0xffff, 0xffff, 0x0000, 0x0000 }}, - { "green", { 0x908e, 0x35cc, 0x2237 }, { 0xffff, 0x0000, 0xffff, 0x0000 }}, - { "blue", { 0x28f7, 0xf000, 0x6dc9 }, { 0xffff, 0x0000, 0x0000, 0xffff }}, + { "white", { 0xebeb, 0x8080, 0x8080 }, { 0xffff, 0xffff, 0xffff, 0xffff }}, + { "gray", { 0x7e6c, 0x8080, 0x8080 }, { 0xffff, 0x8080, 0x8080, 0x8080 }}, + { "black", { 0x1010, 0x8080, 0x8080 }, { 0xffff, 0x0000, 0x0000, 0x0000 }}, + { "red", { 0x51cd, 0x5a8e, 0xf0f0 }, { 0xffff, 0xffff, 0x0000, 0x0000 }}, + { "green", { 0x911e, 0x3602, 0x2259 }, { 0xffff, 0x0000, 0xffff, 0x0000 }}, + { "blue", { 0x2920, 0xf0f0, 0x6e37 }, { 0xffff, 0x0000, 0x0000, 0xffff }}, } },/*
@@ -151,12 +153,12 @@ static struct yuv_u16_to_argb_u16_case yuv_u16_to_argb_u16_cases[] = { .range = DRM_COLOR_YCBCR_LIMITED_RANGE, .n_colors = 6, .colors = { - { "white", { 0xeb00, 0x8000, 0x8000 }, { 0xffff, 0xffff, 0xffff, 0xffff }}, - { "gray", { 0x7dee, 0x8000, 0x8000 }, { 0xffff, 0x8080, 0x8080, 0x8080 }}, - { "black", { 0x1000, 0x8000, 0x8000 }, { 0xffff, 0x0000, 0x0000, 0x0000 }}, - { "red", { 0x3e8f, 0x6656, 0xf000 }, { 0xffff, 0xffff, 0x0000, 0x0000 }}, - { "green", { 0xaca1, 0x29aa, 0x1a45 }, { 0xffff, 0x0000, 0xffff, 0x0000 }}, - { "blue", { 0x1fd0, 0xf000, 0x75bb }, { 0xffff, 0x0000, 0x0000, 0xffff }}, + { "white", { 0xebeb, 0x8080, 0x8080 }, { 0xffff, 0xffff, 0xffff, 0xffff }}, + { "gray", { 0x7e6c, 0x8080, 0x8080 }, { 0xffff, 0x8080, 0x8080, 0x8080 }}, + { "black", { 0x1010, 0x8080, 0x8080 }, { 0xffff, 0x0000, 0x0000, 0x0000 }}, + { "red", { 0x3ece, 0x66bc, 0xf0f0 }, { 0xffff, 0xffff, 0x0000, 0x0000 }}, + { "green", { 0xad4e, 0x29d4, 0x1a5f }, { 0xffff, 0x0000, 0xffff, 0x0000 }}, + { "blue", { 0x1ff0, 0xf0f0, 0x7631 }, { 0xffff, 0x0000, 0x0000, 0xffff }}, } },/*
@@ -201,12 +203,12 @@ static struct yuv_u16_to_argb_u16_case yuv_u16_to_argb_u16_cases[] = { .range = DRM_COLOR_YCBCR_LIMITED_RANGE, .n_colors = 6, .colors = { - { "white", { 0xeb00, 0x8000, 0x8000 }, { 0xffff, 0xffff, 0xffff, 0xffff }}, - { "gray", { 0x7dee, 0x8000, 0x8000 }, { 0xffff, 0x8080, 0x8080, 0x8080 }}, - { "black", { 0x1000, 0x8000, 0x8000 }, { 0xffff, 0x0000, 0x0000, 0x0000 }}, - { "red", { 0x4988, 0x60b9, 0xf000 }, { 0xffff, 0xffff, 0x0000, 0x0000 }}, - { "green", { 0xa47b, 0x2f47, 0x1902 }, { 0xffff, 0x0000, 0xffff, 0x0000 }}, - { "blue", { 0x1cfd, 0xf000, 0x76fe }, { 0xffff, 0x0000, 0x0000, 0xffff }}, + { "white", { 0xebeb, 0x8080, 0x8080 }, { 0xffff, 0xffff, 0xffff, 0xffff }}, + { "gray", { 0x7e6c, 0x8080, 0x8080 }, { 0xffff, 0x8080, 0x8080, 0x8080 }}, + { "black", { 0x1010, 0x8080, 0x8080 }, { 0xffff, 0x0000, 0x0000, 0x0000 }}, + { "red", { 0x49d2, 0x611a, 0xf0f0 }, { 0xffff, 0xffff, 0x0000, 0x0000 }}, + { "green", { 0xa520, 0x2f76, 0x191b }, { 0xffff, 0x0000, 0xffff, 0x0000 }}, + { "blue", { 0x1d1a, 0xf0f0, 0x7775 }, { 0xffff, 0x0000, 0x0000, 0xffff }}, } }, };
drivers/gpu/drm/vkms/vkms_formats.c +37 -18
82 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 83/2651 bpftool: Fix spurious batch file read error
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuan Chen <[email protected]>
[ Upstream commit 713c02b59e21840f623a3e31c43d967026c75181 ]
do_batch() checks errno after the read loop to detect read failures, but fgets() does not clear errno on success, so a stale errno left by a previously executed command (e.g. map dump's EBADF from a double close) makes bpftool report a batch file read failure and exit with an error even though every command succeeded.
Clear errno before each fgets() call, so the post-loop check only sees the outcome of the last read: zero on success or EOF, E2BIG for an overlong line, and a genuine errno when fgets() fails.
Since errno is now reset before every read in batch mode, drop the USE_LIBCAP errno reset in main() that existed only to keep errno clean for the batch mode.
--- tools/bpf/bpftool/main.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)
tools/bpf/bpftool/main.c +5 -11
@@ -365,7 +365,11 @@ static int do_batch(int argc, char **argv)if (json_output)jsonw_start_array (json_wtr); -while (fgets (buf,sizeof (buf), fp)) { +for (;;) { + errno =0 ; +if (!fgets (buf,sizeof (buf), fp)) +break ; + cp =strchr (buf,'#' );if (cp) *cp ='\0' ;
@@ -467,16 +471,6 @@ int main(int argc, char **argv)setlinebuf (stdout); -#ifdef USE_LIBCAP -/* Libcap < 2.63 hooks before main() to compute the number of -* capabilities of the running kernel, and doing so it calls prctl() -* which may fail and set errno to non-zero. -* Let's reset errno to make sure this does not interfere with the -* batch mode. -*/ - errno =0 ; -#endif - last_do_help = do_help; pretty_output = false; json_output = false;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 84/2651 selftests/bpf: Avoid flaky resize value test for percpu data
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leon Hwang <[email protected]>
[ Upstream commit 5e875ae9e9ffd5c76c6bdf8982f99de340dd46af ]
The bpf_map__set_value_size() test for percpu data relies on the tail 'cpu_id' field in the ".percpu" map. The test would fail, when 'cpu_id' is not the last field in the map.
To avoid the flaky test, factor out a subtest to use a dedicated ".percpu.arr" map that only has one field 'int arr[1]'. And, skip the subtest when fail to load skel with errno E2BIG and the new value size is larger than ALIGN(32KiB, PAGE_SIZE).
And, drop 'args' in test_percpu_data_on_cpus(), which isn't used in bpf prog side.
And, enhance the test to cover 'set' and 'nums[6]'.
--- .../bpf/prog_tests/global_data_init.c | 96 ++++++++++++++----- .../bpf/progs/test_global_percpu_data.c | 10 +- 2 files changed, 80 insertions(+), 26 deletions(-)
tools/testing/selftests/bpf/prog_tests/global_data_init.c +73 -23
@@ -68,12 +68,9 @@ static void test_percpu_data_on_cpus(struct bpf_map *map, int map_fd, int prog_f {struct test_global_percpu_data__percpu *data =NULL ;int i, err, key =0 , num_online, run =0 ; -__u64 args[2 ] = {0x1234ULL ,0x5678ULL };size_t data_sz;bool *online;LIBBPF_OPTS (bpf_test_run_opts, topts, - .ctx_in = args, - .ctx_size_in = sizeof(args), .flags = BPF_F_TEST_RUN_ON_CPU, );
@@ -81,7 +78,7 @@ static void test_percpu_data_on_cpus(struct bpf_map *map, int map_fd, int prog_fif (!ASSERT_OK (err,"parse_cpu_mask_file" ))return ; - data_sz = map ?bpf_map__value_size (map) :sizeof (*data); + data_sz =sizeof (*data); data =calloc (1 , data_sz);if (!ASSERT_OK_PTR (data,"calloc percpu data" )) goto out;
@@ -109,7 +106,7 @@ static void test_percpu_data_on_cpus(struct bpf_map *map, int map_fd, int prog_fbreak ;ASSERT_EQ (*runp, ++run,"run" ); -ASSERT_EQ (data->cpu_id[0 ], i,"cpu_id" ); +ASSERT_EQ (data->cpu_id, i,"cpu_id" );ASSERT_EQ (data->data,1 ,"data" );ASSERT_TRUE (data->set,"set" );ASSERT_EQ (data->nums[6 ],0xc0de ,"nums[6]" );
@@ -127,7 +124,6 @@ static void test_global_percpu_data_init(void) {struct test_global_percpu_data__percpu init_value = {};struct test_global_percpu_data__percpu *init_data; -const __u32 desired_sz =sysconf (_SC_PAGE_SIZE);struct test_global_percpu_data *skel =NULL ;size_t init_data_sz;struct bpf_map *map;
@@ -163,9 +159,11 @@ static void test_global_percpu_data_init(void)if (!ASSERT_EQ (bpf_map__type (map),BPF_MAP_TYPE_PERCPU_ARRAY ,"bpf_map__type" )) goto out; + init_value.set =1 ; init_value.data =2 ; init_value.nums[6 ] =-1 ; init_value.struct_data.i =2 ; + init_value.struct_data.set =1 ; init_value.struct_data.nums[6 ] =-1 ; err =bpf_map__set_initial_value (map, &init_value,sizeof (init_value));if (!ASSERT_OK (err,"bpf_map__set_initial_value" ))
@@ -177,35 +175,24 @@ static void test_global_percpu_data_init(void)ASSERT_EQ (init_data->data, init_value.data,"init_value data" );ASSERT_EQ (init_data->set, init_value.set,"init_value set" ); +ASSERT_EQ (init_data->nums[6 ], init_value.nums[6 ],"init_value nums[6]" );ASSERT_EQ (init_data->struct_data.i, init_value.struct_data.i,"init_value struct_data.i" ); +ASSERT_EQ (init_data->struct_data.set, init_value.struct_data.set, +"init_value struct_data.set" );ASSERT_EQ (init_data->struct_data.nums[6 ], init_value.struct_data.nums[6 ],"init_value struct_data.nums[6]" );ASSERT_EQ (init_data_sz,sizeof (init_value),"init_value size" );ASSERT_EQ ((void *) init_data, (void *) skel->percpu,"skel->percpu eq init_data" );ASSERT_EQ (skel->percpu->data, init_value.data,"skel->percpu->data" );ASSERT_EQ (skel->percpu->set, init_value.set,"skel->percpu->set" ); +ASSERT_EQ (skel->percpu->nums[6 ], init_value.nums[6 ],"skel->percpu->nums[6]" );ASSERT_EQ (skel->percpu->struct_data.i, init_value.struct_data.i,"skel->percpu->struct_data.i" ); +ASSERT_EQ (skel->percpu->struct_data.set, init_value.struct_data.set, +"skel->percpu->struct_data.set" );ASSERT_EQ (skel->percpu->struct_data.nums[6 ], init_value.struct_data.nums[6 ],"skel->percpu->struct_data.nums[6]" ); -ASSERT_GT (desired_sz,sizeof (init_value),"desired_sz" ); - err =bpf_map__set_value_size (map, desired_sz); -if (!ASSERT_OK (err,"bpf_map__set_value_size" )) - goto out; -if (!ASSERT_EQ (bpf_map__value_size (map), desired_sz,"percpu value size" )) - goto out; -if (!ASSERT_NEQ (bpf_map__btf_value_type_id (map),0 ,"percpu BTF value type" )) - goto out; - - init_data =bpf_map__initial_value (map, &init_data_sz); -if (!ASSERT_OK_PTR (init_data,"resized bpf_map__initial_value" )) - goto out; -if (!ASSERT_EQ (init_data_sz, desired_sz,"resized initial value size" )) - goto out; -if (!ASSERT_EQ (init_data->data, init_value.data,"resized initial value data" )) - goto out; - err =test_global_percpu_data__load (skel);if (!ASSERT_OK (err,"test_global_percpu_data__load" )) goto out;
@@ -236,6 +223,67 @@ static void test_global_percpu_data_lskel(void)test_global_percpu_data_lskel__destroy (lskel); } +#define PCPU_MIN_UNIT_SIZE (32 << 10) + +static void test_global_percpu_data_map_resize (void ) +{ +const __u32 page_size =sysconf (_SC_PAGE_SIZE); +const __u32 pcpu_max_value_size =ALIGN (PCPU_MIN_UNIT_SIZE , page_size); +const __u32 desired_sz = page_size *2 ; +struct test_global_percpu_data *skel; +const int arr_value =-1 ; +struct bpf_map *map; +int err, prog_fd; +size_t data_sz; + + skel =test_global_percpu_data__open (); +if (!ASSERT_OK_PTR (skel,"test_global_percpu_data__open" )) +return ; + + map = skel->maps.percpu_arr; + skel->percpu_arr->arr[0 ] = arr_value; + err =bpf_map__set_value_size (map, desired_sz); +if (!ASSERT_OK (err,"bpf_map__set_value_size" )) + goto out; +if (!ASSERT_EQ (bpf_map__value_size (map), desired_sz,"bpf_map__value_size" )) + goto out; +if (!ASSERT_NEQ (bpf_map__btf_value_type_id (map),0 ,"bpf_map__btf_value_type_id" )) + goto out; + + skel->percpu_arr =bpf_map__initial_value (map, &data_sz); +if (!ASSERT_EQ (data_sz, desired_sz,"data_sz" )) + goto out; +if (!ASSERT_OK_PTR (skel->percpu_arr,"skel->percpu_arr" )) + goto out; +if (!ASSERT_EQ (skel->percpu_arr->arr[0 ], arr_value,"arr[0]" )) + goto out; + + err =test_global_percpu_data__load (skel); +if (bpf_map__value_size (map) > pcpu_max_value_size) { +if (ASSERT_EQ (err, -E2BIG ,"test_global_percpu_data__load E2BIG" )) +/* +* When the PAGE_SIZE is 64KiB, the new value size will +* be 128KiB. Creating a percpu_array map with the new +* value size will fail with -E2BIG due to percpu_array +* map value size limit 64KiB, which is calculated by +* PFN_ALIGN(32KiB). +* Let's skip the test for such case. +*/ +test__skip (); + goto out; + } +if (!ASSERT_OK (err,"test_global_percpu_data__load" )) + goto out; + + map = skel->maps.percpu; + prog_fd =bpf_program__fd (skel->progs.update_percpu_data); +test_percpu_data_on_cpus (map,bpf_map__fd (map), prog_fd, &skel->bss->run); +ASSERT_EQ (skel->bss->arr_sum, arr_value * skel->bss->run,"arr_sum" ); + +out: +test_global_percpu_data__destroy (skel); +} +static int create_rdonly_percpu_array (void ) { LIBBPF_OPTS(bpf_map_create_opts, map_opts,
@@ -388,6 +436,8 @@ void test_global_percpu_data(void)test_global_percpu_data_init ();if (test__start_subtest ("lskel" ))test_global_percpu_data_lskel (); +if (test__start_subtest ("map_resize" )) +test_global_percpu_data_map_resize ();if (test__start_subtest ("rdonly_direct_read" ))test_global_percpu_data_rdonly_direct_read ();if (test__start_subtest ("rdonly_direct_write" ))
tools/testing/selftests/bpf/progs/test_global_percpu_data.c +7 -3
@@ -8,9 +8,12 @@ int loong SEC(".percpu.looooooooong"); int data3 SEC(".data.percpu"); int data2 SEC(".percpu.data"); +/* Used for testing bpf_map__set_value_size(). */ +int arr[1] SEC(".percpu.arr"); +int arr_sum; +int run; -/* cpu_id as array to verify map value resizing. */ -int cpu_id[1] SEC(".percpu"); +int cpu_id SEC(".percpu"); int data SEC(".percpu") = -1; int nums[7] SEC(".percpu"); bool set SEC(".percpu") = false;
@@ -34,7 +37,8 @@ int update_percpu_data(void *ctx) data =1 ; run++; set = true; - cpu_id[0 ] =bpf_get_smp_processor_id (); + cpu_id =bpf_get_smp_processor_id (); + arr_sum += arr[0 ];return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 85/2651 drm/ras: Cancel and free message on get counter failure
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Raag Jadav <[email protected]>
[ Upstream commit 9cc19bb8f2f6886392b9185b96bbef91b2f1a50f ]
doit_reply_value() directly returns on get counter failure, which results in stale sk_buff and genetlink header that aren't cleaned up. Fix it and while at it, consolidate error handling using goto.
--- drivers/gpu/drm/drm_ras.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/gpu/drm/drm_ras.c +11 -8
@@ -201,25 +201,28 @@ static int doit_reply_value(struct genl_info *info, u32 node_id, hdr =genlmsg_iput (msg, info);if (!hdr) { -nlmsg_free (msg); -return -EMSGSIZE ; + ret = -EMSGSIZE ; + goto free_msg; } ret =get_node_error_counter (node_id, error_id, &error_name, &value);if (ret) -return ret; + goto cancel_msg; ret =msg_reply_value (msg, error_id, error_name, value); -if (ret) { -genlmsg_cancel (msg, hdr); -nlmsg_free (msg); -return ret; - } +if (ret) + goto cancel_msg;genlmsg_end (msg, hdr);return genlmsg_reply (msg, info); + +cancel_msg: +genlmsg_cancel (msg, hdr); +free_msg: +nlmsg_free (msg); +return ret; }/**
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 86/2651 selftests/bpf: NUL-terminate bpftool command output
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ihor Solodrai <[email protected]>
[ Upstream commit 4f8a4c76f6704667111d76404bdea4fef0373358 ]
run_command() writes a bpftool command's output into a caller-supplied buffer, and every caller treats that buffer as a C string.
However fread() reports a byte count and doesn't terminate the string. The helper does not terminate either, so callers have to zero the buffer first. prog_tests/bpftool_metadata.c does not, for example.
Read one byte less and terminate in the helper.
--- tools/testing/selftests/bpf/bpftool_helpers.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/bpftool_helpers.c +5 -2
@@ -53,6 +53,7 @@ static int run_command(char *args, char *output_buf, size_t output_max_len)static char bpftool_path[PATH_MAX ] = {};bool suppress_output = !(output_buf && output_max_len);char command[BPFTOOL_FULL_CMD_MAX_LEN ]; +size_t n;FILE *f;int ret;
@@ -68,8 +69,10 @@ static int run_command(char *args, char *output_buf, size_t output_max_len)if (!f)return 1 ; -if (!suppress_output) -fread (output_buf,1 , output_max_len, f); +if (!suppress_output) { + n =fread (output_buf,1 , output_max_len -1 , f); + output_buf[n] ='\0' ; + } ret =pclose (f);return ret;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 87/2651 selftests/bpf: Add tests for bpftool btf dump format c
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ihor Solodrai <[email protected]>
[ Upstream commit 438147f7f60104a228fb506352bc8bbae53b1efd ]
"bpftool btf dump format c" generates the vmlinux.h that BPF programs are built against, and it has no test coverage at all. The only in-tree consumers are build systems.
Building against the header only catches what a compiler rejects, which is insufficient.
Introduce a bpftool_btf_dump selftest. Dump a small hand-built BTF and compare the output against committed expectations.
The BTF is assembled with btf__add_*() rather than compiled from BPF C because the fixture needs a 4-byte "long int". That is what makes bpftool render the hole in struct holey as a pair of "long: 32;" bitfields. A BPF target is always 64-bit, so a compiled fixture could not supply it.
Comparing the whole dump makes every change to a generated header show up in a patch.
Stable-dep-of: ff01f88a9136 ("bpftool: Don't drop a type in the sorted C dump")
--- tools/testing/selftests/bpf/Makefile | 8 +- .../bpf/bpftool_btf_dump_sorted.expected | 44 +++++ .../bpf/bpftool_btf_dump_unsorted.expected | 48 +++++ .../bpf/prog_tests/bpftool_btf_dump.c | 178 ++++++++++++++++++ 4 files changed, 276 insertions(+), 2 deletions(-) create mode 100644 tools/testing/selftests/bpf/bpftool_btf_dump_sorted.expected create mode 100644 tools/testing/selftests/bpf/bpftool_btf_dump_unsorted.expected create mode 100644 tools/testing/selftests/bpf/prog_tests/bpftool_btf_dump.c
tools/testing/selftests/bpf/Makefile +6 -2
@@ -118,7 +118,9 @@ TEST_GEN_PROGS += test_progs-cpuv4 TEST_INST_SUBDIRS += cpuv4 endif -TEST_FILES = xsk_prereqs.sh $(wildcard progs/btf_dump_test_case_*.c) +TEST_FILES = xsk_prereqs.sh $(wildcard progs/btf_dump_test_case_*.c) \ + bpftool_btf_dump_sorted.expected \ + bpftool_btf_dump_unsorted.expected # Order correspond to 'make run_tests' order TEST_PROGS := test_kmod.sh \
@@ -882,7 +884,9 @@ TRUNNER_EXTRA_FILES := $(OUTPUT)/urandom_read \ ima_setup.sh \ $(VERIFY_SIG_SETUP) \ $(wildcard progs/btf_dump_test_case_*.c) \ - $(wildcard progs/*.bpf.o) + $(wildcard progs/*.bpf.o) \ + bpftool_btf_dump_sorted.expected \ + bpftool_btf_dump_unsorted.expected TRUNNER_BPF_BUILD_RULE := CLANG_BPF_BUILD_RULE TRUNNER_BPF_CFLAGS := $(BPF_CFLAGS) $(CLANG_CFLAGS) -DENABLE_ATOMICS_TESTS $(eval $(call DEFINE_TEST_RUNNER,test_progs))
tools/testing/selftests/bpf/bpftool_btf_dump_sorted.expected new file +44 -0
44 lines not on this page · raw message
tools/testing/selftests/bpf/bpftool_btf_dump_unsorted.expected new file +48 -0
48 lines not on this page · raw message
tools/testing/selftests/bpf/prog_tests/bpftool_btf_dump.c new file +178 -0
178 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 88/2651 bpftool: Dont drop a type in the sorted C dump
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ihor Solodrai <[email protected]>
[ Upstream commit ff01f88a91368c264efb071c13f2b27b4d5c1d2b ]
The C dump sorts types by default, so that generated headers are diffable. The sorted dump emits one type fewer than the unsorted dump of the same BTF.
dump_btf_c() starts its loop at index 1 to skip the void type at BTF type ID 0. That holds for the unsorted dump, where the array index is the type ID, but not after qsort(): position 0 is then the lowest ranked type, and btf_type_rank() ranks an anonymous enum 0 while void takes the default rank of 10. So the enum is skipped, and void is emitted instead as a no-op.
--- tools/bpf/bpftool/btf.c | 6 +++++- .../testing/selftests/bpf/bpftool_btf_dump_sorted.expected | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-)
tools/bpf/bpftool/btf.c +5 -1
@@ -805,9 +805,13 @@ static int dump_btf_c(const struct btf *btf,if (sort_dump) datums =sort_btf_c (btf); -for (i =1 ; i < cnt; i++) { +for (i =0 ; i < cnt; i++) {int idx = datums ? datums[i].index : i; +/* type ID 0 is void, skip it */ +if (idx ==0 ) +continue ; + err =btf_dump__dump_type (d, idx);if (err) goto done;
tools/testing/selftests/bpf/bpftool_btf_dump_sorted.expected +4 -0
@@ -21,6 +21,10 @@ #endif #endif +enum { + E0 = 1, +}; + struct holey { int c; long: 32;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 89/2651 regulator: fixed: reject incompatible platform devices
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chandradhar Kumar <[email protected]>
[ Upstream commit f7396c2dbbc1bed6c2c554d1ddf80d16e4780a7d ]
The fixed regulator driver expects non-DT platform devices to provide their configuration through platform_data as a struct fixed_voltage_config.
An explicitly bound driver can bypass the normal platform device/driver matching and attach the fixed regulator driver to an unrelated platform device. This causes the driver's platform_data to be interpreted as a struct fixed_voltage_config even though it contains data for a different device.
Reject non-DT platform devices whose name does not match the fixed regulator driver before accessing their platform data.
--- drivers/regulator/fixed.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/regulator/fixed.c +4 -0
@@ -28,6 +28,7 @@#include <linux/regulator/of_regulator.h> #include <linux/regulator/machine.h> #include <linux/clk.h> +#include <linux/string.h> struct fixed_voltage_data {struct regulator_desc desc;
@@ -225,6 +226,9 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)enum gpiod_flags gflags;int ret; +if (!pdev->dev.of_node &&strcmp (pdev->name,"reg-fixed-voltage" )) +return -ENODEV ; + drvdata =devm_kzalloc (&pdev->dev,sizeof (struct fixed_voltage_data ),GFP_KERNEL );if (!drvdata)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 90/2651 spi: sh-msiof: propagate setup runtime-PM errors
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 152867998da9f331d6235d76aae1c7e1650708a9 ]
sh_msiof_spi_setup() ignores pm_runtime_get_sync() before programming native chip-select registers and marking the configuration initialized.
Use the checked runtime-PM helper and return failure before register access.
--- drivers/spi/spi-sh-msiof.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/spi/spi-sh-msiof.c +4 -1
@@ -453,6 +453,7 @@ static int sh_msiof_spi_setup(struct spi_device *spi)struct sh_msiof_spi_priv *p =spi_controller_get_devdata (spi->controller);u32 clr, set, tmp; +int ret;if (spi_get_csgpiod (spi,0 ) ||spi_controller_is_target (p->ctlr))return 0 ;
@@ -468,7 +469,9 @@ static int sh_msiof_spi_setup(struct spi_device *spi) clr |=SIMDR1_SYNCAC ; else set |= SIMDR1_SYNCAC; -pm_runtime_get_sync (&p->pdev->dev); + ret =pm_runtime_resume_and_get (&p->pdev->dev); +if (ret <0 ) +return ret; tmp =sh_msiof_read (p,SITMDR1 ) & ~clr;sh_msiof_write (p,SITMDR1 , tmp | set |SIMDR1_TRMD |SITMDR1_PCON ); tmp =sh_msiof_read (p,SIRMDR1 ) & ~clr;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 91/2651 iio: humidity: hts221: report available values via read_avail()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adi Nata <[email protected]>
[ Upstream commit 003e99cf33e344a380ba10b3e04ccb862f3d9dc3 ]
Replace the custom oversampling_ratio_available sysfs attributes with the standard IIO read_avail() callback. This lets the IIO core create and format *_available attributes and exposes the lists to in-kernel consumers.
As a consequence, the incorrectly named in_humidity_oversampling_ratio_available attribute is replaced by the standard in_humidityrelative_oversampling_ratio_available name for the IIO_HUMIDITYRELATIVE channel. The temperature oversampling and sampling frequency available attribute names are unchanged.
--- drivers/iio/humidity/hts221_core.c | 106 +++++++++++------------------ 1 file changed, 40 insertions(+), 66 deletions(-)
drivers/iio/humidity/hts221_core.c +40 -66
@@ -10,7 +10,6 @@#include <linux/kernel.h> #include <linux/module.h> #include <linux/device.h> -#include <linux/iio/sysfs.h> #include <linux/delay.h> #include <linux/pm.h> #include <linux/regmap.h>
@@ -49,7 +48,7 @@ struct hts221_odr {struct hts221_avg {u8 addr;u8 mask; -u16 avg_avl[HTS221_AVG_DEPTH ]; +int avg_avl[HTS221_AVG_DEPTH ]; };static const struct hts221_odr hts221_odr_table[] = {
@@ -58,6 +57,8 @@ static const struct hts221_odr hts221_odr_table[] = { { 13, 0x03 }, /* 12.5Hz */ }; +static const int hts221_odr_avail[] = { 1, 7, 13 }; + static const struct hts221_avg hts221_avg_list[] = { { .addr = 0x10,
@@ -97,7 +98,11 @@ static const struct iio_chan_spec hts221_channels[] = {BIT (IIO_CHAN_INFO_OFFSET ) |BIT (IIO_CHAN_INFO_SCALE ) | BIT(IIO_CHAN_INFO_OVERSAMPLING_RATIO), + .info_mask_separate_available = + BIT(IIO_CHAN_INFO_OVERSAMPLING_RATIO), .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), + .info_mask_shared_by_all_available = + BIT(IIO_CHAN_INFO_SAMP_FREQ), .scan_index = 0, .scan_type = { .sign = 's',
@@ -113,7 +118,11 @@ static const struct iio_chan_spec hts221_channels[] = {BIT (IIO_CHAN_INFO_OFFSET ) |BIT (IIO_CHAN_INFO_SCALE ) | BIT(IIO_CHAN_INFO_OVERSAMPLING_RATIO), + .info_mask_separate_available = + BIT(IIO_CHAN_INFO_OVERSAMPLING_RATIO), .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), + .info_mask_shared_by_all_available = + BIT(IIO_CHAN_INFO_SAMP_FREQ), .scan_index = 1, .scan_type = { .sign = 's',
@@ -192,53 +201,35 @@ static int hts221_update_avg(struct hts221_hw *hw,return 0 ; } -static ssize_t hts221_sysfs_sampling_freq (struct device *dev, -struct device_attribute *attr, -char *buf) -{ -int i; -ssize_t len =0 ; - -for (i =0 ; i <ARRAY_SIZE (hts221_odr_table); i++) - len +=scnprintf (buf + len,PAGE_SIZE - len,"%d " , - hts221_odr_table[i].hz); - buf[len -1 ] ='\n' ; - -return len; -} - -static ssize_t -hts221_sysfs_rh_oversampling_avail (struct device *dev, -struct device_attribute *attr, -char *buf) -{ -const struct hts221_avg *avg = &hts221_avg_list[HTS221_SENSOR_H ]; -ssize_t len =0 ; -int i; - -for (i =0 ; i <ARRAY_SIZE (avg->avg_avl); i++) - len +=scnprintf (buf + len,PAGE_SIZE - len,"%d " , - avg->avg_avl[i]); - buf[len -1 ] ='\n' ; - -return len; -} - -static ssize_t -hts221_sysfs_temp_oversampling_avail (struct device *dev, -struct device_attribute *attr, -char *buf) +static int hts221_read_avail (struct iio_dev *indio_dev, +struct iio_chan_spec const *chan, +const int **vals,int *type,int *length, +long mask) { -const struct hts221_avg *avg = &hts221_avg_list[HTS221_SENSOR_T ]; -ssize_t len =0 ; -int i; - -for (i =0 ; i <ARRAY_SIZE (avg->avg_avl); i++) - len +=scnprintf (buf + len,PAGE_SIZE - len,"%d " , - avg->avg_avl[i]); - buf[len -1 ] ='\n' ; - -return len; +switch (mask) { +case IIO_CHAN_INFO_OVERSAMPLING_RATIO : +switch (chan->type) { +case IIO_HUMIDITYRELATIVE : + *vals = hts221_avg_list[HTS221_SENSOR_H ].avg_avl; + *length =ARRAY_SIZE (hts221_avg_list[HTS221_SENSOR_H ].avg_avl); +break ; +case IIO_TEMP : + *vals = hts221_avg_list[HTS221_SENSOR_T ].avg_avl; + *length =ARRAY_SIZE (hts221_avg_list[HTS221_SENSOR_T ].avg_avl); +break ; +default : +return -EINVAL ; + } + *type =IIO_VAL_INT ; +return IIO_AVAIL_LIST ; +case IIO_CHAN_INFO_SAMP_FREQ : + *vals = hts221_odr_avail; + *type =IIO_VAL_INT ; + *length =ARRAY_SIZE (hts221_odr_avail); +return IIO_AVAIL_LIST ; +default : +return -EINVAL ; + } }int hts221_set_enable (struct hts221_hw *hw,bool enable)
@@ -521,27 +512,10 @@ static int hts221_validate_trigger(struct iio_dev *iio_dev,return hw->trig == trig ?0 : -EINVAL ; } -static IIO_DEVICE_ATTR(in_humidity_oversampling_ratio_available, S_IRUGO, - hts221_sysfs_rh_oversampling_avail, NULL, 0); -static IIO_DEVICE_ATTR(in_temp_oversampling_ratio_available, S_IRUGO, - hts221_sysfs_temp_oversampling_avail, NULL, 0); -static IIO_DEV_ATTR_SAMP_FREQ_AVAIL (hts221_sysfs_sampling_freq); - -static struct attribute *hts221_attributes[] = { - &iio_dev_attr_sampling_frequency_available.dev_attr.attr, - &iio_dev_attr_in_humidity_oversampling_ratio_available.dev_attr.attr, - &iio_dev_attr_in_temp_oversampling_ratio_available.dev_attr.attr, -NULL , -}; - -static const struct attribute_group hts221_attribute_group = { - .attrs = hts221_attributes, -}; -static const struct iio_info hts221_info = { - .attrs = &hts221_attribute_group, .read_raw = hts221_read_raw, .write_raw = hts221_write_raw, + .read_avail = hts221_read_avail, .validate_trigger = hts221_validate_trigger, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 92/2651 dt-bindings: iio: light: ltr501: Sort compatible enum array
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Esben Haabendal <[email protected]>
[ Upstream commit 6c430006fbcb63dc8baee3c3bf356b264ba7f61e ]
Restore alphabetical sorting of the properties.compatible.enum array.
Stable-dep-of: 198ed7962e42 ("dt-bindings: iio: light: ltr501: Add missing ltr303 compatible")
--- Documentation/devicetree/bindings/iio/light/liteon,ltr501.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/iio/light/liteon,ltr501.yaml +1 -1
@@ -15,9 +15,9 @@ allOf: properties: compatible: enum: + - liteon,ltr301 - liteon,ltr501 - liteon,ltr559 - - liteon,ltr301 reg: maxItems: 1
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 93/2651 dt-bindings: iio: light: ltr501: Add missing ltr303 compatible
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Esben Haabendal <[email protected]>
[ Upstream commit 198ed7962e42f1e45b7f48b9abc70aad9e3185f8 ]
When support for ltr303 was back in 2021, the bindings documentation was not updated accordingly.
--- Documentation/devicetree/bindings/iio/light/liteon,ltr501.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/iio/light/liteon,ltr501.yaml +1 -0
@@ -16,6 +16,7 @@ properties: compatible: enum: - liteon,ltr301 + - liteon,ltr303 - liteon,ltr501 - liteon,ltr559
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 94/2651 iio: temperature: tmp117: fix calibbias cache update on I2C write failure
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Salah Triki <[email protected]>
[ Upstream commit 61fff9cebbfdf39bbd04d366882476d1def14047 ]
The calibbias cache (data->calibbias) was updated before the I2C write to TMP117_REG_TEMP_OFFSET was known to succeed. If the write failed, the function correctly returned an error, but the driver's internal cache had already been updated to the new value.
This causes the cache and the actual hardware register to go out of
sync: a subsequent write of the same value would be silently skipped by the early "if (off == data->calibbias) return 0;" check, since the cache matches even though the register was never successfully updated.
Update data->calibbias only after confirming the I2C write succeeded, so the cache always reflects the actual state of the device.
Found by code inspection.
--- drivers/iio/temperature/tmp117.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/iio/temperature/tmp117.c +7 -2
@@ -97,15 +97,20 @@ static int tmp117_write_raw(struct iio_dev *indio_dev, struct iio_chan_spec {struct tmp117_data *data =iio_priv (indio_dev);s16 off; +int ret;switch (mask) {case IIO_CHAN_INFO_CALIBBIAS : off =clamp_t (int, val,S16_MIN ,S16_MAX );if (off == data->calibbias)return 0 ; + + ret =i2c_smbus_write_word_swapped (data->client,TMP117_REG_TEMP_OFFSET , off); +if (ret) +return ret; + data->calibbias = off; -return i2c_smbus_write_word_swapped (data->client, -TMP117_REG_TEMP_OFFSET , off); +return 0 ;default :return -EINVAL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 95/2651 iio: pressure: rohm-bm1390: Fix AVE_NUM initialization
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matti Vaittinen <[email protected]>
[ Upstream commit 64f4173ad1a7f1b247296c84e624f5095be170c7 ]
The BM1390 tries to initialize the AVE_NUM to 110b at the start-up. The field location is not taken into account, and value is written unsifted. This causes the AVE_NUM to be initialized to zero.
Use FIELD_PREP() to shift the intended AVE_NUM value to correct field.
--- drivers/iio/pressure/rohm-bm1390.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/iio/pressure/rohm-bm1390.c +3 -1
@@ -479,6 +479,7 @@ static const struct iio_info bm1390_info = {static int bm1390_chip_init (struct bm1390_data *data) { +u8 regval;int ret; ret = regmap_write_bits(data->regmap, BM1390_REG_POWER,
@@ -512,8 +513,9 @@ static int bm1390_chip_init(struct bm1390_data *data)* Default to use IIR filter in "middle" mode. Also the AVE_NUM must * be fixed when IIR is in use. */ + regval =FIELD_PREP (BM1390_MASK_AVE_NUM ,BM1390_IIR_AVE_NUM ); ret =regmap_update_bits (data->regmap,BM1390_REG_MODE_CTRL , -BM1390_MASK_AVE_NUM ,BM1390_IIR_AVE_NUM ); +BM1390_MASK_AVE_NUM , regval);if (ret)return ret;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 96/2651 clk: meson: t7: keep the memory fabric clocks running
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lucas Tanure <[email protected]>
[ Upstream commit 43e1705ecab981c66baee89041e6f728c0436f19 ]
Four clocks feed the bus that moves data between the peripherals and memory. Nothing in Linux claims them, so they were switched off shortly after boot, and any device that started a transfer after that point simply stopped. The SD card, which comes up about two seconds in, never finished reading its identification.
There is no device these clocks belong to, so mark them as always needed.
--- drivers/clk/meson/t7-peripherals.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/clk/meson/t7-peripherals.c +9 -4
@@ -945,11 +945,16 @@ static T7_SYS_PCLK(sys_aucpu, SYS_CLK_EN0_REG0, 14, 0); static T7_SYS_PCLK(sys_cec, SYS_CLK_EN0_REG0, 16, 0); static T7_SYS_PCLK(sys_gdc, SYS_CLK_EN0_REG0, 17, 0); static T7_SYS_PCLK(sys_deswarp, SYS_CLK_EN0_REG0, 18, 0); -static T7_SYS_PCLK(sys_ampipe_nand, SYS_CLK_EN0_REG0, 19, 0); +/* +* NOTE: sys_ampipe_nand and sys_am2axi0..2 provide the clock to the AXI bus +* used for DMA between the peripherals and the DRAM. After the clocks are +* disabled, a device that starts a transfer cannot complete it. +*/ +static T7_SYS_PCLK(sys_ampipe_nand, SYS_CLK_EN0_REG0, 19, CLK_IS_CRITICAL); static T7_SYS_PCLK(sys_ampipe_eth, SYS_CLK_EN0_REG0, 20, 0); -static T7_SYS_PCLK(sys_am2axi0, SYS_CLK_EN0_REG0, 21, 0); -static T7_SYS_PCLK(sys_am2axi1, SYS_CLK_EN0_REG0, 22, 0); -static T7_SYS_PCLK(sys_am2axi2, SYS_CLK_EN0_REG0, 23, 0); +static T7_SYS_PCLK(sys_am2axi0, SYS_CLK_EN0_REG0, 21, CLK_IS_CRITICAL); +static T7_SYS_PCLK(sys_am2axi1, SYS_CLK_EN0_REG0, 22, CLK_IS_CRITICAL); +static T7_SYS_PCLK(sys_am2axi2, SYS_CLK_EN0_REG0, 23, CLK_IS_CRITICAL); static T7_SYS_PCLK(sys_sd_emmc_a, SYS_CLK_EN0_REG0, 24, 0); static T7_SYS_PCLK(sys_sd_emmc_b, SYS_CLK_EN0_REG0, 25, 0); static T7_SYS_PCLK(sys_sd_emmc_c, SYS_CLK_EN0_REG0, 26, 0);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 97/2651 ata: pata_parport: Fix use-after-free in new_device_store
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pei Xiao <[email protected]>
[ Upstream commit bd46a0b22933fb45f4ff009fa4a3836124df34b3 ]
The function new_device_store() calls driver_find() without any protection against concurrent driver unregistration. This can lead to a use-after-free (UAF) when a driver is unloaded (via rmmod) in parallel with a new device addition via sysfs.
The race window exists because driver_find() returns a pointer to the driver's private data, but does not increase its reference count. The caller is responsible for ensuring the driver remains valid, but new_device_store() did not hold any lock or reference during the lookup and subsequent use.
Concurrently, pata_parport_unregister_driver() releases the pi_mutex before calling driver_unregister(), allowing new_device_store to proceed with a stale pointer after the driver has been freed.
Fix this by expanding the critical section protected by pi_mutex in both functions:
- In new_device_store(): acquire pi_mutex before calling driver_find(), and keep it held until all uses of the found driver pointer are completed.
- In pata_parport_unregister_driver(): hold pi_mutex throughout the entire unregistration process, including the driver_unregister() call, so that no concurrent lookup can see a partially removed driver.
Thread A (new_device_store) | Thread B (pata_parport_unregister_driver)
driver_find("ate") |
| mutex_lock(&pi_mutex)
| idr_remove(&protocols, id)
| mutex_unlock(&pi_mutex)
| driver_unregister(&pr->driver)
| (frees driver_private)
/* continues using stale driv */|
-> UAF! |Logs:
BUG: KASAN: slab-use-after-free in driver_find+0xd0/0xd4 Read of size 8 at addr ffffff9f970dc690 by task sh/4737 Call trace: show_stack+0x14/0x1c (C) dump_stack_lvl+0x70/0x84 print_report+0xf4/0x5a4 kasan_report+0xa0/0xe4 __asan_report_load8_noabort+0x18/0x20 driver_find+0xd0/0xd4 new_device_store+0x140/0x30c [pata_parport] bus_attr_store+0x5c/0x94 sysfs_kf_write+0x1c4/0x25c ... Allocated by task 4734: kasan_save_stack+0x28/0x4c kasan_save_track+0x1c/0x34 kasan_save_alloc_info+0x3c/0x4c __kasan_kmalloc+0x98/0xac __kmalloc_cache_noprof+0x158/0x3cc bus_add_driver+0x70/0x4d8 driver_register+0xf0/0x3b0 pata_parport_register_driver+0xb8/0x1c4 [pata_parport] 0xffffffc07f5ce014 do_one_initcall+0xb8/0x36c do_init_module+0x230/0x6d4 ... Freed by task 4737: kasan_save_stack+0x28/0x4c kasan_save_track+0x1c/0x34 kasan_save_free_info+0x48/0x8c __kasan_slab_free+0x5c/0x84 kfree+0x174/0x3e0 driver_release+0x1c/0x7c kobject_put+0x178/0x47c driver_find+0x78/0xd4 new_device_store+0x140/0x30c [pata_parport] bus_attr_store+0x5c/0x94 sysfs_kf_write+0x1c4/0x25c ...
--- drivers/ata/pata_parport/pata_parport.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/ata/pata_parport/pata_parport.c +4 -3
@@ -618,8 +618,9 @@ void pata_parport_unregister_driver(struct pi_protocol *pr)break ; }idr_remove (&protocols, id); -mutex_unlock (&pi_mutex);driver_unregister (&pr->driver); +mutex_unlock (&pi_mutex); + }EXPORT_SYMBOL_GPL (pata_parport_unregister_driver);
@@ -646,18 +647,18 @@ static ssize_t new_device_store(const struct bus_type *bus, const char *buf, siz port_wanted =-1 ; } +mutex_lock (&pi_mutex); drv =driver_find (protocol, &pata_parport_bus_type);if (!drv) {if (strcmp (protocol,"auto" )) {pr_err ("protocol %s not found\n" , protocol); +mutex_unlock (&pi_mutex);return -EINVAL ; } pr_wanted =NULL ; }else { pr_wanted = container_of(drv, struct pi_protocol, driver); } - -mutex_lock (&pi_mutex);/* walk all parports */ idr_for_each_entry (&parport_list, parport, port_num) {if (port_num == port_wanted || port_wanted ==-1 ) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 98/2651 ARM: dts: helios4: fix lm75 supply name
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit ef473a83c63e3173ac472e42727e990b923b99db ]
The lm75 driver requests a regulator named "vs" (the +VS power pin of the chip). The Helios4 DTS incorrectly used vcc-supply instead of vs-supply, causing the regulator core to emit:
lm75 0-004c: supply vs not found, using dummy regulator
Fix the property name to match the binding and the driver.
--- arch/arm/boot/dts/marvell/armada-388-helios4.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/marvell/armada-388-helios4.dts +1 -1
@@ -200,7 +200,7 @@ usb3-ilimit-hog { temp_sensor: temp@4c { compatible = "ti,lm75"; reg = <0x4c>; - vcc-supply = <®_3p3v>; + vs-supply = <®_3p3v>; }; eeprom@53 {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 99/2651 ARM: dts: armada-385-clearfog-gtr: fix vmmc property name
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit 337d10963f601d5a3dfb4b7aa273ca8c0b4d5172 ]
The SDHCI node references the 3.3V regulator through a bare "vmmc" property, which is not part of the mmc controller DT binding; the correct property is "vmmc-supply".
--- arch/arm/boot/dts/marvell/armada-385-clearfog-gtr.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/marvell/armada-385-clearfog-gtr.dtsi +1 -1
@@ -235,7 +235,7 @@ sdhci@d8000 { pinctrl-0 = <&cf_gtr_sdhci_pins>; pinctrl-names = "default"; status = "okay"; - vmmc = <®_3p3v>; + vmmc-supply = <®_3p3v>; wp-inverted; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 100/2651 ARM: dts: armada-395-gp: drop unsupported SDHCI clock-frequency
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit a56183c7f15215d804290808a2b5a1fa997aa9cd ]
The SDHCI node carries a "clock-frequency" property, but the marvell,armada-380-sdhci binding does not define it and dtbs_check rejects the node as a result. No driver consumes it either: only a few other sdhci-pltfm based drivers (imx, mcf, iproc, arasan, dwcmshc, xenon) read that property, while sdhci-pxav3 derives the maximum clock from the io clock rate.
Remove the property.
--- arch/arm/boot/dts/marvell/armada-395-gp.dts | 1 - 1 file changed, 1 deletion(-)
arch/arm/boot/dts/marvell/armada-395-gp.dts +0 -1
@@ -59,7 +59,6 @@ sata@a8000 { /* CON18 */ sdhci@d8000 { - clock-frequency = <200000000>; broken-cd; wp-inverted; bus-width = <8>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 101/2651 ARM: dts: armada-388-helios4: fix vmmc property name
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit 008e9faadef8c0aaa9b8a3ff05a2126e3c5b08b7 ]
The sdhci@d8000 node references the 3.3V regulator through a bare "vmmc" property, which is not part of the mmc controller DT binding. The binding requires supply properties in the form "vmmc-supply", so the current entry is ignored by the driver.
Rename the property to "vmmc-supply" so the fixed regulator is correctly wired up as the card power supply.
--- arch/arm/boot/dts/marvell/armada-388-helios4.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/marvell/armada-388-helios4.dts +1 -1
@@ -269,7 +269,7 @@ sdhci@d8000 { &helios_sdhci_cd_pins>; pinctrl-names = "default"; status = "okay"; - vmmc = <®_3p3v>; + vmmc-supply = <®_3p3v>; wp-inverted; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 102/2651 selftests/filesystems: Add .gitignore for fscontext_ns_test
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mahad Ibrahim <[email protected]>
[ Upstream commit b573f7966695470dd9f5659d32681e7e2821d426 ]
fscontext_ns_test is listed in TEST_GEN_PROGS and is built in the fscontext_ns directory, but the directory has no .gitignore. The binary is thus left untracked by git after being compiled.
git status lists:
Untracked files:
(use "git add <file>..." to include in what will be committed)
tools/testing/selftests/filesystems/fscontext_ns/fscontext_ns_test
Every test directory must include a .gitignore which contains all the generated objects, as per the documentation and convention.
Add .gitignore to ignore fscontext_ns_test.
--- tools/testing/selftests/filesystems/fscontext_ns/.gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 tools/testing/selftests/filesystems/fscontext_ns/.gitignore
tools/testing/selftests/filesystems/fscontext_ns/.gitignore new file +2 -0
@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-only +fscontext_ns_test
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 103/2651 ARM: dts: helios4: fix vbus-supply for USB2 PHY
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit a132798a133e76a7bb575ba95b2b64eadd245438 ]
The usb-nop-xceiv binding and driver use "vbus-supply"; the driver acquires the VBUS regulator via devm_regulator_get_exclusive("vbus") (phy-generic.c). The stale "vbus-regulator" name is never read by the driver and dtbs_check rejects it as an unknown property. Rename the property so reg_5p0v_usb is honored.
--- arch/arm/boot/dts/marvell/armada-388-helios4.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/marvell/armada-388-helios4.dts +1 -1
@@ -140,7 +140,7 @@ fan2: j17-pwm { usb2_phy: usb2-phy { compatible = "usb-nop-xceiv"; - vbus-regulator = <®_5p0v_usb>; + vbus-supply = <®_5p0v_usb>; }; usb3_phy: usb3-phy {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 104/2651 ARM: dts: helios4: fix spi1 location
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit 5df4320a30a87f9bb918ace7b389026917c8d896 ]
This spi node is specified in armada-38x.dtsi with proper compatible strings whereas they are not present here. Instead of copy and pasting various lines, just reference the node in the dtsi.
This dts seems to predate the move of spi from internal-regs to the soc node so this moves it in line there.
Allows proper probing of SPI at runtime.
Remove the microsom_spi1_cs_pins pinctrl group and its reference in &spi1. The group only muxed mpp59 to the "spi1" function, but that pin (SPI1 cs0) is already covered by spi1_pins, which selects the same function for mpp56-59 in armada-38x.dtsi.
--- .../arm/boot/dts/marvell/armada-388-helios4.dts | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
arch/arm/boot/dts/marvell/armada-388-helios4.dts +6 -11
@@ -254,13 +254,6 @@ sata3: sata-port@1 { }; }; - spi@10680 { - pinctrl-0 = <&spi1_pins - µsom_spi1_cs_pins>; - pinctrl-names = "default"; - status = "okay"; - }; - sdhci@d8000 { bus-width = <4>; cd-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
@@ -327,11 +320,13 @@ helios_fan2_pins: helios_fan2_pins { marvell,pins = "mpp48", "mpp55"; marvell,function = "gpio"; }; - microsom_spi1_cs_pins: spi1-cs-pins { - marvell,pins = "mpp59"; - marvell,function = "spi1"; - }; }; }; }; }; + +&spi1 { + pinctrl-0 = <&spi1_pins>; + pinctrl-names = "default"; + status = "okay"; +};
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 105/2651 kexec_file: stop the top-down search before it underflows
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
[ Upstream commit c711461303af9f796b293b5ac06f49a885e46e71 ]
locate_mem_hole_top_down() walks candidates downwards by subtracting PAGE_SIZE whenever the window conflicts with an existing segment or with an architecture exclude range.
Nothing stops that subtraction at zero, so a search that reaches the bottom of the address space wraps temp_start around and continues.
The walk starts inside the range being scanned and only moves down, so bail out once a candidate ends up above end. That covers every step in the loop rather than the subtractions alone, and it matches locate_mem_hole_bottom_up(), which already bounds its candidate on both sides.
This is a better check than subtracting with check_sub_overflow(), given that we would have 3 subtractions in this block, and this single fix would take care of them all (instead of three check_sub_overflow()).
--- kernel/kexec_file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/kexec_file.c +3 -1
@@ -484,7 +484,9 @@ static int locate_mem_hole_top_down(unsigned long start, unsigned long end,/* align down start */ temp_start =ALIGN_DOWN (temp_start, kbuf->buf_align); -if (temp_start < start || temp_start < kbuf->buf_min) +/* A candidate above the range means the walk wrapped around */ +if (temp_start < start || temp_start < kbuf->buf_min || + temp_start > end)return 0 ; temp_end = temp_start + kbuf->memsz -1 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 106/2651 perf jitdump: Fix extended header read that always fails
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 598e905931380f0714d5fd50cecfac615a1ec742 ]
jit_open() sets bsz = bs before the fread() that uses bs - bsz as the read size, making the expression always evaluate to zero. fread() with size 0 returns 0, which triggers the ret != 1 error path — so extended jitdump headers (total_size > sizeof(header)) have been silently broken since the original implementation.
Additionally, when 0 < bs <= bsz the if (bs > bsz) block is skipped entirely, leaving extended header bytes unread in the stream. Subsequent jit_get_next_entry() calls then parse those leftover bytes as a jr_prefix, corrupting the record stream.
Fix by separating the buffer growth from the read: realloc only when bs > bsz, then unconditionally fread bs bytes when bs > 0.
--- tools/perf/util/jitdump.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
tools/perf/util/jitdump.c +5 -3
@@ -224,10 +224,12 @@ jit_open(struct jit_buf_desc *jd, const char *name) n =realloc (buf, bs);if (!n) goto error; - bsz = bs; buf = n; -/* read extra we do not know about */ - ret =fread (buf, bs - bsz,1 , jd->in); + bsz = bs; + } +if (bs >0 ) { +/* consume extended header bytes from the stream */ + ret =fread (buf, bs,1 , jd->in);if (ret !=1 ) goto error; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 107/2651 perf jitdump: Fix debug_data and unwinding_data leaks
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 2bd967f3adcba1d3e54f10b0d8b25f950e4f03fd ]
jit_repipe_debug_info() overwrites jd->debug_data without freeing the previous allocation. If two consecutive JIT_CODE_DEBUG_INFO records appear without an intervening LOAD record consuming the data, the first allocation leaks.
The sibling jit_repipe_unwinding_info() already frees the old jd->unwinding_data before reassignment — add the same pattern to jit_repipe_debug_info() using zfree().
Also add cleanup of both buffers in jit_close() so they are freed when the jitdump session ends, even if no LOAD record consumed them.
--- tools/perf/util/jitdump.c | 3 +++ 1 file changed, 3 insertions(+)
tools/perf/util/jitdump.c +3 -0
@@ -117,6 +117,8 @@ jit_close(struct jit_buf_desc *jd)funlockfile (jd->in);fclose (jd->in); jd->in =NULL ; +zfree (&jd->debug_data); +zfree (&jd->unwinding_data); } static int
@@ -665,6 +667,7 @@ static int jit_repipe_debug_info(struct jit_buf_desc *jd, union jr_entry *jr)memcpy (data, &jr->info.entries, sz); +zfree (&jd->debug_data); jd->debug_data = data;/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 108/2651 perf jitdump: Validate code_size against total_size in code load
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 06c7cf7a072fcd52e68471628c56630d2bdcc650 ]
jit_repipe_code_load() reads code_size from the jitdump record and uses it to compute a pointer to the code blob:
code = (unsigned long)jr + jr->load.p.total_size - csize;
An oversized code_size underflows the pointer arithmetic, causing OOB reads into earlier heap memory. Validate that code_size fits within the record (total_size - sizeof(jr->load)) before the pointer computation.
code_size is uint64_t but csize is int; values above INT_MAX wrap negative when narrowed into csize, which defeats the bounds check and sends the code pointer past the end of the record. Reject those too.
--- tools/perf/util/jitdump.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
tools/perf/util/jitdump.c +11 -0
@@ -9,6 +9,7 @@#include <fcntl.h> #include <unistd.h> #include <inttypes.h> +#include <limits.h> #include <byteswap.h> #include <sys/stat.h> #include <sys/mman.h>
@@ -452,6 +453,16 @@ static int jit_repipe_code_load(struct jit_buf_desc *jd, union jr_entry *jr) csize = jr->load.code_size; usize = jd->unwinding_mapped_size; addr = jr->load.code_addr; + +/* code blob lives at the end of the record, validate it fits */ +if (jr->load.p.total_size <sizeof (jr->load) || + jr->load.code_size > jr->load.p.total_size -sizeof (jr->load) || + jr->load.code_size >INT_MAX ) { +pr_warning ("jitdump: invalid code_size %" PRIu64" (total_size=%u) in code_load record\n" , + (uint64_t )jr->load.code_size, jr->load.p.total_size); +return -1 ; + } + sym = (void *)((unsigned long )jr +sizeof (jr->load)); code = (unsigned long )jr + jr->load.p.total_size - csize; count = jr->load.code_index;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 109/2651 perf jitdump: Prevent integer underflow in debug info size calculation
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit dfe8fe96efca3c32979dc0859f88e15b677d25f1 ]
jit_repipe_debug_info() and jit_repipe_unwinding_info() compute payload sizes by subtracting the fixed header size from total_size:
sz = jr->prefix.total_size - sizeof(jr->info);
When total_size is smaller than the header struct (from a truncated or corrupted jitdump record), the subtraction underflows to a massive value, causing an oversized allocation followed by an OOB memcpy.
Validate that total_size covers at least the fixed header before the subtraction in both functions.
--- tools/perf/util/jitdump.c | 8 ++++++++ 1 file changed, 8 insertions(+)
tools/perf/util/jitdump.c +8 -0
@@ -671,6 +671,10 @@ static int jit_repipe_debug_info(struct jit_buf_desc *jd, union jr_entry *jr)if (!(jd && jr))return -1 ; +/* total_size must cover at least the fixed header */ +if (jr->prefix.total_size <sizeof (jr->info)) +return -1 ; + sz = jr->prefix.total_size -sizeof (jr->info); data =malloc (sz);if (!data)
@@ -699,6 +703,10 @@ jit_repipe_unwinding_info(struct jit_buf_desc *jd, union jr_entry *jr)if (!(jd && jr))return -1 ; +/* total_size must cover at least the fixed header */ +if (jr->prefix.total_size <sizeof (jr->unwinding)) +return -1 ; + unwinding_data_size = jr->prefix.total_size -sizeof (jr->unwinding); unwinding_data =malloc (unwinding_data_size);if (!unwinding_data)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 110/2651 perf jitdump: Bounds-check debug entry byte-swap loop
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit ede3cd8151675c2983cd49104b1e9b25a3712ed8 ]
The byte-swap loop for JIT_CODE_DEBUG_INFO uses array indexing (jr->info.entries[n]) to iterate debug entries. struct debug_entry has a flexible array member name[], so each entry has a different size. Array indexing computes offsets assuming fixed-size elements, landing inside variable-length name strings after the first entry and byte-swapping garbage.
Additionally, nr_entry is read from untrusted jitdump input without validation against total_size, so a crafted value causes OOB reads.
Replace the array indexing with debug_entry_next() pointer arithmetic (which correctly accounts for the variable-length name) and bounds-check each entry against the record's total_size before byte-swapping.
--- tools/perf/util/jitdump.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-)
tools/perf/util/jitdump.c +22 -4
@@ -320,14 +320,32 @@ jit_get_next_entry(struct jit_buf_desc *jd)switch (id) {case JIT_CODE_DEBUG_INFO :if (jd->needs_bswap) { +void *end = (void *)jr + jr->prefix.total_size; +struct debug_entry *ent;uint64_t n; + jr->info.code_addr =bswap_64 (jr->info.code_addr); jr->info.nr_entry =bswap_64 (jr->info.nr_entry); -for (n =0 ; n < jr->info.nr_entry; n++) { - jr->info.entries[n].addr =bswap_64 (jr->info.entries[n].addr); - jr->info.entries[n].lineno =bswap_32 (jr->info.entries[n].lineno); - jr->info.entries[n].discrim =bswap_32 (jr->info.entries[n].discrim); + +/* +* debug_entry has a variable-length name[], so array +* indexing would compute wrong offsets — use +* debug_entry_next() and bounds-check each entry. +*/ + ent = &jr->info.entries[0 ]; +for (n =0 ; n < jr->info.nr_entry; n++) { +if ((void *)ent +sizeof (*ent) > end) +break ; +/* name must be NUL-terminated within the record */ +if (!memchr (ent->name,'\0' , (char *)end - ent->name)) +break ; + ent->addr =bswap_64 (ent->addr); + ent->lineno =bswap_32 (ent->lineno); + ent->discrim =bswap_32 (ent->discrim); + ent =debug_entry_next (ent); } +/* clamp so downstream consumers don't overrun */ + jr->info.nr_entry = n; }break ;case JIT_CODE_UNWINDING_INFO :
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 111/2651 perf jitdump: Check snprintf return before computing header size
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 0155f05ea6e133c18a04b8b5945cac59870da156 ]
snprintf() returns the would-have-been length on truncation. When the jitted filename exceeds PATH_MAX, the unclamped 'size' value inflates sizeof(event->mmap2.filename) - size into a massive underflow, causing the header.size computation to write an oversized header. The subsequent write to 'id = event + header.size - idr_size' then corrupts the heap.
Clamp size to PATH_MAX - 1 after snprintf in both jit_repipe_code_load() and jit_repipe_code_move().
--- tools/perf/util/jitdump.c | 6 ++++++ 1 file changed, 6 insertions(+)
tools/perf/util/jitdump.c +6 -0
@@ -495,6 +495,9 @@ static int jit_repipe_code_load(struct jit_buf_desc *jd, union jr_entry *jr) jd->dir, nspid, count); +/* snprintf returns would-be length on truncation, clamp to buffer */ +if (size >=sizeof (event->mmap2.filename)) + size =sizeof (event->mmap2.filename) -1 ; size++;/* for \0 */
@@ -625,6 +628,9 @@ static int jit_repipe_code_move(struct jit_buf_desc *jd, union jr_entry *jr) jd->dir, nspid, jr->move.code_index); +/* snprintf returns would-be length on truncation, clamp to buffer */ +if (size >=sizeof (event->mmap2.filename)) + size =sizeof (event->mmap2.filename) -1 ; size++;/* for \0 */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 112/2651 perf jitdump: Fix funlockfile on unlocked stream in jit_open() error path
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit bfde6848c1e24fd979d0138c57c1cc28c35093c3 ]
If the malloc() for the initial read buffer fails, jit_open() jumps to the error label which calls funlockfile(jd->in). However, flockfile() is called later in the function, so at this point the stream was never locked. Calling funlockfile() on an unlocked stream is undefined behavior per POSIX.
Split the error path into two labels: 'error' (after flockfile) calls funlockfile before cleanup, 'error_noflock' (before flockfile) skips the unlock.
--- tools/perf/util/jitdump.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/perf/util/jitdump.c +3 -2
@@ -157,7 +157,7 @@ jit_open(struct jit_buf_desc *jd, const char *name) buf =malloc (bsz);if (!buf) - goto error; + goto error_noflock;/* * protect from writer modifying the file while we are reading it
@@ -246,8 +246,9 @@ jit_open(struct jit_buf_desc *jd, const char *name)return 0 ; error: -free (buf);funlockfile (jd->in); +error_noflock: +free (buf);fclose (jd->in);return retval; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 113/2651 perf jitdump: Free event in jit_repipe_code_move()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 7fc5851aac606b9e4143f6857710cc5f346770c5 ]
jit_repipe_code_move() allocates a perf_event with calloc but never frees it — the 'out' label exits with only perf_sample__exit().
The sibling function jit_repipe_code_load() correctly calls free(event) at its out label. Add the same free(event) to jit_repipe_code_move().
--- tools/perf/util/jitdump.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/util/jitdump.c +1 -0
@@ -685,6 +685,7 @@ static int jit_repipe_code_move(struct jit_buf_desc *jd, union jr_entry *jr)build_id__mark_dso_hit (tool, event, &sample, jd->machine); out:perf_sample__exit (&sample); +free (event);return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 114/2651 perf jitdump: Use dirname() return value in jit_open()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 4eddf7d9e341eb8c41704b8aa27b4a91f4e2c7c9 ]
jit_open() calls dirname(jd->dir) but ignores the return value. POSIX says dirname() may return a pointer to internal static storage — glibc does this when the path has no '/', returning "." from a static buffer and leaving jd->dir unchanged with the original filename.
Capture the return value and copy it back to jd->dir when dirname() returns a different pointer.
--- tools/perf/util/jitdump.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tools/perf/util/jitdump.c +4 -1
@@ -146,6 +146,7 @@ jit_open(struct jit_buf_desc *jd, const char *name)ssize_t bs, bsz =0 ;void *n, *buf =NULL ;int ret, retval =-1 ; +char *dname;nsinfo__mountns_enter (jd->nsi, &nsc); jd->in =fopen (name,"r" );
@@ -241,7 +242,9 @@ jit_open(struct jit_buf_desc *jd, const char *name)*/ strncpy (jd->dir, name,PATH_MAX -1 ); jd->dir[PATH_MAX -1 ] ='\0' ; -dirname (jd->dir); + dname =dirname (jd->dir); +if (dname != jd->dir) +strlcpy (jd->dir, dname,sizeof (jd->dir));free (buf);return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 115/2651 perf jitdump: Validate debug entries on native (non-swap) path
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 51e14e495f0cea061bbad33e7635f7fd857113ad ]
The bounds-checking and nr_entry clamping added for the byte-swap path only runs when jd->needs_bswap is true. On native-endian files, nr_entry passes through unvalidated to jit_repipe_debug_info(), which stores it as jd->nr_debug_entries. Downstream, jit_process_debug_info() in genelf_debug.c iterates nr_debug_entries times via debug_entry_next(), which calls strlen() on each entry's name field — a crafted nr_entry causes OOB reads and writes.
Add bounds-checked iteration in jit_repipe_debug_info() that validates each debug_entry fits in the payload and its name is NUL-terminated before calling debug_entry_next(). Clamp nr_debug_entries to the count of valid entries.
--- tools/perf/util/jitdump.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-)
tools/perf/util/jitdump.c +22 -5
@@ -694,8 +694,10 @@ static int jit_repipe_code_move(struct jit_buf_desc *jd, union jr_entry *jr)static int jit_repipe_debug_info (struct jit_buf_desc *jd,union jr_entry *jr) { -void *data; -size_t sz; +struct debug_entry *ent; +void *data, *end; +size_t sz, valid; +uint64_t i;if (!(jd && jr))return -1 ;
@@ -715,10 +717,25 @@ static int jit_repipe_debug_info(struct jit_buf_desc *jd, union jr_entry *jr) jd->debug_data = data;/* -* we must use nr_entry instead of size here because -* we cannot distinguish actual entry from padding otherwise +* Clamp nr_debug_entries to entries that actually fit in the +* payload. The byte-swap path already does this for cross-endian +* files; validate on the native path too, since downstream +* jit_process_debug_info() iterates via debug_entry_next() which +* calls strlen() on each entry's name field. */ - jd->nr_debug_entries = jr->info.nr_entry; + end = data + sz; + ent = data; + valid =0 ; +for (i =0 ; i < jr->info.nr_entry; i++) { +if ((void *)ent +sizeof (*ent) > end) +break ; +/* name must be NUL-terminated within the payload */ +if (!memchr (ent->name,'\0' , (char *)end - ent->name)) +break ; + ent =debug_entry_next (ent); + valid++; + } + jd->nr_debug_entries = valid;return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 116/2651 perf jitdump: Validate sym string NUL-termination in code load
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 98bfe1142ccbaa5ffdca5dcdddd26f238ad33585 ]
jit_repipe_code_load() computes sym = (void *)jr + sizeof(jr->load) and passes it to jit_emit_elf() which calls strlen(sym) via jit_write_elf(). If code_size equals total_size - sizeof(jr->load), the sym pointer aliases the code blob with no NUL terminator, and strlen() scans past the buffer into adjacent heap memory.
Add a memchr() check to verify the symbol name is NUL-terminated within the region between the load header and the code blob before use.
--- tools/perf/util/jitdump.c | 7 +++++++ 1 file changed, 7 insertions(+)
tools/perf/util/jitdump.c +7 -0
@@ -487,6 +487,13 @@ static int jit_repipe_code_load(struct jit_buf_desc *jd, union jr_entry *jr) sym = (void *)((unsigned long )jr +sizeof (jr->load)); code = (unsigned long )jr + jr->load.p.total_size - csize; + +/* sym string lives between the load header and the code blob */ +if (!memchr (sym,'\0' , code - (unsigned long )sym)) { +pr_warning ("jitdump: unterminated symbol name in code_load record\n" ); +return -1 ; + } + count = jr->load.code_index; idr_size = jd->machine->id_hdr_size;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 117/2651 perf jitdump: Validate unwinding sizes against record payload
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 92d50319b4f0c0bbee8a236a09063272cd22faab ]
jit_repipe_unwinding_info() copies unwinding_size and eh_frame_hdr_size from the jitdump record into jd-> fields without checking them against the actual payload size. Downstream, jit_add_eh_frame_info() in genelf.c computes unwinding_table_size = unwinding_size - eh_frame_hdr_size, which underflows when eh_frame_hdr_size > unwinding_size. The result is passed as d->d_size to libelf, causing an OOB heap read into the output ELF file.
Validate that unwinding_size fits within the record payload and that eh_frame_hdr_size does not exceed unwinding_size before allocating or storing the values, so a bogus record cannot force a large allocation that is then discarded.
mapped_size is likewise taken from the record and was narrowed into an int for the mmap2 len computation in jit_repipe_code_load() and jit_repipe_code_move(); values above INT_MAX would turn negative, producing a wrong mmap2 length. Use uint64_t for usize so the value cannot truncate.
--- tools/perf/util/jitdump.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
tools/perf/util/jitdump.c +16 -3
@@ -462,7 +462,8 @@ static int jit_repipe_code_load(struct jit_buf_desc *jd, union jr_entry *jr)u16 idr_size;const char *sym;uint64_t count; -int ret, csize, usize; +int ret, csize; +uint64_t usize;pid_t nspid, pid, tid;struct {u32 pid, tid;
@@ -543,7 +544,7 @@ static int jit_repipe_code_load(struct jit_buf_desc *jd, union jr_entry *jr) event->mmap2.pgoff =GEN_ELF_TEXT_OFFSET ; event->mmap2.start = addr; - event->mmap2.len = usize ?ALIGN_8 (csize) + usize : csize; + event->mmap2.len = usize ?ALIGN_8 ((uint64_t )csize) + usize : (uint64_t )csize; event->mmap2.pid = pid; event->mmap2.tid = tid; event->mmap2.ino = st.st_ino;
@@ -612,7 +613,7 @@ static int jit_repipe_code_move(struct jit_buf_desc *jd, union jr_entry *jr)char *filename;size_t size;struct stat st; -int usize; +uint64_t usize;u16 idr_size;int ret;pid_t nspid, pid, tid;
@@ -761,6 +762,18 @@ jit_repipe_unwinding_info(struct jit_buf_desc *jd, union jr_entry *jr)return -1 ; unwinding_data_size = jr->prefix.total_size -sizeof (jr->unwinding); + +/* +* Validate sizes before allocating — jit_add_eh_frame_info() +* computes unwinding_size - eh_frame_hdr_size and uses the +* result as a buffer length for libelf. +*/ +if (jr->unwinding.unwinding_size > unwinding_data_size || + jr->unwinding.eh_frame_hdr_size > jr->unwinding.unwinding_size) { +pr_warning ("jitdump: invalid unwinding sizes in unwinding_info record\n" ); +return -1 ; + } + unwinding_data =malloc (unwinding_data_size);if (!unwinding_data)return -1 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 118/2651 dt-bindings: display: panel: samsung,s6e8aa5x01: Allow common properties
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit c3fd78f0f3624fff3dcf55d89326f90000367596 ]
Change additionalProperties to unevaluatedProperties to allow inheriting properties from panel-common.yaml, preventing this warning:
qcom/sm6125-xiaomi-laurel-sprout.dtb: panel@0 (samsung,s6e8fc0-m1906f9): 'port' does not match any of the regexes: '^pinctrl-[0-9]+$'
from schema $id: http://devicetree.org/schemas/display/panel/samsung,s6e8aa5x01-ams561ra01.yaml
--- .../bindings/display/panel/samsung,s6e8aa5x01-ams561ra01.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/display/panel/samsung,s6e8aa5x01-ams561ra01.yaml +1 -1
@@ -34,7 +34,7 @@ required: - compatible - reg -additionalProperties: false +unevaluatedProperties: false examples: - |
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 119/2651 arm64: dts: apple: t6030: Fix cpus node indentation
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Peter <[email protected]>
[ Upstream commit 1c7e2a0cfc902932da41a93202f196a2dab18b71 ]
Drop the extra space indentation of the closing brace of the cpus node.
--- arch/arm64/boot/dts/apple/t6030.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/apple/t6030.dtsi +1 -1
@@ -208,7 +208,7 @@ l2_cache_1: l2-cache-1 { cache-unified; cache-size = <0x1000000>; }; - }; + }; timer { compatible = "arm,armv8-timer";
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 120/2651 arm64: dts: apple: t6032: Fix cpus node indentation
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Peter <[email protected]>
[ Upstream commit db6fccb5a4222ceb9c102a68f0e98a1e40b299af ]
Drop the extra space indentation of the closing brace of the cpus node.
--- arch/arm64/boot/dts/apple/t6032.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/apple/t6032.dtsi +1 -1
@@ -283,7 +283,7 @@ l2_cache_5: l2-cache-5 { cache-unified; cache-size = <0x1000000>; }; - }; + }; die0: soc@200000000 { compatible = "simple-bus";
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 121/2651 arm64: dts: imx95-15x15-frdm: fix duplicated can-phy node names
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haibo Chen <[email protected]>
[ Upstream commit 47580f0648398f837aaa3019ba3b7437ed1dea1b ]
Both the flexcan2 and flexcan5 CAN transceiver PHY nodes use the same node name "can-phy", which results in a node name collision. Distinguish them by using unit-less unique names "can-phy0" and "can-phy1".
These two CAN PHYs share their silent pin, this shared GPIO can be handled by GPIO shared proxy.
--- arch/arm64/boot/dts/freescale/imx95-15x15-frdm.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/freescale/imx95-15x15-frdm.dts +2 -2
@@ -56,7 +56,7 @@ dmic: dmic { num-channels = <2>; }; - flexcan2_phy: can-phy { + flexcan2_phy: can-phy0 { compatible = "nxp,tja1051"; #phy-cells = <0>; max-bitrate = <5000000>;
@@ -67,7 +67,7 @@ flexcan2_phy: can-phy { silent-gpios = <&pcal6524 7 GPIO_ACTIVE_HIGH>; }; - flexcan5_phy: can-phy { + flexcan5_phy: can-phy1 { compatible = "nxp,tja1051"; #phy-cells = <0>; max-bitrate = <5000000>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 122/2651 arm64: dts: qcom: glymur-crd: Mark the EC reset gpio as reserved
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abel Vesa <[email protected]>
[ Upstream commit 8ab228ebf968fe43afa55630fb98f1069828988e ]
GPIO 65 from TLMM is used by the Embedded Controller as its reset line. Reserve it to prevent Linux from requesting or reconfiguring it.
--- arch/arm64/boot/dts/qcom/glymur-crd.dtsi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/glymur-crd.dtsi +2 -1
@@ -963,7 +963,8 @@ &remoteproc_soccp { &tlmm { gpio-reserved-ranges = <4 4>, /* EC TZ Secure I3C */ <10 2>, /* OOB UART */ - <44 4>; /* Security SPI (TPM) */ + <44 4>, /* Security SPI (TPM) */ + <65 1>; /* EC reset */ edp_bl_en: edp-bl-en-state { pins = "gpio18";
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 123/2651 arm64: dts: imx8mp-phyboard-pollux-peb-av-10: Fix SAI master assignment
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Primoz Fiser <[email protected]>
[ Upstream commit 1c3f5701bc0ff5cbe56bdae76157047d47051d44 ]
The dailink_master label was placed on the codec sub-node instead of the CPU sub-node, configuring the codec as I2S bitclock/frame master with SAI2 as slave. On this board, BCLK and LRCLK are wired the other way around: SAI2 must be bus master, with the codec as I2S slave.
Move dailink_master to the CPU sub-node so SAI2 drives BCLK and LRCLK, fixing broken audio on the PHYTEC phyBOARD-Pollux-i.MX8MP board with PEB-AV-10 Audio/Video expansion board. Also remove the spurious clocks property from the codec sub-node, which had no effect in this topology.
--- .../boot/dts/freescale/imx8mp-phyboard-pollux-peb-av-10.dtsi | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/freescale/imx8mp-phyboard-pollux-peb-av-10.dtsi +2 -3
@@ -77,13 +77,12 @@ sound { "MIC3R", "Microphone Jack", "Microphone Jack", "Mic Bias"; - simple-audio-card,cpu { + dailink_master: simple-audio-card,cpu { sound-dai = <&sai2>; }; - dailink_master: simple-audio-card,codec { + simple-audio-card,codec { sound-dai = <&codec>; - clocks = <&clk IMX8MP_CLK_SAI2>; }; }; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 124/2651 remoteproc: qcom_q6v5_adsp: Fix double jiffies conversion in adsp_start()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anup Vishwakarma <[email protected]>
[ Upstream commit f559ef6316971fe39dc5f5edd6a483429ba03768 ]
adsp_start() computes 5 * HZ, an already-converted jiffies count, and passes it into msecs_to_jiffies(), which expects milliseconds -- reinterpreting the value and shrinking the intended timeout. Every other caller (q6v5_start() in qcom_q6v5_mss.c, qcom_pas_start() in qcom_q6v5_pas.c) passes msecs_to_jiffies(5000) directly, matching qcom_q6v5_wait_for_start()'s kerneldoc, which documents @timeout as already being in jiffies.
On CONFIG_HZ=250 this shrinks the intended 5 second timeout to ~1.25 seconds, causing a DSP that legitimately takes 2-3 seconds to signal ready to be spuriously torn down as a boot failure.
Fix by passing msecs_to_jiffies(5000) directly, matching every other caller.
--- drivers/remoteproc/qcom_q6v5_adsp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/remoteproc/qcom_q6v5_adsp.c +1 -1
@@ -430,7 +430,7 @@ static int adsp_start(struct rproc *rproc) goto disable_adsp_clks; } - ret =qcom_q6v5_wait_for_start (&adsp->q6v5,msecs_to_jiffies (5 *HZ )); + ret =qcom_q6v5_wait_for_start (&adsp->q6v5,msecs_to_jiffies (5000 ));if (ret == -ETIMEDOUT ) {dev_err (adsp->dev,"start timed out\n" ); goto disable_adsp_clks;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 125/2651 soc: qcom: smem: fix 32-bit overflow in DDR frequency calculation
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gopikrishna Garmidi <[email protected]>
[ Upstream commit 7bb5f186784074f2a91d83e191e305238be47103 ]
The DDR frequency in SMEM is reported in kHz and converted to Hz by multiplying it by 1000. Since the SMEM frequency value is a u32, using an unsuffixed integer constant causes the multiplication to be performed with 32-bit arithmetic.
This overflows for DDR frequencies above 4294967 kHz, resulting in an incorrect frequency being reported through the SMEM DRAM interface.
Use an unsigned long constant for the multiplication so the calculation is performed with 64-bit arithmetic on the supported Qualcomm platforms. Apply the fix consistently to the v3, v3.1, v4, v5, and v7 SMEM parsers.
--- drivers/soc/qcom/smem_dramc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/soc/qcom/smem_dramc.c +5 -5
@@ -219,7 +219,7 @@ static void smem_dram_parse_v3_data(struct smem_dram *dram, void *data)if (freq_entry->freq_khz && freq_entry->enabled) {u32 freq_khz =le32_to_cpu (freq_entry->freq_khz); - dram->frequencies[dram->num_frequencies++] =1000 * freq_khz; + dram->frequencies[dram->num_frequencies++] =1000UL * freq_khz; } } }
@@ -232,7 +232,7 @@ static void smem_dram_parse_v3_14freqs_data(struct smem_dram *dram, void *data)struct ddr_freq_table *freq_entry = &details->ddr_freq_tbl.ddr_freq[i];if (freq_entry->freq_khz && freq_entry->enabled) - dram->frequencies[dram->num_frequencies++] =1000 * freq_entry->freq_khz; + dram->frequencies[dram->num_frequencies++] =1000UL * freq_entry->freq_khz; } }
@@ -248,7 +248,7 @@ static void smem_dram_parse_v4_data(struct smem_dram *dram, void *data)if (freq_entry->freq_khz && freq_entry->enabled) {u32 freq_khz =le32_to_cpu (freq_entry->freq_khz); - dram->frequencies[dram->num_frequencies++] =1000 * freq_khz; + dram->frequencies[dram->num_frequencies++] =1000UL * freq_khz; } } }
@@ -265,7 +265,7 @@ static void smem_dram_parse_v5_data(struct smem_dram *dram, void *data)if (freq_entry->freq_khz && freq_entry->enabled) {u32 freq_khz =le32_to_cpu (freq_entry->freq_khz); - dram->frequencies[dram->num_frequencies++] =1000 * freq_khz; + dram->frequencies[dram->num_frequencies++] =1000UL * freq_khz; } } }
@@ -282,7 +282,7 @@ static void smem_dram_parse_v7_data(struct smem_dram *dram, void *data)if (freq_entry->freq_khz && freq_entry->enabled) {u32 freq_khz =le32_to_cpu (freq_entry->freq_khz); - dram->frequencies[dram->num_frequencies++] =1000 * freq_khz; + dram->frequencies[dram->num_frequencies++] =1000UL * freq_khz; } } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 126/2651 soc: qcom: smem: Fix byte order in v3 14-frequency parser
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linmao Li <[email protected]>
[ Upstream commit 9f3136c0c5bcb26d5c864f8a5658c1a6f449d351 ]
smem_dram_parse_v3_14freqs_data() uses the little-endian freq_khz field directly when scaling the frequency from kHz to Hz. This produces byte-swapped values on big-endian systems.
Convert freq_khz to CPU byte order before using it, as the other DDR data parsers do.
--- drivers/soc/qcom/smem_dramc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/soc/qcom/smem_dramc.c +5 -2
@@ -231,8 +231,11 @@ static void smem_dram_parse_v3_14freqs_data(struct smem_dram *dram, void *data)for (int i =0 ; i <MAX_DDR_FREQ_NUM_V3 +1 ; i++) {struct ddr_freq_table *freq_entry = &details->ddr_freq_tbl.ddr_freq[i]; -if (freq_entry->freq_khz && freq_entry->enabled) - dram->frequencies[dram->num_frequencies++] =1000UL * freq_entry->freq_khz; +if (freq_entry->freq_khz && freq_entry->enabled) { +u32 freq_khz =le32_to_cpu (freq_entry->freq_khz); + + dram->frequencies[dram->num_frequencies++] =1000UL * freq_khz; + } } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 127/2651 arm64: dts: qcom: glymur: Add missing USB clock, power and bandwidth votes
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Ociepka <[email protected]>
[ Upstream commit 0f8d35f04a126fb17134728ec441a177a35babb5 ]
The four USB3 controller nodes on Glymur (usb_0, usb_1, usb_2, usb_mp) are missing three property groups that Glymur's own usb_hs node at a200000 already carries, and that Hamoa (x1e80100) carries on all five of its USB controllers:
- assigned-clocks / assigned-clock-rates
- required-opps
- interconnects / interconnect-names
Without required-opps the controllers place no performance state vote on their power domain. Measured on an Asus Zenbook A16 (UX3607OA) with a SuperSpeed device enumerated, CX aggregates to SVS while the controllers run their master clock at 200 MHz:
$ grep -E "^cx " /sys/kernel/debug/pm_genpd/pm_genpd_summary cx on 128
$ grep "usb30.*master_clk " /sys/kernel/debug/clk/clk_summary gcc_usb30_sec_master_clk ... 200000000 gcc_usb30_prim_master_clk ... 200000000 gcc_usb30_mp_master_clk ... 200000000
128 is RPMH_REGULATOR_LEVEL_SVS; rpmhpd_opp_nom is 256. With this patch applied the same measurement reads 256 while a controller is active.
Without interconnects, dwc3_qcom_interconnect_init() silently does
nothing: of_icc_get() returns NULL rather than an error pointer for a device without the property, so probe succeeds and icc_set_bw() on a NULL path is a no-op. No USB-DDR bandwidth is ever requested.
Without assigned-clock-rates nothing programs the master clock RCG, which keeps whatever the bootloader left behind. On this machine that happens to be the correct 200 MHz, but ftbl_gcc_usb30_mp_master_clk_src also allows 66.67 and 133.33 MHz, neither of which sustains SuperSpeed.
Add all three groups to the four nodes, mirroring usb_hs. The interconnect paths follow the provider layout in drivers/interconnect/qcom/glymur.c: usb_0/usb_1 sit on aggre4_noc, usb_mp on aggre3_noc and usb_2 on aggre2_noc.
--- arch/arm64/boot/dts/qcom/glymur.dtsi | 49 ++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+)
arch/arm64/boot/dts/qcom/glymur.dtsi +49 -0
@@ -4572,6 +4572,10 @@ usb_0: usb@a600000 { "noc_aggr_north", "noc_aggr_south"; + assigned-clocks = <&gcc GCC_USB30_PRIM_MOCK_UTMI_CLK>, + <&gcc GCC_USB30_PRIM_MASTER_CLK>; + assigned-clock-rates = <19200000>, <200000000>; + interrupts-extended = <&intc GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>, <&intc GIC_SPI 371 IRQ_TYPE_LEVEL_HIGH>, <&pdc 90 IRQ_TYPE_EDGE_BOTH>,
@@ -4584,9 +4588,18 @@ usb_0: usb@a600000 { "ss_phy_irq"; power-domains = <&gcc GCC_USB30_PRIM_GDSC>; + required-opps = <&rpmhpd_opp_nom>; resets = <&gcc GCC_USB30_PRIM_BCR>; iommus = <&apps_smmu 0x1420 0x0>; + + interconnects = <&aggre4_noc MASTER_USB3_0 QCOM_ICC_TAG_ALWAYS + &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>, + <&hsc_noc MASTER_APPSS_PROC QCOM_ICC_TAG_ACTIVE_ONLY + &config_noc SLAVE_USB3_0 QCOM_ICC_TAG_ACTIVE_ONLY>; + interconnect-names = "usb-ddr", + "apps-usb"; + phys = <&usb_0_hsphy>, <&usb_0_qmpphy QMP_USB43DP_USB3_PHY>; phy-names = "usb2-phy",
@@ -4647,6 +4660,10 @@ usb_1: usb@a800000 { "noc_aggr_north", "noc_aggr_south"; + assigned-clocks = <&gcc GCC_USB30_SEC_MOCK_UTMI_CLK>, + <&gcc GCC_USB30_SEC_MASTER_CLK>; + assigned-clock-rates = <19200000>, <200000000>; + interrupts-extended = <&intc GIC_SPI 875 IRQ_TYPE_LEVEL_HIGH>, <&intc GIC_SPI 369 IRQ_TYPE_LEVEL_HIGH>, <&pdc 88 IRQ_TYPE_EDGE_BOTH>,
@@ -4660,9 +4677,17 @@ usb_1: usb@a800000 { resets = <&gcc GCC_USB30_SEC_BCR>; power-domains = <&gcc GCC_USB30_SEC_GDSC>; + required-opps = <&rpmhpd_opp_nom>; iommus = <&apps_smmu 0x1460 0x0>; + interconnects = <&aggre4_noc MASTER_USB3_1 QCOM_ICC_TAG_ALWAYS + &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>, + <&hsc_noc MASTER_APPSS_PROC QCOM_ICC_TAG_ACTIVE_ONLY + &config_noc SLAVE_USB3_1 QCOM_ICC_TAG_ACTIVE_ONLY>; + interconnect-names = "usb-ddr", + "apps-usb"; + phys = <&usb_1_hsphy>, <&usb_1_qmpphy QMP_USB43DP_USB3_PHY>; phy-names = "usb2-phy",
@@ -4723,6 +4748,10 @@ usb_2: usb@a000000 { "noc_aggr_north", "noc_aggr_south"; + assigned-clocks = <&gcc GCC_USB30_TERT_MOCK_UTMI_CLK>, + <&gcc GCC_USB30_TERT_MASTER_CLK>; + assigned-clock-rates = <19200000>, <200000000>; + interrupts-extended = <&intc GIC_SPI 871 IRQ_TYPE_LEVEL_HIGH>, <&intc GIC_SPI 370 IRQ_TYPE_LEVEL_HIGH>, <&pdc 89 IRQ_TYPE_EDGE_BOTH>,
@@ -4736,9 +4765,17 @@ usb_2: usb@a000000 { resets = <&gcc GCC_USB30_TERT_BCR>; power-domains = <&gcc GCC_USB30_TERT_GDSC>; + required-opps = <&rpmhpd_opp_nom>; iommus = <&apps_smmu 0x420 0x0>; + interconnects = <&aggre2_noc MASTER_USB3_2 QCOM_ICC_TAG_ALWAYS + &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>, + <&hsc_noc MASTER_APPSS_PROC QCOM_ICC_TAG_ACTIVE_ONLY + &config_noc SLAVE_USB3_2 QCOM_ICC_TAG_ACTIVE_ONLY>; + interconnect-names = "usb-ddr", + "apps-usb"; + phys = <&usb_2_hsphy>, <&usb_2_qmpphy QMP_USB43DP_USB3_PHY>; phy-names = "usb2-phy",
@@ -4869,6 +4906,10 @@ usb_mp: usb@a400000 { "noc_aggr_north", "noc_aggr_south"; + assigned-clocks = <&gcc GCC_USB30_MP_MOCK_UTMI_CLK>, + <&gcc GCC_USB30_MP_MASTER_CLK>; + assigned-clock-rates = <19200000>, <200000000>; + interrupts-extended = <&intc GIC_SPI 132 IRQ_TYPE_LEVEL_HIGH>, <&intc GIC_SPI 345 IRQ_TYPE_LEVEL_HIGH>, <&intc GIC_SPI 346 IRQ_TYPE_LEVEL_HIGH>,
@@ -4894,9 +4935,17 @@ usb_mp: usb@a400000 { resets = <&gcc GCC_USB30_MP_BCR>; power-domains = <&gcc GCC_USB30_MP_GDSC>; + required-opps = <&rpmhpd_opp_nom>; iommus = <&apps_smmu 0xda0 0x0>; + interconnects = <&aggre3_noc MASTER_USB3_MP QCOM_ICC_TAG_ALWAYS + &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>, + <&hsc_noc MASTER_APPSS_PROC QCOM_ICC_TAG_ACTIVE_ONLY + &config_noc SLAVE_USB3_MP QCOM_ICC_TAG_ACTIVE_ONLY>; + interconnect-names = "usb-ddr", + "apps-usb"; + phys = <&usb_mp_hsphy0>, <&usb_mp_qmpphy0>, <&usb_mp_hsphy1>,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 128/2651 arm64: dts: qcom: sdm845-sony-xperia-tama: Fix Bluetooth UART pinctrl
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shujath Mohd <[email protected]>
[ Upstream commit cd0f33393882e2554d46e8e068ab95d00593f385 ]
Use the 4-pin UART6 pinctrl configuration for the WCN3990 Bluetooth controller on Sony Xperia Tama devices.
This enables the UART hardware flow control required for reliable Bluetooth communication at higher baud rates.
--- arch/arm64/boot/dts/qcom/sdm845-sony-xperia-tama.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/qcom/sdm845-sony-xperia-tama.dtsi +2 -0
@@ -754,6 +754,8 @@ int-pins { }; &uart6 { + pinctrl-0 = <&qup_uart6_4pin>; + status = "okay"; bluetooth {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 129/2651 cxl/mce: Avoid alias page retirement for corrected errors
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shaikh Kamaluddin <[email protected]>
[ Upstream commit 04a7b330c8b60dfff200d9a32dd6615f97b59d07 ]
cxl_handle_mce() offlines the aliased page of an Extended Linear Cache (ELC) region for any MCE with a usable address in the region. This includes corrected errors, needlessly reducing usable memory.
Skip ELC alias retirement when mce_is_correctable() identifies the reported error as corrected. Uncorrected errors with a usable address in the ELC region continue to retire the aliased page as before.
mce_usable_address() already implements the per-vendor checks that determine whether the reported address is usable, so no separate memory-error classification is needed.
On AMD, a corrected legacy bank 4 DRAM ECC error (XEC 8) reports a usable address and retired the aliased page before this change. Tested under QEMU with Intel Skylake-Server and AMD EPYC-Milan models.
--- drivers/cxl/core/mce.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/cxl/core/mce.c +7 -1
@@ -18,7 +18,13 @@ static int cxl_handle_mce(struct notifier_block *nb, unsigned long val,u64 spa, spa_alias;unsigned long pfn; -if (!mce || !mce_usable_address (mce)) +if (!mce) +return NOTIFY_DONE ; + +if (mce_is_correctable (mce)) +return NOTIFY_DONE ; + +if (!mce_usable_address (mce))return NOTIFY_DONE ; spa = mce->addr &MCI_ADDR_PHYSADDR ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 130/2651 remoteproc: xlnx: Initialize mailbox work before requesting channels
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Runyu Xiao <[email protected]>
[ Upstream commit 5ca7dea7cb2e47f42c15ac7206c5e0cba23d292d ]
zynqmp_r5_setup_mbox() installs zynqmp_r5_mb_rx_cb() as the mailbox RX callback before requesting the mailbox channels, but initializes ipi->mbox_work only after both channels have been requested. Once the RX channel is active, a notification delivered before the late INIT_WORK() would make the callback queue an uninitialized work item.
Initialize the work item before requesting channels. Also drain the work before freeing the mailbox state, after the channels have been released so no new callbacks can queue it. Use the same drain before freeing ipi from the channel request error paths, since the callback is already published there as well.
This issue was found by our static analysis tool and then confirmed by manual review of the mailbox setup sequence. The callback is published before the channel requests complete, so the work item should be ready before the mailbox provider can invoke it.
A QEMU PoC modeled a mailbox notification delivered after the RX callback became reachable but before the delayed INIT_WORK(). DEBUG_OBJECTS reported queueing an uninitialized work item from the zynqmp_r5_setup_mbox() path.
This is sent as an RFC because the practical trigger depends on the ZynqMP IPI mailbox provider and firmware delivery timing. If the provider cannot invoke the RX callback until after setup returns, this is a defensive lifecycle cleanup rather than a reachable race on current systems.
--- drivers/remoteproc/xlnx_r5_remoteproc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/remoteproc/xlnx_r5_remoteproc.c +6 -2
@@ -318,6 +318,8 @@ static struct mbox_info *zynqmp_r5_setup_mbox(struct device *cdev)if (!ipi)return NULL ; +INIT_WORK (&ipi->mbox_work, handle_event_notified); + mbox_cl = &ipi->mbox_cl; mbox_cl->rx_callback = zynqmp_r5_mb_rx_cb; mbox_cl->tx_block = false;
@@ -329,6 +331,7 @@ static struct mbox_info *zynqmp_r5_setup_mbox(struct device *cdev) ipi->tx_chan =mbox_request_channel_byname (mbox_cl,"tx" );if (IS_ERR (ipi->tx_chan)) { ipi->tx_chan =NULL ; +cancel_work_sync (&ipi->mbox_work);kfree (ipi);dev_warn (cdev,"mbox tx channel request failed\n" );return NULL ;
@@ -339,13 +342,12 @@ static struct mbox_info *zynqmp_r5_setup_mbox(struct device *cdev)mbox_free_channel (ipi->tx_chan); ipi->rx_chan =NULL ; ipi->tx_chan =NULL ; +cancel_work_sync (&ipi->mbox_work);kfree (ipi);dev_warn (cdev,"mbox rx channel request failed\n" );return NULL ; } -INIT_WORK (&ipi->mbox_work, handle_event_notified); -return ipi; }
@@ -364,6 +366,8 @@ static void zynqmp_r5_free_mbox(struct mbox_info *ipi) ipi->rx_chan =NULL ; } +cancel_work_sync (&ipi->mbox_work); +kfree (ipi); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 131/2651 dt-bindings: clock: qcom,milos-camcc: Add missing power-domains support
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Taniya Das <[email protected]>
[ Upstream commit e0f335a4e17f5c80b24b8bd2060802bac072775c ]
The Milos camera clock controller requires the CX and MX power domains, along with their performance state votes, to be enabled before the clock controller can be accessed.
Document the 'power-domains' and 'required-opps' properties and add them to the required properties list and example. Since these properties become required for the already-documented qcom,milos-camcc compatible, this is an ABI break for any devicetree using this binding without specifying them.
--- .../bindings/clock/qcom,milos-camcc.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
Documentation/devicetree/bindings/clock/qcom,milos-camcc.yaml +19 -0
@@ -29,9 +29,21 @@ properties: items: - description: Interconnect path to enable the MultiMedia NoC + power-domains: + items: + - description: CX power domain + - description: MX power domain + + required-opps: + items: + - description: CX performance point + - description: MX performance point + required: - compatible - clocks + - power-domains + - required-opps allOf: - $ref: qcom,gcc.yaml#
@@ -43,6 +55,7 @@ examples: #include <dt-bindings/clock/qcom,milos-gcc.h> #include <dt-bindings/interconnect/qcom,icc.h> #include <dt-bindings/interconnect/qcom,milos-rpmh.h> + #include <dt-bindings/power/qcom,rpmhpd.h> clock-controller@adb0000 { compatible = "qcom,milos-camcc"; reg = <0x0adb0000 0x40000>;
@@ -51,6 +64,12 @@ examples: <&gcc GCC_CAMERA_AHB_CLK>; interconnects = <&mmss_noc MASTER_CAMNOC_HF QCOM_ICC_TAG_ALWAYS &mmss_noc SLAVE_MNOC_HF_MEM_NOC QCOM_ICC_TAG_ALWAYS>; + + power-domains = <&rpmhpd RPMHPD_CX>, + <&rpmhpd RPMHPD_MX>; + required-opps = <&rpmhpd_opp_low_svs>, + <&rpmhpd_opp_low_svs>; + #clock-cells = <1>; #reset-cells = <1>; #power-domain-cells = <1>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 132/2651 dt-bindings: clock: qcom,milos-videocc: Add missing power-domains support
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Taniya Das <[email protected]>
[ Upstream commit 3da90acddd2f211549032e9fdad40a5879803442 ]
The Milos video clock controller requires the CX and MX power domains, along with their performance state votes, to be enabled before the clock controller can be accessed.
Document the 'power-domains' and 'required-opps' properties and add them to the required properties list and example. Since these properties become required for the already-documented qcom,milos-videocc compatible, this is an ABI break for any devicetree using this binding without specifying them.
--- .../bindings/clock/qcom,milos-videocc.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
Documentation/devicetree/bindings/clock/qcom,milos-videocc.yaml +19 -0
@@ -26,9 +26,21 @@ properties: - description: Sleep clock source - description: Video AHB clock from GCC + power-domains: + items: + - description: CX power domain + - description: MX power domain + + required-opps: + items: + - description: CX performance point + - description: MX performance point + required: - compatible - clocks + - power-domains + - required-opps allOf: - $ref: qcom,gcc.yaml#
@@ -38,6 +50,7 @@ unevaluatedProperties: false examples: - | #include <dt-bindings/clock/qcom,milos-gcc.h> + #include <dt-bindings/power/qcom,rpmhpd.h> clock-controller@aaf0000 { compatible = "qcom,milos-videocc"; reg = <0x0aaf0000 0x10000>;
@@ -45,6 +58,12 @@ examples: <&bi_tcxo_ao_div2>, <&sleep_clk>, <&gcc GCC_VIDEO_AHB_CLK>; + + power-domains = <&rpmhpd RPMHPD_CX>, + <&rpmhpd RPMHPD_MX>; + required-opps = <&rpmhpd_opp_low_svs>, + <&rpmhpd_opp_low_svs>; + #clock-cells = <1>; #reset-cells = <1>; #power-domain-cells = <1>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 133/2651 arm64: dts: qcom: milos: Add power-domains for camcc and videocc
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Taniya Das <[email protected]>
[ Upstream commit a21b23f7ec4d849db9044f83787a7939acb639dd ]
The Milos camera and video clock controllers operate on the CX and MX power rails, and require these power domains along with their associated performance state votes to be specified for accessing the clock controller and its GDSC. Add the 'power-domains' and 'required-opps' properties to the camcc and videocc nodes.
--- arch/arm64/boot/dts/qcom/milos.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm64/boot/dts/qcom/milos.dtsi +10 -0
@@ -1949,6 +1949,11 @@ videocc: clock-controller@aaf0000 { <&sleep_clk>, <&gcc GCC_VIDEO_AHB_CLK>; + power-domains = <&rpmhpd RPMHPD_CX>, + <&rpmhpd RPMHPD_MX>; + required-opps = <&rpmhpd_opp_low_svs>, + <&rpmhpd_opp_low_svs>; + #clock-cells = <1>; #reset-cells = <1>; #power-domain-cells = <1>;
@@ -2031,6 +2036,11 @@ camcc: clock-controller@adb0000 { interconnects = <&mmss_noc MASTER_CAMNOC_HF QCOM_ICC_TAG_ALWAYS &mmss_noc SLAVE_MNOC_HF_MEM_NOC QCOM_ICC_TAG_ALWAYS>; + power-domains = <&rpmhpd RPMHPD_CX>, + <&rpmhpd RPMHPD_MX>; + required-opps = <&rpmhpd_opp_low_svs>, + <&rpmhpd_opp_low_svs>; + #clock-cells = <1>; #reset-cells = <1>; #power-domain-cells = <1>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 134/2651 dt-bindings: clock: qcom: Add GCC video axi reset clocks for Nord
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Taniya Das <[email protected]>
[ Upstream commit 348a2ae162e5ec2dbab12c226b8240b8271ca444 ]
The NW_GCC video axi reset clocks are required by the video SW driver to assert and deassert the clock resets during their power down sequence. Hence add these clock resets.
--- include/dt-bindings/clock/qcom,nord-nwgcc.h | 3 +++ 1 file changed, 3 insertions(+)
include/dt-bindings/clock/qcom,nord-nwgcc.h +3 -0
@@ -65,5 +65,8 @@#define NW_GCC_GPU_2_BCR 6#define NW_GCC_GPU_BCR 7#define NW_GCC_VIDEO_BCR 8 +#define NW_GCC_VIDEO_AXI0_CLK_ARES 9 +#define NW_GCC_VIDEO_AXI0C_CLK_ARES 10 +#define NW_GCC_VIDEO_AXI1_CLK_ARES 11#endif
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 135/2651 lsm: dont call security_backing_file_free() multiple times
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cai Xinchen <[email protected]>
[ Upstream commit 3a84fc1a21577dbc8da7e4b6a49c9d8b07c07000 ]
I found the following path:
alloc_empty_backing-file
init_file(&ff->file, xxx)
-> file_ref_init(&f->f_ref, 1); // only 1
error = init_backing_file
-> security_backing_file_alloc
-> rc = call_int_hook(backing_file_alloc, ...)
if (unlikely(rc))
security_backing_file_free(backing_file); // first call
if (unlikely(error)) {
fput(&ff->file);
-> if (unlikely(file_ref_put(&file->f_ref))) // zero
__fput_deferred(file);
-> ____fput -> __fput -> file_free(file);
-> backing_file_free(backing_file(f));
-> security_backing_file_free(&ff->file); // second callCurrently, only SELinux has the lsm backing_file_alloc hook, and it always return 0. When security_backing_file_free is called for the first time, the blobs pointer is set to NULL. Therefore, double free will not occur in the code.
--- security/security.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
security/security.c +1 -2
@@ -2486,9 +2486,8 @@ void security_backing_file_free(struct file *backing_file) {void *blob =backing_file_security (backing_file); -call_void_hook (backing_file_free, backing_file); -if (blob) { +call_void_hook (backing_file_free, backing_file);backing_file_set_security (backing_file,NULL );kmem_cache_free (lsm_backing_file_cache, blob); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 136/2651 ASoC: wcd-mbhc-v2: Fix incorrect properties names and typos
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Heidelberg <[email protected]>
[ Upstream commit 17bca5d55446c1e21944d47354ee2f0b80db36d6 ]
Improves debugging experience.
--- sound/soc/codecs/wcd-mbhc-v2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/soc/codecs/wcd-mbhc-v2.c +4 -4
@@ -864,7 +864,7 @@ static int wcd_measure_adc_continuous(struct wcd_mbhc *mbhc)u8 adc_en;/* Pre-requisites for ADC continuous measurement */ -/* Read legacy electircal detection and disable */ +/* Read legacy electrical detection and disable */ wcd_mbhc_write_field (mbhc,WCD_MBHC_ELECT_SCHMT_ISRC ,0x00 );/* Set ADC to continuous measurement */ wcd_mbhc_write_field (mbhc,WCD_MBHC_ADC_MODE ,1 );
@@ -965,7 +965,7 @@ static int wcd_check_cross_conn(struct wcd_mbhc *mbhc)if (wcd_mbhc_read_field (mbhc,WCD_MBHC_HPH_PA_EN ))return -EINVAL ; -/* Read legacy electircal detection and disable */ +/* Read legacy electrical detection and disable */ elect_ctl =wcd_mbhc_read_field (mbhc,WCD_MBHC_ELECT_SCHMT_ISRC );wcd_mbhc_write_field (mbhc,WCD_MBHC_ELECT_SCHMT_ISRC ,0 );
@@ -1470,14 +1470,14 @@ int wcd_dt_parse_mbhc_data(struct device *dev, struct wcd_mbhc_config *cfg) ret =of_property_read_u32 (np,"qcom,mbhc-headset-vthreshold-microvolt" , µvolt);if (ret) -dev_dbg (dev,"missing qcom,mbhc-hs-mic-max-vthreshold--microvolt in dt node\n" ); +dev_dbg (dev,"missing qcom,mbhc-headset-vthreshold-microvolt in dt node\n" );else cfg->hs_thr = microvolt/1000 ; ret =of_property_read_u32 (np,"qcom,mbhc-headphone-vthreshold-microvolt" , µvolt);if (ret) -dev_dbg (dev,"missing qcom,mbhc-hs-mic-min-vthreshold-microvolt entry\n" ); +dev_dbg (dev,"missing qcom,mbhc-headphone-vthreshold-microvolt entry\n" );else cfg->hph_thr = microvolt/1000 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 137/2651 pwm: renesas-tpu: Fix runtime PM reference leak
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ruoyu Wang <[email protected]>
[ Upstream commit 62cff15fbf2b12ebbb0b01ca720030c2bc12aed1 ]
tpu_pwm_timer_start() used pm_runtime_get_sync() without checking its return value before touching the TPU clock. A failed runtime resume was therefore ignored, and the callback continued into register access.
Use pm_runtime_resume_and_get() and propagate a failed resume. Keep the matching put when clock preparation fails after a successful resume.
tpu_pwm_disable() also needs to propagate a failed start so that the PWM apply callback does not access registers while runtime PM is inactive.
This issue was found by a static analysis checker and confirmed by manual source review.
--- drivers/pwm/pwm-renesas-tpu.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-)
drivers/pwm/pwm-renesas-tpu.c +18 -5
@@ -149,10 +149,14 @@ static int tpu_pwm_timer_start(struct tpu_pwm_device *tpd)if (!tpd->timer_on) {/* Wake up device and enable clock. */ -pm_runtime_get_sync (&tpd->tpu->pdev->dev); + ret =pm_runtime_resume_and_get (&tpd->tpu->pdev->dev); +if (ret <0 ) +return ret; + ret =clk_prepare_enable (tpd->tpu->clk);if (ret) {dev_err (&tpd->tpu->pdev->dev,"cannot enable clock\n" ); +pm_runtime_put (&tpd->tpu->pdev->dev);return ret; } tpd->timer_on = true;
@@ -382,15 +386,21 @@ static int tpu_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)return 0 ; } -static void tpu_pwm_disable (struct pwm_chip *chip,struct pwm_device *pwm) +static int tpu_pwm_disable (struct pwm_chip *chip,struct pwm_device *pwm) {struct tpu_device *tpu =to_tpu_device (chip);struct tpu_pwm_device *tpd = &tpu->tpd[pwm->hwpwm]; +int ret;/* The timer must be running to modify the pin output configuration. */ -tpu_pwm_timer_start (tpd); + ret =tpu_pwm_timer_start (tpd); +if (ret <0 ) +return ret; +tpu_pwm_set_pin (tpd,TPU_PIN_INACTIVE );tpu_pwm_timer_stop (tpd); + +return 0 ; } static int tpu_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
@@ -401,7 +411,10 @@ static int tpu_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,if (state->polarity != pwm->state.polarity) {if (enabled) { -tpu_pwm_disable (chip, pwm); + err =tpu_pwm_disable (chip, pwm); +if (err) +return err; + enabled = false; }
@@ -412,7 +425,7 @@ static int tpu_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,if (!state->enabled) {if (enabled) -tpu_pwm_disable (chip, pwm); +return tpu_pwm_disable (chip, pwm);return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 138/2651 spi: omap2-mcspi: Remove unbalanced pm_runtime_put_sync() calls
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Gu <[email protected]>
[ Upstream commit 5f01cb141169fe422c42279f7d502479b1ff9fd2 ]
pm_runtime_put_sync() is called in the probe error path and in remove when nothing holds a runtime PM reference anymore, so it underflows the usage count.
--- drivers/spi/spi-omap2-mcspi.c | 2 -- 1 file changed, 2 deletions(-)
drivers/spi/spi-omap2-mcspi.c +0 -2
@@ -1595,7 +1595,6 @@ static int omap2_mcspi_probe(struct platform_device *pdev) err_disable_rpm:pm_runtime_dont_use_autosuspend (&pdev->dev); -pm_runtime_put_sync (&pdev->dev);pm_runtime_disable (&pdev->dev); err_release_dma:omap2_mcspi_release_dma (ctlr);
@@ -1613,7 +1612,6 @@ static void omap2_mcspi_remove(struct platform_device *pdev)omap2_mcspi_release_dma (ctlr);pm_runtime_dont_use_autosuspend (mcspi->dev); -pm_runtime_put_sync (mcspi->dev);pm_runtime_disable (&pdev->dev); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 139/2651 soc: qcom: smem: Fix signedness bug in smem_dram_parse()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 22f129fedb153a17d80b1d883a7c4dd2417cf38e ]
The "ver" variable is type "enum ddr_info_version". Enum types are dependent on the compiler but in practical terms here, "ver" is basically an unsigned int. It needs to be signed for the -EINVAL to be handled correctly.
--- drivers/soc/qcom/smem_dramc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/qcom/smem_dramc.c +1 -1
@@ -385,7 +385,7 @@ struct dentry *smem_dram_parse(struct qcom_smem *smem, struct device *dev)return ERR_PTR (-ENODATA ); ver =smem_dram_infer_struct_version (actual_size); -if (ver <0 ) { +if ((int )ver <0 ) {/* Some SoCs don't provide data that's useful for us */ return ERR_PTR (-ENODATA ); }else if (ver ==INFO_UNKNOWN ) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 140/2651 soc: qcom: apr: clean up failed service registrations
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hongyan Xu <[email protected]>
[ Upstream commit 7dc14f37ca4ee35040c67c4b0180dd7b32079caf ]
apr_add_device() publishes a service in svcs_idr before parsing the optional protection domain and registering the device. If device registration fails, put_device() frees the apr_device while its service remains in the IDR. A received packet can then dereference that stale entry. The property error path also leaves the service and allocation behind.
Split device_register() into device_initialize() and device_add() so every pre-registration error can safely drop the device reference. Remove the service from the IDR on all failures after publication, then drain the RX workqueue before dropping the device reference. This prevents an in-flight lookup from outliving the device.
--- drivers/soc/qcom/apr.c | 44 +++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 16 deletions(-)
drivers/soc/qcom/apr.c +28 -16
@@ -434,31 +434,35 @@ static int apr_add_device(struct device *dev, struct device_node *np,if (np)snprintf (adev->name,APR_NAME_SIZE ,"%pOFn" , np); + adev->dev.bus = &aprbus; + adev->dev.parent = dev; + adev->dev.of_node = np; + adev->dev.release = apr_dev_release; + adev->dev.driver =NULL ; +device_initialize (&adev->dev); +switch (apr->type) {case PR_TYPE_APR : -dev_set_name (&adev->dev,"aprsvc:%s:%x:%x" , adev->name, - domain_id, svc_id); + ret =dev_set_name (&adev->dev,"aprsvc:%s:%x:%x" , adev->name, + domain_id, svc_id);break ;case PR_TYPE_GPR : -dev_set_name (&adev->dev,"gprsvc:%s:%x:%x" , adev->name, - domain_id, svc_id); + ret =dev_set_name (&adev->dev,"gprsvc:%s:%x:%x" , adev->name, + domain_id, svc_id);break ;default : + ret = -EINVAL ;break ; } - - adev->dev.bus = &aprbus; - adev->dev.parent = dev; - adev->dev.of_node = np; - adev->dev.release = apr_dev_release; - adev->dev.driver =NULL ; +if (ret) + goto out_put_device;spin_lock (&apr->svcs_lock); ret =idr_alloc (&apr->svcs_idr, svc, svc_id, svc_id +1 ,GFP_ATOMIC );spin_unlock (&apr->svcs_lock);if (ret <0 ) {dev_err (dev,"idr_alloc failed: %d\n" , ret); - goto out; + goto out_put_device; }/* Protection domain is optional, it does not exist on older platforms */
@@ -466,18 +470,26 @@ static int apr_add_device(struct device *dev, struct device_node *np, 1, &adev->service_path);if (ret <0 && ret != -EINVAL ) {dev_err (dev,"Failed to read second value of qcom,protection-domain\n" ); - goto out; + goto out_remove_idr; }dev_info (dev,"Adding APR/GPR dev: %s\n" ,dev_name (&adev->dev)); - ret =device_register (&adev->dev); + ret =device_add (&adev->dev);if (ret) { -dev_err (dev,"device_register failed: %d\n" , ret); -put_device (&adev->dev); +dev_err (dev,"device_add failed: %d\n" , ret); + goto out_remove_idr; } -out: +return 0 ; + +out_remove_idr: +spin_lock (&apr->svcs_lock); +idr_remove (&apr->svcs_idr, svc_id); +spin_unlock (&apr->svcs_lock); +flush_workqueue (apr->rxwq); +out_put_device: +put_device (&adev->dev);return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 141/2651 platform/chrome: cros_ec_proto: Fix deferred response
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Barnes <[email protected]>
[ Upstream commit c55749415623a58eba3eb527da023d29b43fbf5d ]
When cros_ec_wait_until_complete() succeeds after an EC_RES_IN_PROGRESS status, it previously returned the 4-byte transfer size of EC_CMD_GET_COMMS_STATUS. For 0-byte payload commands (such as EC_CMD_FLASH_ERASE), userspace received 4 bytes instead of 0, causing response size validation errors. For commands expecting non-zero response payloads, the kernel exited without issuing EC_CMD_RESEND_RESPONSE, leaving response buffers uninitialized.
Refactor cros_ec_wait_until_complete() to pass orig_msg, issue EC_CMD_RESEND_RESPONSE into orig_msg->data when insize > 0, and return 0 for 0-byte response commands.
--- drivers/platform/chrome/cros_ec_proto.c | 32 +++- drivers/platform/chrome/cros_ec_proto_test.c | 158 ++++++++++++++++++- 2 files changed, 183 insertions(+), 7 deletions(-)
drivers/platform/chrome/cros_ec_proto.c +28 -4
@@ -138,7 +138,8 @@ static int cros_ec_xfer_command(struct cros_ec_device *ec_dev, struct cros_ec_coreturn ret; } -static int cros_ec_wait_until_complete (struct cros_ec_device *ec_dev,uint32_t *result) +static int cros_ec_wait_until_complete (struct cros_ec_device *ec_dev, +struct cros_ec_command *orig_msg) { DEFINE_RAW_FLEX(struct cros_ec_command, msg, data, sizeof(struct ec_response_get_comms_status));
@@ -161,7 +162,7 @@ static int cros_ec_wait_until_complete(struct cros_ec_device *ec_dev, uint32_t *if (ret <0 )return ret; - *result = msg->result; + orig_msg->result = msg->result;if (msg->result !=EC_RES_SUCCESS )return ret;
@@ -170,8 +171,31 @@ static int cros_ec_wait_until_complete(struct cros_ec_device *ec_dev, uint32_t *break ; } -if (!(status->flags &EC_COMMS_STATUS_PROCESSING )) +if (!(status->flags &EC_COMMS_STATUS_PROCESSING )) { +u32 orig_cmd, orig_outsize, orig_version; + +/* If no response payload is expected, return 0. */ +if (orig_msg->insize ==0 ) +return 0 ; + +/* +* Request the response using EC_CMD_RESEND_RESPONSE. +* Restore the original message fields so it appears +* to be a direct response to the original command. +*/ + orig_cmd = orig_msg->command; + orig_outsize = orig_msg->outsize; + orig_version = orig_msg->version; + + orig_msg->command =EC_CMD_RESEND_RESPONSE ; + orig_msg->outsize =0 ; + orig_msg->version =0 ; + ret =cros_ec_xfer_command (ec_dev, orig_msg); + orig_msg->command = orig_cmd; + orig_msg->outsize = orig_outsize; + orig_msg->version = orig_version;return ret; + } }if (i >=EC_COMMAND_RETRIES )
@@ -185,7 +209,7 @@ static int cros_ec_send_command(struct cros_ec_device *ec_dev, struct cros_ec_coint ret =cros_ec_xfer_command (ec_dev, msg);if (msg->result ==EC_RES_IN_PROGRESS ) - ret =cros_ec_wait_until_complete (ec_dev, &msg->result); + ret =cros_ec_wait_until_complete (ec_dev, msg);return ret; }
drivers/platform/chrome/cros_ec_proto_test.c +155 -3
182 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 142/2651 staging: rtl8723bs: disable SDIO function on block size failure
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Myeonghun Pak <[email protected]>
[ Upstream commit baa84b1bb1648506333fde3e66b6540f9d7d73cc ]
sdio_init() enables the SDIO function before configuring the block size. If sdio_set_block_size() fails, the function jumps to the release path and returns the error without disabling the SDIO function. The caller then frees the dvobj directly, so the enabled SDIO function is left active on that probe failure path.
Disable the SDIO function before releasing the host when block size configuration fails.
This issue was identified during our ongoing static-analysis research while reviewing kernel code.
--- drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/rtl8723bs/os_dep/sdio_intf.c +3 -1
@@ -122,8 +122,10 @@ static u32 sdio_init(struct dvobj_priv *dvobj) goto release; err =sdio_set_block_size (func,512 ); -if (err) +if (err) { +sdio_disable_func (func); goto release; + } psdio_data->block_transfer_len =512 ; psdio_data->tx_block_mode =1 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 143/2651 staging: octeon: schedule the TX cleanup tasklet every 1024th packet
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Orgad Shaneh <[email protected]>
[ Upstream commit db57f6517bf65523968ae29cd34a790bfa7d32af ]
cvm_oct_xmit() means to schedule the cleanup tasklet once every 1024 packets, as its comment says, to cover the pathological case of heavy traffic on one port delaying the cleanup of another port blocked waiting for it.
The test is inverted: total_to_clean & 0x3ff is true for 1023 of every 1024 values, and false only on the multiples of 1024. So the tasklet is scheduled on nearly every packet, and skipped on exactly the packet the comment wants. That costs one TASKLET softirq per transmitted packet, each walking every port and doing an FAU fetch-and-add per non-empty queue, and it buys nothing for this port, which already frees its completed skbs inline from the skb_to_free value it reads out of the FAU.
Test the mask against zero. On a CN50XX board (2 cores at 300MHz) carrying ~6.9k transmitted packets/s, TASKLET softirqs drop from 7133/s to 597/s with no throughput change; the freeing work is conserved, so this removes softirq entries, not work.
--- drivers/staging/octeon/ethernet-tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/octeon/ethernet-tx.c +1 -1
@@ -481,7 +481,7 @@ netdev_tx_t cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev)cvmx_fau_fetch_and_add32 (FAU_TOTAL_TX_TO_CLEAN ,1 ); } -if (total_to_clean &0x3ff ) { +if ((total_to_clean &0x3ff ) ==0 ) {/* * Schedule the cleanup tasklet every 1024 packets for * the pathological case of high traffic on one port
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 144/2651 clk: fix self-consuming provider module pinning
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jerome Brunet <[email protected]>
[ Upstream commit a1c8d531c694e193dc48ef2428877d5ea2e35134 ]
clk_hw_get_clk() lets a provider get a struct clk for one of its own struct clk_hw.
When a struct clk is created, the module usage count of the provider is unconditionally increased. For a self-consuming provider, this means it pins itself and the module can never be unloaded.
Increasing the module usage count should only be done when the consumer lives in a different module from the provider. Use THIS_MODULE to capture caller's module and increase the module usage count accordingly.
It is OK for consumer-only APIs such as clk_get() or of_clk_get() to pass a NULL owner. As a result, any provider module will get pinned, same as before.
--- drivers/clk/clk.c | 46 ++++++++++++++++++++---------------- drivers/clk/clk.h | 5 ++-- drivers/clk/clkdev.c | 4 ++-- include/linux/clk-provider.h | 22 ++++++++++++++--- 4 files changed, 50 insertions(+), 27 deletions(-)
drivers/clk/clk.c +26 -20
@@ -166,6 +166,7 @@ struct clk {unsigned long max_rate;unsigned int exclusive_count;struct hlist_node clks_node; +bool pinning; };/*** runtime pm ***/
@@ -4237,13 +4238,15 @@ static void free_clk(struct clk *clk)* @hw: clk_hw associated with the clk being consumed * @dev_id: string describing device name * @con_id: connection ID string on device +* @owner: reference to the module creating the clock * * This is the main function used to create a clk pointer for use by clk * consumers. It connects a consumer to the clk_core and clk_hw structures * used by the framework and clk provider respectively. */ struct clk *clk_hw_create_clk (struct device *dev,struct clk_hw *hw, -const char *dev_id,const char *con_id) +const char *dev_id,const char *con_id, +struct module *owner) {struct clk *clk;struct clk_core *core;
@@ -4258,7 +4261,13 @@ struct clk *clk_hw_create_clk(struct device *dev, struct clk_hw *hw,return clk; clk->dev = dev; -if (!try_module_get (core->owner)) { +/* +* Pin the provider module only when the consumer lives in a different +* module. A provider getting a clk from its own clk_hw would otherwise +* pin itself and could never be unloaded. +*/ + clk->pinning = owner != core->owner; +if (clk->pinning && !try_module_get (core->owner)) {free_clk (clk);return ERR_PTR (-ENOENT ); }
@@ -4269,24 +4278,19 @@ struct clk *clk_hw_create_clk(struct device *dev, struct clk_hw *hw,return clk; } -/** -* clk_hw_get_clk - get clk consumer given an clk_hw -* @hw: clk_hw associated with the clk being consumed -* @con_id: connection ID string on device -* -* Returns: new clk consumer -* This is the function to be used by providers which need -* to get a consumer clk and act on the clock element -* Calls to this function must be balanced with calls clk_put() +/* +* Internal helper backing the clk_hw_get_clk() macro, which passes the caller's +* module via THIS_MODULE. */ -struct clk *clk_hw_get_clk (struct clk_hw *hw,const char *con_id) +struct clk *__clk_hw_get_clk (struct clk_hw *hw,const char *con_id, +struct module *owner) {struct device *dev = hw->core->dev;const char *name = dev ?dev_name (dev) :NULL ; -return clk_hw_create_clk (dev, hw, name, con_id); +return clk_hw_create_clk (dev, hw, name, con_id, owner); } -EXPORT_SYMBOL (clk_hw_get_clk); +EXPORT_SYMBOL (__clk_hw_get_clk);static int clk_cpy_name (const char **dst_p,const char *src,bool must_exist) {
@@ -4450,8 +4454,9 @@ __clk_register(struct device *dev, struct device_node *np, struct clk_hw *hw)INIT_HLIST_HEAD (&core->clks);/* -* Don't call clk_hw_create_clk() here because that would pin the -* provider module to itself and prevent it from ever being removed. +* Don't call clk_hw_create_clk() here because it would systematically +* add a consumer to the hw clock and all clocks would appear to have +* consumer in the clock summary. */ hw->clk =alloc_clk (core,NULL ,NULL );if (IS_ERR (hw->clk)) {
@@ -4808,7 +4813,7 @@ struct clk *devm_clk_hw_get_clk(struct device *dev, struct clk_hw *hw,if (!clkp)return ERR_PTR (-ENOMEM ); - clk =clk_hw_get_clk (hw, con_id); + clk =__clk_hw_get_clk (hw, con_id, dev->driver->owner);if (!IS_ERR (clk)) { *clkp = clk;devres_add (dev, clkp);
@@ -4855,7 +4860,8 @@ void __clk_put(struct clk *clk) owner = clk->core->owner;kref_put (&clk->core->ref, __clk_release); -module_put (owner); +if (clk->pinning) +module_put (owner);free_clk (clk); }
@@ -5376,7 +5382,7 @@ struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec) {struct clk_hw *hw =of_clk_get_hw_from_clkspec (clkspec); -return clk_hw_create_clk (NULL , hw,NULL , __func__); +return clk_hw_create_clk (NULL , hw,NULL , __func__,NULL ); }EXPORT_SYMBOL_GPL (of_clk_get_from_provider);
@@ -5403,7 +5409,7 @@ static struct clk *__of_clk_get(struct device_node *np, {struct clk_hw *hw =of_clk_get_hw (np, index, con_id); -return clk_hw_create_clk (NULL , hw, dev_id, con_id); +return clk_hw_create_clk (NULL , hw, dev_id, con_id,NULL ); }struct clk *of_clk_get (struct device_node *np,int index)
drivers/clk/clk.h +3 -2
@@ -23,13 +23,14 @@ struct clk_hw *clk_find_hw(const char *dev_id, const char *con_id);#ifdef CONFIG_COMMON_CLK struct clk *clk_hw_create_clk (struct device *dev,struct clk_hw *hw, -const char *dev_id,const char *con_id); +const char *dev_id,const char *con_id, +struct module *owner);void __clk_put (struct clk *clk);#else /* All these casts to avoid ifdefs in clkdev... */ static inline struct clk *clk_hw_create_clk (struct device *dev,struct clk_hw *hw,const char *dev_id, -const char *con_id) +const char *con_id,struct module *owner) {return (struct clk *)hw; }
drivers/clk/clkdev.c +2 -2
@@ -88,7 +88,7 @@ static struct clk *__clk_get_sys(struct device *dev, const char *dev_id, {struct clk_hw *hw =clk_find_hw (dev_id, con_id); -return clk_hw_create_clk (dev, hw, dev_id, con_id); +return clk_hw_create_clk (dev, hw, dev_id, con_id,NULL ); }struct clk *clk_get_sys (const char *dev_id,const char *con_id)
@@ -105,7 +105,7 @@ struct clk *clk_get(struct device *dev, const char *con_id)if (dev && dev->of_node) { hw =of_clk_get_hw (dev->of_node,0 , con_id);if (!IS_ERR (hw) ||PTR_ERR (hw) == -EPROBE_DEFER ) -return clk_hw_create_clk (dev, hw, dev_id, con_id); +return clk_hw_create_clk (dev, hw, dev_id, con_id,NULL ); }return __clk_get_sys (dev, dev_id, con_id);
include/linux/clk-provider.h +19 -3
@@ -50,6 +50,7 @@ struct clk;struct clk_hw ;struct clk_core ;struct dentry ; +struct module ;/** * struct clk_rate_request - Structure encoding the clk constraints that
@@ -351,8 +352,9 @@ struct clk_init_data {* @core: pointer to the struct clk_core instance that points back to this * struct clk_hw instance * -* @clk: pointer to the per-user struct clk instance that can be used to call -* into the clk API +* @clk: pointer to the per-user struct clk instance. This will be removed at +* some point in the future, Please consider the field obsolete and do not use +* it. Use clk_hw_get_clk() to get a per-user struct clk from a struct clk_hw. * * @init: pointer to struct clk_init_data that contains the init data shared * with the common clock framework. This pointer will be set to NULL once
@@ -1474,10 +1476,24 @@ static inline struct clk_hw *__clk_get_hw(struct clk *clk) }#endif -struct clk *clk_hw_get_clk (struct clk_hw *hw,const char *con_id); +struct clk *__clk_hw_get_clk (struct clk_hw *hw,const char *con_id, +struct module *owner);struct clk *devm_clk_hw_get_clk (struct device *dev,struct clk_hw *hw,const char *con_id); +/** +* clk_hw_get_clk - get clk consumer given a clk_hw +* @hw: clk_hw associated with the clk being consumed +* @con_id: connection ID string on device +* +* Return: new clk consumer +* This is the function to be used by providers which need +* to get a consumer clk and act on the clock element +* Calls to this function must be balanced with calls to clk_put() +*/ +#define clk_hw_get_clk (hw, con_id) \ + __clk_hw_get_clk((hw), (con_id), THIS_MODULE) +unsigned int clk_hw_get_num_parents (const struct clk_hw *hw);struct clk_hw *clk_hw_get_parent (const struct clk_hw *hw); struct clk_hw *clk_hw_get_parent_by_index(const struct clk_hw *hw,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 145/2651 microblaze: CCF: fix refcount leak
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander A. Klimov <[email protected]>
[ Upstream commit aeedf85beac51c7cd8f7bf4c918a0104dfdb8b78 ]
Every value returned from of_clk_get() is supposed to be cleaned up via clk_put() once not needed anymore.
--- arch/microblaze/kernel/cpu/cpuinfo.c | 1 + 1 file changed, 1 insertion(+)
arch/microblaze/kernel/cpu/cpuinfo.c +1 -0
@@ -133,6 +133,7 @@ void __init setup_cpuinfo_clk(void) cpuinfo.cpu_clock_freq =fcpu (cpu,"timebase-frequency" ); }else { cpuinfo.cpu_clock_freq =clk_get_rate (clk); +clk_put (clk); }if (!cpuinfo.cpu_clock_freq) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 146/2651 microblaze: prevent ptrace writes to MSR and pt_mode
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jérémy Jean <[email protected]>
[ Upstream commit 8518fd17ccef4a7d77877ccb0403b722106ad1a4 ]
arch_ptrace() accepts PTRACE_POKEUSR for every aligned offset below PT_SIZE. This includes the saved machine status register and pt_mode, which are kernel-owned execution state rather than general registers.
On return from an exception, rtbd copies MSR_UMS to the live MSR_UM bit. An unprivileged same-UID tracer can therefore clear MSR_UMS in its tracee's saved register frame and make the tracee resume in supervisor mode. pt_mode also controls whether later entry paths classify the frame as kernel or user state.
Reject PTRACE_POKEUSR writes to both fields while retaining read access.
--- arch/microblaze/kernel/ptrace.c | 3 +++ 1 file changed, 3 insertions(+)
arch/microblaze/kernel/ptrace.c +3 -0
@@ -101,6 +101,9 @@ long arch_ptrace(struct task_struct *child, long request, }else { rval = -EIO ; } + }else if (request ==PTRACE_POKEUSR && + (addr ==PT_MSR || addr ==PT_MODE )) { + rval = -EIO ; }else if (addr <PT_SIZE && (addr &0x3 ) ==0 ) {microblaze_reg_t *reg_addr =reg_save_addr (addr, child);if (request ==PTRACE_PEEKUSR )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 147/2651 PCI: cadence: Fix enum type mismatch warning in LTSSM debugfs
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Zhang <[email protected]>
[ Upstream commit ce8034bb9c5c50f9f5c305856aff5d1c3efe3a30 ]
Fix Clang -Wenum-compare-conditional warning by using a single u32 variable to hold the LTSSM status value, replacing two separate enum variables of different types.
--- .../pci/controller/cadence/pcie-cadence-debugfs.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/pci/controller/cadence/pcie-cadence-debugfs.c +6 -9
@@ -210,24 +210,21 @@ static const char *cdns_pcie_hpa_ltssm_status_string(enum cdns_pcie_hpa_ltssm ltstatic int ltssm_status_show (struct seq_file *s,void *v) {struct cdns_pcie *pci = s->private; -enum cdns_pcie_lga_ltssm lga_ltssm; -enum cdns_pcie_hpa_ltssm hpa_ltssm;const char *str_ltssm; -u32 val; +u32 val, ltssm_val;if (pci->is_hpa) { val =cdns_pcie_hpa_readl (pci,REG_BANK_IP_REG ,CDNS_PCIE_HPA_PHY_DBG_STS_REG0 ); - hpa_ltssm =FIELD_GET (CDNS_PCIE_HPA_LTSSM_STATUS_MASK , val); - str_ltssm =cdns_pcie_hpa_ltssm_status_string (hpa_ltssm); + ltssm_val =FIELD_GET (CDNS_PCIE_HPA_LTSSM_STATUS_MASK , val); + str_ltssm =cdns_pcie_hpa_ltssm_status_string (ltssm_val); }else { val =cdns_pcie_readl (pci,CDNS_PCIE_LM_BASE ); - lga_ltssm =FIELD_GET (CDNS_PCIE_LGA_LTSSM_STATUS_MASK , val); - str_ltssm =cdns_pcie_lga_ltssm_status_string (lga_ltssm); + ltssm_val =FIELD_GET (CDNS_PCIE_LGA_LTSSM_STATUS_MASK , val); + str_ltssm =cdns_pcie_lga_ltssm_status_string (ltssm_val); } -seq_printf (s,"%s (0x%02x)\n" , str_ltssm, - pci->is_hpa ? hpa_ltssm : lga_ltssm); +seq_printf (s,"%s (0x%02x)\n" , str_ltssm, ltssm_val);return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 148/2651 cxl/test: Map mock device nodes to an online node
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Davidlohr Bueso <[email protected]>
[ Upstream commit 6f057dea152574dd044382fd0ba5ed19e3ecba25 ]
cxl_type3_mem_init() and cxl_type2_mem_init() assign alternating NUMA nodes to the mock memdevs to model multi-node topologies. On a single-node host node 1 has no pgdat, and the first node-aware allocation in an odd device's probe faults on a NULL zonelist:
Oops: general protection fault, probably for non-canonical address 0xdffffc00000006e3 KASAN: probably user-memory-access in range [0x0000000000003718-0x000000000000371f] Workqueue: async async_run_entry_fn RIP: __alloc_frozen_pages_noprof+0x288 new_slab ___slab_alloc __kmalloc_node_track_caller_noprof devm_kmalloc cxl_mock_mem_probe
Map the requested node to an online one, as dax_hmem already does for its target node.
--- tools/testing/cxl/test/cxl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/testing/cxl/test/cxl.c +4 -4
@@ -1945,7 +1945,7 @@ static int cxl_type2_mem_init(void) goto err_mem; } pdev->dev.parent = &dport->dev; -set_dev_node (&pdev->dev, i %2 ); +set_dev_node (&pdev->dev,numa_map_to_online_node (i %2 )); rc =cxl_mock_platform_device_add (pdev, &cxl_mem[i]);if (rc)
@@ -1974,7 +1974,7 @@ static int cxl_type3_mem_init(void) goto err_mem; } pdev->dev.parent = &dport->dev; -set_dev_node (&pdev->dev, i %2 ); +set_dev_node (&pdev->dev,numa_map_to_online_node (i %2 )); rc =cxl_mock_platform_device_add (pdev, &cxl_mem[i]);if (rc)
@@ -1991,7 +1991,7 @@ static int cxl_type3_mem_init(void) goto err_single; } pdev->dev.parent = &dport->dev; -set_dev_node (&pdev->dev, i %2 ); +set_dev_node (&pdev->dev,numa_map_to_online_node (i %2 )); rc =cxl_mock_platform_device_add (pdev, &cxl_mem_single[i]);if (rc)
@@ -2009,7 +2009,7 @@ static int cxl_type3_mem_init(void) goto err_rcd; } pdev->dev.parent = &rch->dev; -set_dev_node (&pdev->dev, i %2 ); +set_dev_node (&pdev->dev,numa_map_to_online_node (i %2 )); rc =cxl_mock_platform_device_add (pdev, &cxl_rcd[i]);if (rc)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 149/2651 soundwire: intel: initialise quirk_mask before reading it
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boris Faure <[email protected]>
[ Upstream commit ee8a8cfe4e8d3c67456e554c988017c252710a25 ]
sdw_master_read_intel_prop() declares quirk_mask without an initialiser and ignores the return value of fwnode_property_read_u32(). When a BIOS does not describe "intel-quirk-mask" for a link, the property read leaves the variable untouched and stack garbage decides whether SDW_INTEL_QUIRK_MASK_BUS_DISABLE is honoured, so the link may be marked hw_disabled at random.
Initialise it to 0, matching is_link_enabled() in sound/hda/core/intel-sdw-acpi.c.
Found by code inspection, not observed at run time.
--- drivers/soundwire/intel_auxdevice.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soundwire/intel_auxdevice.c +1 -1
@@ -159,7 +159,7 @@ static int sdw_master_read_intel_prop(struct sdw_bus *bus)struct sdw_intel_prop *intel_prop;struct fwnode_handle *link;char name[32 ]; -u32 quirk_mask; +u32 quirk_mask =0 ;/* Find master handle */ snprintf(name, sizeof(name),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 150/2651 accel/amdxdna: Fix unexpected wait when flushing notifier_wq
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lizhi Hou <[email protected]>
[ Upstream commit 445d20910429b41e88768624b914344658991a5b ]
In amdxdna_gem_obj_free(), flush_workqueue(xdna->notifier_wq) waits for all pending work items on the device-global notifier workqueue, rather than only the work items associated with the BO being freed.
If another BO has a pending hmm_unreg_work, freeing an unrelated BO can be unnecessarily blocked until that work completes.
mmu_interval_notifier_remove() is deferred to a workqueue because it cannot be called from the MMU notifier callback itself. The BO free path is not a notifier callback, so call mmu_interval_notifier_remove() directly there and avoid the workqueue.
--- drivers/accel/amdxdna/amdxdna_gem.c | 69 +++++++++++++++++++---------- drivers/accel/amdxdna/amdxdna_gem.h | 1 + 2 files changed, 47 insertions(+), 23 deletions(-)
drivers/accel/amdxdna/amdxdna_gem.c +46 -23
@@ -253,13 +253,16 @@ static bool amdxdna_hmm_invalidate(struct mmu_interval_notifier *mni,struct amdxdna_gem_obj *abo = mapp->abo;struct amdxdna_dev *xdna; +if (!mmu_notifier_range_blockable (range)) +return false; + +if (mapp->unmapped) +return true; + xdna =to_xdna_dev (to_gobj (abo)->dev);XDNA_DBG (xdna,"Invalidating range 0x%lx, 0x%lx, type %d" , mapp->range.start, mapp->range.end, abo->type); -if (!mmu_notifier_range_blockable (range)) -return false; -down_write (&xdna->notifier_lock); abo->mem.map_invalid = true; mapp->invalid = true;
@@ -301,33 +304,40 @@ static void amdxdna_hmm_unregister(struct amdxdna_gem_obj *abo,down_write (&xdna->notifier_lock);list_for_each_entry (mapp, &abo->mem.umap_list, node) { -if (!vma ||compare_range (mapp, vma->vm_mm, vma->vm_start, vma->vm_end)) { -if (!mapp->unmapped) { -queue_work (xdna->notifier_wq, &mapp->hmm_unreg_work); - mapp->unmapped = true; - } -if (vma) -break ; - } +if (!compare_range (mapp, vma->vm_mm, vma->vm_start, vma->vm_end)) +continue ; + +queue_work (xdna->notifier_wq, &mapp->hmm_unreg_work); + mapp->unmapped = true; }up_write (&xdna->notifier_lock); } -static void amdxdna_umap_release (struct kref *ref) +static void amdxdna_hmm_unregister_all (struct amdxdna_gem_obj *abo) { - struct amdxdna_umap *mapp = container_of(ref, struct amdxdna_umap, refcnt); -struct amdxdna_gem_obj *abo = mapp->abo; -struct amdxdna_dev *xdna; - -mmu_interval_notifier_remove (&mapp->notifier); +struct amdxdna_dev *xdna =to_xdna_dev (to_gobj (abo)->dev); +struct amdxdna_umap *mapp, *tmp; +LIST_HEAD (dead); - xdna =to_xdna_dev (to_gobj (mapp->abo)->dev);down_write (&xdna->notifier_lock); -list_del (&mapp->node); -if (list_empty (&abo->mem.umap_list)) - abo->mem.uva =AMDXDNA_INVALID_ADDR ; +list_for_each_entry_safe (mapp, tmp, &abo->mem.umap_list, node) { + mapp->unmapped = true; + mapp->cleanup = true; +list_move (&mapp->node, &dead); + }up_write (&xdna->notifier_lock); +list_for_each_entry_safe (mapp, tmp, &dead, node) { +cancel_work_sync (&mapp->hmm_unreg_work); +amdxdna_umap_put (mapp); + } +} + +static void amdxdna_umap_release (struct kref *ref) +{ + struct amdxdna_umap *mapp = container_of(ref, struct amdxdna_umap, refcnt); + +mmu_interval_notifier_remove (&mapp->notifier);kvfree (mapp->range.hmm_pfns);kfree (mapp); }
@@ -341,6 +351,20 @@ static void amdxdna_hmm_unreg_work(struct work_struct *work) { struct amdxdna_umap *mapp = container_of(work, struct amdxdna_umap, hmm_unreg_work); +struct amdxdna_gem_obj *abo = mapp->abo; +struct amdxdna_dev *xdna; + + xdna =to_xdna_dev (to_gobj (mapp->abo)->dev); +down_write (&xdna->notifier_lock); +if (mapp->cleanup) { +up_write (&xdna->notifier_lock); +return ; + } + +list_del (&mapp->node); +if (list_empty (&abo->mem.umap_list)) + abo->mem.uva =AMDXDNA_INVALID_ADDR ; +up_write (&xdna->notifier_lock);amdxdna_umap_put (mapp); }
@@ -643,8 +667,7 @@ static void amdxdna_gem_obj_free(struct drm_gem_object *gobj)struct amdxdna_dev *xdna =to_xdna_dev (gobj->dev);struct amdxdna_gem_obj *abo =to_xdna_obj (gobj); -amdxdna_hmm_unregister (abo,NULL ); -flush_workqueue (xdna->notifier_wq); +amdxdna_hmm_unregister_all (abo);if (abo->pinned)amdxdna_gem_unpin (abo);
drivers/accel/amdxdna/amdxdna_gem.h +1 -0
@@ -20,6 +20,7 @@ struct amdxdna_umap {struct kref refcnt;bool invalid;bool unmapped; +bool cleanup; };struct amdxdna_mem {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 151/2651 accel/amdxdna: Fix possible use-after-free when freeing device BO
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lizhi Hou <[email protected]>
[ Upstream commit 6a1f6cb7593aebcdb4f9022410622128fb23b1a1 ]
When the DRM file descriptor is closed, amdxdna_client_cleanup() frees the client structure. If device BOs are still alive, freeing them may access abo->client and result in a use-after-free.
Move amdxdna_gem_heap_free(), which accesses abo->client, before clearing abo->client in the BO close callback. Also track the heap BOs referenced by device BOs so they can be accessed without dereferencing abo->client.
--- drivers/accel/amdxdna/aie2_ctx.c | 9 +- drivers/accel/amdxdna/amdxdna_gem.c | 128 ++++++++++++++++++++-------- drivers/accel/amdxdna/amdxdna_gem.h | 4 +- 3 files changed, 104 insertions(+), 37 deletions(-)
drivers/accel/amdxdna/aie2_ctx.c +8 -1
@@ -799,6 +799,7 @@ int aie2_hwctx_init(struct amdxdna_hwctx *hwctx)for (i =0 ; i <ARRAY_SIZE (priv->cmd_buf); i++) {if (!priv->cmd_buf[i])continue ; +amdxdna_gem_heap_free (client, priv->cmd_buf[i]);drm_gem_object_put (to_gobj (priv->cmd_buf[i])); }amdxdna_gem_unpin (heap);
@@ -836,8 +837,14 @@ void aie2_hwctx_fini(struct amdxdna_hwctx *hwctx)drm_sched_fini (&hwctx->priv->sched);aie2_ctx_syncobj_destroy (hwctx); -for (idx =0 ; idx <ARRAY_SIZE (hwctx->priv->cmd_buf); idx++) +for (idx =0 ; idx <ARRAY_SIZE (hwctx->priv->cmd_buf); idx++) { +/* +* The open/close will never be called for driver allocated +* dev bo. Call amdxdna_gem_heap_free explicitly. +*/ +amdxdna_gem_heap_free (hwctx->client, hwctx->priv->cmd_buf[idx]);drm_gem_object_put (to_gobj (hwctx->priv->cmd_buf[idx])); + }amdxdna_gem_unpin (hwctx->priv->heap);drm_gem_object_put (to_gobj (hwctx->priv->heap));
drivers/accel/amdxdna/amdxdna_gem.c +94 -34
256 lines not on this page · raw message
drivers/accel/amdxdna/amdxdna_gem.h +2 -2
@@ -47,8 +47,7 @@ struct amdxdna_gem_obj {/* Below members are initialized when needed */ struct drm_mm_node mm_node;/* For AMDXDNA_BO_DEV */ -u32 heap_start_id; -u32 heap_end_id; +struct xarray heap_xa;u64 dev_addr;/* For heap bo */ u32 assigned_hwctx;struct dma_buf *dma_buf;
@@ -105,6 +104,7 @@ static inline u64 amdxdna_obj_dma_addr(struct amdxdna_gem_obj *abo) }void amdxdna_umap_put (struct amdxdna_umap *mapp); +void amdxdna_gem_heap_free (struct amdxdna_client *client,struct amdxdna_gem_obj *abo);struct drm_gem_object *amdxdna_gem_create_shmem_object_cb (struct drm_device *dev,size_t size);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 152/2651 arm64: dts: rockchip: Correct Device Orientation on Gameforce Ace
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Morgan <[email protected]>
[ Upstream commit 0d170ee38e7a943248082cdb4b3e40b45a96e2f6 ]
The display, touchscreen, and IMU are currently not oriented consistently. The touchscreen is 90 degrees offset and the IMU is using the default mount matrix which is 180 degrees offset.
Fix the touchscreen alignment and add a mount matrix for the IMU. When the device is held vertically relative to the display hardware, the touchscreen 0,0 position is in the top left corner of the display (next to the home button), and the IMU reads the correct orientation.
--- arch/arm64/boot/dts/rockchip/rk3588s-gameforce-ace.dts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/rockchip/rk3588s-gameforce-ace.dts +5 -2
@@ -596,6 +596,7 @@ regulator-state-mem { &i2c3 { status = "okay"; + /* Touchscreen is rotated 90 degrees with 0,0 position near home button. */ touchscreen@14 { compatible = "goodix,gt911"; reg = <0x14>;
@@ -605,10 +606,8 @@ touchscreen@14 { pinctrl-0 = <&touch_int>, <&touch_rst>; pinctrl-names = "default"; reset-gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_HIGH>; - touchscreen-inverted-x; touchscreen-size-x = <1080>; touchscreen-size-y = <1920>; - touchscreen-swapped-x-y; }; };
@@ -641,11 +640,15 @@ channel@7 { }; }; + /* IMU oriented relative to panel, which is rotated 90 degrees. */ imu@68 { compatible = "invensense,mpu6880"; reg = <0x68>; interrupt-parent = <&gpio0>; interrupts = <RK_PD3 IRQ_TYPE_EDGE_RISING>; + mount-matrix = "-1", "0", "0", + "0", "-1", "0", + "0", "0", "1"; }; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 153/2651 cxl/ras: Pass the PCI devices struct device to match_memdev_by_parent()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Jiang <[email protected]>
[ Upstream commit 977eaad352bad4c4aac7cd15683800196c2ead57 ]
cxl_cper_handle_prot_err() hands bus_find_device() the 'struct pci_dev' where match_memdev_by_parent() expects the embedded 'struct device'. The comparison never matches. The lookup always fails and CXL endpoint protocol errors reported via CPER are dropped without a trace event, leaving only the root port, downstream and upstream cases reporting.
Pass &pdev->dev, and rename the callback parameter to match what it is.
--- drivers/cxl/core/ras.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/cxl/core/ras.c +3 -3
@@ -70,9 +70,9 @@ cxl_cper_trace_uncorr_prot_err(struct cxl_memdev *cxlmd,trace_cxl_aer_uncorrectable_error (cxlmd, status, fe, hl); } -static int match_memdev_by_parent (struct device *dev,const void *uport) +static int match_memdev_by_parent (struct device *dev,const void *parent) { -if (is_cxl_memdev (dev) && dev->parent == uport) +if (is_cxl_memdev (dev) && dev->parent == parent)return 1 ;return 0 ; }
@@ -108,7 +108,7 @@ void cxl_cper_handle_prot_err(struct cxl_cper_prot_err_work_data *data)return ; struct device *mem_dev __free(put_device) = bus_find_device( - &cxl_bus_type,NULL , pdev, match_memdev_by_parent); + &cxl_bus_type,NULL , &pdev->dev, match_memdev_by_parent);if (!mem_dev)return ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 154/2651 wifi: rtw89: coex: Fix wrong constant check of GPIO MUX signal
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gongwei Li <[email protected]>
[ Upstream commit fc17fd87d9f210850f81e547ee88eba89d6f2d50 ]
In _fw_set_gpio(), the check for an invalid GPIO signal uses sig == 0xff. However, _get_gpiosig_for_ver() never returns 0xff. Both of its failure branches return BTC_DBG_NUM (defined as 32) when the requested signal is unsupported for the current firmware version.
Check the result against BTC_DBG_NUM instead, the same as _show_gpio_dbg() already does.
--- drivers/net/wireless/realtek/rtw89/coex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/coex.c +1 -1
@@ -3365,7 +3365,7 @@ static void _fw_set_gpio(struct rtw89_dev *rtwdev, u8 type, u32 val) gpio->mux.data.dlen =CXDGPIO_SET_L2 ; gpio->mux.data.sig =_get_gpiosig_for_ver (rtwdev,FIELD_GET (GENMASK (7 ,0 ), val)); -if (gpio->mux.data.sig ==0xff ) +if (gpio->mux.data.sig >=BTC_DBG_NUM )return ; gpio->mux.data.gpio =FIELD_GET (GENMASK (15 ,8 ), val); l2_h2c = gpio->mux.fmt;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 155/2651 wifi: mm81x: fix type bugs handling sdio_readl/writel()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 37f018809909dfc99646b1b1f79c2b3968e7890a ]
The sdio_readl() and sdio_writel() functions, instead of returning kernel error codes, instead stores the error codes in a parameter. These caller functions pass should pass an int pointer to store the error code but instead pass a signed long.
This will not work on big endian systems. On little endian systems passing a ssize_t means negative error codes are converted to positive values near UINT_MAX. This doesn't cause a problem at runtime because in mm81x_sdio_reg32_write() the error codes are discarded and we always return -EIO. In mm81x_sdio_reg32_read() the high bits are truncated away so the positive value is re-converted back to negative and the code works as intended.
Either way, passing an int is the correct thing and is a cleanup.
--- drivers/net/wireless/morsemicro/mm81x/sdio.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/wireless/morsemicro/mm81x/sdio.c +4 -5
@@ -381,7 +381,7 @@ static int mm81x_sdio_dm_read(struct mm81x *mors, u32 address, u8 *data,static int mm81x_sdio_reg32_write (struct mm81x *mors,u32 address,u32 val) { -ssize_t ret =0 ; +int ret =0 ;u32 original_address = address;struct mm81x_sdio *sdio = (struct mm81x_sdio *)mors->drv_priv;struct sdio_func *func1 = sdio->func->card->sdio_func[0 ];
@@ -391,7 +391,7 @@ static int mm81x_sdio_reg32_write(struct mm81x *mors, u32 address, u32 val) address &=0x0000FFFF ;sdio_writel (func1, (__force u32 )cpu_to_le32 (val), - (__force u32 )cpu_to_le32 (address), (int *)&ret); + (__force u32 )cpu_to_le32 (address), &ret);if (ret) goto error;
@@ -411,7 +411,7 @@ static int mm81x_sdio_reg32_write(struct mm81x *mors, u32 address, u32 val)static int mm81x_sdio_reg32_read (struct mm81x *mors,u32 address,u32 *val) {u32 value; -ssize_t ret =0 ; +int ret =0 ;struct mm81x_sdio *sdio = (struct mm81x_sdio *)mors->drv_priv;struct sdio_func *func1 = sdio->func->card->sdio_func[0 ];
@@ -419,8 +419,7 @@ static int mm81x_sdio_reg32_read(struct mm81x *mors, u32 address, u32 *val) MM81X_CONFIG_ACCESS_4BYTE); address &=0x0000FFFF ; - value =sdio_readl (func1, (__force u32 )cpu_to_le32 (address), - (int *)&ret); + value =sdio_readl (func1, (__force u32 )cpu_to_le32 (address), &ret);if (ret)return ret;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 156/2651 wifi: rtw88: debugfs: dont vzalloc(0) when rsvd_page is read unconfigured
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abdurrahman Karadag <[email protected]>
[ Upstream commit 81510c3d6f2199889a4a936d8cf8b9e05911b10e ]
Reading the rsvd_page debugfs entry before writing a page offset and count to it calls vzalloc() with a size of zero, because rsvd_page.page_num defaults to 0. vmalloc warns about this:
WARNING: mm/vmalloc.c:4019 at __vmalloc_node_range_noprof+0x9ac/0xa30 ... Call Trace: __vmalloc_node_noprof+0x4c/0x70 rtw_debugfs_get_rsvd_page+0x4c/0x110 [rtw88_core] seq_read_iter+0x132/0x4b0 seq_read+0x12e/0x1c0 full_proxy_read+0x6f/0xc0 vfs_read+0xdd/0x490
rtw_fw_dump_fifo() would reject the zero size anyway, but only after the allocation. Check for a zero buffer size first and print a short usage hint instead of allocating.
--- drivers/net/wireless/realtek/rtw88/debug.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/realtek/rtw88/debug.c +5 -0
@@ -315,6 +315,11 @@ static int rtw_debugfs_get_rsvd_page(struct seq_file *m, void *v)int i;int ret; +if (!buf_size) { +seq_puts (m,"usage: echo <page_offset> <page_num> > rsvd_page\n" ); +return 0 ; + } + buf =vzalloc (buf_size);if (!buf)return -ENOMEM ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 157/2651 sched_ext/scx_flatcg: Make cgv_node_less() wraparound-safe
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tao Cui <[email protected]>
[ Upstream commit bf2f23dc5a36237c0d4738966829e5cbde973c8a ]
cgv_node_less() compares cvtimes with a plain <, which misorders once cvtime wraps: the wrapped node lands at the front of the tree while the unwrapped ones get stuck behind it. Each CPU picking a cgroup charges it a full slice, making wrap occur earlier than a naive estimate might suggest.
Use time_before() instead. cgrp_cap_budget() bounds the lag behind cvtime_now, while the lead is bounded by the slice charge plus pending cvtime_delta on re-insertion, so the cyclic ordering assumptions of time_before() hold.
--- tools/sched_ext/scx_flatcg.bpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/sched_ext/scx_flatcg.bpf.c +1 -1
@@ -144,7 +144,7 @@ static bool cgv_node_less(struct bpf_rb_node *a, const struct bpf_rb_node *b) cgc_a = container_of(a, struct cgv_node, rb_node); cgc_b = container_of(b, struct cgv_node, rb_node); -return cgc_a->cvtime < cgc_b->cvtime; +return time_before (cgc_a->cvtime, cgc_b->cvtime); }static struct fcg_cpu_ctx *find_cpu_ctx (void )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 158/2651 fuse: dont fill in.h.pid in case args->nocreds is set
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <[email protected]>
[ Upstream commit 1642e6b6a6ae0dcf61280e1c3110eba62582d4d2 ]
Commit 794e811d1443 ("fuse: split out filesystem part of request sending") alters the pid sent on force && nocreds requests.
Previously these allocated a zeroed request and skipped fuse_force_creds(), so they went out with in.h.pid == 0.
In fuse_fill_creds(), args->pid is now set before the nocreds early return, and fuse_args_to_req() copies it unconditionally - so writeback, release, and DESTROY requests now report the triggering (often kernel-worker) pid instead of 0.
Move the nocreds check above setting args->pid. Also remove the WARN_ON(!args->nocreds) from the !args->force branch, since it's obviously not going to be triggered.
--- fs/fuse/req.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
fs/fuse/req.c +3 -4
@@ -10,12 +10,12 @@ static int fuse_fill_creds(struct fuse_mount *fm, struct fuse_args *args, structkuid_t fsuid =mapped_fsuid (idmap, fc->user_ns);kgid_t fsgid =mapped_fsgid (idmap, fc->user_ns); +if (args->nocreds) +return 0 ; + args->pid =pid_nr_ns (task_pid (current), fc->pid_ns);if (args->force) { -if (args->nocreds) -return 0 ; -if (no_idmap) { args->uid =from_kuid_munged (fc->user_ns,current_fsuid ()); args->gid =from_kgid_munged (fc->user_ns,current_fsgid ());
@@ -26,7 +26,6 @@ static int fuse_fill_creds(struct fuse_mount *fm, struct fuse_args *args, structreturn 0 ; } -WARN_ON (args->nocreds);/* * Keep the old behavior when idmappings support was not * declared by a FUSE server.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 159/2651 fuse: dont bump attr_version for async direct read completion
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jingbo Xu <[email protected]>
[ Upstream commit fc60668db85584da911e5d0a65c8698628f98bba ]
The attr_version counter should only be incremented when cached attributes are actually modified (as documented in commit 1fb69e781729 ("fuse: fix race between getattr and write")). Async direct reads do not modify any cached inode attributes (size, mtime, ctime), so bumping attr_version in fuse_aio_complete() for reads is incorrect.
This unconditional bump causes a livelock when auto_inval_data is enabled together with writeback_cache: fuse_cache_read_iter() issues a FUSE_GETATTR before every read, but by the time the response arrives, an async DIO read completion has already incremented fi->attr_version past the snapshot taken before the request. The GETATTR result is then discarded (attr_version race), fi->i_time is never refreshed, and every subsequent read triggers yet another GETATTR -- creating an infinite loop of useless round-trips.
Fix this by only bumping attr_version for write completions, consistent with the synchronous DIO write path (fuse_write_update_attr) and the cached write path.
--- fs/fuse/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fuse/file.c +1 -1
@@ -689,7 +689,7 @@ static void fuse_aio_complete(struct fuse_io_priv *io, int err, ssize_t pos)struct address_space *mapping = io->iocb->ki_filp->f_mapping;ssize_t res =fuse_get_res_by_io (io); -if (res >=0 ) { +if (res >=0 && io->write) {struct fuse_conn *fc =get_fuse_conn (inode);struct fuse_inode *fi =get_fuse_inode (inode);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 160/2651 fuse: fall back to copy_splice_read() on FOPEN_DIRECT_IO
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <[email protected]>
[ Upstream commit 10bd6b32965265688fa277d166ab224de8e86eb2 ]
Yafang Shao reports:
"After upgrading the kernel from 6.1.y to 6.18.y on production servers, some containers failed to read lxcfs data. The root cause is that our lxcfs is still at the old v3.0.4, which does not include commit 25982f5 ("Set the file size to 4k") [0].
Between 6.1.y and 6.18.y, the FUSE splice_read path was converted from generic_file_splice_read() to filemap_splice_read() by commit 2cb1e08985e3 ("splice: Use filemap_splice_read() instead of generic_file_splice_read()"). Unlike generic_file_splice_read(), filemap_splice_read() strictly checks i_size and refuses to read from zero-size files, which breaks virtual FUSE filesystems like the old lxcfs."
Fix by using copy_splice_read() for the FOPEN_DIRECT_IO case, just like the VFS does for DAX and O_DIRECT files.
--- fs/fuse/file.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/fuse/file.c +4 -1
@@ -1895,7 +1895,10 @@ static ssize_t fuse_splice_read(struct file *in, loff_t *ppos,struct fuse_file *ff = in->private_data;/* FOPEN_DIRECT_IO overrides FOPEN_PASSTHROUGH */ -if (fuse_file_passthrough (ff) && !(ff->open_flags &FOPEN_DIRECT_IO )) + +if (ff->open_flags &FOPEN_DIRECT_IO ) +return copy_splice_read (in, ppos, pipe, len, flags); +else if (fuse_file_passthrough (ff))return fuse_passthrough_splice_read (in, ppos, pipe, len, flags);else return filemap_splice_read (in, ppos, pipe, len, flags);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 161/2651 sched/core: Dont steal a proxy-exec donor
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasily Gorbik <[email protected]>
[ Upstream commit 3dd95f077371f5def65a91c4bb13bd574a62bc3a ]
try_steal_cookie() avoids stealing src->core_pick and src->curr before moving a task with the same cookie via move_queued_task_locked().
With proxy-exec, src->donor is the current scheduling context and may differ from src->curr. Stealing it migrates a task that the source rq still treats as current, leaving src's scheduler state for that task stale. For CFS this means cfs_rq->curr points at the stolen entity, and the next pick on the source rq hits the WARN_ON_ONCE in put_prev_entity().
Commit 7de9d4f94638 ("sched: Start blocked_on chain processing in find_proxy_task()") tweaked the fair class logic so that the donor task isn't migrated away while we're running the proxy. Do it similarly for try_steal_cookie() and skip src->donor as well.
--- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
@@ -6517,7 +6517,7 @@ static bool try_steal_cookie(int this, int that)return false; do { - if (p == src->core_pick || p == src->curr) + if (p == src->core_pick || p == src->curr || p == src->donor) goto next; if (!is_cpu_allowed(p, this))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 162/2651 sched/core: Dont proxy-exec unmatched cookie lock owners
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasily Gorbik <[email protected]>
[ Upstream commit 09351db90a28ee6a82dc873609edfde02da5415d ]
Core scheduling chooses a core-wide cookie before __schedule() installs the next task. With proxy-exec enabled, that task becomes the donor/scheduling context, and find_proxy_task() may then replace the execution context with the runnable mutex owner. If its cookie differs from the selected core cookie, running it would bypass core scheduling's cookie selection.
When the final mutex owner found by find_proxy_task() does not match the selected core cookie, stop proxying the donor. If the current execution context is already in the blocked chain, fall back to idle like the existing proxy-exec retry paths do. Otherwise deactivate the donor and let __schedule() pick again. The mutex owner can be picked later under its own cookie.
--- kernel/sched/core.c | 8 ++++++++ 1 file changed, 8 insertions(+)
kernel/sched/core.c +8 -0
@@ -7051,6 +7051,14 @@ find_proxy_task(struct rq *rq, struct task_struct *donor, struct rq_flags *rf) owner->blocked_donor = p; }WARN_ON_ONCE (owner && !owner->on_rq); + +if (owner && !sched_cpu_cookie_match (rq, owner)) { +if (curr_in_chain) +return proxy_resched_idle (rq); + p = donor;/* Deactivate the donor, not the runnable owner */ +clear_task_blocked_on (p,NULL ); + goto deactivate; + }return owner; deactivate:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 163/2651 sched: Switch rq->next_class in proxy_reset_donor()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Stultz <[email protected]>
[ Upstream commit 1f880513859336b1d4f9731d3a67d22d0b3b6aad ]
Similar to commit 04f80f8b12a0 ("sched: Switch rq->next_class on proxy_resched_idle()"), we should also set the rq->next_class when we call proxy_reset_donor().
--- kernel/sched/core.c | 1 + 1 file changed, 1 insertion(+)
kernel/sched/core.c +1 -0
@@ -3773,6 +3773,7 @@ static inline void proxy_reset_donor(struct rq *rq)WARN_ON_ONCE (rq->donor == rq->curr);put_prev_set_next_task (rq, rq->donor, rq->curr); + rq->next_class = rq->curr->sched_class;rq_set_donor (rq, rq->curr);zap_balance_callbacks (rq);resched_curr (rq);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 164/2651 wifi: mm81x: free the firmware scratch buffer on parse failures
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linmao Li <[email protected]>
[ Upstream commit 87230a514d2ca128c3fcd96126bb18162459640f ]
mm81x_fw_load_fw() allocates fw_buf before it inspects the image, but releases it only on the success path. The two early returns taken for a malformed image leave one firmware-sized allocation attached to the device, and mm81x_fw_flash() retries the load three times.
Release it on those paths too, the way mm81x_fw_load_bcf() already does.
--- drivers/net/wireless/morsemicro/mm81x/fw.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/wireless/morsemicro/mm81x/fw.c +5 -2
@@ -117,13 +117,15 @@ static int mm81x_fw_load_fw(struct mm81x *mors, const struct firmware *fw)if (mm81x_fw_get_header (fw->data, &ehdr)) {dev_err (mors->dev,"Wrong file format" ); -return -EINVAL ; + ret = -EINVAL ; + goto out_free; }if (mm81x_fw_get_section_header (fw->data, &ehdr, &sh_strtab, ehdr.e_shstrndx)) {dev_err (mors->dev,"Invalid firmware. Missing string table" ); -return -ENOENT ; + ret = -ENOENT ; + goto out_free; } sh_strs = (const char *)fw->data + sh_strtab.sh_offset;
@@ -179,6 +181,7 @@ static int mm81x_fw_load_fw(struct mm81x *mors, const struct firmware *fw)if (ehdr.e_entry) ret =mm81x_fw_set_boot_addr (mors, ehdr.e_entry); +out_free:devm_kfree (mors->dev, fw_buf);return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 165/2651 wifi: mm81x: do not discard a failed firmware segment write
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linmao Li <[email protected]>
[ Upstream commit dc1936211335eca00acca53d058dc94fbab02028 ]
When mm81x_dm_write() fails while downloading a PT_LOAD segment, mm81x_fw_load_fw() sets ret to -EIO and breaks out of the loop. The boot address write at the end of the function then overwrites ret, so a partially downloaded image is reported as loaded and the chip is triggered on it instead of the load being retried.
Leave the function as soon as a segment fails.
--- drivers/net/wireless/morsemicro/mm81x/fw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/morsemicro/mm81x/fw.c +1 -1
@@ -162,7 +162,7 @@ static int mm81x_fw_load_fw(struct mm81x *mors, const struct firmware *fw)mm81x_release_bus (mors);if (status) { ret = -EIO ; -break ; + goto out_free; } } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 166/2651 dlm: validate lock modes in recovery messages
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Danila Chernetsov <[email protected]>
[ Upstream commit 7bf1aca6d626944091a5cb218b4e487547edff0a ]
The DLM recovery path restores lock state from rcom_lock messages received from remote nodes. The lock modes in these messages are copied directly into the local lkb state without validating that they are within the valid DLM lock mode range.
The rest of the DLM code assumes that lkb_rqmode and lkb_grmode contain valid lock modes. In particular, LVB callback handling in dlm_may_skip_callback() uses lock modes as indexes into the dlm_lvb_operations array:
dlm_lvb_operations[prev_mode + 1][mode + 1]
An invalid lock mode received during recovery could therefore result in an out-of-bounds read during subsequent LVB callback processing.
Validate rl_rqmode and rl_grmode before storing them into the local LKB state. This preserves the lock mode invariant required by the rest of the DLM code.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- fs/dlm/lock.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/dlm/lock.c +4 -0
@@ -5529,6 +5529,10 @@ static int receive_rcom_lock_args(struct dlm_ls *ls, struct dlm_lkb *lkb, {struct rcom_lock *rl = (struct rcom_lock *) rc->rc_buf; +if (rl->rl_rqmode <DLM_LOCK_IV || rl->rl_rqmode >DLM_LOCK_EX || + rl->rl_grmode <DLM_LOCK_IV || rl->rl_grmode >DLM_LOCK_EX ) +return -EINVAL ; + lkb->lkb_nodeid =le32_to_cpu (rc->rc_header.h_nodeid); lkb->lkb_ownpid =le32_to_cpu (rl->rl_ownpid); lkb->lkb_remid =le32_to_cpu (rl->rl_lkid);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 167/2651 dlm: fix NULL pointer dereference in dlm_dump_rsb_name()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Danila Chernetsov <[email protected]>
[ Upstream commit 19982c99a302ab544c69f95d37ca3070c89762d3 ]
The function dlm_dump_rsb_name() is called from receive_rcom_lookup() when a debug dump is requested via a special RCOM_LOOKUP message with rc_id == 0xFFFFFFFF.
The resource name passed to dlm_dump_rsb_name() comes from the received message. There is no guarantee that an RSB with this name exists in the local hash table.
dlm_search_rsb_tree() returns 0 when the RSB is found and stores a valid pointer in r. When the lookup fails, it returns -EBADR and leaves r NULL.
The current error handling is inverted:
if (!error)
goto out;As a result, dlm_dump_rsb() is called only when the lookup fails and r is NULL, resulting in a NULL pointer dereference.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- fs/dlm/lock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/dlm/lock.c +1 -1
@@ -1421,7 +1421,7 @@ void dlm_dump_rsb_name(struct dlm_ls *ls, const char *name, int len)rcu_read_lock (); error =dlm_search_rsb_tree (&ls->ls_rsbtbl, name, len, &r); -if (!error) +if (error) goto out;dlm_dump_rsb (r);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 168/2651 dlm: fix buffer overflow from negative len in dlm_search_rsb_tree
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joseph Qi <[email protected]>
[ Upstream commit d785f7d92f197b72d496bbcf54a160cd54f00263 ]
commit 080e5563f878c ("dlm: validate length in dlm_search_rsb_tree") only checks for len > DLM_RESNAME_MAXLEN, which does not catch negative values. While the input 'len' can be negative and a negative int passed to memcpy() is implicitly converted to a large size_t, causing a stack buffer overflow on the key[] array.
Fix this by changing the 'len' parameter type from int to unsigned int. This ensures negative values from callers are implicitly converted to large unsigned values that are caught by the existing
len > DLM_RESNAME_MAXLEN check.
Stable-dep-of: b4e6ae7ba711 ("dlm: fix variable key length lookup")
--- fs/dlm/lock.c | 6 ++++-- fs/dlm/lock.h | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-)
fs/dlm/lock.c +4 -2
@@ -622,12 +622,14 @@ static int get_rsb_struct(struct dlm_ls *ls, const void *name, int len,return 0 ; } -int dlm_search_rsb_tree (struct rhashtable *rhash,const void *name,int len, -struct dlm_rsb **r_ret) +int dlm_search_rsb_tree (struct rhashtable *rhash,const void *name, +unsigned int len,struct dlm_rsb **r_ret) {char key[DLM_RESNAME_MAXLEN ] = {}; +if (len >DLM_RESNAME_MAXLEN )return -EINVAL ; +memcpy (key, name, len); *r_ret =rhashtable_lookup_fast (rhash, &key, dlm_rhash_rsb_params);if (*r_ret)
fs/dlm/lock.h +2 -2
@@ -31,8 +31,8 @@ void resume_scan_timer(struct dlm_ls *ls);int dlm_master_lookup (struct dlm_ls *ls,int from_nodeid,const char *name,int len,unsigned int flags,int *r_nodeid,int *result); -int dlm_search_rsb_tree (struct rhashtable *rhash,const void *name,int len, -struct dlm_rsb **r_ret); +int dlm_search_rsb_tree (struct rhashtable *rhash,const void *name, +unsigned int len,struct dlm_rsb **r_ret);void dlm_recover_purge (struct dlm_ls *ls,const struct list_head *root_list);void dlm_purge_mstcpy_locks (struct dlm_rsb *r);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 169/2651 dlm: fix variable key length lookup
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Aring <[email protected]>
[ Upstream commit b4e6ae7ba711758c38d5eb7d5a7a0712273bdf6f ]
Before commit 6c648035cbe7 ("dlm: switch to use rhashtable for rsbs") the rsb hashtable was dynamic key length. Accidentally it was changed to switch to static key length which can end in different results. We fixing this back to the original behaviour by adding the necessary functionality to rhashtable to handle the objects and lookups as dynamic key lengths.
--- fs/dlm/config.c | 30 ++++++++++++++++++++++++++++-- fs/dlm/dlm_internal.h | 5 +++++ fs/dlm/lock.c | 6 ++++-- 3 files changed, 37 insertions(+), 4 deletions(-)
fs/dlm/config.c +28 -2
@@ -64,11 +64,37 @@ static void release_node(struct config_item *);static struct configfs_attribute *comm_attrs[];static struct configfs_attribute *node_attrs[]; +static u32 rsb_hashfn (const void *data,u32 len,u32 seed) +{ +const struct dlm_rsb_key *key = data; + +return jhash (key->name, key->len,0 ); +} + +static u32 rsb_obj_hashfn (const void *data,u32 len,u32 seed) +{ +const struct dlm_rsb *r = data; + +return r->res_hash; +} + +static int rsb_obj_cmpfn (struct rhashtable_compare_arg *arg,const void *obj) +{ +const struct dlm_rsb_key *key = arg->key; +const struct dlm_rsb *r = obj; + +if (key->len != r->res_length) +return -1 ; + +return memcmp (&r->res_name, key->name, key->len); +} +const struct rhashtable_params dlm_rhash_rsb_params = { .nelem_hint =3 ,/* start small */ - .key_len =DLM_RESNAME_MAXLEN , - .key_offset = offsetof(struct dlm_rsb , res_name), .head_offset = offsetof(struct dlm_rsb , res_node), + .hashfn = rsb_hashfn, + .obj_hashfn = rsb_obj_hashfn, + .obj_cmpfn = rsb_obj_cmpfn, .automatic_shrinking = true, };
fs/dlm/dlm_internal.h +5 -0
@@ -340,6 +340,11 @@ struct dlm_rsb {char res_name[DLM_RESNAME_MAXLEN +1 ]; }; +struct dlm_rsb_key { +char name[DLM_RESNAME_MAXLEN ]; +size_t len; +}; +/* dlm_master_lookup() flags */ #define DLM_LU_RECOVER_DIR 1
fs/dlm/lock.c +4 -2
@@ -625,12 +625,14 @@ static int get_rsb_struct(struct dlm_ls *ls, const void *name, int len,int dlm_search_rsb_tree (struct rhashtable *rhash,const void *name,unsigned int len,struct dlm_rsb **r_ret) { -char key[DLM_RESNAME_MAXLEN ] = {}; +struct dlm_rsb_key key = { + .len = len, + };if (len >DLM_RESNAME_MAXLEN )return -EINVAL ; -memcpy (key, name, len); +memcpy (key.name, name, len); *r_ret =rhashtable_lookup_fast (rhash, &key, dlm_rhash_rsb_params);if (*r_ret)return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 170/2651 remoteproc: imx_dsp: Acquire runtime PM before adding carveouts
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 13df1fa4f1a30571442eda64c73d6cac7b9b5c95 ]
The prepare callback publishes DSP carveouts before acquiring the runtime-PM reference that establishes required clocks and mailbox state. A PM failure therefore leaves the prepare transaction partially published.
Acquire runtime PM first and drop that reference if carveout construction fails, so a failed prepare does not add resources before its hardware prerequisite.
--- drivers/remoteproc/imx_dsp_rproc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/remoteproc/imx_dsp_rproc.c +5 -2
@@ -726,14 +726,17 @@ static int imx_dsp_rproc_prepare(struct rproc *rproc)struct device *dev = rproc->dev.parent;int ret; + ret =pm_runtime_resume_and_get (dev); +if (ret <0 ) +return ret; + ret =imx_dsp_rproc_add_carveout (priv);if (ret) {dev_err (dev,"failed on imx_dsp_rproc_add_carveout\n" ); +pm_runtime_put_sync (dev);return ret; } -pm_runtime_get_sync (dev); -return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 171/2651 arm64: dts: imx95: Avoid 32-bit PCIe window System RAM overlap
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Zhu <[email protected]>
[ Upstream commit 9094eb07b3e236233dbaac61ed30cc65be9e9c6c ]
Move the PCIe non-prefetchable memory PCI bus address from 0xe0000000 to 0x10000000 to avoid overlap with DRAM. Avoid hit this as a P2P transfer[1]. The 0x10000000 range is reserved and safe to use.
--- arch/arm64/boot/dts/freescale/imx95.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/freescale/imx95.dtsi +2 -2
@@ -1948,7 +1948,7 @@ pcie0: pcie@4c300000 { <0 0x4c340000 0 0x4000>; reg-names = "dbi", "config", "atu", "app"; ranges = <0x43000000 0x9 0x00000000 0x9 0x00000000 0x0 0xe0000000>, - <0x82000000 0x0 0xe0000000 0x9 0xe0000000 0x0 0x10000000>, + <0x82000000 0x0 0x10000000 0x9 0xe0000000 0x0 0x10000000>, <0x81000000 0x0 0x00000000 0x9 0xf0000000 0x0 0x00100000>; #address-cells = <3>; #size-cells = <2>;
@@ -2039,7 +2039,7 @@ pcie1: pcie@4c380000 { <0 0x4c3c0000 0 0x4000>; reg-names = "dbi", "config", "atu", "app"; ranges = <0x43000000 0xa 0x00000000 0xa 0x00000000 0x0 0xe0000000>, - <0x82000000 0x0 0xe0000000 0xa 0xe0000000 0x0 0x10000000>, + <0x82000000 0x0 0x10000000 0xa 0xe0000000 0x0 0x10000000>, <0x81000000 0x0 0x00000000 0xa 0xf0000000 0x0 0x00100000>; #address-cells = <3>; #size-cells = <2>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 172/2651 arm64: dts: imx94: Avoid 32-bit PCIe window System RAM overlap
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Zhu <[email protected]>
[ Upstream commit 775ebd246092294432895f8e9bd48e3f0a56714a ]
Move the PCIe non-prefetchable memory PCI bus address from 0xe0000000 to 0x10000000 to avoid overlap with DRAM. Avoid hit this as a P2P transfer[1]. The 0x10000000 range is reserved and safe to use.
--- arch/arm64/boot/dts/freescale/imx94.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx94.dtsi +1 -1
@@ -1379,7 +1379,7 @@ pcie0: pcie@4c300000 { <0 0x4c340000 0 0x4000>; reg-names = "dbi", "config", "atu", "app"; ranges = <0x43000000 0x9 0x00000000 0x9 0x00000000 0x0 0xe0000000>, - <0x82000000 0x0 0xe0000000 0x9 0xe0000000 0x0 0x10000000>, + <0x82000000 0x0 0x10000000 0x9 0xe0000000 0x0 0x10000000>, <0x81000000 0x0 0x00000000 0x9 0xf0000000 0x0 0x00100000>; #address-cells = <3>; #size-cells = <2>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 173/2651 arm64: dts: imx943: Avoid 32-bit PCIe window System RAM overlap
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Zhu <[email protected]>
[ Upstream commit fff67007ad5403966092006867fe9926aaedda0d ]
Move the PCIe non-prefetchable memory PCI bus address from 0xe0000000 to 0x10000000 to avoid overlap with DRAM. Avoid hit this as a P2P transfer[1]. The 0x10000000 range is reserved and safe to use.
--- arch/arm64/boot/dts/freescale/imx943.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx943.dtsi +1 -1
@@ -219,7 +219,7 @@ pcie1: pcie@4c380000 { <0 0x4c3c0000 0 0x4000>; reg-names = "dbi", "config", "atu", "app"; ranges = <0x43000000 0xa 0x00000000 0xa 0x00000000 0x0 0xe0000000>, - <0x82000000 0x0 0xe0000000 0xa 0xe0000000 0x0 0x10000000>, + <0x82000000 0x0 0x10000000 0xa 0xe0000000 0x0 0x10000000>, <0x81000000 0x0 0x00000000 0xa 0xf0000000 0x0 0x00100000>; #address-cells = <3>; #size-cells = <2>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 174/2651 drm/amd/display: gate DCE ASIC code behind CONFIG_DRM_AMD_DC_DCE
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gaghik Khachatrian <[email protected]>
[ Upstream commit cd2cfe4d1504342b37c3170d290aa8168deff6d7 ]
[Why&How]
Refactor to make DCE support optional.
Stable-dep-of: e377716b9863 ("drm/amd/display: use translate_curve_to_degamma_hw_format on DCN30")
--- drivers/gpu/drm/amd/display/Kconfig | 9 + .../display/dc/bios/command_table_helper.c | 7 +- .../display/dc/bios/command_table_helper2.c | 2 + .../gpu/drm/amd/display/dc/clk_mgr/Makefile | 8 + .../gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c | 4 + .../display/dc/clk_mgr/dce100/dce_clk_mgr.c | 115 ----------- .../display/dc/clk_mgr/dce100/dce_clk_mgr.h | 8 +- .../dc/clk_mgr/dce112/dce112_clk_mgr.c | 59 ------ .../dc/clk_mgr/dce112/dce112_clk_mgr.h | 4 +- .../display/dc/clk_mgr/dcn10/dcn10_clk_mgr.c | 181 ++++++++++++++++++ .../display/dc/clk_mgr/dcn10/dcn10_clk_mgr.h | 29 +++ .../gpu/drm/amd/display/dc/core/dc_resource.c | 79 ++++++++ .../gpu/drm/amd/display/dc/gpio/hw_factory.c | 4 + .../drm/amd/display/dc/gpio/hw_translate.c | 4 + drivers/gpu/drm/amd/display/dc/hwss/Makefile | 6 + .../amd/display/dc/hwss/dce110/dce110_hwseq.c | 2 + drivers/gpu/drm/amd/display/dc/irq/Makefile | 2 + .../dc/irq/dce110/irq_service_dce110.c | 21 -- .../dc/irq/dce110/irq_service_dce110.h | 9 - .../gpu/drm/amd/display/dc/irq/irq_service.c | 28 +++ .../gpu/drm/amd/display/dc/irq/irq_service.h | 9 + .../gpu/drm/amd/display/dc/resource/Makefile | 4 + .../dc/resource/dce112/dce112_resource.c | 62 ------ 23 files changed, 380 insertions(+), 276 deletions(-) create mode 100644 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn10/dcn10_clk_mgr.c create mode 100644 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn10/dcn10_clk_mgr.h
drivers/gpu/drm/amd/display/Kconfig +9 -0
@@ -34,11 +34,20 @@ config DRM_AMD_DC_SI bool "AMD DC support for Southern Islands ASICs" depends on DRM_AMDGPU_SI depends on DRM_AMD_DC + depends on DRM_AMD_DC_DCE help Choose this option to enable new AMD DC support for SI asics by default. This includes Tahiti, Pitcairn, Cape Verde, Oland. Hainan is not supported by AMD DC and it has no physical DCE6. +config DRM_AMD_DC_DCE + bool "AMD DC support for legacy DCE ASICs" + default y + depends on DRM_AMD_DC + help + Enable support for the legacy DCE (DCE 8/10/11/12) display engines. + Enabled by default so DC keeps support for these older ASICs. + config DEBUG_KERNEL_DC bool "Enable kgdb break in DC" depends on DRM_AMD_DC
drivers/gpu/drm/amd/display/dc/bios/command_table_helper.c +6 -1
@@ -35,7 +35,10 @@ bool dal_bios_parser_init_cmd_tbl_helper( const struct command_table_helper **h, enum dce_version dce) { - switch (dce) { + if (!h) + return false; + +switch (dce) {#if defined(CONFIG_DRM_AMD_DC_SI )case DCE_VERSION_6_0 :case DCE_VERSION_6_1 :
@@ -44,6 +47,7 @@ bool dal_bios_parser_init_cmd_tbl_helper(return true;#endif +#if defined(CONFIG_DRM_AMD_DC_DCE )case DCE_VERSION_8_0 :case DCE_VERSION_8_1 :case DCE_VERSION_8_3 :
@@ -62,6 +66,7 @@ bool dal_bios_parser_init_cmd_tbl_helper(case DCE_VERSION_11_22 : *h =dal_cmd_tbl_helper_dce112_get_table ();return true; +#endif default :/* Unsupported DCE */
drivers/gpu/drm/amd/display/dc/bios/command_table_helper2.c +2 -0
@@ -45,6 +45,7 @@ bool dal_bios_parser_init_cmd_tbl_helper2(return true;#endif +#if defined(CONFIG_DRM_AMD_DC_DCE )case DCE_VERSION_8_0 :case DCE_VERSION_8_1 :case DCE_VERSION_8_3 :
@@ -58,6 +59,7 @@ bool dal_bios_parser_init_cmd_tbl_helper2(case DCE_VERSION_11_0 : *h =dal_cmd_tbl_helper_dce110_get_table ();return true; +#endif case DCE_VERSION_11_2 :case DCE_VERSION_11_22 :
drivers/gpu/drm/amd/display/dc/clk_mgr/Makefile +8 -0
@@ -29,6 +29,7 @@ AMD_DAL_CLK_MGR = $(addprefix $(AMDDALPATH)/dc/clk_mgr/,$(CLK_MGR)) AMD_DISPLAY_FILES += $(AMD_DAL_CLK_MGR) +ifdef CONFIG_DRM_AMD_DC_DCE ############################################################################### # DCE 100 and DCE8x ###############################################################################
@@ -62,6 +63,13 @@ CLK_MGR_DCE120 = dce120_clk_mgr.o AMD_DAL_CLK_MGR_DCE120 = $(addprefix $(AMDDALPATH)/dc/clk_mgr/dce120/,$(CLK_MGR_DCE120)) AMD_DISPLAY_FILES += $(AMD_DAL_CLK_MGR_DCE120) +endif # CONFIG_DRM_AMD_DC_DCE + +# Shared clock helpers used by both the DCE and DCN clock managers. Built +# unconditionally (not gated on CONFIG_DRM_AMD_DC_FP) so non-FP configs that +# still build the DCE clock managers can resolve them. +AMD_DISPLAY_FILES += $(AMDDALPATH)/dc/clk_mgr/dcn10/dcn10_clk_mgr.o + ifdef CONFIG_DRM_AMD_DC_FP ############################################################################### # DCN10
drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c +4 -0
@@ -30,10 +30,12 @@#include "dc_state_priv.h" #include "link_service.h" +#if defined(CONFIG_DRM_AMD_DC_DCE )#include "dce100/dce_clk_mgr.h" #include "dce110/dce110_clk_mgr.h" #include "dce112/dce112_clk_mgr.h" #include "dce120/dce120_clk_mgr.h" +#endif #include "dcn10/rv1_clk_mgr.h" #include "dcn10/rv2_clk_mgr.h" #include "dcn20/dcn20_clk_mgr.h"
@@ -152,6 +154,7 @@ struct clk_mgr *dc_clk_mgr_create(struct dc_context *ctx, struct pp_smu_funcs *pstruct hw_asic_id asic_id = ctx->asic_id;switch (asic_id.chip_family) { +#if defined(CONFIG_DRM_AMD_DC_DCE )case FAMILY_SI :case FAMILY_CI :case FAMILY_KV : {
@@ -211,6 +214,7 @@ struct clk_mgr *dc_clk_mgr_create(struct dc_context *ctx, struct pp_smu_funcs *pdce120_clk_mgr_construct (ctx, clk_mgr);return &clk_mgr->base; } +#endif #if defined(CONFIG_DRM_AMD_DC_FP )case FAMILY_RV : {struct clk_mgr_internal *clk_mgr =kzalloc_obj (*clk_mgr);
drivers/gpu/drm/amd/display/dc/clk_mgr/dce100/dce_clk_mgr.c +0 -115
133 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/clk_mgr/dce100/dce_clk_mgr.h +1 -7
@@ -28,9 +28,9 @@#define _DCE_CLK_MGR_H_#include "dc.h" +#include "dcn10/dcn10_clk_mgr.h" /* functions shared by other dce clk mgrs */ -int dce_adjust_dp_ref_freq_for_ss (struct clk_mgr_internal *clk_mgr_dce,int dp_ref_clk_khz);int dce_get_dp_ref_freq_khz (struct clk_mgr *clk_mgr_base);uint32_t dce_get_max_pixel_clock_for_all_paths (struct dc_state *context);
@@ -40,10 +40,6 @@ void dce_clk_mgr_construct(struct dc_context *ctx, struct clk_mgr_internal *clk_mgr_dce); -void dce_clock_read_ss_info (struct clk_mgr_internal *dccg_dce); - -int dce12_get_dp_ref_freq_khz (struct clk_mgr *dccg); -int dce_set_clock (struct clk_mgr *clk_mgr_base,int requested_clk_khz);
@@ -51,6 +47,4 @@ int dce_set_clock(void dce_clk_mgr_destroy (struct clk_mgr **clk_mgr); -unsigned int dentist_get_divider_from_did (unsigned int did); -#endif /* _DCE_CLK_MGR_H_ */
drivers/gpu/drm/amd/display/dc/clk_mgr/dce112/dce112_clk_mgr.c +0 -59
65 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/clk_mgr/dce112/dce112_clk_mgr.h +2 -2
@@ -26,6 +26,8 @@#ifndef DAL_DC_DCE_DCE112_CLK_MGR_H_ #define DAL_DC_DCE_DCE112_CLK_MGR_H_ +/* dce112_set_dispclk and dce112_set_dprefclk are declared here. */ +#include "dcn10/dcn10_clk_mgr.h" void dce112_clk_mgr_construct( struct dc_context *ctx,
@@ -33,7 +35,5 @@ void dce112_clk_mgr_construct(/* functions shared with other clk mgr */ int dce112_set_clock (struct clk_mgr *clk_mgr_base,int requested_clk_khz); -int dce112_set_dispclk (struct clk_mgr_internal *clk_mgr,int requested_clk_khz); -int dce112_set_dprefclk (struct clk_mgr_internal *clk_mgr);#endif /* DAL_DC_DCE_DCE112_CLK_MGR_H_ */
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn10/dcn10_clk_mgr.c new file +181 -0
181 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn10/dcn10_clk_mgr.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* SPDX-License-Identifier: MIT +* +* Copyright 2026 Advanced Micro Devices, Inc. +*/ + +#ifndef __DCN10_CLK_MGR_H__ +#define __DCN10_CLK_MGR_H__ + +#include "dc.h" + +struct clk_mgr_internal ; + +/* +* Shared clock helpers referenced by both the DCE and DCN clock managers. +*/ +int dce_adjust_dp_ref_freq_for_ss (struct clk_mgr_internal *clk_mgr_dce,int dp_ref_clk_khz); + +void dce_clock_read_ss_info (struct clk_mgr_internal *clk_mgr_dce); + +int dce12_get_dp_ref_freq_khz (struct clk_mgr *clk_mgr_base); + +unsigned int dentist_get_divider_from_did (unsigned int did); + +int dce112_set_dispclk (struct clk_mgr_internal *clk_mgr,int requested_clk_khz); + +int dce112_set_dprefclk (struct clk_mgr_internal *clk_mgr); + +#endif /* __DCN10_CLK_MGR_H__ */
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +79 -0
108 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/gpio/hw_factory.c +4 -0
@@ -43,9 +43,11 @@#if defined(CONFIG_DRM_AMD_DC_SI )#include "dce60/hw_factory_dce60.h" #endif +#if defined(CONFIG_DRM_AMD_DC_DCE )#include "dce80/hw_factory_dce80.h" #include "dce110/hw_factory_dce110.h" #include "dce120/hw_factory_dce120.h" +#endif #include "dcn10/hw_factory_dcn10.h" #include "dcn20/hw_factory_dcn20.h" #include "dcn21/hw_factory_dcn21.h"
@@ -71,6 +73,7 @@ bool dal_hw_factory_init(dal_hw_factory_dce60_init (factory);return true;#endif +#if defined(CONFIG_DRM_AMD_DC_DCE )case DCE_VERSION_8_0 :case DCE_VERSION_8_1 :case DCE_VERSION_8_3 :
@@ -89,6 +92,7 @@ bool dal_hw_factory_init(case DCE_VERSION_12_1 :dal_hw_factory_dce120_init (factory);return true; +#endif case DCN_VERSION_1_0 :case DCN_VERSION_1_01 :dal_hw_factory_dcn10_init (factory);
drivers/gpu/drm/amd/display/dc/gpio/hw_translate.c +4 -0
@@ -43,9 +43,11 @@#if defined(CONFIG_DRM_AMD_DC_SI )#include "dce60/hw_translate_dce60.h" #endif +#if defined(CONFIG_DRM_AMD_DC_DCE )#include "dce80/hw_translate_dce80.h" #include "dce110/hw_translate_dce110.h" #include "dce120/hw_translate_dce120.h" +#endif #include "dcn10/hw_translate_dcn10.h" #include "dcn20/hw_translate_dcn20.h" #include "dcn21/hw_translate_dcn21.h"
@@ -75,6 +77,7 @@ bool dal_hw_translate_init(dal_hw_translate_dce60_init (translate);return true;#endif +#if defined(CONFIG_DRM_AMD_DC_DCE )case DCE_VERSION_8_0 :case DCE_VERSION_8_1 :case DCE_VERSION_8_3 :
@@ -90,6 +93,7 @@ bool dal_hw_translate_init(case DCE_VERSION_12_1 :dal_hw_translate_dce120_init (translate);return true; +#endif case DCN_VERSION_1_0 :case DCN_VERSION_1_01 :dal_hw_translate_dcn10_init (translate);
drivers/gpu/drm/amd/display/dc/hwss/Makefile +6 -0
@@ -36,11 +36,13 @@ endif ############################################################################### +ifdef CONFIG_DRM_AMD_DC_DCE HWSS_DCE80 = dce80_hwseq.o AMD_DAL_HWSS_DCE80 = $(addprefix $(AMDDALPATH)/dc/hwss/dce80/,$(HWSS_DCE80)) AMD_DISPLAY_FILES += $(AMD_DAL_HWSS_DCE80) +endif ###############################################################################
@@ -52,11 +54,13 @@ AMD_DISPLAY_FILES += $(AMD_DAL_HWSS_DCE) ############################################################################### +ifdef CONFIG_DRM_AMD_DC_DCE HWSS_DCE100 = dce100_hwseq.o AMD_DAL_HWSS_DCE100 = $(addprefix $(AMDDALPATH)/dc/hwss/dce100/,$(HWSS_DCE100)) AMD_DISPLAY_FILES += $(AMD_DAL_HWSS_DCE100) +endif ###############################################################################
@@ -68,6 +72,7 @@ AMD_DISPLAY_FILES += $(AMD_DAL_HWSS_DCE110) ############################################################################### +ifdef CONFIG_DRM_AMD_DC_DCE HWSS_DCE112 = dce112_hwseq.o AMD_DAL_HWSS_DCE112 = $(addprefix $(AMDDALPATH)/dc/hwss/dce112/,$(HWSS_DCE112))
@@ -81,6 +86,7 @@ HWSS_DCE120 = dce120_hwseq.o AMD_DAL_HWSS_DCE120 = $(addprefix $(AMDDALPATH)/dc/hwss/dce120/,$(HWSS_DCE120)) AMD_DISPLAY_FILES += $(AMD_DAL_HWSS_DCE120) +endif ifdef CONFIG_DRM_AMD_DC_FP ###############################################################################
drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c +2 -0
@@ -3617,6 +3617,7 @@ void dce110_disable_link_output(struct dc_link *link, dc->link_srv->dp_trace_source_sequence (link,DPCD_SOURCE_SEQ_AFTER_DISABLE_LINK_PHY ); } +#if defined(CONFIG_DRM_AMD_DC_DCE )static const struct hw_sequencer_funcs dce110_funcs = { .program_gamut_remap = program_gamut_remap, .program_output_csc = program_output_csc,
@@ -3685,4 +3686,5 @@ void dce110_hw_sequencer_construct(struct dc *dc) dc->hwss = dce110_funcs; dc->hwseq->funcs = dce110_private_funcs; } +#endif /* CONFIG_DRM_AMD_DC_DCE */
drivers/gpu/drm/amd/display/dc/irq/Makefile +2 -0
@@ -41,6 +41,7 @@ AMD_DAL_IRQ_DCE60 = $(addprefix $(AMDDALPATH)/dc/irq/dce60/,$(IRQ_DCE60)) AMD_DISPLAY_FILES += $(AMD_DAL_IRQ_DCE60) endif +ifdef CONFIG_DRM_AMD_DC_DCE ############################################################################### # DCE 8x ###############################################################################
@@ -67,6 +68,7 @@ IRQ_DCE12 = irq_service_dce120.o AMD_DAL_IRQ_DCE12 = $(addprefix $(AMDDALPATH)/dc/irq/dce120/,$(IRQ_DCE12)) AMD_DISPLAY_FILES += $(AMD_DAL_IRQ_DCE12) +endif # CONFIG_DRM_AMD_DC_DCE ############################################################################### # DCN 1x
drivers/gpu/drm/amd/display/dc/irq/dce110/irq_service_dce110.c +0 -21
@@ -179,27 +179,6 @@ static struct irq_source_info_funcs vupdate_irq_info_funcs = {#define dc_underflow_int_entry (reg_num) \ [DC_IRQ_SOURCE_DC ## reg_num ## UNDERFLOW] = dummy_irq_entry() -bool dal_irq_service_dummy_set (struct irq_service *irq_service, -const struct irq_source_info *info, -bool enable) -{ - (void )enable; -DC_LOG_ERROR ("%s: called for non-implemented irq source, src_id=%u, ext_id=%u\n" , - __func__, info->src_id, info->ext_id); - -return false; -} - -bool dal_irq_service_dummy_ack (struct irq_service *irq_service, -const struct irq_source_info *info) -{ -DC_LOG_ERROR ("%s: called for non-implemented irq source, src_id=%u, ext_id=%u\n" , - __func__, info->src_id, info->ext_id); - -return false; -} - -bool dce110_vblank_set (struct irq_service *irq_service,const struct irq_source_info *info,bool enable)
drivers/gpu/drm/amd/display/dc/irq/dce110/irq_service_dce110.h +0 -9
@@ -36,15 +36,6 @@ enum dc_irq_source to_dal_irq_source_dce110(uint32_t src_id, uint32_t ext_id); -bool dal_irq_service_dummy_set ( -struct irq_service *irq_service, -const struct irq_source_info *info, -bool enable); - -bool dal_irq_service_dummy_ack ( -struct irq_service *irq_service, -const struct irq_source_info *info); - bool dce110_vblank_set( struct irq_service *irq_service, const struct irq_source_info *info,
drivers/gpu/drm/amd/display/dc/irq/irq_service.c +28 -0
@@ -28,14 +28,18 @@#include "include/irq_service_interface.h" #include "include/logger_interface.h" +#if defined(CONFIG_DRM_AMD_DC_DCE )#include "dce110/irq_service_dce110.h" +#endif #if defined(CONFIG_DRM_AMD_DC_SI )#include "dce60/irq_service_dce60.h" #endif +#if defined(CONFIG_DRM_AMD_DC_DCE )#include "dce80/irq_service_dce80.h" #include "dce120/irq_service_dce120.h" +#endif #include "dcn10/irq_service_dcn10.h" #include "reg_helper.h"
@@ -105,6 +109,30 @@ void dal_irq_service_set_generic(dm_write_reg (irq_service->ctx, addr, value); } +/* +* Base "non-implemented source" irq handlers referenced by irq_service.c and +* every DCN irq vtable. +*/ +bool dal_irq_service_dummy_set (struct irq_service *irq_service, +const struct irq_source_info *info, +bool enable) +{ + (void )enable; +DC_LOG_ERROR ("%s: called for non-implemented irq source, src_id=%u, ext_id=%u\n" , + __func__, info->src_id, info->ext_id); + +return false; +} + +bool dal_irq_service_dummy_ack (struct irq_service *irq_service, +const struct irq_source_info *info) +{ +DC_LOG_ERROR ("%s: called for non-implemented irq source, src_id=%u, ext_id=%u\n" , + __func__, info->src_id, info->ext_id); + +return false; +} + bool dal_irq_service_set( struct irq_service *irq_service, enum dc_irq_source source,
drivers/gpu/drm/amd/display/dc/irq/irq_service.h +9 -0
@@ -90,4 +90,13 @@ bool hpd1_ack(struct irq_service *irq_service, const struct irq_source_info *info); +bool dal_irq_service_dummy_set ( +struct irq_service *irq_service, +const struct irq_source_info *info, +bool enable); + +bool dal_irq_service_dummy_ack ( +struct irq_service *irq_service, +const struct irq_source_info *info); +#endif
drivers/gpu/drm/amd/display/dc/resource/Makefile +4 -0
@@ -37,6 +37,8 @@ endif ############################################################################### +ifdef CONFIG_DRM_AMD_DC_DCE + RESOURCE_DCE80 = dce80_resource.o AMD_DAL_RESOURCE_DCE80 = $(addprefix $(AMDDALPATH)/dc/resource/dce80/,$(RESOURCE_DCE80))
@@ -75,6 +77,8 @@ AMD_DAL_RESOURCE_DCE120 = $(addprefix $(AMDDALPATH)/dc/resource/dce120/,$(RESOUR AMD_DISPLAY_FILES += $(AMD_DAL_RESOURCE_DCE120) +endif # CONFIG_DRM_AMD_DC_DCE + ifdef CONFIG_DRM_AMD_DC_FP ############################################################################### # DCN
drivers/gpu/drm/amd/display/dc/resource/dce112/dce112_resource.c +0 -62
74 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 175/2651 drm/amd/display: Refactor HUBP_WAIT_FOR_DCC_META_PROP to drop pipe_ctx
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Siemek <[email protected]>
[ Upstream commit 36a749820850e002e73c030cc59d88c43ec6735d ]
[why]Pipe_ctx shouldn't be passed as block sequence block parameter.
[how]
Precalculate delay during building stage instead during execution.
Stable-dep-of: e377716b9863 ("drm/amd/display: use translate_curve_to_degamma_hw_format on DCN30")
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 4 +- .../drm/amd/display/dc/core/dc_hw_sequencer.c | 47 +++++++++++-------- .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 24 ++-------- .../amd/display/dc/hwss/dcn401/dcn401_hwseq.h | 3 +- .../drm/amd/display/dc/hwss/hw_sequencer.h | 11 ++--- 5 files changed, 36 insertions(+), 53 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +1 -3
@@ -4973,9 +4973,7 @@ static void commit_planes_for_stream(struct dc *dc, top_pipe_to_program->stream_res.tg); } -if (dc->hwss.wait_for_dcc_meta_propagation) { - dc->hwss.wait_for_dcc_meta_propagation (dc, top_pipe_to_program); - } +hwss_hubp_wait_for_dcc_meta_prop (dc, top_pipe_to_program);if (dc->hwseq->funcs.wait_for_pipe_update_if_needed) dc->hwseq->funcs.wait_for_pipe_update_if_needed (dc, top_pipe_to_program, update_type <UPDATE_TYPE_FULL );
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +27 -20
74 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +3 -21
@@ -1332,28 +1332,10 @@ bool dcn401_apply_idle_power_optimizations(struct dc *dc, bool enable)return true; } -void dcn401_wait_for_dcc_meta_propagation (const struct dc *dc, -const struct pipe_ctx *top_pipe) +void dcn401_wait_for_dcc_meta_propagation (uint32_t delay) { -bool is_wait_needed = false; -const struct pipe_ctx *pipe_ctx = top_pipe; - -/* check if any surfaces are updating address while using flip immediate and dcc */ -while (pipe_ctx !=NULL ) { -if (pipe_ctx->plane_state && - pipe_ctx->plane_state->dcc.enable && - pipe_ctx->plane_state->flip_immediate && - pipe_ctx->plane_state->update_bits.addr_update) { - is_wait_needed = true; -break ; - } - -/* check next pipe */ - pipe_ctx = pipe_ctx->bottom_pipe; - } - -if (is_wait_needed && dc->debug.dcc_meta_propagation_delay_us >0 ) { -udelay (dc->debug.dcc_meta_propagation_delay_us); +if (delay >0 ) { +udelay (delay); } }
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.h +1 -2
@@ -57,8 +57,7 @@ void dcn401_set_cursor_position(struct pipe_ctx *pipe_ctx);bool dcn401_apply_idle_power_optimizations (struct dc *dc,bool enable); -void dcn401_wait_for_dcc_meta_propagation (const struct dc *dc, -const struct pipe_ctx *top_pipe_to_program); +void dcn401_wait_for_dcc_meta_propagation (uint32_t delay);void dcn401_prepare_bandwidth (struct dc *dc,struct dc_state *context);
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +4 -7
@@ -182,8 +182,7 @@ struct subvp_save_surf_addr { };struct wait_for_dcc_meta_propagation_params { -const struct dc *dc; -const struct pipe_ctx *top_pipe_to_program; +uint32_t delay; };struct dmub_hw_control_lock_fast_params {
@@ -1652,8 +1651,7 @@ struct hw_sequencer_funcs {bool (*is_pipe_topology_transition_seamless)(struct dc *dc,const struct dc_state *cur_ctx,const struct dc_state *new_ctx); -void (*wait_for_dcc_meta_propagation)(const struct dc *dc, -const struct pipe_ctx *top_pipe_to_program); +void (*wait_for_dcc_meta_propagation)(uint32_t delay);void (*dmub_hw_control_lock)(struct dc *dc,struct dc_state *context,bool lock);
@@ -2120,6 +2118,8 @@ void hwss_setup_periodic_interrupt(struct dc *dc, union block_sequence_params *pvoid hwss_disable_audio_stream (struct dc *dc,union block_sequence_params *params); +void hwss_hubp_wait_for_dcc_meta_prop (struct dc *dc,struct pipe_ctx *top_pipe_to_program); +void hwss_add_optc_pipe_control_lock (struct block_sequence_state *seq_state,struct dc *dc,struct pipe_ctx *pipe_ctx,bool lock);
@@ -2167,9 +2167,6 @@ void hwss_add_dmub_send_dmcub_cmd(struct block_sequence_state *seq_state,void hwss_add_dmub_subvp_save_surf_addr (struct block_sequence_state *seq_state,struct dc_dmub_srv *dc_dmub_srv,struct dc_plane_address *addr,uint8_t subvp_index); -void hwss_add_hubp_wait_for_dcc_meta_prop (struct block_sequence_state *seq_state, -struct dc *dc,struct pipe_ctx *top_pipe_to_program); -void hwss_add_hubp_wait_pipe_read_start (struct block_sequence_state *seq_state,struct hubp *hubp);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 176/2651 drm/amd/display: Refactor DPP_SET_INPUT_TRANSFER_FUNC to drop pipe_ctx
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Siemek <[email protected]>
[ Upstream commit 43bee2ff0d78f4f470062c4b7e6b20c9db92a4bf ]
[Why]Pipe_ctx shouldn't be passed as block sequence block parameter.
[How]
- Adjust arguments for:
- set_input_transfer_func,
- populate_mcm_luts,
- set_mcm_location_post_blend,
- set_mcm_luts,
- program_rmcm_luts.
- Remove const qualifier from plane_state in set_mcm_luts since it is mutated.
Stable-dep-of: e377716b9863 ("drm/amd/display: use translate_curve_to_degamma_hw_format on DCN30")
--- .../drm/amd/display/dc/core/dc_hw_sequencer.c | 68 +++++++++++++++---- .../amd/display/dc/hwss/dce110/dce110_hwseq.c | 11 ++- .../amd/display/dc/hwss/dce60/dce60_hwseq.c | 3 +- .../amd/display/dc/hwss/dcn10/dcn10_hwseq.c | 35 +++++----- .../amd/display/dc/hwss/dcn10/dcn10_hwseq.h | 3 +- .../amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 63 ++++++++--------- .../amd/display/dc/hwss/dcn20/dcn20_hwseq.h | 7 +- .../amd/display/dc/hwss/dcn30/dcn30_hwseq.c | 45 ++++++------ .../amd/display/dc/hwss/dcn30/dcn30_hwseq.h | 8 +-- .../amd/display/dc/hwss/dcn32/dcn32_hwseq.c | 60 ++++++++-------- .../amd/display/dc/hwss/dcn32/dcn32_hwseq.h | 10 +-- .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 29 ++++---- .../amd/display/dc/hwss/dcn401/dcn401_hwseq.h | 6 +- .../amd/display/dc/hwss/dcn42/dcn42_hwseq.c | 49 +++++++------ .../amd/display/dc/hwss/dcn42/dcn42_hwseq.h | 12 ++-- .../drm/amd/display/dc/hwss/hw_sequencer.h | 12 +++- .../display/dc/hwss/hw_sequencer_private.h | 18 ++--- 17 files changed, 238 insertions(+), 201 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +54 -14
@@ -1474,9 +1474,22 @@ void hwss_build_fast_sequence(struct dc *dc, (*num_steps)++; }if (hws->funcs.set_input_transfer_func && current_mpc_pipe->plane_state->update_bits.gamma_change) { - block_sequence[*num_steps].params.set_input_transfer_func_params.dc = dc; - block_sequence[*num_steps].params.set_input_transfer_func_params.pipe_ctx = current_mpc_pipe; - block_sequence[*num_steps].params.set_input_transfer_func_params.plane_state = current_mpc_pipe->plane_state; +struct pipe_ctx *primary_dpp_pipe = +resource_get_primary_dpp_pipe (current_mpc_pipe); + + block_sequence[*num_steps].params.set_input_transfer_func_params = + (struct set_input_transfer_func_params ) { + .dc = dc, + .dpp = current_mpc_pipe->plane_res.dpp, + .hubp = current_mpc_pipe->plane_res.hubp, + .primary_hubp = primary_dpp_pipe ? + primary_dpp_pipe->plane_res.hubp : current_mpc_pipe->plane_res.hubp, + .ipp = current_mpc_pipe->plane_res.ipp, + .mpc = dc->res_pool->mpc, + .mpcc_id = current_mpc_pipe->plane_res.mpcc_inst, + .stream = current_mpc_pipe->stream, + .plane_state = current_mpc_pipe->plane_state, + }; block_sequence[*num_steps].func =DPP_SET_INPUT_TRANSFER_FUNC ; (*num_steps)++; }
@@ -1677,9 +1690,7 @@ void hwss_execute_sequence(struct dc *dc, params->update_plane_addr_params.pipe_ctx);break ;case DPP_SET_INPUT_TRANSFER_FUNC : - hws->funcs.set_input_transfer_func (params->set_input_transfer_func_params.dc, - params->set_input_transfer_func_params.pipe_ctx, - params->set_input_transfer_func_params.plane_state); + hws->funcs.set_input_transfer_func (¶ms->set_input_transfer_func_params);break ;case DPP_PROGRAM_GAMUT_REMAP :if (dc->hwss.program_gamut_remap)
@@ -2246,15 +2257,25 @@ void hwss_add_hubp_update_plane_addr(struct block_sequence_state *seq_state,/* * Helper function to add DPP set input transfer function to block sequence */ -void hwss_add_dpp_set_input_transfer_func (struct block_sequence_state *seq_state, -struct dc *dc, -struct pipe_ctx *pipe_ctx, -struct dc_plane_state *plane_state) +void hwss_add_dpp_set_input_transfer_func (struct block_sequence_state *seq_state,struct dc *dc, +struct pipe_ctx *pipe_ctx) {if (*seq_state->num_steps <MAX_HWSS_BLOCK_SEQUENCE_SIZE ) { - seq_state->steps[*seq_state->num_steps].params.set_input_transfer_func_params.dc = dc; - seq_state->steps[*seq_state->num_steps].params.set_input_transfer_func_params.pipe_ctx = pipe_ctx; - seq_state->steps[*seq_state->num_steps].params.set_input_transfer_func_params.plane_state = plane_state; +struct pipe_ctx *primary_dpp_pipe =resource_get_primary_dpp_pipe (pipe_ctx); + + seq_state->steps[*seq_state->num_steps].params.set_input_transfer_func_params = + (struct set_input_transfer_func_params ) { + .dc = dc, + .dpp = pipe_ctx->plane_res.dpp, + .hubp = pipe_ctx->plane_res.hubp, + .primary_hubp = primary_dpp_pipe ? + primary_dpp_pipe->plane_res.hubp : pipe_ctx->plane_res.hubp, + .ipp = pipe_ctx->plane_res.ipp, + .mpc = dc->res_pool->mpc, + .mpcc_id = pipe_ctx->plane_res.mpcc_inst, + .plane_state = pipe_ctx->plane_state, + .stream = pipe_ctx->stream, + }; seq_state->steps[*seq_state->num_steps].func =DPP_SET_INPUT_TRANSFER_FUNC ; (*seq_state->num_steps)++; }
@@ -4526,6 +4547,26 @@ void hwss_disable_audio_stream(struct dc *dc, union block_sequence_params *param params->disable_audio_stream_params.pipe_ctx); } +void hwss_set_input_transfer_func (struct dc *dc,struct pipe_ctx *pipe_ctx) +{ +if (dc->hwseq->funcs.set_input_transfer_func) { +struct pipe_ctx *primary_dpp_pipe =resource_get_primary_dpp_pipe (pipe_ctx); + + dc->hwseq->funcs.set_input_transfer_func (&(struct set_input_transfer_func_params ) { + .dc = dc, + .dpp = pipe_ctx->plane_res.dpp, + .hubp = pipe_ctx->plane_res.hubp, + .primary_hubp = primary_dpp_pipe ? + primary_dpp_pipe->plane_res.hubp : pipe_ctx->plane_res.hubp, + .ipp = pipe_ctx->plane_res.ipp, + .mpc = dc->res_pool->mpc, + .mpcc_id = pipe_ctx->plane_res.mpcc_inst, + .plane_state = pipe_ctx->plane_state, + .stream = pipe_ctx->stream, + }); + } +} +void hwss_prepare_bandwidth (struct dc *dc,union block_sequence_params *params) {if (dc && dc->hwss.prepare_bandwidth)
@@ -6177,4 +6218,3 @@ void hwss_hubp_wait_for_dcc_meta_prop(struct dc *dc, struct pipe_ctx *top_pipe_t dc->hwss.wait_for_dcc_meta_propagation (delay); } } -
drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c +5 -6
@@ -283,11 +283,10 @@ static void dce110_prescale_params(struct ipp_prescale_params *prescale_params, }static bool -dce110_set_input_transfer_func (struct dc *dc,struct pipe_ctx *pipe_ctx, -const struct dc_plane_state *plane_state) +dce110_set_input_transfer_func (struct set_input_transfer_func_params *params) { - (void )dc; -struct input_pixel_processor *ipp = pipe_ctx->plane_res.ipp; +struct input_pixel_processor *ipp = params->ipp; +struct dc_plane_state *plane_state = params->plane_state;const struct dc_transfer_func *tf =NULL ;struct ipp_prescale_params prescale_params = {0 };bool result = true;
@@ -3140,7 +3139,6 @@ static void dce110_program_front_end_for_pipe(struct xfm_grph_csc_adjustment adjust;struct out_csc_color_matrix tbl_entry;unsigned int i; -struct dce_hwseq *hws = dc->hwseq;memset (&tbl_entry,0 ,sizeof (tbl_entry));
@@ -3199,7 +3197,7 @@ static void dce110_program_front_end_for_pipe(if (pipe_ctx->plane_state->update_bits.full_update || pipe_ctx->plane_state->update_bits.in_transfer_func_change || pipe_ctx->plane_state->update_bits.gamma_change) - hws->funcs.set_input_transfer_func (dc, pipe_ctx, pipe_ctx->plane_state); +hwss_set_input_transfer_func (dc, pipe_ctx);if (pipe_ctx->plane_state->update_bits.full_update)hwss_set_output_transfer_func (dc, pipe_ctx);
@@ -3686,5 +3684,6 @@ void dce110_hw_sequencer_construct(struct dc *dc) dc->hwss = dce110_funcs; dc->hwseq->funcs = dce110_private_funcs; } +#endif /* CONFIG_DRM_AMD_DC_DCE */
drivers/gpu/drm/amd/display/dc/hwss/dce60/dce60_hwseq.c +1 -2
@@ -275,7 +275,6 @@ dce60_program_front_end_for_pipe(struct xfm_grph_csc_adjustment adjust;struct out_csc_color_matrix tbl_entry;unsigned int i; -struct dce_hwseq *hws = dc->hwseq;DC_LOGGER_INIT ();memset (&tbl_entry,0 ,sizeof (tbl_entry));
@@ -335,7 +334,7 @@ dce60_program_front_end_for_pipe(if (pipe_ctx->plane_state->update_bits.full_update || pipe_ctx->plane_state->update_bits.in_transfer_func_change || pipe_ctx->plane_state->update_bits.gamma_change) - hws->funcs.set_input_transfer_func (dc, pipe_ctx, pipe_ctx->plane_state); +hwss_set_input_transfer_func (dc, pipe_ctx);if (pipe_ctx->plane_state->update_bits.full_update)hwss_set_output_transfer_func (dc, pipe_ctx);
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c +17 -18
@@ -2076,39 +2076,38 @@ void dcn10_update_plane_addr(const struct dc *dc, struct pipe_ctx *pipe_ctx) pipe_ctx->plane_state->address.grph_stereo.left_addr = addr; } -bool dcn10_set_input_transfer_func (struct dc *dc,struct pipe_ctx *pipe_ctx, -const struct dc_plane_state *plane_state) +bool dcn10_set_input_transfer_func (struct set_input_transfer_func_params *params) { - (void )dc; -struct dpp *dpp_base = pipe_ctx->plane_res.dpp; +struct dpp *dpp = params->dpp; +struct dc_plane_state *plane_state = params->plane_state;const struct dc_transfer_func *tf =NULL ;bool result = true; -if (dpp_base ==NULL ) +if (dpp ==NULL )return false; tf = &plane_state->in_transfer_func; -if (!dpp_base->ctx->dc->debug.always_use_regamma +if (!dpp->ctx->dc->debug.always_use_regamma && !plane_state->gamma_correction.is_identity &&dce_use_lut (plane_state->format)) - dpp_base->funcs->dpp_program_input_lut (dpp_base, &plane_state->gamma_correction); + dpp->funcs->dpp_program_input_lut (dpp, &plane_state->gamma_correction);if (tf->type ==TF_TYPE_PREDEFINED ) {switch (tf->tf) {case TRANSFER_FUNCTION_SRGB : - dpp_base->funcs->dpp_set_degamma (dpp_base, IPP_DEGAMMA_MODE_HW_sRGB); + dpp->funcs->dpp_set_degamma (dpp, IPP_DEGAMMA_MODE_HW_sRGB);break ;case TRANSFER_FUNCTION_BT709 : - dpp_base->funcs->dpp_set_degamma (dpp_base, IPP_DEGAMMA_MODE_HW_xvYCC); + dpp->funcs->dpp_set_degamma (dpp, IPP_DEGAMMA_MODE_HW_xvYCC);break ;case TRANSFER_FUNCTION_LINEAR : - dpp_base->funcs->dpp_set_degamma (dpp_base,IPP_DEGAMMA_MODE_BYPASS ); + dpp->funcs->dpp_set_degamma (dpp,IPP_DEGAMMA_MODE_BYPASS );break ;case TRANSFER_FUNCTION_PQ : - dpp_base->funcs->dpp_set_degamma (dpp_base,IPP_DEGAMMA_MODE_USER_PWL ); -cm_helper_translate_curve_to_degamma_hw_format (tf, &dpp_base->degamma_params); - dpp_base->funcs->dpp_program_degamma_pwl (dpp_base, &dpp_base->degamma_params); + dpp->funcs->dpp_set_degamma (dpp,IPP_DEGAMMA_MODE_USER_PWL ); +cm_helper_translate_curve_to_degamma_hw_format (tf, &dpp->degamma_params); + dpp->funcs->dpp_program_degamma_pwl (dpp, &dpp->degamma_params); result = true;break ;default :
@@ -2116,12 +2115,12 @@ bool dcn10_set_input_transfer_func(struct dc *dc, struct pipe_ctx *pipe_ctx,break ; } }else if (tf->type ==TF_TYPE_BYPASS ) { - dpp_base->funcs->dpp_set_degamma (dpp_base,IPP_DEGAMMA_MODE_BYPASS ); + dpp->funcs->dpp_set_degamma (dpp,IPP_DEGAMMA_MODE_BYPASS ); }else {cm_helper_translate_curve_to_degamma_hw_format (tf, - &dpp_base->degamma_params); - dpp_base->funcs->dpp_program_degamma_pwl (dpp_base, - &dpp_base->degamma_params); + &dpp->degamma_params); + dpp->funcs->dpp_program_degamma_pwl (dpp, + &dpp->degamma_params); result = true; }
@@ -3296,7 +3295,7 @@ void dcn10_program_pipe(if (pipe_ctx->plane_state->update_bits.full_update || pipe_ctx->plane_state->update_bits.in_transfer_func_change || pipe_ctx->plane_state->update_bits.gamma_change) - hws->funcs.set_input_transfer_func (dc, pipe_ctx, pipe_ctx->plane_state); +hwss_set_input_transfer_func (dc, pipe_ctx);/* dcn10_translate_regamma_to_hw_format takes 750us to finish * only do gamma programming for full update.
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.h +1 -2
@@ -74,8 +74,7 @@ void dcn10_program_output_csc(struct dc *dc,uint16_t *matrix, int opp_id);bool dcn10_set_output_transfer_func (struct set_output_transfer_func_params *params); -bool dcn10_set_input_transfer_func (struct dc *dc,struct pipe_ctx *pipe_ctx, -const struct dc_plane_state *plane_state); +bool dcn10_set_input_transfer_func (struct set_input_transfer_func_params *params);void dcn10_update_plane_addr (const struct dc *dc,struct pipe_ctx *pipe_ctx);void dcn10_update_mpcc (struct dc *dc,struct pipe_ctx *pipe_ctx); void dcn10_reset_hw_ctx_wrap(
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c +30 -33
147 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.h +3 -4
@@ -31,9 +31,9 @@void dcn20_log_color_state (struct dc *dc,struct dc_log_buffer_ctx *log_ctx);bool dcn20_set_blend_lut ( -struct pipe_ctx *pipe_ctx,const struct dc_plane_state *plane_state); +struct dpp *dpp,struct dc_plane_state *plane_state);bool dcn20_set_shaper_3dlut ( -struct pipe_ctx *pipe_ctx,const struct dc_plane_state *plane_state); +struct dpp *dpp,struct dc_plane_state *plane_state);void dcn20_program_front_end_for_ctx (struct dc *dc,struct dc_state *context);
@@ -42,8 +42,7 @@ void dcn20_post_unlock_program_front_end( struct dc_state *context);void dcn20_update_plane_addr (const struct dc *dc,struct pipe_ctx *pipe_ctx);void dcn20_update_mpcc (struct dc *dc,struct pipe_ctx *pipe_ctx); -bool dcn20_set_input_transfer_func (struct dc *dc,struct pipe_ctx *pipe_ctx, -const struct dc_plane_state *plane_state); +bool dcn20_set_input_transfer_func (struct set_input_transfer_func_params *params);bool dcn20_set_output_transfer_func (struct set_output_transfer_func_params *params); void dcn20_program_output_csc(struct dc *dc, struct pipe_ctx *pipe_ctx,
drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c +21 -24
86 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.h +3 -5
@@ -56,12 +56,10 @@ bool dcn30_mmhubbub_warmup(void dcn30_log_color_state (struct dc *dc,struct dc_log_buffer_ctx *log_ctx); -bool dcn30_set_blend_lut (struct pipe_ctx *pipe_ctx, -const struct dc_plane_state *plane_state); +bool dcn30_set_blend_lut (struct dpp *dpp, +struct dc_plane_state *plane_state); -bool dcn30_set_input_transfer_func (struct dc *dc, -struct pipe_ctx *pipe_ctx, -const struct dc_plane_state *plane_state); +bool dcn30_set_input_transfer_func (struct set_input_transfer_func_params *params);void dcn30_program_gamut_remap (struct program_gamut_remap_params *params);
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c +31 -29
112 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.h +5 -5
@@ -47,12 +47,12 @@ void dcn32_cab_for_ss_control(struct dc *dc, bool enable);void dcn32_commit_subvp_config (struct dc *dc,struct dc_state *context); -bool dcn32_set_mcm_luts (struct pipe_ctx *pipe_ctx, -const struct dc_plane_state *plane_state); +bool dcn32_set_mcm_luts (struct dc *dc,struct dpp *dpp,struct hubp *hubp, +struct hubp *primary_hubp,struct mpc *mpc,int mpcc_id, +struct dc_stream_state *stream, +struct dc_plane_state *plane_state); -bool dcn32_set_input_transfer_func (struct dc *dc, -struct pipe_ctx *pipe_ctx, -const struct dc_plane_state *plane_state); +bool dcn32_set_input_transfer_func (struct set_input_transfer_func_params *params);bool dcn32_set_mpc_shaper_3dlut (struct dpp *dpp_base,struct mpc *mpc,int mpcc_id,const struct dc_stream_state *stream);
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +13 -16
@@ -420,18 +420,12 @@ void dcn401_trigger_3dlut_dma_load(struct pipe_ctx *pipe_ctx) } } -bool dcn401_set_mcm_luts (struct pipe_ctx *pipe_ctx, -const struct dc_plane_state *plane_state) +bool dcn401_set_mcm_luts (struct dc *dc,struct dpp *dpp,struct hubp *hubp, +struct hubp *primary_hubp,struct mpc *mpc,int mpcc_id, +struct dc_stream_state *stream, +struct dc_plane_state *plane_state) { -struct dc *dc = pipe_ctx->plane_res.hubp->ctx->dc; -const struct pipe_ctx *primary_dpp_pipe_ctx =resource_get_primary_dpp_pipe (pipe_ctx); -struct dpp *dpp_base = pipe_ctx->plane_res.dpp; -struct hubp *hubp = pipe_ctx->plane_res.hubp; -struct hubp *primary_hubp = primary_dpp_pipe_ctx ? - primary_dpp_pipe_ctx->plane_res.hubp : hubp;/* fall back to current pipe */ const struct dc_plane_cm *cm = &plane_state->cm; -int mpcc_id = hubp->inst; -struct mpc *mpc = dc->res_pool->mpc;union mcm_lut_params m_lut_params;struct dc_3dlut_dma lut3d_dma;bool lut_enable;
@@ -439,6 +433,9 @@ bool dcn401_set_mcm_luts(struct pipe_ctx *pipe_ctx,bool rval;bool result = true; + (void )dc; + (void )stream; +/* decide LUT bank based on current in use */ mpc->funcs->get_lut_mode (mpc,MCM_LUT_1DLUT , mpcc_id, &lut_enable, &lut_bank_a);if (!lut_enable) {
@@ -465,9 +462,9 @@ bool dcn401_set_mcm_luts(struct pipe_ctx *pipe_ctx,else if (cm->blend_func.type ==TF_TYPE_DISTRIBUTED_POINTS ) { rval =cm3_helper_translate_curve_to_hw_format (plane_state->ctx, &cm->blend_func, - &dpp_base->regamma_params, + &dpp->regamma_params, false); - m_lut_params.pwl = rval ? &dpp_base->regamma_params :NULL ; + m_lut_params.pwl = rval ? &dpp->regamma_params :NULL ; }if (!m_lut_params.pwl) {
@@ -492,9 +489,9 @@ bool dcn401_set_mcm_luts(struct pipe_ctx *pipe_ctx,ASSERT (false); rval =cm3_helper_translate_curve_to_hw_format (plane_state->ctx, &cm->shaper_func, - &dpp_base->shaper_params, + &dpp->shaper_params, true); - m_lut_params.pwl = rval ? &dpp_base->shaper_params :NULL ; + m_lut_params.pwl = rval ? &dpp->shaper_params :NULL ; }if (!m_lut_params.pwl) { lut_enable = false;
@@ -2287,7 +2284,7 @@ void dcn401_program_pipe( pipe_ctx->plane_state->update_bits.gamma_change || pipe_ctx->plane_state->update_bits.lut_3d || pipe_ctx->update_flags.bits.enable)) - hws->funcs.set_input_transfer_func(dc, pipe_ctx, pipe_ctx->plane_state); +hwss_set_input_transfer_func (dc, pipe_ctx);/* dcn10_translate_regamma_to_hw_format takes 750us to finish * only do gamma programming for powering on, internal memcmp to avoid
@@ -2444,7 +2441,7 @@ void dcn401_program_pipe_sequence( pipe_ctx->plane_state->update_bits.lut_3d || pipe_ctx->update_flags.bits.enable)) { -hwss_add_dpp_set_input_transfer_func (seq_state, dc, pipe_ctx, pipe_ctx->plane_state); +hwss_add_dpp_set_input_transfer_func (seq_state, dc, pipe_ctx); }/* dcn10_translate_regamma_to_hw_format takes 750us to finish
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.h +4 -2
@@ -36,8 +36,10 @@ void dcn401_program_gamut_remap(struct program_gamut_remap_params *params);void dcn401_init_hw (struct dc *dc); -bool dcn401_set_mcm_luts (struct pipe_ctx *pipe_ctx, -const struct dc_plane_state *plane_state); +bool dcn401_set_mcm_luts (struct dc *dc,struct dpp *dpp,struct hubp *hubp, +struct hubp *primary_hubp,struct mpc *mpc,int mpcc_id, +struct dc_stream_state *stream, +struct dc_plane_state *plane_state);bool dcn401_set_output_transfer_func (struct set_output_transfer_func_params *params);void dcn401_trigger_3dlut_dma_load (struct pipe_ctx *pipe_ctx); void dcn401_calculate_dccg_tmds_div_value(struct pipe_ctx *pipe_ctx,
drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.c +23 -26
81 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.h +8 -4
@@ -15,15 +15,19 @@ void dcn42_program_cm_hist(struct pipe_ctx *pipe_ctx, const struct dc_plane_state *plane_state); -bool dcn42_set_mcm_luts (struct pipe_ctx *pipe_ctx, -const struct dc_plane_state *plane_state); +bool dcn42_set_mcm_luts (struct dc *dc,struct dpp *dpp,struct hubp *hubp, +struct hubp *primary_hubp,struct mpc *mpc,int mpcc_id, +struct dc_stream_state *stream, +struct dc_plane_state *plane_state);bool dcn42_program_rmcm_luts ( +struct dc *dc, +struct dpp *dpp,struct hubp *hubp, -struct pipe_ctx *pipe_ctx,const struct dc_plane_cm *cm,struct mpc *mpc, -int mpcc_id); +int mpcc_id, +struct dc_stream_state *stream);void dcn42_hardware_release (struct dc *dc); void dcn42_prepare_bandwidth(
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +10 -2
@@ -90,7 +90,13 @@ struct update_plane_addr_params {struct set_input_transfer_func_params {struct dc *dc; -struct pipe_ctx *pipe_ctx; +struct dpp *dpp; +struct hubp *hubp; +struct hubp *primary_hubp; +struct mpc *mpc; +int mpcc_id; +struct dc_stream_state *stream; +struct input_pixel_processor *ipp;struct dc_plane_state *plane_state; };
@@ -2120,6 +2126,8 @@ void hwss_disable_audio_stream(struct dc *dc, union block_sequence_params *paramvoid hwss_hubp_wait_for_dcc_meta_prop (struct dc *dc,struct pipe_ctx *top_pipe_to_program); +void hwss_set_input_transfer_func (struct dc *dc,struct pipe_ctx *pipe_ctx); +void hwss_add_optc_pipe_control_lock (struct block_sequence_state *seq_state,struct dc *dc,struct pipe_ctx *pipe_ctx,bool lock);
@@ -2133,7 +2141,7 @@ void hwss_add_hubp_update_plane_addr(struct block_sequence_state *seq_state, struct dc *dc, struct pipe_ctx *pipe_ctx);void hwss_add_dpp_set_input_transfer_func (struct block_sequence_state *seq_state, -struct dc *dc,struct pipe_ctx *pipe_ctx,struct dc_plane_state *plane_state); +struct dc *dc,struct pipe_ctx *pipe_ctx);void hwss_add_dpp_program_gamut_remap (struct block_sequence_state *seq_state,struct pipe_ctx *pipe_ctx);
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer_private.h +9 -9
@@ -90,9 +90,7 @@ struct hwseq_private_funcs {void (*update_mpcc)(struct dc *dc,struct pipe_ctx *pipe_ctx);void (*update_mpcc_sequence)(struct dc *dc,struct pipe_ctx *pipe_ctx,struct block_sequence_state *seq_state); -bool (*set_input_transfer_func)(struct dc *dc, -struct pipe_ctx *pipe_ctx, -const struct dc_plane_state *plane_state); +bool (*set_input_transfer_func)(struct set_input_transfer_func_params *params);bool (*set_output_transfer_func)(struct set_output_transfer_func_params *params);void (*power_down)(struct dc *dc); void (*enable_display_pipe_clock_gating)(struct dc_context *ctx,
@@ -187,12 +185,14 @@ struct hwseq_private_funcs { struct block_sequence_state *seq_state);bool (*wait_for_blank_complete)(struct output_pixel_processor *opp);void (*dccg_init)(struct dce_hwseq *hws); -bool (*set_blend_lut)(struct pipe_ctx *pipe_ctx, -const struct dc_plane_state *plane_state); -bool (*set_shaper_3dlut)(struct pipe_ctx *pipe_ctx, -const struct dc_plane_state *plane_state); -bool (*set_mcm_luts)(struct pipe_ctx *pipe_ctx, -const struct dc_plane_state *plane_state); +bool (*set_blend_lut)(struct dpp *dpp, +struct dc_plane_state *plane_state); +bool (*set_shaper_3dlut)(struct dpp *dpp, +struct dc_plane_state *plane_state); +bool (*set_mcm_luts)(struct dc *dc,struct dpp *dpp,struct hubp *hubp, +struct hubp *primary_hubp,struct mpc *mpc,int mpcc_id, +struct dc_stream_state *stream, +struct dc_plane_state *plane_state);void (*PLAT_58856_wa)(struct dc_state *context,struct pipe_ctx *pipe_ctx);void (*setup_hpo_hw_control)(const struct dce_hwseq *hws,bool enable);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 177/2651 drm/amd/display: use translate_curve_to_degamma_hw_format on DCN30
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Melissa Wen <[email protected]>
[ Upstream commit e377716b9863fb79c59e0f1f7612a1ebf160f8cc ]
DCN3.01 presents the same banding issue as reported in the link below, but the previous fix doesn't cover this hw. Change the helper used to translate degamma/blend curves to HW points for DCN30, DCN 301, DCN31 and DCN314 similar to what was done for DCN32+ by commit 3719314af322 ("drm/amd/display: use a separate helper to translate degamma curves").
--- .../gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c +4 -6
@@ -242,10 +242,9 @@ bool dcn30_set_blend_lut(if (plane_state->cm.blend_func.type ==TF_TYPE_HWPWL ) blend_lut = &plane_state->cm.blend_func.pwl;else if (plane_state->cm.blend_func.type ==TF_TYPE_DISTRIBUTED_POINTS ) { - result =cm3_helper_translate_curve_to_hw_format (plane_state->ctx, + result =cm3_helper_translate_curve_to_degamma_hw_format ( &plane_state->cm.blend_func, - &dpp->regamma_params, - false); + &dpp->regamma_params);if (!result)return result;
@@ -335,9 +334,8 @@ bool dcn30_set_input_transfer_func(struct set_input_transfer_func_params *paramsif (plane_state->in_transfer_func.type ==TF_TYPE_HWPWL ) pwl_params = &plane_state->in_transfer_func.pwl;else if (plane_state->in_transfer_func.type ==TF_TYPE_DISTRIBUTED_POINTS && -cm3_helper_translate_curve_to_hw_format (plane_state->ctx, - &plane_state->in_transfer_func, - &dpp->degamma_params, false)) +cm3_helper_translate_curve_to_degamma_hw_format (&plane_state->in_transfer_func, + &dpp->degamma_params)) pwl_params = &dpp->degamma_params; result = dpp->funcs->dpp_program_gamcor_lut (dpp, pwl_params);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 178/2651 x86/crash: Reserve elfcorehdr for CONFIG_NR_CPUS, not CONFIG_NR_CPUS_DEFAULT
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ionut Nechita <[email protected]>
[ Upstream commit 6664ad1026b558563702f9a1ce637df33e7c001e ]
NR_CPUS_DEFAULT is purely a Kconfig thing. Its entire purpose in life is to start NR_CPUS at a sane value. There is precisely one (buggy) reference to it outside of Kconfig in the whole kernel: the x86 crash code.
That code undersizes the elfcorehdr reservation whenever NR_CPUS exceeds NR_CPUS_DEFAULT, because the header carries one phdr per possible CPU and num_possible_cpus() is bounded by NR_CPUS. kexec_file_load(2) then fails with -EINVAL from sanity_check_segment_list(), and kexec_load(2) silently truncates the elfcorehdr, which surfaces later as a bad or unusable dump.
Size the elfcorehdr reservation with NR_CPUS instead.
--- arch/x86/kernel/crash.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/kernel/crash.c +3 -3
@@ -369,9 +369,9 @@ int crash_load_segments(struct kimage *image)* maximum CPUs and maximum memory ranges. */ if (IS_ENABLED (CONFIG_MEMORY_HOTPLUG )) - pnum =2 +CONFIG_NR_CPUS_DEFAULT +CONFIG_CRASH_MAX_MEMORY_RANGES ; + pnum =2 +CONFIG_NR_CPUS +CONFIG_CRASH_MAX_MEMORY_RANGES ;else - pnum +=2 +CONFIG_NR_CPUS_DEFAULT ; + pnum +=2 +CONFIG_NR_CPUS ;if (pnum < (unsigned long )PN_XNUM ) { kbuf.memsz = pnum *sizeof (Elf64_Phdr);
@@ -430,7 +430,7 @@ unsigned int arch_crash_get_elfcorehdr_size(void)unsigned int sz;/* kernel_map, VMCOREINFO and maximum CPUs */ - sz =2 +CONFIG_NR_CPUS_DEFAULT ; + sz =2 +CONFIG_NR_CPUS ;if (IS_ENABLED (CONFIG_MEMORY_HOTPLUG )) sz +=CONFIG_CRASH_MAX_MEMORY_RANGES ; sz *=sizeof (Elf64_Phdr);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 179/2651 bpftool: Set BPF_F_XDP_DEV_BOUND_ONLY flag non-destructively
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit 06d6f845c4bda857a6ae864690f35321b878e827 ]
When setting the XDP hints ifname, bpftool would set the BPF_F_XDP_DEV_BOUND_ONLY without looking at the existing program flags, overriding any other flag values. This was always a destructive action, but after we change libbpf to carry the frags section flag in prog_flags, this can impact bpftool loading of XDP frags programs.
Change the flag setting to be non-destructive by OR'ing it with the existing flags.
--- tools/bpf/bpftool/prog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bpf/bpftool/prog.c +1 -1
@@ -1769,7 +1769,7 @@ static int load_with_options(int argc, char **argv, bool first_prog_only) }if (prog_type ==BPF_PROG_TYPE_XDP && xdpmeta_ifindex) { -bpf_program__set_flags (pos,BPF_F_XDP_DEV_BOUND_ONLY ); +bpf_program__set_flags (pos,bpf_program__flags (pos) |BPF_F_XDP_DEV_BOUND_ONLY );bpf_program__set_ifindex (pos, xdpmeta_ifindex); }else {bpf_program__set_ifindex (pos, offload_ifindex);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 180/2651 libbpf: Move section-defined program flags to prog_flags
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit d6b633b585f348053dd27044b1b39972c748c1fa ]
The libbpf section definition modifiers for XDP frags support and sleepable programs stores the flags bits only in the private section definition cookie from object open to load time. This has the unfortunate consequence that API consumers cannot see (or manipulate) the flag between object open and program load.
In particular, libxdp has special handling of frags-enabled programs to make them compatible with the dispatcher. This doesn't work on XDP programs that enable frags through the 'xdp.frags' section definition because the flag is not visible through bpf_program__flags()[0].
Fix this by changing how libbpf loads the program flags from section
definitions: instead of using the private section definition cookie, add a setup function to the default section definitions that stores the flags for sleepable and XDP frags programs in the prog_flags field of struct bpf_program.
Exposing the flags this way means that any use of bpf_program__set_flags() will override the flags unless the caller takes care of updating flags in a non-destructive way. This is unavoidable with the set-only API, and any user setting flags unconditionally is already broken in the sense that they will also override any other current and future flags.
In addition, prog_flags survives program type changes through bpf_program__set_type(). It is the responsibility of the caller to ensure the flags are cleared if they are incompatible with the new program type.
[0] https://github.com/xdp-project/xdp-tools/issues/587
--- tools/lib/bpf/libbpf.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
tools/lib/bpf/libbpf.c +14 -6
@@ -7886,6 +7886,19 @@ static int tracing_multi_mod_fd(struct bpf_program *prog, int *btf_obj_fd)return 0 ; } +static int libbpf_setup_prog_flags (struct bpf_program *prog,long cookie) +{ +enum sec_def_flags def = cookie; + +if (def &SEC_SLEEPABLE ) + prog->prog_flags |=BPF_F_SLEEPABLE ; + +if (def &SEC_XDP_FRAGS ) + prog->prog_flags |=BPF_F_XDP_HAS_FRAGS ; + +return 0 ; +} +/* this is called as prog->sec_def->prog_prepare_load_fn for libbpf-supported sec_defs */ static int libbpf_prepare_prog_load (struct bpf_program *prog,struct bpf_prog_load_opts *opts,long cookie)
@@ -7896,12 +7909,6 @@ static int libbpf_prepare_prog_load(struct bpf_program *prog,if ((def &SEC_EXP_ATTACH_OPT ) && !kernel_supports (prog->obj,FEAT_EXP_ATTACH_TYPE )) opts->expected_attach_type =0 ; -if (def &SEC_SLEEPABLE ) - opts->prog_flags |=BPF_F_SLEEPABLE ; - -if (prog->type ==BPF_PROG_TYPE_XDP && (def &SEC_XDP_FRAGS )) - opts->prog_flags |=BPF_F_XDP_HAS_FRAGS ; -/* special check for usdt to use uprobe_multi link */ if ((def &SEC_USDT ) &&kernel_supports (prog->obj,FEAT_UPROBE_MULTI_LINK )) {/* for BPF_TRACE_UPROBE_MULTI, user might want to query expected_attach_type
@@ -10106,6 +10113,7 @@ int bpf_program__clone(struct bpf_program *prog, const struct bpf_prog_load_opts .prog_type = BPF_PROG_TYPE_##ptype, \ .expected_attach_type = atype, \ .cookie = (long)(flags), \ + .prog_setup_fn = libbpf_setup_prog_flags, \ .prog_prepare_load_fn = libbpf_prepare_prog_load, \ __VA_ARGS__ \ }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 181/2651 net: dsa: yt921x: Check lock status with lockdep_assert_held_once()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Yang <[email protected]>
[ Upstream commit b1950d0426aabdda485c86b504106b1d7b11f325 ]
mutex_is_locked() was used to check the lock status. While it should not be triggered unless a bug is introduced, it does not warn on lock being held by another thread. Fix it with lockdep helpers.
--- drivers/net/dsa/yt921x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/dsa/yt921x.c +2 -2
@@ -198,14 +198,14 @@ static u32 ethaddr_lo2_to_u32(const unsigned char *addr)static int yt921x_reg_read (struct yt921x_priv *priv,u32 reg,u32 *valp) { -WARN_ON (!mutex_is_locked (&priv->reg_lock)); +lockdep_assert_held_once (&priv->reg_lock);return priv->reg_ops->read (priv->reg_ctx, reg, valp); }static int yt921x_reg_write (struct yt921x_priv *priv,u32 reg,u32 val) { -WARN_ON (!mutex_is_locked (&priv->reg_lock)); +lockdep_assert_held_once (&priv->reg_lock);return priv->reg_ops->write (priv->reg_ctx, reg, val); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 182/2651 PCI: endpoint: pci-epf-vntb: Pass PF/VF number when BAR programming
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Koichiro Den <[email protected]>
[ Upstream commit afe2aa9dc93d904730bab63f5ccb514a318e6464 ]
vntb_epf_mw_set_trans() programs the memory-window BAR through pci_epc_set_bar() with hardcoded function numbers (0, 0), so the BAR lands on the wrong function whenever the vNTB EPF is bound to anything but PF0. The other BAR programming sites in the vNTB driver already pass the EPF's own numbers.
Pass the EPF's own func_no/vfunc_no here as well.
--- drivers/pci/endpoint/functions/pci-epf-vntb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pci/endpoint/functions/pci-epf-vntb.c +2 -1
@@ -1438,7 +1438,8 @@ static int vntb_epf_mw_set_trans(struct ntb_dev *ndev, int pidx, int idx, epf_bar->barno = barno; epf_bar->size = size; - ret =pci_epc_set_bar (ntb->epf->epc,0 ,0 , epf_bar); + ret =pci_epc_set_bar (ntb->epf->epc, ntb->epf->func_no, + ntb->epf->vfunc_no, epf_bar);if (ret) {dev_err (dev,"failure set mw trans\n" );return ret;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 183/2651 dmaengine: fsl_raid: dont invoke client callback under desc_lock
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit 62c267ce97444f8a381f2bb3cd5d534eb362c540 ]
fsl_re_dequeue() holds re_chan->desc_lock while calling fsl_re_desc_done(), which synchronously invokes the DMA client completion callback via dmaengine_desc_get_callback_invoke(). If that callback submits new work (e.g. fsl_re_tx_submit()), it tries to reacquire the same desc_lock and deadlocks on the spinlock.
Collect completed descriptors into a local list under the lock, then release the lock and invoke the callbacks before moving the descriptors to the ack queue.
--- drivers/dma/fsl_raid.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/dma/fsl_raid.c +13 -2
@@ -162,6 +162,7 @@ static void fsl_re_dequeue(struct tasklet_struct *t)struct fsl_re_hw_desc *hwdesc;unsigned long flags;unsigned int count, oub_count; +LIST_HEAD (completed);int found;fsl_re_cleanup_descs (re_chan);
@@ -182,8 +183,7 @@ static void fsl_re_dequeue(struct tasklet_struct *t) }if (found) { -fsl_re_desc_done (desc); -list_move_tail (&desc->node, &re_chan->ack_q); +list_move_tail (&desc->node, &completed); }else {dev_err (re_chan->dev,"found hwdesc not in sw queue, discard it\n" );
@@ -196,6 +196,17 @@ static void fsl_re_dequeue(struct tasklet_struct *t) FSL_RE_RMVD_JOB(1)); }spin_unlock_irqrestore (&re_chan->desc_lock, flags); + +/* Invoke the client callbacks outside the channel lock. The callback +* may submit new work which re-acquires desc_lock, so holding it here +* would deadlock. +*/ +list_for_each_entry_safe (desc, _desc, &completed, node) { +fsl_re_desc_done (desc); +spin_lock_irqsave (&re_chan->desc_lock, flags); +list_move_tail (&desc->node, &re_chan->ack_q); +spin_unlock_irqrestore (&re_chan->desc_lock, flags); + } }/* Per Job Ring interrupt handler */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 184/2651 dmaengine: fsl_raid: avoid free_q underflow in free_chan_resources
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit d805aa5b6088b193debabaa80cc0991bfa2bd057 ]
fsl_re_free_chan_resources() loops alloc_count times calling list_first_entry() on free_q without checking whether the list still has entries. If descriptors remain un-acked or pending in submit_q / active_q / ack_q when the channel resources are freed, free_q becomes smaller than alloc_count and list_first_entry() returns the list head, causing list_del() to corrupt the list head and dereference a bogus pointer.
Walk free_q with list_for_each_entry_safe() until it is empty, decrementing alloc_count per freed descriptor, instead of relying on the alloc_count count.
--- drivers/dma/fsl_raid.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/dma/fsl_raid.c +3 -6
@@ -614,18 +614,15 @@ static int fsl_re_alloc_chan_resources(struct dma_chan *chan)static void fsl_re_free_chan_resources (struct dma_chan *chan) {struct fsl_re_chan *re_chan; -struct fsl_re_desc *desc; +struct fsl_re_desc *desc, *_desc; re_chan = container_of(chan, struct fsl_re_chan, chan); -while (re_chan->alloc_count--) { - desc =list_first_entry (&re_chan->free_q, - struct fsl_re_desc, - node); - +list_for_each_entry_safe (desc, _desc, &re_chan->free_q, node) {list_del (&desc->node);dma_pool_free (re_chan->re_dev->cf_desc_pool, desc->cf_addr, desc->cf_paddr);kfree (desc); + re_chan->alloc_count--; }if (!list_empty (&re_chan->free_q))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 185/2651 dmaengine: at_hdmac: fix sparse __iomem cast warning in memset helpers
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit fdae0d0f096c92dd05d3722759fd614ea341e0dc ]
Both atc_prep_dma_memset() and atc_prep_dma_memset_sg() declare vaddr as 'void __iomem *' but assign the return of dma_pool_alloc(), which returns 'void *' (not iomem memory). This causes sparse to warn about a cast removing the __iomem address space at the dereference site.
The struct field memset_vaddr is also typed as 'int *', which is neither the type returned by dma_pool_alloc() nor the type used for the actual writes.
Fix by declaring vaddr as 'u32 *' in both functions and changing memset_vaddr in struct at_desc from 'int *' to 'u32 *'. This matches the actual usage and eliminates the need for the (u32 *) cast.
--- drivers/dma/at_hdmac.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/dma/at_hdmac.c +8 -8
@@ -244,7 +244,7 @@ struct at_desc {/* Memset temporary buffer */ bool memset_buffer;dma_addr_t memset_paddr; -int *memset_vaddr; +u32 *memset_vaddr; struct atdma_sg sg[] __counted_by(sglen); };
@@ -1097,7 +1097,7 @@ atc_prep_dma_memset(struct dma_chan *chan, dma_addr_t dest, int value,struct at_dma_chan *atchan =to_at_dma_chan (chan);struct at_dma *atdma =to_at_dma (chan->device);struct at_desc *desc; -void __iomem *vaddr; +u32 *vaddr;dma_addr_t paddr;char fill_pattern;int ret;
@@ -1126,10 +1126,10 @@ atc_prep_dma_memset(struct dma_chan *chan, dma_addr_t dest, int value,/* Only the first byte of value is to be used according to dmaengine */ fill_pattern = (char )value; - *(u32 *)vaddr = (fill_pattern <<24 ) | - (fill_pattern <<16 ) | - (fill_pattern <<8 ) | - fill_pattern; + *vaddr = (fill_pattern <<24 ) | + (fill_pattern <<16 ) | + (fill_pattern <<8 ) | + fill_pattern; desc =kzalloc_flex (*desc, sg,1 ,GFP_ATOMIC );if (!desc)
@@ -1168,7 +1168,7 @@ atc_prep_dma_memset_sg(struct dma_chan *chan,struct at_dma *atdma =to_at_dma (chan->device);struct at_desc *desc;struct scatterlist *sg; -void __iomem *vaddr; +u32 *vaddr;dma_addr_t paddr;size_t total_len =0 ;int i;
@@ -1189,7 +1189,7 @@ atc_prep_dma_memset_sg(struct dma_chan *chan, __func__);return NULL ; } - *(u32 *)vaddr = value; + *vaddr = value; desc =kzalloc_flex (*desc, sg, sg_len,GFP_ATOMIC );if (!desc)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 186/2651 arm64: dts: qcom: qcs6490-rb3gen2: clean up PCI function nodes
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Elder <[email protected]>
[ Upstream commit df4107fc729e3bffce27fe0ed06fc6a64dd675cd ]
The TC9564 SoC contains a PCIe switch with three downstream ports. The third downstream port connects to an embedded PCI endpoint, and that endpoint implements two PCI functions.
The devicetree node describing those functions incorrectly includes this property:
device_type = "pci";
That property should only be used for a PCI device "that implements a PCI bus", but not a PCIe function. So remove the device_type property from the nodes representing the two embedded PCI functions.
Additionally, only PCI bridge nodes should be named "pcie@" (or "pci@"). PCI endpoint nodes are typically named based on the functionality they implement (e.g., "ethernet@"). In this case, the role of these PCI functions is not (yet) specified, and furthermore they will be used with PCI endpoint buses. Rename these to use "dev@", following the convention used in of_pci_make_dev_node() for dynamically-created devicetree nodes.
Finally, those properties contain #address-cells, #size-cells, and ranges properties. And although these properties *will* be appropriate for these functions on an RB3gen2, they are not normally used for PCI functions. So remove these properties as well; we'll include them in the commit that actually adds a pci-ep-bus sub-node to these PCI function nodes.
--- arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +2 -10
@@ -954,20 +954,12 @@ pcie@3,0 { ranges; bus-range = <0x5 0xff>; - pcie@0,0 { + dev@0,0 { reg = <0x50000 0x0 0x0 0x0 0x0>; - #address-cells = <3>; - #size-cells = <2>; - device_type = "pci"; - ranges; }; - pcie@0,1 { + dev@0,1 { reg = <0x50100 0x0 0x0 0x0 0x0>; - #address-cells = <3>; - #size-cells = <2>; - device_type = "pci"; - ranges; }; }; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 187/2651 arm64: dts: qcom: qcs6490-rb3gen2-industrial-mezzanine: clean up PCI function nodes
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Elder <[email protected]>
[ Upstream commit aaedd4ea312d6fd70dfc5cf430edf5106c5b3382 ]
The qcs6490-rb3gen2-industrial-mezzanine overlay defines two nodes representing TC956x chips, each of which contains a PCIe switch and an embedded endpoint that implements two PCIe functions.
The devicetree nodes erroneously include a "pci" device_type property for the two PCIe functions. That property should only be used for a PCI device "that implements a PCI bus". Remove this property for the two function nodes.
In addition, only PCI bridge nodes should be named "pcie@" (or "pci@"). PCI endpoint nodes are typically named based on the functionality they implement (e.g., "ethernet@"). In this case, the role of these PCI functions is not (yet) specified, and furthermore they will be used with PCI endpoint buses. Rename these to use "dev@", following the convention used in of_pci_make_dev_node() for dynamically-created devicetree nodes.
Finally, these nodes define #address-cells, #size-cells, and ranges properties, which are not normally defined for PCIe endpoints. Remove these properties as well; they can be added back once they are actually needed/used.
--- .../qcs6490-rb3gen2-industrial-mezzanine.dtso | 24 ++++--------------- 1 file changed, 4 insertions(+), 20 deletions(-)
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2-industrial-mezzanine.dtso +4 -20
@@ -130,20 +130,12 @@ pcie@3,0 { ranges; bus-range = <0x5 0xff>; - pcie@0,0 { + dev@0,0 { reg = <0x50000 0x0 0x0 0x0 0x0>; - #address-cells = <3>; - #size-cells = <2>; - device_type = "pci"; - ranges; }; - pcie@0,1 { + dev@0,1 { reg = <0x50100 0x0 0x0 0x0 0x0>; - #address-cells = <3>; - #size-cells = <2>; - device_type = "pci"; - ranges; }; };
@@ -225,20 +217,12 @@ pcie@3,0 { ranges; bus-range = <0x5 0xff>; - pcie@0,0 { + dev@0,0 { reg = <0x50000 0x0 0x0 0x0 0x0>; - #address-cells = <3>; - #size-cells = <2>; - device_type = "pci"; - ranges; }; - pcie@0,1 { + dev@0,1 { reg = <0x50100 0x0 0x0 0x0 0x0>; - #address-cells = <3>; - #size-cells = <2>; - device_type = "pci"; - ranges; }; }; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 188/2651 arm64: dts: qcom: lemans-evk-ifp-mezzanine: clean up PCI function nodes
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Elder <[email protected]>
[ Upstream commit ca3027cfe8c7ef612910d2f04e58d75ec8a9b427 ]
The lemans-evk-ifp-mezzanine overlay defines a node representing a TC956x chip which contains a PCIe switch and an embedded endpoint that implements two PCIe functions.
The devicetree nodes erroneously include a "pci" device_type property for the two PCIe functions. That property should only be used for a PCI device "that implements a PCI bus". Remove this property for the two function nodes.
In addition, only PCI bridge nodes should be named "pcie@" (or "pci@"). PCI endpoint nodes are typically named based on the functionality they implement (e.g., "ethernet@"). In this case, the role of these PCI functions is not (yet) specified, and furthermore they will be used with PCI endpoint buses. Rename these to use "dev@", following the convention used in of_pci_make_dev_node() for dynamically-created devicetree nodes.
Finally, these nodes define #address-cells, #size-cells, and ranges properties, which are not normally defined for PCIe endpoints. Remove these properties as well; they can be added back once they are actually needed/used.
--- .../boot/dts/qcom/lemans-evk-ifp-mezzanine.dtso | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
arch/arm64/boot/dts/qcom/lemans-evk-ifp-mezzanine.dtso +2 -10
@@ -271,20 +271,12 @@ pcie@3,0 { ranges; bus-range = <0x5 0xff>; - pcie@0,0 { + dev@0,0 { reg = <0x50000 0x0 0x0 0x0 0x0>; - #address-cells = <3>; - #size-cells = <2>; - device_type = "pci"; - ranges; }; - pcie@0,1 { + dev@0,1 { reg = <0x50100 0x0 0x0 0x0 0x0>; - #address-cells = <3>; - #size-cells = <2>; - device_type = "pci"; - ranges; }; }; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 189/2651 arm64: dts: qcom: monaco-evk-ifp-mezzanine: clean up PCI function nodes
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Elder <[email protected]>
[ Upstream commit 0f8cbe572057b0ef98c651fbd6da1877983c7165 ]
The monaco-evk-ifp-mezzanine overlay defines a node representing a TC956x chip which contains a PCIe switch and an embedded endpoint that implements two PCIe functions.
The devicetree nodes erroneously include a "pci" device_type property for the two PCIe functions. That property should only be used for a PCI device "that implements a PCI bus". Remove this property for the two function nodes.
In addition, only PCI bridge nodes should be named "pcie@" (or "pci@"). PCI endpoint nodes are typically named based on the functionality they implement (e.g., "ethernet@"). In this case, the role of these PCI functions is not (yet) specified, and furthermore they will be used with PCI endpoint buses. Rename these to use "dev@", following the convention used in of_pci_make_dev_node() for dynamically-created devicetree nodes.
Finally, these nodes define #address-cells, #size-cells, and ranges properties, which are not normally defined for PCIe endpoints. Remove these properties as well; they can be added back once they are actually needed/used.
--- .../boot/dts/qcom/monaco-evk-ifp-mezzanine.dtso | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
arch/arm64/boot/dts/qcom/monaco-evk-ifp-mezzanine.dtso +2 -10
@@ -117,20 +117,12 @@ pcie@3,0 { ranges; bus-range = <0x5 0xff>; - pcie@0,0 { + dev@0,0 { reg = <0x50000 0x0 0x0 0x0 0x0>; - #address-cells = <3>; - #size-cells = <2>; - device_type = "pci"; - ranges; }; - pcie@0,1 { + dev@0,1 { reg = <0x50100 0x0 0x0 0x0 0x0>; - #address-cells = <3>; - #size-cells = <2>; - device_type = "pci"; - ranges; }; }; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 190/2651 arm64: dts: qcom: qcs6490-thundercomm-minipc-g1iot: clean up PCI function nodes
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Elder <[email protected]>
[ Upstream commit 55580d234cec123e9b2964cab30fbfad10774b26 ]
The Thundercomm AI Mini PC G1 IoT devicetree source file defines a node representing a TC956x chip which contains a PCIe switch and an embedded endpoint that implements two PCIe functions.
The devicetree nodes erroneously include a "pci" device_type property for the two PCIe functions. That property should only be used for a PCI device "that implements a PCI bus". Remove this property for the two function nodes.
In addition, only PCI bridge nodes should be named "pcie@" (or "pci@"). PCI endpoint nodes are typically named based on the functionality they implement (e.g., "ethernet@"). In this case, the role of these PCI functions is not (yet) specified, and furthermore they will be used with PCI endpoint buses. Rename these to use "dev@", following the convention used in of_pci_make_dev_node() for dynamically-created devicetree nodes.
Finally, these nodes define #address-cells, #size-cells, and ranges properties, which are not normally defined for PCIe endpoints. Remove these properties as well; they can be added back once they are actually needed/used.
--- .../dts/qcom/qcs6490-thundercomm-minipc-g1iot.dts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
arch/arm64/boot/dts/qcom/qcs6490-thundercomm-minipc-g1iot.dts +2 -10
@@ -790,20 +790,12 @@ pcie@3,0 { ranges; bus-range = <0x5 0xff>; - pcie@0,0 { + dev@0,0 { reg = <0x50000 0x0 0x0 0x0 0x0>; - #address-cells = <3>; - #size-cells = <2>; - device_type = "pci"; - ranges; }; - pcie@0,1 { + dev@0,1 { reg = <0x50100 0x0 0x0 0x0 0x0>; - #address-cells = <3>; - #size-cells = <2>; - device_type = "pci"; - ranges; }; }; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 191/2651 arm64: dts: qcom: qcs8550-rb5gen2: clean up PCI function nodes
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Elder <[email protected]>
[ Upstream commit 3f7d46aaf5565471f65b2e21fbb649cedc55e6b8 ]
The Qualcomm RB5gen2 devicetree source file defines a node representing a TC956x chip which contains a PCIe switch and an embedded endpoint that implements two PCIe functions.
The devicetree nodes erroneously include a "pci" device_type property for the two PCIe functions. That property should only be used for a PCI device "that implements a PCI bus". Remove this property for the two function nodes.
In addition, only PCI bridge nodes should be named "pci@" (or "pcie@"). PCI endpoint nodes are typically named based on the functionality they implement (e.g., "ethernet@"). In this case, the role of these PCI functions is not (yet) specified, and furthermore they will be used with PCI endpoint buses. Rename these to use "dev@", following the convention used in of_pci_make_dev_node() for dynamically-created devicetree nodes.
Finally, these nodes define #address-cells, #size-cells, and ranges properties, which are not normally defined for PCIe endpoints. Remove these properties as well; they can be added back once they are actually needed/used.
--- arch/arm64/boot/dts/qcom/qcs8550-rb5gen2.dts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
arch/arm64/boot/dts/qcom/qcs8550-rb5gen2.dts +2 -10
@@ -1126,20 +1126,12 @@ pcie@3,0 { ranges; bus-range = <0x5 0xff>; - pci@0,0 { + dev@0,0 { reg = <0x50000 0x0 0x0 0x0 0x0>; - #address-cells = <3>; - #size-cells = <2>; - device_type = "pci"; - ranges; }; - pci@0,1 { + dev@0,1 { reg = <0x50100 0x0 0x0 0x0 0x0>; - #address-cells = <3>; - #size-cells = <2>; - device_type = "pci"; - ranges; }; }; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 192/2651 leds: max77705: Use fwnode_for_each_child_node_scoped() in max77705_add_led()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manush Prajwal <[email protected]>
[ Upstream commit 4805e5ec50d0b355370e3d1ea906af4fc758accf ]
Rework the subled loop in max77705_add_led() around fwnode_for_each_child_node_scoped() instead of adding a manual fwnode_handle_put(child) before the early return on a max77705_parse_subled() failure, so the reference on the current child fwnode is released automatically on every exit path from the loop. child is never used outside the loop, so the now-unused outer child declaration is dropped along with it.
--- drivers/leds/leds-max77705.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/leds/leds-max77705.c +1 -2
@@ -160,7 +160,6 @@ static int max77705_add_led(struct device *dev, struct regmap *regmap, struct fwstruct max77705_led *led;struct led_classdev *cdev;struct mc_subled *info; -struct fwnode_handle *child;struct led_init_data init_data = {}; led =devm_kzalloc (dev,sizeof (*led),GFP_KERNEL );
@@ -191,7 +190,7 @@ static int max77705_add_led(struct device *dev, struct regmap *regmap, struct fw cdev->brightness_set_blocking = max77705_led_brightness_set_multi; cdev->blink_set = max77705_rgb_blink; -fwnode_for_each_child_node (np, child) { +fwnode_for_each_child_node_scoped (np, child) { ret =max77705_parse_subled (dev, child, &info[i]);if (ret <0 )return ret;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 193/2651 RDMA/hns: Fix missing CQE when UD QP use different SL
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengchang Tang <[email protected]>
[ Upstream commit 3547f46c31993d41748f0f7936f9d4dc5b5d4b12 ]
Due to the hardware contraint, CQEs may be dropped when a UD QP sends with multiple SLs. Pin the SL to the value from the first post_send on the QP to avoid this issue.
--- drivers/infiniband/hw/hns/hns_roce_device.h | 1 + drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-)
drivers/infiniband/hw/hns/hns_roce_device.h +1 -0
@@ -654,6 +654,7 @@ struct hns_roce_qp {u8 priority;spinlock_t flush_lock;struct hns_roce_dip *dip; +bool ud_sl_set; };struct hns_roce_ib_iboe {
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +10 -5
@@ -431,7 +431,8 @@ static int set_ud_opcode(struct hns_roce_v2_ud_send_wqe *ud_sq_wqe,return 0 ; } -static int fill_ud_av (struct hns_roce_v2_ud_send_wqe *ud_sq_wqe, +static int fill_ud_av (struct hns_roce_qp *qp, +struct hns_roce_v2_ud_send_wqe *ud_sq_wqe,struct hns_roce_ah *ah) {struct ib_device *ib_dev = ah->ibah.device;
@@ -441,7 +442,12 @@ static int fill_ud_av(struct hns_roce_v2_ud_send_wqe *ud_sq_wqe,hr_reg_write (ud_sq_wqe,UD_SEND_WQE_HOPLIMIT , ah->av.hop_limit);hr_reg_write (ud_sq_wqe,UD_SEND_WQE_TCLASS , ah->av.tclass);hr_reg_write (ud_sq_wqe,UD_SEND_WQE_FLOW_LABEL , ah->av.flowlabel); -hr_reg_write (ud_sq_wqe,UD_SEND_WQE_SL , ah->av.sl); +if (!qp->ud_sl_set) { + qp->sl = ah->av.sl; + qp->ud_sl_set = true; + } + +hr_reg_write (ud_sq_wqe,UD_SEND_WQE_SL , qp->sl); ud_sq_wqe->sgid_index = ah->av.gid_index;
@@ -491,12 +497,10 @@ static inline int set_ud_wqe(struct hns_roce_qp *qp, qp->qkey : ud_wr(wr)->remote_qkey);hr_reg_write (ud_sq_wqe,UD_SEND_WQE_DQPN ,ud_wr (wr)->remote_qpn); - ret =fill_ud_av (ud_sq_wqe, ah); + ret =fill_ud_av (qp, ud_sq_wqe, ah);if (ret)return ret; - qp->sl =to_hr_ah (ud_wr (wr)->ah)->av.sl; -set_extend_sge (qp, wr->sg_list, &curr_idx, valid_num_sge);/*
@@ -5603,6 +5607,7 @@ static void v2_set_flushed_fields(struct ib_qp *ibqp,hr_reg_write (context,QPC_SQ_PRODUCER_IDX , hr_qp->sq.head);hr_reg_clear (qpc_mask,QPC_SQ_PRODUCER_IDX ); hr_qp->state =IB_QPS_ERR ; + hr_qp->ud_sl_set = false;spin_unlock_irqrestore (&hr_qp->sq.lock, sq_flag);if (ibqp->srq || ibqp->qp_type ==IB_QPT_XRC_INI )/* no RQ */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 194/2651 f2fs: wait for inode record work before clearing ino bitmaps
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wenjie Qi <[email protected]>
[ Upstream commit 56bcda97b38a54b18df380ca928120a05d2a269a ]
APPEND/UPDATE inode state recording was moved to the inode eviction workqueue. These entries were later converted to bitmap values stored in XArrays, but the workqueue drain was left behind in the list cleanup loop where it is now a no-op.
During unmount, inode eviction work can therefore remain queued when f2fs_release_ino_entry() destroys the bitmap XArrays. A delayed worker can repopulate them before the workqueue is finally destroyed, leaking newly allocated XArray nodes when the F2FS superblock is freed.
Wait for APPEND/UPDATE inode record work before destroying each bitmap XArray, restoring the required ordering.
--- fs/f2fs/checkpoint.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
fs/f2fs/checkpoint.c +3 -11
@@ -824,15 +824,6 @@ static void __clear_ino_bitmap(struct f2fs_sb_info *sbi, nid_t ino, int type)spin_unlock (&im->ino_lock); } -static void f2fs_wait_for_inode_record (struct f2fs_sb_info *sbi,int mode) -{ -if (mode !=APPEND_INO && mode !=UPDATE_INO ) -return ; - -/* Let's wait for some pending updates for APPEND_INO and UPDATE_INO. */ -flush_workqueue (sbi->evict_wq); -} -static void __f2fs_add_ino_entry (struct f2fs_sb_info *sbi,nid_t ino,unsigned int devidx,int type) {
@@ -886,8 +877,6 @@ void f2fs_release_ino_entry(struct f2fs_sb_info *sbi, bool all)for (i = all ?ORPHAN_INO :FLUSH_INO ; i <=FLUSH_INO ; i++) {struct inode_management *im = &sbi->im[i]; -f2fs_wait_for_inode_record (sbi, i); -spin_lock (&im->ino_lock);list_for_each_entry_safe (e, tmp, &im->ino_list, list) {list_del (&e->list);
@@ -898,6 +887,9 @@ void f2fs_release_ino_entry(struct f2fs_sb_info *sbi, bool all)spin_unlock (&im->ino_lock); } +/* Wait for pending APPEND/UPDATE inode state updates. */ +flush_workqueue (sbi->evict_wq); +for (i =APPEND_INO ; i <MAX_INO_ENTRY ; i++) {struct inode_management *im = &sbi->im[i];
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 195/2651 clk: Use the generic OF phandle parsing in only one place
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miquel Raynal (Schneider Electric) <[email protected]>
[ Upstream commit 57d728b4ab15a8af890013bb0f302e7733f7c1c6 ]
Ideally, there should be one single entry in the OF world. This way, the DT parsing logic is always identical. At this stage, we call of_parse_phandle_with_args() in:
- of_parse_clkspec()
- of_clk_get_parent_name()
which kinds of defeats the above statement. Furthermore, when this call is done from of_clk_get_parent_name(), we fail to parse the 'clock-ranges' property.
Make sure DT world is entered only once by calling of_parse_clkspec() from of_clk_get_parent_name(). Doing so implies that we do not try the "clock-ranges" path if we already found a "clocks" property.
--- drivers/clk/clk.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/clk/clk.c +3 -2
@@ -5320,6 +5320,8 @@ static int of_parse_clkspec(const struct device_node *np, int index,* has a "clock-ranges" property, then we can try one of its * clocks. */ +if (of_property_present (np,"clocks" )) +break ; np = np->parent;if (np && !of_property_present (np,"clock-ranges" ))break ;
@@ -5464,8 +5466,7 @@ const char *of_clk_get_parent_name(const struct device_node *np, int index)int count;struct clk *clk; - rc =of_parse_phandle_with_args (np,"clocks" ,"#clock-cells" , index, - &clkspec); + rc =of_parse_clkspec (np, index,NULL , &clkspec);if (rc)return NULL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 196/2651 wifi: ath12k: signal regd update completion when reg event is dropped
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baochen Qiang <[email protected]>
[ Upstream commit f2576dc0f894ef33045ba7ed057ec417988bba8a ]
During driver bring-up, ath12k_mac_hw_register() reinitializes ar->regd_update_completed and sends a set current country command to firmware. It then relies on the regulatory event from firmware to signal that completion via ath12k_reg_chan_list_event().
However, when the country being set is identical to the one already applied at boot time, ath12k_reg_validate_reg_info() returns ATH12K_REG_STATUS_DROP through the "Avoid multiple overwrites to default regd" path. In that case ath12k_reg_chan_list_event() jumps to mem_free before assigning pdev_idx, so pdev_idx stays at its initial value of 255, 'ar' remains NULL and complete_all() is never called.
As a result the reinitialized completion is left unsignalled and the next ath12k_regd_update() waits the full timeout, printing:
Timeout while waiting for regulatory update
Fix this by assigning pdev_idx from the event's phy_id right after it is extracted, before validation, so that the drop and fallback paths still reach complete_all(). Change the guard at the end to check the index against ab->num_radios so that an out-of-range phy_id does not lead to an invalid pdevs[] access.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3
--- drivers/net/wireless/ath/ath12k/wmi.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath12k/wmi.c +9 -2
@@ -6992,6 +6992,14 @@ static int ath12k_reg_chan_list_event(struct ath12k_base *ab, struct sk_buff *sk goto mem_free; } +/* +* Set the valid pdev_idx before validating so that, even when the +* event is dropped or falls back, the completion the caller in +* ath12k_mac_hw_register() may be waiting on is still signalled at +* the end and it does not time out. +*/ + pdev_idx = reg_info->phy_id; + ret =ath12k_reg_validate_reg_info (ab, reg_info);if (ret ==ATH12K_REG_STATUS_FALLBACK ) {ath12k_warn (ab,"failed to validate reg info %d\n" , ret);
@@ -7008,7 +7016,6 @@ static int ath12k_reg_chan_list_event(struct ath12k_base *ab, struct sk_buff *sk }/* free old reg_info if it exist */ - pdev_idx = reg_info->phy_id;if (ab->reg_info[pdev_idx]) {ath12k_reg_reset_reg_info (ab->reg_info[pdev_idx]);kfree (ab->reg_info[pdev_idx]);
@@ -7047,7 +7054,7 @@ static int ath12k_reg_chan_list_event(struct ath12k_base *ab, struct sk_buff *sk out:/* In some error cases, even a valid pdev_idx might not be available */ -if (pdev_idx !=255 ) +if (pdev_idx < ab->num_radios) ar = ab->pdevs[pdev_idx].ar;/* During the boot-time update, 'ar' might not be allocated,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 197/2651 wifi: ath11k: disable interrupts during firmware crash recovery
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julius Bairaktaris <[email protected]>
[ Upstream commit f7a74e131d3f0de04335dbe278bfb82bdafcdb3e ]
On IPQ8074 a firmware assert reboots the SoC:
Unable to handle kernel read from unreadable memory at virtual address 0 pc : ath11k_hal_srng_access_begin+0xc/0x60 [ath11k] lr : ath11k_dp_rx_process_mon_status+0x15c/0xd84 [ath11k] Call trace: ath11k_hal_srng_access_begin+0xc/0x60 [ath11k] ath11k_dp_rx_process_mon_rings+0xa0/0x5d4 [ath11k] ath11k_dp_service_srng+0x1f4/0x348 [ath11k] ath11k_ahb_ext_grp_napi_poll+0x34/0xd4 [ath11k_ahb] __napi_poll+0x38/0x188 net_rx_action+0x120/0x2c0
ath11k_core_reconfigure_on_crash() tears the data path down with ath11k_dp_pdev_free(), ath11k_dp_free() and ath11k_hal_srng_clear(), which memsets the ring list. The DP NAPI is still running while that happens, so it services a ring whose address pointer has just been cleared.
That function used to disable the interrupts first, until
commit d455e805de70 ("wifi: ath11k: rearrange IRQ enable/disable in reset path") moved the disable into ath11k_core_reset(). reset_work is only queued from mhi.c and from the debugfs hw-restart handler, so AHB parts never run it on a real firmware crash. Their recovery goes QMI server exit -> restart_work -> ath11k_core_reconfigure_on_crash() -> ath11k_core_qmi_firmware_ready(), and nothing disables the interrupts anywhere along it.
Disable them again on the crash path. The reset path has already done so by the time it gets here, hence the ab->is_reset check.
This is also why the debugfs hw-restart trigger never showed the
problem: it goes through ath11k_core_reset(), the one path that still had the disable.
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.12-01460-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath11k/core.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/net/wireless/ath/ath11k/core.c +10 -0
@@ -2334,6 +2334,16 @@ static int ath11k_core_reconfigure_on_crash(struct ath11k_base *ab)mutex_lock (&ab->core_lock);ath11k_thermal_unregister (ab); + +/* +* ath11k_core_reset() already disabled the interrupts on the reset +* path; only the firmware crash path reaches here with them live. +*/ +if (!ab->is_reset) { +ath11k_hif_irq_disable (ab); +ath11k_hif_ce_irq_disable (ab); + } +ath11k_dp_pdev_free (ab);ath11k_cfr_deinit (ab);ath11k_spectral_deinit (ab);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 198/2651 wifi: ath11k: fix sporadic WLAN initialization failures
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miaoqing Pan <[email protected]>
[ Upstream commit 32ec8488d75d122768b1977501bcb5ec799230c4 ]
On WCN6750 platforms, reboot stress testing occasionally results in WLAN initialization failures after boot. The WPSS firmware reaches the running state successfully, but no WLAN interface is created.
Analysis shows that ath11k_ahb depends on the QRTR SMD transport for QMI communication with WPSS firmware. However, this dependency is not currently expressed in Kconfig, allowing qrtr_smd and ath11k_ahb to load in either order when built as modules.
If ath11k_ahb is loaded before qrtr_smd becomes available, WLAN initialization may not complete successfully.
Make the QRTR and QRTR_SMD dependencies explicit and add a soft dependency to ensure qrtr_smd is loaded before ath11k_ahb.
Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.2.0.c2-00204-QCAMSLSWPLZ-1
--- drivers/net/wireless/ath/ath11k/Kconfig | 3 +++ drivers/net/wireless/ath/ath11k/ahb.c | 1 + 2 files changed, 4 insertions(+)
drivers/net/wireless/ath/ath11k/Kconfig +3 -0
@@ -14,6 +14,9 @@ config ATH11K_AHB tristate "Atheros ath11k AHB support" depends on ATH11K depends on REMOTEPROC + select RPMSG + select QRTR + select QRTR_SMD help This module adds support for AHB bus
drivers/net/wireless/ath/ath11k/ahb.c +1 -0
@@ -1343,5 +1343,6 @@ static struct platform_driver ath11k_ahb_driver = {module_platform_driver (ath11k_ahb_driver); +MODULE_SOFTDEP ("pre: qrtr_smd" );MODULE_DESCRIPTION ("Driver support for Qualcomm Technologies 802.11ax WLAN AHB devices" );MODULE_LICENSE ("Dual BSD/GPL" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 199/2651 wifi: ath11k: fix NULL dereference in ahb remove when QMI init incomplete
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miaoqing Pan <[email protected]>
[ Upstream commit 1a7bcf5324c8e2de6512eca5b028b6b283181d3f ]
On WCN6750, if QMI messages never arrive (for example when qrtr_smd is not ready), WLAN initialization stops before the device is fully registered. In this case ATH11K_FLAG_QMI_FAIL is not set because no QMI event handler is executed.
When the driver is removed, ath11k_ahb_remove() still calls ath11k_core_deinit(), which eventually triggers ath11k_ce_cleanup_pipes() on uninitialized CE pipes and results in a NULL pointer dereference in ath11k_hal_srng_access_begin():
ath11k_hal_srng_access_begin+0x14/0x68 [ath11k] ath11k_ce_cleanup_pipes+0x184/0x190 [ath11k] ath11k_pcic_stop+0x24/0x38 [ath11k] ath11k_core_deinit+0xfc/0x1c0 [ath11k] ath11k_ahb_remove+0x38/0xa0 [ath11k_ahb]
Fix this by invoking ath11k_ahb_remove_prepare() before the state check and skipping ath11k_core_deinit() if ATH11K_FLAG_REGISTERED is not set, core initialization did not complete and CE pipes may remain uninitialized, making ath11k_core_deinit() unsafe.
Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.2.0.c2-00204-QCAMSLSWPLZ-1
--- drivers/net/wireless/ath/ath11k/ahb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath11k/ahb.c +3 -2
@@ -1296,14 +1296,15 @@ static void ath11k_ahb_remove(struct platform_device *pdev) {struct ath11k_base *ab =platform_get_drvdata (pdev); -if (test_bit (ATH11K_FLAG_QMI_FAIL , &ab->dev_flags)) { +ath11k_ahb_remove_prepare (ab); + +if (!test_bit (ATH11K_FLAG_REGISTERED , &ab->dev_flags)) {ath11k_ahb_power_down (ab, false);ath11k_debugfs_soc_destroy (ab);ath11k_qmi_deinit_service (ab); goto qmi_fail; } -ath11k_ahb_remove_prepare (ab);ath11k_core_deinit (ab); qmi_fail:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 200/2651 wifi: ath11k: unregister PM notifier on QMI init failure path
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miaoqing Pan <[email protected]>
[ Upstream commit 1d8e73163ef933624341075f576e2f36ef9133f7 ]
ath11k_core_init() registers a PM notifier before the QMI server becomes available. If the QMI server never arrives, the device remove() path can take the early-exit path introduced for QMI initialization failures, skipping ath11k_core_deinit().
As a result, the PM notifier remains registered after the ath11k base object has been freed. A subsequent suspend or resume event may invoke the stale notifier and trigger a use-after-free.
Fix this by explicitly unregistering the PM notifier in the QMI failure cleanup path before releasing ath11k resources.
Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.2.0.c2-00204-QCAMSLSWPLZ-1
--- drivers/net/wireless/ath/ath11k/ahb.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/ath11k/ahb.c +1 -0
@@ -1302,6 +1302,7 @@ static void ath11k_ahb_remove(struct platform_device *pdev)ath11k_ahb_power_down (ab, false);ath11k_debugfs_soc_destroy (ab);ath11k_qmi_deinit_service (ab); +ath11k_core_pm_notifier_unregister (ab); goto qmi_fail; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 201/2651 PCI/pwrctrl: tc9563: Allow RESX reset assertion to sleep
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abel Vesa <[email protected]>
[ Upstream commit 028f86457e822ab9de5b0d6d23efddc1b8b54ae1 ]
The RESX GPIO may be provided by a sleeping GPIO controller, such as an I2C or SPI I/O expander. Calling gpiod_set_value() for such a GPIO triggers the following warning:
WARNING: ... drivers/gpio/gpiolib.c:4030 at gpiod_set_value()
The TC9563 power-on and power-off callbacks already sleep while enabling or disabling regulators and while waiting for oscillator stabilization. Use gpiod_set_value_cansleep() for RESX so it can be driven without triggering the warning.
--- drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +2 -2
@@ -481,7 +481,7 @@ static int tc9563_pwrctrl_power_off(struct pci_pwrctrl *pwrctrl)struct tc9563_pwrctrl *tc9563 =container_of (pwrctrl, struct tc9563_pwrctrl, pwrctrl); -gpiod_set_value (tc9563->reset_gpio,1 ); +gpiod_set_value_cansleep (tc9563->reset_gpio,1 );regulator_bulk_disable (ARRAY_SIZE (tc9563->supplies), tc9563->supplies);
@@ -501,7 +501,7 @@ static int tc9563_pwrctrl_power_on(struct pci_pwrctrl *pwrctrl)if (ret <0 )return dev_err_probe (dev, ret,"cannot enable regulators\n" ); -gpiod_set_value (tc9563->reset_gpio,0 ); +gpiod_set_value_cansleep (tc9563->reset_gpio,0 );fsleep (TC9563_OSC_STAB_DELAY_US );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 202/2651 arm64: dts: broadcom: bcm2712: adjust display status
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Robinson <[email protected]>
[ Upstream commit 1cda59c6790be4ae93c76bffd81a003b88083ae9 ]
Typically non critical IP in a SoC are disabled by default in the SoC .dtsi and enabled on board specific configs. There are usecases, such as some CM5 carrier boards, where display output may not be desired or connected. So disable them on the SoC .dtsi and enable them on the RPi5 board.
--- .../dts/broadcom/bcm2712-rpi-5-b-base.dtsi | 35 +++++++++++++++++++ arch/arm64/boot/dts/broadcom/bcm2712.dtsi | 11 ++++++ 2 files changed, 46 insertions(+)
arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b-base.dtsi +35 -0
@@ -104,6 +104,18 @@ wl_on_reg: wl-on-reg { }; }; +&ddc0 { + status = "okay"; +}; + +&ddc1 { + status = "okay"; +}; + +&disp_intr { + status = "okay"; +}; + &pinctrl { bt_shutdown_default: bt-shutdown-default-state { function = "gpio";
@@ -230,16 +242,27 @@ bluetooth: bluetooth { &hvs { clocks = <&firmware_clocks 4>, <&firmware_clocks 16>; clock-names = "core", "disp"; + status = "okay"; }; &hdmi0 { clocks = <&firmware_clocks 13>, <&firmware_clocks 14>, <&dvp 0>, <&clk_27MHz>; clock-names = "hdmi", "bvb", "audio", "cec"; + status = "okay"; }; &hdmi1 { clocks = <&firmware_clocks 13>, <&firmware_clocks 14>, <&dvp 1>, <&clk_27MHz>; clock-names = "hdmi", "bvb", "audio", "cec"; + status = "okay"; +}; + +&mop { + status = "okay"; +}; + +&moplet { + status = "okay"; }; &pcie1 {
@@ -250,6 +273,18 @@ &pcie2 { status = "okay"; }; +&pixelvalve0 { + status = "okay"; +}; + +&pixelvalve1 { + status = "okay"; +}; + &v3d { clocks = <&firmware_clocks 5>; }; + +&vc4 { + status = "okay"; +};
arch/arm64/boot/dts/broadcom/bcm2712.dtsi +11 -0
@@ -359,12 +359,14 @@ pixelvalve0: pixelvalve@7c410000 { compatible = "brcm,bcm2712-pixelvalve0"; reg = <0x7c410000 0x100>; interrupts = <GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>; + status = "disabled"; }; pixelvalve1: pixelvalve@7c411000 { compatible = "brcm,bcm2712-pixelvalve1"; reg = <0x7c411000 0x100>; interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>; + status = "disabled"; }; mop: mop@7c500000 {
@@ -372,6 +374,7 @@ mop: mop@7c500000 { reg = <0x7c500000 0x28>; interrupt-parent = <&disp_intr>; interrupts = <1>; + status = "disabled"; }; moplet: moplet@7c501000 {
@@ -379,6 +382,7 @@ moplet: moplet@7c501000 { reg = <0x7c501000 0x20>; interrupt-parent = <&disp_intr>; interrupts = <0>; + status = "disabled"; }; disp_intr: interrupt-controller@7c502000 {
@@ -387,6 +391,7 @@ disp_intr: interrupt-controller@7c502000 { interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>; interrupt-controller; #interrupt-cells = <1>; + status = "disabled"; }; dvp: clock@7c700000 {
@@ -405,6 +410,7 @@ ddc0: i2c@7d508200 { clock-frequency = <97500>; #address-cells = <1>; #size-cells = <0>; + status = "disabled"; }; ddc1: i2c@7d508280 {
@@ -415,6 +421,7 @@ ddc1: i2c@7d508280 { clock-frequency = <97500>; #address-cells = <1>; #size-cells = <0>; + status = "disabled"; }; bsc_irq: interrupt-controller@7d508380 {
@@ -460,6 +467,7 @@ hdmi0: hdmi@7c701400 { interrupt-names = "cec-tx", "cec-rx", "cec-low", "hpd-connected", "hpd-removed"; ddc = <&ddc0>; + status = "disabled"; }; hdmi1: hdmi@7c706400 {
@@ -489,6 +497,7 @@ hdmi1: hdmi@7c706400 { interrupt-names = "cec-tx", "cec-rx", "cec-low", "hpd-connected", "hpd-removed"; ddc = <&ddc1>; + status = "disabled"; }; };
@@ -667,6 +676,7 @@ v3d: gpu@1002000000 { vc4: gpu { compatible = "brcm,bcm2712-vc6"; + status = "disabled"; }; timer {
@@ -701,5 +711,6 @@ hvs: hvs@107c580000 { interrupt-parent = <&disp_intr>; interrupts = <2>, <9>, <16>; interrupt-names = "ch0-eof", "ch1-eof", "ch2-eof"; + status = "disabled"; }; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 203/2651 arm64: dts: broadcom: bcm2712-d-rpi-5-b: add compatible
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gregor Herburger <[email protected]>
[ Upstream commit ef76568f51914937d22e5efd05874bd42f478903 ]
The bcm2712 found on the Raspberry Pi 5 is available in the d Stepping and in a c Stepping. There are two separate dts files. The bcm2712-rpi-5-b.dts for the c Stepping and the bcm2712-d-rpi-5-b.dts for the d Stepping. The d stepping does not set its own compatible/model string but uses "raspberrypi,5-model-b" through its include.
These two steppings are not compatible. Booting with the wrong dtb file causes a crash at boot.
Add a compatibles string "raspberrypi,5-model-b-d0" together with a "bcm2712-d0" string to allow us to distinguish between those two steppings.
--- arch/arm64/boot/dts/broadcom/bcm2712-d-rpi-5-b.dts | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm64/boot/dts/broadcom/bcm2712-d-rpi-5-b.dts +5 -0
@@ -3,6 +3,11 @@ #include "bcm2712-rpi-5-b.dts" +/ { + compatible = "raspberrypi,5-model-b-d0", "brcm,bcm2712-d0"; + model = "Raspberry Pi 5 d0 Stepping"; +}; + &gio_aon { brcm,gpio-bank-widths = <15 6>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 204/2651 regulator: pf1550: fix division by zero in the ramp rate selection
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Donggeun Yoo <[email protected]>
[ Upstream commit f0c54cc56a9a21047b1afa209baea8ea931f2e92 ]
set_machine_constraints() calls the set_ramp_delay() op when either constraints->ramp_delay or constraints->ramp_disable is set. The regulator binding documents regulator-ramp-delay = <0> as the way to disable ramp control, and of_get_regulation_constraints() turns that into ramp_disable = true while leaving ramp_delay at 0, so the op is called with a ramp_delay of 0. The range check rejects negative values and values above 6250 but not zero, and the value is then used as a divisor.
The mapping is also wrong for the values that do pass the check. The hardware offers two rates, 6250 uV/us and 3125 uV/us, selected by SWx_DVSSPEED in SWx_CTRL1. Dividing 6250 by the requested rate and taking bit 1 of the quotient does not map monotonically onto them: a request for 1500 uV/us selects 6250 uV/us, while a request for the faster 2000 uV/us selects 3125 uV/us.
Replace the division with a direct mapping onto the two supported rates. Requests at or below 3125 uV/us get the slower rate and anything above it gets the faster one. A ramp_delay of 0 asks for ramp control to be disabled, which this hardware cannot do, so it gets the fastest rate; pfuze100 handles the disabled case the same way.
--- drivers/regulator/pf1550-regulator.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
drivers/regulator/pf1550-regulator.c +14 -5
@@ -49,17 +49,26 @@ static const int pf1550_ldo13_volts[] = {static int pf1550_set_ramp_delay (struct regulator_dev *rdev,int ramp_delay) {int id =rdev_get_id (rdev); -unsigned int ramp_bits =0 ; +unsigned int ramp_bits;int ret;if (id >PF1550_VREFDDR )return -EACCES ; -if (ramp_delay <0 || ramp_delay >6250 ) +switch (ramp_delay) { +case 0 : +/* Ramp control is disabled, so use the fastest rate. */ + ramp_bits =0 ; +break ; + case 1 ... 3125: + ramp_bits =1 ; +break ; + case 3126 ... 6250: + ramp_bits =0 ; +break ; +default :return -EINVAL ; - - ramp_delay =6250 / ramp_delay; - ramp_bits = ramp_delay >>1 ; + } ret =regmap_update_bits (rdev->regmap, rdev->desc->vsel_reg +4 ,0x10 , ramp_bits <<4 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 205/2651 selftests/clone3: tighten CLONE_CLEAR_SIGHAND conflict test
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Dolan <[email protected]>
[ Upstream commit aeebb4884f0e8feb9929f013067488b7f2081f33 ]
The CLONE_CLEAR_SIGHAND test intends to verify that CLONE_CLEAR_SIGHAND and CLONE_SIGHAND are mutually exclusive. However, CLONE_SIGHAND without CLONE_VM is independently invalid, so the test input has another reason to fail with EINVAL.
Add CLONE_VM so that CLONE_SIGHAND is otherwise valid, and require clone3() to fail with EINVAL. This ensures the test exercises the intended flag conflict and does not accept an unrelated failure.
--- tools/testing/selftests/clone3/clone3_clear_sighand.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/testing/selftests/clone3/clone3_clear_sighand.c +3 -3
@@ -50,12 +50,12 @@ static void test_clone3_clear_sighand(void)* Check that CLONE_CLEAR_SIGHAND and CLONE_SIGHAND are mutually * exclusive. */ - args.flags |=CLONE_CLEAR_SIGHAND |CLONE_SIGHAND ; + args.flags |=CLONE_VM |CLONE_CLEAR_SIGHAND |CLONE_SIGHAND ; args.exit_signal =SIGCHLD ; pid =sys_clone3 (&args,sizeof (args)); -if (pid >0 ) +if (pid !=-1 || errno !=EINVAL )ksft_exit_fail_msg ( -"clone3(CLONE_CLEAR_SIGHAND | CLONE_SIGHAND) succeeded\n" ); +"clone3(CLONE_CLEAR_SIGHAND | CLONE_SIGHAND) did not fail with EINVAL\n" ); act.sa_handler = nop_handler; ret =sigemptyset (&act.sa_mask);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 206/2651 selftests/pidfd: fix PPID values in error message
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Dolan <[email protected]>
[ Upstream commit b4ad6eb49532a43ad06c4d59ec5d8c80a012eb3f ]
The PIDFD_GET_INFO PPID check compares info.ppid against getppid(), but its failure message prints pid and info.pid from the preceding PID check.
Print the PPID values being compared so that a failure reports the correct information.
--- tools/testing/selftests/pidfd/pidfd_open_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/pidfd/pidfd_open_test.c +1 -1
@@ -168,7 +168,7 @@ int main(int argc, char **argv) }if (info.ppid !=getppid ()) {ksft_print_msg ("ppid %d does not match ppid from ioctl %d\n" , - pid, info.pid); +getppid (), info.ppid); goto on_error; }if (info.ruid !=getuid ()) {
Signature · 1 line
2.53.0