diff mbox

[v2] iommu/io-pgtable-arm: Don't use dma_to_phys()

Message ID 56018074.2010104@arm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Robin Murphy Sept. 22, 2015, 4:23 p.m. UTC
On 22/09/15 14:25, Yong Wu wrote:
[...]
> About here:
>> @@ -629,6 +626,11 @@ arm_lpae_alloc_pgtable(struct io_pgtable_cfg
> *cfg)
>>        if (cfg->oas > ARM_LPAE_MAX_ADDR_BITS)
>>                return NULL;
>>   
>> +     if (cfg->iommu_dev->dma_pfn_offset) {
> 
> Do we need change to :
> 	if (!selftest_running && cfg->iommu_dev->dma_pfn_offset) {
> 
> cfg->iommu_dev will be null while self test.

Urgh, you're absolutely right. Must have been one of those days when I
had loads of noisy debug in there and turned the self-tests off :(

Will; since the branch hasn't gone anywhere yet, are you OK to take the below?

Robin.

----->8-----
From: Robin Murphy <robin.murphy@arm.com>
Date: Tue, 22 Sep 2015 14:52:27 +0100
Subject: [PATCH] fixup! iommu/io-pgtable-arm: Don't use dma_to_phys()

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
 drivers/iommu/io-pgtable-arm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Will Deacon Sept. 22, 2015, 4:26 p.m. UTC | #1
On Tue, Sep 22, 2015 at 05:23:16PM +0100, Robin Murphy wrote:
> On 22/09/15 14:25, Yong Wu wrote:
> [...]
> > About here:
> >> @@ -629,6 +626,11 @@ arm_lpae_alloc_pgtable(struct io_pgtable_cfg
> > *cfg)
> >>        if (cfg->oas > ARM_LPAE_MAX_ADDR_BITS)
> >>                return NULL;
> >>   
> >> +     if (cfg->iommu_dev->dma_pfn_offset) {
> > 
> > Do we need change to :
> > 	if (!selftest_running && cfg->iommu_dev->dma_pfn_offset) {
> > 
> > cfg->iommu_dev will be null while self test.
> 
> Urgh, you're absolutely right. Must have been one of those days when I
> had loads of noisy debug in there and turned the self-tests off :(
> 
> Will; since the branch hasn't gone anywhere yet, are you OK to take the below?

Yeah, no problem. I'll fold it in when I get a chance.

Will
diff mbox

Patch

diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c
index 1f08ce7..2ba2323 100644
--- a/drivers/iommu/io-pgtable-arm.c
+++ b/drivers/iommu/io-pgtable-arm.c
@@ -628,7 +628,7 @@  arm_lpae_alloc_pgtable(struct io_pgtable_cfg *cfg)
        if (cfg->oas > ARM_LPAE_MAX_ADDR_BITS)
                return NULL;
 
-       if (cfg->iommu_dev->dma_pfn_offset) {
+       if (!selftest_running && cfg->iommu_dev->dma_pfn_offset) {
                dev_err(cfg->iommu_dev, "Cannot accommodate DMA offset for IOMMU page tables\n");
                return NULL;
        }