While solving an optimal control problem, I encountered the following matrix differential equation
$$\dot P (t) = P(t) S(t) P(t) - Q$$
where $P(t_f)=Q_f$ is the terminal condition. All matrices are block matrices
$$P = \begin{bmatrix} P_1\\ P_2\\ P_3\\ \end{bmatrix}$$
$$S = \begin{bmatrix} S_1 & S_2 & S_3\end{bmatrix}$$
$$Q = \begin{bmatrix} Q_1 \\ Q_2 \\ Q_3\\ \end{bmatrix}$$
We know that block matrices $P_1$ to $P_3$ are non-symmetric and positive semidefinite. Block matrices $Q_1$ to $Q_3$ are symmetric positive semidefinite. Blocks $S_1$ to $S_3$ are diagonal square matrices.
What are the solvability conditions? And what is the solution?