From: Andrii Anisov <andrii.anisov@gmail.com>
Cc: xen-devel@lists.xenproject.org,
Julien Grall <julien.grall@arm.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Andrii Anisov <andrii_anisov@epam.com>
Subject: [PATCH] gic:vgic: avoid excessive conversions
Date: Fri, 16 Nov 2018 18:45:27 +0200 [thread overview]
Message-ID: <1542386727-30311-1-git-send-email-andrii.anisov@gmail.com> (raw)
From: Andrii Anisov <andrii_anisov@epam.com>
Avoid excessive conversions between pending_irq and irq number/priority.
This simlifies functions interface and reduces under locks code size.
Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
---
xen/arch/arm/gic-vgic.c | 10 +++-------
xen/arch/arm/vgic-v3-its.c | 2 +-
xen/arch/arm/vgic.c | 6 +++---
xen/include/asm-arm/gic.h | 5 ++---
4 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/xen/arch/arm/gic-vgic.c b/xen/arch/arm/gic-vgic.c
index 990399c..e8e9136 100644
--- a/xen/arch/arm/gic-vgic.c
+++ b/xen/arch/arm/gic-vgic.c
@@ -73,10 +73,8 @@ void gic_remove_from_lr_pending(struct vcpu *v, struct pending_irq *p)
list_del_init(&p->lr_queue);
}
-void gic_raise_inflight_irq(struct vcpu *v, unsigned int virtual_irq)
+void gic_raise_inflight_irq(struct vcpu *v, struct pending_irq *n)
{
- struct pending_irq *n = irq_to_pending(v, virtual_irq);
-
/* If an LPI has been removed meanwhile, there is nothing left to raise. */
if ( unlikely(!n) )
return;
@@ -133,12 +131,10 @@ static unsigned int gic_find_unused_lr(struct vcpu *v,
return lr;
}
-void gic_raise_guest_irq(struct vcpu *v, unsigned int virtual_irq,
- unsigned int priority)
+void gic_raise_guest_irq(struct vcpu *v, struct pending_irq *p)
{
int i;
unsigned int nr_lrs = gic_get_nr_lrs();
- struct pending_irq *p = irq_to_pending(v, virtual_irq);
ASSERT(spin_is_locked(&v->arch.vgic.lock));
@@ -227,7 +223,7 @@ static void gic_update_one_lr(struct vcpu *v, int i)
if ( test_bit(GIC_IRQ_GUEST_ENABLED, &p->status) &&
test_bit(GIC_IRQ_GUEST_QUEUED, &p->status) &&
!test_bit(GIC_IRQ_GUEST_MIGRATING, &p->status) )
- gic_raise_guest_irq(v, irq, p->priority);
+ gic_raise_guest_irq(v, p);
else {
list_del_init(&p->inflight);
/*
diff --git a/xen/arch/arm/vgic-v3-its.c b/xen/arch/arm/vgic-v3-its.c
index 5b73c4e..193a28f 100644
--- a/xen/arch/arm/vgic-v3-its.c
+++ b/xen/arch/arm/vgic-v3-its.c
@@ -447,7 +447,7 @@ static void update_lpi_vgic_status(struct vcpu *v, struct pending_irq *p)
{
if ( !list_empty(&p->inflight) &&
!test_bit(GIC_IRQ_GUEST_VISIBLE, &p->status) )
- gic_raise_guest_irq(v, p->irq, p->lpi_priority);
+ gic_raise_guest_irq(v, p);
}
else
gic_remove_from_lr_pending(v, p);
diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index 5a4f082..628a34f 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -403,7 +403,7 @@ void vgic_enable_irqs(struct vcpu *v, uint32_t r, int n)
p = irq_to_pending(v_target, irq);
set_bit(GIC_IRQ_GUEST_ENABLED, &p->status);
if ( !list_empty(&p->inflight) && !test_bit(GIC_IRQ_GUEST_VISIBLE, &p->status) )
- gic_raise_guest_irq(v_target, irq, p->priority);
+ gic_raise_guest_irq(v_target, p);
spin_unlock_irqrestore(&v_target->arch.vgic.lock, flags);
if ( p->desc != NULL )
{
@@ -568,7 +568,7 @@ void vgic_inject_irq(struct domain *d, struct vcpu *v, unsigned int virq,
if ( !list_empty(&n->inflight) )
{
- gic_raise_inflight_irq(v, virq);
+ gic_raise_inflight_irq(v, n);
goto out;
}
@@ -577,7 +577,7 @@ void vgic_inject_irq(struct domain *d, struct vcpu *v, unsigned int virq,
/* the irq is enabled */
if ( test_bit(GIC_IRQ_GUEST_ENABLED, &n->status) )
- gic_raise_guest_irq(v, virq, priority);
+ gic_raise_guest_irq(v, n);
list_for_each_entry ( iter, &v->arch.vgic.inflight_irqs, inflight )
{
diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h
index fab02f1..1859416 100644
--- a/xen/include/asm-arm/gic.h
+++ b/xen/include/asm-arm/gic.h
@@ -252,9 +252,8 @@ int gic_remove_irq_from_guest(struct domain *d, unsigned int virq,
extern void gic_clear_pending_irqs(struct vcpu *v);
extern void init_maintenance_interrupt(void);
-extern void gic_raise_guest_irq(struct vcpu *v, unsigned int irq,
- unsigned int priority);
-extern void gic_raise_inflight_irq(struct vcpu *v, unsigned int virtual_irq);
+extern void gic_raise_guest_irq(struct vcpu *v, struct pending_irq *p);
+extern void gic_raise_inflight_irq(struct vcpu *v, struct pending_irq *n);
/* Accept an interrupt from the GIC and dispatch its handler */
extern void gic_interrupt(struct cpu_user_regs *regs, int is_fiq);
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next reply other threads:[~2018-11-16 16:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-16 16:45 Andrii Anisov [this message]
2018-11-16 17:27 ` [PATCH] gic:vgic: avoid excessive conversions Julien Grall
2018-11-19 12:02 ` Andrii Anisov
2018-11-19 13:54 ` Julien Grall
2018-11-19 15:48 ` Andrii Anisov
2018-11-20 11:09 ` Andrii Anisov
2018-12-19 10:49 ` Andrii Anisov
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=1542386727-30311-1-git-send-email-andrii.anisov@gmail.com \
--to=andrii.anisov@gmail.com \
--cc=andrii_anisov@epam.com \
--cc=julien.grall@arm.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.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).