Re: [PATCH 4/7] platform/x86/intel/bff: Add Diamond Rapids support

From: Ilpo Järvinen

Date: Wed Aug 26 2026 - 04:18:43 EST


On Tue, 25 Aug 2026, Tony Luck wrote:

> There are potentially bitfix filters associated with each machine check
> bank. Only some banks may implement them.
>
> Machine check banks have varying scope. E.g. there is a separate L2
> cache for each module, each instance has its own bitfix filter.
>
> Add information that will be used to map a <cpu,bank> pair to a unique
> instance number for a bitfix filter.
>
> Co-developed-by: Qiuxu Zhuo <qiuxu.zhuo@xxxxxxxxx>
> Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@xxxxxxxxx>
> Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx>
> ---
> drivers/platform/x86/intel/bff.c | 41 ++++++++++++++++++++++++++++++++
> 1 file changed, 41 insertions(+)
>
> diff --git a/drivers/platform/x86/intel/bff.c b/drivers/platform/x86/intel/bff.c
> index 9522bdb1401d..6360bbc92347 100644
> --- a/drivers/platform/x86/intel/bff.c
> +++ b/drivers/platform/x86/intel/bff.c
> @@ -18,18 +18,51 @@
> #define pr_fmt(fmt) "bff: " fmt
>
> #include <linux/cpufeature.h>
> +#include <linux/device-id/x86_cpu.h>
> #include <linux/errno.h>
> #include <linux/init.h>
> #include <linux/module.h>
> +#include <linux/printk.h>
> #include <linux/types.h>
>
> +#include <asm/cpu_device_id.h>
> #include <asm/cpufeatures.h>
> +#include <asm/intel-family.h>
> #include <asm/mce.h>
> #include <asm/msr.h>
> #include <asm/msr-index.h>
>
> +/* Machine check bank scope types */
> +enum bff_type {
> + BFF_NONE = 0,
> + BFF_BANK_DCU,
> + BFF_BANK_DTLB,
> + BFF_BANK_MLC,
> + BFF_BANK_CCF,
> + BFF_BANK_HSF,
> + BFF_BANK_IOCACHE,
> +};
> +
> +static const enum bff_type dmr_mcbanks[MAX_NR_BANKS] = {
> + [1] = BFF_BANK_DCU,
> + [2] = BFF_BANK_DTLB,
> + [3] = BFF_BANK_MLC,
> + [6] = BFF_BANK_CCF,
> + [13] = BFF_BANK_HSF,
> + [17] = BFF_BANK_IOCACHE

Please add trailing comma.

> +};
> +
> +static const struct x86_cpu_id bff_cpu_ids[] __initconst = {
> + X86_MATCH_VFM(INTEL_DIAMONDRAPIDS_X, dmr_mcbanks),
> + {}
> +};
> +MODULE_DEVICE_TABLE(x86cpu, bff_cpu_ids);
> +
> +static const enum bff_type *bank_types;
> +
> static int __init bff_init(void)
> {
> + const struct x86_cpu_id *m;
> u64 core_caps, mcg_cap;
>
> if (!cpu_feature_enabled(X86_FEATURE_MCA))
> @@ -45,6 +78,14 @@ static int __init bff_init(void)
> if (!(core_caps & MSR_IA32_CORE_CAPS_BFF_RESET_DETECT))
> return -ENODEV;
>
> + m = x86_match_cpu(bff_cpu_ids);
> + if (!m) {
> + pr_info("CPU supports bitfix filter, but driver does not\n");
> + return -ENODEV;
> + }
> +
> + bank_types = (const enum bff_type *)m->driver_data;
> +
> return 0;
> }
>
>

--
i.