Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp241183ybt; Tue, 7 Jul 2020 21:52:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzojjm1LHwRyd7vFlds3Lmo5W2G2tDDQtvLr2LOD0qkbi6BlCrXBTOXUl4EzyvPEO0gvsFO X-Received: by 2002:a17:906:b0d5:: with SMTP id bk21mr11665777ejb.93.1594183940130; Tue, 07 Jul 2020 21:52:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594183940; cv=none; d=google.com; s=arc-20160816; b=dOfxk5tXVYl1xrPFlo4qOvUwBmJFPyizUWdsA41gViizYCO8SHtCuj3qtDjben9NBX D00UkYQQXXdESwi1mHih0Npc/L/+eVPTIqTuVIr8UQrK6q3INmPKroKOgUkVs7oLhEKQ xuOqhuExQvg+e/Z8SCDpyMu39CDRqt1g9JI1AjKQ87Nhb34e6GUCZ/xeVKn+pS63MYvl czFiA35jyumcSqDRXMh2U1Qv4ZLDwJabWpWDW6O/THAWcaDYU67MFNI1cJDZdINiRh+k pxVzvdMcmaiQfnYDo5KnQZ/QuV5mpte27huyGyjv493wr0mj0LMnCog0cJGcNLB147L9 A6TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=6JqrDHW9ed1Cgw6ac2CqLIDij4qYUBfs2DpwZAXRkPY=; b=K9kBvg44Bki51LwDl67/zSDaz8qLA+j2w7CJQn6wJXUNeRJFyk/6oDGchjBI4SgSkN O3y2zyNamsQu+Cvoit6KEOPdatFPdFCjfThGT6N4gRuMlMgOT7yfCQNTr1JcRFNVFdTG LbHI6D2AYSz+/sy7Lxv+eFZsl7csLjfvJolzgTa7ktelmEWTFkJGAZe/Jh/NFJOyE753 Tq9mQJCapGdDWhEHySEg84TjLi16yeb0YQLiNjpX3MZ1mr1LLmdE/zCg/06WZt6W360L MIHy32+U0c++dd+XGsv2Cak88KC45fbIYTkjcLk9lvH086/+zQPVSXYHWaRP30GuWswW 7RgQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b12si15804484eds.283.2020.07.07.21.51.57; Tue, 07 Jul 2020 21:52:20 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729499AbgGHEvl (ORCPT + 99 others); Wed, 8 Jul 2020 00:51:41 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:61170 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725903AbgGHEvj (ORCPT ); Wed, 8 Jul 2020 00:51:39 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0684DRS3043643; Wed, 8 Jul 2020 00:51:06 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3256x50nm7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Jul 2020 00:51:06 -0400 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 0684X57O095394; Wed, 8 Jul 2020 00:51:06 -0400 Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 3256x50nks-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Jul 2020 00:51:05 -0400 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0684jLjv007266; Wed, 8 Jul 2020 04:51:04 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma04fra.de.ibm.com with ESMTP id 3251dw04d1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Jul 2020 04:51:04 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0684nd9c57934322 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 Jul 2020 04:49:39 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1851BAE058; Wed, 8 Jul 2020 04:51:01 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F1B02AE04D; Wed, 8 Jul 2020 04:50:56 +0000 (GMT) Received: from bangoria.ibmuc.com (unknown [9.199.51.84]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 8 Jul 2020 04:50:56 +0000 (GMT) From: Ravi Bangoria To: mpe@ellerman.id.au, mikey@neuling.org Cc: ravi.bangoria@linux.ibm.com, apopple@linux.ibm.com, paulus@samba.org, npiggin@gmail.com, christophe.leroy@c-s.fr, naveen.n.rao@linux.vnet.ibm.com, peterz@infradead.org, jolsa@kernel.org, oleg@redhat.com, fweisbec@gmail.com, mingo@kernel.org, pedromfc@br.ibm.com, miltonm@us.ibm.com, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/9] powerpc/watchpoint: Fix 512 byte boundary limit Date: Wed, 8 Jul 2020 10:20:38 +0530 Message-Id: <20200708045046.135702-2-ravi.bangoria@linux.ibm.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200708045046.135702-1-ravi.bangoria@linux.ibm.com> References: <20200708045046.135702-1-ravi.bangoria@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-07-08_01:2020-07-08,2020-07-08 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 spamscore=0 cotscore=-2147483648 adultscore=0 phishscore=0 impostorscore=0 clxscore=1015 mlxlogscore=999 bulkscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2007080024 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Milton Miller reported that we are aligning start and end address to wrong size SZ_512M. It should be SZ_512. Fix that. While doing this change I also found a case where ALIGN() comparison fails. Within a given aligned range, ALIGN() of two addresses does not match when start address is pointing to the first byte and end address is pointing to any other byte except the first one. But that's not true for ALIGN_DOWN(). ALIGN_DOWN() of any two addresses within that range will always point to the first byte. So use ALIGN_DOWN() instead of ALIGN(). Fixes: e68ef121c1f4 ("powerpc/watchpoint: Use builtin ALIGN*() macros") Reported-by: Milton Miller Signed-off-by: Ravi Bangoria --- arch/powerpc/kernel/hw_breakpoint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/hw_breakpoint.c b/arch/powerpc/kernel/hw_breakpoint.c index 0000daf0e1da..031e6defc08e 100644 --- a/arch/powerpc/kernel/hw_breakpoint.c +++ b/arch/powerpc/kernel/hw_breakpoint.c @@ -419,7 +419,7 @@ static int hw_breakpoint_validate_len(struct arch_hw_breakpoint *hw) if (dawr_enabled()) { max_len = DAWR_MAX_LEN; /* DAWR region can't cross 512 bytes boundary */ - if (ALIGN(start_addr, SZ_512M) != ALIGN(end_addr - 1, SZ_512M)) + if (ALIGN_DOWN(start_addr, SZ_512) != ALIGN_DOWN(end_addr - 1, SZ_512)) return -EINVAL; } else if (IS_ENABLED(CONFIG_PPC_8xx)) { /* 8xx can setup a range without limitation */ -- 2.26.2