From patchwork Mon Feb 19 15:21:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 203148 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1360793dyc; Mon, 19 Feb 2024 07:35:40 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVxdc4eyCODkOpb4wIcUA2BqyJ3N2JiJVE+Jem5sGeQhHAdypyEVGWQjSQr47FZLnKR5iyJDRRnCzsybwpBRSjO4OLYcQ== X-Google-Smtp-Source: AGHT+IFKfLiVYURdRKWQg6BNa56ByMg26fVTvSdzbj6UUt+ZsevMoDUNMGy8NGibQJVWZqy+X5Xw X-Received: by 2002:a05:6a20:9398:b0:1a0:9ab0:982a with SMTP id x24-20020a056a20939800b001a09ab0982amr4341174pzh.26.1708356940243; Mon, 19 Feb 2024 07:35:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708356940; cv=pass; d=google.com; s=arc-20160816; b=Vorv+SruIWHLkYZ+6TVaWSOTYCluiGM8/0e65vQgc2ZN2TAcWWAAJ8C7+Oy6o6DxTI 598KqkkWhmXsjy5yPvgmUn7pFBgvQabBMYsCxYPHiotW++WEwsukqhnFTPb8bzWoUYTs qcD6jXOf3NhYiTCftLe6ZIULNKR4Sn2gz7/UNXdZRRKFudgW75nehOyh1YfVbKWa4wrm SY724C1A5Fuc2+JCbzP8HL8BWKewVKf+QygVaV+w3nId/8/uS47xZ0iYMFOWKNPw0zeh kKaB0ggGl0K8UFVUiYDcAxPr22UmxNrqHowbijrhOY6th4giQpZ9v0HWQETTz+tbGu4g 7dBA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=8ltsHf1PwnnRBNn4pYqVf92/T9hGBxHrz+dtWVE8uYw=; fh=YYAYLgD2ndzh4BtJ78N7IkpWnJwlXbC9ziFeWxG2hOM=; b=S7jUlRjUoJyctnArKjoOV+kgaRx2MYpXeqjnLR27mbVedq5zJX9j5qmDLXRPRUnyWi lF4YYwYG12NwensRq/cjhv7DyO7XMrYuXrirTKg1S6dHHUbsJVZeFlXSRlbbwlVbBAMB Jy4mghMKB8EnVsDoGBE2uTwdvtFLys/Pn2ekt2A9U8GsL2hMYD+ygbKlP6WhIAmCK3Dr aJXGmLGuxbSMdXAxSJOKgFWuxaI8EYnxrNicsaHlX7a6UBOOCi604t1Gr65knZfIGCzt aBmEiBS7UxG/1WUdPLElLu6ASjz3xVbGtVqi/nUiKle1EyaUlErFpXogIucKck8I+C7W IOFA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Gige87Op; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=6iNM42ud; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-71577-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71577-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id l10-20020a65680a000000b005dca7a43069si4535609pgt.603.2024.02.19.07.35.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 07:35:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71577-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Gige87Op; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=6iNM42ud; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-71577-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71577-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id DA0C8B23FCA for ; Mon, 19 Feb 2024 15:21:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EDF4738FA5; Mon, 19 Feb 2024 15:21:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Gige87Op"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="6iNM42ud" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D88C338389; Mon, 19 Feb 2024 15:21:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708356084; cv=none; b=kyrWLoL8jLYG4CNle+E0geJ5kg+D1URdx+tltlO9cyKlCO1HU6qV0Tmvxa+03aVhuYVGPo058vxWiEVL/ihQtpf5ollu/BcXXKzelZqc6y2HpQlK0hHduS43qpOKBkJKcOQ+P6ORwmO1XMSiEJVhxW64ve4dJbeWKVx3rIfQrQ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708356084; c=relaxed/simple; bh=G2cvM0uYCACv57fHf4T3QzA7HExl9j/2O59IDZ0UxGU=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=sXy4TUb6Pb0UuaAm/8ho1KYjvLmQFHo8E70CYsmn8LgtkCGNJvADz0JyVpEQtRyF3VLgEldrsGGVV0dlQ+wfjri8Qo7R7/xnt00/zqXwcyFaONBCOkNNYbgNXtZdq2UGA+Nytaa2plI58dWDPSRkRzc1K6CaBqMn6JuEPoh8GqM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Gige87Op; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=6iNM42ud; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Mon, 19 Feb 2024 15:21:20 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1708356081; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8ltsHf1PwnnRBNn4pYqVf92/T9hGBxHrz+dtWVE8uYw=; b=Gige87Opi7VjCflOt1nd0zzjShhvwRwbYbhCnE7EXdwbyP54+wahAW7LKw8z0Zt7OOXc0f MYU+6AwielGbDFWcMTyM3NRYvCKIhWcCQs1EUf3RwKkeWzqa6R80Wx/q+gcNGHT9uszCyQ Npx8oMDQFTJgaf/FUjmKbb4DOPfa5P+kUcUemD0+czaQ6TT3smmzDmkpZhDstLM7/FmyQq Pj/S49U0+na/S8CF1O08X6CuzZLO+QWxPaEihSx/RMxPtrLTLPl6tl07BLXPPNpZxNzxg2 dAh16Y7J8FBkkRk74FcM1mC/KW7lCdKyEa54xN+QPZsJ0lF4Movsug46CboaSg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1708356081; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8ltsHf1PwnnRBNn4pYqVf92/T9hGBxHrz+dtWVE8uYw=; b=6iNM42udPMh3wflw8piWHMn4tr58N9QanjUMxYRhH6e6rvF11TQWDzTzrKAajfEcx3x9OD ZMY/tlabIARuBBCA== From: "tip-bot2 for Vidya Sagar" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: irq/urgent] PCI/MSI: Prevent MSI hardware interrupt number truncation Cc: Vidya Sagar , Thomas Gleixner , Shanker Donthineni , stable@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, maz@kernel.org In-Reply-To: <20240115135649.708536-1-vidyas@nvidia.com> References: <20240115135649.708536-1-vidyas@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170835608023.398.3330290067084127851.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791342086766816993 X-GMAIL-MSGID: 1791342086766816993 The following commit has been merged into the irq/urgent branch of tip: Commit-ID: db744ddd59be798c2627efbfc71f707f5a935a40 Gitweb: https://git.kernel.org/tip/db744ddd59be798c2627efbfc71f707f5a935a40 Author: Vidya Sagar AuthorDate: Mon, 15 Jan 2024 19:26:49 +05:30 Committer: Thomas Gleixner CommitterDate: Mon, 19 Feb 2024 16:11:01 +01:00 PCI/MSI: Prevent MSI hardware interrupt number truncation While calculating the hardware interrupt number for a MSI interrupt, the higher bits (i.e. from bit-5 onwards a.k.a domain_nr >= 32) of the PCI domain number gets truncated because of the shifted value casting to return type of pci_domain_nr() which is 'int'. This for example is resulting in same hardware interrupt number for devices 0019:00:00.0 and 0039:00:00.0. To address this cast the PCI domain number to 'irq_hw_number_t' before left shifting it to calculate the hardware interrupt number. Please note that this fixes the issue only on 64-bit systems and doesn't change the behavior for 32-bit systems i.e. the 32-bit systems continue to have the issue. Since the issue surfaces only if there are too many PCIe controllers in the system which usually is the case in modern server systems and they don't tend to run 32-bit kernels. Fixes: 3878eaefb89a ("PCI/MSI: Enhance core to support hierarchy irqdomain") Signed-off-by: Vidya Sagar Signed-off-by: Thomas Gleixner Tested-by: Shanker Donthineni Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20240115135649.708536-1-vidyas@nvidia.com --- drivers/pci/msi/irqdomain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/msi/irqdomain.c b/drivers/pci/msi/irqdomain.c index c8be056..cfd84a8 100644 --- a/drivers/pci/msi/irqdomain.c +++ b/drivers/pci/msi/irqdomain.c @@ -61,7 +61,7 @@ static irq_hw_number_t pci_msi_domain_calc_hwirq(struct msi_desc *desc) return (irq_hw_number_t)desc->msi_index | pci_dev_id(dev) << 11 | - (pci_domain_nr(dev->bus) & 0xFFFFFFFF) << 27; + ((irq_hw_number_t)(pci_domain_nr(dev->bus) & 0xFFFFFFFF)) << 27; } static void pci_msi_domain_set_desc(msi_alloc_info_t *arg,