<feed xmlns='http://www.w3.org/2005/Atom'>
<title>opensbi.git/lib/utils/ipi/aclint_mswi.c, branch v1.6</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.</subtitle>
<id>http://cgit.235523.xyz/opensbi.git/atom/lib/utils/ipi/aclint_mswi.c?h=v1.6</id>
<link rel='self' href='http://cgit.235523.xyz/opensbi.git/atom/lib/utils/ipi/aclint_mswi.c?h=v1.6'/>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/'/>
<updated>2024-11-11T12:48:35Z</updated>
<entry>
<title>lib: sbi_ipi: Move initial IPI clear to sbi_ipi_init()</title>
<updated>2024-11-11T12:48:35Z</updated>
<author>
<name>Samuel Holland</name>
<email>samuel.holland@sifive.com</email>
</author>
<published>2024-10-25T18:59:47Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=693afc818feecdbddb75f5c9ec4b436d56f64208'/>
<id>urn:sha1:693afc818feecdbddb75f5c9ec4b436d56f64208</id>
<content type='text'>
sbi_ipi_init() expects the platform warm init function to clear IPIs
on the local hart, but there is already a generic function to do this.
After this change, none of the existing drivers need a warm init
callback.

Signed-off-by: Samuel Holland &lt;samuel.holland@sifive.com&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
<entry>
<title>lib: sbi_ipi: Make .ipi_clear always target the current hart</title>
<updated>2024-11-11T12:47:15Z</updated>
<author>
<name>Samuel Holland</name>
<email>samuel.holland@sifive.com</email>
</author>
<published>2024-10-25T18:59:46Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=be9752a071475ae1d9e58a2dfcb8e83185fb7ae5'/>
<id>urn:sha1:be9752a071475ae1d9e58a2dfcb8e83185fb7ae5</id>
<content type='text'>
All existing users of this operation target the current hart, and it
seems unlikely that a future user will need to clear the pending IPI
status of a remote hart. Simplify the logic by changing .ipi_clear (and
its wrapper sbi_ipi_raw_clear()) to always operate on the current hart.

