Skip to contentSkip to conversation

intel_pmc_ipc: Fix GCR register base address and length

PATCH In review Qipeng Zha 3 participants 7 messages Feb 17, 2016 – Feb 19, 2016 x86 platform drivers

lore
Share & tools
lore

Qipeng Zha

author
#0 lore raw

PATCH 1/2 intel_pmc_ipc: Fix GCR register base address and length

GCR register (pmc_cfg register) is at offset 0x1008, and remapping of 0x4 bytes is enough.

---
 drivers/platform/x86/intel_pmc_ipc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/platform/x86/intel_pmc_ipc.c +3 -2
index ca69135..abdf67c 100644
@@ -67,7 +67,8 @@
 /* exported resources from IFWI */
 #define PLAT_RESOURCE_IPC_INDEX		0
 #define PLAT_RESOURCE_IPC_SIZE		0x1000
-#define PLAT_RESOURCE_GCR_SIZE		0x1000
+#define PLAT_RESOURCE_GCR_OFFSET	0x1008
+#define PLAT_RESOURCE_GCR_SIZE		0x4
 #define PLAT_RESOURCE_BIOS_DATA_INDEX	1
 #define PLAT_RESOURCE_BIOS_IFACE_INDEX	2
 #define PLAT_RESOURCE_ISP_DATA_INDEX	4
@@ -688,7 +689,7 @@ static int ipc_plat_get_res(struct platform_device *pdev)
 	}
 	ipcdev.ipc_base = addr;
 
-	ipcdev.gcr_base = res->start + size;
+	ipcdev.gcr_base = res->start + PLAT_RESOURCE_GCR_OFFSET;
 	ipcdev.gcr_size = PLAT_RESOURCE_GCR_SIZE;
 	dev_info(&pdev->dev, "ipc res: %pR\n", res);
 
Signature · 1 line
1.8.3.2
author
#1 lore raw

PATCH 2/2 intel_pmc_ipc: avoid pending IPC1 command during legacy suspend

During legacy suspend flow, IPC1 commands are being requested from opregion driver. But the PMC_IPC1 command will timeout as example:

[  281.444600] ipc_debug##: ipc_send_command: cmd=0x201ff,
[  281.444648] wbuf[0]=0x4ea6
[  281.444668] wbuf[1]=0x0
[  281.444674] wbuf[2]=0x0
[  281.444676] wbuf[3]=0x0
[  284.446467] pmc-ipc-plat INT34D2:00: IPC timed out, TS=0x4, CMD=0x200ff

This is because before the opregion driver could send IPC1 commands, the PMC_IPC irq is already suspended. Which makes the IPC command to timeout.

Solution: register pmc_ipc irq as IRQF_NO_SUSPEND

---
 drivers/platform/x86/intel_pmc_ipc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/platform/x86/intel_pmc_ipc.c +2 -1
index abdf67c..140aa77 100644
@@ -731,7 +731,8 @@ static int ipc_plat_probe(struct platform_device *pdev)
 		goto err_device;
 	}
 
