platform-driver-x86.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] platform/x86: amd-pmc: Fix undefined reference to __udivdi3
@ 2021-07-16 15:38 Shyam Sundar S K
  2021-07-16 16:22 ` Randy Dunlap
  2021-07-17 10:27 ` Hans de Goede
  0 siblings, 2 replies; 3+ messages in thread
From: Shyam Sundar S K @ 2021-07-16 15:38 UTC (permalink / raw)
  To: hdegoede, mgross; +Cc: platform-driver-x86, Shyam Sundar S K, Randy Dunlap

It was reported that on i386 config

------
on i386:

ld: drivers/platform/x86/amd-pmc.o: in function `s0ix_stats_show':
amd-pmc.c:(.text+0x100): undefined reference to `__udivdi3'
-------

The reason for this is that 64-bit integer division is not supported
on 32-bit architecture. Use do_div macro to fix this.

Fixes: b9a4fa6978be ("platform/x86: amd-pmc: Add support for logging s0ix counters")
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
---
 drivers/platform/x86/amd-pmc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/amd-pmc.c b/drivers/platform/x86/amd-pmc.c
index 680f94c7e075..45ce1d5e1e6d 100644
--- a/drivers/platform/x86/amd-pmc.c
+++ b/drivers/platform/x86/amd-pmc.c
@@ -189,7 +189,8 @@ static int s0ix_stats_show(struct seq_file *s, void *unused)
 	exit_time = exit_time << 32 | ioread32(dev->fch_virt_addr + FCH_S0I3_EXIT_TIME_L_OFFSET);
 
 	/* It's in 48MHz. We need to convert it */
-	residency = (exit_time - entry_time) / 48;
+	residency = exit_time - entry_time;
+	do_div(residency, 48);
 
 	seq_puts(s, "=== S0ix statistics ===\n");
 	seq_printf(s, "S0ix Entry Time: %lld\n", entry_time);
-- 
2.25.1


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

* Re: [PATCH] platform/x86: amd-pmc: Fix undefined reference to __udivdi3
  2021-07-16 15:38 [PATCH] platform/x86: amd-pmc: Fix undefined reference to __udivdi3 Shyam Sundar S K
@ 2021-07-16 16:22 ` Randy Dunlap
  2021-07-17 10:27 ` Hans de Goede
  1 sibling, 0 replies; 3+ messages in thread
From: Randy Dunlap @ 2021-07-16 16:22 UTC (permalink / raw)
  To: Shyam Sundar S K, hdegoede, mgross; +Cc: platform-driver-x86

On 7/16/21 8:38 AM, Shyam Sundar S K wrote:
> It was reported that on i386 config
> 
> ------
> on i386:
> 
> ld: drivers/platform/x86/amd-pmc.o: in function `s0ix_stats_show':
> amd-pmc.c:(.text+0x100): undefined reference to `__udivdi3'
> -------
> 
> The reason for this is that 64-bit integer division is not supported
> on 32-bit architecture. Use do_div macro to fix this.
> 
> Fixes: b9a4fa6978be ("platform/x86: amd-pmc: Add support for logging s0ix counters")
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>

Reviewed-by: Randy Dunlap <rdunlap@infradead.org> # and build-tested

Thanks.

> ---
>  drivers/platform/x86/amd-pmc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/amd-pmc.c b/drivers/platform/x86/amd-pmc.c
> index 680f94c7e075..45ce1d5e1e6d 100644
> --- a/drivers/platform/x86/amd-pmc.c
> +++ b/drivers/platform/x86/amd-pmc.c
> @@ -189,7 +189,8 @@ static int s0ix_stats_show(struct seq_file *s, void *unused)
>  	exit_time = exit_time << 32 | ioread32(dev->fch_virt_addr + FCH_S0I3_EXIT_TIME_L_OFFSET);
>  
>  	/* It's in 48MHz. We need to convert it */
> -	residency = (exit_time - entry_time) / 48;
> +	residency = exit_time - entry_time;
> +	do_div(residency, 48);
>  
>  	seq_puts(s, "=== S0ix statistics ===\n");
>  	seq_printf(s, "S0ix Entry Time: %lld\n", entry_time);
> 


-- 
~Randy

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

* Re: [PATCH] platform/x86: amd-pmc: Fix undefined reference to __udivdi3
  2021-07-16 15:38 [PATCH] platform/x86: amd-pmc: Fix undefined reference to __udivdi3 Shyam Sundar S K
  2021-07-16 16:22 ` Randy Dunlap
@ 2021-07-17 10:27 ` Hans de Goede
  1 sibling, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2021-07-17 10:27 UTC (permalink / raw)
  To: Shyam Sundar S K, mgross; +Cc: platform-driver-x86, Randy Dunlap

Hi,

On 7/16/21 5:38 PM, Shyam Sundar S K wrote:
> It was reported that on i386 config
> 
> ------
> on i386:
> 
> ld: drivers/platform/x86/amd-pmc.o: in function `s0ix_stats_show':
> amd-pmc.c:(.text+0x100): undefined reference to `__udivdi3'
> -------
> 
> The reason for this is that 64-bit integer division is not supported
> on 32-bit architecture. Use do_div macro to fix this.
> 
> Fixes: b9a4fa6978be ("platform/x86: amd-pmc: Add support for logging s0ix counters")
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>

Thank you for your patch, I've applied this patch to my review-hans 
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

I will also apply this to the fixes branch and include it in my
upcoming v5.14 pdx86 fixes pull-req to Linus.

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

Regards,

Hans


> ---
>  drivers/platform/x86/amd-pmc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/amd-pmc.c b/drivers/platform/x86/amd-pmc.c
> index 680f94c7e075..45ce1d5e1e6d 100644
> --- a/drivers/platform/x86/amd-pmc.c
> +++ b/drivers/platform/x86/amd-pmc.c
> @@ -189,7 +189,8 @@ static int s0ix_stats_show(struct seq_file *s, void *unused)
>  	exit_time = exit_time << 32 | ioread32(dev->fch_virt_addr + FCH_S0I3_EXIT_TIME_L_OFFSET);
>  
>  	/* It's in 48MHz. We need to convert it */
> -	residency = (exit_time - entry_time) / 48;
> +	residency = exit_time - entry_time;
> +	do_div(residency, 48);
>  
>  	seq_puts(s, "=== S0ix statistics ===\n");
>  	seq_printf(s, "S0ix Entry Time: %lld\n", entry_time);
> 


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

end of thread, other threads:[~2021-07-17 10:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-16 15:38 [PATCH] platform/x86: amd-pmc: Fix undefined reference to __udivdi3 Shyam Sundar S K
2021-07-16 16:22 ` Randy Dunlap
2021-07-17 10:27 ` Hans de Goede

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).