Skip to content
Merged
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
21 changes: 18 additions & 3 deletions Kbuild
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
obj-m += neuron.o

neuron-objs := neuron_module.o neuron_pci.o neuron_mempool.o neuron_dma.o neuron_ring.o
neuron-objs += neuron_core.o neuron_cdev.o
neuron-objs += udma/udma_iofic.o udma/udma_m2m.o udma/udma_main.o v1/fw_io.o
neuron-objs := neuron_arch.o neuron_dhal.o
neuron-objs += neuron_reg_access.o
neuron-objs += neuron_module.o neuron_pci.o neuron_mempool.o neuron_dma.o neuron_ring.o neuron_ds.o
neuron-objs += neuron_core.o neuron_crwl.o neuron_cdev.o neuron_topsp.o neuron_pid.o
neuron-objs += neuron_reset.o neuron_cinit.o neuron_mmap.o neuron_p2p.o
neuron-objs += neuron_nq.o
neuron-objs += neuron_mc_handle.o
neuron-objs += neuron_metrics.o neuron_sysfs_metrics.o
neuron-objs += udma/udma_iofic.o udma/udma_m2m.o udma/udma_main.o
neuron-objs += neuron_fw_io.o
neuron-objs += neuron_dmabuf.o
neuron-objs += neuron_log.o
neuron-objs += neuron_power.o
neuron-objs += vc/neuron_dhal_vc.o
neuron-objs += v1/fw_io.o v1/putils.o v1/neuron_dhal_v1.o
neuron-objs += v2/notific.o v2/neuron_dhal_v2.o
neuron-objs += v3/notific.o v3/neuron_dhal_v3.o v3/neuron_pelect.o

ccflags-y += -O3 -Wall -Werror -Wno-declaration-after-statement -Wunused-macros -Wunused-local-typedefs
ccflags-y += -I$(src)/
ccflags-y += $(call cc-option,-march=armv8.2-a)
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
ARCH ?= x86_64
KERNEL_SRC_DIR ?= /lib/modules/$(shell uname -r)/build

all:
make -C $(KERNEL_SRC_DIR) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) M=$(PWD) modules
make -C $(KERNEL_SRC_DIR) M=$(PWD) modules

