Changeset
docs/formatdomain.html.in                               | 5 +++--
docs/schemas/domaincommon.rng                           | 1 +
src/conf/domain_conf.c                                  | 3 ++-
src/conf/domain_conf.h                                  | 1 +
src/qemu/qemu_capabilities.c                            | 2 ++
src/qemu/qemu_capabilities.h                            | 1 +
src/qemu/qemu_command.c                                 | 5 ++++-
tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml        | 1 +
tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml        | 1 +
tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml        | 1 +
tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml        | 1 +
tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml      | 1 +
tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml        | 1 +
tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml       | 1 +
tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml      | 1 +
tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml        | 1 +
tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml       | 1 +
tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml        | 1 +
tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml        | 1 +
tests/qemucapabilitiesdata/caps_2.6.0.aarch64.xml       | 1 +
tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml         | 1 +
tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml        | 1 +
tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml        | 1 +
tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml        | 1 +
tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml         | 1 +
tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml        | 1 +
tests/qemustatusxml2xmldata/migration-in-params-in.xml  | 1 +
tests/qemustatusxml2xmldata/migration-out-nbd-in.xml    | 1 +
tests/qemustatusxml2xmldata/migration-out-nbd-out.xml   | 1 +
tests/qemustatusxml2xmldata/migration-out-params-in.xml | 1 +
tests/qemustatusxml2xmldata/modern-in.xml               | 1 +
tests/qemuxml2argvdata/sound-device.args                | 2 ++
tests/qemuxml2argvdata/sound-device.xml                 | 2 ++
tests/qemuxml2argvtest.c                                | 1 +
tests/qemuxml2xmloutdata/sound-device.xml               | 2 ++
35 files changed, 45 insertions(+), 4 deletions(-)
Git apply log
Switched to a new branch '20180516221112.22268-1-filipalac@gmail.com'
Applying: qemu: Add support for -device hda-output (disable line-in)
To https://github.com/patchew-project/libvirt
 + 612887b...173f2f3 patchew/20180516221112.22268-1-filipalac@gmail.com -> patchew/20180516221112.22268-1-filipalac@gmail.com (forced update)
Test passed: syntax-check

loading

[libvirt] [PATCH] qemu: Add support for -device hda-output (disable line-in)
Posted by Filip Alac, 6 days ago
Add support for hda 'output' codec for ich6 and ich9 sound devices,
which allow us to disable line-in for guest.

Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=1126641

Signed-off-by: Filip Alac <filipalac@gmail.com>
---
 docs/formatdomain.html.in                               | 5 +++--
 docs/schemas/domaincommon.rng                           | 1 +
 src/conf/domain_conf.c                                  | 3 ++-
 src/conf/domain_conf.h                                  | 1 +
 src/qemu/qemu_capabilities.c                            | 2 ++
 src/qemu/qemu_capabilities.h                            | 1 +
 src/qemu/qemu_command.c                                 | 5 ++++-
 tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml        | 1 +
 tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml        | 1 +
 tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml        | 1 +
 tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml        | 1 +
 tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml      | 1 +
 tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml        | 1 +
 tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml       | 1 +
 tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml      | 1 +
 tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml        | 1 +
 tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml       | 1 +
 tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml        | 1 +
 tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml        | 1 +
 tests/qemucapabilitiesdata/caps_2.6.0.aarch64.xml       | 1 +
 tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml         | 1 +
 tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml        | 1 +
 tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml        | 1 +
 tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml        | 1 +
 tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml         | 1 +
 tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml        | 1 +
 tests/qemustatusxml2xmldata/migration-in-params-in.xml  | 1 +
 tests/qemustatusxml2xmldata/migration-out-nbd-in.xml    | 1 +
 tests/qemustatusxml2xmldata/migration-out-nbd-out.xml   | 1 +
 tests/qemustatusxml2xmldata/migration-out-params-in.xml | 1 +
 tests/qemustatusxml2xmldata/modern-in.xml               | 1 +
 tests/qemuxml2argvdata/sound-device.args                | 2 ++
 tests/qemuxml2argvdata/sound-device.xml                 | 2 ++
 tests/qemuxml2argvtest.c                                | 1 +
 tests/qemuxml2xmloutdata/sound-device.xml               | 2 ++
 35 files changed, 45 insertions(+), 4 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 0d0fd3b9..8ab45e1c 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -7388,8 +7388,9 @@ qemu-kvm -net nic,model=? /dev/null
       sub-elements <code>&lt;codec&gt;</code> to attach various audio
       codecs to the audio device. If not specified, a default codec
       will be attached to allow playback and recording. Valid values
-      are 'duplex' (advertise a line-in and a line-out) and 'micro'
-      (advertise a speaker and a microphone).
+      are 'duplex' (advertise a line-in and a line-out), 'micro'
+       (advertise a speaker and a microphone) and 'output'
+       (advertise a speaker).
     </p>
 
 <pre>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 71ac3d07..f16e1573 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3824,6 +3824,7 @@
         <choice>
           <value>duplex</value>
           <value>micro</value>
+          <value>output</value>
         </choice>
       </attribute>
     </element>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 3689ac0a..f12c87d2 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -529,7 +529,8 @@ VIR_ENUM_IMPL(virDomainSmartcard, VIR_DOMAIN_SMARTCARD_TYPE_LAST,
 
 VIR_ENUM_IMPL(virDomainSoundCodec, VIR_DOMAIN_SOUND_CODEC_TYPE_LAST,
               "duplex",
-              "micro")
+              "micro",
+              "output")
 
 VIR_ENUM_IMPL(virDomainSoundModel, VIR_DOMAIN_SOUND_MODEL_LAST,
               "sb16",
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index a78fdee4..ee3285a9 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1335,6 +1335,7 @@ struct _virDomainInputDef {
 typedef enum {
     VIR_DOMAIN_SOUND_CODEC_TYPE_DUPLEX,
     VIR_DOMAIN_SOUND_CODEC_TYPE_MICRO,
+    VIR_DOMAIN_SOUND_CODEC_TYPE_OUTPUT,
 
     VIR_DOMAIN_SOUND_CODEC_TYPE_LAST
 } virDomainSoundCodecType;
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index a5cb24fe..ba085a9e 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -486,6 +486,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
 
               /* 300 */
               "sdl-gl",
+              "hda-output",
     );
 
 
@@ -1015,6 +1016,7 @@ struct virQEMUCapsStringFlags virQEMUCapsEvents[] = {
 struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
     { "hda-duplex", QEMU_CAPS_HDA_DUPLEX },
     { "hda-micro", QEMU_CAPS_HDA_MICRO },
+    { "hda-output", QEMU_CAPS_HDA_OUTPUT},
     { "ccid-card-emulated", QEMU_CAPS_CCID_EMULATED },
     { "ccid-card-passthru", QEMU_CAPS_CCID_PASSTHRU },
     { "piix3-usb-uhci", QEMU_CAPS_PIIX3_USB_UHCI },
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index d23c34c2..3e9a8b30 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -470,6 +470,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
 
     /* 300 */
     QEMU_CAPS_SDL_GL, /* -sdl gl */
+    QEMU_CAPS_HDA_OUTPUT, /* -device hda-output*/
 
     QEMU_CAPS_LAST /* this must always be the last item */
 } virQEMUCapsFlags;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index c4237339..aee5bde5 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -139,7 +139,8 @@ VIR_ENUM_DECL(qemuSoundCodec)
 
 VIR_ENUM_IMPL(qemuSoundCodec, VIR_DOMAIN_SOUND_CODEC_TYPE_LAST,
               "hda-duplex",
-              "hda-micro");
+              "hda-micro",
+              "hda-output");
 
 VIR_ENUM_DECL(qemuControllerModelUSB)
 
