From: Peter Maydell <peter.maydell@linaro.org>
To: Patrick Venture <venture@google.com>
Cc: Jason Wang <jasowang@redhat.com>,
Havard Skinnemoen <hskinnemoen@google.com>,
CS20 KFTing <kfting@nuvoton.com>, qemu-arm <qemu-arm@nongnu.org>,
qemu-devel <qemu-devel@nongnu.org>, Hao Wu <wuhaotsh@google.com>
Subject: Re: [PATCH] hw/net: npcm7xx_emc: set MAC in register space
Date: Thu, 29 Sep 2022 16:54:44 +0100 [thread overview]
Message-ID: <CAFEAcA8_WM_-w7HDc+cRvvxZVEdatczsj18D3beN3+MUg7P3cA@mail.gmail.com> (raw)
In-Reply-To: <CAO=notzN3E_OA-_jBvXsB8_LGbTXpE=G50RX8APbHHFN6eHE3A@mail.gmail.com>
On Thu, 29 Sept 2022 at 16:28, Patrick Venture <venture@google.com> wrote:
> On Mon, Sep 26, 2022 at 8:45 AM Patrick Venture <venture@google.com> wrote:
>>> I think what Jason is suggesting is that that should depend on what
>>> the real hardware does. On a physical board, if the guest sets the
>>> MAC address, and then you power-cycle the hardware, does the MAC
>>> that it set still persist after powercycle ? Does the guest writing
>>> to these MAC registers correspond to writing to an EEPROM ?
>>
>>
>> Thanks, Peter - we've reached out to the vendor off-list to seek out some details, I'll update this with a v2 when I get an answer.
> "No, The EMC driver reset the MAC address registers during boot cycle/reset."
OK, I guess that's clear enough. In a real full-software-stack
setup is the MAC address setup usually done by a BIOS/firmware,
or is it done by Linux ?
> So in that case, we should disregard the value the user sets in
> reset and use the value provided through Qemu. Or, should we just
> not allow Qemu to set the MAC address at all?
I think that the behaviour for QEMU's model should be that
on reset we should reset the MAC address registers to the
user-provided value. That is, if the guest writes to the
MAC address registers then that does have an effect, but
only until the next reset.
That gives you reasonably plausible behaviour for both:
(1) you're emulating some guest that always sets up its
own MAC address when it starts up (eg if it's done by
some BIOS-level code that you're running in the guest)
(2) you're booting a guest kernel directly that expects
that the firmware/BIOS/whatever has already set up
a MAC address -- then the MAC address provided by QEMU/the
user fills that role
More concretely:
* on reset, set the emc->regs[] fields from emc->conf.macaddr
* when using the MAC address, always use emc->regs[], never
emc->conf.macaddr
* to handle the guest writes to the MAC registers, set
emc->regs[], but not emc->conf.macaddr
Assuming that doesn't break your existing booting workloads,
of course :-)
thanks
-- PMM
next prev parent reply other threads:[~2022-09-29 16:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-21 23:46 [PATCH] hw/net: npcm7xx_emc: set MAC in register space Patrick Venture
2022-09-22 12:35 ` Peter Maydell
2022-09-23 3:21 ` Jason Wang
2022-09-23 23:42 ` Patrick Venture
2022-09-24 9:10 ` Peter Maydell
2022-09-26 15:45 ` Patrick Venture
2022-09-29 15:28 ` Patrick Venture
2022-09-29 15:54 ` Peter Maydell [this message]
2022-09-30 2:05 ` Patrick Venture
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=CAFEAcA8_WM_-w7HDc+cRvvxZVEdatczsj18D3beN3+MUg7P3cA@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=hskinnemoen@google.com \
--cc=jasowang@redhat.com \
--cc=kfting@nuvoton.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=venture@google.com \
--cc=wuhaotsh@google.com \
/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).