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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A41BC43219 for ; Tue, 26 Apr 2022 13:40:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351024AbiDZNnk (ORCPT ); Tue, 26 Apr 2022 09:43:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351039AbiDZNnh (ORCPT ); Tue, 26 Apr 2022 09:43:37 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B29103C70B; Tue, 26 Apr 2022 06:40:27 -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-out1.suse.de (Postfix) with ESMTPS id 4B76E210F3; Tue, 26 Apr 2022 13:40:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1650980426; 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=kmKjHgBTikr9wJP5c4NnxpMditJjA5UgCxx0GiFlRPo=; b=FL0QQEYwU011YjnCyfhbAf1gxieHCrchpHEYkFtExYQcCIEHVjGezies9asjNzDSbDt+4v XpGph0NWFvcX3kThatPIvxnZQ3ZUZaxu+Ah6tJd39MhgCRv4W50qT7p1/bpd0un4/aKHBn uyuNZxFtZmeT6D5n6sFO/JPi6gujf9c= 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 97C3513223; Tue, 26 Apr 2022 13:40:25 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id CYHfI0n2Z2ImNQAAMHmgww (envelope-from ); Tue, 26 Apr 2022 13:40:25 +0000 From: Juergen Gross To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, x86@kernel.org, linux-s390@vger.kernel.org, linux-hyperv@vger.kernel.org, virtualization@lists.linux-foundation.org Cc: Juergen Gross , Arnd Bergmann , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , Andy Lutomirski , Peter Zijlstra , "Michael S. Tsirkin" , Jason Wang , Christoph Hellwig , Oleksandr Tyshchenko Subject: [PATCH 0/2] kernel: add new infrastructure for platform_has() support Date: Tue, 26 Apr 2022 15:40:19 +0200 Message-Id: <20220426134021.11210-1-jgross@suse.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-arch@vger.kernel.org In another patch series [1] the need has come up to have support for a generic feature flag infrastructure. This patch series is introducing that infrastructure and adds the first use case. I have decided to use a similar interface as the already known x86 cpu_has() function. As the new infrastructure is meant to be usable for general and arch-specific feature flags, the flags are being spread between a general bitmap and an arch specific one. The bitmaps start all being zero, single features can be set or reset at any time by using the related platform_[re]set_feature() functions. The platform_has() function is using a simple test_bit() call for now, further optimization might be added when needed. [1]: https://lore.kernel.org/lkml/1650646263-22047-1-git-send-email-olekstysh@gmail.com/T/#t Juergen Gross (2): kernel: add platform_has() infrastructure virtio: replace arch_has_restricted_virtio_memory_access() MAINTAINERS | 8 +++++++ arch/s390/Kconfig | 1 - arch/s390/mm/init.c | 13 +++-------- arch/x86/Kconfig | 1 - arch/x86/kernel/cpu/mshyperv.c | 5 ++++- arch/x86/mm/mem_encrypt.c | 6 ------ arch/x86/mm/mem_encrypt_identity.c | 5 +++++ drivers/virtio/Kconfig | 6 ------ drivers/virtio/virtio.c | 5 ++--- include/asm-generic/Kbuild | 1 + include/asm-generic/platform-feature.h | 8 +++++++ include/linux/platform-feature.h | 30 ++++++++++++++++++++++++++ include/linux/virtio_config.h | 9 -------- kernel/Makefile | 2 +- kernel/platform-feature.c | 7 ++++++ 15 files changed, 69 insertions(+), 38 deletions(-) create mode 100644 include/asm-generic/platform-feature.h create mode 100644 include/linux/platform-feature.h create mode 100644 kernel/platform-feature.c -- 2.34.1