On Fri Dec 06 19, Jerry Snitselaar wrote:
On Sat Dec 07 19, Lu Baolu wrote:
Hi Jerry,

On 12/6/19 3:24 PM, Jerry Snitselaar wrote:
On Fri Dec 06 19, Lu Baolu wrote:
[snip]

Can you please try below change? Let's check whether the afending
address has been mapped for device 01.00.2.

$ git diff
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index db7bfd4f2d20..d9daf66be849 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -663,6 +663,8 @@ static int iommu_group_create_direct_mappings(struct iommu_group *group,                        ret = iommu_map(domain, addr, addr, pg_size, entry->prot);
                       if (ret)
                               goto out;
+
+                       dev_info(dev, "Setting identity map [0x%Lx - 0x%Lx] for group %d\n", addr, addr + pg_size, group->id);
               }

       }

I am doubting that device 01.00.2 is not in the device scope of

[    4.485108] DMAR: RMRR base: 0x000000bdf6f000 end: 0x000000bdf7efff

By the way, does device 01.00.2 works well after binding the driver?


When I boot it with passthrough it doesn't get to a point where I can
login. I think the serial console on these systems is tied to the ilo,
so the conserver connection could be making things
worse. Unfortunately the system is remote. I should have more time now
to focus on debugging this.

Attaching console output for the above patch.

It seems that device 01.00.2 isn't in the scope of RMRR [base:
0x000000bdf6f000 end: 0x000000bdf7efff]. But it still tries to access
the address within it, hence faults generated.

You can check it with ACPI/DMAR table.

Best regards,
baolu


I believe it is the 3rd endpoint device entry in dmar data below.
So question about request_default_domain_for_dev. Since a dma mapping
is already done for 1.00.0, and that sets the default_domain for the
group (I think), won't it bail out for 1.00.2 at this check?

        if (group->default_domain && group->default_domain->type == type)
                goto out;


Or I guess request_default_domain_for_dev wouldn't even be called for 1.00.2.
intel_iommu_add_device it wouldn't even call one of the request
functions with 1.00.2 since domain->type would be dma from 1.00.0, and 
device_def_domain_type
should return dma.

output from lspci -t:

\-[0000:00]-+-00.0
            +-01.0-[08]--
            +-01.1-[14]--
            +-02.0-[03]--+-00.0
            |            +-00.1
            |            +-00.2
            |            \-00.3
            +-02.1-[15]--
            +-02.2-[02]----00.0
            +-02.3-[16]--
            +-03.0-[04-07]----00.0-[05-07]--+-02.0-[06]--+-00.0
            |                               |            \-00.1
            |                               \-04.0-[07]--+-00.0
            |                                            \-00.1
            +-03.1-[17]--
            +-03.2-[18]--
            +-03.3-[19]--
            +-04.0
            +-04.1
            +-04.2
            +-04.3
            +-04.4
            +-04.5
            +-04.6
            +-04.7
            +-05.0
            +-05.2
            +-05.4
            +-11.0-[1b]--
            +-1a.0
            +-1c.0-[0b]--
            +-1c.7-[01]--+-00.0
            |            +-00.1
            |            +-00.2
            |            \-00.4
            +-1d.0
            +-1e.0-[1a]--
            +-1f.0
            \-1f.2

DMAR table entries for the RMRR:

[302h 0770   2]                Subtable Type : 0001 [Reserved Memory Region]
[304h 0772   2]                       Length : 00CE

[306h 0774   2]                     Reserved : 0000
[308h 0776   2]           PCI Segment Number : 0000
[30Ah 0778   8]                 Base Address : 00000000BDF6F000
[312h 0786   8]          End Address (limit) : 00000000BDF7EFFF

[31Ah 0794   1]            Device Scope Type : 01 [PCI Endpoint Device]
[31Bh 0795   1]                 Entry Length : 0A
[31Ch 0796   2]                     Reserved : 0000
[31Eh 0798   1]               Enumeration ID : 00
[31Fh 0799   1]               PCI Bus Number : 00

[320h 0800   2]                     PCI Path : 02,02

[322h 0802   2]                     PCI Path : 00,00


[324h 0804   1]            Device Scope Type : 01 [PCI Endpoint Device]
[325h 0805   1]                 Entry Length : 0A
[326h 0806   2]                     Reserved : 0000
[328h 0808   1]               Enumeration ID : 00
[329h 0809   1]               PCI Bus Number : 00

[32Ah 0810   2]                     PCI Path : 1C,07

[32Ch 0812   2]                     PCI Path : 00,00


[32Eh 0814   1]            Device Scope Type : 01 [PCI Endpoint Device]
[32Fh 0815   1]                 Entry Length : 0A
[330h 0816   2]                     Reserved : 0000
[332h 0818   1]               Enumeration ID : 00
[333h 0819   1]               PCI Bus Number : 00

[334h 0820   2]                     PCI Path : 1C,07

[336h 0822   2]                     PCI Path : 00,02


[338h 0824   1]            Device Scope Type : 01 [PCI Endpoint Device]
[339h 0825   1]                 Entry Length : 08
[33Ah 0826   2]                     Reserved : 0000
[33Ch 0828   1]               Enumeration ID : 00
[33Dh 0829   1]               PCI Bus Number : 00

[33Eh 0830   2]                     PCI Path : 1F,02


[340h 0832   1]            Device Scope Type : 01 [PCI Endpoint Device]
[341h 0833   1]                 Entry Length : 08
[342h 0834   2]                     Reserved : 0000
[344h 0836   1]               Enumeration ID : 00
[345h 0837   1]               PCI Bus Number : 00

