From patchwork Sun Oct 27 21:00:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 177864 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp2535637ill; Sun, 27 Oct 2019 14:13:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqzY55Huq3hRyjEOFdKYRX2+BdLejHucJjNx0KGIZCp0RbWmsdaSMFRd98r5Yr+KeTKQiqIe X-Received: by 2002:a17:906:f42:: with SMTP id h2mr13613872ejj.39.1572210839674; Sun, 27 Oct 2019 14:13:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572210839; cv=none; d=google.com; s=arc-20160816; b=B0n7/fmZU3IYs/2988lJCIlSU/wbByaCKF38ZYbAeMWQWGpwoWESjaNF4Sie3oo5+W 8QU8PyHu+qNBtReblt+6bflHbc5l4kOLMnrFcv52Ym16fi+LM9bJVRW0LKzpA3yIE/XG DAqbueStczfDCNLOWWGNY5mjZkB7/07gIBaXiI0bRYgzXDs6sX/JLbMZzer7iLy2t/Jc G2i4MSO/N70PpFXMDsLdl2PJJXQCQpDwcGHCt0Dw/deo0cl+JCROB/waJDTCclOuUidM +Om/PY6hH/FNlaXQbPT4lsQrgicO0ZpIUGYUSCacNbhLUKuHFZYomyWvCEX6++HNTGdn yG9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/jIX4m1+1DVdF6RmSntXUHoa0xNJYjKGnMDAop584yE=; b=B9lYDJHJzvtudihzKKLAimRhK2rkcayPNctGwafyiVAPYri3f3FLkQZBxyBLzZdQH1 6OV3M4zOXGKCKMpd/+vdD4QIr1M6e9/TIH9k8M56X9pv00pxCYUJBPm/cJ/DxEK90zTy QQC81iz4rwbd6LgXtYaGgbGlbrUWnORGYjEfUhDF9+29RqyXIpJRhwlr8tQ9F0X6lgTd 7q0lay+CWIVmn/2XeDTPHA61lSK3Ks7UPFAdwMBrOouTn0Dgbbxb+6dwYqX5yQzftr5y rkwE4dWGswLmB8q2ol5isb/DejfMkRq1SUAkNZyiMfsdf4XCmco+qpPWM4cIC3qB432S VSUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YR3T5uMx; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v8si5130174eja.227.2019.10.27.14.13.59; Sun, 27 Oct 2019 14:13:59 -0700 (PDT) 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=pass header.i=@kernel.org header.s=default header.b=YR3T5uMx; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730367AbfJ0VN5 (ORCPT + 26 others); Sun, 27 Oct 2019 17:13:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:32814 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730343AbfJ0VNz (ORCPT ); Sun, 27 Oct 2019 17:13:55 -0400 Received: from localhost (100.50.158.77.rev.sfr.net [77.158.50.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7F654208C0; Sun, 27 Oct 2019 21:13:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572210835; bh=2dUNRIy0dla7Y0wuoEdvjGO01rJ2UMAR+njUmoJQ62I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YR3T5uMxhchBY0nXbqZBvHAiMnmBkUosFUG+OEQg5W8wlfSUrnmeMSbh94ip/ZDKC xWd5uNgJb4sDr+/64SEJHbAglc8VxyN8PBeIx0RoFrY96ujXcIqKa6ZT1Xsumm4vLS rgaYqmNLDgcPLhx8Xbr22hS7C16rYgJVgtakLXRw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Ujfalusi , Tomi Valkeinen , Tony Lindgren , Sasha Levin Subject: [PATCH 4.19 08/93] ARM: dts: am4372: Set memory bandwidth limit for DISPC Date: Sun, 27 Oct 2019 22:00:20 +0100 Message-Id: <20191027203253.738570255@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191027203251.029297948@linuxfoundation.org> References: <20191027203251.029297948@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peter Ujfalusi [ Upstream commit f90ec6cdf674248dcad85bf9af6e064bf472b841 ] Set memory bandwidth limit to filter out resolutions above 720p@60Hz to avoid underflow errors due to the bandwidth needs of higher resolutions. am43xx can not provide enough bandwidth to DISPC to correctly handle 'high' resolutions. Signed-off-by: Peter Ujfalusi Signed-off-by: Tomi Valkeinen Signed-off-by: Tony Lindgren Signed-off-by: Sasha Levin --- arch/arm/boot/dts/am4372.dtsi | 2 ++ 1 file changed, 2 insertions(+) -- 2.20.1 diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi index d4b7c59eec685..cf1e4f747242f 100644 --- a/arch/arm/boot/dts/am4372.dtsi +++ b/arch/arm/boot/dts/am4372.dtsi @@ -1142,6 +1142,8 @@ ti,hwmods = "dss_dispc"; clocks = <&disp_clk>; clock-names = "fck"; + + max-memory-bandwidth = <230000000>; }; rfbi: rfbi@4832a800 { From patchwork Sun Oct 27 21:01:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 177865 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp2536516ill; Sun, 27 Oct 2019 14:15:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqxmqwXnrP6xX+4lnWGFvat2Hr+mGPpdNdjvDAJgJsyuCEPdED7SHVIUzOd0sgvQfgh+T46P X-Received: by 2002:a17:906:365a:: with SMTP id r26mr13873742ejb.123.1572210908353; Sun, 27 Oct 2019 14:15:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572210908; cv=none; d=google.com; s=arc-20160816; b=UUNt4ss607Ve5P/jb7U++8onkg+5FQ5t98oPDf5jCIIuTIFSTpMVLLjMDZtpnOqBau Pt7dqGAaHnngqZyFrphztRnCqnJGm/dg8Rh8NwOX388shjv3+eZS4QHq+H0JTWtPJN6F Xgzf2IXUTjHVDVT98fj9jLu3ltE0GIAgNSqtOtMnM7fJkkpg0gujRKBDmuAFawjL0po4 iR7SMnhUzqfuvqvw6GrgTnSHYkDo++DMr/t8ULWCNPuBrTqAyr5z+WbzytSzpbRW2hdT YQZrs89I2Ey+JpxNpZY0IiHAxil5AbCeZzwi3X6GKKRM4t9OxNeU1cnkbnJB2xz8ToSj 3ViQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=J+0XJDS6QuEeSAJm5RtqEX15Cr+e8TH+3L0jCbYYYxo=; b=0Cf0QoKJzUsJbH1bHRekZ1e9hi3KMhN74P5ZPzJ90glLDtXFkUzTcrgmoIPOFag/Fz oTJUQ+eJtRDOBlQM0F1+TdzQlEp9F7+jPvMhk7xGXFlkbv97ae8RUs6dfe2uwhvwLaQm TsxnW2Q/dJ/3PP+hcQFNy94GfVwT1lXyQSVG8YzFyAgxIGh/Q79s/d1q8MtwKf2DSniW bp+JDN4soyd9ifiV2qMgRo3x+Q6sYoulGwSKslDYM6JQZcBCHIK3s915+6lueVUCuhKU j1knBnNTqcl8QvcOY+nI4Gfb4KWwf1ZmhYAC82Pt0bb4BicbMe9y9QtdeEfjRBBJZcwN aMQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XEQ0y7rY; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b15si1793624ejb.266.2019.10.27.14.15.08; Sun, 27 Oct 2019 14:15:08 -0700 (PDT) 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=pass header.i=@kernel.org header.s=default header.b=XEQ0y7rY; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729615AbfJ0VPG (ORCPT + 26 others); Sun, 27 Oct 2019 17:15:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:34068 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730574AbfJ0VPC (ORCPT ); Sun, 27 Oct 2019 17:15:02 -0400 Received: from localhost (100.50.158.77.rev.sfr.net [77.158.50.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C281F214E0; Sun, 27 Oct 2019 21:15:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572210901; bh=oLGR8Lc/q1pBvRocHRZNtfIF+PmU6jMfikQ3I2grAls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XEQ0y7rYLATf1CiIGsokpnoF5oRRQkQS13nsd2BrCWTrnVfIHAlK0w2YjO6xtGy1c FHSQ/rEm/KBUs/f7Fb6/8I3m0xZYcNBsPz/Tu9a2AYAi7OcGlR4hNcORnOWbOI8sJh 1lSSgQDdFeA+u9A3Qlj+Bb+i6lDL+Ih6yQo3drxA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Garry , "Rafael J. Wysocki" Subject: [PATCH 4.19 56/93] ACPI: CPPC: Set pcc_data[pcc_ss_id] to NULL in acpi_cppc_processor_exit() Date: Sun, 27 Oct 2019 22:01:08 +0100 Message-Id: <20191027203302.306603006@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191027203251.029297948@linuxfoundation.org> References: <20191027203251.029297948@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: John Garry commit 56a0b978d42f58c7e3ba715cf65af487d427524d upstream. When enabling KASAN and DEBUG_TEST_DRIVER_REMOVE, I find this KASAN warning: [ 20.872057] BUG: KASAN: use-after-free in pcc_data_alloc+0x40/0xb8 [ 20.878226] Read of size 4 at addr ffff00236cdeb684 by task swapper/0/1 [ 20.884826] [ 20.886309] CPU: 19 PID: 1 Comm: swapper/0 Not tainted 5.4.0-rc1-00009-ge7f7df3db5bf-dirty #289 [ 20.894994] Hardware name: Huawei D06 /D06, BIOS Hisilicon D06 UEFI RC0 - V1.16.01 03/15/2019 [ 20.903505] Call trace: [ 20.905942] dump_backtrace+0x0/0x200 [ 20.909593] show_stack+0x14/0x20 [ 20.912899] dump_stack+0xd4/0x130 [ 20.916291] print_address_description.isra.9+0x6c/0x3b8 [ 20.921592] __kasan_report+0x12c/0x23c [ 20.925417] kasan_report+0xc/0x18 [ 20.928808] __asan_load4+0x94/0xb8 [ 20.932286] pcc_data_alloc+0x40/0xb8 [ 20.935938] acpi_cppc_processor_probe+0x4e8/0xb08 [ 20.940717] __acpi_processor_start+0x48/0xb0 [ 20.945062] acpi_processor_start+0x40/0x60 [ 20.949235] really_probe+0x118/0x548 [ 20.952887] driver_probe_device+0x7c/0x148 [ 20.957059] device_driver_attach+0x94/0xa0 [ 20.961231] __driver_attach+0xa4/0x110 [ 20.965055] bus_for_each_dev+0xe8/0x158 [ 20.968966] driver_attach+0x30/0x40 [ 20.972531] bus_add_driver+0x234/0x2f0 [ 20.976356] driver_register+0xbc/0x1d0 [ 20.980182] acpi_processor_driver_init+0x40/0xe4 [ 20.984875] do_one_initcall+0xb4/0x254 [ 20.988700] kernel_init_freeable+0x24c/0x2f8 [ 20.993047] kernel_init+0x10/0x118 [ 20.996524] ret_from_fork+0x10/0x18 [ 21.000087] [ 21.001567] Allocated by task 1: [ 21.004785] save_stack+0x28/0xc8 [ 21.008089] __kasan_kmalloc.isra.9+0xbc/0xd8 [ 21.012435] kasan_kmalloc+0xc/0x18 [ 21.015913] pcc_data_alloc+0x94/0xb8 [ 21.019564] acpi_cppc_processor_probe+0x4e8/0xb08 [ 21.024343] __acpi_processor_start+0x48/0xb0 [ 21.028689] acpi_processor_start+0x40/0x60 [ 21.032860] really_probe+0x118/0x548 [ 21.036512] driver_probe_device+0x7c/0x148 [ 21.040684] device_driver_attach+0x94/0xa0 [ 21.044855] __driver_attach+0xa4/0x110 [ 21.048680] bus_for_each_dev+0xe8/0x158 [ 21.052591] driver_attach+0x30/0x40 [ 21.056155] bus_add_driver+0x234/0x2f0 [ 21.059980] driver_register+0xbc/0x1d0 [ 21.063805] acpi_processor_driver_init+0x40/0xe4 [ 21.068497] do_one_initcall+0xb4/0x254 [ 21.072322] kernel_init_freeable+0x24c/0x2f8 [ 21.076667] kernel_init+0x10/0x118 [ 21.080144] ret_from_fork+0x10/0x18 [ 21.083707] [ 21.085186] Freed by task 1: [ 21.088056] save_stack+0x28/0xc8 [ 21.091360] __kasan_slab_free+0x118/0x180 [ 21.095445] kasan_slab_free+0x10/0x18 [ 21.099183] kfree+0x80/0x268 [ 21.102139] acpi_cppc_processor_exit+0x1a8/0x1b8 [ 21.106832] acpi_processor_stop+0x70/0x80 [ 21.110917] really_probe+0x174/0x548 [ 21.114568] driver_probe_device+0x7c/0x148 [ 21.118740] device_driver_attach+0x94/0xa0 [ 21.122912] __driver_attach+0xa4/0x110 [ 21.126736] bus_for_each_dev+0xe8/0x158 [ 21.130648] driver_attach+0x30/0x40 [ 21.134212] bus_add_driver+0x234/0x2f0 [ 21.0x10/0x18 [ 21.161764] [ 21.163244] The buggy address belongs to the object at ffff00236cdeb600 [ 21.163244] which belongs to the cache kmalloc-256 of size 256 [ 21.175750] The buggy address is located 132 bytes inside of [ 21.175750] 256-byte region [ffff00236cdeb600, ffff00236cdeb700) [ 21.187473] The buggy address belongs to the page: [ 21.192254] page:fffffe008d937a00 refcount:1 mapcount:0 mapping:ffff002370c0fa00 index:0x0 compound_mapcount: 0 [ 21.202331] flags: 0x1ffff00000010200(slab|head) [ 21.206940] raw: 1ffff00000010200 dead000000000100 dead000000000122 ffff002370c0fa00 [ 21.214671] raw: 0000000000000000 00000000802a002a 00000001ffffffff 0000000000000000 [ 21.222400] page dumped because: kasan: bad access detected [ 21.227959] [ 21.229438] Memory state around the buggy address: [ 21.234218] ffff00236cdeb580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 21.241427] ffff00236cdeb600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 21.248637] >ffff00236cdeb680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 21.255845] ^ [ 21.259062] ffff00236cdeb700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 21.266272] ffff00236cdeb780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 21.273480] ================================================================== It seems that global pcc_data[pcc_ss_id] can be freed in acpi_cppc_processor_exit(), but we may later reference this value, so NULLify it when freed. Also remove the useless setting of data "pcc_channel_acquired", which we're about to free. Fixes: 85b1407bf6d2 ("ACPI / CPPC: Make CPPC ACPI driver aware of PCC subspace IDs") Signed-off-by: John Garry Cc: 4.15+ # 4.15+ Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- drivers/acpi/cppc_acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/acpi/cppc_acpi.c +++ b/drivers/acpi/cppc_acpi.c @@ -909,8 +909,8 @@ void acpi_cppc_processor_exit(struct acp pcc_data[pcc_ss_id]->refcount--; if (!pcc_data[pcc_ss_id]->refcount) { pcc_mbox_free_channel(pcc_data[pcc_ss_id]->pcc_channel); - pcc_data[pcc_ss_id]->pcc_channel_acquired = 0; kfree(pcc_data[pcc_ss_id]); + pcc_data[pcc_ss_id] = NULL; } } } From patchwork Sun Oct 27 21:01:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 177866 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp2537366ill; Sun, 27 Oct 2019 14:16:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqz0MujM+qUix9IAoV4JEEJQ/Y0n7wxmUVL7hBuDzj6sRXU71nfnE6q2qFdFz4+VJUyZYHcf X-Received: by 2002:a17:906:5502:: with SMTP id r2mr14114473ejp.3.1572210964847; Sun, 27 Oct 2019 14:16:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572210964; cv=none; d=google.com; s=arc-20160816; b=aJtKCNnHk9G6F7MiWMpfNfa5IVahp7yqdZtoweRgzLoOMd7mS2jvNGHVGXYDW1+tqV qshVhdU65ETqIXQmqfK21ZGpqeHn5/gSNju+Kye3kEmYGJeqOLId2JnFbIitpfU63FPW dPr/AjGyTB4LO4wzCVfTgjV2ckVNaSxoqhWmSC9CHIBpxyceFnHU4oGTtSAIiThS/Uyu TMPkdB2tZ9zgFOJ/6cNbqSEDq4zRQKzTFHnEAD7z2hLHii8VF50ahM/BjO18T8e6V1xe M98fKXyd9DgwrGyDLU9YnXFyTyr70AMT1xZbD8Mke0L+svgkf3ET2b7dbykjp+nPEuf4 zWCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7FByywA7nL0Uub5SyTsyxVAalxD4JLH7TXv+A9K6jNY=; b=zx/JmWSAtQgyHS1Zk1QMPdx+sAK55Bfen3iAi6bvGGb7Xjitw3enDqwkDP0rIdERlR 52gR0/F8KiqXKNLD/nqmjlBkMtmvceqCRwocQST5TYMfSHRCGC96VX2DwM+zpl7gFcjj 7YM2EnoeFoOMklsgaWSETdBalOFPQxFte82eEh0O5rtTlW/j0S2lvqWiQhdbC47qilKH ++9rv3jZHSpRcyyWLbROXqmbFAYOpbxSC7tc9voUMoj458enUe39QTY0aUdGJK2H0FoH i2U/QdrX3HBXHC9UpEk9qzs+6qKsBrtDHzLB96jySWOtCQOLaBq8+bjTGO1pd950Tsl2 sd3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hr0pqfHj; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c24si6720938edb.328.2019.10.27.14.16.04; Sun, 27 Oct 2019 14:16:04 -0700 (PDT) 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=pass header.i=@kernel.org header.s=default header.b=hr0pqfHj; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730747AbfJ0VQB (ORCPT + 26 others); Sun, 27 Oct 2019 17:16:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:35368 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730718AbfJ0VP4 (ORCPT ); Sun, 27 Oct 2019 17:15:56 -0400 Received: from localhost (100.50.158.77.rev.sfr.net [77.158.50.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B1E94205C9; Sun, 27 Oct 2019 21:15:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572210955; bh=8IOV29BNjDY+REp3WUyqDVAt2o6u+fOSAlETP48YXZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hr0pqfHjpSBNS8p9sB0LYq1W1T43P2Xqbm1Wx1BbsxJuVy33RlO5SKyQyCinBOKLO c1k/Is5GTFeKlYmnVi3MDP7qG2EwiF6ZyIYYBgBaeRVyqH/TWTUnEmZjX5Kq+Awhup oYi8YPitjvuALjLIF9+7cvCA9huC7xv4ZX8FDAQg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Zyngier , Will Deacon Subject: [PATCH 4.19 73/93] arm64: Enable workaround for Cavium TX2 erratum 219 when running SMT Date: Sun, 27 Oct 2019 22:01:25 +0100 Message-Id: <20191027203310.113079555@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191027203251.029297948@linuxfoundation.org> References: <20191027203251.029297948@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marc Zyngier commit 93916beb70143c46bf1d2bacf814be3a124b253b upstream. It appears that the only case where we need to apply the TX2_219_TVM mitigation is when the core is in SMT mode. So let's condition the enabling on detecting a CPU whose MPIDR_EL1.Aff0 is non-zero. Cc: Signed-off-by: Marc Zyngier Signed-off-by: Will Deacon Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kernel/cpu_errata.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) --- a/arch/arm64/kernel/cpu_errata.c +++ b/arch/arm64/kernel/cpu_errata.c @@ -23,6 +23,7 @@ #include #include #include +#include static bool __maybe_unused is_affected_midr_range(const struct arm64_cpu_capabilities *entry, int scope) @@ -618,6 +619,30 @@ check_branch_predictor(const struct arm6 return (need_wa > 0); } +static const __maybe_unused struct midr_range tx2_family_cpus[] = { + MIDR_ALL_VERSIONS(MIDR_BRCM_VULCAN), + MIDR_ALL_VERSIONS(MIDR_CAVIUM_THUNDERX2), + {}, +}; + +static bool __maybe_unused +needs_tx2_tvm_workaround(const struct arm64_cpu_capabilities *entry, + int scope) +{ + int i; + + if (!is_affected_midr_range_list(entry, scope) || + !is_hyp_mode_available()) + return false; + + for_each_possible_cpu(i) { + if (MPIDR_AFFINITY_LEVEL(cpu_logical_map(i), 0) != 0) + return true; + } + + return false; +} + #ifdef CONFIG_HARDEN_EL2_VECTORS static const struct midr_range arm64_harden_el2_vectors[] = { @@ -802,6 +827,14 @@ const struct arm64_cpu_capabilities arm6 .matches = has_cortex_a76_erratum_1463225, }, #endif +#ifdef CONFIG_CAVIUM_TX2_ERRATUM_219 + { + .desc = "Cavium ThunderX2 erratum 219 (KVM guest sysreg trapping)", + .capability = ARM64_WORKAROUND_CAVIUM_TX2_219_TVM, + ERRATA_MIDR_RANGE_LIST(tx2_family_cpus), + .matches = needs_tx2_tvm_workaround, + }, +#endif { } };