linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Switchtec Changes for v4.13
@ 2017-06-15 20:12 Logan Gunthorpe
  2017-06-15 20:12 ` [PATCH 1/2] switchtec: running status flag to fw partition info ioctl Logan Gunthorpe
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Logan Gunthorpe @ 2017-06-15 20:12 UTC (permalink / raw)
  To: Bjorn Helgaas, linux-pci, linux-kernel; +Cc: Logan Gunthorpe

Hi Bjorn,

Can you please queue up these two minor changes for v4.13?

Thanks,

Logan

Logan Gunthorpe (2):
  switchtec: running status flag to fw partition info ioctl
  switchtec: add device ids for additional switchtec products

 drivers/pci/switch/switchtec.c       | 40 ++++++++++++++++++++++++++++++++++--
 include/uapi/linux/switchtec_ioctl.h |  3 +++
 2 files changed, 41 insertions(+), 2 deletions(-)

--
2.11.0

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

* [PATCH 1/2] switchtec: running status flag to fw partition info ioctl
  2017-06-15 20:12 [PATCH 0/2] Switchtec Changes for v4.13 Logan Gunthorpe
@ 2017-06-15 20:12 ` Logan Gunthorpe
  2017-06-15 20:12 ` [PATCH 2/2] switchtec: add device ids for additional switchtec products Logan Gunthorpe
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Logan Gunthorpe @ 2017-06-15 20:12 UTC (permalink / raw)
  To: Bjorn Helgaas, linux-pci, linux-kernel; +Cc: Logan Gunthorpe

This flag lets userspace know which firmware partitions are actually
currently in use as opposed to just active. (Active meaning they will
be in use for the next reboot, where as running means they are currently
in use.)

If an old kernel is in use, or the firmware doesn't support these
fields, the new flag will not be set in the output.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Kurt Schwemmer <kurt.schwemmer@microsemi.com>
---
 drivers/pci/switch/switchtec.c       | 22 ++++++++++++++++++++--
 include/uapi/linux/switchtec_ioctl.h |  3 +++
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c
index f6a63406c76e..5cf59af989f4 100644
--- a/drivers/pci/switch/switchtec.c
+++ b/drivers/pci/switch/switchtec.c
@@ -120,6 +120,13 @@ struct sw_event_regs {
 	u32 reserved16[4];
 } __packed;
 
+enum {
+	SWITCHTEC_CFG0_RUNNING = 0x04,
+	SWITCHTEC_CFG1_RUNNING = 0x05,
+	SWITCHTEC_IMG0_RUNNING = 0x03,
+	SWITCHTEC_IMG1_RUNNING = 0x07,
+};
+
 struct sys_info_regs {
 	u32 device_id;
 	u32 device_version;
@@ -129,7 +136,9 @@ struct sys_info_regs {
 	u32 table_format_version;
 	u32 partition_id;
 	u32 cfg_file_fmt_version;
-	u32 reserved2[58];
+	u16 cfg_running;
+	u16 img_running;
+	u32 reserved2[57];
 	char vendor_id[8];
 	char product_id[16];
 	char product_revision[4];
@@ -807,6 +816,7 @@ static int ioctl_flash_part_info(struct switchtec_dev *stdev,
 {
 	struct switchtec_ioctl_flash_part_info info = {0};
 	struct flash_info_regs __iomem *fi = stdev->mmio_flash_info;
+	struct sys_info_regs __iomem *si = stdev->mmio_sys_info;
 	u32 active_addr = -1;
 
 	if (copy_from_user(&info, uinfo, sizeof(info)))
@@ -816,18 +826,26 @@ static int ioctl_flash_part_info(struct switchtec_dev *stdev,
 	case SWITCHTEC_IOCTL_PART_CFG0:
 		active_addr = ioread32(&fi->active_cfg);
 		set_fw_info_part(&info, &fi->cfg0);
+		if (ioread16(&si->cfg_running) == SWITCHTEC_CFG0_RUNNING)
+			info.active |= SWITCHTEC_IOCTL_PART_RUNNING;
 		break;
 	case SWITCHTEC_IOCTL_PART_CFG1:
 		active_addr = ioread32(&fi->active_cfg);
 		set_fw_info_part(&info, &fi->cfg1);
+		if (ioread16(&si->cfg_running) == SWITCHTEC_CFG1_RUNNING)
+			info.active |= SWITCHTEC_IOCTL_PART_RUNNING;
 		break;
 	case SWITCHTEC_IOCTL_PART_IMG0:
 		active_addr = ioread32(&fi->active_img);
 		set_fw_info_part(&info, &fi->img0);
+		if (ioread16(&si->img_running) == SWITCHTEC_IMG0_RUNNING)
+			info.active |= SWITCHTEC_IOCTL_PART_RUNNING;
 		break;
 	case SWITCHTEC_IOCTL_PART_IMG1:
 		active_addr = ioread32(&fi->active_img);
 		set_fw_info_part(&info, &fi->img1);
+		if (ioread16(&si->img_running) == SWITCHTEC_IMG1_RUNNING)
+			info.active |= SWITCHTEC_IOCTL_PART_RUNNING;
 		break;
 	case SWITCHTEC_IOCTL_PART_NVLOG:
 		set_fw_info_part(&info, &fi->nvlog);
@@ -861,7 +879,7 @@ static int ioctl_flash_part_info(struct switchtec_dev *stdev,
 	}
 
 	if (info.address == active_addr)
-		info.active = 1;
+		info.active |= SWITCHTEC_IOCTL_PART_ACTIVE;
 
 	if (copy_to_user(uinfo, &info, sizeof(info)))
 		return -EFAULT;
diff --git a/include/uapi/linux/switchtec_ioctl.h b/include/uapi/linux/switchtec_ioctl.h
index 3e824e1a6495..5e392968bad2 100644
--- a/include/uapi/linux/switchtec_ioctl.h
+++ b/include/uapi/linux/switchtec_ioctl.h
@@ -39,6 +39,9 @@ struct switchtec_ioctl_flash_info {
 	__u32 padding;
 };
 
+#define SWITCHTEC_IOCTL_PART_ACTIVE  1
+#define SWITCHTEC_IOCTL_PART_RUNNING 2
+
 struct switchtec_ioctl_flash_part_info {
 	__u32 flash_partition;
 	__u32 address;
-- 
2.11.0

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

* [PATCH 2/2] switchtec: add device ids for additional switchtec products
  2017-06-15 20:12 [PATCH 0/2] Switchtec Changes for v4.13 Logan Gunthorpe
  2017-06-15 20:12 ` [PATCH 1/2] switchtec: running status flag to fw partition info ioctl Logan Gunthorpe
