diff mbox series

[v3,2/2] intel_iommu: Make PASID-cache and PIOTLB type invalid in legacy mode

Message ID 20240814022654.2612780-3-zhenzhong.duan@intel.com (mailing list archive)
State New, archived
Headers show
Series intel_iommu minor fixes | expand

Commit Message

Duan, Zhenzhong Aug. 14, 2024, 2:26 a.m. UTC
In vtd_process_inv_desc(), VTD_INV_DESC_PC and VTD_INV_DESC_PIOTLB are
bypassed without scalable mode check. These two types are not valid
in legacy mode and we should report error.

Fixes: 4a4f219e8a1 ("intel_iommu: add scalable-mode option to make scalable mode work")
Suggested-by: Yi Liu <yi.l.liu@intel.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Clément Mathieu--Drif<clement.mathieu--drif@eviden.com>
Reviewed-by: Yi Liu <yi.l.liu@intel.com>
---
 hw/i386/intel_iommu.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

Comments

Duan, Zhenzhong Aug. 14, 2024, 3:05 a.m. UTC | #1
>-----Original Message-----
>From: Liu, Yi L <yi.l.liu@intel.com>
>Subject: Re: [PATCH v3 2/2] intel_iommu: Make PASID-cache and PIOTLB
>type invalid in legacy mode
>
>On 2024/8/14 10:26, Zhenzhong Duan wrote:
>> In vtd_process_inv_desc(), VTD_INV_DESC_PC and VTD_INV_DESC_PIOTLB
>are
>> bypassed without scalable mode check. These two types are not valid
>> in legacy mode and we should report error.
>>
>> Fixes: 4a4f219e8a1 ("intel_iommu: add scalable-mode option to make
>scalable mode work")
>
>4a4f219e8a10 would be better. :)

Ah, OK, Michael, let me know if you want me send a new version.

Thanks
Zhenzhong

>
>> Suggested-by: Yi Liu <yi.l.liu@intel.com>
>> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
>> Reviewed-by: Clément Mathieu--Drif<clement.mathieu--drif@eviden.com>
>> Reviewed-by: Yi Liu <yi.l.liu@intel.com>
>> ---
>>   hw/i386/intel_iommu.c | 22 +++++++++++-----------
>>   1 file changed, 11 insertions(+), 11 deletions(-)
>>
>> diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
>> index 68cb72a481..90cd4e5044 100644
>> --- a/hw/i386/intel_iommu.c
>> +++ b/hw/i386/intel_iommu.c
>> @@ -2763,17 +2763,6 @@ static bool
>vtd_process_inv_desc(IntelIOMMUState *s)
>>           }
>>           break;
>>
>> -    /*
>> -     * TODO: the entity of below two cases will be implemented in future
>series.
>> -     * To make guest (which integrates scalable mode support patch set in
>> -     * iommu driver) work, just return true is enough so far.
>> -     */
>> -    case VTD_INV_DESC_PC:
>> -        break;
>> -
>> -    case VTD_INV_DESC_PIOTLB:
>> -        break;
>> -
>>       case VTD_INV_DESC_WAIT:
>>           trace_vtd_inv_desc("wait", inv_desc.hi, inv_desc.lo);
>>           if (!vtd_process_wait_desc(s, &inv_desc)) {
>> @@ -2795,6 +2784,17 @@ static bool
>vtd_process_inv_desc(IntelIOMMUState *s)
>>           }
>>           break;
>>
>> +    /*
>> +     * TODO: the entity of below two cases will be implemented in future
>series.
>> +     * To make guest (which integrates scalable mode support patch set in
>> +     * iommu driver) work, just return true is enough so far.
>> +     */
>> +    case VTD_INV_DESC_PC:
>> +    case VTD_INV_DESC_PIOTLB:
>> +        if (s->scalable_mode) {
>> +            break;
>> +        }
>> +    /* fallthrough */
>>       default:
>>           error_report_once("%s: invalid inv desc: hi=%"PRIx64", lo=%"PRIx64
>>                             " (unknown type)", __func__, inv_desc.hi,
>
>--
>Regards,
>Yi Liu
Yi Liu Aug. 14, 2024, 3:08 a.m. UTC | #2
On 2024/8/14 10:26, Zhenzhong Duan wrote:
> In vtd_process_inv_desc(), VTD_INV_DESC_PC and VTD_INV_DESC_PIOTLB are
> bypassed without scalable mode check. These two types are not valid
> in legacy mode and we should report error.
> 
> Fixes: 4a4f219e8a1 ("intel_iommu: add scalable-mode option to make scalable mode work")

4a4f219e8a10 would be better. :)