@@ -4172,6 +4173,8 @@ qemuSoundCodecTypeToCaps(int type)
         return QEMU_CAPS_HDA_DUPLEX;
     case VIR_DOMAIN_SOUND_CODEC_TYPE_MICRO:
         return QEMU_CAPS_HDA_MICRO;
+    case VIR_DOMAIN_SOUND_CODEC_TYPE_OUTPUT:
+        return QEMU_CAPS_HDA_OUTPUT;
     default:
         return -1;
     }
diff --git a/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml b/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml
index e7c2e9a1..2b13ebc1 100644
--- a/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml
@@ -105,6 +105,7 @@
   <flag name='query-cpu-definitions'/>
   <flag name='kernel-irqchip'/>
   <flag name='isa-serial'/>
+  <flag name='hda-output'/>
   <version>1005003</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>46523</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml
index e57dec32..ecd31293 100644
--- a/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml
@@ -110,6 +110,7 @@
   <flag name='query-cpu-definitions'/>
   <flag name='kernel-irqchip'/>
   <flag name='isa-serial'/>
+  <flag name='hda-output'/>
   <version>1006000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>44752</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml
index 39ec8f9b..c31a9721 100644
--- a/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml
@@ -112,6 +112,7 @@
   <flag name='query-cpu-definitions'/>
   <flag name='kernel-irqchip'/>
   <flag name='isa-serial'/>
+  <flag name='hda-output'/>
   <version>1007000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>50196</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml
index afe0882d..07cb2a37 100644
--- a/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml
@@ -128,6 +128,7 @@
   <flag name='query-named-block-nodes'/>
   <flag name='kernel-irqchip'/>
   <flag name='isa-serial'/>
+  <flag name='hda-output'/>
   <version>2001001</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>58992</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml
index 59043068..e11c1122 100644
--- a/tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml
@@ -155,6 +155,7 @@
   <flag name='disk-write-cache'/>
   <flag name='nbd-tls'/>
   <flag name='sdl-gl'/>
+  <flag name='hda-output'/>
   <version>2010000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>303541</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml
index 2912c8d6..21d91c8d 100644
--- a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml
@@ -154,6 +154,7 @@
   <flag name='disk-write-cache'/>
   <flag name='nbd-tls'/>
   <flag name='sdl-gl'/>
+  <flag name='hda-output'/>
   <version>2010000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>382824</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml
index 77ca3013..7821144e 100644
--- a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml
@@ -197,6 +197,7 @@
   <flag name='disk-write-cache'/>
   <flag name='nbd-tls'/>
   <flag name='sdl-gl'/>
+  <flag name='hda-output'/>
   <version>2010000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>344938</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml
index cabe4f2f..e4f22684 100644
--- a/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml
@@ -162,6 +162,7 @@
   <flag name='qom-list-properties'/>
   <flag name='memory-backend-file.discard-data'/>
   <flag name='sdl-gl'/>
+  <flag name='hda-output'/>
   <version>2011090</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>343099</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml
index bffe3b3b..3e393633 100644
--- a/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml
@@ -159,6 +159,7 @@
   <flag name='qom-list-properties'/>
   <flag name='memory-backend-file.discard-data'/>
   <flag name='sdl-gl'/>
+  <flag name='hda-output'/>
   <version>2011090</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>419968</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml
index 4247afeb..35eadc18 100644
--- a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml
@@ -200,6 +200,7 @@
   <flag name='qom-list-properties'/>
   <flag name='memory-backend-file.discard-data'/>
   <flag name='sdl-gl'/>
+  <flag name='hda-output'/>
   <version>2011090</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>390813</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml
index 871eb5e4..56861723 100644
--- a/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml
@@ -154,6 +154,7 @@
   <flag name='virtio-gpu.max_outputs'/>
   <flag name='isa-serial'/>
   <flag name='sdl-gl'/>
+  <flag name='hda-output'/>
   <version>2004000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>75406</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml
index 90dce5a7..e86fce9f 100644
--- a/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml
@@ -160,6 +160,7 @@
   <flag name='virtio-gpu.max_outputs'/>
   <flag name='isa-serial'/>
   <flag name='sdl-gl'/>
+  <flag name='hda-output'/>
   <version>2005000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>216528</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.6.0.aarch64.xml
index 42985489..e5268eda 100644
--- a/tests/qemucapabilitiesdata/caps_2.6.0.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.6.0.aarch64.xml
@@ -142,6 +142,7 @@
   <flag name='dump-completed'/>
   <flag name='nbd-tls'/>
   <flag name='sdl-gl'/>
+  <flag name='hda-output'/>
   <version>2006000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>228241</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml
index 07cdc49b..7e514be6 100644
--- a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml
@@ -137,6 +137,7 @@
   <flag name='dump-completed'/>
   <flag name='nbd-tls'/>
   <flag name='sdl-gl'/>
+  <flag name='hda-output'/>
   <version>2006000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>263005</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml
index 4c6371a6..0d542b87 100644
--- a/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml
@@ -172,6 +172,7 @@
   <flag name='dump-completed'/>
   <flag name='nbd-tls'/>
   <flag name='sdl-gl'/>
+  <flag name='hda-output'/>
   <version>2006000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>227332</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml
