head	1.13;
access;
symbols
	perseant-exfatfs-base-20261102:1.13
	perseant-exfatfs-base-20250801:1.13
	perseant-exfatfs-base-20240630:1.13
	perseant-exfatfs:1.13.0.14
	perseant-exfatfs-base:1.13
	bouyer-sunxi-drm:1.13.0.12
	bouyer-sunxi-drm-base:1.13
	cjep_sun2x:1.13.0.10
	cjep_sun2x-base:1.13
	cjep_staticlib_x-base1:1.13
	cjep_staticlib_x:1.13.0.8
	cjep_staticlib_x-base:1.13
	thorpej-futex-base:1.13
	bouyer-xenpvh-base2:1.13
	phil-wifi-20200421:1.13
	bouyer-xenpvh-base1:1.13
	phil-wifi-20200411:1.13
	bouyer-xenpvh:1.13.0.6
	bouyer-xenpvh-base:1.13
	phil-wifi-20200406:1.13
	ad-namecache-base3:1.13
	ad-namecache-base2:1.13
	ad-namecache-base1:1.13
	ad-namecache:1.13.0.4
	ad-namecache-base:1.13
	isaki-audio2:1.13.0.2
	isaki-audio2-base:1.13
	pgoyette-compat-merge-20190127:1.3.4.3
	pgoyette-compat-20190127:1.13
	pgoyette-compat-20190118:1.13
	pgoyette-compat-1226:1.13
	pgoyette-compat-1126:1.13
	pgoyette-compat-1020:1.5
	pgoyette-compat-0930:1.4
	pgoyette-compat-0906:1.4
	jdolecek-ncqfixes:1.4.0.2
	jdolecek-ncqfixes-base:1.4
	pgoyette-compat-0728:1.3
	phil-wifi:1.3.0.6
	phil-wifi-base:1.3
	pgoyette-compat-0625:1.3
	pgoyette-compat-0521:1.3
	pgoyette-compat-0502:1.3
	pgoyette-compat-0422:1.3
	pgoyette-compat-0415:1.3
	pgoyette-compat-0407:1.3
	pgoyette-compat-0330:1.3
	pgoyette-compat-0322:1.3
	pgoyette-compat-0315:1.3
	pgoyette-compat:1.3.0.4
	pgoyette-compat-base:1.3
	tls-maxphys:1.3.0.2
	tls-maxphys-base-20171202:1.3
	perseant-stdc-iso10646:1.1.0.6
	perseant-stdc-iso10646-base:1.1
	prg-localcount2-base3:1.1
	prg-localcount2-base2:1.1
	prg-localcount2-base1:1.1
	prg-localcount2:1.1.0.4
	prg-localcount2-base:1.1
	pgoyette-localcount-20170426:1.1
	bouyer-socketcan-base1:1.1
	jdolecek-ncq:1.1.0.2;
locks; strict;
comment	@# @;


1.13
date	2018.10.24.20.03.07;	author jdolecek;	state dead;
branches;
next	1.12;
commitid	nnixDEqObQsZAfXA;

1.12
date	2018.10.24.19.46.44;	author jdolecek;	state Exp;
branches;
next	1.11;
commitid	H8hAtQgHHtPzvfXA;

1.11
date	2018.10.24.19.38.00;	author jdolecek;	state Exp;
branches;
next	1.10;
commitid	rFuKN1rsidWVpfXA;

1.10
date	2018.10.23.22.05.01;	author jdolecek;	state Exp;
branches;
next	1.9;
commitid	px5k8jRZ4lLNi8XA;

1.9
date	2018.10.22.21.25.23;	author jdolecek;	state Exp;
branches;
next	1.8;
commitid	yYUKhdLbZZ1l70XA;

1.8
date	2018.10.22.21.24.18;	author jdolecek;	state Exp;
branches;
next	1.7;
commitid	FUmWxFrXpxCW60XA;

1.7
date	2018.10.22.20.30.52;	author jdolecek;	state Exp;
branches;
next	1.6;
commitid	oBrPW0sTklQwOZWA;

1.6
date	2018.10.22.20.13.47;	author jdolecek;	state Exp;
branches;
next	1.5;
commitid	5FLttyj4duOUEZWA;

1.5
date	2018.10.14.17.37.40;	author jdolecek;	state Exp;
branches;
next	1.4;
commitid	N9AnGsDSE4K96XVA;

1.4
date	2018.08.31.18.44.04;	author jdolecek;	state Exp;
branches
	1.4.2.1;
next	1.3;
commitid	Bk8byioPYbTNTiQA;

1.3
date	2017.11.01.21.27.22;	author jdolecek;	state Exp;
branches
	1.3.2.1
	1.3.4.1
	1.3.6.1;
next	1.2;
commitid	VWoA2T7RqQbAxndA;

1.2
date	2017.10.07.16.05.32;	author jdolecek;	state Exp;
branches;
next	1.1;
commitid	GwBDxxfU8NhEy8aA;

1.1
date	2017.04.19.20.49.58;	author jdolecek;	state dead;
branches
	1.1.2.1;
next	;
commitid	Y7ClYCWDxqvqDbOz;

1.4.2.1
date	2018.08.31.19.15.04;	author jdolecek;	state Exp;
branches;
next	1.4.2.2;
commitid	9WWKzYcF2EUk4jQA;

1.4.2.2
date	2018.08.31.19.23.54;	author jdolecek;	state Exp;
branches;
next	1.4.2.3;
commitid	RJVt7HGyDy7k7jQA;

1.4.2.3
date	2018.09.17.20.54.41;	author jdolecek;	state Exp;
branches;
next	1.4.2.4;
commitid	4jIRuyDecuUZ3vSA;

1.4.2.4
date	2018.09.22.09.22.59;	author jdolecek;	state Exp;
branches;
next	1.4.2.5;
commitid	u3PcFKjFi5bN15TA;

1.4.2.5
date	2018.09.22.09.26.48;	author jdolecek;	state Exp;
branches;
next	1.4.2.6;
commitid	4e8qYPHxdv6y65TA;

