On 7/10/20 4:35 PM, Andrew Lunn wrote:
>> In principle there is nothing in this para-virtualization design that
>> would preclude a quirky quad PHY from being accessed in a
>> virtualization-safe mode. The main use case for PHY access in a VM is
>> for detecting when the link went down. Worst case, the QEMU host-side
>> driver could lie about the PHY ID, and could only expose the clause 22
>> subset of registers that could make it compatible with genphy. I don't
>> think this changes the overall approach about how MDIO devices would be
>> virtualized with QEMU.
> 
> A more generic solution might be to fully virtualize the PHY. Let the
> host kernel drive the PHY, and QEMU can use /sys/bus/mdio_bus/devices,
> and uevents sent to user space. Ioana already added support for a PHY
> not bound to a MAC in phylink. You would need to add a UAPI for
> start/stop, and maybe a couple more operations, and probably export a
> bit more information.


You would still need a struct device to bind to that PHY and I am not 
sure what device that might be since the userspace cannot provide one.

> 
> This would then solve the quad PHY situation, and any other odd
> setups. And all the VM would require is genphy, keeping it simple.
> 
>       Andrew
> 
> 

How would the genphy driver work if there is no MDIO register map for it 
to access? This suggestion seems something in between a software PHY and 
hardware PHY. Also, it would work only on PHYs and not any other device 
accessible over an MDIO bus (so you couldn't assign a DSA switch to a VM).

Coming back to a point that you made earlier, even as we speak, with an 
upstream kernel you can still have an userspace application accessing 
devices on a MDIO bus. Since the MDIO controller is memory mapped you 
just need some devmem commands wrapped-up in a nice script, no need for 
a vendor patch over an upstream kernel for this.

Ioana

Reply via email to