All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Add Switchtec Gen4 automotive device IDs and a tweak
@ 2021-11-19  0:38 Kelvin Cao
  2021-11-19  0:38 ` [PATCH 1/2] Add device IDs for the Gen4 automotive variants Kelvin Cao
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Kelvin Cao @ 2021-11-19  0:38 UTC (permalink / raw)
  To: Kurt Schwemmer, Logan Gunthorpe, Bjorn Helgaas,
	Krzysztof Wilczyński, linux-pci, linux-kernel
  Cc: Kelvin Cao, kelvincao

Hi,

This patchset introduces device IDs for the Switchtec Gen4 automotive
variants and a minor tweak for the MRPC execution.

The first patch adds the device IDs. Patch 2 makes the tweak to improve
the MRPC execution efficiency [1].

This patchset is based on v5.16-rc1.

[1] https://lore.kernel.org/r/20211014141859.11444-1-kelvin.cao@microchip.com/

Thanks,
Kelvin

Kelvin Cao (2):
  Add device IDs for the Gen4 automotive variants
  Declare local array state_names as static

 drivers/pci/quirks.c           |  9 +++++++++
 drivers/pci/switch/switchtec.c | 11 ++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

-- 
2.25.1


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

* [PATCH 1/2] Add device IDs for the Gen4 automotive variants
  2021-11-19  0:38 [PATCH 0/2] Add Switchtec Gen4 automotive device IDs and a tweak Kelvin Cao
@ 2021-11-19  0:38 ` Kelvin Cao
  2021-11-19  0:38 ` [PATCH 2/2] Declare local array state_names as static Kelvin Cao
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Kelvin Cao @ 2021-11-19  0:38 UTC (permalink / raw)
  To: Kurt Schwemmer, Logan Gunthorpe, Bjorn Helgaas,
	Krzysztof Wilczyński, linux-pci, linux-kernel
  Cc: Kelvin Cao, kelvincao

Advertise support of the Gen4 automotive variants in module's device ID
table and add the same IDs to the list of switchtec quirks.

Signed-off-by: Kelvin Cao <kelvin.cao@microchip.com>
---
 drivers/pci/quirks.c           | 9 +++++++++
 drivers/pci/switch/switchtec.c | 9 +++++++++
 2 files changed, 18 insertions(+)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 003950c738d2..25ccb2994891 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -5683,6 +5683,15 @@ SWITCHTEC_QUIRK(0x4268);  /* PAX 68XG4  */
 SWITCHTEC_QUIRK(0x4252);  /* PAX 52XG4  */
 SWITCHTEC_QUIRK(0x4236);  /* PAX 36XG4  */
 SWITCHTEC_QUIRK(0x4228);  /* PAX 28XG4  */
+SWITCHTEC_QUIRK(0x4352);  /* PFXA 52XG4 */
+SWITCHTEC_QUIRK(0x4336);  /* PFXA 36XG4 */
+SWITCHTEC_QUIRK(0x4328);  /* PFXA 28XG4 */
+SWITCHTEC_QUIRK(0x4452);  /* PSXA 52XG4 */
+SWITCHTEC_QUIRK(0x4436);  /* PSXA 36XG4 */
+SWITCHTEC_QUIRK(0x4428);  /* PSXA 28XG4 */
+SWITCHTEC_QUIRK(0x4552);  /* PAXA 52XG4 */
+SWITCHTEC_QUIRK(0x4536);  /* PAXA 36XG4 */
+SWITCHTEC_QUIRK(0x4528);  /* PAXA 28XG4 */
 
 /*
  * The PLX NTB uses devfn proxy IDs to move TLPs between NT endpoints.
diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c
index 38c2b036fb8e..6e2d6c5ea4b5 100644
--- a/drivers/pci/switch/switchtec.c
+++ b/drivers/pci/switch/switchtec.c
@@ -1779,6 +1779,15 @@ static const struct pci_device_id switchtec_pci_tbl[] = {
 	SWITCHTEC_PCI_DEVICE(0x4252, SWITCHTEC_GEN4),  //PAX 52XG4
 	SWITCHTEC_PCI_DEVICE(0x4236, SWITCHTEC_GEN4),  //PAX 36XG4
 	SWITCHTEC_PCI_DEVICE(0x4228, SWITCHTEC_GEN4),  //PAX 28XG4
+	SWITCHTEC_PCI_DEVICE(0x4352, SWITCHTEC_GEN4),  //PFXA 52XG4
+	SWITCHTEC_PCI_DEVICE(0x4336, SWITCHTEC_GEN4),  //PFXA 36XG4
+	SWITCHTEC_PCI_DEVICE(0x4328, SWITCHTEC_GEN4),  //PFXA 28XG4
+	SWITCHTEC_PCI_DEVICE(0x4452, SWITCHTEC_GEN4),  //PSXA 52XG4
+	SWITCHTEC_PCI_DEVICE(0x4436, SWITCHTEC_GEN4),  //PSXA 36XG4
+	SWITCHTEC_PCI_DEVICE(0x4428, SWITCHTEC_GEN4),  //PSXA 28XG4
+	SWITCHTEC_PCI_DEVICE(0x4552, SWITCHTEC_GEN4),  //PAXA 52XG4
+	SWITCHTEC_PCI_DEVICE(0x4536, SWITCHTEC_GEN4),  //PAXA 36XG4
+	SWITCHTEC_PCI_DEVICE(0x4528, SWITCHTEC_GEN4),  //PAXA 28XG4
 	{0}
 };
 MODULE_DEVICE_TABLE(pci, switchtec_pci_tbl);
-- 
2.25.1


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

* [PATCH 2/2] Declare local array state_names as static
  2021-11-19  0:38 [PATCH 0/2] Add Switchtec Gen4 automotive device IDs and a tweak Kelvin Cao
  2021-11-19  0:38 ` [PATCH 1/2] Add device IDs for the Gen4 automotive variants Kelvin Cao