1.4.2.6
date	2018.09.22.16.14.25;	author jdolecek;	state Exp;
branches;
next	1.4.2.7;
commitid	GwOynVFgaszoj7TA;

1.4.2.7
date	2018.09.22.17.50.09;	author jdolecek;	state Exp;
branches;
next	1.4.2.8;
commitid	p0A4POi87mCFS7TA;

1.4.2.8
date	2018.09.22.17.52.24;	author jdolecek;	state Exp;
branches;
next	1.4.2.9;
commitid	CR0moff8FAseU7TA;

1.4.2.9
date	2018.09.24.19.48.02;	author jdolecek;	state Exp;
branches;
next	1.4.2.10;
commitid	BSUhW6GNmVAhtoTA;

1.4.2.10
date	2018.10.03.19.20.48;	author jdolecek;	state Exp;
branches;
next	1.4.2.11;
commitid	xnfLoL67TQpd0yUA;

1.4.2.11
date	2018.10.04.19.42.01;	author jdolecek;	state Exp;
branches;
next	1.4.2.12;
commitid	FcITItXGO1e66GUA;

1.4.2.12
date	2018.10.06.20.27.28;	author jdolecek;	state Exp;
branches;
next	1.4.2.13;
commitid	xCjAKNMOanUrjWUA;

1.4.2.13
date	2018.10.11.20.57.51;	author jdolecek;	state Exp;
branches;
next	1.4.2.14;
commitid	D3TQyHX3DcR4jAVA;

1.4.2.14
date	2018.10.14.14.50.54;	author jdolecek;	state Exp;
branches;
next	1.4.2.15;
commitid	JmWWlUd9bLUobWVA;

1.4.2.15
date	2018.10.15.21.18.53;	author jdolecek;	state Exp;
branches;
next	1.4.2.16;
commitid	PKjaFXioRXLuh6WA;

1.4.2.16
date	2018.10.17.18.03.26;	author jdolecek;	state Exp;
branches;
next	1.4.2.17;
commitid	lycMjxWNo3jt9lWA;

1.4.2.17
date	2018.10.21.19.16.48;	author jdolecek;	state Exp;
branches;
next	;
commitid	PeKDhnSVNySirRWA;

1.3.2.1
date	2017.11.01.21.27.22;	author jdolecek;	state dead;
branches;
next	1.3.2.2;
commitid	XcIYRZTAh1LmerhA;

1.3.2.2
date	2017.12.03.11.36.59;	author jdolecek;	state Exp;
branches;
next	;
commitid	XcIYRZTAh1LmerhA;

1.3.4.1
date	2018.09.06.06.55.48;	author pgoyette;	state Exp;
branches;
next	1.3.4.2;
commitid	HCi1bXD317XIK0RA;

1.3.4.2
date	2018.10.20.06.58.30;	author pgoyette;	state Exp;
branches;
next	1.3.4.3;
commitid	mTSoqZEZ4arHnFWA;

1.3.4.3
date	2018.11.26.01.52.30;	author pgoyette;	state dead;
branches;
next	;
commitid	Zj4q5SspGdKXto1B;

1.3.6.1
date	2019.06.10.22.07.05;	author christos;	state dead;
branches;
next	;
commitid	jtc8rnCzWiEEHGqB;

1.1.2.1
date	2017.04.19.20.49.58;	author jdolecek;	state Exp;
branches;
next	1.1.2.2;
commitid	Y7ClYCWDxqvqDbOz;

1.1.2.2
date	2017.04.19.21.02.43;	author jdolecek;	state Exp;
branches;
next	1.1.2.3;
commitid	XLQsLIIuS879HbOz;

1.1.2.3
date	2017.04.19.22.02.32;	author jdolecek;	state Exp;
branches;
next	1.1.2.4;
commitid	5U3eaYvDqdek2cOz;

1.1.2.4
date	2017.04.20.20.14.42;	author jdolecek;	state Exp;
branches;
next	1.1.2.5;
commitid	nxC0orjUNfUAojOz;

1.1.2.5
date	2017.04.20.20.23.49;	author jdolecek;	state Exp;
branches;
next	1.1.2.6;
commitid	KBgLbYHaElKosjOz;

1.1.2.6
date	2017.04.21.10.53.43;	author jdolecek;	state Exp;
branches;
next	1.1.2.7;
commitid	Q53cOvUclO2RgoOz;

1.1.2.7
date	2017.04.21.10.54.27;	author jdolecek;	state Exp;
branches;
next	1.1.2.8;
commitid	lP63R3YDCC63hoOz;

1.1.2.8
date	2017.04.23.09.16.35;	author jdolecek;	state Exp;
branches;
next	1.1.2.9;
commitid	YOFjrhsUVqgAFDOz;

1.1.2.9
date	2017.04.24.10.46.42;	author jdolecek;	state Exp;
branches;
next	1.1.2.10;
commitid	70IEN3yKTSjx8MOz;

1.1.2.10
date	2017.04.24.15.15.02;	author jdolecek;	state Exp;
branches;
next	1.1.2.11;
commitid	u9XZnFhyUGSfBNOz;

1.1.2.11
date	2017.04.24.22.20.23;	author jdolecek;	state Exp;
branches;
next	1.1.2.12;
commitid	cDpyYmxTS0xyXPOz;

1.1.2.12
date	2017.06.12.21.53.19;	author jdolecek;	state Exp;
branches;
next	1.1.2.13;
commitid	GgPd31htpWrAf8Vz;

1.1.2.13
date	2017.06.12.23.25.06;	author jakllsch;	state Exp;
branches;
next	1.1.2.14;
commitid	Jxwj1MLY9w7UK8Vz;

1.1.2.14
date	2017.06.13.00.02.19;	author jakllsch;	state Exp;
branches;
next	1.1.2.15;
commitid	IxMWtMnLa49yX8Vz;

1.1.2.15
date	2017.06.16.18.01.10;	author jdolecek;	state Exp;
branches;
next	1.1.2.16;
commitid	fjjGMKyEU3hPPCVz;

1.1.2.16
date	2017.06.17.14.01.36;	author jdolecek;	state Exp;
branches;
next	1.1.2.17;
commitid	O7gGVgSIMWCfsJVz;

