[RFC v4 12/31] hw/arm/smmuv3: Store CD NSCFG in TT info

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 12/31] hw/arm/smmuv3: Store CD NSCFG in TT info
Posted by Tao Tang 1 month, 2 weeks ago
With NSCFG definitions in place, record the per-table NSCFG bits
in SMMUTransTableInfo during CD decode for later use.

Signed-off-by: Tao Tang <tangtao1634@phytium.com.cn>
---
 hw/arm/smmuv3.c              | 1 +
 include/hw/arm/smmu-common.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
index aa1a95a0093..b8f2fae9a1d 100644
--- a/hw/arm/smmuv3.c
+++ b/hw/arm/smmuv3.c
@@ -838,6 +838,7 @@ static int decode_cd(SMMUv3State *s, SMMUTransCfg *cfg,
             tt->ttb = CACHED_ENTRY_TO_ADDR(entry, tt->ttb);
         }
 
+        tt->nscfg = i ? CD_NSCFG(cd, 1) : CD_NSCFG(cd, 0);
         tt->had = CD_HAD(cd, i);
         trace_smmuv3_decode_cd_tt(i, tt->tsz, tt->ttb, tt->granule_sz, tt->had);
     }
diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
index 9e44c9f7710..bd88e599c77 100644
--- a/include/hw/arm/smmu-common.h
+++ b/include/hw/arm/smmu-common.h
@@ -83,6 +83,7 @@ typedef struct SMMUTransTableInfo {
     uint8_t tsz;               /* input range, ie. 2^(64 -tsz)*/
     uint8_t granule_sz;        /* granule page shift */
     bool had;                  /* hierarchical attribute disable */
+    int nscfg;                 /* Non-secure attribute of Starting-level TT */
 } SMMUTransTableInfo;
 
 typedef struct SMMUTLBEntry {
-- 
2.34.1
Re: [RFC v4 12/31] hw/arm/smmuv3: Store CD NSCFG in TT info
Posted by Eric Auger 1 month, 1 week ago

On 2/21/26 11:16 AM, Tao Tang wrote:
> With NSCFG definitions in place, record the per-table NSCFG bits
> in SMMUTransTableInfo during CD decode for later use.
>
> Signed-off-by: Tao Tang <tangtao1634@phytium.com.cn>
> ---
>  hw/arm/smmuv3.c              | 1 +
>  include/hw/arm/smmu-common.h | 1 +
>  2 files changed, 2 insertions(+)
>
> diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
> index aa1a95a0093..b8f2fae9a1d 100644
> --- a/hw/arm/smmuv3.c
> +++ b/hw/arm/smmuv3.c
> @@ -838,6 +838,7 @@ static int decode_cd(SMMUv3State *s, SMMUTransCfg *cfg,
>              tt->ttb = CACHED_ENTRY_TO_ADDR(entry, tt->ttb);
>          }
>  
> +        tt->nscfg = i ? CD_NSCFG(cd, 1) : CD_NSCFG(cd, 0);

tt->nscfg = CD_NSCFG(cd, i)?

Besides
Reviewed-by: Eric Auger <eric.auger@redhat.com>


Eric


>          tt->had = CD_HAD(cd, i);
>          trace_smmuv3_decode_cd_tt(i, tt->tsz, tt->ttb, tt->granule_sz, tt->had);
>      }
> diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
> index 9e44c9f7710..bd88e599c77 100644
> --- a/include/hw/arm/smmu-common.h
> +++ b/include/hw/arm/smmu-common.h
> @@ -83,6 +83,7 @@ typedef struct SMMUTransTableInfo {
>      uint8_t tsz;               /* input range, ie. 2^(64 -tsz)*/
>      uint8_t granule_sz;        /* granule page shift */
>      bool had;                  /* hierarchical attribute disable */
> +    int nscfg;                 /* Non-secure attribute of Starting-level TT */
>  } SMMUTransTableInfo;
>  
>  typedef struct SMMUTLBEntry {
Re: [RFC v4 12/31] hw/arm/smmuv3: Store CD NSCFG in TT info
Posted by Mostafa Saleh 1 month, 1 week ago
On Sat, Feb 21, 2026 at 06:16:32PM +0800, Tao Tang wrote:
> With NSCFG definitions in place, record the per-table NSCFG bits
> in SMMUTransTableInfo during CD decode for later use.
> 
> Signed-off-by: Tao Tang <tangtao1634@phytium.com.cn>

I feel this patch would be better squashed with how it’s used,
but no strong opinion.

Thanks,
Mostafa

> ---
>  hw/arm/smmuv3.c              | 1 +
>  include/hw/arm/smmu-common.h | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
> index aa1a95a0093..b8f2fae9a1d 100644
> --- a/hw/arm/smmuv3.c
> +++ b/hw/arm/smmuv3.c
> @@ -838,6 +838,7 @@ static int decode_cd(SMMUv3State *s, SMMUTransCfg *cfg,
>              tt->ttb = CACHED_ENTRY_TO_ADDR(entry, tt->ttb);
>          }
>  
> +        tt->nscfg = i ? CD_NSCFG(cd, 1) : CD_NSCFG(cd, 0);
>          tt->had = CD_HAD(cd, i);
>          trace_smmuv3_decode_cd_tt(i, tt->tsz, tt->ttb, tt->granule_sz, tt->had);
>      }
> diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
> index 9e44c9f7710..bd88e599c77 100644
> --- a/include/hw/arm/smmu-common.h
> +++ b/include/hw/arm/smmu-common.h
> @@ -83,6 +83,7 @@ typedef struct SMMUTransTableInfo {
>      uint8_t tsz;               /* input range, ie. 2^(64 -tsz)*/
>      uint8_t granule_sz;        /* granule page shift */
>      bool had;                  /* hierarchical attribute disable */
> +    int nscfg;                 /* Non-secure attribute of Starting-level TT */
>  } SMMUTransTableInfo;
>  
>  typedef struct SMMUTLBEntry {
> -- 
> 2.34.1
> 

Re: [RFC v4 12/31] hw/arm/smmuv3: Store CD NSCFG in TT info
Posted by Tao Tang 1 month, 1 week ago
Hi Mostafa,

On 2026/2/27 PM10:41, Mostafa Saleh wrote:
> On Sat, Feb 21, 2026 at 06:16:32PM +0800, Tao Tang wrote:
>> With NSCFG definitions in place, record the per-table NSCFG bits
>> in SMMUTransTableInfo during CD decode for later use.
>>
>> Signed-off-by: Tao Tang <tangtao1634@phytium.com.cn>
> I feel this patch would be better squashed with how it’s used,
> but no strong opinion.


I split "definition" vs "usage" here because Eric suggested keeping 
plumbing changes separate in previous series.


That said, I don’t mind squashing this into "hw/arm/smmu-common: 
Implement secure state handling in ptw" in V5, since it’s effectively a 
one-liner and will make the series smaller.


> Thanks,
> Mostafa


Best regards,

Tao


Re: [RFC v4 12/31] hw/arm/smmuv3: Store CD NSCFG in TT info
Posted by Mostafa Saleh 1 month, 1 week ago
On Sun, Mar 01, 2026 at 10:21:55PM +0800, Tao Tang wrote:
> Hi Mostafa,
> 
> On 2026/2/27 PM10:41, Mostafa Saleh wrote:
> > On Sat, Feb 21, 2026 at 06:16:32PM +0800, Tao Tang wrote:
> > > With NSCFG definitions in place, record the per-table NSCFG bits
> > > in SMMUTransTableInfo during CD decode for later use.
> > > 
> > > Signed-off-by: Tao Tang <tangtao1634@phytium.com.cn>
> > I feel this patch would be better squashed with how it’s used,
> > but no strong opinion.
> 
> 
> I split "definition" vs "usage" here because Eric suggested keeping plumbing
> changes separate in previous series.
> 

I don't have a strong opinion, you can keep it, if Eric is ok with it.
I was just looking for ways to keep this series shorter.

Thanks,
Mostafa

> 
> That said, I don’t mind squashing this into "hw/arm/smmu-common: Implement
> secure state handling in ptw" in V5, since it’s effectively a one-liner and
> will make the series smaller.
> 
> 
> > Thanks,
> > Mostafa
> 
> 
> Best regards,
> 
> Tao
> 

Re: [RFC v4 12/31] hw/arm/smmuv3: Store CD NSCFG in TT info
Posted by Eric Auger 1 month, 1 week ago

On 3/2/26 11:22 AM, Mostafa Saleh wrote:
> On Sun, Mar 01, 2026 at 10:21:55PM +0800, Tao Tang wrote:
>> Hi Mostafa,
>>
>> On 2026/2/27 PM10:41, Mostafa Saleh wrote:
>>> On Sat, Feb 21, 2026 at 06:16:32PM +0800, Tao Tang wrote:
>>>> With NSCFG definitions in place, record the per-table NSCFG bits
>>>> in SMMUTransTableInfo during CD decode for later use.
>>>>
>>>> Signed-off-by: Tao Tang <tangtao1634@phytium.com.cn>
>>> I feel this patch would be better squashed with how it’s used,
>>> but no strong opinion.
>>
>> I split "definition" vs "usage" here because Eric suggested keeping plumbing
>> changes separate in previous series.
>>
> I don't have a strong opinion, you can keep it, if Eric is ok with it.
> I was just looking for ways to keep this series shorter.
No strong opinion either. assuming this nscfg field is used in
subsequent patches, I find it easy to review it separately.

I prefer to have a big series with simple logical and functional changes
(that better fits my mind) rather than a small one with intricate patches. 

Thanks

Eric
>
> Thanks,
> Mostafa
>
>> That said, I don’t mind squashing this into "hw/arm/smmu-common: Implement
>> secure state handling in ptw" in V5, since it’s effectively a one-liner and
>> will make the series smaller.
>>
>>
>>> Thanks,
>>> Mostafa
>>
>> Best regards,
>>
>> Tao
>>


Re: [RFC v4 12/31] hw/arm/smmuv3: Store CD NSCFG in TT info
Posted by Pierrick Bouvier 1 month, 2 weeks ago
On 2/21/26 2:16 AM, Tao Tang wrote:
> With NSCFG definitions in place, record the per-table NSCFG bits
> in SMMUTransTableInfo during CD decode for later use.
> 
> Signed-off-by: Tao Tang <tangtao1634@phytium.com.cn>
> ---
>   hw/arm/smmuv3.c              | 1 +
>   include/hw/arm/smmu-common.h | 1 +
>   2 files changed, 2 insertions(+)
> 

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