From nobody Wed Nov 27 07:41:56 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 B28C81E495 for ; Sun, 13 Oct 2024 11:21:39 +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=1728818501; cv=none; b=st/03DWxo8/syohJ54nn5PXjZ9X5m6i7vYUuVpwJ5gX6MYF+RqIe19W7Mu8eg4InZ1/ejsZA5iUirlSoW+dUCBl8nefHa5jDW4eGZZ/3gzn8yM72OyR6csn23tNJpnxWwySNPjlWfb/d7nq1yVKYjpgmUBI1D0PoesAB2+QHssc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728818501; c=relaxed/simple; bh=HPzlE9sh1djReKfpWW1YtSaIElNq0n+B+WspYQFZr6Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KjBXmrz86cJ+LTWKKmV1VKVCxG6KmX8U3tw0wNgWSrEH0pkLRcTDec8XlX8gzBTSHwchE2VZK3nqkbDOtoDI6uHsvCPPIQd3fv4W1kJ5qmEm9OEfHzycURPr8Ws/j+Y7iju5WYv37N0j3xBNU8kzyR+a64Jq7CbRFUlOuvoxhdA= 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=vYw3yhO2; 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="vYw3yhO2" Received: from umang.jain (unknown [IPv6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id F24519EC; Sun, 13 Oct 2024 13:19:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728818397; bh=HPzlE9sh1djReKfpWW1YtSaIElNq0n+B+WspYQFZr6Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vYw3yhO26Iu/LwpbMZ1oARAK0UNzWdZqnRiKj+TIRX6iI2/xwE5iKWTmaFXpZR+Gd 4NeY/L4s3kLtsDpKsxBnTGDnGlk2XHbhjgcFE639FC8VoZHMPFZs8Hup8qr06/g3sY q3I/e5YKtUfBXO6nLNsCttwMjc3dSAuTy49DNklY= 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 , Laurent Pinchart , kernel-list@raspberrypi.com, Stefan Wahren , Umang Jain Subject: [PATCH v4 1/6] staging: vchiq_core: Locally cache cache_line_size information Date: Sun, 13 Oct 2024 16:51:23 +0530 Message-ID: <20241013112128.397249-2-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241013112128.397249-1-umang.jain@ideasonboard.com> References: <20241013112128.397249-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 1e4b2978c186..e9b60dd8d419 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -1490,6 +1490,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) @@ -1638,10 +1639,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)) { @@ -1671,6 +1672,7 @@ free_pagelist(struct vchiq_instance *instance, struct= vchiq_pagelist_info *pagel 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, a= ctual); =20 @@ -1685,16 +1687,17 @@ free_pagelist(struct vchiq_instance *instance, stru= ct vchiq_pagelist_info *pagel 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->fragmen= ts_base) { char *fragments =3D drv_mgmt->fragments_base + (pagelist->type - PAGELIST_READ_WITH_FRAGMENTS) * 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) @@ -1707,8 +1710,8 @@ free_pagelist(struct vchiq_instance *instance, struct= vchiq_pagelist_info *pagel (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