From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linu Cherian Subject: Re: [RFC PATCH 1/7] iommu/arm-smmu-v3: Introduce smmu option PAGE0_REGS_ONLY for Silicon errata. Date: Wed, 12 Apr 2017 10:35:19 +0530 Message-ID: References: <1491921765-29475-1-git-send-email-linucherian@gmail.com> <1491921765-29475-2-git-send-email-linucherian@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from mail-yb0-f170.google.com ([209.85.213.170]:34159 "EHLO mail-yb0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750767AbdDLFFU (ORCPT ); Wed, 12 Apr 2017 01:05:20 -0400 Received: by mail-yb0-f170.google.com with SMTP id m133so4141549ybb.1 for ; Tue, 11 Apr 2017 22:05:20 -0700 (PDT) In-Reply-To: Sender: linux-acpi-owner@vger.kernel.org List-Id: linux-acpi@vger.kernel.org To: Robin Murphy Cc: catalin.marinas@arm.com, will.deacon@arm.com, lorenzo.pieralisi@arm.com, Hanjun Guo , sudeep.holla@arm.com, rjw@rjwysocki.net, Len Brown , joro@8bytes.org, robert.moore@intel.com, lv.zheng@intel.com, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, iommu@lists.linux-foundation.org, devel@acpica.org, Sunil.Goutham@cavium.com, Geethasowjanya.Akula@cavium.com, robert.richter@cavium.com, Linu Cherian On Tue, Apr 11, 2017 at 9:12 PM, Robin Murphy wrote: > On 11/04/17 15:42, linucherian@gmail.com wrote: >> From: Linu Cherian >> >> Cavium 99xx SMMU implementation doesn't support page 1 register space >> and PAGE0_REGS_ONLY option will be enabled as an errata workaround. > > Ugh :( > >> This option when turned on, replaces all page 1 offsets used for >> EVTQ_PROD/CONS, PRIQ_PROD/CONS register access with page 0 offsets. > > I think it might be neater to have something like: > > arm_smmu_page1(smmu) { > if (smmu->quirk) > return smmu->base; > return smmu->base + 64k; > } > > and use it as the base in the appropriate places, rather than override > the individual registers. Much like ARM_SMMU_GR0_NS in the SMMUv2 driver. > IIUC, we need to change the offsets as well for this, Like, #define ARM_SMMU_EVTQ_BASE 0xa0 -#define ARM_SMMU_EVTQ_PROD 0x100a8 -#define ARM_SMMU_EVTQ_CONS 0x100ac +#define ARM_SMMU_EVTQ_PROD 0xa8 +#define ARM_SMMU_EVTQ_CONS 0xac #define ARM_SMMU_EVTQ_IRQ_CFG0 0xb0 #define ARM_SMMU_EVTQ_IRQ_CFG1 0xb8 #define ARM_SMMU_EVTQ_IRQ_CFG2 0xbc #define ARM_SMMU_PRIQ_BASE 0xc0 -#define ARM_SMMU_PRIQ_PROD 0x100c8 -#define ARM_SMMU_PRIQ_CONS 0x100cc +#define ARM_SMMU_PRIQ_PROD 0xc8 +#define ARM_SMMU_PRIQ_CONS 0xcc But, it appears difficult to take this approach, at least with arm_smmu_init_one_queue function. This function takes both page0 register offset and and page1 register offset as an argument. So, we might need to do additional checks in this function to decide, whether to use a pag0 base or page1 base. Thanks. From mboxrd@z Thu Jan 1 00:00:00 1970 From: linucherian@gmail.com (Linu Cherian) Date: Wed, 12 Apr 2017 10:35:19 +0530 Subject: [RFC PATCH 1/7] iommu/arm-smmu-v3: Introduce smmu option PAGE0_REGS_ONLY for Silicon errata. In-Reply-To: References: <1491921765-29475-1-git-send-email-linucherian@gmail.com> <1491921765-29475-2-git-send-email-linucherian@gmail.com> Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Tue, Apr 11, 2017 at 9:12 PM, Robin Murphy wrote: > On 11/04/17 15:42, linucherian at gmail.com wrote: >> From: Linu Cherian >> >> Cavium 99xx SMMU implementation doesn't support page 1 register space >> and PAGE0_REGS_ONLY option will be enabled as an errata workaround. > > Ugh :( > >> This option when turned on, replaces all page 1 offsets used for >> EVTQ_PROD/CONS, PRIQ_PROD/CONS register access with page 0 offsets. > > I think it might be neater to have something like: > > arm_smmu_page1(smmu) { > if (smmu->quirk) > return smmu->base; > return smmu->base + 64k; > } > > and use it as the base in the appropriate places, rather than override > the individual registers. Much like ARM_SMMU_GR0_NS in the SMMUv2 driver. > IIUC, we need to change the offsets as well for this, Like, #define ARM_SMMU_EVTQ_BASE 0xa0 -#define ARM_SMMU_EVTQ_PROD 0x100a8 -#define ARM_SMMU_EVTQ_CONS 0x100ac +#define ARM_SMMU_EVTQ_PROD 0xa8 +#define ARM_SMMU_EVTQ_CONS 0xac #define ARM_SMMU_EVTQ_IRQ_CFG0 0xb0 #define ARM_SMMU_EVTQ_IRQ_CFG1 0xb8 #define ARM_SMMU_EVTQ_IRQ_CFG2 0xbc #define ARM_SMMU_PRIQ_BASE 0xc0 -#define ARM_SMMU_PRIQ_PROD 0x100c8 -#define ARM_SMMU_PRIQ_CONS 0x100cc +#define ARM_SMMU_PRIQ_PROD 0xc8 +#define ARM_SMMU_PRIQ_CONS 0xcc But, it appears difficult to take this approach, at least with arm_smmu_init_one_queue function. This function takes both page0 register offset and and page1 register offset as an argument. So, we might need to do additional checks in this function to decide, whether to use a pag0 base or page1 base. Thanks.