All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/73] libata: rework logging, take II
@ 2021-12-08 16:31 Hannes Reinecke
  2021-12-08 16:31 ` [PATCH 01/73] libata: remove pointless debugging messages Hannes Reinecke
                   ` (73 more replies)
  0 siblings, 74 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:31 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Hi all,

after some prodding from individual persons I've resurrected my
patchset to put libata logging on a even keel, and use structured
logging for everything.
So this patch does away with DPRINTK, ATA_DEBUG or ata_msg_XXX() calls,
and moves everything over to structured logging (ie the dev_XXX()
calls).
Additionally I've added more tracepoints to trace command flow
and EH, HSM, and other related things.

So everything is looking far saner now.

As usual, comments and reviews are welcome.

I know that the device names suck. Blame Tejun.

Hannes Reinecke (73):
  libata: remove pointless debugging messages
  libata: Add ata_port_classify() helper
  libata: move ata_dump_id() to dynamic debugging
  libata: sanitize ATA_HORKAGE_DUMP_ID
  sata_mv: replace DPRINTK with 'pci_dump' module parameter
  sata_mv: kill 'port' argument in mv_dump_all_regs()
  libata: add reset tracepoints
  libata: drop DPRINTK() calls in reset
  libata: tracepoints for bus-master DMA
  libata: drop debugging statements for bus-master DMA
  pata_octeon_cf: add bmdma tracepoints and drop DPRINTK() calls
  pata_arasan_cf: use generic tracepoints
  sata_dwc_460ex: use generic tracepoints
  sata_nv: use generic tracepoints
  libata-sff: tracepoints for HSM state machine
  libata-sff: add tracepoints for ata_sff_flush_pio_task()
  libata-scsi: drop DPRINTK calls for cdb translation
  libata: add tracepoints for ATA error handling
  libata: drop DPRINTK() calls during ATA error handling
  libata-eh: remove DPRINTK() calls for request sense
  libata: move ata_{port,link,dev}_dbg to standard dev_XXX() macros
  libata: add qc_prep tracepoint
  libata: move DPRINTK to ata debugging
  pata_octeon_cf: remove DPRINTK() macro in interrupt context
  pdc_adma: Remove DPRINTK call
  sata_fsl: move DPRINTK to ata debugging
  sata_rcar: replace DPRINTK() with ata_port_dbg()
  sata_qstor: replace DPRINTK() with ata_port_dbg()
  pata_pdc2027x: Replace PDPRINTK() with standard ata logging
  libata: remove pointless VPRINTK() calls
  ahci: Drop pointless VPRINTK() calls and convert the remaining ones
  pdc_adma: Drop pointless VPRINTK() calls and convert the remaining
    ones
  pata_octeon_cf: Drop pointless VPRINTK() calls and convert the
    remaining ones
  pata_via: Drop pointless VPRINTK() calls
  sata_promise: Drop pointless VPRINTK() calls and convert the remaining
    ones
  sata_qstor: Drop pointless VPRINTK() calls
  sata_rcar: Drop pointless VPRINTK() calls
  sata_inic162x: Drop pointless VPRINTK() calls
  sata_mv: Drop pointless VPRINTK() call and convert the remaining one
  sata_nv: drop pointless VPRINTK() calls and convert remaining ones
  sata_fsl: convert VPRINTK() calls to ata_port_dbg()
  sata_sil: Drop pointless VPRINTK() calls
  sata_sx4: Drop pointless VPRINTK() calls and convert the remaining
    ones
  sata_sx4: add module parameter 'dimm_test'
  libata: drop ata_msg_error() and ata_msg_intr()
  libata: drop ata_msg_ctl()
  libata: drop ata_msg_malloc()
  libata: drop ata_msg_warn()
  libata: drop ata_msg_probe()
  libata: drop ata_msg_info()
  libata: drop ata_msg_drv()
  libata: remove 'new' ata message handling
  libata: remove debug compilation switches
  pata_atp867x: convert blank printk() calls
  pata_cmd640: convert blank printk() calls
  pata_cmd64x: convert blank printk() calls
  pata_cs5520: convert blank printk() calls
  pata_cs5536: convert blank printk() calls
  pata_cypressx: convert blank printk() calls
  pata_it821x: convert blank printk() calls
  pata_marvell: convert blank printk() calls
  pata_rz1000: convert blank printk() calls
  pata_serverworks: convert blank printk() calls
  pata_sil680: convert blank printk() calls
  pdc_adma: remove disabled debugging messages
  sata_sx4: convert blank printk() calls
  sata_mv: convert remaining printk() to structured logging
  pata_hpt37x: convert pr_XXX() calls
  pata_octeon_cf: Replace pr_XXX() calls with structured logging
  pata_hpt3x2n: convert pr_XXX() calls
  pata_hpt3x2n: convert pr_err() calls
  pata_hpt366: convert pr_warn() calls
  libata-scsi: rework ata_dump_status to avoid using pr_cont()

 drivers/ata/acard-ahci.c        |   4 -
 drivers/ata/ahci.c              |  13 +-
 drivers/ata/ahci_qoriq.c        |   4 -
 drivers/ata/ahci_xgene.c        |   4 -
 drivers/ata/ata_piix.c          |   3 -
 drivers/ata/libahci.c           |  33 +--
 drivers/ata/libata-acpi.c       |  71 +++---
 drivers/ata/libata-core.c       | 270 ++++++++--------------
 drivers/ata/libata-eh.c         |  50 +++--
 drivers/ata/libata-pmp.c        |   8 -
 drivers/ata/libata-sata.c       |   5 -
 drivers/ata/libata-scsi.c       | 111 ++-------
 drivers/ata/libata-sff.c        |  86 +++----
 drivers/ata/libata-trace.c      |  29 +++
 drivers/ata/libata.h            |   1 -
 drivers/ata/pata_arasan_cf.c    |   3 +
 drivers/ata/pata_atp867x.c      |  29 +--
 drivers/ata/pata_cmd640.c       |   2 +-
 drivers/ata/pata_cmd64x.c       |   4 +-
 drivers/ata/pata_cs5520.c       |   4 +-
 drivers/ata/pata_cs5536.c       |   4 +-
 drivers/ata/pata_cypress.c      |   2 +-
 drivers/ata/pata_hpt366.c       |   4 +-
 drivers/ata/pata_hpt37x.c       |  19 +-
 drivers/ata/pata_hpt3x2n.c      |  11 +-
 drivers/ata/pata_it821x.c       |  43 ++--
 drivers/ata/pata_ixp4xx_cf.c    |   6 +-
 drivers/ata/pata_marvell.c      |   9 +-
 drivers/ata/pata_octeon_cf.c    |  48 +---
 drivers/ata/pata_pdc2027x.c     |  71 +++---
 drivers/ata/pata_pdc202xx_old.c |   2 -
 drivers/ata/pata_rz1000.c       |   4 +-
 drivers/ata/pata_serverworks.c  |   4 +-
 drivers/ata/pata_sil680.c       |   9 +-
 drivers/ata/pata_via.c          |  12 -
 drivers/ata/pdc_adma.c          |  33 +--
 drivers/ata/sata_dwc_460ex.c    |  71 +-----
 drivers/ata/sata_fsl.c          | 165 ++++++--------
 drivers/ata/sata_gemini.c       |   4 +-
 drivers/ata/sata_inic162x.c     |   4 +-
 drivers/ata/sata_mv.c           | 147 ++++++------
 drivers/ata/sata_nv.c           |  53 ++---
 drivers/ata/sata_promise.c      |  31 +--
 drivers/ata/sata_qstor.c        |  15 +-
 drivers/ata/sata_rcar.c         |  25 +--
 drivers/ata/sata_sil.c          |   1 -
 drivers/ata/sata_sil24.c        |   5 +-
 drivers/ata/sata_sx4.c          | 148 +++++-------
 include/linux/libata.h          |  99 ++------
 include/trace/events/libata.h   | 387 +++++++++++++++++++++++++++++++-
 50 files changed, 992 insertions(+), 1178 deletions(-)

-- 
2.29.2


^ permalink raw reply	[flat|nested] 114+ messages in thread

* [PATCH 01/73] libata: remove pointless debugging messages
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
@ 2021-12-08 16:31 ` Hannes Reinecke
  2021-12-08 16:31 ` [PATCH 02/73] libata: Add ata_port_classify() helper Hannes Reinecke
                   ` (72 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:31 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke, Bartlomiej Zolnierkiewicz

Debugging messages in pci init functions or sg setup are pretty
much pointless, as the workflow pretty much decides what happened.
So drop them.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 drivers/ata/acard-ahci.c  |  4 ----
 drivers/ata/ahci.c        |  2 --
 drivers/ata/ata_piix.c    |  3 ---
 drivers/ata/libahci.c     |  3 ---
 drivers/ata/libata-core.c | 11 -----------
 drivers/ata/libata-sff.c  |  2 --
 drivers/ata/sata_nv.c     |  4 ----
 7 files changed, 29 deletions(-)

diff --git a/drivers/ata/acard-ahci.c b/drivers/ata/acard-ahci.c
index 2a04e8abd397..536d4cb8f08b 100644
--- a/drivers/ata/acard-ahci.c
+++ b/drivers/ata/acard-ahci.c
@@ -185,8 +185,6 @@ static unsigned int acard_ahci_fill_sg(struct ata_queued_cmd *qc, void *cmd_tbl)
 	struct acard_sg *acard_sg = cmd_tbl + AHCI_CMD_TBL_HDR_SZ;
 	unsigned int si, last_si = 0;
 
-	VPRINTK("ENTER\n");
-
 	/*
 	 * Next, the S/G list.
 	 */
@@ -362,8 +360,6 @@ static int acard_ahci_init_one(struct pci_dev *pdev, const struct pci_device_id
 	struct ata_host *host;
 	int n_ports, i, rc;
 
-	VPRINTK("ENTER\n");
-
 	WARN_ON((int)ATA_MAX_QUEUE > AHCI_MAX_CMDS);
 
 	ata_print_version_once(&pdev->dev, DRV_VERSION);
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index d60f34718b5d..5fa8a12c6b3b 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1672,8 +1672,6 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	int n_ports, i, rc;
 	int ahci_pci_bar = AHCI_PCI_BAR_STANDARD;
 
-	VPRINTK("ENTER\n");
-
 	WARN_ON((int)ATA_MAX_QUEUE > AHCI_MAX_CMDS);
 
 	ata_print_version_once(&pdev->dev, DRV_VERSION);
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 0b2fcf0d1d6c..eb6bf30bd2e3 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -1345,7 +1345,6 @@ static void piix_init_pcs(struct ata_host *host,
 	new_pcs = pcs | map_db->port_enable;
 
 	if (new_pcs != pcs) {
-		DPRINTK("updating PCS from 0x%x to 0x%x\n", pcs, new_pcs);
 		pci_write_config_word(pdev, ICH5_PCS, new_pcs);
 		msleep(150);
 	}
@@ -1769,14 +1768,12 @@ static int __init piix_init(void)
 {
 	int rc;
 
-	DPRINTK("pci_register_driver\n");
 	rc = pci_register_driver(&piix_pci_driver);
 	if (rc)
 		return rc;
 
 	in_module_init = 0;
 
-	DPRINTK("done\n");
 	return 0;
 }
 
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 8a6835bfd18a..8b651f55fc84 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -1620,8 +1620,6 @@ static unsigned int ahci_fill_sg(struct ata_queued_cmd *qc, void *cmd_tbl)
 	struct ahci_sg *ahci_sg = cmd_tbl + AHCI_CMD_TBL_HDR_SZ;
 	unsigned int si;
 
-	VPRINTK("ENTER\n");
-
 	/*
 	 * Next, the S/G list.
 	 */
@@ -1695,7 +1693,6 @@ static void ahci_fbs_dec_intr(struct ata_port *ap)
 	u32 fbs = readl(port_mmio + PORT_FBS);
 	int retries = 3;
 
-	DPRINTK("ENTER\n");
 	BUG_ON(!pp->fbs_enabled);
 
 	/* time to wait for DEC is not specified by AHCI spec,
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 8a0ccb190d76..f6a9e2f22a94 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -764,9 +764,6 @@ int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev,
 		head  = track % dev->heads;
 		sect  = (u32)block % dev->sectors + 1;
 
-		DPRINTK("block %u track %u cyl %u head %u sect %u\n",
-			(u32)block, track, cyl, head, sect);
-
 		/* Check whether the converted CHS can fit.
 		   Cylinder: 0-65535
 		   Head: 0-15
@@ -4562,8 +4559,6 @@ static int ata_sg_setup(struct ata_queued_cmd *qc)
 	struct ata_port *ap = qc->ap;
 	unsigned int n_elem;
 
-	VPRINTK("ENTER, ata%u\n", ap->print_id);
-
 	n_elem = dma_map_sg(ap->dev, qc->sg, qc->n_elem, qc->dma_dir);
 	if (n_elem < 1)
 		return -1;
@@ -5368,8 +5363,6 @@ struct ata_port *ata_port_alloc(struct ata_host *host)
 {
 	struct ata_port *ap;
 
-	DPRINTK("ENTER\n");
-
 	ap = kzalloc(sizeof(*ap), GFP_KERNEL);
 	if (!ap)
 		return NULL;
@@ -5486,8 +5479,6 @@ struct ata_host *ata_host_alloc(struct device *dev, int max_ports)
 	int i;
 	void *dr;
 
-	DPRINTK("ENTER\n");
-
 	/* alloc a container for our list of ATA ports (buses) */
 	sz = sizeof(struct ata_host) + (max_ports + 1) * sizeof(void *);
 	host = kzalloc(sz, GFP_KERNEL);
@@ -5777,9 +5768,7 @@ int ata_port_probe(struct ata_port *ap)
 		__ata_port_probe(ap);
 		ata_port_wait_eh(ap);
 	} else {
-		DPRINTK("ata%u: bus probe begin\n", ap->print_id);
 		rc = ata_bus_probe(ap);
-		DPRINTK("ata%u: bus probe end\n", ap->print_id);
 	}
 	return rc;
 }
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index b71ea4a680b0..39c026f3948c 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -2467,8 +2467,6 @@ static int ata_pci_init_one(struct pci_dev *pdev,
 	struct ata_host *host = NULL;
 	int rc;
 
-	DPRINTK("ENTER\n");
-
 	pi = ata_sff_find_valid_pi(ppi);
 	if (!pi) {
 		dev_err(&pdev->dev, "no valid port_info specified\n");
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index 16272c111208..3c70405a0b80 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -1277,8 +1277,6 @@ static int nv_adma_host_init(struct ata_host *host)
 	unsigned int i;
 	u32 tmp32;
 
-	VPRINTK("ENTER\n");
-
 	/* enable ADMA on the ports */
 	pci_read_config_dword(pdev, NV_MCP_SATA_CFG_20, &tmp32);
 	tmp32 |= NV_MCP_SATA_CFG_20_PORT0_EN |
@@ -1320,8 +1318,6 @@ static void nv_adma_fill_sg(struct ata_queued_cmd *qc, struct nv_adma_cpb *cpb)
 	struct scatterlist *sg;
 	unsigned int si;
 
-	VPRINTK("ENTER\n");
-
 	for_each_sg(qc->sg, sg, qc->n_elem, si) {
 		aprd = (si < 5) ? &cpb->aprd[si] :
 			&pp->aprd[NV_ADMA_SGTBL_LEN * qc->hw_tag + (si-5)];
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 02/73] libata: Add ata_port_classify() helper
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
  2021-12-08 16:31 ` [PATCH 01/73] libata: remove pointless debugging messages Hannes Reinecke
@ 2021-12-08 16:31 ` Hannes Reinecke
  2021-12-08 22:21     ` kernel test robot
                     ` (2 more replies)
  2021-12-08 16:31 ` [PATCH 03/73] libata: move ata_dump_id() to dynamic debugging Hannes Reinecke
                   ` (71 subsequent siblings)
  73 siblings, 3 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:31 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke, Bartlomiej Zolnierkiewicz

Add an ata_port_classify() helper to print out the results from
the device classification and remove the debugging statements
from ata_dev_classify(). Also provide a mapping ata_dev_class_string()
to provide a string representation for those instances calling
ata_dev_classify() directly.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 drivers/ata/libahci.c       |  2 +-
 drivers/ata/libata-core.c   | 67 ++++++++++++++++++++++++++++---------
 drivers/ata/libata-sff.c    |  2 +-
 drivers/ata/sata_fsl.c      |  2 +-
 drivers/ata/sata_inic162x.c |  2 +-
 drivers/ata/sata_sil24.c    |  2 +-
 include/linux/libata.h      |  2 ++
 7 files changed, 58 insertions(+), 21 deletions(-)

diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 8b651f55fc84..21dbcd551443 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -1300,7 +1300,7 @@ unsigned int ahci_dev_classify(struct ata_port *ap)
 	tf.lbal		= (tmp >> 8)	& 0xff;
 	tf.nsect	= (tmp)		& 0xff;
 
-	return ata_dev_classify(&tf);
+	return ata_port_classify(ap, &tf);
 }
 EXPORT_SYMBOL_GPL(ahci_dev_classify);
 
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index f6a9e2f22a94..6cac413caf83 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -969,6 +969,27 @@ const char *sata_spd_string(unsigned int spd)
 	return spd_str[spd - 1];
 }
 
+const char *ata_dev_class_string(unsigned int class)
+{
+	static const char * const class_str[] = {
+		"unknown",
+		"ATA",
+		"ATA (unsupported)",
+		"ATAPI",
+		"ATAPI (unsupported",
+		"PMP",
+		"PMP (unsupported)",
+		"SEMB",
+		"SEMB (unsupported)",
+		"ZAC",
+		"ZAC (unsupported)",
+		"none",
+	};
+	if (class == 0 || (class - 1) >= ARRAY_SIZE(class_str))
+		return "unknown";
+	return class_str[class - 1];
+}
+
 /**
  *	ata_dev_classify - determine device type based on ATA-spec signature
  *	@tf: ATA taskfile register set for device to be identified
@@ -1007,36 +1028,50 @@ unsigned int ata_dev_classify(const struct ata_taskfile *tf)
 	 * SEMB signature.  This is worked around in
 	 * ata_dev_read_id().
 	 */
-	if ((tf->lbam == 0) && (tf->lbah == 0)) {
-		DPRINTK("found ATA device by sig\n");
+	if ((tf->lbam == 0) && (tf->lbah == 0))
 		return ATA_DEV_ATA;
-	}
 
-	if ((tf->lbam == 0x14) && (tf->lbah == 0xeb)) {
-		DPRINTK("found ATAPI device by sig\n");
+	if ((tf->lbam == 0x14) && (tf->lbah == 0xeb))
 		return ATA_DEV_ATAPI;
-	}
 
-	if ((tf->lbam == 0x69) && (tf->lbah == 0x96)) {
-		DPRINTK("found PMP device by sig\n");
+	if ((tf->lbam == 0x69) && (tf->lbah == 0x96))
 		return ATA_DEV_PMP;
-	}
 
-	if ((tf->lbam == 0x3c) && (tf->lbah == 0xc3)) {
-		DPRINTK("found SEMB device by sig (could be ATA device)\n");
+	if ((tf->lbam == 0x3c) && (tf->lbah == 0xc3))
 		return ATA_DEV_SEMB;
-	}
 
-	if ((tf->lbam == 0xcd) && (tf->lbah == 0xab)) {
-		DPRINTK("found ZAC device by sig\n");
+	if ((tf->lbam == 0xcd) && (tf->lbah == 0xab))
 		return ATA_DEV_ZAC;
-	}
 
-	DPRINTK("unknown device\n");
 	return ATA_DEV_UNKNOWN;
 }
 EXPORT_SYMBOL_GPL(ata_dev_classify);
 
+/**
+ *     ata_port_classify - determine device type based on ATA-spec signature
+ *     @ap: ATA port device on which the classification should be run
+ *     @tf: ATA taskfile register set for device to be identified
+ *
+ *     A wrapper around ata_dev_classify() to provide additional logging
+ *
+ *     RETURNS:
+ *     Device type, %ATA_DEV_ATA, %ATA_DEV_ATAPI, %ATA_DEV_PMP,
+ *     %ATA_DEV_ZAC, or %ATA_DEV_UNKNOWN the event of failure.
+ */
+unsigned int ata_port_classify(struct ata_port *ap,
+			       const struct ata_taskfile *tf)
+{
+	unsigned int class = ata_dev_classify(tf);
+
+	if (class != ATA_DEV_UNKNOWN)
+		ata_port_dbg(ap, "found %s device by sig\n",
+			     ata_dev_class_string(class));
+	else
+		ata_port_dbg(ap, "found unknown device\n");
+	return class;
+}
+EXPORT_SYMBOL_GPL(ata_port_classify);
+
 /**
  *	ata_id_string - Convert IDENTIFY DEVICE page into string
  *	@id: IDENTIFY DEVICE results we will examine
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 39c026f3948c..a119fabe0919 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -1853,7 +1853,7 @@ unsigned int ata_sff_dev_classify(struct ata_device *dev, int present,
 		return ATA_DEV_NONE;
 
 	/* determine if device is ATA or ATAPI */
-	class = ata_dev_classify(&tf);
+	class = ata_port_classify(ap, &tf);
 
 	if (class == ATA_DEV_UNKNOWN) {
 		/* If the device failed diagnostic, it's likely to
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index e5838b23c9e0..dbc57b7a58b8 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -812,7 +812,7 @@ static unsigned int sata_fsl_dev_classify(struct ata_port *ap)
 	tf.lbal = (temp >> 8) & 0xff;
 	tf.nsect = temp & 0xff;
 
-	return ata_dev_classify(&tf);
+	return ata_port_classify(ap, &tf);
 }
 
 static int sata_fsl_hardreset(struct ata_link *link, unsigned int *class,
diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c
index e517bd8822a5..b6239dae524a 100644
--- a/drivers/ata/sata_inic162x.c
+++ b/drivers/ata/sata_inic162x.c
@@ -657,7 +657,7 @@ static int inic_hardreset(struct ata_link *link, unsigned int *class,
 		}
 
 		inic_tf_read(ap, &tf);
-		*class = ata_dev_classify(&tf);
+		*class = ata_port_classify(ap, &tf);
 	}
 
 	return 0;
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index f99ec6f7d7c0..7e9c1945dc81 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -680,7 +680,7 @@ static int sil24_softreset(struct ata_link *link, unsigned int *class,
 	}
 
 	sil24_read_tf(ap, 0, &tf);
-	*class = ata_dev_classify(&tf);
+	*class = ata_port_classify(ap, &tf);
 
 	DPRINTK("EXIT, class=%u\n", *class);
 	return 0;
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 2a8404b26083..235fdbeb19ea 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1160,6 +1160,8 @@ extern enum ata_completion_errors ata_noop_qc_prep(struct ata_queued_cmd *qc);
 extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
 		 unsigned int n_elem);
 extern unsigned int ata_dev_classify(const struct ata_taskfile *tf);
+extern unsigned int ata_port_classify(struct ata_port *ap,
+				      const struct ata_taskfile *tf);
 extern void ata_dev_disable(struct ata_device *adev);
 extern void ata_id_string(const u16 *id, unsigned char *s,
 			  unsigned int ofs, unsigned int len);
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 03/73] libata: move ata_dump_id() to dynamic debugging
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
  2021-12-08 16:31 ` [PATCH 01/73] libata: remove pointless debugging messages Hannes Reinecke
  2021-12-08 16:31 ` [PATCH 02/73] libata: Add ata_port_classify() helper Hannes Reinecke
@ 2021-12-08 16:31 ` Hannes Reinecke
  2021-12-08 16:31 ` [PATCH 04/73] libata: sanitize ATA_HORKAGE_DUMP_ID Hannes Reinecke
                   ` (70 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:31 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke, Bartlomiej Zolnierkiewicz

Use ata_dev_dbg() to print out the information in ata_dump_id()
and remove the ata_msg_probe() conditional.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 drivers/ata/libata-core.c | 38 ++++++++++----------------------------
 1 file changed, 10 insertions(+), 28 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 6cac413caf83..6b8c6be65458 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1387,6 +1387,7 @@ static int ata_hpa_resize(struct ata_device *dev)
 
 /**
  *	ata_dump_id - IDENTIFY DEVICE info debugging output
+ *	@dev: device from which the information is fetched
  *	@id: IDENTIFY DEVICE page to dump
  *
  *	Dump selected 16-bit words from the given IDENTIFY DEVICE
@@ -1396,32 +1397,14 @@ static int ata_hpa_resize(struct ata_device *dev)
  *	caller.
  */
 
-static inline void ata_dump_id(const u16 *id)
-{
-	DPRINTK("49==0x%04x  "
-		"53==0x%04x  "
-		"63==0x%04x  "
-		"64==0x%04x  "
-		"75==0x%04x  \n",
-		id[49],
-		id[53],
-		id[63],
-		id[64],
-		id[75]);
-	DPRINTK("80==0x%04x  "
-		"81==0x%04x  "
-		"82==0x%04x  "
-		"83==0x%04x  "
-		"84==0x%04x  \n",
-		id[80],
-		id[81],
-		id[82],
-		id[83],
-		id[84]);
-	DPRINTK("88==0x%04x  "
-		"93==0x%04x\n",
-		id[88],
-		id[93]);
+static inline void ata_dump_id(struct ata_device *dev, const u16 *id)
+{
+	ata_dev_dbg(dev,
+		"49==0x%04x  53==0x%04x  63==0x%04x  64==0x%04x  75==0x%04x\n"
+		"80==0x%04x  81==0x%04x  82==0x%04x  83==0x%04x  84==0x%04x\n"
+		"88==0x%04x  93==0x%04x\n",
+		id[49], id[53], id[63], id[64], id[75], id[80],
+		id[81], id[82], id[83], id[84], id[88], id[93]);
 }
 
 /**
@@ -2673,8 +2656,7 @@ int ata_dev_configure(struct ata_device *dev)
 	/* find max transfer mode; for printk only */
 	xfer_mask = ata_id_xfermask(id);
 
-	if (ata_msg_probe(ap))
-		ata_dump_id(id);
+	ata_dump_id(dev, id);
 
 	/* SCSI only uses 4-char revisions, dump full 8 chars from ATA */
 	ata_id_c_string(dev->id, fwrevbuf, ATA_ID_FW_REV,
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 04/73] libata: sanitize ATA_HORKAGE_DUMP_ID
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (2 preceding siblings ...)
  2021-12-08 16:31 ` [PATCH 03/73] libata: move ata_dump_id() to dynamic debugging Hannes Reinecke
@ 2021-12-08 16:31 ` Hannes Reinecke
  2021-12-08 16:31 ` [PATCH 05/73] sata_mv: replace DPRINTK with 'pci_dump' module parameter Hannes Reinecke
                   ` (69 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:31 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke, Bartlomiej Zolnierkiewicz

As ata_dev_dbg() is now using dynamic debugging ATA_HORKAGE_DUMP_ID
will now print out the raw IDENTIFY data without a header unless
explicitly enable via dyndebug.
So move the logging level up to INFO and have the header printed
always.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 drivers/ata/libata-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 6b8c6be65458..3977da2d098e 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1894,10 +1894,10 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
 	}
 
 	if (dev->horkage & ATA_HORKAGE_DUMP_ID) {
-		ata_dev_dbg(dev, "dumping IDENTIFY data, "
+		ata_dev_info(dev, "dumping IDENTIFY data, "
 			    "class=%d may_fallback=%d tried_spinup=%d\n",
 			    class, may_fallback, tried_spinup);
-		print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET,
+		print_hex_dump(KERN_INFO, "", DUMP_PREFIX_OFFSET,
 			       16, 2, id, ATA_ID_WORDS * sizeof(*id), true);
 	}
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 05/73] sata_mv: replace DPRINTK with 'pci_dump' module parameter
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (3 preceding siblings ...)
  2021-12-08 16:31 ` [PATCH 04/73] libata: sanitize ATA_HORKAGE_DUMP_ID Hannes Reinecke
@ 2021-12-08 16:31 ` Hannes Reinecke
  2021-12-09  0:38   ` Damien Le Moal
  2021-12-08 16:31 ` [PATCH 06/73] sata_mv: kill 'port' argument in mv_dump_all_regs() Hannes Reinecke
                   ` (68 subsequent siblings)
  73 siblings, 1 reply; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:31 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke, Bartlomiej Zolnierkiewicz

Implement module parameter 'pci_dump' and move the DPRINTK calls
over to dev_printk().

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 drivers/ata/sata_mv.c | 88 ++++++++++++++++++++++++-------------------
 1 file changed, 49 insertions(+), 39 deletions(-)

diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index cae4c1eab102..f0257685495f 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -83,6 +83,10 @@ module_param(irq_coalescing_usecs, int, S_IRUGO);
 MODULE_PARM_DESC(irq_coalescing_usecs,
 		 "IRQ coalescing time threshold in usecs");
 
+static int pci_dump;
+module_param(pci_dump, int, S_IRUGO);
+MODULE_PARM_DESC(pci_dump, "Enable dumping of PCI registers on error");
+
 enum {
 	/* BAR's are enumerated in terms of pci_resource_start() terms */
 	MV_PRIMARY_BAR		= 0,	/* offset 0x10: memory space */
@@ -1248,42 +1252,43 @@ static int mv_stop_edma(struct ata_port *ap)
 	return err;
 }
 
-#ifdef ATA_DEBUG
-static void mv_dump_mem(void __iomem *start, unsigned bytes)
+static void mv_dump_mem(struct device *dev, void __iomem *start, unsigned bytes)
 {
-	int b, w;
+	int b, w, o;
+	unsigned char linebuf[38];
+
 	for (b = 0; b < bytes; ) {
-		DPRINTK("%p: ", start + b);
-		for (w = 0; b < bytes && w < 4; w++) {
-			printk("%08x ", readl(start + b));
+		for (w = 0, o = 0; b < bytes && w < 4; w++) {
+			o += snprintf(linebuf + o, 38 - o,
+				      "%08x ", readl(start + b));
 			b += sizeof(u32);
 		}
-		printk("\n");
+		dev_printk(KERN_DEBUG, dev, "%s: %p: %s\n",
+			   __func__, start + b, linebuf);
 	}
 }
-#endif
-#if defined(ATA_DEBUG) || defined(CONFIG_PCI)
+
 static void mv_dump_pci_cfg(struct pci_dev *pdev, unsigned bytes)
 {
-#ifdef ATA_DEBUG
-	int b, w;
+	int b, w, o;
 	u32 dw;
+	unsigned char linebuf[38];
+
 	for (b = 0; b < bytes; ) {
-		DPRINTK("%02x: ", b);
-		for (w = 0; b < bytes && w < 4; w++) {
+		for (w = 0, o = 0; b < bytes && w < 4; w++) {
 			(void) pci_read_config_dword(pdev, b, &dw);
-			printk("%08x ", dw);
+			o += snprintf(linebuf + o, 38 - o,
+				      "%08x ", dw);
 			b += sizeof(u32);
 		}
-		printk("\n");
+		dev_printk(KERN_DEBUG, &pdev->dev, "%s: %02x: %s\n",
+			   __func__, b, linebuf);
 	}
-#endif
 }
-#endif
+
 static void mv_dump_all_regs(void __iomem *mmio_base, int port,
 			     struct pci_dev *pdev)
 {
-#ifdef ATA_DEBUG
 	void __iomem *hc_base = mv_hc_base(mmio_base,
 					   port >> MV_PORT_HC_SHIFT);
 	void __iomem *port_base;
@@ -1298,31 +1303,34 @@ static void mv_dump_all_regs(void __iomem *mmio_base, int port,
 		start_port = port;
 		num_ports = num_hcs = 1;
 	}
-	DPRINTK("All registers for port(s) %u-%u:\n", start_port,
-		num_ports > 1 ? num_ports - 1 : start_port);
+	dev_printk(KERN_DEBUG, &pdev->dev,
+		   "%s: All registers for port(s) %u-%u:\n", __func__,
+		   start_port, num_ports > 1 ? num_ports - 1 : start_port);
 
-	if (NULL != pdev) {
-		DPRINTK("PCI config space regs:\n");
-		mv_dump_pci_cfg(pdev, 0x68);
-	}
-	DPRINTK("PCI regs:\n");
-	mv_dump_mem(mmio_base+0xc00, 0x3c);
-	mv_dump_mem(mmio_base+0xd00, 0x34);
-	mv_dump_mem(mmio_base+0xf00, 0x4);
-	mv_dump_mem(mmio_base+0x1d00, 0x6c);
+	dev_printk(KERN_DEBUG, &pdev->dev,
+		   "%s: PCI config space regs:\n", __func__);
+	mv_dump_pci_cfg(pdev, 0x68);
+
+	dev_printk(KERN_DEBUG, &pdev->dev, "%s: PCI regs:\n", __func__);
+	mv_dump_mem(&pdev->dev, mmio_base+0xc00, 0x3c);
+	mv_dump_mem(&pdev->dev, mmio_base+0xd00, 0x34);
+	mv_dump_mem(&pdev->dev, mmio_base+0xf00, 0x4);
+	mv_dump_mem(&pdev->dev, mmio_base+0x1d00, 0x6c);
 	for (hc = start_hc; hc < start_hc + num_hcs; hc++) {
 		hc_base = mv_hc_base(mmio_base, hc);
-		DPRINTK("HC regs (HC %i):\n", hc);
-		mv_dump_mem(hc_base, 0x1c);
+		dev_printk(KERN_DEBUG, &pdev->dev, "%s: HC regs (HC %i):\n",
+			   __func__, hc);
+		mv_dump_mem(&pdev->dev, hc_base, 0x1c);
 	}
 	for (p = start_port; p < start_port + num_ports; p++) {
 		port_base = mv_port_base(mmio_base, p);
-		DPRINTK("EDMA regs (port %i):\n", p);
-		mv_dump_mem(port_base, 0x54);
-		DPRINTK("SATA regs (port %i):\n", p);
-		mv_dump_mem(port_base+0x300, 0x60);
+		dev_printk(KERN_DEBUG, &pdev->dev, "%s: EDMA regs (port %i):\n",
+			   __func__, p);
+		mv_dump_mem(&pdev->dev, port_base, 0x54);
+		dev_printk(KERN_DEBUG, &pdev->dev, "%s: SATA regs (port %i):\n",
+			   __func__, p);
+		mv_dump_mem(&pdev->dev, port_base+0x300, 0x60);
 	}
-#endif
 }
 
 static unsigned int mv_scr_offset(unsigned int sc_reg_in)
@@ -2962,9 +2970,11 @@ static int mv_pci_error(struct ata_host *host, void __iomem *mmio)
 
 	dev_err(host->dev, "PCI ERROR; PCI IRQ cause=0x%08x\n", err_cause);
 
-	DPRINTK("All regs @ PCI error\n");
-	mv_dump_all_regs(mmio, -1, to_pci_dev(host->dev));
-
+	if (pci_dump) {
+		dev_printk(KERN_DEBUG, host->dev, "%s: All regs @ PCI error\n",
+			   __func__);
+		mv_dump_all_regs(mmio, -1, to_pci_dev(host->dev));
+	}
 	writelfl(0, mmio + hpriv->irq_cause_offset);
 
 	for (i = 0; i < host->n_ports; i++) {
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 06/73] sata_mv: kill 'port' argument in mv_dump_all_regs()
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (4 preceding siblings ...)
  2021-12-08 16:31 ` [PATCH 05/73] sata_mv: replace DPRINTK with 'pci_dump' module parameter Hannes Reinecke
@ 2021-12-08 16:31 ` Hannes Reinecke
  2021-12-09  0:40   ` Damien Le Moal
  2021-12-08 16:31 ` [PATCH 07/73] libata: add reset tracepoints Hannes Reinecke
                   ` (67 subsequent siblings)
  73 siblings, 1 reply; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:31 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke, Bartlomiej Zolnierkiewicz

Always '-1', so drop it and simplify the function.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 drivers/ata/sata_mv.c | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index f0257685495f..e86eddf83704 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -1286,23 +1286,13 @@ static void mv_dump_pci_cfg(struct pci_dev *pdev, unsigned bytes)
 	}
 }
 
-static void mv_dump_all_regs(void __iomem *mmio_base, int port,
-			     struct pci_dev *pdev)
+static void mv_dump_all_regs(void __iomem *mmio_base, struct pci_dev *pdev)
 {
-	void __iomem *hc_base = mv_hc_base(mmio_base,
-					   port >> MV_PORT_HC_SHIFT);
-	void __iomem *port_base;
 	int start_port, num_ports, p, start_hc, num_hcs, hc;
 
-	if (0 > port) {
-		start_hc = start_port = 0;
-		num_ports = 8;		/* shld be benign for 4 port devs */
-		num_hcs = 2;
-	} else {
-		start_hc = port >> MV_PORT_HC_SHIFT;
-		start_port = port;
-		num_ports = num_hcs = 1;
-	}
+	start_hc = start_port = 0;
+	num_ports = 8;		/* shld be benign for 4 port devs */
+	num_hcs = 2;
 	dev_printk(KERN_DEBUG, &pdev->dev,
 		   "%s: All registers for port(s) %u-%u:\n", __func__,
 		   start_port, num_ports > 1 ? num_ports - 1 : start_port);
@@ -1317,13 +1307,13 @@ static void mv_dump_all_regs(void __iomem *mmio_base, int port,
 	mv_dump_mem(&pdev->dev, mmio_base+0xf00, 0x4);
 	mv_dump_mem(&pdev->dev, mmio_base+0x1d00, 0x6c);
 	for (hc = start_hc; hc < start_hc + num_hcs; hc++) {
-		hc_base = mv_hc_base(mmio_base, hc);
+		void __iomem *hc_base = mv_hc_base(mmio_base, hc);
 		dev_printk(KERN_DEBUG, &pdev->dev, "%s: HC regs (HC %i):\n",
 			   __func__, hc);
 		mv_dump_mem(&pdev->dev, hc_base, 0x1c);
 	}
 	for (p = start_port; p < start_port + num_ports; p++) {
-		port_base = mv_port_base(mmio_base, p);
+		void __iomem *port_base = mv_port_base(mmio_base, p);
 		dev_printk(KERN_DEBUG, &pdev->dev, "%s: EDMA regs (port %i):\n",
 			   __func__, p);
 		mv_dump_mem(&pdev->dev, port_base, 0x54);
@@ -2973,7 +2963,7 @@ static int mv_pci_error(struct ata_host *host, void __iomem *mmio)
 	if (pci_dump) {
 		dev_printk(KERN_DEBUG, host->dev, "%s: All regs @ PCI error\n",
 			   __func__);
-		mv_dump_all_regs(mmio, -1, to_pci_dev(host->dev));
+		mv_dump_all_regs(mmio, to_pci_dev(host->dev));
 	}
 	writelfl(0, mmio + hpriv->irq_cause_offset);
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 07/73] libata: add reset tracepoints
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (5 preceding siblings ...)
  2021-12-08 16:31 ` [PATCH 06/73] sata_mv: kill 'port' argument in mv_dump_all_regs() Hannes Reinecke
@ 2021-12-08 16:31 ` Hannes Reinecke
  2021-12-08 16:31 ` [PATCH 08/73] libata: drop DPRINTK() calls in reset Hannes Reinecke
                   ` (66 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:31 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke, Bartlomiej Zolnierkiewicz

To follow the flow of control we should be using tracepoints, as
they will tie in with the actual I/O flow and deliver a better
overview about what it happening.
This patch adds tracepoints for hard reset, soft reset, and postreset
and adds them in the libata-eh control flow.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 drivers/ata/libata-eh.c       | 21 ++++++--
 include/trace/events/libata.h | 96 +++++++++++++++++++++++++++++++++++
 2 files changed, 114 insertions(+), 3 deletions(-)

diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 1d4a6f1e88cd..043a1c846f2c 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -2596,12 +2596,19 @@ int ata_eh_reset(struct ata_link *link, int classify,
 
 		/* mark that this EH session started with reset */
 		ehc->last_reset = jiffies;
-		if (reset == hardreset)
+		if (reset == hardreset) {
 			ehc->i.flags |= ATA_EHI_DID_HARDRESET;
-		else
+			trace_ata_link_hardreset_begin(link, classes, deadline);
+		} else {
 			ehc->i.flags |= ATA_EHI_DID_SOFTRESET;
+			trace_ata_link_softreset_begin(link, classes, deadline);
+		}
 
 		rc = ata_do_reset(link, reset, classes, deadline, true);
+		if (reset == hardreset)
+			trace_ata_link_hardreset_end(link, classes, rc);
+		else
+			trace_ata_link_softreset_end(link, classes, rc);
 		if (rc && rc != -EAGAIN) {
 			failed_link = link;
 			goto fail;
@@ -2615,8 +2622,11 @@ int ata_eh_reset(struct ata_link *link, int classify,
 				ata_link_info(slave, "hard resetting link\n");
 
 			ata_eh_about_to_do(slave, NULL, ATA_EH_RESET);
+			trace_ata_slave_hardreset_begin(slave, classes,
+							deadline);
 			tmp = ata_do_reset(slave, reset, classes, deadline,
 					   false);
+			trace_ata_slave_hardreset_end(slave, classes, tmp);
 			switch (tmp) {
 			case -EAGAIN:
 				rc = -EAGAIN;
@@ -2644,7 +2654,9 @@ int ata_eh_reset(struct ata_link *link, int classify,
 			}
 
 			ata_eh_about_to_do(link, NULL, ATA_EH_RESET);
+			trace_ata_link_softreset_begin(link, classes, deadline);
 			rc = ata_do_reset(link, reset, classes, deadline, true);
+			trace_ata_link_softreset_end(link, classes, rc);
 			if (rc) {
 				failed_link = link;
 				goto fail;
@@ -2698,8 +2710,11 @@ int ata_eh_reset(struct ata_link *link, int classify,
 	 */
 	if (postreset) {
 		postreset(link, classes);
-		if (slave)
+		trace_ata_link_postreset(link, classes, rc);
+		if (slave) {
 			postreset(slave, classes);
+			trace_ata_slave_postreset(slave, classes, rc);
+		}
 	}
 
 	/*
diff --git a/include/trace/events/libata.h b/include/trace/events/libata.h
index ab69434e2329..ec2a350d1aca 100644
--- a/include/trace/events/libata.h
+++ b/include/trace/events/libata.h
@@ -132,6 +132,22 @@
 		ata_protocol_name(ATAPI_PROT_PIO),	\
 		ata_protocol_name(ATAPI_PROT_DMA))
 
+#define ata_class_name(class)	{ class, #class }
+#define show_class_name(val)				\
+	__print_symbolic(val,				\
+		ata_class_name(ATA_DEV_UNKNOWN),	\
+		ata_class_name(ATA_DEV_ATA),		\
+		ata_class_name(ATA_DEV_ATA_UNSUP),	\
+		ata_class_name(ATA_DEV_ATAPI),		\
+		ata_class_name(ATA_DEV_ATAPI_UNSUP),	\
+		ata_class_name(ATA_DEV_PMP),		\
+		ata_class_name(ATA_DEV_PMP_UNSUP),	\
+		ata_class_name(ATA_DEV_SEMB),		\
+		ata_class_name(ATA_DEV_SEMB_UNSUP),	\
+		ata_class_name(ATA_DEV_ZAC),		\
+		ata_class_name(ATA_DEV_ZAC_UNSUP),	\
+		ata_class_name(ATA_DEV_NONE))
+
 const char *libata_trace_parse_status(struct trace_seq*, unsigned char);
 #define __parse_status(s) libata_trace_parse_status(p, s)
 
@@ -329,6 +345,86 @@ TRACE_EVENT(ata_eh_link_autopsy_qc,
 		  __parse_eh_err_mask(__entry->eh_err_mask))
 );
 
+DECLARE_EVENT_CLASS(ata_link_reset_begin_template,
+
+	TP_PROTO(struct ata_link *link, unsigned int *class, unsigned long deadline),
+
+	TP_ARGS(link, class, deadline),
+
+	TP_STRUCT__entry(
+		__field( unsigned int,	ata_port )
+		__array( unsigned int,	class, 2 )
+		__field( unsigned long,	deadline )
+	),
+
+	TP_fast_assign(
+		__entry->ata_port	= link->ap->print_id;
+		memcpy(__entry->class, class, 2);
+		__entry->deadline	= deadline;
+	),
+
+	TP_printk("ata_port=%u deadline=%lu classes=[%s,%s]",
+		  __entry->ata_port, __entry->deadline,
+		  show_class_name(__entry->class[0]),
+		  show_class_name(__entry->class[1]))
+);
+
+DEFINE_EVENT(ata_link_reset_begin_template, ata_link_hardreset_begin,
+	     TP_PROTO(struct ata_link *link, unsigned int *class, unsigned long deadline),
+	     TP_ARGS(link, class, deadline));
+
+DEFINE_EVENT(ata_link_reset_begin_template, ata_slave_hardreset_begin,
+	     TP_PROTO(struct ata_link *link, unsigned int *class, unsigned long deadline),
+	     TP_ARGS(link, class, deadline));
+
+DEFINE_EVENT(ata_link_reset_begin_template, ata_link_softreset_begin,
+	     TP_PROTO(struct ata_link *link, unsigned int *class, unsigned long deadline),
+	     TP_ARGS(link, class, deadline));
+
+DECLARE_EVENT_CLASS(ata_link_reset_end_template,
+
+	TP_PROTO(struct ata_link *link, unsigned int *class, int rc),
+
+	TP_ARGS(link, class, rc),
+
+	TP_STRUCT__entry(
+		__field( unsigned int,	ata_port )
+		__array( unsigned int,	class, 2 )
+		__field( int,		rc	)
+	),
+
+	TP_fast_assign(
+		__entry->ata_port	= link->ap->print_id;
+		memcpy(__entry->class, class, 2);
+		__entry->rc		= rc;
+	),
+
+	TP_printk("ata_port=%u rc=%d class=[%s,%s]",
+		  __entry->ata_port, __entry->rc,
+		  show_class_name(__entry->class[0]),
+		  show_class_name(__entry->class[1]))
+);
+
+DEFINE_EVENT(ata_link_reset_end_template, ata_link_hardreset_end,
+	     TP_PROTO(struct ata_link *link, unsigned int *class, int rc),
+	     TP_ARGS(link, class, rc));
+
+DEFINE_EVENT(ata_link_reset_end_template, ata_slave_hardreset_end,
+	     TP_PROTO(struct ata_link *link, unsigned int *class, int rc),
+	     TP_ARGS(link, class, rc));
+
+DEFINE_EVENT(ata_link_reset_end_template, ata_link_softreset_end,
+	     TP_PROTO(struct ata_link *link, unsigned int *class, int rc),
+	     TP_ARGS(link, class, rc));
+
+DEFINE_EVENT(ata_link_reset_end_template, ata_link_postreset,
+	     TP_PROTO(struct ata_link *link, unsigned int *class, int rc),
+	     TP_ARGS(link, class, rc));
+
+DEFINE_EVENT(ata_link_reset_end_template, ata_slave_postreset,
+	     TP_PROTO(struct ata_link *link, unsigned int *class, int rc),
+	     TP_ARGS(link, class, rc));
+
 #endif /*  _TRACE_LIBATA_H */
 
 /* This part must be outside protection */
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 08/73] libata: drop DPRINTK() calls in reset
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (6 preceding siblings ...)
  2021-12-08 16:31 ` [PATCH 07/73] libata: add reset tracepoints Hannes Reinecke
@ 2021-12-08 16:31 ` Hannes Reinecke
  2021-12-09  0:47   ` Damien Le Moal
  2021-12-08 16:31 ` [PATCH 09/73] libata: tracepoints for bus-master DMA Hannes Reinecke
                   ` (65 subsequent siblings)
  73 siblings, 1 reply; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:31 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke, Bartlomiej Zolnierkiewicz

Reset is now logged with tracepoints, so the DPRINTK() calls can
be dropped.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 drivers/ata/ahci.c           |  7 -------
 drivers/ata/ahci_qoriq.c     |  4 ----
 drivers/ata/libahci.c        | 10 ----------
 drivers/ata/libata-core.c    |  4 ----
 drivers/ata/libata-sff.c     | 11 +----------
 drivers/ata/pata_octeon_cf.c |  2 --
 drivers/ata/sata_fsl.c       | 10 ----------
 drivers/ata/sata_rcar.c      |  4 ----
 drivers/ata/sata_sil24.c     |  3 ---
 9 files changed, 1 insertion(+), 54 deletions(-)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 5fa8a12c6b3b..6a867ef64c9c 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -699,8 +699,6 @@ static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class,
 	bool online;
 	int rc;
 
-	DPRINTK("ENTER\n");
-
 	hpriv->stop_engine(ap);
 
 	rc = sata_link_hardreset(link, sata_ehc_deb_timing(&link->eh_context),
@@ -708,8 +706,6 @@ static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class,
 
 	hpriv->start_engine(ap);
 
-	DPRINTK("EXIT, rc=%d, class=%u\n", rc, *class);
-
 	/* vt8251 doesn't clear BSY on signature FIS reception,
 	 * request follow-up softreset.
 	 */
@@ -789,8 +785,6 @@ static int ahci_avn_hardreset(struct ata_link *link, unsigned int *class,
 	bool online;
 	int rc, i;
 
-	DPRINTK("ENTER\n");
-
 	hpriv->stop_engine(ap);
 
 	for (i = 0; i < 2; i++) {
@@ -828,7 +822,6 @@ static int ahci_avn_hardreset(struct ata_link *link, unsigned int *class,
 	if (online)
 		*class = ahci_dev_classify(ap);
 
-	DPRINTK("EXIT, rc=%d, class=%u\n", rc, *class);
 	return rc;
 }
 
diff --git a/drivers/ata/ahci_qoriq.c b/drivers/ata/ahci_qoriq.c
index 5b46fc9aeb4a..bf5b388bd4e0 100644
--- a/drivers/ata/ahci_qoriq.c
+++ b/drivers/ata/ahci_qoriq.c
@@ -103,8 +103,6 @@ static int ahci_qoriq_hardreset(struct ata_link *link, unsigned int *class,
 	int rc;
 	bool ls1021a_workaround = (qoriq_priv->type == AHCI_LS1021A);
 
-	DPRINTK("ENTER\n");
-
 	hpriv->stop_engine(ap);
 
 	/*
@@ -146,8 +144,6 @@ static int ahci_qoriq_hardreset(struct ata_link *link, unsigned int *class,
 
 	if (online)
 		*class = ahci_dev_classify(ap);
-
-	DPRINTK("EXIT, rc=%d, class=%u\n", rc, *class);
 	return rc;
 }
 
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 21dbcd551443..ee7e63da0437 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -1415,8 +1415,6 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class,
 	bool fbs_disabled = false;
 	int rc;
 
-	DPRINTK("ENTER\n");
-
 	/* prepare for SRST (AHCI-1.1 10.4.1) */
 	rc = ahci_kick_engine(ap);
 	if (rc && rc != -EOPNOTSUPP)
@@ -1476,7 +1474,6 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class,
 	if (fbs_disabled)
 		ahci_enable_fbs(ap);
 
-	DPRINTK("EXIT, class=%u\n", *class);
 	return 0;
 
  fail:
@@ -1498,8 +1495,6 @@ static int ahci_softreset(struct ata_link *link, unsigned int *class,
 {
 	int pmp = sata_srst_pmp(link);
 
-	DPRINTK("ENTER\n");
-
 	return ahci_do_softreset(link, class, pmp, deadline, ahci_check_ready);
 }
 EXPORT_SYMBOL_GPL(ahci_do_softreset);
@@ -1529,8 +1524,6 @@ static int ahci_pmp_retry_softreset(struct ata_link *link, unsigned int *class,
 	int rc;
 	u32 irq_sts;
 
-	DPRINTK("ENTER\n");
-
 	rc = ahci_do_softreset(link, class, pmp, deadline,
 			       ahci_bad_pmp_check_ready);
 
@@ -1564,8 +1557,6 @@ int ahci_do_hardreset(struct ata_link *link, unsigned int *class,
 	struct ata_taskfile tf;
 	int rc;
 
-	DPRINTK("ENTER\n");
-
 	hpriv->stop_engine(ap);
 
 	/* clear D2H reception area to properly wait for D2H FIS */
@@ -1581,7 +1572,6 @@ int ahci_do_hardreset(struct ata_link *link, unsigned int *class,
 	if (*online)
 		*class = ahci_dev_classify(ap);
 
-	DPRINTK("EXIT, rc=%d, class=%u\n", rc, *class);
 	return rc;
 }
 EXPORT_SYMBOL_GPL(ahci_do_hardreset);
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 3977da2d098e..02cd8fe1acab 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3697,16 +3697,12 @@ void ata_std_postreset(struct ata_link *link, unsigned int *classes)
 {
 	u32 serror;
 
-	DPRINTK("ENTER\n");
-
 	/* reset complete, clear SError */
 	if (!sata_scr_read(link, SCR_ERROR, &serror))
 		sata_scr_write(link, SCR_ERROR, serror);
 
 	/* print link status */
 	sata_print_link_status(link);
-
-	DPRINTK("EXIT\n");
 }
 EXPORT_SYMBOL_GPL(ata_std_postreset);
 
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index a119fabe0919..4cc7c0606e06 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -1956,8 +1956,6 @@ static int ata_bus_softreset(struct ata_port *ap, unsigned int devmask,
 {
 	struct ata_ioports *ioaddr = &ap->ioaddr;
 
-	DPRINTK("ata%u: bus reset via SRST\n", ap->print_id);
-
 	if (ap->ioaddr.ctl_addr) {
 		/* software reset.  causes dev0 to be selected */
 		iowrite8(ap->ctl, ioaddr->ctl_addr);
@@ -1995,8 +1993,6 @@ int ata_sff_softreset(struct ata_link *link, unsigned int *classes,
 	int rc;
 	u8 err;
 
-	DPRINTK("ENTER\n");
-
 	/* determine if device 0/1 are present */
 	if (ata_devchk(ap, 0))
 		devmask |= (1 << 0);
@@ -2007,7 +2003,6 @@ int ata_sff_softreset(struct ata_link *link, unsigned int *classes,
 	ap->ops->sff_dev_select(ap, 0);
 
 	/* issue bus reset */
-	DPRINTK("about to softreset, devmask=%x\n", devmask);
 	rc = ata_bus_softreset(ap, devmask, deadline);
 	/* if link is occupied, -ENODEV too is an error */
 	if (rc && (rc != -ENODEV || sata_scr_valid(link))) {
@@ -2022,7 +2017,6 @@ int ata_sff_softreset(struct ata_link *link, unsigned int *classes,
 		classes[1] = ata_sff_dev_classify(&link->device[1],
 						  devmask & (1 << 1), &err);
 
-	DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]);
 	return 0;
 }
 EXPORT_SYMBOL_GPL(ata_sff_softreset);
@@ -2055,7 +2049,6 @@ int sata_sff_hardreset(struct ata_link *link, unsigned int *class,
 	if (online)
 		*class = ata_sff_dev_classify(link->device, 1, NULL);
 
-	DPRINTK("EXIT, class=%u\n", *class);
 	return rc;
 }
 EXPORT_SYMBOL_GPL(sata_sff_hardreset);
@@ -2085,10 +2078,8 @@ void ata_sff_postreset(struct ata_link *link, unsigned int *classes)
 		ap->ops->sff_dev_select(ap, 0);
 
 	/* bail out if no device is present */
-	if (classes[0] == ATA_DEV_NONE && classes[1] == ATA_DEV_NONE) {
-		DPRINTK("EXIT, no device\n");
+	if (classes[0] == ATA_DEV_NONE && classes[1] == ATA_DEV_NONE)
 		return;
-	}
 
 	/* set up device control */
 	if (ap->ops->sff_set_devctl || ap->ioaddr.ctl_addr) {
diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
index b5a3f710d76d..cdc95eb2b2cb 100644
--- a/drivers/ata/pata_octeon_cf.c
+++ b/drivers/ata/pata_octeon_cf.c
@@ -440,7 +440,6 @@ static int octeon_cf_softreset16(struct ata_link *link, unsigned int *classes,
 	int rc;
 	u8 err;
 
-	DPRINTK("about to softreset\n");
 	__raw_writew(ap->ctl, base + 0xe);
 	udelay(20);
 	__raw_writew(ap->ctl | ATA_SRST, base + 0xe);
@@ -455,7 +454,6 @@ static int octeon_cf_softreset16(struct ata_link *link, unsigned int *classes,
 
 	/* determine by signature whether we have ATA or ATAPI devices */
 	classes[0] = ata_sff_dev_classify(&link->device[0], 1, &err);
-	DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]);
 	return 0;
 }
 
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index dbc57b7a58b8..5421625dcf6e 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -825,8 +825,6 @@ static int sata_fsl_hardreset(struct ata_link *link, unsigned int *class,
 	int i = 0;
 	unsigned long start_jiffies;
 
-	DPRINTK("in xx_hardreset\n");
-
 try_offline_again:
 	/*
 	 * Force host controller to go off-line, aborting current operations
@@ -941,10 +939,7 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
 	u8 *cfis;
 	u32 Serror;
 
-	DPRINTK("in xx_softreset\n");
-
 	if (ata_link_offline(link)) {
-		DPRINTK("PHY reports no device\n");
 		*class = ATA_DEV_NONE;
 		return 0;
 	}
@@ -957,8 +952,6 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
 	 * reached here, we can send a command to the target device
 	 */
 
-	DPRINTK("Sending SRST/device reset\n");
-
 	ata_tf_init(link->device, &tf);
 	cfis = (u8 *) &pp->cmdentry->cfis;
 
@@ -1030,8 +1023,6 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
 	 */
 	iowrite32(0x01, CC + hcr_base);	/* We know it will be cmd#0 always */
 
-	DPRINTK("SATA FSL : Now checking device signature\n");
-
 	*class = ATA_DEV_NONE;
 
 	/* Verify if SStatus indicates device presence */
@@ -1045,7 +1036,6 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
 
 		*class = sata_fsl_dev_classify(ap);
 
-		DPRINTK("class = %d\n", *class);
 		VPRINTK("ccreg = 0x%x\n", ioread32(hcr_base + CC));
 		VPRINTK("cereg = 0x%x\n", ioread32(hcr_base + CE));
 	}
diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
index 44b0ed8f6bb8..9005833ab02f 100644
--- a/drivers/ata/sata_rcar.c
+++ b/drivers/ata/sata_rcar.c
@@ -323,8 +323,6 @@ static int sata_rcar_bus_softreset(struct ata_port *ap, unsigned long deadline)
 {
 	struct ata_ioports *ioaddr = &ap->ioaddr;
 
-	DPRINTK("ata%u: bus reset via SRST\n", ap->print_id);
-
 	/* software reset.  causes dev0 to be selected */
 	iowrite32(ap->ctl, ioaddr->ctl_addr);
 	udelay(20);
@@ -350,7 +348,6 @@ static int sata_rcar_softreset(struct ata_link *link, unsigned int *classes,
 		devmask |= 1 << 0;
 
 	/* issue bus reset */
-	DPRINTK("about to softreset, devmask=%x\n", devmask);
 	rc = sata_rcar_bus_softreset(ap, deadline);
 	/* if link is occupied, -ENODEV too is an error */
 	if (rc && (rc != -ENODEV || sata_scr_valid(link))) {
@@ -361,7 +358,6 @@ static int sata_rcar_softreset(struct ata_link *link, unsigned int *classes,
 	/* determine by signature whether we have ATA or ATAPI devices */
 	classes[0] = ata_sff_dev_classify(&link->device[0], devmask, &err);
 
-	DPRINTK("classes[0]=%u\n", classes[0]);
 	return 0;
 }
 
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index 7e9c1945dc81..2fef6ce93f07 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -656,8 +656,6 @@ static int sil24_softreset(struct ata_link *link, unsigned int *class,
 	const char *reason;
 	int rc;
 
-	DPRINTK("ENTER\n");
-
 	/* put the port into known state */
 	if (sil24_init_port(ap)) {
 		reason = "port not ready";
@@ -682,7 +680,6 @@ static int sil24_softreset(struct ata_link *link, unsigned int *class,
 	sil24_read_tf(ap, 0, &tf);
 	*class = ata_port_classify(ap, &tf);
 
-	DPRINTK("EXIT, class=%u\n", *class);
 	return 0;
 
  err:
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 09/73] libata: tracepoints for bus-master DMA
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (7 preceding siblings ...)
  2021-12-08 16:31 ` [PATCH 08/73] libata: drop DPRINTK() calls in reset Hannes Reinecke
@ 2021-12-08 16:31 ` Hannes Reinecke
  2021-12-08 16:31 ` [PATCH 10/73] libata: drop debugging statements " Hannes Reinecke
                   ` (64 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:31 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Add tracepoints for bus-master DMA and taskfile related functions.
That allows us to drop the relevant DPRINTK() calls.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/libata-core.c     |   5 ++
 drivers/ata/libata-sff.c      |  23 ++++++--
 include/trace/events/libata.h | 100 ++++++++++++++++++++++++++++++++++
 3 files changed, 123 insertions(+), 5 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 02cd8fe1acab..ef5ae37bfac0 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -6614,3 +6614,8 @@ void ata_print_version(const struct device *dev, const char *version)
 	dev_printk(KERN_DEBUG, dev, "version %s\n", version);
 }
 EXPORT_SYMBOL(ata_print_version);
+
+EXPORT_TRACEPOINT_SYMBOL_GPL(ata_tf_load);
+EXPORT_TRACEPOINT_SYMBOL_GPL(ata_exec_command);
+EXPORT_TRACEPOINT_SYMBOL_GPL(ata_bmdma_setup);
+EXPORT_TRACEPOINT_SYMBOL_GPL(ata_bmdma_start);
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 4cc7c0606e06..60ac93a0bafb 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -18,7 +18,7 @@
 #include <linux/module.h>
 #include <linux/libata.h>
 #include <linux/highmem.h>
-
+#include <trace/events/libata.h>
 #include "libata.h"
 
 static struct workqueue_struct *ata_sff_wq;
@@ -505,6 +505,7 @@ EXPORT_SYMBOL_GPL(ata_sff_exec_command);
  *	ata_tf_to_host - issue ATA taskfile to host controller
  *	@ap: port to which command is being issued
  *	@tf: ATA taskfile register set
+ *	@tag: tag of the associated command
  *
  *	Issues ATA taskfile register set to ATA host controller,
  *	with proper synchronization with interrupt handler and
@@ -514,9 +515,12 @@ EXPORT_SYMBOL_GPL(ata_sff_exec_command);
  *	spin_lock_irqsave(host lock)
  */
 static inline void ata_tf_to_host(struct ata_port *ap,
-				  const struct ata_taskfile *tf)
+				  const struct ata_taskfile *tf,
+				  unsigned int tag)
 {
+	trace_ata_tf_load(ap, tf);
 	ap->ops->sff_tf_load(ap, tf);
+	trace_ata_exec_command(ap, tf, tag);
 	ap->ops->sff_exec_command(ap, tf);
 }
 
@@ -768,6 +772,7 @@ static void atapi_send_cdb(struct ata_port *ap, struct ata_queued_cmd *qc)
 	case ATAPI_PROT_DMA:
 		ap->hsm_task_state = HSM_ST_LAST;
 		/* initiate bmdma */
+		trace_ata_bmdma_start(ap, &qc->tf, qc->tag);
 		ap->ops->bmdma_start(qc);
 		break;
 #endif /* CONFIG_ATA_BMDMA */
@@ -1376,7 +1381,7 @@ unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc)
 		if (qc->tf.flags & ATA_TFLAG_POLLING)
 			ata_qc_set_polling(qc);
 
-		ata_tf_to_host(ap, &qc->tf);
+		ata_tf_to_host(ap, &qc->tf, qc->tag);
 		ap->hsm_task_state = HSM_ST_LAST;
 
 		if (qc->tf.flags & ATA_TFLAG_POLLING)
@@ -1388,7 +1393,7 @@ unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc)
 		if (qc->tf.flags & ATA_TFLAG_POLLING)
 			ata_qc_set_polling(qc);
 
-		ata_tf_to_host(ap, &qc->tf);
+		ata_tf_to_host(ap, &qc->tf, qc->tag);
 
 		if (qc->tf.flags & ATA_TFLAG_WRITE) {
 			/* PIO data out protocol */
@@ -1418,7 +1423,7 @@ unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc)
 		if (qc->tf.flags & ATA_TFLAG_POLLING)
 			ata_qc_set_polling(qc);
 
-		ata_tf_to_host(ap, &qc->tf);
+		ata_tf_to_host(ap, &qc->tf, qc->tag);
 
 		ap->hsm_task_state = HSM_ST_FIRST;
 
@@ -2745,8 +2750,11 @@ unsigned int ata_bmdma_qc_issue(struct ata_queued_cmd *qc)
 	case ATA_PROT_DMA:
 		WARN_ON_ONCE(qc->tf.flags & ATA_TFLAG_POLLING);
 
+		trace_ata_tf_load(ap, &qc->tf);
 		ap->ops->sff_tf_load(ap, &qc->tf);  /* load tf registers */
+		trace_ata_bmdma_setup(ap, &qc->tf, qc->tag);
 		ap->ops->bmdma_setup(qc);	    /* set up bmdma */
+		trace_ata_bmdma_start(ap, &qc->tf, qc->tag);
 		ap->ops->bmdma_start(qc);	    /* initiate bmdma */
 		ap->hsm_task_state = HSM_ST_LAST;
 		break;
@@ -2754,7 +2762,9 @@ unsigned int ata_bmdma_qc_issue(struct ata_queued_cmd *qc)
 	case ATAPI_PROT_DMA:
 		WARN_ON_ONCE(qc->tf.flags & ATA_TFLAG_POLLING);
 
+		trace_ata_tf_load(ap, &qc->tf);
 		ap->ops->sff_tf_load(ap, &qc->tf);  /* load tf registers */
+		trace_ata_bmdma_setup(ap, &qc->tf, qc->tag);
 		ap->ops->bmdma_setup(qc);	    /* set up bmdma */
 		ap->hsm_task_state = HSM_ST_FIRST;
 
@@ -2802,6 +2812,7 @@ unsigned int ata_bmdma_port_intr(struct ata_port *ap, struct ata_queued_cmd *qc)
 			return ata_sff_idle_irq(ap);
 
 		/* before we do anything else, clear DMA-Start bit */
+		trace_ata_bmdma_stop(ap, &qc->tf, qc->tag);
 		ap->ops->bmdma_stop(qc);
 		bmdma_stopped = true;
 
@@ -2881,6 +2892,7 @@ void ata_bmdma_error_handler(struct ata_port *ap)
 			thaw = true;
 		}
 
+		trace_ata_bmdma_stop(ap, &qc->tf, qc->tag);
 		ap->ops->bmdma_stop(qc);
 
 		/* if we're gonna thaw, make sure IRQ is clear */
@@ -2914,6 +2926,7 @@ void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc)
 
 	if (ata_is_dma(qc->tf.protocol)) {
 		spin_lock_irqsave(ap->lock, flags);
+		trace_ata_bmdma_stop(ap, &qc->tf, qc->tag);
 		ap->ops->bmdma_stop(qc);
 		spin_unlock_irqrestore(ap->lock, flags);
 	}
diff --git a/include/trace/events/libata.h b/include/trace/events/libata.h
index ec2a350d1aca..6a0a9b7a42ec 100644
--- a/include/trace/events/libata.h
+++ b/include/trace/events/libata.h
@@ -291,6 +291,106 @@ DEFINE_EVENT(ata_qc_complete_template, ata_qc_complete_done,
 	     TP_PROTO(struct ata_queued_cmd *qc),
 	     TP_ARGS(qc));
 
+TRACE_EVENT(ata_tf_load,
+
+	TP_PROTO(struct ata_port *ap, const struct ata_taskfile *tf),
+
+	TP_ARGS(ap, tf),
+
+	TP_STRUCT__entry(
+		__field( unsigned int,	ata_port )
+		__field( unsigned char,	cmd	)
+		__field( unsigned char,	dev	)
+		__field( unsigned char,	lbal	)
+		__field( unsigned char,	lbam	)
+		__field( unsigned char,	lbah	)
+		__field( unsigned char,	nsect	)
+		__field( unsigned char,	feature	)
+		__field( unsigned char,	hob_lbal )
+		__field( unsigned char,	hob_lbam )
+		__field( unsigned char,	hob_lbah )
+		__field( unsigned char,	hob_nsect )
+		__field( unsigned char,	hob_feature )
+		__field( unsigned char,	proto	)
+	),
+
+	TP_fast_assign(
+		__entry->ata_port	= ap->print_id;
+		__entry->proto		= tf->protocol;
+		__entry->cmd		= tf->command;
+		__entry->dev		= tf->device;
+		__entry->lbal		= tf->lbal;
+		__entry->lbam		= tf->lbam;
+		__entry->lbah		= tf->lbah;
+		__entry->hob_lbal	= tf->hob_lbal;
+		__entry->hob_lbam	= tf->hob_lbam;
+		__entry->hob_lbah	= tf->hob_lbah;
+		__entry->feature	= tf->feature;
+		__entry->hob_feature	= tf->hob_feature;
+		__entry->nsect		= tf->nsect;
+		__entry->hob_nsect	= tf->hob_nsect;
+	),
+
+	TP_printk("ata_port=%u proto=%s cmd=%s%s " \
+		  " tf=(%02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x)",
+		  __entry->ata_port,
+		  show_protocol_name(__entry->proto),
+		  show_opcode_name(__entry->cmd),
+		  __parse_subcmd(__entry->cmd, __entry->feature, __entry->hob_nsect),
+		  __entry->cmd, __entry->feature, __entry->nsect,
+		  __entry->lbal, __entry->lbam, __entry->lbah,
+		  __entry->hob_feature, __entry->hob_nsect,
+		  __entry->hob_lbal, __entry->hob_lbam, __entry->hob_lbah,
+		  __entry->dev)
+);
+
+DECLARE_EVENT_CLASS(ata_exec_command_template,
+
+	TP_PROTO(struct ata_port *ap, const struct ata_taskfile *tf, unsigned int tag),
+
+	TP_ARGS(ap, tf, tag),
+
+	TP_STRUCT__entry(
+		__field( unsigned int,	ata_port )
+		__field( unsigned int,	tag	)
+		__field( unsigned char,	cmd	)
+		__field( unsigned char,	feature	)
+		__field( unsigned char,	hob_nsect )
+		__field( unsigned char,	proto	)
+	),
+
+	TP_fast_assign(
+		__entry->ata_port	= ap->print_id;
+		__entry->tag		= tag;
+		__entry->proto		= tf->protocol;
+		__entry->cmd		= tf->command;
+		__entry->feature	= tf->feature;
+		__entry->hob_nsect	= tf->hob_nsect;
+	),
+
+	TP_printk("ata_port=%u tag=%d proto=%s cmd=%s%s",
+		  __entry->ata_port, __entry->tag,
+		  show_protocol_name(__entry->proto),
+		  show_opcode_name(__entry->cmd),
+		  __parse_subcmd(__entry->cmd, __entry->feature, __entry->hob_nsect))
+);
+
+DEFINE_EVENT(ata_exec_command_template, ata_exec_command,
+	     TP_PROTO(struct ata_port *ap, const struct ata_taskfile *tf, unsigned int tag),
+	     TP_ARGS(ap, tf, tag));
+
+DEFINE_EVENT(ata_exec_command_template, ata_bmdma_setup,
+	     TP_PROTO(struct ata_port *ap, const struct ata_taskfile *tf, unsigned int tag),
+	     TP_ARGS(ap, tf, tag));
+
+DEFINE_EVENT(ata_exec_command_template, ata_bmdma_start,
+	     TP_PROTO(struct ata_port *ap, const struct ata_taskfile *tf, unsigned int tag),
+	     TP_ARGS(ap, tf, tag));
+
+DEFINE_EVENT(ata_exec_command_template, ata_bmdma_stop,
+	     TP_PROTO(struct ata_port *ap, const struct ata_taskfile *tf, unsigned int tag),
+	     TP_ARGS(ap, tf, tag));
+
 TRACE_EVENT(ata_eh_link_autopsy,
 
 	TP_PROTO(struct ata_device *dev, unsigned int eh_action, unsigned int eh_err_mask),
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 10/73] libata: drop debugging statements for bus-master DMA
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (8 preceding siblings ...)
  2021-12-08 16:31 ` [PATCH 09/73] libata: tracepoints for bus-master DMA Hannes Reinecke
@ 2021-12-08 16:31 ` Hannes Reinecke
  2021-12-09  0:46   ` Damien Le Moal
  2021-12-08 16:31 ` [PATCH 11/73] pata_octeon_cf: add bmdma tracepoints and drop DPRINTK() calls Hannes Reinecke
                   ` (63 subsequent siblings)
  73 siblings, 1 reply; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:31 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke, Bartlomiej Zolnierkiewicz

Bus-master DMA is now logged with generic tracepoints, so we can
drop the DPRINTK()/VPRINTK and dev_dbg() calls here.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 drivers/ata/libata-sff.c        | 18 +-----------------
 drivers/ata/pata_octeon_cf.c    | 10 ++--------
 drivers/ata/pata_pdc202xx_old.c |  2 --
 drivers/ata/pata_sil680.c       |  1 -
 drivers/ata/sata_dwc_460ex.c    | 18 ++++--------------
 drivers/ata/sata_rcar.c         |  2 --
 6 files changed, 7 insertions(+), 44 deletions(-)

diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 60ac93a0bafb..4c923820d4f9 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -409,12 +409,6 @@ void ata_sff_tf_load(struct ata_port *ap, const struct ata_taskfile *tf)
 		iowrite8(tf->hob_lbal, ioaddr->lbal_addr);
 		iowrite8(tf->hob_lbam, ioaddr->lbam_addr);
 		iowrite8(tf->hob_lbah, ioaddr->lbah_addr);
-		VPRINTK("hob: feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n",
-			tf->hob_feature,
-			tf->hob_nsect,
-			tf->hob_lbal,
-			tf->hob_lbam,
-			tf->hob_lbah);
 	}
 
 	if (is_addr) {
@@ -423,18 +417,10 @@ void ata_sff_tf_load(struct ata_port *ap, const struct ata_taskfile *tf)
 		iowrite8(tf->lbal, ioaddr->lbal_addr);
 		iowrite8(tf->lbam, ioaddr->lbam_addr);
 		iowrite8(tf->lbah, ioaddr->lbah_addr);
-		VPRINTK("feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n",
-			tf->feature,
-			tf->nsect,
-			tf->lbal,
-			tf->lbam,
-			tf->lbah);
 	}
 
-	if (tf->flags & ATA_TFLAG_DEVICE) {
+	if (tf->flags & ATA_TFLAG_DEVICE)
 		iowrite8(tf->device, ioaddr->device_addr);
-		VPRINTK("device 0x%X\n", tf->device);
-	}
 
 	ata_wait_idle(ap);
 }
@@ -494,8 +480,6 @@ EXPORT_SYMBOL_GPL(ata_sff_tf_read);
  */
 void ata_sff_exec_command(struct ata_port *ap, const struct ata_taskfile *tf)
 {
-	DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command);
-
 	iowrite8(tf->command, ap->ioaddr.command_addr);
 	ata_sff_pause(ap);
 }
diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
index cdc95eb2b2cb..06468a1f4807 100644
--- a/drivers/ata/pata_octeon_cf.c
+++ b/drivers/ata/pata_octeon_cf.c
@@ -514,20 +514,14 @@ static void octeon_cf_exec_command16(struct ata_port *ap,
 {
 	/* The base of the registers is at ioaddr.data_addr. */
 	void __iomem *base = ap->ioaddr.data_addr;
-	u16 blob;
+	u16 blob = 0;
 
-	if (tf->flags & ATA_TFLAG_DEVICE) {
-		VPRINTK("device 0x%X\n", tf->device);
+	if (tf->flags & ATA_TFLAG_DEVICE)
 		blob = tf->device;
-	} else {
-		blob = 0;
-	}
 
-	DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command);
 	blob |= (tf->command << 8);
 	__raw_writew(blob, base + 6);
 
-
 	ata_wait_idle(ap);
 }
 
diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c
index 0c5cbcd28d0d..b99849095853 100644
--- a/drivers/ata/pata_pdc202xx_old.c
+++ b/drivers/ata/pata_pdc202xx_old.c
@@ -38,8 +38,6 @@ static int pdc2026x_cable_detect(struct ata_port *ap)
 static void pdc202xx_exec_command(struct ata_port *ap,
 				  const struct ata_taskfile *tf)
 {
-	DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command);
-
 	iowrite8(tf->command, ap->ioaddr.command_addr);
 	ndelay(400);
 }
diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c
index 43215a664b96..81238e097fe2 100644
--- a/drivers/ata/pata_sil680.c
+++ b/drivers/ata/pata_sil680.c
@@ -212,7 +212,6 @@ static void sil680_set_dmamode(struct ata_port *ap, struct ata_device *adev)
 static void sil680_sff_exec_command(struct ata_port *ap,
 				    const struct ata_taskfile *tf)
 {
-	DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command);
 	iowrite8(tf->command, ap->ioaddr.command_addr);
 	ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_CMD);
 }
diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c
index 338c2e50f759..f5ef5ce5f758 100644
--- a/drivers/ata/sata_dwc_460ex.c
+++ b/drivers/ata/sata_dwc_460ex.c
@@ -980,9 +980,6 @@ static void sata_dwc_exec_command_by_tag(struct ata_port *ap,
 {
 	struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap);
 
-	dev_dbg(ap->dev, "%s cmd(0x%02x): %s tag=%d\n", __func__, tf->command,
-		ata_get_cmd_descript(tf->command), tag);
-
 	hsdevp->cmd_issued[tag] = cmd_issued;
 
 	/*
@@ -1005,12 +1002,9 @@ static void sata_dwc_bmdma_setup(struct ata_queued_cmd *qc)
 {
 	u8 tag = qc->hw_tag;
 
-	if (ata_is_ncq(qc->tf.protocol)) {
-		dev_dbg(qc->ap->dev, "%s: ap->link.sactive=0x%08x tag=%d\n",
-			__func__, qc->ap->link.sactive, tag);
-	} else {
+	if (!ata_is_ncq(qc->tf.protocol))
 		tag = 0;
-	}
+
 	sata_dwc_bmdma_setup_by_tag(qc, tag);
 }
 
@@ -1067,13 +1061,9 @@ static void sata_dwc_bmdma_start(struct ata_queued_cmd *qc)
 {
 	u8 tag = qc->hw_tag;
 
-	if (ata_is_ncq(qc->tf.protocol)) {
-		dev_dbg(qc->ap->dev, "%s: ap->link.sactive=0x%08x tag=%d\n",
-			__func__, qc->ap->link.sactive, tag);
-	} else {
+	if (!ata_is_ncq(qc->tf.protocol))
 		tag = 0;
-	}
-	dev_dbg(qc->ap->dev, "%s\n", __func__);
+
 	sata_dwc_bmdma_start_by_tag(qc, tag);
 }
 
diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
index 9005833ab02f..b4994d182eda 100644
--- a/drivers/ata/sata_rcar.c
+++ b/drivers/ata/sata_rcar.c
@@ -436,8 +436,6 @@ static void sata_rcar_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
 static void sata_rcar_exec_command(struct ata_port *ap,
 				   const struct ata_taskfile *tf)
 {
-	DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command);
-
 	iowrite32(tf->command, ap->ioaddr.command_addr);
 	ata_sff_pause(ap);
 }
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 11/73] pata_octeon_cf: add bmdma tracepoints and drop DPRINTK() calls
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (9 preceding siblings ...)
  2021-12-08 16:31 ` [PATCH 10/73] libata: drop debugging statements " Hannes Reinecke
@ 2021-12-08 16:31 ` Hannes Reinecke
  2021-12-08 16:31 ` [PATCH 12/73] pata_arasan_cf: use generic tracepoints Hannes Reinecke
                   ` (62 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:31 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke, Bartlomiej Zolnierkiewicz

Add missing bmdma tracepoints and drop the now pointless
DPRINTK() calls.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 drivers/ata/pata_octeon_cf.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
index 06468a1f4807..f86dabcecf9d 100644
--- a/drivers/ata/pata_octeon_cf.c
+++ b/drivers/ata/pata_octeon_cf.c
@@ -19,7 +19,7 @@
 #include <linux/of_platform.h>
 #include <linux/platform_device.h>
 #include <scsi/scsi_host.h>
-
+#include <trace/events/libata.h>
 #include <asm/byteorder.h>
 #include <asm/octeon/octeon.h>
 
@@ -535,12 +535,10 @@ static void octeon_cf_dma_setup(struct ata_queued_cmd *qc)
 	struct octeon_cf_port *cf_port;
 
 	cf_port = ap->private_data;
-	DPRINTK("ENTER\n");
 	/* issue r/w command */
 	qc->cursg = qc->sg;
 	cf_port->dma_finished = 0;
 	ap->ops->sff_exec_command(ap, &qc->tf);
-	DPRINTK("EXIT\n");
 }
 
 /**
@@ -792,8 +790,11 @@ static unsigned int octeon_cf_qc_issue(struct ata_queued_cmd *qc)
 	case ATA_PROT_DMA:
 		WARN_ON(qc->tf.flags & ATA_TFLAG_POLLING);
 
+		trace_ata_tf_load(ap, &qc->tf);
 		ap->ops->sff_tf_load(ap, &qc->tf);  /* load tf registers */
+		trace_ata_bmdma_setup(ap, &qc->tf, qc->tag);
 		octeon_cf_dma_setup(qc);	    /* set up dma */
+		trace_ata_bmdma_start(ap, &qc->tf, qc->tag);
 		octeon_cf_dma_start(qc);	    /* initiate dma */
 		ap->hsm_task_state = HSM_ST_LAST;
 		break;
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 12/73] pata_arasan_cf: use generic tracepoints
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (10 preceding siblings ...)
  2021-12-08 16:31 ` [PATCH 11/73] pata_octeon_cf: add bmdma tracepoints and drop DPRINTK() calls Hannes Reinecke
@ 2021-12-08 16:31 ` Hannes Reinecke
  2021-12-08 16:31 ` [PATCH 13/73] sata_dwc_460ex: " Hannes Reinecke
                   ` (61 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:31 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke, Bartlomiej Zolnierkiewicz

For completeness add generic tracepoints for bus-master DMA.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 drivers/ata/pata_arasan_cf.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c
index 63f39440a9b4..24c3d5e1fca3 100644
--- a/drivers/ata/pata_arasan_cf.c
+++ b/drivers/ata/pata_arasan_cf.c
@@ -39,6 +39,7 @@
 #include <linux/spinlock.h>
 #include <linux/types.h>
 #include <linux/workqueue.h>
+#include <trace/events/libata.h>
 
 #define DRIVER_NAME	"arasan_cf"
 #define TIMEOUT		msecs_to_jiffies(3000)
@@ -703,9 +704,11 @@ static unsigned int arasan_cf_qc_issue(struct ata_queued_cmd *qc)
 	case ATA_PROT_DMA:
 		WARN_ON_ONCE(qc->tf.flags & ATA_TFLAG_POLLING);
 
+		trace_ata_tf_load(ap, &qc->tf);
 		ap->ops->sff_tf_load(ap, &qc->tf);
 		acdev->dma_status = 0;
 		acdev->qc = qc;
+		trace_ata_bmdma_start(ap, &qc->tf, qc->tag);
 		arasan_cf_dma_start(acdev);
 		ap->hsm_task_state = HSM_ST_LAST;
 		break;
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 13/73] sata_dwc_460ex: use generic tracepoints
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (11 preceding siblings ...)
  2021-12-08 16:31 ` [PATCH 12/73] pata_arasan_cf: use generic tracepoints Hannes Reinecke
@ 2021-12-08 16:31 ` Hannes Reinecke
  2021-12-09 11:57   ` kernel test robot
                     ` (2 more replies)
  2021-12-08 16:31 ` [PATCH 14/73] sata_nv: " Hannes Reinecke
                   ` (60 subsequent siblings)
  73 siblings, 3 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:31 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke, Bartlomiej Zolnierkiewicz

Add generic tracepoints and drop the now obsolete logging statements.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 drivers/ata/sata_dwc_460ex.c | 53 +++---------------------------------
 1 file changed, 4 insertions(+), 49 deletions(-)

diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c
index f5ef5ce5f758..6cdce9d00ed7 100644
--- a/drivers/ata/sata_dwc_460ex.c
+++ b/drivers/ata/sata_dwc_460ex.c
@@ -34,6 +34,7 @@
 #include <linux/phy/phy.h>
 #include <linux/libata.h>
 #include <linux/slab.h>
+#include <trace/events/libata.h>
 
 #include "libata.h"
 
@@ -297,35 +298,6 @@ static const char *get_prot_descript(u8 protocol)
 	}
 }
 
-static const char *get_dma_dir_descript(int dma_dir)
-{
-	switch ((enum dma_data_direction)dma_dir) {
-	case DMA_BIDIRECTIONAL:
-		return "bidirectional";
-	case DMA_TO_DEVICE:
-		return "to device";
-	case DMA_FROM_DEVICE:
-		return "from device";
-	default:
-		return "none";
-	}
-}
-
-static void sata_dwc_tf_dump(struct ata_port *ap, struct ata_taskfile *tf)
-{
-	dev_vdbg(ap->dev,
-		"taskfile cmd: 0x%02x protocol: %s flags: 0x%lx device: %x\n",
-		tf->command, get_prot_descript(tf->protocol), tf->flags,
-		tf->device);
-	dev_vdbg(ap->dev,
-		"feature: 0x%02x nsect: 0x%x lbal: 0x%x lbam: 0x%x lbah: 0x%x\n",
-		tf->feature, tf->nsect, tf->lbal, tf->lbam, tf->lbah);
-	dev_vdbg(ap->dev,
-		"hob_feature: 0x%02x hob_nsect: 0x%x hob_lbal: 0x%x hob_lbam: 0x%x hob_lbah: 0x%x\n",
-		tf->hob_feature, tf->hob_nsect, tf->hob_lbal, tf->hob_lbam,
-		tf->hob_lbah);
-}
-
 static void dma_dwc_xfer_done(void *hsdev_instance)
 {
 	unsigned long flags;
@@ -553,6 +525,7 @@ static irqreturn_t sata_dwc_isr(int irq, void *dev_instance)
 		 * active tag.  It is the tag that matches the command about to
 		 * be completed.
 		 */
+		trace_ata_bmdma_start(ap, &qc->tf, tag);
 		qc->ap->link.active_tag = tag;
 		sata_dwc_bmdma_start_by_tag(qc, tag);
 
@@ -1031,12 +1004,6 @@ static void sata_dwc_bmdma_start_by_tag(struct ata_queued_cmd *qc, u8 tag)
 		start_dma = 0;
 	}
 
-	dev_dbg(ap->dev,
-		"%s qc=%p tag: %x cmd: 0x%02x dma_dir: %s start_dma? %x\n",
-		__func__, qc, tag, qc->tf.command,
-		get_dma_dir_descript(qc->dma_dir), start_dma);
-	sata_dwc_tf_dump(ap, &qc->tf);
-
 	if (start_dma) {
 		sata_dwc_scr_read(&ap->link, SCR_ERROR, &reg);
 		if (reg & SATA_DWC_SERROR_ERR_BITS) {
@@ -1074,16 +1041,6 @@ static unsigned int sata_dwc_qc_issue(struct ata_queued_cmd *qc)
 	struct ata_port *ap = qc->ap;
 	struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap);
 
-#ifdef DEBUG_NCQ
-	if (qc->hw_tag > 0 || ap->link.sactive > 1)
-		dev_info(ap->dev,
-			 "%s ap id=%d cmd(0x%02x)=%s qc tag=%d prot=%s ap active_tag=0x%08x ap sactive=0x%08x\n",
-			 __func__, ap->print_id, qc->tf.command,
-			 ata_get_cmd_descript(qc->tf.command),
-			 qc->hw_tag, get_prot_descript(qc->tf.protocol),
-			 ap->link.active_tag, ap->link.sactive);
-#endif
-
 	if (!ata_is_ncq(qc->tf.protocol))
 		tag = 0;
 
@@ -1100,11 +1057,9 @@ static unsigned int sata_dwc_qc_issue(struct ata_queued_cmd *qc)
 		sactive |= (0x00000001 << tag);
 		sata_dwc_scr_write(&ap->link, SCR_ACTIVE, sactive);
 
-		dev_dbg(qc->ap->dev,
-			"%s: tag=%d ap->link.sactive = 0x%08x sactive=0x%08x\n",
-			__func__, tag, qc->ap->link.sactive, sactive);
-
+		trace_ata_tf_load(ap, &qc->tf);
 		ap->ops->sff_tf_load(ap, &qc->tf);
+		trace_ata_exec_command(ap, &qc->tf, tag);
 		sata_dwc_exec_command_by_tag(ap, &qc->tf, tag,
 					     SATA_DWC_CMD_ISSUED_PEND);
 	} else {
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 14/73] sata_nv: use generic tracepoints
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (12 preceding siblings ...)
  2021-12-08 16:31 ` [PATCH 13/73] sata_dwc_460ex: " Hannes Reinecke
@ 2021-12-08 16:31 ` Hannes Reinecke
  2021-12-08 16:31 ` [PATCH 15/73] libata-sff: tracepoints for HSM state machine Hannes Reinecke
                   ` (59 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:31 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke, Bartlomiej Zolnierkiewicz

Remove logging messages covered by generic tracepoints and add
generic tracepoints for internal calls.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 drivers/ata/sata_nv.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index 3c70405a0b80..995c6f19e78f 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -31,6 +31,7 @@
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_device.h>
 #include <linux/libata.h>
+#include <trace/events/libata.h>
 
 #define DRV_NAME			"sata_nv"
 #define DRV_VERSION			"3.5"
@@ -1434,8 +1435,6 @@ static unsigned int nv_adma_qc_issue(struct ata_queued_cmd *qc)
 
 	writew(qc->hw_tag, mmio + NV_ADMA_APPEND);
 
-	DPRINTK("Issued tag %u\n", qc->hw_tag);
-
 	return 0;
 }
 
@@ -2013,19 +2012,17 @@ static unsigned int nv_swncq_issue_atacmd(struct ata_port *ap,
 	if (qc == NULL)
 		return 0;
 
-	DPRINTK("Enter\n");
-
 	writel((1 << qc->hw_tag), pp->sactive_block);
 	pp->last_issue_tag = qc->hw_tag;
 	pp->dhfis_bits &= ~(1 << qc->hw_tag);
 	pp->dmafis_bits &= ~(1 << qc->hw_tag);
 	pp->qc_active |= (0x1 << qc->hw_tag);
 
+	trace_ata_tf_load(ap, &qc->tf);
 	ap->ops->sff_tf_load(ap, &qc->tf);	 /* load tf registers */
+	trace_ata_exec_command(ap, &qc->tf, qc->hw_tag);
 	ap->ops->sff_exec_command(ap, &qc->tf);
 
-	DPRINTK("Issued tag %u\n", qc->hw_tag);
-
 	return 0;
 }
 
@@ -2037,8 +2034,6 @@ static unsigned int nv_swncq_qc_issue(struct ata_queued_cmd *qc)
 	if (qc->tf.protocol != ATA_PROT_NCQ)
 		return ata_bmdma_qc_issue(qc);
 
-	DPRINTK("Enter\n");
-
 	if (!pp->qc_active)
 		nv_swncq_issue_atacmd(ap, qc);
 	else
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 15/73] libata-sff: tracepoints for HSM state machine
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (13 preceding siblings ...)
  2021-12-08 16:31 ` [PATCH 14/73] sata_nv: " Hannes Reinecke
@ 2021-12-08 16:31 ` Hannes Reinecke
  2021-12-08 16:31 ` [PATCH 16/73] libata-sff: add tracepoints for ata_sff_flush_pio_task() Hannes Reinecke
                   ` (58 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:31 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Add tracepoints for the HSM state machine and drop DPRINTK calls

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/libata-sff.c      | 12 ++---
 drivers/ata/libata-trace.c    | 29 +++++++++++
 include/trace/events/libata.h | 96 +++++++++++++++++++++++++++++++++++
 3 files changed, 130 insertions(+), 7 deletions(-)

diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 4c923820d4f9..5d6ea1c9ce29 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -668,7 +668,7 @@ static void ata_pio_sector(struct ata_queued_cmd *qc)
 	page = nth_page(page, (offset >> PAGE_SHIFT));
 	offset %= PAGE_SIZE;
 
-	DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read");
+	trace_ata_sff_pio_transfer_data(qc, offset, qc->sect_size);
 
 	/*
 	 * Split the transfer when it splits a page boundary.  Note that the
@@ -738,7 +738,7 @@ static void ata_pio_sectors(struct ata_queued_cmd *qc)
 static void atapi_send_cdb(struct ata_port *ap, struct ata_queued_cmd *qc)
 {
 	/* send SCSI cdb */
-	DPRINTK("send cdb\n");
+	trace_atapi_send_cdb(qc, 0, qc->dev->cdb_len);
 	WARN_ON_ONCE(qc->dev->cdb_len < 12);
 
 	ap->ops->sff_data_xfer(qc, qc->cdb, qc->dev->cdb_len, 1);
@@ -809,7 +809,7 @@ static int __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes)
 	/* don't cross page boundaries */
 	count = min(count, (unsigned int)PAGE_SIZE - offset);
 
-	DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read");
+	trace_atapi_pio_transfer_data(qc, offset, count);
 
 	/* do the actual data transfer */
 	buf = kmap_atomic(page);
@@ -991,8 +991,7 @@ int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
 	WARN_ON_ONCE(in_wq != ata_hsm_ok_in_wq(ap, qc));
 
 fsm_start:
-	DPRINTK("ata%u: protocol %d task_state %d (dev_stat 0x%X)\n",
-		ap->print_id, qc->tf.protocol, ap->hsm_task_state, status);
+	trace_ata_sff_hsm_state(qc, status);
 
 	switch (ap->hsm_task_state) {
 	case HSM_ST_FIRST:
@@ -1193,8 +1192,7 @@ int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
 		}
 
 		/* no more data to transfer */
-		DPRINTK("ata%u: dev %u command complete, drv_stat 0x%x\n",
-			ap->print_id, qc->dev->devno, status);
+		trace_ata_sff_hsm_command_complete(qc, status);
 
 		WARN_ON_ONCE(qc->err_mask & (AC_ERR_DEV | AC_ERR_HSM));
 
diff --git a/drivers/ata/libata-trace.c b/drivers/ata/libata-trace.c
index 08e001303a82..5a9fba18411b 100644
--- a/drivers/ata/libata-trace.c
+++ b/drivers/ata/libata-trace.c
@@ -137,6 +137,35 @@ libata_trace_parse_qc_flags(struct trace_seq *p, unsigned int qc_flags)
 	return ret;
 }
 
+const char *
+libata_trace_parse_tf_flags(struct trace_seq *p, unsigned int tf_flags)
+{
+	const char *ret = trace_seq_buffer_ptr(p);
+
+	trace_seq_printf(p, "%x", tf_flags);
+	if (tf_flags) {
+		trace_seq_printf(p, "{ ");
+		if (tf_flags & ATA_TFLAG_LBA48)
+			trace_seq_printf(p, "LBA48 ");
+		if (tf_flags & ATA_TFLAG_ISADDR)
+			trace_seq_printf(p, "ISADDR ");
+		if (tf_flags & ATA_TFLAG_DEVICE)
+			trace_seq_printf(p, "DEV ");
+		if (tf_flags & ATA_TFLAG_WRITE)
+			trace_seq_printf(p, "WRITE ");
+		if (tf_flags & ATA_TFLAG_LBA)
+			trace_seq_printf(p, "LBA ");
+		if (tf_flags & ATA_TFLAG_FUA)
+			trace_seq_printf(p, "FUA ");
+		if (tf_flags & ATA_TFLAG_POLLING)
+			trace_seq_printf(p, "POLL ");
+		trace_seq_putc(p, '}');
+	}
+	trace_seq_putc(p, 0);
+
+	return ret;
+}
+
 const char *
 libata_trace_parse_subcmd(struct trace_seq *p, unsigned char cmd,
 			  unsigned char feature, unsigned char hob_nsect)
diff --git a/include/trace/events/libata.h b/include/trace/events/libata.h
index 6a0a9b7a42ec..135b1df472e5 100644
--- a/include/trace/events/libata.h
+++ b/include/trace/events/libata.h
@@ -148,6 +148,15 @@
 		ata_class_name(ATA_DEV_ZAC_UNSUP),	\
 		ata_class_name(ATA_DEV_NONE))
 
+#define ata_sff_hsm_state_name(state)	{ state, #state }
+#define show_sff_hsm_state_name(val)				\
+    __print_symbolic(val,				\
+		ata_sff_hsm_state_name(HSM_ST_IDLE),	\
+		ata_sff_hsm_state_name(HSM_ST_FIRST),	\
+		ata_sff_hsm_state_name(HSM_ST),		\
+		ata_sff_hsm_state_name(HSM_ST_LAST),	\
+		ata_sff_hsm_state_name(HSM_ST_ERR))
+
 const char *libata_trace_parse_status(struct trace_seq*, unsigned char);
 #define __parse_status(s) libata_trace_parse_status(p, s)
 
@@ -160,6 +169,9 @@ const char *libata_trace_parse_eh_err_mask(struct trace_seq *, unsigned int);
 const char *libata_trace_parse_qc_flags(struct trace_seq *, unsigned int);
 #define __parse_qc_flags(f) libata_trace_parse_qc_flags(p, f)
 
+const char *libata_trace_parse_tf_flags(struct trace_seq *, unsigned int);
+#define __parse_tf_flags(f) libata_trace_parse_tf_flags(p, f)
+
 const char *libata_trace_parse_subcmd(struct trace_seq *, unsigned char,
 				      unsigned char, unsigned char);
 #define __parse_subcmd(c,f,h) libata_trace_parse_subcmd(p, c, f, h)
@@ -525,6 +537,90 @@ DEFINE_EVENT(ata_link_reset_end_template, ata_slave_postreset,
 	     TP_PROTO(struct ata_link *link, unsigned int *class, int rc),
 	     TP_ARGS(link, class, rc));
 
+DECLARE_EVENT_CLASS(ata_sff_hsm_template,
+
+	TP_PROTO(struct ata_queued_cmd *qc, unsigned char status),
+
+	TP_ARGS(qc, status),
+
+	TP_STRUCT__entry(
+		__field( unsigned int,	ata_port )
+		__field( unsigned int,	ata_dev	)
+		__field( unsigned int,	tag	)
+		__field( unsigned int,	qc_flags )
+		__field( unsigned int,	protocol )
+		__field( unsigned int,	hsm_state )
+		__field( unsigned char,	dev_state )
+	),
+
+	TP_fast_assign(
+		__entry->ata_port	= qc->ap->print_id;
+		__entry->ata_dev	= qc->dev->link->pmp + qc->dev->devno;
+		__entry->tag		= qc->tag;
+		__entry->qc_flags	= qc->flags;
+		__entry->protocol	= qc->tf.protocol;
+		__entry->hsm_state	= qc->ap->hsm_task_state;
+		__entry->dev_state	= status;
+	),
+
+	TP_printk("ata_port=%u ata_dev=%u tag=%d proto=%s flags=%s task_state=%s dev_stat=0x%X",
+		  __entry->ata_port, __entry->ata_dev, __entry->tag,
+		  show_protocol_name(__entry->protocol),
+		  __parse_qc_flags(__entry->qc_flags),
+		  show_sff_hsm_state_name(__entry->hsm_state),
+		  __entry->dev_state)
+);
+
+DEFINE_EVENT(ata_sff_hsm_template, ata_sff_hsm_state,
+	TP_PROTO(struct ata_queued_cmd *qc, unsigned char state),
+	TP_ARGS(qc, state));
+
+DEFINE_EVENT(ata_sff_hsm_template, ata_sff_hsm_command_complete,
+	TP_PROTO(struct ata_queued_cmd *qc, unsigned char state),
+	TP_ARGS(qc, state));
+
+DECLARE_EVENT_CLASS(ata_transfer_data_template,
+
+	TP_PROTO(struct ata_queued_cmd *qc, unsigned int offset, unsigned int count),
+
+	TP_ARGS(qc, offset, count),
+
+	TP_STRUCT__entry(
+		__field( unsigned int,	ata_port )
+		__field( unsigned int,	ata_dev	)
+		__field( unsigned int,	tag	)
+		__field( unsigned int,	flags	)
+		__field( unsigned int,	offset	)
+		__field( unsigned int,	bytes	)
+	),
+
+	TP_fast_assign(
+		__entry->ata_port	= qc->ap->print_id;
+		__entry->ata_dev	= qc->dev->link->pmp + qc->dev->devno;
+		__entry->tag		= qc->tag;
+		__entry->flags		= qc->tf.flags;
+		__entry->offset		= offset;
+		__entry->bytes		= count;
+	),
+
+	TP_printk("ata_port=%u ata_dev=%u tag=%d flags=%s offset=%u bytes=%u",
+		  __entry->ata_port, __entry->ata_dev, __entry->tag,
+		  __parse_tf_flags(__entry->flags),
+		  __entry->offset, __entry->bytes)
+);
+
+DEFINE_EVENT(ata_transfer_data_template, ata_sff_pio_transfer_data,
+	     TP_PROTO(struct ata_queued_cmd *qc, unsigned int offset, unsigned int count),
+	     TP_ARGS(qc, offset, count));
+
+DEFINE_EVENT(ata_transfer_data_template, atapi_pio_transfer_data,
+	     TP_PROTO(struct ata_queued_cmd *qc, unsigned int offset, unsigned int count),
+	     TP_ARGS(qc, offset, count));
+
+DEFINE_EVENT(ata_transfer_data_template, atapi_send_cdb,
+	     TP_PROTO(struct ata_queued_cmd *qc, unsigned int offset, unsigned int count),
+	     TP_ARGS(qc, offset, count));
+
 #endif /*  _TRACE_LIBATA_H */
 
 /* This part must be outside protection */
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 16/73] libata-sff: add tracepoints for ata_sff_flush_pio_task()
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (14 preceding siblings ...)
  2021-12-08 16:31 ` [PATCH 15/73] libata-sff: tracepoints for HSM state machine Hannes Reinecke
@ 2021-12-08 16:31 ` Hannes Reinecke
  2021-12-08 16:31 ` [PATCH 17/73] libata-scsi: drop DPRINTK calls for cdb translation Hannes Reinecke
                   ` (57 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:31 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke, Bartlomiej Zolnierkiewicz

Replace DPRINTK calls with tracepoints.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 drivers/ata/libata-sff.c      |  5 +----
 include/trace/events/libata.h | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 5d6ea1c9ce29..58304dc401ac 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -1249,7 +1249,7 @@ EXPORT_SYMBOL_GPL(ata_sff_queue_pio_task);
 
 void ata_sff_flush_pio_task(struct ata_port *ap)
 {
-	DPRINTK("ENTER\n");
+	trace_ata_sff_flush_pio_task(ap);
 
 	cancel_delayed_work_sync(&ap->sff_pio_task);
 
@@ -1266,9 +1266,6 @@ void ata_sff_flush_pio_task(struct ata_port *ap)
 	spin_unlock_irq(ap->lock);
 
 	ap->sff_pio_task_link = NULL;
-
-	if (ata_msg_ctl(ap))
-		ata_port_dbg(ap, "%s: EXIT\n", __func__);
 }
 
 static void ata_sff_pio_task(struct work_struct *work)
diff --git a/include/trace/events/libata.h b/include/trace/events/libata.h
index 135b1df472e5..06bc6756f1dc 100644
--- a/include/trace/events/libata.h
+++ b/include/trace/events/libata.h
@@ -621,6 +621,31 @@ DEFINE_EVENT(ata_transfer_data_template, atapi_send_cdb,
 	     TP_PROTO(struct ata_queued_cmd *qc, unsigned int offset, unsigned int count),
 	     TP_ARGS(qc, offset, count));
 
+DECLARE_EVENT_CLASS(ata_sff_template,
+
+	TP_PROTO(struct ata_port *ap),
+
+	TP_ARGS(ap),
+
+	TP_STRUCT__entry(
+		__field( unsigned int,	ata_port )
+		__field( unsigned char,	hsm_state )
+	),
+
+	TP_fast_assign(
+		__entry->ata_port	= ap->print_id;
+		__entry->hsm_state	= ap->hsm_task_state;
+	),
+
+	TP_printk("ata_port=%u task_state=%s",
+		  __entry->ata_port,
+		  show_sff_hsm_state_name(__entry->hsm_state))
+);
+
+DEFINE_EVENT(ata_sff_template, ata_sff_flush_pio_task,
+	     TP_PROTO(struct ata_port *ap),
+	     TP_ARGS(ap));
+
 #endif /*  _TRACE_LIBATA_H */
 
 /* This part must be outside protection */
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 17/73] libata-scsi: drop DPRINTK calls for cdb translation
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (15 preceding siblings ...)
  2021-12-08 16:31 ` [PATCH 16/73] libata-sff: add tracepoints for ata_sff_flush_pio_task() Hannes Reinecke
@ 2021-12-08 16:31 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 18/73] libata: add tracepoints for ATA error handling Hannes Reinecke
                   ` (56 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:31 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Drop DPRINTK calls for cdb translation as they are already covered
by other traces, and also drop the DPRINTK calls in ata_scsi_hotplug().

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/libata-scsi.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 1b84d5526d77..4df7cbf6abe6 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1469,9 +1469,6 @@ static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc)
 		head  = track % dev->heads;
 		sect  = (u32)block % dev->sectors + 1;
 
-		DPRINTK("block %u track %u cyl %u head %u sect %u\n",
-			(u32)block, track, cyl, head, sect);
-
 		/* Check whether the converted CHS can fit.
 		   Cylinder: 0-65535
 		   Head: 0-15
@@ -1594,7 +1591,6 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc)
 			goto invalid_fld;
 		break;
 	default:
-		DPRINTK("no-byte command\n");
 		fp = 0;
 		goto invalid_fld;
 	}
@@ -1748,7 +1744,6 @@ static int ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd,
 early_finish:
 	ata_qc_free(qc);
 	scsi_done(cmd);
-	DPRINTK("EXIT - early finish (good or error)\n");
 	return 0;
 
 err_did:
@@ -1756,12 +1751,10 @@ static int ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd,
 	cmd->result = (DID_ERROR << 16);
 	scsi_done(cmd);
 err_mem:
-	DPRINTK("EXIT - internal\n");
 	return 0;
 
 defer:
 	ata_qc_free(qc);
-	DPRINTK("EXIT - defer\n");
 	if (rc == ATA_DEFER_LINK)
 		return SCSI_MLQUEUE_DEVICE_BUSY;
 	else
@@ -2512,8 +2505,6 @@ static void atapi_request_sense(struct ata_queued_cmd *qc)
 	struct ata_port *ap = qc->ap;
 	struct scsi_cmnd *cmd = qc->scsicmd;
 
-	DPRINTK("ATAPI request sense\n");
-
 	memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
 
 #ifdef CONFIG_ATA_SFF
@@ -2552,8 +2543,6 @@ static void atapi_request_sense(struct ata_queued_cmd *qc)
 	qc->complete_fn = atapi_sense_complete;
 
 	ata_qc_issue(qc);
-
-	DPRINTK("EXIT\n");
 }
 
 /*
@@ -2663,7 +2652,6 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc)
 	qc->tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
 	if (scmd->sc_data_direction == DMA_TO_DEVICE) {
 		qc->tf.flags |= ATA_TFLAG_WRITE;
-		DPRINTK("direction: write\n");
 	}
 
 	qc->tf.command = ATA_CMD_PACKET;
@@ -4048,8 +4036,6 @@ int __ata_scsi_queuecmd(struct scsi_cmnd *scmd, struct ata_device *dev)
 	return rc;
 
  bad_cdb_len:
-	DPRINTK("bad CDB len=%u, scsi_op=0x%02x, max=%u\n",
-		scmd->cmd_len, scsi_op, dev->cdb_len);
 	scmd->result = DID_ERROR << 16;
 	scsi_done(scmd);
 	return 0;
@@ -4520,12 +4506,9 @@ void ata_scsi_hotplug(struct work_struct *work)
 		container_of(work, struct ata_port, hotplug_task.work);
 	int i;
 
-	if (ap->pflags & ATA_PFLAG_UNLOADING) {
-		DPRINTK("ENTER/EXIT - unloading\n");
+	if (ap->pflags & ATA_PFLAG_UNLOADING)
 		return;
-	}
 
-	DPRINTK("ENTER\n");
 	mutex_lock(&ap->scsi_scan_mutex);
 
 	/* Unplug detached devices.  We cannot use link iterator here
@@ -4541,7 +4524,6 @@ void ata_scsi_hotplug(struct work_struct *work)
 	ata_scsi_scan_host(ap, 0);
 
 	mutex_unlock(&ap->scsi_scan_mutex);
-	DPRINTK("EXIT\n");
 }
 
 /**
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 18/73] libata: add tracepoints for ATA error handling
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (16 preceding siblings ...)
  2021-12-08 16:31 ` [PATCH 17/73] libata-scsi: drop DPRINTK calls for cdb translation Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 19/73] libata: drop DPRINTK() calls during " Hannes Reinecke
                   ` (55 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke, Bartlomiej Zolnierkiewicz

Add tracepoints for ATA error handling.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 drivers/ata/libata-eh.c       | 10 ++++--
 include/trace/events/libata.h | 60 +++++++++++++++++++++++++++++++++++
 2 files changed, 67 insertions(+), 3 deletions(-)

diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 043a1c846f2c..2a25be588e14 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -940,7 +940,7 @@ void ata_std_sched_eh(struct ata_port *ap)
 	ata_eh_set_pending(ap, 1);
 	scsi_schedule_eh(ap->scsi_host);
 
-	DPRINTK("port EH scheduled\n");
+	trace_ata_std_sched_eh(ap);
 }
 EXPORT_SYMBOL_GPL(ata_std_sched_eh);
 
@@ -1070,7 +1070,7 @@ static void __ata_port_freeze(struct ata_port *ap)
 
 	ap->pflags |= ATA_PFLAG_FROZEN;
 
-	DPRINTK("ata%u port frozen\n", ap->print_id);
+	trace_ata_port_freeze(ap);
 }
 
 /**
@@ -1147,7 +1147,7 @@ void ata_eh_thaw_port(struct ata_port *ap)
 
 	spin_unlock_irqrestore(ap->lock, flags);
 
-	DPRINTK("ata%u port thawed\n", ap->print_id);
+	trace_ata_port_thaw(ap);
 }
 
 static void ata_eh_scsidone(struct scsi_cmnd *scmd)
@@ -1287,6 +1287,8 @@ void ata_eh_about_to_do(struct ata_link *link, struct ata_device *dev,
 	struct ata_eh_context *ehc = &link->eh_context;
 	unsigned long flags;
 
+	trace_ata_eh_about_to_do(link, dev ? dev->devno : 0, action);
+
 	spin_lock_irqsave(ap->lock, flags);
 
 	ata_eh_clear_action(link, dev, ehi, action);
@@ -1317,6 +1319,8 @@ void ata_eh_done(struct ata_link *link, struct ata_device *dev,
 {
 	struct ata_eh_context *ehc = &link->eh_context;
 
+	trace_ata_eh_done(link, dev ? dev->devno : 0, action);
+
 	ata_eh_clear_action(link, dev, &ehc->i, action);
 }
 
diff --git a/include/trace/events/libata.h b/include/trace/events/libata.h
index 06bc6756f1dc..7d48e804b889 100644
--- a/include/trace/events/libata.h
+++ b/include/trace/events/libata.h
@@ -457,6 +457,37 @@ TRACE_EVENT(ata_eh_link_autopsy_qc,
 		  __parse_eh_err_mask(__entry->eh_err_mask))
 );
 
+DECLARE_EVENT_CLASS(ata_eh_action_template,
+
+	TP_PROTO(struct ata_link *link, unsigned int devno, unsigned int eh_action),
+
+	TP_ARGS(link, devno, eh_action),
+
+	TP_STRUCT__entry(
+		__field( unsigned int,	ata_port )
+		__field( unsigned int,	ata_dev	)
+		__field( unsigned int,	eh_action )
+	),
+
+	TP_fast_assign(
+		__entry->ata_port	= link->ap->print_id;
+		__entry->ata_dev	= link->pmp + devno;
+		__entry->eh_action	= eh_action;
+	),
+
+	TP_printk("ata_port=%u ata_dev=%u eh_action=%s",
+		  __entry->ata_port, __entry->ata_dev,
+		  __parse_eh_action(__entry->eh_action))
+);
+
+DEFINE_EVENT(ata_eh_action_template, ata_eh_about_to_do,
+	     TP_PROTO(struct ata_link *link, unsigned int devno, unsigned int eh_action),
+	     TP_ARGS(link, devno, eh_action));
+
+DEFINE_EVENT(ata_eh_action_template, ata_eh_done,
+	     TP_PROTO(struct ata_link *link, unsigned int devno, unsigned int eh_action),
+	     TP_ARGS(link, devno, eh_action));
+
 DECLARE_EVENT_CLASS(ata_link_reset_begin_template,
 
 	TP_PROTO(struct ata_link *link, unsigned int *class, unsigned long deadline),
@@ -537,6 +568,35 @@ DEFINE_EVENT(ata_link_reset_end_template, ata_slave_postreset,
 	     TP_PROTO(struct ata_link *link, unsigned int *class, int rc),
 	     TP_ARGS(link, class, rc));
 
+DECLARE_EVENT_CLASS(ata_port_eh_begin_template,
+
+	TP_PROTO(struct ata_port *ap),
+
+	TP_ARGS(ap),
+
+	TP_STRUCT__entry(
+		__field( unsigned int,	ata_port )
+	),
+
+	TP_fast_assign(
+		__entry->ata_port	= ap->print_id;
+	),
+
+	TP_printk("ata_port=%u", __entry->ata_port)
+);
+
+DEFINE_EVENT(ata_port_eh_begin_template, ata_std_sched_eh,
+	     TP_PROTO(struct ata_port *ap),
+	     TP_ARGS(ap));
+
+DEFINE_EVENT(ata_port_eh_begin_template, ata_port_freeze,
+	     TP_PROTO(struct ata_port *ap),
+	     TP_ARGS(ap));
+
+DEFINE_EVENT(ata_port_eh_begin_template, ata_port_thaw,
+	     TP_PROTO(struct ata_port *ap),
+	     TP_ARGS(ap));
+
 DECLARE_EVENT_CLASS(ata_sff_hsm_template,
 
 	TP_PROTO(struct ata_queued_cmd *qc, unsigned char status),
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 19/73] libata: drop DPRINTK() calls during ATA error handling
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (17 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 18/73] libata: add tracepoints for ATA error handling Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-09  0:50   ` Damien Le Moal
  2021-12-08 16:32 ` [PATCH 20/73] libata-eh: remove DPRINTK() calls for request sense Hannes Reinecke
                   ` (54 subsequent siblings)
  73 siblings, 1 reply; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke, Bartlomiej Zolnierkiewicz

The information is now logged with tracepoints, so the DPRINTK()
calls can be dropped.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 drivers/ata/libata-eh.c   | 12 ------------
 drivers/ata/libata-pmp.c  |  8 --------
 drivers/ata/libata-sata.c |  3 ---
 3 files changed, 23 deletions(-)

diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 2a25be588e14..a0fd38260f48 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -533,8 +533,6 @@ void ata_scsi_error(struct Scsi_Host *host)
 	unsigned long flags;
 	LIST_HEAD(eh_work_q);
 
-	DPRINTK("ENTER\n");
-
 	spin_lock_irqsave(host->host_lock, flags);
 	list_splice_init(&host->eh_cmd_q, &eh_work_q);
 	spin_unlock_irqrestore(host->host_lock, flags);
@@ -548,7 +546,6 @@ void ata_scsi_error(struct Scsi_Host *host)
 	/* finish or retry handled scmd's and clean up */
 	WARN_ON(!list_empty(&eh_work_q));
 
-	DPRINTK("EXIT\n");
 }
 
 /**
@@ -1932,8 +1929,6 @@ static void ata_eh_link_autopsy(struct ata_link *link)
 	u32 serror;
 	int rc;
 
-	DPRINTK("ENTER\n");
-
 	if (ehc->i.flags & ATA_EHI_NO_AUTOPSY)
 		return;
 
@@ -2040,7 +2035,6 @@ static void ata_eh_link_autopsy(struct ata_link *link)
 		ehc->i.action |= ata_eh_speed_down(dev, eflags, all_err_mask);
 		trace_ata_eh_link_autopsy(dev, ehc->i.action, all_err_mask);
 	}
-	DPRINTK("EXIT\n");
 }
 
 /**
@@ -2940,8 +2934,6 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
 	unsigned long flags;
 	int rc = 0;
 
-	DPRINTK("ENTER\n");
-
 	/* For PATA drive side cable detection to work, IDENTIFY must
 	 * be done backwards such that PDIAG- is released by the slave
 	 * device before the master device is identified.
@@ -3055,7 +3047,6 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
 
  err:
 	*r_failed_dev = dev;
-	DPRINTK("EXIT rc=%d\n", rc);
 	return rc;
 }
 
@@ -3570,8 +3561,6 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
 	int rc, nr_fails;
 	unsigned long flags, deadline;
 
-	DPRINTK("ENTER\n");
-
 	/* prep for recovery */
 	ata_for_each_link(link, ap, EDGE) {
 		struct ata_eh_context *ehc = &link->eh_context;
@@ -3779,7 +3768,6 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
 	if (rc && r_failed_link)
 		*r_failed_link = link;
 
-	DPRINTK("EXIT, rc=%d\n", rc);
 	return rc;
 }
 
diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c
index ba7be3f38617..e2e9cbd405fa 100644
--- a/drivers/ata/libata-pmp.c
+++ b/drivers/ata/libata-pmp.c
@@ -652,8 +652,6 @@ static int sata_pmp_revalidate(struct ata_device *dev, unsigned int new_class)
 	u32 *gscr = (void *)ap->sector_buf;
 	int rc;
 
-	DPRINTK("ENTER\n");
-
 	ata_eh_about_to_do(link, NULL, ATA_EH_REVALIDATE);
 
 	if (!ata_dev_enabled(dev)) {
@@ -686,12 +684,10 @@ static int sata_pmp_revalidate(struct ata_device *dev, unsigned int new_class)
 
 	ata_eh_done(link, NULL, ATA_EH_REVALIDATE);
 
-	DPRINTK("EXIT, rc=0\n");
 	return 0;
 
  fail:
 	ata_dev_err(dev, "PMP revalidation failed (errno=%d)\n", rc);
-	DPRINTK("EXIT, rc=%d\n", rc);
 	return rc;
 }
 
@@ -759,8 +755,6 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap,
 	int detach = 0, rc = 0;
 	int reval_failed = 0;
 
-	DPRINTK("ENTER\n");
-
 	if (dev->flags & ATA_DFLAG_DETACH) {
 		detach = 1;
 		rc = -ENODEV;
@@ -828,7 +822,6 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap,
 	/* okay, PMP resurrected */
 	ehc->i.flags = 0;
 
-	DPRINTK("EXIT, rc=0\n");
 	return 0;
 
  fail:
@@ -838,7 +831,6 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap,
 	else
 		ata_dev_disable(dev);
 
-	DPRINTK("EXIT, rc=%d\n", rc);
 	return rc;
 }
 
diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c
index 4e88597aa9df..7b72c68bc9f7 100644
--- a/drivers/ata/libata-sata.c
+++ b/drivers/ata/libata-sata.c
@@ -533,8 +533,6 @@ int sata_link_hardreset(struct ata_link *link, const unsigned long *timing,
 	u32 scontrol;
 	int rc;
 
-	DPRINTK("ENTER\n");
-
 	if (online)
 		*online = false;
 
@@ -610,7 +608,6 @@ int sata_link_hardreset(struct ata_link *link, const unsigned long *timing,
 			*online = false;
 		ata_link_err(link, "COMRESET failed (errno=%d)\n", rc);
 	}
-	DPRINTK("EXIT, rc=%d\n", rc);
 	return rc;
 }
 EXPORT_SYMBOL_GPL(sata_link_hardreset);
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 20/73] libata-eh: remove DPRINTK() calls for request sense
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (18 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 19/73] libata: drop DPRINTK() calls during " Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-09  0:51   ` Damien Le Moal
  2021-12-08 16:32 ` [PATCH 21/73] libata: move ata_{port,link,dev}_dbg to standard dev_XXX() macros Hannes Reinecke
                   ` (53 subsequent siblings)
  73 siblings, 1 reply; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke, Bartlomiej Zolnierkiewicz

The information will printed during ata_qc_issue() anyway, so
this messages can be dropped.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 drivers/ata/libata-eh.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index a0fd38260f48..69f51616d8bd 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -1422,8 +1422,6 @@ static void ata_eh_request_sense(struct ata_queued_cmd *qc,
 		return;
 	}
 
-	DPRINTK("ATA request sense\n");
-
 	ata_tf_init(dev, &tf);
 	tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
 	tf.flags |= ATA_TFLAG_LBA | ATA_TFLAG_LBA48;
@@ -1464,8 +1462,6 @@ unsigned int atapi_eh_request_sense(struct ata_device *dev,
 	struct ata_port *ap = dev->link->ap;
 	struct ata_taskfile tf;
 
-	DPRINTK("ATAPI request sense\n");
-
 	memset(sense_buf, 0, SCSI_SENSE_BUFFERSIZE);
 
 	/* initialize sense_buf with the error register,
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 21/73] libata: move ata_{port,link,dev}_dbg to standard dev_XXX() macros
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (19 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 20/73] libata-eh: remove DPRINTK() calls for request sense Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-09  0:57   ` Damien Le Moal
  2021-12-08 16:32 ` [PATCH 22/73] libata: add qc_prep tracepoint Hannes Reinecke
                   ` (52 subsequent siblings)
  73 siblings, 1 reply; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Use standard dev_{dbg,info,notice,warn,err} macros instead of the
hand-crafted printk helpers.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/libata-acpi.c    | 48 +++++++++++++++-------------
 drivers/ata/libata-core.c    | 61 ------------------------------------
 drivers/ata/pata_ixp4xx_cf.c |  6 ++--
 include/linux/libata.h       | 48 ++++++++++------------------
 4 files changed, 45 insertions(+), 118 deletions(-)

diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index 7a7d6642edcc..7007377880ce 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
@@ -650,9 +650,7 @@ static int ata_acpi_run_tf(struct ata_device *dev,
 	struct ata_taskfile *pptf = NULL;
 	struct ata_taskfile tf, ptf, rtf;
 	unsigned int err_mask;
-	const char *level;
 	const char *descr;
-	char msg[60];
 	int rc;
 
 	if ((gtf->tf[0] == 0) && (gtf->tf[1] == 0) && (gtf->tf[2] == 0)
@@ -666,6 +664,10 @@ static int ata_acpi_run_tf(struct ata_device *dev,
 		pptf = &ptf;
 	}
 
+	descr = ata_get_cmd_descript(tf.command);
+	if (!descr)
+		descr = "unknown";
+
 	if (!ata_acpi_filter_tf(dev, &tf, pptf)) {
 		rtf = tf;
 		err_mask = ata_exec_internal(dev, &rtf, NULL,
@@ -673,40 +675,42 @@ static int ata_acpi_run_tf(struct ata_device *dev,
 
 		switch (err_mask) {
 		case 0:
-			level = KERN_DEBUG;
-			snprintf(msg, sizeof(msg), "succeeded");
+			ata_dev_dbg(dev,
+				"ACPI cmd %02x/%02x:%02x:%02x:%02x:%02x:%02x"
+				"(%s) succeeded\n",
+				tf.command, tf.feature, tf.nsect, tf.lbal,
+				tf.lbam, tf.lbah, tf.device, descr);
 			rc = 1;
 			break;
 
 		case AC_ERR_DEV:
-			level = KERN_INFO;
-			snprintf(msg, sizeof(msg),
-				 "rejected by device (Stat=0x%02x Err=0x%02x)",
-				 rtf.command, rtf.feature);
+			ata_dev_info(dev,
+				"ACPI cmd %02x/%02x:%02x:%02x:%02x:%02x:%02x"
+				"(%s) rejected by device (Stat=0x%02x Err=0x%02x)",
+				tf.command, tf.feature, tf.nsect, tf.lbal,
+				tf.lbam, tf.lbah, tf.device, descr,
+				rtf.command, rtf.feature);
 			rc = 0;
 			break;
 
 		default:
-			level = KERN_ERR;
-			snprintf(msg, sizeof(msg),
-				 "failed (Emask=0x%x Stat=0x%02x Err=0x%02x)",
-				 err_mask, rtf.command, rtf.feature);
+			ata_dev_err(dev,
+				"ACPI cmd %02x/%02x:%02x:%02x:%02x:%02x:%02x"
+				"(%s) failed (Emask=0x%x Stat=0x%02x Err=0x%02x)",
+				tf.command, tf.feature, tf.nsect, tf.lbal,
+				tf.lbam, tf.lbah, tf.device, descr,
+				err_mask, rtf.command, rtf.feature);
 			rc = -EIO;
 			break;
 		}
 	} else {
-		level = KERN_INFO;
-		snprintf(msg, sizeof(msg), "filtered out");
+		ata_dev_info(dev,
+			"ACPI cmd %02x/%02x:%02x:%02x:%02x:%02x:%02x"
+			"(%s) filtered out\n",
+			tf.command, tf.feature, tf.nsect, tf.lbal,
+			tf.lbam, tf.lbah, tf.device, descr);
 		rc = 0;
 	}
-	descr = ata_get_cmd_descript(tf.command);
-
-	ata_dev_printk(dev, level,
-		       "ACPI cmd %02x/%02x:%02x:%02x:%02x:%02x:%02x (%s) %s\n",
-		       tf.command, tf.feature, tf.nsect, tf.lbal,
-		       tf.lbam, tf.lbah, tf.device,
-		       (descr ? descr : "unknown"), msg);
-
 	return rc;
 }
 
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index ef5ae37bfac0..de5f4bf1c90c 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -6548,67 +6548,6 @@ const struct ata_port_info ata_dummy_port_info = {
 };
 EXPORT_SYMBOL_GPL(ata_dummy_port_info);
 
-/*
- * Utility print functions
- */
-void ata_port_printk(const struct ata_port *ap, const char *level,
-		     const char *fmt, ...)
-{
-	struct va_format vaf;
-	va_list args;
-
-	va_start(args, fmt);
-
-	vaf.fmt = fmt;
-	vaf.va = &args;
-
-	printk("%sata%u: %pV", level, ap->print_id, &vaf);
-
-	va_end(args);
-}
-EXPORT_SYMBOL(ata_port_printk);
-
-void ata_link_printk(const struct ata_link *link, const char *level,
-		     const char *fmt, ...)
-{
-	struct va_format vaf;
-	va_list args;
-
-	va_start(args, fmt);
-
-	vaf.fmt = fmt;
-	vaf.va = &args;
-
-	if (sata_pmp_attached(link->ap) || link->ap->slave_link)
-		printk("%sata%u.%02u: %pV",
-		       level, link->ap->print_id, link->pmp, &vaf);
-	else
-		printk("%sata%u: %pV",
-		       level, link->ap->print_id, &vaf);
-
-	va_end(args);
-}
-EXPORT_SYMBOL(ata_link_printk);
-
-void ata_dev_printk(const struct ata_device *dev, const char *level,
-		    const char *fmt, ...)
-{
-	struct va_format vaf;
-	va_list args;
-
-	va_start(args, fmt);
-
-	vaf.fmt = fmt;
-	vaf.va = &args;
-
-	printk("%sata%u.%02u: %pV",
-	       level, dev->link->ap->print_id, dev->link->pmp + dev->devno,
-	       &vaf);
-
-	va_end(args);
-}
-EXPORT_SYMBOL(ata_dev_printk);
-
 void ata_print_version(const struct device *dev, const char *version)
 {
 	dev_printk(KERN_DEBUG, dev, "version %s\n", version);
diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c
index 99c63087c8ae..17b557c91e1c 100644
--- a/drivers/ata/pata_ixp4xx_cf.c
+++ b/drivers/ata/pata_ixp4xx_cf.c
@@ -114,7 +114,7 @@ static void ixp4xx_set_piomode(struct ata_port *ap, struct ata_device *adev)
 {
 	struct ixp4xx_pata *ixpp = ap->host->private_data;
 
-	ata_dev_printk(adev, KERN_INFO, "configured for PIO%d 8bit\n",
+	ata_dev_info(adev, "configured for PIO%d 8bit\n",
 		       adev->pio_mode - XFER_PIO_0);
 	ixp4xx_set_8bit_timing(ixpp, adev->pio_mode);
 }
@@ -132,8 +132,8 @@ static unsigned int ixp4xx_mmio_data_xfer(struct ata_queued_cmd *qc,
 	struct ixp4xx_pata *ixpp = ap->host->private_data;
 	unsigned long flags;
 
-	ata_dev_printk(adev, KERN_DEBUG, "%s %d bytes\n", (rw == READ) ? "READ" : "WRITE",
-		       buflen);
+	ata_dev_dbg(adev, "%s %d bytes\n", (rw == READ) ? "READ" : "WRITE",
+		    buflen);
 	spin_lock_irqsave(ap->lock, flags);
 
 	/* set the expansion bus in 16bit mode and restore
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 235fdbeb19ea..a807d2d43d70 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1489,51 +1489,38 @@ static inline int sata_srst_pmp(struct ata_link *link)
 	return link->pmp;
 }
 
-/*
- * printk helpers
- */
-__printf(3, 4)
-void ata_port_printk(const struct ata_port *ap, const char *level,
-		     const char *fmt, ...);
-__printf(3, 4)
-void ata_link_printk(const struct ata_link *link, const char *level,
-		     const char *fmt, ...);
-__printf(3, 4)
-void ata_dev_printk(const struct ata_device *dev, const char *level,
-		    const char *fmt, ...);
-
 #define ata_port_err(ap, fmt, ...)				\
-	ata_port_printk(ap, KERN_ERR, fmt, ##__VA_ARGS__)
+	dev_err(&ap->tdev, fmt, ##__VA_ARGS__)
 #define ata_port_warn(ap, fmt, ...)				\
-	ata_port_printk(ap, KERN_WARNING, fmt, ##__VA_ARGS__)
+	dev_warn(&ap->tdev, fmt, ##__VA_ARGS__)
 #define ata_port_notice(ap, fmt, ...)				\
-	ata_port_printk(ap, KERN_NOTICE, fmt, ##__VA_ARGS__)
+	dev_notice(&ap->tdev, fmt, ##__VA_ARGS__)
 #define ata_port_info(ap, fmt, ...)				\
-	ata_port_printk(ap, KERN_INFO, fmt, ##__VA_ARGS__)
+	dev_info(&ap->tdev, fmt, ##__VA_ARGS__)
 #define ata_port_dbg(ap, fmt, ...)				\
-	ata_port_printk(ap, KERN_DEBUG, fmt, ##__VA_ARGS__)
+	dev_dbg(&ap->tdev, "%s: " fmt, __func__, ##__VA_ARGS__)
 
 #define ata_link_err(link, fmt, ...)				\
-	ata_link_printk(link, KERN_ERR, fmt, ##__VA_ARGS__)
+	dev_err(&link->tdev, fmt, ##__VA_ARGS__)
 #define ata_link_warn(link, fmt, ...)				\
-	ata_link_printk(link, KERN_WARNING, fmt, ##__VA_ARGS__)
+	dev_warn(&link->tdev, fmt, ##__VA_ARGS__)
 #define ata_link_notice(link, fmt, ...)				\
-	ata_link_printk(link, KERN_NOTICE, fmt, ##__VA_ARGS__)
+	dev_notice(&link->tdev, fmt, ##__VA_ARGS__)
 #define ata_link_info(link, fmt, ...)				\
-	ata_link_printk(link, KERN_INFO, fmt, ##__VA_ARGS__)
+	dev_info(&link->tdev, fmt, ##__VA_ARGS__)
 #define ata_link_dbg(link, fmt, ...)				\
-	ata_link_printk(link, KERN_DEBUG, fmt, ##__VA_ARGS__)
+	dev_dbg(&link->tdev, "%s: " fmt, __func__, ##__VA_ARGS__)
 
 #define ata_dev_err(dev, fmt, ...)				\
-	ata_dev_printk(dev, KERN_ERR, fmt, ##__VA_ARGS__)
+	dev_err(&dev->tdev, fmt, ##__VA_ARGS__)
 #define ata_dev_warn(dev, fmt, ...)				\
-	ata_dev_printk(dev, KERN_WARNING, fmt, ##__VA_ARGS__)
+	dev_warn(&dev->tdev, fmt, ##__VA_ARGS__)
 #define ata_dev_notice(dev, fmt, ...)				\
-	ata_dev_printk(dev, KERN_NOTICE, fmt, ##__VA_ARGS__)
+	dev_notice(&dev->tdev, fmt, ##__VA_ARGS__)
 #define ata_dev_info(dev, fmt, ...)				\
-	ata_dev_printk(dev, KERN_INFO, fmt, ##__VA_ARGS__)
+	dev_info(&dev->tdev, fmt, ##__VA_ARGS__)
 #define ata_dev_dbg(dev, fmt, ...)				\
-	ata_dev_printk(dev, KERN_DEBUG, fmt, ##__VA_ARGS__)
+	dev_dbg(&dev->tdev, "%s: " fmt, __func__, ##__VA_ARGS__)
 
 void ata_print_version(const struct device *dev, const char *version);
 
@@ -2067,11 +2054,8 @@ static inline u8 ata_wait_idle(struct ata_port *ap)
 {
 	u8 status = ata_sff_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
 
-#ifdef ATA_DEBUG
 	if (status != 0xff && (status & (ATA_BUSY | ATA_DRQ)))
-		ata_port_printk(ap, KERN_DEBUG, "abnormal Status 0x%X\n",
-				status);
-#endif
+		ata_port_dbg(ap, "abnormal Status 0x%X\n", status);
 
 	return status;
 }
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 22/73] libata: add qc_prep tracepoint
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (20 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 21/73] libata: move ata_{port,link,dev}_dbg to standard dev_XXX() macros Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-09  8:42   ` Sergei Shtylyov
  2021-12-08 16:32 ` [PATCH 23/73] libata: move DPRINTK to ata debugging Hannes Reinecke
                   ` (51 subsequent siblings)
  73 siblings, 1 reply; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Add tracepoint for ata_qc_prep().

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/libata-core.c     |  1 +
 include/trace/events/libata.h | 10 +++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index de5f4bf1c90c..a538840c652a 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -4931,6 +4931,7 @@ void ata_qc_issue(struct ata_queued_cmd *qc)
 		return;
 	}
 
+	trace_ata_qc_prep(qc);
 	qc->err_mask |= ap->ops->qc_prep(qc);
 	if (unlikely(qc->err_mask))
 		goto err;
diff --git a/include/trace/events/libata.h b/include/trace/events/libata.h
index 7d48e804b889..360f99980b44 100644
--- a/include/trace/events/libata.h
+++ b/include/trace/events/libata.h
@@ -176,7 +176,7 @@ const char *libata_trace_parse_subcmd(struct trace_seq *, unsigned char,
 				      unsigned char, unsigned char);
 #define __parse_subcmd(c,f,h) libata_trace_parse_subcmd(p, c, f, h)
 
-TRACE_EVENT(ata_qc_issue,
+DECLARE_EVENT_CLASS(ata_qc_issue_template,
 
 	TP_PROTO(struct ata_queued_cmd *qc),
 
@@ -235,6 +235,14 @@ TRACE_EVENT(ata_qc_issue,
 		  __entry->dev)
 );
 
+DEFINE_EVENT(ata_qc_issue_template, ata_qc_prep,
+	     TP_PROTO(struct ata_queued_cmd *qc),
+	     TP_ARGS(qc));
+
+DEFINE_EVENT(ata_qc_issue_template, ata_qc_issue,
+	     TP_PROTO(struct ata_queued_cmd *qc),
+	     TP_ARGS(qc));
+
 DECLARE_EVENT_CLASS(ata_qc_complete_template,
 
 	TP_PROTO(struct ata_queued_cmd *qc),
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 23/73] libata: move DPRINTK to ata debugging
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (21 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 22/73] libata: add qc_prep tracepoint Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 24/73] pata_octeon_cf: remove DPRINTK() macro in interrupt context Hannes Reinecke
                   ` (50 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke, Hannes Reinecke

From: Hannes Reinecke <hare@suse.com>

Replace all DPRINTK calls with the ata_XXX_dbg functions.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/libata-core.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index a538840c652a..15ed4417bc68 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2011,7 +2011,7 @@ unsigned int ata_read_log_page(struct ata_device *dev, u8 log,
 	unsigned int err_mask;
 	bool dma = false;
 
-	DPRINTK("read log page - log 0x%x, page 0x%x\n", log, page);
+	ata_dev_dbg(dev, "read log page - log 0x%x, page 0x%x\n", log, page);
 
 	/*
 	 * Return error without actually issuing the command on controllers
@@ -3382,8 +3382,8 @@ static int ata_dev_set_mode(struct ata_device *dev)
 			dev_err_whine = " (device error ignored)";
 	}
 
-	DPRINTK("xfer_shift=%u, xfer_mode=0x%x\n",
-		dev->xfer_shift, (int)dev->xfer_mode);
+	ata_dev_dbg(dev, "xfer_shift=%u, xfer_mode=0x%x\n",
+		    dev->xfer_shift, (int)dev->xfer_mode);
 
 	if (!(ehc->i.flags & ATA_EHI_QUIET) ||
 	    ehc->i.flags & ATA_EHI_DID_HARDRESET)
@@ -4327,7 +4327,7 @@ static unsigned int ata_dev_set_xfermode(struct ata_device *dev)
 	unsigned int err_mask;
 
 	/* set up set-features taskfile */
-	DPRINTK("set features - xfer mode\n");
+	ata_dev_dbg(dev, "set features - xfer mode\n");
 
 	/* Some controllers and ATAPI devices show flaky interrupt
 	 * behavior after setting xfer mode.  Use polling instead.
@@ -4349,7 +4349,6 @@ static unsigned int ata_dev_set_xfermode(struct ata_device *dev)
 	/* On some disks, this command causes spin-up, so we need longer timeout */
 	err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 15000);
 
-	DPRINTK("EXIT, err_mask=%x\n", err_mask);
 	return err_mask;
 }
 
@@ -4375,7 +4374,7 @@ unsigned int ata_dev_set_feature(struct ata_device *dev, u8 enable, u8 feature)
 	unsigned long timeout = 0;
 
 	/* set up set-features taskfile */
-	DPRINTK("set features - SATA features\n");
+	ata_dev_dbg(dev, "set features - SATA features\n");
 
 	ata_tf_init(dev, &tf);
 	tf.command = ATA_CMD_SET_FEATURES;
@@ -4389,7 +4388,6 @@ unsigned int ata_dev_set_feature(struct ata_device *dev, u8 enable, u8 feature)
 			  ata_probe_timeout * 1000 : SETFEATURES_SPINUP_TIMEOUT;
 	err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, timeout);
 
-	DPRINTK("EXIT, err_mask=%x\n", err_mask);
 	return err_mask;
 }
 EXPORT_SYMBOL_GPL(ata_dev_set_feature);
@@ -4417,7 +4415,7 @@ static unsigned int ata_dev_init_params(struct ata_device *dev,
 		return AC_ERR_INVALID;
 
 	/* set up init dev params taskfile */
-	DPRINTK("init dev params \n");
+	ata_dev_dbg(dev, "init dev params \n");
 
 	ata_tf_init(dev, &tf);
 	tf.command = ATA_CMD_INIT_DEV_PARAMS;
@@ -4433,7 +4431,6 @@ static unsigned int ata_dev_init_params(struct ata_device *dev,
 	if (err_mask == AC_ERR_DEV && (tf.feature & ATA_ABORTED))
 		err_mask = 0;
 
-	DPRINTK("EXIT, err_mask=%x\n", err_mask);
 	return err_mask;
 }
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 24/73] pata_octeon_cf: remove DPRINTK() macro in interrupt context
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (22 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 23/73] libata: move DPRINTK to ata debugging Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-09  0:58   ` Damien Le Moal
  2021-12-08 16:32 ` [PATCH 25/73] pdc_adma: Remove DPRINTK call Hannes Reinecke
                   ` (49 subsequent siblings)
  73 siblings, 1 reply; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

There is only so much information to be glanced when the interrupt
routine in called and exited, so remove these DPRINTK() calls.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/pata_octeon_cf.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
index f86dabcecf9d..7b80bbd9b1ed 100644
--- a/drivers/ata/pata_octeon_cf.c
+++ b/drivers/ata/pata_octeon_cf.c
@@ -668,7 +668,6 @@ static irqreturn_t octeon_cf_interrupt(int irq, void *dev_instance)
 
 	spin_lock_irqsave(&host->lock, flags);
 
-	DPRINTK("ENTER\n");
 	for (i = 0; i < host->n_ports; i++) {
 		u8 status;
 		struct ata_port *ap;
@@ -722,7 +721,6 @@ static irqreturn_t octeon_cf_interrupt(int irq, void *dev_instance)
 		}
 	}
 	spin_unlock_irqrestore(&host->lock, flags);
-	DPRINTK("EXIT\n");
 	return IRQ_RETVAL(handled);
 }
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 25/73] pdc_adma: Remove DPRINTK call
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (23 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 24/73] pata_octeon_cf: remove DPRINTK() macro in interrupt context Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 26/73] sata_fsl: move DPRINTK to ata debugging Hannes Reinecke
                   ` (48 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

The DPRINTK call doesn't print information which isn't already covered
by tracepoints later on.
Remove it.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/pdc_adma.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/ata/pdc_adma.c b/drivers/ata/pdc_adma.c
index 5db55e1e2a61..2c910c4cd4de 100644
--- a/drivers/ata/pdc_adma.c
+++ b/drivers/ata/pdc_adma.c
@@ -475,8 +475,6 @@ static inline unsigned int adma_intr_mmio(struct ata_host *host)
 			u8 status = ata_sff_check_status(ap);
 			if ((status & ATA_BUSY))
 				continue;
-			DPRINTK("ata%u: protocol %d (dev_stat 0x%X)\n",
-				ap->print_id, qc->tf.protocol, status);
 
 			/* complete taskfile transaction */
 			pp->state = adma_state_idle;
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 26/73] sata_fsl: move DPRINTK to ata debugging
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (24 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 25/73] pdc_adma: Remove DPRINTK call Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 27/73] sata_rcar: replace DPRINTK() with ata_port_dbg() Hannes Reinecke
                   ` (47 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke, Hannes Reinecke

From: Hannes Reinecke <hare@suse.com>

Replace all DPRINTK calls with the ata_XXX_dbg functions.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/sata_fsl.c | 79 ++++++++++++++++++++----------------------
 1 file changed, 37 insertions(+), 42 deletions(-)

diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index 5421625dcf6e..9a371dd593a7 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -311,9 +311,9 @@ static void fsl_sata_set_irq_coalescing(struct ata_host *host,
 	intr_coalescing_ticks = ticks;
 	spin_unlock_irqrestore(&host->lock, flags);
 
-	DPRINTK("interrupt coalescing, count = 0x%x, ticks = %x\n",
+	dev_dbg(&host->dev, "interrupt coalescing, count = 0x%x, ticks = %x\n",
 			intr_coalescing_count, intr_coalescing_ticks);
-	DPRINTK("ICC register status: (hcr base: %p) = 0x%x\n",
+	dev_dbg(&host->dev, "ICC register status: (hcr base: 0x%x) = 0x%x\n",
 			hcr_base, ioread32(hcr_base + ICC));
 }
 
@@ -385,18 +385,19 @@ static ssize_t fsl_sata_rx_watermark_store(struct device *dev,
 	return strlen(buf);
 }
 
-static inline unsigned int sata_fsl_tag(unsigned int tag,
+static inline unsigned int sata_fsl_tag(struct ata_port *ap,
+					unsigned int tag,
 					void __iomem *hcr_base)
 {
 	/* We let libATA core do actual (queue) tag allocation */
 
 	if (unlikely(tag >= SATA_FSL_QUEUE_DEPTH)) {
-		DPRINTK("tag %d invalid : out of range\n", tag);
+		ata_port_dbg(ap, "tag %d invalid : out of range\n", tag);
 		return 0;
 	}
 
 	if (unlikely((ioread32(hcr_base + CQ)) & (1 << tag))) {
-		DPRINTK("tag %d invalid : in use!!\n", tag);
+		ata_port_dbg(ap, "tag %d invalid : in use!!\n", tag);
 		return 0;
 	}
 
@@ -508,7 +509,7 @@ static enum ata_completion_errors sata_fsl_qc_prep(struct ata_queued_cmd *qc)
 	struct sata_fsl_port_priv *pp = ap->private_data;
 	struct sata_fsl_host_priv *host_priv = ap->host->private_data;
 	void __iomem *hcr_base = host_priv->hcr_base;
-	unsigned int tag = sata_fsl_tag(qc->hw_tag, hcr_base);
+	unsigned int tag = sata_fsl_tag(ap, qc->hw_tag, hcr_base);
 	struct command_desc *cd;
 	u32 desc_info = CMD_DESC_RES | CMD_DESC_SNOOP_ENABLE;
 	u32 num_prde = 0;
@@ -557,7 +558,7 @@ static unsigned int sata_fsl_qc_issue(struct ata_queued_cmd *qc)
 	struct ata_port *ap = qc->ap;
 	struct sata_fsl_host_priv *host_priv = ap->host->private_data;
 	void __iomem *hcr_base = host_priv->hcr_base;
-	unsigned int tag = sata_fsl_tag(qc->hw_tag, hcr_base);
+	unsigned int tag = sata_fsl_tag(ap, qc->hw_tag, hcr_base);
 
 	VPRINTK("xx_qc_issue called,CQ=0x%x,CA=0x%x,CE=0x%x,CC=0x%x\n",
 		ioread32(CQ + hcr_base),
@@ -586,7 +587,7 @@ static bool sata_fsl_qc_fill_rtf(struct ata_queued_cmd *qc)
 	struct sata_fsl_port_priv *pp = qc->ap->private_data;
 	struct sata_fsl_host_priv *host_priv = qc->ap->host->private_data;
 	void __iomem *hcr_base = host_priv->hcr_base;
-	unsigned int tag = sata_fsl_tag(qc->hw_tag, hcr_base);
+	unsigned int tag = sata_fsl_tag(qc->ap, qc->hw_tag, hcr_base);
 	struct command_desc *cd;
 
 	cd = pp->cmdentry + tag;
@@ -850,9 +851,10 @@ static int sata_fsl_hardreset(struct ata_link *link, unsigned int *class,
 			goto try_offline_again;
 	}
 
-	DPRINTK("hardreset, controller off-lined\n");
-	VPRINTK("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS));
-	VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
+	ata_port_dbg(ap, "hardreset, controller off-lined\n"
+		     "HStatus = 0x%x HControl = 0x%x\n",
+		     ioread32(hcr_base + HSTATUS),
+		     ioread32(hcr_base + HCONTROL));
 
 	/*
 	 * PHY reset should remain asserted for atleast 1ms
@@ -880,9 +882,10 @@ static int sata_fsl_hardreset(struct ata_link *link, unsigned int *class,
 		goto err;
 	}
 
-	DPRINTK("hardreset, controller off-lined & on-lined\n");
-	VPRINTK("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS));
-	VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
+	ata_port_dbg(ap, "controller off-lined & on-lined\n"
+		     "HStatus = 0x%x HControl = 0x%x\n",
+		     ioread32(hcr_base + HSTATUS),
+		     ioread32(hcr_base + HCONTROL));
 
 	/*
 	 * First, wait for the PHYRDY change to occur before waiting for
@@ -962,7 +965,7 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
 	tf.ctl |= ATA_SRST;	/* setup SRST bit in taskfile control reg */
 	ata_tf_to_fis(&tf, pmp, 0, cfis);
 
-	DPRINTK("Dumping cfis : 0x%x, 0x%x, 0x%x, 0x%x\n",
+	ata_port_dbg(ap, "Dumping cfis : 0x%x, 0x%x, 0x%x, 0x%x\n",
 		cfis[0], cfis[1], cfis[2], cfis[3]);
 
 	/*
@@ -970,7 +973,7 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
 	 * other commands are active on the controller/device
 	 */
 
-	DPRINTK("@Softreset, CQ = 0x%x, CA = 0x%x, CC = 0x%x\n",
+	ata_port_dbg(ap, "CQ = 0x%x, CA = 0x%x, CC = 0x%x\n",
 		ioread32(CQ + hcr_base),
 		ioread32(CA + hcr_base), ioread32(CC + hcr_base));
 
@@ -983,15 +986,16 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
 	if (temp & 0x1) {
 		ata_port_warn(ap, "ATA_SRST issue failed\n");
 
-		DPRINTK("Softreset@5000,CQ=0x%x,CA=0x%x,CC=0x%x\n",
+		ata_port_dbg(ap, "Softreset@5000,CQ=0x%x,CA=0x%x,CC=0x%x\n",
 			ioread32(CQ + hcr_base),
 			ioread32(CA + hcr_base), ioread32(CC + hcr_base));
 
 		sata_fsl_scr_read(&ap->link, SCR_ERROR, &Serror);
 
-		DPRINTK("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS));
-		DPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
-		DPRINTK("Serror = 0x%x\n", Serror);
+		ata_port_dbg(ap, "HStatus = 0x%x HControl = 0x%x Serror = 0x%x\n",
+			     ioread32(hcr_base + HSTATUS),
+			     ioread32(hcr_base + HCONTROL),
+			     Serror);
 		goto err;
 	}
 
@@ -1048,10 +1052,7 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
 
 static void sata_fsl_error_handler(struct ata_port *ap)
 {
-
-	DPRINTK("in xx_error_handler\n");
 	sata_pmp_error_handler(ap);
-
 }
 
 static void sata_fsl_post_internal_cmd(struct ata_queued_cmd *qc)
@@ -1092,7 +1093,7 @@ static void sata_fsl_error_intr(struct ata_port *ap)
 	if (unlikely(SError & 0xFFFF0000))
 		sata_fsl_scr_write(&ap->link, SCR_ERROR, SError);
 
-	DPRINTK("error_intr,hStat=0x%x,CE=0x%x,DE =0x%x,SErr=0x%x\n",
+	ata_port_dbg(ap, "hStat=0x%x,CE=0x%x,DE =0x%x,SErr=0x%x\n",
 		hstatus, cereg, ioread32(hcr_base + DE), SError);
 
 	/* handle fatal errors */
@@ -1109,7 +1110,7 @@ static void sata_fsl_error_intr(struct ata_port *ap)
 
 	/* Handle PHYRDY change notification */
 	if (hstatus & INT_ON_PHYRDY_CHG) {
-		DPRINTK("SATA FSL: PHYRDY change indication\n");
+		ata_port_dbg(ap, "PHYRDY change indication\n");
 
 		/* Setup a soft-reset EH action */
 		ata_ehi_hotplugged(ehi);
@@ -1130,7 +1131,7 @@ static void sata_fsl_error_intr(struct ata_port *ap)
 		 */
 		abort = 1;
 
-		DPRINTK("single device error, CE=0x%x, DE=0x%x\n",
+		ata_port_dbg(ap, "single device error, CE=0x%x, DE=0x%x\n",
 			ioread32(hcr_base + CE), ioread32(hcr_base + DE));
 
 		/* find out the offending link and qc */
@@ -1235,12 +1236,12 @@ static void sata_fsl_host_intr(struct ata_port *ap)
 	}
 
 	if (unlikely(SError & 0xFFFF0000)) {
-		DPRINTK("serror @host_intr : 0x%x\n", SError);
+		ata_port_dbg(ap, "serror @host_intr : 0x%x\n", SError);
 		sata_fsl_error_intr(ap);
 	}
 
 	if (unlikely(hstatus & status_mask)) {
-		DPRINTK("error interrupt!!\n");
+		ata_port_dbg(ap, "error interrupt!!\n");
 		sata_fsl_error_intr(ap);
 		return;
 	}
@@ -1258,15 +1259,13 @@ static void sata_fsl_host_intr(struct ata_port *ap)
 		/* clear CC bit, this will also complete the interrupt */
 		iowrite32(done_mask, hcr_base + CC);
 
-		DPRINTK("Status of all queues :\n");
-		DPRINTK("done_mask/CC = 0x%x, CA = 0x%x, CE=0x%x\n",
+		ata_port_dbg(ap, "Status of all queues: done_mask/CC = 0x%x, CA = 0x%x, CE=0x%x\n",
 			done_mask, ioread32(hcr_base + CA),
 			ioread32(hcr_base + CE));
 
 		for (i = 0; i < SATA_FSL_QUEUE_DEPTH; i++) {
 			if (done_mask & (1 << i))
-				DPRINTK
-				    ("completing ncq cmd,tag=%d,CC=0x%x,CA=0x%x\n",
+				ata_port_dbg(ap, "completing ncq cmd,tag=%d,CC=0x%x,CA=0x%x\n",
 				     i, ioread32(hcr_base + CC),
 				     ioread32(hcr_base + CA));
 		}
@@ -1277,7 +1276,7 @@ static void sata_fsl_host_intr(struct ata_port *ap)
 		iowrite32(1, hcr_base + CC);
 		qc = ata_qc_from_tag(ap, ATA_TAG_INTERNAL);
 
-		DPRINTK("completing non-ncq cmd, CC=0x%x\n",
+		ata_port_dbg(ap, "completing non-ncq cmd, CC=0x%x\n",
 			 ioread32(hcr_base + CC));
 
 		if (qc) {
@@ -1285,7 +1284,7 @@ static void sata_fsl_host_intr(struct ata_port *ap)
 		}
 	} else {
 		/* Spurious Interrupt!! */
-		DPRINTK("spurious interrupt!!, CC = 0x%x\n",
+		ata_port_dbg(ap, "spurious interrupt!!, CC = 0x%x\n",
 			ioread32(hcr_base + CC));
 		iowrite32(done_mask, hcr_base + CC);
 		return;
@@ -1305,8 +1304,6 @@ static irqreturn_t sata_fsl_interrupt(int irq, void *dev_instance)
 	interrupt_enables = ioread32(hcr_base + HSTATUS);
 	interrupt_enables &= 0x3F;
 
-	DPRINTK("interrupt status 0x%x\n", interrupt_enables);
-
 	if (!interrupt_enables)
 		return IRQ_NONE;
 
@@ -1359,7 +1356,7 @@ static int sata_fsl_init_controller(struct ata_host *host)
 	iowrite32((temp & ~0x3F), hcr_base + HCONTROL);
 
 	/* Disable interrupt coalescing control(icc), for the moment */
-	DPRINTK("icc = 0x%x\n", ioread32(hcr_base + ICC));
+	ata_port_dbg(ap, "icc = 0x%x\n", ioread32(hcr_base + ICC));
 	iowrite32(0x01000000, hcr_base + ICC);
 
 	/* clear error registers, SError is cleared by libATA  */
@@ -1378,8 +1375,8 @@ static int sata_fsl_init_controller(struct ata_host *host)
 	 * callback, that should also initiate the OOB, COMINIT sequence
 	 */
 
-	DPRINTK("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS));
-	DPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
+	ata_port_dbg(ap, "HStatus = 0x%x HControl = 0x%x\n",
+		     ioread32(hcr_base + HSTATUS), ioread32(hcr_base + HCONTROL));
 
 	return 0;
 }
@@ -1458,9 +1455,7 @@ static int sata_fsl_probe(struct platform_device *ofdev)
 		iowrite32(temp | TRANSCFG_RX_WATER_MARK, csr_base + TRANSCFG);
 	}
 
-	DPRINTK("@reset i/o = 0x%x\n", ioread32(csr_base + TRANSCFG));
-	DPRINTK("sizeof(cmd_desc) = %d\n", sizeof(struct command_desc));
-	DPRINTK("sizeof(#define cmd_desc) = %d\n", SATA_FSL_CMD_DESC_SIZE);
+	ata_port_dbg(ap, "@reset i/o = 0x%x\n", ioread32(csr_base + TRANSCFG));
 
 	host_priv = kzalloc(sizeof(struct sata_fsl_host_priv), GFP_KERNEL);
 	if (!host_priv)
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 27/73] sata_rcar: replace DPRINTK() with ata_port_dbg()
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (25 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 26/73] sata_fsl: move DPRINTK to ata debugging Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 28/73] sata_qstor: " Hannes Reinecke
                   ` (46 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/sata_rcar.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
index b4994d182eda..11e68e3854f8 100644
--- a/drivers/ata/sata_rcar.c
+++ b/drivers/ata/sata_rcar.c
@@ -679,7 +679,7 @@ static void sata_rcar_serr_interrupt(struct ata_port *ap)
 	if (!serror)
 		return;
 
-	DPRINTK("SError @host_intr: 0x%x\n", serror);
+	ata_port_dbg(ap, "SError @host_intr: 0x%x\n", serror);
 
 	/* first, analyze and record host port events */
 	ata_ehi_clear_desc(ehi);
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 28/73] sata_qstor: replace DPRINTK() with ata_port_dbg()
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (26 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 27/73] sata_rcar: replace DPRINTK() with ata_port_dbg() Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 29/73] pata_pdc2027x: Replace PDPRINTK() with standard ata logging Hannes Reinecke
                   ` (45 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/sata_qstor.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ata/sata_qstor.c b/drivers/ata/sata_qstor.c
index ef00ab644afb..2b4ccdca71c6 100644
--- a/drivers/ata/sata_qstor.c
+++ b/drivers/ata/sata_qstor.c
@@ -374,8 +374,8 @@ static inline unsigned int qs_intr_pkt(struct ata_host *host)
 			struct qs_port_priv *pp = ap->private_data;
 			struct ata_queued_cmd *qc;
 
-			DPRINTK("SFF=%08x%08x: sCHAN=%u sHST=%d sDST=%02x\n",
-					sff1, sff0, port_no, sHST, sDST);
+			ata_dev_dbg(ap, "SFF=%08x%08x: sHST=%d sDST=%02x\n",
+				    sff1, sff0, sHST, sDST);
 			handled = 1;
 			if (!pp || pp->state != qs_state_pkt)
 				continue;
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 29/73] pata_pdc2027x: Replace PDPRINTK() with standard ata logging
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (27 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 28/73] sata_qstor: " Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 30/73] libata: remove pointless VPRINTK() calls Hannes Reinecke
                   ` (44 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke, Hannes Reinecke

From: Hannes Reinecke <hare@suse.com>

Use standard ata logging macros instead of the hand-crafted
PDPRINTK and remove duplicate logging messages.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/pata_pdc2027x.c | 71 +++++++++++++++----------------------
 1 file changed, 28 insertions(+), 43 deletions(-)

diff --git a/drivers/ata/pata_pdc2027x.c b/drivers/ata/pata_pdc2027x.c
index effc1a09444d..4fbb3eed8b0b 100644
--- a/drivers/ata/pata_pdc2027x.c
+++ b/drivers/ata/pata_pdc2027x.c
@@ -30,13 +30,6 @@
 
 #define DRV_NAME	"pata_pdc2027x"
 #define DRV_VERSION	"1.0"
-#undef PDC_DEBUG
-
-#ifdef PDC_DEBUG
-#define PDPRINTK(fmt, args...) printk(KERN_ERR "%s: " fmt, __func__, ## args)
-#else
-#define PDPRINTK(fmt, args...)
-#endif
 
 enum {
 	PDC_MMIO_BAR		= 5,
@@ -214,11 +207,11 @@ static int pdc2027x_cable_detect(struct ata_port *ap)
 	if (cgcr & (1 << 26))
 		goto cbl40;
 
-	PDPRINTK("No cable or 80-conductor cable on port %d\n", ap->port_no);
+	ata_port_dbg(ap, "No cable or 80-conductor cable\n");
 
 	return ATA_CBL_PATA80;
 cbl40:
-	printk(KERN_INFO DRV_NAME ": 40-conductor cable detected on port %d\n", ap->port_no);
+	ata_port_info(ap, DRV_NAME ":40-conductor cable detected\n");
 	return ATA_CBL_PATA40;
 }
 
@@ -292,17 +285,17 @@ static void pdc2027x_set_piomode(struct ata_port *ap, struct ata_device *adev)
 	unsigned int pio = adev->pio_mode - XFER_PIO_0;
 	u32 ctcr0, ctcr1;
 
-	PDPRINTK("adev->pio_mode[%X]\n", adev->pio_mode);
+	ata_port_dbg(ap, "adev->pio_mode[%X]\n", adev->pio_mode);
 
 	/* Sanity check */
 	if (pio > 4) {
-		printk(KERN_ERR DRV_NAME ": Unknown pio mode [%d] ignored\n", pio);
+		ata_port_err(ap, "Unknown pio mode [%d] ignored\n", pio);
 		return;
 
 	}
 
 	/* Set the PIO timing registers using value table for 133MHz */
-	PDPRINTK("Set pio regs... \n");
+	ata_port_dbg(ap, "Set pio regs... \n");
 
 	ctcr0 = ioread32(dev_mmio(ap, adev, PDC_CTCR0));
 	ctcr0 &= 0xffff0000;
@@ -315,9 +308,7 @@ static void pdc2027x_set_piomode(struct ata_port *ap, struct ata_device *adev)
 	ctcr1 |= (pdc2027x_pio_timing_tbl[pio].value2 << 24);
 	iowrite32(ctcr1, dev_mmio(ap, adev, PDC_CTCR1));
 
-	PDPRINTK("Set pio regs done\n");
-
-	PDPRINTK("Set to pio mode[%u] \n", pio);
+	ata_port_dbg(ap, "Set to pio mode[%u] \n", pio);
 }
 
 /**
@@ -350,7 +341,7 @@ static void pdc2027x_set_dmamode(struct ata_port *ap, struct ata_device *adev)
 			iowrite32(ctcr1 & ~(1 << 7), dev_mmio(ap, adev, PDC_CTCR1));
 		}
 
-		PDPRINTK("Set udma regs... \n");
+		ata_port_dbg(ap, "Set udma regs... \n");
 
 		ctcr1 = ioread32(dev_mmio(ap, adev, PDC_CTCR1));
 		ctcr1 &= 0xff000000;
@@ -359,16 +350,14 @@ static void pdc2027x_set_dmamode(struct ata_port *ap, struct ata_device *adev)
 			(pdc2027x_udma_timing_tbl[udma_mode].value2 << 16);
 		iowrite32(ctcr1, dev_mmio(ap, adev, PDC_CTCR1));
 
-		PDPRINTK("Set udma regs done\n");
-
-		PDPRINTK("Set to udma mode[%u] \n", udma_mode);
+		ata_port_dbg(ap, "Set to udma mode[%u] \n", udma_mode);
 
 	} else  if ((dma_mode >= XFER_MW_DMA_0) &&
 		   (dma_mode <= XFER_MW_DMA_2)) {
 		/* Set the MDMA timing registers with value table for 133MHz */
 		unsigned int mdma_mode = dma_mode & 0x07;
 
-		PDPRINTK("Set mdma regs... \n");
+		ata_port_dbg(ap, "Set mdma regs... \n");
 		ctcr0 = ioread32(dev_mmio(ap, adev, PDC_CTCR0));
 
 		ctcr0 &= 0x0000ffff;
@@ -376,11 +365,10 @@ static void pdc2027x_set_dmamode(struct ata_port *ap, struct ata_device *adev)
 			(pdc2027x_mdma_timing_tbl[mdma_mode].value1 << 24);
 
 		iowrite32(ctcr0, dev_mmio(ap, adev, PDC_CTCR0));
-		PDPRINTK("Set mdma regs done\n");
 
-		PDPRINTK("Set to mdma mode[%u] \n", mdma_mode);
+		ata_port_dbg(ap, "Set to mdma mode[%u] \n", mdma_mode);
 	} else {
-		printk(KERN_ERR DRV_NAME ": Unknown dma mode [%u] ignored\n", dma_mode);
+		ata_port_err(ap, "Unknown dma mode [%u] ignored\n", dma_mode);
 	}
 }
 
@@ -414,7 +402,7 @@ static int pdc2027x_set_mode(struct ata_link *link, struct ata_device **r_failed
 			ctcr1 |= (1 << 25);
 			iowrite32(ctcr1, dev_mmio(ap, dev, PDC_CTCR1));
 
-			PDPRINTK("Turn on prefetch\n");
+			ata_dev_dbg(dev, "Turn on prefetch\n");
 		} else {
 			pdc2027x_set_dmamode(ap, dev);
 		}
@@ -485,8 +473,8 @@ static long pdc_read_counter(struct ata_host *host)
 
 	counter = (bccrh << 15) | bccrl;
 
-	PDPRINTK("bccrh [%X] bccrl [%X]\n", bccrh,  bccrl);
-	PDPRINTK("bccrhv[%X] bccrlv[%X]\n", bccrhv, bccrlv);
+	dev_dbg(host->dev, "bccrh [%X] bccrl [%X]\n", bccrh,  bccrl);
+	dev_dbg(host->dev, "bccrhv[%X] bccrlv[%X]\n", bccrhv, bccrlv);
 
 	/*
 	 * The 30-bit decreasing counter are read by 2 pieces.
@@ -495,7 +483,7 @@ static long pdc_read_counter(struct ata_host *host)
 	 */
 	if (retry && !(bccrh == bccrhv && bccrl >= bccrlv)) {
 		retry--;
-		PDPRINTK("rereading counter\n");
+		dev_dbg(host->dev, "rereading counter\n");
 		goto retry;
 	}
 
@@ -520,20 +508,19 @@ static void pdc_adjust_pll(struct ata_host *host, long pll_clock, unsigned int b
 
 	/* Sanity check */
 	if (unlikely(pll_clock_khz < 5000L || pll_clock_khz > 70000L)) {
-		printk(KERN_ERR DRV_NAME ": Invalid PLL input clock %ldkHz, give up!\n", pll_clock_khz);
+		dev_err(host->dev, "Invalid PLL input clock %ldkHz, give up!\n",
+			pll_clock_khz);
 		return;
 	}
 
-#ifdef PDC_DEBUG
-	PDPRINTK("pout_required is %ld\n", pout_required);
+	dev_dbg(host->dev, "pout_required is %ld\n", pout_required);
 
 	/* Show the current clock value of PLL control register
 	 * (maybe already configured by the firmware)
 	 */
 	pll_ctl = ioread16(mmio_base + PDC_PLL_CTL);
 
-	PDPRINTK("pll_ctl[%X]\n", pll_ctl);
-#endif
+	dev_dbg(host->dev, "pll_ctl[%X]\n", pll_ctl);
 
 	/*
 	 * Calculate the ratio of F, R and OD
@@ -552,7 +539,7 @@ static void pdc_adjust_pll(struct ata_host *host, long pll_clock, unsigned int b
 		R = 0x00;
 	} else {
 		/* Invalid ratio */
-		printk(KERN_ERR DRV_NAME ": Invalid ratio %ld, give up!\n", ratio);
+		dev_err(host->dev, "Invalid ratio %ld, give up!\n", ratio);
 		return;
 	}
 
@@ -560,15 +547,15 @@ static void pdc_adjust_pll(struct ata_host *host, long pll_clock, unsigned int b
 
 	if (unlikely(F < 0 || F > 127)) {
 		/* Invalid F */
-		printk(KERN_ERR DRV_NAME ": F[%d] invalid!\n", F);
+		dev_err(host->dev, "F[%d] invalid!\n", F);
 		return;
 	}
 
-	PDPRINTK("F[%d] R[%d] ratio*1000[%ld]\n", F, R, ratio);
+	dev_dbg(host->dev, "F[%d] R[%d] ratio*1000[%ld]\n", F, R, ratio);
 
 	pll_ctl = (R << 8) | F;
 
-	PDPRINTK("Writing pll_ctl[%X]\n", pll_ctl);
+	dev_dbg(host->dev, "Writing pll_ctl[%X]\n", pll_ctl);
 
 	iowrite16(pll_ctl, mmio_base + PDC_PLL_CTL);
 	ioread16(mmio_base + PDC_PLL_CTL); /* flush */
@@ -576,15 +563,13 @@ static void pdc_adjust_pll(struct ata_host *host, long pll_clock, unsigned int b
 	/* Wait the PLL circuit to be stable */
 	msleep(30);
 
-#ifdef PDC_DEBUG
 	/*
 	 *  Show the current clock value of PLL control register
 	 * (maybe configured by the firmware)
 	 */
 	pll_ctl = ioread16(mmio_base + PDC_PLL_CTL);
 
-	PDPRINTK("pll_ctl[%X]\n", pll_ctl);
-#endif
+	dev_dbg(host->dev, "pll_ctl[%X]\n", pll_ctl);
 
 	return;
 }
@@ -605,7 +590,7 @@ static long pdc_detect_pll_input_clock(struct ata_host *host)
 
 	/* Start the test mode */
 	scr = ioread32(mmio_base + PDC_SYS_CTL);
-	PDPRINTK("scr[%X]\n", scr);
+	dev_dbg(host->dev, "scr[%X]\n", scr);
 	iowrite32(scr | (0x01 << 14), mmio_base + PDC_SYS_CTL);
 	ioread32(mmio_base + PDC_SYS_CTL); /* flush */
 
@@ -622,7 +607,7 @@ static long pdc_detect_pll_input_clock(struct ata_host *host)
 
 	/* Stop the test mode */
 	scr = ioread32(mmio_base + PDC_SYS_CTL);
-	PDPRINTK("scr[%X]\n", scr);
+	dev_dbg(host->dev, "scr[%X]\n", scr);
 	iowrite32(scr & ~(0x01 << 14), mmio_base + PDC_SYS_CTL);
 	ioread32(mmio_base + PDC_SYS_CTL); /* flush */
 
@@ -632,8 +617,8 @@ static long pdc_detect_pll_input_clock(struct ata_host *host)
 	pll_clock = ((start_count - end_count) & 0x3fffffff) / 100 *
 		(100000000 / usec_elapsed);
 
-	PDPRINTK("start[%ld] end[%ld] \n", start_count, end_count);
-	PDPRINTK("PLL input clock[%ld]Hz\n", pll_clock);
+	dev_dbg(host->dev, "start[%ld] end[%ld] PLL input clock[%ld]HZ\n",
+		     start_count, end_count, pll_clock);
 
 	return pll_clock;
 }
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 30/73] libata: remove pointless VPRINTK() calls
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (28 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 29/73] pata_pdc2027x: Replace PDPRINTK() with standard ata logging Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 31/73] ahci: Drop pointless VPRINTK() calls and convert the remaining ones Hannes Reinecke
                   ` (43 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Most of the information is already covered by tracepoints
(if not downright pointless), so remove the VPRINTK() calls.
And while we're at it, remove ata_scsi_dump_cdb(), too,
as this information can be retrieved from scsi tracing.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/libata-core.c |  3 ---
 drivers/ata/libata-sata.c |  2 --
 drivers/ata/libata-scsi.c | 42 ---------------------------------------
 drivers/ata/libata-sff.c  |  9 +--------
 drivers/ata/libata.h      |  1 -
 5 files changed, 1 insertion(+), 56 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 15ed4417bc68..982ccd761bc3 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -4542,8 +4542,6 @@ static void ata_sg_clean(struct ata_queued_cmd *qc)
 
 	WARN_ON_ONCE(sg == NULL);
 
-	VPRINTK("unmapping %u sg elements\n", qc->n_elem);
-
 	if (qc->n_elem)
 		dma_unmap_sg(ap->dev, sg, qc->orig_n_elem, dir);
 
@@ -4573,7 +4571,6 @@ static int ata_sg_setup(struct ata_queued_cmd *qc)
 	if (n_elem < 1)
 		return -1;
 
-	VPRINTK("%d sg elements mapped\n", n_elem);
 	qc->orig_n_elem = qc->n_elem;
 	qc->n_elem = n_elem;
 	qc->flags |= ATA_QCFLAG_DMAMAP;
diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c
index 7b72c68bc9f7..e1339e18c800 100644
--- a/drivers/ata/libata-sata.c
+++ b/drivers/ata/libata-sata.c
@@ -1258,8 +1258,6 @@ int ata_sas_queuecmd(struct scsi_cmnd *cmd, struct ata_port *ap)
 {
 	int rc = 0;
 
-	ata_scsi_dump_cdb(ap, cmd);
-
 	if (likely(ata_dev_enabled(ap->link.device)))
 		rc = __ata_scsi_queuecmd(cmd, ap->link.device);
 	else {
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 4df7cbf6abe6..bbbd0a06ffd2 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1299,8 +1299,6 @@ static void scsi_6_lba_len(const u8 *cdb, u64 *plba, u32 *plen)
 	u64 lba = 0;
 	u32 len;
 
-	VPRINTK("six-byte command\n");
-
 	lba |= ((u64)(cdb[1] & 0x1f)) << 16;
 	lba |= ((u64)cdb[2]) << 8;
 	lba |= ((u64)cdb[3]);
@@ -1326,8 +1324,6 @@ static void scsi_10_lba_len(const u8 *cdb, u64 *plba, u32 *plen)
 	u64 lba = 0;
 	u32 len = 0;
 
-	VPRINTK("ten-byte command\n");
-
 	lba |= ((u64)cdb[2]) << 24;
 	lba |= ((u64)cdb[3]) << 16;
 	lba |= ((u64)cdb[4]) << 8;
@@ -1355,8 +1351,6 @@ static void scsi_16_lba_len(const u8 *cdb, u64 *plba, u32 *plen)
 	u64 lba = 0;
 	u32 len = 0;
 
-	VPRINTK("sixteen-byte command\n");
-
 	lba |= ((u64)cdb[2]) << 56;
 	lba |= ((u64)cdb[3]) << 48;
 	lba |= ((u64)cdb[4]) << 40;
@@ -1706,8 +1700,6 @@ static int ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd,
 	struct ata_queued_cmd *qc;
 	int rc;
 
-	VPRINTK("ENTER\n");
-
 	qc = ata_scsi_qc_new(dev, cmd);
 	if (!qc)
 		goto err_mem;
@@ -1738,7 +1730,6 @@ static int ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd,
 	/* select device, send command to hardware */
 	ata_qc_issue(qc);
 
-	VPRINTK("EXIT\n");
 	return 0;
 
 early_finish:
@@ -1851,8 +1842,6 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf)
 		2
 	};
 
-	VPRINTK("ENTER\n");
-
 	/* set scsi removable (RMB) bit per ata bit, or if the
 	 * AHCI port says it's external (Hotplug-capable, eSATA).
 	 */
@@ -2287,8 +2276,6 @@ static unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf)
 	u8 dpofua, bp = 0xff;
 	u16 fp;
 
-	VPRINTK("ENTER\n");
-
 	six_byte = (scsicmd[0] == MODE_SENSE);
 	ebd = !(scsicmd[1] & 0x8);      /* dbd bit inverted == edb */
 	/*
@@ -2406,8 +2393,6 @@ static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf)
 	log2_per_phys = ata_id_log2_per_physical_sector(dev->id);
 	lowest_aligned = ata_id_logical_sector_offset(dev->id, log2_per_phys);
 
-	VPRINTK("ENTER\n");
-
 	if (args->cmd->cmnd[0] == READ_CAPACITY) {
 		if (last_lba >= 0xffffffffULL)
 			last_lba = 0xffffffff;
@@ -2474,7 +2459,6 @@ static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf)
  */
 static unsigned int ata_scsiop_report_luns(struct ata_scsi_args *args, u8 *rbuf)
 {
-	VPRINTK("ENTER\n");
 	rbuf[3] = 8;	/* just one lun, LUN 0, size 8 bytes */
 
 	return 0;
@@ -2570,8 +2554,6 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc)
 	struct scsi_cmnd *cmd = qc->scsicmd;
 	unsigned int err_mask = qc->err_mask;
 
-	VPRINTK("ENTER, err_mask 0x%X\n", err_mask);
-
 	/* handle completion from new EH */
 	if (unlikely(qc->ap->ops->error_handler &&
 		     (err_mask || qc->flags & ATA_QCFLAG_SENSE_VALID))) {
@@ -3675,8 +3657,6 @@ static unsigned int ata_scsi_mode_select_xlat(struct ata_queued_cmd *qc)
 	u8 buffer[64];
 	const u8 *p = buffer;
 
-	VPRINTK("ENTER\n");
-
 	six_byte = (cdb[0] == MODE_SELECT);
 	if (six_byte) {
 		if (scmd->cmd_len < 5) {
@@ -3974,26 +3954,6 @@ static inline ata_xlat_func_t ata_get_xlat_func(struct ata_device *dev, u8 cmd)
 	return NULL;
 }
 
-/**
- *	ata_scsi_dump_cdb - dump SCSI command contents to dmesg
- *	@ap: ATA port to which the command was being sent
- *	@cmd: SCSI command to dump
- *
- *	Prints the contents of a SCSI command via printk().
- */
-
-void ata_scsi_dump_cdb(struct ata_port *ap, struct scsi_cmnd *cmd)
-{
-#ifdef ATA_VERBOSE_DEBUG
-	struct scsi_device *scsidev = cmd->device;
-
-	VPRINTK("CDB (%u:%d,%d,%lld) %9ph\n",
-		ap->print_id,
-		scsidev->channel, scsidev->id, scsidev->lun,
-		cmd->cmnd);
-#endif
-}
-
 int __ata_scsi_queuecmd(struct scsi_cmnd *scmd, struct ata_device *dev)
 {
 	u8 scsi_op = scmd->cmnd[0];
@@ -4072,8 +4032,6 @@ int ata_scsi_queuecmd(struct Scsi_Host *shost, struct scsi_cmnd *cmd)
 
 	spin_lock_irqsave(ap->lock, irq_flags);
 
-	ata_scsi_dump_cdb(ap, cmd);
-
 	dev = ata_scsi_find_dev(ap, scsidev);
 	if (likely(dev))
 		rc = __ata_scsi_queuecmd(cmd, dev);
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 58304dc401ac..e0cbabaad9e7 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -877,8 +877,6 @@ static void atapi_pio_bytes(struct ata_queued_cmd *qc)
 	if (unlikely(!bytes))
 		goto atapi_check;
 
-	VPRINTK("ata%u: xfering %d bytes\n", ap->print_id, bytes);
-
 	if (unlikely(__atapi_pio_bytes(qc, bytes)))
 		goto err_out;
 	ata_sff_sync(ap); /* flush */
@@ -1462,9 +1460,6 @@ static unsigned int __ata_sff_port_intr(struct ata_port *ap,
 {
 	u8 status;
 
-	VPRINTK("ata%u: protocol %d task_state %d\n",
-		ap->print_id, qc->tf.protocol, ap->hsm_task_state);
-
 	/* Check whether we are expecting interrupt in this state */
 	switch (ap->hsm_task_state) {
 	case HSM_ST_FIRST:
@@ -2587,7 +2582,6 @@ static void ata_bmdma_fill_sg(struct ata_queued_cmd *qc)
 
 			prd[pi].addr = cpu_to_le32(addr);
 			prd[pi].flags_len = cpu_to_le32(len & 0xffff);
-			VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", pi, addr, len);
 
 			pi++;
 			sg_len -= len;
@@ -2647,7 +2641,6 @@ static void ata_bmdma_fill_sg_dumb(struct ata_queued_cmd *qc)
 				prd[++pi].addr = cpu_to_le32(addr + 0x8000);
 			}
 			prd[pi].flags_len = cpu_to_le32(blen);
-			VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", pi, addr, len);
 
 			pi++;
 			sg_len -= len;
@@ -2784,7 +2777,7 @@ unsigned int ata_bmdma_port_intr(struct ata_port *ap, struct ata_queued_cmd *qc)
 	if (ap->hsm_task_state == HSM_ST_LAST && ata_is_dma(qc->tf.protocol)) {
 		/* check status of DMA engine */
 		host_stat = ap->ops->bmdma_status(ap);
-		VPRINTK("ata%u: host_stat 0x%X\n", ap->print_id, host_stat);
+		ata_port_dbg(ap, "host_stat 0x%X\n", host_stat);
 
 		/* if it's not our irq... */
 		if (!(host_stat & ATA_DMA_INTR))
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
index 68cdd81d747c..6661ba622858 100644
--- a/drivers/ata/libata.h
+++ b/drivers/ata/libata.h
@@ -148,7 +148,6 @@ extern int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel,
 			      unsigned int id, u64 lun);
 void ata_scsi_sdev_config(struct scsi_device *sdev);
 int ata_scsi_dev_config(struct scsi_device *sdev, struct ata_device *dev);
-void ata_scsi_dump_cdb(struct ata_port *ap, struct scsi_cmnd *cmd);
 int __ata_scsi_queuecmd(struct scsi_cmnd *scmd, struct ata_device *dev);
 
 /* libata-eh.c */
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 31/73] ahci: Drop pointless VPRINTK() calls and convert the remaining ones
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (29 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 30/73] libata: remove pointless VPRINTK() calls Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 32/73] pdc_adma: " Hannes Reinecke
                   ` (42 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Drop pointless VPRINTK() calls for entering and existing interrupt
routines and convert the remaining calls to dev_dbg().

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/ahci.c       |  4 +---
 drivers/ata/ahci_xgene.c |  4 ----
 drivers/ata/libahci.c    | 18 ++++--------------
 3 files changed, 5 insertions(+), 21 deletions(-)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 6a867ef64c9c..e9fd09152a6b 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -683,7 +683,7 @@ static void ahci_pci_init_controller(struct ata_host *host)
 
 		/* clear port IRQ */
 		tmp = readl(port_mmio + PORT_IRQ_STAT);
-		VPRINTK("PORT_IRQ_STAT 0x%x\n", tmp);
+		dev_dbg(&pdev->dev, "PORT_IRQ_STAT 0x%x\n", tmp);
 		if (tmp)
 			writel(tmp, port_mmio + PORT_IRQ_STAT);
 	}
@@ -1468,7 +1468,6 @@ static irqreturn_t ahci_thunderx_irq_handler(int irq, void *dev_instance)
 	u32 irq_stat, irq_masked;
 	unsigned int handled = 1;
 
-	VPRINTK("ENTER\n");
 	hpriv = host->private_data;
 	mmio = hpriv->mmio;
 	irq_stat = readl(mmio + HOST_IRQ_STAT);
@@ -1485,7 +1484,6 @@ static irqreturn_t ahci_thunderx_irq_handler(int irq, void *dev_instance)
 		irq_stat = readl(mmio + HOST_IRQ_STAT);
 		spin_unlock(&host->lock);
 	} while (irq_stat);
-	VPRINTK("EXIT\n");
 
 	return IRQ_RETVAL(handled);
 }
diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c
index dffc432b9d54..4d8a186ec12a 100644
--- a/drivers/ata/ahci_xgene.c
+++ b/drivers/ata/ahci_xgene.c
@@ -588,8 +588,6 @@ static irqreturn_t xgene_ahci_irq_intr(int irq, void *dev_instance)
 	void __iomem *mmio;
 	u32 irq_stat, irq_masked;
 
-	VPRINTK("ENTER\n");
-
 	hpriv = host->private_data;
 	mmio = hpriv->mmio;
 
@@ -612,8 +610,6 @@ static irqreturn_t xgene_ahci_irq_intr(int irq, void *dev_instance)
 
 	spin_unlock(&host->lock);
 
-	VPRINTK("EXIT\n");
-
 	return IRQ_RETVAL(rc);
 }
 
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index ee7e63da0437..4deb5e9295c0 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -1234,12 +1234,12 @@ static void ahci_port_init(struct device *dev, struct ata_port *ap,
 
 	/* clear SError */
 	tmp = readl(port_mmio + PORT_SCR_ERR);
-	VPRINTK("PORT_SCR_ERR 0x%x\n", tmp);
+	dev_dbg(dev, "PORT_SCR_ERR 0x%x\n", tmp);
 	writel(tmp, port_mmio + PORT_SCR_ERR);
 
 	/* clear port IRQ */
 	tmp = readl(port_mmio + PORT_IRQ_STAT);
-	VPRINTK("PORT_IRQ_STAT 0x%x\n", tmp);
+	dev_dbg(dev, "PORT_IRQ_STAT 0x%x\n", tmp);
 	if (tmp)
 		writel(tmp, port_mmio + PORT_IRQ_STAT);
 
@@ -1270,10 +1270,10 @@ void ahci_init_controller(struct ata_host *host)
 	}
 
 	tmp = readl(mmio + HOST_CTL);
-	VPRINTK("HOST_CTL 0x%x\n", tmp);
+	dev_dbg(host->dev, "HOST_CTL 0x%x\n", tmp);
 	writel(tmp | HOST_IRQ_EN, mmio + HOST_CTL);
 	tmp = readl(mmio + HOST_CTL);
-	VPRINTK("HOST_CTL 0x%x\n", tmp);
+	dev_dbg(host->dev, "HOST_CTL 0x%x\n", tmp);
 }
 EXPORT_SYMBOL_GPL(ahci_init_controller);
 
@@ -1911,8 +1911,6 @@ static irqreturn_t ahci_multi_irqs_intr_hard(int irq, void *dev_instance)
 	void __iomem *port_mmio = ahci_port_base(ap);
 	u32 status;
 
-	VPRINTK("ENTER\n");
-
 	status = readl(port_mmio + PORT_IRQ_STAT);
 	writel(status, port_mmio + PORT_IRQ_STAT);
 
@@ -1920,8 +1918,6 @@ static irqreturn_t ahci_multi_irqs_intr_hard(int irq, void *dev_instance)
 	ahci_handle_port_interrupt(ap, port_mmio, status);
 	spin_unlock(ap->lock);
 
-	VPRINTK("EXIT\n");
-
 	return IRQ_HANDLED;
 }
 
@@ -1938,9 +1934,7 @@ u32 ahci_handle_port_intr(struct ata_host *host, u32 irq_masked)
 		ap = host->ports[i];
 		if (ap) {
 			ahci_port_intr(ap);
-			VPRINTK("port %u\n", i);
 		} else {
-			VPRINTK("port %u (no irq)\n", i);
 			if (ata_ratelimit())
 				dev_warn(host->dev,
 					 "interrupt on disabled port %u\n", i);
@@ -1961,8 +1955,6 @@ static irqreturn_t ahci_single_level_irq_intr(int irq, void *dev_instance)
 	void __iomem *mmio;
 	u32 irq_stat, irq_masked;
 
-	VPRINTK("ENTER\n");
-
 	hpriv = host->private_data;
 	mmio = hpriv->mmio;
 
@@ -1990,8 +1982,6 @@ static irqreturn_t ahci_single_level_irq_intr(int irq, void *dev_instance)
 
 	spin_unlock(&host->lock);
 
-	VPRINTK("EXIT\n");
-
 	return IRQ_RETVAL(rc);
 }
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 32/73] pdc_adma: Drop pointless VPRINTK() calls and convert the remaining ones
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (30 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 31/73] ahci: Drop pointless VPRINTK() calls and convert the remaining ones Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-09  1:01   ` Damien Le Moal
  2021-12-08 16:32 ` [PATCH 33/73] pata_octeon_cf: " Hannes Reinecke
                   ` (41 subsequent siblings)
  73 siblings, 1 reply; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Drop pointless VPRINTK() calls for entering and existing interrupt
routines and convert the remaining calls to dev_dbg().

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/pdc_adma.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/drivers/ata/pdc_adma.c b/drivers/ata/pdc_adma.c
index 2c910c4cd4de..5d6f460b2356 100644
--- a/drivers/ata/pdc_adma.c
+++ b/drivers/ata/pdc_adma.c
@@ -284,9 +284,6 @@ static int adma_fill_sg(struct ata_queued_cmd *qc)
 		*(__le32 *)(buf + i) =
 			(pFLAGS & pEND) ? 0 : cpu_to_le32(pp->pkt_dma + i + 4);
 		i += 4;
-
-		VPRINTK("PRD[%u] = (0x%lX, 0x%X)\n", i/4,
-					(unsigned long)addr, len);
 	}
 
 	if (likely(last_buf))
@@ -302,8 +299,6 @@ static enum ata_completion_errors adma_qc_prep(struct ata_queued_cmd *qc)
 	u32 pkt_dma = (u32)pp->pkt_dma;
 	int i = 0;
 
-	VPRINTK("ENTER\n");
-
 	adma_enter_reg_mode(qc->ap);
 	if (qc->tf.protocol != ATA_PROT_DMA)
 		return AC_ERR_OK;
@@ -379,8 +374,6 @@ static inline void adma_packet_start(struct ata_queued_cmd *qc)
 	struct ata_port *ap = qc->ap;
 	void __iomem *chan = ADMA_PORT_REGS(ap);
 
-	VPRINTK("ENTER, ap %p\n", ap);
-
 	/* fire up the ADMA engine */
 	writew(aPIOMD4 | aGO, chan + ADMA_CONTROL);
 }
@@ -502,14 +495,10 @@ static irqreturn_t adma_intr(int irq, void *dev_instance)
 	struct ata_host *host = dev_instance;
 	unsigned int handled = 0;
 
-	VPRINTK("ENTER\n");
-
 	spin_lock(&host->lock);
 	handled  = adma_intr_pkt(host) | adma_intr_mmio(host);
 	spin_unlock(&host->lock);
 
-	VPRINTK("EXIT\n");
-
 	return IRQ_RETVAL(handled);
 }
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 33/73] pata_octeon_cf: Drop pointless VPRINTK() calls and convert the remaining ones
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (31 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 32/73] pdc_adma: " Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-09  8:39   ` Sergey Shtylyov
  2021-12-08 16:32 ` [PATCH 34/73] pata_via: Drop pointless VPRINTK() calls Hannes Reinecke
                   ` (40 subsequent siblings)
  73 siblings, 1 reply; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Drop pointless VPRINTK() calls for entering and existing interrupt
routines and convert the remaining calls to dev_dbg().

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/pata_octeon_cf.c | 23 ++---------------------
 1 file changed, 2 insertions(+), 21 deletions(-)

diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
index 7b80bbd9b1ed..de27428920a0 100644
--- a/drivers/ata/pata_octeon_cf.c
+++ b/drivers/ata/pata_octeon_cf.c
@@ -477,23 +477,11 @@ static void octeon_cf_tf_load16(struct ata_port *ap,
 		__raw_writew(tf->hob_feature << 8, base + 0xc);
 		__raw_writew(tf->hob_nsect | tf->hob_lbal << 8, base + 2);
 		__raw_writew(tf->hob_lbam | tf->hob_lbah << 8, base + 4);
-		VPRINTK("hob: feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n",
-			tf->hob_feature,
-			tf->hob_nsect,
-			tf->hob_lbal,
-			tf->hob_lbam,
-			tf->hob_lbah);
 	}
 	if (is_addr) {
 		__raw_writew(tf->feature << 8, base + 0xc);
 		__raw_writew(tf->nsect | tf->lbal << 8, base + 2);
 		__raw_writew(tf->lbam | tf->lbah << 8, base + 4);
-		VPRINTK("feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n",
-			tf->feature,
-			tf->nsect,
-			tf->lbal,
-			tf->lbam,
-			tf->lbah);
 	}
 	ata_wait_idle(ap);
 }
@@ -553,8 +541,6 @@ static void octeon_cf_dma_start(struct ata_queued_cmd *qc)
 	union cvmx_mio_boot_dma_intx mio_boot_dma_int;
 	struct scatterlist *sg;
 
-	VPRINTK("%d scatterlists\n", qc->n_elem);
-
 	/* Get the scatter list entry we need to DMA into */
 	sg = qc->cursg;
 	BUG_ON(!sg);
@@ -595,10 +581,6 @@ static void octeon_cf_dma_start(struct ata_queued_cmd *qc)
 
 	mio_boot_dma_cfg.s.adr = sg_dma_address(sg);
 
-	VPRINTK("%s %d bytes address=%p\n",
-		(mio_boot_dma_cfg.s.rw) ? "write" : "read", sg->length,
-		(void *)(unsigned long)mio_boot_dma_cfg.s.adr);
-
 	cvmx_write_csr(cf_port->dma_base + DMA_CFG, mio_boot_dma_cfg.u64);
 }
 
@@ -617,9 +599,8 @@ static unsigned int octeon_cf_dma_finished(struct ata_port *ap,
 	union cvmx_mio_boot_dma_intx dma_int;
 	u8 status;
 
-	VPRINTK("ata%u: protocol %d task_state %d\n",
-		ap->print_id, qc->tf.protocol, ap->hsm_task_state);
-
+	ata_port_dbg(ap, "protocol %d task_state %d\n",
+		     qc->tf.protocol, ap->hsm_task_state);
 
 	if (ap->hsm_task_state != HSM_ST_LAST)
 		return 0;
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 34/73] pata_via: Drop pointless VPRINTK() calls
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (32 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 33/73] pata_octeon_cf: " Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 35/73] sata_promise: Drop pointless VPRINTK() calls and convert the remaining ones Hannes Reinecke
                   ` (39 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/pata_via.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c
index 475032048984..439ca882f73c 100644
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -414,12 +414,6 @@ static void via_tf_load(struct ata_port *ap, const struct ata_taskfile *tf)
 		iowrite8(tf->hob_lbal, ioaddr->lbal_addr);
 		iowrite8(tf->hob_lbam, ioaddr->lbam_addr);
 		iowrite8(tf->hob_lbah, ioaddr->lbah_addr);
-		VPRINTK("hob: feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n",
-			tf->hob_feature,
-			tf->hob_nsect,
-			tf->hob_lbal,
-			tf->hob_lbam,
-			tf->hob_lbah);
 	}
 
 	if (is_addr) {
@@ -428,12 +422,6 @@ static void via_tf_load(struct ata_port *ap, const struct ata_taskfile *tf)
 		iowrite8(tf->lbal, ioaddr->lbal_addr);
 		iowrite8(tf->lbam, ioaddr->lbam_addr);
 		iowrite8(tf->lbah, ioaddr->lbah_addr);
-		VPRINTK("feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n",
-			tf->feature,
-			tf->nsect,
-			tf->lbal,
-			tf->lbam,
-			tf->lbah);
 	}
 
 	ata_wait_idle(ap);
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 35/73] sata_promise: Drop pointless VPRINTK() calls and convert the remaining ones
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (33 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 34/73] pata_via: Drop pointless VPRINTK() calls Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-09  6:13   ` Mikael Pettersson
  2021-12-08 16:32 ` [PATCH 36/73] sata_qstor: Drop pointless VPRINTK() calls Hannes Reinecke
                   ` (38 subsequent siblings)
  73 siblings, 1 reply; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Drop pointless VPRINTK() calls for entering and existing interrupt
routines and convert the remaining calls to dev_dbg().

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/sata_promise.c | 31 ++++++++-----------------------
 1 file changed, 8 insertions(+), 23 deletions(-)

diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
index 7815da8ef9e5..1059beae8720 100644
--- a/drivers/ata/sata_promise.c
+++ b/drivers/ata/sata_promise.c
@@ -596,7 +596,8 @@ static void pdc_fill_sg(struct ata_queued_cmd *qc)
 
 			prd[idx].addr = cpu_to_le32(addr);
 			prd[idx].flags_len = cpu_to_le32(len & 0xffff);
-			VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx, addr, len);
+			ata_port_dbg(ap, "PRD[%u] = (9x%X, 0x%X)\n",
+				     idx, addr, len);
 
 			idx++;
 			sg_len -= len;
@@ -609,17 +610,16 @@ static void pdc_fill_sg(struct ata_queued_cmd *qc)
 	if (len > SG_COUNT_ASIC_BUG) {
 		u32 addr;
 
-		VPRINTK("Splitting last PRD.\n");
-
 		addr = le32_to_cpu(prd[idx - 1].addr);
 		prd[idx - 1].flags_len = cpu_to_le32(len - SG_COUNT_ASIC_BUG);
-		VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx - 1, addr, SG_COUNT_ASIC_BUG);
+		ata_port_dbg(ap, "PRD[%u] = (0x%X, 0x%X)\n",
+			     idx - 1, addr, SG_COUNT_ASIC_BUG);
 
 		addr = addr + len - SG_COUNT_ASIC_BUG;
 		len = SG_COUNT_ASIC_BUG;
 		prd[idx].addr = cpu_to_le32(addr);
 		prd[idx].flags_len = cpu_to_le32(len);
-		VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx, addr, len);
+		ata_port_dbg(ap, "PRD[%u] = (0x%X, 0x%X)\n", idx, addr, len);
 
 		idx++;
 	}
@@ -632,8 +632,6 @@ static enum ata_completion_errors pdc_qc_prep(struct ata_queued_cmd *qc)
 	struct pdc_port_priv *pp = qc->ap->private_data;
 	unsigned int i;
 
-	VPRINTK("ENTER\n");
-
 	switch (qc->tf.protocol) {
 	case ATA_PROT_DMA:
 		pdc_fill_sg(qc);
@@ -922,12 +920,8 @@ static irqreturn_t pdc_interrupt(int irq, void *dev_instance)
 	u32 hotplug_status;
 	int is_sataii_tx4;
 
-	VPRINTK("ENTER\n");
-
-	if (!host || !host->iomap[PDC_MMIO_BAR]) {
-		VPRINTK("QUICK EXIT\n");
+	if (!host || !host->iomap[PDC_MMIO_BAR])
 		return IRQ_NONE;
-	}
 
 	host_mmio = host->iomap[PDC_MMIO_BAR];
 
@@ -946,23 +940,18 @@ static irqreturn_t pdc_interrupt(int irq, void *dev_instance)
 	/* reading should also clear interrupts */
 	mask = readl(host_mmio + PDC_INT_SEQMASK);
 
-	if (mask == 0xffffffff && hotplug_status == 0) {
-		VPRINTK("QUICK EXIT 2\n");
+	if (mask == 0xffffffff && hotplug_status == 0)
 		goto done_irq;
-	}
 
 	mask &= 0xffff;		/* only 16 SEQIDs possible */
-	if (mask == 0 && hotplug_status == 0) {
-		VPRINTK("QUICK EXIT 3\n");
+	if (mask == 0 && hotplug_status == 0)
 		goto done_irq;
-	}
 
 	writel(mask, host_mmio + PDC_INT_SEQMASK);
 
 	is_sataii_tx4 = pdc_is_sataii_tx4(host->ports[0]->flags);
 
 	for (i = 0; i < host->n_ports; i++) {
-		VPRINTK("port %u\n", i);
 		ap = host->ports[i];
 
 		/* check for a plug or unplug event */
@@ -989,8 +978,6 @@ static irqreturn_t pdc_interrupt(int irq, void *dev_instance)
 		}
 	}
 
-	VPRINTK("EXIT\n");
-
 done_irq:
 	spin_unlock(&host->lock);
 	return IRQ_RETVAL(handled);
@@ -1005,8 +992,6 @@ static void pdc_packet_start(struct ata_queued_cmd *qc)
 	unsigned int port_no = ap->port_no;
 	u8 seq = (u8) (port_no + 1);
 
-	VPRINTK("ENTER, ap %p\n", ap);
-
 	writel(0x00000001, host_mmio + (seq * 4));
 	readl(host_mmio + (seq * 4));	/* flush */
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 36/73] sata_qstor: Drop pointless VPRINTK() calls
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (34 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 35/73] sata_promise: Drop pointless VPRINTK() calls and convert the remaining ones Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 37/73] sata_rcar: " Hannes Reinecke
                   ` (37 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/sata_qstor.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/drivers/ata/sata_qstor.c b/drivers/ata/sata_qstor.c
index 2b4ccdca71c6..db62c07f820f 100644
--- a/drivers/ata/sata_qstor.c
+++ b/drivers/ata/sata_qstor.c
@@ -252,9 +252,6 @@ static unsigned int qs_fill_sg(struct ata_queued_cmd *qc)
 		len = sg_dma_len(sg);
 		*(__le32 *)prd = cpu_to_le32(len);
 		prd += sizeof(u64);
-
-		VPRINTK("PRD[%u] = (0x%llX, 0x%X)\n", si,
-					(unsigned long long)addr, len);
 	}
 
 	return si;
@@ -268,8 +265,6 @@ static enum ata_completion_errors qs_qc_prep(struct ata_queued_cmd *qc)
 	u64 addr;
 	unsigned int nelem;
 
-	VPRINTK("ENTER\n");
-
 	qs_enter_reg_mode(qc->ap);
 	if (qc->tf.protocol != ATA_PROT_DMA)
 		return AC_ERR_OK;
@@ -304,8 +299,6 @@ static inline void qs_packet_start(struct ata_queued_cmd *qc)
 	struct ata_port *ap = qc->ap;
 	u8 __iomem *chan = qs_mmio_base(ap->host) + (ap->port_no * 0x4000);
 
-	VPRINTK("ENTER, ap %p\n", ap);
-
 	writeb(QS_CTR0_CLER, chan + QS_CCT_CTR0);
 	wmb();                             /* flush PRDs and pkt to memory */
 	writel(QS_CCF_RUN_PKT, chan + QS_CCT_CFF);
@@ -435,14 +428,10 @@ static irqreturn_t qs_intr(int irq, void *dev_instance)
 	unsigned int handled = 0;
 	unsigned long flags;
 
-	VPRINTK("ENTER\n");
-
 	spin_lock_irqsave(&host->lock, flags);
 	handled  = qs_intr_pkt(host) | qs_intr_mmio(host);
 	spin_unlock_irqrestore(&host->lock, flags);
 
-	VPRINTK("EXIT\n");
-
 	return IRQ_RETVAL(handled);
 }
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 37/73] sata_rcar: Drop pointless VPRINTK() calls
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (35 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 36/73] sata_qstor: Drop pointless VPRINTK() calls Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 38/73] sata_inic162x: " Hannes Reinecke
                   ` (36 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/sata_rcar.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
index 11e68e3854f8..91b39a6aa9f7 100644
--- a/drivers/ata/sata_rcar.c
+++ b/drivers/ata/sata_rcar.c
@@ -379,12 +379,6 @@ static void sata_rcar_tf_load(struct ata_port *ap,
 		iowrite32(tf->hob_lbal, ioaddr->lbal_addr);
 		iowrite32(tf->hob_lbam, ioaddr->lbam_addr);
 		iowrite32(tf->hob_lbah, ioaddr->lbah_addr);
-		VPRINTK("hob: feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n",
-			tf->hob_feature,
-			tf->hob_nsect,
-			tf->hob_lbal,
-			tf->hob_lbam,
-			tf->hob_lbah);
 	}
 
 	if (is_addr) {
@@ -393,18 +387,10 @@ static void sata_rcar_tf_load(struct ata_port *ap,
 		iowrite32(tf->lbal, ioaddr->lbal_addr);
 		iowrite32(tf->lbam, ioaddr->lbam_addr);
 		iowrite32(tf->lbah, ioaddr->lbah_addr);
-		VPRINTK("feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n",
-			tf->feature,
-			tf->nsect,
-			tf->lbal,
-			tf->lbam,
-			tf->lbah);
 	}
 
-	if (tf->flags & ATA_TFLAG_DEVICE) {
+	if (tf->flags & ATA_TFLAG_DEVICE)
 		iowrite32(tf->device, ioaddr->device_addr);
-		VPRINTK("device 0x%X\n", tf->device);
-	}
 
 	ata_wait_idle(ap);
 }
@@ -537,7 +523,6 @@ static void sata_rcar_bmdma_fill_sg(struct ata_queued_cmd *qc)
 
 		prd[si].addr = cpu_to_le32(addr);
 		prd[si].flags_len = cpu_to_le32(sg_len);
-		VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", si, addr, sg_len);
 	}
 
 	/* end-of-table flag */
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 38/73] sata_inic162x: Drop pointless VPRINTK() calls
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (36 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 37/73] sata_rcar: " Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 39/73] sata_mv: Drop pointless VPRINTK() call and convert the remaining one Hannes Reinecke
                   ` (35 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/sata_inic162x.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c
index b6239dae524a..781901151d82 100644
--- a/drivers/ata/sata_inic162x.c
+++ b/drivers/ata/sata_inic162x.c
@@ -488,8 +488,6 @@ static enum ata_completion_errors inic_qc_prep(struct ata_queued_cmd *qc)
 	bool is_data = ata_is_data(qc->tf.protocol);
 	unsigned int cdb_len = 0;
 
-	VPRINTK("ENTER\n");
-
 	if (is_atapi)
 		cdb_len = qc->dev->cdb_len;
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 39/73] sata_mv: Drop pointless VPRINTK() call and convert the remaining one
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (37 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 38/73] sata_inic162x: " Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 40/73] sata_nv: drop pointless VPRINTK() calls and convert remaining ones Hannes Reinecke
                   ` (34 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Drop pointless VPRINTK() call and convert the remaining one to dev_dbg().

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/sata_mv.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index e86eddf83704..4f3fa54c8f64 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -3723,11 +3723,6 @@ static void mv_port_init(struct ata_ioports *port,  void __iomem *port_mmio)
 
 	/* unmask all non-transient EDMA error interrupts */
 	writelfl(~EDMA_ERR_IRQ_TRANSIENT, port_mmio + EDMA_ERR_IRQ_MASK);
-
-	VPRINTK("EDMA cfg=0x%08x EDMA IRQ err cause/mask=0x%08x/0x%08x\n",
-		readl(port_mmio + EDMA_CFG),
-		readl(port_mmio + EDMA_ERR_IRQ_CAUSE),
-		readl(port_mmio + EDMA_ERR_IRQ_MASK));
 }
 
 static unsigned int mv_in_pcix_mode(struct ata_host *host)
@@ -3972,7 +3967,7 @@ static int mv_init_host(struct ata_host *host)
 	for (hc = 0; hc < n_hc; hc++) {
 		void __iomem *hc_mmio = mv_hc_base(mmio, hc);
 
-		VPRINTK("HC%i: HC config=0x%08x HC IRQ cause "
+		dev_dbg(host->dev, "HC%i: HC config=0x%08x HC IRQ cause "
 			"(before clear)=0x%08x\n", hc,
 			readl(hc_mmio + HC_CFG),
 			readl(hc_mmio + HC_IRQ_CAUSE));
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 40/73] sata_nv: drop pointless VPRINTK() calls and convert remaining ones
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (38 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 39/73] sata_mv: Drop pointless VPRINTK() call and convert the remaining one Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 41/73] sata_fsl: convert VPRINTK() calls to ata_port_dbg() Hannes Reinecke
                   ` (33 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Quite some information from the VPRINTK() is already covered by
tracepoints, so remove the pointless calls and convert the remaining
ones to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/sata_nv.c | 38 ++++++++++++++------------------------
 1 file changed, 14 insertions(+), 24 deletions(-)

diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index 995c6f19e78f..a9ef8ab378ee 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -809,7 +809,7 @@ static int nv_adma_check_cpb(struct ata_port *ap, int cpb_num, int force_err)
 	struct nv_adma_port_priv *pp = ap->private_data;
 	u8 flags = pp->cpb[cpb_num].resp_flags;
 
-	VPRINTK("CPB %d, flags=0x%x\n", cpb_num, flags);
+	ata_port_dbg(ap, "CPB %d, flags=0x%x\n", cpb_num, flags);
 
 	if (unlikely((force_err ||
 		     flags & (NV_CPB_RESP_ATA_ERR |
@@ -1101,8 +1101,6 @@ static int nv_adma_port_start(struct ata_port *ap)
 	struct pci_dev *pdev = to_pci_dev(dev);
 	u16 tmp;
 
-	VPRINTK("ENTER\n");
-
 	/*
 	 * Ensure DMA mask is set to 32-bit before allocating legacy PRD and
 	 * pad buffers.
@@ -1191,7 +1189,6 @@ static void nv_adma_port_stop(struct ata_port *ap)
 	struct nv_adma_port_priv *pp = ap->private_data;
 	void __iomem *mmio = pp->ctl_block;
 
-	VPRINTK("ENTER\n");
 	writew(0, mmio + NV_ADMA_CTL);
 }
 
@@ -1253,8 +1250,6 @@ static void nv_adma_setup_port(struct ata_port *ap)
 	void __iomem *mmio = ap->host->iomap[NV_MMIO_BAR];
 	struct ata_ioports *ioport = &ap->ioaddr;
 
-	VPRINTK("ENTER\n");
-
 	mmio += NV_ADMA_PORT + ap->port_no * NV_ADMA_PORT_SIZE;
 
 	ioport->cmd_addr	= mmio;
@@ -1375,8 +1370,6 @@ static enum ata_completion_errors nv_adma_qc_prep(struct ata_queued_cmd *qc)
 	if (qc->tf.protocol == ATA_PROT_NCQ)
 		ctl_flags |= NV_CPB_CTL_QUEUE | NV_CPB_CTL_FPDMA;
 
-	VPRINTK("qc->flags = 0x%lx\n", qc->flags);
-
 	nv_adma_tf_to_cpb(&qc->tf, cpb->tf);
 
 	if (qc->flags & ATA_QCFLAG_DMAMAP) {
@@ -1401,8 +1394,6 @@ static unsigned int nv_adma_qc_issue(struct ata_queued_cmd *qc)
 	void __iomem *mmio = pp->ctl_block;
 	int curr_ncq = (qc->tf.protocol == ATA_PROT_NCQ);
 
-	VPRINTK("ENTER\n");
-
 	/* We can't handle result taskfile with NCQ commands, since
 	   retrieving the taskfile switches us out of ADMA mode and would abort
 	   existing commands. */
@@ -1414,7 +1405,6 @@ static unsigned int nv_adma_qc_issue(struct ata_queued_cmd *qc)
 
 	if (nv_adma_use_reg_mode(qc)) {
 		/* use ATA register mode */
-		VPRINTK("using ATA register mode: 0x%lx\n", qc->flags);
 		BUG_ON(!(pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) &&
 			(qc->flags & ATA_QCFLAG_DMAMAP));
 		nv_adma_register_mode(qc->ap);
@@ -1866,12 +1856,12 @@ static void nv_swncq_host_init(struct ata_host *host)
 
 	/* enable swncq */
 	tmp = readl(mmio + NV_CTL_MCP55);
-	VPRINTK("HOST_CTL:0x%X\n", tmp);
+	dev_dbg(&pdev->dev, "HOST_CTL:0x%X\n", tmp);
 	writel(tmp | NV_CTL_PRI_SWNCQ | NV_CTL_SEC_SWNCQ, mmio + NV_CTL_MCP55);
 
 	/* enable irq intr */
 	tmp = readl(mmio + NV_INT_ENABLE_MCP55);
-	VPRINTK("HOST_ENABLE:0x%X\n", tmp);
+	dev_dbg(&pdev->dev, "HOST_ENABLE:0x%X\n", tmp);
 	writel(tmp | 0x00fd00fd, mmio + NV_INT_ENABLE_MCP55);
 
 	/*  clear port irq */
@@ -2100,7 +2090,7 @@ static int nv_swncq_sdbfis(struct ata_port *ap)
 	ata_qc_complete_multiple(ap, ata_qc_get_active(ap) ^ done_mask);
 
 	if (!ap->qc_active) {
-		DPRINTK("over\n");
+		ata_port_dbg(ap, "over\n");
 		nv_swncq_pp_reinit(ap);
 		return 0;
 	}
@@ -2115,12 +2105,12 @@ static int nv_swncq_sdbfis(struct ata_port *ap)
 		 */
 		lack_dhfis = 1;
 
-	DPRINTK("id 0x%x QC: qc_active 0x%llx,"
-		"SWNCQ:qc_active 0x%X defer_bits %X "
-		"dhfis 0x%X dmafis 0x%X last_issue_tag %x\n",
-		ap->print_id, ap->qc_active, pp->qc_active,
-		pp->defer_queue.defer_bits, pp->dhfis_bits,
-		pp->dmafis_bits, pp->last_issue_tag);
+	ata_port_dbg(ap, "QC: qc_active 0x%llx,"
+		     "SWNCQ:qc_active 0x%X defer_bits %X "
+		     "dhfis 0x%X dmafis 0x%X last_issue_tag %x\n",
+		     ap->qc_active, pp->qc_active,
+		     pp->defer_queue.defer_bits, pp->dhfis_bits,
+		     pp->dmafis_bits, pp->last_issue_tag);
 
 	nv_swncq_fis_reinit(ap);
 
@@ -2160,7 +2150,7 @@ static void nv_swncq_dmafis(struct ata_port *ap)
 	__ata_bmdma_stop(ap);
 	tag = nv_swncq_tag(ap);
 
-	DPRINTK("dma setup tag 0x%x\n", tag);
+	ata_port_dbg(ap, "dma setup tag 0x%x\n", tag);
 	qc = ata_qc_from_tag(ap, tag);
 
 	if (unlikely(!qc))
@@ -2228,9 +2218,9 @@ static void nv_swncq_host_interrupt(struct ata_port *ap, u16 fis)
 
 	if (fis & NV_SWNCQ_IRQ_SDBFIS) {
 		pp->ncq_flags |= ncq_saw_sdb;
-		DPRINTK("id 0x%x SWNCQ: qc_active 0x%X "
+		ata_port_dbg(ap, "SWNCQ: qc_active 0x%X "
 			"dhfis 0x%X dmafis 0x%X sactive 0x%X\n",
-			ap->print_id, pp->qc_active, pp->dhfis_bits,
+			pp->qc_active, pp->dhfis_bits,
 			pp->dmafis_bits, readl(pp->sactive_block));
 		if (nv_swncq_sdbfis(ap) < 0)
 			goto irq_error;
@@ -2256,7 +2246,7 @@ static void nv_swncq_host_interrupt(struct ata_port *ap, u16 fis)
 				goto irq_exit;
 
 			if (pp->defer_queue.defer_bits) {
-				DPRINTK("send next command\n");
+				ata_port_dbg(ap, "send next command\n");
 				qc = nv_swncq_qc_from_dq(ap);
 				nv_swncq_issue_atacmd(ap, qc);
 			}
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 41/73] sata_fsl: convert VPRINTK() calls to ata_port_dbg()
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (39 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 40/73] sata_nv: drop pointless VPRINTK() calls and convert remaining ones Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 42/73] sata_sil: Drop pointless VPRINTK() calls Hannes Reinecke
                   ` (32 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/sata_fsl.c | 74 +++++++++++++++++-------------------------
 1 file changed, 29 insertions(+), 45 deletions(-)

diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index 9a371dd593a7..548b44baecc8 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -404,7 +404,8 @@ static inline unsigned int sata_fsl_tag(struct ata_port *ap,
 	return tag;
 }
 
-static void sata_fsl_setup_cmd_hdr_entry(struct sata_fsl_port_priv *pp,
+static void sata_fsl_setup_cmd_hdr_entry(struct ata_port *ap,
+					 struct sata_fsl_port_priv *pp,
 					 unsigned int tag, u32 desc_info,
 					 u32 data_xfer_len, u8 num_prde,
 					 u8 fis_len)
@@ -422,7 +423,7 @@ static void sata_fsl_setup_cmd_hdr_entry(struct sata_fsl_port_priv *pp,
 	pp->cmdslot[tag].ttl = cpu_to_le32(data_xfer_len & ~0x03);
 	pp->cmdslot[tag].desc_info = cpu_to_le32(desc_info | (tag & 0x1F));
 
-	VPRINTK("cda=0x%x, prde_fis_len=0x%x, ttl=0x%x, di=0x%x\n",
+	ata_port_dbg(ap, "cda=0x%x, prde_fis_len=0x%x, ttl=0x%x, di=0x%x\n",
 		pp->cmdslot[tag].cda,
 		pp->cmdslot[tag].prde_fis_len,
 		pp->cmdslot[tag].ttl, pp->cmdslot[tag].desc_info);
@@ -448,8 +449,6 @@ static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc,
 	dma_addr_t indirect_ext_segment_paddr;
 	unsigned int si;
 
-	VPRINTK("SATA FSL : cd = 0x%p, prd = 0x%p\n", cmd_desc, prd);
-
 	indirect_ext_segment_paddr = cmd_desc_paddr +
 	    SATA_FSL_CMD_DESC_OFFSET_TO_PRDT + SATA_FSL_MAX_PRD_DIRECT * 16;
 
@@ -457,9 +456,6 @@ static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc,
 		dma_addr_t sg_addr = sg_dma_address(sg);
 		u32 sg_len = sg_dma_len(sg);
 
-		VPRINTK("SATA FSL : fill_sg, sg_addr = 0x%llx, sg_len = %d\n",
-			(unsigned long long)sg_addr, sg_len);
-
 		/* warn if each s/g element is not dword aligned */
 		if (unlikely(sg_addr & 0x03))
 			ata_port_err(qc->ap, "s/g addr unaligned : 0x%llx\n",
@@ -470,7 +466,6 @@ static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc,
 
 		if (num_prde == (SATA_FSL_MAX_PRD_DIRECT - 1) &&
 		    sg_next(sg) != NULL) {
-			VPRINTK("setting indirect prde\n");
 			prd_ptr_to_indirect_ext = prd;
 			prd->dba = cpu_to_le32(indirect_ext_segment_paddr);
 			indirect_ext_segment_sz = 0;
@@ -482,9 +477,6 @@ static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc,
 		prd->dba = cpu_to_le32(sg_addr);
 		prd->ddc_and_ext = cpu_to_le32(data_snoop | (sg_len & ~0x03));
 
-		VPRINTK("sg_fill, ttl=%d, dba=0x%x, ddc=0x%x\n",
-			ttl_dwords, prd->dba, prd->ddc_and_ext);
-
 		++num_prde;
 		++prd;
 		if (prd_ptr_to_indirect_ext)
@@ -521,14 +513,6 @@ static enum ata_completion_errors sata_fsl_qc_prep(struct ata_queued_cmd *qc)
 
 	ata_tf_to_fis(&qc->tf, qc->dev->link->pmp, 1, (u8 *) &cd->cfis);
 
-	VPRINTK("Dumping cfis : 0x%x, 0x%x, 0x%x\n",
-		cd->cfis[0], cd->cfis[1], cd->cfis[2]);
-
-	if (qc->tf.protocol == ATA_PROT_NCQ) {
-		VPRINTK("FPDMA xfer,Sctor cnt[0:7],[8:15] = %d,%d\n",
-			cd->cfis[3], cd->cfis[11]);
-	}
-
 	/* setup "ACMD - atapi command" in cmd. desc. if this is ATAPI cmd */
 	if (ata_is_atapi(qc->tf.protocol)) {
 		desc_info |= ATAPI_CMD;
@@ -544,10 +528,10 @@ static enum ata_completion_errors sata_fsl_qc_prep(struct ata_queued_cmd *qc)
 	if (qc->tf.protocol == ATA_PROT_NCQ)
 		desc_info |= FPDMA_QUEUED_CMD;
 
-	sata_fsl_setup_cmd_hdr_entry(pp, tag, desc_info, ttl_dwords,
+	sata_fsl_setup_cmd_hdr_entry(ap, pp, tag, desc_info, ttl_dwords,
 				     num_prde, 5);
 
-	VPRINTK("SATA FSL : xx_qc_prep, di = 0x%x, ttl = %d, num_prde = %d\n",
+	ata_port_dbg(ap, "SATA FSL : di = 0x%x, ttl = %d, num_prde = %d\n",
 		desc_info, ttl_dwords, num_prde);
 
 	return AC_ERR_OK;
@@ -560,7 +544,7 @@ static unsigned int sata_fsl_qc_issue(struct ata_queued_cmd *qc)
 	void __iomem *hcr_base = host_priv->hcr_base;
 	unsigned int tag = sata_fsl_tag(ap, qc->hw_tag, hcr_base);
 
-	VPRINTK("xx_qc_issue called,CQ=0x%x,CA=0x%x,CE=0x%x,CC=0x%x\n",
+	ata_port_dbg(ap, "CQ=0x%x,CA=0x%x,CE=0x%x,CC=0x%x\n",
 		ioread32(CQ + hcr_base),
 		ioread32(CA + hcr_base),
 		ioread32(CE + hcr_base), ioread32(CC + hcr_base));
@@ -570,10 +554,10 @@ static unsigned int sata_fsl_qc_issue(struct ata_queued_cmd *qc)
 	/* Simply queue command to the controller/device */
 	iowrite32(1 << tag, CQ + hcr_base);
 
-	VPRINTK("xx_qc_issue called, tag=%d, CQ=0x%x, CA=0x%x\n",
+	ata_port_dbg(ap, "tag=%d, CQ=0x%x, CA=0x%x\n",
 		tag, ioread32(CQ + hcr_base), ioread32(CA + hcr_base));
 
-	VPRINTK("CE=0x%x, DE=0x%x, CC=0x%x, CmdStat = 0x%x\n",
+	ata_port_dbg(ap, "CE=0x%x, DE=0x%x, CC=0x%x, CmdStat = 0x%x\n",
 		ioread32(CE + hcr_base),
 		ioread32(DE + hcr_base),
 		ioread32(CC + hcr_base),
@@ -614,7 +598,7 @@ static int sata_fsl_scr_write(struct ata_link *link,
 		return -EINVAL;
 	}
 
-	VPRINTK("xx_scr_write, reg_in = %d\n", sc_reg);
+	ata_link_dbg(link, "reg_in = %d\n", sc_reg);
 
 	iowrite32(val, ssr_base + (sc_reg * 4));
 	return 0;
@@ -638,7 +622,7 @@ static int sata_fsl_scr_read(struct ata_link *link,
 		return -EINVAL;
 	}
 
-	VPRINTK("xx_scr_read, reg_in = %d\n", sc_reg);
+	ata_link_dbg(link, "reg_in = %d\n", sc_reg);
 
 	*val = ioread32(ssr_base + (sc_reg * 4));
 	return 0;
@@ -650,18 +634,18 @@ static void sata_fsl_freeze(struct ata_port *ap)
 	void __iomem *hcr_base = host_priv->hcr_base;
 	u32 temp;
 
-	VPRINTK("xx_freeze, CQ=0x%x, CA=0x%x, CE=0x%x, DE=0x%x\n",
+	ata_port_dbg(ap, "CQ=0x%x, CA=0x%x, CE=0x%x, DE=0x%x\n",
 		ioread32(CQ + hcr_base),
 		ioread32(CA + hcr_base),
 		ioread32(CE + hcr_base), ioread32(DE + hcr_base));
-	VPRINTK("CmdStat = 0x%x\n",
+	ata_port_dbg(ap, "CmdStat = 0x%x\n",
 		ioread32(host_priv->csr_base + COMMANDSTAT));
 
 	/* disable interrupts on the controller/port */
 	temp = ioread32(hcr_base + HCONTROL);
 	iowrite32((temp & ~0x3F), hcr_base + HCONTROL);
 
-	VPRINTK("in xx_freeze : HControl = 0x%x, HStatus = 0x%x\n",
+	ata_port_dbg(ap, "HControl = 0x%x, HStatus = 0x%x\n",
 		ioread32(hcr_base + HCONTROL), ioread32(hcr_base + HSTATUS));
 }
 
@@ -674,7 +658,7 @@ static void sata_fsl_thaw(struct ata_port *ap)
 	/* ack. any pending IRQs for this controller/port */
 	temp = ioread32(hcr_base + HSTATUS);
 
-	VPRINTK("xx_thaw, pending IRQs = 0x%x\n", (temp & 0x3F));
+	ata_port_dbg(ap, "pending IRQs = 0x%x\n", (temp & 0x3F));
 
 	if (temp & 0x3F)
 		iowrite32((temp & 0x3F), hcr_base + HSTATUS);
@@ -683,7 +667,7 @@ static void sata_fsl_thaw(struct ata_port *ap)
 	temp = ioread32(hcr_base + HCONTROL);
 	iowrite32((temp | DEFAULT_PORT_IRQ_ENABLE_MASK), hcr_base + HCONTROL);
 
-	VPRINTK("xx_thaw : HControl = 0x%x, HStatus = 0x%x\n",
+	ata_port_dbg(ap, "HControl = 0x%x, HStatus = 0x%x\n",
 		ioread32(hcr_base + HCONTROL), ioread32(hcr_base + HSTATUS));
 }
 
@@ -745,7 +729,7 @@ static int sata_fsl_port_start(struct ata_port *ap)
 
 	ap->private_data = pp;
 
-	VPRINTK("CHBA = 0x%x, cmdentry_phys = 0x%x\n",
+	ata_port_dbg(ap, "CHBA = 0x%x, cmdentry_phys = 0x%x\n",
 		pp->cmdslot_paddr, pp->cmdentry_paddr);
 
 	/* Now, update the CHBA register in host controller cmd register set */
@@ -762,9 +746,9 @@ static int sata_fsl_port_start(struct ata_port *ap)
 	temp = ioread32(hcr_base + HCONTROL);
 	iowrite32((temp | HCONTROL_ONLINE_PHY_RST), hcr_base + HCONTROL);
 
-	VPRINTK("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS));
-	VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
-	VPRINTK("CHBA  = 0x%x\n", ioread32(hcr_base + CHBA));
+	ata_port_dbg(ap, "HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS));
+	ata_port_dbg(ap, "HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
+	ata_port_dbg(ap, "CHBA  = 0x%x\n", ioread32(hcr_base + CHBA));
 
 	return 0;
 }
@@ -804,9 +788,8 @@ static unsigned int sata_fsl_dev_classify(struct ata_port *ap)
 
 	temp = ioread32(hcr_base + SIGNATURE);
 
-	VPRINTK("raw sig = 0x%x\n", temp);
-	VPRINTK("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS));
-	VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
+	ata_port_dbg(ap, "HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS));
+	ata_port_dbg(ap, "HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
 
 	tf.lbah = (temp >> 24) & 0xff;
 	tf.lbam = (temp >> 16) & 0xff;
@@ -959,7 +942,7 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
 	cfis = (u8 *) &pp->cmdentry->cfis;
 
 	/* device reset/SRST is a control register update FIS, uses tag0 */
-	sata_fsl_setup_cmd_hdr_entry(pp, 0,
+	sata_fsl_setup_cmd_hdr_entry(ap, pp, 0,
 		SRST_CMD | CMD_DESC_RES | CMD_DESC_SNOOP_ENABLE, 0, 0, 5);
 
 	tf.ctl |= ATA_SRST;	/* setup SRST bit in taskfile control reg */
@@ -1009,8 +992,9 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
 	 * using ATA signature D2H register FIS to the host controller.
 	 */
 
-	sata_fsl_setup_cmd_hdr_entry(pp, 0, CMD_DESC_RES | CMD_DESC_SNOOP_ENABLE,
-				      0, 0, 5);
+	sata_fsl_setup_cmd_hdr_entry(ap, pp, 0,
+				     CMD_DESC_RES | CMD_DESC_SNOOP_ENABLE,
+				     0, 0, 5);
 
 	tf.ctl &= ~ATA_SRST;	/* 2nd H2D Ctl. register FIS */
 	ata_tf_to_fis(&tf, pmp, 0, cfis);
@@ -1040,8 +1024,8 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
 
 		*class = sata_fsl_dev_classify(ap);
 
-		VPRINTK("ccreg = 0x%x\n", ioread32(hcr_base + CC));
-		VPRINTK("cereg = 0x%x\n", ioread32(hcr_base + CE));
+		ata_port_dbg(ap, "ccreg = 0x%x\n", ioread32(hcr_base + CC));
+		ata_port_dbg(ap, "cereg = 0x%x\n", ioread32(hcr_base + CE));
 	}
 
 	return 0;
@@ -1246,8 +1230,8 @@ static void sata_fsl_host_intr(struct ata_port *ap)
 		return;
 	}
 
-	VPRINTK("Status of all queues :\n");
-	VPRINTK("done_mask/CC = 0x%x, CA = 0x%x, CE=0x%x,CQ=0x%x,apqa=0x%llx\n",
+	ata_port_dbg(ap, "Status of all queues :\n");
+	ata_port_dbg(ap, "done_mask/CC = 0x%x, CA = 0x%x, CE=0x%x,CQ=0x%x,apqa=0x%llx\n",
 		done_mask,
 		ioread32(hcr_base + CA),
 		ioread32(hcr_base + CE),
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 42/73] sata_sil: Drop pointless VPRINTK() calls
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (40 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 41/73] sata_fsl: convert VPRINTK() calls to ata_port_dbg() Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 43/73] sata_sx4: Drop pointless VPRINTK() calls and convert the remaining ones Hannes Reinecke
                   ` (31 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/sata_sil.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
index 75321f1ceba5..3b989a52879d 100644
--- a/drivers/ata/sata_sil.c
+++ b/drivers/ata/sata_sil.c
@@ -307,7 +307,6 @@ static void sil_fill_sg(struct ata_queued_cmd *qc)
 
 		prd->addr = cpu_to_le32(addr);
 		prd->flags_len = cpu_to_le32(sg_len);
-		VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", si, addr, sg_len);
 
 		last_prd = prd;
 		prd++;
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 43/73] sata_sx4: Drop pointless VPRINTK() calls and convert the remaining ones
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (41 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 42/73] sata_sil: Drop pointless VPRINTK() calls Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 44/73] sata_sx4: add module parameter 'dimm_test' Hannes Reinecke
                   ` (30 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Drop pointless VPRINTK() calls for setting up SG tables
and convert the remaining calls to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/sata_sx4.c | 105 +++++++++++++----------------------------
 1 file changed, 34 insertions(+), 71 deletions(-)

diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c
index 4c01190a5e37..85e72c81a1de 100644
--- a/drivers/ata/sata_sx4.c
+++ b/drivers/ata/sata_sx4.c
@@ -308,15 +308,9 @@ static inline void pdc20621_ata_sg(u8 *buf, unsigned int portno,
 	/* output ATA packet S/G table */
 	addr = PDC_20621_DIMM_BASE + PDC_20621_DIMM_DATA +
 	       (PDC_DIMM_DATA_STEP * portno);
-	VPRINTK("ATA sg addr 0x%x, %d\n", addr, addr);
+
 	buf32[dw] = cpu_to_le32(addr);
 	buf32[dw + 1] = cpu_to_le32(total_len | ATA_PRD_EOT);
-
-	VPRINTK("ATA PSG @ %x == (0x%x, 0x%x)\n",
-		PDC_20621_DIMM_BASE +
-		       (PDC_DIMM_WINDOW_STEP * portno) +
-		       PDC_DIMM_APKT_PRD,
-		buf32[dw], buf32[dw + 1]);
 }
 
 static inline void pdc20621_host_sg(u8 *buf, unsigned int portno,
@@ -332,12 +326,6 @@ static inline void pdc20621_host_sg(u8 *buf, unsigned int portno,
 
 	buf32[dw] = cpu_to_le32(addr);
 	buf32[dw + 1] = cpu_to_le32(total_len | ATA_PRD_EOT);
-
-	VPRINTK("HOST PSG @ %x == (0x%x, 0x%x)\n",
-		PDC_20621_DIMM_BASE +
-		       (PDC_DIMM_WINDOW_STEP * portno) +
-		       PDC_DIMM_HPKT_PRD,
-		buf32[dw], buf32[dw + 1]);
 }
 
 static inline unsigned int pdc20621_ata_pkt(struct ata_taskfile *tf,
@@ -351,7 +339,6 @@ static inline unsigned int pdc20621_ata_pkt(struct ata_taskfile *tf,
 	unsigned int dimm_sg = PDC_20621_DIMM_BASE +
 			       (PDC_DIMM_WINDOW_STEP * portno) +
 			       PDC_DIMM_APKT_PRD;
-	VPRINTK("ENTER, dimm_sg == 0x%x, %d\n", dimm_sg, dimm_sg);
 
 	i = PDC_DIMM_ATA_PKT;
 
@@ -406,8 +393,6 @@ static inline void pdc20621_host_pkt(struct ata_taskfile *tf, u8 *buf,
 	unsigned int dimm_sg = PDC_20621_DIMM_BASE +
 			       (PDC_DIMM_WINDOW_STEP * portno) +
 			       PDC_DIMM_HPKT_PRD;
-	VPRINTK("ENTER, dimm_sg == 0x%x, %d\n", dimm_sg, dimm_sg);
-	VPRINTK("host_sg == 0x%x, %d\n", host_sg, host_sg);
 
 	dw = PDC_DIMM_HOST_PKT >> 2;
 
@@ -424,14 +409,6 @@ static inline void pdc20621_host_pkt(struct ata_taskfile *tf, u8 *buf,
 	buf32[dw + 1] = cpu_to_le32(host_sg);
 	buf32[dw + 2] = cpu_to_le32(dimm_sg);
 	buf32[dw + 3] = 0;
-
-	VPRINTK("HOST PKT @ %x == (0x%x 0x%x 0x%x 0x%x)\n",
-		PDC_20621_DIMM_BASE + (PDC_DIMM_WINDOW_STEP * portno) +
-			PDC_DIMM_HOST_PKT,
-		buf32[dw + 0],
-		buf32[dw + 1],
-		buf32[dw + 2],
-		buf32[dw + 3]);
 }
 
 static void pdc20621_dma_prep(struct ata_queued_cmd *qc)
@@ -447,8 +424,6 @@ static void pdc20621_dma_prep(struct ata_queued_cmd *qc)
 
 	WARN_ON(!(qc->flags & ATA_QCFLAG_DMAMAP));
 
-	VPRINTK("ata%u: ENTER\n", ap->print_id);
-
 	/* hard-code chip #0 */
 	mmio += PDC_CHIP0_OFS;
 
@@ -492,7 +467,8 @@ static void pdc20621_dma_prep(struct ata_queued_cmd *qc)
 
 	readl(dimm_mmio);	/* MMIO PCI posting flush */
 
-	VPRINTK("ata pkt buf ofs %u, prd size %u, mmio copied\n", i, sgt_len);
+	ata_port_dbg(ap, "ata pkt buf ofs %u, prd size %u, mmio copied\n",
+		     i, sgt_len);
 }
 
 static void pdc20621_nodata_prep(struct ata_queued_cmd *qc)
@@ -504,8 +480,6 @@ static void pdc20621_nodata_prep(struct ata_queued_cmd *qc)
 	unsigned int portno = ap->port_no;
 	unsigned int i;
 
-	VPRINTK("ata%u: ENTER\n", ap->print_id);
-
 	/* hard-code chip #0 */
 	mmio += PDC_CHIP0_OFS;
 
@@ -527,7 +501,7 @@ static void pdc20621_nodata_prep(struct ata_queued_cmd *qc)
 
 	readl(dimm_mmio);	/* MMIO PCI posting flush */
 
-	VPRINTK("ata pkt buf ofs %u, mmio copied\n", i);
+	ata_port_dbg(ap, "ata pkt buf ofs %u, mmio copied\n", i);
 }
 
 static enum ata_completion_errors pdc20621_qc_prep(struct ata_queued_cmd *qc)
@@ -633,8 +607,6 @@ static void pdc20621_packet_start(struct ata_queued_cmd *qc)
 	/* hard-code chip #0 */
 	mmio += PDC_CHIP0_OFS;
 
-	VPRINTK("ata%u: ENTER\n", ap->print_id);
-
 	wmb();			/* flush PRD, pkt writes */
 
 	port_ofs = PDC_20621_DIMM_BASE + (PDC_DIMM_WINDOW_STEP * port_no);
@@ -645,7 +617,7 @@ static void pdc20621_packet_start(struct ata_queued_cmd *qc)
 
 		pdc20621_dump_hdma(qc);
 		pdc20621_push_hdma(qc, seq, port_ofs + PDC_DIMM_HOST_PKT);
-		VPRINTK("queued ofs 0x%x (%u), seq %u\n",
+		ata_port_dbg(ap, "queued ofs 0x%x (%u), seq %u\n",
 			port_ofs + PDC_DIMM_HOST_PKT,
 			port_ofs + PDC_DIMM_HOST_PKT,
 			seq);
@@ -656,7 +628,7 @@ static void pdc20621_packet_start(struct ata_queued_cmd *qc)
 		writel(port_ofs + PDC_DIMM_ATA_PKT,
 		       ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT);
 		readl(ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT);
-		VPRINTK("submitted ofs 0x%x (%u), seq %u\n",
+		ata_port_dbg(ap, "submitted ofs 0x%x (%u), seq %u\n",
 			port_ofs + PDC_DIMM_ATA_PKT,
 			port_ofs + PDC_DIMM_ATA_PKT,
 			seq);
@@ -696,14 +668,12 @@ static inline unsigned int pdc20621_host_intr(struct ata_port *ap,
 	u8 status;
 	unsigned int handled = 0;
 
-	VPRINTK("ENTER\n");
-
 	if ((qc->tf.protocol == ATA_PROT_DMA) &&	/* read */
 	    (!(qc->tf.flags & ATA_TFLAG_WRITE))) {
 
 		/* step two - DMA from DIMM to host */
 		if (doing_hdma) {
-			VPRINTK("ata%u: read hdma, 0x%x 0x%x\n", ap->print_id,
+			ata_port_dbg(ap, "read hdma, 0x%x 0x%x\n",
 				readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT));
 			/* get drive status; clear intr; complete txn */
 			qc->err_mask |= ac_err_mask(ata_wait_idle(ap));
@@ -714,7 +684,7 @@ static inline unsigned int pdc20621_host_intr(struct ata_port *ap,
 		/* step one - exec ATA command */
 		else {
 			u8 seq = (u8) (port_no + 1 + 4);
-			VPRINTK("ata%u: read ata, 0x%x 0x%x\n", ap->print_id,
+			ata_port_dbg(ap, "read ata, 0x%x 0x%x\n",
 				readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT));
 
 			/* submit hdma pkt */
@@ -729,7 +699,7 @@ static inline unsigned int pdc20621_host_intr(struct ata_port *ap,
 		/* step one - DMA from host to DIMM */
 		if (doing_hdma) {
 			u8 seq = (u8) (port_no + 1);
-			VPRINTK("ata%u: write hdma, 0x%x 0x%x\n", ap->print_id,
+			ata_port_dbg(ap, "write hdma, 0x%x 0x%x\n",
 				readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT));
 
 			/* submit ata pkt */
@@ -742,7 +712,7 @@ static inline unsigned int pdc20621_host_intr(struct ata_port *ap,
 
 		/* step two - execute ATA command */
 		else {
-			VPRINTK("ata%u: write ata, 0x%x 0x%x\n", ap->print_id,
+			ata_port_dbg(ap, "write ata, 0x%x 0x%x\n",
 				readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT));
 			/* get drive status; clear intr; complete txn */
 			qc->err_mask |= ac_err_mask(ata_wait_idle(ap));
@@ -755,7 +725,7 @@ static inline unsigned int pdc20621_host_intr(struct ata_port *ap,
 	} else if (qc->tf.protocol == ATA_PROT_NODATA) {
 
 		status = ata_sff_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
-		DPRINTK("BUS_NODATA (drv_stat 0x%X)\n", status);
+		ata_port_dbg(ap, "BUS_NODATA (drv_stat 0x%X)\n", status);
 		qc->err_mask |= ac_err_mask(status);
 		ata_qc_complete(qc);
 		handled = 1;
@@ -781,29 +751,21 @@ static irqreturn_t pdc20621_interrupt(int irq, void *dev_instance)
 	unsigned int handled = 0;
 	void __iomem *mmio_base;
 
-	VPRINTK("ENTER\n");
-
-	if (!host || !host->iomap[PDC_MMIO_BAR]) {
-		VPRINTK("QUICK EXIT\n");
+	if (!host || !host->iomap[PDC_MMIO_BAR])
 		return IRQ_NONE;
-	}
 
 	mmio_base = host->iomap[PDC_MMIO_BAR];
 
 	/* reading should also clear interrupts */
 	mmio_base += PDC_CHIP0_OFS;
 	mask = readl(mmio_base + PDC_20621_SEQMASK);
-	VPRINTK("mask == 0x%x\n", mask);
 
-	if (mask == 0xffffffff) {
-		VPRINTK("QUICK EXIT 2\n");
+	if (mask == 0xffffffff)
 		return IRQ_NONE;
-	}
+
 	mask &= 0xffff;		/* only 16 tags possible */
-	if (!mask) {
-		VPRINTK("QUICK EXIT 3\n");
+	if (!mask)
 		return IRQ_NONE;
-	}
 
 	spin_lock(&host->lock);
 
@@ -816,7 +778,8 @@ static irqreturn_t pdc20621_interrupt(int irq, void *dev_instance)
 		else
 			ap = host->ports[port_no];
 		tmp = mask & (1 << i);
-		VPRINTK("seq %u, port_no %u, ap %p, tmp %x\n", i, port_no, ap, tmp);
+		if (ap)
+			ata_port_dbg(ap, "seq %u, tmp %x\n", i, tmp);
 		if (tmp && ap) {
 			struct ata_queued_cmd *qc;
 
@@ -829,10 +792,6 @@ static irqreturn_t pdc20621_interrupt(int irq, void *dev_instance)
 
 	spin_unlock(&host->lock);
 
-	VPRINTK("mask == 0x%x\n", mask);
-
-	VPRINTK("EXIT\n");
-
 	return IRQ_RETVAL(handled);
 }
 
@@ -1274,7 +1233,7 @@ static unsigned int pdc20621_dimm_init(struct ata_host *host)
 	/* Initialize Time Period Register */
 	writel(0xffffffff, mmio + PDC_TIME_PERIOD);
 	time_period = readl(mmio + PDC_TIME_PERIOD);
-	VPRINTK("Time Period Register (0x40): 0x%x\n", time_period);
+	dev_dbg(host->dev, "Time Period Register (0x40): 0x%x\n", time_period);
 
 	/* Enable timer */
 	writel(PDC_TIMER_DEFAULT, mmio + PDC_TIME_CONTROL);
@@ -1289,7 +1248,7 @@ static unsigned int pdc20621_dimm_init(struct ata_host *host)
 	*/
 
 	tcount = readl(mmio + PDC_TIME_COUNTER);
-	VPRINTK("Time Counter Register (0x44): 0x%x\n", tcount);
+	dev_dbg(host->dev, "Time Counter Register (0x44): 0x%x\n", tcount);
 
 	/*
 	   If SX4 is on PCI-X bus, after 3 seconds, the timer counter
@@ -1297,17 +1256,19 @@ static unsigned int pdc20621_dimm_init(struct ata_host *host)
 	*/
 	if (tcount >= PCI_X_TCOUNT) {
 		ticks = (time_period - tcount);
-		VPRINTK("Num counters 0x%x (%d)\n", ticks, ticks);
+		dev_dbg(host->dev, "Num counters 0x%x (%d)\n", ticks, ticks);
 
 		clock = (ticks / 300000);
-		VPRINTK("10 * Internal clk = 0x%x (%d)\n", clock, clock);
+		dev_dbg(host->dev, "10 * Internal clk = 0x%x (%d)\n",
+			clock, clock);
 
 		clock = (clock * 33);
-		VPRINTK("10 * Internal clk * 33 = 0x%x (%d)\n", clock, clock);
+		dev_dbg(host->dev, "10 * Internal clk * 33 = 0x%x (%d)\n",
+			clock, clock);
 
 		/* PLL F Param (bit 22:16) */
 		fparam = (1400000 / clock) - 2;
-		VPRINTK("PLL F Param: 0x%x (%d)\n", fparam, fparam);
+		dev_dbg(host->dev, "PLL F Param: 0x%x (%d)\n", fparam, fparam);
 
 		/* OD param = 0x2 (bit 31:30), R param = 0x5 (bit 29:25) */
 		pci_status = (0x8a001824 | (fparam << 16));
@@ -1315,7 +1276,7 @@ static unsigned int pdc20621_dimm_init(struct ata_host *host)
 		pci_status = PCI_PLL_INIT;
 
 	/* Initialize PLL. */
-	VPRINTK("pci_status: 0x%x\n", pci_status);
+	dev_dbg(host->dev, "pci_status: 0x%x\n", pci_status);
 	writel(pci_status, mmio + PDC_CTL_STATUS);
 	readl(mmio + PDC_CTL_STATUS);
 
@@ -1327,15 +1288,16 @@ static unsigned int pdc20621_dimm_init(struct ata_host *host)
 		printk(KERN_ERR "Detect Local DIMM Fail\n");
 		return 1;	/* DIMM error */
 	}
-	VPRINTK("Local DIMM Speed = %d\n", speed);
+	dev_dbg(host->dev, "Local DIMM Speed = %d\n", speed);
 
 	/* Programming DIMM0 Module Control Register (index_CID0:80h) */
 	size = pdc20621_prog_dimm0(host);
-	VPRINTK("Local DIMM Size = %dMB\n", size);
+	dev_dbg(host->dev, "Local DIMM Size = %dMB\n", size);
 
 	/* Programming DIMM Module Global Control Register (index_CID0:88h) */
 	if (pdc20621_prog_dimm_global(host)) {
-		printk(KERN_ERR "Programming DIMM Module Global Control Register Fail\n");
+		dev_err(host->dev,
+			"Programming DIMM Module Global Control Register Fail\n");
 		return 1;
 	}
 
@@ -1372,13 +1334,14 @@ static unsigned int pdc20621_dimm_init(struct ata_host *host)
 
 	if (!pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS,
 			       PDC_DIMM_SPD_TYPE, &spd0)) {
-		pr_err("Failed in i2c read: device=%#x, subaddr=%#x\n",
+		dev_err(host->dev,
+			"Failed in i2c read: device=%#x, subaddr=%#x\n",
 		       PDC_DIMM0_SPD_DEV_ADDRESS, PDC_DIMM_SPD_TYPE);
 		return 1;
 	}
 	if (spd0 == 0x02) {
 		void *buf;
-		VPRINTK("Start ECC initialization\n");
+		dev_dbg(host->dev, "Start ECC initialization\n");
 		addr = 0;
 		length = size * 1024 * 1024;
 		buf = kzalloc(ECC_ERASE_BUF_SZ, GFP_KERNEL);
@@ -1390,7 +1353,7 @@ static unsigned int pdc20621_dimm_init(struct ata_host *host)
 			addr += ECC_ERASE_BUF_SZ;
 		}
 		kfree(buf);
-		VPRINTK("Finish ECC initialization\n");
+		dev_dbg(host->dev, "Finish ECC initialization\n");
 	}
 	return 0;
 }
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 44/73] sata_sx4: add module parameter 'dimm_test'
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (42 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 43/73] sata_sx4: Drop pointless VPRINTK() calls and convert the remaining ones Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 45/73] libata: drop ata_msg_error() and ata_msg_intr() Hannes Reinecke
                   ` (29 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Add module parameter 'dimm_test' to enable DIMM testing during startup.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/sata_sx4.c | 34 ++++++++++++++--------------------
 1 file changed, 14 insertions(+), 20 deletions(-)

diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c
index 85e72c81a1de..5d7913644dfc 100644
--- a/drivers/ata/sata_sx4.c
+++ b/drivers/ata/sata_sx4.c
@@ -78,6 +78,9 @@
 #define DRV_NAME	"sata_sx4"
 #define DRV_VERSION	"0.12"
 
+static int dimm_test;
+module_param(dimm_test, int, 0644);
+MODULE_PARM_DESC(dimm_test, "Enable DIMM test during startup (1 = enabled)");
 
 enum {
 	PDC_MMIO_BAR		= 3,
@@ -211,10 +214,8 @@ static unsigned int pdc20621_i2c_read(struct ata_host *host,
 				      u32 device, u32 subaddr, u32 *pdata);
 static int pdc20621_prog_dimm0(struct ata_host *host);
 static unsigned int pdc20621_prog_dimm_global(struct ata_host *host);
-#ifdef ATA_VERBOSE_DEBUG
 static void pdc20621_get_from_dimm(struct ata_host *host,
 				   void *psource, u32 offset, u32 size);
-#endif
 static void pdc20621_put_to_dimm(struct ata_host *host,
 				 void *psource, u32 offset, u32 size);
 static void pdc20621_irq_clear(struct ata_port *ap);
@@ -575,7 +576,6 @@ static void pdc20621_pop_hdma(struct ata_queued_cmd *qc)
 	pp->hdma_cons++;
 }
 
-#ifdef ATA_VERBOSE_DEBUG
 static void pdc20621_dump_hdma(struct ata_queued_cmd *qc)
 {
 	struct ata_port *ap = qc->ap;
@@ -585,14 +585,10 @@ static void pdc20621_dump_hdma(struct ata_queued_cmd *qc)
 	dimm_mmio += (port_no * PDC_DIMM_WINDOW_STEP);
 	dimm_mmio += PDC_DIMM_HOST_PKT;
 
-	printk(KERN_ERR "HDMA[0] == 0x%08X\n", readl(dimm_mmio));
-	printk(KERN_ERR "HDMA[1] == 0x%08X\n", readl(dimm_mmio + 4));
-	printk(KERN_ERR "HDMA[2] == 0x%08X\n", readl(dimm_mmio + 8));
-	printk(KERN_ERR "HDMA[3] == 0x%08X\n", readl(dimm_mmio + 12));
+	ata_port_dbg(ap, "HDMA 0x%08X 0x%08X 0x%08X 0x%08X\n",
+		     readl(dimm_mmio), readl(dimm_mmio + 4),
+		     readl(dimm_mmio + 8), readl(dimm_mmio + 12));
 }
-#else
-static inline void pdc20621_dump_hdma(struct ata_queued_cmd *qc) { }
-#endif /* ATA_VERBOSE_DEBUG */
 
 static void pdc20621_packet_start(struct ata_queued_cmd *qc)
 {
@@ -938,7 +934,6 @@ static void pdc_sata_setup_port(struct ata_ioports *port, void __iomem *base)
 }
 
 
-#ifdef ATA_VERBOSE_DEBUG
 static void pdc20621_get_from_dimm(struct ata_host *host, void *psource,
 				   u32 offset, u32 size)
 {
@@ -988,7 +983,6 @@ static void pdc20621_get_from_dimm(struct ata_host *host, void *psource,
 		memcpy_fromio(psource, dimm_mmio, size / 4);
 	}
 }
-#endif
 
 
 static void pdc20621_put_to_dimm(struct ata_host *host, void *psource,
@@ -1301,8 +1295,7 @@ static unsigned int pdc20621_dimm_init(struct ata_host *host)
 		return 1;
 	}
 
-#ifdef ATA_VERBOSE_DEBUG
-	{
+	if (dimm_test) {
 		u8 test_parttern1[40] =
 			{0x55,0xAA,'P','r','o','m','i','s','e',' ',
 			'N','o','t',' ','Y','e','t',' ',
@@ -1316,19 +1309,20 @@ static unsigned int pdc20621_dimm_init(struct ata_host *host)
 
 		pdc20621_put_to_dimm(host, test_parttern1, 0x10040, 40);
 		pdc20621_get_from_dimm(host, test_parttern2, 0x40, 40);
-		printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0],
+		dev_info(host->dev, "DIMM test pattern 1: %x, %x, %s\n", test_parttern2[0],
 		       test_parttern2[1], &(test_parttern2[2]));
 		pdc20621_get_from_dimm(host, test_parttern2, 0x10040,
 				       40);
-		printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0],
-		       test_parttern2[1], &(test_parttern2[2]));
+		dev_info(host->dev, "DIMM test pattern 2: %x, %x, %s\n",
+			 test_parttern2[0],
+			 test_parttern2[1], &(test_parttern2[2]));
 
 		pdc20621_put_to_dimm(host, test_parttern1, 0x40, 40);
 		pdc20621_get_from_dimm(host, test_parttern2, 0x40, 40);
-		printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0],
-		       test_parttern2[1], &(test_parttern2[2]));
+		dev_info(host->dev, "DIMM test pattern 3: %x, %x, %s\n",
+			 test_parttern2[0],
+			 test_parttern2[1], &(test_parttern2[2]));
 	}
-#endif
 
 	/* ECC initiliazation. */
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 45/73] libata: drop ata_msg_error() and ata_msg_intr()
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (43 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 44/73] sata_sx4: add module parameter 'dimm_test' Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 46/73] libata: drop ata_msg_ctl() Hannes Reinecke
                   ` (28 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Unused.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/libata-core.c | 6 +++---
 include/linux/libata.h    | 4 ----
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 982ccd761bc3..ff7e82be0a94 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -5384,11 +5384,11 @@ struct ata_port *ata_port_alloc(struct ata_host *host)
 
 #if defined(ATA_VERBOSE_DEBUG)
 	/* turn on all debugging levels */
-	ap->msg_enable = 0x00FF;
+	ap->msg_enable = 0x003F;
 #elif defined(ATA_DEBUG)
-	ap->msg_enable = ATA_MSG_DRV | ATA_MSG_INFO | ATA_MSG_CTL | ATA_MSG_WARN | ATA_MSG_ERR;
+	ap->msg_enable = ATA_MSG_DRV | ATA_MSG_INFO | ATA_MSG_CTL | ATA_MSG_WARN;
 #else
-	ap->msg_enable = ATA_MSG_DRV | ATA_MSG_ERR | ATA_MSG_WARN;
+	ap->msg_enable = ATA_MSG_DRV | ATA_MSG_WARN;
 #endif
 
 	mutex_init(&ap->scsi_scan_mutex);
diff --git a/include/linux/libata.h b/include/linux/libata.h
index a807d2d43d70..a3f35735fd27 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -78,8 +78,6 @@ enum {
 	ATA_MSG_WARN	= 0x0008,
 	ATA_MSG_MALLOC	= 0x0010,
 	ATA_MSG_CTL	= 0x0020,
-	ATA_MSG_INTR	= 0x0040,
-	ATA_MSG_ERR	= 0x0080,
 };
 
 #define ata_msg_drv(p)    ((p)->msg_enable & ATA_MSG_DRV)
@@ -88,8 +86,6 @@ enum {
 #define ata_msg_warn(p)   ((p)->msg_enable & ATA_MSG_WARN)
 #define ata_msg_malloc(p) ((p)->msg_enable & ATA_MSG_MALLOC)
 #define ata_msg_ctl(p)    ((p)->msg_enable & ATA_MSG_CTL)
-#define ata_msg_intr(p)   ((p)->msg_enable & ATA_MSG_INTR)
-#define ata_msg_err(p)    ((p)->msg_enable & ATA_MSG_ERR)
 
 static inline u32 ata_msg_init(int dval, int default_msg_enable_bits)
 {
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 46/73] libata: drop ata_msg_ctl()
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (44 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 45/73] libata: drop ata_msg_error() and ata_msg_intr() Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 47/73] libata: drop ata_msg_malloc() Hannes Reinecke
                   ` (27 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

The one caller have been converted to dynamic debugging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/libata-core.c | 7 ++-----
 include/linux/libata.h    | 2 --
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index ff7e82be0a94..691dfa1f01c5 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1809,9 +1809,6 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
 	int may_fallback = 1, tried_spinup = 0;
 	int rc;
 
-	if (ata_msg_ctl(ap))
-		ata_dev_dbg(dev, "%s: ENTER\n", __func__);
-
 retry:
 	ata_tf_init(dev, &tf);
 
@@ -5384,9 +5381,9 @@ struct ata_port *ata_port_alloc(struct ata_host *host)
 
 #if defined(ATA_VERBOSE_DEBUG)
 	/* turn on all debugging levels */
-	ap->msg_enable = 0x003F;
+	ap->msg_enable = 0x001F;
 #elif defined(ATA_DEBUG)
-	ap->msg_enable = ATA_MSG_DRV | ATA_MSG_INFO | ATA_MSG_CTL | ATA_MSG_WARN;
+	ap->msg_enable = ATA_MSG_DRV | ATA_MSG_INFO | ATA_MSG_WARN;
 #else
 	ap->msg_enable = ATA_MSG_DRV | ATA_MSG_WARN;
 #endif
diff --git a/include/linux/libata.h b/include/linux/libata.h
index a3f35735fd27..fc7f64646e5b 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -77,7 +77,6 @@ enum {
 	ATA_MSG_PROBE	= 0x0004,
 	ATA_MSG_WARN	= 0x0008,
 	ATA_MSG_MALLOC	= 0x0010,
-	ATA_MSG_CTL	= 0x0020,
 };
 
 #define ata_msg_drv(p)    ((p)->msg_enable & ATA_MSG_DRV)
@@ -85,7 +84,6 @@ enum {
 #define ata_msg_probe(p)  ((p)->msg_enable & ATA_MSG_PROBE)
 #define ata_msg_warn(p)   ((p)->msg_enable & ATA_MSG_WARN)
 #define ata_msg_malloc(p) ((p)->msg_enable & ATA_MSG_MALLOC)
-#define ata_msg_ctl(p)    ((p)->msg_enable & ATA_MSG_CTL)
 
 static inline u32 ata_msg_init(int dval, int default_msg_enable_bits)
 {
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 47/73] libata: drop ata_msg_malloc()
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (45 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 46/73] libata: drop ata_msg_ctl() Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 48/73] libata: drop ata_msg_warn() Hannes Reinecke
                   ` (26 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Unused.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/libata-core.c | 2 +-
 include/linux/libata.h    | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 691dfa1f01c5..00d3bb8c87af 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -5381,7 +5381,7 @@ struct ata_port *ata_port_alloc(struct ata_host *host)
 
 #if defined(ATA_VERBOSE_DEBUG)
 	/* turn on all debugging levels */
-	ap->msg_enable = 0x001F;
+	ap->msg_enable = 0x000F;
 #elif defined(ATA_DEBUG)
 	ap->msg_enable = ATA_MSG_DRV | ATA_MSG_INFO | ATA_MSG_WARN;
 #else
diff --git a/include/linux/libata.h b/include/linux/libata.h
index fc7f64646e5b..8bde38e3debd 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -76,14 +76,12 @@ enum {
 	ATA_MSG_INFO	= 0x0002,
 	ATA_MSG_PROBE	= 0x0004,
 	ATA_MSG_WARN	= 0x0008,
-	ATA_MSG_MALLOC	= 0x0010,
 };
 
 #define ata_msg_drv(p)    ((p)->msg_enable & ATA_MSG_DRV)
 #define ata_msg_info(p)   ((p)->msg_enable & ATA_MSG_INFO)
 #define ata_msg_probe(p)  ((p)->msg_enable & ATA_MSG_PROBE)
 #define ata_msg_warn(p)   ((p)->msg_enable & ATA_MSG_WARN)
-#define ata_msg_malloc(p) ((p)->msg_enable & ATA_MSG_MALLOC)
 
 static inline u32 ata_msg_init(int dval, int default_msg_enable_bits)
 {
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 48/73] libata: drop ata_msg_warn()
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (46 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 47/73] libata: drop ata_msg_malloc() Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 49/73] libata: drop ata_msg_probe() Hannes Reinecke
                   ` (25 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

The WARN level was always enabled, so drop ata_msg_warn().

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/libata-core.c | 19 ++++++++-----------
 include/linux/libata.h    |  2 --
 2 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 00d3bb8c87af..363714fcb950 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1617,9 +1617,8 @@ unsigned ata_exec_internal_sg(struct ata_device *dev,
 			else
 				ata_qc_complete(qc);
 
-			if (ata_msg_warn(ap))
-				ata_dev_warn(dev, "qc timeout (cmd 0x%x)\n",
-					     command);
+			ata_dev_warn(dev, "qc timeout (cmd 0x%x)\n",
+				     command);
 		}
 
 		spin_unlock_irqrestore(ap->lock, flags);
@@ -1978,9 +1977,8 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
 	return 0;
 
  err_out:
-	if (ata_msg_warn(ap))
-		ata_dev_warn(dev, "failed to IDENTIFY (%s, err_mask=0x%x)\n",
-			     reason, err_mask);
+	ata_dev_warn(dev, "failed to IDENTIFY (%s, err_mask=0x%x)\n",
+		     reason, err_mask);
 	return rc;
 }
 
@@ -2724,8 +2722,7 @@ int ata_dev_configure(struct ata_device *dev)
 
 		rc = atapi_cdb_len(id);
 		if ((rc < 12) || (rc > ATAPI_CDB_LEN)) {
-			if (ata_msg_warn(ap))
-				ata_dev_warn(dev, "unsupported CDB len\n");
+			ata_dev_warn(dev, "unsupported CDB len %d\n", rc);
 			rc = -EINVAL;
 			goto err_out_nosup;
 		}
@@ -5381,11 +5378,11 @@ struct ata_port *ata_port_alloc(struct ata_host *host)
 
 #if defined(ATA_VERBOSE_DEBUG)
 	/* turn on all debugging levels */
-	ap->msg_enable = 0x000F;
+	ap->msg_enable = 0x0007;
 #elif defined(ATA_DEBUG)
-	ap->msg_enable = ATA_MSG_DRV | ATA_MSG_INFO | ATA_MSG_WARN;
+	ap->msg_enable = ATA_MSG_DRV | ATA_MSG_INFO;
 #else
-	ap->msg_enable = ATA_MSG_DRV | ATA_MSG_WARN;
+	ap->msg_enable = ATA_MSG_DRV;
 #endif
 
 	mutex_init(&ap->scsi_scan_mutex);
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 8bde38e3debd..5a4a23d38c08 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -75,13 +75,11 @@ enum {
 	ATA_MSG_DRV	= 0x0001,
 	ATA_MSG_INFO	= 0x0002,
 	ATA_MSG_PROBE	= 0x0004,
-	ATA_MSG_WARN	= 0x0008,
 };
 
 #define ata_msg_drv(p)    ((p)->msg_enable & ATA_MSG_DRV)
 #define ata_msg_info(p)   ((p)->msg_enable & ATA_MSG_INFO)
 #define ata_msg_probe(p)  ((p)->msg_enable & ATA_MSG_PROBE)
-#define ata_msg_warn(p)   ((p)->msg_enable & ATA_MSG_WARN)
 
 static inline u32 ata_msg_init(int dval, int default_msg_enable_bits)
 {
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 49/73] libata: drop ata_msg_probe()
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (47 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 48/73] libata: drop ata_msg_warn() Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 50/73] libata: drop ata_msg_info() Hannes Reinecke
                   ` (24 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

All callsites have been converted to dynamic debugging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/libata-acpi.c | 23 +++++++----------------
 drivers/ata/libata-core.c | 20 +++++++-------------
 drivers/ata/libata-sff.c  |  4 ----
 include/linux/libata.h    |  2 --
 4 files changed, 14 insertions(+), 35 deletions(-)

diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index 7007377880ce..bc2414da2731 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
@@ -402,7 +402,6 @@ EXPORT_SYMBOL_GPL(ata_acpi_stm);
  */
 static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf)
 {
-	struct ata_port *ap = dev->link->ap;
 	acpi_status status;
 	struct acpi_buffer output;
 	union acpi_object *out_obj;
@@ -418,10 +417,6 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf)
 	output.length = ACPI_ALLOCATE_BUFFER;
 	output.pointer = NULL;	/* ACPI-CA sets this; save/free it later */
 
-	if (ata_msg_probe(ap))
-		ata_dev_dbg(dev, "%s: ENTER: port#: %d\n",
-			    __func__, ap->port_no);
-
 	/* _GTF has no input parameters */
 	status = acpi_evaluate_object(ata_dev_acpi_handle(dev), "_GTF", NULL,
 				      &output);
@@ -437,11 +432,9 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf)
 	}
 
 	if (!output.length || !output.pointer) {
-		if (ata_msg_probe(ap))
-			ata_dev_dbg(dev, "%s: Run _GTF: length or ptr is NULL (0x%llx, 0x%p)\n",
-				    __func__,
-				    (unsigned long long)output.length,
-				    output.pointer);
+		ata_dev_dbg(dev, "Run _GTF: length or ptr is NULL (0x%llx, 0x%p)\n",
+			    (unsigned long long)output.length,
+			    output.pointer);
 		rc = -EINVAL;
 		goto out_free;
 	}
@@ -464,9 +457,8 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf)
 	rc = out_obj->buffer.length / REGS_PER_GTF;
 	if (gtf) {
 		*gtf = (void *)out_obj->buffer.pointer;
-		if (ata_msg_probe(ap))
-			ata_dev_dbg(dev, "%s: returning gtf=%p, gtf_count=%d\n",
-				    __func__, *gtf, rc);
+		ata_dev_dbg(dev, "returning gtf=%p, gtf_count=%d\n",
+			    *gtf, rc);
 	}
 	return rc;
 
@@ -780,9 +772,8 @@ static int ata_acpi_push_id(struct ata_device *dev)
 	struct acpi_object_list input;
 	union acpi_object in_params[1];
 
-	if (ata_msg_probe(ap))
-		ata_dev_dbg(dev, "%s: ix = %d, port#: %d\n",
-			    __func__, dev->devno, ap->port_no);
+	ata_dev_dbg(dev, "%s: ix = %d, port#: %d\n",
+		    __func__, dev->devno, ap->port_no);
 
 	/* Give the drive Identify data to the drive via the _SDD method */
 	/* _SDD: set up input parameters */
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 363714fcb950..501b08ee652a 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2576,9 +2576,6 @@ int ata_dev_configure(struct ata_device *dev)
 		return 0;
 	}
 
-	if (ata_msg_probe(ap))
-		ata_dev_dbg(dev, "%s: ENTER\n", __func__);
-
 	/* set horkage */
 	dev->horkage |= ata_dev_blacklisted(dev);
 	ata_force_horkage(dev);
@@ -2626,13 +2623,12 @@ int ata_dev_configure(struct ata_device *dev)
 		return rc;
 
 	/* print device capabilities */
-	if (ata_msg_probe(ap))
-		ata_dev_dbg(dev,
-			    "%s: cfg 49:%04x 82:%04x 83:%04x 84:%04x "
-			    "85:%04x 86:%04x 87:%04x 88:%04x\n",
-			    __func__,
-			    id[49], id[82], id[83], id[84],
-			    id[85], id[86], id[87], id[88]);
+	ata_dev_dbg(dev,
+		    "%s: cfg 49:%04x 82:%04x 83:%04x 84:%04x "
+		    "85:%04x 86:%04x 87:%04x 88:%04x\n",
+		    __func__,
+		    id[49], id[82], id[83], id[84],
+		    id[85], id[86], id[87], id[88]);
 
 	/* initialize to-be-configured parameters */
 	dev->flags &= ~ATA_DFLAG_CFG_MASK;
@@ -2832,8 +2828,6 @@ int ata_dev_configure(struct ata_device *dev)
 	return 0;
 
 err_out_nosup:
-	if (ata_msg_probe(ap))
-		ata_dev_dbg(dev, "%s: EXIT, err\n", __func__);
 	return rc;
 }
 
@@ -5378,7 +5372,7 @@ struct ata_port *ata_port_alloc(struct ata_host *host)
 
 #if defined(ATA_VERBOSE_DEBUG)
 	/* turn on all debugging levels */
-	ap->msg_enable = 0x0007;
+	ap->msg_enable = 0x0003;
 #elif defined(ATA_DEBUG)
 	ap->msg_enable = ATA_MSG_DRV | ATA_MSG_INFO;
 #else
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index e0cbabaad9e7..41ba992a4ef9 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -330,10 +330,6 @@ EXPORT_SYMBOL_GPL(ata_sff_dev_select);
 static void ata_dev_select(struct ata_port *ap, unsigned int device,
 			   unsigned int wait, unsigned int can_sleep)
 {
-	if (ata_msg_probe(ap))
-		ata_port_info(ap, "ata_dev_select: ENTER, device %u, wait %u\n",
-			      device, wait);
-
 	if (wait)
 		ata_wait_idle(ap);
 
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 5a4a23d38c08..bce3b50112c0 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -74,12 +74,10 @@
 enum {
 	ATA_MSG_DRV	= 0x0001,
 	ATA_MSG_INFO	= 0x0002,
-	ATA_MSG_PROBE	= 0x0004,
 };
 
 #define ata_msg_drv(p)    ((p)->msg_enable & ATA_MSG_DRV)
 #define ata_msg_info(p)   ((p)->msg_enable & ATA_MSG_INFO)
-#define ata_msg_probe(p)  ((p)->msg_enable & ATA_MSG_PROBE)
 
 static inline u32 ata_msg_init(int dval, int default_msg_enable_bits)
 {
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 50/73] libata: drop ata_msg_info()
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (48 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 49/73] libata: drop ata_msg_probe() Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 51/73] libata: drop ata_msg_drv() Hannes Reinecke
                   ` (23 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Convert the sole caller to ata_dev_deb() and remove the definition.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/libata-core.c | 10 +++-------
 include/linux/libata.h    |  2 --
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 501b08ee652a..c23e96163f95 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2571,8 +2571,8 @@ int ata_dev_configure(struct ata_device *dev)
 	char modelbuf[ATA_ID_PROD_LEN+1];
 	int rc;
 
-	if (!ata_dev_enabled(dev) && ata_msg_info(ap)) {
-		ata_dev_info(dev, "%s: ENTER/EXIT -- nodev\n", __func__);
+	if (!ata_dev_enabled(dev)) {
+		ata_dev_dbg(dev, "no device\n");
 		return 0;
 	}
 
@@ -5372,11 +5372,7 @@ struct ata_port *ata_port_alloc(struct ata_host *host)
 
 #if defined(ATA_VERBOSE_DEBUG)
 	/* turn on all debugging levels */
-	ap->msg_enable = 0x0003;
-#elif defined(ATA_DEBUG)
-	ap->msg_enable = ATA_MSG_DRV | ATA_MSG_INFO;
-#else
-	ap->msg_enable = ATA_MSG_DRV;
+	ap->msg_enable = 0x0001;
 #endif
 
 	mutex_init(&ap->scsi_scan_mutex);
diff --git a/include/linux/libata.h b/include/linux/libata.h
index bce3b50112c0..9895414492cb 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -73,11 +73,9 @@
 
 enum {
 	ATA_MSG_DRV	= 0x0001,
-	ATA_MSG_INFO	= 0x0002,
 };
 
 #define ata_msg_drv(p)    ((p)->msg_enable & ATA_MSG_DRV)
-#define ata_msg_info(p)   ((p)->msg_enable & ATA_MSG_INFO)
 
 static inline u32 ata_msg_init(int dval, int default_msg_enable_bits)
 {
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 51/73] libata: drop ata_msg_drv()
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (49 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 50/73] libata: drop ata_msg_info() Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 52/73] libata: remove 'new' ata message handling Hannes Reinecke
                   ` (22 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Callers are already protected by ata_dev_print_info(), so no need
to have an additional configuration parameter here.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/libata-core.c | 19 ++++++-------------
 drivers/ata/libata-eh.c   |  3 +--
 include/linux/libata.h    |  6 ------
 3 files changed, 7 insertions(+), 21 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index c23e96163f95..81f96e46f64e 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2396,7 +2396,6 @@ static void ata_dev_config_trusted(struct ata_device *dev)
 
 static int ata_dev_config_lba(struct ata_device *dev)
 {
-	struct ata_port *ap = dev->link->ap;
 	const u16 *id = dev->id;
 	const char *lba_desc;
 	char ncq_desc[24];
@@ -2418,7 +2417,7 @@ static int ata_dev_config_lba(struct ata_device *dev)
 	ret = ata_dev_config_ncq(dev, ncq_desc, sizeof(ncq_desc));
 
 	/* print device info to dmesg */
-	if (ata_msg_drv(ap) && ata_dev_print_info(dev))
+	if (ata_dev_print_info(dev))
 		ata_dev_info(dev,
 			     "%llu sectors, multi %u: %s %s\n",
 			     (unsigned long long)dev->n_sectors,
@@ -2429,7 +2428,6 @@ static int ata_dev_config_lba(struct ata_device *dev)
 
 static void ata_dev_config_chs(struct ata_device *dev)
 {
-	struct ata_port *ap = dev->link->ap;
 	const u16 *id = dev->id;
 
 	if (ata_id_current_chs_valid(id)) {
@@ -2445,7 +2443,7 @@ static void ata_dev_config_chs(struct ata_device *dev)
 	}
 
 	/* print device info to dmesg */
-	if (ata_msg_drv(ap) && ata_dev_print_info(dev))
+	if (ata_dev_print_info(dev))
 		ata_dev_info(dev,
 			     "%llu sectors, multi %u, CHS %u/%u/%u\n",
 			     (unsigned long long)dev->n_sectors,
@@ -2685,7 +2683,7 @@ int ata_dev_configure(struct ata_device *dev)
 		}
 
 		/* print device info to dmesg */
-		if (ata_msg_drv(ap) && print_info)
+		if (print_info)
 			ata_dev_info(dev, "%s: %s, %s, max %s\n",
 				     revbuf, modelbuf, fwrevbuf,
 				     ata_mode_string(xfer_mask));
@@ -2705,7 +2703,7 @@ int ata_dev_configure(struct ata_device *dev)
 		ata_dev_config_cpr(dev);
 		dev->cdb_len = 32;
 
-		if (ata_msg_drv(ap) && print_info)
+		if (print_info)
 			ata_dev_print_features(dev);
 	}
 
@@ -2762,7 +2760,7 @@ int ata_dev_configure(struct ata_device *dev)
 		}
 
 		/* print device info to dmesg */
-		if (ata_msg_drv(ap) && print_info)
+		if (print_info)
 			ata_dev_info(dev,
 				     "ATAPI: %s, %s, max %s%s%s%s\n",
 				     modelbuf, fwrevbuf,
@@ -2779,7 +2777,7 @@ int ata_dev_configure(struct ata_device *dev)
 	/* Limit PATA drive on SATA cable bridge transfers to udma5,
 	   200 sectors */
 	if (ata_dev_knobble(dev)) {
-		if (ata_msg_drv(ap) && print_info)
+		if (print_info)
 			ata_dev_info(dev, "applying bridge limits\n");
 		dev->udma_mask &= ATA_UDMA5;
 		dev->max_sectors = ATA_MAX_SECTORS;
@@ -5370,11 +5368,6 @@ struct ata_port *ata_port_alloc(struct ata_host *host)
 	ap->host = host;
 	ap->dev = host->dev;
 
-#if defined(ATA_VERBOSE_DEBUG)
-	/* turn on all debugging levels */
-	ap->msg_enable = 0x0001;
-#endif
-
 	mutex_init(&ap->scsi_scan_mutex);
 	INIT_DELAYED_WORK(&ap->hotplug_task, ata_scsi_hotplug);
 	INIT_WORK(&ap->scsi_rescan_task, ata_scsi_dev_rescan);
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 69f51616d8bd..8d6dcabbf4f2 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -1214,8 +1214,7 @@ void ata_dev_disable(struct ata_device *dev)
 	if (!ata_dev_enabled(dev))
 		return;
 
-	if (ata_msg_drv(dev->link->ap))
-		ata_dev_warn(dev, "disabled\n");
+	ata_dev_warn(dev, "disable device\n");
 	ata_acpi_on_disable(dev);
 	ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO0 | ATA_DNXFER_QUIET);
 	dev->class++;
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 9895414492cb..df10edca3433 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -71,12 +71,6 @@
 /* NEW: debug levels */
 #define HAVE_LIBATA_MSG 1
 
-enum {
-	ATA_MSG_DRV	= 0x0001,
-};
-
-#define ata_msg_drv(p)    ((p)->msg_enable & ATA_MSG_DRV)
-
 static inline u32 ata_msg_init(int dval, int default_msg_enable_bits)
 {
 	if (dval < 0 || dval >= (sizeof(u32) * 8))
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 52/73] libata: remove 'new' ata message handling
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (50 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 51/73] libata: drop ata_msg_drv() Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 53/73] libata: remove debug compilation switches Hannes Reinecke
                   ` (21 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Remove the remaining bits for the 'new' ata message handling.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 include/linux/libata.h | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/include/linux/libata.h b/include/linux/libata.h
index df10edca3433..6bfbb419e141 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -68,18 +68,6 @@
 	}							\
 })
 
-/* NEW: debug levels */
-#define HAVE_LIBATA_MSG 1
-
-static inline u32 ata_msg_init(int dval, int default_msg_enable_bits)
-{
-	if (dval < 0 || dval >= (sizeof(u32) * 8))
-		return default_msg_enable_bits; /* should be 0x1 - only driver info msgs */
-	if (!dval)
-		return 0;
-	return (1 << dval) - 1;
-}
-
 /* defines only for the constants which don't work well as enums */
 #define ATA_TAG_POISON		0xfafbfcfdU
 
@@ -864,7 +852,6 @@ struct ata_port {
 
 	unsigned int		hsm_task_state;
 
-	u32			msg_enable;
 	struct list_head	eh_done_q;
 	wait_queue_head_t	eh_wait_q;
 	int			eh_tries;
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 53/73] libata: remove debug compilation switches
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (51 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 52/73] libata: remove 'new' ata message handling Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 54/73] pata_atp867x: convert blank printk() calls Hannes Reinecke
                   ` (20 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Unused now, so remove them.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 include/linux/libata.h | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/include/linux/libata.h b/include/linux/libata.h
index 6bfbb419e141..ea3478d02cf5 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -39,25 +39,9 @@
  * compile-time options: to be removed as soon as all the drivers are
  * converted to the new debugging mechanism
  */
-#undef ATA_DEBUG		/* debugging output */
-#undef ATA_VERBOSE_DEBUG	/* yet more debugging output */
 #undef ATA_IRQ_TRAP		/* define to ack screaming irqs */
-#undef ATA_NDEBUG		/* define to disable quick runtime checks */
 
 
-/* note: prints function name for you */
-#ifdef ATA_DEBUG
-#define DPRINTK(fmt, args...) printk(KERN_ERR "%s: " fmt, __func__, ## args)
-#ifdef ATA_VERBOSE_DEBUG
-#define VPRINTK(fmt, args...) printk(KERN_ERR "%s: " fmt, __func__, ## args)
-#else
-#define VPRINTK(fmt, args...)
-#endif	/* ATA_VERBOSE_DEBUG */
-#else
-#define DPRINTK(fmt, args...)
-#define VPRINTK(fmt, args...)
-#endif	/* ATA_DEBUG */
-
 #define ata_print_version_once(dev, version)			\
 ({								\
 	static bool __print_once;				\
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 54/73] pata_atp867x: convert blank printk() calls
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (52 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 53/73] libata: remove debug compilation switches Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 22:21   ` kernel test robot
  2021-12-09  1:08   ` Damien Le Moal
  2021-12-08 16:32 ` [PATCH 55/73] pata_cmd640: " Hannes Reinecke
                   ` (19 subsequent siblings)
  73 siblings, 2 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Convert blank printk() calls to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/pata_atp867x.c | 29 ++++++++++++-----------------
 1 file changed, 12 insertions(+), 17 deletions(-)

diff --git a/drivers/ata/pata_atp867x.c b/drivers/ata/pata_atp867x.c
index 2bc5fc81efe3..84dac8c69085 100644
--- a/drivers/ata/pata_atp867x.c
+++ b/drivers/ata/pata_atp867x.c
@@ -155,7 +155,7 @@ static int atp867x_get_active_clocks_shifted(struct ata_port *ap,
 	case 1 ... 6:
 		break;
 	default:
-		printk(KERN_WARNING "ATP867X: active %dclk is invalid. "
+		ata_port_warn(ap, "ATP867X: active %dclk is invalid. "
 			"Using 12clk.\n", clk);
 		fallthrough;
 	case 9 ... 12:
@@ -171,7 +171,8 @@ static int atp867x_get_active_clocks_shifted(struct ata_port *ap,
 	return clocks << ATP867X_IO_PIOSPD_ACTIVE_SHIFT;
 }
 
-static int atp867x_get_recover_clocks_shifted(unsigned int clk)
+static int atp867x_get_recover_clocks_shifted(struct ata_port *ap,
+					      unsigned int clk)
 {
 	unsigned char clocks = clk;
 
@@ -188,7 +189,7 @@ static int atp867x_get_recover_clocks_shifted(unsigned int clk)
 	case 15:
 		break;
 	default:
-		printk(KERN_WARNING "ATP867X: recover %dclk is invalid. "
+		ata_port_warn(ap, "ATP867X: recover %dclk is invalid. "
 			"Using default 12clk.\n", clk);
 		fallthrough;
 	case 12:	/* default 12 clk */
@@ -225,7 +226,7 @@ static void atp867x_set_piomode(struct ata_port *ap, struct ata_device *adev)
 	iowrite8(b, dp->dma_mode);
 
 	b = atp867x_get_active_clocks_shifted(ap, t.active) |
-	    atp867x_get_recover_clocks_shifted(t.recover);
+		atp867x_get_recover_clocks_shifted(ap, t.recover);
 
 	if (adev->devno & 1)
 		iowrite8(b, dp->slave_piospd);
@@ -233,7 +234,7 @@ static void atp867x_set_piomode(struct ata_port *ap, struct ata_device *adev)
 		iowrite8(b, dp->mstr_piospd);
 
 	b = atp867x_get_active_clocks_shifted(ap, t.act8b) |
-	    atp867x_get_recover_clocks_shifted(t.rec8b);
+		atp867x_get_recover_clocks_shifted(ap, t.rec8b);
 
 	iowrite8(b, dp->eightb_piospd);
 }
@@ -270,7 +271,6 @@ static struct ata_port_operations atp867x_ops = {
 };
 
 
-#ifdef	ATP867X_DEBUG
 static void atp867x_check_res(struct pci_dev *pdev)
 {
 	int i;
@@ -280,7 +280,7 @@ static void atp867x_check_res(struct pci_dev *pdev)
 	for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
 		start = pci_resource_start(pdev, i);
 		len   = pci_resource_len(pdev, i);
-		printk(KERN_DEBUG "ATP867X: resource start:len=%lx:%lx\n",
+		dev_dbg(&pdev->dev, "ATP867X: resource start:len=%lx:%lx\n",
 			start, len);
 	}
 }
@@ -290,7 +290,7 @@ static void atp867x_check_ports(struct ata_port *ap, int port)
 	struct ata_ioports *ioaddr = &ap->ioaddr;
 	struct atp867x_priv *dp = ap->private_data;
 
-	printk(KERN_DEBUG "ATP867X: port[%d] addresses\n"
+	ata_port_dbg(ap, "ATP867X: port[%d] addresses\n"
 		"  cmd_addr	=0x%llx, 0x%llx\n"
 		"  ctl_addr	=0x%llx, 0x%llx\n"
 		"  bmdma_addr	=0x%llx, 0x%llx\n"
@@ -332,7 +332,6 @@ static void atp867x_check_ports(struct ata_port *ap, int port)
 		(unsigned long long)dp->eightb_piospd,
 		(unsigned long)dp->pci66mhz);
 }
-#endif
 
 static int atp867x_set_priv(struct ata_port *ap)
 {
@@ -370,8 +369,7 @@ static void atp867x_fixup(struct ata_host *host)
 	if (v < 0x80) {
 		v = 0x80;
 		pci_write_config_byte(pdev, PCI_LATENCY_TIMER, v);
-		printk(KERN_DEBUG "ATP867X: set latency timer of device %s"
-			" to %d\n", pci_name(pdev), v);
+		dev_dbg(&pdev->dev, "ATP867X: set latency timer to %d\n", v);
 	}
 
 	/*
@@ -419,13 +417,11 @@ static int atp867x_ata_pci_sff_init_host(struct ata_host *host)
 		return rc;
 	host->iomap = pcim_iomap_table(pdev);
 
-#ifdef	ATP867X_DEBUG
 	atp867x_check_res(pdev);
 
 	for (i = 0; i < PCI_STD_NUM_BARS; i++)
-		printk(KERN_DEBUG "ATP867X: iomap[%d]=0x%llx\n", i,
+		dev_dbg(gdev, "ATP867X: iomap[%d]=0x%llx\n", i,
 			(unsigned long long)(host->iomap[i]));
-#endif
 
 	/*
 	 * request, iomap BARs and init port addresses accordingly
@@ -444,9 +440,8 @@ static int atp867x_ata_pci_sff_init_host(struct ata_host *host)
 		if (rc)
 			return rc;
 
-#ifdef	ATP867X_DEBUG
 		atp867x_check_ports(ap, i);
-#endif
+
 		ata_port_desc(ap, "cmd 0x%lx ctl 0x%lx",
 			(unsigned long)ioaddr->cmd_addr,
 			(unsigned long)ioaddr->ctl_addr);
@@ -486,7 +481,7 @@ static int atp867x_init_one(struct pci_dev *pdev,
 	if (rc)
 		return rc;
 
-	printk(KERN_INFO "ATP867X: ATP867 ATA UDMA133 controller (rev %02X)",
+	dev_info(&pdev->dev, "ATP867X: ATP867 ATA UDMA133 controller (rev %02X)",
 		pdev->device);
 
 	host = ata_host_alloc_pinfo(&pdev->dev, ppi, ATP867X_NUM_PORTS);
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 55/73] pata_cmd640: convert blank printk() calls
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (53 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 54/73] pata_atp867x: convert blank printk() calls Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 56/73] pata_cmd64x: " Hannes Reinecke
                   ` (18 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Convert blank printk() calls to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/pata_cmd640.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ata/pata_cmd640.c b/drivers/ata/pata_cmd640.c
index d0bcabb58b44..1a3372a72213 100644
--- a/drivers/ata/pata_cmd640.c
+++ b/drivers/ata/pata_cmd640.c
@@ -61,7 +61,7 @@ static void cmd640_set_piomode(struct ata_port *ap, struct ata_device *adev)
 	struct ata_device *pair = ata_dev_pair(adev);
 
 	if (ata_timing_compute(adev, adev->pio_mode, &t, T, 0) < 0) {
-		printk(KERN_ERR DRV_NAME ": mode computation failed.\n");
+		ata_dev_err(adev, DRV_NAME ": mode computation failed.\n");
 		return;
 	}
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 56/73] pata_cmd64x: convert blank printk() calls
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (54 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 55/73] pata_cmd640: " Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 57/73] pata_cs5520: " Hannes Reinecke
                   ` (17 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Convert blank printk() calls to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/pata_cmd64x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ata/pata_cmd64x.c b/drivers/ata/pata_cmd64x.c
index 1d74d89b5bed..5baa4a7819c1 100644
--- a/drivers/ata/pata_cmd64x.c
+++ b/drivers/ata/pata_cmd64x.c
@@ -116,7 +116,7 @@ static void cmd64x_set_timing(struct ata_port *ap, struct ata_device *adev, u8 m
 	/* ata_timing_compute is smart and will produce timings for MWDMA
 	   that don't violate the drives PIO capabilities. */
 	if (ata_timing_compute(adev, mode, &t, T, 0) < 0) {
-		printk(KERN_ERR DRV_NAME ": mode computation failed.\n");
+		ata_dev_err(adev, DRV_NAME ": mode computation failed.\n");
 		return;
 	}
 	if (ap->port_no) {
@@ -130,7 +130,7 @@ static void cmd64x_set_timing(struct ata_port *ap, struct ata_device *adev, u8 m
 		}
 	}
 
-	printk(KERN_DEBUG DRV_NAME ": active %d recovery %d setup %d.\n",
+	ata_dev_dbg(adev, DRV_NAME ": active %d recovery %d setup %d.\n",
 		t.active, t.recover, t.setup);
 	if (t.recover > 16) {
 		t.active += t.recover - 16;
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 57/73] pata_cs5520: convert blank printk() calls
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (55 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 56/73] pata_cmd64x: " Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 58/73] pata_cs5536: " Hannes Reinecke
                   ` (16 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Convert blank printk() calls to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/pata_cs5520.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ata/pata_cs5520.c b/drivers/ata/pata_cs5520.c
index 247c14702624..24ce8665b1f9 100644
--- a/drivers/ata/pata_cs5520.c
+++ b/drivers/ata/pata_cs5520.c
@@ -153,12 +153,12 @@ static int cs5520_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 
 	/* Perform set up for DMA */
 	if (pci_enable_device_io(pdev)) {
-		printk(KERN_ERR DRV_NAME ": unable to configure BAR2.\n");
+		dev_err(&pdev->dev, "unable to configure BAR2.\n");
 		return -ENODEV;
 	}
 
 	if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
-		printk(KERN_ERR DRV_NAME ": unable to configure DMA mask.\n");
+		dev_err(&pdev->dev, "unable to configure DMA mask.\n");
 		return -ENODEV;
 	}
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 58/73] pata_cs5536: convert blank printk() calls
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (56 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 57/73] pata_cs5520: " Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 59/73] pata_cypressx: " Hannes Reinecke
                   ` (15 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Convert blank printk() calls to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/pata_cs5536.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ata/pata_cs5536.c b/drivers/ata/pata_cs5536.c
index 760ac6e65216..ab47aeb5587f 100644
--- a/drivers/ata/pata_cs5536.c
+++ b/drivers/ata/pata_cs5536.c
@@ -263,12 +263,12 @@ static int cs5536_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 	ppi[1] = &ata_dummy_port_info;
 
 	if (use_msr)
-		printk(KERN_ERR DRV_NAME ": Using MSR regs instead of PCI\n");
+		dev_err(&dev->dev, DRV_NAME ": Using MSR regs instead of PCI\n");
 
 	cs5536_read(dev, CFG, &cfg);
 
 	if ((cfg & IDE_CFG_CHANEN) == 0) {
-		printk(KERN_ERR DRV_NAME ": disabled by BIOS\n");
+		dev_err(&dev->dev, DRV_NAME ": disabled by BIOS\n");
 		return -ENODEV;
 	}
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 59/73] pata_cypressx: convert blank printk() calls
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (57 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 58/73] pata_cs5536: " Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-09  8:25   ` Sergey Shtylyov
  2021-12-08 16:32 ` [PATCH 60/73] pata_it821x: " Hannes Reinecke
                   ` (14 subsequent siblings)
  73 siblings, 1 reply; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Convert blank printk() calls to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/pata_cypress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ata/pata_cypress.c b/drivers/ata/pata_cypress.c
index 5b3a7a8ebef6..3be5d52a777b 100644
--- a/drivers/ata/pata_cypress.c
+++ b/drivers/ata/pata_cypress.c
@@ -62,7 +62,7 @@ static void cy82c693_set_piomode(struct ata_port *ap, struct ata_device *adev)
 	u32 addr;
 
 	if (ata_timing_compute(adev, adev->pio_mode, &t, T, 1) < 0) {
-		printk(KERN_ERR DRV_NAME ": mome computation failed.\n");
+		ata_dev_err(adev, DRV_NAME ": mome computation failed.\n");
 		return;
 	}
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 60/73] pata_it821x: convert blank printk() calls
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (58 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 59/73] pata_cypressx: " Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 61/73] pata_marvell: " Hannes Reinecke
                   ` (13 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Convert blank printk() calls to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/pata_it821x.c | 43 ++++++++++++++++++++++-----------------
 1 file changed, 24 insertions(+), 19 deletions(-)

diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index 0e2265978a34..b77ef0046dbe 100644
--- a/drivers/ata/pata_it821x.c
+++ b/drivers/ata/pata_it821x.c
@@ -431,7 +431,8 @@ static unsigned int it821x_smart_qc_issue(struct ata_queued_cmd *qc)
 		case ATA_CMD_SET_FEATURES:
 			return ata_bmdma_qc_issue(qc);
 	}
-	printk(KERN_DEBUG "it821x: can't process command 0x%02X\n", qc->tf.command);
+	ata_dev_dbg(qc->dev, "it821x: can't process command 0x%02X\n",
+		    qc->tf.command);
 	return AC_ERR_DEV;
 }
 
@@ -507,12 +508,14 @@ static void it821x_dev_config(struct ata_device *adev)
 
 	if (strstr(model_num, "Integrated Technology Express")) {
 		/* RAID mode */
-		ata_dev_info(adev, "%sRAID%d volume",
-			     adev->id[147] ? "Bootable " : "",
-			     adev->id[129]);
-		if (adev->id[129] != 1)
-			pr_cont("(%dK stripe)", adev->id[146]);
-		pr_cont("\n");
+		if (adev->id[129] == 1)
+			ata_dev_info(adev, "%sRAID%d volume\n",
+				     adev->id[147] ? "Bootable " : "",
+				     adev->id[129]);
+		else
+			ata_dev_info(adev, "%sRAID%d volume (%dK stripe)\n",
+				     adev->id[147] ? "Bootable " : "",
+				     adev->id[129], adev->id[146]);
 	}
 	/* This is a controller firmware triggered funny, don't
 	   report the drive faulty! */
@@ -593,6 +596,7 @@ static int it821x_check_atapi_dma(struct ata_queued_cmd *qc)
 
 /**
  *	it821x_display_disk	-	display disk setup
+ *	@ap: ATA port
  *	@n: Device number
  *	@buf: Buffer block from firmware
  *
@@ -600,7 +604,7 @@ static int it821x_check_atapi_dma(struct ata_queued_cmd *qc)
  *	by the firmware.
  */
 
-static void it821x_display_disk(int n, u8 *buf)
+static void it821x_display_disk(struct ata_port *ap, int n, u8 *buf)
 {
 	unsigned char id[41];
 	int mode = 0;
@@ -633,13 +637,13 @@ static void it821x_display_disk(int n, u8 *buf)
 	else
 		strcpy(mbuf, "PIO");
 	if (buf[52] == 4)
-		printk(KERN_INFO "%d: %-6s %-8s          %s %s\n",
+		ata_port_info(ap, "%d: %-6s %-8s          %s %s\n",
 				n, mbuf, types[buf[52]], id, cbl);
 	else
-		printk(KERN_INFO "%d: %-6s %-8s Volume: %1d %s %s\n",
+		ata_port_info(ap, "%d: %-6s %-8s Volume: %1d %s %s\n",
 				n, mbuf, types[buf[52]], buf[53], id, cbl);
 	if (buf[125] < 100)
-		printk(KERN_INFO "%d: Rebuilding: %d%%\n", n, buf[125]);
+		ata_port_info(ap, "%d: Rebuilding: %d%%\n", n, buf[125]);
 }
 
 /**
@@ -676,7 +680,7 @@ static u8 *it821x_firmware_command(struct ata_port *ap, u8 cmd, int len)
 		status = ioread8(ap->ioaddr.status_addr);
 		if (status & ATA_ERR) {
 			kfree(buf);
-			printk(KERN_ERR "it821x_firmware_command: rejected\n");
+			ata_port_err(ap, "%s: rejected\n", __func__);
 			return NULL;
 		}
 		if (status & ATA_DRQ) {
@@ -686,7 +690,7 @@ static u8 *it821x_firmware_command(struct ata_port *ap, u8 cmd, int len)
 		usleep_range(500, 1000);
 	}
 	kfree(buf);
-	printk(KERN_ERR "it821x_firmware_command: timeout\n");
+	ata_port_err(ap, "%s: timeout\n", __func__);
 	return NULL;
 }
 
@@ -709,13 +713,13 @@ static void it821x_probe_firmware(struct ata_port *ap)
 	buf = it821x_firmware_command(ap, 0xFA, 512);
 
 	if (buf != NULL) {
-		printk(KERN_INFO "pata_it821x: Firmware %02X/%02X/%02X%02X\n",
+		ata_port_info(ap, "pata_it821x: Firmware %02X/%02X/%02X%02X\n",
 				buf[505],
 				buf[506],
 				buf[507],
 				buf[508]);
 		for (i = 0; i < 4; i++)
- 			it821x_display_disk(i, buf + 128 * i);
+			it821x_display_disk(ap, i, buf + 128 * i);
 		kfree(buf);
 	}
 }
@@ -771,7 +775,8 @@ static int it821x_port_start(struct ata_port *ap)
 		itdev->timing10 = 1;
 		/* Need to disable ATAPI DMA for this case */
 		if (!itdev->smart)
-			printk(KERN_WARNING DRV_NAME": Revision 0x10, workarounds activated.\n");
+			dev_warn(&pdev->dev,
+				 "Revision 0x10, workarounds activated.\n");
 	}
 
 	return 0;
@@ -919,14 +924,14 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	} else {
 		/* Force the card into bypass mode if so requested */
 		if (it8212_noraid) {
-			printk(KERN_INFO DRV_NAME ": forcing bypass mode.\n");
+			dev_info(&pdev->dev, "forcing bypass mode.\n");
 			it821x_disable_raid(pdev);
 		}
 		pci_read_config_byte(pdev, 0x50, &conf);
 		conf &= 1;
 
-		printk(KERN_INFO DRV_NAME": controller in %s mode.\n",
-								mode[conf]);
+		dev_info(&pdev->dev, "controller in %s mode.\n", mode[conf]);
+
 		if (conf == 0)
 			ppi[0] = &info_passthru;
 		else
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 61/73] pata_marvell: convert blank printk() calls
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (59 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 60/73] pata_it821x: " Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 62/73] pata_rz1000: " Hannes Reinecke
                   ` (12 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Convert the blank printk() call to structured logging and
drop the pointless PCI bar debug messages.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/pata_marvell.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/ata/pata_marvell.c b/drivers/ata/pata_marvell.c
index 361597d14c56..0c5a51970fbf 100644
--- a/drivers/ata/pata_marvell.c
+++ b/drivers/ata/pata_marvell.c
@@ -32,7 +32,6 @@
 
 static int marvell_pata_active(struct pci_dev *pdev)
 {
-	int i;
 	u32 devices;
 	void __iomem *barp;
 
@@ -44,11 +43,6 @@ static int marvell_pata_active(struct pci_dev *pdev)
 	if (barp == NULL)
 		return -ENOMEM;
 
-	printk("BAR5:");
-	for(i = 0; i <= 0x0F; i++)
-		printk("%02X:%02X ", i, ioread8(barp + i));
-	printk("\n");
-
 	devices = ioread32(barp + 0x0C);
 	pci_iounmap(pdev, barp);
 
@@ -149,7 +143,8 @@ static int marvell_init_one (struct pci_dev *pdev, const struct pci_device_id *i
 
 #if IS_ENABLED(CONFIG_SATA_AHCI)
 	if (!marvell_pata_active(pdev)) {
-		printk(KERN_INFO DRV_NAME ": PATA port not active, deferring to AHCI driver.\n");
+		dev_info(&pdev->dev,
+			 "PATA port not active, deferring to AHCI driver.\n");
 		return -ENODEV;
 	}
 #endif
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 62/73] pata_rz1000: convert blank printk() calls
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (60 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 61/73] pata_marvell: " Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-09  1:10   ` Damien Le Moal
  2021-12-08 16:32 ` [PATCH 63/73] pata_serverworks: " Hannes Reinecke
                   ` (11 subsequent siblings)
  73 siblings, 1 reply; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Convert blank printk() calls to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/pata_rz1000.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ata/pata_rz1000.c b/drivers/ata/pata_rz1000.c
index 3722a67083fd..8beec884836d 100644
--- a/drivers/ata/pata_rz1000.c
+++ b/drivers/ata/pata_rz1000.c
@@ -69,7 +69,7 @@ static int rz1000_fifo_disable(struct pci_dev *pdev)
 	reg &= 0xDFFF;
 	if (pci_write_config_word(pdev, 0x40, reg) != 0)
 		return -1;
-	printk(KERN_INFO DRV_NAME ": disabled chipset readahead.\n");
+	dev_info(&pdev->dev, "disabled chipset readahead.\n");
 	return 0;
 }
 
@@ -97,7 +97,7 @@ static int rz1000_init_one (struct pci_dev *pdev, const struct pci_device_id *en
 	if (rz1000_fifo_disable(pdev) == 0)
 		return ata_pci_sff_init_one(pdev, ppi, &rz1000_sht, NULL, 0);
 
-	printk(KERN_ERR DRV_NAME ": failed to disable read-ahead on chipset..\n");
+	dev_err(&pdev->dev, "failed to disable read-ahead on chipset..\n");
 	/* Not safe to use so skip */
 	return -ENODEV;
 }
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 63/73] pata_serverworks: convert blank printk() calls
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (61 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 62/73] pata_rz1000: " Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 64/73] pata_sil680: " Hannes Reinecke
                   ` (10 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Convert blank printk() calls to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/pata_serverworks.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ata/pata_serverworks.c b/drivers/ata/pata_serverworks.c
index b602e303fb54..e410fe44177f 100644
--- a/drivers/ata/pata_serverworks.c
+++ b/drivers/ata/pata_serverworks.c
@@ -286,13 +286,13 @@ static int serverworks_fixup_osb4(struct pci_dev *pdev)
 		pci_read_config_dword(isa_dev, 0x64, &reg);
 		reg &= ~0x00002000; /* disable 600ns interrupt mask */
 		if (!(reg & 0x00004000))
-			printk(KERN_DEBUG DRV_NAME ": UDMA not BIOS enabled.\n");
+			dev_info(&pdev->dev, "UDMA not BIOS enabled.\n");
 		reg |=  0x00004000; /* enable UDMA/33 support */
 		pci_write_config_dword(isa_dev, 0x64, reg);
 		pci_dev_put(isa_dev);
 		return 0;
 	}
-	printk(KERN_WARNING DRV_NAME ": Unable to find bridge.\n");
+	dev_warn(&pdev->dev, "Unable to find bridge.\n");
 	return -ENODEV;
 }
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 64/73] pata_sil680: convert blank printk() calls
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (62 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 63/73] pata_serverworks: " Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-09  8:24   ` Sergey Shtylyov
  2021-12-08 16:32 ` [PATCH 65/73] pdc_adma: remove disabled debugging messages Hannes Reinecke
                   ` (9 subsequent siblings)
  73 siblings, 1 reply; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Convert blank printk() calls to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/pata_sil680.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c
index 81238e097fe2..0da58ce20d82 100644
--- a/drivers/ata/pata_sil680.c
+++ b/drivers/ata/pata_sil680.c
@@ -308,17 +308,17 @@ static u8 sil680_init_chip(struct pci_dev *pdev, int *try_mmio)
 
 	switch (tmpbyte & 0x30) {
 	case 0x00:
-		printk(KERN_INFO "sil680: 100MHz clock.\n");
+		dev_info(&pdev->dev, "sil680: 100MHz clock.\n");
 		break;
 	case 0x10:
-		printk(KERN_INFO "sil680: 133MHz clock.\n");
+		dev_info(&pdev->dev, "sil680: 133MHz clock.\n");
 		break;
 	case 0x20:
-		printk(KERN_INFO "sil680: Using PCI clock.\n");
+		dev_info(&pdev->dev, "sil680: Using PCI clock.\n");
 		break;
 	/* This last case is _NOT_ ok */
 	case 0x30:
-		printk(KERN_ERR "sil680: Clock disabled ?\n");
+		dev_err(&pdev->dev, "sil680: Clock disabled ?\n");
 	}
 	return tmpbyte & 0x30;
 }
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 65/73] pdc_adma: remove disabled debugging messages
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (63 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 64/73] pata_sil680: " Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 66/73] sata_sx4: convert blank printk() calls Hannes Reinecke
                   ` (8 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Remove debugging messages for printing out the resulting PRD
as it was permanently disabled anyway.
And convert the remaining printk() statement to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/pdc_adma.c | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/drivers/ata/pdc_adma.c b/drivers/ata/pdc_adma.c
index 5d6f460b2356..35b823ac20c9 100644
--- a/drivers/ata/pdc_adma.c
+++ b/drivers/ata/pdc_adma.c
@@ -350,22 +350,6 @@ static enum ata_completion_errors adma_qc_prep(struct ata_queued_cmd *qc)
 
 	i = adma_fill_sg(qc);
 	wmb();	/* flush PRDs and pkt to memory */
-#if 0
-	/* dump out CPB + PRDs for debug */
-	{
-		int j, len = 0;
-		static char obuf[2048];
-		for (j = 0; j < i; ++j) {
-			len += sprintf(obuf+len, "%02x ", buf[j]);
-			if ((j & 7) == 7) {
-				printk("%s\n", obuf);
-				len = 0;
-			}
-		}
-		if (len)
-			printk("%s\n", obuf);
-	}
-#endif
 	return AC_ERR_OK;
 }
 
@@ -534,8 +518,8 @@ static int adma_port_start(struct ata_port *ap)
 		return -ENOMEM;
 	/* paranoia? */
 	if ((pp->pkt_dma & 7) != 0) {
-		printk(KERN_ERR "bad alignment for pp->pkt_dma: %08x\n",
-						(u32)pp->pkt_dma);
+		ata_port_err(ap, "bad alignment for pp->pkt_dma: %08x\n",
+			     (u32)pp->pkt_dma);
 		return -ENOMEM;
 	}
 	ap->private_data = pp;
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 66/73] sata_sx4: convert blank printk() calls
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (64 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 65/73] pdc_adma: remove disabled debugging messages Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 67/73] sata_mv: convert remaining printk() to structured logging Hannes Reinecke
                   ` (7 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Convert blank printk() calls to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/sata_sx4.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c
index 5d7913644dfc..6ceec59cb291 100644
--- a/drivers/ata/sata_sx4.c
+++ b/drivers/ata/sata_sx4.c
@@ -1179,15 +1179,16 @@ static unsigned int pdc20621_prog_dimm_global(struct ata_host *host)
 	/* Turn on for ECC */
 	if (!pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS,
 			       PDC_DIMM_SPD_TYPE, &spd0)) {
-		pr_err("Failed in i2c read: device=%#x, subaddr=%#x\n",
-		       PDC_DIMM0_SPD_DEV_ADDRESS, PDC_DIMM_SPD_TYPE);
+		dev_err(host->dev,
+			"Failed in i2c read: device=%#x, subaddr=%#x\n",
+			PDC_DIMM0_SPD_DEV_ADDRESS, PDC_DIMM_SPD_TYPE);
 		return 1;
 	}
 	if (spd0 == 0x02) {
 		data |= (0x01 << 16);
 		writel(data, mmio + PDC_SDRAM_CONTROL);
 		readl(mmio + PDC_SDRAM_CONTROL);
-		printk(KERN_ERR "Local DIMM ECC Enabled\n");
+		dev_err(host->dev, "Local DIMM ECC Enabled\n");
 	}
 
 	/* DIMM Initialization Select/Enable (bit 18/19) */
@@ -1279,7 +1280,7 @@ static unsigned int pdc20621_dimm_init(struct ata_host *host)
 	   and program the DIMM Module Controller.
 	*/
 	if (!(speed = pdc20621_detect_dimm(host))) {
-		printk(KERN_ERR "Detect Local DIMM Fail\n");
+		dev_err(host->dev, "Detect Local DIMM Fail\n");
 		return 1;	/* DIMM error */
 	}
 	dev_dbg(host->dev, "Local DIMM Speed = %d\n", speed);
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 67/73] sata_mv: convert remaining printk() to structured logging
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (65 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 66/73] sata_sx4: convert blank printk() calls Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-08 16:32 ` [PATCH 68/73] pata_hpt37x: convert pr_XXX() calls Hannes Reinecke
                   ` (6 subsequent siblings)
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Refactor the .reset_hc() callback and convert the remaining printk()
calls to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/sata_mv.c | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 4f3fa54c8f64..796b03ddf4ae 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -583,7 +583,7 @@ struct mv_hw_ops {
 	void (*enable_leds)(struct mv_host_priv *hpriv, void __iomem *mmio);
 	void (*read_preamp)(struct mv_host_priv *hpriv, int idx,
 			   void __iomem *mmio);
-	int (*reset_hc)(struct mv_host_priv *hpriv, void __iomem *mmio,
+	int (*reset_hc)(struct ata_host *host, void __iomem *mmio,
 			unsigned int n_hc);
 	void (*reset_flash)(struct mv_host_priv *hpriv, void __iomem *mmio);
 	void (*reset_bus)(struct ata_host *host, void __iomem *mmio);
@@ -610,7 +610,7 @@ static void mv5_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
 static void mv5_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio);
 static void mv5_read_preamp(struct mv_host_priv *hpriv, int idx,
 			   void __iomem *mmio);
-static int mv5_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio,
+static int mv5_reset_hc(struct ata_host *host, void __iomem *mmio,
 			unsigned int n_hc);
 static void mv5_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio);
 static void mv5_reset_bus(struct ata_host *host, void __iomem *mmio);
@@ -620,14 +620,14 @@ static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
 static void mv6_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio);
 static void mv6_read_preamp(struct mv_host_priv *hpriv, int idx,
 			   void __iomem *mmio);
-static int mv6_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio,
+static int mv6_reset_hc(struct ata_host *host, void __iomem *mmio,
 			unsigned int n_hc);
 static void mv6_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio);
 static void mv_soc_enable_leds(struct mv_host_priv *hpriv,
 				      void __iomem *mmio);
 static void mv_soc_read_preamp(struct mv_host_priv *hpriv, int idx,
 				      void __iomem *mmio);
-static int mv_soc_reset_hc(struct mv_host_priv *hpriv,
+static int mv_soc_reset_hc(struct ata_host *host,
 				  void __iomem *mmio, unsigned int n_hc);
 static void mv_soc_reset_flash(struct mv_host_priv *hpriv,
 				      void __iomem *mmio);
@@ -3201,9 +3201,10 @@ static void mv5_reset_one_hc(struct mv_host_priv *hpriv, void __iomem *mmio,
 }
 #undef ZERO
 
-static int mv5_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio,
+static int mv5_reset_hc(struct ata_host *host, void __iomem *mmio,
 			unsigned int n_hc)
 {
+	struct mv_host_priv *hpriv = host->private_data;
 	unsigned int hc, port;
 
 	for (hc = 0; hc < n_hc; hc++) {
@@ -3262,7 +3263,7 @@ static void mv6_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio)
  *      LOCKING:
  *      Inherited from caller.
  */
-static int mv6_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio,
+static int mv6_reset_hc(struct ata_host *host, void __iomem *mmio,
 			unsigned int n_hc)
 {
 	void __iomem *reg = mmio + PCI_MAIN_CMD_STS;
@@ -3282,7 +3283,7 @@ static int mv6_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio,
 			break;
 	}
 	if (!(PCI_MASTER_EMPTY & t)) {
-		printk(KERN_ERR DRV_NAME ": PCI master won't flush\n");
+		dev_err(host->dev, "PCI master won't flush\n");
 		rc = 1;
 		goto done;
 	}
@@ -3296,7 +3297,7 @@ static int mv6_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio,
 	} while (!(GLOB_SFT_RST & t) && (i-- > 0));
 
 	if (!(GLOB_SFT_RST & t)) {
-		printk(KERN_ERR DRV_NAME ": can't set global reset\n");
+		dev_err(host->dev, "can't set global reset\n");
 		rc = 1;
 		goto done;
 	}
@@ -3310,7 +3311,7 @@ static int mv6_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio,
 	} while ((GLOB_SFT_RST & t) && (i-- > 0));
 
 	if (GLOB_SFT_RST & t) {
-		printk(KERN_ERR DRV_NAME ": can't clear global reset\n");
+		dev_err(host->dev, "can't clear global reset\n");
 		rc = 1;
 	}
 done:
@@ -3479,9 +3480,10 @@ static void mv_soc_reset_one_hc(struct mv_host_priv *hpriv,
 
 #undef ZERO
 
-static int mv_soc_reset_hc(struct mv_host_priv *hpriv,
+static int mv_soc_reset_hc(struct ata_host *host,
 				  void __iomem *mmio, unsigned int n_hc)
 {
+	struct mv_host_priv *hpriv = host->private_data;
 	unsigned int port;
 
 	for (port = 0; port < hpriv->n_ports; port++)
@@ -3854,11 +3856,11 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
 			 *
 			 * Warn the user, lest they think we're just buggy.
 			 */
-			printk(KERN_WARNING DRV_NAME ": Highpoint RocketRAID"
+			dev_warn(&pdev->dev, "Highpoint RocketRAID"
 				" BIOS CORRUPTS DATA on all attached drives,"
 				" regardless of if/how they are configured."
 				" BEWARE!\n");
-			printk(KERN_WARNING DRV_NAME ": For data safety, do not"
+			dev_warn(&pdev->dev, "For data safety, do not"
 				" use sectors 8-9 on \"Legacy\" drives,"
 				" and avoid the final two gigabytes on"
 				" all RocketRAID BIOS initialized drives.\n");
@@ -3949,7 +3951,7 @@ static int mv_init_host(struct ata_host *host)
 		if (hpriv->ops->read_preamp)
 			hpriv->ops->read_preamp(hpriv, port, mmio);
 
-	rc = hpriv->ops->reset_hc(hpriv, mmio, n_hc);
+	rc = hpriv->ops->reset_hc(host, mmio, n_hc);
 	if (rc)
 		goto done;
 
@@ -4265,7 +4267,7 @@ static int mv_platform_resume(struct platform_device *pdev)
 		/* initialize adapter */
 		ret = mv_init_host(host);
 		if (ret) {
-			printk(KERN_ERR DRV_NAME ": Error during HW init\n");
+			dev_err(&pdev->dev, "Error during HW init\n");
 			return ret;
 		}
 		ata_host_resume(host);
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 68/73] pata_hpt37x: convert pr_XXX() calls
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (66 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 67/73] sata_mv: convert remaining printk() to structured logging Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-09  1:13   ` Damien Le Moal
  2021-12-08 16:32 ` [PATCH 69/73] pata_octeon_cf: Replace pr_XXX() calls with structured logging Hannes Reinecke
                   ` (5 subsequent siblings)
  73 siblings, 1 reply; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Convert pr_XXX() calls to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/pata_hpt37x.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c
index f242157bc81b..47709eb9d135 100644
--- a/drivers/ata/pata_hpt37x.c
+++ b/drivers/ata/pata_hpt37x.c
@@ -15,8 +15,6 @@
  *	Look into engine reset on timeout errors. Should not be	required.
  */
 
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/pci.h>
@@ -231,7 +229,8 @@ static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr,
 
 	i = match_string(list, -1, model_num);
 	if (i >= 0) {
-		pr_warn("%s is not supported for %s\n", modestr, list[i]);
+		ata_dev_warn(dev, "%s is not supported for %s\n",
+			     modestr, list[i]);
 		return 1;
 	}
 	return 0;
@@ -864,7 +863,8 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 			chip_table = &hpt372;
 			break;
 		default:
-			pr_err("Unknown HPT366 subtype, please report (%d)\n",
+			dev_err(&dev->dev,
+				"Unknown HPT366 subtype, please report (%d)\n",
 			       rev);
 			return -ENODEV;
 		}
@@ -905,7 +905,8 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 			*ppi = &info_hpt374_fn1;
 		break;
 	default:
-		pr_err("PCI table is bogus, please report (%d)\n", dev->device);
+		dev_err(&dev->dev, "PCI table is bogus, please report (%d)\n",
+			dev->device);
 		return -ENODEV;
 	}
 	/* Ok so this is a chip we support */
@@ -953,7 +954,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 		u8 sr;
 		u32 total = 0;
 
-		pr_warn("BIOS has not set timing clocks\n");
+		dev_warn(&dev->dev, "BIOS has not set timing clocks\n");
 
 		/* This is the process the HPT371 BIOS is reported to use */
 		for (i = 0; i < 128; i++) {
@@ -1009,7 +1010,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 					       (f_high << 16) | f_low | 0x100);
 		}
 		if (adjust == 8) {
-			pr_err("DPLL did not stabilize!\n");
+			dev_err(&dev->dev, "DPLL did not stabilize!\n");
 			return -ENODEV;
 		}
 		if (dpll == 3)
@@ -1017,7 +1018,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 		else
 			private_data = (void *)hpt37x_timings_50;
 
-		pr_info("bus clock %dMHz, using %dMHz DPLL\n",
+		dev_info(&dev->dev, "bus clock %dMHz, using %dMHz DPLL\n",
 			MHz[clock_slot], MHz[dpll]);
 	} else {
 		private_data = (void *)chip_table->clocks[clock_slot];
@@ -1032,7 +1033,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 		if (clock_slot < 2 && ppi[0] == &info_hpt370a)
 			ppi[0] = &info_hpt370a_33;
 
-		pr_info("%s using %dMHz bus clock\n",
+		dev_info(&dev->dev, "%s using %dMHz bus clock\n",
 			chip_table->name, MHz[clock_slot]);
 	}
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 69/73] pata_octeon_cf: Replace pr_XXX() calls with structured logging
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (67 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 68/73] pata_hpt37x: convert pr_XXX() calls Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-09  8:08   ` Sergey Shtylyov
  2021-12-08 16:32 ` [PATCH 70/73] pata_hpt3x2n: convert pr_XXX() calls Hannes Reinecke
                   ` (4 subsequent siblings)
  73 siblings, 1 reply; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/pata_octeon_cf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
index de27428920a0..64bb65ef8f02 100644
--- a/drivers/ata/pata_octeon_cf.c
+++ b/drivers/ata/pata_octeon_cf.c
@@ -273,9 +273,9 @@ static void octeon_cf_set_dmamode(struct ata_port *ap, struct ata_device *dev)
 	dma_tim.s.we_n = ns_to_tim_reg(tim_mult, oe_n);
 	dma_tim.s.we_a = ns_to_tim_reg(tim_mult, oe_a);
 
-	pr_debug("ns to ticks (mult %d) of %d is: %d\n", tim_mult, 60,
+	ata_dev_dbg(dev, "ns to ticks (mult %d) of %d is: %d\n", tim_mult, 60,
 		 ns_to_tim_reg(tim_mult, 60));
-	pr_debug("oe_n: %d, oe_a: %d, dmack_s: %d, dmack_h: %d, dmarq: %d, pause: %d\n",
+	ata_dev_dbg(dev, "oe_n: %d, oe_a: %d, dmack_s: %d, dmack_h: %d, dmarq: %d, pause: %d\n",
 		 dma_tim.s.oe_n, dma_tim.s.oe_a, dma_tim.s.dmack_s,
 		 dma_tim.s.dmack_h, dma_tim.s.dmarq, dma_tim.s.pause);
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 70/73] pata_hpt3x2n: convert pr_XXX() calls
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (68 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 69/73] pata_octeon_cf: Replace pr_XXX() calls with structured logging Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-09  1:13   ` Damien Le Moal
  2021-12-08 16:32 ` [PATCH 71/73] pata_hpt3x2n: convert pr_err() calls Hannes Reinecke
                   ` (3 subsequent siblings)
  73 siblings, 1 reply; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Convert pr_XXX() calls to structured logging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/pata_hpt3x2n.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c
index 48eef338e050..60e7d71328f6 100644
--- a/drivers/ata/pata_hpt3x2n.c
+++ b/drivers/ata/pata_hpt3x2n.c
@@ -16,8 +16,6 @@
  *	Work out best PLL policy
  */
 
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/pci.h>
@@ -420,7 +418,7 @@ static int hpt3x2n_pci_clock(struct pci_dev *pdev)
 		u16 sr;
 		u32 total = 0;
 
-		pr_warn("BIOS clock data not set\n");
+		dev_warn(&pdev->dev, "BIOS clock data not set\n");
 
 		/* This is the process the HPT371 BIOS is reported to use */
 		for (i = 0; i < 128; i++) {
@@ -530,7 +528,8 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 		ppi[0] = &info_hpt372n;
 		break;
 	default:
-		pr_err("PCI table is bogus, please report (%d)\n", dev->device);
+		dev_err(&dev->dev,"PCI table is bogus, please report (%d)\n",
+			dev->device);
 		return -ENODEV;
 	}
 
@@ -579,11 +578,11 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 		pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low);
 	}
 	if (adjust == 8) {
-		pr_err("DPLL did not stabilize!\n");
+		dev_err(&dev->dev, "DPLL did not stabilize!\n");
 		return -ENODEV;
 	}
 
-	pr_info("bus clock %dMHz, using 66MHz DPLL\n", pci_mhz);
+	dev_info(&dev->dev, "bus clock %dMHz, using 66MHz DPLL\n", pci_mhz);
 
 	/*
 	 * Set our private data up. We only need a few flags
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 71/73] pata_hpt3x2n: convert pr_err() calls
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (69 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 70/73] pata_hpt3x2n: convert pr_XXX() calls Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-09  1:14   ` Damien Le Moal
  2021-12-09  8:09   ` Sergey Shtylyov
  2021-12-08 16:32 ` [PATCH 72/73] pata_hpt366: convert pr_warn() calls Hannes Reinecke
                   ` (2 subsequent siblings)
  73 siblings, 2 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Convert pr_err() calls to dev_err()

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/sata_gemini.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ata/sata_gemini.c b/drivers/ata/sata_gemini.c
index f793564f3d78..440a63de20d0 100644
--- a/drivers/ata/sata_gemini.c
+++ b/drivers/ata/sata_gemini.c
@@ -253,12 +253,12 @@ static int gemini_sata_bridge_init(struct sata_gemini *sg)
 
 	ret = clk_prepare_enable(sg->sata0_pclk);
 	if (ret) {
-		pr_err("failed to enable SATA0 PCLK\n");
+		dev_err(dev, "failed to enable SATA0 PCLK\n");
 		return ret;
 	}
 	ret = clk_prepare_enable(sg->sata1_pclk);
 	if (ret) {
-		pr_err("failed to enable SATA1 PCLK\n");
+		dev_err(dev, "failed to enable SATA1 PCLK\n");
 		clk_disable_unprepare(sg->sata0_pclk);
 		return ret;
 	}
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 72/73] pata_hpt366: convert pr_warn() calls
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (70 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 71/73] pata_hpt3x2n: convert pr_err() calls Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-09  1:14   ` Damien Le Moal
  2021-12-08 16:32 ` [PATCH 73/73] libata-scsi: rework ata_dump_status to avoid using pr_cont() Hannes Reinecke
  2021-12-09  1:17 ` [PATCH 00/73] libata: rework logging, take II Damien Le Moal
  73 siblings, 1 reply; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

Convert pr_warn() calls to ata_dev_warn()

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/pata_hpt366.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/ata/pata_hpt366.c b/drivers/ata/pata_hpt366.c
index 06b7c4a9ec95..c29863038428 100644
--- a/drivers/ata/pata_hpt366.c
+++ b/drivers/ata/pata_hpt366.c
@@ -15,8 +15,6 @@
  *	Look into engine reset on timeout errors. Should not be required.
  */
 
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/pci.h>
@@ -183,7 +181,7 @@ static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr,
 
 	i = match_string(list, -1, model_num);
 	if (i >= 0) {
-		pr_warn("%s is not supported for %s\n", modestr, list[i]);
+		ata_dev_warn(dev, "%s is not supported for %s\n", modestr, list[i]);
 		return 1;
 	}
 	return 0;
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* [PATCH 73/73] libata-scsi: rework ata_dump_status to avoid using pr_cont()
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (71 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 72/73] pata_hpt366: convert pr_warn() calls Hannes Reinecke
@ 2021-12-08 16:32 ` Hannes Reinecke
  2021-12-09  1:17 ` [PATCH 00/73] libata: rework logging, take II Damien Le Moal
  73 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-08 16:32 UTC (permalink / raw)
  To: Damien LeMoal; +Cc: linux-ide, Hannes Reinecke

pr_cont() has the problem that individual calls will be disrupted
under high load, causing each call to end up on a single line and
thereby mangling the output.
So rework ata_dump_status() to have just one call to ata_port_warn()
and avoid this problem.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/libata-scsi.c | 49 ++++++++++++++++++---------------------
 1 file changed, 22 insertions(+), 27 deletions(-)

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index bbbd0a06ffd2..aab648d20493 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -678,37 +678,32 @@ static void ata_qc_set_pc_nbytes(struct ata_queued_cmd *qc)
  *	LOCKING:
  *	inherited from caller
  */
-static void ata_dump_status(unsigned id, struct ata_taskfile *tf)
+static void ata_dump_status(struct ata_port *ap, struct ata_taskfile *tf)
 {
 	u8 stat = tf->command, err = tf->feature;
 
-	pr_warn("ata%u: status=0x%02x { ", id, stat);
 	if (stat & ATA_BUSY) {
-		pr_cont("Busy }\n");	/* Data is not valid in this case */
+		ata_port_warn(ap, "status=0x%02x {Busy} ", stat);
 	} else {
-		if (stat & ATA_DRDY)	pr_cont("DriveReady ");
-		if (stat & ATA_DF)	pr_cont("DeviceFault ");
-		if (stat & ATA_DSC)	pr_cont("SeekComplete ");
-		if (stat & ATA_DRQ)	pr_cont("DataRequest ");
-		if (stat & ATA_CORR)	pr_cont("CorrectedError ");
-		if (stat & ATA_SENSE)	pr_cont("Sense ");
-		if (stat & ATA_ERR)	pr_cont("Error ");
-		pr_cont("}\n");
-
-		if (err) {
-			pr_warn("ata%u: error=0x%02x { ", id, err);
-			if (err & ATA_ABORTED)	pr_cont("DriveStatusError ");
-			if (err & ATA_ICRC) {
-				if (err & ATA_ABORTED)
-						pr_cont("BadCRC ");
-				else		pr_cont("Sector ");
-			}
-			if (err & ATA_UNC)	pr_cont("UncorrectableError ");
-			if (err & ATA_IDNF)	pr_cont("SectorIdNotFound ");
-			if (err & ATA_TRK0NF)	pr_cont("TrackZeroNotFound ");
-			if (err & ATA_AMNF)	pr_cont("AddrMarkNotFound ");
-			pr_cont("}\n");
-		}
+		ata_port_warn(ap, "status=0x%02x { %s%s%s%s%s%s%s} ", stat,
+			      stat & ATA_DRDY ? "DriveReady " : "",
+			      stat & ATA_DF ? "DeviceFault " : "",
+			      stat & ATA_DSC ? "SeekComplete " : "",
+			      stat & ATA_DRQ ? "DataRequest " : "",
+			      stat & ATA_CORR ? "CorrectedError " : "",
+			      stat & ATA_SENSE ? "Sense " : "",
+			      stat & ATA_ERR ? "Error " : "");
+		if (err)
+			ata_port_warn(ap, "error=0x%02x {%s%s%s%s%s%s", err,
+				      err & ATA_ABORTED ?
+				      "DriveStatusError " : "",
+				      err & ATA_ICRC ?
+				      (err & ATA_ABORTED ?
+				       "BadCRC " : "Sector ") : "",
+				      err & ATA_UNC ? "UncorrectableError " : "",
+				      err & ATA_IDNF ? "SectorIdNotFound " : "",
+				      err & ATA_TRK0NF ? "TrackZeroNotFound " : "",
+				      err & ATA_AMNF ? "AddrMarkNotFound " : "");
 	}
 }
 
@@ -1662,7 +1657,7 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
 		cmd->result = SAM_STAT_GOOD;
 
 	if (need_sense && !ap->ops->error_handler)
-		ata_dump_status(ap->print_id, &qc->result_tf);
+		ata_dump_status(ap, &qc->result_tf);
 
 	ata_qc_done(qc);
 }
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 114+ messages in thread

* Re: [PATCH 02/73] libata: Add ata_port_classify() helper
  2021-12-08 16:31 ` [PATCH 02/73] libata: Add ata_port_classify() helper Hannes Reinecke
@ 2021-12-08 22:21     ` kernel test robot
  2021-12-09  0:34   ` Damien Le Moal
  2021-12-09  4:20   ` kernel test robot
  2 siblings, 0 replies; 114+ messages in thread
From: kernel test robot @ 2021-12-08 22:21 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: llvm, kbuild-all

Hi Hannes,

I love your patch! Perhaps something to improve:

[auto build test WARNING on rostedt-trace/for-next]
[also build test WARNING on axboe-block/for-next linus/master v5.16-rc4 next-20211208]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Hannes-Reinecke/libata-rework-logging-take-II/20211209-003634
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git for-next
config: hexagon-randconfig-r045-20211207 (https://download.01.org/0day-ci/archive/20211209/202112090643.h0EhSayB-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 097a1cb1d5ebb3a0ec4bcaed8ba3ff6a8e33c00a)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/6b66f083c8ccc2d25de4c0a9bc9229f38952bf10
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Hannes-Reinecke/libata-rework-logging-take-II/20211209-003634
        git checkout 6b66f083c8ccc2d25de4c0a9bc9229f38952bf10
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/ata/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/ata/libata-core.c:972:13: warning: no previous prototype for function 'ata_dev_class_string' [-Wmissing-prototypes]
   const char *ata_dev_class_string(unsigned int class)
               ^
   drivers/ata/libata-core.c:972:7: note: declare 'static' if the function is not intended to be used outside of this translation unit
   const char *ata_dev_class_string(unsigned int class)
         ^
   static 
   1 warning generated.


vim +/ata_dev_class_string +972 drivers/ata/libata-core.c

   971	
 > 972	const char *ata_dev_class_string(unsigned int class)
   973	{
   974		static const char * const class_str[] = {
   975			"unknown",
   976			"ATA",
   977			"ATA (unsupported)",
   978			"ATAPI",
   979			"ATAPI (unsupported",
   980			"PMP",
   981			"PMP (unsupported)",
   982			"SEMB",
   983			"SEMB (unsupported)",
   984			"ZAC",
   985			"ZAC (unsupported)",
   986			"none",
   987		};
   988		if (class == 0 || (class - 1) >= ARRAY_SIZE(class_str))
   989			return "unknown";
   990		return class_str[class - 1];
   991	}
   992	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 02/73] libata: Add ata_port_classify() helper
@ 2021-12-08 22:21     ` kernel test robot
  0 siblings, 0 replies; 114+ messages in thread
From: kernel test robot @ 2021-12-08 22:21 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 2921 bytes --]

Hi Hannes,

I love your patch! Perhaps something to improve:

[auto build test WARNING on rostedt-trace/for-next]
[also build test WARNING on axboe-block/for-next linus/master v5.16-rc4 next-20211208]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Hannes-Reinecke/libata-rework-logging-take-II/20211209-003634
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git for-next
config: hexagon-randconfig-r045-20211207 (https://download.01.org/0day-ci/archive/20211209/202112090643.h0EhSayB-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 097a1cb1d5ebb3a0ec4bcaed8ba3ff6a8e33c00a)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/6b66f083c8ccc2d25de4c0a9bc9229f38952bf10
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Hannes-Reinecke/libata-rework-logging-take-II/20211209-003634
        git checkout 6b66f083c8ccc2d25de4c0a9bc9229f38952bf10
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/ata/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/ata/libata-core.c:972:13: warning: no previous prototype for function 'ata_dev_class_string' [-Wmissing-prototypes]
   const char *ata_dev_class_string(unsigned int class)
               ^
   drivers/ata/libata-core.c:972:7: note: declare 'static' if the function is not intended to be used outside of this translation unit
   const char *ata_dev_class_string(unsigned int class)
         ^
   static 
   1 warning generated.


vim +/ata_dev_class_string +972 drivers/ata/libata-core.c

   971	
 > 972	const char *ata_dev_class_string(unsigned int class)
   973	{
   974		static const char * const class_str[] = {
   975			"unknown",
   976			"ATA",
   977			"ATA (unsupported)",
   978			"ATAPI",
   979			"ATAPI (unsupported",
   980			"PMP",
   981			"PMP (unsupported)",
   982			"SEMB",
   983			"SEMB (unsupported)",
   984			"ZAC",
   985			"ZAC (unsupported)",
   986			"none",
   987		};
   988		if (class == 0 || (class - 1) >= ARRAY_SIZE(class_str))
   989			return "unknown";
   990		return class_str[class - 1];
   991	}
   992	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 54/73] pata_atp867x: convert blank printk() calls
  2021-12-08 16:32 ` [PATCH 54/73] pata_atp867x: convert blank printk() calls Hannes Reinecke
@ 2021-12-08 22:21   ` kernel test robot
  2021-12-09  1:08   ` Damien Le Moal
  1 sibling, 0 replies; 114+ messages in thread
From: kernel test robot @ 2021-12-08 22:21 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 13094 bytes --]

Hi Hannes,

I love your patch! Perhaps something to improve:

[auto build test WARNING on rostedt-trace/for-next]
[also build test WARNING on axboe-block/for-next linus/master v5.16-rc4 next-20211208]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Hannes-Reinecke/libata-rework-logging-take-II/20211209-003634
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git for-next
config: arc-randconfig-r043-20211207 (https://download.01.org/0day-ci/archive/20211209/202112090637.TBRwbH92-lkp(a)intel.com/config)
compiler: arceb-elf-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/bd6ed9c4fe23f7c395cacd847a03e6babd390e1f
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Hannes-Reinecke/libata-rework-logging-take-II/20211209-003634
        git checkout bd6ed9c4fe23f7c395cacd847a03e6babd390e1f
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash drivers/ata/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from include/linux/device.h:15,
                    from include/linux/pci.h:37,
                    from drivers/ata/pata_atp867x.c:17:
   drivers/ata/pata_atp867x.c: In function 'atp867x_check_ports':
>> drivers/ata/pata_atp867x.c:313:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     313 |                 (unsigned long long)ioaddr->cmd_addr,
         |                 ^
   include/linux/dev_printk.h:129:48: note: in definition of macro 'dev_printk'
     129 |                 _dev_printk(level, dev, fmt, ##__VA_ARGS__);            \
         |                                                ^~~~~~~~~~~
   include/linux/libata.h:1452:9: note: in expansion of macro 'dev_dbg'
    1452 |         dev_dbg(&ap->tdev, "%s: " fmt, __func__, ##__VA_ARGS__)
         |         ^~~~~~~
   drivers/ata/pata_atp867x.c:293:9: note: in expansion of macro 'ata_port_dbg'
     293 |         ata_port_dbg(ap, "ATP867X: port[%d] addresses\n"
         |         ^~~~~~~~~~~~
   drivers/ata/pata_atp867x.c:314:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     314 |                 (unsigned long long)ATP867X_IO_PORTBASE(ap, port),
         |                 ^
   include/linux/dev_printk.h:129:48: note: in definition of macro 'dev_printk'
     129 |                 _dev_printk(level, dev, fmt, ##__VA_ARGS__);            \
         |                                                ^~~~~~~~~~~
   include/linux/libata.h:1452:9: note: in expansion of macro 'dev_dbg'
    1452 |         dev_dbg(&ap->tdev, "%s: " fmt, __func__, ##__VA_ARGS__)
         |         ^~~~~~~
   drivers/ata/pata_atp867x.c:293:9: note: in expansion of macro 'ata_port_dbg'
     293 |         ata_port_dbg(ap, "ATP867X: port[%d] addresses\n"
         |         ^~~~~~~~~~~~
   drivers/ata/pata_atp867x.c:315:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     315 |                 (unsigned long long)ioaddr->ctl_addr,
         |                 ^
   include/linux/dev_printk.h:129:48: note: in definition of macro 'dev_printk'
     129 |                 _dev_printk(level, dev, fmt, ##__VA_ARGS__);            \
         |                                                ^~~~~~~~~~~
   include/linux/libata.h:1452:9: note: in expansion of macro 'dev_dbg'
    1452 |         dev_dbg(&ap->tdev, "%s: " fmt, __func__, ##__VA_ARGS__)
         |         ^~~~~~~
   drivers/ata/pata_atp867x.c:293:9: note: in expansion of macro 'ata_port_dbg'
     293 |         ata_port_dbg(ap, "ATP867X: port[%d] addresses\n"
         |         ^~~~~~~~~~~~
   drivers/ata/pata_atp867x.c:316:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     316 |                 (unsigned long long)ATP867X_IO_ALTSTATUS(ap, port),
         |                 ^
   include/linux/dev_printk.h:129:48: note: in definition of macro 'dev_printk'
     129 |                 _dev_printk(level, dev, fmt, ##__VA_ARGS__);            \
         |                                                ^~~~~~~~~~~
   include/linux/libata.h:1452:9: note: in expansion of macro 'dev_dbg'
    1452 |         dev_dbg(&ap->tdev, "%s: " fmt, __func__, ##__VA_ARGS__)
         |         ^~~~~~~
   drivers/ata/pata_atp867x.c:293:9: note: in expansion of macro 'ata_port_dbg'
     293 |         ata_port_dbg(ap, "ATP867X: port[%d] addresses\n"
         |         ^~~~~~~~~~~~
   drivers/ata/pata_atp867x.c:317:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     317 |                 (unsigned long long)ioaddr->bmdma_addr,
         |                 ^
   include/linux/dev_printk.h:129:48: note: in definition of macro 'dev_printk'
     129 |                 _dev_printk(level, dev, fmt, ##__VA_ARGS__);            \
         |                                                ^~~~~~~~~~~
   include/linux/libata.h:1452:9: note: in expansion of macro 'dev_dbg'
    1452 |         dev_dbg(&ap->tdev, "%s: " fmt, __func__, ##__VA_ARGS__)
         |         ^~~~~~~
   drivers/ata/pata_atp867x.c:293:9: note: in expansion of macro 'ata_port_dbg'
     293 |         ata_port_dbg(ap, "ATP867X: port[%d] addresses\n"
         |         ^~~~~~~~~~~~
   drivers/ata/pata_atp867x.c:318:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     318 |                 (unsigned long long)ATP867X_IO_DMABASE(ap, port),
         |                 ^
   include/linux/dev_printk.h:129:48: note: in definition of macro 'dev_printk'
     129 |                 _dev_printk(level, dev, fmt, ##__VA_ARGS__);            \
         |                                                ^~~~~~~~~~~
   include/linux/libata.h:1452:9: note: in expansion of macro 'dev_dbg'
    1452 |         dev_dbg(&ap->tdev, "%s: " fmt, __func__, ##__VA_ARGS__)
         |         ^~~~~~~
   drivers/ata/pata_atp867x.c:293:9: note: in expansion of macro 'ata_port_dbg'
     293 |         ata_port_dbg(ap, "ATP867X: port[%d] addresses\n"
         |         ^~~~~~~~~~~~
   drivers/ata/pata_atp867x.c:319:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     319 |                 (unsigned long long)ioaddr->data_addr,
         |                 ^
   include/linux/dev_printk.h:129:48: note: in definition of macro 'dev_printk'
     129 |                 _dev_printk(level, dev, fmt, ##__VA_ARGS__);            \
         |                                                ^~~~~~~~~~~
   include/linux/libata.h:1452:9: note: in expansion of macro 'dev_dbg'
    1452 |         dev_dbg(&ap->tdev, "%s: " fmt, __func__, ##__VA_ARGS__)
         |         ^~~~~~~
   drivers/ata/pata_atp867x.c:293:9: note: in expansion of macro 'ata_port_dbg'
     293 |         ata_port_dbg(ap, "ATP867X: port[%d] addresses\n"
         |         ^~~~~~~~~~~~
   drivers/ata/pata_atp867x.c:320:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     320 |                 (unsigned long long)ioaddr->error_addr,
         |                 ^
   include/linux/dev_printk.h:129:48: note: in definition of macro 'dev_printk'
     129 |                 _dev_printk(level, dev, fmt, ##__VA_ARGS__);            \
         |                                                ^~~~~~~~~~~
   include/linux/libata.h:1452:9: note: in expansion of macro 'dev_dbg'
    1452 |         dev_dbg(&ap->tdev, "%s: " fmt, __func__, ##__VA_ARGS__)
         |         ^~~~~~~
   drivers/ata/pata_atp867x.c:293:9: note: in expansion of macro 'ata_port_dbg'
     293 |         ata_port_dbg(ap, "ATP867X: port[%d] addresses\n"
         |         ^~~~~~~~~~~~
   drivers/ata/pata_atp867x.c:321:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     321 |                 (unsigned long long)ioaddr->feature_addr,
         |                 ^
   include/linux/dev_printk.h:129:48: note: in definition of macro 'dev_printk'
     129 |                 _dev_printk(level, dev, fmt, ##__VA_ARGS__);            \


vim +313 drivers/ata/pata_atp867x.c

d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  287) 
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  288) static void atp867x_check_ports(struct ata_port *ap, int port)
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  289) {
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  290) 	struct ata_ioports *ioaddr = &ap->ioaddr;
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  291) 	struct atp867x_priv *dp = ap->private_data;
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  292) 
bd6ed9c4fe23f7 Hannes Reinecke   2021-12-08  293  	ata_port_dbg(ap, "ATP867X: port[%d] addresses\n"
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  294) 		"  cmd_addr	=0x%llx, 0x%llx\n"
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  295) 		"  ctl_addr	=0x%llx, 0x%llx\n"
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  296) 		"  bmdma_addr	=0x%llx, 0x%llx\n"
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  297) 		"  data_addr	=0x%llx\n"
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  298) 		"  error_addr	=0x%llx\n"
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  299) 		"  feature_addr	=0x%llx\n"
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  300) 		"  nsect_addr	=0x%llx\n"
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  301) 		"  lbal_addr	=0x%llx\n"
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  302) 		"  lbam_addr	=0x%llx\n"
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  303) 		"  lbah_addr	=0x%llx\n"
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  304) 		"  device_addr	=0x%llx\n"
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  305) 		"  status_addr	=0x%llx\n"
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  306) 		"  command_addr	=0x%llx\n"
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  307) 		"  dp->dma_mode	=0x%llx\n"
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  308) 		"  dp->mstr_piospd	=0x%llx\n"
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  309) 		"  dp->slave_piospd	=0x%llx\n"
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  310) 		"  dp->eightb_piospd	=0x%llx\n"
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  311) 		"  dp->pci66mhz		=0x%lx\n",
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  312) 		port,
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14 @313) 		(unsigned long long)ioaddr->cmd_addr,
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  314) 		(unsigned long long)ATP867X_IO_PORTBASE(ap, port),
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  315) 		(unsigned long long)ioaddr->ctl_addr,
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  316) 		(unsigned long long)ATP867X_IO_ALTSTATUS(ap, port),
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  317) 		(unsigned long long)ioaddr->bmdma_addr,
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  318) 		(unsigned long long)ATP867X_IO_DMABASE(ap, port),
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  319) 		(unsigned long long)ioaddr->data_addr,
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  320) 		(unsigned long long)ioaddr->error_addr,
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  321) 		(unsigned long long)ioaddr->feature_addr,
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  322) 		(unsigned long long)ioaddr->nsect_addr,
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  323) 		(unsigned long long)ioaddr->lbal_addr,
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  324) 		(unsigned long long)ioaddr->lbam_addr,
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  325) 		(unsigned long long)ioaddr->lbah_addr,
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  326) 		(unsigned long long)ioaddr->device_addr,
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  327) 		(unsigned long long)ioaddr->status_addr,
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  328) 		(unsigned long long)ioaddr->command_addr,
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  329) 		(unsigned long long)dp->dma_mode,
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  330) 		(unsigned long long)dp->mstr_piospd,
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  331) 		(unsigned long long)dp->slave_piospd,
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  332) 		(unsigned long long)dp->eightb_piospd,
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  333) 		(unsigned long)dp->pci66mhz);
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  334) }
d15d6e6cc34056 John(Jung-Ik  Lee 2009-09-14  335) 

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 02/73] libata: Add ata_port_classify() helper
  2021-12-08 16:31 ` [PATCH 02/73] libata: Add ata_port_classify() helper Hannes Reinecke
  2021-12-08 22:21     ` kernel test robot
@ 2021-12-09  0:34   ` Damien Le Moal
  2021-12-09  7:16     ` Hannes Reinecke
  2021-12-09  4:20   ` kernel test robot
  2 siblings, 1 reply; 114+ messages in thread
From: Damien Le Moal @ 2021-12-09  0:34 UTC (permalink / raw)
  To: Hannes Reinecke, Damien LeMoal; +Cc: linux-ide, Bartlomiej Zolnierkiewicz

On 2021/12/09 1:31, Hannes Reinecke wrote:
> Add an ata_port_classify() helper to print out the results from
> the device classification and remove the debugging statements
> from ata_dev_classify(). Also provide a mapping ata_dev_class_string()
> to provide a string representation for those instances calling
> ata_dev_classify() directly.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> ---
>  drivers/ata/libahci.c       |  2 +-
>  drivers/ata/libata-core.c   | 67 ++++++++++++++++++++++++++++---------
>  drivers/ata/libata-sff.c    |  2 +-
>  drivers/ata/sata_fsl.c      |  2 +-
>  drivers/ata/sata_inic162x.c |  2 +-
>  drivers/ata/sata_sil24.c    |  2 +-
>  include/linux/libata.h      |  2 ++
>  7 files changed, 58 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
> index 8b651f55fc84..21dbcd551443 100644
> --- a/drivers/ata/libahci.c
> +++ b/drivers/ata/libahci.c
> @@ -1300,7 +1300,7 @@ unsigned int ahci_dev_classify(struct ata_port *ap)
>  	tf.lbal		= (tmp >> 8)	& 0xff;
>  	tf.nsect	= (tmp)		& 0xff;
>  
> -	return ata_dev_classify(&tf);
> +	return ata_port_classify(ap, &tf);
>  }
>  EXPORT_SYMBOL_GPL(ahci_dev_classify);
>  
> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> index f6a9e2f22a94..6cac413caf83 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -969,6 +969,27 @@ const char *sata_spd_string(unsigned int spd)
>  	return spd_str[spd - 1];
>  }
>  
> +const char *ata_dev_class_string(unsigned int class)

This should be static.

> +{
> +	static const char * const class_str[] = {
> +		"unknown",
> +		"ATA",
> +		"ATA (unsupported)",
> +		"ATAPI",
> +		"ATAPI (unsupported",
> +		"PMP",
> +		"PMP (unsupported)",
> +		"SEMB",
> +		"SEMB (unsupported)",
> +		"ZAC",
> +		"ZAC (unsupported)",
> +		"none",
> +	};

Add a blank line after the declaration.

> +	if (class == 0 || (class - 1) >= ARRAY_SIZE(class_str))
> +		return "unknown";
> +	return class_str[class - 1];

Why class - 1 ? The class_str entries directly match the values of the
ATA_DEV_XXX macros...

> +}
> +
>  /**
>   *	ata_dev_classify - determine device type based on ATA-spec signature
>   *	@tf: ATA taskfile register set for device to be identified
> @@ -1007,36 +1028,50 @@ unsigned int ata_dev_classify(const struct ata_taskfile *tf)
>  	 * SEMB signature.  This is worked around in
>  	 * ata_dev_read_id().
>  	 */
> -	if ((tf->lbam == 0) && (tf->lbah == 0)) {
> -		DPRINTK("found ATA device by sig\n");
> +	if ((tf->lbam == 0) && (tf->lbah == 0))
>  		return ATA_DEV_ATA;
> -	}
>  
> -	if ((tf->lbam == 0x14) && (tf->lbah == 0xeb)) {
> -		DPRINTK("found ATAPI device by sig\n");
> +	if ((tf->lbam == 0x14) && (tf->lbah == 0xeb))
>  		return ATA_DEV_ATAPI;
> -	}
>  
> -	if ((tf->lbam == 0x69) && (tf->lbah == 0x96)) {
> -		DPRINTK("found PMP device by sig\n");
> +	if ((tf->lbam == 0x69) && (tf->lbah == 0x96))
>  		return ATA_DEV_PMP;
> -	}
>  
> -	if ((tf->lbam == 0x3c) && (tf->lbah == 0xc3)) {
> -		DPRINTK("found SEMB device by sig (could be ATA device)\n");
> +	if ((tf->lbam == 0x3c) && (tf->lbah == 0xc3))
>  		return ATA_DEV_SEMB;
> -	}
>  
> -	if ((tf->lbam == 0xcd) && (tf->lbah == 0xab)) {
> -		DPRINTK("found ZAC device by sig\n");
> +	if ((tf->lbam == 0xcd) && (tf->lbah == 0xab))
>  		return ATA_DEV_ZAC;
> -	}
>  
> -	DPRINTK("unknown device\n");
>  	return ATA_DEV_UNKNOWN;
>  }
>  EXPORT_SYMBOL_GPL(ata_dev_classify);
>  
> +/**
> + *     ata_port_classify - determine device type based on ATA-spec signature
> + *     @ap: ATA port device on which the classification should be run
> + *     @tf: ATA taskfile register set for device to be identified
> + *
> + *     A wrapper around ata_dev_classify() to provide additional logging
> + *
> + *     RETURNS:
> + *     Device type, %ATA_DEV_ATA, %ATA_DEV_ATAPI, %ATA_DEV_PMP,
> + *     %ATA_DEV_ZAC, or %ATA_DEV_UNKNOWN the event of failure.
> + */
> +unsigned int ata_port_classify(struct ata_port *ap,
> +			       const struct ata_taskfile *tf)
> +{
> +	unsigned int class = ata_dev_classify(tf);
> +
> +	if (class != ATA_DEV_UNKNOWN)
> +		ata_port_dbg(ap, "found %s device by sig\n",
> +			     ata_dev_class_string(class));
> +	else
> +		ata_port_dbg(ap, "found unknown device\n");

Why the if-else here ? ata_dev_class_string(() handles ATA_DEV_UNKNOWN and "bad"
class values saying "unknown" already. So this all seems redundant. If this is
removed, then ata_dev_class_string() could be coded in here since this is the
sole user of that helper.

> +	return class;
> +}
> +EXPORT_SYMBOL_GPL(ata_port_classify);
> +
>  /**
>   *	ata_id_string - Convert IDENTIFY DEVICE page into string
>   *	@id: IDENTIFY DEVICE results we will examine
> diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
> index 39c026f3948c..a119fabe0919 100644
> --- a/drivers/ata/libata-sff.c
> +++ b/drivers/ata/libata-sff.c
> @@ -1853,7 +1853,7 @@ unsigned int ata_sff_dev_classify(struct ata_device *dev, int present,
>  		return ATA_DEV_NONE;
>  
>  	/* determine if device is ATA or ATAPI */
> -	class = ata_dev_classify(&tf);
> +	class = ata_port_classify(ap, &tf);
>  
>  	if (class == ATA_DEV_UNKNOWN) {
>  		/* If the device failed diagnostic, it's likely to
> diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
> index e5838b23c9e0..dbc57b7a58b8 100644
> --- a/drivers/ata/sata_fsl.c
> +++ b/drivers/ata/sata_fsl.c
> @@ -812,7 +812,7 @@ static unsigned int sata_fsl_dev_classify(struct ata_port *ap)
>  	tf.lbal = (temp >> 8) & 0xff;
>  	tf.nsect = temp & 0xff;
>  
> -	return ata_dev_classify(&tf);
> +	return ata_port_classify(ap, &tf);
>  }
>  
>  static int sata_fsl_hardreset(struct ata_link *link, unsigned int *class,
> diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c
> index e517bd8822a5..b6239dae524a 100644
> --- a/drivers/ata/sata_inic162x.c
> +++ b/drivers/ata/sata_inic162x.c
> @@ -657,7 +657,7 @@ static int inic_hardreset(struct ata_link *link, unsigned int *class,
>  		}
>  
>  		inic_tf_read(ap, &tf);
> -		*class = ata_dev_classify(&tf);
> +		*class = ata_port_classify(ap, &tf);
>  	}
>  
>  	return 0;
> diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
> index f99ec6f7d7c0..7e9c1945dc81 100644
> --- a/drivers/ata/sata_sil24.c
> +++ b/drivers/ata/sata_sil24.c
> @@ -680,7 +680,7 @@ static int sil24_softreset(struct ata_link *link, unsigned int *class,
>  	}
>  
>  	sil24_read_tf(ap, 0, &tf);
> -	*class = ata_dev_classify(&tf);
> +	*class = ata_port_classify(ap, &tf);
>  
>  	DPRINTK("EXIT, class=%u\n", *class);
>  	return 0;
> diff --git a/include/linux/libata.h b/include/linux/libata.h
> index 2a8404b26083..235fdbeb19ea 100644
> --- a/include/linux/libata.h
> +++ b/include/linux/libata.h
> @@ -1160,6 +1160,8 @@ extern enum ata_completion_errors ata_noop_qc_prep(struct ata_queued_cmd *qc);
>  extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
>  		 unsigned int n_elem);
>  extern unsigned int ata_dev_classify(const struct ata_taskfile *tf);
> +extern unsigned int ata_port_classify(struct ata_port *ap,
> +				      const struct ata_taskfile *tf);
>  extern void ata_dev_disable(struct ata_device *adev);
>  extern void ata_id_string(const u16 *id, unsigned char *s,
>  			  unsigned int ofs, unsigned int len);
> 


-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 05/73] sata_mv: replace DPRINTK with 'pci_dump' module parameter
  2021-12-08 16:31 ` [PATCH 05/73] sata_mv: replace DPRINTK with 'pci_dump' module parameter Hannes Reinecke
@ 2021-12-09  0:38   ` Damien Le Moal
  2021-12-09  7:17     ` Hannes Reinecke
  0 siblings, 1 reply; 114+ messages in thread
From: Damien Le Moal @ 2021-12-09  0:38 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: linux-ide, Bartlomiej Zolnierkiewicz

On 2021/12/09 1:31, Hannes Reinecke wrote:
> Implement module parameter 'pci_dump' and move the DPRINTK calls
> over to dev_printk().
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> ---
>  drivers/ata/sata_mv.c | 88 ++++++++++++++++++++++++-------------------
>  1 file changed, 49 insertions(+), 39 deletions(-)
> 
> diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
> index cae4c1eab102..f0257685495f 100644
> --- a/drivers/ata/sata_mv.c
> +++ b/drivers/ata/sata_mv.c
> @@ -83,6 +83,10 @@ module_param(irq_coalescing_usecs, int, S_IRUGO);
>  MODULE_PARM_DESC(irq_coalescing_usecs,
>  		 "IRQ coalescing time threshold in usecs");
>  
> +static int pci_dump;
> +module_param(pci_dump, int, S_IRUGO);
> +MODULE_PARM_DESC(pci_dump, "Enable dumping of PCI registers on error");
> +
>  enum {
>  	/* BAR's are enumerated in terms of pci_resource_start() terms */
>  	MV_PRIMARY_BAR		= 0,	/* offset 0x10: memory space */
> @@ -1248,42 +1252,43 @@ static int mv_stop_edma(struct ata_port *ap)
>  	return err;
>  }
>  
> -#ifdef ATA_DEBUG
> -static void mv_dump_mem(void __iomem *start, unsigned bytes)
> +static void mv_dump_mem(struct device *dev, void __iomem *start, unsigned bytes)
>  {
> -	int b, w;
> +	int b, w, o;
> +	unsigned char linebuf[38];
> +
>  	for (b = 0; b < bytes; ) {
> -		DPRINTK("%p: ", start + b);
> -		for (w = 0; b < bytes && w < 4; w++) {
> -			printk("%08x ", readl(start + b));
> +		for (w = 0, o = 0; b < bytes && w < 4; w++) {
> +			o += snprintf(linebuf + o, 38 - o,
> +				      "%08x ", readl(start + b));
>  			b += sizeof(u32);
>  		}
> -		printk("\n");
> +		dev_printk(KERN_DEBUG, dev, "%s: %p: %s\n",
> +			   __func__, start + b, linebuf);

Why not dev_dbg() ? Same comment for all the prints below.

>  	}
>  }
> -#endif
> -#if defined(ATA_DEBUG) || defined(CONFIG_PCI)
> +
>  static void mv_dump_pci_cfg(struct pci_dev *pdev, unsigned bytes)
>  {
> -#ifdef ATA_DEBUG
> -	int b, w;
> +	int b, w, o;
>  	u32 dw;
> +	unsigned char linebuf[38];
> +
>  	for (b = 0; b < bytes; ) {
> -		DPRINTK("%02x: ", b);
> -		for (w = 0; b < bytes && w < 4; w++) {
> +		for (w = 0, o = 0; b < bytes && w < 4; w++) {
>  			(void) pci_read_config_dword(pdev, b, &dw);
> -			printk("%08x ", dw);
> +			o += snprintf(linebuf + o, 38 - o,
> +				      "%08x ", dw);
>  			b += sizeof(u32);
>  		}
> -		printk("\n");
> +		dev_printk(KERN_DEBUG, &pdev->dev, "%s: %02x: %s\n",
> +			   __func__, b, linebuf);
>  	}
> -#endif
>  }
> -#endif
> +
>  static void mv_dump_all_regs(void __iomem *mmio_base, int port,
>  			     struct pci_dev *pdev)
>  {
> -#ifdef ATA_DEBUG
>  	void __iomem *hc_base = mv_hc_base(mmio_base,
>  					   port >> MV_PORT_HC_SHIFT);
>  	void __iomem *port_base;
> @@ -1298,31 +1303,34 @@ static void mv_dump_all_regs(void __iomem *mmio_base, int port,
>  		start_port = port;
>  		num_ports = num_hcs = 1;
>  	}
> -	DPRINTK("All registers for port(s) %u-%u:\n", start_port,
> -		num_ports > 1 ? num_ports - 1 : start_port);
> +	dev_printk(KERN_DEBUG, &pdev->dev,
> +		   "%s: All registers for port(s) %u-%u:\n", __func__,
> +		   start_port, num_ports > 1 ? num_ports - 1 : start_port);
>  
> -	if (NULL != pdev) {
> -		DPRINTK("PCI config space regs:\n");
> -		mv_dump_pci_cfg(pdev, 0x68);
> -	}
> -	DPRINTK("PCI regs:\n");
> -	mv_dump_mem(mmio_base+0xc00, 0x3c);
> -	mv_dump_mem(mmio_base+0xd00, 0x34);
> -	mv_dump_mem(mmio_base+0xf00, 0x4);
> -	mv_dump_mem(mmio_base+0x1d00, 0x6c);
> +	dev_printk(KERN_DEBUG, &pdev->dev,
> +		   "%s: PCI config space regs:\n", __func__);
> +	mv_dump_pci_cfg(pdev, 0x68);
> +
> +	dev_printk(KERN_DEBUG, &pdev->dev, "%s: PCI regs:\n", __func__);
> +	mv_dump_mem(&pdev->dev, mmio_base+0xc00, 0x3c);
> +	mv_dump_mem(&pdev->dev, mmio_base+0xd00, 0x34);
> +	mv_dump_mem(&pdev->dev, mmio_base+0xf00, 0x4);
> +	mv_dump_mem(&pdev->dev, mmio_base+0x1d00, 0x6c);
>  	for (hc = start_hc; hc < start_hc + num_hcs; hc++) {
>  		hc_base = mv_hc_base(mmio_base, hc);
> -		DPRINTK("HC regs (HC %i):\n", hc);
> -		mv_dump_mem(hc_base, 0x1c);
> +		dev_printk(KERN_DEBUG, &pdev->dev, "%s: HC regs (HC %i):\n",
> +			   __func__, hc);
> +		mv_dump_mem(&pdev->dev, hc_base, 0x1c);
>  	}
>  	for (p = start_port; p < start_port + num_ports; p++) {
>  		port_base = mv_port_base(mmio_base, p);
> -		DPRINTK("EDMA regs (port %i):\n", p);
> -		mv_dump_mem(port_base, 0x54);
> -		DPRINTK("SATA regs (port %i):\n", p);
> -		mv_dump_mem(port_base+0x300, 0x60);
> +		dev_printk(KERN_DEBUG, &pdev->dev, "%s: EDMA regs (port %i):\n",
> +			   __func__, p);
> +		mv_dump_mem(&pdev->dev, port_base, 0x54);
> +		dev_printk(KERN_DEBUG, &pdev->dev, "%s: SATA regs (port %i):\n",
> +			   __func__, p);
> +		mv_dump_mem(&pdev->dev, port_base+0x300, 0x60);
>  	}
> -#endif
>  }
>  
>  static unsigned int mv_scr_offset(unsigned int sc_reg_in)
> @@ -2962,9 +2970,11 @@ static int mv_pci_error(struct ata_host *host, void __iomem *mmio)
>  
>  	dev_err(host->dev, "PCI ERROR; PCI IRQ cause=0x%08x\n", err_cause);
>  
> -	DPRINTK("All regs @ PCI error\n");
> -	mv_dump_all_regs(mmio, -1, to_pci_dev(host->dev));
> -
> +	if (pci_dump) {
> +		dev_printk(KERN_DEBUG, host->dev, "%s: All regs @ PCI error\n",
> +			   __func__);
> +		mv_dump_all_regs(mmio, -1, to_pci_dev(host->dev));
> +	}
>  	writelfl(0, mmio + hpriv->irq_cause_offset);
>  
>  	for (i = 0; i < host->n_ports; i++) {
> 


-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 06/73] sata_mv: kill 'port' argument in mv_dump_all_regs()
  2021-12-08 16:31 ` [PATCH 06/73] sata_mv: kill 'port' argument in mv_dump_all_regs() Hannes Reinecke
@ 2021-12-09  0:40   ` Damien Le Moal
  2021-12-09  8:19     ` Hannes Reinecke
  0 siblings, 1 reply; 114+ messages in thread
From: Damien Le Moal @ 2021-12-09  0:40 UTC (permalink / raw)
  To: Hannes Reinecke, Damien LeMoal; +Cc: linux-ide, Bartlomiej Zolnierkiewicz

On 2021/12/09 1:31, Hannes Reinecke wrote:
> Always '-1', so drop it and simplify the function.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> ---
>  drivers/ata/sata_mv.c | 24 +++++++-----------------
>  1 file changed, 7 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
> index f0257685495f..e86eddf83704 100644
> --- a/drivers/ata/sata_mv.c
> +++ b/drivers/ata/sata_mv.c
> @@ -1286,23 +1286,13 @@ static void mv_dump_pci_cfg(struct pci_dev *pdev, unsigned bytes)
>  	}
>  }
>  
> -static void mv_dump_all_regs(void __iomem *mmio_base, int port,
> -			     struct pci_dev *pdev)
> +static void mv_dump_all_regs(void __iomem *mmio_base, struct pci_dev *pdev)
>  {
> -	void __iomem *hc_base = mv_hc_base(mmio_base,
> -					   port >> MV_PORT_HC_SHIFT);
> -	void __iomem *port_base;
>  	int start_port, num_ports, p, start_hc, num_hcs, hc;
>  
> -	if (0 > port) {
> -		start_hc = start_port = 0;
> -		num_ports = 8;		/* shld be benign for 4 port devs */
> -		num_hcs = 2;
> -	} else {
> -		start_hc = port >> MV_PORT_HC_SHIFT;
> -		start_port = port;
> -		num_ports = num_hcs = 1;
> -	}
> +	start_hc = start_port = 0;
> +	num_ports = 8;		/* shld be benign for 4 port devs */
> +	num_hcs = 2;
>  	dev_printk(KERN_DEBUG, &pdev->dev,
>  		   "%s: All registers for port(s) %u-%u:\n", __func__,
>  		   start_port, num_ports > 1 ? num_ports - 1 : start_port);
> @@ -1317,13 +1307,13 @@ static void mv_dump_all_regs(void __iomem *mmio_base, int port,
>  	mv_dump_mem(&pdev->dev, mmio_base+0xf00, 0x4);
>  	mv_dump_mem(&pdev->dev, mmio_base+0x1d00, 0x6c);
>  	for (hc = start_hc; hc < start_hc + num_hcs; hc++) {
> -		hc_base = mv_hc_base(mmio_base, hc);
> +		void __iomem *hc_base = mv_hc_base(mmio_base, hc);

please add a blank line after the declaration.

>  		dev_printk(KERN_DEBUG, &pdev->dev, "%s: HC regs (HC %i):\n",
>  			   __func__, hc);

Change this to dev_dbg() while at it ?

>  		mv_dump_mem(&pdev->dev, hc_base, 0x1c);
>  	}
>  	for (p = start_port; p < start_port + num_ports; p++) {
> -		port_base = mv_port_base(mmio_base, p);
> +		void __iomem *port_base = mv_port_base(mmio_base, p);
>  		dev_printk(KERN_DEBUG, &pdev->dev, "%s: EDMA regs (port %i):\n",
>  			   __func__, p);

Same comments.

>  		mv_dump_mem(&pdev->dev, port_base, 0x54);
> @@ -2973,7 +2963,7 @@ static int mv_pci_error(struct ata_host *host, void __iomem *mmio)
>  	if (pci_dump) {
>  		dev_printk(KERN_DEBUG, host->dev, "%s: All regs @ PCI error\n",
>  			   __func__);
> -		mv_dump_all_regs(mmio, -1, to_pci_dev(host->dev));
> +		mv_dump_all_regs(mmio, to_pci_dev(host->dev));
>  	}
>  	writelfl(0, mmio + hpriv->irq_cause_offset);
>  
> 


-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 10/73] libata: drop debugging statements for bus-master DMA
  2021-12-08 16:31 ` [PATCH 10/73] libata: drop debugging statements " Hannes Reinecke
@ 2021-12-09  0:46   ` Damien Le Moal
  2021-12-09  8:20     ` Hannes Reinecke
  0 siblings, 1 reply; 114+ messages in thread
From: Damien Le Moal @ 2021-12-09  0:46 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: linux-ide, Bartlomiej Zolnierkiewicz

On 2021/12/09 1:31, Hannes Reinecke wrote:
> Bus-master DMA is now logged with generic tracepoints, so we can
> drop the DPRINTK()/VPRINTK and dev_dbg() calls here.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>

Wouldn't it be better to merge this in the previous patch ?

> ---
>  drivers/ata/libata-sff.c        | 18 +-----------------
>  drivers/ata/pata_octeon_cf.c    | 10 ++--------
>  drivers/ata/pata_pdc202xx_old.c |  2 --
>  drivers/ata/pata_sil680.c       |  1 -
>  drivers/ata/sata_dwc_460ex.c    | 18 ++++--------------
>  drivers/ata/sata_rcar.c         |  2 --
>  6 files changed, 7 insertions(+), 44 deletions(-)
> 
> diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
> index 60ac93a0bafb..4c923820d4f9 100644
> --- a/drivers/ata/libata-sff.c
> +++ b/drivers/ata/libata-sff.c
> @@ -409,12 +409,6 @@ void ata_sff_tf_load(struct ata_port *ap, const struct ata_taskfile *tf)
>  		iowrite8(tf->hob_lbal, ioaddr->lbal_addr);
>  		iowrite8(tf->hob_lbam, ioaddr->lbam_addr);
>  		iowrite8(tf->hob_lbah, ioaddr->lbah_addr);
> -		VPRINTK("hob: feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n",
> -			tf->hob_feature,
> -			tf->hob_nsect,
> -			tf->hob_lbal,
> -			tf->hob_lbam,
> -			tf->hob_lbah);
>  	}
>  
>  	if (is_addr) {
> @@ -423,18 +417,10 @@ void ata_sff_tf_load(struct ata_port *ap, const struct ata_taskfile *tf)
>  		iowrite8(tf->lbal, ioaddr->lbal_addr);
>  		iowrite8(tf->lbam, ioaddr->lbam_addr);
>  		iowrite8(tf->lbah, ioaddr->lbah_addr);
> -		VPRINTK("feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n",
> -			tf->feature,
> -			tf->nsect,
> -			tf->lbal,
> -			tf->lbam,
> -			tf->lbah);
>  	}
>  
> -	if (tf->flags & ATA_TFLAG_DEVICE) {
> +	if (tf->flags & ATA_TFLAG_DEVICE)
>  		iowrite8(tf->device, ioaddr->device_addr);
> -		VPRINTK("device 0x%X\n", tf->device);
> -	}
>  
>  	ata_wait_idle(ap);
>  }
> @@ -494,8 +480,6 @@ EXPORT_SYMBOL_GPL(ata_sff_tf_read);
>   */
>  void ata_sff_exec_command(struct ata_port *ap, const struct ata_taskfile *tf)
>  {
> -	DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command);
> -
>  	iowrite8(tf->command, ap->ioaddr.command_addr);
>  	ata_sff_pause(ap);
>  }
> diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
> index cdc95eb2b2cb..06468a1f4807 100644
> --- a/drivers/ata/pata_octeon_cf.c
> +++ b/drivers/ata/pata_octeon_cf.c
> @@ -514,20 +514,14 @@ static void octeon_cf_exec_command16(struct ata_port *ap,
>  {
>  	/* The base of the registers is at ioaddr.data_addr. */
>  	void __iomem *base = ap->ioaddr.data_addr;
> -	u16 blob;
> +	u16 blob = 0;
>  
> -	if (tf->flags & ATA_TFLAG_DEVICE) {
> -		VPRINTK("device 0x%X\n", tf->device);
> +	if (tf->flags & ATA_TFLAG_DEVICE)
>  		blob = tf->device;
> -	} else {
> -		blob = 0;
> -	}
>  
> -	DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command);
>  	blob |= (tf->command << 8);
>  	__raw_writew(blob, base + 6);
>  
> -
>  	ata_wait_idle(ap);
>  }
>  
> diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c
> index 0c5cbcd28d0d..b99849095853 100644
> --- a/drivers/ata/pata_pdc202xx_old.c
> +++ b/drivers/ata/pata_pdc202xx_old.c
> @@ -38,8 +38,6 @@ static int pdc2026x_cable_detect(struct ata_port *ap)
>  static void pdc202xx_exec_command(struct ata_port *ap,
>  				  const struct ata_taskfile *tf)
>  {
> -	DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command);
> -
>  	iowrite8(tf->command, ap->ioaddr.command_addr);
>  	ndelay(400);
>  }
> diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c
> index 43215a664b96..81238e097fe2 100644
> --- a/drivers/ata/pata_sil680.c
> +++ b/drivers/ata/pata_sil680.c
> @@ -212,7 +212,6 @@ static void sil680_set_dmamode(struct ata_port *ap, struct ata_device *adev)
>  static void sil680_sff_exec_command(struct ata_port *ap,
>  				    const struct ata_taskfile *tf)
>  {
> -	DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command);
>  	iowrite8(tf->command, ap->ioaddr.command_addr);
>  	ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_CMD);
>  }
> diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c
> index 338c2e50f759..f5ef5ce5f758 100644
> --- a/drivers/ata/sata_dwc_460ex.c
> +++ b/drivers/ata/sata_dwc_460ex.c
> @@ -980,9 +980,6 @@ static void sata_dwc_exec_command_by_tag(struct ata_port *ap,
>  {
>  	struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap);
>  
> -	dev_dbg(ap->dev, "%s cmd(0x%02x): %s tag=%d\n", __func__, tf->command,
> -		ata_get_cmd_descript(tf->command), tag);
> -
>  	hsdevp->cmd_issued[tag] = cmd_issued;
>  
>  	/*
> @@ -1005,12 +1002,9 @@ static void sata_dwc_bmdma_setup(struct ata_queued_cmd *qc)
>  {
>  	u8 tag = qc->hw_tag;
>  
> -	if (ata_is_ncq(qc->tf.protocol)) {
> -		dev_dbg(qc->ap->dev, "%s: ap->link.sactive=0x%08x tag=%d\n",
> -			__func__, qc->ap->link.sactive, tag);
> -	} else {
> +	if (!ata_is_ncq(qc->tf.protocol))
>  		tag = 0;
> -	}
> +
>  	sata_dwc_bmdma_setup_by_tag(qc, tag);
>  }
>  
> @@ -1067,13 +1061,9 @@ static void sata_dwc_bmdma_start(struct ata_queued_cmd *qc)
>  {
>  	u8 tag = qc->hw_tag;
>  
> -	if (ata_is_ncq(qc->tf.protocol)) {
> -		dev_dbg(qc->ap->dev, "%s: ap->link.sactive=0x%08x tag=%d\n",
> -			__func__, qc->ap->link.sactive, tag);
> -	} else {
> +	if (!ata_is_ncq(qc->tf.protocol))
>  		tag = 0;
> -	}
> -	dev_dbg(qc->ap->dev, "%s\n", __func__);
> +
>  	sata_dwc_bmdma_start_by_tag(qc, tag);
>  }
>  
> diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
> index 9005833ab02f..b4994d182eda 100644
> --- a/drivers/ata/sata_rcar.c
> +++ b/drivers/ata/sata_rcar.c
> @@ -436,8 +436,6 @@ static void sata_rcar_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
>  static void sata_rcar_exec_command(struct ata_port *ap,
>  				   const struct ata_taskfile *tf)
>  {
> -	DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command);
> -
>  	iowrite32(tf->command, ap->ioaddr.command_addr);
>  	ata_sff_pause(ap);
>  }
> 


-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 08/73] libata: drop DPRINTK() calls in reset
  2021-12-08 16:31 ` [PATCH 08/73] libata: drop DPRINTK() calls in reset Hannes Reinecke
@ 2021-12-09  0:47   ` Damien Le Moal
  0 siblings, 0 replies; 114+ messages in thread
From: Damien Le Moal @ 2021-12-09  0:47 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: linux-ide, Bartlomiej Zolnierkiewicz

On 2021/12/09 1:31, Hannes Reinecke wrote:
> Reset is now logged with tracepoints, so the DPRINTK() calls can
> be dropped.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>

This could be merged with the previous patch, no ? This way, a single patch
switch from old DPRINTK() to modern tracepoints.

> ---
>  drivers/ata/ahci.c           |  7 -------
>  drivers/ata/ahci_qoriq.c     |  4 ----
>  drivers/ata/libahci.c        | 10 ----------
>  drivers/ata/libata-core.c    |  4 ----
>  drivers/ata/libata-sff.c     | 11 +----------
>  drivers/ata/pata_octeon_cf.c |  2 --
>  drivers/ata/sata_fsl.c       | 10 ----------
>  drivers/ata/sata_rcar.c      |  4 ----
>  drivers/ata/sata_sil24.c     |  3 ---
>  9 files changed, 1 insertion(+), 54 deletions(-)
> 
> diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
> index 5fa8a12c6b3b..6a867ef64c9c 100644
> --- a/drivers/ata/ahci.c
> +++ b/drivers/ata/ahci.c
> @@ -699,8 +699,6 @@ static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class,
>  	bool online;
>  	int rc;
>  
> -	DPRINTK("ENTER\n");
> -
>  	hpriv->stop_engine(ap);
>  
>  	rc = sata_link_hardreset(link, sata_ehc_deb_timing(&link->eh_context),
> @@ -708,8 +706,6 @@ static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class,
>  
>  	hpriv->start_engine(ap);
>  
> -	DPRINTK("EXIT, rc=%d, class=%u\n", rc, *class);
> -
>  	/* vt8251 doesn't clear BSY on signature FIS reception,
>  	 * request follow-up softreset.
>  	 */
> @@ -789,8 +785,6 @@ static int ahci_avn_hardreset(struct ata_link *link, unsigned int *class,
>  	bool online;
>  	int rc, i;
>  
> -	DPRINTK("ENTER\n");
> -
>  	hpriv->stop_engine(ap);
>  
>  	for (i = 0; i < 2; i++) {
> @@ -828,7 +822,6 @@ static int ahci_avn_hardreset(struct ata_link *link, unsigned int *class,
>  	if (online)
>  		*class = ahci_dev_classify(ap);
>  
> -	DPRINTK("EXIT, rc=%d, class=%u\n", rc, *class);
>  	return rc;
>  }
>  
> diff --git a/drivers/ata/ahci_qoriq.c b/drivers/ata/ahci_qoriq.c
> index 5b46fc9aeb4a..bf5b388bd4e0 100644
> --- a/drivers/ata/ahci_qoriq.c
> +++ b/drivers/ata/ahci_qoriq.c
> @@ -103,8 +103,6 @@ static int ahci_qoriq_hardreset(struct ata_link *link, unsigned int *class,
>  	int rc;
>  	bool ls1021a_workaround = (qoriq_priv->type == AHCI_LS1021A);
>  
> -	DPRINTK("ENTER\n");
> -
>  	hpriv->stop_engine(ap);
>  
>  	/*
> @@ -146,8 +144,6 @@ static int ahci_qoriq_hardreset(struct ata_link *link, unsigned int *class,
>  
>  	if (online)
>  		*class = ahci_dev_classify(ap);
> -
> -	DPRINTK("EXIT, rc=%d, class=%u\n", rc, *class);
>  	return rc;
>  }
>  
> diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
> index 21dbcd551443..ee7e63da0437 100644
> --- a/drivers/ata/libahci.c
> +++ b/drivers/ata/libahci.c
> @@ -1415,8 +1415,6 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class,
>  	bool fbs_disabled = false;
>  	int rc;
>  
> -	DPRINTK("ENTER\n");
> -
>  	/* prepare for SRST (AHCI-1.1 10.4.1) */
>  	rc = ahci_kick_engine(ap);
>  	if (rc && rc != -EOPNOTSUPP)
> @@ -1476,7 +1474,6 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class,
>  	if (fbs_disabled)
>  		ahci_enable_fbs(ap);
>  
> -	DPRINTK("EXIT, class=%u\n", *class);
>  	return 0;
>  
>   fail:
> @@ -1498,8 +1495,6 @@ static int ahci_softreset(struct ata_link *link, unsigned int *class,
>  {
>  	int pmp = sata_srst_pmp(link);
>  
> -	DPRINTK("ENTER\n");
> -
>  	return ahci_do_softreset(link, class, pmp, deadline, ahci_check_ready);
>  }
>  EXPORT_SYMBOL_GPL(ahci_do_softreset);
> @@ -1529,8 +1524,6 @@ static int ahci_pmp_retry_softreset(struct ata_link *link, unsigned int *class,
>  	int rc;
>  	u32 irq_sts;
>  
> -	DPRINTK("ENTER\n");
> -
>  	rc = ahci_do_softreset(link, class, pmp, deadline,
>  			       ahci_bad_pmp_check_ready);
>  
> @@ -1564,8 +1557,6 @@ int ahci_do_hardreset(struct ata_link *link, unsigned int *class,
>  	struct ata_taskfile tf;
>  	int rc;
>  
> -	DPRINTK("ENTER\n");
> -
>  	hpriv->stop_engine(ap);
>  
>  	/* clear D2H reception area to properly wait for D2H FIS */
> @@ -1581,7 +1572,6 @@ int ahci_do_hardreset(struct ata_link *link, unsigned int *class,
>  	if (*online)
>  		*class = ahci_dev_classify(ap);
>  
> -	DPRINTK("EXIT, rc=%d, class=%u\n", rc, *class);
>  	return rc;
>  }
>  EXPORT_SYMBOL_GPL(ahci_do_hardreset);
> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> index 3977da2d098e..02cd8fe1acab 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -3697,16 +3697,12 @@ void ata_std_postreset(struct ata_link *link, unsigned int *classes)
>  {
>  	u32 serror;
>  
> -	DPRINTK("ENTER\n");
> -
>  	/* reset complete, clear SError */
>  	if (!sata_scr_read(link, SCR_ERROR, &serror))
>  		sata_scr_write(link, SCR_ERROR, serror);
>  
>  	/* print link status */
>  	sata_print_link_status(link);
> -
> -	DPRINTK("EXIT\n");
>  }
>  EXPORT_SYMBOL_GPL(ata_std_postreset);
>  
> diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
> index a119fabe0919..4cc7c0606e06 100644
> --- a/drivers/ata/libata-sff.c
> +++ b/drivers/ata/libata-sff.c
> @@ -1956,8 +1956,6 @@ static int ata_bus_softreset(struct ata_port *ap, unsigned int devmask,
>  {
>  	struct ata_ioports *ioaddr = &ap->ioaddr;
>  
> -	DPRINTK("ata%u: bus reset via SRST\n", ap->print_id);
> -
>  	if (ap->ioaddr.ctl_addr) {
>  		/* software reset.  causes dev0 to be selected */
>  		iowrite8(ap->ctl, ioaddr->ctl_addr);
> @@ -1995,8 +1993,6 @@ int ata_sff_softreset(struct ata_link *link, unsigned int *classes,
>  	int rc;
>  	u8 err;
>  
> -	DPRINTK("ENTER\n");
> -
>  	/* determine if device 0/1 are present */
>  	if (ata_devchk(ap, 0))
>  		devmask |= (1 << 0);
> @@ -2007,7 +2003,6 @@ int ata_sff_softreset(struct ata_link *link, unsigned int *classes,
>  	ap->ops->sff_dev_select(ap, 0);
>  
>  	/* issue bus reset */
> -	DPRINTK("about to softreset, devmask=%x\n", devmask);
>  	rc = ata_bus_softreset(ap, devmask, deadline);
>  	/* if link is occupied, -ENODEV too is an error */
>  	if (rc && (rc != -ENODEV || sata_scr_valid(link))) {
> @@ -2022,7 +2017,6 @@ int ata_sff_softreset(struct ata_link *link, unsigned int *classes,
>  		classes[1] = ata_sff_dev_classify(&link->device[1],
>  						  devmask & (1 << 1), &err);
>  
> -	DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]);
>  	return 0;
>  }
>  EXPORT_SYMBOL_GPL(ata_sff_softreset);
> @@ -2055,7 +2049,6 @@ int sata_sff_hardreset(struct ata_link *link, unsigned int *class,
>  	if (online)
>  		*class = ata_sff_dev_classify(link->device, 1, NULL);
>  
> -	DPRINTK("EXIT, class=%u\n", *class);
>  	return rc;
>  }
>  EXPORT_SYMBOL_GPL(sata_sff_hardreset);
> @@ -2085,10 +2078,8 @@ void ata_sff_postreset(struct ata_link *link, unsigned int *classes)
>  		ap->ops->sff_dev_select(ap, 0);
>  
>  	/* bail out if no device is present */
> -	if (classes[0] == ATA_DEV_NONE && classes[1] == ATA_DEV_NONE) {
> -		DPRINTK("EXIT, no device\n");
> +	if (classes[0] == ATA_DEV_NONE && classes[1] == ATA_DEV_NONE)
>  		return;
> -	}
>  
>  	/* set up device control */
>  	if (ap->ops->sff_set_devctl || ap->ioaddr.ctl_addr) {
> diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
> index b5a3f710d76d..cdc95eb2b2cb 100644
> --- a/drivers/ata/pata_octeon_cf.c
> +++ b/drivers/ata/pata_octeon_cf.c
> @@ -440,7 +440,6 @@ static int octeon_cf_softreset16(struct ata_link *link, unsigned int *classes,
>  	int rc;
>  	u8 err;
>  
> -	DPRINTK("about to softreset\n");
>  	__raw_writew(ap->ctl, base + 0xe);
>  	udelay(20);
>  	__raw_writew(ap->ctl | ATA_SRST, base + 0xe);
> @@ -455,7 +454,6 @@ static int octeon_cf_softreset16(struct ata_link *link, unsigned int *classes,
>  
>  	/* determine by signature whether we have ATA or ATAPI devices */
>  	classes[0] = ata_sff_dev_classify(&link->device[0], 1, &err);
> -	DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]);
>  	return 0;
>  }
>  
> diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
> index dbc57b7a58b8..5421625dcf6e 100644
> --- a/drivers/ata/sata_fsl.c
> +++ b/drivers/ata/sata_fsl.c
> @@ -825,8 +825,6 @@ static int sata_fsl_hardreset(struct ata_link *link, unsigned int *class,
>  	int i = 0;
>  	unsigned long start_jiffies;
>  
> -	DPRINTK("in xx_hardreset\n");
> -
>  try_offline_again:
>  	/*
>  	 * Force host controller to go off-line, aborting current operations
> @@ -941,10 +939,7 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
>  	u8 *cfis;
>  	u32 Serror;
>  
> -	DPRINTK("in xx_softreset\n");
> -
>  	if (ata_link_offline(link)) {
> -		DPRINTK("PHY reports no device\n");
>  		*class = ATA_DEV_NONE;
>  		return 0;
>  	}
> @@ -957,8 +952,6 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
>  	 * reached here, we can send a command to the target device
>  	 */
>  
> -	DPRINTK("Sending SRST/device reset\n");
> -
>  	ata_tf_init(link->device, &tf);
>  	cfis = (u8 *) &pp->cmdentry->cfis;
>  
> @@ -1030,8 +1023,6 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
>  	 */
>  	iowrite32(0x01, CC + hcr_base);	/* We know it will be cmd#0 always */
>  
> -	DPRINTK("SATA FSL : Now checking device signature\n");
> -
>  	*class = ATA_DEV_NONE;
>  
>  	/* Verify if SStatus indicates device presence */
> @@ -1045,7 +1036,6 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
>  
>  		*class = sata_fsl_dev_classify(ap);
>  
> -		DPRINTK("class = %d\n", *class);
>  		VPRINTK("ccreg = 0x%x\n", ioread32(hcr_base + CC));
>  		VPRINTK("cereg = 0x%x\n", ioread32(hcr_base + CE));
>  	}
> diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
> index 44b0ed8f6bb8..9005833ab02f 100644
> --- a/drivers/ata/sata_rcar.c
> +++ b/drivers/ata/sata_rcar.c
> @@ -323,8 +323,6 @@ static int sata_rcar_bus_softreset(struct ata_port *ap, unsigned long deadline)
>  {
>  	struct ata_ioports *ioaddr = &ap->ioaddr;
>  
> -	DPRINTK("ata%u: bus reset via SRST\n", ap->print_id);
> -
>  	/* software reset.  causes dev0 to be selected */
>  	iowrite32(ap->ctl, ioaddr->ctl_addr);
>  	udelay(20);
> @@ -350,7 +348,6 @@ static int sata_rcar_softreset(struct ata_link *link, unsigned int *classes,
>  		devmask |= 1 << 0;
>  
>  	/* issue bus reset */
> -	DPRINTK("about to softreset, devmask=%x\n", devmask);
>  	rc = sata_rcar_bus_softreset(ap, deadline);
>  	/* if link is occupied, -ENODEV too is an error */
>  	if (rc && (rc != -ENODEV || sata_scr_valid(link))) {
> @@ -361,7 +358,6 @@ static int sata_rcar_softreset(struct ata_link *link, unsigned int *classes,
>  	/* determine by signature whether we have ATA or ATAPI devices */
>  	classes[0] = ata_sff_dev_classify(&link->device[0], devmask, &err);
>  
> -	DPRINTK("classes[0]=%u\n", classes[0]);
>  	return 0;
>  }
>  
> diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
> index 7e9c1945dc81..2fef6ce93f07 100644
> --- a/drivers/ata/sata_sil24.c
> +++ b/drivers/ata/sata_sil24.c
> @@ -656,8 +656,6 @@ static int sil24_softreset(struct ata_link *link, unsigned int *class,
>  	const char *reason;
>  	int rc;
>  
> -	DPRINTK("ENTER\n");
> -
>  	/* put the port into known state */
>  	if (sil24_init_port(ap)) {
>  		reason = "port not ready";
> @@ -682,7 +680,6 @@ static int sil24_softreset(struct ata_link *link, unsigned int *class,
>  	sil24_read_tf(ap, 0, &tf);
>  	*class = ata_port_classify(ap, &tf);
>  
> -	DPRINTK("EXIT, class=%u\n", *class);
>  	return 0;
>  
>   err:
> 


-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 19/73] libata: drop DPRINTK() calls during ATA error handling
  2021-12-08 16:32 ` [PATCH 19/73] libata: drop DPRINTK() calls during " Hannes Reinecke
@ 2021-12-09  0:50   ` Damien Le Moal
  0 siblings, 0 replies; 114+ messages in thread
From: Damien Le Moal @ 2021-12-09  0:50 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: linux-ide, Bartlomiej Zolnierkiewicz

On 2021/12/09 1:32, Hannes Reinecke wrote:
> The information is now logged with tracepoints, so the DPRINTK()
> calls can be dropped.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>

squash this one in the previous patch ?

> ---
>  drivers/ata/libata-eh.c   | 12 ------------
>  drivers/ata/libata-pmp.c  |  8 --------
>  drivers/ata/libata-sata.c |  3 ---
>  3 files changed, 23 deletions(-)
> 
> diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
> index 2a25be588e14..a0fd38260f48 100644
> --- a/drivers/ata/libata-eh.c
> +++ b/drivers/ata/libata-eh.c
> @@ -533,8 +533,6 @@ void ata_scsi_error(struct Scsi_Host *host)
>  	unsigned long flags;
>  	LIST_HEAD(eh_work_q);
>  
> -	DPRINTK("ENTER\n");
> -
>  	spin_lock_irqsave(host->host_lock, flags);
>  	list_splice_init(&host->eh_cmd_q, &eh_work_q);
>  	spin_unlock_irqrestore(host->host_lock, flags);
> @@ -548,7 +546,6 @@ void ata_scsi_error(struct Scsi_Host *host)
>  	/* finish or retry handled scmd's and clean up */
>  	WARN_ON(!list_empty(&eh_work_q));
>  
> -	DPRINTK("EXIT\n");
>  }
>  
>  /**
> @@ -1932,8 +1929,6 @@ static void ata_eh_link_autopsy(struct ata_link *link)
>  	u32 serror;
>  	int rc;
>  
> -	DPRINTK("ENTER\n");
> -
>  	if (ehc->i.flags & ATA_EHI_NO_AUTOPSY)
>  		return;
>  
> @@ -2040,7 +2035,6 @@ static void ata_eh_link_autopsy(struct ata_link *link)
>  		ehc->i.action |= ata_eh_speed_down(dev, eflags, all_err_mask);
>  		trace_ata_eh_link_autopsy(dev, ehc->i.action, all_err_mask);
>  	}
> -	DPRINTK("EXIT\n");
>  }
>  
>  /**
> @@ -2940,8 +2934,6 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
>  	unsigned long flags;
>  	int rc = 0;
>  
> -	DPRINTK("ENTER\n");
> -
>  	/* For PATA drive side cable detection to work, IDENTIFY must
>  	 * be done backwards such that PDIAG- is released by the slave
>  	 * device before the master device is identified.
> @@ -3055,7 +3047,6 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
>  
>   err:
>  	*r_failed_dev = dev;
> -	DPRINTK("EXIT rc=%d\n", rc);
>  	return rc;
>  }
>  
> @@ -3570,8 +3561,6 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
>  	int rc, nr_fails;
>  	unsigned long flags, deadline;
>  
> -	DPRINTK("ENTER\n");
> -
>  	/* prep for recovery */
>  	ata_for_each_link(link, ap, EDGE) {
>  		struct ata_eh_context *ehc = &link->eh_context;
> @@ -3779,7 +3768,6 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
>  	if (rc && r_failed_link)
>  		*r_failed_link = link;
>  
> -	DPRINTK("EXIT, rc=%d\n", rc);
>  	return rc;
>  }
>  
> diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c
> index ba7be3f38617..e2e9cbd405fa 100644
> --- a/drivers/ata/libata-pmp.c
> +++ b/drivers/ata/libata-pmp.c
> @@ -652,8 +652,6 @@ static int sata_pmp_revalidate(struct ata_device *dev, unsigned int new_class)
>  	u32 *gscr = (void *)ap->sector_buf;
>  	int rc;
>  
> -	DPRINTK("ENTER\n");
> -
>  	ata_eh_about_to_do(link, NULL, ATA_EH_REVALIDATE);
>  
>  	if (!ata_dev_enabled(dev)) {
> @@ -686,12 +684,10 @@ static int sata_pmp_revalidate(struct ata_device *dev, unsigned int new_class)
>  
>  	ata_eh_done(link, NULL, ATA_EH_REVALIDATE);
>  
> -	DPRINTK("EXIT, rc=0\n");
>  	return 0;
>  
>   fail:
>  	ata_dev_err(dev, "PMP revalidation failed (errno=%d)\n", rc);
> -	DPRINTK("EXIT, rc=%d\n", rc);
>  	return rc;
>  }
>  
> @@ -759,8 +755,6 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap,
>  	int detach = 0, rc = 0;
>  	int reval_failed = 0;
>  
> -	DPRINTK("ENTER\n");
> -
>  	if (dev->flags & ATA_DFLAG_DETACH) {
>  		detach = 1;
>  		rc = -ENODEV;
> @@ -828,7 +822,6 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap,
>  	/* okay, PMP resurrected */
>  	ehc->i.flags = 0;
>  
> -	DPRINTK("EXIT, rc=0\n");
>  	return 0;
>  
>   fail:
> @@ -838,7 +831,6 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap,
>  	else
>  		ata_dev_disable(dev);
>  
> -	DPRINTK("EXIT, rc=%d\n", rc);
>  	return rc;
>  }
>  
> diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c
> index 4e88597aa9df..7b72c68bc9f7 100644
> --- a/drivers/ata/libata-sata.c
> +++ b/drivers/ata/libata-sata.c
> @@ -533,8 +533,6 @@ int sata_link_hardreset(struct ata_link *link, const unsigned long *timing,
>  	u32 scontrol;
>  	int rc;
>  
> -	DPRINTK("ENTER\n");
> -
>  	if (online)
>  		*online = false;
>  
> @@ -610,7 +608,6 @@ int sata_link_hardreset(struct ata_link *link, const unsigned long *timing,
>  			*online = false;
>  		ata_link_err(link, "COMRESET failed (errno=%d)\n", rc);
>  	}
> -	DPRINTK("EXIT, rc=%d\n", rc);
>  	return rc;
>  }
>  EXPORT_SYMBOL_GPL(sata_link_hardreset);
> 


-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 20/73] libata-eh: remove DPRINTK() calls for request sense
  2021-12-08 16:32 ` [PATCH 20/73] libata-eh: remove DPRINTK() calls for request sense Hannes Reinecke
@ 2021-12-09  0:51   ` Damien Le Moal
  0 siblings, 0 replies; 114+ messages in thread
From: Damien Le Moal @ 2021-12-09  0:51 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: linux-ide, Bartlomiej Zolnierkiewicz

On 2021/12/09 1:32, Hannes Reinecke wrote:
> The information will printed during ata_qc_issue() anyway, so

s/will/will be

> this messages can be dropped.

s/this/these

> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> ---
>  drivers/ata/libata-eh.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
> index a0fd38260f48..69f51616d8bd 100644
> --- a/drivers/ata/libata-eh.c
> +++ b/drivers/ata/libata-eh.c
> @@ -1422,8 +1422,6 @@ static void ata_eh_request_sense(struct ata_queued_cmd *qc,
>  		return;
>  	}
>  
> -	DPRINTK("ATA request sense\n");
> -
>  	ata_tf_init(dev, &tf);
>  	tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
>  	tf.flags |= ATA_TFLAG_LBA | ATA_TFLAG_LBA48;
> @@ -1464,8 +1462,6 @@ unsigned int atapi_eh_request_sense(struct ata_device *dev,
>  	struct ata_port *ap = dev->link->ap;
>  	struct ata_taskfile tf;
>  
> -	DPRINTK("ATAPI request sense\n");
> -
>  	memset(sense_buf, 0, SCSI_SENSE_BUFFERSIZE);
>  
>  	/* initialize sense_buf with the error register,
> 


-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 21/73] libata: move ata_{port,link,dev}_dbg to standard dev_XXX() macros
  2021-12-08 16:32 ` [PATCH 21/73] libata: move ata_{port,link,dev}_dbg to standard dev_XXX() macros Hannes Reinecke
@ 2021-12-09  0:57   ` Damien Le Moal
  0 siblings, 0 replies; 114+ messages in thread
From: Damien Le Moal @ 2021-12-09  0:57 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: linux-ide

On 2021/12/09 1:32, Hannes Reinecke wrote:
> Use standard dev_{dbg,info,notice,warn,err} macros instead of the
> hand-crafted printk helpers.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>  drivers/ata/libata-acpi.c    | 48 +++++++++++++++-------------
>  drivers/ata/libata-core.c    | 61 ------------------------------------
>  drivers/ata/pata_ixp4xx_cf.c |  6 ++--
>  include/linux/libata.h       | 48 ++++++++++------------------
>  4 files changed, 45 insertions(+), 118 deletions(-)
> 
> diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
> index 7a7d6642edcc..7007377880ce 100644
> --- a/drivers/ata/libata-acpi.c
> +++ b/drivers/ata/libata-acpi.c
> @@ -650,9 +650,7 @@ static int ata_acpi_run_tf(struct ata_device *dev,
>  	struct ata_taskfile *pptf = NULL;
>  	struct ata_taskfile tf, ptf, rtf;
>  	unsigned int err_mask;
> -	const char *level;
>  	const char *descr;
> -	char msg[60];
>  	int rc;
>  
>  	if ((gtf->tf[0] == 0) && (gtf->tf[1] == 0) && (gtf->tf[2] == 0)
> @@ -666,6 +664,10 @@ static int ata_acpi_run_tf(struct ata_device *dev,
>  		pptf = &ptf;
>  	}
>  
> +	descr = ata_get_cmd_descript(tf.command);
> +	if (!descr)
> +		descr = "unknown";

Change ata_get_cmd_descript() last silly "return NULL;" to "return "unknown";"
and you can avoid the if here, and even the descr local variable.
This could be done in a prep patch.

While at it, I would rename this function to ata_cmd_name() to simplify things
("descript" is very misleading for just human readable string...).

> +
>  	if (!ata_acpi_filter_tf(dev, &tf, pptf)) {
>  		rtf = tf;
>  		err_mask = ata_exec_internal(dev, &rtf, NULL,
> @@ -673,40 +675,42 @@ static int ata_acpi_run_tf(struct ata_device *dev,
>  
>  		switch (err_mask) {
>  		case 0:
> -			level = KERN_DEBUG;
> -			snprintf(msg, sizeof(msg), "succeeded");
> +			ata_dev_dbg(dev,
> +				"ACPI cmd %02x/%02x:%02x:%02x:%02x:%02x:%02x"
> +				"(%s) succeeded\n",
> +				tf.command, tf.feature, tf.nsect, tf.lbal,
> +				tf.lbam, tf.lbah, tf.device, descr);
>  			rc = 1;
>  			break;
>  
>  		case AC_ERR_DEV:
> -			level = KERN_INFO;
> -			snprintf(msg, sizeof(msg),
> -				 "rejected by device (Stat=0x%02x Err=0x%02x)",
> -				 rtf.command, rtf.feature);
> +			ata_dev_info(dev,
> +				"ACPI cmd %02x/%02x:%02x:%02x:%02x:%02x:%02x"
> +				"(%s) rejected by device (Stat=0x%02x Err=0x%02x)",
> +				tf.command, tf.feature, tf.nsect, tf.lbal,
> +				tf.lbam, tf.lbah, tf.device, descr,
> +				rtf.command, rtf.feature);
>  			rc = 0;
>  			break;
>  
>  		default:
> -			level = KERN_ERR;
> -			snprintf(msg, sizeof(msg),
> -				 "failed (Emask=0x%x Stat=0x%02x Err=0x%02x)",
> -				 err_mask, rtf.command, rtf.feature);
> +			ata_dev_err(dev,
> +				"ACPI cmd %02x/%02x:%02x:%02x:%02x:%02x:%02x"
> +				"(%s) failed (Emask=0x%x Stat=0x%02x Err=0x%02x)",
> +				tf.command, tf.feature, tf.nsect, tf.lbal,
> +				tf.lbam, tf.lbah, tf.device, descr,
> +				err_mask, rtf.command, rtf.feature);
>  			rc = -EIO;
>  			break;
>  		}
>  	} else {
> -		level = KERN_INFO;
> -		snprintf(msg, sizeof(msg), "filtered out");
> +		ata_dev_info(dev,
> +			"ACPI cmd %02x/%02x:%02x:%02x:%02x:%02x:%02x"
> +			"(%s) filtered out\n",
> +			tf.command, tf.feature, tf.nsect, tf.lbal,
> +			tf.lbam, tf.lbah, tf.device, descr);
>  		rc = 0;
>  	}
> -	descr = ata_get_cmd_descript(tf.command);
> -
> -	ata_dev_printk(dev, level,
> -		       "ACPI cmd %02x/%02x:%02x:%02x:%02x:%02x:%02x (%s) %s\n",
> -		       tf.command, tf.feature, tf.nsect, tf.lbal,
> -		       tf.lbam, tf.lbah, tf.device,
> -		       (descr ? descr : "unknown"), msg);
> -
>  	return rc;
>  }
>  
> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> index ef5ae37bfac0..de5f4bf1c90c 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -6548,67 +6548,6 @@ const struct ata_port_info ata_dummy_port_info = {
>  };
>  EXPORT_SYMBOL_GPL(ata_dummy_port_info);
>  
> -/*
> - * Utility print functions
> - */
> -void ata_port_printk(const struct ata_port *ap, const char *level,
> -		     const char *fmt, ...)
> -{
> -	struct va_format vaf;
> -	va_list args;
> -
> -	va_start(args, fmt);
> -
> -	vaf.fmt = fmt;
> -	vaf.va = &args;
> -
> -	printk("%sata%u: %pV", level, ap->print_id, &vaf);
> -
> -	va_end(args);
> -}
> -EXPORT_SYMBOL(ata_port_printk);
> -
> -void ata_link_printk(const struct ata_link *link, const char *level,
> -		     const char *fmt, ...)
> -{
> -	struct va_format vaf;
> -	va_list args;
> -
> -	va_start(args, fmt);
> -
> -	vaf.fmt = fmt;
> -	vaf.va = &args;
> -
> -	if (sata_pmp_attached(link->ap) || link->ap->slave_link)
> -		printk("%sata%u.%02u: %pV",
> -		       level, link->ap->print_id, link->pmp, &vaf);
> -	else
> -		printk("%sata%u: %pV",
> -		       level, link->ap->print_id, &vaf);
> -
> -	va_end(args);
> -}
> -EXPORT_SYMBOL(ata_link_printk);
> -
> -void ata_dev_printk(const struct ata_device *dev, const char *level,
> -		    const char *fmt, ...)
> -{
> -	struct va_format vaf;
> -	va_list args;
> -
> -	va_start(args, fmt);
> -
> -	vaf.fmt = fmt;
> -	vaf.va = &args;
> -
> -	printk("%sata%u.%02u: %pV",
> -	       level, dev->link->ap->print_id, dev->link->pmp + dev->devno,
> -	       &vaf);
> -
> -	va_end(args);
> -}
> -EXPORT_SYMBOL(ata_dev_printk);
> -
>  void ata_print_version(const struct device *dev, const char *version)
>  {
>  	dev_printk(KERN_DEBUG, dev, "version %s\n", version);
> diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c
> index 99c63087c8ae..17b557c91e1c 100644
> --- a/drivers/ata/pata_ixp4xx_cf.c
> +++ b/drivers/ata/pata_ixp4xx_cf.c
> @@ -114,7 +114,7 @@ static void ixp4xx_set_piomode(struct ata_port *ap, struct ata_device *adev)
>  {
>  	struct ixp4xx_pata *ixpp = ap->host->private_data;
>  
> -	ata_dev_printk(adev, KERN_INFO, "configured for PIO%d 8bit\n",
> +	ata_dev_info(adev, "configured for PIO%d 8bit\n",
>  		       adev->pio_mode - XFER_PIO_0);
>  	ixp4xx_set_8bit_timing(ixpp, adev->pio_mode);
>  }
> @@ -132,8 +132,8 @@ static unsigned int ixp4xx_mmio_data_xfer(struct ata_queued_cmd *qc,
>  	struct ixp4xx_pata *ixpp = ap->host->private_data;
>  	unsigned long flags;
>  
> -	ata_dev_printk(adev, KERN_DEBUG, "%s %d bytes\n", (rw == READ) ? "READ" : "WRITE",
> -		       buflen);
> +	ata_dev_dbg(adev, "%s %d bytes\n", (rw == READ) ? "READ" : "WRITE",
> +		    buflen);
>  	spin_lock_irqsave(ap->lock, flags);
>  
>  	/* set the expansion bus in 16bit mode and restore
> diff --git a/include/linux/libata.h b/include/linux/libata.h
> index 235fdbeb19ea..a807d2d43d70 100644
> --- a/include/linux/libata.h
> +++ b/include/linux/libata.h
> @@ -1489,51 +1489,38 @@ static inline int sata_srst_pmp(struct ata_link *link)
>  	return link->pmp;
>  }
>  
> -/*
> - * printk helpers
> - */
> -__printf(3, 4)
> -void ata_port_printk(const struct ata_port *ap, const char *level,
> -		     const char *fmt, ...);
> -__printf(3, 4)
> -void ata_link_printk(const struct ata_link *link, const char *level,
> -		     const char *fmt, ...);
> -__printf(3, 4)
> -void ata_dev_printk(const struct ata_device *dev, const char *level,
> -		    const char *fmt, ...);
> -
>  #define ata_port_err(ap, fmt, ...)				\
> -	ata_port_printk(ap, KERN_ERR, fmt, ##__VA_ARGS__)
> +	dev_err(&ap->tdev, fmt, ##__VA_ARGS__)
>  #define ata_port_warn(ap, fmt, ...)				\
> -	ata_port_printk(ap, KERN_WARNING, fmt, ##__VA_ARGS__)
> +	dev_warn(&ap->tdev, fmt, ##__VA_ARGS__)
>  #define ata_port_notice(ap, fmt, ...)				\
> -	ata_port_printk(ap, KERN_NOTICE, fmt, ##__VA_ARGS__)
> +	dev_notice(&ap->tdev, fmt, ##__VA_ARGS__)
>  #define ata_port_info(ap, fmt, ...)				\
> -	ata_port_printk(ap, KERN_INFO, fmt, ##__VA_ARGS__)
> +	dev_info(&ap->tdev, fmt, ##__VA_ARGS__)
>  #define ata_port_dbg(ap, fmt, ...)				\
> -	ata_port_printk(ap, KERN_DEBUG, fmt, ##__VA_ARGS__)
> +	dev_dbg(&ap->tdev, "%s: " fmt, __func__, ##__VA_ARGS__)
>  
>  #define ata_link_err(link, fmt, ...)				\
> -	ata_link_printk(link, KERN_ERR, fmt, ##__VA_ARGS__)
> +	dev_err(&link->tdev, fmt, ##__VA_ARGS__)
>  #define ata_link_warn(link, fmt, ...)				\
> -	ata_link_printk(link, KERN_WARNING, fmt, ##__VA_ARGS__)
> +	dev_warn(&link->tdev, fmt, ##__VA_ARGS__)
>  #define ata_link_notice(link, fmt, ...)				\
> -	ata_link_printk(link, KERN_NOTICE, fmt, ##__VA_ARGS__)
> +	dev_notice(&link->tdev, fmt, ##__VA_ARGS__)
>  #define ata_link_info(link, fmt, ...)				\
> -	ata_link_printk(link, KERN_INFO, fmt, ##__VA_ARGS__)
> +	dev_info(&link->tdev, fmt, ##__VA_ARGS__)
>  #define ata_link_dbg(link, fmt, ...)				\
> -	ata_link_printk(link, KERN_DEBUG, fmt, ##__VA_ARGS__)
> +	dev_dbg(&link->tdev, "%s: " fmt, __func__, ##__VA_ARGS__)
>  
>  #define ata_dev_err(dev, fmt, ...)				\
> -	ata_dev_printk(dev, KERN_ERR, fmt, ##__VA_ARGS__)
> +	dev_err(&dev->tdev, fmt, ##__VA_ARGS__)
>  #define ata_dev_warn(dev, fmt, ...)				\
> -	ata_dev_printk(dev, KERN_WARNING, fmt, ##__VA_ARGS__)
> +	dev_warn(&dev->tdev, fmt, ##__VA_ARGS__)
>  #define ata_dev_notice(dev, fmt, ...)				\
> -	ata_dev_printk(dev, KERN_NOTICE, fmt, ##__VA_ARGS__)
> +	dev_notice(&dev->tdev, fmt, ##__VA_ARGS__)
>  #define ata_dev_info(dev, fmt, ...)				\
> -	ata_dev_printk(dev, KERN_INFO, fmt, ##__VA_ARGS__)
> +	dev_info(&dev->tdev, fmt, ##__VA_ARGS__)
>  #define ata_dev_dbg(dev, fmt, ...)				\
> -	ata_dev_printk(dev, KERN_DEBUG, fmt, ##__VA_ARGS__)
> +	dev_dbg(&dev->tdev, "%s: " fmt, __func__, ##__VA_ARGS__)
>  
>  void ata_print_version(const struct device *dev, const char *version);
>  
> @@ -2067,11 +2054,8 @@ static inline u8 ata_wait_idle(struct ata_port *ap)
>  {
>  	u8 status = ata_sff_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
>  
> -#ifdef ATA_DEBUG
>  	if (status != 0xff && (status & (ATA_BUSY | ATA_DRQ)))
> -		ata_port_printk(ap, KERN_DEBUG, "abnormal Status 0x%X\n",
> -				status);
> -#endif
> +		ata_port_dbg(ap, "abnormal Status 0x%X\n", status);
>  
>  	return status;
>  }
> 


-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 24/73] pata_octeon_cf: remove DPRINTK() macro in interrupt context
  2021-12-08 16:32 ` [PATCH 24/73] pata_octeon_cf: remove DPRINTK() macro in interrupt context Hannes Reinecke
@ 2021-12-09  0:58   ` Damien Le Moal
  0 siblings, 0 replies; 114+ messages in thread
From: Damien Le Moal @ 2021-12-09  0:58 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: linux-ide

On 2021/12/09 1:32, Hannes Reinecke wrote:
> There is only so much information to be glanced when the interrupt
> routine in called and exited, so remove these DPRINTK() calls.

s/in/is

> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>  drivers/ata/pata_octeon_cf.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
> index f86dabcecf9d..7b80bbd9b1ed 100644
> --- a/drivers/ata/pata_octeon_cf.c
> +++ b/drivers/ata/pata_octeon_cf.c
> @@ -668,7 +668,6 @@ static irqreturn_t octeon_cf_interrupt(int irq, void *dev_instance)
>  
>  	spin_lock_irqsave(&host->lock, flags);
>  
> -	DPRINTK("ENTER\n");
>  	for (i = 0; i < host->n_ports; i++) {
>  		u8 status;
>  		struct ata_port *ap;
> @@ -722,7 +721,6 @@ static irqreturn_t octeon_cf_interrupt(int irq, void *dev_instance)
>  		}
>  	}
>  	spin_unlock_irqrestore(&host->lock, flags);
> -	DPRINTK("EXIT\n");
>  	return IRQ_RETVAL(handled);
>  }
>  
> 


-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 32/73] pdc_adma: Drop pointless VPRINTK() calls and convert the remaining ones
  2021-12-08 16:32 ` [PATCH 32/73] pdc_adma: " Hannes Reinecke
@ 2021-12-09  1:01   ` Damien Le Moal
  0 siblings, 0 replies; 114+ messages in thread
From: Damien Le Moal @ 2021-12-09  1:01 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: linux-ide

On 2021/12/09 1:32, Hannes Reinecke wrote:
> Drop pointless VPRINTK() calls for entering and existing interrupt
> routines and convert the remaining calls to dev_dbg().

There are no remaining calls here :)

> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>  drivers/ata/pdc_adma.c | 11 -----------
>  1 file changed, 11 deletions(-)
> 
> diff --git a/drivers/ata/pdc_adma.c b/drivers/ata/pdc_adma.c
> index 2c910c4cd4de..5d6f460b2356 100644
> --- a/drivers/ata/pdc_adma.c
> +++ b/drivers/ata/pdc_adma.c
> @@ -284,9 +284,6 @@ static int adma_fill_sg(struct ata_queued_cmd *qc)
>  		*(__le32 *)(buf + i) =
>  			(pFLAGS & pEND) ? 0 : cpu_to_le32(pp->pkt_dma + i + 4);
>  		i += 4;
> -
> -		VPRINTK("PRD[%u] = (0x%lX, 0x%X)\n", i/4,
> -					(unsigned long)addr, len);
>  	}
>  
>  	if (likely(last_buf))
> @@ -302,8 +299,6 @@ static enum ata_completion_errors adma_qc_prep(struct ata_queued_cmd *qc)
>  	u32 pkt_dma = (u32)pp->pkt_dma;
>  	int i = 0;
>  
> -	VPRINTK("ENTER\n");
> -
>  	adma_enter_reg_mode(qc->ap);
>  	if (qc->tf.protocol != ATA_PROT_DMA)
>  		return AC_ERR_OK;
> @@ -379,8 +374,6 @@ static inline void adma_packet_start(struct ata_queued_cmd *qc)
>  	struct ata_port *ap = qc->ap;
>  	void __iomem *chan = ADMA_PORT_REGS(ap);
>  
> -	VPRINTK("ENTER, ap %p\n", ap);
> -
>  	/* fire up the ADMA engine */
>  	writew(aPIOMD4 | aGO, chan + ADMA_CONTROL);
>  }
> @@ -502,14 +495,10 @@ static irqreturn_t adma_intr(int irq, void *dev_instance)
>  	struct ata_host *host = dev_instance;
>  	unsigned int handled = 0;
>  
> -	VPRINTK("ENTER\n");
> -
>  	spin_lock(&host->lock);
>  	handled  = adma_intr_pkt(host) | adma_intr_mmio(host);
>  	spin_unlock(&host->lock);
>  
> -	VPRINTK("EXIT\n");
> -
>  	return IRQ_RETVAL(handled);
>  }
>  
> 


-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 54/73] pata_atp867x: convert blank printk() calls
  2021-12-08 16:32 ` [PATCH 54/73] pata_atp867x: convert blank printk() calls Hannes Reinecke
  2021-12-08 22:21   ` kernel test robot
@ 2021-12-09  1:08   ` Damien Le Moal
  1 sibling, 0 replies; 114+ messages in thread
From: Damien Le Moal @ 2021-12-09  1:08 UTC (permalink / raw)
  To: Hannes Reinecke, Damien LeMoal; +Cc: linux-ide

On 2021/12/09 1:32, Hannes Reinecke wrote:
> Convert blank printk() calls to structured logging.

s/blank/raw ? Since they are not empty prints...

> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>  drivers/ata/pata_atp867x.c | 29 ++++++++++++-----------------
>  1 file changed, 12 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/ata/pata_atp867x.c b/drivers/ata/pata_atp867x.c
> index 2bc5fc81efe3..84dac8c69085 100644
> --- a/drivers/ata/pata_atp867x.c
> +++ b/drivers/ata/pata_atp867x.c
> @@ -155,7 +155,7 @@ static int atp867x_get_active_clocks_shifted(struct ata_port *ap,
>  	case 1 ... 6:
>  		break;
>  	default:
> -		printk(KERN_WARNING "ATP867X: active %dclk is invalid. "
> +		ata_port_warn(ap, "ATP867X: active %dclk is invalid. "
>  			"Using 12clk.\n", clk);
>  		fallthrough;
>  	case 9 ... 12:
> @@ -171,7 +171,8 @@ static int atp867x_get_active_clocks_shifted(struct ata_port *ap,
>  	return clocks << ATP867X_IO_PIOSPD_ACTIVE_SHIFT;
>  }
>  
> -static int atp867x_get_recover_clocks_shifted(unsigned int clk)
> +static int atp867x_get_recover_clocks_shifted(struct ata_port *ap,
> +					      unsigned int clk)
>  {
>  	unsigned char clocks = clk;
>  
> @@ -188,7 +189,7 @@ static int atp867x_get_recover_clocks_shifted(unsigned int clk)
>  	case 15:
>  		break;
>  	default:
> -		printk(KERN_WARNING "ATP867X: recover %dclk is invalid. "
> +		ata_port_warn(ap, "ATP867X: recover %dclk is invalid. "
>  			"Using default 12clk.\n", clk);
>  		fallthrough;
>  	case 12:	/* default 12 clk */
> @@ -225,7 +226,7 @@ static void atp867x_set_piomode(struct ata_port *ap, struct ata_device *adev)
>  	iowrite8(b, dp->dma_mode);
>  
>  	b = atp867x_get_active_clocks_shifted(ap, t.active) |
> -	    atp867x_get_recover_clocks_shifted(t.recover);
> +		atp867x_get_recover_clocks_shifted(ap, t.recover);
>  
>  	if (adev->devno & 1)
>  		iowrite8(b, dp->slave_piospd);
> @@ -233,7 +234,7 @@ static void atp867x_set_piomode(struct ata_port *ap, struct ata_device *adev)
>  		iowrite8(b, dp->mstr_piospd);
>  
>  	b = atp867x_get_active_clocks_shifted(ap, t.act8b) |
> -	    atp867x_get_recover_clocks_shifted(t.rec8b);
> +		atp867x_get_recover_clocks_shifted(ap, t.rec8b);
>  
>  	iowrite8(b, dp->eightb_piospd);
>  }
> @@ -270,7 +271,6 @@ static struct ata_port_operations atp867x_ops = {
>  };
>  
>  
> -#ifdef	ATP867X_DEBUG
>  static void atp867x_check_res(struct pci_dev *pdev)
>  {
>  	int i;
> @@ -280,7 +280,7 @@ static void atp867x_check_res(struct pci_dev *pdev)
>  	for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
>  		start = pci_resource_start(pdev, i);
>  		len   = pci_resource_len(pdev, i);
> -		printk(KERN_DEBUG "ATP867X: resource start:len=%lx:%lx\n",
> +		dev_dbg(&pdev->dev, "ATP867X: resource start:len=%lx:%lx\n",
>  			start, len);
>  	}
>  }
> @@ -290,7 +290,7 @@ static void atp867x_check_ports(struct ata_port *ap, int port)
>  	struct ata_ioports *ioaddr = &ap->ioaddr;
>  	struct atp867x_priv *dp = ap->private_data;
>  
> -	printk(KERN_DEBUG "ATP867X: port[%d] addresses\n"
> +	ata_port_dbg(ap, "ATP867X: port[%d] addresses\n"
>  		"  cmd_addr	=0x%llx, 0x%llx\n"
>  		"  ctl_addr	=0x%llx, 0x%llx\n"
>  		"  bmdma_addr	=0x%llx, 0x%llx\n"
> @@ -332,7 +332,6 @@ static void atp867x_check_ports(struct ata_port *ap, int port)
>  		(unsigned long long)dp->eightb_piospd,
>  		(unsigned long)dp->pci66mhz);
>  }
> -#endif
>  
>  static int atp867x_set_priv(struct ata_port *ap)
>  {
> @@ -370,8 +369,7 @@ static void atp867x_fixup(struct ata_host *host)
>  	if (v < 0x80) {
>  		v = 0x80;
>  		pci_write_config_byte(pdev, PCI_LATENCY_TIMER, v);
> -		printk(KERN_DEBUG "ATP867X: set latency timer of device %s"
> -			" to %d\n", pci_name(pdev), v);
> +		dev_dbg(&pdev->dev, "ATP867X: set latency timer to %d\n", v);
>  	}
>  
>  	/*
> @@ -419,13 +417,11 @@ static int atp867x_ata_pci_sff_init_host(struct ata_host *host)
>  		return rc;
>  	host->iomap = pcim_iomap_table(pdev);
>  
> -#ifdef	ATP867X_DEBUG
>  	atp867x_check_res(pdev);
>  
>  	for (i = 0; i < PCI_STD_NUM_BARS; i++)
> -		printk(KERN_DEBUG "ATP867X: iomap[%d]=0x%llx\n", i,
> +		dev_dbg(gdev, "ATP867X: iomap[%d]=0x%llx\n", i,
>  			(unsigned long long)(host->iomap[i]));
> -#endif
>  
>  	/*
>  	 * request, iomap BARs and init port addresses accordingly
> @@ -444,9 +440,8 @@ static int atp867x_ata_pci_sff_init_host(struct ata_host *host)
>  		if (rc)
>  			return rc;
>  
> -#ifdef	ATP867X_DEBUG
>  		atp867x_check_ports(ap, i);
> -#endif
> +
>  		ata_port_desc(ap, "cmd 0x%lx ctl 0x%lx",
>  			(unsigned long)ioaddr->cmd_addr,
>  			(unsigned long)ioaddr->ctl_addr);
> @@ -486,7 +481,7 @@ static int atp867x_init_one(struct pci_dev *pdev,
>  	if (rc)
>  		return rc;
>  
> -	printk(KERN_INFO "ATP867X: ATP867 ATA UDMA133 controller (rev %02X)",
> +	dev_info(&pdev->dev, "ATP867X: ATP867 ATA UDMA133 controller (rev %02X)",
>  		pdev->device);
>  
>  	host = ata_host_alloc_pinfo(&pdev->dev, ppi, ATP867X_NUM_PORTS);
> 


-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 62/73] pata_rz1000: convert blank printk() calls
  2021-12-08 16:32 ` [PATCH 62/73] pata_rz1000: " Hannes Reinecke
@ 2021-12-09  1:10   ` Damien Le Moal
  0 siblings, 0 replies; 114+ messages in thread
From: Damien Le Moal @ 2021-12-09  1:10 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: linux-ide

On 2021/12/09 1:32, Hannes Reinecke wrote:
> Convert blank printk() calls to structured logging.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>  drivers/ata/pata_rz1000.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/ata/pata_rz1000.c b/drivers/ata/pata_rz1000.c
> index 3722a67083fd..8beec884836d 100644
> --- a/drivers/ata/pata_rz1000.c
> +++ b/drivers/ata/pata_rz1000.c
> @@ -69,7 +69,7 @@ static int rz1000_fifo_disable(struct pci_dev *pdev)
>  	reg &= 0xDFFF;
>  	if (pci_write_config_word(pdev, 0x40, reg) != 0)
>  		return -1;
> -	printk(KERN_INFO DRV_NAME ": disabled chipset readahead.\n");
> +	dev_info(&pdev->dev, "disabled chipset readahead.\n");
>  	return 0;
>  }
>  
> @@ -97,7 +97,7 @@ static int rz1000_init_one (struct pci_dev *pdev, const struct pci_device_id *en
>  	if (rz1000_fifo_disable(pdev) == 0)
>  		return ata_pci_sff_init_one(pdev, ppi, &rz1000_sht, NULL, 0);
>  
> -	printk(KERN_ERR DRV_NAME ": failed to disable read-ahead on chipset..\n");
> +	dev_err(&pdev->dev, "failed to disable read-ahead on chipset..\n");

While at it, make that ".." at the end a single dot ?

>  	/* Not safe to use so skip */
>  	return -ENODEV;
>  }
> 


-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 68/73] pata_hpt37x: convert pr_XXX() calls
  2021-12-08 16:32 ` [PATCH 68/73] pata_hpt37x: convert pr_XXX() calls Hannes Reinecke
@ 2021-12-09  1:13   ` Damien Le Moal
  0 siblings, 0 replies; 114+ messages in thread
From: Damien Le Moal @ 2021-12-09  1:13 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: linux-ide

On 2021/12/09 1:32, Hannes Reinecke wrote:
> Convert pr_XXX() calls to structured logging.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>  drivers/ata/pata_hpt37x.c | 19 ++++++++++---------
>  1 file changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c
> index f242157bc81b..47709eb9d135 100644
> --- a/drivers/ata/pata_hpt37x.c
> +++ b/drivers/ata/pata_hpt37x.c
> @@ -15,8 +15,6 @@
>   *	Look into engine reset on timeout errors. Should not be	required.
>   */
>  
> -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

I think you can also remove the blank line before this line too.

> -
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/pci.h>
> @@ -231,7 +229,8 @@ static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr,
>  
>  	i = match_string(list, -1, model_num);
>  	if (i >= 0) {
> -		pr_warn("%s is not supported for %s\n", modestr, list[i]);
> +		ata_dev_warn(dev, "%s is not supported for %s\n",
> +			     modestr, list[i]);
>  		return 1;
>  	}
>  	return 0;
> @@ -864,7 +863,8 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
>  			chip_table = &hpt372;
>  			break;
>  		default:
> -			pr_err("Unknown HPT366 subtype, please report (%d)\n",
> +			dev_err(&dev->dev,
> +				"Unknown HPT366 subtype, please report (%d)\n",
>  			       rev);
>  			return -ENODEV;
>  		}
> @@ -905,7 +905,8 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
>  			*ppi = &info_hpt374_fn1;
>  		break;
>  	default:
> -		pr_err("PCI table is bogus, please report (%d)\n", dev->device);
> +		dev_err(&dev->dev, "PCI table is bogus, please report (%d)\n",
> +			dev->device);
>  		return -ENODEV;
>  	}
>  	/* Ok so this is a chip we support */
> @@ -953,7 +954,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
>  		u8 sr;
>  		u32 total = 0;
>  
> -		pr_warn("BIOS has not set timing clocks\n");
> +		dev_warn(&dev->dev, "BIOS has not set timing clocks\n");
>  
>  		/* This is the process the HPT371 BIOS is reported to use */
>  		for (i = 0; i < 128; i++) {
> @@ -1009,7 +1010,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
>  					       (f_high << 16) | f_low | 0x100);
>  		}
>  		if (adjust == 8) {
> -			pr_err("DPLL did not stabilize!\n");
> +			dev_err(&dev->dev, "DPLL did not stabilize!\n");
>  			return -ENODEV;
>  		}
>  		if (dpll == 3)
> @@ -1017,7 +1018,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
>  		else
>  			private_data = (void *)hpt37x_timings_50;
>  
> -		pr_info("bus clock %dMHz, using %dMHz DPLL\n",
> +		dev_info(&dev->dev, "bus clock %dMHz, using %dMHz DPLL\n",
>  			MHz[clock_slot], MHz[dpll]);
>  	} else {
>  		private_data = (void *)chip_table->clocks[clock_slot];
> @@ -1032,7 +1033,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
>  		if (clock_slot < 2 && ppi[0] == &info_hpt370a)
>  			ppi[0] = &info_hpt370a_33;
>  
> -		pr_info("%s using %dMHz bus clock\n",
> +		dev_info(&dev->dev, "%s using %dMHz bus clock\n",
>  			chip_table->name, MHz[clock_slot]);
>  	}
>  
> 


-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 70/73] pata_hpt3x2n: convert pr_XXX() calls
  2021-12-08 16:32 ` [PATCH 70/73] pata_hpt3x2n: convert pr_XXX() calls Hannes Reinecke
@ 2021-12-09  1:13   ` Damien Le Moal
  0 siblings, 0 replies; 114+ messages in thread
From: Damien Le Moal @ 2021-12-09  1:13 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: linux-ide

On 2021/12/09 1:32, Hannes Reinecke wrote:
> Convert pr_XXX() calls to structured logging.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>  drivers/ata/pata_hpt3x2n.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c
> index 48eef338e050..60e7d71328f6 100644
> --- a/drivers/ata/pata_hpt3x2n.c
> +++ b/drivers/ata/pata_hpt3x2n.c
> @@ -16,8 +16,6 @@
>   *	Work out best PLL policy
>   */
>  

Remove this blank line too ?

> -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> -
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/pci.h>
> @@ -420,7 +418,7 @@ static int hpt3x2n_pci_clock(struct pci_dev *pdev)
>  		u16 sr;
>  		u32 total = 0;
>  
> -		pr_warn("BIOS clock data not set\n");
> +		dev_warn(&pdev->dev, "BIOS clock data not set\n");
>  
>  		/* This is the process the HPT371 BIOS is reported to use */
>  		for (i = 0; i < 128; i++) {
> @@ -530,7 +528,8 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id)
>  		ppi[0] = &info_hpt372n;
>  		break;
>  	default:
> -		pr_err("PCI table is bogus, please report (%d)\n", dev->device);
> +		dev_err(&dev->dev,"PCI table is bogus, please report (%d)\n",
> +			dev->device);
>  		return -ENODEV;
>  	}
>  
> @@ -579,11 +578,11 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id)
>  		pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low);
>  	}
>  	if (adjust == 8) {
> -		pr_err("DPLL did not stabilize!\n");
> +		dev_err(&dev->dev, "DPLL did not stabilize!\n");
>  		return -ENODEV;
>  	}
>  
> -	pr_info("bus clock %dMHz, using 66MHz DPLL\n", pci_mhz);
> +	dev_info(&dev->dev, "bus clock %dMHz, using 66MHz DPLL\n", pci_mhz);
>  
>  	/*
>  	 * Set our private data up. We only need a few flags
> 


-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 71/73] pata_hpt3x2n: convert pr_err() calls
  2021-12-08 16:32 ` [PATCH 71/73] pata_hpt3x2n: convert pr_err() calls Hannes Reinecke
@ 2021-12-09  1:14   ` Damien Le Moal
  2021-12-09  8:09   ` Sergey Shtylyov
  1 sibling, 0 replies; 114+ messages in thread
From: Damien Le Moal @ 2021-12-09  1:14 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: linux-ide

On 2021/12/09 1:32, Hannes Reinecke wrote:
> Convert pr_err() calls to dev_err()
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>  drivers/ata/sata_gemini.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/ata/sata_gemini.c b/drivers/ata/sata_gemini.c
> index f793564f3d78..440a63de20d0 100644
> --- a/drivers/ata/sata_gemini.c
> +++ b/drivers/ata/sata_gemini.c
> @@ -253,12 +253,12 @@ static int gemini_sata_bridge_init(struct sata_gemini *sg)
>  
>  	ret = clk_prepare_enable(sg->sata0_pclk);
>  	if (ret) {
> -		pr_err("failed to enable SATA0 PCLK\n");
> +		dev_err(dev, "failed to enable SATA0 PCLK\n");
>  		return ret;
>  	}
>  	ret = clk_prepare_enable(sg->sata1_pclk);
>  	if (ret) {
> -		pr_err("failed to enable SATA1 PCLK\n");
> +		dev_err(dev, "failed to enable SATA1 PCLK\n");
>  		clk_disable_unprepare(sg->sata0_pclk);
>  		return ret;
>  	}
> 

Why is this not part of the previous patch ?

-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 72/73] pata_hpt366: convert pr_warn() calls
  2021-12-08 16:32 ` [PATCH 72/73] pata_hpt366: convert pr_warn() calls Hannes Reinecke
@ 2021-12-09  1:14   ` Damien Le Moal
  0 siblings, 0 replies; 114+ messages in thread
From: Damien Le Moal @ 2021-12-09  1:14 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: linux-ide

On 2021/12/09 1:32, Hannes Reinecke wrote:
> Convert pr_warn() calls to ata_dev_warn()
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>  drivers/ata/pata_hpt366.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/ata/pata_hpt366.c b/drivers/ata/pata_hpt366.c
> index 06b7c4a9ec95..c29863038428 100644
> --- a/drivers/ata/pata_hpt366.c
> +++ b/drivers/ata/pata_hpt366.c
> @@ -15,8 +15,6 @@
>   *	Look into engine reset on timeout errors. Should not be required.
>   */
>  

Remove the above blank line.

> -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> -
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/pci.h>
> @@ -183,7 +181,7 @@ static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr,
>  
>  	i = match_string(list, -1, model_num);
>  	if (i >= 0) {
> -		pr_warn("%s is not supported for %s\n", modestr, list[i]);
> +		ata_dev_warn(dev, "%s is not supported for %s\n", modestr, list[i]);
>  		return 1;
>  	}
>  	return 0;
> 


-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 00/73] libata: rework logging, take II
  2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
                   ` (72 preceding siblings ...)
  2021-12-08 16:32 ` [PATCH 73/73] libata-scsi: rework ata_dump_status to avoid using pr_cont() Hannes Reinecke
@ 2021-12-09  1:17 ` Damien Le Moal
  73 siblings, 0 replies; 114+ messages in thread
From: Damien Le Moal @ 2021-12-09  1:17 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: linux-ide

On 2021/12/09 1:31, Hannes Reinecke wrote:
> Hi all,
> 
> after some prodding from individual persons I've resurrected my
> patchset to put libata logging on a even keel, and use structured
> logging for everything.
> So this patch does away with DPRINTK, ATA_DEBUG or ata_msg_XXX() calls,
> and moves everything over to structured logging (ie the dev_XXX()
> calls).
> Additionally I've added more tracepoints to trace command flow
> and EH, HSM, and other related things.
> 
> So everything is looking far saner now.
> 
> As usual, comments and reviews are welcome.

Hannes,

Thanks for cleaning this up. I commented only on patches where I saw problems.
No comments == LGTM.

> 
> I know that the device names suck. Blame Tejun.
> 
> Hannes Reinecke (73):
>   libata: remove pointless debugging messages
>   libata: Add ata_port_classify() helper
>   libata: move ata_dump_id() to dynamic debugging
>   libata: sanitize ATA_HORKAGE_DUMP_ID
>   sata_mv: replace DPRINTK with 'pci_dump' module parameter
>   sata_mv: kill 'port' argument in mv_dump_all_regs()
>   libata: add reset tracepoints
>   libata: drop DPRINTK() calls in reset
>   libata: tracepoints for bus-master DMA
>   libata: drop debugging statements for bus-master DMA
>   pata_octeon_cf: add bmdma tracepoints and drop DPRINTK() calls
>   pata_arasan_cf: use generic tracepoints
>   sata_dwc_460ex: use generic tracepoints
>   sata_nv: use generic tracepoints
>   libata-sff: tracepoints for HSM state machine
>   libata-sff: add tracepoints for ata_sff_flush_pio_task()
>   libata-scsi: drop DPRINTK calls for cdb translation
>   libata: add tracepoints for ATA error handling
>   libata: drop DPRINTK() calls during ATA error handling
>   libata-eh: remove DPRINTK() calls for request sense
>   libata: move ata_{port,link,dev}_dbg to standard dev_XXX() macros
>   libata: add qc_prep tracepoint
>   libata: move DPRINTK to ata debugging
>   pata_octeon_cf: remove DPRINTK() macro in interrupt context
>   pdc_adma: Remove DPRINTK call
>   sata_fsl: move DPRINTK to ata debugging
>   sata_rcar: replace DPRINTK() with ata_port_dbg()
>   sata_qstor: replace DPRINTK() with ata_port_dbg()
>   pata_pdc2027x: Replace PDPRINTK() with standard ata logging
>   libata: remove pointless VPRINTK() calls
>   ahci: Drop pointless VPRINTK() calls and convert the remaining ones
>   pdc_adma: Drop pointless VPRINTK() calls and convert the remaining
>     ones
>   pata_octeon_cf: Drop pointless VPRINTK() calls and convert the
>     remaining ones
>   pata_via: Drop pointless VPRINTK() calls
>   sata_promise: Drop pointless VPRINTK() calls and convert the remaining
>     ones
>   sata_qstor: Drop pointless VPRINTK() calls
>   sata_rcar: Drop pointless VPRINTK() calls
>   sata_inic162x: Drop pointless VPRINTK() calls
>   sata_mv: Drop pointless VPRINTK() call and convert the remaining one
>   sata_nv: drop pointless VPRINTK() calls and convert remaining ones
>   sata_fsl: convert VPRINTK() calls to ata_port_dbg()
>   sata_sil: Drop pointless VPRINTK() calls
>   sata_sx4: Drop pointless VPRINTK() calls and convert the remaining
>     ones
>   sata_sx4: add module parameter 'dimm_test'
>   libata: drop ata_msg_error() and ata_msg_intr()
>   libata: drop ata_msg_ctl()
>   libata: drop ata_msg_malloc()
>   libata: drop ata_msg_warn()
>   libata: drop ata_msg_probe()
>   libata: drop ata_msg_info()
>   libata: drop ata_msg_drv()
>   libata: remove 'new' ata message handling
>   libata: remove debug compilation switches
>   pata_atp867x: convert blank printk() calls
>   pata_cmd640: convert blank printk() calls
>   pata_cmd64x: convert blank printk() calls
>   pata_cs5520: convert blank printk() calls
>   pata_cs5536: convert blank printk() calls
>   pata_cypressx: convert blank printk() calls
>   pata_it821x: convert blank printk() calls
>   pata_marvell: convert blank printk() calls
>   pata_rz1000: convert blank printk() calls
>   pata_serverworks: convert blank printk() calls
>   pata_sil680: convert blank printk() calls
>   pdc_adma: remove disabled debugging messages
>   sata_sx4: convert blank printk() calls
>   sata_mv: convert remaining printk() to structured logging
>   pata_hpt37x: convert pr_XXX() calls
>   pata_octeon_cf: Replace pr_XXX() calls with structured logging
>   pata_hpt3x2n: convert pr_XXX() calls
>   pata_hpt3x2n: convert pr_err() calls
>   pata_hpt366: convert pr_warn() calls
>   libata-scsi: rework ata_dump_status to avoid using pr_cont()
> 
>  drivers/ata/acard-ahci.c        |   4 -
>  drivers/ata/ahci.c              |  13 +-
>  drivers/ata/ahci_qoriq.c        |   4 -
>  drivers/ata/ahci_xgene.c        |   4 -
>  drivers/ata/ata_piix.c          |   3 -
>  drivers/ata/libahci.c           |  33 +--
>  drivers/ata/libata-acpi.c       |  71 +++---
>  drivers/ata/libata-core.c       | 270 ++++++++--------------
>  drivers/ata/libata-eh.c         |  50 +++--
>  drivers/ata/libata-pmp.c        |   8 -
>  drivers/ata/libata-sata.c       |   5 -
>  drivers/ata/libata-scsi.c       | 111 ++-------
>  drivers/ata/libata-sff.c        |  86 +++----
>  drivers/ata/libata-trace.c      |  29 +++
>  drivers/ata/libata.h            |   1 -
>  drivers/ata/pata_arasan_cf.c    |   3 +
>  drivers/ata/pata_atp867x.c      |  29 +--
>  drivers/ata/pata_cmd640.c       |   2 +-
>  drivers/ata/pata_cmd64x.c       |   4 +-
>  drivers/ata/pata_cs5520.c       |   4 +-
>  drivers/ata/pata_cs5536.c       |   4 +-
>  drivers/ata/pata_cypress.c      |   2 +-
>  drivers/ata/pata_hpt366.c       |   4 +-
>  drivers/ata/pata_hpt37x.c       |  19 +-
>  drivers/ata/pata_hpt3x2n.c      |  11 +-
>  drivers/ata/pata_it821x.c       |  43 ++--
>  drivers/ata/pata_ixp4xx_cf.c    |   6 +-
>  drivers/ata/pata_marvell.c      |   9 +-
>  drivers/ata/pata_octeon_cf.c    |  48 +---
>  drivers/ata/pata_pdc2027x.c     |  71 +++---
>  drivers/ata/pata_pdc202xx_old.c |   2 -
>  drivers/ata/pata_rz1000.c       |   4 +-
>  drivers/ata/pata_serverworks.c  |   4 +-
>  drivers/ata/pata_sil680.c       |   9 +-
>  drivers/ata/pata_via.c          |  12 -
>  drivers/ata/pdc_adma.c          |  33 +--
>  drivers/ata/sata_dwc_460ex.c    |  71 +-----
>  drivers/ata/sata_fsl.c          | 165 ++++++--------
>  drivers/ata/sata_gemini.c       |   4 +-
>  drivers/ata/sata_inic162x.c     |   4 +-
>  drivers/ata/sata_mv.c           | 147 ++++++------
>  drivers/ata/sata_nv.c           |  53 ++---
>  drivers/ata/sata_promise.c      |  31 +--
>  drivers/ata/sata_qstor.c        |  15 +-
>  drivers/ata/sata_rcar.c         |  25 +--
>  drivers/ata/sata_sil.c          |   1 -
>  drivers/ata/sata_sil24.c        |   5 +-
>  drivers/ata/sata_sx4.c          | 148 +++++-------
>  include/linux/libata.h          |  99 ++------
>  include/trace/events/libata.h   | 387 +++++++++++++++++++++++++++++++-
>  50 files changed, 992 insertions(+), 1178 deletions(-)
> 


-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 02/73] libata: Add ata_port_classify() helper
  2021-12-08 16:31 ` [PATCH 02/73] libata: Add ata_port_classify() helper Hannes Reinecke
  2021-12-08 22:21     ` kernel test robot
  2021-12-09  0:34   ` Damien Le Moal
@ 2021-12-09  4:20   ` kernel test robot
  2 siblings, 0 replies; 114+ messages in thread
From: kernel test robot @ 2021-12-09  4:20 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 2424 bytes --]

Hi Hannes,

I love your patch! Perhaps something to improve:

[auto build test WARNING on rostedt-trace/for-next]
[also build test WARNING on axboe-block/for-next linus/master v5.16-rc4 next-20211208]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Hannes-Reinecke/libata-rework-logging-take-II/20211209-003634
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git for-next
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20211209/202112091250.Wg19kdGn-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/6b66f083c8ccc2d25de4c0a9bc9229f38952bf10
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Hannes-Reinecke/libata-rework-logging-take-II/20211209-003634
        git checkout 6b66f083c8ccc2d25de4c0a9bc9229f38952bf10
        # save the config file to linux build tree
        mkdir build_dir
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/ata/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/ata/libata-core.c:972:13: warning: no previous prototype for 'ata_dev_class_string' [-Wmissing-prototypes]
     972 | const char *ata_dev_class_string(unsigned int class)
         |             ^~~~~~~~~~~~~~~~~~~~


vim +/ata_dev_class_string +972 drivers/ata/libata-core.c

   971	
 > 972	const char *ata_dev_class_string(unsigned int class)
   973	{
   974		static const char * const class_str[] = {
   975			"unknown",
   976			"ATA",
   977			"ATA (unsupported)",
   978			"ATAPI",
   979			"ATAPI (unsupported",
   980			"PMP",
   981			"PMP (unsupported)",
   982			"SEMB",
   983			"SEMB (unsupported)",
   984			"ZAC",
   985			"ZAC (unsupported)",
   986			"none",
   987		};
   988		if (class == 0 || (class - 1) >= ARRAY_SIZE(class_str))
   989			return "unknown";
   990		return class_str[class - 1];
   991	}
   992	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 35/73] sata_promise: Drop pointless VPRINTK() calls and convert the remaining ones
  2021-12-08 16:32 ` [PATCH 35/73] sata_promise: Drop pointless VPRINTK() calls and convert the remaining ones Hannes Reinecke
@ 2021-12-09  6:13   ` Mikael Pettersson
  0 siblings, 0 replies; 114+ messages in thread
From: Mikael Pettersson @ 2021-12-09  6:13 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: Damien LeMoal, linux-ide

On Wed, Dec 8, 2021 at 9:36 PM Hannes Reinecke <hare@suse.de> wrote:
>
> Drop pointless VPRINTK() calls for entering and existing interrupt
> routines and convert the remaining calls to dev_dbg().
>
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>  drivers/ata/sata_promise.c | 31 ++++++++-----------------------
>  1 file changed, 8 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
> index 7815da8ef9e5..1059beae8720 100644
> --- a/drivers/ata/sata_promise.c
> +++ b/drivers/ata/sata_promise.c
> @@ -596,7 +596,8 @@ static void pdc_fill_sg(struct ata_queued_cmd *qc)
>
>                         prd[idx].addr = cpu_to_le32(addr);
>                         prd[idx].flags_len = cpu_to_le32(len & 0xffff);
> -                       VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx, addr, len);
> +                       ata_port_dbg(ap, "PRD[%u] = (9x%X, 0x%X)\n",

typo: 9x -> 0x
LGTM otherwise

> +                                    idx, addr, len);
>
>                         idx++;
>                         sg_len -= len;
> @@ -609,17 +610,16 @@ static void pdc_fill_sg(struct ata_queued_cmd *qc)
>         if (len > SG_COUNT_ASIC_BUG) {
>                 u32 addr;
>
> -               VPRINTK("Splitting last PRD.\n");
> -
>                 addr = le32_to_cpu(prd[idx - 1].addr);
>                 prd[idx - 1].flags_len = cpu_to_le32(len - SG_COUNT_ASIC_BUG);
> -               VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx - 1, addr, SG_COUNT_ASIC_BUG);
> +               ata_port_dbg(ap, "PRD[%u] = (0x%X, 0x%X)\n",
> +                            idx - 1, addr, SG_COUNT_ASIC_BUG);
>
>                 addr = addr + len - SG_COUNT_ASIC_BUG;
>                 len = SG_COUNT_ASIC_BUG;
>                 prd[idx].addr = cpu_to_le32(addr);
>                 prd[idx].flags_len = cpu_to_le32(len);
> -               VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx, addr, len);
> +               ata_port_dbg(ap, "PRD[%u] = (0x%X, 0x%X)\n", idx, addr, len);
>
>                 idx++;
>         }
> @@ -632,8 +632,6 @@ static enum ata_completion_errors pdc_qc_prep(struct ata_queued_cmd *qc)
>         struct pdc_port_priv *pp = qc->ap->private_data;
>         unsigned int i;
>
> -       VPRINTK("ENTER\n");
> -
>         switch (qc->tf.protocol) {
>         case ATA_PROT_DMA:
>                 pdc_fill_sg(qc);
> @@ -922,12 +920,8 @@ static irqreturn_t pdc_interrupt(int irq, void *dev_instance)
>         u32 hotplug_status;
>         int is_sataii_tx4;
>
> -       VPRINTK("ENTER\n");
> -
> -       if (!host || !host->iomap[PDC_MMIO_BAR]) {
> -               VPRINTK("QUICK EXIT\n");
> +       if (!host || !host->iomap[PDC_MMIO_BAR])
>                 return IRQ_NONE;
> -       }
>
>         host_mmio = host->iomap[PDC_MMIO_BAR];
>
> @@ -946,23 +940,18 @@ static irqreturn_t pdc_interrupt(int irq, void *dev_instance)
>         /* reading should also clear interrupts */
>         mask = readl(host_mmio + PDC_INT_SEQMASK);
>
> -       if (mask == 0xffffffff && hotplug_status == 0) {
> -               VPRINTK("QUICK EXIT 2\n");
> +       if (mask == 0xffffffff && hotplug_status == 0)
>                 goto done_irq;
> -       }
>
>         mask &= 0xffff;         /* only 16 SEQIDs possible */
> -       if (mask == 0 && hotplug_status == 0) {
> -               VPRINTK("QUICK EXIT 3\n");
> +       if (mask == 0 && hotplug_status == 0)
>                 goto done_irq;
> -       }
>
>         writel(mask, host_mmio + PDC_INT_SEQMASK);
>
>         is_sataii_tx4 = pdc_is_sataii_tx4(host->ports[0]->flags);
>
>         for (i = 0; i < host->n_ports; i++) {
> -               VPRINTK("port %u\n", i);
>                 ap = host->ports[i];
>
>                 /* check for a plug or unplug event */
> @@ -989,8 +978,6 @@ static irqreturn_t pdc_interrupt(int irq, void *dev_instance)
>                 }
>         }
>
> -       VPRINTK("EXIT\n");
> -
>  done_irq:
>         spin_unlock(&host->lock);
>         return IRQ_RETVAL(handled);
> @@ -1005,8 +992,6 @@ static void pdc_packet_start(struct ata_queued_cmd *qc)
>         unsigned int port_no = ap->port_no;
>         u8 seq = (u8) (port_no + 1);
>
> -       VPRINTK("ENTER, ap %p\n", ap);
> -
>         writel(0x00000001, host_mmio + (seq * 4));
>         readl(host_mmio + (seq * 4));   /* flush */
>
> --
> 2.29.2
>

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 02/73] libata: Add ata_port_classify() helper
  2021-12-09  0:34   ` Damien Le Moal
@ 2021-12-09  7:16     ` Hannes Reinecke
  0 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-09  7:16 UTC (permalink / raw)
  To: Damien Le Moal, Damien LeMoal; +Cc: linux-ide, Bartlomiej Zolnierkiewicz

On 12/9/21 1:34 AM, Damien Le Moal wrote:
> On 2021/12/09 1:31, Hannes Reinecke wrote:
>> Add an ata_port_classify() helper to print out the results from
>> the device classification and remove the debugging statements
>> from ata_dev_classify(). Also provide a mapping ata_dev_class_string()
>> to provide a string representation for those instances calling
>> ata_dev_classify() directly.
>>
>> Signed-off-by: Hannes Reinecke <hare@suse.de>
>> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
>> ---
>>   drivers/ata/libahci.c       |  2 +-
>>   drivers/ata/libata-core.c   | 67 ++++++++++++++++++++++++++++---------
>>   drivers/ata/libata-sff.c    |  2 +-
>>   drivers/ata/sata_fsl.c      |  2 +-
>>   drivers/ata/sata_inic162x.c |  2 +-
>>   drivers/ata/sata_sil24.c    |  2 +-
>>   include/linux/libata.h      |  2 ++
>>   7 files changed, 58 insertions(+), 21 deletions(-)
>>
>> diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
>> index 8b651f55fc84..21dbcd551443 100644
>> --- a/drivers/ata/libahci.c
>> +++ b/drivers/ata/libahci.c
>> @@ -1300,7 +1300,7 @@ unsigned int ahci_dev_classify(struct ata_port *ap)
>>   	tf.lbal		= (tmp >> 8)	& 0xff;
>>   	tf.nsect	= (tmp)		& 0xff;
>>   
>> -	return ata_dev_classify(&tf);
>> +	return ata_port_classify(ap, &tf);
>>   }
>>   EXPORT_SYMBOL_GPL(ahci_dev_classify);
>>   
>> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
>> index f6a9e2f22a94..6cac413caf83 100644
>> --- a/drivers/ata/libata-core.c
>> +++ b/drivers/ata/libata-core.c
>> @@ -969,6 +969,27 @@ const char *sata_spd_string(unsigned int spd)
>>   	return spd_str[spd - 1];
>>   }
>>   
>> +const char *ata_dev_class_string(unsigned int class)
> 
> This should be static.
> 
Yeah; kbuild robot complained already.

>> +{
>> +	static const char * const class_str[] = {
>> +		"unknown",
>> +		"ATA",
>> +		"ATA (unsupported)",
>> +		"ATAPI",
>> +		"ATAPI (unsupported",
>> +		"PMP",
>> +		"PMP (unsupported)",
>> +		"SEMB",
>> +		"SEMB (unsupported)",
>> +		"ZAC",
>> +		"ZAC (unsupported)",
>> +		"none",
>> +	};
> 
> Add a blank line after the declaration.
> 
>> +	if (class == 0 || (class - 1) >= ARRAY_SIZE(class_str))
>> +		return "unknown";
>> +	return class_str[class - 1];
> 
> Why class - 1 ? The class_str entries directly match the values of the
> ATA_DEV_XXX macros...
> 
Yeah; and the whole thing should just go anyway, as we have the same 
functionality already present in libata-transport.c:get_ata_class_names().

>> +}
>> +
>>   /**
>>    *	ata_dev_classify - determine device type based on ATA-spec signature
>>    *	@tf: ATA taskfile register set for device to be identified
>> @@ -1007,36 +1028,50 @@ unsigned int ata_dev_classify(const struct ata_taskfile *tf)
>>   	 * SEMB signature.  This is worked around in
>>   	 * ata_dev_read_id().
>>   	 */
>> -	if ((tf->lbam == 0) && (tf->lbah == 0)) {
>> -		DPRINTK("found ATA device by sig\n");
>> +	if ((tf->lbam == 0) && (tf->lbah == 0))
>>   		return ATA_DEV_ATA;
>> -	}
>>   
>> -	if ((tf->lbam == 0x14) && (tf->lbah == 0xeb)) {
>> -		DPRINTK("found ATAPI device by sig\n");
>> +	if ((tf->lbam == 0x14) && (tf->lbah == 0xeb))
>>   		return ATA_DEV_ATAPI;
>> -	}
>>   
>> -	if ((tf->lbam == 0x69) && (tf->lbah == 0x96)) {
>> -		DPRINTK("found PMP device by sig\n");
>> +	if ((tf->lbam == 0x69) && (tf->lbah == 0x96))
>>   		return ATA_DEV_PMP;
>> -	}
>>   
>> -	if ((tf->lbam == 0x3c) && (tf->lbah == 0xc3)) {
>> -		DPRINTK("found SEMB device by sig (could be ATA device)\n");
>> +	if ((tf->lbam == 0x3c) && (tf->lbah == 0xc3))
>>   		return ATA_DEV_SEMB;
>> -	}
>>   
>> -	if ((tf->lbam == 0xcd) && (tf->lbah == 0xab)) {
>> -		DPRINTK("found ZAC device by sig\n");
>> +	if ((tf->lbam == 0xcd) && (tf->lbah == 0xab))
>>   		return ATA_DEV_ZAC;
>> -	}
>>   
>> -	DPRINTK("unknown device\n");
>>   	return ATA_DEV_UNKNOWN;
>>   }
>>   EXPORT_SYMBOL_GPL(ata_dev_classify);
>>   
>> +/**
>> + *     ata_port_classify - determine device type based on ATA-spec signature
>> + *     @ap: ATA port device on which the classification should be run
>> + *     @tf: ATA taskfile register set for device to be identified
>> + *
>> + *     A wrapper around ata_dev_classify() to provide additional logging
>> + *
>> + *     RETURNS:
>> + *     Device type, %ATA_DEV_ATA, %ATA_DEV_ATAPI, %ATA_DEV_PMP,
>> + *     %ATA_DEV_ZAC, or %ATA_DEV_UNKNOWN the event of failure.
>> + */
>> +unsigned int ata_port_classify(struct ata_port *ap,
>> +			       const struct ata_taskfile *tf)
>> +{
>> +	unsigned int class = ata_dev_classify(tf);
>> +
>> +	if (class != ATA_DEV_UNKNOWN)
>> +		ata_port_dbg(ap, "found %s device by sig\n",
>> +			     ata_dev_class_string(class));
>> +	else
>> +		ata_port_dbg(ap, "found unknown device\n");
> 
> Why the if-else here ? ata_dev_class_string(() handles ATA_DEV_UNKNOWN and "bad"
> class values saying "unknown" already. So this all seems redundant. If this is
> removed, then ata_dev_class_string() could be coded in here since this is the
> sole user of that helper.
> 

Will be doing so, and removing ata_dev_class_string() in favour of the 
libata-transport routines.

Thanks for the review!

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 05/73] sata_mv: replace DPRINTK with 'pci_dump' module parameter
  2021-12-09  0:38   ` Damien Le Moal
@ 2021-12-09  7:17     ` Hannes Reinecke
  2021-12-09  8:10       ` Damien Le Moal
  0 siblings, 1 reply; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-09  7:17 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-ide, Bartlomiej Zolnierkiewicz

On 12/9/21 1:38 AM, Damien Le Moal wrote:
> On 2021/12/09 1:31, Hannes Reinecke wrote:
>> Implement module parameter 'pci_dump' and move the DPRINTK calls
>> over to dev_printk().
>>
>> Signed-off-by: Hannes Reinecke <hare@suse.de>
>> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
>> ---
>>   drivers/ata/sata_mv.c | 88 ++++++++++++++++++++++++-------------------
>>   1 file changed, 49 insertions(+), 39 deletions(-)
>>
>> diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
>> index cae4c1eab102..f0257685495f 100644
>> --- a/drivers/ata/sata_mv.c
>> +++ b/drivers/ata/sata_mv.c
>> @@ -83,6 +83,10 @@ module_param(irq_coalescing_usecs, int, S_IRUGO);
>>   MODULE_PARM_DESC(irq_coalescing_usecs,
>>   		 "IRQ coalescing time threshold in usecs");
>>   
>> +static int pci_dump;
>> +module_param(pci_dump, int, S_IRUGO);
>> +MODULE_PARM_DESC(pci_dump, "Enable dumping of PCI registers on error");
>> +
>>   enum {
>>   	/* BAR's are enumerated in terms of pci_resource_start() terms */
>>   	MV_PRIMARY_BAR		= 0,	/* offset 0x10: memory space */
>> @@ -1248,42 +1252,43 @@ static int mv_stop_edma(struct ata_port *ap)
>>   	return err;
>>   }
>>   
>> -#ifdef ATA_DEBUG
>> -static void mv_dump_mem(void __iomem *start, unsigned bytes)
>> +static void mv_dump_mem(struct device *dev, void __iomem *start, unsigned bytes)
>>   {
>> -	int b, w;
>> +	int b, w, o;
>> +	unsigned char linebuf[38];
>> +
>>   	for (b = 0; b < bytes; ) {
>> -		DPRINTK("%p: ", start + b);
>> -		for (w = 0; b < bytes && w < 4; w++) {
>> -			printk("%08x ", readl(start + b));
>> +		for (w = 0, o = 0; b < bytes && w < 4; w++) {
>> +			o += snprintf(linebuf + o, 38 - o,
>> +				      "%08x ", readl(start + b));
>>   			b += sizeof(u32);
>>   		}
>> -		printk("\n");
>> +		dev_printk(KERN_DEBUG, dev, "%s: %p: %s\n",
>> +			   __func__, start + b, linebuf);
> 
> Why not dev_dbg() ? Same comment for all the prints below.
> 
Because the entire thing is encapsulated by the 'pci_dump' parameter, ie 
it'll be only ever called when 'pci_dump' is set.
So it feels redundant to require both, 'pci_dump' _and_ dynamic debugging.

But I can move it over to dynamic debugging and kill the pci_dump parameter.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 69/73] pata_octeon_cf: Replace pr_XXX() calls with structured logging
  2021-12-08 16:32 ` [PATCH 69/73] pata_octeon_cf: Replace pr_XXX() calls with structured logging Hannes Reinecke
@ 2021-12-09  8:08   ` Sergey Shtylyov
  0 siblings, 0 replies; 114+ messages in thread
From: Sergey Shtylyov @ 2021-12-09  8:08 UTC (permalink / raw)
  To: Hannes Reinecke, Damien LeMoal; +Cc: linux-ide

Hello!

On 08.12.2021 19:32, Hannes Reinecke wrote:

> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>   drivers/ata/pata_octeon_cf.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
> index de27428920a0..64bb65ef8f02 100644
> --- a/drivers/ata/pata_octeon_cf.c
> +++ b/drivers/ata/pata_octeon_cf.c
> @@ -273,9 +273,9 @@ static void octeon_cf_set_dmamode(struct ata_port *ap, struct ata_device *dev)
>   	dma_tim.s.we_n = ns_to_tim_reg(tim_mult, oe_n);
>   	dma_tim.s.we_a = ns_to_tim_reg(tim_mult, oe_a);
>   
> -	pr_debug("ns to ticks (mult %d) of %d is: %d\n", tim_mult, 60,
> +	ata_dev_dbg(dev, "ns to ticks (mult %d) of %d is: %d\n", tim_mult, 60,
>   		 ns_to_tim_reg(tim_mult, 60));

    Shouldn't you realign this like with the moved ( above?

> -	pr_debug("oe_n: %d, oe_a: %d, dmack_s: %d, dmack_h: %d, dmarq: %d, pause: %d\n",
> +	ata_dev_dbg(dev, "oe_n: %d, oe_a: %d, dmack_s: %d, dmack_h: %d, dmarq: %d, pause: %d\n",
>   		 dma_tim.s.oe_n, dma_tim.s.oe_a, dma_tim.s.dmack_s,
>   		 dma_tim.s.dmack_h, dma_tim.s.dmarq, dma_tim.s.pause);

    Same here.

MBR, Sergey

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 71/73] pata_hpt3x2n: convert pr_err() calls
  2021-12-08 16:32 ` [PATCH 71/73] pata_hpt3x2n: convert pr_err() calls Hannes Reinecke
  2021-12-09  1:14   ` Damien Le Moal
@ 2021-12-09  8:09   ` Sergey Shtylyov
  1 sibling, 0 replies; 114+ messages in thread
From: Sergey Shtylyov @ 2021-12-09  8:09 UTC (permalink / raw)
  To: Hannes Reinecke, Damien LeMoal; +Cc: linux-ide

On 08.12.2021 19:32, Hannes Reinecke wrote:

> Convert pr_err() calls to dev_err()
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>   drivers/ata/sata_gemini.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)

   The subject doesn't match the patch itself. :-/

MBR, Sergey

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 05/73] sata_mv: replace DPRINTK with 'pci_dump' module parameter
  2021-12-09  7:17     ` Hannes Reinecke
@ 2021-12-09  8:10       ` Damien Le Moal
  0 siblings, 0 replies; 114+ messages in thread
From: Damien Le Moal @ 2021-12-09  8:10 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: linux-ide, Bartlomiej Zolnierkiewicz

On 2021/12/09 16:17, Hannes Reinecke wrote:
> On 12/9/21 1:38 AM, Damien Le Moal wrote:
>> On 2021/12/09 1:31, Hannes Reinecke wrote:
>>> Implement module parameter 'pci_dump' and move the DPRINTK calls
>>> over to dev_printk().
>>>
>>> Signed-off-by: Hannes Reinecke <hare@suse.de>
>>> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
>>> ---
>>>   drivers/ata/sata_mv.c | 88 ++++++++++++++++++++++++-------------------
>>>   1 file changed, 49 insertions(+), 39 deletions(-)
>>>
>>> diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
>>> index cae4c1eab102..f0257685495f 100644
>>> --- a/drivers/ata/sata_mv.c
>>> +++ b/drivers/ata/sata_mv.c
>>> @@ -83,6 +83,10 @@ module_param(irq_coalescing_usecs, int, S_IRUGO);
>>>   MODULE_PARM_DESC(irq_coalescing_usecs,
>>>   		 "IRQ coalescing time threshold in usecs");
>>>   
>>> +static int pci_dump;
>>> +module_param(pci_dump, int, S_IRUGO);
>>> +MODULE_PARM_DESC(pci_dump, "Enable dumping of PCI registers on error");
>>> +
>>>   enum {
>>>   	/* BAR's are enumerated in terms of pci_resource_start() terms */
>>>   	MV_PRIMARY_BAR		= 0,	/* offset 0x10: memory space */
>>> @@ -1248,42 +1252,43 @@ static int mv_stop_edma(struct ata_port *ap)
>>>   	return err;
>>>   }
>>>   
>>> -#ifdef ATA_DEBUG
>>> -static void mv_dump_mem(void __iomem *start, unsigned bytes)
>>> +static void mv_dump_mem(struct device *dev, void __iomem *start, unsigned bytes)
>>>   {
>>> -	int b, w;
>>> +	int b, w, o;
>>> +	unsigned char linebuf[38];
>>> +
>>>   	for (b = 0; b < bytes; ) {
>>> -		DPRINTK("%p: ", start + b);
>>> -		for (w = 0; b < bytes && w < 4; w++) {
>>> -			printk("%08x ", readl(start + b));
>>> +		for (w = 0, o = 0; b < bytes && w < 4; w++) {
>>> +			o += snprintf(linebuf + o, 38 - o,
>>> +				      "%08x ", readl(start + b));
>>>   			b += sizeof(u32);
>>>   		}
>>> -		printk("\n");
>>> +		dev_printk(KERN_DEBUG, dev, "%s: %p: %s\n",
>>> +			   __func__, start + b, linebuf);
>>
>> Why not dev_dbg() ? Same comment for all the prints below.
>>
> Because the entire thing is encapsulated by the 'pci_dump' parameter, ie 
> it'll be only ever called when 'pci_dump' is set.
> So it feels redundant to require both, 'pci_dump' _and_ dynamic debugging.
> 
> But I can move it over to dynamic debugging and kill the pci_dump parameter.

That sounds simpler to me.

> 
> Cheers,
> 
> Hannes


-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 06/73] sata_mv: kill 'port' argument in mv_dump_all_regs()
  2021-12-09  0:40   ` Damien Le Moal
@ 2021-12-09  8:19     ` Hannes Reinecke
  0 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-09  8:19 UTC (permalink / raw)
  To: Damien Le Moal, Damien LeMoal; +Cc: linux-ide, Bartlomiej Zolnierkiewicz

On 12/9/21 1:40 AM, Damien Le Moal wrote:
> On 2021/12/09 1:31, Hannes Reinecke wrote:
>> Always '-1', so drop it and simplify the function.
>>
>> Signed-off-by: Hannes Reinecke <hare@suse.de>
>> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
>> ---
>>   drivers/ata/sata_mv.c | 24 +++++++-----------------
>>   1 file changed, 7 insertions(+), 17 deletions(-)
>>
>> diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
>> index f0257685495f..e86eddf83704 100644
>> --- a/drivers/ata/sata_mv.c
>> +++ b/drivers/ata/sata_mv.c
>> @@ -1286,23 +1286,13 @@ static void mv_dump_pci_cfg(struct pci_dev *pdev, unsigned bytes)
>>   	}
>>   }
>>   
>> -static void mv_dump_all_regs(void __iomem *mmio_base, int port,
>> -			     struct pci_dev *pdev)
>> +static void mv_dump_all_regs(void __iomem *mmio_base, struct pci_dev *pdev)
>>   {
>> -	void __iomem *hc_base = mv_hc_base(mmio_base,
>> -					   port >> MV_PORT_HC_SHIFT);
>> -	void __iomem *port_base;
>>   	int start_port, num_ports, p, start_hc, num_hcs, hc;
>>   
>> -	if (0 > port) {
>> -		start_hc = start_port = 0;
>> -		num_ports = 8;		/* shld be benign for 4 port devs */
>> -		num_hcs = 2;
>> -	} else {
>> -		start_hc = port >> MV_PORT_HC_SHIFT;
>> -		start_port = port;
>> -		num_ports = num_hcs = 1;
>> -	}
>> +	start_hc = start_port = 0;
>> +	num_ports = 8;		/* shld be benign for 4 port devs */
>> +	num_hcs = 2;
>>   	dev_printk(KERN_DEBUG, &pdev->dev,
>>   		   "%s: All registers for port(s) %u-%u:\n", __func__,
>>   		   start_port, num_ports > 1 ? num_ports - 1 : start_port);
>> @@ -1317,13 +1307,13 @@ static void mv_dump_all_regs(void __iomem *mmio_base, int port,
>>   	mv_dump_mem(&pdev->dev, mmio_base+0xf00, 0x4);
>>   	mv_dump_mem(&pdev->dev, mmio_base+0x1d00, 0x6c);
>>   	for (hc = start_hc; hc < start_hc + num_hcs; hc++) {
>> -		hc_base = mv_hc_base(mmio_base, hc);
>> +		void __iomem *hc_base = mv_hc_base(mmio_base, hc);
> 
> please add a blank line after the declaration.
> 
>>   		dev_printk(KERN_DEBUG, &pdev->dev, "%s: HC regs (HC %i):\n",
>>   			   __func__, hc);
> 
> Change this to dev_dbg() while at it ?
> 
Okay, will do.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 10/73] libata: drop debugging statements for bus-master DMA
  2021-12-09  0:46   ` Damien Le Moal
@ 2021-12-09  8:20     ` Hannes Reinecke
  0 siblings, 0 replies; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-09  8:20 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-ide

On 12/9/21 1:46 AM, Damien Le Moal wrote:
> On 2021/12/09 1:31, Hannes Reinecke wrote:
>> Bus-master DMA is now logged with generic tracepoints, so we can
>> drop the DPRINTK()/VPRINTK and dev_dbg() calls here.
>>
>> Signed-off-by: Hannes Reinecke <hare@suse.de>
>> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> 
> Wouldn't it be better to merge this in the previous patch ?
> 
Sure, can do.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 64/73] pata_sil680: convert blank printk() calls
  2021-12-08 16:32 ` [PATCH 64/73] pata_sil680: " Hannes Reinecke
@ 2021-12-09  8:24   ` Sergey Shtylyov
  0 siblings, 0 replies; 114+ messages in thread
From: Sergey Shtylyov @ 2021-12-09  8:24 UTC (permalink / raw)
  To: Hannes Reinecke, Damien LeMoal; +Cc: linux-ide

On 08.12.2021 19:32, Hannes Reinecke wrote:

> Convert blank printk() calls to structured logging.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>   drivers/ata/pata_sil680.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c
> index 81238e097fe2..0da58ce20d82 100644
> --- a/drivers/ata/pata_sil680.c
> +++ b/drivers/ata/pata_sil680.c
> @@ -308,17 +308,17 @@ static u8 sil680_init_chip(struct pci_dev *pdev, int *try_mmio)
>   
>   	switch (tmpbyte & 0x30) {
>   	case 0x00:
> -		printk(KERN_INFO "sil680: 100MHz clock.\n");
> +		dev_info(&pdev->dev, "sil680: 100MHz clock.\n");
>   		break;
>   	case 0x10:
> -		printk(KERN_INFO "sil680: 133MHz clock.\n");
> +		dev_info(&pdev->dev, "sil680: 133MHz clock.\n");
>   		break;
>   	case 0x20:
> -		printk(KERN_INFO "sil680: Using PCI clock.\n");
> +		dev_info(&pdev->dev, "sil680: Using PCI clock.\n");
>   		break;
>   	/* This last case is _NOT_ ok */
>   	case 0x30:
> -		printk(KERN_ERR "sil680: Clock disabled ?\n");
> +		dev_err(&pdev->dev, "sil680: Clock disabled ?\n");

    Could remove a space before ?, while at it?

[...]

MBR, Sergey

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 59/73] pata_cypressx: convert blank printk() calls
  2021-12-08 16:32 ` [PATCH 59/73] pata_cypressx: " Hannes Reinecke
@ 2021-12-09  8:25   ` Sergey Shtylyov
  0 siblings, 0 replies; 114+ messages in thread
From: Sergey Shtylyov @ 2021-12-09  8:25 UTC (permalink / raw)
  To: Hannes Reinecke, Damien LeMoal; +Cc: linux-ide

On 08.12.2021 19:32, Hannes Reinecke wrote:

> Convert blank printk() calls to structured logging.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>   drivers/ata/pata_cypress.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/ata/pata_cypress.c b/drivers/ata/pata_cypress.c
> index 5b3a7a8ebef6..3be5d52a777b 100644
> --- a/drivers/ata/pata_cypress.c
> +++ b/drivers/ata/pata_cypress.c
> @@ -62,7 +62,7 @@ static void cy82c693_set_piomode(struct ata_port *ap, struct ata_device *adev)
>   	u32 addr;
>   
>   	if (ata_timing_compute(adev, adev->pio_mode, &t, T, 1) < 0) {
> -		printk(KERN_ERR DRV_NAME ": mome computation failed.\n");
> +		ata_dev_err(adev, DRV_NAME ": mome computation failed.\n");

    s/mome/mode/?

[...]

MBR, Sergey

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 33/73] pata_octeon_cf: Drop pointless VPRINTK() calls and convert the remaining ones
  2021-12-08 16:32 ` [PATCH 33/73] pata_octeon_cf: " Hannes Reinecke
@ 2021-12-09  8:39   ` Sergey Shtylyov
  0 siblings, 0 replies; 114+ messages in thread
From: Sergey Shtylyov @ 2021-12-09  8:39 UTC (permalink / raw)
  To: Hannes Reinecke, Damien LeMoal; +Cc: linux-ide

On 08.12.2021 19:32, Hannes Reinecke wrote:

> Drop pointless VPRINTK() calls for entering and existing interrupt

    s/existing/exiting/?
    BTW, I'm not seeing where you drop VPRINTK() calls in the interrupt 
handlers...

> routines and convert the remaining calls to dev_dbg().
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>   drivers/ata/pata_octeon_cf.c | 23 ++---------------------
>   1 file changed, 2 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
> index 7b80bbd9b1ed..de27428920a0 100644
> --- a/drivers/ata/pata_octeon_cf.c
> +++ b/drivers/ata/pata_octeon_cf.c
[...]
> @@ -617,9 +599,8 @@ static unsigned int octeon_cf_dma_finished(struct ata_port *ap,
>   	union cvmx_mio_boot_dma_intx dma_int;
>   	u8 status;
>   
> -	VPRINTK("ata%u: protocol %d task_state %d\n",
> -		ap->print_id, qc->tf.protocol, ap->hsm_task_state);
> -
> +	ata_port_dbg(ap, "protocol %d task_state %d\n",
> +		     qc->tf.protocol, ap->hsm_task_state);

    You are replacing VPRINTK() here, not removing...

[...]

MBR, Sergey

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 22/73] libata: add qc_prep tracepoint
  2021-12-08 16:32 ` [PATCH 22/73] libata: add qc_prep tracepoint Hannes Reinecke
@ 2021-12-09  8:42   ` Sergei Shtylyov
  2021-12-09 11:14     ` Hannes Reinecke
  0 siblings, 1 reply; 114+ messages in thread
From: Sergei Shtylyov @ 2021-12-09  8:42 UTC (permalink / raw)
  To: Hannes Reinecke, Damien LeMoal; +Cc: linux-ide

On 08.12.2021 19:32, Hannes Reinecke wrote:

> Add tracepoint for ata_qc_prep().

    You're also adding a tracepoint for ata_qc_issue...

> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>   drivers/ata/libata-core.c     |  1 +
>   include/trace/events/libata.h | 10 +++++++++-
>   2 files changed, 10 insertions(+), 1 deletion(-)

[...]
> diff --git a/include/trace/events/libata.h b/include/trace/events/libata.h
> index 7d48e804b889..360f99980b44 100644
> --- a/include/trace/events/libata.h
> +++ b/include/trace/events/libata.h
[...]
> @@ -235,6 +235,14 @@ TRACE_EVENT(ata_qc_issue,
>   		  __entry->dev)
>   );
>   
> +DEFINE_EVENT(ata_qc_issue_template, ata_qc_prep,
> +	     TP_PROTO(struct ata_queued_cmd *qc),
> +	     TP_ARGS(qc));
> +
> +DEFINE_EVENT(ata_qc_issue_template, ata_qc_issue,
> +	     TP_PROTO(struct ata_queued_cmd *qc),
> +	     TP_ARGS(qc));
> +
>   DECLARE_EVENT_CLASS(ata_qc_complete_template,
>   
>   	TP_PROTO(struct ata_queued_cmd *qc),

MBR, Sergey

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 22/73] libata: add qc_prep tracepoint
  2021-12-09  8:42   ` Sergei Shtylyov
@ 2021-12-09 11:14     ` Hannes Reinecke
  2021-12-09 12:47       ` Sergei Shtylyov
  0 siblings, 1 reply; 114+ messages in thread
From: Hannes Reinecke @ 2021-12-09 11:14 UTC (permalink / raw)
  To: Sergei Shtylyov, Damien LeMoal; +Cc: linux-ide

On 12/9/21 9:42 AM, Sergei Shtylyov wrote:
> On 08.12.2021 19:32, Hannes Reinecke wrote:
> 
>> Add tracepoint for ata_qc_prep().
> 
>    You're also adding a tracepoint for ata_qc_issue...
> 
Actually, no.

I'm converting the existing tracepoint for ata_qc_issue into a template,
and then adding tracepoints for ata_qc_prep and ata_qc_issue based on
that template.

But I can make a note of this in the patch description.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		           Kernel Storage Architect
hare@suse.de			                  +49 911 74053 688
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), GF: Felix Imendörffer

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 13/73] sata_dwc_460ex: use generic tracepoints
  2021-12-08 16:31 ` [PATCH 13/73] sata_dwc_460ex: " Hannes Reinecke
@ 2021-12-09 11:57   ` kernel test robot
  2021-12-09 12:28     ` kernel test robot
  2021-12-09 19:52     ` kernel test robot
  2 siblings, 0 replies; 114+ messages in thread
From: kernel test robot @ 2021-12-09 11:57 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 6785 bytes --]

Hi Hannes,

I love your patch! Perhaps something to improve:

[auto build test WARNING on rostedt-trace/for-next]
[also build test WARNING on axboe-block/for-next linus/master v5.16-rc4 next-20211208]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Hannes-Reinecke/libata-rework-logging-take-II/20211209-003634
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git for-next
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20211209/202112091923.b2cQMxCn-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/b3bb5eac4170da8a3e9c477ad4c1c8f97164abc5
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Hannes-Reinecke/libata-rework-logging-take-II/20211209-003634
        git checkout b3bb5eac4170da8a3e9c477ad4c1c8f97164abc5
        # save the config file to linux build tree
        mkdir build_dir
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/ata/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from include/linux/device.h:15,
                    from drivers/ata/sata_dwc_460ex.c:28:
   drivers/ata/sata_dwc_460ex.c: In function 'sata_dwc_dma_xfer_complete':
   drivers/ata/sata_dwc_460ex.c:744:5: error: implicit declaration of function 'get_dma_dir_descript'; did you mean 'get_prot_descript'? [-Werror=implicit-function-declaration]
     744 |     get_dma_dir_descript(qc->dma_dir),
         |     ^~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:110:23: note: in definition of macro 'dev_printk_index_wrap'
     110 |   _p_func(dev, fmt, ##__VA_ARGS__);   \
         |                       ^~~~~~~~~~~
   drivers/ata/sata_dwc_460ex.c:741:3: note: in expansion of macro 'dev_info'
     741 |   dev_info(ap->dev,
         |   ^~~~~~~~
>> drivers/ata/sata_dwc_460ex.c:742:5: warning: format '%s' expects argument of type 'char *', but argument 6 has type 'int' [-Wformat=]
     742 |     "%s tag=%u cmd=0x%02x dma dir=%s proto=%s dmacr=0x%08x\n",
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:110:16: note: in definition of macro 'dev_printk_index_wrap'
     110 |   _p_func(dev, fmt, ##__VA_ARGS__);   \
         |                ^~~
   include/linux/dev_printk.h:150:51: note: in expansion of macro 'dev_fmt'
     150 |  dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                                                   ^~~~~~~
   drivers/ata/sata_dwc_460ex.c:741:3: note: in expansion of macro 'dev_info'
     741 |   dev_info(ap->dev,
         |   ^~~~~~~~
   drivers/ata/sata_dwc_460ex.c:742:36: note: format string is defined here
     742 |     "%s tag=%u cmd=0x%02x dma dir=%s proto=%s dmacr=0x%08x\n",
         |                                   ~^
         |                                    |
         |                                    char *
         |                                   %d
   cc1: some warnings being treated as errors


vim +742 drivers/ata/sata_dwc_460ex.c

62936009f35a66 Rupjyoti Sarmah 2010-07-06  724  
62936009f35a66 Rupjyoti Sarmah 2010-07-06  725  static void sata_dwc_dma_xfer_complete(struct ata_port *ap, u32 check_status)
62936009f35a66 Rupjyoti Sarmah 2010-07-06  726  {
62936009f35a66 Rupjyoti Sarmah 2010-07-06  727  	struct ata_queued_cmd *qc;
62936009f35a66 Rupjyoti Sarmah 2010-07-06  728  	struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap);
62936009f35a66 Rupjyoti Sarmah 2010-07-06  729  	struct sata_dwc_device *hsdev = HSDEV_FROM_AP(ap);
62936009f35a66 Rupjyoti Sarmah 2010-07-06  730  	u8 tag = 0;
62936009f35a66 Rupjyoti Sarmah 2010-07-06  731  
62936009f35a66 Rupjyoti Sarmah 2010-07-06  732  	tag = ap->link.active_tag;
62936009f35a66 Rupjyoti Sarmah 2010-07-06  733  	qc = ata_qc_from_tag(ap, tag);
62936009f35a66 Rupjyoti Sarmah 2010-07-06  734  	if (!qc) {
62936009f35a66 Rupjyoti Sarmah 2010-07-06  735  		dev_err(ap->dev, "failed to get qc");
62936009f35a66 Rupjyoti Sarmah 2010-07-06  736  		return;
62936009f35a66 Rupjyoti Sarmah 2010-07-06  737  	}
62936009f35a66 Rupjyoti Sarmah 2010-07-06  738  
62936009f35a66 Rupjyoti Sarmah 2010-07-06  739  #ifdef DEBUG_NCQ
62936009f35a66 Rupjyoti Sarmah 2010-07-06  740  	if (tag > 0) {
d578514b271e7c Andy Shevchenko 2015-03-03  741  		dev_info(ap->dev,
d578514b271e7c Andy Shevchenko 2015-03-03 @742  			 "%s tag=%u cmd=0x%02x dma dir=%s proto=%s dmacr=0x%08x\n",
4e5b6260cc9ba8 Jens Axboe      2018-05-11  743  			 __func__, qc->hw_tag, qc->tf.command,
84b47e3b16f8a5 Sergei Shtylyov 2011-01-28 @744  			 get_dma_dir_descript(qc->dma_dir),
84b47e3b16f8a5 Sergei Shtylyov 2011-01-28  745  			 get_prot_descript(qc->tf.protocol),
ee81d6cc8e8aa6 Mans Rullgard   2016-04-26  746  			 sata_dwc_readl(&hsdev->sata_dwc_regs->dmacr));
62936009f35a66 Rupjyoti Sarmah 2010-07-06  747  	}
62936009f35a66 Rupjyoti Sarmah 2010-07-06  748  #endif
62936009f35a66 Rupjyoti Sarmah 2010-07-06  749  
62936009f35a66 Rupjyoti Sarmah 2010-07-06  750  	if (ata_is_dma(qc->tf.protocol)) {
62936009f35a66 Rupjyoti Sarmah 2010-07-06  751  		if (hsdevp->dma_pending[tag] == SATA_DWC_DMA_PENDING_NONE) {
d578514b271e7c Andy Shevchenko 2015-03-03  752  			dev_err(ap->dev,
d578514b271e7c Andy Shevchenko 2015-03-03  753  				"%s DMA protocol RX and TX DMA not pending dmacr: 0x%08x\n",
d578514b271e7c Andy Shevchenko 2015-03-03  754  				__func__,
ee81d6cc8e8aa6 Mans Rullgard   2016-04-26  755  				sata_dwc_readl(&hsdev->sata_dwc_regs->dmacr));
62936009f35a66 Rupjyoti Sarmah 2010-07-06  756  		}
62936009f35a66 Rupjyoti Sarmah 2010-07-06  757  
62936009f35a66 Rupjyoti Sarmah 2010-07-06  758  		hsdevp->dma_pending[tag] = SATA_DWC_DMA_PENDING_NONE;
62936009f35a66 Rupjyoti Sarmah 2010-07-06  759  		sata_dwc_qc_complete(ap, qc, check_status);
62936009f35a66 Rupjyoti Sarmah 2010-07-06  760  		ap->link.active_tag = ATA_TAG_POISON;
62936009f35a66 Rupjyoti Sarmah 2010-07-06  761  	} else {
62936009f35a66 Rupjyoti Sarmah 2010-07-06  762  		sata_dwc_qc_complete(ap, qc, check_status);
62936009f35a66 Rupjyoti Sarmah 2010-07-06  763  	}
62936009f35a66 Rupjyoti Sarmah 2010-07-06  764  }
62936009f35a66 Rupjyoti Sarmah 2010-07-06  765  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 13/73] sata_dwc_460ex: use generic tracepoints
  2021-12-08 16:31 ` [PATCH 13/73] sata_dwc_460ex: " Hannes Reinecke
@ 2021-12-09 12:28     ` kernel test robot
  2021-12-09 12:28     ` kernel test robot
  2021-12-09 19:52     ` kernel test robot
  2 siblings, 0 replies; 114+ messages in thread
From: kernel test robot @ 2021-12-09 12:28 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: llvm, kbuild-all

Hi Hannes,

I love your patch! Perhaps something to improve:

[auto build test WARNING on rostedt-trace/for-next]
[also build test WARNING on axboe-block/for-next linus/master v5.16-rc4 next-20211208]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Hannes-Reinecke/libata-rework-logging-take-II/20211209-003634
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git for-next
config: i386-randconfig-a012-20211209 (https://download.01.org/0day-ci/archive/20211209/202112092036.fKbXi4EI-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 097a1cb1d5ebb3a0ec4bcaed8ba3ff6a8e33c00a)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/b3bb5eac4170da8a3e9c477ad4c1c8f97164abc5
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Hannes-Reinecke/libata-rework-logging-take-II/20211209-003634
        git checkout b3bb5eac4170da8a3e9c477ad4c1c8f97164abc5
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/ata/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/ata/sata_dwc_460ex.c:744:5: error: implicit declaration of function 'get_dma_dir_descript' [-Werror,-Wimplicit-function-declaration]
                            get_dma_dir_descript(qc->dma_dir),
                            ^
>> drivers/ata/sata_dwc_460ex.c:744:5: warning: format specifies type 'char *' but the argument has type 'int' [-Wformat]
                            get_dma_dir_descript(qc->dma_dir),
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:150:67: note: expanded from macro 'dev_info'
           dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
                                                                    ~~~     ^~~~~~~~~~~
   include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
                   _p_func(dev, fmt, ##__VA_ARGS__);                       \
                                ~~~    ^~~~~~~~~~~
   1 warning and 1 error generated.


vim +744 drivers/ata/sata_dwc_460ex.c

62936009f35a66 Rupjyoti Sarmah 2010-07-06  724  
62936009f35a66 Rupjyoti Sarmah 2010-07-06  725  static void sata_dwc_dma_xfer_complete(struct ata_port *ap, u32 check_status)
62936009f35a66 Rupjyoti Sarmah 2010-07-06  726  {
62936009f35a66 Rupjyoti Sarmah 2010-07-06  727  	struct ata_queued_cmd *qc;
62936009f35a66 Rupjyoti Sarmah 2010-07-06  728  	struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap);
62936009f35a66 Rupjyoti Sarmah 2010-07-06  729  	struct sata_dwc_device *hsdev = HSDEV_FROM_AP(ap);
62936009f35a66 Rupjyoti Sarmah 2010-07-06  730  	u8 tag = 0;
62936009f35a66 Rupjyoti Sarmah 2010-07-06  731  
62936009f35a66 Rupjyoti Sarmah 2010-07-06  732  	tag = ap->link.active_tag;
62936009f35a66 Rupjyoti Sarmah 2010-07-06  733  	qc = ata_qc_from_tag(ap, tag);
62936009f35a66 Rupjyoti Sarmah 2010-07-06  734  	if (!qc) {
62936009f35a66 Rupjyoti Sarmah 2010-07-06  735  		dev_err(ap->dev, "failed to get qc");
62936009f35a66 Rupjyoti Sarmah 2010-07-06  736  		return;
62936009f35a66 Rupjyoti Sarmah 2010-07-06  737  	}
62936009f35a66 Rupjyoti Sarmah 2010-07-06  738  
62936009f35a66 Rupjyoti Sarmah 2010-07-06  739  #ifdef DEBUG_NCQ
62936009f35a66 Rupjyoti Sarmah 2010-07-06  740  	if (tag > 0) {
d578514b271e7c Andy Shevchenko 2015-03-03  741  		dev_info(ap->dev,
d578514b271e7c Andy Shevchenko 2015-03-03  742  			 "%s tag=%u cmd=0x%02x dma dir=%s proto=%s dmacr=0x%08x\n",
4e5b6260cc9ba8 Jens Axboe      2018-05-11  743  			 __func__, qc->hw_tag, qc->tf.command,
84b47e3b16f8a5 Sergei Shtylyov 2011-01-28 @744  			 get_dma_dir_descript(qc->dma_dir),
84b47e3b16f8a5 Sergei Shtylyov 2011-01-28  745  			 get_prot_descript(qc->tf.protocol),
ee81d6cc8e8aa6 Mans Rullgard   2016-04-26  746  			 sata_dwc_readl(&hsdev->sata_dwc_regs->dmacr));
62936009f35a66 Rupjyoti Sarmah 2010-07-06  747  	}
62936009f35a66 Rupjyoti Sarmah 2010-07-06  748  #endif
62936009f35a66 Rupjyoti Sarmah 2010-07-06  749  
62936009f35a66 Rupjyoti Sarmah 2010-07-06  750  	if (ata_is_dma(qc->tf.protocol)) {
62936009f35a66 Rupjyoti Sarmah 2010-07-06  751  		if (hsdevp->dma_pending[tag] == SATA_DWC_DMA_PENDING_NONE) {
d578514b271e7c Andy Shevchenko 2015-03-03  752  			dev_err(ap->dev,
d578514b271e7c Andy Shevchenko 2015-03-03  753  				"%s DMA protocol RX and TX DMA not pending dmacr: 0x%08x\n",
d578514b271e7c Andy Shevchenko 2015-03-03  754  				__func__,
ee81d6cc8e8aa6 Mans Rullgard   2016-04-26  755  				sata_dwc_readl(&hsdev->sata_dwc_regs->dmacr));
62936009f35a66 Rupjyoti Sarmah 2010-07-06  756  		}
62936009f35a66 Rupjyoti Sarmah 2010-07-06  757  
62936009f35a66 Rupjyoti Sarmah 2010-07-06  758  		hsdevp->dma_pending[tag] = SATA_DWC_DMA_PENDING_NONE;
62936009f35a66 Rupjyoti Sarmah 2010-07-06  759  		sata_dwc_qc_complete(ap, qc, check_status);
62936009f35a66 Rupjyoti Sarmah 2010-07-06  760  		ap->link.active_tag = ATA_TAG_POISON;
62936009f35a66 Rupjyoti Sarmah 2010-07-06  761  	} else {
62936009f35a66 Rupjyoti Sarmah 2010-07-06  762  		sata_dwc_qc_complete(ap, qc, check_status);
62936009f35a66 Rupjyoti Sarmah 2010-07-06  763  	}
62936009f35a66 Rupjyoti Sarmah 2010-07-06  764  }
62936009f35a66 Rupjyoti Sarmah 2010-07-06  765  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 13/73] sata_dwc_460ex: use generic tracepoints
@ 2021-12-09 12:28     ` kernel test robot
  0 siblings, 0 replies; 114+ messages in thread
From: kernel test robot @ 2021-12-09 12:28 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 6049 bytes --]

Hi Hannes,

I love your patch! Perhaps something to improve:

[auto build test WARNING on rostedt-trace/for-next]
[also build test WARNING on axboe-block/for-next linus/master v5.16-rc4 next-20211208]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Hannes-Reinecke/libata-rework-logging-take-II/20211209-003634
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git for-next
config: i386-randconfig-a012-20211209 (https://download.01.org/0day-ci/archive/20211209/202112092036.fKbXi4EI-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 097a1cb1d5ebb3a0ec4bcaed8ba3ff6a8e33c00a)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/b3bb5eac4170da8a3e9c477ad4c1c8f97164abc5
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Hannes-Reinecke/libata-rework-logging-take-II/20211209-003634
        git checkout b3bb5eac4170da8a3e9c477ad4c1c8f97164abc5
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/ata/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/ata/sata_dwc_460ex.c:744:5: error: implicit declaration of function 'get_dma_dir_descript' [-Werror,-Wimplicit-function-declaration]
                            get_dma_dir_descript(qc->dma_dir),
                            ^
>> drivers/ata/sata_dwc_460ex.c:744:5: warning: format specifies type 'char *' but the argument has type 'int' [-Wformat]
                            get_dma_dir_descript(qc->dma_dir),
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:150:67: note: expanded from macro 'dev_info'
           dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
                                                                    ~~~     ^~~~~~~~~~~
   include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
                   _p_func(dev, fmt, ##__VA_ARGS__);                       \
                                ~~~    ^~~~~~~~~~~
   1 warning and 1 error generated.


vim +744 drivers/ata/sata_dwc_460ex.c

62936009f35a66 Rupjyoti Sarmah 2010-07-06  724  
62936009f35a66 Rupjyoti Sarmah 2010-07-06  725  static void sata_dwc_dma_xfer_complete(struct ata_port *ap, u32 check_status)
62936009f35a66 Rupjyoti Sarmah 2010-07-06  726  {
62936009f35a66 Rupjyoti Sarmah 2010-07-06  727  	struct ata_queued_cmd *qc;
62936009f35a66 Rupjyoti Sarmah 2010-07-06  728  	struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap);
62936009f35a66 Rupjyoti Sarmah 2010-07-06  729  	struct sata_dwc_device *hsdev = HSDEV_FROM_AP(ap);
62936009f35a66 Rupjyoti Sarmah 2010-07-06  730  	u8 tag = 0;
62936009f35a66 Rupjyoti Sarmah 2010-07-06  731  
62936009f35a66 Rupjyoti Sarmah 2010-07-06  732  	tag = ap->link.active_tag;
62936009f35a66 Rupjyoti Sarmah 2010-07-06  733  	qc = ata_qc_from_tag(ap, tag);
62936009f35a66 Rupjyoti Sarmah 2010-07-06  734  	if (!qc) {
62936009f35a66 Rupjyoti Sarmah 2010-07-06  735  		dev_err(ap->dev, "failed to get qc");
62936009f35a66 Rupjyoti Sarmah 2010-07-06  736  		return;
62936009f35a66 Rupjyoti Sarmah 2010-07-06  737  	}
62936009f35a66 Rupjyoti Sarmah 2010-07-06  738  
62936009f35a66 Rupjyoti Sarmah 2010-07-06  739  #ifdef DEBUG_NCQ
62936009f35a66 Rupjyoti Sarmah 2010-07-06  740  	if (tag > 0) {
d578514b271e7c Andy Shevchenko 2015-03-03  741  		dev_info(ap->dev,
d578514b271e7c Andy Shevchenko 2015-03-03  742  			 "%s tag=%u cmd=0x%02x dma dir=%s proto=%s dmacr=0x%08x\n",
4e5b6260cc9ba8 Jens Axboe      2018-05-11  743  			 __func__, qc->hw_tag, qc->tf.command,
84b47e3b16f8a5 Sergei Shtylyov 2011-01-28 @744  			 get_dma_dir_descript(qc->dma_dir),
84b47e3b16f8a5 Sergei Shtylyov 2011-01-28  745  			 get_prot_descript(qc->tf.protocol),
ee81d6cc8e8aa6 Mans Rullgard   2016-04-26  746  			 sata_dwc_readl(&hsdev->sata_dwc_regs->dmacr));
62936009f35a66 Rupjyoti Sarmah 2010-07-06  747  	}
62936009f35a66 Rupjyoti Sarmah 2010-07-06  748  #endif
62936009f35a66 Rupjyoti Sarmah 2010-07-06  749  
62936009f35a66 Rupjyoti Sarmah 2010-07-06  750  	if (ata_is_dma(qc->tf.protocol)) {
62936009f35a66 Rupjyoti Sarmah 2010-07-06  751  		if (hsdevp->dma_pending[tag] == SATA_DWC_DMA_PENDING_NONE) {
d578514b271e7c Andy Shevchenko 2015-03-03  752  			dev_err(ap->dev,
d578514b271e7c Andy Shevchenko 2015-03-03  753  				"%s DMA protocol RX and TX DMA not pending dmacr: 0x%08x\n",
d578514b271e7c Andy Shevchenko 2015-03-03  754  				__func__,
ee81d6cc8e8aa6 Mans Rullgard   2016-04-26  755  				sata_dwc_readl(&hsdev->sata_dwc_regs->dmacr));
62936009f35a66 Rupjyoti Sarmah 2010-07-06  756  		}
62936009f35a66 Rupjyoti Sarmah 2010-07-06  757  
62936009f35a66 Rupjyoti Sarmah 2010-07-06  758  		hsdevp->dma_pending[tag] = SATA_DWC_DMA_PENDING_NONE;
62936009f35a66 Rupjyoti Sarmah 2010-07-06  759  		sata_dwc_qc_complete(ap, qc, check_status);
62936009f35a66 Rupjyoti Sarmah 2010-07-06  760  		ap->link.active_tag = ATA_TAG_POISON;
62936009f35a66 Rupjyoti Sarmah 2010-07-06  761  	} else {
62936009f35a66 Rupjyoti Sarmah 2010-07-06  762  		sata_dwc_qc_complete(ap, qc, check_status);
62936009f35a66 Rupjyoti Sarmah 2010-07-06  763  	}
62936009f35a66 Rupjyoti Sarmah 2010-07-06  764  }
62936009f35a66 Rupjyoti Sarmah 2010-07-06  765  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 22/73] libata: add qc_prep tracepoint
  2021-12-09 11:14     ` Hannes Reinecke
@ 2021-12-09 12:47       ` Sergei Shtylyov
  0 siblings, 0 replies; 114+ messages in thread
From: Sergei Shtylyov @ 2021-12-09 12:47 UTC (permalink / raw)
  To: Hannes Reinecke, Damien LeMoal; +Cc: linux-ide

On 09.12.2021 14:14, Hannes Reinecke wrote:

[...]
>>> Add tracepoint for ata_qc_prep().
>>
>>     You're also adding a tracepoint for ata_qc_issue...
>>
> Actually, no.
> 
> I'm converting the existing tracepoint for ata_qc_issue into a template,
> and then adding tracepoints for ata_qc_prep and ata_qc_issue based on
> that template.
> 
> But I can make a note of this in the patch description.

    Please do. :-)

> Cheers,
> 
> Hannes

MBR, Sergei

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 13/73] sata_dwc_460ex: use generic tracepoints
  2021-12-08 16:31 ` [PATCH 13/73] sata_dwc_460ex: " Hannes Reinecke
@ 2021-12-09 19:52     ` kernel test robot
  2021-12-09 12:28     ` kernel test robot
  2021-12-09 19:52     ` kernel test robot
  2 siblings, 0 replies; 114+ messages in thread
From: kernel test robot @ 2021-12-09 19:52 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: llvm, kbuild-all

Hi Hannes,

I love your patch! Yet something to improve:

[auto build test ERROR on rostedt-trace/for-next]
[also build test ERROR on axboe-block/for-next linus/master v5.16-rc4 next-20211208]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Hannes-Reinecke/libata-rework-logging-take-II/20211209-003634
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git for-next
config: i386-randconfig-a012-20211209 (https://download.01.org/0day-ci/archive/20211210/202112100319.zR4w9NfW-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 097a1cb1d5ebb3a0ec4bcaed8ba3ff6a8e33c00a)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/b3bb5eac4170da8a3e9c477ad4c1c8f97164abc5
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Hannes-Reinecke/libata-rework-logging-take-II/20211209-003634
        git checkout b3bb5eac4170da8a3e9c477ad4c1c8f97164abc5
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/ata/sata_dwc_460ex.c:744:5: error: implicit declaration of function 'get_dma_dir_descript' [-Werror,-Wimplicit-function-declaration]
                            get_dma_dir_descript(qc->dma_dir),
                            ^
   drivers/ata/sata_dwc_460ex.c:744:5: warning: format specifies type 'char *' but the argument has type 'int' [-Wformat]
                            get_dma_dir_descript(qc->dma_dir),
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:150:67: note: expanded from macro 'dev_info'
           dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
                                                                    ~~~     ^~~~~~~~~~~
   include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
                   _p_func(dev, fmt, ##__VA_ARGS__);                       \
                                ~~~    ^~~~~~~~~~~
   1 warning and 1 error generated.


vim +/get_dma_dir_descript +744 drivers/ata/sata_dwc_460ex.c

62936009f35a665 Rupjyoti Sarmah 2010-07-06  724  
62936009f35a665 Rupjyoti Sarmah 2010-07-06  725  static void sata_dwc_dma_xfer_complete(struct ata_port *ap, u32 check_status)
62936009f35a665 Rupjyoti Sarmah 2010-07-06  726  {
62936009f35a665 Rupjyoti Sarmah 2010-07-06  727  	struct ata_queued_cmd *qc;
62936009f35a665 Rupjyoti Sarmah 2010-07-06  728  	struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap);
62936009f35a665 Rupjyoti Sarmah 2010-07-06  729  	struct sata_dwc_device *hsdev = HSDEV_FROM_AP(ap);
62936009f35a665 Rupjyoti Sarmah 2010-07-06  730  	u8 tag = 0;
62936009f35a665 Rupjyoti Sarmah 2010-07-06  731  
62936009f35a665 Rupjyoti Sarmah 2010-07-06  732  	tag = ap->link.active_tag;
62936009f35a665 Rupjyoti Sarmah 2010-07-06  733  	qc = ata_qc_from_tag(ap, tag);
62936009f35a665 Rupjyoti Sarmah 2010-07-06  734  	if (!qc) {
62936009f35a665 Rupjyoti Sarmah 2010-07-06  735  		dev_err(ap->dev, "failed to get qc");
62936009f35a665 Rupjyoti Sarmah 2010-07-06  736  		return;
62936009f35a665 Rupjyoti Sarmah 2010-07-06  737  	}
62936009f35a665 Rupjyoti Sarmah 2010-07-06  738  
62936009f35a665 Rupjyoti Sarmah 2010-07-06  739  #ifdef DEBUG_NCQ
62936009f35a665 Rupjyoti Sarmah 2010-07-06  740  	if (tag > 0) {
d578514b271e7c8 Andy Shevchenko 2015-03-03  741  		dev_info(ap->dev,
d578514b271e7c8 Andy Shevchenko 2015-03-03  742  			 "%s tag=%u cmd=0x%02x dma dir=%s proto=%s dmacr=0x%08x\n",
4e5b6260cc9ba84 Jens Axboe      2018-05-11  743  			 __func__, qc->hw_tag, qc->tf.command,
84b47e3b16f8a5b Sergei Shtylyov 2011-01-28 @744  			 get_dma_dir_descript(qc->dma_dir),
84b47e3b16f8a5b Sergei Shtylyov 2011-01-28  745  			 get_prot_descript(qc->tf.protocol),
ee81d6cc8e8aa66 Mans Rullgard   2016-04-26  746  			 sata_dwc_readl(&hsdev->sata_dwc_regs->dmacr));
62936009f35a665 Rupjyoti Sarmah 2010-07-06  747  	}
62936009f35a665 Rupjyoti Sarmah 2010-07-06  748  #endif
62936009f35a665 Rupjyoti Sarmah 2010-07-06  749  
62936009f35a665 Rupjyoti Sarmah 2010-07-06  750  	if (ata_is_dma(qc->tf.protocol)) {
62936009f35a665 Rupjyoti Sarmah 2010-07-06  751  		if (hsdevp->dma_pending[tag] == SATA_DWC_DMA_PENDING_NONE) {
d578514b271e7c8 Andy Shevchenko 2015-03-03  752  			dev_err(ap->dev,
d578514b271e7c8 Andy Shevchenko 2015-03-03  753  				"%s DMA protocol RX and TX DMA not pending dmacr: 0x%08x\n",
d578514b271e7c8 Andy Shevchenko 2015-03-03  754  				__func__,
ee81d6cc8e8aa66 Mans Rullgard   2016-04-26  755  				sata_dwc_readl(&hsdev->sata_dwc_regs->dmacr));
62936009f35a665 Rupjyoti Sarmah 2010-07-06  756  		}
62936009f35a665 Rupjyoti Sarmah 2010-07-06  757  
62936009f35a665 Rupjyoti Sarmah 2010-07-06  758  		hsdevp->dma_pending[tag] = SATA_DWC_DMA_PENDING_NONE;
62936009f35a665 Rupjyoti Sarmah 2010-07-06  759  		sata_dwc_qc_complete(ap, qc, check_status);
62936009f35a665 Rupjyoti Sarmah 2010-07-06  760  		ap->link.active_tag = ATA_TAG_POISON;
62936009f35a665 Rupjyoti Sarmah 2010-07-06  761  	} else {
62936009f35a665 Rupjyoti Sarmah 2010-07-06  762  		sata_dwc_qc_complete(ap, qc, check_status);
62936009f35a665 Rupjyoti Sarmah 2010-07-06  763  	}
62936009f35a665 Rupjyoti Sarmah 2010-07-06  764  }
62936009f35a665 Rupjyoti Sarmah 2010-07-06  765  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply	[flat|nested] 114+ messages in thread

* Re: [PATCH 13/73] sata_dwc_460ex: use generic tracepoints
@ 2021-12-09 19:52     ` kernel test robot
  0 siblings, 0 replies; 114+ messages in thread
From: kernel test robot @ 2021-12-09 19:52 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 6091 bytes --]

Hi Hannes,

I love your patch! Yet something to improve:

[auto build test ERROR on rostedt-trace/for-next]
[also build test ERROR on axboe-block/for-next linus/master v5.16-rc4 next-20211208]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Hannes-Reinecke/libata-rework-logging-take-II/20211209-003634
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git for-next
config: i386-randconfig-a012-20211209 (https://download.01.org/0day-ci/archive/20211210/202112100319.zR4w9NfW-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 097a1cb1d5ebb3a0ec4bcaed8ba3ff6a8e33c00a)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/b3bb5eac4170da8a3e9c477ad4c1c8f97164abc5
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Hannes-Reinecke/libata-rework-logging-take-II/20211209-003634
        git checkout b3bb5eac4170da8a3e9c477ad4c1c8f97164abc5
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/ata/sata_dwc_460ex.c:744:5: error: implicit declaration of function 'get_dma_dir_descript' [-Werror,-Wimplicit-function-declaration]
                            get_dma_dir_descript(qc->dma_dir),
                            ^
   drivers/ata/sata_dwc_460ex.c:744:5: warning: format specifies type 'char *' but the argument has type 'int' [-Wformat]
                            get_dma_dir_descript(qc->dma_dir),
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:150:67: note: expanded from macro 'dev_info'
           dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
                                                                    ~~~     ^~~~~~~~~~~
   include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
                   _p_func(dev, fmt, ##__VA_ARGS__);                       \
                                ~~~    ^~~~~~~~~~~
   1 warning and 1 error generated.


vim +/get_dma_dir_descript +744 drivers/ata/sata_dwc_460ex.c

62936009f35a665 Rupjyoti Sarmah 2010-07-06  724  
62936009f35a665 Rupjyoti Sarmah 2010-07-06  725  static void sata_dwc_dma_xfer_complete(struct ata_port *ap, u32 check_status)
62936009f35a665 Rupjyoti Sarmah 2010-07-06  726  {
62936009f35a665 Rupjyoti Sarmah 2010-07-06  727  	struct ata_queued_cmd *qc;
62936009f35a665 Rupjyoti Sarmah 2010-07-06  728  	struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap);
62936009f35a665 Rupjyoti Sarmah 2010-07-06  729  	struct sata_dwc_device *hsdev = HSDEV_FROM_AP(ap);
62936009f35a665 Rupjyoti Sarmah 2010-07-06  730  	u8 tag = 0;
62936009f35a665 Rupjyoti Sarmah 2010-07-06  731  
62936009f35a665 Rupjyoti Sarmah 2010-07-06  732  	tag = ap->link.active_tag;
62936009f35a665 Rupjyoti Sarmah 2010-07-06  733  	qc = ata_qc_from_tag(ap, tag);
62936009f35a665 Rupjyoti Sarmah 2010-07-06  734  	if (!qc) {
62936009f35a665 Rupjyoti Sarmah 2010-07-06  735  		dev_err(ap->dev, "failed to get qc");
62936009f35a665 Rupjyoti Sarmah 2010-07-06  736  		return;
62936009f35a665 Rupjyoti Sarmah 2010-07-06  737  	}
62936009f35a665 Rupjyoti Sarmah 2010-07-06  738  
62936009f35a665 Rupjyoti Sarmah 2010-07-06  739  #ifdef DEBUG_NCQ
62936009f35a665 Rupjyoti Sarmah 2010-07-06  740  	if (tag > 0) {
d578514b271e7c8 Andy Shevchenko 2015-03-03  741  		dev_info(ap->dev,
d578514b271e7c8 Andy Shevchenko 2015-03-03  742  			 "%s tag=%u cmd=0x%02x dma dir=%s proto=%s dmacr=0x%08x\n",
4e5b6260cc9ba84 Jens Axboe      2018-05-11  743  			 __func__, qc->hw_tag, qc->tf.command,
84b47e3b16f8a5b Sergei Shtylyov 2011-01-28 @744  			 get_dma_dir_descript(qc->dma_dir),
84b47e3b16f8a5b Sergei Shtylyov 2011-01-28  745  			 get_prot_descript(qc->tf.protocol),
ee81d6cc8e8aa66 Mans Rullgard   2016-04-26  746  			 sata_dwc_readl(&hsdev->sata_dwc_regs->dmacr));
62936009f35a665 Rupjyoti Sarmah 2010-07-06  747  	}
62936009f35a665 Rupjyoti Sarmah 2010-07-06  748  #endif
62936009f35a665 Rupjyoti Sarmah 2010-07-06  749  
62936009f35a665 Rupjyoti Sarmah 2010-07-06  750  	if (ata_is_dma(qc->tf.protocol)) {
62936009f35a665 Rupjyoti Sarmah 2010-07-06  751  		if (hsdevp->dma_pending[tag] == SATA_DWC_DMA_PENDING_NONE) {
d578514b271e7c8 Andy Shevchenko 2015-03-03  752  			dev_err(ap->dev,
d578514b271e7c8 Andy Shevchenko 2015-03-03  753  				"%s DMA protocol RX and TX DMA not pending dmacr: 0x%08x\n",
d578514b271e7c8 Andy Shevchenko 2015-03-03  754  				__func__,
ee81d6cc8e8aa66 Mans Rullgard   2016-04-26  755  				sata_dwc_readl(&hsdev->sata_dwc_regs->dmacr));
62936009f35a665 Rupjyoti Sarmah 2010-07-06  756  		}
62936009f35a665 Rupjyoti Sarmah 2010-07-06  757  
62936009f35a665 Rupjyoti Sarmah 2010-07-06  758  		hsdevp->dma_pending[tag] = SATA_DWC_DMA_PENDING_NONE;
62936009f35a665 Rupjyoti Sarmah 2010-07-06  759  		sata_dwc_qc_complete(ap, qc, check_status);
62936009f35a665 Rupjyoti Sarmah 2010-07-06  760  		ap->link.active_tag = ATA_TAG_POISON;
62936009f35a665 Rupjyoti Sarmah 2010-07-06  761  	} else {
62936009f35a665 Rupjyoti Sarmah 2010-07-06  762  		sata_dwc_qc_complete(ap, qc, check_status);
62936009f35a665 Rupjyoti Sarmah 2010-07-06  763  	}
62936009f35a665 Rupjyoti Sarmah 2010-07-06  764  }
62936009f35a665 Rupjyoti Sarmah 2010-07-06  765  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 114+ messages in thread

end of thread, other threads:[~2021-12-09 19:53 UTC | newest]

Thread overview: 114+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-08 16:31 [PATCH 00/73] libata: rework logging, take II Hannes Reinecke
2021-12-08 16:31 ` [PATCH 01/73] libata: remove pointless debugging messages Hannes Reinecke
2021-12-08 16:31 ` [PATCH 02/73] libata: Add ata_port_classify() helper Hannes Reinecke
2021-12-08 22:21   ` kernel test robot
2021-12-08 22:21     ` kernel test robot
2021-12-09  0:34   ` Damien Le Moal
2021-12-09  7:16     ` Hannes Reinecke
2021-12-09  4:20   ` kernel test robot
2021-12-08 16:31 ` [PATCH 03/73] libata: move ata_dump_id() to dynamic debugging Hannes Reinecke
2021-12-08 16:31 ` [PATCH 04/73] libata: sanitize ATA_HORKAGE_DUMP_ID Hannes Reinecke
2021-12-08 16:31 ` [PATCH 05/73] sata_mv: replace DPRINTK with 'pci_dump' module parameter Hannes Reinecke
2021-12-09  0:38   ` Damien Le Moal
2021-12-09  7:17     ` Hannes Reinecke
2021-12-09  8:10       ` Damien Le Moal
2021-12-08 16:31 ` [PATCH 06/73] sata_mv: kill 'port' argument in mv_dump_all_regs() Hannes Reinecke
2021-12-09  0:40   ` Damien Le Moal
2021-12-09  8:19     ` Hannes Reinecke
2021-12-08 16:31 ` [PATCH 07/73] libata: add reset tracepoints Hannes Reinecke
2021-12-08 16:31 ` [PATCH 08/73] libata: drop DPRINTK() calls in reset Hannes Reinecke
2021-12-09  0:47   ` Damien Le Moal
2021-12-08 16:31 ` [PATCH 09/73] libata: tracepoints for bus-master DMA Hannes Reinecke
2021-12-08 16:31 ` [PATCH 10/73] libata: drop debugging statements " Hannes Reinecke
2021-12-09  0:46   ` Damien Le Moal
2021-12-09  8:20     ` Hannes Reinecke
2021-12-08 16:31 ` [PATCH 11/73] pata_octeon_cf: add bmdma tracepoints and drop DPRINTK() calls Hannes Reinecke
2021-12-08 16:31 ` [PATCH 12/73] pata_arasan_cf: use generic tracepoints Hannes Reinecke
2021-12-08 16:31 ` [PATCH 13/73] sata_dwc_460ex: " Hannes Reinecke
2021-12-09 11:57   ` kernel test robot
2021-12-09 12:28   ` kernel test robot
2021-12-09 12:28     ` kernel test robot
2021-12-09 19:52   ` kernel test robot
2021-12-09 19:52     ` kernel test robot
2021-12-08 16:31 ` [PATCH 14/73] sata_nv: " Hannes Reinecke
2021-12-08 16:31 ` [PATCH 15/73] libata-sff: tracepoints for HSM state machine Hannes Reinecke
2021-12-08 16:31 ` [PATCH 16/73] libata-sff: add tracepoints for ata_sff_flush_pio_task() Hannes Reinecke
2021-12-08 16:31 ` [PATCH 17/73] libata-scsi: drop DPRINTK calls for cdb translation Hannes Reinecke
2021-12-08 16:32 ` [PATCH 18/73] libata: add tracepoints for ATA error handling Hannes Reinecke
2021-12-08 16:32 ` [PATCH 19/73] libata: drop DPRINTK() calls during " Hannes Reinecke
2021-12-09  0:50   ` Damien Le Moal
2021-12-08 16:32 ` [PATCH 20/73] libata-eh: remove DPRINTK() calls for request sense Hannes Reinecke
2021-12-09  0:51   ` Damien Le Moal
2021-12-08 16:32 ` [PATCH 21/73] libata: move ata_{port,link,dev}_dbg to standard dev_XXX() macros Hannes Reinecke
2021-12-09  0:57   ` Damien Le Moal
2021-12-08 16:32 ` [PATCH 22/73] libata: add qc_prep tracepoint Hannes Reinecke
2021-12-09  8:42   ` Sergei Shtylyov
2021-12-09 11:14     ` Hannes Reinecke
2021-12-09 12:47       ` Sergei Shtylyov
2021-12-08 16:32 ` [PATCH 23/73] libata: move DPRINTK to ata debugging Hannes Reinecke
2021-12-08 16:32 ` [PATCH 24/73] pata_octeon_cf: remove DPRINTK() macro in interrupt context Hannes Reinecke
2021-12-09  0:58   ` Damien Le Moal
2021-12-08 16:32 ` [PATCH 25/73] pdc_adma: Remove DPRINTK call Hannes Reinecke
2021-12-08 16:32 ` [PATCH 26/73] sata_fsl: move DPRINTK to ata debugging Hannes Reinecke
2021-12-08 16:32 ` [PATCH 27/73] sata_rcar: replace DPRINTK() with ata_port_dbg() Hannes Reinecke
2021-12-08 16:32 ` [PATCH 28/73] sata_qstor: " Hannes Reinecke
2021-12-08 16:32 ` [PATCH 29/73] pata_pdc2027x: Replace PDPRINTK() with standard ata logging Hannes Reinecke
2021-12-08 16:32 ` [PATCH 30/73] libata: remove pointless VPRINTK() calls Hannes Reinecke
2021-12-08 16:32 ` [PATCH 31/73] ahci: Drop pointless VPRINTK() calls and convert the remaining ones Hannes Reinecke
2021-12-08 16:32 ` [PATCH 32/73] pdc_adma: " Hannes Reinecke
2021-12-09  1:01   ` Damien Le Moal
2021-12-08 16:32 ` [PATCH 33/73] pata_octeon_cf: " Hannes Reinecke
2021-12-09  8:39   ` Sergey Shtylyov
2021-12-08 16:32 ` [PATCH 34/73] pata_via: Drop pointless VPRINTK() calls Hannes Reinecke
2021-12-08 16:32 ` [PATCH 35/73] sata_promise: Drop pointless VPRINTK() calls and convert the remaining ones Hannes Reinecke
2021-12-09  6:13   ` Mikael Pettersson
2021-12-08 16:32 ` [PATCH 36/73] sata_qstor: Drop pointless VPRINTK() calls Hannes Reinecke
2021-12-08 16:32 ` [PATCH 37/73] sata_rcar: " Hannes Reinecke
2021-12-08 16:32 ` [PATCH 38/73] sata_inic162x: " Hannes Reinecke
2021-12-08 16:32 ` [PATCH 39/73] sata_mv: Drop pointless VPRINTK() call and convert the remaining one Hannes Reinecke
2021-12-08 16:32 ` [PATCH 40/73] sata_nv: drop pointless VPRINTK() calls and convert remaining ones Hannes Reinecke
2021-12-08 16:32 ` [PATCH 41/73] sata_fsl: convert VPRINTK() calls to ata_port_dbg() Hannes Reinecke
2021-12-08 16:32 ` [PATCH 42/73] sata_sil: Drop pointless VPRINTK() calls Hannes Reinecke
2021-12-08 16:32 ` [PATCH 43/73] sata_sx4: Drop pointless VPRINTK() calls and convert the remaining ones Hannes Reinecke
2021-12-08 16:32 ` [PATCH 44/73] sata_sx4: add module parameter 'dimm_test' Hannes Reinecke
2021-12-08 16:32 ` [PATCH 45/73] libata: drop ata_msg_error() and ata_msg_intr() Hannes Reinecke
2021-12-08 16:32 ` [PATCH 46/73] libata: drop ata_msg_ctl() Hannes Reinecke
2021-12-08 16:32 ` [PATCH 47/73] libata: drop ata_msg_malloc() Hannes Reinecke
2021-12-08 16:32 ` [PATCH 48/73] libata: drop ata_msg_warn() Hannes Reinecke
2021-12-08 16:32 ` [PATCH 49/73] libata: drop ata_msg_probe() Hannes Reinecke
2021-12-08 16:32 ` [PATCH 50/73] libata: drop ata_msg_info() Hannes Reinecke
2021-12-08 16:32 ` [PATCH 51/73] libata: drop ata_msg_drv() Hannes Reinecke
2021-12-08 16:32 ` [PATCH 52/73] libata: remove 'new' ata message handling Hannes Reinecke
2021-12-08 16:32 ` [PATCH 53/73] libata: remove debug compilation switches Hannes Reinecke
2021-12-08 16:32 ` [PATCH 54/73] pata_atp867x: convert blank printk() calls Hannes Reinecke
2021-12-08 22:21   ` kernel test robot
2021-12-09  1:08   ` Damien Le Moal
2021-12-08 16:32 ` [PATCH 55/73] pata_cmd640: " Hannes Reinecke
2021-12-08 16:32 ` [PATCH 56/73] pata_cmd64x: " Hannes Reinecke
2021-12-08 16:32 ` [PATCH 57/73] pata_cs5520: " Hannes Reinecke
2021-12-08 16:32 ` [PATCH 58/73] pata_cs5536: " Hannes Reinecke
2021-12-08 16:32 ` [PATCH 59/73] pata_cypressx: " Hannes Reinecke
2021-12-09  8:25   ` Sergey Shtylyov
2021-12-08 16:32 ` [PATCH 60/73] pata_it821x: " Hannes Reinecke
2021-12-08 16:32 ` [PATCH 61/73] pata_marvell: " Hannes Reinecke
2021-12-08 16:32 ` [PATCH 62/73] pata_rz1000: " Hannes Reinecke
2021-12-09  1:10   ` Damien Le Moal
2021-12-08 16:32 ` [PATCH 63/73] pata_serverworks: " Hannes Reinecke
2021-12-08 16:32 ` [PATCH 64/73] pata_sil680: " Hannes Reinecke
2021-12-09  8:24   ` Sergey Shtylyov
2021-12-08 16:32 ` [PATCH 65/73] pdc_adma: remove disabled debugging messages Hannes Reinecke
2021-12-08 16:32 ` [PATCH 66/73] sata_sx4: convert blank printk() calls Hannes Reinecke
2021-12-08 16:32 ` [PATCH 67/73] sata_mv: convert remaining printk() to structured logging Hannes Reinecke
2021-12-08 16:32 ` [PATCH 68/73] pata_hpt37x: convert pr_XXX() calls Hannes Reinecke
2021-12-09  1:13   ` Damien Le Moal
2021-12-08 16:32 ` [PATCH 69/73] pata_octeon_cf: Replace pr_XXX() calls with structured logging Hannes Reinecke
2021-12-09  8:08   ` Sergey Shtylyov
2021-12-08 16:32 ` [PATCH 70/73] pata_hpt3x2n: convert pr_XXX() calls Hannes Reinecke
2021-12-09  1:13   ` Damien Le Moal
2021-12-08 16:32 ` [PATCH 71/73] pata_hpt3x2n: convert pr_err() calls Hannes Reinecke
2021-12-09  1:14   ` Damien Le Moal
2021-12-09  8:09   ` Sergey Shtylyov
2021-12-08 16:32 ` [PATCH 72/73] pata_hpt366: convert pr_warn() calls Hannes Reinecke
2021-12-09  1:14   ` Damien Le Moal
2021-12-08 16:32 ` [PATCH 73/73] libata-scsi: rework ata_dump_status to avoid using pr_cont() Hannes Reinecke
2021-12-09  1:17 ` [PATCH 00/73] libata: rework logging, take II Damien Le Moal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.