1.1.2.17
date	2017.06.17.19.24.26;	author jdolecek;	state Exp;
branches;
next	1.1.2.18;
commitid	ibUJ3Keo7GzxgLVz;

1.1.2.18
date	2017.06.19.21.00.00;	author jdolecek;	state Exp;
branches;
next	1.1.2.19;
commitid	hC8mEx5XA6ifH1Wz;

1.1.2.19
date	2017.06.20.20.58.22;	author jdolecek;	state Exp;
branches;
next	1.1.2.20;
commitid	jwi0lui0rasKG9Wz;

1.1.2.20
date	2017.06.20.21.55.09;	author jdolecek;	state Exp;
branches;
next	1.1.2.21;
commitid	0nZULrjXMJah0aWz;

1.1.2.21
date	2017.06.21.22.40.43;	author jdolecek;	state Exp;
branches;
next	1.1.2.22;
commitid	7wOKzyJqemtidiWz;

1.1.2.22
date	2017.06.23.20.40.51;	author jdolecek;	state Exp;
branches;
next	1.1.2.23;
commitid	Axe1Wikb5EGspxWz;

1.1.2.23
date	2017.06.23.23.49.20;	author jdolecek;	state Exp;
branches;
next	1.1.2.24;
commitid	oPD53ujE8IuGwyWz;

1.1.2.24
date	2017.06.24.00.00.10;	author jdolecek;	state Exp;
branches;
next	1.1.2.25;
commitid	dwKBEqnOmCl8ByWz;

1.1.2.25
date	2017.06.24.00.23.39;	author jdolecek;	state Exp;
branches;
next	1.1.2.26;
commitid	lwwdGy9abYn6JyWz;

1.1.2.26
date	2017.06.24.14.33.06;	author jdolecek;	state Exp;
branches;
next	1.1.2.27;
commitid	syXZyWE0FmuUpDWz;

1.1.2.27
date	2017.06.27.18.16.50;	author jdolecek;	state Exp;
branches;
next	1.1.2.28;
commitid	5cx7s3sewhyqz2Xz;

1.1.2.28
date	2017.06.28.19.54.38;	author jdolecek;	state Exp;
branches;
next	1.1.2.29;
commitid	EELxFk2Bt0ES4bXz;

1.1.2.29
date	2017.07.03.18.17.01;	author jdolecek;	state Exp;
branches;
next	1.1.2.30;
commitid	uaLEyAbmsG9qnOXz;

1.1.2.30
date	2017.07.19.20.26.52;	author jdolecek;	state Exp;
branches;
next	1.1.2.31;
commitid	bUvKbRFENIyUzSZz;

1.1.2.31
date	2017.07.31.20.11.17;	author jdolecek;	state Exp;
branches;
next	1.1.2.32;
commitid	gUvhHCmVWqNV6q1A;

1.1.2.32
date	2017.08.01.22.04.48;	author jdolecek;	state Exp;
branches;
next	1.1.2.33;
commitid	vtkivplIdEOSHy1A;

1.1.2.33
date	2017.08.12.09.52.28;	author jdolecek;	state Exp;
branches;
next	1.1.2.34;
commitid	DI9XJHTaQy7jeU2A;

1.1.2.34
date	2017.08.12.14.41.54;	author jdolecek;	state Exp;
branches;
next	1.1.2.35;
commitid	OyrIbXKpHshBSV2A;

1.1.2.35
date	2017.08.12.22.43.22;	author jdolecek;	state Exp;
branches;
next	1.1.2.36;
commitid	rumuSJUg0AgNxY2A;

1.1.2.36
date	2017.08.13.11.46.32;	author jdolecek;	state Exp;
branches;
next	1.1.2.37;
commitid	YiwbDHzxy8SRT23A;

1.1.2.37
date	2017.08.29.13.38.38;	author jdolecek;	state Exp;
branches;
next	1.1.2.38;
commitid	CyTBxOZsGFGq075A;

1.1.2.38
date	2017.09.10.19.31.15;	author jdolecek;	state Exp;
branches;
next	1.1.2.39;
commitid	5psn1Fi7unNdzG6A;

1.1.2.39
date	2017.09.11.22.30.05;	author jdolecek;	state Exp;
branches;
next	1.1.2.40;
commitid	GIXLpklU5PxPvP6A;

1.1.2.40
date	2017.09.11.22.31.42;	author jdolecek;	state Exp;
branches;
next	1.1.2.41;
commitid	XWZsQKmoTCz9xP6A;

1.1.2.41
date	2017.09.13.19.55.12;	author jdolecek;	state Exp;
branches;
next	1.1.2.42;
commitid	H5yaeNXvo38JB47A;

1.1.2.42
date	2017.09.19.21.06.25;	author jdolecek;	state Exp;
branches;
next	1.1.2.43;
commitid	fgMtx2QIUa4aIQ7A;

1.1.2.43
date	2017.09.20.19.45.37;	author jdolecek;	state Exp;
branches;
next	1.1.2.44;
commitid	IUsQqBAXUUFrkY7A;

1.1.2.44
date	2017.09.21.17.15.18;	author jdolecek;	state Exp;
branches;
next	1.1.2.45;
commitid	BQhR6Bf2PpFVs58A;

1.1.2.45
date	2017.09.28.20.25.45;	author jdolecek;	state Exp;
branches;
next	1.1.2.46;
commitid	ATERRgjP6deji09A;

1.1.2.46
date	2017.09.28.20.34.23;	author jdolecek;	state Exp;
branches;
next	1.1.2.47;
commitid	Q3LVQx0WM0Xxi09A;

1.1.2.47
date	2017.09.29.20.05.07;	author jdolecek;	state Exp;
branches;
next	;
commitid	l7s5Svm5ksVd989A;


desc
@@


1.13
log
@remove TODO.ncq; the FIS note was added to atastart(), and the note
about dump to unopened wd(4) device was attached to PR kern/16789, and
nothing else remains
@
text
@Other random notes (do outside the NCQ branch):
-----------------------------------------------------
implement support for PM FIS-based switching, remove restriction in atastart()
for hw which supports it, adjust error handling in controller drivers to handle
xfers for several different drives

