Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1683403pxb; Thu, 16 Sep 2021 12:54:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzz54JpzKek6nRjL2vgNSYwP/TghJQ4/egpA/BERClCVt2LehcNzgsQmy4vv+GiaEVI9VdK X-Received: by 2002:a5d:93cf:: with SMTP id j15mr3158358ioo.113.1631822052419; Thu, 16 Sep 2021 12:54:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631822052; cv=none; d=google.com; s=arc-20160816; b=aJgW+RUkt5ZIrhuz8yLFRg7XHJ+jDWEeRq2TkoUm4PUanxz4MUBvfcOoH763bGfP/Q aTgSOM53zrG5gM1FBsCvClJGjRhY9St+aN1B3Pn4N0kiC5KxHSGWSK7wh/7SBGlunxQj cqSANLD3Jtb/RxOfmg2O4ai4aeDlx5UGJBf2VPuu2I7frxTklK2TkMDRfRKIevemZJth 8htphChEvnBf3vnrHZePaVVjkrIXaF2mV6NNgJG6W9q4ubcwsbkmRKPflQxj10kawjNJ sSVfcQS09sA0/YaeUXC5Jbwry30Y8uXOnLqd8u5aJbDrDLzHSW+FHlf6PAzqND2RokSH lFoA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fy0B2kRlAPGTI8vZ0y75j3BLSExznDRkLk1JcEkhloU=; b=Bc1s/iecWM/bR4tLQYykIvGANDlR3BEb/y/UjWZdvG4jOBx/4rUUvfQjYL8sRFFRPG iyHZWwkJ8EGSumNmyppyccGKLl0Tzl6buZ46fx3UHe00quAVSXS9GFCk2MYe9AcyH3YM A7DJaFE5P5aKKgUSPWd8YWtefnVgpUNLeaj34+9QACFUXh/sgiScMfU3Zd3ApY3bHLA/ W85t4t3JGC+FZqON211pEHgJuBIQK94sxroXjddRx35jDewE53LSFeYm5/lEO7EbHyHE u/1ZqArcSBMs5BQTD3y6E8Kvw1s/61+/8DuI34WxoXhboB/vsrSBb9L4oMFL8hPQusAE DatQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UF5e4X8N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r1si3416120ilg.125.2021.09.16.12.53.54; Thu, 16 Sep 2021 12:54:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UF5e4X8N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241862AbhIPQWc (ORCPT + 99 others); Thu, 16 Sep 2021 12:22:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:54974 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240705AbhIPQOW (ORCPT ); Thu, 16 Sep 2021 12:14:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B5537613A9; Thu, 16 Sep 2021 16:10:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631808619; bh=xVZaS4VY1CagNFx46DC7CHstYvPqRAR5sckPHTXIT3A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UF5e4X8Nx+fHkVKse9nUNZ8MqNkk2uYXqKA425zxKZ0ZCdpAxzpaGzlUYPxJCYQun CQxGQQ0hisfSGcJA7fxiW1WK7HDt725xTbWrYxE+wMymf+iTK0pNV89x2juuvroxi6 G+uHMinPZ3wUQsOlDFOz1yMotbe06focgfDRpumU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiko Carstens , Niklas Schnelle , Sasha Levin Subject: [PATCH 5.10 160/306] s390: make PCI mio support a machine flag Date: Thu, 16 Sep 2021 17:58:25 +0200 Message-Id: <20210916155759.534410826@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155753.903069397@linuxfoundation.org> References: <20210916155753.903069397@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Niklas Schnelle [ Upstream commit 3322ba0d7bea1e24ae464418626f6a15b69533ab ] Kernel support for the newer PCI mio instructions can be toggled off with the pci=nomio command line option which needs to integrate with common code PCI option parsing. However this option then toggles static branches which can't be toggled yet in an early_param() call. Thus commit 9964f396f1d0 ("s390: fix setting of mio addressing control") moved toggling the static branches to the PCI init routine. With this setup however we can't check for mio support outside the PCI code during early boot, i.e. before switching the static branches, which we need to be able to export this as an ELF HWCAP. Improve on this by turning mio availability into a machine flag that gets initially set based on CONFIG_PCI and the facility bit and gets toggled off if pci=nomio is found during PCI option parsing allowing simple access to this machine flag after early init. Reviewed-by: Heiko Carstens Signed-off-by: Niklas Schnelle Signed-off-by: Heiko Carstens Signed-off-by: Sasha Levin --- arch/s390/include/asm/setup.h | 2 ++ arch/s390/kernel/early.c | 4 ++++ arch/s390/pci/pci.c | 5 ++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/s390/include/asm/setup.h b/arch/s390/include/asm/setup.h index bdb242a1544e..75a2ecec2ab8 100644 --- a/arch/s390/include/asm/setup.h +++ b/arch/s390/include/asm/setup.h @@ -38,6 +38,7 @@ #define MACHINE_FLAG_NX BIT(15) #define MACHINE_FLAG_GS BIT(16) #define MACHINE_FLAG_SCC BIT(17) +#define MACHINE_FLAG_PCI_MIO BIT(18) #define LPP_MAGIC BIT(31) #define LPP_PID_MASK _AC(0xffffffff, UL) @@ -113,6 +114,7 @@ extern unsigned long mio_wb_bit_mask; #define MACHINE_HAS_NX (S390_lowcore.machine_flags & MACHINE_FLAG_NX) #define MACHINE_HAS_GS (S390_lowcore.machine_flags & MACHINE_FLAG_GS) #define MACHINE_HAS_SCC (S390_lowcore.machine_flags & MACHINE_FLAG_SCC) +#define MACHINE_HAS_PCI_MIO (S390_lowcore.machine_flags & MACHINE_FLAG_PCI_MIO) /* * Console mode. Override with conmode= diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c index 705844f73934..985e1e755333 100644 --- a/arch/s390/kernel/early.c +++ b/arch/s390/kernel/early.c @@ -238,6 +238,10 @@ static __init void detect_machine_facilities(void) clock_comparator_max = -1ULL >> 1; __ctl_set_bit(0, 53); } + if (IS_ENABLED(CONFIG_PCI) && test_facility(153)) { + S390_lowcore.machine_flags |= MACHINE_FLAG_PCI_MIO; + /* the control bit is set during PCI initialization */ + } } static inline void save_vector_registers(void) diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c index 0ddb1fe353dc..f5ddbc625c1a 100644 --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c @@ -866,7 +866,6 @@ static void zpci_mem_exit(void) } static unsigned int s390_pci_probe __initdata = 1; -static unsigned int s390_pci_no_mio __initdata; unsigned int s390_pci_force_floating __initdata; static unsigned int s390_pci_initialized; @@ -877,7 +876,7 @@ char * __init pcibios_setup(char *str) return NULL; } if (!strcmp(str, "nomio")) { - s390_pci_no_mio = 1; + S390_lowcore.machine_flags &= ~MACHINE_FLAG_PCI_MIO; return NULL; } if (!strcmp(str, "force_floating")) { @@ -906,7 +905,7 @@ static int __init pci_base_init(void) if (!test_facility(69) || !test_facility(71)) return 0; - if (test_facility(153) && !s390_pci_no_mio) { + if (MACHINE_HAS_PCI_MIO) { static_branch_enable(&have_mio); ctl_set_bit(2, 5); } -- 2.30.2