All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Some trivial fixes
@ 2020-04-13  9:15 Keqian Zhu
  2020-04-13  9:15 ` [PATCH 1/3] bugfix: Use gicr_typer in arm_gicv3_icc_reset Keqian Zhu
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Keqian Zhu @ 2020-04-13  9:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Michael S . Tsirkin, qemu-arm, Igor Mammedov,
	wanghaibin.wang, Keqian Zhu

Hi all,

This patch-set contains trivial bugfix and typo fix.

Thanks,
Keqian

Keqian Zhu (3):
  bugfix: Use gicr_typer in arm_gicv3_icc_reset
  intc/gicv3_kvm: use kvm_gicc_access to get ICC_CTLR_EL1
  Typo: Correct the name of CPU hotplug memory region

 hw/acpi/cpu.c           | 2 +-
 hw/intc/arm_gicv3_kvm.c | 7 ++-----
 2 files changed, 3 insertions(+), 6 deletions(-)

-- 
2.19.1



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] bugfix: Use gicr_typer in arm_gicv3_icc_reset
  2020-04-13  9:15 [PATCH 0/3] Some trivial fixes Keqian Zhu
@ 2020-04-13  9:15 ` Keqian Zhu
  2020-04-13  9:15 ` [PATCH 2/3] intc/gicv3_kvm: use kvm_gicc_access to get ICC_CTLR_EL1 Keqian Zhu
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Keqian Zhu @ 2020-04-13  9:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Michael S . Tsirkin, qemu-arm, Igor Mammedov,
	wanghaibin.wang, Keqian Zhu

The KVM_VGIC_ATTR macro expect the second parameter as gicr_typer,
of which high 32bit is constructed by mp_affinity. For most case,
the high 32bit of mp_affinity is zero, so it will always access the
ICC_CTLR_EL1 of CPU0.

Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
---
 hw/intc/arm_gicv3_kvm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c
index 49304ca589..ca43bf87ca 100644
--- a/hw/intc/arm_gicv3_kvm.c
+++ b/hw/intc/arm_gicv3_kvm.c
@@ -658,13 +658,11 @@ static void kvm_arm_gicv3_get(GICv3State *s)
 
 static void arm_gicv3_icc_reset(CPUARMState *env, const ARMCPRegInfo *ri)
 {
-    ARMCPU *cpu;
     GICv3State *s;
     GICv3CPUState *c;
 
     c = (GICv3CPUState *)env->gicv3state;
     s = c->gic;
-    cpu = ARM_CPU(c->cpu);
 
     c->icc_pmr_el1 = 0;
     c->icc_bpr[GICV3_G0] = GIC_MIN_BPR;
@@ -681,7 +679,7 @@ static void arm_gicv3_icc_reset(CPUARMState *env, const ARMCPRegInfo *ri)
 
     /* Initialize to actual HW supported configuration */
     kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS,
-                      KVM_VGIC_ATTR(ICC_CTLR_EL1, cpu->mp_affinity),
+                      KVM_VGIC_ATTR(ICC_CTLR_EL1, c->gicr_typer),
                       &c->icc_ctlr_el1[GICV3_NS], false, &error_abort);
 
     c->icc_ctlr_el1[GICV3_S] = c->icc_ctlr_el1[GICV3_NS];
-- 
2.19.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] intc/gicv3_kvm: use kvm_gicc_access to get ICC_CTLR_EL1
  2020-04-13  9:15 [PATCH 0/3] Some trivial fixes Keqian Zhu
  2020-04-13  9:15 ` [PATCH 1/3] bugfix: Use gicr_typer in arm_gicv3_icc_reset Keqian Zhu
@ 2020-04-13  9:15 ` Keqian Zhu
  2020-04-17 11:09   ` Peter Maydell
  2020-04-13  9:15 ` [PATCH 3/3] Typo: Correct the name of CPU hotplug memory region Keqian Zhu
  2020-04-17 11:10 ` [PATCH 0/3] Some trivial fixes Peter Maydell
  3 siblings, 1 reply; 7+ messages in thread
From: Keqian Zhu @ 2020-04-13  9:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Michael S . Tsirkin, qemu-arm, Igor Mammedov,
	wanghaibin.wang, Keqian Zhu

Replace kvm_device_access with kvm_gicc_access to simplify
code.

Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
---
 hw/intc/arm_gicv3_kvm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c
index ca43bf87ca..85f6420498 100644
--- a/hw/intc/arm_gicv3_kvm.c
+++ b/hw/intc/arm_gicv3_kvm.c
@@ -678,9 +678,8 @@ static void arm_gicv3_icc_reset(CPUARMState *env, const ARMCPRegInfo *ri)
     }
 
     /* Initialize to actual HW supported configuration */
