From: Hanjun Guo <hanjun.guo@linaro.org>
To: Wei Huang <wei@redhat.com>, kvmarm@lists.cs.columbia.edu
Cc: kvm@vger.kernel.org, marc.zyngier@arm.com,
christoffer.dall@linaro.org, pbonzini@redhat.com,
drjones@redhat.com, a.spyridakis@virtualopensystems.com
Subject: Re: [PATCH V2 1/5] kvm: arm64: Enable ACPI support for virt arch timer
Date: Thu, 11 Jun 2015 19:27:25 +0800 [thread overview]
Message-ID: <5579709D.7080905@linaro.org> (raw)
In-Reply-To: <1433909767-12189-2-git-send-email-wei@redhat.com>
On 06/10/2015 12:16 PM, Wei Huang wrote:
> This patches enables ACPI support for KVM virtual arch timer. It allows
> KVM to parse ACPI table for arch timer PPI when DT table is not present.
>
> Signed-off-by: Alexander Spyridaki <a.spyridakis@virtualopensystems.com>
> Signed-off-by: Wei Huang <wei@redhat.com>
> ---
> virt/kvm/arm/arch_timer.c | 75 +++++++++++++++++++++++++++++++++++++++--------
> 1 file changed, 62 insertions(+), 13 deletions(-)
>
> diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c
> index 98c95f2..a9da75a 100644
> --- a/virt/kvm/arm/arch_timer.c
> +++ b/virt/kvm/arm/arch_timer.c
> @@ -21,6 +21,7 @@
> #include <linux/kvm.h>
> #include <linux/kvm_host.h>
> #include <linux/interrupt.h>
> +#include <linux/acpi.h>
>
> #include <clocksource/arm_arch_timer.h>
> #include <asm/arch_timer.h>
> @@ -274,9 +275,57 @@ static const struct of_device_id arch_timer_of_match[] = {
> {},
> };
>
> -int kvm_timer_hyp_init(void)
> +static int kvm_timer_ppi_dt_parse(unsigned int *ppi)
> {
> struct device_node *np;
> +
> + np = of_find_matching_node(NULL, arch_timer_of_match);
> + if (!np)
> + return -ENODEV;
> +
> + *ppi = irq_of_parse_and_map(np, 2);
> + if (*ppi == 0) {
> + of_node_put(np);
> + return -EINVAL;
> + }
> +
> + return 0;
> +}
> +
> +#ifdef CONFIG_ACPI
> +struct acpi_table_gtdt *gtdt_acpi;
> +static void arch_timer_acpi_parse(struct acpi_table_header *table)
> +{
> + gtdt_acpi = container_of(table, struct acpi_table_gtdt, header);
> +}
> +
> +static int kvm_timer_ppi_acpi_parse(unsigned int *ppi)
> +{
> + u32 flags;
> + int trigger, polarity;
> +
> + /*Get the interrupt number from the GTDT table */
> + acpi_table_parse(ACPI_SIG_GTDT,
> + (acpi_tbl_table_handler)arch_timer_acpi_parse);
> +
> + if (!gtdt_acpi->virtual_timer_interrupt)
> + return -EINVAL;
...
> +
> + flags = gtdt_acpi->virtual_timer_flags;
> + trigger = (flags & ACPI_GTDT_INTERRUPT_MODE) ? ACPI_EDGE_SENSITIVE
> + : ACPI_LEVEL_SENSITIVE;
> + polarity = (flags & ACPI_GTDT_INTERRUPT_POLARITY) ? ACPI_ACTIVE_LOW
> + : ACPI_ACTIVE_HIGH;
> +
> + *ppi = acpi_register_gsi(NULL, gtdt_acpi->virtual_timer_interrupt,
> + trigger, polarity);
Hmm, this is another duplication of getting trigger/polarity and
registering the interrupt, currently we are working on introducing
gtdt.c and put common used functions there [1], but I think this is
just some nitpick, we can refactor it later when that patch set
is accepted.
[1]: https://lkml.org/lkml/2015/6/10/367
Thanks
Hanjun
next prev parent reply other threads:[~2015-06-11 11:27 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-10 4:16 [PATCH V2 0/5] Enable ACPI support for KVM ARM Wei Huang
2015-06-10 4:16 ` [PATCH V2 1/5] kvm: arm64: Enable ACPI support for virt arch timer Wei Huang
2015-06-10 12:51 ` Andrew Jones
2015-06-11 11:27 ` Hanjun Guo [this message]
2015-06-10 4:16 ` [PATCH V2 2/5] kvm: arm64: Dispatch virt GIC probing to device tree and ACPI Wei Huang
2015-06-11 11:34 ` Hanjun Guo
2015-06-10 4:16 ` [PATCH V2 3/5] kvm: arm64: Detect GIC version for proper ACPI vGIC probing Wei Huang
2015-06-10 12:53 ` Andrew Jones
2015-06-10 16:43 ` Marc Zyngier
2015-06-11 4:51 ` Wei Huang
2015-06-11 7:54 ` Marc Zyngier
2015-06-10 4:16 ` [PATCH V2 4/5] kvm: arm64: Implement ACPI probing code for GICv2 Wei Huang
2015-06-10 4:16 ` [PATCH V2 5/5] kvm: arm64: Implement ACPI probing code for GICv3 Wei Huang
2015-06-10 13:04 ` Andrew Jones
2015-06-10 13:23 ` [PATCH V2 0/5] Enable ACPI support for KVM ARM Andrew Jones
2015-06-11 11:47 ` Hanjun Guo
2016-01-14 0:27 ` Graeme Gregory
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5579709D.7080905@linaro.org \
--to=hanjun.guo@linaro.org \
--cc=a.spyridakis@virtualopensystems.com \
--cc=christoffer.dall@linaro.org \
--cc=drjones@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=marc.zyngier@arm.com \
--cc=pbonzini@redhat.com \
--cc=wei@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.