Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp646397ybh; Tue, 21 Jul 2020 04:38:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCjl6SCQSFXH4EebvWiETrJ64J03NtF3UZtk7h2OjhfoCqsBQnvelYVG/NeISHXYXI7pEG X-Received: by 2002:a17:906:3b01:: with SMTP id g1mr26155527ejf.353.1595331496246; Tue, 21 Jul 2020 04:38:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595331496; cv=none; d=google.com; s=arc-20160816; b=XCQBtgq8OUSoK+yAtO/sWEhqp7+qpC6S2fkq3dhJWSug10lkJcwz4vHtHdPhlzE6KU CozcyqZ4ljH/XkoZtiA93WpHMi0K385yD1QTUjjObCPirM0GdNDG53FonnV2/AH4ovTf eZ+ocAYOPtvgPrTBfXk+M3Cfg6SUtSl5CDDRRQSHMExcYsopTDbxfQamp4BBnNyBYcv6 3hhEQjbGjV72w//y/Rs5ow/vGTkldZ2qLZ3pxNVgZZjrnZqyvjutbq1RUDAdbowDzEIO 8BM+hSeCW3qjPFIuG+2VizRain+X94bkvEP46IdhPnJubHbvf/3RWeu5UG8jrM4KWbYa FWxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=AirAXslKidWQB0tI77iLcdU/j2pzspYoK6SDwc38c+k=; b=NPCDAurxSaYMC4r11FuzmLipk6CIjTOSVXTxKFqmPkw3N8XkbvCaf6V9hNk/iE3YpH q/okvsnSAFDeWv8T/In+rNGMqqELx1snzmLNiTGtZeZktnJCC1XtesCB47jivWixAMSx ahQoBjksVrF4GprARvJk8T4xQGPNUkzSmm5tQ8KdtgHkMegIdm6YXAE3V4L3bZ72GQKs ebhnw9SKYcXNNCtXGLcpUfvZpzt1H4AL0WPXScKul3vujVoaZ83Qr1F/o8koeYxd5kOK 8UqYsCcc12xYd7b7tv/3wh6OlNSKzqfneGGcyTFSpTwYXtwy/eBav/HEy2t09+hLDasl sKog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=JyhmLykP; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i25si731755edy.316.2020.07.21.04.37.53; Tue, 21 Jul 2020 04:38:16 -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; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=JyhmLykP; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729629AbgGULg5 (ORCPT + 99 others); Tue, 21 Jul 2020 07:36:57 -0400 Received: from ozlabs.org ([203.11.71.1]:38021 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727106AbgGULg4 (ORCPT ); Tue, 21 Jul 2020 07:36:56 -0400 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4B9xQH045Xz9sSJ; Tue, 21 Jul 2020 21:36:54 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ellerman.id.au; s=201909; t=1595331415; bh=8cWqEZ7b8BkO4Lc0Yw9kRlVs08QZ7978e9X0CuvOH3I=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=JyhmLykPfuVbCmNgLwFSzcomuXhpdEJTpqJ7z3tXJaJxIOnZheJmHY0gNc6ljONpf cWMncIFEKRaAuy9NXF8JOniiQPI/xhDLFO+9Ax0KCPFBLjqRf8NwaexBpxte9A0cuO OXhqY7VsIdhf1+ipTE9Vg2FayfKkcH/5ln1pjPAdm8TudEONBAezMcRR7wxrmuryG4 dYAfSi4ZD+YZXmzfcgEPhyhpOGJWHWSv5Kfr+CCW9VTypwW9rTiGimSVyokaM+/onJ 3mYDfMsC8liIOPX0svCn03YVxiDz4aP/76avkJ8BrxbNWSNbcSdXkbp+RS2HdljEsj F1BmP47NUh3kA== From: Michael Ellerman To: Ravi Bangoria , Jordan Niethe Cc: 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 Subject: Re: [PATCH v4 09/10] powerpc/watchpoint: Return available watchpoints dynamically In-Reply-To: References: <20200717040958.70561-1-ravi.bangoria@linux.ibm.com> <20200717040958.70561-10-ravi.bangoria@linux.ibm.com> Date: Tue, 21 Jul 2020 21:36:54 +1000 Message-ID: <87k0yxrtex.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. cheers