File habanalabs-add-in-device-creation-status.patch of Package linux-glibc-devel.26130
From f621eeead8d6eca12289dc8f52727cd23d5c5b21 Mon Sep 17 00:00:00 2001
From: Omer Shpigelman <oshpigelman@habana.ai>
Date: Mon, 16 Aug 2021 13:27:12 +0300
Subject: [PATCH] habanalabs: add "in device creation" status
Git-commit: 71731090ab17a208a58020e4b342fdfee280458a
Patch-mainline: v5.15-rc1
References: stable-5.14.8
[ Upstream commit 71731090ab17a208a58020e4b342fdfee280458a ]
On init, the disabled state is cleared right before hw_init and that
causes the device to report on "Operational" state before the device
initialization is finished. Although the char device is not yet exposed
to the user at this stage, the sysfs entries are exposed.
This can cause errors in monitoring applications that use the sysfs
entries.
In order to avoid this, a new state "in device creation" is introduced
to ne reported when the device is not disabled but is still in init
flow.
Signed-off-by: Omer Shpigelman <oshpigelman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Acked-by: Takashi Iwai <tiwai@suse.de>
---
drivers/misc/habanalabs/common/device.c | 3 +++
drivers/misc/habanalabs/common/habanalabs.h | 2 +-
.../misc/habanalabs/common/habanalabs_drv.c | 8 ++++++--
drivers/misc/habanalabs/common/sysfs.c | 20 +++++++------------
include/uapi/misc/habanalabs.h | 4 +++-
5 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/include/uapi/misc/habanalabs.h b/include/uapi/misc/habanalabs.h
index a47a731e4527..b4b681b81df8 100644
--- a/include/misc/habanalabs.h
+++ b/include/misc/habanalabs.h
@@ -276,7 +276,9 @@ enum hl_device_status {
HL_DEVICE_STATUS_OPERATIONAL,
HL_DEVICE_STATUS_IN_RESET,
HL_DEVICE_STATUS_MALFUNCTION,
- HL_DEVICE_STATUS_NEEDS_RESET
+ HL_DEVICE_STATUS_NEEDS_RESET,
+ HL_DEVICE_STATUS_IN_DEVICE_CREATION,
+ HL_DEVICE_STATUS_LAST = HL_DEVICE_STATUS_IN_DEVICE_CREATION
};
/* Opcode for management ioctl
--
2.26.2