Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1442727 > unrolled thread

[PATCH v7 0/9] acpi, clocksource: add GTDT driver and GTDT support in arm_arch_timer

Started byfu.wei@linaro.org
First post2016-07-13 20:00 +0200
Last post2016-07-13 20:00 +0200
Articles 8 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v7 0/9] acpi, clocksource: add GTDT driver and GTDT support in arm_arch_timer fu.wei@linaro.org - 2016-07-13 20:00 +0200
    [PATCH v7 9/9] acpi/arm64: Add SBSA Generic Watchdog support in GTDT driver fu.wei@linaro.org - 2016-07-13 20:00 +0200
    [PATCH v7 8/9] clocksource/drivers/arm_arch_timer: Add GTDT support for memory-mapped timer fu.wei@linaro.org - 2016-07-13 20:00 +0200
    [PATCH v7 5/9] MAINTAINERS / ACPI: add the ARM64-specific ACPI Support maintainers fu.wei@linaro.org - 2016-07-13 20:00 +0200
      Re: [PATCH v7 5/9] MAINTAINERS / ACPI: add the ARM64-specific ACPI  Support maintainers "Rafael J. Wysocki" <rafael@kernel.org> - 2016-07-13 22:20 +0200
        Re: [PATCH v7 5/9] MAINTAINERS / ACPI: add the ARM64-specific ACPI  Support maintainers Fu Wei <fu.wei@linaro.org> - 2016-07-15 03:10 +0200
    [PATCH v7 1/9] clocksource/drivers/arm_arch_timer: Move enums and defines to header file fu.wei@linaro.org - 2016-07-13 20:00 +0200
    [PATCH v7 6/9] clocksource/drivers/arm_arch_timer: Simplify ACPI support code. fu.wei@linaro.org - 2016-07-13 20:00 +0200

#1442727 — [PATCH v7 0/9] acpi, clocksource: add GTDT driver and GTDT support in arm_arch_timer

Fromfu.wei@linaro.org
Date2016-07-13 20:00 +0200
Subject[PATCH v7 0/9] acpi, clocksource: add GTDT driver and GTDT support in arm_arch_timer
Message-ID<rUwBX-6kl-3@gated-at.bofh.it>
From: Fu Wei <fu.wei@linaro.org>

This patchset:
    (1)Preparation for adding GTDT support in arm_arch_timer
        1. Move some enums and marcos to header file
        2. Add a new enum for spi type.
        3. Improve printk relevant code

    (2)Introduce ACPI GTDT parser: drivers/acpi/gtdt.c
    Parse all kinds of timer in GTDT table of ACPI:arch timer,
    memory-mapped timer and SBSA Generic Watchdog timer.
    This driver can help to simplify all the relevant timer drivers,
    and separate all the ACPI GTDT knowledge from them.
    Also add add the ARM64-specific ACPI Support maintainers in MAINTAINERS.

    (3)Simplify ACPI code for arm_arch_timer

    (4)Add GTDT support for ARM memory-mapped timer

This patchset has been tested on the following platforms:
    (1)ARM Foundation v8 model

Changelog:
v7: Move the GTDT driver to drivers/acpi/arm64
    Add add the ARM64-specific ACPI Support maintainers in MAINTAINERS
    Merge 3 patches of GTDT parser driver.
    Fix the for_each_platform_timer bug.

v6: https://lkml.org/lkml/2016/6/29/580
    split the GTDT driver to 4 parts: basic, arch_timer, memory-mapped timer,
    and SBSA Generic Watchdog timer
    Improve driver by suggestions and example code from Daniel Lezcano

v5: https://lkml.org/lkml/2016/5/24/356
    Sorting out all patches, simplify the API of GTDT driver:
    GTDT driver just fills the data struct for arm_arch_timer driver.

v4: https://lists.linaro.org/pipermail/linaro-acpi/2016-March/006667.html
    Delete the kvm relevant patches
    Separate two patches for sorting out the code for arm_arch_timer.
    Improve irq info export code to allow missing irq info in GTDT table.

