From patchwork Sat Nov 5 00:00:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 9413547 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8847160722 for ; Sat, 5 Nov 2016 00:36:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D0502B2D6 for ; Sat, 5 Nov 2016 00:36:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5FA0D2B2D8; Sat, 5 Nov 2016 00:36:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 33F742B2D6 for ; Sat, 5 Nov 2016 00:36:10 +0000 (UTC) Received: from localhost ([::1]:41591 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c2oxs-0004QF-Hv for patchwork-qemu-devel@patchwork.kernel.org; Fri, 04 Nov 2016 20:36:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59863) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c2oxb-0004QA-0q for qemu-devel@nongnu.org; Fri, 04 Nov 2016 20:35:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c2oxV-00032v-RB for qemu-devel@nongnu.org; Fri, 04 Nov 2016 20:35:50 -0400 Received: from mail-bl2nam02on0086.outbound.protection.outlook.com ([104.47.38.86]:45091 helo=NAM02-BL2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c2oxV-00031j-LT for qemu-devel@nongnu.org; Fri, 04 Nov 2016 20:35:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=GBi9qNXsURPG0UOY6RDiB0CiiBr8mPw2gRzTmzOe49E=; b=uGTplET4ATAsLMX37NuH1sZcQaYAl+jUcJygQ0Fll+k6+s94A0sFzv2OZcLQ/8dVsdUg3rMUcEHAfFAW9e+uTR2tWFrg/OJ+SXA8ZmYOlF1sMJOWktXRnQ6f8LOenlgAL9m2BUj6TBc1ujAdmbPa98Gma0jlzv0jP4P0CJQ1Re0= Received: from DM5PR02CA0061.namprd02.prod.outlook.com (10.168.192.23) by BL2PR02MB2003.namprd02.prod.outlook.com (10.167.96.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.679.12; Sat, 5 Nov 2016 00:02:11 +0000 Received: from SN1NAM02FT015.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::201) by DM5PR02CA0061.outlook.office365.com (2603:10b6:3:39::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.693.12 via Frontend Transport; Sat, 5 Nov 2016 00:02:10 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.100) smtp.mailfrom=xilinx.com; huawei.com; dkim=none (message not signed) header.d=none;huawei.com; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.100 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.100; helo=xsj-pvapsmtpgw02; Received: from xsj-pvapsmtpgw02 (149.199.60.100) by SN1NAM02FT015.mail.protection.outlook.com (10.152.72.109) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.707.3 via Frontend Transport; Sat, 5 Nov 2016 00:02:09 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:1459; Count:15 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:56421 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1c2oQy-0002fV-JM; Fri, 04 Nov 2016 17:02:08 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1c2oQy-0007kN-Fo; Fri, 04 Nov 2016 17:02:08 -0700 Received: from xsj-pvapsmtp01 (mailhub.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id uA5023qC026884; Fri, 4 Nov 2016 17:02:03 -0700 Received: from [172.19.74.182] (helo=xsjalistai50.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1c2oQs-0007gQ-SV; Fri, 04 Nov 2016 17:02:02 -0700 From: Alistair Francis To: , Date: Fri, 4 Nov 2016 17:00:31 -0700 Message-ID: X-Mailer: git-send-email 2.7.4 X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.0.0.1202-22678.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-IncomingHeaderCount: 15 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.100; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(979002)(6009001)(7916002)(2980300002)(438002)(189002)(199003)(50986999)(19580395003)(9786002)(626004)(77096005)(11100500001)(33646002)(6666003)(189998001)(586003)(50466002)(92566002)(229853001)(36756003)(8936002)(50226002)(48376002)(47776003)(118296001)(5001770100001)(2906002)(4326007)(5003940100001)(81166006)(7846002)(356003)(81156014)(5660300001)(36386004)(87936001)(106466001)(63266004)(19580405001)(8676002)(305945005)(107986001)(5001870100001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:BL2PR02MB2003; H:xsj-pvapsmtpgw02; FPR:; SPF:Pass; PTR:xapps1.xilinx.com,unknown-60-100.xilinx.com; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; SN1NAM02FT015; 1:u5haZFzuDrWfBdi4qKm4QTRcEac9bAdb7hI9ABn49+qwpkR4rNVs56oUrNnKKt2hPFdaApqzLIlvjz8TsusUb+z9RzPr84VSbcuOvzPtUX+fDNma22ebAynV1lzcv1YFALBOFyhFE3WmAYJXucJJWYbCzW4C4kZYSsaXTBRnOFX/IylicLKBkR7893GfU53aX9ttZRjIIX3r+QkDwEw+z2XbU9ZxXuI1d4e2IFZy36NwV1unzzZ3hdvnUZvRIOWEkEXVXbgSwP+T8/wG78fyK9w5FTuMIAAHw5tTqLv69GLT6Xa12axdHQs2oWZAhZZ0wEzlcZbfkUxf5INFgdZopWVKKx10ISquWvuiQPUEvczaYxbm4PoMl+kCkrqkFqvhiv2T0rwXgArh6KUkKNwEumjAyO9/IO22Vr48stzzLHqO7iYVKPRLx/Q5P1s5Uhsf10VhScj4cXo/2CEBo8QaxoGNubpyJIkup2qHh77oq1DC+atGkyzZB7JnnoYVXNDaYLDbPLmchnjviEvJm6JFT+KaCTUZ/RDy0+QZqh29h0257iV4ChI6K1zGx0L5DymkJ2I4BT7xu0Y/mqCTHwsMDphLtwgJ+dleUxnTTpyMy4I7Zf3L76IzR2RjyUq0bzUW MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: e46bb6b5-7c9e-402b-c74c-08d4050efcc3 X-Microsoft-Exchange-Diagnostics: 1; BL2PR02MB2003; 2:H2w4YdME6W0TJ7sOIZxE7MsLsYTzqxFoXv+CQkHqFc4Uhy3LLJ3lBNrtZlS7COo3tyJbicCRyLT5eSkONeI0sVa2i6shJE64aEATI2HB9IuzRl0k/6MzBeQp0XMqVgAdMH5qBapmC2mZlO4AoN8k9maqmU0T+wR/To+srV2fDAB5ee9inHGeVVypI7TsCVxLM+LidhRJI3pCsv6WxvQBvQ==; 3:UsAxEDxpMuOHcBVfKYmzBdhf06E3xfUHyQE0mH5aGxR84Iy+Ee9VbRuqOt0pSstVm6KpaB5Rvz+yts1dyP02j+XyyrvMLx3M5QYmppAy0vIXDgNxn1WK4BQkVV8ywwaW5xKRwByBOpmm+YhTd8XLjIhpJY+yObkD37yzBGY6wxkVBzPe3tciUNekFcxEGvFE8BOGxbvxnf5MPOsDMj8HKeTV3d+gIj5smURfp6sIJ6m+38yMyrsEtXwJF+G9HYMCRaqZQGcApqlvdtItDMzxIj01gM+k1OQa++JsjDa5C3g= X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:BL2PR02MB2003; X-Microsoft-Exchange-Diagnostics: 1; BL2PR02MB2003; 25:mLB+CM38NtnqYmeT8Xid39iHCzf+PmQ3B8U58s8eD56sUNp+FHR4WahDJYokp/loyVsIy5KDKz3bkBVbMFySovzvIywmoWUX52lHB+bBrk+kL/oIiMekf3SZtqxZMIWps+7ZvsK3uzlXofdrwkv+FVm4xruovAbjlYJyEymtCq/Dm8aoYk+pMfM6to8p+O40ZmxrVWyrVeUl2iFnqkj1rk/+Nk5F3qTbEPQvHFkNdklnRvj2qtwMfbb/0lwLp8wWWIYy42VBaHmFKcdzR7db5fZSnObbMpFk3+SG9WvLoO1Uz6oSbZV7zTHKHF1+ZvpKhqoGnwJE0rVvFMQN2hhv1qfsrIydx2ciD37wMXczd3XYnXO5ZzkAnL8vYg/cCoXoxSALLGbfNb04XIIorqDzvMmCofyceFFRRQPGJkPtBy8d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HqiMptQ5RdZ1/0yrZZ9z7etba96Hkv9rnOeYMtYvb3JsT7xHDIMF64+fLriUUOprGOq6AY7A90Sm5RnvEFR9sLamTHavuH9Qd54EaOzzgndP3oN6d094C+2FBagb3upT6KatUZU2JVWtT X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(50582790962513)(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(13024025)(13023025)(8121501046)(13015025)(13017025)(13018025)(5005006)(3002001)(10201501046)(6055026); SRVR:BL2PR02MB2003; BCL:0; PCL:0; RULEID:; SRVR:BL2PR02MB2003; X-Microsoft-Exchange-Diagnostics: 1; BL2PR02MB2003; 4:Jg0qEfYv8J/xHGCOedIl7Czt7vl1NIiyy9YHqB7FW5zHV25bR6ckmrbig+aWqpmSJfWu28496DLNn11fI5+bDHzXWa9SUtoK9koJi1M0S28f/qZ6/AGM/Ol40MLMRyMXkSt+mUvvvIzfvNGfEaYP+qcX3XZiEAxX6/ZpW/LWw4jWSYXeSED8u79h6SvGbzo0v3bgUsXCK3mRcqQKwYdB6a0YeeEvGO8Q76ARD4NohgjgRP1G2VCPayQaRk90kpCayWJt4ps0uU+W74S9oVXkeyJQ5gjnNU/JvjP6pDckewgiDzDLY2gUklflLAvSS3SncK6PmP2/YYOF6SFpidmHUcQQb3k7sfh6KN7mvnK6q8C2mOj+nJ29ocZaigdCzTXV0xDRE3T+V8u1DACWUmxV49PduRpeLzN6LGvIrCvxLc8ZlXaLEc12UQUtBBBEJG6Zj9raXIRCJLMHFKvb7c3gj/vSrzrAD9QlxEwWkI+hGHVAgSTtJiqGuwCnQAT311mi11k1ws2WOJWq6S9hWyxL+PrF5/ojJpcyw1W6/R5vi0knGsA8EFtaYd4UDmsqXd5qg13D8OmyQ3q39Lu9tu1ocg== X-Forefront-PRVS: 011787B9DD X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BL2PR02MB2003; 23:OwUbHR/u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Q?k5HhCnHotnj/0HqERvg1rp2pm7aXYD02+bLl4+oPe95KF7DbbWMngjf54fzw?= =?us-ascii?Q?VPanEOgofVhe8quXeNKjM6LixNmbG32Wqo+wJn0Yticqn8H606brM+GeZxD9?= =?us-ascii?Q?ZJBwsFjK6YvCmanbiJhe4uUIUNtdFLji/IpY6s97+iVJm/k7xQRvyhkuMQrE?= =?us-ascii?Q?3WOQeyMOP+1zVQcSQNTv+UvEIXYyGOfSZ7mCj2oJb26pUQJSo34D4JefACpj?= =?us-ascii?Q?7X+d0gCeJjvK0EXLc6aJMH8eFm68tvzFoXNkMhqNMdG19K/RZyGMQ=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BL2PR02MB2003; 6:G839EU8xTF/HvIszWwAd72x6HleZc1XcdTnWMoE2b+v4iH3eoe8SQP6BQ+lkKpnPc3W8Twv53xWfnjH6pvvN2F8Jwj7jZaTagGieYkl9uEQav5+pLj8UsugWm9cKAZlSpCoxauQh9DtCBTlQe5YA7dJV/EixvojvC3YiKMNLkynVKzNk8tQ3y0DBcnVfsYqyaAr+yDQylWVZx1g9gS/v50SjE74ufEjwo5pfToypjtbJTjF1lvGWFM9UuRpr4irx0SvdudGuF1SeF/rs57L8vIYST7Rjn+LTpk4q2eRh8yHlOC1E8SFhEszwDFpUuS2XIbEYBT4C+JwUwcYsYS9FBQ==; 5:5OQPgS8VpASN6l7d+etGyDBgueZgpz1HE3fgU/K0vzf+WEICJAoQg+orval99ad//X5ZrRlCxZQPWMax2o2fmVunr/e0gZIYTUAVnOXo8jVp72GRrIBdRo0v9XcZxvqvcFz2t0RDJ7IHy2EGemd+FQ==; 24:pRTYcKpeA/n0ZB+2nQEcBcYDccaWJuX35nMKBdrtRUUIHClDRhY1VzKPN3twHPlKy8Qi4AvV4n7S6jpsVy/EiEoeLXsbQZcNqeyH+iCbOaQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BL2PR02MB2003; 7:BXTwk8gDjN1UC0k0UGnuNHZNkKsrJrhCVqi88mSBhKvWKGU4hUKsXi8AMLfY3fy7DxQm+gkDlXk4rqjgSC8nXKtZ7/ngytfMBRZ4g+2tktFSBdEkKqcM2S6gZ0FfzxEzYhV3iLdHb0PyKGZv2383fm+C4BRSBY5fQkEWwpUInmclD8gajzgqiUg6f+0QBAo8KqDRMHEB/G/nUT9crC7HL3RyilBn18whnDjFXVbu36Ro0/0Y8cYLTdzVQtkfU46v8Q/4ZtxjW6oSKxsPd4EOqKc/u+faNHwMD+r0bTXwn1Yz3Wx9ncGZWyAdV3dpurw9uJxkFHnaTLRUBBboOgSLWSueuYU+1R6YyCUOcIDIQjk= X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Nov 2016 00:02:09.1796 (UTC) X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.100]; Helo=[xsj-pvapsmtpgw02] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2PR02MB2003 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.38.86 Subject: [Qemu-devel] [PATCH v1 1/1] cadence_uart: Check baud rate generator and divider values on migration X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alistair23@gmail.com, psirt@huawei.com, pjp@fedoraproject.org, alistair.francis@xilinx.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The Cadence UART device emulator calculates speed by dividing the baud rate by a 'baud rate generator' & 'baud rate divider' value. The device specification defines these register values to be non-zero and within certain limits. Checks were recently added when writing to these registers but not when restoring from migration. This patch adds checks when restoring from migration to avoid divide by zero errors. Reported-by: Huawei PSIRT Signed-off-by: Alistair Francis --- hw/char/cadence_uart.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c index def34cd..e3a6248 100644 --- a/hw/char/cadence_uart.c +++ b/hw/char/cadence_uart.c @@ -487,6 +487,19 @@ static int cadence_uart_post_load(void *opaque, int version_id) { CadenceUARTState *s = opaque; + /* Ensure these two aren't invalid numbers */ + if (s->r[R_BRGR] <= 1) { + /* Value is invalid, reset it */ + s->r[R_BRGR] = 0x0000028B; + } + if (s->r[R_BDIV] <= 3) { + /* Value is invalid, reset it */ + s->r[R_BDIV] = 0x0000000F; + } + + s->r[R_BRGR] = s->r[R_BRGR] & 0xFFFF; + s->r[R_BDIV] = s->r[R_BDIV] & 0xFF; + uart_parameters_setup(s); uart_update_status(s); return 0;