Skip to content

Commit df0219d

Browse files
committed
Merge tag 'parisc-for-6.0-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux
Pull parisc fixes from Helge Deller: "Some interesting background to the current patchset: It turned out that the fldw instruction (which loads a 32-bit word from memory into one half of a FP register) failed on unaligned addresses and even trashed some other random FP register instead. It's a trivial one-liner fix in the exception handler but this failure dates back to the very beginnings of the parisc-port. It's strange that it was never noticed before. Another patch fixes an annoyance noticed by Randy Dunlap. Running "make ARCH=parisc64 randconfig" always returned a 32-bit config, although one would expect a 64-bit config. Masahiro Yamada suggested to mimik sparc Kconfig code, which fixed the issue nicely. This allowed to drop some compiler build checks too. Third, it's possible to build an optimized 32-bit kernel for PA8X00 (64-bit) CPUs, which then wouldn't start on 32-bit-only (PA1.x) machines. I've added a bootup check which prevents that and which prints a message to the console. This can be tested with qemu, which currently only supports 32-bit emulation. The other patches are usual clean-up stuff like added return value checks and typo fixes in comments. Summary: - Fix emulation of fldw instruction on unaligned addresses - Fix "make ARCH=parisc64 randconfig" to return a 64-bit config - Prevent boot if trying to boot a 32-bit kernel compiled for PA8X00 CPUs on 32-bit only machines - ccio-dma: Handle kmalloc failure in ccio_init_resources()" * tag 'parisc-for-6.0-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux: parisc: Add runtime check to prevent PA2.0 kernels on PA1.x machines parisc: ccio-dma: Handle kmalloc failure in ccio_init_resources() parisc: led: Move from strlcpy with unused retval to strscpy parisc: ccio-dma: Fix typo in comment Revert "parisc: Show error if wrong 32/64-bit compiler is being used" parisc: Make CONFIG_64BIT available for ARCH=parisc64 only parisc: Fix exception handler for fldw and fstw instructions
2 parents 95607ad + 591d210 commit df0219d

File tree

6 files changed

+59
-30
lines changed

6 files changed

+59
-30
lines changed

arch/parisc/Kconfig

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,10 @@ menu "Processor type and features"
146146

147147
choice
148148
prompt "Processor type"
149-
default PA7000
149+
default PA7000 if "$(ARCH)" = "parisc"
150150

151151
config PA7000
152-
bool "PA7000/PA7100"
152+
bool "PA7000/PA7100" if "$(ARCH)" = "parisc"
153153
help
154154
This is the processor type of your CPU. This information is
155155
used for optimizing purposes. In order to compile a kernel
@@ -160,21 +160,21 @@ config PA7000
160160
which is required on some machines.
161161

162162
config PA7100LC
163-
bool "PA7100LC"
163+
bool "PA7100LC" if "$(ARCH)" = "parisc"
164164
help
165165
Select this option for the PCX-L processor, as used in the
166166
712, 715/64, 715/80, 715/100, 715/100XC, 725/100, 743, 748,
167167
D200, D210, D300, D310 and E-class
168168

169169
config PA7200
170-
bool "PA7200"
170+
bool "PA7200" if "$(ARCH)" = "parisc"
171171
help
172172
Select this option for the PCX-T' processor, as used in the
173173
C100, C110, J100, J110, J210XC, D250, D260, D350, D360,
174174
K100, K200, K210, K220, K400, K410 and K420
175175

176176
config PA7300LC
177-
bool "PA7300LC"
177+
bool "PA7300LC" if "$(ARCH)" = "parisc"
178178
help
179179
Select this option for the PCX-L2 processor, as used in the
180180
744, A180, B132L, B160L, B180L, C132L, C160L, C180L,
@@ -224,17 +224,8 @@ config MLONGCALLS
224224
Enabling this option will probably slow down your kernel.
225225

226226
config 64BIT
227-
bool "64-bit kernel"
227+
def_bool "$(ARCH)" = "parisc64"
228228
depends on PA8X00
229-
help
230-
Enable this if you want to support 64bit kernel on PA-RISC platform.
231-
232-
At the moment, only people willing to use more than 2GB of RAM,
233-
or having a 64bit-only capable PA-RISC machine should say Y here.
234-
235-
Since there is no 64bit userland on PA-RISC, there is no point to
236-
enable this option otherwise. The 64bit kernel is significantly bigger
237-
and slower than the 32bit one.
238229

239230
choice
240231
prompt "Kernel page size"

arch/parisc/include/asm/bitops.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@
1212
#include <asm/barrier.h>
1313
#include <linux/atomic.h>
1414