v3: https://lkml.org/lkml/2016/2/1/658
    Improve GTDT driver code:
      (1)improve pr_* by defining pr_fmt(fmt)
      (2)simplify gtdt_sbsa_gwdt_init
      (3)improve gtdt_arch_timer_data_init, if table is NULL, it will try
      to get GTDT table.
    Move enum ppi_nr to arm_arch_timer.h, and add enum spi_nr.
    Add arm_arch_timer get ppi from DT and GTDT support for kvm.

v2: https://lkml.org/lkml/2015/12/2/10
    Rebase to latest kernel version(4.4-rc3).
    Fix the bug about the config problem,
    use CONFIG_ACPI_GTDT instead of CONFIG_ACPI in arm_arch_timer.c

v1: The first upstreaming version: https://lkml.org/lkml/2015/10/28/553

Fu Wei (9):
  clocksource/drivers/arm_arch_timer: Move enums and defines to header
    file
  clocksource/drivers/arm_arch_timer: Add a new enum for spi type
  clocksource/drivers/arm_arch_timer: Improve printk relevant code
  acpi/arm64: Add GTDT table parse driver
  MAINTAINERS / ACPI: add the ARM64-specific ACPI Support maintainers
  clocksource/drivers/arm_arch_timer: Simplify ACPI support code.
  acpi/arm64: Add memory-mapped timer support in GTDT driver
  clocksource/drivers/arm_arch_timer: Add GTDT support for memory-mapped
    timer
  acpi/arm64: Add SBSA Generic Watchdog support in GTDT driver

 MAINTAINERS                          |   8 +
 drivers/acpi/Kconfig                 |   5 +
 drivers/acpi/Makefile                |   1 +
 drivers/acpi/arm64/Kconfig           |  15 ++
 drivers/acpi/arm64/Makefile          |   1 +
 drivers/acpi/arm64/acpi_gtdt.c       | 343 +++++++++++++++++++++++++++++++++++
 drivers/clocksource/Kconfig          |   1 +
 drivers/clocksource/arm_arch_timer.c | 228 ++++++++++++++++-------
 drivers/watchdog/Kconfig             |   1 +
 include/clocksource/arm_arch_timer.h |  32 ++++
 include/linux/acpi.h                 |   7 +
 11 files changed, 575 insertions(+), 67 deletions(-)
 create mode 100644 drivers/acpi/arm64/Kconfig
 create mode 100644 drivers/acpi/arm64/Makefile
 create mode 100644 drivers/acpi/arm64/acpi_gtdt.c

-- 
2.5.5

[toc] | [next] | [standalone]


#1442728 — [PATCH v7 9/9] acpi/arm64: Add SBSA Generic Watchdog support in GTDT driver

Fromfu.wei@linaro.org
Date2016-07-13 20:00 +0200
Subject[PATCH v7 9/9] acpi/arm64: Add SBSA Generic Watchdog support in GTDT driver
Message-ID<rUwBY-6kl-19@gated-at.bofh.it>
In reply to#1442727
From: Fu Wei <fu.wei@linaro.org>

This driver adds support for parsing SBSA Generic Watchdog timer
in GTDT, parse all info in SBSA Generic Watchdog Structure in GTDT,
and creating a platform device with that information.

This allows the operating system to obtain device data from the
resource of platform device. The platform device named "sbsa-gwdt"
can be used by the ARM SBSA Generic Watchdog driver.

Signed-off-by: Fu Wei <fu.wei@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 drivers/acpi/arm64/acpi_gtdt.c | 83 ++++++++++++++++++++++++++++++++++++++++++
 drivers/watchdog/Kconfig       |  1 +
 2 files changed, 84 insertions(+)

diff --git a/drivers/acpi/arm64/acpi_gtdt.c b/drivers/acpi/arm64/acpi_gtdt.c
index ff62953..eb3edac 100644
--- a/drivers/acpi/arm64/acpi_gtdt.c
+++ b/drivers/acpi/arm64/acpi_gtdt.c
@@ -15,6 +15,7 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/platform_device.h>
 
 #include <clocksource/arm_arch_timer.h>
 
