Received: by 2002:a05:7208:13ce:b0:7f:395a:35b6 with SMTP id r14csp337560rbe; Thu, 29 Feb 2024 00:35:00 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWrpq9QkIX4bKZY59XLfZVwz7ZG6LmEF2LDkIvOm8/9dZ58+QTA8CulPPPUhPlx6QQHmSH2NFHGLRbM/PtMaWgPeVcbXSLm8LDQMX42Sg== X-Google-Smtp-Source: AGHT+IGOJ6ChPOiUhz7zAkUtHfJ4OFtZmLK8GpS113b6ei9RMwwIJ8dY2HS4yhD7ZI3ebbCXegC0 X-Received: by 2002:a05:6870:1583:b0:21e:624d:56f3 with SMTP id j3-20020a056870158300b0021e624d56f3mr1200606oab.56.1709195700010; Thu, 29 Feb 2024 00:35:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709195699; cv=pass; d=google.com; s=arc-20160816; b=oeHR0BriHNFA8OFFyW0/CRq6Jw6MKlvhiAtRe7B8JuJF4ue1fSFJaCoivBWaTcAU0F 2Fz4MilDpVfM45YsXc7C8jaEcvtysOAsHKjnHZ+DJ6Wtk9xATtw+xpWL8rGNXCqfYo5c Dcid2UlUS8PjwSjg11ED/PdGg7tl2lwwySj6/ntd51IaHzpjSMeQ8F+BYZYGVAJzxmwF 7SunAIXKFUxmCZKkTJq+QTA5RVT1kVNxHvTk58Vpb87g2c0B4NCyxoCu4sZdkb/W3UmM 6G2rDOWtVd6FfY8sQQzfEBMlKg9UY5lIV8uzXOrZLpjiI57D8KaFK49pUNbmehqXq5/l GMEw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=IfHC0HtN5kmwu3qNFRuDW3PsLTEYilNj4cqI1GxWsK8=; fh=tQ6viaFeB/kxCgTWyGZ2VFWhYMFFw5BiHefGgixtung=; b=vmBanTFLvsXskTkiazc7g39gpmxxdhpSeuCQBaC98+MV+txXqrUuUFOSKGgM/n/n74 Ux3ak3yLmwbuLlFvX1eOGAhwb5M+DiaPgn0GXj3NpPgn88bIuLLZrknqxfj/mZBLJPYg IFbJUbwxhBDMWk/nz3xfpEngJS/aQ1qFW/mSRctXrwZSsftQqZAPtFqtq/I5Q5tW4uT0 eGukrS3GNl4RoXF/JVM4+xPCsjFDon5vAhLPVFGNg4j2IPwoIMHTE09o5G+Op9puROxz taEMy917egqcW2tG0lMrtV+wpBZ52DzBkurn0ZuIUgGZwWf999XREFFITH43OwEDOzrD DiBA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-86297-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86297-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id c14-20020a056a000ace00b006e558a20e88si914161pfl.208.2024.02.29.00.34.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 00:34:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-86297-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-86297-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86297-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 73D8A28A831 for ; Thu, 29 Feb 2024 08:34:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4FF1E50A87; Thu, 29 Feb 2024 08:34:45 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B5B875025C for ; Thu, 29 Feb 2024 08:34:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709195684; cv=none; b=bP/hbScbOp1nx/CuaNzs0+PZmZ0fuEKckXrONvz0W8TXb+EWOMqNtIvvawMMnN8zp+ftMRhLxJ8uJeAl3FTQJqNmUKAOtLzaGq6Eu+TA04K3TsuxYC8bIGIPIDN9+JGeTSWwO48Z25WSenU21wPVfUFXybnUD5WJyjT9THkd/cw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709195684; c=relaxed/simple; bh=dAYAj7SZmUmbdaksmAoUcV11I0Mcv8AU0oakyneZ/M0=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=a0pQzCA3KuJU73hvr3jyfdc5c6lGbmdd1lC5dEPeZUbVBGSSSMBEErDXg6lGNM4VwSgNBEULj58qpOn/ZybDbuZTPxSJRpPYWAJICX6Jp+Hqq+C0in8wva9ZtnixXgra06uDQxIfXzFUszuYzLjZZ5rFHJX1PIrqHaomsXIvH5c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 686681FB; Thu, 29 Feb 2024 00:35:19 -0800 (PST) Received: from a077893.arm.com (unknown [10.163.47.238]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 005BF3F6C4; Thu, 29 Feb 2024 00:34:37 -0800 (PST) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com Cc: Anshuman Khandual , Will Deacon , Mark Rutland , linux-kernel@vger.kernel.org, Mark Brown Subject: [PATCH V2] arm64/hw_breakpoint: Directly use ESR_ELx_WNR for an watchpoint exception Date: Thu, 29 Feb 2024 14:04:31 +0530 Message-Id: <20240229083431.356578-1-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Let's use existing ISS encoding for an watchpoint exception i.e ESR_ELx_WNR This represents an instruction's either writing to or reading from a memory location during an watchpoint exception. While here this drops non-standard macro AARCH64_ESR_ACCESS_MASK. Cc: Catalin Marinas Cc: Will Deacon Cc: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Reviewed-by: Mark Brown Signed-off-by: Anshuman Khandual --- This applies on v6.8-rc5 Changes in V2: - Dropped new ISS encoding details ESR_ELx_WnR and ESR_ELx_WnR_SHIFT - Directly used existing ESR_ELx_WNR per Catalin - Updated the commit message as required Changes in V1: https://lore.kernel.org/all/20240223094615.3977323-1-anshuman.khandual@arm.com/ arch/arm64/include/asm/hw_breakpoint.h | 1 - arch/arm64/kernel/hw_breakpoint.c | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/hw_breakpoint.h b/arch/arm64/include/asm/hw_breakpoint.h index 84055329cd8b..bd81cf17744a 100644 --- a/arch/arm64/include/asm/hw_breakpoint.h +++ b/arch/arm64/include/asm/hw_breakpoint.h @@ -59,7 +59,6 @@ static inline void decode_ctrl_reg(u32 reg, /* Watchpoints */ #define ARM_BREAKPOINT_LOAD 1 #define ARM_BREAKPOINT_STORE 2 -#define AARCH64_ESR_ACCESS_MASK (1 << 6) /* Lengths */ #define ARM_BREAKPOINT_LEN_1 0x1 diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c index 35225632d70a..2f5755192c2b 100644 --- a/arch/arm64/kernel/hw_breakpoint.c +++ b/arch/arm64/kernel/hw_breakpoint.c @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -779,7 +780,7 @@ static int watchpoint_handler(unsigned long addr, unsigned long esr, * Check that the access type matches. * 0 => load, otherwise => store */ - access = (esr & AARCH64_ESR_ACCESS_MASK) ? HW_BREAKPOINT_W : + access = (esr & ESR_ELx_WNR) ? HW_BREAKPOINT_W : HW_BREAKPOINT_R; if (!(access & hw_breakpoint_type(wp))) continue; -- 2.25.1