Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp752517ybh; Tue, 21 Jul 2020 07:10:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4QLLEOx+ZdFCPRNq5aFrxmYuHKLROhzFj4OCP2r0rZxNwOWnsrf4SBiw7rsANuJ8S+u11 X-Received: by 2002:a17:906:38da:: with SMTP id r26mr24616407ejd.120.1595340605883; Tue, 21 Jul 2020 07:10:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595340605; cv=none; d=google.com; s=arc-20160816; b=mSc2OCziqbnldFzLVGx4CupArmnKQVnLC68ZBWFS9YkI+2T9SxQR2KVkOAZGVsNcvF MnQDupIvZIcZompzMML+Y4NtpxnFXzAZUjMz17KIgs7hYhX+bV/Gv3VO3hfmt1JUcfhb wXg5YyxCEcMy1V97ZTFDXwsHgpgBqW0YHAfjQf+KQt68auZFy1TZOG+X3rgeWnoz8RmC oHgtw7SrhJKboH+AnxNiE7JW1ArZjrtHt64tGoffm9SVv0r6Ufg/60BcrUEqy0hSs0vL Wyk9E28oDt04uBtfiBgoewNl80q3SoQ5CKgFygqNrTtxlyCyR1+McTClIJpEa+nOXJTZ 6kdA== 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=/wirsqlf12Y8Oz1JHVf+wCBDVdzuKKqvFzsRxSSydSo=; b=T3C2mtVSm2Sfh6AiMGsHDLeAkREzYwtuJs1vOQ66HD2NWuWFX3mOV2a/qNvflqLNbN 9k59g3woGpAHkS+ALH9tadfpPogF8B3pZTug5WBv7zUpnJBv+GlaFVR31w0EYFrp0a1D 6sPHDn9B0qiYgY1bvziscVZDMQIdtD4ZJsWT1dIYrenZLTnc4DC5pf0hI1GwTmAYZt6N LA4V3tT/qYH2c6fnFyXxu8Tj1cqGkLWs/XK9vFDx17bA/aKh72+CknkYZjs5zz0ACsbE Xba9FO4tCSu7HlTkYpI9veh6Woz2k9ghe21t/4P8KvXcI0mqU8H5EMJi6ckoQ4vPNV62 OGEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=SaAY7VXP; 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 qx22si12222394ejb.148.2020.07.21.07.09.41; Tue, 21 Jul 2020 07:10:05 -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=SaAY7VXP; 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 S1726700AbgGUOHW (ORCPT + 99 others); Tue, 21 Jul 2020 10:07:22 -0400 Received: from ozlabs.org ([203.11.71.1]:49901 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726120AbgGUOHW (ORCPT ); Tue, 21 Jul 2020 10:07:22 -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 4BB0ll6WTvz9sPB; Wed, 22 Jul 2020 00:07:15 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ellerman.id.au; s=201909; t=1595340439; bh=pEIZzV48lY9oMztWrQ5y0yoN1x11b53snuVDYzGP9yQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=SaAY7VXP+8gsFiGhyvEZfA+oRA9StiLhZfuy+2pKRVNobM60s5ZrvgssW4zf9X62a MZVWmqNQd3ogXkhQzVYT2D6VyVqWKDqOTPUqeXt46kCvuhO/J2IMGdZCQAUUqN0SIL 4dfQwOKoWzFqHPbN+FBeidh2+nu4W84rUbGweXJpIruRz3B4B0YQrtTDgf479Rar/y Viw/52UZYPrBmgsgdov8KvZxHChLO16wRqgypswzCaGIaVwaE290Pt0mbM8PutKM3/ Xb8erB7zonG4Bzma/IFDuaXKb0iPg7coE2wqu+/YiWJI8VuHLFsB4OK2ql0qU6+xD9 nx9GykCYcRn6A== 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 05/10] powerpc/dt_cpu_ftrs: Add feature for 2nd DAWR In-Reply-To: <62daa2d1-4e11-dcc1-cb1d-805ee4a156e0@linux.ibm.com> References: <20200717040958.70561-1-ravi.bangoria@linux.ibm.com> <20200717040958.70561-6-ravi.bangoria@linux.ibm.com> <87mu3trtri.fsf@mpe.ellerman.id.au> <62daa2d1-4e11-dcc1-cb1d-805ee4a156e0@linux.ibm.com> Date: Wed, 22 Jul 2020 00:07:15 +1000 Message-ID: <87d04prmgc.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/21/20 4:59 PM, Michael Ellerman wrote: >> Ravi Bangoria writes: >>> On 7/17/20 11:14 AM, Jordan Niethe wrote: >>>> On Fri, Jul 17, 2020 at 2:10 PM Ravi Bangoria >>>> wrote: >>>>> >>>>> Add new device-tree feature for 2nd DAWR. If this feature is present, >>>>> 2nd DAWR is supported, otherwise not. >>>>> >>>>> Signed-off-by: Ravi Bangoria >>>>> --- >>>>> arch/powerpc/include/asm/cputable.h | 7 +++++-- >>>>> arch/powerpc/kernel/dt_cpu_ftrs.c | 7 +++++++ >>>>> 2 files changed, 12 insertions(+), 2 deletions(-) >>>>> >>>>> diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h >>>>> index e506d429b1af..3445c86e1f6f 100644 >>>>> --- a/arch/powerpc/include/asm/cputable.h >>>>> +++ b/arch/powerpc/include/asm/cputable.h >>>>> @@ -214,6 +214,7 @@ static inline void cpu_feature_keys_init(void) { } >>>>> #define CPU_FTR_P9_TLBIE_ERAT_BUG LONG_ASM_CONST(0x0001000000000000) >>>>> #define CPU_FTR_P9_RADIX_PREFETCH_BUG LONG_ASM_CONST(0x0002000000000000) >>>>> #define CPU_FTR_ARCH_31 LONG_ASM_CONST(0x0004000000000000) >>>>> +#define CPU_FTR_DAWR1 LONG_ASM_CONST(0x0008000000000000) >>>>> >>>>> #ifndef __ASSEMBLY__ >>>>> >>>>> @@ -497,14 +498,16 @@ static inline void cpu_feature_keys_init(void) { } >>>>> #define CPU_FTRS_POSSIBLE \ >>>>> (CPU_FTRS_POWER7 | CPU_FTRS_POWER8E | CPU_FTRS_POWER8 | \ >>>>> CPU_FTR_ALTIVEC_COMP | CPU_FTR_VSX_COMP | CPU_FTRS_POWER9 | \ >>>>> - CPU_FTRS_POWER9_DD2_1 | CPU_FTRS_POWER9_DD2_2 | CPU_FTRS_POWER10) >>>>> + CPU_FTRS_POWER9_DD2_1 | CPU_FTRS_POWER9_DD2_2 | CPU_FTRS_POWER10 | \ >>>>> + CPU_FTR_DAWR1) >>>>> #else >>>>> #define CPU_FTRS_POSSIBLE \ >>>>> (CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | \ >>>>> CPU_FTRS_POWER6 | CPU_FTRS_POWER7 | CPU_FTRS_POWER8E | \ >>>>> CPU_FTRS_POWER8 | CPU_FTRS_CELL | CPU_FTRS_PA6T | \ >>>>> CPU_FTR_VSX_COMP | CPU_FTR_ALTIVEC_COMP | CPU_FTRS_POWER9 | \ >>>>> - CPU_FTRS_POWER9_DD2_1 | CPU_FTRS_POWER9_DD2_2 | CPU_FTRS_POWER10) >>>>> + CPU_FTRS_POWER9_DD2_1 | CPU_FTRS_POWER9_DD2_2 | CPU_FTRS_POWER10 | \ >>>>> + CPU_FTR_DAWR1) >> >>>> Instead of putting CPU_FTR_DAWR1 into CPU_FTRS_POSSIBLE should it go >>>> into CPU_FTRS_POWER10? >>>> Then it will be picked up by CPU_FTRS_POSSIBLE. >>> >>> I remember a discussion about this with Mikey and we decided to do it >>> this way. Obviously, the purpose is to make CPU_FTR_DAWR1 independent of >>> CPU_FTRS_POWER10 because DAWR1 is an optional feature in p10. I fear >>> including CPU_FTR_DAWR1 in CPU_FTRS_POWER10 can make it forcefully enabled >>> even when device-tree property is not present or pa-feature bit it not set, >>> because we do: >>> >>> { /* 3.1-compliant processor, i.e. Power10 "architected" mode */ >>> .pvr_mask = 0xffffffff, >>> .pvr_value = 0x0f000006, >>> .cpu_name = "POWER10 (architected)", >>> .cpu_features = CPU_FTRS_POWER10, >> >> The pa-features logic will turn it off if the feature bit is not set. >> >> So you should be able to put it in CPU_FTRS_POWER10. >> >> See for example CPU_FTR_NOEXECUTE. > > Ah ok. scan_features() clears the feature if the bit is not set in > pa-features. So it should work find for powervm. I'll verify the same > thing happens in case of baremetal where we use cpu-features not > pa-features. If it works in baremetal as well, will put it in > CPU_FTRS_POWER10. When we use DT CPU features we don't use CPU_FTRS_POWER10 at all. We construct a cpu_spec from scratch with just the base set of features: static struct cpu_spec __initdata base_cpu_spec = { .cpu_name = NULL, .cpu_features = CPU_FTRS_DT_CPU_BASE, And then individual features are enabled via the device tree flags. cheers