[vmm] Implement mask/unmask support in IO APIC

Our current IO APIC doesn't support masking / unmasking interrupts.
Instead, received interrupts will always be immediately forwarded to
whatever is configured in their redirect entry.

We have mostly gotten away with this imperfect implementation so far:
guest kernels sometimes complain about spurious interrupts, but
otherwise handle things just fine.

More recent Linux kernels however have changed how they perform IO APIC
shutdown. During shutdown, each IO APIC redirect register is set to
masked, but otherwise zeroed out. If, during shutdown, an interrupt
happens to fire, our IO APIC implementation will ignore the mask bit and
instead deliver an interrupt to vector 0, which is interpreted by guests
as a divide-by-zero exception. http://fxbug.dev/82015 is an example of
such a bug.

This CL adds support for masking/unmasking interrupts in the IO APIC:

 * If an IRQ is received while it is unmasked, nothing changes.

 * If an IRQ is received while it is masked, it is marked as pending.
   When it is finally unmasked, the current value in the IRQ's redirect
   register will be used as the destination.

Fixed: 82015

Change-Id: I0c3d3b145fb8a025b33d7d169c8022cac2c2bc87
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/613549
Commit-Queue: Auto-Submit <auto-submit@fuchsia-infra.iam.gserviceaccount.com>
Fuchsia-Auto-Submit: David Greenaway <dgreenaway@google.com>
Reviewed-by: Abdulla Kamar <abdulla@google.com>
4 files changed
tree: c315cab84921c438937b6f58885042fb55ecfd75
  1. boards/
  2. build/
  3. bundles/
  4. docs/
  5. examples/
  6. garnet/
  7. products/
  8. scripts/
  9. sdk/
  10. src/
  11. third_party/
  12. tools/
  13. zircon/
  14. .clang-format
  15. .clang-tidy
  16. .git-blame-ignore-revs
  17. .gitattributes
  18. .gitignore
  19. .gn
  20. .style.yapf
  21. analysis_options.yaml
  22. AUTHORS
  23. BUILD.gn
  24. CODE_OF_CONDUCT.md
  25. CONTRIBUTING.md
  26. LICENSE
  27. OWNERS
  28. PATENTS
  29. pyrightconfig.json
  30. README.md
  31. rustfmt.toml
README.md

Fuchsia

What is Fuchsia?

Fuchsia an open source, general purpose operating system supporting modern 64-bit Intel and ARM processors.

We expect everyone interacting with our project to respect our code of conduct.

Read more about Fuchsia's principles.

How can I build and run Fuchsia?

See Getting Started.

Where can I learn more about Fuchsia?

See fuchsia.dev.