From: "Jiaxun Yang" <jiaxun.yang@flygoat.com>
To: "Bibo Mao" <maobibo@loongson.cn>,
"Huacai Chen" <chenhuacai@kernel.org>,
"Xuerui Wang" <kernel@xen0n.name>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Viresh Kumar" <viresh.kumar@linaro.org>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Thomas Bogendoerfer" <tsbogend@alpha.franken.de>
Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org,
"linux-mips@vger.kernel.org" <linux-mips@vger.kernel.org>,
kvm@vger.kernel.org
Subject: Re: [PATCH v3 3/4] LoongArch: Extract IOCSR definitions to standalone header
Date: Sat, 14 Sep 2024 11:27:44 +0100 [thread overview]
Message-ID: <5e29630b-36ec-4f9e-a7d8-d8afa29150d1@app.fastmail.com> (raw)
In-Reply-To: <147e72c9-8177-9c03-8baf-df7362143cd6@loongson.cn>
在2024年9月14日九月 上午9:56,maobibo写道:
> Hi jiaxun,
Hi Bibo,
Thanks for your comments.
[...]
>> +
>> +#define LOONGSON_IOCSR_FEATURES 0x8
>> +#define IOCSRF_TEMP BIT_ULL(0)
>> +#define IOCSRF_NODECNT BIT_ULL(1)
>> +#define IOCSRF_MSI BIT_ULL(2)
>> +#define IOCSRF_EXTIOI BIT_ULL(3)
>> +#define IOCSRF_CSRIPI BIT_ULL(4)
>> +#define IOCSRF_FREQCSR BIT_ULL(5)
>> +#define IOCSRF_FREQSCALE BIT_ULL(6)
>> +#define IOCSRF_DVFSV1 BIT_ULL(7)
>> +#define IOCSRF_EIODECODE BIT_ULL(9)
>> +#define IOCSRF_FLATMODE BIT_ULL(10)
>> +#define IOCSRF_VM BIT_ULL(11)
>> +#define IOCSRF_AVEC BIT_ULL(15)
> Is these definiton the same between Loongson3 mips and LoongArch machine
> such as IOCSRF_FLATMODE/IOCSRF_AVEC?
Those bits are only defined on LoongArch based loongson3, and will be zero
on MIPS loongson3 systems. Zero means hardware doesn't have such feature,
this is still semantically correct.
Given that there will be no more future MIPS loongson3 it makes sense to
just define them in common header.
>
[...]
>> +
>> +/* PerCore CSR, only accessible by local cores */
>> +#define LOONGSON_IOCSR_IPI_STATUS 0x1000
>> +#define LOONGSON_IOCSR_IPI_EN 0x1004
>> +#define LOONGSON_IOCSR_IPI_SET 0x1008
>> +#define LOONGSON_IOCSR_IPI_CLEAR 0x100c
>> +#define LOONGSON_IOCSR_MBUF0 0x1020
>> +#define LOONGSON_IOCSR_MBUF1 0x1028
>> +#define LOONGSON_IOCSR_MBUF2 0x1030
>> +#define LOONGSON_IOCSR_MBUF3 0x1038
> It seems that it is only used with arch/loongarch/kernel/smp.c,
> and file smp.c is arch specific. No generic driver uses this.
Yes, but arch/mips/loongson64/smp.c are using those bits as well,
and will be converted in next patch.
Just FYI, I'm now trying to implement a common SMP IPI driver for
MIPS/LoongArch Loongson chips, there is a preview [1].
>
>> +
[...]
>> +
>> +/* Register offset and bit definition for CSR access */
>> +#define LOONGSON_IOCSR_TIMER_CFG 0x1060
>> +#define LOONGSON_IOCSR_TIMER_TICK 0x1070
>> +#define IOCSR_TIMER_CFG_RESERVED (_ULCAST_(1) << 63)
>> +#define IOCSR_TIMER_CFG_PERIODIC (_ULCAST_(1) << 62)
>> +#define IOCSR_TIMER_CFG_EN (_ULCAST_(1) << 61)
>> +#define IOCSR_TIMER_MASK 0x0ffffffffffffULL
>> +#define IOCSR_TIMER_INITVAL_RST (_ULCAST_(0xffff) << 48)
> I do not find any use about IOCSR_TIMER macro, which does ip driver use
> this?
So IOCSR timer is obsoleted by LoongArch's architecture timer, but still
present on at least 3A5000 for compatibility reason. We may write a driver
for it at some point.
It is common practice that hardware headers contains those bits that are not used
by drivers yet to serve as a document to the hardware.
>
>> +
>> +#define LOONGSON_IOCSR_EXTIOI_NODEMAP_BASE 0x14a0
>> +#define LOONGSON_IOCSR_EXTIOI_IPMAP_BASE 0x14c0
>> +#define LOONGSON_IOCSR_EXTIOI_EN_BASE 0x1600
>> +#define LOONGSON_IOCSR_EXTIOI_BOUNCE_BASE 0x1680
>> +#define LOONGSON_IOCSR_EXTIOI_ISR_BASE 0x1800
>> +#define LOONGSON_IOCSR_EXTIOI_ROUTE_BASE 0x1c00
>> +#define IOCSR_EXTIOI_VECTOR_NUM 256
> Is it better to define these macro in common header file or in extioi
> driver? It seems that only extioi use it.
Maybe :-) This is a little bit out of scope of this series but I can try
later.
Thanks
[...]
[1]: https://github.com/FlyGoat/linux/commit/0a5ee611529d359b4d22eaae22c2b9835c63c63f
--
- Jiaxun
next prev parent reply other threads:[~2024-09-14 10:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-13 20:32 [PATCH v3 0/4] LoongArch, MIPS: Unify Loongson IOCSR handling Jiaxun Yang
2024-09-13 20:32 ` [PATCH v3 1/4] LoongArch: Probe more CPU features from CPUCFG Jiaxun Yang
2024-09-13 20:32 ` [PATCH v3 2/4] LoongArch: cpu-probe: Move IOCSR probing out of cpu_probe_common Jiaxun Yang
2024-09-13 20:32 ` [PATCH v3 3/4] LoongArch: Extract IOCSR definitions to standalone header Jiaxun Yang
2024-09-14 8:56 ` maobibo
2024-09-14 10:27 ` Jiaxun Yang [this message]
2024-09-13 20:32 ` [PATCH v3 4/4] MIPS: Loongson64: Use shared IOCSR header Jiaxun Yang
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=5e29630b-36ec-4f9e-a7d8-d8afa29150d1@app.fastmail.com \
--to=jiaxun.yang@flygoat.com \
--cc=chenhuacai@kernel.org \
--cc=kernel@xen0n.name \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=maobibo@loongson.cn \
--cc=rafael@kernel.org \
--cc=tglx@linutronix.de \
--cc=tsbogend@alpha.franken.de \
--cc=viresh.kumar@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
all inboxes | Powered by JetHome®