Efficient and stable solution of M-matrix linear systems of (block) Hessenberg form