Code originally written by Timothy Rule and reworked & bug fixed by myself Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>