Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'ata-6.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/libata/linux

Pull ata updates from Niklas Cassel:

- Add 'external' to the libata.force module parameter, in order to
allow a user to workaround broken firmware (me)

- Use the str_up_down() helper in the sata_via driver (Salah Triki)

- Convert the Freescale PowerQUICC SATA device tree binding to YAML
(J. Neuschäfer)

- Do not use ATAPI DMA for a device that only supports PIO (me)

- Add Marvell 88SE9215 PCI device ID to the ahci driver. Since the
controller has quirks, it cannot rely on the generic AHCI PCI class
code entry (Daniel Kral)

- Improve the return value of atapi_check_dma() (Huacai Chen)

- Fix the NCQ Non-Data log not supported print to actually reference
the correct log (me)

- Make Marvel 88SE9215 prefer DMA for ATAPI devices (Huacai Chen)

- Simplify the AHCI IRQ vector allocations by performing the IRQ vector
allocations in the same function, regardless of IRQ type (Tomas
Henzl)

* tag 'ata-6.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/libata/linux:
ata: ahci: simplify init function
ahci: Marvell 88SE9215 controllers prefer DMA for ATAPI
ata: libata: Fix NCQ Non-Data log not supported print
ata: libata: Improve return value of atapi_check_dma()
ahci: add PCI ID for Marvell 88SE9215 SATA Controller
ata: libata-eh: Do not use ATAPI DMA for a device limited to PIO mode
dt-bindings: ata: Convert fsl,pq-sata to YAML
ata: sata_via: Use str_up_down() helper in vt6420_prereset()
ata: libata-core: Add 'external' to the libata.force kernel parameter

