From: "Liu, Yi L" <yi.l.liu@linux.intel.com>
To: Peter Xu <peterx@redhat.com>
Cc: qemu-devel@nongnu.org, Jason Wang <jasowang@redhat.com>,
"Michael S . Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/2] intel_iommu: remove X86_IOMMU_PCI_DEVFN_MAX
Date: Fri, 8 Dec 2017 14:50:52 +0800 [thread overview]
Message-ID: <20171208065052.GA2392@sky-dev> (raw)
In-Reply-To: <20171208042654.10910-2-peterx@redhat.com>
On Fri, Dec 08, 2017 at 12:26:53PM +0800, Peter Xu wrote:
Looks good to me.
Reviewed-by: Liu, Yi L <yi.l.liu@intel.com>
> We have PCI_DEVFN_MAX now.
>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
> hw/i386/intel_iommu.c | 10 +++++-----
> include/hw/i386/x86-iommu.h | 1 -
> 2 files changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
> index 3a5bb0bc2e..c1fa08d205 100644
> --- a/hw/i386/intel_iommu.c
> +++ b/hw/i386/intel_iommu.c
> @@ -186,7 +186,7 @@ static void vtd_reset_context_cache(IntelIOMMUState *s)
> g_hash_table_iter_init(&bus_it, s->vtd_as_by_busptr);
>
> while (g_hash_table_iter_next (&bus_it, NULL, (void**)&vtd_bus)) {
> - for (devfn_it = 0; devfn_it < X86_IOMMU_PCI_DEVFN_MAX; ++devfn_it) {
> + for (devfn_it = 0; devfn_it < PCI_DEVFN_MAX; ++devfn_it) {
> vtd_as = vtd_bus->dev_as[devfn_it];
> if (!vtd_as) {
> continue;
> @@ -1002,7 +1002,7 @@ static void vtd_switch_address_space_all(IntelIOMMUState *s)
>
> g_hash_table_iter_init(&iter, s->vtd_as_by_busptr);
> while (g_hash_table_iter_next(&iter, NULL, (void **)&vtd_bus)) {
> - for (i = 0; i < X86_IOMMU_PCI_DEVFN_MAX; i++) {
> + for (i = 0; i < PCI_DEVFN_MAX; i++) {
> if (!vtd_bus->dev_as[i]) {
> continue;
> }
> @@ -1294,7 +1294,7 @@ static void vtd_context_device_invalidate(IntelIOMMUState *s,
> vtd_bus = vtd_find_as_from_bus_num(s, bus_n);
> if (vtd_bus) {
> devfn = VTD_SID_TO_DEVFN(source_id);
> - for (devfn_it = 0; devfn_it < X86_IOMMU_PCI_DEVFN_MAX; ++devfn_it) {
> + for (devfn_it = 0; devfn_it < PCI_DEVFN_MAX; ++devfn_it) {
> vtd_as = vtd_bus->dev_as[devfn_it];
> if (vtd_as && ((devfn_it & mask) == (devfn & mask))) {
> trace_vtd_inv_desc_cc_device(bus_n, VTD_PCI_SLOT(devfn_it),
> @@ -2699,7 +2699,7 @@ VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s, PCIBus *bus, int devfn)
> *new_key = (uintptr_t)bus;
> /* No corresponding free() */
> vtd_bus = g_malloc0(sizeof(VTDBus) + sizeof(VTDAddressSpace *) * \
> - X86_IOMMU_PCI_DEVFN_MAX);
> + PCI_DEVFN_MAX);
> vtd_bus->bus = bus;
> g_hash_table_insert(s->vtd_as_by_busptr, new_key, vtd_bus);
> }
> @@ -2982,7 +2982,7 @@ static AddressSpace *vtd_host_dma_iommu(PCIBus *bus, void *opaque, int devfn)
> IntelIOMMUState *s = opaque;
> VTDAddressSpace *vtd_as;
>
> - assert(0 <= devfn && devfn < X86_IOMMU_PCI_DEVFN_MAX);
> + assert(0 <= devfn && devfn < PCI_DEVFN_MAX);
>
> vtd_as = vtd_find_add_as(s, bus, devfn);
> return &vtd_as->as;
> diff --git a/include/hw/i386/x86-iommu.h b/include/hw/i386/x86-iommu.h
> index ef89c0c646..7c71fc7470 100644
> --- a/include/hw/i386/x86-iommu.h
> +++ b/include/hw/i386/x86-iommu.h
> @@ -31,7 +31,6 @@
> #define X86_IOMMU_GET_CLASS(obj) \
> OBJECT_GET_CLASS(X86IOMMUClass, obj, TYPE_X86_IOMMU_DEVICE)
>
> -#define X86_IOMMU_PCI_DEVFN_MAX 256
> #define X86_IOMMU_SID_INVALID (0xffff)
>
> typedef struct X86IOMMUState X86IOMMUState;
> --
> 2.14.3
>
>
next prev parent reply other threads:[~2017-12-08 7:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-08 4:26 [Qemu-devel] [PATCH 0/2] vtd: tiny fixes for 2.12 Peter Xu
2017-12-08 4:26 ` [Qemu-devel] [PATCH 1/2] intel_iommu: remove X86_IOMMU_PCI_DEVFN_MAX Peter Xu
2017-12-08 6:50 ` Liu, Yi L [this message]
2017-12-08 4:26 ` [Qemu-devel] [PATCH 2/2] intel_iommu: fix error param in string Peter Xu
2017-12-08 6:52 ` Liu, Yi L
2017-12-20 3:16 ` [Qemu-devel] [PATCH 0/2] vtd: tiny fixes for 2.12 Peter Xu
2017-12-20 8:43 ` Jason Wang
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=20171208065052.GA2392@sky-dev \
--to=yi.l.liu@linux.intel.com \
--cc=jasowang@redhat.com \
--cc=mst@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.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).