-    kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS,
-                      KVM_VGIC_ATTR(ICC_CTLR_EL1, c->gicr_typer),
-                      &c->icc_ctlr_el1[GICV3_NS], false, &error_abort);
+    kvm_gicc_access(s, ICC_CTLR_EL1, c->cpu->cpu_index,
+                    &c->icc_ctlr_el1[GICV3_NS], false);
 
     c->icc_ctlr_el1[GICV3_S] = c->icc_ctlr_el1[GICV3_NS];
 }
-- 
2.19.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] Typo: Correct the name of CPU hotplug memory region
  2020-04-13  9:15 [PATCH 0/3] Some trivial fixes Keqian Zhu
  2020-04-13  9:15 ` [PATCH 1/3] bugfix: Use gicr_typer in arm_gicv3_icc_reset Keqian Zhu
  2020-04-13  9:15 ` [PATCH 2/3] intc/gicv3_kvm: use kvm_gicc_access to get ICC_CTLR_EL1 Keqian Zhu
@ 2020-04-13  9:15 ` Keqian Zhu
  2020-04-17 11:10 ` [PATCH 0/3] Some trivial fixes Peter Maydell
  3 siblings, 0 replies; 7+ messages in thread
From: Keqian Zhu @ 2020-04-13  9:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Michael S . Tsirkin, qemu-arm, Igor Mammedov,
	wanghaibin.wang, Keqian Zhu

Replace "acpi-mem-hotplug" with "acpi-cpu-hotplug"

Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
---
 hw/acpi/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c
index e2c957ce00..3d6a500fb7 100644
--- a/hw/acpi/cpu.c
+++ b/hw/acpi/cpu.c
@@ -222,7 +222,7 @@ void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner,
         state->devs[i].arch_id = id_list->cpus[i].arch_id;
     }
     memory_region_init_io(&state->ctrl_reg, owner, &cpu_hotplug_ops, state,
-                          "acpi-mem-hotplug", ACPI_CPU_HOTPLUG_REG_LEN);
+                          "acpi-cpu-hotplug", ACPI_CPU_HOTPLUG_REG_LEN);
     memory_region_add_subregion(as, base_addr, &state->ctrl_reg);
 }
 
-- 
2.19.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] intc/gicv3_kvm: use kvm_gicc_access to get ICC_CTLR_EL1
  2020-04-13  9:15 ` [PATCH 2/3] intc/gicv3_kvm: use kvm_gicc_access to get ICC_CTLR_EL1 Keqian Zhu
@ 2020-04-17 11:09   ` Peter Maydell
  2020-04-18  3:22     ` zhukeqian
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Maydell @ 2020-04-17 11:09 UTC (permalink / raw)
  To: Keqian Zhu
  Cc: wanghaibin.wang, Igor Mammedov, qemu-arm, QEMU Developers,
	Michael S . Tsirkin

On Mon, 13 Apr 2020 at 10:18, Keqian Zhu <zhukeqian1@huawei.com> wrote:
>
> Replace kvm_device_access with kvm_gicc_access to simplify
> code.
>
> Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
> ---
>  hw/intc/arm_gicv3_kvm.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c
> index ca43bf87ca..85f6420498 100644
> --- a/hw/intc/arm_gicv3_kvm.c
> +++ b/hw/intc/arm_gicv3_kvm.c
> @@ -678,9 +678,8 @@ static void arm_gicv3_icc_reset(CPUARMState *env, const ARMCPRegInfo *ri)
>      }
>
>      /* Initialize to actual HW supported configuration */
> -    kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS,
> -                      KVM_VGIC_ATTR(ICC_CTLR_EL1, c->gicr_typer),
> -                      &c->icc_ctlr_el1[GICV3_NS], false, &error_abort);
> +    kvm_gicc_access(s, ICC_CTLR_EL1, c->cpu->cpu_index,
> +                    &c->icc_ctlr_el1[GICV3_NS], false);

This works at the moment, but I'd rather we avoided looking into
cpu->cpu_index inside the GIC code. The cpu_index is the overall
index of the CPU of all CPUs in the system, which is not in
theory the same as "index of this CPU for this GIC". The two
currently match up because arm_gicv3_common_realize() populates
its s->cpu[i].cpu by calling qemu_get_cpu(i), but in future
we might change that code (eg so that the board code has to
explicitly wire up the CPUs to the GIC object by passing
pointers to the CPUs to the GIC via link properties). So I'd
rather not have the internals of the GIC code bake in the
assumption that 'global CPU index is the same as the index
of the CPU for this GIC object'.

(All the other places that call kvm_gicc_access() are doing it
as part of a loop from 0 to n->num_cpus, so they don't have this
issue.)

thanks
-- PMM


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/3] Some trivial fixes
  2020-04-13  9:15 [PATCH 0/3] Some trivial fixes Keqian Zhu
                   ` (2 preceding siblings ...)
  2020-04-13  9:15 ` [PATCH 3/3] Typo: Correct the name of CPU hotplug memory region Keqian Zhu
@ 2020-04-17 11:10 ` Peter Maydell
  3 siblings, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2020-04-17 11:10 UTC (permalink / raw)
  To: Keqian Zhu
  Cc: wanghaibin.wang, Igor Mammedov, qemu-arm, QEMU Developers,
	Michael S . Tsirkin

