From nobody Wed Nov 27 08:49:41 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 B030D217308 for ; Fri, 11 Oct 2024 12:10:24 +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=1728648626; cv=none; b=uCVnuIggpk9b/erYbILyE0G+OWTbARyR9p+9HO4WQmuM7T24G9K3pDMtWTOiEgvJ4KpWOtXlguYdQWlr/d1TCYbvwZOL7Mhmhlq3iXVuvDqrTHm618lp0RBncF/AellVJ9zzUxsvdRHUorJkytgPbBPz1+N1gdqbhpGwo86INZ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728648626; c=relaxed/simple; bh=HPzlE9sh1djReKfpWW1YtSaIElNq0n+B+WspYQFZr6Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TYVbXANp+62m1bznN8PtktwKTIlV9YSYfVnOsuslLPmxlG8HJvicz4ovNNaxXtsyx2ZD5nLDSc5AjcFCuxyh+Z/k6sXtg5Gmw34KOPkLFk9Lndd3cWFgwkEzHq62dK16G9FKlUtdnvx3gc89JgUgAxjZDcNICk8IBGhd622HeDo= 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=ICyiPHdU; 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="ICyiPHdU" Received: from umang.jain (unknown [IPv6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A2788CDB; Fri, 11 Oct 2024 14:08:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728648523; bh=HPzlE9sh1djReKfpWW1YtSaIElNq0n+B+WspYQFZr6Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ICyiPHdU6z78Hq/RQKLF0mAAgd0rhXGCfJHmoeyrzMaWbe78bggGlDy4QUNXyFkBw 0jN17O+Z3o3zmSSNYfjzgxXvhjWjFijKSSTbCMtAdCCwakhnx0NttnNDdk53aqiip6 bQsV1DkQNbYxtSIdGIQ8HF+VMvcDUsWzNcXgks5Y= 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 v2 1/6] staging: vchiq_core: Locally cache cache_line_size information Date: Fri, 11 Oct 2024 17:39:05 +0530 Message-ID: <20241011120910.74045-2-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241011120910.74045-1-umang.jain@ideasonboard.com> References: <20241011120910.74045-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