Merge tag 'LA.UM.9.12.r1-18100-SMxx50.QSSI14.0' of https://git.codelinaro.org/clo/la/kernel/msm-4.19 into android13-4.19-kona
"LA.UM.9.12.r1-18100-SMxx50.QSSI14.0" * tag 'LA.UM.9.12.r1-18100-SMxx50.QSSI14.0' of https://git.codelinaro.org/clo/la/kernel/msm-4.19: msm: kgsl: Do not release dma and anon buffers if unmap fails mmc: sdhci-msm: Reset GCC_SDCC_BCR register for SDHC usb: phy: Enable clock before accessing EUD register space loop: Select I/O scheduler 'none' from inside add_disk() BACKPORT: loop: Fix missing discard support when using LOOP_CONFIGURE UPSTREAM: loop: unset GENHD_FL_NO_PART_SCAN on LOOP_CONFIGURE loop: Check for overflow while configuring loop BACKPORT: loop: Set correct device size when using LOOP_CONFIGURE cnss2: Add support for configuring calibration duration block: delete part_round_stats and switch to less precise counting BACKPORT: media: venus: hfi_parser: Add check for number of codecs BACKPORT: media: venus: hfi: add checks in capabilities from firmware BACKPORT: media: venus: hfi: fix the check in session buffer requirement BACKPORT: media: venus: hfi: add checks to perform sanity on queue pointers vidc_3x: venc: Add missing level in h263 msm: kgsl: Do not free sharedmem if it cannot be unmapped vidc_3x: Return EBUSY if mbpf check fails soc: qcom: qmi_encdec: out of bound check for input buffer Conflicts: drivers/media/platform/qcom/venus/hfi_parser.c drivers/media/platform/qcom/venus/hfi_venus.c Change-Id: I79781403e7d2e6417196eda9f67015c998d1e8d4
This commit is contained in:
33
block/bio.c
33
block/bio.c
@@ -1672,13 +1672,33 @@ void bio_check_pages_dirty(struct bio *bio)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(bio_check_pages_dirty);
|
||||
|
||||
void update_io_ticks(struct hd_struct *part, unsigned long now)
|
||||
{
|
||||
unsigned long stamp;
|
||||
int cpu;
|
||||
again:
|
||||
stamp = READ_ONCE(part->stamp);
|
||||
if (unlikely(stamp != now)) {
|
||||
if (likely(cmpxchg(&part->stamp, stamp, now) == stamp)) {
|
||||
cpu = part_stat_lock();
|
||||
__part_stat_add(cpu, part, io_ticks, 1);
|
||||
part_stat_unlock();
|
||||
}
|
||||
}
|
||||
if (part->partno) {
|
||||
part = &part_to_disk(part)->part0;
|
||||
goto again;
|
||||
}
|
||||
}
|
||||
|
||||
void generic_start_io_acct(struct request_queue *q, int op,
|
||||
unsigned long sectors, struct hd_struct *part)
|
||||
{
|
||||
const int sgrp = op_stat_group(op);
|
||||
int cpu = part_stat_lock();
|
||||
int cpu;
|
||||
|
||||
part_round_stats(q, cpu, part);
|
||||
cpu = part_stat_lock();
|
||||
update_io_ticks(part, jiffies);
|
||||
part_stat_inc(cpu, part, ios[sgrp]);
|
||||
part_stat_add(cpu, part, sectors[sgrp], sectors);
|
||||
part_inc_in_flight(q, part, op_is_write(op));
|
||||
@@ -1690,12 +1710,15 @@ EXPORT_SYMBOL(generic_start_io_acct);
|
||||
void generic_end_io_acct(struct request_queue *q, int req_op,
|
||||
struct hd_struct *part, unsigned long start_time)
|
||||
{
|
||||
unsigned long duration = jiffies - start_time;
|
||||
unsigned long now = jiffies;
|
||||
unsigned long duration = now - start_time;
|
||||
const int sgrp = op_stat_group(req_op);
|
||||
int cpu = part_stat_lock();
|
||||
int cpu;
|
||||
|
||||
cpu = part_stat_lock();
|
||||
update_io_ticks(part, now);
|
||||
part_stat_add(cpu, part, nsecs[sgrp], jiffies_to_nsecs(duration));
|
||||
part_round_stats(q, cpu, part);
|
||||
part_stat_add(cpu, part, time_in_queue, duration);
|
||||
part_dec_in_flight(q, part, op_is_write(req_op));
|
||||
|
||||
part_stat_unlock();
|
||||
|
||||
@@ -1681,63 +1681,6 @@ static void add_acct_request(struct request_queue *q, struct request *rq,
|
||||
__elv_add_request(q, rq, where);
|
||||
}
|
||||
|
||||
static void part_round_stats_single(struct request_queue *q, int cpu,
|
||||
struct hd_struct *part, unsigned long now,
|
||||
unsigned int inflight)
|
||||
{
|
||||
if (inflight) {
|
||||
__part_stat_add(cpu, part, time_in_queue,
|
||||
inflight * (now - part->stamp));
|
||||
__part_stat_add(cpu, part, io_ticks, (now - part->stamp));
|
||||
}
|
||||
part->stamp = now;
|
||||
}
|
||||
|
||||
/**
|
||||
* part_round_stats() - Round off the performance stats on a struct disk_stats.
|
||||
* @q: target block queue
|
||||
* @cpu: cpu number for stats access
|
||||
* @part: target partition
|
||||
*
|
||||
* The average IO queue length and utilisation statistics are maintained
|
||||
* by observing the current state of the queue length and the amount of
|
||||
* time it has been in this state for.
|
||||
*
|
||||
* Normally, that accounting is done on IO completion, but that can result
|
||||
* in more than a second's worth of IO being accounted for within any one
|
||||
* second, leading to >100% utilisation. To deal with that, we call this
|
||||
* function to do a round-off before returning the results when reading
|
||||
* /proc/diskstats. This accounts immediately for all queue usage up to
|
||||
* the current jiffies and restarts the counters again.
|
||||
*/
|
||||
void part_round_stats(struct request_queue *q, int cpu, struct hd_struct *part)
|
||||
{
|
||||
struct hd_struct *part2 = NULL;
|
||||
unsigned long now = jiffies;
|
||||
unsigned int inflight[2];
|
||||
int stats = 0;
|
||||
|
||||
if (part->stamp != now)
|
||||
stats |= 1;
|
||||
|
||||
if (part->partno) {
|
||||
part2 = &part_to_disk(part)->part0;
|
||||
if (part2->stamp != now)
|
||||
stats |= 2;
|
||||
}
|
||||
|
||||
if (!stats)
|
||||
return;
|
||||
|
||||
part_in_flight(q, part, inflight);
|
||||
|
||||
if (stats & 2)
|
||||
part_round_stats_single(q, cpu, part2, now, inflight[1]);
|
||||
if (stats & 1)
|
||||
part_round_stats_single(q, cpu, part, now, inflight[0]);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(part_round_stats);
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static void blk_pm_put_request(struct request *rq)
|
||||
{
|
||||
@@ -2775,9 +2718,10 @@ void blk_account_io_done(struct request *req, u64 now)
|
||||
cpu = part_stat_lock();
|
||||
part = req->part;
|
||||
|
||||
update_io_ticks(part, jiffies);
|
||||
part_stat_inc(cpu, part, ios[sgrp]);
|
||||
part_stat_add(cpu, part, nsecs[sgrp], now - req->start_time_ns);
|
||||
part_round_stats(req->q, cpu, part);
|
||||
part_stat_add(cpu, part, time_in_queue, nsecs_to_jiffies64(now - req->start_time_ns));
|
||||
part_dec_in_flight(req->q, part, rq_data_dir(req));
|
||||
|
||||
hd_struct_put(part);
|
||||
@@ -2837,11 +2781,12 @@ void blk_account_io_start(struct request *rq, bool new_io)
|
||||
part = &rq->rq_disk->part0;
|
||||
hd_struct_get(part);
|
||||
}
|
||||
part_round_stats(rq->q, cpu, part);
|
||||
part_inc_in_flight(rq->q, part, rw);
|
||||
rq->part = part;
|
||||
}
|
||||
|
||||
update_io_ticks(part, jiffies);
|
||||
|
||||
part_stat_unlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -673,7 +673,6 @@ static void blk_account_io_merge(struct request *req)
|
||||
cpu = part_stat_lock();
|
||||
part = req->part;
|
||||
|
||||
part_round_stats(req->q, cpu, part);
|
||||
part_dec_in_flight(req->q, part, rq_data_dir(req));
|
||||
|
||||
hd_struct_put(part);
|
||||
|
||||
@@ -1339,7 +1339,6 @@ static int diskstats_show(struct seq_file *seqf, void *v)
|
||||
struct hd_struct *hd;
|
||||
char buf[BDEVNAME_SIZE];
|
||||
unsigned int inflight[2];
|
||||
int cpu;
|
||||
|
||||
/*
|
||||
if (&disk_to_dev(gp)->kobj.entry == block_class.devices.next)
|
||||
@@ -1351,9 +1350,6 @@ static int diskstats_show(struct seq_file *seqf, void *v)
|
||||
|
||||
disk_part_iter_init(&piter, gp, DISK_PITER_INCL_EMPTY_PART0);
|
||||
while ((hd = disk_part_iter_next(&piter))) {
|
||||
cpu = part_stat_lock();
|
||||
part_round_stats(gp->queue, cpu, hd);
|
||||
part_stat_unlock();
|
||||
part_in_flight(gp->queue, hd, inflight);
|
||||
seq_printf(seqf, "%4d %7d %s "
|
||||
"%lu %lu %lu %u "
|
||||
|
||||
@@ -121,11 +121,7 @@ ssize_t part_stat_show(struct device *dev,
|
||||
struct hd_struct *p = dev_to_part(dev);
|
||||
struct request_queue *q = part_to_disk(p)->queue;
|
||||
unsigned int inflight[2];
|
||||
int cpu;
|
||||
|
||||
cpu = part_stat_lock();
|
||||
part_round_stats(q, cpu, p);
|
||||
part_stat_unlock();
|
||||
part_in_flight(q, p, inflight);
|
||||
return sprintf(buf,
|
||||
"%8lu %8lu %8llu %8u "
|
||||
|
||||
@@ -300,6 +300,9 @@ static void kgsl_destroy_ion(struct kgsl_memdesc *memdesc)
|
||||
struct kgsl_mem_entry, memdesc);
|
||||
struct kgsl_dma_buf_meta *meta = entry->priv_data;
|
||||
|
||||
if (memdesc->priv & KGSL_MEMDESC_MAPPED)
|
||||
return;
|
||||
|
||||
if (meta != NULL) {
|
||||
remove_dmabuf_list(meta);
|
||||
dma_buf_unmap_attachment(meta->attach, meta->table,
|
||||
@@ -328,6 +331,9 @@ static void kgsl_destroy_anon(struct kgsl_memdesc *memdesc)
|
||||
struct scatterlist *sg;
|
||||
struct page *page;
|
||||
|
||||
if (memdesc->priv & KGSL_MEMDESC_MAPPED)
|
||||
return;
|
||||
|
||||
for_each_sg(memdesc->sgt->sgl, sg, memdesc->sgt->nents, i) {
|
||||
page = sg_page(sg);
|
||||
for (j = 0; j < (sg->length >> PAGE_SHIFT); j++) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2002,2007-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/slab.h>
|
||||
@@ -492,6 +492,8 @@ kgsl_mmu_unmap(struct kgsl_pagetable *pagetable,
|
||||
size = kgsl_memdesc_footprint(memdesc);
|
||||
|
||||
ret = pagetable->pt_ops->mmu_unmap(pagetable, memdesc);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
atomic_dec(&pagetable->stats.entries);
|
||||
atomic_long_sub(size, &pagetable->stats.mapped);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2002,2007-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <asm/cacheflush.h>
|
||||
@@ -595,6 +595,9 @@ static int kgsl_unlock_sgt(struct sg_table *sgt)
|
||||
|
||||
static void kgsl_page_alloc_free(struct kgsl_memdesc *memdesc)
|
||||
{
|
||||
if (memdesc->priv & KGSL_MEMDESC_MAPPED)
|
||||
return;
|
||||
|
||||
kgsl_page_alloc_unmap_kernel(memdesc);
|
||||
/* we certainly do not expect the hostptr to still be mapped */
|
||||
BUG_ON(memdesc->hostptr);
|
||||
@@ -695,6 +698,9 @@ static void kgsl_cma_coherent_free(struct kgsl_memdesc *memdesc)
|
||||
{
|
||||
unsigned long attrs = 0;
|
||||
|
||||
if (memdesc->priv & KGSL_MEMDESC_MAPPED)
|
||||
return;
|
||||
|
||||
if (memdesc->hostptr) {
|
||||
if (memdesc->priv & KGSL_MEMDESC_SECURE) {
|
||||
atomic_long_sub(memdesc->size,
|
||||
|
||||
@@ -387,6 +387,7 @@ static struct msm_vidc_ctrl msm_venc_ctrls[] = {
|
||||
(1 << V4L2_MPEG_VIDC_VIDEO_H263_LEVEL_2_0) |
|
||||
(1 << V4L2_MPEG_VIDC_VIDEO_H263_LEVEL_3_0) |
|
||||
(1 << V4L2_MPEG_VIDC_VIDEO_H263_LEVEL_4_0) |
|
||||
(1 << V4L2_MPEG_VIDC_VIDEO_H263_LEVEL_4_5) |
|
||||
(1 << V4L2_MPEG_VIDC_VIDEO_H263_LEVEL_5_0) |
|
||||
(1 << V4L2_MPEG_VIDC_VIDEO_H263_LEVEL_6_0) |
|
||||
(1 << V4L2_MPEG_VIDC_VIDEO_H263_LEVEL_7_0)
|
||||
|
||||
@@ -5056,7 +5056,7 @@ static int msm_vidc_check_mbpf_supported(struct msm_vidc_inst *inst)
|
||||
mutex_unlock(&core->lock);
|
||||
if (mbpf > 2*capability->mbs_per_frame.max) {
|
||||
msm_vidc_print_running_insts(inst->core);
|
||||
return -ENOMEM;
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -19,7 +19,8 @@ static void init_codecs(struct venus_core *core)
|
||||
struct venus_caps *caps = core->caps, *cap;
|
||||
unsigned long bit;
|
||||
|
||||
if (hweight_long(core->dec_codecs) + hweight_long(core->enc_codecs) > MAX_CODEC_NUM)
|
||||
if (hweight_long(core->dec_codecs) +
|
||||
hweight_long(core->enc_codecs) > MAX_CODEC_NUM)
|
||||
return;
|
||||
|
||||
for_each_set_bit(bit, &core->dec_codecs, MAX_CODEC_NUM) {
|
||||
|
||||
@@ -222,7 +222,8 @@ static int venus_write_queue(struct venus_hfi_device *hdev,
|
||||
wr_ptr = (u32 *)(queue->qmem.kva + (wr_idx << 2));
|
||||
|
||||
if (wr_ptr < (u32 *)queue->qmem.kva ||
|
||||
wr_ptr > (u32 *)(queue->qmem.kva + queue->qmem.size - sizeof(*wr_ptr)))
|
||||
wr_ptr > (u32 *)(queue->qmem.kva +
|
||||
queue->qmem.size - sizeof(*wr_ptr)))
|
||||
return -EINVAL;
|
||||
|
||||
if (new_wr_idx < qsize) {
|
||||
@@ -294,7 +295,8 @@ static int venus_read_queue(struct venus_hfi_device *hdev,
|
||||
rd_ptr = (u32 *)(queue->qmem.kva + (rd_idx << 2));
|
||||
|
||||
if (rd_ptr < (u32 *)queue->qmem.kva ||
|
||||
rd_ptr > (u32 *)(queue->qmem.kva + queue->qmem.size - sizeof(*rd_ptr)))
|
||||
rd_ptr > (u32 *)(queue->qmem.kva +
|
||||
queue->qmem.size - sizeof(*rd_ptr)))
|
||||
return -EINVAL;
|
||||
|
||||
dwords = *rd_ptr >> 2;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*
|
||||
* drivers/mmc/host/sdhci-msm.c - Qualcomm Technologies, Inc. MSM SDHCI Platform
|
||||
* driver source file
|
||||
@@ -5042,6 +5042,44 @@ static int sdhci_msm_notify_load(struct sdhci_host *host, enum mmc_load state)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sdhci_msm_gcc_reset(struct device *dev, struct sdhci_host *host)
|
||||
{
|
||||
|
||||
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
|
||||
struct sdhci_msm_host *msm_host = pltfm_host->priv;
|
||||
struct reset_control *reset = msm_host->core_reset;
|
||||
int ret = -EOPNOTSUPP;
|
||||
|
||||
if (!reset) {
|
||||
dev_err(dev, "unable to acquire core_reset\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = reset_control_assert(reset);
|
||||
if (ret) {
|
||||
dev_err(dev, "core_reset assert failed %d\n", ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* The hardware requirement for delay between assert/deassert
|
||||
* is at least 3-4 sleep clock (32.7KHz) cycles, which comes to
|
||||
* ~125us (4/32768). To be on the safe side add 200us delay.
|
||||
*/
|
||||
usleep_range(200, 210);
|
||||
|
||||
ret = reset_control_deassert(reset);
|
||||
if (ret) {
|
||||
dev_err(dev, "core_reset deassert failed %d\n", ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
usleep_range(200, 210);
|
||||
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void sdhci_msm_hw_reset(struct sdhci_host *host)
|
||||
{
|
||||
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
|
||||
@@ -5063,28 +5101,10 @@ static void sdhci_msm_hw_reset(struct sdhci_host *host)
|
||||
host->mmc->cqe_enabled = false;
|
||||
}
|
||||
|
||||
ret = reset_control_assert(msm_host->core_reset);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "%s: core_reset assert failed, err = %d\n",
|
||||
__func__, ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* The hardware requirement for delay between assert/deassert
|
||||
* is at least 3-4 sleep clock (32.7KHz) cycles, which comes to
|
||||
* ~125us (4/32768). To be on the safe side add 200us delay.
|
||||
*/
|
||||
usleep_range(200, 210);
|
||||
|
||||
ret = reset_control_deassert(msm_host->core_reset);
|
||||
if (ret)
|
||||
dev_err(&pdev->dev, "%s: core_reset deassert failed, err = %d\n",
|
||||
__func__, ret);
|
||||
|
||||
sdhci_msm_gcc_reset(&pdev->dev, host);
|
||||
sdhci_msm_registers_restore(host);
|
||||
msm_host->reg_store = false;
|
||||
out:
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -5411,6 +5431,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)
|
||||
goto pltfm_free;
|
||||
}
|
||||
|
||||
sdhci_msm_gcc_reset(&pdev->dev, host);
|
||||
/* Setup Clocks */
|
||||
|
||||
/* Setup SDCC bus voter clock. */
|
||||
|
||||
@@ -2665,6 +2665,13 @@ cnss_use_nv_mac(struct cnss_plat_data *plat_priv)
|
||||
"use-nv-mac");
|
||||
}
|
||||
|
||||
static inline int cnss_get_cal_duration(struct cnss_plat_data *plat_priv)
|
||||
{
|
||||
return of_property_read_u32(plat_priv->plat_dev->dev.of_node,
|
||||
"qcom,cnss-cal-duration",
|
||||
&plat_priv->cal_duration);
|
||||
}
|
||||
|
||||
static int cnss_probe(struct platform_device *plat_dev)
|
||||
{
|
||||
int ret = 0;
|
||||
@@ -2698,6 +2705,9 @@ static int cnss_probe(struct platform_device *plat_dev)
|
||||
plat_priv->device_id = device_id->driver_data;
|
||||
plat_priv->bus_type = cnss_get_bus_type(plat_priv->device_id);
|
||||
plat_priv->use_nv_mac = cnss_use_nv_mac(plat_priv);
|
||||
if (cnss_get_cal_duration(plat_priv) != 0)
|
||||
plat_priv->cal_duration = CNSS_INVALID_CAL_DURATION;
|
||||
|
||||
plat_priv->use_fw_path_with_prefix =
|
||||
cnss_use_fw_path_with_prefix(plat_priv);
|
||||
cnss_set_plat_priv(plat_dev, plat_priv);
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#define CNSS_RAMDUMP_MAGIC 0x574C414E
|
||||
#define CNSS_RAMDUMP_VERSION 0
|
||||
#define MAX_FIRMWARE_NAME_LEN 20
|
||||
#define CNSS_INVALID_CAL_DURATION 0xFFFFFFFF
|
||||
|
||||
#define CNSS_EVENT_SYNC BIT(0)
|
||||
#define CNSS_EVENT_UNINTERRUPTIBLE BIT(1)
|
||||
@@ -397,6 +398,7 @@ struct cnss_plat_data {
|
||||
u32 diag_reg_read_len;
|
||||
u8 *diag_reg_read_buf;
|
||||
u8 cal_done;
|
||||
u32 cal_duration;
|
||||
u8 powered_on;
|
||||
u8 use_fw_path_with_prefix;
|
||||
char firmware_name[MAX_FIRMWARE_NAME_LEN];
|
||||
|
||||
@@ -228,6 +228,15 @@ static int cnss_wlfw_host_cap_send_sync(struct cnss_plat_data *plat_priv)
|
||||
req->cal_done = plat_priv->cal_done;
|
||||
cnss_pr_dbg("Calibration done is %d\n", plat_priv->cal_done);
|
||||
|
||||
if (plat_priv->cal_duration != CNSS_INVALID_CAL_DURATION) {
|
||||
req->cal_duration_valid = 1;
|
||||
req->cal_duration = plat_priv->cal_duration;
|
||||
cnss_pr_dbg("Calibration duration: %u",
|
||||
plat_priv->cal_duration);
|
||||
} else {
|
||||
cnss_pr_dbg("Calibration duration not valid");
|
||||
}
|
||||
|
||||
if (!cnss_bus_get_iova(plat_priv, &iova_start, &iova_size) &&
|
||||
!cnss_bus_get_iova_ipa(plat_priv, &iova_ipa_start,
|
||||
&iova_ipa_size)) {
|
||||
|
||||
@@ -427,6 +427,7 @@ static int qmi_encode(struct qmi_elem_info *ei_array, void *out_buf,
|
||||
* @buf_src: Buffer containing the elements in QMI wire format.
|
||||
* @elem_len: Number of elements to be decoded.
|
||||
* @elem_size: Size of a single instance of the element to be decoded.
|
||||
* @src_len: Source buffer length.
|
||||
*
|
||||
* This function decodes the "elem_len" number of elements in QMI wire format,
|
||||
* each of size "elem_size" bytes from the source buffer "buf_src" and stores
|
||||
@@ -437,10 +438,13 @@ static int qmi_encode(struct qmi_elem_info *ei_array, void *out_buf,
|
||||
* Return: The total size of the decoded data elements, in bytes.
|
||||
*/
|
||||
static int qmi_decode_basic_elem(void *buf_dst, const void *buf_src,
|
||||
u32 elem_len, u32 elem_size)
|
||||
u32 elem_len, u32 elem_size, u32 src_len)
|
||||
{
|
||||
u32 i, rc = 0;
|
||||
|
||||
if (elem_len * elem_size > src_len)
|
||||
return -EINVAL;
|
||||
|
||||
for (i = 0; i < elem_len; i++) {
|
||||
QMI_ENCDEC_DECODE_N_BYTES(buf_dst, buf_src, elem_size);
|
||||
rc += elem_size;
|
||||
@@ -458,6 +462,7 @@ static int qmi_decode_basic_elem(void *buf_dst, const void *buf_src,
|
||||
* @tlv_len: Total size of the encoded inforation corresponding to
|
||||
* this struct element.
|
||||
* @dec_level: Depth of the nested structure from the main structure.
|
||||
* @src_len: Source buffer length.
|
||||
*
|
||||
* This function decodes the "elem_len" number of elements in QMI wire format,
|
||||
* each of size "(tlv_len/elem_len)" bytes from the source buffer "buf_src"
|
||||
@@ -471,16 +476,20 @@ static int qmi_decode_basic_elem(void *buf_dst, const void *buf_src,
|
||||
static int qmi_decode_struct_elem(struct qmi_elem_info *ei_array,
|
||||
void *buf_dst, const void *buf_src,
|
||||
u32 elem_len, u32 tlv_len,
|
||||
int dec_level)
|
||||
int dec_level, u32 src_len)
|
||||
{
|
||||
int i, rc, decoded_bytes = 0;
|
||||
struct qmi_elem_info *temp_ei = ei_array;
|
||||
|
||||
if (tlv_len > src_len)
|
||||
return -EINVAL;
|
||||
|
||||
for (i = 0; i < elem_len && decoded_bytes < tlv_len; i++) {
|
||||
rc = qmi_decode(temp_ei->ei_array, buf_dst, buf_src,
|
||||
tlv_len - decoded_bytes, dec_level);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
buf_src = buf_src + rc;
|
||||
buf_dst = buf_dst + temp_ei->elem_size;
|
||||
decoded_bytes += rc;
|
||||
@@ -505,6 +514,7 @@ static int qmi_decode_struct_elem(struct qmi_elem_info *ei_array,
|
||||
* @tlv_len: Total size of the encoded inforation corresponding to
|
||||
* this string element.
|
||||
* @dec_level: Depth of the string element from the main structure.
|
||||
* @src_len: Source buffer length.
|
||||
*
|
||||
* This function decodes the string element of maximum length
|
||||
* "ei_array->elem_len" from the source buffer "buf_src" and puts it into
|
||||
@@ -516,7 +526,7 @@ static int qmi_decode_struct_elem(struct qmi_elem_info *ei_array,
|
||||
*/
|
||||
static int qmi_decode_string_elem(struct qmi_elem_info *ei_array,
|
||||
void *buf_dst, const void *buf_src,
|
||||
u32 tlv_len, int dec_level)
|
||||
u32 tlv_len, int dec_level, u32 src_len)
|
||||
{
|
||||
int rc;
|
||||
int decoded_bytes = 0;
|
||||
@@ -530,7 +540,10 @@ static int qmi_decode_string_elem(struct qmi_elem_info *ei_array,
|
||||
string_len_sz = temp_ei->elem_len <= U8_MAX ?
|
||||
sizeof(u8) : sizeof(u16);
|
||||
rc = qmi_decode_basic_elem(&string_len, buf_src,
|
||||
1, string_len_sz);
|
||||
1, string_len_sz, src_len);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
decoded_bytes += rc;
|
||||
}
|
||||
|
||||
@@ -545,7 +558,11 @@ static int qmi_decode_string_elem(struct qmi_elem_info *ei_array,
|
||||
}
|
||||
|
||||
rc = qmi_decode_basic_elem(buf_dst, buf_src + decoded_bytes,
|
||||
string_len, temp_ei->elem_size);
|
||||
string_len, temp_ei->elem_size,
|
||||
src_len - decoded_bytes);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
*((char *)buf_dst + string_len) = '\0';
|
||||
decoded_bytes += rc;
|
||||
|
||||
@@ -611,6 +628,10 @@ static int qmi_decode(struct qmi_elem_info *ei_array, void *out_c_struct,
|
||||
|
||||
if (dec_level == 1) {
|
||||
tlv_pointer = buf_src;
|
||||
if (decoded_bytes + TLV_TYPE_SIZE + TLV_LEN_SIZE >
|
||||
in_buf_len)
|
||||
return -EINVAL;
|
||||
|
||||
QMI_ENCDEC_DECODE_TLV(&tlv_type,
|
||||
&tlv_len, tlv_pointer);
|
||||
buf_src += (TLV_TYPE_SIZE + TLV_LEN_SIZE);
|
||||
@@ -643,7 +664,11 @@ static int qmi_decode(struct qmi_elem_info *ei_array, void *out_c_struct,
|
||||
data_len_sz = temp_ei->elem_size == sizeof(u8) ?
|
||||
sizeof(u8) : sizeof(u16);
|
||||
rc = qmi_decode_basic_elem(&data_len_value, buf_src,
|
||||
1, data_len_sz);
|
||||
1, data_len_sz,
|
||||
in_buf_len - decoded_bytes);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
memcpy(buf_dst, &data_len_value, sizeof(u32));
|
||||
temp_ei = temp_ei + 1;
|
||||
buf_dst = out_c_struct + temp_ei->offset;
|
||||
@@ -670,24 +695,32 @@ static int qmi_decode(struct qmi_elem_info *ei_array, void *out_c_struct,
|
||||
case QMI_SIGNED_4_BYTE_ENUM:
|
||||
rc = qmi_decode_basic_elem(buf_dst, buf_src,
|
||||
data_len_value,
|
||||
temp_ei->elem_size);
|
||||
temp_ei->elem_size,
|
||||
in_buf_len - decoded_bytes);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
UPDATE_DECODE_VARIABLES(buf_src, decoded_bytes, rc);
|
||||
break;
|
||||
|
||||
case QMI_STRUCT:
|
||||
rc = qmi_decode_struct_elem(temp_ei, buf_dst, buf_src,
|
||||
data_len_value, tlv_len,
|
||||
dec_level + 1);
|
||||
dec_level + 1,
|
||||
in_buf_len - decoded_bytes);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
UPDATE_DECODE_VARIABLES(buf_src, decoded_bytes, rc);
|
||||
break;
|
||||
|
||||
case QMI_STRING:
|
||||
rc = qmi_decode_string_elem(temp_ei, buf_dst, buf_src,
|
||||
tlv_len, dec_level);
|
||||
tlv_len, dec_level,
|
||||
in_buf_len - decoded_bytes);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
UPDATE_DECODE_VARIABLES(buf_src, decoded_bytes, rc);
|
||||
break;
|
||||
|
||||
|
||||
@@ -598,9 +598,10 @@ static int msm_hsphy_dpdm_regulator_enable(struct regulator_dev *rdev)
|
||||
dev_dbg(phy->phy.dev, "%s dpdm_enable:%d\n",
|
||||
__func__, phy->dpdm_enable);
|
||||
|
||||
msm_hsphy_enable_clocks(phy, true);
|
||||
if (phy->eud_enable_reg && readl_relaxed(phy->eud_enable_reg)) {
|
||||
dev_err(phy->phy.dev, "eud is enabled\n");
|
||||
return 0;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
mutex_lock(&phy->phy_lock);
|
||||
@@ -608,11 +609,9 @@ static int msm_hsphy_dpdm_regulator_enable(struct regulator_dev *rdev)
|
||||
ret = msm_hsphy_enable_power(phy, true);
|
||||
if (ret) {
|
||||
mutex_unlock(&phy->phy_lock);
|
||||
return ret;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
msm_hsphy_enable_clocks(phy, true);
|
||||
|
||||
msm_hsphy_reset(phy);
|
||||
|
||||
/*
|
||||
@@ -628,11 +627,11 @@ static int msm_hsphy_dpdm_regulator_enable(struct regulator_dev *rdev)
|
||||
UTMI_PHY_DATAPATH_CTRL_OVERRIDE_EN,
|
||||
UTMI_PHY_DATAPATH_CTRL_OVERRIDE_EN);
|
||||
|
||||
msm_hsphy_enable_clocks(phy, false);
|
||||
phy->dpdm_enable = true;
|
||||
}
|
||||
mutex_unlock(&phy->phy_lock);
|
||||
|
||||
exit:
|
||||
msm_hsphy_enable_clocks(phy, false);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -413,8 +413,7 @@ static inline void free_part_info(struct hd_struct *part)
|
||||
kfree(part->info);
|
||||
}
|
||||
|
||||
/* block/blk-core.c */
|
||||
extern void part_round_stats(struct request_queue *q, int cpu, struct hd_struct *part);
|
||||
void update_io_ticks(struct hd_struct *part, unsigned long now);
|
||||
|
||||
/* block/genhd.c */
|
||||
extern void device_add_disk(struct device *parent, struct gendisk *disk);
|
||||
|
||||
Reference in New Issue
Block a user