[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200713155424.24721-2-oded.gabbay@gmail.com>
Date: Mon, 13 Jul 2020 18:54:23 +0300
From: Oded Gabbay <oded.gabbay@...il.com>
To: linux-kernel@...r.kernel.org, SW_Drivers@...ana.ai
Subject: [PATCH 2/3] habanalabs: create common folder
For internal needs of our CI we need to move all the common code into a
common folder instead of putting them in the root folder of the driver.
Same applies to the common header files under include/
Signed-off-by: Oded Gabbay <oded.gabbay@...il.com>
---
drivers/misc/habanalabs/Makefile | 11 +++++------
drivers/misc/habanalabs/common/Makefile | 9 +++++++++
drivers/misc/habanalabs/{ => common}/asid.c | 0
drivers/misc/habanalabs/{ => common}/command_buffer.c | 0
.../misc/habanalabs/{ => common}/command_submission.c | 0
drivers/misc/habanalabs/{ => common}/context.c | 0
drivers/misc/habanalabs/{ => common}/debugfs.c | 0
drivers/misc/habanalabs/{ => common}/device.c | 0
drivers/misc/habanalabs/{ => common}/firmware_if.c | 2 +-
drivers/misc/habanalabs/{ => common}/habanalabs.h | 4 ++--
drivers/misc/habanalabs/{ => common}/habanalabs_drv.c | 0
.../misc/habanalabs/{ => common}/habanalabs_ioctl.c | 0
drivers/misc/habanalabs/{ => common}/hl_dma_fence.c | 0
drivers/misc/habanalabs/{ => common}/hl_dma_fence.h | 0
drivers/misc/habanalabs/{ => common}/hw_queue.c | 0
drivers/misc/habanalabs/{ => common}/hwmon.c | 0
drivers/misc/habanalabs/{ => common}/irq.c | 0
drivers/misc/habanalabs/{ => common}/memory.c | 0
drivers/misc/habanalabs/{ => common}/mmu.c | 0
drivers/misc/habanalabs/{ => common}/pci.c | 0
drivers/misc/habanalabs/{ => common}/sysfs.c | 0
drivers/misc/habanalabs/gaudi/Makefile | 2 +-
drivers/misc/habanalabs/gaudi/gaudiP.h | 2 +-
drivers/misc/habanalabs/goya/goyaP.h | 2 +-
.../misc/habanalabs/include/{ => common}/armcp_if.h | 0
.../misc/habanalabs/include/{ => common}/hl_boot_if.h | 0
.../misc/habanalabs/include/{ => common}/qman_if.h | 0
27 files changed, 20 insertions(+), 12 deletions(-)
create mode 100644 drivers/misc/habanalabs/common/Makefile
rename drivers/misc/habanalabs/{ => common}/asid.c (100%)
rename drivers/misc/habanalabs/{ => common}/command_buffer.c (100%)
rename drivers/misc/habanalabs/{ => common}/command_submission.c (100%)
rename drivers/misc/habanalabs/{ => common}/context.c (100%)
rename drivers/misc/habanalabs/{ => common}/debugfs.c (100%)
rename drivers/misc/habanalabs/{ => common}/device.c (100%)
rename drivers/misc/habanalabs/{ => common}/firmware_if.c (99%)
rename drivers/misc/habanalabs/{ => common}/habanalabs.h (99%)
rename drivers/misc/habanalabs/{ => common}/habanalabs_drv.c (100%)
rename drivers/misc/habanalabs/{ => common}/habanalabs_ioctl.c (100%)
rename drivers/misc/habanalabs/{ => common}/hl_dma_fence.c (100%)
rename drivers/misc/habanalabs/{ => common}/hl_dma_fence.h (100%)
rename drivers/misc/habanalabs/{ => common}/hw_queue.c (100%)
rename drivers/misc/habanalabs/{ => common}/hwmon.c (100%)
rename drivers/misc/habanalabs/{ => common}/irq.c (100%)
rename drivers/misc/habanalabs/{ => common}/memory.c (100%)
rename drivers/misc/habanalabs/{ => common}/mmu.c (100%)
rename drivers/misc/habanalabs/{ => common}/pci.c (100%)
rename drivers/misc/habanalabs/{ => common}/sysfs.c (100%)
rename drivers/misc/habanalabs/include/{ => common}/armcp_if.h (100%)
rename drivers/misc/habanalabs/include/{ => common}/hl_boot_if.h (100%)
rename drivers/misc/habanalabs/include/{ => common}/qman_if.h (100%)
diff --git a/drivers/misc/habanalabs/Makefile b/drivers/misc/habanalabs/Makefile
index 83b0e9ac35d6..a786c0a7de9a 100644
--- a/drivers/misc/habanalabs/Makefile
+++ b/drivers/misc/habanalabs/Makefile
@@ -3,16 +3,15 @@
# Makefile for HabanaLabs AI accelerators driver
#
-obj-m := habanalabs.o
+obj-$(CONFIG_HABANA_AI) := habanalabs.o
-habanalabs-y := habanalabs_drv.o device.o context.o asid.o habanalabs_ioctl.o \
- command_buffer.o hw_queue.o irq.o sysfs.o hwmon.o memory.o \
- command_submission.o mmu.o firmware_if.o pci.o hl_dma_fence.o
-
-habanalabs-$(CONFIG_DEBUG_FS) += debugfs.o
+include $(src)/common/Makefile
+habanalabs-y += $(HL_COMMON_FILES)
include $(src)/goya/Makefile
habanalabs-y += $(HL_GOYA_FILES)
include $(src)/gaudi/Makefile
habanalabs-y += $(HL_GAUDI_FILES)
+
+habanalabs-$(CONFIG_DEBUG_FS) += common/debugfs.o
diff --git a/drivers/misc/habanalabs/common/Makefile b/drivers/misc/habanalabs/common/Makefile
new file mode 100644
index 000000000000..1e149f5852c6
--- /dev/null
+++ b/drivers/misc/habanalabs/common/Makefile
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0-only
+subdir-ccflags-y += -I$(src)/common
+
+HL_COMMON_FILES := common/habanalabs_drv.o common/device.o common/context.o \
+ common/asid.o common/habanalabs_ioctl.o \
+ common/command_buffer.o common/hw_queue.o common/irq.o \
+ common/sysfs.o common/hwmon.o common/memory.o \
+ common/command_submission.o common/mmu.o common/firmware_if.o \
+ common/pci.o common/hl_dma_fence.o
diff --git a/drivers/misc/habanalabs/asid.c b/drivers/misc/habanalabs/common/asid.c
similarity index 100%
rename from drivers/misc/habanalabs/asid.c
rename to drivers/misc/habanalabs/common/asid.c
diff --git a/drivers/misc/habanalabs/command_buffer.c b/drivers/misc/habanalabs/common/command_buffer.c
similarity index 100%
rename from drivers/misc/habanalabs/command_buffer.c
rename to drivers/misc/habanalabs/common/command_buffer.c
diff --git a/drivers/misc/habanalabs/command_submission.c b/drivers/misc/habanalabs/common/command_submission.c
similarity index 100%
rename from drivers/misc/habanalabs/command_submission.c
rename to drivers/misc/habanalabs/common/command_submission.c
diff --git a/drivers/misc/habanalabs/context.c b/drivers/misc/habanalabs/common/context.c
similarity index 100%
rename from drivers/misc/habanalabs/context.c
rename to drivers/misc/habanalabs/common/context.c
diff --git a/drivers/misc/habanalabs/debugfs.c b/drivers/misc/habanalabs/common/debugfs.c
similarity index 100%
rename from drivers/misc/habanalabs/debugfs.c
rename to drivers/misc/habanalabs/common/debugfs.c
diff --git a/drivers/misc/habanalabs/device.c b/drivers/misc/habanalabs/common/device.c
similarity index 100%
rename from drivers/misc/habanalabs/device.c
rename to drivers/misc/habanalabs/common/device.c
diff --git a/drivers/misc/habanalabs/firmware_if.c b/drivers/misc/habanalabs/common/firmware_if.c
similarity index 99%
rename from drivers/misc/habanalabs/firmware_if.c
rename to drivers/misc/habanalabs/common/firmware_if.c
index 3be1549cd137..b2b84510b932 100644
--- a/drivers/misc/habanalabs/firmware_if.c
+++ b/drivers/misc/habanalabs/common/firmware_if.c
@@ -6,7 +6,7 @@
*/
#include "habanalabs.h"
-#include "include/hl_boot_if.h"
+#include "include/common/hl_boot_if.h"
#include <linux/firmware.h>
#include <linux/genalloc.h>
diff --git a/drivers/misc/habanalabs/habanalabs.h b/drivers/misc/habanalabs/common/habanalabs.h
similarity index 99%
rename from drivers/misc/habanalabs/habanalabs.h
rename to drivers/misc/habanalabs/common/habanalabs.h
index 3f9270ace869..c362df319d17 100644
--- a/drivers/misc/habanalabs/habanalabs.h
+++ b/drivers/misc/habanalabs/common/habanalabs.h
@@ -8,8 +8,8 @@
#ifndef HABANALABSP_H_
#define HABANALABSP_H_
-#include "include/armcp_if.h"
-#include "include/qman_if.h"
+#include "include/common/armcp_if.h"
+#include "include/common/qman_if.h"
#include <uapi/misc/habanalabs.h>
#include <linux/cdev.h>
diff --git a/drivers/misc/habanalabs/habanalabs_drv.c b/drivers/misc/habanalabs/common/habanalabs_drv.c
similarity index 100%
rename from drivers/misc/habanalabs/habanalabs_drv.c
rename to drivers/misc/habanalabs/common/habanalabs_drv.c
diff --git a/drivers/misc/habanalabs/habanalabs_ioctl.c b/drivers/misc/habanalabs/common/habanalabs_ioctl.c
similarity index 100%
rename from drivers/misc/habanalabs/habanalabs_ioctl.c
rename to drivers/misc/habanalabs/common/habanalabs_ioctl.c
diff --git a/drivers/misc/habanalabs/hl_dma_fence.c b/drivers/misc/habanalabs/common/hl_dma_fence.c
similarity index 100%
rename from drivers/misc/habanalabs/hl_dma_fence.c
rename to drivers/misc/habanalabs/common/hl_dma_fence.c
diff --git a/drivers/misc/habanalabs/hl_dma_fence.h b/drivers/misc/habanalabs/common/hl_dma_fence.h
similarity index 100%
rename from drivers/misc/habanalabs/hl_dma_fence.h
rename to drivers/misc/habanalabs/common/hl_dma_fence.h
diff --git a/drivers/misc/habanalabs/hw_queue.c b/drivers/misc/habanalabs/common/hw_queue.c
similarity index 100%
rename from drivers/misc/habanalabs/hw_queue.c
rename to drivers/misc/habanalabs/common/hw_queue.c
diff --git a/drivers/misc/habanalabs/hwmon.c b/drivers/misc/habanalabs/common/hwmon.c
similarity index 100%
rename from drivers/misc/habanalabs/hwmon.c
rename to drivers/misc/habanalabs/common/hwmon.c
diff --git a/drivers/misc/habanalabs/irq.c b/drivers/misc/habanalabs/common/irq.c
similarity index 100%
rename from drivers/misc/habanalabs/irq.c
rename to drivers/misc/habanalabs/common/irq.c
diff --git a/drivers/misc/habanalabs/memory.c b/drivers/misc/habanalabs/common/memory.c
similarity index 100%
rename from drivers/misc/habanalabs/memory.c
rename to drivers/misc/habanalabs/common/memory.c
diff --git a/drivers/misc/habanalabs/mmu.c b/drivers/misc/habanalabs/common/mmu.c
similarity index 100%
rename from drivers/misc/habanalabs/mmu.c
rename to drivers/misc/habanalabs/common/mmu.c
diff --git a/drivers/misc/habanalabs/pci.c b/drivers/misc/habanalabs/common/pci.c
similarity index 100%
rename from drivers/misc/habanalabs/pci.c
rename to drivers/misc/habanalabs/common/pci.c
diff --git a/drivers/misc/habanalabs/sysfs.c b/drivers/misc/habanalabs/common/sysfs.c
similarity index 100%
rename from drivers/misc/habanalabs/sysfs.c
rename to drivers/misc/habanalabs/common/sysfs.c
diff --git a/drivers/misc/habanalabs/gaudi/Makefile b/drivers/misc/habanalabs/gaudi/Makefile
index f802cdc980ca..75104ae74e2b 100644
--- a/drivers/misc/habanalabs/gaudi/Makefile
+++ b/drivers/misc/habanalabs/gaudi/Makefile
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
-subdir-ccflags-y += -I$(src)
+subdir-ccflags-y += -I$(src)/common
HL_GAUDI_FILES := gaudi/gaudi.o gaudi/gaudi_hwmgr.o gaudi/gaudi_security.o \
gaudi/gaudi_coresight.o
diff --git a/drivers/misc/habanalabs/gaudi/gaudiP.h b/drivers/misc/habanalabs/gaudi/gaudiP.h
index bdc5f96085a7..a94ab6a180f0 100644
--- a/drivers/misc/habanalabs/gaudi/gaudiP.h
+++ b/drivers/misc/habanalabs/gaudi/gaudiP.h
@@ -10,7 +10,7 @@
#include <uapi/misc/habanalabs.h>
#include "habanalabs.h"
-#include "include/hl_boot_if.h"
+#include "include/common/hl_boot_if.h"
#include "include/gaudi/gaudi_packets.h"
#include "include/gaudi/gaudi.h"
#include "include/gaudi/gaudi_async_events.h"
diff --git a/drivers/misc/habanalabs/goya/goyaP.h b/drivers/misc/habanalabs/goya/goyaP.h
index 8265cc21b45a..9e674cf39fd9 100644
--- a/drivers/misc/habanalabs/goya/goyaP.h
+++ b/drivers/misc/habanalabs/goya/goyaP.h
@@ -10,7 +10,7 @@
#include <uapi/misc/habanalabs.h>
#include "habanalabs.h"
-#include "include/hl_boot_if.h"
+#include "include/common/hl_boot_if.h"
#include "include/goya/goya_packets.h"
#include "include/goya/goya.h"
#include "include/goya/goya_async_events.h"
diff --git a/drivers/misc/habanalabs/include/armcp_if.h b/drivers/misc/habanalabs/include/common/armcp_if.h
similarity index 100%
rename from drivers/misc/habanalabs/include/armcp_if.h
rename to drivers/misc/habanalabs/include/common/armcp_if.h
diff --git a/drivers/misc/habanalabs/include/hl_boot_if.h b/drivers/misc/habanalabs/include/common/hl_boot_if.h
similarity index 100%
rename from drivers/misc/habanalabs/include/hl_boot_if.h
rename to drivers/misc/habanalabs/include/common/hl_boot_if.h
diff --git a/drivers/misc/habanalabs/include/qman_if.h b/drivers/misc/habanalabs/include/common/qman_if.h
similarity index 100%
rename from drivers/misc/habanalabs/include/qman_if.h
rename to drivers/misc/habanalabs/include/common/qman_if.h
--
2.17.1
Powered by blists - more mailing lists