Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Does not go to the interrupt handler when generating the MSI interrupt driver for the module on the PciExpress bus (OS QNX 6.5.0 X86): (10 Items)
   
Does not go to the interrupt handler when generating the MSI interrupt driver for the module on the PciExpress bus (OS QNX 6.5.0 X86)  
Good afternoon everyone!

There is a board with the Pci Express bus, this board implements the work of MSI interrupts

I wrote the driver for Linux, MSI interrupts are enabled via the pci_msi_anable function and everything worked fine 
until I had a need to rewrite the driver under QNX 6.5.0

according to the documentation for the pci server (standard, which is installed with QNX), it's enough just to pass the 
PCI_USE_MSI flag to the function pci_attach_device and everything will be set up ... but that just does not work ...
 
I changed the bootloader QNX so that it loads startup-apic and pci-bios-v2
 
in the driver I connect to the pci server and initialize msi interrupts, then I connect the interrupt handler, but the 
driver does not enter the interrupt handler (there are no messages from the handler), and I know for sure that the 
message packet msi leaves the tlp module, it is ignored on the QNX side or blocked
 
loader and driver code for initializing the module with msi interrupts under QNX 6.5, as well as the pci -vvv log and 
the driver download log I am attaching
 
dear forum users, did anyone have experience of including MSI interrupts under QNX 6.5.0 X86, share, please experience, 
2 weeks already I fight, so far no result ????
 
thank you waiting for an answer
Attachment: Text log_pciv.txt 1.51 KB Text qnxbasesmp-apic.build 2.23 KB Text drv_log.txt 1.73 KB Text driver_msi.c 10.04 KB
Re: Does not go to the interrupt handler when generating the MSI interrupt driver for the module on the PciExpress bus (OS QNX 6.5.0 X86)  
Please can you supply the complete "pci -vv" from the system? I see that the PCI server is using address 0xfee00000 for 
the apic, so that might be the problem. Maybe the apic on your system is at a different address.

Thanks, Hugh.

On 2018-02-13, 2:29 AM, "matrix dasd" <community-noreply@qnx.com> wrote:

    Good afternoon everyone!
    
    There is a board with the Pci Express bus, this board implements the work of MSI interrupts
    
    I wrote the driver for Linux, MSI interrupts are enabled via the pci_msi_anable function and everything worked fine 
until I had a need to rewrite the driver under QNX 6.5.0
    
    according to the documentation for the pci server (standard, which is installed with QNX), it's enough just to pass 
the PCI_USE_MSI flag to the function pci_attach_device and everything will be set up ... but that just does not work ...

     
    I changed the bootloader QNX so that it loads startup-apic and pci-bios-v2
     
    in the driver I connect to the pci server and initialize msi interrupts, then I connect the interrupt handler, but 
the driver does not enter the interrupt handler (there are no messages from the handler), and I know for sure that the 
message packet msi leaves the tlp module, it is ignored on the QNX side or blocked
     
    loader and driver code for initializing the module with msi interrupts under QNX 6.5, as well as the pci -vvv log 
and the driver download log I am attaching
     
    dear forum users, did anyone have experience of including MSI interrupts under QNX 6.5.0 X86, share, please 
experience, 2 weeks already I fight, so far no result ????
     
    thank you waiting for an answer
    
    
    
    _______________________________________________
    
    General
    http://community.qnx.com/sf/go/post118563
    To cancel your subscription to this discussion, please e-mail general-community-unsubscribe@community.qnx.com
    

Re: Does not go to the interrupt handler when generating the MSI interrupt driver for the module on the PciExpress bus (OS QNX 6.5.0 X86)  
Thanks, Hugh, for your reply

the whole log of pci -vvv I'm attaching

but how can this happen ?? because the pci server itself configures the capability of the msi registers, and not I in 
the program itself write down these addresses and the value

it turns out that the pci server itself incorrectly configures the apic controller?

I checked on 2 computers, on one is just bios, on another uefi bios, in Linux I had problems with switching to uefi bios
, because programmer that wrote before I forgot to call the driver pci_master_enable (), and uefi bios did not skip msi 
interrupts with this configuration, but in QNX the module is a master and can go to the pciexpress bus ...
Attachment: Text log_pcivv_all.txt 39.73 KB
Re: Does not go to the interrupt handler when generating the MSI interrupt driver for the module on the PciExpress bus (OS QNX 6.5.0 X86)  
I see that your RTL8169 Ethernet controller is using MSI-X interrupts, so if that is working, it means that the APIC 
controller is working.
Do you have a bus analyzer on the system to see the MSI interrupt for your device?