dump to unopened disk fails (e.g. dump do wd1b when wd1a not mounted), due
to the open path executing ata_get_params(), which eventually tsleeps()
while waiting for the command to finish; specifically, if WDF_LOADED is not
set 
- happens due to wd_get_params() with just AT_WAIT in wdopen()
- not easy to fix, open needs to read disklabel and all this mechanics
  is too much for emergency crash dump code path
- old bug - kern/16789
@


1.12
log
@move the comment (and expand) about NCQ TRIM to wd_trim()
@
text
@@


1.11
log
@detach the controller itself on shutdown; adjust to not detach already
detached atabus/channel
@
text
@a14 2

add support for the NCQ TRIM if supported by device?
@


1.10
log
@add support for DIOCCACHESYNC (!), and DIOCGCACHE; code adapted from ccd(4)

tested with Intel ATA Raid
@
text
@a16 3

ahcisata(4)/siisata(4) - enable detach on shutdown, and fix the issue
with atabus being detached several times
@


1.9
log
@remove the note for dump, moral equivalent is done and biodone() most
certainly should not be done
@
text
@d18 2
a19 1
implement DIOCGCACHE/DIOCCACHESYNC for ld@@ataraid? just passthrough, like ccd
@


1.8
log
@remove the wd* at umass? entry (comment moved to umass_isdata.c and manpage)

remove MSI for ahcisata(4), siisata(4) - these were done
@
text
@a2 4
do biodone() in wddone() starting the dump to not leak bufs when dumping from
active system? make sure to not trigger atastart()
- call ata_kill_active() + ata_kill_pending() when dumping

@


1.7
log
@move mvsata(4) related items from ata/TODO.ncq to dev/ic/mvsata.c, it's
unlikely this will ever be done, but still good to note somewhere
@
text
@a0 4
Bugs
----
test wd* at umass?, confirm the ata_channel kludge works

a22 2

MSI/MSI-X support for ahcisata(4), siisata(4)
@


1.6
log
@Merge jdolecek-ncqfixes branch

- ata_xfer's are dynamicall allocated as needed using a pool, no longer
  limited to number of possible openings supported by controller; dump
  and recovery paths use dedicated pre-allocated storage
- moved callouts and condvars from ata_xfer to queue or channel, so that
  ata_xfer does not need special initialization
- slot allocation now done when xfer is being activated, uncoupled
  from memory allocation; active slots are no longer tracked by controller
  code
- channel and drive reset is done always via the atabus thread, and
  now executes with channel locked the whole time
- NCQ recovery moved to shared function, and run via the thread also
- added some workarounds for buggy error recovery AHCI emulation in QEMU
  and Parallels

designed to primarily fix kern/52614, but might also help with kern/47041
and kern/53183
@
text
@d28 1
a28 6
MSI/MSI-X support for ahcisata(4), siisata(4) and mvsata(4)

mvsata - move pci-specific code to the pci attach code

mvsata(4) 64-bit DMA
- at least with AHA1430SA does not really work, crash in mvsata_intr() on boot
@


1.5
log
@remove M_CANFAIL flag for malloc(9) - it was completely ignored, so had
actually no effect
@
text
@a14 5
maybe do device error handling in not-interrupt-context (maybe this should be
done on a mpata branch?)

queue is allocated regardless if there are any drives, fix? 

d28 1
a28 1
MSI/MSI-X support for AHCI and mvsata(4)
@


1.4
log
@one less
@
text
@a38 2

malloc(M_CANFAIL) actually doesn't do anything
@


1.4.2.1
log
@list goals for the jdolecek-ncqfixes branch
@
text
@a0 13
jdolecek-ncqfixes goals:
- make ata_xfer dynamically allocated per-drive using a pool
  - fixes: queue is allocated regardless if there are any drives, fix? 
- remove limit of queued ata_xfers, allow any number of pending xfers;
  this should fix kern/52614 AKA wdc-attached ATAPI cd(4)
- remove the wd(4) flush condition, just allocate a dynamic ata_xfer
- change wd(4) dump code to use on-stack ata_xfer to not rely on pool having
  memory
- re-fix QEMU ahci(4) bug workaround (no READ LOG EXT support) - now it
  triggers KASSERT()
- fix ahci(4) error handling under paralles - invalid bio via WD_CHAOS_MONKEY
  ends up being handled as NOERROR, triggering KASSERT() in wd(4)

d18 2
@


1.4.2.2
log
@fix comment - dynamically allocated yes, per-drive not
@
text
@d2 1
a2 1
- make ata_xfer dynamically allocated using a pool
@


1.4.2.3
log
@convert from malloc()/free() to kmem_zalloc()/kmem_free()
@
text
@d3 1
a3 2
  - will fix: queue is allocated regardless if there are any drives, fix? 
  - malloc() -> kmem_zalloc() in ata_queue_alloc() once this is done
@


1.4.2.4
log
@separate ata_xfer slot allocation and the memory allocation, so that
there can be more queued xfers than number of supported slots by controller,
and use a pool instead of custom pre-allocation

primarily to help PR kern/52614

remove no longer needed custom wd(4) logic for flush cache

switch also wd(4) trim/suspend/setcache/wdioctlstrategy to sleep waiting
for the memory, they are all called from process context and this
avoids spurious failures
@
text
@d2 8
a9 4
- add to wd(4) a callout to restart buf queue processing when ata_get_xfer()
  call fails and remove ata_channel_start()
- change wd(4) dump code to use preallocated or on-stack ata_xfer to not rely
  on pool having memory
a13 1
- weed out remaining KM_NOSLEEP
@


1.4.2.5
log
@use KM_SLEEP in atabus_alloc_drives() to avoid spurious failures; this is
not called from interrupt context
@
text
@d10 1
@


1.4.2.6
log
@fix use-after-free in wd(4) dump, detected by switch to the pool

change code in wd_dumpblocks() to use it's own non-pool ata_xfer,
which skips the deallocation step and thus keeps the contents when the I/O
is finished
@
text
@d4 2
@


