From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=198.175.65.20 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796206492; b=ArkdF7mgmPQepLXcwmYb6GfSVJ6sCWtqjnlsKODiKbEFDZ25oT1MKQUMz4WkZTo7rBn3 vdJNkkbey78R6FfYxJG3Eex0MN0d61fnHA+P818EQ56qhNkd9Ec3mCTxA4/c6d7u4v/83 FnwJaQ9exTwABbSQul4tXPxLX++Wo3W77R2LJeA3e9/B0+yk5pkH6xxOT4S5xmftH+ahy 6ILobcJ0PLFLBpaeUwrGQ8rUhFB3TtydBsLFTHoNgF8Xb9PoPseLLfGknnlbUAkuc8QnQ 5V72OpQ/rH5DbIyV3gQJutZk3aZT4idXtcJfGnayGH18C+pHXKhdkDSrg+8afNtwOUQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796206492; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Message-ID:Date: MIME-Version:User-Agent:Subject:To:Cc:References:Content-Language: From:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=Sbxve6Ho7Cp2QHoRoZ/DXxaEo1Z0EZ1shlyCXxP1oPA=; b=gudErV5OYFy3r4PzD1iDORkioLIKKXXMQ8T0404cyEhkl4WxZ3/I4RmYlzIuhJWyMfus 35GFoDqfxEziyvqw/qOSHRMTDvMR7124/OMDjvGD4b1qhNJ9NRkV+wKzMXGXo0nMauUTe LCpseTVfLE1/rWbcVTw04DQdduMx07Nhxv5+Qxf3Dr3F9dkK+E2Au7QsdqkRflG1enHzq qpiMu8A6m8q9AElUp0x1QIu1RCmSPWHQ8SGXxGVrH2pFLDpbl7M95ZJn1wbKCXXHpRw1F GOxsBtXk018KDtyaU2ETu7zyxFNoDnm8NcCuw3ASx6pFObwCpqS1o7d/q3sqbNlMdQA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=d8MuRU3Y; arc=none smtp.remote-ip=198.175.65.20 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C2CA606A32E for ; Wed, 2 Dec 2026 10:14:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 5C2CA606A32E Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=d8MuRU3Y DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796206493; x=1827742493; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=Sbxve6Ho7Cp2QHoRoZ/DXxaEo1Z0EZ1shlyCXxP1oPA=; b=d8MuRU3YtHPxVhwZbhJOBYi7z5O7SIB7J3hvGWucKD9XiKin96/Fy1f9 r/v2tG8Q1KFPpNJrVU6I9Cu1ryH9wyctAzTxYAd9pzbVqfJUCf8ThHb6o D5ibN5DfukPk/roFasJeF5dJI2sBdjVNAMwPLMTq0VinqnLIVfr3M713l 4DRz6W3AHy5MO7RhBiwemtl9gFI/pTmZpgtkl4x9hW+baseHa0OwKCzvQ KN2666OGugNOUAQVjEPSH/TjUuBs94Fy919GO9fjHL8W2+NtcDx9YKbqN dXUWwBmfpvKIa4Qs/obypvNuYGRn200ep5dES8LSDIS++TrFvGkz/ZZTg g==; X-CSE-ConnectionGUID: kTJsLnNFTTaGbCzHSUWrGQ== X-CSE-MsgGUID: 784R9SjbRH2iFxgwR67ZEA== X-IronPort-AV: E=McAfee;i="6800,10657,11983"; a="5162608" X-IronPort-AV: E=Sophos;i="6.27,246,1787036400"; d="scan'208";a="5162608" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2026 02:14:52 -0800 X-CSE-ConnectionGUID: BPC21B/uR1+qmn40gnsZjA== X-CSE-MsgGUID: e1iXBPUpRNu55ojLNaNXnw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,246,1787036400"; d="scan'208";a="4941417" Received: from soc-5cg43972ff.clients.intel.com (HELO [10.102.88.152]) ([10.102.88.152]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2026 02:14:52 -0800 Message-ID: Date: Wed, 2 Dec 2026 11:14:37 +0100 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH char-misc-next v3 4/4] issei: add driver to driver interface To: Alexander Usyskin Cc: linux-kernel@vger.kernel.org References: <20261111-issei_pm_and_itf-v3-0-4f4f6d626ff3@intel.com> <20261111-issei_pm_and_itf-v3-4-4f4f6d626ff3@intel.com> Content-Language: en-US From: Andrzej Kacprowski In-Reply-To: <20261111-issei_pm_and_itf-v3-4-4f4f6d626ff3@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 11-Nov-26 8:40 AM, Alexander Usyskin wrote: > Add new interface that enables communication with ISSEI device > from the kernel modules. > First intended consumer is an NPU driver. > > Co-developed-by: Reuven Abliyev > Signed-off-by: Reuven Abliyev > Co-developed-by: Andrzej Kacprowski > Signed-off-by: Andrzej Kacprowski > Signed-off-by: Alexander Usyskin > --- > MAINTAINERS | 1 + > drivers/misc/issei/Makefile | 1 + > drivers/misc/issei/cdev.c | 12 +- > drivers/misc/issei/issei_device.c | 269 ++++++++++++++++++++++++++++++++++++++ > include/linux/issei_device.h | 31 +++++ > 5 files changed, 308 insertions(+), 6 deletions(-) > > diff --git a/MAINTAINERS b/MAINTAINERS > index 93abbb315065..1633cc41d95b 100644 ... > +ssize_t issei_device_write(void *ctx, const u8 *ubuf, size_t length, unsigned long timeout) > +{ > + struct issei_host_client *cl = ctx; > + struct issei_device *idev = cl->idev; > + ssize_t ret; > + long wret; > + > + if (idev->rst_state != ISSEI_RST_STATE_DONE) { > + dev_dbg(&idev->dev, "Device is in transition\n"); > + return -EBUSY; > + } > + > + if (!length) > + return 0; > + > + /* sanity check */ > + if (length > idev->dma.length.h2f) { > + dev_dbg(&idev->dev, "Write is too big %zu > %zu\n", length, > + idev->dma.length.h2f); > + return -EFBIG; > + } > + > + u8 *buf __free(kfree) = kmemdup(ubuf, length, GFP_KERNEL); > + if (!buf) > + return -ENOMEM; > + > + do { > + ret = issei_cl_write(cl, buf, length); > + if (ret < 0 && ret != -EAGAIN) > + return ret; > + /* buf is consumed by issei_cl_write on success */ > + if (ret >= 0) > + retain_and_null_ptr(buf); > + wret = wait_event_interruptible_timeout(cl->write_wait, > + issei_cl_check_write(cl) != 1, > + msecs_to_jiffies(timeout)); Here the timeout parameter is converted to jiffies. > + if (wret == 0) /* timeout */ > + wret = -ETIMEDOUT; > + if (wret < 0) { > + issei_cl_clean_all_wbuf(cl); > + dev_dbg(&idev->dev, "Failed writing data ret = %zd\n", ret); > + return wret; > + } > + } while (ret == -EAGAIN); > + > + return ret; > +} > +EXPORT_SYMBOL_GPL(issei_device_write); > + > +/** > + * issei_device_read - receive data from the firmware client. > + * @ctx: opaque context > + * @ubuf: buffer for data > + * @length: buffer length > + * @timeout: operation timeout in milliseconds > + * > + * Return: >=0 data length on success, <0 on error > + */ > +ssize_t issei_device_read(void *ctx, u8 *ubuf, size_t length, unsigned long timeout) I suggest to rename `timeout` to `timeout_ms` - it will make it easier to spot mistakes like below. > +{ > + struct issei_host_client *cl = ctx; > + struct issei_device *idev = cl->idev; > + u8 *data = NULL; > + ssize_t ret; > + > + if (idev->rst_state != ISSEI_RST_STATE_DONE) { > + dev_dbg(&idev->dev, "Device is in transition\n"); > + return -EBUSY; > + } > + > + if (!length) > + return 0; > + > + /* sanity check */ > + if (length > idev->dma.length.f2h) { > + dev_dbg(&idev->dev, "Read is too big %zu > %zu\n", length, > + idev->dma.length.f2h); > + return -EFBIG; > + } > + > + ret = issei_cl_read(cl, &data, length); > + if (ret < 0) { > + if (ret != -ENOENT) > + return ret; > + > + ret = wait_event_interruptible_timeout(cl->read_wait, > + issei_cl_check_read(cl) != 0, > + timeout); Here the timeout is in milliseconds but it's passed directly to function that takes jiffies - it must be converted to jiffies first with msecs_to_jiffies(). The similar function issei_device_write() already does this conversion. BR, Andrzej