From nobody Tue May 14 22:19:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 168332334241946.8912955756075; Fri, 5 May 2023 14:49:02 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.530668.826413 (Exim 4.92) (envelope-from ) id 1pv3I0-0002Nv-2k; Fri, 05 May 2023 21:48:32 +0000 Received: by outflank-mailman (output) from mailman id 530668.826413; Fri, 05 May 2023 21:48:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pv3Hz-0002No-W6; Fri, 05 May 2023 21:48:31 +0000 Received: by outflank-mailman (input) for mailman id 530668; Fri, 05 May 2023 21:48:30 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pv3Hy-0002Ng-F8 for xen-devel@lists.xenproject.org; Fri, 05 May 2023 21:48:30 +0000 Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 90e2af1c-eb8e-11ed-8611-37d641c3527e; Fri, 05 May 2023 23:48:27 +0200 (CEST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 0462C32002FB; Fri, 5 May 2023 17:48:24 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 05 May 2023 17:48:25 -0400 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 5 May 2023 17:48:22 -0400 (EDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 90e2af1c-eb8e-11ed-8611-37d641c3527e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= invisiblethingslab.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:sender:subject:subject:to:to; s=fm3; t=1683323304; x=1683409704; bh=63RaELZf0bZZdNao1GuFs3vFD Am34PcStRchPykUHYs=; b=g4cW2l8rkHmfM8cL4Kfrd3fptPg848oUPhuCXcs6J U3FDMOY1eqDrQ6xQSbodW3pDeq1j0CUnCuaXvb4Tgp+RrNjj4VggdeJg/kKR3WGr Ud2gQCni7nLWTVvSUn4KAdRZaio48MySCH0YJAHEYT5efF9+G26re1ZkoC+VRzky SyT6WRosYuHNkSbqeAonschZ0v6NAFyYcwwME5AGRJUlWUQ2I/i/VcL8tOf4G190 Qpy6LBwx2LDz068e6cpr7u4JjQiyczEtSBZyXr3nfXM6zFg/NnDSFuw2MLU42DD8 RM0m7PwJqGd6xd9GQSsmJPjwx+SirBVIgX4HPlMzYCSxA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1683323304; x=1683409704; bh=6 3RaELZf0bZZdNao1GuFs3vFDAm34PcStRchPykUHYs=; b=DWyn4fEISOpJSSncY xcOaePj4xLw1A55hu+5JxyWyn5eqtuW0eddWMFKbD9l/opNYg6ccWq1LZRLykatB 3PUQtcGZhoMzHey8I2pdrgVVp8MYZtyugNLQhQbGBm4TS7WZYYbDx4oDRqgkLtq7 i0ckYS3myC479neV4z4RYmj+RemC7dH6QUR1hxLrAv949s47MEdajYEPUvrP/giQ Y4V0cAxXj9pDPvpVUlP57sMcUJ+n0OL4AH5751L1R0RX3O62j+4zhfH9iA5gYWeK ctJG5IZ38ezFhdDqZAFKa1T9Na00qNilCA26MNxaGCJZQGA5JTXTjDcPwCDBc2SU 2Dwww== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeeffedgtddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofggtgfgsehtkeertdertdejnecuhfhrohhmpeforghrvghk ucforghrtgiihihkohifshhkihdqifpkrhgvtghkihcuoehmrghrmhgrrhgvkhesihhnvh hishhisghlvghthhhinhhgshhlrggsrdgtohhmqeenucggtffrrghtthgvrhhnpeelkefh udelteelleelteetveeffeetffekteetjeehlefggeekleeghefhtdehvdenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrghrmhgrrhgvkhes ihhnvhhishhisghlvghthhhinhhgshhlrggsrdgtohhm X-ME-Proxy: Feedback-ID: i1568416f:Fastmail From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [PATCH v3] ns16550: enable memory decoding on MMIO-based PCI console card Date: Fri, 5 May 2023 23:48:10 +0200 Message-Id: <20230505214810.406061-1-marmarek@invisiblethingslab.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1683323344760100001 pci_serial_early_init() enables PCI_COMMAND_IO for IO-based UART devices, add setting PCI_COMMAND_MEMORY for MMIO-based UART devices too. Note the MMIO-based devices in practice need a "pci" sub-option, otherwise a few parameters are not initialized (including bar_idx, reg_shift, reg_width etc). The "pci" is not supposed to be used with explicit BDF, so do not key setting PCI_COMMAND_MEMORY on explicit BDF being set. Contrary to the IO-based UART, pci_serial_early_init() will not attempt to set BAR0 address, even if user provided io_base manually - in most cases, those are with an offest and the current cmdline syntax doesn't allow expressing it. Due to this, enable PCI_COMMAND_MEMORY only if uart->bar is already populated. In similar spirit, this patch does not support setting BAR0 of the bridge. Signed-off-by: Marek Marczykowski-G=C3=B3recki Acked-by: Jan Beulich --- This fixes the issue I was talking about on #xendevel. Thanks Roger for the hint. Changes in v2: - check if uart->bar instead of uart->io_base - move it ahead of !uart->ps_bdf_enable return - expand commit message. Changes in v3: - restore io_base check --- xen/drivers/char/ns16550.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c index 1b21eb93c45f..ae845a720f7a 100644 --- a/xen/drivers/char/ns16550.c +++ b/xen/drivers/char/ns16550.c @@ -272,6 +272,14 @@ static int cf_check ns16550_getc(struct serial_port *p= ort, char *pc) static void pci_serial_early_init(struct ns16550 *uart) { #ifdef NS16550_PCI + if ( uart->bar && uart->io_base >=3D 0x10000) + { + pci_conf_write16(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1], + uart->ps_bdf[2]), + PCI_COMMAND, PCI_COMMAND_MEMORY); + return; + } + if ( !uart->ps_bdf_enable || uart->io_base >=3D 0x10000 ) return; =20 --=20 2.39.2