Re: Anyone still using PCI "isp" SCSI / FC controllers?

2021-07-20 Thread Michael
Hello,

On Tue, 20 Jul 2021 15:09:57 +0200
Manuel Bouyer  wrote:

> I have:
> isp0 at pci10 dev 0 function 0: QLogic FC-AL and 4Gbps Fabric PCI-E HBA
> isp1 at pci10 dev 0 function 1: QLogic FC-AL and 4Gbps Fabric PCI-E HBA

For the record, I have two slightly different isp at sbus ( one UW, one
FW SCSI ) in case anything in the bus-independent part needs testing.

have fun
Michael


Re: Anyone still using PCI "isp" SCSI / FC controllers?

2021-07-20 Thread Manuel Bouyer
On Sun, Jul 18, 2021 at 02:44:46PM -0700, Jason Thorpe wrote:
> The Qlogic ISP SCSI / FC driver PCI front-end appears to universally support 
> using 64-bit PCI DMA addresses, based on my reading of this code block in 
> isp_pci_dmasetup():
> 
> if (sizeof (bus_addr_t) > 4) { 
> if (rq->req_header.rqs_entry_type == RQSTYPE_T2RQS) {
> rq->req_header.rqs_entry_type = RQSTYPE_T3RQS;
> } else if (rq->req_header.rqs_entry_type == 
> RQSTYPE_REQUEST) {  
> rq->req_header.rqs_entry_type = RQSTYPE_A64;
> }
> }
> 
> There's just one problem, though!  It does not use the 64-bit PCI DMA tag, 
> and so it is always getting DMA addresses that fit in 32-bits.  On x86-64 
> machines, this results in having to bounce DMA transfers (ick).  On Alpha 
> machines, this results in having to use SGMAP (IOMMU) DMA; this is not a 
> problem unto itself, and I recently made some improvements to this on systems 
> where Qlogic ISP controllers were more likely to be present (e.g. AlphaServer 
> 1000 / 1000A).
> 
> But there are some Alpha systems we support (notably the EV6+ 
> Tsunami/Typhoon/Titan systems e.g. DS10/DS20/DS25/...) that natively support 
> 64-bit PCI DMA addressing without having to use SGMAPs ... this is generally 
> preferred because, among other things, it's faster.
> 
> I'm pretty sure it's safe, based on the code block quoted above, to change 
> PCI DMA tag selection in the driver to something like this:
> 
> /*
>  * See conditional in isp_pci_dmasetup(); if
>  * sizeof (bus_addr_t) > 4, then we'll program 
>  * the device using 64-bit DMA addresses.  
>  * So, if we're going to do that, we should do
>  * our best to get 64-bit addresses in the first
>  * place.
>  */
> if (sizeof (bus_addr_t) > 4 && pci_dma64_available(pa)) {
> isp->isp_dmatag = pa->pa_dmat64;
> } else {
> isp->isp_dmatag = pa->pa_dmat;
> }
> 
> Anyway, if someone with more knowledge of these controllers could chime in, 
> I'd really appreciate it.  (Hopefully Matt is still lurking on these mailing 
> lists??)

I have:
isp0 at pci10 dev 0 function 0: QLogic FC-AL and 4Gbps Fabric PCI-E HBA
isp1 at pci10 dev 0 function 1: QLogic FC-AL and 4Gbps Fabric PCI-E HBA

connecting to a overland LTO changer
I don't have specific knowledge on these controllers, but I could certainly
test-boot a -current kernel and see if I can still read tapes (the server is
running netbsd-8 at this time)

-- 
Manuel Bouyer 
 NetBSD: 26 ans d'experience feront toujours la difference
--


Anyone still using PCI "isp" SCSI / FC controllers?

2021-07-18 Thread Jason Thorpe
The Qlogic ISP SCSI / FC driver PCI front-end appears to universally support 
using 64-bit PCI DMA addresses, based on my reading of this code block in 
isp_pci_dmasetup():

if (sizeof (bus_addr_t) > 4) { 
if (rq->req_header.rqs_entry_type == RQSTYPE_T2RQS) {
rq->req_header.rqs_entry_type = RQSTYPE_T3RQS;
} else if (rq->req_header.rqs_entry_type == 
RQSTYPE_REQUEST) {  
rq->req_header.rqs_entry_type = RQSTYPE_A64;
}
}

There's just one problem, though!  It does not use the 64-bit PCI DMA tag, and 
so it is always getting DMA addresses that fit in 32-bits.  On x86-64 machines, 
this results in having to bounce DMA transfers (ick).  On Alpha machines, this 
results in having to use SGMAP (IOMMU) DMA; this is not a problem unto itself, 
and I recently made some improvements to this on systems where Qlogic ISP 
controllers were more likely to be present (e.g. AlphaServer 1000 / 1000A).

But there are some Alpha systems we support (notably the EV6+ 
Tsunami/Typhoon/Titan systems e.g. DS10/DS20/DS25/...) that natively support 
64-bit PCI DMA addressing without having to use SGMAPs ... this is generally 
preferred because, among other things, it's faster.

I'm pretty sure it's safe, based on the code block quoted above, to change PCI 
DMA tag selection in the driver to something like this:

/*
 * See conditional in isp_pci_dmasetup(); if
 * sizeof (bus_addr_t) > 4, then we'll program 
 * the device using 64-bit DMA addresses.  
 * So, if we're going to do that, we should do
 * our best to get 64-bit addresses in the first
 * place.
 */
if (sizeof (bus_addr_t) > 4 && pci_dma64_available(pa)) {
isp->isp_dmatag = pa->pa_dmat64;
} else {
isp->isp_dmatag = pa->pa_dmat;
}

Anyway, if someone with more knowledge of these controllers could chime in, I'd 
really appreciate it.  (Hopefully Matt is still lurking on these mailing 
lists??)

-- thorpej