1.4.2.7
log
@remove explicit ata_channel_start() calls, it's no longer necessary
now that ata_xfer's are allocated via pool and not really limited;
replace by just a callout to restart the processing for rare cases
where system runs out of memory
@
text
@d2 2
@


1.4.2.8
log
@one more
@
text
@a5 1
- remove controller-specific slot bitmaps (ic/siisata.c, ic/ahcisata_core.c)
@


1.4.2.9
log
@replace KASSERT() for READ LOG EXT returning without error indication
with just log to avoid triggering panic under QEMU - it doesn't implement
the command for AHCI emulation
@
text
@d2 2
a6 2
- revert rev 1.431 of wd.c (AT_POOL removal) - ensure still works
  for the reset-via-thread case
@


1.4.2.10
log
@change channel reset and drive reset for all ATA controllers to always
run via thread, and with channel lock held the whole time; the queue is
frozen while reset is pending

for this repurpose ata_reset_channel() into new ata_thread_run()

also adjust some device printfs to not leak xfer pointer, and avoid
aprint_* for non-autoconf messages
@
text
@d5 2
@


1.4.2.11
log
@relax the NOERROR + C_CHAOS, just rerun the xfer instead of panic, to handle
another variant of bad/missing AHCI error recovery, this time under Parallels
@
text
@d2 2
a3 3
- re-check READ LOG EXT handling under native and Parallels to make sure
  the NOERROR under Parallels is their bug and not ours
- run recovery via atathread, move to new function and share ahci/siisata/mvsata
@


1.4.2.12
log
@move the entry for error recovery on thread up, it will be done on ncqfixes
branch
@
text
@a4 2
- maybe do device error handling in not-interrupt-context (maybe this should be
  done on a mpata branch?)
d21 3
@


1.4.2.13
log
@refactor shared parts of the SATA error recovery into new function
ata_recovery_resume() and use for ahcisata/siisata/mvsata, also replace
per-controller hold/unhold with generic version

move the shared recovery code into separate file ata_recovery.c
@
text
@d7 1
a7 2
- adjust mvsata() intr code to accept tfd (instead of irq 0/1) so that
  ata_recovery_resume() works properly for it
@


1.4.2.14
log
@adjust mvsata_bio_intr() so it recognizes the 'tfd' parameter as passed
by recovery and hence works; use it also for passing state from
mvsata_edma_handle()
@
text
@d7 2
@


1.4.2.15
log
@change the SATA/NCQ recovery to run in the atabus thread
@
text
@d4 3
@


1.4.2.16
log
@rechecked bad block handling under Parallels and it really doesn't set
any error bits in any of the registers (neither IS nor SERR) for out-of-range
block read nor write, while it works just fine under VMware, so not our bug
@
text
@d1 3
a3 3
jdolecek-ncqfixes to finish:
- re-check READ LOG EXT handling under native
- recheck native working for ahcisata(4), siisata(4), mvsata(4) + PMP
@


1.4.2.17
log
@testing done (including PMP on siisata(4) and ATAPI cd(4) on ahcisata/siisata)
@
text
@d1 4
d32 1
a32 1
MSI/MSI-X support for ahcisata(4), siisata(4) and mvsata(4)
@


1.3
log
@one down - mlelstv converted wd(4) to dksubr
@
text
@d35 1
a35 2
mvsata - constify mvsata_pci_products and move pci-specific code to
the pci attach code
@


1.3.6.1
log
@Sync with HEAD
@
text
@@


1.3.4.1
log
@Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
@
text
@d35 2
a36 1
mvsata - move pci-specific code to the pci attach code
@


1.3.4.2
log
@Sync with head
@
text
@d39 2
@


1.3.4.3
log
@Sync with HEAD, resolve a couple of conflicts
@
text
@@


1.3.2.1
log
@file TODO.ncq was added on branch tls-maxphys on 2017-12-03 11:36:59 +0000
@
text
@d1 41
@


1.3.2.2
log
@update from HEAD
@
text
@a0 41
Bugs
----
test wd* at umass?, confirm the ata_channel kludge works

Other random notes (do outside the NCQ branch):
-----------------------------------------------------
do biodone() in wddone() starting the dump to not leak bufs when dumping from
active system? make sure to not trigger atastart()
- call ata_kill_active() + ata_kill_pending() when dumping

implement support for PM FIS-based switching, remove restriction in atastart()
for hw which supports it, adjust error handling in controller drivers to handle
xfers for several different drives

maybe do device error handling in not-interrupt-context (maybe this should be
done on a mpata branch?)

queue is allocated regardless if there are any drives, fix? 

dump to unopened disk fails (e.g. dump do wd1b when wd1a not mounted), due
to the open path executing ata_get_params(), which eventually tsleeps()
while waiting for the command to finish; specifically, if WDF_LOADED is not
set 
- happens due to wd_get_params() with just AT_WAIT in wdopen()
- not easy to fix, open needs to read disklabel and all this mechanics
  is too much for emergency crash dump code path
- old bug - kern/16789

add support for the NCQ TRIM if supported by device?

implement DIOCGCACHE/DIOCCACHESYNC for ld@@ataraid? just passthrough, like ccd

MSI/MSI-X support for AHCI and mvsata(4)

mvsata - constify mvsata_pci_products and move pci-specific code to
the pci attach code

mvsata(4) 64-bit DMA
- at least with AHA1430SA does not really work, crash in mvsata_intr() on boot

malloc(M_CANFAIL) actually doesn't do anything
@


1.2
log
@Merge support for SATA NCQ (Native Command Queueing) from jdolecek-ncq branch

ATA subsystem was changed to support several outstanding commands, and use
NCQ xfers if supported by both the controller and the disk, including NCQ
error recovery. Set NCQ high priority for BPRIO_TIMECRITICAL xfers
if supported. Added FUA support.

Done some work towards MP-safe, all ATA code tsleep()/wakeup() replaced
by condvars, and switched most code from spl* to mutexes (separate
wd(4) and ata channel lock).

