qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Qemu API documentation


From: Alex Bennée
Subject: Re: Qemu API documentation
Date: Fri, 20 Mar 2020 08:54:05 +0000
User-agent: mu4e 1.3.10; emacs 28.0.50

Priyamvad Acharya <address@hidden> writes:

> Thanks Alex, I will check it out.
> Have you look at below issue which I mention in my previous email?

Without seeing the full code changes it's hard to make a determination.
But it looks like you haven't followed the template of defining the
device type.

Also have a look at tests/tcg/*/Makefile.softmmu-target for examples on
how we build executables suitable for loading into system emulation.

>
>
>>>> *>> qemu-system-arm: Unknown device 'soc' for default sysbusAborted
>>>> (core>> dumped)**
>>>>
>>>
>
> On Thu, 19 Mar 2020 at 20:09, Alex Bennée <address@hidden> wrote:
>
>>
>> Priyamvad Acharya <address@hidden> writes:
>>
>> > Thanks John and Peter for guiding me, but still it will be hard to
>> > understand from source code for a newbie.
>> >
>> > I basically want to implement a trivial device for arm architecture which
>> > basically contains register for read/write operation with a program.So
>> what
>> > are the references?
>>
>> I would look at hw/misc/unimp.c as a useful template for implementing a
>> new device. Many boards instantiate the unimp devices for areas of SoC's
>> that are not yet implemented ;-)
>>
>> >
>> > I am providing pointers about my device which I am trying to implement:
>> >  - I am implementing a device which will be attached to *versatilepb*
>> > board, that board has* ARM926 CPU*.
>> > - My device name is "*soc*" , whose description is in
>> *qemu/hw/misc/soc.c*
>> > file attached below.
>> > - I have written below line to make my device available to qemu in
>> > *qemu/hw/misc/Makefile.objs*.
>> >
>> >> *$ common-obj-$(CONFIG_SOC) += soc.o *
>> >>
>> > - I added following lines in *qemu/hw/arm/versatilepb.c* to attach my
>> > device to board.
>> >
>> >>
>> >> *#define DES_BASEADDR        0x101f5000*
>> >>
>> >>
>> >>
>> >> *    soc=qdev_create(NULL, "soc");// +    qdev_init_nofail(soc);// +
>> >> sysbus_mmio_map(SYS_BUS_DEVICE(soc), 0, DES_BASEADDR);// +*
>> >>
>> >
>> > - Run below commands to build my device
>> >
>> >> *$ make distclean*
>> >> *$ make -j8 -C build *
>> >>
>> >
>> > - Run below command to run a bare metal program on device.
>> >
>> >> *$ ./qemu-system-arm -M versatilepb -nographic -kernel
>> >> /lhome/priyamvad/debian_qemu_arm32/c_application/DES/des_demo.elf*
>> >>
>> >
>> > -I get following output in terminal shown below
>> >
>> >>
>> >>
>> >> *[priyamvad@predator arm-softmmu]$ ./qemu-system-arm -M versatilepb
>> >> -nographic -kernel
>> >> /lhome/priyamvad/debian_qemu_arm32/c_application/DES/des_demo.elf
>> >> qemu-system-arm: Unknown device 'soc' for default sysbusAborted (core
>> >> dumped)*
>> >>
>> >
>> > -Here des_demo.elf is our *bare metal program* executable for
>> *arm(926ej-s)*
>> > processor.
>> >
>> > So how to resolve below issue to run executable
>> >
>> >>
>> >>
>> >> *[priyamvad@predator arm-softmmu]$ ./qemu-system-arm -M versatilepb
>> >> -nographic -kernel
>> >> /lhome/priyamvad/debian_qemu_arm32/c_application/DES/des_demo.elf
>> >> qemu-system-arm: Unknown device 'soc' for default sysbusAborted (core
>> >> dumped)*
>> >>
>> >
>> > test.s,test.ld,startup.S,Makefile,des_demo.c are files required for bare
>> >> metal program
>> >>
>> >
>> > References:
>> >
>> >
>> https://devkail.wordpress.com/2014/12/16/emulation-of-des-encryption-device-in-qemu/
>> >
>> > Thanks,
>> > Priyamvad
>> >
>> > On Thu, 19 Mar 2020 at 01:19, John Snow <address@hidden> wrote:
>> >
>> >>
>> >>
>> >> On 3/18/20 7:09 AM, Peter Maydell wrote:
>> >> > On Wed, 18 Mar 2020 at 09:55, Priyamvad Acharya
>> >> > <address@hidden> wrote:
>> >> >>
>> >> >> Hello developer community,
>> >> >>
>> >> >> I am working on implementing a custom device in Qemu, so to implement
>> >> it I need documentation of functions which are used to emulate a
>> hardware
>> >> model in Qemu.
>> >> >>
>> >> >> What are the references to get it ?
>> >> >
>> >> > QEMU has very little documentation of its internals;
>> >> > the usual practice is to figure things out by
>> >> > reading the source code. What we do have is in
>> >> > docs/devel. There are also often documentation comments
>> >> > for specific functions in the include files where
>> >> > those functions are declared, which form the API
>> >> > documentation for them.
>> >> >
>> >>
>> >> ^ Unfortunately true. One thing you can do is try to pick an existing
>> >> device that's close to yours -- some donor PCI, USB etc device and start
>> >> using that as a reference.
>> >>
>> >> If you can share (broad) details of what device you are trying to
>> >> implement, we might be able to point you to relevant examples to use as
>> >> a reference.
>> >>
>> >> --js
>> >>
>> >>
>>
>>
>> --
>> Alex Bennée
>>


-- 
Alex Bennée



reply via email to

[Prev in Thread] Current Thread [Next in Thread]