Skip to content

Commit

Permalink
Automatic merge of 'next' into merge (2024-02-15 23:53)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpe committed Feb 15, 2024
2 parents cd4470c + 14ce0db commit 35d5936
Show file tree
Hide file tree
Showing 12 changed files with 107 additions and 55 deletions.
2 changes: 1 addition & 1 deletion arch/powerpc/include/asm/ibmebus.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

struct platform_driver;

extern struct bus_type ibmebus_bus_type;
extern const struct bus_type ibmebus_bus_type;

int ibmebus_register_driver(struct platform_driver *drv);
void ibmebus_unregister_driver(struct platform_driver *drv);
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/include/asm/macio.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <linux/of.h>
#include <linux/platform_device.h>

extern struct bus_type macio_bus_type;
extern const struct bus_type macio_bus_type;

/* MacIO device driver is defined later */
struct macio_driver;
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/include/asm/mpic.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ struct mpic
#endif
};

extern struct bus_type mpic_subsys;
extern const struct bus_type mpic_subsys;

/*
* MPIC flags (passed to mpic_alloc)
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/include/asm/smp.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

extern int boot_cpuid;
extern int boot_cpu_hwid; /* PPC64 only */
extern int boot_core_hwid;
extern int spinning_secondaries;
extern u32 *cpu_to_phys_id;
extern bool coregroup_enabled;
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/include/asm/vio.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
*/
#define VIO_CMO_MIN_ENT 1562624

extern struct bus_type vio_bus_type;
extern const struct bus_type vio_bus_type;

struct iommu_table;

Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/include/asm/vmalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP

#define arch_vmap_pud_supported arch_vmap_pud_supported
static inline bool arch_vmap_pud_supported(pgprot_t prot)
static __always_inline bool arch_vmap_pud_supported(pgprot_t prot)
{
/* HPT does not cope with large pages in the vmalloc area */
return radix_enabled();
}

#define arch_vmap_pmd_supported arch_vmap_pmd_supported
static inline bool arch_vmap_pmd_supported(pgprot_t prot)
static __always_inline bool arch_vmap_pmd_supported(pgprot_t prot)
{
return radix_enabled();
}
Expand Down
22 changes: 20 additions & 2 deletions arch/powerpc/kernel/prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,13 +368,31 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
if (found < 0)
return 0;

DBG("boot cpu: logical %d physical %d\n", found,
be32_to_cpu(intserv[found_thread]));
boot_cpuid = found;

if (IS_ENABLED(CONFIG_PPC64))
boot_cpu_hwid = be32_to_cpu(intserv[found_thread]);

if (nr_cpu_ids % nthreads != 0) {
set_nr_cpu_ids(ALIGN(nr_cpu_ids, nthreads));
pr_warn("nr_cpu_ids was not a multiple of threads_per_core, adjusted to %d\n",
nr_cpu_ids);
}

if (boot_cpuid >= nr_cpu_ids) {
// Remember boot core for smp_setup_cpu_maps()
boot_core_hwid = be32_to_cpu(intserv[0]);

pr_warn("Boot CPU %d (core hwid %d) >= nr_cpu_ids, adjusted boot CPU to %d\n",
boot_cpuid, boot_core_hwid, found_thread);

// Adjust boot CPU to appear on logical core 0
boot_cpuid = found_thread;
}

DBG("boot cpu: logical %d physical %d\n", boot_cpuid,
be32_to_cpu(intserv[found_thread]));

