Re: Parameter 'driver' expects pluggable device type

2020-05-08 Thread Priyamvad Acharya
Hi,
I have set user_creatable to true in class_init function of pl061 source
code.
Now when I run qemu via command line with *-device *option it gives below
output

> qemu-system-arm: Device pl061 can not be dynamically instantiated
>


I request community members to reply asap!!!



On Fri, 8 May 2020 at 07:40, Priyamvad Acharya 
wrote:

> Hi,
> Thanks for providing relevant information.
> FYI
> I am using Qemu version *4.2.94 (v5.0.0-rc4-dirty).*
> I am using *virt* board.
>
> Where we need to set *user creatable *to true?
> Any other modification is needed to allow sysbus device support?
>
> Below is the script which I am using  to boot linux image with pl061
> device on virt board.
>
> #!/bin/bash
>>
>> KERNEL="/lhome/priyamvad/debian_qemu_arm32/vmlinuz-3.16.0-6-armmp-lpae"
>>
>> INIT_IMAGE="/lhome/priyamvad/debian_qemu_arm32/initrd.img-3.16.0-6-armmp-lpae"
>> DISK="/lhome/priyamvad/debian_qemu_arm32/hda30.qcow2"
>>
>> ./qemu-system-arm \
>> -M virt \
>> -m 1024 \
>> -smp 4 \
>> -kernel $KERNEL \
>> -object rng-random,filename=/dev/urandom,id=rng0 \
>> -device virtio-rng-device,rng=rng0 \
>> -initrd $INIT_IMAGE \
>> -append 'root=/dev/vda2' \
>> -drive if=none,file=$DISK,format=qcow2,id=hd \
>> -device pl061 \
>> -device virtio-blk-device,drive=hd \
>> -device virtio-net-device,netdev=usernet \
>> -netdev user,id=usernet,hostfwd=tcp::2222-:22 \
>> -nographic
>>
>
> Is the above script  correct  to boot linux image with pl061 device on
> virt board?
>
> On Fri, 8 May 2020 at 02:32, John Snow  wrote:
>
>>
>>
>> On 5/6/20 8:56 AM, Priyamvad Acharya wrote:
>> >
>> > Hello developer community,
>> > I want to allow a *sysbus *type device to boot with kernel image(arm
>> > architecture) via Qemu command line .
>> >
>> > When I run qemu arm system executable with *-device *option via qemu
>> > command line,I get following error message
>> >
>> >> qemu-system-arm: -device pl061: Parameter 'driver' expects pluggable
>> > device type
>> >
>> > So, how to allow a sysbus device via command line?
>> > Is there any working patch?
>>
>> Hi, it looks like the pl061 device is not declared "user creatable" so
>> it is unavailable from the CLI. As a sysbus device, QEMU is not aware,
>> in the abstract, of how to "connect" the device to other devices.
>>
>> See the sysbus class initialization code for more detail:
>> https://github.com/qemu/qemu/blob/master/hw/core/sysbus.c#L301
>>
>>
>> However, It looks like these boards/devices create such a device:
>>
>> hw/arm/highbank
>> hw/arm/realview
>> hw/arm/sbsa-ref
>> hw/arm/stellaris
>> hw/arm/versatilepb
>> hw/arm/virt
>>
>> If you want one on some other kind of machine, you'll need to write it
>> up yourself in the machine board code, but you didn't tell us what
>> version of QEMU you're using, what machine type you are trying to use,
>> etc.
>>
>> --js
>>
>>


Re: Parameter 'driver' expects pluggable device type

2020-05-07 Thread Priyamvad Acharya
 Hi,
Thanks for providing relevant information.
FYI
I am using Qemu version *4.2.94 (v5.0.0-rc4-dirty).*
I am using *virt* board.

Where we need to set *user creatable *to true?
Any other modification is needed to allow sysbus device support?

Below is the script which I am using  to boot linux image with pl061 device
on virt board.

