Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp408893ybh; Mon, 20 Jul 2020 20:59:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtsoR030SYQn4YF/r01B9S/BJeBjzNzu/3Z6BlxfiOSdAjyu+WQBILvpJbaHEqejFiZcgY X-Received: by 2002:a17:906:27c9:: with SMTP id k9mr22936189ejc.74.1595303988260; Mon, 20 Jul 2020 20:59:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595303988; cv=none; d=google.com; s=arc-20160816; b=kTrkFrJUsMSTzf9yvnlB476FJCEbECOpax8gKKhs73KRQHt6dDAA0tHa9bXuf4jfiY VxVSFW5TZUZkMbIkH6hwSH8RwRm6qqJksfNCO85mwP3tz/Hd5qOdJgwlOK3IxhmaAAkS We00W/xJ/VDQFg2acXGmfbq8nZk8tcysT0VEQBZWf/TPunoHtBJmGE8MZ7O/fBRfGQ2w 94L1Z/rSVMDDcPJvfyohIwRvvmOwYN/Nud4QqjIxgyLjhgA6qkUH8oWQf/k+nCeaiuPz bE08F8c8qwMhLrxxk9vUg/92D6TlQzTE8pFT6g20jyaeOqQmOBAvKm3XPbsXezEKGKEN 6Kcg== 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=zlt5gdHyH5hHBBbzL6+rFC/mlBWeaMJ8n05xyc7mN4s=; b=r5aro4qQws/5P87j8Rp2IJh1HCdUflyXNNEWlioPwqSSNqrhgQtEMoDi9srAe3Cah7 P3st0bOE/fq4ySGn6zSEz0nnD4/9HxHQtqjZOv/4gX4rYb6HKNhW00MReK6fpfiNkYmU y3noX3y2meS+UXWN+UVXf/yTUS2WMM6DbR7SDK58O9hMVIHJUi/Y/jIJMfbI2BQ42spF uxDIdOdrlkvTGzcFst/jFIKfJqMbscfBFf5kAUjXylMOCub6PKHH+LPvE9KNupqlsP05 l2uFuR8oEuvAOnL/D7YRNw+099UtAWl2o8w5aDNoIrYoy3VvMnigxq+yQclZQm3TsSQ7 p1qQ== 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 l6si12110630edq.465.2020.07.20.20.59.23; Mon, 20 Jul 2020 20:59:48 -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 S1726945AbgGUD6O (ORCPT + 99 others); Mon, 20 Jul 2020 23:58:14 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:20104 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726089AbgGUD6N (ORCPT ); Mon, 20 Jul 2020 23:58:13 -0400 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06L3W2PF088512; Mon, 20 Jul 2020 23:57:47 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 32d91us242-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Jul 2020 23:57:47 -0400 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 06L3YMmJ094633; Mon, 20 Jul 2020 23:57:46 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 32d91us23p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Jul 2020 23:57:46 -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 06L3ojhX002974; Tue, 21 Jul 2020 03:57:44 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma04ams.nl.ibm.com with ESMTP id 32brq83d9d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 Jul 2020 03:57:44 +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 06L3uIDm62456124 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 Jul 2020 03:56:18 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E37F6AE045; Tue, 21 Jul 2020 03:57:41 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 84FB4AE051; Tue, 21 Jul 2020 03:57:38 +0000 (GMT) Received: from [9.199.47.202] (unknown [9.199.47.202]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 21 Jul 2020 03:57:38 +0000 (GMT) Subject: Re: [PATCH v4 09/10] powerpc/watchpoint: Return available watchpoints dynamically To: Jordan Niethe Cc: Michael Ellerman , 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> From: Ravi Bangoria Message-ID: Date: Tue, 21 Jul 2020 09:27:37 +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: 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-20_19:2020-07-20,2020-07-20 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 malwarescore=0 spamscore=0 priorityscore=1501 impostorscore=0 mlxscore=0 bulkscore=0 lowpriorityscore=0 adultscore=0 suspectscore=0 clxscore=1015 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007210020 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. >> >> #endif /* !__ASSEMBLY__ */ >> >> diff --git a/arch/powerpc/include/asm/hw_breakpoint.h b/arch/powerpc/include/asm/hw_breakpoint.h >> index cb424799da0d..d4eab1694bcd 100644 >> --- a/arch/powerpc/include/asm/hw_breakpoint.h >> +++ b/arch/powerpc/include/asm/hw_breakpoint.h >> @@ -5,10 +5,11 @@ >> * Copyright 2010, IBM Corporation. >> * Author: K.Prasad >> */ >> - > Was removing this line deliberate? Nah. Will remove that hunk. >> #ifndef _PPC_BOOK3S_64_HW_BREAKPOINT_H >> #define _PPC_BOOK3S_64_HW_BREAKPOINT_H >> >> +#include >> + >> #ifdef __KERNEL__ >> struct arch_hw_breakpoint { >> unsigned long address; >> @@ -46,7 +47,7 @@ struct arch_hw_breakpoint { >> >> static inline int nr_wp_slots(void) >> { >> - return HBP_NUM_MAX; >> + return cpu_has_feature(CPU_FTR_DAWR1) ? HBP_NUM_TWO : HBP_NUM_ONE; > So it'd be something like: > + return cpu_has_feature(CPU_FTR_DAWR1) ? HBP_NUM_MAX : 1; > But thinking that there might be more slots added in the future, it > may be better to make the number of slots a variable that is set > during the init and then have this function return that. Not sure I follow. What do you mean by setting number of slots a variable that is set during the init? Thanks, Ravi