summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/iommu/generic_pt/fmt/vtdss.h8
-rw-r--r--drivers/iommu/generic_pt/fmt/x86_64.h8
2 files changed, 8 insertions, 8 deletions
diff --git a/drivers/iommu/generic_pt/fmt/vtdss.h b/drivers/iommu/generic_pt/fmt/vtdss.h
index d9774848eb6f..50ffed9d0e50 100644
--- a/drivers/iommu/generic_pt/fmt/vtdss.h
+++ b/drivers/iommu/generic_pt/fmt/vtdss.h
@@ -174,6 +174,9 @@ static inline unsigned int vtdss_pt_max_sw_bit(struct pt_common *common)
static inline u64 vtdss_pt_sw_bit(unsigned int bitnr)
{
+ if (__builtin_constant_p(bitnr) && bitnr > 10)
+ BUILD_BUG();
+
/* Bits marked Ignored in the specification */
switch (bitnr) {
case 0:
@@ -184,10 +187,7 @@ static inline u64 vtdss_pt_sw_bit(unsigned int bitnr)
return BIT_ULL(63);
/* Some bits in 9-3 are available in some entries */
default:
- if (__builtin_constant_p(bitnr))
- BUILD_BUG();
- else
- PT_WARN_ON(true);
+ PT_WARN_ON(true);
return 0;
}
}
diff --git a/drivers/iommu/generic_pt/fmt/x86_64.h b/drivers/iommu/generic_pt/fmt/x86_64.h
index a86353f1481e..507abf2c934c 100644
--- a/drivers/iommu/generic_pt/fmt/x86_64.h
+++ b/drivers/iommu/generic_pt/fmt/x86_64.h
@@ -175,6 +175,9 @@ static inline unsigned int x86_64_pt_max_sw_bit(struct pt_common *common)
static inline u64 x86_64_pt_sw_bit(unsigned int bitnr)
{
+ if (__builtin_constant_p(bitnr) && bitnr > 12)
+ BUILD_BUG();
+
/* Bits marked Ignored/AVL in the specification */
switch (bitnr) {
case 0:
@@ -185,10 +188,7 @@ static inline u64 x86_64_pt_sw_bit(unsigned int bitnr)
return BIT_ULL((bitnr - 2) + 52);
/* Some bits in 8,6,4,3 are available in some entries */
default:
- if (__builtin_constant_p(bitnr))
- BUILD_BUG();
- else
- PT_WARN_ON(true);
+ PT_WARN_ON(true);
return 0;
}
}