From: Ira Weiny <[email protected]> Dynamic Capacity Devices (DCD) require event interrupts to process memory addition or removal. BIOS may have control over non-DCD event processing. DCD interrupt configuration needs to be separate from memory event interrupt configuration.
Factor out check for firmware ownership of memory event logs. Link: https://lore.kernel.org/all/[email protected]/ [1] Suggested-by: Dan Williams <[email protected]> Signed-off-by: Ira Weiny <[email protected]> Signed-off-by: Anisa Su <[email protected]> Tested-by: Wonjae Lee <[email protected]> Tested-by: Junhee Park <[email protected]> Tested-by: Heesoo Kim <[email protected]> Reviewed-by: Dave Jiang <[email protected]> Reviewed-by: Jonathan Cameron <[email protected]> Reviewed-by: Fan Ni <[email protected]> Reviewed-by: Li Ming <[email protected]> Reviewed-by: Davidlohr Bueso <[email protected]> Reviewed-by: Alison Schofield <[email protected]> Reviewed-by: Richard Cheng <[email protected]> --- drivers/cxl/pci.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c index 4867657f5526..7b754af2168d 100644 --- a/drivers/cxl/pci.c +++ b/drivers/cxl/pci.c @@ -640,6 +640,14 @@ static bool cxl_event_int_is_fw(u8 setting) return mode == CXL_INT_FW; } +static bool cxl_event_fw_owns_mem_logs(struct cxl_event_interrupt_policy *policy) +{ + return cxl_event_int_is_fw(policy->info_settings) || + cxl_event_int_is_fw(policy->warn_settings) || + cxl_event_int_is_fw(policy->failure_settings) || + cxl_event_int_is_fw(policy->fatal_settings); +} + static int cxl_event_config(struct pci_host_bridge *host_bridge, struct cxl_memdev_state *mds, bool irq_avail) { @@ -662,10 +670,7 @@ static int cxl_event_config(struct pci_host_bridge *host_bridge, if (rc) return rc; - if (cxl_event_int_is_fw(policy.info_settings) || - cxl_event_int_is_fw(policy.warn_settings) || - cxl_event_int_is_fw(policy.failure_settings) || - cxl_event_int_is_fw(policy.fatal_settings)) { + if (cxl_event_fw_owns_mem_logs(&policy)) { dev_err(mds->cxlds.dev, "FW still in control of Event Logs despite _OSC settings\n"); return -EBUSY; -- 2.43.0