Introduced new option WD_CHAOS_MONKEY to facilitate testing of error
handling, fixed several uncovered issues. Also fixed several problems
with kernel dump to wd(4) disk.

Tested with ahcisata(4), mvsata(4), siisata(4), piixide(4) on amd64,
with and without port multiplier, both disk and ATAPI devices; other
drivers and archs mechanically adjusted and compile-tested. NCQ is
supported for ahcisata(4) and siisata(4) for any controller, for
mvsata(4) only Gen IIe ones for now. Also enabled ATAPI support in
mvsata(4).

Thanks to Matt Thomas for initial ATA infrastructure patch, and
Jonathan A.Kollasch for siisata(4) NCQ changes and general testing.

Also fixes PR kern/43169 (wd(4)); and PR kern/11811, PR kern/47041,
PR kern/51979 (kernel dump)
@
text
@a19 2
change wd(4) to use dksubr

@


1.1
log
@file TODO.ncq was initially added on branch jdolecek-ncq.
@
text
@d1 43
@


1.1.2.1
log
@bunch of random observations
@
text
@a0 20
ahci with NCQ gets frequent timeouts, something's amiss

ata_xfer_*() uses wd->drvp->chnl_softc as ata_channel, but it's umass
softc for wd? at umass*

protect more of wddone() with mutex?

wdminphys() - LBA48 has maximum 65536 sectors

refactor mvsata to reuse (more of) ata_wdc.c?

NCQ ICC - investigate and set/get the behaviour with timeouts

implement DIOCGCACHE/DIOCCACHESYNC for ld@@ataraid? just passthrough, like ccd

MSI/MSI-X support for AHCI

fix all 'XXX slot' 

malloc(M_CANFAIL) actually doesn't do anything
@


1.1.2.2
log
@up to 65536 sectors can be transferred for LBA48 commands; adjust wdminphys()
and wdstart1() accordingly
@
text
@d8 2
@


1.1.2.3
log
@note the QEMU bug
@
text
@a2 3
under QEMU, the mounted AHCI drive doesn't show directories for ls,
but cd, mkdir, stat and creating files wroks just fine - what do?

@


1.1.2.4
log
@use a fake ata_channel struct in umass_isdata.c so that the wd(4) calls
to ata_{get,free}_xfer() can work, adjust to ata interface changes

compile tested only
@
text
@d1 1
a1 2
ahci with NCQ gets frequent timeouts, something's amiss; improve message
to use dev for the drive, not the controller
d6 2
a7 3
test wd* at umass?, confirm the ata_channel kludge works

set PRIO/ICC for NCQ transfers for BPRIO_TIMECRITICAL/BPRIO_TIMELIMITED
@


1.1.2.5
log
@remove ahci timeouts, fixed by Jonathan
@
text
@d1 3
@


1.1.2.6
log
@group items, slightly expand description
@
text
@a0 3
Bugs
----

a2 2
- https://lists.freebsd.org/pipermail/freebsd-current/2011-September/027294.html
- somewhat critical since we use QEMU for babylon builds
d4 1
a4 8
ahci driver - fix error handling to iterate over all relevant xfers

mvsata, siisata - fix all 'XXX slot' 

NCQ PRIO/ICC handling
---------------------
fix handling of ATA 'devices' value to be full 16-bit value, to prepare for
the ICC/AUXILIARY support
a6 1
NCQ ICC - investigate and set/get the behaviour with timeouts (WDNC, RDNC)
d8 1
a8 5
test wd* at umass?, confirm the ata_channel kludge works

Other random notes (maybe do outside the NCQ branch):
-----------------------------------------------------
add support for the NCQ TRIM if supported by device?
d10 1
a10 1
protect more of wddone() with mutex?
d12 1
a12 2
refactor mvsata to reuse (more of) ata_wdc.c? duplicates e.g. mode selection
logic
d18 2
@


1.1.2.7
log
@move the wd* at umass? item to bugs, too
@
text
@a12 2
test wd* at umass?, confirm the ata_channel kludge works

d21 2
@


1.1.2.8
log
@note possible problem with ata_exec_xfer()
@
text
@a14 3
is ata_exec_xfer() + POLL safe wrt. more outstanding I/Os? why is it waiting
until xfer is head of queue? also layer violation with the ata_xfer_free() call

@


1.1.2.9
log
@one down
@
text
@d9 2
@


1.1.2.10
log
@do not use PRD Byte Count for queued commands to determine number of bytes
actually transferred; it should not be used and is not guaranteed to be
valid according to AHCI spec, underflow is always invalid for queued cmds

this fixes my ls problem under QEMU
@
text
@d4 5
@


1.1.2.11
log
@set NCQ priority field to 'high' for BPRIO_TIMECRITICAL transfers if drive
supports it
@
text
@d11 8
@


1.1.2.12
log
@update notes
@
text
@d4 1
a4 3
test crashdump with ahci

siisata - fix all 'XXX slot' 
d11 1
a11 1
Other random notes (do outside the NCQ branch):
a12 2
add nibble to control number of tags (1==disable NCQ)?

d17 3
d22 1
a22 7
MSI/MSI-X support for AHCI and mvsata(4)

mvsata - constify mvsata_pci_products and move pci-specific code to
the pci attach code

mvsata(4) 64-bit DMA
- at least with AHA1430SA does not really work, crash in mvsata_intr() on boot
@


1.1.2.13
log
@Add a few more NCQ branch action items.
@
text
@d6 1
a6 3
siisata - fix all 'XXX slot' -- jakllsch has this done but uncommited

test crashdump with siisata
a12 12
further test port multipliers (currently appears to not work)

test device error handling (currently appears to not work well, at least in NCQ case)

do proper NCQ error recovery (currently not even really attempted)

maybe do device error handling in not-interrupt-context (maybe this should be
done on a mpata branch?)

atabus(4) queue depth can only shrink, causing NCQ to not be available if NCQ
drive rescaned after detach of non-NCQ drive

@


1.1.2.14
log
@Add NCQ support to siisata(4).

There are still issues that need to be address before I consider this
mergable.
@
text
@d6 1
a6 1
siisata - fix all new XXX and unmergable bits
@


