intel-hda: fixes
PATCH 1/4 intel-hda: exit cleanup
In reply to Gerd HoffmannAdd pci exit callback for the intel-hda device and cleanup properly. Also add an exit callback to the HDA bus implementation and make sure it is called on qdev_free().
--- hw/intel-hda.c | 20 ++++++++++++++++++++ hw/intel-hda.h | 1 + 2 files changed, 21 insertions(+), 0 deletions(-)
hw/intel-hda.c +20 -0
@@ -61,9 +61,20 @@ static int hda_codec_dev_init(DeviceState *qdev, DeviceInfo *base)return info->init (dev); } +static int hda_codec_dev_exit (DeviceState *qdev) +{ +HDACodecDevice *dev =DO_UPCAST (HDACodecDevice, qdev, qdev); + +if (dev->info->exit) { + dev->info->exit (dev); + } +return 0 ; +} +void hda_codec_register (HDACodecDeviceInfo *info) { info->qdev.init = hda_codec_dev_init; + info->qdev.exit = hda_codec_dev_exit; info->qdev.bus_info = &hda_codec_bus_info;qdev_register (&info->qdev); }
@@ -1137,6 +1148,14 @@ static int intel_hda_init(PCIDevice *pci)return 0 ; } +static int intel_hda_exit (PCIDevice *pci) +{ +IntelHDAState *d =DO_UPCAST (IntelHDAState, pci, pci); + +cpu_unregister_io_memory (d->mmio_addr); +return 0 ; +} +static int intel_hda_post_load (void *opaque,int version) {IntelHDAState * d = opaque;
@@ -1219,6 +1238,7 @@ static PCIDeviceInfo intel_hda_info = { .qdev.vmsd = &vmstate_intel_hda, .qdev.reset = intel_hda_reset, .init = intel_hda_init, + .exit = intel_hda_exit, .qdev.props = (Property []) {DEFINE_PROP_UINT32 ("debug" , IntelHDAState, debug,0 ),DEFINE_PROP_END_OF_LIST (),
hw/intel-hda.h +1 -0
@@ -32,6 +32,7 @@ struct HDACodecDevice {struct HDACodecDeviceInfo {DeviceInfo qdev;int (*init)(HDACodecDevice *dev); +int (*exit)(HDACodecDevice *dev);void (*command)(HDACodecDevice *dev,uint32_t nid,uint32_t data);void (*stream)(HDACodecDevice *dev,uint32_t stnr,bool running); };
Signature · 1 line
1.7.1
PATCH 2/4 hda-audio: exit cleanup
In reply to Gerd HoffmannAdd exit callback to the driver. Unregister the sound card properly on exit.
--- hw/hda-audio.c | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-)
hw/hda-audio.c +23 -0
@@ -808,6 +808,27 @@ static int hda_audio_init(HDACodecDevice *hda, const struct desc_codec *desc)return 0 ; } +static int hda_audio_exit (HDACodecDevice *hda) +{ +HDAAudioState *a =DO_UPCAST (HDAAudioState, hda, hda); +HDAAudioStream *st; +int i; + +dprint (a,1 ,"%s\n" , __FUNCTION__); +for (i =0 ; i <ARRAY_SIZE (a->st); i++) { + st = a->st + i; +if (st->node ==NULL ) +continue ; +if (st->output) { +AUD_close_out (&a->card, st->voice.out); + }else { +AUD_close_in (&a->card, st->voice.in); + } + } +AUD_remove_card (&a->card); +return 0 ; +} +static int hda_audio_post_load (void *opaque,int version) {HDAAudioState *a = opaque;
@@ -879,6 +900,7 @@ static HDACodecDeviceInfo hda_audio_info_output = { .qdev.vmsd = &vmstate_hda_audio, .qdev.props = hda_audio_properties, .init = hda_audio_init_output, + .exit = hda_audio_exit, .command = hda_audio_command, .stream = hda_audio_stream, };
@@ -890,6 +912,7 @@ static HDACodecDeviceInfo hda_audio_info_duplex = { .qdev.vmsd = &vmstate_hda_audio, .qdev.props = hda_audio_properties, .init = hda_audio_init_duplex, + .exit = hda_audio_exit, .command = hda_audio_command, .stream = hda_audio_stream, };
Signature · 1 line
1.7.1
PATCH 3/4 intel-hda: Honor WAKEEN bits.
In reply to Gerd HoffmannFrom: François Revol <[email protected]>
HDA: Honor WAKEEN bits when deciding to raise an interrupt on codec status change. This prevents an interrupt storm with the Haiku HDA driver which does not handle codec status changes in the irq handler.
--- hw/intel-hda.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
hw/intel-hda.c +2 -1
@@ -246,7 +246,7 @@ static void intel_hda_update_int_sts(IntelHDAState *d)if (d->rirb_sts &ICH6_RBSTS_OVERRUN ) { sts |= (1 <<30 ); } -if (d->state_sts) { +if (d->state_sts & d->wake_en) { sts |= (1 <<30 ); }
@@ -628,6 +628,7 @@ static const struct IntelHDAReg regtab[] = { [ ICH6_REG_WAKEEN ] = { .name = "WAKEEN", .size = 2, + .wmask = 0x3fff, .offset = offsetof(IntelHDAState, wake_en), }, [ ICH6_REG_STATESTS ] = {
Signature · 1 line
1.7.1
PATCH 4/4 intel-hda: update irq status on WAKEEN changes.
In reply to Gerd HoffmannWhen the guest updates the WAKEEN register we
must re-calculate the IRQ status.
--- hw/intel-hda.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
hw/intel-hda.c +6 -0
@@ -508,6 +508,11 @@ static void intel_hda_set_g_ctl(IntelHDAState *d, const IntelHDAReg *reg, uint32 } } +static void intel_hda_set_wake_en (IntelHDAState *d,const IntelHDAReg *reg,uint32_t old) +{ +intel_hda_update_irq (d); +} +static void intel_hda_set_state_sts (IntelHDAState *d,const IntelHDAReg *reg,uint32_t old) {intel_hda_update_irq (d);
@@ -630,6 +635,7 @@ static const struct IntelHDAReg regtab[] = { .size = 2, .wmask = 0x3fff, .offset = offsetof(IntelHDAState, wake_en), + .whandler = intel_hda_set_wake_en, }, [ ICH6_REG_STATESTS ] = { .name = "STATESTS",
Signature · 1 line
1.7.1
cover intel-hda: fixes
Hi,
This patch series brings a few fixes for the intel-hda driver.
please apply,
Gerd
François Revol (1):
intel-hda: Honor WAKEEN bits.
Gerd Hoffmann (3):
intel-hda: exit cleanup
hda-audio: exit cleanup
intel-hda: update irq status on WAKEEN changes.
hw/hda-audio.c | 23 +++++++++++++++++++++++ hw/intel-hda.c | 29 ++++++++++++++++++++++++++++- hw/intel-hda.h | 1 + 3 files changed, 52 insertions(+), 1 deletions(-)
[Qemu-devel] Re: [PATCH 2/4] hda-audio: exit cleanup
In reply to Gerd HoffmannQuoted 17 lines · Gerd Hoffmann
Add exit callback to the driver. Unregister the sound card properly on exit.
Signed-off-by Gerd Hoffmann <[email protected]>--- hw/hda-audio.c | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-)hw/hda-audio.c +1
-0@@ -808,6 +808,27 @@ static int hda_audio_init(HDACodecDevice *hda, const struct desc_codec *desc)return 0 ; } +static int hda_audio_exit (HDACodecDevice *hda)
hw/hda-audio.c static int hda_audio_init(HDACodecDevice *hda, const struct desc_codec *desc) · line 821
Quoted 10 lines
hw/hda-audio.c +10
-0+{ +HDAAudioState *a =DO_UPCAST (HDAAudioState, hda, hda); +HDAAudioStream *st; +int i; + +dprint (a,1 ,"%s\n" , __FUNCTION__); +for (i =0 ; i <ARRAY_SIZE (a->st); i++) { + st = a->st + i; +if (st->node ==NULL ) +continue ;
Braces
Quoted 30 lines
hw/hda-audio.c +12
-0+if (st->output) { +AUD_close_out (&a->card, st->voice.out); + }else { +AUD_close_in (&a->card, st->voice.in); + } + } +AUD_remove_card (&a->card); +return 0 ; +} +static int hda_audio_post_load (void *opaque,int version) {HDAAudioState *a = opaque;@@ -879,6 +900,7 @@ static HDACodecDeviceInfo hda_audio_info_output = { .qdev.vmsd = &vmstate_hda_audio, .qdev.props = hda_audio_properties, .init = hda_audio_init_output, + .exit = hda_audio_exit, .command = hda_audio_command, .stream = hda_audio_stream, };@@ -890,6 +912,7 @@ static HDACodecDeviceInfo hda_audio_info_duplex = { .qdev.vmsd = &vmstate_hda_audio, .qdev.props = hda_audio_properties, .init = hda_audio_init_duplex, + .exit = hda_audio_exit, .command = hda_audio_command, .stream = hda_audio_stream, };
Signature · 1 line
mailto:[email protected]