qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Help initializing a hw module
@ 2011-02-03 13:58 Juan Antonio Moya Vicén
  2011-02-03 14:22 ` Juan Antonio Moya Vicén
  0 siblings, 1 reply; 2+ messages in thread
From: Juan Antonio Moya Vicén @ 2011-02-03 13:58 UTC (permalink / raw)
  To: qemu-devel

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


-- 


*Juan Antonio Moya*

Scientific Developer, Securiforest
Sant Joan de La Salle 42, 4th floor
08022 Barcelona (Spain)
Email: juan@securiforest.com <mailto:juan@securiforest.com>
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./

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] Help initializing a hw module
  2011-02-03 13:58 [Qemu-devel] Help initializing a hw module Juan Antonio Moya Vicén
@ 2011-02-03 14:22 ` Juan Antonio Moya Vicén
  0 siblings, 0 replies; 2+ messages in thread
From: Juan Antonio Moya Vicén @ 2011-02-03 14:22 UTC (permalink / raw)
  To: qemu-devel

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;



On 03/02/11 14:58, Juan Antonio Moya Vicén wrote:
> 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
>
>
>   

-- 


*Juan Antonio Moya*

Scientific Developer, Securiforest
Sant Joan de La Salle 42, 4th floor
08022 Barcelona (Spain)
Email: juan@securiforest.com <mailto:juan@securiforest.com>
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./

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-03 14:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-03 13:58 [Qemu-devel] Help initializing a hw module Juan Antonio Moya Vicén
2011-02-03 14:22 ` Juan Antonio Moya Vicén

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).