@ 2021-11-19  0:38 ` Kelvin Cao
  2021-11-19 16:49 ` [PATCH 0/2] Add Switchtec Gen4 automotive device IDs and a tweak Logan Gunthorpe
  2021-11-19 18:15 ` Bjorn Helgaas
  3 siblings, 0 replies; 7+ messages in thread
From: Kelvin Cao @ 2021-11-19  0:38 UTC (permalink / raw)
  To: Kurt Schwemmer, Logan Gunthorpe, Bjorn Helgaas,
	Krzysztof Wilczyński, linux-pci, linux-kernel
  Cc: Kelvin Cao, kelvincao

When a MRPC command is being executed, the function stuser_set_state()
will be called several times to set the command execution state.
During each run of stuser_set_state(), the local array state_names is
allocated and populated. The array contains a constant mapping of the
state enum values to the text strings, so repeated allocation and
initialization is just a wait of CPU cycles. Therefore, declare the
array as static.

See the link below for the discussion.

  https://lore.kernel.org/r/20211014141859.11444-1-kelvin.cao@microchip.com/

Suggested-by: Krzysztof Wilczyński <kw@linux.com>
Signed-off-by: Kelvin Cao <kelvin.cao@microchip.com>
---
 drivers/pci/switch/switchtec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c
index 6e2d6c5ea4b5..c36c1238c604 100644
--- a/drivers/pci/switch/switchtec.c
+++ b/drivers/pci/switch/switchtec.c
@@ -122,7 +122,7 @@ static void stuser_set_state(struct switchtec_user *stuser,
 {
 	/* requires the mrpc_mutex to already be held when called */
 
-	const char * const state_names[] = {
+	static const char * const state_names[] = {
 		[MRPC_IDLE] = "IDLE",
 		[MRPC_QUEUED] = "QUEUED",
 		[MRPC_RUNNING] = "RUNNING",
-- 
2.25.1


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

* Re: [PATCH 0/2] Add Switchtec Gen4 automotive device IDs and a tweak
  2021-11-19  0:38 [PATCH 0/2] Add Switchtec Gen4 automotive device IDs and a tweak Kelvin Cao
  2021-11-19  0:38 ` [PATCH 1/2] Add device IDs for the Gen4 automotive variants Kelvin Cao
  2021-11-19  0:38 ` [PATCH 2/2] Declare local array state_names as static Kelvin Cao
@ 2021-11-19 16:49 ` Logan Gunthorpe
  2021-11-21  6:38   ` Kelvin.Cao
  2021-11-19 18:15 ` Bjorn Helgaas
  3 siblings, 1 reply; 7+ messages in thread