[346h 0838   2]                     PCI Path : 1F,05


[348h 0840   1]            Device Scope Type : 01 [PCI Endpoint Device]
[349h 0841   1]                 Entry Length : 0A
[34Ah 0842   2]                     Reserved : 0000
[34Ch 0844   1]               Enumeration ID : 00
[34Dh 0845   1]               PCI Bus Number : 00

[34Eh 0846   2]                     PCI Path : 02,00

[350h 0848   2]                     PCI Path : 00,00


[352h 0850   1]            Device Scope Type : 01 [PCI Endpoint Device]
[353h 0851   1]                 Entry Length : 0A
[354h 0852   2]                     Reserved : 0000
[356h 0854   1]               Enumeration ID : 00
[357h 0855   1]               PCI Bus Number : 00

[358h 0856   2]                     PCI Path : 02,00

[35Ah 0858   2]                     PCI Path : 00,01


[35Ch 0860   1]            Device Scope Type : 01 [PCI Endpoint Device]
[35Dh 0861   1]                 Entry Length : 0A
[35Eh 0862   2]                     Reserved : 0000
[360h 0864   1]               Enumeration ID : 00
[361h 0865   1]               PCI Bus Number : 00

[362h 0866   2]                     PCI Path : 02,00

[364h 0868   2]                     PCI Path : 00,02


[366h 0870   1]            Device Scope Type : 01 [PCI Endpoint Device]
[367h 0871   1]                 Entry Length : 0A
[368h 0872   2]                     Reserved : 0000
[36Ah 0874   1]               Enumeration ID : 00
[36Bh 0875   1]               PCI Bus Number : 00

[36Ch 0876   2]                     PCI Path : 02,00

[36Eh 0878   2]                     PCI Path : 00,03


[370h 0880   1]            Device Scope Type : 01 [PCI Endpoint Device]
[371h 0881   1]                 Entry Length : 0E
[372h 0882   2]                     Reserved : 0000
[374h 0884   1]               Enumeration ID : 00
[375h 0885   1]               PCI Bus Number : 00

[376h 0886   2]                     PCI Path : 03,00

[378h 0888   2]                     PCI Path : 00,00

[37Ah 0890   2]                     PCI Path : 02,00

[37Ch 0892   2]                     PCI Path : 00,00


[37Eh 0894   1]            Device Scope Type : 01 [PCI Endpoint Device]
[37Fh 0895   1]                 Entry Length : 0E
[380h 0896   2]                     Reserved : 0000
[382h 0898   1]               Enumeration ID : 00
[383h 0899   1]               PCI Bus Number : 00

[384h 0900   2]                     PCI Path : 03,00

[386h 0902   2]                     PCI Path : 00,00

[388h 0904   2]                     PCI Path : 02,00

[38Ah 0906   2]                     PCI Path : 00,01


[38Ch 0908   1]            Device Scope Type : 01 [PCI Endpoint Device]
[38Dh 0909   1]                 Entry Length : 0E
[38Eh 0910   2]                     Reserved : 0000
[390h 0912   1]               Enumeration ID : 00
[391h 0913   1]               PCI Bus Number : 00

[392h 0914   2]                     PCI Path : 03,00

[394h 0916   2]                     PCI Path : 00,00

[396h 0918   2]                     PCI Path : 04,00

[398h 0920   2]                     PCI Path : 00,00


[39Ah 0922   1]            Device Scope Type : 01 [PCI Endpoint Device]
[39Bh 0923   1]                 Entry Length : 0E
[39Ch 0924   2]                     Reserved : 0000
[39Eh 0926   1]               Enumeration ID : 00
[39Fh 0927   1]               PCI Bus Number : 00

[3A0h 0928   2]                     PCI Path : 03,00

[3A2h 0930   2]                     PCI Path : 00,00

[3A4h 0932   2]                     PCI Path : 04,00

[3A6h 0934   2]                     PCI Path : 00,01


[3A8h 0936   1]            Device Scope Type : 01 [PCI Endpoint Device]
[3A9h 0937   1]                 Entry Length : 0A
[3AAh 0938   2]                     Reserved : 0000
[3ACh 0940   1]               Enumeration ID : 00
[3ADh 0941   1]               PCI Bus Number : 20

[3AEh 0942   2]                     PCI Path : 02,02

[3B0h 0944   2]                     PCI Path : 00,00


[3B2h 0946   1]            Device Scope Type : 01 [PCI Endpoint Device]
[3B3h 0947   1]                 Entry Length : 0A
[3B4h 0948   2]                     Reserved : 0000
[3B6h 0950   1]               Enumeration ID : 00
[3B7h 0951   1]               PCI Bus Number : 20

[3B8h 0952   2]                     PCI Path : 02,02

[3BAh 0954   2]                     PCI Path : 00,01


[3BCh 0956   1]            Device Scope Type : 01 [PCI Endpoint Device]
[3BDh 0957   1]                 Entry Length : 0A
[3BEh 0958   2]                     Reserved : 0000
[3C0h 0960   1]               Enumeration ID : 00
[3C1h 0961   1]               PCI Bus Number : 20

[3C2h 0962   2]                     PCI Path : 02,02

[3C4h 0964   2]                     PCI Path : 00,02


[3C6h 0966   1]            Device Scope Type : 01 [PCI Endpoint Device]
[3C7h 0967   1]                 Entry Length : 0A
[3C8h 0968   2]                     Reserved : 0000
[3CAh 0970   1]               Enumeration ID : 00
[3CBh 0971   1]               PCI Bus Number : 20

[3CCh 0972   2]                     PCI Path : 02,02

[3CEh 0974   2]                     PCI Path : 00,03

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to