All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lpfc: Add support for optional pldv handling
@ 2021-09-27 18:35 James Smart
  2021-09-29  3:28 ` Martin K. Petersen
  2021-10-05  4:34 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: James Smart @ 2021-09-27 18:35 UTC (permalink / raw)
  To: linux-scsi; +Cc: James Smart, Nigel Kirkland

At adapter attachment or SLI port initialization, read the SLIPORT_STATUS
register to check for pldv_enable. If found, the driver will perform a
PCIe configuration space write when attaching to an SLI port instance
that is an LPe32000 series adapter.

Co-developed-by: Nigel Kirkland <nkirkland2304@gmail.com>
Signed-off-by: Nigel Kirkland <nkirkland2304@gmail.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
---
 drivers/scsi/lpfc/lpfc_hw4.h  |  4 ++++
 drivers/scsi/lpfc/lpfc_init.c | 14 ++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h
index 79a4872c2edb..143b73f71333 100644
--- a/drivers/scsi/lpfc/lpfc_hw4.h
+++ b/drivers/scsi/lpfc/lpfc_hw4.h
@@ -673,6 +673,10 @@ struct lpfc_register {
 #define lpfc_sliport_status_rdy_SHIFT	23
 #define lpfc_sliport_status_rdy_MASK	0x1
 #define lpfc_sliport_status_rdy_WORD	word0
+#define lpfc_sliport_status_pldv_SHIFT	0
+#define lpfc_sliport_status_pldv_MASK	0x1
+#define lpfc_sliport_status_pldv_WORD	word0
+#define CFG_PLD				0x3C
 #define MAX_IF_TYPE_2_RESETS		6
 
 #define LPFC_CTL_PORT_CTL_OFFSET	0x408
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index d0e64233d273..bd2bc88e2ae9 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -68,6 +68,7 @@
 static enum cpuhp_state lpfc_cpuhp_state;
 /* Used when mapping IRQ vectors in a driver centric manner */
 static uint32_t lpfc_present_cpu;
+static bool lpfc_pldv_detect;
 
 static void __lpfc_cpuhp_remove(struct lpfc_hba *phba);
 static void lpfc_cpuhp_remove(struct lpfc_hba *phba);
@@ -9359,7 +9360,15 @@ lpfc_sli4_post_status_check(struct lpfc_hba *phba)
 					phba->work_status[0],
 					phba->work_status[1]);
 				port_error = -ENODEV;
+				break;
 			}
+
+			if (lpfc_pldv_detect &&
+			    bf_get(lpfc_sli_intf_sli_family,
+				   &phba->sli4_hba.sli_intf) ==
+					LPFC_SLI_INTF_FAMILY_G6)
+				pci_write_config_byte(phba->pcidev,
+						      LPFC_SLI_INTF, CFG_PLD);
 			break;
 		case LPFC_SLI_INTF_IF_TYPE_1:
 		default:
@@ -11567,6 +11576,9 @@ lpfc_pci_function_reset(struct lpfc_hba *phba)
 			goto out;
 		}
 
+		if (bf_get(lpfc_sliport_status_pldv, &reg_data))
+			lpfc_pldv_detect = true;
+
 		if (!port_reset) {
 			/*
 			 * Reset the port now
@@ -15559,6 +15571,8 @@ lpfc_init(void)
 	/* Initialize in case vector mapping is needed */
 	lpfc_present_cpu = num_present_cpus();
 
+	lpfc_pldv_detect = false;
+
 	error = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN,
 					"lpfc/sli4:online",
 					lpfc_cpu_online, lpfc_cpu_offline);
-- 
2.26.2


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

* Re: [PATCH] lpfc: Add support for optional pldv handling
  2021-09-27 18:35 [PATCH] lpfc: Add support for optional pldv handling James Smart
@ 2021-09-29  3:28 ` Martin K. Petersen
  2021-10-05  4:34 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2021-09-29  3:28 UTC (permalink / raw)
  To: James Smart; +Cc: linux-scsi, Nigel Kirkland


James,

> At adapter attachment or SLI port initialization, read the
> SLIPORT_STATUS register to check for pldv_enable. If found, the driver
> will perform a PCIe configuration space write when attaching to an SLI
> port instance that is an LPe32000 series adapter.

Applied to 5.16/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH] lpfc: Add support for optional pldv handling
  2021-09-27 18:35 [PATCH] lpfc: Add support for optional pldv handling James Smart
  2021-09-29  3:28 ` Martin K. Petersen
@ 2021-10-05  4:34 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2021-10-05  4:34 UTC (permalink / raw)
  To: linux-scsi, James Smart; +Cc: Martin K . Petersen, Nigel Kirkland

On Mon, 27 Sep 2021 11:35:18 -0700, James Smart wrote:

> At adapter attachment or SLI port initialization, read the SLIPORT_STATUS
> register to check for pldv_enable. If found, the driver will perform a
> PCIe configuration space write when attaching to an SLI port instance
> that is an LPe32000 series adapter.
> 
> 

Applied to 5.16/scsi-queue, thanks!

[1/1] lpfc: Add support for optional pldv handling
      https://git.kernel.org/mkp/scsi/c/a5b141a895b5

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2021-10-05  4:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-27 18:35 [PATCH] lpfc: Add support for optional pldv handling James Smart
2021-09-29  3:28 ` Martin K. Petersen
2021-10-05  4:34 ` Martin K. Petersen

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.