15-
/* compiler build environment sanity checks: */
16-
#if !defined(CONFIG_64BIT) && defined(__LP64__)
17-
#error "Please use 'ARCH=parisc' to build the 32-bit kernel."
18-
#endif
19-
#if defined(CONFIG_64BIT) && !defined(__LP64__)
20-
#error "Please use 'ARCH=parisc64' to build the 64-bit kernel."
21-
#endif
22-
2315
/* See http://marc.theaimsgroup.com/?t=108826637900003 for discussion
2416
* on use of volatile and __*_bit() (set/clear/change):
2517
* *_bit() want use of volatile.

arch/parisc/kernel/head.S

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include <linux/init.h>
2323
#include <linux/pgtable.h>
2424

25-
.level PA_ASM_LEVEL
25+
.level 1.1
2626

2727
__INITDATA
2828
ENTRY(boot_args)
@@ -70,6 +70,47 @@ $bss_loop:
7070
stw,ma %arg2,4(%r1)
7171
stw,ma %arg3,4(%r1)
7272

73+
#if !defined(CONFIG_64BIT) && defined(CONFIG_PA20)
74+
/* This 32-bit kernel was compiled for PA2.0 CPUs. Check current CPU
75+
* and halt kernel if we detect a PA1.x CPU. */
76+
ldi 32,%r10
77+
mtctl %r10,%cr11
78+
.level 2.0
79+
mfctl,w %cr11,%r10
80+
.level 1.1
81+
comib,<>,n 0,%r10,$cpu_ok
82+
83+
load32 PA(msg1),%arg0
84+
ldi msg1_end-msg1,%arg1
85+
$iodc_panic:
86+
copy %arg0, %r10
87+
copy %arg1, %r11
88+
load32 PA(init_stack),%sp
89+
#define MEM_CONS 0x3A0
90+
ldw MEM_CONS+32(%r0),%arg0 // HPA
91+
ldi ENTRY_IO_COUT,%arg1
92+
ldw MEM_CONS+36(%r0),%arg2 // SPA
93+
ldw MEM_CONS+8(%r0),%arg3 // layers
94+
load32 PA(__bss_start),%r1
95+
stw %r1,-52(%sp) // arg4
96+
stw %r0,-56(%sp) // arg5
97+
stw %r10,-60(%sp) // arg6 = ptr to text
98+
stw %r11,-64(%sp) // arg7 = len
99+
stw %r0,-68(%sp) // arg8
100+
load32 PA(.iodc_panic_ret), %rp
101+
ldw MEM_CONS+40(%r0),%r1 // ENTRY_IODC
102+
bv,n (%r1)
103+
.iodc_panic_ret:
104+
b . /* wait endless with ... */
105+
or %r10,%r10,%r10 /* qemu idle sleep */
106+
msg1: .ascii "Can't boot kernel which was built for PA8x00 CPUs on this machine.\r\n"
107+
msg1_end:
108+
109+
$cpu_ok:
110+
#endif
111+
112+
.level PA_ASM_LEVEL
113+
73114
/* Initialize startup VM. Just map first 16/32 MB of memory */
74115
load32 PA(swapper_pg_dir),%r4
75116
mtctl %r4,%cr24 /* Initialize kernel root pointer */

arch/parisc/kernel/unaligned.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
#define R1(i) (((i)>>21)&0x1f)
9494
#define R2(i) (((i)>>16)&0x1f)
9595
#define R3(i) ((i)&0x1f)
96-
#define FR3(i) ((((i)<<1)&0x1f)|(((i)>>6)&1))
96+
#define FR3(i) ((((i)&0x1f)<<1)|(((i)>>6)&1))
9797
#define IM(i,n) (((i)>>1&((1<<(n-1))-1))|((i)&1?((0-1L)<<(n-1)):0))
9898
#define IM5_2(i) IM((i)>>16,5)
9999
#define IM5_3(i) IM((i),5)

drivers/parisc/ccio-dma.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ static int ioc_count;
268268
* Each bit can represent a number of pages.
269269
* LSbs represent lower addresses (IOVA's).
270270
*
271-
* This was was copied from sba_iommu.c. Don't try to unify
271+
* This was copied from sba_iommu.c. Don't try to unify
272272
* the two resource managers unless a way to have different
273273
* allocation policies is also adjusted. We'd like to avoid
274274
* I/O TLB thrashing by having resource allocation policy
@@ -1380,15 +1380,17 @@ ccio_init_resource(struct resource *res, char *name, void __iomem *ioaddr)
13801380
}
13811381
}
13821382

1383-
static void __init ccio_init_resources(struct ioc *ioc)
1383+
static int __init ccio_init_resources(struct ioc *ioc)
13841384
{
13851385
struct resource *res = ioc->mmio_region;
13861386
char *name = kmalloc(14, GFP_KERNEL);
1387-
1387+
if (unlikely(!name))
1388+
return -ENOMEM;
13881389
snprintf(name, 14, "GSC Bus [%d/]", ioc->hw_path);
13891390

13901391
ccio_init_resource(res, name, &ioc->ioc_regs->io_io_low);
13911392
ccio_init_resource(res + 1, name, &ioc->ioc_regs->io_io_low_hv);
1393+
return 0;
13921394
}
13931395

13941396
static int new_ioc_area(struct resource *res, unsigned long size,
@@ -1543,7 +1545,10 @@ static int __init ccio_probe(struct parisc_device *dev)
15431545
return -ENOMEM;
15441546
}
15451547
ccio_ioc_init(ioc);
1546-
ccio_init_resources(ioc);
1548+
if (ccio_init_resources(ioc)) {
1549+
kfree(ioc);
1550+
return -ENOMEM;
1551+
}
15471552
hppa_dma_ops = &ccio_ops;
15481553

15491554
hba = kzalloc(sizeof(*hba), GFP_KERNEL);

drivers/parisc/led.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ int lcd_print( const char *str )
646646
cancel_delayed_work_sync(&led_task);
647647

648648
/* copy display string to buffer for procfs */
649-
strlcpy(lcd_text, str, sizeof(lcd_text));
649+
strscpy(lcd_text, str, sizeof(lcd_text));
650650

651651
/* Set LCD Cursor to 1st character */
652652
gsc_writeb(lcd_info.reset_cmd1, LCD_CMD_REG);

0 commit comments

Comments
 (0)