From: Logan Gunthorpe @ 2021-11-19 16:49 UTC (permalink / raw)
  To: Kelvin Cao, Kurt Schwemmer, Bjorn Helgaas,
	Krzysztof Wilczyński, linux-pci, linux-kernel
  Cc: kelvincao



On 2021-11-18 5:38 p.m., Kelvin Cao wrote:
> Hi,
> 
> This patchset introduces device IDs for the Switchtec Gen4 automotive
> variants and a minor tweak for the MRPC execution.
> 
> The first patch adds the device IDs. Patch 2 makes the tweak to improve
> the MRPC execution efficiency [1].
> 
> This patchset is based on v5.16-rc1.
> 
> [1] https://lore.kernel.org/r/20211014141859.11444-1-kelvin.cao@microchip.com/
> 
> Thanks,
> Kelvin
> 
> Kelvin Cao (2):
>   Add device IDs for the Gen4 automotive variants
>   Declare local array state_names as static
> 
>  drivers/pci/quirks.c           |  9 +++++++++
>  drivers/pci/switch/switchtec.c | 11 ++++++++++-
>  2 files changed, 19 insertions(+), 1 deletion(-)

Looks fine to me.

Reviewed-by: Logan Gunthorpe <logang@deltatee.com>

Logan

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

* Re: [PATCH 0/2] Add Switchtec Gen4 automotive device IDs and a tweak
  2021-11-19  0:38 [PATCH 0/2] Add Switchtec Gen4 automotive device IDs and a tweak Kelvin Cao
                   ` (2 preceding siblings ...)
  2021-11-19 16:49 ` [PATCH 0/2] Add Switchtec Gen4 automotive device IDs and a tweak Logan Gunthorpe
@ 2021-11-19 18:15 ` Bjorn Helgaas
  2021-11-21  6:40   ` Kelvin.Cao
  3 siblings, 1 reply; 7+ messages in thread
From: Bjorn Helgaas @ 2021-11-19 18:15 UTC (permalink / raw)
  To: Kelvin Cao
  Cc: Kurt Schwemmer, Logan Gunthorpe, Bjorn Helgaas,
	Krzysztof Wilczyński, linux-pci, linux-kernel, kelvincao

On Thu, Nov 18, 2021 at 04:38:01PM -0800, Kelvin Cao wrote:
> Hi,
> 
> This patchset introduces device IDs for the Switchtec Gen4 automotive
> variants and a minor tweak for the MRPC execution.
> 
> The first patch adds the device IDs. Patch 2 makes the tweak to improve
> the MRPC execution efficiency [1].
> 
> This patchset is based on v5.16-rc1.
> 
> [1] https://lore.kernel.org/r/20211014141859.11444-1-kelvin.cao@microchip.com/
> 
> Thanks,
> Kelvin
> 
> Kelvin Cao (2):
>   Add device IDs for the Gen4 automotive variants
>   Declare local array state_names as static
> 
>  drivers/pci/quirks.c           |  9 +++++++++
>  drivers/pci/switch/switchtec.c | 11 ++++++++++-
>  2 files changed, 19 insertions(+), 1 deletion(-)

Applied to pci/switchtec for v5.17, thanks!

I tidied up the subjects for you so they match the style of previous
ones, 7a30ebb9f2a2 ("PCI/switchtec: Add Gen4 device IDs") in
particular:

  bb17b15813ea ("PCI/switchtec: Add Gen4 automotive device IDs")
  b76521f6482d ("PCI/switchtec: Declare local state_names[] as static")


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

* Re: [PATCH 0/2] Add Switchtec Gen4 automotive device IDs and a tweak
  2021-11-19 16:49 ` [PATCH 0/2] Add Switchtec Gen4 automotive device IDs and a tweak Logan Gunthorpe
@ 2021-11-21  6:38   ` Kelvin.Cao
  0 siblings, 0 replies; 7+ messages in thread
From: Kelvin.Cao @ 2021-11-21  6:38 UTC (permalink / raw)
  To: kurt.schwemmer, bhelgaas, linux-pci, logang, linux-kernel, kw; +Cc: kelvincao

