From patchwork Thu Aug 1 14:44:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Henrique Cerri X-Patchwork-Id: 1140522 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45ztNX0VChz9sN4; Fri, 2 Aug 2019 00:44:27 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1htCJY-0006p5-VP; Thu, 01 Aug 2019 14:44:20 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1htCJX-0006om-7c for kernel-team@lists.ubuntu.com; Thu, 01 Aug 2019 14:44:19 +0000 Received: from mail-qt1-f197.google.com ([209.85.160.197]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1htCJW-0005D7-OG for kernel-team@lists.ubuntu.com; Thu, 01 Aug 2019 14:44:18 +0000 Received: by mail-qt1-f197.google.com with SMTP id r58so64898581qtb.5 for ; Thu, 01 Aug 2019 07:44:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dKF260tBEqN7ZuxrhKF2dLPUTrUlulj3yJiTHGVEnvM=; b=fKu8ykExQDPbl6rF3tU8thE/PyOx2OE9eMcysi32zZvYjOcU6Ilc15gQkmLgC0Hllv MrsP7D9gXGAPQeTlOzCgHaU56kbDdiPjwMIWVFFYXazrUzU7UDawtIM6TaBgpQsLE6SJ TSYL52enoCz6AW7wRQU33xVYnQSwFYFgIitF+qlpzFF3BrVziPDTfxAzF2QqPBt4yGam PEzoHMyH8IBhIzUc1+WRfZge+5dOExpSgkSYKz3cTC+UW/YsEPEqqAAeJGoxvaWHnWN8 u02KMsOi2H/uP7tex0G90BC9O1q0j5Ek/TNfRoRngbKIIUHJ+K+uqZwz/u1TUPZVhY+u 4qHA== X-Gm-Message-State: APjAAAXGA9xG73R5DaX13HKDZfGRR6A67ffwuhTUCAvCDcExF8V5ZFEJ i+k2RuS3YHMWNSwsdLACW3/Oo5fdFjoKa0pqa+mJ92rfGk4kODUe4Etxtr9HdwxzizFE2VgW/sO iW2eAB4ABGcmwuNDr66sG9VXaoL0JvviiOx9irgfS X-Received: by 2002:ac8:394b:: with SMTP id t11mr89117377qtb.286.1564670657371; Thu, 01 Aug 2019 07:44:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqz0aSlCA7o+se05McfhIzTp1g2f3n1yG7lujUMk9LF41QVM4Ny8j8gywweU4TnTjBMatTpPpg== X-Received: by 2002:ac8:394b:: with SMTP id t11mr89117357qtb.286.1564670657090; Thu, 01 Aug 2019 07:44:17 -0700 (PDT) Received: from gallifrey.lan ([2804:14c:4e3:5580:95b:d92c:6741:356e]) by smtp.gmail.com with ESMTPSA id m44sm38273763qtm.54.2019.08.01.07.44.15 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 01 Aug 2019 07:44:16 -0700 (PDT) From: Marcelo Henrique Cerri To: kernel-team@lists.ubuntu.com Subject: [d/azure][PATCH 1/5] x86/Hyper-V: Set x2apic destination mode to physical when x2apic is available Date: Thu, 1 Aug 2019 11:44:05 -0300 Message-Id: <20190801144409.10744-2-marcelo.cerri@canonical.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190801144409.10744-1-marcelo.cerri@canonical.com> References: <20190801144409.10744-1-marcelo.cerri@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Lan Tianyu BugLink: https://bugs.launchpad.net/bugs/1826447 Hyper-V doesn't provide irq remapping for IO-APIC. To enable x2apic, set x2apic destination mode to physcial mode when x2apic is available and Hyper-V IOMMU driver makes sure cpus assigned with IO-APIC irqs have 8-bit APIC id. Reviewed-by: Thomas Gleixner Reviewed-by: Michael Kelley Signed-off-by: Lan Tianyu Signed-off-by: Joerg Roedel (cherry picked from commit 84fdfafab849036b5aefa52824b5cb42e887ef0e) Signed-off-by: Marcelo Henrique Cerri --- arch/x86/kernel/cpu/mshyperv.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c index e81a2db42df7..3fa238a137d2 100644 --- a/arch/x86/kernel/cpu/mshyperv.c +++ b/arch/x86/kernel/cpu/mshyperv.c @@ -328,6 +328,18 @@ static void __init ms_hyperv_init_platform(void) # ifdef CONFIG_SMP smp_ops.smp_prepare_boot_cpu = hv_smp_prepare_boot_cpu; # endif + + /* + * Hyper-V doesn't provide irq remapping for IO-APIC. To enable x2apic, + * set x2apic destination mode to physcial mode when x2apic is available + * and Hyper-V IOMMU driver makes sure cpus assigned with IO-APIC irqs + * have 8-bit APIC id. + */ +# ifdef CONFIG_X86_X2APIC + if (x2apic_supported()) + x2apic_phys = 1; +# endif + #endif }