[RFC v4 19/31] hw/arm/smmuv3: Fix CFGI_CD handling when stage-1 is unsupported

Tao Tang posted 31 patches 1 month, 2 weeks ago
Maintainers: Eric Auger <eric.auger@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, "Michael S. Tsirkin" <mst@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
[RFC v4 19/31] hw/arm/smmuv3: Fix CFGI_CD handling when stage-1 is unsupported
Posted by Tao Tang 1 month, 2 weeks ago
Add a STAGE1_SUPPORTED check in the CMD_CFGI_CD and CMD_CFGI_CD_ALL path
and return CERROR_ILL when stage-1 translation is not implemented,
matching the architecture requirement (IHI 0070G.b, page 176).

Fixes: 32cfd7f39e08 ("hw/arm/smmuv3: Cache/invalidate config data")
Signed-off-by: Tao Tang <tangtao1634@phytium.com.cn>
---
 hw/arm/smmuv3.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
index fa09099a09a..d4c58c0c724 100644
--- a/hw/arm/smmuv3.c
+++ b/hw/arm/smmuv3.c
@@ -1461,6 +1461,15 @@ static int smmuv3_cmdq_consume(SMMUv3State *s, Error **errp, SMMUSecSID sec_sid)
                 break;
             }
 
+            /*
+             * This command raises CERROR_ILL when stage 1 is not implemented
+             * according to (IHI 0070G.b) Page 176.
+             */
+            if (!STAGE1_SUPPORTED(s)) {
+                cmd_error = SMMU_CERROR_ILL;
+                break;
+            }
+
             trace_smmuv3_cmdq_cfgi_cd(sid);
             smmuv3_flush_config(sdev);
             if (!smmuv3_accel_issue_inv_cmd(s, &cmd, sdev, errp)) {
-- 
2.34.1
Re: [RFC v4 19/31] hw/arm/smmuv3: Fix CFGI_CD handling when stage-1 is unsupported
Posted by Eric Auger 1 month, 1 week ago

On 2/21/26 11:17 AM, Tao Tang wrote:
> Add a STAGE1_SUPPORTED check in the CMD_CFGI_CD and CMD_CFGI_CD_ALL path
> and return CERROR_ILL when stage-1 translation is not implemented,
> matching the architecture requirement (IHI 0070G.b, page 176).
>
> Fixes: 32cfd7f39e08 ("hw/arm/smmuv3: Cache/invalidate config data")
> Signed-off-by: Tao Tang <tangtao1634@phytium.com.cn>
> ---
>  hw/arm/smmuv3.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
> index fa09099a09a..d4c58c0c724 100644
> --- a/hw/arm/smmuv3.c
> +++ b/hw/arm/smmuv3.c
> @@ -1461,6 +1461,15 @@ static int smmuv3_cmdq_consume(SMMUv3State *s, Error **errp, SMMUSecSID sec_sid)
>                  break;
>              }
>  
> +            /*
> +             * This command raises CERROR_ILL when stage 1 is not implemented
> +             * according to (IHI 0070G.b) Page 176.
> +             */
> +            if (!STAGE1_SUPPORTED(s)) {
> +                cmd_error = SMMU_CERROR_ILL;
> +                break;
> +            }
> +
>              trace_smmuv3_cmdq_cfgi_cd(sid);
>              smmuv3_flush_config(sdev);
>              if (!smmuv3_accel_issue_inv_cmd(s, &cmd, sdev, errp)) {
With the fixed fixes tag,
Reviewed-by: Eric Auger <eric.auger@redhat.com>

Eric
Re: [RFC v4 19/31] hw/arm/smmuv3: Fix CFGI_CD handling when stage-1 is unsupported
Posted by Mostafa Saleh 1 month, 1 week ago
On Sat, Feb 21, 2026 at 06:17:33PM +0800, Tao Tang wrote:
> Add a STAGE1_SUPPORTED check in the CMD_CFGI_CD and CMD_CFGI_CD_ALL path
> and return CERROR_ILL when stage-1 translation is not implemented,
> matching the architecture requirement (IHI 0070G.b, page 176).
> 
> Fixes: 32cfd7f39e08 ("hw/arm/smmuv3: Cache/invalidate config data")
> Signed-off-by: Tao Tang <tangtao1634@phytium.com.cn>

This is a separate fix, it can be sent standalone to make this series
smaller, similarly the first patch.
Also the "Fixes" comment is not accurate, that was probably broken from
the stage-2 implementation which was added later.

Reviewed-by: Mostafa Saleh <smostafa@google.com>

Thanks,
Mostafa

> ---
>  hw/arm/smmuv3.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
> index fa09099a09a..d4c58c0c724 100644
> --- a/hw/arm/smmuv3.c
> +++ b/hw/arm/smmuv3.c
> @@ -1461,6 +1461,15 @@ static int smmuv3_cmdq_consume(SMMUv3State *s, Error **errp, SMMUSecSID sec_sid)
>                  break;
>              }
>  
> +            /*
> +             * This command raises CERROR_ILL when stage 1 is not implemented
> +             * according to (IHI 0070G.b) Page 176.
> +             */
> +            if (!STAGE1_SUPPORTED(s)) {
> +                cmd_error = SMMU_CERROR_ILL;
> +                break;
> +            }
> +
>              trace_smmuv3_cmdq_cfgi_cd(sid);
>              smmuv3_flush_config(sdev);
>              if (!smmuv3_accel_issue_inv_cmd(s, &cmd, sdev, errp)) {
> -- 
> 2.34.1
>
Re: [RFC v4 19/31] hw/arm/smmuv3: Fix CFGI_CD handling when stage-1 is unsupported
Posted by Tao Tang 1 month, 1 week ago
Hi Mostafa,

On 2026/2/27 PM10:49, Mostafa Saleh wrote:
> On Sat, Feb 21, 2026 at 06:17:33PM +0800, Tao Tang wrote:
>> Add a STAGE1_SUPPORTED check in the CMD_CFGI_CD and CMD_CFGI_CD_ALL path
>> and return CERROR_ILL when stage-1 translation is not implemented,
>> matching the architecture requirement (IHI 0070G.b, page 176).
>>
>> Fixes: 32cfd7f39e08 ("hw/arm/smmuv3: Cache/invalidate config data")
>> Signed-off-by: Tao Tang<tangtao1634@phytium.com.cn>
> This is a separate fix, it can be sent standalone to make this series
> smaller, similarly the first patch.


For #1, #2 and #19 commit (this one), since I’m not fully sure about the 
expected process here, should I resend these already Reviewed-by fixes 
as standalone patch respectively right now,  and try to get them merged 
first?


> Also the "Fixes" comment is not accurate, that was probably broken from
> the stage-2 implementation which was added later.


I'll remove "Fixes" when resending this commit.


> Reviewed-by: Mostafa Saleh<smostafa@google.com>
>
> Thanks,
> Mostafa


Thanks for your review.

Tao


Re: [RFC v4 19/31] hw/arm/smmuv3: Fix CFGI_CD handling when stage-1 is unsupported
Posted by Eric Auger 1 month, 1 week ago

On 3/1/26 1:33 PM, Tao Tang wrote:
>
> Hi Mostafa,
>
> On 2026/2/27 PM10:49, Mostafa Saleh wrote:
>> On Sat, Feb 21, 2026 at 06:17:33PM +0800, Tao Tang wrote:
>>> Add a STAGE1_SUPPORTED check in the CMD_CFGI_CD and CMD_CFGI_CD_ALL path
>>> and return CERROR_ILL when stage-1 translation is not implemented,
>>> matching the architecture requirement (IHI 0070G.b, page 176).
>>>
>>> Fixes: 32cfd7f39e08 ("hw/arm/smmuv3: Cache/invalidate config data")
>>> Signed-off-by: Tao Tang <tangtao1634@phytium.com.cn>
>> This is a separate fix, it can be sent standalone to make this series
>> smaller, similarly the first patch.
>
>
> For #1, #2 and #19 commit (this one), since I’m not fully sure about
> the expected process here, should I resend these already Reviewed-by
> fixes as standalone patch respectively right now,  and try to get them
> merged first?
>
>
>> Also the "Fixes" comment is not accurate, that was probably broken from
>> the stage-2 implementation which was added later.
>
>
> I'll remove "Fixes" when resending this commit.
>
Better to keep it after fixing it ;-)

