Morphological regulation of all-inorganic perovskites for multilevel resistive switching