upstream commits and patches for msim

Change-Id: I6901a17dcfa5b4ec6aa8c30dc6b612ce1093658b