qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Customizing ARM Emulation boards?
@ 2016-04-14 17:03 Alexander Duff
  2016-04-14 22:12 ` Peter Maydell
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Duff @ 2016-04-14 17:03 UTC (permalink / raw)
  To: qemu-devel

Hello,

(This is cross-posted from the general discussion mailing list)

I'm emulating routers running OpenWrt for ARM using the 
realview-eb-mpcore machine and I've run into the problem of not being 
able to create more than one NIC. For what it's worth, when specifying 
that the NIC should be an smc91c111, qemu-system-arm -M 
realview-eb-mpcore says that this machine doesn't support that device. 
When the device is unspecified, it defaults to the smc91c111 once the 
machine is booted. Every NIC after the first defaults to rtl8139, but 
emulation of the PCI bus is missing (I am unsure if it's missing due to 
the OpenWrt kernel built for ARM or something in QEMU) so these devices 
show in QEMU's monitor, but not on the guest. Since it's a router, I 
would very much like to have more than one ethernet port. I downloaded 
the QEMU source and looked through it to see how the devices are created 
and assigned. In realview.c (lines 265 through 281), I found the 
following code:

     for(n = 0; n < nb_nics; n++) {
         nd = &nd_table[n];

         if (!done_nic && (!nd->model ||

strcmp(nd->model, is_pb ? "lan9118" : "smc91c111") == 0)) {

             if (is_pb) {
                 lan9118_init(nd, 0x4e000000, pic[28]);
             } else {
                 smc91c111_init(nd, 0x4e000000, pic[28]);
             }
             done_nic = 1;
         } else {
             if (pci_bus) {
                 pci_nic_init_nofail(nd, pci_bus, "rtl8139", NULL);
             }
         }
     }

So my understanding is that it checks to see if a NIC has been created. 
If it hasn't, it creates an smc91c111 NIC and maps it to 0x4e000000, 
then sets "done_nic" to 1 and creates all subsequent NICs as rtl8139 
devices.

So, I have the following questions:

1) Could I make my own customized board by more-or-less copying the 
realview.c file and changing this section so that the first 8 or so NICs 
(however many I can fit in that memory space) are smc91c111 devices and 
offset them by the space it takes (I want to say 16 but I'll double 
check first)? The next address on the memory map is 0x4f00000000 (USB, 
which I don't need anyway).

2) Is there any documentation on programming a custom board? In this 
case, I don't think I need it, but it would be good to have. I apologize 
if I've missed it, there are a lot of moving parts in this endeavor.

3) Is there a simpler way to get more than one ethernet port on a 
virtualized ARM machine? I've been working on this for a long time and 
I'm afraid I'm getting tunnel vision and missing an obvious solution.

4) Is this the right mailing list?If there's a better place to ask this 
question or if anyone can point me in the right direction, I would be 
grateful for that information. I already posted on the OpenWrt forums 
and received 0 replies.

Thank you very much, and I appreciate any help I can get on this.

-Alex

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

end of thread, other threads:[~2016-04-14 22:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-14 17:03 [Qemu-devel] Customizing ARM Emulation boards? Alexander Duff
2016-04-14 22:12 ` Peter Maydell

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).