AMD/IOMMU: Drop get_field_from_byte()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 24 Sep 2018 10:39:46 +0000 (11:39 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 5 Oct 2018 09:53:58 +0000 (10:53 +0100)
It is MASK_EXTR() in disguise, but less flexible.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Brian Woods <brian.woods@amd.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
xen/drivers/passthrough/amd/iommu_map.c
xen/include/asm-x86/hvm/svm/amd-iommu-proto.h

index 61ade718500e701cfd0c4db72d05aa5e8990ef01..d0398069273e8b319dbcc33fe722a05632309d72 100644 (file)
@@ -220,7 +220,7 @@ void __init iommu_dte_add_device_entry(u32 *dte, struct ivrs_mappings *ivrs_dev)
     dte[7] = dte[6] = dte[4] = dte[2] = dte[1] = dte[0] = 0;
 
     flags = ivrs_dev->device_flags;
-    sys_mgt = get_field_from_byte(flags, ACPI_IVHD_SYSTEM_MGMT);
+    sys_mgt = MASK_EXTR(flags, ACPI_IVHD_SYSTEM_MGMT);
     dev_ex = ivrs_dev->dte_allow_exclusion;
 
     flags &= mask;
index 99bc21c7b3b0eb8abe0136c5d94ac524cf241a59..1b965e16f23fe1d716021ac91dc1dca4a93a9bd7 100644 (file)
@@ -155,11 +155,6 @@ static inline u32 set_field_in_reg_u32(u32 field, u32 reg_value,
     return reg_value;
 }
 
-static inline u8 get_field_from_byte(u8 value, u8 mask)
-{
-    return (value & mask) / (mask & -mask);
-}
-
 static inline unsigned long region_to_pages(unsigned long addr, unsigned long size)
 {
     return (PAGE_ALIGN(addr + size) - (addr & PAGE_MASK)) >> PAGE_SHIFT;