1.1.2.15
log
@notes from dump testing - TL;DR: broken, fixing
@
text
@d4 1
a4 2
test crashdump with ahci, pciide, mvsata
- jdolecek: broken for various reasons, working on fix
a28 8
change wd(4) to use dk_open()

dump to unopened disk fails (e.g. dump do wd1b when wd1a not mounted), due
to the open path executing ata_get_params(), which eventually tsleeps()
while waiting for the command to finish; specifically, if WDF_LOADED is not
set 
- happens due to wd_get_params() with just AT_WAIT in wdopen()

@


1.1.2.16
log
@make PMP working great again

tested with mvsata(4), my ahcisata(4) controller unfortunately doesn't
support PMP
@
text
@d16 2
a26 2
- careful with PMP, must be minimum of openings supported by drives
  attached to the same channel
@


1.1.2.17
log
@more notes, esp. PMP on siisata doesn't work + more problems with downsize
@
text
@d4 2
a5 1
fix crashdump for mvsata - request times out (maybe same as HEAD?)
d7 1
a7 1
siisata - fix all new XXX and unmergable bits, fix PMP
a10 3
reset channel and PMP doesn't work with siisata - siisata_reset_drive()
uses ata_get_xfer() and this can clash on slot 0 with on-stack xfers

a26 3
- the downsize can leak transfers with PMP if other device happens
  to have active or pending transfers (e.g. when non-NCQ device is attached
  while there is already NCQ device present)
@


1.1.2.18
log
@add ata_channel lock, use it to protect queue manipulation (only that for now);
add ata_channel_detach() to destroy the locks

change ata_get_xfer() so that it can wait for xfer, convert all on-stack
xfer code to use the blocking variant

fix siisata_reset_drive() to use polled reset and not try ata_activate_xfer(),
convert drive probe code also over from slot0 XXX to ata_get_xfer()

drive reset and PMP now works on siisata(4) too; changes tested also
on piixide(4), ahci(4), mvsata(4)
@
text
@d9 3
a11 2
- fails with recursive panic via pmap_kremove_local() regardless if
  drive connected via PMP or direct
a13 1
+ add detach code (channel detach, free queue)
a32 4
add mechanics to re-check queue when xfer is finished - needed on PMP
and for IDE disks, when one drive uses up all available xfers nothing
ever restarts queue for the other drives

@


1.1.2.19
log
@remove ata queue downsizing - every device, attached to the same channel,
uses slots according to it's own limits

wdc code changed to expect maximum one active xfer, and not check number
of openings in the channel; this is to facilitate using wdc functions
for e.g. handling of atapi commands  for drivers which support both ATAPI
and NCQ
@
text
@d25 8
@


1.1.2.20
log
@some more notes for dump on unopened device (PR kern/16789)
@
text
@a37 3
- not easy to fix, open needs to read disklabel and all this mechanics
  is too much for emergency crash dump code path
- old bug - kern/16789
@


1.1.2.21
log
@hold channel lock for ata_exec_xfer() and most of atastart(), convert
C_WAITACT handling to use condvar

add comment for the code block with C_FREE and ata_free_xfer() explaining
why it's not abstraction layer violation
@
text
@d15 3
@


1.1.2.22
log
@restart I/O processing after freeing xfer, i.e. now even after commands
like cache flush or standby; the command handling no longer use on-stack xfer,
hence use queue slot and compete with normal I/O for the xfers

the restart give change to all drives attached to the same channel
in round-robin fashion, for fair usage and to recover from situation
when disk is idle due to all xfers being consumed by other drives

make special concession for flush cache - ignore any new I/O requests
on the particular disk while the flush cache is waiting for xfer,
so that I/O queue won't starve the flush cache and the flush cache would
be done ASAP

tested on piixide(4), ahci(4), siisata(4)
@
text
@a4 1
- HEAD crash due to KASSERT(chp->ch_queue->active_xfer != NULL)
d6 1
a6 1
siisata - fix all new XXX and unmergable bits
d10 1
a10 3
  drive connected via PMP or direct (failed KASSERT(panicstr != NULL))
- HEAD crashes same as branch
- see kern/49610 for potential fix
d22 3
a24 6
do not limit openings for xfers for non-NCQ drives in wdstart(), the tag
will not be used so can use any xfer

in atastart(), restrict NCQ commands to commands for the same drive? it's
fine for fis-based switching to have outstanding for several drives, but
not non-FIS
d28 1
a28 1
change wd(4) to use dksubr
@


1.1.2.23
log
@fix dump for siisata(4) to work - need to call drv_done() callback in order to
not leak xfers

while here, reduce the DELAY() for polled bio to make it go much faster,
same value as used in ahcisata(4)

needs also rev. 1.252 src/sys/arch/x86/x86/pmap.c to not trigger the
assertion, the pmap.c fix committed only on HEAD
@
text
@d9 6
a33 2
queue is allocated regardless if there are any drives, fix? 

@


1.1.2.24
log
@only limit the openings for I/O xfer if the drive actually supports NCQ; if
it's non-NCQ drive, the tag is not going to be used, so we can use any xfer
@
text
@d19 3
@


1.1.2.25
log
@add detach code for umass_isdata; compile-tested only
@
text
@d10 1
@


1.1.2.26
log
@fix dump on mvsata - there was misplaced mvsata_bio_intr() call causing
diagnostic panic, and we also need to switch controller to appropriate
DMA mode (NCQ vs. non-NCQ DMA)

while here, also reduce delay for the polled command wait to 100 us, same
as siisata(4) and ahcisata(4)
@
text
@d4 3
@


1.1.2.27
log
@note ATAPI on siisata, ahcisata needs to be tested
@
text
@a5 2
test ATAPI on siisata, ahcisata

@


1.1.2.28
log
@ATAPI on siisata(4), ahcisata(4) tested
@
text
@d6 2
@


1.1.2.29
log
@expand what needs to be done with error handling
@
text
@d8 1
a8 3
test non-NCQ device error handling
- test retry code paths, locking
- channel reset on fatal errors
a10 5
- if fatal error, do channel reset
- if tranfer error (both TFD.STS.BSY and DRQ is 0), need READ LOG EXT log
  page 10h to read tag which caused the error, and reset the device to idle
