|
171 | 171 | #define ARM_SMMU_PRIQ_IRQ_CFG1 0xd8
|
172 | 172 | #define ARM_SMMU_PRIQ_IRQ_CFG2 0xdc
|
173 | 173 |
|
| 174 | +#define ARM_SMMU_REG_SZ 0xe00 |
| 175 | + |
174 | 176 | /* Common MSI config fields */
|
175 | 177 | #define MSI_CFG0_ADDR_MASK GENMASK_ULL(51, 2)
|
176 | 178 | #define MSI_CFG2_SH GENMASK(5, 4)
|
@@ -628,6 +630,7 @@ struct arm_smmu_strtab_cfg {
|
628 | 630 | struct arm_smmu_device {
|
629 | 631 | struct device *dev;
|
630 | 632 | void __iomem *base;
|
| 633 | + void __iomem *page1; |
631 | 634 |
|
632 | 635 | #define ARM_SMMU_FEAT_2_LVL_STRTAB (1 << 0)
|
633 | 636 | #define ARM_SMMU_FEAT_2_LVL_CDTAB (1 << 1)
|
@@ -733,9 +736,8 @@ static struct arm_smmu_option_prop arm_smmu_options[] = {
|
733 | 736 | static inline void __iomem *arm_smmu_page1_fixup(unsigned long offset,
|
734 | 737 | struct arm_smmu_device *smmu)
|
735 | 738 | {
|
736 |
| - if ((offset > SZ_64K) && |
737 |
| - (smmu->options & ARM_SMMU_OPT_PAGE0_REGS_ONLY)) |
738 |
| - offset -= SZ_64K; |
| 739 | + if (offset > SZ_64K) |
| 740 | + return smmu->page1 + offset - SZ_64K; |
739 | 741 |
|
740 | 742 | return smmu->base + offset;
|
741 | 743 | }
|
@@ -4001,6 +4003,18 @@ err_reset_pci_ops: __maybe_unused;
|
4001 | 4003 | return err;
|
4002 | 4004 | }
|
4003 | 4005 |
|
| 4006 | +static void __iomem *arm_smmu_ioremap(struct device *dev, resource_size_t start, |
| 4007 | + resource_size_t size) |
| 4008 | +{ |
| 4009 | + struct resource res = { |
| 4010 | + .flags = IORESOURCE_MEM, |
| 4011 | + .start = start, |
| 4012 | + .end = start + size - 1, |
| 4013 | + }; |
| 4014 | + |
| 4015 | + return devm_ioremap_resource(dev, &res); |
| 4016 | +} |
| 4017 | + |
4004 | 4018 | static int arm_smmu_device_probe(struct platform_device *pdev)
|
4005 | 4019 | {
|
4006 | 4020 | int irq, ret;
|
@@ -4036,10 +4050,23 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
|
4036 | 4050 | }
|
4037 | 4051 | ioaddr = res->start;
|
4038 | 4052 |
|
4039 |
| - smmu->base = devm_ioremap_resource(dev, res); |
| 4053 | + /* |
| 4054 | + * Don't map the IMPLEMENTATION DEFINED regions, since they may contain |
| 4055 | + * the PMCG registers which are reserved by the PMU driver. |
| 4056 | + */ |
| 4057 | + smmu->base = arm_smmu_ioremap(dev, ioaddr, ARM_SMMU_REG_SZ); |
4040 | 4058 | if (IS_ERR(smmu->base))
|
4041 | 4059 | return PTR_ERR(smmu->base);
|
4042 | 4060 |
|
| 4061 | + if (arm_smmu_resource_size(smmu) > SZ_64K) { |
| 4062 | + smmu->page1 = arm_smmu_ioremap(dev, ioaddr + SZ_64K, |
| 4063 | + ARM_SMMU_REG_SZ); |
| 4064 | + if (IS_ERR(smmu->page1)) |
| 4065 | + return PTR_ERR(smmu->page1); |
| 4066 | + } else { |
| 4067 | + smmu->page1 = smmu->base; |
| 4068 | + } |
| 4069 | + |
4043 | 4070 | /* Interrupt lines */
|
4044 | 4071 |
|
4045 | 4072 | irq = platform_get_irq_byname_optional(pdev, "combined");
|
|
0 commit comments