On Fri, 2021-11-19 at 09:49 -0700, Logan Gunthorpe wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
> 
> On 2021-11-18 5:38 p.m., Kelvin Cao wrote:
> > Hi,
> > 
> > This patchset introduces device IDs for the Switchtec Gen4
> > automotive
> > variants and a minor tweak for the MRPC execution.
> > 
> > The first patch adds the device IDs. Patch 2 makes the tweak to
> > improve
> > the MRPC execution efficiency [1].
> > 
> > This patchset is based on v5.16-rc1.
> > 
> > [1] 
> > https://lore.kernel.org/r/20211014141859.11444-1-kelvin.cao@microchip.com/
> > 
> > Thanks,
> > Kelvin
> > 
> > Kelvin Cao (2):
> >   Add device IDs for the Gen4 automotive variants
> >   Declare local array state_names as static
> > 
> >  drivers/pci/quirks.c           |  9 +++++++++
> >  drivers/pci/switch/switchtec.c | 11 ++++++++++-
> >  2 files changed, 19 insertions(+), 1 deletion(-)
> 
> Looks fine to me.
> 
> Reviewed-by: Logan Gunthorpe <logang@deltatee.com>

Thanks Logan!

Kelvin
> 
> Logan

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

* Re: [PATCH 0/2] Add Switchtec Gen4 automotive device IDs and a tweak
  2021-11-19 18:15 ` Bjorn Helgaas
@ 2021-11-21  6:40   ` Kelvin.Cao
  0 siblings, 0 replies; 7+ messages in thread
From: Kelvin.Cao @ 2021-11-21  6:40 UTC (permalink / raw)
  To: helgaas
  Cc: kelvincao, kurt.schwemmer, bhelgaas, linux-pci, logang, linux-kernel, kw

On Fri, 2021-11-19 at 12:15 -0600, Bjorn Helgaas wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
> 
> On Thu, Nov 18, 2021 at 04:38:01PM -0800, Kelvin Cao wrote:
> > Hi,
> > 
> > This patchset introduces device IDs for the Switchtec Gen4
> > automotive
> > variants and a minor tweak for the MRPC execution.
> > 
> > The first patch adds the device IDs. Patch 2 makes the tweak to
> > improve
> > the MRPC execution efficiency [1].
> > 
> > This patchset is based on v5.16-rc1.
> > 
> > [1] 
> > https://lore.kernel.org/r/20211014141859.11444-1-kelvin.cao@microchip.com/
> > 
> > Thanks,
> > Kelvin
> > 
> > Kelvin Cao (2):
> >   Add device IDs for the Gen4 automotive variants
> >   Declare local array state_names as static
> > 
> >  drivers/pci/quirks.c           |  9 +++++++++
> >  drivers/pci/switch/switchtec.c | 11 ++++++++++-
> >  2 files changed, 19 insertions(+), 1 deletion(-)
> 
> Applied to pci/switchtec for v5.17, thanks!
> 
> I tidied up the subjects for you so they match the style of previous
> ones, 7a30ebb9f2a2 ("PCI/switchtec: Add Gen4 device IDs") in
> particular:
> 
>   bb17b15813ea ("PCI/switchtec: Add Gen4 automotive device IDs")
>   b76521f6482d ("PCI/switchtec: Declare local state_names[] as
> static")
> 

Thank you Bjorn!

Kelvin

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

end of thread, other threads:[~2021-11-21  6:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-19  0:38 [PATCH 0/2] Add Switchtec Gen4 automotive device IDs and a tweak Kelvin Cao
2021-11-19  0:38 ` [PATCH 1/2] Add device IDs for the Gen4 automotive variants Kelvin Cao
2021-11-19  0:38 ` [PATCH 2/2] Declare local array state_names as static Kelvin Cao
2021-11-19 16:49 ` [PATCH 0/2] Add Switchtec Gen4 automotive device IDs and a tweak Logan Gunthorpe
2021-11-21  6:38   ` Kelvin.Cao
2021-11-19 18:15 ` Bjorn Helgaas
2021-11-21  6:40   ` Kelvin.Cao

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.