Multilevel switching in Mg-doped HfOx memristor through the mutual-ion effect