> Suggested-by: Yi Liu <yi.l.liu@intel.com>
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
> Reviewed-by: Clément Mathieu--Drif<clement.mathieu--drif@eviden.com>
> Reviewed-by: Yi Liu <yi.l.liu@intel.com>
> ---
>   hw/i386/intel_iommu.c | 22 +++++++++++-----------
>   1 file changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
> index 68cb72a481..90cd4e5044 100644
> --- a/hw/i386/intel_iommu.c
> +++ b/hw/i386/intel_iommu.c
> @@ -2763,17 +2763,6 @@ static bool vtd_process_inv_desc(IntelIOMMUState *s)
>           }
>           break;
>   
> -    /*
> -     * TODO: the entity of below two cases will be implemented in future series.
> -     * To make guest (which integrates scalable mode support patch set in
> -     * iommu driver) work, just return true is enough so far.
> -     */
> -    case VTD_INV_DESC_PC:
> -        break;
> -
> -    case VTD_INV_DESC_PIOTLB:
> -        break;
> -
>       case VTD_INV_DESC_WAIT:
>           trace_vtd_inv_desc("wait", inv_desc.hi, inv_desc.lo);
>           if (!vtd_process_wait_desc(s, &inv_desc)) {
> @@ -2795,6 +2784,17 @@ static bool vtd_process_inv_desc(IntelIOMMUState *s)
>           }
>           break;
>   
> +    /*
> +     * TODO: the entity of below two cases will be implemented in future series.
> +     * To make guest (which integrates scalable mode support patch set in
> +     * iommu driver) work, just return true is enough so far.
> +     */
> +    case VTD_INV_DESC_PC:
> +    case VTD_INV_DESC_PIOTLB:
> +        if (s->scalable_mode) {
> +            break;
> +        }
> +    /* fallthrough */
>       default:
>           error_report_once("%s: invalid inv desc: hi=%"PRIx64", lo=%"PRIx64
>                             " (unknown type)", __func__, inv_desc.hi,
Michael S. Tsirkin Aug. 14, 2024, 7:02 a.m. UTC | #3
On Wed, Aug 14, 2024 at 03:05:33AM +0000, Duan, Zhenzhong wrote:
> 
> 
> >-----Original Message-----
> >From: Liu, Yi L <yi.l.liu@intel.com>
> >Subject: Re: [PATCH v3 2/2] intel_iommu: Make PASID-cache and PIOTLB
> >type invalid in legacy mode
> >
> >On 2024/8/14 10:26, Zhenzhong Duan wrote:
> >> In vtd_process_inv_desc(), VTD_INV_DESC_PC and VTD_INV_DESC_PIOTLB
> >are
> >> bypassed without scalable mode check. These two types are not valid
> >> in legacy mode and we should report error.
> >>
> >> Fixes: 4a4f219e8a1 ("intel_iommu: add scalable-mode option to make
> >scalable mode work")
> >
> >4a4f219e8a10 would be better. :)
> 
> Ah, OK, Michael, let me know if you want me send a new version.
> 
> Thanks
> Zhenzhong


Yes pls, also pls Cc me on the cover letter.

> >
> >> Suggested-by: Yi Liu <yi.l.liu@intel.com>
> >> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
> >> Reviewed-by: Clément Mathieu--Drif<clement.mathieu--drif@eviden.com>
> >> Reviewed-by: Yi Liu <yi.l.liu@intel.com>
> >> ---
> >>   hw/i386/intel_iommu.c | 22 +++++++++++-----------
> >>   1 file changed, 11 insertions(+), 11 deletions(-)
> >>
> >> diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
> >> index 68cb72a481..90cd4e5044 100644
> >> --- a/hw/i386/intel_iommu.c
> >> +++ b/hw/i386/intel_iommu.c
> >> @@ -2763,17 +2763,6 @@ static bool
> >vtd_process_inv_desc(IntelIOMMUState *s)
> >>           }
> >>           break;
> >>
> >> -    /*
> >> -     * TODO: the entity of below two cases will be implemented in future
> >series.
> >> -     * To make guest (which integrates scalable mode support patch set in
> >> -     * iommu driver) work, just return true is enough so far.
> >> -     */
> >> -    case VTD_INV_DESC_PC:
> >> -        break;
> >> -
> >> -    case VTD_INV_DESC_PIOTLB:
> >> -        break;
> >> -
> >>       case VTD_INV_DESC_WAIT:
> >>           trace_vtd_inv_desc("wait", inv_desc.hi, inv_desc.lo);
> >>           if (!vtd_process_wait_desc(s, &inv_desc)) {
> >> @@ -2795,6 +2784,17 @@ static bool
> >vtd_process_inv_desc(IntelIOMMUState *s)
> >>           }
> >>           break;
> >>
> >> +    /*
> >> +     * TODO: the entity of below two cases will be implemented in future
> >series.
> >> +     * To make guest (which integrates scalable mode support patch set in
> >> +     * iommu driver) work, just return true is enough so far.
> >> +     */
> >> +    case VTD_INV_DESC_PC:
> >> +    case VTD_INV_DESC_PIOTLB:
> >> +        if (s->scalable_mode) {
> >> +            break;
> >> +        }
> >> +    /* fallthrough */
> >>       default:
> >>           error_report_once("%s: invalid inv desc: hi=%"PRIx64", lo=%"PRIx64
> >>                             " (unknown type)", __func__, inv_desc.hi,
> >
> >--
> >Regards,
> >Yi Liu
diff mbox series

Patch

diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index 68cb72a481..90cd4e5044 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -2763,17 +2763,6 @@  static bool vtd_process_inv_desc(IntelIOMMUState *s)
         }
         break;
 
-    /*
-     * TODO: the entity of below two cases will be implemented in future series.
-     * To make guest (which integrates scalable mode support patch set in
-     * iommu driver) work, just return true is enough so far.
-     */
-    case VTD_INV_DESC_PC:
-        break;
-
-    case VTD_INV_DESC_PIOTLB:
-        break;
-
     case VTD_INV_DESC_WAIT:
         trace_vtd_inv_desc("wait", inv_desc.hi, inv_desc.lo);
         if (!vtd_process_wait_desc(s, &inv_desc)) {
@@ -2795,6 +2784,17 @@  static bool vtd_process_inv_desc(IntelIOMMUState *s)
         }
         break;
 
+    /*
+     * TODO: the entity of below two cases will be implemented in future series.
+     * To make guest (which integrates scalable mode support patch set in
+     * iommu driver) work, just return true is enough so far.
+     */
+    case VTD_INV_DESC_PC:
+    case VTD_INV_DESC_PIOTLB:
+        if (s->scalable_mode) {
+            break;
+        }
+    /* fallthrough */
     default:
         error_report_once("%s: invalid inv desc: hi=%"PRIx64", lo=%"PRIx64
                           " (unknown type)", __func__, inv_desc.hi,