Merge tag 'for-5.19/parisc-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 4 Jun 2022 20:50:23 +0000 (13:50 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 4 Jun 2022 20:50:23 +0000 (13:50 -0700)
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

arch/parisc/include/asm/fb.h
arch/parisc/kernel/processor.c
arch/parisc/kernel/topology.c
drivers/video/console/sticon.c
drivers/video/console/sticore.c
drivers/video/fbdev/sticore.h
drivers/video/fbdev/stifb.c

index c4cd636..d63a2ac 100644 (file)
@@ -12,9 +12,13 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
        pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE;
 }
 
+#if defined(CONFIG_STI_CONSOLE) || defined(CONFIG_FB_STI)
+int fb_is_primary_device(struct fb_info *info);
+#else
 static inline int fb_is_primary_device(struct fb_info *info)
 {
        return 0;
 }
+#endif
 
 #endif /* _ASM_FB_H_ */
index 26eb568..dddaaa6 100644 (file)
@@ -327,8 +327,6 @@ int init_per_cpu(int cpunum)
        set_firmware_width();
        ret = pdc_coproc_cfg(&coproc_cfg);
 
-       store_cpu_topology(cpunum);
-
        if(ret >= 0 && coproc_cfg.ccr_functional) {
                mtctl(coproc_cfg.ccr_functional, 10);  /* 10 == Coprocessor Control Reg */
 
index 9696e3c..b9d845e 100644 (file)
@@ -20,8 +20,6 @@
 
 static DEFINE_PER_CPU(struct cpu, cpu_devices);
 
-static int dualcores_found;
-
 /*
  * store_cpu_topology is called at boot when only one cpu is running
  * and with the mutex cpu_hotplug.lock locked, when several cpus have booted,
@@ -60,7 +58,6 @@ void store_cpu_topology(unsigned int cpuid)
                        if (p->cpu_loc) {
                                cpuid_topo->core_id++;
                                cpuid_topo->package_id = cpu_topology[cpu].package_id;
-                               dualcores_found = 1;
                                continue;
                        }
                }
@@ -80,22 +77,11 @@ void store_cpu_topology(unsigned int cpuid)
                cpu_topology[cpuid].package_id);
 }
 
-static struct sched_domain_topology_level parisc_mc_topology[] = {
-#ifdef CONFIG_SCHED_MC
-       { cpu_coregroup_mask, cpu_core_flags, SD_INIT_NAME(MC) },
-#endif
-
-       { cpu_cpu_mask, SD_INIT_NAME(DIE) },
-       { NULL, },
-};
-
 /*
  * init_cpu_topology is called at boot when only one cpu is running
  * which prevent simultaneous write access to cpu_topology array
  */
 void __init init_cpu_topology(void)
 {
-       /* Set scheduler topology descriptor */
-       if (dualcores_found)
-               set_sched_topology(parisc_mc_topology);
+       reset_cpu_topology();
 }
index 40496e9..f304163 100644 (file)
@@ -46,6 +46,7 @@
 #include <linux/slab.h>
 #include <linux/font.h>
 #include <linux/crc32.h>
+#include <linux/fb.h>
 
 #include <asm/io.h>
 
@@ -392,7 +393,9 @@ static int __init sticonsole_init(void)
     for (i = 0; i < MAX_NR_CONSOLES; i++)
        font_data[i] = STI_DEF_FONT;
 
-    pr_info("sticon: Initializing STI text console.\n");
+    pr_info("sticon: Initializing STI text console on %s at [%s]\n",
+       sticon_sti->sti_data->inq_outptr.dev_name,
+       sticon_sti->pa_path);
     console_lock();
     err = do_take_over_console(&sti_con, 0, MAX_NR_CONSOLES - 1,
                PAGE0->mem_cons.cl_class != CL_DUPLEX);
index 837011b..fa23bf0 100644 (file)
 #include <asm/pdc.h>
 #include <asm/cacheflush.h>
 #include <asm/grfioctl.h>
+#include <asm/fb.h>
 
 #include "../fbdev/sticore.h"
 
-#define STI_DRIVERVERSION "Version 0.9b"
+#define STI_DRIVERVERSION "Version 0.9c"
 
 static struct sti_struct *default_sti __read_mostly;
 
@@ -502,7 +503,7 @@ sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name)
        if (!fbfont)
                return NULL;
 
