Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp727616ybh; Tue, 21 Jul 2020 06:34:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybQZaVUXsCbJ4ir65bn7cX/aGEGztYLYH6gwXGlToTec6Q5J6ZyLqjhdkfn8kzWflCdoHM X-Received: by 2002:aa7:dd05:: with SMTP id i5mr26260307edv.283.1595338487873; Tue, 21 Jul 2020 06:34:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595338487; cv=none; d=google.com; s=arc-20160816; b=e6w+vSn2FYoJ2mYgAGULpiD6/CvxbHfFevjgVNlmGyDvvMWPbmVsoPR+Z9cY5uX4cI 4yn84ITzKNQ7raw6BnRRfLcAox8IHfo8ijVaN3JyjpEq+/7w/wd6dzJ9PnEcl798/r5w kLObQnQ0EnkpX8WzyaK0tvau2ShGvCP8Bbjrfrp6QXk8hSGYDk8e0itAoMQ98yZwmKN5 k3YX2FZVpy+DViah/y6XGbJbMSBj28uVkXNqciuxsHUazMMdTnaVUpY/bLEZxBl0KKLm h5TMkQrncerX2u7pIV5w2bSlTpqmcTfLmimcnDQ8JL/RIL8/EG2egWmowSAdQ2+LIUQx PzMQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=L9ubVvdswXiy7TS/kF6ORlB0dw+MJD3N6o9ccK5kAXw=; b=WdZEvl25LQbag+bztPDFFHCJ0M/sxUKD8gyQxZ4MxLnaHRBNgA6IjGOTSkOzPIzOzm 2EegUOpEIHfCvkeJ7WYhMHwd0EqgV9cvUzVxMGMHG23CXICfnuMCtFPHzopkoNT9lkuL qKqbTKQudKLUzqm2jyqVABirvG1bbjWV7f8GvdSOcKrH2puye5fXWLc3EAyjjZHl7E87 +v6bZ9susxtrGfrVJNPKjR+TqSfxx3OrkQiiqN9adFLbYoG7UhS4Jgvbvtw/I+i8Sq5L 3WSbdWxL2ZGIH0iKC9BCBlQZz+q/uH8GgXM6Yx7E7YhZSpkzysAhPPRvdl572pPzNGky vEag== 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 n20si11714637ejs.158.2020.07.21.06.34.24; Tue, 21 Jul 2020 06:34:47 -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 S1726919AbgGUNdq (ORCPT + 99 others); Tue, 21 Jul 2020 09:33:46 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:57820 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726506AbgGUNdq (ORCPT ); Tue, 21 Jul 2020 09:33:46 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06LDWKmR091526; Tue, 21 Jul 2020 09:33:16 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 32d5h5t7bt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 Jul 2020 09:33:16 -0400 Received: from m0098416.ppops.net (m0098416.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 06LDWLko091576; Tue, 21 Jul 2020 09:33:14 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 32d5h5t7aw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 Jul 2020 09:33:14 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 06LDV9nw005318; Tue, 21 Jul 2020 13:33:12 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma03ams.nl.ibm.com with ESMTP id 32brq7kxat-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 Jul 2020 13:33:12 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 06LDX95K16843144 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 Jul 2020 13:33:09 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 96ECBAE045; Tue, 21 Jul 2020 13:33:09 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 78BA4AE053; Tue, 21 Jul 2020 13:33:05 +0000 (GMT) Received: from [9.199.35.129] (unknown [9.199.35.129]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 21 Jul 2020 13:33:05 +0000 (GMT) Subject: Re: [PATCH v4 09/10] powerpc/watchpoint: Return available watchpoints dynamically To: Michael Ellerman Cc: Jordan Niethe , mikey@neuling.org, apopple@linux.ibm.com, Paul Mackerras , Nicholas Piggin , Christophe Leroy , 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, Ravi Bangoria References: <20200717040958.70561-1-ravi.bangoria@linux.ibm.com> <20200717040958.70561-10-ravi.bangoria@linux.ibm.com> <87k0yxrtex.fsf@mpe.ellerman.id.au> From: Ravi Bangoria Message-ID: Date: Tue, 21 Jul 2020 19:03:04 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <87k0yxrtex.fsf@mpe.ellerman.id.au> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-07-21_08:2020-07-21,2020-07-21 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxlogscore=999 clxscore=1015 mlxscore=0 malwarescore=0 bulkscore=0 phishscore=0 impostorscore=0 adultscore=0 lowpriorityscore=0 priorityscore=1501 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007210094 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/21/20 5:06 PM, Michael Ellerman wrote: > Ravi Bangoria writes: >> On 7/20/20 9:12 AM, Jordan Niethe wrote: >>> On Fri, Jul 17, 2020 at 2:11 PM Ravi Bangoria >>> wrote: >>>> >>>> So far Book3S Powerpc supported only one watchpoint. Power10 is >>>> introducing 2nd DAWR. Enable 2nd DAWR support for Power10. >>>> Availability of 2nd DAWR will depend on CPU_FTR_DAWR1. >>>> >>>> Signed-off-by: Ravi Bangoria >>>> --- >>>> arch/powerpc/include/asm/cputable.h | 4 +++- >>>> arch/powerpc/include/asm/hw_breakpoint.h | 5 +++-- >>>> 2 files changed, 6 insertions(+), 3 deletions(-) >>>> >>>> diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h >>>> index 3445c86e1f6f..36a0851a7a9b 100644 >>>> --- a/arch/powerpc/include/asm/cputable.h >>>> +++ b/arch/powerpc/include/asm/cputable.h >>>> @@ -633,7 +633,9 @@ enum { >>>> * Maximum number of hw breakpoint supported on powerpc. Number of >>>> * breakpoints supported by actual hw might be less than this. >>>> */ >>>> -#define HBP_NUM_MAX 1 >>>> +#define HBP_NUM_MAX 2 >>>> +#define HBP_NUM_ONE 1 >>>> +#define HBP_NUM_TWO 2 > >>> I wonder if these defines are necessary - has it any advantage over >>> just using the literal? >> >> No, not really. Initially I had something like: >> >> #define HBP_NUM_MAX 2 >> #define HBP_NUM_P8_P9 1 >> #define HBP_NUM_P10 2 >> >> But then I thought it's also not right. So I made it _ONE and _TWO. >> Now the function that decides nr watchpoints dynamically (nr_wp_slots) >> is in different file, I thought to keep it like this so it would be >> easier to figure out why _MAX is 2. > > I don't think it makes anything clearer. > > I had to stare at it thinking there was some sort of mapping or > indirection going on, before I realised it's just literally the number > of breakpoints. > > So please just do: > > static inline int nr_wp_slots(void) > { > return cpu_has_feature(CPU_FTR_DAWR1) ? 2 : 1; > } > > If you think HBP_NUM_MAX needs explanation then do that with a comment, > it can refer to nr_wp_slots() if that's helpful. Agreed. By adding a comment, we can remove those macros. Will change it. Thanks, Ravi