matrix-io / matrixio-kernel-modules

MATRIX HAL in kernel space
22 stars 23 forks source link

"warning: the frame size of 1232 bytes is larger than 1024 bytes" on aarch64 compilation #51

Open HinTak opened 3 years ago

HinTak commented 3 years ago

This is seen on ubuntu 20.04.1 aarch64 :

dtc -W no-unit_address_vs_reg -@ -I dts -O dtb -o matrixio.dtbo matrixio.dts
make -C /lib/modules/5.4.0-1022-raspi/build M=/home/ubuntu/matrixio-kernel-modules/src modules
make[1]: Entering directory '/usr/src/linux-headers-5.4.0-1022-raspi'
  CC [M]  /home/ubuntu/matrixio-kernel-modules/src/matrixio-core.o
/home/ubuntu/matrixio-kernel-modules/src/matrixio-core.c: In function ‘matrixio_register_devices’:
/home/ubuntu/matrixio-kernel-modules/src/matrixio-core.c:221:1: warning: the frame size of 1232 bytes is larger than 1024 bytes [-Wframe-larger-than=]
  221 | }
      | ^
...

Probably harmless and easy to fix. Interestingly enough not seen on x86_64 - I assume it is because on x86_64, members of structures don't need to be aligned to 64-bit, so may be packed closer?

floppy286 commented 3 years ago

Hi, what is the procedure to compile and install those kernel modules for 64bit raspbian or ubuntu ?

HinTak commented 3 years ago

For current raspbian (they switched to v5.10 last week) you need this https://github.com/matrix-io/matrixio-kernel-modules/pull/53 - Afaik ubuntu focal is still at 5.4; likely ubuntu groovy is at 5.10.

floppy286 commented 3 years ago

When i try to follow procedure i receive following errors:

echo "deb https://apt.matrix.one/raspbian $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/matrixlabs.list deb https://apt.matrix.one/raspbian buster main

sudo apt-get update Get:8 https://apt.matrix.one/raspbian buster/main armhf Packages [4,422 B] Fetched 10.4 kB in 2s (4,672 B/s) Reading package lists... Done N: Skipping acquire of configured file 'main/binary-arm64/Packages' as repository 'https://apt.matrix.one/raspbian buster InRelease' doesn't support architecture 'arm64'

and i cannot install sudo apt install matrixio-creator-init

i have installed:

sudo apt-get -y install raspberrypi-kernel-headers raspberrypi-kernel git

correctly, but when i try to clone and make your #53 repo i get following error messages:

pi@raspberrypi:~/matrix/new/matrixio-kernel-modules/src make

make -C /lib/modules/5.10.11-v8+/build M=/home/pi/matrix/new/matrixio-kernel-modules/src modules make[1]: Entering directory '/usr/src/linux-headers-5.10.11-v8+' CC [M] /home/pi/matrix/new/matrixio-kernel-modules/src/matrixio-everloop.o In file included from ./arch/arm64/include/asm/uaccess.h:11, from /home/pi/matrix/new/matrixio-kernel-modules/src/matrixio-everloop.c:1: ./arch/arm64/include/asm/kernel-pgtable.h:132:31: warning: "PUD_SHIFT" is not defined, evaluates to 0 [-Wundef]

define ARM64_MEMSTART_SHIFT PUD_SHIFT

                           ^~~~~~~~~

./arch/arm64/include/asm/kernel-pgtable.h:145:42: note: in expansion of macro ‘ARM64_MEMSTART_SHIFT’

if defined(CONFIG_SPARSEMEM_VMEMMAP) && ARM64_MEMSTART_SHIFT < SECTION_SIZE_BITS

                                      ^~~~~~~~~~~~~~~~~~~~