On 2018-02-13, 8:45 AM, "matrix dasd" <community-noreply@qnx.com> wrote:

    Thanks, Hugh, for your reply
    
    the whole log of pci -vvv I'm attaching
    
    but how can this happen ?? because the pci server itself configures the capability of the msi registers, and not I 
in the program itself write down these addresses and the value
    
    it turns out that the pci server itself incorrectly configures the apic controller?
    
    I checked on 2 computers, on one is just bios, on another uefi bios, in Linux I had problems with switching to uefi 
bios, because programmer that wrote before I forgot to call the driver pci_master_enable (), and uefi bios did not skip 
msi interrupts with this configuration, but in QNX the module is a master and can go to the pciexpress bus ...
    
    
    
    _______________________________________________
    
    General
    http://community.qnx.com/sf/go/post118567
    To cancel your subscription to this discussion, please e-mail general-community-unsubscribe@community.qnx.com
    

Re: Does not go to the interrupt handler when generating the MSI interrupt driver for the module on the PciExpress bus (OS QNX 6.5.0 X86)  
Unfortunately, this is my first experience of developing drivers for QNX, I do not know much about how it is possible at
 least on the side of QNX to see if the operating system has fixed the interrupt arrival, as in linux (the proc / 
interrupts file)

On the module side, the interrupt is exactly gone; this is seen on the chipscope, I see that the corresponding registers
 in the module are correctly configured, with the same module configuration on Linux, the interrupts come
Re: Does not go to the interrupt handler when generating the MSI interrupt driver for the module on the PciExpress bus (OS QNX 6.5.0 X86)  
Looking at the outputs that you sent, it appears that everything is setup correctly for MSI interrupts.
Have you tried running "startup-bios" and "pci-bios" to see if your device works with non-msi interrupts?


On 2018-02-13, 9:42 AM, "matrix dasd" <community-noreply@qnx.com> wrote:

    Unfortunately, this is my first experience of developing drivers for QNX, I do not know much about how it is 
possible at least on the side of QNX to see if the operating system has fixed the interrupt arrival, as in linux (the 
proc / interrupts file)
    
    On the module side, the interrupt is exactly gone; this is seen on the chipscope, I see that the corresponding 
registers in the module are correctly configured, with the same module configuration on Linux, the interrupts come
    
    
    
    _______________________________________________
    
    General
    http://community.qnx.com/sf/go/post118570
    To cancel your subscription to this discussion, please e-mail general-community-unsubscribe@community.qnx.com
    

Re: Does not go to the interrupt handler when generating the MSI interrupt driver for the module on the PciExpress bus (OS QNX 6.5.0 X86)  
Yes, I tried, but the driver did not enter the interrupt handler.

I made the driver log with and without the apic bootloader ("startup-bios" and "pci-bios"), as well as the pci -vvv log 
after downloading the driver in both cases, these logs I made on the work computer where uefi bios stands (the previous 
ones were made from a home computer)

in QNX are there any tools (utilities, programs, files) that let you see whether there was an interruption at all?
Attachment: Text pciv_not_msi.txt 43.04 KB Text drv_log_dont_use_msi.txt 1.75 KB Text pciv_use_msi.txt 43.08 KB Text drv_log_use_msi.txt 1.76 KB
Re: Does not go to the interrupt handler when generating the MSI interrupt driver for the module on the PciExpress bus (OS QNX 6.5.0 X86)  
Well if the BIOS interrupts didn't work, then it isn't a QNX problem.

Hugh.

On 2018-02-14, 4:16 AM, "matrix dasd" <community-noreply@qnx.com> wrote:

    Yes, I tried, but the driver did not enter the interrupt handler.
    
    I made the driver log with and without the apic bootloader ("startup-bios" and "pci-bios"), as well as the pci -vvv 
log after downloading the driver in both cases, these logs I made on the work computer where uefi bios stands (the 
previous ones were made from a home computer)
    
    in QNX are there any tools (utilities, programs, files) that let you see whether there was an interruption at all?
    
    
    
    _______________________________________________
    
    General
    http://community.qnx.com/sf/go/post118576
    To cancel your subscription to this discussion, please e-mail general-community-unsubscribe@community.qnx.com
    

Re: Does not go to the interrupt handler when generating the MSI interrupt driver for the module on the PciExpress bus (OS QNX 6.5.0 X86)  
Many thanks for the help, finally, figured out)))

rewrote the code via InterruptAttachEvent, everything worked

The problem was that the functions printf and MsgDeliverEvent can not be used in the interrupt handler, I did not know 
that there are such limitations in QNX (I'll repeat once again, this is my first experience writing drivers for QNX, I 
wrote mostly for Linux)

formally did this - in the process of initialization a thread_irq is created, which registers an interrupt and waits for
 it, sends a signal

