On Sat, 24 Sept 2022 at 00:42, Patrick Venture <vent...@google.com> wrote: > On Thu, Sep 22, 2022 at 8:21 PM Jason Wang <jasow...@redhat.com> wrote: >> >> On Thu, Sep 22, 2022 at 8:35 PM Peter Maydell <peter.mayd...@linaro.org> >> wrote: >> > A question to which I don't know the answer: if the guest writes to >> > the device to change the MAC address, should that persist across >> > reset, or should reset revert the device to the original MAC address >> > as specified by the user on the command line or whatever ? At the >> > moment you have the former behaviour (and end up storing the MAC >> > address in two places as a result -- it would be neater to either >> > keep it in only one place, or else have emc->regs[] be the current >> > programmed MAC address and emc->conf.macaddr the value to reset to). >> > >> > I'm not sure we're consistent between device models about that, >> > eg the e1000 seems to reset to the initial MAC addr, but the >> > imx_fec keeps the guest-set value over resets. Jason, is there >> > a recommended "right way" to handle guest-programmable MAC addresses >> > over device reset ? >> >> I think it depends on the NIC. >> >> E1000 has a EEPROM interface for providing the MAC address for the >> ethernet controller before it can be accessed by the driver during >> reset. For modern Intel NICs like E810, it has similar semantics but >> using NVM instead of EEPROM. So the current e1000 behaviour seems to >> be correct (treat the initiali MAC as the one stored in the EEPROM). >> >> I guess most NIC should behave the same as having a persistent storage >> for MAC for the controller during reset, but I'm not sure this is the >> case for imx_fec.
> So the first time the NIC is realized, it should take the value from > the command line. Then later if the guest OS updates it, it should > always on reset use that provided value? 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 -- PMM