Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp390773rdb; Mon, 22 Jan 2024 07:23:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IGXoz0yCVPwSeRgaEt3atF3t7kGES+/HhYvGYNVqhzrveA9erCKVdNJHDr+Nkkjb+LPOOkU X-Received: by 2002:a05:622a:210:b0:42a:3324:8006 with SMTP id b16-20020a05622a021000b0042a33248006mr4436375qtx.20.1705937019571; Mon, 22 Jan 2024 07:23:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705937019; cv=pass; d=google.com; s=arc-20160816; b=hUiQ4wsZTIdbh3jlV13UB71o0qNljMd9KG+oFkmkNLixi2Dide2rg7aCDeIssviZte r4XTuiEGpWueUKh3JT6KBK7HIc+zhY7MH9UmO4TWDkY4nTz7UEGXwVpT/NZbXXIITmiD rwxwZpYyp/ILn2D7ROdd6UgadWBz4uOM3oDfDcQ++b8QDL6IBxILDzBmzFxAItkKKV7Y xddvWV0aKRmIRNolcGEmwhud+m1/JnPitb7RAvIW/6m+siE4VVZCzu+UCTCcbuaJfiQS FJd81pzVqenzaV+fSC79YvZJPR6hnzRdmp/wOhEZHmYxLb7LkT7famHzSweLVWoftmr1 7vGg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=em3uB5pK7NGRtaAvJyB1FoNhn4qSGFxI4fwv6Vk7MmQ=; fh=+ST3IOYq3aG5NI9vIsRQo+e9NH/XVMslH23b3OgG5as=; b=k8opajHpjMydcYAZvpr8HMm+Psjbsm6rj3nJYZnABt909DsN9b0sTkHErU8jlv1VtP u2Kpuf8Q5coVoIsU/01PJg6Of/uYZFbfQhQJcIcE74OrnD01YtTJ+OCT4VixdTa5b86d YXfDBMgTl0uU2QeXAARZIQanJkA8FA+PH8HdVWEO/LcTYNfpL+KAO7CiWrMLnbXmbTaX 8nro3d9goKtlYHg82CROKk9YBLPclIxX5AwkmmXjOGAQEk/LXNNaDeK3jim+PJ+kB/Ls lRguNKPpelhCN2xR2+tZ2cVfGQ2DmkgYxpUND4f+5TTK1Qb+/fzmKMrMMtB4mxrnAfcF cshg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fpxPDBUs; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-33285-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33285-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id c2-20020ac85a82000000b0042a21139231si5809162qtc.489.2024.01.22.07.23.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 07:23:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33285-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fpxPDBUs; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-33285-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33285-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 56CF51C22ADA for ; Mon, 22 Jan 2024 15:23:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D232140C06; Mon, 22 Jan 2024 15:00:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fpxPDBUs" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 02BE45BAE9; Mon, 22 Jan 2024 15:00:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705935612; cv=none; b=j/B7jk92JqRAs+q6JdsIyJ2Aqrb0PIB47/rpkEvUoRuquR+eon3JoD1f1bqDzYeVgH0uRPxQVtohhXRTGqTCtRaUFGEyFuIlrmywbWzIjJpwgJ6dYMozNZnV6fofJ/LaLrSw6uiBPR/15s50TrRacjPysK3p8xYXP5dpCaG5A54= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705935612; c=relaxed/simple; bh=tAG6oSvI88C2HV+Ni+JtLfU6sUpFj5b4hsKwm4etEmU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HhEhPh+sMaoQMlDYzFzTRNvvuA95YLg5ueR05pYd7k/5n5oE3BC0BBMQfnTN8OeeZ6O6AykhrNtuyyNRgry/kGxTJ+6k25+nFTyg2GF0QUewtMyUZO4kuRVLkGBifn8E9J/+YwtovVumVBO74fy9DJteRS4a4mg8wKhLo43F2r0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fpxPDBUs; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09EF0C43142; Mon, 22 Jan 2024 15:00:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705935611; bh=tAG6oSvI88C2HV+Ni+JtLfU6sUpFj5b4hsKwm4etEmU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fpxPDBUs2/1qHwBDZA1V+jv+bt6v5sXW4vXaAimC9AcHiX6t27zm+562LvYpLs41K 6sUj/HUcmrSIGLHRYB917frVs7dBcaO6Ei3b3mO1AEHppSRsoEpwdFpxTNi3CSKe1Y VBfSoCy9iEvEYll+pxYwK85zoGCHJTvSkpacDIOKQcSm+7+6xV+/ECQwVkPUI5j2NS riHDbnlR7QtgtPt+V8zoRisf+xdJLMLOkIyhwRRY4xlfBlPv93taodAhjjcDtiNkXK rZ/qA9Wl3Wg9tsLjroNFsKaQ04RA7GSM59CVHmlg3KrCGzdVh43QMSIRTXL3+fO3xo u4LFkJtZP9dUQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Oded Gabbay , Sasha Levin , ttayar@habana.ai, stanislaw.gruszka@linux.intel.com, kelbaz@habana.ai, dhirschfeld@habana.ai, fkassabri@habana.ai, obitton@habana.ai, osharabi@habana.ai, mhaimovski@habana.ai, xupengfei@nfschina.com, dliberman@habana.ai, asuller@habana.ai, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 6.7 63/88] accel/habanalabs: add support for Gaudi2C device Date: Mon, 22 Jan 2024 09:51:36 -0500 Message-ID: <20240122145608.990137-63-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122145608.990137-1-sashal@kernel.org> References: <20240122145608.990137-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.7.1 Content-Transfer-Encoding: 8bit From: Oded Gabbay [ Upstream commit 42422993cf28d456778ee9168d73758ec037cd51 ] Gaudi2 with PCI revision ID with the value of '3' represents Gaudi2C device and should be detected and initialized as Gaudi2. Signed-off-by: Oded Gabbay Signed-off-by: Sasha Levin --- drivers/accel/habanalabs/common/device.c | 3 +++ drivers/accel/habanalabs/common/habanalabs.h | 2 ++ drivers/accel/habanalabs/common/habanalabs_drv.c | 3 +++ drivers/accel/habanalabs/common/mmu/mmu.c | 1 + drivers/accel/habanalabs/common/sysfs.c | 3 +++ drivers/accel/habanalabs/include/hw_ip/pci/pci_general.h | 1 + 6 files changed, 13 insertions(+) diff --git a/drivers/accel/habanalabs/common/device.c b/drivers/accel/habanalabs/common/device.c index 9711e8fc979d..9e461c03e705 100644 --- a/drivers/accel/habanalabs/common/device.c +++ b/drivers/accel/habanalabs/common/device.c @@ -853,6 +853,9 @@ static int device_early_init(struct hl_device *hdev) gaudi2_set_asic_funcs(hdev); strscpy(hdev->asic_name, "GAUDI2B", sizeof(hdev->asic_name)); break; + case ASIC_GAUDI2C: + gaudi2_set_asic_funcs(hdev); + strscpy(hdev->asic_name, "GAUDI2C", sizeof(hdev->asic_name)); break; default: dev_err(hdev->dev, "Unrecognized ASIC type %d\n", diff --git a/drivers/accel/habanalabs/common/habanalabs.h b/drivers/accel/habanalabs/common/habanalabs.h index 1655c101c705..d0fd77bb6a74 100644 --- a/drivers/accel/habanalabs/common/habanalabs.h +++ b/drivers/accel/habanalabs/common/habanalabs.h @@ -1262,6 +1262,7 @@ struct hl_dec { * @ASIC_GAUDI_SEC: Gaudi secured device (HL-2000). * @ASIC_GAUDI2: Gaudi2 device. * @ASIC_GAUDI2B: Gaudi2B device. + * @ASIC_GAUDI2C: Gaudi2C device. */ enum hl_asic_type { ASIC_INVALID, @@ -1270,6 +1271,7 @@ enum hl_asic_type { ASIC_GAUDI_SEC, ASIC_GAUDI2, ASIC_GAUDI2B, + ASIC_GAUDI2C, }; struct hl_cs_parser; diff --git a/drivers/accel/habanalabs/common/habanalabs_drv.c b/drivers/accel/habanalabs/common/habanalabs_drv.c index 306a5bc9bf89..51fb04bbe376 100644 --- a/drivers/accel/habanalabs/common/habanalabs_drv.c +++ b/drivers/accel/habanalabs/common/habanalabs_drv.c @@ -141,6 +141,9 @@ static enum hl_asic_type get_asic_type(struct hl_device *hdev) case REV_ID_B: asic_type = ASIC_GAUDI2B; break; + case REV_ID_C: + asic_type = ASIC_GAUDI2C; + break; default: break; } diff --git a/drivers/accel/habanalabs/common/mmu/mmu.c b/drivers/accel/habanalabs/common/mmu/mmu.c index b2145716c605..b654302a68fc 100644 --- a/drivers/accel/habanalabs/common/mmu/mmu.c +++ b/drivers/accel/habanalabs/common/mmu/mmu.c @@ -596,6 +596,7 @@ int hl_mmu_if_set_funcs(struct hl_device *hdev) break; case ASIC_GAUDI2: case ASIC_GAUDI2B: + case ASIC_GAUDI2C: /* MMUs in Gaudi2 are always host resident */ hl_mmu_v2_hr_set_funcs(hdev, &hdev->mmu_func[MMU_HR_PGT]); break; diff --git a/drivers/accel/habanalabs/common/sysfs.c b/drivers/accel/habanalabs/common/sysfs.c index 01f89f029355..278606373055 100644 --- a/drivers/accel/habanalabs/common/sysfs.c +++ b/drivers/accel/habanalabs/common/sysfs.c @@ -251,6 +251,9 @@ static ssize_t device_type_show(struct device *dev, case ASIC_GAUDI2B: str = "GAUDI2B"; break; + case ASIC_GAUDI2C: + str = "GAUDI2C"; + break; default: dev_err(hdev->dev, "Unrecognized ASIC type %d\n", hdev->asic_type); diff --git a/drivers/accel/habanalabs/include/hw_ip/pci/pci_general.h b/drivers/accel/habanalabs/include/hw_ip/pci/pci_general.h index f5d497dc9bdc..4f951cada077 100644 --- a/drivers/accel/habanalabs/include/hw_ip/pci/pci_general.h +++ b/drivers/accel/habanalabs/include/hw_ip/pci/pci_general.h @@ -25,6 +25,7 @@ enum hl_revision_id { REV_ID_INVALID = 0x00, REV_ID_A = 0x01, REV_ID_B = 0x02, + REV_ID_C = 0x03 }; #endif /* INCLUDE_PCI_GENERAL_H_ */ -- 2.43.0