Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2647418imj; Mon, 11 Feb 2019 06:25:59 -0800 (PST) X-Google-Smtp-Source: AHgI3IYI5A0u4pQufMwcpnky/+47hmESmDz3PfdiBul7QywA6Xm8u378j5vjQRsRoMFThNycQes7 X-Received: by 2002:a63:e511:: with SMTP id r17mr33871340pgh.452.1549895159293; Mon, 11 Feb 2019 06:25:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549895159; cv=none; d=google.com; s=arc-20160816; b=reiY0/jHB7sgpqmfaar3sTkaK8xwZPNivW9tA1AGUldDLGdQNvzTDzJrs4zi6fKz8y k2lJHG78EMOsdidT9v874pvdOOXZaukSHrybNUEnxY1/4TQ/OVUitZ2nBjSLCt8NDsL0 kWWkDbD/6aiCSBK847wNdCgY2R+015lOc1/mLHfqMhd774fyKkPL8iik0ryEH7Dw1dEF r2q6uVlB7ivEO3odEljvLm7/zT7bngXyoGkfFQLawuIodm1muxP3LcpqhprR66c5xI0W tOGEd0urXjZLuhFEdIOijhjeVk6cYnzc/SC4F+UcrMWa621dKKOefuRZ4opWJjwvmmEe qAbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:in-reply-to:message-id:date :subject:cc:from:dkim-signature; bh=tTPsu0Tly/9LmgM4P6llE4UL5oymeBEZj3d8anCiLC8=; b=TuD/PZrOfr6xm5nL98VaA5cZy6SfBbn3iO0Sde2+0nduhuUxZN0yUqkPKiB+MW/KK2 wjTYB21JJALzsyCJHnIB9YvVQFXA/u5irsClgjaEnHNVbNrkiaLbUSL0ikthd4sNP8dJ n6blCqysUcdgVBjbyDeL8r+P62BoNU4Z3XRdy9/8upl9MIgkjnCAl5eq924hwG+eysN2 uRahSKxZU1IGeFAWGrZwnA5KqLKZD5WvxV71y2owNcA9r1JyKa1Mhz0ekOeFkczlZoSn kWGB+0hEYgLwD8BWL6WPeMj0cHez8wcGBogF9GYTQpoh0HMy0s4K2BamnmzcPaePRnEo xA1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=loe07Ibj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 39si3210775ple.336.2019.02.11.06.25.43; Mon, 11 Feb 2019 06:25:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=loe07Ibj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728415AbfBKOU5 (ORCPT + 99 others); Mon, 11 Feb 2019 09:20:57 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:46883 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728389AbfBKOUx (ORCPT ); Mon, 11 Feb 2019 09:20:53 -0500 Received: by mail-pg1-f193.google.com with SMTP id w7so5001520pgp.13 for ; Mon, 11 Feb 2019 06:20:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tTPsu0Tly/9LmgM4P6llE4UL5oymeBEZj3d8anCiLC8=; b=loe07IbjkU/2n5IJhCPJM6oG8gFvpRcbZsvZ+Aibb4wp4HS7J1ZJ9sny/T67j0f7E5 8NvD8pMp7VmF44ahqKIFWSCChZ0O1UsA8J9wGdcy228wQG8YzUr8psDz3uXqT/LPvZIM 2mToZFvgZteKib5NP4Q1Qe9s8TVf4TgU96I5RItnofLZNTcZ0Jgo6uSA/NcPJfZrimzf LEZ7uBHHulRlvG92ZF+2N3fcVcJPmciXG3lmRxjulanucso94f5bmBFVLehUale1DVKJ GI93a5guP4HhtJsHLFJhEAsoNcEWBrPOk7zsaFrB0jVd+MOUFGBRrGu5kCwxI4SLluak 4kEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tTPsu0Tly/9LmgM4P6llE4UL5oymeBEZj3d8anCiLC8=; b=mlQD+vFzcrW0I7i44wFtx2j6wHAH8YgUDh4Nb/H90ewcR2CHpOfHDXdFM8+3jsV66r BlN1+3+goTc0scnrcIDs4/54GTUZL2kyek1OG0HZ/qW2nZc2gmre7ZG5YrzyNI5DuPTt Vt0wMSVBD33BDiYjKREpRFzFplfCJoYZsDKIGKX4MT3CyzBmZyDc/Vn3sxpQs/U+w8vC feSu4gYwP9UZCLMBZ3DoAY2vSsWBTyr8JYYRCe07wb9KrnqGsce6rk9z02TzncttmDyN Dpdp/1Wmn6fCy2OdQpJJIov38SkrOC0jUzEyK/mk79a5ghf0+nKGclRkhac3GrDz7qGk dz1w== X-Gm-Message-State: AHQUAualebfzcX0IPNDvagAFG1mTDdz9MlsLXPPRuwtBthcAxYOOSWcS G1EF2uWBLw1yKvmsjtIsBdA= X-Received: by 2002:a65:6219:: with SMTP id d25mr19043834pgv.18.1549894852247; Mon, 11 Feb 2019 06:20:52 -0800 (PST) Received: from tianyukernel.corp.microsoft.com ([167.220.255.93]) by smtp.googlemail.com with ESMTPSA id e2sm20551664pga.92.2019.02.11.06.20.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 11 Feb 2019 06:20:51 -0800 (PST) From: lantianyu1986@gmail.com X-Google-Original-From: Tianyu.Lan@microsoft.com Cc: Lan Tianyu , kys@microsoft.com, haiyangz@microsoft.com, sthemmin@microsoft.com, sashal@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, x86@kernel.org, joro@8bytes.org, mchehab+samsung@kernel.org, davem@davemloft.net, gregkh@linuxfoundation.org, nicolas.ferre@microchip.com, arnd@arndb.de, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, iommu@lists.linux-foundation.org, michael.h.kelley@microsoft.com, vkuznets@redhat.com, alex.williamson@redhat.com, dan.carpenter@oracle.com Subject: [PATCH V4 1/3] x86/Hyper-V: Set x2apic destination mode to physical when x2apic is available Date: Mon, 11 Feb 2019 22:20:22 +0800 Message-Id: <1549894824-26623-2-git-send-email-Tianyu.Lan@microsoft.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1549894824-26623-1-git-send-email-Tianyu.Lan@microsoft.com> References: <1549894824-26623-1-git-send-email-Tianyu.Lan@microsoft.com> To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lan Tianyu 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 Signed-off-by: Lan Tianyu --- Change since v2: - Fix compile error due to x2apic_phys - Fix comment indent Change since v1: - Remove redundant extern for x2apic_phys --- arch/x86/kernel/cpu/mshyperv.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c index e81a2db..0c29e4e 100644 --- a/arch/x86/kernel/cpu/mshyperv.c +++ b/arch/x86/kernel/cpu/mshyperv.c @@ -328,6 +328,16 @@ 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. + */ + if (IS_ENABLED(CONFIG_X86_X2APIC) && x2apic_supported()) + x2apic_phys = 1; + #endif } -- 2.7.4