All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoffer Dall <cdall@linaro.org>
To: Marc Zyngier <marc.zyngier@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	kvmarm@lists.cs.columbia.edu,
	linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org
Subject: Re: [PATCH v3 06/20] KVM: arm/arm64: Check that system supports split eoi/deactivate
Date: Wed, 18 Oct 2017 21:16:38 +0200	[thread overview]
Message-ID: <20171018191638.GJ8900@cbox> (raw)
In-Reply-To: <874lqwjvdv.fsf@on-the-bus.cambridge.arm.com>

On Wed, Oct 18, 2017 at 05:03:40PM +0100, Marc Zyngier wrote:
> On Wed, Oct 18 2017 at  3:41:45 pm BST, Christoffer Dall <cdall@linaro.org> wrote:
> > On Mon, Oct 09, 2017 at 05:47:18PM +0100, Marc Zyngier wrote:
> >> On 23/09/17 01:41, 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 are 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 | 3 ++-
> >> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >> > 
> >> > diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
> >> > index f641e8e..ab12bf4 100644
> >> > --- a/drivers/irqchip/irq-gic.c
> >> > +++ b/drivers/irqchip/irq-gic.c
> >> > @@ -1420,7 +1420,8 @@ static void __init gic_of_setup_kvm_info(struct device_node *node)
> >> >  	if (ret)
> >> >  		return;
> >> >  
> >> > -	gic_set_kvm_info(&gic_v2_kvm_info);
> >> > +	if (static_key_true(&supports_deactivate))
> >> > +		gic_set_kvm_info(&gic_v2_kvm_info);
> >> >  }
> >> >  
> >> >  int __init
> >> > 
> >> 
> >> Should we add the same level of checking on the ACPI path, just for the
> >> sake symmetry?
> >
> > Yes, we should, if anyone is crazy enough to use ACPI :)
> 
> Sadly, the madness is becoming commonplace.
> 
> >> 
> >> Also, do we need to add the same thing for GICv3?
> >> 
> >
> > Why would split EOI/deactivate not be available on GICv3, actually?  It
> > looks like this is not supported unless you have EL2, but I can't seem
> > to find anything in the spec for this, and KVM should support
> > EOI/deactivate for GICv3 guests I think.  Am I missing something?
> 
> No, you're not. This is just a Linux choice (or rather mine) not to use
> EOImode=1 in guests (or anything booted at EL1), as we don't really need
> the two-stage deactivate in that situation (it is pure overhead).
> 
> I'm just worried of potentially broken HW, and would like to make sure
> that when we force EOImode=0 on these systems, we truly tell KVM about
> it.
> 

Yes, makes sense, it's also more cosistent that way.

> > Assuming I'm wrong about GICv3, which I probably am, how does this look
> > (on top of the posted patch):
> >
> > diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
> > index 519149e..aed524c 100644
> > --- a/drivers/irqchip/irq-gic-v3.c
> > +++ b/drivers/irqchip/irq-gic-v3.c
> > @@ -1228,7 +1228,9 @@ static int __init gic_of_init(struct device_node *node, struct device_node *pare
> >  		goto out_unmap_rdist;
> >  
> >  	gic_populate_ppi_partitions(node);
> > -	gic_of_setup_kvm_info(node);
> > +
> > +	if (static_key_true(&supports_deactivate))
> > +		gic_of_setup_kvm_info(node);
> >  	return 0;
> >  
> >  out_unmap_rdist:
> > @@ -1517,7 +1519,9 @@ gic_acpi_init(struct acpi_subtable_header *header, const unsigned long end)
> >  		goto out_fwhandle_free;
> >  
> >  	acpi_set_irq_model(ACPI_IRQ_MODEL_GIC, domain_handle);
> > -	gic_acpi_setup_kvm_info();
> > +
> > +	if (static_key_true(&supports_deactivate))
> > +		gic_acpi_setup_kvm_info();
> >  
> >  	return 0;
> >  
> > diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
> > index ab12bf4..121af5c 100644
> > --- a/drivers/irqchip/irq-gic.c
> > +++ b/drivers/irqchip/irq-gic.c
> > @@ -1653,7 +1653,8 @@ static int __init gic_v2_acpi_init(struct acpi_subtable_header *header,
> >  	if (IS_ENABLED(CONFIG_ARM_GIC_V2M))
> >  		gicv2m_init(NULL, gic_data[0].domain);
> >  
> > -	gic_acpi_setup_kvm_info();
> > +	if (static_key_true(&supports_deactivate))
> > +		gic_acpi_setup_kvm_info();
> >  
> >  	return 0;
> >  }
> 
> Yup, looks good to me!
> 

Thanks,
-Christoffer

WARNING: multiple messages have this Message-ID (diff)
From: cdall@linaro.org (Christoffer Dall)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 06/20] KVM: arm/arm64: Check that system supports split eoi/deactivate
Date: Wed, 18 Oct 2017 21:16:38 +0200	[thread overview]
Message-ID: <20171018191638.GJ8900@cbox> (raw)
In-Reply-To: <874lqwjvdv.fsf@on-the-bus.cambridge.arm.com>

