From patchwork Wed May 4 15:57:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juergen Gross X-Patchwork-Id: 12838118 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 lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E6422C4332F for ; Wed, 4 May 2022 15:57:24 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.320870.541836 (Exim 4.92) (envelope-from ) id 1nmHNG-0003wh-1i; Wed, 04 May 2022 15:57:10 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 320870.541836; Wed, 04 May 2022 15:57:10 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nmHNF-0003wa-U2; Wed, 04 May 2022 15:57:09 +0000 Received: by outflank-mailman (input) for mailman id 320870; Wed, 04 May 2022 15:57:08 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nmHNE-0003wP-EV for xen-devel@lists.xenproject.org; Wed, 04 May 2022 15:57:08 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id d93f5fd2-cbc2-11ec-a406-831a346695d4; Wed, 04 May 2022 17:57:07 +0200 (CEST) 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 A53991F74B; Wed, 4 May 2022 15:57:06 +0000 (UTC) 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 04953132C4; Wed, 4 May 2022 15:57:05 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id XfVKO1GicmLWPAAAMHmgww (envelope-from ); Wed, 04 May 2022 15:57:05 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d93f5fd2-cbc2-11ec-a406-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1651679826; 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=hG7emcEGn0sS81RKfZEcY3mzY1AE7PXlwENEP7suGv0=; b=g4wY94mvZyO+V+p1H2CBHhX6rOIEgjn6VJaUzqhOuZaZX7Z5w3dZMNr2IaH2+kGxfqve9X r9KOXvqVpM9FnKRs3k6i4MC+Iqp/CQTkqEI1FyzTVZqXo58XoBlTfaY4/FeC40jLvdkqw2 cmdfELH/dDTQoTEyFXNI3PahwVKzzWM= From: Juergen Gross To: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, x86@kernel.org, linux-s390@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" , Andy Lutomirski , Peter Zijlstra , "Michael S. Tsirkin" , Jason Wang , Christoph Hellwig , Oleksandr Tyshchenko Subject: [PATCH v3 0/2] kernel: add new infrastructure for platform_has() support Date: Wed, 4 May 2022 17:57:01 +0200 Message-Id: <20220504155703.13336-1-jgross@suse.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 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/mm/mem_encrypt.c | 7 ------- arch/x86/mm/mem_encrypt_amd.c | 4 ++++ 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 | 19 ++++++++++++++++++ include/linux/virtio_config.h | 9 --------- kernel/Makefile | 2 +- kernel/platform-feature.c | 27 ++++++++++++++++++++++++++ 14 files changed, 73 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 Reviewed-by: Oleksandr Tyshchenko Tested-by: Oleksandr Tyshchenko