Please Please put back Sys/io.h emulation for armhf and possibly aarch64

Luís Palma Nunes Mendes luis.mendes@ist.utl.pt
Wed Jun 16 11:14:29 GMT 2021


Dear GLibc maintainers/developers,

This email is quite similar to an email that I exchanged with Carlos
O'Donell, who recommended that I should post on this mailing list
instead, for further discussion. So I've elaborated this more detailed
version.

Two years ago I was successfully using an own developed software using
ioperm, iopl and inb, outb from glibc to control a PCIe parallel port
card, as there are many out there and they are simple to use. In this
case I was using it to burn firmware into ATMEL chips, today I needed it
again and to my surprise it no longer compiled, then I saw that sys/io.h
was missing from glibc for armhf.

Please please put back sys/io.h support for ioperm, iopl, inb and outb.
It was not only helpful for the old ISA cards, but it is still also
today for PCIe cards with I/O like serial and parallel port cards, among
others, possibly. Network cards and even graphics sometimes have I/O.
These cards are widely available in the market today. Just search amazon
or ebay for parallel port cards, and you will find dozens of offers.

The great advantage is that it was simple to use from user-space and is
a perfect solution when bit-banging is needed for parport devices, since
PPDEV ioctls end up being too slow. It may be useful for other use cases
as well. I see many people complaining in the web about sys/io.h
missing.

The commit that removed the support, according to Carlos O'Donell was
this one:
The rationale is given in the commit:

commit 6b33f373c7b9199e00ba5fbafd94ac9bfb4337b1
Author: Florian Weimer
Date:   Wed May 29 16:53:09 2019 +0200

    arm: Remove ioperm/iopl/inb/inw/inl/outb/outw/outl support

    Linux only supports the required ISA sysctls on StrongARM devices,
    which are armv4 and no longer tested during glibc development
    and probably bit-rotted by this point.  (No reported test results,
    and the last discussion of armv4 support was in the glibc 2.19
    release notes.)

Except that I was using it with armv7 for PCIe, with the kernel
configuration:

-> General setup->Configure standard Kernel features (expert
users)->Sysctl syscall support->Enable

and I had my kernel modified with the following for imx6q, which is an
ARMv7:

arch/arm/mach-imx/mach-imx6q.c, function __init imx6q_init_late(void)
and appended:

   register_isa_ports(0xfee0000, 0x1f80000, 0);

Which is the PCIe IO memory region in the memory map. It was just a
matter of up-streaming the change. It maybe also useful to rename
register_isa_ports to register_pci_ports, or so in the kernel, to avoid
this confusion regarding to ISA bus only applicability.

Also did a similar change for mach-mvebu and both were working with
glibc.

I am available for collaborating on properly adding this support. Please
advise.

Regards,

Luís Mendes

Aparapi open-source project developer (www.aparapi.com)

PhD Student and Researcher


More information about the Libc-alpha mailing list