mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 16:13:19 +09:00
iommu/hyper-v: Allow hyperv irq remapping without x2apic
If x2apic is not available, hyperv-iommu skips remapping irqs. This breaks root partition which always needs irqs remapped. Fix this by allowing irq remapping regardless of x2apic, and change hyperv_enable_irq_remapping() to return IRQ_REMAP_XAPIC_MODE in case x2apic is missing. Tested with root and non-root hyperv partitions. Signed-off-by: Nuno Das Neves <nunodasneves@linux.microsoft.com> Reviewed-by: Tianyu Lan <Tianyu.Lan@microsoft.com> Reviewed-by: Michael Kelley <mikelley@microsoft.com> Link: https://lore.kernel.org/r/1668715899-8971-1-git-send-email-nunodasneves@linux.microsoft.com Signed-off-by: Wei Liu <wei.liu@kernel.org>
This commit is contained in:
@@ -475,6 +475,12 @@ static bool __init ms_hyperv_x2apic_available(void)
|
|||||||
* (logically) generates MSIs directly to the system APIC irq domain.
|
* (logically) generates MSIs directly to the system APIC irq domain.
|
||||||
* There is no HPET, and PCI MSI/MSI-X interrupts are remapped by the
|
* There is no HPET, and PCI MSI/MSI-X interrupts are remapped by the
|
||||||
* pci-hyperv host bridge.
|
* pci-hyperv host bridge.
|
||||||
|
*
|
||||||
|
* Note: for a Hyper-V root partition, this will always return false.
|
||||||
|
* The hypervisor doesn't expose these HYPERV_CPUID_VIRT_STACK_* cpuids by
|
||||||
|
* default, they are implemented as intercepts by the Windows Hyper-V stack.
|
||||||
|
* Even a nested root partition (L2 root) will not get them because the
|
||||||
|
* nested (L1) hypervisor filters them out.
|
||||||
*/
|
*/
|
||||||
static bool __init ms_hyperv_msi_ext_dest_id(void)
|
static bool __init ms_hyperv_msi_ext_dest_id(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -474,13 +474,13 @@ config QCOM_IOMMU
|
|||||||
Support for IOMMU on certain Qualcomm SoCs.
|
Support for IOMMU on certain Qualcomm SoCs.
|
||||||
|
|
||||||
config HYPERV_IOMMU
|
config HYPERV_IOMMU
|
||||||
bool "Hyper-V x2APIC IRQ Handling"
|
bool "Hyper-V IRQ Handling"
|
||||||
depends on HYPERV && X86
|
depends on HYPERV && X86
|
||||||
select IOMMU_API
|
select IOMMU_API
|
||||||
default HYPERV
|
default HYPERV
|
||||||
help
|
help
|
||||||
Stub IOMMU driver to handle IRQs as to allow Hyper-V Linux
|
Stub IOMMU driver to handle IRQs to support Hyper-V Linux
|
||||||
guests to run with x2APIC mode enabled.
|
guest and root partitions.
|
||||||
|
|
||||||
config VIRTIO_IOMMU
|
config VIRTIO_IOMMU
|
||||||
tristate "Virtio IOMMU driver"
|
tristate "Virtio IOMMU driver"
|
||||||
|
|||||||
@@ -122,9 +122,12 @@ static int __init hyperv_prepare_irq_remapping(void)
|
|||||||
const char *name;
|
const char *name;
|
||||||
const struct irq_domain_ops *ops;
|
const struct irq_domain_ops *ops;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For a Hyper-V root partition, ms_hyperv_msi_ext_dest_id()
|
||||||
|
* will always return false.
|
||||||
|
*/
|
||||||
if (!hypervisor_is_type(X86_HYPER_MS_HYPERV) ||
|
if (!hypervisor_is_type(X86_HYPER_MS_HYPERV) ||
|
||||||
x86_init.hyper.msi_ext_dest_id() ||
|
x86_init.hyper.msi_ext_dest_id())
|
||||||
!x2apic_supported())
|
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
if (hv_root_partition) {
|
if (hv_root_partition) {
|
||||||
@@ -170,7 +173,9 @@ static int __init hyperv_prepare_irq_remapping(void)
|
|||||||
|
|
||||||
static int __init hyperv_enable_irq_remapping(void)
|
static int __init hyperv_enable_irq_remapping(void)
|
||||||
{
|
{
|
||||||
|
if (x2apic_supported())
|
||||||
return IRQ_REMAP_X2APIC_MODE;
|
return IRQ_REMAP_X2APIC_MODE;
|
||||||
|
return IRQ_REMAP_XAPIC_MODE;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct irq_remap_ops hyperv_irq_remap_ops = {
|
struct irq_remap_ops hyperv_irq_remap_ops = {
|
||||||
|
|||||||
Reference in New Issue
Block a user