Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
cd9bee0
StandaloneMmHob removed
kuqin12 Oct 5, 2025
7ffc55b
handle the IPL, still more work to do
kuqin12 Oct 5, 2025
07917f5
handle the MM comm buffer prep
kuqin12 Oct 5, 2025
2621cfb
handle core
kuqin12 Oct 5, 2025
2346f5d
handle MmSupervisorPkg/Library/MmSupervisorMemLib
kuqin12 Oct 5, 2025
e9bdf10
remove the header and dec definitions
kuqin12 Oct 5, 2025
bccf515
Decouple usage from SEA
kuqin12 Oct 5, 2025
3269fcb
Now it is a dxe driver
kuqin12 Oct 6, 2025
6a27232
changes to allow mm communicate to update the comm buffer
kuqin12 Oct 6, 2025
2e104a6
this should do better
kuqin12 Oct 7, 2025
e09917e
breaking up ipl and mmsupv suppot
kuqin12 Oct 9, 2025
b2d4367
Merge remote-tracking branch 'origin/main' into pei_n_ipl
kuqin12 Oct 27, 2025
0eaaf3b
Adding end of PEI handler
kuqin12 Nov 4, 2025
a40251c
Building allocation module hob just like the edk2 style
kuqin12 Nov 4, 2025
d4c41ec
look up the hob just like edk2 style
kuqin12 Nov 4, 2025
7d297ee
merge from top of main...
kuqin12 Dec 1, 2025
814e2a3
revert some changes
kuqin12 Dec 1, 2025
a166047
how about this?
kuqin12 Dec 1, 2025
7443b3a
revert more
kuqin12 Dec 1, 2025
4f44bdc
more changes
kuqin12 Dec 1, 2025
042119f
revert seom change
kuqin12 Dec 2, 2025
5da3a94
fixing the extra guids
kuqin12 Dec 2, 2025
c456b22
fixing end of pei
kuqin12 Dec 2, 2025
7bc1b57
Ring 3 broker register the callback
kuqin12 Dec 2, 2025
a7859ab
Do the translation
kuqin12 Dec 2, 2025
de21036
revert some changes
kuqin12 Dec 2, 2025
4fd35d0
add back spaces
kuqin12 Dec 2, 2025
205c5c5
protocol
kuqin12 Dec 2, 2025
ca744bd
Merge branch 'end_of_pei' into pei_n_ipl
kuqin12 Dec 2, 2025
c47f43e
fix build
kuqin12 Dec 2, 2025
91ec602
Merge remote-tracking branch 'origin/main' into pei_n_ipl
kuqin12 Dec 8, 2025
26544bf
move the mm close and lock back to IPL
kuqin12 Dec 8, 2025
2537813
fixing the build
kuqin12 Dec 8, 2025
e50c34e
clean up the inf
kuqin12 Dec 8, 2025
b66f8d3
fixing dsc
kuqin12 Dec 8, 2025
74c0816
uncru
kuqin12 Dec 8, 2025
0ceb8a7
adding x64 PEI build
kuqin12 Dec 8, 2025
8272fa2
Merge remote-tracking branch 'origin/main' into pei_n_ipl
kuqin12 Dec 10, 2025
09f7eed
Supervisor changes to bubble up the user mode not ready case
kuqin12 Dec 10, 2025
0ff44ca
simpler?
kuqin12 Dec 10, 2025
149d825
still need a real handler
kuqin12 Dec 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions MmSupervisorPkg/Core/Handler/Mmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ MmiManage (
CommBuffer,
CommBufferSize
);
if (Status == EFI_NOT_READY) {
// This is from the wrap itself due to ring 3 broker not ready, so we bail the loop and bubble it back to the caller
ReturnStatus = Status;
break;
}
} else if (SupervisorPath && MmiHandler->IsSupervisor) {
Status = MmiHandler->Handler (
(EFI_HANDLE)MmiHandler,
Expand Down
48 changes: 35 additions & 13 deletions MmSupervisorPkg/Core/MmSupervisorCore.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,17 @@ EFI_MEMORY_DESCRIPTOR mMmSupervisorAccessBuffer[MM_OPEN_BUFFER_CNT];
// Table of MMI Handlers that are registered by the MM Core when it is initialized
//
MM_CORE_MMI_HANDLERS mMmCoreMmiHandlers[] = {
{ MmDriverDispatchHandler, &gMmSupervisorDriverDispatchGuid, NULL, TRUE },
{ MmReadyToLockHandler, &gEfiDxeMmReadyToLockProtocolGuid, NULL, TRUE },
{ MmSupvRequestHandler, &gMmSupervisorRequestHandlerGuid, NULL, FALSE },
{ NULL, NULL, NULL, FALSE },
// Note: The driver dispatch handler is registered in user handler pool, to suffice the needs
// if a driver dispatch call is invoked from user space. The handler is intentionally left
// to duplicate the real dispatcher. Because if the ring 3 broker is ready, supervisor will
// dispatch to this handler after demotion, which will trip on #GP due to SMAP. Otherwise,
// if this is invoked before ring 3 broker being dispatched, the demotion routine will
// directly bail with EFI_NOT_READY.
{ MmDriverDispatchHandler, &gEventMmDispatchGuid, NULL, FALSE, FALSE },
{ MmDriverDispatchHandler, &gMmSupervisorDriverDispatchGuid, NULL, TRUE, TRUE },
{ MmReadyToLockHandler, &gEfiDxeMmReadyToLockProtocolGuid, NULL, TRUE, TRUE },
{ MmSupvRequestHandler, &gMmSupervisorRequestHandlerGuid, NULL, FALSE, TRUE },
{ NULL, NULL, NULL, FALSE, TRUE },
};

EFI_SYSTEM_TABLE *mEfiSystemTable;
Expand Down Expand Up @@ -385,13 +392,18 @@ MmReadyToLockHandler (
//
for (Index = 0; mMmCoreMmiHandlers[Index].HandlerType != NULL; Index++) {
if (mMmCoreMmiHandlers[Index].UnRegister) {
Status = MmiHandlerSupvUnRegister (mMmCoreMmiHandlers[Index].DispatchHandle);
if (mMmCoreMmiHandlers[Index].SupervisorHandler) {
Status = MmiHandlerSupvUnRegister (mMmCoreMmiHandlers[Index].DispatchHandle);
} else {
Status = MmiHandlerUserUnRegister (mMmCoreMmiHandlers[Index].DispatchHandle);
}
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
"Failed to unregister supervisor handler No. %d %g - %r\n",
"Failed to unregister supervisor handler No. %d %g (%a) - %r\n",
Index,
mMmCoreMmiHandlers[Index].HandlerType,
mMmCoreMmiHandlers[Index].SupervisorHandler ? "S" : "U",
Status
));
}
Expand Down Expand Up @@ -547,7 +559,8 @@ MmEntryPoint (

mMmCommunicationBufferStatus.IsCommBufferValid = FALSE;
mMmCommunicationBufferStatus.ReturnBufferSize = BufferSize;
mMmCommunicationBufferStatus.ReturnStatus = (Status == EFI_SUCCESS) ? EFI_SUCCESS : EFI_NOT_FOUND;
// Rather than typical not_found on errors, this will bubble up the not_ready error.
mMmCommunicationBufferStatus.ReturnStatus = (Status == EFI_SUCCESS) ? EFI_SUCCESS : ((Status == EFI_NOT_READY) ? EFI_NOT_READY : EFI_NOT_FOUND);
} else {
//
// This should be supervisor communicate channel, everything can be ring 0 buffer fine
Expand Down Expand Up @@ -1156,12 +1169,21 @@ MmSupervisorMain (
// Register all handlers in the core table
//
for (Index = 0; mMmCoreMmiHandlers[Index].HandlerType != NULL; Index++) {
Status = MmiSupvHandlerRegister (
mMmCoreMmiHandlers[Index].Handler,
mMmCoreMmiHandlers[Index].HandlerType,
&mMmCoreMmiHandlers[Index].DispatchHandle
);
DEBUG ((DEBUG_INFO, "MmiHandlerRegister - GUID %g - Status %d\n", mMmCoreMmiHandlers[Index].HandlerType, Status));
if (mMmCoreMmiHandlers[Index].SupervisorHandler) {
Status = MmiSupvHandlerRegister (
mMmCoreMmiHandlers[Index].Handler,
mMmCoreMmiHandlers[Index].HandlerType,
&mMmCoreMmiHandlers[Index].DispatchHandle
);
DEBUG ((DEBUG_INFO, "MmiSupvHandlerRegister - GUID %g - Status %d\n", mMmCoreMmiHandlers[Index].HandlerType, Status));
} else {
Status = MmiUserHandlerRegister (
mMmCoreMmiHandlers[Index].Handler,
mMmCoreMmiHandlers[Index].HandlerType,
&mMmCoreMmiHandlers[Index].DispatchHandle
);
DEBUG ((DEBUG_INFO, "MmiUserHandlerRegister - GUID %g - Status %d\n", mMmCoreMmiHandlers[Index].HandlerType, Status));
}
}

Status = InitializeMmSupervisorTestAgents ();
Expand Down
1 change: 1 addition & 0 deletions MmSupervisorPkg/Core/MmSupervisorCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ typedef struct {
EFI_GUID *HandlerType;
EFI_HANDLE DispatchHandle;
BOOLEAN UnRegister;
BOOLEAN SupervisorHandler;
} MM_CORE_MMI_HANDLERS;

//
Expand Down
1 change: 1 addition & 0 deletions MmSupervisorPkg/Core/MmSupervisorCore.inf
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@
gMmSupervisorRequestHandlerGuid ## SOMETIMES_CONSUMES ## GUID # SmiHandlerRegister
gMmSupervisorPolicyFileGuid ## CONSUMES
gMmPagingAuditMmiHandlerGuid ## SOMETIMES_CONSUMES
gEventMmDispatchGuid ## CONSUMES
gEfiHobMemoryAllocModuleGuid
gEfiMmPeiMmramMemoryReserveGuid

Expand Down
Loading
Loading