-	if (request_irq(ipcdev.irq, ioc, 0, "intel_pmc_ipc", &ipcdev)) {
+	if (request_irq(ipcdev.irq, ioc, IRQF_NO_SUSPEND,
+			"intel_pmc_ipc", &ipcdev)) {
 		dev_err(&pdev->dev, "Failed to request irq\n");
 		ret = -EBUSY;
 		goto err_irq;
Signature · 1 line
1.8.3.2
#2 lore raw

Re: [PATCH 2/2] intel_pmc_ipc: avoid pending IPC1 command during legacy suspend

Quoted 14 lines · Qipeng Zha

During legacy suspend flow, IPC1 commands are being requested from opregion driver. But the PMC_IPC1 command will timeout as example:

[  281.444600] ipc_debug##: ipc_send_command: cmd=0x201ff,
[  281.444648] wbuf[0]=0x4ea6
[  281.444668] wbuf[1]=0x0
[  281.444674] wbuf[2]=0x0
[  281.444676] wbuf[3]=0x0
[  284.446467] pmc-ipc-plat INT34D2:00: IPC timed out, TS=0x4, CMD=0x200ff

This is because before the opregion driver could send IPC1 commands, the PMC_IPC irq is already suspended. Which makes the IPC command to timeout.

Quoted 5 lines

Solution: register pmc_ipc irq as IRQF_NO_SUSPEND

Qipeng, who wrote this patch? This is the one I need a Signed-off-by from. Feel free to credit the others with concept, debug, testing in the commit message, but the Signed-off-by indicates authorship and the path the patch took to mainline.

Quoted 22 lines
---
 drivers/platform/x86/intel_pmc_ipc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/platform/x86/intel_pmc_ipc.c +2 -1
index abdf67c..140aa77 100644
@@ -731,7 +731,8 @@ static int ipc_plat_probe(struct platform_device *pdev)
 		goto err_device;
 	}
 
-	if (request_irq(ipcdev.irq, ioc, 0, "intel_pmc_ipc", &ipcdev)) {
+	if (request_irq(ipcdev.irq, ioc, IRQF_NO_SUSPEND,
+			"intel_pmc_ipc", &ipcdev)) {
 		dev_err(&pdev->dev, "Failed to request irq\n");
 		ret = -EBUSY;
 		goto err_irq;
Signature · 1 line
1.8.3.2
Signature · 2 lines
Darren Hart
Intel Open Source Technology Center
#3 lore raw
In reply to Qipeng Zha
Quoted 3 lines · Qipeng Zha

GCR register (pmc_cfg register) is at offset 0x1008, and remapping of 0x4 bytes is enough.

Darren, both patches are fine by me.

Quoted 32 lines

Signed-off-by: Francois-Nicolas Muller <francois-
[email protected]>

---
 drivers/platform/x86/intel_pmc_ipc.c | 5 +++--

 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/platform/x86/intel_pmc_ipc.c +2 -1
index ca69135..abdf67c 100644
@@ -67,7 +67,8 @@
  /* exported resources from IFWI */
  #define PLAT_RESOURCE_IPC_INDEX		0
  #define PLAT_RESOURCE_IPC_SIZE		0x1000
-#define PLAT_RESOURCE_GCR_SIZE		0x1000
+#define PLAT_RESOURCE_GCR_OFFSET	0x1008
+#define PLAT_RESOURCE_GCR_SIZE		0x4
  #define PLAT_RESOURCE_BIOS_DATA_INDEX	1
  #define PLAT_RESOURCE_BIOS_IFACE_INDEX	2
  #define PLAT_RESOURCE_ISP_DATA_INDEX	4
@@ -688,7 +689,7 @@ static int ipc_plat_get_res(struct
 platform_device *pdev)
  	}
  	ipcdev.ipc_base = addr;

drivers/platform/x86/intel_pmc_ipc.c +1 -1
-	ipcdev.gcr_base = res->start + size;
+	ipcdev.gcr_base = res->start + PLAT_RESOURCE_GCR_OFFSET;

  ipcdev.gcr_size = PLAT_RESOURCE_GCR_SIZE; dev_info(&pdev->dev, "ipc res: %pR\n", res);

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#4 lore raw
In reply to Qipeng Zha
Quoted 5 lines · Qipeng Zha

GCR register (pmc_cfg register) is at offset 0x1008, and remapping of 0x4 bytes is enough.

Who wrote the patch?

Quoted 31 lines
---
 drivers/platform/x86/intel_pmc_ipc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/platform/x86/intel_pmc_ipc.c +3 -2
index ca69135..abdf67c 100644
@@ -67,7 +67,8 @@
 /* exported resources from IFWI */
 #define PLAT_RESOURCE_IPC_INDEX		0
 #define PLAT_RESOURCE_IPC_SIZE		0x1000
-#define PLAT_RESOURCE_GCR_SIZE		0x1000
+#define PLAT_RESOURCE_GCR_OFFSET	0x1008
+#define PLAT_RESOURCE_GCR_SIZE		0x4
 #define PLAT_RESOURCE_BIOS_DATA_INDEX	1
 #define PLAT_RESOURCE_BIOS_IFACE_INDEX	2
 #define PLAT_RESOURCE_ISP_DATA_INDEX	4
@@ -688,7 +689,7 @@ static int ipc_plat_get_res(struct platform_device *pdev)
 	}
 	ipcdev.ipc_base = addr;
 
-	ipcdev.gcr_base = res->start + size;
+	ipcdev.gcr_base = res->start + PLAT_RESOURCE_GCR_OFFSET;
 	ipcdev.gcr_size = PLAT_RESOURCE_GCR_SIZE;
 	dev_info(&pdev->dev, "ipc res: %pR\n", res);
 
Signature · 1 line
1.8.3.2
Signature · 2 lines
Darren Hart
Intel Open Source Technology Center
#5 lore raw
Quoted 6 lines

Signed-off-by: Francois-Nicolas Muller
<[email protected]>

Who wrote the patch?

Darren, Francois-Nicolas wrote this patch whicch merged in internal kernel.

Quoted 29 lines
---
 drivers/platform/x86/intel_pmc_ipc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/platform/x86/intel_pmc_ipc.c +3 -3
index ca69135..abdf67c 100644
@@ -67,7 +67,8 @@
 /* exported resources from IFWI */
 #define PLAT_RESOURCE_IPC_INDEX		0
 #define PLAT_RESOURCE_IPC_SIZE		0x1000
-#define PLAT_RESOURCE_GCR_SIZE		0x1000
+#define PLAT_RESOURCE_GCR_OFFSET	0x1008
+#define PLAT_RESOURCE_GCR_SIZE		0x4
 #define PLAT_RESOURCE_BIOS_DATA_INDEX	1
 #define PLAT_RESOURCE_BIOS_IFACE_INDEX	2
 #define PLAT_RESOURCE_ISP_DATA_INDEX	4
@@ -688,7 +689,7 @@ static int ipc_plat_get_res(struct platform_device *pdev)
 	}
 	ipcdev.ipc_base = addr;
 
-	ipcdev.gcr_base = res->start + size;
+	ipcdev.gcr_base = res->start + PLAT_RESOURCE_GCR_OFFSET;
 	ipcdev.gcr_size = PLAT_RESOURCE_GCR_SIZE;
 	dev_info(&pdev->dev, "ipc res: %pR\n", res);
 
--
Quoted 3 lines

1.8.3.2

--
Darren Hart
Intel Open Source Technology Center

#6 lore raw
Quoted 7 lines · Qipeng
Quoted 6 lines

Signed-off-by: Francois-Nicolas Muller
<[email protected]>

Who wrote the patch?

Darren, Francois-Nicolas wrote this patch whicch merged in internal kernel.

Thanks Qipeng. If the author isn't submitting, please give me a head's up in the cover letter (PATCH 0/X) in future submissions.

Signature · 2 lines
Darren Hart
Intel Open Source Technology Center