Re: [PATCH 4.19 058/118] PCI: designware-ep: Use aligned ATU window for raising MSI interrupts

From: Pavel Machek
Date: Sun Jun 16 2019 - 16:06:00 EST


Hi!

> diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c
> index de8635af4cde..739d97080d3b 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-ep.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c
> @@ -385,6 +385,7 @@ int dw_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, u8 func_no,
> {
> struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
> struct pci_epc *epc = ep->epc;
> + unsigned int aligned_offset;
> u16 msg_ctrl, msg_data;
> u32 msg_addr_lower, msg_addr_upper, reg;
> u64 msg_addr;
> @@ -410,13 +411,15 @@ int dw_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, u8 func_no,
> reg = ep->msi_cap + PCI_MSI_DATA_32;
> msg_data = dw_pcie_readw_dbi(pci, reg);
> }
> - msg_addr = ((u64) msg_addr_upper) << 32 | msg_addr_lower;
> + aligned_offset = msg_addr_lower & (epc->mem->page_size - 1);
> + msg_addr = ((u64)msg_addr_upper) << 32 |
> + (msg_addr_lower & ~aligned_offset);

This warks but is really... interesting code.

would (msg_addr_lower - aligned_offset) make more sense?

Thanks,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Attachment: signature.asc
Description: Digital signature