#!/bin/bash
>
> KERNEL="/lhome/priyamvad/debian_qemu_arm32/vmlinuz-3.16.0-6-armmp-lpae"
>
> INIT_IMAGE="/lhome/priyamvad/debian_qemu_arm32/initrd.img-3.16.0-6-armmp-lpae"
> DISK="/lhome/priyamvad/debian_qemu_arm32/hda30.qcow2"
>
> ./qemu-system-arm \
> -M virt \
> -m 1024 \
> -smp 4 \
> -kernel $KERNEL \
> -object rng-random,filename=/dev/urandom,id=rng0 \
> -device virtio-rng-device,rng=rng0 \
> -initrd $INIT_IMAGE \
> -append 'root=/dev/vda2' \
> -drive if=none,file=$DISK,format=qcow2,id=hd \
> -device pl061 \
> -device virtio-blk-device,drive=hd \
> -device virtio-net-device,netdev=usernet \
> -netdev user,id=usernet,hostfwd=tcp::-:22 \
> -nographic
>

Is the above script  correct  to boot linux image with pl061 device on virt
board?

On Fri, 8 May 2020 at 02:32, John Snow  wrote:

>
>
> On 5/6/20 8:56 AM, Priyamvad Acharya wrote:
> >
> > Hello developer community,
> > I want to allow a *sysbus *type device to boot with kernel image(arm
> > architecture) via Qemu command line .
> >
> > When I run qemu arm system executable with *-device *option via qemu
> > command line,I get following error message
> >
> >> qemu-system-arm: -device pl061: Parameter 'driver' expects pluggable
> > device type
> >
> > So, how to allow a sysbus device via command line?
> > Is there any working patch?
>
> Hi, it looks like the pl061 device is not declared "user creatable" so
> it is unavailable from the CLI. As a sysbus device, QEMU is not aware,
> in the abstract, of how to "connect" the device to other devices.
>
> See the sysbus class initialization code for more detail:
> https://github.com/qemu/qemu/blob/master/hw/core/sysbus.c#L301
>
>
> However, It looks like these boards/devices create such a device:
>
> hw/arm/highbank
> hw/arm/realview
> hw/arm/sbsa-ref
> hw/arm/stellaris
> hw/arm/versatilepb
> hw/arm/virt
>
> If you want one on some other kind of machine, you'll need to write it
> up yourself in the machine board code, but you didn't tell us what
> version of QEMU you're using, what machine type you are trying to use, etc.
>
> --js
>
>


Re: Parameter 'driver' expects pluggable device type

2020-05-07 Thread Priyamvad Acharya
Hi,
Thanks for providing relevant information.
FYI
I am using Qemu version *4.2.94 (v5.0.0-rc4-dirty).*
I am using *virt* board.

Where we need to set *user creatable *to true?
Any other modification is needed to allow sysbus device support?

Below is the script which I am using  to boot linux image with pl061 device
on virt board.

#!/bin/bash
>
> KERNEL="/lhome/priyamvad/debian_qemu_arm32/vmlinuz-3.16.0-6-armmp-lpae"
>
> INIT_IMAGE="/lhome/priyamvad/debian_qemu_arm32/initrd.img-3.16.0-6-armmp-lpae"
> DISK="/lhome/priyamvad/debian_qemu_arm32/hda30.qcow2"
>
> ./qemu-system-arm \
> -M virt \
> -m 1024 \
> -smp 4 \
> -kernel $KERNEL \
> -object rng-random,filename=/dev/urandom,id=rng0 \
> -device virtio-rng-device,rng=rng0 \
> -initrd $INIT_IMAGE \
> -append 'root=/dev/vda2' \
> -drive if=none,file=$DISK,format=qcow2,id=hd \
> -device pl061 \
> -device virtio-blk-device,drive=hd \
> -device virtio-net-device,netdev=usernet \
> -netdev user,id=usernet,hostfwd=tcp::-:22 \
> -nographic
>

Is this script  to boot linux image with pl061 device on virt board?


On Fri, 8 May 2020 at 02:32, John Snow  wrote:

