[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 8/8] xen/arm: smmuv3: Remove linux compatibility functions.


  • To: Rahul Singh <Rahul.Singh@xxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Fri, 11 Dec 2020 13:15:04 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i9yaz6ZfSjicd0DadFFb622WPH4VUCuIsmFFsvFKT0o=; b=MyzkX/ArU77+03X8RzZ5xhUGQF2Nk8bOFWd8qLO26kVT/myIfv39Yupra1t3WWIDmgYHG/uqesY3GOh+pqv46zti16bjOLgIxVY/fDSfgfLGfE1T563TOgVMys5o4xYKP+gCVJ+1wKqwi3A6dAwNxqN/CuR2ALnzdMJfp2kPaWZQc2vlYG9uo84qdxNODj/GMrku3ghIrfmcCvieYk7Hp9mSSSzwTD7j1kagWPtIxCljE2RFjBRt52Yhag39zkbBNbAmsHWo3mB2senVYbFim0pLKdhUATz0UaUk387AwQsmmsh/yxhtioJDxoT2dvxVaFI3ocaFdKMRrqVsdQn6Dw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bORRjMi2pra05J7cksibIuWv4w8WFj2QWKLRUVhe2BzOVpXkXIZbHSMRonwSsZEZtgiFETgqb9XKhAxFZp/vsTjYmxYWAdZ/g6Zv34aw1mVDUvO5pv+xJocMJQSR2eiWSZ0bdkDGfQYojgvP2a6xAyL8BdXS6iV92IIgfT6UDYItkUPEN9I2SzRl/SbreauY7Jr0L9wtGe6wz3SZmZhnvd+GPK6xL4ygS3zgzwN3HqrCJL15RB/n8mOrDlSc9ZSAbjank8J3fcqDqeefN6lfGI9DKvjssrPudPBPUCVz2MbtB7se9wCsB4YC1DS9sVxQ7fDs2O2waThruNjLXELohw==
  • Authentication-results-original: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Fri, 11 Dec 2020 13:15:50 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHWzxYmAyN3BeJ+Bke0TiYbqyxvo6nx4RoA
  • Thread-topic: [PATCH v3 8/8] xen/arm: smmuv3: Remove linux compatibility functions.

Hi Rahul,

> On 10 Dec 2020, at 16:57, Rahul Singh <Rahul.Singh@xxxxxxx> wrote:
> 
> Replace all Linux compatible 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@xxxxxxx>
Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>

Cheers
Bertrand

> ---
> Changes in v3:
> - This patch is introduce in this version.
> 
> ---
> xen/drivers/passthrough/arm/smmu-v3.c | 32 +++++++--------------------
> 1 file changed, 8 insertions(+), 24 deletions(-)
> 
> diff --git a/xen/drivers/passthrough/arm/smmu-v3.c 
> b/xen/drivers/passthrough/arm/smmu-v3.c
> index 65b3db94ad..c19c56ebc8 100644
> --- a/xen/drivers/passthrough/arm/smmu-v3.c
> +++ b/xen/drivers/passthrough/arm/smmu-v3.c
> @@ -101,22 +101,6 @@ typedef unsigned int             gfp_t;
> 
> #define GFP_KERNEL            0
> 
> -/* Alias to Xen device tree helpers */
> -#define device_node                  dt_device_node
> -#define of_phandle_args              dt_phandle_args
> -#define of_device_id         dt_device_match
> -#define of_match_node                dt_match_node
> -#define of_property_read_u32(np, pname, out) \
> -             (!dt_property_read_u32(np, pname, out))
> -#define of_property_read_bool                dt_property_read_bool
> -#define of_parse_phandle_with_args   dt_parse_phandle_with_args
> -
> -/* Alias to Xen time functions */
> -#define ktime_t s_time_t
> -#define ktime_get()                  (NOW())
> -#define ktime_add_us(t, i)           (t + MICROSECS(i))
> -#define ktime_compare(t, i)          (t > (i))
> -
> /* Alias to Xen allocation helpers */
> #define kzalloc(size, flags)  _xzalloc(size, sizeof(void *))
> #define kfree xfree
> @@ -922,7 +906,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",
> @@ -994,17 +978,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) {
> @@ -1232,13 +1216,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;
> }
> @@ -2969,7 +2953,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
> 




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.