kernel panic with ivtv on amd64, firmware loading and test_ioctl work fine!

Sven Boeckelmann sven at boeckelmann.org
Fri May 14 16:26:12 UTC 2004


hi im trying to run ivtv on an amd64-

ok, the firmware loading has been fixed.
used : http://kmos.org/~ckennedy/ivtv/ivtv-0.1.10-pre2-ck65f.tgz
to load ivtv successfully.

but the io code does not seem to be 64bit safe.

when accessing the device the kernel crashes:
when executing function ivtv_sched_DMA 

There must be someone out there who is able to check if this
is 64bit safe .. !

Thanks,
sven

PS: if someone can tell me how to save the dmesg of a crashing kernel
    i will submit the stack trace

On Fri, 2004-05-14 at 13:46, Sven Boeckelmann wrote:
> hi,
> 
> i'm trying to get ivtv working on my amd64.
> the driver is compiling on gentoo with kernel 2.6.6, gcc 3.3.3,
> module-init-tools from gentoo sys-apps/module-init-tools-3.0
> 
> 
> but when i'm doing insmod i get a modprobe Ooops:
> 
> ivtv: i2c client attach
> ivtv: i2c attach [client=saa7115[0],ok]
> ivtv: Active card count: 1.
> ivtv: Stopping VDM
> ivtv: Stopping AO
> ivtv: pinging (?) APU
> ivtv: Stopping VPU
> ivtv: Resetting Hw Blocks
> ivtv: Stopping SPU
> ivtv: Sleeping for 10ms
> ivtv: init Encoder SDRAM pre-charge
> ivtv: init Encoder SDRAM refresh to 1us
> ivtv: init Decoder SDRAM pre-charge
> ivtv: init Decoder SDRAM refresh to 1us
> ivtv: Sleeping for 600ms (600 recommended)
> ivtv: Card ready for firmware!
> ivtv: Loading encoder image
> ivtv: Loading decoder firmware
> ivtv: Sleeping for 1 sec
> ivtv: Sleeping for 1 sec
> ivtv: About to search for mailboxes
> ivtv: Searching for encoder mailbox
> ivtv: .<1>Unable to handle kernel paging request at 00000000000c8100
> RIP:
> <ffffffffa02ebdfb>{:ivtv:ivtv_find_firmware_mailbox+75}PML4 38949067 PGD
> 386ad067 PMD 0
> Oops: 0000 [1]
> CPU 0
> Pid: 5714, comm: insmod Tainted: P   2.6.6
> RIP: 0010:[<ffffffffa02ebdfb>]
> <ffffffffa02ebdfb>{:ivtv:ivtv_find_firmware_mailbox+75}RSP:
> 0018:0000010037529dc8  EFLAGS: 00010213
> RAX: ffffff00010c7fff RBX: 0000000000000000 RCX: 000000000000007f
> RDX: 0000000000000000 RSI: 0000000000000001 RDI: ffffffff80463a40
> RBP: 00000000000c8100 R08: 0000000000000034 R09: 000001003f37b0c0
> R10: 0000007fbffff3c3 R11: 0000000000000001 R12: 0000000000000000
> R13: ffffffffa02fd720 R14: 00000000005020a0 R15: 0000000000000003
> FS:  0000002a95ac9060(0000) GS:ffffffff804ce600(0000)
> knlGS:0000000000000000
> CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
> CR2: 00000000000c8100 CR3: 0000000000101000 CR4: 00000000000006e0
> Process insmod (pid: 5714, stackpage=1003e76f000)
> Stack: 0000000000000000 ffffffffa02fd720 000001003fd15000
> 0000000000000000
>        0000000000000000 ffffffffa03056b0 0000010037529e80
> 01164000381e1aa8
>        000001003ff0c3a8 ffffffff801948b1
> Call Trace:<ffffffffa03056b0>{:ivtv:ivtv_probe+1712}
> <ffffffff801948b1>{sysfs_create+113}
>        <ffffffff801951a3>{create_dir+131}
> <ffffffff8022d3cd>{pci_device_probe_static+61}
>        <ffffffff8022d419>{__pci_device_probe+25}
> <ffffffff8022d460>{pci_device_probe+48}
>        <ffffffff8028aad7>{bus_match+71}
> <ffffffff8028abf6>{driver_attach+70}
>        <ffffffff8028ae9e>{bus_add_driver+126}
> <ffffffff8028b212>{driver_register+50}
>        <ffffffff8022d68e>{pci_register_driver+62}
> <ffffffffa02ef1ac>{:ivtv:module_start+716}
>        <ffffffff80148417>{sys_init_module+263}
> <ffffffff8011141a>{system_call+126}
>         
>  
> Code: 8b 45 00 39 04 95 70 ae 2f a0 75 54 ff c3 44 8d 65 04 8d 43
> RIP <ffffffffa02ebdfb>{:ivtv:ivtv_find_firmware_mailbox+75} RSP
> <0000010037529dc8>
> CR2: 00000000000c8100
> 
> 
> i was able to track it down to this portion of the code, 
> but i guess the ivtv code is not able to 64bit at all.
> I habe been in contact with some of the ivtv developers, 
> but none of them use amd64. so it's hard for them to figure out
> where the problem is. I was hoping someone on this list can help.
>                                                                                       
> int ivtv_find_firmware_mailbox(struct ivtv *itv) {
>         u32 *searchptr, *result;
>         int match = 0;
>                                                                                       
>         searchptr = NULL;
>         result    = NULL;
>                                                                                       
>         IVTV_DEBUG(IVTV_DEBUG_INFO, "Searching for encoder mailbox\n");
>         searchptr =(u32 *)(IVTV_FIRM_SEARCH_ENCODER_START +
> itv->io_mem);
>                                                                                       
>         while (searchptr < (u32 *)(IVTV_FIRM_SEARCH_ENCODER_END +
> itv->io_mem)) {
>                 if (ivtv_firm_search_id[match] == readl(searchptr)) {
>                         (u32)result = (u32)searchptr+4; /* avoid pointer
> aritmetic */
>                         match++;
>                         while ((match > 0) && (match < 4)) {
>                                 IVTV_DEBUG(IVTV_DEBUG_INFO, "match:
> 0x%08x at "
>                                            "0x%08x. match: %d\n",
> *result,
>                                            (u32)result, match);
>                                 if (ivtv_firm_search_id[match] ==
> readl(result)) {
>                                         match++;
>                                         /* FIXME change to just
> "result++;" ? */
>                                         (u32)result =  (u32)result + 4;
>                                 }
>                                 else
>                                         match = 0;
>                         }
>                 }
>                 else {
>                         IVTV_DEBUG(IVTV_DEBUG_INFO, ".");
>                 }
>                 if ( 4 == match ) {
>                         IVTV_DEBUG(IVTV_DEBUG_INFO, "found encoder
> mailbox!\n");
> 
>                         itv->enc_mbox = (struct ivtv_mailbox *) result;
>                         break;
>                 }
>                 (u32)searchptr += IVTV_FIRM_SEARCH_STEP;
>         }
>         if (itv->enc_mbox == NULL) IVTV_DEBUG(IVTV_DEBUG_ERR, "Encoder
> mailbox not found\n");
>                                                                                       
>         IVTV_DEBUG(IVTV_DEBUG_INFO, "Searching for decoder mailbox\n");
>         match = 0;
>         searchptr = (u32 *)(IVTV_FIRM_SEARCH_DECODER_START +
> itv->io_mem);
>                                                                                       
>         while (searchptr < (u32 *)(IVTV_FIRM_SEARCH_DECODER_END +
> itv->io_mem)) {
>                 if (ivtv_firm_search_id[match] == readl(searchptr)) {
>                         (u32)result = (u32)searchptr+4;  /* avoid
> pointer aritmetic */                        match++;
>                         while ((match > 0) && (match < 4)) {
>                                 IVTV_DEBUG(IVTV_DEBUG_INFO, "match:
> 0x%08x at 0x%08x. match: %d\n",
>                                         *result, (u32)result, match);
>                                 if (ivtv_firm_search_id[match] ==
> readl(result)) {
>                                         match++;
>                                         /* FIXME change to just
> "result++;" ? */
>                                         (u32)result =  (u32)result + 4;
>                                 }
>                                 else
>                                         match = 0;
>                         }
>                 }
>                 else {
>                         IVTV_DEBUG(IVTV_DEBUG_INFO, ".");
>                 }
>                 if ( 4 == match ) {
>                         IVTV_DEBUG(IVTV_DEBUG_INFO, "found decoder
> mailbox!\n");
>                         itv->dec_mbox = (struct ivtv_mailbox *) result;
>                         break;
>                 }
>                 (u32)searchptr += IVTV_FIRM_SEARCH_STEP;
>         }
>         if (itv->dec_mbox == 0) IVTV_DEBUG(IVTV_DEBUG_ERR, "Decoder
> mailbox not found\n");
>                                                                                       
>         return 0;
> }
> 
> 
> the first time we run into the loop everything is fine,
> but after 
>  (u32)searchptr += IVTV_FIRM_SEARCH_STEP;
> is called
>  readl(searchptr) 
> causes the error.
> 
> i did a quick hack and changed it to:
>  searchptr = (u32 *) (searchptr + IVTV_FIRM_SEARCH_STEP);
> which eliminated the error.
> 
> but of course id didn't make the driver work properly :-(
> 
> no the encoder search loop works, but doesn't find a match at
>  if (ivtv_firm_search_id[match] == readl(searchptr)) {
> 
> and when we start looking for the decoder there is still the same error.
> 
> i guess there is something going wrong with ivtv->io_mem and 
> readl(searchptr).
> 
> unfortunately i don't know much about pointer and address ranges.
> I'm hoping to get in touch with one of the amd64 kernel gurus on this
> list to help us figure out how to get ivtv running on amd64.
> 
> I'm really stuck!
> 
> Cheers,
> Sven





More information about the fedora-devel-list mailing list