Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3759385img; Mon, 25 Mar 2019 17:45:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqw3jFhIwhTlGIzDv5Xv7GYf9/mpBXoO2q1XFVyI4S0cz+NpE5/UofRx1WlE/IQRMIAqEMdW X-Received: by 2002:a63:d1f:: with SMTP id c31mr3242317pgl.353.1553561113115; Mon, 25 Mar 2019 17:45:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553561113; cv=none; d=google.com; s=arc-20160816; b=REZ1KKY5oQKl/0IZIJ9wDf5GqXZan6FUOm3RvWn+ZNDZPu6cvSduvil90IbG5aJm+z A64ohloeNe+5INe/ykDK7QoVLAQw519n37h7vqoRx3hd7PQ9ik/uYDbS0rIcyhAF4opi P9sHrcHR22U+P8anpSwm7lcvpBI1fitH1vd1qqM4ICfHWyE3ONwBmNzeuOZEuancWHuP IoDU7F21Asq7xk73vr6bihMkPL2ESZRs376F9s6aBs58iOB/UxileokRH07wHe/Y/zdh yNYZ8M+cLGSSce8dR43f66vjyTQaikKkIdj38UWbt2Yl8OEbidsIG8qbPNZV6/nTibl9 eRqA== 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; bh=O7cxrYTvm30zpYzfh79rx/ppMQ5fptItO4IiR7q/ve0=; b=H8Nxm4bCtZVsa8puWmNbnPKbceDcHzXyPzzYJlWwanEd/Dpfwckn9deryUhIkDwVrC aziljlFz1DBOkZACnXo51SylTHnu0ujSmid1TjOUTUYFkOxsInPDxI82LyqMAarujQ1e ihPkKO4N65QNwToqTu/YfxXNJTwSIzn2wITgjxph5sk8vVnBVfr4GVbPZioIpIIu2a8c jlxuicU6kV9fSgIYTh9DsxfJWIg46kmd9QUk3MTa4GU0VYmDaMEBShfz5wuJbfJ4mZgW qD/3FurpeUuCaaEvNV5RJfMZmag9LDnVGS8cogSjCNppuONDMKQBfuaraTCQsg6lDBVI 2ujg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x14si3912417pfm.179.2019.03.25.17.44.58; Mon, 25 Mar 2019 17:45:13 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730384AbfCZAoS (ORCPT + 99 others); Mon, 25 Mar 2019 20:44:18 -0400 Received: from mga14.intel.com ([192.55.52.115]:51162 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726186AbfCZAoR (ORCPT ); Mon, 25 Mar 2019 20:44:17 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Mar 2019 17:44:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,270,1549958400"; d="scan'208";a="134712607" Received: from hao-dev.bj.intel.com (HELO localhost) ([10.238.157.65]) by fmsmga008.fm.intel.com with ESMTP; 25 Mar 2019 17:44:15 -0700 Date: Tue, 26 Mar 2019 08:28:52 +0800 From: Wu Hao To: Alan Tull Cc: Moritz Fischer , linux-fpga@vger.kernel.org, linux-kernel , linux-api@vger.kernel.org, Xu Yilun Subject: Re: [PATCH 02/17] fpga: dfl: fme: align PR buffer size per PR datawidth Message-ID: <20190326002852.GA2901@hao-dev> References: <1553483264-5379-1-git-send-email-hao.wu@intel.com> <1553483264-5379-3-git-send-email-hao.wu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 25, 2019 at 12:50:40PM -0500, Alan Tull wrote: > On Sun, Mar 24, 2019 at 10:23 PM Wu Hao wrote: > > Hi Hao, > > Looks good, one question below. > > > > > Current driver checks if input bitstream file size is aligned or > > not per PR data width (default 32bits). It requires one additional > > step for end user when they generate the bitstream file, padding > > extra zeros to bitstream file to align its size per PR data width, > > but they don't have to as hardware will drop extra padding bytes > > automatically. > > > > In order to simplify the user steps, this patch aligns PR buffer > > size per PR data width in driver, to allow user to pass unaligned > > size bitstream files to driver. > > > > Signed-off-by: Xu Yilun > > Signed-off-by: Wu Hao > > --- > > drivers/fpga/dfl-fme-pr.c | 14 +++++++++----- > > 1 file changed, 9 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/fpga/dfl-fme-pr.c b/drivers/fpga/dfl-fme-pr.c > > index d9ca955..c1fb1fe 100644 > > --- a/drivers/fpga/dfl-fme-pr.c > > +++ b/drivers/fpga/dfl-fme-pr.c > > @@ -74,6 +74,7 @@ static int fme_pr(struct platform_device *pdev, unsigned long arg) > > struct dfl_fme *fme; > > unsigned long minsz; > > void *buf = NULL; > > + size_t length; > > int ret = 0; > > u64 v; > > > > @@ -85,9 +86,6 @@ static int fme_pr(struct platform_device *pdev, unsigned long arg) > > if (port_pr.argsz < minsz || port_pr.flags) > > return -EINVAL; > > > > - if (!IS_ALIGNED(port_pr.buffer_size, 4)) > > - return -EINVAL; > > - > > /* get fme header region */ > > fme_hdr = dfl_get_feature_ioaddr_by_id(&pdev->dev, > > FME_FEATURE_ID_HEADER); > > @@ -103,7 +101,13 @@ static int fme_pr(struct platform_device *pdev, unsigned long arg) > > port_pr.buffer_size)) > > return -EFAULT; > > > > - buf = vmalloc(port_pr.buffer_size); > > + /* > > + * align PR buffer per PR bandwidth, as HW ignores the extra padding > > + * data automatically. > > + */ > > + length = ALIGN(port_pr.buffer_size, 4); > > + > > + buf = vmalloc(length); > > Since it may not be completely filled, would it be worthwhile to alloc > a zero'ed buff? > Hi Alan, Thanks for the review, acutally per spec, hw doesn't care about the extra padding data. So for now, i guess we don't need this. Thanks Hao > Alan >