* [Qemu-devel] [PATCH 0/4] intel-hda: fixes
@ 2010-11-08 13:46 Gerd Hoffmann
2010-11-08 13:46 ` [Qemu-devel] [PATCH 1/4] intel-hda: exit cleanup Gerd Hoffmann
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2010-11-08 13:46 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
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(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 1/4] intel-hda: exit cleanup
2010-11-08 13:46 [Qemu-devel] [PATCH 0/4] intel-hda: fixes Gerd Hoffmann
@ 2010-11-08 13:46 ` Gerd Hoffmann
2010-11-08 13:46 ` [Qemu-devel] [PATCH 2/4] hda-audio: " Gerd Hoffmann
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2010-11-08 13:46 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Add 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().
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/intel-hda.c | 20 ++++++++++++++++++++
hw/intel-hda.h | 1 +
2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/hw/intel-hda.c b/hw/intel-hda.c
index ccb059d..78c32da 100644
--- a/hw/intel-hda.c
+++ b/hw/intel-hda.c
@@ -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(),
diff --git a/hw/intel-hda.h b/hw/intel-hda.h
index ba290ec..4e44e38 100644
--- a/hw/intel-hda.h
+++ b/hw/intel-hda.h
@@ -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);
};
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 2/4] hda-audio: exit cleanup
2010-11-08 13:46 [Qemu-devel] [PATCH 0/4] intel-hda: fixes Gerd Hoffmann
2010-11-08 13:46 ` [Qemu-devel] [PATCH 1/4] intel-hda: exit cleanup Gerd Hoffmann
@ 2010-11-08 13:46 ` Gerd Hoffmann
2010-11-08 17:50 ` [Qemu-devel] " malc
2010-11-08 13:46 ` [Qemu-devel] [PATCH 3/4] intel-hda: Honor WAKEEN bits Gerd Hoffmann
2010-11-08 13:46 ` [Qemu-devel] [PATCH 4/4] intel-hda: update irq status on WAKEEN changes Gerd Hoffmann
3 siblings, 1 reply; 6+ messages in thread
From: Gerd Hoffmann @ 2010-11-08 13:46 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Add exit callback to the driver. Unregister the sound card properly
on exit.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/hda-audio.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/hw/hda-audio.c b/hw/hda-audio.c
index 1035774..5593c84 100644
--- a/hw/hda-audio.c
+++ b/hw/hda-audio.c
@@ -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,
};
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 3/4] intel-hda: Honor WAKEEN bits.
2010-11-08 13:46 [Qemu-devel] [PATCH 0/4] intel-hda: fixes Gerd Hoffmann
2010-11-08 13:46 ` [Qemu-devel] [PATCH 1/4] intel-hda: exit cleanup Gerd Hoffmann
2010-11-08 13:46 ` [Qemu-devel] [PATCH 2/4] hda-audio: " Gerd Hoffmann
@ 2010-11-08 13:46 ` Gerd Hoffmann
2010-11-08 13:46 ` [Qemu-devel] [PATCH 4/4] intel-hda: update irq status on WAKEEN changes Gerd Hoffmann
3 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2010-11-08 13:46 UTC (permalink / raw)
To: qemu-devel; +Cc: François Revol, Gerd Hoffmann
From: François Revol <revol@free.fr>
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.
Signed-off-by: François Revol <revol@free.fr>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/intel-hda.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/hw/intel-hda.c b/hw/intel-hda.c
index 78c32da..2c1ef12 100644
--- a/hw/intel-hda.c
+++ b/hw/intel-hda.c
@@ -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 ] = {
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 4/4] intel-hda: update irq status on WAKEEN changes.
2010-11-08 13:46 [Qemu-devel] [PATCH 0/4] intel-hda: fixes Gerd Hoffmann
` (2 preceding siblings ...)
2010-11-08 13:46 ` [Qemu-devel] [PATCH 3/4] intel-hda: Honor WAKEEN bits Gerd Hoffmann
@ 2010-11-08 13:46 ` Gerd Hoffmann
3 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2010-11-08 13:46 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
When the guest updates the WAKEEN register we
must re-calculate the IRQ status.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/intel-hda.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/hw/intel-hda.c b/hw/intel-hda.c
index 2c1ef12..e478e67 100644
--- a/hw/intel-hda.c
+++ b/hw/intel-hda.c
@@ -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",
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] Re: [PATCH 2/4] hda-audio: exit cleanup
2010-11-08 13:46 ` [Qemu-devel] [PATCH 2/4] hda-audio: " Gerd Hoffmann
@ 2010-11-08 17:50 ` malc
0 siblings, 0 replies; 6+ messages in thread
From: malc @ 2010-11-08 17:50 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel
On Mon, 8 Nov 2010, Gerd Hoffmann wrote:
> Add exit callback to the driver. Unregister the sound card properly
> on exit.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> hw/hda-audio.c | 23 +++++++++++++++++++++++
> 1 files changed, 23 insertions(+), 0 deletions(-)
>
> diff --git a/hw/hda-audio.c b/hw/hda-audio.c
> index 1035774..5593c84 100644
> --- a/hw/hda-audio.c
> +++ b/hw/hda-audio.c
> @@ -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;
Braces
> + 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,
> };
>
--
mailto:av1474@comtv.ru
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-11-08 17:50 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-08 13:46 [Qemu-devel] [PATCH 0/4] intel-hda: fixes Gerd Hoffmann
2010-11-08 13:46 ` [Qemu-devel] [PATCH 1/4] intel-hda: exit cleanup Gerd Hoffmann
2010-11-08 13:46 ` [Qemu-devel] [PATCH 2/4] hda-audio: " Gerd Hoffmann
2010-11-08 17:50 ` [Qemu-devel] " malc
2010-11-08 13:46 ` [Qemu-devel] [PATCH 3/4] intel-hda: Honor WAKEEN bits Gerd Hoffmann
2010-11-08 13:46 ` [Qemu-devel] [PATCH 4/4] intel-hda: update irq status on WAKEEN changes Gerd Hoffmann
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).