+141 -44
+2
Documentation/admin-guide/kernel-parameters.txt
··· 3117 3117 * max_sec_lba48: Set or clear transfer size limit to 3118 3118 65535 sectors. 3119 3119 3120 + * external: Mark port as external (hotplug-capable). 3121 + 3120 3122 * [no]lpm: Enable or disable link power management. 3121 3123 3122 3124 * [no]setxfer: Indicate if transfer speed mode setting
+60
Documentation/devicetree/bindings/ata/fsl,pq-sata.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/ata/fsl,pq-sata.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Freescale 8xxx/3.0 Gb/s SATA nodes 8 + 9 + maintainers: 10 + - J. Neuschäfer <j.ne@posteo.net> 11 + 12 + description: 13 + SATA nodes are defined to describe on-chip Serial ATA controllers. 14 + Each SATA controller should have its own node. 15 + 16 + properties: 17 + compatible: 18 + oneOf: 19 + - items: 20 + - enum: 21 + - fsl,mpc8377-sata 22 + - fsl,mpc8536-sata 23 + - fsl,mpc8315-sata 24 + - fsl,mpc8379-sata 25 + - const: fsl,pq-sata 26 + - const: fsl,pq-sata-v2 27 + 28 + reg: 29 + maxItems: 1 30 + 31 + interrupts: 32 + maxItems: 1 33 + 34 + cell-index: 35 + $ref: /schemas/types.yaml#/definitions/uint32 36 + enum: [1, 2, 3, 4] 37 + description: | 38 + 1 for controller @ 0x18000 39 + 2 for controller @ 0x19000 40 + 3 for controller @ 0x1a000 41 + 4 for controller @ 0x1b000 42 + 43 + required: 44 + - compatible 45 + - interrupts 46 + - cell-index 47 + 48 + additionalProperties: false 49 + 50 + examples: 51 + - | 52 + #include <dt-bindings/interrupt-controller/irq.h> 53 + sata@18000 { 54 + compatible = "fsl,mpc8379-sata", "fsl,pq-sata"; 55 + reg = <0x18000 0x1000>; 56 + cell-index = <1>; 57 + interrupts = <44 IRQ_TYPE_LEVEL_LOW>; 58 + }; 59 + 60 + ...
-28
Documentation/devicetree/bindings/ata/fsl-sata.txt
··· 1 - * Freescale 8xxx/3.0 Gb/s SATA nodes 2 - 3 - SATA nodes are defined to describe on-chip Serial ATA controllers. 4 - Each SATA port should have its own node. 5 - 6 - Required properties: 7 - - compatible : compatible list, contains 2 entries, first is 8 - "fsl,CHIP-sata", where CHIP is the processor 9 - (mpc8315, mpc8379, etc.) and the second is 10 - "fsl,pq-sata" 11 - - interrupts : <interrupt mapping for SATA IRQ> 12 - - cell-index : controller index. 13 - 1 for controller @ 0x18000 14 - 2 for controller @ 0x19000 15 - 3 for controller @ 0x1a000 16 - 4 for controller @ 0x1b000 17 - 18 - Optional properties: 19 - - reg : <registers mapping> 20 - 21 - Example: 22 - sata@18000 { 23 - compatible = "fsl,mpc8379-sata", "fsl,pq-sata"; 24 - reg = <0x18000 0x1000>; 25 - cell-index = <1>; 26 - interrupts = <2c 8>; 27 - interrupt-parent = < &ipic >; 28 - };
+23 -11
drivers/ata/ahci.c
··· 63 63 board_ahci_pcs_quirk_no_devslp, 64 64 board_ahci_pcs_quirk_no_sntf, 65 65 board_ahci_yes_fbs, 66 + board_ahci_yes_fbs_atapi_dma, 66 67 67 68 /* board IDs for specific chipsets in alphabetical order */ 68 69 board_ahci_al, ··· 184 183 }, 185 184 [board_ahci_yes_fbs] = { 186 185 AHCI_HFLAGS (AHCI_HFLAG_YES_FBS), 186 + .flags = AHCI_FLAG_COMMON, 187 + .pio_mask = ATA_PIO4, 188 + .udma_mask = ATA_UDMA6, 189 + .port_ops = &ahci_ops, 190 + }, 191 + [board_ahci_yes_fbs_atapi_dma] = { 192 + AHCI_HFLAGS (AHCI_HFLAG_YES_FBS | 193 + AHCI_HFLAG_ATAPI_DMA_QUIRK), 187 194 .flags = AHCI_FLAG_COMMON, 188 195 .pio_mask = ATA_PIO4, 189 196 .udma_mask = ATA_UDMA6, ··· 598 589 .driver_data = board_ahci_yes_fbs }, 599 590 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x91a3), 600 591 .driver_data = board_ahci_yes_fbs }, 592 + { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9215), 593 + .driver_data = board_ahci_yes_fbs_atapi_dma }, 601 594 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9230), 602 595 .driver_data = board_ahci_yes_fbs }, 603 596 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9235), ··· 1676 1665 return pci_irq_vector(to_pci_dev(host->dev), port); 1677 1666 } 1678 1667 1679 - static int ahci_init_msi(struct pci_dev *pdev, unsigned int n_ports, 1668 + static void ahci_init_irq(struct pci_dev *pdev, unsigned int n_ports, 1680 1669 struct ahci_host_priv *hpriv) 1681 1670 { 1682 1671 int nvec; 1683 1672 1684 - if (hpriv->flags & AHCI_HFLAG_NO_MSI) 1685 - return -ENODEV; 1673 + if (hpriv->flags & AHCI_HFLAG_NO_MSI) { 1674 + pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_INTX); 1675 + return; 1676 + } 1686 1677 1687 1678 /* 1688 1679 * If number of MSIs is less than number of ports then Sharing Last ··· 1698 1685 if (!(readl(hpriv->mmio + HOST_CTL) & HOST_MRSM)) { 1699 1686 hpriv->get_irq_vector = ahci_get_irq_vector; 1700 1687 hpriv->flags |= AHCI_HFLAG_MULTI_MSI; 1701 - return nvec; 1688 + return; 1702 1689 } 1703 1690 1704 1691 /* ··· 1713 1700 1714 1701 /* 1715 1702 * If the host is not capable of supporting per-port vectors, fall 1716 - * back to single MSI before finally attempting single MSI-X. 1703 + * back to single MSI before finally attempting single MSI-X or 1704 + * a legacy INTx. 1717 1705 */ 1718 1706 nvec = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSI); 1719 1707 if (nvec == 1) 1720 - return nvec; 1721 - return pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSIX); 1708 + return; 1709 + pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSIX | PCI_IRQ_INTX); 1722 1710 } 1723 1711 1724 1712 static void ahci_mark_external_port(struct ata_port *ap) ··· 1999 1985 } 2000 1986 host->private_data = hpriv; 2001 1987 2002 - if (ahci_init_msi(pdev, n_ports, hpriv) < 0) { 2003 - /* legacy intx interrupts */ 2004 - pcim_intx(pdev, 1); 2005 - } 1988 + ahci_init_irq(pdev, n_ports, hpriv); 1989 + 2006 1990 hpriv->irq = pci_irq_vector(pdev, 0); 2007 1991 2008 1992 if (!(hpriv->cap & HOST_CAP_SSS) || ahci_ignore_sss)
+1
drivers/ata/ahci.h
··· 246 246 AHCI_HFLAG_NO_SXS = BIT(26), /* SXS not supported */ 247 247 AHCI_HFLAG_43BIT_ONLY = BIT(27), /* 43bit DMA addr limit */ 248 248 AHCI_HFLAG_INTEL_PCS_QUIRK = BIT(28), /* apply Intel PCS quirk */ 249 + AHCI_HFLAG_ATAPI_DMA_QUIRK = BIT(29), /* force ATAPI to use DMA */ 249 250 250 251 /* ap->flags bits */ 251 252
+4
drivers/ata/libahci.c
··· 1322 1322 { 1323 1323 struct ahci_host_priv *hpriv = dev->link->ap->host->private_data; 1324 1324 1325 + if ((dev->class == ATA_DEV_ATAPI) && 1326 + (hpriv->flags & AHCI_HFLAG_ATAPI_DMA_QUIRK)) 1327 + dev->quirks |= ATA_QUIRK_ATAPI_MOD16_DMA; 1328 + 1325 1329 if (hpriv->flags & AHCI_HFLAG_SECT255) { 1326 1330 dev->max_sectors = 255; 1327 1331 ata_dev_info(dev,
+40 -2
drivers/ata/libata-core.c
··· 88 88 unsigned int xfer_mask; 89 89 unsigned int quirk_on; 90 90 unsigned int quirk_off; 91 + unsigned int pflags_on; 91 92 u16 lflags_on; 92 93 u16 lflags_off; 93 94 }; ··· 333 332 } 334 333 335 334 /** 335 + * ata_force_pflags - force port flags according to libata.force 336 + * @ap: ATA port of interest 337 + * 338 + * Force port flags according to libata.force and whine about it. 339 + * 340 + * LOCKING: 341 + * EH context. 342 + */ 343 + static void ata_force_pflags(struct ata_port *ap) 344 + { 345 + int i; 346 + 347 + for (i = ata_force_tbl_size - 1; i >= 0; i--) { 348 + const struct ata_force_ent *fe = &ata_force_tbl[i]; 349 + 350 + if (fe->port != -1 && fe->port != ap->print_id) 351 + continue; 352 + 353 + /* let pflags stack */ 354 + if (fe->param.pflags_on) { 355 + ap->pflags |= fe->param.pflags_on; 356 + ata_port_notice(ap, 357 + "FORCE: port flag 0x%x forced -> 0x%x\n", 358 + fe->param.pflags_on, ap->pflags); 359 + } 360 + } 361 + } 362 + 363 + /** 336 364 * ata_force_link_limits - force link limits according to libata.force 337 365 * @link: ATA link of interest 338 366 * ··· 516 486 } 517 487 } 518 488 #else 489 + static inline void ata_force_pflags(struct ata_port *ap) { } 519 490 static inline void ata_force_link_limits(struct ata_link *link) { } 520 491 static inline void ata_force_xfermask(struct ata_device *dev) { } 521 492 static inline void ata_force_quirks(struct ata_device *dev) { } ··· 2274 2243 2275 2244 if (!ata_log_supported(dev, ATA_LOG_NCQ_NON_DATA)) { 2276 2245 ata_dev_warn(dev, 2277 - "NCQ Send/Recv Log not supported\n"); 2246 + "NCQ Non-Data Log not supported\n"); 2278 2247 return; 2279 2248 } 2280 2249 err_mask = ata_read_log_page(dev, ATA_LOG_NCQ_NON_DATA, ··· 4583 4552 */ 4584 4553 if (!(qc->dev->quirks & ATA_QUIRK_ATAPI_MOD16_DMA) && 4585 4554 unlikely(qc->nbytes & 15)) 4586 - return 1; 4555 + return -EOPNOTSUPP; 4587 4556 4588 4557 if (ap->ops->check_atapi_dma) 4589 4558 return ap->ops->check_atapi_dma(qc); ··· 5491 5460 #endif 5492 5461 ata_sff_port_init(ap); 5493 5462 5463 + ata_force_pflags(ap); 5464 + 5494 5465 return ap; 5495 5466 } 5496 5467 EXPORT_SYMBOL_GPL(ata_port_alloc); ··· 6305 6272 { "no" #name, .lflags_on = (flags) }, \ 6306 6273 { #name, .lflags_off = (flags) } 6307 6274 6275 + #define force_pflag_on(name, flags) \ 6276 + { #name, .pflags_on = (flags) } 6277 + 6308 6278 #define force_quirk_on(name, flag) \ 6309 6279 { #name, .quirk_on = (flag) } 6310 6280 ··· 6366 6330 force_lflag_on(norst, ATA_LFLAG_NO_HRST | ATA_LFLAG_NO_SRST), 6367 6331 force_lflag_on(rstonce, ATA_LFLAG_RST_ONCE), 6368 6332 force_lflag_onoff(dbdelay, ATA_LFLAG_NO_DEBOUNCE_DELAY), 6333 + 6334 + force_pflag_on(external, ATA_PFLAG_EXTERNAL), 6369 6335 6370 6336 force_quirk_onoff(ncq, ATA_QUIRK_NONCQ), 6371 6337 force_quirk_onoff(ncqtrim, ATA_QUIRK_NO_NCQ_TRIM),
+9 -2
drivers/ata/libata-eh.c
··· 1542 1542 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; 1543 1543 tf.command = ATA_CMD_PACKET; 1544 1544 1545 - /* is it pointless to prefer PIO for "safety reasons"? */ 1546 - if (ap->flags & ATA_FLAG_PIO_DMA) { 1545 + /* 1546 + * Do not use DMA if the connected device only supports PIO, even if the 1547 + * port prefers PIO commands via DMA. 1548 + * 1549 + * Ideally, we should call atapi_check_dma() to check if it is safe for 1550 + * the LLD to use DMA for REQUEST_SENSE, but we don't have a qc. 1551 + * Since we can't check the command, perhaps we should only use pio? 1552 + */ 1553 + if ((ap->flags & ATA_FLAG_PIO_DMA) && !(dev->flags & ATA_DFLAG_PIO)) { 1547 1554 tf.protocol = ATAPI_PROT_DMA; 1548 1555 tf.feature |= ATAPI_PKT_DMA; 1549 1556 } else {
+2 -1
drivers/ata/sata_via.c
··· 25 25 #include <scsi/scsi_cmnd.h> 26 26 #include <scsi/scsi_host.h> 27 27 #include <linux/libata.h> 28 + #include <linux/string_choices.h> 28 29 29 30 #define DRV_NAME "sata_via" 30 31 #define DRV_VERSION "2.6" ··· 360 359 361 360 ata_port_info(ap, 362 361 "SATA link %s 1.5 Gbps (SStatus %X SControl %X)\n", 363 - online ? "up" : "down", sstatus, scontrol); 362 + str_up_down(online), sstatus, scontrol); 364 363 365 364 /* SStatus is read one more time */ 366 365 svia_scr_read(link, SCR_STATUS, &sstatus);