From 1bf1fd913180ae8c5aaf00f9cd14378d9a52f8da Mon Sep 17 00:00:00 2001 From: Kelvin Cao Date: Fri, 25 Sep 2020 16:32:14 +0000 Subject: [PATCH 1/3] Minor output message tuning --- fabric_client/target.c | 2 +- switchtec_dma.c | 30 ++++++++++++++++++------------ 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/fabric_client/target.c b/fabric_client/target.c index 9e990eb..7d1e8aa 100644 --- a/fabric_client/target.c +++ b/fabric_client/target.c @@ -60,7 +60,7 @@ static int data_cookie = 0; static int rhi_notify(struct notifier_block *self, unsigned long cookie, void *dev) { - printk("Receive RHI notification with cookie 0x%lx\n", cookie); + printk("Receive RHI notification with cookie %ld\n", cookie); if (cookie == spd_cookie) tasklet_schedule(&target.data_process_task); diff --git a/switchtec_dma.c b/switchtec_dma.c index b58a13a..b97a573 100644 --- a/switchtec_dma.c +++ b/switchtec_dma.c @@ -1208,7 +1208,7 @@ static int switchtec_dma_chan_init(struct switchtec_dma_dev *swdma_dev, int i) /* halt channel first */ rc = halt_channel(swdma_chan); if (rc) { - dev_err(dev, "Channel %d: halt failed\n", i); + dev_err(dev, "Channel %d: halt channel failed\n", i); goto err_unlock_and_exit; } @@ -1225,11 +1225,11 @@ static int switchtec_dma_chan_init(struct switchtec_dma_dev *swdma_dev, int i) valid_en_se = readl(&chan_fw->valid_en_se); - dev_dbg(dev, "Channel %d: SE buf base 0x%x\n", + dev_dbg(dev, "Channel %d: SE buffer base %d\n", i, (valid_en_se >> SE_BUF_BASE_SHIFT) & SE_BUF_BASE_MASK); se_buf_len = (valid_en_se >> SE_BUF_LEN_SHIFT) & SE_BUF_LEN_MASK; - dev_dbg(dev, "Channel %d: SE buf cnt 0x%x\n", i, se_buf_len); + dev_dbg(dev, "Channel %d: SE buffer count %d\n", i, se_buf_len); thresh = se_buf_len / 2; valid_en_se |= (thresh & SE_THRESH_MASK) << SE_THRESH_SHIFT; @@ -1237,7 +1237,7 @@ static int switchtec_dma_chan_init(struct switchtec_dma_dev *swdma_dev, int i) /* request irqs */ irq = readl(&chan_fw->int_vec); - dev_dbg(dev, "Channel %d: irq vec 0x%x\n", i, irq); + dev_dbg(dev, "Channel %d: CE irq vector %d\n", i, irq); irq = pci_irq_vector(pdev, irq); if (irq < 0) { @@ -1341,15 +1341,16 @@ static int switchtec_dma_chans_enumerate(struct switchtec_dma_dev *swdma_dev, base = readw(&swdma_dev->mmio_dmac_cap->se_buf_base); cnt = readw(&swdma_dev->mmio_dmac_cap->se_buf_cnt); - dev_dbg(&pdev->dev, "EP SE buf base 0x%x\n", base); - dev_dbg(&pdev->dev, "EP SE buf cnt 0x%x\n", cnt); + dev_dbg(&pdev->dev, "EP SE buffer base %d\n", base); + dev_dbg(&pdev->dev, "EP SE buffer count %d\n", cnt); INIT_LIST_HEAD(&dma->channels); for (i = 0; i < chan_cnt; i++) { rc = switchtec_dma_chan_init(swdma_dev, i); if (rc) { - dev_err(&pdev->dev, "Channel %d: init failed\n", i); + dev_err(&pdev->dev, "Channel %d: init channel failed\n", + i); goto err_unlock_and_exit; } } @@ -2349,8 +2350,8 @@ int switchtec_fabric_register_buffer(struct dma_device *dma_dev, u16 peer_hfid, lower_32_bits(buf_addr)); dev_dbg(dev, " dma size: 0x%08x_%08x\n", upper_32_bits(buf_size), lower_32_bits(buf_size)); - dev_dbg(dev, " vector: %x", le16_to_cpu(rsp.buf_vec)); - dev_dbg(dev, " irq (cookie): 0x%x", irq); + dev_dbg(dev, " vector: %d", le16_to_cpu(rsp.buf_vec)); + dev_dbg(dev, " irq (cookie): %d", irq); *cookie = irq; @@ -2731,7 +2732,7 @@ static int switchtec_dma_init_fabric(struct switchtec_dma_dev *swdma_dev) (unsigned long)swdma_dev); irq = readw(&swdma_dev->mmio_fabric_ctrl->event_vec); - dev_dbg(&pdev->dev, "Fabric event irq vec 0x%x\n", irq); + dev_dbg(&pdev->dev, "Fabric event irq vector %d\n", irq); irq = pci_irq_vector(pdev, irq); if (irq < 0) { @@ -2793,6 +2794,7 @@ static int switchtec_dma_create(struct pci_dev *pdev, bool is_fabric) int nr_vecs; int irq; int rc; + int i; /* * Create the switchtec dma device @@ -2818,6 +2820,9 @@ static int switchtec_dma_create(struct pci_dev *pdev, bool is_fabric) SWITCHTEC_DMAC_FABRIC_CTRL_OFFSET; readw(&swdma_dev->mmio_fabric_ctrl->requestor_id); + dev_info(dev, "Switchtec PAX DMA EP\n"); + } else { + dev_info(dev, "Switchtec PSX/PFX DMA EP\n"); } RCU_INIT_POINTER(swdma_dev->pdev, pdev); @@ -2833,7 +2838,7 @@ static int switchtec_dma_create(struct pci_dev *pdev, bool is_fabric) (unsigned long)swdma_dev); irq = readw(&swdma_dev->mmio_dmac_cap->chan_sts_vec); - dev_dbg(dev, "Channel pause irq vec 0x%x\n", irq); + dev_dbg(dev, "Channel pause irq vector %d\n", irq); irq = pci_irq_vector(pdev, irq); if (irq < 0) { @@ -2894,8 +2899,9 @@ static int switchtec_dma_create(struct pci_dev *pdev, bool is_fabric) goto err_exit; } + i = 0; list_for_each_entry(chan, &dma->channels, device_node) - pci_info(pdev, "Channel: %s\n", dma_chan_name(chan)); + pci_info(pdev, "Channel %d: %s\n", i++, dma_chan_name(chan)); pci_set_drvdata(pdev, swdma_dev); From a661e8c45266e1fb1bbdb52767f58e19da89a88f Mon Sep 17 00:00:00 2001 From: Kelvin Cao Date: Sun, 27 Sep 2020 09:06:52 +0000 Subject: [PATCH 2/3] Style nit: remove {} for single line if statements --- switchtec_dma.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/switchtec_dma.c b/switchtec_dma.c index b97a573..47ec9aa 100644 --- a/switchtec_dma.c +++ b/switchtec_dma.c @@ -2152,9 +2152,8 @@ struct dma_device *switchtec_fabric_get_dma_device(char *name) list_for_each_entry(d, &dma_list, list) { sprintf(dev_name, "dma%d", d->dma_dev.dev_id); - if (!strcmp(name, dev_name)) { + if (!strcmp(name, dev_name)) return &d->dma_dev; - } } return NULL; @@ -2829,9 +2828,8 @@ static int switchtec_dma_create(struct pci_dev *pdev, bool is_fabric) nr_vecs = pci_msix_vec_count(pdev); rc = pci_alloc_irq_vectors(pdev, nr_vecs, nr_vecs, PCI_IRQ_MSIX); - if (rc < 0) { + if (rc < 0) goto err_exit; - } tasklet_init(&swdma_dev->chan_status_task, switchtec_dma_chan_status_task, @@ -2967,9 +2965,8 @@ static void switchtec_dma_remove(struct pci_dev *pdev) tasklet_kill(&swdma_dev->chan_status_task); - if (swdma_dev->is_fabric) { + if (swdma_dev->is_fabric) tasklet_kill(&swdma_dev->fabric_event_task); - } rcu_assign_pointer(swdma_dev->pdev, NULL); synchronize_rcu(); From 03b3395e70c38cff5fcb50a98f02ac446b7b8399 Mon Sep 17 00:00:00 2001 From: Kelvin Cao Date: Sun, 27 Sep 2020 12:20:41 +0000 Subject: [PATCH 3/3] Do sparse check by default --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 44ce7e3..91befd4 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ version.h: FORCE $(OBJDIR) modules: | version.h %:: - $(MAKE) -C $(KERNEL_SOURCES) M=$$PWD $@ + $(MAKE) -C $(KERNEL_SOURCES) M=$$PWD C=1 $@ clean:: rm -f version.h