Date: Wed, 9 Oct 2013 23:53:22 +0000 (UTC) From: Peter Grehan <grehan@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r256248 - head/usr.sbin/bhyve Message-ID: <201310092353.r99NrMWa015062@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: grehan Date: Wed Oct 9 23:53:21 2013 New Revision: 256248 URL: http://svnweb.freebsd.org/changeset/base/256248 Log: Allow a 4-byte write to PCI config space to overlap the 2 read-only bytes at the start of a PCI capability. This is the sequence that OpenBSD uses when enabling MSI interrupts, and works fine on real h/w. In bhyve, convert the 4 byte write to a 2-byte write to the r/w area past the first 2 r/o bytes of a capability. Reviewed by: neel Approved by: re@ (blanket) Modified: head/usr.sbin/bhyve/pci_emul.c Modified: head/usr.sbin/bhyve/pci_emul.c ============================================================================== --- head/usr.sbin/bhyve/pci_emul.c Wed Oct 9 22:10:03 2013 (r256247) +++ head/usr.sbin/bhyve/pci_emul.c Wed Oct 9 23:53:21 2013 (r256248) @@ -941,10 +941,19 @@ pci_emul_capwrite(struct pci_devinst *pi assert(offset >= capoff); /* - * Capability ID and Next Capability Pointer are readonly + * Capability ID and Next Capability Pointer are readonly. + * However, some o/s's do 4-byte writes that include these. + * For this case, trim the write back to 2 bytes and adjust + * the data. */ - if (offset == capoff || offset == capoff + 1) - return; + if (offset == capoff || offset == capoff + 1) { + if (offset == capoff && bytes == 4) { + bytes = 2; + offset += 2; + val >>= 16; + } else + return; + } switch (capid) { case PCIY_MSI:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310092353.r99NrMWa015062>