Message-ID: Content-Type: multipart/alternative; boundary="_551aee14-d93a-4ef4-a94a-37c85515f42a_" From: krishna m Date: Fri, 25 Mar 2011 17:51:06 +0530 In-Reply-To: References: , <4D80BA8B.7050803@domain.hid>, <4D81C6AD.8050803@domain.hid>, , , <4D88925C.3040609@domain.hid>, , <4D88D39D.907@domain.hid>, <4D88D66F.6020605@domain.hid>, MIME-Version: 1.0 Subject: Re: [Xenomai-core] MSI support in Xenomai List-Id: Xenomai life and development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: gilles.chanteperdrix@xenomai.org, jan.kiszka@domain.hid Cc: xenomai@xenomai.org --_551aee14-d93a-4ef4-a94a-37c85515f42a_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable =20 From: krishnamurthyjs@domain.hid To: gilles.chanteperdrix@xenomai.org jan.kiszka@domain.hid Date: Tue=2C 22 Mar 2011 23:50:27 +0530 CC: xenomai@xenomai.org Subject: Re: [Xenomai-core] MSI support in Xenomai > Date: Tue=2C 22 Mar 2011 18:03:43 +0100 > From: gilles.chanteperdrix@xenomai.org > To: jan.kiszka@domain.hid > CC: krishnamurthyjs@domain.hid xenomai@xenomai.org > Subject: Re: MSI support in Xenomai >=20 > Jan Kiszka wrote: > > On 2011-03-22 16:55=2C krishna m wrote: >=20 > >> Mar 22 21:12:47 localhost kernel: test_dev: Probe for device function= =3D0 > >> Mar 22 21:12:47 localhost kernel: test_dev 0000:15:00.0: found PCI INT= A -> IRQ 10 > >=20 > > Here you get IRQ 10... > >=20 > >> Mar 22 21:12:47 localhost kernel: pci_bar =3D 0xfe000000 > >> Mar 22 21:12:47 localhost kernel: Xenomai: RTDM: RT open handler is de= precated=2C=20 > >> driver requires update. > >> Mar 22 21:12:47 localhost kernel: Xenomai: RTDM: RT close handler is d= eprecated=2C=20 > >> driver requires update. > >=20 > > [ These messages also have a meaning=2C though unrelated to the crash. = ] > >=20 > >> Mar 22 21:12:47 localhost kernel: test_dev: IRQ 16 successfully assign= ed to the=20 > >> device. > >=20 > > ...but here IRQ 16 is assigned. Broken output or a real inconsistency? > >=20 > > Also=2C where is the MSI? You should see log messages about MSI/MSI-X I= RQ > > number assignment when properly enabling the support at PCI level. >=20 > Maybe pci_enable_msi was called after request_irq ? >=20 >=20 > --=20 > Gilles. =20 Just check my code: i do enable MSI (pci_enable_msi) before rtdm_irq_request pasted the code b= elow part of my PCI probe function in the device driver: =20 ...... rtdm_dev =3D kmalloc(sizeof(struct rtdm_device)=2C GFP_KERNEL)=3B if(!rtdm_dev) { printk(KERN_WARNING "RUBICON: kmalloc failed\n")=3B ret =3D -ENOMEM=3B //Insufficient storage space is available. goto fail_pci=3B } //copy the structure to the new memory memcpy(rtdm_dev=2C &rubicon_rtdm_driver=2C sizeof(struct rtdm_device))=3B //create filename snprintf(rtdm_dev->device_name=2C RTDM_MAX_DEVNAME_LEN=2C "rtser%d"=2C 0 /*i*/)=3B rtdm_dev->device_id =3D 0=3B //i=3B //define two other members of the rtdm_device structure rtdm_dev->proc_name =3D rtdm_dev->device_name=3B =20 ret =3D rtdm_dev_register(rtdm_dev)=3B if(ret < 0) { printk(KERN_WARNING"RUBICON: cannot register device\n")=3B goto fail_pci=3B } g_rubicon_context.xen_device =3D rtdm_dev=3B =20 ret =3D pci_enable_msi(dev)=3B if(ret) { printk("RUBICON: Enabling MSI failed wuth error code: 0x%x\n"=2C ret)=3B goto fail_pci=3B } g_rubicon_context.irq =3D dev->irq=3B /* save the allocated IRQ */ g_rubicon_context.dev =3D dev=3B /* Save the PCI queue h/w device ctx */ dev_set_drvdata(dev=2C(void *) &(g_rubicon_context))=3B /* request the irq for the device */ ret =3D rtdm_irq_request(&g_rubicon_context.irq_handle=2C g_rubicon_context.irq=2C rubicon_irq_handler=2C RTDM_IRQTYPE_SHARED=2C "rubicon"=2C (void *)&g_rubicon_context)=3B .... =20 >From IRQ number perspective: Mar 22 21:12:47 localhost kernel: test_dev 0000:15:00.0: found PCI INT A ->= IRQ 10 >>>> is the print from the Kernel PCI Probe and=20 Mar 22 21:12:47 localhost kernel: test_dev: IRQ 16 successfully assigned >>= >>>> is my Print after enabling MSI and registering for irq. =20 I get the similar print with the Plain Linux kernel with the IRQ being assi= gned MSI enabled is irq 20. [Below i have pasted the kernel log of plain li= nux kernel]. I have tested the MSI interrupts and they work fine.=20 Mar 22 23:47:49 localhost kernel: test_dev: Probe for device function=3D0 Mar 22 23:47:49 localhost kernel: test_dev 0000:15:00.0: found PCI INT A ->= IRQ 10 Mar 22 23:47:49 localhost kernel: pci_bar =3D 0xfe000000=20 Mar 22 23:47:49 localhost kernel: test_dev: IRQ 20 successfully assigned to= the device. Mar 22 23:47:49 localhost kernel: test_dev: Probe for device function=3D1 Mar 22 23:47:49 localhost kernel: test_dev: Successfully added test_dev Dev= ice Driver. =20 Just wanted to add 3 more questions: 1. Which versions of Linux=2C Adeos patch and xenomai are tested for stable= MSI functionality ? Please let me know. 2. I am using the Xenomai Version linux-2.6.37=2C xenomai-2.5.6 and adeos-i= pipe-2.6.37-x86-2.9-00. Is this combination fine ? 3. I looked at the /proc/interrupts and with out xenomai loaded [i.e. defau= lt linux kernel] I see my card beaing assigned MSI-EDGE interrupt and with = xenomai kernel i don't see the entry in the /proc/interrupts but in /proc/x= enomai/irq i see this entry=20 IRQ CPU0 =20 16: 0 test_drv 521: 0 [IPI] 524: 869467 [timer] 525: 0 [critical sync] 546: 0 [virtual] thanks -krishna=20 =20 _______________________________________________ Xenomai-core mailing list X= enomai-core@domain.hid https://mail.gna.org/listinfo/xenomai-core = --_551aee14-d93a-4ef4-a94a-37c85515f42a_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable  =3B
From: krishnamurthyjs@domain.hid
To: gilles.chanteperdrix@xenomai.org= =3B jan.kiszka@domain.hid
Date: Tue=2C 22 Mar 2011 23:50:27 +0530
CC= : xenomai@xenomai.org
Subject: Re: [Xenomai-core] MSI support in Xenoma= i

>=3B Date: Tue=2C 22 Mar 2011 18:03:43 +0100
>=3B From: gilles.chant= eperdrix@domain.hid
>=3B To: jan.kiszka@domain.hid
>=3B CC: kri= shnamurthyjs@domain.hid xenomai@xenomai.org
>=3B Subject: Re: MSI= support in Xenomai
>=3B
>=3B Jan Kiszka wrote:
>=3B >=3B= On 2011-03-22 16:55=2C krishna m wrote:
>=3B
>=3B >=3B>=3B = Mar 22 21:12:47 localhost kernel: test_dev: Probe for device function=3D0>=3B >=3B>=3B Mar 22 21:12:47 localhost kernel: test_dev 0000:15:00= .0: found PCI INT A ->=3B IRQ 10
>=3B >=3B
>=3B >=3B Here = you get IRQ 10...
>=3B >=3B
>=3B >=3B>=3B Mar 22 21:12:47 = localhost kernel: pci_bar =3D 0xfe000000
>=3B >=3B>=3B Mar 22 21:1= 2:47 localhost kernel: Xenomai: RTDM: RT open handler is deprecated=2C
= >=3B >=3B>=3B driver requires update.
>=3B >=3B>=3B Mar 22 2= 1:12:47 localhost kernel: Xenomai: RTDM: RT close handler is deprecated=2C =
>=3B >=3B>=3B driver requires update.
>=3B >=3B
>=3B= >=3B [ These messages also have a meaning=2C though unrelated to the cra= sh. ]
>=3B >=3B
>=3B >=3B>=3B Mar 22 21:12:47 localhost ke= rnel: test_dev: IRQ 16 successfully assigned to the
>=3B >=3B>=3B= device.
>=3B >=3B
>=3B >=3B ...but here IRQ 16 is assigned.= Broken output or a real inconsistency?
>=3B >=3B
>=3B >=3B = Also=2C where is the MSI? You should see log messages about MSI/MSI-X IRQ>=3B >=3B number assignment when properly enabling the support at PCI= level.
>=3B
>=3B Maybe pci_enable_msi was called after request_= irq ?
>=3B
>=3B
>=3B --
>=3B Gilles.
 =3B
= Just check my code:
i do enable MSI =3B (= pci_enable_msi) before rtdm_irq_request p= asted the code below part of my PCI probe function in the device driver:
 =3B
......
rtdm_dev =3D kmall= oc(sizeof(struct rtdm_device)=2C GFP_KERNEL)=3B
 =3B =3Bif(!rtdm= _dev) {
 =3B =3B =3Bprintk(KERN_WARNING "RUBICON: kmalloc fa= iled\n")=3B
 =3B =3B =3Bret =3D -ENOMEM=3B //Insufficient st= orage space is available.
 =3B =3B =3Bgoto fail_pci=3B
&n= bsp=3B =3B}


 =3B =3B//= copy the structure to the new memory
 =3B =3Bmemcpy(rtdm_dev=2C = &=3Brubicon_rtdm_driver=2C sizeof(struct rtdm_device))=3B

 = =3B =3B//create filename
 =3B =3Bsnprintf(rtdm_dev->=3Bdev= ice_name=2C
 =3B =3B =3B =3B =3B =3B =3B&nbs= p=3B =3B =3B RTDM_MAX_DEVNAME_LEN=2C "rtser%d"=2C 0 /*i*/)=3B
&n= bsp=3B =3Brtdm_dev->=3Bdevice_id =3D 0=3B //i=3B

 =3B = =3B//define two other members of the rtdm_device structure
 =3B = =3Brtdm_dev->=3Bproc_name =3D rtdm_dev->=3Bdevice_name=3B

 =3B
 = =3B =3Bret =3D rtdm_dev_register(rtdm_dev)=3B
 =3B =3Bif(ret= <=3B 0) {
 =3B =3B =3Bprintk(KERN_WARNING"RUBICON: cannot= register device\n")=3B
 =3B =3B =3Bgoto fail_pci=3B
&nbs= p=3B =3B}

 =3B =3Bg_rubico= n_context.xen_device =3D rtdm_dev=3B
<= /FONT> =3B
 =3B =3Bret =3D pci= _enable_msi(dev)=3B
 =3B = =3Bif(ret) {
 =3B =3B =3Bprintk("RUBICON: Enabling MSI faile= d wuth error code: 0x%x\n"=2C ret)=3B
 =3B =3B =3Bgoto fail_= pci=3B
 =3B =3B}


 = =3B =3Bg_rubicon_context.irq =3D dev->=3Birq=3B /* save the allocated= IRQ */
 =3B =3Bg_rubicon_context.dev =3D dev=3B /* Save the PCI= queue h/w device ctx */

 =3B = =3Bdev_set_drvdata(dev=2C(void *) &=3B(g_rubicon_context))=3B
=  =3B =3B/* request the irq for the devic= e */
 =3B =3Bret =3D rtdm_irq_request(&=3Bg_rubicon_co= ntext.irq_handle=2C
 =3B =3B =3B =3B =3B =3B&nbs= p=3B =3B =3B =3B =3B =3B =3B =3B =3B = =3B =3B =3B =3B =3B =3B =3B =3B =3B g_rubic= on_context.irq=2C
 =3B =3B =3B =3B =3B =3B = =3B =3B =3B =3B =3B =3B =3B =3B =3B =3B=  =3B =3B =3B =3B =3B =3B =3B =3B rubicon_ir= q_handler=2C
 =3B =3B =3B =3B =3B =3B =3B&nb= sp=3B =3B =3B =3B =3B =3B =3B =3B =3B = =3B =3B =3B =3B =3B =3B =3B =3B RTDM_IRQTYPE_SH= ARED=2C
 =3B =3B =3B =3B =3B =3B =3B =3B=  =3B =3B =3B =3B =3B =3B =3B =3B =3B&nb= sp=3B =3B =3B =3B =3B =3B =3B "rubicon"=2C
 = =3B =3B =3B =3B =3B =3B =3B =3B =3B =3B=  =3B =3B =3B =3B =3B =3B =3B =3B =3B&nb= sp=3B =3B =3B =3B =3B (void *)&=3Bg_rubicon_context)=3B<= /FONT>
....
 =3B
From = IRQ number perspective:
Mar 22 = 21:12:47 localhost kernel: test_dev 0000:15:00.0: found PCI INT A ->=3B I= RQ 10 =3B >=3B>=3B>=3B>=3B is the print fro= m the Kernel PCI Probe and
Mar 22 21:12:47 localhost kernel: tes= t_dev: IRQ 16 successfully assigned >=3B>=3B>=3B>=3B>=3B>=3B is my Print after enabling MSI and registering for irq.
 =3B
I get t= he similar print with the Plain Linux kernel with the IRQ being assigned MS= I enabled is irq 20. [Below i have pasted the kernel log of plain linux ker= nel]. I have tested the MSI interrupts and they work fine.
Mar 22 23:47:49 localhost kernel:= test_dev: Probe for device function=3D0
Mar 22 23:47:49 localhost kerne= l: test_dev 0000:15:00.0: found PCI INT A ->=3B IRQ 10
Mar 22 23:47:49= localhost kernel: pci_bar =3D 0xfe000000
Mar 22 23:47:49 localhost ker= nel: test_dev: IRQ 20 successfully assigned to the device.
Mar 22 23:47:= 49 localhost kernel: test_dev: Probe for device function=3D1
Mar 22 23:4= 7:49 localhost kernel: test_dev: Successfully added test_dev Device Driver.=

<= /FONT> =3B
J= ust wanted to add 3 more questions:
1. Which versions of Linux=2C Adeos patch and xe= nomai are tested for stable MSI functionality ? Please let me know.<= BR> 2= . I am using the Xenomai Version linux-2.6.37=2C xenomai-2.5.6 and adeos-ip= ipe-2.6.37-x86-2.9-00. Is =3Bthis combination fine ?
3= . I looked at the /proc/interrupts and with out xenomai loaded [i.e. defaul= t linux kernel] I see my card beaing assigned MSI-EDGE interrupt and with x= enomai kernel i don't see the entry in the /proc/interrupts but in /proc/xe= nomai/irq i see this entry
I= RQ =3B =3B =3B =3B =3B =3B =3B =3B =3B&= nbsp=3B CPU0 =3B =3B
16: =3B =3B =3B&= nbsp=3B =3B =3B =3B =3B =3B =3B =3B =3B&nbs= p=3B 0 =3B =3B =3B =3B =3B =3B test_drv

521: =3B =3B =3B =3B =3B&nbs= p=3B =3B =3B =3B =3B =3B =3B 0 =3B =3B = =3B =3B =3B =3B =3B[IPI]
524: =3B =3B =3B =3B =3B&nbs= p=3B =3B =3B869467 =3B =3B =3B =3B =3B =3B&= nbsp=3B[timer]
525: =3B =3B =3B =3B =3B&nbs= p=3B =3B =3B =3B =3B =3B =3B 0 =3B =3B = =3B =3B =3B =3B =3B[critical sync]
546: =3B =3B =3B =3B =3B&nbs= p=3B =3B =3B =3B =3B =3B =3B 0 =3B =3B = =3B =3B =3B =3B =3B[virtual]

thanks
-krishna
 =3B=

_______________________________________________ Xenomai-core= mailing list Xenomai-core@domain.hid https://mail.gna.org/listinfo/xenomai-co= re
= --_551aee14-d93a-4ef4-a94a-37c85515f42a_--