Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3886460rdg; Wed, 18 Oct 2023 08:42:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHldf2FzIcV2bHw4WAZqb3Q8aWXD6K/HbazvMhB2vZxurKUIlKh1Ds/YW0+OOXJGJVakd19 X-Received: by 2002:a05:6a00:290f:b0:68f:c1e0:a2c4 with SMTP id cg15-20020a056a00290f00b0068fc1e0a2c4mr7918267pfb.3.1697643744609; Wed, 18 Oct 2023 08:42:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697643744; cv=none; d=google.com; s=arc-20160816; b=kzLZnc9eCZDDdwDf1eSRgpwTHE3zkSu2UPt4PyympKokr64X2vv8W2fM6Ui67+cXJy 5UzRZC1zWLCh9KjXmZoefLT6+cPf/JcC+39s6qhg/6feEmXCkMBseUIKYm+xKJ5V3JJw M1OXUAywSeK5y9f1tCB/vCufr4DOHYmNp+0Sq4Pp/lc+7F4oratckanV6qtE1kv76pFP q5Nds/YsgnXSNdan7LVSrujpzNZim0aFnFn2PEOvCkqY0iofr1Hfym98zXcpF9moJ04W ACZ/XLhjAXQm04uu+LwUWFWjDOmc3JDhgMtHeUVzqpyL0o8yqZzoeGGAGW5bsp6HbS/K U3yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=yduaMw8XB6WiBdXYtfKs7nzS4qmAPIeifySsyC4goB4=; fh=L/rHdwTgP4uME76mIuGVJsqRhR85nL0NuQG/dwQJ4Ts=; b=P4h8VqCN0lj411zNve/Vtjzdg4mSfPJJqYMq+jNB6fgRvZqKxAu4nXi9YVvH2khQbp i1aF7KYTNiiju/Q8cDIIgXPl1LEZHGRs4MkKLzP2UlrRpY5NbffEyiRnmwaaL9C50AOF 2Vo9idlH67J6+H8wRBgWgfufJqpB9leMyD+dt7XiW/hrqchUcLfFiNSooKq6rJ0jkA8o hugaBlivm1zZeTKqeOEvV8dReJztcmRyWxCIkfaPGl/kpDzUxPNSoNmCvdLGDN7UyVYj OOCUWNkz0xee7aiiH8tCsLEnNe8b2dp6zh15auuXH4vDVxEA1HQJsmZyh53ohQloD+uz 197w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id p6-20020a056a000b4600b006be30258e50si4470978pfo.226.2023.10.18.08.42.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:42:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 1C76581E140D; Wed, 18 Oct 2023 08:42:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232360AbjJRPmJ (ORCPT + 99 others); Wed, 18 Oct 2023 11:42:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231958AbjJRPmI (ORCPT ); Wed, 18 Oct 2023 11:42:08 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3A6E5116 for ; Wed, 18 Oct 2023 08:42:06 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D05342F4; Wed, 18 Oct 2023 08:42:46 -0700 (PDT) Received: from [192.168.20.76] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DC8A03F64C; Wed, 18 Oct 2023 08:42:02 -0700 (PDT) Message-ID: <25ba377a-c590-1a1c-6be3-e268a6b300c9@arm.com> Date: Wed, 18 Oct 2023 10:42:01 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v2 3/3] arm64: cpufeature: Change 32-bit EL0 to display enabled cores Content-Language: en-US To: Marc Zyngier Cc: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com, anshuman.khandual@arm.com, krisman@suse.de, broonie@kernel.org, james.morse@arm.com, ionela.voinescu@arm.com, linux-kernel@vger.kernel.org References: <20231017052322.1211099-1-jeremy.linton@arm.com> <20231017052322.1211099-4-jeremy.linton@arm.com> <86ttqpm8lg.wl-maz@kernel.org> <86pm1cm780.wl-maz@kernel.org> From: Jeremy Linton In-Reply-To: <86pm1cm780.wl-maz@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.1 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 18 Oct 2023 08:42:21 -0700 (PDT) On 10/18/23 07:43, Marc Zyngier wrote: > On Tue, 17 Oct 2023 20:15:43 +0100, > Jeremy Linton wrote: >> >> Hi, >> >> On 10/17/23 13:01, Marc Zyngier wrote: >>> On Tue, 17 Oct 2023 06:23:22 +0100, >>> Jeremy Linton wrote: >>>> >>>> Now that we have the ability to display the list of cores >>>> with a feature when it is selectivly enabled, lets display the >>>> cores enabled for 32-bit use at EL0. >>>> >>>> Signed-off-by: Jeremy Linton >>>> --- >>>> arch/arm64/kernel/cpufeature.c | 15 +++++++++++++-- >>>> 1 file changed, 13 insertions(+), 2 deletions(-) >>>> >>>> diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c >>>> index b7b67bac0e60..512cbe446b41 100644 >>>> --- a/arch/arm64/kernel/cpufeature.c >>>> +++ b/arch/arm64/kernel/cpufeature.c >>>> @@ -1533,8 +1533,17 @@ static bool has_32bit_el0(const struct arm64_cpu_capabilities *entry, int scope) >>>> if (!has_cpuid_feature(entry, scope)) >>>> return allow_mismatched_32bit_el0; >>>> - if (scope == SCOPE_SYSTEM) >>>> - pr_info("detected: 32-bit EL0 Support\n"); >>>> + if (scope == SCOPE_SYSTEM) { >>>> + struct arm64_cpu_capabilities *has_32bit; >>>> + >>>> + has_32bit = (struct arm64_cpu_capabilities *)entry; >>>> + >>>> + has_32bit->cpus = system_32bit_el0_cpumask(); >>> >>> This seems rather dodgy. 'entry' comes from a static const array which >>> will, in all likelihood be mapped R/O pretty soon after the initial >>> CPU bringup. Try offlining/onlining a CPU and you should see a >>> firework similar to what I have below (I hacked the CnP property, but >>> that's no different from what you are doing): >> >> Yes, dodgy is a good word. The other choices, maintain a mask just for >> the print or dump the static key and always use the cpu_32bit_el0_mask >> or some combination, weren't much better in the "ick" category. If >> anyone sees a better way I'm open to suggestion, although simply >> dropping this last patch is fine too. > > An obvious choice would be to replace the 'cpus' cpumask with a > function that evaluates a cpumask stored separately. Right, I was too busy trying to cleanup the 32-bit mask, that works too.