Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1113723pxb; Tue, 19 Oct 2021 21:24:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5I1OKxir2jymbfGRChAdC3pMsSUMq4vvTKR2RPJLu1DX4EuUZIagXB3vlwvV/xcszffR6 X-Received: by 2002:a17:90b:1d0a:: with SMTP id on10mr4607183pjb.218.1634703895406; Tue, 19 Oct 2021 21:24:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634703895; cv=none; d=google.com; s=arc-20160816; b=KVAZnqeNuRidcQYd8KQO03sekZsyy+8tTsaQHG4nEAqYvfpap3NSiqJXj1b0w2xock 1U4cr8hqlBgykac+pwt+tBSo9+MV1JLTfw1QaMAUK008Rut27MHdwK35toRP+FjrzWDJ PcfggNRhRmyQ8/CvBz5k2yocy7tIDbyqWxYfFrhrglGbQi7R3eWB7NkLi8utnLiJl4wL 0bLNnM6VpI/CyfOD5plZhC8L+1mgLbZJpQHff3xbSYxFZ+9jqHeP6hdRsSJWg3UrjHqS QZ8pB8vVTtxeeY+ReUht3U6V7DMhfNm26MzVvaVwbWfh5aJ5cq7naoVyGN7FpqTED2uC XnZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=fwhZm9/RbodbNnMTr/RHbsbfBNgBv1xdXljWlS7PQZE=; b=bcJZa3UkW8pP68qK0dUxLCayeJaXeRx8zjiVlkW7Y5grvBgZUYFyLO/MJGkVZH1Lan G+wFLqxKHBmml7+Fn2S2yqliia0gYvjWudz95AxEbqq861/+rNLgX33U9Q6P7jEpSCKE W+PWlyyW9QYKylCZIimk/9r00WpivoOzK3z7uNyAqda2Y9y5gCXPMFxdOUBggcneq7fS k1LhEBOy5Wa2UJMCLx3Fxq/jpYB7LPJIekfq0krqqn067b3PypA3WnMRYzQt29bkjuaS +2KXp1rtHDjKXsl/jy0ZackXHk/7WOs+KLj4K1Lo/ZuY447CMKjWp2hZdqBc1WPWhN6s nbrw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id q8si1350522pgl.360.2021.10.19.21.24.41; Tue, 19 Oct 2021 21:24:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S229771AbhJTEYP (ORCPT + 99 others); Wed, 20 Oct 2021 00:24:15 -0400 Received: from mga01.intel.com ([192.55.52.88]:7856 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbhJTEYO (ORCPT ); Wed, 20 Oct 2021 00:24:14 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10142"; a="252169195" X-IronPort-AV: E=Sophos;i="5.87,165,1631602800"; d="scan'208";a="252169195" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2021 21:22:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,165,1631602800"; d="scan'208";a="483561795" Received: from yilunxu-optiplex-7050.sh.intel.com (HELO localhost) ([10.239.159.162]) by orsmga007.jf.intel.com with ESMTP; 19 Oct 2021 21:21:57 -0700 Date: Wed, 20 Oct 2021 12:15:26 +0800 From: Xu Yilun To: Russ Weight Cc: mdf@kernel.org, linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, trix@redhat.com, lgoncalv@redhat.com, hao.wu@intel.com, matthew.gerlach@intel.com Subject: Re: [PATCH v1 1/2] fpga: dfl: afu: Clear port errors in afu init Message-ID: <20211020041526.GA146813@yilunxu-OptiPlex-7050> References: <20211019231545.47118-1-russell.h.weight@intel.com> <20211019231545.47118-2-russell.h.weight@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211019231545.47118-2-russell.h.weight@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 19, 2021 at 04:15:44PM -0700, Russ Weight wrote: > When the AFU driver initializes, log any pre-existing errors and clear them. Please wrapper the commit message to pass checkpatch.pl > > Signed-off-by: Russ Weight > --- > drivers/fpga/dfl-afu-error.c | 26 ++++++++++++++++---------- > 1 file changed, 16 insertions(+), 10 deletions(-) > > diff --git a/drivers/fpga/dfl-afu-error.c b/drivers/fpga/dfl-afu-error.c > index ab7be6217368..0dc60bf49902 100644 > --- a/drivers/fpga/dfl-afu-error.c > +++ b/drivers/fpga/dfl-afu-error.c > @@ -47,13 +47,13 @@ static void afu_port_err_mask(struct device *dev, bool mask) > } > > /* clear port errors. */ > -static int afu_port_err_clear(struct device *dev, u64 err) > +static int afu_port_err_clear(struct device *dev, u64 err, bool clear_all) how about "clear_all_on_init"? > { > struct dfl_feature_platform_data *pdata = dev_get_platdata(dev); > struct platform_device *pdev = to_platform_device(dev); > + u64 v, port_error, port_first_error; > void __iomem *base_err, *base_hdr; > int enable_ret = 0, ret = -EBUSY; > - u64 v; > > base_err = dfl_get_feature_ioaddr_by_id(dev, PORT_FEATURE_ID_ERROR); > base_hdr = dfl_get_feature_ioaddr_by_id(dev, PORT_FEATURE_ID_HEADER); > @@ -88,16 +88,21 @@ static int afu_port_err_clear(struct device *dev, u64 err) > __afu_port_err_mask(dev, true); > > /* Clear errors if err input matches with current port errors.*/ > - v = readq(base_err + PORT_ERROR); > + port_error = readq(base_err + PORT_ERROR); > > - if (v == err) { > - writeq(v, base_err + PORT_ERROR); > + if (clear_all || port_error == err) { > + port_first_error = readq(base_err + PORT_FIRST_ERROR); > > - v = readq(base_err + PORT_FIRST_ERROR); > - writeq(v, base_err + PORT_FIRST_ERROR); > + if (clear_all && (port_error || port_first_error)) > + dev_warn(dev, > + "Port Error: 0x%llx, First Error 0x%llx\n", > + port_error, port_first_error); The log could be more specific that we are reporting errors on device initialization. Thanks, Yilun > + > + writeq(port_error, base_err + PORT_ERROR); > + writeq(port_first_error, base_err + PORT_FIRST_ERROR); > } else { > dev_warn(dev, "%s: received 0x%llx, expected 0x%llx\n", > - __func__, v, err); > + __func__, port_error, err); > ret = -EINVAL; > } > > @@ -137,7 +142,7 @@ static ssize_t errors_store(struct device *dev, struct device_attribute *attr, > if (kstrtou64(buff, 0, &value)) > return -EINVAL; > > - ret = afu_port_err_clear(dev, value); > + ret = afu_port_err_clear(dev, value, false); > > return ret ? ret : count; > } > @@ -211,7 +216,8 @@ const struct attribute_group port_err_group = { > static int port_err_init(struct platform_device *pdev, > struct dfl_feature *feature) > { > - afu_port_err_mask(&pdev->dev, false); > + if (afu_port_err_clear(&pdev->dev, 0, true)) > + afu_port_err_mask(&pdev->dev, false); > > return 0; > } > -- > 2.25.1