Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
16 changes: 8 additions & 8 deletions drivers/accel/amdxdna/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ XDNA_BUS_TYPE := pci

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
$(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
1 change: 0 additions & 1 deletion drivers/accel/amdxdna/aie2_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,6 @@ static int aie2_init_exec_req(void *req, struct amdxdna_gem_obj *cmd_abo,
int ret;
u32 op;


op = amdxdna_cmd_get_op(cmd_abo);
switch (op) {
case ERT_START_CU:
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
44 changes: 44 additions & 0 deletions drivers/accel/amdxdna/amdxdna_aux_drv.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2022-2026, Advanced Micro Devices, Inc.
*/

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

#include "amdxdna_drv.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 -ENODEV;
}

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);

MODULE_LICENSE(AMDXDNA_MODULE_LICENSE);
MODULE_AUTHOR(AMDXDNA_MODULE_AUTHOR);
MODULE_VERSION(AMDXDNA_MODULE_VERSION);
MODULE_DESCRIPTION(AMDXDNA_MODULE_DESCRIPTION);
3 changes: 1 addition & 2 deletions 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 Expand Up @@ -503,7 +503,6 @@ int amdxdna_cmd_submit(struct amdxdna_client *client,
goto unlock_srcu;
}


job->hwctx = hwctx;
job->mm = current->mm;

Expand Down
Loading