index c322d18d..5795bc95 100644
--- a/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml
@@ -177,6 +177,7 @@
   <flag name='disk-write-cache'/>
   <flag name='nbd-tls'/>
   <flag name='sdl-gl'/>
+  <flag name='hda-output'/>
   <version>2007000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>239029</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml
index 7c329ad4..bd467d27 100644
--- a/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml
@@ -179,6 +179,7 @@
   <flag name='disk-write-cache'/>
   <flag name='nbd-tls'/>
   <flag name='sdl-gl'/>
+  <flag name='hda-output'/>
   <version>2008000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>255684</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml
index cfc94050..1e6d0cc3 100644
--- a/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml
@@ -146,6 +146,7 @@
   <flag name='disk-write-cache'/>
   <flag name='nbd-tls'/>
   <flag name='sdl-gl'/>
+  <flag name='hda-output'/>
   <version>2009000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>346538</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
index 0701c244..7e45b311 100644
--- a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
@@ -192,6 +192,7 @@
   <flag name='disk-write-cache'/>
   <flag name='nbd-tls'/>
   <flag name='sdl-gl'/>
+  <flag name='hda-output'/>
   <version>2009000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>320947</microcodeVersion>
diff --git a/tests/qemustatusxml2xmldata/migration-in-params-in.xml b/tests/qemustatusxml2xmldata/migration-in-params-in.xml
index b0caa34e..03f18b4f 100644
--- a/tests/qemustatusxml2xmldata/migration-in-params-in.xml
+++ b/tests/qemustatusxml2xmldata/migration-in-params-in.xml
@@ -236,6 +236,7 @@
     <flag name='iscsi.password-secret'/>
     <flag name='isa-serial'/>
     <flag name='dump-completed'/>
+    <flag name='hda-output'/>
   </qemuCaps>
   <job type='none' async='migration in' phase='prepare' flags='0x900'>
     <migParams>
diff --git a/tests/qemustatusxml2xmldata/migration-out-nbd-in.xml b/tests/qemustatusxml2xmldata/migration-out-nbd-in.xml
index 6d87c1ec..636accf0 100644
--- a/tests/qemustatusxml2xmldata/migration-out-nbd-in.xml
+++ b/tests/qemustatusxml2xmldata/migration-out-nbd-in.xml
@@ -229,6 +229,7 @@
     <flag name='iscsi.password-secret'/>
     <flag name='isa-serial'/>
     <flag name='dump-completed'/>
+    <flag name='hda-output'/>
   </qemuCaps>
   <job type='none' async='migration out' phase='perform3'>
     <disk dev='vdb' migrating='yes'/>
diff --git a/tests/qemustatusxml2xmldata/migration-out-nbd-out.xml b/tests/qemustatusxml2xmldata/migration-out-nbd-out.xml
index 05da1f81..315d8e4c 100644
--- a/tests/qemustatusxml2xmldata/migration-out-nbd-out.xml
+++ b/tests/qemustatusxml2xmldata/migration-out-nbd-out.xml
@@ -229,6 +229,7 @@
     <flag name='iscsi.password-secret'/>
     <flag name='isa-serial'/>
     <flag name='dump-completed'/>
+    <flag name='hda-output'/>
   </qemuCaps>
   <job type='none' async='migration out' phase='perform3' flags='0x0'>
     <disk dev='vdb' migrating='yes'/>
diff --git a/tests/qemustatusxml2xmldata/migration-out-params-in.xml b/tests/qemustatusxml2xmldata/migration-out-params-in.xml
index 17649796..ae206483 100644
--- a/tests/qemustatusxml2xmldata/migration-out-params-in.xml
+++ b/tests/qemustatusxml2xmldata/migration-out-params-in.xml
@@ -236,6 +236,7 @@
     <flag name='iscsi.password-secret'/>
     <flag name='isa-serial'/>
     <flag name='dump-completed'/>
+    <flag name='hda-output'/>
   </qemuCaps>
   <job type='none' async='migration out' phase='perform3' flags='0x802'>
     <disk dev='vda' migrating='no'/>
diff --git a/tests/qemustatusxml2xmldata/modern-in.xml b/tests/qemustatusxml2xmldata/modern-in.xml
index d63fcf79..5b7e2a34 100644
--- a/tests/qemustatusxml2xmldata/modern-in.xml
+++ b/tests/qemustatusxml2xmldata/modern-in.xml
@@ -232,6 +232,7 @@
     <flag name='iscsi.password-secret'/>
     <flag name='isa-serial'/>
     <flag name='dump-completed'/>
+    <flag name='hda-output'/>
   </qemuCaps>
   <devices>
     <device alias='rng0'/>
diff --git a/tests/qemuxml2argvdata/sound-device.args b/tests/qemuxml2argvdata/sound-device.args
index ee8313bf..f97050a0 100644
--- a/tests/qemuxml2argvdata/sound-device.args
+++ b/tests/qemuxml2argvdata/sound-device.args
@@ -33,10 +33,12 @@ server,nowait \
 -device intel-hda,id=sound5,bus=pci.0,addr=0x6 \
 -device hda-micro,id=sound5-codec0,bus=sound5.0,cad=0 \
 -device hda-duplex,id=sound5-codec1,bus=sound5.0,cad=1 \
+-device hda-output,id=sound5-codec2,bus=sound5.0,cad=2 \
 -device ich9-intel-hda,id=sound6,bus=pci.0,addr=0x7 \
 -device hda-duplex,id=sound6-codec0,bus=sound6.0,cad=0 \
 -device ich9-intel-hda,id=sound7,bus=pci.0,addr=0x8 \
 -device hda-micro,id=sound7-codec0,bus=sound7.0,cad=0 \
 -device hda-duplex,id=sound7-codec1,bus=sound7.0,cad=1 \
+-device hda-output,id=sound7-codec2,bus=sound7.0,cad=2 \
 -device usb-audio,id=sound8,bus=usb.0,port=1 \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x9
diff --git a/tests/qemuxml2argvdata/sound-device.xml b/tests/qemuxml2argvdata/sound-device.xml
index bceb9d1f..c544e931 100644
--- a/tests/qemuxml2argvdata/sound-device.xml
+++ b/tests/qemuxml2argvdata/sound-device.xml
@@ -32,11 +32,13 @@
     <sound model='ich6'>
       <codec type='micro'/>
       <codec type='duplex'/>
+      <codec type='output'/>
     </sound>
     <sound model='ich9'/>
     <sound model='ich9'>
       <codec type='micro'/>
       <codec type='duplex'/>
