Skip to content

Commit 434b73e

Browse files
jpbruckerjoergroedel
authored andcommitted
iommu/arm-smmu-v3: Use device properties for pasid-num-bits
The pasid-num-bits property shouldn't need a dedicated fwspec field, it's a job for device properties. Add properties for IORT, and access the number of PASID bits using device_property_read_u32(). Suggested-by: Robin Murphy <[email protected]> Acked-by: Jonathan Cameron <[email protected]> Acked-by: Will Deacon <[email protected]> Reviewed-by: Eric Auger <[email protected]> Signed-off-by: Jean-Philippe Brucker <[email protected]> Acked-by: Hanjun Guo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 0d35309 commit 434b73e

File tree

4 files changed

+9
-14
lines changed

4 files changed

+9
-14
lines changed

drivers/acpi/arm64/iort.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -968,15 +968,16 @@ static int iort_pci_iommu_init(struct pci_dev *pdev, u16 alias, void *data)
968968
static void iort_named_component_init(struct device *dev,
969969
struct acpi_iort_node *node)
970970
{
971+
struct property_entry props[2] = {};
971972
struct acpi_iort_named_component *nc;
972-
struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
973-
974-
if (!fwspec)
975-
return;
976973

977974
nc = (struct acpi_iort_named_component *)node->node_data;
978-
fwspec->num_pasid_bits = FIELD_GET(ACPI_IORT_NC_PASID_BITS,
979-
nc->node_flags);
975+
props[0] = PROPERTY_ENTRY_U32("pasid-num-bits",
976+
FIELD_GET(ACPI_IORT_NC_PASID_BITS,
977+
nc->node_flags));
978+
979+
if (device_add_properties(dev, props))
980+
dev_warn(dev, "Could not add device properties\n");
980981
}
981982

982983
static int iort_nc_iommu_map(struct device *dev, struct acpi_iort_node *node)

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2392,7 +2392,8 @@ static struct iommu_device *arm_smmu_probe_device(struct device *dev)
23922392
}
23932393
}
23942394

2395-
master->ssid_bits = min(smmu->ssid_bits, fwspec->num_pasid_bits);
2395+
device_property_read_u32(dev, "pasid-num-bits", &master->ssid_bits);
2396+
master->ssid_bits = min(smmu->ssid_bits, master->ssid_bits);
23962397

23972398
/*
23982399
* Note that PASID must be enabled before, and disabled after ATS:

drivers/iommu/of_iommu.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,6 @@ const struct iommu_ops *of_iommu_configure(struct device *dev,
210210
of_pci_iommu_init, &info);
211211
} else {
212212
err = of_iommu_configure_device(master_np, dev, id);
213-
214-
fwspec = dev_iommu_fwspec_get(dev);
215-
if (!err && fwspec)
216-
of_property_read_u32(master_np, "pasid-num-bits",
217-
&fwspec->num_pasid_bits);
218213
}
219214

220215
/*

include/linux/iommu.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,15 +572,13 @@ struct iommu_group *fsl_mc_device_group(struct device *dev);
572572
* @ops: ops for this device's IOMMU
573573
* @iommu_fwnode: firmware handle for this device's IOMMU
574574
* @flags: IOMMU_FWSPEC_* flags
575-
* @num_pasid_bits: number of PASID bits supported by this device
576575
* @num_ids: number of associated device IDs
577576
* @ids: IDs which this device may present to the IOMMU
578577
*/
579578
struct iommu_fwspec {
580579
const struct iommu_ops *ops;
581580
struct fwnode_handle *iommu_fwnode;
582581
u32 flags;
583-
u32 num_pasid_bits;
584582
unsigned int num_ids;
585583
u32 ids[];
586584
};

0 commit comments

Comments
 (0)