Skip to content

Commit 4242299

Browse files
committed
accel/habanalabs: add support for Gaudi2C device
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 <ogabbay@kernel.org>
1 parent e8bc0c1 commit 4242299

6 files changed

Lines changed: 13 additions & 0 deletions

File tree

drivers/accel/habanalabs/common/device.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,9 @@ static int device_early_init(struct hl_device *hdev)
853853
gaudi2_set_asic_funcs(hdev);
854854
strscpy(hdev->asic_name, "GAUDI2B", sizeof(hdev->asic_name));
855855
break;
856+
case ASIC_GAUDI2C:
857+
gaudi2_set_asic_funcs(hdev);
858+
strscpy(hdev->asic_name, "GAUDI2C", sizeof(hdev->asic_name));
856859
break;
857860
default:
858861
dev_err(hdev->dev, "Unrecognized ASIC type %d\n",

drivers/accel/habanalabs/common/habanalabs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,6 +1262,7 @@ struct hl_dec {
12621262
* @ASIC_GAUDI_SEC: Gaudi secured device (HL-2000).
12631263
* @ASIC_GAUDI2: Gaudi2 device.
12641264
* @ASIC_GAUDI2B: Gaudi2B device.
1265+
* @ASIC_GAUDI2C: Gaudi2C device.
12651266
*/
12661267
enum hl_asic_type {
12671268
ASIC_INVALID,
@@ -1270,6 +1271,7 @@ enum hl_asic_type {
12701271
ASIC_GAUDI_SEC,
12711272
ASIC_GAUDI2,
12721273
ASIC_GAUDI2B,
1274+
ASIC_GAUDI2C,
12731275
};
12741276

12751277
struct hl_cs_parser;

drivers/accel/habanalabs/common/habanalabs_drv.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ static enum hl_asic_type get_asic_type(struct hl_device *hdev)
141141
case REV_ID_B:
142142
asic_type = ASIC_GAUDI2B;
143143
break;
144+
case REV_ID_C:
145+
asic_type = ASIC_GAUDI2C;
146+
break;
144147
default:
145148
break;
146149
}

drivers/accel/habanalabs/common/mmu/mmu.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,7 @@ int hl_mmu_if_set_funcs(struct hl_device *hdev)
596596
break;
597597
case ASIC_GAUDI2:
598598
case ASIC_GAUDI2B:
599+
case ASIC_GAUDI2C:
599600
/* MMUs in Gaudi2 are always host resident */
600601
hl_mmu_v2_hr_set_funcs(hdev, &hdev->mmu_func[MMU_HR_PGT]);
601602
break;

drivers/accel/habanalabs/common/sysfs.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ static ssize_t device_type_show(struct device *dev,
251251
case ASIC_GAUDI2B:
252252
str = "GAUDI2B";
253253
break;
254+
case ASIC_GAUDI2C:
255+
str = "GAUDI2C";
256+
break;
254257
default:
255258
dev_err(hdev->dev, "Unrecognized ASIC type %d\n",
256259
hdev->asic_type);

drivers/accel/habanalabs/include/hw_ip/pci/pci_general.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ enum hl_revision_id {
2525
REV_ID_INVALID = 0x00,
2626
REV_ID_A = 0x01,
2727
REV_ID_B = 0x02,
28+
REV_ID_C = 0x03
2829
};
2930

3031
#endif /* INCLUDE_PCI_GENERAL_H_ */

0 commit comments

Comments
 (0)