Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp547132pxj; Thu, 13 May 2021 10:54:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxeVRL/clUAuFT0cMxK06ysFe0A1j4wDptl+L8HzSmGAqpxlfbMS1tl2PP/PBoOcNxBHiu9 X-Received: by 2002:a9d:106:: with SMTP id 6mr3315522otu.100.1620928490921; Thu, 13 May 2021 10:54:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620928490; cv=none; d=google.com; s=arc-20160816; b=oaBlIbo/1s+4QEy2/Tu4ot94iT9bIvl91O0pQM5YLHQRRVGH8gbYZV0+eLbW8wU2jH Ij9suWRSW+CdSa1p+dlRAgDhFaGY5n9U0H4Na4ZGhLtdos3Ab7ne+lkOXxD0iLc2Zz47 JA7UD09mqjT4rm+7vrZRxB6wF86MHxECKVqT83+6Lq0Q1NJXeqsed8hSiEY6pwtqyNyX N1uJJ37rMKQAgGaQvqZvBOpXc9IqAZGSeokPCSvQRm7d3w715p3JphRxcWxHYJHMlnYb a8hkEXRFGqgMQNvLl+AmMIcP0/zcoeKDrpsc8Gqq/pJGD1ldTI0uI3G+Qvs62ISMvU/g aLuw== 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:dkim-signature; bh=u30T5V0m4n3DBwTDFaTeYLAgdhfP3qBCly6J+90zfVE=; b=E5pSt6NrT1ENci9maASoXVzrU1zApOnuCEdl76Pj4dDFad7zte/eBHIln70hWoiRb1 Mx/HEzFQ5Au6MT/xZOY4DfFOdZ+w3tkdMkbkuafukSBd60uLzws5zrr4z9HPOSZ96D2r ArLyRCnZ7LHbiaPPffBQen5yeujPmS6SJDo/fMvBxE8THGjEWYon35pe0MAvorkh+vXy FlHgiI+2rKocA8zLMMyaurSrKE6TuR2Kp/vhITuIc1VFOQv4zVxtwF1tUhXnKWEG3DeL iw5X/CfetI+o1LJIjE3pfExldHD2RQkTDWT9OUNc7Hbu9nF0uZ0IPCrWELBpJN1C/RW4 AqoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qqET1CVO; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r4si4063167ooi.66.2021.05.13.10.54.36; Thu, 13 May 2021 10:54:50 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qqET1CVO; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233306AbhEMLRR (ORCPT + 99 others); Thu, 13 May 2021 07:17:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:35080 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233287AbhEMLQ4 (ORCPT ); Thu, 13 May 2021 07:16:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6325C611CA; Thu, 13 May 2021 11:15:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620904546; bh=7HQQIGZ6kdWE+1iDxTMukFID128I7VIccQaqVwQY+Cw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qqET1CVOQKbacH5qKhhXfCwvyanBMDfn7m9UcqG2ULzBboNt3DKmVq3UBUeN7PS4X cY8O//QaLk32OZ67Tp///sLo+nNJR7JAo7dciQRWtb82NWel3VeqAgO29J8GcyGucS vvkMKZPCVt1py+7eKm3NXsuNVwFVuYGNXZPnZxcw= Date: Thu, 13 May 2021 13:15:45 +0200 From: Greg Kroah-Hartman To: Maciej Kwapulinski Cc: Arnd Bergmann , Jonathan Corbet , Derek Kiernan , Dragan Cvetic , Andy Shevchenko , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Tomasz Jankowski , Savo Novakovic , Jianxun Zhang Subject: Re: [PATCH v3 02/14] intel_gna: add component of hardware operation Message-ID: References: <20210513110040.2268-1-maciej.kwapulinski@linux.intel.com> <20210513110040.2268-3-maciej.kwapulinski@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210513110040.2268-3-maciej.kwapulinski@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 13, 2021 at 01:00:28PM +0200, Maciej Kwapulinski wrote: > +void gna_start_scoring(struct gna_private *gna_priv, > + struct gna_compute_cfg *compute_cfg) > +{ > + u32 ctrl = gna_reg_read(gna_priv, GNA_MMIO_CTRL); > + > + ctrl |= GNA_CTRL_START_ACCEL | GNA_CTRL_COMP_INT_EN | GNA_CTRL_ERR_INT_EN; > + > + ctrl &= ~GNA_CTRL_COMP_STATS_EN; > + ctrl |= FIELD_PREP(GNA_CTRL_COMP_STATS_EN, > + compute_cfg->hw_perf_encoding & FIELD_MAX(GNA_CTRL_COMP_STATS_EN)); > + > + ctrl &= ~GNA_CTRL_ACTIVE_LIST_EN; > + ctrl |= FIELD_PREP(GNA_CTRL_ACTIVE_LIST_EN, > + compute_cfg->active_list_on & FIELD_MAX(GNA_CTRL_ACTIVE_LIST_EN)); > + > + ctrl &= ~GNA_CTRL_OP_MODE; > + ctrl |= FIELD_PREP(GNA_CTRL_OP_MODE, > + compute_cfg->gna_mode & FIELD_MAX(GNA_CTRL_OP_MODE)); > + > + gna_reg_write(gna_priv, GNA_MMIO_CTRL, ctrl); > + > + dev_dbg(gna_dev(gna_priv), "scoring started...\n"); ftrace is your friend, no need for lines like this. > +void gna_abort_hw(struct gna_private *gna_priv) > +{ > + u32 val; > + int ret; > + > + /* saturation bit in the GNA status register needs > + * to be explicitly cleared. > + */ > + gna_clear_saturation(gna_priv); > + > + val = gna_reg_read(gna_priv, GNA_MMIO_STS); > + dev_dbg(gna_dev(gna_priv), "status before abort: %#x\n", val); > + > + val = gna_reg_read(gna_priv, GNA_MMIO_CTRL); > + val |= GNA_CTRL_ABORT_CLR_ACCEL; > + gna_reg_write(gna_priv, GNA_MMIO_CTRL, val); > + > + ret = readl_poll_timeout(gna_priv->iobase + GNA_MMIO_STS, val, > + !(val & 0x1), > + 0, 1000); > + > + if (ret) > + dev_err(gna_dev(gna_priv), "abort did not complete\n"); > +} If "abort_hw" can fail, then return an error. What could a user do with an error message in the kernel log like the above one? The driver obviously did not recover from it, so what can they do? > --- /dev/null > +++ b/include/uapi/misc/intel/gna.h > @@ -0,0 +1,47 @@ > +/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ > +/* Copyright(c) 2017-2021 Intel Corporation */ > + > +#ifndef _UAPI_GNA_H_ > +#define _UAPI_GNA_H_ > + > +#if defined(__cplusplus) > +extern "C" { > +#endif These C++ things should not be needed in kernel uapi header files, right? thanks, greg k-h