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

Re: [XEN v6 03/12] xen/arm: Introduce a wrapper for dt_device_get_address() to handle paddr_t


  • To: Julien Grall <julien@xxxxxxx>, Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Ayan Kumar Halder <ayankuma@xxxxxxx>
  • Date: Wed, 3 May 2023 15:06:54 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=htY6wAQlmkfy+g2a0rtOTjM6Ae3lrM6ND5lLPxrqvUQ=; b=MIuD2xKDUtbdiaSsfZT2mBE0nJdBuK3UOe9YJiu6wbd/iNVYQxreC8nAQqyOPfJ5xhgsUPSlFsskSNR/w018Ba6PKomcTiDfJm+jSEScP2d3NezSzGmqPOIySKBMqLn4d1uy10JwVVkj6NquoEmAkX3po9ifrJpMwhrnuhb8Tpa6oMokC9MUj+/2qjEwUWeUNG3pdq7pm6SO+gdYX5D8XkNor3dlVKflaWWnqJjzNybmQovTxjpblngF609jESTSwz29yr0ESJGQ4gFof9JOwVIFXdLz3Wbp2FgGloU3h2ZUwHR9s1L404fvpWSTyDO1p8lr2srTuUk12IyQjS9wIQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CpFXu2m9Esb3p5mMr35zNmMg7eIHt651b4Maet0sn5/0YHC3LnlplCMZ0kN1APzPKN73YWhDoO01qAaeLVsptpnPbi54dXnP0bysre/K69EMUTSxQypjXLeopXUqTbNlyw8Vid+jUFXGwewqSsnppGHjHsbOq8Gyy0wuEb3v0qD8L5Hy60gpSBlRTHUQbiH9dBdWSLRWshIYs04YPQ/zLb+6a5OJZPm3S98eShsBSDjKlF+qK9iOV3nU8cCPKFCRosHkYVZmtdmCgr0QL+3wQfZjOlr1dtq04pPeqMVsIXHCSGlqHuYCblmrQFjj3JH1LRkfTZMenDduK6FvXki+Cg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: sstabellini@xxxxxxxxxx, stefano.stabellini@xxxxxxx, Volodymyr_Babchuk@xxxxxxxx, bertrand.marquis@xxxxxxx, andrew.cooper3@xxxxxxxxxx, george.dunlap@xxxxxxxxxx, jbeulich@xxxxxxxx, wl@xxxxxxx, rahul.singh@xxxxxxx
  • Delivery-date: Wed, 03 May 2023 14:07:21 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 03/05/2023 12:25, Julien Grall wrote:
Hi Ayan,
Hi Julien,

On 28/04/2023 18:55, Ayan Kumar Halder wrote:
dt_device_get_address() can accept uint64_t only for address and size.
However, the address/size denotes physical addresses. Thus, they should
be represented by 'paddr_t'.
Consequently, we introduce a wrapper for dt_device_get_address() ie
dt_device_get_paddr() which accepts address/size as paddr_t and inturn
invokes dt_device_get_address() after converting address/size to
uint64_t.

The reason for introducing this is that in future 'paddr_t' may not
always be 64-bit. Thus, we need an explicit wrapper to do the type
conversion and return an error in case of truncation.

With this, callers can now invoke dt_device_get_paddr().

Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
---
Changes from -

v1 - 1. New patch.

v2 - 1. Extracted part of "[XEN v2 05/11] xen/arm: Use paddr_t instead of u64 for address/size"
into this patch.

2. dt_device_get_address() callers now invoke dt_device_get_paddr() instead.

3. Logged error in case of truncation.

v3 - 1. Modified the truncation checks as "dt_addr != (paddr_t)dt_addr".
2. Some sanity fixes.

v4 - 1. Some sanity fixes.
2. Preserved the declaration of dt_device_get_address() in
xen/include/xen/device_tree.h. The reason being it is currently used by
ns16550.c. This driver requires some more changes as pointed by Jan in
https://lore.kernel.org/xen-devel/6196e90f-752e-e61a-45ce-37e46c22b812@xxxxxxxx/
which is to be addressed as a separate series.

v5 - 1. Removed initialization of variables.
2. In dt_device_get_paddr(), added the check
if ( !addr )
     return -EINVAL;

  xen/arch/arm/domain_build.c                | 10 +++---
  xen/arch/arm/gic-v2.c                      | 10 +++---
  xen/arch/arm/gic-v3-its.c                  |  4 +--
  xen/arch/arm/gic-v3.c                      | 10 +++---
  xen/arch/arm/pci/pci-host-common.c         |  6 ++--
  xen/arch/arm/platforms/brcm-raspberry-pi.c |  2 +-
  xen/arch/arm/platforms/brcm.c              |  6 ++--
  xen/arch/arm/platforms/exynos5.c           | 32 +++++++++---------
  xen/arch/arm/platforms/sunxi.c             |  2 +-
  xen/arch/arm/platforms/xgene-storm.c       |  2 +-
  xen/common/device_tree.c                   | 39 ++++++++++++++++++++++
  xen/drivers/char/cadence-uart.c            |  4 +--
  xen/drivers/char/exynos4210-uart.c         |  4 +--
  xen/drivers/char/imx-lpuart.c              |  4 +--
  xen/drivers/char/meson-uart.c              |  4 +--
  xen/drivers/char/mvebu-uart.c              |  4 +--
  xen/drivers/char/omap-uart.c               |  4 +--
  xen/drivers/char/pl011.c                   |  6 ++--
  xen/drivers/char/scif-uart.c               |  4 +--

What about the call in xen/drivers/char/ns16550.c?

Refer to https://lore.kernel.org/xen-devel/6196e90f-752e-e61a-45ce-37e46c22b812@xxxxxxxx/ , Jan mentioned that this driver needs some prior cleanup.

So, I decided to take it out and do it after the current series has been committed.

See https://patchew.org/Xen/20230413173735.48387-1-ayan.kumar.halder@xxxxxxx/ , Jan agreed to this.

Is this ok with you ?

- Ayan


xen/drivers/passthrough/arm/ipmmu-vmsa.c   |  8 ++---
  xen/drivers/passthrough/arm/smmu-v3.c      |  2 +-
  xen/drivers/passthrough/arm/smmu.c         |  8 ++---
  xen/include/xen/device_tree.h              | 13 ++++++++
  23 files changed, 120 insertions(+), 68 deletions(-)
Cheers,




 


Rackspace

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