[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH RESEND 1/9] hw/arm/smmu-common: Factorize some code in smmu_p
From: |
Auger Eric |
Subject: |
Re: [PATCH RESEND 1/9] hw/arm/smmu-common: Factorize some code in smmu_ptw_64() |
Date: |
Fri, 26 Jun 2020 15:53:42 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 |
Hi Peter,
On 6/25/20 4:49 PM, Peter Maydell wrote:
> On Thu, 11 Jun 2020 at 17:15, Eric Auger <eric.auger@redhat.com> wrote:
>>
>> Page and block PTE decoding can share some code. Let's
>> first handle table PTE and factorize some code shared by
>> page and block PTEs.
>>
>> Signed-off-by: Eric Auger <eric.auger@redhat.com>
>> ---
>> hw/arm/smmu-common.c | 51 ++++++++++++++++----------------------------
>> 1 file changed, 18 insertions(+), 33 deletions(-)
>>
>> diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
>> index e13a5f4a7c..f2de2be527 100644
>> --- a/hw/arm/smmu-common.c
>> +++ b/hw/arm/smmu-common.c
>> @@ -186,12 +186,12 @@ static int smmu_ptw_64(SMMUTransCfg *cfg,
>> uint64_t subpage_size = 1ULL << level_shift(level, granule_sz);
>> uint64_t mask = subpage_size - 1;
>> uint32_t offset = iova_level_offset(iova, inputsize, level,
>> granule_sz);
>> - uint64_t pte;
>> + uint64_t pte, gpa;
>> dma_addr_t pte_addr = baseaddr + offset * sizeof(pte);
>> uint8_t ap;
>>
>> if (get_pte(baseaddr, offset, &pte, info)) {
>> - goto error;
>> + break;
>
> get_pte() fills in info->type (to SMMU_PTW_ERR_WALK_EABT) on
> error; changing this from "goto error" to "break" means we'll
> now execute the "info->type = SMMU_PTW_ERR_TRANSLATION" that
> comes between the end of the while loop and the error: label,
> overwriting the wrong error type.
Agreed.
Thanks
Eric
>
> thanks
> -- PMM
>
- [PATCH RESEND 0/9] SMMUv3.2 Range-based TLB Invalidation Support, Eric Auger, 2020/06/11
- [PATCH RESEND 1/9] hw/arm/smmu-common: Factorize some code in smmu_ptw_64(), Eric Auger, 2020/06/11
- [PATCH RESEND 2/9] hw/arm/smmu-common: Add IOTLB helpers, Eric Auger, 2020/06/11
- [PATCH RESEND 3/9] hw/arm/smmu: Simplify the IOTLB key format, Eric Auger, 2020/06/11
- [PATCH RESEND 4/9] hw/arm/smmu: Introduce SMMUTLBEntry for PTW and IOTLB value, Eric Auger, 2020/06/11
- [PATCH RESEND 5/9] hw/arm/smmuv3: Store the starting level in SMMUTransTableInfo, Eric Auger, 2020/06/11