Skip to contentSkip to conversation

Help initializing a hw module

Qemu-devel Juan Antonio Moya Vicén 1 participant 2 messages Feb 3, 2011

lore
Share & tools
lore
#0 lore raw

Hi list,
I'm new to qemu, and developing a new hw module. And I'll appreciate any help or link any of you can provide relating to the following problem I'm experiencing, that I'm certain it is because of inexperience:

I'm getting ENODEV error codes each time I load the kernel module for my specific device.

** I have a guest OS Linux. The hw I'm emulating is a stupid device, whose kernel module tries to find at a certain IO mem position: 0xFED40000 The code in the kernel module that makes the call:

         ioremap(0xFED40000, 0x5000);
         if(ioread8(0xFED40000) == 0)
            return -ENODEV;

** My device initialization code in qemu:

static uint32_t my_access_read(void* opaque, target_phys_addr_t addr) {
    return (uint32_t) 0xFF;
}

static CPUReadMemoryFunc* const my_access_read_str[3] = { my_access_read, NULL, NULL };

void my_register_function(void) {
        int addr = cpu_register_io_memory(my_access_read_str, NULL, s);
        cpu_register_physical_memory(0xFED40000, 0x5000, addr);
}

** I do know that Qemu is calling and executing "my_register_function()" ** I do know that the guest OS kernel module is executing the two lines I pasted before.

But looks like "my_access_read()" function gets never called. Do you guys have any idea how to fix this mess?
Thanks in advance

Signature · 15 lines
*Juan Antonio Moya*

Scientific Developer, Securiforest
Sant Joan de La Salle 42, 4th floor
08022 Barcelona (Spain)
Email: [email protected] <mailto:[email protected]>
Web:   http://www.securiforest.com
        


/ /!\ Disclaimer -- The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended
recipient, please notify the sender immediately and do not disclose the
contents to any other person, use it for any purpose, or store or copy the
information by any means./
#1 lore raw

I'm sorry I made a typo.

The code in the kernel module that makes the call REALLY IS:

         iobase = ioremap(0xFED40000, 0x5000);
         if(ioread8(iobase) == 0)
            return -ENODEV;
Quoted 40 lines · Juan Antonio Moya Vicén

Hi list,
I'm new to qemu, and developing a new hw module. And I'll appreciate any help or link any of you can provide relating to the following problem I'm experiencing, that I'm certain it is because of inexperience:

I'm getting ENODEV error codes each time I load the kernel module for my specific device.

** I have a guest OS Linux. The hw I'm emulating is a stupid device, whose kernel module tries to find at a certain IO mem position: 0xFED40000 The code in the kernel module that makes the call:

         ioremap(0xFED40000, 0x5000);
         if(ioread8(0xFED40000) == 0)
            return -ENODEV;

** My device initialization code in qemu:

static uint32_t my_access_read(void* opaque, target_phys_addr_t addr) {
    return (uint32_t) 0xFF;
}

static CPUReadMemoryFunc* const my_access_read_str[3] = { my_access_read, NULL, NULL };

void my_register_function(void) {
        int addr = cpu_register_io_memory(my_access_read_str, NULL, s);
        cpu_register_physical_memory(0xFED40000, 0x5000, addr);
}

** I do know that Qemu is calling and executing "my_register_function()" ** I do know that the guest OS kernel module is executing the two lines I pasted before.

But looks like "my_access_read()" function gets never called. Do you guys have any idea how to fix this mess?
Thanks in advance

Signature · 15 lines
*Juan Antonio Moya*

Scientific Developer, Securiforest
Sant Joan de La Salle 42, 4th floor
08022 Barcelona (Spain)
Email: [email protected] <mailto:[email protected]>
Web:   http://www.securiforest.com
        


/ /!\ Disclaimer -- The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended
recipient, please notify the sender immediately and do not disclose the
contents to any other person, use it for any purpose, or store or copy the
information by any means./