/*
* PAPR defines "logical" PVR values for cpus that
* meet various levels of the architecture:
Expand Down
58 changes: 41 additions & 17 deletions arch/powerpc/kernel/setup-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ EXPORT_SYMBOL(machine_id);

int boot_cpuid = -1;
EXPORT_SYMBOL_GPL(boot_cpuid);
int __initdata boot_core_hwid = -1;

#ifdef CONFIG_PPC64
int boot_cpu_hwid = -1;
Expand Down Expand Up @@ -411,6 +412,25 @@ static void __init cpu_init_thread_core_maps(int tpc)

u32 *cpu_to_phys_id = NULL;

static int assign_threads(unsigned int cpu, unsigned int nthreads, bool present,
const __be32 *hw_ids)
{
for (int i = 0; i < nthreads && cpu < nr_cpu_ids; i++) {
__be32 hwid;

hwid = be32_to_cpu(hw_ids[i]);

DBG(" thread %d -> cpu %d (hard id %d)\n", i, cpu, hwid);

set_cpu_present(cpu, present);
set_cpu_possible(cpu, true);
cpu_to_phys_id[cpu] = hwid;
cpu++;
}

return cpu;
}

/**
* setup_cpu_maps - initialize the following cpu maps:
* cpu_possible_mask
Expand Down Expand Up @@ -446,7 +466,7 @@ void __init smp_setup_cpu_maps(void)
for_each_node_by_type(dn, "cpu") {
const __be32 *intserv;
__be32 cpu_be;
int j, len;
int len;

DBG(" * %pOF...\n", dn);

Expand All @@ -468,27 +488,31 @@ void __init smp_setup_cpu_maps(void)

nthreads = len / sizeof(int);

for (j = 0; j < nthreads && cpu < nr_cpu_ids; j++) {
bool avail;
bool avail = of_device_is_available(dn);
if (!avail)
avail = !of_property_match_string(dn,
"enable-method", "spin-table");

DBG(" thread %d -> cpu %d (hard id %d)\n",
j, cpu, be32_to_cpu(intserv[j]));

avail = of_device_is_available(dn);
if (!avail)
avail = !of_property_match_string(dn,
"enable-method", "spin-table");

set_cpu_present(cpu, avail);
set_cpu_possible(cpu, true);
cpu_to_phys_id[cpu] = be32_to_cpu(intserv[j]);
cpu++;
}
if (boot_core_hwid >= 0) {
if (cpu == 0) {
pr_info("Skipping CPU node %pOF to allow for boot core.\n", dn);
cpu = nthreads;
continue;
}

if (cpu >= nr_cpu_ids) {
if (be32_to_cpu(intserv[0]) == boot_core_hwid) {
pr_info("Renumbered boot core %pOF to logical 0\n", dn);
assign_threads(0, nthreads, avail, intserv);
of_node_put(dn);
break;
}
} else if (cpu >= nr_cpu_ids) {
of_node_put(dn);
break;
}

if (cpu < nr_cpu_ids)
cpu = assign_threads(cpu, nthreads, avail, intserv);
}

/* If no SMT supported, nthreads is forced to 1 */
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/platforms/pseries/ibmebus.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static struct device ibmebus_bus_device = { /* fake "parent" device */
.init_name = "ibmebus",
};

struct bus_type ibmebus_bus_type;
const struct bus_type ibmebus_bus_type;