+      <codec type='output'/>
     </sound>
     <sound model='usb'/>
     <memballoon model='virtio'/>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 07e5ba1d..ff32347f 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1515,6 +1515,7 @@ mymain(void)
     DO_TEST("sound", NONE);
     DO_TEST("sound-device",
             QEMU_CAPS_HDA_DUPLEX, QEMU_CAPS_HDA_MICRO,
+            QEMU_CAPS_HDA_OUTPUT,
             QEMU_CAPS_DEVICE_ICH9_INTEL_HDA,
             QEMU_CAPS_OBJECT_USB_AUDIO);
     DO_TEST("fs9p", NONE);
diff --git a/tests/qemuxml2xmloutdata/sound-device.xml b/tests/qemuxml2xmloutdata/sound-device.xml
index 62336a8c..cbf4d179 100644
--- a/tests/qemuxml2xmloutdata/sound-device.xml
+++ b/tests/qemuxml2xmloutdata/sound-device.xml
@@ -43,6 +43,7 @@
     <sound model='ich6'>
       <codec type='micro'/>
       <codec type='duplex'/>
+      <codec type='output'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
     </sound>
     <sound model='ich9'>
@@ -51,6 +52,7 @@
     <sound model='ich9'>
       <codec type='micro'/>
       <codec type='duplex'/>
+      <codec type='output'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
     </sound>
     <sound model='usb'/>
-- 
2.17.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: Add support for -device hda-output (disable line-in)
Posted by Erik Skultety, 5 days ago
On Thu, May 17, 2018 at 12:11:12AM +0200, Filip Alac wrote:
> Add support for hda 'output' codec for ich6 and ich9 sound devices,
> which allow us to disable line-in for guest.
>
> Fixes:
> https://bugzilla.redhat.com/show_bug.cgi?id=1126641
>
> Signed-off-by: Filip Alac <filipalac@gmail.com>
> ---
>  docs/formatdomain.html.in                               | 5 +++--
>  docs/schemas/domaincommon.rng                           | 1 +
>  src/conf/domain_conf.c                                  | 3 ++-
>  src/conf/domain_conf.h                                  | 1 +
>  src/qemu/qemu_capabilities.c                            | 2 ++
>  src/qemu/qemu_capabilities.h                            | 1 +
>  src/qemu/qemu_command.c                                 | 5 ++++-
>  tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml        | 1 +
>  tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml        | 1 +
>  tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml        | 1 +
>  tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml        | 1 +
>  tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml      | 1 +
>  tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml        | 1 +
>  tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml       | 1 +
>  tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml      | 1 +
>  tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml        | 1 +
>  tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml       | 1 +
>  tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml        | 1 +
>  tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml        | 1 +
>  tests/qemucapabilitiesdata/caps_2.6.0.aarch64.xml       | 1 +
>  tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml         | 1 +
>  tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml        | 1 +
>  tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml        | 1 +
>  tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml        | 1 +
>  tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml         | 1 +
>  tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml        | 1 +
>  tests/qemustatusxml2xmldata/migration-in-params-in.xml  | 1 +
>  tests/qemustatusxml2xmldata/migration-out-nbd-in.xml    | 1 +
>  tests/qemustatusxml2xmldata/migration-out-nbd-out.xml   | 1 +
>  tests/qemustatusxml2xmldata/migration-out-params-in.xml | 1 +
>  tests/qemustatusxml2xmldata/modern-in.xml               | 1 +
>  tests/qemuxml2argvdata/sound-device.args                | 2 ++
>  tests/qemuxml2argvdata/sound-device.xml                 | 2 ++
>  tests/qemuxml2argvtest.c                                | 1 +
>  tests/qemuxml2xmloutdata/sound-device.xml               | 2 ++
>  35 files changed, 45 insertions(+), 4 deletions(-)
>
> diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
> index 0d0fd3b9..8ab45e1c 100644
> --- a/docs/formatdomain.html.in
> +++ b/docs/formatdomain.html.in
> @@ -7388,8 +7388,9 @@ qemu-kvm -net nic,model=? /dev/null
>        sub-elements <code>&lt;codec&gt;</code> to attach various audio
>        codecs to the audio device. If not specified, a default codec
>        will be attached to allow playback and recording. Valid values
> -      are 'duplex' (advertise a line-in and a line-out) and 'micro'
> -      (advertise a speaker and a microphone).
> +      are 'duplex' (advertise a line-in and a line-out), 'micro'
> +       (advertise a speaker and a microphone) and 'output'
> +       (advertise a speaker).

QEMU reports the description as line-out, so we should keep in sync with that,
also, we should document since what libvirt release we support the new value,
which in this case will be 4.4.0 once it's out.

Other than that, I don't see any issues with the patch and the audio device
features reported within guest correspond too.

I'll fix the little nit above and push the patch tomorrow.

Reviewed-by: Erik Skultety <eskultet@redhat.com>

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: Add support for -device hda-output (disable line-in)
Posted by John Ferlan, 5 days ago

On 05/16/2018 06:11 PM, Filip Alac wrote:
> Add support for hda 'output' codec for ich6 and ich9 sound devices,
> which allow us to disable line-in for guest.
> 
> Fixes:
> https://bugzilla.redhat.com/show_bug.cgi?id=1126641
> 
> Signed-off-by: Filip Alac <filipalac@gmail.com>
> ---
>  docs/formatdomain.html.in                               | 5 +++--
>  docs/schemas/domaincommon.rng                           | 1 +
>  src/conf/domain_conf.c                                  | 3 ++-
>  src/conf/domain_conf.h                                  | 1 +
>  src/qemu/qemu_capabilities.c                            | 2 ++
>  src/qemu/qemu_capabilities.h                            | 1 +
>  src/qemu/qemu_command.c                                 | 5 ++++-
>  tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml        | 1 +
>  tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml        | 1 +
>  tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml        | 1 +
>  tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml        | 1 +
>  tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml      | 1 +
>  tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml        | 1 +
>  tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml       | 1 +
>  tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml      | 1 +
>  tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml        | 1 +
>  tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml       | 1 +
>  tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml        | 1 +
>  tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml        | 1 +
>  tests/qemucapabilitiesdata/caps_2.6.0.aarch64.xml       | 1 +
>  tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml         | 1 +
>  tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml        | 1 +
>  tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml        | 1 +
>  tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml        | 1 +
>  tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml         | 1 +
>  tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml        | 1 +
>  tests/qemustatusxml2xmldata/migration-in-params-in.xml  | 1 +
>  tests/qemustatusxml2xmldata/migration-out-nbd-in.xml    | 1 +
>  tests/qemustatusxml2xmldata/migration-out-nbd-out.xml   | 1 +
>  tests/qemustatusxml2xmldata/migration-out-params-in.xml | 1 +
>  tests/qemustatusxml2xmldata/modern-in.xml               | 1 +
>  tests/qemuxml2argvdata/sound-device.args                | 2 ++
>  tests/qemuxml2argvdata/sound-device.xml                 | 2 ++
>  tests/qemuxml2argvtest.c                                | 1 +
>  tests/qemuxml2xmloutdata/sound-device.xml               | 2 ++
>  35 files changed, 45 insertions(+), 4 deletions(-)
> 

