From 70b2f993ea4a79c298aac4ec1c58089020536ba5 Mon Sep 17 00:00:00 2001 From: Oded Gabbay Date: Mon, 13 Jul 2020 12:21:04 +0300 Subject: [PATCH] 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 Reviewed-by: Omer Shpigelman --- 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}/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 25 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}/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 421ebd903069..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 - -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..97d03b5c8683 --- /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 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 #include 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 14def0d26d2d..82532f1f94cb 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 #include 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/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 #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 #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