In file included from ./arch/arm64/include/asm/uaccess.h:22, from /home/pi/matrix/new/matrixio-kernel-modules/src/matrixio-everloop.c:1: ./arch/arm64/include/asm/mmu.h:51:55: error: unknown type name ‘bp_hardening_data’; did you mean ‘bp_hardening_cb_t’? DECLARE_PER_CPU_READ_MOSTLY(struct bp_hardening_data, bp_hardening_data); ^~~~~ bp_hardening_cb_t ./arch/arm64/include/asm/mmu.h: In function ‘arm64_get_bp_hardening_data’: ./arch/arm64/include/asm/mmu.h:55:9: error: implicit declaration of function ‘this_cpu_ptr’; did you mean ‘this_cpu_has_cap’? [-Werror=implicit-function-declaration] return this_cpu_ptr(&bp_hardening_data); ^~~~ this_cpu_has_cap ./arch/arm64/include/asm/mmu.h:55:23: error: ‘bp_hardening_data’ undeclared (first use in this function) return this_cpu_ptr(&bp_hardening_data); ^~~~~ ./arch/arm64/include/asm/mmu.h:55:23: note: each undeclared identifier is reported only once for each function it appears in ./arch/arm64/include/asm/mmu.h: At top level: ./arch/arm64/include/asm/mmu.h:77:11: error: unknown type name ‘pgprot_t’; did you mean ‘pgoff_t’? pgprot_t prot, bool page_mappings_only); ^~~~ pgoff_t ./arch/arm64/include/asm/mmu.h:78:63: error: unknown type name ‘pgprot_t’; did you mean ‘pgoff_t’? extern void fixmap_remap_fdt(phys_addr_t dt_phys, int size, pgprot_t prot); ^~~~ pgoff_t In file included from /home/pi/matrix/new/matrixio-kernel-modules/src/matrixio-everloop.c:1: ./arch/arm64/include/asm/uaccess.h:29:27: error: unknown type name ‘mm_segment_t’; did you mean ‘mm_context_t’? static inline void set_fs(mm_segment_t fs) ^~~~ mm_context_t ./arch/arm64/include/asm/uaccess.h: In function ‘range_ok’: ./arch/arm64/include/asm/uaccess.h:64:29: error: implicit declaration of function ‘current_thread_info’ [-Werror=implicit-function-declaration] unsigned long ret, limit = current_thread_info()->addr_limit; ^~~~~~~ ./arch/arm64/include/asm/uaccess.h:64:50: error: invalid type argument of ‘->’ (have ‘int’) unsigned long ret, limit = current_thread_info()->addr_limit; ^~ ./arch/arm64/include/asm/uaccess.h:72:7: error: ‘current’ undeclared (first use in this function) (current->flags & PF_KTHREAD || test_thread_flag(TIF_TAGGED_ADDR))) ^~~ ./arch/arm64/include/asm/uaccess.h:72:24: error: ‘PF_KTHREAD’ undeclared (first use in this function) (current->flags & PF_KTHREAD || test_thread_flag(TIF_TAGGED_ADDR))) ^~~~~~ ./arch/arm64/include/asm/uaccess.h:72:38: error: implicit declaration of function ‘test_thread_flag’ [-Werror=implicit-function-declaration] (current->flags & PF_KTHREAD || test_thread_flag(TIF_TAGGED_ADDR))) ^~~~ ./arch/arm64/include/asm/uaccess.h:72:55: error: ‘TIF_TAGGED_ADDR’ undeclared (first use in this function); did you mean ‘KIMAGE_VADDR’? (current->flags & PF_KTHREAD || test_thread_flag(TIF_TAGGED_ADDR))) ^~~~~~~ KIMAGE_VADDR ./arch/arm64/include/asm/uaccess.h: In function ‘uaccess_mask_ptr’: ./arch/arm64/include/asm/uaccess.h:240:41: error: invalid type argument of ‘->’ (have ‘int’) : "r" (ptr), "r" (current_thread_info()->addr_limit), ^~ In file included from ./include/linux/sched/task.h:11, from ./include/linux/sched/signal.h:9, from ./include/linux/rcuwait.h:6, from ./include/linux/percpu-rwsem.h:7, from ./include/linux/fs.h:33, from /home/pi/matrix/new/matrixio-kernel-modules/src/matrixio-everloop.c:3: ./include/linux/uaccess.h: In function ‘force_uaccess_begin’: ./include/linux/uaccess.h:23:2: error: implicit declaration of function ‘set_fs’; did you mean ‘get_fs’? [-Werror=implicit-function-declaration] set_fs(USER_DS); ^~ get_fs cc1: some warnings being treated as errors make[2]: [scripts/Makefile.build:279: /home/pi/matrix/new/matrixio-kernel-modules/src/matrixio-everloop.o] Error 1 make[1]: [Makefile:1808: /home/pi/matrix/new/matrixio-kernel-modules/src] Error 2 make[1]: Leaving directory '/usr/src/linux-headers-5.10.11-