- need to cancel and restart the other active transfers in a way to not
  increase retry count, and not trigger drive reset
@


1.1.2.30
log
@update to note remaining work

move some stuff to 'after-merge'
@
text
@d8 10
a17 5
do proper NCQ error recovery
- update mvsata to do same as ahcisata/siisata (read log ext, timeouts, et.al)
- update also ic/wdc.c, scsipi/atapi_wdc.c, ata/ata_wdc.c to not use
  ch_status/ch_error/ATACH_IRQ_WAIT
- retest ATAPI
d19 6
a24 2
ahcisata - use dynamic xfer in ahci_do_reset_drive() instead of hardcoding
0, which can clash on drive reset after command failure
a27 7
implement support for PM FIS-based switching, remove restriction in atastart()
for hw which supports it, adjust error handling in controller drivers to handle
xfers for several different drives

maybe do device error handling in not-interrupt-context (maybe this should be
done on a mpata branch?)

@


1.1.2.31
log
@some more notes
@
text
@d14 2
a15 12
do biodone() in wddone() starting the dump to not leak bufs when dumping from
active system? make sure to not trigger atastart()
- call ata_kill_active() + ata_kill_pending() when dumping

kill active transfers after software drive reset - race timeout vs.
error recovery

multi-pmp disk open+i/o on siisata fails - track down and fix
#!/bin/sh
for disk in $disks; do
        (echo $disk; for i in `seq 0 3`; do dd if=/dev/r${disk}d bs=16m of=/dev/null count=1; done)&
done;
@


1.1.2.32
log
@another one down
@
text
@d21 6
@


1.1.2.33
log
@remove all logic around ATACH_IRQ_WAIT and channel-global ch_error/ch_status,
so that there is less hidden state shared by commands; primary intent is
to make the NCQ and non-NCQ paths more similar, and remove possibility
of incorrect handling for the NCQ commands

tested both disk and ATAPI - piixide(4) on QEMU, and siisata(4),
ahcisata(4), mvsata(4) on real hw
@
text
@d10 3
a20 2
atabus_thread() protect run by mutex/condvar

@


1.1.2.34
log
@convert the atabus thread to use the channel lock and a condvar, adjust
code which sets the relevant channel flags to take the lock while doing so
@
text
@d18 2
@


1.1.2.35
log
@add NCQ error recovery for mvsata(4)

fix wait flags for mvsata_bio_start(), AT_* constants are only valid for cmd

change the debug logging to similar form as ahcisata/siisata, so it's
easier to selectively show
@
text
@d8 3
@


1.1.2.36
log
@move the dump note to post-merge, it's not new
siisata seems to be fine, no longer holds the merge

remove the kill active transfers after software drive reset - not relevant

now only the wd* at umass? stays as new item, but I won't hold the merge
for this, as I don't have the hardware and it is contained enough to be
resolved on HEAD
@
text
@d3 3
a7 2
Other random notes (do outside the NCQ branch):
-----------------------------------------------------
d12 5
@


1.1.2.37
log
@some notes around c_start/atastart()
@
text
@a4 5
c_start() needs to be called on splbio to avoid spurious irq during reset,
is not e.g. in ata thread and may not in atastart() neither
- wdc.c never calls atastart() (start always false)
- ata_wdc.c calls atastart() regardless if error

@


1.1.2.38
log
@refactor code so that xfer c_start() hook is called with channel mutex held,
and hence the controller submit code no longer relies on spl

tested all the affected drivers - wdc (via piixide), ahci, mvsata, siisata,
both disk and atapi I/O
@
text
@d5 2
a6 2
revise calls to atastart() - now called alsoafter ATASTART_ABORT(), call
only from intr routine
a9 2
reconsider freeze/thaw in error recovery - can it screw up with thread?

@


1.1.2.39
log
@atastart() rechecked - it's okay to call it even in error path in those
several cases we do, it's just optimization to skip the call; I'm not even
very convinced it's useful to have this conditional, but keeping for now
until proven harmful
@
text
@d5 5
@


1.1.2.40
log
@doesn't seem the freeze/thaw in error recovery can cause the thread to panic,
all commands within are executed as polled and hence thread is not invoked
@
text
@d5 2
@


1.1.2.41
log
@two more - mvsata MVSATA_WITHOUTDMA seems to be broken, and latest channel lock
changes introduced panic in mi_switch() on code paths which kpause/tsleep
@
text
@a4 6
mvsata - resest MVSATA_WITHOUTDMA

the changes to lock channel lock cause now mi_switch() with spinlock held
when invoking ata_delay() (which calls kpause()) or on tsleep, need
to refactor

@


1.1.2.42
log
@replace all remaining tsleep()/wakeup() calls with condition variables, or
calls to ata_delay(), as appropriate; change ata_delay() to require the
channel lock on entry, and pass the lock to kpause() for unlocking while
sleeping
@
text
@d7 4
@


1.1.2.43
log
@MVSATA_WITHOUTDMA seems to work fine
@
text
@d5 2
@


1.1.2.44
log
@wddone() doesn't need more locking
@
text
@d35 2
@


1.1.2.45
log
@add note about DEV_BSIZE use
@
text
@a4 4
stop using DEV_BSIZE when really meaning ATA sector size and revert
<sys/param.h> inclusion in:
cvs rdiff -u -r1.2.30.1 -r1.2.30.2 src/sys/arch/amiga/dev/wdc_xsurf.c

@


1.1.2.46
log
@add sysctls to control if NCQ is being used, and how many max tags;
I have a drive which is significantly slower with NCQ than non-NCQ,
and it's generally useful to have this easily overridable

while here, also move the frequency settings for WD_CHAOS_MONKEY
to a sysctl and make it per-drive
@
text
@d35 2
@


1.1.2.47
log
@introduce ATA_BSIZE and use it instead of DEV_BSIZE for get params and
recovery, where they are by spec 512 bytes and not negotiable
@
text
@d5 4
@


