Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2758369ybh; Mon, 9 Mar 2020 12:23:24 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsSYPu6FhpBiOY7z9eD2n1J+6VMKNbQ+CFKim16HObSIS9NQb3YX4VyakmLiO7E7H3Hn9/M X-Received: by 2002:a9d:4d15:: with SMTP id n21mr719197otf.208.1583781804246; Mon, 09 Mar 2020 12:23:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583781804; cv=none; d=google.com; s=arc-20160816; b=1KK53vGZh4qX32xyMkJ7E+H7KMcYIpDMjnqJeuG7N+iZIKcQK4liB6JZ/OIlmhYWv1 H6yA+EpELKEO3XQfppSvbVqHgd/32TVZx7KzrCto1UbQGeztDW8Qhvvg63JnWk6NPJ7N VaBD3WER2EnF8qez13nMhdZ9ZxAc4uHxBogQ11bzsbrVIFxvhNVsZmekB/k3vtdfgSHr TtMWeXXZlK7YFWYKRVV9xECuZE0ZWe0H4OfzlfY26uZy48x/n0y4Cjk2kT9xA5Ec6hLr 2ReNCz7BJ0nlc1KhLxdTEWLLBa9y0WngknwksayfgqZJ8Ov0Ds1AsLe06+63F+BruNuj IvgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=/Ve3mrSvm1dOHAsegEEjiuaMrFQOijqF+lr2yreUyLE=; b=AH81B3NsJyyQEHvFIzh5nyRp7nEqE1NVqC3GI7dfT2Fsbn5ITEpbNaaKjaDIKTyklG nWPgVCyoBOzEUvKIgveOcCmaqczo+wCml9rPwfocXWlHVoAgnlMXKNXpAG+Pyur87zeh 6IuAQHolQIwd85Svhq7XdIMRaboBSF5pjo6kBdf95H4LVwBNQccqw5loIgtNelbg/8F1 RkZwFQ2btZ8w4MM+gc2OwfKNgunJGbfs3ti0ZLDoHwOozGNOCfgCgtDBeCWSwdUrbaFf YljR5EyA9N5Ts3i7Y2IEjeR+FyoxDaiPD+k+qnfuQtK8AV52vlfbEhiefmiKt2Y6/mTY WRDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PKCtKC7u; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t193si1906315oih.61.2020.03.09.12.23.11; Mon, 09 Mar 2020 12:23:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PKCtKC7u; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726293AbgCITVW (ORCPT + 99 others); Mon, 9 Mar 2020 15:21:22 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:37053 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726266AbgCITVV (ORCPT ); Mon, 9 Mar 2020 15:21:21 -0400 Received: by mail-pf1-f196.google.com with SMTP id p14so5276340pfn.4 for ; Mon, 09 Mar 2020 12:21:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=/Ve3mrSvm1dOHAsegEEjiuaMrFQOijqF+lr2yreUyLE=; b=PKCtKC7uyC8i/DN0MO+jBy7A9dYjm0BvRQHCcABOBfgDupKb+axXLHJ1pIr5+0N6v+ EOZwJYSIfs2miXWm90Qjb6yE5EBWGSBAsw/IRyuFapS9v6j5tiHTfsj8sy8fndA4ooO9 UKs1UUhQk1xKwDJGKHHRiGZ4SR4ShkUpFn6QuntqJF3mhLrBK3keXR9SOUl0Epx2yryK dqYB3wkDKVT3frMmHokgUdQyCvgwBogJgN9Hy0rbNBvNYsfsuDcnCMas98lYqxyv775v T7xrFLTYcuTQgavNN3+2Qvly5vFOFiA8Upap+DllXIKkLvxGERM74sfSGkAAiWy7yk2p JNtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=/Ve3mrSvm1dOHAsegEEjiuaMrFQOijqF+lr2yreUyLE=; b=ccEgg4NkrNWXC0q6g9zrYcXiJxLThpZEu+zwPjiRSNfFaC4RE1MIq/vmjj++XxEmaT vdOI3jw3nPrfyZjPplrGBvmZVNGyxxpvtGhrJWjY5icqUfg3gOo/d2mPEOU1B5hInmAH tdL3ppW9ctTGMNch6OMibCaUrgZfqgQN8nWhmXMFXN5ItkPa3hDBpmhyYjeTvgxvNI5c famHeqHGMC5L3F6HyDDMaxgGLQywy2KOwN9jJv7IezUAcoA/zGWpByRPkXv9ofTjo22i NKRATeIU5XMDfno0aS3Hgx2X/pXi1uhhI1eirYtbjUeBdOIXQ1NVui4zkgZ/O8zq05iI uVxw== X-Gm-Message-State: ANhLgQ2YBU+8+xDyUUbPtl6RcMrCOsjMXpheqmuY+n9YVZENfFO8sfyi NHDB2691+CHRBQyqYkIulvpPxQ== X-Received: by 2002:a62:25c3:: with SMTP id l186mr18053778pfl.52.1583781678971; Mon, 09 Mar 2020 12:21:18 -0700 (PDT) Received: from xps15 (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id u14sm27167815pgg.67.2020.03.09.12.21.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2020 12:21:18 -0700 (PDT) Date: Mon, 9 Mar 2020 13:21:15 -0600 From: Mathieu Poirier To: Clement Leger Cc: Ohad Ben-Cohen , Bjorn Andersson , Jonathan Corbet , Shawn Guo , Sascha Hauer , linux-remoteproc@vger.kernel.org, Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Andy Gross , Patrice Chotard , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Arnaud Pouliquen , Loic PALLARDY , s-anna Subject: Re: [PATCH v5 2/8] remoteproc: Use size_t instead of int for rproc_mem_entry len Message-ID: <20200309192115.GB1399@xps15> References: <20200210162209.23149-1-cleger@kalray.eu> <20200302093902.27849-1-cleger@kalray.eu> <20200302093902.27849-3-cleger@kalray.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200302093902.27849-3-cleger@kalray.eu> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 02, 2020 at 10:38:56AM +0100, Clement Leger wrote: > Now that rproc_da_to_va uses a size_t for length, use a size_t for len field > of rproc_mem_entry. Function used to create such structures now takes > a size_t instead of int to allow full size range to be handled. > > Signed-off-by: Clement Leger With the checkpatch warning fixed: Reviewed-by: Mathieu Poirier > --- > drivers/remoteproc/remoteproc_core.c | 14 ++++++++------ > drivers/remoteproc/remoteproc_debugfs.c | 2 +- > include/linux/remoteproc.h | 6 +++--- > 3 files changed, 12 insertions(+), 10 deletions(-) > > diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c > index 5ab094fc1b55..4bfaf4a3c4a3 100644 > --- a/drivers/remoteproc/remoteproc_core.c > +++ b/drivers/remoteproc/remoteproc_core.c > @@ -318,8 +318,9 @@ int rproc_alloc_vring(struct rproc_vdev *rvdev, int i) > struct device *dev = &rproc->dev; > struct rproc_vring *rvring = &rvdev->vring[i]; > struct fw_rsc_vdev *rsc; > - int ret, size, notifyid; > + int ret, notifyid; > struct rproc_mem_entry *mem; > + size_t size; > > /* actual size of vring (in bytes) */ > size = PAGE_ALIGN(vring_size(rvring->len, rvring->align)); > @@ -746,11 +747,12 @@ static int rproc_alloc_carveout(struct rproc *rproc, > va = dma_alloc_coherent(dev->parent, mem->len, &dma, GFP_KERNEL); > if (!va) { > dev_err(dev->parent, > - "failed to allocate dma memory: len 0x%x\n", mem->len); > + "failed to allocate dma memory: len 0x%zx\n", > + mem->len); > return -ENOMEM; > } > > - dev_dbg(dev, "carveout va %pK, dma %pad, len 0x%x\n", > + dev_dbg(dev, "carveout va %pK, dma %pad, len 0x%zx\n", > va, &dma, mem->len); > > if (mem->da != FW_RSC_ADDR_ANY && !rproc->domain) { > @@ -957,7 +959,7 @@ EXPORT_SYMBOL(rproc_add_carveout); > */ > struct rproc_mem_entry * > rproc_mem_entry_init(struct device *dev, > - void *va, dma_addr_t dma, int len, u32 da, > + void *va, dma_addr_t dma, size_t len, u32 da, > int (*alloc)(struct rproc *, struct rproc_mem_entry *), > int (*release)(struct rproc *, struct rproc_mem_entry *), > const char *name, ...) > @@ -999,7 +1001,7 @@ EXPORT_SYMBOL(rproc_mem_entry_init); > * provided by client. > */ > struct rproc_mem_entry * > -rproc_of_resm_mem_entry_init(struct device *dev, u32 of_resm_idx, int len, > +rproc_of_resm_mem_entry_init(struct device *dev, u32 of_resm_idx, size_t len, > u32 da, const char *name, ...) > { > struct rproc_mem_entry *mem; > @@ -1270,7 +1272,7 @@ static void rproc_resource_cleanup(struct rproc *rproc) > unmapped = iommu_unmap(rproc->domain, entry->da, entry->len); > if (unmapped != entry->len) { > /* nothing much to do besides complaining */ > - dev_err(dev, "failed to unmap %u/%zu\n", entry->len, > + dev_err(dev, "failed to unmap %zx/%zu\n", entry->len, > unmapped); > } > > diff --git a/drivers/remoteproc/remoteproc_debugfs.c b/drivers/remoteproc/remoteproc_debugfs.c > index dd93cf04e17f..82dc34b819df 100644 > --- a/drivers/remoteproc/remoteproc_debugfs.c > +++ b/drivers/remoteproc/remoteproc_debugfs.c > @@ -293,7 +293,7 @@ static int rproc_carveouts_show(struct seq_file *seq, void *p) > seq_printf(seq, "\tVirtual address: %pK\n", carveout->va); > seq_printf(seq, "\tDMA address: %pad\n", &carveout->dma); > seq_printf(seq, "\tDevice address: 0x%x\n", carveout->da); > - seq_printf(seq, "\tLength: 0x%x Bytes\n\n", carveout->len); > + seq_printf(seq, "\tLength: 0x%zx Bytes\n\n", carveout->len); > } > > return 0; > diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h > index 89215798eaea..bee559330204 100644 > --- a/include/linux/remoteproc.h > +++ b/include/linux/remoteproc.h > @@ -329,7 +329,7 @@ struct rproc; > struct rproc_mem_entry { > void *va; > dma_addr_t dma; > - int len; > + size_t len; > u32 da; > void *priv; > char name[32]; > @@ -599,13 +599,13 @@ void rproc_add_carveout(struct rproc *rproc, struct rproc_mem_entry *mem); > > struct rproc_mem_entry * > rproc_mem_entry_init(struct device *dev, > - void *va, dma_addr_t dma, int len, u32 da, > + void *va, dma_addr_t dma, size_t len, u32 da, > int (*alloc)(struct rproc *, struct rproc_mem_entry *), > int (*release)(struct rproc *, struct rproc_mem_entry *), > const char *name, ...); > > struct rproc_mem_entry * > -rproc_of_resm_mem_entry_init(struct device *dev, u32 of_resm_idx, int len, > +rproc_of_resm_mem_entry_init(struct device *dev, u32 of_resm_idx, size_t len, > u32 da, const char *name, ...); > > int rproc_boot(struct rproc *rproc); > -- > 2.15.0.276.g89ea799 >