[openib-general] [PATCH] mthca - command interface

Roland Dreier rdreier at cisco.com
Mon Feb 13 22:09:28 PST 2006


Hmm, I think I see one more issue.  You take the FW's word for the
doorbell base address here:

 > +	MTHCA_GET(dev->cmd.dbell_base, outbox, QUERY_FW_CMD_DB_BASE);

and then just ioremap that with no adjustment:

 > +	map_base = ioremap(dev->cmd.dbell_base, max_off +
 > +			   sizeof(unsigned long));

This will be broken on architectures such as ppc64 where the HCA's
view of bus address doesn't match up with what the kernel expects to
be passed to ioremap.

I think you need to do something like the code in mthca_start_catas_poll(),
which takes the address from the firmware and uses it as an offset
into a PCI resource to make this work:

	addr = pci_resource_start(dev->pdev, 0) +
		((pci_resource_len(dev->pdev, 0) - 1) &
		 dev->catas_err.addr);

	if (!request_mem_region(addr, dev->catas_err.size * 4,
				DRV_NAME)) {
		mthca_warn(dev, "couldn't request catastrophic error region "
			   "at 0x%lx/0x%x\n", addr, dev->catas_err.size * 4);
		return;
	}

	dev->catas_err.map = ioremap(addr, dev->catas_err.size * 4);
	if (!dev->catas_err.map) {
		mthca_warn(dev, "couldn't map catastrophic error region "
			   "at 0x%lx/0x%x\n", addr, dev->catas_err.size * 4);
		release_mem_region(addr, dev->catas_err.size * 4);
		return;
	}

(And looking at the catastrophic error code, I notice that you didn't
request the doorbell region before ioremapping it, which is another
issue to fix)

 - R.



More information about the general mailing list