All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Eduardo Habkost <ehabkost@redhat.com>
Subject: [PATCH for-6.2 1/8] softmmu: Use accel_find("xen") instead of xen_available()
Date: Fri, 30 Jul 2021 11:59:40 +0100	[thread overview]
Message-ID: <20210730105947.28215-2-peter.maydell@linaro.org> (raw)
In-Reply-To: <20210730105947.28215-1-peter.maydell@linaro.org>

The xen_available() function is used only to produce an error
for some Xen-specific command line options in QEMU binaries where
Xen support was not compiled in: it just returns the value of
the CONFIG_XEN define.

Now that accelerators are QOM classes, we can check for
"does this binary have Xen compiled in" with accel_find("xen"),
and drop the xen_available() function.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 include/sysemu/arch_init.h | 1 -
 softmmu/arch_init.c        | 9 ---------
 softmmu/vl.c               | 6 +++---
 3 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h
index e723c467eb2..7acfc62418f 100644
--- a/include/sysemu/arch_init.h
+++ b/include/sysemu/arch_init.h
@@ -30,7 +30,6 @@ enum {
 extern const uint32_t arch_type;
 
 int kvm_available(void);
-int xen_available(void);
 
 /* default virtio transport per architecture */
 #define QEMU_ARCH_VIRTIO_PCI (QEMU_ARCH_ALPHA | QEMU_ARCH_ARM | \
diff --git a/softmmu/arch_init.c b/softmmu/arch_init.c
index 6ff9f30badd..3f4d7c1b1cd 100644
--- a/softmmu/arch_init.c
+++ b/softmmu/arch_init.c
@@ -96,12 +96,3 @@ int kvm_available(void)
     return 0;
 #endif
 }
-
-int xen_available(void)
-{
-#ifdef CONFIG_XEN
-    return 1;
-#else
-    return 0;
-#endif
-}
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 4dee472c794..a32d15b6a1f 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -3429,21 +3429,21 @@ void qemu_init(int argc, char **argv, char **envp)
                 has_defaults = 0;
                 break;
             case QEMU_OPTION_xen_domid:
-                if (!(xen_available())) {
+                if (!(accel_find("xen"))) {
                     error_report("Option not supported for this target");
                     exit(1);
                 }
                 xen_domid = atoi(optarg);
                 break;
             case QEMU_OPTION_xen_attach:
-                if (!(xen_available())) {
+                if (!(accel_find("xen"))) {
                     error_report("Option not supported for this target");
                     exit(1);
                 }
                 xen_mode = XEN_ATTACH;
                 break;
             case QEMU_OPTION_xen_domid_restrict:
-                if (!(xen_available())) {
+                if (!(accel_find("xen"))) {
                     error_report("Option not supported for this target");
                     exit(1);
                 }
-- 
2.20.1



  reply	other threads:[~2021-07-30 11:05 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-30 10:59 [PATCH for-6.2 0/8] softmmu: Clean up arch_init.c Peter Maydell
2021-07-30 10:59 ` Peter Maydell [this message]
2021-07-30 18:41   ` [PATCH for-6.2 1/8] softmmu: Use accel_find("xen") instead of xen_available() Richard Henderson
2021-07-30 10:59 ` [PATCH for-6.2 2/8] monitor: Use accel_find("kvm") instead of kvm_available() Peter Maydell
2021-07-30 18:41   ` Richard Henderson
2021-07-30 10:59 ` [PATCH for-6.2 3/8] softmmu/arch_init.c: Trim down include list Peter Maydell
2021-07-30 18:42   ` Richard Henderson
2021-07-30 10:59 ` [PATCH for-6.2 4/8] meson.build: Define QEMU_ARCH in config-target.h Peter Maydell
2021-07-30 13:19   ` Philippe Mathieu-Daudé
2021-07-30 18:43   ` Richard Henderson
2021-07-30 10:59 ` [PATCH for-6.2 5/8] arch_init.h: Add QEMU_ARCH_HEXAGON Peter Maydell
2021-07-30 13:20   ` Philippe Mathieu-Daudé
2021-07-30 18:44   ` Richard Henderson
2021-07-30 19:36   ` Taylor Simpson
2021-07-30 10:59 ` [PATCH for-6.2 6/8] arch_init.h: Move QEMU_ARCH_VIRTIO_* to qdev-monitor.c Peter Maydell
2021-07-30 18:46   ` Richard Henderson
2021-08-26 14:41   ` Markus Armbruster
2021-07-30 10:59 ` [PATCH for-6.2 7/8] arch_init.h: Don't include arch_init.h unnecessarily Peter Maydell
2021-07-30 13:21   ` Philippe Mathieu-Daudé
2021-07-30 18:45   ` Richard Henderson
2021-08-01  0:54   ` Alistair Francis
2021-07-30 10:59 ` [PATCH for-6.2 8/8] stubs: Remove unused arch_type.c stub Peter Maydell
2021-07-30 13:23   ` Philippe Mathieu-Daudé
2021-07-30 18:46   ` Richard Henderson
2021-08-26 14:33 ` [PATCH for-6.2 0/8] softmmu: Clean up arch_init.c Peter Maydell

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=20210730105947.28215-2-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=armbru@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=pbonzini@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 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.