diff --git a/module/cmn600/include/internal/cmn600_ccix.h b/module/cmn600/include/internal/cmn600_ccix.h index e0fdc9a52d084603a8e1fc651e17c1b0b4cfb654..5fae2f965e6a4e6a154eeb2a75fe907ef6dda745 100644 --- a/module/cmn600/include/internal/cmn600_ccix.h +++ b/module/cmn600/include/internal/cmn600_ccix.h @@ -37,6 +37,10 @@ int ccix_enter_system_coherency(struct cmn600_ctx *ctx, uint8_t link_id); */ int ccix_enter_dvm_domain(struct cmn600_ctx *ctx, uint8_t link_id); +/* + * CMN600 CCIX get Capabilities Function + */ +void ccix_capabilities_get(struct cmn600_ctx *ctx); /* * CCIX Gateway (CXG) protocol link control & status registers @@ -171,6 +175,8 @@ struct cxg_wait_condition_data { #define CXG_RA_RND_RAID_VALID_REG_OFFSET 0xF38 #define CXG_RA_AGENTID_TO_LINKID_OFFSET 0xE60 #define CXG_RA_AGENTID_TO_LINKID_VAL_OFFSET 0xF20 +#define CXG_RA_REQUEST_TRACKER_DEPTH_MASK UINT64_C(0x0000000001FF0000) +#define CXG_RA_REQUEST_TRACKER_DEPTH_VAL 16 /* CCIX Gateway (CXG) Home Agent (HA) defines */ @@ -180,11 +186,17 @@ struct cxg_wait_condition_data { #define CXG_HA_RAID_TO_LDID_VALID_OFFSET (0xD08) #define CXG_HA_RAID_TO_LDID_RNF_MASK (0x80) #define CXG_HA_LDID_TO_RAID_OFFSET 0xC00 +#define CXG_HA_SNOOP_TRACKER_DEPTH_MASK UINT64_C(0x00001FF000000000) +#define CXG_HA_SNOOP_TRACKER_DEPTH_VAL 36 +#define CXG_HA_WDB_DEPTH_MASK UINT64_C(0x0000000007FC0000) +#define CXG_HA_WDB_DEPTH_VAL 18 /* CCIX Gateway (CXG) Link Agent (LA) defines */ #define CXLA_AGENTID_TO_LINKID_OFFSET 0xC30 #define CXLA_AGENTID_TO_LINKID_VAL_OFFSET 0xC70 + +#define CXLA_CCIX_PROP_MSG_PACK_SHIFT_MASK UINT64_C(0x0000000000000400) #define CXLA_CCIX_PROP_MSG_PACK_SHIFT_VAL 10 #define CXLA_CCIX_PROP_MAX_PACK_SIZE_MASK UINT64_C(0x0000000000000380) diff --git a/module/cmn600/include/mod_cmn600.h b/module/cmn600/include/mod_cmn600.h index 70d69f575ba2ad413d550cb551d689366a2bb89a..8a38712b8e662f65563becbaeb26fb5a016014ab 100644 --- a/module/cmn600/include/mod_cmn600.h +++ b/module/cmn600/include/mod_cmn600.h @@ -203,6 +203,9 @@ struct mod_cmn600_ccix_remote_node_config { /*! Remote HA memory map table */ struct mod_cmn600_ccix_ha_mmap remote_ha_mmap[MAX_HA_MMAP_ENTRIES]; + + /*! Max Packet Size */ + uint8_t ccix_max_packet_size; }; /*! @@ -224,6 +227,23 @@ struct mod_cmn600_ccix_host_node_config { /*! CCIX HA memory map table for endpoints */ struct mod_cmn600_ccix_ha_mmap ccix_host_mmap[MAX_HA_MMAP_ENTRIES]; + /*! CCIX Maximum Memory Request send credits from Host */ + uint16_t ccix_request_credits; + + /*! CCIX Maximum Snoop send credits from Host */ + uint16_t ccix_snoop_credits; + + /*! CCIX Maximum Data send credits from Host */ + uint16_t ccix_data_credits; + + /*! Max Packet Size */ + uint8_t ccix_max_packet_size; + + /*! CCIX optimised tlp mode capabiltiy of Host */ + bool ccix_opt_tlp; + + /*! CCIX message packing flag capability of Host */ + bool ccix_msg_pack_enable; }; /*! diff --git a/module/cmn600/src/cmn600_ccix.c b/module/cmn600/src/cmn600_ccix.c index cd8213bcbd3bca8e2af26777e282e2fbc0e42afd..dcd110f9d859007f19e4daee7de706a0e5570371 100644 --- a/module/cmn600/src/cmn600_ccix.c +++ b/module/cmn600/src/cmn600_ccix.c @@ -277,7 +277,7 @@ static int enable_and_start_ccix_link_up_sequence(struct cmn600_ctx *ctx, ~CXLA_CCIX_PROP_MAX_PACK_SIZE_MASK; ctx->cxla_reg->CXLA_CCIX_PROP_CONFIGURED |= - (CXLA_CCIX_PROP_MAX_PACK_SIZE_512 << + (config->ccix_max_packet_size << CXLA_CCIX_PROP_MAX_PACK_SIZE_SHIFT_VAL); ctx->cxla_reg->CXLA_LINKID_TO_PCIE_BUS_NUM = @@ -601,3 +601,34 @@ int ccix_enter_dvm_domain(struct cmn600_ctx *ctx, uint8_t link_id) ctx->log_api->log(MOD_LOG_GROUP_DEBUG, "Done\n"); return FWK_SUCCESS; } + +void ccix_capabilities_get(struct cmn600_ctx *ctx) +{ + /* Populate maximum credit send capability */ + ctx->ccix_host_info.ccix_request_credits = + (ctx->cxg_ra_reg->CXG_RA_UNIT_INFO & CXG_RA_REQUEST_TRACKER_DEPTH_MASK) + >> CXG_RA_REQUEST_TRACKER_DEPTH_VAL; + + ctx->ccix_host_info.ccix_snoop_credits = + (ctx->cxg_ha_reg->CXG_HA_UNIT_INFO & CXG_HA_SNOOP_TRACKER_DEPTH_MASK) >> + CXG_HA_SNOOP_TRACKER_DEPTH_VAL; + + ctx->ccix_host_info.ccix_data_credits = + (ctx->cxg_ha_reg->CXG_HA_UNIT_INFO & CXG_HA_WDB_DEPTH_MASK) >> + CXG_HA_WDB_DEPTH_VAL; + + /* Populate max packet size capability */ + ctx->ccix_host_info.ccix_max_packet_size = + (ctx->cxla_reg->CXLA_CCIX_PROP_CAPABILITIES & + CXLA_CCIX_PROP_MAX_PACK_SIZE_MASK) >> + CXLA_CCIX_PROP_MAX_PACK_SIZE_SHIFT_VAL; + + /* Optimized TLP is always supported by CMN-600 */ + ctx->ccix_host_info.ccix_opt_tlp = true; + + /* Populate message packing capability */ + ctx->ccix_host_info.ccix_msg_pack_enable = + !((ctx->cxla_reg->CXLA_CCIX_PROP_CAPABILITIES & + CXLA_CCIX_PROP_MSG_PACK_SHIFT_MASK) >> + CXLA_CCIX_PROP_MSG_PACK_SHIFT_VAL); +} diff --git a/module/cmn600/src/mod_cmn600.c b/module/cmn600/src/mod_cmn600.c index 03eccc9a7c1c04ad114299d3c18b9ef06ac6ce40..c98efa6574949f0043673148e5d326ce63a3da1b 100644 --- a/module/cmn600/src/mod_cmn600.c +++ b/module/cmn600/src/mod_cmn600.c @@ -535,6 +535,8 @@ static int cmn600_ccix_config_get( ctx->internal_rnsam_count + ctx->external_rnsam_count - 1; ctx->ccix_host_info.host_sa_count = ctx->config->sa_count; + ccix_capabilities_get(ctx); + memcpy((void *)config, (void *)&ctx->ccix_host_info, sizeof(struct mod_cmn600_ccix_host_node_config)); return FWK_SUCCESS; diff --git a/product/n1sdp/module/n1sdp_c2c/src/mod_n1sdp_c2c_i2c.c b/product/n1sdp/module/n1sdp_c2c/src/mod_n1sdp_c2c_i2c.c index 89688a6e7c71d7079a3e838f18086a88786e19c8..a088dc4ffc78bc5649635e2ed97b48da59569309 100644 --- a/product/n1sdp/module/n1sdp_c2c/src/mod_n1sdp_c2c_i2c.c +++ b/product/n1sdp/module/n1sdp_c2c/src/mod_n1sdp_c2c_i2c.c @@ -45,6 +45,11 @@ #define C2C_MASTER_RETRY_DELAY_US UINT32_C(10000) #define C2C_MASTER_RETRIES 10 +/* Max Packet Size values */ +#define CCIX_PROP_MAX_PACK_SIZE_128 0 +#define CCIX_PROP_MAX_PACK_SIZE_256 1 +#define CCIX_PROP_MAX_PACK_SIZE_512 2 + static const char * const cmd_str[] = { [N1SDP_C2C_CMD_CHECK_SLAVE] = "Check slave alive", [N1SDP_C2C_CMD_PCIE_POWER_ON] = "PCIe power ON", @@ -368,6 +373,7 @@ static int n1sdp_c2c_multichip_run_command(uint8_t cmd, bool run_in_slave) remote_config.remote_ha_mmap[0].ha_id = 0x1; remote_config.remote_ha_mmap[0].base = (4ULL * FWK_TIB); remote_config.remote_ha_mmap[0].size = (4ULL * FWK_TIB); + remote_config.ccix_max_packet_size = CCIX_PROP_MAX_PACK_SIZE_512; status = n1sdp_c2c_ctx.cmn600_api->set_config(&remote_config); if (status != FWK_SUCCESS) { diff --git a/product/n1sdp/module/scmi_ccix_config/include/internal/mod_scmi_ccix_config.h b/product/n1sdp/module/scmi_ccix_config/include/internal/mod_scmi_ccix_config.h index 6e2f14956a0e52c6807a2e4f28a7d00d4c1558ba..907b3d348b50c2719f497b393ca01fe1856a161a 100644 --- a/product/n1sdp/module/scmi_ccix_config/include/internal/mod_scmi_ccix_config.h +++ b/product/n1sdp/module/scmi_ccix_config/include/internal/mod_scmi_ccix_config.h @@ -70,11 +70,36 @@ struct __attribute((packed)) scmi_ccix_config_mempools_map { #define HA_COUNT_MASK UINT32_C(0x00FF0000) #define HA_COUNT_BIT_POS 16 +/* + * link_properties bit field definition + * + * opt_tlp[31] + * msg_packing[30] + * max_packet_size[29-27] + * data_credits[26-18] + * snoop_credits[17-9] + * request_credits[8-0] + */ +#define REQUEST_CREDITS_MASK UINT32_C(0x000001FF) +#define REQUEST_CREDITS_BIT_POS 0 +#define SNOOP_CREDITS_MASK UINT32_C(0x0003FE00) +#define SNOOP_CREDITS_BIT_POS 9 +#define DATA_CREDITS_MASK UINT32_C(0x07FC0000) +#define DATA_CREDITS_BIT_POS 18 +#define HOST_MAX_PACKET_SIZE_MASK UINT32_C(0x38000000) +#define HOST_MAX_PACKET_SIZE_BIT_POS 27 +#define HOST_MSG_PACK_MASK UINT32_C(0x40000000) +#define HOST_MSG_PACK_BIT_POS 30 +#define HOST_OPT_TLP_MASK UINT32_C(0x80000000) +#define HOST_OPT_TLP_BIT_POS 31 + + struct __attribute((packed)) scmi_ccix_config_protocol_get_p2a { int32_t status; uint32_t agent_count; uint32_t host_mmap_count; struct scmi_ccix_config_mempools_map mem_pools[MAX_HA_MMAP_ENTRIES]; + uint32_t link_properties; }; /* @@ -82,7 +107,8 @@ struct __attribute((packed)) scmi_ccix_config_protocol_get_p2a { * * config_property bit field definition * - * reserved[31-26] + * reserved[31-29] + * max_packet_size[28-26] * opt_tlp[25] * msg_packing[24] * link_id[23-16] @@ -99,6 +125,8 @@ struct __attribute((packed)) scmi_ccix_config_protocol_get_p2a { #define MSG_PACK_BIT_POS 24 #define OPT_TLP_MASK UINT32_C(0x03000000) #define OPT_TLP_BIT_POS 25 +#define MAX_PACKET_SIZE_MASK UINT32_C(0x1C000000) +#define MAX_PACKET_SIZE_BIT_POS 26 struct __attribute((packed)) scmi_ccix_config_protocol_set_a2p { uint32_t agent_count; diff --git a/product/n1sdp/module/scmi_ccix_config/src/mod_scmi_ccix_config.c b/product/n1sdp/module/scmi_ccix_config/src/mod_scmi_ccix_config.c index 7c8d2f69c3818f5999f62ecd82640985aa381b39..88faf63a03bf89031c3a896420bc765129f6c181 100644 --- a/product/n1sdp/module/scmi_ccix_config/src/mod_scmi_ccix_config.c +++ b/product/n1sdp/module/scmi_ccix_config/src/mod_scmi_ccix_config.c @@ -209,6 +209,15 @@ static int scmi_ccix_config_protocol_get_handler(fwk_id_t service_id, ADDRESS_LSB_MASK); } + return_values.link_properties = + ((ccix_host_config.ccix_data_credits << DATA_CREDITS_BIT_POS) | + (ccix_host_config.ccix_snoop_credits << SNOOP_CREDITS_BIT_POS) | + (ccix_host_config.ccix_request_credits << REQUEST_CREDITS_BIT_POS) | + (ccix_host_config.ccix_max_packet_size << + HOST_MAX_PACKET_SIZE_BIT_POS) | + (ccix_host_config.ccix_opt_tlp << HOST_OPT_TLP_BIT_POS) | + (ccix_host_config.ccix_msg_pack_enable << HOST_MSG_PACK_BIT_POS)); + exit: scmi_ccix_config_ctx.scmi_api->respond(service_id, &return_values, (return_values.status == SCMI_SUCCESS) ? @@ -281,6 +290,9 @@ static int scmi_ccix_config_protocol_set_handler(fwk_id_t service_id, ccix_ep_config.remote_ha_mmap_count = (uint8_t)(params->remote_mmap_count); ccix_ep_config.ccix_opt_tlp = (bool)((params->config_property & OPT_TLP_MASK) >> OPT_TLP_BIT_POS); + ccix_ep_config.ccix_max_packet_size = (uint8_t)((params->config_property & + MAX_PACKET_SIZE_MASK) >> + MAX_PACKET_SIZE_BIT_POS); for (i = 0; i < ccix_ep_config.remote_ha_mmap_count; i++) { ccix_ep_config.remote_ha_mmap[i].ha_id =