From: Matthew Wilcox <willy@debian.org>
To: James Bottomley <James.Bottomley@steeleye.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: Re: Proposal for new generic device API: dma_get_required_mask()
Date: Thu, 17 Jun 2004 16:28:18 +0100 [thread overview]
Message-ID: <20040617152818.GZ20511@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <1087481331.2210.27.camel@mulgrave>
On Thu, Jun 17, 2004 at 09:08:51AM -0500, James Bottomley wrote:
> We have a large number of devices in scsi: aacraid, aic7xxx, qla1280,
> qla2xxx which can all do full 64 bit DMA, but which pay a performance
> penalty for using the larger descriptors (aic7xxx is stranger in that it
> has three modes of operation: 32 bit, 39 bit and 64 bit each with an
> increasing performance penalty).
sym2 too -- 32, 40 and 64-bit, but with the restriction of the 64-bit
mode that it's limited to accessing 16 4GB segments.
> Once the driver has the platform's optimal mask, it can use this to
> decide on the correct descriptor size.
Sounds good to me.
So let's look at the sym2 implementation to see how this would work.
A straight diff -u is not terribly helpful, So let's try a more verbose
context diff:
*** 1625,1657 ****
*/
static int sym_setup_bus_dma_mask(struct sym_hcb *np)
{
! #if SYM_CONF_DMA_ADDRESSING_MODE == 0
! if (pci_set_dma_mask(np->s.device, 0xffffffffUL))
! goto out_err32;
! #else
! #if SYM_CONF_DMA_ADDRESSING_MODE == 1
! #define PciDmaMask 0xffffffffffULL
! #elif SYM_CONF_DMA_ADDRESSING_MODE == 2
! #define PciDmaMask 0xffffffffffffffffULL
! #endif
if (np->features & FE_DAC) {
! if (!pci_set_dma_mask(np->s.device, PciDmaMask)) {
! np->use_dac = 1;
! printf_info("%s: using 64 bit DMA addressing\n",
! sym_name(np));
! } else {
! if (pci_set_dma_mask(np->s.device, 0xffffffffUL))
! goto out_err32;
! }
}
! #undef PciDmaMask
! #endif
return 0;
! out_err32:
! printf_warning("%s: 32 BIT DMA ADDRESSING NOT SUPPORTED\n",
! sym_name(np));
! return -1;
}
/*
--- 1625,1645 ----
*/
static int sym_setup_bus_dma_mask(struct sym_hcb *np)
{
! struct pci_dev *pdev = &np->s.device;
!
if (np->features & FE_DAC) {
! u64 required_mask = dma_set_mask(&pdev->dev, 0xffffffffffULL);
! if (required_mask > 0xffffffffUL)
! goto use_dac;
}
!
! dma_set_mask(&pdev->dev, 0xffffffffUL);
return 0;
! use_dac:
! np->use_dac = 1;
! printf_info("%s: using 64 bit DMA addressing\n", sym_name(np));
! return 0;
}
/*
There's an obvious problem here -- no error checking on the second
dma_set_mask(). How were we going to indicate "I can't do that"
errors again?
--
"Next the statesmen will invent cheap lies, putting the blame upon
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince
himself that the war is just, and will thank God for the better sleep
he enjoys after this process of grotesque self-deception." -- Mark Twain
next prev parent reply other threads:[~2004-06-17 15:28 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-17 14:08 James Bottomley
2004-06-17 14:51 ` Meelis Roos
2004-06-17 15:28 ` Matthew Wilcox [this message]
2004-06-17 20:12 ` James Bottomley
2004-06-18 0:46 ` Krzysztof Halasa
2004-06-18 1:45 ` James Bottomley
2004-06-18 23:07 ` Krzysztof Halasa
2004-06-19 15:00 ` James Bottomley
2004-06-19 23:39 ` Krzysztof Halasa
2004-06-20 16:56 ` James Bottomley
2004-06-18 9:21 ` Russell King
2004-06-18 23:10 ` Krzysztof Halasa
2004-06-19 20:22 ` Russell King
2004-06-20 0:00 ` Krzysztof Halasa
2004-06-20 19:47 ` Russell King
2004-06-23 19:32 ` Krzysztof Halasa
2004-06-18 5:59 ` Jeremy Higdon
2004-06-18 14:19 ` James Bottomley
2004-06-17 14:52 Salyzyn, Mark
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040617152818.GZ20511@parcelfarce.linux.theplanet.co.uk \
--to=willy@debian.org \
--cc=James.Bottomley@steeleye.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®