On Wed, Oct 18, 2017 at 05:03:40PM +0100, Marc Zyngier wrote:
> On Wed, Oct 18 2017 at  3:41:45 pm BST, Christoffer Dall <cdall@linaro.org> wrote:
> > On Mon, Oct 09, 2017 at 05:47:18PM +0100, Marc Zyngier wrote:
> >> On 23/09/17 01:41, 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 are 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 | 3 ++-
> >> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >> > 
> >> > diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
> >> > index f641e8e..ab12bf4 100644
> >> > --- a/drivers/irqchip/irq-gic.c
> >> > +++ b/drivers/irqchip/irq-gic.c
> >> > @@ -1420,7 +1420,8 @@ static void __init gic_of_setup_kvm_info(struct device_node *node)
> >> >  	if (ret)
> >> >  		return;
> >> >  
> >> > -	gic_set_kvm_info(&gic_v2_kvm_info);
> >> > +	if (static_key_true(&supports_deactivate))
> >> > +		gic_set_kvm_info(&gic_v2_kvm_info);
> >> >  }
> >> >  
> >> >  int __init
> >> > 
> >> 
> >> Should we add the same level of checking on the ACPI path, just for the
> >> sake symmetry?
> >
> > Yes, we should, if anyone is crazy enough to use ACPI :)
> 
> Sadly, the madness is becoming commonplace.
> 
> >> 
> >> Also, do we need to add the same thing for GICv3?
> >> 
> >
> > Why would split EOI/deactivate not be available on GICv3, actually?  It
> > looks like this is not supported unless you have EL2, but I can't seem
> > to find anything in the spec for this, and KVM should support
> > EOI/deactivate for GICv3 guests I think.  Am I missing something?
> 
> No, you're not. This is just a Linux choice (or rather mine) not to use
> EOImode=1 in guests (or anything booted at EL1), as we don't really need
> the two-stage deactivate in that situation (it is pure overhead).
> 
> I'm just worried of potentially broken HW, and would like to make sure
> that when we force EOImode=0 on these systems, we truly tell KVM about
> it.
> 

Yes, makes sense, it's also more cosistent that way.

