Message ID | c5499db2-2c25-4765-b9e0-1fa26da1cc45@moroto.mountain |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-33575-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2697397dyb; Mon, 22 Jan 2024 08:48:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IEe/sWsw2Ed1IVx+SYaF+178AazOGHGdbV2tfkZHUaULvJBsOaEegTBcvBZ94y2lr091bgg X-Received: by 2002:a05:6402:1487:b0:55c:4ef:f8d5 with SMTP id e7-20020a056402148700b0055c04eff8d5mr113061edv.8.1705942119618; Mon, 22 Jan 2024 08:48:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705942119; cv=pass; d=google.com; s=arc-20160816; b=Cu9+JhrLLo6fYX15Ck0rDSHYkxx2MG1a9UGGvJn4T0dw1hSZphGSCFUq3HqEglg1KO bOjwofDU5CEBWsfNdaiKvt0OKws9SulcPH0tnT0V1V+VavrLIW+JjNIa3og+LR4QwNBQ WvPszDxyFpKH9KuFpBRa9bbbEG88CMwJbotf81Z9QJMhARYOI/GkstCFq7ZKmLzzfcvO qai4vhgAwAzVjz7XqJSCKsy2luZNm56877Zuz28qnXnshgiQurMtoXZ+DuzXo/OESr3i Wff90Gf2yIPBCie2jXB6lO3EgW2I9z36j6xGs/WjyVCQxAL0VZBW3SfnUcSXGw+sQmjB S/ZA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:subject:cc:to:from :date:dkim-signature; bh=3NSmP683nHsYZ+QYwFDjWG0Am9VIQRDzOaWrn4+k4gg=; fh=eXzY3uCod0uoUhoSFH26hwNyKgz3imtHgoKrWTV58bE=; b=LSj/dD4H7I51Kor1NkS16dnlaHfXdU0YfqW3rqb/z0d+wgH3uKWCqj7vA17RK4bLZ4 rrRHU4gIOTDpRbbGNGdi85u1ACX3o7IPadObb/Oo3WQv92X3NoVW7/Wf727vgcmFNlvg LUHgLYPuuHq4THKamrTEwHKcT6rpIsij8R8sXIyTMtB82H3K/3FVBKLMrYmOyQqCjyRT /n46VGo4DZL0P18Xlqf2eDstE6wqyqLTcShLoKV8NI6BjTy1XGPISJEyry5w6jx5v2yX ZA3Sk5VCWYJ9YTBCrhV0ep6XXC7nVrSILF+r7ByXoXA8UyHHNPXVTxCbyCzvCwzZ54l8 5zZg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="D/yBbLD2"; 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-33575-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33575-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id w13-20020a056402268d00b00559ae01e2d4si6680490edd.691.2024.01.22.08.48.39 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 08:48:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33575-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="D/yBbLD2"; 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-33575-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33575-ouuuleilei=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 13EC61F24678 for <ouuuleilei@gmail.com>; Mon, 22 Jan 2024 16:48:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 56E0D405ED; Mon, 22 Jan 2024 15:21:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="D/yBbLD2" Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 18502405DA for <linux-kernel@vger.kernel.org>; Mon, 22 Jan 2024 15:21:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705936876; cv=none; b=f80uFBeqRAarSU4p6N8CYoGZUr63veWjVxYNKGnE3M7xK1hYk1BcgK5UyHwTsubWnDAlNoIaEyMw3F+3SE2yk28DqRlvNiKrd7/Q4sCCBLwXE0dQ9sC4D+4e6cArlvBM7rjetu/XlzE2se2kWshrwQUOO3RddFIColkbO2eAWjI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705936876; c=relaxed/simple; bh=fUfuTS1ONtt1Sc+QMJaOn6OAPkhCtiu6J0M8A7SoJa8=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=Mo5wUsmz9dPEvk9uqOy3lwTxP5NYNA7ElDN4WzOYflbSgqwmuoVgh4gvjXVTkUYT8X4ej9U93oYAreninYiyH1LmxSYi0G5HNlbNrQ04Ot8ZDhjti/sVbD28dSUoIpv7W2Hf9A4bQaOps5+ud4kUONxGb49SyrxSJDx4djYVGYs= 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=D/yBbLD2; arc=none smtp.client-ip=209.85.128.45 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-wm1-f45.google.com with SMTP id 5b1f17b1804b1-40e76626170so37624705e9.2 for <linux-kernel@vger.kernel.org>; Mon, 22 Jan 2024 07:21:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1705936873; x=1706541673; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:message-id:subject:cc :to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=3NSmP683nHsYZ+QYwFDjWG0Am9VIQRDzOaWrn4+k4gg=; b=D/yBbLD2Z9NmmMarOc0g3Zy4wqpJ7mmfYz+3x6zxlNkNMqU4w/Qf3lfBsQh0cbDSpD jFCtpNcZFf4yke329Grdm36+MJ9R7xTJ54V8fjPInO4xmgCln5+DRvyw2h/SnpqGOl1H PH5HeLlB5Ofl/8dTQSgbzIbko5kiF0B/Pd1m7tN+PMX2U9eVLrsbB+6dvZ6yqQZWxuCu MF+QTu/jcKUojmGVsCTMh2vBRwQQexgg8obr8Ys4kni+ggRa1dG4/CzAaMewQf/DME29 6+zodjrYx5izdXrGgwbA66xkStFN3cmzisE/dSCcu/QPflXYaC57PH7Xx7L/c6UoEJm4 B5Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705936873; x=1706541673; h=in-reply-to:content-disposition:mime-version:message-id:subject:cc :to:from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3NSmP683nHsYZ+QYwFDjWG0Am9VIQRDzOaWrn4+k4gg=; b=dqB8dsZBoxkB4/J6egYm4jytyLoPVEp8UCR+nEuLxpU/keBXNGFevPj3w2Ln5X/UEK tMxg9DLucTcNtK5dudOzdYM1BwUzrWGk5bpmEsOFCiFWLpEpceiY5g+wRh9Y2roooq9M VHpo3Vh/Ck8vfvS4kxhB8An16nuyRS2JG273US/hOOsFuysmywxW+nSpVemKXmYl86EY QaI4cPCKGxSLbnCIbPisjJcWAR/+9UUfsopHNQyO80ca7Wu3EPSCVpscg5vK/j4+bsmL H7/w92V1PZwFMhJPJYwNiCbZnJyQjiZ8TVe2R4ZLrTRBJO4uFGqPDLIbymd2aflnU8tY mSgQ== X-Gm-Message-State: AOJu0YxqeyjJFftlTdMp2HNVqRgBCpBlHymLyN0spxOzOfZO4HzWzXXO Gf5i80ZllnklQ0kgnYvy1W6byJHDgKKtPIEZmgvW0uARjtzqw7zj+3GHJpE2jbM= X-Received: by 2002:a05:600c:3847:b0:40e:553c:dace with SMTP id s7-20020a05600c384700b0040e553cdacemr2272796wmr.92.1705936873221; Mon, 22 Jan 2024 07:21:13 -0800 (PST) Received: from localhost ([102.140.209.237]) by smtp.gmail.com with ESMTPSA id jb13-20020a05600c54ed00b0040e418494absm38542327wmb.46.2024.01.22.07.21.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 07:21:13 -0800 (PST) Date: Mon, 22 Jan 2024 18:21:00 +0300 From: Dan Carpenter <dan.carpenter@linaro.org> To: Jingoo Han <jingoohan1@gmail.com> Cc: Gustavo Pimentel <gustavo.pimentel@synopsys.com>, Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>, Lorenzo Pieralisi <lpieralisi@kernel.org>, Krzysztof =?utf-8?q?Wilczy=C5=84?= =?utf-8?q?ski?= <kw@linux.com>, Rob Herring <robh@kernel.org>, Bjorn Helgaas <bhelgaas@google.com>, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH v3 2/2] PCI: dwc: Cleanup in dw_pcie_ep_raise_msi_irq() Message-ID: <c5499db2-2c25-4765-b9e0-1fa26da1cc45@moroto.mountain> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <d0d5b689-9437-43cd-8c1f-daa72aeafb2e@moroto.mountain> X-Mailer: git-send-email haha only kidding X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788809964000702608 X-GMAIL-MSGID: 1788809964000702608 |
Series |
[v3,1/2] PCI: dwc: Fix a 64bit bug in dw_pcie_ep_raise_msix_irq()
|
|
Commit Message
Dan Carpenter
Jan. 22, 2024, 3:21 p.m. UTC
I recently changed the code in dw_pcie_ep_raise_msix_irq() to use
ALIGN_DOWN(). The code in dw_pcie_ep_raise_msi_irq() is similar so
update it to match as well. (No effect on runtime, just a cleanup).
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
v2: Add this patch
v3: Use ALIGN_DOWN() as a style improvement
drivers/pci/controller/dwc/pcie-designware-ep.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On Mon, Jan 22, 2024 at 06:21:00PM +0300, Dan Carpenter wrote: > I recently changed the code in dw_pcie_ep_raise_msix_irq() to use > ALIGN_DOWN(). The code in dw_pcie_ep_raise_msi_irq() is similar so > update it to match as well. (No effect on runtime, just a cleanup). > > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> > --- > v2: Add this patch > v3: Use ALIGN_DOWN() as a style improvement > > drivers/pci/controller/dwc/pcie-designware-ep.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c > index 51679c6702cf..1c8d2e938851 100644 > --- a/drivers/pci/controller/dwc/pcie-designware-ep.c > +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c > @@ -483,8 +483,8 @@ int dw_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, u8 func_no, > msg_data = dw_pcie_ep_readw_dbi(ep, func_no, reg); > } > aligned_offset = msg_addr_lower & (epc->mem->window.page_size - 1); > - msg_addr = ((u64)msg_addr_upper) << 32 | > - (msg_addr_lower & ~aligned_offset); > + msg_addr = ((u64)msg_addr_upper) << 32 | msg_addr_lower; > + msg_addr = ALIGN_DOWN(msg_addr, epc->mem->window.page_size); > ret = dw_pcie_ep_map_addr(epc, func_no, 0, ep->msi_mem_phys, msg_addr, > epc->mem->window.page_size); > if (ret) > -- > 2.43.0 > Reviewed-by: Niklas Cassel <cassel@kernel.org> Although, if I'm being super nitpicky (sorry... and feel free to ignore), I think this is slightly cleaner: --- a/drivers/pci/controller/dwc/pcie-designware-ep.c +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c @@ -482,9 +482,10 @@ int dw_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, u8 func_no, reg = ep_func->msi_cap + PCI_MSI_DATA_32; msg_data = dw_pcie_ep_readw_dbi(ep, func_no, reg); } - aligned_offset = msg_addr_lower & (epc->mem->window.page_size - 1); - msg_addr = ((u64)msg_addr_upper) << 32 | - (msg_addr_lower & ~aligned_offset); + msg_addr = ((u64)msg_addr_upper) << 32 | msg_addr_lower; + + aligned_offset = msg_addr & (epc->mem->window.page_size - 1); + msg_addr = ALIGN_DOWN(msg_addr, epc->mem->window.page_size); ret = dw_pcie_ep_map_addr(epc, func_no, 0, ep->msi_mem_phys, msg_addr, epc->mem->window.page_size); if (ret)
diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c index 51679c6702cf..1c8d2e938851 100644 --- a/drivers/pci/controller/dwc/pcie-designware-ep.c +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c @@ -483,8 +483,8 @@ int dw_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, u8 func_no, msg_data = dw_pcie_ep_readw_dbi(ep, func_no, reg); } aligned_offset = msg_addr_lower & (epc->mem->window.page_size - 1); - msg_addr = ((u64)msg_addr_upper) << 32 | - (msg_addr_lower & ~aligned_offset); + msg_addr = ((u64)msg_addr_upper) << 32 | msg_addr_lower; + msg_addr = ALIGN_DOWN(msg_addr, epc->mem->window.page_size); ret = dw_pcie_ep_map_addr(epc, func_no, 0, ep->msi_mem_phys, msg_addr, epc->mem->window.page_size); if (ret)