A slightly different take than Erik - I had started this earlier, got
distracted, and didn't come back to it until I saw Erik's reply.

Way too much in one patch - please split this up into multiple patches:

1. docs, conf, xml2xmltest
2. qemu_capabilities
3. qemu, xml2argvtest

and then add a 4th patch:

4. docs/news.xml  to describe the feature/addition

However, I see that "output" is in the qemu 1.5.3 caps, so since 1.5 is
our lowest supported qemu emulator, do we even need a capability? IOW:
When was "output" added as an option?  I see that hda-duplex and
hda-micro seem to fall into the same category - in the 1.5.3 output, but
we cannot just remove those - they have to be specially handled.

> diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
> index 0d0fd3b9..8ab45e1c 100644
> --- a/docs/formatdomain.html.in
> +++ b/docs/formatdomain.html.in
> @@ -7388,8 +7388,9 @@ qemu-kvm -net nic,model=? /dev/null
>        sub-elements <code>&lt;codec&gt;</code> to attach various audio
>        codecs to the audio device. If not specified, a default codec
>        will be attached to allow playback and recording. Valid values
> -      are 'duplex' (advertise a line-in and a line-out) and 'micro'
> -      (advertise a speaker and a microphone).
> +      are 'duplex' (advertise a line-in and a line-out), 'micro'
> +       (advertise a speaker and a microphone) and 'output'
> +       (advertise a speaker).

The new option will need some sort of since libvirt 4.4.0 tag... It may
even look better to have use a list where the 3rd one using output gets
that since tag.  Lots of examples for using since.

