iommu: Fix compilation issues on sdxbaagha

Current codes may don't consider the 32-bit possibility, some
compilation errors happen when try to enable smmu on sdxbaagha:
  1. arm-smmu-qcom.c:
    "error: shift count is negative" reports at
    "FIELD_GET(QTB_OVR_ECATS_OUTFLD0_PA, val)".
  2. qcom-iommu-debug-user.c:
    "error: incompatible pointer types passing" reports at
    "if (kstrtox_from_user(ubuf, count, 0, &iova))".
  3. qcom-io-pgtable-arm.c:
    "error: implicit declaration of function 'FIELD_GET'"
    reports at "FIELD_GET(TOP_IGNORED_MASK, table_pte)".
  4. qcom-iommu-debug-user.c:
    "error: implicit declaration of function 'FIELD_GET'"
    reports at "FIELD_GET(ARM_SMMU_SMR_ID, fwspec->ids[0])".
  5. qcom-iommu-debug.c:
    "error: implicit declaration of function 'FIELD_GET'"
    reports at "FIELD_GET(ARM_SMMU_SMR_ID, (fwspec->ids[0]))".

Change-Id: I38b96e411eaf37d87e48b4c9fe860a94643bc5b7
Signed-off-by: Qingqing Zhou <quic_qqzhou@quicinc.com>
This commit is contained in:
Qingqing Zhou 2022-06-15 15:42:43 +08:00 committed by Chris Goldsworthy
parent 025e33318e
commit 86b4d3af60
4 changed files with 13 additions and 2 deletions

View File

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/acpi.h>
@ -502,7 +503,7 @@ static const struct arm_smmu_impl qcom_smmu_impl = {
#define QTB_OVR_ECATS_STATUS_DONE BIT(0)
#define QTB_OVR_ECATS_OUTFLD0 0x458
#define QTB_OVR_ECATS_OUTFLD0_PA GENMASK(63, 12)
#define QTB_OVR_ECATS_OUTFLD0_PA GENMASK_ULL(63, 12)
#define QTB_OVR_ECATS_OUTFLD0_FAULT_TYPE GENMASK(5, 4)
#define QTB_OVR_ECATS_OUTFLD0_FAULT BIT(0)

View File

@ -12,6 +12,7 @@
#define pr_fmt(fmt) "arm-lpae io-pgtable: " fmt
#include <linux/atomic.h>
#include <linux/bitfield.h>
#include <linux/bitops.h>
#include <linux/io-pgtable.h>
#include <linux/kernel.h>

View File

@ -1,9 +1,11 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
*
*/
#include <linux/bitfield.h>
#include <linux/dma-mapping.h>
#include <linux/kernel.h>
#include <linux/slab.h>
@ -11,9 +13,15 @@
#include <linux/qcom-iommu-util.h>
#include "qcom-iommu-debug.h"
#ifdef CONFIG_64BIT
#define kstrtoux kstrtou64
#define kstrtox_from_user kstrtoull_from_user
#define kstrtosize_t kstrtoul
#else
#define kstrtoux kstrtou32
#define kstrtox_from_user kstrtouint_from_user
#define kstrtosize_t kstrtouint
#endif
static void *test_virt_addr;
static DEFINE_MUTEX(test_virt_addr_lock);

View File

@ -1,11 +1,12 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
*
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#define pr_fmt(fmt) "iommu-debug: %s: " fmt, __func__
#include <linux/bitfield.h>
#include <linux/debugfs.h>
#include <linux/iommu.h>
#include <linux/module.h>