Magnetic properties of HgTe quantum wells