Eric
>
>
>> Reviewed-by: Mostafa Saleh <smostafa@google.com>
>>
>> Thanks,
>> Mostafa
>
>
> Thanks for your review.
>
> Tao
>
>
>


Re: [RFC v4 19/31] hw/arm/smmuv3: Fix CFGI_CD handling when stage-1 is unsupported
Posted by Pierrick Bouvier 1 month, 1 week ago
On 3/1/26 4:33 AM, Tao Tang wrote:
> Hi Mostafa,
> 
> On 2026/2/27 PM10:49, Mostafa Saleh wrote:
>> On Sat, Feb 21, 2026 at 06:17:33PM +0800, Tao Tang wrote:
>>> Add a STAGE1_SUPPORTED check in the CMD_CFGI_CD and CMD_CFGI_CD_ALL path
>>> and return CERROR_ILL when stage-1 translation is not implemented,
>>> matching the architecture requirement (IHI 0070G.b, page 176).
>>>
>>> Fixes: 32cfd7f39e08 ("hw/arm/smmuv3: Cache/invalidate config data")
>>> Signed-off-by: Tao Tang<tangtao1634@phytium.com.cn>
>> This is a separate fix, it can be sent standalone to make this series
>> smaller, similarly the first patch.
> 
> 
> For #1, #2 and #19 commit (this one), since I’m not fully sure about the 
> expected process here, should I resend these already Reviewed-by fixes 
> as standalone patch respectively right now,  and try to get them merged 
> first?
>