>
>
> On 5/6/20 8:56 AM, Priyamvad Acharya wrote:
> >
> > Hello developer community,
> > I want to allow a *sysbus *type device to boot with kernel image(arm
> > architecture) via Qemu command line .
> >
> > When I run qemu arm system executable with *-device *option via qemu
> > command line,I get following error message
> >
> >> qemu-system-arm: -device pl061: Parameter 'driver' expects pluggable
> > device type
> >
> > So, how to allow a sysbus device via command line?
> > Is there any working patch?
>
> Hi, it looks like the pl061 device is not declared "user creatable" so
> it is unavailable from the CLI. As a sysbus device, QEMU is not aware,
> in the abstract, of how to "connect" the device to other devices.
>
> See the sysbus class initialization code for more detail:
> https://github.com/qemu/qemu/blob/master/hw/core/sysbus.c#L301
>
>
> However, It looks like these boards/devices create such a device:
>
> hw/arm/highbank
> hw/arm/realview
> hw/arm/sbsa-ref
> hw/arm/stellaris
> hw/arm/versatilepb
> hw/arm/virt
>
> If you want one on some other kind of machine, you'll need to write it
> up yourself in the machine board code, but you didn't tell us what
> version of QEMU you're using, what machine type you are trying to use, etc.
>
> --js
>
>


Parameter 'driver' expects pluggable device type

2020-05-06 Thread Priyamvad Acharya
Hello developer community,
I want to allow a *sysbus *type device to boot with kernel image(arm
architecture) via Qemu command line .

When I run qemu arm system executable with *-device *option via qemu
command line,I get following error message

> qemu-system-arm: -device pl061: Parameter 'driver' expects pluggable
device type

So, how to allow a sysbus device via command line?
Is there any working patch?


Re: Qemu API documentation

2020-03-23 Thread Priyamvad Acharya
Thanks for the information.

On Fri, 20 Mar 2020 at 16:47, Alex Bennée  wrote:

>
> Priyamvad Acharya  writes:
>
> > Thansk, I will check it out.
> >
> > To make my device I have used following link as reference
> >
> >
> https://devkail.wordpress.com/2014/12/16/emulation-of-des-encryption-device-in-qemu/
> >
> > Also I have shared all the necessary files
> > in previous mails involved in the development and testing process of
> device.
> >
> > Please check the files and let me know if needed more details.
>
> I'm sorry but I don't have time to dig through your email and re-assemble a
> working tree.
>
> If you want people to review your code you need to submit a proper patch
> series which applies to the current master or provide a git branch that
> can be checked out. The former is preferred as it's easier to review
> patches with inline comments. You can tag the series as RFC if you want.
>
> --
> Alex Bennée
>


Re: Qemu API documentation

2020-03-20 Thread Priyamvad Acharya
So, is there any up to date blog from where I can get a reference about
device modelling development

On Fri, 20 Mar 2020 at 15:46, Peter Maydell 
wrote:

> On Fri, 20 Mar 2020 at 09:39, Priyamvad Acharya
>  wrote:
> >
> > Thansk, I will check it out.
> >
> > To make my device I have used following link as reference
> >
> >
> https://devkail.wordpress.com/2014/12/16/emulation-of-des-encryption-device-in-qemu/
>
> Watch out, because that blog is six years old. Much of QEMU's
> internals have evolved over that time and so a lot of the
> details in the blog post will be out of date.
>
> -- PMM
>


Re: Qemu API documentation

2020-03-20 Thread Priyamvad Acharya
Thansk, I will check it out.

To make my device I have used following link as reference

https://devkail.wordpress.com/2014/12/16/emulation-of-des-encryption-device-in-qemu/

Also I have shared all the necessary files
in previous mails involved in the development and testing process of device.

Please check the files and let me know if needed more details.

Regards,
Priyamvad

On Fri, Mar 20, 2020, 14:24 Alex Bennée  wrote:

>
> Priyamvad Acharya  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 
> wrote:
> >
> >>
> >> Priyamvad Acharya  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_BASEADDR0x101f5000*
> >> >>
> >> >>
> >> >>
> >> >> *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
> >&

Re: Qemu API documentation

2020-03-19 Thread Priyamvad Acharya
Thanks Alex, I will check it out.
Have you look at below issue which I mention in my previous email?


>>> *>> qemu-system-arm: Unknown device 'soc' for default sysbusAborted
>>> (core>> dumped)**
>>>
>>

