Unverified Commit e741d669 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!2656 coresight: trbe: Enable ACPI based devices

Merge Pull Request from: @ci-robot 
 
PR sync from: Junhao He <hejunhao3@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/3AFRFHFV4UBHACQZBDLSXOUBL47L4TOH/ 
This series enables detection of ACPI based TRBE devices via a stand alone
purpose built representative platform device. But as a pre-requisite this
changes coresight_platform_data structure assignment for the TRBE device.


Anshuman Khandual (4):
  arm_pmu: acpi: Refactor arm_spe_acpi_register_device()
  arm_pmu: acpi: Add a representative platform device for TRBE
  coresight: trbe: Add a representative coresight_platform_data for TRBE
  coresight: trbe: Enable ACPI based TRBE devices

Junhao He (3):
  Revert "coresight: trbe: Enable ACPI/Platform automatic module
    loading"
  Revert "arm64/trbe: Add initial MADT/SPE probing"
  Revert "coresight: Return the pointer of @pdata when not "fwnode""


-- 
2.33.0
 
https://gitee.com/openeuler/kernel/issues/I8BOB3 
 
Link:https://gitee.com/openeuler/kernel/pulls/2656

 

Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents 4dc56098 9e9bb3e3
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -7336,7 +7336,6 @@ CONFIG_ETM4X_IMPDEF_FEATURE=y
# CONFIG_CORESIGHT_CTI is not set
CONFIG_CORESIGHT_TRBE=m
CONFIG_ULTRASOC_SMB=m
CONFIG_ACPI_TRBE=y
# end of arm64 Debugging

#
+0 −1
Original line number Diff line number Diff line
@@ -54,7 +54,6 @@ obj-$(CONFIG_PCI) += pci.o
obj-$(CONFIG_ARMV8_DEPRECATED)		+= armv8_deprecated.o
obj-$(CONFIG_ACPI)			+= acpi.o
obj-$(CONFIG_ACPI_NUMA)			+= acpi_numa.o
obj-$(CONFIG_ACPI_TRBE)			+= acpi_trbe.o
obj-$(CONFIG_ARM64_ACPI_PARKING_PROTOCOL)	+= acpi_parking_protocol.o
obj-$(CONFIG_PARAVIRT)			+= paravirt.o paravirt-spinlocks.o
obj-$(CONFIG_PARAVIRT_SPINLOCKS)	+= paravirt.o paravirt-spinlocks.o

arch/arm64/kernel/acpi_trbe.c

deleted100644 → 0
+0 −81
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * ACPI probing code for ARM Trace Buffer Extension.
 *
 * Copyright (C) 2022 ARM Ltd.
 */

#include <linux/acpi.h>
#include <linux/coresight.h>
#include <linux/platform_device.h>
#include <linux/init.h>

static struct resource trbe_resources[] = {
	{
		/* irq */
		.flags          = IORESOURCE_IRQ,
	}
};

static struct platform_device trbe_dev = {
	.name = ARMV9_TRBE_PDEV_NAME,
	.id = -1,
	.resource = trbe_resources,
	.num_resources = ARRAY_SIZE(trbe_resources)
};

static void arm_trbe_acpi_register_device(void)
{
	int cpu, hetid, irq, ret;
	bool first = true;
	u16 gsi = 0;

	/*
	 * Sanity check all the GICC tables for the same interrupt number.
	 * For now, we only support homogeneous machines.
	 */
	for_each_possible_cpu(cpu) {
		struct acpi_madt_generic_interrupt *gicc;

		gicc = acpi_cpu_get_madt_gicc(cpu);
		if (gicc->header.length < ACPI_MADT_GICC_TRBE)
			return;

		if (first) {
			gsi = gicc->trbe_interrupt;
			if (!gsi)
				return;
			hetid = find_acpi_cpu_topology_hetero_id(cpu);
			first = false;
		} else if ((gsi != gicc->trbe_interrupt) ||
				(hetid != find_acpi_cpu_topology_hetero_id(cpu))) {
			pr_warn("ACPI: TRBE must be homogeneous\n");
			return;
		}
	}

	irq = acpi_register_gsi(NULL, gsi, ACPI_LEVEL_SENSITIVE,
			ACPI_ACTIVE_HIGH);
	if (irq < 0) {
		pr_warn("ACPI: TRBE Unable to register interrupt: %d\n", gsi);
		return;
	}

	trbe_resources[0].start = irq;
	ret = platform_device_register(&trbe_dev);
	if (ret < 0) {
		pr_warn("ACPI: TRBE: Unable to register device\n");
		acpi_unregister_gsi(gsi);
	}
}

static int arm_acpi_trbe_init(void)
{
	if (acpi_disabled)
		return 0;

	arm_trbe_acpi_register_device();

	return 0;
}
device_initcall(arm_acpi_trbe_init)
+0 −4
Original line number Diff line number Diff line
@@ -201,7 +201,3 @@ config ULTRASOC_SMB
         called ultrasoc-smb.

endif

config ACPI_TRBE
	depends on ARM64 && ACPI
	def_bool y
+3 −3
Original line number Diff line number Diff line
@@ -862,15 +862,15 @@ coresight_get_platform_data(struct device *dev)
	struct coresight_platform_data *pdata = NULL;
	struct fwnode_handle *fwnode = dev_fwnode(dev);

	if (IS_ERR_OR_NULL(fwnode))
		goto error;

	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
	if (!pdata) {
		ret = -ENOMEM;
		goto error;
	}

	if (IS_ERR_OR_NULL(fwnode))
		return pdata;

	if (is_of_node(fwnode))
		ret = of_get_coresight_platform_data(dev, pdata);
	else if (is_acpi_device_node(fwnode))
Loading