Hi Sweta,
Since pre-power and pre-os commands aren't exactly available to qemu, there is little you can do to get it to work. You can try a multinode setup, where a host node is a different device type to qemu, and uses it's pre_power_command or pre_os_command to run your swtpm socket command (Im not experience with multinode, and moved on from qemu when I got LAVA working, so Im not sure about this)
An alternative would be to try a double boot action, with the first being a different boot method than the one you need, that allows the use of pre_power_command and/or pre_os_command. Then the second boot action would be the actual qemu boot action you need/use. This type of thing I haven't tested nor tried before, and it would rely on the one device dictionary, so Im quite unsure how it would turn out.
There may be other things you can try, or even have tried. But otherwise, it might just not be possible without going into the python code and making some changes to whether a qemu boot method can use pre_power_command.
My apologies that I can't offer a real solution, but I hope you may have already reached one, or do reach one soon.
Best regards, Michael