@@ -258,3 +259,85 @@ int __init gtdt_arch_timer_mem_init(struct gt_block_data *data)
 
 	return index;
 }
+
+/*
+ * Initialize a SBSA generic Watchdog platform device info from GTDT
+ */
+static int __init gtdt_import_sbsa_gwdt(void *platform_timer, int index)
+{
+	struct platform_device *pdev;
+	struct acpi_gtdt_watchdog *wd = platform_timer;
+	int irq = map_generic_timer_interrupt(wd->timer_interrupt,
+					      wd->timer_flags);
+	int no_irq = 1;
+
+	/*
+	 * According to SBSA specification the size of refresh and control
+	 * frames of SBSA Generic Watchdog is SZ_4K(Offset 0x000 – 0xFFF).
+	 */
+	struct resource res[] = {
+		DEFINE_RES_MEM(wd->control_frame_address, SZ_4K),
+		DEFINE_RES_MEM(wd->refresh_frame_address, SZ_4K),
+		DEFINE_RES_IRQ(irq),
+	};
+
+	pr_debug("a Watchdog GT(0x%llx/0x%llx gsi:%u flags:0x%x).\n",
+		 wd->refresh_frame_address, wd->control_frame_address,
+		 wd->timer_interrupt, wd->timer_flags);
+
+	if (!(wd->refresh_frame_address && wd->control_frame_address)) {
+		pr_err(FW_BUG "failed getting the Watchdog GT frame addr.\n");
+		return -EINVAL;
+	}
+
+	if (!wd->timer_interrupt)
+		pr_warn(FW_BUG "failed getting the Watchdog GT GSIV.\n");
+	else if (irq <= 0)
+		pr_warn("failed to map the Watchdog GT GSIV.\n");
+	else
+		no_irq = 0;
+
+	/*
+	 * Add a platform device named "sbsa-gwdt" to match the platform driver.
+	 * "sbsa-gwdt": SBSA(Server Base System Architecture) Generic Watchdog
+	 * The platform driver (like drivers/watchdog/sbsa_gwdt.c)can get device
+	 * info below by matching this name.
+	 */
+	pdev = platform_device_register_simple("sbsa-gwdt", index, res,
+					       ARRAY_SIZE(res) - no_irq);
+	if (IS_ERR(pdev)) {
+		acpi_unregister_gsi(wd->timer_interrupt);
+		return PTR_ERR(pdev);
+	}
+
+	return 0;
+}
+
+static int __init gtdt_sbsa_gwdt_init(void)
+{
+	struct acpi_table_header *table;
+	void *platform_timer;
+	int index = 0;
+
+	if (acpi_disabled)
+		return 0;
+
+	if (ACPI_FAILURE(acpi_get_table(ACPI_SIG_GTDT, 0, &table)))
+		return -EINVAL;
+
+	if (acpi_gtdt_desc_init(table) < 0)
+		return -EINVAL;
+
+	for_each_platform_timer(platform_timer) {
+		if (is_watchdog(platform_timer) &&
+		    !gtdt_import_sbsa_gwdt(platform_timer, index))
+			index++;
+	}
+
+	if (index)
+		pr_info("found %d SBSA generic Watchdog.\n", index);
+
+	return 0;
+}
+
+device_initcall(gtdt_sbsa_gwdt_init);
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index b4b3e25..105f059 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -207,6 +207,7 @@ config ARM_SBSA_WATCHDOG
 	depends on ARM64
 	depends on ARM_ARCH_TIMER
 	select WATCHDOG_CORE
+	select ACPI_GTDT if ACPI
 	help
 	  ARM SBSA Generic Watchdog has two stage timeouts:
 	  the first signal (WS0) is for alerting the system by interrupt,
-- 
2.5.5

[toc] | [prev] | [next] | [standalone]


#1442730 — [PATCH v7 8/9] clocksource/drivers/arm_arch_timer: Add GTDT support for memory-mapped timer