-       pr_info("STI selected %ux%u framebuffer font %s for sticon\n",
+       pr_info("    using %ux%u framebuffer font %s\n",
                        fbfont->width, fbfont->height, fbfont->name);
                        
        bpc = ((fbfont->width+7)/8) * fbfont->height; 
@@ -967,6 +968,7 @@ out_err:
 
 static void sticore_check_for_default_sti(struct sti_struct *sti, char *path)
 {
+       pr_info("    located at [%s]\n", sti->pa_path);
        if (strcmp (path, default_sti_path) == 0)
                default_sti = sti;
 }
@@ -978,7 +980,6 @@ static void sticore_check_for_default_sti(struct sti_struct *sti, char *path)
  */
 static int __init sticore_pa_init(struct parisc_device *dev)
 {
-       char pa_path[21];
        struct sti_struct *sti = NULL;
        int hpa = dev->hpa.start;
 
@@ -991,8 +992,8 @@ static int __init sticore_pa_init(struct parisc_device *dev)
        if (!sti)
                return 1;
 
-       print_pa_hwpath(dev, pa_path);
-       sticore_check_for_default_sti(sti, pa_path);
+       print_pa_hwpath(dev, sti->pa_path);
+       sticore_check_for_default_sti(sti, sti->pa_path);
        return 0;
 }
 
@@ -1028,9 +1029,8 @@ static int sticore_pci_init(struct pci_dev *pd, const struct pci_device_id *ent)
 
        sti = sti_try_rom_generic(rom_base, fb_base, pd);
        if (sti) {
-               char pa_path[30];
-               print_pci_hwpath(pd, pa_path);
-               sticore_check_for_default_sti(sti, pa_path);
+               print_pci_hwpath(pd, sti->pa_path);
+               sticore_check_for_default_sti(sti, sti->pa_path);
        }
        
        if (!sti) {
@@ -1148,6 +1148,22 @@ int sti_call(const struct sti_struct *sti, unsigned long func,
        return ret;
 }
 
+/* check if given fb_info is the primary device */
+int fb_is_primary_device(struct fb_info *info)
+{
+       struct sti_struct *sti;
+
+       sti = sti_get_rom(0);
+
+       /* if no built-in graphics card found, allow any fb driver as default */
+       if (!sti)
+               return true;
+
+       /* return true if it's the default built-in framebuffer driver */
+       return (sti->info == info);
+}
+EXPORT_SYMBOL(fb_is_primary_device);
+
 MODULE_AUTHOR("Philipp Rumpf, Helge Deller, Thomas Bogendoerfer");
 MODULE_DESCRIPTION("Core STI driver for HP's NGLE series graphics cards in HP PARISC machines");
 MODULE_LICENSE("GPL v2");
index c338f78..0ebdd28 100644 (file)
@@ -370,6 +370,9 @@ struct sti_struct {
 
        /* pointer to all internal data */
        struct sti_all_data *sti_data;
+
+       /* pa_path of this device */
+       char pa_path[24];
 };
 
 
index bebb2ee..38a861e 100644 (file)
@@ -1358,11 +1358,11 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref)
                goto out_err3;
        }
 
+       /* save for primary gfx device detection & unregister_framebuffer() */
+       sti->info = info;
        if (register_framebuffer(&fb->info) < 0)
                goto out_err4;
 
-       sti->info = info; /* save for unregister_framebuffer() */
-
        fb_info(&fb->info, "%s %dx%d-%d frame buffer device, %s, id: %04x, mmio: 0x%04lx\n",
                fix->id,
                var->xres,