This paper investigates the energy efficiency (EE) optimization for massive multiple-input multiple-output (MIMO) systems powered by wireless power transfer (WPT) with hardware impairments at sensor nodes (SNs). In the considered system, the SNs are first powered by the WPT from power beacon (PB). Then, the SNs use the harvested energy to transmit data to the base station (BS) with large scale of multiple antennas. Finally, the BS employs maximal-ratio combining (MRC) to detect the data symbols transmitted by the SNs. As the EE optimization problem is a non-convex problem which is difficult to solve directly. A lower bound approximation and variable substitution method are used to transform the EE maximization problem into a concave-linear fractional programming. Then, an energy efficient resource allocation algorithm that combines time and power allocation is proposed by fractional programming to maximize the EE of the system. Finally, simulation results are presented to show the effectiveness of the proposed algorithm and the impact of the hardware impairments on the system performance.