Message ID | 85c1bdd22dc6f50c9d1dfd73e0ddf83c2c307dcf.1610115608.git.rahul.singh@arm.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | xen/arm: Add support for SMMUv3 driver | expand |
On Fri, 8 Jan 2021, Rahul Singh wrote: > Replace all Linux device tree handling function with the XEN > functions. > > Replace all Linux ktime function with the XEN time functions. > > Signed-off-by: Rahul Singh <rahul.singh@arm.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> > --- > Changes in v3: > - This patch is introduce in this version. > Changes in V4: > - Move this patch one patch earlier so that there is no need to remove > the code. > --- > xen/drivers/passthrough/arm/smmu-v3.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/xen/drivers/passthrough/arm/smmu-v3.c b/xen/drivers/passthrough/arm/smmu-v3.c > index f5f8b4c981..2dfadc6a65 100644 > --- a/xen/drivers/passthrough/arm/smmu-v3.c > +++ b/xen/drivers/passthrough/arm/smmu-v3.c > @@ -682,7 +682,7 @@ static void parse_driver_options(struct arm_smmu_device *smmu) > int i = 0; > > do { > - if (of_property_read_bool(smmu->dev->of_node, > + if (dt_property_read_bool(smmu->dev->of_node, > arm_smmu_options[i].prop)) { > smmu->options |= arm_smmu_options[i].opt; > dev_notice(smmu->dev, "option %s\n", > @@ -754,17 +754,17 @@ static void queue_inc_prod(struct arm_smmu_ll_queue *q) > */ > static int queue_poll_cons(struct arm_smmu_queue *q, bool sync, bool wfe) > { > - ktime_t timeout; > + s_time_t timeout; > unsigned int delay = 1, spin_cnt = 0; > > /* Wait longer if it's a CMD_SYNC */ > - timeout = ktime_add_us(ktime_get(), sync ? > + timeout = NOW() + MICROSECS(sync ? > ARM_SMMU_CMDQ_SYNC_TIMEOUT_US : > ARM_SMMU_POLL_TIMEOUT_US); > > while (queue_sync_cons_in(q), > (sync ? !queue_empty(&q->llq) : queue_full(&q->llq))) { > - if (ktime_compare(ktime_get(), timeout) > 0) > + if ((NOW() > timeout) > 0) > return -ETIMEDOUT; > > if (wfe) { > @@ -990,13 +990,13 @@ static void arm_smmu_cmdq_issue_cmd(struct arm_smmu_device *smmu, > */ > static int __arm_smmu_sync_poll_msi(struct arm_smmu_device *smmu, u32 sync_idx) > { > - ktime_t timeout; > + s_time_t timeout; > u32 val; > > - timeout = ktime_add_us(ktime_get(), ARM_SMMU_CMDQ_SYNC_TIMEOUT_US); > + timeout = NOW() + MICROSECS(ARM_SMMU_CMDQ_SYNC_TIMEOUT_US); > val = smp_cond_load_acquire(&smmu->sync_count, > (int)(VAL - sync_idx) >= 0 || > - !ktime_before(ktime_get(), timeout)); > + !(NOW() < timeout)); > > return (int)(val - sync_idx) < 0 ? -ETIMEDOUT : 0; > } > @@ -2649,7 +2649,7 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev, > u32 cells; > int ret = -EINVAL; > > - if (of_property_read_u32(dev->of_node, "#iommu-cells", &cells)) > + if (!dt_property_read_u32(dev->of_node, "#iommu-cells", &cells)) > dev_err(dev, "missing #iommu-cells property\n"); > else if (cells != 1) > dev_err(dev, "invalid #iommu-cells value (%d)\n", cells); > -- > 2.17.1 >
Hi Rahul, > On 8 Jan 2021, at 14:46, Rahul Singh <Rahul.Singh@arm.com> wrote: > > Replace all Linux device tree handling function with the XEN > functions. > > Replace all Linux ktime function with the XEN time functions. > > Signed-off-by: Rahul Singh <rahul.singh@arm.com> Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com> Cheers Bertrand > --- > Changes in v3: > - This patch is introduce in this version. > Changes in V4: > - Move this patch one patch earlier so that there is no need to remove > the code. > --- > xen/drivers/passthrough/arm/smmu-v3.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/xen/drivers/passthrough/arm/smmu-v3.c b/xen/drivers/passthrough/arm/smmu-v3.c > index f5f8b4c981..2dfadc6a65 100644 > --- a/xen/drivers/passthrough/arm/smmu-v3.c > +++ b/xen/drivers/passthrough/arm/smmu-v3.c > @@ -682,7 +682,7 @@ static void parse_driver_options(struct arm_smmu_device *smmu) > int i = 0; > > do { > - if (of_property_read_bool(smmu->dev->of_node, > + if (dt_property_read_bool(smmu->dev->of_node, > arm_smmu_options[i].prop)) { > smmu->options |= arm_smmu_options[i].opt; > dev_notice(smmu->dev, "option %s\n", > @@ -754,17 +754,17 @@ static void queue_inc_prod(struct arm_smmu_ll_queue *q) > */ > static int queue_poll_cons(struct arm_smmu_queue *q, bool sync, bool wfe) > { > - ktime_t timeout; > + s_time_t timeout; > unsigned int delay = 1, spin_cnt = 0; > > /* Wait longer if it's a CMD_SYNC */ > - timeout = ktime_add_us(ktime_get(), sync ? > + timeout = NOW() + MICROSECS(sync ? > ARM_SMMU_CMDQ_SYNC_TIMEOUT_US : > ARM_SMMU_POLL_TIMEOUT_US); > > while (queue_sync_cons_in(q), > (sync ? !queue_empty(&q->llq) : queue_full(&q->llq))) { > - if (ktime_compare(ktime_get(), timeout) > 0) > + if ((NOW() > timeout) > 0) > return -ETIMEDOUT; > > if (wfe) { > @@ -990,13 +990,13 @@ static void arm_smmu_cmdq_issue_cmd(struct arm_smmu_device *smmu, > */ > static int __arm_smmu_sync_poll_msi(struct arm_smmu_device *smmu, u32 sync_idx) > { > - ktime_t timeout; > + s_time_t timeout; > u32 val; > > - timeout = ktime_add_us(ktime_get(), ARM_SMMU_CMDQ_SYNC_TIMEOUT_US); > + timeout = NOW() + MICROSECS(ARM_SMMU_CMDQ_SYNC_TIMEOUT_US); > val = smp_cond_load_acquire(&smmu->sync_count, > (int)(VAL - sync_idx) >= 0 || > - !ktime_before(ktime_get(), timeout)); > + !(NOW() < timeout)); > > return (int)(val - sync_idx) < 0 ? -ETIMEDOUT : 0; > } > @@ -2649,7 +2649,7 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev, > u32 cells; > int ret = -EINVAL; > > - if (of_property_read_u32(dev->of_node, "#iommu-cells", &cells)) > + if (!dt_property_read_u32(dev->of_node, "#iommu-cells", &cells)) > dev_err(dev, "missing #iommu-cells property\n"); > else if (cells != 1) > dev_err(dev, "invalid #iommu-cells value (%d)\n", cells); > -- > 2.17.1 >
diff --git a/xen/drivers/passthrough/arm/smmu-v3.c b/xen/drivers/passthrough/arm/smmu-v3.c index f5f8b4c981..2dfadc6a65 100644 --- a/xen/drivers/passthrough/arm/smmu-v3.c +++ b/xen/drivers/passthrough/arm/smmu-v3.c @@ -682,7 +682,7 @@ static void parse_driver_options(struct arm_smmu_device *smmu) int i = 0; do { - if (of_property_read_bool(smmu->dev->of_node, + if (dt_property_read_bool(smmu->dev->of_node, arm_smmu_options[i].prop)) { smmu->options |= arm_smmu_options[i].opt; dev_notice(smmu->dev, "option %s\n", @@ -754,17 +754,17 @@ static void queue_inc_prod(struct arm_smmu_ll_queue *q) */ static int queue_poll_cons(struct arm_smmu_queue *q, bool sync, bool wfe) { - ktime_t timeout; + s_time_t timeout; unsigned int delay = 1, spin_cnt = 0; /* Wait longer if it's a CMD_SYNC */ - timeout = ktime_add_us(ktime_get(), sync ? + timeout = NOW() + MICROSECS(sync ? ARM_SMMU_CMDQ_SYNC_TIMEOUT_US : ARM_SMMU_POLL_TIMEOUT_US); while (queue_sync_cons_in(q), (sync ? !queue_empty(&q->llq) : queue_full(&q->llq))) { - if (ktime_compare(ktime_get(), timeout) > 0) + if ((NOW() > timeout) > 0) return -ETIMEDOUT; if (wfe) { @@ -990,13 +990,13 @@ static void arm_smmu_cmdq_issue_cmd(struct arm_smmu_device *smmu, */ static int __arm_smmu_sync_poll_msi(struct arm_smmu_device *smmu, u32 sync_idx) { - ktime_t timeout; + s_time_t timeout; u32 val; - timeout = ktime_add_us(ktime_get(), ARM_SMMU_CMDQ_SYNC_TIMEOUT_US); + timeout = NOW() + MICROSECS(ARM_SMMU_CMDQ_SYNC_TIMEOUT_US); val = smp_cond_load_acquire(&smmu->sync_count, (int)(VAL - sync_idx) >= 0 || - !ktime_before(ktime_get(), timeout)); + !(NOW() < timeout)); return (int)(val - sync_idx) < 0 ? -ETIMEDOUT : 0; } @@ -2649,7 +2649,7 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev, u32 cells; int ret = -EINVAL; - if (of_property_read_u32(dev->of_node, "#iommu-cells", &cells)) + if (!dt_property_read_u32(dev->of_node, "#iommu-cells", &cells)) dev_err(dev, "missing #iommu-cells property\n"); else if (cells != 1) dev_err(dev, "invalid #iommu-cells value (%d)\n", cells);
Replace all Linux device tree handling function with the XEN functions. Replace all Linux ktime function with the XEN time functions. Signed-off-by: Rahul Singh <rahul.singh@arm.com> --- Changes in v3: - This patch is introduce in this version. Changes in V4: - Move this patch one patch earlier so that there is no need to remove the code. --- xen/drivers/passthrough/arm/smmu-v3.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)