Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions drivers/accel/amdxdna/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ ccflags-y += -g -Werror
ccflags-${UMQ_HELLO_TEST} += -DUMQ_HELLO_TEST

obj-m += amdxdna.o

# Only objects that have corresponding .c sources in this directory
amdxdna-y := \
amdxdna_drv.o \
amdxdna_solver.o \
amdxdna_ctx.o \
amdxdna_gem.o \
amdxdna_mailbox.o \
amdxdna_mailbox_helper.o \
amdxdna_pci_drv.o \
amdxdna_pm.o \
amdxdna_sysfs.o \
amdxdna_ubuf.o \
Expand All @@ -40,8 +42,11 @@ amdxdna-$(OFT_CONFIG_AMDXDNA_PCI) += \
aie2_pm.o \
aie2_psp.o \
aie2_smu.o \
aie2_solver.o \
npu1_regs.o \
npu4_regs.o \
npu5_regs.o \
npu6_regs.o \
amdxdna_pci_drv.o \

amdxdna-$(OFT_CONFIG_AMDXDNA_AUX) += \
amdxdna_aux_drv.o
18 changes: 9 additions & 9 deletions drivers/accel/amdxdna/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

KERNEL_VER ?= $(shell uname -r)
KERNEL_SRC ?= /lib/modules/$(KERNEL_VER)/build
XDNA_BUS_TYPE := pci
XDNA_BUS_TYPE := aux

ifeq ($(XDNA_BUS_TYPE), pci)
PCI = y
OF = n
else ifeq ($(XDNA_BUS_TYPE), of)
AUX = n
else ifeq ($(XDNA_BUS_TYPE), aux)
PCI = n
OF = y
AUX = y
else
Comment thread
saifuddin-xilinx marked this conversation as resolved.
Outdated
$(error Unknown XDNA_BUS_TYPE $(XDNA_BUS_TYPE))!!
endif
Expand Down Expand Up @@ -51,19 +51,19 @@ endif

DEFINES += -DMODULE_VER_STR='\"$(MODULE_VER_STR)\"'

ifeq ($(XDNA_BUS_TYPE), of)
DEFINES += -DAMDXDNA_OF
ifeq ($(XDNA_BUS_TYPE), aux)
DEFINES += -DAMDXDNA_AUX
# Generate config_kernel.h when building directly (Yocto/DKMS flow)
modules: $(SRC_DIR)/config_kernel.h
$(MAKE) -C $(KERNEL_SRC) M=$(SRC_DIR) CFLAGS_MODULE="$(DEFINES)" OFT_CONFIG_AMDXDNA_PCI=$(PCI) OFT_CONFIG_AMDXDNA_OF=$(OF) $(USE_LLVM) modules
$(MAKE) -C $(KERNEL_SRC) M=$(SRC_DIR) CFLAGS_MODULE="$(DEFINES)" OFT_CONFIG_AMDXDNA_PCI=$(PCI) OFT_CONFIG_AMDXDNA_AUX=$(AUX) $(USE_LLVM) modules

$(SRC_DIR)/config_kernel.h:
@echo "[INFO] Generating config_kernel.h for OF build..."
@echo "[INFO] Generating config_kernel.h for AUX build..."
@KERNEL_SRC=$(KERNEL_SRC) OUT="$(SRC_DIR)/config_kernel.h" bash $(SRC_DIR)/../../../../tools/configure_kernel.sh
else
# PCI builds: CMake generates config_kernel.h
modules:
$(MAKE) -C $(KERNEL_SRC) M=$(SRC_DIR) CFLAGS_MODULE="$(DEFINES)" OFT_CONFIG_AMDXDNA_PCI=$(PCI) OFT_CONFIG_AMDXDNA_OF=$(OF) $(USE_LLVM) modules
$(MAKE) -C $(KERNEL_SRC) M=$(SRC_DIR) CFLAGS_MODULE="$(DEFINES)" OFT_CONFIG_AMDXDNA_PCI=$(PCI) OFT_CONFIG_AMDXDNA_AUX=$(AUX) $(USE_LLVM) modules
endif

modules_install:
Expand Down
2 changes: 1 addition & 1 deletion drivers/accel/amdxdna/aie2_ctx.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include "aie2_msg_priv.h"
#include "aie2_pci.h"
#include "aie2_solver.h"
#include "amdxdna_solver.h"
#include "amdxdna_ctx.h"
#include "amdxdna_gem.h"
#include "amdxdna_mailbox.h"
Expand Down
2 changes: 1 addition & 1 deletion drivers/accel/amdxdna/aie2_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include "aie2_msg_priv.h"
#include "aie2_pci.h"
#include "aie2_solver.h"
#include "amdxdna_solver.h"
#include "amdxdna_ctx.h"
#include "amdxdna_gem.h"
#include "amdxdna_mailbox.h"
Expand Down
41 changes: 41 additions & 0 deletions drivers/accel/amdxdna/amdxdna_aux_drv.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2022-2024, Advanced Micro Devices, Inc.
*
* Placeholder for AMD XDNA VE2 AUX/Device Tree based driver.
* Parallel to amdxdna_pci_drv.c (PCI-based Ryzen/AIE2 driver).
* Full AUX probe/remove and DRM accel integration to be added later.
*/

#include <linux/auxiliary_bus.h>
#include <linux/module.h>

#define AMDXDNA_VE2_AUX_NAME "amdxdna_ve2"

static const struct auxiliary_device_id amdxdna_ve2_aux_id_table[] = {
{ .name = AMDXDNA_VE2_AUX_NAME },
{}
};

MODULE_DEVICE_TABLE(auxiliary, amdxdna_ve2_aux_id_table);

static int amdxdna_ve2_aux_probe(struct auxiliary_device *auxdev,
const struct auxiliary_device_id *id)
{
/* Placeholder: full VE2 DRM accel device init to be implemented */
return 0;
}
Comment thread
saifuddin-xilinx marked this conversation as resolved.

static void amdxdna_ve2_aux_remove(struct auxiliary_device *auxdev)
{
/* Placeholder: full VE2 device teardown to be implemented */
}

static struct auxiliary_driver amdxdna_ve2_aux_driver = {
.name = AMDXDNA_VE2_AUX_NAME,
.probe = amdxdna_ve2_aux_probe,
.remove = amdxdna_ve2_aux_remove,
.id_table = amdxdna_ve2_aux_id_table,
};

module_auxiliary_driver(amdxdna_ve2_aux_driver);
2 changes: 1 addition & 1 deletion drivers/accel/amdxdna/amdxdna_ctx.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include "amdxdna_ctx.h"
#include "amdxdna_gem.h"
#include "amdxdna_pci_drv.h"
#include "amdxdna_drv.h"

#define MAX_HWCTX_ID 255
#define MAX_ARG_COUNT 4095
Expand Down
Loading