Skip to content

Commit 3afc295

Browse files
committed
tgupdate: merge t/upstream base into t/upstream
2 parents 8e88c03 + a68e9c6 commit 3afc295

File tree

44 files changed

+692
-468
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+692
-468
lines changed

drivers/net/ethernet/freescale/fsl_pq_mdio.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,10 +479,12 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev)
479479
"missing 'reg' property in node %pOF\n",
480480
tbi);
481481
err = -EBUSY;
482+
of_node_put(tbi);
482483
goto error;
483484
}
484485
set_tbipa(*prop, pdev,
485486
data->get_tbipa, priv->map, &res);
487+
of_node_put(tbi);
486488
}
487489
}
488490

drivers/net/ethernet/intel/ice/ice_adapter.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,19 +99,21 @@ struct ice_adapter *ice_adapter_get(struct pci_dev *pdev)
9999

100100
index = ice_adapter_xa_index(pdev);
101101
scoped_guard(mutex, &ice_adapters_mutex) {
102-
err = xa_insert(&ice_adapters, index, NULL, GFP_KERNEL);
103-
if (err == -EBUSY) {
104-
adapter = xa_load(&ice_adapters, index);
102+
adapter = xa_load(&ice_adapters, index);
103+
if (adapter) {
105104
refcount_inc(&adapter->refcount);
106105
WARN_ON_ONCE(adapter->index != ice_adapter_index(pdev));
107106
return adapter;
108107
}
108+
err = xa_reserve(&ice_adapters, index, GFP_KERNEL);
109109
if (err)
110110
return ERR_PTR(err);
111111

112112
adapter = ice_adapter_new(pdev);
113-
if (!adapter)
113+
if (!adapter) {
114+
xa_release(&ice_adapters, index);
114115
return ERR_PTR(-ENOMEM);
116+
}
115117
xa_store(&ice_adapters, index, adapter, GFP_KERNEL);
116118
}
117119
return adapter;

drivers/net/ethernet/microchip/sparx5/sparx5_main.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,11 @@ static int sparx5_start(struct sparx5 *sparx5)
708708
/* Init masks */
709709
sparx5_update_fwd(sparx5);
710710

711+
/* Init flood masks */
712+
for (int pgid = sparx5_get_pgid(sparx5, PGID_UC_FLOOD);
713+
pgid <= sparx5_get_pgid(sparx5, PGID_BCAST); pgid++)
714+
sparx5_pgid_clear(sparx5, pgid);
715+
711716
/* CPU copy CPU pgids */
712717
spx5_wr(ANA_AC_PGID_MISC_CFG_PGID_CPU_COPY_ENA_SET(1), sparx5,
713718
ANA_AC_PGID_MISC_CFG(sparx5_get_pgid(sparx5, PGID_CPU)));

drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ static int sparx5_port_bridge_join(struct sparx5_port *port,
176176
struct net_device *bridge,
177177
struct netlink_ext_ack *extack)
178178
{
179+
struct switchdev_brport_flags flags = {0};
179180
struct sparx5 *sparx5 = port->sparx5;
180181
struct net_device *ndev = port->ndev;
181182
int err;
@@ -205,6 +206,11 @@ static int sparx5_port_bridge_join(struct sparx5_port *port,
205206
*/
206207
__dev_mc_unsync(ndev, sparx5_mc_unsync);
207208

209+
/* Enable uc/mc/bc flooding */
210+
flags.mask = BR_FLOOD | BR_MCAST_FLOOD | BR_BCAST_FLOOD;
211+
flags.val = flags.mask;
212+
sparx5_port_attr_bridge_flags(port, flags);
213+
208214
return 0;
209215

210216
err_switchdev_offload:
@@ -215,6 +221,7 @@ static int sparx5_port_bridge_join(struct sparx5_port *port,
215221
static void sparx5_port_bridge_leave(struct sparx5_port *port,
216222
struct net_device *bridge)
217223
{
224+
struct switchdev_brport_flags flags = {0};
218225
struct sparx5 *sparx5 = port->sparx5;
219226

220227
switchdev_bridge_port_unoffload(port->ndev, NULL, NULL, NULL);
@@ -234,6 +241,11 @@ static void sparx5_port_bridge_leave(struct sparx5_port *port,
234241

235242
/* Port enters in host more therefore restore mc list */
236243
__dev_mc_sync(port->ndev, sparx5_mc_sync, sparx5_mc_unsync);
244+
245+
/* Disable uc/mc/bc flooding */
246+
flags.mask = BR_FLOOD | BR_MCAST_FLOOD | BR_BCAST_FLOOD;
247+
flags.val = 0;
248+
sparx5_port_attr_bridge_flags(port, flags);
237249
}
238250

239251
static int sparx5_port_changeupper(struct net_device *dev,

drivers/net/ethernet/microchip/sparx5/sparx5_vlan.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,16 +167,6 @@ void sparx5_update_fwd(struct sparx5 *sparx5)
167167
/* Divide up fwd mask in 32 bit words */
168168
bitmap_to_arr32(mask, sparx5->bridge_fwd_mask, SPX5_PORTS);
169169

170-
/* Update flood masks */
171-
for (port = sparx5_get_pgid(sparx5, PGID_UC_FLOOD);
172-
port <= sparx5_get_pgid(sparx5, PGID_BCAST); port++) {
173-
spx5_wr(mask[0], sparx5, ANA_AC_PGID_CFG(port));
174-
if (is_sparx5(sparx5)) {
175-
spx5_wr(mask[1], sparx5, ANA_AC_PGID_CFG1(port));
176-
spx5_wr(mask[2], sparx5, ANA_AC_PGID_CFG2(port));
177-
}
178-
}
179-
180170
/* Update SRC masks */
181171
for (port = 0; port < sparx5->data->consts->n_ports; port++) {
182172
if (test_bit(port, sparx5->bridge_fwd_mask)) {

drivers/net/ethernet/mscc/ocelot_stats.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,6 +1021,6 @@ int ocelot_stats_init(struct ocelot *ocelot)
10211021

10221022
void ocelot_stats_deinit(struct ocelot *ocelot)
10231023
{
1024-
cancel_delayed_work(&ocelot->stats_work);
1024+
disable_delayed_work_sync(&ocelot->stats_work);
10251025
destroy_workqueue(ocelot->stats_queue);
10261026
}

drivers/net/mdio/mdio-i2c.c

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,23 @@ static int smbus_byte_mii_read_default_c22(struct mii_bus *bus, int phy_id,
116116
if (!i2c_mii_valid_phy_id(phy_id))
117117
return 0;
118118

119-
ret = i2c_smbus_xfer(i2c, i2c_mii_phy_addr(phy_id), 0,
120-
I2C_SMBUS_READ, reg,
121-
I2C_SMBUS_BYTE_DATA, &smbus_data);
119+
i2c_lock_bus(i2c, I2C_LOCK_SEGMENT);
120+
121+
ret = __i2c_smbus_xfer(i2c, i2c_mii_phy_addr(phy_id), 0,
122+
I2C_SMBUS_READ, reg,
123+
I2C_SMBUS_BYTE_DATA, &smbus_data);
122124
if (ret < 0)
123-
return ret;
125+
goto unlock;
124126

125127
val = (smbus_data.byte & 0xff) << 8;
126128

127-
ret = i2c_smbus_xfer(i2c, i2c_mii_phy_addr(phy_id), 0,
128-
I2C_SMBUS_READ, reg,
129-
I2C_SMBUS_BYTE_DATA, &smbus_data);
129+
ret = __i2c_smbus_xfer(i2c, i2c_mii_phy_addr(phy_id), 0,
130+
I2C_SMBUS_READ, reg,
131+
I2C_SMBUS_BYTE_DATA, &smbus_data);
132+
133+
unlock:
134+
i2c_unlock_bus(i2c, I2C_LOCK_SEGMENT);
135+
130136
if (ret < 0)
131137
return ret;
132138

@@ -147,17 +153,22 @@ static int smbus_byte_mii_write_default_c22(struct mii_bus *bus, int phy_id,
147153

148154
smbus_data.byte = (val & 0xff00) >> 8;
149155

150-
ret = i2c_smbus_xfer(i2c, i2c_mii_phy_addr(phy_id), 0,
151-
I2C_SMBUS_WRITE, reg,
152-
I2C_SMBUS_BYTE_DATA, &smbus_data);
156+
i2c_lock_bus(i2c, I2C_LOCK_SEGMENT);
157+
158+
ret = __i2c_smbus_xfer(i2c, i2c_mii_phy_addr(phy_id), 0,
159+
I2C_SMBUS_WRITE, reg,
160+
I2C_SMBUS_BYTE_DATA, &smbus_data);
153161
if (ret < 0)
154-
return ret;
162+
goto unlock;
155163

156164
smbus_data.byte = val & 0xff;
157165

158-
ret = i2c_smbus_xfer(i2c, i2c_mii_phy_addr(phy_id), 0,
159-
I2C_SMBUS_WRITE, reg,
160-
I2C_SMBUS_BYTE_DATA, &smbus_data);
166+
ret = __i2c_smbus_xfer(i2c, i2c_mii_phy_addr(phy_id), 0,
167+
I2C_SMBUS_WRITE, reg,
168+
I2C_SMBUS_BYTE_DATA, &smbus_data);
169+
170+
unlock:
171+
i2c_unlock_bus(i2c, I2C_LOCK_SEGMENT);
161172

162173
return ret < 0 ? ret : 0;
163174
}

drivers/net/wwan/t7xx/t7xx_pci.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,6 +939,7 @@ static void t7xx_pci_remove(struct pci_dev *pdev)
939939

940940
static const struct pci_device_id t7xx_pci_table[] = {
941941
{ PCI_DEVICE(PCI_VENDOR_ID_MEDIATEK, 0x4d75) },
942+
{ PCI_DEVICE(0x03f0, 0x09c8) }, // HP DRMR-H01
942943
{ PCI_DEVICE(0x14c0, 0x4d75) }, // Dell DW5933e
943944
{ }
944945
};

include/linux/mm.h

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4159,14 +4159,13 @@ int arch_lock_shadow_stack_status(struct task_struct *t, unsigned long status);
41594159
* since this value becomes part of PP_SIGNATURE; meaning we can just use the
41604160
* space between the PP_SIGNATURE value (without POISON_POINTER_DELTA), and the
41614161
* lowest bits of POISON_POINTER_DELTA. On arches where POISON_POINTER_DELTA is
4162-
* 0, we make sure that we leave the two topmost bits empty, as that guarantees
4163-
* we won't mistake a valid kernel pointer for a value we set, regardless of the
4164-
* VMSPLIT setting.
4162+
* 0, we use the lowest bit of PAGE_OFFSET as the boundary if that value is
4163+
* known at compile-time.
41654164
*
4166-
* Altogether, this means that the number of bits available is constrained by
4167-
* the size of an unsigned long (at the upper end, subtracting two bits per the
4168-
* above), and the definition of PP_SIGNATURE (with or without
4169-
* POISON_POINTER_DELTA).
4165+
* If the value of PAGE_OFFSET is not known at compile time, or if it is too
4166+
* small to leave at least 8 bits available above PP_SIGNATURE, we define the
4167+
* number of bits to be 0, which turns off the DMA index tracking altogether
4168+
* (see page_pool_register_dma_index()).
41704169
*/
41714170
#define PP_DMA_INDEX_SHIFT (1 + __fls(PP_SIGNATURE - POISON_POINTER_DELTA))
41724171
#if POISON_POINTER_DELTA > 0
@@ -4175,8 +4174,13 @@ int arch_lock_shadow_stack_status(struct task_struct *t, unsigned long status);
41754174
*/
41764175
#define PP_DMA_INDEX_BITS MIN(32, __ffs(POISON_POINTER_DELTA) - PP_DMA_INDEX_SHIFT)
41774176
#else
4178-
/* Always leave out the topmost two; see above. */
4179-
#define PP_DMA_INDEX_BITS MIN(32, BITS_PER_LONG - PP_DMA_INDEX_SHIFT - 2)
4177+
/* Use the lowest bit of PAGE_OFFSET if there's at least 8 bits available; see above */
4178+
#define PP_DMA_INDEX_MIN_OFFSET (1 << (PP_DMA_INDEX_SHIFT + 8))
4179+
#define PP_DMA_INDEX_BITS ((__builtin_constant_p(PAGE_OFFSET) && \
4180+
PAGE_OFFSET >= PP_DMA_INDEX_MIN_OFFSET && \
4181+
!(PAGE_OFFSET & (PP_DMA_INDEX_MIN_OFFSET - 1))) ? \
4182+
MIN(32, __ffs(PAGE_OFFSET) - PP_DMA_INDEX_SHIFT) : 0)
4183+
41804184
#endif
41814185

41824186
#define PP_DMA_INDEX_MASK GENMASK(PP_DMA_INDEX_BITS + PP_DMA_INDEX_SHIFT - 1, \

net/core/page_pool.c

Lines changed: 53 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -468,11 +468,60 @@ page_pool_dma_sync_for_device(const struct page_pool *pool,
468468
}
469469
}
470470

471+
static int page_pool_register_dma_index(struct page_pool *pool,
472+
netmem_ref netmem, gfp_t gfp)
473+
{
474+
int err = 0;
475+
u32 id;
476+
477+
if (unlikely(!PP_DMA_INDEX_BITS))
478+
goto out;
479+
480+
if (in_softirq())
481+
err = xa_alloc(&pool->dma_mapped, &id, netmem_to_page(netmem),
482+
PP_DMA_INDEX_LIMIT, gfp);
483+
else
484+
err = xa_alloc_bh(&pool->dma_mapped, &id, netmem_to_page(netmem),
485+
PP_DMA_INDEX_LIMIT, gfp);
486+
if (err) {
487+
WARN_ONCE(err != -ENOMEM, "couldn't track DMA mapping, please report to netdev@");
488+
goto out;
489+
}
490+
491+
netmem_set_dma_index(netmem, id);
492+
out:
493+
return err;
494+
}
495+
496+
static int page_pool_release_dma_index(struct page_pool *pool,
497+
netmem_ref netmem)
498+
{
499+
struct page *old, *page = netmem_to_page(netmem);
500+
unsigned long id;
501+
502+
if (unlikely(!PP_DMA_INDEX_BITS))
503+
return 0;
504+
505+
id = netmem_get_dma_index(netmem);
506+
if (!id)
507+
return -1;
508+
509+
if (in_softirq())
510+
old = xa_cmpxchg(&pool->dma_mapped, id, page, NULL, 0);
511+
else
512+
old = xa_cmpxchg_bh(&pool->dma_mapped, id, page, NULL, 0);
513+
if (old != page)
514+
return -1;
515+
516+
netmem_set_dma_index(netmem, 0);
517+
518+
return 0;
519+
}
520+
471521
static bool page_pool_dma_map(struct page_pool *pool, netmem_ref netmem, gfp_t gfp)
472522
{
473523
dma_addr_t dma;
474524
int err;
475-
u32 id;
476525

477526
/* Setup DMA mapping: use 'struct page' area for storing DMA-addr
478527
* since dma_addr_t can be either 32 or 64 bits and does not always fit
@@ -491,18 +540,10 @@ static bool page_pool_dma_map(struct page_pool *pool, netmem_ref netmem, gfp_t g
491540
goto unmap_failed;
492541
}
493542

494-
if (in_softirq())
495-
err = xa_alloc(&pool->dma_mapped, &id, netmem_to_page(netmem),
496-
PP_DMA_INDEX_LIMIT, gfp);
497-
else
498-
err = xa_alloc_bh(&pool->dma_mapped, &id, netmem_to_page(netmem),
499-
PP_DMA_INDEX_LIMIT, gfp);
500-
if (err) {
501-
WARN_ONCE(err != -ENOMEM, "couldn't track DMA mapping, please report to netdev@");
543+
err = page_pool_register_dma_index(pool, netmem, gfp);
544+
if (err)
502545
goto unset_failed;
503-
}
504546

505-
netmem_set_dma_index(netmem, id);
506547
page_pool_dma_sync_for_device(pool, netmem, pool->p.max_len);
507548

508549
return true;
@@ -680,8 +721,6 @@ void page_pool_clear_pp_info(netmem_ref netmem)
680721
static __always_inline void __page_pool_release_netmem_dma(struct page_pool *pool,
681722
netmem_ref netmem)
682723
{
683-
struct page *old, *page = netmem_to_page(netmem);
684-
unsigned long id;
685724
dma_addr_t dma;
686725

687726
if (!pool->dma_map)
@@ -690,15 +729,7 @@ static __always_inline void __page_pool_release_netmem_dma(struct page_pool *poo
690729
*/
691730
return;
692731

693-
id = netmem_get_dma_index(netmem);
694-
if (!id)
695-
return;
696-
697-
if (in_softirq())
698-
old = xa_cmpxchg(&pool->dma_mapped, id, page, NULL, 0);
699-
else
700-
old = xa_cmpxchg_bh(&pool->dma_mapped, id, page, NULL, 0);
701-
if (old != page)
732+
if (page_pool_release_dma_index(pool, netmem))
702733
return;
703734

704735
dma = page_pool_get_dma_addr_netmem(netmem);
@@ -708,7 +739,6 @@ static __always_inline void __page_pool_release_netmem_dma(struct page_pool *poo
708739
PAGE_SIZE << pool->p.order, pool->p.dma_dir,
709740
DMA_ATTR_SKIP_CPU_SYNC | DMA_ATTR_WEAK_ORDERING);
710741
page_pool_set_dma_addr_netmem(netmem, 0);
711-
netmem_set_dma_index(netmem, 0);
712742
}
713743

714744
/* Disconnects a page (from a page_pool). API users can have a need

0 commit comments

Comments
 (0)