Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9088080pxu; Mon, 28 Dec 2020 06:20:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJzkhABklC6TuN2/Pgj86cjqaYo9/PZGotLDpuHQYbsUeSE5I+zlJAT4o3teXfTpolskefxU X-Received: by 2002:a17:906:378f:: with SMTP id n15mr41040809ejc.263.1609165226000; Mon, 28 Dec 2020 06:20:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609165225; cv=none; d=google.com; s=arc-20160816; b=Ed/TWAEHxqCvVjjE/CIcw6Ey8otF89tRWxlqBQZD0yjUyaOQxkGSaYeM3ON2EkG2lM Cd+8ezV3jisvo78kH2hwCOP7XUxMTIBrWOuKN2xT9IW2YX87n1RQCqiT3hCs+U8D7One B99A06hfURxYFfzG3wWAgr0esGJWyYoBKaVNMsqaZyLkNJZXdDHLi2hp9WjIt3Yu3uSU ksuq5gGszpOsZHi/QUqIFXXEhxQOo67k3S8LFdA13PMbqgEhTLz3XWNzEKzS578pg4A2 umu9DiUcJkfyKzmXfdN8naSKJAzpD+bEtk0vVLUqdpKYBEeQhT5dl7sm0Ur6ibqWALF8 AJ2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eNOE0M8E96Ks2c3viHYP1n1b66ZZLfw1xnmTKwhfy04=; b=DZOMFQisBheYKJiHuVEk4DHzwXiTdwVvfboT1KqDQI1vUiSU9g0DGBj+cQDaZS7gNy fJVuigF5eXRZzf+AHsERwPF6PfW10qXxngTYiB+hXjmlS1bZ17/FoJAQNOdMxqHBrlu8 k/bnC0Ugh3l52EYsCN+4pUK8luH0NRIybRGMIz9msx9ALt5UwAroIOsx/d6/FXtp/WGc xAM3kdJV7EqfO+Xu2TklW2k/nQxquzI1SBigVQYZ0AME4gI9LCfnqZbBsGTlK3EX7p1S PDQVfRQvZFYnuiMkSNq2nzV+Wu0FGFvMi7F2aVdqYU4HNn/FccUNPdUQfimiOgJ9CGTP wG+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NTEHg6Cv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j15si21149927edv.474.2020.12.28.06.20.03; Mon, 28 Dec 2020 06:20:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NTEHg6Cv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2501883AbgL1OR5 (ORCPT + 99 others); Mon, 28 Dec 2020 09:17:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:52306 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2501901AbgL1ORs (ORCPT ); Mon, 28 Dec 2020 09:17:48 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id D30EB2063A; Mon, 28 Dec 2020 14:17:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165047; bh=tCMV3UkkcwBxvZjvUj6fB2qubsB7ZMZfL2hJfreyivs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NTEHg6CvaRz+E7Ic6Spb/6vVcwMHNcsxYBHcEIuMqlvlebQYkbYTKkT7LszXA8OXD RT4x6afRY+HcWbQiySqHvZjWBxe4cz8kKkXR1PD/3xCkTcO1BhBNuBRqXvtVxnEL7b MNd095yM/E6KyjWu7rUw2C7f+6xtp/D1/qn+U9io= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Balamuruhan S , Ravi Bangoria , Sandipan Das , Daniel Axtens , Michael Ellerman , Sasha Levin Subject: [PATCH 5.10 392/717] powerpc/sstep: Emulate prefixed instructions only when CPU_FTR_ARCH_31 is set Date: Mon, 28 Dec 2020 13:46:30 +0100 Message-Id: <20201228125039.787158501@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Balamuruhan S [ Upstream commit ef6879f8c8053cc3b493f400a06d452d7fb13650 ] Unconditional emulation of prefixed instructions will allow emulation of them on Power10 predecessors which might cause issues. Restrict that. Fixes: 3920742b92f5 ("powerpc sstep: Add support for prefixed fixed-point arithmetic") Fixes: 50b80a12e4cc ("powerpc sstep: Add support for prefixed load/stores") Signed-off-by: Balamuruhan S Signed-off-by: Ravi Bangoria Reviewed-by: Sandipan Das Reviewed-by: Daniel Axtens Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20201011050908.72173-2-ravi.bangoria@linux.ibm.com Signed-off-by: Sasha Levin --- arch/powerpc/lib/sstep.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c index 855457ed09b54..bf2cd3d42125d 100644 --- a/arch/powerpc/lib/sstep.c +++ b/arch/powerpc/lib/sstep.c @@ -1346,6 +1346,9 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs, switch (opcode) { #ifdef __powerpc64__ case 1: + if (!cpu_has_feature(CPU_FTR_ARCH_31)) + return -1; + prefix_r = GET_PREFIX_R(word); ra = GET_PREFIX_RA(suffix); rd = (suffix >> 21) & 0x1f; @@ -2733,6 +2736,9 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs, } break; case 1: /* Prefixed instructions */ + if (!cpu_has_feature(CPU_FTR_ARCH_31)) + return -1; + prefix_r = GET_PREFIX_R(word); ra = GET_PREFIX_RA(suffix); op->update_reg = ra; -- 2.27.0