)]}'
{
  "commit": "562c74e1ea52a399f7a6c416e35d98f4b37888cf",
  "tree": "87e9f39ee8e0d61bca0af997dfc3a8a1fea739be",
  "parents": [
    "0f4cc4b5a7f780111c3ef2e1d4bba175896f8537"
  ],
  "author": {
    "name": "Michael Brown",
    "email": "mcb30@ipxe.org",
    "time": "Mon Nov 22 14:53:33 2021 +0000"
  },
  "committer": {
    "name": "Michael Brown",
    "email": "mcb30@ipxe.org",
    "time": "Tue Nov 23 15:55:01 2021 +0000"
  },
  "message": "[efi] Run ExitBootServices shutdown hook at TPL_NOTIFY\n\nOn some systems (observed with the Thunderbolt ports on a ThinkPad X1\nExtreme Gen3 and a ThinkPad P53), if the IOMMU is enabled then the\nsystem firmware will install an ExitBootServices notification event\nthat disables bus mastering on the Thunderbolt xHCI controller and all\nPCI bridges, and destroys any extant IOMMU mappings.  This leaves the\nxHCI controller unable to perform any DMA operations.\n\nAs described in commit 236299b (\"[xhci] Avoid DMA during shutdown if\nfirmware has disabled bus mastering\"), any subsequent DMA operation\nattempted by the xHCI controller will end up completing after the\noperating system kernel has reenabled bus mastering, resulting in a\nDMA operation to an area of memory that the hardware is no longer\npermitted to access and, on Windows with the Driver Verifier enabled,\na STOP 0xE6 (DRIVER_VERIFIER_DMA_VIOLATION).\n\nThat commit avoids triggering any DMA attempts during the shutdown of\nthe xHCI controller itself.  However, this is not a complete solution\nsince any attached and opened USB device (e.g. a USB NIC) may\nasynchronously trigger DMA attempts that happen to occur after bus\nmastering has been disabled but before we reset the xHCI controller.\n\nAvoid this problem by installing our own ExitBootServices notification\nevent at TPL_NOTIFY, thereby causing it to be invoked before the\nfirmware\u0027s own ExitBootServices notification event that disables bus\nmastering.\n\nThis unsurprisingly causes the shutdown hook itself to be invoked at\nTPL_NOTIFY, which causes a fatal error when later code attempts to\nraise the TPL to TPL_CALLBACK (which is a lower TPL).  Work around\nthis problem by redefining the \"internal\" iPXE TPL to be variable, and\nset this internal TPL to TPL_NOTIFY when the shutdown hook is invoked.\n\nAvoid calling into an underlying SNP protocol instance from within our\nshutdown hook at TPL_NOTIFY, since the underlying SNP driver may\nattempt to raise the TPL to TPL_CALLBACK (which would cause a fatal\nerror).  Failing to shut down the underlying SNP device is safe to do\nsince the underlying device must, in any case, have installed its own\nExitBootServices hook if any shutdown actions are required.\n\nReported-by: Andreas Hammarskjöld \u003cjunior@2PintSoftware.com\u003e\nTested-by: Andreas Hammarskjöld \u003cjunior@2PintSoftware.com\u003e\nSigned-off-by: Michael Brown \u003cmcb30@ipxe.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "b9f34650eaf174c34bdda46b99877d2990afc9b5",
      "old_mode": 33188,
      "old_path": "src/drivers/net/efi/nii.c",
      "new_id": "833462e77f9f0a97d3112a5d6cb410e99ef15ae0",
      "new_mode": 33188,
      "new_path": "src/drivers/net/efi/nii.c"
    },
    {
      "type": "modify",
      "old_id": "fb52402771b70dc34c3d2719239f56dd1020fcbc",
      "old_mode": 33188,
      "old_path": "src/drivers/net/efi/snpnet.c",
      "new_id": "69ec6f5e554e7b39f0fab73d0b800ec2034dcb13",
      "new_mode": 33188,
      "new_path": "src/drivers/net/efi/snpnet.c"
    },
    {
      "type": "modify",
      "old_id": "a83fa0f276e64990509b70bea9abe1925fd1e521",
      "old_mode": 33188,
      "old_path": "src/include/ipxe/efi/efi.h",
      "new_id": "1dd0d44538031e14781964798e9f330572fc9d22",
      "new_mode": 33188,
      "new_path": "src/include/ipxe/efi/efi.h"
    },
    {
      "type": "modify",
      "old_id": "70cd062939c60f745b0cbca5571dbb3ba77016ad",
      "old_mode": 33188,
      "old_path": "src/interface/efi/efi_entropy.c",
      "new_id": "1e8ddfb68d45f2eda50d9d8062d42d40a77dfbf9",
      "new_mode": 33188,
      "new_path": "src/interface/efi/efi_entropy.c"
    },
    {
      "type": "modify",
      "old_id": "1c6e9d440469c900078f1fae5af59b4bb4184f00",
      "old_mode": 33188,
      "old_path": "src/interface/efi/efi_init.c",
      "new_id": "5d98f9ff7b8d7fb310f6b7276cecdb3ef1d89639",
      "new_mode": 33188,
      "new_path": "src/interface/efi/efi_init.c"
    },
    {
      "type": "modify",
      "old_id": "405cd3454f430c32d53d22baf2b772123122f068",
      "old_mode": 33188,
      "old_path": "src/interface/efi/efi_timer.c",
      "new_id": "6427eb1d82bc94617b261177a627611ddcd31f63",
      "new_mode": 33188,
      "new_path": "src/interface/efi/efi_timer.c"
    }
  ]
}