> > Assuming I'm wrong about GICv3, which I probably am, how does this look
> > (on top of the posted patch):
> >
> > diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
> > index 519149e..aed524c 100644
> > --- a/drivers/irqchip/irq-gic-v3.c
> > +++ b/drivers/irqchip/irq-gic-v3.c
> > @@ -1228,7 +1228,9 @@ static int __init gic_of_init(struct device_node *node, struct device_node *pare
> >  		goto out_unmap_rdist;
> >  
> >  	gic_populate_ppi_partitions(node);
> > -	gic_of_setup_kvm_info(node);
> > +
> > +	if (static_key_true(&supports_deactivate))
> > +		gic_of_setup_kvm_info(node);
> >  	return 0;
> >  
> >  out_unmap_rdist:
> > @@ -1517,7 +1519,9 @@ gic_acpi_init(struct acpi_subtable_header *header, const unsigned long end)
> >  		goto out_fwhandle_free;
> >  
> >  	acpi_set_irq_model(ACPI_IRQ_MODEL_GIC, domain_handle);
> > -	gic_acpi_setup_kvm_info();
> > +
> > +	if (static_key_true(&supports_deactivate))
> > +		gic_acpi_setup_kvm_info();
> >  
> >  	return 0;
> >  
> > diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
> > index ab12bf4..121af5c 100644
> > --- a/drivers/irqchip/irq-gic.c
> > +++ b/drivers/irqchip/irq-gic.c
> > @@ -1653,7 +1653,8 @@ static int __init gic_v2_acpi_init(struct acpi_subtable_header *header,
> >  	if (IS_ENABLED(CONFIG_ARM_GIC_V2M))
> >  		gicv2m_init(NULL, gic_data[0].domain);
> >  
> > -	gic_acpi_setup_kvm_info();
> > +	if (static_key_true(&supports_deactivate))
> > +		gic_acpi_setup_kvm_info();
> >  
> >  	return 0;
> >  }
> 
> Yup, looks good to me!
> 

Thanks,
-Christoffer

  reply	other threads:[~2017-10-18 19:16 UTC|newest]

Thread overview: 110+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-23  0:41 [PATCH v3 00/20] KVM: arm/arm64: Optimize arch timer register handling Christoffer Dall
2017-09-23  0:41 ` Christoffer Dall
2017-09-23  0:41 ` [PATCH v3 01/20] irqchip/gic: Deal with broken firmware exposing only 4kB of GICv2 CPU interface Christoffer Dall
2017-09-23  0:41   ` Christoffer Dall
2017-09-23  0:41 ` [PATCH v3 02/20] arm64: Use physical counter for in-kernel reads Christoffer Dall
2017-09-23  0:41   ` Christoffer Dall
2017-10-09 16:10   ` Marc Zyngier
2017-10-09 16:10     ` Marc Zyngier
2017-10-17 15:33   ` Will Deacon
2017-10-17 15:33     ` Will Deacon
2017-10-18 10:00     ` Christoffer Dall
2017-10-18 10:00       ` Christoffer Dall
2017-09-23  0:41 ` [PATCH v3 03/20] arm64: Use the physical counter when available for read_cycles Christoffer Dall
2017-09-23  0:41   ` Christoffer Dall
2017-10-09 16:21   ` Marc Zyngier
2017-10-09 16:21     ` Marc Zyngier
2017-10-18 11:34     ` Christoffer Dall
2017-10-18 11:34       ` Christoffer Dall
2017-10-18 15:52       ` Marc Zyngier
2017-10-18 15:52         ` Marc Zyngier
2017-09-23  0:41 ` [PATCH v3 04/20] KVM: arm/arm64: Guard kvm_vgic_map_is_active against !vgic_initialized Christoffer Dall
2017-09-23  0:41   ` Christoffer Dall
2017-10-09 16:22   ` Marc Zyngier
2017-10-09 16:22     ` Marc Zyngier
2017-09-23  0:41 ` [PATCH v3 05/20] KVM: arm/arm64: Support calling vgic_update_irq_pending from irq context Christoffer Dall
2017-09-23  0:41   ` Christoffer Dall
2017-10-09 16:37   ` Marc Zyngier
2017-10-09 16:37     ` Marc Zyngier
2017-10-18 11:54     ` Christoffer Dall
2017-10-18 11:54       ` Christoffer Dall
2017-09-23  0:41 ` [PATCH v3 06/20] KVM: arm/arm64: Check that system supports split eoi/deactivate Christoffer Dall
2017-09-23  0:41   ` Christoffer Dall
2017-10-09 16:47   ` Marc Zyngier
2017-10-09 16:47     ` Marc Zyngier
2017-10-18 13:41     ` Christoffer Dall
2017-10-18 13:41       ` Christoffer Dall
2017-10-18 16:03       ` Marc Zyngier
2017-10-18 16:03         ` Marc Zyngier
2017-10-18 19:16         ` Christoffer Dall [this message]
2017-10-18 19:16           ` Christoffer Dall
2017-09-23  0:41 ` [PATCH v3 07/20] KVM: arm/arm64: Make timer_arm and timer_disarm helpers more generic Christoffer Dall
2017-09-23  0:41   ` Christoffer Dall
2017-10-09 17:05   ` Marc Zyngier
2017-10-09 17:05     ` Marc Zyngier
2017-10-18 16:47     ` Christoffer Dall
2017-10-18 16:47       ` Christoffer Dall
2017-10-18 16:53       ` Marc Zyngier
2017-10-18 16:53         ` Marc Zyngier
2017-09-23  0:41 ` [PATCH v3 08/20] KVM: arm/arm64: Rename soft timer to bg_timer Christoffer Dall
2017-09-23  0:41   ` Christoffer Dall
2017-10-09 17:06   ` Marc Zyngier
2017-10-09 17:06     ` Marc Zyngier
2017-09-23  0:41 ` [PATCH v3 09/20] KVM: arm/arm64: Use separate timer for phys timer emulation Christoffer Dall
2017-09-23  0:41   ` Christoffer Dall
2017-10-09 17:23   ` Marc Zyngier
2017-10-09 17:23     ` Marc Zyngier
2017-10-19  7:38     ` Christoffer Dall
2017-10-19  7:38       ` Christoffer Dall
2017-09-23  0:41 ` [PATCH v3 10/20] KVM: arm/arm64: Move timer/vgic flush/sync under disabled irq Christoffer Dall
2017-09-23  0:41   ` Christoffer Dall
2017-10-09 17:34   ` Marc Zyngier
2017-10-09 17:34     ` Marc Zyngier
2017-09-23  0:41 ` [PATCH v3 11/20] KVM: arm/arm64: Move timer save/restore out of the hyp code Christoffer Dall
2017-09-23  0:41   ` Christoffer Dall
2017-10-09 17:47   ` Marc Zyngier
2017-10-09 17:47     ` Marc Zyngier
2017-10-19  7:46     ` Christoffer Dall
2017-10-19  7:46       ` Christoffer Dall
2017-09-23  0:41 ` [PATCH v3 12/20] genirq: Document vcpu_info usage for percpu_devid interrupts Christoffer Dall
2017-09-23  0:41   ` Christoffer Dall
2017-10-09 17:48   ` Marc Zyngier
2017-10-09 17:48     ` Marc Zyngier
2017-09-23  0:42 ` [PATCH v3 13/20] KVM: arm/arm64: Set VCPU affinity for virt timer irq Christoffer Dall
2017-09-23  0:42   ` Christoffer Dall
2017-10-09 17:52   ` Marc Zyngier
2017-10-09 17:52     ` Marc Zyngier
2017-09-23  0:42 ` [PATCH v3 14/20] KVM: arm/arm64: Avoid timer save/restore in vcpu entry/exit Christoffer Dall
2017-09-23  0:42   ` Christoffer Dall
2017-10-10  8:47   ` Marc Zyngier
2017-10-10  8:47     ` Marc Zyngier
2017-10-19  8:15     ` Christoffer Dall
2017-10-19  8:15       ` Christoffer Dall
2017-09-23  0:42 ` [PATCH v3 15/20] KVM: arm/arm64: Support EL1 phys timer register access in set/get reg Christoffer Dall
2017-09-23  0:42   ` Christoffer Dall
2017-10-10  9:10   ` Marc Zyngier
2017-10-10  9:10     ` Marc Zyngier
2017-10-19  8:32     ` Christoffer Dall
2017-10-19  8:32       ` Christoffer Dall
2017-09-23  0:42 ` [PATCH v3 16/20] KVM: arm/arm64: Use kvm_arm_timer_set/get_reg for guest register traps Christoffer Dall
2017-09-23  0:42   ` Christoffer Dall
2017-10-10  9:12   ` Marc Zyngier
2017-10-10  9:12     ` Marc Zyngier
2017-09-23  0:42 ` [PATCH v3 17/20] KVM: arm/arm64: Move phys_timer_emulate function Christoffer Dall
2017-09-23  0:42   ` Christoffer Dall
2017-10-10  9:21   ` Marc Zyngier
2017-10-10  9:21     ` Marc Zyngier
2017-09-23  0:42 ` [PATCH v3 18/20] KVM: arm/arm64: Avoid phys timer emulation in vcpu entry/exit Christoffer Dall
2017-09-23  0:42   ` Christoffer Dall
2017-10-10  9:45   ` Marc Zyngier
2017-10-10  9:45     ` Marc Zyngier
2017-10-19  8:44     ` Christoffer Dall
2017-10-19  8:44       ` Christoffer Dall
2017-09-23  0:42 ` [PATCH v3 19/20] KVM: arm/arm64: Get rid of kvm_timer_flush_hwstate Christoffer Dall
2017-09-23  0:42   ` Christoffer Dall
2017-10-10  9:46   ` Marc Zyngier
2017-10-10  9:46     ` Marc Zyngier
2017-09-23  0:42 ` [PATCH v3 20/20] KVM: arm/arm64: Rework kvm_timer_should_fire Christoffer Dall
2017-09-23  0:42   ` Christoffer Dall
2017-10-10  9:59   ` Marc Zyngier
2017-10-10  9:59     ` Marc Zyngier

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=20171018191638.GJ8900@cbox \
    --to=cdall@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=marc.zyngier@arm.com \
    --cc=will.deacon@arm.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.