From: Andi Kleen <andi@firstfloor.org>
To: linux-scsi@vger.kernel.org,
James.Bottomley@HansenPartnership.com, axboe@kernel.dk
Subject: [PATCH] [8/21] SCSI-ISA-DMA: Remove unchecked_isa_dma in eata.c
Date: Thu, 2 Oct 2008 09:58:46 +0200 (CEST) [thread overview]
Message-ID: <20081002075846.3CAD03E6A07@basil.firstfloor.org> (raw)
In-Reply-To: <20081002958.641114646@firstfloor.org>
- Allocate hostdata with DMA separately in the driver
- Audited ->cmnd uses and it only ever copies them
- Enable sense_buffer bouncing using new sense_buffer_isa flag
- Enable block layer bouncing explicitely
- Remove unchecked_isa_dma
Untested due to lack of hardware
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
drivers/scsi/eata.c | 54 +++++++++++++++++++++++++++++++++++++---------------
1 file changed, 39 insertions(+), 15 deletions(-)
Index: linux/drivers/scsi/eata.c
===================================================================
--- linux.orig/drivers/scsi/eata.c
+++ linux/drivers/scsi/eata.c
@@ -512,6 +512,13 @@ static int eata2x_bios_param(struct scsi
sector_t, int *);
static int eata2x_slave_configure(struct scsi_device *);
+static int eata_adjust_queue(struct scsi_device *device)
+{
+ if (device->host->sense_buffer_isa)
+ blk_queue_bounce_limit(device->request_queue, BLK_BOUNCE_ISA);
+ return 0;
+}
+
static struct scsi_host_template driver_template = {
.name = "EATA/DMA 2.0x rev. 8.10.00 ",
.detect = eata2x_detect,
@@ -522,8 +529,8 @@ static struct scsi_host_template driver_
.bios_param = eata2x_bios_param,
.slave_configure = eata2x_slave_configure,
.this_id = 7,
- .unchecked_isa_dma = 1,
.use_clustering = ENABLE_CLUSTERING,
+ .slave_alloc = eata_adjust_queue,
};
#if !defined(__BIG_ENDIAN_BITFIELD) && !defined(__LITTLE_ENDIAN_BITFIELD)
@@ -834,6 +841,16 @@ struct hostdata {
struct mssp sp; /* Local copy of sp buffer */
};
+struct hostdata_ptr {
+ struct hostdata *host;
+ dma_addr_t dma;
+};
+
+#define eata_shost_priv(shost) \
+ (((struct hostdata_ptr *)shost_priv(shost))->host)
+#define eata_shost_dma(shost) \
+ (((struct hostdata_ptr *)shost_priv(shost))->dma)
+
static struct Scsi_Host *sh[MAX_BOARDS];
static const char *driver_name = "EATA";
static char sha[MAX_BOARDS];
@@ -1266,14 +1283,23 @@ static int port_detect(unsigned long por
#endif
spin_unlock_irq(&driver_lock);
- sh[j] = shost = scsi_register(tpnt, sizeof(struct hostdata));
+ sh[j] = shost = scsi_register(tpnt, sizeof(struct hostdata_ptr));
+ ha = dma_alloc_coherent(pdev ? &pdev->dev : NULL,
+ sizeof(struct hostdata),
+ &eata_shost_dma(shost), GFP_KERNEL);
spin_lock_irq(&driver_lock);
- if (shost == NULL) {
+ if (shost == NULL || ha == NULL) {
+ if (ha)
+ dma_free_coherent(pdev ? &pdev->dev : NULL,
+ sizeof(struct hostdata),
+ ha, eata_shost_dma(shost));
printk("%s: unable to register host, detaching.\n", name);
goto freedma;
}
+ eata_shost_priv(shost) = ha;
+
shost->io_port = port_base;
shost->unique_id = port_base;
shost->n_io_port = REGION_SIZE;
@@ -1283,8 +1309,6 @@ static int port_detect(unsigned long por
shost->this_id = (ushort) info.host_addr[3];
shost->can_queue = (ushort) info.queue_size;
shost->cmd_per_lun = MAX_CMD_PER_LUN;
-
- ha = (struct hostdata *)shost->hostdata;
memset(ha, 0, sizeof(struct hostdata));
ha->subversion = subversion;
@@ -1293,11 +1317,9 @@ static int port_detect(unsigned long por
ha->pdev = pdev;
ha->board_number = j;
- if (ha->subversion == ESA)
- shost->unchecked_isa_dma = 0;
- else {
+ if (ha->subversion != ESA) {
unsigned long flags;
- shost->unchecked_isa_dma = 1;
+ shost->sense_buffer_isa = 1;
flags = claim_dma_lock();
disable_dma(dma_channel);
@@ -1355,7 +1377,7 @@ static int port_detect(unsigned long por
for (i = 0; i < shost->can_queue; i++) {
size_t sz = shost->sg_tablesize *sizeof(struct sg_list);
- gfp_t gfp_mask = (shost->unchecked_isa_dma ? GFP_DMA : 0) | GFP_ATOMIC;
+ gfp_t gfp_mask = (shost->sense_buffer_isa ? GFP_DMA : 0) | GFP_ATOMIC;
ha->cp[i].sglist = kmalloc(sz, gfp_mask);
if (!ha->cp[i].sglist) {
printk
@@ -1752,7 +1774,7 @@ static int eata2x_queuecommand(struct sc
void (*done) (struct scsi_cmnd *))
{
struct Scsi_Host *shost = SCpnt->device->host;
- struct hostdata *ha = (struct hostdata *)shost->hostdata;
+ struct hostdata *ha = eata_shost_priv(shost);
unsigned int i, k;
struct mscp *cpp;
@@ -1836,7 +1858,7 @@ static int eata2x_queuecommand(struct sc
static int eata2x_eh_abort(struct scsi_cmnd *SCarg)
{
struct Scsi_Host *shost = SCarg->device->host;
- struct hostdata *ha = (struct hostdata *)shost->hostdata;
+ struct hostdata *ha = eata_shost_priv(shost);
unsigned int i;
if (SCarg->host_scribble == NULL) {
@@ -1906,7 +1928,7 @@ static int eata2x_eh_host_reset(struct s
int arg_done = 0;
struct scsi_cmnd *SCpnt;
struct Scsi_Host *shost = SCarg->device->host;
- struct hostdata *ha = (struct hostdata *)shost->hostdata;
+ struct hostdata *ha = eata_shost_priv(shost);
scmd_printk(KERN_INFO, SCarg,
"reset, enter, pid %ld.\n", SCarg->serial_number);
@@ -2292,7 +2314,7 @@ static irqreturn_t ihdlr(struct Scsi_Hos
unsigned int i, k, c, status, tstatus, reg;
struct mssp *spp;
struct mscp *cpp;
- struct hostdata *ha = (struct hostdata *)shost->hostdata;
+ struct hostdata *ha = eata_shost_priv(shost);
int irq = shost->irq;
/* Check if this board need to be serviced */
@@ -2552,7 +2574,7 @@ static irqreturn_t do_interrupt_handler(
static int eata2x_release(struct Scsi_Host *shost)
{
- struct hostdata *ha = (struct hostdata *)shost->hostdata;
+ struct hostdata *ha = eata_shost_priv(shost);
unsigned int i;
for (i = 0; i < shost->can_queue; i++)
@@ -2572,6 +2594,8 @@ static int eata2x_release(struct Scsi_Ho
free_dma(shost->dma_channel);
release_region(shost->io_port, shost->n_io_port);
+ dma_free_coherent(ha->pdev ? &ha->pdev->dev : NULL,
+ sizeof(*ha), ha, eata_shost_dma(shost));
scsi_unregister(shost);
return 0;
}
next prev parent reply other threads:[~2008-10-02 7:58 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-02 7:58 [PATCH] [0/21] Remove SCSI unchecked_isa_dma try 3 Andi Kleen
2008-10-02 7:58 ` [PATCH] [1/21] SCSI-ISA-DMA: Add the alloc/get_pages_mask calls Andi Kleen
2008-10-02 7:58 ` [PATCH] [2/21] SCSI-ISA-DMA: Add blk_q_mask Andi Kleen
2008-10-02 7:58 ` [PATCH] [3/21] SCSI-ISA-DMA: Pass gfp to scsi_allocate_command Andi Kleen
2008-10-02 7:58 ` [PATCH] [4/21] SCSI-ISA-DMA: Add sense_buffer_isa to host template Andi Kleen
2008-10-02 7:58 ` [PATCH] [5/21] SCSI-ISA-DMA: Remove unchecked_isa in BusLogic Andi Kleen
2008-10-02 7:58 ` [PATCH] [6/21] SCSI-ISA-DMA: Remove unchecked_isa_dma in advansys.c Andi Kleen
2008-10-02 7:58 ` [PATCH] [7/21] SCSI-ISA-DMA: Remove unchecked_isa_dma in gdth Andi Kleen
2008-10-02 7:58 ` Andi Kleen [this message]
2008-10-02 7:58 ` [PATCH] [9/21] SCSI-ISA-DMA: Remove unchecked_isa_dma in aha1542 Andi Kleen
2008-10-02 7:58 ` [PATCH] [10/21] SCSI-ISA-DMA: Remove unchecked_isa_dma in aha152x/wd7000/sym53c416/u14-34f/NCR53c406a Andi Kleen
2008-10-02 7:58 ` [PATCH] [11/21] SCSI-ISA-DMA: Remove GFP_DMA uses in st/osst Andi Kleen
2008-10-02 7:58 ` [PATCH] [12/21] SCSI-ISA-DMA: Remove unchecked_isa_dma support for hostdata Andi Kleen
2008-10-02 7:58 ` [PATCH] [13/21] SCSI-ISA-DMA: Use blk_q_mask/get_pages_mask in sg driver Andi Kleen
2008-10-02 7:58 ` [PATCH] [14/21] SCSI-ISA-DMA: Rely on block layer bouncing for ISA DMA devices scanning Andi Kleen
2008-10-02 7:58 ` [PATCH] [15/21] SCSI-ISA-DMA: Don't disable direct_io for unchecked_isa_dma in st.c Andi Kleen
2008-10-02 7:58 ` [PATCH] [16/21] SCSI-ISA-DMA: Remove automatic block layer bouncing for unchecked_isa_dma Andi Kleen
2008-10-02 7:58 ` [PATCH] [17/21] SCSI-ISA-DMA: Remove GFP_DMA use in sr.c Andi Kleen
2008-10-02 7:58 ` [PATCH] [18/21] SCSI-ISA-DMA: Remove unchecked_isa_dma from sysfs Andi Kleen
2008-10-02 7:58 ` [PATCH] [19/21] SCSI-ISA-DMA: Switch to a single SCSI command pool Andi Kleen
2008-10-02 7:58 ` [PATCH] [20/21] SCSI-ISA-DMA: Finally kill unchecked_isa_dma Andi Kleen
2008-10-02 7:58 ` [PATCH] [21/21] SCSI-ISA-DMA: Convert DMA buffers in ch.c to allocate via the block layer Andi Kleen
2008-10-07 23:53 ` [PATCH] [0/21] Remove SCSI unchecked_isa_dma try 3 Andi Kleen
2008-10-08 10:21 ` Jens Axboe
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=20081002075846.3CAD03E6A07@basil.firstfloor.org \
--to=andi@firstfloor.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=axboe@kernel.dk \
--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