Skip to content

Commit e2c9d8a

Browse files
Merge pull request #11 from neuron-code-sharing-robot/pr-aws-neuron-aws-neuron-driver-master
[master][12-20-2025] Squash merge of RPM aws-neuronx-dkms-2.25.4.0.noarch.rpm contents
2 parents fca19f7 + ec131bf commit e2c9d8a

36 files changed

+2874
-864
lines changed

Kbuild

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ neuron-objs += neuron_dmabuf.o
1414
neuron-objs += neuron_log.o
1515
neuron-objs += neuron_power.o
1616
neuron-objs += vc/neuron_dhal_vc.o
17-
neuron-objs += v1/fw_io.o v1/putils.o v1/neuron_dhal_v1.o
1817
neuron-objs += v2/notific.o v2/neuron_dhal_v2.o
1918
neuron-objs += v3/notific.o v3/neuron_dhal_v3.o v3/neuron_pelect.o
20-
19+
neuron-objs += v4/neuron_dhal_v4.o
2120
ccflags-y += -O3 -Wall -Werror -Wno-declaration-after-statement -Wunused-macros -Wunused-local-typedefs
2221
ccflags-y += -I$(src)/
2322
ccflags-y += $(call cc-option,-march=armv8.2-a)

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ Neuron Devices implement a communication channel (FWIO) that allows the driver a
4646
* neuron_cdev.c - char device interface.
4747
* fw_io.[ch] - Communication channel
4848
* udma/* - DMA engines and queues HAL
49-
* v1/address_map.h - Neuron Device address space
50-
* v1/putils.h - Notification HAL
51-
* v1/tdma.h - Additional DMA HAL functionality
5249

5350
# Compiling and Installing
5451

dkms.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PACKAGE_NAME=aws-neuronx
2-
PACKAGE_VERSION=2.24.7.0
2+
PACKAGE_VERSION=2.25.4.0
33
BUILT_MODULE_NAME[0]="neuron"
44
MAKE[0]="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build"
55
CLEAN="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build clean"

neuron_arch.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010
#define pr_fmt(fmt) "%s:%s: " fmt, KBUILD_MODNAME, __func__
1111

1212
#include "neuron_arch.h"
13+
#include <linux/slab.h>
14+
#include <linux/mm.h>
15+
#include <linux/string.h>
16+
#include <linux/version.h>
17+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
18+
#include <linux/kernel_read_file.h>
19+
#endif
1320

1421
struct neuron_arch_info {
1522
enum neuron_arch arch;
@@ -55,3 +62,31 @@ bool narch_is_emu(void)
5562
BUG_ON(arch_info.arch == NEURON_ARCH_INVALID);
5663
return arch_info.revision == REVID_EMU;
5764
}
65+
66+
int narch_get_instance_type_name(char *instance_type_name, size_t instance_type_name_size) {
67+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
68+
ssize_t len;
69+
ssize_t file_size;
70+
void *buf = kzalloc(PAGE_SIZE, GFP_KERNEL);
71+
72+
if (buf == NULL) {
73+
pr_err("failed to allocate buffer to read instance type");
74+
return -ENOMEM;
75+
}
76+
77+
len = kernel_read_file_from_path("/sys/class/dmi/id/product_name",
78+
0, &buf, 64, &file_size, READING_UNKNOWN);
79+
if (!len) {
80+
pr_err("read instance type failed");
81+
kfree(buf);
82+
return -EIO;
83+
}
84+
85+
snprintf(instance_type_name, instance_type_name_size, "%s", (char *)buf);
86+
87+
kfree(buf);
88+
return 0;
89+
#else
90+
return -ENOSYS;
91+
#endif
92+
}

neuron_arch.h

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,19 @@
1111

1212
enum neuron_arch {
1313
NEURON_ARCH_INVALID,
14-
NEURON_ARCH_V1 = 1,
1514
NEURON_ARCH_V2 = 2,
1615
NEURON_ARCH_V3 = 3,
16+
NEURON_ARCH_V4 = 4,
1717
NEURON_ARCH_NUM
1818
};
1919

20+
enum neuron_platform_type {
21+
NEURON_PLATFORM_TYPE_STD = 0,
22+
NEURON_PLATFORM_TYPE_ULTRASERVER = 1,
23+
NEURON_PLATFORM_TYPE_PDS = 2,
24+
NEURON_PLATFORM_TYPE_INVALID,
25+
};
26+
2027
/**
2128
* narch_init() - Set neuron devices architecture and revision.
2229
*
@@ -55,4 +62,20 @@ bool narch_is_qemu(void);
5562
*/
5663
bool narch_is_emu(void);
5764

65+
/**
66+
* narch_get_instance_type_name() - Reads instance type name from device DMI data.
67+
*
68+
* @instance_type_name: Buffer to store the instance type name string.
69+
* @instance_type_name_size: Size of the instance_type_name buffer.
70+
*
71+
* Note: This function is only available on kernel versions 5.10.0 and above.
72+
*
73+
* Return:
74+
* * 0 if read succeeds,
75+
* * -ENOMEM - Failed to allocate temporary buffer for reading.
76+
* * -EIO - Failed to read the DMI product_name file.
77+
* * -ENOSYS - Kernel version is below 5.10.0, function not supported.
78+
*/
79+
int narch_get_instance_type_name(char *instance_type_name, size_t instance_type_name_size);
80+
5881
#endif

0 commit comments

Comments
 (0)