Pull more parisc architecture updates from Helge Deller: "A fix to prevent crash at bootup if CONFIG_SCHED_MC is enabled, and add auto-detection of primary graphics card for framebuffer driver" * tag 'for-5.19/parisc-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux: parisc/stifb: Keep track of hardware path of graphics card parisc/stifb: Implement fb_is_primary_device() parisc: fix a crash with multicore scheduler
Unified · Split
| @@ -12,9 +12,13 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma, · 11 unmodified lines | |||
| 12 | pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE; | 12 | pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE; |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | #if defined(CONFIG_STI_CONSOLE) || defined(CONFIG_FB_STI) | ||
| 16 | int fb_is_primary_device(struct fb_info *info); | ||
| 17 | #else | ||
| 15 | static inline int fb_is_primary_device(struct fb_info *info) | 18 | static inline int fb_is_primary_device(struct fb_info *info) |
| 16 | { | 19 | { |
| 17 | return 0; | 20 | return 0; |
| 18 | } | 21 | } |
| 22 | #endif | ||
| 19 | 23 | ||
| 20 | #endif /* _ASM_FB_H_ */ | 24 | #endif /* _ASM_FB_H_ */ |
| @@ -327,8 +327,6 @@ int init_per_cpu(int cpunum) · 326 unmodified lines | |||
| 327 | set_firmware_width(); | 327 | set_firmware_width(); |
| 328 | ret = pdc_coproc_cfg(&coproc_cfg); | 328 | ret = pdc_coproc_cfg(&coproc_cfg); |
| 329 | 329 | ||
| 330 | store_cpu_topology(cpunum); | ||
| 331 | |||
| 332 | if(ret >= 0 && coproc_cfg.ccr_functional) { | 330 | if(ret >= 0 && coproc_cfg.ccr_functional) { |
| 333 | mtctl(coproc_cfg.ccr_functional, 10); /* 10 == Coprocessor Control Reg */ | 331 | mtctl(coproc_cfg.ccr_functional, 10); /* 10 == Coprocessor Control Reg */ |
| 334 | 332 | ||
| @@ -20,8 +20,6 @@ · 19 unmodified lines | |||
| 20 | 20 | ||
| 21 | static DEFINE_PER_CPU(struct cpu, cpu_devices); | 21 | static DEFINE_PER_CPU(struct cpu, cpu_devices); |
| 22 | 22 | ||
| 23 | static int dualcores_found; | ||
| 24 | |||
| 25 | /* | 23 | /* |
| 26 | * store_cpu_topology is called at boot when only one cpu is running | 24 | * store_cpu_topology is called at boot when only one cpu is running |
| 27 | * and with the mutex cpu_hotplug.lock locked, when several cpus have booted, | 25 | * and with the mutex cpu_hotplug.lock locked, when several cpus have booted, |
| @@ -60,7 +58,6 @@ void store_cpu_topology(unsigned int cpuid) · 32 unmodified lines | |||
| 60 | if (p->cpu_loc) { | 58 | if (p->cpu_loc) { |
| 61 | cpuid_topo->core_id++; | 59 | cpuid_topo->core_id++; |
| 62 | cpuid_topo->package_id = cpu_topology[cpu].package_id; | 60 | cpuid_topo->package_id = cpu_topology[cpu].package_id; |
| 63 | dualcores_found = 1; | ||
| 64 | continue; | 61 | continue; |
| 65 | } | 62 | } |
| 66 | } | 63 | } |
| @@ -80,22 +77,11 @@ void store_cpu_topology(unsigned int cpuid) · 13 unmodified lines | |||
| 80 | cpu_topology[cpuid].package_id); | 77 | cpu_topology[cpuid].package_id); |
| 81 | } | 78 | } |
| 82 | 79 | ||
| 83 | static struct sched_domain_topology_level parisc_mc_topology[] = { | ||
| 84 | #ifdef CONFIG_SCHED_MC | ||
| 85 | { cpu_coregroup_mask, cpu_core_flags, SD_INIT_NAME(MC) }, | ||
| 86 | #endif | ||
| 87 | |||
| 88 | { cpu_cpu_mask, SD_INIT_NAME(DIE) }, | ||
| 89 | { NULL, }, | ||
| 90 | }; | ||
| 91 | |||
| 92 | /* | 80 | /* |
| 93 | * init_cpu_topology is called at boot when only one cpu is running | 81 | * init_cpu_topology is called at boot when only one cpu is running |
| 94 | * which prevent simultaneous write access to cpu_topology array | 82 | * which prevent simultaneous write access to cpu_topology array |
| 95 | */ | 83 | */ |
| 96 | void __init init_cpu_topology(void) | 84 | void __init init_cpu_topology(void) |
| 97 | { | 85 | { |
| 98 | /* Set scheduler topology descriptor */ | 86 | reset_cpu_topology(); |
| 99 | if (dualcores_found) | ||
| 100 | set_sched_topology(parisc_mc_topology); | ||
| 101 | } | 87 | } |
| @@ -46,6 +46,7 @@ · 45 unmodified lines | |||
| 46 | #include <linux/slab.h> | 46 | #include <linux/slab.h> |
| 47 | #include <linux/font.h> | 47 | #include <linux/font.h> |
| 48 | #include <linux/crc32.h> | 48 | #include <linux/crc32.h> |
| 49 | #include <linux/fb.h> | ||
| 49 | 50 | ||
| 50 | #include <asm/io.h> | 51 | #include <asm/io.h> |
| 51 | 52 | ||
| @@ -392,7 +393,9 @@ static int __init sticonsole_init(void) · 340 unmodified lines | |||
| 392 | for (i = 0; i < MAX_NR_CONSOLES; i++) | 393 | for (i = 0; i < MAX_NR_CONSOLES; i++) |
| 393 | font_data[i] = STI_DEF_FONT; | 394 | font_data[i] = STI_DEF_FONT; |
| 394 | 395 | ||
| 395 | pr_info("sticon: Initializing STI text console.\n"); | 396 | pr_info("sticon: Initializing STI text console on %s at [%s]\n", |
| 397 | sticon_sti->sti_data->inq_outptr.dev_name, | ||
| 398 | sticon_sti->pa_path); | ||
| 396 | console_lock(); | 399 | console_lock(); |
| 397 | err = do_take_over_console(&sti_con, 0, MAX_NR_CONSOLES - 1, | 400 | err = do_take_over_console(&sti_con, 0, MAX_NR_CONSOLES - 1, |
| 398 | PAGE0->mem_cons.cl_class != CL_DUPLEX); | 401 | PAGE0->mem_cons.cl_class != CL_DUPLEX); |
| @@ -30,10 +30,11 @@ · 29 unmodified lines | |||
| 30 | #include <asm/pdc.h> | 30 | #include <asm/pdc.h> |
| 31 | #include <asm/cacheflush.h> | 31 | #include <asm/cacheflush.h> |
| 32 | #include <asm/grfioctl.h> | 32 | #include <asm/grfioctl.h> |
| 33 | #include <asm/fb.h> | ||
| 33 | 34 | ||
| 34 | #include "../fbdev/sticore.h" | 35 | #include "../fbdev/sticore.h" |
| 35 | 36 | ||
| 36 | #define STI_DRIVERVERSION "Version 0.9b" | 37 | #define STI_DRIVERVERSION "Version 0.9c" |
| 37 | 38 | ||
| 38 | static struct sti_struct *default_sti __read_mostly; | 39 | static struct sti_struct *default_sti __read_mostly; |
| 39 | 40 | ||
| @@ -502,7 +503,7 @@ sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name) · 462 unmodified lines | |||
| 502 | if (!fbfont) | 503 | if (!fbfont) |
| 503 | return NULL; | 504 | return NULL; |
| 504 | 505 | ||
| 505 | pr_info("STI selected %ux%u framebuffer font %s for sticon\n", | 506 | pr_info(" using %ux%u framebuffer font %s\n", |
| 506 | fbfont->width, fbfont->height, fbfont->name); | 507 | fbfont->width, fbfont->height, fbfont->name); |
| 507 | 508 | ||
| 508 | bpc = ((fbfont->width+7)/8) * fbfont->height; | 509 | bpc = ((fbfont->width+7)/8) * fbfont->height; |
| @@ -967,6 +968,7 @@ out_err: · 458 unmodified lines | |||
| 967 | 968 | ||
| 968 | static void sticore_check_for_default_sti(struct sti_struct *sti, char *path) | 969 | static void sticore_check_for_default_sti(struct sti_struct *sti, char *path) |
| 969 | { | 970 | { |
| 971 | pr_info(" located at [%s]\n", sti->pa_path); | ||
| 970 | if (strcmp (path, default_sti_path) == 0) | 972 | if (strcmp (path, default_sti_path) == 0) |
| 971 | default_sti = sti; | 973 | default_sti = sti; |
| 972 | } | 974 | } |
| @@ -978,7 +980,6 @@ static void sticore_check_for_default_sti(struct sti_struct *sti, char *path) · 5 unmodified lines | |||
| 978 | */ | 980 | */ |
| 979 | static int __init sticore_pa_init(struct parisc_device *dev) | 981 | static int __init sticore_pa_init(struct parisc_device *dev) |
| 980 | { | 982 | { |
| 981 | char pa_path[21]; | ||
| 982 | struct sti_struct *sti = NULL; | 983 | struct sti_struct *sti = NULL; |
| 983 | int hpa = dev->hpa.start; | 984 | int hpa = dev->hpa.start; |
| 984 | 985 | ||
| @@ -991,8 +992,8 @@ static int __init sticore_pa_init(struct parisc_device *dev) · 6 unmodified lines | |||
| 991 | if (!sti) | 992 | if (!sti) |
| 992 | return 1; | 993 | return 1; |
| 993 | 994 | ||
| 994 | print_pa_hwpath(dev, pa_path); | 995 | print_pa_hwpath(dev, sti->pa_path); |
| 995 | sticore_check_for_default_sti(sti, pa_path); | 996 | sticore_check_for_default_sti(sti, sti->pa_path); |
| 996 | return 0; | 997 | return 0; |
| 997 | } | 998 | } |
| 998 | 999 | ||
| @@ -1028,9 +1029,8 @@ static int sticore_pci_init(struct pci_dev *pd, const struct pci_device_id *ent) · 29 unmodified lines | |||
| 1028 | 1029 | ||
| 1029 | sti = sti_try_rom_generic(rom_base, fb_base, pd); | 1030 | sti = sti_try_rom_generic(rom_base, fb_base, pd); |
| 1030 | if (sti) { | 1031 | if (sti) { |
| 1031 | char pa_path[30]; | 1032 | print_pci_hwpath(pd, sti->pa_path); |
| 1032 | print_pci_hwpath(pd, pa_path); | 1033 | sticore_check_for_default_sti(sti, sti->pa_path); |
| 1033 | sticore_check_for_default_sti(sti, pa_path); | ||
| 1034 | } | 1034 | } |
| 1035 | 1035 | ||
| 1036 | if (!sti) { | 1036 | if (!sti) { |
| @@ -1148,6 +1148,22 @@ int sti_call(const struct sti_struct *sti, unsigned long func, · 111 unmodified lines | |||
| 1148 | return ret; | 1148 | return ret; |
| 1149 | } | 1149 | } |
| 1150 | 1150 | ||
| 1151 | /* check if given fb_info is the primary device */ | ||
| 1152 | int fb_is_primary_device(struct fb_info *info) | ||
| 1153 | { | ||
| 1154 | struct sti_struct *sti; | ||
| 1155 | |||
| 1156 | sti = sti_get_rom(0); | ||
| 1157 | |||
| 1158 | /* if no built-in graphics card found, allow any fb driver as default */ | ||
| 1159 | if (!sti) | ||
| 1160 | return true; | ||
| 1161 | |||
| 1162 | /* return true if it's the default built-in framebuffer driver */ | ||
| 1163 | return (sti->info == info); | ||
| 1164 | } | ||
| 1165 | EXPORT_SYMBOL(fb_is_primary_device); | ||
| 1166 | |||
| 1151 | MODULE_AUTHOR("Philipp Rumpf, Helge Deller, Thomas Bogendoerfer"); | 1167 | MODULE_AUTHOR("Philipp Rumpf, Helge Deller, Thomas Bogendoerfer"); |
| 1152 | MODULE_DESCRIPTION("Core STI driver for HP's NGLE series graphics cards in HP PARISC machines"); | 1168 | MODULE_DESCRIPTION("Core STI driver for HP's NGLE series graphics cards in HP PARISC machines"); |
| 1153 | MODULE_LICENSE("GPL v2"); | 1169 | MODULE_LICENSE("GPL v2"); |
| @@ -370,6 +370,9 @@ struct sti_struct { · 369 unmodified lines | |||
| 370 | 370 | ||
| 371 | /* pointer to all internal data */ | 371 | /* pointer to all internal data */ |
| 372 | struct sti_all_data *sti_data; | 372 | struct sti_all_data *sti_data; |
| 373 | |||
| 374 | /* pa_path of this device */ | ||
| 375 | char pa_path[24]; | ||
| 373 | }; | 376 | }; |
| 374 | 377 | ||
| 375 | 378 | ||
| @@ -1358,11 +1358,11 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref) · 1357 unmodified lines | |||
| 1358 | goto out_err3; | 1358 | goto out_err3; |
| 1359 | } | 1359 | } |
| 1360 | 1360 | ||
| 1361 | /* save for primary gfx device detection & unregister_framebuffer() */ | ||
| 1362 | sti->info = info; | ||
| 1361 | if (register_framebuffer(&fb->info) < 0) | 1363 | if (register_framebuffer(&fb->info) < 0) |
| 1362 | goto out_err4; | 1364 | goto out_err4; |
| 1363 | 1365 | ||
| 1364 | sti->info = info; /* save for unregister_framebuffer() */ | ||
| 1365 | |||
| 1366 | fb_info(&fb->info, "%s %dx%d-%d frame buffer device, %s, id: %04x, mmio: 0x%04lx\n", | 1366 | fb_info(&fb->info, "%s %dx%d-%d frame buffer device, %s, id: %04x, mmio: 0x%04lx\n", |
| 1367 | fix->id, | 1367 | fix->id, |
| 1368 | var->xres, | 1368 | var->xres, |