If a set of patches is fully ready, you can always put them first in 
next version, and ask the maintainer to pull this one.
If your current series needs them to build, I usually prefer to keep it 
all together, instead of having two different series, and using a 
Based-on tag. But it's a personal preference, some people prefer to see 
several series.

Regards,
Pierrick

Re: [RFC v4 19/31] hw/arm/smmuv3: Fix CFGI_CD handling when stage-1 is unsupported
Posted by Eric Auger 1 month, 1 week ago

On 3/2/26 6:47 PM, Pierrick Bouvier wrote:
> On 3/1/26 4:33 AM, Tao Tang wrote:
>> Hi Mostafa,
>>
>> On 2026/2/27 PM10:49, Mostafa Saleh wrote:
>>> On Sat, Feb 21, 2026 at 06:17:33PM +0800, Tao Tang wrote:
>>>> Add a STAGE1_SUPPORTED check in the CMD_CFGI_CD and CMD_CFGI_CD_ALL
>>>> path
>>>> and return CERROR_ILL when stage-1 translation is not implemented,
>>>> matching the architecture requirement (IHI 0070G.b, page 176).
>>>>
>>>> Fixes: 32cfd7f39e08 ("hw/arm/smmuv3: Cache/invalidate config data")
>>>> Signed-off-by: Tao Tang<tangtao1634@phytium.com.cn>
>>> This is a separate fix, it can be sent standalone to make this series
>>> smaller, similarly the first patch.
>>
>>
>> For #1, #2 and #19 commit (this one), since I’m not fully sure about
>> the expected process here, should I resend these already Reviewed-by
>> fixes as standalone patch respectively right now,  and try to get
>> them merged first?
>>
>
> If a set of patches is fully ready, you can always put them first in
> next version, and ask the maintainer to pull this one.
> If your current series needs them to build, I usually prefer to keep
> it all together, instead of having two different series, and using a
> Based-on tag. But it's a personal preference, some people prefer to
> see several series. 
Either, either send them in a separate series or put them at the
beginning. We are approaching the soft freeze so maybe a separate series
would be better.

Eric
>
> Regards,
> Pierrick
>


Re: [RFC v4 19/31] hw/arm/smmuv3: Fix CFGI_CD handling when stage-1 is unsupported
Posted by Tao Tang 1 month, 1 week ago
Hi all,

