Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp476274imn; Wed, 27 Jul 2022 11:15:53 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u6ktfcrKPJzRCbJ3mTeUO6CppuWs5F48ZiKSBZF5aVVer2UHK3kSloItik3koGCRpZjXd+ X-Received: by 2002:a17:902:d2c8:b0:16d:8cb1:d34d with SMTP id n8-20020a170902d2c800b0016d8cb1d34dmr11594613plc.81.1658945752849; Wed, 27 Jul 2022 11:15:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658945752; cv=none; d=google.com; s=arc-20160816; b=gDok+RBCDbkKidY/mWM4Dbj8vPtR7adLLsrx4ilXcqW5YgUY/pD0X6rs8OP/cwPmlP WU1lFUKmNPCpy/IynTr05rfWeymScWo8RW1w7sWLPBPGvL6BKHfvmv+484aBSbwF8jpJ 26tIPonxohQlNM3D4JZj0k0m+h2IUSbzr+l9g4m/JXSpCvh1pQgG0vKUp553l++haDg3 Uev+1BW2ohy29gIbu8Lve8h4gGlddHfZM0cKcWR+9V1efjbSILtnIoJUBVYVUUmaMcGP Jc3WFiLjA4VdLrLgUfHrPs6nTQUnqy+iOOyZRH4k0vA0efetpBQpgxR/Z48kvBTgThCk UTmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=3mt4s6TRQ/5aagVzKEJ+zgYn0F6bDFqIRsrNqODGf7E=; b=nFOUq2cF+9OyLRomNWobT2NZ+BebNkrKFEyAn9PcwvMkvcmvKWw0jseoyy7nRBSTJ/ KOdDihfauPKrFDGm69MhIzZhbmeUgYG4CjBz3u3OozONKgOWLSqyCSa3ypcTTs0hP4I7 tP4QscmjWYdWQQyAFvtuNpFYykq4szwzys+4nbToLGfmXOtCxiHLMUMIgY7OVpDVXq5u FPZVFPwpwEmxIE3b4ljbTLjvnP+p7bqGLke0d6oLWxE0MnEU6PPwb+fRNBCwzkrIS7qb B/5sbLpD6Z94/3VYneeVWFBkA5kjiQHBkomvQxbaE/57i5Ty15JftAvq4KPePdRp35Yo Lybw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=NtaPEGWz; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=LqPsR8OR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lb10-20020a17090b4a4a00b001ecb608ea41si3290213pjb.167.2022.07.27.11.15.37; Wed, 27 Jul 2022 11:15:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=NtaPEGWz; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=LqPsR8OR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234798AbiG0QLr (ORCPT + 99 others); Wed, 27 Jul 2022 12:11:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234784AbiG0QLp (ORCPT ); Wed, 27 Jul 2022 12:11:45 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D2444B489 for ; Wed, 27 Jul 2022 09:11:42 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 07B0220B50; Wed, 27 Jul 2022 16:11:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1658938301; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=3mt4s6TRQ/5aagVzKEJ+zgYn0F6bDFqIRsrNqODGf7E=; b=NtaPEGWzhlotMBwyFZD3iTRpfGUTIWmOn2DW54OX/U4/D1K7gncI+DGSSzAJhCqf2znPks NAmwroaUvltAclyAEq0puEVsYcRPht59KEvge6L15u7RMchlaUndiVIZQ+EbriXWCzzPSo j+oDzlYqTPoYJBHBQyd/u6bX0iANnIk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1658938301; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=3mt4s6TRQ/5aagVzKEJ+zgYn0F6bDFqIRsrNqODGf7E=; b=LqPsR8ORFCwSPJ4gIbI3UO7UVOpEHStpGqXPanRx4WXmJOTOYGCxK/cT0t4QvRUyaCCBd+ uTT2UZUYTkGIdZAQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id C852113ABC; Wed, 27 Jul 2022 16:11:40 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id QXDvLrxj4WLLAQAAMHmgww (envelope-from ); Wed, 27 Jul 2022 16:11:40 +0000 From: Petr Vorel To: linux-kernel@vger.kernel.org Cc: Petr Vorel , Greg Kroah-Hartman , "Rafael J. Wysocki" , David Sterba Subject: [PATCH 1/1] drivers/base/cpu: Print kernel arch Date: Wed, 27 Jul 2022 18:11:35 +0200 Message-Id: <20220727161135.24531-1-pvorel@suse.cz> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Print kernel architecture in /sys/devices/system/cpu/arch using UTS_MACHINE, i.e. member of struct uts_namespace.machine. This helps people who debug kernel with initramfs with minimal environment (i.e. without coreutils or even busybox) or allow to open sysfs file instead of run uname -m in high level languages. Signed-off-by: Petr Vorel --- drivers/base/cpu.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 4c98849577d4..7c8032e3ff10 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -3,6 +3,7 @@ * CPU subsystem support */ +#include #include #include #include @@ -232,6 +233,13 @@ static ssize_t print_cpus_kernel_max(struct device *dev, } static DEVICE_ATTR(kernel_max, 0444, print_cpus_kernel_max, NULL); +static ssize_t print_cpus_arch(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return sysfs_emit(buf, "%s\n", UTS_MACHINE); +} +static DEVICE_ATTR(arch, 0444, print_cpus_arch, NULL); + /* arch-optional setting to enable display of offline cpus >= nr_cpu_ids */ unsigned int total_cpus; @@ -464,6 +472,7 @@ static struct attribute *cpu_root_attrs[] = { &cpu_attrs[1].attr.attr, &cpu_attrs[2].attr.attr, &dev_attr_kernel_max.attr, + &dev_attr_arch.attr, &dev_attr_offline.attr, &dev_attr_isolated.attr, #ifdef CONFIG_NO_HZ_FULL -- 2.37.1