Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3730182pxb; Mon, 24 Jan 2022 16:33:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJxiSw2GbFDcBaLxd2mLCp8NqLuprkXvFUiMjuVJKq02UGp8IyBKGsfzE5I1QOTV2ltRoVAN X-Received: by 2002:a17:90b:1c87:: with SMTP id oo7mr893745pjb.114.1643070800384; Mon, 24 Jan 2022 16:33:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643070800; cv=none; d=google.com; s=arc-20160816; b=HHoDvh4oewrr9jFONoYt75z522GErTDp7O1stw09d6KHcMKslLUJlk035xSP9DPELr 7z5NhI0OxpeiPkKrT/T9Dp+Bw6yXZiqNnYg4iSvoLcrYIgO8jFpMvMvUjBUDoLY8ZNKO 4IgTsqd0ixzY/gKiMXtXFXGbdfaOIs0027d4enIF65SGcRqcpRu/OHlsUnv/5B3+Mbq7 ANoSnSF5XJyASlv7cKG9F+1ymkj7Vr881qvuHkKygkTcXS2DRv3xMLx8M5/l+DF/pgjI Ow1DNxwtLmUN8NpTABr89VzS7nmCdCQlSPgyz+IuqE3I1JCY/KPyORIYVOttKiXJDv/G VTGw== 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=Y7q5iLtrIQ3jgkqWdg6WJu3MCYURMw+Lsaw7o5GsrFwpcagjlYpaMAiGyrYCTsq66U IepkO9KLQqIrT9jZeCtQYvvE7mcs+ShopMh882hiFE4dqioLLKwW8zrBtfnnLnnuxRJC CtCINj010wbHMoNTMsFxGrZ5lWGR0ywPSNFUGqqbc/2TrTJDZTawu2kfGneWInSEA8jF yvQx/S1eZFT3VIEyCaI9p4911uyT2RAG1HmV6Ao1vyFymsy1FRk5/bYN1QUL4ey2pvdK x/N3J/aXK7NZCJNuebFPivDESHcUAVIlAHTO1KJ+lGvr+a6YZn7kfkGmHtcPlh2wLJ7D Crtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jhdVyAGH; 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 j3si13764524pfr.288.2022.01.24.16.33.08; Mon, 24 Jan 2022 16:33:20 -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=jhdVyAGH; 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 S3410539AbiAYA33 (ORCPT + 99 others); Mon, 24 Jan 2022 19:29:29 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:54920 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348012AbiAXVgU (ORCPT ); Mon, 24 Jan 2022 16:36:20 -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 72129612E5; Mon, 24 Jan 2022 21:36:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D0CEC340E4; Mon, 24 Jan 2022 21:36:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060178; bh=YljHBSu8U7fYgPuBxiqBxuJLS3a+IyXUlt9fCs6zb+E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jhdVyAGHnYKXW+kAhEHKAXx7nmvKruB8Tph6SxwiYUsxSax1a4SonaGZDLkdDdG1o TVwWEWmAtr8eOfMDgk0GPE3cLMJa9hxZp8gLqN6yay2nEKwPQwOhFWq9M3lzCoz4TO pZWy2J+hycw03cwwntdc9qxpmG7GAHwtreoU+j9k= 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.16 0864/1039] parisc: Fix lpa and lpa_user defines Date: Mon, 24 Jan 2022 19:44:13 +0100 Message-Id: <20220124184154.337574400@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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) ({ \