clean:
make -C $(KERNEL_SRC_DIR) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) M=$(PWD) clean
make -C $(KERNEL_SRC_DIR) M=$(PWD) clean

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ Neuron Devices implement a communication channel (FWIO) that allows the driver a
* neuron_dma.[ch] - Provides APIs to copy data from/to device memory.
* neuron_mempool.[ch] - Provides API to allocate host and device memory.
* neuron_cdev.c - char device interface.
* fw_io.[ch] - Communication channel
* udma/* - DMA engines and queues HAL
* v1/address_map.h - Neuron Device address space
* v1/fw_io.[ch] - Communication channel
* v1/putils.h - Notification HAL
* v1/tdma.h - Additional DMA HAL functionality

Expand Down
31 changes: 31 additions & 0 deletions aws-neuronx-dkms-mkdeb/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#/usr/bin/make
SRC = $(DESTDIR)/usr/src
SHARE = $(DESTDIR)/usr/share/$(NAME)-dkms

all:

clean:

install:

#source tree
ifeq ("$(wildcard $(NAME)-$(VERSION))", "$(NAME)-$(VERSION)")
install -d "$(SRC)"
cp -a $(NAME)-$(VERSION) $(SRC)
chmod 644 -R "$(SRC)/$(NAME)-$(VERSION)"
chmod +x "$(SRC)/$(NAME)-$(VERSION)/preinstall"
chmod +x "$(SRC)/$(NAME)-$(VERSION)/postinstall"
chmod +x "$(SRC)/$(NAME)-$(VERSION)/postremove"
endif

#tarball, possibly with binaries
ifeq ("$(wildcard $(NAME)-$(VERSION).dkms.tar.gz)", "$(NAME)-$(VERSION).dkms.tar.gz")
install -d "$(SHARE)"
install -m 644 $(NAME)-$(VERSION).dkms.tar.gz "$(SHARE)"
endif

#postinst, only if we are supporting legacy mode
ifeq ("$(wildcard common.postinst)", "common.postinst")
install -d "$(SHARE)"
install -m 755 $(PREFIX)/usr/lib/dkms/common.postinst $(SHARE)/postinst
endif
5 changes: 5 additions & 0 deletions aws-neuronx-dkms-mkdeb/debian/README.Debian
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
MODULE_NAME DKMS module for Debian

This package was automatically generated by the DKMS system,
for distribution on Debian based operating systems.

6 changes: 6 additions & 0 deletions aws-neuronx-dkms-mkdeb/debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
DEBIAN_PACKAGE-dkms (MODULE_VERSION) stable; urgency=low

* Automatically packaged by DKMS.

-- Dynamic Kernel Modules Support Team <[email protected]> DATE_STAMP

1 change: 1 addition & 0 deletions aws-neuronx-dkms-mkdeb/debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7
12 changes: 12 additions & 0 deletions aws-neuronx-dkms-mkdeb/debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Source: DEBIAN_PACKAGE-dkms
Section: misc
Priority: optional
Maintainer: Dynamic Kernel Modules Support Team <[email protected]>
Build-Depends: debhelper (>= 7), dkms
Standards-Version: 3.8.1

Package: DEBIAN_PACKAGE-dkms
Architecture: DEBIAN_BUILD_ARCH
Depends: dkms (>= 1.95), ${misc:Depends}
Description: DEBIAN_PACKAGE driver in DKMS format.
Conflicts: aws-neuron-dkms
2 changes: 2 additions & 0 deletions aws-neuronx-dkms-mkdeb/debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

This copyright has not been completed by the author of this package.
1 change: 1 addition & 0 deletions aws-neuronx-dkms-mkdeb/debian/dirs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/src
49 changes: 49 additions & 0 deletions aws-neuronx-dkms-mkdeb/debian/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/sh
# Copyright (C) 2002-2005 Flavio Stanchina
# Copyright (C) 2005-2006 Aric Cyr
# Copyright (C) 2007 Mario Limonciello
# Copyright (C) 2009 Alberto Milone

set -e

NAME=MODULE_NAME
PACKAGE_NAME=$NAME-dkms
DEB_NAME=$(echo $PACKAGE_NAME | sed 's,_,-,')
CVERSION=`dpkg-query -W -f='${Version}' $DEB_NAME | awk -F "-" '{print $1}' | cut -d\: -f2`
ARCH=`dpkg --print-architecture`

dkms_configure () {
for POSTINST in /usr/lib/dkms/common.postinst "/usr/share/$PACKAGE_NAME/postinst"; do
if [ -f "$POSTINST" ]; then
"$POSTINST" "$NAME" "$CVERSION" "/usr/share/$PACKAGE_NAME" "$ARCH" "$2"
return $?
fi
echo "WARNING: $POSTINST does not exist." >&2
done
echo "ERROR: DKMS version is too old and $PACKAGE_NAME was not" >&2
echo "built with legacy DKMS support." >&2
echo "You must either rebuild $PACKAGE_NAME with legacy postinst" >&2
echo "support or upgrade DKMS to a more current version." >&2
return 1
}

case "$1" in
configure)
dkms_configure
;;

abort-upgrade|abort-remove|abort-deconfigure)
;;

*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0
28 changes: 28 additions & 0 deletions aws-neuronx-dkms-mkdeb/debian/prerm
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh

NAME=MODULE_NAME
VERSION=MODULE_VERSION

set -e

case "$1" in
remove|upgrade|deconfigure)
if [ "`dkms status -m $NAME`" ]; then
dkms remove -m $NAME -v $VERSION --all
fi
;;

failed-upgrade)
;;

*)
echo "prerm called with unknown argument \`$1'" >&2
exit 1
;;
esac

#DEBHELPER#

exit 0


54 changes: 54 additions & 0 deletions aws-neuronx-dkms-mkdeb/debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

DEB_NAME=DEBIAN_PACKAGE
NAME=MODULE_NAME
VERSION=MODULE_VERSION

configure: configure-stamp
configure-stamp:
dh_testdir
touch configure-stamp


build: build-stamp

build-stamp: configure-stamp
dh_testdir
$(MAKE)
touch $@

clean:
dh_testdir
dh_testroot
rm -f build-stamp configure-stamp
-$(MAKE) clean
dh_clean

install: build
dh_testdir
dh_testroot
dh_prep
dh_installdirs
$(MAKE) DESTDIR=$(CURDIR)/debian/$(DEB_NAME)-dkms NAME=$(NAME) VERSION=$(VERSION) install

binary-arch: build install

binary-indep: build install
dh_testdir
dh_testroot
dh_link
dh_strip
dh_compress
dh_fixperms
dh_installdeb
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb -- -Zxz

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure
82 changes: 82 additions & 0 deletions aws-neuronx-dkms-mkrpm.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
%{?!module_name: %{error: You did not specify a module name (%%module_name)}}
%{?!version: %{error: You did not specify a module version (%%version)}}
%{?!kernel_versions: %{error: You did not specify kernel versions (%%kernel_version)}}
%{?!packager: %define packager DKMS <[email protected]>}
%{?!license: %define license GPL-2.0}
%{?!_dkmsdir: %define _dkmsdir /var/lib/dkms}
%{?!_srcdir: %define _srcdir %_prefix/src}
%{?!_datarootdir: %define _datarootdir %{_datadir}}

Summary: %{module_name} %{version} dkms package
Name: aws-neuronx-dkms
Version: %{version}
License: %license
Release: dkms
BuildArch: noarch
Group: System/Kernel
Requires: dkms >= 1.95
BuildRequires: dkms
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root/
Conflicts: aws-neuron-dkms

%description
Kernel modules for %{module_name} %{version} in a DKMS wrapper.

%prep
if [ "%mktarball_line" != "none" ]; then
/usr/sbin/dkms mktarball -m %module_name -v %version %mktarball_line --archive `basename %{module_name}-%{version}.dkms.tar.gz`
cp -af %{_dkmsdir}/%{module_name}/%{version}/tarball/`basename %{module_name}-%{version}.dkms.tar.gz` %{module_name}-%{version}.dkms.tar.gz
fi

%install
if [ "$RPM_BUILD_ROOT" != "/" ]; then
rm -rf $RPM_BUILD_ROOT
fi
mkdir -p $RPM_BUILD_ROOT/%{_srcdir}
mkdir -p $RPM_BUILD_ROOT/%{_datarootdir}/%{module_name}

if [ -d %{_sourcedir}/%{module_name}-%{version} ]; then
cp -Lpr %{_sourcedir}/%{module_name}-%{version} $RPM_BUILD_ROOT/%{_srcdir}
fi

if [ -f %{module_name}-%{version}.dkms.tar.gz ]; then
install -m 644 %{module_name}-%{version}.dkms.tar.gz $RPM_BUILD_ROOT/%{_datarootdir}/%{module_name}
fi

if [ -f %{_sourcedir}/common.postinst ]; then
install -m 755 %{_sourcedir}/common.postinst $RPM_BUILD_ROOT/%{_datarootdir}/%{module_name}/postinst
fi

%clean
if [ "$RPM_BUILD_ROOT" != "/" ]; then
rm -rf $RPM_BUILD_ROOT
fi

%post
for POSTINST in %{_prefix}/lib/dkms/common.postinst %{_datarootdir}/%{module_name}/postinst; do
if [ -f $POSTINST ]; then
$POSTINST %{module_name} %{version} %{_datarootdir}/%{module_name}
exit $?
fi
echo "WARNING: $POSTINST does not exist."
done
echo -e "ERROR: DKMS version is too old and %{module_name} was not"
echo -e "built with legacy DKMS support."
echo -e "You must either rebuild %{module_name} with legacy postinst"
echo -e "support or upgrade DKMS to a more current version."
exit 1

%preun
echo -e
echo -e "Uninstall of %{module_name} module (version %{version}) beginning:"
dkms remove -m %{module_name} -v %{version} --all --rpm_safe_upgrade
exit 0

%files
%defattr(-,root,root)
%{_srcdir}
%{_datarootdir}/%{module_name}/

%changelog
* %(date "+%a %b %d %Y") %packager %{version}-%{release}
- Automatic build by DKMS
5 changes: 3 additions & 2 deletions dkms.conf
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
PACKAGE_NAME=aws-neuron
PACKAGE_VERSION=1.0
PACKAGE_NAME=aws-neuronx
PACKAGE_VERSION=2.24.7.0
BUILT_MODULE_NAME[0]="neuron"
MAKE[0]="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build"
CLEAN="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build clean"
DEST_MODULE_LOCATION[0]=/kernel/drivers/neuron/
REMAKE_INITRD=no
AUTOINSTALL=yes
NO_WEAK_MODULES=yes
PRE_INSTALL=./preinstall
POST_INSTALL=./postinstall
POST_REMOVE=./postremove
Loading