From patchwork Tue Jan 4 15:35:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 12703574 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 6E1C2C433F5 for ; Tue, 4 Jan 2022 15:39:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tQNGAG0jhpQpIqJQyW5rp/UrZwf/R/GPWNE6dtJlZOI=; b=hsYocJjY+oULHs sMj0In+6zlZmLDtUPhKISdMoQPvSeCFtf2EWu4R1c5FNBzs1Mb1cZyXXQQ95nLoisR9yf5hPjvgg9 vN53dBhrCX/bkJDyVGHqMphe6127pxuYkyKYK1ZNuU8pTy8DcPIF1226ryKMnB1szjiwE7eUGdS28 60y4edDHl8DJwx4CIRLQPcHz9YhNpXY04hxjkDIQylocev5YqD+zFHI+0jTdK45eF2atycJ96AM/s y+6ECepqQ/Zt/QBlq5jmqRFzqzquEsxu1A35cY2RlhCtxiuOJsB9EflcDmAvEEZlPGbr3v+UIPyZ5 GfTvVKaligtRIHHzrH5w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n4ltQ-00BxoF-S3; Tue, 04 Jan 2022 15:38:33 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n4ltM-00Bxky-3i for linux-arm-kernel@lists.infradead.org; Tue, 04 Jan 2022 15:38:29 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C3D79614CE; Tue, 4 Jan 2022 15:38:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17A9DC36AF5; Tue, 4 Jan 2022 15:38:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641310706; bh=hVpmL6carw5FHfSaRzrs6Ykkswp2VyP7qkjYE90lc6o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jwm6LKxmU62KKfm+HrSdDh8ADqOhqWlb+/oP/+V0k+FUJZor620FE2qpr5RtPkaAN ez502/JmHsBooNlJN4XDTu8iiDv/Py6mvFy6p5EhIDV6nXObmdNadFnltDMRstWkxv WPgc8rG8S8Y9xrYXe9SHOSNYyxXU7B7BBLxU6mQH24ht5Z0t3rERzAkdMpXP+s74MS oliyVGFr0nPIb0q0kAx+TGvtXDinUKuC/W6E9WxA26ATmCv7vznoBqmTG/lzv8AYFu Uz8MYdfl+gCWHsxD1sVOfPh3m786XqHPYNSDwmzN2En8yVWX83JqIejuGXnD+KrsAc MTQKQ9xZJ/baA== Received: by pali.im (Postfix) id C17E496B; Tue, 4 Jan 2022 16:38:25 +0100 (CET) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Thomas Petazzoni , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Bjorn Helgaas , =?utf-8?q?Marek_Beh=C3=BAn?= Cc: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 04/11] PCI: pci-bridge-emul: Add support for new flag PCI_BRIDGE_EMUL_NO_IO_FORWARD Date: Tue, 4 Jan 2022 16:35:22 +0100 Message-Id: <20220104153529.31647-5-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220104153529.31647-1-pali@kernel.org> References: <20211221141455.30011-1-pali@kernel.org> <20220104153529.31647-1-pali@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220104_073828_243996_24738283 X-CRM114-Status: GOOD ( 13.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Like PCI_BRIDGE_EMUL_NO_PREFMEM_FORWARD, this new flag specifies that emulated PCI bridge does not support forwarding of IO requests in given range between primary and secondary buses. This flag should be used as argument for pci_bridge_emul_init() for hardware setup without IO support. Setting this flag cause that IO base and limit registers are read-only. Signed-off-by: Pali Rohár --- Changes in v2: * Add comment into code. --- drivers/pci/pci-bridge-emul.c | 9 +++++++++ drivers/pci/pci-bridge-emul.h | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/drivers/pci/pci-bridge-emul.c b/drivers/pci/pci-bridge-emul.c index 432b1bec2e22..033bbeb99176 100644 --- a/drivers/pci/pci-bridge-emul.c +++ b/drivers/pci/pci-bridge-emul.c @@ -378,6 +378,15 @@ int pci_bridge_emul_init(struct pci_bridge_emul *bridge, bridge->pci_regs_behavior[PCI_PREF_MEMORY_BASE / 4].rw = 0; } + if (flags & PCI_BRIDGE_EMUL_NO_IO_FORWARD) { + bridge->pci_regs_behavior[PCI_COMMAND / 4].ro |= PCI_COMMAND_IO; + bridge->pci_regs_behavior[PCI_COMMAND / 4].rw &= ~PCI_COMMAND_IO; + bridge->pci_regs_behavior[PCI_IO_BASE / 4].ro |= GENMASK(15, 0); + bridge->pci_regs_behavior[PCI_IO_BASE / 4].rw &= ~GENMASK(15, 0); + bridge->pci_regs_behavior[PCI_IO_BASE_UPPER16 / 4].ro = ~0; + bridge->pci_regs_behavior[PCI_IO_BASE_UPPER16 / 4].rw = 0; + } + return 0; } EXPORT_SYMBOL_GPL(pci_bridge_emul_init); diff --git a/drivers/pci/pci-bridge-emul.h b/drivers/pci/pci-bridge-emul.h index 087b5fa01bcf..4953274cac18 100644 --- a/drivers/pci/pci-bridge-emul.h +++ b/drivers/pci/pci-bridge-emul.h @@ -125,6 +125,12 @@ enum { * requests between primary and secondary buses. */ PCI_BRIDGE_EMUL_NO_PREFMEM_FORWARD = BIT(0), + + /* + * PCI bridge does not support forwarding of IO requests between + * primary and secondary buses. + */ + PCI_BRIDGE_EMUL_NO_IO_FORWARD = BIT(1), }; int pci_bridge_emul_init(struct pci_bridge_emul *bridge,