On Thu, 19 Mar 2020 at 20:09, Alex Bennée  wrote:

>
> Priyamvad Acharya  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_BASEADDR0x101f5000*
> >>
> >>
> >>
> >> *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  wrote:
> >
> >>
> >>
> >> On 3/18/20 7:09 AM, Peter Maydell wrote:
> >> > On Wed, 18 Mar 2020 at 09:55, Priyamvad Acharya
> >> >  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
>


Re: Qemu API documentation

2020-03-19 Thread Priyamvad Acharya
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 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_BASEADDR0x101f5000*
>
>
>
> *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  wrote:

>
>
> On 3/18/20 7:09 AM, Peter Maydell wrote:
> > On Wed, 18 Mar 2020 at 09:55, Priyamvad Acharya
> >  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
>
>
/*
 * Data Encryption Standard (DES) device
 * for virtex-ml507
 * Written by Liang Kaiyuan 
 * for testing and research
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU GPLv2 as published by
 * Free Software Foundation, or any later version. See the COPING
 * file in the top-level directory.
 */
 
#include 
#include 
#include 
#include "hw/hw.h"
#include "hw/sysbus.h"
#include "qemu/main-loop.h"
#include "qemu/osdep.h"
#include "qemu/units.h"
#include "hw/pci/msi.h"
#include "qemu/timer.h"
#include "qemu/module.h"
#include "qapi/visitor.h"

typedef struct {
unsigned char k[8];
unsigned char c[4];
unsigned char d[4];
} key_set;

void generate_key(unsigned char* key);
void generate_sub_keys(unsigned char* main_key, key_set* key_sets);
void process_message(unsigned char* message_piece, unsigned char* processed_piece, key_set* key_sets, int mode);
void print_char_as_binary(char input);
void print_key_set(key_set key_set);


int bread(unsigned char* block, int size, unsigned char* str, int *index);
int bwrite(unsigned char* block, int size, unsigned char* str, int *index);
int bstrlen(unsigned char* str);

#define ENCRYPTION_MODE 1
#define DECRYPTION_MODE 0
#define GENERATEKEY_MODE 2
#define DONE_MODE 3
#define REGS_OFFSET 0x1000
#define REG_KEY_ADDR

Qemu API documentation

2020-03-18 Thread Priyamvad Acharya
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 ?

Thanks,
Priyamvad


Re: New Hardware model emulation

2020-03-04 Thread Priyamvad Acharya
 > I have commented all the lines of other hardware models except custom
device line *" common-obj-$(CONFIG_TESTPCI) += testpci.o "*.
> But when I run *make* I get errors  similar to error shown in file which
I have shared with you in previous replies.
Above custom device I am building for Qemu ARM(32 bit architecture)

When I tried building  custom devicefor Qemu RISCV(32 bit architecture),
*make* get successfully executed and I get my custom device *.o and .d *files
in build/hw/misc directory.

I think there might be some problems with missing libraries for ARM
architecture ?




On Wed, 4 Mar 2020 at 16:45, Priyamvad Acharya 
wrote:

> Hi,
> I have commented all the lines of other hardware models except custom
> device line *" common-obj-$(CONFIG_TESTPCI) += testpci.o "*.
> But when I run *make* I get errors  similar to error shown in file which
> I have shared with you in previous replies.
>
> Thanks,
> Priyamvad
>
> On Wed, 4 Mar 2020 at 02:05, Stefan Hajnoczi  wrote:
>
>> On Tue, Mar 3, 2020 at 5:12 PM Priyamvad Acharya
>>  wrote:
>> > > These errors are probably due to the Makefile.objs changes in your
>> commit:
>> >
>> > If I am not wrong, we need to add a rule i.e "
>> common-obj-$(CONFIG_TESTPCI) += testpci.o " in Makefile.objs to compile
>> custom device in Qemu.
>> > Shall I should remove that rule to remove the errors?
>>
>> No, keep that line.  All the other changes to Makefile.objs in that
>> commit seem spurious though and should be removed.
>>
>> Stefan
>>
>


Re: New Hardware model emulation

