Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp992060ybg; Wed, 3 Jun 2020 20:38:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxiwmRBY2H/IwlcauANGc3G6RjsAExc/3VRF9jto+pPn0tyVrUAWUIplqlVr4r9nD1dVMpg X-Received: by 2002:a17:906:695a:: with SMTP id c26mr2250350ejs.214.1591241897771; Wed, 03 Jun 2020 20:38:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591241897; cv=none; d=google.com; s=arc-20160816; b=vfAwcdwfEY0lnT99ytf4YpHUQZc1l9TTxFD8dYcFDPOjwh9WU4N71TIIoJtPKQPJt/ V9SCGcg7CgliGBAXzu1M3yiJu+w4soSEwJgJawT9SXNGc3QqLApAEUidw4k2ywjT8+nD X20urwOMbH+XiPE2SqogQw9NXWgiGwykU+5NhAsq2nWNrVIZ53hhvYjfLphNgl76VHma P35CgaYykA2AOH6e4NMPhS7Fe3Vtm4isquHtZk1b+rzPFwZiyRAQY21zs0ZVVjgqaGB/ GCzv2jIIMv/qLAHr+ayV6/TmA0nLr+JV8BRN3kv59N7JGK/gKed6mudzrmyqSDaJRi+8 L9Sw== 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=Ps1mGt9Gx2LDDg3wQoKIEnKUSshTl7dzUCsEVjUP6x0=; b=Km+SucCuA2IYCNVLfPzO5x8Cz2xFdIujAwcPxuE/kIV1CPkZ6AiO3En2zIIQT1+6YO dTMv9yHkNFmqDZ8rZc9vNM0Df5JVOnmeGrRqaUKJAtYqhvJLbF77vbr1YjPxDWOD2Qwu +iaRggMuqmeYdLPPXilaLMkEc1qrMAeIHX3y4nWSZegGE22Oi0pgJsEE1Be+XkjsIYuf At26oZ5VTICOq/LHGwJ6r5L4YIj4q2n7Zn/Ld0vICzpzxOhpUl/Kvxy+mNM0qCxvd97V voZCbgS/i6CTndhvYv0GXTLAnUzXBoouWs9SxRYJat17crM3tx55FZ/cCT+dRxi+YO/N 9D2Q== 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 o60si1068488edd.190.2020.06.03.20.37.55; Wed, 03 Jun 2020 20:38:17 -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 S1726793AbgFDDfm (ORCPT + 99 others); Wed, 3 Jun 2020 23:35:42 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:28954 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726047AbgFDDfm (ORCPT ); Wed, 3 Jun 2020 23:35:42 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 05432ebJ144782; Wed, 3 Jun 2020 23:35:12 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 31ek4s14df-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 03 Jun 2020 23:35:12 -0400 Received: from m0098414.ppops.net (m0098414.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 054356QP151286; Wed, 3 Jun 2020 23:35:11 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 31ek4s14cy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 03 Jun 2020 23:35:11 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0543QNOm014509; Thu, 4 Jun 2020 03:35:10 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma04ams.nl.ibm.com with ESMTP id 31bf4816kq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 04 Jun 2020 03:35:09 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0543Z7NO44302428 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 4 Jun 2020 03:35:07 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 02D0611C066; Thu, 4 Jun 2020 03:35:07 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6760D11C04A; Thu, 4 Jun 2020 03:35:03 +0000 (GMT) Received: from bangoria.ibmuc.com (unknown [9.199.58.254]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 4 Jun 2020 03:35:03 +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, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/8] powerpc/watchpoint: Fix 512 byte boundary limit Date: Thu, 4 Jun 2020 09:04:36 +0530 Message-Id: <20200604033443.70591-2-ravi.bangoria@linux.ibm.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200604033443.70591-1-ravi.bangoria@linux.ibm.com> References: <20200604033443.70591-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.216,18.0.687 definitions=2020-06-03_13:2020-06-02,2020-06-03 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 mlxscore=0 phishscore=0 suspectscore=0 spamscore=0 cotscore=-2147483648 clxscore=1015 bulkscore=0 mlxlogscore=999 impostorscore=0 lowpriorityscore=0 priorityscore=1501 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006040017 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Milton 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