On Mon, 13 Apr 2020 at 10:18, Keqian Zhu <zhukeqian1@huawei.com> wrote:
>
> Hi all,
>
> This patch-set contains trivial bugfix and typo fix.
>
> Thanks,
> Keqian
>
> Keqian Zhu (3):
>   bugfix: Use gicr_typer in arm_gicv3_icc_reset
>   intc/gicv3_kvm: use kvm_gicc_access to get ICC_CTLR_EL1
>   Typo: Correct the name of CPU hotplug memory region

Thanks for these fixes; I've applied 1 and 3 to target-arm.next
for 5.1. I don't think we should apply patch 2 (I've followed
up to that explaining my thinking.)

-- PMM


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] intc/gicv3_kvm: use kvm_gicc_access to get ICC_CTLR_EL1
  2020-04-17 11:09   ` Peter Maydell
@ 2020-04-18  3:22     ` zhukeqian
  0 siblings, 0 replies; 7+ messages in thread
From: zhukeqian @ 2020-04-18  3:22 UTC (permalink / raw)
  To: Peter Maydell
  Cc: wanghaibin.wang, Igor Mammedov, qemu-arm, QEMU Developers,
	Michael S . Tsirkin

Hi Peter,

On 2020/4/17 19:09, Peter Maydell wrote:
> On Mon, 13 Apr 2020 at 10:18, Keqian Zhu <zhukeqian1@huawei.com> wrote:
>>
>> Replace kvm_device_access with kvm_gicc_access to simplify
>> code.
>>
>> Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
>> ---
>>  hw/intc/arm_gicv3_kvm.c | 5 ++---
>>  1 file changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c
>> index ca43bf87ca..85f6420498 100644
>> --- a/hw/intc/arm_gicv3_kvm.c
>> +++ b/hw/intc/arm_gicv3_kvm.c
>> @@ -678,9 +678,8 @@ static void arm_gicv3_icc_reset(CPUARMState *env, const ARMCPRegInfo *ri)
>>      }
>>
>>      /* Initialize to actual HW supported configuration */
>> -    kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS,
>> -                      KVM_VGIC_ATTR(ICC_CTLR_EL1, c->gicr_typer),
>> -                      &c->icc_ctlr_el1[GICV3_NS], false, &error_abort);
>> +    kvm_gicc_access(s, ICC_CTLR_EL1, c->cpu->cpu_index,
>> +                    &c->icc_ctlr_el1[GICV3_NS], false);
> 
> This works at the moment, but I'd rather we avoided looking into
> cpu->cpu_index inside the GIC code. The cpu_index is the overall
> index of the CPU of all CPUs in the system, which is not in
> theory the same as "index of this CPU for this GIC". The two
> currently match up because arm_gicv3_common_realize() populates
> its s->cpu[i].cpu by calling qemu_get_cpu(i), but in future
> we might change that code (eg so that the board code has to
> explicitly wire up the CPUs to the GIC object by passing
> pointers to the CPUs to the GIC via link properties). So I'd
> rather not have the internals of the GIC code bake in the
> assumption that 'global CPU index is the same as the index
> of the CPU for this GIC object'.
OK, I get it. This patch can be ignored.
> 
> (All the other places that call kvm_gicc_access() are doing it
> as part of a loop from 0 to n->num_cpus, so they don't have this
> issue.)
> 
> thanks
> -- PMM
> 
> .
> 
Thanks,
Keqian



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-04-18  3:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-13  9:15 [PATCH 0/3] Some trivial fixes Keqian Zhu
2020-04-13  9:15 ` [PATCH 1/3] bugfix: Use gicr_typer in arm_gicv3_icc_reset Keqian Zhu
2020-04-13  9:15 ` [PATCH 2/3] intc/gicv3_kvm: use kvm_gicc_access to get ICC_CTLR_EL1 Keqian Zhu
2020-04-17 11:09   ` Peter Maydell
2020-04-18  3:22     ` zhukeqian
2020-04-13  9:15 ` [PATCH 3/3] Typo: Correct the name of CPU hotplug memory region Keqian Zhu
2020-04-17 11:10 ` [PATCH 0/3] Some trivial fixes Peter Maydell

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.