@ 2017-06-15 20:12 ` Logan Gunthorpe
  2017-06-26 15:59 ` [PATCH 0/2] Switchtec Changes for v4.13 Logan Gunthorpe
  2017-06-27 23:26 ` Bjorn Helgaas
  3 siblings, 0 replies; 5+ messages in thread
From: Logan Gunthorpe @ 2017-06-15 20:12 UTC (permalink / raw)
  To: Bjorn Helgaas, linux-pci, linux-kernel; +Cc: Logan Gunthorpe

The switchtec driver also supports PAX, PFXL and PFXI products which
have the same management interface.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Kurt Schwemmer <kurt.schwemmer@microsemi.com>
---
 drivers/pci/switch/switchtec.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c
index 5cf59af989f4..af81b2dec42e 100644
--- a/drivers/pci/switch/switchtec.c
+++ b/drivers/pci/switch/switchtec.c
@@ -1558,6 +1558,24 @@ static const struct pci_device_id switchtec_pci_tbl[] = {
 	SWITCHTEC_PCI_DEVICE(0x8544),  //PSX 64xG3
 	SWITCHTEC_PCI_DEVICE(0x8545),  //PSX 80xG3
 	SWITCHTEC_PCI_DEVICE(0x8546),  //PSX 96xG3
+	SWITCHTEC_PCI_DEVICE(0x8551),  //PAX 24XG3
+	SWITCHTEC_PCI_DEVICE(0x8552),  //PAX 32XG3
+	SWITCHTEC_PCI_DEVICE(0x8553),  //PAX 48XG3
+	SWITCHTEC_PCI_DEVICE(0x8554),  //PAX 64XG3
+	SWITCHTEC_PCI_DEVICE(0x8555),  //PAX 80XG3
+	SWITCHTEC_PCI_DEVICE(0x8556),  //PAX 96XG3
+	SWITCHTEC_PCI_DEVICE(0x8561),  //PFXL 24XG3
+	SWITCHTEC_PCI_DEVICE(0x8562),  //PFXL 32XG3
+	SWITCHTEC_PCI_DEVICE(0x8563),  //PFXL 48XG3
+	SWITCHTEC_PCI_DEVICE(0x8564),  //PFXL 64XG3
+	SWITCHTEC_PCI_DEVICE(0x8565),  //PFXL 80XG3
+	SWITCHTEC_PCI_DEVICE(0x8566),  //PFXL 96XG3
+	SWITCHTEC_PCI_DEVICE(0x8571),  //PFXI 24XG3
+	SWITCHTEC_PCI_DEVICE(0x8572),  //PFXI 32XG3
+	SWITCHTEC_PCI_DEVICE(0x8573),  //PFXI 48XG3
+	SWITCHTEC_PCI_DEVICE(0x8574),  //PFXI 64XG3
+	SWITCHTEC_PCI_DEVICE(0x8575),  //PFXI 80XG3
+	SWITCHTEC_PCI_DEVICE(0x8576),  //PFXI 96XG3
 	{0}
 };
 MODULE_DEVICE_TABLE(pci, switchtec_pci_tbl);
-- 
2.11.0

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

* Re: [PATCH 0/2] Switchtec Changes for v4.13
  2017-06-15 20:12 [PATCH 0/2] Switchtec Changes for v4.13 Logan Gunthorpe
  2017-06-15 20:12 ` [PATCH 1/2] switchtec: running status flag to fw partition info ioctl Logan Gunthorpe
  2017-06-15 20:12 ` [PATCH 2/2] switchtec: add device ids for additional switchtec products Logan Gunthorpe
@ 2017-06-26 15:59 ` Logan Gunthorpe
  2017-06-27 23:26 ` Bjorn Helgaas
  3 siblings, 0 replies; 5+ messages in thread
From: Logan Gunthorpe @ 2017-06-26 15:59 UTC (permalink / raw)
  To: Bjorn Helgaas, linux-pci, linux-kernel

Poke.

I'd *really* like to see these two patches in for 4.13 because otherwise
we'll have an annoying conflict with the NTB work I'm trying to do for
4.14. (See the RFC set I've already posted.)

Thanks,

Logan

On 15/06/17 02:12 PM, Logan Gunthorpe wrote:
> Hi Bjorn,
> 
> Can you please queue up these two minor changes for v4.13?
> 
> Thanks,
> 
> Logan
> 
> Logan Gunthorpe (2):
>   switchtec: running status flag to fw partition info ioctl
>   switchtec: add device ids for additional switchtec products
> 
>  drivers/pci/switch/switchtec.c       | 40 ++++++++++++++++++++++++++++++++++--
>  include/uapi/linux/switchtec_ioctl.h |  3 +++
>  2 files changed, 41 insertions(+), 2 deletions(-)
> 
> --
> 2.11.0
> 

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

* Re: [PATCH 0/2] Switchtec Changes for v4.13
  2017-06-15 20:12 [PATCH 0/2] Switchtec Changes for v4.13 Logan Gunthorpe
                   ` (2 preceding siblings ...)
  2017-06-26 15:59 ` [PATCH 0/2] Switchtec Changes for v4.13 Logan Gunthorpe
@ 2017-06-27 23:26 ` Bjorn Helgaas
  3 siblings, 0 replies; 5+ messages in thread