HinTak commented 3 years ago

@floppy286 you likely need to do "git checkout -b v5.9 origin/v5.9" to switch to that branch, after cloning.

floppy286 commented 3 years ago

Thanks a lot! compilation passes smoothly but when I try to do sudo make install i get such warrning:

pi@raspberrypi:~/matrix/new/matrixio-kernel-modules/src` $ sudo make install

make -C /lib/modules/5.10.14-v8+/build M=/home/pi/matrix/new/matrixio-kernel-modules/src modules_install make[1]: Entering directory '/usr/src/linux-headers-5.10.14-v8+' INSTALL /home/pi/matrix/new/matrixio-kernel-modules/src/matrixio-codec.ko INSTALL /home/pi/matrix/new/matrixio-kernel-modules/src/matrixio-core.ko INSTALL /home/pi/matrix/new/matrixio-kernel-modules/src/matrixio-env.ko INSTALL /home/pi/matrix/new/matrixio-kernel-modules/src/matrixio-everloop.ko INSTALL /home/pi/matrix/new/matrixio-kernel-modules/src/matrixio-gpio.ko INSTALL /home/pi/matrix/new/matrixio-kernel-modules/src/matrixio-imu.ko INSTALL /home/pi/matrix/new/matrixio-kernel-modules/src/matrixio-mic.ko INSTALL /home/pi/matrix/new/matrixio-kernel-modules/src/matrixio-playback.ko INSTALL /home/pi/matrix/new/matrixio-kernel-modules/src/matrixio-regmap.ko INSTALL /home/pi/matrix/new/matrixio-kernel-modules/src/matrixio-uart.ko DEPMOD 5.10.14-v8 Warning: modules_install: missing 'System.map' file. Skipping depmod. make[1]: Leaving directory '/usr/src/linux-headers-5.10.14-v8+' depmod -A cp matrixio.dtbo /boot/overlays

After performin last steps :

Add in /boot/config.txt

dtoverlay=matrixio

Finally, load the remaining required modules

sudo cp ~/matrixio-kernel-modules/misc/matrixio.conf /etc/modules-load.d/ sudo cp ~/matrixio-kernel-modules/misc/asound.conf /etc/ sudo reboot

i see added device in arecord and aplay but when i've try to do arecord i have the same efect as revievers in #53 - no sound is in fact recorded, no sound is played on matrixio mic

i have 5.10.14-v8 kernel

Thanks in advance

floppy286 commented 3 years ago

This is what i have:

pi@raspberrypi:~ $ arecord -l

List of CAPTURE Hardware Devices card 0: MATRIXIOSOUND [MATRIXIO-SOUND], device 0: matrixio.mic.0 snd-soc-dummy-dai-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0

pi@raspberrypi:~ $ arecord -D hw:0,0 -f S16_LE -d 5 rec2.wav

Recording WAVE 'rec2.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono arecord: set_params:1403: Unable to install hw params: ACCESS: RW_INTERLEAVED FORMAT: S16_LE SUBFORMAT: STD SAMPLE_BITS: 16 FRAME_BITS: 16 CHANNELS: 1 RATE: 8000 PERIOD_TIME: 64000 PERIOD_SIZE: 512 PERIOD_BYTES: 1024 PERIODS: 16 BUFFER_TIME: 1024000 BUFFER_SIZE: 8192 BUFFER_BYTES: 16384 TICK_TIME: 0

no sound is recorded, no sound is played by aplay either