Re: [PATCH] scsi: pm8001: Fix phys_to_virt() usage on dma_addr_t

From: John Garry
Date: Fri Dec 10 2021 - 05:44:45 EST


On 10/12/2021 10:23, Ajish.Koshy@xxxxxxxxxxxxx wrote:
Hi John,

Please config your editor to wrap at ~72 characters and don't top-post.


In my humble opinion what we observed very earlier was with respect smp_request()/response() crash and this patch resolved it. Given that the issue was not only specific to ARM, issue was observed on x86 too with IOMMU enabled. Device discovery went fine post application of this patch on x86.

What we are observing right now on error handling/timeouts for commands on drives will be altogether different issue that needs separate debugging on ARM platform with separate patch since this is a very initial execution of pm80xx driver on ARM platform.

This patch is acceptable. Let me know your further views.


As I mentioned earlier about this patch, a v2 is needed as we need kmap_atomic() in both cases. But I would rather resolve all issues before getting that merged - it has been broken this way for a long time.

So I mentioned a new issue in my response to Damien - maxcpus=1 on the command line crashes on boot. I can imagine that x86 also has that issue.

As for the timeouts, why would the FW not respond in the way I described? I would always expect a completion, even for erroneous commands. Maybe it is an interrupt issue in the driver. Is there some diagnostics I can check - there seems to be a lot of "stuff" in the sysfs scsi_host folder.

Thanks,
John

Thanks,
Ajish

On 26/11/2021 15:35, John Garry wrote:
/*
@@ -4280,8 +4283,9 @@ static int pm80xx_chip_smp_req(struct pm8001_hba_info *pm8001_ha,
pm8001_ha->smp_exp_mode = SMP_INDIRECT;


- tmp_addr = cpu_to_le64((u64)sg_dma_address(&task->smp_task.smp_req));
- preq_dma_addr = (char *)phys_to_virt(tmp_addr);
+ smp_req = &task->smp_task.smp_req;
+ to = kmap(sg_page(smp_req));
This should be a kmap_atomic() as well, as I see the following for when
CONFIG_DEBUG_ATOMIC_SLEEP is enabled: