Tyche td0 merge#1
Open
YuChen-Qian wants to merge 12 commits into
Open
Conversation
Tyche TD0 does not implement memory acceptance for now. Unaccepted memory was added in UEFI 2.9. The TD needs to accept the memoory given by the VMM. The UEFI firmware needs to communicate which memory regions has been accepted through a bitmap to the kernel, and allocate_e820 allocates the bitmap if unaccepted memory is present. Ideally, we should implement this part inside tyche as well so that each TD can choose whether or not it accepts the memory or not, but we can skip it for now. Tyche TD0 does not implement memory encryption. Instead, we make sure the tyche regions between different domains are configured correctly. Tyche TD0 will forces SWIOTLB for all of the DMA regions. The SWIOTLB is essentially a bounce buffer and marked as shared (and decrypted) in the current kernel implementation. Ideally, a shared tyche region between the host kvm and the TD0 will be mapped into this region. Tyche TD0 does not support transferring pages between private and shared memory for now. Signed-off-by: YuChen Qian <yuchenqian96@gmail.com>
Compile the tyche driver in-tree, so that we can export the symbol of some of the tyche driver functions and call them from the kvm tyche backend. If we keep the tyche driver out of tree, then it would be impossible to link these external tyche driver symbols and the linux kernel fails to compile. Signed-off-by: YuChen Qian <yuchenqian96@gmail.com>
If we keep adding object files to obj-$(CONFIG_TYCHE_DRIVER), the kernel will try to compile a separate .ko for each of the object file... This commit fixes this issue by adding the $(TARGET_MODULE)-objs and keep all of the object files there. Signed-off-by: YuChen Qian <yuchenqian96@gmail.com>
The driver so far relied on the domain_handle_t (a file descriptor) to reference a domain inside its functions. We won't have a file descriptor from the kvm-tyche backend, so I changed the API of the src/domains.c functions to take a direct pointer to the domain.
so that we can directly include the headers there Signed-off-by: YuChen Qian <yuchenqian96@gmail.com>
Add an extra argument to the tyche_create_domain(), so that we can differentiate the I/O domain from the normal trust domain. The I/O domain is solely responsible for managing the IOMMU on tyche. Signed-off-by: YuChen Qian <yuchenqian96@gmail.com>
The coherent DMA buffer allocation will be inside the specified swiotlb range. A separate memory allocator is added for this purpose so that the coherent DMA buffer allocation will go through functions like `swiotlb_alloc` and `swiotlb_free`. We need to turn off the CONFIG_SWIOTLB_DYNAMIC so that linux does not allocate buffer at runtime. Tyche needs to first specify some shared regions and the TD0 will first enumerate the capa and then allocates the bounce buffer on this range. Once the bounce buffer is allocated successfully, the TD0 asks tyche to segment the region and will send the capa of the shared region to tyche. Tyche then updates the IOPT on the IOMMU. There will be no updates to the IOMMU when the TD0 kernel is running. The TD0 should not modify the IOMMU and will boot up with "iommu=off". Signed-off-by: YuChen Qian <yuchenqian96@gmail.com>
This reverts commit 851594c.
This reverts commit 1a50729.
Signed-off-by: YuChen Qian <yuchenqian96@gmail.com>
YuChen-Qian
pushed a commit
that referenced
this pull request
Feb 11, 2024
…phys
When booting with "intremap=off" and "x2apic_phys" on the kernel command
line, the physical x2APIC driver ends up being used even when x2APIC
mode is disabled ("intremap=off" disables x2APIC mode). This happens
because the first compound condition check in x2apic_phys_probe() is
false due to x2apic_mode == 0 and so the following one returns true
after default_acpi_madt_oem_check() having already selected the physical
x2APIC driver.
This results in the following panic:
kernel BUG at arch/x86/kernel/apic/io_apic.c:2409!
invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.4.0-rc2-ver4.1rc2 #2
Hardware name: Dell Inc. PowerEdge R6515/07PXPY, BIOS 2.3.6 07/06/2021
RIP: 0010:setup_IO_APIC+0x9c/0xaf0
Call Trace:
<TASK>
? native_read_msr
apic_intr_mode_init
x86_late_time_init
start_kernel
x86_64_start_reservations
x86_64_start_kernel
secondary_startup_64_no_verify
</TASK>
which is:
setup_IO_APIC:
apic_printk(APIC_VERBOSE, "ENABLING IO-APIC IRQs\n");
for_each_ioapic(ioapic)
BUG_ON(mp_irqdomain_create(ioapic));
Return 0 to denote that x2APIC has not been enabled when probing the
physical x2APIC driver.
[ bp: Massage commit message heavily. ]
Fixes: 9ebd680 ("x86, apic: Use probe routines to simplify apic selection")
Signed-off-by: Dheeraj Kumar Srivastava <dheerajkumar.srivastava@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Kishon Vijay Abraham I <kvijayab@amd.com>
Reviewed-by: Vasant Hegde <vasant.hegde@amd.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@gmail.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20230616212236.1389-1-dheerajkumar.srivastava@amd.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.