cxl fixes for 6.8-rc2
- Fix unit test build regression fallout from global "missing-prototypes" change - Fix compatibility with devices that do not support interrupts - Fix overflow when calculating the capacity of large interleave sets -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQSbo+XnGs+rwLz9XGXfioYZHlFsZwUCZbahQwAKCRDfioYZHlFs Z1VNAP0dz0rhIriILaAvRidYQWt/qtmhoaZswrVvEtY+q/orogD/d6eHChpRQKM2 Bg8ofjqLkaEEszx7VBVhOGodgaQnBA8= =RUzU -----END PGP SIGNATURE----- Merge tag 'cxl-fixes-6.8-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl Pull cxl fixes from Dan Williams: "A build regression fix, a device compatibility fix, and an original bug preventing creation of large (16 device) interleave sets: - Fix unit test build regression fallout from global "missing-prototypes" change - Fix compatibility with devices that do not support interrupts - Fix overflow when calculating the capacity of large interleave sets" * tag 'cxl-fixes-6.8-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl: cxl/region:Fix overflow issue in alloc_hpa() cxl/pci: Skip irq features if MSI/MSI-X are not supported tools/testing/nvdimm: Disable "missing prototypes / declarations" warnings tools/testing/cxl: Disable "missing prototypes / declarations" warnings
This commit is contained in:
commit
3eb5ca857d
@ -525,7 +525,7 @@ static int alloc_hpa(struct cxl_region *cxlr, resource_size_t size)
|
||||
struct cxl_root_decoder *cxlrd = to_cxl_root_decoder(cxlr->dev.parent);
|
||||
struct cxl_region_params *p = &cxlr->params;
|
||||
struct resource *res;
|
||||
u32 remainder = 0;
|
||||
u64 remainder = 0;
|
||||
|
||||
lockdep_assert_held_write(&cxl_region_rwsem);
|
||||
|
||||
@ -545,7 +545,7 @@ static int alloc_hpa(struct cxl_region *cxlr, resource_size_t size)
|
||||
(cxlr->mode == CXL_DECODER_PMEM && uuid_is_null(&p->uuid)))
|
||||
return -ENXIO;
|
||||
|
||||
div_u64_rem(size, SZ_256M * p->interleave_ways, &remainder);
|
||||
div64_u64_rem(size, (u64)SZ_256M * p->interleave_ways, &remainder);
|
||||
if (remainder)
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -382,7 +382,7 @@ static int cxl_pci_mbox_send(struct cxl_memdev_state *mds,
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int cxl_pci_setup_mailbox(struct cxl_memdev_state *mds)
|
||||
static int cxl_pci_setup_mailbox(struct cxl_memdev_state *mds, bool irq_avail)
|
||||
{
|
||||
struct cxl_dev_state *cxlds = &mds->cxlds;
|
||||
const int cap = readl(cxlds->regs.mbox + CXLDEV_MBOX_CAPS_OFFSET);
|
||||
@ -441,7 +441,7 @@ static int cxl_pci_setup_mailbox(struct cxl_memdev_state *mds)
|
||||
INIT_DELAYED_WORK(&mds->security.poll_dwork, cxl_mbox_sanitize_work);
|
||||
|
||||
/* background command interrupts are optional */
|
||||
if (!(cap & CXLDEV_MBOX_CAP_BG_CMD_IRQ))
|
||||
if (!(cap & CXLDEV_MBOX_CAP_BG_CMD_IRQ) || !irq_avail)
|
||||
return 0;
|
||||
|
||||
msgnum = FIELD_GET(CXLDEV_MBOX_CAP_IRQ_MSGNUM_MASK, cap);
|
||||
@ -588,7 +588,7 @@ static int cxl_mem_alloc_event_buf(struct cxl_memdev_state *mds)
|
||||
return devm_add_action_or_reset(mds->cxlds.dev, free_event_buf, buf);
|
||||
}
|
||||
|
||||
static int cxl_alloc_irq_vectors(struct pci_dev *pdev)
|
||||
static bool cxl_alloc_irq_vectors(struct pci_dev *pdev)
|
||||
{
|
||||
int nvecs;
|
||||
|
||||
@ -605,9 +605,9 @@ static int cxl_alloc_irq_vectors(struct pci_dev *pdev)
|
||||
PCI_IRQ_MSIX | PCI_IRQ_MSI);
|
||||
if (nvecs < 1) {
|
||||
dev_dbg(&pdev->dev, "Failed to alloc irq vectors: %d\n", nvecs);
|
||||
return -ENXIO;
|
||||
return false;
|
||||
}
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
static irqreturn_t cxl_event_thread(int irq, void *id)
|
||||
@ -743,7 +743,7 @@ static bool cxl_event_int_is_fw(u8 setting)
|
||||
}
|
||||
|
||||
static int cxl_event_config(struct pci_host_bridge *host_bridge,
|
||||
struct cxl_memdev_state *mds)
|
||||
struct cxl_memdev_state *mds, bool irq_avail)
|
||||
{
|
||||
struct cxl_event_interrupt_policy policy;
|
||||
int rc;
|
||||
@ -755,6 +755,11 @@ static int cxl_event_config(struct pci_host_bridge *host_bridge,
|
||||
if (!host_bridge->native_cxl_error)
|
||||
return 0;
|
||||
|
||||
if (!irq_avail) {
|
||||
dev_info(mds->cxlds.dev, "No interrupt support, disable event processing.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
rc = cxl_mem_alloc_event_buf(mds);
|
||||
if (rc)
|
||||
return rc;
|
||||
@ -789,6 +794,7 @@ static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
struct cxl_register_map map;
|
||||
struct cxl_memdev *cxlmd;
|
||||
int i, rc, pmu_count;
|
||||
bool irq_avail;
|
||||
|
||||
/*
|
||||
* Double check the anonymous union trickery in struct cxl_regs
|
||||
@ -846,11 +852,9 @@ static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
else
|
||||
dev_warn(&pdev->dev, "Media not active (%d)\n", rc);
|
||||
|
||||
rc = cxl_alloc_irq_vectors(pdev);
|
||||
if (rc)
|
||||
return rc;
|
||||
irq_avail = cxl_alloc_irq_vectors(pdev);
|
||||
|
||||
rc = cxl_pci_setup_mailbox(mds);
|
||||
rc = cxl_pci_setup_mailbox(mds, irq_avail);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
@ -909,7 +913,7 @@ static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
}
|
||||
}
|
||||
|
||||
rc = cxl_event_config(host_bridge, mds);
|
||||
rc = cxl_event_config(host_bridge, mds, irq_avail);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
|
@ -65,4 +65,6 @@ cxl_core-y += config_check.o
|
||||
cxl_core-y += cxl_core_test.o
|
||||
cxl_core-y += cxl_core_exports.o
|
||||
|
||||
KBUILD_CFLAGS := $(filter-out -Wmissing-prototypes -Wmissing-declarations, $(KBUILD_CFLAGS))
|
||||
|
||||
obj-m += test/
|
||||
|
@ -8,3 +8,5 @@ obj-m += cxl_mock_mem.o
|
||||
cxl_test-y := cxl.o
|
||||
cxl_mock-y := mock.o
|
||||
cxl_mock_mem-y := mem.o
|
||||
|
||||
KBUILD_CFLAGS := $(filter-out -Wmissing-prototypes -Wmissing-declarations, $(KBUILD_CFLAGS))
|
||||
|
@ -82,4 +82,6 @@ libnvdimm-$(CONFIG_NVDIMM_KEYS) += $(NVDIMM_SRC)/security.o
|
||||
libnvdimm-y += libnvdimm_test.o
|
||||
libnvdimm-y += config_check.o
|
||||
|
||||
KBUILD_CFLAGS := $(filter-out -Wmissing-prototypes -Wmissing-declarations, $(KBUILD_CFLAGS))
|
||||
|
||||
obj-m += test/
|
||||
|
Loading…
Reference in New Issue
Block a user