These $f$ are exactly those non-negative functions on the real line which are entire (=represented by their Taylor series on the whole real line).

Suppose $g$ is an entire function. 
Define $g^*(z)=\overline{g(\overline{z})}$ which is also entire. Then
on the real line $f(z)=|g(z)|^2=g(z)g^*(z)$, so your function $f(x)$ is non-negative on the real line and entire (as a product of entire functions). 

Conversely. Let $f$ be an entire function which is non-negative on the real line.
Then all real roots are of even multiplicities, and the rest are symmetric with respect to the real line. Let $X$ be the divisor in the plane which consists of those roots which lie in
the open upper half-plane with their multiplicities,
and real roots with half of their
multiplicities. We have the Weierstrass factorization $f=P e^h$ 
where $P$ is the canonical product, and $h$ is entire, both $P$ and $h$ real on the real line. Let $P_1$ be the canonical product over $X$,
then $P=P_1P_1^*$, and set $g=P_1e^{h/2}$. Then on the real line
$$|g(x)|^2=|P_1(x)|^2|e^{h(x)}|=P(x)e^{h(x)}=f(x).$$