Fromfu.wei@linaro.org
Date2016-07-13 20:00 +0200
Subject[PATCH v7 8/9] clocksource/drivers/arm_arch_timer: Add GTDT support for memory-mapped timer
Message-ID<rUwBY-6kl-25@gated-at.bofh.it>
In reply to#1442727
From: Fu Wei <fu.wei@linaro.org>

The patch add memory-mapped timer register support by using the information
provided by the new GTDT driver of ACPI.

Signed-off-by: Fu Wei <fu.wei@linaro.org>
---
 drivers/clocksource/arm_arch_timer.c | 131 ++++++++++++++++++++++++++++++++++-
 1 file changed, 130 insertions(+), 1 deletion(-)

diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index f6ab857..0d3ab2b 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -848,7 +848,132 @@ CLOCKSOURCE_OF_DECLARE(armv7_arch_timer_mem, "arm,armv7-timer-mem",
 		       arch_timer_mem_init);
 
 #ifdef CONFIG_ACPI_GTDT
-/* Initialize per-processor generic timer */
+static struct gt_timer_data __init *arch_timer_mem_get_timer(
+						struct gt_block_data *gt_blocks)
+{
+	struct gt_block_data *gt_block = gt_blocks;
+	struct gt_timer_data *best_frame = NULL;
+	void __iomem *cntctlbase;
+	u32 cnttidr;
+	int i;
+
+	/*
+	 * According to ARMv8 Architecture Reference Manual(ARM),
+	 * the size of CNTCTLBase frame of memory-mapped timer
+	 * is SZ_4K(Offset 0x000 – 0xFFF).
+	 */
+	cntctlbase = ioremap(gt_block->cntctlbase_phy, SZ_4K);
+	if (!cntctlbase) {
+		pr_err("Can't map CNTCTLBase\n");
+		return NULL;
+	}
+	cnttidr = readl_relaxed(cntctlbase + CNTTIDR);
+
+	/*
+	 * Try to find a virtual capable frame. Otherwise fall back to a
+	 * physical capable frame.
+	 */
+	for (i = 0; i < gt_block->timer_count; i++) {
+		int n;
+		u32 cntacr;
+
+		n = gt_block->timer[i].frame_nr;
+
+		/* Try enabling everything, and see what sticks */
+		cntacr = CNTACR_RFRQ | CNTACR_RWPT | CNTACR_RPCT |
+			 CNTACR_RWVT | CNTACR_RVOFF | CNTACR_RVCT;
+		writel_relaxed(cntacr, cntctlbase + CNTACR(n));
+		cntacr = readl_relaxed(cntctlbase + CNTACR(n));
+
+		if ((cnttidr & CNTTIDR_VIRT(n)) &&
+		    !(~cntacr & (CNTACR_RWVT | CNTACR_RVCT))) {
+			best_frame = &gt_block->timer[i];
+			arch_timer_mem_use_virtual = true;
+			break;
+		}
+
+		if (~cntacr & (CNTACR_RWPT | CNTACR_RPCT))
+			continue;
+
+		best_frame = &gt_block->timer[i];
+	}
+	iounmap(cntctlbase);
+
+	return best_frame;
+}
+
+static int __init arch_timer_mem_acpi_init(u32 timer_count)
+{
+	struct gt_block_data *gt_blocks;
+	struct gt_timer_data *gt_timer;
+	void __iomem *timer_cntbase;
+	int ret = -EINVAL;
+	int timer_irq;
+
+	/*
+	 * If we have some Platform Timer Structures,
+	 * try to find and register a memory-mapped timer.
+	 * If not, just return.
+	 */
+	if (!timer_count)
+		return 0;
+
+	if (arch_timers_present & ARCH_MEM_TIMER) {
+		pr_warn("memory-mapped timer already initialized, skipping\n");
+		return 0;
+	}
+	arch_timers_present |= ARCH_MEM_TIMER;
+	/*
+	 * before really check all the Platform Timer Structures,
+	 * we assume they are GT block, and allocate memory for them.
+	 * We will free these memory once we finish the initialization.
+	 */
+	gt_blocks = kcalloc(timer_count, sizeof(*gt_blocks), GFP_KERNEL);
+	if (!gt_blocks)
+		return -ENOMEM;
+
+	if (gtdt_arch_timer_mem_init(gt_blocks)) {
+		gt_timer = arch_timer_mem_get_timer(gt_blocks);
+		if (!gt_timer) {
+			pr_err("Failed to get mem timer info.\n");
+			goto error;
+		}
+
+		if (arch_timer_mem_use_virtual)
+			timer_irq = gt_timer->virt_irq;
+		else
+			timer_irq = gt_timer->irq;
+		if (!timer_irq) {
+			pr_err("Frame missing %s irq",
+			       arch_timer_mem_use_virtual ? "virt" : "phys");
+			goto error;
+		}
+
+		/*
+		 * According to ARMv8 Architecture Reference Manual(ARM),
+		 * the size of CNTBaseN frames of memory-mapped timer
+		 * is SZ_4K(Offset 0x000 – 0xFFF).
+		 */
+		timer_cntbase = ioremap(gt_timer->cntbase_phy, SZ_4K);
+		if (!timer_cntbase) {
+			pr_err("Can't map CntBase.\n");
+			goto error;
+		}
+		arch_counter_base = timer_cntbase;
+		ret = arch_timer_mem_register(timer_cntbase, timer_irq);
+		if (ret) {
+			iounmap(timer_cntbase);
+			arch_counter_base = NULL;
+			pr_err("Failed to register mem timer.\n");
+		}
+	}
+
+error:
+	kfree(gt_blocks);
+	return ret;
+}
+
+/* Initialize per-processor generic timer and memory-mapped timer(if present) */
 static int __init arch_timer_acpi_init(struct acpi_table_header *table)
 {
 	int timer_count;
@@ -874,6 +999,10 @@ static int __init arch_timer_acpi_init(struct acpi_table_header *table)
 
 	/* Get the frequency from CNTFRQ */
 	arch_timer_detect_rate(NULL, NULL);
+
+	if (arch_timer_mem_acpi_init(timer_count))
+		pr_err("Failed to initialize memory-mapped timer, skipping\n");
+
 	arch_timer_init();
 
 	return 0;
-- 
2.5.5

[toc] | [prev] | [next] | [standalone]


#1442731 — [PATCH v7 5/9] MAINTAINERS / ACPI: add the ARM64-specific ACPI Support maintainers

Fromfu.wei@linaro.org
Date2016-07-13 20:00 +0200
Subject[PATCH v7 5/9] MAINTAINERS / ACPI: add the ARM64-specific ACPI Support maintainers
Message-ID<rUwBY-6kl-27@gated-at.bofh.it>
In reply to#1442727
From: Fu Wei <fu.wei@linaro.org>

This patch add the ARM64-specific ACPI Support maintainers in
MAINTAINERS, according to the discussion on mailing list:
https://lkml.org/lkml/2016/6/29/580
Lorenzo Pieralisi will submit the pull requsts.

The maintainers are listed by the alphabet order of
their name.

Signed-off-by: Fu Wei <fu.wei@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 MAINTAINERS | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 1209323..1e03463 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -315,6 +315,14 @@ W:	https://01.org/linux-acpi
 S:	Supported
 F:	drivers/acpi/fan.c
 
+ACPI FOR ARM64 (ACPI/arm64)
+M:	Hanjun Guo <hanjun.guo@linaro.org>
+M:	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
+M:	Sudeep Holla <sudeep.holla@arm.com>
+L:	linux-acpi@vger.kernel.org
+S:	Supported
+F:	drivers/acpi/arm64
+
 ACPI THERMAL DRIVER
 M:	Zhang Rui <rui.zhang@intel.com>
 L:	linux-acpi@vger.kernel.org
-- 
2.5.5

[toc] | [prev] | [next] | [standalone]


#1442809 — Re: [PATCH v7 5/9] MAINTAINERS / ACPI: add the ARM64-specific ACPI Support maintainers

From"Rafael J. Wysocki" <rafael@kernel.org>
Date2016-07-13 22:20 +0200
SubjectRe: [PATCH v7 5/9] MAINTAINERS / ACPI: add the ARM64-specific ACPI Support maintainers
Message-ID<rUyNr-7VU-3@gated-at.bofh.it>
In reply to#1442731
On Wed, Jul 13, 2016 at 7:53 PM,  <fu.wei@linaro.org> wrote:
> From: Fu Wei <fu.wei@linaro.org>
>
> This patch add the ARM64-specific ACPI Support maintainers in
> MAINTAINERS, according to the discussion on mailing list:
> https://lkml.org/lkml/2016/6/29/580
> Lorenzo Pieralisi will submit the pull requsts.
>
> The maintainers are listed by the alphabet order of
> their name.
>
> Signed-off-by: Fu Wei <fu.wei@linaro.org>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> ---
>  MAINTAINERS | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 1209323..1e03463 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -315,6 +315,14 @@ W: https://01.org/linux-acpi
>  S:     Supported
>  F:     drivers/acpi/fan.c
>
> +ACPI FOR ARM64 (ACPI/arm64)
> +M:     Hanjun Guo <hanjun.guo@linaro.org>
> +M:     Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> +M:     Sudeep Holla <sudeep.holla@arm.com>
> +L:     linux-acpi@vger.kernel.org
> +S:     Supported
> +F:     drivers/acpi/arm64
> +
>  ACPI THERMAL DRIVER
>  M:     Zhang Rui <rui.zhang@intel.com>
>  L:     linux-acpi@vger.kernel.org
> --

This patch should not be part of your series.

I would prefer it if  Hanjun, Lorenzo or Sudeep sent it.

Of course, it doesn't make much sense to send it before creating
drivers/acpi/arm64/ and putting something in there, so it should be
sent separately after the series has been merged.

Thanks,
Rafael

[toc] | [prev] | [next] | [standalone]


#1443848 — Re: [PATCH v7 5/9] MAINTAINERS / ACPI: add the ARM64-specific ACPI Support maintainers

FromFu Wei <fu.wei@linaro.org>
Date2016-07-15 03:10 +0200
SubjectRe: [PATCH v7 5/9] MAINTAINERS / ACPI: add the ARM64-specific ACPI Support maintainers
Message-ID<rUZNE-h3-17@gated-at.bofh.it>
In reply to#1442809
Hi Rafael,

On 14 July 2016 at 04:16, Rafael J. Wysocki <rafael@kernel.org> wrote:
> On Wed, Jul 13, 2016 at 7:53 PM,  <fu.wei@linaro.org> wrote:
>> From: Fu Wei <fu.wei@linaro.org>
>>
>> This patch add the ARM64-specific ACPI Support maintainers in
>> MAINTAINERS, according to the discussion on mailing list:
>> https://lkml.org/lkml/2016/6/29/580
>> Lorenzo Pieralisi will submit the pull requsts.
>>
>> The maintainers are listed by the alphabet order of
>> their name.
>>
>> Signed-off-by: Fu Wei <fu.wei@linaro.org>
>> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
>> ---
>>  MAINTAINERS | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index 1209323..1e03463 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -315,6 +315,14 @@ W: https://01.org/linux-acpi
>>  S:     Supported
>>  F:     drivers/acpi/fan.c
>>
>> +ACPI FOR ARM64 (ACPI/arm64)
>> +M:     Hanjun Guo <hanjun.guo@linaro.org>
>> +M:     Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
>> +M:     Sudeep Holla <sudeep.holla@arm.com>
>> +L:     linux-acpi@vger.kernel.org
>> +S:     Supported
>> +F:     drivers/acpi/arm64
>> +
>>  ACPI THERMAL DRIVER
>>  M:     Zhang Rui <rui.zhang@intel.com>
>>  L:     linux-acpi@vger.kernel.org
>> --
>
> This patch should not be part of your series.
>
> I would prefer it if  Hanjun, Lorenzo or Sudeep sent it.

Sorry for that, This won't be in my patchset next time.

>
> Of course, it doesn't make much sense to send it before creating
> drivers/acpi/arm64/ and putting something in there, so it should be
> sent separately after the series has been merged.

yes, you are right , got it , thanks  :-)

