- 23 Aug, 2019 1 commit
-
-
Kai-Heng Feng authored
Raven Ridge systems may have malfunction touchpad or hang at boot if incorrect IVRS IOAPIC is provided by BIOS. Users already found correct "ivrs_ioapic=" values, let's put them inside kernel to workaround buggy BIOS. BugLink: https://bugs.launchpad.net/bugs/1795292 BugLink: https://bugs.launchpad.net/bugs/1837688 Reported-by:
kbuild test robot <lkp@intel.com> Signed-off-by:
Kai-Heng Feng <kai.heng.feng@canonical.com> Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
- 23 Jul, 2019 1 commit
-
-
Suthikulpanit, Suravee authored
AMD IOMMU requires IntCapXT registers to be setup in order to generate its own interrupts (for Event Log, PPR Log, and GA Log) with 32-bit APIC destination ID. Without this support, AMD IOMMU MSI interrupts will not be routed correctly when booting the system in X2APIC mode. Cc: Joerg Roedel <joro@8bytes.org> Fixes: 90fcffd9 ('iommu/amd: Add support for IOMMU XT mode') Signed-off-by:
Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
- 01 Jul, 2019 3 commits
-
-
Kevin Mitchell authored
When amd_iommu=off was specified on the command line, free_X_resources functions were called immediately after early_amd_iommu_init. They were then called again when amd_iommu_init also failed (as expected). Instead, call them only once: at the end of state_next() whenever there's an error. These functions should be safe to call any time and any number of times. However, since state_next is never called again in an error state, the cleanup will only ever be run once. This also ensures that cleanup code is run as soon as possible after an error is detected rather than waiting for amd_iommu_init() to be called. Signed-off-by:
Kevin Mitchell <kevmitch@arista.com> Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
Kevin Mitchell authored
The fallback to the GART driver in the case amd_iommu doesn't work was executed in a function called free_iommu_resources, which didn't really make sense. This was even being called twice if amd_iommu=off was specified on the command line. The only complication is that it needs to be verified that amd_iommu has fully relinquished control by calling free_iommu_resources and emptying the amd_iommu_list. Signed-off-by:
Kevin Mitchell <kevmitch@arista.com> Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
Kevin Mitchell authored
Make it safe to call iommu_disable during early init error conditions before mmio_base is set, but after the struct amd_iommu has been added to the amd_iommu_list. For example, this happens if firmware fails to fill in mmio_phys in the ACPI table leading to a NULL pointer dereference in iommu_feature_disable. Fixes: 2c0ae172 ('iommu/amd: Convert iommu initialization to state machine') Signed-off-by:
Kevin Mitchell <kevmitch@arista.com> Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
- 05 Jun, 2019 1 commit
-
-
Thomas Gleixner authored
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details you should have received a copy of the gnu general public license along with this program if not write to the free software foundation inc 59 temple place suite 330 boston ma 02111 1307 usa extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 136 file(s). Signed-off-by:
Thomas Gleixner <tglx@linutronix.de> Reviewed-by:
Alexios Zavras <alexios.zavras@intel.com> Reviewed-by:
Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190530000436.384967451@linutronix.de Signed-off-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
- 26 Apr, 2019 1 commit
-
-
Joerg Roedel authored
This variable hold a global list of allocated protection domains in the AMD IOMMU driver. By now this list is never traversed anymore, so the list and the lock protecting it can be removed. Cc: Tom Murphy <tmurphy@arista.com> Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
- 12 Apr, 2019 1 commit
-
-
Joerg Roedel authored
The exlcusion range limit register needs to contain the base-address of the last page that is part of the range, as bits 0-11 of this register are treated as 0xfff by the hardware for comparisons. So correctly set the exclusion range in the hardware to the last page which is _in_ the range. Fixes: b2026aa2 ('x86, AMD IOMMU: add functions for programming IOMMU MMIO space') Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
- 29 Mar, 2019 1 commit
-
-
Joerg Roedel authored
If a device has an exclusion range specified in the IVRS table, this region needs to be reserved in the iova-domain of that device. This hasn't happened until now and can cause data corruption on data transfered with these devices. Treat exclusion ranges as reserved regions in the iommu-core to fix the problem. Fixes: be2a022c ('x86, AMD IOMMU: add functions to parse IOMMU memory mapping requirements for devices') Signed-off-by:
Joerg Roedel <jroedel@suse.de> Reviewed-by:
Gary R Hook <gary.hook@amd.com>
-
- 11 Feb, 2019 1 commit
-
-
Bjorn Helgaas authored
Use dev_printk() when possible so the IOMMU messages are more consistent with other messages related to the device. Signed-off-by:
Bjorn Helgaas <bhelgaas@google.com> Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
- 28 Nov, 2018 1 commit
-
-
Joerg Roedel authored
Make use of pr_fmt instead of having the 'AMD-Vi' prefix added manually at every printk() call. Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
- 12 Nov, 2018 1 commit
-
-
Filippo Sironi authored
This register should have been programmed with the physical address of the memory location containing the shadow tail pointer for the guest virtual APIC log instead of the base address. Fixes: 8bda0cfb ('iommu/amd: Detect and initialize guest vAPIC log') Signed-off-by:
Filippo Sironi <sironi@amazon.de> Signed-off-by:
Wei Wang <wawei@amazon.de> Signed-off-by:
Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
- 06 Oct, 2018 1 commit
-
-
Lianbo Jiang authored
The kdump kernel copies the IOMMU device table from the old device table which is encrypted when SME is enabled in the first kernel. So remap the old device table with the memory encryption mask in the kdump kernel. [ bp: Massage commit message. ] Signed-off-by:
Lianbo Jiang <lijiang@redhat.com> Signed-off-by:
Borislav Petkov <bp@suse.de> Reviewed-by:
Tom Lendacky <thomas.lendacky@amd.com> Acked-by:
Joerg Roedel <jroedel@suse.de> Cc: kexec@lists.infradead.org Cc: tglx@linutronix.de Cc: mingo@redhat.com Cc: hpa@zytor.com Cc: akpm@linux-foundation.org Cc: dan.j.williams@intel.com Cc: bhelgaas@google.com Cc: baiyaowei@cmss.chinamobile.com Cc: tiwai@suse.de Cc: brijesh.singh@amd.com Cc: dyoung@redhat.com Cc: bhe@redhat.com Link: https://lkml.kernel.org/r/20180930031033.22110-4-lijiang@redhat.com
-
- 05 Oct, 2018 1 commit
-
-
Joerg Roedel authored
The function is only called from another __init function, so it should be moved to .init too. Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
- 06 Jul, 2018 3 commits
-
-
Suravee Suthikulpanit authored
The AMD IOMMU XT mode enables interrupt remapping with 32-bit destination APIC ID, which is required for x2APIC. The feature is available when the XTSup bit is set in the IOMMU Extended Feature register and/or the IVHD Type 10h IOMMU Feature Reporting field. For more information, please see section "IOMMU x2APIC Support" of the AMD I/O Virtualization Technology (IOMMU) Specification. Cc: Joerg Roedel <jroedel@suse.de> Signed-off-by:
Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
Suravee Suthikulpanit authored
Currently, the driver only supports lower 32-bit of IOMMU Control register. However, newer AMD IOMMU specification has extended this register to 64-bit. Therefore, replace the accessing API with the 64-bit version. Cc: Joerg Roedel <jroedel@suse.de> Signed-off-by:
Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
Gary R Hook authored
Implement a skeleton framework for debugfs support in the AMD IOMMU. Add an AMD-specific Kconfig boolean that depends upon general enablement of DebugFS in the IOMMU. Signed-off-by:
Gary R Hook <gary.hook@amd.com> Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
- 13 Feb, 2018 1 commit
-
-
Scott Wood authored
Several functions in this driver are called from atomic context, and thus raw locks must be used in order to be safe on PREEMPT_RT. This includes paths that must wait for command completion, which is a potential PREEMPT_RT latency concern but not easily avoidable. Signed-off-by:
Scott Wood <swood@redhat.com> Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
- 11 Jan, 2018 1 commit
-
-
Sinan Kaya authored
pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers. Getting ready to remove pci_get_bus_and_slot() function in favor of pci_get_domain_bus_and_slot(). Hard-code the domain number as 0 for the AMD IOMMU driver. Signed-off-by:
Sinan Kaya <okaya@codeaurora.org> Signed-off-by:
Bjorn Helgaas <helgaas@kernel.org> Reviewed-by:
Gary R Hook <gary.hook@amd.com> Acked-by:
Joerg Roedel <jroedel@suse.de>
-
- 27 Sep, 2017 1 commit
-
-
Arvind Yadav authored
pr_err() messages should end with a new-line to avoid other messages being concatenated. So replace '/n' with '\n'. Signed-off-by:
Arvind Yadav <arvind.yadav.cs@gmail.com> Fixes: 45a01c42 ('iommu/amd: Add function copy_dev_tables()') Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
- 19 Aug, 2017 2 commits
-
-
Joerg Roedel authored
The variable amd_iommu_pre_enabled is used in non-init code-paths, so remove the __initdata annotation. Reported-by:
kbuild test robot <fengguang.wu@intel.com> Fixes: 3ac3e5ee ('iommu/amd: Copy old trans table from old kernel') Acked-by:
Baoquan He <bhe@redhat.com> Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
Joerg Roedel authored
This was reported by the kbuild bot. The condition in which entry would be used uninitialized can not happen, because when there is no iommu this function would never be called. But its no fast-path, so fix the warning anyway. Reported-by:
kbuild test robot <fengguang.wu@intel.com> Acked-by:
Baoquan He <bhe@redhat.com> Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
- 15 Aug, 2017 9 commits
-
-
Baoquan He authored
It's ok to disable iommu early in normal kernel or in kdump kernel when amd_iommu=off is specified. While we should not disable it in kdump kernel when on-flight dma is still on-going. Signed-off-by:
Baoquan He <bhe@redhat.com> Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
Baoquan He authored
When iommu is pre_enabled in kdump kernel, if a device is set up with guest translations (DTE.GV=1), then don't copy GCR3 table root pointer but move the device over to an empty guest-cr3 table and handle the faults in the PPR log (which answer them with INVALID). After all these PPR faults are recoverable for the device and we should not allow the device to change old-kernels data when we don't have to. Signed-off-by:
Baoquan He <bhe@redhat.com> Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
Baoquan He authored
AMD pointed out it's unsafe to update the device-table while iommu is enabled. It turns out that device-table pointer update is split up into two 32bit writes in the IOMMU hardware. So updating it while the IOMMU is enabled could have some nasty side effects. The safe way to work around this is to always allocate the device-table below 4G, including the old device-table in normal kernel and the device-table used for copying the content of the old device-table in kdump kernel. Meanwhile we need check if the address of old device-table is above 4G because it might has been touched accidentally in corrupted 1st kernel. Signed-off-by:
Baoquan He <bhe@redhat.com> Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
Baoquan He authored
Firstly split the dev table entry copy into address translation part and irq remapping part. Because these two parts could be enabled independently. Secondly do sanity check for address translation and irq remap of old dev table entry separately. Signed-off-by:
Baoquan He <bhe@redhat.com> Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
Baoquan He authored
Here several things need be done: - If iommu is pre-enabled in a normal kernel, just disable it and print warning. - If any one of IOMMUs is not pre-enabled in kdump kernel, just continue as it does in normal kernel. - If failed to copy dev table of old kernel, continue to proceed as it does in normal kernel. - Only if all IOMMUs are pre-enabled and copy dev table is done well, free the dev table allocated in early_amd_iommu_init() and make amd_iommu_dev_table point to the copied one. - Disable and Re-enable event/cmd buffer, install the copied DTE table to reg, and detect and enable guest vapic. - Flush all caches Signed-off-by:
Baoquan He <bhe@redhat.com> Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
Baoquan He authored
Add function copy_dev_tables to copy the old DEV table entries of the panicked kernel to the new allocated device table. Since all iommus share the same device table the copy only need be done one time. Here add a new global old_dev_tbl_cpy to point to the newly allocated device table which the content of old device table will be copied to. Besides, we also need to: - Check whether all IOMMUs actually use the same device table with the same size - Verify that the size of the old device table is the expected size. - Reserve the old domain id occupied in 1st kernel to avoid touching the old io-page tables. Then on-flight DMA can continue looking it up. And also define MACRO DEV_DOMID_MASK to replace magic number 0xffffULL, it can be reused in copy_dev_tables(). Signed-off-by:
Baoquan He <bhe@redhat.com> Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
Baoquan He authored
This reverts commit 54bd6357 . We still need the IO_PAGE_FAULT message to warn error after the issue of on-flight dma in kdump kernel is fixed. Signed-off-by:
Baoquan He <bhe@redhat.com> Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
Baoquan He authored
Move single iommu enabling codes into a wrapper function early_enable_iommu(). This can make later kdump change easier. And also add iommu_disable_command_buffer and iommu_disable_event_buffer for later usage. Signed-off-by:
Baoquan He <bhe@redhat.com> Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
Baoquan He authored
Add functions to check whether translation is already enabled in IOMMU. Signed-off-by:
Baoquan He <bhe@redhat.com> Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
- 26 Jul, 2017 1 commit
-
-
Joerg Roedel authored
The register_syscore_ops() function takes a mutex and might sleep. In the IOMMU initialization code it is invoked during irq-remapping setup already, where irqs are disabled. This causes a schedule-while-atomic bug: BUG: sleeping function called from invalid context at kernel/locking/mutex.c:747 in_atomic(): 0, irqs_disabled(): 1, pid: 1, name: swapper/0 no locks held by swapper/0/1. irq event stamp: 304 hardirqs last enabled at (303): [<ffffffff818a87b6>] _raw_spin_unlock_irqrestore+0x36/0x60 hardirqs last disabled at (304): [<ffffffff8235d440>] enable_IR_x2apic+0x79/0x196 softirqs last enabled at (36): [<ffffffff818ae75f>] __do_softirq+0x35f/0x4ec softirqs last disabled at (31): [<ffffffff810c1955>] irq_exit+0x105/0x120 CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.13.0-rc2.1.el7a.test.x86_64.debug #1 Hardware name: PowerEdge C6145 /040N24, BIOS 3.5.0 10/28/2014 Call Trace: dump_stack+0x85/0xca ___might_sleep+0x22a/0x260 __might_sleep+0x4a/0x80 __mutex_lock+0x58/0x960 ? iommu_completion_wait.part.17+0xb5/0x160 ? register_syscore_ops+0x1d/0x70 ? iommu_flush_all_caches+0x120/0x150 mutex_lock_nested+0x1b/0x20 register_syscore_ops+0x1d/0x70 state_next+0x119/0x910 iommu_go_to_state+0x29/0x30 amd_iommu_enable+0x13/0x23 Fix it by moving the register_syscore_ops() call to the next initialization step, which runs with irqs enabled. Reported-by:
Artem Savkov <asavkov@redhat.com> Tested-by:
Artem Savkov <asavkov@redhat.com> Acked-by:
Thomas Gleixner <tglx@linutronix.de> Fixes: 2c0ae172 ('iommu/amd: Convert iommu initialization to state machine') Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
- 18 Jul, 2017 1 commit
-
-
Tom Lendacky authored
The IOMMU is programmed with physical addresses for the various tables and buffers that are used to communicate between the device and the driver. When the driver allocates this memory it is encrypted. In order for the IOMMU to access the memory as encrypted the encryption mask needs to be included in these physical addresses during configuration. The PTE entries created by the IOMMU should also include the encryption mask so that when the device behind the IOMMU performs a DMA, the DMA will be performed to encrypted memory. Signed-off-by:
Tom Lendacky <thomas.lendacky@amd.com> Reviewed-by:
Thomas Gleixner <tglx@linutronix.de> Reviewed-by:
Borislav Petkov <bp@suse.de> Acked-by:
Joerg Roedel <jroedel@suse.de> Cc: <iommu@lists.linux-foundation.org> Cc: Alexander Potapenko <glider@google.com> Cc: Andrey Ryabinin <aryabinin@virtuozzo.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Borislav Petkov <bp@alien8.de> Cc: Brijesh Singh <brijesh.singh@amd.com> Cc: Dave Young <dyoung@redhat.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: Larry Woodman <lwoodman@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Matt Fleming <matt@codeblueprint.co.uk> Cc: Michael S. Tsirkin <mst@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Radim Krčmář <rkrcmar@redhat.com> Cc: Rik van Riel <riel@redhat.com> Cc: Toshimitsu Kani <toshi.kani@hpe.com> Cc: kasan-dev@googlegroups.com Cc: kvm@vger.kernel.org Cc: linux-arch@vger.kernel.org Cc: linux-doc@vger.kernel.org Cc: linux-efi@vger.kernel.org Cc: linux-mm@kvack.org Link: http://lkml.kernel.org/r/3053631ea25ba8b1601c351cb7c541c496f6d9bc.1500319216.git.thomas.lendacky@amd.com Signed-off-by:
Ingo Molnar <mingo@kernel.org>
-
- 22 Jun, 2017 7 commits
-
-
Joerg Roedel authored
This check needs to happens later now, when all previously enabled IOMMUs have been disabled. Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
Joerg Roedel authored
After we made sure that all IOMMUs have been disabled we need to make sure that all resources we allocated are released again. Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
Joerg Roedel authored
Avoid any tries to double-free these pointers. Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
Joerg Roedel authored
Check if we are in an error state already before calling into state_next(). Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
Joerg Roedel authored
This will be used when during initialization we detect that the iommu should be disabled. Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
Joerg Roedel authored
The function will also be used to free iommu resources when amd_iommu=off was specified on the kernel command line. So rename the function to reflect that. Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-
Joerg Roedel authored
When booting, make sure the IOMMUs are disabled. They could be previously enabled if we boot into a kexec or kdump kernel. So make sure they are off. Signed-off-by:
Joerg Roedel <jroedel@suse.de>
-