Skip to content

Commit 52d9691

Browse files
committed
Merge branches 'apple/dart', 'arm/mediatek', 'arm/renesas', 'arm/smmu', 'arm/tegra', 'iommu/fixes', 'x86/amd', 'x86/vt-d' and 'core' into next
10 parents 8bb7eca + 5a009fc + f13efaf + 1cdeb52 + 07f34a1 + 8937424 + ac315f9 + 9f78e44 + 9906b93 + ab6f4b0 commit 52d9691

24 files changed

Lines changed: 367 additions & 243 deletions

File tree

Documentation/devicetree/bindings/iommu/arm,smmu.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ properties:
3333
- description: Qcom SoCs implementing "arm,mmu-500"
3434
items:
3535
- enum:
36+
- qcom,qcm2290-smmu-500
3637
- qcom,sc7180-smmu-500
3738
- qcom,sc7280-smmu-500
3839
- qcom,sc8180x-smmu-500
3940
- qcom,sdm845-smmu-500
41+
- qcom,sm6350-smmu-500
4042
- qcom,sm8150-smmu-500
4143
- qcom,sm8250-smmu-500
4244
- qcom,sm8350-smmu-500

Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ properties:
4343
- renesas,ipmmu-r8a77980 # R-Car V3H
4444
- renesas,ipmmu-r8a77990 # R-Car E3
4545
- renesas,ipmmu-r8a77995 # R-Car D3
46+
- renesas,ipmmu-r8a779a0 # R-Car V3U
4647

4748
reg:
4849
maxItems: 1

arch/x86/include/asm/fpu/api.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,4 @@ extern int cpu_has_xfeatures(u64 xfeatures_mask, const char **feature_name);
106106
*/
107107
#define PASID_DISABLED 0
108108

109-
static inline void update_pasid(void) { }
110-
111109
#endif /* _ASM_X86_FPU_API_H */

drivers/iommu/amd/amd_iommu_types.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@
138138
#define EVENT_DOMID_MASK_HI 0xf0000
139139
#define EVENT_FLAGS_MASK 0xfff
140140
#define EVENT_FLAGS_SHIFT 0x10
141+
#define EVENT_FLAG_RW 0x020
142+
#define EVENT_FLAG_I 0x008
141143

142144
/* feature control bits */
143145
#define CONTROL_IOMMU_EN 0x00ULL

drivers/iommu/amd/iommu.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,12 @@ static void amd_iommu_report_rmp_fault(volatile u32 *event)
473473
pci_dev_put(pdev);
474474
}
475475