/* These devices will automatically be added to the bus during init */
static const struct of_device_id ibmebus_matches[] __initconst = {
Expand Down Expand Up @@ -432,7 +432,7 @@ static int ibmebus_bus_modalias(const struct device *dev, struct kobj_uevent_env
return of_device_uevent_modalias(dev, env);
}

struct bus_type ibmebus_bus_type = {
const struct bus_type ibmebus_bus_type = {
.name = "ibmebus",
.uevent = ibmebus_bus_modalias,
.bus_groups = ibmbus_bus_groups,
Expand Down
61 changes: 35 additions & 26 deletions arch/powerpc/platforms/pseries/vio.c
Original file line number Diff line number Diff line change
Expand Up @@ -991,18 +991,6 @@ static DEVICE_ATTR_RO(cmo_allocated);
static DEVICE_ATTR_RW(cmo_desired);
static DEVICE_ATTR_RW(cmo_allocs_failed);

static struct attribute *vio_cmo_dev_attrs[] = {
&dev_attr_name.attr,
&dev_attr_devspec.attr,
&dev_attr_modalias.attr,
&dev_attr_cmo_entitled.attr,
&dev_attr_cmo_allocated.attr,
&dev_attr_cmo_desired.attr,
&dev_attr_cmo_allocs_failed.attr,
NULL,
};
ATTRIBUTE_GROUPS(vio_cmo_dev);

/* sysfs bus functions and data structures for CMO */

#define viobus_cmo_rd_attr(name) \
Expand Down Expand Up @@ -1062,11 +1050,7 @@ static struct attribute *vio_bus_attrs[] = {
};
ATTRIBUTE_GROUPS(vio_bus);

static void __init vio_cmo_sysfs_init(void)
{
vio_bus_type.dev_groups = vio_cmo_dev_groups;
vio_bus_type.bus_groups = vio_bus_groups;
}
static void __init vio_cmo_sysfs_init(void) { }
#else /* CONFIG_PPC_SMLPAR */
int vio_cmo_entitlement_update(size_t new_entitlement) { return 0; }
void vio_cmo_set_dev_desired(struct vio_dev *viodev, size_t desired) {}
Expand Down Expand Up @@ -1584,14 +1568,6 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
}
static DEVICE_ATTR_RO(modalias);

static struct attribute *vio_dev_attrs[] = {
&dev_attr_name.attr,
&dev_attr_devspec.attr,
&dev_attr_modalias.attr,
NULL,
};
ATTRIBUTE_GROUPS(vio_dev);

void vio_unregister_device(struct vio_dev *viodev)
{
device_unregister(&viodev->dev);
Expand Down Expand Up @@ -1626,7 +1602,39 @@ static int vio_hotplug(const struct device *dev, struct kobj_uevent_env *env)
return 0;
}

struct bus_type vio_bus_type = {
#ifdef CONFIG_PPC_SMLPAR
static struct attribute *vio_cmo_dev_attrs[] = {
&dev_attr_name.attr,
&dev_attr_devspec.attr,
&dev_attr_modalias.attr,
&dev_attr_cmo_entitled.attr,
&dev_attr_cmo_allocated.attr,
&dev_attr_cmo_desired.attr,
&dev_attr_cmo_allocs_failed.attr,
NULL,
};
ATTRIBUTE_GROUPS(vio_cmo_dev);

const struct bus_type vio_bus_type = {
.name = "vio",
.dev_groups = vio_cmo_dev_groups,
.bus_groups = vio_bus_groups,
.uevent = vio_hotplug,
.match = vio_bus_match,
.probe = vio_bus_probe,
.remove = vio_bus_remove,
.shutdown = vio_bus_shutdown,
};
#else /* CONFIG_PPC_SMLPAR */
static struct attribute *vio_dev_attrs[] = {
&dev_attr_name.attr,
&dev_attr_devspec.attr,
&dev_attr_modalias.attr,
NULL,
};
ATTRIBUTE_GROUPS(vio_dev);

const struct bus_type vio_bus_type = {
.name = "vio",
.dev_groups = vio_dev_groups,
.uevent = vio_hotplug,
Expand All @@ -1635,6 +1643,7 @@ struct bus_type vio_bus_type = {
.remove = vio_bus_remove,
.shutdown = vio_bus_shutdown,
};
#endif /* CONFIG_PPC_SMLPAR */

/**
* vio_get_attribute: - get attribute for virtual device
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/sysdev/mpic.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#define DBG(fmt...)
#endif

struct bus_type mpic_subsys = {
const struct bus_type mpic_subsys = {
.name = "mpic",
.dev_name = "mpic",
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/macintosh/macio_asic.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ static int macio_device_modalias(const struct device *dev, struct kobj_uevent_en

extern const struct attribute_group *macio_dev_groups[];

struct bus_type macio_bus_type = {
const struct bus_type macio_bus_type = {
.name = "macio",
.match = macio_bus_match,
.uevent = macio_device_modalias,
Expand Down

0 comments on commit 35d5936

Please sign in to comment.