This incidentally fixes a bug introduced in commit 78c667b6fc07 ("lib:
sbi: Prefer hartindex over hartid in IPI framework"), which changed the
.ipi_clear parameter from a hartid to a hart index, but failed to update
the warm_init functions to match.

Fixes: 78c667b6fc07 ("lib: sbi: Prefer hartindex over hartid in IPI framework")
Signed-off-by: Samuel Holland &lt;samuel.holland@sifive.com&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
<entry>
<title>lib: utils/ipi: Use sbi_domain_root_add_memrange() for ACLINT mswi</title>
<updated>2024-10-25T17:29:54Z</updated>
<author>
<name>Anup Patel</name>
<email>apatel@ventanamicro.com</email>
</author>
<published>2024-09-20T04:44:46Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=8576ca423403cdff66424d8f360542aafe71c901'/>
<id>urn:sha1:8576ca423403cdff66424d8f360542aafe71c901</id>
<content type='text'>
The sbi_domain_root_add_memrange() should be preferred for creating
multiple memregions over a range. Update ACLINT mswi driver to use
sbi_domain_root_add_memrange() instead of explicitly registering
memregions.

Signed-off-by: Anup Patel &lt;apatel@ventanamicro.com&gt;
Reviewed-by: Samuel Holland &lt;samuel.holland@sifive.com&gt;
</content>
</entry>
<entry>
<title>lib: utils/ipi: Fix hartid wrongly used as hart index</title>
<updated>2024-09-27T05:12:24Z</updated>
<author>
<name>Samuel Holland</name>
<email>samuel.holland@sifive.com</email>
</author>
<published>2024-08-31T02:27:43Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=cae230c93556517c50ba8541303d022f28e8e4ff'/>
<id>urn:sha1:cae230c93556517c50ba8541303d022f28e8e4ff</id>
<content type='text'>
Since commit 78c667b6fc07 ("lib: sbi: Prefer hartindex over hartid in
IPI framework"), The .ipi_clear callback functions take a hart index,
not a hartid. However, these warm_init functions were never updated.

Fixes: 78c667b6fc07 ("lib: sbi: Prefer hartindex over hartid in IPI framework")
Signed-off-by: Samuel Holland &lt;samuel.holland@sifive.com&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
<entry>
<title>lib: sbi: Allow relaxed MMIO writes in device ipi_clear() callback</title>
<updated>2023-11-26T13:15:08Z</updated>
<author>
<name>Anup Patel</name>
<email>apatel@ventanamicro.com</email>
</author>
<published>2023-11-21T10:22:17Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=b70d6285f0f7cbb84619ba1758bb0c6d7620eaef'/>
<id>urn:sha1:b70d6285f0f7cbb84619ba1758bb0c6d7620eaef</id>
<content type='text'>
Currently, there are no barriers before or after the ipi_clear()
device callback which forces ipi_clear() device callback to always
use non-relaxed MMIO writes.

Instead of above, we use wmb() in after the ipi_clear() device
callback which pairs with the wmb() done before the ipi_send()
device callback. This also allows device ipi_clear() callback
to use relaxed MMIO writes.

Signed-off-by: Anup Patel &lt;apatel@ventanamicro.com&gt;
Reported-by: Bo Gan &lt;ganboing@gmail.com&gt;
</content>
</entry>
<entry>
<title>lib: sbi: Allow relaxed MMIO writes in device ipi_send() callback</title>
<updated>2023-11-26T13:15:06Z</updated>
<author>
<name>Anup Patel</name>
<email>apatel@ventanamicro.com</email>
</author>
<published>2023-11-21T09:19:42Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=f520256d03da84e7ff8bddd084ef873192f46304'/>
<id>urn:sha1:f520256d03da84e7ff8bddd084ef873192f46304</id>
<content type='text'>
Currently, we have a smp_wmb() between atomic_raw_set_bit() and
ipi_send() device callback whereas the MMIO writes done by the
device ipi_send() callback will also include a barrier.

We can avoid unnecessary/redundant barriers described above by
allowing relaxed MMIO writes in device ipi_send() callback. To
achieve this, we simply use  wmb() instead of smp_wmb() before
calling device ipi_send().

Signed-off-by: Anup Patel &lt;apatel@ventanamicro.com&gt;
Reported-by: Bo Gan &lt;ganboing@gmail.com&gt;
</content>
</entry>
<entry>
<title>lib: sbi: Prefer hartindex over hartid in IPI framework</title>
<updated>2023-09-24T06:09:38Z</updated>
<author>
<name>Anup Patel</name>
<email>apatel@ventanamicro.com</email>
</author>
<published>2023-09-01T12:11:07Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=78c667b6fc07d2ea783fbd18f43a3f8191de6164'/>
<id>urn:sha1:78c667b6fc07d2ea783fbd18f43a3f8191de6164</id>
<content type='text'>
Let us prefer hartindex over hartid in IPI framework which in-turn
forces IPI users to also prefer hartindex.

Signed-off-by: Anup Patel &lt;apatel@ventanamicro.com&gt;
</content>
</entry>
<entry>
<title>lib: utils: Fix sbi_hartid_to_scratch() usage in ACLINT drivers</title>
<updated>2023-07-09T05:34:57Z</updated>
<author>
<name>Anup Patel</name>
<email>apatel@ventanamicro.com</email>
</author>
<published>2023-07-05T06:45:15Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=c6a35733b74aeff612398f274ed19a74f81d1f37'/>
<id>urn:sha1:c6a35733b74aeff612398f274ed19a74f81d1f37</id>
<content type='text'>
The cold_init() functions of ACLINT drivers should skip the HART
if sbi_hartid_to_scratch() returns NULL because we might be dealing
with a HART that is disabled in the device tree.

Signed-off-by: Anup Patel &lt;apatel@ventanamicro.com&gt;
Reviewed-by: Xiang W &lt;wxjstz@126.com&gt;
</content>
</entry>
<entry>
<title>lib: utils/ipi: Use scratch space to save per-HART MSWI pointer</title>
<updated>2023-06-05T10:32:59Z</updated>
<author>
<name>Anup Patel</name>
<email>apatel@ventanamicro.com</email>
</author>
<published>2023-04-19T15:53:53Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=acbd8fce9e5d92f07d344388a3b046f1722ce072'/>
<id>urn:sha1:acbd8fce9e5d92f07d344388a3b046f1722ce072</id>
<content type='text'>
Instead of using a global array indexed by hartid, we should use
scratch space to save per-HART MSWI pointer.

Signed-off-by: Anup Patel &lt;apatel@ventanamicro.com&gt;
Reviewed-by: Andrew Jones &lt;ajones@ventanamicro.com&gt;
</content>
</entry>
<entry>
<title>lib: utils/ipi: buffer overrun aclint_mswi_cold_init</title>
<updated>2023-06-04T09:43:50Z</updated>
<author>
<name>Heinrich Schuchardt</name>
<email>heinrich.schuchardt@canonical.com</email>
</author>
<published>2023-05-29T09:27:20Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=df75e0995689842b3022a4a8d4d69e980430c129'/>
<id>urn:sha1:df75e0995689842b3022a4a8d4d69e980430c129</id>
<content type='text'>
The parameter checks in aclint_mswi_cold_init() don't guard against a
buffer overrun.

mswi_hartid2data is defined as an array of SBI_HARTMASK_MAX_BITS entries.
The current check allows

    mswi-&gt;hart_count = ACLINT_MSWI_MAX_HARTS
    mswi-&gt;first_hartid = SBI_HARTMASK_MAX_BITS - 1.

With these values mswi_hartid2data will be accessed at index

    SBI_HARTMASK_MAX_BITS + SBI_HARTMASK_MAX_BITS - 2.

We have to check the sum of mswi-&gt;first_hartid and mswi-&gt;hart_count.

Furthermore mswi-&gt;hart_count = 0 would not make much sense.

Addresses-Coverity-ID: 1529705 ("Out-of-bounds write")
Fixes: 5a049fe1d6a5 ("lib: utils/ipi: Add ACLINT MSWI library")
Signed-off-by: Heinrich Schuchardt &lt;heinrich.schuchardt@canonical.com&gt;
Reviewed-by: Xiang W &lt;wxjstz@126.com&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
</feed>
