linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iommu/vt-d: Allocate reserved region for ISA with correct permission
@ 2019-12-13  5:36 Jerry Snitselaar
  2019-12-14  1:42 ` Lu Baolu
  2019-12-15  5:39 ` Lu Baolu
  0 siblings, 2 replies; 5+ messages in thread
From: Jerry Snitselaar @ 2019-12-13  5:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Joerg Roedel, Lu Baolu, iommu, stable

Currently the reserved region for ISA is allocated with no
permissions. If a dma domain is being used, mapping this region will
fail. Set the permissions to DMA_PTE_READ|DMA_PTE_WRITE.

Cc: Joerg Roedel <jroedel@suse.de>
Cc: Lu Baolu <baolu.lu@linux.intel.com> 
Cc: iommu@lists.linux-foundation.org
Cc: stable@vger.kernel.org # v5.3+
Fixes: d850c2ee5fe2 ("iommu/vt-d: Expose ISA direct mapping region via iommu_get_resv_regions")
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
---
 drivers/iommu/intel-iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 0c8d81f56a30..998529cebcf2 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -5736,7 +5736,7 @@ static void intel_iommu_get_resv_regions(struct device *device,
 		struct pci_dev *pdev = to_pci_dev(device);
 
 		if ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA) {
-			reg = iommu_alloc_resv_region(0, 1UL << 24, 0,
+			reg = iommu_alloc_resv_region(0, 1UL << 24, prot,
 						      IOMMU_RESV_DIRECT);
 			if (reg)
 				list_add_tail(&reg->list, head);
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] iommu/vt-d: Allocate reserved region for ISA with correct permission
  2019-12-13  5:36 [PATCH] iommu/vt-d: Allocate reserved region for ISA with correct permission Jerry Snitselaar
@ 2019-12-14  1:42 ` Lu Baolu
  2019-12-15  5:38   ` Lu Baolu
  2019-12-15  5:39 ` Lu Baolu
  1 sibling, 1 reply; 5+ messages in thread
From: Lu Baolu @ 2019-12-14  1:42 UTC (permalink / raw)
  To: Jerry Snitselaar, linux-kernel; +Cc: baolu.lu, Joerg Roedel, iommu, stable

Hi Jerry,

On 12/13/19 1:36 PM, Jerry Snitselaar wrote:
> Currently the reserved region for ISA is allocated with no
> permissions. If a dma domain is being used, mapping this region will
> fail. Set the permissions to DMA_PTE_READ|DMA_PTE_WRITE.
> 
> Cc: Joerg Roedel <jroedel@suse.de>
> Cc: Lu Baolu <baolu.lu@linux.intel.com>
> Cc: iommu@lists.linux-foundation.org
> Cc: stable@vger.kernel.org # v5.3+
> Fixes: d850c2ee5fe2 ("iommu/vt-d: Expose ISA direct mapping region via iommu_get_resv_regions")
> Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
> ---
>   drivers/iommu/intel-iommu.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
> index 0c8d81f56a30..998529cebcf2 100644
> --- a/drivers/iommu/intel-iommu.c
> +++ b/drivers/iommu/intel-iommu.c
> @@ -5736,7 +5736,7 @@ static void intel_iommu_get_resv_regions(struct device *device,
>   		struct pci_dev *pdev = to_pci_dev(device);
>   
>   		if ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA) {
> -			reg = iommu_alloc_resv_region(0, 1UL << 24, 0,
> +			reg = iommu_alloc_resv_region(0, 1UL << 24, prot,
>   						      IOMMU_RESV_DIRECT);


This also applies to the IOAPIC range. Can you please change them
together?

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 0c8d81f56a30..256e48434f68 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -5736,7 +5736,7 @@ static void intel_iommu_get_resv_regions(struct 
device *device,
                 struct pci_dev *pdev = to_pci_dev(device);

                 if ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA) {
-                       reg = iommu_alloc_resv_region(0, 1UL << 24, 0,
+                       reg = iommu_alloc_resv_region(0, 1UL << 24, prot,
                                                       IOMMU_RESV_DIRECT);
                         if (reg)
                                 list_add_tail(&reg->list, head);
@@ -5746,7 +5746,7 @@ static void intel_iommu_get_resv_regions(struct 
device *device,

         reg = iommu_alloc_resv_region(IOAPIC_RANGE_START,
                                       IOAPIC_RANGE_END - 
IOAPIC_RANGE_START + 1,
-                                     0, IOMMU_RESV_MSI);
+                                     prot, IOMMU_RESV_MSI);
         if (!reg)
                 return;
         list_add_tail(&reg->list, head);

Best regards,
baolu

>   			if (reg)
>   				list_add_tail(&reg->list, head);
> 

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] iommu/vt-d: Allocate reserved region for ISA with correct permission
  2019-12-14  1:42 ` Lu Baolu
@ 2019-12-15  5:38   ` Lu Baolu
  0 siblings, 0 replies; 5+ messages in thread
From: Lu Baolu @ 2019-12-15  5:38 UTC (permalink / raw)
  To: Jerry Snitselaar, linux-kernel; +Cc: baolu.lu, Joerg Roedel, iommu, stable

Hi Jerry,

On 12/14/19 9:42 AM, Lu Baolu wrote:
> Hi Jerry,
> 
> On 12/13/19 1:36 PM, Jerry Snitselaar wrote:
>> Currently the reserved region for ISA is allocated with no
>> permissions. If a dma domain is being used, mapping this region will
>> fail. Set the permissions to DMA_PTE_READ|DMA_PTE_WRITE.
>>
>> Cc: Joerg Roedel <jroedel@suse.de>
>> Cc: Lu Baolu <baolu.lu@linux.intel.com>
>> Cc: iommu@lists.linux-foundation.org
>> Cc: stable@vger.kernel.org # v5.3+
>> Fixes: d850c2ee5fe2 ("iommu/vt-d: Expose ISA direct mapping region via 
>> iommu_get_resv_regions")
>> Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
>> ---
>>   drivers/iommu/intel-iommu.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
>> index 0c8d81f56a30..998529cebcf2 100644
>> --- a/drivers/iommu/intel-iommu.c
>> +++ b/drivers/iommu/intel-iommu.c
>> @@ -5736,7 +5736,7 @@ static void intel_iommu_get_resv_regions(struct 
>> device *device,
>>           struct pci_dev *pdev = to_pci_dev(device);
>>           if ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA) {
>> -            reg = iommu_alloc_resv_region(0, 1UL << 24, 0,
>> +            reg = iommu_alloc_resv_region(0, 1UL << 24, prot,
>>                                 IOMMU_RESV_DIRECT);
> 
> 
> This also applies to the IOAPIC range. Can you please change them
> together?

Please ignore this comment. These two ranges are of different type. Your
fix is enough. Sorry for the confusion.

Best regards,
baolu

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] iommu/vt-d: Allocate reserved region for ISA with correct permission
  2019-12-13  5:36 [PATCH] iommu/vt-d: Allocate reserved region for ISA with correct permission Jerry Snitselaar
  2019-12-14  1:42 ` Lu Baolu
@ 2019-12-15  5:39 ` Lu Baolu
  2019-12-17 10:48   ` Joerg Roedel
  1 sibling, 1 reply; 5+ messages in thread
From: Lu Baolu @ 2019-12-15  5:39 UTC (permalink / raw)
  To: Jerry Snitselaar, linux-kernel; +Cc: baolu.lu, Joerg Roedel, iommu, stable

Hi,

On 12/13/19 1:36 PM, Jerry Snitselaar wrote:
> Currently the reserved region for ISA is allocated with no
> permissions. If a dma domain is being used, mapping this region will
> fail. Set the permissions to DMA_PTE_READ|DMA_PTE_WRITE.
> 
> Cc: Joerg Roedel <jroedel@suse.de>
> Cc: Lu Baolu <baolu.lu@linux.intel.com>
> Cc: iommu@lists.linux-foundation.org
> Cc: stable@vger.kernel.org # v5.3+
> Fixes: d850c2ee5fe2 ("iommu/vt-d: Expose ISA direct mapping region via iommu_get_resv_regions")
> Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>

This fix looks reasonable to me.

Acked-by: Lu Baolu <baolu.lu@linux.intel.com>

Best regards,
baolu

> ---
>   drivers/iommu/intel-iommu.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
> index 0c8d81f56a30..998529cebcf2 100644
> --- a/drivers/iommu/intel-iommu.c
> +++ b/drivers/iommu/intel-iommu.c
> @@ -5736,7 +5736,7 @@ static void intel_iommu_get_resv_regions(struct device *device,
>   		struct pci_dev *pdev = to_pci_dev(device);
>   
>   		if ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA) {
> -			reg = iommu_alloc_resv_region(0, 1UL << 24, 0,
> +			reg = iommu_alloc_resv_region(0, 1UL << 24, prot,
>   						      IOMMU_RESV_DIRECT);
>   			if (reg)
>   				list_add_tail(&reg->list, head);
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] iommu/vt-d: Allocate reserved region for ISA with correct permission
  2019-12-15  5:39 ` Lu Baolu
@ 2019-12-17 10:48   ` Joerg Roedel
  0 siblings, 0 replies; 5+ messages in thread
From: Joerg Roedel @ 2019-12-17 10:48 UTC (permalink / raw)
  To: Lu Baolu; +Cc: Jerry Snitselaar, linux-kernel, iommu, stable

On Sun, Dec 15, 2019 at 01:39:31PM +0800, Lu Baolu wrote:
> Hi,
> 
> On 12/13/19 1:36 PM, Jerry Snitselaar wrote:
> > Currently the reserved region for ISA is allocated with no
> > permissions. If a dma domain is being used, mapping this region will
> > fail. Set the permissions to DMA_PTE_READ|DMA_PTE_WRITE.
> > 
> > Cc: Joerg Roedel <jroedel@suse.de>
> > Cc: Lu Baolu <baolu.lu@linux.intel.com>
> > Cc: iommu@lists.linux-foundation.org
> > Cc: stable@vger.kernel.org # v5.3+
> > Fixes: d850c2ee5fe2 ("iommu/vt-d: Expose ISA direct mapping region via iommu_get_resv_regions")
> > Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
> 
> This fix looks reasonable to me.
> 
> Acked-by: Lu Baolu <baolu.lu@linux.intel.com>

Applied for v5.5, thanks.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-12-17 10:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-13  5:36 [PATCH] iommu/vt-d: Allocate reserved region for ISA with correct permission Jerry Snitselaar
2019-12-14  1:42 ` Lu Baolu
2019-12-15  5:38   ` Lu Baolu
2019-12-15  5:39 ` Lu Baolu
2019-12-17 10:48   ` Joerg Roedel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).