2020-03-04 Thread Priyamvad Acharya
Hi,
I have commented all the lines of other hardware models except custom
device line *" common-obj-$(CONFIG_TESTPCI) += testpci.o "*.
But when I run *make* I get errors  similar to error shown in file which I
have shared with you in previous replies.

Thanks,
Priyamvad

On Wed, 4 Mar 2020 at 02:05, Stefan Hajnoczi  wrote:

> On Tue, Mar 3, 2020 at 5:12 PM Priyamvad Acharya
>  wrote:
> > > These errors are probably due to the Makefile.objs changes in your
> commit:
> >
> > If I am not wrong, we need to add a rule i.e "
> common-obj-$(CONFIG_TESTPCI) += testpci.o " in Makefile.objs to compile
> custom device in Qemu.
> > Shall I should remove that rule to remove the errors?
>
> No, keep that line.  All the other changes to Makefile.objs in that
> commit seem spurious though and should be removed.
>
> Stefan
>


Re: New Hardware model emulation

2020-03-03 Thread Priyamvad Acharya
 > These errors are probably due to the Makefile.objs changes in your
commit:

If I am not wrong, we need to add a rule i.e *"
common-obj-$(CONFIG_TESTPCI) += testpci.o "* in Makefile.objs to compile
custom device in Qemu.
Shall I should remove that rule to remove the errors?

On Tue, 3 Mar 2020 at 21:06, Stefan Hajnoczi  wrote:

> On Tue, Mar 3, 2020 at 12:45 PM Priyamvad Acharya
>  wrote:
> > Thanks Stefan for explaining the method.
> > After following above method when I run below command to compile my
> custom device in Qemu source code , I get the output on terminal which is
> attached in a file for your reference.
> >
> > Command:- make -j8 -C build
> >
> > Most of the lines in attached file indicate that error might be due to
> helper.c file.
> >
> > How to resolve it?
>
> These errors are probably due to the Makefile.objs changes in your commit:
>
> https://github.com/PriyamvadAcharya/virtual_prototype_qemu/commit/4c71c2759a96cf1db83a74027b93c6ceeab24bf1#diff-a8f0482bb5eda5c20e2054e1b1d263f2
>
> Stefan
>


Re: New Hardware model emulation

2020-03-03 Thread Priyamvad Acharya
 >.* Using git-log(1) can be helpful because it shows how new devices were
introduced.*

What is git-log(1) ?
How to use git-log(1) in Qemu?

On Tue, 3 Mar 2020 at 18:15, Priyamvad Acharya 
wrote:

> Thanks Stefan for explaining the method.
> After following above method when I run below command to compile my custom
> device in Qemu source code , I get the output on terminal which is attached
> in a file for your reference.
>
> Command:- make -j8 -C build
>
> Most of the lines in attached file indicate that error might be due to
> helper.c file.
>
> How to resolve it?
>
> My qemu version:4.2.50
>
>
> Thanks,
> Priyamvad Acharya
>
> On Tue, 3 Mar 2020 at 16:16, Stefan Hajnoczi  wrote:
>
>> On Tue, Mar 3, 2020 at 7:45 AM Priyamvad Acharya
>>  wrote:
>>
>> Please use Reply-All when replying to mailing list emails so that
>> qemu-devel@nongnu.org is included in the CC list.  That way the
>> discussion stays on the mailing list.
>>
>> > Hi,
>> > I have written code to emulate a custom PCI device.
>> > Now I want to run custom device with Qemu, so that user application can
>> perform read/write operation with custom PCI device.
>> > So what is the method to do it?
>>
>> 1. Add the source file somewhere below hw/.
>> 2. Add a make rule to build the object file in Makefile.objs in the
>> same directory as the source file.
>> 3. Compile QEMU and run with -device testpci.
>>
>> > I am new to emulating a custom device model in Qemu, so request you to
>> explain me in that way.
>>
>> Reading the source code is necessary to understand how things work.
>> You can find many examples of devices in the hw/ directory.  Using
>> git-log(1) can be helpful because it shows how new devices were
>> introduced.
>>
>> Stefan
>>
>


Re: New Hardware model emulation

