lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALRxmdCiSZgoqd8tp90kPCdA=s7SWZCTwKsFnWu7S5=U7+eRLQ@mail.gmail.com>
Date:	Mon, 4 Feb 2013 12:10:51 -0600
From:	Stuart Yoder <b08248@...il.com>
To:	Joerg Roedel <joro@...tes.org>
Cc:	Sethi Varun-B16395 <B16395@...escale.com>,
	iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4/5] iommu: Add domain window handling functions

On Mon, Feb 4, 2013 at 7:18 AM, Joerg Roedel <joro@...tes.org> wrote:
> Add the iommu_domain_window_enable() and iommu_domain_window_disable()
> functions to the IOMMU-API. These functions will be used to setup
> domains that are based on subwindows and not on paging.
>
> Signed-off-by: Joerg Roedel <joro@...tes.org>
> ---
>  drivers/iommu/iommu.c |   20 ++++++++++++++++++++
>  include/linux/iommu.h |   22 ++++++++++++++++++++++
>  2 files changed, 42 insertions(+)
>
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index ab9dafd..0fdb7db 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -852,6 +852,26 @@ size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, size_t size)
>  }
>  EXPORT_SYMBOL_GPL(iommu_unmap);
>
> +
> +int iommu_domain_window_enable(struct iommu_domain *domain, u32 wnd_nr,
> +                              phys_addr_t paddr, size_t size)
> +{
> +       if (unlikely(domain->ops->domain_window_enable == NULL))
> +               return -ENODEV;
> +
> +       return domain->ops->domain_window_enable(domain, wnd_nr, paddr, size);
> +}
> +EXPORT_SYMBOL_GPL(iommu_domain_window_enable);
> +
> +void iommu_domain_window_disable(struct iommu_domain *domain, u32 wnd_nr)
> +{
> +       if (unlikely(domain->ops->domain_window_disable == NULL))
> +               return;
> +
> +       return domain->ops->domain_window_disable(domain, wnd_nr);
> +}
> +EXPORT_SYMBOL_GPL(iommu_domain_window_disable);
> +
>  static int __init iommu_init(void)
>  {
>         iommu_group_kset = kset_create_and_add("iommu_groups",
> diff --git a/include/linux/iommu.h b/include/linux/iommu.h
> index 26066f5..0cba2d8 100644
> --- a/include/linux/iommu.h
> +++ b/include/linux/iommu.h
> @@ -101,6 +101,12 @@ struct iommu_ops {
>                                enum iommu_attr attr, void *data);
>         int (*domain_set_attr)(struct iommu_domain *domain,
>                                enum iommu_attr attr, void *data);
> +
> +       /* Window handling functions */
> +       int (*domain_window_enable)(struct iommu_domain *domain, u32 wnd_nr,
> +                                   phys_addr_t paddr, size_t size);
> +       void (*domain_window_disable)(struct iommu_domain *domain, u32 wnd_nr);
> +
>         unsigned long pgsize_bitmap;
>  };
>
> @@ -158,6 +164,10 @@ extern int iommu_domain_get_attr(struct iommu_domain *domain, enum iommu_attr,
>  extern int iommu_domain_set_attr(struct iommu_domain *domain, enum iommu_attr,
>                                  void *data);
>
> +/* Window handling function prototypes */
> +extern int iommu_domain_window_enable(struct iommu_domain *domain, u32 wnd_nr,
> +                                     phys_addr_t offset, size_t size);
> +extern void iommu_domain_window_disable(struct iommu_domain *domain, u32 wnd_nr);
>  /**
>   * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework
>   * @domain: the iommu domain where the fault has happened
> @@ -240,6 +250,18 @@ static inline int iommu_unmap(struct iommu_domain *domain, unsigned long iova,
>         return -ENODEV;
>  }
>
> +static inline int iommu_domain_window_enable(struct iommu_domain *domain,
> +                                            u32 wnd_nr, phys_addr_t paddr,
> +                                            size_t size)
> +{
> +       return -ENODEV;
> +}
> +
> +static inline void iommu_domain_window_disable(struct iommu_domain *domain,
> +                                              u32 wnd_nr)
> +{
> +}
> +
>  static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain,
>                                              unsigned long iova)
>  {

This API looks workable.   The one change we need is that the size argument in
the enable API needs to be 64 bits.   Our window sizes can exceed 4GB.

Stuart
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