Skip to content

Commit 3d0a8d1

Browse files
committed
Merge branch 'for-3.2/drivers' of git://git.kernel.dk/linux-block
* 'for-3.2/drivers' of git://git.kernel.dk/linux-block: (30 commits) virtio-blk: use ida to allocate disk index hpsa: add small delay when using PCI Power Management to reset for kump cciss: add small delay when using PCI Power Management to reset for kump xen/blkback: Fix two races in the handling of barrier requests. xen/blkback: Check for proper operation. xen/blkback: Fix the inhibition to map pages when discarding sector ranges. xen/blkback: Report VBD_WSECT (wr_sect) properly. xen/blkback: Support 'feature-barrier' aka old-style BARRIER requests. xen-blkfront: plug device number leak in xlblk_init() error path xen-blkfront: If no barrier or flush is supported, use invalid operation. xen-blkback: use kzalloc() in favor of kmalloc()+memset() xen-blkback: fixed indentation and comments xen-blkfront: fix a deadlock while handling discard response xen-blkfront: Handle discard requests. xen-blkback: Implement discard requests ('feature-discard') xen-blkfront: add BLKIF_OP_DISCARD and discard request struct drivers/block/loop.c: remove unnecessary bdev argument from loop_clr_fd() drivers/block/loop.c: emit uevent on auto release drivers/block/cpqarray.c: use pci_dev->revision loop: always allow userspace partitions and optionally support automatic scanning ... Fic up trivial header file includsion conflict in drivers/block/loop.c
2 parents b4fdcb0 + a0eda62 commit 3d0a8d1

18 files changed

Lines changed: 638 additions & 123 deletions

File tree

‎Documentation/ABI/testing/sysfs-bus-pci-devices-cciss‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,10 @@ Description: Value of 1 indicates the controller can honor the reset_devices
7171
a dump device, as kdump requires resetting the device in order
7272
to work reliably.
7373

74+
Where: /sys/bus/pci/devices/<dev>/ccissX/transport_mode
75+
Date: July 2011
76+
Kernel Version: 3.0
77+
Contact: iss_storagedev@hp.com
78+
Description: Value of "simple" indicates that the controller has been placed
79+
in "simple mode". Value of "performant" indicates that the
80+
controller has been placed in "performant mode".

‎Documentation/blockdev/cciss.txt‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,16 @@ The device naming scheme is:
7878
/dev/cciss/c1d1p2 Controller 1, disk 1, partition 2
7979
/dev/cciss/c1d1p3 Controller 1, disk 1, partition 3
8080

81+
CCISS simple mode support
82+
-------------------------
83+
84+
The "cciss_simple_mode=1" boot parameter may be used to prevent the driver
85+
from putting the controller into "performant" mode. The difference is that
86+
with simple mode, each command completion requires an interrupt, while with
87+
"performant mode" (the default, and ordinarily better performing) it is
88+
possible to have multiple command completions indicated by a single
89+
interrupt.
90+
8191
SCSI tape drive and medium changer support
8292
------------------------------------------
8393

‎block/genhd.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ void register_disk(struct gendisk *disk)
537537
disk->slave_dir = kobject_create_and_add("slaves", &ddev->kobj);
538538

539539
/* No minors to use for partitions */
540-
if (!disk_partitionable(disk))
540+
if (!disk_part_scan_enabled(disk))
541541
goto exit;
542542

543543
/* No such device (e.g., media were just removed) */
@@ -848,7 +848,7 @@ static int show_partition(struct seq_file *seqf, void *v)
848848
char buf[BDEVNAME_SIZE];
849849

