From: Jean-Philippe Brucker <Jean-Philippe.Brucker@arm.com>
To: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
Cc: "linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"iommu@lists.linux-foundation.org"
<iommu@lists.linux-foundation.org>,
Mark Rutland <Mark.Rutland@arm.com>,
"xieyisheng (A)" <xieyisheng1@huawei.com>,
Gabriele Paoloni <gabriele.paoloni@huawei.com>,
Catalin Marinas <Catalin.Marinas@arm.com>,
Will Deacon <Will.Deacon@arm.com>,
"okaya@codeaurora.org" <okaya@codeaurora.org>,
"yi.l.liu@intel.com" <yi.l.liu@intel.com>,
Lorenzo Pieralisi <Lorenzo.Pieralisi@arm.com>,
"ashok.raj@intel.com" <ashok.raj@intel.com>,
"tn@semihalf.com" <tn@semihalf.com>,
joro@8bytes.org
Subject: Re: [RFCv2 PATCH 14/36] iommu/arm-smmu-v3: Add support for Substream IDs
Date: Thu, 2 Nov 2017 15:51:53 +0000 [thread overview]
Message-ID: <20171102155152.GA11899@e106794-lin.localdomain> (raw)
In-Reply-To: <5FC3163CFD30C246ABAA99954A238FA838454887@FRAEML521-MBX.china.huawei.com>
Hi Shameer,
On Thu, Nov 02, 2017 at 12:49:32PM +0000, Shameerali Kolothum Thodi wrote:
> We had a go with this series on HiSIlicon D05 platform which doesn't have
> support for ssids/ATS/PRI, to make sure it generally works.
>
> But observed the below crash on boot,
>
> [ 16.009084] WARNING: CPU: 59 PID: 391 at mm/page_alloc.c:3883 __alloc_pages_nodemask+0x19c/0xc48
> [ 16.026797] Modules linked in:
> [ 16.032944] CPU: 59 PID: 391 Comm: kworker/59:1 Not tainted 4.14.0-rc1-159539-ge42aca3 #236
> [...]
> [ 16.068206] Workqueue: events deferred_probe_work_func
> [ 16.078557] task: ffff8017d38a0000 task.stack: ffff00000b198000
> [ 16.090486] PC is at __alloc_pages_nodemask+0x19c/0xc48
> [ 16.101013] LR is at __alloc_pages_nodemask+0xe0/0xc48
> [ 16.469220] [<ffff000008186b94>] __alloc_pages_nodemask+0x19c/0xc48
> [ 16.481854] [<ffff0000081d65b0>] alloc_pages_current+0x80/0xcc
> [ 16.493607] [<ffff000008182be8>] __get_free_pages+0xc/0x38
> [ 16.504661] [<ffff0000083c4d58>] swiotlb_alloc_coherent+0x64/0x190
> [ 16.517117] [<ffff00000809824c>] __dma_alloc+0x110/0x204
> [ 16.527820] [<ffff00000858e850>] dmam_alloc_coherent+0x88/0xf0
> [ 16.539575] [<ffff000008568884>] arm_smmu_domain_finalise_s1+0x60/0x248
> [ 16.552909] [<ffff00000856c104>] arm_smmu_attach_dev+0x264/0x300
> [ 16.565013] [<ffff00000855d40c>] __iommu_attach_device+0x48/0x5c
> [ 16.577117] [<ffff00000855e698>] iommu_group_add_device+0x144/0x3a4
> [ 16.589746] [<ffff00000855ed18>] iommu_group_get_for_dev+0x70/0xf8
> [ 16.602201] [<ffff00000856a314>] arm_smmu_add_device+0x1a4/0x418
> [ 16.614308] [<ffff00000849dfcc>] iort_iommu_configure+0xf0/0x16c
> [ 16.626416] [<ffff000008468c50>] acpi_dma_configure+0x30/0x70
> [ 16.637994] [<ffff00000858f00c>] dma_configure+0xa8/0xd4
> [ 16.648695] [<ffff00000857706c>] driver_probe_device+0x1a4/0x2dc
> [ 16.673081] [<ffff0000085752c8>] bus_for_each_drv+0x54/0x94
> [ 16.684307] [<ffff000008576db0>] __device_attach+0xc4/0x12c
> [ 16.695533] [<ffff000008577350>] device_initial_probe+0x10/0x18
> [ 16.707462] [<ffff0000085762b4>] bus_probe_device+0x90/0x98
>
> After a bit of debug it looks like on platforms where ssid is not supported,
> s1_cfg.num_contexts is set to zero and it eventually results in this crash
> in,
> arm_smmu_domain_finalise_s1() -->arm_smmu_alloc_cd_tables()-->
> arm_smmu_alloc_cd_leaf_table() as num_leaf_entries is zero.
>
> With the below fix, it works on D05 now,
>
> diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
> index 8ad90e2..51f5821 100644
> --- a/drivers/iommu/arm-smmu-v3.c
> +++ b/drivers/iommu/arm-smmu-v3.c
> @@ -2433,7 +2433,10 @@ static int arm_smmu_domain_finalise(struct iommu_domain *domain,
> domain->min_pasid = 1;
> domain->max_pasid = master->num_ssids - 1;
> smmu_domain->s1_cfg.num_contexts = master->num_ssids;
> + } else {
> + smmu_domain->s1_cfg.num_contexts = 1;
> }
> +
> smmu_domain->s1_cfg.can_stall = master->ste.can_stall;
> break;
> case ARM_SMMU_DOMAIN_NESTED:
>
>
> I am not sure this is right place do this. Please take a look.
Thanks for testing the series and reporting the bug. I added the
following patch to branch svm/current, does it work for you?
Thanks,
Jean
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
index 42c8378624ed..edda466adc81 100644
--- a/drivers/iommu/arm-smmu-v3.c
+++ b/drivers/iommu/arm-smmu-v3.c
@@ -3169,9 +3169,7 @@ static int arm_smmu_add_device(struct device *dev)
}
}
- if (smmu->ssid_bits)
- master->num_ssids = 1 << min(smmu->ssid_bits,
- fwspec->num_pasid_bits);
+ master->num_ssids = 1 << min(smmu->ssid_bits, fwspec->num_pasid_bits);
if (fwspec->can_stall && smmu->features & ARM_SMMU_FEAT_STALLS) {
master->can_fault = true;
next prev parent reply other threads:[~2017-11-02 15:50 UTC|newest]
Thread overview: 93+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-06 13:31 [RFCv2 PATCH 00/36] Process management for IOMMU + SVM for SMMUv3 Jean-Philippe Brucker
2017-10-06 13:31 ` [RFCv2 PATCH 02/36] iommu: Add a process_exit callback for device drivers Jean-Philippe Brucker
2017-10-06 13:31 ` [RFCv2 PATCH 03/36] iommu/process: Add public function to search for a process Jean-Philippe Brucker
2017-10-06 13:31 ` [RFCv2 PATCH 09/36] iommu/fault: Allow blocking fault handlers Jean-Philippe Brucker
[not found] ` <20171006133203.22803-10-jean-philippe.brucker-5wv7dgnIgG8@public.gmane.org>
2017-11-29 6:15 ` Yisheng Xie
[not found] ` <7e1c8ea4-e568-1000-17de-62f8562c7169-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2017-11-29 15:01 ` Jean-Philippe Brucker
[not found] ` <74891e35-17d8-5831-1ebd-18e00ce00d74-5wv7dgnIgG8@public.gmane.org>
2017-11-30 2:45 ` Yisheng Xie
2017-10-06 13:31 ` [RFCv2 PATCH 10/36] vfio: Add support for Shared Virtual Memory Jean-Philippe Brucker
2017-11-24 8:23 ` Bob Liu
2017-11-24 10:58 ` Jean-Philippe Brucker
2017-10-06 13:31 ` [RFCv2 PATCH 11/36] iommu/arm-smmu-v3: Link domains and devices Jean-Philippe Brucker
2017-10-06 13:31 ` [RFCv2 PATCH 12/36] dt-bindings: document stall and PASID properties for IOMMU masters Jean-Philippe Brucker
[not found] ` <20171006133203.22803-13-jean-philippe.brucker-5wv7dgnIgG8@public.gmane.org>
2017-10-13 19:10 ` Rob Herring
2017-10-16 10:23 ` Jean-Philippe Brucker
[not found] ` <e7288f51-1cfa-44ce-e3ce-e9f3daf91579-5wv7dgnIgG8@public.gmane.org>
2017-10-18 2:06 ` Rob Herring
2017-10-06 13:31 ` [RFCv2 PATCH 14/36] iommu/arm-smmu-v3: Add support for Substream IDs Jean-Philippe Brucker
2017-11-02 12:49 ` Shameerali Kolothum Thodi
2017-11-02 15:51 ` Jean-Philippe Brucker [this message]
2017-11-02 17:02 ` Shameerali Kolothum Thodi
2017-11-03 5:45 ` Yisheng Xie
2017-11-03 9:37 ` Jean-Philippe Brucker
2017-11-03 9:39 ` Shameerali Kolothum Thodi
2017-11-06 0:50 ` Yisheng Xie
2017-10-06 13:31 ` [RFCv2 PATCH 15/36] iommu/arm-smmu-v3: Add second level of context descriptor table Jean-Philippe Brucker
2017-10-06 13:31 ` [RFCv2 PATCH 16/36] iommu/arm-smmu-v3: Add support for VHE Jean-Philippe Brucker
2017-10-06 13:31 ` [RFCv2 PATCH 17/36] iommu/arm-smmu-v3: Support broadcast TLB maintenance Jean-Philippe Brucker
2017-10-06 13:31 ` [RFCv2 PATCH 18/36] iommu/arm-smmu-v3: Add SVM feature checking Jean-Philippe Brucker
[not found] ` <20171006133203.22803-1-jean-philippe.brucker-5wv7dgnIgG8@public.gmane.org>
2017-10-06 13:31 ` [RFCv2 PATCH 01/36] iommu: Keep track of processes and PASIDs Jean-Philippe Brucker
[not found] ` <20171006133203.22803-2-jean-philippe.brucker-5wv7dgnIgG8@public.gmane.org>
2017-10-20 23:32 ` Sinan Kaya
2017-11-02 16:20 ` Jean-Philippe Brucker
2017-11-08 17:50 ` Bharat Kumar Gogada
2017-11-09 12:13 ` Jean-Philippe Brucker
[not found] ` <BLUPR0201MB150538FDD455F6042803B54FA5560-hRBPhS1iNj/g9tdZWAsUFxrHTHEw16jenBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-11-09 12:16 ` Jean-Philippe Brucker
[not found] ` <16b6ba80-b15b-b278-0d06-350ae0201e82-5wv7dgnIgG8@public.gmane.org>
2017-11-13 11:06 ` Bharat Kumar Gogada
2017-10-23 11:04 ` Liu, Yi L
2017-10-23 12:17 ` Jean-Philippe Brucker
[not found] ` <7aaf9851-9546-f34d-1496-cbeea404abbd-5wv7dgnIgG8@public.gmane.org>
2017-10-25 18:05 ` Raj, Ashok
2017-10-30 10:28 ` Jean-Philippe Brucker
2017-11-22 3:15 ` Bob Liu
2017-11-22 13:04 ` Jean-Philippe Brucker
[not found] ` <42f815ee-2a9a-ac49-2392-5c03c1d4c809-5wv7dgnIgG8@public.gmane.org>
2017-11-23 10:33 ` Bob Liu
2017-10-06 13:31 ` [RFCv2 PATCH 04/36] iommu/process: Track process changes with an mmu_notifier Jean-Philippe Brucker
2017-10-06 13:31 ` [RFCv2 PATCH 05/36] iommu/process: Bind and unbind process to and from devices Jean-Philippe Brucker
2017-10-11 11:33 ` Joerg Roedel
2017-10-12 11:13 ` Jean-Philippe Brucker
[not found] ` <ee7f80e3-ca30-0ee7-53f3-3e57b2b58df6-5wv7dgnIgG8@public.gmane.org>
2017-10-12 12:47 ` Joerg Roedel
[not found] ` <20171006133203.22803-6-jean-philippe.brucker-5wv7dgnIgG8@public.gmane.org>
2017-10-21 15:47 ` Sinan Kaya
[not found] ` <683a518d-0e22-c855-2416-2e097ec3291d-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-11-02 16:21 ` Jean-Philippe Brucker
2017-11-29 6:08 ` Yisheng Xie
2017-11-29 15:01 ` Jean-Philippe Brucker
2017-11-30 1:11 ` Yisheng Xie
2017-11-30 13:39 ` Jean-Philippe Brucker
2018-01-19 4:52 ` Sinan Kaya
[not found] ` <0772e71e-4861-1e7b-f248-88aaba8bf2fc-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-01-19 10:27 ` Jean-Philippe Brucker
2018-01-19 13:07 ` okaya
2017-10-06 13:31 ` [RFCv2 PATCH 06/36] iommu: Extend fault reporting Jean-Philippe Brucker
2017-10-06 13:31 ` [RFCv2 PATCH 07/36] iommu: Add a fault handler Jean-Philippe Brucker
2017-10-06 13:31 ` [RFCv2 PATCH 08/36] iommu/fault: Handle mm faults Jean-Philippe Brucker
2017-10-06 13:31 ` [RFCv2 PATCH 13/36] iommu/of: Add stall and pasid properties to iommu_fwspec Jean-Philippe Brucker
2017-10-06 13:31 ` [RFCv2 PATCH 19/36] arm64: mm: Pin down ASIDs for sharing contexts with devices Jean-Philippe Brucker
2017-10-06 13:31 ` [RFCv2 PATCH 20/36] iommu/arm-smmu-v3: Track ASID state Jean-Philippe Brucker
2017-10-06 13:31 ` [RFCv2 PATCH 21/36] iommu/arm-smmu-v3: Implement process operations Jean-Philippe Brucker
2017-11-09 3:32 ` Yisheng Xie
2017-11-09 12:08 ` Jean-Philippe Brucker
2017-10-06 13:31 ` [RFCv2 PATCH 23/36] iommu/arm-smmu-v3: Share process page tables Jean-Philippe Brucker
2017-10-06 13:31 ` [RFCv2 PATCH 28/36] iommu/arm-smmu-v3: Maintain a SID->device structure Jean-Philippe Brucker
2017-10-06 13:31 ` [RFCv2 PATCH 29/36] iommu/arm-smmu-v3: Add stall support for platform devices Jean-Philippe Brucker
2017-10-06 13:31 ` [RFCv2 PATCH 30/36] ACPI/IORT: Check ATS capability in root complex nodes Jean-Philippe Brucker
2017-10-06 13:32 ` [RFCv2 PATCH 34/36] PCI: Make "PRG Response PASID Required" handling common Jean-Philippe Brucker
[not found] ` <20171006133203.22803-35-jean-philippe.brucker-5wv7dgnIgG8@public.gmane.org>
2017-10-06 18:11 ` Bjorn Helgaas
2017-10-06 13:32 ` [RFCv2 PATCH 35/36] iommu/arm-smmu-v3: Add support for PRI Jean-Philippe Brucker
2017-10-06 13:31 ` [RFCv2 PATCH 22/36] iommu/io-pgtable-arm: Factor out ARM LPAE register defines Jean-Philippe Brucker
2017-10-06 13:31 ` [RFCv2 PATCH 24/36] iommu/arm-smmu-v3: Steal private ASID from a domain Jean-Philippe Brucker
2017-10-06 13:31 ` [RFCv2 PATCH 25/36] iommu/arm-smmu-v3: Use shared ASID set Jean-Philippe Brucker
2017-10-06 13:31 ` [RFCv2 PATCH 26/36] iommu/arm-smmu-v3: Add support for Hardware Translation Table Update Jean-Philippe Brucker
2017-12-06 6:51 ` Yisheng Xie
[not found] ` <d2ec2e61-f758-0394-41d2-555ae65feb0d-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2017-12-06 11:06 ` Jean-Philippe Brucker
2017-10-06 13:31 ` [RFCv2 PATCH 27/36] iommu/arm-smmu-v3: Register fault workqueue Jean-Philippe Brucker
2017-10-06 13:31 ` [RFCv2 PATCH 31/36] iommu/arm-smmu-v3: Add support for PCI ATS Jean-Philippe Brucker
2017-11-16 14:19 ` Bharat Kumar Gogada
[not found] ` <BLUPR0201MB150565029F9260A528739ACBA52E0-hRBPhS1iNj/g9tdZWAsUFxrHTHEw16jenBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-11-16 15:03 ` Jean-Philippe Brucker
[not found] ` <673fda01-2ae0-87e4-637e-fe27096b6be0-5wv7dgnIgG8@public.gmane.org>
2017-11-17 6:11 ` Bharat Kumar Gogada
[not found] ` <BLUPR0201MB1505BC86D3838D13F38665E7A52F0-hRBPhS1iNj/g9tdZWAsUFxrHTHEw16jenBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-11-17 11:39 ` Jean-Philippe Brucker
2017-10-06 13:31 ` [RFCv2 PATCH 32/36] iommu/arm-smmu-v3: Hook ATC invalidation to process ops Jean-Philippe Brucker
2017-10-06 13:32 ` [RFCv2 PATCH 33/36] iommu/arm-smmu-v3: Disable tagged pointers Jean-Philippe Brucker
2017-10-06 13:32 ` [RFCv2 PATCH 36/36] iommu/arm-smmu-v3: Add support for PCI PASID Jean-Philippe Brucker
2017-10-09 9:49 ` [RFCv2 PATCH 00/36] Process management for IOMMU + SVM for SMMUv3 Yisheng Xie
2017-10-09 11:36 ` Jean-Philippe Brucker
[not found] ` <0fecd29e-eaf7-9503-b087-7bfbc251da88-5wv7dgnIgG8@public.gmane.org>
2017-10-12 12:05 ` Yisheng Xie
2017-10-12 12:55 ` Jean-Philippe Brucker
[not found] ` <8a1e090d-22e8-0295-a53f-bc3b5b7d7971-5wv7dgnIgG8@public.gmane.org>
2017-10-12 15:28 ` Jordan Crouse
2017-11-08 1:21 ` Bob Liu
2017-11-08 10:50 ` Jean-Philippe Brucker
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=20171102155152.GA11899@e106794-lin.localdomain \
--to=jean-philippe.brucker@arm.com \
--cc=Catalin.Marinas@arm.com \
--cc=Lorenzo.Pieralisi@arm.com \
--cc=Mark.Rutland@arm.com \
--cc=Will.Deacon@arm.com \
--cc=ashok.raj@intel.com \
--cc=devicetree@vger.kernel.org \
--cc=gabriele.paoloni@huawei.com \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=okaya@codeaurora.org \
--cc=shameerali.kolothum.thodi@huawei.com \
--cc=tn@semihalf.com \
--cc=xieyisheng1@huawei.com \
--cc=yi.l.liu@intel.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;
as well as URLs for NNTP newsgroup(s).