From: David Daney <ddaney-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
To: Marc Zyngier <marc.zyngier-5wv7dgnIgG8@public.gmane.org>,
Tirumalesh Chalamarla
<Tirumalesh.Chalamarla-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
Cc: Prasun.Kapoor-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org,
jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org,
suzuki.poulose-5wv7dgnIgG8@public.gmane.org,
catalin.marinas-5wv7dgnIgG8@public.gmane.org,
Geetha sowjanya
<gakula-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>,
will.deacon-5wv7dgnIgG8@public.gmane.org,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
james.morse-5wv7dgnIgG8@public.gmane.org,
tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH v2] arm64: SMMU-v2: Workaround for Cavium ThunderX erratum 28168
Date: Tue, 15 Nov 2016 10:24:22 -0800 [thread overview]
Message-ID: <582B52D6.6060907@caviumnetworks.com> (raw)
In-Reply-To: <0414d797-7134-8192-d373-b14b26edd023-5wv7dgnIgG8@public.gmane.org>
On 11/15/2016 01:26 AM, Marc Zyngier wrote:
> On 15/11/16 07:00, Geetha sowjanya wrote:
>> From: Tirumalesh Chalamarla <Tirumalesh.Chalamarla-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
>>
>> This patch implements Cavium ThunderX erratum 28168.
>>
>> PCI requires stores complete in order. Due to erratum #28168
>> PCI-inbound MSI-X store to the interrupt controller are delivered
>> to the interrupt controller before older PCI-inbound memory stores
>> are committed.
>> Doing a sync on SMMU will make sure all prior data transfers are
>> completed before invoking ISR.
>>
>> Signed-off-by: Tirumalesh Chalamarla <Tirumalesh.Chalamarla-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
>> Signed-off-by: Geetha sowjanya <gakula-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
[...]
>> --- a/drivers/irqchip/irq-gic-v3.c
>> +++ b/drivers/irqchip/irq-gic-v3.c
>> @@ -28,6 +28,8 @@
>> #include <linux/of_irq.h>
>> #include <linux/percpu.h>
>> #include <linux/slab.h>
>> +#include <linux/msi.h>
>> +#include <linux/pci.h>
>>
>> #include <linux/irqchip.h>
>> #include <linux/irqchip/arm-gic-common.h>
>> @@ -736,6 +738,20 @@ static inline void gic_cpu_pm_init(void) { }
>>
>> #define GIC_ID_NR (1U << gic_data.rdists.id_bits)
>>
>> +/*
>> + * Due to #28168 erratum in ThunderX,
>> + * we need to make sure DMA data transfer is done before MSIX.
>> + */
>> +static void cavium_irq_perflow_handler(struct irq_data *data)
>> +{
>> + struct pci_dev *pdev;
>> +
>> + pdev = msi_desc_to_pci_dev(irq_data_get_msi_desc(data));
>
> What happens if this is not a PCI device?
>
>> + if ((pdev->vendor != 0x177d) &&
>> + ((pdev->device & 0xA000) != 0xA000))
>> + cavium_arm_smmu_tlb_sync(&pdev->dev);
>
> I've asked that before. What makes Cavium devices so special that they
> are not sensitive to this bug?
This is a heuristic for devices connected to external PCIe buses as
opposed to on-SoC devices (which don't suffer from the erratum).
In any event what would happen if we got rid of this check and ...
>
>> +}
>> +
>> static int gic_irq_domain_map(struct irq_domain *d, unsigned int irq,
>> irq_hw_number_t hw)
>> {
>> @@ -773,6 +789,9 @@ static int gic_irq_domain_map(struct irq_domain *d, unsigned int irq,
>> return -EPERM;
>> irq_domain_set_info(d, irq, hw, chip, d->host_data,
>> handle_fasteoi_irq, NULL, NULL);
>> + if (cpus_have_cap(ARM64_WORKAROUND_CAVIUM_28168))
>> + __irq_set_preflow_handler(irq,
>> + cavium_irq_perflow_handler);
>
... move the registration of the preflow_handler into a
msi_domain_ops.msi_finish() handler in irq-git-v3-its-pic-msi.c?
There we will know that it is a pci device, and can walk up the bus
hierarchy to see if there is a Cavium PCIe root port present. If such a
port is found, we know we are on an external Cavium PCIe bus, and can
register the preflow_handler without having to check the device identifiers.
> What happens if SMMUv2 is not compiled in? Also, since this only affects
> LPI signaling, why is this in the core GICv3 code and not in the ITS.
> And more specifically, in the PCI part of the ITS, since you seem to
> exclusively consider PCI?
>
>> }
>>
>> return 0;
>>
>
> Thanks,
>
> M.
>
WARNING: multiple messages have this Message-ID (diff)
From: ddaney@caviumnetworks.com (David Daney)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] arm64: SMMU-v2: Workaround for Cavium ThunderX erratum 28168
Date: Tue, 15 Nov 2016 10:24:22 -0800 [thread overview]
Message-ID: <582B52D6.6060907@caviumnetworks.com> (raw)
In-Reply-To: <0414d797-7134-8192-d373-b14b26edd023@arm.com>
On 11/15/2016 01:26 AM, Marc Zyngier wrote:
> On 15/11/16 07:00, Geetha sowjanya wrote:
>> From: Tirumalesh Chalamarla <Tirumalesh.Chalamarla@cavium.com>
>>
>> This patch implements Cavium ThunderX erratum 28168.
>>
>> PCI requires stores complete in order. Due to erratum #28168
>> PCI-inbound MSI-X store to the interrupt controller are delivered
>> to the interrupt controller before older PCI-inbound memory stores
>> are committed.
>> Doing a sync on SMMU will make sure all prior data transfers are
>> completed before invoking ISR.
>>
>> Signed-off-by: Tirumalesh Chalamarla <Tirumalesh.Chalamarla@cavium.com>
>> Signed-off-by: Geetha sowjanya <gakula@caviumnetworks.com>
[...]
>> --- a/drivers/irqchip/irq-gic-v3.c
>> +++ b/drivers/irqchip/irq-gic-v3.c
>> @@ -28,6 +28,8 @@
>> #include <linux/of_irq.h>
>> #include <linux/percpu.h>
>> #include <linux/slab.h>
>> +#include <linux/msi.h>
>> +#include <linux/pci.h>
>>
>> #include <linux/irqchip.h>
>> #include <linux/irqchip/arm-gic-common.h>
>> @@ -736,6 +738,20 @@ static inline void gic_cpu_pm_init(void) { }
>>
>> #define GIC_ID_NR (1U << gic_data.rdists.id_bits)
>>
>> +/*
>> + * Due to #28168 erratum in ThunderX,
>> + * we need to make sure DMA data transfer is done before MSIX.
>> + */
>> +static void cavium_irq_perflow_handler(struct irq_data *data)
>> +{
>> + struct pci_dev *pdev;
>> +
>> + pdev = msi_desc_to_pci_dev(irq_data_get_msi_desc(data));
>
> What happens if this is not a PCI device?
>
>> + if ((pdev->vendor != 0x177d) &&
>> + ((pdev->device & 0xA000) != 0xA000))
>> + cavium_arm_smmu_tlb_sync(&pdev->dev);
>
> I've asked that before. What makes Cavium devices so special that they
> are not sensitive to this bug?
This is a heuristic for devices connected to external PCIe buses as
opposed to on-SoC devices (which don't suffer from the erratum).
In any event what would happen if we got rid of this check and ...
>
>> +}
>> +
>> static int gic_irq_domain_map(struct irq_domain *d, unsigned int irq,
>> irq_hw_number_t hw)
>> {
>> @@ -773,6 +789,9 @@ static int gic_irq_domain_map(struct irq_domain *d, unsigned int irq,
>> return -EPERM;
>> irq_domain_set_info(d, irq, hw, chip, d->host_data,
>> handle_fasteoi_irq, NULL, NULL);
>> + if (cpus_have_cap(ARM64_WORKAROUND_CAVIUM_28168))
>> + __irq_set_preflow_handler(irq,
>> + cavium_irq_perflow_handler);
>
... move the registration of the preflow_handler into a
msi_domain_ops.msi_finish() handler in irq-git-v3-its-pic-msi.c?
There we will know that it is a pci device, and can walk up the bus
hierarchy to see if there is a Cavium PCIe root port present. If such a
port is found, we know we are on an external Cavium PCIe bus, and can
register the preflow_handler without having to check the device identifiers.
> What happens if SMMUv2 is not compiled in? Also, since this only affects
> LPI signaling, why is this in the core GICv3 code and not in the ITS.
> And more specifically, in the PCI part of the ITS, since you seem to
> exclusively consider PCI?
>
>> }
>>
>> return 0;
>>
>
> Thanks,
>
> M.
>
next prev parent reply other threads:[~2016-11-15 18:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-15 7:00 [PATCH v2] arm64: SMMU-v2: Workaround for Cavium ThunderX erratum 28168 Geetha sowjanya
2016-11-15 7:00 ` Geetha sowjanya
[not found] ` <1479193220-6693-1-git-send-email-gakula-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
2016-11-15 9:26 ` Marc Zyngier
2016-11-15 9:26 ` Marc Zyngier
[not found] ` <0414d797-7134-8192-d373-b14b26edd023-5wv7dgnIgG8@public.gmane.org>
2016-11-15 12:36 ` Robin Murphy
2016-11-15 12:36 ` Robin Murphy
2016-11-15 18:24 ` David Daney [this message]
2016-11-15 18:24 ` David Daney
[not found] ` <582B52D6.6060907-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
2016-11-16 9:54 ` Marc Zyngier
2016-11-16 9:54 ` Marc Zyngier
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=582B52D6.6060907@caviumnetworks.com \
--to=ddaney-m3mlkvoiwjvv6pq1l3v1odbpr1lh4cv8@public.gmane.org \
--cc=Prasun.Kapoor-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org \
--cc=Tirumalesh.Chalamarla-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org \
--cc=catalin.marinas-5wv7dgnIgG8@public.gmane.org \
--cc=gakula-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=james.morse-5wv7dgnIgG8@public.gmane.org \
--cc=jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=marc.zyngier-5wv7dgnIgG8@public.gmane.org \
--cc=suzuki.poulose-5wv7dgnIgG8@public.gmane.org \
--cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
--cc=will.deacon-5wv7dgnIgG8@public.gmane.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.