Skip to content

Commit 881bcab

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k
Pull m68k updates from Geert Uytterhoeven. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k: m68k: Setup CROSS_COMPILE at the top m68k: Correct the Atari ALLOWINT definition m68k/video: Create <asm/vga.h> m68k: Make sure {read,write}s[bwl]() are always defined m68k/mm: Port OOM changes to do_page_fault() scsi/atari: Make more functions static scsi/atari: Revive "atascsi=" setup option net/ariadne: Improve debug prints m68k/atari: Change VME irq numbers from unsigned long to unsigned int m68k/amiga: Use arch_initcall() for registering platform devices m68k/amiga: Add error checks when registering platform devices m68k/amiga: Mark z_dev_present() __init m68k: Remove unused MAX_NOINT_IPL definition
2 parents e60b9a0 + f25e918 commit 881bcab

14 files changed

Lines changed: 200 additions & 103 deletions

File tree

‎arch/m68k/Makefile‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616

1717
KBUILD_DEFCONFIG := multi_defconfig
1818

19+
ifneq ($(SUBARCH),$(ARCH))
20+
ifeq ($(CROSS_COMPILE),)
21+
CROSS_COMPILE := $(call cc-cross-prefix, \
22+
m68k-linux-gnu- m68k-linux- m68k-unknown-linux-gnu-)
23+
endif
24+
endif
25+
1926
#
2027
# Enable processor type. Ordering of these is important - we want to
2128
# use the minimum processor type of the range we support. The logic
@@ -62,12 +69,6 @@ endif
6269

6370
LDFLAGS := -m m68kelf
6471
KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/m68k/kernel/module.lds
65-
ifneq ($(SUBARCH),$(ARCH))
66-
ifeq ($(CROSS_COMPILE),)
67-
CROSS_COMPILE := $(call cc-cross-prefix, \
68-
m68k-linux-gnu- m68k-linux- m68k-unknown-linux-gnu-)
69-
endif
70-
endif
7172

7273
ifdef CONFIG_SUN3
7374
LDFLAGS_vmlinux = -N

‎arch/m68k/amiga/platform.c‎

Lines changed: 92 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* for more details.
77
*/
88

9+
#include <linux/err.h>
910
#include <linux/init.h>
1011
#include <linux/platform_device.h>
1112
#include <linux/zorro.h>
@@ -46,18 +47,25 @@ static const struct resource zorro_resources[] __initconst = {
4647

4748
static int __init amiga_init_bus(void)
4849
{
50+
struct platform_device *pdev;
51+
unsigned int n;
52+
4953
if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(ZORRO))
5054
return -ENODEV;
5155

52-
platform_device_register_simple("amiga-zorro", -1, zorro_resources,
53-
AMIGAHW_PRESENT(ZORRO3) ? 4 : 2);
56+
n = AMIGAHW_PRESENT(ZORRO3) ? 4 : 2;
57+
pdev = platform_device_register_simple("amiga-zorro", -1,
58+
zorro_resources, n);
59+
if (IS_ERR(pdev))
60+
return PTR_ERR(pdev);
61+
5462
return 0;
5563
}
5664

5765
subsys_initcall(amiga_init_bus);
5866

5967

