Skip to content

Commit e881dbd

Browse files
ssuthiku-amdjoergroedel
authored andcommitted
iommu/amd: Add support for higher 64-bit IOMMU Control Register
Currently, the driver only supports lower 32-bit of IOMMU Control register. However, newer AMD IOMMU specification has extended this register to 64-bit. Therefore, replace the accessing API with the 64-bit version. Cc: Joerg Roedel <[email protected]> Signed-off-by: Suravee Suthikulpanit <[email protected]> Signed-off-by: Joerg Roedel <[email protected]>
1 parent 818b758 commit e881dbd

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

drivers/iommu/amd_iommu_init.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,9 @@ static void clear_translation_pre_enabled(struct amd_iommu *iommu)
280280

281281
static void init_translation_status(struct amd_iommu *iommu)
282282
{
283-
u32 ctrl;
283+
u64 ctrl;
284284

285-
ctrl = readl(iommu->mmio_base + MMIO_CONTROL_OFFSET);
285+
ctrl = readq(iommu->mmio_base + MMIO_CONTROL_OFFSET);
286286
if (ctrl & (1<<CONTROL_IOMMU_EN))
287287
iommu->flags |= AMD_IOMMU_FLAG_TRANS_PRE_ENABLED;
288288
}
@@ -386,30 +386,30 @@ static void iommu_set_device_table(struct amd_iommu *iommu)
386386
/* Generic functions to enable/disable certain features of the IOMMU. */
387387
static void iommu_feature_enable(struct amd_iommu *iommu, u8 bit)
388388
{
389-
u32 ctrl;
389+
u64 ctrl;
390390

391-
ctrl = readl(iommu->mmio_base + MMIO_CONTROL_OFFSET);
392-
ctrl |= (1 << bit);
393-
writel(ctrl, iommu->mmio_base + MMIO_CONTROL_OFFSET);
391+
ctrl = readq(iommu->mmio_base + MMIO_CONTROL_OFFSET);
392+
ctrl |= (1ULL << bit);
393+
writeq(ctrl, iommu->mmio_base + MMIO_CONTROL_OFFSET);
394394
}
395395

396396
static void iommu_feature_disable(struct amd_iommu *iommu, u8 bit)
397397
{
398-
u32 ctrl;
398+
u64 ctrl;
399399

400-
ctrl = readl(iommu->mmio_base + MMIO_CONTROL_OFFSET);
401-
ctrl &= ~(1 << bit);
402-
writel(ctrl, iommu->mmio_base + MMIO_CONTROL_OFFSET);
400+
ctrl = readq(iommu->mmio_base + MMIO_CONTROL_OFFSET);
401+
ctrl &= ~(1ULL << bit);
402+
writeq(ctrl, iommu->mmio_base + MMIO_CONTROL_OFFSET);
403403
}
404404

405405
static void iommu_set_inv_tlb_timeout(struct amd_iommu *iommu, int timeout)
406406
{
407-
u32 ctrl;
407+
u64 ctrl;
408408

409-
ctrl = readl(iommu->mmio_base + MMIO_CONTROL_OFFSET);
409+
ctrl = readq(iommu->mmio_base + MMIO_CONTROL_OFFSET);
410410
ctrl &= ~CTRL_INV_TO_MASK;
411411
ctrl |= (timeout << CONTROL_INV_TIMEOUT) & CTRL_INV_TO_MASK;
412-
writel(ctrl, iommu->mmio_base + MMIO_CONTROL_OFFSET);
412+
writeq(ctrl, iommu->mmio_base + MMIO_CONTROL_OFFSET);
413413
}
414414

415415
/* Function to enable the hardware */

0 commit comments

Comments
 (0)