>
> Thanks,
> Rafael



-- 
Best regards,

Fu Wei
Software Engineer
Red Hat

[toc] | [prev] | [next] | [standalone]


#1442733 — [PATCH v7 1/9] clocksource/drivers/arm_arch_timer: Move enums and defines to header file

Fromfu.wei@linaro.org
Date2016-07-13 20:00 +0200
Subject[PATCH v7 1/9] clocksource/drivers/arm_arch_timer: Move enums and defines to header file
Message-ID<rUwBY-6kl-33@gated-at.bofh.it>
In reply to#1442727
From: Fu Wei <fu.wei@linaro.org>

To support the arm_arch_timer via ACPI we need to share defines and enums
between the driver and the ACPI parser code.

Split out the relevant defines and enums into arm_arch_timer.h.
No functional change.

Signed-off-by: Fu Wei <fu.wei@linaro.org>
---
 drivers/clocksource/arm_arch_timer.c | 11 -----------
 include/clocksource/arm_arch_timer.h | 11 +++++++++++
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index 4814446..5d7272e 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -48,8 +48,6 @@
 #define CNTV_TVAL	0x38
 #define CNTV_CTL	0x3c
 
-#define ARCH_CP15_TIMER	BIT(0)
-#define ARCH_MEM_TIMER	BIT(1)
 static unsigned arch_timers_present __initdata;
 
 static void __iomem *arch_counter_base;
