From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A32FC433EF for ; Tue, 28 Sep 2021 05:56:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3EF1961355 for ; Tue, 28 Sep 2021 05:56:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239255AbhI1F6a (ORCPT ); Tue, 28 Sep 2021 01:58:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:48494 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238972AbhI1F5t (ORCPT ); Tue, 28 Sep 2021 01:57:49 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 76C956113E; Tue, 28 Sep 2021 05:56:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632808570; bh=W978VNnoBPO6sW63/1v4s7wCVz59IicxzMl2SC1THb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZhLwT2dPyP66zLSDCfIYwMbaIsuVJEbkODvzgvMV7CS3KArunAoe2LLpIqu3if80h oTOeJgSA4qB+q4LNEbpFA5vFiyTfpd/3Sil0LX8bW3FVRDdtteFsnrIRUaucJeBaKI HEdwb651lrDN2mLh5RCCFBsxImJ7S/tNEOQl/eprG3OARutAo7ydxzYS+TzDg3oED5 63jMhjcum11RySo/qphZz08PYt/bonDWIdmCTYkVJXIy7jIkxI9XR4bDLd8NwUVe9z gNNzUxMR5I2eOlX+1CeKUU1UMi/05oXd5cObjdtcCZJXHB/IV1JYvrAXyc5nL5Olsr NDFKhbvzEVAbw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ofir Bitton , Oded Gabbay , Sasha Levin , Arnd@vger.kernel.org, gregkh@linuxfoundation.org, ttayar@habana.ai, fkassabri@habana.ai, osharabi@habana.ai Subject: [PATCH AUTOSEL 5.14 21/40] habanalabs: fail collective wait when not supported Date: Tue, 28 Sep 2021 01:55:05 -0400 Message-Id: <20210928055524.172051-21-sashal@kernel.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210928055524.172051-1-sashal@kernel.org> References: <20210928055524.172051-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ofir Bitton [ Upstream commit d09ff62c820b5950ab9958e77620a8498efe9386 ] As collective wait operation is required only when NIC ports are available, we disable the option to submit a CS in case all the ports are disabled, which is the current situation in the upstream driver. Signed-off-by: Ofir Bitton Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay Signed-off-by: Sasha Levin --- drivers/misc/habanalabs/common/command_submission.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/misc/habanalabs/common/command_submission.c b/drivers/misc/habanalabs/common/command_submission.c index 80c60fb41bbc..d249101106de 100644 --- a/drivers/misc/habanalabs/common/command_submission.c +++ b/drivers/misc/habanalabs/common/command_submission.c @@ -1727,6 +1727,15 @@ static int cs_ioctl_signal_wait(struct hl_fpriv *hpriv, enum hl_cs_type cs_type, goto free_cs_chunk_array; } + if (!hdev->nic_ports_mask) { + atomic64_inc(&ctx->cs_counters.validation_drop_cnt); + atomic64_inc(&cntr->validation_drop_cnt); + dev_err(hdev->dev, + "Collective operations not supported when NIC ports are disabled"); + rc = -EINVAL; + goto free_cs_chunk_array; + } + collective_engine_id = chunk->collective_engine_id; } -- 2.33.0