<p>Claiming the SNP devices has the side effect of raising the TPL to<br>
iPXE's normal operating level of TPL_CALLBACK (see the commit message<br>
for <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/ipxe/ipxe/commit/c89a446cf09f30a121ae21d91f4a1aa071044084/hovercard" href="https://github.com/ipxe/ipxe/commit/c89a446cf09f30a121ae21d91f4a1aa071044084"><tt>c89a446</tt></a> ("[efi] Run at TPL_CALLBACK to protect against UEFI<br>
timers") for details).  This must happen before executing any code<br>
that relies upon the TPL having been raised to TPL_CALLBACK.</p>
<p>The call to efi_snp_claim() in efi_download_start() currently happens<br>
only after the call to xfer_open().  Calling xfer_open() will<br>
typically result in a retry timer being started, which will result in<br>
a call to currticks() in order to initialise the timer.  The call to<br>
currticks() will drop to TPL_APPLICATION and restore to TPL_CALLBACK<br>
in order to allow a timer tick to occur.  Since this call happened<br>
before the call to efi_snp_claim(), the restored TPL is incorrect.</p>
<p>This in turn results in efi_snp_claim() recording the incorrect<br>
original TPL, causing efi_snp_release() to eventually restore the<br>
incorrect TPL, causing the system to lock up when ExitBootServices()<br>
is called at TPL_CALLBACK.</p>
<p>Fix by moving the call to efi_snp_claim() to the start of<br>
efi_download_start().</p>
<p>Debugged-by: Jarrod Johnson <a href="mailto:jjohnson2@lenovo.com">jjohnson2@lenovo.com</a><br>
Debugged-by: He He4 Huang <a href="mailto:huanghe4@lenovo.com">huanghe4@lenovo.com</a><br>
Signed-off-by: Michael Brown <a href="mailto:mcb30@ipxe.org">mcb30@ipxe.org</a></p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/ipxe/ipxe/pull/120'>https://github.com/ipxe/ipxe/pull/120</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>[efi] Claim SNP devices early in efi_download_start()</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/ipxe/ipxe/pull/120/files#diff-483c005ba52d598fea71235285d86a3a">src/interface/efi/efi_download.c</a>
    (5)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/ipxe/ipxe/pull/120.patch'>https://github.com/ipxe/ipxe/pull/120.patch</a></li>
  <li><a href='https://github.com/ipxe/ipxe/pull/120.diff'>https://github.com/ipxe/ipxe/pull/120.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/ipxe/ipxe/pull/120">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAFNGVGG5WYQGDG2H7TZZUDR3SJ67ANCNFSM4OZXWYQA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AAFNGVG6JGIPFW7VFKVONBLR3SJ67A5CNFSM4OZXWYQKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4JZFXMFQ.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/ipxe/ipxe/pull/120",
"url": "https://github.com/ipxe/ipxe/pull/120",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>