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; } }