From: Julien Grall <julien.grall@linaro.org>
To: manish.jaggi@linaro.org, xen-devel@lists.xenproject.org,
sameer.goel@linaro.org, andre.przywara@linaro.org
Cc: manish.jaggi@cavium.com
Subject: Re: [RFC 01/11] acpi: arm: Public API for populating and query based on requesterid
Date: Tue, 16 Jan 2018 17:53:34 +0000 [thread overview]
Message-ID: <6c277855-b6fd-a9e6-a367-412a70d74386@linaro.org> (raw)
In-Reply-To: <20180102092809.1841-2-manish.jaggi@linaro.org>
Hi Manish,
On 02/01/18 09:27, manish.jaggi@linaro.org wrote:
> From: Manish Jaggi <manish.jaggi@linaro.org>
>
> Public API to populate and query map between requester id and
The commit message should not be indented.
> streamId/DeviceID. IORT is parsed one time (outside this patch)
> and two lists are created one for mapping between reuesterId and streamid
s/reuesterId/requesterID/
Please stay consistent in the naming (including the lowercase/uppercase).
Cheers,
> and another between requesterID and deviceID.
>
> These lists eliminate the need to reparse IORT for querying streamid
> or deviceid using requesterid.
>
> Signed-off-by: Manish Jaggi <manish.jaggi@linaro.org>
> ---
> xen/drivers/acpi/Makefile | 1 +
> xen/drivers/acpi/arm/Makefile | 1 +
> xen/drivers/acpi/arm/ridmap.c | 124 ++++++++++++++++++++++++++++++++++++++++++
> xen/include/acpi/ridmap.h | 77 ++++++++++++++++++++++++++
> 4 files changed, 203 insertions(+)
>
> diff --git a/xen/drivers/acpi/Makefile b/xen/drivers/acpi/Makefile
> index 444b11d583..80a074e007 100644
> --- a/xen/drivers/acpi/Makefile
> +++ b/xen/drivers/acpi/Makefile
> @@ -1,6 +1,7 @@
> subdir-y += tables
> subdir-y += utilities
> subdir-$(CONFIG_X86) += apei
> +subdir-$(CONFIG_ARM) += arm
>
> obj-bin-y += tables.init.o
> obj-$(CONFIG_NUMA) += numa.o
> diff --git a/xen/drivers/acpi/arm/Makefile b/xen/drivers/acpi/arm/Makefile
> new file mode 100644
> index 0000000000..046fad5e3d
> --- /dev/null
> +++ b/xen/drivers/acpi/arm/Makefile
> @@ -0,0 +1 @@
> +obj-y = ridmap.o
> diff --git a/xen/drivers/acpi/arm/ridmap.c b/xen/drivers/acpi/arm/ridmap.c
> new file mode 100644
> index 0000000000..2c3a8876ea
> --- /dev/null
> +++ b/xen/drivers/acpi/arm/ridmap.c
> @@ -0,0 +1,124 @@
> +/*
> + * xen/drivers/acpi/arm/ridmap.c
> + *
> + * Public API to populate and query map between requester id and
> + * streamId/DeviceID
> + *
> + * Manish Jaggi <manish.jaggi@linaro.org>
> + * Copyright (c) 2018 Linaro.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + */
> +
> +#include <acpi/ridmap.h>
> +#include <xen/iommu.h>
> +#include <xen/kernel.h>
> +#include <xen/list.h>
> +#include <xen/pci.h>
> +
> +struct list_head rid_streamid_map_list;
> +struct list_head rid_deviceid_map_list;
> +
> +void init_ridmaps(void)
> +{
> + INIT_LIST_HEAD(&rid_deviceid_map_list);
> + INIT_LIST_HEAD(&rid_streamid_map_list);
> +}
> +
> +int add_rid_streamid_map(struct acpi_iort_node *pcirc_node,
> + struct acpi_iort_node *smmu_node,
> + u32 input_base, u32 output_base, u32 id_count)
> +{
> + struct rid_streamid_map *rid_map;
> + rid_map = xzalloc(struct rid_streamid_map);
> +
> + if (!rid_map)
> + return -ENOMEM;
> +
> + rid_map->idmap.input_base = input_base;
> + rid_map->idmap.output_base = output_base;
> + rid_map->idmap.id_count = id_count;
> + rid_map->pcirc_node = pcirc_node;
> + rid_map->smmu_node = smmu_node;
> +
> + list_add_tail(&rid_map->entry, &rid_streamid_map_list);
> + return 0;
> +}
> +
> +int add_rid_deviceid_map(struct acpi_iort_node *pcirc_node,
> + struct acpi_iort_node *its_node,
> + u32 input_base, u32 output_base, u32 id_count)
> +{
> + struct rid_deviceid_map *rid_map;
> + rid_map = xzalloc(struct rid_deviceid_map);
> +
> + if (!rid_map)
> + return -ENOMEM;
> +
> + rid_map->idmap.input_base = input_base;
> + rid_map->idmap.output_base = output_base;
> + rid_map->idmap.id_count = id_count;
> + rid_map->pcirc_node = pcirc_node;
> + rid_map->its_node = its_node;
> +
> + list_add_tail(&rid_map->entry, &rid_deviceid_map_list);
> + return 0;
> +}
> +
> +void query_streamid(struct acpi_iort_node *pcirc_node, u16 rid, u32 *streamid,
> + struct acpi_iort_node **smmu_node)
> +{
> + struct rid_streamid_map *rmap;
> +
> + list_for_each_entry(rmap, &rid_streamid_map_list, entry)
> + {
> + if (rmap->pcirc_node == pcirc_node)
> + {
> + if ( (rid >= rmap->idmap.input_base) &&
> + (rid < rmap->idmap.input_base + rmap->idmap.id_count) )
> + {
> + *streamid = rid - rmap->idmap.input_base +
> + rmap->idmap.output_base;
> + *smmu_node = rmap->smmu_node;
> + break;
> + }
> + }
> + }
> +
> +}
> +
> +void query_deviceid(struct acpi_iort_node *pcirc_node, u16 rid, u32 *deviceid)
> +{
> + struct rid_deviceid_map *rmap;
> +
> + list_for_each_entry(rmap, &rid_deviceid_map_list, entry)
> + {
> + if (rmap->pcirc_node == pcirc_node)
> + {
> + if ( (rid >= rmap->idmap.input_base) &&
> + (rid < rmap->idmap.input_base + rmap->idmap.id_count) )
> + {
> + *deviceid = rid - rmap->idmap.input_base +
> + rmap->idmap.output_base;
> + break;
> + }
> + }
> + }
> +}
> +
> +/*
> + * Local variables:
> + * mode: C
> + * c-file-style: "BSD"
> + * c-basic-offset: 4
> + * indent-tabs-mode: nil
> + * End:
> + */
> diff --git a/xen/include/acpi/ridmap.h b/xen/include/acpi/ridmap.h
> new file mode 100644
> index 0000000000..806f401d89
> --- /dev/null
> +++ b/xen/include/acpi/ridmap.h
> @@ -0,0 +1,77 @@
> +/*
> + * xen/include/acpi/ridmap.h
> + *
> + * Mapping structures to hold map between requester id and streamId/DeviceID
> + * after paring the IORT table.
> + *
> + * Manish Jaggi <manish.jaggi@linaro.org>
> + * Copyright (c) 2018 Linaro.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + */
> +
> +#ifndef RID_MAP_H
> +#define RID_MAP_H
> +
> +#include <xen/acpi.h>
> +
> +struct id_map_struct
> +{
> + u16 input_base;
> + u32 output_base;
> + u16 id_count;
> +};
> +
> +struct rid_streamid_map
> +{
> + struct acpi_iort_node *pcirc_node;
> + struct id_map_struct idmap;
> + struct list_head entry;
> + struct acpi_iort_node *smmu_node;
> +};
> +
> +struct rid_deviceid_map
> +{
> + struct acpi_iort_node *pcirc_node;
> + struct acpi_iort_node *its_node;
> + struct id_map_struct idmap;
> + struct list_head entry;
> +};
> +
> +extern struct list_head rid_streamid_map_list;
> +extern struct list_head rid_deviceid_map_list;
> +
> +int add_rid_streamid_map(struct acpi_iort_node *pcirc_node,
> + struct acpi_iort_node *smmu_node,
> + u32 input_base, u32 output_base, u32 id_count);
> +
> +int add_rid_deviceid_map(struct acpi_iort_node *pcirc_node,
> + struct acpi_iort_node *its_node,
> + u32 input_base, u32 output_base, u32 id_count);
> +
> +void query_streamid(struct acpi_iort_node *pcirc_node, u16 rid, u32 *streamid,
> + struct acpi_iort_node **smmu_node);
> +
> +void query_deviceid(struct acpi_iort_node *pcirc_node,
> + u16 rid, u32 *deviceid);
> +
> +void init_ridmaps(void);
> +
> +#endif
> +
> +/*
> + * Local variables:
> + * mode: C
> + * c-file-style: "BSD"
> + * c-basic-offset: 4
> + * indent-tabs-mode: nil
> + * End:
> + */
>
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-01-16 17:53 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-02 9:27 [RFC 00/11] acpi: arm: IORT Support for Xen manish.jaggi
2018-01-02 9:27 ` [RFC 01/11] acpi: arm: Public API for populating and query based on requesterid manish.jaggi
2018-01-16 17:53 ` Julien Grall [this message]
2018-01-16 18:31 ` Julien Grall
2018-01-19 6:05 ` Manish Jaggi
2018-01-19 12:03 ` Julien Grall
2018-01-22 5:07 ` Manish Jaggi
2018-01-22 13:40 ` Julien Grall
2018-01-02 9:28 ` [RFC 02/11] acpi: arm: API to query estimated size of hardware domain's IORT manish.jaggi
2018-01-16 18:52 ` Julien Grall
2018-01-19 6:10 ` Manish Jaggi
2018-01-22 13:45 ` Julien Grall
2018-01-02 9:28 ` [RFC 03/11] acpi: arm: Code to generate Hardware Domains IORT manish.jaggi
2018-01-18 18:32 ` Julien Grall
2018-01-02 9:28 ` [RFC 04/11] Import iort.c and acpi_iort.h manish.jaggi
2018-01-02 9:28 ` [RFC 05/11] Import fwnode.h from linux manish.jaggi
2018-01-02 9:28 ` [RFC 06/11] fwnode xen spacific changes manish.jaggi
2018-01-18 18:51 ` Julien Grall
2018-03-06 10:27 ` Manish Jaggi
2018-03-06 14:29 ` Julien Grall
2018-03-06 13:43 ` Manish Jaggi
2018-03-06 13:44 ` Manish Jaggi
2018-03-06 14:22 ` Julien Grall
2018-01-02 9:28 ` [RFC 07/11] Add kernel helper functions manish.jaggi
2018-01-18 18:55 ` Julien Grall
2018-01-19 9:33 ` Jan Beulich
2018-02-08 21:56 ` Sameer Goel
2018-01-02 9:28 ` [RFC 08/11] Add ACPI_IORT config manish.jaggi
2018-01-18 19:01 ` Julien Grall
2018-01-02 9:28 ` [RFC 09/11] Xen IORT Changes manish.jaggi
2018-01-18 19:10 ` Julien Grall
2018-01-02 9:28 ` [RFC 10/11] IORT parsing functions to prepare requesterId maps manish.jaggi
2018-01-02 9:28 ` [RFC 11/11] Add to_pci_dev macro manish.jaggi
2018-01-18 19:15 ` Julien Grall
2018-02-08 21:54 ` Sameer Goel
2018-01-16 17:53 ` [RFC 00/11] acpi: arm: IORT Support for Xen Julien Grall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6c277855-b6fd-a9e6-a367-412a70d74386@linaro.org \
--to=julien.grall@linaro.org \
--cc=andre.przywara@linaro.org \
--cc=manish.jaggi@cavium.com \
--cc=manish.jaggi@linaro.org \
--cc=sameer.goel@linaro.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).