2020-03-03 Thread Priyamvad Acharya
Thanks Stefan for explaining the method.
After following above method when I run below command to compile my custom
device in Qemu source code , I get the output on terminal which is attached
in a file for your reference.

Command:- make -j8 -C build

Most of the lines in attached file indicate that error might be due to
helper.c file.

How to resolve it?

My qemu version:4.2.50


Thanks,
Priyamvad Acharya

On Tue, 3 Mar 2020 at 16:16, Stefan Hajnoczi  wrote:

> On Tue, Mar 3, 2020 at 7:45 AM Priyamvad Acharya
>  wrote:
>
> Please use Reply-All when replying to mailing list emails so that
> qemu-devel@nongnu.org is included in the CC list.  That way the
> discussion stays on the mailing list.
>
> > Hi,
> > I have written code to emulate a custom PCI device.
> > Now I want to run custom device with Qemu, so that user application can
> perform read/write operation with custom PCI device.
> > So what is the method to do it?
>
> 1. Add the source file somewhere below hw/.
> 2. Add a make rule to build the object file in Makefile.objs in the
> same directory as the source file.
> 3. Compile QEMU and run with -device testpci.
>
> > I am new to emulating a custom device model in Qemu, so request you to
> explain me in that way.
>
> Reading the source code is necessary to understand how things work.
> You can find many examples of devices in the hw/ directory.  Using
> git-log(1) can be helpful because it shows how new devices were
> introduced.
>
> Stefan
>
target/arm/arm-semi.o: In function `do_arm_semihosting':
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/arm-semi.c:784: 
undefined reference to `qemu_semihosting_console_outc'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/arm-semi.c:787: 
undefined reference to `qemu_semihosting_console_outs'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/arm-semi.c:815: 
undefined reference to `qemu_semihosting_console_inc'
target/arm/cpu.o: In function `arm_v7m_cpu_exec_interrupt':
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/cpu.c:483: undefined 
reference to `armv7m_nvic_can_take_pending_exception'
target/arm/m_helper.o: In function `v7m_stack_write':
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:260: 
undefined reference to `armv7m_nvic_set_pending_derived'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:263: 
undefined reference to `armv7m_nvic_set_pending_lazyfp'
target/arm/m_helper.o: In function `v7m_stack_read':
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:329: 
undefined reference to `armv7m_nvic_set_pending'
target/arm/m_helper.o: In function `helper_v7m_preserve_fp_state':
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:356: 
undefined reference to `armv7m_nvic_set_pending_lazyfp'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:360: 
undefined reference to `armv7m_nvic_set_pending_lazyfp'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:399: 
undefined reference to `armv7m_nvic_can_take_pending_exception'
target/arm/m_helper.o: In function `arm_v7m_load_vector':
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:728: 
undefined reference to `armv7m_nvic_set_pending_derived'
target/arm/m_helper.o: In function `v7m_push_callee_stack':
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:796: 
undefined reference to `armv7m_nvic_set_pending'
target/arm/m_helper.o: In function `v7m_exception_taken':
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:838: 
undefined reference to `armv7m_nvic_get_pending_irq_info'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:946: 
undefined reference to `armv7m_nvic_acknowledge_irq'
target/arm/m_helper.o: In function `v7m_update_fpccr':
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:988: 
undefined reference to `armv7m_nvic_neg_prio_requested'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:1004: 
undefined reference to `armv7m_nvic_get_ready_status'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:1007: 
undefined reference to `armv7m_nvic_get_ready_status'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:1010: 
undefined reference to `armv7m_nvic_get_ready_status'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:1013: 
undefined reference to `armv7m_nvic_get_ready_status'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:1016: 
undefined reference to `armv7m_nvic_get_ready_status'
target/arm/m_helper.o:/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:1020:
 more undefined references to `armv7m_nvic_get_ready_status' follow
target/arm/m_helper.o: In function `v7m_push_stack':
/lhome/priyamvad/debian_qemu_arm32_updated/

New Hardware model emulation

2020-02-24 Thread Priyamvad Acharya
Hello Qemu development community members,

I have created a virtual device in Qemu.
Now I want to run Qemu with the virtual device,so how to do it ?

Thanks,
Priyamvad Acharya