60-
static int z_dev_present(zorro_id id)
68+
static int __init z_dev_present(zorro_id id)
6169
{
6270
unsigned int i;
6371

@@ -126,72 +134,122 @@ static const struct resource amiga_rtc_resource __initconst = {
126134
static int __init amiga_init_devices(void)
127135
{
128136
struct platform_device *pdev;
137+
int error;
129138

130139
if (!MACH_IS_AMIGA)
131140
return -ENODEV;
132141

133142
/* video hardware */
134-
if (AMIGAHW_PRESENT(AMI_VIDEO))
135-
platform_device_register_simple("amiga-video", -1, NULL, 0);
143+
if (AMIGAHW_PRESENT(AMI_VIDEO)) {
144+
pdev = platform_device_register_simple("amiga-video", -1, NULL,
145+
0);
146+
if (IS_ERR(pdev))
147+
return PTR_ERR(pdev);
148+
}
136149

137150

138151
/* sound hardware */
139-
if (AMIGAHW_PRESENT(AMI_AUDIO))
140-
platform_device_register_simple("amiga-audio", -1, NULL, 0);
152+
if (AMIGAHW_PRESENT(AMI_AUDIO)) {
153+
pdev = platform_device_register_simple("amiga-audio", -1, NULL,
154+
0);
155+
if (IS_ERR(pdev))
156+
return PTR_ERR(pdev);
157+
}
141158

142159

143160
/* storage interfaces */
144-
if (AMIGAHW_PRESENT(AMI_FLOPPY))
145-
platform_device_register_simple("amiga-floppy", -1, NULL, 0);
161+
if (AMIGAHW_PRESENT(AMI_FLOPPY)) {
162+
pdev = platform_device_register_simple("amiga-floppy", -1,
163+
NULL, 0);
164+
if (IS_ERR(pdev))
165+
return PTR_ERR(pdev);
166+
}
146167

147-
if (AMIGAHW_PRESENT(A3000_SCSI))
148-
platform_device_register_simple("amiga-a3000-scsi", -1,
149-
&a3000_scsi_resource, 1);
168+
if (AMIGAHW_PRESENT(A3000_SCSI)) {
169+
pdev = platform_device_register_simple("amiga-a3000-scsi", -1,
170+
&a3000_scsi_resource, 1);
171+
if (IS_ERR(pdev))
172+
return PTR_ERR(pdev);
173+
}
150174

151-
if (AMIGAHW_PRESENT(A4000_SCSI))
152-
platform_device_register_simple("amiga-a4000t-scsi", -1,
153-
&a4000t_scsi_resource, 1);
175+
if (AMIGAHW_PRESENT(A4000_SCSI)) {
176+
pdev = platform_device_register_simple("amiga-a4000t-scsi", -1,
177+
&a4000t_scsi_resource,
178+
1);
179+
if (IS_ERR(pdev))
180+
return PTR_ERR(pdev);
181+
}
154182

155183
if (AMIGAHW_PRESENT(A1200_IDE) ||
156184
z_dev_present(ZORRO_PROD_MTEC_VIPER_MK_V_E_MATRIX_530_SCSI_IDE)) {
157185
pdev = platform_device_register_simple("amiga-gayle-ide", -1,
158186
&a1200_ide_resource, 1);
159-
platform_device_add_data(pdev, &a1200_ide_pdata,
160-
sizeof(a1200_ide_pdata));
187+
if (IS_ERR(pdev))
188+
return PTR_ERR(pdev);
189+
error = platform_device_add_data(pdev, &a1200_ide_pdata,
190+
sizeof(a1200_ide_pdata));
191+
if (error)
192+
return error;
161193
}
162194

163195
if (AMIGAHW_PRESENT(A4000_IDE)) {
164196
pdev = platform_device_register_simple("amiga-gayle-ide", -1,
165197
&a4000_ide_resource, 1);
166-
platform_device_add_data(pdev, &a4000_ide_pdata,
167-
sizeof(a4000_ide_pdata));
198+
if (IS_ERR(pdev))
199+
return PTR_ERR(pdev);
200+
error = platform_device_add_data(pdev, &a4000_ide_pdata,
201+
sizeof(a4000_ide_pdata));
202+
if (error)
203+
return error;
168204
}
169205

170206

171207
/* other I/O hardware */
172-
if (AMIGAHW_PRESENT(AMI_KEYBOARD))
173-
platform_device_register_simple("amiga-keyboard", -1, NULL, 0);
208+
if (AMIGAHW_PRESENT(AMI_KEYBOARD)) {
209+
pdev = platform_device_register_simple("amiga-keyboard", -1,
210+
NULL, 0);
211+
if (IS_ERR(pdev))
212+
return PTR_ERR(pdev);
213+
}
174214

175-
if (AMIGAHW_PRESENT(AMI_MOUSE))
176-
platform_device_register_simple("amiga-mouse", -1, NULL, 0);
215+
if (AMIGAHW_PRESENT(AMI_MOUSE)) {
216+
pdev = platform_device_register_simple("amiga-mouse", -1, NULL,
217+
0);
218+
if (IS_ERR(pdev))
219+
return PTR_ERR(pdev);
220+
}
177221

178-
if (AMIGAHW_PRESENT(AMI_SERIAL))
179-
platform_device_register_simple("amiga-serial", -1, NULL, 0);
222+
if (AMIGAHW_PRESENT(AMI_SERIAL)) {
223+
pdev = platform_device_register_simple("amiga-serial", -1,
224+
NULL, 0);
225+
if (IS_ERR(pdev))
226+
return PTR_ERR(pdev);
227+
}
180228

181-
if (AMIGAHW_PRESENT(AMI_PARALLEL))
182-
platform_device_register_simple("amiga-parallel", -1, NULL, 0);
229+
if (AMIGAHW_PRESENT(AMI_PARALLEL)) {
230+
pdev = platform_device_register_simple("amiga-parallel", -1,
231+
NULL, 0);
232+
if (IS_ERR(pdev))
233+
return PTR_ERR(pdev);
234+
}
183235

184236

185237
/* real time clocks */
186-
if (AMIGAHW_PRESENT(A2000_CLK))
187-
platform_device_register_simple("rtc-msm6242", -1,
188-
&amiga_rtc_resource, 1);
238+
if (AMIGAHW_PRESENT(A2000_CLK)) {
239+
pdev = platform_device_register_simple("rtc-msm6242", -1,
240+
&amiga_rtc_resource, 1);
241+
if (IS_ERR(pdev))
242+
return PTR_ERR(pdev);
243+
}
189244

190-
if (AMIGAHW_PRESENT(A3000_CLK))
191-
platform_device_register_simple("rtc-rp5c01", -1,
192-
&amiga_rtc_resource, 1);
245+
if (AMIGAHW_PRESENT(A3000_CLK)) {
246+
pdev = platform_device_register_simple("rtc-rp5c01", -1,
247+
&amiga_rtc_resource, 1);
248+
if (IS_ERR(pdev))
249+
return PTR_ERR(pdev);
250+
}
193251

194252
return 0;
195253
}
196254

197-
device_initcall(amiga_init_devices);
255+
arch_initcall(amiga_init_devices);

‎arch/m68k/atari/ataints.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ void __init atari_init_IRQ(void)
206206
* hardware with a programmable int vector (probably a VME board).
207207
*/
208208

209-
unsigned long atari_register_vme_int(void)
209+
unsigned int atari_register_vme_int(void)
210210
{
211211
int i;
212212

@@ -223,7 +223,7 @@ unsigned long atari_register_vme_int(void)
223223
EXPORT_SYMBOL(atari_register_vme_int);
224224

225225

226-
void atari_unregister_vme_int(unsigned long irq)
226+
void atari_unregister_vme_int(unsigned int irq)
227227
{
228228
if (irq >= VME_SOURCE_BASE && irq < VME_SOURCE_BASE + VME_MAX_SOURCES) {
229229
irq -= VME_SOURCE_BASE;

‎arch/m68k/include/asm/atariints.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ static inline int atari_irq_pending( unsigned irq )
198198
return( get_mfp_bit( irq, MFP_PENDING ) );
199199
}
200200

201-
unsigned long atari_register_vme_int( void );
202-
void atari_unregister_vme_int( unsigned long );
201+
unsigned int atari_register_vme_int(void);
202+
void atari_unregister_vme_int(unsigned int);
203203

204204
#endif /* linux/atariints.h */

‎arch/m68k/include/asm/entry.h‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,11 @@
3333

3434
/* the following macro is used when enabling interrupts */
3535
#if defined(MACH_ATARI_ONLY)
36-
/* block out HSYNC on the atari */
37-
#define ALLOWINT (~0x400)
38-
#define MAX_NOINT_IPL 3
36+
/* block out HSYNC = ipl 2 on the atari */
37+
#define ALLOWINT (~0x500)
3938
#else
4039
/* portable version */
4140
#define ALLOWINT (~0x700)
42-
#define MAX_NOINT_IPL 0
4341
#endif /* machine compilation types */
4442

4543
#ifdef __ASSEMBLY__

‎arch/m68k/include/asm/io_mm.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,13 @@ static inline void isa_delay(void)
278278
#define readl(addr) in_le32(addr)
279279
#define writel(val,addr) out_le32((addr),(val))
280280

281+
#define readsb(port, buf, nr) raw_insb((port), (u8 *)(buf), (nr))
282+
#define readsw(port, buf, nr) raw_insw((port), (u16 *)(buf), (nr))
283+
#define readsl(port, buf, nr) raw_insl((port), (u32 *)(buf), (nr))
284+
#define writesb(port, buf, nr) raw_outsb((port), (u8 *)(buf), (nr))
285+
#define writesw(port, buf, nr) raw_outsw((port), (u16 *)(buf), (nr))
286+
#define writesl(port, buf, nr) raw_outsl((port), (u32 *)(buf), (nr))
287+
281288
#define mmiowb()
282289

283290
static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size)

‎arch/m68k/include/asm/vga.h‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#ifndef _ASM_M68K_VGA_H
2+
#define _ASM_M68K_VGA_H
3+
4+
#include <asm/raw_io.h>
5+
6+
/*
7+
* FIXME
8+
* Ugh, we don't have PCI space, so map readb() and friends to use raw I/O
9+
* accessors, which are identical to the z_*() Zorro bus accessors.
10+
* This should make cirrusfb work again on Amiga
11+
*/
12+
#undef inb_p
13+
#undef inw_p
14+
#undef outb_p
15+
#undef outw
16+
#undef readb
17+
#undef writeb
18+
#undef writew
19+
#define inb_p(port) 0
20+
#define inw_p(port) 0
21+
#define outb_p(port, val) do { } while (0)
22+
#define outw(port, val) do { } while (0)
23+
#define readb raw_inb
24+
#define writeb raw_outb
25+
#define writew raw_outw
26+
27+
#endif /* _ASM_M68K_VGA_H */

‎arch/m68k/mm/fault.c‎

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
7272
{
7373
struct mm_struct *mm = current->mm;
7474
struct vm_area_struct * vma;
75-
int write, fault;
75+
int fault;
76+
unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
7677

7778
#ifdef DEBUG
7879
printk ("do page fault:\nregs->sr=%#x, regs->pc=%#lx, address=%#lx, %ld, %p\n",
@@ -87,6 +88,7 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
8788
if (in_atomic() || !mm)
8889
goto no_context;
8990

91+
retry:
9092
down_read(&mm->mmap_sem);
9193

9294
vma = find_vma(mm, address);
@@ -117,14 +119,13 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
117119
#ifdef DEBUG
118120
printk("do_page_fault: good_area\n");
119121
#endif
120-
write = 0;
121122
switch (error_code & 3) {
122123
default: /* 3: write, present */
123124
/* fall through */
124125
case 2: /* write, not present */
125126
if (!(vma->vm_flags & VM_WRITE))
126127
goto acc_err;
127-
write++;
128+
flags |= FAULT_FLAG_WRITE;
128129
break;
129130
case 1: /* read, present */
130131
goto acc_err;
@@ -139,21 +140,46 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
139140
* the fault.
140141
*/
141142

142-
fault = handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0);
143+
fault = handle_mm_fault(mm, vma, address, flags);
143144
#ifdef DEBUG
144145
printk("handle_mm_fault returns %d\n",fault);
145146
#endif
147+
148+
if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
149+
return 0;
150+
146151
if (unlikely(fault & VM_FAULT_ERROR)) {
147152
if (fault & VM_FAULT_OOM)
148153
goto out_of_memory;
149154
else if (fault & VM_FAULT_SIGBUS)
150155
goto bus_err;
151156
BUG();
152157
}
153-
if (fault & VM_FAULT_MAJOR)
154-
current->maj_flt++;
155-
else
156-
current->min_flt++;
158+
159+
/*
160+
* Major/minor page fault accounting is only done on the
161+
* initial attempt. If we go through a retry, it is extremely
162+
* likely that the page will be found in page cache at that point.
163+
*/
164+
if (flags & FAULT_FLAG_ALLOW_RETRY) {
165+
if (fault & VM_FAULT_MAJOR)
166+
current->maj_flt++;
167+
else
168+
current->min_flt++;
169+
if (fault & VM_FAULT_RETRY) {
170+
/* Clear FAULT_FLAG_ALLOW_RETRY to avoid any risk
171+
* of starvation. */
172+
flags &= ~FAULT_FLAG_ALLOW_RETRY;
173+
174+
/*
175+
* No need to up_read(&mm->mmap_sem) as we would
176+
* have already released it in __lock_page_or_retry
177+
* in mm/filemap.c.
178+
*/
179+
180+
goto retry;
181+
}
182+
}
157183

158184
up_read(&mm->mmap_sem);
159185
return 0;

0 commit comments

Comments
 (0)