All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: David Kiarie <davidkiarie4@gmail.com>
Cc: qemu-devel@nongnu.org, jan.kizska@web.de, mst@redhat.com,
	valentine.sinitsyn@gmail.com, marcel@redhat.com,
	imammedo@redhat.com
Subject: Re: [Qemu-devel] [V9 3/4] hw/core: Add AMD IOMMU to machine properties
Date: Mon, 25 Apr 2016 11:00:08 +0800	[thread overview]
Message-ID: <20160425030008.GD3261@pxdev.xzpeter.org> (raw)
In-Reply-To: <1461535977-331-4-git-send-email-davidkiarie4@gmail.com>

On Mon, Apr 25, 2016 at 01:12:56AM +0300, David Kiarie wrote:
> Added a bool, subject to review to machine properties which
> it used to override iommu emulated from Intel to AMD.
> 
> Signed-off-by: David Kiarie <davidkiarie4@gmail.com>
> ---
>  hw/core/machine.c             | 32 +++++++++++++++++++++++++++++---
>  include/hw/boards.h           |  1 +
>  include/hw/i386/intel_iommu.h |  1 +
>  qemu-options.hx               |  7 +++++--
>  util/qemu-config.c            |  8 ++++++--
>  5 files changed, 42 insertions(+), 7 deletions(-)
> 
> diff --git a/hw/core/machine.c b/hw/core/machine.c
> index 6dbbc85..792641b 100644
> --- a/hw/core/machine.c
> +++ b/hw/core/machine.c
> @@ -15,6 +15,8 @@
>  #include "qapi/error.h"
>  #include "qapi-visit.h"
>  #include "qapi/visitor.h"
> +#include "hw/i386/amd_iommu.h"
> +#include "hw/i386/intel_iommu.h"
>  #include "hw/sysbus.h"
>  #include "sysemu/sysemu.h"
>  #include "qemu/error-report.h"
> @@ -300,6 +302,26 @@ static void machine_set_iommu(Object *obj, bool value, Error **errp)
>      ms->iommu = value;
>  }
>  
> +static void machine_set_iommu_override(Object *obj, const char *value,
> +                                       Error **errp)
> +{
> +    MachineState *ms = MACHINE(obj);
> +    Error *err = NULL;
> +
> +    ms->x_iommu_type = false;
> +    /* ensure a valid iommu type */
> +    if (g_strcmp0(value, AMD_IOMMU_STR) &&
> +            g_strcmp0(value, INTEL_IOMMU_STR)) {
> +        error_setg(errp, "Invalid IOMMU type %s", value);
> +        error_propagate(errp, err);
> +        return;
> +    }
> +
> +    if ((g_strcmp0(value, AMD_IOMMU_STR) == 0)) {
> +        ms->x_iommu_type = true;
> +    }

Would it be clearer to use:

    if (g_strcmp0(value, AMD_IOMMU_STR) == 0) {
        ...
    } else if (g_strcmp0(value, INTEL_IOMMU_STR) == 0) {
        ...
    } else {
        error...
    }

?

Thanks.

-- peterx

  reply	other threads:[~2016-04-25  3:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-24 22:12 [Qemu-devel] [V9 0/4] AMD IOMMU David Kiarie
2016-04-24 22:12 ` [Qemu-devel] [V9 1/4] hw/i386: Introduce " David Kiarie
2016-04-24 22:12 ` [Qemu-devel] [V9 2/4] hw/i386: ACPI table for " David Kiarie
2016-04-29  6:09   ` Jan Kiszka
2016-04-29  8:28     ` David Kiarie
2016-05-04  7:50       ` Valentine Sinitsyn
2016-05-04  7:45     ` Valentine Sinitsyn
2016-04-24 22:12 ` [Qemu-devel] [V9 3/4] hw/core: Add AMD IOMMU to machine properties David Kiarie
2016-04-25  3:00   ` Peter Xu [this message]
2016-04-24 22:12 ` [Qemu-devel] [V9 4/4] hw/pci-host: Emulate AMD IOMMU David Kiarie
2016-04-25  3:06   ` Peter Xu
2016-04-24 22:16 ` [Qemu-devel] [V9 0/4] " David Kiarie
2016-04-25  7:13   ` Jan Kiszka
2016-04-25 12:53 ` Marcel Apfelbaum
  -- strict thread matches above, loose matches on Subject: below --
2016-04-29 22:42 David Kiarie
2016-04-29 22:42 ` [Qemu-devel] [V9 3/4] hw/core: Add AMD IOMMU to machine properties David Kiarie
2016-05-01  9:15   ` Marcel Apfelbaum

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=20160425030008.GD3261@pxdev.xzpeter.org \
    --to=peterx@redhat.com \
    --cc=davidkiarie4@gmail.com \
    --cc=imammedo@redhat.com \
    --cc=jan.kizska@web.de \
    --cc=marcel@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=valentine.sinitsyn@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.