476+
#define IS_IOMMU_MEM_TRANSACTION(flags) \
477+
(((flags) & EVENT_FLAG_I) == 0)
478+
479+
#define IS_WRITE_REQUEST(flags) \
480+
((flags) & EVENT_FLAG_RW)
481+
476482
static void amd_iommu_report_page_fault(u16 devid, u16 domain_id,
477483
u64 address, int flags)
478484
{
@@ -485,6 +491,20 @@ static void amd_iommu_report_page_fault(u16 devid, u16 domain_id,
485491
dev_data = dev_iommu_priv_get(&pdev->dev);
486492

487493
if (dev_data) {
494+
/*
495+
* If this is a DMA fault (for which the I(nterrupt)
496+
* bit will be unset), allow report_iommu_fault() to
497+
* prevent logging it.
498+
*/
499+
if (IS_IOMMU_MEM_TRANSACTION(flags)) {
500+
if (!report_iommu_fault(&dev_data->domain->domain,
501+
&pdev->dev, address,
502+
IS_WRITE_REQUEST(flags) ?
503+
IOMMU_FAULT_WRITE :
504+
IOMMU_FAULT_READ))
505+
goto out;
506+
}
507+
488508
if (__ratelimit(&dev_data->rs)) {
489509
pci_err(pdev, "Event logged [IO_PAGE_FAULT domain=0x%04x address=0x%llx flags=0x%04x]\n",
490510
domain_id, address, flags);
@@ -495,6 +515,7 @@ static void amd_iommu_report_page_fault(u16 devid, u16 domain_id,
495515
domain_id, address, flags);
496516
}
497517

518+
out:
498519
if (pdev)
499520
pci_dev_put(pdev);
500521
}

drivers/iommu/apple-dart.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <linux/bitfield.h>
1616
#include <linux/clk.h>
1717
#include <linux/dev_printk.h>
18-
#include <linux/dma-iommu.h>
1918
#include <linux/dma-mapping.h>
2019
#include <linux/err.h>
2120
#include <linux/interrupt.h>
@@ -70,6 +69,8 @@
7069
#define DART_ERROR_ADDR_HI 0x54
7170
#define DART_ERROR_ADDR_LO 0x50
7271

72+
#define DART_STREAMS_ENABLE 0xfc
73+
7374
#define DART_TCR(sid) (0x100 + 4 * (sid))
7475
#define DART_TCR_TRANSLATE_ENABLE BIT(7)
7576
#define DART_TCR_BYPASS0_ENABLE BIT(8)
@@ -301,6 +302,9 @@ static int apple_dart_hw_reset(struct apple_dart *dart)
301302
apple_dart_hw_disable_dma(&stream_map);
302303
apple_dart_hw_clear_all_ttbrs(&stream_map);
303304

305+
/* enable all streams globally since TCR is used to control isolation */
306+
writel(DART_STREAM_ALL, dart->regs + DART_STREAMS_ENABLE);
307+
304308
/* clear any pending errors before the interrupt is unmasked */
305309
writel(readl(dart->regs + DART_ERROR), dart->regs + DART_ERROR);
306310

@@ -578,7 +582,6 @@ static struct iommu_domain *apple_dart_domain_alloc(unsigned int type)
578582
if (!dart_domain)
579583
return NULL;
580584

581-
iommu_get_dma_cookie(&dart_domain->domain);
582585
mutex_init(&dart_domain->init_lock);
583586

584587
/* no need to allocate pgtbl_ops or do any other finalization steps */
@@ -702,13 +705,12 @@ static struct iommu_group *apple_dart_device_group(struct device *dev)
702705
if (!group)
703706
goto out;
704707

705-
group_master_cfg = kzalloc(sizeof(*group_master_cfg), GFP_KERNEL);
708+
group_master_cfg = kmemdup(cfg, sizeof(*group_master_cfg), GFP_KERNEL);
706709
if (!group_master_cfg) {
707710
iommu_group_put(group);
708711
goto out;
709712
}
710713

711-
memcpy(group_master_cfg, cfg, sizeof(*group_master_cfg));
712714
iommu_group_set_iommudata(group, group_master_cfg,
713715
apple_dart_release_group);
714716

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

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -409,10 +409,7 @@ static void __arm_smmu_cmdq_skip_err(struct arm_smmu_device *smmu,
409409
dev_err(smmu->dev, "\t0x%016llx\n", (unsigned long long)cmd[i]);
410410

411411
/* Convert the erroneous command into a CMD_SYNC */
412-
if (arm_smmu_cmdq_build_cmd(cmd, &cmd_sync)) {
413-
dev_err(smmu->dev, "failed to convert to CMD_SYNC\n");
414-
return;
415-
}
412+
arm_smmu_cmdq_build_cmd(cmd, &cmd_sync);
416413

417414
queue_write(Q_ENT(q, cons), cmd, q->ent_dwords);
418415
}
@@ -860,7 +857,7 @@ static int __arm_smmu_cmdq_issue_cmd(struct arm_smmu_device *smmu,
860857
{
861858
u64 cmd[CMDQ_ENT_DWORDS];
862859

863-
if (arm_smmu_cmdq_build_cmd(cmd, ent)) {
860+
if (unlikely(arm_smmu_cmdq_build_cmd(cmd, ent))) {
864861
dev_warn(smmu->dev, "ignoring unknown CMDQ opcode 0x%x\n",
865862
ent->opcode);
866863
return -EINVAL;
@@ -885,11 +882,20 @@ static void arm_smmu_cmdq_batch_add(struct arm_smmu_device *smmu,
885882
struct arm_smmu_cmdq_batch *cmds,
886883
struct arm_smmu_cmdq_ent *cmd)
887884
{
885+
int index;
886+
888887
if (cmds->num == CMDQ_BATCH_ENTRIES) {
889888
arm_smmu_cmdq_issue_cmdlist(smmu, cmds->cmds, cmds->num, false);
890889
cmds->num = 0;
891890
}
892-
arm_smmu_cmdq_build_cmd(&cmds->cmds[cmds->num * CMDQ_ENT_DWORDS], cmd);
891+
892+
index = cmds->num * CMDQ_ENT_DWORDS;
893+
if (unlikely(arm_smmu_cmdq_build_cmd(&cmds->cmds[index], cmd))) {
894+
dev_warn(smmu->dev, "ignoring unknown CMDQ opcode 0x%x\n",
895+
cmd->opcode);
896+
return;
897+
}
898+
893899
cmds->num++;
894900
}
895901

@@ -1764,10 +1770,11 @@ static int arm_smmu_atc_inv_master(struct arm_smmu_master *master)
17641770
{
17651771
int i;
17661772
struct arm_smmu_cmdq_ent cmd;
1767-
struct arm_smmu_cmdq_batch cmds = {};
1773+
struct arm_smmu_cmdq_batch cmds;
17681774

17691775
arm_smmu_atc_inv_to_cmd(0, 0, 0, &cmd);
17701776

1777+
cmds.num = 0;
17711778
for (i = 0; i < master->num_streams; i++) {
17721779
cmd.atc.sid = master->streams[i].id;
17731780
arm_smmu_cmdq_batch_add(master->smmu, &cmds, &cmd);

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ static const struct of_device_id qcom_smmu_client_of_match[] __maybe_unused = {
231231
{ .compatible = "qcom,sc7180-mdss" },
232232
{ .compatible = "qcom,sc7180-mss-pil" },
233233
{ .compatible = "qcom,sc7280-mdss" },
234+
{ .compatible = "qcom,sc7280-mss-pil" },
234235
{ .compatible = "qcom,sc8180x-mdss" },
235236
{ .compatible = "qcom,sdm845-mdss" },
236237
{ .compatible = "qcom,sdm845-mss-pil" },
@@ -403,12 +404,14 @@ static struct arm_smmu_device *qcom_smmu_create(struct arm_smmu_device *smmu,
403404

404405
static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match[] = {
405406
{ .compatible = "qcom,msm8998-smmu-v2" },
407+
{ .compatible = "qcom,qcm2290-smmu-500" },
406408
{ .compatible = "qcom,sc7180-smmu-500" },
407409
{ .compatible = "qcom,sc7280-smmu-500" },
408410
{ .compatible = "qcom,sc8180x-smmu-500" },
409411
{ .compatible = "qcom,sdm630-smmu-v2" },
410412
{ .compatible = "qcom,sdm845-smmu-500" },
411413
{ .compatible = "qcom,sm6125-smmu-500" },
414+
{ .compatible = "qcom,sm6350-smmu-500" },
412415
{ .compatible = "qcom,sm8150-smmu-500" },
413416
{ .compatible = "qcom,sm8250-smmu-500" },
414417
{ .compatible = "qcom,sm8350-smmu-500" },

0 commit comments

Comments
 (0)