6.1.103-rc1 review
Subsystems (3)
Greg Kroah-Hartman
maintainerPATCH 136/440 media: pci: ivtv: Add check for DMA map result
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikhail Kobuk <[email protected]>
[ Upstream commit 629913d6d79508b166c66e07e4857e20233d85a9 ]
In case DMA fails, 'dma->SG_length' is 0. This value is later used to access 'dma->SGarray[dma->SG_length - 1]', which will cause out of bounds access.
Add check to return early on invalid value. Adjust warnings accordingly.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/media/pci/ivtv/ivtv-udma.c | 8 ++++++++ drivers/media/pci/ivtv/ivtv-yuv.c | 6 ++++++ drivers/media/pci/ivtv/ivtvfb.c | 6 +++--- 3 files changed, 17 insertions(+), 3 deletions(-)
drivers/media/pci/ivtv/ivtv-udma.c +8 -0
@@ -131,6 +131,8 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr,/* Fill SG List with new values */ if (ivtv_udma_fill_sg_list (dma, &user_dma,0 ) <0 ) { +IVTV_DEBUG_WARN ("%s: could not allocate bounce buffers for highmem userspace buffers\n" , + __func__);unpin_user_pages (dma->map, dma->page_count); dma->page_count =0 ;return -ENOMEM ;
@@ -139,6 +141,12 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr,/* Map SG List */ dma->SG_length =dma_map_sg (&itv->pdev->dev, dma->SGlist, dma->page_count,DMA_TO_DEVICE ); +if (!dma->SG_length) { +IVTV_DEBUG_WARN ("%s: DMA map error, SG_length is 0\n" , __func__); +unpin_user_pages (dma->map, dma->page_count); + dma->page_count =0 ; +return -EINVAL ; + }/* Fill SG Array with new values */ ivtv_udma_fill_sg_array (dma, ivtv_dest_addr,0 ,-1 );
drivers/media/pci/ivtv/ivtv-yuv.c +6 -0
@@ -115,6 +115,12 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma, } dma->SG_length =dma_map_sg (&itv->pdev->dev, dma->SGlist, dma->page_count,DMA_TO_DEVICE ); +if (!dma->SG_length) { +IVTV_DEBUG_WARN ("%s: DMA map error, SG_length is 0\n" , __func__); +unpin_user_pages (dma->map, dma->page_count); + dma->page_count =0 ; +return -EINVAL ; + }/* Fill SG Array with new values */ ivtv_udma_fill_sg_array (dma, y_buffer_offset, uv_buffer_offset, y_size);
drivers/media/pci/ivtv/ivtvfb.c +3 -3
@@ -281,10 +281,10 @@ static int ivtvfb_prep_dec_dma_to_device(struct ivtv *itv,/* Map User DMA */ if (ivtv_udma_setup (itv, ivtv_dest_addr, userbuf, size_in_bytes) <=0 ) {mutex_unlock (&itv->udma.lock); -IVTVFB_WARN ("ivtvfb_prep_dec_dma_to_device, Error with pin_user_pages: %d bytes, %d pages returned\n" , - size_in_bytes, itv->udma.page_count); +IVTVFB_WARN ("%s, Error in ivtv_udma_setup: %d bytes, %d pages returned\n" , + __func__, size_in_bytes, itv->udma.page_count); -/* pin_user_pages must have failed completely */ +/* pin_user_pages or DMA must have failed completely */ return -EIO ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 137/440 media: dvb-usb: Fix unexpected infinite loop in dvb_usb_read_remote_control()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zheng Yejian <[email protected]>
[ Upstream commit 2052138b7da52ad5ccaf74f736d00f39a1c9198c ]
Infinite log printing occurs during fuzz test:
rc rc1: DViCO FusionHDTV DVB-T USB (LGZ201) as ...
...
dvb-usb: schedule remote query interval to 100 msecs.
dvb-usb: DViCO FusionHDTV DVB-T USB (LGZ201) successfully initialized ...
dvb-usb: bulk message failed: -22 (1/0)
dvb-usb: bulk message failed: -22 (1/0)
dvb-usb: bulk message failed: -22 (1/0)
...
dvb-usb: bulk message failed: -22 (1/0)
Looking into the codes, there is a loop in dvb_usb_read_remote_control(), that is in rc_core_dvb_usb_remote_init() create a work that will call dvb_usb_read_remote_control(), and this work will reschedule itself at 'rc_interval' intervals to recursively call dvb_usb_read_remote_control(), see following code snippet:
rc_core_dvb_usb_remote_init() {
...
INIT_DELAYED_WORK(&d->rc_query_work, dvb_usb_read_remote_control);
schedule_delayed_work(&d->rc_query_work,
msecs_to_jiffies(rc_interval));
...
}
dvb_usb_read_remote_control() {
...
err = d->props.rc.core.rc_query(d);
if (err)
err(...) // Did not return even if query failed
schedule_delayed_work(&d->rc_query_work,
msecs_to_jiffies(rc_interval));
}When the infinite log printing occurs, the query callback 'd->props.rc.core.rc_query' is cxusb_rc_query(). And the log is due to the failure of finding a valid 'generic_bulk_ctrl_endpoint' in usb_bulk_msg(), see following code snippet:
cxusb_rc_query() {
cxusb_ctrl_msg() {
dvb_usb_generic_rw() {
ret = usb_bulk_msg(d->udev, usb_sndbulkpipe(d->udev,
d->props.generic_bulk_ctrl_endpoint),...);
if (ret)
err("bulk message failed: %d (%d/%d)",ret,wlen,actlen);
...
}
...
}By analyzing the corresponding USB descriptor, it shows that the bNumEndpoints is 0 in its interface descriptor, but
the 'generic_bulk_ctrl_endpoint' is 1, that means user don't configure a valid endpoint for 'generic_bulk_ctrl_endpoint', therefore this 'invalid' USB device should be rejected before it calls into dvb_usb_read_remote_control().
To fix it, we need to add endpoint check for 'generic_bulk_ctrl_endpoint'. And as Sean suggested, the same check and clear halts should be done for 'generic_bulk_ctrl_endpoint_response'. So introduce dvb_usb_check_bulk_endpoint() to do it for both of them.
--- drivers/media/usb/dvb-usb/dvb-usb-init.c | 35 +++++++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-)
drivers/media/usb/dvb-usb/dvb-usb-init.c +31 -4
@@ -23,11 +23,40 @@ static int dvb_usb_force_pid_filter_usage;module_param_named (force_pid_filter_usage, dvb_usb_force_pid_filter_usage, int,0444 );MODULE_PARM_DESC (force_pid_filter_usage,"force all dvb-usb-devices to use a PID filter, if any (default: 0)." ); +static int dvb_usb_check_bulk_endpoint (struct dvb_usb_device *d,u8 endpoint) +{ +if (endpoint) { +int ret; + + ret =usb_pipe_type_check (d->udev,usb_sndbulkpipe (d->udev, endpoint)); +if (ret) +return ret; + ret =usb_pipe_type_check (d->udev,usb_rcvbulkpipe (d->udev, endpoint)); +if (ret) +return ret; + } +return 0 ; +} + +static void dvb_usb_clear_halt (struct dvb_usb_device *d,u8 endpoint) +{ +if (endpoint) { +usb_clear_halt (d->udev,usb_sndbulkpipe (d->udev, endpoint)); +usb_clear_halt (d->udev,usb_rcvbulkpipe (d->udev, endpoint)); + } +} +static int dvb_usb_adapter_init (struct dvb_usb_device *d,short *adapter_nrs) {struct dvb_usb_adapter *adap;int ret, n, o; + ret =dvb_usb_check_bulk_endpoint (d, d->props.generic_bulk_ctrl_endpoint); +if (ret) +return ret; + ret =dvb_usb_check_bulk_endpoint (d, d->props.generic_bulk_ctrl_endpoint_response); +if (ret) +return ret;for (n =0 ; n < d->props.num_adapters; n++) { adap = &d->adapter[n]; adap->dev = d;
@@ -103,10 +132,8 @@ static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs)* when reloading the driver w/o replugging the device * sometimes a timeout occurs, this helps */ -if (d->props.generic_bulk_ctrl_endpoint !=0 ) { -usb_clear_halt (d->udev,usb_sndbulkpipe (d->udev, d->props.generic_bulk_ctrl_endpoint)); -usb_clear_halt (d->udev,usb_rcvbulkpipe (d->udev, d->props.generic_bulk_ctrl_endpoint)); - } +dvb_usb_clear_halt (d, d->props.generic_bulk_ctrl_endpoint); +dvb_usb_clear_halt (d, d->props.generic_bulk_ctrl_endpoint_response);return 0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 138/440 media: imon: Fix race getting ictx->lock
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
[ Upstream commit 24147897507cd3a7d63745d1518a638bf4132238 ]
Lets fix a race between mutex_is_lock() and mutex_lock().
<-mutex is not locked
if (!mutex_is_locked(&ictx->lock)) {
unlock = true; <- mutex is locked externaly
mutex_lock(&ictx->lock);
}Let's use mutex_trylock() that does mutex_is_lock() and mutex_lock() atomically.
Fix the following cocci warning:
drivers/media/rc/imon.c:1167:1-7: preceding lock on line 1153
--- drivers/media/rc/imon.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/media/rc/imon.c +1 -4
@@ -1148,10 +1148,7 @@ static int imon_ir_change_protocol(struct rc_dev *rc, u64 *rc_proto)memcpy (ictx->usb_tx_buf, &ir_proto_packet,sizeof (ir_proto_packet)); -if (!mutex_is_locked (&ictx->lock)) { - unlock = true; -mutex_lock (&ictx->lock); - } + unlock =mutex_trylock (&ictx->lock); retval =send_packet (ictx);if (retval)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 139/440 media: i2c: Fix imx412 exposure control
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bryan O'Donoghue <[email protected]>
[ Upstream commit a1956bf53a2774014ee1768b484af2c38c633a25 ]
Currently we have the following algorithm to calculate what value should be written to the exposure control of imx412.
lpfr = imx412->vblank + imx412->cur_mode->height;
shutter = lpfr - exposure;
The 'shutter' value is given to IMX412_REG_EXPOSURE_CIT however, the above algorithm will result in the value given to IMX412_REG_EXPOSURE_CIT decreasing as the requested exposure value from user-space goes up.
e.g.
[ 2255.713989] imx412 20-001a: Received exp 1608, analog gain 0 [ 2255.714002] imx412 20-001a: Set exp 1608, analog gain 0, shutter 1938, lpfr 3546 [ 2256.302770] imx412 20-001a: Received exp 2586, analog gain 100 [ 2256.302800] imx412 20-001a: Set exp 2586, analog gain 100, shutter 960, lpfr 3546 [ 2256.753755] imx412 20-001a: Received exp 3524, analog gain 110 [ 2256.753772] imx412 20-001a: Set exp 3524, analog gain 110, shutter 22, lpfr 3546
This behaviour results in the image having less exposure as the requested exposure value from user-space increases.
Other sensor drivers such as ov5675, imx218, hid556 and others take the requested exposure value and use the value directly.
Take the example of the above cited sensor drivers and directly apply the requested exposure value from user-space. The 'lpfr' variable still functions as before but the 'shutter' variable can be dispensed with as a result.
Once done a similar run of the test application requesting higher exposure looks like this, with 'exp' written directly to the sensor.
[ 133.207884] imx412 20-001a: Received exp 1608, analog gain 0 [ 133.207899] imx412 20-001a: Set exp 1608, analog gain 0, lpfr 3546 [ 133.905309] imx412 20-001a: Received exp 2844, analog gain 100 [ 133.905344] imx412 20-001a: Set exp 2844, analog gain 100, lpfr 3546 [ 134.241705] imx412 20-001a: Received exp 3524, analog gain 110 [ 134.241775] imx412 20-001a: Set exp 3524, analog gain 110, lpfr 3546
The result is then setting the sensor exposure to lower values results in darker, less exposure images and vice versa with higher exposure values.
--- drivers/media/i2c/imx412.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/media/i2c/imx412.c +4 -5
@@ -544,14 +544,13 @@ static int imx412_update_controls(struct imx412 *imx412,*/ static int imx412_update_exp_gain (struct imx412 *imx412,u32 exposure,u32 gain) { -u32 lpfr, shutter; +u32 lpfr;int ret; lpfr = imx412->vblank + imx412->cur_mode->height; - shutter = lpfr - exposure; -dev_dbg (imx412->dev,"Set exp %u, analog gain %u, shutter %u, lpfr %u" , - exposure, gain, shutter, lpfr); +dev_dbg (imx412->dev,"Set exp %u, analog gain %u, lpfr %u" , + exposure, gain, lpfr); ret =imx412_write_reg (imx412,IMX412_REG_HOLD ,1 ,1 );if (ret)
@@ -561,7 +560,7 @@ static int imx412_update_exp_gain(struct imx412 *imx412, u32 exposure, u32 gain)if (ret) goto error_release_group_hold; - ret =imx412_write_reg (imx412,IMX412_REG_EXPOSURE_CIT ,2 , shutter); + ret =imx412_write_reg (imx412,IMX412_REG_EXPOSURE_CIT ,2 , exposure);if (ret) goto error_release_group_hold;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 140/440 media: v4l: async: Fix NULL pointer dereference in adding ancillary links
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: ChiYuan Huang <[email protected]>
[ Upstream commit 9b4667ea67854f0b116fe22ad11ef5628c5b5b5f ]
In v4l2_async_create_ancillary_links(), ancillary links are created for lens and flash sub-devices. These are sub-device to sub-device links and if the async notifier is related to a V4L2 device, the source sub-device of the ancillary link is NULL, leading to a NULL pointer dereference. Check the notifier's sd field is non-NULL in v4l2_async_create_ancillary_links().
--- drivers/media/v4l2-core/v4l2-async.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/v4l2-core/v4l2-async.c +3 -0
@@ -302,6 +302,9 @@ static int v4l2_async_create_ancillary_links(struct v4l2_async_notifier *n, sd->entity.function != MEDIA_ENT_F_FLASH)return 0 ; +if (!n->sd) +return 0 ; + link =media_create_ancillary_link (&n->sd->entity, &sd->entity);#endif
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 141/440 s390/mm: Convert make_page_secure to use a folio
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Wilcox (Oracle) <[email protected]>
[ Upstream commit 259e660d91d0e7261ae0ee37bb37266d6006a546 ]
These page APIs are deprecated, so convert the incoming page to a folio and use the folio APIs instead. The ultravisor API cannot handle large folios, so return -EINVAL if one has slipped through.
Stable-dep-of: 3f29f6537f54 ("s390/uv: Don't call folio_wait_writeback() without a folio reference")
--- arch/s390/kernel/uv.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-)
arch/s390/kernel/uv.c +16 -13
@@ -172,21 +172,21 @@ int uv_convert_owned_from_secure(unsigned long paddr) }/* -* Calculate the expected ref_count for a page that would otherwise have no +* Calculate the expected ref_count for a folio that would otherwise have no * further pins. This was cribbed from similar functions in other places in * the kernel, but with some slight modifications. We know that a secure -* page can not be a huge page for example. +* folio can not be a large folio, for example. */ -static int expected_page_refs (struct page *page) +static int expected_folio_refs (struct folio *folio) {int res; - res =page_mapcount (page); -if (PageSwapCache (page)) { + res =folio_mapcount (folio); +if (folio_test_swapcache (folio)) { res++; - }else if (page_mapping (page)) { + }else if (folio_mapping (folio)) { res++; -if (page_has_private (page)) +if (folio->private) res++; }return res;
@@ -194,14 +194,17 @@ static int expected_page_refs(struct page *page)static int make_page_secure (struct page *page,struct uv_cb_header *uvcb) { +struct folio *folio =page_folio (page);int expected, cc =0 ; -if (PageWriteback (page)) +if (folio_test_large (folio)) +return -EINVAL ; +if (folio_test_writeback (folio))return -EAGAIN ; - expected =expected_page_refs (page); -if (!page_ref_freeze (page, expected)) + expected =expected_folio_refs (folio); +if (!folio_ref_freeze (folio, expected))return -EBUSY ; -set_bit (PG_arch_1, &page->flags); +set_bit (PG_arch_1, &folio->flags);/* * If the UVC does not succeed or fail immediately, we don't want to * loop for long, or we might get stall notifications.
@@ -211,9 +214,9 @@ static int make_page_secure(struct page *page, struct uv_cb_header *uvcb)* -EAGAIN and we let the callers deal with it. */ cc =__uv_call (0 , (u64 )uvcb); -page_ref_unfreeze (page, expected); +folio_ref_unfreeze (folio, expected);/* -* Return -ENXIO if the page was not mapped, -EINVAL for other errors. +* Return -ENXIO if the folio was not mapped, -EINVAL for other errors. * If busy or partially completed, return -EAGAIN. */ if (cc ==UVC_CC_OK )
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 142/440 s390/mm: Convert gmap_make_secure to use a folio
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Wilcox (Oracle) <[email protected]>
[ Upstream commit d35c34bb32f2cc4ec0b52e91ad7a8fcab55d7856 ]
Remove uses of deprecated page APIs, and move the check for large folios to here to avoid taking the folio lock if the folio is too large. We could do better here by attempting to split the large folio, but I'll leave that improvement for someone who can test it.
Stable-dep-of: 3f29f6537f54 ("s390/uv: Don't call folio_wait_writeback() without a folio reference")
--- arch/s390/kernel/uv.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-)
arch/s390/kernel/uv.c +14 -13
@@ -192,13 +192,10 @@ static int expected_folio_refs(struct folio *folio)return res; } -static int make_page_secure (struct page *page,struct uv_cb_header *uvcb) +static int make_folio_secure (struct folio *folio,struct uv_cb_header *uvcb) { -struct folio *folio =page_folio (page);int expected, cc =0 ; -if (folio_test_large (folio)) -return -EINVAL ;if (folio_test_writeback (folio))return -EAGAIN ; expected =expected_folio_refs (folio);
@@ -264,7 +261,7 @@ int gmap_make_secure(struct gmap *gmap, unsigned long gaddr, void *uvcb)bool local_drain = false;spinlock_t *ptelock;unsigned long uaddr; -struct page *page; +struct folio *folio;pte_t *ptep;int rc;
@@ -291,15 +288,19 @@ int gmap_make_secure(struct gmap *gmap, unsigned long gaddr, void *uvcb) rc = -ENXIO ; ptep =get_locked_pte (gmap->mm, uaddr, &ptelock);if (pte_present (*ptep) && !(pte_val (*ptep) & _PAGE_INVALID) &&pte_write (*ptep)) { - page =pte_page (*ptep); + folio =page_folio (pte_page (*ptep)); + rc = -EINVAL ; +if (folio_test_large (folio)) + goto unlock; rc = -EAGAIN ; -if (trylock_page (page)) { +if (folio_trylock (folio)) {if (should_export_before_import (uvcb, gmap->mm)) -uv_convert_from_secure (page_to_phys (page)); - rc =make_page_secure (page, uvcb); -unlock_page (page); +uv_convert_from_secure (PFN_PHYS (folio_pfn (folio))); + rc =make_folio_secure (folio, uvcb); +folio_unlock (folio); } } +unlock:pte_unmap_unlock (ptep, ptelock); out:mmap_read_unlock (gmap->mm);
@@ -309,10 +310,10 @@ int gmap_make_secure(struct gmap *gmap, unsigned long gaddr, void *uvcb)* If we are here because the UVC returned busy or partial * completion, this is just a useless check, but it is safe. */ -wait_on_page_writeback (page); +folio_wait_writeback (folio); }else if (rc == -EBUSY ) {/* -* If we have tried a local drain and the page refcount +* If we have tried a local drain and the folio refcount * still does not match our expected safe value, try with a * system wide drain. This is needed if the pagevecs holding * the page are on a different CPU.
@@ -323,7 +324,7 @@ int gmap_make_secure(struct gmap *gmap, unsigned long gaddr, void *uvcb)return -EAGAIN ; }/* -* We are here if the page refcount does not match the +* We are here if the folio refcount does not match the * expected safe value. The main culprits are usually * pagevecs. With lru_add_drain() we drain the pagevecs * on the local CPU so that hopefully the refcount will
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 143/440 s390/uv: Dont call folio_wait_writeback() without a folio reference
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <[email protected]>
[ Upstream commit 3f29f6537f54d74e64bac0a390fb2e26da25800d ]
folio_wait_writeback() requires that no spinlocks are held and that a folio reference is held, as documented. After we dropped the PTL, the folio could get freed concurrently. So grab a temporary reference.
--- arch/s390/kernel/uv.c | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/s390/kernel/uv.c +8 -0
@@ -299,6 +299,13 @@ int gmap_make_secure(struct gmap *gmap, unsigned long gaddr, void *uvcb) rc =make_folio_secure (folio, uvcb);folio_unlock (folio); } + +/* +* Once we drop the PTL, the folio may get unmapped and +* freed immediately. We need a temporary reference. +*/ +if (rc == -EAGAIN ) +folio_get (folio); } unlock:pte_unmap_unlock (ptep, ptelock);
@@ -311,6 +318,7 @@ int gmap_make_secure(struct gmap *gmap, unsigned long gaddr, void *uvcb)* completion, this is just a useless check, but it is safe. */ folio_wait_writeback (folio); +folio_put (folio); }else if (rc == -EBUSY ) {/* * If we have tried a local drain and the folio refcount
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 144/440 saa7134: Unchecked i2c_transfer function result fixed
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Burakov <[email protected]>
[ Upstream commit 9d8683b3fd93f0e378f24dc3d9604e5d7d3e0a17 ]
Return value of function 'i2c_transfer' is not checked that may cause undefined behaviour.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/media/pci/saa7134/saa7134-dvb.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/media/pci/saa7134/saa7134-dvb.c +6 -2
@@ -466,7 +466,9 @@ static int philips_europa_tuner_sleep(struct dvb_frontend *fe)/* switch the board to analog mode */ if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl (fe,1 ); -i2c_transfer (&dev->i2c_adap, &analog_msg,1 ); +if (i2c_transfer (&dev->i2c_adap, &analog_msg,1 ) !=1 ) +return -EIO ; +return 0 ; }
@@ -1018,7 +1020,9 @@ static int md8800_set_voltage2(struct dvb_frontend *fe,else wbuf[1 ] = rbuf &0xef ; msg[0 ].len =2 ; -i2c_transfer (&dev->i2c_adap, msg,1 ); +if (i2c_transfer (&dev->i2c_adap, msg,1 ) !=1 ) +return -EIO ; +return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 145/440 media: uvcvideo: Override default flags
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Schaefer <[email protected]>
[ Upstream commit 86419686e66da5b90a07fb8a40ab138fe97189b5 ]
When the UVC device has a control that is readonly it doesn't set the SET_CUR flag. For example the privacy control has SET_CUR flag set in the defaults in the uvc_ctrls variable. Even if the device does not have it set, it's not cleared by uvc_ctrl_get_flags().
Originally written with assignment in commit 859086ae3636 ("media:
uvcvideo: Apply flags from device to actual properties"). But changed to |= in commit 0dc68cabdb62 ("media: uvcvideo: Prevent setting unavailable flags"). It would not clear the default flags.
With this patch applied the correct flags are reported to user space. Tested with:
``` > v4l2-ctl --list-ctrls | grep privacy privacy 0x009a0910 (bool) : default=0 value=0 flags=read-only ```
--- drivers/media/usb/uvc/uvc_ctrl.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/media/usb/uvc/uvc_ctrl.c +8 -1
@@ -1959,7 +1959,13 @@ static int uvc_ctrl_get_flags(struct uvc_device *dev,else ret =uvc_query_ctrl (dev,UVC_GET_INFO , ctrl->entity->id, dev->intfnum, info->selector, data,1 ); -if (!ret) + +if (!ret) { + info->flags &= ~(UVC_CTRL_FLAG_GET_CUR | +UVC_CTRL_FLAG_SET_CUR | +UVC_CTRL_FLAG_AUTO_UPDATE | +UVC_CTRL_FLAG_ASYNCHRONOUS ); + info->flags |= (data[0 ] &UVC_CONTROL_CAP_GET ?UVC_CTRL_FLAG_GET_CUR :0 ) | (data[0] & UVC_CONTROL_CAP_SET ?
@@ -1968,6 +1974,7 @@ static int uvc_ctrl_get_flags(struct uvc_device *dev, UVC_CTRL_FLAG_AUTO_UPDATE : 0) | (data[0 ] &UVC_CONTROL_CAP_ASYNCHRONOUS ?UVC_CTRL_FLAG_ASYNCHRONOUS :0 ); + }kfree (data);return ret;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 146/440 media: rcar-vin: Fix YUYV8_1X16 handling for CSI-2
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacopo Mondi <[email protected]>
[ Upstream commit 9caf253e8ad6f4c66f5591bac900f9f68b6b6620 ]
The YUYV8_1X16 and UYVY8_1X16 formats are treated as 'ITU-R BT.601/BT.1358 16-bit YCbCr-422 input' (YUV16 - 0x5) in the R-Car VIN driver and are thus disallowed when capturing frames from the R-Car CSI-2 interface according to the hardware manual.
As the 1X16 format variants are meant to be used with serial busses they have to be treated as 'YCbCr-422 8-bit data input' (0x1) when capturing from CSI-2, which is a valid setting for CSI-2.
Commit 78b3f9d75a62 ("media: rcar-vin: Add check that input interface and format are valid") disallowed capturing YUV16 when using the CSI-2 interface. Fix this by using YUV8_BT601 for YCbCr422 when CSI-2 is in use.
--- .../media/platform/renesas/rcar-vin/rcar-dma.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/media/platform/renesas/rcar-vin/rcar-dma.c +13 -3
@@ -665,12 +665,22 @@ static int rvin_setup(struct rvin_dev *vin)*/ switch (vin->mbus_code) {case MEDIA_BUS_FMT_YUYV8_1X16 : -/* BT.601/BT.1358 16bit YCbCr422 */ - vnmc |=VNMC_INF_YUV16 ; +if (vin->is_csi) +/* YCbCr422 8-bit */ + vnmc |=VNMC_INF_YUV8_BT601 ; +else +/* BT.601/BT.1358 16bit YCbCr422 */ + vnmc |=VNMC_INF_YUV16 ; input_is_yuv = true;break ;case MEDIA_BUS_FMT_UYVY8_1X16 : - vnmc |=VNMC_INF_YUV16 |VNMC_YCAL ; +if (vin->is_csi) +/* YCbCr422 8-bit */ + vnmc |=VNMC_INF_YUV8_BT601 ; +else +/* BT.601/BT.1358 16bit YCbCr422 */ + vnmc |=VNMC_INF_YUV16 ; + vnmc |=VNMC_YCAL ; input_is_yuv = true;break ;case MEDIA_BUS_FMT_UYVY8_2X8 :
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 147/440 media: rcar-csi2: Disable runtime_pm in probe error
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacopo Mondi <[email protected]>
[ Upstream commit e306183628f7c2e95f9bf853d8fcb86288f606de ]
Disable pm_runtime in the probe() function error path.
--- drivers/media/platform/renesas/rcar-vin/rcar-csi2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/platform/renesas/rcar-vin/rcar-csi2.c +3 -1
@@ -1559,12 +1559,14 @@ static int rcsi2_probe(struct platform_device *pdev) ret =v4l2_async_register_subdev (&priv->subdev);if (ret <0 ) - goto error_async; + goto error_pm_runtime;dev_info (priv->dev,"%d lanes found\n" , priv->lanes);return 0 ; +error_pm_runtime: +pm_runtime_disable (&pdev->dev); error_async:v4l2_async_nf_unregister (&priv->notifier);v4l2_async_nf_cleanup (&priv->notifier);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 148/440 media: rcar-csi2: Cleanup subdevice in remove()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacopo Mondi <[email protected]>
[ Upstream commit f6d64d0d2897ed4e85ac00afe43e45c8b8fc0c44 ]
Cleanup the V4L2 subdevice in the driver's remove function to ensure its async connection are freed, and guarantee in future that the subdev active state is cleaned up.
--- drivers/media/platform/renesas/rcar-vin/rcar-csi2.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/platform/renesas/rcar-vin/rcar-csi2.c +1 -0
@@ -1583,6 +1583,7 @@ static int rcsi2_remove(struct platform_device *pdev)v4l2_async_nf_unregister (&priv->notifier);v4l2_async_nf_cleanup (&priv->notifier);v4l2_async_unregister_subdev (&priv->subdev); +v4l2_subdev_cleanup (&priv->subdev);pm_runtime_disable (&pdev->dev);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 149/440 media: renesas: vsp1: Fix _irqsave and _irq mix
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laurent Pinchart <[email protected]>
[ Upstream commit 57edbbcf5258c378a9b9d0c80d33b03a010b22c8 ]
The histogram support mixes _irqsave and _irq, causing the following smatch warning:
drivers/media/platform/renesas/vsp1/vsp1_histo.c:153 histo_stop_streaming()
warn: mixing irqsave and irq
The histo_stop_streaming() calls spin_lock_irqsave() followed by wait_event_lock_irq(). The former hints that interrupts may be disabled by the caller, while the latter reenables interrupts unconditionally. This doesn't cause any real bug, as the function is always called with interrupts enabled, but the pattern is still incorrect.
Fix the problem by using spin_lock_irq() instead of spin_lock_irqsave() in histo_stop_streaming(). While at it, switch to spin_lock_irq() and spin_lock() as appropriate elsewhere.
--- .../media/platform/renesas/vsp1/vsp1_histo.c | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-)
drivers/media/platform/renesas/vsp1/vsp1_histo.c +8 -12
@@ -36,9 +36,8 @@ struct vsp1_histogram_buffer * vsp1_histogram_buffer_get(struct vsp1_histogram *histo) {struct vsp1_histogram_buffer *buf =NULL ; -unsigned long flags; -spin_lock_irqsave (&histo->irqlock, flags); +spin_lock (&histo->irqlock);if (list_empty (&histo->irqqueue)) goto done;
@@ -49,7 +48,7 @@ vsp1_histogram_buffer_get(struct vsp1_histogram *histo) histo->readout = true; done: -spin_unlock_irqrestore (&histo->irqlock, flags); +spin_unlock (&histo->irqlock);return buf; }
@@ -58,7 +57,6 @@ void vsp1_histogram_buffer_complete(struct vsp1_histogram *histo, size_t size) {struct vsp1_pipeline *pipe = histo->entity.pipe; -unsigned long flags;/* * The pipeline pointer is guaranteed to be valid as this function is
@@ -70,10 +68,10 @@ void vsp1_histogram_buffer_complete(struct vsp1_histogram *histo,vb2_set_plane_payload (&buf->buf.vb2_buf,0 , size);vb2_buffer_done (&buf->buf.vb2_buf,VB2_BUF_STATE_DONE ); -spin_lock_irqsave (&histo->irqlock, flags); +spin_lock (&histo->irqlock); histo->readout = false;wake_up (&histo->wait_queue); -spin_unlock_irqrestore (&histo->irqlock, flags); +spin_unlock (&histo->irqlock); }/* -----------------------------------------------------------------------------
@@ -124,11 +122,10 @@ static void histo_buffer_queue(struct vb2_buffer *vb)struct vb2_v4l2_buffer *vbuf =to_vb2_v4l2_buffer (vb);struct vsp1_histogram *histo =vb2_get_drv_priv (vb->vb2_queue);struct vsp1_histogram_buffer *buf =to_vsp1_histogram_buffer (vbuf); -unsigned long flags; -spin_lock_irqsave (&histo->irqlock, flags); +spin_lock_irq (&histo->irqlock);list_add_tail (&buf->queue, &histo->irqqueue); -spin_unlock_irqrestore (&histo->irqlock, flags); +spin_unlock_irq (&histo->irqlock); }static int histo_start_streaming (struct vb2_queue *vq,unsigned int count)
@@ -140,9 +137,8 @@ static void histo_stop_streaming(struct vb2_queue *vq) {struct vsp1_histogram *histo =vb2_get_drv_priv (vq);struct vsp1_histogram_buffer *buffer; -unsigned long flags; -spin_lock_irqsave (&histo->irqlock, flags); +spin_lock_irq (&histo->irqlock);/* Remove all buffers from the IRQ queue. */ list_for_each_entry (buffer, &histo->irqqueue, queue)
@@ -152,7 +148,7 @@ static void histo_stop_streaming(struct vb2_queue *vq)/* Wait for the buffer being read out (if any) to complete. */ wait_event_lock_irq (histo->wait_queue, !histo->readout, histo->irqlock); -spin_unlock_irqrestore (&histo->irqlock, flags); +spin_unlock_irq (&histo->irqlock); }static const struct vb2_ops histo_video_queue_qops = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 150/440 media: renesas: vsp1: Store RPF partition configuration per RPF instance
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laurent Pinchart <[email protected]>
[ Upstream commit a213bc09b1025c771ee722ee341af1d84375db8a ]
The vsp1_partition structure stores the RPF partition configuration in a single field for all RPF instances, while each RPF can have its own configuration. Fix it by storing the configuration separately for each RPF instance.
--- drivers/media/platform/renesas/vsp1/vsp1_pipe.h | 2 +- drivers/media/platform/renesas/vsp1/vsp1_rpf.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/media/platform/renesas/vsp1/vsp1_pipe.h +1 -1
@@ -73,7 +73,7 @@ struct vsp1_partition_window {* @wpf: The WPF partition window configuration */ struct vsp1_partition { -struct vsp1_partition_window rpf; +struct vsp1_partition_window rpf[VSP1_MAX_RPF ];struct vsp1_partition_window uds_sink;struct vsp1_partition_window uds_source;struct vsp1_partition_window sru;
drivers/media/platform/renesas/vsp1/vsp1_rpf.c +5 -3
@@ -271,8 +271,8 @@ static void rpf_configure_partition(struct vsp1_entity *entity,* 'width' need to be adjusted. */ if (pipe->partitions >1 ) { - crop.width = pipe->partition->rpf.width; - crop.left += pipe->partition->rpf.left; + crop.width = pipe->partition->rpf[rpf->entity.index].width; + crop.left += pipe->partition->rpf[rpf->entity.index].left; }if (pipe->interlaced) {
@@ -327,7 +327,9 @@ static void rpf_partition(struct vsp1_entity *entity,unsigned int partition_idx, struct vsp1_partition_window *window) { - partition->rpf = *window; + struct vsp1_rwpf *rpf = to_rwpf(&entity->subdev); + + partition->rpf[rpf->entity.index] = *window; } static const struct vsp1_entity_operations rpf_entity_ops = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 151/440 drm/mediatek: Add missing plane settings when async update
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hsiao Chien Sung <[email protected]>
[ Upstream commit 86b89dc669c400576dc23aa923bcf302f99e8e3a ]
Fix an issue that plane coordinate was not saved when calling async update.
--- drivers/gpu/drm/mediatek/mtk_drm_plane.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/mediatek/mtk_drm_plane.c +2 -0
@@ -157,6 +157,8 @@ static void mtk_plane_atomic_async_update(struct drm_plane *plane, plane->state->src_y = new_state->src_y; plane->state->src_h = new_state->src_h; plane->state->src_w = new_state->src_w; + plane->state->dst.x1 = new_state->dst.x1; + plane->state->dst.y1 = new_state->dst.y1;mtk_plane_update_new_state (new_state, new_plane_state);swap (plane->state->fb, new_state->fb);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 152/440 drm/mediatek: Add OVL compatible name for MT8195
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hsiao Chien Sung <[email protected]>
[ Upstream commit 6fb7a0985fd16868b5d72eb3e3de7524a6000e6e ]
Add OVL compatible name for MT8195.
Without this commit, DRM won't work after modifying the device tree.
--- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/mediatek/mtk_drm_drv.c +2 -0
@@ -598,6 +598,8 @@ static const struct of_device_id mtk_ddp_comp_dt_ids[] = { .data = (void *)MTK_DISP_OVL }, { .compatible = "mediatek,mt8192-disp-ovl", .data = (void *)MTK_DISP_OVL }, + { .compatible = "mediatek,mt8195-disp-ovl", + .data = (void *)MTK_DISP_OVL }, { .compatible = "mediatek,mt8183-disp-ovl-2l", .data = (void *)MTK_DISP_OVL_2L }, { .compatible = "mediatek,mt8192-disp-ovl-2l",
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 153/440 leds: trigger: Unregister sysfs attributes before calling deactivate()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit c0dc9adf9474ecb7106e60e5472577375aedaed3 ]
Triggers which have trigger specific sysfs attributes typically store related data in trigger-data allocated by the activate() callback and freed by the deactivate() callback.
Calling device_remove_groups() after calling deactivate() leaves a window where the sysfs attributes show/store functions could be called after deactivation and then operate on the just freed trigger-data.
Move the device_remove_groups() call to before deactivate() to close this race window.
This also makes the deactivation path properly do things in reverse order of the activation path which calls the activate() callback before calling device_add_groups().
--- drivers/leds/led-triggers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/leds/led-triggers.c +1 -1
@@ -179,9 +179,9 @@ int led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig)cancel_work_sync (&led_cdev->set_brightness_work);led_stop_software_blink (led_cdev); +device_remove_groups (led_cdev->dev, led_cdev->trigger->groups);if (led_cdev->trigger->deactivate) led_cdev->trigger->deactivate (led_cdev); -device_remove_groups (led_cdev->dev, led_cdev->trigger->groups); led_cdev->trigger =NULL ; led_cdev->trigger_data =NULL ; led_cdev->activated = false;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 154/440 drm/msm/dsi: set VIDEO_COMPRESSION_MODE_CTRL_WC
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan Marek <[email protected]>
[ Upstream commit 9ecd0ddd223b68b4603e4766a1d51f6c6cda346e ]
Video mode DSC won't work if this field is not set correctly. Set it to fix video mode DSC (for slice_per_pkt==1 cases at least).
Patchwork: https://patchwork.freedesktop.org/patch/596234/
--- drivers/gpu/drm/msm/dsi/dsi_host.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/msm/dsi/dsi_host.c +3 -0
@@ -848,6 +848,7 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_modu32 slice_per_intf, total_bytes_per_intf;u32 pkt_per_line;u32 eol_byte_num; +u32 bytes_per_pkt;/* first calculate dsc parameters and then program * compress mode registers
@@ -855,6 +856,7 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mod slice_per_intf =DIV_ROUND_UP (hdisplay, dsc->slice_width); total_bytes_per_intf = dsc->slice_chunk_size * slice_per_intf; + bytes_per_pkt = dsc->slice_chunk_size;/* * slice_per_pkt; */ eol_byte_num = total_bytes_per_intf %3 ;
@@ -892,6 +894,7 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_moddsi_write (msm_host,REG_DSI_COMMAND_COMPRESSION_MODE_CTRL , reg_ctrl);dsi_write (msm_host,REG_DSI_COMMAND_COMPRESSION_MODE_CTRL2 , reg_ctrl2); }else { + reg |=DSI_VIDEO_COMPRESSION_MODE_CTRL_WC (bytes_per_pkt);dsi_write (msm_host,REG_DSI_VIDEO_COMPRESSION_MODE_CTRL , reg); } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 155/440 drm/msm/dpu: drop validity checks for clear_pending_flush() ctl op
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abhinav Kumar <[email protected]>
[ Upstream commit 3d68e3dedd4b48f0358bdc187277e3315d8aa559 ]
clear_pending_flush() ctl op is always assigned irrespective of the DPU hardware revision. Hence there is no needed to check whether the op has been assigned before calling it.
Drop the checks across the driver for clear_pending_flush() and also update its documentation that it is always expected to be assigned.
changes in v2:
- instead of adding more validity checks just drop the one for clear_pending_flush
- update the documentation for clear_pending_flush() ctl op
- update the commit text reflecting these changes
changes in v3:
- simplify the documentation of clear_pending_flush
Patchwork: https://patchwork.freedesktop.org/patch/600241/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 3 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 3 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.h | 3 ++- 3 files changed, 4 insertions(+), 5 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +1 -2
@@ -1653,8 +1653,7 @@ void dpu_encoder_trigger_kickoff_pending(struct drm_encoder *drm_enc) phys = dpu_enc->phys_encs[i]; ctl = phys->hw_ctl; -if (ctl->ops.clear_pending_flush) - ctl->ops.clear_pending_flush (ctl); + ctl->ops.clear_pending_flush (ctl);/* update only for command mode primary ctl */ if ((phys == dpu_enc->cur_master) &&
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c +1 -2
@@ -548,8 +548,7 @@ static void dpu_encoder_phys_wb_disable(struct dpu_encoder_phys *phys_enc) }/* reset h/w before final flush */ -if (phys_enc->hw_ctl->ops.clear_pending_flush) - phys_enc->hw_ctl->ops.clear_pending_flush (phys_enc->hw_ctl); + phys_enc->hw_ctl->ops.clear_pending_flush (phys_enc->hw_ctl);/* * New CTL reset sequence from 5.0 MDP onwards.
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.h +2 -1
@@ -81,7 +81,8 @@ struct dpu_hw_ctl_ops {/** * Clear the value of the cached pending_flush_mask -* No effect on hardware +* No effect on hardware. +* Required to be implemented. * @ctx : ctl path ctx pointer */ void (*clear_pending_flush)(struct dpu_hw_ctl *ctx);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 156/440 perf test: Replace arm callgraph fp test workload with leafloop
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
[ Upstream commit 7cf0b4a73a4a4f36bb4ef53d066b811b7621c635 ]
So that it can get rid of requirement of a compiler.
Stable-dep-of: ff16aeb9b834 ("perf test: Make test_arm_callgraph_fp.sh more robust")
--- .../perf/tests/shell/test_arm_callgraph_fp.sh | 34 ++----------------- 1 file changed, 3 insertions(+), 31 deletions(-)
tools/perf/tests/shell/test_arm_callgraph_fp.sh +3 -31
@@ -4,44 +4,16 @@ lscpu | grep -q "aarch64" || exit 2 -if ! [ -x "$(command -v cc)" ]; then - echo "failed: no compiler, install gcc" - exit 2 -fi - PERF_DATA=$(mktemp /tmp/__perf_test.perf.data.XXXXX) -TEST_PROGRAM_SOURCE=$(mktemp /tmp/test_program.XXXXX.c) -TEST_PROGRAM=$(mktemp /tmp/test_program.XXXXX) +TEST_PROGRAM="perf test -w leafloop" cleanup_files() { rm -f $PERF_DATA - rm -f $TEST_PROGRAM_SOURCE - rm -f $TEST_PROGRAM } trap cleanup_files exit term int -cat << EOF > $TEST_PROGRAM_SOURCE -int a = 0; -void leaf(void) { - for (;;) - a += a; -} -void parent(void) { - leaf(); -} -int main(void) { - parent(); - return 0; -} -EOF - -echo " + Compiling test program ($TEST_PROGRAM)..." - -CFLAGS="-g -O0 -fno-inline -fno-omit-frame-pointer" -cc $CFLAGS $TEST_PROGRAM_SOURCE -o $TEST_PROGRAM || exit 1 - # Add a 1 second delay to skip samples that are not in the leaf() function perf record -o $PERF_DATA --call-graph fp -e cycles//u -D 1000 --user-callchains -- $TEST_PROGRAM 2> /dev/null & PID=$!
@@ -58,11 +30,11 @@ wait $PID # program # 728 leaf # 753 parent -# 76c main +# 76c leafloop # ... perf script -i $PERF_DATA -F comm,ip,sym | head -n4 perf script -i $PERF_DATA -F comm,ip,sym | head -n4 | \ awk '{ if ($2 != "") sym[i++] = $2 } END { if (sym[0] != "leaf" || sym[1] != "parent" || - sym[2] != "main") exit 1 }' + sym[2] != "leafloop") exit 1 }'
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 157/440 perf tests arm_callgraph_fp: Address shellcheck warnings about signal names and adding double quotes for expression
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Spoorthy S <[email protected]>
[ Upstream commit 1bb17b4c6c91ad4d9468247cf5f5464fa6440668 ]
Running shellcheck -S on test_arm_calligraph_fp throws warnings SC2086 and SC3049,
$shellcheck -S warning tests/shell/test_arm_callgraph_fp.sh
rm -f $PERF_DATA
: Double quote to prevent globbing and word splitting.
trap cleanup_files exit term int
: In POSIX sh, using lower/mixed case for signal names is undefined.
After fixing the warnings,
$shellcheck tests/shell/test_arm_callgraph_fp.sh
$ echo $? 0
To address the POSIX shell warnings added changes to convert Lowercase signal names to uppercase in the script and double quoted the command substitutions($fix to "$fix") to solve Globbing warnings.
Stable-dep-of: ff16aeb9b834 ("perf test: Make test_arm_callgraph_fp.sh more robust")
--- tools/perf/tests/shell/test_arm_callgraph_fp.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/tests/shell/test_arm_callgraph_fp.sh +3 -3
@@ -9,13 +9,13 @@ TEST_PROGRAM="perf test -w leafloop" cleanup_files() { - rm -f $PERF_DATA + rm -f "$PERF_DATA" } -trap cleanup_files exit term int +trap cleanup_files EXIT TERM INT # Add a 1 second delay to skip samples that are not in the leaf() function -perf record -o $PERF_DATA --call-graph fp -e cycles//u -D 1000 --user-callchains -- $TEST_PROGRAM 2> /dev/null & +perf record -o "$PERF_DATA" --call-graph fp -e cycles//u -D 1000 --user-callchains -- "$TEST_PROGRAM" 2> /dev/null & PID=$! echo " + Recording (PID=$PID)..."
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 158/440 perf tests: Fix test_arm_callgraph_fp variable expansion
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Clark <[email protected]>
[ Upstream commit 33fe7c08446af6dda0ff08ff4fa9c921e574477f ]
$TEST_PROGRAM is a command with spaces so it's supposed to be word split. The referenced fix to fix the shellcheck warnings incorrectly quoted this string so unquote it to fix the test.
At the same time silence the shellcheck warning for that line and fix two more shellcheck errors at the end of the script.
Stable-dep-of: ff16aeb9b834 ("perf test: Make test_arm_callgraph_fp.sh more robust")
--- tools/perf/tests/shell/test_arm_callgraph_fp.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
tools/perf/tests/shell/test_arm_callgraph_fp.sh +4 -3
@@ -15,7 +15,8 @@ cleanup_files() trap cleanup_files EXIT TERM INT # Add a 1 second delay to skip samples that are not in the leaf() function -perf record -o "$PERF_DATA" --call-graph fp -e cycles//u -D 1000 --user-callchains -- "$TEST_PROGRAM" 2> /dev/null & +# shellcheck disable=SC2086 +perf record -o "$PERF_DATA" --call-graph fp -e cycles//u -D 1000 --user-callchains -- $TEST_PROGRAM 2> /dev/null & PID=$! echo " + Recording (PID=$PID)..."
@@ -33,8 +34,8 @@ wait $PID # 76c leafloop # ... -perf script -i $PERF_DATA -F comm,ip,sym | head -n4 -perf script -i $PERF_DATA -F comm,ip,sym | head -n4 | \ +perf script -i "$PERF_DATA" -F comm,ip,sym | head -n4 +perf script -i "$PERF_DATA" -F comm,ip,sym | head -n4 | \ awk '{ if ($2 != "") sym[i++] = $2 } END { if (sym[0] != "leaf" || sym[1] != "parent" || sym[2] != "leafloop") exit 1 }'
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 159/440 perf test: Make test_arm_callgraph_fp.sh more robust
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Clark <[email protected]>
[ Upstream commit ff16aeb9b83441b8458d4235496cf320189a0c60 ]
The 2 second sleep can cause the test to fail on very slow network file systems because Perf ends up being killed before it finishes starting up.
Fix it by making the leafloop workload end after a fixed time like the other workloads so there is no need to kill it after 2 seconds.
Also remove the 1 second start sampling delay because it is similarly fragile. Instead, search through all samples for a matching one, rather than just checking the first sample and hoping it's in the right place.
--- .../perf/tests/shell/test_arm_callgraph_fp.sh | 27 +++++++------------ tools/perf/tests/workloads/leafloop.c | 20 +++++++++++--- 2 files changed, 26 insertions(+), 21 deletions(-)
tools/perf/tests/shell/test_arm_callgraph_fp.sh +10 -17
@@ -14,28 +14,21 @@ cleanup_files() trap cleanup_files EXIT TERM INT -# Add a 1 second delay to skip samples that are not in the leaf() function # shellcheck disable=SC2086 -perf record -o "$PERF_DATA" --call-graph fp -e cycles//u -D 1000 --user-callchains -- $TEST_PROGRAM 2> /dev/null & -PID=$! +perf record -o "$PERF_DATA" --call-graph fp -e cycles//u --user-callchains -- $TEST_PROGRAM -echo " + Recording (PID=$PID)..." -sleep 2 -echo " + Stopping perf-record..." - -kill $PID -wait $PID +# Try opening the file so any immediate errors are visible in the log +perf script -i "$PERF_DATA" -F comm,ip,sym | head -n4 -# expected perf-script output: +# expected perf-script output if 'leaf' has been inserted correctly: # -# program +# perf # 728 leaf # 753 parent # 76c leafloop -# ... +# ... remaining stack to main() ... -perf script -i "$PERF_DATA" -F comm,ip,sym | head -n4 -perf script -i "$PERF_DATA" -F comm,ip,sym | head -n4 | \ - awk '{ if ($2 != "") sym[i++] = $2 } END { if (sym[0] != "leaf" || - sym[1] != "parent" || - sym[2] != "leafloop") exit 1 }' +# Each frame is separated by a tab, some spaces and an address +SEP="[[:space:]]+ [[:xdigit:]]+" +perf script -i "$PERF_DATA" -F comm,ip,sym | tr '\n' ' ' | \ + grep -E -q "perf $SEP leaf $SEP parent $SEP leafloop"
tools/perf/tests/workloads/leafloop.c +16 -4
@@ -1,6 +1,8 @@/* SPDX-License-Identifier: GPL-2.0 */ +#include <signal.h> #include <stdlib.h> #include <linux/compiler.h> +#include <unistd.h> #include "../tests.h" /* We want to check these symbols in perf script */
@@ -8,10 +10,16 @@ noinline void leaf(volatile int b); noinline void parent(volatile int b);static volatile int a; +static volatile sig_atomic_t done; + +static void sighandler (int sig__maybe_unused ) +{ + done =1 ; +} noinline void leaf(volatile int b) { -for (;;) +while (!done) a += b; }
@@ -22,12 +30,16 @@ noinline void parent(volatile int b)static int leafloop (int argc,const char **argv) { -int c =1 ; +int sec =1 ;if (argc >0 ) - c =atoi (argv[0 ]); + sec =atoi (argv[0 ]); + +signal (SIGINT , sighandler); +signal (SIGALRM , sighandler); +alarm (sec); -parent (c); +parent (sec);return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 160/440 perf report: Fix condition in sort__sym_cmp()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
[ Upstream commit cb39d05e67dc24985ff9f5150e71040fa4d60ab8 ]
It's expected that both hist entries are in the same hists when comparing two. But the current code in the function checks one without dso sort key and other with the key. This would make the condition true in any case.
I guess the intention of the original commit was to add '!' for the right side too. But as it should be the same, let's just remove it.
--- tools/perf/util/sort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/sort.c +1 -1
@@ -275,7 +275,7 @@ sort__sym_cmp(struct hist_entry *left, struct hist_entry *right)* comparing symbol address alone is not enough since it's a * relative address within a dso. */ -if (!hists__has (left->hists, dso) ||hists__has (right->hists, dso)) { +if (!hists__has (left->hists, dso)) { ret =sort__dso_cmp (left, right);if (ret !=0 )return ret;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 161/440 drm/etnaviv: fix DMA direction handling for cached RW buffers
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lucas Stach <[email protected]>
[ Upstream commit 58979ad6330a70450ed78837be3095107d022ea9 ]
The dma sync operation needs to be done with DMA_BIDIRECTIONAL when the BO is prepared for both read and write operations.
--- drivers/gpu/drm/etnaviv/etnaviv_gem.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/etnaviv/etnaviv_gem.c +4 -2
@@ -355,9 +355,11 @@ static void *etnaviv_gem_vmap_impl(struct etnaviv_gem_object *obj)static inline enum dma_data_direction etnaviv_op_to_dma_dir (u32 op) { -if (op &ETNA_PREP_READ ) + op &=ETNA_PREP_READ |ETNA_PREP_WRITE ; + +if (op ==ETNA_PREP_READ )return DMA_FROM_DEVICE ; -else if (op &ETNA_PREP_WRITE ) +else if (op ==ETNA_PREP_WRITE )return DMA_TO_DEVICE ;else return DMA_BIDIRECTIONAL ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 162/440 drm/qxl: Add check for drm_cvt_mode
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ni <[email protected]>
[ Upstream commit 7bd09a2db0f617377027a2bb0b9179e6959edff3 ]
Add check for the return value of drm_cvt_mode() and return the error if it fails in order to avoid NULL pointer dereference.
--- drivers/gpu/drm/qxl/qxl_display.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/qxl/qxl_display.c +3 -0
@@ -236,6 +236,9 @@ static int qxl_add_mode(struct drm_connector *connector,return 0 ; mode =drm_cvt_mode (dev, width, height,60 , false, false, false); +if (!mode) +return 0 ; +if (preferred) mode->type |=DRM_MODE_TYPE_PREFERRED ; mode->hdisplay = width;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 163/440 Revert "leds: led-core: Fix refcount leak in of_led_get()"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luca Ceresoli <[email protected]>
[ Upstream commit 940b27161afc6ec53fc66245a4fb3518394cdc92 ]
This reverts commit da1afe8e6099980fe1e2fd7436dca284af9d3f29.
Commit 699a8c7c4bd3 ("leds: Add of_led_get() and led_put()"), introduced in 5.5, added of_led_get() and led_put() but missed a put_device() in led_put(), thus creating a leak in case the consumer device is removed.
Arguably device removal was not very popular, so this went apparently unnoticed until 2022. In January 2023 two different patches got merged to fix the same bug:
- commit da1afe8e6099 ("leds: led-core: Fix refcount leak in of_led_get()")
- commit 445110941eb9 ("leds: led-class: Add missing put_device() to led_put()")
They fix the bug in two different ways, which creates no patch conflicts, and both were merged in v6.2. The result is that now there is one more put_device() than get_device()s, instead of one less.
Arguably device removal is not very popular yet, so this apparently hasn't been noticed as well up to now. But it blew up here while I'm working with device tree overlay insertion and removal. The symptom is an apparently unrelated list of oopses on device removal, with reasons:
kernfs: can not remove 'uevent', no directory
kernfs: can not remove 'brightness', no directory
kernfs: can not remove 'max_brightness', no directory
...
Here sysfs fails removing attribute files, which is because the device name changed and so the sysfs path. This is because the device name string got corrupted, which is because it got freed too early and its memory reused.
Different symptoms could appear in different use cases.
Fix by removing one of the two fixes.
The choice was to remove commit da1afe8e6099 because:
* it is calling put_device() inside of_led_get() just after getting the device, thus it is basically not refcounting the LED device at all during its entire lifetime
* it does not add a corresponding put_device() in led_get(), so it fixes only the OF case
The other fix (445110941eb9) is adding the put_device() in led_put() so it covers the entire lifetime, and it works even in the non-DT case.
--- drivers/leds/led-class.c | 1 - 1 file changed, 1 deletion(-)
drivers/leds/led-class.c +0 -1
@@ -235,7 +235,6 @@ struct led_classdev *of_led_get(struct device_node *np, int index) led_dev =class_find_device_by_of_node (leds_class, led_node);of_node_put (led_node); -put_device (led_dev);if (!led_dev)return ERR_PTR (-EPROBE_DEFER );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 164/440 ext4: fix infinite loop when replaying fast_commit
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luis Henriques (SUSE) <[email protected]>
[ Upstream commit 907c3fe532253a6ef4eb9c4d67efb71fab58c706 ]
When doing fast_commit replay an infinite loop may occur due to an uninitialized extent_status struct. ext4_ext_determine_insert_hole() does not detect the replay and calls ext4_es_find_extent_range(), which will return immediately without initializing the 'es' variable.
Because 'es' contains garbage, an integer overflow may happen causing an infinite loop in this function, easily reproducible using fstest generic/039.
This commit fixes this issue by unconditionally initializing the structure in function ext4_es_find_extent_range().
Thanks to Zhang Yi, for figuring out the real problem!
--- fs/ext4/extents_status.c | 2 ++ 1 file changed, 2 insertions(+)
fs/ext4/extents_status.c +2 -0
@@ -312,6 +312,8 @@ void ext4_es_find_extent_range(struct inode *inode, ext4_lblk_t lblk, ext4_lblk_t end, struct extent_status *es) { + es->es_lblk = es->es_len = es->es_pblk = 0; +if (EXT4_SB (inode->i_sb)->s_mount_state &EXT4_FC_REPLAY )return ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 165/440 media: venus: flush all buffers in output plane streamoff
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dikshita Agarwal <[email protected]>
[ Upstream commit e750a4b1224142bd8dd057b0d5adf8a5608b7e77 ]
For scenarios, when source change is followed by VIDIOC_STREAMOFF on output plane, driver should discard any queued OUTPUT buffers, which are not decoded or dequeued.
Flush with HFI_FLUSH_INPUT does not have any actual impact. So, fix it, by invoking HFI_FLUSH_ALL, which will flush all queued buffers.
--- drivers/media/platform/qcom/venus/vdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/qcom/venus/vdec.c +1 -1
@@ -1221,7 +1221,7 @@ static int vdec_stop_output(struct venus_inst *inst)break ;case VENUS_DEC_STATE_INIT :case VENUS_DEC_STATE_CAPTURE_SETUP : - ret =hfi_session_flush (inst,HFI_FLUSH_INPUT , true); + ret =hfi_session_flush (inst,HFI_FLUSH_ALL , true);break ;default :break ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 166/440 perf intel-pt: Fix aux_watermark calculation for 64-bit size
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
[ Upstream commit 36b4cd990a8fd3f5b748883050e9d8c69fe6398d ]
aux_watermark is a u32. For a 64-bit size, cap the aux_watermark calculation at UINT_MAX instead of truncating it to 32-bits.
--- tools/perf/arch/x86/util/intel-pt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/arch/x86/util/intel-pt.c +2 -1
@@ -780,7 +780,8 @@ static int intel_pt_recording_options(struct auxtrace_record *itr, }if (!opts->auxtrace_snapshot_mode && !opts->auxtrace_sample_mode) { -u32 aux_watermark = opts->auxtrace_mmap_pages * page_size /4 ; +size_t aw = opts->auxtrace_mmap_pages * (size_t )page_size /4 ; +u32 aux_watermark = aw >UINT_MAX ?UINT_MAX : aw; intel_pt_evsel->core.attr.aux_watermark = aux_watermark; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 167/440 perf intel-pt: Fix exclude_guest setting
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
[ Upstream commit b40934ae32232140e85dc7dc1c3ea0e296986723 ]
In the past, the exclude_guest setting has had no effect on Intel PT tracing, but that may not be the case in the future.
Set the flag correctly based upon whether KVM is using Intel PT "Host/Guest" mode, which is determined by the kvm_intel module parameter pt_mode:
pt_mode=0 System-wide mode : host and guest output to host buffer
pt_mode=1 Host/Guest mode : host/guest output to host/guest
buffers respectively
--- tools/perf/arch/x86/util/intel-pt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
tools/perf/arch/x86/util/intel-pt.c +12 -0
@@ -32,6 +32,7 @@#include "../../../util/tsc.h" #include <internal/lib.h> // page_size #include "../../../util/intel-pt.h" +#include <api/fs/fs.h> #define KiB (x) ((x) * 1024)#define MiB (x) ((x) * 1024 * 1024)
@@ -440,6 +441,16 @@ static int intel_pt_track_switches(struct evlist *evlist)return 0 ; } +static bool intel_pt_exclude_guest (void ) +{ +int pt_mode; + +if (sysfs__read_int ("module/kvm_intel/parameters/pt_mode" , &pt_mode)) + pt_mode =0 ; + +return pt_mode ==1 ; +} +static void intel_pt_valid_str (char *str,size_t len,u64 valid) {unsigned int val, last =0 , state =1 ;
@@ -643,6 +654,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr, } evsel->core.attr.freq =0 ; evsel->core.attr.sample_period =1 ; + evsel->core.attr.exclude_guest =intel_pt_exclude_guest (); evsel->no_aux_samples = true; evsel->needs_auxtrace_mmap = true; intel_pt_evsel = evsel;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 168/440 mfd: rsmu: Split core code into separate module
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit c879a8c39dd55e7fabdd8d13341f7bc5200db377 ]
Linking a file into two modules can have unintended side-effects and produces a W=1 warning:
scripts/Makefile.build:236: drivers/mfd/Makefile: rsmu_core.o is added to multiple modules: rsmu-i2c rsmu-spi
Make this one a separate module instead.
--- drivers/mfd/Makefile | 6 ++---- drivers/mfd/rsmu_core.c | 2 ++ 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/mfd/Makefile +2 -4
@@ -276,7 +276,5 @@ obj-$(CONFIG_MFD_INTEL_M10_BMC) += intel-m10-bmc.o obj-$(CONFIG_MFD_ATC260X) += atc260x-core.o obj-$(CONFIG_MFD_ATC260X_I2C) += atc260x-i2c.o -rsmu-i2c-objs := rsmu_core.o rsmu_i2c.o -rsmu-spi-objs := rsmu_core.o rsmu_spi.o -obj-$(CONFIG_MFD_RSMU_I2C) += rsmu-i2c.o -obj-$(CONFIG_MFD_RSMU_SPI) += rsmu-spi.o +obj-$(CONFIG_MFD_RSMU_I2C) += rsmu_i2c.o rsmu_core.o +obj-$(CONFIG_MFD_RSMU_SPI) += rsmu_spi.o rsmu_core.o
drivers/mfd/rsmu_core.c +2 -0
@@ -78,11 +78,13 @@ int rsmu_core_init(struct rsmu_ddata *rsmu)return ret; } +EXPORT_SYMBOL_GPL (rsmu_core_init);void rsmu_core_exit (struct rsmu_ddata *rsmu) {mutex_destroy (&rsmu->lock); } +EXPORT_SYMBOL_GPL (rsmu_core_exit);MODULE_DESCRIPTION ("Renesas SMU core driver" );MODULE_LICENSE ("GPL" );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 169/440 mfd: omap-usb-tll: Use struct_size to allocate tll
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
[ Upstream commit 40176714c818b0b6a2ca8213cdb7654fbd49b742 ]
Commit 16c2004d9e4d ("mfd: omap-usb-tll: Allocate driver data at once") changed the memory allocation of 'tll' to consolidate it into a single allocation, introducing an incorrect size calculation.
In particular, the allocation for the array of pointers was converted into a single-pointer allocation.
The memory allocation used to occur in two steps:
tll = devm_kzalloc(dev, sizeof(struct usbtll_omap), GFP_KERNEL); tll->ch_clk = devm_kzalloc(dev, sizeof(struct clk *) * tll->nch,
GFP_KERNEL);
And it turned that into the following allocation:
tll = devm_kzalloc(dev, sizeof(*tll) + sizeof(tll->ch_clk[nch]),
GFP_KERNEL);
sizeof(tll->ch_clk[nch]) returns the size of a single pointer instead of the expected nch pointers.
This bug went unnoticed because the allocation size was small enough to fit within the minimum size of a memory allocation for this particular case [1].
The complete allocation can still be done at once with the struct_size macro, which comes in handy for structures with a trailing flexible array.
Fix the memory allocation to obtain the original size again.
--- drivers/mfd/omap-usb-tll.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mfd/omap-usb-tll.c +1 -2
@@ -237,8 +237,7 @@ static int usbtll_omap_probe(struct platform_device *pdev)break ; } - tll =devm_kzalloc (dev,sizeof (*tll) +sizeof (tll->ch_clk[nch]), -GFP_KERNEL ); + tll =devm_kzalloc (dev,struct_size (tll, ch_clk, nch),GFP_KERNEL );if (!tll) {pm_runtime_put_sync (dev);pm_runtime_disable (dev);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 170/440 xprtrdma: Fix rpcrdma_reqs_reset()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
[ Upstream commit acd9f2dd23c632568156217aac7a05f5a0313152 ]
Avoid FastReg operations getting MW_BIND_ERR after a reconnect.
rpcrdma_reqs_reset() is called on transport tear-down to get each rpcrdma_req back into a clean state.
MRs on req->rl_registered are waiting for a FastReg, are already registered, or are waiting for invalidation. If the transport is being torn down when reqs_reset() is called, the matching LocalInv might never be posted. That leaves these MR registered /and/ on req->rl_free_mrs, where they can be re-used for the next connection.
Since xprtrdma does not keep specific track of the MR state, it's not possible to know what state these MRs are in, so the only safe thing to do is release them immediately.
--- net/sunrpc/xprtrdma/frwr_ops.c | 3 ++- net/sunrpc/xprtrdma/verbs.c | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-)
net/sunrpc/xprtrdma/frwr_ops.c +2 -1
@@ -92,7 +92,8 @@ static void frwr_mr_put(struct rpcrdma_mr *mr)rpcrdma_mr_push (mr, &mr->mr_req->rl_free_mrs); } -/* frwr_reset - Place MRs back on the free list +/** +* frwr_reset - Place MRs back on @req's free list * @req: request to reset * * Used after a failed marshal. For FRWR, this means the MRs
net/sunrpc/xprtrdma/verbs.c +15 -1
@@ -897,6 +897,8 @@ static int rpcrdma_reqs_setup(struct rpcrdma_xprt *r_xprt)static void rpcrdma_req_reset (struct rpcrdma_req *req) { +struct rpcrdma_mr *mr; +/* Credits are valid for only one connection */ req->rl_slot.rq_cong =0 ;
@@ -906,7 +908,19 @@ static void rpcrdma_req_reset(struct rpcrdma_req *req)rpcrdma_regbuf_dma_unmap (req->rl_sendbuf);rpcrdma_regbuf_dma_unmap (req->rl_recvbuf); -frwr_reset (req); +/* The verbs consumer can't know the state of an MR on the +* req->rl_registered list unless a successful completion +* has occurred, so they cannot be re-used. +*/ +while ((mr =rpcrdma_mr_pop (&req->rl_registered))) { +struct rpcrdma_buffer *buf = &mr->mr_xprt->rx_buf; + +spin_lock (&buf->rb_lock); +list_del (&mr->mr_all); +spin_unlock (&buf->rb_lock); + +frwr_mr_release (mr); + } }/* ASSUMPTION: the rb_allreqs list is stable for the duration,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 171/440 SUNRPC: avoid soft lockup when transmitting UDP to reachable server.
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
[ Upstream commit 6258cf25d5e3155c3219ab5a79b970eef7996356 ]
Prior to the commit identified below, call_transmit_status() would handle -EPERM and other errors related to an unreachable server by falling through to call_status() which added a 3-second delay and handled the failure as a timeout.
Since that commit, call_transmit_status() falls through to handle_bind(). For UDP this moves straight on to handle_connect() and handle_transmit() so we immediately retransmit - and likely get the same error.
This results in an indefinite loop in __rpc_execute() which triggers a soft-lockup warning.
For the errors that indicate an unreachable server, call_transmit_status() should fall back to call_status() as it did before. This cannot cause the thundering herd that the previous patch was avoiding, as the call_status() will insert a delay.
--- net/sunrpc/clnt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/sunrpc/clnt.c +2 -1
@@ -2296,12 +2296,13 @@ call_transmit_status(struct rpc_task *task) task->tk_action = call_transmit; task->tk_status =0 ;break ; -case -ECONNREFUSED :case -EHOSTDOWN :case -ENETDOWN :case -EHOSTUNREACH :case -ENETUNREACH :case -EPERM : +break ; +case -ECONNREFUSED :if (RPC_IS_SOFTCONN (task)) {if (!task->tk_msg.rpc_proc->p_proc) trace_xprt_ping(task->tk_xprt,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 172/440 NFSv4.1 another fix for EXCHGID4_FLAG_USE_PNFS_DS for DS server
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Olga Kornievskaia <[email protected]>
[ Upstream commit 4840c00003a2275668a13b82c9f5b1aed80183aa ]
Previously in order to mark the communication with the DS server, we tried to use NFS_CS_DS in cl_flags. However, this flag would only be saved for the DS server and in case where DS equals MDS, the client would not find a matching nfs_client in nfs_match_client that represents the MDS (but is also a DS).
Instead, don't rely on the NFS_CS_DS but instead use NFS_CS_PNFS.
--- fs/nfs/nfs4client.c | 6 ++---- fs/nfs/nfs4proc.c | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-)
fs/nfs/nfs4client.c +2 -4
@@ -230,9 +230,8 @@ struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init)__set_bit (NFS_CS_INFINITE_SLOTS , &clp->cl_flags);__set_bit (NFS_CS_DISCRTRY , &clp->cl_flags);__set_bit (NFS_CS_NO_RETRANS_TIMEOUT , &clp->cl_flags); - -if (test_bit (NFS_CS_DS , &cl_init->init_flags)) -__set_bit (NFS_CS_DS , &clp->cl_flags); +if (test_bit (NFS_CS_PNFS , &cl_init->init_flags)) +__set_bit (NFS_CS_PNFS , &clp->cl_flags);/* * Set up the connection to the server before we add add to the * global list.
@@ -997,7 +996,6 @@ struct nfs_client *nfs4_set_ds_client(struct nfs_server *mds_srv,if (mds_srv->flags &NFS_MOUNT_NORESVPORT )__set_bit (NFS_CS_NORESVPORT , &cl_init.init_flags); -__set_bit (NFS_CS_DS , &cl_init.init_flags);__set_bit (NFS_CS_PNFS , &cl_init.init_flags); cl_init.max_connect =NFS_MAX_TRANSPORTS ;/*
fs/nfs/nfs4proc.c +1 -1
@@ -8821,7 +8821,7 @@ nfs4_run_exchange_id(struct nfs_client *clp, const struct cred *cred,#ifdef CONFIG_NFS_V4_1_MIGRATION calldata->args.flags |=EXCHGID4_FLAG_SUPP_MOVED_MIGR ;#endif -if (test_bit (NFS_CS_DS , &clp->cl_flags)) +if (test_bit (NFS_CS_PNFS , &clp->cl_flags)) calldata->args.flags |=EXCHGID4_FLAG_USE_PNFS_DS ; msg.rpc_argp = &calldata->args; msg.rpc_resp = &calldata->res;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 173/440 ext4: dont track ranges in fast_commit if inode has inlined data
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luis Henriques (SUSE) <[email protected]>
[ Upstream commit 7882b0187bbeb647967a7b5998ce4ad26ef68a9a ]
When fast-commit needs to track ranges, it has to handle inodes that have inlined data in a different way because ext4_fc_write_inode_data(), in the actual commit path, will attempt to map the required blocks for the range. However, inodes that have inlined data will have it's data stored in inode->i_block and, eventually, in the extended attribute space.
Unfortunately, because fast commit doesn't currently support extended attributes, the solution is to mark this commit as ineligible.
--- fs/ext4/fast_commit.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/ext4/fast_commit.c +6 -0
@@ -649,6 +649,12 @@ void ext4_fc_track_range(handle_t *handle, struct inode *inode, ext4_lblk_t starif (ext4_test_mount_flag (inode->i_sb,EXT4_MF_FC_INELIGIBLE ))return ; +if (ext4_has_inline_data (inode)) { +ext4_fc_mark_ineligible (inode->i_sb,EXT4_FC_REASON_XATTR , + handle); +return ; + } + args.start = start; args.end = end;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 174/440 ext4: avoid writing unitialized memory to disk in EA inodes
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
[ Upstream commit 65121eff3e4c8c90f8126debf3c369228691c591 ]
If the extended attribute size is not a multiple of block size, the last block in the EA inode will have uninitialized tail which will get written to disk. We will never expose the data to userspace but still this is not a good practice so just zero out the tail of the block as it isn't going to cause a noticeable performance overhead.
--- fs/ext4/xattr.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/ext4/xattr.c +6 -0
@@ -1384,6 +1384,12 @@ static int ext4_xattr_inode_write(handle_t *handle, struct inode *ea_inode, goto out;memcpy (bh->b_data, buf, csize); +/* +* Zero out block tail to avoid writing uninitialized memory +* to disk. +*/ +if (csize < blocksize) +memset (bh->b_data + csize,0 , blocksize - csize);set_buffer_uptodate (bh);ext4_handle_dirty_metadata (handle, ea_inode, bh);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 175/440 sparc64: Fix incorrect function signature and add prototype for prom_cif_init
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Larsson <[email protected]>
[ Upstream commit a6c3ea1ec96307dbfbb2f16d96c674c5cc80f445 ]
Remove the unused cif_stack argument and add a protype in oplib_64.h Commit ef3e035c3a9b ("sparc64: Fix register corruption in top-most kernel stack frame during boot.") removed the cif_stack argument to prom_cif init in the declaration at the caller site and the usage of it within prom_cif_init, but not in the function signature of the function itself.
This also fixes the following warning:arch/sparc/prom/p1275.c:52:6: warning: no previous prototype for ‘prom_cif_init’
--- arch/sparc/include/asm/oplib_64.h | 1 + arch/sparc/prom/init_64.c | 3 --- arch/sparc/prom/p1275.c | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-)
arch/sparc/include/asm/oplib_64.h +1 -0
@@ -247,6 +247,7 @@ void prom_sun4v_guest_soft_state(void);int prom_ihandle2path (int handle,char *buffer,int bufsize);/* Client interface level routines. */ +void prom_cif_init (void *cif_handler);void p1275_cmd_direct (unsigned long *);#endif /* !(__SPARC64_OPLIB_H) */
arch/sparc/prom/init_64.c +0 -3
@@ -26,9 +26,6 @@ phandle prom_chosen_node;* routines in the prom library. * It gets passed the pointer to the PROM vector. */ - -extern void prom_cif_init (void *); -void __init prom_init (void *cif_handler) {phandle node;
arch/sparc/prom/p1275.c +1 -1
@@ -49,7 +49,7 @@ void p1275_cmd_direct(unsigned long *args)local_irq_restore (flags); } -void prom_cif_init (void *cif_handler,void *cif_stack) +void prom_cif_init (void *cif_handler) { p1275buf.prom_cif_handler = (void (*)(long *))cif_handler; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 176/440 SUNRPC: Fixup gss_status tracepoint error output
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Coddington <[email protected]>
[ Upstream commit b9fae9f06d84ffab0f3f9118f3a96bbcdc528bf6 ]
The GSS routine errors are values, not flags.
--- include/trace/events/rpcgss.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/trace/events/rpcgss.h +1 -1
@@ -54,7 +54,7 @@ TRACE_DEFINE_ENUM(GSS_S_UNSEQ_TOKEN);TRACE_DEFINE_ENUM (GSS_S_GAP_TOKEN );#define show_gss_status (x) \ - __print_flags(x, "|", \ + __print_symbolic(x, \ { GSS_S_BAD_MECH, "GSS_S_BAD_MECH" }, \ { GSS_S_BAD_NAME, "GSS_S_BAD_NAME" }, \ { GSS_S_BAD_NAMETYPE, "GSS_S_BAD_NAMETYPE" }, \
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 177/440 PCI: Fix resource double counting on remove & rescan
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilpo Järvinen <[email protected]>
[ Upstream commit 903534fa7d30214d8ba840ab1cd9e917e0c88e41 ]
pbus_size_mem() keeps the size of the optional resources in children_add_size. When calculating the PCI bridge window size, calculate_memsize() lower bounds size by old_size before adding children_add_size and performing the window size alignment. This results in double counting for the resources in children_add_size because old_size may be based on the previous size of the bridge window after it has already included children_add_size (that is, size1 in pbus_size_mem() from an earlier invocation of that function).
As a result, on repeated remove of the bus & rescan cycles the resource size keeps increasing when children_add_size is non-zero as can be seen from this extract:
iomem0: 23fffd00000-23fffdfffff : PCI Bus 0000:03 # 1MiB iomem1: 20000000000-200001fffff : PCI Bus 0000:03 # 2MiB iomem2: 20000000000-200002fffff : PCI Bus 0000:03 # 3MiB iomem3: 20000000000-200003fffff : PCI Bus 0000:03 # 4MiB iomem4: 20000000000-200004fffff : PCI Bus 0000:03 # 5MiB
Solve the double counting by moving old_size check later in calculate_memsize() so that children_add_size is already accounted for.
After the patch, the bridge window retains its size as expected:
iomem0: 23fffd00000-23fffdfffff : PCI Bus 0000:03 # 1MiB iomem1: 20000000000-200000fffff : PCI Bus 0000:03 # 1MiB iomem2: 20000000000-200000fffff : PCI Bus 0000:03 # 1MiB
--- drivers/pci/setup-bus.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/pci/setup-bus.c +2 -4
@@ -824,11 +824,9 @@ static resource_size_t calculate_memsize(resource_size_t size, size = min_size;if (old_size ==1 ) old_size =0 ; -if (size < old_size) - size = old_size; - size =ALIGN (max (size, add_size) + children_add_size, align); -return size; + size =max (size, add_size) + children_add_size; +return ALIGN (max (size, old_size), align); } resource_size_t __weak pcibios_window_alignment(struct pci_bus *bus,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 178/440 PCI: keystone: Relocate ks_pcie_set/clear_dbi_mode()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Siddharth Vadapalli <[email protected]>
[ Upstream commit 5125fdc3292eea20870d4e6cefa62dc1245ce7ec ]
Relocate ks_pcie_set_dbi_mode() and ks_pcie_clear_dbi_mode() to avoid forward declaration in a subsequent patch. No functional change intended.
Stable-dep-of: 9ffa0e70b2da ("PCI: keystone: Don't enable BAR 0 for AM654x")
--- drivers/pci/controller/dwc/pci-keystone.c | 84 +++++++++++------------ 1 file changed, 42 insertions(+), 42 deletions(-)
drivers/pci/controller/dwc/pci-keystone.c +42 -42
@@ -247,6 +247,48 @@ static struct irq_chip ks_pcie_msi_irq_chip = { .irq_unmask = ks_pcie_msi_unmask, }; +/** +* ks_pcie_set_dbi_mode() - Set DBI mode to access overlaid BAR mask registers +* @ks_pcie: A pointer to the keystone_pcie structure which holds the KeyStone +* PCIe host controller driver information. +* +* Since modification of dbi_cs2 involves different clock domain, read the +* status back to ensure the transition is complete. +*/ +static void ks_pcie_set_dbi_mode (struct keystone_pcie *ks_pcie) +{ +u32 val; + + val =ks_pcie_app_readl (ks_pcie,CMD_STATUS ); + val |=DBI_CS2 ; +ks_pcie_app_writel (ks_pcie,CMD_STATUS , val); + +do { + val =ks_pcie_app_readl (ks_pcie,CMD_STATUS ); + }while (!(val &DBI_CS2 )); +} + +/** +* ks_pcie_clear_dbi_mode() - Disable DBI mode +* @ks_pcie: A pointer to the keystone_pcie structure which holds the KeyStone +* PCIe host controller driver information. +* +* Since modification of dbi_cs2 involves different clock domain, read the +* status back to ensure the transition is complete. +*/ +static void ks_pcie_clear_dbi_mode (struct keystone_pcie *ks_pcie) +{ +u32 val; + + val =ks_pcie_app_readl (ks_pcie,CMD_STATUS ); + val &= ~DBI_CS2 ; +ks_pcie_app_writel (ks_pcie,CMD_STATUS , val); + +do { + val =ks_pcie_app_readl (ks_pcie,CMD_STATUS ); + }while (val &DBI_CS2 ); +} +static int ks_pcie_msi_host_init (struct dw_pcie_rp *pp) { pp->msi_irq_chip = &ks_pcie_msi_irq_chip;
@@ -343,48 +385,6 @@ static const struct irq_domain_ops ks_pcie_legacy_irq_domain_ops = { .xlate = irq_domain_xlate_onetwocell, }; -/** -* ks_pcie_set_dbi_mode() - Set DBI mode to access overlaid BAR mask registers -* @ks_pcie: A pointer to the keystone_pcie structure which holds the KeyStone -* PCIe host controller driver information. -* -* Since modification of dbi_cs2 involves different clock domain, read the -* status back to ensure the transition is complete. -*/ -static void ks_pcie_set_dbi_mode (struct keystone_pcie *ks_pcie) -{ -u32 val; - - val =ks_pcie_app_readl (ks_pcie,CMD_STATUS ); - val |=DBI_CS2 ; -ks_pcie_app_writel (ks_pcie,CMD_STATUS , val); - -do { - val =ks_pcie_app_readl (ks_pcie,CMD_STATUS ); - }while (!(val &DBI_CS2 )); -} - -/** -* ks_pcie_clear_dbi_mode() - Disable DBI mode -* @ks_pcie: A pointer to the keystone_pcie structure which holds the KeyStone -* PCIe host controller driver information. -* -* Since modification of dbi_cs2 involves different clock domain, read the -* status back to ensure the transition is complete. -*/ -static void ks_pcie_clear_dbi_mode (struct keystone_pcie *ks_pcie) -{ -u32 val; - - val =ks_pcie_app_readl (ks_pcie,CMD_STATUS ); - val &= ~DBI_CS2 ; -ks_pcie_app_writel (ks_pcie,CMD_STATUS , val); - -do { - val =ks_pcie_app_readl (ks_pcie,CMD_STATUS ); - }while (val &DBI_CS2 ); -} -static void ks_pcie_setup_rc_app_regs (struct keystone_pcie *ks_pcie) {u32 val;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 179/440 PCI: keystone: Dont enable BAR 0 for AM654x
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Siddharth Vadapalli <[email protected]>
[ Upstream commit 9ffa0e70b2daf9b0271e4960b7c8a2350e2cda08 ]
After 6ab15b5e7057 ("PCI: dwc: keystone: Convert .scan_bus() callback to use add_bus"), ks_pcie_v3_65_add_bus() enabled BAR 0 for both v3.65a and v4.90a devices. On the AM654x SoC, which uses v4.90a, enabling BAR 0 causes Completion Timeouts when setting up MSI-X. These timeouts delay boot of the AM654x by about 45 seconds.
Move the BAR 0 initialization to ks_pcie_msi_host_init(), which is only used for v3.65a devices, and remove ks_pcie_v3_65_add_bus().
--- drivers/pci/controller/dwc/pci-keystone.c | 52 ++++++++--------------- 1 file changed, 18 insertions(+), 34 deletions(-)
drivers/pci/controller/dwc/pci-keystone.c +18 -34
@@ -291,6 +291,24 @@ static void ks_pcie_clear_dbi_mode(struct keystone_pcie *ks_pcie)static int ks_pcie_msi_host_init (struct dw_pcie_rp *pp) { +struct dw_pcie *pci =to_dw_pcie_from_pp (pp); +struct keystone_pcie *ks_pcie =to_keystone_pcie (pci); + +/* Configure and set up BAR0 */ +ks_pcie_set_dbi_mode (ks_pcie); + +/* Enable BAR0 */ +dw_pcie_writel_dbi (pci,PCI_BASE_ADDRESS_0 ,1 ); +dw_pcie_writel_dbi (pci,PCI_BASE_ADDRESS_0 ,SZ_4K -1 ); + +ks_pcie_clear_dbi_mode (ks_pcie); + +/* +* For BAR0, just setting bus address for inbound writes (MSI) should +* be sufficient. Use physical address to avoid any conflicts. +*/ +dw_pcie_writel_dbi (pci,PCI_BASE_ADDRESS_0 , ks_pcie->app.start); + pp->msi_irq_chip = &ks_pcie_msi_irq_chip;return dw_pcie_allocate_domains (pp); }
@@ -448,44 +466,10 @@ static struct pci_ops ks_child_pcie_ops = { .write = pci_generic_config_write, }; -/** -* ks_pcie_v3_65_add_bus() - keystone add_bus post initialization -* @bus: A pointer to the PCI bus structure. -* -* This sets BAR0 to enable inbound access for MSI_IRQ register -*/ -static int ks_pcie_v3_65_add_bus (struct pci_bus *bus) -{ -struct dw_pcie_rp *pp = bus->sysdata; -struct dw_pcie *pci =to_dw_pcie_from_pp (pp); -struct keystone_pcie *ks_pcie =to_keystone_pcie (pci); - -if (!pci_is_root_bus (bus)) -return 0 ; - -/* Configure and set up BAR0 */ -ks_pcie_set_dbi_mode (ks_pcie); - -/* Enable BAR0 */ -dw_pcie_writel_dbi (pci,PCI_BASE_ADDRESS_0 ,1 ); -dw_pcie_writel_dbi (pci,PCI_BASE_ADDRESS_0 ,SZ_4K -1 ); - -ks_pcie_clear_dbi_mode (ks_pcie); - -/* -* For BAR0, just setting bus address for inbound writes (MSI) should -* be sufficient. Use physical address to avoid any conflicts. -*/ -dw_pcie_writel_dbi (pci,PCI_BASE_ADDRESS_0 , ks_pcie->app.start); - -return 0 ; -} -static struct pci_ops ks_pcie_ops = { .map_bus = dw_pcie_own_conf_map_bus, .read = pci_generic_config_read, .write = pci_generic_config_write, - .add_bus = ks_pcie_v3_65_add_bus, };/**
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 180/440 PCI: keystone: Fix NULL pointer dereference in case of DT error in ks_pcie_setup_rc_app_regs()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Mishin <[email protected]>
[ Upstream commit a231707a91f323af1e5d9f1722055ec2fc1c7775 ]
If IORESOURCE_MEM is not provided in Device Tree due to any error, resource_list_first_type() will return NULL and pci_parse_request_of_pci_ranges() will just emit a warning.
This will cause a NULL pointer dereference. Fix this bug by adding NULL return check.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/pci/controller/dwc/pci-keystone.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/pci/controller/dwc/pci-keystone.c +15 -5
@@ -403,17 +403,22 @@ static const struct irq_domain_ops ks_pcie_legacy_irq_domain_ops = { .xlate = irq_domain_xlate_onetwocell, }; -static void ks_pcie_setup_rc_app_regs (struct keystone_pcie *ks_pcie) +static int ks_pcie_setup_rc_app_regs (struct keystone_pcie *ks_pcie) {u32 val;u32 num_viewport = ks_pcie->num_viewport;struct dw_pcie *pci = ks_pcie->pci;struct dw_pcie_rp *pp = &pci->pp; -u64 start, end; +struct resource_entry *entry;struct resource *mem; +u64 start, end;int i; - mem =resource_list_first_type (&pp->bridge->windows,IORESOURCE_MEM )->res; + entry =resource_list_first_type (&pp->bridge->windows,IORESOURCE_MEM ); +if (!entry) +return -ENODEV ; + + mem = entry->res; start = mem->start; end = mem->end;
@@ -424,7 +429,7 @@ static void ks_pcie_setup_rc_app_regs(struct keystone_pcie *ks_pcie)ks_pcie_clear_dbi_mode (ks_pcie);if (ks_pcie->is_am6) -return ; +return 0 ; val =ilog2 (OB_WIN_SIZE );ks_pcie_app_writel (ks_pcie,OB_SIZE , val);
@@ -441,6 +446,8 @@ static void ks_pcie_setup_rc_app_regs(struct keystone_pcie *ks_pcie) val =ks_pcie_app_readl (ks_pcie,CMD_STATUS ); val |=OB_XLAT_EN_VAL ;ks_pcie_app_writel (ks_pcie,CMD_STATUS , val); + +return 0 ; } static void __iomem *ks_pcie_other_map_bus(struct pci_bus *bus,
@@ -802,7 +809,10 @@ static int __init ks_pcie_host_init(struct dw_pcie_rp *pp)return ret;ks_pcie_stop_link (pci); -ks_pcie_setup_rc_app_regs (ks_pcie); + ret =ks_pcie_setup_rc_app_regs (ks_pcie); +if (ret) +return ret; +writew (PCI_IO_RANGE_TYPE_32 | (PCI_IO_RANGE_TYPE_32 <<8 ), pci->dbi_base +PCI_IO_BASE );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 181/440 PCI: rcar: Demote WARN() to dev_warn_ratelimited() in rcar_pcie_wakeup()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
[ Upstream commit c93637e6a4c4e1d0e85ef7efac78d066bbb24d96 ]
Avoid large backtrace, it is sufficient to warn the user that there has been a link problem. Either the link has failed and the system is in need of maintenance, or the link continues to work and user has been informed. The message from the warning can be looked up in the sources.
This makes an actual link issue less verbose.
First of all, this controller has a limitation in that the controller driver has to assist the hardware with transition to L1 link state by writing L1IATN to PMCTRL register, the L1 and L0 link state switching is not fully automatic on this controller.
In case of an ASMedia ASM1062 PCIe SATA controller which does not support ASPM, on entry to suspend or during platform pm_test, the SATA controller enters D3hot state and the link enters L1 state. If the SATA controller wakes up before rcar_pcie_wakeup() was called and returns to D0, the link returns to L0 before the controller driver even started its transition to L1 link state. At this point, the SATA controller did send an PM_ENTER_L1 DLLP to the PCIe controller and the PCIe controller received it, and the PCIe controller did set PMSR PMEL1RX bit.
Once rcar_pcie_wakeup() is called, if the link is already back in L0 state and PMEL1RX bit is set, the controller driver has no way to determine if it should perform the link transition to L1 state, or treat the link as if it is in L0 state. Currently the driver attempts to perform the transition to L1 link state unconditionally, which in this specific case fails with a PMSR L1FAEG poll timeout, however the link still works as it is already back in L0 state.
Reduce this warning verbosity. In case the link is really broken, the rcar_pcie_config_access() would fail, otherwise it will succeed and any system with this controller and ASM1062 can suspend without generating a backtrace.
--- drivers/pci/controller/pcie-rcar-host.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/pci/controller/pcie-rcar-host.c +5 -1
@@ -92,7 +92,11 @@ static int rcar_pcie_wakeup(struct device *pcie_dev, void __iomem *pcie_base)writel (L1IATN , pcie_base +PMCTLR ); ret =readl_poll_timeout_atomic (pcie_base +PMSR , val, val &L1FAEG ,10 ,1000 ); -WARN (ret,"Timeout waiting for L1 link state, ret=%d\n" , ret); +if (ret) { +dev_warn_ratelimited (pcie_dev, +"Timeout waiting for L1 link state, ret=%d\n" , + ret); + }writel (L1FAEG |PMEL1RX , pcie_base +PMSR ); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 182/440 clk: qcom: branch: Add helper functions for setting retain bits
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit b594e6f6605311785171b8d4600fe96e35625530 ]
Most Qualcomm branch clocks come with a pretty usual set of bits that can enable memory retention by means of not turning off parts of the memory logic. Add them to the common header file and introduce helper functions for setting them instead of using magic writes.
Stable-dep-of: f38467b5a920 ("clk: qcom: gcc-sc7280: Update force mem core bit for UFS ICE clock")
--- drivers/clk/qcom/clk-branch.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
drivers/clk/qcom/clk-branch.h +26 -0
@@ -37,6 +37,32 @@ struct clk_branch {struct clk_regmap clkr; }; +/* Branch clock common bits for HLOS-owned clocks */ +#define CBCR_FORCE_MEM_CORE_ON BIT(14) +#define CBCR_FORCE_MEM_PERIPH_ON BIT(13) +#define CBCR_FORCE_MEM_PERIPH_OFF BIT(12) + +static inline void qcom_branch_set_force_mem_core (struct regmap *regmap, +struct clk_branch clk,bool on) +{ +regmap_update_bits (regmap, clk.halt_reg,CBCR_FORCE_MEM_CORE_ON , + on ?CBCR_FORCE_MEM_CORE_ON :0 ); +} + +static inline void qcom_branch_set_force_periph_on (struct regmap *regmap, +struct clk_branch clk,bool on) +{ +regmap_update_bits (regmap, clk.halt_reg,CBCR_FORCE_MEM_PERIPH_ON , + on ?CBCR_FORCE_MEM_PERIPH_ON :0 ); +} + +static inline void qcom_branch_set_force_periph_off (struct regmap *regmap, +struct clk_branch clk,bool on) +{ +regmap_update_bits (regmap, clk.halt_reg,CBCR_FORCE_MEM_PERIPH_OFF , + on ?CBCR_FORCE_MEM_PERIPH_OFF :0 ); +} +extern const struct clk_ops clk_branch_ops;extern const struct clk_ops clk_branch2_ops;extern const struct clk_ops clk_branch_simple_ops;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 183/440 clk: qcom: gcc-sc7280: Update force mem core bit for UFS ICE clock
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Taniya Das <[email protected]>
[ Upstream commit f38467b5a920be1473710428a93c4e54b6f8a0c1 ]
Update the force mem core bit for UFS ICE clock to force the core on signal to remain active during halt state of the clk. When retention bit of the clock is set the memories of the subsystem will retain the logic across power states.
--- drivers/clk/qcom/gcc-sc7280.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/clk/qcom/gcc-sc7280.c +3 -0
@@ -3469,6 +3469,9 @@ static int gcc_sc7280_probe(struct platform_device *pdev)regmap_update_bits (regmap,0x71004 ,BIT (0 ),BIT (0 ));regmap_update_bits (regmap,0x7100C ,BIT (13 ),BIT (13 )); +/* FORCE_MEM_CORE_ON for ufs phy ice core clocks */ +qcom_branch_set_force_mem_core (regmap, gcc_ufs_phy_ice_core_clk, true); + ret =qcom_cc_register_rcg_dfs (regmap, gcc_dfs_clocks,ARRAY_SIZE (gcc_dfs_clocks));if (ret)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 184/440 clk: qcom: camcc-sc7280: Add parent dependency to all camera GDSCs
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Taniya Das <[email protected]>
[ Upstream commit 63aec3e4d987fd43237f557460345bca3b51e530 ]
Camera titan top GDSC is a parent supply to all other camera GDSCs. Titan top GDSC is required to be enabled before enabling any other camera GDSCs and it should be disabled only after all other camera GDSCs are disabled. Ensure this behavior by marking titan top GDSC as parent of all other camera GDSCs.
--- drivers/clk/qcom/camcc-sc7280.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/clk/qcom/camcc-sc7280.c +5 -0
@@ -2260,6 +2260,7 @@ static struct gdsc cam_cc_bps_gdsc = { .name = "cam_cc_bps_gdsc", }, .pwrsts = PWRSTS_OFF_ON, + .parent = &cam_cc_titan_top_gdsc.pd, .flags = HW_CTRL | RETAIN_FF_ENABLE, };
@@ -2269,6 +2270,7 @@ static struct gdsc cam_cc_ife_0_gdsc = { .name = "cam_cc_ife_0_gdsc", }, .pwrsts = PWRSTS_OFF_ON, + .parent = &cam_cc_titan_top_gdsc.pd, .flags = RETAIN_FF_ENABLE, };
@@ -2278,6 +2280,7 @@ static struct gdsc cam_cc_ife_1_gdsc = { .name = "cam_cc_ife_1_gdsc", }, .pwrsts = PWRSTS_OFF_ON, + .parent = &cam_cc_titan_top_gdsc.pd, .flags = RETAIN_FF_ENABLE, };
@@ -2287,6 +2290,7 @@ static struct gdsc cam_cc_ife_2_gdsc = { .name = "cam_cc_ife_2_gdsc", }, .pwrsts = PWRSTS_OFF_ON, + .parent = &cam_cc_titan_top_gdsc.pd, .flags = RETAIN_FF_ENABLE, };
@@ -2296,6 +2300,7 @@ static struct gdsc cam_cc_ipe_0_gdsc = { .name = "cam_cc_ipe_0_gdsc", }, .pwrsts = PWRSTS_OFF_ON, + .parent = &cam_cc_titan_top_gdsc.pd, .flags = HW_CTRL | RETAIN_FF_ENABLE, };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 185/440 iio: frequency: adrf6780: rm clk provider include
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antoniu Miclaus <[email protected]>
[ Upstream commit e2261b4a4de2804698935eb44f98dc897e1c44c3 ]
The driver has no clock provider implementation, therefore remove the include.
--- drivers/iio/frequency/adrf6780.c | 1 - 1 file changed, 1 deletion(-)
drivers/iio/frequency/adrf6780.c +0 -1
@@ -9,7 +9,6 @@#include <linux/bits.h> #include <linux/clk.h> #include <linux/clkdev.h> -#include <linux/clk-provider.h> #include <linux/delay.h> #include <linux/device.h> #include <linux/iio/iio.h>
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 186/440 coresight: Fix ref leak when of_coresight_parse_endpoint() fails
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Clark <[email protected]>
[ Upstream commit 7fcb9cb2fe47294e16067c3cfd25332c8662a115 ]
of_graph_get_next_endpoint() releases the reference to the previous endpoint on each iteration, but when parsing fails the loop exits early meaning the last reference is never dropped.
Fix it by dropping the refcount in the exit condition.
--- drivers/hwtracing/coresight/coresight-platform.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hwtracing/coresight/coresight-platform.c +3 -1
@@ -323,8 +323,10 @@ static int of_get_coresight_platform_data(struct device *dev,continue ; ret =of_coresight_parse_endpoint (dev, ep, pdata); -if (ret) +if (ret) { +of_node_put (ep);return ret; + } }return 0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 187/440 RDMA/mlx5: Set mkeys for dmabuf at PAGE_SIZE
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chiara Meiohas <[email protected]>
[ Upstream commit a4e540119be565f47c305f295ed43f8e0bc3f5c3 ]
Set the mkey for dmabuf at PAGE_SIZE to support any SGL after a move operation.
ib_umem_find_best_pgsz returns 0 on error, so it is incorrect to check the returned page_size against PAGE_SIZE
--- drivers/infiniband/hw/mlx5/mlx5_ib.h | 13 +++++++++++++ drivers/infiniband/hw/mlx5/odp.c | 6 ++---- 2 files changed, 15 insertions(+), 4 deletions(-)
drivers/infiniband/hw/mlx5/mlx5_ib.h +13 -0
@@ -109,6 +109,19 @@ unsigned long __mlx5_umem_find_best_quantized_pgoff( __mlx5_bit_sz(typ, page_offset_fld), 0, scale, \ page_offset_quantized) +static inline unsigned long +mlx5_umem_dmabuf_find_best_pgsz (struct ib_umem_dmabuf *umem_dmabuf) +{ +/* +* mkeys used for dmabuf are fixed at PAGE_SIZE because we must be able +* to hold any sgl after a move operation. Ideally the mkc page size +* could be changed at runtime to be optimal, but right now the driver +* cannot do that. +*/ +return ib_umem_find_best_pgsz (&umem_dmabuf->umem,PAGE_SIZE , + umem_dmabuf->umem.iova); +} +enum {MLX5_IB_MMAP_OFFSET_START =9 ,MLX5_IB_MMAP_OFFSET_END =255 ,
drivers/infiniband/hw/mlx5/odp.c +2 -4
@@ -706,10 +706,8 @@ static int pagefault_dmabuf_mr(struct mlx5_ib_mr *mr, size_t bcnt,return err; } - page_size =mlx5_umem_find_best_pgsz (&umem_dmabuf->umem, mkc, - log_page_size,0 , - umem_dmabuf->umem.iova); -if (unlikely (page_size <PAGE_SIZE )) { + page_size =mlx5_umem_dmabuf_find_best_pgsz (umem_dmabuf); +if (!page_size) {ib_umem_dmabuf_unmap_pages (umem_dmabuf); err = -EINVAL ; }else {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 188/440 powerpc/pseries: Fix alignment of PLPKS structures and buffers
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Donnellan <[email protected]>
[ Upstream commit fcf63d6b8ab9b12c2ce1b4bde12a3c391029c998 ]
A number of structures and buffers passed to PKS hcalls have alignment requirements, which could on occasion cause problems:
- Authorisation structures must be 16-byte aligned and must not cross a page boundary
- Label structures must not cross page boundaries
- Password output buffers must not cross page boundaries
To ensure correct alignment, we adjust the allocation size of each of these structures/buffers to be the closest power of 2 that is at least the size of the structure/buffer (since kmalloc() guarantees that an allocation of a power of 2 size will be aligned to at least that size).
Stable-dep-of: 932bed412170 ("powerpc/kexec_file: fix cpus node update to FDT")
--- arch/powerpc/platforms/pseries/plpks.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
arch/powerpc/platforms/pseries/plpks.c +7 -3
@@ -113,7 +113,8 @@ static int plpks_gen_password(void)u8 *password, consumer =PLPKS_OS_OWNER ;int rc; - password =kzalloc (maxpwsize,GFP_KERNEL ); +// The password must not cross a page boundary, so we align to the next power of 2 + password =kzalloc (roundup_pow_of_two (maxpwsize),GFP_KERNEL );if (!password)return -ENOMEM ;
@@ -149,7 +150,9 @@ static struct plpks_auth *construct_auth(u8 consumer)if (consumer >PLPKS_OS_OWNER )return ERR_PTR (-EINVAL ); - auth =kzalloc (struct_size (auth, password, maxpwsize),GFP_KERNEL ); +// The auth structure must not cross a page boundary and must be +// 16 byte aligned. We align to the next largest power of 2 + auth =kzalloc (roundup_pow_of_two (struct_size (auth, password, maxpwsize)),GFP_KERNEL );if (!auth)return ERR_PTR (-ENOMEM );
@@ -183,7 +186,8 @@ static struct label *construct_label(char *component, u8 varos, u8 *name,if (component && slen >sizeof (label->attr.prefix))return ERR_PTR (-EINVAL ); - label =kzalloc (sizeof (*label),GFP_KERNEL ); +// The label structure must not cross a page boundary, so we align to the next power of 2 + label =kzalloc (roundup_pow_of_two (sizeof (*label)),GFP_KERNEL );if (!label)return ERR_PTR (-ENOMEM );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 189/440 powerpc/pseries: Move plpks.h to include directory
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell Currey <[email protected]>
[ Upstream commit 90b74e305d6b5a444b1283dd7ad1caf6acaa0340 ]
Move plpks.h from platforms/pseries/ to include/asm/. This is necessary for later patches to make use of the PLPKS from code in other subsystems.
Stable-dep-of: 932bed412170 ("powerpc/kexec_file: fix cpus node update to FDT")
---
.../powerpc/{platforms/pseries => include/asm}/plpks.h | 10 +++++++---
arch/powerpc/platforms/pseries/plpks.c | 3 +--
2 files changed, 8 insertions(+), 5 deletions(-)
rename arch/powerpc/{platforms/pseries => include/asm}/plpks.h (94%)arch/powerpc/include/asm/plpks.h renamed from arch/powerpc/platforms/pseries/plpks.h +7 -3
@@ -6,8 +6,10 @@* Platform keystore for pseries LPAR(PLPKS). */ -#ifndef _PSERIES_PLPKS_H -#define _PSERIES_PLPKS_H +#ifndef _ASM_POWERPC_PLPKS_H +#define _ASM_POWERPC_PLPKS_H + +#ifdef CONFIG_PSERIES_PLPKS #include <linux/types.h> #include <linux/list.h>
@@ -93,4 +95,6 @@ int plpks_read_fw_var(struct plpks_var *var);*/ int plpks_read_bootloader_var (struct plpks_var *var); -#endif +#endif // CONFIG_PSERIES_PLPKS + +#endif // _ASM_POWERPC_PLPKS_H
arch/powerpc/platforms/pseries/plpks.c +1 -2
@@ -18,8 +18,7 @@#include <linux/types.h> #include <asm/hvcall.h> #include <asm/machdep.h> - -#include "plpks.h" +#include <asm/plpks.h> static u8 *ospassword;static u16 ospasswordlength;
Signature · 1 line
2.43.0
Re: [PATCH 6.1 189/440] powerpc/pseries: Move plpks.h to include directory
Quoted 11 lines · Greg Kroah-Hartman
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell Currey <[email protected]>
[ Upstream commit
90b74e305d6b5a444b1283dd7ad1caf6acaa0340]Move
plpks.hfrom platforms/pseries/ toinclude/asm/. This is necessary for later patches to make use of the PLPKS from code in other subsystems.
Quoted 6 lines
Signed-off-by Russell Currey <[email protected]>Signed-off-by Andrew Donnellan <[email protected]>Reviewed-by Stefan Berger <[email protected]>Signed-off-by Michael Ellerman <[email protected]>Stable-dep-of:
932bed412170("powerpc/kexec_file: fix cpus node update to FDT")
I don't see why this is a stable-dep of that commit?
0857beff9c1e and 932bed412170 apply with some fuzz, but otherwise seem fine, and build OK for me here (only tested a few configs).
I'm not sure about backporting these plpks commits without some further testing.
cheers
Quoted 51 lines
Signed-off-by Sasha Levin <[email protected]>--- .../powerpc/{platforms/pseries => include/asm}/plpks.h | 10 +++++++--- arch/powerpc/platforms/pseries/plpks.c | 3 +-- 2 files changed, 8 insertions(+), 5 deletions(-) rename arch/powerpc/{platforms/pseries => include/asm}/plpks.h (94%)arch/powerpc/include/asm/plpks.h renamed from arch/powerpc/platforms/pseries/plpks.h +7
-3@@ -6,8 +6,10 @@* Platform keystore for pseries LPAR(PLPKS). */ -#ifndef _PSERIES_PLPKS_H -#define _PSERIES_PLPKS_H +#ifndef _ASM_POWERPC_PLPKS_H +#define _ASM_POWERPC_PLPKS_H + +#ifdef CONFIG_PSERIES_PLPKS #include <linux/types.h> #include <linux/list.h> @@ -93,4 +95,6 @@ int plpks_read_fw_var(struct plpks_var *var);*/ int plpks_read_bootloader_var (struct plpks_var *var); -#endif +#endif // CONFIG_PSERIES_PLPKS + +#endif // _ASM_POWERPC_PLPKS_H arch/powerpc/platforms/pseries/plpks.c +1
-2@@ -18,8 +18,7 @@#include <linux/types.h> #include <asm/hvcall.h> #include <asm/machdep.h> - -#include "plpks.h" +#include <asm/plpks.h> static u8 *ospassword;static u16 ospasswordlength;Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 190/440 powerpc/pseries: Expose PLPKS config values, support additional fields
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nayna Jain <[email protected]>
[ Upstream commit 119da30d037dced29118fb90afe683ff50313386 ]
The plpks driver uses the H_PKS_GET_CONFIG hcall to retrieve configuration and status information about the PKS from the hypervisor.
Update _plpks_get_config() to handle some additional fields. Add getter functions to allow the PKS configuration information to be accessed from other files. Validate that the values we're getting comply with the spec.
While we're here, move the config struct in _plpks_get_config() off the stack - it's getting large and we also need to make sure it doesn't cross a page boundary.
Stable-dep-of: 932bed412170 ("powerpc/kexec_file: fix cpus node update to FDT")
--- arch/powerpc/include/asm/plpks.h | 58 ++++++++++ arch/powerpc/platforms/pseries/plpks.c | 149 +++++++++++++++++++++++-- 2 files changed, 195 insertions(+), 12 deletions(-)
arch/powerpc/include/asm/plpks.h +58 -0
@@ -95,6 +95,64 @@ int plpks_read_fw_var(struct plpks_var *var);*/ int plpks_read_bootloader_var (struct plpks_var *var); +/** +* Returns if PKS is available on this LPAR. +*/ +bool plpks_is_available (void ); + +/** +* Returns version of the Platform KeyStore. +*/ +u8 plpks_get_version (void ); + +/** +* Returns hypervisor storage overhead per object, not including the size of +* the object or label. Only valid for config version >= 2 +*/ +u16 plpks_get_objoverhead (void ); + +/** +* Returns maximum password size. Must be >= 32 bytes +*/ +u16 plpks_get_maxpwsize (void ); + +/** +* Returns maximum object size supported by Platform KeyStore. +*/ +u16 plpks_get_maxobjectsize (void ); + +/** +* Returns maximum object label size supported by Platform KeyStore. +*/ +u16 plpks_get_maxobjectlabelsize (void ); + +/** +* Returns total size of the configured Platform KeyStore. +*/ +u32 plpks_get_totalsize (void ); + +/** +* Returns used space from the total size of the Platform KeyStore. +*/ +u32 plpks_get_usedspace (void ); + +/** +* Returns bitmask of policies supported by the hypervisor. +*/ +u32 plpks_get_supportedpolicies (void ); + +/** +* Returns maximum byte size of a single object supported by the hypervisor. +* Only valid for config version >= 3 +*/ +u32 plpks_get_maxlargeobjectsize (void ); + +/** +* Returns bitmask of signature algorithms supported for signed updates. +* Only valid for config version >= 3 +*/ +u64 plpks_get_signedupdatealgorithms (void ); +#endif // CONFIG_PSERIES_PLPKS #endif // _ASM_POWERPC_PLPKS_H
arch/powerpc/platforms/pseries/plpks.c +137 -12
177 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 191/440 powerpc/pseries: Add helper to get PLPKS password length
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell Currey <[email protected]>
[ Upstream commit 9ee76bd5c7e39b622660cc14833ead1967f2038d ]
Add helper function to get the PLPKS password length. This will be used in a later patch to support passing the password between kernels over kexec.
Stable-dep-of: 932bed412170 ("powerpc/kexec_file: fix cpus node update to FDT")
--- arch/powerpc/include/asm/plpks.h | 5 +++++ arch/powerpc/platforms/pseries/plpks.c | 5 +++++ 2 files changed, 10 insertions(+)
arch/powerpc/include/asm/plpks.h +5 -0
@@ -153,6 +153,11 @@ u32 plpks_get_maxlargeobjectsize(void);*/ u64 plpks_get_signedupdatealgorithms (void ); +/** +* Returns the length of the PLPKS password in bytes. +*/ +u16 plpks_get_passwordlen (void ); +#endif // CONFIG_PSERIES_PLPKS #endif // _ASM_POWERPC_PLPKS_H
arch/powerpc/platforms/pseries/plpks.c +5 -0
@@ -348,6 +348,11 @@ u64 plpks_get_signedupdatealgorithms(void)return signedupdatealgorithms; } +u16 plpks_get_passwordlen (void ) +{ +return ospasswordlength; +} +bool plpks_is_available (void ) {int rc;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 192/440 powerpc/kexec: make the update_cpus_node() function public
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sourabh Jain <[email protected]>
[ Upstream commit 0857beff9c1ec8bb421a8b7a721da0f34cc886c0 ]
Move the update_cpus_node() from kexec/{file_load_64.c => core_64.c} to allow other kexec components to use it.
Later in the series, this function is used for in-kernel updates to the kdump image during CPU/memory hotplug or online/offline events for both kexec_load and kexec_file_load syscalls.
No functional changes are intended.
Stable-dep-of: 932bed412170 ("powerpc/kexec_file: fix cpus node update to FDT")
--- arch/powerpc/include/asm/kexec.h | 4 ++ arch/powerpc/kexec/core_64.c | 91 +++++++++++++++++++++++++++++++ arch/powerpc/kexec/file_load_64.c | 87 ----------------------------- 3 files changed, 95 insertions(+), 87 deletions(-)
arch/powerpc/include/asm/kexec.h +4 -0
@@ -181,6 +181,10 @@ static inline void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *))#endif /* CONFIG_KEXEC_CORE */ +#if defined(CONFIG_KEXEC_FILE ) || defined(CONFIG_CRASH_DUMP ) +int update_cpus_node (void *fdt); +#endif +#ifdef CONFIG_PPC_BOOK3S_64 #include <asm/book3s/64/kexec.h> #endif
arch/powerpc/kexec/core_64.c +91 -0
106 lines not on this page · raw message
arch/powerpc/kexec/file_load_64.c +0 -87
93 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 193/440 powerpc/kexec_file: fix cpus node update to FDT
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sourabh Jain <[email protected]>
[ Upstream commit 932bed41217059638c78a75411b7893b121d2162 ]
While updating the cpus node, commit 40c753993e3a ("powerpc/kexec_file:
Use current CPU info while setting up FDT") first deletes all subnodes
under the /cpus node. However, while adding sub-nodes back, it missed adding cpus subnodes whose device_type != "cpu", such as l2-cache*, l3-cache*, ibm,powerpc-cpu-features.
Fix this by only deleting cpus sub-nodes of device_type == "cpus" and then adding all available nodes with device_type == "cpu".
--- arch/powerpc/kexec/core_64.c | 53 +++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 16 deletions(-)
arch/powerpc/kexec/core_64.c +37 -16
@@ -468,9 +468,15 @@ static int add_node_props(void *fdt, int node_offset, const struct device_node ** @fdt: Flattened device tree of the kernel. * * Returns 0 on success, negative errno on error. +* +* Note: expecting no subnodes under /cpus/<node> with device_type == "cpu". +* If this changes, update this function to include them. */ int update_cpus_node (void *fdt) { +int prev_node_offset; +const char *device_type; +const struct fdt_property *prop;struct device_node *cpus_node, *dn;int cpus_offset, cpus_subnode_offset, ret =0 ;
@@ -481,30 +487,44 @@ int update_cpus_node(void *fdt)return cpus_offset; } -if (cpus_offset >0 ) { - ret =fdt_del_node (fdt, cpus_offset); + prev_node_offset = cpus_offset; +/* Delete sub-nodes of /cpus node with device_type == "cpu" */ +for (cpus_subnode_offset =fdt_first_subnode (fdt, cpus_offset); cpus_subnode_offset >=0 ;) { +/* Ignore nodes that do not have a device_type property or device_type != "cpu" */ + prop =fdt_get_property (fdt, cpus_subnode_offset,"device_type" ,NULL ); +if (!prop ||strcmp (prop->data,"cpu" )) { + prev_node_offset = cpus_subnode_offset; + goto next_node; + } + + ret =fdt_del_node (fdt, cpus_subnode_offset);if (ret <0 ) { -pr_err ("Error deleting /cpus node: %s\n" ,fdt_strerror (ret)); -return -EINVAL ; +pr_err ("Failed to delete a cpus sub-node: %s\n" ,fdt_strerror (ret)); +return ret; } +next_node: +if (prev_node_offset == cpus_offset) + cpus_subnode_offset =fdt_first_subnode (fdt, cpus_offset); +else + cpus_subnode_offset =fdt_next_subnode (fdt, prev_node_offset); } -/* Add cpus node to fdt */ - cpus_offset =fdt_add_subnode (fdt,fdt_path_offset (fdt,"/" ),"cpus" ); -if (cpus_offset <0 ) { -pr_err ("Error creating /cpus node: %s\n" ,fdt_strerror (cpus_offset)); + cpus_node =of_find_node_by_path ("/cpus" ); +/* Fail here to avoid kexec/kdump kernel boot hung */ +if (!cpus_node) { +pr_err ("No /cpus node found\n" );return -EINVAL ; } -/* Add cpus node properties */ - cpus_node =of_find_node_by_path ("/cpus" ); - ret =add_node_props (fdt, cpus_offset, cpus_node); -of_node_put (cpus_node); -if (ret <0 ) -return ret; +/* Add all /cpus sub-nodes of device_type == "cpu" to FDT */ +for_each_child_of_node (cpus_node, dn) { +/* Ignore device nodes that do not have a device_type property +* or device_type != "cpu". +*/ + device_type =of_get_property (dn,"device_type" ,NULL ); +if (!device_type ||strcmp (device_type,"cpu" )) +continue ; -/* Loop through all subnodes of cpus and add them to fdt */ -for_each_node_by_type (dn,"cpu" ) { cpus_subnode_offset =fdt_add_subnode (fdt, cpus_offset, dn->full_name);if (cpus_subnode_offset <0 ) { pr_err("Unable to add %s subnode: %s\n", dn->full_name,
@@ -518,6 +538,7 @@ int update_cpus_node(void *fdt) goto out; } out: +of_node_put (cpus_node);of_node_put (dn);return ret; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 194/440 RDMA/cache: Release GID table even if leak is detected
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leon Romanovsky <[email protected]>
[ Upstream commit a92fbeac7e94a420b55570c10fe1b90e64da4025 ]
When the table is released, we nullify pointer to GID table, it means that in case GID entry leak is detected, we will leak table too.
Delete code that prevents table destruction.
--- drivers/infiniband/core/cache.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/infiniband/core/cache.c +5 -9
@@ -794,7 +794,6 @@ static struct ib_gid_table *alloc_gid_table(int sz)static void release_gid_table (struct ib_device *device,struct ib_gid_table *table) { -bool leak = false;int i;if (!table)
@@ -803,15 +802,12 @@ static void release_gid_table(struct ib_device *device,for (i =0 ; i < table->sz; i++) {if (is_gid_entry_free (table->data_vec[i]))continue ; -if (kref_read (&table->data_vec[i]->kref) >1 ) { -dev_err (&device->dev, -"GID entry ref leak for index %d ref=%u\n" , i, -kref_read (&table->data_vec[i]->kref)); - leak = true; - } + +WARN_ONCE (true, +"GID entry ref leak for dev %s index %d ref=%u\n" , +dev_name (&device->dev), i, +kref_read (&table->data_vec[i]->kref)); } -if (leak) -return ;mutex_destroy (&table->lock);kfree (table->data_vec);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 195/440 clk: qcom: gpucc-sm8350: Park RCGs clk source at XO during disable
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Taniya Das <[email protected]>
[ Upstream commit 313e2909023bef36ef7b6d1d9ff2d98febcaa28d ]
The RCG's clk src has to be parked at XO while disabling as per the HW recommendation, hence use clk_rcg2_shared_ops to achieve the same.
--- drivers/clk/qcom/gpucc-sm8350.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/clk/qcom/gpucc-sm8350.c +3 -2
@@ -2,6 +2,7 @@/* * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. * Copyright (c) 2022, Linaro Limited +* Copyright (c) 2024, Qualcomm Innovation Center, Inc. All rights reserved. */ #include <linux/clk.h>
@@ -147,7 +148,7 @@ static struct clk_rcg2 gpu_cc_gmu_clk_src = { .parent_data = gpu_cc_parent_data_0, .num_parents = ARRAY_SIZE(gpu_cc_parent_data_0), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
@@ -169,7 +170,7 @@ static struct clk_rcg2 gpu_cc_hub_clk_src = { .parent_data = gpu_cc_parent_data_1, .num_parents = ARRAY_SIZE(gpu_cc_parent_data_1), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 196/440 interconnect: qcom: qcm2290: Fix mas_snoc_bimc RPM master ID
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit cd5ce4589081190281cc2537301edd4275fe55eb ]
The value was wrong, resulting in misprogramming of the hardware. Fix it.
--- drivers/interconnect/qcom/qcm2290.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/interconnect/qcom/qcm2290.c +1 -1
@@ -166,7 +166,7 @@ static struct qcom_icc_node mas_snoc_bimc = { .qos.ap_owned = true, .qos.qos_port = 6, .qos.qos_mode = NOC_QOS_MODE_BYPASS, - .mas_rpm_id = 164, + .mas_rpm_id = 3, .slv_rpm_id = -1, .num_links = ARRAY_SIZE(mas_snoc_bimc_links), .links = mas_snoc_bimc_links,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 197/440 Input: qt1050 - handle CHIP_ID reading error
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrei Lalaev <[email protected]>
[ Upstream commit 866a5c7e2781cf1b019072288f1f5c64186dcb63 ]
If the device is missing, we get the following error:
qt1050 3-0041: ID -1340767592 not supported
Let's handle this situation and print more informative error when reading of CHIP_ID fails:
qt1050 3-0041: Failed to read chip ID: -6
--- drivers/input/keyboard/qt1050.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/input/keyboard/qt1050.c +6 -1
@@ -226,7 +226,12 @@ static bool qt1050_identify(struct qt1050_priv *ts)int err;/* Read Chip ID */ -regmap_read (ts->regmap,QT1050_CHIP_ID , &val); + err =regmap_read (ts->regmap,QT1050_CHIP_ID , &val); +if (err) { +dev_err (&ts->client->dev,"Failed to read chip ID: %d\n" , err); +return false; + } +if (val !=QT1050_CHIP_ID_VER ) {dev_err (&ts->client->dev,"ID %d not supported\n" , val);return false;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 198/440 RDMA/mlx4: Fix truncated output warning in mad.c
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leon Romanovsky <[email protected]>
[ Upstream commit 0d2e6992fc956e3308cd5376c18567def4cb3967 ]
Increase size of the name array to avoid truncated output warning.
drivers/infiniband/hw/mlx4/mad.c: In function ‘mlx4_ib_alloc_demux_ctx’:drivers/infiniband/hw/mlx4/mad.c:2197:47: error: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size 4 [-Werror=format-truncation=]
2197 | snprintf(name, sizeof(name), "mlx4_ibt%d", port);
| ^~drivers/infiniband/hw/mlx4/mad.c:2197:38: note: directive argument in the range [-2147483645, 2147483647]
2197 | snprintf(name, sizeof(name), "mlx4_ibt%d", port);
| ^~~~~~~~~~~~
drivers/infiniband/hw/mlx4/mad.c:2197:9: note: ‘snprintf’ output between
10 and 20 bytes into a destination of size 12
2197 | snprintf(name, sizeof(name), "mlx4_ibt%d", port);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~drivers/infiniband/hw/mlx4/mad.c:2205:48: error: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size 3 [-Werror=format-truncation=]
2205 | snprintf(name, sizeof(name), "mlx4_ibwi%d", port);
| ^~drivers/infiniband/hw/mlx4/mad.c:2205:38: note: directive argument in the range [-2147483645, 2147483647]
2205 | snprintf(name, sizeof(name), "mlx4_ibwi%d", port);
| ^~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/mad.c:2205:9: note: ‘snprintf’ output between
11 and 21 bytes into a destination of size 12
2205 | snprintf(name, sizeof(name), "mlx4_ibwi%d", port);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~drivers/infiniband/hw/mlx4/mad.c:2213:48: error: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size 3 [-Werror=format-truncation=]
2213 | snprintf(name, sizeof(name), "mlx4_ibud%d", port);
| ^~drivers/infiniband/hw/mlx4/mad.c:2213:38: note: directive argument in the range [-2147483645, 2147483647]
2213 | snprintf(name, sizeof(name), "mlx4_ibud%d", port);
| ^~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/mad.c:2213:9: note: ‘snprintf’ output between
11 and 21 bytes into a destination of size 12
2213 | snprintf(name, sizeof(name), "mlx4_ibud%d", port);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~cc1: all warnings being treated as errors
make[6]: *** [scripts/Makefile.build:244: drivers/infiniband/hw/mlx4/mad.o] Error 1
--- drivers/infiniband/hw/mlx4/mad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mlx4/mad.c +1 -1
@@ -2158,7 +2158,7 @@ static int mlx4_ib_alloc_demux_ctx(struct mlx4_ib_dev *dev,struct mlx4_ib_demux_ctx *ctx, int port) { - char name[12]; + char name[21];int ret =0 ;int i;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 199/440 RDMA/mlx4: Fix truncated output warning in alias_GUID.c
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leon Romanovsky <[email protected]>
[ Upstream commit 5953e0647cec703ef436ead37fed48943507b433 ]
drivers/infiniband/hw/mlx4/alias_GUID.c: In function ‘mlx4_ib_init_alias_guid_service’:drivers/infiniband/hw/mlx4/alias_GUID.c:878:74: error: ‘%d’ directive
output may be truncated writing between 1 and 11 bytes into a region of
size 5 [-Werror=format-truncation=]
878 | snprintf(alias_wq_name, sizeof alias_wq_name, "alias_guid%d", i);
| ^~drivers/infiniband/hw/mlx4/alias_GUID.c:878:63: note: directive argument in the range [-2147483641, 2147483646]
878 | snprintf(alias_wq_name, sizeof alias_wq_name, "alias_guid%d", i);
| ^~~~~~~~~~~~~~drivers/infiniband/hw/mlx4/alias_GUID.c:878:17: note: ‘snprintf’ output
between 12 and 22 bytes into a destination of size 15
878 | snprintf(alias_wq_name, sizeof alias_wq_name, "alias_guid%d", i);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~cc1: all warnings being treated as errors
--- drivers/infiniband/hw/mlx4/alias_GUID.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mlx4/alias_GUID.c +1 -1
@@ -829,7 +829,7 @@ void mlx4_ib_destroy_alias_guid_service(struct mlx4_ib_dev *dev)int mlx4_ib_init_alias_guid_service (struct mlx4_ib_dev *dev) { -char alias_wq_name[15 ]; +char alias_wq_name[22 ];int ret =0 ;int i, j;union ib_gid gid;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 200/440 RDMA/mlx5: Use sq timestamp as QP timestamp when RoCE is disabled
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Or Har-Toov <[email protected]>
[ Upstream commit 0c5275bf75ec3708d95654195ae4ed80d946d088 ]
When creating a QP, one of the attributes is TS format (timestamp). In some devices, we have a limitation that all QPs should have the same ts_format. The ts_format is chosen based on the device's capability. The qp_ts_format cap resides under the RoCE caps table, and the cap will be 0 when RoCE is disabled. So when RoCE is disabled, the value that should be queried is sq_ts_format under HCA caps.
Consider the case when the system supports REAL_TIME_TS format (0x2), some QPs are created with REAL_TIME_TS as ts_format, and afterwards RoCE gets disabled. When trying to construct a new QP, we can't use the qp_ts_format, that is queried from the RoCE caps table, Since it leads to passing 0x0 (FREE_RUNNING_TS) as the value of the qp_ts_format, which is different than the ts_format of the previously allocated QPs REAL_TIME_TS format (0x2).
Thus, to resolve this, read the sq_ts_format, which also reflect the supported ts format for the QP when RoCE is disabled.
--- include/linux/mlx5/qp.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
include/linux/mlx5/qp.h +6 -3
@@ -566,9 +566,12 @@ static inline const char *mlx5_qp_state_str(int state)static inline int mlx5_get_qp_default_ts (struct mlx5_core_dev *dev) { -return !MLX5_CAP_ROCE (dev, qp_ts_format) ? -MLX5_TIMESTAMP_FORMAT_FREE_RUNNING : -MLX5_TIMESTAMP_FORMAT_DEFAULT ; +u8 supported_ts_cap =mlx5_get_roce_state (dev) ? +MLX5_CAP_ROCE (dev, qp_ts_format) : +MLX5_CAP_GEN (dev, sq_ts_format); + +return supported_ts_cap ?MLX5_TIMESTAMP_FORMAT_DEFAULT : +MLX5_TIMESTAMP_FORMAT_FREE_RUNNING ; }#endif /* MLX5_QP_H */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 201/440 RDMA/rxe: Dont set BTH_ACK_MASK for UC or UD QPs
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Honggang LI <[email protected]>
[ Upstream commit 4adcaf969d77d3d3aa3871bbadc196258a38aec6 ]
BTH_ACK_MASK bit is used to indicate that an acknowledge (for this packet) should be scheduled by the responder. Both UC and UD QPs are unacknowledged, so don't set BTH_ACK_MASK for UC or UD QPs.
--- drivers/infiniband/sw/rxe/rxe_req.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/infiniband/sw/rxe/rxe_req.c +4 -3
@@ -390,7 +390,7 @@ static struct sk_buff *init_req_packet(struct rxe_qp *qp,int paylen;int solicited;u32 qp_num; -int ack_req; +int ack_req =0 ;/* length from start of bth to end of icrc */ paylen = rxe_opcode[opcode].length + payload + pad +RXE_ICRC_SIZE ;
@@ -411,8 +411,9 @@ static struct sk_buff *init_req_packet(struct rxe_qp *qp, qp_num = (pkt->mask &RXE_DETH_MASK ) ? ibwr->wr.ud.remote_qpn : qp->attr.dest_qp_num; - ack_req = ((pkt->mask &RXE_END_MASK ) || - (qp->req.noack_pkts++ >RXE_MAX_PKT_PER_ACK )); +if (qp_type (qp) !=IB_QPT_UD &&qp_type (qp) !=IB_QPT_UC ) + ack_req = ((pkt->mask &RXE_END_MASK ) || + (qp->req.noack_pkts++ >RXE_MAX_PKT_PER_ACK ));if (ack_req) qp->req.noack_pkts =0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 202/440 ASoC: qcom: Adjust issues in case of DT error in asoc_qcom_lpass_cpu_platform_probe()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Mishin <[email protected]>
[ Upstream commit f9f7f29f64454bb20896c7d918c3abc3a1aa487b ]
If IORESOURCE_MEM "lpass-rxtx-cdc-dma-lpm" or "lpass-va-cdc-dma-lpm" resources is not provided in Device Tree due to any error, platform_get_resource_byname() will return NULL which is later dereferenced. According to sound/qcom,lpass-cpu.yaml, these resources are provided, but DT can be broken due to any error. In such cases driver must be able to protect itself, since the DT is external data for the driver.
Adjust this issues by adding NULL return check.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- sound/soc/qcom/lpass-cpu.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/soc/qcom/lpass-cpu.c +4 -0
@@ -1160,9 +1160,13 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev) } res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"lpass-rxtx-cdc-dma-lpm" ); +if (!res) +return -EINVAL ; drvdata->rxtx_cdc_dma_lpm_buf = res->start; res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"lpass-va-cdc-dma-lpm" ); +if (!res) +return -EINVAL ; drvdata->va_cdc_dma_lpm_buf = res->start; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 203/440 powerpc/prom: Add CPU info to hardware description string later
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Lynch <[email protected]>
[ Upstream commit 7bdd1c6c87de758750d419eedab7285b95b66417 ]
cur_cpu_spec->cpu_name is appended to ppc_hw_desc before cur_cpu_spec has taken on its final value. This is illustrated on pseries by comparing the CPU name as reported at boot ("POWER8E (raw)") to the contents of /proc/cpuinfo ("POWER8 (architected)"):
$ dmesg | grep Hardware
Hardware name: IBM,8408-E8E POWER8E (raw) 0x4b0201 0xf000004 \
of:IBM,FW860.50 (SV860_146) hv:phyp pSeries$ grep -m 1 ^cpu /proc/cpuinfo cpu : POWER8 (architected), altivec supported
Some 44x models would appear to be affected as well; see identical_pvr_fixup().
This results in incorrect CPU information in stack dumps -- ppc_hw_desc is an input to dump_stack_set_arch_desc().
Delay gathering the CPU name until after all potential calls to identify_cpu().
--- arch/powerpc/kernel/prom.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
arch/powerpc/kernel/prom.c +8 -4
@@ -324,6 +324,7 @@ static int __init early_init_dt_scan_cpus(unsigned long node, void *data) {const char *type =of_get_flat_dt_prop (node,"device_type" ,NULL ); +const __be32 *cpu_version =NULL ;const __be32 *prop;const __be32 *intserv;int i, nthreads;
@@ -404,7 +405,7 @@ static int __init early_init_dt_scan_cpus(unsigned long node, prop =of_get_flat_dt_prop (node,"cpu-version" ,NULL );if (prop && (be32_to_cpup (prop) &0xff000000 ) ==0x0f000000 ) {identify_cpu (0 ,be32_to_cpup (prop)); -seq_buf_printf (&ppc_hw_desc,"0x%04x " ,be32_to_cpup (prop)); + cpu_version = prop; }check_cpu_feature_properties (node);
@@ -415,6 +416,12 @@ static int __init early_init_dt_scan_cpus(unsigned long node, }identical_pvr_fixup (node); + +// We can now add the CPU name & PVR to the hardware description +seq_buf_printf (&ppc_hw_desc,"%s 0x%04lx " , cur_cpu_spec->cpu_name,mfspr (SPRN_PVR )); +if (cpu_version) +seq_buf_printf (&ppc_hw_desc,"0x%04x " ,be32_to_cpup (cpu_version)); +init_mmu_slb_size (node);#ifdef CONFIG_PPC64
@@ -852,9 +859,6 @@ void __init early_init_devtree(void *params)dt_cpu_ftrs_scan (); -// We can now add the CPU name & PVR to the hardware description -seq_buf_printf (&ppc_hw_desc,"%s 0x%04lx " , cur_cpu_spec->cpu_name,mfspr (SPRN_PVR )); -/* Retrieve CPU related informations from the flat tree * (altivec support, boot CPU ID, ...) */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 204/440 ASoC: max98088: Check for clk_prepare_enable() error
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ni <[email protected]>
[ Upstream commit 1a70579723fde3624a72dfea6e79e55be6e36659 ]
clk_prepare_enable() may fail, so we should better check its return value and propagate it in the case of error.
--- sound/soc/codecs/max98088.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
sound/soc/codecs/max98088.c +7 -3
@@ -1318,6 +1318,7 @@ static int max98088_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) {struct max98088_priv *max98088 =snd_soc_component_get_drvdata (component); +int ret;switch (level) {case SND_SOC_BIAS_ON :
@@ -1333,10 +1334,13 @@ static int max98088_set_bias_level(struct snd_soc_component *component,*/ if (!IS_ERR (max98088->mclk)) {if (snd_soc_component_get_bias_level (component) == -SND_SOC_BIAS_ON ) +SND_SOC_BIAS_ON ) {clk_disable_unprepare (max98088->mclk); -else -clk_prepare_enable (max98088->mclk); + }else { + ret =clk_prepare_enable (max98088->mclk); +if (ret) +return ret; + } }break ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 205/440 mtd: make mtd_test.c a separate module
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit a5cf054d325e6f362e82fe6d124a1871a4af8174 ]
This file gets linked into nine different modules, which causes a warning:
scripts/Makefile.build:236: drivers/mtd/tests/Makefile: mtd_test.o is added to multiple modules: mtd_nandbiterrs mtd_oobtest mtd_pagetest mtd_readtest mtd_speedtest mtd_stresstest mtd_subpagetest mtd_torturetest
Make it a separate module instead.
--- drivers/mtd/tests/Makefile | 34 +++++++++++++++++----------------- drivers/mtd/tests/mtd_test.c | 9 +++++++++ 2 files changed, 26 insertions(+), 17 deletions(-)
drivers/mtd/tests/Makefile +17 -17
@@ -1,19 +1,19 @@ # SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_MTD_TESTS) += mtd_oobtest.o -obj-$(CONFIG_MTD_TESTS) += mtd_pagetest.o -obj-$(CONFIG_MTD_TESTS) += mtd_readtest.o -obj-$(CONFIG_MTD_TESTS) += mtd_speedtest.o -obj-$(CONFIG_MTD_TESTS) += mtd_stresstest.o -obj-$(CONFIG_MTD_TESTS) += mtd_subpagetest.o -obj-$(CONFIG_MTD_TESTS) += mtd_torturetest.o -obj-$(CONFIG_MTD_TESTS) += mtd_nandecctest.o -obj-$(CONFIG_MTD_TESTS) += mtd_nandbiterrs.o +obj-$(CONFIG_MTD_TESTS) += mtd_oobtest.o mtd_test.o +obj-$(CONFIG_MTD_TESTS) += mtd_pagetest.o mtd_test.o +obj-$(CONFIG_MTD_TESTS) += mtd_readtest.o mtd_test.o +obj-$(CONFIG_MTD_TESTS) += mtd_speedtest.o mtd_test.o +obj-$(CONFIG_MTD_TESTS) += mtd_stresstest.o mtd_test.o +obj-$(CONFIG_MTD_TESTS) += mtd_subpagetest.o mtd_test.o +obj-$(CONFIG_MTD_TESTS) += mtd_torturetest.o mtd_test.o +obj-$(CONFIG_MTD_TESTS) += mtd_nandecctest.o mtd_test.o +obj-$(CONFIG_MTD_TESTS) += mtd_nandbiterrs.o mtd_test.o -mtd_oobtest-objs := oobtest.o mtd_test.o -mtd_pagetest-objs := pagetest.o mtd_test.o -mtd_readtest-objs := readtest.o mtd_test.o -mtd_speedtest-objs := speedtest.o mtd_test.o -mtd_stresstest-objs := stresstest.o mtd_test.o -mtd_subpagetest-objs := subpagetest.o mtd_test.o -mtd_torturetest-objs := torturetest.o mtd_test.o -mtd_nandbiterrs-objs := nandbiterrs.o mtd_test.o +mtd_oobtest-objs := oobtest.o +mtd_pagetest-objs := pagetest.o +mtd_readtest-objs := readtest.o +mtd_speedtest-objs := speedtest.o +mtd_stresstest-objs := stresstest.o +mtd_subpagetest-objs := subpagetest.o +mtd_torturetest-objs := torturetest.o +mtd_nandbiterrs-objs := nandbiterrs.o
drivers/mtd/tests/mtd_test.c +9 -0
@@ -25,6 +25,7 @@ int mtdtest_erase_eraseblock(struct mtd_info *mtd, unsigned int ebnum)return 0 ; } +EXPORT_SYMBOL_GPL (mtdtest_erase_eraseblock);static int is_block_bad (struct mtd_info *mtd,unsigned int ebnum) {
@@ -57,6 +58,7 @@ int mtdtest_scan_for_bad_eraseblocks(struct mtd_info *mtd, unsigned char *bbt,return 0 ; } +EXPORT_SYMBOL_GPL (mtdtest_scan_for_bad_eraseblocks);int mtdtest_erase_good_eraseblocks (struct mtd_info *mtd,unsigned char *bbt,unsigned int eb,int ebcnt)
@@ -75,6 +77,7 @@ int mtdtest_erase_good_eraseblocks(struct mtd_info *mtd, unsigned char *bbt,return 0 ; } +EXPORT_SYMBOL_GPL (mtdtest_erase_good_eraseblocks);int mtdtest_read (struct mtd_info *mtd,loff_t addr,size_t size,void *buf) {
@@ -92,6 +95,7 @@ int mtdtest_read(struct mtd_info *mtd, loff_t addr, size_t size, void *buf)return err; } +EXPORT_SYMBOL_GPL (mtdtest_read);int mtdtest_write (struct mtd_info *mtd,loff_t addr,size_t size,const void *buf)
@@ -107,3 +111,8 @@ int mtdtest_write(struct mtd_info *mtd, loff_t addr, size_t size,return err; } +EXPORT_SYMBOL_GPL (mtdtest_write); + +MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("MTD function test helpers" ); +MODULE_AUTHOR ("Akinobu Mita" );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 206/440 RDMA/device: Return error earlier if port in not valid
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leon Romanovsky <[email protected]>
[ Upstream commit 917918f57a7b139c043e78c502876f2c286f4f0a ]
There is no need to allocate port data if port provided is not valid.
--- drivers/infiniband/core/device.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/infiniband/core/device.c +3 -3
@@ -2146,6 +2146,9 @@ int ib_device_set_netdev(struct ib_device *ib_dev, struct net_device *ndev,unsigned long flags;int ret; +if (!rdma_is_port_valid (ib_dev, port)) +return -EINVAL ; +/* * Drivers wish to call this before ib_register_driver, so we have to * setup the port data early.
@@ -2154,9 +2157,6 @@ int ib_device_set_netdev(struct ib_device *ib_dev, struct net_device *ndev,if (ret)return ret; -if (!rdma_is_port_valid (ib_dev, port)) -return -EINVAL ; - pdata = &ib_dev->port_data[port];spin_lock_irqsave (&pdata->netdev_lock, flags); old_ndev = rcu_dereference_protected(
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 207/440 Input: elan_i2c - do not leave interrupt disabled on suspend failure
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Torokhov <[email protected]>
[ Upstream commit 5f82c1e04721e7cd98e604eb4e58f0724d8e5a65 ]
Make sure interrupts are not left disabled when we fail to suspend the touch controller.
--- drivers/input/mouse/elan_i2c_core.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/input/mouse/elan_i2c_core.c +2 -0
@@ -1372,6 +1372,8 @@ static int __maybe_unused elan_suspend(struct device *dev) } err: +if (ret) +enable_irq (client->irq);mutex_unlock (&data->sysfs_mutex);return ret; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 208/440 ASoC: amd: Adjust error handling in case of absent codec device
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Mishin <[email protected]>
[ Upstream commit 5080808c3339de2220c602ab7c7fa23dc6c1a5a3 ]
acpi_get_first_physical_node() can return NULL in several cases (no such device, ACPI table error, reference count drop to 0, etc). Existing check just emit error message, but doesn't perform return. Then this NULL pointer is passed to devm_acpi_dev_add_driver_gpios() where it is dereferenced.
Adjust this error handling by adding error code return.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- sound/soc/amd/acp-es8336.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/amd/acp-es8336.c +3 -1
@@ -203,8 +203,10 @@ static int st_es8336_late_probe(struct snd_soc_card *card) codec_dev =acpi_get_first_physical_node (adev);acpi_dev_put (adev); -if (!codec_dev) +if (!codec_dev) {dev_err (card->dev,"can not find codec dev\n" ); +return -ENODEV ; + } ret =devm_acpi_dev_add_driver_gpios (codec_dev, acpi_es8336_gpios);if (ret)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 209/440 PCI: endpoint: Clean up error handling in vpci_scan_bus()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 8e0f5a96c534f781e8c57ca30459448b3bfe5429 ]
Smatch complains about inconsistent NULL checking in vpci_scan_bus():
drivers/pci/endpoint/functions/pci-epf-vntb.c:1024 vpci_scan_bus() error: we previously assumed 'vpci_bus' could be null (see line 1021)
Instead of printing an error message and then crashing we should return an error code and clean up.
Also the NULL check is reversed so it prints an error for success instead of failure.
--- drivers/pci/endpoint/functions/pci-epf-vntb.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/pci/endpoint/functions/pci-epf-vntb.c +9 -3
@@ -1032,8 +1032,10 @@ static int vpci_scan_bus(void *sysdata)struct epf_ntb *ndev = sysdata; vpci_bus =pci_scan_bus (ndev->vbus_number, &vpci_ops, sysdata); -if (vpci_bus) -pr_err ("create pci bus\n" ); +if (!vpci_bus) { +pr_err ("create pci bus failed\n" ); +return -EINVAL ; + }pci_bus_add_devices (vpci_bus);
@@ -1355,10 +1357,14 @@ static int epf_ntb_bind(struct pci_epf *epf) goto err_bar_alloc; } -vpci_scan_bus (ntb); + ret =vpci_scan_bus (ntb); +if (ret) + goto err_unregister;return 0 ; +err_unregister: +pci_unregister_driver (&vntb_pci_driver); err_bar_alloc:epf_ntb_config_spad_bar_free (ntb);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 210/440 PCI: endpoint: Fix error handling in epf_ntb_epc_cleanup()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 6bba3c0ac5dc54737998a0982b2e272242c87e0f ]
There are two issues related to epf_ntb_epc_cleanup():
1) It should call epf_ntb_config_sspad_bar_clear()
2) The epf_ntb_bind() function should call epf_ntb_epc_cleanup() to cleanup.
I also changed the ordering a bit. Unwinding should be done in the mirror order from how they are allocated.
--- drivers/pci/endpoint/functions/pci-epf-vntb.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/pci/endpoint/functions/pci-epf-vntb.c +5 -2
@@ -813,8 +813,9 @@ static int epf_ntb_epc_init(struct epf_ntb *ntb)*/ static void epf_ntb_epc_cleanup (struct epf_ntb *ntb) { -epf_ntb_db_bar_clear (ntb);epf_ntb_mw_bar_clear (ntb, ntb->num_mws); +epf_ntb_db_bar_clear (ntb); +epf_ntb_config_sspad_bar_clear (ntb); }#define EPF_NTB_R (_name) \
@@ -1354,7 +1355,7 @@ static int epf_ntb_bind(struct pci_epf *epf) ret =pci_register_driver (&vntb_pci_driver);if (ret) {dev_err (dev,"failure register vntb pci driver\n" ); - goto err_bar_alloc; + goto err_epc_cleanup; } ret =vpci_scan_bus (ntb);
@@ -1365,6 +1366,8 @@ static int epf_ntb_bind(struct pci_epf *epf) err_unregister:pci_unregister_driver (&vntb_pci_driver); +err_epc_cleanup: +epf_ntb_epc_cleanup (ntb); err_bar_alloc:epf_ntb_config_spad_bar_free (ntb);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 211/440 vhost/vsock: always initialize seqpacket_allow
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael S. Tsirkin <[email protected]>
[ Upstream commit 1e1fdcbdde3b7663e5d8faeb2245b9b151417d22 ]
There are two issues around seqpacket_allow:
1. seqpacket_allow is not initialized when socket is created. Thus if features are never set, it will be read uninitialized.
2. if VIRTIO_VSOCK_F_SEQPACKET is set and then cleared, then seqpacket_allow will not be cleared appropriately (existing apps I know about don't usually do this but it's legal and there's no way to be sure no one relies on this).
To fix:
- initialize seqpacket_allow after allocation
- set it unconditionally in set_features
Message-ID: <[email protected]>
--- drivers/vhost/vsock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/vhost/vsock.c +2 -2
@@ -654,6 +654,7 @@ static int vhost_vsock_dev_open(struct inode *inode, struct file *file) } vsock->guest_cid =0 ;/* no CID assigned yet */ + vsock->seqpacket_allow = false;atomic_set (&vsock->queued_replies,0 );
@@ -797,8 +798,7 @@ static int vhost_vsock_set_features(struct vhost_vsock *vsock, u64 features) goto err; } -if (features & (1ULL <<VIRTIO_VSOCK_F_SEQPACKET )) - vsock->seqpacket_allow = true; + vsock->seqpacket_allow = features & (1ULL <<VIRTIO_VSOCK_F_SEQPACKET );for (i =0 ; i <ARRAY_SIZE (vsock->vqs); i++) { vq = &vsock->vqs[i];
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 212/440 net: missing check virtio
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Denis Arefev <[email protected]>
[ Upstream commit e269d79c7d35aa3808b1f3c1737d63dab504ddc8 ]
Two missing check in virtio_net_hdr_to_skb() allowed syzbot to crash kernels again
1. After the skb_segment function the buffer may become non-linear (nr_frags != 0), but since the SKBTX_SHARED_FRAG flag is not set anywhere the __skb_linearize function will not be executed, then the buffer will remain non-linear. Then the condition (offset >= skb_headlen(skb)) becomes true, which causes WARN_ON_ONCE in skb_checksum_help.
2. The struct sk_buff and struct virtio_net_hdr members must be mathematically related.
(gso_size) must be greater than (needed) otherwise WARN_ON_ONCE. (remainder) must be greater than (needed) otherwise WARN_ON_ONCE. (remainder) may be 0 if division is without remainder.
offset+2 (4191) > skb_headlen() (1116)
WARNING: CPU: 1 PID: 5084 at net/core/dev.c:3303 skb_checksum_help+0x5e2/0x740 net/core/dev.c:3303 Modules linked in: CPU: 1 PID: 5084 Comm: syz-executor336 Not tainted 6.7.0-rc3-syzkaller-00014-gdf60cee26a2e #0 Hardware name: Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023 RIP: 0010:skb_checksum_help+0x5e2/0x740 net/core/dev.c:3303 Code: 89 e8 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85 52 01 00 00 44 89 e2 2b 53 74 4c 89 ee 48 c7 c7 40 57 e9 8b e8 af 8f dd f8 90 <0f> 0b 90 90 e9 87 fe ff ff e8 40 0f 6e f9 e9 4b fa ff ff 48 89 ef RSP: 0018:ffffc90003a9f338 EFLAGS: 00010286 RAX: 0000000000000000 RBX: ffff888025125780 RCX: ffffffff814db209 RDX: ffff888015393b80 RSI: ffffffff814db216 RDI: 0000000000000001 RBP: ffff8880251257f4 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000001 R12: 000000000000045c R13: 000000000000105f R14: ffff8880251257f0 R15: 000000000000105d FS: 0000555555c24380(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000000002000f000 CR3: 0000000023151000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> ip_do_fragment+0xa1b/0x18b0 net/ipv4/ip_output.c:777 ip_fragment.constprop.0+0x161/0x230 net/ipv4/ip_output.c:584 ip_finish_output_gso net/ipv4/ip_output.c:286 [inline] __ip_finish_output net/ipv4/ip_output.c:308 [inline] __ip_finish_output+0x49c/0x650 net/ipv4/ip_output.c:295 ip_finish_output+0x31/0x310 net/ipv4/ip_output.c:323 NF_HOOK_COND include/linux/netfilter.h:303 [inline] ip_output+0x13b/0x2a0 net/ipv4/ip_output.c:433 dst_output include/net/dst.h:451 [inline] ip_local_out+0xaf/0x1a0 net/ipv4/ip_output.c:129 iptunnel_xmit+0x5b4/0x9b0 net/ipv4/ip_tunnel_core.c:82 ipip6_tunnel_xmit net/ipv6/sit.c:1034 [inline] sit_tunnel_xmit+0xed2/0x28f0 net/ipv6/sit.c:1076 __netdev_start_xmit include/linux/netdevice.h:4940 [inline] netdev_start_xmit include/linux/netdevice.h:4954 [inline] xmit_one net/core/dev.c:3545 [inline] dev_hard_start_xmit+0x13d/0x6d0 net/core/dev.c:3561 __dev_queue_xmit+0x7c1/0x3d60 net/core/dev.c:4346 dev_queue_xmit include/linux/netdevice.h:3134 [inline] packet_xmit+0x257/0x380 net/packet/af_packet.c:276 packet_snd net/packet/af_packet.c:3087 [inline] packet_sendmsg+0x24ca/0x5240 net/packet/af_packet.c:3119 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg+0xd5/0x180 net/socket.c:745 __sys_sendto+0x255/0x340 net/socket.c:2190 __do_sys_sendto net/socket.c:2202 [inline] __se_sys_sendto net/socket.c:2198 [inline] __x64_sys_sendto+0xe0/0x1b0 net/socket.c:2198 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x40/0x110 arch/x86/entry/common.c:82 entry_SYSCALL_64_after_hwframe+0x63/0x6b
Found by Linux Verification Center (linuxtesting.org) with Syzkaller
Message-Id: <[email protected]>
--- include/linux/virtio_net.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
include/linux/virtio_net.h +11 -0
@@ -51,6 +51,7 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb,unsigned int thlen =0 ;unsigned int p_off =0 ;unsigned int ip_proto; +u64 ret, remainder, gso_size;if (hdr->gso_type !=VIRTIO_NET_HDR_GSO_NONE ) {switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN ) {
@@ -87,6 +88,16 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb,u32 off =__virtio16_to_cpu (little_endian, hdr->csum_offset);u32 needed = start +max_t (u32, thlen, off +sizeof (__sum16)); +if (hdr->gso_size) { + gso_size =__virtio16_to_cpu (little_endian, hdr->gso_size); + ret =div64_u64_rem (skb->len, gso_size, &remainder); +if (!(ret && (hdr->gso_size > needed) && + ((remainder > needed) || (remainder ==0 )))) { +return -EINVAL ; + } +skb_shinfo (skb)->tx_flags |=SKBFL_SHARED_FRAG ; + } +if (!pskb_may_pull (skb, needed))return -EINVAL ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 213/440 crypto: qat - extend scope of lock in adf_cfg_add_key_value_param()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nivas Varadharajan Mugunthakumar <[email protected]>
[ Upstream commit 6424da7d8b938fe66e7e771eaa949bc7b6c29c00 ]
The function adf_cfg_add_key_value_param() attempts to access and modify the key value store of the driver without locking.
Extend the scope of cfg->lock to avoid a potential race condition.
--- drivers/crypto/qat/qat_common/adf_cfg.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/crypto/qat/qat_common/adf_cfg.c +4 -2
@@ -276,17 +276,19 @@ int adf_cfg_add_key_value_param(struct adf_accel_dev *accel_dev,* 3. if the key exists with the same value, then return without doing * anything (the newly created key_val is freed). */ +down_write (&cfg->lock);if (!adf_cfg_key_val_get (accel_dev, section_name, key, temp_val)) {if (strncmp (temp_val, key_val->val,sizeof (temp_val))) {adf_cfg_keyval_remove (key, section); }else {kfree (key_val); -return 0 ; + goto out; } } -down_write (&cfg->lock);adf_cfg_keyval_add (key_val, section); + +out:up_write (&cfg->lock);return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 214/440 clk: qcom: Park shared RCGs upon registration
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Boyd <[email protected]>
[ Upstream commit 01a0a6cc8cfd9952e72677d48d56cf6bc4e3a561 ]
There's two problems with shared RCGs.
The first problem is that they incorrectly report the parent after commit 703db1f5da1e ("clk: qcom: rcg2: Cache CFG register updates for parked RCGs"). That's because the cached CFG register value needs to be populated when the clk is registered. clk_rcg2_shared_enable() writes the cached CFG register value 'parked_cfg'. This value is initially zero due to static initializers. If a driver calls clk_enable() before setting a rate or parent, it will set the parent to '0' which is (almost?) always XO, and may not reflect the parent at registration. In the worst case, this switches the RCG from sourcing a fast PLL to the slow crystal speed.
The second problem is that the force enable bit isn't cleared. The force enable bit is only used during parking and unparking of shared RCGs. Otherwise it shouldn't be set because it keeps the RCG enabled even when all the branches on the output of the RCG are disabled (the hardware has a feedback mechanism so that any child branches keep the RCG enabled when the branch enable bit is set). This problem wastes power if the clk is unused, and is harmful in the case that the clk framework disables the parent of the force enabled RCG. In the latter case, the GDSC the shared RCG is associated with will get wedged if the RCG's source clk is disabled and the GDSC tries to enable the RCG to do "housekeeping" while powering on.
Both of these problems combined with incorrect runtime PM usage in the display driver lead to a black screen on Qualcomm sc7180 Trogdor chromebooks. What happens is that the bootloader leaves the 'disp_cc_mdss_rot_clk' enabled and the 'disp_cc_mdss_rot_clk_src' force enabled and parented to 'disp_cc_pll0'. The mdss driver probes and runtime suspends, disabling the mdss_gdsc which uses the 'disp_cc_mdss_rot_clk_src' for "housekeeping". The 'disp_cc_mdss_rot_clk' is disabled during late init because the clk is unused, but the parent 'disp_cc_mdss_rot_clk_src' is still force enabled because the force enable bit was never cleared. Then 'disp_cc_pll0' is disabled because it is also unused. That's because the clk framework believes the parent of the RCG is XO when it isn't. A child device of the mdss device (e.g. DSI) runtime resumes mdss which powers on the mdss_gdsc. This wedges the GDSC because 'disp_cc_mdss_rot_clk_src' is parented to 'disp_cc_pll0' and that PLL is off. With the GDSC wedged, mdss_runtime_resume() tries to enable 'disp_cc_mdss_mdp_clk' but it can't because the GDSC has wedged all the clks associated with the GDSC causing clks to stay stuck off.
This leads to the following warning seen at boot and a black screen because the display driver fails to probe.
disp_cc_mdss_mdp_clk status stuck at 'off'
WARNING: CPU: 1 PID: 81 at drivers/clk/qcom/clk-branch.c:87 clk_branch_toggle+0x114/0x168 Modules linked in: CPU: 1 PID: 81 Comm: kworker/u16:4 Not tainted 6.7.0-g0dd3ee311255 #1 f5757d475795053fd2ad52247a070cd50dd046f2 Hardware name: Google Lazor (rev1 - 2) with LTE (DT) Workqueue: events_unbound deferred_probe_work_func pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : clk_branch_toggle+0x114/0x168 lr : clk_branch_toggle+0x110/0x168 sp : ffffffc08084b670 pmr_save: 00000060 x29: ffffffc08084b680 x28: ffffff808006de00 x27: 0000000000000001 x26: ffffff8080dbd4f4 x25: 0000000000000000 x24: 0000000000000000 x23: 0000000000000000 x22: ffffffd838461198 x21: ffffffd838007997 x20: ffffffd837541d5c x19: 0000000000000001 x18: 0000000000000004 x17: 0000000000000000 x16: 0000000000000010 x15: ffffffd837070fac x14: 0000000000000003 x13: 0000000000000004 x12: 0000000000000001 x11: c0000000ffffdfff x10: ffffffd838347aa0 x9 : 08dadf92e516c000 x8 : 08dadf92e516c000 x7 : 0000000000000000 x6 : 0000000000000027 x5 : ffffffd8385a61f2 x4 : 0000000000000000 x3 : ffffffc08084b398 x2 : ffffffc08084b3a0 x1 : 00000000ffffdfff x0 : 00000000fffffff0 Call trace: clk_branch_toggle+0x114/0x168 clk_branch2_enable+0x24/0x30 clk_core_enable+0x5c/0x1c8 clk_enable+0x38/0x58 clk_bulk_enable+0x40/0xb0 mdss_runtime_resume+0x68/0x258 pm_generic_runtime_resume+0x30/0x44 __genpd_runtime_resume+0x30/0x80 genpd_runtime_resume+0x124/0x214 __rpm_callback+0x7c/0x15c rpm_callback+0x30/0x88 rpm_resume+0x390/0x4d8 rpm_resume+0x43c/0x4d8 __pm_runtime_resume+0x54/0x98 __device_attach+0xe0/0x170 device_initial_probe+0x1c/0x28 bus_probe_device+0x48/0xa4 device_add+0x52c/0x6fc mipi_dsi_device_register_full+0x104/0x1a8 devm_mipi_dsi_device_register_full+0x28/0x78 ti_sn_bridge_probe+0x1dc/0x2bc auxiliary_bus_probe+0x4c/0x94 really_probe+0xf8/0x270 __driver_probe_device+0xa8/0x130 driver_probe_device+0x44/0x104 __device_attach_driver+0xa4/0xcc bus_for_each_drv+0x94/0xe8 __device_attach+0xf8/0x170 device_initial_probe+0x1c/0x28 bus_probe_device+0x48/0xa4 deferred_probe_work_func+0x9c/0xd8
Fix these problems by parking shared RCGs at boot. This will properly initialize the parked_cfg struct member so that the parent is reported properly and ensure that the clk won't get stuck on or off because the RCG is parented to the safe source (XO).
--- drivers/clk/qcom/clk-rcg2.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
drivers/clk/qcom/clk-rcg2.c +32 -0
@@ -1136,7 +1136,39 @@ clk_rcg2_shared_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)return clk_rcg2_recalc_rate (hw, parent_rate); } +static int clk_rcg2_shared_init (struct clk_hw *hw) +{ +/* +* This does a few things: +* +* 1. Sets rcg->parked_cfg to reflect the value at probe so that the +* proper parent is reported from clk_rcg2_shared_get_parent(). +* +* 2. Clears the force enable bit of the RCG because we rely on child +* clks (branches) to turn the RCG on/off with a hardware feedback +* mechanism and only set the force enable bit in the RCG when we +* want to make sure the clk stays on for parent switches or +* parking. +* +* 3. Parks shared RCGs on the safe source at registration because we +* can't be certain that the parent clk will stay on during boot, +* especially if the parent is shared. If this RCG is enabled at +* boot, and the parent is turned off, the RCG will get stuck on. A +* GDSC can wedge if is turned on and the RCG is stuck on because +* the GDSC's controller will hang waiting for the clk status to +* toggle on when it never does. +* +* The safest option here is to "park" the RCG at init so that the clk +* can never get stuck on or off. This ensures the GDSC can't get +* wedged. +*/ +clk_rcg2_shared_disable (hw); + +return 0 ; +} +const struct clk_ops clk_rcg2_shared_ops = { + .init = clk_rcg2_shared_init, .enable = clk_rcg2_shared_enable, .disable = clk_rcg2_shared_disable, .get_parent = clk_rcg2_shared_get_parent,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 215/440 clk: en7523: fix rate divider for slic and spi clocks
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <[email protected]>
[ Upstream commit 58c53d43142f222221e5a76a7016c4d8f3b84b97 ]
Introduce div_offset field in en_clk_desc struct in order to fix rate divider estimation in en7523_get_div routine for slic and spi fixed rate clocks.
Moreover, fix base_shift for crypto clock.
--- drivers/clk/clk-en7523.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/clk/clk-en7523.c +7 -2
@@ -41,6 +41,7 @@ struct en_clk_desc {u8 div_shift;u16 div_val0;u8 div_step; +u8 div_offset; };struct en_clk_gate {
@@ -68,6 +69,7 @@ static const struct en_clk_desc en7523_base_clks[] = { .div_bits = 3, .div_shift = 0, .div_step = 1, + .div_offset = 1, }, { .id = EN7523_CLK_EMI, .name = "emi",
@@ -81,6 +83,7 @@ static const struct en_clk_desc en7523_base_clks[] = { .div_bits = 3, .div_shift = 0, .div_step = 1, + .div_offset = 1, }, { .id = EN7523_CLK_BUS, .name = "bus",
@@ -94,6 +97,7 @@ static const struct en_clk_desc en7523_base_clks[] = { .div_bits = 3, .div_shift = 0, .div_step = 1, + .div_offset = 1, }, { .id = EN7523_CLK_SLIC, .name = "slic",
@@ -134,13 +138,14 @@ static const struct en_clk_desc en7523_base_clks[] = { .div_bits = 3, .div_shift = 0, .div_step = 1, + .div_offset = 1, }, { .id = EN7523_CLK_CRYPTO, .name = "crypto", .base_reg = REG_CRYPTO_CLKSRC, .base_bits = 1, - .base_shift = 8, + .base_shift = 0, .base_values = emi_base, .n_base_values = ARRAY_SIZE(emi_base), }
@@ -185,7 +190,7 @@ static u32 en7523_get_div(void __iomem *base, int i)if (!val && desc->div_val0)return desc->div_val0; -return (val +1 ) * desc->div_step; +return (val + desc->div_offset) * desc->div_step; }static int en7523_pci_is_enabled (struct clk_hw *hw)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 216/440 MIPS: Octeron: remove source file executable bit
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dominique Martinet <[email protected]>
[ Upstream commit 89c7f5078935872cf47a713a645affb5037be694 ]
This does not matter the least, but there is no other .[ch] file in the repo that is executable, so clean this up.
--- arch/mips/pci/pcie-octeon.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 arch/mips/pci/pcie-octeon.c
arch/mips/pci/pcie-octeon.c +0 -0
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 217/440 PCI: qcom-ep: Disable resources unconditionally during PERST# assert
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 912315715d7b74f7abdb6f063ebace44ee288af9 ]
All EP specific resources are enabled during PERST# deassert. As a counter operation, all resources should be disabled during PERST# assert. There is no point in skipping that if the link was not enabled.
This will also result in enablement of the resources twice if PERST# got deasserted again. So remove the check from qcom_pcie_perst_assert() and disable all the resources unconditionally.
--- drivers/pci/controller/dwc/pcie-qcom-ep.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/pci/controller/dwc/pcie-qcom-ep.c +0 -6
@@ -446,12 +446,6 @@ static int qcom_pcie_perst_deassert(struct dw_pcie *pci)static void qcom_pcie_perst_assert (struct dw_pcie *pci) {struct qcom_pcie_ep *pcie_ep =to_pcie_ep (pci); -struct device *dev = pci->dev; - -if (pcie_ep->link_status ==QCOM_PCIE_EP_LINK_DISABLED ) { -dev_dbg (dev,"Link is already disabled\n" ); -return ; - }qcom_pcie_disable_resources (pcie_ep); pcie_ep->link_status =QCOM_PCIE_EP_LINK_DISABLED ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 218/440 PCI: dwc: Fix index 0 incorrectly being interpreted as a free ATU slot
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Li <[email protected]>
[ Upstream commit c2a57ee0f2f1ad8c970ff58b78a43e85abbdeb7f ]
When PERST# assert and deassert happens on the PERST# supported platforms, both iATU0 and iATU6 will map inbound window to BAR0. DMA will access the area that was previously allocated (iATU0) for BAR0, instead of the new area (iATU6) for BAR0.
Right now, this isn't an issue because both iATU0 and iATU6 should translate inbound accesses to BAR0 to the same allocated memory area. However, having two separate inbound mappings for the same BAR is a disaster waiting to happen.
The mappings between PCI BAR and iATU inbound window are maintained in the dw_pcie_ep::bar_to_atu[] array. While allocating a new inbound iATU map for a BAR, dw_pcie_ep_inbound_atu() API checks for the availability of the existing mapping in the array and if it is not found (i.e., value in the array indexed by the BAR is found to be 0), it allocates a new map value using find_first_zero_bit().
The issue is the existing logic failed to consider the fact that the map value '0' is a valid value for BAR0, so find_first_zero_bit() will return '0' as the map value for BAR0 (note that it returns the first zero bit position).
Due to this, when PERST# assert + deassert happens on the PERST# supported platforms, the inbound window allocation restarts from BAR0 and the existing logic to find the BAR mapping will return '6' for BAR0 instead of '0' due to the fact that it considers '0' as an invalid map value.
Fix this issue by always incrementing the map value before assigning to bar_to_atu[] array and then decrementing it while fetching. This will make sure that the map value '0' always represents the invalid mapping."
--- drivers/pci/controller/dwc/pcie-designware-ep.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/pci/controller/dwc/pcie-designware-ep.c +10 -3
@@ -165,7 +165,7 @@ static int dw_pcie_ep_inbound_atu(struct dw_pcie_ep *ep, u8 func_no, int type,if (!ep->bar_to_atu[bar]) free_win =find_first_zero_bit (ep->ib_window_map, pci->num_ib_windows);else - free_win = ep->bar_to_atu[bar]; + free_win = ep->bar_to_atu[bar] -1 ;if (free_win >= pci->num_ib_windows) {dev_err (pci->dev,"No free inbound window\n" );
@@ -179,7 +179,11 @@ static int dw_pcie_ep_inbound_atu(struct dw_pcie_ep *ep, u8 func_no, int type,return ret; } - ep->bar_to_atu[bar] = free_win; +/* +* Always increment free_win before assignment, since value 0 is used to identify +* unallocated mapping. +*/ + ep->bar_to_atu[bar] = free_win +1 ;set_bit (free_win, ep->ib_window_map);return 0 ;
@@ -216,7 +220,10 @@ static void dw_pcie_ep_clear_bar(struct pci_epc *epc, u8 func_no, u8 vfunc_no,struct dw_pcie_ep *ep =epc_get_drvdata (epc);struct dw_pcie *pci =to_dw_pcie_from_ep (ep);enum pci_barno bar = epf_bar->barno; -u32 atu_index = ep->bar_to_atu[bar]; +u32 atu_index = ep->bar_to_atu[bar] -1 ; + +if (!ep->bar_to_atu[bar]) +return ;__dw_pcie_ep_reset_bar (pci, func_no, bar, epf_bar->flags);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 219/440 powerpc/xmon: Fix disassembly CPU feature checks
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
[ Upstream commit 14196e47c5ffe32af7ed5a51c9e421c5ea5bccce ]
In the xmon disassembly code there are several CPU feature checks to determine what dialects should be passed to the disassembler. The dialect controls which instructions the disassembler will recognise.
Unfortunately the checks are incorrect, because instead of passing a single CPU feature they are passing a mask of feature bits.
For example the code:
if (cpu_has_feature(CPU_FTRS_POWER5))
dialect |= PPC_OPCODE_POWER5;Is trying to check if the system is running on a Power5 CPU. But CPU_FTRS_POWER5 is a mask of *all* the feature bits that are enabled on a Power5.
In practice the test will always return true for any 64-bit CPU, because at least one bit in the mask will be present in the CPU_FTRS_ALWAYS mask.
Similarly for all the other checks against CPU_FTRS_xx masks.
Rather than trying to match the disassembly behaviour exactly to the current CPU, just differentiate between 32-bit and 64-bit, and Altivec, VSX and HTM.
That will cause some instructions to be shown in disassembly even on a CPU that doesn't support them, but that's OK, objdump -d output has the same behaviour, and if anything it's less confusing than some instructions not being disassembled.
--- arch/powerpc/xmon/ppc-dis.c | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-)
arch/powerpc/xmon/ppc-dis.c +11 -22
@@ -122,32 +122,21 @@ int print_insn_powerpc (unsigned long insn, unsigned long memaddr)bool insn_is_short;ppc_cpu_t dialect; - dialect =PPC_OPCODE_PPC |PPC_OPCODE_COMMON - |PPC_OPCODE_64 |PPC_OPCODE_POWER4 |PPC_OPCODE_ALTIVEC ; + dialect =PPC_OPCODE_PPC |PPC_OPCODE_COMMON ; -if (cpu_has_feature (CPU_FTRS_POWER5 )) - dialect |=PPC_OPCODE_POWER5 ; +if (IS_ENABLED (CONFIG_PPC64 )) + dialect |=PPC_OPCODE_64 |PPC_OPCODE_POWER4 |PPC_OPCODE_CELL | +PPC_OPCODE_POWER5 |PPC_OPCODE_POWER6 |PPC_OPCODE_POWER7 |PPC_OPCODE_POWER8 | +PPC_OPCODE_POWER9 ; -if (cpu_has_feature (CPU_FTRS_CELL )) - dialect |= (PPC_OPCODE_CELL |PPC_OPCODE_ALTIVEC ); +if (cpu_has_feature (CPU_FTR_TM )) + dialect |=PPC_OPCODE_HTM ; -if (cpu_has_feature (CPU_FTRS_POWER6 )) - dialect |= (PPC_OPCODE_POWER5 |PPC_OPCODE_POWER6 |PPC_OPCODE_ALTIVEC ); +if (cpu_has_feature (CPU_FTR_ALTIVEC )) + dialect |=PPC_OPCODE_ALTIVEC |PPC_OPCODE_ALTIVEC2 ; -if (cpu_has_feature (CPU_FTRS_POWER7 )) - dialect |= (PPC_OPCODE_POWER5 |PPC_OPCODE_POWER6 |PPC_OPCODE_POWER7 - |PPC_OPCODE_ALTIVEC |PPC_OPCODE_VSX ); - -if (cpu_has_feature (CPU_FTRS_POWER8 )) - dialect |= (PPC_OPCODE_POWER5 |PPC_OPCODE_POWER6 |PPC_OPCODE_POWER7 - |PPC_OPCODE_POWER8 |PPC_OPCODE_HTM - |PPC_OPCODE_ALTIVEC |PPC_OPCODE_ALTIVEC2 |PPC_OPCODE_VSX ); - -if (cpu_has_feature (CPU_FTRS_POWER9 )) - dialect |= (PPC_OPCODE_POWER5 |PPC_OPCODE_POWER6 |PPC_OPCODE_POWER7 - |PPC_OPCODE_POWER8 |PPC_OPCODE_POWER9 |PPC_OPCODE_HTM - |PPC_OPCODE_ALTIVEC |PPC_OPCODE_ALTIVEC2 - |PPC_OPCODE_VSX |PPC_OPCODE_VSX3 ); +if (cpu_has_feature (CPU_FTR_VSX )) + dialect |=PPC_OPCODE_VSX |PPC_OPCODE_VSX3 ;/* Get the major opcode of the insn. */ opcode =NULL ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 220/440 macintosh/therm_windtunnel: fix module unload.
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nick Bowler <[email protected]>
[ Upstream commit fd748e177194ebcbbaf98df75152a30e08230cc6 ]
The of_device_unregister call in therm_windtunnel's module_exit procedure does not fully reverse the effects of of_platform_device_create in the module_init prodedure. Once you unload this module, it is impossible to load it ever again since only the first of_platform_device_create call on the fan node succeeds.
This driver predates first git commit, and it turns out back then of_platform_device_create worked differently than it does today. So this is actually an old regression.
The appropriate function to undo of_platform_device_create now appears to be of_platform_device_destroy, and switching to use this makes it possible to unload and load the module as expected.
--- drivers/macintosh/therm_windtunnel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/macintosh/therm_windtunnel.c +1 -1
@@ -548,7 +548,7 @@ g4fan_exit( void )platform_driver_unregister ( &therm_of_driver );if ( x.of_dev ) -of_device_unregister ( x.of_dev ); +of_platform_device_destroy (&x.of_dev->dev,NULL ); }module_init (g4fan_init);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 221/440 RDMA/hns: Check atomic wr length
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junxian Huang <[email protected]>
[ Upstream commit 6afa2c0bfb8ef69f65715ae059e5bd5f9bbaf03b ]
8 bytes is the only supported length of atomic. Add this check in set_rc_wqe(). Besides, stop processing WQEs and return from set_rc_wqe() if there is any error.
--- drivers/infiniband/hw/hns/hns_roce_device.h | 2 ++ drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/infiniband/hw/hns/hns_roce_device.h +2 -0
@@ -90,6 +90,8 @@/* Configure to HW for PAGE_SIZE larger than 4KB */ #define PG_SHIFT_OFFSET (PAGE_SHIFT - 12) +#define ATOMIC_WR_LEN 8 +#define HNS_ROCE_IDX_QUE_ENTRY_SZ 4#define SRQ_DB_REG 0x230
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +7 -2
@@ -602,11 +602,16 @@ static inline int set_rc_wqe(struct hns_roce_qp *qp, (wr->send_flags & IB_SEND_SIGNALED) ? 1 : 0);if (wr->opcode ==IB_WR_ATOMIC_CMP_AND_SWP || - wr->opcode ==IB_WR_ATOMIC_FETCH_AND_ADD ) + wr->opcode ==IB_WR_ATOMIC_FETCH_AND_ADD ) { +if (msg_len !=ATOMIC_WR_LEN ) +return -EINVAL ;set_atomic_seg (wr, rc_sq_wqe, valid_num_sge); -else if (wr->opcode !=IB_WR_REG_MR ) + }else if (wr->opcode !=IB_WR_REG_MR ) { ret =set_rwqe_data_seg (&qp->ibqp, wr, rc_sq_wqe, &curr_idx, valid_num_sge); +if (ret) +return ret; + }/* * The pipeline can sequentially post all valid WQEs into WQ buffer,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 222/440 RDMA/hns: Fix unmatch exception handling when init eq table fails
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junxian Huang <[email protected]>
[ Upstream commit 543fb987bd63ed27409b5dea3d3eec27b9c1eac9 ]
The hw ctx should be destroyed when init eq table fails.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 25 +++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +13 -12
@@ -6418,9 +6418,16 @@ static void hns_roce_v2_int_mask_enable(struct hns_roce_dev *hr_dev,roce_write (hr_dev,ROCEE_VF_ABN_INT_CFG_REG , enable_flag); } -static void hns_roce_v2_destroy_eqc (struct hns_roce_dev *hr_dev,u32 eqn) +static void free_eq_buf (struct hns_roce_dev *hr_dev,struct hns_roce_eq *eq) +{ +hns_roce_mtr_destroy (hr_dev, &eq->mtr); +} + +static void hns_roce_v2_destroy_eqc (struct hns_roce_dev *hr_dev, +struct hns_roce_eq *eq) {struct device *dev = hr_dev->dev; +int eqn = eq->eqn;int ret;u8 cmd;
@@ -6431,12 +6438,9 @@ static void hns_roce_v2_destroy_eqc(struct hns_roce_dev *hr_dev, u32 eqn) ret =hns_roce_destroy_hw_ctx (hr_dev, cmd, eqn &HNS_ROCE_V2_EQN_M );if (ret) -dev_err (dev,"[mailbox cmd] destroy eqc(%u) failed.\n" , eqn); -} +dev_err (dev,"[mailbox cmd] destroy eqc(%d) failed.\n" , eqn); -static void free_eq_buf (struct hns_roce_dev *hr_dev,struct hns_roce_eq *eq) -{ -hns_roce_mtr_destroy (hr_dev, &eq->mtr); +free_eq_buf (hr_dev, eq); }static void init_eq_config (struct hns_roce_dev *hr_dev,struct hns_roce_eq *eq)
@@ -6742,7 +6746,7 @@ static int hns_roce_v2_init_eq_table(struct hns_roce_dev *hr_dev) err_create_eq_fail:for (i -=1 ; i >=0 ; i--) -free_eq_buf (hr_dev, &eq_table->eq[i]); +hns_roce_v2_destroy_eqc (hr_dev, &eq_table->eq[i]);kfree (eq_table->eq);return ret;
@@ -6762,11 +6766,8 @@ static void hns_roce_v2_cleanup_eq_table(struct hns_roce_dev *hr_dev)__hns_roce_free_irq (hr_dev);destroy_workqueue (hr_dev->irq_workq); -for (i =0 ; i < eq_num; i++) { -hns_roce_v2_destroy_eqc (hr_dev, i); - -free_eq_buf (hr_dev, &eq_table->eq[i]); - } +for (i =0 ; i < eq_num; i++) +hns_roce_v2_destroy_eqc (hr_dev, &eq_table->eq[i]);kfree (eq_table->eq); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 223/440 RDMA/hns: Fix missing pagesize and alignment check in FRMR
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengchang Tang <[email protected]>
[ Upstream commit d387d4b54eb84208bd4ca13572e106851d0a0819 ]
The offset requires 128B alignment and the page size ranges from 4K to 128M.
--- drivers/infiniband/hw/hns/hns_roce_device.h | 4 ++++ drivers/infiniband/hw/hns/hns_roce_mr.c | 5 +++++ 2 files changed, 9 insertions(+)
drivers/infiniband/hw/hns/hns_roce_device.h +4 -0
@@ -82,6 +82,7 @@#define MR_TYPE_DMA 0x03#define HNS_ROCE_FRMR_MAX_PA 512 +#define HNS_ROCE_FRMR_ALIGN_SIZE 128#define PKEY_ID 0xffff#define NODE_DESC_SIZE 64
@@ -182,6 +183,9 @@ enum {#define HNS_HW_PAGE_SHIFT 12#define HNS_HW_PAGE_SIZE (1 << HNS_HW_PAGE_SHIFT) +#define HNS_HW_MAX_PAGE_SHIFT 27 +#define HNS_HW_MAX_PAGE_SIZE (1 << HNS_HW_MAX_PAGE_SHIFT) +struct hns_roce_uar {u64 pfn;unsigned long index;
drivers/infiniband/hw/hns/hns_roce_mr.c +5 -0
@@ -423,6 +423,11 @@ int hns_roce_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents,struct hns_roce_mtr *mtr = &mr->pbl_mtr;int ret, sg_num =0 ; +if (!IS_ALIGNED (*sg_offset,HNS_ROCE_FRMR_ALIGN_SIZE ) || + ibmr->page_size <HNS_HW_PAGE_SIZE || + ibmr->page_size >HNS_HW_MAX_PAGE_SIZE ) +return sg_num; + mr->npages =0 ; mr->page_list =kvcalloc (mr->pbl_mtr.hem_cfg.buf_pg_count,sizeof (dma_addr_t),GFP_KERNEL );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 224/440 RDMA/hns: Fix shift-out-bounds when max_inline_data is 0
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengchang Tang <[email protected]>
[ Upstream commit 24c6291346d98c7ece4f4bfeb5733bec1d6c7b4f ]
A shift-out-bounds may occur, if the max_inline_data has not been set.
The related log:
UBSAN: shift-out-of-bounds in kernel/include/linux/log2.h:57:13 shift exponent 64 is too large for 64-bit type 'long unsigned int' Call trace: dump_backtrace+0xb0/0x118 show_stack+0x20/0x38 dump_stack_lvl+0xbc/0x120 dump_stack+0x1c/0x28 __ubsan_handle_shift_out_of_bounds+0x104/0x240 set_ext_sge_param+0x40c/0x420 [hns_roce_hw_v2] hns_roce_create_qp+0xf48/0x1c40 [hns_roce_hw_v2] create_qp.part.0+0x294/0x3c0 ib_create_qp_kernel+0x7c/0x150 create_mad_qp+0x11c/0x1e0 ib_mad_init_device+0x834/0xc88 add_client_context+0x248/0x318 enable_device_and_get+0x158/0x280 ib_register_device+0x4ac/0x610 hns_roce_init+0x890/0xf98 [hns_roce_hw_v2] __hns_roce_hw_v2_init_instance+0x398/0x720 [hns_roce_hw_v2] hns_roce_hw_v2_init_instance+0x108/0x1e0 [hns_roce_hw_v2] hclge_init_roce_client_instance+0x1a0/0x358 [hclge] hclge_init_client_instance+0xa0/0x508 [hclge] hnae3_register_client+0x18c/0x210 [hnae3] hns_roce_hw_v2_init+0x28/0xff8 [hns_roce_hw_v2] do_one_initcall+0xe0/0x510 do_init_module+0x110/0x370 load_module+0x2c6c/0x2f20 init_module_from_file+0xe0/0x140 idempotent_init_module+0x24c/0x350 __arm64_sys_finit_module+0x88/0xf8 invoke_syscall+0x68/0x1a0 el0_svc_common.constprop.0+0x11c/0x150 do_el0_svc+0x38/0x50 el0_svc+0x50/0xa0 el0t_64_sync_handler+0xc0/0xc8 el0t_64_sync+0x1a4/0x1a8
--- drivers/infiniband/hw/hns/hns_roce_qp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/hw/hns/hns_roce_qp.c +3 -1
@@ -538,13 +538,15 @@ static unsigned int get_sge_num_from_max_inl_data(bool is_ud_or_gsi, {unsigned int inline_sge; - inline_sge =roundup_pow_of_two (max_inline_data) /HNS_ROCE_SGE_SIZE ; +if (!max_inline_data) +return 0 ;/* * if max_inline_data less than * HNS_ROCE_SGE_IN_WQE * HNS_ROCE_SGE_SIZE, * In addition to ud's mode, no need to extend sge. */ + inline_sge =roundup_pow_of_two (max_inline_data) /HNS_ROCE_SGE_SIZE ;if (!is_ud_or_gsi && inline_sge <=HNS_ROCE_SGE_IN_WQE ) inline_sge =0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 225/440 RDMA/hns: Fix undifined behavior caused by invalid max_sge
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengchang Tang <[email protected]>
[ Upstream commit 36397b907355e2fdb5a25a02a7921a937fd8ef4c ]
If max_sge has been set to 0, roundup_pow_of_two() in set_srq_basic_param() may have undefined behavior.
--- drivers/infiniband/hw/hns/hns_roce_srq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/hns/hns_roce_srq.c +1 -1
@@ -296,7 +296,7 @@ static int set_srq_basic_param(struct hns_roce_srq *srq, max_sge =proc_srq_sge (hr_dev, srq, !!udata);if (attr->max_wr > hr_dev->caps.max_srq_wrs || - attr->max_sge > max_sge) { + attr->max_sge > max_sge || !attr->max_sge) {ibdev_err (&hr_dev->ib_dev,"invalid SRQ attr, depth = %u, sge = %u.\n" , attr->max_wr, attr->max_sge);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 226/440 RDMA/hns: Fix insufficient extend DB for VFs.
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengchang Tang <[email protected]>
[ Upstream commit 0b8e658f70ffd5dc7cda3872fd524d657d4796b7 ]
VFs and its PF will share the memory of the extend DB. Currently, the number of extend DB allocated by driver is only enough for PF. This leads to a probability of DB loss and some other problems in scenarios where both PF and VFs use a large number of QPs.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +4 -2
@@ -2574,14 +2574,16 @@ static int set_llm_cfg_to_hw(struct hns_roce_dev *hr_dev,static struct hns_roce_link_table *alloc_link_table_buf (struct hns_roce_dev *hr_dev) { +u16 total_sl = hr_dev->caps.sl_num * hr_dev->func_num;struct hns_roce_v2_priv *priv = hr_dev->priv;struct hns_roce_link_table *link_tbl;u32 pg_shift, size, min_size; link_tbl = &priv->ext_llm; pg_shift = hr_dev->caps.llm_buf_pg_sz +PAGE_SHIFT ; - size = hr_dev->caps.num_qps *HNS_ROCE_V2_EXT_LLM_ENTRY_SZ ; - min_size =HNS_ROCE_EXT_LLM_MIN_PAGES (hr_dev->caps.sl_num) << pg_shift; + size = hr_dev->caps.num_qps * hr_dev->func_num * +HNS_ROCE_V2_EXT_LLM_ENTRY_SZ ; + min_size =HNS_ROCE_EXT_LLM_MIN_PAGES (total_sl) << pg_shift;/* Alloc data table */ size =max (size, min_size);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 227/440 iommu/vt-d: Fix to convert mm pfn to dma pfn
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yanfei Xu <[email protected]>
[ Upstream commit fb5f50a43d9fd44fd6bc4f4dbcf9d3ec5b556558 ]
For the case that VT-d page is smaller than mm page, converting dma pfn should be handled in two cases which are for start pfn and for end pfn. Currently the calculation of end dma pfn is incorrect and the result is less than real page frame number which is causing the mapping of iova always misses some page frames.
Rename the mm_to_dma_pfn() to mm_to_dma_pfn_start() and add a new helper for converting end dma pfn named mm_to_dma_pfn_end().
Stable-dep-of: 31000732d56b ("iommu/vt-d: Fix identity map bounds in si_domain_init()")
--- drivers/iommu/intel/iommu.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
drivers/iommu/intel/iommu.c +13 -9
@@ -113,13 +113,17 @@ static inline unsigned long lvl_to_nr_pages(unsigned int lvl)/* VT-d pages must always be _smaller_ than MM pages. Otherwise things are never going to work. */ -static inline unsigned long mm_to_dma_pfn (unsigned long mm_pfn) +static inline unsigned long mm_to_dma_pfn_start (unsigned long mm_pfn) {return mm_pfn << (PAGE_SHIFT -VTD_PAGE_SHIFT ); } +static inline unsigned long mm_to_dma_pfn_end (unsigned long mm_pfn) +{ +return ((mm_pfn +1 ) << (PAGE_SHIFT -VTD_PAGE_SHIFT )) -1 ; +}static inline unsigned long page_to_dma_pfn (struct page *pg) { -return mm_to_dma_pfn (page_to_pfn (pg)); +return mm_to_dma_pfn_start (page_to_pfn (pg)); }static inline unsigned long virt_to_dma_pfn (void *p) {
@@ -2439,8 +2443,8 @@ static int __init si_domain_init(int hw)for_each_mem_pfn_range (i, nid, &start_pfn, &end_pfn,NULL ) { ret =iommu_domain_identity_map (si_domain, -mm_to_dma_pfn (start_pfn), -mm_to_dma_pfn (end_pfn)); +mm_to_dma_pfn_start (start_pfn), +mm_to_dma_pfn_end (end_pfn));if (ret)return ret; }
@@ -2461,8 +2465,8 @@ static int __init si_domain_init(int hw)continue ; ret =iommu_domain_identity_map (si_domain, -mm_to_dma_pfn (start >>PAGE_SHIFT ), -mm_to_dma_pfn (end >>PAGE_SHIFT )); +mm_to_dma_pfn_start (start >>PAGE_SHIFT ), +mm_to_dma_pfn_end (end >>PAGE_SHIFT ));if (ret)return ret; }
@@ -3698,8 +3702,8 @@ static int intel_iommu_memory_notifier(struct notifier_block *nb, unsigned long val, void *v) { struct memory_notify *mhp = v; -unsigned long start_vpfn =mm_to_dma_pfn (mhp->start_pfn); -unsigned long last_vpfn =mm_to_dma_pfn (mhp->start_pfn + +unsigned long start_vpfn =mm_to_dma_pfn_start (mhp->start_pfn); +unsigned long last_vpfn =mm_to_dma_pfn_end (mhp->start_pfn + mhp->nr_pages -1 );switch (val) {
@@ -4401,7 +4405,7 @@ static void intel_iommu_tlb_sync(struct iommu_domain *domain,unsigned long i; nrpages =aligned_nrpages (gather->start, size); - start_pfn =mm_to_dma_pfn (iova_pfn); + start_pfn =mm_to_dma_pfn_start (iova_pfn);xa_for_each (&dmar_domain->iommu_array, i, info) iommu_flush_iotlb_psi(info->iommu, dmar_domain,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 228/440 iommu/vt-d: Fix identity map bounds in si_domain_init()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jon Pan-Doh <[email protected]>
[ Upstream commit 31000732d56b43765d51e08cccb68818fbc0032c ]
Intel IOMMU operates on inclusive bounds (both generally aas well as iommu_domain_identity_map()). Meanwhile, for_each_mem_pfn_range() uses exclusive bounds for end_pfn. This creates an off-by-one error when switching between the two.
--- drivers/iommu/intel/iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/intel/iommu.c +1 -1
@@ -2444,7 +2444,7 @@ static int __init si_domain_init(int hw)for_each_mem_pfn_range (i, nid, &start_pfn, &end_pfn,NULL ) { ret =iommu_domain_identity_map (si_domain,mm_to_dma_pfn_start (start_pfn), -mm_to_dma_pfn_end (end_pfn)); +mm_to_dma_pfn_end (end_pfn-1 ));if (ret)return ret; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 229/440 bnxt_re: Fix imm_data endianness
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jack Wang <[email protected]>
[ Upstream commit 95b087f87b780daafad1dbb2c84e81b729d5d33f ]
When map a device between servers with MLX and BCM RoCE nics, RTRS server complain about unknown imm type, and can't map the device,
After more debug, it seems bnxt_re wrongly handle the imm_data, this patch fixed the compat issue with MLX for us.
In off list discussion, Selvin confirmed HW is working in little endian format and all data needs to be converted to LE while providing.
This patch fix the endianness for imm_data
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 8 ++++---- drivers/infiniband/hw/bnxt_re/qplib_fp.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +4 -4
@@ -2359,7 +2359,7 @@ static int bnxt_re_build_send_wqe(struct bnxt_re_qp *qp,break ;case IB_WR_SEND_WITH_IMM : wqe->type =BNXT_QPLIB_SWQE_TYPE_SEND_WITH_IMM ; - wqe->send.imm_data = wr->ex.imm_data; + wqe->send.imm_data =be32_to_cpu (wr->ex.imm_data);break ;case IB_WR_SEND_WITH_INV : wqe->type =BNXT_QPLIB_SWQE_TYPE_SEND_WITH_INV ;
@@ -2389,7 +2389,7 @@ static int bnxt_re_build_rdma_wqe(const struct ib_send_wr *wr,break ;case IB_WR_RDMA_WRITE_WITH_IMM : wqe->type =BNXT_QPLIB_SWQE_TYPE_RDMA_WRITE_WITH_IMM ; - wqe->rdma.imm_data = wr->ex.imm_data; + wqe->rdma.imm_data =be32_to_cpu (wr->ex.imm_data);break ;case IB_WR_RDMA_READ : wqe->type =BNXT_QPLIB_SWQE_TYPE_RDMA_READ ;
@@ -3340,7 +3340,7 @@ static void bnxt_re_process_res_shadow_qp_wc(struct bnxt_re_qp *gsi_sqp, wc->byte_len = orig_cqe->length; wc->qp = &gsi_qp->ib_qp; - wc->ex.imm_data = orig_cqe->immdata; + wc->ex.imm_data =cpu_to_be32 (le32_to_cpu (orig_cqe->immdata)); wc->src_qp = orig_cqe->src_qp;memcpy (wc->smac, orig_cqe->smac,ETH_ALEN );if (bnxt_re_is_vlan_pkt (orig_cqe, &vlan_id, &sl)) {
@@ -3476,7 +3476,7 @@ int bnxt_re_poll_cq(struct ib_cq *ib_cq, int num_entries, struct ib_wc *wc) (unsigned long )(cqe->qp_handle), struct bnxt_re_qp, qplib_qp); wc->qp = &qp->ib_qp; - wc->ex.imm_data = cqe->immdata; + wc->ex.imm_data =cpu_to_be32 (le32_to_cpu (cqe->immdata)); wc->src_qp = cqe->src_qp;memcpy (wc->smac, cqe->smac,ETH_ALEN ); wc->port_num =1 ;
drivers/infiniband/hw/bnxt_re/qplib_fp.h +3 -3
@@ -164,7 +164,7 @@ struct bnxt_qplib_swqe {/* Send, with imm, inval key */ struct {union { -__be32 imm_data; +u32 imm_data;u32 inv_key; };u32 q_key;
@@ -182,7 +182,7 @@ struct bnxt_qplib_swqe {/* RDMA write, with imm, read */ struct {union { -__be32 imm_data; +u32 imm_data;u32 inv_key; };u64 remote_va;
@@ -374,7 +374,7 @@ struct bnxt_qplib_cqe {u16 cfa_meta;u64 wr_id;union { -__be32 immdata; +__le32 immdata;u32 invrkey; };u64 qp_handle;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 230/440 netfilter: ctnetlink: use helper function to calculate expect ID
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 782161895eb4ac45cf7cfa8db375bd4766cb8299 ]
Delete expectation path is missing a call to the nf_expect_get_id() helper function to calculate the expectation ID, otherwise LSB of the expectation object address is leaked to userspace.
--- net/netfilter/nf_conntrack_netlink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/netfilter/nf_conntrack_netlink.c +2 -1
@@ -3415,7 +3415,8 @@ static int ctnetlink_del_expect(struct sk_buff *skb,if (cda[CTA_EXPECT_ID ]) {__be32 id =nla_get_be32 (cda[CTA_EXPECT_ID ]); -if (ntohl (id) != (u32 )(unsigned long )exp) { + +if (id !=nf_expect_get_id (exp)) {nf_ct_expect_put (exp);return -ENOENT ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 231/440 netfilter: nft_set_pipapo: constify lookup fn args where possible
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit f04df573faf90bb828a2241b650598c02c074323 ]
Those get called from packet path, content must not be modified. No functional changes intended.
Stable-dep-of: 791a615b7ad2 ("netfilter: nf_set_pipapo: fix initial map fill")
--- net/netfilter/nft_set_pipapo.c | 18 +++++---- net/netfilter/nft_set_pipapo.h | 6 +-- net/netfilter/nft_set_pipapo_avx2.c | 59 +++++++++++++++++------------ 3 files changed, 48 insertions(+), 35 deletions(-)
net/netfilter/nft_set_pipapo.c +10 -8
@@ -360,7 +360,7 @@* Return: -1 on no match, bit position on 'match_only', 0 otherwise. */ int pipapo_refill (unsigned long *map,int len,int rules,unsigned long *dst, -union nft_pipapo_map_bucket *mt,bool match_only) +const union nft_pipapo_map_bucket *mt,bool match_only) {unsigned long bitset;int k, ret =-1 ;
@@ -412,9 +412,9 @@ bool nft_pipapo_lookup(const struct net *net, const struct nft_set *set,struct nft_pipapo_scratch *scratch;unsigned long *res_map, *fill_map;u8 genmask =nft_genmask_cur (net); +const struct nft_pipapo_match *m; +const struct nft_pipapo_field *f;const u8 *rp = (const u8 *)key; -struct nft_pipapo_match *m; -struct nft_pipapo_field *f;bool map_index;int i;
@@ -519,11 +519,13 @@ static struct nft_pipapo_elem *pipapo_get(const struct net *net, {struct nft_pipapo_elem *ret =ERR_PTR (-ENOENT );struct nft_pipapo *priv =nft_set_priv (set); -struct nft_pipapo_match *m = priv->clone;unsigned long *res_map, *fill_map =NULL ; -struct nft_pipapo_field *f; +const struct nft_pipapo_match *m; +const struct nft_pipapo_field *f;int i; + m = priv->clone; + res_map =kmalloc_array (m->bsize_max,sizeof (*res_map),GFP_ATOMIC );if (!res_map) { ret =ERR_PTR (-ENOMEM );
@@ -1595,7 +1597,7 @@ static void pipapo_gc(const struct nft_set *_set, struct nft_pipapo_match *m)while ((rules_f0 =pipapo_rules_same_key (m->f, first_rule))) {union nft_pipapo_map_bucket rulemap[NFT_PIPAPO_MAX_FIELDS ]; -struct nft_pipapo_field *f; +const struct nft_pipapo_field *f;int i, start, rules_fx; start = first_rule;
@@ -2041,8 +2043,8 @@ static void nft_pipapo_walk(const struct nft_ctx *ctx, struct nft_set *set, {struct nft_pipapo *priv =nft_set_priv (set);struct net *net =read_pnet (&set->net); -struct nft_pipapo_match *m; -struct nft_pipapo_field *f; +const struct nft_pipapo_match *m; +const struct nft_pipapo_field *f;int i, r;rcu_read_lock ();
net/netfilter/nft_set_pipapo.h +3 -3
@@ -185,7 +185,7 @@ struct nft_pipapo_elem { };int pipapo_refill (unsigned long *map,int len,int rules,unsigned long *dst, -union nft_pipapo_map_bucket *mt,bool match_only); +const union nft_pipapo_map_bucket *mt,bool match_only);/** * pipapo_and_field_buckets_4bit() - Intersect 4-bit buckets
@@ -193,7 +193,7 @@ int pipapo_refill(unsigned long *map, int len, int rules, unsigned long *dst,* @dst: Area to store result * @data: Input data selecting table buckets */ -static inline void pipapo_and_field_buckets_4bit (struct nft_pipapo_field *f, +static inline void pipapo_and_field_buckets_4bit (const struct nft_pipapo_field *f,unsigned long *dst,const u8 *data) {
@@ -221,7 +221,7 @@ static inline void pipapo_and_field_buckets_4bit(struct nft_pipapo_field *f,* @dst: Area to store result * @data: Input data selecting table buckets */ -static inline void pipapo_and_field_buckets_8bit (struct nft_pipapo_field *f, +static inline void pipapo_and_field_buckets_8bit (const struct nft_pipapo_field *f,unsigned long *dst,const u8 *data) {
net/netfilter/nft_set_pipapo_avx2.c +35 -24
132 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 232/440 netfilter: nf_set_pipapo: fix initial map fill
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit 791a615b7ad2258c560f91852be54b0480837c93 ]
The initial buffer has to be inited to all-ones, but it must restrict it to the size of the first field, not the total field size.
After each round in the map search step, the result and the fill map are swapped, so if we have a set where f->bsize of the first element is smaller than m->bsize_max, those one-bits are leaked into future rounds result map.
This makes pipapo find an incorrect matching results for sets where first field size is not the largest.
Followup patch adds a test case to nft_concat_range.sh selftest script.
Thanks to Stefano Brivio for pointing out that we need to zero out the remainder explicitly, only correcting memset() argument isn't enough.
--- net/netfilter/nft_set_pipapo.c | 4 ++-- net/netfilter/nft_set_pipapo.h | 21 +++++++++++++++++++++ net/netfilter/nft_set_pipapo_avx2.c | 10 ++++++---- 3 files changed, 29 insertions(+), 6 deletions(-)
net/netfilter/nft_set_pipapo.c +2 -2
@@ -432,7 +432,7 @@ bool nft_pipapo_lookup(const struct net *net, const struct nft_set *set, res_map = scratch->map + (map_index ? m->bsize_max :0 ); fill_map = scratch->map + (map_index ?0 : m->bsize_max); -memset (res_map,0xff , m->bsize_max *sizeof (*res_map)); +pipapo_resmap_init (m, res_map);nft_pipapo_for_each_field (f, i, m) {bool last = i == m->field_count -1 ;
@@ -538,7 +538,7 @@ static struct nft_pipapo_elem *pipapo_get(const struct net *net, goto out; } -memset (res_map,0xff , m->bsize_max *sizeof (*res_map)); +pipapo_resmap_init (m, res_map);nft_pipapo_for_each_field (f, i, m) {bool last = i == m->field_count -1 ;
net/netfilter/nft_set_pipapo.h +21 -0
@@ -285,4 +285,25 @@ static u64 pipapo_estimate_size(const struct nft_set_desc *desc) return size; } +/** +* pipapo_resmap_init() - Initialise result map before first use +* @m: Matching data, including mapping table +* @res_map: Result map +* +* Initialize all bits covered by the first field to one, so that after +* the first step, only the matching bits of the first bit group remain. +* +* If other fields have a large bitmap, set remainder of res_map to 0. +*/ +static inline void pipapo_resmap_init (const struct nft_pipapo_match *m,unsigned long *res_map) +{ +const struct nft_pipapo_field *f = m->f; +int i; + +for (i =0 ; i < f->bsize; i++) + res_map[i] =ULONG_MAX ; + +for (i = f->bsize; i < m->bsize_max; i++) + res_map[i] =0ul ; +}#endif /* _NFT_SET_PIPAPO_H */
net/netfilter/nft_set_pipapo_avx2.c +6 -4
@@ -1036,6 +1036,7 @@ static int nft_pipapo_avx2_lookup_8b_16(unsigned long *map, unsigned long *fill,/** * nft_pipapo_avx2_lookup_slow() - Fallback function for uncommon field sizes +* @mdata: Matching data, including mapping table * @map: Previous match result, used as initial bitmap * @fill: Destination bitmap to be filled with current match result * @f: Field, containing lookup and mapping tables
@@ -1051,7 +1052,8 @@ static int nft_pipapo_avx2_lookup_8b_16(unsigned long *map, unsigned long *fill,* Return: -1 on no match, rule index of match if @last, otherwise first long * word index to be checked next (i.e. first filled word). */ -static int nft_pipapo_avx2_lookup_slow (unsigned long *map,unsigned long *fill, +static int nft_pipapo_avx2_lookup_slow (const struct nft_pipapo_match *mdata, +unsigned long *map,unsigned long *fill,const struct nft_pipapo_field *f,int offset,const u8 *pkt,bool first,bool last)
@@ -1060,7 +1062,7 @@ static int nft_pipapo_avx2_lookup_slow(unsigned long *map, unsigned long *fill,int i, ret =-1 , b;if (first) -memset (map,0xff , bsize *sizeof (*map)); +pipapo_resmap_init (mdata, map);for (i = offset; i < bsize; i++) {if (f->bb ==8 )
@@ -1186,7 +1188,7 @@ bool nft_pipapo_avx2_lookup(const struct net *net, const struct nft_set *set, }else if (f->groups ==16 ) {NFT_SET_PIPAPO_AVX2_LOOKUP (8 ,16 ); }else { - ret =nft_pipapo_avx2_lookup_slow (res, fill, f, + ret =nft_pipapo_avx2_lookup_slow (m, res, fill, f, ret, rp, first, last); }
@@ -1202,7 +1204,7 @@ bool nft_pipapo_avx2_lookup(const struct net *net, const struct nft_set *set, }else if (f->groups ==32 ) {NFT_SET_PIPAPO_AVX2_LOOKUP (4 ,32 ); }else { - ret =nft_pipapo_avx2_lookup_slow (res, fill, f, + ret =nft_pipapo_avx2_lookup_slow (m, res, fill, f, ret, rp, first, last); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 233/440 net: flow_dissector: use DEBUG_NET_WARN_ON_ONCE
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 120f1c857a73e52132e473dee89b340440cb692b ]
The following splat is easy to reproduce upstream as well as in -stable kernels. Florian Westphal provided the following commit:
d1dab4f71d37 ("net: add and use __skb_get_hash_symmetric_net")
but this complementary fix has been also suggested by Willem de Bruijn and it can be easily backported to -stable kernel which consists in using DEBUG_NET_WARN_ON_ONCE instead to silence the following splat given __skb_get_hash() is used by the nftables tracing infrastructure to to identify packets in traces.
[69133.561393] ------------[ cut here ]------------ [69133.561404] WARNING: CPU: 0 PID: 43576 at net/core/flow_dissector.c:1104 __skb_flow_dissect+0x134f/ [...] [69133.561944] CPU: 0 PID: 43576 Comm: socat Not tainted 6.10.0-rc7+ #379 [69133.561959] RIP: 0010:__skb_flow_dissect+0x134f/0x2ad0 [69133.561970] Code: 83 f9 04 0f 84 b3 00 00 00 45 85 c9 0f 84 aa 00 00 00 41 83 f9 02 0f 84 81 fc ff ff 44 0f b7 b4 24 80 00 00 00 e9 8b f9 ff ff <0f> 0b e9 20 f3 ff ff 41 f6 c6 20 0f 84 e4 ef ff ff 48 8d 7b 12 e8 [69133.561979] RSP: 0018:ffffc90000006fc0 EFLAGS: 00010246 [69133.561988] RAX: 0000000000000000 RBX: ffffffff82f33e20 RCX: ffffffff81ab7e19 [69133.561994] RDX: dffffc0000000000 RSI: ffffc90000007388 RDI: ffff888103a1b418 [69133.562001] RBP: ffffc90000007310 R08: 0000000000000000 R09: 0000000000000000 [69133.562007] R10: ffffc90000007388 R11: ffffffff810cface R12: ffff888103a1b400 [69133.562013] R13: 0000000000000000 R14: ffffffff82f33e2a R15: ffffffff82f33e28 [69133.562020] FS: 00007f40f7131740(0000) GS:ffff888390800000(0000) knlGS:0000000000000000 [69133.562027] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [69133.562033] CR2: 00007f40f7346ee0 CR3: 000000015d200001 CR4: 00000000001706f0 [69133.562040] Call Trace: [69133.562044] <IRQ> [69133.562049] ? __warn+0x9f/0x1a0 [ 1211.841384] ? __skb_flow_dissect+0x107e/0x2860 [...] [ 1211.841496] ? bpf_flow_dissect+0x160/0x160 [ 1211.841753] __skb_get_hash+0x97/0x280 [ 1211.841765] ? __skb_get_hash_symmetric+0x230/0x230 [ 1211.841776] ? mod_find+0xbf/0xe0 [ 1211.841786] ? get_stack_info_noinstr+0x12/0xe0 [ 1211.841798] ? bpf_ksym_find+0x56/0xe0 [ 1211.841807] ? __rcu_read_unlock+0x2a/0x70 [ 1211.841819] nft_trace_init+0x1b9/0x1c0 [nf_tables] [ 1211.841895] ? nft_trace_notify+0x830/0x830 [nf_tables] [ 1211.841964] ? get_stack_info+0x2b/0x80 [ 1211.841975] ? nft_do_chain_arp+0x80/0x80 [nf_tables] [ 1211.842044] nft_do_chain+0x79c/0x850 [nf_tables]
--- net/core/flow_dissector.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/flow_dissector.c +1 -1
@@ -1013,7 +1013,7 @@ bool __skb_flow_dissect(const struct net *net, } } -WARN_ON_ONCE (!net); +DEBUG_NET_WARN_ON_ONCE (!net);if (net) {enum netns_bpf_attach_type type =NETNS_BPF_FLOW_DISSECTOR ;struct bpf_prog_array *run_array;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 234/440 ipv4: Fix incorrect TOS in route get reply
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
[ Upstream commit 338bb57e4c2a1c2c6fc92f9c0bd35be7587adca7 ]
The TOS value that is returned to user space in the route get reply is the one with which the lookup was performed ('fl4->flowi4_tos'). This is fine when the matched route is configured with a TOS as it would not match if its TOS value did not match the one with which the lookup was performed.
However, matching on TOS is only performed when the route's TOS is not zero. It is therefore possible to have the kernel incorrectly return a non-zero TOS:
# ip link add name dummy1 up type dummy
# ip address add 192.0.2.1/24 dev dummy1
# ip route get 192.0.2.2 tos 0xfc
192.0.2.2 tos 0x1c dev dummy1 src 192.0.2.1 uid 0
cacheFix by adding a DSCP field to the FIB result structure (inside an existing 4 bytes hole), populating it in the route lookup and using it when filling the route get reply.
Output after the patch:
# ip link add name dummy1 up type dummy
# ip address add 192.0.2.1/24 dev dummy1
# ip route get 192.0.2.2 tos 0xfc
192.0.2.2 dev dummy1 src 192.0.2.1 uid 0
cache--- include/net/ip_fib.h | 1 + net/ipv4/fib_trie.c | 1 + net/ipv4/route.c | 14 +++++++------- 3 files changed, 9 insertions(+), 7 deletions(-)
include/net/ip_fib.h +1 -0
@@ -173,6 +173,7 @@ struct fib_result {unsigned char type;unsigned char scope;u32 tclassid; +dscp_t dscp;struct fib_nh_common *nhc;struct fib_info *fi;struct fib_table *table;
net/ipv4/fib_trie.c +1 -0
@@ -1628,6 +1628,7 @@ int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp, res->nhc = nhc; res->type = fa->fa_type; res->scope = fi->fib_scope; + res->dscp = fa->fa_dscp; res->fi = fi; res->table = tb; res->fa_head = &n->leaf;
net/ipv4/route.c +7 -7
@@ -2934,9 +2934,9 @@ EXPORT_SYMBOL_GPL(ip_route_output_tunnel);/* called with rcu_read_lock held */ static int rt_fill_info (struct net *net,__be32 dst,__be32 src, -struct rtable *rt,u32 table_id,struct flowi4 *fl4, -struct sk_buff *skb,u32 portid,u32 seq, -unsigned int flags) +struct rtable *rt,u32 table_id,dscp_t dscp, +struct flowi4 *fl4,struct sk_buff *skb,u32 portid, +u32 seq,unsigned int flags) {struct rtmsg *r;struct nlmsghdr *nlh;
@@ -2952,7 +2952,7 @@ static int rt_fill_info(struct net *net, __be32 dst, __be32 src, r->rtm_family =AF_INET ; r->rtm_dst_len =32 ; r->rtm_src_len =0 ; - r->rtm_tos = fl4 ? fl4->flowi4_tos :0 ; + r->rtm_tos =inet_dscp_to_dsfield (dscp); r->rtm_table = table_id <256 ? table_id :RT_TABLE_COMPAT ;if (nla_put_u32 (skb,RTA_TABLE , table_id)) goto nla_put_failure;
@@ -3102,7 +3102,7 @@ static int fnhe_dump_bucket(struct net *net, struct sk_buff *skb, goto next; err =rt_fill_info (net, fnhe->fnhe_daddr,0 , rt, - table_id,NULL , skb, + table_id,0 ,NULL , skb,NETLINK_CB (cb->skb).portid, cb->nlh->nlmsg_seq, flags);if (err)
@@ -3425,8 +3425,8 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, err =fib_dump_info (skb,NETLINK_CB (in_skb).portid, nlh->nlmsg_seq,RTM_NEWROUTE , &fri,0 ); }else { - err =rt_fill_info (net, dst, src, rt, table_id, &fl4, skb, -NETLINK_CB (in_skb).portid, + err =rt_fill_info (net, dst, src, rt, table_id, res.dscp, &fl4, + skb,NETLINK_CB (in_skb).portid, nlh->nlmsg_seq,0 ); }if (err <0 )
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 235/440 ipv4: Fix incorrect TOS in fibmatch route get reply
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
[ Upstream commit f036e68212c11e5a7edbb59b5e25299341829485 ]
The TOS value that is returned to user space in the route get reply is the one with which the lookup was performed ('fl4->flowi4_tos'). This is fine when the matched route is configured with a TOS as it would not match if its TOS value did not match the one with which the lookup was performed.
However, matching on TOS is only performed when the route's TOS is not zero. It is therefore possible to have the kernel incorrectly return a non-zero TOS:
# ip link add name dummy1 up type dummy # ip address add 192.0.2.1/24 dev dummy1 # ip route get fibmatch 192.0.2.2 tos 0xfc 192.0.2.0/24 tos 0x1c dev dummy1 proto kernel scope link src 192.0.2.1
Fix by instead returning the DSCP field from the FIB result structure which was populated during the route lookup.
Output after the patch:
# ip link add name dummy1 up type dummy # ip address add 192.0.2.1/24 dev dummy1 # ip route get fibmatch 192.0.2.2 tos 0xfc 192.0.2.0/24 dev dummy1 proto kernel scope link src 192.0.2.1
Extend the existing selftests to not only verify that the correct route is returned, but that it is also returned with correct "tos" value (or without it).
--- net/ipv4/route.c | 2 +- tools/testing/selftests/net/fib_tests.sh | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-)
net/ipv4/route.c +1 -1
@@ -3398,7 +3398,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, fri.tb_id = table_id; fri.dst = res.prefix; fri.dst_len = res.prefixlen; - fri.dscp =inet_dsfield_to_dscp (fl4.flowi4_tos); + fri.dscp = res.dscp; fri.type = rt->rt_type; fri.offload =0 ; fri.trap =0 ;
tools/testing/selftests/net/fib_tests.sh +12 -12
@@ -1485,53 +1485,53 @@ ipv4_rt_dsfield() # DSCP 0x10 should match the specific route, no matter the ECN bits $IP route get fibmatch 172.16.102.1 dsfield 0x10 | \ - grep -q "via 172.16.103.2" + grep -q "172.16.102.0/24 tos 0x10 via 172.16.103.2" log_test $? 0 "IPv4 route with DSCP and ECN:Not-ECT" $IP route get fibmatch 172.16.102.1 dsfield 0x11 | \ - grep -q "via 172.16.103.2" + grep -q "172.16.102.0/24 tos 0x10 via 172.16.103.2" log_test $? 0 "IPv4 route with DSCP and ECN:ECT(1)" $IP route get fibmatch 172.16.102.1 dsfield 0x12 | \ - grep -q "via 172.16.103.2" + grep -q "172.16.102.0/24 tos 0x10 via 172.16.103.2" log_test $? 0 "IPv4 route with DSCP and ECN:ECT(0)" $IP route get fibmatch 172.16.102.1 dsfield 0x13 | \ - grep -q "via 172.16.103.2" + grep -q "172.16.102.0/24 tos 0x10 via 172.16.103.2" log_test $? 0 "IPv4 route with DSCP and ECN:CE" # Unknown DSCP should match the generic route, no matter the ECN bits $IP route get fibmatch 172.16.102.1 dsfield 0x14 | \ - grep -q "via 172.16.101.2" + grep -q "172.16.102.0/24 via 172.16.101.2" log_test $? 0 "IPv4 route with unknown DSCP and ECN:Not-ECT" $IP route get fibmatch 172.16.102.1 dsfield 0x15 | \ - grep -q "via 172.16.101.2" + grep -q "172.16.102.0/24 via 172.16.101.2" log_test $? 0 "IPv4 route with unknown DSCP and ECN:ECT(1)" $IP route get fibmatch 172.16.102.1 dsfield 0x16 | \ - grep -q "via 172.16.101.2" + grep -q "172.16.102.0/24 via 172.16.101.2" log_test $? 0 "IPv4 route with unknown DSCP and ECN:ECT(0)" $IP route get fibmatch 172.16.102.1 dsfield 0x17 | \ - grep -q "via 172.16.101.2" + grep -q "172.16.102.0/24 via 172.16.101.2" log_test $? 0 "IPv4 route with unknown DSCP and ECN:CE" # Null DSCP should match the generic route, no matter the ECN bits $IP route get fibmatch 172.16.102.1 dsfield 0x00 | \ - grep -q "via 172.16.101.2" + grep -q "172.16.102.0/24 via 172.16.101.2" log_test $? 0 "IPv4 route with no DSCP and ECN:Not-ECT" $IP route get fibmatch 172.16.102.1 dsfield 0x01 | \ - grep -q "via 172.16.101.2" + grep -q "172.16.102.0/24 via 172.16.101.2" log_test $? 0 "IPv4 route with no DSCP and ECN:ECT(1)" $IP route get fibmatch 172.16.102.1 dsfield 0x02 | \ - grep -q "via 172.16.101.2" + grep -q "172.16.102.0/24 via 172.16.101.2" log_test $? 0 "IPv4 route with no DSCP and ECN:ECT(0)" $IP route get fibmatch 172.16.102.1 dsfield 0x03 | \ - grep -q "via 172.16.101.2" + grep -q "172.16.102.0/24 via 172.16.101.2" log_test $? 0 "IPv4 route with no DSCP and ECN:CE" }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 236/440 net: dsa: mv88e6xxx: Limit chip-wide frame size config to CPU ports
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Willi <[email protected]>
[ Upstream commit 66b6095c264e1b4e0a441c6329861806504e06c6 ]
Marvell chips not supporting per-port jumbo frame size configurations use a chip-wide frame size configuration. In the commit referenced with the Fixes tag, the setting is applied just for the last port changing its MTU.
While configuring CPU ports accounts for tagger overhead, user ports do not. When setting the MTU for a user port, the chip-wide setting is reduced to not include the tagger overhead, resulting in an potentially insufficient maximum frame size for the CPU port. Specifically, sending full-size frames from the CPU port on a MV88E6097 having a user port MTU of 1500 bytes results in dropped frames.
As, by design, the CPU port MTU is adjusted for any user port change, apply the chip-wide setting only for CPU ports.
--- drivers/net/dsa/mv88e6xxx/chip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/dsa/mv88e6xxx/chip.c +2 -1
@@ -3606,7 +3606,8 @@ static int mv88e6xxx_change_mtu(struct dsa_switch *ds, int port, int new_mtu)mv88e6xxx_reg_lock (chip);if (chip->info->ops->port_set_jumbo_size) ret = chip->info->ops->port_set_jumbo_size (chip, port, new_mtu); -else if (chip->info->ops->set_max_frame_size) +else if (chip->info->ops->set_max_frame_size && +dsa_is_cpu_port (ds, port)) ret = chip->info->ops->set_max_frame_size (chip, new_mtu);mv88e6xxx_reg_unlock (chip);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 237/440 net: dsa: b53: Limit chip-wide jumbo frame config to CPU ports
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Willi <[email protected]>
[ Upstream commit c5118072e228e7e4385fc5ac46b2e31cf6c4f2d3 ]
Broadcom switches supported by the b53 driver use a chip-wide jumbo frame configuration. In the commit referenced with the Fixes tag, the setting is applied just for the last port changing its MTU.
While configuring CPU ports accounts for tagger overhead, user ports do not. When setting the MTU for a user port, the chip-wide setting is reduced to not include the tagger overhead, resulting in an potentially insufficient chip-wide maximum frame size for the CPU port.
As, by design, the CPU port MTU is adjusted for any user port change, apply the chip-wide setting only for CPU ports. This aligns the driver to the behavior of other switch drivers.
--- drivers/net/dsa/b53/b53_common.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/dsa/b53/b53_common.c +3 -0
@@ -2221,6 +2221,9 @@ static int b53_change_mtu(struct dsa_switch *ds, int port, int mtu)if (is5325 (dev) ||is5365 (dev))return -EOPNOTSUPP ; +if (!dsa_is_cpu_port (ds, port)) +return 0 ; + enable_jumbo = (mtu >=JMS_MIN_SIZE ); allow_10_100 = (dev->chip_id ==BCM583XX_DEVICE_ID );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 238/440 fs/ntfs3: Use ALIGN kernel macro
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit 97a6815e50619377704e6566fb2b77c1aa4e2647 ]
This way code will be more readable.
Stable-dep-of: 25610ff98d4a ("fs/ntfs3: Fix transform resident to nonresident for compressed files")
--- fs/ntfs3/fsntfs.c | 2 +- fs/ntfs3/ntfs.h | 1 - fs/ntfs3/ntfs_fs.h | 2 ++ 3 files changed, 3 insertions(+), 2 deletions(-)
fs/ntfs3/fsntfs.c +1 -1
@@ -475,7 +475,7 @@ static int ntfs_extend_mft(struct ntfs_sb_info *sbi)struct ATTRIB *attr;struct wnd_bitmap *wnd = &sbi->mft.bitmap; - new_mft_total = (wnd->nbits +MFT_INCREASE_CHUNK +127 ) & (CLST )~127 ; + new_mft_total =ALIGN (wnd->nbits +NTFS_MFT_INCREASE_STEP ,128 ); new_mft_bytes = (u64 )new_mft_total << sbi->record_bits;/* Step 1: Resize $MFT::DATA. */
fs/ntfs3/ntfs.h +0 -1
@@ -84,7 +84,6 @@ typedef u32 CLST;#define COMPRESSION_UNIT 4#define COMPRESS_MAX_CLUSTER 0x1000 -#define MFT_INCREASE_CHUNK 1024enum RECORD_NUM {MFT_REC_MFT =0 ,
fs/ntfs3/ntfs_fs.h +2 -0
@@ -197,6 +197,8 @@ struct ntfs_index {/* Minimum MFT zone. */ #define NTFS_MIN_MFT_ZONE 100 +/* Step to increase the MFT. */ +#define NTFS_MFT_INCREASE_STEP 1024/* Ntfs file system in-core superblock data. */ struct ntfs_sb_info {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 239/440 fs/ntfs3: Merge synonym COMPRESSION_UNIT and NTFS_LZNT_CUNIT
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit 487f8d482a7e51a640b8f955a398f906a4f83951 ]
COMPRESSION_UNIT and NTFS_LZNT_CUNIT mean the same thing (1u<<NTFS_LZNT_CUNIT) determines the size for compression (in clusters).
COMPRESS_MAX_CLUSTER is not used in the code.
Stable-dep-of: 25610ff98d4a ("fs/ntfs3: Fix transform resident to nonresident for compressed files")
--- fs/ntfs3/attrib.c | 2 +- fs/ntfs3/frecord.c | 2 +- fs/ntfs3/fslog.c | 2 +- fs/ntfs3/inode.c | 2 +- fs/ntfs3/ntfs.h | 3 --- 5 files changed, 4 insertions(+), 7 deletions(-)
fs/ntfs3/attrib.c +1 -1
@@ -265,7 +265,7 @@ int attr_make_nonresident(struct ntfs_inode *ni, struct ATTRIB *attr, align = sbi->cluster_size;if (is_attr_compressed (attr)) - align <<=COMPRESSION_UNIT ; + align <<=NTFS_LZNT_CUNIT ; len = (rsize + align -1 ) >> sbi->cluster_bits;run_init (run);
fs/ntfs3/frecord.c +1 -1
@@ -1501,7 +1501,7 @@ int ni_insert_nonresident(struct ntfs_inode *ni, enum ATTR_TYPE type,if (is_ext) {if (flags &ATTR_FLAG_COMPRESSED ) - attr->nres.c_unit =COMPRESSION_UNIT ; + attr->nres.c_unit =NTFS_LZNT_CUNIT ; attr->nres.total_size = attr->nres.alloc_size; }
fs/ntfs3/fslog.c +1 -1
@@ -2999,7 +2999,7 @@ static struct ATTRIB *attr_create_nonres_log(struct ntfs_sb_info *sbi,if (is_ext) { attr->name_off =SIZEOF_NONRESIDENT_EX_LE ;if (is_attr_compressed (attr)) - attr->nres.c_unit =COMPRESSION_UNIT ; + attr->nres.c_unit =NTFS_LZNT_CUNIT ; attr->nres.run_off =cpu_to_le16 (SIZEOF_NONRESIDENT_EX + name_size);
fs/ntfs3/inode.c +1 -1
@@ -1459,7 +1459,7 @@ struct inode *ntfs_create_inode(struct user_namespace *mnt_userns, attr->size =cpu_to_le32 (SIZEOF_NONRESIDENT_EX +8 ); attr->name_off =SIZEOF_NONRESIDENT_EX_LE ; attr->flags =ATTR_FLAG_COMPRESSED ; - attr->nres.c_unit =COMPRESSION_UNIT ; + attr->nres.c_unit =NTFS_LZNT_CUNIT ; asize =SIZEOF_NONRESIDENT_EX +8 ; }else { attr->size =cpu_to_le32 (SIZEOF_NONRESIDENT +8 );
fs/ntfs3/ntfs.h +0 -3
@@ -82,9 +82,6 @@ typedef u32 CLST;#define RESIDENT_LCN ((CLST)-2)#define COMPRESSED_LCN ((CLST)-3) -#define COMPRESSION_UNIT 4 -#define COMPRESS_MAX_CLUSTER 0x1000 -enum RECORD_NUM {MFT_REC_MFT =0 ,MFT_REC_MIRR =1 ,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 240/440 fs/ntfs3: Fix transform resident to nonresident for compressed files
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit 25610ff98d4a34e6a85cbe4fd8671be6b0829f8f ]
Сorrected calculation of required space len (in clusters) for attribute data storage in case of compression.
--- fs/ntfs3/attrib.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
fs/ntfs3/attrib.c +8 -5
@@ -242,7 +242,7 @@ int attr_make_nonresident(struct ntfs_inode *ni, struct ATTRIB *attr,struct ntfs_sb_info *sbi;struct ATTRIB *attr_s;struct MFT_REC *rec; -u32 used, asize, rsize, aoff, align; +u32 used, asize, rsize, aoff;bool is_data;CLST len, alen;char *next;
@@ -263,10 +263,13 @@ int attr_make_nonresident(struct ntfs_inode *ni, struct ATTRIB *attr, rsize =le32_to_cpu (attr->res.data_size); is_data = attr->type ==ATTR_DATA && !attr->name_len; - align = sbi->cluster_size; -if (is_attr_compressed (attr)) - align <<=NTFS_LZNT_CUNIT ; - len = (rsize + align -1 ) >> sbi->cluster_bits; +/* len - how many clusters required to store 'rsize' bytes */ +if (is_attr_compressed (attr)) { +u8 shift = sbi->cluster_bits +NTFS_LZNT_CUNIT ; + len = ((rsize + (1u << shift) -1 ) >> shift) <<NTFS_LZNT_CUNIT ; + }else { + len =bytes_to_cluster (sbi, rsize); + }run_init (run);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 241/440 fs/ntfs3: Missed NI_FLAG_UPDATE_PARENT setting
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit 1c308ace1fd6de93bd0b7e1a5e8963ab27e2c016 ]
--- fs/ntfs3/attrib.c | 1 + 1 file changed, 1 insertion(+)
fs/ntfs3/attrib.c +1 -0
@@ -1640,6 +1640,7 @@ int attr_allocate_frame(struct ntfs_inode *ni, CLST frame, size_t compr_size, attr_b->nres.total_size =cpu_to_le64 (total_size);inode_set_bytes (&ni->vfs_inode, total_size); + ni->ni_flags |=NI_FLAG_UPDATE_PARENT ; mi_b->dirty = true;mark_inode_dirty (&ni->vfs_inode);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 242/440 fs/ntfs3: Fix getting file type
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit 24c5100aceedcd47af89aaa404d4c96cd2837523 ]
An additional condition causes the mft record to be read from disk and get the file type dt_type.
--- fs/ntfs3/dir.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ntfs3/dir.c +2 -1
@@ -326,7 +326,8 @@ static inline int ntfs_filldir(struct ntfs_sb_info *sbi, struct ntfs_inode *ni,* It does additional locks/reads just to get the type of name. * Should we use additional mount option to enable branch below? */ -if ((fname->dup.fa &FILE_ATTRIBUTE_REPARSE_POINT ) && +if (((fname->dup.fa &FILE_ATTRIBUTE_REPARSE_POINT ) || + fname->dup.ea_size) && ino != ni->mi.rno) {struct inode *inode =ntfs_iget5 (sbi->sb, &e->ref,NULL );if (!IS_ERR_OR_NULL (inode)) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 243/440 fs/ntfs3: Add missing .dirty_folio in address_space_operations
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit 0f9579d9e0331b6255132ac06bdf2c0a01cceb90 ]
After switching from pages to folio [1], it became evident that the initialization of .dirty_folio for page cache operations was missed for compressed files.
[1] https://lore.kernel.org/ntfs3/[email protected]
--- fs/ntfs3/inode.c | 1 + 1 file changed, 1 insertion(+)
fs/ntfs3/inode.c +1 -0
@@ -1967,5 +1967,6 @@ const struct address_space_operations ntfs_aops = {const struct address_space_operations ntfs_aops_cmpr = { .read_folio = ntfs_read_folio, .readahead = ntfs_readahead, + .dirty_folio = block_dirty_folio, };// clang-format on
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 244/440 pinctrl: rockchip: update rk3308 iomux routes
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Yashin <[email protected]>
[ Upstream commit a8f2548548584549ea29d43431781d67c4afa42b ]
Some of the rk3308 iomux routes in rk3308_mux_route_data belong to the rk3308b SoC. Remove them and correct i2c3 routes.
--- drivers/pinctrl/pinctrl-rockchip.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-)
drivers/pinctrl/pinctrl-rockchip.c +2 -15
@@ -916,9 +916,8 @@ static struct rockchip_mux_route_data rk3308_mux_route_data[] = {RK_MUXROUTE_SAME (0 ,RK_PC3 ,1 ,0x314 ,BIT (16 +0 ) |BIT (0 )),/* rtc_clk */ RK_MUXROUTE_SAME (1 ,RK_PC6 ,2 ,0x314 ,BIT (16 +2 ) |BIT (16 +3 )),/* uart2_rxm0 */ RK_MUXROUTE_SAME (4 ,RK_PD2 ,2 ,0x314 ,BIT (16 +2 ) |BIT (16 +3 ) |BIT (2 )),/* uart2_rxm1 */ -RK_MUXROUTE_SAME (0 ,RK_PB7 ,2 ,0x608 ,BIT (16 +8 ) |BIT (16 +9 )),/* i2c3_sdam0 */ -RK_MUXROUTE_SAME (3 ,RK_PB4 ,2 ,0x608 ,BIT (16 +8 ) |BIT (16 +9 ) |BIT (8 )),/* i2c3_sdam1 */ -RK_MUXROUTE_SAME (2 ,RK_PA0 ,3 ,0x608 ,BIT (16 +8 ) |BIT (16 +9 ) |BIT (9 )),/* i2c3_sdam2 */ +RK_MUXROUTE_SAME (0 ,RK_PB7 ,2 ,0x314 ,BIT (16 +4 )),/* i2c3_sdam0 */ +RK_MUXROUTE_SAME (3 ,RK_PB4 ,2 ,0x314 ,BIT (16 +4 ) |BIT (4 )),/* i2c3_sdam1 */ RK_MUXROUTE_SAME (1 ,RK_PA3 ,2 ,0x308 ,BIT (16 +3 )),/* i2s-8ch-1-sclktxm0 */ RK_MUXROUTE_SAME (1 ,RK_PA4 ,2 ,0x308 ,BIT (16 +3 )),/* i2s-8ch-1-sclkrxm0 */ RK_MUXROUTE_SAME(1, RK_PB5, 2, 0x308, BIT(16 + 3) | BIT(3)), /* i2s-8ch-1-sclktxm1 */
@@ -927,18 +926,6 @@ static struct rockchip_mux_route_data rk3308_mux_route_data[] = {RK_MUXROUTE_SAME (1 ,RK_PB6 ,4 ,0x308 ,BIT (16 +12 ) |BIT (16 +13 ) |BIT (12 )),/* pdm-clkm1 */ RK_MUXROUTE_SAME (2 ,RK_PA6 ,2 ,0x308 ,BIT (16 +12 ) |BIT (16 +13 ) |BIT (13 )),/* pdm-clkm2 */ RK_MUXROUTE_SAME(2, RK_PA4, 3, 0x600, BIT(16 + 2) | BIT(2)), /* pdm-clkm-m2 */ -RK_MUXROUTE_SAME (3 ,RK_PB2 ,3 ,0x314 ,BIT (16 +9 )),/* spi1_miso */ -RK_MUXROUTE_SAME (2 ,RK_PA4 ,2 ,0x314 ,BIT (16 +9 ) |BIT (9 )),/* spi1_miso_m1 */ -RK_MUXROUTE_SAME (0 ,RK_PB3 ,3 ,0x314 ,BIT (16 +10 ) |BIT (16 +11 )),/* owire_m0 */ -RK_MUXROUTE_SAME (1 ,RK_PC6 ,7 ,0x314 ,BIT (16 +10 ) |BIT (16 +11 ) |BIT (10 )),/* owire_m1 */ -RK_MUXROUTE_SAME (2 ,RK_PA2 ,5 ,0x314 ,BIT (16 +10 ) |BIT (16 +11 ) |BIT (11 )),/* owire_m2 */ -RK_MUXROUTE_SAME (0 ,RK_PB3 ,2 ,0x314 ,BIT (16 +12 ) |BIT (16 +13 )),/* can_rxd_m0 */ -RK_MUXROUTE_SAME (1 ,RK_PC6 ,5 ,0x314 ,BIT (16 +12 ) |BIT (16 +13 ) |BIT (12 )),/* can_rxd_m1 */ -RK_MUXROUTE_SAME (2 ,RK_PA2 ,4 ,0x314 ,BIT (16 +12 ) |BIT (16 +13 ) |BIT (13 )),/* can_rxd_m2 */ -RK_MUXROUTE_SAME (1 ,RK_PC4 ,3 ,0x314 ,BIT (16 +14 )),/* mac_rxd0_m0 */ -RK_MUXROUTE_SAME (4 ,RK_PA2 ,2 ,0x314 ,BIT (16 +14 ) |BIT (14 )),/* mac_rxd0_m1 */ -RK_MUXROUTE_SAME (3 ,RK_PB4 ,4 ,0x314 ,BIT (16 +15 )),/* uart3_rx */ - RK_MUXROUTE_SAME(0, RK_PC1, 3, 0x314, BIT(16 + 15) | BIT(15)), /* uart3_rx_m1 */ }; static struct rockchip_mux_route_data rk3328_mux_route_data[] = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 245/440 pinctrl: core: fix possible memory leak when pinctrl_enable() fails
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Yingliang <[email protected]>
[ Upstream commit ae1cf4759972c5fe665ee4c5e0c29de66fe3cf4a ]
In devm_pinctrl_register(), if pinctrl_enable() fails in pinctrl_register(), the "pctldev" has not been added to dev resources, so devm_pinctrl_dev_release() can not be called, it leads memory leak.
Introduce pinctrl_uninit_controller(), call it in the error path to free memory.
--- drivers/pinctrl/core.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/pinctrl/core.c +11 -1
@@ -2062,6 +2062,14 @@ pinctrl_init_controller(struct pinctrl_desc *pctldesc, struct device *dev,return ERR_PTR (ret); } +static void pinctrl_uninit_controller (struct pinctrl_dev *pctldev,struct pinctrl_desc *pctldesc) +{ +pinctrl_free_pindescs (pctldev, pctldesc->pins, + pctldesc->npins); +mutex_destroy (&pctldev->mutex); +kfree (pctldev); +} +static int pinctrl_claim_hogs (struct pinctrl_dev *pctldev) { pctldev->p =create_pinctrl (pctldev->dev, pctldev);
@@ -2142,8 +2150,10 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,return pctldev; error =pinctrl_enable (pctldev); -if (error) +if (error) { +pinctrl_uninit_controller (pctldev, pctldesc);return ERR_PTR (error); + }return pctldev; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 246/440 pinctrl: single: fix possible memory leak when pinctrl_enable() fails
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Yingliang <[email protected]>
[ Upstream commit 8f773bfbdd428819328a2d185976cfc6ae811cd3 ]
This driver calls pinctrl_register_and_init() which is not devm_ managed, it will leads memory leak if pinctrl_enable() fails. Replace it with devm_pinctrl_register_and_init(). And call pcs_free_resources() if pinctrl_enable() fails.
--- drivers/pinctrl/pinctrl-single.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/pinctrl/pinctrl-single.c +4 -3
@@ -1328,7 +1328,6 @@ static void pcs_irq_free(struct pcs_device *pcs)static void pcs_free_resources (struct pcs_device *pcs) {pcs_irq_free (pcs); -pinctrl_unregister (pcs->pctl);#if IS_BUILTIN (CONFIG_PINCTRL_SINGLE )if (pcs->missing_nr_pinctrl_cells)
@@ -1885,7 +1884,7 @@ static int pcs_probe(struct platform_device *pdev)if (ret <0 ) goto free; - ret =pinctrl_register_and_init (&pcs->desc, pcs->dev, pcs, &pcs->pctl); + ret =devm_pinctrl_register_and_init (pcs->dev, &pcs->desc, pcs, &pcs->pctl);if (ret) {dev_err (pcs->dev,"could not register single pinctrl driver\n" ); goto free;
@@ -1918,8 +1917,10 @@ static int pcs_probe(struct platform_device *pdev)dev_info (pcs->dev,"%i pins, size %u\n" , pcs->desc.npins, pcs->size); -return pinctrl_enable (pcs->pctl); +if (pinctrl_enable (pcs->pctl)) + goto free; +return 0 ; free:pcs_free_resources (pcs);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 247/440 pinctrl: ti: ti-iodelay: Drop if block with always false condition
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 88b3f108502bc45e6ebd005702add46759f3f45a ]
ti_iodelay_remove() is only called after ti_iodelay_probe() completed successfully. In this case platform_set_drvdata() was called with a non-NULL argument and so platform_get_drvdata() won't return NULL.
Simplify by removing the if block with the always false condition.
Stable-dep-of: 9b401f4a7170 ("pinctrl: ti: ti-iodelay: fix possible memory leak when pinctrl_enable() fails")
--- drivers/pinctrl/ti/pinctrl-ti-iodelay.c | 3 --- 1 file changed, 3 deletions(-)
drivers/pinctrl/ti/pinctrl-ti-iodelay.c +0 -3
@@ -908,9 +908,6 @@ static int ti_iodelay_remove(struct platform_device *pdev) {struct ti_iodelay_device *iod =platform_get_drvdata (pdev); -if (!iod) -return 0 ; -if (iod->pctl)pinctrl_unregister (iod->pctl);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 248/440 pinctrl: ti: ti-iodelay: fix possible memory leak when pinctrl_enable() fails
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Yingliang <[email protected]>
[ Upstream commit 9b401f4a7170125365160c9af267a41ff6b39001 ]
This driver calls pinctrl_register_and_init() which is not devm_ managed, it will leads memory leak if pinctrl_enable() fails. Replace it with devm_pinctrl_register_and_init(). And add missing of_node_put() in the error path.
--- drivers/pinctrl/ti/pinctrl-ti-iodelay.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/pinctrl/ti/pinctrl-ti-iodelay.c +6 -5
@@ -883,7 +883,7 @@ static int ti_iodelay_probe(struct platform_device *pdev) iod->desc.name =dev_name (dev); iod->desc.owner =THIS_MODULE ; - ret =pinctrl_register_and_init (&iod->desc, dev, iod, &iod->pctl); + ret =devm_pinctrl_register_and_init (dev, &iod->desc, iod, &iod->pctl);if (ret) {dev_err (dev,"Failed to register pinctrl\n" ); goto exit_out;
@@ -891,7 +891,11 @@ static int ti_iodelay_probe(struct platform_device *pdev)platform_set_drvdata (pdev, iod); -return pinctrl_enable (iod->pctl); + ret =pinctrl_enable (iod->pctl); +if (ret) + goto exit_out; + +return 0 ; exit_out:of_node_put (np);
@@ -908,9 +912,6 @@ static int ti_iodelay_remove(struct platform_device *pdev) {struct ti_iodelay_device *iod =platform_get_drvdata (pdev); -if (iod->pctl) -pinctrl_unregister (iod->pctl); -ti_iodelay_pinconf_deinit_dev (iod);/* Expect other allocations to be freed by devm */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 249/440 pinctrl: freescale: mxs: Fix refcount of child
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit 7f500f2011c0bbb6e1cacab74b4c99222e60248e ]
of_get_next_child() will increase refcount of the returned node, need use of_node_put() on it when done.
Per current implementation, 'child' will be override by for_each_child_of_node(np, child), so use of_get_child_count to avoid refcount leakage.
--- drivers/pinctrl/freescale/pinctrl-mxs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pinctrl/freescale/pinctrl-mxs.c +2 -2
@@ -405,8 +405,8 @@ static int mxs_pinctrl_probe_dt(struct platform_device *pdev,int ret;u32 val; - child =of_get_next_child (np,NULL ); -if (!child) { + val =of_get_child_count (np); +if (val ==0 ) {dev_err (&pdev->dev,"no group is defined\n" );return -ENOENT ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 250/440 fs/ntfs3: Replace inode_trylock with inode_lock
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit 69505fe98f198ee813898cbcaf6770949636430b ]
The issue was detected due to xfstest 465 failing.
--- fs/ntfs3/file.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
fs/ntfs3/file.c +1 -4
@@ -396,10 +396,7 @@ static int ntfs_file_mmap(struct file *file, struct vm_area_struct *vma) }if (ni->i_valid < to) { -if (!inode_trylock (inode)) { - err = -EAGAIN ; - goto out; - } +inode_lock (inode); err =ntfs_extend_initialized_size (file, ni, ni->i_valid, to);inode_unlock (inode);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 251/440 fs/ntfs3: Fix field-spanning write in INDEX_HDR
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit 2f3e176fee66ac86ae387787bf06457b101d9f7a ]
Fields flags and res[3] replaced with one 4 byte flags.
--- fs/ntfs3/index.c | 4 ++-- fs/ntfs3/ntfs.h | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-)
fs/ntfs3/index.c +2 -2
@@ -979,7 +979,7 @@ static struct indx_node *indx_new(struct ntfs_index *indx, hdr->used =cpu_to_le32 (eo +sizeof (struct NTFS_DE ) +sizeof (u64));de_set_vbn_le (e, *sub_vbn); - hdr->flags =1 ; + hdr->flags =NTFS_INDEX_HDR_HAS_SUBNODES ; }else { e->size =cpu_to_le16 (sizeof (struct NTFS_DE )); hdr->used =cpu_to_le32 (eo +sizeof (struct NTFS_DE ));
@@ -1677,7 +1677,7 @@ static int indx_insert_into_root(struct ntfs_index *indx, struct ntfs_inode *ni, e->size =cpu_to_le16 (sizeof (struct NTFS_DE ) +sizeof (u64)); e->flags =NTFS_IE_HAS_SUBNODES |NTFS_IE_LAST ; - hdr->flags =1 ; + hdr->flags =NTFS_INDEX_HDR_HAS_SUBNODES ; hdr->used = hdr->total =cpu_to_le32 (new_root_size - offsetof(struct INDEX_ROOT , ihdr));
fs/ntfs3/ntfs.h +5 -4
@@ -686,14 +686,15 @@ static inline bool de_has_vcn_ex(const struct NTFS_DE *e) offsetof(struct ATTR_FILE_NAME, name) + \ NTFS_NAME_LEN * sizeof(short), 8) +#define NTFS_INDEX_HDR_HAS_SUBNODES cpu_to_le32(1) +struct INDEX_HDR {__le32 de_off;// 0x00: The offset from the start of this structure // to the first NTFS_DE. __le32 used;// 0x04: The size of this structure plus all // entries (quad-word aligned). __le32 total;// 0x08: The allocated size of for this structure plus all entries. -u8 flags;// 0x0C: 0x00 = Small directory, 0x01 = Large directory. -u8 res[3 ]; +__le32 flags;// 0x0C: 0x00 = Small directory, 0x01 = Large directory. // // de_off + used <= total
@@ -740,7 +741,7 @@ static inline struct NTFS_DE *hdr_next_de(const struct INDEX_HDR *hdr,static inline bool hdr_has_subnode (const struct INDEX_HDR *hdr) { -return hdr->flags &1 ; +return hdr->flags &NTFS_INDEX_HDR_HAS_SUBNODES ; }struct INDEX_BUFFER {
@@ -760,7 +761,7 @@ static inline bool ib_is_empty(const struct INDEX_BUFFER *ib)static inline bool ib_is_leaf (const struct INDEX_BUFFER *ib) { -return !(ib->ihdr.flags &1 ); +return !(ib->ihdr.flags &NTFS_INDEX_HDR_HAS_SUBNODES ); }/* Index root structure ( 0x90 ). */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 252/440 pinctrl: renesas: r8a779g0: Fix CANFD5 suffix
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 77fa9007ac31e80674beadc452d3f3614f283e18 ]
CAN-FD instance 5 has two alternate pin groups: "canfd5" and "canfd5_b". Rename the former to "canfd5_a" to increase uniformity.
While at it, remove the unneeded separator.
--- drivers/pinctrl/renesas/pfc-r8a779g0.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-)
drivers/pinctrl/renesas/pfc-r8a779g0.c +11 -13
@@ -335,8 +335,8 @@/* IP0SR2 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ #define IP0SR2_3_0 FM(FXR_TXDA) FM(CANFD1_TX) FM(TPU0TO2_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_7_4 FM(FXR_TXENA_N) FM(CANFD1_RX) FM(TPU0TO3_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR2_11_8 FM(RXDA_EXTFXR) FM(CANFD5_TX) FM(IRQ5) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR2_15_12 FM(CLK_EXTFXR) FM(CANFD5_RX) FM(IRQ4_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR2_11_8 FM(RXDA_EXTFXR) FM(CANFD5_TX_A) FM(IRQ5) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR2_15_12 FM(CLK_EXTFXR) FM(CANFD5_RX_A) FM(IRQ4_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_19_16 FM(RXDB_EXTFXR) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_23_20 FM(FXR_TXENB_N) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_27_24 FM(FXR_TXDB) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
@@ -890,11 +890,11 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP0SR2_7_4 ,TPU0TO3_A ),PINMUX_IPSR_GPSR (IP0SR2_11_8 ,RXDA_EXTFXR ), -PINMUX_IPSR_GPSR (IP0SR2_11_8 ,CANFD5_TX ), +PINMUX_IPSR_GPSR (IP0SR2_11_8 ,CANFD5_TX_A ),PINMUX_IPSR_GPSR (IP0SR2_11_8 ,IRQ5 ),PINMUX_IPSR_GPSR (IP0SR2_15_12 ,CLK_EXTFXR ), -PINMUX_IPSR_GPSR (IP0SR2_15_12 ,CANFD5_RX ), +PINMUX_IPSR_GPSR (IP0SR2_15_12 ,CANFD5_RX_A ),PINMUX_IPSR_GPSR (IP0SR2_15_12 ,IRQ4_B ), PINMUX_IPSR_GPSR(IP0SR2_19_16, RXDB_EXTFXR),
@@ -1507,15 +1507,14 @@ static const unsigned int canfd4_data_mux[] = { };/* - CANFD5 ----------------------------------------------------------------- */ -static const unsigned int canfd5_data_pins[] = { -/* CANFD5_TX, CANFD5_RX */ +static const unsigned int canfd5_data_a_pins[] = { +/* CANFD5_TX_A, CANFD5_RX_A */ RCAR_GP_PIN (2 ,2 ),RCAR_GP_PIN (2 ,3 ), }; -static const unsigned int canfd5_data_mux[] = { -CANFD5_TX_MARK ,CANFD5_RX_MARK , +static const unsigned int canfd5_data_a_mux[] = { +CANFD5_TX_A_MARK ,CANFD5_RX_A_MARK , }; -/* - CANFD5_B ----------------------------------------------------------------- */ static const unsigned int canfd5_data_b_pins[] = {/* CANFD5_TX_B, CANFD5_RX_B */ RCAR_GP_PIN (1 ,8 ),RCAR_GP_PIN (1 ,9 ),
@@ -2551,8 +2550,8 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {SH_PFC_PIN_GROUP (canfd2_data),SH_PFC_PIN_GROUP (canfd3_data),SH_PFC_PIN_GROUP (canfd4_data), -SH_PFC_PIN_GROUP (canfd5_data),/* suffix might be updated */ -SH_PFC_PIN_GROUP (canfd5_data_b),/* suffix might be updated */ +SH_PFC_PIN_GROUP (canfd5_data_a), +SH_PFC_PIN_GROUP (canfd5_data_b),SH_PFC_PIN_GROUP (canfd6_data),SH_PFC_PIN_GROUP (canfd7_data), SH_PFC_PIN_GROUP(can_clk),
@@ -2756,8 +2755,7 @@ static const char * const canfd4_groups[] = { };static const char *const canfd5_groups[] = { -/* suffix might be updated */ -"canfd5_data" , +"canfd5_data_a" ,"canfd5_data_b" , };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 253/440 pinctrl: renesas: r8a779g0: Fix FXR_TXEN[AB] suffixes
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 4976d61ca39ce51f422e094de53b46e2e3ac5c0d ]
The Pin Multiplex attachment in Rev.1.10 of the R-Car V4H Series Hardware User's Manual still has two alternate pins named both "FXR_TXEN[AB]". To differentiate, the pin control driver uses "FXR_TXEN[AB]" and "FXR_TXEN[AB]_X", which were considered temporary names until the conflict was sorted out.
Fix this by adopting R-Car V4M naming:
- Rename "FXR_TXEN[AB]" to "FXR_TXEN[AB]_A",
- Rename "FXR_TXEN[AB]_X" to "FXR_TXEN[AB]_B".
--- drivers/pinctrl/renesas/pfc-r8a779g0.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/pinctrl/renesas/pfc-r8a779g0.c +10 -10
@@ -116,11 +116,11 @@#define GPSR2_8 F_(TPU0TO0, IP1SR2_3_0)#define GPSR2_7 F_(TPU0TO1, IP0SR2_31_28)#define GPSR2_6 F_(FXR_TXDB, IP0SR2_27_24) -#define GPSR2_5 F_(FXR_TXENB_N, IP0SR2_23_20) +#define GPSR2_5 F_(FXR_TXENB_N_A, IP0SR2_23_20)#define GPSR2_4 F_(RXDB_EXTFXR, IP0SR2_19_16)#define GPSR2_3 F_(CLK_EXTFXR, IP0SR2_15_12)#define GPSR2_2 F_(RXDA_EXTFXR, IP0SR2_11_8) -#define GPSR2_1 F_(FXR_TXENA_N, IP0SR2_7_4) +#define GPSR2_1 F_(FXR_TXENA_N_A, IP0SR2_7_4)#define GPSR2_0 F_(FXR_TXDA, IP0SR2_3_0)/* GPSR3 */
@@ -334,18 +334,18 @@/* SR2 */ /* IP0SR2 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ #define IP0SR2_3_0 FM(FXR_TXDA) FM(CANFD1_TX) FM(TPU0TO2_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR2_7_4 FM(FXR_TXENA_N) FM(CANFD1_RX) FM(TPU0TO3_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR2_7_4 FM(FXR_TXENA_N_A) FM(CANFD1_RX) FM(TPU0TO3_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_11_8 FM(RXDA_EXTFXR) FM(CANFD5_TX_A) FM(IRQ5) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_15_12 FM(CLK_EXTFXR) FM(CANFD5_RX_A) FM(IRQ4_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_19_16 FM(RXDB_EXTFXR) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR2_23_20 FM(FXR_TXENB_N) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR2_23_20 FM(FXR_TXENB_N_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_27_24 FM(FXR_TXDB) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_31_28 FM(TPU0TO1) FM(CANFD6_TX) F_(0, 0) FM(TCLK2_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)/* IP1SR2 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ #define IP1SR2_3_0 FM(TPU0TO0) FM(CANFD6_RX) F_(0, 0) FM(TCLK1_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR2_7_4 FM(CAN_CLK) FM(FXR_TXENA_N_X) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR2_11_8 FM(CANFD0_TX) FM(FXR_TXENB_N_X) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR2_7_4 FM(CAN_CLK) FM(FXR_TXENA_N_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR2_11_8 FM(CANFD0_TX) FM(FXR_TXENB_N_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_15_12 FM(CANFD0_RX) FM(STPWT_EXTFXR) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_19_16 FM(CANFD2_TX) FM(TPU0TO2) F_(0, 0) FM(TCLK3_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_23_20 FM(CANFD2_RX) FM(TPU0TO3) FM(PWM1_B) FM(TCLK4_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
@@ -885,7 +885,7 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP0SR2_3_0 ,CANFD1_TX ),PINMUX_IPSR_GPSR (IP0SR2_3_0 ,TPU0TO2_A ), -PINMUX_IPSR_GPSR (IP0SR2_7_4 ,FXR_TXENA_N ), +PINMUX_IPSR_GPSR (IP0SR2_7_4 ,FXR_TXENA_N_A ),PINMUX_IPSR_GPSR (IP0SR2_7_4 ,CANFD1_RX ), PINMUX_IPSR_GPSR(IP0SR2_7_4, TPU0TO3_A),
@@ -899,7 +899,7 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP0SR2_19_16 ,RXDB_EXTFXR ), -PINMUX_IPSR_GPSR (IP0SR2_23_20 ,FXR_TXENB_N ), +PINMUX_IPSR_GPSR (IP0SR2_23_20 ,FXR_TXENB_N_A ), PINMUX_IPSR_GPSR(IP0SR2_27_24, FXR_TXDB),
@@ -913,10 +913,10 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP1SR2_3_0 ,TCLK1_A ),PINMUX_IPSR_GPSR (IP1SR2_7_4 ,CAN_CLK ), -PINMUX_IPSR_GPSR (IP1SR2_7_4 ,FXR_TXENA_N_X ), +PINMUX_IPSR_GPSR (IP1SR2_7_4 ,FXR_TXENA_N_B ),PINMUX_IPSR_GPSR (IP1SR2_11_8 ,CANFD0_TX ), -PINMUX_IPSR_GPSR (IP1SR2_11_8 ,FXR_TXENB_N_X ), +PINMUX_IPSR_GPSR (IP1SR2_11_8 ,FXR_TXENB_N_B ),PINMUX_IPSR_GPSR (IP1SR2_15_12 ,CANFD0_RX ), PINMUX_IPSR_GPSR(IP1SR2_15_12, STPWT_EXTFXR),
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 254/440 pinctrl: renesas: r8a779g0: Fix (H)SCIF1 suffixes
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 3cf834a1669ea433aeee4c82c642776899c87451 ]
The Pin Multiplex attachment in Rev.1.10 of the R-Car V4H Series Hardware User's Manual still has two alternate pin groups (GP0_14-18 and GP1_6-10) each named both HSCIF1 and SCIF1. To differentiate, the pin control driver uses "(h)scif1" and "(h)scif1_x", which were considered temporary names until the conflict was sorted out.
Fix this by adopting R-Car V4M naming:
- Rename "(h)scif1" to "(h)scif1_a",
- Rename "(h)scif1_x" to "(h)scif1_b".
Adopt the R-Car V4M naming "(h)scif1_a" and "(h)scif1_b" to increase uniformity.
While at it, remove unneeded separators.
--- drivers/pinctrl/renesas/pfc-r8a779g0.c | 208 ++++++++++++------------- 1 file changed, 102 insertions(+), 106 deletions(-)
drivers/pinctrl/renesas/pfc-r8a779g0.c +102 -106
@@ -285,13 +285,13 @@#define IP1SR0_15_12 FM(MSIOF5_SCK) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR0_19_16 FM(MSIOF5_RXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR0_23_20 FM(MSIOF2_SS2) FM(TCLK1) FM(IRQ2_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR0_27_24 FM(MSIOF2_SS1) FM(HTX1) FM(TX1) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR0_31_28 FM(MSIOF2_SYNC) FM(HRX1) FM(RX1) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR0_27_24 FM(MSIOF2_SS1) FM(HTX1_A) FM(TX1_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR0_31_28 FM(MSIOF2_SYNC) FM(HRX1_A) FM(RX1_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)/* IP2SR0 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ -#define IP2SR0_3_0 FM(MSIOF2_TXD) FM(HCTS1_N) FM(CTS1_N) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP2SR0_7_4 FM(MSIOF2_SCK) FM(HRTS1_N) FM(RTS1_N) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP2SR0_11_8 FM(MSIOF2_RXD) FM(HSCK1) FM(SCK1) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP2SR0_3_0 FM(MSIOF2_TXD) FM(HCTS1_N_A) FM(CTS1_N_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP2SR0_7_4 FM(MSIOF2_SCK) FM(HRTS1_N_A) FM(RTS1_N_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP2SR0_11_8 FM(MSIOF2_RXD) FM(HSCK1_A) FM(SCK1_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)/* SR1 */ /* IP0SR1 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */
@@ -301,13 +301,13 @@#define IP0SR1_15_12 FM(MSIOF1_SCK) FM(HSCK3_A) FM(CTS3_N) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR1_19_16 FM(MSIOF1_TXD) FM(HRX3_A) FM(SCK3) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR1_23_20 FM(MSIOF1_RXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR1_27_24 FM(MSIOF0_SS2) FM(HTX1_X) FM(TX1_X) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR1_31_28 FM(MSIOF0_SS1) FM(HRX1_X) FM(RX1_X) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR1_27_24 FM(MSIOF0_SS2) FM(HTX1_B) FM(TX1_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR1_31_28 FM(MSIOF0_SS1) FM(HRX1_B) FM(RX1_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)/* IP1SR1 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ -#define IP1SR1_3_0 FM(MSIOF0_SYNC) FM(HCTS1_N_X) FM(CTS1_N_X) FM(CANFD5_TX_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR1_7_4 FM(MSIOF0_TXD) FM(HRTS1_N_X) FM(RTS1_N_X) FM(CANFD5_RX_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR1_11_8 FM(MSIOF0_SCK) FM(HSCK1_X) FM(SCK1_X) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR1_3_0 FM(MSIOF0_SYNC) FM(HCTS1_N_B) FM(CTS1_N_B) FM(CANFD5_TX_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR1_7_4 FM(MSIOF0_TXD) FM(HRTS1_N_B) FM(RTS1_N_B) FM(CANFD5_RX_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR1_11_8 FM(MSIOF0_SCK) FM(HSCK1_B) FM(SCK1_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR1_15_12 FM(MSIOF0_RXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR1_19_16 FM(HTX0) FM(TX0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR1_23_20 FM(HCTS0_N) FM(CTS0_N) FM(PWM8_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
@@ -748,25 +748,25 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP1SR0_23_20 ,IRQ2_A ),PINMUX_IPSR_GPSR (IP1SR0_27_24 ,MSIOF2_SS1 ), -PINMUX_IPSR_GPSR (IP1SR0_27_24 ,HTX1 ), -PINMUX_IPSR_GPSR (IP1SR0_27_24 ,TX1 ), +PINMUX_IPSR_GPSR (IP1SR0_27_24 ,HTX1_A ), +PINMUX_IPSR_GPSR (IP1SR0_27_24 ,TX1_A ),PINMUX_IPSR_GPSR (IP1SR0_31_28 ,MSIOF2_SYNC ), -PINMUX_IPSR_GPSR (IP1SR0_31_28 ,HRX1 ), -PINMUX_IPSR_GPSR (IP1SR0_31_28 ,RX1 ), +PINMUX_IPSR_GPSR (IP1SR0_31_28 ,HRX1_A ), +PINMUX_IPSR_GPSR (IP1SR0_31_28 ,RX1_A ),/* IP2SR0 */ PINMUX_IPSR_GPSR (IP2SR0_3_0 ,MSIOF2_TXD ), -PINMUX_IPSR_GPSR (IP2SR0_3_0 ,HCTS1_N ), -PINMUX_IPSR_GPSR (IP2SR0_3_0 ,CTS1_N ), +PINMUX_IPSR_GPSR (IP2SR0_3_0 ,HCTS1_N_A ), +PINMUX_IPSR_GPSR (IP2SR0_3_0 ,CTS1_N_A ),PINMUX_IPSR_GPSR (IP2SR0_7_4 ,MSIOF2_SCK ), -PINMUX_IPSR_GPSR (IP2SR0_7_4 ,HRTS1_N ), -PINMUX_IPSR_GPSR (IP2SR0_7_4 ,RTS1_N ), +PINMUX_IPSR_GPSR (IP2SR0_7_4 ,HRTS1_N_A ), +PINMUX_IPSR_GPSR (IP2SR0_7_4 ,RTS1_N_A ),PINMUX_IPSR_GPSR (IP2SR0_11_8 ,MSIOF2_RXD ), -PINMUX_IPSR_GPSR (IP2SR0_11_8 ,HSCK1 ), -PINMUX_IPSR_GPSR (IP2SR0_11_8 ,SCK1 ), +PINMUX_IPSR_GPSR (IP2SR0_11_8 ,HSCK1_A ), +PINMUX_IPSR_GPSR (IP2SR0_11_8 ,SCK1_A ),/* IP0SR1 */ PINMUX_IPSR_GPSR(IP0SR1_3_0, MSIOF1_SS2),
@@ -792,27 +792,27 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP0SR1_23_20 ,MSIOF1_RXD ),PINMUX_IPSR_GPSR (IP0SR1_27_24 ,MSIOF0_SS2 ), -PINMUX_IPSR_GPSR (IP0SR1_27_24 ,HTX1_X ), -PINMUX_IPSR_GPSR (IP0SR1_27_24 ,TX1_X ), +PINMUX_IPSR_GPSR (IP0SR1_27_24 ,HTX1_B ), +PINMUX_IPSR_GPSR (IP0SR1_27_24 ,TX1_B ),PINMUX_IPSR_GPSR (IP0SR1_31_28 ,MSIOF0_SS1 ), -PINMUX_IPSR_GPSR (IP0SR1_31_28 ,HRX1_X ), -PINMUX_IPSR_GPSR (IP0SR1_31_28 ,RX1_X ), +PINMUX_IPSR_GPSR (IP0SR1_31_28 ,HRX1_B ), +PINMUX_IPSR_GPSR (IP0SR1_31_28 ,RX1_B ),/* IP1SR1 */ PINMUX_IPSR_GPSR (IP1SR1_3_0 ,MSIOF0_SYNC ), -PINMUX_IPSR_GPSR (IP1SR1_3_0 ,HCTS1_N_X ), -PINMUX_IPSR_GPSR (IP1SR1_3_0 ,CTS1_N_X ), +PINMUX_IPSR_GPSR (IP1SR1_3_0 ,HCTS1_N_B ), +PINMUX_IPSR_GPSR (IP1SR1_3_0 ,CTS1_N_B ),PINMUX_IPSR_GPSR (IP1SR1_3_0 ,CANFD5_TX_B ),PINMUX_IPSR_GPSR (IP1SR1_7_4 ,MSIOF0_TXD ), -PINMUX_IPSR_GPSR (IP1SR1_7_4 ,HRTS1_N_X ), -PINMUX_IPSR_GPSR (IP1SR1_7_4 ,RTS1_N_X ), +PINMUX_IPSR_GPSR (IP1SR1_7_4 ,HRTS1_N_B ), +PINMUX_IPSR_GPSR (IP1SR1_7_4 ,RTS1_N_B ),PINMUX_IPSR_GPSR (IP1SR1_7_4 ,CANFD5_RX_B ),PINMUX_IPSR_GPSR (IP1SR1_11_8 ,MSIOF0_SCK ), -PINMUX_IPSR_GPSR (IP1SR1_11_8 ,HSCK1_X ), -PINMUX_IPSR_GPSR (IP1SR1_11_8 ,SCK1_X ), +PINMUX_IPSR_GPSR (IP1SR1_11_8 ,HSCK1_B ), +PINMUX_IPSR_GPSR (IP1SR1_11_8 ,SCK1_B ), PINMUX_IPSR_GPSR(IP1SR1_15_12, MSIOF0_RXD),
@@ -1574,49 +1574,48 @@ static const unsigned int hscif0_ctrl_mux[] = { };/* - HSCIF1 ----------------------------------------------------------------- */ -static const unsigned int hscif1_data_pins[] = { -/* HRX1, HTX1 */ +static const unsigned int hscif1_data_a_pins[] = { +/* HRX1_A, HTX1_A */ RCAR_GP_PIN (0 ,15 ),RCAR_GP_PIN (0 ,14 ), }; -static const unsigned int hscif1_data_mux[] = { -HRX1_MARK ,HTX1_MARK , +static const unsigned int hscif1_data_a_mux[] = { +HRX1_A_MARK ,HTX1_A_MARK , }; -static const unsigned int hscif1_clk_pins[] = { -/* HSCK1 */ +static const unsigned int hscif1_clk_a_pins[] = { +/* HSCK1_A */ RCAR_GP_PIN (0 ,18 ), }; -static const unsigned int hscif1_clk_mux[] = { -HSCK1_MARK , +static const unsigned int hscif1_clk_a_mux[] = { +HSCK1_A_MARK , }; -static const unsigned int hscif1_ctrl_pins[] = { -/* HRTS1_N, HCTS1_N */ +static const unsigned int hscif1_ctrl_a_pins[] = { +/* HRTS1_N_A, HCTS1_N_A */ RCAR_GP_PIN (0 ,17 ),RCAR_GP_PIN (0 ,16 ), }; -static const unsigned int hscif1_ctrl_mux[] = { -HRTS1_N_MARK ,HCTS1_N_MARK , +static const unsigned int hscif1_ctrl_a_mux[] = { +HRTS1_N_A_MARK ,HCTS1_N_A_MARK , }; -/* - HSCIF1_X---------------------------------------------------------------- */ -static const unsigned int hscif1_data_x_pins[] = { -/* HRX1_X, HTX1_X */ +static const unsigned int hscif1_data_b_pins[] = { +/* HRX1_B, HTX1_B */ RCAR_GP_PIN (1 ,7 ),RCAR_GP_PIN (1 ,6 ), }; -static const unsigned int hscif1_data_x_mux[] = { -HRX1_X_MARK ,HTX1_X_MARK , +static const unsigned int hscif1_data_b_mux[] = { +HRX1_B_MARK ,HTX1_B_MARK , }; -static const unsigned int hscif1_clk_x_pins[] = { -/* HSCK1_X */ +static const unsigned int hscif1_clk_b_pins[] = { +/* HSCK1_B */ RCAR_GP_PIN (1 ,10 ), }; -static const unsigned int hscif1_clk_x_mux[] = { -HSCK1_X_MARK , +static const unsigned int hscif1_clk_b_mux[] = { +HSCK1_B_MARK , }; -static const unsigned int hscif1_ctrl_x_pins[] = { -/* HRTS1_N_X, HCTS1_N_X */ +static const unsigned int hscif1_ctrl_b_pins[] = { +/* HRTS1_N_B, HCTS1_N_B */ RCAR_GP_PIN (1 ,9 ),RCAR_GP_PIN (1 ,8 ), }; -static const unsigned int hscif1_ctrl_x_mux[] = { -HRTS1_N_X_MARK ,HCTS1_N_X_MARK , +static const unsigned int hscif1_ctrl_b_mux[] = { +HRTS1_N_B_MARK ,HCTS1_N_B_MARK , };/* - HSCIF2 ----------------------------------------------------------------- */
@@ -2236,49 +2235,48 @@ static const unsigned int scif0_ctrl_mux[] = { };/* - SCIF1 ------------------------------------------------------------------ */ -static const unsigned int scif1_data_pins[] = { -/* RX1, TX1 */ +static const unsigned int scif1_data_a_pins[] = { +/* RX1_A, TX1_A */ RCAR_GP_PIN (0 ,15 ),RCAR_GP_PIN (0 ,14 ), }; -static const unsigned int scif1_data_mux[] = { -RX1_MARK ,TX1_MARK , +static const unsigned int scif1_data_a_mux[] = { +RX1_A_MARK ,TX1_A_MARK , }; -static const unsigned int scif1_clk_pins[] = { -/* SCK1 */ +static const unsigned int scif1_clk_a_pins[] = { +/* SCK1_A */ RCAR_GP_PIN (0 ,18 ), }; -static const unsigned int scif1_clk_mux[] = { -SCK1_MARK , +static const unsigned int scif1_clk_a_mux[] = { +SCK1_A_MARK , }; -static const unsigned int scif1_ctrl_pins[] = { -/* RTS1_N, CTS1_N */ +static const unsigned int scif1_ctrl_a_pins[] = { +/* RTS1_N_A, CTS1_N_A */ RCAR_GP_PIN (0 ,17 ),RCAR_GP_PIN (0 ,16 ), }; -static const unsigned int scif1_ctrl_mux[] = { -RTS1_N_MARK ,CTS1_N_MARK , +static const unsigned int scif1_ctrl_a_mux[] = { +RTS1_N_A_MARK ,CTS1_N_A_MARK , }; -/* - SCIF1_X ------------------------------------------------------------------ */ -static const unsigned int scif1_data_x_pins[] = { -/* RX1_X, TX1_X */ +static const unsigned int scif1_data_b_pins[] = { +/* RX1_B, TX1_B */ RCAR_GP_PIN (1 ,7 ),RCAR_GP_PIN (1 ,6 ), }; -static const unsigned int scif1_data_x_mux[] = { -RX1_X_MARK ,TX1_X_MARK , +static const unsigned int scif1_data_b_mux[] = { +RX1_B_MARK ,TX1_B_MARK , }; -static const unsigned int scif1_clk_x_pins[] = { -/* SCK1_X */ +static const unsigned int scif1_clk_b_pins[] = { +/* SCK1_B */ RCAR_GP_PIN (1 ,10 ), }; -static const unsigned int scif1_clk_x_mux[] = { -SCK1_X_MARK , +static const unsigned int scif1_clk_b_mux[] = { +SCK1_B_MARK , }; -static const unsigned int scif1_ctrl_x_pins[] = { -/* RTS1_N_X, CTS1_N_X */ +static const unsigned int scif1_ctrl_b_pins[] = { +/* RTS1_N_B, CTS1_N_B */ RCAR_GP_PIN (1 ,9 ),RCAR_GP_PIN (1 ,8 ), }; -static const unsigned int scif1_ctrl_x_mux[] = { -RTS1_N_X_MARK ,CTS1_N_X_MARK , +static const unsigned int scif1_ctrl_b_mux[] = { +RTS1_N_B_MARK ,CTS1_N_B_MARK , };/* - SCIF3 ------------------------------------------------------------------ */
@@ -2559,12 +2557,12 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {SH_PFC_PIN_GROUP (hscif0_data),SH_PFC_PIN_GROUP (hscif0_clk),SH_PFC_PIN_GROUP (hscif0_ctrl), -SH_PFC_PIN_GROUP (hscif1_data),/* suffix might be updated */ -SH_PFC_PIN_GROUP (hscif1_clk),/* suffix might be updated */ -SH_PFC_PIN_GROUP (hscif1_ctrl),/* suffix might be updated */ -SH_PFC_PIN_GROUP (hscif1_data_x),/* suffix might be updated */ -SH_PFC_PIN_GROUP (hscif1_clk_x),/* suffix might be updated */ -SH_PFC_PIN_GROUP (hscif1_ctrl_x),/* suffix might be updated */ +SH_PFC_PIN_GROUP (hscif1_data_a), +SH_PFC_PIN_GROUP (hscif1_clk_a), +SH_PFC_PIN_GROUP (hscif1_ctrl_a), +SH_PFC_PIN_GROUP (hscif1_data_b), +SH_PFC_PIN_GROUP (hscif1_clk_b), +SH_PFC_PIN_GROUP (hscif1_ctrl_b),SH_PFC_PIN_GROUP (hscif2_data),SH_PFC_PIN_GROUP (hscif2_clk), SH_PFC_PIN_GROUP(hscif2_ctrl),
@@ -2658,12 +2656,12 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {SH_PFC_PIN_GROUP (scif0_data),SH_PFC_PIN_GROUP (scif0_clk),SH_PFC_PIN_GROUP (scif0_ctrl), -SH_PFC_PIN_GROUP (scif1_data),/* suffix might be updated */ -SH_PFC_PIN_GROUP (scif1_clk),/* suffix might be updated */ -SH_PFC_PIN_GROUP (scif1_ctrl),/* suffix might be updated */ -SH_PFC_PIN_GROUP (scif1_data_x),/* suffix might be updated */ -SH_PFC_PIN_GROUP (scif1_clk_x),/* suffix might be updated */ -SH_PFC_PIN_GROUP (scif1_ctrl_x),/* suffix might be updated */ +SH_PFC_PIN_GROUP (scif1_data_a), +SH_PFC_PIN_GROUP (scif1_clk_a), +SH_PFC_PIN_GROUP (scif1_ctrl_a), +SH_PFC_PIN_GROUP (scif1_data_b), +SH_PFC_PIN_GROUP (scif1_clk_b), +SH_PFC_PIN_GROUP (scif1_ctrl_b),SH_PFC_PIN_GROUP (scif3_data),/* suffix might be updated */ SH_PFC_PIN_GROUP (scif3_clk),/* suffix might be updated */ SH_PFC_PIN_GROUP(scif3_ctrl), /* suffix might be updated */
@@ -2778,13 +2776,12 @@ static const char * const hscif0_groups[] = { };static const char *const hscif1_groups[] = { -/* suffix might be updated */ -"hscif1_data" , -"hscif1_clk" , -"hscif1_ctrl" , -"hscif1_data_x" , -"hscif1_clk_x" , -"hscif1_ctrl_x" , +"hscif1_data_a" , +"hscif1_clk_a" , +"hscif1_ctrl_a" , +"hscif1_data_b" , +"hscif1_clk_b" , +"hscif1_ctrl_b" , };static const char *const hscif2_groups[] = {
@@ -2961,13 +2958,12 @@ static const char * const scif0_groups[] = { };static const char *const scif1_groups[] = { -/* suffix might be updated */ -"scif1_data" , -"scif1_clk" , -"scif1_ctrl" , -"scif1_data_x" , -"scif1_clk_x" , -"scif1_ctrl_x" , +"scif1_data_a" , +"scif1_clk_a" , +"scif1_ctrl_a" , +"scif1_data_b" , +"scif1_clk_b" , +"scif1_ctrl_b" , };static const char *const scif3_groups[] = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 255/440 pinctrl: renesas: r8a779g0: Fix (H)SCIF3 suffixes
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 5350f38150a171322b50c0a48efa671885f87050 ]
(H)SCIF instance 3 has two alternate pin groups: "hscif3" and "hscif3_a", resp. "scif3" and "scif3_a", but the actual meanings of the pins within the groups do not match.
Increase uniformity by adopting R-Car V4M naming:
- Rename "hscif3_a" to "hscif3_b",
- Rename "hscif3" to "hscif3_a",
- Rename "scif3" to "scif3_b".
While at it, remove unneeded separators.
--- drivers/pinctrl/renesas/pfc-r8a779g0.c | 192 ++++++++++++------------- 1 file changed, 94 insertions(+), 98 deletions(-)
drivers/pinctrl/renesas/pfc-r8a779g0.c +94 -98
@@ -71,11 +71,11 @@#define GPSR0_0 F_(GP0_00, IP0SR0_3_0)/* GPSR1 */ -#define GPSR1_28 F_(HTX3, IP3SR1_19_16) -#define GPSR1_27 F_(HCTS3_N, IP3SR1_15_12) -#define GPSR1_26 F_(HRTS3_N, IP3SR1_11_8) -#define GPSR1_25 F_(HSCK3, IP3SR1_7_4) -#define GPSR1_24 F_(HRX3, IP3SR1_3_0) +#define GPSR1_28 F_(HTX3_A, IP3SR1_19_16) +#define GPSR1_27 F_(HCTS3_N_A, IP3SR1_15_12) +#define GPSR1_26 F_(HRTS3_N_A, IP3SR1_11_8) +#define GPSR1_25 F_(HSCK3_A, IP3SR1_7_4) +#define GPSR1_24 F_(HRX3_A, IP3SR1_3_0)#define GPSR1_23 F_(GP1_23, IP2SR1_31_28)#define GPSR1_22 F_(AUDIO_CLKIN, IP2SR1_27_24)#define GPSR1_21 F_(AUDIO_CLKOUT, IP2SR1_23_20)
@@ -295,11 +295,11 @@/* SR1 */ /* IP0SR1 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ -#define IP0SR1_3_0 FM(MSIOF1_SS2) FM(HTX3_A) FM(TX3) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR1_7_4 FM(MSIOF1_SS1) FM(HCTS3_N_A) FM(RX3) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR1_11_8 FM(MSIOF1_SYNC) FM(HRTS3_N_A) FM(RTS3_N) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR1_15_12 FM(MSIOF1_SCK) FM(HSCK3_A) FM(CTS3_N) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR1_19_16 FM(MSIOF1_TXD) FM(HRX3_A) FM(SCK3) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR1_3_0 FM(MSIOF1_SS2) FM(HTX3_B) FM(TX3_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR1_7_4 FM(MSIOF1_SS1) FM(HCTS3_N_B) FM(RX3_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR1_11_8 FM(MSIOF1_SYNC) FM(HRTS3_N_B) FM(RTS3_N_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR1_15_12 FM(MSIOF1_SCK) FM(HSCK3_B) FM(CTS3_N_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR1_19_16 FM(MSIOF1_TXD) FM(HRX3_B) FM(SCK3_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR1_23_20 FM(MSIOF1_RXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR1_27_24 FM(MSIOF0_SS2) FM(HTX1_B) FM(TX1_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR1_31_28 FM(MSIOF0_SS1) FM(HRX1_B) FM(RX1_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
@@ -325,11 +325,11 @@#define IP2SR1_31_28 F_(0, 0) FM(TCLK2) FM(MSIOF4_SS1) FM(IRQ3_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)/* IP3SR1 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ -#define IP3SR1_3_0 FM(HRX3) FM(SCK3_A) FM(MSIOF4_SS2) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP3SR1_7_4 FM(HSCK3) FM(CTS3_N_A) FM(MSIOF4_SCK) FM(TPU0TO0_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP3SR1_11_8 FM(HRTS3_N) FM(RTS3_N_A) FM(MSIOF4_TXD) FM(TPU0TO1_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP3SR1_15_12 FM(HCTS3_N) FM(RX3_A) FM(MSIOF4_RXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP3SR1_19_16 FM(HTX3) FM(TX3_A) FM(MSIOF4_SYNC) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP3SR1_3_0 FM(HRX3_A) FM(SCK3_A) FM(MSIOF4_SS2) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP3SR1_7_4 FM(HSCK3_A) FM(CTS3_N_A) FM(MSIOF4_SCK) FM(TPU0TO0_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP3SR1_11_8 FM(HRTS3_N_A) FM(RTS3_N_A) FM(MSIOF4_TXD) FM(TPU0TO1_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP3SR1_15_12 FM(HCTS3_N_A) FM(RX3_A) FM(MSIOF4_RXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP3SR1_19_16 FM(HTX3_A) FM(TX3_A) FM(MSIOF4_SYNC) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)/* SR2 */ /* IP0SR2 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */
@@ -770,24 +770,24 @@ static const u16 pinmux_data[] = {/* IP0SR1 */ PINMUX_IPSR_GPSR (IP0SR1_3_0 ,MSIOF1_SS2 ), -PINMUX_IPSR_GPSR (IP0SR1_3_0 ,HTX3_A ), -PINMUX_IPSR_GPSR (IP0SR1_3_0 ,TX3 ), +PINMUX_IPSR_GPSR (IP0SR1_3_0 ,HTX3_B ), +PINMUX_IPSR_GPSR (IP0SR1_3_0 ,TX3_B ),PINMUX_IPSR_GPSR (IP0SR1_7_4 ,MSIOF1_SS1 ), -PINMUX_IPSR_GPSR (IP0SR1_7_4 ,HCTS3_N_A ), -PINMUX_IPSR_GPSR (IP0SR1_7_4 ,RX3 ), +PINMUX_IPSR_GPSR (IP0SR1_7_4 ,HCTS3_N_B ), +PINMUX_IPSR_GPSR (IP0SR1_7_4 ,RX3_B ),PINMUX_IPSR_GPSR (IP0SR1_11_8 ,MSIOF1_SYNC ), -PINMUX_IPSR_GPSR (IP0SR1_11_8 ,HRTS3_N_A ), -PINMUX_IPSR_GPSR (IP0SR1_11_8 ,RTS3_N ), +PINMUX_IPSR_GPSR (IP0SR1_11_8 ,HRTS3_N_B ), +PINMUX_IPSR_GPSR (IP0SR1_11_8 ,RTS3_N_B ),PINMUX_IPSR_GPSR (IP0SR1_15_12 ,MSIOF1_SCK ), -PINMUX_IPSR_GPSR (IP0SR1_15_12 ,HSCK3_A ), -PINMUX_IPSR_GPSR (IP0SR1_15_12 ,CTS3_N ), +PINMUX_IPSR_GPSR (IP0SR1_15_12 ,HSCK3_B ), +PINMUX_IPSR_GPSR (IP0SR1_15_12 ,CTS3_N_B ),PINMUX_IPSR_GPSR (IP0SR1_19_16 ,MSIOF1_TXD ), -PINMUX_IPSR_GPSR (IP0SR1_19_16 ,HRX3_A ), -PINMUX_IPSR_GPSR (IP0SR1_19_16 ,SCK3 ), +PINMUX_IPSR_GPSR (IP0SR1_19_16 ,HRX3_B ), +PINMUX_IPSR_GPSR (IP0SR1_19_16 ,SCK3_B ), PINMUX_IPSR_GPSR(IP0SR1_23_20, MSIOF1_RXD),
@@ -858,25 +858,25 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP2SR1_31_28 ,IRQ3_B ),/* IP3SR1 */ -PINMUX_IPSR_GPSR (IP3SR1_3_0 ,HRX3 ), +PINMUX_IPSR_GPSR (IP3SR1_3_0 ,HRX3_A ),PINMUX_IPSR_GPSR (IP3SR1_3_0 ,SCK3_A ),PINMUX_IPSR_GPSR (IP3SR1_3_0 ,MSIOF4_SS2 ), -PINMUX_IPSR_GPSR (IP3SR1_7_4 ,HSCK3 ), +PINMUX_IPSR_GPSR (IP3SR1_7_4 ,HSCK3_A ),PINMUX_IPSR_GPSR (IP3SR1_7_4 ,CTS3_N_A ),PINMUX_IPSR_GPSR (IP3SR1_7_4 ,MSIOF4_SCK ),PINMUX_IPSR_GPSR (IP3SR1_7_4 ,TPU0TO0_A ), -PINMUX_IPSR_GPSR (IP3SR1_11_8 ,HRTS3_N ), +PINMUX_IPSR_GPSR (IP3SR1_11_8 ,HRTS3_N_A ),PINMUX_IPSR_GPSR (IP3SR1_11_8 ,RTS3_N_A ),PINMUX_IPSR_GPSR (IP3SR1_11_8 ,MSIOF4_TXD ),PINMUX_IPSR_GPSR (IP3SR1_11_8 ,TPU0TO1_A ), -PINMUX_IPSR_GPSR (IP3SR1_15_12 ,HCTS3_N ), +PINMUX_IPSR_GPSR (IP3SR1_15_12 ,HCTS3_N_A ),PINMUX_IPSR_GPSR (IP3SR1_15_12 ,RX3_A ),PINMUX_IPSR_GPSR (IP3SR1_15_12 ,MSIOF4_RXD ), -PINMUX_IPSR_GPSR (IP3SR1_19_16 ,HTX3 ), +PINMUX_IPSR_GPSR (IP3SR1_19_16 ,HTX3_A ),PINMUX_IPSR_GPSR (IP3SR1_19_16 ,TX3_A ), PINMUX_IPSR_GPSR(IP3SR1_19_16, MSIOF4_SYNC),
@@ -1642,49 +1642,48 @@ static const unsigned int hscif2_ctrl_mux[] = { };/* - HSCIF3 ----------------------------------------------------------------- */ -static const unsigned int hscif3_data_pins[] = { -/* HRX3, HTX3 */ +static const unsigned int hscif3_data_a_pins[] = { +/* HRX3_A, HTX3_A */ RCAR_GP_PIN (1 ,24 ),RCAR_GP_PIN (1 ,28 ), }; -static const unsigned int hscif3_data_mux[] = { -HRX3_MARK ,HTX3_MARK , +static const unsigned int hscif3_data_a_mux[] = { +HRX3_A_MARK ,HTX3_A_MARK , }; -static const unsigned int hscif3_clk_pins[] = { -/* HSCK3 */ +static const unsigned int hscif3_clk_a_pins[] = { +/* HSCK3_A */ RCAR_GP_PIN (1 ,25 ), }; -static const unsigned int hscif3_clk_mux[] = { -HSCK3_MARK , +static const unsigned int hscif3_clk_a_mux[] = { +HSCK3_A_MARK , }; -static const unsigned int hscif3_ctrl_pins[] = { -/* HRTS3_N, HCTS3_N */ +static const unsigned int hscif3_ctrl_a_pins[] = { +/* HRTS3_N_A, HCTS3_N_A */ RCAR_GP_PIN (1 ,26 ),RCAR_GP_PIN (1 ,27 ), }; -static const unsigned int hscif3_ctrl_mux[] = { -HRTS3_N_MARK ,HCTS3_N_MARK , +static const unsigned int hscif3_ctrl_a_mux[] = { +HRTS3_N_A_MARK ,HCTS3_N_A_MARK , }; -/* - HSCIF3_A ----------------------------------------------------------------- */ -static const unsigned int hscif3_data_a_pins[] = { -/* HRX3_A, HTX3_A */ +static const unsigned int hscif3_data_b_pins[] = { +/* HRX3_B, HTX3_B */ RCAR_GP_PIN (1 ,4 ),RCAR_GP_PIN (1 ,0 ), }; -static const unsigned int hscif3_data_a_mux[] = { -HRX3_A_MARK ,HTX3_A_MARK , +static const unsigned int hscif3_data_b_mux[] = { +HRX3_B_MARK ,HTX3_B_MARK , }; -static const unsigned int hscif3_clk_a_pins[] = { -/* HSCK3_A */ +static const unsigned int hscif3_clk_b_pins[] = { +/* HSCK3_B */ RCAR_GP_PIN (1 ,3 ), }; -static const unsigned int hscif3_clk_a_mux[] = { -HSCK3_A_MARK , +static const unsigned int hscif3_clk_b_mux[] = { +HSCK3_B_MARK , }; -static const unsigned int hscif3_ctrl_a_pins[] = { -/* HRTS3_N_A, HCTS3_N_A */ +static const unsigned int hscif3_ctrl_b_pins[] = { +/* HRTS3_N_B, HCTS3_N_B */ RCAR_GP_PIN (1 ,2 ),RCAR_GP_PIN (1 ,1 ), }; -static const unsigned int hscif3_ctrl_a_mux[] = { -HRTS3_N_A_MARK ,HCTS3_N_A_MARK , +static const unsigned int hscif3_ctrl_b_mux[] = { +HRTS3_N_B_MARK ,HCTS3_N_B_MARK , };/* - I2C0 ------------------------------------------------------------------- */
@@ -2280,29 +2279,6 @@ static const unsigned int scif1_ctrl_b_mux[] = { };/* - SCIF3 ------------------------------------------------------------------ */ -static const unsigned int scif3_data_pins[] = { -/* RX3, TX3 */ -RCAR_GP_PIN (1 ,1 ),RCAR_GP_PIN (1 ,0 ), -}; -static const unsigned int scif3_data_mux[] = { -RX3_MARK ,TX3_MARK , -}; -static const unsigned int scif3_clk_pins[] = { -/* SCK3 */ -RCAR_GP_PIN (1 ,4 ), -}; -static const unsigned int scif3_clk_mux[] = { -SCK3_MARK , -}; -static const unsigned int scif3_ctrl_pins[] = { -/* RTS3_N, CTS3_N */ -RCAR_GP_PIN (1 ,2 ),RCAR_GP_PIN (1 ,3 ), -}; -static const unsigned int scif3_ctrl_mux[] = { -RTS3_N_MARK ,CTS3_N_MARK , -}; - -/* - SCIF3_A ------------------------------------------------------------------ */ static const unsigned int scif3_data_a_pins[] = {/* RX3_A, TX3_A */ RCAR_GP_PIN (1 ,27 ),RCAR_GP_PIN (1 ,28 ),
@@ -2325,6 +2301,28 @@ static const unsigned int scif3_ctrl_a_mux[] = { RTS3_N_A_MARK, CTS3_N_A_MARK, }; +static const unsigned int scif3_data_b_pins[] = { +/* RX3_B, TX3_B */ +RCAR_GP_PIN (1 ,1 ),RCAR_GP_PIN (1 ,0 ), +}; +static const unsigned int scif3_data_b_mux[] = { +RX3_B_MARK ,TX3_B_MARK , +}; +static const unsigned int scif3_clk_b_pins[] = { +/* SCK3_B */ +RCAR_GP_PIN (1 ,4 ), +}; +static const unsigned int scif3_clk_b_mux[] = { +SCK3_B_MARK , +}; +static const unsigned int scif3_ctrl_b_pins[] = { +/* RTS3_N_B, CTS3_N_B */ +RCAR_GP_PIN (1 ,2 ),RCAR_GP_PIN (1 ,3 ), +}; +static const unsigned int scif3_ctrl_b_mux[] = { +RTS3_N_B_MARK ,CTS3_N_B_MARK , +}; +/* - SCIF4 ------------------------------------------------------------------ */ static const unsigned int scif4_data_pins[] = {/* RX4, TX4 */
@@ -2566,12 +2564,12 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {SH_PFC_PIN_GROUP (hscif2_data),SH_PFC_PIN_GROUP (hscif2_clk),SH_PFC_PIN_GROUP (hscif2_ctrl), -SH_PFC_PIN_GROUP (hscif3_data),/* suffix might be updated */ -SH_PFC_PIN_GROUP (hscif3_clk),/* suffix might be updated */ -SH_PFC_PIN_GROUP (hscif3_ctrl),/* suffix might be updated */ -SH_PFC_PIN_GROUP (hscif3_data_a),/* suffix might be updated */ -SH_PFC_PIN_GROUP (hscif3_clk_a),/* suffix might be updated */ -SH_PFC_PIN_GROUP (hscif3_ctrl_a),/* suffix might be updated */ +SH_PFC_PIN_GROUP (hscif3_data_a), +SH_PFC_PIN_GROUP (hscif3_clk_a), +SH_PFC_PIN_GROUP (hscif3_ctrl_a), +SH_PFC_PIN_GROUP (hscif3_data_b), +SH_PFC_PIN_GROUP (hscif3_clk_b), +SH_PFC_PIN_GROUP (hscif3_ctrl_b),SH_PFC_PIN_GROUP (i2c0), SH_PFC_PIN_GROUP(i2c1),
@@ -2662,12 +2660,12 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {SH_PFC_PIN_GROUP (scif1_data_b),SH_PFC_PIN_GROUP (scif1_clk_b),SH_PFC_PIN_GROUP (scif1_ctrl_b), -SH_PFC_PIN_GROUP (scif3_data),/* suffix might be updated */ -SH_PFC_PIN_GROUP (scif3_clk),/* suffix might be updated */ -SH_PFC_PIN_GROUP (scif3_ctrl),/* suffix might be updated */ -SH_PFC_PIN_GROUP (scif3_data_a),/* suffix might be updated */ -SH_PFC_PIN_GROUP (scif3_clk_a),/* suffix might be updated */ -SH_PFC_PIN_GROUP (scif3_ctrl_a),/* suffix might be updated */ +SH_PFC_PIN_GROUP (scif3_data_a), +SH_PFC_PIN_GROUP (scif3_clk_a), +SH_PFC_PIN_GROUP (scif3_ctrl_a), +SH_PFC_PIN_GROUP (scif3_data_b), +SH_PFC_PIN_GROUP (scif3_clk_b), +SH_PFC_PIN_GROUP (scif3_ctrl_b),SH_PFC_PIN_GROUP (scif4_data),SH_PFC_PIN_GROUP (scif4_clk), SH_PFC_PIN_GROUP(scif4_ctrl),
@@ -2791,13 +2789,12 @@ static const char * const hscif2_groups[] = { };static const char *const hscif3_groups[] = { -/* suffix might be updated */ -"hscif3_data" , -"hscif3_clk" , -"hscif3_ctrl" ,"hscif3_data_a" ,"hscif3_clk_a" ,"hscif3_ctrl_a" , +"hscif3_data_b" , +"hscif3_clk_b" , +"hscif3_ctrl_b" , };static const char *const i2c0_groups[] = {
@@ -2967,13 +2964,12 @@ static const char * const scif1_groups[] = { };static const char *const scif3_groups[] = { -/* suffix might be updated */ -"scif3_data" , -"scif3_clk" , -"scif3_ctrl" ,"scif3_data_a" ,"scif3_clk_a" ,"scif3_ctrl_a" , +"scif3_data_b" , +"scif3_clk_b" , +"scif3_ctrl_b" , };static const char *const scif4_groups[] = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 256/440 pinctrl: renesas: r8a779g0: Fix IRQ suffixes
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit c391dcde3884dbbea37f57dd2625225d8661da97 ]
The suffixes of the IRQ identifiers for external interrupts 0-3 are inconsistent:
- "IRQ0" and "IRQ0_A",
- "IRQ1" and "IRQ1_A",
- "IRQ2" and "IRQ2_A",
- "IRQ3" and "IRQ3_B".
The suffixes for external interrupts 4 and 5 do follow conventional naming:
- "IRQ4A" and IRQ4_B",
- "IRQ5".
Fix this by adopting R-Car V4M naming:
- Rename "IRQ[0-2]_A" to "IRQ[0-2]_B",
- Rename "IRQ[0-3]" to "IRQ[0-3]_A".
--- drivers/pinctrl/renesas/pfc-r8a779g0.c | 36 +++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-)
drivers/pinctrl/renesas/pfc-r8a779g0.c +18 -18
@@ -62,10 +62,10 @@#define GPSR0_9 F_(MSIOF5_SYNC, IP1SR0_7_4)#define GPSR0_8 F_(MSIOF5_SS1, IP1SR0_3_0)#define GPSR0_7 F_(MSIOF5_SS2, IP0SR0_31_28) -#define GPSR0_6 F_(IRQ0, IP0SR0_27_24) -#define GPSR0_5 F_(IRQ1, IP0SR0_23_20) -#define GPSR0_4 F_(IRQ2, IP0SR0_19_16) -#define GPSR0_3 F_(IRQ3, IP0SR0_15_12) +#define GPSR0_6 F_(IRQ0_A, IP0SR0_27_24) +#define GPSR0_5 F_(IRQ1_A, IP0SR0_23_20) +#define GPSR0_4 F_(IRQ2_A, IP0SR0_19_16) +#define GPSR0_3 F_(IRQ3_A, IP0SR0_15_12)#define GPSR0_2 F_(GP0_02, IP0SR0_11_8)#define GPSR0_1 F_(GP0_01, IP0SR0_7_4)#define GPSR0_0 F_(GP0_00, IP0SR0_3_0)
@@ -272,10 +272,10 @@#define IP0SR0_3_0 F_(0, 0) FM(ERROROUTC_N_B) FM(TCLK2_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR0_7_4 F_(0, 0) FM(MSIOF3_SS1) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR0_11_8 F_(0, 0) FM(MSIOF3_SS2) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR0_15_12 FM(IRQ3) FM(MSIOF3_SCK) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR0_19_16 FM(IRQ2) FM(MSIOF3_TXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR0_23_20 FM(IRQ1) FM(MSIOF3_RXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR0_27_24 FM(IRQ0) FM(MSIOF3_SYNC) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR0_15_12 FM(IRQ3_A) FM(MSIOF3_SCK) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR0_19_16 FM(IRQ2_A) FM(MSIOF3_TXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR0_23_20 FM(IRQ1_A) FM(MSIOF3_RXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR0_27_24 FM(IRQ0_A) FM(MSIOF3_SYNC) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR0_31_28 FM(MSIOF5_SS2) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)/* IP1SR0 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */
@@ -284,7 +284,7 @@#define IP1SR0_11_8 FM(MSIOF5_TXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR0_15_12 FM(MSIOF5_SCK) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR0_19_16 FM(MSIOF5_RXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR0_23_20 FM(MSIOF2_SS2) FM(TCLK1) FM(IRQ2_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR0_23_20 FM(MSIOF2_SS2) FM(TCLK1) FM(IRQ2_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR0_27_24 FM(MSIOF2_SS1) FM(HTX1_A) FM(TX1_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR0_31_28 FM(MSIOF2_SYNC) FM(HRX1_A) FM(RX1_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
@@ -319,8 +319,8 @@#define IP2SR1_7_4 FM(SCIF_CLK) FM(IRQ4_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP2SR1_11_8 FM(SSI_SCK) FM(TCLK3) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP2SR1_15_12 FM(SSI_WS) FM(TCLK4) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP2SR1_19_16 FM(SSI_SD) FM(IRQ0_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP2SR1_23_20 FM(AUDIO_CLKOUT) FM(IRQ1_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP2SR1_19_16 FM(SSI_SD) FM(IRQ0_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP2SR1_23_20 FM(AUDIO_CLKOUT) FM(IRQ1_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP2SR1_27_24 FM(AUDIO_CLKIN) FM(PWM3_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP2SR1_31_28 F_(0, 0) FM(TCLK2) FM(MSIOF4_SS1) FM(IRQ3_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
@@ -718,16 +718,16 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP0SR0_11_8 ,MSIOF3_SS2 ), -PINMUX_IPSR_GPSR (IP0SR0_15_12 ,IRQ3 ), +PINMUX_IPSR_GPSR (IP0SR0_15_12 ,IRQ3_A ),PINMUX_IPSR_GPSR (IP0SR0_15_12 ,MSIOF3_SCK ), -PINMUX_IPSR_GPSR (IP0SR0_19_16 ,IRQ2 ), +PINMUX_IPSR_GPSR (IP0SR0_19_16 ,IRQ2_A ),PINMUX_IPSR_GPSR (IP0SR0_19_16 ,MSIOF3_TXD ), -PINMUX_IPSR_GPSR (IP0SR0_23_20 ,IRQ1 ), +PINMUX_IPSR_GPSR (IP0SR0_23_20 ,IRQ1_A ),PINMUX_IPSR_GPSR (IP0SR0_23_20 ,MSIOF3_RXD ), -PINMUX_IPSR_GPSR (IP0SR0_27_24 ,IRQ0 ), +PINMUX_IPSR_GPSR (IP0SR0_27_24 ,IRQ0_A ),PINMUX_IPSR_GPSR (IP0SR0_27_24 ,MSIOF3_SYNC ), PINMUX_IPSR_GPSR(IP0SR0_31_28, MSIOF5_SS2),
@@ -745,7 +745,7 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP1SR0_23_20 ,MSIOF2_SS2 ),PINMUX_IPSR_GPSR (IP1SR0_23_20 ,TCLK1 ), -PINMUX_IPSR_GPSR (IP1SR0_23_20 ,IRQ2_A ), +PINMUX_IPSR_GPSR (IP1SR0_23_20 ,IRQ2_B ),PINMUX_IPSR_GPSR (IP1SR0_27_24 ,MSIOF2_SS1 ), PINMUX_IPSR_GPSR(IP1SR0_27_24, HTX1_A),
@@ -845,10 +845,10 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP2SR1_15_12 ,TCLK4 ),PINMUX_IPSR_GPSR (IP2SR1_19_16 ,SSI_SD ), -PINMUX_IPSR_GPSR (IP2SR1_19_16 ,IRQ0_A ), +PINMUX_IPSR_GPSR (IP2SR1_19_16 ,IRQ0_B ),PINMUX_IPSR_GPSR (IP2SR1_23_20 ,AUDIO_CLKOUT ), -PINMUX_IPSR_GPSR (IP2SR1_23_20 ,IRQ1_A ), +PINMUX_IPSR_GPSR (IP2SR1_23_20 ,IRQ1_B ),PINMUX_IPSR_GPSR (IP2SR1_27_24 ,AUDIO_CLKIN ), PINMUX_IPSR_GPSR(IP2SR1_27_24, PWM3_A),
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 257/440 pinctrl: renesas: r8a779g0: FIX PWM suffixes
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 0aabdc9a4d3644fd57d804b283b2ab0f9c28dc6c ]
PWM channels 0, 2, 8, and 9 do not have alternate pins. Remove their "_a" or "_b" suffixes to increase uniformity.
--- drivers/pinctrl/renesas/pfc-r8a779g0.c | 76 ++++++++++++-------------- 1 file changed, 36 insertions(+), 40 deletions(-)
drivers/pinctrl/renesas/pfc-r8a779g0.c +36 -40
@@ -310,9 +310,9 @@#define IP1SR1_11_8 FM(MSIOF0_SCK) FM(HSCK1_B) FM(SCK1_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR1_15_12 FM(MSIOF0_RXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR1_19_16 FM(HTX0) FM(TX0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR1_23_20 FM(HCTS0_N) FM(CTS0_N) FM(PWM8_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR1_27_24 FM(HRTS0_N) FM(RTS0_N) FM(PWM9_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR1_31_28 FM(HSCK0) FM(SCK0) FM(PWM0_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR1_23_20 FM(HCTS0_N) FM(CTS0_N) FM(PWM8) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR1_27_24 FM(HRTS0_N) FM(RTS0_N) FM(PWM9) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR1_31_28 FM(HSCK0) FM(SCK0) FM(PWM0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)/* IP2SR1 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ #define IP2SR1_3_0 FM(HRX0) FM(RX0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
@@ -349,7 +349,7 @@#define IP1SR2_15_12 FM(CANFD0_RX) FM(STPWT_EXTFXR) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_19_16 FM(CANFD2_TX) FM(TPU0TO2) F_(0, 0) FM(TCLK3_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_23_20 FM(CANFD2_RX) FM(TPU0TO3) FM(PWM1_B) FM(TCLK4_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR2_27_24 FM(CANFD3_TX) F_(0, 0) FM(PWM2_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR2_27_24 FM(CANFD3_TX) F_(0, 0) FM(PWM2) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_31_28 FM(CANFD3_RX) F_(0, 0) FM(PWM3_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)/* IP2SR2 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */
@@ -821,15 +821,15 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP1SR1_23_20 ,HCTS0_N ),PINMUX_IPSR_GPSR (IP1SR1_23_20 ,CTS0_N ), -PINMUX_IPSR_GPSR (IP1SR1_23_20 ,PWM8_A ), +PINMUX_IPSR_GPSR (IP1SR1_23_20 ,PWM8 ),PINMUX_IPSR_GPSR (IP1SR1_27_24 ,HRTS0_N ),PINMUX_IPSR_GPSR (IP1SR1_27_24 ,RTS0_N ), -PINMUX_IPSR_GPSR (IP1SR1_27_24 ,PWM9_A ), +PINMUX_IPSR_GPSR (IP1SR1_27_24 ,PWM9 ),PINMUX_IPSR_GPSR (IP1SR1_31_28 ,HSCK0 ),PINMUX_IPSR_GPSR (IP1SR1_31_28 ,SCK0 ), -PINMUX_IPSR_GPSR (IP1SR1_31_28 ,PWM0_A ), +PINMUX_IPSR_GPSR (IP1SR1_31_28 ,PWM0 ),/* IP2SR1 */ PINMUX_IPSR_GPSR(IP2SR1_3_0, HRX0),
@@ -931,7 +931,7 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP1SR2_23_20 ,TCLK4_A ),PINMUX_IPSR_GPSR (IP1SR2_27_24 ,CANFD3_TX ), -PINMUX_IPSR_GPSR (IP1SR2_27_24 ,PWM2_B ), +PINMUX_IPSR_GPSR (IP1SR2_27_24 ,PWM2 ),PINMUX_IPSR_GPSR (IP1SR2_31_28 ,CANFD3_RX ), PINMUX_IPSR_GPSR(IP1SR2_31_28, PWM3_B),
@@ -2066,13 +2066,13 @@ static const unsigned int pcie1_clkreq_n_mux[] = { PCIE1_CLKREQ_N_MARK, }; -/* - PWM0_A ------------------------------------------------------------------- */ -static const unsigned int pwm0_a_pins[] = { -/* PWM0_A */ +/* - PWM0 ------------------------------------------------------------------- */ +static const unsigned int pwm0_pins[] = { +/* PWM0 */ RCAR_GP_PIN (1 ,15 ), }; -static const unsigned int pwm0_a_mux[] = { -PWM0_A_MARK , +static const unsigned int pwm0_mux[] = { +PWM0_MARK , };/* - PWM1_A ------------------------------------------------------------------- */
@@ -2093,13 +2093,13 @@ static const unsigned int pwm1_b_mux[] = { PWM1_B_MARK, }; -/* - PWM2_B ------------------------------------------------------------------- */ -static const unsigned int pwm2_b_pins[] = { -/* PWM2_B */ +/* - PWM2 ------------------------------------------------------------------- */ +static const unsigned int pwm2_pins[] = { +/* PWM2 */ RCAR_GP_PIN (2 ,14 ), }; -static const unsigned int pwm2_b_mux[] = { -PWM2_B_MARK , +static const unsigned int pwm2_mux[] = { +PWM2_MARK , };/* - PWM3_A ------------------------------------------------------------------- */
@@ -2156,22 +2156,22 @@ static const unsigned int pwm7_mux[] = { PWM7_MARK, }; -/* - PWM8_A ------------------------------------------------------------------- */ -static const unsigned int pwm8_a_pins[] = { -/* PWM8_A */ +/* - PWM8 ------------------------------------------------------------------- */ +static const unsigned int pwm8_pins[] = { +/* PWM8 */ RCAR_GP_PIN (1 ,13 ), }; -static const unsigned int pwm8_a_mux[] = { -PWM8_A_MARK , +static const unsigned int pwm8_mux[] = { +PWM8_MARK , }; -/* - PWM9_A ------------------------------------------------------------------- */ -static const unsigned int pwm9_a_pins[] = { -/* PWM9_A */ +/* - PWM9 ------------------------------------------------------------------- */ +static const unsigned int pwm9_pins[] = { +/* PWM9 */ RCAR_GP_PIN (1 ,14 ), }; -static const unsigned int pwm9_a_mux[] = { -PWM9_A_MARK , +static const unsigned int pwm9_mux[] = { +PWM9_MARK , };/* - QSPI0 ------------------------------------------------------------------ */
@@ -2631,18 +2631,18 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {SH_PFC_PIN_GROUP (pcie0_clkreq_n),SH_PFC_PIN_GROUP (pcie1_clkreq_n), -SH_PFC_PIN_GROUP (pwm0_a),/* suffix might be updated */ +SH_PFC_PIN_GROUP (pwm0),SH_PFC_PIN_GROUP (pwm1_a),SH_PFC_PIN_GROUP (pwm1_b), -SH_PFC_PIN_GROUP (pwm2_b),/* suffix might be updated */ +SH_PFC_PIN_GROUP (pwm2),SH_PFC_PIN_GROUP (pwm3_a),SH_PFC_PIN_GROUP (pwm3_b),SH_PFC_PIN_GROUP (pwm4),SH_PFC_PIN_GROUP (pwm5),SH_PFC_PIN_GROUP (pwm6),SH_PFC_PIN_GROUP (pwm7), -SH_PFC_PIN_GROUP (pwm8_a),/* suffix might be updated */ -SH_PFC_PIN_GROUP (pwm9_a),/* suffix might be updated */ +SH_PFC_PIN_GROUP (pwm8), +SH_PFC_PIN_GROUP (pwm9),SH_PFC_PIN_GROUP (qspi0_ctrl), BUS_DATA_PIN_GROUP(qspi0_data, 2),
@@ -2891,8 +2891,7 @@ static const char * const pcie_groups[] = { };static const char *const pwm0_groups[] = { -/* suffix might be updated */ -"pwm0_a" , +"pwm0" , };static const char *const pwm1_groups[] = {
@@ -2901,8 +2900,7 @@ static const char * const pwm1_groups[] = { };static const char *const pwm2_groups[] = { -/* suffix might be updated */ -"pwm2_b" , +"pwm2" , };static const char *const pwm3_groups[] = {
@@ -2927,13 +2925,11 @@ static const char * const pwm7_groups[] = { };static const char *const pwm8_groups[] = { -/* suffix might be updated */ -"pwm8_a" , +"pwm8" , };static const char *const pwm9_groups[] = { -/* suffix might be updated */ -"pwm9_a" , +"pwm9" , };static const char *const qspi0_groups[] = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 258/440 pinctrl: renesas: r8a779g0: Fix TCLK suffixes
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit bfd2428f3a80647af681df4793e473258aa755da ]
The Pin Multiplex attachment in Rev.1.10 of the R-Car V4H Series Hardware User's Manual still has two alternate pins named both TCLK3 and TCLK4. To differentiate, the pin control driver uses "TCLK[34]" and "TCLK[34]_X". In addition, there are alternate pins without suffix, and with an "_A" or "_B" suffix.
Increase uniformity by adopting R-Car V4M naming:
- Rename "TCLK2_B" to "TCLK2_C",
- Rename "TCLK[12]_A" to "TCLK[12]_B",
- Rename "TCLK[12]" to "TCLK[12]_A",
- Rename "TCLK[34]_A" to "TCLK[34]_C",
- Rename "TCLK[34]_X" to "TCLK[34]_A",
- Rename "TCLK[34]" to "TCLK[34]_B".
--- drivers/pinctrl/renesas/pfc-r8a779g0.c | 44 +++++++++++++------------- 1 file changed, 22 insertions(+), 22 deletions(-)
drivers/pinctrl/renesas/pfc-r8a779g0.c +22 -22
@@ -269,7 +269,7 @@/* SR0 */ /* IP0SR0 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ -#define IP0SR0_3_0 F_(0, 0) FM(ERROROUTC_N_B) FM(TCLK2_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR0_3_0 F_(0, 0) FM(ERROROUTC_N_B) FM(TCLK2_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR0_7_4 F_(0, 0) FM(MSIOF3_SS1) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR0_11_8 F_(0, 0) FM(MSIOF3_SS2) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR0_15_12 FM(IRQ3_A) FM(MSIOF3_SCK) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
@@ -284,7 +284,7 @@#define IP1SR0_11_8 FM(MSIOF5_TXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR0_15_12 FM(MSIOF5_SCK) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR0_19_16 FM(MSIOF5_RXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR0_23_20 FM(MSIOF2_SS2) FM(TCLK1) FM(IRQ2_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR0_23_20 FM(MSIOF2_SS2) FM(TCLK1_A) FM(IRQ2_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR0_27_24 FM(MSIOF2_SS1) FM(HTX1_A) FM(TX1_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR0_31_28 FM(MSIOF2_SYNC) FM(HRX1_A) FM(RX1_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
@@ -317,12 +317,12 @@/* IP2SR1 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ #define IP2SR1_3_0 FM(HRX0) FM(RX0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP2SR1_7_4 FM(SCIF_CLK) FM(IRQ4_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP2SR1_11_8 FM(SSI_SCK) FM(TCLK3) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP2SR1_15_12 FM(SSI_WS) FM(TCLK4) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP2SR1_11_8 FM(SSI_SCK) FM(TCLK3_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP2SR1_15_12 FM(SSI_WS) FM(TCLK4_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP2SR1_19_16 FM(SSI_SD) FM(IRQ0_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP2SR1_23_20 FM(AUDIO_CLKOUT) FM(IRQ1_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP2SR1_27_24 FM(AUDIO_CLKIN) FM(PWM3_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP2SR1_31_28 F_(0, 0) FM(TCLK2) FM(MSIOF4_SS1) FM(IRQ3_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP2SR1_31_28 F_(0, 0) FM(TCLK2_A) FM(MSIOF4_SS1) FM(IRQ3_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)/* IP3SR1 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ #define IP3SR1_3_0 FM(HRX3_A) FM(SCK3_A) FM(MSIOF4_SS2) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
@@ -340,15 +340,15 @@#define IP0SR2_19_16 FM(RXDB_EXTFXR) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_23_20 FM(FXR_TXENB_N_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_27_24 FM(FXR_TXDB) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR2_31_28 FM(TPU0TO1) FM(CANFD6_TX) F_(0, 0) FM(TCLK2_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR2_31_28 FM(TPU0TO1) FM(CANFD6_TX) F_(0, 0) FM(TCLK2_C) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)/* IP1SR2 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ -#define IP1SR2_3_0 FM(TPU0TO0) FM(CANFD6_RX) F_(0, 0) FM(TCLK1_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR2_3_0 FM(TPU0TO0) FM(CANFD6_RX) F_(0, 0) FM(TCLK1_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_7_4 FM(CAN_CLK) FM(FXR_TXENA_N_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_11_8 FM(CANFD0_TX) FM(FXR_TXENB_N_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_15_12 FM(CANFD0_RX) FM(STPWT_EXTFXR) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR2_19_16 FM(CANFD2_TX) FM(TPU0TO2) F_(0, 0) FM(TCLK3_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR2_23_20 FM(CANFD2_RX) FM(TPU0TO3) FM(PWM1_B) FM(TCLK4_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR2_19_16 FM(CANFD2_TX) FM(TPU0TO2) F_(0, 0) FM(TCLK3_C) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR2_23_20 FM(CANFD2_RX) FM(TPU0TO3) FM(PWM1_B) FM(TCLK4_C) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_27_24 FM(CANFD3_TX) F_(0, 0) FM(PWM2) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_31_28 FM(CANFD3_RX) F_(0, 0) FM(PWM3_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
@@ -375,8 +375,8 @@#define IP1SR3_11_8 FM(MMC_SD_CMD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR3_15_12 FM(SD_CD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR3_19_16 FM(SD_WP) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR3_23_20 FM(IPC_CLKIN) FM(IPC_CLKEN_IN) FM(PWM1_A) FM(TCLK3_X) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR3_27_24 FM(IPC_CLKOUT) FM(IPC_CLKEN_OUT) FM(ERROROUTC_N_A) FM(TCLK4_X) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR3_23_20 FM(IPC_CLKIN) FM(IPC_CLKEN_IN) FM(PWM1_A) FM(TCLK3_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR3_27_24 FM(IPC_CLKOUT) FM(IPC_CLKEN_OUT) FM(ERROROUTC_N_A) FM(TCLK4_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR3_31_28 FM(QSPI0_SSL) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)/* IP2SR3 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */
@@ -712,7 +712,7 @@ static const u16 pinmux_data[] = {/* IP0SR0 */ PINMUX_IPSR_GPSR (IP0SR0_3_0 ,ERROROUTC_N_B ), -PINMUX_IPSR_GPSR (IP0SR0_3_0 ,TCLK2_A ), +PINMUX_IPSR_GPSR (IP0SR0_3_0 ,TCLK2_B ), PINMUX_IPSR_GPSR(IP0SR0_7_4, MSIOF3_SS1),
@@ -744,7 +744,7 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP1SR0_19_16 ,MSIOF5_RXD ),PINMUX_IPSR_GPSR (IP1SR0_23_20 ,MSIOF2_SS2 ), -PINMUX_IPSR_GPSR (IP1SR0_23_20 ,TCLK1 ), +PINMUX_IPSR_GPSR (IP1SR0_23_20 ,TCLK1_A ),PINMUX_IPSR_GPSR (IP1SR0_23_20 ,IRQ2_B ), PINMUX_IPSR_GPSR(IP1SR0_27_24, MSIOF2_SS1),
@@ -839,10 +839,10 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP2SR1_7_4 ,IRQ4_A ),PINMUX_IPSR_GPSR (IP2SR1_11_8 ,SSI_SCK ), -PINMUX_IPSR_GPSR (IP2SR1_11_8 ,TCLK3 ), +PINMUX_IPSR_GPSR (IP2SR1_11_8 ,TCLK3_B ),PINMUX_IPSR_GPSR (IP2SR1_15_12 ,SSI_WS ), -PINMUX_IPSR_GPSR (IP2SR1_15_12 ,TCLK4 ), +PINMUX_IPSR_GPSR (IP2SR1_15_12 ,TCLK4_B ),PINMUX_IPSR_GPSR (IP2SR1_19_16 ,SSI_SD ), PINMUX_IPSR_GPSR(IP2SR1_19_16, IRQ0_B),
@@ -853,7 +853,7 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP2SR1_27_24 ,AUDIO_CLKIN ),PINMUX_IPSR_GPSR (IP2SR1_27_24 ,PWM3_A ), -PINMUX_IPSR_GPSR (IP2SR1_31_28 ,TCLK2 ), +PINMUX_IPSR_GPSR (IP2SR1_31_28 ,TCLK2_A ),PINMUX_IPSR_GPSR (IP2SR1_31_28 ,MSIOF4_SS1 ), PINMUX_IPSR_GPSR(IP2SR1_31_28, IRQ3_B),
@@ -905,12 +905,12 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP0SR2_31_28 ,TPU0TO1 ),PINMUX_IPSR_GPSR (IP0SR2_31_28 ,CANFD6_TX ), -PINMUX_IPSR_GPSR (IP0SR2_31_28 ,TCLK2_B ), +PINMUX_IPSR_GPSR (IP0SR2_31_28 ,TCLK2_C ),/* IP1SR2 */ PINMUX_IPSR_GPSR (IP1SR2_3_0 ,TPU0TO0 ),PINMUX_IPSR_GPSR (IP1SR2_3_0 ,CANFD6_RX ), -PINMUX_IPSR_GPSR (IP1SR2_3_0 ,TCLK1_A ), +PINMUX_IPSR_GPSR (IP1SR2_3_0 ,TCLK1_B ),PINMUX_IPSR_GPSR (IP1SR2_7_4 ,CAN_CLK ), PINMUX_IPSR_GPSR(IP1SR2_7_4, FXR_TXENA_N_B),
@@ -923,12 +923,12 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP1SR2_19_16 ,CANFD2_TX ),PINMUX_IPSR_GPSR (IP1SR2_19_16 ,TPU0TO2 ), -PINMUX_IPSR_GPSR (IP1SR2_19_16 ,TCLK3_A ), +PINMUX_IPSR_GPSR (IP1SR2_19_16 ,TCLK3_C ),PINMUX_IPSR_GPSR (IP1SR2_23_20 ,CANFD2_RX ),PINMUX_IPSR_GPSR (IP1SR2_23_20 ,TPU0TO3 ),PINMUX_IPSR_GPSR (IP1SR2_23_20 ,PWM1_B ), -PINMUX_IPSR_GPSR (IP1SR2_23_20 ,TCLK4_A ), +PINMUX_IPSR_GPSR (IP1SR2_23_20 ,TCLK4_C ),PINMUX_IPSR_GPSR (IP1SR2_27_24 ,CANFD3_TX ), PINMUX_IPSR_GPSR(IP1SR2_27_24, PWM2),
@@ -973,12 +973,12 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP1SR3_23_20 ,IPC_CLKIN ),PINMUX_IPSR_GPSR (IP1SR3_23_20 ,IPC_CLKEN_IN ),PINMUX_IPSR_GPSR (IP1SR3_23_20 ,PWM1_A ), -PINMUX_IPSR_GPSR (IP1SR3_23_20 ,TCLK3_X ), +PINMUX_IPSR_GPSR (IP1SR3_23_20 ,TCLK3_A ),PINMUX_IPSR_GPSR (IP1SR3_27_24 ,IPC_CLKOUT ),PINMUX_IPSR_GPSR (IP1SR3_27_24 ,IPC_CLKEN_OUT ),PINMUX_IPSR_GPSR (IP1SR3_27_24 ,ERROROUTC_N_A ), -PINMUX_IPSR_GPSR (IP1SR3_27_24 ,TCLK4_X ), +PINMUX_IPSR_GPSR (IP1SR3_27_24 ,TCLK4_A ), PINMUX_IPSR_GPSR(IP1SR3_31_28, QSPI0_SSL),
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 259/440 pinctrl: renesas: r8a779g0: Fix TPU suffixes
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 3d144ef10a448f89065dcff39c40d90ac18e035e ]
The Timer Pulse Unit channels have two alternate pin groups:
"tpu_to[0-3]" and "tpu_to[0-3]_a".
Increase uniformity by adopting R-Car V4M naming:
- Rename "tpu_to[0-3]_a" to "tpu_to[0-3]_b",
- Rename "tpu_to[0-3]" to "tpu_to[0-3]_a",
--- drivers/pinctrl/renesas/pfc-r8a779g0.c | 128 ++++++++++++------------- 1 file changed, 63 insertions(+), 65 deletions(-)
drivers/pinctrl/renesas/pfc-r8a779g0.c +63 -65
@@ -113,8 +113,8 @@#define GPSR2_11 F_(CANFD0_RX, IP1SR2_15_12)#define GPSR2_10 F_(CANFD0_TX, IP1SR2_11_8)#define GPSR2_9 F_(CAN_CLK, IP1SR2_7_4) -#define GPSR2_8 F_(TPU0TO0, IP1SR2_3_0) -#define GPSR2_7 F_(TPU0TO1, IP0SR2_31_28) +#define GPSR2_8 F_(TPU0TO0_A, IP1SR2_3_0) +#define GPSR2_7 F_(TPU0TO1_A, IP0SR2_31_28)#define GPSR2_6 F_(FXR_TXDB, IP0SR2_27_24)#define GPSR2_5 F_(FXR_TXENB_N_A, IP0SR2_23_20)#define GPSR2_4 F_(RXDB_EXTFXR, IP0SR2_19_16)
@@ -326,29 +326,29 @@/* IP3SR1 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ #define IP3SR1_3_0 FM(HRX3_A) FM(SCK3_A) FM(MSIOF4_SS2) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP3SR1_7_4 FM(HSCK3_A) FM(CTS3_N_A) FM(MSIOF4_SCK) FM(TPU0TO0_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP3SR1_11_8 FM(HRTS3_N_A) FM(RTS3_N_A) FM(MSIOF4_TXD) FM(TPU0TO1_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP3SR1_7_4 FM(HSCK3_A) FM(CTS3_N_A) FM(MSIOF4_SCK) FM(TPU0TO0_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP3SR1_11_8 FM(HRTS3_N_A) FM(RTS3_N_A) FM(MSIOF4_TXD) FM(TPU0TO1_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP3SR1_15_12 FM(HCTS3_N_A) FM(RX3_A) FM(MSIOF4_RXD) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP3SR1_19_16 FM(HTX3_A) FM(TX3_A) FM(MSIOF4_SYNC) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)/* SR2 */ /* IP0SR2 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ -#define IP0SR2_3_0 FM(FXR_TXDA) FM(CANFD1_TX) FM(TPU0TO2_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR2_7_4 FM(FXR_TXENA_N_A) FM(CANFD1_RX) FM(TPU0TO3_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR2_3_0 FM(FXR_TXDA) FM(CANFD1_TX) FM(TPU0TO2_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR2_7_4 FM(FXR_TXENA_N_A) FM(CANFD1_RX) FM(TPU0TO3_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_11_8 FM(RXDA_EXTFXR) FM(CANFD5_TX_A) FM(IRQ5) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_15_12 FM(CLK_EXTFXR) FM(CANFD5_RX_A) FM(IRQ4_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_19_16 FM(RXDB_EXTFXR) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_23_20 FM(FXR_TXENB_N_A) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP0SR2_27_24 FM(FXR_TXDB) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP0SR2_31_28 FM(TPU0TO1) FM(CANFD6_TX) F_(0, 0) FM(TCLK2_C) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP0SR2_31_28 FM(TPU0TO1_A) FM(CANFD6_TX) F_(0, 0) FM(TCLK2_C) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)/* IP1SR2 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ -#define IP1SR2_3_0 FM(TPU0TO0) FM(CANFD6_RX) F_(0, 0) FM(TCLK1_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR2_3_0 FM(TPU0TO0_A) FM(CANFD6_RX) F_(0, 0) FM(TCLK1_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_7_4 FM(CAN_CLK) FM(FXR_TXENA_N_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_11_8 FM(CANFD0_TX) FM(FXR_TXENB_N_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_15_12 FM(CANFD0_RX) FM(STPWT_EXTFXR) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR2_19_16 FM(CANFD2_TX) FM(TPU0TO2) F_(0, 0) FM(TCLK3_C) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) -#define IP1SR2_23_20 FM(CANFD2_RX) FM(TPU0TO3) FM(PWM1_B) FM(TCLK4_C) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR2_19_16 FM(CANFD2_TX) FM(TPU0TO2_A) F_(0, 0) FM(TCLK3_C) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) +#define IP1SR2_23_20 FM(CANFD2_RX) FM(TPU0TO3_A) FM(PWM1_B) FM(TCLK4_C) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_27_24 FM(CANFD3_TX) F_(0, 0) FM(PWM2) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)#define IP1SR2_31_28 FM(CANFD3_RX) F_(0, 0) FM(PWM3_B) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
@@ -865,12 +865,12 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP3SR1_7_4 ,HSCK3_A ),PINMUX_IPSR_GPSR (IP3SR1_7_4 ,CTS3_N_A ),PINMUX_IPSR_GPSR (IP3SR1_7_4 ,MSIOF4_SCK ), -PINMUX_IPSR_GPSR (IP3SR1_7_4 ,TPU0TO0_A ), +PINMUX_IPSR_GPSR (IP3SR1_7_4 ,TPU0TO0_B ),PINMUX_IPSR_GPSR (IP3SR1_11_8 ,HRTS3_N_A ),PINMUX_IPSR_GPSR (IP3SR1_11_8 ,RTS3_N_A ),PINMUX_IPSR_GPSR (IP3SR1_11_8 ,MSIOF4_TXD ), -PINMUX_IPSR_GPSR (IP3SR1_11_8 ,TPU0TO1_A ), +PINMUX_IPSR_GPSR (IP3SR1_11_8 ,TPU0TO1_B ),PINMUX_IPSR_GPSR (IP3SR1_15_12 ,HCTS3_N_A ), PINMUX_IPSR_GPSR(IP3SR1_15_12, RX3_A),
@@ -883,11 +883,11 @@ static const u16 pinmux_data[] = {/* IP0SR2 */ PINMUX_IPSR_GPSR (IP0SR2_3_0 ,FXR_TXDA ),PINMUX_IPSR_GPSR (IP0SR2_3_0 ,CANFD1_TX ), -PINMUX_IPSR_GPSR (IP0SR2_3_0 ,TPU0TO2_A ), +PINMUX_IPSR_GPSR (IP0SR2_3_0 ,TPU0TO2_B ),PINMUX_IPSR_GPSR (IP0SR2_7_4 ,FXR_TXENA_N_A ),PINMUX_IPSR_GPSR (IP0SR2_7_4 ,CANFD1_RX ), -PINMUX_IPSR_GPSR (IP0SR2_7_4 ,TPU0TO3_A ), +PINMUX_IPSR_GPSR (IP0SR2_7_4 ,TPU0TO3_B ),PINMUX_IPSR_GPSR (IP0SR2_11_8 ,RXDA_EXTFXR ), PINMUX_IPSR_GPSR(IP0SR2_11_8, CANFD5_TX_A),
@@ -903,12 +903,12 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP0SR2_27_24 ,FXR_TXDB ), -PINMUX_IPSR_GPSR (IP0SR2_31_28 ,TPU0TO1 ), +PINMUX_IPSR_GPSR (IP0SR2_31_28 ,TPU0TO1_A ),PINMUX_IPSR_GPSR (IP0SR2_31_28 ,CANFD6_TX ),PINMUX_IPSR_GPSR (IP0SR2_31_28 ,TCLK2_C ),/* IP1SR2 */ -PINMUX_IPSR_GPSR (IP1SR2_3_0 ,TPU0TO0 ), +PINMUX_IPSR_GPSR (IP1SR2_3_0 ,TPU0TO0_A ),PINMUX_IPSR_GPSR (IP1SR2_3_0 ,CANFD6_RX ), PINMUX_IPSR_GPSR(IP1SR2_3_0, TCLK1_B),
@@ -922,11 +922,11 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP1SR2_15_12 ,STPWT_EXTFXR ),PINMUX_IPSR_GPSR (IP1SR2_19_16 ,CANFD2_TX ), -PINMUX_IPSR_GPSR (IP1SR2_19_16 ,TPU0TO2 ), +PINMUX_IPSR_GPSR (IP1SR2_19_16 ,TPU0TO2_A ),PINMUX_IPSR_GPSR (IP1SR2_19_16 ,TCLK3_C ),PINMUX_IPSR_GPSR (IP1SR2_23_20 ,CANFD2_RX ), -PINMUX_IPSR_GPSR (IP1SR2_23_20 ,TPU0TO3 ), +PINMUX_IPSR_GPSR (IP1SR2_23_20 ,TPU0TO3_A ),PINMUX_IPSR_GPSR (IP1SR2_23_20 ,PWM1_B ), PINMUX_IPSR_GPSR(IP1SR2_23_20, TCLK4_C),
@@ -2379,64 +2379,63 @@ static const unsigned int ssi_ctrl_mux[] = { SSI_SCK_MARK, SSI_WS_MARK, }; -/* - TPU ------------------------------------------------------------------- */ -static const unsigned int tpu_to0_pins[] = { -/* TPU0TO0 */ +/* - TPU -------------------------------------------------------------------- */ +static const unsigned int tpu_to0_a_pins[] = { +/* TPU0TO0_A */ RCAR_GP_PIN (2 ,8 ), }; -static const unsigned int tpu_to0_mux[] = { -TPU0TO0_MARK , +static const unsigned int tpu_to0_a_mux[] = { +TPU0TO0_A_MARK , }; -static const unsigned int tpu_to1_pins[] = { -/* TPU0TO1 */ +static const unsigned int tpu_to1_a_pins[] = { +/* TPU0TO1_A */ RCAR_GP_PIN (2 ,7 ), }; -static const unsigned int tpu_to1_mux[] = { -TPU0TO1_MARK , +static const unsigned int tpu_to1_a_mux[] = { +TPU0TO1_A_MARK , }; -static const unsigned int tpu_to2_pins[] = { -/* TPU0TO2 */ +static const unsigned int tpu_to2_a_pins[] = { +/* TPU0TO2_A */ RCAR_GP_PIN (2 ,12 ), }; -static const unsigned int tpu_to2_mux[] = { -TPU0TO2_MARK , +static const unsigned int tpu_to2_a_mux[] = { +TPU0TO2_A_MARK , }; -static const unsigned int tpu_to3_pins[] = { -/* TPU0TO3 */ +static const unsigned int tpu_to3_a_pins[] = { +/* TPU0TO3_A */ RCAR_GP_PIN (2 ,13 ), }; -static const unsigned int tpu_to3_mux[] = { -TPU0TO3_MARK , +static const unsigned int tpu_to3_a_mux[] = { +TPU0TO3_A_MARK , }; -/* - TPU_A ------------------------------------------------------------------- */ -static const unsigned int tpu_to0_a_pins[] = { -/* TPU0TO0_A */ +static const unsigned int tpu_to0_b_pins[] = { +/* TPU0TO0_B */ RCAR_GP_PIN (1 ,25 ), }; -static const unsigned int tpu_to0_a_mux[] = { -TPU0TO0_A_MARK , +static const unsigned int tpu_to0_b_mux[] = { +TPU0TO0_B_MARK , }; -static const unsigned int tpu_to1_a_pins[] = { -/* TPU0TO1_A */ +static const unsigned int tpu_to1_b_pins[] = { +/* TPU0TO1_B */ RCAR_GP_PIN (1 ,26 ), }; -static const unsigned int tpu_to1_a_mux[] = { -TPU0TO1_A_MARK , +static const unsigned int tpu_to1_b_mux[] = { +TPU0TO1_B_MARK , }; -static const unsigned int tpu_to2_a_pins[] = { -/* TPU0TO2_A */ +static const unsigned int tpu_to2_b_pins[] = { +/* TPU0TO2_B */ RCAR_GP_PIN (2 ,0 ), }; -static const unsigned int tpu_to2_a_mux[] = { -TPU0TO2_A_MARK , +static const unsigned int tpu_to2_b_mux[] = { +TPU0TO2_B_MARK , }; -static const unsigned int tpu_to3_a_pins[] = { -/* TPU0TO3_A */ +static const unsigned int tpu_to3_b_pins[] = { +/* TPU0TO3_B */ RCAR_GP_PIN (2 ,1 ), }; -static const unsigned int tpu_to3_a_mux[] = { -TPU0TO3_A_MARK , +static const unsigned int tpu_to3_b_mux[] = { +TPU0TO3_B_MARK , };/* - TSN0 ------------------------------------------------ */
@@ -2675,14 +2674,14 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {SH_PFC_PIN_GROUP (ssi_data),SH_PFC_PIN_GROUP (ssi_ctrl), -SH_PFC_PIN_GROUP (tpu_to0),/* suffix might be updated */ -SH_PFC_PIN_GROUP (tpu_to0_a),/* suffix might be updated */ -SH_PFC_PIN_GROUP (tpu_to1),/* suffix might be updated */ -SH_PFC_PIN_GROUP (tpu_to1_a),/* suffix might be updated */ -SH_PFC_PIN_GROUP (tpu_to2),/* suffix might be updated */ -SH_PFC_PIN_GROUP (tpu_to2_a),/* suffix might be updated */ -SH_PFC_PIN_GROUP (tpu_to3),/* suffix might be updated */ -SH_PFC_PIN_GROUP (tpu_to3_a),/* suffix might be updated */ +SH_PFC_PIN_GROUP (tpu_to0_a), +SH_PFC_PIN_GROUP (tpu_to0_b), +SH_PFC_PIN_GROUP (tpu_to1_a), +SH_PFC_PIN_GROUP (tpu_to1_b), +SH_PFC_PIN_GROUP (tpu_to2_a), +SH_PFC_PIN_GROUP (tpu_to2_b), +SH_PFC_PIN_GROUP (tpu_to3_a), +SH_PFC_PIN_GROUP (tpu_to3_b),SH_PFC_PIN_GROUP (tsn0_link), SH_PFC_PIN_GROUP(tsn0_phy_int),
@@ -2988,15 +2987,14 @@ static const char * const ssi_groups[] = { };static const char *const tpu_groups[] = { -/* suffix might be updated */ -"tpu_to0" ,"tpu_to0_a" , -"tpu_to1" , +"tpu_to0_b" ,"tpu_to1_a" , -"tpu_to2" , +"tpu_to1_b" ,"tpu_to2_a" , -"tpu_to3" , +"tpu_to2_b" ,"tpu_to3_a" , +"tpu_to3_b" , };static const char *const tsn0_groups[] = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 260/440 fs/proc/task_mmu: indicate PM_FILE for PMD-mapped file THP
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <[email protected]>
[ Upstream commit 3f9f022e975d930709848a86a1c79775b0585202 ]
Patch series "fs/proc: move page_mapcount() to fs/proc/internal.h".
With all other page_mapcount() users in the tree gone, move page_mapcount() to fs/proc/internal.h, rename it and extend the documentation to prevent future (ab)use.
... of course, I find some issues while working on that code that I sort first ;)
We'll now only end up calling page_mapcount() [now folio_precise_page_mapcount()] on pages mapped via present page table entries. Except for /proc/kpagecount, that still does questionable things, but we'll leave that legacy interface as is for now.
Did a quick sanity check. Likely we would want some better selfestest for /proc/$/pagemap + smaps. I'll see if I can find some time to write some more.
This patch (of 6):
Looks like we never taught pagemap_pmd_range() about the existence of PMD-mapped file THPs. Seems to date back to the times when we first added support for non-anon THPs in the form of shmem THP.
--- fs/proc/task_mmu.c | 2 ++ 1 file changed, 2 insertions(+)
fs/proc/task_mmu.c +2 -0
@@ -1513,6 +1513,8 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end, }#endif +if (page && !PageAnon (page)) + flags |=PM_FILE ;if (page && !migration &&page_mapcount (page) ==1 ) flags |=PM_MMAP_EXCLUSIVE ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 261/440 nilfs2: avoid undefined behavior in nilfs_cnt32_ge macro
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
[ Upstream commit 0f3819e8c483771a59cf9d3190cd68a7a990083c ]
According to the C standard 3.4.3p3, the result of signed integer overflow is undefined. The macro nilfs_cnt32_ge(), which compares two sequence numbers, uses signed integer subtraction that can overflow, and therefore the result of the calculation may differ from what is expected due to undefined behavior in different environments.
Similar to an earlier change to the jiffies-related comparison macros in commit 5a581b367b5d ("jiffies: Avoid undefined behavior from signed overflow"), avoid this potential issue by changing the definition of the macro to perform the subtraction as unsigned integers, then cast the result to a signed integer for comparison.
--- fs/nilfs2/segment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nilfs2/segment.c +1 -1
@@ -136,7 +136,7 @@ static void nilfs_dispose_list(struct the_nilfs *, struct list_head *, int);#define nilfs_cnt32_ge (a, b) \ (typecheck(__u32, a) && typecheck(__u32, b) && \ - ((__s32)(a) - (__s32)(b) >= 0)) + ((__s32)((a) - (b)) >= 0))static int nilfs_prepare_segment_lock (struct super_block *sb,struct nilfs_transaction_info *ti)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 262/440 rtc: interface: Add RTC offset to alarm after fix-up
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Csókás, Bence <[email protected]>
[ Upstream commit 463927a8902a9f22c3633960119410f57d4c8920 ]
rtc_add_offset() is called by __rtc_read_time() and __rtc_read_alarm() to add the RTC's offset to the raw read-outs from the device drivers. However, in the latter case, a fix-up algorithm is run if the RTC device does not report a full struct rtc_time alarm value. In that case, the offset was forgot to be added.
--- drivers/rtc/interface.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/rtc/interface.c +5 -4
@@ -274,10 +274,9 @@ int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)return err;/* full-function RTCs won't have such missing fields */ -if (rtc_valid_tm (&alarm->time) ==0 ) { -rtc_add_offset (rtc, &alarm->time); -return 0 ; - } + err =rtc_valid_tm (&alarm->time); +if (!err) + goto done;/* get the "after" timestamp, to detect wrapped fields */ err =rtc_read_time (rtc, &now);
@@ -379,6 +378,8 @@ int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)if (err)dev_warn (&rtc->dev,"invalid alarm value: %ptR\n" , &alarm->time); +else +rtc_add_offset (rtc, &alarm->time);return err; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 263/440 fs/ntfs3: Missed error return
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit 2cbbd96820255fff4f0ad1533197370c9ccc570b ]
--- fs/ntfs3/bitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ntfs3/bitmap.c +1 -1
@@ -1356,7 +1356,7 @@ int wnd_extend(struct wnd_bitmap *wnd, size_t new_bits) err =ntfs_vbo_to_lbo (sbi, &wnd->run, vbo, &lbo, &bytes);if (err) -break ; +return err; bh =ntfs_bread (sb, lbo >> sb->s_blocksize_bits);if (!bh)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 264/440 fs/ntfs3: Keep runs for $MFT::$ATTR_DATA and $MFT::$ATTR_BITMAP
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit eb95678ee930d67d79fc83f0a700245ae7230455 ]
We skip the run_truncate_head call also for $MFT::$ATTR_BITMAP.
Otherwise wnd_map()/run_lookup_entry will not find the disk position for the bitmap parts.
--- fs/ntfs3/attrib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ntfs3/attrib.c +2 -1
@@ -681,7 +681,8 @@ int attr_set_size(struct ntfs_inode *ni, enum ATTR_TYPE type, goto undo_2; } -if (!is_mft) +/* keep runs for $MFT::$ATTR_DATA and $MFT::$ATTR_BITMAP. */ +if (ni->mi.rno !=MFT_REC_MFT )run_truncate_head (run, evcn +1 ); svcn =le64_to_cpu (attr->nres.svcn);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 265/440 s390/dasd: fix error checks in dasd_copy_pair_store()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Carlos López <[email protected]>
[ Upstream commit 8e64d2356cbc800b4cd0e3e614797f76bcf0cdb8 ]
dasd_add_busid() can return an error via ERR_PTR() if an allocation fails. However, two callsites in dasd_copy_pair_store() do not check the result, potentially resulting in a NULL pointer dereference. Fix this by checking the result with IS_ERR() and returning the error up the stack.
--- drivers/s390/block/dasd_devmap.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/s390/block/dasd_devmap.c +8 -2
@@ -2135,13 +2135,19 @@ static ssize_t dasd_copy_pair_store(struct device *dev,/* allocate primary devmap if needed */ prim_devmap =dasd_find_busid (prim_busid); -if (IS_ERR (prim_devmap)) +if (IS_ERR (prim_devmap)) { prim_devmap =dasd_add_busid (prim_busid,DASD_FEATURE_DEFAULT ); +if (IS_ERR (prim_devmap)) +return PTR_ERR (prim_devmap); + }/* allocate secondary devmap if needed */ sec_devmap =dasd_find_busid (sec_busid); -if (IS_ERR (sec_devmap)) +if (IS_ERR (sec_devmap)) { sec_devmap =dasd_add_busid (sec_busid,DASD_FEATURE_DEFAULT ); +if (IS_ERR (sec_devmap)) +return PTR_ERR (sec_devmap); + }/* setting copy relation is only allowed for offline secondary */ if (sec_devmap->device)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 266/440 sbitmap: remove unnecessary calculation of alloc_hint in __sbitmap_get_shallow
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kemeng Shi <[email protected]>
[ Upstream commit f1591a8bb3e02713f4ee2efe20df0d84ed80da48 ]
Updates to alloc_hint in the loop in __sbitmap_get_shallow() are mostly pointless and equivalent to setting alloc_hint to zero (because SB_NR_TO_BIT() considers only low sb->shift bits from alloc_hint). So simplify the logic.
Stable-dep-of: 72d04bdcf3f7 ("sbitmap: fix io hung due to race on sbitmap_word::cleared")
--- lib/sbitmap.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
lib/sbitmap.c +4 -7
@@ -243,6 +243,7 @@ static int __sbitmap_get_shallow(struct sbitmap *sb,int nr =-1 ; index =SB_NR_TO_INDEX (sb, alloc_hint); + alloc_hint =SB_NR_TO_BIT (sb, alloc_hint);for (i =0 ; i < sb->map_nr; i++) { again:
@@ -250,7 +251,7 @@ static int __sbitmap_get_shallow(struct sbitmap *sb, min_t(unsigned int, __map_depth(sb, index), shallow_depth), - SB_NR_TO_BIT(sb, alloc_hint), true); + alloc_hint, true);if (nr !=-1 ) { nr += index << sb->shift;break ;
@@ -260,13 +261,9 @@ static int __sbitmap_get_shallow(struct sbitmap *sb, goto again;/* Jump to next index. */ - index++; - alloc_hint = index << sb->shift; - -if (index >= sb->map_nr) { + alloc_hint =0 ; +if (++index >= sb->map_nr) index =0 ; - alloc_hint =0 ; - } }return nr;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 267/440 sbitmap: rewrite sbitmap_find_bit_in_index to reduce repeat code
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kemeng Shi <[email protected]>
[ Upstream commit 08470a98a7d7e32c787b23b87353f13b03c23195 ]
Rewrite sbitmap_find_bit_in_index as following:
1. Rename sbitmap_find_bit_in_index to sbitmap_find_bit_in_word
2. Accept "struct sbitmap_word *" directly instead of accepting "struct sbitmap *" and "int index" to get "struct sbitmap_word *".
3. Accept depth/shallow_depth and wrap for __sbitmap_get_word from caller to support need of both __sbitmap_get_shallow and __sbitmap_get.
With helper function sbitmap_find_bit_in_word, we can remove repeat code in __sbitmap_get_shallow to find bit considring deferred clear.
Stable-dep-of: 72d04bdcf3f7 ("sbitmap: fix io hung due to race on sbitmap_word::cleared")
--- lib/sbitmap.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
lib/sbitmap.c +15 -15
@@ -167,15 +167,16 @@ static int __sbitmap_get_word(unsigned long *word, unsigned long depth,return nr; } -static int sbitmap_find_bit_in_index (struct sbitmap *sb,int index, -unsigned int alloc_hint) +static int sbitmap_find_bit_in_word (struct sbitmap_word *map, +unsigned int depth, +unsigned int alloc_hint, +bool wrap) { -struct sbitmap_word *map = &sb->map[index];int nr; do { - nr = __sbitmap_get_word(&map->word, __map_depth(sb, index), - alloc_hint, !sb->round_robin); + nr = __sbitmap_get_word(&map->word, depth, + alloc_hint, wrap); if (nr != -1) break; if (!sbitmap_deferred_clear(map))
@@ -203,7 +204,9 @@ static int __sbitmap_get(struct sbitmap *sb, unsigned int alloc_hint) alloc_hint =0 ;for (i =0 ; i < sb->map_nr; i++) { - nr =sbitmap_find_bit_in_index (sb, index, alloc_hint); + nr =sbitmap_find_bit_in_word (&sb->map[index], +__map_depth (sb, index), + alloc_hint, !sb->round_robin);if (nr !=-1 ) { nr += index << sb->shift;break ;
@@ -246,20 +249,17 @@ static int __sbitmap_get_shallow(struct sbitmap *sb, alloc_hint =SB_NR_TO_BIT (sb, alloc_hint);for (i =0 ; i < sb->map_nr; i++) { -again: - nr =__sbitmap_get_word (&sb->map[index].word, - min_t(unsigned int, -__map_depth (sb, index), - shallow_depth), - alloc_hint, true); + nr =sbitmap_find_bit_in_word (&sb->map[index], + min_t(unsigned int, +__map_depth (sb, index), + shallow_depth), + alloc_hint, true); +if (nr !=-1 ) { nr += index << sb->shift;break ; } -if (sbitmap_deferred_clear (&sb->map[index])) - goto again; -/* Jump to next index. */ alloc_hint =0 ;if (++index >= sb->map_nr)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 268/440 sbitmap: use READ_ONCE to access map->word
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: linke li <[email protected]>
[ Upstream commit 6ad0d7e0f4b68f87a98ea2b239123b7d865df86b ]
In __sbitmap_queue_get_batch(), map->word is read several times, and update atomically using atomic_long_try_cmpxchg(). But the first two read of map->word is not protected.
This patch moves the statement val = READ_ONCE(map->word) forward, eliminating unprotected accesses to map->word within the function. It is aimed at reducing the number of benign races reported by KCSAN in order to focus future debugging effort on harmful races.
Stable-dep-of: 72d04bdcf3f7 ("sbitmap: fix io hung due to race on sbitmap_word::cleared")
--- lib/sbitmap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
lib/sbitmap.c +4 -4
@@ -503,18 +503,18 @@ unsigned long __sbitmap_queue_get_batch(struct sbitmap_queue *sbq, int nr_tags,struct sbitmap_word *map = &sb->map[index];unsigned long get_mask;unsigned int map_depth =__map_depth (sb, index); +unsigned long val;sbitmap_deferred_clear (map); -if (map->word == (1UL << (map_depth -1 )) -1 ) + val =READ_ONCE (map->word); +if (val == (1UL << (map_depth -1 )) -1 ) goto next; - nr =find_first_zero_bit (&map->word, map_depth); + nr =find_first_zero_bit (&val, map_depth);if (nr + nr_tags <= map_depth) {atomic_long_t *ptr = (atomic_long_t *) &map->word; -unsigned long val; get_mask = ((1UL << nr_tags) -1 ) << nr; - val =READ_ONCE (map->word);while (!atomic_long_try_cmpxchg (ptr, &val, get_mask | val)) ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 269/440 sbitmap: fix io hung due to race on sbitmap_word::cleared
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Yang <[email protected]>
[ Upstream commit 72d04bdcf3f7d7e07d82f9757946f68802a7270a ]
Configuration for sbq:
depth=64, wake_batch=6, shift=6, map_nr=1
1. There are 64 requests in progress:
map->word = 0xFFFFFFFFFFFFFFFF
2. After all the 64 requests complete, and no more requests come:
map->word = 0xFFFFFFFFFFFFFFFF, map->cleared = 0xFFFFFFFFFFFFFFFF
3. Now two tasks try to allocate requests:
T1: T2:
__blk_mq_get_tag .
__sbitmap_queue_get .
sbitmap_get .
sbitmap_find_bit .
sbitmap_find_bit_in_word .
__sbitmap_get_word -> nr=-1 __blk_mq_get_tag
sbitmap_deferred_clear __sbitmap_queue_get
/* map->cleared=0xFFFFFFFFFFFFFFFF */ sbitmap_find_bit
if (!READ_ONCE(map->cleared)) sbitmap_find_bit_in_word
return false; __sbitmap_get_word -> nr=-1
mask = xchg(&map->cleared, 0) sbitmap_deferred_clear
atomic_long_andnot() /* map->cleared=0 */
if (!(map->cleared))
return false;
/*
* map->cleared is cleared by T1
* T2 fail to acquire the tag
*/4. T2 is the sole tag waiter. When T1 puts the tag, T2 cannot be woken up due to the wake_batch being set at 6. If no more requests come, T1 will wait here indefinitely.
This patch achieves two purposes:
1. Check on ->cleared and update on both ->cleared and ->word need to be done atomically, and using spinlock could be the simplest solution.
2. Add extra check in sbitmap_deferred_clear(), to identify whether ->word has free bits.
--- include/linux/sbitmap.h | 5 +++++ lib/sbitmap.c | 36 +++++++++++++++++++++++++++++------- 2 files changed, 34 insertions(+), 7 deletions(-)
include/linux/sbitmap.h +5 -0
@@ -36,6 +36,11 @@ struct sbitmap_word {* @cleared: word holding cleared bits */ unsigned long cleared____cacheline_aligned_in_smp ; + +/** +* @swap_lock: serializes simultaneous updates of ->word and ->cleared +*/ +spinlock_t swap_lock; }____cacheline_aligned_in_smp ;/**
lib/sbitmap.c +29 -7
@@ -60,12 +60,30 @@ static inline void update_alloc_hint_after_get(struct sbitmap *sb,/* * See if we have deferred clears that we can batch move */ -static inline bool sbitmap_deferred_clear (struct sbitmap_word *map) +static inline bool sbitmap_deferred_clear (struct sbitmap_word *map, +unsigned int depth,unsigned int alloc_hint,bool wrap) { -unsigned long mask; +unsigned long mask, word_mask; -if (!READ_ONCE (map->cleared)) -return false; +guard (spinlock_irqsave)(&map->swap_lock); + +if (!map->cleared) { +if (depth ==0 ) +return false; + + word_mask = (~0UL ) >> (BITS_PER_LONG - depth); +/* +* The current behavior is to always retry after moving +* ->cleared to word, and we change it to retry in case +* of any free bits. To avoid an infinite loop, we need +* to take wrap & alloc_hint into account, otherwise a +* soft lockup may occur. +*/ +if (!wrap && alloc_hint) + word_mask &= ~((1UL << alloc_hint) -1 ); + +return (READ_ONCE (map->word) & word_mask) != word_mask; + }/* * First get a stable cleared mask, setting the old mask to 0.
@@ -85,6 +103,7 @@ int sbitmap_init_node(struct sbitmap *sb, unsigned int depth, int shift, bool alloc_hint) {unsigned int bits_per_word; +int i;if (shift <0 ) shift =sbitmap_calculate_shift (depth);
@@ -116,6 +135,9 @@ int sbitmap_init_node(struct sbitmap *sb, unsigned int depth, int shift,return -ENOMEM ; } +for (i =0 ; i < sb->map_nr; i++) +spin_lock_init (&sb->map[i].swap_lock); +return 0 ; }EXPORT_SYMBOL_GPL (sbitmap_init_node);
@@ -126,7 +148,7 @@ void sbitmap_resize(struct sbitmap *sb, unsigned int depth)unsigned int i;for (i =0 ; i < sb->map_nr; i++) -sbitmap_deferred_clear (&sb->map[i]); +sbitmap_deferred_clear (&sb->map[i],0 ,0 ,0 ); sb->depth = depth; sb->map_nr =DIV_ROUND_UP (sb->depth, bits_per_word);
@@ -179,7 +201,7 @@ static int sbitmap_find_bit_in_word(struct sbitmap_word *map, alloc_hint, wrap);if (nr !=-1 )break ; -if (!sbitmap_deferred_clear (map)) +if (!sbitmap_deferred_clear (map, depth, alloc_hint, wrap))break ; }while (1 );
@@ -505,7 +527,7 @@ unsigned long __sbitmap_queue_get_batch(struct sbitmap_queue *sbq, int nr_tags,unsigned int map_depth =__map_depth (sb, index);unsigned long val; -sbitmap_deferred_clear (map); +sbitmap_deferred_clear (map,0 ,0 ,0 ); val =READ_ONCE (map->word);if (val == (1UL << (map_depth -1 )) -1 ) goto next;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 270/440 landlock: Dont lose track of restrictions on cred_transfer
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
commit 39705a6c29f8a2b93cf5b99528a55366c50014d1 upstream.
When a process' cred struct is replaced, this _almost_ always invokes the cred_prepare LSM hook; but in one special case (when KEYCTL_SESSION_TO_PARENT updates the parent's credentials), the cred_transfer LSM hook is used instead. Landlock only implements the cred_prepare hook, not cred_transfer, so KEYCTL_SESSION_TO_PARENT causes all information on Landlock restrictions to be lost.
This basically means that a process with the ability to use the fork() and keyctl() syscalls can get rid of all Landlock restrictions on itself.
Fix it by adding a cred_transfer hook that does the same thing as the existing cred_prepare hook. (Implemented by having hook_cred_prepare() call hook_cred_transfer() so that the two functions are less likely to accidentally diverge in the future.)
--- security/landlock/cred.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
security/landlock/cred.c +9 -2
@@ -14,8 +14,8 @@#include "ruleset.h" #include "setup.h" -static int hook_cred_prepare (struct cred *const new, -const struct cred *const old,const gfp_t gfp) +static void hook_cred_transfer (struct cred *const new, +const struct cred *const old) {struct landlock_ruleset *const old_dom =landlock_cred (old)->domain;
@@ -23,6 +23,12 @@ static int hook_cred_prepare(struct credlandlock_get_ruleset (old_dom);landlock_cred (new)->domain = old_dom; } +} + +static int hook_cred_prepare (struct cred *const new, +const struct cred *const old,const gfp_t gfp) +{ +hook_cred_transfer (new, old);return 0 ; }
@@ -36,6 +42,7 @@ static void hook_cred_free(struct cred * static struct security_hook_list landlock_hooks[] __lsm_ro_after_init = {LSM_HOOK_INIT (cred_prepare, hook_cred_prepare), +LSM_HOOK_INIT (cred_transfer, hook_cred_transfer),LSM_HOOK_INIT (cred_free, hook_cred_free), };
Greg Kroah-Hartman
maintainerPATCH 271/440 mm/hugetlb: fix possible recursive locking detected warning
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miaohe Lin <[email protected]>
commit 667574e873b5f77a220b2a93329689f36fb56d5d upstream.
When tries to demote 1G hugetlb folios, a lockdep warning is observed:
============================================
WARNING: possible recursive locking detected 6.10.0-rc6-00452-ga4d0275fa660-dirty #79 Not tainted
--------------------------------------------
bash/710 is trying to acquire lock:ffffffff8f0a7850 (&h->resize_lock){+.+.}-{3:3}, at: demote_store+0x244/0x460
but task is already holding lock:ffffffff8f0a6f48 (&h->resize_lock){+.+.}-{3:3}, at: demote_store+0xae/0x460
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
---- lock(&h->resize_lock);
lock(&h->resize_lock);
*** DEADLOCK ***
May be due to missing lock nesting notation
4 locks held by bash/710:
#0: ffff8f118439c3f0 (sb_writers#5){.+.+}-{0:0}, at: ksys_write+0x64/0xe0 #1: ffff8f11893b9e88 (&of->mutex#2){+.+.}-{3:3}, at: kernfs_fop_write_iter+0xf8/0x1d0 #2: ffff8f1183dc4428 (kn->active#98){.+.+}-{0:0}, at: kernfs_fop_write_iter+0x100/0x1d0 #3: ffffffff8f0a6f48 (&h->resize_lock){+.+.}-{3:3}, at: demote_store+0xae/0x460
stack backtrace: CPU: 3 PID: 710 Comm: bash Not tainted 6.10.0-rc6-00452-ga4d0275fa660-dirty #79 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 Call Trace: <TASK> dump_stack_lvl+0x68/0xa0 __lock_acquire+0x10f2/0x1ca0 lock_acquire+0xbe/0x2d0 __mutex_lock+0x6d/0x400 demote_store+0x244/0x460 kernfs_fop_write_iter+0x12c/0x1d0 vfs_write+0x380/0x540 ksys_write+0x64/0xe0 do_syscall_64+0xb9/0x1d0 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fa61db14887 RSP: 002b:00007ffc56c48358 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007fa61db14887 RDX: 0000000000000002 RSI: 000055a030050220 RDI: 0000000000000001 RBP: 000055a030050220 R08: 00007fa61dbd1460 R09: 000000007fffffff R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000002 R13: 00007fa61dc1b780 R14: 00007fa61dc17600 R15: 00007fa61dc16a00 </TASK>
Lockdep considers this an AA deadlock because the different resize_lock mutexes reside in the same lockdep class, but this is a false positive. Place them in distinct classes to avoid these warnings.
--- include/linux/hugetlb.h | 1 + mm/hugetlb.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
include/linux/hugetlb.h +1 -0
@@ -694,6 +694,7 @@ HPAGEFLAG(RawHwpUnreliable, raw_hwp_unre/* Defines one hugetlb page size */ struct hstate {struct mutex resize_lock; +struct lock_class_key resize_key;int next_nid_to_alloc;int next_nid_to_free;unsigned int order;
mm/hugetlb.c +1 -1
@@ -4353,7 +4353,7 @@ void __init hugetlb_add_hstate(unsignedBUG_ON (hugetlb_max_hstate >=HUGE_MAX_HSTATE );BUG_ON (order ==0 ); h = &hstates[hugetlb_max_hstate++]; -mutex_init (&h->resize_lock); +__mutex_init (&h->resize_lock,"resize mutex" , &h->resize_key); h->order = order; h->mask = ~(huge_page_size (h) -1 );for (i =0 ; i <MAX_NUMNODES ; ++i)
Greg Kroah-Hartman
maintainerPATCH 272/440 mm/mglru: fix div-by-zero in vmpressure_calc_level()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Zhao <[email protected]>
commit 8b671fe1a879923ecfb72dda6caf01460dd885ef upstream.
evict_folios() uses a second pass to reclaim folios that have gone through page writeback and become clean before it finishes the first pass, since folio_rotate_reclaimable() cannot handle those folios due to the isolation.
The second pass tries to avoid potential double counting by deducting scan_control->nr_scanned. However, this can result in underflow of nr_scanned, under a condition where shrink_folio_list() does not increment nr_scanned, i.e., when folio_trylock() fails.
The underflow can cause the divisor, i.e., scale=scanned+reclaimed in vmpressure_calc_level(), to become zero, resulting in the following crash:
[exception RIP: vmpressure_work_fn+101]
process_one_work at ffffffffa3313f2b
Since scan_control->nr_scanned has no established semantics, the potential double counting has minimal risks. Therefore, fix the problem by not deducting scan_control->nr_scanned in evict_folios().
--- mm/vmscan.c | 1 - 1 file changed, 1 deletion(-)
mm/vmscan.c +0 -1
@@ -5065,7 +5065,6 @@ retry:/* retry folios that may have missed folio_rotate_reclaimable() */ list_move (&folio->lru, &clean); - sc->nr_scanned -=folio_nr_pages (folio); }spin_lock_irq (&lruvec->lru_lock);
Greg Kroah-Hartman
maintainerPATCH 273/440 mm: mmap_lock: replace get_memcg_path_buf() with on-stack buffer
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuo Handa <[email protected]>
commit 7d6be67cfdd4a53cea7147313ca13c531e3a470f upstream.
Commit 2b5067a8143e ("mm: mmap_lock: add tracepoints around lock acquisition") introduced TRACE_MMAP_LOCK_EVENT() macro using preempt_disable() in order to let get_mm_memcg_path() return a percpu buffer exclusively used by normal, softirq, irq and NMI contexts respectively.
Commit 832b50725373 ("mm: mmap_lock: use local locks instead of disabling preemption") replaced preempt_disable() with local_lock(&memcg_paths.lock) based on an argument that preempt_disable() has to be avoided because get_mm_memcg_path() might sleep if PREEMPT_RT=y.
But syzbot started reporting
inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage.
and
inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
messages, for local_lock() does not disable IRQ.
We could replace local_lock() with local_lock_irqsave() in order to suppress these messages. But this patch instead replaces percpu buffers with on-stack buffer, for the size of each buffer returned by get_memcg_path_buf() is only 256 bytes which is tolerable for allocating from current thread's kernel stack memory.
--- mm/mmap_lock.c | 175 ++++++--------------------------------------------------- 1 file changed, 20 insertions(+), 155 deletions(-)
mm/mmap_lock.c +20 -155
@@ -19,14 +19,7 @@ EXPORT_TRACEPOINT_SYMBOL(mmap_lock_relea#ifdef CONFIG_MEMCG -/* -* Our various events all share the same buffer (because we don't want or need -* to allocate a set of buffers *per event type*), so we need to protect against -* concurrent _reg() and _unreg() calls, and count how many _reg() calls have -* been made. -*/ -static DEFINE_MUTEX (reg_lock); -static int reg_refcount;/* Protected by reg_lock. */ +static atomic_t reg_refcount;/* * Size of the buffer for memcg path names. Ignoring stack trace support,
@@ -34,136 +27,22 @@ static int reg_refcount; /* Protected by*/ #define MEMCG_PATH_BUF_SIZE MAX_FILTER_STR_VAL -/* -* How many contexts our trace events might be called in: normal, softirq, irq, -* and NMI. -*/ -#define CONTEXT_COUNT 4 - -struct memcg_path { -local_lock_t lock; -char __rcu *buf; -local_t buf_idx; -}; -static DEFINE_PER_CPU(struct memcg_path, memcg_paths) = { - .lock =INIT_LOCAL_LOCK (lock), - .buf_idx =LOCAL_INIT (0 ), -}; - -static char **tmp_bufs; - -/* Called with reg_lock held. */ -static void free_memcg_path_bufs (void ) -{ -struct memcg_path *memcg_path; -int cpu; -char **old = tmp_bufs; - -for_each_possible_cpu (cpu) { - memcg_path =per_cpu_ptr (&memcg_paths, cpu); - *(old++) =rcu_dereference_protected (memcg_path->buf, -lockdep_is_held (®_lock)); -rcu_assign_pointer (memcg_path->buf,NULL ); - } - -/* Wait for inflight memcg_path_buf users to finish. */ -synchronize_rcu (); - - old = tmp_bufs; -for_each_possible_cpu (cpu) { -kfree (*(old++)); - } - -kfree (tmp_bufs); - tmp_bufs =NULL ; -} -int trace_mmap_lock_reg (void ) { -int cpu; -char *new; - -mutex_lock (®_lock); - -/* If the refcount is going 0->1, proceed with allocating buffers. */ -if (reg_refcount++) - goto out; - - tmp_bufs =kmalloc_array (num_possible_cpus (),sizeof (*tmp_bufs), -GFP_KERNEL ); -if (tmp_bufs ==NULL ) - goto out_fail; - -for_each_possible_cpu (cpu) { - new =kmalloc (MEMCG_PATH_BUF_SIZE *CONTEXT_COUNT ,GFP_KERNEL ); -if (new ==NULL ) - goto out_fail_free; -rcu_assign_pointer (per_cpu_ptr (&memcg_paths, cpu)->buf, new); -/* Don't need to wait for inflights, they'd have gotten NULL. */ - } - -out: -mutex_unlock (®_lock); +atomic_inc (®_refcount);return 0 ; - -out_fail_free: -free_memcg_path_bufs (); -out_fail: -/* Since we failed, undo the earlier ref increment. */ - --reg_refcount; - -mutex_unlock (®_lock); -return -ENOMEM ; }void trace_mmap_lock_unreg (void ) { -mutex_lock (®_lock); - -/* If the refcount is going 1->0, proceed with freeing buffers. */ -if (--reg_refcount) - goto out; - -free_memcg_path_bufs (); - -out: -mutex_unlock (®_lock); -} - -static inline char *get_memcg_path_buf (void ) -{ -struct memcg_path *memcg_path =this_cpu_ptr (&memcg_paths); -char *buf; -int idx; - -rcu_read_lock (); - buf =rcu_dereference (memcg_path->buf); -if (buf ==NULL ) { -rcu_read_unlock (); -return NULL ; - } - idx =local_add_return (MEMCG_PATH_BUF_SIZE , &memcg_path->buf_idx) - -MEMCG_PATH_BUF_SIZE ; -return &buf[idx]; +atomic_dec (®_refcount); } -static inline void put_memcg_path_buf (void ) -{ -local_sub (MEMCG_PATH_BUF_SIZE , &this_cpu_ptr (&memcg_paths)->buf_idx); -rcu_read_unlock (); -} - -#define TRACE_MMAP_LOCK_EVENT (type, mm, ...) \ - do { \ - const char *memcg_path; \ - local_lock(&memcg_paths.lock); \ - memcg_path = get_mm_memcg_path(mm); \ - trace_mmap_lock_##type(mm, \ - memcg_path != NULL ? memcg_path : "", \ - ##__VA_ARGS__); \ - if (likely(memcg_path != NULL)) \ - put_memcg_path_buf(); \ - local_unlock(&memcg_paths.lock); \ +#define TRACE_MMAP_LOCK_EVENT (type, mm, ...) \ + do { \ + char buf[MEMCG_PATH_BUF_SIZE]; \ + get_mm_memcg_path(mm, buf, sizeof(buf)); \ + trace_mmap_lock_##type(mm, buf, ##__VA_ARGS__); \ } while (0)#else /* !CONFIG_MEMCG */
@@ -185,37 +64,23 @@ void trace_mmap_lock_unreg(void)#ifdef CONFIG_TRACING #ifdef CONFIG_MEMCG /* -* Write the given mm_struct's memcg path to a percpu buffer, and return a -* pointer to it. If the path cannot be determined, or no buffer was available -* (because the trace event is being unregistered), NULL is returned. -* -* Note: buffers are allocated per-cpu to avoid locking, so preemption must be -* disabled by the caller before calling us, and re-enabled only after the -* caller is done with the pointer. -* -* The caller must call put_memcg_path_buf() once the buffer is no longer -* needed. This must be done while preemption is still disabled. +* Write the given mm_struct's memcg path to a buffer. If the path cannot be +* determined or the trace event is being unregistered, empty string is written. */ -static const char *get_mm_memcg_path (struct mm_struct *mm) +static void get_mm_memcg_path (struct mm_struct *mm,char *buf,size_t buflen) { -char *buf =NULL ; -struct mem_cgroup *memcg =get_mem_cgroup_from_mm (mm); +struct mem_cgroup *memcg; + buf[0 ] ='\0' ; +/* No need to get path if no trace event is registered. */ +if (!atomic_read (®_refcount)) +return ; + memcg =get_mem_cgroup_from_mm (mm);if (memcg ==NULL ) - goto out; -if (unlikely (memcg->css.cgroup ==NULL )) - goto out_put; - - buf =get_memcg_path_buf (); -if (buf ==NULL ) - goto out_put; - -cgroup_path (memcg->css.cgroup, buf,MEMCG_PATH_BUF_SIZE ); - -out_put: +return ; +if (memcg->css.cgroup) +cgroup_path (memcg->css.cgroup, buf, buflen);css_put (&memcg->css); -out: -return buf; }#endif /* CONFIG_MEMCG */
Greg Kroah-Hartman
maintainerPATCH 274/440 x86/efistub: Avoid returning EFI_SUCCESS on error
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ard Biesheuvel <[email protected]>
commit fb318ca0a522295edd6d796fb987e99ec41f0ee5 upstream.
The fail label is only used in a situation where the previous EFI API call succeeded, and so status will be set to EFI_SUCCESS. Fix this, by dropping the goto entirely, and call efi_exit() with the correct error code.
--- drivers/firmware/efi/libstub/x86-stub.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/firmware/efi/libstub/x86-stub.c +1 -4
@@ -467,16 +467,13 @@ efi_status_t __efiapi efi_pe_entry(efi_h/* Convert unicode cmdline to ascii */ cmdline_ptr =efi_convert_cmdline (image, &options_size);if (!cmdline_ptr) - goto fail; +efi_exit (handle,EFI_OUT_OF_RESOURCES );efi_set_u64_split ((unsigned long )cmdline_ptr, &hdr->cmd_line_ptr, &boot_params.ext_cmd_line_ptr);efi_stub_entry (handle, sys_table_arg, &boot_params);/* not reached */ - -fail: -efi_exit (handle, status); } static void add_e820ext(struct boot_params *params,
Greg Kroah-Hartman
maintainerPATCH 275/440 x86/efistub: Revert to heap allocated boot_params for PE entrypoint
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ard Biesheuvel <[email protected]>
commit ae835a96d72cd025421910edb0e8faf706998727 upstream.
This is a partial revert of commit
8117961d98f ("x86/efi: Disregard setup header of loaded image")
which triggers boot issues on older Dell laptops. As it turns out, switching back to a heap allocation for the struct boot_params constructed by the EFI stub works around this, even though it is unclear why.
--- drivers/firmware/efi/libstub/x86-stub.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/firmware/efi/libstub/x86-stub.c +15 -5
@@ -435,11 +435,12 @@ void __noreturn efi_stub_entry(efi_handl efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,efi_system_table_t *sys_table_arg) { - static struct boot_params boot_params __page_aligned_bss; -struct setup_header *hdr = &boot_params.hdr;efi_guid_t proto =LOADED_IMAGE_PROTOCOL_GUID ; +struct boot_params *boot_params; +struct setup_header *hdr;int options_size =0 ;efi_status_t status; +unsigned long alloc;char *cmdline_ptr;if (efi_is_native ())
@@ -457,6 +458,13 @@ efi_status_t __efiapi efi_pe_entry(efi_hefi_exit (handle, status); } + status =efi_allocate_pages (PARAM_SIZE , &alloc,ULONG_MAX ); +if (status !=EFI_SUCCESS ) +efi_exit (handle, status); + + boot_params =memset ((void *)alloc,0x0 ,PARAM_SIZE ); + hdr = &boot_params->hdr; +/* Assign the setup_header fields that the kernel actually cares about */ hdr->root_flags =1 ; hdr->vid_mode =0xffff ;
@@ -466,13 +474,15 @@ efi_status_t __efiapi efi_pe_entry(efi_h/* Convert unicode cmdline to ascii */ cmdline_ptr =efi_convert_cmdline (image, &options_size); -if (!cmdline_ptr) +if (!cmdline_ptr) { +efi_free (PARAM_SIZE , alloc);efi_exit (handle,EFI_OUT_OF_RESOURCES ); + }efi_set_u64_split ((unsigned long )cmdline_ptr, &hdr->cmd_line_ptr, - &boot_params.ext_cmd_line_ptr); + &boot_params->ext_cmd_line_ptr); -efi_stub_entry (handle, sys_table_arg, &boot_params); +efi_stub_entry (handle, sys_table_arg, boot_params);/* not reached */ }