ARC: fix build warnings
Subsystems (9)
Sasha Levin
maintainerPATCH 1/39 ARC: fix build warnings
From: Vineet Gupta <[email protected]>
[ Upstream commit 89c92142f75eb80064f5b9f1111484b1b4d81790 ]
| arch/arc/mm/tlb.c:914:2: warning: variable length array 'pd0' is used [-Wvla] | arch/arc/include/asm/cmpxchg.h:95:29: warning: value computed is not used [-Wunused-value]
--- arch/arc/include/asm/cmpxchg.h | 14 ++++++++++---- arch/arc/mm/tlb.c | 13 ++++++++----- 2 files changed, 18 insertions(+), 9 deletions(-)
arch/arc/include/asm/cmpxchg.h +10 -4
@@ -92,8 +92,11 @@ __cmpxchg(volatile void *ptr, unsigned long expected, unsigned long new)#endif /* CONFIG_ARC_HAS_LLSC */ -#define cmpxchg (ptr, o, n) ((typeof(*(ptr)))__cmpxchg((ptr), \ - (unsigned long)(o), (unsigned long)(n))) +#define cmpxchg (ptr, o, n) ({ \ + (typeof(*(ptr)))__cmpxchg((ptr), \ + (unsigned long)(o), \ + (unsigned long)(n)); \ +})/* * atomic_cmpxchg is same as cmpxchg
@@ -198,8 +201,11 @@ static inline unsigned long __xchg(unsigned long val, volatile void *ptr, return __xchg_bad_pointer(); } -#define xchg (ptr, with) ((typeof(*(ptr)))__xchg((unsigned long)(with), (ptr), \ - sizeof(*(ptr)))) +#define xchg (ptr, with) ({ \ + (typeof(*(ptr)))__xchg((unsigned long)(with), \ + (ptr), \ + sizeof(*(ptr))); \ +})#endif /* CONFIG_ARC_PLAT_EZNPS */
arch/arc/mm/tlb.c +8 -5
@@ -911,9 +911,11 @@ void do_tlb_overlap_fault(unsigned long cause, unsigned long address, struct pt_regs *regs) {struct cpuinfo_arc_mmu *mmu = &cpuinfo_arc700[smp_processor_id ()].mmu; -unsigned int pd0[mmu->ways];unsigned long flags; -int set; +int set, n_ways = mmu->ways; + + n_ways =min (n_ways,4 ); +BUG_ON (mmu->ways >4 );local_irq_save (flags);
@@ -921,9 +923,10 @@ void do_tlb_overlap_fault(unsigned long cause, unsigned long address,for (set =0 ; set < mmu->sets; set++) {int is_valid, way; +unsigned int pd0[4 ];/* read out all the ways of current set */ -for (way =0 , is_valid =0 ; way < mmu->ways; way++) { +for (way =0 , is_valid =0 ; way < n_ways; way++) {write_aux_reg (ARC_REG_TLBINDEX ,SET_WAY_TO_IDX (mmu, set, way));write_aux_reg (ARC_REG_TLBCOMMAND , TLBRead);
@@ -937,14 +940,14 @@ void do_tlb_overlap_fault(unsigned long cause, unsigned long address,continue ;/* Scan the set for duplicate ways: needs a nested loop */ -for (way =0 ; way < mmu->ways -1 ; way++) { +for (way =0 ; way < n_ways -1 ; way++) {int n;if (!pd0[way])continue ; -for (n = way +1 ; n < mmu->ways; n++) { +for (n = way +1 ; n < n_ways; n++) {if (pd0[way] != pd0[n])continue ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 2/39 dmaengine: dw-axi-dmac: fix null dereference when pointer first is null
From: Colin Ian King <[email protected]>
[ Upstream commit 0788611c9a0925c607de536b2449de5ed98ef8df ]
In the unlikely event that axi_desc_get returns a null desc in the very first iteration of the while-loop the error exit path ends up calling axi_desc_put on a null pointer 'first' and this causes a null pointer dereference. Fix this by adding a null check on pointer 'first' before calling axi_desc_put.
Addresses-Coverity: ("Explicit null dereference")
--- drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +2 -1
@@ -512,7 +512,8 @@ dma_chan_prep_dma_memcpy(struct dma_chan *dchan, dma_addr_t dst_adr,return vchan_tx_prep (&chan->vc, &first->vd, flags); err_desc_get: -axi_desc_put (first); +if (first) +axi_desc_put (first);return NULL ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 3/39 dmaengine: sprd: Fix block length overflow
In reply to Sasha LevinFrom: Eric Long <[email protected]>
[ Upstream commit 89d03b3c126d683f7b2cd5b07178493993d12448 ]
The maximum value of block length is 0xffff, so if the configured transfer length is more than 0xffff, that will cause block length overflow to lead a configuration error.
Thus we can set block length as the maximum burst length to avoid this issue, since the maximum burst length will not be a big value which is more than 0xffff.
--- drivers/dma/sprd-dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/sprd-dma.c +1 -1
@@ -663,7 +663,7 @@ static int sprd_dma_fill_desc(struct dma_chan *chan, temp |= slave_cfg->src_maxburst &SPRD_DMA_FRG_LEN_MASK ; hw->frg_len = temp; - hw->blk_len = len &SPRD_DMA_BLK_LEN_MASK ; + hw->blk_len = slave_cfg->src_maxburst &SPRD_DMA_BLK_LEN_MASK ; hw->trsc_len = len &SPRD_DMA_TRSC_LEN_MASK ; temp = (dst_step &SPRD_DMA_TRSF_STEP_MASK ) <<SPRD_DMA_DEST_TRSF_STEP_OFFSET ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 4/39 ARC: [plat-hsdk]: Add missing multicast filter bins number to GMAC node
In reply to Sasha LevinFrom: Jose Abreu <[email protected]>
[ Upstream commit ecc906a11c2a0940e1a380debd8bd5bc09faf454 ]
GMAC controller on HSDK boards supports 256 Hash Table size so we need to add the multicast filter bins property. This allows for the Hash filter to work properly using stmmac driver.
--- arch/arc/boot/dts/hsdk.dts | 1 + 1 file changed, 1 insertion(+)
arch/arc/boot/dts/hsdk.dts +1 -0
@@ -175,6 +175,7 @@ interrupt-names = "macirq"; phy-mode = "rgmii"; snps,pbl = <32>; + snps,multicast-filter-bins = <256>; clocks = <&gmacclk>; clock-names = "stmmaceth"; phy-handle = <&phy0>;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 5/39 ARC: [plat-hsdk]: Add missing FIFO size entry in GMAC node
In reply to Sasha LevinFrom: Jose Abreu <[email protected]>
[ Upstream commit 4c70850aeb2e40016722cd1abd43c679666d3ca0 ]
Add the binding for RX/TX fifo size of GMAC node.
--- arch/arc/boot/dts/hsdk.dts | 3 +++ 1 file changed, 3 insertions(+)
arch/arc/boot/dts/hsdk.dts +3 -0
@@ -184,6 +184,9 @@ mac-address = [00 00 00 00 00 00]; /* Filled in by U-Boot */ dma-coherent; + tx-fifo-depth = <4096>; + rx-fifo-depth = <4096>; + mdio { #address-cells = <1>; #size-cells = <0>;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 6/39 fpga: dfl: afu: Pass the correct device to dma_mapping_error()
In reply to Sasha LevinFrom: Scott Wood <[email protected]>
[ Upstream commit 13069847a475b60069918dc9971f5adb42811ce3 ]
dma_mapping_error() was being called on a different device struct than what was passed to map/unmap. Besides rendering the error checking ineffective, it caused a debug splat with CONFIG_DMA_API_DEBUG.
--- drivers/fpga/dfl-afu-dma-region.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/fpga/dfl-afu-dma-region.c +1 -1
@@ -399,7 +399,7 @@ int afu_dma_map_region(struct dfl_feature_platform_data *pdata, region->pages[0 ],0 , region->length, DMA_BIDIRECTIONAL); -if (dma_mapping_error (&pdata->dev->dev, region->iova)) { +if (dma_mapping_error (dfl_fpga_pdata_to_parent (pdata), region->iova)) {dev_err (&pdata->dev->dev,"failed to map for dma\n" ); ret = -EFAULT ; goto unpin_pages;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 7/39 fpga: dfl: Add lockdep classes for pdata->lock
In reply to Sasha LevinFrom: Scott Wood <[email protected]>
[ Upstream commit dfe3de8d397bf878b31864d4e489d41118ec475f ]
struct dfl_feature_platform_data (and it's mutex) is used by both fme and port devices, and when lockdep is enabled it complains about nesting between these locks. Tell lockdep about the difference so it can track each class separately.
Here's the lockdep complaint:
[ 409.680668] WARNING: possible recursive locking detected
[ 409.685983] 5.1.0-rc3.fpga+ #1 Tainted: G E
[ 409.691469] --------------------------------------------
[ 409.696779] fpgaconf/9348 is trying to acquire lock:
[ 409.701746] 00000000a443fe2e (&pdata->lock){+.+.}, at: port_enable_set+0x24/0x60 [dfl_afu]
[ 409.710006]
[ 409.710006] but task is already holding lock:
[ 409.715837] 0000000063b78782 (&pdata->lock){+.+.}, at: fme_pr_ioctl+0x21d/0x330 [dfl_fme]
[ 409.724012]
[ 409.724012] other info that might help us debug this:
[ 409.730535] Possible unsafe locking scenario:
[ 409.730535]
[ 409.736457] CPU0
[ 409.738910] ----
[ 409.741360] lock(&pdata->lock);
[ 409.744679] lock(&pdata->lock);
[ 409.747999]
[ 409.747999] *** DEADLOCK ***
[ 409.747999]
[ 409.753920] May be due to missing lock nesting notation
[ 409.753920]
[ 409.760704] 4 locks held by fpgaconf/9348:
[ 409.764805] #0: 0000000063b78782 (&pdata->lock){+.+.}, at: fme_pr_ioctl+0x21d/0x330 [dfl_fme]
[ 409.773408] #1: 00000000213c8a66 (®ion->mutex){+.+.}, at: fpga_region_program_fpga+0x24/0x200 [fpga_region]
[ 409.783489] #2: 00000000fe63afb9 (&mgr->ref_mutex){+.+.}, at: fpga_mgr_lock+0x15/0x40 [fpga_mgr]
[ 409.792354] #3: 000000000b2285c5 (&bridge->mutex){+.+.}, at: __fpga_bridge_get+0x26/0xa0 [fpga_bridge]
[ 409.801740]
[ 409.801740] stack backtrace:
[ 409.806102] CPU: 45 PID: 9348 Comm: fpgaconf Kdump: loaded Tainted: G E 5.1.0-rc3.fpga+ #1
[ 409.815658] Hardware name: Intel Corporation S2600BT/S2600BT, BIOS SE5C620.86B.01.00.0763.022420181017 02/24/2018
[ 409.825911] Call Trace:
[ 409.828369] dump_stack+0x5e/0x8b
[ 409.831686] __lock_acquire+0xf3d/0x10e0
[ 409.835612] ? find_held_lock+0x3c/0xa0
[ 409.839451] lock_acquire+0xbc/0x1d0
[ 409.843030] ? port_enable_set+0x24/0x60 [dfl_afu]
[ 409.847823] ? port_enable_set+0x24/0x60 [dfl_afu]
[ 409.852616] __mutex_lock+0x86/0x970
[ 409.856195] ? port_enable_set+0x24/0x60 [dfl_afu]
[ 409.860989] ? port_enable_set+0x24/0x60 [dfl_afu]
[ 409.865777] ? __mutex_unlock_slowpath+0x4b/0x290
[ 409.870486] port_enable_set+0x24/0x60 [dfl_afu]
[ 409.875106] fpga_bridges_disable+0x36/0x50 [fpga_bridge]
[ 409.880502] fpga_region_program_fpga+0xea/0x200 [fpga_region]
[ 409.886338] fme_pr_ioctl+0x13e/0x330 [dfl_fme]
[ 409.890870] fme_ioctl+0x66/0xe0 [dfl_fme]
[ 409.894973] do_vfs_ioctl+0xa9/0x720
[ 409.898548] ? lockdep_hardirqs_on+0xf0/0x1a0
[ 409.902907] ksys_ioctl+0x60/0x90
[ 409.906225] __x64_sys_ioctl+0x16/0x20
[ 409.909981] do_syscall_64+0x5a/0x220
[ 409.913644] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[ 409.918698] RIP: 0033:0x7f9d31b9b8d7
[ 409.922276] Code: 44 00 00 48 8b 05 b9 15 2d 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 89 15 2d 00 f7 d8 64 89 01 48
[ 409.941020] RSP: 002b:00007ffe4cae0d68 EFLAGS: 00000202 ORIG_RAX: 0000000000000010
[ 409.948588] RAX: ffffffffffffffda RBX: 00007f9d32ade6a0 RCX: 00007f9d31b9b8d7
[ 409.955719] RDX: 00007ffe4cae0df0 RSI: 000000000000b680 RDI: 0000000000000003
[ 409.962852] RBP: 0000000000000003 R08: 00007f9d2b70a177 R09: 00007ffe4cae0e40
[ 409.969984] R10: 00007ffe4cae0160 R11: 0000000000000202 R12: 00007ffe4cae0df0
[ 409.977115] R13: 000000000000b680 R14: 0000000000000000 R15: 00007ffe4cae0f60--- drivers/fpga/dfl.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/fpga/dfl.c +15 -1
@@ -40,6 +40,13 @@ enum dfl_fpga_devt_type { DFL_FPGA_DEVT_MAX, }; +static struct lock_class_key dfl_pdata_keys[DFL_ID_MAX ]; + +static const char *dfl_pdata_key_strings[DFL_ID_MAX ] = { +"dfl-fme-pdata" , +"dfl-port-pdata" , +}; +/** * dfl_dev_info - dfl feature device information. * @name: name string of the feature platform device.
@@ -443,11 +450,16 @@ static int build_info_commit_dev(struct build_feature_devs_info *binfo)struct platform_device *fdev = binfo->feature_dev;struct dfl_feature_platform_data *pdata;struct dfl_feature_info *finfo, *p; +enum dfl_id_type type;int ret, index =0 ;if (!fdev)return 0 ; + type =feature_dev_id_type (fdev); +if (WARN_ON_ONCE (type >=DFL_ID_MAX )) +return -EINVAL ; +/* * we do not need to care for the memory which is associated with * the platform device. After calling platform_device_unregister(),
@@ -463,6 +475,8 @@ static int build_info_commit_dev(struct build_feature_devs_info *binfo) pdata->num = binfo->feature_num; pdata->dfl_cdev = binfo->cdev;mutex_init (&pdata->lock); +lockdep_set_class_and_name (&pdata->lock, &dfl_pdata_keys[type], + dfl_pdata_key_strings[type]);/* * the count should be initialized to 0 to make sure
@@ -497,7 +511,7 @@ static int build_info_commit_dev(struct build_feature_devs_info *binfo) ret =platform_device_add (binfo->feature_dev);if (!ret) { -if (feature_dev_id_type (binfo->feature_dev) ==PORT_ID ) +if (type ==PORT_ID )dfl_fpga_cdev_add_port_dev (binfo->cdev, binfo->feature_dev);else
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 8/39 fpga: dfl: expand minor range when registering chrdev region
In reply to Sasha LevinFrom: Chengguang Xu <[email protected]>
[ Upstream commit de9a7f6f5f1967d275311cca9163b4a3ffe9b0ae ]
Actually, total amount of available minor number
for a single major is MINORMASK + 1. So expand
minor range when registering chrdev region.
--- drivers/fpga/dfl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/fpga/dfl.c +3 -3
@@ -322,7 +322,7 @@ static void dfl_chardev_uinit(void)for (i =0 ; i <DFL_FPGA_DEVT_MAX ; i++)if (MAJOR (dfl_chrdevs[i].devt)) {unregister_chrdev_region (dfl_chrdevs[i].devt, -MINORMASK ); +MINORMASK +1 ); dfl_chrdevs[i].devt =MKDEV (0 ,0 ); } }
@@ -332,8 +332,8 @@ static int dfl_chardev_init(void)int i, ret;for (i =0 ; i <DFL_FPGA_DEVT_MAX ; i++) { - ret =alloc_chrdev_region (&dfl_chrdevs[i].devt,0 ,MINORMASK , - dfl_chrdevs[i].name); + ret =alloc_chrdev_region (&dfl_chrdevs[i].devt,0 , +MINORMASK +1 , dfl_chrdevs[i].name);if (ret) goto exit; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 9/39 parport: Fix mem leak in parport_register_dev_model
In reply to Sasha LevinFrom: YueHaibing <[email protected]>
[ Upstream commit 1c7ebeabc9e5ee12e42075a597de40fdb9059530 ]
BUG: memory leak
unreferenced object 0xffff8881df48cda0 (size 16):
comm "syz-executor.0", pid 5077, jiffies 4295994670 (age 22.280s)
hex dump (first 16 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<00000000d2d0d5fe>] parport_register_dev_model+0x141/0x6e0 [parport]
[<00000000782f6dab>] 0xffffffffc15d1196
[<00000000d2ca6ae4>] platform_drv_probe+0x7e/0x100
[<00000000628c2a94>] really_probe+0x342/0x4d0
[<000000006874f5da>] driver_probe_device+0x8c/0x170
[<00000000424de37a>] __device_attach_driver+0xda/0x100
[<000000002acab09a>] bus_for_each_drv+0xfe/0x170
[<000000003d9e5f31>] __device_attach+0x190/0x230
[<0000000035d32f80>] bus_probe_device+0x123/0x140
[<00000000a05ba627>] device_add+0x7cc/0xce0
[<000000003f7560bf>] platform_device_add+0x230/0x3c0
[<000000002a0be07d>] 0xffffffffc15d0949
[<000000007361d8d2>] port_check+0x3b/0x50 [parport]
[<000000004d67200f>] bus_for_each_dev+0x115/0x180
[<000000003ccfd11c>] __parport_register_driver+0x1f0/0x210 [parport]
[<00000000987f06fc>] 0xffffffffc15d803eAfter commit 4e5a74f1db8d ("parport: Revert "parport: fix memory leak""), free_pardevice do not free par_dev->state, we should free it in error path of parport_register_dev_model before return.
--- drivers/parport/share.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/parport/share.c +2 -0
@@ -895,6 +895,7 @@ parport_register_dev_model(struct parport *port, const char *name, par_dev->devmodel = true; ret =device_register (&par_dev->dev);if (ret) { +kfree (par_dev->state);put_device (&par_dev->dev); goto err_put_port; }
@@ -912,6 +913,7 @@ parport_register_dev_model(struct parport *port, const char *name,spin_unlock (&port->physport->pardevice_lock);pr_debug ("%s: cannot grant exclusive access for device %s\n" , port->name, name); +kfree (par_dev->state);device_unregister (&par_dev->dev); goto err_put_port; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 10/39 parisc: Fix compiler warnings in float emulation code
In reply to Sasha LevinFrom: Helge Deller <[email protected]>
[ Upstream commit 6b98d9134e14f5ef4bcf64b27eedf484ed19a1ec ]
Avoid such compiler warnings:arch/parisc/math-emu/cnv_float.h:71:27: warning: ‘<<’ in boolean context, did you mean ‘<’ ? [-Wint-in-bool-context]
((Dintp1(dint_valueA) << 33 - SGL_EXP_LENGTH) || Dintp2(dint_valueB))
arch/parisc/math-emu/fcnvxf.c:257:6: note: in expansion of macro ‘Dint_isinexact_to_sgl’
if (Dint_isinexact_to_sgl(srcp1,srcp2)) {
--- arch/parisc/math-emu/cnv_float.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/parisc/math-emu/cnv_float.h +4 -4
@@ -60,19 +60,19 @@ ((exponent < (SGL_P -1 )) ? \ (Sall(sgl_value) << (SGL_EXP_LENGTH + 1 + exponent)) : FALSE) -#define Int_isinexact_to_sgl (int_value) (int_value << 33 - SGL_EXP_LENGTH) +#define Int_isinexact_to_sgl (int_value) ((int_value << 33 - SGL_EXP_LENGTH) != 0) #define Sgl_roundnearest_from_int(int_value,sgl_value) \ if (int_value & 1<<(SGL_EXP_LENGTH - 2)) /* round bit */ \ - if ((int_value << 34 - SGL_EXP_LENGTH) || Slow(sgl_value)) \ + if (((int_value << 34 - SGL_EXP_LENGTH) != 0) || Slow(sgl_value)) \ Sall(sgl_value)++#define Dint_isinexact_to_sgl (dint_valueA,dint_valueB) \ - ((Dintp1(dint_valueA) << 33 - SGL_EXP_LENGTH) || Dintp2(dint_valueB)) + (((Dintp1(dint_valueA) << 33 - SGL_EXP_LENGTH) != 0) || Dintp2(dint_valueB))#define Sgl_roundnearest_from_dint (dint_valueA,dint_valueB,sgl_value) \ if (Dintp1(dint_valueA) & 1<<(SGL_EXP_LENGTH - 2)) \ - if ((Dintp1(dint_valueA) << 34 - SGL_EXP_LENGTH) || \ + if (((Dintp1(dint_valueA) << 34 - SGL_EXP_LENGTH) != 0) || \ Dintp2(dint_valueB) || Slow(sgl_value)) Sall(sgl_value)++#define Dint_isinexact_to_dbl (dint_value) \
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 11/39 IB/rdmavt: Fix alloc_qpn() WARN_ON()
In reply to Sasha LevinFrom: Mike Marciniszyn <[email protected]>
[ Upstream commit 2abae62a26a265129b364d8c1ef3be55e2c01309 ]
The qpn allocation logic has a WARN_ON() that intends to detect the use of an index that will introduce bits in the lower order bits of the QOS bits in the QPN.
Unfortunately, it has the following bugs:
- it misfires when wrapping QPN allocation for non-QOS
- it doesn't correctly detect low order QOS bits (despite the comment)
The WARN_ON() should not be applied to non-QOS (qos_shift == 1).
Additionally, it SHOULD test the qpn bits per the table below:
2 data VLs: [qp7, qp6, qp5, qp4, qp3, qp2, qp1] ^
[ 0, 0, 0, 0, 0, 0, sc0], qp bit 1 always 0*
3-4 data VLs: [qp7, qp6, qp5, qp4, qp3, qp2, qp1] ^
[ 0, 0, 0, 0, 0, sc1, sc0], qp bits [21] always 0
5-8 data VLs: [qp7, qp6, qp5, qp4, qp3, qp2, qp1] ^
[ 0, 0, 0, 0, sc2, sc1, sc0] qp bits [321] always 0Fix by qualifying the warning for qos_shift > 1 and producing the correct mask to insure the above bits are zero without generating a superfluous warning.
--- drivers/infiniband/sw/rdmavt/qp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/sw/rdmavt/qp.c +2 -1
@@ -412,7 +412,8 @@ static int alloc_qpn(struct rvt_dev_info *rdi, struct rvt_qpn_table *qpt, offset = qpt->incr | ((offset &1 ) ^1 ); }/* there can be no set bits in low-order QoS bits */ -WARN_ON (offset & (BIT (rdi->dparms.qos_shift) -1 )); +WARN_ON (rdi->dparms.qos_shift >1 && + offset & ((BIT (rdi->dparms.qos_shift -1 ) -1 ) <<1 )); qpn =mk_qpn (qpt, map, offset); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 12/39 IB/hfi1: Insure freeze_work work_struct is canceled on shutdown
In reply to Sasha LevinFrom: Mike Marciniszyn <[email protected]>
[ Upstream commit 6d517353c70bb0818b691ca003afdcb5ee5ea44e ]
By code inspection, the freeze_work is never canceled.
Fix by adding a cancel_work_sync in the shutdown path to insure it is no longer running.
--- drivers/infiniband/hw/hfi1/chip.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/hfi1/chip.c +1 -0
@@ -9849,6 +9849,7 @@ void hfi1_quiet_serdes(struct hfi1_pportdata *ppd)/* disable the port */ clear_rcvctrl (dd,RCV_CTRL_RCV_PORT_ENABLE_SMASK ); +cancel_work_sync (&ppd->freeze_work); }static inline int init_cpu_counters (struct hfi1_devdata *dd)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 13/39 IB/{qib, hfi1, rdmavt}: Correct ibv_devinfo max_mr value
In reply to Sasha LevinFrom: Mike Marciniszyn <[email protected]>
[ Upstream commit 35164f5259a47ea756fa1deb3e463ac2a4f10dc9 ]
The command 'ibv_devinfo -v' reports 0 for max_mr.
Fix by assigning the query values after the mr lkey_table has been built rather than early on in the driver.
--- drivers/infiniband/hw/hfi1/verbs.c | 2 -- drivers/infiniband/hw/qib/qib_verbs.c | 2 -- drivers/infiniband/sw/rdmavt/mr.c | 2 ++ 3 files changed, 2 insertions(+), 4 deletions(-)
drivers/infiniband/hw/hfi1/verbs.c +0 -2
@@ -1418,8 +1418,6 @@ static void hfi1_fill_device_attr(struct hfi1_devdata *dd) rdi->dparms.props.max_cq = hfi1_max_cqs; rdi->dparms.props.max_ah = hfi1_max_ahs; rdi->dparms.props.max_cqe = hfi1_max_cqes; - rdi->dparms.props.max_mr = rdi->lkey_table.max; - rdi->dparms.props.max_fmr = rdi->lkey_table.max; rdi->dparms.props.max_map_per_fmr =32767 ; rdi->dparms.props.max_pd = hfi1_max_pds; rdi->dparms.props.max_qp_rd_atom =HFI1_MAX_RDMA_ATOMIC ;
drivers/infiniband/hw/qib/qib_verbs.c +0 -2
@@ -1495,8 +1495,6 @@ static void qib_fill_device_attr(struct qib_devdata *dd) rdi->dparms.props.max_cq = ib_qib_max_cqs; rdi->dparms.props.max_cqe = ib_qib_max_cqes; rdi->dparms.props.max_ah = ib_qib_max_ahs; - rdi->dparms.props.max_mr = rdi->lkey_table.max; - rdi->dparms.props.max_fmr = rdi->lkey_table.max; rdi->dparms.props.max_map_per_fmr =32767 ; rdi->dparms.props.max_qp_rd_atom =QIB_MAX_RDMA_ATOMIC ; rdi->dparms.props.max_qp_init_rd_atom =255 ;
drivers/infiniband/sw/rdmavt/mr.c +2 -0
@@ -96,6 +96,8 @@ int rvt_driver_mr_init(struct rvt_dev_info *rdi)for (i =0 ; i < rdi->lkey_table.max; i++)RCU_INIT_POINTER (rdi->lkey_table.table[i],NULL ); + rdi->dparms.props.max_mr = rdi->lkey_table.max; + rdi->dparms.props.max_fmr = rdi->lkey_table.max;return 0 ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 14/39 IB/hfi1: Validate page aligned for a given virtual address
In reply to Sasha LevinFrom: Kamenee Arumugam <[email protected]>
[ Upstream commit 97736f36dbebf2cda2799db3b54717ba5b388255 ]
User applications can register memory regions for TID buffers that are not aligned on page boundaries. Hfi1 is expected to pin those pages in memory and cache the pages with mmu_rb. The rb tree will fail to insert pages that are not aligned correctly.
Validate whether a given virtual address is page aligned before pinning.
--- drivers/infiniband/hw/hfi1/user_exp_rcv.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/infiniband/hw/hfi1/user_exp_rcv.c +3 -0
@@ -324,6 +324,9 @@ int hfi1_user_exp_rcv_setup(struct hfi1_filedata *fd,u32 *tidlist =NULL ;struct tid_user_buf *tidbuf; +if (!PAGE_ALIGNED (tinfo->vaddr)) +return -EINVAL ; + tidbuf =kzalloc (sizeof (*tidbuf),GFP_KERNEL );if (!tidbuf)return -ENOMEM ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 15/39 MIPS: uprobes: remove set but not used variable 'epc'
In reply to Sasha LevinFrom: YueHaibing <[email protected]>
[ Upstream commit f532beeeff0c0a3586cc15538bc52d249eb19e7c ]
Fixes gcc '-Wunused-but-set-variable' warning:
arch/mips/kernel/uprobes.c: In function 'arch_uprobe_pre_xol':arch/mips/kernel/uprobes.c:115:17: warning: variable 'epc' set but not used [-Wunused-but-set-variable]
It's never used since introduction in commit 40e084a506eb ("MIPS: Add uprobes support.")
--- arch/mips/kernel/uprobes.c | 3 --- 1 file changed, 3 deletions(-)
arch/mips/kernel/uprobes.c +0 -3
@@ -112,9 +112,6 @@ int arch_uprobe_pre_xol(struct arch_uprobe *aup, struct pt_regs *regs)*/ aup->resume_epc = regs->cp0_epc +4 ;if (insn_has_delay_slot ((union mips_instruction ) aup->insn[0 ])) { -unsigned long epc; - - epc = regs->cp0_epc;__compute_return_epc_for_insn (regs, (union mips_instruction ) aup->insn[0 ]); aup->resume_epc = regs->cp0_epc;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 16/39 xtensa: Fix section mismatch between memblock_reserve and mem_reserve
In reply to Sasha LevinFrom: Guenter Roeck <[email protected]>
[ Upstream commit adefd051a6707a6ca0ebad278d3c1c05c960fc3b ]
Since commit 9012d011660ea5cf2 ("compiler: allow all arches to enable CONFIG_OPTIMIZE_INLINING"), xtensa:tinyconfig fails to build with section mismatch errors.
WARNING: vmlinux.o(.text.unlikely+0x68): Section mismatch in reference
from the function ___pa()
to the function .meminit.text:memblock_reserve()
WARNING: vmlinux.o(.text.unlikely+0x74): Section mismatch in reference
from the function mem_reserve()
to the function .meminit.text:memblock_reserve()
FATAL: modpost: Section mismatches detected.
This was not seen prior to the above mentioned commit because mem_reserve() was always inlined.
Mark mem_reserve(() as __init_memblock to have it reside in the same section as memblock_reserve().
Message-Id: <[email protected]>
--- arch/xtensa/kernel/setup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/xtensa/kernel/setup.c +2 -1
@@ -310,7 +310,8 @@ extern char _SecondaryResetVector_text_start;extern char _SecondaryResetVector_text_end;#endif -static inline int mem_reserve (unsigned long start,unsigned long end) +static inline int __init_memblock mem_reserve(unsigned long start, +unsigned long end) {return memblock_reserve (start, end - start); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 17/39 kselftest/cgroup: fix unexpected testing failure on test_memcontrol
In reply to Sasha LevinFrom: Alex Shi <[email protected]>
[ Upstream commit f6131f28057d4fd8922599339e701a2504e0f23d ]
The cgroup testing relies on the root cgroup's subtree_control setting, If the 'memory' controller isn't set, all test cases will be failed as following:
$ sudo ./test_memcontrol not ok 1 test_memcg_subtree_control not ok 2 test_memcg_current ok 3 # skip test_memcg_min not ok 4 test_memcg_low not ok 5 test_memcg_high not ok 6 test_memcg_max not ok 7 test_memcg_oom_events ok 8 # skip test_memcg_swap_max not ok 9 test_memcg_sock not ok 10 test_memcg_oom_group_leaf_events not ok 11 test_memcg_oom_group_parent_events not ok 12 test_memcg_oom_group_score_events
To correct this unexpected failure, this patch write the 'memory' to subtree_control of root to get a right result.
--- tools/testing/selftests/cgroup/test_memcontrol.c | 4 ++++ 1 file changed, 4 insertions(+)
tools/testing/selftests/cgroup/test_memcontrol.c +4 -0
@@ -1205,6 +1205,10 @@ int main(int argc, char **argv)if (cg_read_strstr (root,"cgroup.controllers" ,"memory" ))ksft_exit_skip ("memory controller isn't available\n" ); +if (cg_read_strstr (root,"cgroup.subtree_control" ,"memory" )) +if (cg_write (root,"cgroup.subtree_control" ,"+memory" )) +ksft_exit_skip ("Failed to set memory controller\n" ); +for (i =0 ; i <ARRAY_SIZE (tests); i++) {switch (tests[i].fn (root)) {case KSFT_PASS :
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 18/39 kselftest/cgroup: fix unexpected testing failure on test_core
In reply to Sasha LevinFrom: Alex Shi <[email protected]>
[ Upstream commit 00e38a5d753d7788852f81703db804a60a84c26e ]
The cgroup testing relys on the root cgroup's subtree_control setting, If the 'memory' controller isn't set, some test cases will be failed as following:
$sudo ./test_core
not ok 1 test_cgcore_internal_process_constraint
ok 2 test_cgcore_top_down_constraint_enable
not ok 3 test_cgcore_top_down_constraint_disable
...
To correct this unexpected failure, this patch write the 'memory' to subtree_control of root to get a right result.
--- tools/testing/selftests/cgroup/test_core.c | 5 +++++ 1 file changed, 5 insertions(+)
tools/testing/selftests/cgroup/test_core.c +5 -0
@@ -376,6 +376,11 @@ int main(int argc, char *argv[])if (cg_find_unified_root (root,sizeof (root)))ksft_exit_skip ("cgroup v2 isn't mounted\n" ); + +if (cg_read_strstr (root,"cgroup.subtree_control" ,"memory" )) +if (cg_write (root,"cgroup.subtree_control" ,"+memory" )) +ksft_exit_skip ("Failed to set memory controller\n" ); +for (i =0 ; i <ARRAY_SIZE (tests); i++) {switch (tests[i].fn (root)) {case KSFT_PASS :
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 19/39 kselftest/cgroup: fix incorrect test_core skip
In reply to Sasha LevinFrom: Alex Shi <[email protected]>
[ Upstream commit f97f3f8839eb9de5843066d80819884f7722c8c5 ]
The test_core will skip the test_cgcore_no_internal_process_constraint_on_threads test case if the 'cpu' controller missing in root's subtree_control. In fact we need to set the 'cpu' in subtree_control, to make the testing meaningful.
./test_core
...
ok 4 # skip test_cgcore_no_internal_process_constraint_on_threads
...
--- tools/testing/selftests/cgroup/test_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/cgroup/test_core.c +1 -1
@@ -198,7 +198,7 @@ static int test_cgcore_no_internal_process_constraint_on_threads(const char *roochar *parent =NULL , *child =NULL ;if (cg_read_strstr (root,"cgroup.controllers" ,"cpu" ) || -cg_read_strstr (root,"cgroup.subtree_control" ,"cpu" )) { +cg_write (root,"cgroup.subtree_control" ,"+cpu" )) { ret =KSFT_SKIP ; goto cleanup; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 20/39 selftests: vm: install test_vmalloc.sh for run_vmtests
In reply to Sasha LevinFrom: Naresh Kamboju <[email protected]>
[ Upstream commit bc2cce3f2ebcae02aa4bb29e3436bf75ee674c32 ]
Add test_vmalloc.sh to TEST_FILES to make sure it gets installed for run_vmtests.
Fixed below error:
./run_vmtests: line 217: ./test_vmalloc.sh: No such file or directory
Tested with: make TARGETS=vm install INSTALL_PATH=$PWD/x
--- tools/testing/selftests/vm/Makefile | 2 ++ 1 file changed, 2 insertions(+)
tools/testing/selftests/vm/Makefile +2 -0
@@ -24,6 +24,8 @@ TEST_GEN_FILES += virtual_address_range TEST_PROGS := run_vmtests +TEST_FILES := test_vmalloc.sh + KSFT_KHDR_INSTALL := 1 include ../lib.mk
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 21/39 net: dsa: mv88e6xxx: avoid error message on remove from VLAN 0
In reply to Sasha LevinFrom: Nikita Yushchenko <[email protected]>
[ Upstream commit 62394708f3e01c9f2be6be74eb6305bae1ed924f ]
When non-bridged, non-vlan'ed mv88e6xxx port is moving down, error message is logged:
failed to kill vid 0081/0 for device eth_cu_1000_4
This is caused by call from __vlan_vid_del() with vin set to zero, over call chain this results into _mv88e6xxx_port_vlan_del() called with vid=0, and mv88e6xxx_vtu_get() called from there returns -EINVAL.
On symmetric path moving port up, call goes through mv88e6xxx_port_vlan_prepare() that calls mv88e6xxx_port_check_hw_vlan() that returns -EOPNOTSUPP for zero vid.
This patch changes mv88e6xxx_vtu_get() to also return -EOPNOTSUPP for zero vid, then this error code is explicitly cleared in dsa_slave_vlan_rx_kill_vid() and error message is no longer logged.
--- drivers/net/dsa/mv88e6xxx/chip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/mv88e6xxx/chip.c +1 -1
@@ -1484,7 +1484,7 @@ static int mv88e6xxx_vtu_get(struct mv88e6xxx_chip *chip, u16 vid,int err;if (!vid) -return -EINVAL ; +return -EOPNOTSUPP ; entry->vid = vid -1 ; entry->valid = false;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 22/39 net: hns: Fix loopback test failed at copper ports
In reply to Sasha LevinFrom: Yonglong Liu <[email protected]>
[ Upstream commit 2e1f164861e500f4e068a9d909bbd3fcc7841483 ]
When doing a loopback test at copper ports, the serdes loopback and the phy loopback will fail, because of the adjust link had not finished, and phy not ready.
Adds sleep between adjust link and test process to fix it.
--- drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c +4 -0
@@ -339,6 +339,7 @@ static int __lb_setup(struct net_device *ndev,static int __lb_up (struct net_device *ndev,enum hnae_loop loop_mode) { +#define NIC_LB_TEST_WAIT_PHY_LINK_TIME 300struct hns_nic_priv *priv =netdev_priv (ndev);struct hnae_handle *h = priv->ae_handle;int speed, duplex;
@@ -365,6 +366,9 @@ static int __lb_up(struct net_device *ndev, h->dev->ops->adjust_link (h, speed, duplex); +/* wait adjust link done and phy ready */ +msleep (NIC_LB_TEST_WAIT_PHY_LINK_TIME ); +return 0 ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 23/39 mdesc: fix a missing-check bug in get_vdev_port_node_info()
In reply to Sasha LevinFrom: Gen Zhang <[email protected]>
[ Upstream commit 80caf43549e7e41a695c6d1e11066286538b336f ]
In get_vdev_port_node_info(), 'node_info->vdev_port.name' is allcoated by kstrdup_const(), and it returns NULL when fails. So 'node_info->vdev_port.name' should be checked.
--- arch/sparc/kernel/mdesc.c | 2 ++ 1 file changed, 2 insertions(+)
arch/sparc/kernel/mdesc.c +2 -0
@@ -357,6 +357,8 @@ static int get_vdev_port_node_info(struct mdesc_handle *md, u64 node, node_info->vdev_port.id = *idp; node_info->vdev_port.name =kstrdup_const (name,GFP_KERNEL ); +if (!node_info->vdev_port.name) +return -1 ; node_info->vdev_port.parent_cfg_hdl = *parent_cfg_hdlp;return 0 ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 24/39 sparc: perf: fix updated event period in response to PERF_EVENT_IOC_PERIOD
In reply to Sasha LevinFrom: Young Xiao <[email protected]>
[ Upstream commit 56cd0aefa475079e9613085b14a0f05037518fed ]
The PERF_EVENT_IOC_PERIOD ioctl command can be used to change the sample period of a running perf_event. Consequently, when calculating the next event period, the new period will only be considered after the previous one has overflowed.
This patch changes the calculation of the remaining event ticks so that they are offset if the period has changed.
See commit 3581fe0ef37c ("ARM: 7556/1: perf: fix updated event period in response to PERF_EVENT_IOC_PERIOD") for details.
--- arch/sparc/kernel/perf_event.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/sparc/kernel/perf_event.c +4 -0
@@ -891,6 +891,10 @@ static int sparc_perf_event_set_period(struct perf_event *event,s64 period = hwc->sample_period;int ret =0 ; +/* The period may have been changed by PERF_EVENT_IOC_PERIOD */ +if (unlikely (period != hwc->last_period)) + left = period - (hwc->last_period - left); +if (unlikely (left <= -period)) { left = period;local64_set (&hwc->period_left, left);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 25/39 net: ethernet: mediatek: Use hw_feature to judge if HWLRO is supported
In reply to Sasha LevinFrom: Sean Wang <[email protected]>
[ Upstream commit 9e4f56f1a7f3287718d0083b5cb85298dc05a5fd ]
Should hw_feature as hardware capability flags to check if hardware LRO got support.
--- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/ethernet/mediatek/mtk_eth_soc.c +6 -6
@@ -2304,13 +2304,13 @@ static int mtk_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,switch (cmd->cmd) {case ETHTOOL_GRXRINGS : -if (dev->features &NETIF_F_LRO ) { +if (dev->hw_features &NETIF_F_LRO ) { cmd->data =MTK_MAX_RX_RING_NUM ; ret =0 ; }break ;case ETHTOOL_GRXCLSRLCNT : -if (dev->features &NETIF_F_LRO ) { +if (dev->hw_features &NETIF_F_LRO ) {struct mtk_mac *mac =netdev_priv (dev); cmd->rule_cnt = mac->hwlro_ip_cnt;
@@ -2318,11 +2318,11 @@ static int mtk_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, }break ;case ETHTOOL_GRXCLSRULE : -if (dev->features &NETIF_F_LRO ) +if (dev->hw_features &NETIF_F_LRO ) ret =mtk_hwlro_get_fdir_entry (dev, cmd);break ;case ETHTOOL_GRXCLSRLALL : -if (dev->features &NETIF_F_LRO ) +if (dev->hw_features &NETIF_F_LRO ) ret =mtk_hwlro_get_fdir_all (dev, cmd, rule_locs);break ;
@@ -2339,11 +2339,11 @@ static int mtk_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)switch (cmd->cmd) {case ETHTOOL_SRXCLSRLINS : -if (dev->features &NETIF_F_LRO ) +if (dev->hw_features &NETIF_F_LRO ) ret =mtk_hwlro_add_ipaddr (dev, cmd);break ;case ETHTOOL_SRXCLSRLDEL : -if (dev->features &NETIF_F_LRO ) +if (dev->hw_features &NETIF_F_LRO ) ret =mtk_hwlro_del_ipaddr (dev, cmd);break ;default :
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 26/39 net: ethernet: mediatek: Use NET_IP_ALIGN to judge if HW RX_2BYTE_OFFSET is enabled
In reply to Sasha LevinFrom: Sean Wang <[email protected]>
[ Upstream commit 880c2d4b2fdfd580ebcd6bb7240a8027a1d34751 ]
Should only enable HW RX_2BYTE_OFFSET function in the case NET_IP_ALIGN equals to 2.
--- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/mediatek/mtk_eth_soc.c +2 -1
@@ -1784,6 +1784,7 @@ static void mtk_poll_controller(struct net_device *dev)static int mtk_start_dma (struct mtk_eth *eth) { +u32 rx_2b_offset = (NET_IP_ALIGN ==2 ) ?MTK_RX_2B_OFFSET :0 ;int err; err =mtk_dma_init (eth);
@@ -1800,7 +1801,7 @@ static int mtk_start_dma(struct mtk_eth *eth) MTK_QDMA_GLO_CFG);mtk_w32 (eth, -MTK_RX_DMA_EN |MTK_RX_2B_OFFSET | +MTK_RX_DMA_EN | rx_2b_offset |MTK_RX_BT_32DWORDS |MTK_MULTI_EN ,MTK_PDMA_GLO_CFG );
Signature · 1 line
2.20.1