Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1199150imm; Tue, 15 May 2018 15:35:43 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrOik6g7v/Ck2cAGTuXFWuAF8KlKxnuzqcHKsDGS4R/SZ2vUndNDpuUKl1sjpHxlNaF9tWh X-Received: by 2002:a17:902:9a9:: with SMTP id 38-v6mr16568748pln.114.1526423743598; Tue, 15 May 2018 15:35:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526423743; cv=none; d=google.com; s=arc-20160816; b=f7hYSWjxlA2agGK+h6n4zDDWL7Xx7O+m5ykd5a6PI+nbrrsqMbfB1mhNb4hBfj9FMn nsGDLKfrNhxdzXJ2Ux7QT64bfzoWcY9BlqcAVD6BuLPlMyQ+aIR7DvxPQ22vmyMSyNuG xLgRz3t1/5N8wntFPqQz+jndZySfp7kILIf9rfVFx41HVZAH+sIFuPF33kRP/KzGl+Lg dBb5mPy4inaobPPxXySpmzcArckiuynjpyZfiXXN6K8xmiSKp0u0msl5FU1M9NoG4avW f/N2EoGy85rcH5SFeD2YT3C9eA2esP+5Xz0PquRgkRk6xVgnog/WiacSdBMDVaDDmpDW 3AJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=jlfZb67cMAA29Qmyd+Uemw2NTO4mYYqWwQfb9sGN4pc=; b=RgSeSI7weZ6TBkHJADZt5P0qUvlsOHt/ZHOZLU3CMwuyA8j7YJBreX9KAq3ReJOLLL g8yddvuson3h/81BJvSpHVh2jI6MMU+lF667iwUQSH24AgFZUDWg8J/ElqC3uFAOarrX o9gsbmzLiHiwSd9n1dB46EgyfEOdh6N/fEpJ2XonJvbE0QfMrB8hcCOXK80eW20lZUJY wIsm8H/T7xbQcQp+jnBZTuEik1QiPmQKuizpujHMSYusX6xTk+lPJj7ZfkXhRKwnlJiI o+0K2mvoIwHWogPrPK7kFlwq083a7Tb+6YmKERp6It9b5lFE7iWXYgIX8uNo/D9lGyhQ b4TA== ARC-Authentication-Results: i=1; mx.google.com; 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 y1-v6si971638plt.316.2018.05.15.15.35.29; Tue, 15 May 2018 15:35:43 -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; 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 S1752292AbeEOWfN (ORCPT + 99 others); Tue, 15 May 2018 18:35:13 -0400 Received: from 9pmail.ess.barracuda.com ([64.235.150.224]:58653 "EHLO 9pmail.ess.barracuda.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751400AbeEOWfJ (ORCPT ); Tue, 15 May 2018 18:35:09 -0400 Received: from mipsdag02.mipstec.com (mail2.mips.com [12.201.5.32]) by mx28.ess.sfj.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA256 bits=128 verify=NO); Tue, 15 May 2018 22:34:18 +0000 Received: from [10.20.78.107] (10.20.78.107) by mipsdag02.mipstec.com (10.20.40.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1415.2; Tue, 15 May 2018 15:34:02 -0700 Date: Tue, 15 May 2018 23:33:26 +0100 From: "Maciej W. Rozycki" To: Alexander Viro , James Hogan CC: Ralf Baechle , , , , Subject: [PATCH 2/3] MIPS: Correct the 64-bit DSP accumulator register size In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Originating-IP: [10.20.78.107] X-ClientProxiedBy: mipsdag02.mipstec.com (10.20.40.47) To mipsdag02.mipstec.com (10.20.40.47) X-BESS-ID: 1526423657-637138-23752-17153-2 X-BESS-VER: 2018.6-r1805102334 X-BESS-Apparent-Source-IP: 12.201.5.32 X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.193020 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS59374 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the `unsigned long' rather than `__u32' type for DSP accumulator registers, like with the regular MIPS multiply/divide accumulator and general-purpose registers, as all are 64-bit in 64-bit implementations and using a 32-bit data type leads to contents truncation on context saving. Update `arch_ptrace' and `compat_arch_ptrace' accordingly, removing casts that are similarly not used with multiply/divide accumulator or general-purpose register accesses. Cc: stable@vger.kernel.org # 2.6.15+ Fixes: e50c0a8fa60d ("Support the MIPS32 / MIPS64 DSP ASE.") Signed-off-by: Maciej W. Rozycki --- Hi, I have no 64-bit DSP hardware handy to verify this change, however some surely exists and is used to run Linux, as indicated by GDB PR gdb/22286, , so we better get it right before people start screaming. Maciej --- arch/mips/include/asm/processor.h | 2 +- arch/mips/kernel/ptrace.c | 2 +- arch/mips/kernel/ptrace32.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) linux-mips-dsp64.diff Index: linux-jhogan-test/arch/mips/include/asm/processor.h =================================================================== --- linux-jhogan-test.orig/arch/mips/include/asm/processor.h 2018-03-21 17:13:52.000000000 +0000 +++ linux-jhogan-test/arch/mips/include/asm/processor.h 2018-05-09 22:35:33.248559000 +0100 @@ -141,7 +141,7 @@ struct mips_fpu_struct { #define NUM_DSP_REGS 6 -typedef __u32 dspreg_t; +typedef unsigned long dspreg_t; struct mips_dsp_state { dspreg_t dspr[NUM_DSP_REGS]; Index: linux-jhogan-test/arch/mips/kernel/ptrace.c =================================================================== --- linux-jhogan-test.orig/arch/mips/kernel/ptrace.c 2018-05-09 22:34:00.000000000 +0100 +++ linux-jhogan-test/arch/mips/kernel/ptrace.c 2018-05-09 22:37:45.416608000 +0100 @@ -856,7 +856,7 @@ long arch_ptrace(struct task_struct *chi goto out; } dregs = __get_dsp_regs(child); - tmp = (unsigned long) (dregs[addr - DSP_BASE]); + tmp = dregs[addr - DSP_BASE]; break; } case DSP_CONTROL: Index: linux-jhogan-test/arch/mips/kernel/ptrace32.c =================================================================== --- linux-jhogan-test.orig/arch/mips/kernel/ptrace32.c 2018-03-21 17:13:52.000000000 +0000 +++ linux-jhogan-test/arch/mips/kernel/ptrace32.c 2018-05-09 22:45:50.924418000 +0100 @@ -142,7 +142,7 @@ long compat_arch_ptrace(struct task_stru goto out; } dregs = __get_dsp_regs(child); - tmp = (unsigned long) (dregs[addr - DSP_BASE]); + tmp = dregs[addr - DSP_BASE]; break; } case DSP_CONTROL: