From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Bibo Mao <maobibo@loongson.cn>,
Paolo Bonzini <pbonzini@redhat.com>,
Jiaxun Yang <jiaxun.yang@flygoat.com>,
Song Gao <gaosong@loongson.cn>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH v2 1/4] hw/intc/loongson_ipi_common: Add loongson ipi common class
Date: Mon, 15 Jul 2024 17:31:13 +0200 [thread overview]
Message-ID: <3cf8df41-f5b2-49b2-be0f-28c96c0e638f@linaro.org> (raw)
In-Reply-To: <20240704033802.3838618-2-maobibo@loongson.cn>
On 4/7/24 05:37, Bibo Mao wrote:
> Loongson ipi common class and instance is created here, it comes
> from file loongson_ipi mostly. For the new added loongson ipi
> common class, there is four interfaces defined here:
> 1. Interfaces pre_save/post_load are used for future kvm child class
> 2. Interface get_iocsr_as can be used for different architectures,
> now MIPS 3A4000 and LoongArch 3A5000 machine use this ip, can inherit
> this common class.
> 3. Interace cpu_by_arch_id is added, by default generic function
> cpu_by_arch_id() is used to search vcpu from physical cpuid, it is
> generic searching method. Different machine may define other search
> methods such binary searching method.
>
> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
> ---
> hw/intc/loongson_ipi_common.c | 394 ++++++++++++++++++++++++++
> include/hw/intc/loongson_ipi_common.h | 77 +++++
> 2 files changed, 471 insertions(+)
> create mode 100644 hw/intc/loongson_ipi_common.c
> create mode 100644 include/hw/intc/loongson_ipi_common.h
> +static MemTxResult send_ipi_data(LoongsonIPICommonState *ipi, CPUState *cpu,
> + uint64_t val,
> + hwaddr addr, MemTxAttrs attrs)
> +{
> + int i, mask = 0, data = 0;
> + AddressSpace *iocsr_as;
> + LoongsonIPICommonClass *licc = LOONGSON_IPI_COMMON_GET_CLASS(ipi);
> +
> + iocsr_as = NULL;
> + if (licc->get_iocsr_as) {
> + iocsr_as = licc->get_iocsr_as(cpu);
> + }
> +
> + if (!iocsr_as) {
> + return MEMTX_DECODE_ERROR;
> + }
> +
> + /*
> + * bit 27-30 is mask for byte writing,
> + * if the mask is 0, we need not to do anything.
> + */
> + if ((val >> 27) & 0xf) {
> + data = address_space_ldl_le(iocsr_as, addr, attrs, NULL);
Adding/removing files make noticing the uncommented changes very hard
(see my v3).
Here you use little-endian instead of host one. This device is L-E only
so this makes sense, but I'd have appreciate at least a comment about
it.
> + for (i = 0; i < 4; i++) {
> + /* get mask for byte writing */
> + if (val & (0x1 << (27 + i))) {
> + mask |= 0xff << (i * 8);
> + }
> + }
> + }
> +
> + data &= mask;
> + data |= (val >> 32) & ~mask;
> + address_space_stl_le(iocsr_as, addr, data, attrs, NULL);
Ditto.
> + return MEMTX_OK;
> +}
next prev parent reply other threads:[~2024-07-15 15:32 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-04 3:37 [PATCH v2 0/4] Reconstruct loongson ipi driver Bibo Mao
2024-07-04 3:37 ` [PATCH v2 1/4] hw/intc/loongson_ipi_common: Add loongson ipi common class Bibo Mao
2024-07-15 15:31 ` Philippe Mathieu-Daudé [this message]
2024-07-16 1:11 ` maobibo
2024-07-04 3:38 ` [PATCH v2 2/4] hw/intc/loongarch_ipi: Add loongarch ipi support Bibo Mao
2024-07-04 3:38 ` [PATCH v2 3/4] hw/loongarch/virt: Replace loongson ipi with loongarch ipi Bibo Mao
2024-07-04 3:38 ` [PATCH v2 4/4] hw/intc/loongson_ipi: reconstruct driver inherit from common class Bibo Mao
2024-07-09 12:04 ` [PATCH v2 0/4] Reconstruct loongson ipi driver maobibo
2024-07-10 4:00 ` Jiaxun Yang
2024-07-10 6:08 ` maobibo
2024-07-15 15:17 ` Philippe Mathieu-Daudé
2024-07-16 1:04 ` maobibo
2024-07-16 1:29 ` maobibo
2024-07-16 6:40 ` Philippe Mathieu-Daudé
2024-07-17 9:22 ` maobibo
2024-07-17 11:53 ` Jiaxun Yang
2024-07-17 21:41 ` 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=3cf8df41-f5b2-49b2-be0f-28c96c0e638f@linaro.org \
--to=philmd@linaro.org \
--cc=gaosong@loongson.cn \
--cc=jiaxun.yang@flygoat.com \
--cc=maobibo@loongson.cn \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.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).