Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp448423pxb; Thu, 9 Sep 2021 04:50:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjMfNZuffKBAADP5r68QlW14iBUd97FR0ikXt9ybD7XcCBI2mylc2HHi8VXrsYXG774b0a X-Received: by 2002:a17:906:4ed2:: with SMTP id i18mr1688463ejv.528.1631188228557; Thu, 09 Sep 2021 04:50:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631188228; cv=none; d=google.com; s=arc-20160816; b=seJD+Mnis6NNKmCpG505qEADjYKjR9jzpRE9YOi8hXA7BiUkfgDee7A6Y8i6PlgKVp 66LbutdOhEuzYJWhH0hfGewGFEiSIZY51BzfUckFml0g0z2K9mT5A3CIkGmYm7B9NBoj DWmRUEVBAPUiP/A93mWiQNj5q9MMKQ1jX+clDzCSfDVBPndyZK74cN77lWKYai0SdaMi NlCxHU3BrKV7DArDmEjVmAPZHhdJClp2LAL2hsZwMKZUV1IkNjR5ZlfkTE2z0hfqP7PG 6jHX+tKRUTZL9nUmc8oNsCkOHiH240D1+Y5H1glXNxlBG3Hp3rzL23aKpYMBAJ3+OX8n RGtA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=upJ2R2fg9pSN9eglmAcySlFxfIbzqW0pE/Xav4yMsiw=; b=HP+P/givklT5Gn3mcFqNQyzWtIAljlnAklUCzsLfEr7az2AMQc0QR9LoxbIDYX9Ws1 GgTU1ASagw6cShI8JaUtQwgg4H7AlHLuDkWAXR8J1z5BscSRPaA+jUVYdBBvFRF32oiY fvqr4+G9j8ysjh3zumaHURynQy6h6MvUWKz/UQ3Twd5T9uqUCBv618tzMYZoPymUNaqs FOLwi9y0mzs5B9D2V+xLvmBXvpEZ+eh4Ce9+z+XKO4RzOYv1NWCGPNZ+ZfNoXMcElSdL PdoEz90+lR8GU4gjOP2XGOvnDIwEe04hAO3QGWM04RAH4vQJ0Me5BhzFJ/v3zEfG3YSM xZGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LEGszd4Y; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n27si1534318ejl.103.2021.09.09.04.50.00; Thu, 09 Sep 2021 04:50:28 -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=@kernel.org header.s=k20201202 header.b=LEGszd4Y; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239858AbhIILrp (ORCPT + 99 others); Thu, 9 Sep 2021 07:47:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:46218 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238005AbhIILpB (ORCPT ); Thu, 9 Sep 2021 07:45:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2D7CA61131; Thu, 9 Sep 2021 11:42:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631187763; bh=CAqIcXkcf34afve8LtpAWpAHRErObplwMTC0sRhadn0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LEGszd4YzupvRwSykdV9Ox2oHpsMyUztVNVgPEyFf5emkBNW4maUFgiPB1kCrrGkB hVzj3vTzTgRz7gyYGuKogH4JLjvhHKUkfJ+CHyNp7AOU9/kjymeuu5PrirIHAWo4Pz jFl4OuGZNSSmn7k1mC6Hicibt6cOoOkgPlccZfgBsiI6xkouTvRBz4SmmeUVRZo6vm NgwnuRY3cBdB0o/Mh87fcIfntLi8XdUhI01gvI3xl60jEMXYIL5qMETe2JBcFet7xq eVSZDoKps1h7FvIJPBKvYT1eVYPn82gf7LdlKrdKWQMBCklcPWDgWSAJjvfsSVbPU7 9y80IKRa+fY2Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Niklas Schnelle , Heiko Carstens , Sasha Levin , linux-s390@vger.kernel.org Subject: [PATCH AUTOSEL 5.14 076/252] s390: make PCI mio support a machine flag Date: Thu, 9 Sep 2021 07:38:10 -0400 Message-Id: <20210909114106.141462-76-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210909114106.141462-1-sashal@kernel.org> References: <20210909114106.141462-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 3a77aa96d092..bdb0c77bcfd9 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) @@ -110,6 +111,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 fb84e3fc1686..9857cb046726 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 8fcb7ecb7225..2146ffb3e1eb 100644 --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c @@ -892,7 +892,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; @@ -903,7 +902,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")) { @@ -934,7 +933,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