Did Mary know who Jesus was?
She knew that she was not with a man so this child was exclusively created by the power of God in her as the angel explained to both her and Joseph her husband (Mt.1:20)
The angel told her that this child would save her people from their sins (Lk.1:28-) which in Judaism meant he would be the Messiah, the one that they waited for.
When the shepherds came from the field instructed by the angel to visit the newborn child they surely told Mary what they were instructed and who they were to see a Savior, who is Christ the Lord” (Luke 2:11)
‘they came with haste and found Mary and Joseph, and the Babe lying in a manger. Now when they had seen Him, they made widely known the saying which was told them concerning this Child.” (Luke 2:16-17)
She did rejoice in God her savior (Lk.1:47) and was told by Simeon when she brought him a sacrifice for her newborn, her son is identified by his prophesy (Lk.2:24-35). V.33 And Joseph and His mother marveled at those things which were spoken of Him.’
Later on when the travelling wisemen found the newborn son at Mary and Joseph’s home years after his birth, they brought special gifts and worshiped him (Mt.2:11)
Joseph is warned in a dream to flee to Egypt right after their visit (Mt.2:13). They returned to Nazareth, that it might be fulfilled which was spoken by the prophets, "He shall be called a Nazarene." (Matt 2:23)
When Jesus is fully grown up Mary asked Jesus about creating more wine at the marriage festivities before he was revealed to Israel. Jesus responds John 2:4-5" Woman, what does your concern have to do with Me? My hour has not yet come." However by law he was obedient to his mother.
His mother brought the whole family, his younger brothers and sisters to hear him teach (Mk.3:31)
While many of his disciples learned who he is, Mary knew from the beginning.
At the crucifixion his mother stood at the crucifixion (Jn.19:25) where the prophecy that was told to her and Joseph were fulfilled. Yes. Mary knew whom her child was.