qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Duff <amd435@drexel.edu>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Customizing ARM Emulation boards?
Date: Thu, 14 Apr 2016 13:03:42 -0400	[thread overview]
Message-ID: <570FCD6E.8090603@drexel.edu> (raw)

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

             reply	other threads:[~2016-04-14 17:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-14 17:03 Alexander Duff [this message]
2016-04-14 22:12 ` [Qemu-devel] Customizing ARM Emulation boards? Peter Maydell

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=570FCD6E.8090603@drexel.edu \
    --to=amd435@drexel.edu \
    --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 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).