Friday, July 15, 2011

sgxdbgkm - Checking linux kernel dependencies for SGX

SGX driver depends on 2 main aspects in the linux kernel - Clock settings and frame buffer driver related settings. If there are problems with any of these 2 (clock/fb settings), it will manifest as though its a problem with SGX driver. So in order to check whether kernel is ready for SGX integration, a standalone kernel module - sgxdbgkm has been developed.


This module checks for clocks and framebuffer settings required from a SGX perspective.
It also helps in checking for framework integration like QT.
The sources for sgxdbgkm can be found at -

http://gitorious.org/tigraphics/sgxdbg/trees/master

Instructions to build
===============================
Edit Rules.make to provide Linux kernel installation path (LINUXKERNEL_INSTALL_DIR) and toolchain path (TOOLCHAIN_PATH).
Issue make.
This will create sgxdbgkm.ko. Copy to the target file system.

Instructions to execute
=========================================
Once the board boots up, based on the TI device in use , issue the command as follows-
For OMAP35x
#insmod sgxdbgkm.ko omapes=3
For AM37xx/DM37xx
#insmod sgxdbgkm.ko omapes=5
For 387x(TI814x) -
#insmod sgxdbgkm.ko omapes=6 devname=centaurus
For 389x(TI816x)-
#insmod sgxdbgkm.ko omapes=6
For AM45x-
#insmod sgxdbgkm.ko omapes=7

Sample logs when executed on OMAP35x, 387x(TI814x) devices-

OMAP35x-

=============

root@omap3evm:/opt# insmod sgxdbgkm.ko

sgx kernel clock checks passed

Found RGB565 pixel format

: Framebuffer physical address: 0x805c3000

: Framebuffer virtual address: 0xc9000000

: Framebuffer virtual width: 480

: Framebuffer virtual height: 640

: Framebuffer width: 480

: Framebuffer height: 640

: Framebuffer stride: 960

sgx kernel Framebuffer checks passed

sgx kernel checks passed...Kernel is ready to integrate SGX

387x(TI814x)

==========================

root@arago:/opt# insmod sgxdbgkm.ko omapes=6 devname=centaurus

sgx kernel clock checks passed

Found ARGB8888 pixel format

: Framebuffer physical address: 0x84e00000

: Framebuffer virtual address: 0xc9000000

: Framebuffer virtual width: 1920

: Framebuffer virtual height: 1080

: Framebuffer width: 1920

: Framebuffer height: 1080

: Framebuffer stride: 7680

sgx kernel Framebuffer checks passed

sgx kernel checks passed...Kernel is ready to integrate SGX

Use case showing how sgxdbgkm driver can detect if kernel dependancies/configuration are not met from a SGX perspective-

The default frame buffer setting has alpha(transparency) component set to zero on AM45x. But the QT integration requires alpha (transparency) to be non zero. sgxdbgkm helps in detecting this as shown below-

root@omap4430-panda:/opt# insmod sgxdbgkm.ko omapes=7

sgx kernel clock checks passed
__sgx_kernel_checks: sgx kernel Framebuffer checks failed:Invalid pixel format
sgx_kernel_check_init: sgx kernel checks failed
insmod: error inserting 'sgxdbgkm.ko': -1 No such device

As shown above, sgxdbgkm has detected the problem and prints the error message.

Now setting alpha with fbset -
root@omap4430-panda:/opt# ./fbset -rgba 8/16,8/8,8/0,8/24


root@omap4430-panda:/opt# insmod sgxdbgkm.ko omapes=7

sgx kernel clock checks passed Found ARGB8888 pixel format
: Framebuffer physical address: 0x80b9e000
: Framebuffer virtual address: 0xf1000000
: Framebuffer virtual width: 640
: Framebuffer virtual height: 480
: Framebuffer width: 640
: Framebuffer height: 480
: Framebuffer stride: 2560
sgx kernel Framebuffer checks passed
sgx kernel checks passed...Kernel is ready to integrate SGX

root@omap4430-panda:/opt#

Now the above message indicates that the kernel meets SGX requirements and SGX driver is ready to be integrated and tested.



2 comments:

  1. Hi,

    Thanks for this test module.
    I think I found 2 little bugs :
    - The pointer returned by clk_get has to checked by IS_ERR macro and not tested against NULL.
    - Besides if the core clock is faulty you return 0 and finally say everything is OK

    Regards

    ReplyDelete
  2. Thank you for the feedback - We could incorporate this, do you have a patch anywhere ? Else we would create one.

    ReplyDelete