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

Commit 05632db8 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera_v3: Add bounds checking for output resources"

parents 3f66ea56 9e33533f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -280,6 +280,7 @@ int cam_cdm_stream_ops_internal(void *hw_priv,
			ahb_vote.type = CAM_VOTE_ABSOLUTE;
			ahb_vote.vote.level = CAM_SVS_VOTE;
			axi_vote.compressed_bw = CAM_CPAS_DEFAULT_AXI_BW;
			axi_vote.compressed_bw_ab = CAM_CPAS_DEFAULT_AXI_BW;
			axi_vote.uncompressed_bw = CAM_CPAS_DEFAULT_AXI_BW;

			rc = cam_cpas_start(core->cpas_handle,
+1 −0
Original line number Diff line number Diff line
@@ -947,6 +947,7 @@ int cam_hw_cdm_probe(struct platform_device *pdev)
	ahb_vote.type = CAM_VOTE_ABSOLUTE;
	ahb_vote.vote.level = CAM_SVS_VOTE;
	axi_vote.compressed_bw = CAM_CPAS_DEFAULT_AXI_BW;
	axi_vote.compressed_bw_ab = CAM_CPAS_DEFAULT_AXI_BW;
	axi_vote.uncompressed_bw = CAM_CPAS_DEFAULT_AXI_BW;
	rc = cam_cpas_start(cdm_core->cpas_handle, &ahb_vote, &axi_vote);
	if (rc) {
+26 −14
Original line number Diff line number Diff line
@@ -620,7 +620,7 @@ static int cam_cpas_util_apply_client_axi_vote(
	struct cam_cpas_client *temp_client;
	struct cam_axi_vote req_axi_vote = *axi_vote;
	struct cam_cpas_axi_port *axi_port = cpas_client->axi_port;
	uint64_t camnoc_bw = 0, mnoc_bw = 0;
	uint64_t camnoc_bw = 0, mnoc_bw = 0, mnoc_bw_ab = 0;
	int rc = 0;

	if (!axi_port) {
@@ -632,14 +632,21 @@ static int cam_cpas_util_apply_client_axi_vote(
	 * Make sure we use same bw for both compressed, uncompressed
	 * in case client has requested either of one only
	 */
	if (req_axi_vote.compressed_bw == 0)
	if (req_axi_vote.compressed_bw == 0) {
		req_axi_vote.compressed_bw = req_axi_vote.uncompressed_bw;
		req_axi_vote.compressed_bw_ab = req_axi_vote.uncompressed_bw;
	}

	if (req_axi_vote.compressed_bw_ab == 0)
		req_axi_vote.compressed_bw_ab = req_axi_vote.compressed_bw;

	if (req_axi_vote.uncompressed_bw == 0)
		req_axi_vote.uncompressed_bw = req_axi_vote.compressed_bw;

	if ((cpas_client->axi_vote.compressed_bw ==
		req_axi_vote.compressed_bw) &&
		(cpas_client->axi_vote.compressed_bw_ab ==
		req_axi_vote.compressed_bw_ab) &&
		(cpas_client->axi_vote.uncompressed_bw ==
		req_axi_vote.uncompressed_bw))
		return 0;
@@ -651,23 +658,27 @@ static int cam_cpas_util_apply_client_axi_vote(
		&axi_port->clients_list_head, axi_sibling_client) {
		camnoc_bw += curr_client->axi_vote.uncompressed_bw;
		mnoc_bw += curr_client->axi_vote.compressed_bw;
		mnoc_bw_ab += curr_client->axi_vote.compressed_bw_ab;
	}

	if ((!soc_private->axi_camnoc_based) && (mnoc_bw < camnoc_bw))
		mnoc_bw = camnoc_bw;

	if ((!soc_private->axi_camnoc_based) && (mnoc_bw_ab < camnoc_bw))
		mnoc_bw_ab = mnoc_bw;

	axi_port->consolidated_axi_vote.compressed_bw = mnoc_bw;
	axi_port->consolidated_axi_vote.uncompressed_bw = camnoc_bw;

	CAM_DBG(CAM_CPAS,
		"axi[(%d, %d),(%d, %d)] : camnoc_bw[%llu], mnoc_bw[%llu]",
		"axi[(%d, %d),(%d, %d)] : camnoc_bw[%llu], mnoc_bw[ab: %llu, ib: %llu]",
		axi_port->mnoc_bus.src, axi_port->mnoc_bus.dst,
		axi_port->camnoc_bus.src, axi_port->camnoc_bus.dst,
		camnoc_bw, mnoc_bw);
		camnoc_bw, mnoc_bw_ab, mnoc_bw);

	if (axi_port->ib_bw_voting_needed)
		rc = cam_cpas_util_vote_bus_client_bw(&axi_port->mnoc_bus,
			mnoc_bw, mnoc_bw, false);
			mnoc_bw_ab, mnoc_bw, false);
	else
		rc = cam_cpas_util_vote_bus_client_bw(&axi_port->mnoc_bus,
			mnoc_bw, 0, false);
@@ -675,9 +686,7 @@ static int cam_cpas_util_apply_client_axi_vote(
	if (rc) {
		CAM_ERR(CAM_CPAS,
			"Failed in mnoc vote ab[%llu] ib[%llu] rc=%d",
			mnoc_bw,
			(axi_port->ib_bw_voting_needed ? mnoc_bw : 0),
			rc);
			mnoc_bw_ab, mnoc_bw, rc);
		goto unlock_axi_port;
	}

@@ -723,11 +732,13 @@ static int cam_cpas_hw_update_axi_vote(struct cam_hw_info *cpas_hw,
	axi_vote = *client_axi_vote;

	if ((axi_vote.compressed_bw == 0) &&
		(axi_vote.uncompressed_bw == 0)) {
		(axi_vote.uncompressed_bw == 0) &&
		(axi_vote.compressed_bw_ab == 0)) {
		CAM_DBG(CAM_CPAS, "0 vote from client_handle=%d",
			client_handle);
		axi_vote.compressed_bw = CAM_CPAS_DEFAULT_AXI_BW;
		axi_vote.uncompressed_bw = CAM_CPAS_DEFAULT_AXI_BW;
		axi_vote.compressed_bw_ab = CAM_CPAS_DEFAULT_AXI_BW;
	}

	if (!CAM_CPAS_CLIENT_VALID(client_indx))
@@ -746,10 +757,10 @@ static int cam_cpas_hw_update_axi_vote(struct cam_hw_info *cpas_hw,
	}

	CAM_DBG(CAM_PERF,
		"Client=[%d][%s][%d] Requested compressed[%llu], uncompressed[%llu]",
		"Client=[%d][%s][%d] Req comp[%llu], comp_ab[%llu], uncomp[%llu]",
		client_indx, cpas_client->data.identifier,
		cpas_client->data.cell_index, axi_vote.compressed_bw,
		axi_vote.uncompressed_bw);
		axi_vote.compressed_bw_ab, axi_vote.uncompressed_bw);

	rc = cam_cpas_util_apply_client_axi_vote(cpas_hw,
		cpas_core->cpas_client[client_indx], &axi_vote);
@@ -1001,11 +1012,11 @@ static int cam_cpas_hw_start(void *hw_priv, void *start_args,
	if (rc)
		goto done;

	CAM_DBG(CAM_CPAS,
		"AXI client=[%d][%s][%d] compressed_bw[%llu], uncompressed_bw[%llu]",
	CAM_INFO(CAM_CPAS,
		"AXI client=[%d][%s][%d] comp[%llu], comp_ab[%llu], uncomp[%llu]",
		client_indx, cpas_client->data.identifier,
		cpas_client->data.cell_index, axi_vote->compressed_bw,
		axi_vote->uncompressed_bw);
		axi_vote->compressed_bw_ab, axi_vote->uncompressed_bw);
	rc = cam_cpas_util_apply_client_axi_vote(cpas_hw,
		cpas_client, axi_vote);
	if (rc)
@@ -1156,6 +1167,7 @@ static int cam_cpas_hw_stop(void *hw_priv, void *stop_args,

	axi_vote.uncompressed_bw = 0;
	axi_vote.compressed_bw = 0;
	axi_vote.compressed_bw_ab = 0;
	rc = cam_cpas_util_apply_client_axi_vote(cpas_hw,
		cpas_client, &axi_vote);

+2 −1
Original line number Diff line number Diff line
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -348,6 +348,7 @@ struct cam_ahb_vote {
struct cam_axi_vote {
	uint64_t   uncompressed_bw;
	uint64_t   compressed_bw;
	uint64_t   compressed_bw_ab;
};

/**
+2 −1
Original line number Diff line number Diff line
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -151,6 +151,7 @@ int cam_fd_soc_enable_resources(struct cam_hw_soc_info *soc_info)
	ahb_vote.type = CAM_VOTE_ABSOLUTE;
	ahb_vote.vote.level = CAM_SVS_VOTE;
	axi_vote.compressed_bw = 7200000;
	axi_vote.compressed_bw_ab = 7200000;
	axi_vote.uncompressed_bw = 7200000;
	rc = cam_cpas_start(soc_private->cpas_handle, &ahb_vote, &axi_vote);
	if (rc) {
Loading