MIPS: Add KSEG*ADDR definitions to CONFIG_64BIT
Subsystems (2)
PATCH 1/1 MIPS: Add KSEG*ADDR definitions to CONFIG_64BIT
The patch adds KSEG0ADDR, KSEG1ADDR, KSEG2ADDR, KSEG3ADDR definitions to CONFIG_64BIT ifdef. This fixes broken compilation:
CC drivers/watchdog/mtx-1_wdt.o
In file included from drivers/watchdog/mtx-1_wdt.c:44:./arch/mips/include/asm/mach-au1x00/au1000.h: In function ‘alchemy_rdsys’:./arch/mips/include/asm/mach-au1x00/au1000.h:603:36: error: implicit
declaration of function ‘KSEG1ADDR’; did you mean ‘CKSEG1ADDR’? [-Werror=implicit-function-declaration]
--- arch/mips/include/asm/addrspace.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/mips/include/asm/addrspace.h +12 -0
@@ -65,6 +65,10 @@#define XKSSEG _CONST64_(0x4000000000000000)#define XKPHYS _CONST64_(0x8000000000000000)#define XKSEG _CONST64_(0xc000000000000000) +#define KSEG0 _CONST64_(0xffffffff80000000) +#define KSEG1 _CONST64_(0xffffffffa0000000) +#define KSSEG _CONST64_(0xffffffffc0000000) +#define KSEG3 _CONST64_(0xffffffffe0000000)#define CKSEG0 _CONST64_(0xffffffff80000000)#define CKSEG1 _CONST64_(0xffffffffa0000000)#define CKSSEG _CONST64_(0xffffffffc0000000)
@@ -75,6 +79,14 @@#define CKSEG2ADDR (a) (CPHYSADDR(a) | CKSEG2)#define CKSEG3ADDR (a) (CPHYSADDR(a) | CKSEG3) +/* +* Map an address to a certain kernel segment +*/ +#define KSEG0ADDR (a) (CPHYSADDR(a) | KSEG0) +#define KSEG1ADDR (a) (CPHYSADDR(a) | KSEG1) +#define KSEG2ADDR (a) (CPHYSADDR(a) | KSEG2) +#define KSEG3ADDR (a) (CPHYSADDR(a) | KSEG3) +#else #define CKSEG0ADDR (a) (CPHYSADDR(a) | KSEG0)
Signature · 1 line
2.20.1
Hi Denis,
Quoted 8 lines · Denis Efremov
The patch adds KSEG0ADDR, KSEG1ADDR, KSEG2ADDR, KSEG3ADDR definitions to
CONFIG_64BITifdef. This fixes broken compilation:
CCdrivers/watchdog/mtx-1_wdt.o
In file included fromdrivers/watchdog/mtx-1_wdt.c:44:./arch/mips/include/asm/mach-au1x00/au1000.h: In function ‘alchemy_rdsys’:./arch/mips/include/asm/mach-au1x00/au1000.h:603:36: error: implicit
declaration of function ‘KSEG1ADDR’; did you mean ‘CKSEG1ADDR’? [-Werror=implicit-function-declaration]
Since this driver is meant to run on a system that only supports 32 bit kernels, I think it would be better to correct its dependencies in Kconfig like so:
drivers/watchdog/Kconfig +1 -1
@@ -1648,7 +1648,7 @@ config JZ4740_WDT config WDT_MTX1 tristate "MTX-1 Hardware Watchdog" - depends on MIPS_MTX1 || (MIPS && COMPILE_TEST) + depends on MIPS_MTX1 || (MIPS && 32BIT && COMPILE_TEST) help Hardware driver for the MTX-1 boards. This is a watchdog timer that will reboot the machine after a 100 seconds timer expired.
And mark this with the appropriate fixes tag:
What do you think?
Alternatively the driver could just use the existing & equivalent CKSEG1ADDR() macro as the compiler suggested, but in that case it'd be good to check that's the only change needed to build cleanly with CONFIG_64BIT=y.
Thanks,
Paul
Hi,
Quoted 32 lines · Paul Burton
Hi Denis,
Quoted 8 lines · Denis Efremov
The patch adds KSEG0ADDR, KSEG1ADDR, KSEG2ADDR, KSEG3ADDR definitions to
CONFIG_64BITifdef. This fixes broken compilation:
CCdrivers/watchdog/mtx-1_wdt.o
In file included fromdrivers/watchdog/mtx-1_wdt.c:44:./arch/mips/include/asm/mach-au1x00/au1000.h: In function ‘alchemy_rdsys’:./arch/mips/include/asm/mach-au1x00/au1000.h:603:36: error: implicit
declaration of function ‘KSEG1ADDR’; did you mean ‘CKSEG1ADDR’? [-Werror=implicit-function-declaration]Since this driver is meant to run on a system that only supports 32 bit kernels, I think it would be better to correct its dependencies in
Kconfiglike so:drivers/watchdog/Kconfig +1
-1@@ -1648,7 +1648,7 @@ config JZ4740_WDT config WDT_MTX1 tristate "MTX-1 Hardware Watchdog" - depends on MIPS_MTX1 || (MIPS && COMPILE_TEST) + depends on MIPS_MTX1 || (MIPS && 32BIT && COMPILE_TEST) help Hardware driver for the MTX-1 boards. This is a watchdog timer that will reboot the machine after a 100 seconds timer expired.And mark this with the appropriate fixes tag:
Quoted 9 lines
Fixes da2a68b3eb47 ("watchdog: Enable COMPILE_TEST where possible")What do you think?
Alternatively the driver could just use the existing & equivalent
CKSEG1ADDR()macro as the compiler suggested, but in that case it'd be good to check that's the only change needed to build cleanly withCONFIG_64BIT=y.
Thank you for the suggestion. I will prepare V2 and fix the same way other drivers that break the compilation with CONFIG_64BIT and missing KSEG1ADDR.
Quoted 3 lines
Thanks,
Paul
Quoted 39 lines · Denis Efremov
Hi,
Quoted 36 lines · Paul Burton
Hi Denis,
Quoted 8 lines · Denis Efremov
The patch adds KSEG0ADDR, KSEG1ADDR, KSEG2ADDR, KSEG3ADDR definitions to
CONFIG_64BITifdef. This fixes broken compilation:
CCdrivers/watchdog/mtx-1_wdt.o
In file included fromdrivers/watchdog/mtx-1_wdt.c:44:./arch/mips/include/asm/mach-au1x00/au1000.h: In function ‘alchemy_rdsys’:./arch/mips/include/asm/mach-au1x00/au1000.h:603:36: error: implicit
declaration of function ‘KSEG1ADDR’; did you mean ‘CKSEG1ADDR’? [-Werror=implicit-function-declaration]Since this driver is meant to run on a system that only supports 32 bit kernels, I think it would be better to correct its dependencies in
Kconfiglike so:drivers/watchdog/Kconfig +1
-1@@ -1648,7 +1648,7 @@ config JZ4740_WDT config WDT_MTX1 tristate "MTX-1 Hardware Watchdog" - depends on MIPS_MTX1 || (MIPS && COMPILE_TEST) + depends on MIPS_MTX1 || (MIPS && 32BIT && COMPILE_TEST) help Hardware driver for the MTX-1 boards. This is a watchdog timer that will reboot the machine after a 100 seconds timer expired.And mark this with the appropriate fixes tag:
Fixes da2a68b3eb47 ("watchdog: Enable COMPILE_TEST where possible")What do you think?
Quoted 8 lines
Quoted 5 lines
Alternatively the driver could just use the existing & equivalent
CKSEG1ADDR()macro as the compiler suggested, but in that case it'd be good to check that's the only change needed to build cleanly withCONFIG_64BIT=y.Thank you for the suggestion. I will prepare V2 and fix the same way other drivers that break the compilation with
CONFIG_64BITand missing KSEG1ADDR.
There is a much simpler solution actually:
drivers/watchdog/mtx-1_wdt.c +0 -2
@@ -41,8 +41,6 @@#include <linux/uaccess.h> #include <linux/gpio/consumer.h> -#include <asm/mach-au1x00/au1000.h> -#define MTX1_WDT_INTERVAL (5 * HZ)static int ticks =100 *HZ ;
and then you can even push this further with:
drivers/watchdog/Kconfig +1 -1
@@ -1651,7 +1651,7 @@ config JZ4740_WDT config WDT_MTX1 tristate "MTX-1 Hardware Watchdog" - depends on MIPS_MTX1 || (MIPS && COMPILE_TEST) + depends on MIPS_MTX1 || COMPILE_TEST help Hardware driver for the MTX-1 boards. This is a watchdog timer
that
will reboot the machine after a 100 seconds timer expired.
I checked both an alchemy, non-alchemy MIPS build as well as a x86_64 build with the two patches applied.
In fact, this entire driver is just an older version of drivers/watchdog/gpio_wdt.c and should be converted to it, if only I had that box available.
Signature · 1 line
Florian
Quoted 49 lines · Florian Fainelli
Quoted 39 lines · Denis Efremov
Hi,
Quoted 36 lines · Paul Burton
Hi Denis,
Quoted 8 lines · Denis Efremov
The patch adds KSEG0ADDR, KSEG1ADDR, KSEG2ADDR, KSEG3ADDR definitions to
CONFIG_64BITifdef. This fixes broken compilation:
CCdrivers/watchdog/mtx-1_wdt.o
In file included fromdrivers/watchdog/mtx-1_wdt.c:44:./arch/mips/include/asm/mach-au1x00/au1000.h: In function ‘alchemy_rdsys’:./arch/mips/include/asm/mach-au1x00/au1000.h:603:36: error: implicit
declaration of function ‘KSEG1ADDR’; did you mean ‘CKSEG1ADDR’? [-Werror=implicit-function-declaration]Since this driver is meant to run on a system that only supports 32 bit kernels, I think it would be better to correct its dependencies in
Kconfiglike so:drivers/watchdog/Kconfig +1
-1@@ -1648,7 +1648,7 @@ config JZ4740_WDT config WDT_MTX1 tristate "MTX-1 Hardware Watchdog" - depends on MIPS_MTX1 || (MIPS && COMPILE_TEST) + depends on MIPS_MTX1 || (MIPS && 32BIT && COMPILE_TEST) help Hardware driver for the MTX-1 boards. This is a watchdog timer that will reboot the machine after a 100 seconds timer expired.And mark this with the appropriate fixes tag:
Fixes da2a68b3eb47 ("watchdog: Enable COMPILE_TEST where possible")What do you think?
Quoted 8 lines
Quoted 5 lines
Alternatively the driver could just use the existing & equivalent
CKSEG1ADDR()macro as the compiler suggested, but in that case it'd be good to check that's the only change needed to build cleanly withCONFIG_64BIT=y.Thank you for the suggestion. I will prepare V2 and fix the same way other drivers that break the compilation with
CONFIG_64BITand missing KSEG1ADDR.
Quoted 1 line
There is a much simpler solution actually:
Well, I think you know better how to fix this. I think it will be better if you prepare the patch. Your solution seems more elegant, at least to me.
Quoted 32 lines
drivers/watchdog/mtx-1_wdt.c +0
-2@@ -41,8 +41,6 @@#include <linux/uaccess.h> #include <linux/gpio/consumer.h> -#include <asm/mach-au1x00/au1000.h> -#define MTX1_WDT_INTERVAL (5 * HZ)static int ticks =100 *HZ ;and then you can even push this further with:
drivers/watchdog/Kconfig +1
-1@@ -1651,7 +1651,7 @@ config JZ4740_WDT config WDT_MTX1 tristate "MTX-1 Hardware Watchdog" - depends on MIPS_MTX1 || (MIPS && COMPILE_TEST) + depends on MIPS_MTX1 || COMPILE_TEST help Hardware driver for the MTX-1 boards. This is a watchdog timerthat
will reboot the machine after a 100 seconds timer expired.
Quoted 6 lines
I checked both an alchemy, non-alchemy MIPS build as well as a
x86_64build with the two patches applied.In fact, this entire driver is just an older version of
drivers/watchdog/gpio_wdt.cand should be converted to it, if only I had that box available.
Thanks,
Denis