* [PATCH] habanalabs: show unsupported message for GAUDI
@ 2020-03-21 9:00 Oded Gabbay
2020-03-22 6:20 ` Omer Shpigelman
0 siblings, 1 reply; 2+ messages in thread
From: Oded Gabbay @ 2020-03-21 9:00 UTC (permalink / raw)
To: linux-kernel, oshpigelman, ttayar; +Cc: gregkh
If a GAUDI device is present in the system, display an error message that
it is not supported by the current kernel.
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
---
drivers/misc/habanalabs/habanalabs.h | 4 +++-
drivers/misc/habanalabs/habanalabs_drv.c | 11 ++++++++++-
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/misc/habanalabs/habanalabs.h b/drivers/misc/habanalabs/habanalabs.h
index 9472da3ef847..31ebcf9458fe 100644
--- a/drivers/misc/habanalabs/habanalabs.h
+++ b/drivers/misc/habanalabs/habanalabs.h
@@ -424,10 +424,12 @@ struct hl_eq {
* enum hl_asic_type - supported ASIC types.
* @ASIC_INVALID: Invalid ASIC type.
* @ASIC_GOYA: Goya device.
+ * @ASIC_GAUDI: Gaudi device.
*/
enum hl_asic_type {
ASIC_INVALID,
- ASIC_GOYA
+ ASIC_GOYA,
+ ASIC_GAUDI
};
struct hl_cs_parser;
diff --git a/drivers/misc/habanalabs/habanalabs_drv.c b/drivers/misc/habanalabs/habanalabs_drv.c
index 8c342fb499ca..b670859c677a 100644
--- a/drivers/misc/habanalabs/habanalabs_drv.c
+++ b/drivers/misc/habanalabs/habanalabs_drv.c
@@ -40,12 +40,13 @@ MODULE_PARM_DESC(reset_on_lockup,
#define PCI_VENDOR_ID_HABANALABS 0x1da3
#define PCI_IDS_GOYA 0x0001
+#define PCI_IDS_GAUDI 0x1000
static const struct pci_device_id ids[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_HABANALABS, PCI_IDS_GOYA), },
+ { PCI_DEVICE(PCI_VENDOR_ID_HABANALABS, PCI_IDS_GAUDI), },
{ 0, }
};
-MODULE_DEVICE_TABLE(pci, ids);
/*
* get_asic_type - translate device id to asic type
@@ -63,6 +64,9 @@ static enum hl_asic_type get_asic_type(u16 device)
case PCI_IDS_GOYA:
asic_type = ASIC_GOYA;
break;
+ case PCI_IDS_GAUDI:
+ asic_type = ASIC_GAUDI;
+ break;
default:
asic_type = ASIC_INVALID;
break;
@@ -263,6 +267,11 @@ int create_hdev(struct hl_device **dev, struct pci_dev *pdev,
dev_err(&pdev->dev, "Unsupported ASIC\n");
rc = -ENODEV;
goto free_hdev;
+ } else if (hdev->asic_type == ASIC_GAUDI) {
+ dev_err(&pdev->dev,
+ "GAUDI is not supported by the current kernel\n");
+ rc = -ENODEV;
+ goto free_hdev;
}
} else {
hdev->asic_type = asic_type;
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [PATCH] habanalabs: show unsupported message for GAUDI
2020-03-21 9:00 [PATCH] habanalabs: show unsupported message for GAUDI Oded Gabbay
@ 2020-03-22 6:20 ` Omer Shpigelman
0 siblings, 0 replies; 2+ messages in thread
From: Omer Shpigelman @ 2020-03-22 6:20 UTC (permalink / raw)
To: Oded Gabbay, linux-kernel@vger.kernel.org, Tomer Tayar
Cc: gregkh@linuxfoundation.org
On Sat, Mar 21, 2020 at 11:01 AM, Oded Gabbay <oded.gabbay@gmail.com> wrote:
> If a GAUDI device is present in the system, display an error
> message that it is not supported by the current kernel.
>
> Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Reviewed-by: Omer Shpigelman <oshpigelman@habana.ai>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-03-22 6:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-21 9:00 [PATCH] habanalabs: show unsupported message for GAUDI Oded Gabbay
2020-03-22 6:20 ` Omer Shpigelman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox