From: Stafford Horne <shorne@gmail.com>
To: Sahil Siddiq <icegambit91@gmail.com>
Cc: Linux OpenRISC <linux-openrisc@vger.kernel.org>
Subject: Re: Contributing to OpenRISC Linux
Date: Sat, 25 Jan 2025 07:30:43 +0000 [thread overview]
Message-ID: <Z5STI5WUqCXPwcNF@antec> (raw)
In-Reply-To: <1052b18b-7524-49b4-8ac2-22031bf90d4b@gmail.com>
On Thu, Jan 23, 2025 at 12:25:59AM +0530, Sahil Siddiq wrote:
> Hi,
>
> On 1/13/25 12:01 PM, Stafford Horne wrote:
> > On Mon, Jan 13, 2025 at 11:42:08AM +0530, Sahil Siddiq wrote:
> > > Hi,
> > >
> > > Thank you for your reply.
> > >
> > > On 1/12/25 12:58 PM, Stafford Horne wrote:
> > > > Hi Sunil,
> > > >
> > > > +CC List
> > > >
> > > > yes, the cacheinfo task is still open. There are many things that are still not
> > > > implemented in OpenRISC, you can always just look under the kernel
> > > > Documentation/features.
> > > >
> > > > For example:
> > > >
> > > > < shorne@antec ~/work/linux > grep -r -e openrisc.*TODO Documentation/features | column -t
> > > > Documentation/features/vm/huge-vmap/arch-support.txt: | openrisc: | TODO |
> > > > Documentation/features/vm/ELF-ASLR/arch-support.txt: | openrisc: | TODO |
> > > > Documentation/features/vm/ioremap_prot/arch-support.txt: | openrisc: | TODO |
> > > > Documentation/features/vm/pte_special/arch-support.txt: | openrisc: | TODO |
> > > > Documentation/features/perf/kprobes-event/arch-support.txt: | openrisc: | TODO |
> > > > ...
> > >
> > > Got it. I did find this list in the online documentation [1] but I couldn't find
> > > the cacheinfo task listed there.
> >
> > Right, not all features have config flags that are documented.
> >
>
> Understood. Do you know how one finds these flags? I wasn't able
> to find much related to cpu or caches in arch/openrisc/Kconfig [1].
> I did find the usage of ARCH_HAS_CPU_CACHE_ALIASING in
> include/linux/cacheinfo.h [2]. I am not sure if this is relevant.
Not all features are enabled using ARCH_ flags. The cacheinfo apis are always
enabled and compiled, even for or1k now. But if we look, we see the default
implementation is defined with __weak symbols:
drivers/base/cacheinfo.c
include/linux/cacheinfo.h
int __weak init_cache_level(unsigned int cpu)
{
return -ENOENT;
}
int __weak populate_cache_leaves(unsigned int cpu)
{
return -ENOENT;
}
In order for us to add support I think all we will need to do is define these
functions under arch/openrisc.
We can look to cpuinfo_or1k for how in openrisc we can pull cache details from
the UPR registers in (we can maybe just get the info from the cpuinfo_or1k
structure):
arch/openrisc/kernel/setup.c
You can read about the background of the cacheinfo work and motivations in the
original patch series:
https://lore.kernel.org/all/1412084912-2767-1-git-send-email-sudeep.holla@arm.com/
> > > > How far have you come with OpenRISC so far? If you haven't already I suggest
> > > > working through:
> > > >
> > > > - Get a simulator, I use QEMU for most development as it's faster and supports
> > > > more memory than most FPGA. Final verification can be done on an FPGA.
> > > > - Get a working compiler toolchain.
> > > > - Compile and boot the openrisc kernel.
> > > > - Build a userspace environment, either buildroot, toybox or busybox.
> > > >
> > > > I have some tools to help with this in or1k-utils [1], also there are prebuilt
> > > > environments and docs in the linux kernel [2] and qemu [3].
> > >
> > > I don't have an environment set up yet. I'll start with the steps above. I'll use
> > > QEMU for development. I don't have an FPGA with me currently.
>
> I have set up a fairly basic environment. I built both QEMU and
> openrisc-linux from the master branch. I used a prebuilt compiler
> toolchain to build openrisc-linux and busybox, and manually
> created an initramfs image. I used the default configuration
> options to build linux.
>
> The userspace environment only has utilities that are provided
> by busybox. Only the following filesystems have been mounted -
> rootfs, devtmpfs, sys, proc and tmpfs.
>
> I tried to understand the workings of some of the scripts in
> or1k-utils. There were a few things that I didn't understand
> and I'll need some more time to wrap my head around them. I
> don't think this should hinder the cacheinfo task though.
>
> Is there anything else that I'll need to set up in the environment
> before progressing?
I think its a good start. As long as /sys is available in your environment
it should be enough for you to test your changes.
> I don't see any cache-related info in /sys. Based on what I have
> understood, it'll be possible to fetch these details once cacheinfo
> is supported.
On my x86 machine I see:
$ tree /sys/devices/system/cpu/cpu0/cache/
/sys/devices/system/cpu/cpu0/cache/
├── index0
│ ├── coherency_line_size
│ ├── id
│ ├── level
│ ├── number_of_sets
│ ├── physical_line_partition
│ ├── shared_cpu_list
On or1k I only see (no cache info yet):
$ tree /sys/devices/system/cpu/cpu0/
/sys/devices/system/cpu/cpu0/
|-- of_node -> ../../../../firmware/devicetree/base/cpus/cpu@0
|-- subsystem -> ../../../../bus/cpu
|-- topology
| |-- core_cpus
| |-- core_cpus_list
| |-- core_id
| |-- core_siblings
| |-- core_siblings_list
| |-- package_cpus
| |-- package_cpus_list
| |-- physical_package_id
| |-- thread_siblings
| `-- thread_siblings_list
`-- uevent
But we do have some cache info available via cpuinfo:
$ cat /proc/cpuinfo | head -n16
processor : 0
cpu : OpenRISC-13
revision : 8
frequency : 20000000
dcache size : 256 bytes
dcache block size : 16 bytes
dcache ways : 1
icache size : 32 bytes
icache block size : 16 bytes
icache ways : 2
immu : 128 entries, 1 ways
dmmu : 128 entries, 1 ways
bogomips : 40.00
features : orbis32 orfpx32
> > > > At the momoment, I am also thinking of what to work on next for OpenRISC, there is:
> > > >
> > > > - kexec
> > > > - jump_label
> > > > - kprobes
> > > > - perf_events
> > > > - ftrace
> > >
> > > Is the virtio task [2] also still a part of the roadmap? I can't find that either
> > > in the TODO list.
> >
> > The virtio task is still possible but will be more advanced and may need some
> > architecture changes to support hypervisors.
>
> Got it.
I am slowly working on kexec support right now.
-Stafford
next prev parent reply other threads:[~2025-01-25 7:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <2613c1c6-2a2f-4ceb-8adb-f819961ec61f@gmail.com>
2025-01-12 7:28 ` Contributing to OpenRISC Linux Stafford Horne
2025-01-13 6:12 ` Sahil Siddiq
2025-01-13 6:31 ` Stafford Horne
2025-01-22 18:55 ` Sahil Siddiq
2025-01-25 7:30 ` Stafford Horne [this message]
2025-01-25 10:53 ` Stafford Horne
2025-01-26 19:54 ` Sahil Siddiq
2025-02-12 15:29 ` Queries regarding OpenRISC CPU cache Sahil Siddiq
2025-02-18 19:38 ` Sahil Siddiq
2025-02-20 6:12 ` Stafford Horne
2025-02-22 11:35 ` Sahil Siddiq
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=Z5STI5WUqCXPwcNF@antec \
--to=shorne@gmail.com \
--cc=icegambit91@gmail.com \
--cc=linux-openrisc@vger.kernel.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 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.