diff mbox

[v3,3/3] hw/arm/virt-acpi-build: Add PMU IRQ number in ACPI table

Message ID 1461568306-14624-4-git-send-email-zhaoshenglong@huawei.com (mailing list archive)
State New, archived
Headers show

Commit Message

Shannon Zhao April 25, 2016, 7:11 a.m. UTC
From: Shannon Zhao <shannon.zhao@linaro.org>

Add PMU IRQ number in ACPI table, then we can use PMU in guest through
ACPI.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Andrew Jones <drjones@redhat.com>
---
 hw/arm/virt-acpi-build.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Andrew Jones April 25, 2016, 12:42 p.m. UTC | #1
On Mon, Apr 25, 2016 at 03:11:46PM +0800, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
> 
> Add PMU IRQ number in ACPI table, then we can use PMU in guest through
> ACPI.
> 
> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
> Reviewed-by: Andrew Jones <drjones@redhat.com>
> ---
>  hw/arm/virt-acpi-build.c | 3 +++
>  1 file changed, 3 insertions(+)

Question: for testing of this, did you use
https://lkml.org/lkml/2016/4/12/755 ?

Thanks,
drew

> 
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index f51fe39..5031232 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c
> @@ -491,6 +491,9 @@ build_madt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info)
>          gicc->arm_mpidr = armcpu->mp_affinity;
>          gicc->uid = i;
>          gicc->flags = cpu_to_le32(ACPI_GICC_ENABLED);
> +
> +        if (armcpu->has_pmu)
> +            gicc->performance_interrupt = cpu_to_le32(PPI(VIRTUAL_PMU_IRQ));
>      }
>  
>      if (guest_info->gic_version == 3) {
> -- 
> 2.0.4
> 
> 
>
Shannon Zhao April 25, 2016, 1:49 p.m. UTC | #2
On 2016?04?25? 20:42, Andrew Jones wrote:
> On Mon, Apr 25, 2016 at 03:11:46PM +0800, Shannon Zhao wrote:
>> > From: Shannon Zhao <shannon.zhao@linaro.org>
>> > 
>> > Add PMU IRQ number in ACPI table, then we can use PMU in guest through
>> > ACPI.
>> > 
>> > Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
>> > Reviewed-by: Andrew Jones <drjones@redhat.com>
>> > ---
>> >  hw/arm/virt-acpi-build.c | 3 +++
>> >  1 file changed, 3 insertions(+)
> Question: for testing of this, did you use
> https://lkml.org/lkml/2016/4/12/755 ?
Actually I didn't test PMU with ACPI since I didn't notice the patch
series you point out and it's very obvious for QEMU changes(adding irq
flag and irq number in GICC). I will have a test later.

Thanks,
Shannon Zhao April 26, 2016, 11:08 a.m. UTC | #3
On 2016/4/25 21:49, Shannon Zhao wrote:
> On 2016?04?25? 20:42, Andrew Jones wrote:
>> > On Mon, Apr 25, 2016 at 03:11:46PM +0800, Shannon Zhao wrote:
>>>> >> > From: Shannon Zhao <shannon.zhao@linaro.org>
>>>> >> > 
>>>> >> > Add PMU IRQ number in ACPI table, then we can use PMU in guest through
>>>> >> > ACPI.
>>>> >> > 
>>>> >> > Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
>>>> >> > Reviewed-by: Andrew Jones <drjones@redhat.com>
>>>> >> > ---
>>>> >> >  hw/arm/virt-acpi-build.c | 3 +++
>>>> >> >  1 file changed, 3 insertions(+)
>> > Question: for testing of this, did you use
>> > https://lkml.org/lkml/2016/4/12/755 ?
> Actually I didn't test PMU with ACPI since I didn't notice the patch
> series you point out and it's very obvious for QEMU changes(adding irq
> flag and irq number in GICC). I will have a test later.

I have test this patch series using ACPI and guest with the patches you
point out. Guest prints below logs and perf works well in guest.

[    0.000000] ACPI-PMU: Assign CPU 0 girq 23 level 0
[    0.000000] ACPI-PMU: Assign CPU 1 girq 23 level 0
[    0.000000] ACPI-PMU: Assign CPU 2 girq 23 level 0
[    0.000000] ACPI-PMU: Assign CPU 3 girq 23 level 0
[...]
[    0.094782] ACPI-PMU: Setting up 4 PMUs for CPU type D07

Thanks,
Andrew Jones April 26, 2016, 11:18 a.m. UTC | #4
On Tue, Apr 26, 2016 at 07:08:25PM +0800, Shannon Zhao wrote:
> 
> 
> On 2016/4/25 21:49, Shannon Zhao wrote:
> > On 2016?04?25? 20:42, Andrew Jones wrote:
> >> > On Mon, Apr 25, 2016 at 03:11:46PM +0800, Shannon Zhao wrote:
> >>>> >> > From: Shannon Zhao <shannon.zhao@linaro.org>
> >>>> >> > 
> >>>> >> > Add PMU IRQ number in ACPI table, then we can use PMU in guest through
> >>>> >> > ACPI.
> >>>> >> > 
> >>>> >> > Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
> >>>> >> > Reviewed-by: Andrew Jones <drjones@redhat.com>
> >>>> >> > ---
> >>>> >> >  hw/arm/virt-acpi-build.c | 3 +++
> >>>> >> >  1 file changed, 3 insertions(+)
> >> > Question: for testing of this, did you use
> >> > https://lkml.org/lkml/2016/4/12/755 ?
> > Actually I didn't test PMU with ACPI since I didn't notice the patch
> > series you point out and it's very obvious for QEMU changes(adding irq
> > flag and irq number in GICC). I will have a test later.
> 
> I have test this patch series using ACPI and guest with the patches you
> point out. Guest prints below logs and perf works well in guest.
> 
> [    0.000000] ACPI-PMU: Assign CPU 0 girq 23 level 0
> [    0.000000] ACPI-PMU: Assign CPU 1 girq 23 level 0
> [    0.000000] ACPI-PMU: Assign CPU 2 girq 23 level 0
> [    0.000000] ACPI-PMU: Assign CPU 3 girq 23 level 0
> [...]
> [    0.094782] ACPI-PMU: Setting up 4 PMUs for CPU type D07

Thanks for the additional testing Shannon!

drew
diff mbox

Patch

diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index f51fe39..5031232 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -491,6 +491,9 @@  build_madt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info)
         gicc->arm_mpidr = armcpu->mp_affinity;
         gicc->uid = i;
         gicc->flags = cpu_to_le32(ACPI_GICC_ENABLED);
+
+        if (armcpu->has_pmu)
+            gicc->performance_interrupt = cpu_to_le32(PPI(VIRTUAL_PMU_IRQ));
     }
 
     if (guest_info->gic_version == 3) {