@@ -62,15 +60,6 @@ struct arch_timer {
 #define to_arch_timer(e) container_of(e, struct arch_timer, evt)
 
 static u32 arch_timer_rate;
-
-enum ppi_nr {
-	PHYS_SECURE_PPI,
-	PHYS_NONSECURE_PPI,
-	VIRT_PPI,
-	HYP_PPI,
-	MAX_TIMER_PPI
-};
-
 static int arch_timer_ppi[MAX_TIMER_PPI];
 
 static struct clock_event_device __percpu *arch_timer_evt;
diff --git a/include/clocksource/arm_arch_timer.h b/include/clocksource/arm_arch_timer.h
index caedb74..6f06481 100644
--- a/include/clocksource/arm_arch_timer.h
+++ b/include/clocksource/arm_arch_timer.h
@@ -19,6 +19,9 @@
 #include <linux/timecounter.h>
 #include <linux/types.h>
 
+#define ARCH_CP15_TIMER			BIT(0)
+#define ARCH_MEM_TIMER			BIT(1)
+
 #define ARCH_TIMER_CTRL_ENABLE		(1 << 0)
 #define ARCH_TIMER_CTRL_IT_MASK		(1 << 1)
 #define ARCH_TIMER_CTRL_IT_STAT		(1 << 2)
@@ -34,6 +37,14 @@ enum arch_timer_reg {
 	ARCH_TIMER_REG_TVAL,
 };
 
+enum ppi_nr {
+	PHYS_SECURE_PPI,
+	PHYS_NONSECURE_PPI,
+	VIRT_PPI,
+	HYP_PPI,
+	MAX_TIMER_PPI
+};
+
 #define ARCH_TIMER_PHYS_ACCESS		0
 #define ARCH_TIMER_VIRT_ACCESS		1
 #define ARCH_TIMER_MEM_PHYS_ACCESS	2
-- 
2.5.5

[toc] | [prev] | [next] | [standalone]


#1442734 — [PATCH v7 6/9] clocksource/drivers/arm_arch_timer: Simplify ACPI support code.

Fromfu.wei@linaro.org
Date2016-07-13 20:00 +0200
Subject[PATCH v7 6/9] clocksource/drivers/arm_arch_timer: Simplify ACPI support code.
Message-ID<rUwBY-6kl-35@gated-at.bofh.it>
In reply to#1442727
From: Fu Wei <fu.wei@linaro.org>

The patch update arm_arch_timer driver to use the function
provided by the new GTDT driver of ACPI.
By this way, arm_arch_timer.c can be simplified, and separate
all the ACPI GTDT knowledge from this timer driver.

Signed-off-by: Fu Wei <fu.wei@linaro.org>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 drivers/clocksource/Kconfig          |  1 +
 drivers/clocksource/arm_arch_timer.c | 49 +++++++++---------------------------
 2 files changed, 13 insertions(+), 37 deletions(-)

diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 47352d2..71d5b30 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -8,6 +8,7 @@ config CLKSRC_OF
 config CLKSRC_ACPI
 	bool
 	select CLKSRC_PROBE
+	select ACPI_GTDT if ARM64
 
 config CLKSRC_PROBE
 	bool
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index e6fd42d..f6ab857 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -847,60 +847,35 @@ out:
 CLOCKSOURCE_OF_DECLARE(armv7_arch_timer_mem, "arm,armv7-timer-mem",
 		       arch_timer_mem_init);
 
-#ifdef CONFIG_ACPI
-static int __init map_generic_timer_interrupt(u32 interrupt, u32 flags)
-{
-	int trigger, polarity;
-
-	if (!interrupt)
-		return 0;
-
-	trigger = (flags & ACPI_GTDT_INTERRUPT_MODE) ? ACPI_EDGE_SENSITIVE
-			: ACPI_LEVEL_SENSITIVE;
-
-	polarity = (flags & ACPI_GTDT_INTERRUPT_POLARITY) ? ACPI_ACTIVE_LOW
-			: ACPI_ACTIVE_HIGH;
-
-	return acpi_register_gsi(NULL, interrupt, trigger, polarity);
-}
-
+#ifdef CONFIG_ACPI_GTDT
 /* Initialize per-processor generic timer */
 static int __init arch_timer_acpi_init(struct acpi_table_header *table)
 {
-	struct acpi_table_gtdt *gtdt;
+	int timer_count;
 
 	if (arch_timers_present & ARCH_CP15_TIMER) {
 		pr_warn("already initialized, skipping\n");
 		return -EINVAL;
 	}
 
-	gtdt = container_of(table, struct acpi_table_gtdt, header);
-
 	arch_timers_present |= ARCH_CP15_TIMER;
 
-	arch_timer_ppi[PHYS_SECURE_PPI] =
-		map_generic_timer_interrupt(gtdt->secure_el1_interrupt,
-		gtdt->secure_el1_flags);
+	timer_count = gtdt_arch_timer_init(table);
 
-	arch_timer_ppi[PHYS_NONSECURE_PPI] =
-		map_generic_timer_interrupt(gtdt->non_secure_el1_interrupt,
-		gtdt->non_secure_el1_flags);
-
-	arch_timer_ppi[VIRT_PPI] =
-		map_generic_timer_interrupt(gtdt->virtual_timer_interrupt,
-		gtdt->virtual_timer_flags);
+	if (timer_count < 0)
+		return -EINVAL;
 
-	arch_timer_ppi[HYP_PPI] =
-		map_generic_timer_interrupt(gtdt->non_secure_el2_interrupt,
-		gtdt->non_secure_el2_flags);
+	arch_timer_ppi[PHYS_SECURE_PPI] = acpi_gtdt_map_ppi(PHYS_SECURE_PPI);
+	arch_timer_ppi[PHYS_NONSECURE_PPI] = acpi_gtdt_map_ppi(PHYS_NONSECURE_PPI);
+	arch_timer_ppi[VIRT_PPI] = acpi_gtdt_map_ppi(VIRT_PPI);
+	arch_timer_ppi[HYP_PPI] = acpi_gtdt_map_ppi(HYP_PPI);
+	/* Always-on capability */
+	arch_timer_c3stop = acpi_gtdt_c3stop();
 
 	/* Get the frequency from CNTFRQ */
 	arch_timer_detect_rate(NULL, NULL);
-
-	/* Always-on capability */
-	arch_timer_c3stop = !(gtdt->non_secure_el1_flags & ACPI_GTDT_ALWAYS_ON);
-
 	arch_timer_init();
+
 	return 0;
 }
 CLOCKSOURCE_ACPI_DECLARE(arch_timer, ACPI_SIG_GTDT, arch_timer_acpi_init);
-- 
2.5.5

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web