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

Commit e01a64dd authored by Gilad Broner's avatar Gilad Broner
Browse files

scsi: ufs: define cpu affinity mask for PM QoS voting



PM QoS request type PM_QOS_REQ_AFFINE_CORES specifies for which CPU
cores the voting is applied to by the cpu affinity mask.
This change defines the cpu mask to be used for the voting in the
device tree node so it can be customized for each target.

Change-Id: I004dea47b42eaf3cdf0489427b2bb894c9982f22
Signed-off-by: default avatarGilad Broner <gbroner@codeaurora.org>
parent 7c6cf2cc
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -121,6 +121,10 @@ bus vectors in the same order as qcom,msm-bus,vectors-KBps property.
  have little cluster and will update/apply the vote to all the cores in the
  little cluster.
  The default CPU affinity mode is PM_QOS_REQ_AFFINE_IRQ.
- qcom,cpu-affinity-mask: this property is taken into consideration only in case
  "affine_cores" is specified for qcom,cpu-affinity. It specifies which cores the
  PM QoS voting should apply to. In practice, for system with big / little cluster
  configuration, this should specify the cores of the little cluster.

Example:
	ufshc@0xfc598000 {
+20 −7
Original line number Diff line number Diff line
@@ -250,9 +250,10 @@ static void ufshcd_parse_pm_levels(struct ufs_hba *hba)
}

#ifdef CONFIG_SMP
static void ufshcd_parse_pm_qos(struct ufs_hba *hba)
static void ufshcd_parse_pm_qos(struct ufs_hba *hba, int irq)
{
	const char *cpu_affinity = NULL;
	u32 cpu_mask;

	hba->pm_qos.cpu_dma_latency_us = UFS_DEFAULT_CPU_DMA_LATENCY_US;
	of_property_read_u32(hba->dev->of_node, "qcom,cpu-dma-latency-us",
@@ -260,18 +261,30 @@ static void ufshcd_parse_pm_qos(struct ufs_hba *hba)
	dev_dbg(hba->dev, "cpu_dma_latency_us = %u\n",
		hba->pm_qos.cpu_dma_latency_us);

	/* Default to affine irq in case parsing fails */
	hba->pm_qos.req.type = PM_QOS_REQ_AFFINE_IRQ;
	hba->pm_qos.req.irq = irq;
	if (!of_property_read_string(hba->dev->of_node, "qcom,cpu-affinity",
		&cpu_affinity)) {
		if (!strcmp(cpu_affinity, "all_cores"))
			hba->pm_qos.req.type = PM_QOS_REQ_ALL_CORES;
		else if (!strcmp(cpu_affinity, "affine_cores"))
			/*
			 * PM_QOS_REQ_AFFINE_CORES request type is used for
			 * targets that have little cluster and will apply
			 * the vote to all the cores in the little cluster.
			 */
			if (!of_property_read_u32(hba->dev->of_node,
				"qcom,cpu-affinity-mask", &cpu_mask)) {
				hba->pm_qos.req.type = PM_QOS_REQ_AFFINE_CORES;
		else if (!strcmp(cpu_affinity, "affine_irq"))
			hba->pm_qos.req.type = PM_QOS_REQ_AFFINE_IRQ;
				/* Convert u32 to cpu bit mask */
				cpumask_bits(&hba->pm_qos.req.cpus_affine)[0] =
					cpu_mask;
			}
	dev_dbg(hba->dev, "hba->pm_qos.pm_qos_req.type = %u\n",
		hba->pm_qos.req.type);
	}

	dev_dbg(hba->dev, "hba->pm_qos.pm_qos_req.type = %u, cpu_mask=0x%lx\n",
		hba->pm_qos.req.type, hba->pm_qos.req.cpus_affine.bits[0]);
}

/**
@@ -375,7 +388,7 @@ static int ufshcd_pltfrm_probe(struct platform_device *pdev)
		goto dealloc_host;
	}

	ufshcd_parse_pm_qos(hba);
	ufshcd_parse_pm_qos(hba, irq);
	ufshcd_parse_pm_levels(hba);
	pm_runtime_set_active(&pdev->dev);
	pm_runtime_enable(&pdev->dev);
+0 −10
Original line number Diff line number Diff line
@@ -1743,16 +1743,6 @@ static void ufshcd_pm_qos_unvote_work(struct work_struct *work)

static int ufshcd_pm_qos_init(struct ufs_hba *hba)
{
	/*
	 * PM_QOS_REQ_AFFINE_CORES request type is used for targets that have
	 * little cluster and will update/apply the vote to all the cores in
	 * the little cluster.
	 */
	if (hba->pm_qos.req.type == PM_QOS_REQ_AFFINE_CORES)
		hba->pm_qos.req.cpus_affine.bits[0] = 0x0F;
	else if (hba->pm_qos.req.type == PM_QOS_REQ_AFFINE_IRQ)
		hba->pm_qos.req.irq = hba->irq;

	if (hba->pm_qos.cpu_dma_latency_us)
		pm_qos_add_request(&hba->pm_qos.req,
			PM_QOS_CPU_DMA_LATENCY, hba->pm_qos.cpu_dma_latency_us);