<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/arch/arm64/kernel/fpsimd.c, branch linux-5.16.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.16.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.16.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2021-10-26T09:15:46Z</updated>
<entry>
<title>arm64/sve: Fix warnings when SVE is disabled</title>
<updated>2021-10-26T09:15:46Z</updated>
<author>
<name>Mark Brown</name>
</author>
<published>2021-10-22T14:16:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=04ee53a55543ddc16398391ac95e97e5c9436ba3'/>
<id>urn:sha1:04ee53a55543ddc16398391ac95e97e5c9436ba3</id>
<content type='text'>
In configurations where SVE is disabled we define but never reference the
functions for retrieving the default vector length, causing warnings. Fix
this by move the ifdef up, marking get_default_vl() inline since it is
referenced from code guarded by an IS_ENABLED() check, and do the same for
the other accessors for consistency.

Reported-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Link: https://lore.kernel.org/r/20211022141635.2360415-3-broonie@kernel.org
Signed-off-by: Will Deacon &lt;will@kernel.org&gt;
</content>
</entry>
<entry>
<title>arm64/sve: Track vector lengths for tasks in an array</title>
<updated>2021-10-21T09:18:17Z</updated>
<author>
<name>Mark Brown</name>
</author>
<published>2021-10-19T17:22:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5838a155798479e3fe7e1482a31f0db657d5bbdd'/>
<id>urn:sha1:5838a155798479e3fe7e1482a31f0db657d5bbdd</id>
<content type='text'>
As for SVE we will track a per task SME vector length for tasks. Convert
the existing storage for the vector length into an array and update
fpsimd_flush_task() to initialise this in a function.

Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Link: https://lore.kernel.org/r/20211019172247.3045838-10-broonie@kernel.org
Signed-off-by: Will Deacon &lt;will@kernel.org&gt;
</content>
</entry>
<entry>
<title>arm64/sve: Explicitly load vector length when restoring SVE state</title>
<updated>2021-10-21T09:18:17Z</updated>
<author>
<name>Mark Brown</name>
</author>
<published>2021-10-19T17:22:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ddc806b5c4752d35bdaa4dfa2aaa72785711a3da'/>
<id>urn:sha1:ddc806b5c4752d35bdaa4dfa2aaa72785711a3da</id>
<content type='text'>
Currently when restoring the SVE state we supply the SVE vector length
as an argument to sve_load_state() and the underlying macros. This becomes
inconvenient with the addition of SME since we may need to restore any
combination of SVE and SME vector lengths, and we already separately
restore the vector length in the KVM code. We don't need to know the vector
length during the actual register load since the SME load instructions can
index into the data array for us.

Refactor the interface so we explicitly set the vector length separately
to restoring the SVE registers in preparation for adding SME support, no
functional change should be involved.

Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Link: https://lore.kernel.org/r/20211019172247.3045838-9-broonie@kernel.org
Signed-off-by: Will Deacon &lt;will@kernel.org&gt;
</content>
</entry>
<entry>
<title>arm64/sve: Put system wide vector length information into structs</title>
<updated>2021-10-21T09:18:17Z</updated>
<author>
<name>Mark Brown</name>
</author>
<published>2021-10-19T17:22:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b5bc00ffddc08c20a799514cbcfd2abaa6718014'/>
<id>urn:sha1:b5bc00ffddc08c20a799514cbcfd2abaa6718014</id>
<content type='text'>
With the introduction of SME we will have a second vector length in the
system, enumerated and configured in a very similar fashion to the
existing SVE vector length.  While there are a few differences in how
things are handled this is a relatively small portion of the overall
code so in order to avoid code duplication we factor out

We create two structs, one vl_info for the static hardware properties
and one vl_config for the runtime configuration, with an array
instantiated for each and update all the users to reference these. Some
accessor functions are provided where helpful for readability, and the
write to set the vector length is put into a function since the system
register being updated needs to be chosen at compile time.

This is a mostly mechanical replacement, further work will be required
to actually make things generic, ensuring that we handle those places
where there are differences properly.

Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Link: https://lore.kernel.org/r/20211019172247.3045838-8-broonie@kernel.org
Signed-off-by: Will Deacon &lt;will@kernel.org&gt;
</content>
</entry>
<entry>
<title>arm64/sve: Use accessor functions for vector lengths in thread_struct</title>
<updated>2021-10-21T09:18:17Z</updated>
<author>
<name>Mark Brown</name>
</author>
<published>2021-10-19T17:22:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0423eedcf4e1ba49f262a9e925ad9ab8ad8eaa36'/>
<id>urn:sha1:0423eedcf4e1ba49f262a9e925ad9ab8ad8eaa36</id>
<content type='text'>
In a system with SME there are parallel vector length controls for SVE and
SME vectors which function in much the same way so it is desirable to
share the code for handling them as much as possible. In order to prepare
for doing this add a layer of accessor functions for the various VL related
operations on tasks.

Since almost all current interactions are actually via task-&gt;thread rather
than directly with the thread_info the accessors use that. Accessors are
provided for both generic and SVE specific usage, the generic accessors
should be used for cases where register state is being manipulated since
the registers are shared between streaming and regular SVE so we know that
when SME support is implemented we will always have to be in the appropriate
mode already and hence can generalise now.

