Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 79ad1b0e authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: ipa: fix uC descriptor ring IPA SRAM area"

parents b9e1e326 bfb580fc
Loading
Loading
Loading
Loading
+26 −3
Original line number Diff line number Diff line
@@ -2701,11 +2701,34 @@ int _ipa_init_sram_v3(void)
		IPA_MEM_PART(modem_hdr_proc_ctx_ofst) - 4);
	ipa3_sram_set_canary(ipa_sram_mmio,
		IPA_MEM_PART(modem_hdr_proc_ctx_ofst));
	ipa3_sram_set_canary(ipa_sram_mmio, IPA_MEM_PART(modem_ofst) - 4);
	if (ipa_get_hw_type() >= IPA_HW_v4_5) {
		ipa3_sram_set_canary(ipa_sram_mmio,
			IPA_MEM_PART(apps_hdr_proc_ctx_ofst) - 4);
		ipa3_sram_set_canary(ipa_sram_mmio,
			IPA_MEM_PART(apps_hdr_proc_ctx_ofst));
		ipa3_sram_set_canary(ipa_sram_mmio,
			IPA_MEM_PART(nat_tbl_ofst) - 4);
		ipa3_sram_set_canary(ipa_sram_mmio, IPA_MEM_PART(nat_tbl_ofst));
	}
	if (ipa_get_hw_type() >= IPA_HW_v4_0) {
		ipa3_sram_set_canary(ipa_sram_mmio,
			IPA_MEM_PART(pdn_config_ofst) - 4);
		ipa3_sram_set_canary(ipa_sram_mmio,
			IPA_MEM_PART(pdn_config_ofst));
		ipa3_sram_set_canary(ipa_sram_mmio,
			IPA_MEM_PART(stats_quota_ofst) - 4);
		ipa3_sram_set_canary(ipa_sram_mmio,
			IPA_MEM_PART(stats_quota_ofst));
	}
	if (ipa_get_hw_type() <= IPA_HW_v3_5 ||
		ipa_get_hw_type() >= IPA_HW_v4_5) {
		ipa3_sram_set_canary(ipa_sram_mmio,
			IPA_MEM_PART(modem_ofst) - 4);
		ipa3_sram_set_canary(ipa_sram_mmio, IPA_MEM_PART(modem_ofst));
	}
	ipa3_sram_set_canary(ipa_sram_mmio,
		(ipa_get_hw_type() >= IPA_HW_v3_5) ?
			IPA_MEM_PART(uc_event_ring_ofst) :
			IPA_MEM_PART(uc_descriptor_ram_ofst) :
			IPA_MEM_PART(end_ofst));

	iounmap(ipa_sram_mmio);
