[PATCH v3 03/14] PCI: rcar: Convert to MSI domains

Marc Zyngier maz at kernel.org
Thu Apr 1 11:38:19 BST 2021


On Thu, 01 Apr 2021 11:19:57 +0100,
Lorenzo Pieralisi <lorenzo.pieralisi at arm.com> wrote:
> 
> On Tue, Mar 30, 2021 at 04:11:34PM +0100, Marc Zyngier wrote:
> 
> [...]
> 
> > +static void rcar_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
> > +{
> > +	struct rcar_msi *msi = irq_data_get_irq_chip_data(data);
> > +	unsigned long pa = virt_to_phys(msi);
> >  
> > -	hwirq = rcar_msi_alloc_region(msi, nvec);
> > -	if (hwirq < 0)
> > -		return -ENOSPC;
> > +	/* Use the msi structure as the PA for the MSI doorbell */
> > +	msg->address_lo = lower_32_bits(pa);
> > +	msg->address_hi = upper_32_bits(pa);
> 
> I don't think this change is aligned with the previous patch (is it ?),
> the PA address we are using here is different from the one programmed
> into the controller registers - either that or I am missing something,
> please let me know.

Err. You are right. This looks like a bad case of broken conflict
resolution on my part.

The following snippet should fix it. Let me know if you want me to
resend the whole thing or whether you are OK with applying this by
hand.

Thanks,

	M.

diff --git a/drivers/pci/controller/pcie-rcar-host.c b/drivers/pci/controller/pcie-rcar-host.c
index f7331ad0d6dc..765cf2b45e24 100644
--- a/drivers/pci/controller/pcie-rcar-host.c
+++ b/drivers/pci/controller/pcie-rcar-host.c
@@ -573,11 +573,10 @@ static int rcar_msi_set_affinity(struct irq_data *d, const struct cpumask *mask,
 static void rcar_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
 {
 	struct rcar_msi *msi = irq_data_get_irq_chip_data(data);
-	unsigned long pa = virt_to_phys(msi);
+	struct rcar_pcie *pcie = &msi_to_host(msi)->pcie;
 
-	/* Use the msi structure as the PA for the MSI doorbell */
-	msg->address_lo = lower_32_bits(pa);
-	msg->address_hi = upper_32_bits(pa);
+	msg->address_lo = rcar_pci_read_reg(pcie, PCIEMSIALR) & ~MSIFE;
+	msg->address_hi = rcar_pci_read_reg(pcie, PCIEMSIAUR);
 	msg->data = data->hwirq;
 }
 

-- 
Without deviation from the norm, progress is not possible.



More information about the Linux-mediatek mailing list