'devid' is type of int, but 'irq_data->hwirq' is unsigned long.
When 'devid' >= 0xf000, hwirq will have a error value in 64 bit machine.
For example:
(unsigned long)((int)0xf000 << 16) = 0xfffffffff0000000
(unsigned long)((unsigned int)0xf000 << 16) = 0xf0000000
Add a cast to fix this problem.
Fixes: 7c71d306c97b ("irq_remapping/amd: Enhance AMD IR driver to support hierarchical irqdomains")
Signed-off-by: Su Hui <[email protected]>
---
drivers/iommu/amd/iommu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index 52d83730a22a..934738dfc8ea 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -3506,7 +3506,7 @@ static int irq_remapping_alloc(struct irq_domain *domain, unsigned int virq,
}
data->iommu = iommu;
- irq_data->hwirq = (devid << 16) + i;
+ irq_data->hwirq = ((irq_hw_number_t)devid << 16) + i;
irq_data->chip_data = data;
irq_data->chip = &amd_ir_chip;
irq_remapping_prepare_irte(data, cfg, info, devid, index, i);
--
2.30.2