Organic matter follows a cycle in which decomposers such as fungi and bacteria break down waste and corpses, and the byproducts of decomposition become the building blocks for all living beings (directly or indirectly).
But what about lifeforms that are based on rocks?
A few examples of such beings:
The trolls of Discworld and the Goron people of the Legend of Zelda series of games litrrally eat all kinds of rocks; the former are actually moving, living rocks themselves.
The gem people from Steven Universe can eat anything, or refrain from eating if they so wish; but they are carved out of rocks, and each one's true form is also a small rock. Population growth for their civilization consumes entire planets for raw materials.
The Xorn, Stonepeople and Earth elementals in general from Dungeons & Dragons also consume rocks as part of their diet.
My main concern is that rocks cannot be grown like wheat and corn. If a population of evolving, sentient creatures feed on small bits of a mountain, over geological eras the mountain will cease existing relatively quick. So what could be a plausible matter cycle for such lifeforms?