Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1558233pxb; Thu, 16 Sep 2021 09:52:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuiRsdzv63JbAudPPB31E2a9PpCpIui5xQtRrivuOaKkiJkI2Tdbc6p9ZBtYM8NB8y3tGQ X-Received: by 2002:a50:bec6:: with SMTP id e6mr7751215edk.216.1631811179392; Thu, 16 Sep 2021 09:52:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631811179; cv=none; d=google.com; s=arc-20160816; b=uhXvUXUS6u+eOLVJwoBfDwxRBuMUD2G69qLXC1HiMGgRH4ecLK7xYFvPVXXh3gKdmU z1NQJWSL1fhRILW0PX2Xdc255PxVUty9+H6X3ofiI9babzHK7ULoMJjRkCfyYa0vuQTO G4Au7vJWRnHS21qcN5MPGL6LsSxDNvjyAUiDs4Gq9RdfqAzldlqYiUvwgNtbTXaec0Sc g8tVnNO4+V5V+9Jc6IkPqgbUehdJHlZKx0ZFkr89OkqGBTnfR4gj4jCrm4BO0IERMlQ9 PWC6bjFJ1OVY9lDMsoQUiK7iCs2xIzPWC7hB7nc4Hqn71nBvjpy8zbIla++t/mlUroAy 7URA== 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=QI/w2TspbU6cqMLGkiEwAEihE5rwkUv4tptE1HH9xto=; b=ssGw3ZGoO511N0+c8yEjjOGotjBjtgQukPveLFzhHC3fiT/dKyhGDKaRfXiDSv0HrR KnD5oghP2B327Dtv1n5KUQ6GZnXX1Ztv8sQx0846fErfjUl9v90yvJZGheFbq5WE7L8F SxAnJyFFnJahste4Rbl7Sp3jeB1Fgj5vvpwvHWAOlUkH80M27/0vLt3eUhy8zSTRYyRt hbAwdGCr4Ts1MhrMf3bjhUVuzz5q6RNbwp0cH66EKmoESYUCtuSw88TEdPTMnD0AczQR nDTMuRjAP+AF+gU5h9QJHcCc9uzirWFpGdOIGRnBdfnY3ia51C2qVt59EVRBB5o1dIB9 SVtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Tqb1i0ow; 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 p17si4244238edy.229.2021.09.16.09.52.33; Thu, 16 Sep 2021 09:52:59 -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=Tqb1i0ow; 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 S1345627AbhIPQu3 (ORCPT + 99 others); Thu, 16 Sep 2021 12:50:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:58996 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244123AbhIPQpw (ORCPT ); Thu, 16 Sep 2021 12:45:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AABE761A6C; Thu, 16 Sep 2021 16:26:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631809569; bh=DUNfnJ8vVfCQ6WLzdPlvUhpWJUV0nFvuTGO4FjcQ7CA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tqb1i0owxaUj0KWgTJAMSgnN1ys/tuhLWg4XBxAMg7nbneaO/OAy5xzCoy5oEw/GN JZHeiFBKvxne6tPyjZ47jebAjtM26KZAWzyDkcUCWlmITCEw06e4E+f24/EkT5JLfu 5VgVU96k0RZmBpqW+lmaf4dXfWzmbTHOL+2V6r6o= 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.13 202/380] s390: make PCI mio support a machine flag Date: Thu, 16 Sep 2021 17:59:19 +0200 Message-Id: <20210916155810.942469605@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155803.966362085@linuxfoundation.org> References: <20210916155803.966362085@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 3e388fa208d4..519d517fedf4 100644 --- a/arch/s390/include/asm/setup.h +++ b/arch/s390/include/asm/setup.h @@ -36,6 +36,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) @@ -109,6 +110,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 a361d2e70025..661585587cbe 100644 --- a/arch/s390/kernel/early.c +++ b/arch/s390/kernel/early.c @@ -236,6 +236,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 77cd965cffef..34839bad33e4 100644 --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c @@ -893,7 +893,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; @@ -904,7 +903,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")) { @@ -935,7 +934,7 @@ static int __init pci_base_init(void) 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