Commit 39d71016 authored by David S. Miller's avatar David S. Miller

Merge branch 'master' of ../net-next/

parents 1d11fa23 5e437416
...@@ -3583,6 +3583,7 @@ static const struct mv88e6xxx_ops mv88e6141_ops = { ...@@ -3583,6 +3583,7 @@ static const struct mv88e6xxx_ops mv88e6141_ops = {
.port_set_speed_duplex = mv88e6341_port_set_speed_duplex, .port_set_speed_duplex = mv88e6341_port_set_speed_duplex,
.port_max_speed_mode = mv88e6341_port_max_speed_mode, .port_max_speed_mode = mv88e6341_port_max_speed_mode,
.port_tag_remap = mv88e6095_port_tag_remap, .port_tag_remap = mv88e6095_port_tag_remap,
.port_set_policy = mv88e6352_port_set_policy,
.port_set_frame_mode = mv88e6351_port_set_frame_mode, .port_set_frame_mode = mv88e6351_port_set_frame_mode,
.port_set_ucast_flood = mv88e6352_port_set_ucast_flood, .port_set_ucast_flood = mv88e6352_port_set_ucast_flood,
.port_set_mcast_flood = mv88e6352_port_set_mcast_flood, .port_set_mcast_flood = mv88e6352_port_set_mcast_flood,
...@@ -3596,7 +3597,7 @@ static const struct mv88e6xxx_ops mv88e6141_ops = { ...@@ -3596,7 +3597,7 @@ static const struct mv88e6xxx_ops mv88e6141_ops = {
.port_set_cmode = mv88e6341_port_set_cmode, .port_set_cmode = mv88e6341_port_set_cmode,
.port_setup_message_port = mv88e6xxx_setup_message_port, .port_setup_message_port = mv88e6xxx_setup_message_port,
.stats_snapshot = mv88e6390_g1_stats_snapshot, .stats_snapshot = mv88e6390_g1_stats_snapshot,
.stats_set_histogram = mv88e6095_g1_stats_set_histogram, .stats_set_histogram = mv88e6390_g1_stats_set_histogram,
.stats_get_sset_count = mv88e6320_stats_get_sset_count, .stats_get_sset_count = mv88e6320_stats_get_sset_count,
.stats_get_strings = mv88e6320_stats_get_strings, .stats_get_strings = mv88e6320_stats_get_strings,
.stats_get_stats = mv88e6390_stats_get_stats, .stats_get_stats = mv88e6390_stats_get_stats,
...@@ -3606,6 +3607,9 @@ static const struct mv88e6xxx_ops mv88e6141_ops = { ...@@ -3606,6 +3607,9 @@ static const struct mv88e6xxx_ops mv88e6141_ops = {
.mgmt_rsvd2cpu = mv88e6390_g1_mgmt_rsvd2cpu, .mgmt_rsvd2cpu = mv88e6390_g1_mgmt_rsvd2cpu,
.pot_clear = mv88e6xxx_g2_pot_clear, .pot_clear = mv88e6xxx_g2_pot_clear,
.reset = mv88e6352_g1_reset, .reset = mv88e6352_g1_reset,
.rmu_disable = mv88e6390_g1_rmu_disable,
.atu_get_hash = mv88e6165_g1_atu_get_hash,
.atu_set_hash = mv88e6165_g1_atu_set_hash,
.vtu_getnext = mv88e6352_g1_vtu_getnext, .vtu_getnext = mv88e6352_g1_vtu_getnext,
.vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge,
.serdes_power = mv88e6390_serdes_power, .serdes_power = mv88e6390_serdes_power,
...@@ -3619,6 +3623,11 @@ static const struct mv88e6xxx_ops mv88e6141_ops = { ...@@ -3619,6 +3623,11 @@ static const struct mv88e6xxx_ops mv88e6141_ops = {
.serdes_irq_enable = mv88e6390_serdes_irq_enable, .serdes_irq_enable = mv88e6390_serdes_irq_enable,
.serdes_irq_status = mv88e6390_serdes_irq_status, .serdes_irq_status = mv88e6390_serdes_irq_status,
.gpio_ops = &mv88e6352_gpio_ops, .gpio_ops = &mv88e6352_gpio_ops,
.serdes_get_sset_count = mv88e6390_serdes_get_sset_count,
.serdes_get_strings = mv88e6390_serdes_get_strings,
.serdes_get_stats = mv88e6390_serdes_get_stats,
.serdes_get_regs_len = mv88e6390_serdes_get_regs_len,
.serdes_get_regs = mv88e6390_serdes_get_regs,
.phylink_validate = mv88e6341_phylink_validate, .phylink_validate = mv88e6341_phylink_validate,
}; };
...@@ -4383,6 +4392,7 @@ static const struct mv88e6xxx_ops mv88e6341_ops = { ...@@ -4383,6 +4392,7 @@ static const struct mv88e6xxx_ops mv88e6341_ops = {
.port_set_speed_duplex = mv88e6341_port_set_speed_duplex, .port_set_speed_duplex = mv88e6341_port_set_speed_duplex,
.port_max_speed_mode = mv88e6341_port_max_speed_mode, .port_max_speed_mode = mv88e6341_port_max_speed_mode,
.port_tag_remap = mv88e6095_port_tag_remap, .port_tag_remap = mv88e6095_port_tag_remap,
.port_set_policy = mv88e6352_port_set_policy,
.port_set_frame_mode = mv88e6351_port_set_frame_mode, .port_set_frame_mode = mv88e6351_port_set_frame_mode,
.port_set_ucast_flood = mv88e6352_port_set_ucast_flood, .port_set_ucast_flood = mv88e6352_port_set_ucast_flood,
.port_set_mcast_flood = mv88e6352_port_set_mcast_flood, .port_set_mcast_flood = mv88e6352_port_set_mcast_flood,
...@@ -4396,7 +4406,7 @@ static const struct mv88e6xxx_ops mv88e6341_ops = { ...@@ -4396,7 +4406,7 @@ static const struct mv88e6xxx_ops mv88e6341_ops = {
.port_set_cmode = mv88e6341_port_set_cmode, .port_set_cmode = mv88e6341_port_set_cmode,
.port_setup_message_port = mv88e6xxx_setup_message_port, .port_setup_message_port = mv88e6xxx_setup_message_port,
.stats_snapshot = mv88e6390_g1_stats_snapshot, .stats_snapshot = mv88e6390_g1_stats_snapshot,
.stats_set_histogram = mv88e6095_g1_stats_set_histogram, .stats_set_histogram = mv88e6390_g1_stats_set_histogram,
.stats_get_sset_count = mv88e6320_stats_get_sset_count, .stats_get_sset_count = mv88e6320_stats_get_sset_count,
.stats_get_strings = mv88e6320_stats_get_strings, .stats_get_strings = mv88e6320_stats_get_strings,
.stats_get_stats = mv88e6390_stats_get_stats, .stats_get_stats = mv88e6390_stats_get_stats,
...@@ -4406,6 +4416,9 @@ static const struct mv88e6xxx_ops mv88e6341_ops = { ...@@ -4406,6 +4416,9 @@ static const struct mv88e6xxx_ops mv88e6341_ops = {
.mgmt_rsvd2cpu = mv88e6390_g1_mgmt_rsvd2cpu, .mgmt_rsvd2cpu = mv88e6390_g1_mgmt_rsvd2cpu,
.pot_clear = mv88e6xxx_g2_pot_clear, .pot_clear = mv88e6xxx_g2_pot_clear,
.reset = mv88e6352_g1_reset, .reset = mv88e6352_g1_reset,
.rmu_disable = mv88e6390_g1_rmu_disable,
.atu_get_hash = mv88e6165_g1_atu_get_hash,
.atu_set_hash = mv88e6165_g1_atu_set_hash,
.vtu_getnext = mv88e6352_g1_vtu_getnext, .vtu_getnext = mv88e6352_g1_vtu_getnext,
.vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge,
.serdes_power = mv88e6390_serdes_power, .serdes_power = mv88e6390_serdes_power,
...@@ -4421,6 +4434,11 @@ static const struct mv88e6xxx_ops mv88e6341_ops = { ...@@ -4421,6 +4434,11 @@ static const struct mv88e6xxx_ops mv88e6341_ops = {
.gpio_ops = &mv88e6352_gpio_ops, .gpio_ops = &mv88e6352_gpio_ops,
.avb_ops = &mv88e6390_avb_ops, .avb_ops = &mv88e6390_avb_ops,
.ptp_ops = &mv88e6352_ptp_ops, .ptp_ops = &mv88e6352_ptp_ops,
.serdes_get_sset_count = mv88e6390_serdes_get_sset_count,
.serdes_get_strings = mv88e6390_serdes_get_strings,
.serdes_get_stats = mv88e6390_serdes_get_stats,
.serdes_get_regs_len = mv88e6390_serdes_get_regs_len,
.serdes_get_regs = mv88e6390_serdes_get_regs,
.phylink_validate = mv88e6341_phylink_validate, .phylink_validate = mv88e6341_phylink_validate,
}; };
......
...@@ -722,7 +722,7 @@ static struct mv88e6390_serdes_hw_stat mv88e6390_serdes_hw_stats[] = { ...@@ -722,7 +722,7 @@ static struct mv88e6390_serdes_hw_stat mv88e6390_serdes_hw_stats[] = {
int mv88e6390_serdes_get_sset_count(struct mv88e6xxx_chip *chip, int port) int mv88e6390_serdes_get_sset_count(struct mv88e6xxx_chip *chip, int port)
{ {
if (mv88e6390_serdes_get_lane(chip, port) < 0) if (mv88e6xxx_serdes_get_lane(chip, port) < 0)
return 0; return 0;
return ARRAY_SIZE(mv88e6390_serdes_hw_stats); return ARRAY_SIZE(mv88e6390_serdes_hw_stats);
...@@ -734,7 +734,7 @@ int mv88e6390_serdes_get_strings(struct mv88e6xxx_chip *chip, ...@@ -734,7 +734,7 @@ int mv88e6390_serdes_get_strings(struct mv88e6xxx_chip *chip,
struct mv88e6390_serdes_hw_stat *stat; struct mv88e6390_serdes_hw_stat *stat;
int i; int i;
if (mv88e6390_serdes_get_lane(chip, port) < 0) if (mv88e6xxx_serdes_get_lane(chip, port) < 0)
return 0; return 0;
for (i = 0; i < ARRAY_SIZE(mv88e6390_serdes_hw_stats); i++) { for (i = 0; i < ARRAY_SIZE(mv88e6390_serdes_hw_stats); i++) {
...@@ -770,7 +770,7 @@ int mv88e6390_serdes_get_stats(struct mv88e6xxx_chip *chip, int port, ...@@ -770,7 +770,7 @@ int mv88e6390_serdes_get_stats(struct mv88e6xxx_chip *chip, int port,
int lane; int lane;
int i; int i;
lane = mv88e6390_serdes_get_lane(chip, port); lane = mv88e6xxx_serdes_get_lane(chip, port);
if (lane < 0) if (lane < 0)
return 0; return 0;
......
...@@ -134,6 +134,8 @@ M(MSIX_OFFSET, 0x005, msix_offset, msg_req, msix_offset_rsp) \ ...@@ -134,6 +134,8 @@ M(MSIX_OFFSET, 0x005, msix_offset, msg_req, msix_offset_rsp) \
M(VF_FLR, 0x006, vf_flr, msg_req, msg_rsp) \ M(VF_FLR, 0x006, vf_flr, msg_req, msg_rsp) \
M(PTP_OP, 0x007, ptp_op, ptp_req, ptp_rsp) \ M(PTP_OP, 0x007, ptp_op, ptp_req, ptp_rsp) \
M(GET_HW_CAP, 0x008, get_hw_cap, msg_req, get_hw_cap_rsp) \ M(GET_HW_CAP, 0x008, get_hw_cap, msg_req, get_hw_cap_rsp) \
M(LMTST_TBL_SETUP, 0x00a, lmtst_tbl_setup, lmtst_tbl_setup_req, \
msg_rsp) \
M(SET_VF_PERM, 0x00b, set_vf_perm, set_vf_perm, msg_rsp) \ M(SET_VF_PERM, 0x00b, set_vf_perm, set_vf_perm, msg_rsp) \
/* CGX mbox IDs (range 0x200 - 0x3FF) */ \ /* CGX mbox IDs (range 0x200 - 0x3FF) */ \
M(CGX_START_RXTX, 0x200, cgx_start_rxtx, msg_req, msg_rsp) \ M(CGX_START_RXTX, 0x200, cgx_start_rxtx, msg_req, msg_rsp) \
...@@ -1278,6 +1280,14 @@ struct set_vf_perm { ...@@ -1278,6 +1280,14 @@ struct set_vf_perm {
u64 flags; u64 flags;
}; };
struct lmtst_tbl_setup_req {
struct mbox_msghdr hdr;
u16 base_pcifunc;
u8 use_local_lmt_region;
u64 lmt_iova;
u64 rsvd[4];
};
/* CPT mailbox error codes /* CPT mailbox error codes
* Range 901 - 1000. * Range 901 - 1000.
*/ */
......
...@@ -2333,6 +2333,7 @@ static void __rvu_flr_handler(struct rvu *rvu, u16 pcifunc) ...@@ -2333,6 +2333,7 @@ static void __rvu_flr_handler(struct rvu *rvu, u16 pcifunc)
rvu_blklf_teardown(rvu, pcifunc, BLKADDR_SSOW); rvu_blklf_teardown(rvu, pcifunc, BLKADDR_SSOW);
rvu_blklf_teardown(rvu, pcifunc, BLKADDR_SSO); rvu_blklf_teardown(rvu, pcifunc, BLKADDR_SSO);
rvu_blklf_teardown(rvu, pcifunc, BLKADDR_NPA); rvu_blklf_teardown(rvu, pcifunc, BLKADDR_NPA);
rvu_reset_lmt_map_tbl(rvu, pcifunc);
rvu_detach_rsrcs(rvu, NULL, pcifunc); rvu_detach_rsrcs(rvu, NULL, pcifunc);
mutex_unlock(&rvu->flr_lock); mutex_unlock(&rvu->flr_lock);
} }
......
...@@ -243,6 +243,7 @@ struct rvu_pfvf { ...@@ -243,6 +243,7 @@ struct rvu_pfvf {
u8 nix_blkaddr; /* BLKADDR_NIX0/1 assigned to this PF */ u8 nix_blkaddr; /* BLKADDR_NIX0/1 assigned to this PF */
u8 nix_rx_intf; /* NIX0_RX/NIX1_RX interface to NPC */ u8 nix_rx_intf; /* NIX0_RX/NIX1_RX interface to NPC */
u8 nix_tx_intf; /* NIX0_TX/NIX1_TX interface to NPC */ u8 nix_tx_intf; /* NIX0_TX/NIX1_TX interface to NPC */
u64 lmt_base_addr; /* Preseving the pcifunc's lmtst base addr*/
unsigned long flags; unsigned long flags;
}; };
...@@ -754,6 +755,9 @@ int rvu_cpt_lf_teardown(struct rvu *rvu, u16 pcifunc, int lf, int slot); ...@@ -754,6 +755,9 @@ int rvu_cpt_lf_teardown(struct rvu *rvu, u16 pcifunc, int lf, int slot);
int rvu_set_channels_base(struct rvu *rvu); int rvu_set_channels_base(struct rvu *rvu);
void rvu_program_channels(struct rvu *rvu); void rvu_program_channels(struct rvu *rvu);
/* CN10K RVU - LMT*/
void rvu_reset_lmt_map_tbl(struct rvu *rvu, u16 pcifunc);
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
void rvu_dbg_init(struct rvu *rvu); void rvu_dbg_init(struct rvu *rvu);
void rvu_dbg_exit(struct rvu *rvu); void rvu_dbg_exit(struct rvu *rvu);
......
...@@ -10,6 +10,206 @@ ...@@ -10,6 +10,206 @@
#include "cgx.h" #include "cgx.h"
#include "rvu_reg.h" #include "rvu_reg.h"
/* RVU LMTST */
#define LMT_TBL_OP_READ 0
#define LMT_TBL_OP_WRITE 1
#define LMT_MAP_TABLE_SIZE (128 * 1024)
#define LMT_MAPTBL_ENTRY_SIZE 16
/* Function to perform operations (read/write) on lmtst map table */
static int lmtst_map_table_ops(struct rvu *rvu, u32 index, u64 *val,
int lmt_tbl_op)
{
void __iomem *lmt_map_base;
u64 tbl_base;
tbl_base = rvu_read64(rvu, BLKADDR_APR, APR_AF_LMT_MAP_BASE);
lmt_map_base = ioremap_wc(tbl_base, LMT_MAP_TABLE_SIZE);
if (!lmt_map_base) {
dev_err(rvu->dev, "Failed to setup lmt map table mapping!!\n");
return -ENOMEM;
}
if (lmt_tbl_op == LMT_TBL_OP_READ) {
*val = readq(lmt_map_base + index);
} else {
writeq((*val), (lmt_map_base + index));
/* Flushing the AP interceptor cache to make APR_LMT_MAP_ENTRY_S
* changes effective. Write 1 for flush and read is being used as a
* barrier and sets up a data dependency. Write to 0 after a write
* to 1 to complete the flush.
*/
rvu_write64(rvu, BLKADDR_APR, APR_AF_LMT_CTL, BIT_ULL(0));
rvu_read64(rvu, BLKADDR_APR, APR_AF_LMT_CTL);
rvu_write64(rvu, BLKADDR_APR, APR_AF_LMT_CTL, 0x00);
}
iounmap(lmt_map_base);
return 0;
}
static u32 rvu_get_lmtst_tbl_index(struct rvu *rvu, u16 pcifunc)
{
return ((rvu_get_pf(pcifunc) * rvu->hw->total_vfs) +
(pcifunc & RVU_PFVF_FUNC_MASK)) * LMT_MAPTBL_ENTRY_SIZE;
}
static int rvu_get_lmtaddr(struct rvu *rvu, u16 pcifunc,
u64 iova, u64 *lmt_addr)
{
u64 pa, val, pf;
int err;
if (!iova) {
dev_err(rvu->dev, "%s Requested Null address for transulation\n", __func__);
return -EINVAL;
}
rvu_write64(rvu, BLKADDR_RVUM, RVU_AF_SMMU_ADDR_REQ, iova);
pf = rvu_get_pf(pcifunc) & 0x1F;
val = BIT_ULL(63) | BIT_ULL(14) | BIT_ULL(13) | pf << 8 |
((pcifunc & RVU_PFVF_FUNC_MASK) & 0xFF);
rvu_write64(rvu, BLKADDR_RVUM, RVU_AF_SMMU_TXN_REQ, val);
err = rvu_poll_reg(rvu, BLKADDR_RVUM, RVU_AF_SMMU_ADDR_RSP_STS, BIT_ULL(0), false);
if (err) {
dev_err(rvu->dev, "%s LMTLINE iova transulation failed\n", __func__);
return err;
}
val = rvu_read64(rvu, BLKADDR_RVUM, RVU_AF_SMMU_ADDR_RSP_STS);
if (val & ~0x1ULL) {
dev_err(rvu->dev, "%s LMTLINE iova transulation failed err:%llx\n", __func__, val);
return -EIO;
}
/* PA[51:12] = RVU_AF_SMMU_TLN_FLIT1[60:21]
* PA[11:0] = IOVA[11:0]
*/
pa = rvu_read64(rvu, BLKADDR_RVUM, RVU_AF_SMMU_TLN_FLIT1) >> 21;
pa &= GENMASK_ULL(39, 0);
*lmt_addr = (pa << 12) | (iova & 0xFFF);
return 0;
}
static int rvu_update_lmtaddr(struct rvu *rvu, u16 pcifunc, u64 lmt_addr)
{
struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc);
u32 tbl_idx;
int err = 0;
u64 val;
/* Read the current lmt addr of pcifunc */
tbl_idx = rvu_get_lmtst_tbl_index(rvu, pcifunc);
err = lmtst_map_table_ops(rvu, tbl_idx, &val, LMT_TBL_OP_READ);
if (err) {
dev_err(rvu->dev,
"Failed to read LMT map table: index 0x%x err %d\n",
tbl_idx, err);
return err;
}
/* Storing the seondary's lmt base address as this needs to be
* reverted in FLR. Also making sure this default value doesn't
* get overwritten on multiple calls to this mailbox.
*/
if (!pfvf->lmt_base_addr)
pfvf->lmt_base_addr = val;
/* Update the LMT table with new addr */
err = lmtst_map_table_ops(rvu, tbl_idx, &lmt_addr, LMT_TBL_OP_WRITE);
if (err) {
dev_err(rvu->dev,
"Failed to update LMT map table: index 0x%x err %d\n",
tbl_idx, err);
return err;
}
return 0;
}
int rvu_mbox_handler_lmtst_tbl_setup(struct rvu *rvu,
struct lmtst_tbl_setup_req *req,
struct msg_rsp *rsp)
{
u64 lmt_addr, val;
u32 pri_tbl_idx;
int err = 0;
/* Check if PF_FUNC wants to use it's own local memory as LMTLINE
* region, if so, convert that IOVA to physical address and
* populate LMT table with that address
*/
if (req->use_local_lmt_region) {
err = rvu_get_lmtaddr(rvu, req->hdr.pcifunc,
req->lmt_iova, &lmt_addr);
if (err < 0)
return err;
/* Update the lmt addr for this PFFUNC in the LMT table */
err = rvu_update_lmtaddr(rvu, req->hdr.pcifunc, lmt_addr);
if (err)
return err;
}
/* Reconfiguring lmtst map table in lmt region shared mode i.e. make
* multiple PF_FUNCs to share an LMTLINE region, so primary/base
* pcifunc (which is passed as an argument to mailbox) is the one
* whose lmt base address will be shared among other secondary
* pcifunc (will be the one who is calling this mailbox).
*/
if (req->base_pcifunc) {
/* Calculating the LMT table index equivalent to primary
* pcifunc.
*/
pri_tbl_idx = rvu_get_lmtst_tbl_index(rvu, req->base_pcifunc);
/* Read the base lmt addr of the primary pcifunc */
err = lmtst_map_table_ops(rvu, pri_tbl_idx, &val,
LMT_TBL_OP_READ);
if (err) {
dev_err(rvu->dev,
"Failed to read LMT map table: index 0x%x err %d\n",
pri_tbl_idx, err);
return err;
}
/* Update the base lmt addr of secondary with primary's base
* lmt addr.
*/
err = rvu_update_lmtaddr(rvu, req->hdr.pcifunc, val);
if (err)
return err;
}
return 0;
}
/* Resetting the lmtst map table to original base addresses */
void rvu_reset_lmt_map_tbl(struct rvu *rvu, u16 pcifunc)
{
struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc);
u32 tbl_idx;
int err;
if (is_rvu_otx2(rvu))
return;
if (pfvf->lmt_base_addr) {
/* This corresponds to lmt map table index */
tbl_idx = rvu_get_lmtst_tbl_index(rvu, pcifunc);
/* Reverting back original lmt base addr for respective
* pcifunc.
*/
err = lmtst_map_table_ops(rvu, tbl_idx, &pfvf->lmt_base_addr,
LMT_TBL_OP_WRITE);
if (err)
dev_err(rvu->dev,
"Failed to update LMT map table: index 0x%x err %d\n",
tbl_idx, err);
pfvf->lmt_base_addr = 0;
}
}
int rvu_set_channels_base(struct rvu *rvu) int rvu_set_channels_base(struct rvu *rvu)
{ {
struct rvu_hwinfo *hw = rvu->hw; struct rvu_hwinfo *hw = rvu->hw;
......
...@@ -49,6 +49,11 @@ ...@@ -49,6 +49,11 @@
#define RVU_AF_PFX_VF_BAR4_ADDR (0x5400 | (a) << 4) #define RVU_AF_PFX_VF_BAR4_ADDR (0x5400 | (a) << 4)
#define RVU_AF_PFX_VF_BAR4_CFG (0x5600 | (a) << 4) #define RVU_AF_PFX_VF_BAR4_CFG (0x5600 | (a) << 4)
#define RVU_AF_PFX_LMTLINE_ADDR (0x5800 | (a) << 4) #define RVU_AF_PFX_LMTLINE_ADDR (0x5800 | (a) << 4)
#define RVU_AF_SMMU_ADDR_REQ (0x6000)
#define RVU_AF_SMMU_TXN_REQ (0x6008)
#define RVU_AF_SMMU_ADDR_RSP_STS (0x6010)
#define RVU_AF_SMMU_ADDR_TLN (0x6018)
#define RVU_AF_SMMU_TLN_FLIT1 (0x6030)
/* Admin function's privileged PF/VF registers */ /* Admin function's privileged PF/VF registers */
#define RVU_PRIV_CONST (0x8000000) #define RVU_PRIV_CONST (0x8000000)
...@@ -692,4 +697,9 @@ ...@@ -692,4 +697,9 @@
#define LBK_LINK_CFG_ID_MASK GENMASK_ULL(11, 6) #define LBK_LINK_CFG_ID_MASK GENMASK_ULL(11, 6)
#define LBK_LINK_CFG_BASE_MASK GENMASK_ULL(5, 0) #define LBK_LINK_CFG_BASE_MASK GENMASK_ULL(5, 0)
/* APR */
#define APR_AF_LMT_CFG (0x000ull)
#define APR_AF_LMT_MAP_BASE (0x008ull)
#define APR_AF_LMT_CTL (0x010ull)
#endif /* RVU_REG_H */ #endif /* RVU_REG_H */
...@@ -35,7 +35,8 @@ enum rvu_block_addr_e { ...@@ -35,7 +35,8 @@ enum rvu_block_addr_e {
BLKADDR_NDC_NPA0 = 0xeULL, BLKADDR_NDC_NPA0 = 0xeULL,
BLKADDR_NDC_NIX1_RX = 0x10ULL, BLKADDR_NDC_NIX1_RX = 0x10ULL,
BLKADDR_NDC_NIX1_TX = 0x11ULL, BLKADDR_NDC_NIX1_TX = 0x11ULL,
BLK_COUNT = 0x12ULL, BLKADDR_APR = 0x16ULL,
BLK_COUNT = 0x17ULL,
}; };
/* RVU Block Type Enumeration */ /* RVU Block Type Enumeration */
......
...@@ -22,69 +22,52 @@ static struct dev_hw_ops cn10k_hw_ops = { ...@@ -22,69 +22,52 @@ static struct dev_hw_ops cn10k_hw_ops = {
.refill_pool_ptrs = cn10k_refill_pool_ptrs, .refill_pool_ptrs = cn10k_refill_pool_ptrs,
}; };
int cn10k_pf_lmtst_init(struct otx2_nic *pf) int cn10k_lmtst_init(struct otx2_nic *pfvf)
{ {
int size, num_lines;
u64 base;
if (!test_bit(CN10K_LMTST, &pf->hw.cap_flag)) { struct lmtst_tbl_setup_req *req;
pf->hw_ops = &otx2_hw_ops; int qcount, err;
if (!test_bit(CN10K_LMTST, &pfvf->hw.cap_flag)) {
pfvf->hw_ops = &otx2_hw_ops;
return 0; return 0;
} }
pf->hw_ops = &cn10k_hw_ops; pfvf->hw_ops = &cn10k_hw_ops;
base = pci_resource_start(pf->pdev, PCI_MBOX_BAR_NUM) + qcount = pfvf->hw.max_queues;
(MBOX_SIZE * (pf->total_vfs + 1)); /* LMTST lines allocation
* qcount = num_online_cpus();
size = pci_resource_len(pf->pdev, PCI_MBOX_BAR_NUM) - * NPA = TX + RX + XDP.
(MBOX_SIZE * (pf->total_vfs + 1)); * NIX = TX * 32 (For Burst SQE flush).
*/
pf->hw.lmt_base = ioremap(base, size); pfvf->tot_lmt_lines = (qcount * 3) + (qcount * 32);
pfvf->npa_lmt_lines = qcount * 3;
pfvf->nix_lmt_size = LMT_BURST_SIZE * LMT_LINE_SIZE;
if (!pf->hw.lmt_base) { mutex_lock(&pfvf->mbox.lock);
dev_err(pf->dev, "Unable to map PF LMTST region\n"); req = otx2_mbox_alloc_msg_lmtst_tbl_setup(&pfvf->mbox);
if (!req) {
mutex_unlock(&pfvf->mbox.lock);
return -ENOMEM; return -ENOMEM;
} }
/* FIXME: Get the num of LMTST lines from LMT table */ req->use_local_lmt_region = true;
pf->tot_lmt_lines = size / LMT_LINE_SIZE;
num_lines = (pf->tot_lmt_lines - NIX_LMTID_BASE) /
pf->hw.tx_queues;
/* Number of LMT lines per SQ queues */
pf->nix_lmt_lines = num_lines > 32 ? 32 : num_lines;
pf->nix_lmt_size = pf->nix_lmt_lines * LMT_LINE_SIZE;
return 0;
}
int cn10k_vf_lmtst_init(struct otx2_nic *vf) err = qmem_alloc(pfvf->dev, &pfvf->dync_lmt, pfvf->tot_lmt_lines,
{ LMT_LINE_SIZE);
int size, num_lines; if (err) {
mutex_unlock(&pfvf->mbox.lock);
if (!test_bit(CN10K_LMTST, &vf->hw.cap_flag)) { return err;
vf->hw_ops = &otx2_hw_ops;
return 0;
} }
pfvf->hw.lmt_base = (u64 *)pfvf->dync_lmt->base;
req->lmt_iova = (u64)pfvf->dync_lmt->iova;
vf->hw_ops = &cn10k_hw_ops; err = otx2_sync_mbox_msg(&pfvf->mbox);
size = pci_resource_len(vf->pdev, PCI_MBOX_BAR_NUM); mutex_unlock(&pfvf->mbox.lock);
vf->hw.lmt_base = ioremap_wc(pci_resource_start(vf->pdev,
PCI_MBOX_BAR_NUM),
size);
if (!vf->hw.lmt_base) {
dev_err(vf->dev, "Unable to map VF LMTST region\n");
return -ENOMEM;
}
vf->tot_lmt_lines = size / LMT_LINE_SIZE;
/* LMTST lines per SQ */
num_lines = (vf->tot_lmt_lines - NIX_LMTID_BASE) /
vf->hw.tx_queues;
vf->nix_lmt_lines = num_lines > 32 ? 32 : num_lines;
vf->nix_lmt_size = vf->nix_lmt_lines * LMT_LINE_SIZE;
return 0; return 0;
} }
EXPORT_SYMBOL(cn10k_vf_lmtst_init); EXPORT_SYMBOL(cn10k_lmtst_init);
int cn10k_sq_aq_init(void *dev, u16 qidx, u16 sqb_aura) int cn10k_sq_aq_init(void *dev, u16 qidx, u16 sqb_aura)
{ {
...@@ -93,9 +76,11 @@ int cn10k_sq_aq_init(void *dev, u16 qidx, u16 sqb_aura) ...@@ -93,9 +76,11 @@ int cn10k_sq_aq_init(void *dev, u16 qidx, u16 sqb_aura)
struct otx2_snd_queue *sq; struct otx2_snd_queue *sq;
sq = &pfvf->qset.sq[qidx]; sq = &pfvf->qset.sq[qidx];
sq->lmt_addr = (__force u64 *)((u64)pfvf->hw.nix_lmt_base + sq->lmt_addr = (u64 *)((u64)pfvf->hw.nix_lmt_base +
(qidx * pfvf->nix_lmt_size)); (qidx * pfvf->nix_lmt_size));
sq->lmt_id = pfvf->npa_lmt_lines + (qidx * LMT_BURST_SIZE);
/* Get memory to put this msg */ /* Get memory to put this msg */
aq = otx2_mbox_alloc_msg_nix_cn10k_aq_enq(&pfvf->mbox); aq = otx2_mbox_alloc_msg_nix_cn10k_aq_enq(&pfvf->mbox);
if (!aq) if (!aq)
...@@ -158,15 +143,13 @@ void cn10k_refill_pool_ptrs(void *dev, struct otx2_cq_queue *cq) ...@@ -158,15 +143,13 @@ void cn10k_refill_pool_ptrs(void *dev, struct otx2_cq_queue *cq)
void cn10k_sqe_flush(void *dev, struct otx2_snd_queue *sq, int size, int qidx) void cn10k_sqe_flush(void *dev, struct otx2_snd_queue *sq, int size, int qidx)
{ {
struct otx2_nic *pfvf = dev;
int lmt_id = NIX_LMTID_BASE + (qidx * pfvf->nix_lmt_lines);
u64 val = 0, tar_addr = 0; u64 val = 0, tar_addr = 0;
/* FIXME: val[0:10] LMT_ID. /* FIXME: val[0:10] LMT_ID.
* [12:15] no of LMTST - 1 in the burst. * [12:15] no of LMTST - 1 in the burst.
* [19:63] data size of each LMTST in the burst except first. * [19:63] data size of each LMTST in the burst except first.
*/ */
val = (lmt_id & 0x7FF); val = (sq->lmt_id & 0x7FF);
/* Target address for LMTST flush tells HW how many 128bit /* Target address for LMTST flush tells HW how many 128bit
* words are present. * words are present.
* tar_addr[6:4] size of first LMTST - 1 in units of 128b. * tar_addr[6:4] size of first LMTST - 1 in units of 128b.
......
...@@ -12,8 +12,7 @@ ...@@ -12,8 +12,7 @@
void cn10k_refill_pool_ptrs(void *dev, struct otx2_cq_queue *cq); void cn10k_refill_pool_ptrs(void *dev, struct otx2_cq_queue *cq);
void cn10k_sqe_flush(void *dev, struct otx2_snd_queue *sq, int size, int qidx); void cn10k_sqe_flush(void *dev, struct otx2_snd_queue *sq, int size, int qidx);
int cn10k_sq_aq_init(void *dev, u16 qidx, u16 sqb_aura); int cn10k_sq_aq_init(void *dev, u16 qidx, u16 sqb_aura);
int cn10k_pf_lmtst_init(struct otx2_nic *pf); int cn10k_lmtst_init(struct otx2_nic *pfvf);
int cn10k_vf_lmtst_init(struct otx2_nic *vf);
int cn10k_free_all_ipolicers(struct otx2_nic *pfvf); int cn10k_free_all_ipolicers(struct otx2_nic *pfvf);
int cn10k_alloc_matchall_ipolicer(struct otx2_nic *pfvf); int cn10k_alloc_matchall_ipolicer(struct otx2_nic *pfvf);
int cn10k_free_matchall_ipolicer(struct otx2_nic *pfvf); int cn10k_free_matchall_ipolicer(struct otx2_nic *pfvf);
......
...@@ -218,8 +218,8 @@ struct otx2_hw { ...@@ -218,8 +218,8 @@ struct otx2_hw {
unsigned long cap_flag; unsigned long cap_flag;
#define LMT_LINE_SIZE 128 #define LMT_LINE_SIZE 128
#define NIX_LMTID_BASE 72 /* RX + TX + XDP */ #define LMT_BURST_SIZE 32 /* 32 LMTST lines for burst SQE flush */
void __iomem *lmt_base; u64 *lmt_base;
u64 *npa_lmt_base; u64 *npa_lmt_base;
u64 *nix_lmt_base; u64 *nix_lmt_base;
}; };
...@@ -363,8 +363,9 @@ struct otx2_nic { ...@@ -363,8 +363,9 @@ struct otx2_nic {
/* Block address of NIX either BLKADDR_NIX0 or BLKADDR_NIX1 */ /* Block address of NIX either BLKADDR_NIX0 or BLKADDR_NIX1 */
int nix_blkaddr; int nix_blkaddr;
/* LMTST Lines info */ /* LMTST Lines info */
struct qmem *dync_lmt;
u16 tot_lmt_lines; u16 tot_lmt_lines;
u16 nix_lmt_lines; u16 npa_lmt_lines;
u32 nix_lmt_size; u32 nix_lmt_size;
struct otx2_ptp *ptp; struct otx2_ptp *ptp;
......
...@@ -1533,10 +1533,10 @@ int otx2_open(struct net_device *netdev) ...@@ -1533,10 +1533,10 @@ int otx2_open(struct net_device *netdev)
if (test_bit(CN10K_LMTST, &pf->hw.cap_flag)) { if (test_bit(CN10K_LMTST, &pf->hw.cap_flag)) {
/* Reserve LMT lines for NPA AURA batch free */ /* Reserve LMT lines for NPA AURA batch free */
pf->hw.npa_lmt_base = (__force u64 *)pf->hw.lmt_base; pf->hw.npa_lmt_base = pf->hw.lmt_base;
/* Reserve LMT lines for NIX TX */ /* Reserve LMT lines for NIX TX */
pf->hw.nix_lmt_base = (__force u64 *)((u64)pf->hw.npa_lmt_base + pf->hw.nix_lmt_base = (u64 *)((u64)pf->hw.npa_lmt_base +
(NIX_LMTID_BASE * LMT_LINE_SIZE)); (pf->npa_lmt_lines * LMT_LINE_SIZE));
} }
err = otx2_init_hw_resources(pf); err = otx2_init_hw_resources(pf);
...@@ -2526,7 +2526,7 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -2526,7 +2526,7 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if (err) if (err)
goto err_detach_rsrc; goto err_detach_rsrc;
err = cn10k_pf_lmtst_init(pf); err = cn10k_lmtst_init(pf);
if (err) if (err)
goto err_detach_rsrc; goto err_detach_rsrc;
...@@ -2630,8 +2630,8 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -2630,8 +2630,8 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)
err_ptp_destroy: err_ptp_destroy:
otx2_ptp_destroy(pf); otx2_ptp_destroy(pf);
err_detach_rsrc: err_detach_rsrc:
if (hw->lmt_base) if (test_bit(CN10K_LMTST, &pf->hw.cap_flag))
iounmap(hw->lmt_base); qmem_free(pf->dev, pf->dync_lmt);
otx2_detach_resources(&pf->mbox); otx2_detach_resources(&pf->mbox);
err_disable_mbox_intr: err_disable_mbox_intr:
otx2_disable_mbox_intr(pf); otx2_disable_mbox_intr(pf);
...@@ -2772,9 +2772,8 @@ static void otx2_remove(struct pci_dev *pdev) ...@@ -2772,9 +2772,8 @@ static void otx2_remove(struct pci_dev *pdev)
otx2_mcam_flow_del(pf); otx2_mcam_flow_del(pf);
otx2_shutdown_tc(pf); otx2_shutdown_tc(pf);
otx2_detach_resources(&pf->mbox); otx2_detach_resources(&pf->mbox);
if (pf->hw.lmt_base) if (test_bit(CN10K_LMTST, &pf->hw.cap_flag))
iounmap(pf->hw.lmt_base); qmem_free(pf->dev, pf->dync_lmt);
otx2_disable_mbox_intr(pf); otx2_disable_mbox_intr(pf);
otx2_pfaf_mbox_destroy(pf); otx2_pfaf_mbox_destroy(pf);
pci_free_irq_vectors(pf->pdev); pci_free_irq_vectors(pf->pdev);
......
...@@ -83,6 +83,7 @@ struct otx2_snd_queue { ...@@ -83,6 +83,7 @@ struct otx2_snd_queue {
u16 num_sqbs; u16 num_sqbs;
u16 sqe_thresh; u16 sqe_thresh;
u8 sqe_per_sqb; u8 sqe_per_sqb;
u32 lmt_id;
u64 io_addr; u64 io_addr;
u64 *aura_fc_addr; u64 *aura_fc_addr;
u64 *lmt_addr; u64 *lmt_addr;
......
...@@ -609,7 +609,7 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -609,7 +609,7 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if (err) if (err)
goto err_detach_rsrc; goto err_detach_rsrc;
err = cn10k_vf_lmtst_init(vf); err = cn10k_lmtst_init(vf);
if (err) if (err)
goto err_detach_rsrc; goto err_detach_rsrc;
...@@ -667,8 +667,8 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -667,8 +667,8 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
err_unreg_netdev: err_unreg_netdev:
unregister_netdev(netdev); unregister_netdev(netdev);
err_detach_rsrc: err_detach_rsrc:
if (hw->lmt_base) if (test_bit(CN10K_LMTST, &vf->hw.cap_flag))
iounmap(hw->lmt_base); qmem_free(vf->dev, vf->dync_lmt);
otx2_detach_resources(&vf->mbox); otx2_detach_resources(&vf->mbox);
err_disable_mbox_intr: err_disable_mbox_intr:
otx2vf_disable_mbox_intr(vf); otx2vf_disable_mbox_intr(vf);
...@@ -700,10 +700,8 @@ static void otx2vf_remove(struct pci_dev *pdev) ...@@ -700,10 +700,8 @@ static void otx2vf_remove(struct pci_dev *pdev)
destroy_workqueue(vf->otx2_wq); destroy_workqueue(vf->otx2_wq);
otx2vf_disable_mbox_intr(vf); otx2vf_disable_mbox_intr(vf);
otx2_detach_resources(&vf->mbox); otx2_detach_resources(&vf->mbox);
if (test_bit(CN10K_LMTST, &vf->hw.cap_flag))
if (vf->hw.lmt_base) qmem_free(vf->dev, vf->dync_lmt);
iounmap(vf->hw.lmt_base);
otx2vf_vfaf_mbox_destroy(vf); otx2vf_vfaf_mbox_destroy(vf);
pci_free_irq_vectors(vf->pdev); pci_free_irq_vectors(vf->pdev);
pci_set_drvdata(pdev, NULL); pci_set_drvdata(pdev, NULL);
......
...@@ -427,7 +427,7 @@ static int dsa_switch_lag_join(struct dsa_switch *ds, ...@@ -427,7 +427,7 @@ static int dsa_switch_lag_join(struct dsa_switch *ds,
info->port, info->lag, info->port, info->lag,
info->info); info->info);
return 0; return -EOPNOTSUPP;
} }
static int dsa_switch_lag_leave(struct dsa_switch *ds, static int dsa_switch_lag_leave(struct dsa_switch *ds,
...@@ -440,7 +440,7 @@ static int dsa_switch_lag_leave(struct dsa_switch *ds, ...@@ -440,7 +440,7 @@ static int dsa_switch_lag_leave(struct dsa_switch *ds,
return ds->ops->crosschip_lag_leave(ds, info->sw_index, return ds->ops->crosschip_lag_leave(ds, info->sw_index,
info->port, info->lag); info->port, info->lag);
return 0; return -EOPNOTSUPP;
} }
static int dsa_switch_mdb_add(struct dsa_switch *ds, static int dsa_switch_mdb_add(struct dsa_switch *ds,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment