From 6c27e9b705fabba1fa2c228b70cd1b9c8338b97e Mon Sep 17 00:00:00 2001 From: Pradeep P V K Date: Fri, 8 Sep 2023 11:55:47 +0530 Subject: [PATCH 1/7] mtd: msm_qpic_nand: Add mutex lock in system suspend/resume functions Some race condition is happening where as part of mtd_write_oob post msm_nand_get_devices function msm_nand_suspend function is getting invoked and since we don't have any locks there so it ends up turning off the qpic clocks leading to NOC error. Add mutex lock in system suspend/resume functions for synchronization. Change-Id: Iaa3e3ee0041c425e2edddc5a023074009010e393 Signed-off-by: Sarthak Garg Signed-off-by: Pradeep P V K --- drivers/mtd/devices/msm_qpic_nand.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/mtd/devices/msm_qpic_nand.c b/drivers/mtd/devices/msm_qpic_nand.c index 41fadf756ac3..329e7ebbd191 100644 --- a/drivers/mtd/devices/msm_qpic_nand.c +++ b/drivers/mtd/devices/msm_qpic_nand.c @@ -231,20 +231,27 @@ static void msm_nand_print_rpm_info(struct device *dev) static int msm_nand_suspend(struct device *dev) { int ret = 0; + struct msm_nand_info *info = dev_get_drvdata(dev); + + mutex_lock(&info->lock); if (!pm_runtime_suspended(dev)) ret = msm_nand_runtime_suspend(dev); + mutex_unlock(&info->lock); return ret; } static int msm_nand_resume(struct device *dev) { int ret = 0; + struct msm_nand_info *info = dev_get_drvdata(dev); + mutex_lock(&info->lock); if (!pm_runtime_suspended(dev)) ret = msm_nand_runtime_resume(dev); + mutex_unlock(&info->lock); return ret; } #else From 470f96c089c9761eef91462c4c41567b36ce2c03 Mon Sep 17 00:00:00 2001 From: Mukesh Ojha Date: Fri, 7 Jan 2022 17:51:04 +0530 Subject: [PATCH 2/7] soc: qcom: socinfo: Add revision 16 support in socinfo structure Below are some new fields are getting updated in socinfo structure from bootloader under revision 16. e.g esku; nproduct_code; npartnamemap_offset; nnum_partname_mapping; Add the change in socinfo driver to accommodate this. Change-Id: I11b5182c15af32da61cddbf4bb45d5aef390135a Signed-off-by: Mukesh Ojha Signed-off-by: Srinivasarao Pathipati --- drivers/soc/qcom/socinfo.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c index 562f35ce68a4..511f08848720 100644 --- a/drivers/soc/qcom/socinfo.c +++ b/drivers/soc/qcom/socinfo.c @@ -167,6 +167,11 @@ static struct socinfo { __le32 ndefective_parts_array_offset; /* Version 15 */ __le32 nmodem_supported; + /* Version 16 */ + __le32 esku; + __le32 nproduct_code; + __le32 npartnamemap_offset; + __le32 nnum_partname_mapping; } *socinfo; /* sysfs attributes */ @@ -959,6 +964,7 @@ static void socinfo_populate_sysfs(struct qcom_socinfo *qcom_socinfo) int i = 0; switch (socinfo_format) { + case SOCINFO_VERSION(0, 16): case SOCINFO_VERSION(0, 15): msm_custom_socinfo_attrs[i++] = &dev_attr_nmodem_supported.attr; case SOCINFO_VERSION(0, 14): @@ -1200,6 +1206,29 @@ static void socinfo_print(void) socinfo->nmodem_supported); break; + case SOCINFO_VERSION(0, 16): + pr_info("v%u.%u, id=%u, ver=%u.%u, raw_id=%u, raw_ver=%u, hw_plat=%u, hw_plat_ver=%u\n accessory_chip=%u, hw_plat_subtype=%u, pmic_model=%u, pmic_die_revision=%u foundry_id=%u serial_number=%u num_pmics=%u chip_family=0x%x raw_device_family=0x%x raw_device_number=0x%x nproduct_id=0x%x num_clusters=0x%x ncluster_array_offset=0x%x num_defective_parts=0x%x ndefective_parts_array_offset=0x%x nmodem_supported=0x%x\n", + f_maj, f_min, socinfo->id, v_maj, v_min, + socinfo->raw_id, socinfo->raw_ver, + socinfo->hw_plat, + socinfo->plat_ver, + socinfo->accessory_chip, + socinfo->hw_plat_subtype, + socinfo->pmic_model, + socinfo->pmic_die_rev, + socinfo->foundry_id, + socinfo->serial_num, + socinfo->num_pmics, + socinfo->chip_family, + socinfo->raw_device_family, + socinfo->raw_device_num, + socinfo->nproduct_id, + socinfo->num_clusters, + socinfo->ncluster_array_offset, + socinfo->num_defective_parts, + socinfo->ndefective_parts_array_offset, + socinfo->nmodem_supported); + default: pr_err("Unknown format found: v%u.%u\n", f_maj, f_min); break; From ce4a0865b11f9ae1799a1477d34dc7d6149fc139 Mon Sep 17 00:00:00 2001 From: Mukesh Ojha Date: Wed, 19 Jan 2022 21:56:57 +0530 Subject: [PATCH 3/7] soc: qcom: socinfo: Add sku sysfs support Add the support to get the sku information from userspace. Change-Id: I39b60fcc430308cd75e67fa400ad9515b5ad4b65 Signed-off-by: Mukesh Ojha Signed-off-by: Srinivasarao Pathipati --- drivers/soc/qcom/socinfo.c | 112 ++++++++++++++++++++++++++++++++++++- 1 file changed, 110 insertions(+), 2 deletions(-) diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c index 511f08848720..fc369c48f6df 100644 --- a/drivers/soc/qcom/socinfo.c +++ b/drivers/soc/qcom/socinfo.c @@ -34,6 +34,7 @@ #define SMEM_IMAGE_VERSION_TABLE 469 static uint32_t socinfo_format; +static const char *sku; enum { HW_PLATFORM_UNKNOWN = 0, @@ -121,6 +122,51 @@ static const char * const hw_platform_subtype[] = { [PLATFORM_SUBTYPE_INVALID] = "Invalid", }; +enum { + /* External SKU */ + SKU_UNKNOWN = 0x0, + SKU_AA = 0x1, + SKU_AB = 0x2, + SKU_AC = 0x3, + SKU_AD = 0x4, + SKU_AE = 0x5, + SKU_AF = 0x6, + SKU_EXT_RESERVE, + + /* Internal SKU */ + SKU_Y0 = 0xf1, + SKU_Y1 = 0xf2, + SKU_Y2 = 0xf3, + SKU_Y3 = 0xf4, + SKU_Y4 = 0xf5, + SKU_Y5 = 0xf6, + SKU_Y6 = 0xf7, + SKU_Y7 = 0xf8, + SKU_INT_RESERVE, +}; + +static const char * const hw_platform_esku[] = { + [SKU_UNKNOWN] = "Unknown", + [SKU_AA] = "AA", + [SKU_AB] = "AB", + [SKU_AC] = "AC", + [SKU_AD] = "AD", + [SKU_AE] = "AE", + [SKU_AF] = "AF", +}; + +#define SKU_INT_MASK 0x0f +static const char * const hw_platform_isku[] = { + [SKU_Y0 & SKU_INT_MASK] = "Y0", + [SKU_Y1 & SKU_INT_MASK] = "Y1", + [SKU_Y2 & SKU_INT_MASK] = "Y2", + [SKU_Y3 & SKU_INT_MASK] = "Y3", + [SKU_Y4 & SKU_INT_MASK] = "Y4", + [SKU_Y5 & SKU_INT_MASK] = "Y5", + [SKU_Y6 & SKU_INT_MASK] = "Y6", + [SKU_Y7 & SKU_INT_MASK] = "Y7", +}; + /* Socinfo SMEM item structure */ static struct socinfo { __le32 fmt; @@ -367,6 +413,35 @@ static uint32_t socinfo_get_nmodem_supported(void) : 0; } +/* Version 16 */ +static uint32_t socinfo_get_eskuid(void) +{ + return socinfo ? + (socinfo_format >= SOCINFO_VERSION(0, 16) ? + le32_to_cpu(socinfo->esku) : 0) + : 0; +} + +static const char *socinfo_get_esku_mapping(void) +{ + uint32_t id = socinfo_get_eskuid(); + + if (id > SKU_UNKNOWN && id < SKU_EXT_RESERVE) + return hw_platform_esku[id]; + else if (id >= SKU_Y0 && id < SKU_INT_RESERVE) + return hw_platform_isku[id & SKU_INT_MASK]; + + return NULL; +} + +static uint32_t socinfo_get_nproduct_code(void) +{ + return socinfo ? + (socinfo_format >= SOCINFO_VERSION(0, 16) ? + le32_to_cpu(socinfo->nproduct_code) : 0) + : 0; +} + /* Version 2 */ static ssize_t msm_get_raw_id(struct device *dev, @@ -617,6 +692,27 @@ msm_get_nmodem_supported(struct device *dev, } ATTR_DEFINE(nmodem_supported); +/* Version 16 */ +static ssize_t +msm_get_sku(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + return sysfs_emit(buf, "%s\n", sku ? sku : "Unknown"); +} +ATTR_DEFINE(sku); + +static ssize_t +msm_get_esku(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + const char *esku = socinfo_get_esku_mapping(); + + return sysfs_emit(buf, "%s\n", esku ? esku : "Unknown"); +} +ATTR_DEFINE(esku); + struct qcom_socinfo { struct soc_device *soc_dev; struct soc_device_attribute attr; @@ -965,6 +1061,8 @@ static void socinfo_populate_sysfs(struct qcom_socinfo *qcom_socinfo) switch (socinfo_format) { case SOCINFO_VERSION(0, 16): + msm_custom_socinfo_attrs[i++] = &dev_attr_sku.attr; + msm_custom_socinfo_attrs[i++] = &dev_attr_esku.attr; case SOCINFO_VERSION(0, 15): msm_custom_socinfo_attrs[i++] = &dev_attr_nmodem_supported.attr; case SOCINFO_VERSION(0, 14): @@ -1207,7 +1305,7 @@ static void socinfo_print(void) break; case SOCINFO_VERSION(0, 16): - pr_info("v%u.%u, id=%u, ver=%u.%u, raw_id=%u, raw_ver=%u, hw_plat=%u, hw_plat_ver=%u\n accessory_chip=%u, hw_plat_subtype=%u, pmic_model=%u, pmic_die_revision=%u foundry_id=%u serial_number=%u num_pmics=%u chip_family=0x%x raw_device_family=0x%x raw_device_number=0x%x nproduct_id=0x%x num_clusters=0x%x ncluster_array_offset=0x%x num_defective_parts=0x%x ndefective_parts_array_offset=0x%x nmodem_supported=0x%x\n", + pr_info("v%u.%u, id=%u, ver=%u.%u, raw_id=%u, raw_ver=%u, hw_plat=%u, hw_plat_ver=%u\n accessory_chip=%u, hw_plat_subtype=%u, pmic_model=%u, pmic_die_revision=%u foundry_id=%u serial_number=%u num_pmics=%u chip_family=0x%x raw_device_family=0x%x raw_device_number=0x%x nproduct_id=0x%x num_clusters=0x%x ncluster_array_offset=0x%x num_defective_parts=0x%x ndefective_parts_array_offset=0x%x nmodem_supported=0x%x sku=%s\n", f_maj, f_min, socinfo->id, v_maj, v_min, socinfo->raw_id, socinfo->raw_ver, socinfo->hw_plat, @@ -1227,7 +1325,8 @@ static void socinfo_print(void) socinfo->ncluster_array_offset, socinfo->num_defective_parts, socinfo->ndefective_parts_array_offset, - socinfo->nmodem_supported); + socinfo->nmodem_supported, + sku ? sku : "Unknown"); default: pr_err("Unknown format found: v%u.%u\n", f_maj, f_min); @@ -1266,6 +1365,7 @@ static int qcom_socinfo_probe(struct platform_device *pdev) struct qcom_socinfo *qs; struct socinfo *info; size_t item_size; + const char *machine, *esku; info = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_HW_SW_BUILD_ID, &item_size); @@ -1290,6 +1390,14 @@ static int qcom_socinfo_probe(struct platform_device *pdev) SOCINFO_MINOR(le32_to_cpu(info->ver))); qs->attr.soc_id = kasprintf(GFP_KERNEL, "%d", socinfo_get_id()); + if (socinfo_format >= SOCINFO_VERSION(0, 16)) { + machine = socinfo_machine(le32_to_cpu(info->id)); + esku = socinfo_get_esku_mapping(); + if (machine && esku) + sku = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s-%u-%s", + machine, socinfo_get_nproduct_code(), esku); + } + qsocinfo = qs; init_rwsem(&qs->current_image_rwsem); socinfo_populate_sysfs(qs); From 902e1de200b693aab422b816f655196c6db62c8b Mon Sep 17 00:00:00 2001 From: Mukesh Ojha Date: Tue, 15 Mar 2022 19:03:56 +0530 Subject: [PATCH 4/7] soc:qcom: trivial fix Missing break could lead to unnecessary warning. fix this by adding the break in the switch case. Change-Id: If2249ebf34daa25e3fc4ae9a867746a352bc7023 Signed-off-by: Mukesh Ojha Signed-off-by: Srinivasarao Pathipati --- drivers/soc/qcom/socinfo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c index fc369c48f6df..acd296faa0c4 100644 --- a/drivers/soc/qcom/socinfo.c +++ b/drivers/soc/qcom/socinfo.c @@ -1327,6 +1327,7 @@ static void socinfo_print(void) socinfo->ndefective_parts_array_offset, socinfo->nmodem_supported, sku ? sku : "Unknown"); + break; default: pr_err("Unknown format found: v%u.%u\n", f_maj, f_min); From 4c0f606a93092a7e141468ced06088ff852df44e Mon Sep 17 00:00:00 2001 From: Himansu Nayak Date: Fri, 6 Oct 2023 10:49:34 +0530 Subject: [PATCH 5/7] msm_ipa: Add flag to enable ipv6 option header Adding ipv6_option_hdr_enabled in ipa_ipgre_info structure to pass from QCMAP to ipacm. Change-Id: I4fbd0b619f018ff625709b7d777ac9e560168242 Signed-off-by: Himansu Nayak --- include/uapi/linux/msm_ipa.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/msm_ipa.h b/include/uapi/linux/msm_ipa.h index d596fc155224..3e258d6293ce 100644 --- a/include/uapi/linux/msm_ipa.h +++ b/include/uapi/linux/msm_ipa.h @@ -1808,7 +1808,10 @@ struct ipa_ipgre_info { * GRE header value. */ uint16_t gre_protocol; - uint8_t unused; /* for alignment */ + /* If v6 tunnel: option header enabled then set "true" + * If v4 tunnel: option header enabled then set "false" + */ + uint8_t ipv6_option_hdr_enabled; /* * The number of valid elements in, and the accompanying * exception_list, below From bf0f28818c4d696af8dba11297dd24d9b5faa5ad Mon Sep 17 00:00:00 2001 From: Xin Deng Date: Mon, 9 Oct 2023 16:07:25 +0800 Subject: [PATCH 6/7] nl80211: fix beacon tx rate mask validation While adding HE MCS beacon tx rate support, it is observed that legacy beacon tx rate in VHT hwsim test suite is failed. Whenever the application doesn't explicitly set VHT/MCS rate attribute in fixed rate command, by default all HE MCS masks are enabled in cfg80211. In beacon fixed rate, more than one rate mask is not allowed. Fix that by not setting all rate mask by default in case of beacon tx rate. Signed-off-by: Rajkumar Manoharan Link: https://lore.kernel.org/r/1602879327-29488-1-git-send-email-rmanohar@codeaurora.org Signed-off-by: Johannes Berg Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git Git-commit: 857b34c4fb104cecc95cd5c5fea5052628758a0f [quic_deng@quicinc.com: Make appropriate modifications to adapt kernel-5.4.] Change-Id: I85c5bd502b88ca2157fdc74e4c39de6e75580652 Signed-off-by: Xin Deng --- net/wireless/nl80211.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index b1759050b6e7..f346d40e1985 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -4408,7 +4408,8 @@ static const struct nla_policy nl80211_txattr_policy[NL80211_TXRATE_MAX + 1] = { }; static int nl80211_parse_tx_bitrate_mask(struct genl_info *info, - struct cfg80211_bitrate_mask *mask) + struct cfg80211_bitrate_mask *mask, + bool default_all_enabled) { struct nlattr *tb[NL80211_TXRATE_MAX + 1]; struct cfg80211_registered_device *rdev = info->user_ptr[0]; @@ -4420,6 +4421,9 @@ static int nl80211_parse_tx_bitrate_mask(struct genl_info *info, memset(mask, 0, sizeof(*mask)); /* Default to all rates enabled */ for (i = 0; i < NUM_NL80211_BANDS; i++) { + if (!default_all_enabled) + break; + sband = rdev->wiphy.bands[i]; if (!sband) @@ -4943,7 +4947,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) return -EINVAL; if (info->attrs[NL80211_ATTR_TX_RATES]) { - err = nl80211_parse_tx_bitrate_mask(info, ¶ms.beacon_rate); + err = nl80211_parse_tx_bitrate_mask(info, ¶ms.beacon_rate, false); if (err) return err; @@ -10725,7 +10729,7 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb, if (!rdev->ops->set_bitrate_mask) return -EOPNOTSUPP; - err = nl80211_parse_tx_bitrate_mask(info, &mask); + err = nl80211_parse_tx_bitrate_mask(info, &mask, true); if (err) return err; @@ -11321,7 +11325,7 @@ static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info) } if (info->attrs[NL80211_ATTR_TX_RATES]) { - err = nl80211_parse_tx_bitrate_mask(info, &setup.beacon_rate); + err = nl80211_parse_tx_bitrate_mask(info, &setup.beacon_rate, false); if (err) return err; From d4bb64720dff6a76cf24720d1fe6b76af6ac4f94 Mon Sep 17 00:00:00 2001 From: Mao Jinlong Date: Tue, 1 Aug 2023 15:56:25 +0800 Subject: [PATCH 7/7] coresight: Fix duplicate and abnormal stop issues of PCIE sw path Compare with sysfs buffer size instead of drvdata size to avoid the duplicate data issue. Need to compare with the actual data size as the data size could be smaller than the PCIE block size. Change-Id: I45175b57a9154cbfb96946d424b8474a6a69213f Signed-off-by: Mao Jinlong --- drivers/hwtracing/coresight/coresight-byte-cntr.c | 4 ++-- drivers/hwtracing/coresight/coresight-tmc-etr.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-byte-cntr.c b/drivers/hwtracing/coresight/coresight-byte-cntr.c index 9c500245b4e2..d85b769ea9ce 100644 --- a/drivers/hwtracing/coresight/coresight-byte-cntr.c +++ b/drivers/hwtracing/coresight/coresight-byte-cntr.c @@ -785,7 +785,7 @@ static void etr_pcie_write_work_fn(struct work_struct *work) req->snd_cmpl = 1; bytes_to_write = mhi_dev_write_channel(req); - if (bytes_to_write != PCIE_BLK_SIZE) { + if (bytes_to_write != actual) { dev_err(&tmcdrvdata->csdev->dev, "Write error %d\n", bytes_to_write); @@ -795,7 +795,7 @@ static void etr_pcie_write_work_fn(struct work_struct *work) } mutex_lock(&byte_cntr_data->byte_cntr_lock); - if (byte_cntr_data->offset + actual >= tmcdrvdata->size) + if (byte_cntr_data->offset + actual >= tmcdrvdata->sysfs_buf->size) byte_cntr_data->offset = 0; else byte_cntr_data->offset += actual; diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index 323971401cb6..d2a71501bf0d 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1171,7 +1171,8 @@ static void __tmc_etr_disable_hw(struct tmc_drvdata *drvdata) { CS_UNLOCK(drvdata->base); - tmc_flush_and_stop(drvdata); + if (drvdata->out_mode != TMC_ETR_OUT_MODE_PCIE) + tmc_flush_and_stop(drvdata); /* * When operating in sysFS mode the content of the buffer needs to be * read before the TMC is disabled.