Skip to content

Commit f2e4413

Browse files
committed
Merge tag 'parisc-for-6.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux
Pull parisc updates from Helge Deller: "Fixes: - When we added basic vDSO support in kernel 5.18 we introduced a bug which prevented a mmap() of graphic card memory. This is because we used the DMB (data memory break trap bit) page flag as special-bit, but missed to clear that bit when loading the TLB. - Graphics card memory size was not correctly aligned - Spelling fixes (from Colin Ian King) Enhancements: - PDC console (which uses firmware calls) now rewritten as early console - Reduced size of alternative tables" * tag 'parisc-for-6.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux: parisc: Fix spelling mistake "mis-match" -> "mismatch" in eisa driver parisc: Fix userspace graphics card breakage due to pgtable special bit parisc: fbdev/stifb: Align graphics memory size to 4MB parisc: Convert PDC console to an early console parisc: Reduce kernel size by packing alternative tables
2 parents ebdca8e + 34314cd commit f2e4413

File tree

12 files changed

+67
-267
lines changed

12 files changed

+67
-267
lines changed

arch/parisc/include/asm/alternative.h

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222

2323
struct alt_instr {
2424
s32 orig_offset; /* offset to original instructions */
25-
s32 len; /* end of original instructions */
26-
u32 cond; /* see ALT_COND_XXX */
25+
s16 len; /* end of original instructions */
26+
u16 cond; /* see ALT_COND_XXX */
2727
u32 replacement; /* replacement instruction or code */
28-
};
28+
} __packed;
2929

3030
void set_kernel_text_rw(int enable_read_write);
3131
void apply_alternatives_all(void);
@@ -35,24 +35,27 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end,
3535
/* Alternative SMP implementation. */
3636
#define ALTERNATIVE(cond, replacement) "!0:" \
3737
".section .altinstructions, \"aw\" !" \
38-
".word (0b-4-.), 1, " __stringify(cond) "," \
39-
__stringify(replacement) " !" \
38+
".word (0b-4-.) !" \
39+
".hword 1, " __stringify(cond) " !" \
40+
".word " __stringify(replacement) " !" \
4041
".previous"
4142

4243
#else
4344

4445
/* to replace one single instructions by a new instruction */
4546
#define ALTERNATIVE(from, to, cond, replacement)\
4647
.section .altinstructions, "aw" ! \
47-
.word (from - .), (to - from)/4 ! \
48-
.word cond, replacement ! \
48+
.word (from - .) ! \
49+
.hword (to - from)/4, cond ! \
50+
.word replacement ! \
4951
.previous
5052

5153
/* to replace multiple instructions by new code */
5254
#define ALTERNATIVE_CODE(from, num_instructions, cond, new_instr_ptr)\
5355
.section .altinstructions, "aw" ! \
54-
.word (from - .), -num_instructions ! \
55-
.word cond, (new_instr_ptr - .) ! \
56+
.word (from - .) ! \
57+
.hword -num_instructions, cond ! \
58+
.word (new_instr_ptr - .) ! \
5659
.previous
5760

5861
#endif /* __ASSEMBLY__ */

arch/parisc/include/asm/pdc.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ extern unsigned long parisc_pat_pdc_cap; /* PDC capabilities (PAT) */
1919
#define PDC_TYPE_SYSTEM_MAP 1 /* 32-bit, but supports PDC_SYSTEM_MAP */
2020
#define PDC_TYPE_SNAKE 2 /* Doesn't support SYSTEM_MAP */
2121

22-
void pdc_console_init(void); /* in pdc_console.c */
23-
void pdc_console_restart(void);
24-
2522
void setup_pdc(void); /* in inventory.c */
2623

2724
/* wrapper-functions from pdc.c */

arch/parisc/include/asm/pgtable.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,11 @@ extern void __update_cache(pte_t pte);
192192
#define _PAGE_PRESENT_BIT 22 /* (0x200) Software: translation valid */
193193
#define _PAGE_HPAGE_BIT 21 /* (0x400) Software: Huge Page */
194194
#define _PAGE_USER_BIT 20 /* (0x800) Software: User accessible page */
195+
#ifdef CONFIG_HUGETLB_PAGE
196+
#define _PAGE_SPECIAL_BIT _PAGE_DMB_BIT /* DMB feature is currently unused */
197+
#else
198+
#define _PAGE_SPECIAL_BIT _PAGE_HPAGE_BIT /* use unused HUGE PAGE bit */
199+
#endif
195200

196201
/* N.B. The bits are defined in terms of a 32 bit word above, so the */
197202
/* following macro is ok for both 32 and 64 bit. */
@@ -219,7 +224,7 @@ extern void __update_cache(pte_t pte);
219224
#define _PAGE_PRESENT (1 << xlate_pabit(_PAGE_PRESENT_BIT))
220225
#define _PAGE_HUGE (1 << xlate_pabit(_PAGE_HPAGE_BIT))
221226
#define _PAGE_USER (1 << xlate_pabit(_PAGE_USER_BIT))
222-
#define _PAGE_SPECIAL (_PAGE_DMB)
227+
#define _PAGE_SPECIAL (1 << xlate_pabit(_PAGE_SPECIAL_BIT))
223228

224229
#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | _PAGE_DIRTY | _PAGE_ACCESSED)
225230
#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_SPECIAL)

arch/parisc/kernel/alternative.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ void __init_or_module apply_alternatives(struct alt_instr *start,
2626
struct alt_instr *entry;
2727
int index = 0, applied = 0;
2828
int num_cpus = num_online_cpus();
29-
u32 cond_check;
29+
u16 cond_check;
3030

3131
cond_check = ALT_COND_ALWAYS |
3232
((num_cpus == 1) ? ALT_COND_NO_SMP : 0) |
@@ -45,8 +45,9 @@ void __init_or_module apply_alternatives(struct alt_instr *start,
4545

4646
for (entry = start; entry < end; entry++, index++) {
4747

48-
u32 *from, cond, replacement;
49-
s32 len;
48+
u32 *from, replacement;
49+
u16 cond;
50+
s16 len;
5051

5152
from = (u32 *)((ulong)&entry->orig_offset + entry->orig_offset);
5253
len = entry->len;

arch/parisc/kernel/entry.S

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,10 @@
499499
* Finally, _PAGE_READ goes in the top bit of PL1 (so we
500500
* trigger an access rights trap in user space if the user
501501
* tries to read an unreadable page */
502+
#if _PAGE_SPECIAL_BIT == _PAGE_DMB_BIT
503+
/* need to drop DMB bit, as it's used as SPECIAL flag */
504+
depi 0,_PAGE_SPECIAL_BIT,1,\pte
505+
#endif
502506
depd \pte,8,7,\prot
503507

504508
/* PAGE_USER indicates the page can be read with user privileges,
@@ -529,6 +533,10 @@
529533
* makes the tlb entry for the differently formatted pa11
530534
* insertion instructions */
531535
.macro make_insert_tlb_11 spc,pte,prot
536+
#if _PAGE_SPECIAL_BIT == _PAGE_DMB_BIT
537+
/* need to drop DMB bit, as it's used as SPECIAL flag */
538+
depi 0,_PAGE_SPECIAL_BIT,1,\pte
539+
#endif
532540
zdep \spc,30,15,\prot
533541
dep \pte,8,7,\prot
534542
extru,= \pte,_PAGE_NO_CACHE_BIT,1,%r0

0 commit comments

Comments
 (0)