+34 −37
Original line number Diff line number Diff line
@@ -1753,77 +1753,63 @@ struct ipa3_plat_drv_res {
 * +-------------------------+
 * |  MODEM HDR              |
 * +-------------------------+
 * |    CANARY               |
 * +-------------------------+
 * |    CANARY               |
 * +-------------------------+
 * | MODEM PROC CTX          |
 * +-------------------------+
 * | APPS PROC CTX           |
 * +-------------------------+
 * |    CANARY               |
 * |  APPS HDR (IPA4.5)      |
 * +-------------------------+
 * |    CANARY               |
 * +-------------------------+
 * | PDN CONFIG              |
 * +-------------------------+
 * |    CANARY               |
 * +-------------------------+
 * |    CANARY               |
 * +-------------------------+
 * | QUOTA STATS             |
 * | MODEM PROC CTX          |
 * +-------------------------+
 * |    CANARY               |
 * |    CANARY (IPA4.5)      |
 * +-------------------------+
 * |    CANARY               |
 * |    CANARY (IPA4.5)      |
 * +-------------------------+
 * | TETH STATS              |
 * | APPS PROC CTX           |
 * +-------------------------+
 * |    CANARY               |
 * +-------------------------+
 * |    CANARY               |
 * +-------------------------+
 * | V4 FLT STATS            |
 * | NAT TABLE (IPA4.5)      |
 * +-------------------------+
 * |    CANARY               |
 * | NAT IDX TABLE (IPA4.5)  |
 * +-------------------------+
 * |    CANARY               |
 * | NAT EXP TABLE (IPA4.5)  |
 * +-------------------------+
 * | V6 FLT STATS            |
 * |    CANARY (IPA4.5)      |
 * +-------------------------+
 * |    CANARY               |
 * |    CANARY (IPA4.5)      |
 * +-------------------------+
 * |    CANARY               |
 * +-------------------------+
 * | V4 RT STATS             |
 * | PDN CONFIG              |
 * +-------------------------+
 * |    CANARY               |
 * +-------------------------+
 * |    CANARY               |
 * +-------------------------+
 * | V6 RT STATS             |
 * | QUOTA STATS             |
 * +-------------------------+
 * |    CANARY               |
 * | TETH STATS              |
 * +-------------------------+
 * |    CANARY               |
 * | FnR STATS               |
 * +-------------------------+
 * | DROP STATS              |
 * +-------------------------+
 * |    CANARY               |
 * |    CANARY (IPA4.5)      |
 * +-------------------------+
 * |    CANARY               |
 * |    CANARY (IPA4.5)      |
 * +-------------------------+
 * | MODEM MEM               |
 * +-------------------------+
 * |    CANARY               |
 * |    Dummy (IPA4.5)       |
 * +-------------------------+
 * |    CANARY (IPA4.5)      |
 * +-------------------------+
 * |  UC EVENT RING          | From IPA 3.5
 * | UC DESC RAM (IPA3.5)    |
 * +-------------------------+
 */
struct ipa3_mem_partition {
	u32 ofst_start;
	u32 nat_ofst;
	u32 nat_size;
	u32 v4_flt_hash_ofst;
	u32 v4_flt_hash_size;
	u32 v4_flt_hash_size_ddr;
@@ -1868,6 +1854,12 @@ struct ipa3_mem_partition {
	u32 apps_hdr_proc_ctx_ofst;
	u32 apps_hdr_proc_ctx_size;
	u32 apps_hdr_proc_ctx_size_ddr;
	u32 nat_tbl_ofst;
	u32 nat_tbl_size;
	u32 nat_index_tbl_ofst;
	u32 nat_index_tbl_size;
	u32 nat_exp_tbl_ofst;
	u32 nat_exp_tbl_size;
	u32 modem_comp_decomp_ofst;
	u32 modem_comp_decomp_size;
	u32 modem_ofst;
@@ -1891,14 +1883,18 @@ struct ipa3_mem_partition {
	u32 apps_v6_rt_hash_size;
	u32 apps_v6_rt_nhash_ofst;
	u32 apps_v6_rt_nhash_size;
	u32 uc_event_ring_ofst;
	u32 uc_event_ring_size;
	u32 uc_descriptor_ram_ofst;
	u32 uc_descriptor_ram_size;
	u32 pdn_config_ofst;
	u32 pdn_config_size;
	u32 stats_quota_ofst;
	u32 stats_quota_size;
	u32 stats_tethering_ofst;
	u32 stats_tethering_size;
	u32 stats_fnr_ofst;
	u32 stats_fnr_size;

	/* Irrelevant starting IPA4.5 */
	u32 stats_flt_v4_ofst;
	u32 stats_flt_v4_size;
	u32 stats_flt_v6_ofst;
@@ -1907,6 +1903,7 @@ struct ipa3_mem_partition {
	u32 stats_rt_v4_size;
	u32 stats_rt_v6_ofst;
	u32 stats_rt_v6_size;

	u32 stats_drop_ofst;
	u32 stats_drop_size;
};
+196 −29
Original line number Diff line number Diff line
@@ -2381,8 +2381,6 @@ static const struct ipa_ep_configuration ipa3_ep_mapping

static struct ipa3_mem_partition ipa_4_1_mem_part = {
	.ofst_start				= 0x280,
	.nat_ofst			= 0x0,
	.nat_size			= 0x0,
	.v4_flt_hash_ofst		= 0x288,
	.v4_flt_hash_size		=  0x78,
	.v4_flt_hash_size_ddr		= 0x4000,
@@ -2450,8 +2448,8 @@ static struct ipa3_mem_partition ipa_4_1_mem_part = {
	.apps_v6_rt_hash_size		= 0x0,
	.apps_v6_rt_nhash_ofst		= 0x23fc,
	.apps_v6_rt_nhash_size		= 0x0,
	.uc_event_ring_ofst		= 0x2400,
	.uc_event_ring_size		= 0x400,
	.uc_descriptor_ram_ofst		= 0x2400,
	.uc_descriptor_ram_size		= 0x400,
	.pdn_config_ofst		= 0xbd8,
	.pdn_config_size		= 0x50,
	.stats_quota_ofst		= 0xc30,
@@ -2472,8 +2470,6 @@ static struct ipa3_mem_partition ipa_4_1_mem_part = {

static struct ipa3_mem_partition ipa_4_2_mem_part = {
	.ofst_start				= 0x280,
	.nat_ofst			= 0x0,
	.nat_size			= 0x0,
	.v4_flt_hash_ofst		= 0x288,
	.v4_flt_hash_size		= 0x0,
	.v4_flt_hash_size_ddr		= 0x0,
@@ -2541,8 +2537,8 @@ static struct ipa3_mem_partition ipa_4_2_mem_part = {
	.apps_v6_rt_hash_size		= 0x0,
	.apps_v6_rt_nhash_ofst		= 0x1bfc,
	.apps_v6_rt_nhash_size		= 0x0,
	.uc_event_ring_ofst		= 0x1c00,
	.uc_event_ring_size		= 0x400,
	.uc_descriptor_ram_ofst		= 0x1c00,
	.uc_descriptor_ram_size		= 0x400,
	.pdn_config_ofst		= 0x9F8,
	.pdn_config_size		= 0x50,
	.stats_quota_ofst		= 0xa50,
@@ -2561,6 +2557,104 @@ static struct ipa3_mem_partition ipa_4_2_mem_part = {
	.stats_drop_size		= 0x0,
};

static struct ipa3_mem_partition ipa_4_5_mem_part = {
	.uc_info_ofst			= 0x80,
	.uc_info_size			= 0x200,
	.ofst_start			= 0x280,
	.v4_flt_hash_ofst		= 0x288,
	.v4_flt_hash_size		=  0x78,
	.v4_flt_hash_size_ddr		= 0x4000,
	.v4_flt_nhash_ofst		= 0x308,
	.v4_flt_nhash_size		= 0x78,
	.v4_flt_nhash_size_ddr		= 0x4000,
	.v6_flt_hash_ofst		= 0x388,
	.v6_flt_hash_size		= 0x78,
	.v6_flt_hash_size_ddr		= 0x4000,
	.v6_flt_nhash_ofst		= 0x408,
	.v6_flt_nhash_size		= 0x78,
	.v6_flt_nhash_size_ddr		= 0x4000,
	.v4_rt_num_index		= 0xf,
	.v4_modem_rt_index_lo		= 0x0,
	.v4_modem_rt_index_hi		= 0x7,
	.v4_apps_rt_index_lo		= 0x8,
	.v4_apps_rt_index_hi		= 0xe,
	.v4_rt_hash_ofst		= 0x488,
	.v4_rt_hash_size		= 0x78,
	.v4_rt_hash_size_ddr		= 0x4000,
	.v4_rt_nhash_ofst		= 0x508,
	.v4_rt_nhash_size		= 0x78,
	.v4_rt_nhash_size_ddr		= 0x4000,
	.v6_rt_num_index		= 0xf,
	.v6_modem_rt_index_lo		= 0x0,
	.v6_modem_rt_index_hi		= 0x7,
	.v6_apps_rt_index_lo		= 0x8,
	.v6_apps_rt_index_hi		= 0xe,
	.v6_rt_hash_ofst		= 0x588,
	.v6_rt_hash_size		= 0x78,
	.v6_rt_hash_size_ddr		= 0x4000,
	.v6_rt_nhash_ofst		= 0x608,
	.v6_rt_nhash_size		= 0x78,
	.v6_rt_nhash_size_ddr		= 0x4000,
	.modem_hdr_ofst			= 0x688,
	.modem_hdr_size			= 0x240,
	.apps_hdr_ofst			= 0x8c8,
	.apps_hdr_size			= 0x200,
	.apps_hdr_size_ddr		= 0x800,
	.modem_hdr_proc_ctx_ofst	= 0xad0,
	.modem_hdr_proc_ctx_size	= 0x200,
	.apps_hdr_proc_ctx_ofst		= 0xcd8,
	.apps_hdr_proc_ctx_size		= 0x200,
	.apps_hdr_proc_ctx_size_ddr	= 0x0,
	.nat_tbl_ofst			= 0xee0,
	.nat_tbl_size			= 0x800,
	.nat_index_tbl_ofst		= 0x16e0,
	.nat_index_tbl_size		= 0x100,
	.nat_exp_tbl_ofst		= 0x17e0,
	.nat_exp_tbl_size		= 0x400,
	.pdn_config_ofst		= 0x1be8,
	.pdn_config_size		= 0x50,
	.stats_quota_ofst		= 0x1c40,
	.stats_quota_size		= 0x78,
	.stats_tethering_ofst		= 0x1cb8,
	.stats_tethering_size		= 0x238,
	.stats_flt_v4_ofst		= 0,
	.stats_flt_v4_size		= 0,
	.stats_flt_v6_ofst		= 0,
	.stats_flt_v6_size		= 0,
	.stats_rt_v4_ofst		= 0,
	.stats_rt_v4_size		= 0,
	.stats_rt_v6_ofst		= 0,
	.stats_rt_v6_size		= 0,
	.stats_fnr_ofst			= 0x1ef0,
	.stats_fnr_size			= 0x800,
	.stats_drop_ofst		= 0x26f0,
	.stats_drop_size		= 0x20,
	.modem_comp_decomp_ofst		= 0x0,
	.modem_comp_decomp_size		= 0x0,
	.modem_ofst			= 0x2718,
	.modem_size			= 0x100c,
	.apps_v4_flt_hash_ofst	= 0x2718,
	.apps_v4_flt_hash_size	= 0x0,
	.apps_v4_flt_nhash_ofst	= 0x2718,
	.apps_v4_flt_nhash_size	= 0x0,
	.apps_v6_flt_hash_ofst	= 0x2718,
	.apps_v6_flt_hash_size	= 0x0,
	.apps_v6_flt_nhash_ofst	= 0x2718,
	.apps_v6_flt_nhash_size	= 0x0,
	.apps_v4_rt_hash_ofst	= 0x2718,
	.apps_v4_rt_hash_size	= 0x0,
	.apps_v4_rt_nhash_ofst	= 0x2718,
	.apps_v4_rt_nhash_size	= 0x0,
	.apps_v6_rt_hash_ofst	= 0x2718,
	.apps_v6_rt_hash_size	= 0x0,
	.apps_v6_rt_nhash_ofst	= 0x2718,
	.apps_v6_rt_nhash_size	= 0x0,
	.uc_descriptor_ram_ofst	= 0x3800,
	.uc_descriptor_ram_size	= 0x1000,
	.end_ofst		= 0x4800,
};


/**
 * ipa3_get_clients_from_rm_resource() - get IPA clients which are related to an
 * IPA_RM resource
@@ -4873,7 +4967,7 @@ int ipa3_init_mem_partition(enum ipa_hw_type type)
		ipa3_ctx->ctrl->mem_partition = &ipa_4_2_mem_part;
		break;
	case IPA_HW_v4_5:
		ipa3_ctx->ctrl->mem_partition = &ipa_4_1_mem_part;
		ipa3_ctx->ctrl->mem_partition = &ipa_4_5_mem_part;
		break;
	case IPA_HW_None:
	case IPA_HW_v1_0:
@@ -4891,19 +4985,6 @@ int ipa3_init_mem_partition(enum ipa_hw_type type)
		return -EPERM;
	}

	if (IPA_MEM_PART(uc_event_ring_ofst) & 1023) {
		IPAERR("UC EVENT RING OFST 0x%x is unaligned\n",
			IPA_MEM_PART(uc_event_ring_ofst));
		return -ENODEV;
	}

	IPADBG("UC EVENT RING OFST 0x%x SIZE 0x%x\n",
		IPA_MEM_PART(uc_event_ring_ofst),
		IPA_MEM_PART(uc_event_ring_size));

	IPADBG("NAT OFST 0x%x SIZE 0x%x\n", IPA_MEM_PART(nat_ofst),
		IPA_MEM_PART(nat_size));

	if (IPA_MEM_PART(uc_info_ofst) & 3) {
		IPAERR("UC INFO OFST 0x%x is unaligned\n",
			IPA_MEM_PART(uc_info_ofst));
@@ -5074,18 +5155,85 @@ int ipa3_init_mem_partition(enum ipa_hw_type type)
		return -ENODEV;
	}

	IPADBG("NAT TBL OFST 0x%x SIZE 0x%x\n",
		IPA_MEM_PART(nat_tbl_ofst),
		IPA_MEM_PART(nat_tbl_size));

	if (IPA_MEM_PART(nat_tbl_ofst) & 31) {
		IPAERR("NAT TBL OFST 0x%x is unaligned\n",
			IPA_MEM_PART(nat_tbl_ofst));
		return -ENODEV;
	}

	IPADBG("NAT INDEX TBL OFST 0x%x SIZE 0x%x\n",
		IPA_MEM_PART(nat_index_tbl_ofst),
		IPA_MEM_PART(nat_index_tbl_size));

	if (IPA_MEM_PART(nat_index_tbl_ofst) & 3) {
		IPAERR("NAT INDEX TBL OFST 0x%x is unaligned\n",
			IPA_MEM_PART(nat_index_tbl_ofst));
		return -ENODEV;
	}

	IPADBG("NAT EXP TBL OFST 0x%x SIZE 0x%x\n",
		IPA_MEM_PART(nat_exp_tbl_ofst),
		IPA_MEM_PART(nat_exp_tbl_size));

	if (IPA_MEM_PART(nat_exp_tbl_ofst) & 31) {
		IPAERR("NAT EXP TBL OFST 0x%x is unaligned\n",
			IPA_MEM_PART(nat_exp_tbl_ofst));
		return -ENODEV;
	}

	IPADBG("PDN CONFIG OFST 0x%x SIZE 0x%x\n",
		IPA_MEM_PART(pdn_config_ofst),
		IPA_MEM_PART(pdn_config_size));

	if (IPA_MEM_PART(modem_ofst) & 7) {
		IPAERR("MODEM OFST 0x%x is unaligned\n",
			IPA_MEM_PART(modem_ofst));
	if (IPA_MEM_PART(pdn_config_ofst) & 7) {
		IPAERR("PDN CONFIG OFST 0x%x is unaligned\n",
			IPA_MEM_PART(pdn_config_ofst));
		return -ENODEV;
	}

	IPADBG("MODEM OFST 0x%x SIZE 0x%x\n", IPA_MEM_PART(modem_ofst),
		IPA_MEM_PART(modem_size));
	IPADBG("QUOTA STATS OFST 0x%x SIZE 0x%x\n",
		IPA_MEM_PART(stats_quota_ofst),
		IPA_MEM_PART(stats_quota_size));

	if (IPA_MEM_PART(stats_quota_ofst) & 7) {
		IPAERR("QUOTA STATS OFST 0x%x is unaligned\n",
			IPA_MEM_PART(stats_quota_ofst));
		return -ENODEV;
	}

	IPADBG("TETHERING STATS OFST 0x%x SIZE 0x%x\n",
		IPA_MEM_PART(stats_tethering_ofst),
		IPA_MEM_PART(stats_tethering_size));

	if (IPA_MEM_PART(stats_tethering_ofst) & 7) {
		IPAERR("TETHERING STATS OFST 0x%x is unaligned\n",
			IPA_MEM_PART(stats_tethering_ofst));
		return -ENODEV;
	}

	IPADBG("FILTER AND ROUTING STATS OFST 0x%x SIZE 0x%x\n",
		IPA_MEM_PART(stats_fnr_ofst),
		IPA_MEM_PART(stats_fnr_size));

	if (IPA_MEM_PART(stats_fnr_ofst) & 7) {
		IPAERR("FILTER AND ROUTING STATS OFST 0x%x is unaligned\n",
			IPA_MEM_PART(stats_fnr_ofst));
		return -ENODEV;
	}

	IPADBG("DROP STATS OFST 0x%x SIZE 0x%x\n",
	IPA_MEM_PART(stats_drop_ofst),
		IPA_MEM_PART(stats_drop_size));

	if (IPA_MEM_PART(stats_drop_ofst) & 7) {
		IPAERR("DROP STATS OFST 0x%x is unaligned\n",
			IPA_MEM_PART(stats_drop_ofst));
		return -ENODEV;
	}

	IPADBG("V4 APPS HASHABLE FLT OFST 0x%x SIZE 0x%x\n",
		IPA_MEM_PART(apps_v4_flt_hash_ofst),
@@ -5122,6 +5270,25 @@ int ipa3_init_mem_partition(enum ipa_hw_type type)
		IPA_MEM_PART(apps_v6_rt_nhash_ofst),
		IPA_MEM_PART(apps_v6_rt_nhash_size));

	if (IPA_MEM_PART(modem_ofst) & 7) {
		IPAERR("MODEM OFST 0x%x is unaligned\n",
			IPA_MEM_PART(modem_ofst));
		return -ENODEV;
	}

	IPADBG("MODEM OFST 0x%x SIZE 0x%x\n", IPA_MEM_PART(modem_ofst),
		IPA_MEM_PART(modem_size));

	if (IPA_MEM_PART(uc_descriptor_ram_ofst) & 1023) {
		IPAERR("UC DESCRIPTOR RAM OFST 0x%x is unaligned\n",
			IPA_MEM_PART(uc_descriptor_ram_ofst));
		return -ENODEV;
	}

	IPADBG("UC DESCRIPTOR RAM OFST 0x%x SIZE 0x%x\n",
		IPA_MEM_PART(uc_descriptor_ram_ofst),
		IPA_MEM_PART(uc_descriptor_ram_size));

	return 0;
}