From: Jan Kiszka <[email protected]>

Use GET_FIELD where possible, change to descending bit order.

Signed-off-by: Jan Kiszka <[email protected]>
---
 hypervisor/arch/arm64/smmu.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/hypervisor/arch/arm64/smmu.c b/hypervisor/arch/arm64/smmu.c
index 8d0ce757..ace7a48d 100644
--- a/hypervisor/arch/arm64/smmu.c
+++ b/hypervisor/arch/arm64/smmu.c
@@ -60,14 +60,11 @@
 #define ID1_NUMCB(id)                  GET_FIELD(id, 7, 0)
 
 #define ARM_SMMU_GR0_ID2               0x28
-#define ARM_SMMU_GR0_ID7               0x3c
-
-#define ID2_IAS_SHIFT                  0
-#define ID2_IAS_MASK                   0xf
-#define ID2_OAS_SHIFT                  4
-#define ID2_OAS_MASK                   0xf
 #define ID2_PTFS_4K                    (1 << 12)
+#define ID2_OAS(id)                    GET_FIELD(id, 7, 4)
+#define ID2_IAS(id)                    GET_FIELD(id, 3, 0)
 
+#define ARM_SMMU_GR0_ID7               0x3c
 #define ID7_MAJOR_SHIFT                        4
 #define ID7_MAJOR_MASK                 0xf
 
@@ -439,11 +436,11 @@ static int arm_smmu_device_cfg_probe(struct 
arm_smmu_device *smmu)
 
        /* ID2 */
        id = mmio_read32(gr0_base + ARM_SMMU_GR0_ID2);
-       size = arm_smmu_id_size_to_bits((id >> ID2_IAS_SHIFT) & ID2_IAS_MASK);
+       size = arm_smmu_id_size_to_bits(ID2_IAS(id));
        smmu->ipa_size = MIN(size, get_cpu_parange());
 
        /* The output mask is also applied for bypass */
-       size = arm_smmu_id_size_to_bits((id >> ID2_OAS_SHIFT) & ID2_OAS_MASK);
+       size = arm_smmu_id_size_to_bits(ID2_OAS(id));
        smmu->pa_size = size;
 
        if (!(id & ID2_PTFS_4K))
-- 
2.26.2

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/bcd0f80f8ae8dcdd9a1140c33c2233ee5b8fe3b4.1601838005.git.jan.kiszka%40siemens.com.

Reply via email to