SmmSwDispatch2Protocol - Registering an SMI - Can't find protocol with OVMF



Trying to register a SMI in my custom SMM module here, and I'm running into an issue.

Before registering the SMI, the code looks for the specific protocol this way:
Status = gSmst->SmmLocateProtocol(
DEBUG ( (EFI_D_INFO, "SmmSwDispatch2Protocol Status: 0x%x\n", Status) );

Unfortunately, while starting OVMF, boot hangs and the following message appears:
SmmSwDispatch2Protocol Status: 0xE
ASSERT_EFI_ERROR (Status = Not Found)

Adding gEfiSmmSwDispatch2ProtocolGuid to the Depex section of my INF file doesn't solve the issue, in fact it prevents the custom code from being loaded at all.

For info in OVMF, I simply added a reference to the inf file in the DSC file, so that my custom code is built along OVMF:


OVMF is built with the following options:

Then the SMM module is converted to the right format and injected manually with UEFITool.

Would anyone be of help with this situation? Or could give me an advice of what would be wrong or missing?