On 3/12/26 10:03 PM, Nathan Chen wrote:
> From: Nathan Chen <nathanc@nvidia.com>
>
> Change accel SMMUv3 OAS property from uint8_t to OasMode. Setting
> 'auto' will use the default value of 44 set in smmuv3_init_id_regs().
> A future patch will implement resolution of 'auto' value to match
> the host SMMUv3 OAS value.
Same I think we don't want auto mode to be selectable at the moment.
Because then you will change the semantic of the auto mode, returning
the host value and not 44 anymore.
Eric
>
> Signed-off-by: Nathan Chen <nathanc@nvidia.com>
> ---
> hw/arm/smmuv3-accel.c | 2 +-
> hw/arm/smmuv3.c | 9 +++++----
> include/hw/arm/smmuv3.h | 2 +-
> 3 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
> index ab037df7ac..5073f74b8b 100644
> --- a/hw/arm/smmuv3-accel.c
> +++ b/hw/arm/smmuv3-accel.c
> @@ -849,7 +849,7 @@ void smmuv3_accel_idr_override(SMMUv3State *s)
> }
>
> /* Advertise 48-bit OAS in IDR5 when requested (default is 44 bits). */
> - if (s->oas == SMMU_OAS_48BIT) {
> + if (s->oas == OAS_MODE_48) {
> s->idr[5] = FIELD_DP32(s->idr[5], IDR5, OAS, SMMU_IDR5_OAS_48);
> }
>
> diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
> index 8b0121c0ed..9faa9c8dfb 100644
> --- a/hw/arm/smmuv3.c
> +++ b/hw/arm/smmuv3.c
> @@ -1981,7 +1981,7 @@ static bool smmu_validate_property(SMMUv3State *s, Error **errp)
> error_setg(errp, "ats can only be enabled if accel=on");
> return false;
> }
> - if (s->oas != SMMU_OAS_44BIT) {
> + if (s->oas > OAS_MODE_44) {
> error_setg(errp, "OAS must be 44 bits when accel=off");
> return false;
> }
> @@ -1999,8 +1999,9 @@ static bool smmu_validate_property(SMMUv3State *s, Error **errp)
> return false;
> }
>
> - if (s->oas != SMMU_OAS_44BIT && s->oas != SMMU_OAS_48BIT) {
> - error_setg(errp, "OAS can only be set to 44 or 48 bits");
> + if (s->oas != OAS_MODE_AUTO && s->oas != OAS_MODE_44 &&
> + s->oas != OAS_MODE_48) {
> + error_setg(errp, "OAS can only be set to auto, 44 bits, or 48 bits");
> return false;
> }
>
> @@ -2130,7 +2131,7 @@ static const Property smmuv3_properties[] = {
> /* RIL can be turned off for accel cases */
> DEFINE_PROP_ON_OFF_AUTO("ril", SMMUv3State, ril, ON_OFF_AUTO_ON),
> DEFINE_PROP_ON_OFF_AUTO("ats", SMMUv3State, ats, ON_OFF_AUTO_OFF),
> - DEFINE_PROP_UINT8("oas", SMMUv3State, oas, 44),
> + DEFINE_PROP_OAS_MODE("oas", SMMUv3State, oas, OAS_MODE_44),
> DEFINE_PROP_SSIDSIZE_MODE("ssidsize", SMMUv3State, ssidsize,
> SSID_SIZE_MODE_0),
> };
> diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h
> index ddf472493d..82f18eb090 100644
> --- a/include/hw/arm/smmuv3.h
> +++ b/include/hw/arm/smmuv3.h
> @@ -72,7 +72,7 @@ struct SMMUv3State {
> Error *migration_blocker;
> OnOffAuto ril;
> OnOffAuto ats;
> - uint8_t oas;
> + OasMode oas;
> SsidSizeMode ssidsize;
> };
>