Segmentation issue on calling outb function Apalis iMX6

Dear @raja,

We are eagerly waiting for your input.

Thanks,
bevincb

Dear @bevinb,

Thank you for your patience.

Are you trying to access 03:00.0 Non-VGA unclassified device: Device 4453:0c00 device? We don’t have a similar device.

Did you set (General setup->Configure standard Kernel features (expert users)->Sysctl syscall support->Enable) to enable the system call for the inb() and outb() from user space.

Could you try outl or inl as described here : http://www.embeddedlinux.org.cn/essentiallinuxdevicedrivers/final/ch10lev1sec3.html

Also, try readl and writel APIs as described here : https://www.oreilly.com/library/view/linux-device-drivers/0596005903/ch09.html, let us know the feedback.

Dear @raja.tx,

Are you trying to access 03:00.0 Non-VGA unclassified device: Device 4453:0c00 device? We don’t have a similar device.

Yes, Please let us know whether you were able to read and write any IO based PCI device[ which returns true for if(pci_resource_flags(dev, 0) & IORESOURCE_IO) where dev is return from pci_get_device function]. If you were able to read any IO based PCI device, please let us know.

Did you set (General setup->Configure standard Kernel features (expert users)->Sysctl syscall support->Enable) to enable the system call for the inb() and outb() from user space.

According to our requirement, we need to access the device IO from kernel space.

Could you try outl or inl as described here : http://www.embeddedlinux.org.cn/essentiallinuxdevicedrivers/final/ch10lev1sec3.html

Checked and confirmed that outl is working fine by toggling user led. But inl is reading 0

Also, try readl and writel APIs as described here : 9. Communicating with Hardware - Linux Device Drivers, 3rd Edition [Book]

Getting segmentation fault with “Unable to handle kernel paging request at virtual address 00001074”

Dear @raja.tx ,

We got Apalis imx6 source from one of our alliance company. Can you please provide the source code for Apalis-iMX6_LXDE-Image-Tezi_2.8b6.184 in any compressed format. We followed the links in toradex site to get the source, but it is taking too long for download. We were able to flash Apalis-iMX6_LXDE-Image-Tezi_2.8b6.184 image got from toradex site using toradex easy installer, so if you can provide the source, we will be able to build kernel module and will be helpful to do debugging.

Thanks,
bevincb

Dear @bevincb,

Did you try to download this branch: toradex_4.9-2.3.x-imx from http://git.toradex.com/cgit/linux-toradex.git/? This is for the kernel, device tree.

Does it take a long time to download the source code? Please let me know if you really need a compressed format then I would do that.

Thank you.

Dear @raja.tx,

It is taking long for git clone. Can you please provide the compressed source for Apalis imx6. Will be very helpful if you can provide the source of Apalis-iMX6_LXDE-Image-Tezi_2.8b6.184. We are using a custom board with Apalis imx6 and we were able to boot the board properly with Apalis-iMX6_LXDE-Image-Tezi_2.8b6.184 image from toradex site. We would like to have the source for Apalis-iMX6_LXDE-Image-Tezi_2.8b6.184. Thanks for your support.

Thanks,
bevincb

Dear @raja.tx,

Please include .config also ,which was used to build Apalis-iMX6_LXDE-Image-Tezi_2.8b6.184.

Thanks,
bevincb

Dear @bevincb,

As you requested, compressed Linux-kernel without git repo files that uploaded here : https://share.toradex.com/96sigig594d3qyi

I used 7z compression method with the following options : peazip_portable-6.9.2.LINUX.x86_64.GTK2/res/7z/7z’ a -t7z -m0=LZMA2 -mmt=on -mx9 -md=64m -mfb=64 -ms=4g -mqs=on -bb0 -bse0 -bsp2. Use any 7z extract tool to extract the source code.

Please let us know if you face any issues with this.

Dear @raja.tx,

Thanks for the source code.

We have tried with the image built from the source. When we try to enable the device using pci_enable_device function, we are getting error as below.

pci 0000:03:00.0: can’t enable device: BAR 0 [io 0xffffff00-0xffffffff] not claimed

When we use pci_assign_resource function to allocate resource from driver before pci_enable_device function call and trying to read the register at offset 0x74 using inb, we are getting Segmentation fault at terminal where the module is loaded. The corresponding dmesg log tells that

Unhandled fault: external abort on non-linefetch (0x1008) at 0xfee01074)

Seems like resources are not allocated for this device at enumeration time. We don’t have any idea on what exactly is causing this issue of resources not allocated. In dmesg log after booting, it is showing

pci 0000:03:00.0: [4453:0c00] type 00 class 0x000000

pci 0000:03:00.0: reg 0x10: [io 0xffffff00-0xffffffff]

Can you please provide some inputs to debug this issue, like in which file and which kernel functions we need to check or any idea on what may be causing this issue.

Thanks,

bevincb

Dear @bevincb,

We don’t any endpoint device with IO memory. But PCI switch reports IO memory. Could you share your test application/module source code with us, let me quickly modify the VID/PID or class parameter in your application and try to access the reported IO memory address and then let you know the result.

Dear @raja.tx,

Please find the kernel module init code below. Please try to read any io registers and let us know the outcome.

 {
  int rc=0;
  unsigned long base = 0;
  volatile unsigned int read;
  dev = pci_get_device(VENDOR_ID,DEVICE_ID,NULL);
 if(dev == NULL)
    {
        printk("Device not found \n");
        return -1;
    }
    rc = pci_enable_device(dev);

    if (rc)
    {
        printk("pci_enable_device function failed \n");
        return rc;
    }
    base = pci_resource_start(dev, 0);
    if(base)
    {
        read = inb((base+0x79));
        printk(KERN_INFO "Reg(0x79) val: %08x %d\n",read,read);
   }

}

When we checked the dmesg log we found that, for our device io range is not assigned properly. I am debugging in kernel source.

I found that while PCI enumeration, __pci_read_base function is called. In this function the value ‘l’ read at the beginning of the function from BAR0 is associated with the range of io assigned. For our device, it is reading 0xffff ff01. For i210, it was reading 0000 0001. Can you please provide your inputs on which function is assigning this (BAR)value for the PCI devices.

Thanks,
bevincb

Dear @raja.tx,

Please find my contact number: +918848619402 (India)

Thanks,
bevincb

Dear @raja.tx,

Please let me know if you faced any issues while trying to contact me.

Thanks,
bevincb

Dear @raja.tx,

When we try to enable pci driver in uboot source using menuconfig, the build is failing.
The .config was generated using make apalis_imx6_defconfig

Please provide your inputs.

Thanks,
bevincb

Hi @bevincb

Could you share your .config file and the error log?

Thanks and best regards,
Jaski

link text

link text

link text

Dear @jaski.tx,

Please find the attached .config file and error log on executing make. The .config file was renamed at the time of uploading since we faced difficulty to upload with name as .config

Thanks,
bevincb

Thanks for the files.

What is your use-case for PCIe in U-Boot?
We never activated and tested for any SoM except for Apalis T30 and Apalis TK1.