From: "Alex Bennée" <alex.bennee@linaro.org>
To: Priyamvad Acharya <priyamvad.agnisys@gmail.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
John Snow <jsnow@redhat.com>,
qemu-devel@nongnu.org
Subject: Re: Qemu API documentation
Date: Thu, 19 Mar 2020 14:39:07 +0000 [thread overview]
Message-ID: <871rpojto4.fsf@linaro.org> (raw)
In-Reply-To: <CAPV47zfQKCaKS3BQ4+zbFJ1KyATqgOZvtaY9n-Gh_wtFCn4trQ@mail.gmail.com>
Priyamvad Acharya <priyamvad.agnisys@gmail.com> 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 <jsnow@redhat.com> wrote:
>
>>
>>
>> On 3/18/20 7:09 AM, Peter Maydell wrote:
>> > On Wed, 18 Mar 2020 at 09:55, Priyamvad Acharya
>> > <priyamvad.agnisys@gmail.com> 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
next prev parent reply other threads:[~2020-03-19 14:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-18 9:54 Qemu API documentation Priyamvad Acharya
2020-03-18 11:09 ` Peter Maydell
2020-03-18 19:49 ` John Snow
2020-03-19 14:16 ` Priyamvad Acharya
2020-03-19 14:39 ` Alex Bennée [this message]
2020-03-20 3:25 ` Priyamvad Acharya
2020-03-20 8:54 ` Alex Bennée
2020-03-20 9:39 ` Priyamvad Acharya
2020-03-20 10:16 ` Peter Maydell
2020-03-20 10:30 ` Priyamvad Acharya
2020-03-20 11:17 ` Alex Bennée
2020-03-23 11:20 ` Priyamvad Acharya
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871rpojto4.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=jsnow@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=priyamvad.agnisys@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.