Re: git: 2eb2079554f4 - main - bhyve: keep physical and virtual COMMAND reg in sync
Date: Wed, 24 Nov 2021 16:10:26 UTC
On 11/24/21 4:00 AM, Corvin Köhne wrote: > Hi John, > >> Would you be able to test if that change works in your environment? I was >> never able to confirm that it fixed the bug I was trying to address, but I >> do think it is more correct. The busmastering thing is to work around Linux >> clearing that flag on shutdown of a guest, and I wanted to preserve other >> bits in the command register that weren't related to BARs, etc. > > The change works in my environment. As you have mentioned, my Linux guest > clears the busmastering bit on shutdown. However, in my opinion we should > initialize the command register bits in the same way as a real system does. > > I took a short look into a public available PCI specification > (https://www.ics.uci.edu/~harris/ics216/pci/PCI_22.pdf). > For busmastering (and also for IO/Mem decoding) it states that it's default value > is 0. Therefore, I'd prefer to unconditionally clear those bits on startup. While it's true that real systems do that on reset, most firmware set those bits while populating BARs. Bhyve doesn't always run boot firmware to do those tasks and needs to provide working devices out of the box. This is similar to how bhyve pre-populates BARs with resources rather than relying on firmware to assign resources to BARs. -- John Baldwin