Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3979591pxb; Tue, 25 Jan 2022 00:32:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJxwpECFAWnBUb2ON/wgon+iw+y3rQekYCgW2qLEb/p3wJV7qzLlrrC2W/uNts71yFzxWw37 X-Received: by 2002:a17:90b:2251:: with SMTP id hk17mr2438901pjb.11.1643099539381; Tue, 25 Jan 2022 00:32:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643099539; cv=none; d=google.com; s=arc-20160816; b=RtdZWH09PqOKgLsrRJXp3FAG8mG6Ho9vuSB7mSg1JzDQO6qI1gWFfeaLpF+iE2Wcg1 zvxuOHUwnrtUkMWZKRWV2PappYpGk6lP4XNB1z36OApfBszdyLNUG+TUTUWSVqURUEEX 7rKtFnXvFA0xvLFdQgbIY3vp6hweVx7X7aQUDddKEgCf29T5FcDEkfHxt4P7DYcCHp+1 MlkQhiKZsOXAJt4KJV7+9EvMSoGG/2ZDqZM71VESlS3Q3bNrhJyya3ybYhD7MM3bXJSg DEx2mdTWoyQ9LPuVx28CULAM2OMa1wSwYn+KdUPfj5awdNRntl6hWFcuAwXYJpP5ywXc itDg== 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=KUSJVUgrVSbB/gaPIOPRMi55nRpf3LmoiIRY5xjgbro=; b=vpSKqcn4lkcMtBBs+/ybgMH3GCJKkLXCXj31TDaBBxG6wFGElf13AYxcZ2FpY0XWJz aY1MZFzEIC06FFJKDfzz1AlPxP3acaAvxwkalF+cZa5sfkx9ca3pxH1sMEdahlOO/fix Ojo1pDI3fdTi/mV35LzVy1KQRWCRRTozQr61MpbjEa7b7meLQOiLQ9LTmo3pzb8vzHYJ nih8f6zhqvWDetgarEbn6NRaDHfuzpo3oBiW4nOP/mHmCbAPAPP7mCB7WJQtmMLEf6Sy 0DRbSpoNhlBbLYnI/5zEs4kvcHsje/6995VmqIJ9k18f5/hyGbzCby3/lNOmoXDX2D6S 02IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vLSiCmFP; 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 w198si13075155pfc.73.2022.01.25.00.32.07; Tue, 25 Jan 2022 00:32:19 -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=vLSiCmFP; 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 S1314376AbiAYCuw (ORCPT + 99 others); Mon, 24 Jan 2022 21:50:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442274AbiAXVE3 (ORCPT ); Mon, 24 Jan 2022 16:04:29 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E7C0C068087; Mon, 24 Jan 2022 12:04:15 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2D7B0B81218; Mon, 24 Jan 2022 20:04:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63C39C340E5; Mon, 24 Jan 2022 20:04:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054652; bh=YljHBSu8U7fYgPuBxiqBxuJLS3a+IyXUlt9fCs6zb+E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vLSiCmFPmfNFJDKw8wp1uJ/MWrr6ytCzPQlktwgPP2pfacLidfR83Iyb0evhL/RBn JzviTwYSHzg9JFGINxDl+pAsNNSW1IpV2nrfEVf9CeF4CPFbKYckNRp/rWpIzpyHvI s0msGEU9QmxAabOVcm4G8293dj7VioWZXsnOCY8g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John David Anglin , Helge Deller Subject: [PATCH 5.10 458/563] parisc: Fix lpa and lpa_user defines Date: Mon, 24 Jan 2022 19:43:43 +0100 Message-Id: <20220124184040.288671499@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@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: John David Anglin commit db19c6f1a2a353cc8dec35b4789733a3cf6e2838 upstream. While working on the rewrite to the light-weight syscall and futex code, I experimented with using a hash index based on the user physical address of atomic variable. This exposed two problems with the lpa and lpa_user defines. Because of the copy instruction, the pa argument needs to be an early clobber argument. This prevents gcc from allocating the va and pa arguments to the same register. Secondly, the lpa instruction can cause a page fault so we need to catch exceptions. Signed-off-by: John David Anglin Fixes: 116d753308cf ("parisc: Use lpa instruction to load physical addresses in driver code") Signed-off-by: Helge Deller Cc: stable@vger.kernel.org # v5.2+ Signed-off-by: Greg Kroah-Hartman --- arch/parisc/include/asm/special_insns.h | 44 +++++++++++++++++--------------- 1 file changed, 24 insertions(+), 20 deletions(-) --- a/arch/parisc/include/asm/special_insns.h +++ b/arch/parisc/include/asm/special_insns.h @@ -2,28 +2,32 @@ #ifndef __PARISC_SPECIAL_INSNS_H #define __PARISC_SPECIAL_INSNS_H -#define lpa(va) ({ \ - unsigned long pa; \ - __asm__ __volatile__( \ - "copy %%r0,%0\n\t" \ - "lpa %%r0(%1),%0" \ - : "=r" (pa) \ - : "r" (va) \ - : "memory" \ - ); \ - pa; \ +#define lpa(va) ({ \ + unsigned long pa; \ + __asm__ __volatile__( \ + "copy %%r0,%0\n" \ + "8:\tlpa %%r0(%1),%0\n" \ + "9:\n" \ + ASM_EXCEPTIONTABLE_ENTRY(8b, 9b) \ + : "=&r" (pa) \ + : "r" (va) \ + : "memory" \ + ); \ + pa; \ }) -#define lpa_user(va) ({ \ - unsigned long pa; \ - __asm__ __volatile__( \ - "copy %%r0,%0\n\t" \ - "lpa %%r0(%%sr3,%1),%0" \ - : "=r" (pa) \ - : "r" (va) \ - : "memory" \ - ); \ - pa; \ +#define lpa_user(va) ({ \ + unsigned long pa; \ + __asm__ __volatile__( \ + "copy %%r0,%0\n" \ + "8:\tlpa %%r0(%%sr3,%1),%0\n" \ + "9:\n" \ + ASM_EXCEPTIONTABLE_ENTRY(8b, 9b) \ + : "=&r" (pa) \ + : "r" (va) \ + : "memory" \ + ); \ + pa; \ }) #define mfctl(reg) ({ \