diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c index 8f512d59da73044475d8df392b9afa1b4c6b03fa..d7e19b51155328db831dfd5c9bb4bb85c3ed19ea 100644 --- a/drivers/cxl/core/mbox.c +++ b/drivers/cxl/core/mbox.c @@ -919,6 +919,16 @@ void cxl_event_trace_record(const struct cxl_memdev *cxlmd, evt->gen_media.type, evt->gen_media.transaction_type); + // Enable DSA Poison reporting support for AliSCM devices + struct pci_dev *pdev = to_pci_dev(cxlds->dev); + + if (cxl_pci_quirk_lookup(pdev, cxl_quirk_list)) { + u64 pfn = PHYS_PFN(hpa); + + if (pfn_valid(pfn)) + memory_failure_queue(pfn, MF_MUST_KILL|MF_ACTION_REQUIRED); + } + trace_cxl_general_media(cxlmd, type, cxlr, hpa, &evt->gen_media); } else if (event_type == CXL_CPER_EVENT_DRAM) { diff --git a/drivers/cxl/cxlmem.h b/drivers/cxl/cxlmem.h index 9c4f94e3a1c90158a5086e1bb2826d476fb0fbf9..f690f17b07aac71b50a6534c537f9ccb4bfab0c6 100644 --- a/drivers/cxl/cxlmem.h +++ b/drivers/cxl/cxlmem.h @@ -873,6 +873,4 @@ struct seq_file; struct dentry *cxl_debugfs_create_dir(const char *dir); void cxl_dpa_debug(struct seq_file *file, struct cxl_dev_state *cxlds); -#define PCI_VENDOR_ID_ALISCM 0x2042 - #endif /* __CXL_MEM_H__ */ diff --git a/drivers/cxl/cxlpci.h b/drivers/cxl/cxlpci.h index 0fa4799ea316cd802c97feda11fb6e3c88aaa138..c7f611929e38e9774925d88f92739f15d3ee4151 100644 --- a/drivers/cxl/cxlpci.h +++ b/drivers/cxl/cxlpci.h @@ -93,4 +93,41 @@ void read_cdat_data(struct cxl_port *port); void cxl_cor_error_detected(struct pci_dev *pdev); pci_ers_result_t cxl_error_detected(struct pci_dev *pdev, pci_channel_state_t state); + +#define PCI_VENDOR_ID_ALISCM 0x2042 + +struct cxl_pci_quirk { + u16 vendor; + u16 device; +}; + +static const struct cxl_pci_quirk cxl_quirk_list[] = { + { 0x2042, 0x0ddb}, /* aliscm1.0 */ + { } /* END */ +}; + +static inline const struct cxl_pci_quirk * +cxl_pci_quirk_lookup_id(u16 vendor, u16 device, + const struct cxl_pci_quirk *list) +{ + const struct cxl_pci_quirk *q; + + for (q = list; q->vendor || q->device; q++) { + if (q->vendor != vendor) + continue; + if (!q->device || device == q->device) + return q; + } + return NULL; +} + +static inline const struct cxl_pci_quirk * +cxl_pci_quirk_lookup(struct pci_dev *pci, const struct cxl_pci_quirk *list) +{ + if (!pci) + return NULL; + return cxl_pci_quirk_lookup_id(pci->vendor, + pci->device, + list); +} #endif /* __CXL_PCI_H__ */ diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c index 2968c8b9fd30acfb2804a4bd2718b0f0cd9534e6..ce92ed4946fd0b976c0c986c27482e05323393a3 100644 --- a/drivers/cxl/pci.c +++ b/drivers/cxl/pci.c @@ -197,41 +197,6 @@ static void cxl_mbox_scan_media_work(struct work_struct *work) mutex_unlock(&mds->mbox_mutex); } -struct cxl_pci_quirk { - u16 vendor; - u16 device; -}; - -static const struct cxl_pci_quirk cxl_quirk_list[] = { - { 0x2042, 0x0ddb}, /* aliscm1.0 */ - { } /* END */ -}; - -const struct cxl_pci_quirk * -cxl_pci_quirk_lookup_id(u16 vendor, u16 device, - const struct cxl_pci_quirk *list) -{ - const struct cxl_pci_quirk *q; - - for (q = list; q->vendor || q->device; q++) { - if (q->vendor != vendor) - continue; - if (!q->device || device == q->device) - return q; - } - return NULL; -} - -const struct cxl_pci_quirk * -cxl_pci_quirk_lookup(struct pci_dev *pci, const struct cxl_pci_quirk *list) -{ - if (!pci) - return NULL; - return cxl_pci_quirk_lookup_id(pci->vendor, - pci->device, - list); -} - /** * __cxl_pci_mbox_send_cmd() - Execute a mailbox command * @mds: The memory device driver data