qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Jiaxun Yang" <jiaxun.yang@flygoat.com>
To: "Bibo Mao" <maobibo@loongson.cn>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	gaosong <gaosong@loongson.cn>,
	"QEMU devel" <qemu-devel@nongnu.org>
Cc: "Huacai Chen" <chenhuacai@kernel.org>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Peter Maydell" <peter.maydell@linaro.org>
Subject: Re: [PATCH v3 1/4] hw/intc: Remove loongarch_ipi.c
Date: Mon, 01 Jul 2024 09:29:30 +0100	[thread overview]
Message-ID: <dd0754c2-2a42-4cf4-8c23-eb7a1ca100b5@app.fastmail.com> (raw)
In-Reply-To: <c817c31b-3f22-da1a-c110-4873e1a36eab@loongson.cn>



在2024年7月1日七月 上午8:22,maobibo写道:
> On 2024/7/1 下午3:01, Jiaxun Yang wrote:
>> 
>> 
>> 在2024年7月1日七月 上午7:44,maobibo写道:
>>> Also this patch is problematic on LoongArch.
>>>
>>> The original patch is to search physical cpuid rather than logic cpuid.
>>>
>>> We want to make ipi module better and better, however now it comes back
>>> to initial state at the beginning :(
>> 
>> Isn't arch_id the "physical id" you want? "cs->cpu_index" is the logical ID
>> for QEMU.
>> 
>> arch_id is setup by arch code, like APIC ID for x86.
>> 
>> I had come across the old ipi_getcpu  implementation, and I'm sure we were
>> looking at arch_id as well.
> So, where is implementation code for function get_arch_id() looking for 
> vcpu with physical index?

Hi Bibo,

cpu_by_arch_id will be redirected to:

```
CPUState *cpu_by_arch_id(int64_t id)
{
    CPUState *cpu;

    CPU_FOREACH(cpu) {
        CPUClass *cc = CPU_GET_CLASS(cpu);

        if (cc->get_arch_id(cpu) == id) {
            return cpu;
        }
    }
    return NULL;
}
```

It iterates over all vcpus and return CPUStates with corresponding arch_id.

Whereas, for LoongArch's get_arch_id implementation:
```
static int64_t loongarch_cpu_get_arch_id(CPUState *cs)
{
    LoongArchCPU *cpu = LOONGARCH_CPU(cs);

    return cpu->phy_id;
}
```
I believe it matches our intension here.

Thanks

>
> Regards
> Bibo Mao
>
>> 
>> Thanks
>> - Jiaxun
>>>
>>> commit 03ca348b6b9038ce284916b36c19f700ac0ce7a6
>>> Author: Jiaxun Yang <jiaxun.yang@flygoat.com>
>>> Date:   Wed Jun 5 10:04:27 2024
>>>
>>>       hw/intc/loongson_ipi: Replace ipi_getcpu with cpu_by_arch_id
>>>
>>>       cpu_by_arch_id is doing the same thing as our ipi_getcpu logic.
>>>
>>>       Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
>>>       Reviewed-by: Song Gao <gaosong@loongson.cn>
>>>       Message-ID: <20240605-loongson3-ipi-v3-4-ddd2c0e03fa3@flygoat.com>
>>>       Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>>>
>>>
>>> Regards
>>> Bibo Mao
>>>

-- 
- Jiaxun


  reply	other threads:[~2024-07-01  8:30 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-05  2:15 [PATCH v3 0/4] hw/mips/loongson3_virt: Implement IPI support Jiaxun Yang
2024-06-05  2:15 ` [PATCH v3 1/4] hw/intc: Remove loongarch_ipi.c Jiaxun Yang
2024-06-05  3:32   ` gaosong
2024-06-18 11:09   ` Philippe Mathieu-Daudé
2024-06-26  4:11   ` maobibo
2024-06-26  7:40     ` Jiaxun Yang
2024-06-26  7:51       ` maobibo
2024-06-26 10:03         ` Jiaxun Yang
2024-06-26 12:10     ` Philippe Mathieu-Daudé
2024-06-27  2:44       ` gaosong
2024-06-27 13:02         ` Philippe Mathieu-Daudé
2024-07-01  1:35           ` maobibo
2024-07-01  6:44             ` maobibo
2024-07-01  7:01               ` Jiaxun Yang
2024-07-01  7:22                 ` maobibo
2024-07-01  8:29                   ` Jiaxun Yang [this message]
2024-07-01  8:51                     ` maobibo
2024-07-01  7:08             ` Jiaxun Yang
2024-07-01  7:24               ` maobibo
2024-06-05  2:15 ` [PATCH v3 2/4] hw/intc/loongson_ipi: Provide per core MMIO address spaces Jiaxun Yang
2024-06-05  2:15 ` [PATCH v3 3/4] hw/mips/loongson3_virt: Wire up loongson_ipi device Jiaxun Yang
2024-06-18 11:17   ` Philippe Mathieu-Daudé
2024-06-18 11:24     ` Philippe Mathieu-Daudé
2024-06-05  2:15 ` [PATCH v3 4/4] hw/intc/loongson_ipi: Replace ipi_getcpu with cpu_by_arch_id Jiaxun Yang
2024-06-05  3:33   ` gaosong
2024-06-12 12:09 ` [PATCH v3 0/4] hw/mips/loongson3_virt: Implement IPI support Jiaxun Yang
2024-06-18 11:49   ` Philippe Mathieu-Daudé

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=dd0754c2-2a42-4cf4-8c23-eb7a1ca100b5@app.fastmail.com \
    --to=jiaxun.yang@flygoat.com \
    --cc=chenhuacai@kernel.org \
    --cc=gaosong@loongson.cn \
    --cc=maobibo@loongson.cn \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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).