From patchwork Tue Apr 10 13:42:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 133085 Delivered-To: patches@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1315331ljb; Tue, 10 Apr 2018 06:42:06 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/1usRGkrUSka4HcapbqDYWN6ZWkvIlEpfONwirgNORzSZxS4+yD7Z/OWZtc1XhYEDUK72F X-Received: by 10.28.48.70 with SMTP id w67mr1727829wmw.47.1523367726252; Tue, 10 Apr 2018 06:42:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523367726; cv=none; d=google.com; s=arc-20160816; b=bKQ1jsHrhAfwXa1IB9Ahd5p2LfWO45jNZ3Eo2kcLCg5Av03nKvV6HjcGtf9Z2/ebsi TF4smV4F95NiRk4z+pg+EAf0FdsX9wAm1I574H6urGNd45H5hS2wnp2nQVu7jpCXt3rq KKaieIUHz/bQhgRU/mKAJNR5Xv69gWdyBsVyt4+VWJwShrpTpTz3QIkuEE1NdSHKtEuP bBDTEfFZuzuCMdntvyi2YrwmKDF2AMlAA8lfcYKkujwc0t5XgF8BEI+Yo3vwh2eZrW8U 1fayO4D7F3x0CzuL0MWCVXqVj/Lp4djqEkV/Re/ArN75BX/vMFZ7X3Zsz9GV65623GHH 3P1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:arc-authentication-results; bh=AzmQhTlrVyFyR6dp6J43afLMOXMX7x7hURGBlD6tEcI=; b=sLvr9YiEKKWSx+5pJsfH+D/wIYfz8/oWJT+PpcQYk2g+83SV9Vm32YhSdYGBhzs5a5 fZ110NXDwr/NsodVL9MUdhtOYm47Zx0NMEY+BBnyAJ8DjW7Roun0q8l3TaFTRH9If8dw VQxvaTT5h2BBp1xWVrgjYKjPbYh/Cr5ExYdgfM2IGbZqov9m9iFNzyUXgoZJNVLqB8ej HxHc6sPsRA+jk9QJ5WqiGXueDlrFUSiMHjkWdaJs2AqITv5NKE2RP9uBkZd+XDosQV/+ VFCH5NO3QYZCzX+HTX+DLbSh11s4dmWEa3+YE0BEJbUkyDToLEZjT4ixocOjQXJ4K/WZ jqfQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) smtp.mailfrom=pm215@archaic.org.uk; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by mx.google.com with ESMTPS id k7si1192686wma.138.2018.04.10.06.42.06 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Apr 2018 06:42:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) client-ip=2001:8b0:1d0::2; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) smtp.mailfrom=pm215@archaic.org.uk; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1f5tXB-00005I-1D; Tue, 10 Apr 2018 14:42:05 +0100 From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: patches@linaro.org, qemu-stable@nongnu.org Subject: [PATCH for-2.12] hw/char/cmsdk-apb-uart.c: Correctly clear INTSTATUS bits on writes Date: Tue, 10 Apr 2018 14:42:03 +0100 Message-Id: <20180410134203.17552-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.16.2 The CMSDK APB UART INTSTATUS register bits are all write-one-to-clear. We were getting this correct for the TXO and RXO bits (which need special casing because their state lives in the STATE register), but had forgotten to handle the normal bits for RX and TX which we do store in our s->intstatus field. Perform the W1C operation on the bits in s->intstatus too. Fixes: https://bugs.launchpad.net/qemu/+bug/1760262 Cc: qemu-stable@nongnu.org Signed-off-by: Peter Maydell --- Not a disaster if this doesn't get into 2.12, I guess. I think it's missed the rc3 boat, so if we need an rc4 for some other reason we can put it in. hw/char/cmsdk-apb-uart.c | 1 + 1 file changed, 1 insertion(+) -- 2.16.2 Reviewed-by: Philippe Mathieu-Daudé diff --git a/hw/char/cmsdk-apb-uart.c b/hw/char/cmsdk-apb-uart.c index 1ad1e14295..9c0929d8a2 100644 --- a/hw/char/cmsdk-apb-uart.c +++ b/hw/char/cmsdk-apb-uart.c @@ -274,6 +274,7 @@ static void uart_write(void *opaque, hwaddr offset, uint64_t value, * is then reflected into the intstatus value by the update function). */ s->state &= ~(value & (R_INTSTATUS_TXO_MASK | R_INTSTATUS_RXO_MASK)); + s->intstatus &= ~value; cmsdk_apb_uart_update(s); break; case A_BAUDDIV: