[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 67/74] i2c: pm_smbus: Don't delay host status registe
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 67/74] i2c: pm_smbus: Don't delay host status register busy bit when interrupts are enabled |
Date: |
Tue, 21 Aug 2018 19:02:39 +0200 |
From: Corey Minyard <address@hidden>
Change 880b1ffe6ec2f0ae "smbus: do not immediately complete commands"
changed pm_smbus to delay setting the host busy bit until the status
register was read, to work around a bug in AMIBIOS. Unfortunately,
when interrupts are enabled, the status register will never get read
and the processing will never happen.
Modify the code to only delay setting the host busy bit if interrupts
are not enabled.
Signed-off-by: Corey Minyard <address@hidden>
Cc: Hervé Poussineau <address@hidden>
Cc: Philippe Mathieu-Daudé <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/i2c/pm_smbus.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/hw/i2c/pm_smbus.c b/hw/i2c/pm_smbus.c
index 6322f07..91ee444 100644
--- a/hw/i2c/pm_smbus.c
+++ b/hw/i2c/pm_smbus.c
@@ -80,9 +80,6 @@ static void smb_transaction(PMSMBus *s)
I2CBus *bus = s->smbus;
int ret;
- assert(s->smb_stat & STS_HOST_BUSY);
- s->smb_stat &= ~STS_HOST_BUSY;
-
SMBUS_DPRINTF("SMBus trans addr=0x%02x prot=0x%02x\n", addr, prot);
/* Transaction isn't exec if STS_DEV_ERR bit set */
if ((s->smb_stat & STS_DEV_ERR) != 0) {
@@ -209,9 +206,18 @@ error:
static void smb_transaction_start(PMSMBus *s)
{
- /* Do not execute immediately the command ; it will be
- * executed when guest will read SMB_STAT register */
- s->smb_stat |= STS_HOST_BUSY;
+ if (s->smb_ctl & CTL_INTREN) {
+ smb_transaction(s);
+ } else {
+ /* Do not execute immediately the command; it will be
+ * executed when guest will read SMB_STAT register. This
+ * is to work around a bug in AMIBIOS (that is working
+ * around another bug in some specific hardware) where
+ * it waits for STS_HOST_BUSY to be set before waiting
+ * checking for status. If STS_HOST_BUSY doesn't get
+ * set, it gets stuck. */
+ s->smb_stat |= STS_HOST_BUSY;
+ }
}
static bool
@@ -330,6 +336,7 @@ static uint64_t smb_ioport_readb(void *opaque, hwaddr addr,
unsigned width)
val = s->smb_stat;
if (s->smb_stat & STS_HOST_BUSY) {
/* execute command now */
+ s->smb_stat &= ~STS_HOST_BUSY;
smb_transaction(s);
}
break;
--
1.8.3.1
- [Qemu-devel] [PULL 61/74] pc-dimm: assign and verify the "addr" property during pre_plug, (continued)
- [Qemu-devel] [PULL 61/74] pc-dimm: assign and verify the "addr" property during pre_plug, Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 70/74] KVM: cleanup unnecessary #ifdef KVM_CAP_..., Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 73/74] char-socket: update all ioc handlers when changing context, Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 60/74] pc: drop memory region alignment check for 0, Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 71/74] Revert "chardev: tcp: postpone TLS work until machine done", Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 59/74] util/oslib-win32: indicate alignment for qemu_anon_ram_alloc(), Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 58/74] pc-dimm: assign and verify the "slot" property during pre_plug, Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 72/74] Revert "chardev: tcp: postpone async connection setup", Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 74/74] test-char: add socket reconnect test, Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 57/74] ipmi: Use proper struct reference for BT vmstate, Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 67/74] i2c: pm_smbus: Don't delay host status register busy bit when interrupts are enabled,
Paolo Bonzini <=
- [Qemu-devel] [PULL 68/74] i2c: pm_smbus: Add the ability to force block transfer enable, Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 64/74] i2c: pm_smbus: Make the I2C block read command read-only, Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 63/74] i2c: pm_smbus: Fix the semantics of block I2C transfers, Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 62/74] i2c: pm_smbus: Clean up some style issues, Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 66/74] i2c: pm_smbus: Add interrupt handling, Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 65/74] i2c: pm_smbus: Add block transfer capability, Paolo Bonzini, 2018/08/21
- Re: [Qemu-devel] [PULL 00/74] Misc patches for 2018-08-21, Peter Maydell, 2018/08/23