From nobody Wed Nov 27 15:45:18 2024 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 99ECD1C243D for ; Thu, 10 Oct 2024 10:23:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728555815; cv=none; b=Uqm6nBAA9qYxEbbLW7hsZXzXH0QAXqZtmxKoPo2UUqJfB2622LUImUv0LfbeGuQD2x1zpoXgyZgjyXfpanPVNkcFzX1nFno8cKymeFcyc24rxMSi7pa7ar25HGKEV5UVQJtjseZY1YI5pZSgQdGRTqswfAoBbIwO3vemMc4Yn4Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728555815; c=relaxed/simple; bh=s/1gGhbnt50tcEUMLNEZ7eg+4hprLgeErANYEfXxqho=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=d2zW3X9SZJqcgwKU5fPfAIExQIOb2C7mdrhxoVUzhkerc+ZsGQjv2TAF2mOJlK4dTctYHr+XN/P4Jcx7N1Ote+ETYgDyGMNb2Sc8myitnWI1KY5oqJJqgxfboURPbtzoUR6N/dOLivdoraNF0ml3i5sjQfV0yuQ0FWhj+udJwkQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=FhXyedf7; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="FhXyedf7" Received: from umang.jain (unknown [IPv6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5F06F1648; Thu, 10 Oct 2024 12:21:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728555709; bh=s/1gGhbnt50tcEUMLNEZ7eg+4hprLgeErANYEfXxqho=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FhXyedf7uq/9gqlzV1eYj7ouAG0A7n/jKnsL2qcZJ0hTaRf7ld7GFB3P/+YjJfZYL KuN1W7kiWh5MU/eRpio4YTouFUY7nEK4I/EpAYTqoUS0NqSO0RYjyl0Cg8T/FkPc3U LJtWLgo2P4yoilFtgF1lJcF2eN0MNgxln15CPapg= From: Umang Jain To: Greg Kroah-Hartman , Broadcom internal kernel review list Cc: linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Kieran Bingham , Dan Carpenter , Stefan Wahren , Laurent Pinchart , Umang Jain Subject: [PATCH 5/5] staging: vchiq_core: Locally cache cache_line_size information Date: Thu, 10 Oct 2024 15:52:49 +0530 Message-ID: <20241010102250.236545-6-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241010102250.236545-1-umang.jain@ideasonboard.com> References: <20241010102250.236545-1-umang.jain@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Locally cache 'cache_line_size' information in a variable instead of repeatedly accessing it from drv_mgmt->info. This helps to reflow lines under 80 columns. No functional change intended in this patch. Signed-off-by: Umang Jain Reviewed-by: Stefan Wahren --- .../interface/vchiq_arm/vchiq_core.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c= b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index d03b67f9cdb7..19c24dd9d1b3 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -1516,6 +1516,7 @@ create_pagelist(struct vchiq_instance *instance, char= *buf, char __user *ubuf, size_t pagelist_size; struct scatterlist *scatterlist, *sg; int dma_buffers; + unsigned int cache_line_size; dma_addr_t dma_addr; =20 if (count >=3D INT_MAX - PAGE_SIZE) @@ -1666,10 +1667,10 @@ create_pagelist(struct vchiq_instance *instance, ch= ar *buf, char __user *ubuf, } =20 /* Partial cache lines (fragments) require special measures */ + cache_line_size =3D drv_mgmt->info->cache_line_size; if ((type =3D=3D PAGELIST_READ) && - ((pagelist->offset & (drv_mgmt->info->cache_line_size - 1)) || - ((pagelist->offset + pagelist->length) & - (drv_mgmt->info->cache_line_size - 1)))) { + ((pagelist->offset & (cache_line_size - 1)) || + ((pagelist->offset + pagelist->length) & (cache_line_size - 1)))) { char *fragments; =20 if (down_interruptible(&drv_mgmt->free_fragments_sema)) { @@ -1699,6 +1700,7 @@ free_pagelist(struct vchiq_instance *instance, struct pagelist *pagelist =3D pagelistinfo->pagelist; struct page **pages =3D pagelistinfo->pages; unsigned int num_pages =3D pagelistinfo->num_pages; + unsigned int cache_line_size; =20 dev_dbg(instance->state->dev, "arm: %pK, %d\n", pagelistinfo->pagelist, actual); @@ -1714,6 +1716,7 @@ free_pagelist(struct vchiq_instance *instance, pagelistinfo->scatterlist_mapped =3D 0; =20 /* Deal with any partial cache lines (fragments) */ + cache_line_size =3D drv_mgmt->info->cache_line_size; if (pagelist->type >=3D PAGELIST_READ_WITH_FRAGMENTS && drv_mgmt->fragments_base) { char *fragments =3D drv_mgmt->fragments_base + @@ -1721,10 +1724,10 @@ free_pagelist(struct vchiq_instance *instance, drv_mgmt->fragments_size; int head_bytes, tail_bytes; =20 - head_bytes =3D (drv_mgmt->info->cache_line_size - pagelist->offset) & - (drv_mgmt->info->cache_line_size - 1); + head_bytes =3D (cache_line_size - pagelist->offset) & + (cache_line_size - 1); tail_bytes =3D (pagelist->offset + actual) & - (drv_mgmt->info->cache_line_size - 1); + (cache_line_size - 1); =20 if ((actual >=3D 0) && (head_bytes !=3D 0)) { if (head_bytes > actual) @@ -1737,8 +1740,8 @@ free_pagelist(struct vchiq_instance *instance, (tail_bytes !=3D 0)) memcpy_to_page(pages[num_pages - 1], (pagelist->offset + actual) & - (PAGE_SIZE - 1) & ~(drv_mgmt->info->cache_line_size - 1), - fragments + drv_mgmt->info->cache_line_size, + (PAGE_SIZE - 1) & ~(cache_line_size - 1), + fragments + cache_line_size, tail_bytes); =20 down(&drv_mgmt->free_fragments_mutex); --=20 2.45.2