On 2026/3/3 01:53, Eric Auger wrote:
>
> On 3/2/26 6:47 PM, Pierrick Bouvier wrote:
>> On 3/1/26 4:33 AM, Tao Tang wrote:
>>> Hi Mostafa,
>>>
>>> On 2026/2/27 PM10:49, Mostafa Saleh wrote:
>>>> On Sat, Feb 21, 2026 at 06:17:33PM +0800, Tao Tang wrote:
>>>>> Add a STAGE1_SUPPORTED check in the CMD_CFGI_CD and CMD_CFGI_CD_ALL
>>>>> path
>>>>> and return CERROR_ILL when stage-1 translation is not implemented,
>>>>> matching the architecture requirement (IHI 0070G.b, page 176).
>>>>>
>>>>> Fixes: 32cfd7f39e08 ("hw/arm/smmuv3: Cache/invalidate config data")
>>>>> Signed-off-by: Tao Tang<tangtao1634@phytium.com.cn>
>>>> This is a separate fix, it can be sent standalone to make this series
>>>> smaller, similarly the first patch.
>>>
>>> For #1, #2 and #19 commit (this one), since I’m not fully sure about
>>> the expected process here, should I resend these already Reviewed-by
>>> fixes as standalone patch respectively right now,  and try to get
>>> them merged first?
>>>
>> If a set of patches is fully ready, you can always put them first in
>> next version, and ask the maintainer to pull this one.
>> If your current series needs them to build, I usually prefer to keep
>> it all together, instead of having two different series, and using a
>> Based-on tag. But it's a personal preference, some people prefer to
>> see several series.
> Either, either send them in a separate series or put them at the
> beginning. We are approaching the soft freeze so maybe a separate series
> would be better.


Thank you all for the guide.
I’ll resend #1/#2/#19 as a small standalone fixes series with the Fixes 
tags, so it can be picked up independently.

The main series will then be rebased accordingly.

Best regards,

Tao


Re: [RFC v4 19/31] hw/arm/smmuv3: Fix CFGI_CD handling when stage-1 is unsupported
Posted by Mostafa Saleh 1 month, 1 week ago
On Sun, Mar 01, 2026 at 08:33:15PM +0800, Tao Tang wrote:
> Hi Mostafa,
> 
> On 2026/2/27 PM10:49, Mostafa Saleh wrote:
> > On Sat, Feb 21, 2026 at 06:17:33PM +0800, Tao Tang wrote:
> > > Add a STAGE1_SUPPORTED check in the CMD_CFGI_CD and CMD_CFGI_CD_ALL path
> > > and return CERROR_ILL when stage-1 translation is not implemented,
> > > matching the architecture requirement (IHI 0070G.b, page 176).
> > > 
> > > Fixes: 32cfd7f39e08 ("hw/arm/smmuv3: Cache/invalidate config data")
> > > Signed-off-by: Tao Tang<tangtao1634@phytium.com.cn>
> > This is a separate fix, it can be sent standalone to make this series
> > smaller, similarly the first patch.
> 
> 
> For #1, #2 and #19 commit (this one), since I’m not fully sure about the
> expected process here, should I resend these already Reviewed-by fixes as
> standalone patch respectively right now,  and try to get them merged first?
> 

Yes, that's my own opinion, that would make this series smaller and
slightly easier to review, but it's up to Eric.

Thanks,
Mostafa

> 
> > Also the "Fixes" comment is not accurate, that was probably broken from
> > the stage-2 implementation which was added later.
> 
> 
> I'll remove "Fixes" when resending this commit.
> 
> 
> > Reviewed-by: Mostafa Saleh<smostafa@google.com>
> > 
> > Thanks,
> > Mostafa
> 
> 
> Thanks for your review.
> 
> Tao
> 
> 

Re: [RFC v4 19/31] hw/arm/smmuv3: Fix CFGI_CD handling when stage-1 is unsupported
Posted by Pierrick Bouvier 1 month, 2 weeks ago
On 2/21/26 2:17 AM, Tao Tang wrote:
> Add a STAGE1_SUPPORTED check in the CMD_CFGI_CD and CMD_CFGI_CD_ALL path
> and return CERROR_ILL when stage-1 translation is not implemented,
> matching the architecture requirement (IHI 0070G.b, page 176).
> 
> Fixes: 32cfd7f39e08 ("hw/arm/smmuv3: Cache/invalidate config data")
> Signed-off-by: Tao Tang <tangtao1634@phytium.com.cn>
> ---
>   hw/arm/smmuv3.c | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>