Since we are using task_struct and we don't want to cause widespread
inclusion of sched.h the acessors are all out of line, it is hoped that
none of the uses are in a sufficiently critical path for this to be an
issue. Those that are most likely to present an issue are in the same
translation unit so hopefully the compiler may be able to inline anyway.

This is purely adding the layer of abstraction, additional work will be
needed to support tasks using SME.

Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Link: https://lore.kernel.org/r/20211019172247.3045838-7-broonie@kernel.org
Signed-off-by: Will Deacon &lt;will@kernel.org&gt;
</content>
</entry>
<entry>
<title>arm64/sve: Rename find_supported_vector_length()</title>
<updated>2021-10-21T09:18:17Z</updated>
<author>
<name>Mark Brown</name>
</author>
<published>2021-10-19T17:22:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=059613f546b67423a5b49cb6e6fa8b72fbaa4e0b'/>
<id>urn:sha1:059613f546b67423a5b49cb6e6fa8b72fbaa4e0b</id>
<content type='text'>
The function has SVE specific checks in it and it will be more trouble
to add conditional code for SME than it is to simply rename it to be SVE
specific.

Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Link: https://lore.kernel.org/r/20211019172247.3045838-6-broonie@kernel.org
Signed-off-by: Will Deacon &lt;will@kernel.org&gt;
</content>
</entry>
<entry>
<title>arm64/sve: Make access to FFR optional</title>
<updated>2021-10-21T09:18:17Z</updated>
<author>
<name>Mark Brown</name>
</author>
<published>2021-10-19T17:22:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9f5848665788a0f07bc175cb2cdd06d367b7556e'/>
<id>urn:sha1:9f5848665788a0f07bc175cb2cdd06d367b7556e</id>
<content type='text'>
SME introduces streaming SVE mode in which FFR is not present and the
instructions for accessing it UNDEF. In preparation for handling this
update the low level SVE state access functions to take a flag specifying
if FFR should be handled. When saving the register state we store a zero
for FFR to guard against uninitialized data being read. No behaviour change
should be introduced by this patch.

Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Link: https://lore.kernel.org/r/20211019172247.3045838-5-broonie@kernel.org
Signed-off-by: Will Deacon &lt;will@kernel.org&gt;
</content>
</entry>
<entry>
<title>arm64/sve: Make sve_state_size() static</title>
<updated>2021-10-21T09:18:17Z</updated>
<author>
<name>Mark Brown</name>
</author>
<published>2021-10-19T17:22:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=12cc2352bfb34dbdf97e51b006c32a8bd0d13bcb'/>
<id>urn:sha1:12cc2352bfb34dbdf97e51b006c32a8bd0d13bcb</id>
<content type='text'>
There are no users outside fpsimd.c so make sve_state_size() static.
KVM open codes an equivalent.

Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Link: https://lore.kernel.org/r/20211019172247.3045838-4-broonie@kernel.org
Signed-off-by: Will Deacon &lt;will@kernel.org&gt;
</content>
</entry>
<entry>
<title>arm64/fp: Reindent fpsimd_save()</title>
<updated>2021-10-21T09:18:16Z</updated>
<author>
<name>Mark Brown</name>
</author>
<published>2021-10-19T17:22:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2d481bd3b6361ed16c3ddeb58537f149623d30a0'/>
<id>urn:sha1:2d481bd3b6361ed16c3ddeb58537f149623d30a0</id>
<content type='text'>
Currently all the active code in fpsimd_save() is inside a check for
TIF_FOREIGN_FPSTATE. Reduce the indentation level by changing to return
from the function if TIF_FOREIGN_FPSTATE is set.

Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Link: https://lore.kernel.org/r/20211019172247.3045838-2-broonie@kernel.org
Signed-off-by: Will Deacon &lt;will@kernel.org&gt;
</content>
</entry>
<entry>
<title>arm64/sve: Use correct size when reinitialising SVE state</title>
<updated>2021-09-16T16:34:46Z</updated>
<author>
<name>Mark Brown</name>
</author>
<published>2021-09-09T16:53:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e35ac9d0b56e9efefaeeb84b635ea26c2839ea86'/>
<id>urn:sha1:e35ac9d0b56e9efefaeeb84b635ea26c2839ea86</id>
<content type='text'>
When we need a buffer for SVE register state we call sve_alloc() to make
sure that one is there. In order to avoid repeated allocations and frees
we keep the buffer around unless we change vector length and just memset()
it to ensure a clean register state. The function that deals with this
takes the task to operate on as an argument, however in the case where we
do a memset() we initialise using the SVE state size for the current task
rather than the task passed as an argument.

This is only an issue in the case where we are setting the register state
for a task via ptrace and the task being configured has a different vector
length to the task tracing it. In the case where the buffer is larger in
the traced process we will leak old state from the traced process to
itself, in the case where the buffer is smaller in the traced process we
will overflow the buffer and corrupt memory.

Fixes: bc0ee4760364 ("arm64/sve: Core task context handling")
Cc: &lt;stable@vger.kernel.org&gt; # 4.15.x
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Link: https://lore.kernel.org/r/20210909165356.10675-1-broonie@kernel.org
Signed-off-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
</content>
</entry>
</feed>