>      </p>
>  
>  <pre>
> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
> index 71ac3d07..f16e1573 100644
> --- a/docs/schemas/domaincommon.rng
> +++ b/docs/schemas/domaincommon.rng
> @@ -3824,6 +3824,7 @@
>          <choice>
>            <value>duplex</value>
>            <value>micro</value>
> +          <value>output</value>
>          </choice>
>        </attribute>
>      </element>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 3689ac0a..f12c87d2 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -529,7 +529,8 @@ VIR_ENUM_IMPL(virDomainSmartcard, VIR_DOMAIN_SMARTCARD_TYPE_LAST,
>  
>  VIR_ENUM_IMPL(virDomainSoundCodec, VIR_DOMAIN_SOUND_CODEC_TYPE_LAST,
>                "duplex",
> -              "micro")
> +              "micro",
> +              "output")
>  
>  VIR_ENUM_IMPL(virDomainSoundModel, VIR_DOMAIN_SOUND_MODEL_LAST,
>                "sb16",
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index a78fdee4..ee3285a9 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -1335,6 +1335,7 @@ struct _virDomainInputDef {
>  typedef enum {
>      VIR_DOMAIN_SOUND_CODEC_TYPE_DUPLEX,
>      VIR_DOMAIN_SOUND_CODEC_TYPE_MICRO,
> +    VIR_DOMAIN_SOUND_CODEC_TYPE_OUTPUT,
>  
>      VIR_DOMAIN_SOUND_CODEC_TYPE_LAST
>  } virDomainSoundCodecType;
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index a5cb24fe..ba085a9e 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -486,6 +486,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
>  
>                /* 300 */
>                "sdl-gl",
> +              "hda-output",
>      );
>  
>  
> @@ -1015,6 +1016,7 @@ struct virQEMUCapsStringFlags virQEMUCapsEvents[] = {
>  struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
>      { "hda-duplex", QEMU_CAPS_HDA_DUPLEX },
>      { "hda-micro", QEMU_CAPS_HDA_MICRO },
> +    { "hda-output", QEMU_CAPS_HDA_OUTPUT},
                                         ^^^^
Generally we add to the end of the array not in the middle... Also
follow the existing syntax with space between OUTPUT and }

>      { "ccid-card-emulated", QEMU_CAPS_CCID_EMULATED },
>      { "ccid-card-passthru", QEMU_CAPS_CCID_PASSTHRU },
>      { "piix3-usb-uhci", QEMU_CAPS_PIIX3_USB_UHCI },
> diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
> index d23c34c2..3e9a8b30 100644
> --- a/src/qemu/qemu_capabilities.h
> +++ b/src/qemu/qemu_capabilities.h
> @@ -470,6 +470,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
>  
>      /* 300 */
>      QEMU_CAPS_SDL_GL, /* -sdl gl */
> +    QEMU_CAPS_HDA_OUTPUT, /* -device hda-output*/
                                                 ^^
Add a space between output and */


John


>  
>      QEMU_CAPS_LAST /* this must always be the last item */
>  } virQEMUCapsFlags;
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index c4237339..aee5bde5 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -139,7 +139,8 @@ VIR_ENUM_DECL(qemuSoundCodec)
>  
>  VIR_ENUM_IMPL(qemuSoundCodec, VIR_DOMAIN_SOUND_CODEC_TYPE_LAST,
>                "hda-duplex",
> -              "hda-micro");
> +              "hda-micro",
> +              "hda-output");
>  
>  VIR_ENUM_DECL(qemuControllerModelUSB)
>  
> @@ -4172,6 +4173,8 @@ qemuSoundCodecTypeToCaps(int type)
>          return QEMU_CAPS_HDA_DUPLEX;
>      case VIR_DOMAIN_SOUND_CODEC_TYPE_MICRO:
>          return QEMU_CAPS_HDA_MICRO;
> +    case VIR_DOMAIN_SOUND_CODEC_TYPE_OUTPUT:
> +        return QEMU_CAPS_HDA_OUTPUT;
>      default:
>          return -1;
>      }
> diff --git a/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml b/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml
> index e7c2e9a1..2b13ebc1 100644
> --- a/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml
> +++ b/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml
> @@ -105,6 +105,7 @@
>    <flag name='query-cpu-definitions'/>
>    <flag name='kernel-irqchip'/>
>    <flag name='isa-serial'/>
> +  <flag name='hda-output'/>
>    <version>1005003</version>
>    <kvmVersion>0</kvmVersion>
>    <microcodeVersion>46523</microcodeVersion>
> diff --git a/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml
> index e57dec32..ecd31293 100644
> --- a/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml
> +++ b/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml
> @@ -110,6 +110,7 @@
>    <flag name='query-cpu-definitions'/>
>    <flag name='kernel-irqchip'/>
>    <flag name='isa-serial'/>
> +  <flag name='hda-output'/>
>    <version>1006000</version>
>    <kvmVersion>0</kvmVersion>
>    <microcodeVersion>44752</microcodeVersion>
> diff --git a/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml
> index 39ec8f9b..c31a9721 100644
> --- a/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml
> +++ b/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml
> @@ -112,6 +112,7 @@
>    <flag name='query-cpu-definitions'/>
>    <flag name='kernel-irqchip'/>
>    <flag name='isa-serial'/>
> +  <flag name='hda-output'/>
>    <version>1007000</version>
>    <kvmVersion>0</kvmVersion>
>    <microcodeVersion>50196</microcodeVersion>
> diff --git a/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml
> index afe0882d..07cb2a37 100644
> --- a/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml
> +++ b/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml
> @@ -128,6 +128,7 @@
>    <flag name='query-named-block-nodes'/>
>    <flag name='kernel-irqchip'/>
>    <flag name='isa-serial'/>
> +  <flag name='hda-output'/>
>    <version>2001001</version>
>    <kvmVersion>0</kvmVersion>
>    <microcodeVersion>58992</microcodeVersion>
> diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml
> index 59043068..e11c1122 100644
> --- a/tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml
> +++ b/tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml
> @@ -155,6 +155,7 @@
>    <flag name='disk-write-cache'/>
>    <flag name='nbd-tls'/>
>    <flag name='sdl-gl'/>
> +  <flag name='hda-output'/>
>    <version>2010000</version>
>    <kvmVersion>0</kvmVersion>
>    <microcodeVersion>303541</microcodeVersion>
> diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml
> index 2912c8d6..21d91c8d 100644
> --- a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml
> +++ b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml
> @@ -154,6 +154,7 @@
>    <flag name='disk-write-cache'/>
>    <flag name='nbd-tls'/>
>    <flag name='sdl-gl'/>
> +  <flag name='hda-output'/>
>    <version>2010000</version>
>    <kvmVersion>0</kvmVersion>
>    <microcodeVersion>382824</microcodeVersion>
> diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml
> index 77ca3013..7821144e 100644
> --- a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml
> +++ b/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml
> @@ -197,6 +197,7 @@
>    <flag name='disk-write-cache'/>
>    <flag name='nbd-tls'/>
>    <flag name='sdl-gl'/>
> +  <flag name='hda-output'/>
>    <version>2010000</version>
>    <kvmVersion>0</kvmVersion>
>    <microcodeVersion>344938</microcodeVersion>
> diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml
> index cabe4f2f..e4f22684 100644
> --- a/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml
> +++ b/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml
> @@ -162,6 +162,7 @@
>    <flag name='qom-list-properties'/>
>    <flag name='memory-backend-file.discard-data'/>
>    <flag name='sdl-gl'/>
> +  <flag name='hda-output'/>
>    <version>2011090</version>
>    <kvmVersion>0</kvmVersion>
>    <microcodeVersion>343099</microcodeVersion>
> diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml
> index bffe3b3b..3e393633 100644
> --- a/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml
> +++ b/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml
> @@ -159,6 +159,7 @@
>    <flag name='qom-list-properties'/>
>    <flag name='memory-backend-file.discard-data'/>
>    <flag name='sdl-gl'/>
> +  <flag name='hda-output'/>
>    <version>2011090</version>
>    <kvmVersion>0</kvmVersion>
>    <microcodeVersion>419968</microcodeVersion>
> diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml
> index 4247afeb..35eadc18 100644
> --- a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml
> +++ b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml
> @@ -200,6 +200,7 @@
>    <flag name='qom-list-properties'/>
>    <flag name='memory-backend-file.discard-data'/>
>    <flag name='sdl-gl'/>
> +  <flag name='hda-output'/>
>    <version>2011090</version>
>    <kvmVersion>0</kvmVersion>
>    <microcodeVersion>390813</microcodeVersion>
> diff --git a/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml
> index 871eb5e4..56861723 100644
> --- a/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml
> +++ b/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml
> @@ -154,6 +154,7 @@
>    <flag name='virtio-gpu.max_outputs'/>
>    <flag name='isa-serial'/>
>    <flag name='sdl-gl'/>
> +  <flag name='hda-output'/>
>    <version>2004000</version>
>    <kvmVersion>0</kvmVersion>
>    <microcodeVersion>75406</microcodeVersion>
> diff --git a/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml
> index 90dce5a7..e86fce9f 100644
> --- a/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml
> +++ b/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml
> @@ -160,6 +160,7 @@
>    <flag name='virtio-gpu.max_outputs'/>
>    <flag name='isa-serial'/>
>    <flag name='sdl-gl'/>
> +  <flag name='hda-output'/>
>    <version>2005000</version>
>    <kvmVersion>0</kvmVersion>
>    <microcodeVersion>216528</microcodeVersion>
> diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.6.0.aarch64.xml
> index 42985489..e5268eda 100644
> --- a/tests/qemucapabilitiesdata/caps_2.6.0.aarch64.xml
> +++ b/tests/qemucapabilitiesdata/caps_2.6.0.aarch64.xml
> @@ -142,6 +142,7 @@
>    <flag name='dump-completed'/>
>    <flag name='nbd-tls'/>
>    <flag name='sdl-gl'/>
> +  <flag name='hda-output'/>
>    <version>2006000</version>
>    <kvmVersion>0</kvmVersion>
>    <microcodeVersion>228241</microcodeVersion>
> diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml
> index 07cdc49b..7e514be6 100644
> --- a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml
> +++ b/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml
> @@ -137,6 +137,7 @@
>    <flag name='dump-completed'/>
>    <flag name='nbd-tls'/>
>    <flag name='sdl-gl'/>
> +  <flag name='hda-output'/>
>    <version>2006000</version>
>    <kvmVersion>0</kvmVersion>
>    <microcodeVersion>263005</microcodeVersion>
> diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml
> index 4c6371a6..0d542b87 100644
> --- a/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml
> +++ b/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml
> @@ -172,6 +172,7 @@
>    <flag name='dump-completed'/>
>    <flag name='nbd-tls'/>
>    <flag name='sdl-gl'/>
> +  <flag name='hda-output'/>
>    <version>2006000</version>
>    <kvmVersion>0</kvmVersion>
>    <microcodeVersion>227332</microcodeVersion>
> diff --git a/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml
> index c322d18d..5795bc95 100644
> --- a/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml
> +++ b/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml
> @@ -177,6 +177,7 @@
>    <flag name='disk-write-cache'/>
>    <flag name='nbd-tls'/>
>    <flag name='sdl-gl'/>
> +  <flag name='hda-output'/>
>    <version>2007000</version>
>    <kvmVersion>0</kvmVersion>
>    <microcodeVersion>239029</microcodeVersion>
> diff --git a/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml
> index 7c329ad4..bd467d27 100644
> --- a/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml
> +++ b/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml
> @@ -179,6 +179,7 @@
>    <flag name='disk-write-cache'/>
>    <flag name='nbd-tls'/>
>    <flag name='sdl-gl'/>
> +  <flag name='hda-output'/>
>    <version>2008000</version>
>    <kvmVersion>0</kvmVersion>
>    <microcodeVersion>255684</microcodeVersion>
> diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml
> index cfc94050..1e6d0cc3 100644
> --- a/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml
> +++ b/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml
> @@ -146,6 +146,7 @@
>    <flag name='disk-write-cache'/>
>    <flag name='nbd-tls'/>
>    <flag name='sdl-gl'/>
> +  <flag name='hda-output'/>
>    <version>2009000</version>
>    <kvmVersion>0</kvmVersion>
>    <microcodeVersion>346538</microcodeVersion>
> diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
> index 0701c244..7e45b311 100644
> --- a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
> +++ b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
> @@ -192,6 +192,7 @@
>    <flag name='disk-write-cache'/>
>    <flag name='nbd-tls'/>
>    <flag name='sdl-gl'/>
> +  <flag name='hda-output'/>
>    <version>2009000</version>
>    <kvmVersion>0</kvmVersion>
>    <microcodeVersion>320947</microcodeVersion>
> diff --git a/tests/qemustatusxml2xmldata/migration-in-params-in.xml b/tests/qemustatusxml2xmldata/migration-in-params-in.xml
> index b0caa34e..03f18b4f 100644
> --- a/tests/qemustatusxml2xmldata/migration-in-params-in.xml
> +++ b/tests/qemustatusxml2xmldata/migration-in-params-in.xml
> @@ -236,6 +236,7 @@
>      <flag name='iscsi.password-secret'/>
>      <flag name='isa-serial'/>
>      <flag name='dump-completed'/>
> +    <flag name='hda-output'/>
>    </qemuCaps>
>    <job type='none' async='migration in' phase='prepare' flags='0x900'>
>      <migParams>
> diff --git a/tests/qemustatusxml2xmldata/migration-out-nbd-in.xml b/tests/qemustatusxml2xmldata/migration-out-nbd-in.xml
> index 6d87c1ec..636accf0 100644
> --- a/tests/qemustatusxml2xmldata/migration-out-nbd-in.xml
> +++ b/tests/qemustatusxml2xmldata/migration-out-nbd-in.xml
> @@ -229,6 +229,7 @@
>      <flag name='iscsi.password-secret'/>
>      <flag name='isa-serial'/>
>      <flag name='dump-completed'/>
> +    <flag name='hda-output'/>
>    </qemuCaps>
>    <job type='none' async='migration out' phase='perform3'>
>      <disk dev='vdb' migrating='yes'/>
> diff --git a/tests/qemustatusxml2xmldata/migration-out-nbd-out.xml b/tests/qemustatusxml2xmldata/migration-out-nbd-out.xml
> index 05da1f81..315d8e4c 100644
> --- a/tests/qemustatusxml2xmldata/migration-out-nbd-out.xml
> +++ b/tests/qemustatusxml2xmldata/migration-out-nbd-out.xml
> @@ -229,6 +229,7 @@
>      <flag name='iscsi.password-secret'/>
>      <flag name='isa-serial'/>
>      <flag name='dump-completed'/>
> +    <flag name='hda-output'/>
>    </qemuCaps>
>    <job type='none' async='migration out' phase='perform3' flags='0x0'>
>      <disk dev='vdb' migrating='yes'/>
> diff --git a/tests/qemustatusxml2xmldata/migration-out-params-in.xml b/tests/qemustatusxml2xmldata/migration-out-params-in.xml
> index 17649796..ae206483 100644
> --- a/tests/qemustatusxml2xmldata/migration-out-params-in.xml
> +++ b/tests/qemustatusxml2xmldata/migration-out-params-in.xml
> @@ -236,6 +236,7 @@
>      <flag name='iscsi.password-secret'/>
>      <flag name='isa-serial'/>
>      <flag name='dump-completed'/>
> +    <flag name='hda-output'/>
>    </qemuCaps>
>    <job type='none' async='migration out' phase='perform3' flags='0x802'>
>      <disk dev='vda' migrating='no'/>
> diff --git a/tests/qemustatusxml2xmldata/modern-in.xml b/tests/qemustatusxml2xmldata/modern-in.xml
> index d63fcf79..5b7e2a34 100644
> --- a/tests/qemustatusxml2xmldata/modern-in.xml
> +++ b/tests/qemustatusxml2xmldata/modern-in.xml
> @@ -232,6 +232,7 @@
>      <flag name='iscsi.password-secret'/>
>      <flag name='isa-serial'/>
>      <flag name='dump-completed'/>
> +    <flag name='hda-output'/>
>    </qemuCaps>
>    <devices>
>      <device alias='rng0'/>
> diff --git a/tests/qemuxml2argvdata/sound-device.args b/tests/qemuxml2argvdata/sound-device.args
> index ee8313bf..f97050a0 100644
> --- a/tests/qemuxml2argvdata/sound-device.args
> +++ b/tests/qemuxml2argvdata/sound-device.args
> @@ -33,10 +33,12 @@ server,nowait \
>  -device intel-hda,id=sound5,bus=pci.0,addr=0x6 \
>  -device hda-micro,id=sound5-codec0,bus=sound5.0,cad=0 \
>  -device hda-duplex,id=sound5-codec1,bus=sound5.0,cad=1 \
> +-device hda-output,id=sound5-codec2,bus=sound5.0,cad=2 \
>  -device ich9-intel-hda,id=sound6,bus=pci.0,addr=0x7 \
>  -device hda-duplex,id=sound6-codec0,bus=sound6.0,cad=0 \
>  -device ich9-intel-hda,id=sound7,bus=pci.0,addr=0x8 \
>  -device hda-micro,id=sound7-codec0,bus=sound7.0,cad=0 \
>  -device hda-duplex,id=sound7-codec1,bus=sound7.0,cad=1 \
> +-device hda-output,id=sound7-codec2,bus=sound7.0,cad=2 \
>  -device usb-audio,id=sound8,bus=usb.0,port=1 \
>  -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x9
> diff --git a/tests/qemuxml2argvdata/sound-device.xml b/tests/qemuxml2argvdata/sound-device.xml
> index bceb9d1f..c544e931 100644
> --- a/tests/qemuxml2argvdata/sound-device.xml
> +++ b/tests/qemuxml2argvdata/sound-device.xml
> @@ -32,11 +32,13 @@
>      <sound model='ich6'>
>        <codec type='micro'/>
>        <codec type='duplex'/>
> +      <codec type='output'/>
>      </sound>
>      <sound model='ich9'/>
>      <sound model='ich9'>
>        <codec type='micro'/>
>        <codec type='duplex'/>
> +      <codec type='output'/>
>      </sound>
>      <sound model='usb'/>
>      <memballoon model='virtio'/>
> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
> index 07e5ba1d..ff32347f 100644
> --- a/tests/qemuxml2argvtest.c
> +++ b/tests/qemuxml2argvtest.c
> @@ -1515,6 +1515,7 @@ mymain(void)
>      DO_TEST("sound", NONE);
>      DO_TEST("sound-device",
>              QEMU_CAPS_HDA_DUPLEX, QEMU_CAPS_HDA_MICRO,
> +            QEMU_CAPS_HDA_OUTPUT,
>              QEMU_CAPS_DEVICE_ICH9_INTEL_HDA,
>              QEMU_CAPS_OBJECT_USB_AUDIO);
>      DO_TEST("fs9p", NONE);
> diff --git a/tests/qemuxml2xmloutdata/sound-device.xml b/tests/qemuxml2xmloutdata/sound-device.xml
> index 62336a8c..cbf4d179 100644
> --- a/tests/qemuxml2xmloutdata/sound-device.xml
> +++ b/tests/qemuxml2xmloutdata/sound-device.xml
> @@ -43,6 +43,7 @@
>      <sound model='ich6'>
>        <codec type='micro'/>
>        <codec type='duplex'/>
> +      <codec type='output'/>
>        <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
>      </sound>
>      <sound model='ich9'>
> @@ -51,6 +52,7 @@
>      <sound model='ich9'>
>        <codec type='micro'/>
>        <codec type='duplex'/>
> +      <codec type='output'/>
>        <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
>      </sound>
>      <sound model='usb'/>
> 

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: Add support for -device hda-output (disable line-in)
Posted by Pavel Hrdina, 5 days ago
On Thu, May 17, 2018 at 12:15:08PM -0400, John Ferlan wrote:
> 
> 
> On 05/16/2018 06:11 PM, Filip Alac wrote:
> > Add support for hda 'output' codec for ich6 and ich9 sound devices,
> > which allow us to disable line-in for guest.
> > 
> > Fixes:
> > https://bugzilla.redhat.com/show_bug.cgi?id=1126641
> > 
> > Signed-off-by: Filip Alac <filipalac@gmail.com>
> > ---
> >  docs/formatdomain.html.in                               | 5 +++--
> >  docs/schemas/domaincommon.rng                           | 1 +
> >  src/conf/domain_conf.c                                  | 3 ++-
> >  src/conf/domain_conf.h                                  | 1 +
> >  src/qemu/qemu_capabilities.c                            | 2 ++
> >  src/qemu/qemu_capabilities.h                            | 1 +
> >  src/qemu/qemu_command.c                                 | 5 ++++-
> >  tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml        | 1 +
> >  tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml        | 1 +
> >  tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml        | 1 +
> >  tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml        | 1 +
> >  tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml      | 1 +
> >  tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml        | 1 +
> >  tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml       | 1 +
> >  tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml      | 1 +
> >  tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml        | 1 +
> >  tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml       | 1 +
> >  tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml        | 1 +
> >  tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml        | 1 +
> >  tests/qemucapabilitiesdata/caps_2.6.0.aarch64.xml       | 1 +
> >  tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml         | 1 +
> >  tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml        | 1 +
> >  tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml        | 1 +
> >  tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml        | 1 +
> >  tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml         | 1 +
> >  tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml        | 1 +
> >  tests/qemustatusxml2xmldata/migration-in-params-in.xml  | 1 +
> >  tests/qemustatusxml2xmldata/migration-out-nbd-in.xml    | 1 +
> >  tests/qemustatusxml2xmldata/migration-out-nbd-out.xml   | 1 +
> >  tests/qemustatusxml2xmldata/migration-out-params-in.xml | 1 +
> >  tests/qemustatusxml2xmldata/modern-in.xml               | 1 +
> >  tests/qemuxml2argvdata/sound-device.args                | 2 ++
> >  tests/qemuxml2argvdata/sound-device.xml                 | 2 ++
> >  tests/qemuxml2argvtest.c                                | 1 +
> >  tests/qemuxml2xmloutdata/sound-device.xml               | 2 ++
> >  35 files changed, 45 insertions(+), 4 deletions(-)
> > 
> 
> A slightly different take than Erik - I had started this earlier, got
> distracted, and didn't come back to it until I saw Erik's reply.
> 
> Way too much in one patch - please split this up into multiple patches:
> 
> 1. docs, conf, xml2xmltest
> 2. qemu_capabilities
> 3. qemu, xml2argvtest
> 
> and then add a 4th patch:
> 
> 4. docs/news.xml  to describe the feature/addition
> 
> However, I see that "output" is in the qemu 1.5.3 caps, so since 1.5 is
> our lowest supported qemu emulator, do we even need a capability? IOW:
> When was "output" added as an option?  I see that hda-duplex and
> hda-micro seem to fall into the same category - in the 1.5.3 output, but
> we cannot just remove those - they have to be specially handled.

'duplex' and 'output' were introduced in 0.14.0 but 'micro' was
introduced in 1.1.0.  Since the HDA codec doesn't have to be compiled
in we should have at least one capability to make sure that it's
available.  I guess that it will not hurt to have separate capability
for each codec.

Pavel
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list