diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2018-01-11 21:37:12 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@ozlabs.org> | 2018-01-18 20:10:21 -0500 |
commit | bf4159da4751ab8eea43ca6e7c49193dbce8398c (patch) | |
tree | f388b8cce6117fd8dd3d592dfa18d7d290ea35a9 /arch/powerpc/sysdev/xive/native.c | |
parent | c424c108233dc422a9a29ee833154006a5bdf9fc (diff) |
KVM: PPC: Book3S HV: Enable use of the new XIVE "single escalation" feature
That feature, provided by Power9 DD2.0 and later, when supported
by newer OPAL versions, allows us to sacrifice a queue (priority 7)
in favor of merging all the escalation interrupts of the queues
of a single VP into a single interrupt.
This reduces the number of host interrupts used up by KVM guests
especially when those guests use multiple priorities.
It will also enable a future change to control the masking of the
escalation interrupts more precisely to avoid spurious ones.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Diffstat (limited to 'arch/powerpc/sysdev/xive/native.c')
-rw-r--r-- | arch/powerpc/sysdev/xive/native.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/arch/powerpc/sysdev/xive/native.c b/arch/powerpc/sysdev/xive/native.c index ebc244b08d67..d22aeb0b69e1 100644 --- a/arch/powerpc/sysdev/xive/native.c +++ b/arch/powerpc/sysdev/xive/native.c | |||
@@ -42,6 +42,7 @@ static u32 xive_provision_chip_count; | |||
42 | static u32 xive_queue_shift; | 42 | static u32 xive_queue_shift; |
43 | static u32 xive_pool_vps = XIVE_INVALID_VP; | 43 | static u32 xive_pool_vps = XIVE_INVALID_VP; |
44 | static struct kmem_cache *xive_provision_cache; | 44 | static struct kmem_cache *xive_provision_cache; |
45 | static bool xive_has_single_esc; | ||
45 | 46 | ||
46 | int xive_native_populate_irq_data(u32 hw_irq, struct xive_irq_data *data) | 47 | int xive_native_populate_irq_data(u32 hw_irq, struct xive_irq_data *data) |
47 | { | 48 | { |
@@ -571,6 +572,10 @@ bool __init xive_native_init(void) | |||
571 | break; | 572 | break; |
572 | } | 573 | } |
573 | 574 | ||
575 | /* Do we support single escalation */ | ||
576 | if (of_get_property(np, "single-escalation-support", NULL) != NULL) | ||
577 | xive_has_single_esc = true; | ||
578 | |||
574 | /* Configure Thread Management areas for KVM */ | 579 | /* Configure Thread Management areas for KVM */ |
575 | for_each_possible_cpu(cpu) | 580 | for_each_possible_cpu(cpu) |
576 | kvmppc_set_xive_tima(cpu, r.start, tima); | 581 | kvmppc_set_xive_tima(cpu, r.start, tima); |
@@ -667,12 +672,15 @@ void xive_native_free_vp_block(u32 vp_base) | |||
667 | } | 672 | } |
668 | EXPORT_SYMBOL_GPL(xive_native_free_vp_block); | 673 | EXPORT_SYMBOL_GPL(xive_native_free_vp_block); |
669 | 674 | ||
670 | int xive_native_enable_vp(u32 vp_id) | 675 | int xive_native_enable_vp(u32 vp_id, bool single_escalation) |
671 | { | 676 | { |
672 | s64 rc; | 677 | s64 rc; |
678 | u64 flags = OPAL_XIVE_VP_ENABLED; | ||
673 | 679 | ||
680 | if (single_escalation) | ||
681 | flags |= OPAL_XIVE_VP_SINGLE_ESCALATION; | ||
674 | for (;;) { | 682 | for (;;) { |
675 | rc = opal_xive_set_vp_info(vp_id, OPAL_XIVE_VP_ENABLED, 0); | 683 | rc = opal_xive_set_vp_info(vp_id, flags, 0); |
676 | if (rc != OPAL_BUSY) | 684 | if (rc != OPAL_BUSY) |
677 | break; | 685 | break; |
678 | msleep(1); | 686 | msleep(1); |
@@ -710,3 +718,9 @@ int xive_native_get_vp_info(u32 vp_id, u32 *out_cam_id, u32 *out_chip_id) | |||
710 | return 0; | 718 | return 0; |
711 | } | 719 | } |
712 | EXPORT_SYMBOL_GPL(xive_native_get_vp_info); | 720 | EXPORT_SYMBOL_GPL(xive_native_get_vp_info); |
721 | |||
722 | bool xive_native_has_single_escalation(void) | ||
723 | { | ||
724 | return xive_has_single_esc; | ||
725 | } | ||
726 | EXPORT_SYMBOL_GPL(xive_native_has_single_escalation); | ||