Skip to content

Commit fac9567

Browse files
John Garrywilldeacon
authored andcommitted
iommu/arm-smmu-v3: Stop pre-zeroing batch commands
Pre-zeroing the batched commands structure is inefficient, as individual commands are zeroed later in arm_smmu_cmdq_build_cmd(). The size is quite large and commonly most commands won't even be used: struct arm_smmu_cmdq_batch cmds = {}; 345c: 52800001 mov w1, #0x0 // #0 3460: d2808102 mov x2, #0x408 // Rust-for-Linux#1032 3464: 910143a0 add x0, x29, #0x50 3468: 94000000 bl 0 <memset> Stop pre-zeroing the complete structure and only zero the num member. Signed-off-by: John Garry <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 2cbeaf3 commit fac9567

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,7 @@ static void arm_smmu_sync_cd(struct arm_smmu_domain *smmu_domain,
955955
size_t i;
956956
unsigned long flags;
957957
struct arm_smmu_master *master;
958-
struct arm_smmu_cmdq_batch cmds = {};
958+
struct arm_smmu_cmdq_batch cmds;
959959
struct arm_smmu_device *smmu = smmu_domain->smmu;
960960
struct arm_smmu_cmdq_ent cmd = {
961961
.opcode = CMDQ_OP_CFGI_CD,
@@ -965,6 +965,8 @@ static void arm_smmu_sync_cd(struct arm_smmu_domain *smmu_domain,
965965
},
966966
};
967967

968+
cmds.num = 0;
969+
968970
spin_lock_irqsave(&smmu_domain->devices_lock, flags);
969971
list_for_each_entry(master, &smmu_domain->devices, domain_head) {
970972
for (i = 0; i < master->num_streams; i++) {
@@ -1781,7 +1783,7 @@ int arm_smmu_atc_inv_domain(struct arm_smmu_domain *smmu_domain, int ssid,
17811783
unsigned long flags;
17821784
struct arm_smmu_cmdq_ent cmd;
17831785
struct arm_smmu_master *master;
1784-
struct arm_smmu_cmdq_batch cmds = {};
1786+
struct arm_smmu_cmdq_batch cmds;
17851787

17861788
if (!(smmu_domain->smmu->features & ARM_SMMU_FEAT_ATS))
17871789
return 0;
@@ -1805,6 +1807,8 @@ int arm_smmu_atc_inv_domain(struct arm_smmu_domain *smmu_domain, int ssid,
18051807

18061808
arm_smmu_atc_inv_to_cmd(ssid, iova, size, &cmd);
18071809

1810+
cmds.num = 0;
1811+
18081812
spin_lock_irqsave(&smmu_domain->devices_lock, flags);
18091813
list_for_each_entry(master, &smmu_domain->devices, domain_head) {
18101814
if (!master->ats_enabled)
@@ -1852,7 +1856,7 @@ static void __arm_smmu_tlb_inv_range(struct arm_smmu_cmdq_ent *cmd,
18521856
struct arm_smmu_device *smmu = smmu_domain->smmu;
18531857
unsigned long end = iova + size, num_pages = 0, tg = 0;
18541858
size_t inv_range = granule;
1855-
struct arm_smmu_cmdq_batch cmds = {};
1859+
struct arm_smmu_cmdq_batch cmds;
18561860

18571861
if (!size)
18581862
return;
@@ -1870,6 +1874,8 @@ static void __arm_smmu_tlb_inv_range(struct arm_smmu_cmdq_ent *cmd,
18701874
num_pages = size >> tg;
18711875
}
18721876

1877+
cmds.num = 0;
1878+
18731879
while (iova < end) {
18741880
if (smmu->features & ARM_SMMU_FEAT_RANGE_INV) {
18751881
/*

0 commit comments

Comments
 (0)