Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp776104rdb; Sun, 18 Feb 2024 11:06:57 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWHHKlwmvSDJfs3YFLvQgZTMYavpcpn5Yzmypbtn4ZSL1OlLfepqy+8t8+jeMCHJbs4KuoislKy7PIEnVuPV9PYl0Yy4oW/RBPXs3TJJw== X-Google-Smtp-Source: AGHT+IFZKNfGb8Qy1jSGtE7cHkCt/KlAxNHu/BED8hCSl0lTwYyXvXErMszxGjFd5wav7OrLiuWg X-Received: by 2002:a17:902:d54c:b0:1db:a0f1:0 with SMTP id z12-20020a170902d54c00b001dba0f10000mr10623326plf.28.1708283217192; Sun, 18 Feb 2024 11:06:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708283217; cv=pass; d=google.com; s=arc-20160816; b=r35Hr7qv+KtiQo9K+QJ6333WO0POVKY+0Sxz+skUPsZ3hBIUhh0NKFRZlqteXMDClW jzWPChAQCCJiRuFH0+uFf2KeJqu1VlF0Dxan4HsXJaKPXaxkr+DXik4yusZuHG6mRi2T 232t5PWK9J1XXeKxZf1qBEP8e09vb5nPXo2H17+GgHe0chumUFoFa2/op/9hKxUbNB5P jMvpgnPfUrhEJOGZVpmK0ssbbnUJrOs3UN2kym1GIA+sDJgoomfymH2z3FdYrsgF3/ja F2iJsHOn5wZgy2iinMfLMzze0woq3VXRuqtZ6y3Z6KH4vdHPknKuzwPJ3SsaQSMqSyG/ Q5Dg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=Pkl65YWoZqBRy7PXp9WalSTMwRYxXFsGyTDBtpnT5Zg=; fh=CcwBWppwIOFVs4Mqz5tGu256xta/OELTqej5gcz5/5M=; b=Xw136oYi/JU7JcOYQHaGZTubSe0jrJPAFJd3qXWtFDTa5Xnx6XuqvWM8+LRiAt7NS/ ulWz8HTeC2OFcNsOsdR8eIuQrLdiXjoTbFKBInKOtUyITODuAecCBTjDl6OMFDsFq0PN wc+XUDJJbvteXWKQkrsIZx5x5apbdUPaecqZcIkrAeTYLsf3Bch3UEP1AmNRuohtyX1X RWRqmKndMF0pHf++Dns5ZZFhEOl/N+nlTVh3j+MiKWXJlhATgO5zEOhKHc5zhr8eJqgo Vqtx/AsIbL6jw4Ua4XXbmShb1SB+6POei+zDtbk54wh3P5HSQ+ooG6ja3nSMAwasZwKT gLSQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kKpsh04U; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-70535-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70535-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id q9-20020a17090311c900b001db9e68b35asi3121687plh.363.2024.02.18.11.06.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 11:06:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70535-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kKpsh04U; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-70535-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70535-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id DB08A280EEA for ; Sun, 18 Feb 2024 19:06:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A186374E25; Sun, 18 Feb 2024 19:04:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="kKpsh04U" Received: from mail-io1-f52.google.com (mail-io1-f52.google.com [209.85.166.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4CE79745F6 for ; Sun, 18 Feb 2024 19:04:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708283097; cv=none; b=a5lDq5T1OHf0KrnfLn/A0Nr83KYf6uCIQgJVcyRA9CxDuDSJU/9Fe+Jz37mOG8TN4G6Qcwh7zq/yrBdJjGdcK4osqDgpg4bQVy1Jkxo0dT59EZH/I0wCgzvMD8Am3ZMzLP00LCjxIiTD1icBjEwKEh35hBnTFcnTSQlFPAn9QII= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708283097; c=relaxed/simple; bh=EiHEARKfsSch8CWg3qSOqrgsBmJrYMqzousU6JGvsio=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=LeXbL7BX7Oo8tnuRknSEDUsS2k9BTE1+OKcoDMD8yIq7PpBq9ualIbapO4T7EyJpJ5Jc1N2z6sSv22hsi0SbEqOUXnF/QNuNlALJGylvtTKUsAAhoxHimaPPL50EZgpOMizPFrEP+69boniXHub5OHXYQI9U87fHGJbxRtPKFZc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=kKpsh04U; arc=none smtp.client-ip=209.85.166.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-io1-f52.google.com with SMTP id ca18e2360f4ac-7c48e13e0d7so134543039f.1 for ; Sun, 18 Feb 2024 11:04:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708283095; x=1708887895; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Pkl65YWoZqBRy7PXp9WalSTMwRYxXFsGyTDBtpnT5Zg=; b=kKpsh04U8AChJFNvvcK2Ypa5nxuU1bHtMcF3zIopO7rd6k+gU7sTHPQVGhUBe7T3+/ SyR88IB/HfQO76TU76Qi/Bv2kL2/HE75Rm7MCB1NtwEgoI481MOHedeDZUuFJgKmnGpy UWqak5GMtrBPCuEXrcwWrwfxNmyoONtxhmcuQzizK9BVjciqoWsLGs5ONKx7pfFtYxq+ gOKS6HCsrsjVscKeIcMPpEJGZ3eme7QK4dBssRzt2vRUrpusHhwV4wJXm6K14Wi/FDX6 m1syRbF5wEQK7jQWIuZo03St9ZILsJqSfI71uFvDI99WKA0W0qumTaUhewBWPqICLBXC 9b4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708283095; x=1708887895; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Pkl65YWoZqBRy7PXp9WalSTMwRYxXFsGyTDBtpnT5Zg=; b=IxpyTdHFMddsHSDi+nzmbyeeUIntuwiroxcsh4F/MporlJExV0YpKF2HKeTOIEOXvD 195NxCq/3f3rEpx9a9EZT4QH3ZeIJsq/KIivhLEwRpHY9bRuOduca7ASDBMRde10Aufi gUXja9dgJeFy8QP6RS2JJ3xz78LxOIhIjBLycQ09dl2e1awlV78QU0X60tYmjxVY9iRO hJRVs5ujVYSENnWJFC4GOBhkWDlFCEEkIKvuml9HVzKmpibXqc3Lv7Z75xrxAQY7RPOW wIN8miqdF7QewXrEZk1WVRxilt3vRxEfx0b9JnGmhxw20FrsYBx+AaBEdd0jYm7s6OUd 9gMw== X-Forwarded-Encrypted: i=1; AJvYcCXLj7DyUC4lf4JBFciTSC/yrHDiv3GMf+obPxSzakaxlJVEZn+4b0o9oHk4Iiji5JmplMAT5s/YVcyvRWyOCRG3HfhfkSNHSF92Vp0M X-Gm-Message-State: AOJu0Yzk1f15fdvBh6+Vi8iiyNSv+bYZN2AGoI5HR4RGyof0KuPy3iRG GAVHFhSj2IlflgC+/tFfFafxRiJSUaT9aJ0iJCUzvYOCo3N6AR2XLUtA+zN4V7w= X-Received: by 2002:a6b:6113:0:b0:7c3:ec35:8df7 with SMTP id v19-20020a6b6113000000b007c3ec358df7mr12455709iob.3.1708283095387; Sun, 18 Feb 2024 11:04:55 -0800 (PST) Received: from localhost.localdomain (c-98-61-227-136.hsd1.mn.comcast.net. [98.61.227.136]) by smtp.gmail.com with ESMTPSA id t125-20020a6bc383000000b007c4926ebed8sm1300105iof.40.2024.02.18.11.04.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 11:04:54 -0800 (PST) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: mka@chromium.org, andersson@kernel.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: ipa: don't overrun IPA suspend interrupt registers Date: Sun, 18 Feb 2024 13:04:50 -0600 Message-Id: <20240218190450.331390-1-elder@linaro.org> X-Mailer: git-send-email 2.40.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In newer hardware, IPA supports more than 32 endpoints. Some registers--such as IPA interrupt registers--represent endpoints as bits in a 4-byte register, and such registers are repeated as needed to represent endpoints beyond the first 32. In ipa_interrupt_suspend_clear_all(), we clear all pending IPA suspend interrupts by reading all status register(s) and writing corresponding registers to clear interrupt conditions. Unfortunately the number of registers to read/write is calculated incorrectly, and as a result we access *many* more registers than intended. This bug occurs only when the IPA hardware signals a SUSPEND interrupt, which happens when a packet is received for an endpoint (or its underlying GSI channel) that is suspended. This situation is difficult to reproduce, but possible. Fix this by correctly computing the number of interrupt registers to read and write. This is the only place in the code where registers that map endpoints or channels this way perform this calculation. Fixes: f298ba785e2d ("net: ipa: add a parameter to suspend registers") Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_interrupt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ipa/ipa_interrupt.c b/drivers/net/ipa/ipa_interrupt.c index 4bc05948f772d..a78c692f2d3c5 100644 --- a/drivers/net/ipa/ipa_interrupt.c +++ b/drivers/net/ipa/ipa_interrupt.c @@ -212,7 +212,7 @@ void ipa_interrupt_suspend_clear_all(struct ipa_interrupt *interrupt) u32 unit_count; u32 unit; - unit_count = roundup(ipa->endpoint_count, 32); + unit_count = DIV_ROUND_UP(ipa->endpoint_count, 32); for (unit = 0; unit < unit_count; unit++) { const struct reg *reg; u32 val; -- 2.40.1