void *thread_irq(void *arg)
{	uint32_t ri, mi, mci, rci;
    int eu = 0;
    unsigned int minor = *(unsigned int *)arg;

    struct sigevent int_event; //текущее событие

    struct sigevent event;
    int i = 0,err = 0;

    printf("\nDEV_MIL_DRV_UDx: Start irq_thread(), minor = %d",minor);

	//записываем номер MSI прерывания
	device_mil[minor].irq_num = device_mil[minor].pci_info.Irq;
	if(device_mil[minor].pci_info.msi)	printf("\nDEV_MIL_DRV_UDx: MSI enable, MSI irq is %d",device_mil[minor].irq_num);
	else printf("\nDEV_MIL_DRV_UDx: !!! MSI DON'T ENABLE, YOU MUST DON'T USE INTERRUPT FOR WORK WITH MODULE!!!");

	// создаем поток для драйвера(должны быть root права)
    if(ThreadCtl(_NTO_TCTL_IO, 0) != EOK){
        printf("\nDEV_MIL_DRV_UDx: You must be root!");
        pthread_exit((void*)-1);
    }

	//регистрируем обработчик прерывания
	int_event.sigev_notify = SIGEV_INTR;
	device_mil[minor].di.int_id = InterruptAttachEvent(device_mil[minor].irq_num,&int_event,0);
	if(device_mil[minor].di.int_id == -1)
	{	printf("\nDEV_MIL_DRV_UDx: error interrupt attach");
		perror("\nInterruptAttach:");
		pthread_exit((void*)-1);
	}

	while(1){
		//ожидаем прерывания
		InterruptWait( 0, NULL);

		printf("\nDEV_MIL_DRV_UDx: irq_handler(): begin.\n");
                
                !!!!!code!!!!

        }
}

now I will only use InterruptAttachEvent)))

Once again many thanks for the help !!!)))
Re: Does not go to the interrupt handler when generating the MSI interrupt driver for the module on the PciExpress bus (OS QNX 6.5.0 X86)  
Thanks for letting us know.

Hugh.

On 2018-02-15, 7:14 AM, "matrix dasd" <community-noreply@qnx.com> wrote:

    Many thanks for the help, finally, figured out)))
    
    rewrote the code via InterruptAttachEvent, everything worked
    
    The problem was that the functions printf and MsgDeliverEvent can not be used in the interrupt handler, I did not 
know that there are such limitations in QNX (I'll repeat once again, this is my first experience writing drivers for QNX
, I wrote mostly for Linux)
    
    formally did this - in the process of initialization a thread_irq is created, which registers an interrupt and waits
 for it, sends a signal
    
    void *thread_irq(void *arg)
    {	uint32_t ri, mi, mci, rci;
        int eu = 0;
        unsigned int minor = *(unsigned int *)arg;
    
        struct sigevent int_event; //текущее событие
    
        struct sigevent event;
        int i = 0,err = 0;
    
        printf("\nDEV_MIL_DRV_UDx: Start irq_thread(), minor = %d",minor);
    
    	//записываем номер MSI прерывания
    	device_mil[minor].irq_num = device_mil[minor].pci_info.Irq;
    	if(device_mil[minor].pci_info.msi)	printf("\nDEV_MIL_DRV_UDx: MSI enable, MSI irq is %d",device_mil[minor].irq_num)
;
    	else printf("\nDEV_MIL_DRV_UDx: !!! MSI DON'T ENABLE, YOU MUST DON'T USE INTERRUPT FOR WORK WITH MODULE!!!");
    
    	// создаем поток для драйвера(должны быть root права)
        if(ThreadCtl(_NTO_TCTL_IO, 0) != EOK){
            printf("\nDEV_MIL_DRV_UDx: You must be root!");
            pthread_exit((void*)-1);
        }
    
    	//регистрируем обработчик прерывания
    	int_event.sigev_notify = SIGEV_INTR;
    	device_mil[minor].di.int_id = InterruptAttachEvent(device_mil[minor].irq_num,&int_event,0);
    	if(device_mil[minor].di.int_id == -1)
    	{	printf("\nDEV_MIL_DRV_UDx: error interrupt attach");
    		perror("\nInterruptAttach:");
    		pthread_exit((void*)-1);
    	}
    
    	while(1){
    		//ожидаем прерывания
    		InterruptWait( 0, NULL);
    
    		printf("\nDEV_MIL_DRV_UDx: irq_handler(): begin.\n");
                    
                    !!!!!code!!!!
    
            }
    }
    
    now I will only use InterruptAttachEvent)))
    
    Once again many thanks for the help !!!)))
    
    
    
    _______________________________________________
    
    General
    http://community.qnx.com/sf/go/post118581
    To cancel your subscription to this discussion, please e-mail general-community-unsubscribe@community.qnx.com