The previous solution (Patch1) for running Hurd on i440fx Qemu machine
was:

https://lists.gnu.org/archive/html/bug-hurd/2026-05/msg00000.html

Patch1, whilst functional, introduced an unnecessary overhead for
machines using a disc controller with 64 bit PCI bus address
capability. This new patch (Patch2) obsoletes Patch1 although there is
no problem with them both being installed simultaneously. In such a
case the new code in Patch2 simply won't be triggered as there would
never be a need to 'bounce'.

Patch2 copies the relevant code from the NetBSD x86 arch into the rump
dma-map implementation. A pair of DMA tags are created with the main
PCI bus and are then available to be tagged to each PCI device as it
is discovered. There is one for 32 bit DMA and one for 64 bit. When
the i440fx disk controller is discovered it specifies the 32 bit tag
for use with any DMA operation. The tag maintains a bounce threshold
which if exceeded by any physical memory address triggers use of a
bounce buffer (which is within the 32 bit space) to effect the DMA
transfer. This is all handled by the device meaning that there is no
requirement to allocate user buffers in particular memory regions.

Patch2 means that use of the q35 machine behaves as before Patch1 with
no performance penalty. Additionally, Patch2 means that there is no
performance loss when an i440fx user buffer is used that is already
within the 32 bit physical address space.

The only part of Patch2 that is architecture specific relates to the
memory synchronisation code within the NetBSD x86 arch. There are a
few functions implemented in assembly which I've copied into an arch
specific directory within the rump source tree. The function
bus_dmamap_sync() is also arch specific but I have not moved that out
into a seperate arch area. I can if required but wanted to minimise
the patch complexity. I have at least made the code inclusion
conditional on the arch via #ifdef and an #error in the event of some
other arch being compiled.

I get lots of trailing space warns when merging Patch2 into git. I've
used quilt to generate the patch, committed that to git and then used
git format-patch. I don't know if these space warnings are an issue or
not.

I have tested this on hurd-amd64 and hurd-i386 (with PAE).

Mike.

Reply via email to