Re: How to use designware-root-port and designware-root-host devices ?

2024-06-25 Thread Arthur Tumanyan
Hi,

I ported DWC PCIE part from fsl-imx7.c to my new cusotm virt machine based
on RISC-V "virt".

It looks ok so far. Now i'm wondering whether there is a "standard/ready to
use for most of cases" device tree description for the synopsis pcie host
device ?

Looking this way:
https://mjmwired.net/kernel/Documentation/devicetree/bindings/pci/designware-pcie.txt
but would be glad to hear some advices if any.

Best regards,
Arthur

On Fri, Jun 21, 2024 at 1:30 PM Thomas Huth  wrote:

> On 21/06/2024 11.16, Peter Maydell wrote:
> > On Fri, 21 Jun 2024 at 08:07, Arthur Tumanyan 
> wrote:
> >>
> >> Hi,
> >>
> >> I just tried to run mcimx7d-sabre machine this way:
> >>
> >> ${HOME}/cosim/usr/local/bin/qemu-system-arm -M mcimx7d-sabre -m 2G \
> >> -kernel ${HOME}/cosim-arm/buildroot/output/images/uImage \
> >>  --initrd
> ${HOME}/cosim-arm/buildroot/output/images/rootfs.cpio.gz \
> >> -nographic \
> >> -net nic -net user
> >>
> >> and it just prints this and do nothing: qemu-system-arm: warning: nic
> imx.enet.1 has no peer
> >>
> >> Based on what I see in the mcimx7d-sabre.c , it configures just very
> basic things, no PCIe at all (may be I'm wrong ;) )
> >
> > The machine model in mcimx7d-sabre.c creates the SoC object
> > (TYPE_FSL_IMX7). It's the code for that in hw/arm/fsl-imx7.c
> > that creates all the SoC devices including the PCIe controller.
> > (This structure is similar to real hardware where you have a
> > board, which has one or two chips on it like RAM but most of
> > the complicated stuff is inside the one big SoC chip.)
> >
> >> Is there any idea what goes wrong here ? Maybe someone has experience
> with running this machine ?
> >
> > "No output" usually means "your guest kernel is not configured
> > correctly for this machine type", and/or possibly "you didn't
> > tell the kernel to output on the serial port".
>
> By the way, it seems like we don't even have an avocado test for that
> machine available. Peter, do you know whether there is a kernel for this
> machine available somewhere that we could use for testing?
>
>   Thomas
>
>
>


Re: How to use designware-root-port and designware-root-host devices ?

2024-06-21 Thread Thomas Huth

On 21/06/2024 11.16, Peter Maydell wrote:

On Fri, 21 Jun 2024 at 08:07, Arthur Tumanyan  wrote:


Hi,

I just tried to run mcimx7d-sabre machine this way:

${HOME}/cosim/usr/local/bin/qemu-system-arm -M mcimx7d-sabre -m 2G \
-kernel ${HOME}/cosim-arm/buildroot/output/images/uImage \
 --initrd ${HOME}/cosim-arm/buildroot/output/images/rootfs.cpio.gz \
-nographic \
-net nic -net user

and it just prints this and do nothing: qemu-system-arm: warning: nic 
imx.enet.1 has no peer

Based on what I see in the mcimx7d-sabre.c , it configures just very basic 
things, no PCIe at all (may be I'm wrong ;) )


The machine model in mcimx7d-sabre.c creates the SoC object
(TYPE_FSL_IMX7). It's the code for that in hw/arm/fsl-imx7.c
that creates all the SoC devices including the PCIe controller.
(This structure is similar to real hardware where you have a
board, which has one or two chips on it like RAM but most of
the complicated stuff is inside the one big SoC chip.)


Is there any idea what goes wrong here ? Maybe someone has experience with 
running this machine ?


"No output" usually means "your guest kernel is not configured
correctly for this machine type", and/or possibly "you didn't
tell the kernel to output on the serial port".


By the way, it seems like we don't even have an avocado test for that 
machine available. Peter, do you know whether there is a kernel for this 
machine available somewhere that we could use for testing?


 Thomas





Re: How to use designware-root-port and designware-root-host devices ?

2024-06-21 Thread Peter Maydell
On Fri, 21 Jun 2024 at 08:07, Arthur Tumanyan  wrote:
>
> Hi,
>
> I just tried to run mcimx7d-sabre machine this way:
>
> ${HOME}/cosim/usr/local/bin/qemu-system-arm -M mcimx7d-sabre -m 2G \
> -kernel ${HOME}/cosim-arm/buildroot/output/images/uImage \
> --initrd ${HOME}/cosim-arm/buildroot/output/images/rootfs.cpio.gz \
> -nographic \
> -net nic -net user
>
> and it just prints this and do nothing: qemu-system-arm: warning: nic 
> imx.enet.1 has no peer
>
> Based on what I see in the mcimx7d-sabre.c , it configures just very basic 
> things, no PCIe at all (may be I'm wrong ;) )

The machine model in mcimx7d-sabre.c creates the SoC object
(TYPE_FSL_IMX7). It's the code for that in hw/arm/fsl-imx7.c
that creates all the SoC devices including the PCIe controller.
(This structure is similar to real hardware where you have a
board, which has one or two chips on it like RAM but most of
the complicated stuff is inside the one big SoC chip.)

> Is there any idea what goes wrong here ? Maybe someone has experience with 
> running this machine ?

"No output" usually means "your guest kernel is not configured
correctly for this machine type", and/or possibly "you didn't
tell the kernel to output on the serial port".

The "no peer" warning is because this board has two ethernet devices,
and your command line explicitly wires up one but not the other.
If you drop both the "-net" options entirely it will probably go
away (you get the default user networking anyway).

thanks
-- PMM



Re: How to use designware-root-port and designware-root-host devices ?

2024-06-21 Thread Arthur Tumanyan
Hi,

I just tried to run mcimx7d-sabre machine this way:

${HOME}/cosim/usr/local/bin/qemu-system-arm -M mcimx7d-sabre -m 2G \
-kernel ${HOME}/cosim-arm/buildroot/output/images/uImage \
--initrd ${HOME}/cosim-arm/buildroot/output/images/rootfs.cpio.gz \
-nographic \
-net nic -net user

and it just prints this and do nothing: *qemu-system-arm: warning: nic
imx.enet.1 has no peer*

Based on what I see in the mcimx7d-sabre.c , it configures just very basic
things, no PCIe at all (may be I'm wrong ;) )

Is there any idea what goes wrong here ? Maybe someone has experience with
running this machine ?

Before starting to create my own virt machine I would like to know I'm not
missing the existing ways to run this.

Thanks in advance,
Arthur





On Thu, Jun 20, 2024 at 11:37 PM Arthur Tumanyan 
wrote:

> Thanks for the answers, I could move forward a bit more. I'm going/I need
> to to create a "virt" machine with designware PCI controller for simulation
> purposes. Will get back with progress in case anyone is interested in
> results. Thank you again for your time and support.
> Arthur
>
> On Thu, Jun 20, 2024, 23:05 Peter Maydell 
> wrote:
>
>> On Thu, 20 Jun 2024 at 18:34, Thomas Huth  wrote:
>> >
>> > On 20/06/2024 10.28, Arthur Tumanyan wrote:
>> > >  From the other hand the device is declared as non pluggable:
>> > > dc->user_creatable = false;
>> >
>> > Well, that means that you cannot use those with "-device". They can
>> only be
>> > instantiated via the code that creates the machine.
>> >
>> > > Can you please help me to use designware-root-host/port devices ?
>> >
>> > It seems like the i.MX7 SABRE machine is using this device, so instead
>> of
>> > "-M virt", you could have a try with "-M mcimx7d-sabre" (and a kernel
>> that
>> > supports this machine) instead.
>>
>> Right -- these devices are the PCIe controller that's used on the i.MX7
>> and i.MX6 SoCs, and they're automatically created when you use a machine
>> type that uses one of those SoCs. The "virt" board doesn't use that
>> PCIe controller, it uses the "generic PCIe bridge" TYPE_GPEX_HOST
>> (and you automatically get a PCIe controller when you use the virt board).
>> You can't change the PCIe controller type of a QEMU machine from
>> the command line, you have to configure the guest to use the controller
>> the machine type provides.
>>
>> thanks
>> -- PMM
>>
>


Re: How to use designware-root-port and designware-root-host devices ?

2024-06-20 Thread Arthur Tumanyan
Thanks for the answers, I could move forward a bit more. I'm going/I need
to to create a "virt" machine with designware PCI controller for simulation
purposes. Will get back with progress in case anyone is interested in
results. Thank you again for your time and support.
Arthur

On Thu, Jun 20, 2024, 23:05 Peter Maydell  wrote:

> On Thu, 20 Jun 2024 at 18:34, Thomas Huth  wrote:
> >
> > On 20/06/2024 10.28, Arthur Tumanyan wrote:
> > >  From the other hand the device is declared as non pluggable:
> > > dc->user_creatable = false;
> >
> > Well, that means that you cannot use those with "-device". They can only
> be
> > instantiated via the code that creates the machine.
> >
> > > Can you please help me to use designware-root-host/port devices ?
> >
> > It seems like the i.MX7 SABRE machine is using this device, so instead of
> > "-M virt", you could have a try with "-M mcimx7d-sabre" (and a kernel
> that
> > supports this machine) instead.
>
> Right -- these devices are the PCIe controller that's used on the i.MX7
> and i.MX6 SoCs, and they're automatically created when you use a machine
> type that uses one of those SoCs. The "virt" board doesn't use that
> PCIe controller, it uses the "generic PCIe bridge" TYPE_GPEX_HOST
> (and you automatically get a PCIe controller when you use the virt board).
> You can't change the PCIe controller type of a QEMU machine from
> the command line, you have to configure the guest to use the controller
> the machine type provides.
>
> thanks
> -- PMM
>


Re: How to use designware-root-port and designware-root-host devices ?

2024-06-20 Thread Peter Maydell
On Thu, 20 Jun 2024 at 18:34, Thomas Huth  wrote:
>
> On 20/06/2024 10.28, Arthur Tumanyan wrote:
> >  From the other hand the device is declared as non pluggable:
> > dc->user_creatable = false;
>
> Well, that means that you cannot use those with "-device". They can only be
> instantiated via the code that creates the machine.
>
> > Can you please help me to use designware-root-host/port devices ?
>
> It seems like the i.MX7 SABRE machine is using this device, so instead of
> "-M virt", you could have a try with "-M mcimx7d-sabre" (and a kernel that
> supports this machine) instead.

Right -- these devices are the PCIe controller that's used on the i.MX7
and i.MX6 SoCs, and they're automatically created when you use a machine
type that uses one of those SoCs. The "virt" board doesn't use that
PCIe controller, it uses the "generic PCIe bridge" TYPE_GPEX_HOST
(and you automatically get a PCIe controller when you use the virt board).
You can't change the PCIe controller type of a QEMU machine from
the command line, you have to configure the guest to use the controller
the machine type provides.

thanks
-- PMM



Re: How to use designware-root-port and designware-root-host devices ?

2024-06-20 Thread Thomas Huth

On 20/06/2024 10.28, Arthur Tumanyan wrote:

Hi all,

My question may sound stupid, however...


 Hi Arthur,

no worries, the question how to use which device in QEMU can be quite tricky ;-)

Currently I'm trying to make 
available designware-root-{port,host} devices  in linux when I run it in qemu.


I try the following way to run:

qemu-system-arm -M virt -m 2G \
      -kernel images/Image \
      -append "rootwait root=/dev/vda ro" \
      -drive file=images/rootfs.ext2,format=raw,id=hd0 \
      -device designware-root-port,id=rp0,chassis=1,slot=0,bus=pcie.0,addr=1 \
      -device e1000,netdev=net0,mac=52:54:00:12:34:56,bus=rp0,addr=0 \
      -netdev user,id=net0

but it seems designware device is not enabled by default: qemu-system-arm: 
-device designware-root-port,id=rp0,chassis=1,slot=0,bus=pcie.0,addr=1: 
'designware-root-port' is not a valid device model name


Are you sure about the names?

$ grep -r 'designware' *
...
include/hw/pci-host/designware.h:#define TYPE_DESIGNWARE_PCIE_HOST 
"designware-pcie-host"
include/hw/pci-host/designware.h:#define TYPE_DESIGNWARE_PCIE_ROOT 
"designware-pcie-root"


when I enable it from Kconfig/meson.build it says the device is already 
registered and exits with abort().


 From the other hand the device is declared as non pluggable: 
dc->user_creatable = false;


Well, that means that you cannot use those with "-device". They can only be 
instantiated via the code that creates the machine.



Can you please help me to use designware-root-host/port devices ?


It seems like the i.MX7 SABRE machine is using this device, so instead of 
"-M virt", you could have a try with "-M mcimx7d-sabre" (and a kernel that 
supports this machine) instead.


 HTH,
  Thomas




How to use designware-root-port and designware-root-host devices ?

2024-06-20 Thread Arthur Tumanyan
Hi all,

My question may sound stupid, however... Currently I'm trying to make
available designware-root-{port,host} devices  in linux when I run it in
qemu.

I try the following way to run:

qemu-system-arm -M virt -m 2G \
 -kernel images/Image \
 -append "rootwait root=/dev/vda ro" \
 -drive file=images/rootfs.ext2,format=raw,id=hd0 \
 -device designware-root-port,id=rp0,chassis=1,slot=0,bus=pcie.0,addr=1
\
 -device e1000,netdev=net0,mac=52:54:00:12:34:56,bus=rp0,addr=0 \
 -netdev user,id=net0

but it seems designware device is not enabled by default: qemu-system-arm:
-device designware-root-port,id=rp0,chassis=1,slot=0,bus=pcie.0,addr=1:
'designware-root-port' is not a valid device model name

when I enable it from Kconfig/meson.build it says the device is already
registered and exits with abort().

>From the other hand the device is declared as non pluggable: dc->user_creatable
= false;

Can you please help me to use designware-root-host/port devices ?

Thanks in advance,
Arthur