Linux IOMMU Development
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Auger Eric <eric.auger@redhat.com>
Cc: eric.auger.pro@gmail.com, marc.zyngier@arm.com,
	christoffer.dall@linaro.org, andre.przywara@arm.com,
	robin.murphy@arm.com, alex.williamson@redhat.com,
	will.deacon@arm.com, joro@8bytes.org, jason@lakedaemon.net,
	linux-arm-kernel@lists.infradead.org, drjones@redhat.com,
	kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org,
	pbonzini@redhat.com, linux-kernel@vger.kernel.org,
	Bharat.Bhushan@freescale.com, pranav.sawargaonkar@gmail.com,
	p.fedin@samsung.com, iommu@lists.linux-foundation.org,
	Jean-Philippe.Brucker@arm.com, yehuday@marvell.com,
	Manish.Jaggi@caviumnetworks.com,
	robert.richter@caviumnetworks.com
Subject: Re: [PATCH v11 10/10] genirq/msi: use the MSI doorbell's IOVA when requested
Date: Tue, 26 Jul 2016 11:04:18 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.11.1607261101340.19896@nanos> (raw)
In-Reply-To: <08a930f2-8cc9-7d99-78c0-77d08ee40db3@redhat.com>

Eric,

On Mon, 25 Jul 2016, Auger Eric wrote:
> On 20/07/2016 11:09, Thomas Gleixner wrote:
> > On Tue, 19 Jul 2016, Eric Auger wrote:
> >> @@ -63,10 +63,18 @@ static int msi_compose(struct irq_data *irq_data,
> >>  {
> >>  	int ret = 0;
> >>  
> >> -	if (erase)
> >> +	if (erase) {
> >>  		memset(msg, 0, sizeof(*msg));
> >> -	else
> >> +	} else {
> >> +		struct device *dev;
> >> +
> >>  		ret = irq_chip_compose_msi_msg(irq_data, msg);
> >> +		if (ret)
> >> +			return ret;
> >> +
> >> +		dev = msi_desc_to_dev(irq_data_get_msi_desc(irq_data));
> >> +		WARN_ON(iommu_msi_msg_pa_to_va(dev, msg));
> > 
> > What the heck is this call doing? And why is there only a WARN_ON and not a
> > proper error return code handling?
> 
> iommu_msi_msg_pa_to_va is part of the new iommu-msi API introduced in PART I
> of this series. This helper function detects the physical address found in
> the MSI message has a corresponding allocated IOVA. This happens if the MSI
> doorbell is accessed through an IOMMU and this IOMMU do not bypass the MSI
> addresses (ARM case). Allocation of this IOVA was performed in the previous
> patch.
>
> So, if this is the case, the physical address is swapped with the IOVA
> address. That way the PCIe device will send the MSI with this IOVA and
> the address will be translated by the IOMMU into the target MSI doorbell PA.
> 
> Hope this clarifies

No, it does not. You are explaining in great length what that function is
doing, but you are not explaining WHY your don't do a proper return code
handling and just do a WARN_ON() and happily proceed. If that function fails
then the interrupt will not be functional, so WHY on earth are you continuing?

Thanks,

	tglx

  reply	other threads:[~2016-07-26  9:04 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-19 13:02 [PATCH v11 00/10] KVM PCIe/MSI passthrough on ARM/ARM64: kernel part 2/3: msi changes Eric Auger
     [not found] ` <1468933367-23159-1-git-send-email-eric.auger-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-07-19 13:02   ` [PATCH v11 01/10] genirq/msi: export msi_get_domain_info Eric Auger
2016-07-19 13:02   ` [PATCH v11 05/10] genirq/msi-doorbell: msi_doorbell_pages Eric Auger
2016-07-19 14:38     ` Thomas Gleixner
2016-07-20  7:50       ` Auger Eric
2016-07-21 13:38       ` Auger Eric
2016-07-19 13:02   ` [PATCH v11 07/10] irqchip/gicv2m: register the MSI global doorbell Eric Auger
2016-07-19 13:02   ` [PATCH v11 08/10] irqchip/gicv3-its: " Eric Auger
2016-07-19 13:02   ` [PATCH v11 10/10] genirq/msi: use the MSI doorbell's IOVA when requested Eric Auger
2016-07-20  9:09     ` Thomas Gleixner
2016-07-25 16:31       ` Auger Eric
2016-07-26  9:04         ` Thomas Gleixner [this message]
2016-07-26 10:02           ` Auger Eric
2016-07-19 13:02 ` [PATCH v11 02/10] genirq/msi: msi_compose wrapper Eric Auger
2016-07-19 13:02 ` [PATCH v11 03/10] genirq/irq: introduce msi_doorbell_info Eric Auger
2016-07-19 14:15   ` Thomas Gleixner
2016-07-19 13:02 ` [PATCH v11 04/10] genirq/msi-doorbell: allow MSI doorbell (un)registration Eric Auger
2016-07-19 14:22   ` Thomas Gleixner
2016-07-20  7:50     ` Auger Eric
2016-07-19 13:02 ` [PATCH v11 06/10] genirq/msi-doorbell: msi_doorbell_safe Eric Auger
2016-07-20  8:12   ` Thomas Gleixner
2016-07-21 13:38     ` Auger Eric
2016-07-22 12:44       ` Thomas Gleixner
2016-07-22 14:08         ` Auger Eric
2016-07-19 13:02 ` [PATCH v11 09/10] genirq/msi: map/unmap the MSI doorbells on msi_domain_alloc/free_irqs Eric Auger
2016-07-20  9:04   ` Thomas Gleixner
2016-07-25 16:21     ` Auger Eric
2016-07-26  9:00       ` Thomas Gleixner
2016-07-26  9:54         ` Auger Eric
2016-07-26 11:01           ` Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.11.1607261101340.19896@nanos \
    --to=tglx@linutronix.de \
    --cc=Bharat.Bhushan@freescale.com \
    --cc=Jean-Philippe.Brucker@arm.com \
    --cc=Manish.Jaggi@caviumnetworks.com \
    --cc=alex.williamson@redhat.com \
    --cc=andre.przywara@arm.com \
    --cc=christoffer.dall@linaro.org \
    --cc=drjones@redhat.com \
    --cc=eric.auger.pro@gmail.com \
    --cc=eric.auger@redhat.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jason@lakedaemon.net \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=p.fedin@samsung.com \
    --cc=pbonzini@redhat.com \
    --cc=pranav.sawargaonkar@gmail.com \
    --cc=robert.richter@caviumnetworks.com \
    --cc=robin.murphy@arm.com \
    --cc=will.deacon@arm.com \
    --cc=yehuday@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox