kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <marc.zyngier@arm.com>
To: Christoffer Dall <cdall@linaro.org>,
	kvmarm@lists.cs.columbia.edu,
	linux-arm-kernel@lists.infradead.org
Cc: kvm@vger.kernel.org
Subject: Re: [RFC PATCH v2 05/19] KVM: arm/arm64: Check that system supports split eoi/deactivate
Date: Tue, 1 Aug 2017 12:35:23 +0100	[thread overview]
Message-ID: <3ca8bc15-b5e7-abf7-78cc-9bbc5332c267@arm.com> (raw)
In-Reply-To: <20170717142718.13853-6-cdall@linaro.org>

On 17/07/17 15:27, Christoffer Dall wrote:
> Some systems without proper firmware and/or hardware description data
> don't support the split EOI and deactivate operation.
> 
> On such systems, we cannot leave the physical interrupt active after the
> timer handler on the host has run, so we cannot support KVM with an
> in-kernel GIC with the timer changes we about to introduce.
> 
> This patch makes sure that trying to initialize the KVM GIC code will
> fail on such systems.
> 
> Cc: Marc Zyngier <marc.zyngier@arm.com>
> Signed-off-by: Christoffer Dall <cdall@linaro.org>
> ---
>  drivers/irqchip/irq-gic.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
> index 090991f..b7e4fed 100644
> --- a/drivers/irqchip/irq-gic.c
> +++ b/drivers/irqchip/irq-gic.c
> @@ -1391,7 +1391,8 @@ int gic_of_init_child(struct device *dev, struct gic_chip_data **gic, int irq)
>  	return 0;
>  }
>  
> -static void __init gic_of_setup_kvm_info(struct device_node *node)
> +static void __init gic_of_setup_kvm_info(struct device_node *node,
> +					 bool supports_deactivate)

Ouch, nasty. This shadows the static key which is also called
supports_deactivate...

>  {
>  	int ret;
>  	struct resource *vctrl_res = &gic_v2_kvm_info.vctrl;
> @@ -1411,6 +1412,9 @@ static void __init gic_of_setup_kvm_info(struct device_node *node)
>  	if (ret)
>  		return;
>  
> +	if (!supports_deactivate)
> +		return;
> +
>  	gic_set_kvm_info(&gic_v2_kvm_info);

Speaking of which, the static key should already be initialized, so this
could actually read:

	if (static_key_true(&supports_deactivate))
		gic_set_kvm_info(&gic_v2_kvm_info);

>  }
>  
> @@ -1419,6 +1423,7 @@ gic_of_init(struct device_node *node, struct device_node *parent)
>  {
>  	struct gic_chip_data *gic;
>  	int irq, ret;
> +	bool has_eoimode;
>  
>  	if (WARN_ON(!node))
>  		return -ENODEV;
> @@ -1436,7 +1441,8 @@ gic_of_init(struct device_node *node, struct device_node *parent)
>  	 * Disable split EOI/Deactivate if either HYP is not available
>  	 * or the CPU interface is too small.
>  	 */
> -	if (gic_cnt == 0 && !gic_check_eoimode(node, &gic->raw_cpu_base))
> +	has_eoimode = gic_check_eoimode(node, &gic->raw_cpu_base);
> +	if (gic_cnt == 0 && !has_eoimode)
>  		static_key_slow_dec(&supports_deactivate);
>  
>  	ret = __gic_init_bases(gic, -1, &node->fwnode);
> @@ -1447,7 +1453,7 @@ gic_of_init(struct device_node *node, struct device_node *parent)
>  
>  	if (!gic_cnt) {
>  		gic_init_physaddr(node);
> -		gic_of_setup_kvm_info(node);
> +		gic_of_setup_kvm_info(node, has_eoimode);
>  	}
>  
>  	if (parent) {
> 

and we shouldn't need any of this. What do you think?

	M.
-- 
Jazz is not dead. It just smells funny...

  reply	other threads:[~2017-08-01 11:35 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-17 14:26 [RFC PATCH v2 00/19] KVM: arm/arm64: Optimize arch timer register handling Christoffer Dall
2017-07-17 14:27 ` [RFC PATCH v2 01/19] arm64: Use physical counter for in-kernel reads Christoffer Dall
2017-07-17 14:27 ` [RFC PATCH v2 02/19] arm64: Use the physical counter when available for read_cycles Christoffer Dall
2017-07-25  9:43   ` Will Deacon
2017-07-25 14:36     ` Christoffer Dall
2017-07-26 17:17       ` Will Deacon
2017-07-27  7:14         ` Christoffer Dall
2017-07-17 14:27 ` [RFC PATCH v2 03/19] KVM: arm/arm64: Guard kvm_vgic_map_is_active against !vgic_initialized Christoffer Dall
2017-07-17 14:27 ` [RFC PATCH v2 04/19] KVM: arm/arm64: Support calling vgic_update_irq_pending from irq context Christoffer Dall
2017-07-17 14:27 ` [RFC PATCH v2 05/19] KVM: arm/arm64: Check that system supports split eoi/deactivate Christoffer Dall
2017-08-01 11:35   ` Marc Zyngier [this message]
2017-08-01 12:26     ` Christoffer Dall
2017-08-01 12:37       ` Marc Zyngier
2017-08-01 12:54         ` Christoffer Dall
2017-07-17 14:27 ` [RFC PATCH v2 06/19] KVM: arm/arm64: Make timer_arm and timer_disarm helpers more generic Christoffer Dall
2017-08-01 14:10   ` Marc Zyngier
2017-08-01 14:57     ` Christoffer Dall
2017-08-01 15:41       ` Marc Zyngier
2017-07-17 14:27 ` [RFC PATCH v2 07/19] KVM: arm/arm64: Rename soft timer to bg_timer Christoffer Dall
2017-07-17 14:27 ` [RFC PATCH v2 08/19] KVM: arm/arm64: Use separate timer for phys timer emulation Christoffer Dall
2017-07-17 14:27 ` [RFC PATCH v2 09/19] KVM: arm/arm64: Move timer/vgic flush/sync under disabled irq Christoffer Dall
2017-07-17 14:27 ` [RFC PATCH v2 10/19] KVM: arm/arm64: Move timer save/restore out of the hyp code Christoffer Dall
2017-07-17 14:27 ` [RFC PATCH v2 11/19] genirq: Document vcpu_info usage for per-CPU interrupts Christoffer Dall
2017-08-01 16:15   ` Marc Zyngier
2017-08-01 16:57     ` Christoffer Dall
2017-07-17 14:27 ` [RFC PATCH v2 12/19] KVM: arm/arm64: Set VCPU affinity for virt timer irq Christoffer Dall
2017-07-17 14:27 ` [RFC PATCH v2 13/19] KVM: arm/arm64: Avoid timer save/restore in vcpu entry/exit Christoffer Dall
2017-07-17 14:27 ` [RFC PATCH v2 14/19] KVM: arm/arm64: Support EL1 phys timer register access in set/get reg Christoffer Dall
2017-07-17 14:27 ` [RFC PATCH v2 15/19] KVM: arm/arm64: Use kvm_arm_timer_set/get_reg for guest register traps Christoffer Dall
2017-07-17 14:27 ` [RFC PATCH v2 16/19] KVM: arm/arm64: Move phys_timer_emulate function Christoffer Dall
2017-07-17 14:27 ` [RFC PATCH v2 17/19] KVM: arm/arm64: Avoid phys timer emulation in vcpu entry/exit Christoffer Dall
2017-07-17 14:27 ` [RFC PATCH v2 18/19] KVM: arm/arm64: Get rid of kvm_timer_flush_hwstate Christoffer Dall
2017-07-17 14:27 ` [RFC PATCH v2 19/19] KVM: arm/arm64: Rework kvm_timer_should_fire Christoffer Dall

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=3ca8bc15-b5e7-abf7-78cc-9bbc5332c267@arm.com \
    --to=marc.zyngier@arm.com \
    --cc=cdall@linaro.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).