[PATCH v7 071/120] dmaengine: ioatdma: Use parsed CPUID(0x9)

From: Ahmed S. Darwish

Date: Thu May 28 2026 - 12:22:51 EST


Use parsed CPUID(0x9) instead of manual bitwise operations and a direct
CPUID query.

Signed-off-by: Ahmed S. Darwish <darwi@xxxxxxxxxxxxx>
---
drivers/dma/ioat/dca.c | 21 ++++-----------------
1 file changed, 4 insertions(+), 17 deletions(-)

diff --git a/drivers/dma/ioat/dca.c b/drivers/dma/ioat/dca.c
index 07c977bef5f8..5e9b43b0b6dc 100644
--- a/drivers/dma/ioat/dca.c
+++ b/drivers/dma/ioat/dca.c
@@ -52,25 +52,12 @@ static inline u16 dcaid_from_pcidev(struct pci_dev *pci)
return pci_dev_id(pci);
}

-static int dca_enabled_in_bios(struct pci_dev *pdev)
-{
- /* CPUID level 9 returns DCA configuration */
- /* Bit 0 indicates DCA enabled by the BIOS */
- u32 eax;
- int res;
-
- eax = cpuid_eax(CPUID_LEAF_DCA);
- res = eax & BIT(0);
- if (!res)
- dev_dbg(&pdev->dev, "DCA is disabled in BIOS\n");
-
- return res;
-}
-
int system_has_dca_enabled(struct pci_dev *pdev)
{
- if (boot_cpu_has(X86_FEATURE_DCA))
- return dca_enabled_in_bios(pdev);
+ const struct leaf_0x9_0 *l9 = cpuid_leaf(&boot_cpu_data, 0x9);
+
+ if (l9 && boot_cpu_has(X86_FEATURE_DCA))
+ return l9->dca_enabled_in_bios;

dev_dbg(&pdev->dev, "boot cpu doesn't have X86_FEATURE_DCA\n");
return 0;
--
2.54.0