diff --git a/drivers/misc/habanalabs/Makefile b/drivers/misc/habanalabs/Makefile index 421ebd903069bf5ada429ec1886abf642069fe21..a786c0a7de9ac98dacdc184355a7336f050ae83c 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 0000000000000000000000000000000000000000..97d03b5c8683589c9faa5145e7051cdc052f96d9 --- /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 3be1549cd1378c2354fa7bdee9843a18b79d9a82..b2b84510b932f0d00b01a735ca8486a474f183b5 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 14def0d26d2d9717f8ba25e35d6747a11fc07625..82532f1f94cb7139c07d10fde7b8cd0d04ab3f6c 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 f802cdc980ca535b928c30d2a706878b94d6e422..75104ae74e2b02ab734e15ffde0d7656e8f6e2b4 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 bdc5f96085a7783c60a7e320216611098fda5d5e..a94ab6a180f0baa9947de1bb1ae3de1d7ec1aeb1 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 8265cc21b45a913b8929a41fc5cdb052698a6dbc..9e674cf39fd9b723cb54edffa54ddd65cea10dc9 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