From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jean-Philippe Brucker Subject: Re: [RFCv2 PATCH 21/36] iommu/arm-smmu-v3: Implement process operations Date: Thu, 9 Nov 2017 12:08:59 +0000 Message-ID: <812aa54c-1cda-d4a4-640f-4aa2d8eb81fa@arm.com> References: <20171006133203.22803-1-jean-philippe.brucker@arm.com> <20171006133203.22803-22-jean-philippe.brucker@arm.com> <084b1848-0939-5e73-3890-3aab8dc4bc70@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Return-path: Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:46094 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754228AbdKIMIO (ORCPT ); Thu, 9 Nov 2017 07:08:14 -0500 In-Reply-To: <084b1848-0939-5e73-3890-3aab8dc4bc70@huawei.com> Content-Language: en-US Sender: linux-acpi-owner@vger.kernel.org List-Id: linux-acpi@vger.kernel.org To: Yisheng Xie , "linux-arm-kernel@lists.infradead.org" , "linux-pci@vger.kernel.org" , "linux-acpi@vger.kernel.org" , "devicetree@vger.kernel.org" , "iommu@lists.linux-foundation.org" Cc: "joro@8bytes.org" , "robh+dt@kernel.org" , Mark Rutland , Catalin Marinas , Will Deacon , Lorenzo Pieralisi , "hanjun.guo@linaro.org" , Sudeep Holla , "rjw@rjwysocki.net" , "lenb@kernel.org" , Robin Murphy , "bhelgaas@google.com" , "alex.williamson@redhat.com" , "tn@semihalf.com" , "liubo95@huawei.com" , "thunder.leizhen@huawei.com" , "gabriele.paoloni@huawei.com" , nwatters@cod Hi, On 09/11/17 03:32, Yisheng Xie wrote: > Hi Jean, > > On 2017/10/6 21:31, Jean-Philippe Brucker wrote: >> Hook process operations to support PASID and page table sharing with the >> SMMUv3: >> >> + >> +static void arm_smmu_process_exit(struct iommu_domain *domain, >> + struct iommu_process *process) >> +{ >> + struct arm_smmu_master_data *master; >> + struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain); >> + >> + if (!domain->process_exit) >> + return; > > If domain do not set process_exit handler, just return? smmu do not > need invalid ATC, clear cd entry, etc.? Maybe you should check when > call domain->process_exit? Indeed, that doesn't make sense. I'll move the check below. Thanks, Jean >> + >> + spin_lock(&smmu_domain->devices_lock); >> + list_for_each_entry(master, &smmu_domain->devices, list) { >> + if (!master->processes) >> + continue; >> + >> + master->processes--; > Add > if (domain->process_exit) > here? >> + domain->process_exit(domain, master->dev, process->pasid, >> + domain->process_exit_token); >> + >> + /* TODO: inval ATC */ >> + } >> + spin_unlock(&smmu_domain->devices_lock); >> + >> + arm_smmu_write_ctx_desc(smmu_domain, process->pasid, NULL); >> + >> + /* TODO: Invalidate all mappings if not DVM */ >> +} >> + > Thanks > Yisheng Xie > > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Return-Path: Subject: Re: [RFCv2 PATCH 21/36] iommu/arm-smmu-v3: Implement process operations To: Yisheng Xie , "linux-arm-kernel@lists.infradead.org" , "linux-pci@vger.kernel.org" , "linux-acpi@vger.kernel.org" , "devicetree@vger.kernel.org" , "iommu@lists.linux-foundation.org" References: <20171006133203.22803-1-jean-philippe.brucker@arm.com> <20171006133203.22803-22-jean-philippe.brucker@arm.com> <084b1848-0939-5e73-3890-3aab8dc4bc70@huawei.com> From: Jean-Philippe Brucker Message-ID: <812aa54c-1cda-d4a4-640f-4aa2d8eb81fa@arm.com> Date: Thu, 9 Nov 2017 12:08:59 +0000 MIME-Version: 1.0 In-Reply-To: <084b1848-0939-5e73-3890-3aab8dc4bc70@huawei.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , "gabriele.paoloni@huawei.com" , Catalin Marinas , Will Deacon , "okaya@codeaurora.org" , "yi.l.liu@intel.com" , Lorenzo Pieralisi , "ashok.raj@intel.com" , "tn@semihalf.com" , "joro@8bytes.org" , "rfranz@cavium.com" , "lenb@kernel.org" , "jacob.jun.pan@linux.intel.com" , "alex.williamson@redhat.com" , "robh+dt@kernel.org" , "thunder.leizhen@huawei.com" , "bhelgaas@google.com" , "dwmw2@infradead.org" , "liubo95@huawei.com" , "rjw@rjwysocki.net" , "robdclark@gmail.com" , "hanjun.guo@linaro.org" , Sudeep Holla , Robin Murphy , "nwatters@codeaurora.org" Content-Type: text/plain; charset="us-ascii" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+bjorn=helgaas.com@lists.infradead.org List-ID: Hi, On 09/11/17 03:32, Yisheng Xie wrote: > Hi Jean, > > On 2017/10/6 21:31, Jean-Philippe Brucker wrote: >> Hook process operations to support PASID and page table sharing with the >> SMMUv3: >> >> + >> +static void arm_smmu_process_exit(struct iommu_domain *domain, >> + struct iommu_process *process) >> +{ >> + struct arm_smmu_master_data *master; >> + struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain); >> + >> + if (!domain->process_exit) >> + return; > > If domain do not set process_exit handler, just return? smmu do not > need invalid ATC, clear cd entry, etc.? Maybe you should check when > call domain->process_exit? Indeed, that doesn't make sense. I'll move the check below. Thanks, Jean >> + >> + spin_lock(&smmu_domain->devices_lock); >> + list_for_each_entry(master, &smmu_domain->devices, list) { >> + if (!master->processes) >> + continue; >> + >> + master->processes--; > Add > if (domain->process_exit) > here? >> + domain->process_exit(domain, master->dev, process->pasid, >> + domain->process_exit_token); >> + >> + /* TODO: inval ATC */ >> + } >> + spin_unlock(&smmu_domain->devices_lock); >> + >> + arm_smmu_write_ctx_desc(smmu_domain, process->pasid, NULL); >> + >> + /* TODO: Invalidate all mappings if not DVM */ >> +} >> + > Thanks > Yisheng Xie > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 From: jean-philippe.brucker@arm.com (Jean-Philippe Brucker) Date: Thu, 9 Nov 2017 12:08:59 +0000 Subject: [RFCv2 PATCH 21/36] iommu/arm-smmu-v3: Implement process operations In-Reply-To: <084b1848-0939-5e73-3890-3aab8dc4bc70@huawei.com> References: <20171006133203.22803-1-jean-philippe.brucker@arm.com> <20171006133203.22803-22-jean-philippe.brucker@arm.com> <084b1848-0939-5e73-3890-3aab8dc4bc70@huawei.com> Message-ID: <812aa54c-1cda-d4a4-640f-4aa2d8eb81fa@arm.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi, On 09/11/17 03:32, Yisheng Xie wrote: > Hi Jean, > > On 2017/10/6 21:31, Jean-Philippe Brucker wrote: >> Hook process operations to support PASID and page table sharing with the >> SMMUv3: >> >> + >> +static void arm_smmu_process_exit(struct iommu_domain *domain, >> + struct iommu_process *process) >> +{ >> + struct arm_smmu_master_data *master; >> + struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain); >> + >> + if (!domain->process_exit) >> + return; > > If domain do not set process_exit handler, just return? smmu do not > need invalid ATC, clear cd entry, etc.? Maybe you should check when > call domain->process_exit? Indeed, that doesn't make sense. I'll move the check below. Thanks, Jean >> + >> + spin_lock(&smmu_domain->devices_lock); >> + list_for_each_entry(master, &smmu_domain->devices, list) { >> + if (!master->processes) >> + continue; >> + >> + master->processes--; > Add > if (domain->process_exit) > here? >> + domain->process_exit(domain, master->dev, process->pasid, >> + domain->process_exit_token); >> + >> + /* TODO: inval ATC */ >> + } >> + spin_unlock(&smmu_domain->devices_lock); >> + >> + arm_smmu_write_ctx_desc(smmu_domain, process->pasid, NULL); >> + >> + /* TODO: Invalidate all mappings if not DVM */ >> +} >> + > Thanks > Yisheng Xie > >