From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC99DC4363A for ; Thu, 29 Oct 2020 01:01:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 882DD2087E for ; Thu, 29 Oct 2020 01:01:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603933269; bh=YTIoP8jmk1dMFohZd6EK2lZ2rfu1qEiJDzHvGm4gTPM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=xa8Q8R6ubymp3oxZ/lwsmBYeKhE3DKGxQQ1b2uF5fzUDVeXKfeT5yKI+O7QdXOf5W JrlAXlGx92WPUdJlceZGOgJB8CXLri8WtVcW9P9OpAc1fYHCv65dVt4iyuHfOQ3v05 zAmixslhN76N6ztYAOst4Robs7QId7T5B3pJcK1c= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404049AbgJ2BBG (ORCPT ); Wed, 28 Oct 2020 21:01:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:60502 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731528AbgJ1WR1 (ORCPT ); Wed, 28 Oct 2020 18:17:27 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C22452465B; Wed, 28 Oct 2020 08:36:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603874214; bh=YTIoP8jmk1dMFohZd6EK2lZ2rfu1qEiJDzHvGm4gTPM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=br54aej6Fa3FCD729KUKrUAQOnkwSB34dXnqmrdB7pYHryrJ8bcuIUzMtqUpnnLul jZAzLh0Ol2qAkkHNXL9ZNYIbDrsmE1WhYab3+NbUHzeVI1AHuxbcg5mtfmUrA8Aiz1 BDEpUgrVSB4Gml1vH9fNb6ZO0jOFZovQ9KBQptq8= Date: Wed, 28 Oct 2020 09:37:46 +0100 From: Greg Kroah-Hartman To: Will Deacon Cc: linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, Catalin Marinas , Marc Zyngier , Peter Zijlstra , Morten Rasmussen , Qais Yousef , Suren Baghdasaryan , kernel-team@android.com Subject: Re: [PATCH 5/6] arm64: Advertise CPUs capable of running 32-bit applcations in sysfs Message-ID: <20201028083746.GA1854746@kroah.com> References: <20201027215118.27003-1-will@kernel.org> <20201027215118.27003-6-will@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201027215118.27003-6-will@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-arch@vger.kernel.org On Tue, Oct 27, 2020 at 09:51:17PM +0000, Will Deacon wrote: > Since 32-bit applications will be killed if they are caught trying to > execute on a 64-bit-only CPU in a mismatched system, advertise the set > of 32-bit capable CPUs to userspace in sysfs. > > Signed-off-by: Will Deacon > --- > .../ABI/testing/sysfs-devices-system-cpu | 8 ++++++++ > arch/arm64/kernel/cpufeature.c | 19 +++++++++++++++++++ > 2 files changed, 27 insertions(+) > > diff --git a/Documentation/ABI/testing/sysfs-devices-system-cpu b/Documentation/ABI/testing/sysfs-devices-system-cpu > index b555df825447..19893fb8e870 100644 > --- a/Documentation/ABI/testing/sysfs-devices-system-cpu > +++ b/Documentation/ABI/testing/sysfs-devices-system-cpu > @@ -472,6 +472,14 @@ Description: AArch64 CPU registers > 'identification' directory exposes the CPU ID registers for > identifying model and revision of the CPU. > > +What: /sys/devices/system/cpu/aarch32_el0 > +Date: October 2020 > +Contact: Linux ARM Kernel Mailing list > +Description: Identifies the subset of CPUs in the system that can execute > + AArch32 (32-bit ARM) applications. If absent, then all or none > + of the CPUs can execute AArch32 applications and execve() will > + behave accordingly. How is this value represented? A hint here would be nice. > + > What: /sys/devices/system/cpu/cpu#/cpu_capacity > Date: December 2016 > Contact: Linux kernel mailing list > diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c > index 2e2219cbd54c..9f29d4d1ef7e 100644 > --- a/arch/arm64/kernel/cpufeature.c > +++ b/arch/arm64/kernel/cpufeature.c > @@ -67,6 +67,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -1236,6 +1237,24 @@ bool system_has_mismatched_32bit_el0(void) > return fld == ID_AA64PFR0_EL0_64BIT_ONLY; > } > > +static ssize_t aarch32_el0_show(struct kobject *kobj, > + struct kobj_attribute *attr, char *buf) > +{ > + const struct cpumask *mask = system_32bit_el0_cpumask(); > + return sprintf(buf, "%*pbl\n", cpumask_pr_args(mask)); sysfs_emit()? And a blank line to make checkpatch.pl happy :) > +} > +static const struct kobj_attribute aarch32_el0_attr = __ATTR_RO(aarch32_el0); DEVICE_ATTR_RO()? > + > +static int __init aarch32_el0_sysfs_init(void) > +{ > + if (!__allow_mismatched_32bit_el0) > + return 0; > + > + return sysfs_create_file(&cpu_subsys.dev_root->kobj, > + &aarch32_el0_attr.attr); device_create_file() please, dev_root is a struct device, no need to "thunk" down to a "raw" sysfs call. thanks, greg k-h From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FCB0C55178 for ; Wed, 28 Oct 2020 08:38:16 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0D9602462E for ; Wed, 28 Oct 2020 08:38:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="uOF25ZEn"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="br54aej6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0D9602462E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1+/DT1ZYkDJNnGAd5J6oEMN9lpO+Dj/30qyxV5nq4Vs=; b=uOF25ZEnctmZqo4jYzrUkvnG7 f5iFFEJMtwKp0A7N4uqXnL7xxLDVqK2gaAg25kBUuMFzoDLE8URFmfY3/d28VYs9Ptw5U7eYEtQdj QDOT+IJ4VNqxl+0A2vi/cl7oxsXzd/fJgx/5C4A5ibdurnm0HjcvELp79RwLtkSIIae0ELoSZQBr7 TuKIWr9f5zNHTGArWbYvyTPZrvF8qYAdViEypfSgvD53ZUxz5i23HlIXP/amlHkZEsKAdw59TDIOO YpuQ6PhdNI/TwdPjaZX1bjJD1NYyBSrCCgfrB1R/CIPxFe5cQcyyYQ7eVmpUdag903XCMSE2DX/G3 zAmEAljWA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kXgx7-0002IU-HM; Wed, 28 Oct 2020 08:37:05 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kXgwx-0002Fb-4Q for linux-arm-kernel@lists.infradead.org; Wed, 28 Oct 2020 08:36:57 +0000 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C22452465B; Wed, 28 Oct 2020 08:36:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603874214; bh=YTIoP8jmk1dMFohZd6EK2lZ2rfu1qEiJDzHvGm4gTPM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=br54aej6Fa3FCD729KUKrUAQOnkwSB34dXnqmrdB7pYHryrJ8bcuIUzMtqUpnnLul jZAzLh0Ol2qAkkHNXL9ZNYIbDrsmE1WhYab3+NbUHzeVI1AHuxbcg5mtfmUrA8Aiz1 BDEpUgrVSB4Gml1vH9fNb6ZO0jOFZovQ9KBQptq8= Date: Wed, 28 Oct 2020 09:37:46 +0100 From: Greg Kroah-Hartman To: Will Deacon Subject: Re: [PATCH 5/6] arm64: Advertise CPUs capable of running 32-bit applcations in sysfs Message-ID: <20201028083746.GA1854746@kroah.com> References: <20201027215118.27003-1-will@kernel.org> <20201027215118.27003-6-will@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201027215118.27003-6-will@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201028_043655_400940_516FACA4 X-CRM114-Status: GOOD ( 21.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, kernel-team@android.com, Peter Zijlstra , Catalin Marinas , Qais Yousef , Marc Zyngier , Suren Baghdasaryan , Morten Rasmussen , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Oct 27, 2020 at 09:51:17PM +0000, Will Deacon wrote: > Since 32-bit applications will be killed if they are caught trying to > execute on a 64-bit-only CPU in a mismatched system, advertise the set > of 32-bit capable CPUs to userspace in sysfs. > > Signed-off-by: Will Deacon > --- > .../ABI/testing/sysfs-devices-system-cpu | 8 ++++++++ > arch/arm64/kernel/cpufeature.c | 19 +++++++++++++++++++ > 2 files changed, 27 insertions(+) > > diff --git a/Documentation/ABI/testing/sysfs-devices-system-cpu b/Documentation/ABI/testing/sysfs-devices-system-cpu > index b555df825447..19893fb8e870 100644 > --- a/Documentation/ABI/testing/sysfs-devices-system-cpu > +++ b/Documentation/ABI/testing/sysfs-devices-system-cpu > @@ -472,6 +472,14 @@ Description: AArch64 CPU registers > 'identification' directory exposes the CPU ID registers for > identifying model and revision of the CPU. > > +What: /sys/devices/system/cpu/aarch32_el0 > +Date: October 2020 > +Contact: Linux ARM Kernel Mailing list > +Description: Identifies the subset of CPUs in the system that can execute > + AArch32 (32-bit ARM) applications. If absent, then all or none > + of the CPUs can execute AArch32 applications and execve() will > + behave accordingly. How is this value represented? A hint here would be nice. > + > What: /sys/devices/system/cpu/cpu#/cpu_capacity > Date: December 2016 > Contact: Linux kernel mailing list > diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c > index 2e2219cbd54c..9f29d4d1ef7e 100644 > --- a/arch/arm64/kernel/cpufeature.c > +++ b/arch/arm64/kernel/cpufeature.c > @@ -67,6 +67,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -1236,6 +1237,24 @@ bool system_has_mismatched_32bit_el0(void) > return fld == ID_AA64PFR0_EL0_64BIT_ONLY; > } > > +static ssize_t aarch32_el0_show(struct kobject *kobj, > + struct kobj_attribute *attr, char *buf) > +{ > + const struct cpumask *mask = system_32bit_el0_cpumask(); > + return sprintf(buf, "%*pbl\n", cpumask_pr_args(mask)); sysfs_emit()? And a blank line to make checkpatch.pl happy :) > +} > +static const struct kobj_attribute aarch32_el0_attr = __ATTR_RO(aarch32_el0); DEVICE_ATTR_RO()? > + > +static int __init aarch32_el0_sysfs_init(void) > +{ > + if (!__allow_mismatched_32bit_el0) > + return 0; > + > + return sysfs_create_file(&cpu_subsys.dev_root->kobj, > + &aarch32_el0_attr.attr); device_create_file() please, dev_root is a struct device, no need to "thunk" down to a "raw" sysfs call. thanks, greg k-h _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel