File tree Expand file tree Collapse file tree 5 files changed +15
-10
lines changed Expand file tree Collapse file tree 5 files changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -4730,20 +4730,20 @@ const struct attribute_group *intel_iommu_groups[] = {
4730
4730
NULL ,
4731
4731
};
4732
4732
4733
- static inline bool has_untrusted_dev (void )
4733
+ static inline bool has_external_pci (void )
4734
4734
{
4735
4735
struct pci_dev * pdev = NULL ;
4736
4736
4737
4737
for_each_pci_dev (pdev )
4738
- if (pdev -> untrusted )
4738
+ if (pdev -> external_facing )
4739
4739
return true ;
4740
4740
4741
4741
return false;
4742
4742
}
4743
4743
4744
4744
static int __init platform_optin_force_iommu (void )
4745
4745
{
4746
- if (!dmar_platform_optin () || no_platform_optin || !has_untrusted_dev ())
4746
+ if (!dmar_platform_optin () || no_platform_optin || !has_external_pci ())
4747
4747
return 0 ;
4748
4748
4749
4749
if (no_iommu || dmar_disabled )
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ void pci_set_bus_of_node(struct pci_bus *bus)
42
42
} else {
43
43
node = of_node_get (bus -> self -> dev .of_node );
44
44
if (node && of_property_read_bool (node , "external-facing" ))
45
- bus -> self -> untrusted = true;
45
+ bus -> self -> external_facing = true;
46
46
}
47
47
48
48
bus -> dev .of_node = node ;
Original file line number Diff line number Diff line change @@ -1213,7 +1213,7 @@ static void pci_acpi_optimize_delay(struct pci_dev *pdev,
1213
1213
ACPI_FREE (obj );
1214
1214
}
1215
1215
1216
- static void pci_acpi_set_untrusted (struct pci_dev * dev )
1216
+ static void pci_acpi_set_external_facing (struct pci_dev * dev )
1217
1217
{
1218
1218
u8 val ;
1219
1219
@@ -1224,11 +1224,10 @@ static void pci_acpi_set_untrusted(struct pci_dev *dev)
1224
1224
1225
1225
/*
1226
1226
* These root ports expose PCIe (including DMA) outside of the
1227
- * system so make sure we treat them and everything behind as
1228
- * untrusted.
1227
+ * system. Everything downstream from them is external.
1229
1228
*/
1230
1229
if (val )
1231
- dev -> untrusted = 1 ;
1230
+ dev -> external_facing = 1 ;
1232
1231
}
1233
1232
1234
1233
static void pci_acpi_setup (struct device * dev )
@@ -1240,7 +1239,7 @@ static void pci_acpi_setup(struct device *dev)
1240
1239
return ;
1241
1240
1242
1241
pci_acpi_optimize_delay (pci_dev , adev -> handle );
1243
- pci_acpi_set_untrusted (pci_dev );
1242
+ pci_acpi_set_external_facing (pci_dev );
1244
1243
pci_acpi_add_edr_notifier (pci_dev );
1245
1244
1246
1245
pci_acpi_add_pm_notifier (adev , pci_dev );
Original file line number Diff line number Diff line change @@ -1552,7 +1552,7 @@ static void set_pcie_untrusted(struct pci_dev *dev)
1552
1552
* untrusted as well.
1553
1553
*/
1554
1554
parent = pci_upstream_bridge (dev );
1555
- if (parent && parent -> untrusted )
1555
+ if (parent && ( parent -> untrusted || parent -> external_facing ) )
1556
1556
dev -> untrusted = true;
1557
1557
}
1558
1558
Original file line number Diff line number Diff line change @@ -432,6 +432,12 @@ struct pci_dev {
432
432
* mappings to make sure they cannot access arbitrary memory.
433
433
*/
434
434
unsigned int untrusted :1 ;
435
+ /*
436
+ * Info from the platform, e.g., ACPI or device tree, may mark a
437
+ * device as "external-facing". An external-facing device is
438
+ * itself internal but devices downstream from it are external.
439
+ */
440
+ unsigned int external_facing :1 ;
435
441
unsigned int broken_intx_masking :1 ; /* INTx masking can't be used */
436
442
unsigned int io_window_1k :1 ; /* Intel bridge 1K I/O windows */
437
443
unsigned int irq_managed :1 ;
You can’t perform that action at this time.
0 commit comments