From patchwork Thu Mar 10 14:34:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= X-Patchwork-Id: 12776482 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 lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 45A8FC433EF for ; Thu, 10 Mar 2022 14:34:36 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.288417.489035 (Exim 4.92) (envelope-from ) id 1nSJrx-0001jR-A6; Thu, 10 Mar 2022 14:34:21 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 288417.489035; Thu, 10 Mar 2022 14:34:21 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nSJrx-0001jK-7B; Thu, 10 Mar 2022 14:34:21 +0000 Received: by outflank-mailman (input) for mailman id 288417; Thu, 10 Mar 2022 14:34:19 +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 1nSJrv-0001j9-Np for xen-devel@lists.xenproject.org; Thu, 10 Mar 2022 14:34:19 +0000 Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 29968f09-a07f-11ec-8539-5f4723681683; Thu, 10 Mar 2022 15:34:17 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 897B93200D30; Thu, 10 Mar 2022 09:34:14 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Thu, 10 Mar 2022 09:34:15 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 10 Mar 2022 09:34:12 -0500 (EST) 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: 29968f09-a07f-11ec-8539-5f4723681683 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date: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=fm2; bh=+ofNMV OSWA1/XJphOOvDB6VXgIrvHKjSLBWQP2D64Co=; b=aw/hoPehRvcuF3BAcaR9u2 gMBQCeGY2jzq+2OkGVuNE8BPJ7SRpUmtTyMelLvXwH6CkzNrmgFZToOHsXUyLEHI iJDLNyXgQ5mAEkkFfBAPLSVaD9AfiohVIOJt1khbijpDQc4z3gQO8Oa14vHSybbj bVoLUCdd10ol3OEA3hVvD437OmP4YmA1ce2YoO9ePpzpBRZJNiTkNXUA2bxEtML1 B1QPGzZu2yvnpcz8FUWYR+hn9oCjoZ3bMZXANTDMvnEfZky7ors4D9D+iaexE3FA L35RfqfTNzBybga+4BnLij6MLxNt60MdsDX4GnWyNSoOiOq2b4fpz1NUbj+IJwVw == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddruddvtddgieehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffogggtohfgsehtkeertdertdejnecuhfhrohhmpeforghrvghk ucforghrtgiihihkohifshhkihdqifpkrhgvtghkihcuoehmrghrmhgrrhgvkhesihhnvh hishhisghlvghthhhinhhgshhlrggsrdgtohhmqeenucggtffrrghtthgvrhhnpeetgeet keeukeffhfejueeludehtedtkeeuiedtgffgtdfhveefueeiiefhudehgeenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrghrmhgrrhgvkhes ihhnvhhishhisghlvghthhhinhhgshhlrggsrdgtohhm X-ME-Proxy: From: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= To: xen-devel@lists.xenproject.org Cc: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [PATCH 1/2] ns16550: reject IRQ above nr_irqs Date: Thu, 10 Mar 2022 15:34:02 +0100 Message-Id: <20220310143403.50944-1-marmarek@invisiblethingslab.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Organization: Invisible Things Lab Intel LPSS has INTERRUPT_LINE set to 0xff by default, that can't possibly work. While a proper IRQ configuration may be useful, validating value retrieved from the hardware is still necessary. If it fails, use the device in poll mode. Signed-off-by: Marek Marczykowski-Górecki --- xen/drivers/char/ns16550.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c index e5b4a9085516..2d7c8c11bc69 100644 --- a/xen/drivers/char/ns16550.c +++ b/xen/drivers/char/ns16550.c @@ -1221,6 +1221,9 @@ pci_uart_config(struct ns16550 *uart, bool_t skip_amt, unsigned int idx) pci_conf_read8(PCI_SBDF(0, b, d, f), PCI_INTERRUPT_LINE) : 0; + if (uart->irq >= nr_irqs) + uart->irq = 0; + return 0; } } From patchwork Thu Mar 10 14:34:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= X-Patchwork-Id: 12776483 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 lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 F36FBC433FE for ; Thu, 10 Mar 2022 14:34:36 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.288418.489041 (Exim 4.92) (envelope-from ) id 1nSJrx-0001me-JM; Thu, 10 Mar 2022 14:34:21 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 288418.489041; Thu, 10 Mar 2022 14:34:21 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nSJrx-0001lw-E7; Thu, 10 Mar 2022 14:34:21 +0000 Received: by outflank-mailman (input) for mailman id 288418; Thu, 10 Mar 2022 14:34:20 +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 1nSJrw-0001j9-93 for xen-devel@lists.xenproject.org; Thu, 10 Mar 2022 14:34:20 +0000 Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 2aff97be-a07f-11ec-8539-5f4723681683; Thu, 10 Mar 2022 15:34:19 +0100 (CET) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 657353200D25; Thu, 10 Mar 2022 09:34:17 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Thu, 10 Mar 2022 09:34:18 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 10 Mar 2022 09:34:15 -0500 (EST) 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: 2aff97be-a07f-11ec-8539-5f4723681683 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=GGlD5fqFfDHwCS2CyKZrzEWK6VNmaqqEkjCd1dwys 3E=; b=nAvSF+HvetmwTrmYzR6hO9z+RwIur5L+Wzpzs53Y+EDx6rtWWpis2HmnW wD9irOAuXdFBeXR4Pc9VQ6siRcIS7il7fM5mbiylWIHapF5Wys/Cv0dksb5nbeAJ teU3LTA0xooEG3BT95Bp5OHEppoKmvHAU6zSbgottfW8Y1B5rzOqP0rLuS2VOeph 13Nd9MIO81Z4jS/ZEk0Jc2hF6qGg7EiWoMwTzmCn/N8G03I2DL2DloDmcxAD9Kvm 866eugbxBF1hKfcuSJSW9dpiWbZPcRK7NEzoA5PQHDxmlNA5awBV5/OXag4TyUQT JiBhY17fAIWxhumMehCGM9IPWQl1g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddruddvtddgieeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfgggtohfgsehtkeertdertdejnecuhfhrohhmpeforghr vghkucforghrtgiihihkohifshhkihdqifpkrhgvtghkihcuoehmrghrmhgrrhgvkhesih hnvhhishhisghlvghthhhinhhgshhlrggsrdgtohhmqeenucggtffrrghtthgvrhhnpeek jefhkeffkeekkeffiefhhffhledtgfejleeikeevffegfeelueehueeuleeljeenucevlh hushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrghrmhgrrhgv khesihhnvhhishhisghlvghthhhinhhgshhlrggsrdgtohhm X-ME-Proxy: From: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= To: xen-devel@lists.xenproject.org Cc: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [PATCH 2/2] ns16550: Add support for Intel LPSS UART Date: Thu, 10 Mar 2022 15:34:03 +0100 Message-Id: <20220310143403.50944-2-marmarek@invisiblethingslab.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220310143403.50944-1-marmarek@invisiblethingslab.com> References: <20220310143403.50944-1-marmarek@invisiblethingslab.com> MIME-Version: 1.0 Organization: Invisible Things Lab This adds support for serial console as found in a laptop with TGL-LP (StarBook MkV). Since the device is on the bus 0, it needs to be enabled via "com1=...,amt", not just "...,pci". Device specification is in Intel docs 631119-007 and 631120-001. Signed-off-by: Marek Marczykowski-Górecki Reviewed-by: Jan Beulich --- This adds only a single device (UART#2) to the table - the only one I have present, but the specification includes other device ids too. Should I add them too? I don't have a way to test that, though. --- xen/drivers/char/ns16550.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c index 2d7c8c11bc69..edf981db22f4 100644 --- a/xen/drivers/char/ns16550.c +++ b/xen/drivers/char/ns16550.c @@ -91,6 +91,7 @@ struct ns16550_config { param_exar_xr17v352, param_exar_xr17v354, param_exar_xr17v358, + param_intel_lpss, } param; }; @@ -822,6 +823,16 @@ static const struct ns16550_config_param __initconst uart_param[] = { .mmio = 1, .max_ports = 8, }, + [param_intel_lpss] = { + .uart_offset = 0x000, + .reg_shift = 2, + .reg_width = 1, + .fifo_size = 64, + .lsr_mask = UART_LSR_THRE, + .bar0 = 1, + .mmio = 1, + .max_ports = 1, + }, }; static const struct ns16550_config __initconst uart_config[] = @@ -1066,6 +1077,12 @@ static const struct ns16550_config __initconst uart_config[] = .dev_id = 0x0358, .param = param_exar_xr17v358 }, + /* Intel Corp. TGL-LP LPSS PCI */ + { + .vendor_id = PCI_VENDOR_ID_INTEL, + .dev_id = 0xa0c7, + .param = param_intel_lpss + }, }; static int __init