Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S972597AbdDXSnh (ORCPT ); Mon, 24 Apr 2017 14:43:37 -0400 Received: from mail-cys01nam02on0041.outbound.protection.outlook.com ([104.47.37.41]:22256 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S972094AbdDXSnH (ORCPT ); Mon, 24 Apr 2017 14:43:07 -0400 Authentication-Results: lists.infradead.org; dkim=none (message not signed) header.d=none;lists.infradead.org; dmarc=none action=none header.from=cavium.com; From: David Daney To: linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Paolo Bonzini , Marc Zyngier , Christoffer Dall , Jonathan Corbet , Will Deacon , Catalin Marinas Cc: linux-kernel@vger.kernel.org, Robert Richter , David Daney Subject: [PATCH 2/2] arm64: Add workaround for Cavium Thunder erratum 30115 Date: Mon, 24 Apr 2017 11:42:50 -0700 Message-Id: <20170424184250.667-3-david.daney@cavium.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170424184250.667-1-david.daney@cavium.com> References: <20170424184250.667-1-david.daney@cavium.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [50.233.148.156] X-ClientProxiedBy: SN1PR07CA0025.namprd07.prod.outlook.com (10.162.170.163) To MWHPR07MB3503.namprd07.prod.outlook.com (10.164.192.30) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c55c35d9-ff48-4839-8468-08d48b41bc44 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075)(201703031133081);SRVR:MWHPR07MB3503; X-Microsoft-Exchange-Diagnostics: 1;MWHPR07MB3503;3:8ehVLRp1m22WAzyWX+/wtez9v2WW5goD9wf9qgn827CF2YJzC5yR9rXVZZ1XRsU7jqZh3I1LWTzp/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Tpuqc/vsYk78TA20+WUTV/tBKCVFPM5pzQPPRpkGCdPMj3xCnxsorCUMwGzhuCB6vQUA09MgzeeCkC8pLwIbg+hSUYjwv9gXfXkKdfYcEAKcrFWVZtHeZQXkJgSHD1BNHw7i0Y1W48BitAZLeftrMo5WMB+OuYcs5Z/hhLYzl6v0MCumNDDxKzGpdx7dS1b0ylAh16nX/w5iIyJE8Uh5urb0fLwNlZIuXfMpZU2psqt0nY9mnZ6piSuCAXkRxHI3M36HNhB24vYJ05TsUjlZ88iMskOKKOeXrumDoS1fj422DkNAoh/1k/X7i3V/9F9qACOJPjtuTJnqInIvRGkwVkY3TXFiU3smvCGMB/zJQcz0f8/7V0nZn/h2PfSQVj/VAoEkBtDXlSVOcQWEuQsgVSG8ZM4YTbqqgr+0V6MvBr6cCB1TFiR31QV X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(6041248)(20161123560025)(20161123555025)(20161123564025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(6072148);SRVR:MWHPR07MB3503;BCL:0;PCL:0;RULEID:;SRVR:MWHPR07MB3503; X-Microsoft-Exchange-Diagnostics: 1;MWHPR07MB3503;4:3SV9rKkVJ47bLfAWI8+hcyAiszjaYcldwH9xBQk4jXC+lGm/Ro6oy0JQv6frDkN5gfCH8PkRNkEkccePxKIKYBF4GBOFIEGwUK8QSgSCDOo6VjNlC1MWW6TtqzmhtX5Br/trpcNEBNllwmU7INqtnKDJoTPwd1phWHxqhvxJrWT+oJMPhsjV/jX9pgErIDAb1quxq/Ed/xgnq4xx1krqhzKeP46Pc2OjcKhJ+Odtid/Qkvo1DPUQiakRJSmrrpZ6LZg4Hw0/bApLGam3qIzZSVDJruMaarcEqtFWWNYToPSNW9SjmIMHln51Lcj7o8viIcQSRYG8Ftq7z2LV+HgOyitOA6kodo5X+0gFB6ic4H3Lqc9dFtkFYi7l7h7OYU/YO7gI2pRUT45/La5QiGRMT/ZDQnooubUHR8gX1TDE/j1BM+1j3OW6/gpR9m2myD3lF+HDfAExn8fd0Hkl1Fwin/Vqfk/wB9PThMtv+uzjQW5SrhofIYQf1fY3UJyMznPDe0XRwE23VTfCb2zeFpdzFObiJX6iHEr3tzlXv4Z16hERnetuq0n+Nem27X84sIwXPMsY/BlHdLnxqeFWJPvMMcpzmMO45usUOT+9yJsDOIgQqyhvR5V3NrKXN6VA35WVXDnVSC+oqbfAr9ENKPbnT9buPJDpbEfKTr625luw3Mm9/4h+yWs1Xx0+9yB7uoLdo2fClZYXgd8qza6fkRRNAQ== X-Forefront-PRVS: 0287BBA78D X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(39850400002)(39400400002)(39410400002)(39840400002)(2171002)(6666003)(305945005)(8676002)(7736002)(53936002)(2950100002)(3846002)(2906002)(189998001)(6116002)(4326008)(5660300001)(1076002)(25786009)(38730400002)(7416002)(42186005)(33646002)(50226002)(53416004)(36756003)(50986999)(5003940100001)(66066001)(86362001)(76176999)(6506006)(81166006)(47776003)(6512007)(6486002)(54906002)(48376002)(50466002)(107886003)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:MWHPR07MB3503;H:ddl.caveonetworks.com;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;MWHPR07MB3503;23:QZjbt60b3BcihQdmmgtWVsmMt0teTKuBSm4OLXbUT?= =?us-ascii?Q?xsddsy+RiKm1RKxLjL+up5zmfAoimGyTsUR7gSHj8Wjjsr/qLH11hBHK4pm/?= =?us-ascii?Q?fHggnfUTA0ys5YZovjh5hcb5P69NI8VVJoLtOSVsHJUvCBlb2xTN/IkbVyTL?= =?us-ascii?Q?JX/7pbpfxz4CFgHzFLrjSlIFajrTcHQ+4F49sit9RY/9kzL4TMGBMwtcpXNI?= =?us-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F6APSxZ9q4g=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;MWHPR07MB3503;6:xUOjO/cpvuCph3ID/V/L44E/ULIwwlLlU7fftoNY5fBJEzNOwla5luU+Ckqu+plUJjrkAb8Uqbl1GQNWJ5YVp7j4KBHMRO6Ewa24ULFx7MbmMt8y0PM8Yv4t9WcvNkwRo9qHWAM3p0ja8QbEy+PODmDWjoeHz4CRWvBj6p38Is3v+4/QpSYdMydReIauNdtAQIsXCGXv4o+a5HQ0JTR9KKT8mrqF8Qb2LFgQ2I6+KS9SO8GI74bw5r+iLEWUAmUGWTtBeoxgpjrDUfG2ueb547L/1pbpZ+r5yh0U1VGCvG5WkWO9ocX/roVU7b9T68MDqYHT1ppymTzHuFJZ2JF1VefAYBqSXg5e0/NxYn/vVZII1ub7mTkdUJxwWKsrBZH/tKphSj6cowedintcYCr7GlGzVdDrlOGeW8yjqEG1ESqwaHTeI5DctQ494YAHnyO6Sy3XCou02MzkfwvqzNKjCdcI7MJd78aeeaNr3spP7HPa+5feKxnVE2lczoWZ6UuDP+36L3mpZquYzyMjtjBZRw==;5:Am7m9kCyRgTKHk/43C2rRBFHMyt51XAntIh59QjrVUhgT7m8HUr5m5x61+SZb1hBC4/YsGCe6OTqT4jvxOTOj8Sb2QZc8+iphyTBoNSgI2UNM9Oucn5CEZ6+fjjh7uYVpoItTDesUAhwmpc1CJRquLT8CTBIOpujAVAwjLZYzaw=;24:qaldNat//fvMmPVSPvV9dO3un7fzw4/IVqw0fBphcaMxH4D9WRz8nxOpgG3YTXMkZmbn2r+N8YsIP9E/KWIJt3v0DMoqabsTueMEzYZ+OSA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;MWHPR07MB3503;7:Hl7K0OVPrDmmw5uiMO8HKiI3UttQuyH34FZZB6bNQpNYrRsjImAMgyOo60/AclNYRRUE71dFGBKtofABANwvydf3/H/EyOf6EeGWQtlFHrz0a4/teEydUtBsKeT4SaovQxzeu7H1MAv1Qgwlo7EKZ1C3vhWdfn23r58T2XTwltlRg9AgAWYVbBur8RcVqcGizR92JnVgE1GHAzXirA18pZnjxpSmFLhnKN/nEBCOcH22kNxWMiwB+Ryua06IQ6mVcjQcHIifT4Jl+0QZK08GhD7WZNskIZdkmL9aKLX1NOo5F3oVRgmJ4NLIq9thrrTYiNrj5+WBLeoF2MYcBms6Cw== X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2017 18:42:59.9761 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR07MB3503 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4530 Lines: 129 Some Cavium Thunder CPUs suffer a problem where a KVM guest may inadvertently cause the host kernel to quit receiving interrupts. The workaround is to toggle the group-1 interrupt enable on each exit from the guest. Signed-off-by: David Daney --- Documentation/arm64/silicon-errata.txt | 1 + arch/arm64/Kconfig | 11 +++++++++++ arch/arm64/include/asm/cpucaps.h | 3 ++- arch/arm64/kernel/cpu_errata.c | 21 +++++++++++++++++++++ arch/arm64/kvm/hyp/switch.c | 9 +++++++++ 5 files changed, 44 insertions(+), 1 deletion(-) diff --git a/Documentation/arm64/silicon-errata.txt b/Documentation/arm64/silicon-errata.txt index 10f2ddd..f5f93dc 100644 --- a/Documentation/arm64/silicon-errata.txt +++ b/Documentation/arm64/silicon-errata.txt @@ -62,6 +62,7 @@ stable kernels. | Cavium | ThunderX GICv3 | #23154 | CAVIUM_ERRATUM_23154 | | Cavium | ThunderX Core | #27456 | CAVIUM_ERRATUM_27456 | | Cavium | ThunderX SMMUv2 | #27704 | N/A | +| Cavium | ThunderX Core | #30115 | CAVIUM_ERRATUM_30115 | | | | | | | Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 | | | | | | diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index e7f043e..fe29277 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -480,6 +480,17 @@ config CAVIUM_ERRATUM_27456 If unsure, say Y. +config CAVIUM_ERRATUM_30115 + bool "Cavium erratum 30115: Guest may disable interrupts in host" + default y + help + On ThunderX T88 pass 1.x through 2.2, T81 pass 1.0 through + 1.2, and T83 Pass 1.0, KVM guest execution may disable + interrupts in host. The fix is to reenable group 1 + interrupts when returning to host mode. + + If unsure, say Y. + config QCOM_FALKOR_ERRATUM_1003 bool "Falkor E1003: Incorrect translation due to ASID change" default y diff --git a/arch/arm64/include/asm/cpucaps.h b/arch/arm64/include/asm/cpucaps.h index b3aab8a..8d2272c 100644 --- a/arch/arm64/include/asm/cpucaps.h +++ b/arch/arm64/include/asm/cpucaps.h @@ -38,7 +38,8 @@ #define ARM64_WORKAROUND_REPEAT_TLBI 17 #define ARM64_WORKAROUND_QCOM_FALKOR_E1003 18 #define ARM64_WORKAROUND_858921 19 +#define ARM64_WORKAROUND_CAVIUM_30115 20 -#define ARM64_NCAPS 20 +#define ARM64_NCAPS 21 #endif /* __ASM_CPUCAPS_H */ diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c index 2ed2a76..0e27f86 100644 --- a/arch/arm64/kernel/cpu_errata.c +++ b/arch/arm64/kernel/cpu_errata.c @@ -133,6 +133,27 @@ const struct arm64_cpu_capabilities arm64_errata[] = { MIDR_RANGE(MIDR_THUNDERX_81XX, 0x00, 0x00), }, #endif +#ifdef CONFIG_CAVIUM_ERRATUM_30115 + { + /* Cavium ThunderX, T88 pass 1.x - 2.2 */ + .desc = "Cavium erratum 30115", + .capability = ARM64_WORKAROUND_CAVIUM_30115, + MIDR_RANGE(MIDR_THUNDERX, 0x00, + (1 << MIDR_VARIANT_SHIFT) | 2), + }, + { + /* Cavium ThunderX, T81 pass 1.0 - 1.2 */ + .desc = "Cavium erratum 30115", + .capability = ARM64_WORKAROUND_CAVIUM_30115, + MIDR_RANGE(MIDR_THUNDERX_81XX, 0x00, 0x02), + }, + { + /* Cavium ThunderX, T83 pass 1.0 */ + .desc = "Cavium erratum 30115", + .capability = ARM64_WORKAROUND_CAVIUM_30115, + MIDR_RANGE(MIDR_THUNDERX_83XX, 0x00, 0x00), + }, +#endif { .desc = "Mismatched cache line size", .capability = ARM64_MISMATCHED_CACHE_LINE_SIZE, diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c index aede165..c174b5f 100644 --- a/arch/arm64/kvm/hyp/switch.c +++ b/arch/arm64/kvm/hyp/switch.c @@ -17,11 +17,13 @@ #include #include +#include #include #include #include #include +#include static bool __hyp_text __fpsimd_enabled_nvhe(void) { @@ -166,6 +168,13 @@ static void __hyp_text __vgic_save_state(struct kvm_vcpu *vcpu) __vgic_v2_save_state(vcpu); write_sysreg(read_sysreg(hcr_el2) & ~HCR_INT_OVERRIDE, hcr_el2); + +#ifdef CONFIG_CAVIUM_ERRATUM_30115 + if (cpus_have_const_cap(ARM64_WORKAROUND_CAVIUM_30115)) { + gic_write_grpen1(0); + gic_write_grpen1(1); + } +#endif } static void __hyp_text __vgic_restore_state(struct kvm_vcpu *vcpu) -- 2.7.4