New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable iommu #186

Merged
merged 5 commits into from Aug 3, 2018
Commits on Jul 25, 2018
  1. nb/amd/pi/00730F01: Add initial native IVRS support

    madscientist159 authored and pietrushnic committed Jun 13, 2016
    - Iteration over devices in add_ivrs_device_entries were simplified to
    decrease complexity.
    - Code was structured to satisfy checkpatch
    
    Change-Id: I1ae789f75363435accd14a1b556e1570f43f94c4
    Signed-off-by: Timothy Pearson <tpearson@raptorengineering.com>
    Signed-off-by: Piotr Król <piotr.krol@3mdeb.com>
  2. nb/amd/pi/00730F01: Initialize IOMMU device

    kmalkki authored and pietrushnic committed Jun 14, 2016
    Change-Id: I12d3ed35770ee06626f884db23004652084c88c0
    Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
  3. pcengines/apu2: enable IOMMU for all apu2 variants

    pietrushnic committed May 4, 2018
    IOMMU was tested on Xen 4.8 and Linux kernel 4.14.33. Following feature
    set is enabled:
    (XEN) AMD-Vi: Disabled HAP memory map sharing with IOMMU
    (XEN) AMD-Vi: IOMMU Extended Features:
    (XEN)  - Peripheral Page Service Request
    (XEN)  - Guest Translation
    (XEN)  - Invalidate All Command
    (XEN)  - Guest APIC supported
    (XEN)  - Performance Counters
    (XEN) AMD-Vi: IOMMU 0 Enabled.
    
    Change-Id: I6dbfae78849248f3532caa78974c8f2ce61a530d
    Signed-off-by: Piotr Król <piotr.krol@3mdeb.com>
  4. [WIP] AGESA binaryPI: Fix CAR_GLOBAL use for AP CPUs

    kmalkki authored and pietrushnic committed May 5, 2018
    The memory between _car_region_start .. _car_region_end has to
    be set up as WB in MTRRs for all the cores executing through
    bootblock, verstage and romstage. Otherwise CAR_GLOBALs may
    fail on AP CPUs.
    
    Combination of CBMEM_CONSOLE=y with SQUELCH_EARLY_SMP=n is
    still broken with corrupted early console in memory.
    
    Change-Id: I4abcec90c03046e32dafcf97d2f7228ca93c5549
    Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
    Signed-off-by: Marshall Dawson <marshalldawson3rd@gmail.com>
  5. nb/amd/pi/00730F01: use MMIO and performance counters from AGESA

    pietrushnic committed Jul 22, 2018
    This patch contain minimal set of changes to initial IVRS implementation
    to make it work reliably. Code in this patch was tested with Xen 4.8 and
    Debian 4.14.y - this software stack survived 100x reboots without any
    hang on PC Engines apu2c4. Previously using IVRS provided by AGESA lead
    to 29/100 hangs.
    
    MMIO base shall not be hard coded since this value depends on platform
    design.
    
    Performance counters were selected experimentally, since lack of
    them cause 4.14.y panic:
    [    1.064229] AMD-Vi: IOMMU performance counters supported
    [    1.069579] BUG: unable to handle kernel paging request at ffffaffc4065c000
    [    1.073554] IP: iommu_go_to_state+0xf8a/0x1260
    [    1.073554] PGD 12a11f067 P4D 12a11f067 PUD 12a120067 PMD 129b69067 PTE 0
    [    1.073554] Oops: 0000 [#1] SMP NOPTI
    [    1.073554] Modules linked in:
    [    1.073554] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.14.50 #13
    [    1.073554] Hardware name: PC Engines apu2/apu2, BIOS 4.8-1174-gf12b3046f0-d2
    [    1.073554] task: ffff8d5d69b9f040 task.stack: ffffaffc40648000
    [    1.073554] RIP: 0010:iommu_go_to_state+0xf8a/0x1260
    [    1.073554] RSP: 0018:ffffaffc4064be28 EFLAGS: 00010282
    [    1.073554] RAX: ffffaffc40658000 RBX: ffff8d5d69bae000 RCX: ffffffff99e57b88
    [    1.073554] RDX: 0000000000000000 RSI: 0000000000000092 RDI: 0000000000000246
    [    1.073554] RBP: 0000000000000040 R08: 0000000000000001 R09: 0000000000000170
    [    1.073554] R10: 0000000000000000 R11: ffffffff9a435e2d R12: 0000000000000000
    [    1.073554] R13: ffffffff9a29a830 R14: 0000000000000000 R15: 0000000000000000
    [    1.073554] FS:  0000000000000000(0000) GS:ffff8d5d6ec80000(0000) knlGS:00000
    [    1.073554] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [    1.073554] CR2: ffffaffc4065c000 CR3: 000000010fa0a000 CR4: 00000000000406e0
    [    1.073554] Call Trace:
    [    1.073554]  ? set_debug_rodata+0x11/0x11
    [    1.073554]  amd_iommu_init+0x11/0x89
    [    1.073554]  pci_iommu_init+0x16/0x3f
    [    1.073554]  ? e820__memblock_setup+0x60/0x60
    [    1.073554]  do_one_initcall+0x51/0x190
    [    1.073554]  ? set_debug_rodata+0x11/0x11
    [    1.073554]  kernel_init_freeable+0x16b/0x1ec
    [    1.073554]  ? rest_init+0xb0/0xb0
    [    1.073554]  kernel_init+0xa/0xf7
    [    1.073554]  ret_from_fork+0x22/0x40
    [    1.073554] Code: d2 31 f6 48 89 df e8 d8 15 02 ff 85 c0 75 d1 48 8b 44 24 2
    [    1.073554] RIP: iommu_go_to_state+0xf8a/0x1260 RSP: ffffaffc4064be28
    [    1.073554] CR2: ffffaffc4065c000
    [    1.073554] ---[ end trace 44588f98aa7c7c0b ]---
    [    1.255973] Kernel panic - not syncing: Attempted to kill init! exitcode=0x09
    [    1.255973]
    [    1.259934] ---[ end Kernel panic - not syncing: Attempted to kill init! exi9
    
    Possible future improvements:
    - compare device entries with values returned by AGESA
    - enable EFRSup (this is enabled in AGESA)
    - try various IVHD flags (there is difference between initial
    implementation and AGESA)
    
    Change-Id: I7e3a3d21f295ae96962d7718b9568fc4b67eb23d
    Signed-off-by: Piotr Król <piotr.krol@3mdeb.com>