From: Bjorn Helgaas @ 2017-06-27 23:26 UTC (permalink / raw)
  To: Logan Gunthorpe; +Cc: Bjorn Helgaas, linux-pci, linux-kernel

On Thu, Jun 15, 2017 at 02:12:22PM -0600, Logan Gunthorpe wrote:
> Hi Bjorn,
> 
> Can you please queue up these two minor changes for v4.13?
> 
> Thanks,
> 
> Logan
> 
> Logan Gunthorpe (2):
>   switchtec: running status flag to fw partition info ioctl
>   switchtec: add device ids for additional switchtec products
> 
>  drivers/pci/switch/switchtec.c       | 40 ++++++++++++++++++++++++++++++++++--
>  include/uapi/linux/switchtec_ioctl.h |  3 +++
>  2 files changed, 41 insertions(+), 2 deletions(-)

Applied to pci/switchtec for v4.13, thanks!

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

end of thread, other threads:[~2017-06-27 23:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-15 20:12 [PATCH 0/2] Switchtec Changes for v4.13 Logan Gunthorpe
2017-06-15 20:12 ` [PATCH 1/2] switchtec: running status flag to fw partition info ioctl Logan Gunthorpe
2017-06-15 20:12 ` [PATCH 2/2] switchtec: add device ids for additional switchtec products Logan Gunthorpe
2017-06-26 15:59 ` [PATCH 0/2] Switchtec Changes for v4.13 Logan Gunthorpe
2017-06-27 23:26 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).