From c4f33e1c9d3762819a74123675917af618a7cd68 Mon Sep 17 00:00:00 2001 From: wfjm Date: Sat, 3 Jun 2017 16:23:55 +0200 Subject: [PATCH] Update USB serial latency handling - 99-retro-usb-permissions.rules renamed to 90-retro-usb-permissions.rules - 91-retro-usb-latency.rules: udev rule to enforce low latency for FDTI USB UART - 92-retro-usb-persistent.rules: udev rule for persistent device names - Note: - for all FTDI USB-UART it is essential to set them to `low latency` mode. That was default for linux kernels 2.6.32 to 4.4.52. Since about March 2017 one gets kernels with 16 ms default latency again, thanks to kernel patch 9589541. For newer systems it is essential to install the udev rule which automatically sets low latency. --- doc/CHANGELOG.md | 14 +++++++++++++ doc/w11a_os_guide.md | 16 +++++++++----- tools/README.md | 1 + ...s.rules => 90-retro-usb-permissions.rules} | 2 +- tools/fx2/sys/README.md | 4 ++-- tools/oskit/211bsd_rpmin/README.md | 9 ++++---- tools/sys/91-retro-usb-latency.rules | 16 ++++++++++++++ tools/sys/92-retro-usb-persistent.rules | 17 +++++++++++++++ tools/sys/README.md | 21 +++++++++++++++++++ 9 files changed, 88 insertions(+), 12 deletions(-) rename tools/fx2/sys/{99-retro-usb-permissions.rules => 90-retro-usb-permissions.rules} (94%) create mode 100644 tools/sys/91-retro-usb-latency.rules create mode 100644 tools/sys/92-retro-usb-persistent.rules create mode 100644 tools/sys/README.md diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index 3139debc..7b42edce 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -25,6 +25,20 @@ The full set of tests is only run for tagged releases. - RSX11-M uses buffer chaining, will not work ### Summary +- Update USB serial latency handling + - 99-retro-usb-permissions.rules renamed to 90-retro-usb-permissions.rules + - 91-retro-usb-latency.rules: udev rule to set low latency for FDTI USB UART + - 92-retro-usb-persistent.rules: udev rule for persistent device names + - for all FTDI USB-UART it is essential to set them to `low latency` mode. + That was default for linux kernels 2.6.32 to 4.4.52. Since about March + 2017 one gets kernels with 16 ms default latency again, thanks to + [kernel patch 9589541](https://patchwork.kernel.org/patch/9589541/). + **For newer systems it is essential to install a udev rule** which + automatically sets low latency, see [docu](../tools/sys/README.md). +- Miscellaneous fixes and changes + - ibdr_deuna: add logic to handle 'PDMD issued while busy' + - Rw11CntlDEUNA: adopt trace and statistics + - hook_ibmon_xua.tcl: use .imf,.ime - Miscellaneous fixes and changes - Rw11VirtDiskOver: BUGFIX: correct write count accumulation - svn_set_ignore: check svn:ignore existance before reading it diff --git a/doc/w11a_os_guide.md b/doc/w11a_os_guide.md index d645601f..5363bbaf 100644 --- a/doc/w11a_os_guide.md +++ b/doc/w11a_os_guide.md @@ -13,7 +13,7 @@ ### I/O emulation setup All UNIBUS peripherals which exchange data (currently DL11, LP11, PC11, RK11, -RL11, RPRH and TM11 ) are currently emulated via a backend process. The +RL11, RPRH, TM11, and DENUA ) are currently emulated via a backend process. The communication between FPGA board and backend server can be via - Serial port @@ -21,10 +21,16 @@ communication between FPGA board and backend server can be via - on Arty, Basys3, and Nexys4 and Nexys4 DDR with a `FT2232HQ`, allows up to 12M Baud - on nexys3 with a `FT232R`, allows up to 2M Baud + - for all FTDI USB-UART it is essential to set them to `low latency` mode. + That was default for linux kernels 2.6.32 to 4.4.52. Since about March + 2017 one gets kernels with 16 ms default latency again, thanks to + [kernel patch 9589541](https://patchwork.kernel.org/patch/9589541/). + **For newer systems it is essential to install a udev rule** which + automatically sets low latency, see [docu](../tools/sys/README.md). - via RS232 port, as on s3board and nexys2 - using a serial port (/dev/ttySx) is limited to 115 kBaud on most PCs. - using a USB-RS232 adapter was tested up to 460k Baud. - + - Direct USB connection using a Cypress FX2 USB controller - is supported on the nexys2 and nexys3 FPGA boards - much faster than serial port connections (see below) @@ -183,7 +189,7 @@ simh to reflect the w11a setup as close as possible: - `setup_w11a_max.scmd` Planned configuration for the w11a, in addition - processor: 4 Mbyte memory (as on Nexys2, Nexys3,...) - - periphery: DZ11, RL11/RL02, RK70/RP06, TM11/TU10 + - periphery: in addition DZ11, RL11/RL02, RK70/RP06, TM11/TU10 Startup scripts are provided with each oskit. They call the w11a_max configuration, so will show in the emulator what w11a can do when @@ -201,7 +207,7 @@ All examples below use the same basic setup pdp11 _boot.scmd -###oskits +### oskits Ready to be used 'oskits' are provided under @@ -210,7 +216,7 @@ Ready to be used 'oskits' are provided under The tarballs with the disk images are provided from a web server and have to be installed separately. -###Unix systems +### Unix systems #### Legal and license issues diff --git a/tools/README.md b/tools/README.md index 3bbe4364..6eb33925 100644 --- a/tools/README.md +++ b/tools/README.md @@ -12,6 +12,7 @@ This directory tree contains **many tools** and is organized in | [oskit](oskit) | support files for OS disk/tape image kits | | [simh](simh) | configuration files for `simh pdp11` | | [src](src) | C++ sources for rlink backend | +| [sys](sys) | udev rules for USB device handling | | [tbench](tbench) | w11 test bench | | [tcl](tcl) | TCL sources for rlink backend | | [vivado](vivado) | scripts for Xilinx Vivado | diff --git a/tools/fx2/sys/99-retro-usb-permissions.rules b/tools/fx2/sys/90-retro-usb-permissions.rules similarity index 94% rename from tools/fx2/sys/99-retro-usb-permissions.rules rename to tools/fx2/sys/90-retro-usb-permissions.rules index 5121a506..21f89021 100644 --- a/tools/fx2/sys/99-retro-usb-permissions.rules +++ b/tools/fx2/sys/90-retro-usb-permissions.rules @@ -1,4 +1,4 @@ -# $Id: 99-retro-usb-permissions.rules 467 2013-01-02 19:49:05Z mueller $ +# $Id: 90-retro-usb-permissions.rules 902 2017-06-03 14:02:17Z mueller $ # # udev rules to make some USB adaptors writable to group plugdev # diff --git a/tools/fx2/sys/README.md b/tools/fx2/sys/README.md index 4f38c2b9..dc1885a6 100644 --- a/tools/fx2/sys/README.md +++ b/tools/fx2/sys/README.md @@ -13,8 +13,8 @@ is read/write accessible for user land processes, either in To setup udev rules do ```bash - sudo cp -a 99-retro-usb-permissions.rules /etc/udev/rules.d/ - sudo chown root:root /etc/udev/rules.d/99-retro-usb-permissions.rules + sudo cp -a 90-retro-usb-permissions.rules /etc/udev/rules.d/ + sudo chown root:root /etc/udev/rules.d/90-retro-usb-permissions.rules dir /etc/udev/rules.d/ sudo udevadm control --reload-rules diff --git a/tools/oskit/211bsd_rpmin/README.md b/tools/oskit/211bsd_rpmin/README.md index b906b7ea..63f64439 100644 --- a/tools/oskit/211bsd_rpmin/README.md +++ b/tools/oskit/211bsd_rpmin/README.md @@ -45,6 +45,7 @@ Download, unpack and copy the disk images (*.dsk), e.g. ``` - Hit `` in the `xterm` window to connnect to backend server. + System with as low as 512 kB memory can be used, like in example below. The boot dialog in the console `xterm` window will look like (required input is in `{..}`, with `{}` denoting a carriage return: ``` @@ -56,8 +57,8 @@ Download, unpack and copy the disk images (*.dsk), e.g. 2.11 BSD UNIX #1: Fri May 26 12:48:54 PDT 2017 root@w11a:/usr/src/sys/RETRONFPMIN - phys mem = 3932160 - avail mem = 3721408 + phys mem = 524288 + avail mem = 313536 user mem = 307200 May 26 12:49:35 init: configure system @@ -109,8 +110,8 @@ Download, unpack and copy the disk images (*.dsk), e.g. 47/128 inodes 9/ 80 processes 8/ 36 texts active, 32 used - 3/ 72 swapmap entries, 437 kB used, 3742 kB free, 3736 kB max - 30/ 80 coremap entries, 3069 kB free, 2993 kB max + 6/ 72 swapmap entries, 475 kB used, 3704 kB free, 3673 kB max + 15/ 80 coremap entries, 107 kB free, 43 kB max 1/ 10 ub_map entries, 25 free, 25 max # {mount} /dev/xp0a on / diff --git a/tools/sys/91-retro-usb-latency.rules b/tools/sys/91-retro-usb-latency.rules new file mode 100644 index 00000000..38fad49b --- /dev/null +++ b/tools/sys/91-retro-usb-latency.rules @@ -0,0 +1,16 @@ +# $Id: 91-retro-usb-latency.rules 902 2017-06-03 14:02:17Z mueller $ +# +# udev rules to set FTDI USB-serial adaptors to low latency mode +# +# copy into /etc/udev/rules.d +# +# Notes: +# - prior to linux 2.6.32 the default was the built in 16 ms device latency +# - from linux 2.6.32 till 4.4 patch 9589541 low latency (1 ms) was the default +# - the patch https://patchwork.kernel.org/patch/9589541/ reverted this +# - the entered the 4.4.52 and higher kernel lines under the changelog heading +# USB: serial: ftdi_sio: fix extreme low-latency setting +# - this rule ensures that low (1ms) latency is used +# +ACTION=="add", SUBSYSTEM=="tty", DRIVERS=="ftdi_sio", RUN+="/bin/setserial /dev/$kernel low_latency" +# diff --git a/tools/sys/92-retro-usb-persistent.rules b/tools/sys/92-retro-usb-persistent.rules new file mode 100644 index 00000000..0fcfbd49 --- /dev/null +++ b/tools/sys/92-retro-usb-persistent.rules @@ -0,0 +1,17 @@ +# $Id: 92-retro-usb-persistent.rules 902 2017-06-03 14:02:17Z mueller $ +# +# udev rules to create persistent names for Digilent FT2232C style FPGA boards +# +# copy into /etc/udev/rules.d +# +# Notes: +# - the FT2232C has two interfaces, 1st: JTAG, 2nd: UART +# - the persistent name points to the 2nd, the USB UART +# - the rule uses ENV{} and not ATTRS{} because The serial number and the +# interface number are properties of different device layers and multiple +# ATTRS{} must match in one layer +# +# NOTE: this is an example, adopt ID_SERIAL_SHORT to your needs +# +# - Digilent nexys4 board ------------------------------------------------ +SUBSYSTEM=="tty", ENV{ID_USB_INTERFACE_NUM}=="01", ENV{ID_MODEL}=="Digilent_USB_Device", ENV{ID_SERIAL_SHORT}=="210274628291", SYMLINK="fpga_n4" diff --git a/tools/sys/README.md b/tools/sys/README.md new file mode 100644 index 00000000..fab3aba7 --- /dev/null +++ b/tools/sys/README.md @@ -0,0 +1,21 @@ +This directory contains udev rule files which ensure that +- FTDI based USB UARTs are operated with low latency +- Digilent FT2232C style FPGA boards receive a persistent device name + +To setup udev rules do +```bash + # !! adopt 92-retro-usb-persistent.rules to your needs !! + sudo cp -a 91-retro-usb-latency.rules /etc/udev/rules.d/ + sudo cp -a 92-retro-usb-persistent.rules /etc/udev/rules.d/ + sudo chown root:root /etc/udev/rules.d/*-retro-usb-*.rules + ls -al /etc/udev/rules.d/ + + sudo udevadm control --reload-rules +``` + +to verify whether usb device has low latency use +```bash + # --> deterime the /dev/ttyUSB* device of interest + cat /sys/bus/usb-serial/devices/ttyUSB1/latency_timer + # --> should show '1' and not '16' +```