850850
/* Don't show non-partitionable removeable devices or empty devices */
851-
if (!get_capacity(sgp) || (!disk_partitionable(sgp) &&
851+
if (!get_capacity(sgp) || (!disk_max_parts(sgp) &&
852852
(sgp->flags & GENHD_FL_REMOVABLE)))
853853
return 0;
854854
if (sgp->flags & GENHD_FL_SUPPRESS_PARTITION_INFO)

‎block/ioctl.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static int blkdev_reread_part(struct block_device *bdev)
101101
struct gendisk *disk = bdev->bd_disk;
102102
int res;
103103

104-
if (!disk_partitionable(disk) || bdev != bdev->bd_contains)
104+
if (!disk_part_scan_enabled(disk) || bdev != bdev->bd_contains)
105105
return -EINVAL;
106106
if (!capable(CAP_SYS_ADMIN))
107107
return -EACCES;

‎drivers/block/cciss.c‎

Lines changed: 65 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ static int cciss_tape_cmds = 6;
6868
module_param(cciss_tape_cmds, int, 0644);
6969
MODULE_PARM_DESC(cciss_tape_cmds,
7070
"number of commands to allocate for tape devices (default: 6)");
71+
static int cciss_simple_mode;
72+
module_param(cciss_simple_mode, int, S_IRUGO|S_IWUSR);
73+
MODULE_PARM_DESC(cciss_simple_mode,
74+
"Use 'simple mode' rather than 'performant mode'");
7175

7276
static DEFINE_MUTEX(cciss_mutex);
7377
static struct proc_dir_entry *proc_cciss;
@@ -176,6 +180,7 @@ static void cciss_geometry_inquiry(ctlr_info_t *h, int logvol,
176180
unsigned int block_size, InquiryData_struct *inq_buff,
177181
drive_info_struct *drv);
178182
static void __devinit cciss_interrupt_mode(ctlr_info_t *);
183+
static int __devinit cciss_enter_simple_mode(struct ctlr_info *h);
179184
static void start_io(ctlr_info_t *h);
180185
static int sendcmd_withirq(ctlr_info_t *h, __u8 cmd, void *buff, size_t size,
181186
__u8 page_code, unsigned char scsi3addr[],
@@ -388,7 +393,7 @@ static void cciss_seq_show_header(struct seq_file *seq)
388393
h->product_name,
389394
(unsigned long)h->board_id,
390395
h->firm_ver[0], h->firm_ver[1], h->firm_ver[2],
391-
h->firm_ver[3], (unsigned int)h->intr[PERF_MODE_INT],
396+
h->firm_ver[3], (unsigned int)h->intr[h->intr_mode],
392397
h->num_luns,
393398
h->Qdepth, h->commands_outstanding,
394399
h->maxQsinceinit, h->max_outstanding, h->maxSG);
@@ -636,6 +641,18 @@ static ssize_t host_store_rescan(struct device *dev,
636641
}
637642
static DEVICE_ATTR(rescan, S_IWUSR, NULL, host_store_rescan);
638643

644+
static ssize_t host_show_transport_mode(struct device *dev,
645+
struct device_attribute *attr,
646+
char *buf)
647+
{
648+
struct ctlr_info *h = to_hba(dev);
649+
650+
return snprintf(buf, 20, "%s\n",
651+
h->transMethod & CFGTBL_Trans_Performant ?
652+
"performant" : "simple");
653+
}
654+
static DEVICE_ATTR(transport_mode, S_IRUGO, host_show_transport_mode, NULL);
655+
639656
static ssize_t dev_show_unique_id(struct device *dev,
640657
struct device_attribute *attr,
641658
char *buf)
@@ -808,6 +825,7 @@ static DEVICE_ATTR(usage_count, S_IRUGO, cciss_show_usage_count, NULL);
808825
static struct attribute *cciss_host_attrs[] = {
809826
&dev_attr_rescan.attr,
810827
&dev_attr_resettable.attr,
828+
&dev_attr_transport_mode.attr,
811829
NULL
812830
};
813831

@@ -3984,6 +4002,9 @@ static void __devinit cciss_put_controller_into_performant_mode(ctlr_info_t *h)
39844002
{
39854003
__u32 trans_support;
39864004

4005+
if (cciss_simple_mode)
4006+
return;
4007+
39874008
dev_dbg(&h->pdev->dev, "Trying to put board into Performant mode\n");
39884009
/* Attempt to put controller into performant mode if supported */
39894010
/* Does board support performant mode? */
@@ -4081,7 +4102,7 @@ static void __devinit cciss_interrupt_mode(ctlr_info_t *h)
40814102
default_int_mode:
40824103
#endif /* CONFIG_PCI_MSI */
40834104
/* if we get here we're going to use the default interrupt mode */
4084-
h->intr[PERF_MODE_INT] = h->pdev->irq;
4105+
h->intr[h->intr_mode] = h->pdev->irq;
40854106
return;
40864107
}
40874108

@@ -4341,6 +4362,9 @@ static int __devinit cciss_pci_init(ctlr_info_t *h)
43414362
}
43424363
cciss_enable_scsi_prefetch(h);
43434364
cciss_p600_dma_prefetch_quirk(h);
4365+
err = cciss_enter_simple_mode(h);
4366+
if (err)
4367+
goto err_out_free_res;
43444368
cciss_put_controller_into_performant_mode(h);
43454369
return 0;
43464370

@@ -4533,6 +4557,13 @@ static int cciss_controller_hard_reset(struct pci_dev *pdev,
45334557
pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
45344558
pmcsr |= PCI_D0;
45354559
pci_write_config_word(pdev, pos + PCI_PM_CTRL, pmcsr);
4560+
4561+
/*
4562+
* The P600 requires a small delay when changing states.
4563+
* Otherwise we may think the board did not reset and we bail.
4564+
* This for kdump only and is particular to the P600.
4565+
*/
4566+
msleep(500);
45364567
}
45374568
return 0;
45384569
}
@@ -4843,20 +4874,20 @@ static int cciss_request_irq(ctlr_info_t *h,
48434874
irqreturn_t (*intxhandler)(int, void *))
48444875
{
48454876
if (h->msix_vector || h->msi_vector) {
4846-
if (!request_irq(h->intr[PERF_MODE_INT], msixhandler,
4877+
if (!request_irq(h->intr[h->intr_mode], msixhandler,
48474878
IRQF_DISABLED, h->devname, h))
48484879
return 0;
48494880
dev_err(&h->pdev->dev, "Unable to get msi irq %d"
4850-
" for %s\n", h->intr[PERF_MODE_INT],
4881+
" for %s\n", h->intr[h->intr_mode],
48514882
h->devname);
48524883
return -1;
48534884
}
48544885

4855-
if (!request_irq(h->intr[PERF_MODE_INT], intxhandler,
4886+
if (!request_irq(h->intr[h->intr_mode], intxhandler,
48564887
IRQF_DISABLED, h->devname, h))
48574888
return 0;
48584889
dev_err(&h->pdev->dev, "Unable to get irq %d for %s\n",
4859-
h->intr[PERF_MODE_INT], h->devname);
4890+
h->intr[h->intr_mode], h->devname);
48604891
return -1;
48614892
}
48624893

@@ -4887,7 +4918,7 @@ static void cciss_undo_allocations_after_kdump_soft_reset(ctlr_info_t *h)
48874918
{
48884919
int ctlr = h->ctlr;
48894920

4890-
free_irq(h->intr[PERF_MODE_INT], h);
4921+
free_irq(h->intr[h->intr_mode], h);
48914922
#ifdef CONFIG_PCI_MSI
48924923
if (h->msix_vector)
48934924
pci_disable_msix(h->pdev);
@@ -4953,6 +4984,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
49534984
h = hba[i];
49544985
h->pdev = pdev;
49554986
h->busy_initializing = 1;
4987+
h->intr_mode = cciss_simple_mode ? SIMPLE_MODE_INT : PERF_MODE_INT;
49564988
INIT_LIST_HEAD(&h->cmpQ);
49574989
INIT_LIST_HEAD(&h->reqQ);
49584990
mutex_init(&h->busy_shutting_down);
@@ -5009,7 +5041,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
50095041

50105042
dev_info(&h->pdev->dev, "%s: <0x%x> at PCI %s IRQ %d%s using DAC\n",
50115043
h->devname, pdev->device, pci_name(pdev),
5012-
h->intr[PERF_MODE_INT], dac ? "" : " not");
5044+
h->intr[h->intr_mode], dac ? "" : " not");
50135045

50145046
if (cciss_allocate_cmd_pool(h))
50155047
goto clean4;
@@ -5056,7 +5088,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
50565088
spin_lock_irqsave(&h->lock, flags);
50575089
h->access.set_intr_mask(h, CCISS_INTR_OFF);
50585090
spin_unlock_irqrestore(&h->lock, flags);
5059-
free_irq(h->intr[PERF_MODE_INT], h);
5091+
free_irq(h->intr[h->intr_mode], h);
50605092
rc = cciss_request_irq(h, cciss_msix_discard_completions,
50615093
cciss_intx_discard_completions);
50625094
if (rc) {
@@ -5133,7 +5165,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
51335165
cciss_free_cmd_pool(h);
51345166
cciss_free_scatterlists(h);
51355167
cciss_free_sg_chain_blocks(h->cmd_sg_list, h->nr_cmds);
5136-
free_irq(h->intr[PERF_MODE_INT], h);
5168+
free_irq(h->intr[h->intr_mode], h);
51375169
clean2:
51385170
unregister_blkdev(h->major, h->devname);
51395171
clean1:
@@ -5172,9 +5204,31 @@ static void cciss_shutdown(struct pci_dev *pdev)
51725204
if (return_code != IO_OK)
51735205
dev_warn(&h->pdev->dev, "Error flushing cache\n");
51745206
h->access.set_intr_mask(h, CCISS_INTR_OFF);
5175-
free_irq(h->intr[PERF_MODE_INT], h);
5207+
free_irq(h->intr[h->intr_mode], h);
5208+
}
5209+
5210+
static int __devinit cciss_enter_simple_mode(struct ctlr_info *h)
5211+
{
5212+
u32 trans_support;
5213+
5214+
trans_support = readl(&(h->cfgtable->TransportSupport));
5215+
if (!(trans_support & SIMPLE_MODE))
5216+
return -ENOTSUPP;
5217+
5218+
h->max_commands = readl(&(h->cfgtable->CmdsOutMax));
5219+
writel(CFGTBL_Trans_Simple, &(h->cfgtable->HostWrite.TransportRequest));
5220+
writel(CFGTBL_ChangeReq, h->vaddr + SA5_DOORBELL);
5221+
cciss_wait_for_mode_change_ack(h);
5222+
print_cfg_table(h);
5223+
if (!(readl(&(h->cfgtable->TransportActive)) & CFGTBL_Trans_Simple)) {
5224+
dev_warn(&h->pdev->dev, "unable to get board into simple mode\n");
5225+
return -ENODEV;
5226+
}
5227+
h->transMethod = CFGTBL_Trans_Simple;
5228+
return 0;
51765229
}
51775230

5231+
51785232
static void __devexit cciss_remove_one(struct pci_dev *pdev)
51795233
{
51805234
ctlr_info_t *h;

‎drivers/block/cciss.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ struct ctlr_info
9292
unsigned int intr[4];
9393
unsigned int msix_vector;
9494
unsigned int msi_vector;
95+
int intr_mode;
9596
int cciss_max_sectors;
9697
BYTE cciss_read;
9798
BYTE cciss_write;

‎drivers/block/cpqarray.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,7 @@ static int cpqarray_pci_init(ctlr_info_t *c, struct pci_dev *pdev)
620620
}
621621
vendor_id = pdev->vendor;
622622
device_id = pdev->device;
623+
revision = pdev->revision;
623624
irq = pdev->irq;
624625

625626
for(i=0; i<6; i++)
@@ -632,7 +633,6 @@ static int cpqarray_pci_init(ctlr_info_t *c, struct pci_dev *pdev)
632633
}
633634

634635
pci_read_config_word(pdev, PCI_COMMAND, &command);
635-
pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision);
636636
pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &cache_line_size);
637637
pci_read_config_byte(pdev, PCI_LATENCY_TIMER, &latency_timer);
638638

0 commit comments

Comments
 (0)