Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3615369pxb; Mon, 24 Jan 2022 13:34:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJx3qgSh2OnWp4EcMXYmKaB1IREWAthXmxWya6aE86eBJhi7qV+49Rsl/RNuzF0PmTUB4Kh5 X-Received: by 2002:a17:903:1209:b0:149:a968:6cf2 with SMTP id l9-20020a170903120900b00149a9686cf2mr15684803plh.110.1643060075602; Mon, 24 Jan 2022 13:34:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643060075; cv=none; d=google.com; s=arc-20160816; b=VPhTkpmNwv50MIcJi34Vzxqek9ob3mPYgpcQJxk4meWds7U9lEoeIWMjEqlgEWrDPD pG0LEvuwzvDoTHg16BLV+H/LMa3oGUwLYAQA8AnGNuCtEkpqSyaJdawd6qlzGAc5/hOR z9cRPTWOyUhfVj/dcd0gAKYhAody8WqEkvSryX2Z06pElc1imZTwQ+3cIiC2HVZ4PvxS BxzL95z0CaJd+r9SwAoHvHOPkZK7obz8yPLGAUWcWYlpOTB7vZmMxagy+rUnG9O8KKkB yaKmWcwD07KtXMbmXKyDBpEagwOml/3HZoAhk0jYWiGLdUJXkcwtuT/o/hfOWmK77Tj+ wmcQ== 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=HL0Xi5niq9i+pAzXtK+WR/1TXLfx8QCiUnOKHPiH2UunVh5AryKHxpf9f8Eajsx6Gt vI9D4khwm6LJnjZz+MaxYNnfVFXsskMgFtTslcNfw3OfPWqvfNaLtum+BPUklBKnqyRD DGZqq1xSxeigVwKgUbe6XyRAA6rlhhfGo36JIViexDo1QKJmx6keYi08ea/dKyPSUoi5 u24mBU+JmIh9d/XlSq7mVSBcbARC+90XhX2yx0MFtEHguW0piH0ZG4mtat5XCMR2QIpi HL/VMVjNx3KJpfdTZTxygG2US1lhoOxF+WHV41h7wCWrZ9kZAagcrG3ooO+MSfz/fFJN h0pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UT4dvYCS; 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 bj7si14109604plb.408.2022.01.24.13.34.23; Mon, 24 Jan 2022 13:34:35 -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=UT4dvYCS; 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 S1447899AbiAXVLj (ORCPT + 99 others); Mon, 24 Jan 2022 16:11:39 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:40190 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1389949AbiAXUpD (ORCPT ); Mon, 24 Jan 2022 15:45:03 -0500 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 dfw.source.kernel.org (Postfix) with ESMTPS id 3136860B11; Mon, 24 Jan 2022 20:44:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0669DC340E5; Mon, 24 Jan 2022 20:44:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057078; bh=YljHBSu8U7fYgPuBxiqBxuJLS3a+IyXUlt9fCs6zb+E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UT4dvYCS03Guinbh0NFD/ZCrG5c007EplAMXJpbIQx+x9m2VOezPhKdHSkrqL8vSu vV3ptC0TP9l6J7GeL32jDQ53GFQuJ7M4rnymHPNHDLVR4A8S042N26EvqFxamhh/Mt cJW4HCfWoFiEzlCeZBEtpZKbbzuXID4/u7SmdyNA= 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.15 695/846] parisc: Fix lpa and lpa_user defines Date: Mon, 24 Jan 2022 19:43:32 +0100 Message-Id: <20220124184125.027440777@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@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) ({ \